changeset 567:7fbf083f2a02

. Merge in changes from the BSD repository.
author glewis@misty.eyesbeyond.com
date Sun, 15 Feb 2009 14:28:37 -0800
parents 7365c027d8a1 9903b653fc98
children 60d170c9a338
files src/os/bsd/vm/os_bsd.cpp
diffstat 3 files changed, 52 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/bsd/vm/os_bsd.cpp	Sun Feb 15 14:27:47 2009 -0800
+++ b/src/os/bsd/vm/os_bsd.cpp	Sun Feb 15 14:28:37 2009 -0800
@@ -62,7 +62,7 @@
 # include <link.h>
 #endif
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 # include <elf.h>
 #endif
 
@@ -3274,7 +3274,7 @@
   return OS_OK;
 #elif defined(__FreeBSD__)
   int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__NetBSD__)
   struct sched_param sp;
   int policy;
   pthread_t self = pthread_self();
@@ -3302,7 +3302,7 @@
   errno = 0;
 #if defined(__OpenBSD__) || defined(__FreeBSD__)
   *priority_ptr = pthread_getprio(thread->osthread()->pthread_id());
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__NetBSD__)
   int policy;
   struct sched_param sp;
 
--- a/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp	Sun Feb 15 14:27:47 2009 -0800
+++ b/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp	Sun Feb 15 14:28:37 2009 -0800
@@ -39,6 +39,10 @@
 #    define bswap_16(x)	swap16(x)
 #    define bswap_32(x)	swap32(x)
 #    define bswap_64(x)	swap64(x)
+#  elif defined(__NetBSD__)
+#    define bswap_16(x)	bswap16(x)
+#    define bswap_32(x)	bswap32(x)
+#    define bswap_64(x)	bswap64(x)
 #  else
 #    define bswap_16(x) __bswap16(x)
 #    define bswap_32(x) __bswap32(x)
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Sun Feb 15 14:27:47 2009 -0800
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Sun Feb 15 14:28:37 2009 -0800
@@ -48,7 +48,7 @@
 # include <ucontext.h>
 #endif
 
-#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__)
+#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) && !defined(__NetBSD__)
 # include <pthread_np.h>
 #endif
 
@@ -196,6 +196,50 @@
 # endif
 #endif
 
+#ifdef __NetBSD__
+# define context_trapno uc_mcontext.__gregs[_REG_TRAPNO]
+# ifdef AMD64
+#  define __register_t __greg_t
+#  define context_pc uc_mcontext.__gregs[_REG_RIP]
+#  define context_sp uc_mcontext.__gregs[_REG_URSP]
+#  define context_fp uc_mcontext.__gregs[_REG_RBP]
+#  define context_rip uc_mcontext.__gregs[_REG_RIP]
+#  define context_rsp uc_mcontext.__gregs[_REG_URSP]
+#  define context_rax uc_mcontext.__gregs[_REG_RAX]
+#  define context_rbx uc_mcontext.__gregs[_REG_RBX]
+#  define context_rcx uc_mcontext.__gregs[_REG_RCX]
+#  define context_rdx uc_mcontext.__gregs[_REG_RDX]
+#  define context_rbp uc_mcontext.__gregs[_REG_RBP]
+#  define context_rsi uc_mcontext.__gregs[_REG_RSI]
+#  define context_rdi uc_mcontext.__gregs[_REG_RDI]
+#  define context_r8  uc_mcontext.__gregs[_REG_R8]
+#  define context_r9  uc_mcontext.__gregs[_REG_R9]
+#  define context_r10 uc_mcontext.__gregs[_REG_R10]
+#  define context_r11 uc_mcontext.__gregs[_REG_R11]
+#  define context_r12 uc_mcontext.__gregs[_REG_R12]
+#  define context_r13 uc_mcontext.__gregs[_REG_R13]
+#  define context_r14 uc_mcontext.__gregs[_REG_R14]
+#  define context_r15 uc_mcontext.__gregs[_REG_R15]
+#  define context_flags uc_mcontext.__gregs[_REG_RFL]
+#  define context_err uc_mcontext.__gregs[_REG_ERR]
+# else
+#  define context_pc uc_mcontext.__gregs[_REG_EIP]
+#  define context_sp uc_mcontext.__gregs[_REG_UESP]
+#  define context_fp uc_mcontext.__gregs[_REG_EBP]
+#  define context_eip uc_mcontext.__gregs[_REG_EIP]
+#  define context_esp uc_mcontext.__gregs[_REG_UESP]
+#  define context_eax uc_mcontext.__gregs[_REG_EAX]
+#  define context_ebx uc_mcontext.__gregs[_REG_EBX]
+#  define context_ecx uc_mcontext.__gregs[_REG_ECX]
+#  define context_edx uc_mcontext.__gregs[_REG_EDX]
+#  define context_ebp uc_mcontext.__gregs[_REG_EBP]
+#  define context_esi uc_mcontext.__gregs[_REG_ESI]
+#  define context_edi uc_mcontext.__gregs[_REG_EDI]
+#  define context_eflags uc_mcontext.__gregs[_REG_EFL]
+#  define context_trapno uc_mcontext.__gregs[_REG_TRAPNO]
+# endif
+#endif
+
 address os::current_stack_pointer() {
 #ifdef SPARC_WORKS
   register void *esp;