Hi.

This patch add "OS_main" and 'OS_task' attributes in GCC 4.2.1. Function with 
"OS_main" and 'OS_task' attributes do not save any "call-saved" registers.

1. "OS_main" attribute  used when there IS guarantee that interrupts are 
disabled at that time when function is called. For example "main" function in 
avr-libc. If this function has local variables that a prologue will look so:
  in r28, 0x3d ; 61
  in r29, 0x3e ; 62
  sbiw r28, 0x08 ; 8
  out 0x3e, r29 ; 62
  out 0x3d, r28 ; 61

No save/clear/restore "I" flag.

2. "OS_task" attribute  used when there is NO guarantee that interrupts are 
disabled at that time when function is called. For example task functions 
multi-threading operating systems. In this case save/clear/restore "I" flag is 
need for changing SP register. Prologue (if this function has local variables) 
will look so:

  in r28, 0x3d ; 61
  in r29, 0x3e ; 62
  sbiw r28, 0x08 ; 8
  in r0, 0x3f ; 63
  cli
  out 0x3e, r29 ; 62
  out 0x3f, r0 ; 63
  out 0x3d, r28 ; 61


Testcase:
__attribute__ ((noinline))
int fn0(long a1, long a2, long a3, long a4, long a5)
{
    return 0;
}

__attribute__ ((OS_main))
int main(void)
{
   volatile long long a; // local var, need function frame

   a = 1;

   return fn0(1, 2, 3, 4, 5); // use call-saved regs
}

PS: At this moment, I have not found a simple way to add "OS_main" attribute 
in the avr-gcc 4.3. So presence of this attribute in GCC 4.3  in doubt.

Anatoly. 


