23 #define MAX_ADDR (0xfff00000UL) 56 DBG (
"Relocate: currently at [%x,%x)\n" 57 "...need %x bytes for %d-byte alignment\n",
64 DBG (
"Limiting relocation to [0,%x)\n",
max );
71 for ( i = 0 ; i < memmap.
count ; i++ ) {
75 DBG (
"Considering [%llx,%llx)\n", region->
start, region->
end);
82 DBG (
"...starts after max=%x\n",
max );
85 r_start = region->
start;
87 DBG (
"...end truncated to max=%x\n",
max );
92 DBG (
"...usable portion is [%x,%x)\n", r_start, r_end );
97 if ( r_end < r_start ) {
98 DBG (
"...truncated to negative size\n" );
103 if ( ( r_end - r_start ) <
size ) {
104 DBG (
"...too small (need %x bytes)\n",
size );
116 if ( ( r_end -
size ) > new_end ) {
118 DBG (
"...new best block found.\n" );
125 new_start = new_end - padded_size;
126 new_start += ( (
start - new_start ) & (
ALIGN - 1 ) );
127 new_end = new_start +
size;
129 DBG (
"Relocating from [%x,%x) to [%x,%x)\n",
void get_memmap(struct memory_map *memmap)
Get memory map.
__asmcall void relocate(struct i386_all_regs *ix86)
Relocate iPXE.
unsigned int count
Number of used regions.
uint8_t size
Entry size (in 32-bit words)
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
uint32_t start
Starting offset.
struct memory_region regions[MAX_MEMORY_REGIONS]
Memory regions.
#define __asmcall
Declare a function with standard calling conventions.
uint64_t start
Physical start address.
uint32_t end
Ending offset.
#define DBG(...)
Print a debugging message.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint64_t end
Physical end address.