From 7c311ae374888309d54fe29040a6b41be30d2fd1 Mon Sep 17 00:00:00 2001 From: Jean-Yves Lamoureux Date: Sun, 20 Dec 2009 16:29:24 +0000 Subject: [PATCH] * Fix libcaca.a linkage (was off by one argument), fill memory with 0xCACA, because caca is so delicious. --- build-kernel | 2 +- kernel/drivers/processor.c | 10 ++++++---- kernel/kernel.c | 12 ++++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/build-kernel b/build-kernel index c716abb..2fc5a60 100755 --- a/build-kernel +++ b/build-kernel @@ -57,7 +57,7 @@ gcc $CFLAGS klibc.c -c gcc $CFLAGS kernel.c -c # Link everything but bootsector, kernel.o MUST be at the very end -ld --oformat binary -Ttext 1000 stage2.o gdt.o pic.o int.o idt.o interruptions.o keyboard.o memory.o timer.o floppy.o processor.o klibc.o kernel.o -Map kernel.map ../caca/.libs/libcaca.a -o kern.bin +ld --oformat binary -Ttext 1000 stage2.o gdt.o pic.o int.o idt.o interruptions.o keyboard.o memory.o timer.o floppy.o processor.o klibc.o kernel.o ../caca/.libs/libcaca.a -Map kernel.map -o kern.bin ls -ail kern.bin cd .. diff --git a/kernel/drivers/processor.c b/kernel/drivers/processor.c index a020356..72c9596 100644 --- a/kernel/drivers/processor.c +++ b/kernel/drivers/processor.c @@ -85,25 +85,27 @@ void processor_print_info(struct processor_info *processor_info) { printf("CPU%d\n", processor_info->id); printf("Vendor ID : %s\n", processor_info->vendor); + printf("Frequency : "); if (processor_info->frequency > 1000000000) { - printf("Frequency : ~%dGhz (or something like that)\n", + printf("%dGhz", processor_info->frequency / 1000000000); } else if (processor_info->frequency > 1000000) { - printf("Frequency : ~%dMhz (or something like that)\n", + printf("%dMhz", processor_info->frequency / 1000000); } else if (processor_info->frequency > 1000) { - printf("Frequency : ~%dKhz (or something like that)\n", + printf("%dKhz\n", processor_info->frequency / 1000); } else { - printf("Frequency : ~%dhz (you must be running Bochs)\n", + printf("%dhz\n", processor_info->frequency); } + printf(" (or something like that)\n"); printf("Features : 0x%x\n", processor_info->features); } diff --git a/kernel/kernel.c b/kernel/kernel.c index 52df1e6..2bdac1f 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -27,6 +27,7 @@ #include "drivers/timer.h" extern char const * const * caca_get_display_driver_list(void); +extern char end[]; /* C entry point, called from stage2 */ int kmain(void) @@ -36,7 +37,7 @@ int kmain(void) printf("_start at 0x%x\n", _start); printf("kmain() at 0x%x\n", kmain); - printf("Types : char[%d] int[%d] long[%d] unsigned long long[%d]\n", sizeof(char), sizeof(int), sizeof(long), sizeof(unsigned long long)); + printf("Types : char[%d] short[%d] int[%d] unsigned long long[%d]\n", sizeof(char), sizeof(short), sizeof(int), sizeof(unsigned long long)); enable_interrupt(1); // Enable Keyboard Interrupt (IRQ1) enable_interrupt(0); // Enable IRQ0 (timer) @@ -50,14 +51,17 @@ int kmain(void) floppy_get_info(&floppy_info); floppy_print_info(&floppy_info); - //caca_get_display_driver_list(); - printf("Entering kernel infinite loop.\n"); + /* Caca is delicious */ + printf("Filling memory with 0xCACA, starting from 0x%x\n", end); + char *ptr = end; while (1) { - + *ptr = 0xCA; + *ptr++; } } +char end[]; #endif /* __KERNEL__ */