Loading meh kernel above 0x10000

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.
User avatar
ChazZeromus
Member
Member
Posts: 61
Joined: Sun Jun 22, 2008 4:09 pm

Loading meh kernel above 0x10000

Post 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 :P
Image
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Loading meh kernel above 0x10000

Post 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...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
ChazZeromus
Member
Member
Posts: 61
Joined: Sun Jun 22, 2008 4:09 pm

Re: Loading meh kernel above 0x10000

Post by ChazZeromus »

What? You're joking right?
Image
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Loading meh kernel above 0x10000

Post by Combuster »

Joking about what? Unreal Mode?

/me sees no jokes.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Re: Loading meh kernel above 0x10000

Post 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...
"Sufficiently advanced stupidity is indistinguishable from malice."
albeva
Member
Member
Posts: 42
Joined: Thu Aug 21, 2008 8:31 pm

Re: Loading meh kernel above 0x10000

Post 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?
User avatar
cr2
Member
Member
Posts: 162
Joined: Fri Jun 27, 2008 8:05 pm
Location: ND, USA

Re: Loading meh kernel above 0x10000

Post 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...)
OS-LUX V0.0
Working on...
Memory management: the Pool
User avatar
ChazZeromus
Member
Member
Posts: 61
Joined: Sun Jun 22, 2008 4:09 pm

Re: Loading meh kernel above 0x10000

Post 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
Image
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Loading meh kernel above 0x10000

Post by Combuster »

I used the de-facto term for it since you can google on that :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Loading meh kernel above 0x10000

Post 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.
User avatar
ChazZeromus
Member
Member
Posts: 61
Joined: Sun Jun 22, 2008 4:09 pm

Re: Loading meh kernel above 0x10000

Post 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.
Image
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Re: Loading meh kernel above 0x10000

Post 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).
User avatar
ChazZeromus
Member
Member
Posts: 61
Joined: Sun Jun 22, 2008 4:09 pm

Re: Loading meh kernel above 0x10000

Post 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.
Image
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Loading meh kernel above 0x10000

Post 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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
ChazZeromus
Member
Member
Posts: 61
Joined: Sun Jun 22, 2008 4:09 pm

Re: Loading meh kernel above 0x10000

Post 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.
Image
Post Reply