diff --git a/Part3/09_memory/kernel/kernel.c b/Part3/09_memory/kernel/kernel.c index a0e824b..ad634f7 100644 --- a/Part3/09_memory/kernel/kernel.c +++ b/Part3/09_memory/kernel/kernel.c @@ -127,7 +127,7 @@ 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; + node *holes_head = NULL; u32 last_end_addr = 0; // Traverse the allocated memory nodes @@ -136,7 +136,7 @@ // 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)); + 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; @@ -155,7 +155,7 @@ // Update the holes list in your global data structure or print it, etc. // holes_head now represents the list of memory holes - print_holes(holes_head); + print_list(holes_head); } @@ -173,6 +173,17 @@ } + 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 390b86c..aef92c7 100644 --- a/Part3/09_memory/kernel/kernel.h +++ b/Part3/09_memory/kernel/kernel.h @@ -10,6 +10,7 @@ #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); diff --git a/Part3/09_memory/libc/linked.c b/Part3/09_memory/libc/linked.c index e0168b9..e5abc05 100644 --- a/Part3/09_memory/libc/linked.c +++ b/Part3/09_memory/libc/linked.c @@ -465,10 +465,7 @@ void print_list( node *head, bool ft_descending_ascending) node *iterator = NULL; if( ft_descending_ascending) { iterator = head; - while( iterator != NULL) { - print_node( iterator); - iterator = iterator->next; - } + } else { iterator = get_tail( head); while( iterator != NULL) {