iPXE
Data Structures | Macros | Functions | Variables
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. More...
 
#define COM32_START_PHYS   0x101000
 Entry point address of COM32 images. More...
 
#define COM32_BOUNCE_SEG   0x07C0
 COM32 bounce buffer segment. More...
 
#define COMBOOT_FILE_BLOCKSZ   512
 Size of SYSLINUX file block in bytes. More...
 
#define COMBOOT_FEATURE_LOCAL_BOOT   (1 << 0)
 COMBOOT feature flags (INT 22h AX=15h) More...
 
#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) More...
 
#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) More...
 
void unhook_comboot_interrupts ()
 Unhook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h) More...
 
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. More...
 

Variables

typedef __attribute__
 Initialise completion queue. More...
 
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.

◆ COM32_START_PHYS

#define COM32_START_PHYS   0x101000

Entry point address of COM32 images.

Definition at line 20 of file comboot.h.

◆ COM32_BOUNCE_SEG

#define COM32_BOUNCE_SEG   0x07C0

COM32 bounce buffer segment.

Definition at line 23 of file comboot.h.

◆ COMBOOT_FILE_BLOCKSZ

#define COMBOOT_FILE_BLOCKSZ   512

Size of SYSLINUX file block in bytes.

Definition at line 26 of file comboot.h.

◆ 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.

◆ 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.

◆ COMBOOT_EXIT

#define COMBOOT_EXIT   1

Definition at line 119 of file comboot.h.

◆ COMBOOT_EXIT_RUN_KERNEL

#define COMBOOT_EXIT_RUN_KERNEL   2

Definition at line 120 of file comboot.h.

◆ COMBOOT_EXIT_COMMAND

#define COMBOOT_EXIT_COMMAND   3

Definition at line 121 of file comboot.h.

◆ COMBOOT_VIDEO_GRAPHICS

#define COMBOOT_VIDEO_GRAPHICS   0x01

Definition at line 125 of file comboot.h.

◆ 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.

◆ 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 ( )

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

Definition at line 659 of file comboot_call.c.

659  {
660 
662  TEXT16_CODE ( "\nint20_wrapper:\n\t"
663  VIRT_CALL ( int20 )
664  "clc\n\t"
665  "call patch_cf\n\t"
666  "iret\n\t" ) : );
667 
669 
671  TEXT16_CODE ( "\nint21_wrapper:\n\t"
672  VIRT_CALL ( int21 )
673  "clc\n\t"
674  "call patch_cf\n\t"
675  "iret\n\t" ) : );
676 
678 
680  TEXT16_CODE ( "\nint22_wrapper:\n\t"
681  VIRT_CALL ( int22 )
682  "clc\n\t"
683  "call patch_cf\n\t"
684  "iret\n\t" ) : );
685 
687 }
#define VIRT_CALL(function)
Call C function from real-mode code.
Definition: librm.h:78
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:24
static __asmcall void int21(struct i386_all_regs *ix86)
DOS-compatible API.
Definition: comboot_call.c:231
static __asmcall void int22(struct i386_all_regs *ix86)
SYSLINUX API.
Definition: comboot_call.c:314
void int22_wrapper(void)
#define int21_vector
Definition: comboot_call.c:72
void int21_wrapper(void)
__asm__ __volatile__("\n1:\n\t" "movb -1(%2,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %%eax, %%eax\n\t" "mov %3, %1\n\t" "rep stosb\n\t" :"=&D"(discard_D), "=&c"(discard_c) :"r"(data), "g"(pad_len), "0"(value0), "1"(len) :"eax")
__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")
#define int20_vector
Definition: comboot_call.c:69
void int20_wrapper(void)
#define int22_vector
Definition: comboot_call.c:75
#define TEXT16_CODE(asm_code_str)
Definition: libkir.h:217
static __asmcall void int20(struct i386_all_regs *ix86 __unused)
Terminate program interrupt handler.
Definition: comboot_call.c:223

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 ( )

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

Definition at line 692 of file comboot_call.c.

692  {
693 
695  &int20_vector );
696 
698  &int21_vector );
699 
701  &int22_vector );
702 }
unsigned long intptr_t
Definition: stdint.h:21
int unhook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Unhook INT vector.
Definition: biosint.c:69
void int22_wrapper(void)
#define int21_vector
Definition: comboot_call.c:72
void int21_wrapper(void)
#define int20_vector
Definition: comboot_call.c:69
void int20_wrapper(void)
#define int22_vector
Definition: comboot_call.c:75

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 ( )

Referenced by com32_exec_loop().

◆ com32_farcall_wrapper()

void com32_farcall_wrapper ( )

Referenced by com32_exec_loop().

◆ com32_cfarcall_wrapper()

void com32_cfarcall_wrapper ( )

Referenced by com32_exec_loop().

◆ comboot_resolv()

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

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 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
uint64_t address
Base address.
Definition: ena.h:24
#define EAFNOSUPPORT
Address family not supported.
Definition: errno.h:313
#define EINPROGRESS
Operation in progress.
Definition: errno.h:418
struct in_addr addr
uint32_t s_addr
Definition: in.h:40
void step(void)
Single-step a single process.
Definition: process.c:98
struct interface intf
int resolv(struct interface *resolv, const char *name, struct sockaddr *sa)
Start name resolution.
Definition: resolv.c:257
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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().

◆ comboot_force_text_mode()

void comboot_force_text_mode ( void  )

Set default text mode.

Definition at line 140 of file comboot_call.c.

140  {
142  /* Set VGA mode 3 via VESA VBE mode set */
144  REAL_CODE (
145  "mov $0x4F02, %%ax\n\t"
146  "mov $0x03, %%bx\n\t"
147  "int $0x10\n\t"
148  )
149  : : );
151  /* Set VGA mode 3 via standard VGA mode set */
153  REAL_CODE (
154  "mov $0x03, %%ax\n\t"
155  "int $0x10\n\t"
156  )
157  : : );
158  }
159 
161 }
#define COMBOOT_VIDEO_VESA
Definition: comboot.h:127
static uint16_t comboot_graphics_mode
Definition: comboot_call.c:85
__asm__ __volatile__("\n1:\n\t" "movb -1(%2,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %%eax, %%eax\n\t" "mov %3, %1\n\t" "rep stosb\n\t" :"=&D"(discard_D), "=&c"(discard_c) :"r"(data), "g"(pad_len), "0"(value0), "1"(len) :"eax")
__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")
#define REAL_CODE(asm_code_str)
Definition: libkir.h:226
#define COMBOOT_VIDEO_GRAPHICS
Definition: comboot.h:125

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

Definition at line 82 of file comboot_call.c.

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