Testing add method with providing base and size.

This commit is contained in:
Jonathan Turner 2023-11-29 07:33:09 -05:00
parent 15fd2420d5
commit bb199ce587

View File

@ -35,8 +35,21 @@ void user_input(char *input) {
if (strcmp(input, "END") == 0) { if (strcmp(input, "END") == 0) {
kprint("Stopping the CPU. Bye!\n"); kprint("Stopping the CPU. Bye!\n");
asm volatile("hlt"); asm volatile("hlt");
} else if (strcmp(input, "ADD") == 0) { // } else if (strcmp(input, "ADD") == 0) {
umem_head = add_node( umem_head, 0x10000, 0x100, true, global_id++); // umem_head = add_node( umem_head, 0x10000, 0x100, true, global_id++);
// }
} else if (strncmp(input, "ADD", 3) == 0) {
// Extract size and offset from the input
char size_str[10];
char offset_str[10];
sscanf(input, "ADD %s %s", size_str, offset_str);
// Convert size and offset to integers
u32 size = atoi(size_str);
u32 offset = atoi(offset_str);
// Add the node with the specified base register
umem_head = add_node(umem_head, offset, size, true, global_id++);
} else if (strcmp(input, "LIST") == 0) { } else if (strcmp(input, "LIST") == 0) {
kprint("***** FORWARD ****\n"); kprint("***** FORWARD ****\n");
print_list( umem_head, true); print_list( umem_head, true);