hotspot changes for NetBSD
Christos Zoulas
christos at zoulas.com
Fri Feb 13 11:48:03 PST 2009
[I cannot commit, so someone please commit it]. This was lost when the
repository got reverted.
- Add NetBSD to the include the headers needed
- NetBSD specific swap macros.
- Add NetBSD specific register definitions
christos
diff -r 9f1dd0b1d28c src/os/bsd/vm/os_bsd.cpp
--- a/src/os/bsd/vm/os_bsd.cpp Wed Feb 11 21:21:45 2009 -0800
+++ b/src/os/bsd/vm/os_bsd.cpp Fri Feb 13 14:42:55 2009 -0500
@@ -62,7 +62,7 @@
# include <link.h>
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
# include <elf.h>
#endif
@@ -3268,7 +3268,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();
@@ -3296,7 +3296,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;
diff -r 9f1dd0b1d28c src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp
--- a/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp Wed Feb 11 21:21:45 2009 -0800
+++ b/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp Fri Feb 13 14:42:55 2009 -0500
@@ -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)
diff -r 9f1dd0b1d28c src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Wed Feb 11 21:21:45 2009 -0800
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Fri Feb 13 14:42:55 2009 -0500
@@ -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;
More information about the bsd-port-dev
mailing list