changeset 2221:c98220405511

. Make BSD changes equivalent to the Linux specific changes.
author Greg Lewis <glewis@eyesbeyond.com>
date Thu, 03 Mar 2011 18:36:40 -0800
parents fb23abdd4636
children 737d0e928967
files make/bsd/Makefile make/bsd/makefiles/adlc.make make/bsd/makefiles/buildtree.make make/bsd/makefiles/gcc.make make/bsd/makefiles/mapfile-vers-debug make/bsd/makefiles/mapfile-vers-product make/bsd/makefiles/rules.make make/bsd/makefiles/top.make make/bsd/makefiles/vm.make src/os/bsd/vm/jvm_bsd.cpp src/os/bsd/vm/osThread_bsd.cpp src/os/bsd/vm/os_bsd.cpp src/os/bsd/vm/os_bsd.inline.hpp src/os/bsd/vm/thread_bsd.inline.hpp src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp src/os_cpu/bsd_x86/vm/bsd_x86_32.s src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp
diffstat 19 files changed, 205 insertions(+), 122 deletions(-) [+]
line wrap: on
line diff
--- a/make/bsd/Makefile	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/Makefile	Thu Mar 03 18:36:40 2011 -0800
@@ -208,7 +208,7 @@
 TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
 
 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
-BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
+BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
 BUILDTREE_VARS   += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION) JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
 
 BUILDTREE         = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS)
--- a/make/bsd/makefiles/adlc.make	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/makefiles/adlc.make	Thu Mar 03 18:36:40 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,9 @@
 
 SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad 
 
-SOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \
-	     $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad 
+SOURCES.AD = \
+  $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
+  $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
 
 EXEC	= $(OUTDIR)/adlc
 
--- a/make/bsd/makefiles/buildtree.make	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/makefiles/buildtree.make	Thu Mar 03 18:36:40 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 
 # Usage:
 #
-# $(MAKE) -f buildtree.make ARCH=arch BUILDARCH=buildarch LIBARCH=libarch
+# $(MAKE) -f buildtree.make SRCARCH=srcarch BUILDARCH=buildarch LIBARCH=libarch
 #         GAMMADIR=dir OS_FAMILY=os VARIANT=variant
 #
 # The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the
@@ -56,6 +56,8 @@
 # having to read the dependency files for the vm.
 
 include $(GAMMADIR)/make/scm.make
+include $(GAMMADIR)/make/altsrc.make
+
 
 # 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details.
 QUIETLY$(MAKE_VERBOSE)	= @
@@ -127,7 +129,7 @@
         env.sh env.csh jdkpath.sh .dbxrc test_gamma
 
 BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
-	ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
+	SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
 
 # Define variables to be set in flags.make.
 # Default values are set in make/defs.make.
@@ -146,13 +148,7 @@
 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
 # or make/hotspot_distro.
 ifndef HOTSPOT_VM_DISTRO
-  CLOSED_DIR_EXISTS := $(shell                \
-    if [ -d $(GAMMADIR)/src/closed ] ; then \
-      echo true;                              \
-    else                                      \
-      echo false;                             \
-    fi)
-  ifeq ($(CLOSED_DIR_EXISTS), true)
+  ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
     include $(GAMMADIR)/make/hotspot_distro
   else
     include $(GAMMADIR)/make/openjdk_distro
@@ -177,6 +173,11 @@
 $(SIMPLE_DIRS):
 	$(QUIETLY) mkdir -p $@
 
