![]() |
|
|
|
#1
|
|||
|
|||
|
Quote:
Could you show us correct syntax for inline assembler which will Intel C++ Compiler accept ? -- Jump |
| The Following User Says Thank You to jump For This Useful Post: | ||
Indigo (07-19-2019) | ||
|
#2
|
||||
|
||||
|
Quote:
__asm mov rbx, rax; or __asm { ... } emit format is: __asm __emit 0xCC; sample function: Code:
__declspec(naked) int __fastcall strcmpW(const wchar_t *s1, const wchar_t *s2)
{
__asm {
push rdi
push rsi
mov rdi, rdx
mov rsi, rcx
or rcx, -1
xor rax, rax
repne scasw
not rcx
mov rdi, rdx
repe cmpsw
xor rdx, rdx
mov ax, [rsi - 2]
mov dx, [rdi - 2]
sub rax, rdx
pop rsi
pop rdi
ret
}
}
|
| The Following 2 Users Gave Reputation+1 to Fyyre For This Useful Post: | ||
jump (04-09-2010) | ||
| The Following User Says Thank You to Fyyre For This Useful Post: | ||
Indigo (07-19-2019) | ||
|
#3
|
|||
|
|||
|
So if i understand correct, the inline assmbler have to be also x64 not x86,right?
So you cant tak source with inline x86 assembler and think it will be compileable for x64 architecture. You have to rewrite it, right? -- Jump |
| The Following User Says Thank You to jump For This Useful Post: | ||
Indigo (07-19-2019) | ||
|
#4
|
||||
|
||||
|
x86 or x64 depends upon your project (like Av0id said above).
Regarding re-writing of code, how big of task depends on the code itself... i.e. the above strcmpW function, he only require change of registers from e*x to r*x.... AFAIK the calling covention always __fastcall on X64, more simple than x86 assembly, imo. -Fyyre |
| The Following User Says Thank You to Fyyre For This Useful Post: | ||
Indigo (07-19-2019) | ||
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| inline patche | hp3 | Source Code | 3 | 06-04-2021 14:48 |
| How to inline x64 asm in vs2017 ? | Mahmoudnia | General Discussion | 25 | 07-22-2018 01:04 |
| Inline Patching | MaRKuS-DJM | General Discussion | 1 | 01-24-2004 23:03 |