summaryrefslogtreecommitdiff
path: root/lang/mono/patches/patch-an
blob: eb306f05fba15faa621b7596f0880bbd4328a66a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$NetBSD: patch-an,v 1.2 2006/01/03 08:03:53 recht Exp $

--- mono/mini/exceptions-x86.c.orig	2005-09-15 13:21:13.000000000 +0200
+++ mono/mini/exceptions-x86.c
@@ -688,7 +688,17 @@ mono_arch_sigctx_to_monoctx (void *sigct
 	mctx->esi = ctx->uc_mcontext.mc_esi;
 	mctx->edi = ctx->uc_mcontext.mc_edi;
 	mctx->eip = ctx->uc_mcontext.mc_eip;
-#else
+#elif defined(__NetBSD__)
+        mctx->eax = ctx->uc_mcontext.__gregs[_REG_EAX];
+        mctx->ebx = ctx->uc_mcontext.__gregs[_REG_EBX];
+        mctx->ecx = ctx->uc_mcontext.__gregs[_REG_ECX];
+        mctx->edx = ctx->uc_mcontext.__gregs[_REG_EDX];
+        mctx->ebp = ctx->uc_mcontext.__gregs[_REG_EBP];
+        mctx->esp = ctx->uc_mcontext.__gregs[_REG_ESP];
+        mctx->esi = ctx->uc_mcontext.__gregs[_REG_ESI];
+        mctx->edi = ctx->uc_mcontext.__gregs[_REG_EDI];
+        mctx->eip = ctx->uc_mcontext.__gregs[_REG_EIP];
+#else 
 	mctx->eax = ctx->uc_mcontext.gregs [REG_EAX];
 	mctx->ebx = ctx->uc_mcontext.gregs [REG_EBX];
 	mctx->ecx = ctx->uc_mcontext.gregs [REG_ECX];
@@ -725,12 +735,21 @@ mono_arch_monoctx_to_sigctx (MonoContext
 	ctx->uc_mcontext.mc_ebx = mctx->ebx;
 	ctx->uc_mcontext.mc_ecx = mctx->ecx;
 	ctx->uc_mcontext.mc_edx = mctx->edx;
-	ctx->uc_mcontext.mc_ebp  = mctx->ebp;
+	ctx->uc_mcontext.mc_ebp = mctx->ebp;
 	ctx->uc_mcontext.mc_esp = mctx->esp;
 	ctx->uc_mcontext.mc_esi = mctx->esi;
 	ctx->uc_mcontext.mc_edi = mctx->edi;
 	ctx->uc_mcontext.mc_eip = mctx->eip;
-
+#elif defined(__NetBSD__)
+        ctx->uc_mcontext.__gregs[_REG_EAX] = mctx->eax;
+        ctx->uc_mcontext.__gregs[_REG_EBX] = mctx->ebx;
+        ctx->uc_mcontext.__gregs[_REG_ECX] = mctx->ecx;
+        ctx->uc_mcontext.__gregs[_REG_EDX] = mctx->edx;
+        ctx->uc_mcontext.__gregs[_REG_EBP] = mctx->ebp;
+        ctx->uc_mcontext.__gregs[_REG_ESP] = mctx->esp;
+        ctx->uc_mcontext.__gregs[_REG_ESI] = mctx->esi;
+        ctx->uc_mcontext.__gregs[_REG_EDI] = mctx->edi;
+        ctx->uc_mcontext.__gregs[_REG_EIP] = mctx->eip;
 #else
 	ctx->uc_mcontext.gregs [REG_EAX] = mctx->eax;
 	ctx->uc_mcontext.gregs [REG_EBX] = mctx->ebx;
@@ -764,6 +783,8 @@ mono_arch_ip_from_context (void *sigctx)
 	ucontext_t *ctx = (ucontext_t*)sigctx;
 #if defined(__FreeBSD__)
 	return (gpointer)ctx->uc_mcontext.mc_eip;
+#elif defined(__NetBSD__)
+	return (gpointer)ctx->uc_mcontext.__gregs[_REG_EIP];
 #else
 	return (gpointer)ctx->uc_mcontext.gregs [REG_EIP];
 #endif