if this works imma jump

This commit is contained in:
Jonathan Turner 2023-11-29 10:07:20 -05:00
parent 48f81212b3
commit 331cfdee21

View File

@ -36,20 +36,28 @@
kprint("Stopping the CPU. Bye!\n"); kprint("Stopping the CPU. Bye!\n");
asm volatile("hlt"); asm volatile("hlt");
} else if (strncmp(input, "ADD", 3) == 0) { } else if (strncmp(input, "ADD", 3) == 0) {
u32 base = 0x10000;
u32 limit = 0x100;
bool valid = true;
if (sstrlen(input, 15) > 4) { if (sstrlen(input, 15) > 4) {
char *number = input + 4; char *args1 = input + 4;
u32 result = digit_conver(number); base = digit_conver(args1);
int nDigits = digit_len(result); int nDigits = digit_len(base);
if (sstrlen(number, 15) > nDigits + 4) { if (sstrlen(args1, 15) > nDigits + 1) {
kprint("There is a limit"); char *args2 = args1 + nDigits;
limit = digit_conver(args2);
if (limit < 100) {
kprint("That memory address is to below the min of 0x100.");
valid = false;
}
} }
if (result < 10000) { if (base < 10000) {
kprint("That memory address is reserved by the Kernel, addresses must be 10000+"); kprint("That memory address is reserved by the Kernel, addresses must be 10000+");
} else { valid = false;
umem_head = add_node( umem_head, result, 0x100, true, global_id++);
} }
} else { }
umem_head = add_node( umem_head, 0x10000, 0x100, true, global_id++); if (valid) {
umem_head = add_node( umem_head, base, limit, true, global_id++);
} }
} else if (strcmp(input, "LIST") == 0) { } else if (strcmp(input, "LIST") == 0) {
kprint("***** FORWARD ****\n"); kprint("***** FORWARD ****\n");