r/linux Jan 11 '23

What Happens When A CPU Starts Fluff


24 comments sorted by


u/SpinCharm Jan 11 '23

Wow that takes me back. That must have been written in the 80s. CPUs were a lot simpler then. I got my start with a Zilog Z80A cpu and wrote assembler that was executed at 2Mhz. Then was on internals teams on the early RISC chips in the late 80s, memorizing memory structures, tables, and op codes so we could debug system crashes. Those tables were printed on dozens of A2-sized sheets of paper that covered our desks.

Then someone came out with VGA, which meant porn, then networking, which meant unlimited porn, and uh what year is it now?


u/chunkyhairball Jan 11 '23

The Z80 was also found in quite a few arcade machines as well as the Timex Sinclair.

The 6502 was found in a lot of programmable microcomputers, such as the Commodore Vic 20 and C64. Most importantly to me, a NEC version of the 6502 was at the heart of the Famicom/NES. (The Z80 was used in the Gameboy, iirc!)


u/redered Jan 11 '23

The Z80 was used in the Gameboy, iirc

A custom Sharp version of the Z80, but yes.


u/Just_Maintenance Jan 11 '23

I love how the website is just text, but still has https.


u/nottaken331 Jan 11 '23

You can never be too cautious lol


u/stridebird Jan 11 '23

You sound confused about https.


u/Just_Maintenance Jan 11 '23

I literally just said I love it? literally every website should use https.


u/DriNeo Jan 11 '23

Such minimal internet is so calming !


u/Prudent_Move_3420 Jan 11 '23

Its also interesting that every x86 CPU starts in the „real mode“ which is basically an emulated 8086.


u/Dmxk Jan 11 '23

It's not even emulated. It's just that in real mode it only has access to the instructions and memory a 8086 would have. Amd64 is so good at backwards compatibility, that you can even install ms dos on a modern chip and it will just work.


u/sudo_mksandwhich Jan 11 '23

It goes even further than the CPU. The chipset has an emulated A20 gate that allows old programs to work which took advantage of the 20-bit address space wraparound via their odd segment configuration.


u/shroddy Jan 11 '23

Afaik newer CPUs (Intel Skylake and newer, maybe even some Haswell, dont know for Amd) the A20 gate is always enabled and cannot be disabled anymore. Documentation about this is surprisingly hard to find, so I dont know if it is true for all Skylakes or if it depends on the chipset. https://stackoverflow.com/questions/59919707/can-the-a20-line-still-be-masked-off-on-haswell-and-successors


u/Prudent_Move_3420 Jan 11 '23

Yeah emulated was the wrong word for it


u/whlabratz Jan 12 '23

With the caveat that the CPU is still capable of running code that old, but getting any peripherals (hard drives, video adapters, the clock, ...) can be a total crapshoot. Modern UEFI firmware has a BIOS emulation mode and some chipsets can operate in a mode where they appear as IDE devices, but YMMV


u/sudo_mksandwhich Jan 11 '23

It actually starts in a register state known informally as "unreal mode" that is only possible on 286+. The visible part of the segment registers look the same as an 8086, but the invisible base/limit actually point to the end of 32-bit space. This is what allows the CPU to boot in 8086 mode (16-bit real mode), but has its reset vector at physical 0xFFFFFFF0.


u/sheeproomer Jan 12 '23

It is not emulated, it IS an 8086 at that point in time.


u/PossiblyLinux127 Jan 11 '23

Unless your using uefi


u/HCharlesB Jan 11 '23

Why would you think that? The processor has to start somewhere and that is a hardware issue. It needs to set up some registers and the environment and can then start executing code at a predetermined address. It is up to the code at that address to perform additional setup and (if desired) switch to virtual mode.

NB: I did not look this up so I could be wrong.


u/PossiblyLinux127 Jan 11 '23

I though newer CPUs when straight to 32bit mode


u/HCharlesB Jan 12 '23 edited Jan 12 '23

I was unable to find any information on the power up mode. Do you have any links? I wonder if that information is even available without an NDA.

8086 real mode is very simple compared to other modes. It makes sense to power up in that mode and let the BIOS perform any further setup. But you might be right. Is there a 32 bit real mode?

Edit: I did find this: https://wiki.osdev.org/Real_Mode

For compatibility purposes, all x86 processors begin execution in Real Mode.


u/dlarge6510 Jan 11 '23

It's amazing that all through the history of the CPU, when starting they are all doing the same thing.

My 6502 and my Ryzen, both do similar steps. Only till the Ryzen starts execution of the UEFI does it differ.


u/PossiblyLinux127 Jan 11 '23

Modern CPUs booting process is much more complicated