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 。 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