summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/include
diff options
context:
space:
mode:
authorMichael Brown2016-02-19 20:43:04 +0100
committerMichael Brown2016-02-21 00:09:36 +0100
commitea203e4fe1c60504023ea2604604d8092f24effc (patch)
treea35f62d6dc59334ad9118020ac1adabc567069ac /src/arch/x86/include
parent[build] Fix building on older versions of binutils (diff)
downloadipxe-ea203e4fe1c60504023ea2604604d8092f24effc.tar.gz
ipxe-ea203e4fe1c60504023ea2604604d8092f24effc.tar.xz
ipxe-ea203e4fe1c60504023ea2604604d8092f24effc.zip
[librm] Add phys_call() wrapper for calling code with physical addressing
Add a phys_call() wrapper function (analogous to the existing real_call() wrapper function) for calling code with flat physical addressing, and use this wrapper within the PHYS_CODE() macro. Move the relevant functionality inside librm.S, where it more naturally belongs. The COMBOOT code currently uses explicit calls to _virt_to_phys and _phys_to_virt. These will need to be rewritten if our COMBOOT support is ever generalised to be able to run in a 64-bit build. Specifically: - com32_exec_loop() should be restructured to use PHYS_CODE() - com32_wrapper.S should be restructured to use an equivalent of prot_call(), passing parameters via a struct i386_all_regs - there appears to be no need for com32_wrapper.S to switch between external and internal stacks; this could be omitted to simplify the design. For now, librm.S continues to expose _virt_to_phys and _phys_to_virt for use by com32.c and com32_wrapper.S. Similarly, librm.S continues to expose _intr_to_virt for use by gdbidt.S. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/include')
-rw-r--r--src/arch/x86/include/librm.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/arch/x86/include/librm.h b/src/arch/x86/include/librm.h
index fc31c5036..bc925a2db 100644
--- a/src/arch/x86/include/librm.h
+++ b/src/arch/x86/include/librm.h
@@ -250,11 +250,16 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
/* PHYS_CODE: declare a fragment of code that executes in flat physical mode */
#define PHYS_CODE( asm_code_str ) \
- "call _virt_to_phys\n\t" \
+ "push $1f\n\t" \
+ "call phys_call\n\t" \
+ ".section \".text.phys\", \"ax\", @progbits\n\t"\
".code32\n\t" \
+ "\n1:\n\t" \
asm_code_str \
- "call _phys_to_virt\n\t" \
- CODE_DEFAULT "\n\t"
+ "\n\t" \
+ "ret\n\t" \
+ CODE_DEFAULT "\n\t" \
+ ".previous\n\t"
/** Number of interrupts */
#define NUM_INT 256