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

Last change on this file since 4235 was 4160, checked in by Jean-Yves Lamoureux, 10 years ago
  • Fix libcaca.a linkage (was off by one argument), fill memory with 0xCACA, because caca is so delicious.
  • Property svn:keywords set to Id
File size: 1.8 KB
RevLine 
[4158]1/*
2 *  libcaca       
[672]3 *  libcaca       Colour ASCII-Art library
[4158]4 *  Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
5 *                2009 Jean-Yves Lamoureux <jylam@lnxscene.org>
[568]6 *                All Rights Reserved
7 *
[769]8 *  $Id: kernel.c 4160 2009-12-20 16:29:24Z jylam $
9 *
[1462]10 *  This library is free software. It comes without any warranty, to
[1452]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
[568]14 *  http://sam.zoy.org/wtfpl/COPYING for more details.
15 */
16
17#include "config.h"
[2821]18#include "caca_types.h"
[2299]19
[568]20#ifdef __KERNEL__
21
[4154]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"
[589]28
[4154]29extern char const * const * caca_get_display_driver_list(void);
[4160]30extern char end[];
[1048]31
[4154]32/* C entry point, called from stage2 */
33int kmain(void)
[568]34{
[4154]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);
[4160]40    printf("Types : char[%d] short[%d] int[%d] unsigned long long[%d]\n", sizeof(char), sizeof(short), sizeof(int), sizeof(unsigned long long));
[4154]41   
[4159]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   
[4154]48    processor_get_info(&processor_info);
49    processor_print_info(&processor_info);
[573]50
[4154]51    floppy_get_info(&floppy_info);
52    floppy_print_info(&floppy_info);
[573]53
[4160]54    /* Caca is delicious */
55    printf("Filling memory with 0xCACA, starting from 0x%x\n", end);
[4154]56   
[4160]57    char *ptr = end;
[4154]58    while (1)
[664]59    {
[4160]60        *ptr = 0xCA;
61        *ptr++;
[664]62    }
[568]63}
64
[4160]65char end[];
[568]66
67#endif /* __KERNEL__ */
Note: See TracBrowser for help on using the repository browser.