|
|
|
Re: user_mode(regs) macro in kernel | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Wed, Jun 20, 2012 at 6:45 PM, sumeet linux <sumeet4linux@xxxxxxxxx> wrote: > Hi All, > > What is the meaning of user_mode(regs) macro ? What does it do ? I assume you were referring to: http://lxr.linux.no/#linux+v3.4.3/arch/x86/include/asm/ptrace.h#L164 right? let me paste the code here: return !!(regs->cs & 3) As you can see there, it retrieve the CS register and AND it with 3 (11 in binary). We know that 3 in CS (Code segment) means CPU is currently operating in ring level 3 a.k.a user mode. Whereas if it is 0, then it is in kernel mode. Hope it makes it clear for you :) -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
[Newbies FAQ] [Linux Kernel Development] [IETF Annouce] [Git] [Networking] [Security] [Bugtraq] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux Networking] [Linux RAID] [Linux SCSI] [Linux ACPI]
![]() |
![]() |