ebc Projects


EFI Byte Code

Just as UEFI is becoming mainstream in the PC market, the first EFI platform -- the Itanium -- looks set to be retired. Having acquired an Itanium recently, and with absolutely no idea how to write a native IA64 program, it seems logical to try EBC, because in theory at least, a program which runs in the x64 EFI shell should run in the Itanium EFI Shell.

Searching around the internet yields only a handful of EBC programs, all of which, I found, cause fatal system crashes in the Itanium EFI Shell. This traces to 64-bit PE32 relocation records targeting non-aligned addresses. (Itanium boots with alignment checking enabled).

Relative addressing can bypass the need for a runtime fixup. helloebc.html is a small program written in EFI Byte Code to display a message with no relocations at all - it derives the image load address from IP (instruction pointer). helloebc.efi is the compiled version of this program, which does run in both the x64 and the IA64 Shell.

{ebc1} has now been developed further produce a custom relocation table; along with a small assembly routine at the PE32 entry point, ChaOS EBC programs self-relocate according to the Image Load Address as reported by EFI using GetProtocol(EFI_LOADED_IMAGE). All relocations target 64-bit aligned addresses (pointer fixups), and function calls are done using relative addressing.

March 2017: Ported {armc1} -> {ebc1} to produce EFI Byte Code, for the EFI pre-boot Virtual Machine (provided it is supported in firmware). This provided a first glimpse of the Itanium environment.