We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,534 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

ARM asm, how to return a value -- Please help

Hi, in a given c program where you have

myvar = sumR(char * arg1, int arg2)

sumR is a function in an assembly .s file. I have done all the calculations, but I have no idea how to return the value to the calling c program.

Any ideas?

Thanks so much.

2
Contributors
3
Replies
17 Minutes
Discussion Span
1 Year Ago
Last Updated
4
Views
baldwindc
Light Poster
35 posts since Nov 2010
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0

Usually the value is returned in R0. So in your sumR, after you do your stuff, place what you want myvar to equal in R0

GunnerInc
xor eax, eax
Team Colleague
90 posts since Jan 2011
Reputation Points: 38
Solved Threads: 13
Skill Endorsements: 0

Thanks. If you don't mind one more, how do you print the contents of a register which contains an int.

baldwindc
Light Poster
35 posts since Nov 2010
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0

Eh, Not sure, I am an x86 guy - sorry. Check the ARM website for debug stuff you can use.

GunnerInc
xor eax, eax
Team Colleague
90 posts since Jan 2011
Reputation Points: 38
Solved Threads: 13
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0665 seconds using 2.72MB