I have following code:
[bits 64]
%define msg db "%i\n", 0xa, 0
%define var -4
mov r8, rsp
mov [r8+(var)], WORD 0xFFFF
push WORD [r8+(var)] ; not works
; if trying to push DWORD its shows error instruction not supported in 64 bit asm
push DWORD 0xFFFF ; works
call tCtAKBWomJ
msg
tCtAKBWomJ:
call [rbx+3*8]
add rsp, 8
push 0
call [rbx]
call [rbx + x * 8]
is call to asmloader api
x = 0, exit
x = 3, printf
etc.
i want to move value to "variable" and push it to stack.
EDIT:
[bits 64]
; const
%define msg db "%i", 0xa, 0
; vars offsets
%define var 8
; vars address
mov r8, rsp
; set var to 0xFFFF
mov DWORD [r8+(var)], 0xFFFF
; push var
push QWORD [r8+(var)]
; push const string msg
call tCtAKBWomJ
msg
tCtAKBWomJ:
; call printf
call [rbx+3*8]
add rsp, 8
; exit
push 0
call [rbx]
"variable offset" should be + value, not -.
and i should use
push QWORD