Which file does is first read by the cpu in the booting proccess


Very true, and that is also true for any operating system I am aware of, at least on x86 type hardware, where you must perform tricky stuff like switching from real/16-bit mode into protected/32-bit or 64-bit mode.
 
Forgive me, my experience with Assembly was limited to an 8088 in classes on a Friday afternoon following lunches in the student bar. I'm somewhat amazed that they still need to start a 64bit CPU in real mode and switch twice to get into 64Bit mode. Would this issue still exist if you were running EFI and not BIOS?
 
I honestly don't know the answer to that one. But before you can switch to 64-bit mode you need to set up segment selectors, an interrupt table and paging. Conceivably these could be set to some standard values, but normally you would want to specify these details yourself. But there are still several other things that you will want to set up that cannot be accessed from C (several configuration registers for example), so a certain amount of assembler is always going to be required.

I guess if the x86-64 didn't care about backwards compatibility it would be a lot cleaner. I'd be interested in studying the IA64, but where can you easily get hold of one of them? The PPC and ARM processors are a bit cleaner in this respect.
 

bmouring

Distinguished
May 6, 2006
1,215
0
19,360


A *lot* of the legacy crap of BIOS was cut out in the move over to UEFI, but your old friend real-mode still is alive and kicking and, again, this is all due to the combination of desire to maintain compatibility with various flavors of CP/M and DOS and a nasty chicken-and-egg issue between Intel/AMD and the mobo manufacturers