Subject: Re: cpufunc.h
To: John Fremlin <vii@users.sourceforge.net>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm
Date: 05/29/2001 23:37:41
On 29 May 2001, John Fremlin wrote:
> Ben Harris <bjh21@netbsd.org> writes:
>
> [...]
>
> > Most of the occurrances of SetCPSR seem to be being used to disable
> > IRQs and restore their previous state, so we should probably have an
> > API specifically to do that.
>
> There already exists one in cpufunc.h
Ha. Shows how thoroughly _I_ know that bit of the API, doesn't it?
> #define disable_interrupts(mask) \
> (SetCPSR((mask) & (I32_bit | F32_bit), (mask) & (I32_bit | F32_bit)))
>
> #define enable_interrupts(mask) \
> (SetCPSR((mask) & (I32_bit | F32_bit), 0))
>
> #define restore_interrupts(old_cpsr) \
> (SetCPSR((I32_bit | F32_bit), (old_cpsr) & (I32_bit | F32_bit)))
>
> Typical that people don't use it. Looking at the hpcarm port I see
> people doing the set_cpsr stuff themselves in inline assembly :-(
Actually, those are rather more heavily-used than SetCPSR, so changing the
remaining uses of SetCPSR to use those instead shouldn't be too painful.
--
Ben Harris <bjh21@netbsd.org>
Portmaster, NetBSD/arm26 <URL:http://www.netbsd.org/Ports/arm26/>