我正在進行函數調用並返回x86程序集。我似乎無法得到這個沒有崩潰。我正在從bit_operations調用函數MIRROR_BYTE。但每次運行代碼時,它都有未知的錯誤和崩潰。它只發生在我MIRROR_BYTE完成後真的失去了這裏,任何幫助表示讚賞。鏈接直接全碼x86彙編編程函數調用
__declspec(naked) void
bit_operations(unsigned long inputDWord, unsigned long *outputDWord)
{
__asm{
// start code for part B here
push eax
push ebx
mov ebx, [esp + 12]
push ebx //move inputDword into the stack
call MIRROR_BYTE
pop ebx //pop inputDword out of the stack
pop ebx
pop eax
// end code for part B here
ret
}
}
/*
This function takes 4 bytes as input and mirrors the value of Byte 4 (leftmost).
For example, for a byte like 10110111, the mirrored byte value is 11101101.
*/
__declspec(naked) unsigned long
MIRROR_BYTE(unsigned long inputDWord)
{
__asm{
// not sure what to do here just return dummy al from inputDword
mov al, byte ptr[esp +4]
}
}
這是可能的,讓我試試 – MobDev