OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 12:31 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: paging (split from Screen Shots)
PostPosted: Sun May 23, 2021 4:16 am 
Offline
Member
Member

Joined: Tue Mar 25, 2008 12:26 pm
Posts: 52
I finaly managed to enable paging, i have imported the VMM code of frost OS and adapted to my kernel. i understand well how it works now

like frost, it doe not use High Half kernel model:
* the kernel is identity maped to itself , also the console buffer, the vesa lfb are identity mapped
* the gui thread and the idle thread use the kernel's page directory
* each processes have they page directory
* the thread uses the page directory of the owner process
* when the scheduler switch to the thread, it activate the thread's page directory
* when i load a process from an executable (a flat binary): it create a new page directory for it, and activate it; so it can copy the binay data to the app address's space (0x40000000 or 1GiB)
* when a page directory is activated, it is automaticaly synced with the previous page directory (the bottom 255 entries corresponding to the first Gib is copied, so the kernel space is always sync accross all pages directories)

it work well when i load multiples processes before the timer is enabled:
* each process runs, and can receive events from the kernel

i have only a problem when the process ask the kernel to load an executable trought a syscall; the process is well created, and the task also. but when the scheduler switch to that newly created task, it returns a page fault, saying that a page is not present. (this bug does'nt occurs when the process is asking to create a thread in it's address space)

Note: when i alocate a physical page (in KMM.bas, method 'PageAlloc') , i map it to a free hole (bellow the 1 gig limit) int the current's context page directory and return the virtual address => normaly when i switch to another task this new mapping should be also synced

for now, the only workaround i have found, is to identity map the physical memory to itself (512 MB with qemu) , when i do that, all work well, there is no more pagefault. but this situation is not ideal (it will not work if there is more than 1gib in the machine)

the code is shared in my github at https://github.com/stephaneweg/little-os
maybe someone can look at it and see if he could find a problem with my logic (somewhere in Kernel/Src/Process.bas, kernel/Src/Thread.Bas, kernel/Src/KMM.bas , kernel/SRC/VMM.Bas , kernel/SRC/Scheduler.bas)


Top
 Profile  
 
 Post subject: Re: paging (split from Screen Shots)
PostPosted: Tue May 25, 2021 7:20 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
The thread you originally posted this in is for screenshots, I have split your post to its own thread.

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 102 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group