paging functionality

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
blound
Member
Member
Posts: 70
Joined: Sat Dec 01, 2007 1:36 pm

paging functionality

Post by blound »

I was working on my paging code and since this is my first OS i want to make sure I get enough functionality in so I do not have to keep coming back in later to add things.

I already have the physical memory manager working and it has methods for allocating contiguous pages or just a single page ( and freeing them ) so i believe that is done..

here is the main functions that are things outside the core paging might use (meaning i am not listing every helper function/macro)

Code: Select all

void allocatePageTable(uint pdir, uint virt, uint flags)

void MapPhysicalAddress(uint pdir, uint vaddr, uint paddr, uint flags)

void invlpg(uint addr)

/* allocates an address space for a new task   
    starting with 'pages' amount of pages
*/
void allocAddressSpace(int pages)
When it comes time to handle multitasking/ring 3 tasks will I need anything more flexible?

also I had a question about allocAddressSpace because I am not quite sure of the flow for it. I know that it will have to allocate at least one page to be the page directory for the new task, then to use the last entry trick map itself into the last slot, but what about for the rest of the entries? If I am going to have the kernels pages mapped into every task is this the place to do it? I thought it might be a good place to set the the permissions for the kernel regions ( I have my kernel mapped to 0xc0000000 and will let it expand to higher addresses) but I do not know if that is the best function to put it in.

and for clean design should MapPhysicalAddress be the only thing to ever call allocatePageTable? I could not think of any other function that would need a page table brought in, and once kmalloc is implemented all the other parts of the kernel that need memory should rely on that anyway

I realize there was alot of questions in here but I wanted to have everything clear before I finish the code and move on to multitasking.
blound
Member
Member
Posts: 70
Joined: Sat Dec 01, 2007 1:36 pm

Post by blound »

I guess this is not an official "bump" since its only been a short time since I posted but I says alot of people have read the post

is it too long/filled with too many questions? Anything I can do to entice some discussion?
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

A lot of time posts don't get answered for a while.

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Hi, Sorry I was drunk on rum when your question went up!

You will need a "cloneAddressSpace" function for when implementing "fork()" et al.
If I am going to have the kernels pages mapped into every task is this the place to do it? I thought it might be a good place to set the the permissions for the kernel regions ( I have my kernel mapped to 0xc0000000 and will let it expand to higher addresses) but I do not know if that is the best function to put it in.
Putting that functionality in the function that creates an address space seems like a good idea to me.
and for clean design should MapPhysicalAddress be the only thing to ever call allocatePageTable?
Yes.
Post Reply