Identifying whether a user-process or kernel-thread execution takes place by looking at CPU registers

limp johnkyr83 at hotmail.com
Thu May 12 06:55:09 EDT 2011


Hi all,

 

About a month ago I've made a question in the ML regarding the contents of
the CR3 register and how the value of this register change when different
processes/threads are executed.

 

One of the conclusions of the conversation we had was that when kernel
threads are executed, the CR3 register keeps the value of the process under
which the kernel thread is executed (which is the previously executed
process). That is, the kernel thread "borrows" the page-table of the
previously executed process for executing.

 

The problem is that by looking *only* at the CR3 register, we can't really
tell if the user process in which the CR3 value corresponds to (each process
is assigned a unique PGD value which results to a unique CR3 value) *or* a
kernel-thread that uses its tables is executing.

 

I was wondering if any other CPU register (apart from CR3) can indicate if a
user-process or a kernel thread under it (and which one) is executed. Is it
possible to know such a thing *only* by looking at CPU registers?

 

I'll be happy to clarify any of the above.

 

Thank you all in advance.

 

John K.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110512/3b394a06/attachment.html 


More information about the Kernelnewbies mailing list