PE machine definitions

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kerravon
Member
Member
Posts: 320
Joined: Fri Nov 17, 2006 5:26 am

PE machine definitions

Post by kerravon »

As you may or may not know, Microsoft Windows is available for both ARM and x86 - and indeed, both platforms allow both 32-bit and 64-bit programming with small executables using msvcrt.dll for the C runtime library.

And PDOS-generic (at pdos.org) provides a mini Windows clone of all 4 of those environments.

Even though Microsoft may not be interested in porting their version to the 68000 or mainframe (S/370 or z/Arch), I am, and I would like to have official machine definition numbers for this field:

https://learn.microsoft.com/en-us/windo ... /pe-format

e.g.

IMAGE_FILE_MACHINE_AMD64
0x8664
x64


I need 32-bit 68000 and 32-bit S/370 and 64-bit z/Arch

I note that the UEFI spec uses PE too, so I was wondering if they were (now?) the official body that assigns numbers rather than Microsoft.

Either way I am reluctant to click on the UEFI spec which says "by clicking on this you agree ..." and prefer to keep a distance from them for (at least attempted) clean-room purposes.

I am happy to email them though, if the numbers don't already exist.

Any idea what the situation is? ie who controls number assignment?

Thanks. Paul.
User avatar
bellezzasolo
Member
Member
Posts: 120
Joined: Sun Feb 20, 2011 2:01 pm

Re: PE machine definitions

Post by bellezzasolo »

kerravon wrote: Thu Jul 03, 2025 11:04 pm As you may or may not know, Microsoft Windows is available for both ARM and x86 - and indeed, both platforms allow both 32-bit and 64-bit programming with small executables using msvcrt.dll for the C runtime library.

And PDOS-generic (at pdos.org) provides a mini Windows clone of all 4 of those environments.

Even though Microsoft may not be interested in porting their version to the 68000 or mainframe (S/370 or z/Arch), I am, and I would like to have official machine definition numbers for this field:

https://learn.microsoft.com/en-us/windo ... /pe-format

e.g.

IMAGE_FILE_MACHINE_AMD64
0x8664
x64


I need 32-bit 68000 and 32-bit S/370 and 64-bit z/Arch

I note that the UEFI spec uses PE too, so I was wondering if they were (now?) the official body that assigns numbers rather than Microsoft.

Either way I am reluctant to click on the UEFI spec which says "by clicking on this you agree ..." and prefer to keep a distance from them for (at least attempted) clean-room purposes.

I am happy to email them though, if the numbers don't already exist.

Any idea what the situation is? ie who controls number assignment?

Thanks. Paul.
Pretty academic, as the UEFI spec defines calling convention etc, but in fact is only defined for a subset of the architectures listed under the PE format.

Code: Select all

// PE32+ Machine type for EFI images
#define EFI_IMAGE_MACHINE_IA32 0x014c
#define EFI_IMAGE_MACHINE_IA64 0x0200
#define EFI_IMAGE_MACHINE_EBC 0x0EBC
#define EFI_IMAGE_MACHINE_x64 0x8664
#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
#define EFI_IMAGE_MACHINE_AARCH64 0xAA64
#define EFI_IMAGE_MACHINE_RISCV32 0x5032
#define EFI_IMAGE_MACHINE_RISCV64 0x5064
#define EFI_IMAGE_MACHINE_RISCV128 0x5128
#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232
#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264
Whoever said you can't do OS development on Windows?
https://github.com/ChaiSoft/ChaiOS
User avatar
iansjack
Member
Member
Posts: 4815
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: PE machine definitions

Post by iansjack »

There is a type for the Motorola 68000 (0x0268) but not, apparently, for the IBM mainframes. Your best bet is to use "Unknown architecture" (0x0000).

https://github.com/torvalds/linux/blob/ ... linux/pe.h

I'm honestly surprised, with your passion for public domain, that you use Microsoft's executable file format.
kerravon
Member
Member
Posts: 320
Joined: Fri Nov 17, 2006 5:26 am

Re: PE machine definitions

Post by kerravon »

iansjack wrote: Fri Jul 04, 2025 8:49 am There is a type for the Motorola 68000 (0x0268) but not, apparently, for the IBM mainframes. Your best bet is to use "Unknown architecture" (0x0000).

https://github.com/torvalds/linux/blob/ ... linux/pe.h
Ok, thanks.
I'm honestly surprised, with your passion for public domain, that you use Microsoft's executable file format.
The code in pdld and PDOS is all public domain. What relevance is the executable file format that I use?

Regardless of that, it wasn't me who started using PE - I used a.out. A couple of Slovakians are responsible for PE being supported, and for "mini Windows clone" being a thing.

And regardless of that - how else are you supposed to compete with Microsoft if you don't even support PE format? I currently run a subset of Win32 and Win64 binary apps. If I didn't have PE support, it wouldn't be a subset, it would be precisely 0.

However, it is true that I intended to compete with Microsoft anyway, but with an expectation that people would recompile their C90 apps and produce an a.out executable that used an MSDOS-inspired API. But at one point Alica Okano was running the show and I was mostly just standing out of her way. Then she suddenly disappeared - I'm guessing Microsoft's goons assassinated her, but no idea.
kerravon
Member
Member
Posts: 320
Joined: Fri Nov 17, 2006 5:26 am

Re: PE machine definitions

Post by kerravon »

And besides all of that - the intention was that (likely a derivative of) PDOS would be commercialized - not necessarily by me - to be commercial quality. So there would be multiple competing commercial Windows (partial) clones, with Microsoft just being one vendor (not PDOS-derived). Commercial and closed source so that the vendor can protect their work, which is basically a trade secret.
User avatar
iansjack
Member
Member
Posts: 4815
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: PE machine definitions

Post by iansjack »

Fair enough. Although, if you are recompiling executables to run on a different architecture couldn't you choose a different format?

Have you contacted Microsoft to request the machine types you require?
kerravon
Member
Member
Posts: 320
Joined: Fri Nov 17, 2006 5:26 am

Re: PE machine definitions

Post by kerravon »

iansjack wrote: Fri Jul 04, 2025 11:30 pm Fair enough. Although, if you are recompiling executables to run on a different architecture couldn't you choose a different format?
Yes, I certainly could have. And I already do have that - you can use Amiga hunk for your PDOS-generic executables. I don't have any particular reason to be using Win32 and/or PE. I don't have a particular reason to not use it either. It's up to others - with their commercial derivatives - or non-commercial derivatives - to decide what they want. I'm just putting some variations out there to prove what is possible and provide a starting point. I don't really have a "grand plan". I can likely define NEED_ELF in the makefile and get that working too if it would help you achieve some tangible goal.
Have you contacted Microsoft to request the machine types you require?
Yes - I submitted feedback.

https://aka.ms/AAwyk3o
Post Reply