about summary refs log tree commit diff stats
path: root/src/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/os')
-rw-r--r--src/os/emit_signal_wine.c54
-rw-r--r--src/os/os_wine.c8
2 files changed, 52 insertions, 10 deletions
diff --git a/src/os/emit_signal_wine.c b/src/os/emit_signal_wine.c
index 0539a818..ef0a0f65 100644
--- a/src/os/emit_signal_wine.c
+++ b/src/os/emit_signal_wine.c
@@ -1,22 +1,64 @@
+/*
+ * Copyright 2022-2025 André Zwing
+ * Copyright 2023 Alexandre Julliard
+ */
+#include <signal.h>
+#include <windows.h>
+#include <winternl.h>
+
 #include "x64emu.h"
+#include "debug.h"
 #include "custommem.h"
+#include "wine/compiler.h"
 
 void EmitSignal(x64emu_t* emu, int sig, void* addr, int code)
 {
-    // FIXME
+    EXCEPTION_RECORD rec;
+
+    switch (sig) {
+        case SIGILL:
+            printf_log(LOG_DEBUG, "SIGILL at %p with code %d\n", addr, code);
+            rec.ExceptionCode = STATUS_ILLEGAL_INSTRUCTION;
+            break;
+        case SIGSEGV:
+            printf_log(LOG_DEBUG, "SIGSEGV at %p with code %d\n", addr, code);
+            rec.ExceptionCode = STATUS_ACCESS_VIOLATION;
+            break;
+        default:
+            printf_log(LOG_INFO, "Warning, unknown signal %d at %p with code %d\n", sig, addr, code);
+            rec.ExceptionCode = STATUS_ACCESS_VIOLATION;
+            break;
+    }
+    rec.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
+    rec.ExceptionRecord = NULL;
+    rec.ExceptionAddress = addr;
+    rec.NumberParameters = 0;
+    RtlRaiseException(&rec);
 }
 
 void CheckExec(x64emu_t* emu, uintptr_t addr)
 {
-    // FIXME
 }
 
-void EmitInterruption(x64emu_t* emu, int num, void* addr)
+void EmitDiv0(x64emu_t* emu, void* addr, int code)
 {
-    // FIXME
+    EXCEPTION_RECORD rec;
+    rec.ExceptionCode = EXCEPTION_INT_DIVIDE_BY_ZERO;
+    rec.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
+    rec.ExceptionRecord = NULL;
+    rec.ExceptionAddress = addr;
+    rec.NumberParameters = 0;
+    RtlRaiseException(&rec);
 }
 
-void EmitDiv0(x64emu_t* emu, void* addr, int code)
+void EmuInt3(void* emu, void* addr)
 {
-    // FIXME
+    EXCEPTION_RECORD rec;
+
+    rec.ExceptionCode = STATUS_BREAKPOINT;
+    rec.ExceptionFlags = 0;
+    rec.ExceptionRecord = NULL;
+    rec.ExceptionAddress = addr;
+    rec.NumberParameters = 0;
+    RtlRaiseException(&rec);
 }
diff --git a/src/os/os_wine.c b/src/os/os_wine.c
index 937371c7..83be99b2 100644
--- a/src/os/os_wine.c
+++ b/src/os/os_wine.c
@@ -5,6 +5,7 @@
 #include <winternl.h>
 
 #include "os.h"
+#include "debug.h"
 #include "wine/debug.h"
 
 #define HandleToULong(h) ((ULONG)(ULONG_PTR)(h))
@@ -39,22 +40,21 @@ void* GetSeg43Base()
 
 void* GetSegmentBase(uint32_t desc)
 {
-    // FIXME
+    printf_log(LOG_NONE, "GetSegmentBase NYI\n");
     return NULL;
 }
 
-void EmuInt3(void* emu, void* addr) { }
 void* EmuFork(void* emu, int forktype) { return NULL; }
 
 
 void EmuX64Syscall(void* emu)
 {
-    // FIXME
+    printf_log(LOG_NONE, "EmuX64Syscall NYI\n");
 }
 
 void EmuX86Syscall(void* emu)
 {
-    // FIXME
+    printf_log(LOG_NONE, "EmuX86Syscall NYI\n");
 }
 
 const char* GetBridgeName(void* p)