From 13df062d3686a9b1961f0877aa8aaccd1fdc7332 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 6 Jan 2009 20:29:28 +0100 Subject: [PATCH] kernel32: #ifdef out some code that is not needed on non-i386. --- dlls/kernel32/instr.c | 4 +++ dlls/kernel32/kernel32.spec | 48 ++++++++++++++++++------------------ dlls/kernel32/relay16.c | 25 ++----------------- dlls/kernel32/thunk.c | 44 +++------------------------------ dlls/kernel32/utthunk.c | 4 +++ dlls/ntoskrnl.exe/ntoskrnl.c | 10 +++++--- 6 files changed, 45 insertions(+), 90 deletions(-) diff --git a/dlls/kernel32/instr.c b/dlls/kernel32/instr.c index 73edf7b756d..7fdc4cd6cab 100644 --- a/dlls/kernel32/instr.c +++ b/dlls/kernel32/instr.c @@ -23,6 +23,8 @@ #include "config.h" #include "wine/port.h" +#ifdef __i386__ + #include #include "windef.h" @@ -928,3 +930,5 @@ FARPROC16 WINAPI GetSetKernelDOSProc16( FARPROC16 DosProc ) FIXME("(DosProc=%p): stub\n", DosProc); return NULL; } + +#endif /* __i386__ */ diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 32e352361c5..d02f6e3b753 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -40,27 +40,27 @@ 30 stdcall -noname GlobalUnWire16(long) 31 stdcall -noname GlobalFree16(long) 32 stdcall -noname GlobalSize16(long) - 33 stdcall -noname HouseCleanLogicallyDeadHandles() - 34 stdcall -noname GetWin16DOSEnv() + 33 stdcall -noname -i386 HouseCleanLogicallyDeadHandles() + 34 stdcall -noname -i386 GetWin16DOSEnv() 35 stdcall -noname LoadLibrary16(str) 36 stdcall -noname FreeLibrary16(long) 37 stdcall -noname GetProcAddress16(long str) WIN32_GetProcAddress16 38 stdcall -noname -i386 -register AllocMappedBuffer() 39 stdcall -noname -i386 -register FreeMappedBuffer() 40 stdcall -noname -i386 -register OT_32ThkLSF() - 41 stdcall -noname ThunkInitLSF(long str long str str) + 41 stdcall -noname -i386 ThunkInitLSF(long str long str str) 42 stdcall -noname -i386 -register LogApiThkLSF(str) - 43 stdcall -noname ThunkInitLS(long str long str str) + 43 stdcall -noname -i386 ThunkInitLS(long str long str str) 44 stdcall -noname -i386 -register LogApiThkSL(str) 45 stdcall -noname -i386 -register Common32ThkLS() - 46 stdcall -noname ThunkInitSL(long str long str str) + 46 stdcall -noname -i386 ThunkInitSL(long str long str str) 47 stdcall -noname -i386 -register LogCBThkSL(str) 48 stdcall -noname ReleaseThunkLock(ptr) 49 stdcall -noname RestoreThunkLock(long) 51 stdcall -noname -i386 -register W32S_BackTo32() - 52 stdcall -noname GetThunkBuff() - 53 stdcall -noname GetThunkStuff(str str) + 52 stdcall -noname -i386 GetThunkBuff() + 53 stdcall -noname -i386 GetThunkStuff(str str) 54 stdcall -noname K32WOWCallback16(long long) 55 stdcall -noname K32WOWCallback16Ex(ptr long long ptr ptr) 56 stdcall -noname K32WOWGetVDMPointer(long long long) @@ -94,20 +94,20 @@ 84 stdcall -noname -ret64 K32RtlConvertLongToLargeInteger(long) ntdll.RtlConvertLongToLargeInteger 85 stdcall -noname -ret64 K32RtlConvertUlongToLargeInteger(long) ntdll.RtlConvertUlongToLargeInteger 86 stdcall @(ptr) _KERNEL32_86 - 87 stdcall -noname SSOnBigStack() - 88 varargs -noname SSCall(long long ptr) + 87 stdcall -noname -i386 SSOnBigStack() + 88 varargs -noname -i386 SSCall(long long ptr) 89 stdcall -noname -i386 -register FT_PrologPrime() 90 stdcall -noname -i386 -register QT_ThunkPrime() - 91 stdcall -noname PK16FNF(ptr) - 92 stdcall -noname GetPK16SysVar() + 91 stdcall -noname -i386 PK16FNF(ptr) + 92 stdcall -noname -i386 GetPK16SysVar() 93 stdcall -noname GetpWin16Lock(ptr) 94 stdcall -noname _CheckNotSysLevel(ptr) 95 stdcall -noname _ConfirmSysLevel(ptr) 96 stdcall -noname _ConfirmWin16Lock() 97 stdcall -noname _EnterSysLevel(ptr) 98 stdcall -noname _LeaveSysLevel(ptr) - 99 stdcall @(long) _KERNEL32_99 -100 stdcall @(long long long) _KERNEL32_100 + 99 stdcall -i386 @(long) _KERNEL32_99 +100 stdcall -i386 @(long long long) _KERNEL32_100 101 stub @ 102 stub @ 103 stub @ @@ -143,8 +143,8 @@ @ stdcall AddRefActCtx(ptr) @ stdcall AddVectoredExceptionHandler(long ptr) ntdll.RtlAddVectoredExceptionHandler @ stdcall AllocConsole() -@ stub AllocLSCallback -@ stdcall AllocSLCallback(ptr ptr) +@ stub -i386 AllocLSCallback +@ stdcall -i386 AllocSLCallback(ptr ptr) @ stub AllocateUserPhysicalPages @ stdcall AreFileApisANSI() @ stdcall AssignProcessToJobObject(ptr ptr) @@ -415,11 +415,11 @@ @ stdcall FreeLibrary(long) @ stdcall FreeLibraryAndExitThread(long long) @ stdcall FreeResource(long) -@ stdcall FreeSLCallback(long) +@ stdcall -i386 FreeSLCallback(long) @ stub FreeUserPhysicalPages @ stub FreeVirtualBuffer @ stdcall GenerateConsoleCtrlEvent(long long) -@ stdcall Get16DLLAddress(long str) +@ stdcall -i386 Get16DLLAddress(long str) @ stdcall GetACP() @ stdcall GetAtomNameA(long ptr long) @ stdcall GetAtomNameW(long ptr long) @@ -1082,7 +1082,7 @@ @ stdcall TermsrvAppInstallMode() @ stdcall Thread32First(long ptr) @ stdcall Thread32Next(long ptr) -@ stdcall ThunkConnect32(ptr str str str ptr ptr) +@ stdcall -i386 ThunkConnect32(ptr str str str ptr ptr) @ stdcall TlsAlloc() @ stub TlsAllocInternal @ stdcall TlsFree(long) @@ -1095,8 +1095,8 @@ @ stub TrimVirtualBuffer @ stdcall TryEnterCriticalSection(ptr) ntdll.RtlTryEnterCriticalSection @ stdcall TzSpecificLocalTimeToSystemTime(ptr ptr ptr) -@ stdcall UTRegister(long str str str ptr ptr ptr) -@ stdcall UTUnRegister(long) +@ stdcall -i386 UTRegister(long str str str ptr ptr ptr) +@ stdcall -i386 UTUnRegister(long) @ stdcall UnMapLS(long) @ stdcall -i386 -norelay UnMapSLFixArray(long long) @ stdcall UnhandledExceptionFilter(ptr) @@ -1251,10 +1251,10 @@ # or 'wine_' (for user-visible functions) to avoid namespace conflicts. # 16-bit relays -@ cdecl __wine_dll_register_16(ptr str) -@ cdecl __wine_dll_unregister_16(ptr) -@ varargs -private __wine_call_from_16_regs() -@ cdecl __wine_emulate_instruction(ptr ptr) +@ cdecl -i386 __wine_dll_register_16(ptr str) +@ cdecl -i386 __wine_dll_unregister_16(ptr) +@ varargs -i386 -private __wine_call_from_16_regs() +@ cdecl -i386 __wine_emulate_instruction(ptr ptr) # Unix files @ cdecl wine_get_unix_file_name(wstr) diff --git a/dlls/kernel32/relay16.c b/dlls/kernel32/relay16.c index e34eb367679..a2a550cc23f 100644 --- a/dlls/kernel32/relay16.c +++ b/dlls/kernel32/relay16.c @@ -20,6 +20,8 @@ #include "config.h" #include "wine/port.h" +#ifdef __i386__ + #include #include #include @@ -38,8 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(relay); -#ifdef __i386__ - static const WCHAR **debug_relay_excludelist; static const WCHAR **debug_relay_includelist; static const WCHAR **debug_snoop_excludelist; @@ -569,25 +569,4 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT86 *con return ret_val; } -#else /* __i386__ */ - -/* - * Stubs for the CallTo16/CallFrom16 routines on non-Intel architectures - * (these will never be called but need to be present to satisfy the linker ...) - */ - -/*********************************************************************** - * __wine_call_from_16_regs (KERNEL32.@) - */ -void __wine_call_from_16_regs(void) -{ - assert( FALSE ); -} - -DWORD WINAPI CALL32_CBClient( FARPROC proc, LPWORD args, DWORD *esi ) -{ assert( FALSE ); } - -DWORD WINAPI CALL32_CBClientEx( FARPROC proc, LPWORD args, DWORD *esi, INT *nArgs ) -{ assert( FALSE ); } - #endif /* __i386__ */ diff --git a/dlls/kernel32/thunk.c b/dlls/kernel32/thunk.c index 6e9b59d06d0..1f946979349 100644 --- a/dlls/kernel32/thunk.c +++ b/dlls/kernel32/thunk.c @@ -31,6 +31,8 @@ # include #endif +#ifdef __i386__ + #include "windef.h" #include "winbase.h" #include "winerror.h" @@ -147,11 +149,7 @@ struct SLApiDB SEGPTR CALL32_CBClient_RetAddr = 0; SEGPTR CALL32_CBClientEx_RetAddr = 0; -#ifdef __i386__ extern void __wine_call_from_16_thunk(); -#else -static void __wine_call_from_16_thunk() { } -#endif /* Push a DWORD on the 32-bit stack */ static inline void stack32_push( CONTEXT86 *context, DWORD val ) @@ -191,9 +189,7 @@ void WINAPI __regs_LogApiThkLSF( LPSTR func, CONTEXT86 *context ) { TRACE( "%s\n", debugstr_a(func) ); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( LogApiThkLSF, 1 ) -#endif /*********************************************************************** * LogApiThkSL (KERNEL32.44) @@ -204,9 +200,7 @@ void WINAPI __regs_LogApiThkSL( LPSTR func, CONTEXT86 *context ) { TRACE( "%s\n", debugstr_a(func) ); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( LogApiThkSL, 1 ) -#endif /*********************************************************************** * LogCBThkSL (KERNEL32.47) @@ -217,9 +211,7 @@ void WINAPI __regs_LogCBThkSL( LPSTR func, CONTEXT86 *context ) { TRACE( "%s\n", debugstr_a(func) ); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( LogCBThkSL, 1 ) -#endif /*********************************************************************** * Generates a FT_Prolog call. @@ -486,9 +478,7 @@ void WINAPI __regs_QT_Thunk( CONTEXT86 *context ) context->Esp += LOWORD(context16.Esp) - ( OFFSETOF(NtCurrentTeb()->WOW32Reserved) - argsize ); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( QT_Thunk, 0 ) -#endif /********************************************************************** @@ -554,9 +544,7 @@ void WINAPI __regs_FT_Prolog( CONTEXT86 *context ) *(DWORD *)(context->Ebp - 48) = context->Eax; *(DWORD *)(context->Ebp - 52) = context->Edx; } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( FT_Prolog, 0 ) -#endif /********************************************************************** * FT_Thunk (KERNEL32.@) @@ -622,11 +610,7 @@ void WINAPI __regs_FT_Thunk( CONTEXT86 *context ) /* Copy modified buffers back to 32-bit stack */ memcpy( oldstack, newstack, argsize ); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( FT_Thunk, 0 ) -#endif - -#ifdef __i386__ /*********************************************************************** * FT_Exit0 (KERNEL32.@) @@ -679,8 +663,6 @@ DEFINE_FT_Exit(48) DEFINE_FT_Exit(52) DEFINE_FT_Exit(56) -#endif /* __i386__ */ - /*********************************************************************** * ThunkInitLS (KERNEL32.43) @@ -778,9 +760,7 @@ void WINAPI __regs_Common32ThkLS( CONTEXT86 *context ) /* Clean up caller's stack frame */ context->Esp += LOBYTE(context16.Ebx); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( Common32ThkLS, 0 ) -#endif /*********************************************************************** * OT_32ThkLSF (KERNEL32.40) @@ -835,9 +815,7 @@ void WINAPI __regs_OT_32ThkLSF( CONTEXT86 *context ) context->Esp += LOWORD(context16.Esp) - ( OFFSETOF(NtCurrentTeb()->WOW32Reserved) - argsize ); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( OT_32ThkLSF, 0 ) -#endif /*********************************************************************** * ThunkInitLSF (KERNEL32.41) @@ -937,9 +915,7 @@ void WINAPI __regs_FT_PrologPrime( CONTEXT86 *context ) /* Jump to the call stub just created */ context->Eip = (DWORD)relayCode; } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( FT_PrologPrime, 0 ) -#endif /*********************************************************************** * QT_ThunkPrime (KERNEL32.90) @@ -969,9 +945,7 @@ void WINAPI __regs_QT_ThunkPrime( CONTEXT86 *context ) /* Jump to the call stub just created */ context->Eip = (DWORD)relayCode; } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( QT_ThunkPrime, 0 ) -#endif /*********************************************************************** * ThunkInitSL (KERNEL32.46) @@ -1112,9 +1086,7 @@ void WINAPI __regs_W32S_BackTo32( CONTEXT86 *context ) context->Eip = stack32_pop(context); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( W32S_BackTo32, 0 ) -#endif /********************************************************************** * AllocSLCallback (KERNEL32.@) @@ -1229,9 +1201,7 @@ void WINAPI __regs_AllocMappedBuffer( context->Edi = (DWORD)(buffer + 2); } } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( AllocMappedBuffer, 0 ) -#endif /********************************************************************** * FreeMappedBuffer (KERNEL32.39) @@ -1254,9 +1224,7 @@ void WINAPI __regs_FreeMappedBuffer( GlobalFree((HGLOBAL)buffer[0]); } } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( FreeMappedBuffer, 0 ) -#endif /********************************************************************** * GetTEBSelectorFS (KERNEL.475) @@ -1362,9 +1330,7 @@ void WINAPI __regs_K32Thk1632Prolog( CONTEXT86 *context ) been called. Thus we re-use it to hold the Win16Lock count */ ReleaseThunkLock(&CURRENT_STACK16->entry_point); } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( K32Thk1632Prolog, 0 ) -#endif /*********************************************************************** * K32Thk1632Epilog (KERNEL32.@) @@ -1399,9 +1365,7 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT86 *context ) context->Ebp, context->Esp, NtCurrentTeb()->WOW32Reserved); } } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( K32Thk1632Epilog, 0 ) -#endif /********************************************************************* * PK16FNF [KERNEL32.91] @@ -2211,9 +2175,7 @@ void WINAPI __regs_CommonUnimpStub( CONTEXT86 *context ) context->Esp += (context->Ecx & 0x0f) * 4; } -#ifdef DEFINE_REGS_ENTRYPOINT DEFINE_REGS_ENTRYPOINT( CommonUnimpStub, 0 ) -#endif /********************************************************************** * HouseCleanLogicallyDeadHandles (KERNEL32.33) @@ -2556,3 +2518,5 @@ DWORD WINAPIV WOW16Call(WORD x, WORD y, WORD z, VA_LIST16 args) DPRINTF(") calling address was 0x%08x\n",calladdr); return 0; } + +#endif /* __i386__ */ diff --git a/dlls/kernel32/utthunk.c b/dlls/kernel32/utthunk.c index a1889fa3502..d3333a2225c 100644 --- a/dlls/kernel32/utthunk.c +++ b/dlls/kernel32/utthunk.c @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifdef __i386__ + #include #include "wine/winbase16.h" @@ -323,3 +325,5 @@ WORD WINAPI UTInit16( DWORD x1, DWORD x2, DWORD x3, DWORD x4 ) FIXME("(%08x, %08x, %08x, %08x): stub\n", x1, x2, x3, x4 ); return 0; } + +#endif /* __i386__ */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index f6d7d1e7011..d27014f7d79 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -117,16 +117,20 @@ static HANDLE get_device_manager(void) /* exception handler for emulation of privileged instructions */ static LONG CALLBACK vectored_handler( EXCEPTION_POINTERS *ptrs ) { - extern DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT86 *context ); - EXCEPTION_RECORD *record = ptrs->ExceptionRecord; - CONTEXT86 *context = ptrs->ContextRecord; + CONTEXT *context = ptrs->ContextRecord; if (record->ExceptionCode == EXCEPTION_ACCESS_VIOLATION || record->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION) { +#ifdef __i386__ + extern DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context ); + if (__wine_emulate_instruction( record, context ) == ExceptionContinueExecution) return EXCEPTION_CONTINUE_EXECUTION; +#else + FIXME( "Privileged instruction emulation not implemented on this CPU\n" ); +#endif } return EXCEPTION_CONTINUE_SEARCH; }