Page 1 of 1

It's all about Memory

Posted: Tue Nov 21, 2017 7:00 pm
by abosohyle
Hello there, this is my first post and I'm so glad to be here. Reading a story is interesting thing, living one is quite another. My post is about some questions that I can not solve since been involved in OS development and I hope that someone could guide me through the road. Although I have successfully built my tool chain as instructed and managed to boot, gdt, irq, timer, keyboard... But I stuck in memory and how to manage it. Simply could not answer these questions:-

1) how big is my kernel.
2) how to know where is my kernel in physical memory (start - end).
3) how to use grub memory map and not just to know it.
4) how to design a flat memory model.
Furthermore...
5) how to start paging.
6) how to create a memory management system using virtual memory.

I know Memory is a complex concept though four months have passed reading all kind of information I could reach but with no progress, my goal is not just a theory I have read enough but could not understand. I need a practical piece of code to start with.

I hope this is enough to express the problem and forgive my English - still in progress. Thanks in advance.

Re: It's all about Memory

Posted: Wed Nov 22, 2017 11:37 am
by Octocontrabass
1) Subtract the address of the start of your kernel from the address of the end of your kernel.
2) You can define global symbols in your linker script that point to the start and end of your kernel.
3) Write a function that translates the information from the memory map into something your physical memory manager can use.
4) Set all of the segment base addresses to 0.
5) Build your page tables and then enable paging.
6) This page is a good start. Some of the links on that page will also be useful.

Re: It's all about Memory

Posted: Wed Nov 22, 2017 2:08 pm
by DavidAylaian
We also have a page on paging: http://wiki.osdev.org/Paging

Re: It's all about Memory

Posted: Thu Nov 23, 2017 11:31 am
by abosohyle
Thanks a lot.