Why did linux BootSector move itself to 0x90000

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
stoned
Posts: 7
Joined: Mon Mar 16, 2009 7:09 am

Why did linux BootSector move itself to 0x90000

Post 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 ?
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

Re: Why did linux BootSector move itself to 0x90000

Post 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 ..)
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Why did linux BootSector move itself to 0x90000

Post 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
stoned
Posts: 7
Joined: Mon Mar 16, 2009 7:09 am

Re: Why did linux BootSector move itself to 0x90000

Post 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)
Post Reply