iPXE
Data Structures | Defines | Functions | Variables
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...

Defines

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

Define Documentation

Definition at line 33 of file fakee820.c.

Referenced by fake_e820(), and unfake_e820().

#define E820_TYPE_RAM   1

Normal memory.

Definition at line 45 of file fakee820.c.

Referenced by __text16_array().

#define E820_TYPE_RSVD   2

Reserved and unavailable.

Definition at line 46 of file fakee820.c.

Referenced by __text16_array().

#define E820_TYPE_ACPI   3

ACPI reclaim memory.

Definition at line 47 of file fakee820.c.

Referenced by __text16_array().

#define E820_TYPE_NVS   4

ACPI NVS memory.

Definition at line 48 of file fakee820.c.

#define e820map   __use_text16 ( e820map )

Definition at line 62 of file fakee820.c.

Referenced by fake_e820().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
void int15_fakee820 ( )

Assembly routine in inline asm.

Referenced by fake_e820(), and unfake_e820().

static struct segoff __text16 ( real_int15_vector  ) [static, read]

Original INT 15 handler.

struct e820_entry __attribute__ ( (packed)  )
static struct e820_entry __text16_array ( e820map  ) [static, read]

Fake e820 map.

Definition at line 51 of file fakee820.c.

References E820_TYPE_ACPI, E820_TYPE_RAM, and E820_TYPE_RSVD.

                                                                 {
        { 0x00000000ULL, ( 0x000a0000ULL - 0x00000000ULL ), E820_TYPE_RAM },
        { 0x00100000ULL, ( 0xcfb50000ULL - 0x00100000ULL ), E820_TYPE_RAM },
        { 0xcfb50000ULL, ( 0xcfb64000ULL - 0xcfb50000ULL ), E820_TYPE_RSVD },
        { 0xcfb64000ULL, ( 0xcfb66000ULL - 0xcfb64000ULL ), E820_TYPE_RSVD },
        { 0xcfb66000ULL, ( 0xcfb85c00ULL - 0xcfb66000ULL ), E820_TYPE_ACPI },
        { 0xcfb85c00ULL, ( 0xd0000000ULL - 0xcfb85c00ULL ), E820_TYPE_RSVD },
        { 0xe0000000ULL, ( 0xf0000000ULL - 0xe0000000ULL ), E820_TYPE_RSVD },
        { 0xfe000000ULL, (0x100000000ULL - 0xfe000000ULL ), E820_TYPE_RSVD },
        {0x100000000ULL, (0x230000000ULL -0x100000000ULL ), E820_TYPE_RAM },
};
void fake_e820 ( void  )

Definition at line 64 of file fakee820.c.

References __asm__(), e820map, hook_bios_interrupt(), int15_fakee820(), real_int15_vector, and TEXT16_CODE.

Referenced by hide_etherboot().

                        {
        __asm__ __volatile__ (
                TEXT16_CODE ( "\nint15_fakee820:\n\t"
                              "pushfw\n\t"
                              "cmpl $0xe820, %%eax\n\t"
                              "jne 99f\n\t"
                              "cmpl $0x534d4150, %%edx\n\t"
                              "jne 99f\n\t"
                              "pushaw\n\t"
                              "movw %%sp, %%bp\n\t"
                              "andb $~0x01, 22(%%bp)\n\t" /* Clear return CF */
                              "leaw e820map(%%bx), %%si\n\t"
                              "cs rep movsb\n\t"
                              "popaw\n\t"
                              "movl %%edx, %%eax\n\t"
                              "addl $20, %%ebx\n\t"
                              "cmpl %0, %%ebx\n\t"
                              "jne 1f\n\t"
                              "xorl %%ebx,%%ebx\n\t"
                              "\n1:\n\t"
                              "popfw\n\t"
                              "iret\n\t"
                              "\n99:\n\t"
                              "popfw\n\t"
                              "ljmp *%%cs:real_int15_vector\n\t" )
                : : "i" ( sizeof ( e820map ) ) );

        hook_bios_interrupt ( 0x15, ( intptr_t ) int15_fakee820,
                              &real_int15_vector );
}
void unfake_e820 ( void  )

Variable Documentation

Start of region.

Definition at line 45 of file fakee820.c.

Length of region.

Definition at line 47 of file fakee820.c.

Type of region.

Definition at line 49 of file fakee820.c.