https://ru.wikibooks.org/wiki/Ассемблер_в_Linux_для_программистов_C

В этом учебнике не хватает раздела про передачу аргументов командной строки в параметры программы.

https://stackoverflow.com/questions/368 … n-assembly

AMD64 ABI Draft 0.99.7 – November 17, 2014

http://s8.uploads.ru/AtOKT.gif

Для x86:

All the arguments are sitting on the stack when the program starts, so all we need to do is pop them off.
The first value popped off is the number of arguments (called argc in C/C++), the second is the name of the program, and finally we get the actual command line arguments.
when we pop the command line argument off the stack, it actually puts the address of that string in EBX
This just took us an entire 3 instructions

_start:
  pop ebx; argc (argument count)
  pop ebx; argv[0] (argument 0, the program name)
  pop ebx; The first real arg, a filename

Отредактировано Лис (2018-11-02 11:11:15)