| @@ -57,7 +57,7 @@ gcc $CFLAGS klibc.c -c | |||||
| gcc $CFLAGS kernel.c -c | gcc $CFLAGS kernel.c -c | ||||
| # Link everything but bootsector, kernel.o MUST be at the very end | # 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 | ls -ail kern.bin | ||||
| cd .. | cd .. | ||||
| @@ -85,25 +85,27 @@ void processor_print_info(struct processor_info *processor_info) | |||||
| { | { | ||||
| printf("CPU%d\n", processor_info->id); | printf("CPU%d\n", processor_info->id); | ||||
| printf("Vendor ID : %s\n", processor_info->vendor); | printf("Vendor ID : %s\n", processor_info->vendor); | ||||
| printf("Frequency : "); | |||||
| if (processor_info->frequency > 1000000000) | if (processor_info->frequency > 1000000000) | ||||
| { | { | ||||
| printf("Frequency : ~%dGhz (or something like that)\n", | |||||
| printf("%dGhz", | |||||
| processor_info->frequency / 1000000000); | processor_info->frequency / 1000000000); | ||||
| } | } | ||||
| else if (processor_info->frequency > 1000000) | else if (processor_info->frequency > 1000000) | ||||
| { | { | ||||
| printf("Frequency : ~%dMhz (or something like that)\n", | |||||
| printf("%dMhz", | |||||
| processor_info->frequency / 1000000); | processor_info->frequency / 1000000); | ||||
| } | } | ||||
| else if (processor_info->frequency > 1000) | else if (processor_info->frequency > 1000) | ||||
| { | { | ||||
| printf("Frequency : ~%dKhz (or something like that)\n", | |||||
| printf("%dKhz\n", | |||||
| processor_info->frequency / 1000); | processor_info->frequency / 1000); | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| printf("Frequency : ~%dhz (you must be running Bochs)\n", | |||||
| printf("%dhz\n", | |||||
| processor_info->frequency); | processor_info->frequency); | ||||
| } | } | ||||
| printf(" (or something like that)\n"); | |||||
| printf("Features : 0x%x\n", processor_info->features); | printf("Features : 0x%x\n", processor_info->features); | ||||
| } | } | ||||
| @@ -27,6 +27,7 @@ | |||||
| #include "drivers/timer.h" | #include "drivers/timer.h" | ||||
| extern char const * const * caca_get_display_driver_list(void); | extern char const * const * caca_get_display_driver_list(void); | ||||
| extern char end[]; | |||||
| /* C entry point, called from stage2 */ | /* C entry point, called from stage2 */ | ||||
| int kmain(void) | int kmain(void) | ||||
| @@ -36,7 +37,7 @@ int kmain(void) | |||||
| printf("_start at 0x%x\n", _start); | printf("_start at 0x%x\n", _start); | ||||
| printf("kmain() at 0x%x\n", kmain); | 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(1); // Enable Keyboard Interrupt (IRQ1) | ||||
| enable_interrupt(0); // Enable IRQ0 (timer) | enable_interrupt(0); // Enable IRQ0 (timer) | ||||
| @@ -50,14 +51,17 @@ int kmain(void) | |||||
| floppy_get_info(&floppy_info); | floppy_get_info(&floppy_info); | ||||
| floppy_print_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) | while (1) | ||||
| { | { | ||||
| *ptr = 0xCA; | |||||
| *ptr++; | |||||
| } | } | ||||
| } | } | ||||
| char end[]; | |||||
| #endif /* __KERNEL__ */ | #endif /* __KERNEL__ */ | ||||