+# Convenience macro which takes a source relative path, applies $(1) to the
+# absolute path, and then replaces $(GAMMADIR) in the result with a 
+# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile.  
+gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2)))
+
 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
 	@echo Creating $@ ...
 	$(QUIETLY) ( \
@@ -187,7 +188,7 @@
 	echo; \
 	echo "GAMMADIR = $(GAMMADIR)"; \
 	echo "SYSDEFS = \$$(Platform_sysdefs)"; \
-	echo "SRCARCH = $(ARCH)"; \
+	echo "SRCARCH = $(SRCARCH)"; \
 	echo "BUILDARCH = $(BUILDARCH)"; \
 	echo "LIBARCH = $(LIBARCH)"; \
 	echo "TARGET = $(TARGET)"; \
@@ -208,16 +209,28 @@
 	echo; \
 	echo "Src_Dirs_V = \\"; \
 	sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \
-	echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \
+	echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
 	echo; \
 	echo "Src_Dirs_I = \\"; \
-	echo "\$$(GAMMADIR)/src/share/vm \\"; \
-	echo "\$$(GAMMADIR)/src/share/vm/prims \\"; \
-	echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \
+	echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \
+	echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \
+	echo "$(call gamma-path,altsrc,share/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,share/vm) \\"; \
+	echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
 	[ -n "$(CFLAGS_BROWSE)" ] && \
 	    echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
 	[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
@@ -241,9 +254,14 @@
 
 ../shared_dirs.lst:  $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
 	@echo Creating directory list $@
-	$(QUIETLY) find $(GAMMADIR)/src/share/vm/* -prune \
+	$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
+          find $(HS_ALT_SRC)/share/vm/* -prune \
+	  -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
+          \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \
+        fi;
+	$(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \
 	-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
-        \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@
+        \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
 
 Makefile: $(BUILDTREE_MAKE)
 	@echo Creating $@ ...
--- a/make/bsd/makefiles/gcc.make	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/makefiles/gcc.make	Thu Mar 03 18:36:40 2011 -0800
@@ -79,6 +79,11 @@
 CFLAGS += -fno-exceptions
 CFLAGS += -pthread
 CFLAGS += -fcheck-new
+# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
+# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
+ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
+CFLAGS += -fvisibility=hidden
+endif
 
 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
 ARCHFLAG/i486    = -m32 -march=i586
--- a/make/bsd/makefiles/mapfile-vers-debug	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/makefiles/mapfile-vers-debug	Thu Mar 03 18:36:40 2011 -0800
@@ -262,14 +262,6 @@
                 JVM_SetField;
                 JVM_SetPrimitiveField;
 
-                # Needed for dropping VM into JDK 1.3.x, 1.4
-                _JVM_native_threads;
-                jdk_sem_init;
-                jdk_sem_post;
-                jdk_sem_wait;
-                jdk_pthread_sigmask;
-                jdk_waitpid;
-
                 # debug JVM
                 JVM_AccessVMBooleanFlag;
                 JVM_AccessVMIntFlag;
--- a/make/bsd/makefiles/mapfile-vers-product	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/makefiles/mapfile-vers-product	Thu Mar 03 18:36:40 2011 -0800
@@ -262,14 +262,6 @@
                 JVM_SetField;
                 JVM_SetPrimitiveField;
 
-                # Needed for dropping VM into JDK 1.3.x, 1.4
-                _JVM_native_threads;
-                jdk_sem_init;
-                jdk_sem_post;
-                jdk_sem_wait;
-                jdk_pthread_sigmask;
-                jdk_waitpid;
-
                 # miscellaneous functions
                 jio_fprintf;
                 jio_printf;
--- a/make/bsd/makefiles/rules.make	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/makefiles/rules.make	Thu Mar 03 18:36:40 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -146,6 +146,8 @@
 include $(GAMMADIR)/make/pic.make
 endif
 
+include $(GAMMADIR)/make/altsrc.make
+
 # The non-PIC object files are only generated for 32 bit platforms.
 ifdef LP64
 %.o: %.cpp
--- a/make/bsd/makefiles/top.make	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/makefiles/top.make	Thu Mar 03 18:36:40 2011 -0800
@@ -39,6 +39,8 @@
 # Instead, use "gmake" (or "gnumake") from the command line.  --Rose
 #MAKE = gmake
 
+include $(GAMMADIR)/make/altsrc.make
+
 TOPDIR      = $(shell echo `pwd`)
 GENERATED   = $(TOPDIR)/../generated
 VM          = $(GAMMADIR)/src/share/vm
@@ -57,8 +59,8 @@
 
 AD_Dir   = $(GENERATED)/adfiles
 ADLC     = $(AD_Dir)/adlc
-AD_Spec  = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad
-AD_Src   = $(GAMMADIR)/src/share/vm/adlc
+AD_Spec  = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad)
+AD_Src   = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc)
 AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp
 AD_Files = $(AD_Names:%=$(AD_Dir)/%)
 
--- a/make/bsd/makefiles/vm.make	Sun Feb 20 12:01:15 2011 -0800
+++ b/make/bsd/makefiles/vm.make	Thu Mar 03 18:36:40 2011 -0800
@@ -28,6 +28,7 @@
 # Common build rules.
 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
 include $(MAKEFILES_DIR)/rules.make
+include $(GAMMADIR)/make/altsrc.make
 
 default: build
 
@@ -129,17 +130,27 @@
   LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 endif
 
-CORE_PATHS := $(shell find $(GAMMADIR)/src/share/vm/* -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \))
-CORE_PATHS += $(GAMMADIR)/src/os/$(Platform_os_family)/vm
-CORE_PATHS += $(GAMMADIR)/src/cpu/$(Platform_arch)/vm
-CORE_PATHS += $(GAMMADIR)/src/os_cpu/$(Platform_os_arch)/vm
-CORE_PATHS += $(GENERATED)/jvmtifiles
+SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt
 
-COMPILER1_PATHS := $(GAMMADIR)/src/share/vm/c1
+SOURCE_PATHS=\
+  $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
+      \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \))
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
 
-COMPILER2_PATHS := $(GAMMADIR)/src/share/vm/opto
-COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt
-COMPILER2_PATHS +=  $(GENERATED)/adfiles
+CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
+CORE_PATHS+=$(GENERATED)/jvmtifiles
+
+COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1)
+COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1
+
+COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto)
+COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt)
+COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto
+COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt
+COMPILER2_PATHS += $(GENERATED)/adfiles
 
 # Include dirs per type.
 Src_Dirs/CORE      := $(CORE_PATHS)
--- a/src/os/bsd/vm/jvm_bsd.cpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os/bsd/vm/jvm_bsd.cpp	Thu Mar 03 18:36:40 2011 -0800
@@ -29,11 +29,6 @@
 
 #include <signal.h>
 
-/*
- * FIXME: This is temporary hack to keep Bsd Runtime.exec()
- * code happy. See $JDK/src/bsd/native/java/lang/UnixProcess_md.c
- */
-int _JVM_native_threads = 1;
 
 // sun.misc.Signal ///////////////////////////////////////////////////////////
 // Signal code is mostly copied from classic vm, signals_md.c   1.4 98/08/23
--- a/src/os/bsd/vm/osThread_bsd.cpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os/bsd/vm/osThread_bsd.cpp	Thu Mar 03 18:36:40 2011 -0800
@@ -39,6 +39,12 @@
 #ifdef TARGET_ARCH_zero
 # include "assembler_zero.inline.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "assembler_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "assembler_ppc.inline.hpp"
+#endif
 
 
 void OSThread::pd_initialize() {
--- a/src/os/bsd/vm/os_bsd.cpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os/bsd/vm/os_bsd.cpp	Thu Mar 03 18:36:40 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,6 +74,14 @@
 # include "assembler_zero.inline.hpp"
 # include "nativeInst_zero.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "assembler_arm.inline.hpp"
+# include "nativeInst_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "assembler_ppc.inline.hpp"
+# include "nativeInst_ppc.hpp"
+#endif
 #ifdef COMPILER1
 #include "c1/c1_Runtime1.hpp"
 #endif
@@ -142,6 +150,7 @@
 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
 #define SEC_IN_NANOSECS  1000000000LL
 
+#define LARGEPAGES_BIT (1 << 6)
 ////////////////////////////////////////////////////////////////////////////////
 // global variables
 julong os::Bsd::_physical_memory = 0;
@@ -1736,10 +1745,9 @@
 
 const char* os::dll_file_extension() { return JNI_LIB_SUFFIX; }
 
-const char* os::get_temp_directory() {
-  const char *prop = Arguments::get_property("java.io.tmpdir");
-  return prop == NULL ? "/tmp" : prop;
-}
+// This must be hard coded because it's the system's temporary
+// directory not the java application's temp directory, ala java.io.tmpdir.
+const char* os::get_temp_directory() { return "/tmp"; }
 
 static bool file_exists(const char* filename) {
   struct stat statbuf;
@@ -2744,8 +2752,10 @@
 }
 
 #ifndef _ALLBSD_SOURCE
-extern "C" void numa_warn(int number, char *where, ...) { }
-extern "C" void numa_error(char *where) { }
+// Something to do with the numa-aware allocator needs these symbols
+extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+extern "C" JNIEXPORT void numa_error(char *where) { }
+extern "C" JNIEXPORT int fork1() { return fork(); }
 
 
 // If we are running with libnuma version > 2, then we should
@@ -2964,6 +2974,43 @@
   return bsd_mprotect(addr, size, PROT_READ|PROT_WRITE);
 }
 
+/*
+* Set the coredump_filter bits to include largepages in core dump (bit 6)
+*
+* From the coredump_filter documentation:
+*
+* - (bit 0) anonymous private memory
+* - (bit 1) anonymous shared memory
+* - (bit 2) file-backed private memory
+* - (bit 3) file-backed shared memory
+* - (bit 4) ELF header pages in file-backed private memory areas (it is
+*           effective only if the bit 2 is cleared)
+* - (bit 5) hugetlb private memory
+* - (bit 6) hugetlb shared memory
+*/
+static void set_coredump_filter(void) {
+  FILE *f;
+  long cdm;
+
+  if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) {
+    return;
+  }
+
+  if (fscanf(f, "%lx", &cdm) != 1) {
+    fclose(f);
+    return;
+  }
+
+  rewind(f);
+
+  if ((cdm & LARGEPAGES_BIT) == 0) {
+    cdm |= LARGEPAGES_BIT;
+    fprintf(f, "%#lx", cdm);
+  }
+
+  fclose(f);
+}
+
 // Large page support
 
 static size_t _large_page_size = 0;
@@ -3024,6 +3071,8 @@
     _page_sizes[2] = 0;
   }
 
