Browse Source

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
4e4727079b
1 changed files with 9 additions and 6 deletions
  1. 9
    6
      src/arch/x86/prefix/romprefix.S

+ 9
- 6
src/arch/x86/prefix/romprefix.S View File

402
 	/* Shrink ROM */
402
 	/* Shrink ROM */
403
 	movb	shrunk_rom_size, %al
403
 	movb	shrunk_rom_size, %al
404
 	movb	%al, romheader_size
404
 	movb	%al, romheader_size
405
-1:	/* Allocate decompression PMM block.  Round up the size to the
406
-	 * nearest 128kB and use the size within the PMM handle; this
407
-	 * allows the same decompression area to be shared between
408
-	 * multiple iPXE ROMs even with differing build IDs
405
+1:	/* Allocate decompression PMM block.  Allow 4kB for page
406
+	 * alignment and round up the size to the nearest 128kB, then
407
+	 * use the size within the PMM handle; this allows the same
408
+	 * decompression area to be shared between multiple iPXE ROMs
409
+	 * even with differing build IDs
409
 	 */
410
 	 */
410
 	movl	$_textdata_memsz_pgh, %ecx
411
 	movl	$_textdata_memsz_pgh, %ecx
411
-	addl	$0x00001fff, %ecx
412
-	andl	$0xffffe000, %ecx
412
+	addl	$( 0x00000100 /* 4kB */ + 0x00001fff /* 128kB - 1 */ ), %ecx
413
+	andl	$( 0xffffe000 /* ~( 128kB - 1 ) */ ), %ecx
413
 	movl	%ecx, %ebx
414
 	movl	%ecx, %ebx
414
 	shrw	$12, %bx
415
 	shrw	$12, %bx
415
 	orl	$PMM_HANDLE_BASE_DECOMPRESS_TO, %ebx
416
 	orl	$PMM_HANDLE_BASE_DECOMPRESS_TO, %ebx
416
 	movw	$get_pmm_decompress_to, %bp
417
 	movw	$get_pmm_decompress_to, %bp
417
 	call	get_pmm
418
 	call	get_pmm
419
+	addl	$( 0x00000fff /* 4kB - 1 */ ), %esi
420
+	andl	$( 0xfffff000 /* ~( 4kB - 1 ) */ ), %esi
418
 	movl	%esi, decompress_to
421
 	movl	%esi, decompress_to
419
 	/* Restore registers */
422
 	/* Restore registers */
420
 	popal
423
 	popal

Loading…
Cancel
Save