Subject: Re: Interrupt level in system call
To: None <port-sh3@NetBSD.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sh3
Date: 07/22/2006 06:53:24
On Fri, Jul 21, 2006 at 12:33:15 +0900, Masao Uebayashi wrote:
> A co-worker found a problem that system calls in kernel mode are
> running in the highest interrupt level (SR:I[3-0] == 1111).
Oops.
> Can't they safely run in the lowest interrupt level?
They should.
> Index: arch/sh3/sh3/exception_vector.S
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/sh3/sh3/exception_vector.S,v
> retrieving revision 1.18
> diff -u -r1.18 exception_vector.S
> --- arch/sh3/sh3/exception_vector.S 8 Feb 2006 02:19:57 -0000 1.18
> +++ arch/sh3/sh3/exception_vector.S 21 Jul 2006 03:23:31 -0000
> @@ -104,6 +104,7 @@
> mov.l r2, @(TF_UBC, r14) /* clear trapframe->tf_ubc */
> #endif /* DDB */
> __EXCEPTION_UNBLOCK(r0, r1)
> + __INTR_UNMASK(r0, r1)
> mov.l _L.general, r0
> jsr @r0
> mov r14, r5 /* 2nd arg */
I think that's not a correct fix. We can hit general_excepion() from
kernel code, so we cannot set sr.imask to zero in that place.
general_excepion() should call spl0() if the trap is coming from the
user mode.
I'm trying to wrap my head around this code.
SY, Uwe
--
uwe@ptc.spbu.ru | Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/ | Ist zu Grunde gehen