Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7181995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:40:29+00:00 2026-05-28T17:40:29+00:00

I have a function that is called by main. Assume that function’s name is

  • 0

I have a function that is called by main. Assume that function’s name is funct1. funct1 calls another function named read_input.

Now assume that funct1 starts as follows:

push %rbp
push %rbx
sub $0x28, %rsp
mov $rsp, %rsi
callq 4014f0 read_input
cmpl $0x0, (%rsp)
jne (some terminating function)

So just a few of questions:

  1. In this case, does read_input only have one argument, which is
    %rbx?
  2. Furthermore, if the stack pointer is being decreased by
    0x28, this means a string of size 0x28 is getting pushed onto the
    stack? (I know it’s a string).
  3. And what is the significance of
    mov %rsp, %rsi before calling a function?
  4. And lastly, when read_input returns, where is the return value put?

Thank you and sorry for the questions but I am just starting to learn x86!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:40:30+00:00Added an answer on May 28, 2026 at 5:40 pm

    It looks like your code is using the Linux/AMD ABI. I’ll answer your questions in that context.

    1. No, rbx is a callee-saved (nonvolatile) register. Your function is saving it so that it doesn’t disturb the caller’s value. It’s not being restored in the code you’ve shown, but that’s because you haven’t shown the whole function. If there’s more to this function, and I think there is, it’s because rbx is being used somewhere later on in this routine.
    2. Yes, space for 0x28 bytes of data is being made on the stack. Assuming read_input is taking a string as a parameter, your description is reasonable. It’s not necessarily accurate, however. Some of that data might be used for other local variables aside from just the buffer being allocated to pass to read_input.
    3. This instruction is putting a pointer to the newly allocated stack buffer into rsi. rsi is the second parameter register for the AMD x64 calling convention. That means you’re going to be calling read_input with whatever the first parameter passed to this function is, along with a pointer to your new stack buffer.
    4. In rax, if it’s a 64-bit value or smaller, in rax & rdx if it’s larger. Or if it’s floating point, in xmm0, ymm0, or st(0). You probably should look at a description of your calling convention to get a handle on this stuff – there’s a great PDF file at this link. Check out Table 4.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have a boost::function of with an arbitrary signature called type CallbackType
I have a function that's called hundreds of thousands of times per update, and
I have a function that I use called sqlf(), it emulates prepared statements. For
I have a function that is being called from different threads in the application.
I have an old function that is called many times in my application. I
I have a function that is often called inside of other functions, and I'd
I have a Javascript function that is called from the onchange method in a
I have an MS SQL function that is called with the following syntax: SELECT
I have a function called FindSpecificRowValue that takes in a datatable and returns the
I have this function called ProperCase that takes a string, then converts the first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.