Why did bootsect move to 0x90000 on linux (x86)?

I am studying the boot process of x86 systems and here is the boot flow:

  • BIOS loads boot file from MBR disk at memory address 0x7c00
  • boosect copies itself to 0x90000 memory address and jumps to 0x90000.
  • load load from disk to memory address 0x90200.
  • Get the parameters of the system peripheral (video, root drive, keyboard, ... etc) and navigate to 0x90200.
  • Switch the system to protected mode, move the kernel from 0x10000 (64K) to 0x0000
  • Go to 0x0000 and execute head.s to load the kernel

My question is, why do we need to translate bootsect to 0x90000 first?

Why can't we just move the settings and system?

Thank.

+3


source to share


2 answers


I believe that moving the boot sector off the road was mainly a matter of convenience - there is no hard technical reason why it cannot be done otherwise.

However, there 0x7c00

is less than 32KiB since the beginning of the memory. 32KiB is often not enough for the kernel installation stage, let alone the kernel itself. 0x90000

sits well under the area that is reserved for the PC BIOS and also leaves enough room for the kernel.



In any case, the process you are talking about has not been used by the Linux kernel for several years. The addresses you provide are used by Linux Boot Protocol versions prior to v2.02, which was first used with linux-2.4.0. I think the kernel stopped being directly bootable as of linux-2.6.0 or so. The file of arch/i386/boot/bootsect.S

this version displays a message about this when someone tries to directly load the kernel.

Nowadays, the kernel is usually loaded with a separate bootloader, which can take any desired approach as long as it conforms to the boot protocol. The boot loader can have multiple stages and can even do kernel things like switch to protected mode .

0


source


It was (and still is) a good practice to "shadow" your bootloader and go to it. This practice started earlier, when the typical bootloader was limited to one segment on an x86 processor and one read sector from disk. After polling the hardware, the bootloader can do more advanced work, such as installing system files (calls, interceptors, TSRs, etc.), capturing viruses, or initializing protected mode and running hardware swap applications, etc.

The origin of the "behavior" predates Linux, you should find that this behavior was common with x86 boot loaders. Perhaps any IBM PC based computer.

Currently, the code on Linux was probably derived from this:



Fx. https://stuff.mit.edu/afs/sipb/user/warlord/C/memtest86/bootsect.s

In this case, the choice to move to 0x90000 would most likely be arbitrary, the goal was to move the bootloader from the default location to a location of its choice, where it would not be tampered with by programs that might stand out from "low mem" (essentially: as practical. )

I would like to see a specific reason myself :) pretty sure this is really just the remainder of the time the x86 platform was a DOS platform and as the hardware developed new tricks used to remain backward compatible with the "unfriendly" lowmem code.

+3


source







All Articles