assembly - Calling C function from masm 64 -
i have problem assembly code (64 bit masm in visual 2013 on win8 64). when i'm calling c function (printf), throwing exception ntdll.dll. i'm doing wrong? how can read , write data console in 64 bit masm? can find tutorial masm 64 bit?
extrn printf : proc .data format byte "arg1: %d", 10, 0 .code printdata proc mov rbx, 100 push rbx lea rax, format; format address push rax call printf; throw unhandled exception ntdll.dll - access violation reading location 0xffffffffffffffff. add rsp, 16 ;2* 64bit value ret printdata endp end
p.s i'm calling printdata c++ code.
the 64-bit calling convention (https://msdn.microsoft.com/en-us/library/ms235286.aspx) requires pass arguments starting in rcx, followed rdx, r8 , r9 if needed. in case need rcx store address of format, , rdx integer value want print.
Comments
Post a Comment