I have following C++ function with inline assembly:
void getMemAddrFromBIOSbySMI(int& bResult, unsigned long& addr,unsigned long& dataLength){
__asm {
mov eax, 0x000000E3
mov ebx, 0x00000001
mov ecx, 0xFAFAFAFA
mov edx, 0x000000B2
out dx,al
mov bResult, eax
mov addr, ebx
mov dataLength, ecx
}
if((bResult & 0x000000FF) == 0){
bReSult = 1;
}
else {
bResult = 0;
}
}
I want to let this code can support x64, but VC++ x64 have no support inline assembly, I have no idea how to translate this code to x64 assembly format...
Have anybody can help me?
You can use the compiler intrinsic __outbyte to write to a port.
You can use __asm _emit
to encode x64 instructions. Additionally, since on x64 the parameters come via registers RCX and RDX need to be saved before the MOVs, then restored when accessing the parameters.
User contributions licensed under CC BY-SA 3.0