[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] Re: MiNTOS Versions
On Thu, Feb 11, 1999 at 01:03:33PM -0700, Oddie Jonathan wrote:
> BTW: does anyone know if it is possible to declare an inline function in gcc?
> e.g. some compilers allow this:
> void dummyfunc(void) = 0xA913;
> which makes a function that calls an a-trap, but my gcc (2.5.8) whines at this,
> saying something like "function initialized like a variable."
> It would be nice if someone knows how to do this, because this is what I need
> to be able to call Mac functions from inside MacMiNT, which is necessary for
> a few things...
Sure - look in the gcc info pages:
static inline UWORD ints_off(void)
{
UWORD old_sr;
asm volatile ("move.w %%sr,%0\n\t"
"ori #0x0700,%%sr"
: "=d" (old_sr) /* output register */
: /* input registers */
: "cc" /* clobbered */ );
return old_sr;
}
UWORD sr = ints_off();
(...)
ints_on(sr);
cu
Michael
--
Michael Schwingen, Ahornstrasse 36, 52074 Aachen