| 1 |
/* |
| 2 |
* libcaca Colour ASCII-Art library |
| 3 |
* Copyright (c) 2006-2012 Sam Hocevar <[email protected]> |
| 4 |
* 2009-2010 Jean-Yves Lamoureux <[email protected]> |
| 5 |
* All Rights Reserved |
| 6 |
* |
| 7 |
* This library is free software. It comes without any warranty, to |
| 8 |
* the extent permitted by applicable law. You can redistribute it |
| 9 |
* and/or modify it under the terms of the Do What the Fuck You Want |
| 10 |
* to Public License, Version 2, as published by Sam Hocevar. See |
| 11 |
* http://www.wtfpl.net/ for more details. |
| 12 |
*/ |
| 13 |
|
| 14 |
#include "config.h" |
| 15 |
#include "caca_types.h" |
| 16 |
|
| 17 |
#ifdef __KERNEL__ |
| 18 |
|
| 19 |
#include "klibc.h" |
| 20 |
#include "boot/stage2.h" |
| 21 |
#include "kernel.h" |
| 22 |
#include "drivers/processor.h" |
| 23 |
#include "drivers/floppy.h" |
| 24 |
#include "drivers/timer.h" |
| 25 |
|
| 26 |
extern char const * const * caca_get_display_driver_list(void); |
| 27 |
extern char end[]; |
| 28 |
|
| 29 |
/* C entry point, called from stage2 */ |
| 30 |
int kmain(void) |
| 31 |
{ |
| 32 |
struct processor_info processor_info; |
| 33 |
struct floppy_info floppy_info; |
| 34 |
|
| 35 |
printf("_start at 0x%x\n", _start); |
| 36 |
printf("kmain() at 0x%x\n", kmain); |
| 37 |
printf("Types : char[%d] short[%d] int[%d] unsigned long long[%d]\n", sizeof(char), sizeof(short), sizeof(int), sizeof(unsigned long long)); |
| 38 |
|
| 39 |
enable_interrupt(1); // Enable Keyboard Interrupt (IRQ1) |
| 40 |
enable_interrupt(0); // Enable IRQ0 (timer) |
| 41 |
enable_interrupt(13); |
| 42 |
timer_phase(100); // Fire IRQ0 each 1/100s |
| 43 |
|
| 44 |
|
| 45 |
processor_get_info(&processor_info); |
| 46 |
processor_print_info(&processor_info); |
| 47 |
|
| 48 |
floppy_get_info(&floppy_info); |
| 49 |
floppy_print_info(&floppy_info); |
| 50 |
|
| 51 |
/* Caca is delicious */ |
| 52 |
printf("Filling memory with 0xCACA, starting from 0x%x\n", end); |
| 53 |
|
| 54 |
char *ptr = end; |
| 55 |
while (1) |
| 56 |
{ |
| 57 |
*ptr = 0xCA; |
| 58 |
*ptr++; |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
char end[]; |
| 63 |
|
| 64 |
#endif /* __KERNEL__ */ |