fix KERNELMODE() macro (check MD bits, too)

This commit is contained in:
msaitoh 2001-06-24 05:34:07 +00:00
parent fa7f03665e
commit 40204ff68c
3 changed files with 10 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.12 2001/05/30 12:28:50 mrg Exp $ */
/* $NetBSD: cpu.h,v 1.13 2001/06/24 05:34:07 msaitoh Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -90,11 +90,7 @@ extern struct cpu_info cpu_info_store;
*/
#define clockframe intrframe
#if 1
#define CLKF_USERMODE(frame) (!KERNELMODE((frame)->if_r15))
#else
#define CLKF_USERMODE(frame) USERMODE((frame)->if_spc, (frame)->if_ssr)
#endif
#define CLKF_USERMODE(frame) (!KERNELMODE((frame)->if_r15, (frame)->if_ssr))
#if 0
#define CLKF_BASEPRI(frame) ((frame)->if_pri == 0)
#else

View File

@ -1,4 +1,4 @@
/* $NetBSD: segments.h,v 1.1 1999/09/13 10:31:22 itojun Exp $ */
/* $NetBSD: segments.h,v 1.2 2001/06/24 05:34:07 msaitoh Exp $ */
/*-
* Copyright (c) 1995, 1997
@ -57,11 +57,8 @@
#define PSL_USERMODE 0 /* User mode */
#define PSL_SVMODE PSL_MD /* SuperVisor Mode */
#define USERMODE(c, f) ((f & PSL_MD) == PSL_USERMODE)
#if 1
#define KERNELMODE(sp) (sp & 0x80000000)
#else
#define KERNELMODE(c, f) ((f & PSL_MD) == PSL_SVMODE)
#endif
#define KERNELMODE(sp, f) ((sp & 0x80000000) \
&& ((f & PSL_MD) == PSL_SVMODE))
#define USERMODE(sp, f) (!KERNELMODE(sp, f))
#endif /* !_SH3_SEGMENTS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.26 2001/06/02 18:09:21 chs Exp $ */
/* $NetBSD: trap.c,v 1.27 2001/06/24 05:34:07 msaitoh Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -186,11 +186,7 @@ trap(p1, p2, p3, p4, frame)
}
#endif
#if 1
if (!KERNELMODE(frame.tf_r15)) {
#else
if (!KERNELMODE(frame.tf_spc, frame.tf_ssr)) {
#endif
if (!KERNELMODE(frame.tf_r15, frame.tf_ssr)) {
type |= T_USER;
sticks = p->p_sticks;
p->p_md.md_regs = &frame;
@ -425,11 +421,7 @@ syscall(frame)
u_quad_t sticks;
uvmexp.syscalls++;
#if 1
if (KERNELMODE(frame->tf_r15))
#else
if (!USERMODE(frame->tf_spc, frame->tf_ssr))
#endif
if (KERNELMODE(frame->tf_r15, frame->tf_ssr))
panic("syscall");
p = curproc;
sticks = p->p_sticks;
@ -708,7 +700,7 @@ tlb_handler(p1, p2, p3, p4, frame)
printf("tlb_handler#:va(0x%lx),curproc(%p)\n", va, curproc);
#endif
user = !KERNELMODE(frame.tf_r15);
user = !KERNELMODE(frame.tf_r15, frame.tf_ssr);
pteh_save = SHREG_PTEH;
va_save = va;