98 lines
3.2 KiB
Plaintext
98 lines
3.2 KiB
Plaintext
$NetBSD: patch-aa,v 1.9 2013/06/15 09:31:05 jperkin Exp $
|
|
|
|
DragonFly support.
|
|
|
|
--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig 2013-05-29 03:57:57.000000000 +0000
|
|
+++ hotspot/src/os/bsd/vm/os_bsd.cpp
|
|
@@ -131,8 +131,11 @@
|
|
# include <inttypes.h>
|
|
# include <sys/ioctl.h>
|
|
|
|
-#if defined(__FreeBSD__) || defined(__NetBSD__)
|
|
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
|
|
# include <elf.h>
|
|
+#if !defined(EM_ALPHA)
|
|
+#define EM_ALPHA 0x9026
|
|
+#endif
|
|
#endif
|
|
|
|
#ifdef __APPLE__
|
|
@@ -342,7 +345,12 @@ void os::Bsd::initialize_system_info() {
|
|
int mib[2];
|
|
size_t len;
|
|
int cpu_val;
|
|
+#ifdef HW_USERMEM64
|
|
+ uint64_t mem_val;
|
|
+#else
|
|
u_long mem_val;
|
|
+#endif
|
|
+ struct rlimit limits;
|
|
|
|
/* get processors count via hw.ncpus sysctl */
|
|
mib[0] = CTL_HW;
|
|
@@ -359,21 +367,26 @@ void os::Bsd::initialize_system_info() {
|
|
* instead of hw.physmem because we need size of allocatable memory
|
|
*/
|
|
mib[0] = CTL_HW;
|
|
+#ifdef HW_USERMEM64
|
|
+ mib[1] = HW_USERMEM64;
|
|
+#else
|
|
mib[1] = HW_USERMEM;
|
|
+#endif
|
|
len = sizeof(mem_val);
|
|
- if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1)
|
|
+ if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1) {
|
|
_physical_memory = mem_val;
|
|
- else
|
|
+#ifdef HW_USERMEM64
|
|
+ if (_physical_memory < mem_val)
|
|
+ _physical_memory = (julong)-1;
|
|
+#endif
|
|
+ } else
|
|
_physical_memory = 256*1024*1024; // fallback (XXXBSD?)
|
|
|
|
-#ifdef __OpenBSD__
|
|
- {
|
|
- // limit _physical_memory memory view on OpenBSD since
|
|
- // datasize rlimit restricts us anyway.
|
|
- struct rlimit limits;
|
|
- getrlimit(RLIMIT_DATA, &limits);
|
|
- _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur);
|
|
- }
|
|
+ getrlimit(RLIMIT_DATA, &limits);
|
|
+ _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur);
|
|
+#if defined(RLIMIT_AS)
|
|
+ getrlimit(RLIMIT_AS, &limits);
|
|
+ _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur);
|
|
#endif
|
|
}
|
|
#else
|
|
@@ -2165,7 +2178,9 @@ void * os::dll_load(const char *filename
|
|
{EM_PPC, EM_PPC, ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"},
|
|
{EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},
|
|
{EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"},
|
|
+#if 0
|
|
{EM_S390, EM_S390, ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"},
|
|
+#endif
|
|
{EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
|
|
{EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"},
|
|
{EM_MIPS, EM_MIPS, ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"},
|
|
@@ -3668,7 +3683,7 @@ OSReturn os::set_native_priority(Thread*
|
|
#ifdef __OpenBSD__
|
|
// OpenBSD pthread_setprio starves low priority threads
|
|
return OS_OK;
|
|
-#elif defined(__FreeBSD__)
|
|
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
|
int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri);
|
|
#elif defined(__APPLE__) || defined(__NetBSD__)
|
|
struct sched_param sp;
|
|
@@ -3696,7 +3711,7 @@ OSReturn os::get_native_priority(const T
|
|
}
|
|
|
|
errno = 0;
|
|
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
|
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
|
*priority_ptr = pthread_getprio(thread->osthread()->pthread_id());
|
|
#elif defined(__APPLE__) || defined(__NetBSD__)
|
|
int policy;
|