Search code examples
assemblybootprocessor

linux booting process


I started leaning the booting process of Linux OS. It says that the first program executed by the processor is BIOS. I want to know what will be the contents of the instruction pointer and what is the first instruction that is executed by the microprocessor?

Moreover, are these BIOS instructions actually brought into the main memory to execute?? If yes, then where are these instructions loaded, i mean the starting address . If no, whats the reason in not bringing them into the memory?

Adding to these, where does the interrupt vector table actually resides? RAM or ROM??


Solution

  • Note: this is all for x86. This may be different for other platforms.

    What the instruction pointer points to first, well, depends. Typically, a processor will set this to 0 on reset, but it's defined by the processor and ultimately, who made it. In the case of x86, it will jump to 0xFFFFFFF0 (source). This will just contain a jump to a useful section of BIOS code.

    Your BIOS then needs to start setting up your system. To do this, it executes directly from its ROM chip, since your memory hasn't been properly initialised now. This is specific to the platform, but typically on x86, the BIOS will put the CPU into cache-as-RAM mode, allowing it some temporary storage while it sets up the memory.

    It will then set up the rest of the system. This includes the IVT, which resides at the bottom of memory (0x0) and other useful stuff (source 1, source 2).