Re: Contents of CR3 register when a kernel thread is executed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Mon, Apr 18, 2011 at 9:17 PM, limp <johnkyr83@xxxxxxxxxxx> wrote:
Hi all,

I am trying to understand in what extend the PGD (page global directory)
value stored in the CR3 register indicate the running process/thread by the
Linux scheduler.

 

I know that each process has its own PGD value but what I am confused about
is the value of CR3 register when kernel threads are scheduled.


yes, each process has its own CR3 value -> u can easily see this when u do a printk() of it....and it is always equal to the process (which is "insmod" usually) that started the kernel module.   i experimented it here:

http://www.issociate.de/board/post/492650/Does_cr3_register_change_when_a_new_process_is_scheduled_?.html
 
AFAIK, a "kernel thread" can 'borrow' the page-directory that belongs to
another process (i.e. its address space). Does this apply *only* to threads

yes, "borrow" in the sense that:   kernel thread DOES NOT have any process context, and so it can be executed in any process context, and which ever process context it is executing, when u print the CR3 value, it will belong to that process which the kernel thread is currently executing under.

read this:

http://www.scs.ch/~frey/linux/kernelthreads.html
 
of the same process (i.e. all the threads of process A are using the PGD
entry of process A) or could also apply to threads not relevant to process
A?

That is, if a thread is executed and the value of CR3 at the time is
0x1E107000, does this *necessary* mean that a thread of the process with PGD
0xDE107000 is executed *or* a thread not relevant with that process could
have 'borrowed' its PGD entry?

Any help will be greatly appreciated.

John K.



_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



--
Regards,
Peter Teoh
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux