[librm] Support ioremap() for addresses above 4GB in a 64-bit build

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2016-02-26 15:34:28 +00:00
parent 5bd8427d3d
commit 99b5216b1c
6 changed files with 216 additions and 1 deletions
+17
View File
@@ -1340,11 +1340,19 @@ interrupt_wrapper:
* These point to the PDPT. This creates some aliased
* addresses within unused portions of the 64-bit address
* space, but allows us to use just a single PDPT.
*
* - PDE[...] covering arbitrary 2MB portions of I/O space
*
* These are 2MB pages created by ioremap() to cover I/O
* device addresses.
*/
pml4e:
.space SIZEOF_PT
.size pml4e, . - pml4e
.globl io_pages
.equ io_pages, pml4e
/* Page directory pointer table entries (PDPTEs)
*
* This comprises:
@@ -1357,6 +1365,11 @@ pml4e:
* These point to the appropriate page directories (in pde_low)
* used to identity-map the whole of the 32-bit address space.
*
* - PDPTE[0x004] covering [0x0000000100000000-0x000000013fffffff]
*
* This points back to the PML4, allowing the PML4 to be
* (ab)used to hold 2MB pages used for I/O device addresses.
*
* - PDPTE[0x1ff] covering [0xffffffffc0000000-0xffffffffffffffff]
*
* This points back to the PDPT itself, allowing the PDPT to be
@@ -1421,6 +1434,10 @@ init_pages:
/* Initialise PDPTE for negative 1GB */
movl %eax, ( VIRTUAL(pdpte) + SIZEOF_PT - SIZEOF_PTE )
/* Initialise PDPTE for I/O space */
leal ( VIRTUAL(pml4e) + ( PG_P | PG_RW | PG_US ) )(%edi), %eax
movl %eax, ( VIRTUAL(pdpte) + ( PDE_LOW_PTS * SIZEOF_PTE ) )
/* Initialise PDPTEs for low 4GB */
movl $PDE_LOW_PTS, %ecx
leal ( VIRTUAL(pde_low) + ( PDE_LOW_PTS * SIZEOF_PT ) + \