From eaa7bda4a5e0484cd2dec6e8e700013122d0cfcf Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Fri, 6 Jun 2003 23:27:18 +0000 Subject: [PATCH] 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. --- sys/ia64/include/cpu.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h index da13c01f2a1d..114f2176d09d 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.