C ++ visual studio内联汇编我如何推送一个地址而不是它的值 [英] C++ visual studio inline assembly how do I push an address instead of the value of it

查看:104
本文介绍了C ++ visual studio内联汇编我如何推送一个地址而不是它的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Visual Studio 2013上使用内联asm推送地址,



mov [asd],0x80

推送asd



而不是推送地址,它推动了asd的值



我不知道怎么样为了克服这一点,任何帮助表示赞赏



我尝试过:



asd是地址,但是当我使用十六进制查看器进入内存区域时,push asd变为push [asd]



我不知道该尝试什么next

解决方案

这将取决于编译器,但对于GCC,它是:

 push 


asd



看到这里,它可能会有所帮助:在C / C ++中使用内联汇编 [ ^ ]

这取决于使用的汇编程序。使用Visual C / C ++使用的MASM语法,您必须使用 OFFSET 关键字:

推送OFFSET ASD 


I'm trying to push an address using inline asm on Visual Studio 2013,

mov [asd], 0x80
push asd

instead of pushing the address, it pushes the value of asd

I have no idea how to overcome this any help is appreciated

What I have tried:

asd is the address, but when i go to the memory region with a hex viewer the push asd turns into push [asd]

I have no idea what to try next

解决方案

It's going to depend on the compiler, but for GCC it's:

push


asd


See here, it might help: Using Inline Assembly in C/C++[^]


It depends on the used assembler. With MASM syntax which is used by Visual C/C++ you have to use the OFFSET keyword:

push OFFSET asd


这篇关于C ++ visual studio内联汇编我如何推送一个地址而不是它的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