25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

68 satır
1.8 KiB

  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$
  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. #include "config.h"
  17. #include "caca_types.h"
  18. #ifdef __KERNEL__
  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. extern char const * const * caca_get_display_driver_list(void);
  26. extern char end[];
  27. /* C entry point, called from stage2 */
  28. int kmain(void)
  29. {
  30. struct processor_info processor_info;
  31. struct floppy_info floppy_info;
  32. printf("_start at 0x%x\n", _start);
  33. printf("kmain() at 0x%x\n", kmain);
  34. printf("Types : char[%d] short[%d] int[%d] unsigned long long[%d]\n", sizeof(char), sizeof(short), sizeof(int), sizeof(unsigned long long));
  35. enable_interrupt(1); // Enable Keyboard Interrupt (IRQ1)
  36. enable_interrupt(0); // Enable IRQ0 (timer)
  37. enable_interrupt(13);
  38. timer_phase(100); // Fire IRQ0 each 1/100s
  39. processor_get_info(&processor_info);
  40. processor_print_info(&processor_info);
  41. floppy_get_info(&floppy_info);
  42. floppy_print_info(&floppy_info);
  43. /* Caca is delicious */
  44. printf("Filling memory with 0xCACA, starting from 0x%x\n", end);
  45. char *ptr = end;
  46. while (1)
  47. {
  48. *ptr = 0xCA;
  49. *ptr++;
  50. }
  51. }
  52. char end[];
  53. #endif /* __KERNEL__ */