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!