<HTML><BODY>
<div>Only exception... maybe one of these programs is using r20,21,22,23 by accident when it shouldnt be??<SPAN contentEditable=false style="DISPLAY: inline-block"></SPAN></div>
<div> </div>
<br>
-----Original Message-----<br>
From: richard-lists@imagecraft.com<br>
Sent: Wed, 4 Apr 2007 4:03 PM<br>
Subject: Re: [Icc-avr] Preserved registers?<br>
<br>
<STYLE>
.AOLPlainTextBody {
margin: 0px;
font-family: Tahoma, Verdana, Arial, Sans-Serif;
font-size: 12px;
color: #000;
background-color: #fff;
}
.AOLPlainTextBody pre {
font-size: 9pt;
}
.AOLInlineAttachment {
margin: 10px;
}
.AOLAttachmentHeader {
font: 11px arial;
border: 1px solid #7DA8D4;
background: #F9F9F9;
}
.AOLAttachmentHeader .Title {
font: 11px arial;
background: #B5DDFA;
padding: 3px 3px 3px 3px;
}
.AOLAttachmentHeader .FieldLabel {
font: 11px arial;
color: #000000;
padding: 1px 10px 1px 9px;
background: #F9F9F9;
}
.AOLAttachmentHeader .FieldValue {
font: 11px arial;
color: #000000;
background: #F9F9F9;
}
.AOLAttachmentHeader a, .AOLImage a {
color: #2864B4;
text-decoration: none;
}
.AOLAttachmentHeader a:hover, .AOLImage a:hover {
color: #2864B4;
text-decoration: underline;
}
.AOLWebSuiteCompose .AOLPicturesFullSizeLink,
.AOLWebSuite .AOLPicturesFullSizeLink {
height: 1px;
width: 1px;
overflow: hidden;
}
body {
background-color: white;
font-family: "Verdana";
font-size: 10pt;
border: 0px;
}
.AOLWebSuiteCompose p {
margin: 0px;
padding: 0px;
}
img.managedImg {
width: 0px;
height: 0px;
}
img.placeholder {
width: 275px;
height: 206px;
background: #F4F4F4 center center no-repeat;
border: 1px solid #DADAD6 !important;
}
</STYLE>
<div class=AOLPlainTextBody id=AOLMsgPart_0_2cb921f6-e871-4184-8921-efaf44a62bc0>Is "foo" compiled by ICC? If so, then it should not be a problem, since foo()'s code will save/restore the "Preserved Registers" (see Help on Calling Convention and Assembler Interface). If foo() is written in assembler, it will still need to obey the convention. <br>
<br>
At 10:44 AM 4/4/2007, Peter LaDow wrote: <br>
>I'm running into an issue with preserved registers being overwritten. <br>
> <br>
>For example, I have something like: <br>
> <br>
>extern void (*foo)(void); <br>
> <br>
>void bar(void) <br>
>{ <br>
> int i; <br>
> <br>
> for(i=0; i < 16; i++) <br>
> { <br>
> foo(); <br>
> } <br>
>} <br>
> <br>
>The problem is that i keeps getting destroyed after a call to foo(). I've >tracked this down and it is because foo() is using the same registers that >i is using. Now foo() is not located in the same executable ( i.e. not >linked with bar()), and I think some sort of optimization is being >done. Since bar() is unaware of foo()'s register usage, and foo() is >unaware of bar()'s register usage, they can pick the same registers. <br>
> <br>
>(The application calls functions in the bootloader to program the flash, >but the bootloader and application are compiled separately.) <br>
> <br>
>I do NOT have global optimizations enabled (which I think is -Wf-O8). <br>
> <br>
>I think my only way to handle this is to make sure that all preserved >registers are saved and restored whenever leaving (or entering) code >outside of the current executable. Is this my only solution, or is there >an ICC way to handle this? <br>
> <br>
>Thanks, <br>
>Pete <br>
<br>
// richard (This email is for mailing lists. To reach me directly, please use richard at imagecraft.com) <br>
_______________________________________________ <br>
Icc-avr mailing list <br>
<A href='javascript:parent.ComposeTo("Icc-avr%40imagecraft.com", "");'>Icc-avr@imagecraft.com</A> <br>
<A href="http://dragonsgate.net/mailman/listinfo/icc-avr" target=_blank>http://dragonsgate.net/mailman/listinfo/icc-avr</A> <br>
</div>
<!-- end of AOLMsgPart_0_2cb921f6-e871-4184-8921-efaf44a62bc0 -->
<div class="AOLPromoFooter">
<hr style="margin-top:10px;" />
AOL now offers free email to everyone. Find out more about what's free from AOL at <a href="http://www.aol.com?ncid=AOLAOF00020000000437" target="_blank"><b>AOL.com</b></a>.<br />
</div>
</BODY></HTML>