I know these macros exist, but they don't work either, because the compilers always inserts the prologue code before the first statement. See the example below. What I need, is to disable interrupts as the first instruction (STLDSR) in the interrupt service routine. This makes sure no other higher interrupt request can interrupt my isr.
See the text on page 124 of the MCF51JM128RM.pdf manual (6.3.2 - exception processing overview).
; 221: __interrupt void my_isr(void)
; 222: {
;
0x000082BA _my_isr:
; my_isr:
0x000082BA 0x4FEFFFF4 lea -12(a7),a7
0x000082BE 0x48D70103 movem.l d0-d1/a0,(a7)
;
; 223: DisableInterrupts
; 224:
;
0x000082C2 0x40C0 move sr,d0
0x000082C4 0x008000000700 ori.l #0x700,d0 ; '....'
0x000082CA 0x46C0 move d0,sr