mirror of
https://github.com/ipxe/ipxe
synced 2026-01-13 00:48:39 +03:00
[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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user