47 #define syslinux_version __use_data16 ( syslinux_version ) 51 #define syslinux_copyright __use_data16 ( syslinux_copyright ) 54 #define syslinux_configuration_file __use_data16 ( syslinux_configuration_file ) 58 #define comboot_feature_flags __use_data16 ( comboot_feature_flags ) 66 #define comboot_initial_regs __use_text16 ( comboot_initial_regs ) 69 #define int20_vector __use_text16 ( int20_vector ) 72 #define int21_vector __use_text16 ( int21_vector ) 75 #define int22_vector __use_text16 ( int22_vector ) 106 static void shuffle (
unsigned int list_segment,
unsigned int list_offset,
unsigned int count )
116 for ( i = 0; i <
count; i++ ) {
120 if ( shuf[ i ].
src == 0xFFFFFFFF ) {
123 }
else if ( shuf[ i ].
dest == 0xFFFFFFFF ) {
145 "mov $0x4F02, %%ax\n\t" 146 "mov $0x03, %%bx\n\t" 154 "mov $0x03, %%ax\n\t" 169 struct image *initrd;
181 initrd_end =
strchr ( initrd_file,
' ' );
185 DBG (
"COMBOOT: fetching initrd '%s'\n", initrd_file );
190 DBG (
"COMBOOT: could not fetch initrd: %s\n",
200 DBG (
"COMBOOT: fetching kernel '%s'\n", kernel_file );
204 DBG (
"COMBOOT: could not fetch kernel: %s\n",
211 DBG (
"COMBOOT: could not replace with kernel: %s\n",
234 switch ( ix86->
regs.
ah ) {
246 if ( ix86->
regs.
al == 0x0A )
249 if ( ix86->
regs.
ah == 0x01 )
291 DBG (
"COMBOOT unknown int21 function %02x\n", ix86->
regs.
ah );
317 switch ( ix86->
regs.
ax ) {
353 DBG (
"COMBOOT: executing command '%s'\n",
cmd );
355 DBG (
"COMBOOT: exiting after executing command...\n" );
379 if ( file[0] ==
'\0' ) {
380 DBG (
"COMBOOT: attempted open with empty file name\n" );
384 DBG (
"COMBOOT: opening file '%s'\n", file );
389 DBG (
"COMBOOT: error opening file %s\n", file );
396 #if (POSIX_FD_MAX > 65535) 397 #error POSIX_FD_MAX too large 423 DBG (
"COMBOOT: read failed\n" );
556 char file[file_len + 1];
557 char cmd[cmd_len + 1];
562 DBG (
"COMBOOT: run kernel %s %s\n", file,
cmd );
569 DBG (
"COMBOOT: exiting to run kernel...\n" );
608 "movw $comboot_initial_regs, %%sp\n\t" 629 "movw $(comboot_initial_regs + 6), %%sp\n\t" 631 "movl %%cs:(comboot_initial_regs + 28), %%esp\n\t" 633 "ljmp *%%cs:(comboot_initial_regs + 44)\n\t" 651 DBG (
"COMBOOT unknown int22 function %04x\n", ix86->
regs.
ax );
#define syslinux_configuration_file
static void print_user_string(unsigned int segment, unsigned int offset, char terminator)
Print a string with a particular terminator.
uint16_t segment
Code segment.
struct arbelprm_rc_send_wqe rc
static __always_inline void off_t int c
static uint8_t __data16(comboot_feature_flags)
Feature flags.
struct i386_seg_regs segs
#define syslinux_copyright
uint16_t divisor
Baud rate divisor.
#define VIRT_CALL(function)
Call C function from real-mode code.
#define __from_text16(pointer)
ssize_t read_user(int fd, userptr_t buffer, off_t offset, size_t max_len)
Read data from file.
void uart_transmit(struct uart *uart, uint8_t data)
Transmit data.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
static syslinux_regs __text16(comboot_initial_regs)
Initial register values for INT 22h AX=1Ah and 1Bh.
userptr_t phys_to_user(unsigned long phys_addr)
Convert physical address to user pointer.
#define COMBOOT_VIDEO_VESA
#define COMBOOT_FEATURE_IDLE_LOOP
void * base
I/O port base address.
__weak int pxe_api_call_weak(struct i386_all_regs *ix86 __unused)
Dispatch PXE API call weakly.
void hook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Hook INT vector.
int unhook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Unhook INT vector.
ssize_t fsize(int fd)
Determine file size.
void memset_user(userptr_t userptr, off_t offset, int c, size_t len)
Fill user buffer with a constant byte.
char * strstr(const char *haystack, const char *needle)
Find substring.
#define __asmcall
Declare a function with standard calling conventions.
uint32_t userptr_t
A pointer to a user buffer.
#define __used
Declare a function as used.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define __unused
Declare a variable or data structure as unused.
void comboot_force_text_mode(void)
Set default text mode.
A 16-bit general register.
uint16_t count
Number of entries.
#define BZI_LOADER_TYPE_IPXE
bzImage boot loader identifier for iPXE
uint32_t kernel
Kernel version (numeric)
static uint16_t comboot_graphics_mode
uint32_t fd_set
File descriptor set as used for select()
int getchar(void)
Read a single character from any console.
char * strerror(int errno)
Retrieve string representation of error number.
static char __bss16_array(syslinux_version, [32])
The "SYSLINUX" version string.
void unhook_comboot_interrupts()
Unhook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)
static char __data16_array(syslinux_copyright, [])
The "SYSLINUX" copyright string.
char * strchr(const char *src, int character)
Find character within a string.
int image_replace(struct image *replacement)
Set replacement image.
#define comboot_feature_flags
__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))
const char product_version[]
Product version string.
int select(fd_set *readfds, int wait)
Check file descriptors for readiness.
static void shuffle(unsigned int list_segment, unsigned int list_offset, unsigned int count)
Perform a series of memory copies from a list in low memory.
#define COMBOOT_EXIT_RUN_KERNEL
size_t strlen_user(userptr_t userptr, off_t offset)
Find length of NUL-terminated string in user buffer.
int comboot_resolv(const char *name, struct in_addr *address)
__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")
struct uart serial_console
Serial console UART.
void hook_comboot_interrupts()
Hook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)
#define __from_data16(pointer)
int imgdownload_string(const char *uri_string, unsigned long timeout, struct image **image)
Download a new image.
#define COMBOOT_EXIT_COMMAND
void step(void)
Single-step a single process.
static __asmcall __used void int22(struct i386_all_regs *ix86)
SYSLINUX API.
FILE_LICENCE(GPL2_OR_LATER)
int open(const char *uri_string)
Open file.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
#define __weak
Declare a function as weak (use before the definition)
#define COMBOOT_MAX_SHUFFLE_DESCRIPTORS
Maximum number of shuffle descriptors for shuffle and boot functions (INT 22h AX=0012h,...
static int comboot_fetch_kernel(char *kernel_file, char *cmdline)
Fetch kernel and optional initrd.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
void memmove_user(userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len)
Copy data between user buffers, allowing for overlap.
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
uint16_t offset
Offset to command line.
static struct evtchn_close * close
static __asmcall __used void int20(struct i386_all_regs *ix86 __unused)
Terminate program interrupt handler.
static __asmcall __used void int21(struct i386_all_regs *ix86)
DOS-compatible API.
#define DBG(...)
Print a debugging message.
#define rmlongjmp(_env, _val)
struct eth_slow_terminator_tlv terminator
Terminator.
#define comboot_initial_regs
static void shutdown_boot(void)
Shut down system for OS boot.
#define REAL_CODE(asm_code_str)
#define NULL
NULL pointer (VOID *)
int putchar(int character)
Write a single character to each console device.
#define COMBOOT_VIDEO_GRAPHICS
int iskey(void)
Check for available input on any console.
A real-mode-extended jump buffer.
#define COMBOOT_FILE_BLOCKSZ
Size of SYSLINUX file block in bytes.
#define TEXT16_CODE(asm_code_str)
void memcpy_user(userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len)
Copy data between user buffers.
uint8_t system[ETH_ALEN]
System identifier.