[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Not naked but "topless" functions?
From: |
Tvrtko A. Ursulin |
Subject: |
[avr-gcc-list] Not naked but "topless" functions? |
Date: |
Thu, 10 Oct 2002 23:07:52 +0200 |
Hello everyone!
More questions...
I need to write functions that dont push/pop registers on stack. But if I use
__attribute__((naked)) then compiler omits code that adjusts stack pointer
also. That is ok if my function uses less than available registers, but if
not... trouble.
My functions should adjust stack like this:
14e: cd b7 in r28, 0x3d ; 61
150: de b7 in r29, 0x3e ; 62
152: 25 97 sbiw r28, 0x05 ; 5
154: 0f b6 in r0, 0x3f ; 63
156: f8 94 cli
158: de bf out 0x3e, r29 ; 62
15a: 0f be out 0x3f, r0 ; 63
15c: cd bf out 0x3d, r28 ; 61
This is taken from function which uses 5 stack variables, hence sbiw r28,0x05.
Btw, what does in/cli/out of SREG in default function prolog do? If it is
supposed to ensure no interrupt occurs while manipulating SP, why "out
0x3f,r0" (enable interrupts right?) is not the last instruction?
Thanks!
avr-gcc-list at http://avr1.org
- [avr-gcc-list] Not naked but "topless" functions?,
Tvrtko A. Ursulin <=