From 1fc5225fd2e6b1c577ad1a59017239ccead80c32 Mon Sep 17 00:00:00 2001 From: xamidev Date: Tue, 31 Mar 2026 17:48:11 +0200 Subject: [PATCH] kheap info --- include/{mem => arch}/gdt.h | 0 include/mem/kheap.h | 1 + include/sched/spinlock.h | 2 +- include/security/ubsan.h | 1 - src/{mem => arch/x86}/gdt.c | 2 +- src/arch/x86/init.c | 2 +- src/io/kbd/ps2.c | 20 +++++++++++++------- src/kapps/kshell.c | 9 ++++++++- src/kmain.c | 2 +- src/mem/kheap.c | 29 +++++++++++++++++++++++++++++ src/sched/process.c | 4 ++-- 11 files changed, 57 insertions(+), 15 deletions(-) rename include/{mem => arch}/gdt.h (100%) rename src/{mem => arch/x86}/gdt.c (99%) diff --git a/include/mem/gdt.h b/include/arch/gdt.h similarity index 100% rename from include/mem/gdt.h rename to include/arch/gdt.h diff --git a/include/mem/kheap.h b/include/mem/kheap.h index ee4672d..52a9fb7 100644 --- a/include/mem/kheap.h +++ b/include/mem/kheap.h @@ -28,5 +28,6 @@ void* kmalloc(size_t size); void kfree(void* ptr); void* kalloc_stack(void); void kheap_map_page(void); +void kheap_info(); #endif \ No newline at end of file diff --git a/include/sched/spinlock.h b/include/sched/spinlock.h index 849d99d..fabf089 100644 --- a/include/sched/spinlock.h +++ b/include/sched/spinlock.h @@ -1,4 +1,4 @@ -/* + /* * @author xamidev * @brief Spinlock implementation * @license GPL-3.0-only diff --git a/include/security/ubsan.h b/include/security/ubsan.h index 6f2609a..0282a02 100644 --- a/include/security/ubsan.h +++ b/include/security/ubsan.h @@ -62,5 +62,4 @@ struct ubsan_overflow_data struct ubsan_type_descriptor* type; }; - #endif \ No newline at end of file diff --git a/src/mem/gdt.c b/src/arch/x86/gdt.c similarity index 99% rename from src/mem/gdt.c rename to src/arch/x86/gdt.c index 3fe0c06..54dd6fc 100644 --- a/src/mem/gdt.c +++ b/src/arch/x86/gdt.c @@ -4,7 +4,7 @@ * @license GPL-3.0-only */ -#include +#include #include #include #include diff --git a/src/arch/x86/init.c b/src/arch/x86/init.c index bc4b461..040ddf1 100644 --- a/src/arch/x86/init.c +++ b/src/arch/x86/init.c @@ -4,7 +4,7 @@ * @license GPL-3.0-only */ -#include +#include #include #include #include diff --git a/src/io/kbd/ps2.c b/src/io/kbd/ps2.c index aea8c13..b9029d8 100644 --- a/src/io/kbd/ps2.c +++ b/src/io/kbd/ps2.c @@ -289,15 +289,21 @@ int keyboard_getline(char* output, size_t size) // Read until Enter is pressed while ((c = keyboard_getchar()) != 0x0A) { - if (index == size-1) { - output[index] = c; - output[index+1] = '\0'; - return index; + if (c == '\b') { + if (index > 0) { + index--; + output[index] = '\0'; + printf(" \b"); + } + continue; } - output[index] = c; - index++; + + if (index >= size-1) { + continue; + } + output[index++] = c; } - output[index+1] = '\0'; + output[index] = '\0'; return index; } diff --git a/src/kapps/kshell.c b/src/kapps/kshell.c index e1ed05b..f4a6852 100644 --- a/src/kapps/kshell.c +++ b/src/kapps/kshell.c @@ -11,6 +11,7 @@ #include #include #include