source: libcaca/trunk/kernel/kernel.c @ 4333

Last change on this file since 4333 was 4333, checked in by Sam Hocevar, 10 years ago

Large source code cleanup, getting rid of spaces, tabs, and svn keywords.

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1/*
2 *  libcaca       Colour ASCII-Art library
3 *  Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
4 *                2009 Jean-Yves Lamoureux <jylam@lnxscene.org>
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://sam.zoy.org/wtfpl/COPYING 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
26extern char const * const * caca_get_display_driver_list(void);
27extern char end[];
28
29/* C entry point, called from stage2 */
30int 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
62char end[];
63
64#endif /* __KERNEL__ */
Note: See TracBrowser for help on using the repository browser.