Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

kernel.c 1.7 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * libcaca Colour ASCII-Art library
  3. * Copyright (c) 2006-2012 Sam Hocevar <sam@hocevar.net>
  4. * 2009-2010 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://www.wtfpl.net/ for more details.
  12. */
  13. #include "config.h"
  14. #include "caca_types.h"
  15. #ifdef __KERNEL__
  16. #include "klibc.h"
  17. #include "boot/stage2.h"
  18. #include "kernel.h"
  19. #include "drivers/processor.h"
  20. #include "drivers/floppy.h"
  21. #include "drivers/timer.h"
  22. extern char const * const * caca_get_display_driver_list(void);
  23. extern char end[];
  24. /* C entry point, called from stage2 */
  25. int kmain(void)
  26. {
  27. struct processor_info processor_info;
  28. struct floppy_info floppy_info;
  29. printf("_start at 0x%x\n", _start);
  30. printf("kmain() at 0x%x\n", kmain);
  31. printf("Types : char[%d] short[%d] int[%d] unsigned long long[%d]\n", sizeof(char), sizeof(short), sizeof(int), sizeof(unsigned long long));
  32. enable_interrupt(1); // Enable Keyboard Interrupt (IRQ1)
  33. enable_interrupt(0); // Enable IRQ0 (timer)
  34. enable_interrupt(13);
  35. timer_phase(100); // Fire IRQ0 each 1/100s
  36. processor_get_info(&processor_info);
  37. processor_print_info(&processor_info);
  38. floppy_get_info(&floppy_info);
  39. floppy_print_info(&floppy_info);
  40. /* Caca is delicious */
  41. printf("Filling memory with 0xCACA, starting from 0x%x\n", end);
  42. char *ptr = end;
  43. while (1)
  44. {
  45. *ptr = 0xCA;
  46. *ptr++;
  47. }
  48. }
  49. char end[];
  50. #endif /* __KERNEL__ */