begin 666 gcc-4.2.1-os_main_os_task.txt
[EMAIL PROTECTED](&=C8R]C;VYF:6<O879R+V%V<BYC"CT]/3T]/3T]/3T]/3T]/3T]
M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]
M/3T]/3T*+2TM(&=C8R]C;VYF:6<O879R+V%V<BYC"2AR979I<VEO;B Q,C8T
M-3<I"BLK*R!G8V,O8V]N9FEG+V%V<B]A=G(N8PDH=V]R:VEN9R!C;W!Y*0I 
M0" M-#DL-B K-#DL."! 0 H@(V1E9FEN92!-05A?3$1?3T9&4T54*$U/1$4I
M("@V-" M("AS:6=N960I1T547TU/1$5?4TE:12 H34]$12DI"B *('-T871I
M8R!I;[EMAIL PROTECTED]:V5D7V9U;F-T:6]N7W @*'1R964I.PHK<W1A=&EC(&EN
M="!A=G)?3U-?;6%I;E]F=6YC=&EO;E]P("AT<F5E*3L**W-T871I8R!I;G0@
M879R7T]37W1A<VM?9G5N8W1I;VY?<" H=')E92D["B!S=&%T:6,@:6YT(&EN
M=&5R<G5P=%]F=6YC=&EO;E]P("AT<F5E*3L*('-T871I8R!I;G0@<VEG;F%L
M7V9U;F-T:6]N7W @*'1R964I.PH@<W1A=&EC(&EN="!A=G)?<F5G<U]T;U]S
M879E("A(05)$7U)[EMAIL PROTECTED]"D! ("TT,#$L-B K-# S+#,S($! "B @
M(')E='5R;B!A("$]($Y53$Q?5%)%13L*('T*( [EMAIL PROTECTED])N(&YO;GIE
M<F\@:[EMAIL PROTECTED]<R!A($]37VUA:[EMAIL PROTECTED];VXN(" J+PHK"BMS=&%T
M:6,@:6YT"BMA=G)?3U-?;6%I;E]F=6YC=&EO;E]P("AT<F5E(&9U;F,I"BM[
M"BL@('[EMAIL PROTECTED]("!G8V-?87-S97)T("A44D5%7T-/[EMAIL PROTECTED]&9U;F,I
M(#T]($953D-424].7T1%0TPI.PHK(" **R @82 ](&QO;VMU<%]A='1R:6)U
M=&[EMAIL PROTECTED]")/4U]M86EN([EMAIL PROTECTED])55$53("[EMAIL PROTECTED]&9U
M;F,I*2D["BL@(')E='5R;B!A("$]($Y53$Q?5%)[EMAIL PROTECTED]
M=7)N(&YO;GIE<F\@:[EMAIL PROTECTED]<R!A($]37W1A<[EMAIL PROTECTED];VXN(" J
M+PHK"BMS=&%T:6,@:6YT"BMA=G)?3U-?=&%S:U]F=6YC=&EO;E]P("AT<F5E
M(&9U;F,I"BM["BL@('[EMAIL PROTECTED]("!G8V-?87-S97)T("A44D5%7T-/
[EMAIL PROTECTED]&9U;F,I(#T]($953D-424].7T1%0TPI.PHK(" **R @82 ](&QO;VMU
M<%]A='1R:6)U=&[EMAIL PROTECTED]")/4U]T87-K([EMAIL PROTECTED])55$53("A44D5%
[EMAIL PROTECTED]&9U;F,I*2D["BL@(')E='5R;B!A("$]($Y53$Q?5%)%13L**WT*
M*PHK"B O*B!2971U<FX@;F]N>F5R;R!I9B!&54Y#(&ES(&%N(&EN=&5R<G5P
M="!F=6YC=&EO;B!A<R!S<&5C:69I960*(" @(&)Y('1H92 B:6YT97)R=7!T
M(B!A='1R:6)U=&4N(" J+PH@"D! ("TT-#8L." K-#<U+#$Q($! "B @(" @
M0TQ%05)?2$%21%]214=?4T54("@J<V5T*3L*(" @8V]U;G0@/2 P.PH@"BT@
M("\J($YO(&[EMAIL PROTECTED]&\@<V%V92!A;GD@<F5G:7-T97)S(&EF('1H92!F=6YC
M=&EO;B!N979E<B!R971U<FYS+B @*B\*+2 @:[EMAIL PROTECTED])4U]63TQ!
M5$E,12 H8W5R<F5N=%]F=6YC=&EO;E]D96-L*2D**R @[EMAIL PROTECTED]@;F5E9"!T
M;R!S879E(&%N>2!R96=I<W1E<G,@:[EMAIL PROTECTED]&AE(&9U;F-T:6]N(&YE=F5R(')E
M='5R;G,@;W(@"BL@(" @(&ES(&AA=F4@(D]37VUA:6XB(&]R($]37W1A<VL@
M871T<FEB=71E+B @*B\**R @:[EMAIL PROTECTED])4U]63TQ!5$E,12 H8W5R
M<F5N=%]F=6YC=&EO;E]D96-L*0HK(" @(" @?'[EMAIL PROTECTED]:6Y?9G5N
M8W1I;VY?<" H8W5R<F5N=%]F=6YC=&EO;E]D96-L*0HK(" @(" @?'[EMAIL PROTECTED]
M7T]37W1A<VM?9G5N8W1I;VY?<" H8W5R<F5N=%]F=6YC=&EO;E]D96-L*2D*
M(" @("!R971U<FX@,#L*( H@("!F;W(@*')E9R ](# [(')E9R \(#,R.R!R
M96<K*RD*0$ @+30Y."PW("LU,S L-B! 0 H@"2 @)B8@(2!I;G1E<G)U<'1?
M9G5N8W1I;VY?<" H8W5R<F5N=%]F=6YC=&EO;E]D96-L*0H@"2 @)B8@(2!S
M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3%]04D],3T=515,*( D@(" @(" F)B A:6YT97)R=7!T
M7V9U;F-?<" F)B A<VEG;F%L7V9U;F-?<" F)B!L:79E7W-E<2D["D! ("TW
M,#4L,[EMAIL PROTECTED]<S."PX($! "B )(" @(" @($%3,2 H8VQR+%]?>F5R;U]R96=?
M7RD@(" @(EQN(BD["B @(" @("!P<F]L;V=U95]S:7IE("L](#4["B @(" @
M?0HM("!I9B H;6%I;E]P*0HK("!I9B H;6EN:6UI>F4@)[EMAIL PROTECTED]&9R86UE7W!O
M:6YT97)?;F5E9&5D('Q\(&QI=F5?<V5Q([EMAIL PROTECTED]( H@(" @('L*+2 @(" @
M(&9P<FEN=&[EMAIL PROTECTED]&9I;&4L("@B7'0B( HM"0D@(" @("[EMAIL 
PROTECTED]&QD:2QR,[EMAIL PROTECTED]
M("(L;&\X*"5S("T@(B!(3U-47U=)1$5?24Y47U!224Y47T1%0R B*2(@0U)?
M5$%""BT)"2 @(" @($%3,2 H;&1I+'(R.2D@(BQH:[EMAIL PROTECTED])7,@+2 B($A/4U1?
M5TE$15])3E1?4%))3E1?1$5#("(I(B!#4E]404(*+0D)(" @(" @05,R("AO
M=70L7U]34%](7U\L<C(Y*2 @(" @0U)?5$%""BT)"2 @(" @($%3,B H;W5T
M+%]?4U!?3%]?+'(R."D@(EQN(BDL"BT)(" @(" @(&%V<E]I;FET7W-T86-K
M+"!S:7IE+"!A=G)?:6YI=%]S=&%C:RP@<VEZ92D["BT@(" @(" *+2 @(" @
M('!R;VQO9W5E7W-I>[EMAIL PROTECTED]@-#L*+2 @("!]"BT@(&5L<V4@:[EMAIL 
PROTECTED]&UI;FEM
M:7IE("8F("AF<F%M95]P;VEN=&5R7VYE961E9"!\?"!L:79E7W-E<2 ^(#8I
M*2 *+2 @("!["B @(" @("!F<')I;G1F("AF:6QE+" H(EQT(@H@"0D@(" @
M("[EMAIL PROTECTED]&QD:2P@<C(V*2 B+&QO."@B($A/4U1?5TE$15])3E1?4%))3E1?
M1$5#("(I(B!#4E]404(*( D)(" @(" @05,Q("AL9&DL('(R-RD@(BQH:[EMAIL PROTECTED]
M(B!(3U-47U=)1$5?24Y47U!224Y47T1%0R B*2(@0U)?5$%"*2P@<VEZ92P@
M<VEZ92D["D! ("TW-34L,3(@*S<W-RPQ-R! 0 H@"7T*(" @(" @(&EF("AF
M<F%M95]P;VEN=&5R7VYE961E9"D*( E["BL)("!I9B H(4]37VUA:6Y?<" F
M)B A3U-?=&%S:U]P*0HK(" @(" @(" @(" @>PHK"2 @(" @(&9P<FEN=&8@
M*&9I;&4L(")<="(**PD)(" @(" @($%3,2 H<'5S:"QR,[EMAIL PROTECTED]([EMAIL 
PROTECTED]
M"0D@(" @(" @05,Q("AP=7-H+'(R.2D@(EQN(BD["BL)(" @(" @<')O;&]G
M=65?<VEZ92 K/2 R.PHK"2 @("!]"B )("!F<')I;G1F("AF:6QE+" B7'0B
M"BT)"2 @($%3,2 H<'5S:"QR,[EMAIL PROTECTED]([EMAIL PROTECTED]"0D@("[EMAIL 
PROTECTED]'!U<[EMAIL PROTECTED]
M<C(Y*2!#4E]404(*( D)(" @05,R("AI;BQR,[EMAIL PROTECTED],7U\I($-27U1!
[EMAIL PROTECTED]@"0D@("!!4S(@*&EN+'(R.2Q?7U-07TA?7RD@(EQN(BD["BT)("!P<F]L
M;V=U95]S:7IE("L](#0["BL)("!P<F]L;V=U95]S:7IE("L](#(["B )("!I
M9B H<VEZ92D*( D@(" @>PH@"2 @(" @(&9P=71S("@B7'0B+"!F:6QE*3L*
M0$ @+3<W,"PW("LW.3<L-R! 0 H@"0E["B )"2 @<')O;&]G=65?<VEZ92 K
M/2!O=71?<V5T7W-T86-K7W!T<B H9FEL92P@,2P@,2D["B )"7T*+0D@(" @
M("!E;'-E(&EF("AS:6=N86Q?9G5N8U]P*0HK"2 @(" @(&5L<V4@:[EMAIL PROTECTED]'-I
M9VYA;%]F=6YC7W @?'[EMAIL PROTECTED];6%I;E]P*0H@"0E["B )"2 @<')O;&]G=65?
M<VEZ92 K/2!O=71?<V5T7W-T86-K7W!T<B H9FEL92P@,"P@,"D["B )"7T*
M0$ @+3<Y-"PW("LX,C$L."! 0 H@("!I;G0@<F5G.PH@("!I;G0@:6YT97)R
M=7!T7V9U;F-?<#L*(" @:6YT('-I9VYA;%]F=6YC7W ["BT@(&EN="!M86EN
M7W ["BL@(&EN="!/4U]M86EN7W ["BL@(&EN="!/4U]T87-K7W ["B @(&EN
M="!F=6YC=&EO;E]S:7IE.PH@("!I;G0@;&EV95]S97$["B @(&EN="!M:6YI
M;6EZ93L*0$ @[EMAIL PROTECTED]" K.#4T+#$T($! "B *(" @:6YT97)R=7!T7V9U
M;F-?<" ](&EN=&5R<G5P=%]F=6YC=&EO;E]P("AC=7)R96YT7V9U;F-T:6]N
M7V1E8VPI.PH@("!S:6=N86Q?9G5N8U]P(#T@<VEG;F%L7V9U;F-T:6]N7W @
M*&-U<G)E;G1?9G5N8W1I;VY?9&5C;"D["BT@(&UA:6Y?<" ]($U!24Y?3D%-
M15]0("A$14-,[EMAIL PROTECTED]&-U<G)E;G1?9G5N8W1I;VY?9&5C;"DI.PHK("!/
M4U]M86EN7W @/2!A=G)?3U-?;6%I;E]F=6YC=&EO;E]P("AC=7)R96YT7V9U
M;F-T:6]N7V1E8VPI.PHK("!/4U]T87-K7W @/2!A=G)?3U-?=&%S:U]F=6YC
M=&EO;E]P("AC=7)R96YT7V9U;F-T:6]N7V1E8VPI.PH@("!L:79E7W-E<2 ]
M('-E<75E;G1?<F5G<U]L:79E("@I.PH@("!M:6YI;6EZ92 ]("A405)'151?
M0T%,3%]04D],3T=515,*( D@(" @(" F)B A:6YT97)R=7!T7V9U;F-?<" F
M)B A<VEG;F%L7V9U;F-?<" F)B!L:79E7W-E<2D["B @( HM("!I9B H;6%I
M;E]P*0HK("!I9B H;6EN:6UI>F4@)[EMAIL PROTECTED]&9R86UE7W!O:6YT97)?;F5E9&5D
M('Q\(&QI=F5?<V5Q([EMAIL PROTECTED]"DI"B @(" @>PHM(" @(" @[EMAIL 
PROTECTED])N('9A
M;'5E(&9R;VT@;6%I;[EMAIL PROTECTED](&ES(&%L<F5A9'D@:[EMAIL 
PROTECTED]&AE(&-O<G)E8W0@<F5G
M:7-T97)S"BT)("AR,C4Z<C(T*2!A<R!T:&[EMAIL PROTECTED]"@I(&%R9W5M96YT+B @
M*B\*+2 @(" @(&EF("A!5E)?345'02D*+0E["BT)("!F<'5T<R H(EQT(B!!
[EMAIL PROTECTED]&IM<"QE>&ET*2 B7&XB+"!F:6QE*3L*+0D@(&5P:6QO9W5E7W-I>F4@
M*ST@,CL*+0E]"BT@(" @("!E;'-E"BT)>PHM"2 @9G!U=',@*")<="(@05,Q
M("AR:FUP+&5X:70I(")<;B(L(&9I;&4I.PHM"2 @*RME<&EL;V=U95]S:7IE
M.PHM"7T*+2 @("!]"BT@(&5L<V4@:[EMAIL PROTECTED]&UI;FEM:7IE("8F("AF<F%M95]P
M;VEN=&5R7VYE961E9"!\?"!L:79E7W-E<2 ^(#0I*0HM(" @('L*(" @(" @
M(&9P<FEN=&[EMAIL PROTECTED]&9I;&4L("@B7'0B($%3,B H;&1I+"!R,S L("5D*2!#4E]4
M04(I+"!L:79E7W-E<2D["B @(" @(" K*V5P:6QO9W5E7W-I>F4["B @(" @
M("!I9B H9G)A;65?<&]I;G1E<E]N965D960I"D! ("TX.30L,3 @*SDP."PQ
M,R! 0 H@"0D@(&5P:6QO9W5E7W-I>[EMAIL PROTECTED]@;W5T7W-E=%]S=&%C:U]P='(@
M*&9I;&4L("TQ+" M,2D["B )"7T*( D@(" @?0HM"2 @9G!R:6YT9B H9FEL
M92P@(EQT(@HM"0D@("[EMAIL PROTECTED]'!O<"QR,CDI([EMAIL PROTECTED]"0D@("!!4S$@
M*'!O<"QR,[EMAIL PROTECTED](")<;B(I.PHM"2 @97!I;&]G=65?<VEZ92 K/2 R.PHK"2 @
M:[EMAIL PROTECTED]"%/4U]M86EN7W @)B8@(4]37W1A<VM?<"D**R @(" @(" @(" @('L*
M*PD@(" @("!F<')I;G1F("AF:6QE+" B7'0B"BL)"2 @(" @("[EMAIL PROTECTED]'!O
M<"QR,CDI([EMAIL PROTECTED]"0D@(" @(" @05,Q("AP;W L<C(X*2 B7&XB*3L*
M*PD@(" @("!E<&EL;V=U95]S:7IE("L](#(["BL)(" @('T*( E]"B *(" @
M(" @(&5P:6QO9W5E7W-I>[EMAIL PROTECTED]@879R7W)E9W-?=&]?<V%V92 H)G-E="D[
M"D! ("[EMAIL PROTECTED]"! 0 H@(" @:6YT97)R=7!T("T@;6%K92!A
M(&9U;F-T:6]N('1O(&)E(&AA<F1W87)E(&EN=&5R<G5P="[EMAIL PROTECTED](@9G5N
M8W1I;VX*(" @('!R;VQO9W5E(&EN=&5R<G5P=',@87)E(&5N86)L960["B @
M("!N86ME9" @(" @+2!D;VXG="!G96YE<F%T92!F=6YC=&EO;B!P<F]L;V=U
M92]E<&EL;V=U92!A;[EMAIL PROTECTED]')E="<@8V]M;6%N9"X**R @($]37VUA:[EMAIL 
PROTECTED] N
M+BX**R @($]37W1A<[EMAIL PROTECTED] N+BX*( H@(" @3VYL>2!@<')O9VUE;2<@871T
M<FEB=71E('9A;&ED(&9O<B!T>7!E+B @*B\*( I 0" M-#8U-"PV("LT-C<S
M+#@@0$ *(" @>R B<VEG;F%L(BP@(" @,"P@,"[EMAIL PROTECTED]')U92P@(&9A;'-E+"!F
M86QS92P@(&%V<E]H86YD;&5?9FYD96-L7V%T=')I8G5T92!]+ H@("![(")I
M;G1E<G)U<'0B+" P+" P+"!T<G5E+" @9F%L<V4L(&9A;'-E+" @879R7VAA
M;F1L95]F;F1E8VQ?871T<FEB=71E('TL"B @('L@(FYA:V5D(BP@(" @(# L
M(# L(&9A;'-E+"!T<G5E+" @=')U92P@("!A=G)?:&%N9&QE7V9N='EP95]A
M='1R:6)U=&[EMAIL PROTECTED] @>R B3U-?;6%I;B(L(" @,"P@,"[EMAIL 
PROTECTED]<V4L('1R
M=64L("!T<G5E+" @(&%V<E]H86YD;&5?9FYT>7!E7V%T=')I8G5T92!]+ HK
M("![(")/4U]T87-K(BP@(" P+" P+"[EMAIL PROTECTED]')U92P@('1R=64L(" @
M879R7VAA;F1L95]F;G1Y<&5?871T<FEB=71E('TL"B @('[EMAIL PROTECTED],3"P@(" @
L(" @(# L(# L(&9A;'-E+"[EMAIL PROTECTED]<V4L([EMAIL PROTECTED]@?3L*( H`
`
end



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to