2017-07-31 10:52 GMT+02:00 Philipp Stanner stanner@posteo.de:
- cb switches the CPU immediately to Protected Mode, yet Payloads like seaBIOS work in Real Mode. Does coreboot switch the CPU always back to RM before jumping to the payload?
No, payloads are started in pmode.
- When CB switches to PM - who generates and administrates the Page Tables and where?
We use flat mode: 4gb segments starting at 0, for code and data. Virtual address == logical address == physical address
- Gustavo Duarte writes that GRUB switches from protected mode to real mode and vice versa all the time to address >1MiB of RAM and also use the BIOS-calls. If this is true using GRUB as payload would not work, as GRUB needs to call the non-existent BIOS, right?
It uses BIOS calls, except when built for coreboot.
- Once CB is in PM it can't access physical addresses anymore? It doesn't need to, too?
We use flat mode, see above.
- PM means RAM-access is only possible through virtual addresses which are translated by the MMU using the Page Tables. This question is similar to [2.]: If coreboot generates the Page Tables and the payload would start in PM as well (is this even possible? At least the Linux-Kernel has entry points for RM and PM) this would mean the payload needs to use the Page Tables generated by CB. That wouldn't be a problem as they're linked in the register CR3 anyways?
As stated above, payloads start in pmode. As stated above, we use a flat representation which comes with no surprises. The payload can then reconfigure the system to setup its own configuration.
Why does every modern CPU still start in RM? I do get the compatibility problem, but on the other hand: Do you need it for anything beside booting MS-DOS on your Ryzen? Is it really impossible for AMD and Intel to create a new CPU-generation with the x86-instruction set without RM, 16-bit-registers and 20-bit-mode registers like CS, SS etc. No modern OS uses bios calls. No CPU is ever switched to RM again after booting up. They should get rid of this old stuff.
"Every modern x86 CPU". In the end, that's something to ask the CPU vendors (but don't expect any answers). Some guesses:
1. Windows 7 uses BIOS calls (although they stopped switching back to real mode for that, they use x86 16bit emulation. still, BIOS services need to be there) 2. CPUs might not be switched back to real mode today, but from 32bit modes it's a pretty short route to vm86 modes, which are effectively identical to real mode and still in use. 3. Why change a working system and risk compatibility issues? x86's biggest selling point is compatibility, and if you forfeit that, users may move off your architecture entirely.
Regards, Patrick