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 914231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:41:08+00:00 2026-05-15T17:41:08+00:00

This question is asked because the author is building a compiler (src -> asm)

  • 0

This question is asked because the author is building a compiler (src -> asm) and is in the process of writing code for generating assembly code.

One of the first things that happens when a program executes on a Linux (any OS really) based operating system is that the stack gets set up and the SP register is assigned with the memory address of the beginning of the stack.

I was curious about if the responsibility of doing the above lies with the program, or the OS itself. If it is the case that the responsibility lies with the program, how is this accomplished by the program (specifically, in a Linux base environment)?

What other actions must an individual program do before it can start executing its main function?

Examples with commented i386 NASM assembly code is appreciated. Also, any web resource that could help the author in his goal would also be very much appreciated.

  • 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-15T17:41:09+00:00Added an answer on May 15, 2026 at 5:41 pm

    The OS will set up the SP for you and place the program arguments on the stack. There is nothing special your program needs to set up in order to run.

    As for the actual stack layout on Linux when your program starts, you could check this document for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is being asked because of this one . C++11 allows you to
I asked this question earlier and it was closed because it was a duplicate,
I know this question gets asked a lot because I have looked at many
I am asking this question on SO because a similar question was asked here
I'm raising this question because of another question I asked here on SO some
i have asked this question before and it was closed because i was unable
This question is being asked because I have no prior experience with delegate best
This question changed a lot since it was first asked because I didn't understand
This is not generic question. I have asked this question because I'm confused with
I was recently asked this question in one of my telephonic interview. There is

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.