iPXE
comboot.h File Reference

SYSLINUX COMBOOT. More...

#include <stdint.h>
#include <rmsetjmp.h>
#include <ipxe/in.h>

Go to the source code of this file.

Data Structures

union  com32_reg32_t
struct  com32sys_t
struct  syslinux_pm_regs
struct  syslinux_rm_regs
struct  comboot_shuffle_descriptor

Macros

#define COMBOOT_PSP_SEG   0x07C0
 Segment used for COMBOOT PSP and image.
#define COM32_START_PHYS   0x101000
 Entry point address of COM32 images.
#define COM32_BOUNCE_SEG   0x07C0
 COM32 bounce buffer segment.
#define COMBOOT_FILE_BLOCKSZ   512
 Size of SYSLINUX file block in bytes.
#define COMBOOT_FEATURE_LOCAL_BOOT   (1 << 0)
 COMBOOT feature flags (INT 22h AX=15h)
#define COMBOOT_FEATURE_IDLE_LOOP   (1 << 1)
#define COMBOOT_MAX_SHUFFLE_DESCRIPTORS   682
 Maximum number of shuffle descriptors for shuffle and boot functions (INT 22h AX=0012h, 001Ah, 001Bh)
#define COMBOOT_EXIT   1
#define COMBOOT_EXIT_RUN_KERNEL   2
#define COMBOOT_EXIT_COMMAND   3
#define COMBOOT_VIDEO_GRAPHICS   0x01
#define COMBOOT_VIDEO_NONSTANDARD   0x02
#define COMBOOT_VIDEO_VESA   0x04
#define COMBOOT_VIDEO_NOTEXT   0x08

Functions

 FILE_LICENCE (GPL2_OR_LATER)
void hook_comboot_interrupts ()
 Hook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)
void unhook_comboot_interrupts ()
 Unhook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)
void com32_intcall_wrapper ()
void com32_farcall_wrapper ()
void com32_cfarcall_wrapper ()
int comboot_resolv (const char *name, struct in_addr *address)
void comboot_force_text_mode (void)
 Set default text mode.

Variables

rmjmp_buf comboot_return

Detailed Description

SYSLINUX COMBOOT.

Definition in file comboot.h.

Macro Definition Documentation

◆ COMBOOT_PSP_SEG

#define COMBOOT_PSP_SEG   0x07C0

Segment used for COMBOOT PSP and image.

Definition at line 17 of file comboot.h.

Referenced by comboot_exec_loop(), and comboot_prepare_segment().

◆ COM32_START_PHYS

#define COM32_START_PHYS   0x101000

Entry point address of COM32 images.

Definition at line 20 of file comboot.h.

Referenced by com32_exec_loop(), and com32_load_image().

◆ COM32_BOUNCE_SEG

#define COM32_BOUNCE_SEG   0x07C0

COM32 bounce buffer segment.

Definition at line 23 of file comboot.h.

Referenced by com32_exec_loop(), and com32_prepare_bounce_buffer().

◆ COMBOOT_FILE_BLOCKSZ

#define COMBOOT_FILE_BLOCKSZ   512

Size of SYSLINUX file block in bytes.

Definition at line 26 of file comboot.h.

Referenced by int22().

◆ COMBOOT_FEATURE_LOCAL_BOOT

#define COMBOOT_FEATURE_LOCAL_BOOT   (1 << 0)

COMBOOT feature flags (INT 22h AX=15h)

Definition at line 29 of file comboot.h.

◆ COMBOOT_FEATURE_IDLE_LOOP

#define COMBOOT_FEATURE_IDLE_LOOP   (1 << 1)

Definition at line 30 of file comboot.h.

Referenced by __data16().

◆ COMBOOT_MAX_SHUFFLE_DESCRIPTORS

#define COMBOOT_MAX_SHUFFLE_DESCRIPTORS   682

Maximum number of shuffle descriptors for shuffle and boot functions (INT 22h AX=0012h, 001Ah, 001Bh)

Definition at line 36 of file comboot.h.

Referenced by int22(), and shuffle().

◆ COMBOOT_EXIT

#define COMBOOT_EXIT   1

Definition at line 119 of file comboot.h.

Referenced by com32_exec_loop(), comboot_exec_loop(), int20(), and int21().

◆ COMBOOT_EXIT_RUN_KERNEL

#define COMBOOT_EXIT_RUN_KERNEL   2

Definition at line 120 of file comboot.h.

Referenced by com32_exec_loop(), comboot_exec_loop(), and int22().

◆ COMBOOT_EXIT_COMMAND

#define COMBOOT_EXIT_COMMAND   3

Definition at line 121 of file comboot.h.

Referenced by com32_exec_loop(), comboot_exec_loop(), and int22().

◆ COMBOOT_VIDEO_GRAPHICS

#define COMBOOT_VIDEO_GRAPHICS   0x01

Definition at line 125 of file comboot.h.

Referenced by comboot_force_text_mode().

◆ COMBOOT_VIDEO_NONSTANDARD

#define COMBOOT_VIDEO_NONSTANDARD   0x02

Definition at line 126 of file comboot.h.

◆ COMBOOT_VIDEO_VESA

#define COMBOOT_VIDEO_VESA   0x04

Definition at line 127 of file comboot.h.

Referenced by comboot_force_text_mode().

◆ COMBOOT_VIDEO_NOTEXT

#define COMBOOT_VIDEO_NOTEXT   0x08

Definition at line 128 of file comboot.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER )

