I'm trying to nail down what the proper Machine Type value in the PE/COFF header should be for ARM linux images with the stub.
The PE/COFF specification lists two values that seem appropriate:
IMAGE_FILE_MACHINE_ARM 0x1c0 "ARM little endian" IMAGE_FILE_MACHINE_THUMB 0x1c2 "ARM or Thumb ("interworking")"
Tianocore currently only supports the 0x1c2 value, but it seems that the 0x1c0 should also be supported. Is there a specific reason only 0x1c2 is supported?
Thanks, Roy
(I responded to the original thread on linux-kernel, but I'll respond here to so as not to leave it hanging.)
On 15 January 2014 03:06, Roy Franz roy.franz@linaro.org wrote:
I'm trying to nail down what the proper Machine Type value in the PE/COFF header should be for ARM linux images with the stub.
The PE/COFF specification lists two values that seem appropriate:
IMAGE_FILE_MACHINE_ARM 0x1c0 "ARM little endian" IMAGE_FILE_MACHINE_THUMB 0x1c2 "ARM or Thumb ("interworking")"
Tianocore currently only supports the 0x1c2 value, but it seems that the 0x1c0 should also be supported. Is there a specific reason only 0x1c2 is supported?
0x1c2 specifies that the application supports "interworking" - an application can contain both ARM (A32) and Thumb (T32) instructions. This is mandated by modern procedure-call standards (which are mandated by the UEFI spec). . 0x1c0 is "ARM (now A32) only", so not conformant to modern PCS. There is also an 0x1c4 code - "Thumb (T32) only", invalid for similar reasons.
Regards,
Leif
On 01/15/14 04:06, Roy Franz wrote:
I'm trying to nail down what the proper Machine Type value in the PE/COFF header should be for ARM linux images with the stub.
The PE/COFF specification lists two values that seem appropriate:
IMAGE_FILE_MACHINE_ARM 0x1c0 "ARM little endian" IMAGE_FILE_MACHINE_THUMB 0x1c2 "ARM or Thumb ("interworking")"
Tianocore currently only supports the 0x1c2 value, but it seems that the 0x1c0 should also be supported. Is there a specific reason only 0x1c2 is supported?
Just a guess, from "BaseTools/Source/C/Common/BasePeCoff.c", function PeCoffLoaderCheckImageType():
if (ImageContext->Machine == IMAGE_FILE_MACHINE_ARM) { // // There are two types of ARM images. Pure ARM and ARM/Thumb. // If we see the ARM say it is the ARM/Thumb so there is only // a single machine type we need to check for ARM. // ImageContext->Machine = EFI_IMAGE_MACHINE_ARMT; if (ImageContext->IsTeImage == FALSE) { PeHdr->Pe32.FileHeader.Machine = ImageContext->Machine; } else { TeHdr->Machine = ImageContext->Machine; }
} else {
Laszlo