This is the mail archive of the
crossgcc@cygnus.com
mailing list for the crossgcc project.
Re: Masking interrupts?
On Mon, Jul 05, 1999 at 11:43:21AM -0700, Art Berggreen wrote:
>
> We've had to resort to asm() in our 68k code to insure atomic
> operations.
I did that, too. Any idea *why* gcc sometimes produces three instructions
instead of one atomic one, even if none of the values is used again later?
> For your problem, maybe something along the lines of:
>
> static inline void txint_off(UART *regs)
> {
> unsigned char *ier_ptr = &(regs->ier);
> unsigned char mask = ~TXLDL_IE;
> asm volatile ("and.b %0,(%1)" : : "d" (mask), "a" (ier_ptr) : "cc");
> }
This uses an extra data and address register (and two instructions to
initialize them). In my case, there is already an address register which
holds a pointer to the hardware, so a "bset #a,b(%%a0)" is the best.
I want to get a "bset #4,2(%1)" with the '4' and '2' replaced by constants
derived from the C does (ie. a defined bit number and offset in the struct),
but I could not get this to work. The hardcoded asm does work fine, but is
difficult to maintain.
cu
Michael
--
Michael Schwingen, Ahornstrasse 36, 52074 Aachen
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.