davmac314 wrote:
In a UEFI environment all running applications share the same page mapping. There is no isolation. If one application requests a funky mapping, it's forced upon all other running applications as well.
I'm not expecting other "applications" to be running. This is a dead PC. I stick in my USB stick with my bootloader/kernel/apps (all on the USB stick) and fire it up. The same as I have traditionally done with a traditional BIOS.
If it's a bootloader, exit boot services and setup whatever mapping you please.
I don't want to exit boot services. That's what I'm using as a BIOS and/or OS.
If you continue running in the boot services environment, you don't know other applications you are sharing it with. They may have been started before your "bootloader" was. Some of them may be drivers.
Well - I expect that to be part of the UEFI environment. So yes, they can't access the 4-8 GiB region. My UEFI would need an option to make that physical memory inaccessible to other components as it can potentially be remapped.
This feels like wrong use of the term "bootloader". A boot loader typically uses UEFI only to get established and assist in loading the kernel. Once that's done, it exits boot services, sets up whatever mode/mapping is required, and executes the kernel. Device memory is (in general) no longer under UEFI control the moment you exit boot services.
Ok, so terminology. It's unclear what UCX64 actually is. It currently has the ability to run some Win64 executables. It does this with minimal code. Basically converting a Win64 call to msvcrt.dll into (eventually) a UEFI call. It also needs to actually load the Win64 executables into memory since this file format - or at least the DLLs (msvcrt.dll) are not known to UEFI. But both memory management and file management have been left to UEFI to do (at least currently - I do have my own versions of both of these things that I could switch in).
1. This allows CM32 to be removed from the processor entirely, making it simpler/cheaper.
2. It may actually be LM64 that is removed from the processor entirely, and I'll switch in a 32-bit processor that looks mostly, but not entirely, like the 80386 (extra instructions are required to manipulate R8 and R9)
So you're talking custom architecture. Why bother with UEFI at all? Write whatever firmware you want.
First it will work with existing x64 processors and a slightly modified UEFI. I'm not trying to change the world, I'm just trying to sneak in 32-bit software with minimal fuss.
THEN, someone else can make a cheaper 32-bit or cheaper 64-bit processor, and my software will continue to work unchanged.
3. I don't need to run - potentially for a long time - with interrupts disabled.
To be honest I don't find any of those compelling. [3] in particular isn't the case even if you do switch mode.
What do you mean? In my design I don't exit boot services. Therefore I need to disable interrupts before switching to CM32, and return to LM64 before reenabling them to do a UEFI call. If I stay in LM64 (running unusual 32-bit code), I don't need to disable interrupts at all - especially not for a long time.
This would require a specific spot that may clash with other extensions, and I can't detect whether the extension is actually there, without crashing, right?
I mean, what you've described is "not UEFI". So there aren't any extensions for it. There isn't
any existing software for it. You have to modify the firmware anyway, do whatever you want.
The software will exist, rapidly, as soon as I have a C compiler that has been modified to produce the "unusual assembler". I have standard C90 code already, standing by. In fact, a lot of it will probably run without any UEFI changes, because negative indexes aren't very common.
Forgive me for saying so but it seems like you're so hell-bent on a particular solution that you've forgotten what the problem is. It's certainly not clear to me what problem you're trying to solve.
Running Win32 instead of Win64 software under 64-bit UEFI. If you look at
http://pdos.org at the bottom of the UCX64 section, I have that already as proof of concept. Negative indexes won't work though - but I don't have negative indexes.
At a later date ... run that exact same Win32 software on an 80386.
Or ... make that an earlier date ... 1986. Replace the BIOS with 64-bit UEFI in 1986. Or create a 64-bit UEFI layer on top of the BIOS, in 1986. And when I say "64-bit UEFI" - it will be ready for UEFI - parameters on the stack will occupy 8 bytes, the stack will always be 16-byte aligned, but back in 1986 it will actually be 32-bit. But standing by ready for genuine 64-bit UEFI.
1. How would you get a literal 80386 to boot and run x64 UEFI firmware?
The details of the UEFI implementation and the processor used are hidden from the bootloader/kernel/win32 application author and are out of scope. These people just need to know what rules to follow to work on both an 80386 and x64.
2. If you had an 80386 and were dead-set on using UEFI, why wouldn't you just run a 32-bit UEFI firmware? And then you can happily run 32-bit code without any funky mapping hacks or "extensions", no need to change calling conventions, etc.
That would require both an 80386 and x64 version of every single 32-bit program I wrote, starting in 1986.
The goal is for a single executable to run on either an 80386 or an x64 in LM64, and without conditional execution/duplication/layers (in my executables - I don't really care what happens outside of my executables).