summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/transitions/librm.S
diff options
context:
space:
mode:
authorMichael Brown2016-04-14 17:48:41 +0200
committerMichael Brown2016-04-15 16:31:36 +0200
commit5e5450c2d04e6f976ea4cef5db50e136d4a06282 (patch)
tree21a059921d77d68d0508f984a0667d84c1666e12 /src/arch/x86/transitions/librm.S
parent[pool] Fix check for reopenable pooled connections (diff)
downloadipxe-5e5450c2d04e6f976ea4cef5db50e136d4a06282.tar.gz
ipxe-5e5450c2d04e6f976ea4cef5db50e136d4a06282.tar.xz
ipxe-5e5450c2d04e6f976ea4cef5db50e136d4a06282.zip
[comboot] Support COMBOOT in 64-bit builds
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/transitions/librm.S')
-rw-r--r--src/arch/x86/transitions/librm.S66
1 files changed, 64 insertions, 2 deletions
diff --git a/src/arch/x86/transitions/librm.S b/src/arch/x86/transitions/librm.S
index 3a585a92..f633b352 100644
--- a/src/arch/x86/transitions/librm.S
+++ b/src/arch/x86/transitions/librm.S
@@ -567,9 +567,10 @@ phys_to_prot:
popl %eax
ret
- /* Expose as _phys_to_virt for use by COMBOOT */
+.if32 /* Expose as _phys_to_virt for use by COMBOOT, if applicable */
.globl _phys_to_virt
.equ _phys_to_virt, phys_to_prot
+.endif
/****************************************************************************
* prot_to_phys (protected-mode near call, 32-bit virtual return address)
@@ -615,9 +616,10 @@ prot_to_phys:
popl %eax
ret
- /* Expose as _virt_to_phys for use by COMBOOT */
+.if32 /* Expose as _virt_to_phys for use by COMBOOT, if applicable */
.globl _virt_to_phys
.equ _virt_to_phys, prot_to_phys
+.endif
/****************************************************************************
* intr_to_prot (protected-mode near call, 32-bit virtual return address)
@@ -1203,6 +1205,66 @@ phys_call:
ret $( PHC_OFFSET_END - PHC_OFFSET_PARAMS )
/****************************************************************************
+ * phys_to_long (protected-mode near call, 32-bit physical return address)
+ *
+ * Used by COMBOOT.
+ *
+ ****************************************************************************
+ */
+ .if64
+
+ .section ".text.phys_to_long", "ax", @progbits
+ .code32
+phys_to_long:
+
+ /* Switch to virtual addresses */
+ call phys_to_prot
+
+ /* Convert to 32-bit virtual return address */
+ pushl %eax
+ movl VIRTUAL(virt_offset), %eax
+ subl %eax, 4(%esp)
+ popl %eax
+
+ /* Switch to long mode and return */
+ jmp prot_to_long
+
+ /* Expose as _phys_to_virt for use by COMBOOT */
+ .globl _phys_to_virt
+ .equ _phys_to_virt, phys_to_long
+
+ .endif
+
+/****************************************************************************
+ * long_to_phys (long-mode near call, 64-bit virtual return address)
+ *
+ * Used by COMBOOT.
+ *
+ ****************************************************************************
+ */
+ .if64
+
+ .section ".text.long_to_phys", "ax", @progbits
+ .code64
+long_to_phys:
+
+ /* Switch to protected mode */
+ call long_to_prot
+ .code32
+
+ /* Convert to 32-bit virtual return address */
+ popl (%esp)
+
+ /* Switch to physical addresses and return */
+ jmp prot_to_phys
+
+ /* Expose as _virt_to_phys for use by COMBOOT */
+ .globl _virt_to_phys
+ .equ _virt_to_phys, long_to_phys
+
+ .endif
+
+/****************************************************************************
* flatten_real_mode (real-mode near call)
*
* Switch to flat real mode