10 FILE_LICENCE ( GPL2_OR_LATER
);
16 /** Descriptor in a 32-bit IDT */
17 struct idt_descriptor
{
22 } __attribute__ (( packed
));
24 /** Operand for the LIDT instruction */
28 } __attribute__ (( packed
));
30 /** Entry in the interrupt jump buffer */
32 uint8_t pusha_instruction
;
33 uint8_t mov_instruction
;
35 uint8_t jump_instruction
;
36 uint32_t jump_destination
;
37 } __attribute__ (( packed
));
39 /** The x86 opcode for "pushal" */
40 #define IJB_PUSHA 0x60
42 /** The x86 opcode for "movb $imm8,%al" */
43 #define IJB_MOV_AL_IMM8 0xB0
45 /** The x86 opcode for "jmp rel32" */
46 #define IJB_JMP_REL32 0xE9
48 /** Flags that specify a 32-bit interrupt gate with DPL=0 */
49 #define IDT_INTERRUPT_GATE_FLAGS 0x8E00
51 /** Address of COM32 interrupt descriptor table */
52 #define COM32_IDT 0x100000
54 /** Number of entries in a fully populated IDT */
55 #define COM32_NUM_IDT_ENTRIES 256
57 /** Address of COM32 interrupt jump buffer */
58 #define COM32_IJB 0x100800
60 /** Segment used for COMBOOT PSP and image */
61 #define COMBOOT_PSP_SEG 0x07C0
63 /** Entry point address of COM32 images */
64 #define COM32_START_PHYS 0x101000
66 /** COM32 bounce buffer segment */
67 #define COM32_BOUNCE_SEG 0x07C0
69 /** Size of SYSLINUX file block in bytes */
70 #define COMBOOT_FILE_BLOCKSZ 512
72 /** COMBOOT feature flags (INT 22h AX=15h) */
73 #define COMBOOT_FEATURE_LOCAL_BOOT (1 << 0)
74 #define COMBOOT_FEATURE_IDLE_LOOP (1 << 1)
76 /** Maximum number of shuffle descriptors for
77 * shuffle and boot functions
78 * (INT 22h AX=0012h, 001Ah, 001Bh)
80 #define COMBOOT_MAX_SHUFFLE_DESCRIPTORS 682
89 uint16_t gs
; /* Offset 0 */
90 uint16_t fs
; /* Offset 2 */
91 uint16_t es
; /* Offset 4 */
92 uint16_t ds
; /* Offset 6 */
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 */
103 com32_reg32_t eflags
; /* Offset 40 */
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 */
116 uint32_t eip
; /* Offset 32 */
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 */
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 */
136 uint16_t ip
; /* Offset 44 */
137 uint16_t cs
; /* Offset 46 */
144 } comboot_shuffle_descriptor
;
146 extern void hook_comboot_interrupts ( );
147 extern void unhook_comboot_interrupts ( );
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
153 extern void com32_intcall_wrapper ( );
154 extern void com32_farcall_wrapper ( );
155 extern void com32_cfarcall_wrapper ( );
156 extern void com32_irq_wrapper ( );
158 /* Resolve a hostname to an (IPv4) address */
159 extern int comboot_resolv ( const char *name
, struct in_addr
*address
);
161 /* setjmp/longjmp context buffer used to return after loading an image */
162 extern rmjmp_buf comboot_return
;
164 /* Replacement image when exiting with COMBOOT_EXIT_RUN_KERNEL */
165 extern struct image
*comboot_replacement_image
;
167 extern void *com32_external_esp
;
169 #define COMBOOT_EXIT 1
170 #define COMBOOT_EXIT_RUN_KERNEL 2
171 #define COMBOOT_EXIT_COMMAND 3
173 extern void comboot_force_text_mode ( void );
175 #define COMBOOT_VIDEO_GRAPHICS 0x01
176 #define COMBOOT_VIDEO_NONSTANDARD 0x02
177 #define COMBOOT_VIDEO_VESA 0x04
178 #define COMBOOT_VIDEO_NOTEXT 0x08