about summary refs log tree commit diff stats
path: root/wow64
diff options
context:
space:
mode:
Diffstat (limited to 'wow64')
-rw-r--r--wow64/include/wine/compiler.h (renamed from wow64/compiler.h)22
-rw-r--r--wow64/wowbox64.c10
2 files changed, 17 insertions, 15 deletions
diff --git a/wow64/compiler.h b/wow64/include/wine/compiler.h
index eac844e5..f206c40d 100644
--- a/wow64/compiler.h
+++ b/wow64/include/wine/compiler.h
@@ -4,9 +4,9 @@
 #include <stdint.h>
 
 /* Things missing from mingw64 right now */
-#define ThreadWow64Context (29)
-#define WOW64_TLS_CPURESERVED (1)
-#define WOW64_TLS_MAX_NUMBER (19)
+#define ThreadWow64Context                 (29)
+#define WOW64_TLS_CPURESERVED              (1)
+#define WOW64_TLS_MAX_NUMBER               (19)
 #define WOW64_CPURESERVED_FLAG_RESET_STATE (1)
 
 typedef enum _MEMORY_INFORMATION_CLASS {
@@ -26,8 +26,7 @@ typedef enum _MEMORY_INFORMATION_CLASS {
     MemoryBadInformationAllProcesses,
 } MEMORY_INFORMATION_CLASS;
 
-typedef struct _WOW64_CPURESERVED
-{
+typedef struct _WOW64_CPURESERVED {
     USHORT Flags;
     USHORT Machine;
 } WOW64_CPURESERVED;
@@ -51,21 +50,22 @@ typedef struct _XMM_SAVE_AREA32 {
     BYTE  Reserved4[96];
 } XMM_SAVE_AREA32;
 
-#define NtCurrentProcess() ( (HANDLE)(LONG_PTR) -1 )
+#define NtCurrentProcess() ((HANDLE)(LONG_PTR) - 1)
 
-NTSTATUS WINAPI RtlWow64GetCurrentCpuArea(USHORT *, void **, void **);
-NTSTATUS  WINAPI Wow64SystemServiceEx(UINT, UINT*);
+NTSTATUS WINAPI RtlWow64GetCurrentCpuArea(USHORT*, void**, void**);
+NTSTATUS WINAPI Wow64SystemServiceEx(UINT, UINT*);
 NTSYSAPI NTSTATUS WINAPI LdrGetDllHandle(LPCWSTR, ULONG, const UNICODE_STRING*, HMODULE*);
 NTSYSAPI NTSTATUS WINAPI NtContinue(PCONTEXT, BOOLEAN);
 NTSYSAPI NTSTATUS WINAPI NtQueryVirtualMemory(HANDLE, LPCVOID, MEMORY_INFORMATION_CLASS, PVOID, SIZE_T, SIZE_T*);
 NTSYSAPI void* WINAPI RtlFindExportedRoutineByName(HMODULE, const char*);
 NTSYSAPI void DECLSPEC_NORETURN WINAPI RtlRaiseStatus(NTSTATUS);
+NTSYSAPI void WINAPI RtlRaiseException(EXCEPTION_RECORD*);
 
 static inline uintptr_t calculate_fs(void)
 {
-/* until mingw64 has WowTebOffset in the TEB struct */
-uint8_t* teb = (uint8_t*)NtCurrentTeb();
-return (uintptr_t)(teb + *(int32_t*)(teb + 0x180c));
+    /* until mingw64 has WowTebOffset in the TEB struct */
+    uint8_t* teb = (uint8_t*)NtCurrentTeb();
+    return (uintptr_t)(teb + *(int32_t*)(teb + 0x180c));
 }
 
 #endif //__COMPILER_H_
diff --git a/wow64/wowbox64.c b/wow64/wowbox64.c
index 0aa10a22..a985ef69 100644
--- a/wow64/wowbox64.c
+++ b/wow64/wowbox64.c
@@ -9,7 +9,6 @@
 #include <winternl.h>
 #include <winnt.h>
 
-#include "compiler.h"
 #include "debug.h"
 #include "os.h"
 #include "custommem.h"
@@ -22,6 +21,7 @@
 #include "box64cpu.h"
 #include "box64cpu_util.h"
 #include "rbtree.h"
+#include "wine/compiler.h"
 #include "wine/debug.h"
 
 uintptr_t box64_pagesize = 4096;
@@ -210,6 +210,8 @@ STATIC_ASSERT(offsetof(x64emu_t, win64_teb) == 3120, offset_of_b_must_be_4);
 
     printf_log(LOG_INFO, "libwowbox64.dll process initializing.\n");
 
+    PrintEnvVariables(&box64env, LOG_INFO);
+
     memset(bopcode, 0xc3, sizeof(bopcode));
     memset(unxcode, 0xc3, sizeof(unxcode));
     bopcode[0] = 0x2ecd;
@@ -346,7 +348,7 @@ NTSTATUS WINAPI BTCpuTurboThunkControl(ULONG enable)
     return STATUS_SUCCESS;
 }
 
-void x86IntImpl(x64emu_t *emu, int code)
+void EmitInterruptionImpl(x64emu_t *emu, int code)
 {
     int inst_off = box64env.dynarec ? 2 : 0;
 
@@ -429,10 +431,10 @@ static void __attribute__((naked)) SEHFrameTrampoline2Args(void* Arg0, int Arg1,
          ".seh_endproc" );
 }
 
-void x86Int(void* emu, int code)
+void EmitInterruption(x64emu_t* emu, int num, void* addr)
 {
     CONTEXT *entry_context = NtCurrentTeb()->TlsSlots[WOW64_TLS_MAX_NUMBER];
-    SEHFrameTrampoline2Args(emu, code, (void*)x86IntImpl, entry_context->Sp, entry_context->Pc);
+    SEHFrameTrampoline2Args(emu, num, (void*)EmitInterruptionImpl, entry_context->Sp, entry_context->Pc);
     NtCurrentTeb()->TlsSlots[WOW64_TLS_MAX_NUMBER] = entry_context;
 }