Where to put stage 2?

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
randell23
Posts: 2
Joined: Fri Jul 21, 2017 9:08 am

Where to put stage 2?

Post by randell23 »

Hello. I've just finished developing the ISO9660 stage 1 bootloader. But i don't know where to put stage 2.
Stage 1 locates at 0x0000:0x7c00 - 0x0000:0x8400.
So, where is the optimal place to put the stage 2 bootloader?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Where to put stage 2?

Post by AJ »

Hi,

Short answer: wherever you like.

If it's a normal sized stage 2, why not place in in RAM immediately after stage 1? You have all that space up to the start of the BDA. If your stage 2 is more like a kernel, you will want somewhere above 1MiB.

The wiki article [wiki]Memory Map (x86)[/wiki] tells you of a few areas that are guaranteed free. You are also generally safe in the area from 1MiB - 14MiB if the RAM exists and you don't intend to place your kernel there. It's also worth generating a system memory map early on.

Cheers,
Adam
randell23
Posts: 2
Joined: Fri Jul 21, 2017 9:08 am

Re: Where to put stage 2?

Post by randell23 »

AJ wrote:Hi,

Short answer: wherever you like.

If it's a normal sized stage 2, why not place in in RAM immediately after stage 1? You have all that space up to the start of the BDA. If your stage 2 is more like a kernel, you will want somewhere above 1MiB.

The wiki article [wiki]Memory Map (x86)[/wiki] tells you of a few areas that are guaranteed free. You are also generally safe in the area from 1MiB - 14MiB if the RAM exists and you don't intend to place your kernel there. It's also worth generating a system memory map early on.

Cheers,
Adam
OK. Thanks for the answer.
Post Reply