summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include/cpu.h
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-06-06 23:27:18 +0000
committermarcel <marcel@FreeBSD.org>2003-06-06 23:27:18 +0000
commitef38b07248783ecef8a067426cd784c9582722f3 (patch)
treebd35810890d7d3bd4b1aba537d1ec352202466c9 /sys/ia64/include/cpu.h
parentb7efdb063aa3c8f256a111275d6f9333735f437e (diff)
downloadFreeBSD-src-ef38b07248783ecef8a067426cd784c9582722f3.zip
FreeBSD-src-ef38b07248783ecef8a067426cd784c9582722f3.tar.gz
Have TRAPF_USERMODE() take into account that the gateway page is not
always kernel space. It should be treated as user space when run with user privileges (which is the case for the signal trampolines). This fixes its only use in a KASSERT in subr_trap.c.
Diffstat (limited to 'sys/ia64/include/cpu.h')
-rw-r--r--sys/ia64/include/cpu.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h
index da13c01..114f217 100644
--- a/sys/ia64/include/cpu.h
+++ b/sys/ia64/include/cpu.h
@@ -61,9 +61,15 @@ struct clockframe {
/* Used by signaling code. */
#define cpu_getstack(td) ((td)->td_frame->tf_special.sp)
-/* XXX */
#define TRAPF_PC(tf) ((tf)->tf_special.iip)
-#define TRAPF_USERMODE(tf) ((TRAPF_PC(tf) >> 61) < 5)
+#define TRAPF_CPL(tf) ((tf)->tf_special.psr & IA64_PSR_CPL)
+/*
+ * User mode for use by ast() and VM faults. It's takes into account
+ * that the gateway page is kernel space when looking at the VA, but
+ * is to be treated as user space when running with user priveleges.
+ */
+#define TRAPF_USERMODE(tf) \
+ ((TRAPF_PC(tf) >> 61) < 5 || TRAPF_CPL(tf) == IA64_PSR_CPL_USER)
/*
* CTL_MACHDEP definitions.
OpenPOWER on IntegriCloud