Moving contents of RAX to C variable (x86-64 asm)

北城余情 提交于 2019-12-25 01:53:38

问题


This is a rather naive question. I'm just playing around with allocating some executable memory and manually assembling some x86 code to run in it. I'm a bit confused by how addressing works in 64-bit mode. If I have a variable in my C code, and I want to move the contents of RAX into this variable, which form of the MOV instruction should I use? (This isn't using inline assembly, so I can't get the compiler to do it for me; I just have the value of &var to play with.)


回答1:


Using Intel syntax, it will be something like mov [var],rax, where var is basically the 64-bit immediate address.

I think this what Intel call MOV moffs64*,RAX in "Intel® 64 and IA-32 Architectures Software Developer’s Manual".



来源:https://stackoverflow.com/questions/4318816/moving-contents-of-rax-to-c-variable-x86-64-asm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!