Page 2 of 2

Posted: Tue Jun 26, 2007 1:45 pm
by Bughunter
Good decision, you're now busy with PMM so it's wise to (maybe temporarily) use GRUB for now. I'm doing the same as you, and later on switching to custom stage1/stage2 boot loaders :)

Posted: Wed Jun 27, 2007 12:04 pm
by JJeronimo
bughunter wrote:I think you're overloading him with stuff. First you start with a Physical Memory Manager.

(...)

The PMM itself has _nothing_ to do with page directories or page tables itself.

You just initialize your PMM and then you create a page directory to map the kernel and page stack pages into memory, then you enable paging.
Building the stack before enabling paging is a bit tricky because this makes allocating the pages for the stack more difficult.

I think the PMM must be closely tied with the paging code.
Also, I think that it's best to have allocpage() and freepage() in the architecture specific code for this same reason. If the address where you are going to write the page address on the stack doesn't exist, then the best thing to do is allocate that page to the stack instead of pushing it. And this operation is architecture specific (and different architectures have paging structures of different depth and workings).

Better thinking, there are other approaches to achieve the same result. For example, if we have an allocate_to_paging_structures() architecture-specific function, that would allocate the page to whatever level of page tables needs it...

The last time I wrote paging code I had no intention to make it portable...

JJ

Posted: Wed Jun 27, 2007 12:51 pm
by t0xic
I have already enabled paging, I just need a way to keep track of allocated pages.

--Michael

Posted: Wed Jun 27, 2007 3:46 pm
by Bughunter
JJeronimo wrote:
bughunter wrote:I think you're overloading him with stuff. First you start with a Physical Memory Manager.

(...)

The PMM itself has _nothing_ to do with page directories or page tables itself.

You just initialize your PMM and then you create a page directory to map the kernel and page stack pages into memory, then you enable paging.
Building the stack before enabling paging is a bit tricky because this makes allocating the pages for the stack more difficult.
That's totally your point of view. For me, it doesn't make finding a free page for the stack any harder at all. It just really depends on how efficient your code is and in what way you build your stack. I could easily port my code to make it build the stack without having paging enabled.

Besides, my PMM doesn't do _anything_ with page directories or page tables! In my bootstrap program I just map some pages (which is not part of the PMM code at all!) and then continue finding a free space for the stack to use and then building the stack.