Page 1 of 1
Why did linux BootSector move itself to 0x90000
Posted: Mon Mar 16, 2009 7:14 am
by stoned
According to an old linux boot sector, once the sector loaded at 0x7C00, moves itself
-out of the way- to loacation 0x90000 and continues execution over there.
I'm sure there must be a good reason for that, but I still can't figure it out.
Any help ?
Re: Why did linux BootSector move itself to 0x90000
Posted: Mon Mar 16, 2009 7:24 am
by johnsa
So that it can load a stage2 loader to 7c00 perhaps (I personally think its all personal choice.. load the stage 2 somewhere else.. or load the stage 1 and move it ..)
Re: Why did linux BootSector move itself to 0x90000
Posted: Mon Mar 16, 2009 7:33 am
by AJ
Hi,
You would need this for chainloading. If your bootsector (at 0x7C00) loads another boot sector, the second boot sector needs to be at 0x7C00. Therefore, the first sector needs to move itself out of the way.
Cheers,
Adam
Re: Why did linux BootSector move itself to 0x90000
Posted: Mon Mar 16, 2009 10:47 am
by stoned
But I think the linux boot sector does not chainload. All it does it copies itself to 0x90000 and jump over there, thenafter getting some data from BIOS (like boot_drive) it loads another peice of code (called setup) from a boot drive to the same segment 0x9000. Which after some twidding will in its turn load (decompress) the kernel at 0x10000.
In my point of view, I think the main reason behind this process, is to make sure that data exchange between the boot sector (which is actually forced to fit into only 512b) and setup code won't trespass the 64k boundaries, hence stay close to same segment to avoid long jumps.
We could have stayed close to the original boot seg 0x7C0, but since setup code can be very large, it has been preferred to switch to a new full segment.
(Current linux revisions doesnt support this legacy and won't boot directly anymore)