OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 9:13 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Does kernel base address can't be changed
PostPosted: Mon Apr 03, 2017 11:06 am 
Offline

Joined: Mon Apr 03, 2017 10:59 am
Posts: 5
I'm doing some work on JOS. The kernel base address is 0xF0000000 in JOS. when the value is changed, some problems will happen. I'm wondering what determine the KERNBASE value.


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Mon Apr 03, 2017 11:13 am 
Offline

Joined: Mon Apr 03, 2017 10:59 am
Posts: 5
kyowill wrote:
I'm doing some work on JOS. The kernel base address is 0xF0000000 in JOS. when the value is changed, some problems will happen. I'm wondering what determine the KERNBASE value.

when translates a VA to a PA, you can get PA by using VA - KERNBASE


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Mon Apr 03, 2017 1:10 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
kyowill wrote:
I'm doing some work on JOS. The kernel base address is 0xF0000000 in JOS.


Which JOS? I recall at least three OSes by that name, and odds are the one you mean isn't any of those three. It even appears to be used as a generic name for the student OS projects in the MIT Open Courseware Operating System Engineering course. You may need to post a link to the specific one you mean. Here are a few I found just on a quick DDG search:

Java Operating System
JamesxX's JOS
LeJOS LEGO Minstorms OS
Jeremy's OS for Arduino
Jose's Operating System

I am pretty sure that there was a mainframe OS called JOS back in the day, as well.

kyowill wrote:
I'm wondering what determine the KERNBASE value.


The whim of the primary developers, really.

Now, there are often good reasons for choosing a specific kernel base - for example, for a Higher Half Kernel on a 32-bit platform, it is sometimes useful to put it at 0x10000000 - giving the kernel literally half of the address space - for a number of reasons (e.g., it ensures that the OS has plenty of room; it makes the user and kernel space sizes equal; it makes it easy to find it without a separate constant; it is easy to tell if a given address is in the kernel space or user space by checking the high bit - not that it comes up a lot, but still; etc.). However, different OSes have different purposes, and OS devs will have different priorities. What might seem like a good reason in one design for one group of developers may not make sense for something and someone else.

Unless it is explained in the documentation and/or code comments somewhere, you'd need to consult with whoever designed the kernel's memory layout to get the answer for a specific OS.

As for why it is causing problems, first off, how, when (e.g., at compile time, at link time, at run time, etc), and why are you trying to change it, and what actually happens when you do? If you could post any error messages or (if necessary) screenshots of the results, it might help a great deal.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Mon Apr 03, 2017 6:30 pm 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
Schol-R-LEA wrote:
0x10000000 - giving the kernel literally half of the address space


Sorry, couldn't help myself =)


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Mon Apr 03, 2017 8:01 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
OK, that was a dumbass attack on my part. That should have been 0x80000000.

Or am I still an idiot here? I mean binary 10000000000000000000000000000000 (2^31), which should indeed be 0x80000000. Dunno what made me think that would be 0x10000000, I just wasn't paying attention when I wrote it.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Tue Apr 04, 2017 7:37 am 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
Schol-R-LEA wrote:
Or am I still an idiot here?


No, I was referring to the 0x1 vs 0x8..


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Tue Apr 04, 2017 8:10 am 
Offline

Joined: Mon Apr 03, 2017 10:59 am
Posts: 5
Schol-R-LEA wrote:
OK, that was a dumbass attack on my part. That should have been 0x80000000.

Or am I still an idiot here? I mean binary 10000000000000000000000000000000 (2^31), which should indeed be 0x80000000. Dunno what made me think that would be 0x10000000, I just wasn't paying attention when I wrote it.


I still don‘t get the point why PA(physcial address) equal to VA(virtual address) - KERNBASE(0x80000000 or 0x10000000)


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Tue Apr 04, 2017 9:23 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 723
Location: Tallinn, Estonia
kyowill wrote:
I still don‘t get the point why PA(physcial address) equal to VA(virtual address) - KERNBASE(0x80000000 or 0x10000000)


It depends on how the kernel is loaded.

If it's loaded starting from 0x0 in physical RAM while having virtual start address at KERNBASE, then indeed, subtracting KERNBASE from any kernel address will yield it's physical address in memory.

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Tue Apr 04, 2017 5:07 pm 
Offline

Joined: Mon Apr 03, 2017 10:59 am
Posts: 5
dozniak wrote:
kyowill wrote:
I still don‘t get the point why PA(physcial address) equal to VA(virtual address) - KERNBASE(0x80000000 or 0x10000000)


It depends on how the kernel is loaded.

If it's loaded starting from 0x0 in physical RAM while having virtual start address at KERNBASE, then indeed, subtracting KERNBASE from any kernel address will yield it's physical address in memory.


if 0x0(physical address)is mapped to KERNBASE, but how do you know the mapping detail.


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Tue Apr 04, 2017 9:42 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
I know I asked this earlier, but can you please specify which OS named JOS you are referring to? A link to a repo and/or a site describing it, if possible, would also be appreciated.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Wed Apr 05, 2017 8:09 am 
Offline

Joined: Mon Apr 03, 2017 10:59 am
Posts: 5
Schol-R-LEA wrote:
I know I asked this earlier, but can you please specify which OS named JOS you are referring to? A link to a repo and/or a site describing it, if possible, would also be appreciated.


https://pdos.csail.mit.edu/6.828/2016/


Top
 Profile  
 
 Post subject: Re: Does kernel base address can't be changed
PostPosted: Wed Apr 05, 2017 11:33 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 723
Location: Tallinn, Estonia
kyowill wrote:
if 0x0(physical address)is mapped to KERNBASE, but how do you know the mapping detail.


You (JOS) made it yourself, so by definition you know it.

_________________
Learn to read.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 172 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group