+  set_coredump_filter();
+
   // Large page support is available on 2.6 or newer kernel, some vendors
   // (e.g. Redhat) have backported it to their 2.4 based distributions.
   // We optimistically assume the support is available. If later it turns out
@@ -3713,7 +3762,7 @@
 // Note that the VM will print warnings if it detects conflicting signal
 // handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers".
 //
-extern "C" int
+extern "C" JNIEXPORT int
 JVM_handle_bsd_signal(int signo, siginfo_t* siginfo,
                         void* ucontext, int abort_if_unrecognized);
 
@@ -5009,44 +5058,6 @@
   }
 }
 
-extern "C" {
-
-/**
- * NOTE: the following code is to keep the green threads code
- * in the libjava.so happy. Once the green threads is removed,
- * these code will no longer be needed.
- */
-int
-jdk_waitpid(pid_t pid, int* status, int options) {
-    return waitpid(pid, status, options);
-}
-
-int
-fork1() {
-    return fork();
-}
-
-int
-jdk_sem_init(sem_t *sem, int pshared, unsigned int value) {
-    return sem_init(sem, pshared, value);
-}
-
-int
-jdk_sem_post(sem_t *sem) {
-    return sem_post(sem);
-}
-
-int
-jdk_sem_wait(sem_t *sem) {
-    return sem_wait(sem);
-}
-
-int
-jdk_pthread_sigmask(int how , const sigset_t* newmask, sigset_t* oldmask) {
-    return pthread_sigmask(how , newmask, oldmask);
-}
-
-}
 
 // Refer to the comments in os_solaris.cpp park-unpark.
 //
