我正在处理 x86 程序集中的函数调用和返回。我似乎无法让它在不崩溃的情况下运行。我从 bit_operations 调用函数 MIRROR_BYTE。但是每次我运行代码时,它都会出现未知错误和崩溃。它仅在我 MIRROR_BYTE 完成后才发生 在这里真的迷路了,感谢您的帮助。完整代码的网址
__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]
}
}