Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Etherboot routines for PCBIOS firmware.
  2. *
  3. * Body of routines taken from old pcbios.S
  4. */
  5. #include "stdint.h"
  6. #include "realmode.h"
  7. #define BIOS_DATA_SEG 0x0040
  8. #define CF ( 1 << 0 )
  9. /**************************************************************************
  10. CURRTICKS - Get Time
  11. Use direct memory access to BIOS variables, longword 0040:006C (ticks
  12. today) and byte 0040:0070 (midnight crossover flag) instead of calling
  13. timeofday BIOS interrupt.
  14. **************************************************************************/
  15. #if defined(CONFIG_TSC_CURRTICKS)
  16. #undef CONFIG_BIOS_CURRTICKS
  17. #else
  18. #define CONFIG_BIOS_CURRTICKS 1
  19. #endif
  20. #if defined(CONFIG_BIOS_CURRTICKS)
  21. unsigned long currticks ( void ) {
  22. static uint32_t days = 0;
  23. uint32_t ticks;
  24. uint8_t midnight;
  25. /* Re-enable interrupts so that the timer interrupt can occur
  26. */
  27. REAL_EXEC ( rm_currticks,
  28. "sti\n\t"
  29. "nop\n\t"
  30. "nop\n\t"
  31. "cli\n\t",
  32. 0,
  33. OUT_CONSTRAINTS (),
  34. IN_CONSTRAINTS (),
  35. CLOBBER ( "eax" ) ); /* can't have an empty clobber list */
  36. get_real ( ticks, BIOS_DATA_SEG, 0x006c );
  37. get_real ( midnight, BIOS_DATA_SEG, 0x0070 );
  38. if ( midnight ) {
  39. midnight = 0;
  40. put_real ( midnight, BIOS_DATA_SEG, 0x0070 );
  41. days += 0x1800b0;
  42. }
  43. return ( days + ticks );
  44. }
  45. #endif /* CONFIG_BIOS_CURRTICKS */
  46. /**************************************************************************
  47. CPU_NAP - Save power by halting the CPU until the next interrupt
  48. **************************************************************************/
  49. void cpu_nap ( void ) {
  50. REAL_EXEC ( rm_cpu_nap,
  51. "sti\n\t"
  52. "hlt\n\t"
  53. "cli\n\t",
  54. 0,
  55. OUT_CONSTRAINTS (),
  56. IN_CONSTRAINTS (),
  57. CLOBBER ( "eax" ) ); /* can't have an empty clobber list */
  58. }