Subject: Re: build aborts in regress/lib/libpthread/sem
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Marcus Comstedt <marcus@mc.pp.se>
List: port-dreamcast
Date: 02/13/2003 13:28:33
Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> writes:

> BTW, I have some questions about current G2_LOCK/UNLOCK implementation:
> 
> - In G2_LOCK, it uses _cpu_exception_suspend(), but shouldn't we
>   use _cpu_intr_suspend() instead?

The call was initially disable_intr(), but was changed by uch to
_cpu_exception_suspend().  I don't know the definition of this macro,
but the important thing is that the bus cycle which accesses the G2
bus will not be interrupted.  An exception might interrupt the bus
cycle just as an interrupt would, so it should be safest to diable
both by setting the block bit in the status register.


> - In G2_UNLOCK, it implicitly pass zero to _cpu_exception_resume(),
>   but shouldn't we restore returned value from the previous
>   _cpu_exception_suspend() in G2_LOCK?

Probably.  As I said, I don't know the definition of these macros, but
if exceptions were already disabled on entry to the bus_mem function,
they should remain disabled upon exit.


  // Marcus