If the BIOS can do it, why can't I?
Posted: Fri Aug 21, 2020 11:29 am
Alright, this is something that has been on my mind for quite a bit of time now. Let's assume the case of 99% of desktop PCs today - with an Intel (or AMD) x86(-64) processor. The Intel manual says that on reset, the processor starts off at a specified reset vector (in unreal mode technically?). This reset vector should be a system physical address that would correspond to the BIOS flash chip (which is simply memory which contains BIOS code which is executed by the processor). The BIOS code (it should be simple x86 code right? After all, it is executed by the x86 processor) does a TON of magic now, including but not limited to copying the BIOS code into DRAM and remapping the physical addresses in the system agent (that is, the same physical address of BIOS would point to DRAM now).
Here is the issue, whatever is done at startup is just x86 instructions executed by the processor right? So if the BIOS code can remap the physical addresses to any place it wanted, why can't I? Or can I, but it is implementation-dependent? How does this remapping even occur? What sort of instructions would the BIOS use to achieve this? I/O read/writes? I'm not sure.
P.S. I've always used BIOS code instead of BIOS, because after all it is just code, and I don't want to portray the BIOS as some sort of entity/being who does something (The BIOS configures PCI? No. The BIOS code does)
Here is the issue, whatever is done at startup is just x86 instructions executed by the processor right? So if the BIOS code can remap the physical addresses to any place it wanted, why can't I? Or can I, but it is implementation-dependent? How does this remapping even occur? What sort of instructions would the BIOS use to achieve this? I/O read/writes? I'm not sure.
P.S. I've always used BIOS code instead of BIOS, because after all it is just code, and I don't want to portray the BIOS as some sort of entity/being who does something (The BIOS configures PCI? No. The BIOS code does)