summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include/cpu.h
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-05-24 21:16:19 +0000
committermarcel <marcel@FreeBSD.org>2003-05-24 21:16:19 +0000
commit7b4ed28b3c2cf450122063ab1b4e6dc7a01c1c9d (patch)
treee723f41b24ffe6ab71baa548c89c4b59f8f7fc65 /sys/ia64/include/cpu.h
parentedd5fa2492def21f0e01b3369c344e035a20b67e (diff)
downloadFreeBSD-src-7b4ed28b3c2cf450122063ab1b4e6dc7a01c1c9d.zip
FreeBSD-src-7b4ed28b3c2cf450122063ab1b4e6dc7a01c1c9d.tar.gz
Consistently us the same metric to differentiate between kernel mode
and user mode. We need to take into account that the EPC syscall path introduces a grey area in which one can argue either way, including a third: neither. We now use the region in which the IP address lies. Regions 5, 6 and 7 are kernel VA regions and if the IP lies any any of those regions we assume we're in kernel mode. Hence, we can be in kernel mode even if we're not on the kernel stack and/or have user privileges. There're gremlins living in the twilight zone :-) For the EPC syscall path this particularly means that the process leaves user mode the moment it calls into the gateway page. This makes the most sense because from a process' point of view the call represents a request to the kernel for some service and that service has been performed if the call returns. With the metric we picked, this also means that we're back in user mode IFF the call returns. Approved by: re@ (blanket)
Diffstat (limited to 'sys/ia64/include/cpu.h')
-rw-r--r--sys/ia64/include/cpu.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h
index cc3f5f9..93c142f 100644
--- a/sys/ia64/include/cpu.h
+++ b/sys/ia64/include/cpu.h
@@ -63,8 +63,7 @@ struct clockframe {
/* XXX */
#define TRAPF_PC(tf) ((tf)->tf_special.iip)
-#define TRAPF_USERMODE(framep) \
- (((framep)->tf_special.psr & IA64_PSR_CPL) == IA64_PSR_CPL_USER)
+#define TRAPF_USERMODE(tf) ((TRAPF_PC(tf) >> 61) < 5)
/*
* CTL_MACHDEP definitions.
OpenPOWER on IntegriCloud