You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

comboot.h 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #ifndef COMBOOT_H
  2. #define COMBOOT_H
  3. /**
  4. * @file
  5. *
  6. * SYSLINUX COMBOOT
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER );
  9. #include <stdint.h>
  10. #include <setjmp.h>
  11. #include <ipxe/in.h>
  12. /** Segment used for COMBOOT PSP and image */
  13. #define COMBOOT_PSP_SEG 0x07C0
  14. /** Entry point address of COM32 images */
  15. #define COM32_START_PHYS 0x101000
  16. /** COM32 bounce buffer segment */
  17. #define COM32_BOUNCE_SEG 0x07C0
  18. /** Size of SYSLINUX file block in bytes */
  19. #define COMBOOT_FILE_BLOCKSZ 512
  20. /** COMBOOT feature flags (INT 22h AX=15h) */
  21. #define COMBOOT_FEATURE_LOCAL_BOOT (1 << 0)
  22. #define COMBOOT_FEATURE_IDLE_LOOP (1 << 1)
  23. /** Maximum number of shuffle descriptors for
  24. * shuffle and boot functions
  25. * (INT 22h AX=0012h, 001Ah, 001Bh)
  26. */
  27. #define COMBOOT_MAX_SHUFFLE_DESCRIPTORS 682
  28. typedef union {
  29. uint32_t l;
  30. uint16_t w[2];
  31. uint8_t b[4];
  32. } com32_reg32_t;
  33. typedef struct {
  34. uint16_t gs; /* Offset 0 */
  35. uint16_t fs; /* Offset 2 */
  36. uint16_t es; /* Offset 4 */
  37. uint16_t ds; /* Offset 6 */
  38. com32_reg32_t edi; /* Offset 8 */
  39. com32_reg32_t esi; /* Offset 12 */
  40. com32_reg32_t ebp; /* Offset 16 */
  41. com32_reg32_t _unused_esp; /* Offset 20 */
  42. com32_reg32_t ebx; /* Offset 24 */
  43. com32_reg32_t edx; /* Offset 28 */
  44. com32_reg32_t ecx; /* Offset 32 */
  45. com32_reg32_t eax; /* Offset 36 */
  46. com32_reg32_t eflags; /* Offset 40 */
  47. } com32sys_t;
  48. typedef struct {
  49. uint32_t eax; /* Offset 0 */
  50. uint32_t ecx; /* Offset 4 */
  51. uint32_t edx; /* Offset 8 */
  52. uint32_t ebx; /* Offset 12 */
  53. uint32_t esp; /* Offset 16 */
  54. uint32_t ebp; /* Offset 20 */
  55. uint32_t esi; /* Offset 24 */
  56. uint32_t edi; /* Offset 28 */
  57. uint32_t eip; /* Offset 32 */
  58. } syslinux_pm_regs;
  59. typedef struct {
  60. uint16_t es; /* Offset 0 */
  61. uint16_t _unused_cs; /* Offset 2 */
  62. uint16_t ds; /* Offset 4 */
  63. uint16_t ss; /* Offset 6 */
  64. uint16_t fs; /* Offset 8 */
  65. uint16_t gs; /* Offset 10 */
  66. uint32_t eax; /* Offset 12 */
  67. uint32_t ecx; /* Offset 16 */
  68. uint32_t edx; /* Offset 20 */
  69. uint32_t ebx; /* Offset 24 */
  70. uint32_t esp; /* Offset 28 */
  71. uint32_t ebp; /* Offset 32 */
  72. uint32_t esi; /* Offset 36 */
  73. uint32_t edi; /* Offset 40 */
  74. uint16_t ip; /* Offset 44 */
  75. uint16_t cs; /* Offset 46 */
  76. } syslinux_rm_regs;
  77. typedef struct {
  78. uint32_t dest;
  79. uint32_t src;
  80. uint32_t len;
  81. } comboot_shuffle_descriptor;
  82. extern void hook_comboot_interrupts ( );
  83. extern void unhook_comboot_interrupts ( );
  84. /* These are not the correct prototypes, but it doens't matter,
  85. * as we only ever get the address of these functions;
  86. * they are only called from COM32 code running in PHYS_CODE
  87. */
  88. extern void com32_intcall_wrapper ( );
  89. extern void com32_farcall_wrapper ( );
  90. extern void com32_cfarcall_wrapper ( );
  91. /* Resolve a hostname to an (IPv4) address */
  92. extern int comboot_resolv ( const char *name, struct in_addr *address );
  93. /* setjmp/longjmp context buffer used to return after loading an image */
  94. extern rmjmp_buf comboot_return;
  95. /* Replacement image when exiting with COMBOOT_EXIT_RUN_KERNEL */
  96. extern struct image *comboot_replacement_image;
  97. extern void *com32_external_esp;
  98. #define COMBOOT_EXIT 1
  99. #define COMBOOT_EXIT_RUN_KERNEL 2
  100. #define COMBOOT_EXIT_COMMAND 3
  101. extern void comboot_force_text_mode ( void );
  102. #define COMBOOT_VIDEO_GRAPHICS 0x01
  103. #define COMBOOT_VIDEO_NONSTANDARD 0x02
  104. #define COMBOOT_VIDEO_VESA 0x04
  105. #define COMBOOT_VIDEO_NOTEXT 0x08
  106. #endif