maybe breaking alot here.

This commit is contained in:
Jonathan Turner 2023-11-29 17:35:59 -05:00
parent 51b1572b45
commit 7a21ede18d
3 changed files with 16 additions and 7 deletions

View File

@ -127,7 +127,7 @@
void update_memory_holes(node *umen_head) { void update_memory_holes(node *umen_head) {
// Assume there's a global variable to store the head of the holes list // 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; u32 last_end_addr = 0;
// Traverse the allocated memory nodes // Traverse the allocated memory nodes
@ -136,7 +136,7 @@
// This is a hole in memory // This is a hole in memory
if (last_end_addr < umen_head->start_addr) { if (last_end_addr < umen_head->start_addr) {
// Create a new hole node // 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->start_addr = last_end_addr;
hole_node->size = umen_head->start_addr - last_end_addr; hole_node->size = umen_head->start_addr - last_end_addr;
hole_node->is_allocated = false; hole_node->is_allocated = false;
@ -155,7 +155,7 @@
// Update the holes list in your global data structure or print it, etc. // Update the holes list in your global data structure or print it, etc.
// holes_head now represents the list of memory holes // 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) { int digit_conver(const char *hexString) {
u32 result = 0; u32 result = 0;
while (*hexString != '\0') { while (*hexString != '\0') {

View File

@ -10,6 +10,7 @@
#include "../libc/linked.h" #include "../libc/linked.h"
void user_input(char *input); void user_input(char *input);
void print_mem_map(node *enum_head);
int digit_len(unsigned digit); int digit_len(unsigned digit);
int digit_conver(const char *str); int digit_conver(const char *str);

View File

@ -465,10 +465,7 @@ void print_list( node *head, bool ft_descending_ascending)
node *iterator = NULL; node *iterator = NULL;
if( ft_descending_ascending) { if( ft_descending_ascending) {
iterator = head; iterator = head;
while( iterator != NULL) {
print_node( iterator);
iterator = iterator->next;
}
} else { } else {
iterator = get_tail( head); iterator = get_tail( head);
while( iterator != NULL) { while( iterator != NULL) {