Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > Embedded > Re: Could any o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 9 Topic 12422 of 13381
Post > Topic >>

Re: Could any one clarify the below codes.

by cs_posting@[EMAIL PROTECTED] Jun 26, 2008 at 10:02 AM

On Jun 26, 11:13 am, moja...@[EMAIL PROTECTED]
 (Everett M.
Greene) wrote:
> "Mohan kumar" <mohankumar_be...@[EMAIL PROTECTED]
> writes:
> > Hi thanks for your reply,
>
> > the puzzling question that rocks my mind is why should they terminate
the
> > stack by subtracting 64 with the stack pointer(r1)
>
> > addi r1,r11,__stackstart_pt@[EMAIL PROTECTED]
> > addi r1,r11,__stackstart_pt@[EMAIL PROTECTED]
> > addi r0,r0,0
> > stwu r0,-64(r1)
>
> > 1. first two lines of code have defined the stack pointer(r1)
> > 2. third lines has cleared register r0.
>
> Are you certain of that?  It appears to do nothing.
> ANDI r0,r0,0 would clear R0.

I'm not quite sure what the first line does that persists, but the
second line loads r1 with the sum of r11 (probably some base register)
and a constant  displacement named "stackstart".

The third line clears r0 as you said

And the fourth line stores this value of 0 at -64 relative to the
value having something to do with "stackstart" that was loaded into
r1.

So yeah, I think it's initializing some part of the stack frame to
zero, probably the pointer to a non-existent previous stack frame.

Storing things at small constant offsets from the stack pointer is a
favorite habit of compilers... you see instructions to this effect all
the time, on all sorts of processors.  Keeping track of those offsets
especially in relation to a stack pointer that may change during your
procedure is a royal pain to do when coding assembly by hand, but very
easy for a compiler.
 




 9 Posts in Topic:
Could any one clarify the below codes.
"Mohan kumar" &  2008-06-25 06:22:46 
Re: Could any one clarify the below codes.
cs_posting@[EMAIL PROTECT  2008-06-25 10:04:15 
Re: Could any one clarify the below codes.
"Mohan kumar" &  2008-06-26 01:10:21 
Re: Could any one clarify the below codes.
Coos Haak <chforth@[EM  2008-06-26 15:19:41 
Re: Could any one clarify the below codes.
"John B" <sp  2008-06-27 11:57:42 
Re: Could any one clarify the below codes.
Coos Haak <chforth@[EM  2008-06-27 18:48:31 
Re: Could any one clarify the below codes.
mojaveg@[EMAIL PROTECTED]  2008-06-26 07:13:04 
Re: Could any one clarify the below codes.
cs_posting@[EMAIL PROTECT  2008-06-26 07:13:50 
Re: Could any one clarify the below codes.
cs_posting@[EMAIL PROTECT  2008-06-26 10:02:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 9:34:02 CST 2008.