UEFI: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
More reorganization |
|||
Line 591:
We need to unload executable binary by "file" command after sections layout is displayed because otherwise its symbols will override debug symbols loaded by "add-symbol-file" command (at least for data section). You do not need to load it each time because sections addresses will change only after next recompilation. Alternatively "objdump" utility can be used to dump sections. As you can see after setup is done you can normally debug your application using whole power of the GDB. Set your "wait" variable to zero and you will exit from endless loop. Set breakpoints/watchpoints, continue execution, enjoy debugging!
== Binary Format ==▼
== UEFI applications in detail ==
▲=== Binary Format ===
(U)EFI generally uses the PE-executable format, with its very own subtypes. Every (U)EFI application is basically a DLL without symbol tables et al, and another subtypes:
Line 599 ⟶ 600:
* (U)EFI run-time driver (12).
=== Calling Conventions ===
The EFI specifications specify the calling conventions for 32-bit 80x86 and Itanium. The (later) UEFI specifications define the calling conventions for 32-bit 80x86, Itanium and 64-bit 80x86
Line 607:
For 64-bit 80x86, Microsoft's x64 calling convention is used. This calling convention requires the stack be aligned on a 16-byte boundary (from the callee's perspective), and that a 32-byte "shadow space" be reserved on the stack (immediately above the return RIP). The shadow space is not described by the UEFI specifications. This can lead to frustrated assembly language programmers (who are writing code based on the UEFI specifications alone and don't know about the shadow space, and therefore waste '''hours''' trying to figure out why their stack gets trashed by some EFI functions).
===
TODO
== Example in FASM ==
Line 685 ⟶ 667:
section '.reloc' fixups data discardable
</source>
=== EFI Byte Code===
TODO
== Common Problems ==
=== My
When control is handed to your
=== My bootloader hangs if I use user defined EFI_MEMORY_TYPE values ===
Line 697 ⟶ 683:
== See also ==
=== OSDEV ===
* [[UEFI Bare Bones]]
* [[PE]] file format
=== Wikipedia ===
|