Selaa lähdekoodia

* Fix libcaca.a linkage (was off by one argument), fill memory with 0xCACA, because caca is so delicious.

tags/v0.99.beta17
Jean-Yves Lamoureux jylam 15 vuotta sitten
vanhempi
commit
7c311ae374
3 muutettua tiedostoa jossa 15 lisäystä ja 9 poistoa
  1. +1
    -1
      build-kernel
  2. +6
    -4
      kernel/drivers/processor.c
  3. +8
    -4
      kernel/kernel.c

+ 1
- 1
build-kernel Näytä tiedosto

@@ -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 ..


+ 6
- 4
kernel/drivers/processor.c Näytä tiedosto

@@ -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);
}

+ 8
- 4
kernel/kernel.c Näytä tiedosto

@@ -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__ */

Ladataan…
Peruuta
Tallenna