[prefix] Add A20-enabling code in libflat

iPXE currently insists on residing in an even megabyte.  This imposes
undesirably severe constraints upon our PMM allocation strategy, and
limits our options for mechanisms to access ROMs greater than 64kB in
size.

Add A20 handling code to libflat so that prefixes are able to access
memory even in odd megabytes.

The algorithms and tuning parameters in the new A20 handling code are
based upon a mixture of the existing iPXE A20 code and the A20 code
from the 2.6.32 Linux kernel.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2010-04-20 18:49:43 +01:00
parent fb754ced56
commit 24b52ae476
2 changed files with 296 additions and 8 deletions

View File

@@ -512,13 +512,24 @@ install_prealloc:
/* Open up access to payload */
#ifndef KEEP_IT_REAL
/* Flatten real mode */
/* Access high memory */
pushw %cs
pushw $1f
pushw %ax
pushw $flatten_real_mode
pushw $access_highmem
lret
1:
1: /* Die if we could not access high memory */
jnc 3f
movw $a20_death_message, %si
xorw %di, %di
call print_message
2: jmp 2b
.section ".prefix.data", "aw", @progbits
a20_death_message:
.asciz "Gate A20 stuck - cannot continue\n"
.size a20_death_message, . - a20_death_message
.previous
3:
#endif
/* Calculate physical address of payload (i.e. first source) */
@@ -570,13 +581,13 @@ install_prealloc:
popl %edx /* discard */
/* Copy code to new location */
pushl %edi
xorw %ax, %ax
movw %ax, %es
movl %ebp, %edi
es rep addr32 movsb
popl %edi
/* Initialise librm at new location */
movl %ebp, %edi
lcall *init_librm_vector
#endif