Skip to main content
Engineering LibreTexts

16.3: Argument Count and Argument Vector Table

  • Page ID
    19962
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Since the operating system will call the main program as a function, the standard calling convention applies. The argument count and the argument vector address are passed as parameters in rdi and rsi in accordance with the standard calling convention. The first argument, in rdi, is the integer argument count. The second argument, in rsi, is the argument vector table address.

    The argument vector table is an array containing the quadword addresses of the string for each argument. Assuming the previous examples with 4 total arguments, the basic argument vector table layout is as follows:

    截屏2021-07-31 下午10.20.47.png

    Each string is NULL terminated by the operating system and will not contain a new line character.


    This page titled 16.3: Argument Count and Argument Vector Table is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Ed Jorgensen.