Using a bitmap for paging

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.
User avatar
Bughunter
Member
Member
Posts: 94
Joined: Mon Dec 18, 2006 5:49 am
Location: Netherlands
Contact:

Post 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 :)
JJeronimo
Member
Member
Posts: 202
Joined: Wed Oct 18, 2006 3:29 pm

Post 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
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

I have already enabled paging, I just need a way to keep track of allocated pages.

--Michael
User avatar
Bughunter
Member
Member
Posts: 94
Joined: Mon Dec 18, 2006 5:49 am
Location: Netherlands
Contact:

Post 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.
Post Reply