Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 334 Vote(s) - 3.39 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How's return value implemented in assembly level?

#1
int main(void){

printf("Hello World");

return 0;

}

How is **0** passed as return value in assembly level? Is there a dedicated CPU register for this job?


**UPDATE**

Here's the 2 tables on passing/return data in the pdf, but doesn't seems to have the exact info on how the calling convention of an API is determined and which register is used for storing return address:

![alt text][1]

![alt text][2]


[1]:

[2]:
Reply

#2
That depends on the architecture. Just for a couple of examples, on x86 the EAX register is normally used for return values. On x86-64, it's RAX. On SPARC, it'll normally show up in %o0.
Reply

#3
That's part of the <a href="http://en.wikipedia.org/wiki/Application_binary_interface">application binary interface</a>.

These days the return value and function parameters usually are passed in registers, because that is the most efficient option. Only if that gets too big for the available registers the stack is used.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through