From: Kees Jongenburger Date: Sat, 16 Feb 2013 21:32:19 +0000 (+0100) Subject: kernel:enable trace on arm. X-Git-Tag: v3.3.0~1145 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=eff37b8a8b2378a784041a70fd8d29bc44a093fa;p=minix.git kernel:enable trace on arm. Change-Id: Iabe6dfd758e8f1cdb4a18e2f2ab8f8ca988f3c86 --- diff --git a/kernel/arch/earm/include/archconst.h b/kernel/arch/earm/include/archconst.h index 48307638b..96999e898 100644 --- a/kernel/arch/earm/include/archconst.h +++ b/kernel/arch/earm/include/archconst.h @@ -26,6 +26,15 @@ */ #define ARM_STACK_TOP_RESERVED (2 * sizeof(reg_t)) +/* only selected bits are changeable by user e.g.[31:9] and skip the + * mode bits. It is probably is a better idea to look at the current + * status to determine if one is allowed to write these values. This + * might allow debugging of privileged processes + */ +#define SET_USR_PSR(rp, npsr) \ + rp->p_reg.psr = ( rp->p_reg.psr & 0x1F) | ( npsr & ~0x1F) + + #define PG_ALLOCATEME ((phys_bytes)-1) #endif /* _ARM_ACONST_H */ diff --git a/kernel/system/do_trace.c b/kernel/system/do_trace.c index 24bfcc588..1bcb8fe21 100644 --- a/kernel/system/do_trace.c +++ b/kernel/system/do_trace.c @@ -154,6 +154,13 @@ int do_trace(struct proc * caller, message * m_ptr) SETPSW(rp, tr_data); else *(reg_t *) ((char *) &rp->p_reg + i) = (reg_t) tr_data; +#else + if (i == (int) &((struct proc *) 0)->p_reg.psr) { + /* only selected bits are changeable */ + SET_USR_PSR(rp, tr_data); + } else { + *(reg_t *) ((char *) &rp->p_reg + i) = (reg_t) tr_data; + } #endif m_ptr->CTL_DATA = 0; break;