I have had success in getting Win64 executables to
run under UEFI with a relatively small amount of
"glue" to switch formats.
And I decided to see if I could get Win32 executables
to run instead of Win64, using different - more
complicated - "glue".
Here is a simple call to puts, but written in assembler
(so I need a C compiler to generate assembler that
looks like this - a separate exercise):
https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdpclib/msdemo32.asm
So this is dependent on msvcrt.dll, and then this loader code:
https://sourceforge.net/p/pdos/gitcode/ci/master/tree/bios/exeload.c
(search for w32puts) will put in the stubs for the win32
executable, and the puts stub can be found here:
https://sourceforge.net/p/pdos/gitcode/ci/master/tree/generic/w32hack.asm
So anyway, with this in place, it means I can write a 32-bit
windows executable that works on anything from win 95
to win 11, and it also runs on an appropriate 64-bit UEFI-based
system (basically just UCX64 from
http://pdos.org). Note that
this is running 32-bit code in long mode.
There will be issues for something like printf, where I don't
know how many parameters there are, so I will just assume
a maximum of 4 or something like that.
Any thoughts/improvements?
Thanks. Paul.