From f25003e0d6938bc7af4299965f2993ce7758800c Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Wed, 29 Nov 2023 08:09:57 -0500 Subject: [PATCH] maybe? --- Part3/09_memory/kernel/kernel.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Part3/09_memory/kernel/kernel.c b/Part3/09_memory/kernel/kernel.c index 9bd24b6..cfe65ac 100644 --- a/Part3/09_memory/kernel/kernel.c +++ b/Part3/09_memory/kernel/kernel.c @@ -47,20 +47,14 @@ void user_input(char *input) { char base_str[16]; // Get input from your input source (you need to implement this) - get_input(base_str); + strncpy(base_str, input + 3, sizeof(base_str) - 1); // Skip the command part + base_str[sizeof(base_str) - 1] = '\0'; // Null-terminate the base_str - // Check if the input matches the expected message - if (strcmp(base_str, "Enter base register value: ") == 0) { - // Input matches, proceed to read the value - get_input(base_str); // Assuming get_input reads the actual value - u32 base = digit_conver(base_str); + // Convert base_str to an integer (you need a suitable conversion function) + u32 base = digit_conver(base_str); - umem_head = add_node(umem_head, base, 0x100, true, global_id++); - } else { - // Input doesn't match the expected message - kprint("Invalid input format.\n"); - // Handle the error or prompt the user again - } + // Now you have the base register input, and you can use it as needed + umem_head = add_node(umem_head, base, 0x100, true, global_id++); } else if (strcmp(input, "LIST") == 0) { kprint("***** FORWARD ****\n"); print_list( umem_head, true);