How to judge a process is running in the kernel mode or user mode?

Submitted by vupiggy
on April 2, 2009 - 1:51pm

I am writing a kernel module, one requirement is that I need to judge a process currently (or before it's switched if it's not in RUNNING state) is running on kernel mode or user mode, please kindly tell me the not-so-hackish way (e.g, does Linux kernel provide some functions or macro to tell?). Thanks a lot!