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