Page 1 of 1

Do I find address of kernel correctly?

Posted: Sat Feb 22, 2020 3:30 am
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.

Re: Do I find address of kernel correctly?

Posted: Sat Feb 22, 2020 4:02 am
by Octocontrabass
mrjbom wrote:I output the values of these variables
Output the address of the variables instead.

Re: Do I find address of kernel correctly?

Posted: Sat Feb 22, 2020 6:09 am
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?

Re: Do I find address of kernel correctly?

Posted: Sat Feb 22, 2020 6:13 am
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).

Re: Do I find address of kernel correctly?

Posted: Sun Feb 23, 2020 12:53 am
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;