Page 1 of 4
Loading meh kernel above 0x10000
Posted: Mon Sep 08, 2008 9:55 pm
by ChazZeromus
Right now, I found a way to load my kernel above 0x10000 without using grub, even though grub supports booting up from various mediums, I like doing everything my own way. So I'm just wondering, what if I loaded my kernel above the address 0x10000 by constantly switching back and forth between real address mode and protected mode. And I wonder if switching back to real mode would not harm the bios routines. I just want to know if this would work. I'm going to try it anyways
Re: Loading meh kernel above 0x10000
Posted: Tue Sep 09, 2008 3:51 am
by Combuster
As long as you don't change anything the bios needs (e.g. IDT, (E)BDA), then you can go in and out of protected mode without causing serious problems.
You may want to consider Unreal Mode though...
Re: Loading meh kernel above 0x10000
Posted: Tue Sep 09, 2008 1:22 pm
by ChazZeromus
What? You're joking right?
Re: Loading meh kernel above 0x10000
Posted: Tue Sep 09, 2008 2:19 pm
by Combuster
Joking about what?
Unreal Mode?
/me sees no jokes.
Re: Loading meh kernel above 0x10000
Posted: Tue Sep 09, 2008 5:24 pm
by Zenith
Just something off topic that I've noticed:
Why does everybody who asks these kind of addressing questions (I'm not singling out the OP) make the mistake of saying 0x10000 (64 kB) when they almost always mean 0x100000 (1 MB)? It's just a random thing that bugs me...
Re: Loading meh kernel above 0x10000
Posted: Tue Sep 09, 2008 5:42 pm
by albeva
because they like to be cool but forget a leading 0?
or maybe he did mean to load his kernel at 64kb point?
Re: Loading meh kernel above 0x10000
Posted: Tue Sep 09, 2008 9:12 pm
by cr2
<problem>
If I am not correct, when you switch back to real mode you don't get back the BIOS interrupts. (If you want them back, you will find them at 0x0-0x3FF).
</problem>
P.S. Do NOT try getting back the BIOS interrupts in pmode. It wont work (I was actually dumb enough to try this...)
Re: Loading meh kernel above 0x10000
Posted: Tue Sep 09, 2008 9:28 pm
by ChazZeromus
Combuster wrote:Joking about what?
Unreal Mode?
/me sees no jokes.
Oh why didnt you just say 16-bit mode with > 64KB access. I knew that can be achieved but I never knew it had a name.
mod edit: wiki discussion moved
Re: Loading meh kernel above 0x10000
Posted: Wed Sep 10, 2008 2:20 am
by Combuster
I used the de-facto term for it since you can google on that
Re: Loading meh kernel above 0x10000
Posted: Wed Sep 10, 2008 3:41 am
by bewing
In fact, you do seem very insistent that you really do mean that you think you have a 64K addressing limitation. There is no such limitation, which suggests that you do not understand the function of the segment registers when you are in Real mode. The segment registers contain one extra nibble of an address, when the CPU is in Real mode. (To be more precise, an "address" in Real mode is made from a segment register shifted up 4 bits, plus a specified 16 bit offset register.
This allows you to address 1MB, while you are in Real mode. However, you should only count on the first half of that memory to actually exist.
Re: Loading meh kernel above 0x10000
Posted: Wed Sep 10, 2008 4:54 am
by ChazZeromus
You know, I'm not stupid. I know that, but when I use bios routines to read my kernel into memory, I can only specify a location that I can write to by segment, so the highest I can go is 0xFFFF0. I just wanted move data above that address.
Re: Loading meh kernel above 0x10000
Posted: Wed Sep 10, 2008 11:56 pm
by Ready4Dis
cr2 wrote:<problem>
If I am not correct, when you switch back to real mode you don't get back the BIOS interrupts. (If you want them back, you will find them at 0x0-0x3FF).
</problem>
P.S. Do NOT try getting back the BIOS interrupts in pmode. It wont work (I was actually dumb enough to try this...)
When you switch from p-mode to real-mode, you retain all your bios interrupts as long as you have not over-written your IVT and you remember to set your IDT back to the correct information. I also recommend unreal mode however, to keep from switching back and forth, although I did do my kernel both ways at one point and there wasn't a very big difference in booting time (disk i/o is my major slow down).
Re: Loading meh kernel above 0x10000
Posted: Thu Sep 11, 2008 4:53 am
by ChazZeromus
Ready4Dis wrote:cr2 wrote:<problem>
If I am not correct, when you switch back to real mode you don't get back the BIOS interrupts. (If you want them back, you will find them at 0x0-0x3FF).
</problem>
P.S. Do NOT try getting back the BIOS interrupts in pmode. It wont work (I was actually dumb enough to try this...)
When you switch from p-mode to real-mode, you retain all your bios interrupts as long as you have not over-written your IVT and you remember to set your IDT back to the correct information. I also recommend unreal mode however, to keep from switching back and forth, although I did do my kernel both ways at one point and there wasn't a very big difference in booting time (disk i/o is my major slow down).
Yeah, I already knew that. You also can't overwrite the Extended Bios Area or you'll lose your interrupt procedures.
Re: Loading meh kernel above 0x10000
Posted: Thu Sep 11, 2008 5:07 am
by Love4Boobies
Yeah, I already knew that. You also can't overwrite the Extended Bios Area or you'll lose your interrupt procedures.
The interrupt handlers aren't in the EBDA. In fact, some (especially older) BIOSes don't even have an EBDA, only a BDA that holds some information about the state of the machine (for instance the state of the num lock key or what's on a COM/LPT port). The IVT tells you more about where the interrupt handlers are.
Re: Loading meh kernel above 0x10000
Posted: Thu Sep 11, 2008 1:15 pm
by ChazZeromus
Okay fine, is isn't extended. Okay, well maybe I'm wrong it's not like you weren't ever. Okay, if the IVT's point to where the handlers are, then where exactly are they? Go write a program or something. EDBA can also describe the interrupts too. Geez, I'm know alot but theres alot i don't know, and I'm not like 23 years old or anything.
By the way, happy terrorist day.