added argv and argc interaction

This commit is contained in:
IgorCielniak
2025-12-25 22:37:04 +01:00
parent f76ef276e9
commit 7d6c1fb0d3
3 changed files with 72 additions and 0 deletions

11
main.py
View File

@@ -1754,7 +1754,18 @@ class Assembler:
"%define RSTK_BYTES 65536",
"%define PRINT_BUF_BYTES 128",
"global _start",
"global argc",
"global argv",
"section .data",
"argc: dq 0",
"argv: dq 0",
"section .text",
"_start:",
" ; Linux x86-64 startup: argc/argv from stack",
" mov rdi, [rsp]", # argc
" lea rsi, [rsp+8]", # argv
" mov [rel argc], rdi",
" mov [rel argv], rsi",
" ; initialize data/return stack pointers",
" lea r12, [rel dstack_top]",
" mov r15, r12",