Long shot
This commit is contained in:
parent
19419cc649
commit
abbf714841
@ -46,10 +46,6 @@
|
|||||||
if (sstrlen(args1, 15) > nDigits + 1) {
|
if (sstrlen(args1, 15) > nDigits + 1) {
|
||||||
char *args2 = args1 + nDigits + 1;
|
char *args2 = args1 + nDigits + 1;
|
||||||
limit = digit_conver(args2);
|
limit = digit_conver(args2);
|
||||||
if (limit < 100) {
|
|
||||||
kprint("That memory address is to below the min of 0x100.\n");
|
|
||||||
valid = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (base < 10000) {
|
if (base < 10000) {
|
||||||
kprint("That memory address is reserved by the Kernel, addresses must be 10000+\n");
|
kprint("That memory address is reserved by the Kernel, addresses must be 10000+\n");
|
||||||
@ -193,7 +189,7 @@ void print_memory(node *umem_head, node *hole_head) {
|
|||||||
|
|
||||||
total_allocated = (total_allocated+1)/(0x400);
|
total_allocated = (total_allocated+1)/(0x400);
|
||||||
char c[16];
|
char c[16];
|
||||||
int_to_ascii( total_allocated-64, c, 16);
|
int_to_ascii( total_allocated, c, 16);
|
||||||
kprint("Total Allocated: ");
|
kprint("Total Allocated: ");
|
||||||
kprint(c);
|
kprint(c);
|
||||||
kprint("kb\n");
|
kprint("kb\n");
|
||||||
@ -215,8 +211,8 @@ void print_memory(node *umem_head, node *hole_head) {
|
|||||||
|
|
||||||
node* get_holes(node* umem_head) {
|
node* get_holes(node* umem_head) {
|
||||||
if (umem_head == NULL) {
|
if (umem_head == NULL) {
|
||||||
kprint("Holes list is Empty\n");
|
node *hole = add_node(hole, 0x10000, 0x3FFFF, true, 0);
|
||||||
return NULL;
|
return hole;
|
||||||
}
|
}
|
||||||
u32 hole_ids = 0;
|
u32 hole_ids = 0;
|
||||||
node *hole = NULL;
|
node *hole = NULL;
|
||||||
@ -235,3 +231,29 @@ node* get_holes(node* umem_head) {
|
|||||||
}
|
}
|
||||||
return hole;
|
return hole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void begin_output_example() {
|
||||||
|
static u32 delete_id = 0; // static persistent variable for incrementing during test
|
||||||
|
static node* umem_head = NULL; // static persistent head variable for contiguous block allocations
|
||||||
|
static node* hole_head = get_holes(umem_head);
|
||||||
|
|
||||||
|
kprint("Jonathan Turner - S02\n");
|
||||||
|
kprint("Current Allocation: \n");
|
||||||
|
print_memory(umem_head, holes_head);
|
||||||
|
umem_head = add_node( umem_head, 0x10000, 0x3FF, true, global_id++);
|
||||||
|
umem_head = add_node( umem_head, 0x11000, 0x1FF, true, global_id++);
|
||||||
|
umem_head = add_node( umem_head, 0x12000, 0x3FF, true, global_id++);
|
||||||
|
umem_head = add_node( umem_head, 0x15000, 0x7FF, true, global_id++);
|
||||||
|
umem_head = add_node( umem_head, 0x22000, 0x1FFF, true, global_id++);
|
||||||
|
print_memory(umem_head, holes_head);
|
||||||
|
node* temp = umem_head->next;
|
||||||
|
free_node(umem_head);
|
||||||
|
umem_head = temp;
|
||||||
|
umem_head->previous = NULL;
|
||||||
|
print_memory(umem_head, holes_head);
|
||||||
|
temp = get_tail(umem_head);
|
||||||
|
temp->previous = NULL;
|
||||||
|
free_node(temp);
|
||||||
|
print_memory(umem_head, holes_head);
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user