C ++ visual studio内联汇编如何调用地址 [英] C++ visual studio inline assembly how do I call an address

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

问题描述

我遇到的问题是我正在尝试在Inline Asm中执行以下操作



asd是地址



调用asd



在十六进制编辑器中查看时,它会写入call dword ptr asd



我很遗失



我尝试了什么:



到目前为止我在内联装配中尝试过使用两件东西



呼叫偏移量asd



打电话给asd



两个都没有工作,我错过了什么,我无法弄清楚如何去做这个

The problem that i'm having is that I'm trying to do the following in Inline Asm

asd is the address

"call asd"

When viewing it in a hex editor it writes "call dword ptr asd"

I'm quite lost

What I have tried:

I've tried using two things so far in the inline assembly

"call offset asd"

"call asd"

Neither work, I'm missing something and I cant figure out how to go about this

推荐答案

当我不确定汇编代码指令时,我用C或C ++编写一段代码,然后查看汇编代码清单。我这样做了。这段代码有一个简单的函数和一个调用它的指针。这是汇编代码清单:
When I am uncertain about the assembly code instructions, I write a snippet of code in C or C++ and then look at the assembly code listing. I did that with this. This code has a simple function and a pointer to it which is called. Here is the assembly code listing :
?DoFunctionTest@@YAXXZ PROC				; DoFunctionTest
; 237  : {


LN3:
push rdi
sub rsp, 64 ; 00000040H
mov rdi,rsp
mov ecx, 16
mov eax, - 858993460 ; ccccccccH
rep stosd

; 238 double x = 16 。< span class =code-digit> 612
;

movsd xmm0,QWORD PTR __real @ 40309cac083126e9
movsd QWORD PTR x
LN3: push rdi sub rsp, 64 ; 00000040H mov rdi, rsp mov ecx, 16 mov eax, -858993460 ; ccccccccH rep stosd ; 238 : double x = 16.612; movsd xmm0, QWORD PTR __real@40309cac083126e9 movsd QWORD PTR x


[rsp],xmm0

; 239 :dblfunc df = factor; // factor是函数,df是指向它的指针

lea rax,OFFSET FLAT:?fac @@ YANN @ Z; fac
mov QWORD PTR df
[rsp], xmm0 ; 239 : dblfunc df = factor; // factor is the function, df is a pointer to it lea rax, OFFSET FLAT:?fac@@YANN@Z ; fac mov QWORD PTR df


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

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