[Mono-bugs] [Bug 447454] New: [PATCH] Two NetBSD patches
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Nov 21 03:24:07 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=447454
Summary: [PATCH] Two NetBSD patches
Product: Mono: Compilers
Version: 2.0.x
Platform: x86-64
OS/Version: NetBSD
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: kefren at ngnetworks.ro
QAContact: mono-bugs at lists.ximian.com
Found By: Other
NetBSD/amd64 __greg_t indexes patch:
--- mono/mini/mini-amd64.h.orig 2008-09-02 18:42:54.000000000 +0300
+++ mono/mini/mini-amd64.h 2008-11-21 09:42:31.000000000 +0200
@@ -229,7 +229,29 @@
#endif /* PLATFORM_WIN32 */
-#ifdef __FreeBSD__
+#if defined (__NetBSD__)
+
+#define REG_RAX 14
+#define REG_RCX 3
+#define REG_RDX 2
+#define REG_RBX 13
+#define REG_RSP 24
+#define REG_RBP 12
+#define REG_RSI 1
+#define REG_RDI 0
+#define REG_R8 4
+#define REG_R9 5
+#define REG_R10 6
+#define REG_R11 7
+#define REG_R12 8
+#define REG_R13 9
+#define REG_R14 10
+#define REG_R15 11
+#define REG_RIP 21
+
+#define MONO_ARCH_NOMAP32BIT
+
+#elif defined (__FreeBSD__)
#define REG_RAX 7
#define REG_RCX 4
----------------------
Interlocked* primitives implemented via atomic functions:
--- mono/io-layer/atomic.h.orig 2008-07-01 20:50:32.000000000 +0300
+++ mono/io-layer/atomic.h 2008-11-19 11:37:19.000000000 +0200
@@ -10,11 +10,61 @@
#ifndef _WAPI_ATOMIC_H_
#define _WAPI_ATOMIC_H_
+#if defined(__NetBSD__)
+#include <sys/param.h>
+
+#if __NetBSD_Version__ > 499004000
+#include <sys/atomic.h>
+#define HAVE_ATOMIC_OPS
+#endif
+
+#endif
+
#include <glib.h>
#include "mono/io-layer/wapi.h"
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__NetBSD__) && defined(HAVE_ATOMIC_OPS)
+
+#define WAPI_ATOMIC_ASM
+static inline gint32 InterlockedCompareExchange(volatile gint32 *dest,
+ gint32 exch, gint32 comp)
+{
+ return atomic_cas_32((uint32_t*)dest, comp, exch);
+}
+
+static inline gpointer InterlockedCompareExchangePointer(volatile gpointer
*dest, gpointer exch, gpointer comp)
+{
+ return atomic_cas_ptr(dest, comp, exch);
+}
+
+static inline gint32 InterlockedIncrement(volatile gint32 *val)
+{
+ return atomic_inc_32_nv((uint32_t*)val);
+}
+
+static inline gint32 InterlockedDecrement(volatile gint32 *val)
+{
+ return atomic_dec_32_nv((uint32_t*)val);
+}
+
+static inline gint32 InterlockedExchange(volatile gint32 *val, gint32 new_val)
+{
+ return atomic_swap_32((uint32_t*)val, new_val);
+}
+
+static inline gpointer InterlockedExchangePointer(volatile gpointer *val,
+ gpointer new_val)
+{
+ return atomic_swap_ptr(val, new_val);
+}
+
+static inline gint32 InterlockedExchangeAdd(volatile gint32 *val, gint32 add)
+{
+ return atomic_add_32_nv((uint32_t*)val, add) - add;
+}
+
+#elif defined(__i386__) || defined(__x86_64__)
#define WAPI_ATOMIC_ASM
/*
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list