1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00

Consistently us the same metric to differentiate between kernel mode

and user mode. We need to take into account that the EPC syscall path
introduces a grey area in which one can argue either way, including a
third: neither.

We now use the region in which the IP address lies. Regions 5, 6 and 7
are kernel VA regions and if the IP lies any any of those regions we
assume we're in kernel mode. Hence, we can be in kernel mode even if
we're not on the kernel stack and/or have user privileges. There're
gremlins living in the twilight zone :-)

For the EPC syscall path this particularly means that the process
leaves user mode the moment it calls into the gateway page. This
makes the most sense because from a process' point of view the call
represents a request to the kernel for some service and that service
has been performed if the call returns. With the metric we picked,
this also means that we're back in user mode IFF the call returns.

Approved by: re@ (blanket)
This commit is contained in:
Marcel Moolenaar 2003-05-24 21:16:19 +00:00
parent 5e8db10ac1
commit 95f2dbba40
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115294
2 changed files with 2 additions and 3 deletions

View File

@ -343,7 +343,7 @@ trap(int vector, struct trapframe *framep)
int i, user;
u_int sticks;
user = ((framep->tf_special.psr & IA64_PSR_CPL) == IA64_PSR_CPL_USER);
user = ((framep->tf_special.iip >> 61) < 5) ? 1 : 0;
/* Short-circuit break instruction based system calls. */
if (vector == IA64_VEC_BREAK && user &&

View File

@ -63,8 +63,7 @@ struct clockframe {
/* XXX */
#define TRAPF_PC(tf) ((tf)->tf_special.iip)
#define TRAPF_USERMODE(framep) \
(((framep)->tf_special.psr & IA64_PSR_CPL) == IA64_PSR_CPL_USER)
#define TRAPF_USERMODE(tf) ((TRAPF_PC(tf) >> 61) < 5)
/*
* CTL_MACHDEP definitions.