Change of Base address.

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
stonedzealot

Change of Base address.

Post by stonedzealot »

I'm finally getting around to getting the kernel restricted to >=2GB in address space. I read Tim Robinson's Memory Management 1 tutorial at osdever a long time ago and remembered him mentioning it. He says that the base address should be changed to 0x41000000 because 0xC0000000 + 0x41000000 = 0x1000000 which is 1MB (*somehow*) I thought that it should be 0x40100000 so you'd get 0x100000 out (5 zeros vs. 6) which would be 1MB.

Regardless, whatever the magic number is, what do I have to change with it? This is the way I understand it (but it doesn't work):

Kernel is linked for 0xC0000000

Bootloader loads the kernel to 0x100000

Bootloader lgdts GDT with CODESEL and DATASEL bases set to the magic number (whichever it is).

Bootloader jumps to CODESEL:0xC0000000

and operation continues as usual...

So what's wrong with this picture, since it's not really working...?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Change of Base address.

Post by Candy »

wangpeng wrote: I'm finally getting around to getting the kernel restricted to >=2GB in address space. I read Tim Robinson's Memory Management 1 tutorial at osdever a long time ago and remembered him mentioning it. He says that the base address should be changed to 0x41000000 because 0xC0000000 + 0x41000000 = 0x1000000 which is 1MB (*somehow*) I thought that it should be 0x40100000 so you'd get 0x100000 out (5 zeros vs. 6) which would be 1MB.
That's an error Tim admitted at least a year ago, search the forum some more. The address should have been 0x40100000.
stonedzealot

Re:Change of Base address.

Post by stonedzealot »

I'm not trying to indict him or anything for chrissake, I was just asking what I wasn't doing. As far as I knew he was right (it's not like he's led me wrong before) and the extra zero was supposed to be there. The search term "0x40100000" turned up the discussion I was looking for however, so nevermind.

Besides, who would assume there's an error in a tutorial... shouldn't it be changed after someone makes a realization? Especially something on osdever that probably gets read a lot... no point in spreading false information...
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Change of Base address.

Post by Pype.Clicker »

wangpeng wrote: Besides, who would assume there's an error in a tutorial... shouldn't it be changed after someone makes a realization? Especially something on osdever that probably gets read a lot... no point in spreading false information...
That's why the FAQ is a wiki, here ... If you manage to find people being able to patch the fault, please, feel free to have them chaning it ;)
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Change of Base address.

Post by Candy »

wangpeng wrote: Besides, who would assume there's an error in a tutorial... shouldn't it be changed after someone makes a realization? Especially something on osdever that probably gets read a lot... no point in spreading false information...
Everybody who thinks Tim is a human would think he can make errors too, and try out the alternative. NOFI btw.
thomasantony

Re:Change of Base address.

Post by thomasantony »

Hi,
Dont you think you should put something like an [org 0xc000000] in the kernel file?

Thomas Antony
AR

Re:Change of Base address.

Post by AR »

Dont you think you should put something like an [org 0xc000000] in the kernel file?
I don't see the point of that, the linker will change the origin anyway.
Post Reply