--- a/src/os/bsd/vm/os_bsd.inline.hpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os/bsd/vm/os_bsd.inline.hpp	Thu Mar 03 18:36:40 2011 -0800
@@ -39,6 +39,14 @@
 # include "atomic_bsd_zero.inline.hpp"
 # include "orderAccess_bsd_zero.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_arm
+# include "atomic_bsd_arm.inline.hpp"
+# include "orderAccess_bsd_arm.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_ppc
+# include "atomic_bsd_ppc.inline.hpp"
+# include "orderAccess_bsd_ppc.inline.hpp"
+#endif
 
 // System includes
 
--- a/src/os/bsd/vm/thread_bsd.inline.hpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os/bsd/vm/thread_bsd.inline.hpp	Thu Mar 03 18:36:40 2011 -0800
@@ -44,6 +44,16 @@
 # include "orderAccess_bsd_zero.inline.hpp"
 # include "prefetch_bsd_zero.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_arm
+# include "atomic_bsd_arm.inline.hpp"
+# include "orderAccess_bsd_arm.inline.hpp"
+# include "prefetch_bsd_arm.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_ppc
+# include "atomic_bsd_ppc.inline.hpp"
+# include "orderAccess_bsd_ppc.inline.hpp"
+# include "prefetch_bsd_ppc.inline.hpp"
+#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp	Thu Mar 03 18:36:40 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,11 +100,6 @@
   return exchange_value;
 }
 
