iPXE
fakee820.c File Reference
#include <realmode.h>
#include <biosint.h>

Go to the source code of this file.

Data Structures

struct  e820_entry
 An INT 15,e820 memory map entry. More...

Macros

#define real_int15_vector   __use_text16 ( real_int15_vector )
#define E820_TYPE_RAM   1
 Normal memory.
#define E820_TYPE_RSVD   2
 Reserved and unavailable.
#define E820_TYPE_ACPI   3
 ACPI reclaim memory.
#define E820_TYPE_NVS   4
 ACPI NVS memory.
#define e820map   __use_text16 ( e820map )

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
void int15_fakee820 ()
 Assembly routine in inline asm.
static struct segoff __text16 (real_int15_vector)
 Original INT 15 handler.
struct e820_entry __attribute__ ((packed))
static struct e820_entry __text16_array (e820map)
 Fake e820 map.
void fake_e820 (void)
void unfake_e820 (void)

Variables

uint64_t start
 Start of region.
uint64_t len
 Length of region.
uint32_t type
 Type of region.

Macro Definition Documentation

◆ real_int15_vector

#define real_int15_vector   __use_text16 ( real_int15_vector )

Definition at line 33 of file fakee820.c.

Referenced by __attribute__(), fake_e820(), and unfake_e820().

◆ E820_TYPE_RAM

#define E820_TYPE_RAM   1

Normal memory.

Definition at line 45 of file fakee820.c.

Referenced by __text16_array(), and meme820().

◆ E820_TYPE_RSVD

#define E820_TYPE_RSVD   2

Reserved and unavailable.

Definition at line 46 of file fakee820.c.

Referenced by __text16_array().

◆ E820_TYPE_ACPI

#define E820_TYPE_ACPI   3

ACPI reclaim memory.

Definition at line 47 of file fakee820.c.

Referenced by __text16_array().

◆ E820_TYPE_NVS

#define E820_TYPE_NVS   4

ACPI NVS memory.

Definition at line 48 of file fakee820.c.

◆ e820map

#define e820map   __use_text16 ( e820map )

Definition at line 62 of file fakee820.c.

Referenced by __text16_array(), and fake_e820().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ int15_fakee820()

void int15_fakee820 ( )
extern

Assembly routine in inline asm.

Referenced by fake_e820(), and unfake_e820().

◆ __text16()

struct segoff __text16 ( real_int15_vector )
static

Original INT 15 handler.

◆ __text16_array()

struct e820_entry __text16_array ( e820map )
static

Fake e820 map.

Definition at line 51 of file fakee820.c.

51 {
52 { 0x00000000ULL, ( 0x000a0000ULL - 0x00000000ULL ), E820_TYPE_RAM },
53 { 0x00100000ULL, ( 0xcfb50000ULL - 0x00100000ULL ), E820_TYPE_RAM },
54 { 0xcfb50000ULL, ( 0xcfb64000ULL - 0xcfb50000ULL ), E820_TYPE_RSVD },
55 { 0xcfb64000ULL, ( 0xcfb66000ULL - 0xcfb64000ULL ), E820_TYPE_RSVD },
56 { 0xcfb66000ULL, ( 0xcfb85c00ULL - 0xcfb66000ULL ), E820_TYPE_ACPI },
57 { 0xcfb85c00ULL, ( 0xd0000000ULL - 0xcfb85c00ULL ), E820_TYPE_RSVD },
58 { 0xe0000000ULL, ( 0xf0000000ULL - 0xe0000000ULL ), E820_TYPE_RSVD },
59 { 0xfe000000ULL, (0x100000000ULL - 0xfe000000ULL ), E820_TYPE_RSVD },
60 {0x100000000ULL, (0x230000000ULL -0x100000000ULL ), E820_TYPE_RAM },
61};
#define E820_TYPE_ACPI
ACPI reclaim memory.
Definition fakee820.c:47
#define E820_TYPE_RSVD
Reserved and unavailable.
Definition fakee820.c:46
#define E820_TYPE_RAM
Normal memory.
Definition fakee820.c:45

References __text16_array, __used, E820_TYPE_ACPI, E820_TYPE_RAM, E820_TYPE_RSVD, and e820map.

◆ fake_e820()

void fake_e820 ( void )

Definition at line 64 of file fakee820.c.

64 {
66 TEXT16_CODE ( "\nint15_fakee820:\n\t"
67 "pushfw\n\t"
68 "cmpl $0xe820, %%eax\n\t"
69 "jne 99f\n\t"
70 "cmpl $0x534d4150, %%edx\n\t"
71 "jne 99f\n\t"
72 "pushaw\n\t"
73 "movw %%sp, %%bp\n\t"
74 "andb $~0x01, 22(%%bp)\n\t" /* Clear return CF */
75 "leaw e820map(%%bx), %%si\n\t"
76 "cs rep movsb\n\t"
77 "popaw\n\t"
78 "movl %%edx, %%eax\n\t"
79 "addl $20, %%ebx\n\t"
80 "cmpl %0, %%ebx\n\t"
81 "jne 1f\n\t"
82 "xorl %%ebx,%%ebx\n\t"
83 "\n1:\n\t"
84 "popfw\n\t"
85 "iret\n\t"
86 "\n99:\n\t"
87 "popfw\n\t"
88 "ljmp *%%cs:real_int15_vector\n\t" )
89 : : "i" ( sizeof ( e820map ) ) );
90
93}
__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
#define real_int15_vector
Definition fakee820.c:33
#define e820map
Definition fakee820.c:62
void int15_fakee820()
Assembly routine in inline asm.
#define TEXT16_CODE(asm_code_str)
Definition libkir.h:217
__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__(), e820map, hook_bios_interrupt(), int15_fakee820(), real_int15_vector, and TEXT16_CODE.

Referenced by hide_etherboot().

◆ unfake_e820()

void unfake_e820 ( void )

Definition at line 95 of file fakee820.c.

95 {
98}
int unhook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Unhook INT vector.
Definition biosint.c:70

References int15_fakee820(), real_int15_vector, and unhook_bios_interrupt().

Referenced by unhide_etherboot().

Variable Documentation

◆ start

uint64_t start

Start of region.

Definition at line 1 of file fakee820.c.

◆ len

uint64_t len

Length of region.

Definition at line 3 of file fakee820.c.

◆ type

uint32_t type

Type of region.

Definition at line 5 of file fakee820.c.