Paging, Again :(

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
User avatar
finarfin
Member
Member
Posts: 106
Joined: Fri Feb 23, 2007 1:41 am
Location: Italy & Ireland
Contact:

Paging, Again :(

Post by finarfin »

I'm asking again help about paging.

At this time, my OS, boot and load correctly a page Dir and page table, so i'm in paged mode.
I'm blocked here, because i don't know how to proceed.

Now what things i have to program next?

It's strange, globally i know what i have to program, a memory allocator, several utility functions for page managing, function for copy kernle into a new pageDir/pageTable but i'm still confused.

In other words, after creation of the first pageDir, pageTable, function that enables it, what are the next things to do.
(i have already enabled paging)

I have to start thinking at a malloc function? Or it is too early.
I have to write first page fault function? Or i need first to create an allocator?

Exactly how a malloc function work? It require an address to paging memory manager, and obtain it, after when i try to access that location a page_fault occur, and i have to map that address (requiring a page to physical memory manager)?
It is correct?

I read several tutorials (also JamesM tutorial), but i'm still confused.
In jamesM tutorial for example, he use a variable placement_address, but what is it start address? The variable end (declared in ld script file) which start value is supposed to have?

I hope yuo may help me.

P.S Once again, sorry for my english (i restart to study it :D )
Elen síla lúmenn' omentielvo
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Paging, Again :(

Post by Omega »

End should be the offset where your loader stopped and your kernel starts. Check out James' tutorial again and read on to the Heap and VFS, I think he does more with paging in those. Your next step would be to create the Heap as denoted by James' guide. Good Luck.
Free energy is indeed evil for it absorbs the light.
User avatar
Adek336
Member
Member
Posts: 129
Joined: Thu May 12, 2005 11:00 pm
Location: Kabaty, Warszawa
Contact:

Re: Paging, Again :(

Post by Adek336 »

You might want to try write an interface, first, that is writing down the signatures of the functions you'd use, like for example

Code: Select all

you need heap
void *kmalloc(size_t s);
void kfree(void *ptr);

you'd like to manage your paging structures, to have heap;
addr_t alloc_page(); //to get a physical address of a free page; you may want to have some sort of collection of free physical pages
void disalloc_page(addr_t page);   //to return a physical page back to the pool

uint32 pte_val(addr_t logi); //a function to return the PTE entry corresponding to the logical address [logi]
void pte_map(addr_t logi, uint32 pte); // a function to set the PTE entry of a logical address; do you want this function to flush TLB? or maybe another function should flush so that you may use pte_map() in a for-loop for bulk amounts of changes

....   //more functions you thing of during design :)
this is an example interface you might want to do it another way; you're free and encouraged to experiment in your project :mrgreen:
User avatar
finarfin
Member
Member
Posts: 106
Joined: Fri Feb 23, 2007 1:41 am
Location: Italy & Ireland
Contact:

Re: Paging, Again :(

Post by finarfin »

Ok now other questions came, i'm reading JamesM tutorials, but there is a thing that is not clear,
the variable placement_address is the same for every page_dir, or not?

In my interpretation, every page dir, must have his own placement_address (if we have a multitasking environment, and every task with is own address space).

Is that corret? If not, why?

Please help me, i'm very confused :shock:
Elen síla lúmenn' omentielvo
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
Post Reply