Dell - Internal Use - Confidential
Tested it on a 32-bit system and it worked (after updating my USB key with a
shell 2.0 version of BOOTIA32.efi that is).
Ok, now the question is how to take the output of the ver command and use it in
an nsh file to read the 64 or 32.
Any ideas? ... I find the shell command very limiting in this respect.
</Lowell>
From: Dennis, Lowell
Sent: Wednesday, September 10, 2014 9:07 AM
To: [email protected]
Subject: Re: [edk2] Is there a way ...
Thanks Allen,
FS0:\> ver -s -_pa
2.0
64
Seems to work. I do not have any IA32 H/W at the moment. Could someone who
does have IA32 H/W please try it out and verify that it indicates 32-bit.
- Lowell
-----Original Message-----
From: Wynn, Allen
Sent: Wednesday, September 10, 2014 8:47 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [edk2] Is there a way ...
Have you tried following?
ver -_pa
See ShellPkg\Library\UefiShellLevel3CommandsLib\Ver.c (snippet below)
//
// implementation specific support for displaying processor architecture
//
if (ShellCommandLineGetFlag(Package, L"-_pa")) {
ShellPrintEx(-1, -1, L"%d\r\n", sizeof(UINTN)==sizeof(UINT64)?64:32);
}
Best Regards,
Allen
-----Original Message-----
From: Andrew Fish [mailto:[email protected]]
Sent: Tuesday, September 9, 2014 3:53 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: [edk2] Is there a way ...
On Sep 9, 2014, at 1:44 PM, Laszlo Ersek wrote:
> On 09/09/14 21:52, [email protected]<mailto:[email protected]>
> wrote:
>> *Dell - Internal Use - Confidential *
>
> (not very confidential...)
But some lawyer is happy.
>
>> I would like to know if there is a way from the EFI shell to
>> determine if this is a 32-bit or 64-bit environment.
>>
>> For the most part, I am using BOOTX64.efi.
>>
>> However, it would be nice to be able to gracefully handle the
>> situation where BOOTIA32.efi was used.
>>
>> For example, let's say I have a home grown utility that has a 32-bit
>> and a 64-bit efi file. How do I determine which one to use from an nsh
>> script?
>
> When in doubt, use brute force, I guess. Start the 64-bit variant, and
> if it fails, start the 32-bit one. LoadImage() won't let you load a
> binary with incorrect bitness (or another architecture mismatch). IIRC
> the return value in this case is EFI_UNSUPPORTED.
>
>From C code, you can use #ifdef to figure out your image type.
#ifdef MDE_CPU_X64
#ifdef MDE_CPU_IA32
The DXE Core uses the EFI_IMAGE_MACHINE_TYPE_SUPPORTED() macro. It tells you if
the PE/COFF image type is supported.
The image types from the PE/COFF header are:
///
/// PE32+ Machine type for IA32 UEFI images.
///
#define EFI_IMAGE_MACHINE_IA32 0x014C
///
/// PE32+ Machine type for IA64 UEFI images.
///
#define EFI_IMAGE_MACHINE_IA64 0x0200
///
/// PE32+ Machine type for EBC UEFI images.
///
#define EFI_IMAGE_MACHINE_EBC 0x0EBC
///
/// PE32+ Machine type for X64 UEFI images.
///
#define EFI_IMAGE_MACHINE_X64 0x8664
///
/// PE32+ Machine type for ARM mixed ARM and Thumb/Thumb2 images.
///
#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
///
/// PE32+ Machine type for AARCH64 A64 images.
///
#define EFI_IMAGE_MACHINE_AARCH64 0xAA64
Thanks,
Andrew Fish
> Granted, this might not allow you to tell apart genuine error exits of
> the application from "failed to load due to wrong bitness". For that
> case, write an empty application (one that returns with success from
> main() immediately), and use the brute force approach on those -- they
> can't really fail due to any other reason than wrong bitness. Then key
> off the real application's selection from this result.
>
> Just my 2 cents.
>
> Laszlo
>
>
> ----------------------------------------------------------------------
> --------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce.
> Perforce version control. Predictably reliable.
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.
> clktrk _______________________________________________
> edk2-devel mailing list
> [email protected]<mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel