iPXE
comboot.h
Go to the documentation of this file.
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 <rmsetjmp.h>
14 #include <ipxe/in.h>
15 
16 /** Segment used for COMBOOT PSP and image */
17 #define COMBOOT_PSP_SEG 0x07C0
18 
19 /** Entry point address of COM32 images */
20 #define COM32_START_PHYS 0x101000
21 
22 /** COM32 bounce buffer segment */
23 #define COM32_BOUNCE_SEG 0x07C0
24 
25 /** Size of SYSLINUX file block in bytes */
26 #define COMBOOT_FILE_BLOCKSZ 512
27 
28 /** COMBOOT feature flags (INT 22h AX=15h) */
29 #define COMBOOT_FEATURE_LOCAL_BOOT (1 << 0)
30 #define COMBOOT_FEATURE_IDLE_LOOP (1 << 1)
31 
32 /** Maximum number of shuffle descriptors for
33  * shuffle and boot functions
34  * (INT 22h AX=0012h, 001Ah, 001Bh)
35  */
36 #define COMBOOT_MAX_SHUFFLE_DESCRIPTORS 682
37 
38 typedef union {
40  uint16_t w[2];
41  uint8_t b[4];
43 
44 typedef struct {
45  uint16_t gs; /* Offset 0 */
46  uint16_t fs; /* Offset 2 */
47  uint16_t es; /* Offset 4 */
48  uint16_t ds; /* Offset 6 */
49 
50  com32_reg32_t edi; /* Offset 8 */
51  com32_reg32_t esi; /* Offset 12 */
52  com32_reg32_t ebp; /* Offset 16 */
53  com32_reg32_t _unused_esp; /* Offset 20 */
54  com32_reg32_t ebx; /* Offset 24 */
55  com32_reg32_t edx; /* Offset 28 */
56  com32_reg32_t ecx; /* Offset 32 */
57  com32_reg32_t eax; /* Offset 36 */
58 
59  com32_reg32_t eflags; /* Offset 40 */
60 } com32sys_t;
61 
62 typedef struct {
63  uint32_t eax; /* Offset 0 */
64  uint32_t ecx; /* Offset 4 */
65  uint32_t edx; /* Offset 8 */
66  uint32_t ebx; /* Offset 12 */
67  uint32_t esp; /* Offset 16 */
68  uint32_t ebp; /* Offset 20 */
69  uint32_t esi; /* Offset 24 */
70  uint32_t edi; /* Offset 28 */
71 
72  uint32_t eip; /* Offset 32 */
74 
75 typedef struct {
76  uint16_t es; /* Offset 0 */
77  uint16_t _unused_cs; /* Offset 2 */
78  uint16_t ds; /* Offset 4 */
79  uint16_t ss; /* Offset 6 */
80  uint16_t fs; /* Offset 8 */
81  uint16_t gs; /* Offset 10 */
82 
83  uint32_t eax; /* Offset 12 */
84  uint32_t ecx; /* Offset 16 */
85  uint32_t edx; /* Offset 20 */
86  uint32_t ebx; /* Offset 24 */
87  uint32_t esp; /* Offset 28 */
88  uint32_t ebp; /* Offset 32 */
89  uint32_t esi; /* Offset 36 */
90  uint32_t edi; /* Offset 40 */
91 
92  uint16_t ip; /* Offset 44 */
93  uint16_t cs; /* Offset 46 */
95 
96 typedef struct {
101 
102 extern void hook_comboot_interrupts ( );
103 extern void unhook_comboot_interrupts ( );
104 
105 /* These are not the correct prototypes, but it doens't matter,
106  * as we only ever get the address of these functions;
107  * they are only called from COM32 code running in PHYS_CODE
108  */
109 extern void com32_intcall_wrapper ( );
110 extern void com32_farcall_wrapper ( );
111 extern void com32_cfarcall_wrapper ( );
112 
113 /* Resolve a hostname to an (IPv4) address */
114 extern int comboot_resolv ( const char *name, struct in_addr *address );
115 
116 /* setjmp/longjmp context buffer used to return after loading an image */
118 
119 #define COMBOOT_EXIT 1
120 #define COMBOOT_EXIT_RUN_KERNEL 2
121 #define COMBOOT_EXIT_COMMAND 3
122 
123 extern void comboot_force_text_mode ( void );
124 
125 #define COMBOOT_VIDEO_GRAPHICS 0x01
126 #define COMBOOT_VIDEO_NONSTANDARD 0x02
127 #define COMBOOT_VIDEO_VESA 0x04
128 #define COMBOOT_VIDEO_NOTEXT 0x08
129 
130 #endif
const char * name
Definition: ath9k_hw.c:1984
unsigned short uint16_t
Definition: stdint.h:11
com32_reg32_t edi
Definition: comboot.h:50
int comboot_resolv(const char *name, struct in_addr *address)
uint32_t l
Definition: comboot.h:39
uint16_t ds
Definition: comboot.h:78
uint32_t ecx
Definition: comboot.h:64
uint32_t edx
Definition: comboot.h:85
FILE_LICENCE(GPL2_OR_LATER)
uint64_t address
Base address.
Definition: ena.h:24
void hook_comboot_interrupts()
Hook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)
Definition: comboot_call.c:659
com32_reg32_t _unused_esp
Definition: comboot.h:53
uint32_t edi
Definition: comboot.h:90
rmjmp_buf comboot_return
Definition: comboot_call.c:82
com32_reg32_t ecx
Definition: comboot.h:56
uint16_t gs
Definition: comboot.h:81
com32_reg32_t eax
Definition: comboot.h:57
uint16_t ip
Definition: comboot.h:92
com32_reg32_t edx
Definition: comboot.h:55
uint16_t fs
Definition: comboot.h:80
com32_reg32_t eflags
Definition: comboot.h:59
uint16_t ss
Definition: comboot.h:79
uint32_t edx
Definition: comboot.h:65
uint32_t esp
Definition: comboot.h:87
uint32_t esp
Definition: comboot.h:67
uint32_t ebx
Definition: comboot.h:66
uint16_t fs
Definition: comboot.h:46
uint32_t ecx
Definition: comboot.h:84
uint32_t ebp
Definition: comboot.h:68
uint32_t esi
Definition: comboot.h:89
void comboot_force_text_mode(void)
Set default text mode.
Definition: comboot_call.c:140
uint16_t es
Definition: comboot.h:76
uint16_t _unused_cs
Definition: comboot.h:77
uint16_t es
Definition: comboot.h:47
uint32_t eip
Definition: comboot.h:72
IP address structure.
Definition: in.h:39
com32_reg32_t esi
Definition: comboot.h:51
void com32_cfarcall_wrapper()
unsigned char uint8_t
Definition: stdint.h:10
unsigned int uint32_t
Definition: stdint.h:12
uint32_t ebx
Definition: comboot.h:86
void com32_farcall_wrapper()
uint32_t eax
Definition: comboot.h:63
void unhook_comboot_interrupts()
Unhook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)
Definition: comboot_call.c:692
com32_reg32_t ebx
Definition: comboot.h:54
uint32_t esi
Definition: comboot.h:69
uint32_t edi
Definition: comboot.h:70
uint16_t gs
Definition: comboot.h:45
uint16_t ds
Definition: comboot.h:48
uint32_t ebp
Definition: comboot.h:88
A real-mode-extended jump buffer.
Definition: rmsetjmp.h:10
com32_reg32_t ebp
Definition: comboot.h:52
uint16_t cs
Definition: comboot.h:93
void com32_intcall_wrapper()
uint32_t eax
Definition: comboot.h:83