- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear everybody,
I need to get variable arguments from a function without using va_args. ABI rules for Nios II state that a copy of r4 thru r7 is saved on the stack after the function call in order to use va_args. Now, I make the following call: MyFunction (param1, param2) (the prototype of MyFunction is void MyFunction (char *, ...). Well, the code written by the compiler as the prolog of MyFunction is: addi sp,sp,-32 stw ra,16(sp) stw fp,12(sp) mov fp,sp stw r5,20(fp) stw r6,24(fp) stw r7,28(fp) stw r4,0(fp) MyFunction uses two "int" local variables. What is really strange for me is that r4 and r5 (my arguments) are copied at 0(fp) and 20(fp). I expect that r5 is copied at 4(fp). Are you able to explain me this compiler behaviour ? Best Regards /AlessandroLink Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page