diff --git a/Part3/09_memory/kernel/kernel.c b/Part3/09_memory/kernel/kernel.c index ad634f7..0a806e6 100644 --- a/Part3/09_memory/kernel/kernel.c +++ b/Part3/09_memory/kernel/kernel.c @@ -125,40 +125,6 @@ kprint("> "); } - void update_memory_holes(node *umen_head) { - // Assume there's a global variable to store the head of the holes list - node *holes_head = NULL; - u32 last_end_addr = 0; - - // Traverse the allocated memory nodes - while (umen_head != NULL) { - if (!umen_head->is_allocated) { - // This is a hole in memory - if (last_end_addr < umen_head->start_addr) { - // Create a new hole node - node *hole_node = (Node *)malloc(sizeof(Node)); - hole_node->start_addr = last_end_addr; - hole_node->size = umen_head->start_addr - last_end_addr; - hole_node->is_allocated = false; - - // Insert the hole node at the beginning of the holes list - hole_node->next = holes_head; - holes_head = hole_node; - } - - // Update the last end address - last_end_addr = umen_head->start_addr + umen_head->size; - } - - umen_head = umen_head->next; - } - - // Update the holes list in your global data structure or print it, etc. - // holes_head now represents the list of memory holes - print_list(holes_head); - } - - int digit_len(unsigned digit) { if (digit >= 1000000000) return 10; if (digit >= 100000000) return 9; @@ -172,18 +138,6 @@ return 1; } - - void print_mem_map(node *enum_head) { - // u32 kernal_max = 0x10000; - // node *iterator = enum_head; - // node kernel = - // while( iterator != NULL) { - // print_node( iterator); - // iterator = iterator->previous; - // } - // return; - } - int digit_conver(const char *hexString) { u32 result = 0; while (*hexString != '\0') { diff --git a/Part3/09_memory/kernel/kernel.h b/Part3/09_memory/kernel/kernel.h index aef92c7..390b86c 100644 --- a/Part3/09_memory/kernel/kernel.h +++ b/Part3/09_memory/kernel/kernel.h @@ -10,7 +10,6 @@ #include "../libc/linked.h" void user_input(char *input); -void print_mem_map(node *enum_head); int digit_len(unsigned digit); int digit_conver(const char *str);