OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 17, 2024 7:26 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How does windows kernel know the process requesting a syscal
PostPosted: Sun Apr 17, 2016 3:56 pm 
Offline

Joined: Sun Apr 17, 2016 3:47 pm
Posts: 2
Hi,
When doing a sycall on windows from user mode to kernel mode (say calling openfile).
How does the kernel know what EPROCESS he should updated with the handle of the
file that was opened, since whats passed in the syscall doesnt contain any process identifier.

I think what probably happened is that since the CR3 register will stay the same through the call
then some code in the kernel eventually looks into the PEB of the address space pointed to by CR3
and then he knows the process ID and thus can iidentiify the EPROCESS and add to the handle list.

Is this how it works ?
Regadrs
Chrstian


Top
 Profile  
 
 Post subject: Re: How does windows kernel know the process requesting a sy
PostPosted: Sun Apr 17, 2016 4:07 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
I believe, it's simply the current one for that CPU. When the scheduler picks another process/thread to run on a CPU, it updates the pointers to the current process/thread structures.


Top
 Profile  
 
 Post subject: Re: How does windows kernel know the process requesting a sy
PostPosted: Mon Apr 18, 2016 12:35 am 
Offline

Joined: Sun Apr 17, 2016 3:47 pm
Posts: 2
Hi,

>> I believe, it's simply the current one for that CPU.
Oh ok, so the current thread/process executing is still being referenced by the kernel so anything that thread does
i.e open a file etc , he knows what EPROCESS to update based on the current context.
Thanks


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 137 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