-extern "C" {
-  // defined in bsd_x86.s
-  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
-}
-
 #ifdef AMD64
 inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
 inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
@@ -164,9 +159,9 @@
   return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
 }
 
-#else
-//inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
-//inline void Atomic::store  (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+#else // !AMD64
 
 inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
   return (intptr_t)Atomic::add((jint)add_value, (volatile jint*)dest);
@@ -189,6 +184,12 @@
   return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
 }
 
+extern "C" {
+  // defined in bsd_x86.s
+  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
+  void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
+}
+
 inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value) {
   return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, os::is_MP());
 }
@@ -200,6 +201,21 @@
 inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value) {
   return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
 }
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  _Atomic_move_long(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, dest);
+}
+
 #endif // AMD64
 
 #endif // OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP
--- a/src/os_cpu/bsd_x86/vm/bsd_x86_32.s	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/bsd_x86_32.s	Thu Mar 03 18:36:40 2011 -0800
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
 	.globl SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts)
 
         .globl SYMBOL(_Atomic_cmpxchg_long)
+        .globl SYMBOL(_Atomic_move_long)
 
 	.text
 
@@ -684,3 +685,15 @@
         popl     %ebx
         ret
 
+
+        # Support for jlong Atomic::load and Atomic::store.
+        # void _Atomic_move_long(volatile jlong* src, volatile jlong* dst)
+        .p2align 4,,15
+	.type    _Atomic_move_long,@function
+_Atomic_move_long:
+        movl     4(%esp), %eax   # src
+        fildll    (%eax)
+        movl     8(%esp), %eax   # dest
+        fistpll   (%eax)
+        ret
+
--- a/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp	Thu Mar 03 18:36:40 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 #ifndef OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
 #define OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
 
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "vm_version_x86.hpp"
 
@@ -64,11 +65,11 @@
 inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { return *p; }
 inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { return *p; }
 inline jint     OrderAccess::load_acquire(volatile jint*    p) { return *p; }
-inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return *p; }
+inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return Atomic::load(p); }
 inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { return *p; }
 inline jushort  OrderAccess::load_acquire(volatile jushort* p) { return *p; }
 inline juint    OrderAccess::load_acquire(volatile juint*   p) { return *p; }
-inline julong   OrderAccess::load_acquire(volatile julong*  p) { return *p; }
+inline julong   OrderAccess::load_acquire(volatile julong*  p) { return Atomic::load((volatile jlong*)p); }
 inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { return *p; }
 inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
 
@@ -79,11 +80,11 @@
 inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { *p = v; }
+inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { Atomic::store(v, p); }
 inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
 inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { *p = v; }
+inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { Atomic::store((jlong)v, (volatile jlong*)p); }
 inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
 
@@ -178,7 +179,7 @@
                           : "0" (v), "r" (p)
                           : "memory");
 #else
-  *p = v; fence();
+  release_store(p, v); fence();
 #endif // AMD64
 }
 
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Thu Mar 03 18:36:40 2011 -0800
@@ -395,7 +395,7 @@
 extern "C" void FetchNResume () ;
 #endif // AMD64
 
-extern "C" int
+extern "C" JNIEXPORT int
 JVM_handle_bsd_signal(int sig,
                         siginfo_t* info,
                         void* ucVoid,
--- a/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Sun Feb 20 12:01:15 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Thu Mar 03 18:36:40 2011 -0800
@@ -120,7 +120,7 @@
   ShouldNotCallThis();
 }
 
-extern "C" int
+extern "C" JNIEXPORT int
 JVM_handle_bsd_signal(int sig,
                         siginfo_t* info,
                         void* ucVoid,