Hi,
great forum here.
I've been looking at various kernel examples and bootsectors/stage2's and have started looking at building my kernel. I have some questions.
How do I load a large kernel from the bootloader, presumable I don't have much ram available starting in realmode.
What areas of memory are used for what e.g. bios etc. when the bootsector loads.
Whats the max amount of memory i can use for loading in real mode.
Would I then have to
while ( remaining )
{
RealMode();
loaddata ([out] realmode buffer,[in,out]size);
ProtectedMode();
copydata([in] realmodebuffer, [out] pmodebuffer, [in,out]size)
remaining -= size;
}
I'm not intending on have a massive kernel. But 640kb or 1mb could be quite restrictive. I wouldn't like to end up stuck later down the line.
thanks in advance
oxide54
EDIT : Use unreal mode.!!!!!!!!!!!!!!!!!!!
Loading Large Kernel's
Re: Loading Large Kernel's
Yes some use unrealmode, but i would use (if my kernel32 got to big) going to and from pmode or you could code pmode drivers, which i can also use.
But i have been working on my OS for many many years it got many built in function (fdd,hdd,ATAPI,usb, fat12/16/32, CLI, etc) and still only 60k.
But i have been working on my OS for many many years it got many built in function (fdd,hdd,ATAPI,usb, fat12/16/32, CLI, etc) and still only 60k.
Re: Loading Large Kernel's
You could use GRUB which loads the kernel at 1mb (or anywhere you tell it practically). That way you would have practically the rest of the address space to use and a proven boot loader. Problems in your boot loader are incredible hard to track down.
Re: Loading Large Kernel's
0-3FFh - IVToxide54 wrote:What areas of memory are used for what e.g. bios etc. when the bootsector loads.
Whats the max amount of memory i can use for loading in real mode.
400h-4FFh - BDA
500h-AMT - available for using. You can get AMT value in kilobytes by calling int 12h.
AMT-0A0000h - EBDA
I don't think so. If your kernel is modular, then it's more than enough.oxide54 wrote:But 640kb or 1mb could be quite restrictive.
If you have seen bad English in my words, tell me what's wrong, please.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Loading Large Kernel's
A couple of quick notes:egos wrote:0-3FFh - IVToxide54 wrote:What areas of memory are used for what e.g. bios etc. when the bootsector loads.
Whats the max amount of memory i can use for loading in real mode.
400h-4FFh - BDA
500h-AMT - available for using. You can get AMT value in kilobytes by calling int 12h.
AMT-0A0000h - EBDA
I don't think so. If your kernel is modular, then it's more than enough.oxide54 wrote:But 640kb or 1mb could be quite restrictive.
- The IVT may not be located at 00H. Think about it for a bit; that is the default position when you first boot. However, people are known to also use chain loading. What if the 1st boot loader moves the IVT (for some unknown reason) to some other place and you rewrite it? It would probably be safest to turn off interrupts until you set your own IVT or until you get to pmode/64-bit mode altogether.
- There might be some empty space between the EBDA and A0000H.
- What's your point with the modular kernel? Modules have to be loaded too. And it's somewhat uncomfortable having to load the VFS, FS driver(s), ATA (or the like) driver and let them do the rest of the job from pmode. I'd go for a more uniform solution.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Loading Large Kernel's
The good soft for boot management wouldn't to do so. When RM kernel code is starting, it supposes that IVT would have the default position setting by BIOS.Love4Boobies wrote:
- The IVT may not be located at 00H. Think about it for a bit; that is the default position when you first boot. However, people are known to also use chain loading. What if the 1st boot loader moves the IVT (for some unknown reason) to some other place and you rewrite it? It would probably be safest to turn off interrupts until you set your own IVT or until you get to pmode/64-bit mode altogether.
You are right. But I didn't see like this however.Love4Boobies wrote:
- There might be some empty space between the EBDA and A0000H.
I load general kernel module and boot device and file system driver when being in RM, but load all other drivers later.Love4Boobies wrote:
- What's your point with the modular kernel? Modules have to be loaded too. And it's somewhat uncomfortable having to load the VFS, FS driver(s), ATA (or the like) driver and let them do the rest of the job from pmode. I'd go for a more uniform solution.
If you have seen bad English in my words, tell me what's wrong, please.
Re: Loading Large Kernel's
Thanks for all the responses they have been really helpfull.