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

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

Fix the source code to reduce testsuite errors.

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
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 4300 2010-01-24 21:58:17Z sam $
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
29extern char const * const * caca_get_display_driver_list(void);
30extern char end[];
31
32/* C entry point, called from stage2 */
33int 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
65char end[];
66
67#endif /* __KERNEL__ */
Note: See TracBrowser for help on using the repository browser.