◆ hook_comboot_interrupts()

void hook_comboot_interrupts ( )
extern

Hook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)

Definition at line 645 of file comboot_call.c.

645 {
646
648 TEXT16_CODE ( "\nint20_wrapper:\n\t"
649 VIRT_CALL ( int20 )
650 "clc\n\t"
651 "call patch_cf\n\t"
652 "iret\n\t" ) : );
653
655
657 TEXT16_CODE ( "\nint21_wrapper:\n\t"
658 VIRT_CALL ( int21 )
659 "clc\n\t"
660 "call patch_cf\n\t"
661 "iret\n\t" ) : );
662
664
666 TEXT16_CODE ( "\nint22_wrapper:\n\t"
667 VIRT_CALL ( int22 )
668 "clc\n\t"
669 "call patch_cf\n\t"
670 "iret\n\t" ) : );
671
673}
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
unsigned long intptr_t
Definition stdint.h:21
void hook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Hook INT vector.
Definition biosint.c:25
static __asmcall __used void int20(struct i386_all_regs *ix86 __unused)
Terminate program interrupt handler.
#define int22_vector
static __asmcall __used void int22(struct i386_all_regs *ix86)
SYSLINUX API.
#define int21_vector
void int22_wrapper(void)
void int20_wrapper(void)
static __asmcall __used void int21(struct i386_all_regs *ix86)
DOS-compatible API.
void int21_wrapper(void)
#define int20_vector
#define TEXT16_CODE(asm_code_str)
Definition libkir.h:217
#define VIRT_CALL(function)
Call C function from real-mode code.
Definition librm.h:72
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")

References __asm__(), __volatile__(), hook_bios_interrupt(), int20(), int20_vector, int20_wrapper(), int21(), int21_vector, int21_wrapper(), int22(), int22_vector, int22_wrapper(), TEXT16_CODE, and VIRT_CALL.

Referenced by com32_exec_loop(), and comboot_exec_loop().

◆ unhook_comboot_interrupts()

void unhook_comboot_interrupts ( )
extern

Unhook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)

Definition at line 678 of file comboot_call.c.

678 {
679
681 &int20_vector );
682
684 &int21_vector );
685
687 &int22_vector );
688}
int unhook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Unhook INT vector.
Definition biosint.c:70

References int20_vector, int20_wrapper(), int21_vector, int21_wrapper(), int22_vector, int22_wrapper(), and unhook_bios_interrupt().

Referenced by com32_exec_loop(), and comboot_exec_loop().

◆ com32_intcall_wrapper()

void com32_intcall_wrapper ( )
extern

Referenced by com32_exec_loop().

◆ com32_farcall_wrapper()

void com32_farcall_wrapper ( )
extern

Referenced by com32_exec_loop().

◆ com32_cfarcall_wrapper()

void com32_cfarcall_wrapper ( )
extern

References address, comboot_return, and name.

Referenced by com32_exec_loop().

◆ comboot_resolv()

int comboot_resolv ( const char * name,
struct in_addr * address )
extern

Definition at line 44 of file comboot_resolv.c.

44 {
45 int rc;
46
49
50 if ( ( rc = resolv ( &comboot_resolver.intf, name, NULL ) ) != 0 )
51 return rc;
52
53 while ( comboot_resolver.rc == -EINPROGRESS )
54 step();
55
57 return -EAFNOSUPPORT;
58
60 return comboot_resolver.rc;
61}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
const char * name
Definition ath9k_hw.c:1986
uint64_t address
Base address.
Definition ena.h:13
#define EAFNOSUPPORT
Address family not supported.
Definition errno.h:314
#define EINPROGRESS
Operation in progress.
Definition errno.h:419
void step(void)
Single-step a single process.
Definition process.c:99
int resolv(struct interface *resolv, const char *name, struct sockaddr *sa)
Start name resolution.
Definition resolv.c:258
struct interface intf
struct in_addr addr
uint32_t s_addr
Definition in.h:43

References comboot_resolver::addr, address, EAFNOSUPPORT, EINPROGRESS, comboot_resolver::intf, name, NULL, comboot_resolver::rc, rc, resolv(), in_addr::s_addr, and step().

Referenced by int22(), and PROVIDE_REQUIRING_SYMBOL().

◆ comboot_force_text_mode()

void comboot_force_text_mode ( void )
extern

Set default text mode.

Definition at line 136 of file comboot_call.c.

136 {
138 /* Set VGA mode 3 via VESA VBE mode set */
140 REAL_CODE (
141 "mov $0x4F02, %%ax\n\t"
142 "mov $0x03, %%bx\n\t"
143 "int $0x10\n\t"
144 )
145 : : );
147 /* Set VGA mode 3 via standard VGA mode set */
149 REAL_CODE (
150 "mov $0x03, %%ax\n\t"
151 "int $0x10\n\t"
152 )
153 : : );
154 }
155
157}
#define COMBOOT_VIDEO_GRAPHICS
Definition comboot.h:125
#define COMBOOT_VIDEO_VESA
Definition comboot.h:127
static uint16_t comboot_graphics_mode
#define REAL_CODE(asm_code_str)
Definition libkir.h:226

References __asm__(), __volatile__(), comboot_graphics_mode, COMBOOT_VIDEO_GRAPHICS, COMBOOT_VIDEO_VESA, and REAL_CODE.

Referenced by com32_exec_loop(), comboot_exec_loop(), and int22().

Variable Documentation

◆ comboot_return

rmjmp_buf comboot_return
extern