diff options
author | Marvin Borner | 2020-09-14 20:45:13 +0200 |
---|---|---|
committer | Marvin Borner | 2020-09-14 20:45:13 +0200 |
commit | 1f5c89d908268a0c11a6c49566c2efad4a069860 (patch) | |
tree | 4384cb7c258bc52db74894c5683349272ece3dc5 | |
parent | 096f9be4ac328ae39bd794c36a9a04ff68c2b844 (diff) |
Tracked down 12KiB bug
-rw-r--r-- | boot/load.c | 5 | ||||
-rw-r--r-- | kernel/Makefile | 3 | ||||
-rw-r--r-- | kernel/main.c | 2 | ||||
-rw-r--r-- | libc/Makefile | 2 | ||||
-rw-r--r-- | libc/cpu.c | 5 |
5 files changed, 11 insertions, 6 deletions
diff --git a/boot/load.c b/boot/load.c index 2a77a0d..2bd6028 100644 --- a/boot/load.c +++ b/boot/load.c @@ -142,11 +142,12 @@ int main(void *data) if (entry) { serial_print("Loaded kernel!\n"); entry(data); - return 0; } else { serial_print("Couldn't find kernel!\n"); - return 1; } + while (1) { + }; + return 0; } u8 inb(u16 port) diff --git a/kernel/Makefile b/kernel/Makefile index f91839a..98c17a2 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -7,6 +7,7 @@ COBJS = main.o \ drivers/fpu.o \ drivers/keyboard.o \ drivers/mouse.o \ + drivers/pci.o \ drivers/ide.o \ drivers/timer.o \ features/fs.o \ @@ -20,7 +21,7 @@ LD = ../cross/opt/bin/i686-elf-ld OC = ../cross/opt/bin/i686-elf-objcopy AS = nasm -CFLAGS = -Wall -Wextra -nostdlib -nostdinc -ffreestanding -fno-builtin -fno-asynchronous-unwind-tables -mno-red-zone -mgeneral-regs-only -mpreferred-stack-boundary=2 -std=c99 -m32 -pedantic-errors -Wl,-ekernel_main -I../libc/inc/ -Iinc/ -Dkernel -Os +CFLAGS = -Wall -Wextra -nostdlib -nostdinc -ffreestanding -fno-builtin -fno-asynchronous-unwind-tables -mno-red-zone -mgeneral-regs-only -mpreferred-stack-boundary=2 -std=c99 -m32 -pedantic-errors -Wl,-ekernel_main -I../libc/inc/ -Iinc/ -Dkernel -Ofast ASFLAGS = -f elf32 diff --git a/kernel/main.c b/kernel/main.c index 880c66c..f9cf79f 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -9,6 +9,7 @@ #include <load.h> #include <mem.h> #include <mouse.h> +#include <pci.h> #include <print.h> #include <serial.h> #include <syscall.h> @@ -28,6 +29,7 @@ void kernel_main(struct vid_info *vid_info) // Install drivers acpi_install(); + pci_install(); interrupts_install(); fpu_install(); timer_install(); diff --git a/libc/Makefile b/libc/Makefile index cbc2fc9..39ab1b4 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -16,7 +16,7 @@ LD = ../cross/opt/bin/i686-elf-ld AR = ../cross/opt/bin/i686-elf-ar AS = nasm -CFLAGS = -Wall -Wextra -nostdlib -nostdinc -fno-builtin -fno-asynchronous-unwind-tables -mno-red-zone -mgeneral-regs-only -mpreferred-stack-boundary=2 -std=c99 -m32 -pedantic-errors -Iinc/ -Os +CFLAGS = -Wall -Wextra -nostdlib -nostdinc -fno-builtin -fno-asynchronous-unwind-tables -mno-red-zone -mgeneral-regs-only -mpreferred-stack-boundary=2 -std=c99 -m32 -pedantic-errors -Iinc/ -Ofast ASFLAGS = -f elf32 @@ -54,7 +54,7 @@ void cpuid(int code, u32 *a, u32 *b, u32 *c, u32 *d) __asm__ volatile("cpuid" : "=a"(*a), "=b"(*b), "=c"(*c), "=d"(*d) : "a"(code)); } -char *cpu_string(char buf[12]) +char *cpu_string(char buf[13]) { u32 a, b, c, d; cpuid(CPUID_VENDOR_STRING, &a, &b, &c, &d); @@ -73,12 +73,13 @@ char *cpu_string(char buf[12]) buf[9] = ecx[1]; buf[10] = ecx[2]; buf[11] = ecx[3]; + buf[12] = 0; return buf; } void cpu_print() { - char buf[12] = { 0 }; + char buf[13] = { 0 }; printf("%s\n", cpu_string(buf)); } |