29 EFI Byte Code Porting Considerations

There are a few considerations to keep in mind when writing drivers that may be ported to EBC (EFI byte code). This chapter describes these considerations in detail and, where applicable, provides solutions to address them. If UEFI drivers are implemented with these considerations in mind, the C code may not require any changes. In this case, a native driver may be ported to EBC simply by recompiling the driver sources using the Intel(R) C Compiler for EFI Byte Code. The tasks required to convert a UEFI Driver to an EBC include the following:
  • Port assembly language sources to C language sources.
  • Port C++ language sources to C language sources.
  • Eliminate use of the float type.
  • Convert floating point math operations to integer math operations.
  • Eliminate use of sizeof() in statements that require a constant.
  • Avoid arithmetic operations and comparisons between natural integers and fixed size integers. Some specific combinations produce unexpected results.
  • Optimize for performance