|
|
1.1 ! root 1: #ifndef COMBOOT_H ! 2: #define COMBOOT_H ! 3: ! 4: /** ! 5: * @file ! 6: * ! 7: * SYSLINUX COMBOOT ! 8: */ ! 9: ! 10: FILE_LICENCE ( GPL2_OR_LATER ); ! 11: ! 12: #include <stdint.h> ! 13: #include <setjmp.h> ! 14: #include <ipxe/in.h> ! 15: ! 16: /** Descriptor in a 32-bit IDT */ ! 17: struct idt_descriptor { ! 18: uint16_t offset_low; ! 19: uint16_t selector; ! 20: uint16_t flags; ! 21: uint16_t offset_high; ! 22: } __attribute__ (( packed )); ! 23: ! 24: /** Operand for the LIDT instruction */ ! 25: struct idt_register { ! 26: uint16_t limit; ! 27: uint32_t base; ! 28: } __attribute__ (( packed )); ! 29: ! 30: /** Entry in the interrupt jump buffer */ ! 31: struct ijb_entry { ! 32: uint8_t pusha_instruction; ! 33: uint8_t mov_instruction; ! 34: uint8_t mov_value; ! 35: uint8_t jump_instruction; ! 36: uint32_t jump_destination; ! 37: } __attribute__ (( packed )); ! 38: ! 39: /** The x86 opcode for "pushal" */ ! 40: #define IJB_PUSHA 0x60 ! 41: ! 42: /** The x86 opcode for "movb $imm8,%al" */ ! 43: #define IJB_MOV_AL_IMM8 0xB0 ! 44: ! 45: /** The x86 opcode for "jmp rel32" */ ! 46: #define IJB_JMP_REL32 0xE9 ! 47: ! 48: /** Flags that specify a 32-bit interrupt gate with DPL=0 */ ! 49: #define IDT_INTERRUPT_GATE_FLAGS 0x8E00 ! 50: ! 51: /** Address of COM32 interrupt descriptor table */ ! 52: #define COM32_IDT 0x100000 ! 53: ! 54: /** Number of entries in a fully populated IDT */ ! 55: #define COM32_NUM_IDT_ENTRIES 256 ! 56: ! 57: /** Address of COM32 interrupt jump buffer */ ! 58: #define COM32_IJB 0x100800 ! 59: ! 60: /** Segment used for COMBOOT PSP and image */ ! 61: #define COMBOOT_PSP_SEG 0x07C0 ! 62: ! 63: /** Entry point address of COM32 images */ ! 64: #define COM32_START_PHYS 0x101000 ! 65: ! 66: /** COM32 bounce buffer segment */ ! 67: #define COM32_BOUNCE_SEG 0x07C0 ! 68: ! 69: /** Size of SYSLINUX file block in bytes */ ! 70: #define COMBOOT_FILE_BLOCKSZ 512 ! 71: ! 72: /** COMBOOT feature flags (INT 22h AX=15h) */ ! 73: #define COMBOOT_FEATURE_LOCAL_BOOT (1 << 0) ! 74: #define COMBOOT_FEATURE_IDLE_LOOP (1 << 1) ! 75: ! 76: /** Maximum number of shuffle descriptors for ! 77: * shuffle and boot functions ! 78: * (INT 22h AX=0012h, 001Ah, 001Bh) ! 79: */ ! 80: #define COMBOOT_MAX_SHUFFLE_DESCRIPTORS 682 ! 81: ! 82: typedef union { ! 83: uint32_t l; ! 84: uint16_t w[2]; ! 85: uint8_t b[4]; ! 86: } com32_reg32_t; ! 87: ! 88: typedef struct { ! 89: uint16_t gs; /* Offset 0 */ ! 90: uint16_t fs; /* Offset 2 */ ! 91: uint16_t es; /* Offset 4 */ ! 92: uint16_t ds; /* Offset 6 */ ! 93: ! 94: com32_reg32_t edi; /* Offset 8 */ ! 95: com32_reg32_t esi; /* Offset 12 */ ! 96: com32_reg32_t ebp; /* Offset 16 */ ! 97: com32_reg32_t _unused_esp; /* Offset 20 */ ! 98: com32_reg32_t ebx; /* Offset 24 */ ! 99: com32_reg32_t edx; /* Offset 28 */ ! 100: com32_reg32_t ecx; /* Offset 32 */ ! 101: com32_reg32_t eax; /* Offset 36 */ ! 102: ! 103: com32_reg32_t eflags; /* Offset 40 */ ! 104: } com32sys_t; ! 105: ! 106: typedef struct { ! 107: uint32_t eax; /* Offset 0 */ ! 108: uint32_t ecx; /* Offset 4 */ ! 109: uint32_t edx; /* Offset 8 */ ! 110: uint32_t ebx; /* Offset 12 */ ! 111: uint32_t esp; /* Offset 16 */ ! 112: uint32_t ebp; /* Offset 20 */ ! 113: uint32_t esi; /* Offset 24 */ ! 114: uint32_t edi; /* Offset 28 */ ! 115: ! 116: uint32_t eip; /* Offset 32 */ ! 117: } syslinux_pm_regs; ! 118: ! 119: typedef struct { ! 120: uint16_t es; /* Offset 0 */ ! 121: uint16_t _unused_cs; /* Offset 2 */ ! 122: uint16_t ds; /* Offset 4 */ ! 123: uint16_t ss; /* Offset 6 */ ! 124: uint16_t fs; /* Offset 8 */ ! 125: uint16_t gs; /* Offset 10 */ ! 126: ! 127: uint32_t eax; /* Offset 12 */ ! 128: uint32_t ecx; /* Offset 16 */ ! 129: uint32_t edx; /* Offset 20 */ ! 130: uint32_t ebx; /* Offset 24 */ ! 131: uint32_t esp; /* Offset 28 */ ! 132: uint32_t ebp; /* Offset 32 */ ! 133: uint32_t esi; /* Offset 36 */ ! 134: uint32_t edi; /* Offset 40 */ ! 135: ! 136: uint16_t ip; /* Offset 44 */ ! 137: uint16_t cs; /* Offset 46 */ ! 138: } syslinux_rm_regs; ! 139: ! 140: typedef struct { ! 141: uint32_t dest; ! 142: uint32_t src; ! 143: uint32_t len; ! 144: } comboot_shuffle_descriptor; ! 145: ! 146: extern void hook_comboot_interrupts ( ); ! 147: extern void unhook_comboot_interrupts ( ); ! 148: ! 149: /* These are not the correct prototypes, but it doens't matter, ! 150: * as we only ever get the address of these functions; ! 151: * they are only called from COM32 code running in PHYS_CODE ! 152: */ ! 153: extern void com32_intcall_wrapper ( ); ! 154: extern void com32_farcall_wrapper ( ); ! 155: extern void com32_cfarcall_wrapper ( ); ! 156: extern void com32_irq_wrapper ( ); ! 157: ! 158: /* Resolve a hostname to an (IPv4) address */ ! 159: extern int comboot_resolv ( const char *name, struct in_addr *address ); ! 160: ! 161: /* setjmp/longjmp context buffer used to return after loading an image */ ! 162: extern rmjmp_buf comboot_return; ! 163: ! 164: extern void *com32_external_esp; ! 165: ! 166: #define COMBOOT_EXIT 1 ! 167: #define COMBOOT_EXIT_RUN_KERNEL 2 ! 168: #define COMBOOT_EXIT_COMMAND 3 ! 169: ! 170: extern void comboot_force_text_mode ( void ); ! 171: ! 172: #define COMBOOT_VIDEO_GRAPHICS 0x01 ! 173: #define COMBOOT_VIDEO_NONSTANDARD 0x02 ! 174: #define COMBOOT_VIDEO_VESA 0x04 ! 175: #define COMBOOT_VIDEO_NOTEXT 0x08 ! 176: ! 177: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.