[romprefix] Align PMM temporary decompression area to a page boundary

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/45/head
Michael Brown 2016-02-18 02:58:03 +00:00
parent a4f5c4647e
commit 4e4727079b
1 changed files with 9 additions and 6 deletions

View File

@ -402,19 +402,22 @@ pmm_scan:
/* Shrink ROM */ /* Shrink ROM */
movb shrunk_rom_size, %al movb shrunk_rom_size, %al
movb %al, romheader_size movb %al, romheader_size
1: /* Allocate decompression PMM block. Round up the size to the 1: /* Allocate decompression PMM block. Allow 4kB for page
* nearest 128kB and use the size within the PMM handle; this * alignment and round up the size to the nearest 128kB, then
* allows the same decompression area to be shared between * use the size within the PMM handle; this allows the same
* multiple iPXE ROMs even with differing build IDs * decompression area to be shared between multiple iPXE ROMs
* even with differing build IDs
*/ */
movl $_textdata_memsz_pgh, %ecx movl $_textdata_memsz_pgh, %ecx
addl $0x00001fff, %ecx addl $( 0x00000100 /* 4kB */ + 0x00001fff /* 128kB - 1 */ ), %ecx
andl $0xffffe000, %ecx andl $( 0xffffe000 /* ~( 128kB - 1 ) */ ), %ecx
movl %ecx, %ebx movl %ecx, %ebx
shrw $12, %bx shrw $12, %bx
orl $PMM_HANDLE_BASE_DECOMPRESS_TO, %ebx orl $PMM_HANDLE_BASE_DECOMPRESS_TO, %ebx
movw $get_pmm_decompress_to, %bp movw $get_pmm_decompress_to, %bp
call get_pmm call get_pmm
addl $( 0x00000fff /* 4kB - 1 */ ), %esi
andl $( 0xfffff000 /* ~( 4kB - 1 ) */ ), %esi
movl %esi, decompress_to movl %esi, decompress_to
/* Restore registers */ /* Restore registers */
popal popal