1

I am currently implementing a C runtime library for the Arm64 platform, and I am unsure which assumptions I can make about the environment at the precise point that the application is executed (what the ELF file has defined as the entry point). With environment, I am primarily referring to the stack setup and the cpu registers.

I was able to piece together information by looking at the kernel source code, but not everything.

My question is: Is the calling convention into applications documented and/or standardized? I am looking for something equivalent to Arm64 Base Procedure Call Standard for example.

I am posting this in the Unix & Linux Stack Exchange, because I am interested in Linix specifically, and I assume an operating system may perform this call in anyway it defines as long as all executables conform.

2
  • This being a vast topic with a fair number of exceptions. I suggest that you first read the manual for the execve function of the standard C libray, then eventually come back here re-editing your question with the points for which you need more detailed infos.
    – MC68020
    CommentedJan 4, 2023 at 15:42
  • After looking into it some more, I agree. The scope is too great. Though the execve documentation is not quite the level of detail I am looking for, I found such information e.g. in the create_flat_tables() kernel function. I will edit my question
    – lte678
    CommentedJan 4, 2023 at 16:55

1 Answer 1

0

Unfortunately, it seems that process initialization is not present in the System V ABI Standard for the Armv8 platform (Source: ARM's published ABIs), despite being present in other versions of the standard.

It does appear to be a part of the standard though, and I was able to find the answers to the question in the AMD64 SystemV ABI, v0.99.

Summarizing the contents very briefly, process initialization consists of

  • Putting argc, argv and envp (and their data) on the stack
  • Floating point operations should be enabled
  • Register state is not relevant, except for the stack pointer (and in some cases the frame pointer and a pointer for atexit())

    You must log in to answer this question.

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.