Back in high school, I studiously avoided taking the Pascal class. At the time, I was a true AppleSoft BASIC and 6502 assembly-language hacker. But one of the items that always fascinated me was that the Apple Pascal compiler. The compiler didn't generate "real" code. It generated p-code. That p-code was, in fact, a stack-based assembly language, but not for any real CPU. Instead, an interpreter processed the p-code. Which made it hard to do anything useful except write high school computer homework assignments.
Fast forward to 2007, Apple is back presenting (along with me and several Intel folks) about another type of p-code: EBC. EBC (EFI Byte Code) is a pseudo-assembly language which is designed to execute correctly on either 32-bit or 64-bit machines without modification. It is designed to operate seamlessly with other UEFI drivers written, even if they're not in EBC. The goal was that you could take your native UEFI driver and recompile it to work in EBC without modifications.
This sounds great. But have you considered what happens when the size of a struct can change based on the size of VOID *? Your sizeof() operator no longer generates a constant value. Instead, it is more like a function. How do you initialize that structure? You can't do it at build time because the offsets of the members may vary depend on the size of your INT.
So this event got everyone together: motherboard folks, BIOS vendors, plug-in card vendors and compiler writers, in one big room, threw in some pizza, and tried to get everyone to play nice with each other. The two server systems in the room provided sufficient white noise to mask the hubbub of folks talking about compiler issues, driver issues and BIOS issues. It was certainly nice to see a number of high quality 3rd party UEFI drivers in the room.
Dong Wei, the chair of the UEFI Test Working Group, pointed out that our next p-code problem will probably be the user-interface forms language (IFR) in UEFI 2.1. Yet-Another-P-Code. Sounds like the topic for another summit.
Tim