58 #define COMBOOT_PSP_CMDLINE_OFFSET 0x81 62 #define COMBOOT_MAX_CMDLINE_LEN 125 76 char spc =
' ',
cr =
'\r';
116 DBGC (
image,
"COMBOOT %p: first non-free paragraph = 0x%x\n",
149 DBGC (
image,
"executing 16-bit COMBOOT image at %4x:0100\n",
176 "xorw %%ax, %%ax\n\t" 177 "xorw %%bx, %%bx\n\t" 178 "xorw %%cx, %%cx\n\t" 179 "xorw %%dx, %%dx\n\t" 180 "xorw %%si, %%si\n\t" 181 "xorw %%di, %%di\n\t" 182 "xorw %%bp, %%bp\n\t" 194 DBGC (
image,
"COMBOOT %p: exited to run kernel %s\n",
199 DBGC (
image,
"COMBOOT %p: exited after executing command\n",
226 DBGC (
image,
"COMBOOT %p: no extension\n",
234 DBGC (
image,
"COMBOOT %p: unrecognized extension %s\n",
250 size_t filesz, memsz;
263 if ( (
rc =
prep_segment ( seg_userptr, filesz, memsz ) ) != 0 ) {
264 DBGC (
image,
"COMBOOT %p: could not prepare segment: %s\n",
310 DBGC(
image,
"COMBOOT %p: image too large\n",
uint16_t int20
INT 20 instruction, executed if COMBOOT image returns with RET.
static int comboot_identify(struct image *image)
Check image name extension.
#define COMBOOT_PSP_CMDLINE_OFFSET
Offset in PSP of command line.
struct arbelprm_rc_send_wqe rc
userptr_t data
Raw file image.
static unsigned int get_fbms(void)
Read the BIOS free base memory counter.
char * strrchr(const char *src, int character)
Find rightmost character within a string.
#define COMBOOT_PSP_SEG
Segment used for COMBOOT PSP and image.
#define ENOEXEC
Exec format error.
static void comboot_init_psp(struct image *image, userptr_t seg_userptr)
Initialize PSP.
An executable image type.
#define COMBOOT_MAX_CMDLINE_LEN
Maximum length of command line in PSP (127 bytes minus space and CR)
#define PROBE_NORMAL
Normal image probe priority.
int strcasecmp(const char *first, const char *second)
Compare case-insensitive strings.
#define FEATURE_IMAGE
Image formats.
static int comboot_probe(struct image *image)
Probe COMBOOT image.
Access to external ("user") memory.
char * name
Name of this image type.
char * cmdline
Command line to pass to image.
static int comboot_exec_loop(struct image *image)
Execute COMBOOT image.
Executable image segments.
void memset_user(userptr_t userptr, off_t offset, int c, size_t len)
Fill user buffer with a constant byte.
FILE_LICENCE(GPL2_OR_LATER)
#define DHCP_EB_FEATURE_COMBOOT
COMBOOT format.
uint32_t userptr_t
A pointer to a user buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
int prep_segment(userptr_t segment, size_t filesz, size_t memsz)
Prepare segment for loading.
struct image_type comboot_image_type __image_type(PROBE_NORMAL)
SYSLINUX COMBOOT (16-bit) image type.
void comboot_force_text_mode(void)
Set default text mode.
static void comboot_copy_cmdline(struct image *image, userptr_t seg_userptr)
Copy command line to PSP.
char * strerror(int errno)
Retrieve string representation of error number.
uint16_t first_non_free_para
Segment of first non-free paragraph of memory.
void unhook_comboot_interrupts()
Unhook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)
size_t len
Length of raw file image.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
__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))
size_t strlen(const char *src)
Get length of string.
static int comboot_prepare_segment(struct image *image)
Load COMBOOT image into memory, preparing a segment and returning it.
static void console_reset(void)
Reset console.
uint16_t ext
Extended status.
#define COMBOOT_EXIT_RUN_KERNEL
COMBOOT PSP, copied to offset 0 of code segment.
void unregister_image(struct image *image)
Unregister executable image.
__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")
void hook_comboot_interrupts()
Hook BIOS interrupts related to COMBOOT API (INT 20h, 21h, 22h)
FEATURE(FEATURE_IMAGE, "COMBOOT", DHCP_EB_FEATURE_COMBOOT, 1)
#define COMBOOT_EXIT_COMMAND
static int comboot_exec(struct image *image)
Execute COMBOOT image.
struct image * replacement
Replacement image.
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
#define REAL_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.