Sign in with
Sign up | Sign in
Your question

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

Last response: in Linux/Free BSD
Share
August 22, 2011 7:57:00 AM

http://lxr.linux.no

OK in this link which file is first read, I think it should be in assembly language where the computer is introduced to the c language.
a b à CPUs
August 22, 2011 10:53:56 AM

The entry point for the kernel is the label "_start" in "header.S" (for the x86 version). That's in the arch/x86/boot directory.
August 23, 2011 10:51:08 PM

Just to be clear, C language is compiled into assembly language so it can be run.
a b à CPUs
August 24, 2011 6:20:15 AM

That's true, but the OP is correct to assume that the initial kernel routines are written directly in assembler, not C.
August 24, 2011 7:59:37 PM

Ijack said:
That's true, but the OP is correct to assume that the initial kernel routines are written directly in assembler, not C.

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.
August 25, 2011 7:03:06 PM

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?
a b à CPUs
August 25, 2011 7:25:11 PM

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.
August 25, 2011 8:35:53 PM

audiovoodoo said:
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?


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
!