From 95c037106514ea16bae1b2fac88003a86aec76b6 Mon Sep 17 00:00:00 2001 From: Robbe Van Herck Date: Fri, 10 Jan 2020 09:48:21 +0100 Subject: [PATCH] Fix shift state and address BSS issue --- docs/bootloader.md | 4 ++-- kernel/drivers/keyboard/keyboard.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/bootloader.md b/docs/bootloader.md index 26c7344..ac4dc75 100644 --- a/docs/bootloader.md +++ b/docs/bootloader.md @@ -63,6 +63,6 @@ As I don't quite get how segments work in real mode, there are most likely error I reserve 32KiB of SFS reserved area for the ELF file of the kernel. This is currently for "historic reasons" (a.k.a. I'm too lazy to load the filesystem in the bootloader). The kernel then handles the filesystem. -### Second ELF program header does not get loaded +### BSS does not get cleared -This will most likely fix the issue of missing global strings. +I do calculate the size of the BSS, so either I intialize every variable in a function or things like global variables that are false by default don't work. It does work in emulators because they initialize all memory to 0, but real computerss don't always do that. diff --git a/kernel/drivers/keyboard/keyboard.c b/kernel/drivers/keyboard/keyboard.c index 4785aff..a71dc66 100644 --- a/kernel/drivers/keyboard/keyboard.c +++ b/kernel/drivers/keyboard/keyboard.c @@ -10,8 +10,8 @@ #define KEY_QUEUE_EMPTY FIFO_QUEUE_EMPTY -bool keyboard_shift_state = false; -bool keyboard_caps_state = false; +bool keyboard_shift_state; +bool keyboard_caps_state; fifo* key_queue = NULL; @@ -72,6 +72,8 @@ char getchar() { } void keyboard_init() { + keyboard_shift_state = false; + keyboard_caps_state = false; key_queue = fifo_new(); uint8_t mask = inb(0x21);