Re: Checking DPL of a Task State Segment

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

 



Hi Thomas,

* Thomas Setzer <tsetzer@tik.ee.ethz.ch> [2003-01-15 20:31]:
> 
> Has someone a clue how to check the DPL of the TSS
> of the task that is currently running?
> 
As far as I remember, the TSS is saved in a "normal" GDT-etnry.
Following this, it would be very easy to retrieve the appropriate
entry from the GDT.

> The reason why I am writing is the following one: 
> On every interrupt I have to check if current task
> is a kernel thread or a user process. Normally I could
> use '(current->mm==NULL)' to identify kernel threads 
> - because kernel threads don't have own memory descriptors -
> but in my case I can't. Checking the DPL would be one way
> to find out what I need to know, but how can I do that?
> Are there functions or macros already existing ...and ready
> to use?
> 

Think of the situation, where you are always in kernel space.  
Arriving at the Interrupt handler, you could fiddle around on the
stack and retrieve, for example, the CS of the interrupted process.
Comparing this one to __KERNEL_CS__ could help, couldn't it?


However, why wouldn't it be possible to keep a counter? ,-)

HTH.
Lukas
-- 
Lukas Ruf
http://www.lpr.ch
Wanna know anything about raw ip? 
Join rawip@rawip.org on http://www.rawip.org
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[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