iPXE
comboot.h
Go to the documentation of this file.
00001 #ifndef COMBOOT_H
00002 #define COMBOOT_H
00003 
00004 /**
00005  * @file
00006  *
00007  * SYSLINUX COMBOOT
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011 
00012 #include <stdint.h>
00013 #include <rmsetjmp.h>
00014 #include <ipxe/in.h>
00015 
00016 /** Segment used for COMBOOT PSP and image */
00017 #define COMBOOT_PSP_SEG 0x07C0
00018 
00019 /** Entry point address of COM32 images */
00020 #define COM32_START_PHYS 0x101000
00021 
00022 /** COM32 bounce buffer segment */
00023 #define COM32_BOUNCE_SEG 0x07C0
00024 
00025 /** Size of SYSLINUX file block in bytes */
00026 #define COMBOOT_FILE_BLOCKSZ 512
00027 
00028 /** COMBOOT feature flags (INT 22h AX=15h) */
00029 #define COMBOOT_FEATURE_LOCAL_BOOT (1 << 0)
00030 #define COMBOOT_FEATURE_IDLE_LOOP  (1 << 1)
00031 
00032 /** Maximum number of shuffle descriptors for
00033  * shuffle and boot functions
00034  * (INT 22h AX=0012h, 001Ah, 001Bh)
00035  */
00036 #define COMBOOT_MAX_SHUFFLE_DESCRIPTORS 682
00037 
00038 typedef union {
00039         uint32_t l;
00040         uint16_t w[2];
00041         uint8_t  b[4];
00042 } com32_reg32_t;
00043 
00044 typedef struct {
00045         uint16_t gs;                /* Offset  0 */
00046         uint16_t fs;                /* Offset  2 */
00047         uint16_t es;                /* Offset  4 */
00048         uint16_t ds;                /* Offset  6 */
00049 
00050         com32_reg32_t edi;          /* Offset  8 */
00051         com32_reg32_t esi;          /* Offset 12 */
00052         com32_reg32_t ebp;          /* Offset 16 */
00053         com32_reg32_t _unused_esp;  /* Offset 20 */
00054         com32_reg32_t ebx;          /* Offset 24 */
00055         com32_reg32_t edx;          /* Offset 28 */
00056         com32_reg32_t ecx;          /* Offset 32 */
00057         com32_reg32_t eax;          /* Offset 36 */
00058 
00059         com32_reg32_t eflags;       /* Offset 40 */
00060 } com32sys_t;
00061 
00062 typedef struct {
00063         uint32_t eax;               /* Offset  0 */
00064         uint32_t ecx;               /* Offset  4 */
00065         uint32_t edx;               /* Offset  8 */
00066         uint32_t ebx;               /* Offset 12 */
00067         uint32_t esp;               /* Offset 16 */
00068         uint32_t ebp;               /* Offset 20 */
00069         uint32_t esi;               /* Offset 24 */
00070         uint32_t edi;               /* Offset 28 */
00071 
00072         uint32_t eip;               /* Offset 32 */
00073 } syslinux_pm_regs;
00074 
00075 typedef struct {
00076         uint16_t es;                /* Offset  0 */
00077         uint16_t _unused_cs;        /* Offset  2 */
00078         uint16_t ds;                /* Offset  4 */
00079         uint16_t ss;                /* Offset  6 */
00080         uint16_t fs;                /* Offset  8 */
00081         uint16_t gs;                /* Offset 10 */
00082 
00083         uint32_t eax;                /* Offset 12 */
00084         uint32_t ecx;                /* Offset 16 */
00085         uint32_t edx;                /* Offset 20 */
00086         uint32_t ebx;                /* Offset 24 */
00087         uint32_t esp;                /* Offset 28 */
00088         uint32_t ebp;                /* Offset 32 */
00089         uint32_t esi;                /* Offset 36 */
00090         uint32_t edi;                /* Offset 40 */
00091 
00092         uint16_t ip;                /* Offset 44 */
00093         uint16_t cs;                /* Offset 46 */
00094 } syslinux_rm_regs;
00095 
00096 typedef struct {
00097         uint32_t dest;
00098         uint32_t src;
00099         uint32_t len;
00100 } comboot_shuffle_descriptor;
00101 
00102 extern void hook_comboot_interrupts ( );
00103 extern void unhook_comboot_interrupts ( );
00104 
00105 /* These are not the correct prototypes, but it doens't matter,
00106  * as we only ever get the address of these functions;
00107  * they are only called from COM32 code running in PHYS_CODE
00108  */
00109 extern void com32_intcall_wrapper ( );
00110 extern void com32_farcall_wrapper ( );
00111 extern void com32_cfarcall_wrapper ( );
00112 
00113 /* Resolve a hostname to an (IPv4) address */
00114 extern int comboot_resolv ( const char *name, struct in_addr *address );
00115 
00116 /* setjmp/longjmp context buffer used to return after loading an image */
00117 extern rmjmp_buf comboot_return;
00118 
00119 #define COMBOOT_EXIT 1
00120 #define COMBOOT_EXIT_RUN_KERNEL 2
00121 #define COMBOOT_EXIT_COMMAND 3
00122 
00123 extern void comboot_force_text_mode ( void );
00124 
00125 #define COMBOOT_VIDEO_GRAPHICS    0x01
00126 #define COMBOOT_VIDEO_NONSTANDARD 0x02
00127 #define COMBOOT_VIDEO_VESA        0x04
00128 #define COMBOOT_VIDEO_NOTEXT      0x08
00129 
00130 #endif