summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include/cpu.h
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-08-20 05:30:35 +0000
committermarcel <marcel@FreeBSD.org>2003-08-20 05:30:35 +0000
commitdd5e41ad29251b7e8976041130e911e9635a6eef (patch)
tree5303d7781c4eedecb30ea3f0a5b44cf74d038073 /sys/ia64/include/cpu.h
parent5c48e77ef1ed368563b4e99da5d586f585859903 (diff)
downloadFreeBSD-src-dd5e41ad29251b7e8976041130e911e9635a6eef.zip
FreeBSD-src-dd5e41ad29251b7e8976041130e911e9635a6eef.tar.gz
Undo the mistake made in revision 1.77 of trap.c and which was the
ultimate trigger for the follow-up fixes in revisions 1.78, 1.80, 1.81 and 1.82 of trap.c. I was simply too pre-occupied with the gateway page and how it blurs kernel space with user space and vice versa that I couldn't see that it was all a load of bollocks. It's not the IP address that matters, it's the privilege level that counts. We never run in user space with lifted permissions and we sure can not run in kernel space without it. Sure, the gateway page is the exception, but not if you look at the privilege level. It's user space if you run with user permissions and kernel space otherwise. So, we're back to looking at the privilege level like it should be. There's no other way. Pointy hat: marcel
Diffstat (limited to 'sys/ia64/include/cpu.h')
-rw-r--r--sys/ia64/include/cpu.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h
index 7269e92..3ae9bd1 100644
--- a/sys/ia64/include/cpu.h
+++ b/sys/ia64/include/cpu.h
@@ -56,20 +56,12 @@ struct clockframe {
struct trapframe cf_tf;
};
#define CLKF_PC(cf) ((cf)->cf_tf.tf_special.iip)
-#define CLKF_USERMODE(cf) ((CLKF_PC(cf) >> 61) < 5)
-
-/* Used by signaling code. */
-#define cpu_getstack(td) ((td)->td_frame->tf_special.sp)
+#define CLKF_CPL(cf) ((cf)->cf_tf.tf_special.psr & IA64_PSR_CPL)
+#define CLKF_USERMODE(cf) (CLKF_CPL(cf) == IA64_PSR_CPL_USER)
#define TRAPF_PC(tf) ((tf)->tf_special.iip)
#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)
+#define TRAPF_USERMODE(tf) (TRAPF_CPL(tf) == IA64_PSR_CPL_USER)
/*
* CTL_MACHDEP definitions.
@@ -96,6 +88,9 @@ struct clockframe {
*/
#define get_cyclecount ia64_get_itc
+/* Used by signaling code. */
+#define cpu_getstack(td) ((td)->td_frame->tf_special.sp)
+
void cpu_halt(void);
void cpu_reset(void);
void fork_trampoline(void); /* MAGIC */
OpenPOWER on IntegriCloud