mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-27 11:50:29 +00:00
Route Borland/Embarcadero into MS inline ASM code for CPUID
The inline ASM code now uses local variables to save the EAX-EDX registers, and then copies the locals into the function parameters. It side steps problems with calling conventions
This commit is contained in:
parent
7464cbba51
commit
da0dc66952
19
cpu.cpp
19
cpu.cpp
@ -123,24 +123,31 @@ extern "C"
|
||||
}
|
||||
#endif
|
||||
|
||||
// Embarcadero and Issue 498
|
||||
// Borland/Embarcadero and Issue 498
|
||||
// cpu.cpp (131): E2211 Inline assembly not allowed in inline and template functions
|
||||
bool CpuId(word32 func, word32 subfunc, word32 output[4])
|
||||
{
|
||||
#if defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY)
|
||||
#if defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) || defined(__BORLANDC__)
|
||||
__try
|
||||
{
|
||||
// Borland/Embarcadero and Issue 500
|
||||
// Local variables for cpuid output
|
||||
word32 a, b, c, d;
|
||||
__asm
|
||||
{
|
||||
mov eax, func
|
||||
mov ecx, subfunc
|
||||
cpuid
|
||||
mov edi, output
|
||||
mov [edi], eax
|
||||
mov [edi+4], ebx
|
||||
mov [edi+8], ecx
|
||||
mov [edi+12], edx
|
||||
mov [a], eax
|
||||
mov [b], ebx
|
||||
mov [c], ecx
|
||||
mov [d], edx
|
||||
}
|
||||
output[0] = a;
|
||||
output[1] = b;
|
||||
output[2] = c;
|
||||
output[3] = d;
|
||||
}
|
||||
// GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
|
Loading…
Reference in New Issue
Block a user