mirror of
https://github.com/ipxe/ipxe
synced 2025-12-10 21:41:09 +03:00
[riscv] Construct page tables based on link-time virtual addresses
Always construct the page tables based on the link-time address values even if relocations have already been applied, on the assumption that relocations will be reapplied after paging has been enabled. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -32,6 +32,16 @@
|
|||||||
.section ".note.GNU-stack", "", @progbits
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.text
|
.text
|
||||||
|
|
||||||
|
/* Link-time base address of _prefix
|
||||||
|
*
|
||||||
|
* This will be not be updated if runtime relocations are applied.
|
||||||
|
*/
|
||||||
|
.section ".rodata.prefix_link", "a", @progbits
|
||||||
|
.balign ( __riscv_xlen / 8 )
|
||||||
|
prefix_link:
|
||||||
|
.dword _base
|
||||||
|
.size prefix_link, . - prefix_link
|
||||||
|
|
||||||
/* Virtual address of _prefix
|
/* Virtual address of _prefix
|
||||||
*
|
*
|
||||||
* This will be updated if runtime relocations are applied.
|
* This will be updated if runtime relocations are applied.
|
||||||
@@ -531,7 +541,7 @@ enable_paging_64:
|
|||||||
li a1, SATP_MODE_SV57
|
li a1, SATP_MODE_SV57
|
||||||
|
|
||||||
/* Calculate virtual address offset */
|
/* Calculate virtual address offset */
|
||||||
LOADN t0, prefix_virt
|
LOADN t0, prefix_link
|
||||||
la t1, _prefix
|
la t1, _prefix
|
||||||
sub tp, t1, t0
|
sub tp, t1, t0
|
||||||
|
|
||||||
@@ -582,7 +592,7 @@ enable_paging_64_loop:
|
|||||||
STOREN t0, -PTE_SIZE(a3)
|
STOREN t0, -PTE_SIZE(a3)
|
||||||
|
|
||||||
/* Calculate PTE[x] address for iPXE virtual address map */
|
/* Calculate PTE[x] address for iPXE virtual address map */
|
||||||
LOADN t0, prefix_virt
|
LOADN t0, prefix_link
|
||||||
srli t0, t0, VPN1_LSB
|
srli t0, t0, VPN1_LSB
|
||||||
andi t0, t0, ( PTE_COUNT - 1 )
|
andi t0, t0, ( PTE_COUNT - 1 )
|
||||||
slli t0, t0, PTE_SIZE_LOG2
|
slli t0, t0, PTE_SIZE_LOG2
|
||||||
@@ -729,7 +739,7 @@ enable_paging_32:
|
|||||||
progress " paging:"
|
progress " paging:"
|
||||||
|
|
||||||
/* Calculate virtual address offset */
|
/* Calculate virtual address offset */
|
||||||
LOADN t0, prefix_virt
|
LOADN t0, prefix_link
|
||||||
la t1, _prefix
|
la t1, _prefix
|
||||||
sub tp, t1, t0
|
sub tp, t1, t0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user