I'll hazard a guess, and say that the processor is in user mode (as opposed
to supervisor mode), when you are running you program.  "ori.w #$0700, %%sr"
is a privileged instruction that generates a privilege violation exception
when executed from user mode.

----- Original Message -----
From: Daniel McCarty <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 30, 1999 4:14 PM
Subject: GCC and asm ("..."): disabling interrupts


>    I'm attempting to disable irq's for a split second to play
> a quick sound with the PWM but my attempts to write a 3-line
> function in assembler with GCC have failed so far.
>
>    I've pored through GCC docs and read the "Assembler
> Instructions with C Expression Operands" section, but while
> I have a version that will compile, it only Fatal Reset's an
> actual device.
>
>    My code so far looks like:
>      static Word TurnOffInts(void)
>      {
>         asm ("move.w %%sr, %%d0" : :);
>         asm ("ori.w #$0700, %%sr" : :);
>         asm ("rts");
>      }
>
>    I found some help at
>      http://www.delorie.com/doc/brennan/brennan_att_inline_djgpp.html
> but it deals more with GAS under DJGPP and not GCC.  Any help
> with what I'm doing wrong (syntax?) would be grealy appreciated.
>
> Thanks,
> Daniel.
>
>    ***  I realize I'm setting myself up for a full flaming from
> David Fedor for trying to disable interrupts, and another one
> from John Marshall for not wading though more docs and visiting
> his super-portal twice daily, but at this point I'm willing to
> risk it.  ;)
>

Reply via email to