maybe?
This commit is contained in:
parent
7a21ede18d
commit
7448b59251
@ -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') {
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user