[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Not naked but "topless" functions?
From: |
Kang Tin LAI |
Subject: |
Re: [avr-gcc-list] Not naked but "topless" functions? |
Date: |
Wed, 16 Oct 2002 22:07:17 +0800 |
As my understanding, you are the fourth one for this question of "naked"
attribute. Everyone playing avr-gcc with kernel have to face this
problem.
If this is a "address" operation in your function, it is also a trouble
regardless how many local you using.
If you are using linux, I may send you my patch for "naked" which
generates a proper stack frame setup. But you need to have your source
codes of gcc, binutils and compilation system working for recompiling
the avr-gcc.
--
---
Kang Tin LAI <address@hidden>
-----
"Tvrtko A. Ursulin" wrote:
>
> 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 at http://avr1.org
- Re: [avr-gcc-list] Not naked but "topless" functions?, (continued)
Re: [avr-gcc-list] Not naked but "topless" functions?,
Kang Tin LAI <=
Re: [avr-gcc-list] Not naked but "topless" functions?, Kang Tin LAI, 2002/10/23