Apparently hg didnt revert correctly this time.

This commit is contained in:
Ben "root" Anderson
2013-10-25 19:15:45 -05:00
parent 1b60236147
commit d8cab4da7f
4 changed files with 24 additions and 25 deletions
+5 -5
View File
@@ -364,7 +364,7 @@ long __stdcall CrashHandler::ExceptionHandler( EXCEPTION_POINTERS *pExc )
int iSize = 1024*32;
char *pStack = (char *) VirtualAlloc( NULL, iSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE );
pStack += iSize;
SM_ASM_X86(mov esp, pStack);
_asm mov esp, pStack;
return MainExceptionHandler( pExc );
}
@@ -532,10 +532,10 @@ void CrashHandler::do_backtrace( const void **buf, size_t size,
static void NORETURN debug_crash()
{
__try {
SM_ASM_X86(xor ebx,ebx);
SM_ASM_X86(mov eax,dword ptr [ebx]);
// SM_ASM_X86(mov dword ptr [ebx],eax);
// SM_ASM_X86(lock add dword ptr cs:[00000000h], 12345678h);
__asm xor ebx,ebx
__asm mov eax,dword ptr [ebx]
// __asm mov dword ptr [ebx],eax
// __asm lock add dword ptr cs:[00000000h], 12345678h
} __except( CrashHandler::ExceptionHandler((EXCEPTION_POINTERS*)_exception_info()) ) {
}
}
+13 -7
View File
@@ -141,12 +141,15 @@ static inline int64_t llabs( int64_t i ) { return i >= 0? i: -i; }
// MinGW provides us with this function already
#if !defined(__MINGW32__)
#if defined(__GNUC__)
#error "MSVC asm syntax ahead"
#endif
inline long int lrintf( float f )
{
int retval;
SM_ASM_X86(fld f);
SM_ASM_X86(fistp retval);
_asm fld f;
_asm fistp retval;
return retval;
}
@@ -175,19 +178,21 @@ inline long int lrintf( float f )
inline uint32_t ArchSwap32( uint32_t n )
{
SM_ASM_X86(
__asm
{
mov eax, n
xchg al, ah
ror eax, 16
xchg al, ah
mov n, eax
);
};
return n;
}
inline uint32_t ArchSwap24( uint32_t n )
{
SM_ASM_X86(
__asm
{
mov eax, n
xchg al, ah
ror eax, 16
@@ -200,11 +205,12 @@ inline uint32_t ArchSwap24( uint32_t n )
inline uint16_t ArchSwap16( uint16_t n )
{
SM_ASM_X86(
__asm
{
mov ax, n
xchg al, ah
mov n, ax
);
};
return n;
}
#endif
+5 -1
View File
@@ -42,7 +42,11 @@ void NORETURN sm_crash( const char *reason )
#if defined(_WINDOWS)
/* Do something after the above, so the call/return isn't optimized to a jmp; that
* way, this function will appear in backtrace stack traces. */
SM_ASM_X86(nop)
#if defined(_MSC_VER)
_asm nop;
#elif defined(__GNUC__) // MinGW or similar
asm("nop");
#endif
#else
_exit( 1 );
#endif
+1 -12
View File
@@ -240,20 +240,9 @@ float roundf( float f ) { if( f < 0.0f ) return truncf( f-0.5f ); return truncf(
inline float strtof( const char *s, char **se ) { return (float) strtod( s, se ); }
#endif
// Compiler-agnostic macro for inline x86 assembly
#if defined(CPU_X86) || defined(CPU_X86_64)
#if defined(_MSC_VER)
// TESTME: is a single instruction legal for this syntax?
#define SM_ASM_X86(x) __asm { x }
#elif defined(__GNUC__)
#define SM_ASM_X86(x) __asm__("x")
#else
#error Inline assembly not implemented for your compiler.
#endif
/* Don't include our own headers here, since they tend to change often. */
#endif // GLOBAL_H
#endif
/**
* @file