Do I find address of kernel correctly?

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
User avatar
mrjbom
Member
Member
Posts: 322
Joined: Sun Jul 21, 2019 7:34 am

Do I find address of kernel correctly?

Post by mrjbom »

Hello.
I write MMU and in order not to damage the kernel when managing memory, I try to find the beginning and end of the kernel in memory.
And I would like to know if I'm doing everything right.
In my linker script, I declared startkernel and endkernel, did I place them correctly?
In the kmain() code, I output the values of these variables to serial.log(I output debugging information there), but I get huge addresses and it seems to me that I am wrong somewhere.
When running in qemu, it gives me 128 Mebibytes of RAM, while writing that the kernel is outside of RAM.
Thanks.
Octocontrabass
Member
Member
Posts: 6280
Joined: Mon Mar 25, 2013 7:01 pm

Re: Do I find address of kernel correctly?

Post by Octocontrabass »

mrjbom wrote:I output the values of these variables
Output the address of the variables instead.
User avatar
mrjbom
Member
Member
Posts: 322
Joined: Sun Jul 21, 2019 7:34 am

Re: Do I find address of kernel correctly?

Post by mrjbom »

Octocontrabass wrote:
mrjbom wrote:I output the values of these variables
Output the address of the variables instead.
Thanks you.

Can I ask you another question?
What is in this area of memory? What does it include? Variables of the kernel? Code?
nullplan
Member
Member
Posts: 2054
Joined: Wed Aug 30, 2017 8:24 am

Re: Do I find address of kernel correctly?

Post by nullplan »

This area, as defined in your code, should encompass... actually, I don't know. You set startkernel before you set the address of the location counter. In any case, once you've made sure it encompasses the entire image, then all your code and static/global variables will be in there, but not your dynamically allocated objects (obviously).
Carpe diem!
User avatar
mrjbom
Member
Member
Posts: 322
Joined: Sun Jul 21, 2019 7:34 am

Re: Do I find address of kernel correctly?

Post by mrjbom »

nullplan wrote:This area, as defined in your code, should encompass... actually, I don't know. You set startkernel before you set the address of the location counter. In any case, once you've made sure it encompasses the entire image, then all your code and static/global variables will be in there, but not your dynamically allocated objects (obviously).
Am I installing startkernel in the wrong place? Where should it be? After . = 0x00100000;
Post Reply