38 #define ALIGN_HIDDEN 4096 58 #define hidemem_base __use_data16 ( hidemem_base ) 62 #define hidemem_umalloc __use_data16 ( hidemem_umalloc ) 66 #define hidemem_textdata __use_data16 ( hidemem_textdata ) 73 #define int15_vector __use_text16 ( int15_vector ) 79 #define _text16_memsz ( ( size_t ) _text16_memsz ) 81 #define _data16_memsz ( ( size_t ) _data16_memsz ) 100 DBG (
"Hiding region [%llx,%llx)\n", region->
start, region->
end );
141 unsigned int rm_ds_top;
142 unsigned int rm_cs_top;
146 DBG (
"Hiding iPXE from system memory map\n" );
151 DBG (
"Hooking in fake E820 map\n" );
174 if ( ( rm_cs_top < fbms ) && ( rm_ds_top < fbms ) ) {
175 DBG (
"Detected potentially unsafe UNDI load at CS=%04x " 177 DBG (
"Disabling INT 15 memory hiding\n" );
185 DBG (
"Hidden iPXE from system memory map\n" );
206 DBG (
"Cannot unhide: %d interrupt vectors still hooked\n",
226 DBG (
"Unhidden iPXE from system memory map\n" );
struct arbelprm_rc_send_wqe rc
void get_memmap(struct memory_map *memmap)
Get memory map.
static void hide_etherboot(void)
Hide Etherboot.
static unsigned int get_fbms(void)
Read the BIOS free base memory counter.
void int15()
Assembly routine in e820mangler.S.
void hide_umalloc(physaddr_t start, physaddr_t end)
Hide umalloc() region.
#define STARTUP_EARLY
Early startup.
unsigned long long uint64_t
struct hidden_region __data16(hidemem_base)
Hidden base memory.
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
void hook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Hook INT vector.
uint32_t start
Starting offset.
A startup/shutdown function.
int unhook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Unhook INT vector.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void unhide_etherboot(int flags __unused)
Unhide Etherboot.
#define __unused
Declare a variable or data structure as unused.
uint64_t start
Physical start address.
static void hide_region(struct hidden_region *region, physaddr_t start, physaddr_t end)
Hide region of memory from system memory map.
struct segoff __text16(int15_vector)
Vector for storing original INT 15 handler.
#define hooked_bios_interrupts
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
char * strerror(int errno)
Retrieve string representation of error number.
#define FAKE_E820
Set to true if you want to test a fake E820 map.
#define ALIGN_HIDDEN
Alignment for hidden memory regions.
uint32_t end
Ending offset.
uint64_t end
Physical end address.
void hide_basemem(void)
Hide used base memory.
void hide_textdata(void)
Hide .text and .data.
struct startup_fn hide_etherboot_startup_fn __startup_fn(STARTUP_EARLY)
Hide Etherboot startup function.
#define DBG(...)
Print a debugging message.