Update devel/jdk/1.7 to b147 / non-beta
- Remove Early Access now that jdk 1.7 is final - Use a patch set for all patches from upstream repository: http://hg.openjdk.java.net/bsd-port/bsd-port - Set milestone and build number to fcs b00 to match Oracle. - Update cacerts file. - Install unlimited crypto policy. - Add DIST_SUBDIR=jdk. - Include patches from icedtea-web for applet hole from Landry Breuil <landry@openbsd.org> via FreeBSD OpenJDK7 port - Include fix for Oracle bug "7070134: Hotspot crashes with sigsegv from PorterStemmer": http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/4e761e7e6e12 okay landry@ jasper@
This commit is contained in:
parent
f630634d36
commit
4d23be3ad3
@ -1,29 +1,29 @@
|
||||
# $OpenBSD: Makefile,v 1.44 2011/05/03 09:35:56 landry Exp $
|
||||
# $OpenBSD: Makefile,v 1.45 2011/09/22 20:26:47 kurt Exp $
|
||||
|
||||
SHARED_ONLY= Yes
|
||||
ONLY_FOR_ARCHS= i386 amd64
|
||||
|
||||
COMMENT-main= Java2(TM) SE Dev Kit v${V} Early Access ${B}
|
||||
COMMENT-jre= Java2(TM) SE Runtime Environment v${V} Early Access ${B}
|
||||
COMMENT-main= Java2(TM) SE Dev Kit v${V}
|
||||
COMMENT-jre= Java2(TM) SE Runtime Environment v${V}
|
||||
V= 1.7.0.00
|
||||
B= b122
|
||||
B= b147
|
||||
PKGNAME= jdk-${V}
|
||||
PKGNAME-main= jdk-${V}${B:S/b/beta/}
|
||||
REVISION-main = 1
|
||||
PKGNAME-jre= jre-${V}${B:S/b/beta/}
|
||||
REVISION-jre = 1
|
||||
PKGNAME-main= jdk-${V}
|
||||
PKGNAME-jre= jre-${V}
|
||||
EPOCH= 0
|
||||
|
||||
# see openjdk/jaxp/jaxp.properties & openjdk/jaxws/jaxws.properties
|
||||
# in ${WRKDIR} for names and download locations of extra distfiles
|
||||
|
||||
JDK_SRC= openjdk-7-ea-src-${B}-16_dec_2010.zip
|
||||
JAXP_SRC= jaxp-1_4_4.zip
|
||||
JAXWS_SRC= jdk7-jaxws2_2-2010_08_19.zip
|
||||
JDK_SRC= openjdk-7-fcs-src-${B}-27_jun_2011.zip
|
||||
JAXP_SRC= jaxp145_01.zip
|
||||
JAXWS_SRC= jdk7-jaxws2_2_4-b03-2011_05_27.zip
|
||||
JAF_SRC= jdk7-jaf-2010_08_19.zip
|
||||
PATCH_SET= openjdk-7-patch-set-20110922.zip
|
||||
|
||||
DISTFILES= ${JDK_SRC} ${JAXP_SRC}:0 ${JAXWS_SRC}:1 ${JAF_SRC}:1
|
||||
EXTRACT_ONLY= ${JDK_SRC}
|
||||
DISTFILES= ${JDK_SRC} ${JAXP_SRC}:0 ${JAXWS_SRC}:1 ${JAF_SRC}:2 ${PATCH_SET}:3
|
||||
EXTRACT_ONLY= ${JDK_SRC} ${PATCH_SET}
|
||||
DIST_SUBDIR= jdk
|
||||
|
||||
CATEGORIES= devel/jdk java
|
||||
|
||||
@ -38,14 +38,21 @@ HOMEPAGE= http://openjdk.java.net/
|
||||
MASTER_SITES= http://www.java.net/download/openjdk/jdk7/promoted/${B}/ \
|
||||
http://openbsd.dead-parrot.de/distfiles/ \
|
||||
http://distfiles.nl/
|
||||
MASTER_SITES0= https://jaxp.dev.java.net/files/documents/913/152561/ \
|
||||
MASTER_SITES0= http://download.java.net/jaxp/1.4.5/ \
|
||||
http://icedtea.classpath.org/download/drops/ \
|
||||
http://openbsd.dead-parrot.de/distfiles/ \
|
||||
http://distfiles.nl/
|
||||
MASTER_SITES1= http://java.net/downloads/jax-ws/JDK7/ \
|
||||
MASTER_SITES1= http://download.java.net/glassfish/components/jax-ws/openjdk/jdk7/ \
|
||||
http://icedtea.classpath.org/download/drops/ \
|
||||
http://openbsd.dead-parrot.de/distfiles/ \
|
||||
http://distfiles.nl/
|
||||
MASTER_SITES2= http://java.net/downloads/jax-ws/JDK7/ \
|
||||
http://icedtea.classpath.org/download/drops/ \
|
||||
http://openbsd.dead-parrot.de/distfiles/ \
|
||||
http://distfiles.nl/
|
||||
MASTER_SITES3= http://www.intricatesoftware.com/distfiles/ \
|
||||
http://openbsd.dead-parrot.de/distfiles/ \
|
||||
http://distfiles.nl/
|
||||
|
||||
MAINTAINER= Kurt Miller <kurt@openbsd.org>
|
||||
|
||||
@ -59,11 +66,11 @@ USE_GROFF = Yes
|
||||
NO_REGRESS= Yes
|
||||
|
||||
.if ${FLAVOR:L:Mnative_bootstrap}
|
||||
INSTALLED!= (pkg_info -qe "jdk->=1.7.0.00beta122v0,<1.8v0" && echo yes) || echo no
|
||||
INSTALLED!= (pkg_info -qe "jdk->=1.7.0.00v0,<1.8v0" && echo yes) || echo no
|
||||
.if ${INSTALLED:L} != "yes"
|
||||
ERRORS += "Fatal: This flavor requires an installed 1.7.0.00beta122v0 jdk package or greater"
|
||||
ERRORS += "Fatal: This flavor requires an installed 1.7.0.00v0 or greater jdk package"
|
||||
.endif
|
||||
BUILD_DEPENDS+= jdk->=1.7.0.00beta122v0,<1.8v0:devel/jdk/1.7
|
||||
BUILD_DEPENDS+= jdk->=1.7.0.00v0,<1.8v0:devel/jdk/1.7
|
||||
ALT_BOOTDIR= ${LOCALBASE}/jdk-1.7.0
|
||||
.else
|
||||
BUILD_DEPENDS+= jdk->=1.6,<1.7:devel/jdk/1.6
|
||||
@ -83,7 +90,7 @@ USE_GMAKE= Yes
|
||||
MAKE_ENV= ALT_BOOTDIR=${ALT_BOOTDIR} \
|
||||
ALT_FREETYPE_HEADERS_PATH=${X11BASE}/include \
|
||||
ALT_FREETYPE_LIB_PATH=${X11BASE}/lib \
|
||||
ALT_DROPS_DIR=${DISTDIR} \
|
||||
ALT_DROPS_DIR=${DISTDIR}/${DIST_SUBDIR} \
|
||||
ALT_PACKAGE_PATH=${LOCALBASE} \
|
||||
ALT_X11_PATH=${X11BASE} \
|
||||
DEFAULT_LIBPATH="/usr/lib:${X11BASE}/lib:${LOCALBASE}/lib" \
|
||||
@ -91,6 +98,8 @@ MAKE_ENV= ALT_BOOTDIR=${ALT_BOOTDIR} \
|
||||
CC="${CC}" \
|
||||
CXX="${CXX}" \
|
||||
USERNAME=${USER} \
|
||||
MILESTONE=fcs \
|
||||
BUILD_NUMBER=b00 \
|
||||
HOTSPOT_BUILD_JOBS=${HOTSPOT_BUILD_JOBS}
|
||||
|
||||
#ALL_TARGET= debug_build
|
||||
@ -123,7 +132,6 @@ COPYDIRS= hotspot/agent/src/os/linux \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_amd64 \
|
||||
hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_x86 \
|
||||
hotspot/src/os/linux/launcher \
|
||||
hotspot/src/os/linux/vm \
|
||||
hotspot/src/os_cpu/linux_x86/vm \
|
||||
hotspot/src/os_cpu/linux_zero/vm \
|
||||
@ -150,38 +158,38 @@ COPYFILES= hotspot/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java
|
||||
jdk/src/solaris/classes/sun/nio/fs/LinuxNativeDispatcher.java \
|
||||
jdk/src/solaris/classes/sun/tools/attach/LinuxAttachProvider.java \
|
||||
jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java \
|
||||
jdk/src/solaris/hpi/include/largefile_linux.h \
|
||||
jdk/src/solaris/native/java/net/linux_close.c \
|
||||
jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
|
||||
|
||||
# create initial bsd src from linux src (except for threads_solaris.c)
|
||||
# create initial bsd src from linux src
|
||||
post-extract:
|
||||
@for d in ${COPYDIRS}; do \
|
||||
mkdir -p `echo ${WRKDIST}/$$d | sed 's/linux/bsd/g;'`; \
|
||||
cd ${WRKDIST}/$$d; \
|
||||
for f in *; do \
|
||||
if [ -f $$f ]; then \
|
||||
t=`echo ${WRKDIST}/$$d/$$f | sed 's/linux/bsd/g; s/Linux/Bsd/g'`; \
|
||||
sed 's/linux/bsd/g; s/Linux/Bsd/g' < $$f > $$t; \
|
||||
t=`echo ${WRKDIST}/$$d/$$f | sed 's/linux/bsd/g; s/Linux/Bsd/g; s/LINUX/BSD/g'`; \
|
||||
sed 's/linux/bsd/g; s/Linux/Bsd/g; s/LINUX/BSD/g' < $$f > $$t; \
|
||||
fi; \
|
||||
done; \
|
||||
done
|
||||
@for f in ${COPYFILES}; do \
|
||||
t=`echo $$f | sed 's/linux/bsd/g; s/Linux/Bsd/g'`; \
|
||||
sed 's/linux/bsd/g; s/Linux/Bsd/g' < ${WRKDIST}/$$f > ${WRKDIST}/$$t; \
|
||||
t=`echo $$f | sed 's/linux/bsd/g; s/Linux/Bsd/g; s/LINUX/BSD/g'`; \
|
||||
sed 's/linux/bsd/g; s/Linux/Bsd/g; s/LINUX/BSD/g' < ${WRKDIST}/$$f > ${WRKDIST}/$$t; \
|
||||
done
|
||||
@sed 's/solaris/bsd/g; s/Solaris/Bsd/g' \
|
||||
< ${WRKDIST}/jdk/src/solaris/hpi/native_threads/src/threads_solaris.c \
|
||||
> ${WRKDIST}/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c
|
||||
@cp ${WRKDIST}/jdk/src/share/lib/security/java.security \
|
||||
${WRKDIST}/jdk/src/share/lib/security/java.security-openbsd
|
||||
@rm ${WRKDIST}/hotspot/agent/src/os/bsd/proc_service.h
|
||||
@cp -f ${FILESDIR}/cacerts ${WRKDIST}/jdk/src/share/lib/security
|
||||
@cp -f ${FILESDIR}/PLATFORM_API_BSDOS_PCM.c \
|
||||
${WRKDIST}/jdk/src/solaris/native/com/sun/media/sound
|
||||
@cd ${WRKDIST} && \
|
||||
${PATCH} -p0 -z .orig.linux --quiet < ${WRKDIR}/${PATCH_SET:R}
|
||||
@perl -pi -e 's|build-policy install-limited|build-policy install-unlimited|' \
|
||||
${WRKDIST}/jdk/make/javax/crypto/Makefile
|
||||
|
||||
|
||||
post-build:
|
||||
@rm -rf ${JDKIMAGEDIR}/man/ja ${JREIMAGEDIR}/man/ja
|
||||
@rm -rf ${JDKIMAGEDIR}/man/ja ${JDKIMAGEDIR}/man/ja_JP.UTF-8 \
|
||||
${JREIMAGEDIR}/man/ja ${JREIMAGEDIR}/man/ja_JP.UTF-8
|
||||
|
||||
do-install:
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/${JDKHOME}
|
||||
|
@ -1,20 +1,25 @@
|
||||
MD5 (jaxp-1_4_4.zip) = LECnWDksSr8tWfNVJA30ag==
|
||||
MD5 (jdk7-jaf-2010_08_19.zip) = GNFd/XERfarbMyrwA9CCEg==
|
||||
MD5 (jdk7-jaxws2_2-2010_08_19.zip) = h3XM79O0+i3eUVXsS35M6w==
|
||||
MD5 (openjdk-7-ea-src-b122-16_dec_2010.zip) = mue188ReSPqHOJdEU3zJBQ==
|
||||
RMD160 (jaxp-1_4_4.zip) = BeceSONiyaJxmjWaJnV5Lgc5kK8=
|
||||
RMD160 (jdk7-jaf-2010_08_19.zip) = +637t4HcKqjPo4S41c1hhSLlUSg=
|
||||
RMD160 (jdk7-jaxws2_2-2010_08_19.zip) = 6Wd/TPncbKOwATI+AhNQnBlkPb0=
|
||||
RMD160 (openjdk-7-ea-src-b122-16_dec_2010.zip) = 8j9xg/sCj5gGpa8ffBWhCx+kgTA=
|
||||
SHA1 (jaxp-1_4_4.zip) = IN7vgFtAbmyjzqzzhrcdUFYX3qo=
|
||||
SHA1 (jdk7-jaf-2010_08_19.zip) = Y+qXDc8Sn7u6OaEy2Pca3Rn78fA=
|
||||
SHA1 (jdk7-jaxws2_2-2010_08_19.zip) = I7N8JKCufnRshU3TJZE1XyRCG3M=
|
||||
SHA1 (openjdk-7-ea-src-b122-16_dec_2010.zip) = R2qqIqc+SVA0We5xiUDvpgfI3R4=
|
||||
SHA256 (jaxp-1_4_4.zip) = ELIDvsW3092PUVqeCY+Aq8MW+vl3vMIgtW7+Pcbp5ek=
|
||||
SHA256 (jdk7-jaf-2010_08_19.zip) = 5q7+39u0Zz6AGVg9E0T7FiuU4bEDgsNiNk27/ViJwJ4=
|
||||
SHA256 (jdk7-jaxws2_2-2010_08_19.zip) = uId6r7sVo0i6vK7k7jcvs+LqAoL4/pPTBicv0k14R94=
|
||||
SHA256 (openjdk-7-ea-src-b122-16_dec_2010.zip) = H2HGuDsLDBUWa/Dkhroj0yAsoOyh+GV4TYgB5nGw+44=
|
||||
SIZE (jaxp-1_4_4.zip) = 5972577
|
||||
SIZE (jdk7-jaf-2010_08_19.zip) = 70613
|
||||
SIZE (jdk7-jaxws2_2-2010_08_19.zip) = 5893692
|
||||
SIZE (openjdk-7-ea-src-b122-16_dec_2010.zip) = 85656129
|
||||
MD5 (jdk/jaxp145_01.zip) = MjlMeAyPteKXdfYjUlmTwA==
|
||||
MD5 (jdk/jdk7-jaf-2010_08_19.zip) = GNFd/XERfarbMyrwA9CCEg==
|
||||
MD5 (jdk/jdk7-jaxws2_2_4-b03-2011_05_27.zip) = L1uCmt5w9n/ictCzIuPnAg==
|
||||
MD5 (jdk/openjdk-7-fcs-src-b147-27_jun_2011.zip) = woTImhBPZKla/eOpYTjvDw==
|
||||
MD5 (jdk/openjdk-7-patch-set-20110922.zip) = G4kf1zDKlq2Y0GYM4p6ftw==
|
||||
RMD160 (jdk/jaxp145_01.zip) = r5G5Xn63po/GL0UNx7X+XCvkoig=
|
||||
RMD160 (jdk/jdk7-jaf-2010_08_19.zip) = +637t4HcKqjPo4S41c1hhSLlUSg=
|
||||
RMD160 (jdk/jdk7-jaxws2_2_4-b03-2011_05_27.zip) = SSc0iWUcGVA3aWaVXyjkBpFl6Bg=
|
||||
RMD160 (jdk/openjdk-7-fcs-src-b147-27_jun_2011.zip) = JbgIgn5TjFqLj3n2S+sp4agByYg=
|
||||
RMD160 (jdk/openjdk-7-patch-set-20110922.zip) = FoqDGL3uixIlxl5J8f2ZzwgnoQ4=
|
||||
SHA1 (jdk/jaxp145_01.zip) = EG24jI5Tq7GgZOg9Qcx6zRa3cTw=
|
||||
SHA1 (jdk/jdk7-jaf-2010_08_19.zip) = Y+qXDc8Sn7u6OaEy2Pca3Rn78fA=
|
||||
SHA1 (jdk/jdk7-jaxws2_2_4-b03-2011_05_27.zip) = U5vPgLmobJdAajx559EGhLITpL4=
|
||||
SHA1 (jdk/openjdk-7-fcs-src-b147-27_jun_2011.zip) = 7PZk0p6OonZCV7xdq8XQtw9GVw4=
|
||||
SHA1 (jdk/openjdk-7-patch-set-20110922.zip) = 0FbysFAZ7C31Km0PpGy0ll/WDeA=
|
||||
SHA256 (jdk/jaxp145_01.zip) = xZJMYYiYji6Dl+5RQ72OqgYladBSVnr9KskyalSoSMs=
|
||||
SHA256 (jdk/jdk7-jaf-2010_08_19.zip) = 5q7+39u0Zz6AGVg9E0T7FiuU4bEDgsNiNk27/ViJwJ4=
|
||||
SHA256 (jdk/jdk7-jaxws2_2_4-b03-2011_05_27.zip) = Ba5yWbddDyMHJ21h7OGIf81DfLTs2kL6uMItS1N+/9Y=
|
||||
SHA256 (jdk/openjdk-7-fcs-src-b147-27_jun_2011.zip) = OpMxoWfKCIp4IDItF0IMT787rDavW0yUrLzi4tOnHOI=
|
||||
SHA256 (jdk/openjdk-7-patch-set-20110922.zip) = l92nQVNFFMTDxSiSYOOZuM1iZ0nr2PUSOrtVxsZspB8=
|
||||
SIZE (jdk/jaxp145_01.zip) = 6389175
|
||||
SIZE (jdk/jdk7-jaf-2010_08_19.zip) = 70613
|
||||
SIZE (jdk/jdk7-jaxws2_2_4-b03-2011_05_27.zip) = 6046353
|
||||
SIZE (jdk/openjdk-7-fcs-src-b147-27_jun_2011.zip) = 87218182
|
||||
SIZE (jdk/openjdk-7-patch-set-20110922.zip) = 234558
|
||||
|
Binary file not shown.
@ -1,32 +0,0 @@
|
||||
$OpenBSD: patch-corba_make_common_Defs_gmk,v 1.4 2011/01/11 15:47:49 kurt Exp $
|
||||
--- corba/make/common/Defs.gmk.orig Thu Oct 28 20:16:47 2010
|
||||
+++ corba/make/common/Defs.gmk Mon Nov 1 13:15:37 2010
|
||||
@@ -53,6 +53,28 @@ endif
|
||||
|
||||
_OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH)
|
||||
|
||||
+ifneq ($(PLATFORM), windows)
|
||||
+ ifdef ALT_X11_PATH
|
||||
+ X11_PATH = $(ALT_X11_PATH)
|
||||
+ else
|
||||
+ X11_PATH = /usr/X11R6
|
||||
+ endif
|
||||
+
|
||||
+ ifdef ALT_PACKAGE_PATH
|
||||
+ PACKAGE_PATH = $(ALT_PACKAGE_PATH)
|
||||
+ else
|
||||
+ ifeq ($(PLATFORM), linux)
|
||||
+ PACKAGE_PATH = /usr
|
||||
+ else
|
||||
+ ifeq ($(OS_VENDOR), Apple)
|
||||
+ PACKAGE_PATH = /opt/local
|
||||
+ else
|
||||
+ PACKAGE_PATH = /usr/local
|
||||
+ endif
|
||||
+ endif
|
||||
+ endif
|
||||
+endif
|
||||
+
|
||||
#
|
||||
# Get platform definitions
|
||||
#
|
@ -1,21 +0,0 @@
|
||||
$OpenBSD: patch-corba_make_common_shared_Defs-bsd_gmk,v 1.4 2011/01/11 15:47:49 kurt Exp $
|
||||
--- corba/make/common/shared/Defs-bsd.gmk.orig Mon Nov 1 13:15:32 2010
|
||||
+++ corba/make/common/shared/Defs-bsd.gmk Mon Nov 1 13:16:09 2010
|
||||
@@ -54,7 +54,7 @@ $(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && p
|
||||
endef
|
||||
|
||||
# Location on system where jdk installs might be
|
||||
-USRJDKINSTANCES_PATH =/opt/java
|
||||
+USRJDKINSTANCES_PATH =$(PACKAGE_PATH)
|
||||
|
||||
# UNIXCOMMAND_PATH: path to where the most common Unix commands are.
|
||||
# NOTE: Must end with / so that it could be empty, allowing PATH usage.
|
||||
@@ -99,7 +99,7 @@ endif
|
||||
ifneq "$(origin ALT_DEVTOOLS_PATH)" "undefined"
|
||||
DEVTOOLS_PATH :=$(call PrefixPath,$(ALT_DEVTOOLS_PATH))
|
||||
else
|
||||
- DEVTOOLS_PATH =/usr/bin/
|
||||
+ DEVTOOLS_PATH =$(PACKAGE_PATH)/bin/
|
||||
endif
|
||||
|
||||
# _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
|
@ -1,52 +0,0 @@
|
||||
$OpenBSD: patch-corba_make_common_shared_Defs-utils_gmk,v 1.4 2011/01/11 15:47:49 kurt Exp $
|
||||
--- corba/make/common/shared/Defs-utils.gmk.orig Fri Aug 13 03:17:47 2010
|
||||
+++ corba/make/common/shared/Defs-utils.gmk Mon Oct 25 18:38:15 2010
|
||||
@@ -53,6 +53,13 @@ ifeq ($(PLATFORM),linux)
|
||||
UTILS_DEVTOOL_PATH=$(USRBIN_PATH)
|
||||
endif
|
||||
|
||||
+ifeq ($(PLATFORM),bsd)
|
||||
+ UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH)
|
||||
+ UTILS_USR_BIN_PATH=$(USRBIN_PATH)
|
||||
+ UTILS_CCS_BIN_PATH=$(USRBIN_PATH)
|
||||
+ UTILS_DEVTOOL_PATH=$(DEVTOOLS_PATH)
|
||||
+endif
|
||||
+
|
||||
ifeq ($(PLATFORM),solaris)
|
||||
UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH)
|
||||
UTILS_USR_BIN_PATH=$(UNIXCOMMAND_PATH)
|
||||
@@ -198,3 +205,34 @@ ifeq ($(PLATFORM),solaris)
|
||||
ECHO = /usr/bin/echo
|
||||
endif
|
||||
|
||||
+# BSD specific
|
||||
+ifeq ($(PLATFORM),bsd)
|
||||
+ BASENAME = $(UTILS_USR_BIN_PATH)basename
|
||||
+ EGREP = $(UTILS_USR_BIN_PATH)egrep
|
||||
+ EXPR = $(UTILS_COMMAND_PATH)expr
|
||||
+ FMT = $(UTILS_USR_BIN_PATH)fmt
|
||||
+ GREP = $(UTILS_USR_BIN_PATH)grep
|
||||
+ GUNZIP = $(UTILS_USR_BIN_PATH)gunzip
|
||||
+ ID = $(UTILS_USR_BIN_PATH)id
|
||||
+ MSGFMT = $(UTILS_DEVTOOL_PATH)msgfmt
|
||||
+ SED = $(UTILS_USR_BIN_PATH)sed
|
||||
+ SORT = $(UTILS_USR_BIN_PATH)sort
|
||||
+ TEST = $(UTILS_COMMAND_PATH)test
|
||||
+ TOUCH = $(UTILS_USR_BIN_PATH)touch
|
||||
+ TRUE = $(UTILS_USR_BIN_PATH)true
|
||||
+ UNAME = $(UTILS_USR_BIN_PATH)uname
|
||||
+ # BSD OS_VENDOR specific
|
||||
+ ifeq ($(OS_VENDOR), Apple)
|
||||
+ NAWK = $(UTILS_USR_BIN_PATH)awk
|
||||
+ UNZIPSFX = $(UTILS_USR_BIN_PATH)unzipsfx
|
||||
+ ZIPEXE = $(UTILS_USR_BIN_PATH)zip
|
||||
+ else
|
||||
+ UNZIP = $(UTILS_DEVTOOL_PATH)unzip
|
||||
+ endif
|
||||
+ ifeq ($(OS_VENDOR), OpenBSD)
|
||||
+ NAWK = $(UTILS_USR_BIN_PATH)awk
|
||||
+ else
|
||||
+ CPIO = $(UTILS_USR_BIN_PATH)cpio
|
||||
+ TAR = $(UTILS_USR_BIN_PATH)tar
|
||||
+ endif
|
||||
+endif
|
@ -1,124 +0,0 @@
|
||||
$OpenBSD: patch-corba_make_common_shared_Platform_gmk,v 1.6 2011/01/11 15:47:49 kurt Exp $
|
||||
--- corba/make/common/shared/Platform.gmk.orig Thu Oct 28 20:16:47 2010
|
||||
+++ corba/make/common/shared/Platform.gmk Mon Nov 1 13:16:10 2010
|
||||
@@ -231,6 +231,101 @@ ifeq ($(SYSTEM_UNAME), Linux)
|
||||
MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2)
|
||||
endif
|
||||
|
||||
+ifeq ($(SYSTEM_UNAME), FreeBSD)
|
||||
+ PLATFORM = bsd
|
||||
+ OS_NAME = freebsd
|
||||
+ OS_VENDOR = FreeBSD
|
||||
+ REQUIRED_OS_VERSION = 6.0
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(SYSTEM_UNAME), Darwin)
|
||||
+ PLATFORM = bsd
|
||||
+ OS_NAME = darwin
|
||||
+ OS_VENDOR = Apple
|
||||
+ REQUIRED_OS_VERSION = 8.0
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(SYSTEM_UNAME), NetBSD)
|
||||
+ PLATFORM = bsd
|
||||
+ OS_NAME = netbsd
|
||||
+ OS_VENDOR = NetBSD
|
||||
+ REQUIRED_OS_VERSION = 3.0
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(SYSTEM_UNAME), OpenBSD)
|
||||
+ PLATFORM = bsd
|
||||
+ OS_NAME = openbsd
|
||||
+ OS_VENDOR = OpenBSD
|
||||
+ REQUIRED_OS_VERSION = 4.2
|
||||
+endif
|
||||
+
|
||||
+# Platform settings specific to BSD
|
||||
+ifeq ($(PLATFORM), bsd)
|
||||
+ OS_VERSION := $(shell uname -r)
|
||||
+ # Arch and OS name/version
|
||||
+ mach := $(shell uname -m)
|
||||
+ archExpr = case "$(mach)" in \
|
||||
+ i[3-9]86) \
|
||||
+ echo i586 \
|
||||
+ ;; \
|
||||
+ sparc64) \
|
||||
+ echo sparcv9 \
|
||||
+ ;; \
|
||||
+ sparc*) \
|
||||
+ echo sparc \
|
||||
+ ;; \
|
||||
+ x86_64) \
|
||||
+ echo amd64 \
|
||||
+ ;; \
|
||||
+ "Power Macintosh") \
|
||||
+ echo ppc \
|
||||
+ ;; \
|
||||
+ *) \
|
||||
+ echo $(mach) \
|
||||
+ ;; \
|
||||
+ esac
|
||||
+ ARCH := $(shell $(archExpr) )
|
||||
+ ARCH_FAMILY := $(ARCH)
|
||||
+
|
||||
+ # Darwin builds may be 32-bit or 64-bit data model.
|
||||
+ ifeq ($(SYSTEM_UNAME), Darwin)
|
||||
+ ifeq ($(ARCH), i586)
|
||||
+ ifeq ($(ARCH_DATA_MODEL), 64)
|
||||
+ ARCH=amd64
|
||||
+ endif
|
||||
+ endif
|
||||
+ endif
|
||||
+
|
||||
+ # i586, sparc, and ppc are 32 bit, amd64 and sparc64 are 64
|
||||
+ ifneq (,$(findstring $(ARCH), i586 sparc ppc))
|
||||
+ ARCH_DATA_MODEL=32
|
||||
+ else
|
||||
+ ARCH_DATA_MODEL=64
|
||||
+ endif
|
||||
+
|
||||
+ # Need to maintain the jre/lib/i386 location for 32-bit Intel
|
||||
+ ifeq ($(ARCH), i586)
|
||||
+ LIBARCH = i386
|
||||
+ else
|
||||
+ LIBARCH = $(ARCH)
|
||||
+ endif
|
||||
+
|
||||
+ # Value of Java os.arch property
|
||||
+ ARCHPROP = $(LIBARCH)
|
||||
+
|
||||
+ # Suffix for file bundles used in previous release
|
||||
+ BUNDLE_FILE_SUFFIX=.tar.gz
|
||||
+ # Minimum disk space needed as determined by running 'du -sk' on
|
||||
+ # a fully built workspace.
|
||||
+ REQUIRED_FREE_SPACE=1500000
|
||||
+ # How much RAM does this machine have:
|
||||
+ ifeq ($(OS_VENDOR), OpenBSD)
|
||||
+ MB_OF_MEMORY=$(shell sysctl -n hw.physmem | awk '{print int($$NF / 1048576); }' )
|
||||
+ else
|
||||
+ MB_OF_MEMORY=$(shell (sysctl -n hw.physmem64 2> /dev/null || sysctl -n hw.physmem) | awk '{print int($$NF / 1048576); }' )
|
||||
+ endif
|
||||
+endif
|
||||
+
|
||||
# Windows with and without CYGWIN will be slightly different
|
||||
ifeq ($(SYSTEM_UNAME), Windows_NT)
|
||||
PLATFORM = windows
|
||||
@@ -379,6 +474,18 @@ ifndef MAX_VM_MEMORY
|
||||
export MIN_VM_MEMORY
|
||||
export LOW_MEMORY_MACHINE
|
||||
export MAX_VM_MEMORY
|
||||
+endif
|
||||
+
|
||||
+# for OpenBSD/i386 limit to 736 max
|
||||
+ifeq ($(OS_VENDOR), OpenBSD)
|
||||
+ ifeq ($(ARCH_DATA_MODEL), 32)
|
||||
+ MAX_VM_MEMORY := $(shell \
|
||||
+ if [ $(MAX_VM_MEMORY) -gt 736 ] ; then \
|
||||
+ echo "736"; \
|
||||
+ else \
|
||||
+ echo "$(MAX_VM_MEMORY)" ; \
|
||||
+ fi)
|
||||
+ endif
|
||||
endif
|
||||
|
||||
REQUIRED_ZIP_VER = 2.2
|
@ -1,32 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_make_Makefile,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/make/Makefile.orig Tue Jun 2 12:31:31 2009
|
||||
+++ hotspot/agent/make/Makefile Tue Jun 2 12:31:37 2009
|
||||
@@ -52,6 +52,9 @@ sun.jvm.hotspot.code \
|
||||
sun.jvm.hotspot.compiler \
|
||||
sun.jvm.hotspot.debugger \
|
||||
sun.jvm.hotspot.debugger.amd64 \
|
||||
+sun.jvm.hotspot.debugger.bsd \
|
||||
+sun.jvm.hotspot.debugger.bsd.amd64 \
|
||||
+sun.jvm.hotspot.debugger.bsd.x86 \
|
||||
sun.jvm.hotspot.debugger.cdbg \
|
||||
sun.jvm.hotspot.debugger.cdbg.basic \
|
||||
sun.jvm.hotspot.debugger.cdbg.basic.amd64 \
|
||||
@@ -94,6 +97,9 @@ sun.jvm.hotspot.memory \
|
||||
sun.jvm.hotspot.oops \
|
||||
sun.jvm.hotspot.runtime \
|
||||
sun.jvm.hotspot.runtime.amd64 \
|
||||
+sun.jvm.hotspot.runtime.bsd \
|
||||
+sun.jvm.hotspot.runtime.bsd_amd64 \
|
||||
+sun.jvm.hotspot.runtime.bsd_x86 \
|
||||
sun.jvm.hotspot.runtime.ia64 \
|
||||
sun.jvm.hotspot.runtime.linux \
|
||||
sun.jvm.hotspot.runtime.linux_amd64 \
|
||||
@@ -143,6 +149,8 @@ sun/jvm/hotspot/code/*.java \
|
||||
sun/jvm/hotspot/compiler/*.java \
|
||||
sun/jvm/hotspot/debugger/*.java \
|
||||
sun/jvm/hotspot/debugger/amd64/*.java \
|
||||
+sun/jvm/hotspot/debugger/bsd/*.java \
|
||||
+sun/jvm/hotspot/debugger/bsd/x86/*.java \
|
||||
sun/jvm/hotspot/debugger/cdbg/*.java \
|
||||
sun/jvm/hotspot/debugger/cdbg/basic/*.java \
|
||||
sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \
|
@ -1,142 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_BsdDebuggerLocal_c,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/BsdDebuggerLocal.c.orig Tue Jun 2 12:59:31 2009
|
||||
+++ hotspot/agent/src/os/bsd/BsdDebuggerLocal.c Tue Jun 2 12:59:42 2009
|
||||
@@ -22,6 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+#include <stdlib.h>
|
||||
#include <jni.h>
|
||||
#include "libproc.h"
|
||||
|
||||
@@ -73,7 +74,7 @@ JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_b
|
||||
(JNIEnv *env, jclass cls) {
|
||||
jclass listClass;
|
||||
|
||||
- if (init_libproc(getenv("LIBSAPROC_DEBUG")) != true) {
|
||||
+ if (init_libproc(getenv("LIBSAPROC_DEBUG") != NULL) != true) {
|
||||
THROW_NEW_DEBUGGER_EXCEPTION("can't initialize libproc");
|
||||
}
|
||||
|
||||
@@ -275,7 +276,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debu
|
||||
bufPtr = (*env)->GetByteArrayElements(env, array, &isCopy);
|
||||
CHECK_EXCEPTION_(0);
|
||||
|
||||
- err = ps_pdread(get_proc_handle(env, this_obj), (psaddr_t) (uintptr_t)addr, bufPtr, numBytes);
|
||||
+ err = ps_pread(get_proc_handle(env, this_obj), (psaddr_t) (uintptr_t)addr, bufPtr, numBytes);
|
||||
(*env)->ReleaseByteArrayElements(env, array, bufPtr, 0);
|
||||
return (err == PS_OK)? array : 0;
|
||||
}
|
||||
@@ -283,11 +284,10 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debu
|
||||
JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
|
||||
(JNIEnv *env, jobject this_obj, jint lwp_id) {
|
||||
|
||||
- struct user_regs_struct gregs;
|
||||
+ struct reg gregs;
|
||||
jboolean isCopy;
|
||||
jlongArray array;
|
||||
jlong *regs;
|
||||
- int i;
|
||||
|
||||
struct ps_prochandle* ph = get_proc_handle(env, this_obj);
|
||||
if (get_lwp_regs(ph, lwp_id, &gregs) != true) {
|
||||
@@ -317,26 +317,27 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debu
|
||||
#ifdef i386
|
||||
#define REG_INDEX(reg) sun_jvm_hotspot_debugger_x86_X86ThreadContext_##reg
|
||||
|
||||
- regs[REG_INDEX(GS)] = (uintptr_t) gregs.xgs;
|
||||
- regs[REG_INDEX(FS)] = (uintptr_t) gregs.xfs;
|
||||
- regs[REG_INDEX(ES)] = (uintptr_t) gregs.xes;
|
||||
- regs[REG_INDEX(DS)] = (uintptr_t) gregs.xds;
|
||||
- regs[REG_INDEX(EDI)] = (uintptr_t) gregs.edi;
|
||||
- regs[REG_INDEX(ESI)] = (uintptr_t) gregs.esi;
|
||||
- regs[REG_INDEX(FP)] = (uintptr_t) gregs.ebp;
|
||||
- regs[REG_INDEX(SP)] = (uintptr_t) gregs.esp;
|
||||
- regs[REG_INDEX(EBX)] = (uintptr_t) gregs.ebx;
|
||||
- regs[REG_INDEX(EDX)] = (uintptr_t) gregs.edx;
|
||||
- regs[REG_INDEX(ECX)] = (uintptr_t) gregs.ecx;
|
||||
- regs[REG_INDEX(EAX)] = (uintptr_t) gregs.eax;
|
||||
- regs[REG_INDEX(PC)] = (uintptr_t) gregs.eip;
|
||||
- regs[REG_INDEX(CS)] = (uintptr_t) gregs.xcs;
|
||||
- regs[REG_INDEX(SS)] = (uintptr_t) gregs.xss;
|
||||
+ regs[REG_INDEX(GS)] = (uintptr_t) gregs.r_gs;
|
||||
+ regs[REG_INDEX(FS)] = (uintptr_t) gregs.r_fs;
|
||||
+ regs[REG_INDEX(ES)] = (uintptr_t) gregs.r_es;
|
||||
+ regs[REG_INDEX(DS)] = (uintptr_t) gregs.r_ds;
|
||||
+ regs[REG_INDEX(EDI)] = (uintptr_t) gregs.r_edi;
|
||||
+ regs[REG_INDEX(ESI)] = (uintptr_t) gregs.r_esi;
|
||||
+ regs[REG_INDEX(FP)] = (uintptr_t) gregs.r_ebp;
|
||||
+ regs[REG_INDEX(SP)] = (uintptr_t) gregs.r_isp;
|
||||
+ regs[REG_INDEX(EBX)] = (uintptr_t) gregs.r_ebx;
|
||||
+ regs[REG_INDEX(EDX)] = (uintptr_t) gregs.r_edx;
|
||||
+ regs[REG_INDEX(ECX)] = (uintptr_t) gregs.r_ecx;
|
||||
+ regs[REG_INDEX(EAX)] = (uintptr_t) gregs.r_eax;
|
||||
+ regs[REG_INDEX(PC)] = (uintptr_t) gregs.r_eip;
|
||||
+ regs[REG_INDEX(CS)] = (uintptr_t) gregs.r_cs;
|
||||
+ regs[REG_INDEX(SS)] = (uintptr_t) gregs.r_ss;
|
||||
|
||||
#endif /* i386 */
|
||||
|
||||
#if ia64
|
||||
regs = (*env)->GetLongArrayElements(env, array, &isCopy);
|
||||
+ int i;
|
||||
for (i = 0; i < NPRGREG; i++ ) {
|
||||
regs[i] = 0xDEADDEAD;
|
||||
}
|
||||
@@ -345,31 +346,31 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debu
|
||||
#ifdef amd64
|
||||
#define REG_INDEX(reg) sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_##reg
|
||||
|
||||
- regs[REG_INDEX(R15)] = gregs.r15;
|
||||
- regs[REG_INDEX(R14)] = gregs.r14;
|
||||
- regs[REG_INDEX(R13)] = gregs.r13;
|
||||
- regs[REG_INDEX(R12)] = gregs.r12;
|
||||
- regs[REG_INDEX(RBP)] = gregs.rbp;
|
||||
- regs[REG_INDEX(RBX)] = gregs.rbx;
|
||||
- regs[REG_INDEX(R11)] = gregs.r11;
|
||||
- regs[REG_INDEX(R10)] = gregs.r10;
|
||||
- regs[REG_INDEX(R9)] = gregs.r9;
|
||||
- regs[REG_INDEX(R8)] = gregs.r8;
|
||||
- regs[REG_INDEX(RAX)] = gregs.rax;
|
||||
- regs[REG_INDEX(RCX)] = gregs.rcx;
|
||||
- regs[REG_INDEX(RDX)] = gregs.rdx;
|
||||
- regs[REG_INDEX(RSI)] = gregs.rsi;
|
||||
- regs[REG_INDEX(RDI)] = gregs.rdi;
|
||||
- regs[REG_INDEX(RIP)] = gregs.rip;
|
||||
- regs[REG_INDEX(CS)] = gregs.cs;
|
||||
- regs[REG_INDEX(RSP)] = gregs.rsp;
|
||||
- regs[REG_INDEX(SS)] = gregs.ss;
|
||||
- regs[REG_INDEX(FSBASE)] = gregs.fs_base;
|
||||
- regs[REG_INDEX(GSBASE)] = gregs.gs_base;
|
||||
- regs[REG_INDEX(DS)] = gregs.ds;
|
||||
- regs[REG_INDEX(ES)] = gregs.es;
|
||||
- regs[REG_INDEX(FS)] = gregs.fs;
|
||||
- regs[REG_INDEX(GS)] = gregs.gs;
|
||||
+ regs[REG_INDEX(R15)] = gregs.r_r15;
|
||||
+ regs[REG_INDEX(R14)] = gregs.r_r14;
|
||||
+ regs[REG_INDEX(R13)] = gregs.r_r13;
|
||||
+ regs[REG_INDEX(R12)] = gregs.r_r12;
|
||||
+ regs[REG_INDEX(RBP)] = gregs.r_rbp;
|
||||
+ regs[REG_INDEX(RBX)] = gregs.r_rbx;
|
||||
+ regs[REG_INDEX(R11)] = gregs.r_r11;
|
||||
+ regs[REG_INDEX(R10)] = gregs.r_r10;
|
||||
+ regs[REG_INDEX(R9)] = gregs.r_r9;
|
||||
+ regs[REG_INDEX(R8)] = gregs.r_r8;
|
||||
+ regs[REG_INDEX(RAX)] = gregs.r_rax;
|
||||
+ regs[REG_INDEX(RCX)] = gregs.r_rcx;
|
||||
+ regs[REG_INDEX(RDX)] = gregs.r_rdx;
|
||||
+ regs[REG_INDEX(RSI)] = gregs.r_rsi;
|
||||
+ regs[REG_INDEX(RDI)] = gregs.r_rdi;
|
||||
+ regs[REG_INDEX(RIP)] = gregs.r_rip;
|
||||
+ regs[REG_INDEX(CS)] = gregs.r_cs;
|
||||
+ regs[REG_INDEX(RSP)] = gregs.r_rsp;
|
||||
+ regs[REG_INDEX(SS)] = gregs.r_ss;
|
||||
+// regs[REG_INDEX(FSBASE)] = gregs.fs_base;
|
||||
+// regs[REG_INDEX(GSBASE)] = gregs.gs_base;
|
||||
+// regs[REG_INDEX(DS)] = gregs.ds;
|
||||
+// regs[REG_INDEX(ES)] = gregs.es;
|
||||
+// regs[REG_INDEX(FS)] = gregs.fs;
|
||||
+// regs[REG_INDEX(GS)] = gregs.gs;
|
||||
|
||||
#endif /* amd64 */
|
||||
|
@ -1,77 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_Makefile,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/Makefile.orig Mon Oct 25 18:02:17 2010
|
||||
+++ hotspot/agent/src/os/bsd/Makefile Mon Oct 25 18:40:03 2010
|
||||
@@ -22,7 +22,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
-ARCH := $(shell if ([ `uname -m` = "ia64" ]) ; then echo ia64 ; elif ([ `uname -m` = "x86_64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi )
|
||||
+ARCH := $(shell if ([ `uname -m` = "ia64" ]) ; then echo ia64 ; elif ([ `uname -m` = "amd64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi )
|
||||
GCC = gcc
|
||||
|
||||
JAVAH = ${JAVA_HOME}/bin/javah
|
||||
@@ -32,25 +32,25 @@ SOURCES = salibelf.c \
|
||||
libproc_impl.c \
|
||||
ps_proc.c \
|
||||
ps_core.c \
|
||||
- BsdDebuggerLocal.c
|
||||
+ hsearch_r.c \
|
||||
+ BsdDebuggerLocal.c
|
||||
|
||||
-INCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/bsd
|
||||
+INCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
|
||||
|
||||
OBJS = $(SOURCES:.c=.o)
|
||||
|
||||
-LIBS = -lthread_db
|
||||
+LIBS = -lutil -lthread_db
|
||||
|
||||
-CFLAGS = -c -fPIC -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES)
|
||||
+CFLAGS = -c -fPIC -g -Wall -D_ALLBSD_SOURCE -D_GNU_SOURCE -D$(ARCH) $(INCLUDES)
|
||||
|
||||
LIBSA = $(ARCH)/libsaproc.so
|
||||
|
||||
all: $(LIBSA)
|
||||
|
||||
BsdDebuggerLocal.o: BsdDebuggerLocal.c
|
||||
- $(JAVAH) -jni -classpath ../../../build/classes \
|
||||
+ $(JAVAH) -jni -classpath ../../../../../build/bsd-i586/hotspot/outputdir/bsd_i486_compiler2/generated/saclasses \
|
||||
sun.jvm.hotspot.debugger.x86.X86ThreadContext \
|
||||
- sun.jvm.hotspot.debugger.sparc.SPARCThreadContext \
|
||||
- sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
|
||||
+ sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
|
||||
$(GCC) $(CFLAGS) $<
|
||||
|
||||
.c.obj:
|
||||
@@ -60,26 +60,19 @@ ifndef LDNOMAP
|
||||
LFLAGS_LIBSA = -Xlinker --version-script=mapfile
|
||||
endif
|
||||
|
||||
-# If this is a --hash-style=gnu system, use --hash-style=both
|
||||
-# The gnu .hash section won't work on some Bsd systems like SuSE 10.
|
||||
-_HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
|
||||
-ifneq ($(_HAS_HASH_STYLE_GNU),)
|
||||
- LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
|
||||
-endif
|
||||
-LFLAGS_LIBSA += $(LDFLAGS_HASH_STYLE)
|
||||
-
|
||||
$(LIBSA): $(OBJS) mapfile
|
||||
if [ ! -d $(ARCH) ] ; then mkdir $(ARCH) ; fi
|
||||
$(GCC) -shared $(LFLAGS_LIBSA) -o $(LIBSA) $(OBJS) $(LIBS)
|
||||
|
||||
-test.o: test.c
|
||||
+test.o: $(LIBSA) test.c
|
||||
$(GCC) -c -o test.o -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) test.c
|
||||
|
||||
test: test.o
|
||||
$(GCC) -o test test.o -L$(ARCH) -lsaproc $(LIBS)
|
||||
|
||||
clean:
|
||||
- rm -rf $(LIBSA)
|
||||
- rm -rf $(OBJS)
|
||||
- rmdir $(ARCH)
|
||||
+ rm -f $(LIBSA)
|
||||
+ rm -f $(OBJS)
|
||||
+ rm -f test.o
|
||||
+ -rmdir $(ARCH)
|
||||
|
@ -1,124 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_StubDebuggerLocal_c,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/StubDebuggerLocal.c.orig Tue Jun 2 13:02:17 2009
|
||||
+++ hotspot/agent/src/os/bsd/StubDebuggerLocal.c Tue Jun 2 13:02:28 2009
|
||||
@@ -0,0 +1,120 @@
|
||||
+/*
|
||||
+ * Copyright 2002-2007 Sun Microsystems, Inc. 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
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
+ * CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
+ * have any questions.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <jni.h>
|
||||
+
|
||||
+#define CHECK_EXCEPTION_(value) if ((*env)->ExceptionOccurred(env)) { return value; }
|
||||
+#define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;}
|
||||
+#define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; }
|
||||
+#define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;}
|
||||
+
|
||||
+static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
|
||||
+ (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
||||
+ * Method: init0
|
||||
+ * Signature: ()V
|
||||
+ */
|
||||
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0
|
||||
+ (JNIEnv *env, jclass cls) {
|
||||
+}
|
||||
+
|
||||
+JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize
|
||||
+ (JNIEnv *env, jclass cls)
|
||||
+{
|
||||
+#ifdef _LP64
|
||||
+ return 8;
|
||||
+#else
|
||||
+ return 4;
|
||||
+#endif
|
||||
+
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
||||
+ * Method: attach0
|
||||
+ * Signature: (I)V
|
||||
+ */
|
||||
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I
|
||||
+ (JNIEnv *env, jobject this_obj, jint jpid) {
|
||||
+
|
||||
+ THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
||||
+ * Method: attach0
|
||||
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
|
||||
+ */
|
||||
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2
|
||||
+ (JNIEnv *env, jobject this_obj, jstring execName, jstring coreName) {
|
||||
+ THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the core file");
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
||||
+ * Method: detach0
|
||||
+ * Signature: ()V
|
||||
+ */
|
||||
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0
|
||||
+ (JNIEnv *env, jobject this_obj) {
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
||||
+ * Method: lookupByName0
|
||||
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)J
|
||||
+ */
|
||||
+JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0
|
||||
+ (JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) {
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
||||
+ * Method: lookupByAddress0
|
||||
+ * Signature: (J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;
|
||||
+ */
|
||||
+JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0
|
||||
+ (JNIEnv *env, jobject this_obj, jlong addr) {
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
||||
+ * Method: readBytesFromProcess0
|
||||
+ * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
|
||||
+ */
|
||||
+JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0
|
||||
+ (JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) {
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
|
||||
+ (JNIEnv *env, jobject this_obj, jint lwp_id) {
|
||||
+ return 0;
|
||||
+}
|
@ -1,38 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_elfmacros_h,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/elfmacros.h.orig Tue Jun 2 13:02:46 2009
|
||||
+++ hotspot/agent/src/os/bsd/elfmacros.h Tue Jun 2 13:02:52 2009
|
||||
@@ -25,16 +25,19 @@
|
||||
#ifndef _ELFMACROS_H_
|
||||
#define _ELFMACROS_H_
|
||||
|
||||
+#define ELF_NHDR Elf_Note
|
||||
+
|
||||
#if defined(_LP64)
|
||||
#define ELF_EHDR Elf64_Ehdr
|
||||
#define ELF_SHDR Elf64_Shdr
|
||||
#define ELF_PHDR Elf64_Phdr
|
||||
#define ELF_SYM Elf64_Sym
|
||||
-#define ELF_NHDR Elf64_Nhdr
|
||||
#define ELF_DYN Elf64_Dyn
|
||||
#define ELF_ADDR Elf64_Addr
|
||||
|
||||
+#ifndef ELF_ST_TYPE
|
||||
#define ELF_ST_TYPE ELF64_ST_TYPE
|
||||
+#endif
|
||||
|
||||
#else
|
||||
|
||||
@@ -42,11 +45,12 @@
|
||||
#define ELF_SHDR Elf32_Shdr
|
||||
#define ELF_PHDR Elf32_Phdr
|
||||
#define ELF_SYM Elf32_Sym
|
||||
-#define ELF_NHDR Elf32_Nhdr
|
||||
#define ELF_DYN Elf32_Dyn
|
||||
#define ELF_ADDR Elf32_Addr
|
||||
|
||||
+#ifndef ELF_ST_TYPE
|
||||
#define ELF_ST_TYPE ELF32_ST_TYPE
|
||||
+#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,221 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_hsearch_r_c,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/hsearch_r.c.orig Tue Jun 2 13:03:08 2009
|
||||
+++ hotspot/agent/src/os/bsd/hsearch_r.c Tue Jun 2 13:03:18 2009
|
||||
@@ -0,0 +1,217 @@
|
||||
+/* Copyright (C) 1993,1995-1997,2002,2005,2007,2008
|
||||
+ Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include <search.h>
|
||||
+
|
||||
+#include "hsearch_r.h"
|
||||
+
|
||||
+#define __set_errno(ERRNO) errno = ERRNO
|
||||
+
|
||||
+/* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986
|
||||
+ [Knuth] The Art of Computer Programming, part 3 (6.4) */
|
||||
+
|
||||
+
|
||||
+/* The reentrant version has no static variables to maintain the state.
|
||||
+ Instead the interface of all functions is extended to take an argument
|
||||
+ which describes the current status. */
|
||||
+typedef struct _ENTRY
|
||||
+{
|
||||
+ unsigned int used;
|
||||
+ ENTRY entry;
|
||||
+}
|
||||
+_ENTRY;
|
||||
+
|
||||
+
|
||||
+/* For the used double hash method the table size has to be a prime. To
|
||||
+ correct the user given table size we need a prime test. This trivial
|
||||
+ algorithm is adequate because
|
||||
+ a) the code is (most probably) called a few times per program run and
|
||||
+ b) the number is small because the table must fit in the core */
|
||||
+static int
|
||||
+isprime (unsigned int number)
|
||||
+{
|
||||
+ /* no even number will be passed */
|
||||
+ unsigned int div = 3;
|
||||
+
|
||||
+ while (div * div < number && number % div != 0)
|
||||
+ div += 2;
|
||||
+
|
||||
+ return number % div != 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* Before using the hash table we must allocate memory for it.
|
||||
+ Test for an existing table are done. We allocate one element
|
||||
+ more as the found prime number says. This is done for more effective
|
||||
+ indexing as explained in the comment for the hsearch function.
|
||||
+ The contents of the table is zeroed, especially the field used
|
||||
+ becomes zero. */
|
||||
+int
|
||||
+hcreate_r (size_t nel, struct hsearch_data *htab)
|
||||
+{
|
||||
+ /* Test for correct arguments. */
|
||||
+ if (htab == NULL)
|
||||
+ {
|
||||
+ __set_errno (EINVAL);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* There is still another table active. Return with error. */
|
||||
+ if (htab->table != NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Change nel to the first prime number not smaller as nel. */
|
||||
+ nel |= 1; /* make odd */
|
||||
+ while (!isprime (nel))
|
||||
+ nel += 2;
|
||||
+
|
||||
+ htab->size = nel;
|
||||
+ htab->filled = 0;
|
||||
+
|
||||
+ /* allocate memory and zero out */
|
||||
+ htab->table = (_ENTRY *) calloc (htab->size + 1, sizeof (_ENTRY));
|
||||
+ if (htab->table == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* everything went alright */
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* After using the hash table it has to be destroyed. The used memory can
|
||||
+ be freed and the local static variable can be marked as not used. */
|
||||
+void
|
||||
+hdestroy_r (struct hsearch_data *htab)
|
||||
+{
|
||||
+ /* Test for correct arguments. */
|
||||
+ if (htab == NULL)
|
||||
+ {
|
||||
+ __set_errno (EINVAL);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Free used memory. */
|
||||
+ free (htab->table);
|
||||
+
|
||||
+ /* the sign for an existing table is an value != NULL in htable */
|
||||
+ htab->table = NULL;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* This is the search function. It uses double hashing with open addressing.
|
||||
+ The argument item.key has to be a pointer to an zero terminated, most
|
||||
+ probably strings of chars. The function for generating a number of the
|
||||
+ strings is simple but fast. It can be replaced by a more complex function
|
||||
+ like ajw (see [Aho,Sethi,Ullman]) if the needs are shown.
|
||||
+
|
||||
+ We use an trick to speed up the lookup. The table is created by hcreate
|
||||
+ with one more element available. This enables us to use the index zero
|
||||
+ special. This index will never be used because we store the first hash
|
||||
+ index in the field used where zero means not used. Every other value
|
||||
+ means used. The used field can be used as a first fast comparison for
|
||||
+ equality of the stored and the parameter value. This helps to prevent
|
||||
+ unnecessary expensive calls of strcmp. */
|
||||
+int
|
||||
+hsearch_r (ENTRY item, ACTION action, ENTRY **retval, struct hsearch_data *htab)
|
||||
+{
|
||||
+ unsigned int hval;
|
||||
+ unsigned int count;
|
||||
+ unsigned int len = strlen (item.key);
|
||||
+ unsigned int idx;
|
||||
+
|
||||
+ /* Compute an value for the given string. Perhaps use a better method. */
|
||||
+ hval = len;
|
||||
+ count = len;
|
||||
+ while (count-- > 0)
|
||||
+ {
|
||||
+ hval <<= 4;
|
||||
+ hval += item.key[count];
|
||||
+ }
|
||||
+
|
||||
+ /* First hash function: simply take the modul but prevent zero. */
|
||||
+ idx = hval % htab->size + 1;
|
||||
+
|
||||
+ if (htab->table[idx].used)
|
||||
+ {
|
||||
+ /* Further action might be required according to the action value. */
|
||||
+ if (htab->table[idx].used == hval
|
||||
+ && strcmp (item.key, htab->table[idx].entry.key) == 0)
|
||||
+ {
|
||||
+ *retval = &htab->table[idx].entry;
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ /* Second hash function, as suggested in [Knuth] */
|
||||
+ unsigned int hval2 = 1 + hval % (htab->size - 2);
|
||||
+ unsigned int first_idx = idx;
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ /* Because SIZE is prime this guarantees to step through all
|
||||
+ available indeces. */
|
||||
+ if (idx <= hval2)
|
||||
+ idx = htab->size + idx - hval2;
|
||||
+ else
|
||||
+ idx -= hval2;
|
||||
+
|
||||
+ /* If we visited all entries leave the loop unsuccessfully. */
|
||||
+ if (idx == first_idx)
|
||||
+ break;
|
||||
+
|
||||
+ /* If entry is found use it. */
|
||||
+ if (htab->table[idx].used == hval
|
||||
+ && strcmp (item.key, htab->table[idx].entry.key) == 0)
|
||||
+ {
|
||||
+ *retval = &htab->table[idx].entry;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+ while (htab->table[idx].used);
|
||||
+ }
|
||||
+
|
||||
+ /* An empty bucket has been found. */
|
||||
+ if (action == ENTER)
|
||||
+ {
|
||||
+ /* If table is full and another entry should be entered return
|
||||
+ with error. */
|
||||
+ if (htab->filled == htab->size)
|
||||
+ {
|
||||
+ __set_errno (ENOMEM);
|
||||
+ *retval = NULL;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ htab->table[idx].used = hval;
|
||||
+ htab->table[idx].entry = item;
|
||||
+
|
||||
+ ++htab->filled;
|
||||
+
|
||||
+ *retval = &htab->table[idx].entry;
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ __set_errno (ESRCH);
|
||||
+ *retval = NULL;
|
||||
+ return 0;
|
||||
+}
|
@ -1,46 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_hsearch_r_h,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/hsearch_r.h.orig Tue Jun 2 13:03:25 2009
|
||||
+++ hotspot/agent/src/os/bsd/hsearch_r.h Tue Jun 2 13:03:34 2009
|
||||
@@ -0,0 +1,42 @@
|
||||
+/* Declarations for System V style searching functions.
|
||||
+ Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#ifndef _HSEARCH_R_H_
|
||||
+#define _HSEARCH_R_H_
|
||||
+
|
||||
+#include <search.h>
|
||||
+
|
||||
+struct _ENTRY;
|
||||
+
|
||||
+/* Data type for reentrant functions. */
|
||||
+struct hsearch_data
|
||||
+ {
|
||||
+ struct _ENTRY *table;
|
||||
+ unsigned int size;
|
||||
+ unsigned int filled;
|
||||
+ };
|
||||
+
|
||||
+/* Reentrant versions which can handle multiple hashing tables at the
|
||||
+ same time. */
|
||||
+extern int hsearch_r (ENTRY __item, ACTION __action, ENTRY **__retval,
|
||||
+ struct hsearch_data *__htab);
|
||||
+extern int hcreate_r (size_t __nel, struct hsearch_data *__htab);
|
||||
+extern void hdestroy_r (struct hsearch_data *__htab);
|
||||
+
|
||||
+#endif /* _HSEARCH_R_H_ */
|
@ -1,63 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_libproc_h,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/libproc.h.orig Tue Jun 2 13:03:57 2009
|
||||
+++ hotspot/agent/src/os/bsd/libproc.h Tue Jun 2 13:04:07 2009
|
||||
@@ -27,7 +27,8 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
-#include "proc_service.h"
|
||||
+#include <machine/reg.h>
|
||||
+#include <proc_service.h>
|
||||
|
||||
#if defined(sparc) || defined(sparcv9)
|
||||
/*
|
||||
@@ -50,14 +51,11 @@ Please note that the bulk of the functionality is from
|
||||
adds Pgrab__ and some missing stuff. We hide the difference b/w live process and core
|
||||
file by this interface.
|
||||
|
||||
-1. pthread_id unique in both NPTL & BsdThreads. We store this in
|
||||
-OSThread::_pthread_id in JVM code.
|
||||
+1. pthread_id is unique. We store this in OSThread::_pthread_id in JVM code.
|
||||
|
||||
-2. All threads see the same pid when they call getpid() under NPTL.
|
||||
-Threads receive different pid under BsdThreads. We used to save the result of
|
||||
-::getpid() call in OSThread::_thread_id. This way uniqueness of OSThread::_thread_id
|
||||
-was lost under NPTL. Now, we store the result of ::gettid() call in
|
||||
-OSThread::_thread_id. Because gettid returns actual pid of thread (lwp id), this is
|
||||
+2. All threads see the same pid when they call getpid().
|
||||
+We used to save the result of ::getpid() call in OSThread::_thread_id.
|
||||
+Because gettid returns actual pid of thread (lwp id), this is
|
||||
unique again. We therefore use OSThread::_thread_id as unique identifier.
|
||||
|
||||
3. There is a unique LWP id under both thread libraries. libthread_db maps pthread_id
|
||||
@@ -74,20 +72,7 @@ combination of ptrace and /proc calls.
|
||||
|
||||
*************************************************************************************/
|
||||
|
||||
-#ifdef ia64
|
||||
-struct user_regs_struct {
|
||||
-/* copied from user.h which doesn't define this in a struct */
|
||||
-
|
||||
-#define IA64_REG_COUNT (EF_SIZE/8+32) /* integer and fp regs */
|
||||
-unsigned long regs[IA64_REG_COUNT]; /* integer and fp regs */
|
||||
-};
|
||||
-#endif
|
||||
-
|
||||
-#if defined(sparc) || defined(sparcv9)
|
||||
-#define user_regs_struct pt_regs
|
||||
-#endif
|
||||
-
|
||||
-// This C bool type must be int for compatibility with Bsd calls and
|
||||
+// This C bool type must be int for compatibility with BSD calls and
|
||||
// it would be a mistake to equivalence it to C++ bool on many platforms
|
||||
|
||||
typedef int bool;
|
||||
@@ -118,7 +103,7 @@ int get_num_threads(struct ps_prochandle* ph);
|
||||
lwpid_t get_lwp_id(struct ps_prochandle* ph, int index);
|
||||
|
||||
// get regs for a given lwp
|
||||
-bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct user_regs_struct* regs);
|
||||
+bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct reg* regs);
|
||||
|
||||
// get number of shared objects
|
||||
int get_num_libs(struct ps_prochandle* ph);
|
@ -1,102 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_libproc_impl_c,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/libproc_impl.c.orig Mon Oct 25 18:02:17 2010
|
||||
+++ hotspot/agent/src/os/bsd/libproc_impl.c Mon Oct 25 18:40:51 2010
|
||||
@@ -174,10 +174,13 @@ lib_info* add_lib_info_fd(struct ps_prochandle* ph, co
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- newlib->symtab = build_symtab(newlib->fd, libname);
|
||||
+ newlib->symtab = build_symtab(newlib->fd);
|
||||
if (newlib->symtab == NULL) {
|
||||
print_debug("symbol table build failed for %s\n", newlib->name);
|
||||
}
|
||||
+ else {
|
||||
+ print_debug("built symbol table for %s\n", newlib->name);
|
||||
+ }
|
||||
|
||||
// even if symbol table building fails, we add the lib_info.
|
||||
// This is because we may need to read from the ELF file for core file
|
||||
@@ -272,7 +275,7 @@ static int thread_db_callback(const td_thrhandle_t *th
|
||||
|
||||
print_debug("thread_db : pthread %d (lwp %d)\n", ti.ti_tid, ti.ti_lid);
|
||||
|
||||
- if (ptr->callback(ptr->ph, ti.ti_tid, ti.ti_lid) != true)
|
||||
+ if (ptr->callback(ptr->ph, (pthread_t)ti.ti_tid, ti.ti_lid) != true)
|
||||
return TD_ERR;
|
||||
|
||||
return TD_OK;
|
||||
@@ -324,7 +327,7 @@ lwpid_t get_lwp_id(struct ps_prochandle* ph, int index
|
||||
}
|
||||
|
||||
// get regs for a given lwp
|
||||
-bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id, struct user_regs_struct* regs) {
|
||||
+bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id, struct reg* regs) {
|
||||
return ph->ops->get_lwp_regs(ph, lwp_id, regs);
|
||||
}
|
||||
|
||||
@@ -375,11 +378,6 @@ bool find_lib(struct ps_prochandle* ph, const char *li
|
||||
//--------------------------------------------------------------------------
|
||||
// proc service functions
|
||||
|
||||
-// get process id
|
||||
-pid_t ps_getpid(struct ps_prochandle *ph) {
|
||||
- return ph->pid;
|
||||
-}
|
||||
-
|
||||
// ps_pglobal_lookup() looks up the symbol sym_name in the symbol table
|
||||
// of the load object object_name in the target process identified by ph.
|
||||
// It returns the symbol's value as an address in the target process in
|
||||
@@ -392,17 +390,33 @@ ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, c
|
||||
}
|
||||
|
||||
// read "size" bytes info "buf" from address "addr"
|
||||
-ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr,
|
||||
- void *buf, size_t size) {
|
||||
+ps_err_e ps_pread(struct ps_prochandle *ph, psaddr_t addr,
|
||||
+ void *buf, size_t size) {
|
||||
return ph->ops->p_pread(ph, (uintptr_t) addr, buf, size)? PS_OK: PS_ERR;
|
||||
}
|
||||
|
||||
// write "size" bytes of data to debuggee at address "addr"
|
||||
-ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
|
||||
- const void *buf, size_t size) {
|
||||
+ps_err_e ps_pwrite(struct ps_prochandle *ph, psaddr_t addr,
|
||||
+ const void *buf, size_t size) {
|
||||
return ph->ops->p_pwrite(ph, (uintptr_t)addr, buf, size)? PS_OK: PS_ERR;
|
||||
}
|
||||
|
||||
+// fill in ptrace_lwpinfo for lid
|
||||
+ps_err_e ps_linfo(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) {
|
||||
+ return ph->ops->get_lwp_info(ph, lwp_id, linfo)? PS_OK: PS_ERR;
|
||||
+}
|
||||
+
|
||||
+// needed for when libthread_db is compiled with TD_DEBUG defined
|
||||
+void
|
||||
+ps_plog (const char *format, ...)
|
||||
+{
|
||||
+ va_list alist;
|
||||
+
|
||||
+ va_start(alist, format);
|
||||
+ vfprintf(stderr, format, alist);
|
||||
+ va_end(alist);
|
||||
+}
|
||||
+
|
||||
// ------------------------------------------------------------------------
|
||||
// Functions below this point are not yet implemented. They are here only
|
||||
// to make the linker happy.
|
||||
@@ -427,8 +441,12 @@ ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t
|
||||
return PS_OK;
|
||||
}
|
||||
|
||||
-// new libthread_db of NPTL seem to require this symbol
|
||||
-ps_err_e ps_get_thread_area() {
|
||||
- print_debug("ps_get_thread_area not implemented\n");
|
||||
+ps_err_e ps_lstop(struct ps_prochandle *ph, lwpid_t lid) {
|
||||
+ print_debug("ps_lstop not implemented\n");
|
||||
+ return PS_OK;
|
||||
+}
|
||||
+
|
||||
+ps_err_e ps_pcontinue(struct ps_prochandle *ph) {
|
||||
+ print_debug("ps_pcontinue not implemented\n");
|
||||
return PS_OK;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_libproc_impl_h,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/libproc_impl.h.orig Tue Jun 2 13:04:50 2009
|
||||
+++ hotspot/agent/src/os/bsd/libproc_impl.h Tue Jun 2 13:04:58 2009
|
||||
@@ -47,7 +47,7 @@ typedef struct lib_info {
|
||||
typedef struct thread_info {
|
||||
lwpid_t lwp_id;
|
||||
pthread_t pthread_id; // not used cores, always -1
|
||||
- struct user_regs_struct regs; // not for process, core uses for caching regset
|
||||
+ struct reg regs; // not for process, core uses for caching regset
|
||||
struct thread_info* next;
|
||||
} thread_info;
|
||||
|
||||
@@ -71,7 +71,9 @@ typedef struct ps_prochandle_ops {
|
||||
bool (*p_pwrite)(struct ps_prochandle *ph,
|
||||
uintptr_t addr, const char *buf , size_t size);
|
||||
// get integer regset of a thread
|
||||
- bool (*get_lwp_regs)(struct ps_prochandle* ph, lwpid_t lwp_id, struct user_regs_struct* regs);
|
||||
+ bool (*get_lwp_regs)(struct ps_prochandle* ph, lwpid_t lwp_id, struct reg* regs);
|
||||
+ // get info on thread
|
||||
+ bool (*get_lwp_info)(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo);
|
||||
} ps_prochandle_ops;
|
||||
|
||||
// the ps_prochandle
|
||||
@@ -79,7 +81,7 @@ typedef struct ps_prochandle_ops {
|
||||
struct core_data {
|
||||
int core_fd; // file descriptor of core file
|
||||
int exec_fd; // file descriptor of exec file
|
||||
- int interp_fd; // file descriptor of interpreter (ld-bsd.so.2)
|
||||
+ int interp_fd; // file descriptor of interpreter (ld-elf.so.1)
|
||||
// part of the class sharing workaround
|
||||
int classes_jsa_fd; // file descriptor of class share archive
|
||||
uintptr_t dynamic_addr; // address of dynamic section of a.out
|
@ -1,24 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_mapfile,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/mapfile.orig Tue Jun 2 13:05:13 2009
|
||||
+++ hotspot/agent/src/os/bsd/mapfile Tue Jun 2 13:05:19 2009
|
||||
@@ -43,13 +43,17 @@ SUNWprivate_1.1 {
|
||||
# proc_service.h functions - to be used by libthread_db
|
||||
ps_getpid;
|
||||
ps_pglobal_lookup;
|
||||
- ps_pdread;
|
||||
- ps_pdwrite;
|
||||
+ ps_pread;
|
||||
+ ps_pwrite;
|
||||
ps_lsetfpregs;
|
||||
ps_lsetregs;
|
||||
ps_lgetfpregs;
|
||||
ps_lgetregs;
|
||||
- ps_get_thread_area;
|
||||
+ ps_lcontinue;
|
||||
+ ps_lgetxmmregs;
|
||||
+ ps_lsetxmmregs;
|
||||
+ ps_lstop;
|
||||
+ ps_linfo;
|
||||
|
||||
# used by attach test program
|
||||
init_libproc;
|
@ -1,314 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_ps_core_c,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/ps_core.c.orig Mon Oct 25 18:02:17 2010
|
||||
+++ hotspot/agent/src/os/bsd/ps_core.c Mon Oct 25 18:42:03 2010
|
||||
@@ -142,6 +142,7 @@ static map_info* add_class_share_map_info(struct ps_pr
|
||||
|
||||
map->next = ph->core->class_share_maps;
|
||||
ph->core->class_share_maps = map;
|
||||
+ return map;
|
||||
}
|
||||
|
||||
// Return the map_info for the given virtual address. We keep a sorted
|
||||
@@ -228,8 +229,8 @@ struct FileMapHeader {
|
||||
|
||||
// 4991491 NOTICE These are C++ bool's in filemap.hpp and must match up with
|
||||
// the C type matching the C++ bool type on any given platform. For
|
||||
- // Hotspot on Bsd we assume the corresponding C type is char but
|
||||
- // licensees on Bsd versions may need to adjust the type of these fields.
|
||||
+ // Hotspot on BSD we assume the corresponding C type is char but
|
||||
+ // licensees on BSD versions may need to adjust the type of these fields.
|
||||
char _read_only; // read only space?
|
||||
char _allow_exec; // executable code in space?
|
||||
|
||||
@@ -240,7 +241,7 @@ struct FileMapHeader {
|
||||
|
||||
static bool read_jboolean(struct ps_prochandle* ph, uintptr_t addr, jboolean* pvalue) {
|
||||
jboolean i;
|
||||
- if (ps_pdread(ph, (psaddr_t) addr, &i, sizeof(i)) == PS_OK) {
|
||||
+ if (ps_pread(ph, (psaddr_t) addr, &i, sizeof(i)) == PS_OK) {
|
||||
*pvalue = i;
|
||||
return true;
|
||||
} else {
|
||||
@@ -250,7 +251,7 @@ static bool read_jboolean(struct ps_prochandle* ph, ui
|
||||
|
||||
static bool read_pointer(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* pvalue) {
|
||||
uintptr_t uip;
|
||||
- if (ps_pdread(ph, (psaddr_t) addr, &uip, sizeof(uip)) == PS_OK) {
|
||||
+ if (ps_pread(ph, (psaddr_t) addr, &uip, sizeof(uip)) == PS_OK) {
|
||||
*pvalue = uip;
|
||||
return true;
|
||||
} else {
|
||||
@@ -264,7 +265,7 @@ static bool read_string(struct ps_prochandle* ph, uint
|
||||
char c = ' ';
|
||||
|
||||
while (c != '\0') {
|
||||
- if (ps_pdread(ph, (psaddr_t) addr, &c, sizeof(char)) != PS_OK)
|
||||
+ if (ps_pread(ph, (psaddr_t) addr, &c, sizeof(char)) != PS_OK)
|
||||
return false;
|
||||
if (i < size - 1)
|
||||
buf[i] = c;
|
||||
@@ -296,7 +297,6 @@ static bool init_classsharing_workaround(struct ps_pro
|
||||
uintptr_t base = 0, useSharedSpacesAddr = 0;
|
||||
uintptr_t sharedArchivePathAddrAddr = 0, sharedArchivePathAddr = 0;
|
||||
jboolean useSharedSpaces = 0;
|
||||
- map_info* mi = 0;
|
||||
|
||||
memset(classes_jsa, 0, sizeof(classes_jsa));
|
||||
jvm_name = lib->name;
|
||||
@@ -306,9 +306,9 @@ static bool init_classsharing_workaround(struct ps_pro
|
||||
return false;
|
||||
}
|
||||
|
||||
- // Hotspot vm types are not exported to build this library. So
|
||||
- // using equivalent type jboolean to read the value of
|
||||
- // UseSharedSpaces which is same as hotspot type "bool".
|
||||
+ // Hotspot vm types are not exported to build this library. So
|
||||
+ // using equivalent type jboolean to read the value of
|
||||
+ // UseSharedSpaces which is same as hotspot type "bool".
|
||||
if (read_jboolean(ph, useSharedSpacesAddr, &useSharedSpaces) != true) {
|
||||
print_debug("can't read the value of 'UseSharedSpaces' flag\n");
|
||||
return false;
|
||||
@@ -507,12 +507,12 @@ static bool core_write_data(struct ps_prochandle* ph,
|
||||
}
|
||||
|
||||
static bool core_get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id,
|
||||
- struct user_regs_struct* regs) {
|
||||
+ struct reg* regs) {
|
||||
// for core we have cached the lwp regs from NOTE section
|
||||
thread_info* thr = ph->threads;
|
||||
while (thr) {
|
||||
if (thr->lwp_id == lwp_id) {
|
||||
- memcpy(regs, &thr->regs, sizeof(struct user_regs_struct));
|
||||
+ memcpy(regs, &thr->regs, sizeof(struct reg));
|
||||
return true;
|
||||
}
|
||||
thr = thr->next;
|
||||
@@ -520,11 +520,17 @@ static bool core_get_lwp_regs(struct ps_prochandle* ph
|
||||
return false;
|
||||
}
|
||||
|
||||
+static bool core_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) {
|
||||
+ print_debug("core_get_lwp_info not implemented\n");
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static ps_prochandle_ops core_ops = {
|
||||
.release= core_release,
|
||||
.p_pread= core_read_data,
|
||||
.p_pwrite= core_write_data,
|
||||
- .get_lwp_regs= core_get_lwp_regs
|
||||
+ .get_lwp_regs= core_get_lwp_regs,
|
||||
+ .get_lwp_info= core_get_lwp_info
|
||||
};
|
||||
|
||||
// read regs and create thread from NT_PRSTATUS entries from core file
|
||||
@@ -539,52 +545,52 @@ static bool core_handle_prstatus(struct ps_prochandle*
|
||||
return false;
|
||||
|
||||
// copy regs
|
||||
- memcpy(&newthr->regs, prstat->pr_reg, sizeof(struct user_regs_struct));
|
||||
+ memcpy(&newthr->regs, &prstat->pr_reg, sizeof(struct reg));
|
||||
|
||||
if (is_debug()) {
|
||||
print_debug("integer regset\n");
|
||||
#ifdef i386
|
||||
// print the regset
|
||||
- print_debug("\teax = 0x%x\n", newthr->regs.eax);
|
||||
- print_debug("\tebx = 0x%x\n", newthr->regs.ebx);
|
||||
- print_debug("\tecx = 0x%x\n", newthr->regs.ecx);
|
||||
- print_debug("\tedx = 0x%x\n", newthr->regs.edx);
|
||||
- print_debug("\tesp = 0x%x\n", newthr->regs.esp);
|
||||
- print_debug("\tebp = 0x%x\n", newthr->regs.ebp);
|
||||
- print_debug("\tesi = 0x%x\n", newthr->regs.esi);
|
||||
- print_debug("\tedi = 0x%x\n", newthr->regs.edi);
|
||||
- print_debug("\teip = 0x%x\n", newthr->regs.eip);
|
||||
+ print_debug("\teax = 0x%x\n", newthr->regs.r_eax);
|
||||
+ print_debug("\tebx = 0x%x\n", newthr->regs.r_ebx);
|
||||
+ print_debug("\tecx = 0x%x\n", newthr->regs.r_ecx);
|
||||
+ print_debug("\tedx = 0x%x\n", newthr->regs.r_edx);
|
||||
+ print_debug("\tesp = 0x%x\n", newthr->regs.r_esp);
|
||||
+ print_debug("\tebp = 0x%x\n", newthr->regs.r_ebp);
|
||||
+ print_debug("\tesi = 0x%x\n", newthr->regs.r_esi);
|
||||
+ print_debug("\tedi = 0x%x\n", newthr->regs.r_edi);
|
||||
+ print_debug("\teip = 0x%x\n", newthr->regs.r_eip);
|
||||
#endif
|
||||
|
||||
#if defined(amd64) || defined(x86_64)
|
||||
// print the regset
|
||||
- print_debug("\tr15 = 0x%lx\n", newthr->regs.r15);
|
||||
- print_debug("\tr14 = 0x%lx\n", newthr->regs.r14);
|
||||
- print_debug("\tr13 = 0x%lx\n", newthr->regs.r13);
|
||||
- print_debug("\tr12 = 0x%lx\n", newthr->regs.r12);
|
||||
- print_debug("\trbp = 0x%lx\n", newthr->regs.rbp);
|
||||
- print_debug("\trbx = 0x%lx\n", newthr->regs.rbx);
|
||||
- print_debug("\tr11 = 0x%lx\n", newthr->regs.r11);
|
||||
- print_debug("\tr10 = 0x%lx\n", newthr->regs.r10);
|
||||
- print_debug("\tr9 = 0x%lx\n", newthr->regs.r9);
|
||||
- print_debug("\tr8 = 0x%lx\n", newthr->regs.r8);
|
||||
- print_debug("\trax = 0x%lx\n", newthr->regs.rax);
|
||||
- print_debug("\trcx = 0x%lx\n", newthr->regs.rcx);
|
||||
- print_debug("\trdx = 0x%lx\n", newthr->regs.rdx);
|
||||
- print_debug("\trsi = 0x%lx\n", newthr->regs.rsi);
|
||||
- print_debug("\trdi = 0x%lx\n", newthr->regs.rdi);
|
||||
- print_debug("\torig_rax = 0x%lx\n", newthr->regs.orig_rax);
|
||||
- print_debug("\trip = 0x%lx\n", newthr->regs.rip);
|
||||
- print_debug("\tcs = 0x%lx\n", newthr->regs.cs);
|
||||
- print_debug("\teflags = 0x%lx\n", newthr->regs.eflags);
|
||||
- print_debug("\trsp = 0x%lx\n", newthr->regs.rsp);
|
||||
- print_debug("\tss = 0x%lx\n", newthr->regs.ss);
|
||||
- print_debug("\tfs_base = 0x%lx\n", newthr->regs.fs_base);
|
||||
- print_debug("\tgs_base = 0x%lx\n", newthr->regs.gs_base);
|
||||
- print_debug("\tds = 0x%lx\n", newthr->regs.ds);
|
||||
- print_debug("\tes = 0x%lx\n", newthr->regs.es);
|
||||
- print_debug("\tfs = 0x%lx\n", newthr->regs.fs);
|
||||
- print_debug("\tgs = 0x%lx\n", newthr->regs.gs);
|
||||
+ print_debug("\tr15 = 0x%lx\n", newthr->regs.r_r15);
|
||||
+ print_debug("\tr14 = 0x%lx\n", newthr->regs.r_r14);
|
||||
+ print_debug("\tr13 = 0x%lx\n", newthr->regs.r_r13);
|
||||
+ print_debug("\tr12 = 0x%lx\n", newthr->regs.r_r12);
|
||||
+ print_debug("\trbp = 0x%lx\n", newthr->regs.r_rbp);
|
||||
+ print_debug("\trbx = 0x%lx\n", newthr->regs.r_rbx);
|
||||
+ print_debug("\tr11 = 0x%lx\n", newthr->regs.r_r11);
|
||||
+ print_debug("\tr10 = 0x%lx\n", newthr->regs.r_r10);
|
||||
+ print_debug("\tr9 = 0x%lx\n", newthr->regs.r_r9);
|
||||
+ print_debug("\tr8 = 0x%lx\n", newthr->regs.r_r8);
|
||||
+ print_debug("\trax = 0x%lx\n", newthr->regs.r_rax);
|
||||
+ print_debug("\trcx = 0x%lx\n", newthr->regs.r_rcx);
|
||||
+ print_debug("\trdx = 0x%lx\n", newthr->regs.r_rdx);
|
||||
+ print_debug("\trsi = 0x%lx\n", newthr->regs.r_rsi);
|
||||
+ print_debug("\trdi = 0x%lx\n", newthr->regs.r_rdi);
|
||||
+ //print_debug("\torig_rax = 0x%lx\n", newthr->regs.orig_rax);
|
||||
+ print_debug("\trip = 0x%lx\n", newthr->regs.r_rip);
|
||||
+ print_debug("\tcs = 0x%lx\n", newthr->regs.r_cs);
|
||||
+ //print_debug("\teflags = 0x%lx\n", newthr->regs.eflags);
|
||||
+ print_debug("\trsp = 0x%lx\n", newthr->regs.r_rsp);
|
||||
+ print_debug("\tss = 0x%lx\n", newthr->regs.r_ss);
|
||||
+ //print_debug("\tfs_base = 0x%lx\n", newthr->regs.fs_base);
|
||||
+ //print_debug("\tgs_base = 0x%lx\n", newthr->regs.gs_base);
|
||||
+ //print_debug("\tds = 0x%lx\n", newthr->regs.ds);
|
||||
+ //print_debug("\tes = 0x%lx\n", newthr->regs.es);
|
||||
+ //print_debug("\tfs = 0x%lx\n", newthr->regs.fs);
|
||||
+ //print_debug("\tgs = 0x%lx\n", newthr->regs.gs);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -656,7 +662,7 @@ static bool read_core_segments(struct ps_prochandle* p
|
||||
* contains a set of saved /proc structures), and PT_LOAD (which
|
||||
* represents a memory mapping from the process's address space).
|
||||
*
|
||||
- * Difference b/w Solaris PT_NOTE and Bsd PT_NOTE:
|
||||
+ * Difference b/w Solaris PT_NOTE and BSD PT_NOTE:
|
||||
*
|
||||
* In Solaris there are two PT_NOTE segments the first PT_NOTE (if present)
|
||||
* contains /proc structs in the pre-2.6 unstructured /proc format. the last
|
||||
@@ -666,10 +672,10 @@ static bool read_core_segments(struct ps_prochandle* p
|
||||
* integer register set among other stuff. For each LWP, we have one lwpstatus
|
||||
* entry that has integer regset for that LWP.
|
||||
*
|
||||
- * Bsd threads are actually 'clone'd processes. To support core analysis
|
||||
- * of "multithreaded" process, Bsd creates more than one pstatus (called
|
||||
+ * Linux threads are actually 'clone'd processes. To support core analysis
|
||||
+ * of "multithreaded" process, Linux creates more than one pstatus (called
|
||||
* "prstatus") entry in PT_NOTE. Each prstatus entry has integer regset for one
|
||||
- * "thread". Please refer to Bsd kernel src file 'fs/binfmt_elf.c', in particular
|
||||
+ * "thread". Please refer to Linux kernel src file 'fs/binfmt_elf.c', in particular
|
||||
* function "elf_core_dump".
|
||||
*/
|
||||
|
||||
@@ -725,7 +731,7 @@ err:
|
||||
return false;
|
||||
}
|
||||
|
||||
-// process segments from interpreter (ld.so or ld-bsd.so)
|
||||
+// process segments from interpreter (ld-elf.so.1)
|
||||
static bool read_interp_segments(struct ps_prochandle* ph) {
|
||||
ELF_EHDR interp_ehdr;
|
||||
|
||||
@@ -826,7 +832,7 @@ static bool read_shared_lib_info(struct ps_prochandle*
|
||||
|
||||
dyn.d_tag = DT_NULL;
|
||||
while (dyn.d_tag != DT_DEBUG) {
|
||||
- if (ps_pdread(ph, (psaddr_t) addr, &dyn, sizeof(ELF_DYN)) != PS_OK) {
|
||||
+ if (ps_pread(ph, (psaddr_t) addr, &dyn, sizeof(ELF_DYN)) != PS_OK) {
|
||||
print_debug("can't read debug info from _DYNAMIC\n");
|
||||
return false;
|
||||
}
|
||||
@@ -836,23 +842,27 @@ static bool read_shared_lib_info(struct ps_prochandle*
|
||||
// we have got Dyn entry with DT_DEBUG
|
||||
debug_base = dyn.d_un.d_ptr;
|
||||
// at debug_base we have struct r_debug. This has first link map in r_map field
|
||||
- if (ps_pdread(ph, (psaddr_t) debug_base + FIRST_LINK_MAP_OFFSET,
|
||||
+ if (ps_pread(ph, (psaddr_t) debug_base + FIRST_LINK_MAP_OFFSET,
|
||||
&first_link_map_addr, sizeof(uintptr_t)) != PS_OK) {
|
||||
print_debug("can't read first link map address\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// read ld_base address from struct r_debug
|
||||
- if (ps_pdread(ph, (psaddr_t) debug_base + LD_BASE_OFFSET, &ld_base_addr,
|
||||
+ // XXX: There is no r_ldbase member on BSD
|
||||
+/*
|
||||
+ if (ps_pread(ph, (psaddr_t) debug_base + LD_BASE_OFFSET, &ld_base_addr,
|
||||
sizeof(uintptr_t)) != PS_OK) {
|
||||
print_debug("can't read ld base address\n");
|
||||
return false;
|
||||
}
|
||||
ph->core->ld_base_addr = ld_base_addr;
|
||||
+*/
|
||||
+ ph->core->ld_base_addr = 0;
|
||||
|
||||
print_debug("interpreter base address is 0x%lx\n", ld_base_addr);
|
||||
|
||||
- // now read segments from interp (i.e ld.so or ld-bsd.so)
|
||||
+ // now read segments from interp (i.e ld-elf.so.1)
|
||||
if (read_interp_segments(ph) != true)
|
||||
return false;
|
||||
|
||||
@@ -870,26 +880,23 @@ static bool read_shared_lib_info(struct ps_prochandle*
|
||||
// address mentioned in shared object and the actual virtual base where runtime
|
||||
// linker loaded it. We use "base diff" in read_lib_segments call below.
|
||||
|
||||
- if (ps_pdread(ph, (psaddr_t) link_map_addr + LINK_MAP_ADDR_OFFSET,
|
||||
+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_ADDR_OFFSET,
|
||||
&lib_base_diff, sizeof(uintptr_t)) != PS_OK) {
|
||||
print_debug("can't read shared object base address diff\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// read address of the name
|
||||
- if (ps_pdread(ph, (psaddr_t) link_map_addr + LINK_MAP_NAME_OFFSET,
|
||||
+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_NAME_OFFSET,
|
||||
&lib_name_addr, sizeof(uintptr_t)) != PS_OK) {
|
||||
print_debug("can't read address of shared object name\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// read name of the shared object
|
||||
- lib_name[0] = '\0';
|
||||
- if (lib_name_addr != 0 &&
|
||||
- read_string(ph, (uintptr_t) lib_name_addr, lib_name, sizeof(lib_name)) != true) {
|
||||
+ if (read_string(ph, (uintptr_t) lib_name_addr, lib_name, sizeof(lib_name)) != true) {
|
||||
print_debug("can't read shared object name\n");
|
||||
- // don't let failure to read the name stop opening the file. If something is really wrong
|
||||
- // it will fail later.
|
||||
+ return false;
|
||||
}
|
||||
|
||||
if (lib_name[0] != '\0') {
|
||||
@@ -924,7 +931,7 @@ static bool read_shared_lib_info(struct ps_prochandle*
|
||||
}
|
||||
|
||||
// read next link_map address
|
||||
- if (ps_pdread(ph, (psaddr_t) link_map_addr + LINK_MAP_NEXT_OFFSET,
|
||||
+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_NEXT_OFFSET,
|
||||
&link_map_addr, sizeof(uintptr_t)) != PS_OK) {
|
||||
print_debug("can't read next link in link_map\n");
|
||||
return false;
|
||||
@@ -938,7 +945,6 @@ static bool read_shared_lib_info(struct ps_prochandle*
|
||||
struct ps_prochandle* Pgrab_core(const char* exec_file, const char* core_file) {
|
||||
ELF_EHDR core_ehdr;
|
||||
ELF_EHDR exec_ehdr;
|
||||
- ELF_EHDR lib_ehdr;
|
||||
|
||||
struct ps_prochandle* ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle));
|
||||
if (ph == NULL) {
|
@ -1,567 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_ps_proc_c,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/ps_proc.c.orig Mon Nov 1 13:14:52 2010
|
||||
+++ hotspot/agent/src/os/bsd/ps_proc.c Mon Nov 1 13:31:53 2010
|
||||
@@ -22,21 +22,23 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/wait.h>
|
||||
#include <sys/ptrace.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/user.h>
|
||||
+#include <elf.h>
|
||||
+#include <sys/elf_common.h>
|
||||
+#include <sys/link_elf.h>
|
||||
+#include <libutil.h>
|
||||
#include "libproc_impl.h"
|
||||
+#include "elfmacros.h"
|
||||
|
||||
-#if defined(x86_64) && !defined(amd64)
|
||||
-#define amd64 1
|
||||
-#endif
|
||||
-
|
||||
-#ifndef __WALL
|
||||
-#define __WALL 0x40000000 // Copied from /usr/include/bsd/wait.h
|
||||
-#endif
|
||||
-
|
||||
// This file has the libproc implementation specific to live process
|
||||
// For core files, refer to ps_core.c
|
||||
|
||||
@@ -50,255 +52,359 @@ static inline uintptr_t align(uintptr_t ptr, size_t si
|
||||
|
||||
// read "size" bytes of data from "addr" within the target process.
|
||||
// unlike the standard ptrace() function, process_read_data() can handle
|
||||
-// unaligned address - alignment check, if required, should be done
|
||||
+// unaligned address - alignment check, if required, should be done
|
||||
// before calling process_read_data.
|
||||
|
||||
static bool process_read_data(struct ps_prochandle* ph, uintptr_t addr, char *buf, size_t size) {
|
||||
- long rslt;
|
||||
+ int rslt;
|
||||
size_t i, words;
|
||||
uintptr_t end_addr = addr + size;
|
||||
- uintptr_t aligned_addr = align(addr, sizeof(long));
|
||||
+ uintptr_t aligned_addr = align(addr, sizeof(int));
|
||||
|
||||
if (aligned_addr != addr) {
|
||||
char *ptr = (char *)&rslt;
|
||||
errno = 0;
|
||||
- rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0);
|
||||
+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
|
||||
if (errno) {
|
||||
- print_debug("ptrace(PTRACE_PEEKDATA, ..) failed for %d bytes @ %lx\n", size, addr);
|
||||
+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr);
|
||||
return false;
|
||||
}
|
||||
for (; aligned_addr != addr; aligned_addr++, ptr++);
|
||||
- for (; ((intptr_t)aligned_addr % sizeof(long)) && aligned_addr < end_addr;
|
||||
- aligned_addr++)
|
||||
+ for (; ((intptr_t)aligned_addr % sizeof(int)) && aligned_addr < end_addr;
|
||||
+ aligned_addr++)
|
||||
*(buf++) = *(ptr++);
|
||||
}
|
||||
|
||||
- words = (end_addr - aligned_addr) / sizeof(long);
|
||||
+ words = (end_addr - aligned_addr) / sizeof(int);
|
||||
|
||||
- // assert((intptr_t)aligned_addr % sizeof(long) == 0);
|
||||
+ // assert((intptr_t)aligned_addr % sizeof(int) == 0);
|
||||
for (i = 0; i < words; i++) {
|
||||
errno = 0;
|
||||
- rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0);
|
||||
+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
|
||||
if (errno) {
|
||||
- print_debug("ptrace(PTRACE_PEEKDATA, ..) failed for %d bytes @ %lx\n", size, addr);
|
||||
+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr);
|
||||
return false;
|
||||
}
|
||||
- *(long *)buf = rslt;
|
||||
- buf += sizeof(long);
|
||||
- aligned_addr += sizeof(long);
|
||||
+ *(int *)buf = rslt;
|
||||
+ buf += sizeof(int);
|
||||
+ aligned_addr += sizeof(int);
|
||||
}
|
||||
|
||||
if (aligned_addr != end_addr) {
|
||||
char *ptr = (char *)&rslt;
|
||||
errno = 0;
|
||||
- rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0);
|
||||
+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
|
||||
if (errno) {
|
||||
- print_debug("ptrace(PTRACE_PEEKDATA, ..) failed for %d bytes @ %lx\n", size, addr);
|
||||
+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr);
|
||||
return false;
|
||||
}
|
||||
- for (; aligned_addr != end_addr; aligned_addr++)
|
||||
+ for (; aligned_addr != end_addr; aligned_addr++)
|
||||
*(buf++) = *(ptr++);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// null implementation for write
|
||||
-static bool process_write_data(struct ps_prochandle* ph,
|
||||
+static bool process_write_data(struct ps_prochandle* ph,
|
||||
uintptr_t addr, const char *buf , size_t size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
-// "user" should be a pointer to a user_regs_struct
|
||||
-static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct user_regs_struct *user) {
|
||||
+// "user" should be a pointer to a reg
|
||||
+static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct reg *user) {
|
||||
// we have already attached to all thread 'pid's, just use ptrace call
|
||||
// to get regset now. Note that we don't cache regset upfront for processes.
|
||||
-// Bsd on x86 and sparc are different. On x86 ptrace(PTRACE_GETREGS, ...)
|
||||
-// uses pointer from 4th argument and ignores 3rd argument. On sparc it uses
|
||||
-// pointer from 3rd argument and ignores 4th argument
|
||||
-#if defined(sparc) || defined(sparcv9)
|
||||
-#define ptrace_getregs(request, pid, addr, data) ptrace(request, pid, addr, data)
|
||||
-#else
|
||||
-#define ptrace_getregs(request, pid, addr, data) ptrace(request, pid, data, addr)
|
||||
-#endif
|
||||
-
|
||||
-#ifdef _LP64
|
||||
-#ifdef PTRACE_GETREGS64
|
||||
-#define PTRACE_GETREGS_REQ PTRACE_GETREGS64
|
||||
-#endif
|
||||
-#else
|
||||
-#if defined(PTRACE_GETREGS) || defined(PT_GETREGS)
|
||||
-#define PTRACE_GETREGS_REQ PTRACE_GETREGS
|
||||
-#endif
|
||||
-#endif /* _LP64 */
|
||||
-
|
||||
-#ifdef PTRACE_GETREGS_REQ
|
||||
- if (ptrace_getregs(PTRACE_GETREGS_REQ, pid, user, NULL) < 0) {
|
||||
+ if (ptrace(PT_GETREGS, pid, (caddr_t) user, 0) < 0) {
|
||||
print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
-#else
|
||||
- print_debug("ptrace(PTRACE_GETREGS, ...) not supported\n");
|
||||
- return false;
|
||||
-#endif
|
||||
+}
|
||||
|
||||
+// fill in ptrace_lwpinfo for lid
|
||||
+static bool process_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) {
|
||||
+ errno = 0;
|
||||
+ ptrace(PT_LWPINFO, lwp_id, linfo, sizeof(struct ptrace_lwpinfo));
|
||||
+
|
||||
+ return (errno == 0)? true: false;
|
||||
}
|
||||
|
||||
// attach to a process/thread specified by "pid"
|
||||
static bool ptrace_attach(pid_t pid) {
|
||||
- if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) < 0) {
|
||||
+ if (ptrace(PT_ATTACH, pid, NULL, 0) < 0) {
|
||||
print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
|
||||
return false;
|
||||
} else {
|
||||
int ret;
|
||||
int status;
|
||||
do {
|
||||
- // Wait for debuggee to stop.
|
||||
+ // Wait for debuggee to stop.
|
||||
ret = waitpid(pid, &status, 0);
|
||||
- if (ret == -1 && errno == ECHILD) {
|
||||
- // try cloned process.
|
||||
- ret = waitpid(pid, &status, __WALL);
|
||||
- }
|
||||
if (ret >= 0) {
|
||||
- if (WIFSTOPPED(status)) {
|
||||
- // Debuggee stopped.
|
||||
- return true;
|
||||
+ if (WIFSTOPPED(status)) {
|
||||
+ // Debuggee stopped.
|
||||
+ return true;
|
||||
} else {
|
||||
- print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
|
||||
- return false;
|
||||
- }
|
||||
+ print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
|
||||
+ return false;
|
||||
+ }
|
||||
} else {
|
||||
- switch (errno) {
|
||||
- case EINTR:
|
||||
+ switch (errno) {
|
||||
+ case EINTR:
|
||||
continue;
|
||||
- break;
|
||||
- case ECHILD:
|
||||
- print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
|
||||
- break;
|
||||
- case EINVAL:
|
||||
- print_debug("waitpid() failed. Invalid options argument.\n");
|
||||
- break;
|
||||
- default:
|
||||
- print_debug("waitpid() failed. Unexpected error %d\n",errno);
|
||||
+ break;
|
||||
+ case ECHILD:
|
||||
+ print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
|
||||
+ break;
|
||||
+ case EINVAL:
|
||||
+ print_debug("waitpid() failed. Invalid options argument.\n");
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_debug("waitpid() failed. Unexpected error %d\n",errno);
|
||||
}
|
||||
return false;
|
||||
- }
|
||||
+ }
|
||||
} while(true);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// -------------------------------------------------------
|
||||
// functions for obtaining library information
|
||||
// -------------------------------------------------------
|
||||
|
||||
+// callback for read_thread_info
|
||||
+static bool add_new_thread(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id) {
|
||||
+ return add_thread_info(ph, pthread_id, lwp_id) != NULL;
|
||||
+}
|
||||
+
|
||||
+#if defined(__FreeBSD__) && __FreeBSD_version < 701000
|
||||
/*
|
||||
- * splits a string _str_ into substrings with delimiter _delim_ by replacing old * delimiters with _new_delim_ (ideally, '\0'). the address of each substring
|
||||
- * is stored in array _ptrs_ as the return value. the maximum capacity of _ptrs_ * array is specified by parameter _n_.
|
||||
- * RETURN VALUE: total number of substrings (always <= _n_)
|
||||
- * NOTE: string _str_ is modified if _delim_!=_new_delim_
|
||||
+ * TEXT_START_ADDR from binutils/ld/emulparams/<arch_spec>.sh
|
||||
+ * Not the most robust but good enough.
|
||||
*/
|
||||
-static int split_n_str(char * str, int n, char ** ptrs, char delim, char new_delim)
|
||||
-{
|
||||
- int i;
|
||||
- for(i = 0; i < n; i++) ptrs[i] = NULL;
|
||||
- if (str == NULL || n < 1 ) return 0;
|
||||
|
||||
- i = 0;
|
||||
+#if defined(amd64) || defined(x86_64)
|
||||
+#define TEXT_START_ADDR 0x400000
|
||||
+#elif defined(i386)
|
||||
+#define TEXT_START_ADDR 0x8048000
|
||||
+#else
|
||||
+#error TEXT_START_ADDR not defined
|
||||
+#endif
|
||||
|
||||
- // skipping leading blanks
|
||||
- while(*str&&*str==delim) str++;
|
||||
+#define BUF_SIZE (PATH_MAX + NAME_MAX + 1)
|
||||
|
||||
- while(*str&&i<n){
|
||||
- ptrs[i++] = str;
|
||||
- while(*str&&*str!=delim) str++;
|
||||
- while(*str&&*str==delim) *(str++) = new_delim;
|
||||
- }
|
||||
+uintptr_t linkmap_addr(struct ps_prochandle *ph) {
|
||||
+ uintptr_t ehdr_addr, phdr_addr, dyn_addr, dmap_addr, lmap_addr;
|
||||
+ ELF_EHDR ehdr;
|
||||
+ ELF_PHDR *phdrs, *phdr;
|
||||
+ ELF_DYN *dyns, *dyn;
|
||||
+ struct r_debug dmap;
|
||||
+ unsigned long hdrs_size;
|
||||
+ unsigned int i;
|
||||
|
||||
- return i;
|
||||
-}
|
||||
+ /* read ELF_EHDR at TEXT_START_ADDR and validate */
|
||||
|
||||
-/*
|
||||
- * fgets without storing '\n' at the end of the string
|
||||
- */
|
||||
-static char * fgets_no_cr(char * buf, int n, FILE *fp)
|
||||
-{
|
||||
- char * rslt = fgets(buf, n, fp);
|
||||
- if (rslt && buf && *buf){
|
||||
- char *p = strchr(buf, '\0');
|
||||
- if (*--p=='\n') *p='\0';
|
||||
- }
|
||||
- return rslt;
|
||||
-}
|
||||
+ ehdr_addr = (uintptr_t)TEXT_START_ADDR;
|
||||
|
||||
-// callback for read_thread_info
|
||||
-static bool add_new_thread(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id) {
|
||||
- return add_thread_info(ph, pthread_id, lwp_id) != NULL;
|
||||
+ if (process_read_data(ph, ehdr_addr, (char *)&ehdr, sizeof(ehdr)) != true) {
|
||||
+ print_debug("process_read_data failed for ehdr_addr %p\n", ehdr_addr);
|
||||
+ return (0);
|
||||
+ }
|
||||
+
|
||||
+ if (!IS_ELF(ehdr) ||
|
||||
+ ehdr.e_ident[EI_CLASS] != ELF_TARG_CLASS ||
|
||||
+ ehdr.e_ident[EI_DATA] != ELF_TARG_DATA ||
|
||||
+ ehdr.e_ident[EI_VERSION] != EV_CURRENT ||
|
||||
+ ehdr.e_phentsize != sizeof(ELF_PHDR) ||
|
||||
+ ehdr.e_version != ELF_TARG_VER ||
|
||||
+ ehdr.e_machine != ELF_TARG_MACH) {
|
||||
+ print_debug("not an ELF_EHDR at %p\n", ehdr_addr);
|
||||
+ return (0);
|
||||
+ }
|
||||
+
|
||||
+ /* allocate space for all ELF_PHDR's and read */
|
||||
+
|
||||
+ phdr_addr = ehdr_addr + ehdr.e_phoff;
|
||||
+ hdrs_size = ehdr.e_phnum * sizeof(ELF_PHDR);
|
||||
+
|
||||
+ if ((phdrs = malloc(hdrs_size)) == NULL)
|
||||
+ return (0);
|
||||
+
|
||||
+ if (process_read_data(ph, phdr_addr, (char *)phdrs, hdrs_size) != true) {
|
||||
+ print_debug("process_read_data failed for phdr_addr %p\n", phdr_addr);
|
||||
+ return (0);
|
||||
+ }
|
||||
+
|
||||
+ /* find PT_DYNAMIC section */
|
||||
+
|
||||
+ for (i = 0, phdr = phdrs; i < ehdr.e_phnum; i++, phdr++) {
|
||||
+ if (phdr->p_type == PT_DYNAMIC)
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (i >= ehdr.e_phnum) {
|
||||
+ print_debug("PT_DYNAMIC section not found!\n");
|
||||
+ free(phdrs);
|
||||
+ return (0);
|
||||
+ }
|
||||
+
|
||||
+ /* allocate space and read in ELF_DYN headers */
|
||||
+
|
||||
+ dyn_addr = phdr->p_vaddr;
|
||||
+ hdrs_size = phdr->p_memsz;
|
||||
+ free(phdrs);
|
||||
+
|
||||
+ if ((dyns = malloc(hdrs_size)) == NULL)
|
||||
+ return (0);
|
||||
+
|
||||
+ if (process_read_data(ph, dyn_addr, (char *)dyns, hdrs_size) != true) {
|
||||
+ print_debug("process_read_data failed for dyn_addr %p\n", dyn_addr);
|
||||
+ free(dyns);
|
||||
+ return (0);
|
||||
+ }
|
||||
+
|
||||
+ /* find DT_DEBUG */
|
||||
+
|
||||
+ dyn = dyns;
|
||||
+ while (dyn->d_tag != DT_DEBUG && dyn->d_tag != DT_NULL) {
|
||||
+ dyn++;
|
||||
+ }
|
||||
+
|
||||
+ if (dyn->d_tag != DT_DEBUG) {
|
||||
+ print_debug("failed to find DT_DEBUG\n");
|
||||
+ free(dyns);
|
||||
+ return (0);
|
||||
+ }
|
||||
+
|
||||
+ /* read struct r_debug into dmap */
|
||||
+
|
||||
+ dmap_addr = (uintptr_t)dyn->d_un.d_ptr;
|
||||
+ free(dyns);
|
||||
+
|
||||
+ if (process_read_data(ph, dmap_addr, (char *)&dmap, sizeof(dmap)) != true) {
|
||||
+ print_debug("process_read_data failed for dmap_addr %p\n", dmap_addr);
|
||||
+ return (0);
|
||||
+ }
|
||||
+
|
||||
+ lmap_addr = (uintptr_t)dmap.r_map;
|
||||
+
|
||||
+ return (lmap_addr);
|
||||
}
|
||||
+#endif // __FreeBSD__ && __FreeBSD_version < 701000
|
||||
|
||||
static bool read_lib_info(struct ps_prochandle* ph) {
|
||||
- char fname[32];
|
||||
- char buf[256];
|
||||
- FILE *fp = NULL;
|
||||
+#if defined(__FreeBSD__) && __FreeBSD_version >= 701000
|
||||
+ struct kinfo_vmentry *freep, *kve;
|
||||
+ int i, cnt;
|
||||
|
||||
- sprintf(fname, "/proc/%d/maps", ph->pid);
|
||||
- fp = fopen(fname, "r");
|
||||
- if (fp == NULL) {
|
||||
- print_debug("can't open /proc/%d/maps file\n", ph->pid);
|
||||
- return false;
|
||||
+ freep = kinfo_getvmmap(ph->pid, &cnt);
|
||||
+ if (freep == NULL) {
|
||||
+ print_debug("can't get vm map for pid\n", ph->pid);
|
||||
+ return false;
|
||||
}
|
||||
|
||||
- while(fgets_no_cr(buf, 256, fp)){
|
||||
- char * word[6];
|
||||
- int nwords = split_n_str(buf, 6, word, ' ', '\0');
|
||||
- if (nwords > 5 && find_lib(ph, word[5]) == false) {
|
||||
- intptr_t base;
|
||||
- lib_info* lib;
|
||||
-#ifdef _LP64
|
||||
- sscanf(word[0], "%lx", &base);
|
||||
-#else
|
||||
- sscanf(word[0], "%x", &base);
|
||||
-#endif
|
||||
- if ((lib = add_lib_info(ph, word[5], (uintptr_t)base)) == NULL)
|
||||
+ for (i = 0; i < cnt; i++) {
|
||||
+ kve = &freep[i];
|
||||
+ if ((kve->kve_flags & KVME_FLAG_COW) &&
|
||||
+ kve->kve_path != NULL &&
|
||||
+ strlen(kve->kve_path) > 0) {
|
||||
+
|
||||
+ if (find_lib(ph, kve->kve_path) == false) {
|
||||
+ lib_info* lib;
|
||||
+ if ((lib = add_lib_info(ph, kve->kve_path,
|
||||
+ (uintptr_t) kve->kve_start)) == NULL)
|
||||
continue; // ignore, add_lib_info prints error
|
||||
|
||||
- // we don't need to keep the library open, symtab is already
|
||||
- // built. Only for core dump we need to keep the fd open.
|
||||
- close(lib->fd);
|
||||
- lib->fd = -1;
|
||||
+ // we don't need to keep the library open, symtab is already
|
||||
+ // built. Only for core dump we need to keep the fd open.
|
||||
+ close(lib->fd);
|
||||
+ lib->fd = -1;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
- fclose(fp);
|
||||
+
|
||||
+ free(freep);
|
||||
+
|
||||
return true;
|
||||
+#else
|
||||
+ char *l_name;
|
||||
+ struct link_map *lmap;
|
||||
+ uintptr_t lmap_addr;
|
||||
+
|
||||
+ if ((l_name = malloc(BUF_SIZE)) == NULL)
|
||||
+ return false;
|
||||
+
|
||||
+ if ((lmap = malloc(sizeof(*lmap))) == NULL) {
|
||||
+ free(l_name);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ lmap_addr = linkmap_addr(ph);
|
||||
+
|
||||
+ if (lmap_addr == 0) {
|
||||
+ free(l_name);
|
||||
+ free(lmap);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ do {
|
||||
+ if (process_read_data(ph, lmap_addr, (char *)lmap, sizeof(*lmap)) != true) {
|
||||
+ print_debug("process_read_data failed for lmap_addr %p\n", lmap_addr);
|
||||
+ free (l_name);
|
||||
+ free (lmap);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (process_read_data(ph, (uintptr_t)lmap->l_name, l_name,
|
||||
+ BUF_SIZE) != true) {
|
||||
+ print_debug("process_read_data failed for lmap->l_name %p\n",
|
||||
+ lmap->l_name);
|
||||
+ free (l_name);
|
||||
+ free (lmap);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (find_lib(ph, l_name) == false) {
|
||||
+ lib_info* lib;
|
||||
+ if ((lib = add_lib_info(ph, l_name,
|
||||
+ (uintptr_t) lmap->l_addr)) == NULL)
|
||||
+ continue; // ignore, add_lib_info prints error
|
||||
+
|
||||
+ // we don't need to keep the library open, symtab is already
|
||||
+ // built. Only for core dump we need to keep the fd open.
|
||||
+ close(lib->fd);
|
||||
+ lib->fd = -1;
|
||||
+ }
|
||||
+ lmap_addr = (uintptr_t)lmap->l_next;
|
||||
+ } while (lmap->l_next != NULL);
|
||||
+
|
||||
+ free (l_name);
|
||||
+ free (lmap);
|
||||
+
|
||||
+ return true;
|
||||
+#endif
|
||||
}
|
||||
|
||||
// detach a given pid
|
||||
static bool ptrace_detach(pid_t pid) {
|
||||
- if (pid && ptrace(PTRACE_DETACH, pid, NULL, NULL) < 0) {
|
||||
+ if (pid && ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0) {
|
||||
print_debug("ptrace(PTRACE_DETACH, ..) failed for %d\n", pid);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
- }
|
||||
+ }
|
||||
}
|
||||
|
||||
-// detach all pids of a ps_prochandle
|
||||
-static void detach_all_pids(struct ps_prochandle* ph) {
|
||||
- thread_info* thr = ph->threads;
|
||||
- while (thr) {
|
||||
- ptrace_detach(thr->lwp_id);
|
||||
- thr = thr->next;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static void process_cleanup(struct ps_prochandle* ph) {
|
||||
- detach_all_pids(ph);
|
||||
+ ptrace_detach(ph->pid);
|
||||
}
|
||||
|
||||
static ps_prochandle_ops process_ops = {
|
||||
.release= process_cleanup,
|
||||
.p_pread= process_read_data,
|
||||
.p_pwrite= process_write_data,
|
||||
- .get_lwp_regs= process_get_lwp_regs
|
||||
+ .get_lwp_regs= process_get_lwp_regs,
|
||||
+ .get_lwp_info= process_get_lwp_info
|
||||
};
|
||||
|
||||
// attach to the process. One and only one exposed stuff
|
||||
@@ -325,21 +431,14 @@ struct ps_prochandle* Pgrab(pid_t pid) {
|
||||
// read library info and symbol tables, must do this before attaching threads,
|
||||
// as the symbols in the pthread library will be used to figure out
|
||||
// the list of threads within the same process.
|
||||
- read_lib_info(ph);
|
||||
-
|
||||
+ if (read_lib_info(ph) != true) {
|
||||
+ ptrace_detach(pid);
|
||||
+ free(ph);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
// read thread info
|
||||
read_thread_info(ph, add_new_thread);
|
||||
|
||||
- // attach to the threads
|
||||
- thr = ph->threads;
|
||||
- while (thr) {
|
||||
- // don't attach to the main thread again
|
||||
- if (ph->pid != thr->lwp_id && ptrace_attach(thr->lwp_id) != true) {
|
||||
- // even if one attach fails, we get return NULL
|
||||
- Prelease(ph);
|
||||
- return NULL;
|
||||
- }
|
||||
- thr = thr->next;
|
||||
- }
|
||||
return ph;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_salibelf_c,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/salibelf.c.orig Tue Jun 2 13:08:38 2009
|
||||
+++ hotspot/agent/src/os/bsd/salibelf.c Tue Jun 2 13:08:43 2009
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "salibelf.h"
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
+#include <string.h>
|
||||
|
||||
extern void print_debug(const char*,...);
|
||||
|
@ -1,402 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_symtab_c,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/symtab.c.orig Mon Oct 25 18:02:17 2010
|
||||
+++ hotspot/agent/src/os/bsd/symtab.c Mon Oct 25 18:42:22 2010
|
||||
@@ -23,10 +23,10 @@
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
-#include <sys/procfs.h>
|
||||
#include <search.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#include "hsearch_r.h"
|
||||
#include "symtab.h"
|
||||
#include "salibelf.h"
|
||||
|
||||
@@ -53,276 +53,9 @@ typedef struct symtab {
|
||||
struct hsearch_data *hash_table;
|
||||
} symtab_t;
|
||||
|
||||
-
|
||||
-// Directory that contains global debuginfo files. In theory it
|
||||
-// should be possible to change this, but in a Java environment there
|
||||
-// is no obvious place to put a user interface to do it. Maybe this
|
||||
-// could be set with an environment variable.
|
||||
-static const char debug_file_directory[] = "/usr/lib/debug";
|
||||
-
|
||||
-/* The CRC used in gnu_debuglink, retrieved from
|
||||
- http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files. */
|
||||
-unsigned int gnu_debuglink_crc32 (unsigned int crc,
|
||||
- unsigned char *buf, size_t len)
|
||||
-{
|
||||
- static const unsigned int crc32_table[256] =
|
||||
- {
|
||||
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
||||
- 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
||||
- 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
||||
- 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
||||
- 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
||||
- 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
||||
- 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
||||
- 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
||||
- 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
||||
- 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
||||
- 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
||||
- 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
||||
- 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
||||
- 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
||||
- 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
||||
- 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
||||
- 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
||||
- 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
||||
- 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
||||
- 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
||||
- 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
||||
- 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
||||
- 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
||||
- 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
||||
- 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
||||
- 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
||||
- 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
||||
- 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
||||
- 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
||||
- 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
||||
- 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
||||
- 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
||||
- 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
||||
- 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
||||
- 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
||||
- 0x2d02ef8d
|
||||
- };
|
||||
- unsigned char *end;
|
||||
-
|
||||
- crc = ~crc & 0xffffffff;
|
||||
- for (end = buf + len; buf < end; ++buf)
|
||||
- crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
|
||||
- return ~crc & 0xffffffff;
|
||||
-}
|
||||
-
|
||||
-/* Open a debuginfo file and check its CRC. If it exists and the CRC
|
||||
- matches return its fd. */
|
||||
-static int
|
||||
-open_debug_file (const char *pathname, unsigned int crc)
|
||||
-{
|
||||
- unsigned int file_crc = 0;
|
||||
- unsigned char buffer[8 * 1024];
|
||||
-
|
||||
- int fd = pathmap_open(pathname);
|
||||
-
|
||||
- if (fd < 0)
|
||||
- return -1;
|
||||
-
|
||||
- lseek(fd, 0, SEEK_SET);
|
||||
-
|
||||
- for (;;) {
|
||||
- int len = read(fd, buffer, sizeof buffer);
|
||||
- if (len <= 0)
|
||||
- break;
|
||||
- file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
|
||||
- }
|
||||
-
|
||||
- if (crc == file_crc)
|
||||
- return fd;
|
||||
- else {
|
||||
- close(fd);
|
||||
- return -1;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-/* Find an ELF section. */
|
||||
-static struct elf_section *find_section_by_name(char *name,
|
||||
- int fd,
|
||||
- ELF_EHDR *ehdr,
|
||||
- ELF_SHDR *shbuf,
|
||||
- struct elf_section *scn_cache)
|
||||
-{
|
||||
- ELF_SHDR* cursct = NULL;
|
||||
- char *strtab;
|
||||
- int cnt;
|
||||
-
|
||||
- if (scn_cache[ehdr->e_shstrndx].c_data == NULL) {
|
||||
- if ((scn_cache[ehdr->e_shstrndx].c_data
|
||||
- = read_section_data(fd, ehdr, cursct)) == NULL) {
|
||||
- return NULL;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- strtab = scn_cache[ehdr->e_shstrndx].c_data;
|
||||
-
|
||||
- for (cursct = shbuf, cnt = 0;
|
||||
- cnt < ehdr->e_shnum;
|
||||
- cnt++, cursct++) {
|
||||
- if (strcmp(cursct->sh_name + strtab, name) == 0) {
|
||||
- scn_cache[cnt].c_data = read_section_data(fd, ehdr, cursct);
|
||||
- return &scn_cache[cnt];
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return NULL;
|
||||
-}
|
||||
-
|
||||
-/* Look for a ".gnu_debuglink" section. If one exists, try to open a
|
||||
- suitable debuginfo file. */
|
||||
-static int open_file_from_debug_link(const char *name,
|
||||
- int fd,
|
||||
- ELF_EHDR *ehdr,
|
||||
- ELF_SHDR *shbuf,
|
||||
- struct elf_section *scn_cache)
|
||||
-{
|
||||
- int debug_fd;
|
||||
- struct elf_section *debug_link = find_section_by_name(".gnu_debuglink", fd, ehdr,
|
||||
- shbuf, scn_cache);
|
||||
- if (debug_link == NULL)
|
||||
- return -1;
|
||||
- char *debug_filename = debug_link->c_data;
|
||||
- int offset = (strlen(debug_filename) + 4) >> 2;
|
||||
- static unsigned int crc;
|
||||
- crc = ((unsigned int*)debug_link->c_data)[offset];
|
||||
- char *debug_pathname = malloc(strlen(debug_filename)
|
||||
- + strlen(name)
|
||||
- + strlen(".debug/")
|
||||
- + strlen(debug_file_directory)
|
||||
- + 2);
|
||||
- strcpy(debug_pathname, name);
|
||||
- char *last_slash = strrchr(debug_pathname, '/');
|
||||
- if (last_slash == NULL)
|
||||
- return -1;
|
||||
-
|
||||
- /* Look in the same directory as the object. */
|
||||
- strcpy(last_slash+1, debug_filename);
|
||||
-
|
||||
- debug_fd = open_debug_file(debug_pathname, crc);
|
||||
- if (debug_fd >= 0) {
|
||||
- free(debug_pathname);
|
||||
- return debug_fd;
|
||||
- }
|
||||
-
|
||||
- /* Look in a subdirectory named ".debug". */
|
||||
- strcpy(last_slash+1, ".debug/");
|
||||
- strcat(last_slash, debug_filename);
|
||||
-
|
||||
- debug_fd = open_debug_file(debug_pathname, crc);
|
||||
- if (debug_fd >= 0) {
|
||||
- free(debug_pathname);
|
||||
- return debug_fd;
|
||||
- }
|
||||
-
|
||||
- /* Look in /usr/lib/debug + the full pathname. */
|
||||
- strcpy(debug_pathname, debug_file_directory);
|
||||
- strcat(debug_pathname, name);
|
||||
- last_slash = strrchr(debug_pathname, '/');
|
||||
- strcpy(last_slash+1, debug_filename);
|
||||
-
|
||||
- debug_fd = open_debug_file(debug_pathname, crc);
|
||||
- if (debug_fd >= 0) {
|
||||
- free(debug_pathname);
|
||||
- return debug_fd;
|
||||
- }
|
||||
-
|
||||
- free(debug_pathname);
|
||||
- return -1;
|
||||
-}
|
||||
-
|
||||
-static struct symtab* build_symtab_internal(int fd, const char *filename, bool try_debuginfo);
|
||||
-
|
||||
-/* Look for a ".gnu_debuglink" section. If one exists, try to open a
|
||||
- suitable debuginfo file and read a symbol table from it. */
|
||||
-static struct symtab *build_symtab_from_debug_link(const char *name,
|
||||
- int fd,
|
||||
- ELF_EHDR *ehdr,
|
||||
- ELF_SHDR *shbuf,
|
||||
- struct elf_section *scn_cache)
|
||||
-{
|
||||
- fd = open_file_from_debug_link(name, fd, ehdr, shbuf, scn_cache);
|
||||
-
|
||||
- if (fd >= 0) {
|
||||
- struct symtab *symtab = build_symtab_internal(fd, NULL, /* try_debuginfo */ false);
|
||||
- close(fd);
|
||||
- return symtab;
|
||||
- }
|
||||
-
|
||||
- return NULL;
|
||||
-}
|
||||
-
|
||||
-// Given a build_id, find the associated debuginfo file
|
||||
-static char *
|
||||
-build_id_to_debug_filename (size_t size, unsigned char *data)
|
||||
-{
|
||||
- char *filename, *s;
|
||||
-
|
||||
- filename = malloc(strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
|
||||
- + 2 * size + (sizeof ".debug" - 1) + 1);
|
||||
- s = filename + sprintf (filename, "%s/.build-id/", debug_file_directory);
|
||||
- if (size > 0)
|
||||
- {
|
||||
- size--;
|
||||
- s += sprintf (s, "%02x", *data++);
|
||||
- }
|
||||
- if (size > 0)
|
||||
- *s++ = '/';
|
||||
- while (size-- > 0)
|
||||
- s += sprintf (s, "%02x", *data++);
|
||||
- strcpy (s, ".debug");
|
||||
-
|
||||
- return filename;
|
||||
-}
|
||||
-
|
||||
-// Read a build ID note. Try to open any associated debuginfo file
|
||||
-// and return its symtab
|
||||
-static struct symtab* build_symtab_from_build_id(Elf64_Nhdr *note)
|
||||
-{
|
||||
- int fd;
|
||||
- struct symtab *symtab = NULL;
|
||||
-
|
||||
- unsigned char *bytes
|
||||
- = (unsigned char*)(note+1) + note->n_namesz;
|
||||
- unsigned char *filename
|
||||
- = (build_id_to_debug_filename (note->n_descsz, bytes));
|
||||
-
|
||||
- fd = pathmap_open(filename);
|
||||
- if (fd >= 0) {
|
||||
- symtab = build_symtab_internal(fd, NULL, /* try_debuginfo */ false);
|
||||
- close(fd);
|
||||
- }
|
||||
- free(filename);
|
||||
-
|
||||
- return symtab;
|
||||
-}
|
||||
-
|
||||
-// read symbol table from given fd. If try_debuginfo) is true, also
|
||||
-// try to open an associated debuginfo file
|
||||
-static struct symtab* build_symtab_internal(int fd, const char *filename, bool try_debuginfo) {
|
||||
+// read symbol table from given fd.
|
||||
+struct symtab* build_symtab(int fd) {
|
||||
ELF_EHDR ehdr;
|
||||
- char *names = NULL;
|
||||
struct symtab* symtab = NULL;
|
||||
|
||||
// Reading of elf header
|
||||
@@ -331,8 +64,9 @@ static struct symtab* build_symtab_internal(int fd, co
|
||||
ELF_SHDR* shbuf = NULL;
|
||||
ELF_SHDR* cursct = NULL;
|
||||
ELF_PHDR* phbuf = NULL;
|
||||
- ELF_PHDR* phdr = NULL;
|
||||
- int sym_section = SHT_DYNSYM;
|
||||
+ int symtab_found = 0;
|
||||
+ int dynsym_found = 0;
|
||||
+ uint32_t symsection = SHT_SYMTAB;
|
||||
|
||||
uintptr_t baseaddr = (uintptr_t)-1;
|
||||
|
||||
@@ -357,23 +91,30 @@ static struct symtab* build_symtab_internal(int fd, co
|
||||
|
||||
for (cursct = shbuf, cnt = 0; cnt < ehdr.e_shnum; cnt++) {
|
||||
scn_cache[cnt].c_shdr = cursct;
|
||||
- if (cursct->sh_type == SHT_SYMTAB || cursct->sh_type == SHT_STRTAB
|
||||
- || cursct->sh_type == SHT_NOTE || cursct->sh_type == SHT_DYNSYM) {
|
||||
+ if (cursct->sh_type == SHT_SYMTAB ||
|
||||
+ cursct->sh_type == SHT_STRTAB ||
|
||||
+ cursct->sh_type == SHT_DYNSYM) {
|
||||
if ( (scn_cache[cnt].c_data = read_section_data(fd, &ehdr, cursct)) == NULL) {
|
||||
goto quit;
|
||||
}
|
||||
}
|
||||
- if (cursct->sh_type == SHT_SYMTAB) {
|
||||
- // Full symbol table available so use that
|
||||
- sym_section = cursct->sh_type;
|
||||
- }
|
||||
+
|
||||
+ if (cursct->sh_type == SHT_SYMTAB)
|
||||
+ symtab_found++;
|
||||
+
|
||||
+ if (cursct->sh_type == SHT_DYNSYM)
|
||||
+ dynsym_found++;
|
||||
+
|
||||
cursct++;
|
||||
}
|
||||
|
||||
+ if (!symtab_found && dynsym_found)
|
||||
+ symsection = SHT_DYNSYM;
|
||||
+
|
||||
for (cnt = 1; cnt < ehdr.e_shnum; cnt++) {
|
||||
ELF_SHDR *shdr = scn_cache[cnt].c_shdr;
|
||||
|
||||
- if (shdr->sh_type == sym_section) {
|
||||
+ if (shdr->sh_type == symsection) {
|
||||
ELF_SYM *syms;
|
||||
int j, n, rslt;
|
||||
size_t size;
|
||||
@@ -435,45 +176,6 @@ static struct symtab* build_symtab_internal(int fd, co
|
||||
}
|
||||
}
|
||||
|
||||
- // Look for a separate debuginfo file.
|
||||
- if (try_debuginfo) {
|
||||
-
|
||||
- // We prefer a debug symtab to an object's own symtab, so look in
|
||||
- // the debuginfo file. We stash a copy of the old symtab in case
|
||||
- // there is no debuginfo.
|
||||
- struct symtab* prev_symtab = symtab;
|
||||
- symtab = NULL;
|
||||
-
|
||||
-#ifdef NT_GNU_BUILD_ID
|
||||
- // First we look for a Build ID
|
||||
- for (cursct = shbuf, cnt = 0;
|
||||
- symtab == NULL && cnt < ehdr.e_shnum;
|
||||
- cnt++) {
|
||||
- if (cursct->sh_type == SHT_NOTE) {
|
||||
- Elf64_Nhdr *note = (Elf64_Nhdr *)scn_cache[cnt].c_data;
|
||||
- if (note->n_type == NT_GNU_BUILD_ID) {
|
||||
- symtab = build_symtab_from_build_id(note);
|
||||
- }
|
||||
- }
|
||||
- cursct++;
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
- // Then, if that doesn't work, the debug link
|
||||
- if (symtab == NULL) {
|
||||
- symtab = build_symtab_from_debug_link(filename, fd, &ehdr, shbuf,
|
||||
- scn_cache);
|
||||
- }
|
||||
-
|
||||
- // If we still haven't found a symtab, use the object's own symtab.
|
||||
- if (symtab != NULL) {
|
||||
- if (prev_symtab != NULL)
|
||||
- destroy_symtab(prev_symtab);
|
||||
- } else {
|
||||
- symtab = prev_symtab;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
quit:
|
||||
if (shbuf) free(shbuf);
|
||||
if (phbuf) free(phbuf);
|
||||
@@ -487,11 +189,6 @@ quit:
|
||||
}
|
||||
return symtab;
|
||||
}
|
||||
-
|
||||
-struct symtab* build_symtab(int fd, const char *filename) {
|
||||
- return build_symtab_internal(fd, filename, /* try_debuginfo */ true);
|
||||
-}
|
||||
-
|
||||
|
||||
void destroy_symtab(struct symtab* symtab) {
|
||||
if (!symtab) return;
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_symtab_h,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/symtab.h.orig Mon Oct 25 18:43:18 2010
|
||||
+++ hotspot/agent/src/os/bsd/symtab.h Mon Oct 25 18:43:25 2010
|
||||
@@ -32,7 +32,7 @@
|
||||
struct symtab;
|
||||
|
||||
// build symbol table for a given ELF file descriptor
|
||||
-struct symtab* build_symtab(int fd, const char *filename);
|
||||
+struct symtab* build_symtab(int fd);
|
||||
|
||||
// destroy the symbol table
|
||||
void destroy_symtab(struct symtab* symtab);
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_os_bsd_test_c,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/os/bsd/test.c.orig Tue Jun 2 13:09:43 2009
|
||||
+++ hotspot/agent/src/os/bsd/test.c Tue Jun 2 13:09:50 2009
|
||||
@@ -44,7 +44,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
default: {
|
||||
- printf("usage %s <pid> or %s <exec file> <core file>\n");
|
||||
+ fprintf(stderr, "usage %s <pid> or %s <exec file> <core file>\n", argv[0], argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_share_classes_sun_jvm_hotspot_HotSpotAgent_java,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java.orig Tue Jun 2 12:33:16 2009
|
||||
+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Tue Jun 2 12:33:28 2009
|
||||
@@ -28,6 +28,7 @@ import java.io.PrintStream;
|
||||
import java.net.*;
|
||||
import java.rmi.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
+import sun.jvm.hotspot.debugger.bsd.*;
|
||||
import sun.jvm.hotspot.debugger.dbx.*;
|
||||
import sun.jvm.hotspot.debugger.proc.*;
|
||||
import sun.jvm.hotspot.debugger.remote.*;
|
||||
@@ -337,6 +338,8 @@ public class HotSpotAgent {
|
||||
setupDebuggerWin32();
|
||||
} else if (os.equals("linux")) {
|
||||
setupDebuggerLinux();
|
||||
+ } else if (os.equals("bsd")) {
|
||||
+ setupDebuggerBsd();
|
||||
} else {
|
||||
// Add support for more operating systems here
|
||||
throw new DebuggerException("Operating system " + os + " not yet supported");
|
||||
@@ -392,6 +395,10 @@ public class HotSpotAgent {
|
||||
db = new HotSpotTypeDataBase(machDesc,
|
||||
new LinuxVtblAccess(debugger, jvmLibNames),
|
||||
debugger, jvmLibNames);
|
||||
+ } else if (os.equals("bsd")) {
|
||||
+ db = new HotSpotTypeDataBase(machDesc,
|
||||
+ new BsdVtblAccess(debugger, jvmLibNames),
|
||||
+ debugger, jvmLibNames);
|
||||
} else {
|
||||
throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)");
|
||||
}
|
||||
@@ -557,6 +564,8 @@ public class HotSpotAgent {
|
||||
setupJVMLibNamesWin32();
|
||||
} else if (os.equals("linux")) {
|
||||
setupJVMLibNamesLinux();
|
||||
+ } else if (os.equals("bsd")) {
|
||||
+ setupJVMLibNamesBsd();
|
||||
} else {
|
||||
throw new RuntimeException("Unknown OS type");
|
||||
}
|
||||
@@ -635,6 +644,31 @@ public class HotSpotAgent {
|
||||
}
|
||||
|
||||
private void setupJVMLibNamesLinux() {
|
||||
+ jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" };
|
||||
+ }
|
||||
+
|
||||
+ //
|
||||
+ // BSD
|
||||
+ //
|
||||
+
|
||||
+ private void setupDebuggerBsd() {
|
||||
+ setupJVMLibNamesBsd();
|
||||
+
|
||||
+ if (cpu.equals("x86")) {
|
||||
+ machDesc = new MachineDescriptionIntelX86();
|
||||
+ } else if (cpu.equals("amd64")) {
|
||||
+ machDesc = new MachineDescriptionAMD64();
|
||||
+ } else {
|
||||
+ throw new DebuggerException("BSD only supported on x86/amd64");
|
||||
+ }
|
||||
+
|
||||
+ BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer);
|
||||
+ debugger = dbg;
|
||||
+
|
||||
+ attachDebugger();
|
||||
+ }
|
||||
+
|
||||
+ private void setupJVMLibNamesBsd() {
|
||||
jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" };
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_share_classes_sun_jvm_hotspot_bugspot_BugSpotAgent_java,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java.orig Tue Jun 2 12:34:28 2009
|
||||
+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Tue Jun 2 12:34:41 2009
|
||||
@@ -29,6 +29,7 @@ import java.net.*;
|
||||
import java.rmi.*;
|
||||
import sun.jvm.hotspot.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
+import sun.jvm.hotspot.debugger.bsd.*;
|
||||
import sun.jvm.hotspot.debugger.dbx.*;
|
||||
import sun.jvm.hotspot.debugger.proc.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.*;
|
||||
@@ -516,6 +517,8 @@ public class BugSpotAgent {
|
||||
setupDebuggerWin32();
|
||||
} else if (os.equals("linux")) {
|
||||
setupDebuggerLinux();
|
||||
+ } else if (os.equals("bsd")) {
|
||||
+ setupDebuggerBsd();
|
||||
} else {
|
||||
// Add support for more operating systems here
|
||||
throw new DebuggerException("Operating system " + os + " not yet supported");
|
||||
@@ -567,6 +570,9 @@ public class BugSpotAgent {
|
||||
} else if (os.equals("linux")) {
|
||||
db = new HotSpotTypeDataBase(machDesc, new LinuxVtblAccess(debugger, jvmLibNames),
|
||||
debugger, jvmLibNames);
|
||||
+ } else if (os.equals("bsd")) {
|
||||
+ db = new HotSpotTypeDataBase(machDesc, new BsdVtblAccess(debugger, jvmLibNames),
|
||||
+ debugger, jvmLibNames);
|
||||
} else {
|
||||
throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess implemented yet)");
|
||||
}
|
||||
@@ -739,6 +745,8 @@ public class BugSpotAgent {
|
||||
setupJVMLibNamesWin32();
|
||||
} else if (os.equals("linux")) {
|
||||
setupJVMLibNamesLinux();
|
||||
+ } else if (os.equals("bsd")) {
|
||||
+ setupJVMLibNamesBsd();
|
||||
} else {
|
||||
throw new RuntimeException("Unknown OS type");
|
||||
}
|
||||
@@ -818,6 +826,34 @@ public class BugSpotAgent {
|
||||
}
|
||||
|
||||
private void setupJVMLibNamesLinux() {
|
||||
+ // same as solaris
|
||||
+ setupJVMLibNamesSolaris();
|
||||
+ }
|
||||
+
|
||||
+ //
|
||||
+ // BSD
|
||||
+ //
|
||||
+
|
||||
+ private void setupDebuggerBsd() {
|
||||
+ setupJVMLibNamesBsd();
|
||||
+
|
||||
+ if (cpu.equals("x86")) {
|
||||
+ machDesc = new MachineDescriptionIntelX86();
|
||||
+ } else if (cpu.equals("amd64")) {
|
||||
+ machDesc = new MachineDescriptionAMD64();
|
||||
+ } else {
|
||||
+ throw new DebuggerException("Bsd only supported on x86/amd64");
|
||||
+ }
|
||||
+
|
||||
+ // Note we do not use a cache for the local debugger in server
|
||||
+ // mode; it will be taken care of on the client side (once remote
|
||||
+ // debugging is implemented).
|
||||
+
|
||||
+ debugger = new BsdDebuggerLocal(machDesc, !isServer);
|
||||
+ attachDebugger();
|
||||
+ }
|
||||
+
|
||||
+ private void setupJVMLibNamesBsd() {
|
||||
// same as solaris
|
||||
setupJVMLibNamesSolaris();
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_share_classes_sun_jvm_hotspot_debugger_bsd_BsdCDebugger_java,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java.orig Tue Jun 2 13:10:15 2009
|
||||
+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java Tue Jun 2 13:10:31 2009
|
||||
@@ -30,10 +30,8 @@ import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.*;
|
||||
import sun.jvm.hotspot.debugger.x86.*;
|
||||
import sun.jvm.hotspot.debugger.amd64.*;
|
||||
-import sun.jvm.hotspot.debugger.sparc.*;
|
||||
import sun.jvm.hotspot.debugger.bsd.x86.*;
|
||||
import sun.jvm.hotspot.debugger.bsd.amd64.*;
|
||||
-import sun.jvm.hotspot.debugger.bsd.sparc.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
class BsdCDebugger implements CDebugger {
|
||||
@@ -99,13 +97,6 @@ class BsdCDebugger implements CDebugger {
|
||||
Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP);
|
||||
if (pc == null) return null;
|
||||
return new BsdAMD64CFrame(dbg, rbp, pc);
|
||||
- } else if (cpu.equals("sparc")) {
|
||||
- SPARCThreadContext context = (SPARCThreadContext) thread.getContext();
|
||||
- Address sp = context.getRegisterAsAddress(SPARCThreadContext.R_SP);
|
||||
- if (sp == null) return null;
|
||||
- Address pc = context.getRegisterAsAddress(SPARCThreadContext.R_O7);
|
||||
- if (pc == null) return null;
|
||||
- return new BsdSPARCCFrame(dbg, sp, pc, BsdDebuggerLocal.getAddressSize());
|
||||
} else {
|
||||
throw new DebuggerException(cpu + " is not yet supported");
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_share_classes_sun_jvm_hotspot_debugger_bsd_BsdThreadContextFactory_java,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java.orig Tue Jun 2 13:10:53 2009
|
||||
+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java Tue Jun 2 13:11:11 2009
|
||||
@@ -26,9 +26,7 @@ package sun.jvm.hotspot.debugger.bsd;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.debugger.bsd.amd64.*;
|
||||
-import sun.jvm.hotspot.debugger.bsd.ia64.*;
|
||||
import sun.jvm.hotspot.debugger.bsd.x86.*;
|
||||
-import sun.jvm.hotspot.debugger.bsd.sparc.*;
|
||||
|
||||
class BsdThreadContextFactory {
|
||||
static ThreadContext createThreadContext(BsdDebugger dbg) {
|
||||
@@ -37,10 +35,6 @@ class BsdThreadContextFactory {
|
||||
return new BsdX86ThreadContext(dbg);
|
||||
} else if (cpu.equals("amd64")) {
|
||||
return new BsdAMD64ThreadContext(dbg);
|
||||
- } else if (cpu.equals("ia64")) {
|
||||
- return new BsdIA64ThreadContext(dbg);
|
||||
- } else if (cpu.equals("sparc")) {
|
||||
- return new BsdSPARCThreadContext(dbg);
|
||||
} else {
|
||||
throw new RuntimeException("cpu " + cpu + " is not yet supported");
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_share_classes_sun_jvm_hotspot_runtime_Threads_java,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java.orig Tue Jun 2 12:35:39 2009
|
||||
+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Tue Jun 2 12:35:52 2009
|
||||
@@ -37,6 +37,8 @@ import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaT
|
||||
import sun.jvm.hotspot.runtime.linux_ia64.LinuxIA64JavaThreadPDAccess;
|
||||
import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess;
|
||||
import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess;
|
||||
+import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess;
|
||||
+import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
public class Threads {
|
||||
@@ -90,7 +92,12 @@ public class Threads {
|
||||
} else if (cpu.equals("sparc")) {
|
||||
access = new LinuxSPARCJavaThreadPDAccess();
|
||||
}
|
||||
-
|
||||
+ } else if (os.equals("bsd")) {
|
||||
+ if (cpu.equals("x86")) {
|
||||
+ access = new BsdX86JavaThreadPDAccess();
|
||||
+ } else if (cpu.equals("amd64")) {
|
||||
+ access = new BsdAMD64JavaThreadPDAccess();
|
||||
+ }
|
||||
}
|
||||
|
||||
if (access == null) {
|
@ -1,63 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_share_classes_sun_jvm_hotspot_runtime_bsd_BsdSignals_java,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java.orig Tue Jun 2 13:11:43 2009
|
||||
+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java Tue Jun 2 13:11:54 2009
|
||||
@@ -28,37 +28,36 @@ public class BsdSignals {
|
||||
private static String[] signalNames = {
|
||||
"", /* No signal 0 */
|
||||
"SIGHUP", /* hangup */
|
||||
- "SIGINT", /* interrupt (rubout) */
|
||||
- "SIGQUIT", /* quit (ASCII FS) */
|
||||
- "SIGILL", /* illegal instruction (not reset when caught) */
|
||||
+ "SIGINT", /* interrupt */
|
||||
+ "SIGQUIT", /* quit */
|
||||
+ "SIGILL", /* illegal instr. (not reset when caught) */
|
||||
"SIGTRAP", /* trace trap (not reset when caught) */
|
||||
- "SIGABRT", /* used by abort, replace SIGIOT in the future */
|
||||
- "SIGIOT",
|
||||
- "SIGBUS",
|
||||
+ "SIGABRT", /* abort() */
|
||||
+ "SIGEMT", /* EMT instruction */
|
||||
"SIGFPE", /* floating point exception */
|
||||
"SIGKILL", /* kill (cannot be caught or ignored) */
|
||||
- "SIGUSR1", /* user defined signal 1 */
|
||||
+ "SIGBUS", /* bus error */
|
||||
"SIGSEGV", /* segmentation violation */
|
||||
- "SIGUSR2", /* user defined signal 2 */
|
||||
+ "SIGSYS", /* non-existent system call invoked */
|
||||
"SIGPIPE", /* write on a pipe with no one to read it */
|
||||
"SIGALRM", /* alarm clock */
|
||||
"SIGTERM", /* software termination signal from kill */
|
||||
- "SIGSTKFLT",
|
||||
- "SIGCHLD", /* child status change alias */
|
||||
- "SIGCONT", /* stopped process has been continued */
|
||||
- "SIGSTOP", /* stop (cannot be caught or ignored) */
|
||||
- "SIGTSTP", /* user stop requested from tty */
|
||||
- "SIGTTIN", /* background tty read attempted */
|
||||
- "SIGTTOU", /* background tty write attempted */
|
||||
- "SIGURG", /* urgent socket condition */
|
||||
- "SIGXCPU", /* exceeded cpu limit */
|
||||
+ "SIGURG", /* urgent condition on IO channel */
|
||||
+ "SIGSTOP", /* sendable stop signal not from tty */
|
||||
+ "SIGTSTP", /* stop signal from tty */
|
||||
+ "SIGCONT", /* continue a stopped process */
|
||||
+ "SIGCHLD", /* to parent on child stop or exit */
|
||||
+ "SIGTTIN", /* to readers pgrp upon background tty read */
|
||||
+ "SIGTTOU", /* like TTIN if (tp->t_local<OSTOP) */
|
||||
+ "SIGIO", /* input/output possible signal */
|
||||
+ "SIGXCPU", /* exceeded CPU time limit */
|
||||
"SIGXFSZ", /* exceeded file size limit */
|
||||
- "SIGVTALRM", /* virtual timer expired */
|
||||
- "SIGPROF", /* profiling timer expired */
|
||||
- "SIGWINCH", /* window size change */
|
||||
- "SIGPOLL", /* pollable event occured */
|
||||
- "SIGPWR", /* power-fail restart */
|
||||
- "SIGSYS"
|
||||
+ "SIGVTALRM", /* virtual time alarm */
|
||||
+ "SIGPROF", /* profiling time alarm */
|
||||
+ "SIGWINCH", /* window size changes */
|
||||
+ "SIGINFO", /* information request */
|
||||
+ "SIGUSR1", /* user defined signal 1 */
|
||||
+ "SIGUSR2" /* user defined signal 2 */
|
||||
};
|
||||
|
||||
public static String getSignalName(int sigNum) {
|
@ -1,63 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_share_classes_sun_jvm_hotspot_runtime_bsd_x86_BsdSignals_java,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java.orig Tue Jun 2 13:12:16 2009
|
||||
+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java Tue Jun 2 13:12:25 2009
|
||||
@@ -28,37 +28,36 @@ public class BsdSignals {
|
||||
private static String[] signalNames = {
|
||||
"", /* No signal 0 */
|
||||
"SIGHUP", /* hangup */
|
||||
- "SIGINT", /* interrupt (rubout) */
|
||||
- "SIGQUIT", /* quit (ASCII FS) */
|
||||
- "SIGILL", /* illegal instruction (not reset when caught) */
|
||||
+ "SIGINT", /* interrupt */
|
||||
+ "SIGQUIT", /* quit */
|
||||
+ "SIGILL", /* illegal instr. (not reset when caught) */
|
||||
"SIGTRAP", /* trace trap (not reset when caught) */
|
||||
- "SIGABRT", /* used by abort, replace SIGIOT in the future */
|
||||
- "SIGIOT",
|
||||
- "SIGBUS",
|
||||
+ "SIGABRT", /* abort() */
|
||||
+ "SIGEMT", /* EMT instruction */
|
||||
"SIGFPE", /* floating point exception */
|
||||
"SIGKILL", /* kill (cannot be caught or ignored) */
|
||||
- "SIGUSR1", /* user defined signal 1 */
|
||||
+ "SIGBUS", /* bus error */
|
||||
"SIGSEGV", /* segmentation violation */
|
||||
- "SIGUSR2", /* user defined signal 2 */
|
||||
+ "SIGSYS", /* non-existent system call invoked */
|
||||
"SIGPIPE", /* write on a pipe with no one to read it */
|
||||
"SIGALRM", /* alarm clock */
|
||||
"SIGTERM", /* software termination signal from kill */
|
||||
- "SIGSTKFLT",
|
||||
- "SIGCHLD", /* child status change alias */
|
||||
- "SIGCONT", /* stopped process has been continued */
|
||||
- "SIGSTOP", /* stop (cannot be caught or ignored) */
|
||||
- "SIGTSTP", /* user stop requested from tty */
|
||||
- "SIGTTIN", /* background tty read attempted */
|
||||
- "SIGTTOU", /* background tty write attempted */
|
||||
- "SIGURG", /* urgent socket condition */
|
||||
- "SIGXCPU", /* exceeded cpu limit */
|
||||
+ "SIGURG", /* urgent condition on IO channel */
|
||||
+ "SIGSTOP", /* sendable stop signal not from tty */
|
||||
+ "SIGTSTP", /* stop signal from tty */
|
||||
+ "SIGCONT", /* continue a stopped process */
|
||||
+ "SIGCHLD", /* to parent on child stop or exit */
|
||||
+ "SIGTTIN", /* to readers pgrp upon background tty read */
|
||||
+ "SIGTTOU", /* like TTIN if (tp->t_local<OSTOP) */
|
||||
+ "SIGIO", /* input/output possible signal */
|
||||
+ "SIGXCPU", /* exceeded CPU time limit */
|
||||
"SIGXFSZ", /* exceeded file size limit */
|
||||
- "SIGVTALRM", /* virtual timer expired */
|
||||
- "SIGPROF", /* profiling timer expired */
|
||||
- "SIGWINCH", /* window size change */
|
||||
- "SIGPOLL", /* pollable event occured */
|
||||
- "SIGPWR", /* power-fail restart */
|
||||
- "SIGSYS"
|
||||
+ "SIGVTALRM", /* virtual time alarm */
|
||||
+ "SIGPROF", /* profiling time alarm */
|
||||
+ "SIGWINCH", /* window size changes */
|
||||
+ "SIGINFO", /* information request */
|
||||
+ "SIGUSR1", /* user defined signal 1 */
|
||||
+ "SIGUSR2" /* user defined signal 2 */
|
||||
};
|
||||
|
||||
public static String getSignalName(int sigNum) {
|
@ -1,18 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_agent_src_share_classes_sun_jvm_hotspot_utilities_PlatformInfo_java,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java.orig Tue Jun 2 12:36:27 2009
|
||||
+++ hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Tue Jun 2 12:36:38 2009
|
||||
@@ -37,6 +37,14 @@ public class PlatformInfo {
|
||||
return "solaris";
|
||||
} else if (os.equals("Linux")) {
|
||||
return "linux";
|
||||
+ } else if (os.equals("FreeBSD")) {
|
||||
+ return "bsd";
|
||||
+ } else if (os.equals("NetBSD")) {
|
||||
+ return "bsd";
|
||||
+ } else if (os.equals("OpenBSD")) {
|
||||
+ return "bsd";
|
||||
+ } else if (os.equals("Darwin")) {
|
||||
+ return "bsd";
|
||||
} else if (os.startsWith("Windows")) {
|
||||
return "win32";
|
||||
} else {
|
@ -1,42 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_Makefile,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/Makefile.orig Thu Oct 28 20:17:00 2010
|
||||
+++ hotspot/make/Makefile Mon Nov 1 13:32:18 2010
|
||||
@@ -321,28 +321,28 @@ endif
|
||||
ifneq ($(OSNAME),windows)
|
||||
ifeq ($(ZERO_BUILD), true)
|
||||
ifeq ($(SHARK_BUILD), true)
|
||||
-$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(SHARK_DIR)/%.so
|
||||
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
-$(EXPORT_SERVER_DIR)/%.so: $(SHARK_DIR)/%.so
|
||||
+$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
else
|
||||
-$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(ZERO_DIR)/%.so
|
||||
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
-$(EXPORT_SERVER_DIR)/%.so: $(ZERO_DIR)/%.so
|
||||
+$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
endif
|
||||
else
|
||||
-$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C1_DIR)/%.so
|
||||
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
-$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so
|
||||
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
-$(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so
|
||||
+$(EXPORT_CLIENT_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
-$(EXPORT_CLIENT_DIR)/64/%.so: $(C1_DIR)/%.so
|
||||
+$(EXPORT_CLIENT_DIR)/64/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
-$(EXPORT_SERVER_DIR)/%.so: $(C2_DIR)/%.so
|
||||
+$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
-$(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so
|
||||
+$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX)
|
||||
$(install-file)
|
||||
endif
|
||||
endif
|
@ -1,13 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_Makefile,v 1.3 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/Makefile.orig Tue Jan 4 18:25:17 2011
|
||||
+++ hotspot/make/bsd/Makefile Tue Jan 4 18:25:19 2011
|
||||
@@ -230,7 +230,8 @@ checks: check_os_version check_j2se_version
|
||||
# Solaris 2.5.1, 2.6).
|
||||
# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok.
|
||||
|
||||
-SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7%
|
||||
+#SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7%
|
||||
+DISABLE_HOTSPOT_OS_VERSION_CHECK = ok
|
||||
OS_VERSION := $(shell uname -r)
|
||||
EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))
|
||||
|
@ -1,7 +1,7 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_adlc_make,v 1.1 2010/07/02 09:40:30 jakemsr Exp $
|
||||
--- hotspot/make/bsd/makefiles/adlc.make.orig Tue Dec 15 00:13:12 2009
|
||||
+++ hotspot/make/bsd/makefiles/adlc.make Tue Dec 15 00:14:45 2009
|
||||
@@ -62,7 +62,7 @@ CPPFLAGS += -DASSERT
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_adlc_make,v 1.2 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/adlc.make.orig Tue Sep 6 18:23:37 2011
|
||||
+++ hotspot/make/bsd/makefiles/adlc.make Wed Sep 7 09:44:08 2011
|
||||
@@ -61,7 +61,7 @@ CPPFLAGS += -DASSERT
|
||||
|
||||
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
|
||||
# Compiler warnings are treated as errors
|
||||
|
@ -1,16 +1,11 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_buildtree_make,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/buildtree.make.orig Mon Oct 25 18:02:18 2010
|
||||
+++ hotspot/make/bsd/makefiles/buildtree.make Mon Oct 25 18:15:44 2010
|
||||
@@ -287,10 +287,11 @@ env.sh: $(BUILDTREE_MAKE)
|
||||
[ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \
|
||||
{ \
|
||||
echo "LD_LIBRARY_PATH=.:$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \
|
||||
+ echo "DYLD_LIBRARY_PATH=.:$${DYLD_LIBRARY_PATH:+$$DYLD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \
|
||||
echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
|
||||
} | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
|
||||
echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
|
||||
- echo "export JAVA_HOME LD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \
|
||||
+ echo "export JAVA_HOME LD_LIBRARY_PATH DYLD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \
|
||||
) > $@
|
||||
|
||||
env.csh: env.sh
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_buildtree_make,v 1.3 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/buildtree.make.orig Tue Sep 6 18:23:38 2011
|
||||
+++ hotspot/make/bsd/makefiles/buildtree.make Wed Sep 7 09:44:08 2011
|
||||
@@ -390,7 +390,6 @@ test_gamma: $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Q
|
||||
echo '#!/bin/sh'; \
|
||||
$(BUILDTREE_COMMENT); \
|
||||
echo '. ./env.sh'; \
|
||||
- echo "exit 0;"; \
|
||||
echo "if [ \"$(CROSS_COMPILE_ARCH)\" != \"\" ]; then { $(CROSS_COMPILING_MSG); exit 0; }; fi"; \
|
||||
echo "if [ -z \$$JAVA_HOME ]; then { $(NO_JAVA_HOME_MSG); exit 0; }; fi"; \
|
||||
echo "if ! \$${JAVA_HOME}/bin/java $(JAVA_FLAG) -fullversion 2>&1 > /dev/null"; \
|
||||
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_cscope_make,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/cscope.make.orig Mon Oct 25 18:45:11 2010
|
||||
+++ hotspot/make/bsd/makefiles/cscope.make Mon Oct 25 18:45:18 2010
|
||||
@@ -71,7 +71,7 @@ endif
|
||||
# OS-specific files for other systems are excluded by default. Use CS_OS=yes
|
||||
# to include platform-specific files for other platforms.
|
||||
ifndef CS_OS
|
||||
-CS_OS = bsd macos solaris win32
|
||||
+CS_OS = linux macos solaris win32 bsd
|
||||
CS_PRUNE_OS = $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS}))
|
||||
endif
|
||||
|
@ -1,109 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_defs_make,v 1.4 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/defs.make.orig Mon Nov 1 13:15:17 2010
|
||||
+++ hotspot/make/bsd/makefiles/defs.make Mon Nov 1 13:32:58 2010
|
||||
@@ -72,8 +72,8 @@ ifeq ($(ARCH), sparc64)
|
||||
HS_ARCH = sparc
|
||||
endif
|
||||
|
||||
-# x86_64
|
||||
-ifeq ($(ARCH), x86_64)
|
||||
+# amd64
|
||||
+ifeq ($(ARCH), amd64)
|
||||
ifeq ($(ARCH_DATA_MODEL), 64)
|
||||
ARCH_DATA_MODEL = 64
|
||||
MAKE_ARGS += LP64=1
|
||||
@@ -85,17 +85,27 @@ ifeq ($(ARCH), x86_64)
|
||||
PLATFORM = bsd-i586
|
||||
VM_PLATFORM = bsd_i486
|
||||
HS_ARCH = x86
|
||||
- # We have to reset ARCH to i686 since SRCARCH relies on it
|
||||
- ARCH = i686
|
||||
+ # We have to reset ARCH to i386 since SRCARCH relies on it
|
||||
+ ARCH = i386
|
||||
endif
|
||||
endif
|
||||
|
||||
-# i686
|
||||
-ifeq ($(ARCH), i686)
|
||||
- ARCH_DATA_MODEL = 32
|
||||
- PLATFORM = bsd-i586
|
||||
- VM_PLATFORM = bsd_i486
|
||||
- HS_ARCH = x86
|
||||
+# i386
|
||||
+ifeq ($(ARCH), i386)
|
||||
+ ifeq ($(ARCH_DATA_MODEL), 64)
|
||||
+ ARCH_DATA_MODEL = 64
|
||||
+ MAKE_ARGS += LP64=1
|
||||
+ PLATFORM = bsd-amd64
|
||||
+ VM_PLATFORM = bsd_amd64
|
||||
+ HS_ARCH = x86
|
||||
+ # We have to reset ARCH to amd64 since SRCARCH relies on it
|
||||
+ ARCH = amd64
|
||||
+ else
|
||||
+ ARCH_DATA_MODEL = 32
|
||||
+ PLATFORM = bsd-i586
|
||||
+ VM_PLATFORM = bsd_i486
|
||||
+ HS_ARCH = x86
|
||||
+ endif
|
||||
endif
|
||||
|
||||
# ARM
|
||||
@@ -116,39 +126,45 @@ endif
|
||||
|
||||
JDK_INCLUDE_SUBDIR=bsd
|
||||
|
||||
+# Library suffix
|
||||
+OS_VENDOR:=$(shell uname -s)
|
||||
+ifeq ($(OS_VENDOR),Darwin)
|
||||
+ LIBRARY_SUFFIX=dylib
|
||||
+else
|
||||
+ LIBRARY_SUFFIX=so
|
||||
+endif
|
||||
+
|
||||
# FIXUP: The subdirectory for a debug build is NOT the same on all platforms
|
||||
VM_DEBUG=jvmg
|
||||
|
||||
EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
|
||||
|
||||
# client and server subdirectories have symbolic links to ../libjsig.so
|
||||
-EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so
|
||||
+EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
|
||||
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
|
||||
|
||||
ifndef BUILD_CLIENT_ONLY
|
||||
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
|
||||
-EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
|
||||
+EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
|
||||
endif
|
||||
|
||||
ifneq ($(ZERO_BUILD), true)
|
||||
ifeq ($(ARCH_DATA_MODEL), 32)
|
||||
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
|
||||
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
|
||||
- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so
|
||||
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Serviceability Binaries
|
||||
# No SA Support for PPC, IA64, ARM or zero
|
||||
-ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
|
||||
- $(EXPORT_LIB_DIR)/sa-jdi.jar
|
||||
-ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
|
||||
- $(EXPORT_LIB_DIR)/sa-jdi.jar
|
||||
-ADD_SA_BINARIES/ppc =
|
||||
-ADD_SA_BINARIES/ia64 =
|
||||
-ADD_SA_BINARIES/arm =
|
||||
-ADD_SA_BINARIES/zero =
|
||||
+ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
|
||||
+ $(EXPORT_LIB_DIR)/sa-jdi.jar
|
||||
+ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
|
||||
+ $(EXPORT_LIB_DIR)/sa-jdi.jar
|
||||
+ADD_SA_BINARIES/ppc =
|
||||
+ADD_SA_BINARIES/ia64 =
|
||||
+ADD_SA_BINARIES/arm =
|
||||
+ADD_SA_BINARIES/zero =
|
||||
|
||||
EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
|
||||
-
|
||||
-
|
@ -1,125 +1,12 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_gcc_make,v 1.3 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/gcc.make.orig Mon Nov 1 13:15:17 2010
|
||||
+++ hotspot/make/bsd/makefiles/gcc.make Mon Nov 1 13:33:24 2010
|
||||
@@ -22,18 +22,22 @@
|
||||
#
|
||||
#
|
||||
|
||||
+OS_VENDOR = $(shell uname -s)
|
||||
+
|
||||
#------------------------------------------------------------------------
|
||||
# CC, CPP & AS
|
||||
|
||||
ifdef ALT_COMPILER_PATH
|
||||
+CXX = $(ALT_COMPILER_PATH)/g++
|
||||
CPP = $(ALT_COMPILER_PATH)/g++
|
||||
CC = $(ALT_COMPILER_PATH)/gcc
|
||||
else
|
||||
-CPP = g++
|
||||
-CC = gcc
|
||||
+CXX ?= g++
|
||||
+CPP = $(CXX)
|
||||
+CC ?= gcc
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_gcc_make,v 1.4 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/gcc.make.orig Sun Sep 18 10:12:24 2011
|
||||
+++ hotspot/make/bsd/makefiles/gcc.make Sun Sep 18 10:12:36 2011
|
||||
@@ -130,7 +130,7 @@ else
|
||||
endif
|
||||
|
||||
-AS = $(CC) -c
|
||||
+AS = $(CC) -c -x assembler-with-cpp
|
||||
# Compiler warnings are treated as errors
|
||||
-WARNINGS_ARE_ERRORS = -Werror
|
||||
+WARNINGS_ARE_ERRORS =
|
||||
|
||||
# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
|
||||
# prints the numbers (e.g. "2.95", "3.2.1")
|
||||
@@ -67,7 +71,7 @@ endif
|
||||
CFLAGS += $(VM_PICFLAG)
|
||||
CFLAGS += -fno-rtti
|
||||
CFLAGS += -fno-exceptions
|
||||
-CFLAGS += -D_REENTRANT
|
||||
+CFLAGS += -pthread
|
||||
CFLAGS += -fcheck-new
|
||||
|
||||
ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
|
||||
@@ -76,10 +80,12 @@ ARCHFLAG/amd64 = -m64
|
||||
ARCHFLAG/ia64 =
|
||||
ARCHFLAG/sparc = -m32 -mcpu=v9
|
||||
ARCHFLAG/sparcv9 = -m64 -mcpu=v9
|
||||
-ARCHFLAG/arm = -fsigned-char
|
||||
ARCHFLAG/zero = $(ZERO_ARCHFLAG)
|
||||
-ifndef E500V2
|
||||
-ARCHFLAG/ppc = -mcpu=powerpc
|
||||
+
|
||||
+# Darwin-specific build flags
|
||||
+ifeq ($(OS_VENDOR), Darwin)
|
||||
+ # Ineffecient 16-byte stack re-alignment on Darwin/IA32
|
||||
+ ARCHFLAG/i486 += -mstackrealign
|
||||
endif
|
||||
|
||||
CFLAGS += $(ARCHFLAG)
|
||||
@@ -124,7 +130,12 @@ endif
|
||||
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
|
||||
# Special cases
|
||||
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
|
||||
+# XXXDARWIN: for _dyld_bind_fully_image_containing_address
|
||||
+ifeq ($(OS_VENDOR), Darwin)
|
||||
+ CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
|
||||
+endif
|
||||
|
||||
+
|
||||
# The flags to use for an Optimized g++ build
|
||||
OPT_CFLAGS += -O3
|
||||
|
||||
@@ -159,28 +170,40 @@ ifeq ($(BUILDARCH), ia64)
|
||||
LFLAGS += -Wl,-relax
|
||||
endif
|
||||
|
||||
-# Enable linker optimization
|
||||
-LFLAGS += -Xlinker -O1
|
||||
-
|
||||
-# If this is a --hash-style=gnu system, use --hash-style=both
|
||||
-# The gnu .hash section won't work on some Bsd systems like SuSE 10.
|
||||
-_HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
|
||||
-ifneq ($(_HAS_HASH_STYLE_GNU),)
|
||||
- LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
|
||||
-endif
|
||||
-LFLAGS += $(LDFLAGS_HASH_STYLE)
|
||||
-
|
||||
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
|
||||
MAPFLAG = -Xlinker --version-script=FILENAME
|
||||
|
||||
-# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
|
||||
-SONAMEFLAG = -Xlinker -soname=SONAME
|
||||
+#
|
||||
+# Shared Library
|
||||
+#
|
||||
+ifeq ($(OS_VENDOR), Darwin)
|
||||
+ # Standard linker flags
|
||||
+ LFLAGS +=
|
||||
|
||||
-# Build shared library
|
||||
-SHARED_FLAG = -shared
|
||||
+ # Darwin doesn't use ELF and doesn't support version scripts
|
||||
+ LDNOMAP = true
|
||||
|
||||
-# Keep symbols even they are not used
|
||||
-AOUT_FLAGS += -export-dynamic
|
||||
+ # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
|
||||
+ SONAMEFLAG =
|
||||
+
|
||||
+ # Build shared library
|
||||
+ SHARED_FLAG = -dynamiclib $(VM_PICFLAG)
|
||||
+
|
||||
+ # Keep symbols even they are not used
|
||||
+ #AOUT_FLAGS += -export-dynamic
|
||||
+else
|
||||
+ # Enable linker optimization
|
||||
+ LFLAGS += -Xlinker -O1
|
||||
+
|
||||
+ # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
|
||||
+ SONAMEFLAG = -Xlinker -soname=SONAME
|
||||
+
|
||||
+ # Build shared library
|
||||
+ SHARED_FLAG = -shared $(VM_PICFLAG)
|
||||
+
|
||||
+ # Keep symbols even they are not used
|
||||
+ AOUT_FLAGS += -export-dynamic
|
||||
+endif
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Debug flags
|
||||
# Except for a few acceptable ones
|
||||
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
|
||||
|
@ -1,42 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_jsig_make,v 1.4 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/jsig.make.orig Mon Oct 25 18:02:18 2010
|
||||
+++ hotspot/make/bsd/makefiles/jsig.make Mon Oct 25 18:46:39 2010
|
||||
@@ -25,11 +25,16 @@
|
||||
# Rules to build signal interposition library, used by vm.make
|
||||
|
||||
# libjsig[_g].so: signal interposition library
|
||||
-JSIG = jsig
|
||||
-LIBJSIG = lib$(JSIG).so
|
||||
+JSIG = jsig
|
||||
+JSIG_G = $(JSIG)$(G_SUFFIX)
|
||||
|
||||
-JSIG_G = $(JSIG)$(G_SUFFIX)
|
||||
-LIBJSIG_G = lib$(JSIG_G).so
|
||||
+ifeq ($(OS_VENDOR), Darwin)
|
||||
+ LIBJSIG = lib$(JSIG).dylib
|
||||
+ LIBJSIG_G = lib$(JSIG_G).dylib
|
||||
+else
|
||||
+ LIBJSIG = lib$(JSIG).so
|
||||
+ LIBJSIG_G = lib$(JSIG_G).so
|
||||
+endif
|
||||
|
||||
JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm
|
||||
|
||||
@@ -42,7 +47,7 @@ LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig
|
||||
# cause problems with interposing. See CR: 6466665
|
||||
# LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE))
|
||||
|
||||
-LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT $(LDFLAGS_HASH_STYLE)
|
||||
+LFLAGS_JSIG += -D_GNU_SOURCE -pthread $(LDFLAGS_HASH_STYLE)
|
||||
|
||||
# DEBUG_BINARIES overrides everything, use full -g debug information
|
||||
ifeq ($(DEBUG_BINARIES), true)
|
||||
@@ -52,7 +57,7 @@ endif
|
||||
$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
|
||||
@echo Making signal interposition lib...
|
||||
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
|
||||
- $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< -ldl
|
||||
+ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $<
|
||||
$(QUIETLY) [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
|
||||
|
||||
install_jsig: $(LIBJSIG)
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_jvmg_make,v 1.1 2009/01/04 23:25:16 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/jvmg.make.orig Sat Aug 2 16:12:30 2008
|
||||
+++ hotspot/make/bsd/makefiles/jvmg.make Sat Aug 2 16:15:29 2008
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
# Sets make macros for making debug version of VM
|
||||
|
||||
+DEBUG_CFLAGS/compactingPermGenGen.o = -O1
|
||||
+
|
||||
# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make
|
||||
DEBUG_CFLAGS/DEFAULT= $(DEBUG_CFLAGS)
|
||||
DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@))
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_launcher_make,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/launcher.make.orig Mon Oct 25 18:02:18 2010
|
||||
+++ hotspot/make/bsd/makefiles/launcher.make Mon Oct 25 18:15:44 2010
|
||||
@@ -46,7 +46,7 @@ ifeq ($(LINK_INTO),AOUT)
|
||||
LIBS_LAUNCHER += $(STATIC_STDCXX) $(LIBS)
|
||||
else
|
||||
LAUNCHER.o = launcher.o
|
||||
- LFLAGS_LAUNCHER += -L `pwd`
|
||||
+ LFLAGS_LAUNCHER += -L`pwd`
|
||||
LIBS_LAUNCHER += -l$(JVM) $(LIBS)
|
||||
endif
|
||||
|
@ -1,14 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_sa_make,v 1.4 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/sa.make.orig Mon Nov 1 13:15:18 2010
|
||||
+++ hotspot/make/bsd/makefiles/sa.make Mon Nov 1 13:16:13 2010
|
||||
@@ -45,8 +45,8 @@ MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
|
||||
|
||||
# gnumake 3.78.1 does not accept the *s that
|
||||
# are in AGENT_FILES1 and AGENT_FILES2, so use the shell to expand them
|
||||
-AGENT_FILES1 := $(shell /usr/bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES1))
|
||||
-AGENT_FILES2 := $(shell /usr/bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES2))
|
||||
+AGENT_FILES1 := $(shell /bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES1))
|
||||
+AGENT_FILES2 := $(shell /bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES2))
|
||||
|
||||
AGENT_FILES1_LIST := $(GENERATED)/agent1.classes.list
|
||||
AGENT_FILES2_LIST := $(GENERATED)/agent2.classes.list
|
@ -1,70 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_saproc_make,v 1.5 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/saproc.make.orig Mon Oct 25 18:02:18 2010
|
||||
+++ hotspot/make/bsd/makefiles/saproc.make Mon Oct 25 18:47:00 2010
|
||||
@@ -25,23 +25,34 @@
|
||||
# Rules to build serviceability agent library, used by vm.make
|
||||
|
||||
# libsaproc[_g].so: serviceability agent
|
||||
-
|
||||
-SAPROC = saproc
|
||||
-LIBSAPROC = lib$(SAPROC).so
|
||||
-
|
||||
+SAPROC = saproc
|
||||
SAPROC_G = $(SAPROC)$(G_SUFFIX)
|
||||
-LIBSAPROC_G = lib$(SAPROC_G).so
|
||||
|
||||
+ifeq ($(OS_VENDOR), Darwin)
|
||||
+ LIBSAPROC = lib$(SAPROC).dylib
|
||||
+ LIBSAPROC_G = lib$(SAPROC_G).dylib
|
||||
+else
|
||||
+ LIBSAPROC = lib$(SAPROC).so
|
||||
+ LIBSAPROC_G = lib$(SAPROC_G).so
|
||||
+endif
|
||||
+
|
||||
AGENT_DIR = $(GAMMADIR)/agent
|
||||
|
||||
SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
|
||||
|
||||
+ifeq ($(OS_VENDOR), FreeBSD)
|
||||
SASRCFILES = $(SASRCDIR)/salibelf.c \
|
||||
$(SASRCDIR)/symtab.c \
|
||||
$(SASRCDIR)/libproc_impl.c \
|
||||
$(SASRCDIR)/ps_proc.c \
|
||||
$(SASRCDIR)/ps_core.c \
|
||||
+ $(SASRCDIR)/hsearch_r.c \
|
||||
$(SASRCDIR)/BsdDebuggerLocal.c
|
||||
+SALIBS = -lutil -lthread_db
|
||||
+else
|
||||
+SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
|
||||
+SALIBS =
|
||||
+endif
|
||||
|
||||
SAMAPFILE = $(SASRCDIR)/mapfile
|
||||
|
||||
@@ -60,7 +71,10 @@ checkAndBuildSA:
|
||||
$(MAKE) -f vm.make $(LIBSAPROC); \
|
||||
fi
|
||||
|
||||
-SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE)
|
||||
+ifneq ($(OS_VENDOR), Darwin)
|
||||
+SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
|
||||
+endif
|
||||
+SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
|
||||
|
||||
$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
|
||||
$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
|
||||
@@ -73,12 +87,12 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
|
||||
-I$(SASRCDIR) \
|
||||
-I$(GENERATED) \
|
||||
-I$(BOOT_JAVA_HOME)/include \
|
||||
- -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \
|
||||
+ -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \
|
||||
$(SASRCFILES) \
|
||||
$(SA_LFLAGS) \
|
||||
$(SA_DEBUG_CFLAGS) \
|
||||
-o $@ \
|
||||
- -lthread_db
|
||||
+ $(SALIBS)
|
||||
$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
|
||||
|
||||
install_saproc: checkAndBuildSA
|
@ -1,120 +1,14 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_vm_make,v 1.4 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/vm.make.orig Mon Nov 1 13:15:19 2010
|
||||
+++ hotspot/make/bsd/makefiles/vm.make Mon Nov 1 13:33:41 2010
|
||||
@@ -90,6 +90,10 @@ CPPFLAGS = \
|
||||
${JRE_VERSION} \
|
||||
${VM_DISTRO}
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_vm_make,v 1.5 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/vm.make.orig Sun Sep 18 11:09:06 2011
|
||||
+++ hotspot/make/bsd/makefiles/vm.make Sun Sep 18 14:56:19 2011
|
||||
@@ -96,6 +96,10 @@ ifdef DEFAULT_LIBPATH
|
||||
CPPFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
|
||||
endif
|
||||
|
||||
+ifdef DEFAULT_LIBPATH
|
||||
+CPPFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
|
||||
+ifdef SHARK_LLVM_VERSION
|
||||
+CPPFLAGS += -DSHARK_LLVM_VERSION="$(SHARK_LLVM_VERSION)"
|
||||
+endif
|
||||
+
|
||||
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
|
||||
CFLAGS += $(CFLAGS_WARN/BYFILE)
|
||||
|
||||
@@ -100,7 +104,7 @@ CFLAGS += $(CFLAGS/NOEX)
|
||||
CFLAGS += $(EXTRA_CFLAGS)
|
||||
LFLAGS += $(EXTRA_CFLAGS)
|
||||
|
||||
-LIBS += -lm -ldl -lpthread
|
||||
+LIBS += -lm -pthread
|
||||
|
||||
# By default, link the *.o into the library, not the executable.
|
||||
LINK_INTO$(LINK_INTO) = LIBJVM
|
||||
@@ -114,9 +118,15 @@ include $(MAKEFILES_DIR)/dtrace.make
|
||||
#----------------------------------------------------------------------
|
||||
# JVM
|
||||
|
||||
-JVM = jvm
|
||||
-LIBJVM = lib$(JVM).so
|
||||
-LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
|
||||
+JVM = jvm
|
||||
+ifeq ($(OS_VENDOR), Darwin)
|
||||
+ LIBJVM = lib$(JVM).dylib
|
||||
+ LIBJVM_G = lib$(JVM)$(G_SUFFIX).dylib
|
||||
+ CFLAGS += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
|
||||
+else
|
||||
+ LIBJVM = lib$(JVM).so
|
||||
+ LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
|
||||
+endif
|
||||
|
||||
JVM_OBJ_FILES = $(Obj_Files)
|
||||
|
||||
@@ -137,15 +147,7 @@ mapfile_reorder : mapfile $(REORDERFILE)
|
||||
vm.def: $(Res_Files) $(Obj_Files)
|
||||
sh $(GAMMADIR)/make/bsd/makefiles/build_vm_def.sh *.o > $@
|
||||
|
||||
-ifeq ($(SHARK_BUILD), true)
|
||||
- STATIC_CXX = false
|
||||
-else
|
||||
- ifeq ($(ZERO_LIBARCH), ppc64)
|
||||
- STATIC_CXX = false
|
||||
- else
|
||||
- STATIC_CXX = true
|
||||
- endif
|
||||
-endif
|
||||
+STATIC_CXX = false
|
||||
|
||||
ifeq ($(LINK_INTO),AOUT)
|
||||
LIBJVM.o =
|
||||
@@ -157,14 +159,21 @@ else
|
||||
LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
|
||||
LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM))
|
||||
|
||||
+ ifeq ($(OS_VENDOR), Darwin)
|
||||
+ LFLAGS_VM += -Xlinker -rpath -Xlinker @loader_path/.
|
||||
+ LFLAGS_VM += -Xlinker -rpath -Xlinker @loader_path/..
|
||||
+ LFLAGS_VM += -Xlinker -install_name -Xlinker @rpath/$(@F)
|
||||
+ endif
|
||||
+
|
||||
# JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
|
||||
# get around library dependency and compatibility issues. Must use gcc not
|
||||
# g++ to link.
|
||||
ifeq ($(STATIC_CXX), true)
|
||||
LFLAGS_VM += $(STATIC_LIBGCC)
|
||||
LIBS_VM += $(STATIC_STDCXX)
|
||||
+ LINK_VM = $(LINK_LIB.c)
|
||||
else
|
||||
- LIBS_VM += -lstdc++
|
||||
+ LINK_VM = $(LINK_LIB.CC)
|
||||
endif
|
||||
|
||||
LIBS_VM += $(LIBS)
|
||||
@@ -177,7 +186,6 @@ ifeq ($(SHARK_BUILD), true)
|
||||
LIBS_VM += $(LLVM_LIBS)
|
||||
endif
|
||||
|
||||
-LINK_VM = $(LINK_LIB.c)
|
||||
|
||||
# rule for building precompiled header
|
||||
$(PRECOMPILED_HEADER): $(Precompiled_Files)
|
||||
@@ -205,11 +213,6 @@ $(LD_SCRIPT): $(LIBJVM_MAPFILE)
|
||||
LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT)
|
||||
endif
|
||||
|
||||
-# With more recent Redhat releases (or the cutting edge version Fedora), if
|
||||
-# SEBsd is configured to be enabled, the runtime linker will fail to apply
|
||||
-# the text relocation to libjvm.so considering that it is built as a non-PIC
|
||||
-# DSO. To workaround that, we run chcon to libjvm.so after it is built. See
|
||||
-# details in bug 6538311.
|
||||
$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
|
||||
$(QUIETLY) { \
|
||||
echo Linking vm...; \
|
||||
@@ -219,17 +222,6 @@ $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
|
||||
$(LINK_LIB.CC/POST_HOOK) \
|
||||
rm -f $@.1; ln -s $@ $@.1; \
|
||||
[ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
|
||||
- if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then \
|
||||
- if [ -x /usr/sbin/sebsdenabled ] ; then \
|
||||
- /usr/sbin/sebsdenabled; \
|
||||
- if [ $$? = 0 ] ; then \
|
||||
- /usr/bin/chcon -t textrel_shlib_t $@; \
|
||||
- if [ $$? != 0 ]; then \
|
||||
- echo "ERROR: Cannot chcon $@"; \
|
||||
- fi \
|
||||
- fi \
|
||||
- fi \
|
||||
- fi \
|
||||
}
|
||||
|
||||
DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
|
||||
|
@ -1,27 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_makefiles_zeroshark_make,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/makefiles/zeroshark.make.orig Mon Oct 25 18:52:01 2010
|
||||
+++ hotspot/make/bsd/makefiles/zeroshark.make Mon Oct 25 18:52:08 2010
|
||||
@@ -40,4 +40,23 @@ ifeq ($(ARCH_DATA_MODEL), 64)
|
||||
CFLAGS += -D_LP64=1
|
||||
endif
|
||||
|
||||
+# Specify the path to the FFI headers
|
||||
+ifdef ALT_PACKAGE_PATH
|
||||
+ PACKAGE_PATH = $(ALT_PACKAGE_PATH)
|
||||
+else
|
||||
+ ifeq ($(OS_VENDOR),Apple)
|
||||
+ PACKAGE_PATH = /opt/local
|
||||
+ else
|
||||
+ ifeq ($(OS_VENDOR),NetBSD)
|
||||
+ PACKAGE_PATH = /usr/pkg
|
||||
+ LIBS += -Wl,-R${PACKAGE_PATH}/lib
|
||||
+ else
|
||||
+ PACKAGE_PATH = /usr/local
|
||||
+ endif
|
||||
+ endif
|
||||
+endif
|
||||
+
|
||||
+CFLAGS += -I$(PACKAGE_PATH)/include
|
||||
+LIBS += -L$(PACKAGE_PATH)/lib -lffi
|
||||
+
|
||||
OPT_CFLAGS/compactingPermGenGen.o = -O1
|
@ -1,9 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_platform_amd64,v 1.1 2009/01/04 23:25:16 kurt Exp $
|
||||
--- hotspot/make/bsd/platform_amd64.orig Fri Aug 8 12:45:41 2008
|
||||
+++ hotspot/make/bsd/platform_amd64 Fri Aug 8 12:46:04 2008
|
||||
@@ -12,4 +12,4 @@ lib_arch = amd64
|
||||
|
||||
compiler = gcc
|
||||
|
||||
-sysdefs = -DLINUX -D_GNU_SOURCE -DAMD64
|
||||
+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DAMD64
|
@ -1,9 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_platform_amd64_suncc,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/platform_amd64.suncc.orig Mon Oct 25 18:53:09 2010
|
||||
+++ hotspot/make/bsd/platform_amd64.suncc Mon Oct 25 18:53:15 2010
|
||||
@@ -14,4 +14,4 @@ compiler = sparcWorks
|
||||
|
||||
gnu_dis_arch = amd64
|
||||
|
||||
-sysdefs = -DLINUX -DSPARC_WORKS -D_GNU_SOURCE -DAMD64
|
||||
+sysdefs = -D_ALLBSD_SOURCE -DSPARC_WORKS -D_GNU_SOURCE -DAMD64
|
@ -1,9 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_platform_i486,v 1.1 2009/01/04 23:25:16 kurt Exp $
|
||||
--- hotspot/make/bsd/platform_i486.orig Fri Aug 8 12:46:25 2008
|
||||
+++ hotspot/make/bsd/platform_i486 Fri Aug 8 12:46:40 2008
|
||||
@@ -12,4 +12,4 @@ lib_arch = i386
|
||||
|
||||
compiler = gcc
|
||||
|
||||
-sysdefs = -DLINUX -D_GNU_SOURCE -DIA32
|
||||
+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DIA32
|
@ -1,9 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_platform_i486_suncc,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/platform_i486.suncc.orig Mon Oct 25 18:53:32 2010
|
||||
+++ hotspot/make/bsd/platform_i486.suncc Mon Oct 25 18:53:39 2010
|
||||
@@ -14,4 +14,4 @@ compiler = sparcWorks
|
||||
|
||||
gnu_dis_arch = i386
|
||||
|
||||
-sysdefs = -DLINUX -DSPARC_WORKS -D_GNU_SOURCE -DIA32
|
||||
+sysdefs = -D_ALLBSD_SOURCE -DSPARC_WORKS -D_GNU_SOURCE -DIA32
|
@ -1,11 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_platform_ia64,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/platform_ia64.orig Mon Oct 25 18:53:53 2010
|
||||
+++ hotspot/make/bsd/platform_ia64 Mon Oct 25 18:54:00 2010
|
||||
@@ -10,6 +10,6 @@ compiler = gcc
|
||||
|
||||
gnu_dis_arch = ia64
|
||||
|
||||
-sysdefs = -DLINUX -D_GNU_SOURCE -DIA64 -DCC_INTERP
|
||||
+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DIA64 -DCC_INTERP
|
||||
|
||||
mark_style = alignment
|
@ -1,9 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_platform_sparc,v 1.1 2009/01/04 23:25:16 kurt Exp $
|
||||
--- hotspot/make/bsd/platform_sparc.orig Fri Aug 8 12:46:51 2008
|
||||
+++ hotspot/make/bsd/platform_sparc Fri Aug 8 12:46:59 2008
|
||||
@@ -12,4 +12,4 @@ lib_arch = sparc
|
||||
|
||||
compiler = gcc
|
||||
|
||||
-sysdefs = -DLINUX -D_GNU_SOURCE -DSPARC
|
||||
+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DSPARC
|
@ -1,9 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_platform_sparcv9,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/platform_sparcv9.orig Mon Oct 25 18:54:12 2010
|
||||
+++ hotspot/make/bsd/platform_sparcv9 Mon Oct 25 18:54:20 2010
|
||||
@@ -12,4 +12,4 @@ lib_arch = sparcv9
|
||||
|
||||
compiler = gcc
|
||||
|
||||
-sysdefs = -DLINUX -D_GNU_SOURCE -DSPARC
|
||||
+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DSPARC
|
@ -1,9 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_bsd_platform_zero_in,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/bsd/platform_zero.in.orig Mon Oct 25 18:54:32 2010
|
||||
+++ hotspot/make/bsd/platform_zero.in Mon Oct 25 18:54:40 2010
|
||||
@@ -14,4 +14,4 @@ compiler = gcc
|
||||
|
||||
gnu_dis_arch = zero
|
||||
|
||||
-sysdefs = -DLINUX -D_GNU_SOURCE -DCC_INTERP -DZERO -D@ZERO_ARCHDEF@ -DZERO_LIBARCH=\"@ZERO_LIBARCH@\"
|
||||
+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DCC_INTERP -DZERO -D@ZERO_ARCHDEF@ -DZERO_LIBARCH=\"@ZERO_LIBARCH@\"
|
@ -1,29 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_defs_make,v 1.4 2009/05/23 03:03:24 kurt Exp $
|
||||
--- hotspot/make/defs.make.orig Fri May 8 03:30:27 2009
|
||||
+++ hotspot/make/defs.make Fri May 15 17:12:33 2009
|
||||
@@ -119,13 +119,23 @@ endif
|
||||
# Windows should have OS predefined
|
||||
ifeq ($(OS),)
|
||||
OS := $(shell uname -s)
|
||||
+ ifneq ($(findstring BSD,$(OS)),)
|
||||
+ OS=bsd
|
||||
+ endif
|
||||
+ ifeq ($(OS), Darwin)
|
||||
+ OS=bsd
|
||||
+ endif
|
||||
HOST := $(shell uname -n)
|
||||
endif
|
||||
|
||||
-# If not SunOS and not Linux, assume Windows
|
||||
+# If not SunOS, not Linux and not BSD, assume Windows
|
||||
ifneq ($(OS), Linux)
|
||||
ifneq ($(OS), SunOS)
|
||||
- OSNAME=windows
|
||||
+ ifneq ($(OS), bsd)
|
||||
+ OSNAME=windows
|
||||
+ else
|
||||
+ OSNAME=bsd
|
||||
+ endif
|
||||
else
|
||||
OSNAME=solaris
|
||||
endif
|
@ -1,45 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_linux_makefiles_defs_make,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/linux/makefiles/defs.make.orig Thu Oct 28 20:17:00 2010
|
||||
+++ hotspot/make/linux/makefiles/defs.make Mon Nov 1 13:33:56 2010
|
||||
@@ -116,33 +116,36 @@ endif
|
||||
|
||||
JDK_INCLUDE_SUBDIR=linux
|
||||
|
||||
+# Library suffix
|
||||
+LIBRARY_SUFFIX=so
|
||||
+
|
||||
# FIXUP: The subdirectory for a debug build is NOT the same on all platforms
|
||||
VM_DEBUG=jvmg
|
||||
|
||||
EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
|
||||
|
||||
# client and server subdirectories have symbolic links to ../libjsig.so
|
||||
-EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so
|
||||
+EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
|
||||
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
|
||||
|
||||
ifndef BUILD_CLIENT_ONLY
|
||||
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
|
||||
-EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
|
||||
+EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
|
||||
endif
|
||||
|
||||
ifneq ($(ZERO_BUILD), true)
|
||||
ifeq ($(ARCH_DATA_MODEL), 32)
|
||||
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
|
||||
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
|
||||
- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so
|
||||
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Serviceability Binaries
|
||||
# No SA Support for PPC, IA64, ARM or zero
|
||||
-ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
|
||||
+ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
|
||||
$(EXPORT_LIB_DIR)/sa-jdi.jar
|
||||
-ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
|
||||
+ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
|
||||
$(EXPORT_LIB_DIR)/sa-jdi.jar
|
||||
ADD_SA_BINARIES/ppc =
|
||||
ADD_SA_BINARIES/ia64 =
|
@ -1,23 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_sa_files,v 1.1 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/make/sa.files.orig Tue Jun 2 12:38:13 2009
|
||||
+++ hotspot/make/sa.files Tue Jun 2 12:38:18 2009
|
||||
@@ -50,6 +50,9 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/code/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/compiler/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/amd64/*.java \
|
||||
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/*.java \
|
||||
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/amd64/*.java \
|
||||
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/x86/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/x86/*.java \
|
||||
@@ -95,6 +98,9 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/oops/*.java
|
||||
AGENT_FILES2 = \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/amd64/*.java \
|
||||
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd/*.java \
|
||||
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_amd64/*.java \
|
||||
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_x86/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/ia64/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_amd64/*.java \
|
@ -1,54 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_solaris_makefiles_defs_make,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/solaris/makefiles/defs.make.orig Thu Oct 28 20:17:00 2010
|
||||
+++ hotspot/make/solaris/makefiles/defs.make Mon Nov 1 13:34:05 2010
|
||||
@@ -61,34 +61,37 @@ endif
|
||||
|
||||
JDK_INCLUDE_SUBDIR=solaris
|
||||
|
||||
+# Library suffix
|
||||
+LIBRARY_SUFFIX=so
|
||||
+
|
||||
# FIXUP: The subdirectory for a debug build is NOT the same on all platforms
|
||||
VM_DEBUG=jvmg
|
||||
|
||||
EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
|
||||
|
||||
-# client and server subdirectories have symbolic links to ../libjsig.so
|
||||
-EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so
|
||||
+# client and server subdirectories have symbolic links to ../libjsig.$(LIBRARY_SUFFIX)
|
||||
+EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
|
||||
|
||||
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
|
||||
ifneq ($(BUILD_CLIENT_ONLY),true)
|
||||
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
|
||||
-EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
|
||||
-EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.so
|
||||
-EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.so
|
||||
+EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
|
||||
+EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.$(LIBRARY_SUFFIX)
|
||||
+EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX)
|
||||
endif
|
||||
ifeq ($(ARCH_DATA_MODEL), 32)
|
||||
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
|
||||
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
|
||||
- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so
|
||||
- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.so
|
||||
- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.so
|
||||
- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.so
|
||||
- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.so
|
||||
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
|
||||
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.$(LIBRARY_SUFFIX)
|
||||
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX)
|
||||
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
|
||||
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX)
|
||||
ifneq ($(BUILD_CLIENT_ONLY), true)
|
||||
- EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.so
|
||||
- EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.so
|
||||
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
|
||||
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX)
|
||||
endif
|
||||
endif
|
||||
|
||||
-EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so
|
||||
+EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX)
|
||||
EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
|
@ -1,44 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_make_windows_makefiles_defs_make,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/make/windows/makefiles/defs.make.orig Mon Oct 25 19:04:10 2010
|
||||
+++ hotspot/make/windows/makefiles/defs.make Mon Oct 25 19:04:16 2010
|
||||
@@ -109,6 +109,9 @@ endif
|
||||
|
||||
JDK_INCLUDE_SUBDIR=win32
|
||||
|
||||
+# Library suffix
|
||||
+LIBRARY_SUFFIX=dll
|
||||
+
|
||||
# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
|
||||
# and added to MAKE_ARGS list in $(GAMMADIR)/make/defs.make.
|
||||
|
||||
@@ -172,26 +175,26 @@ endif
|
||||
|
||||
EXPORT_SERVER_DIR = $(EXPORT_JRE_BIN_DIR)/server
|
||||
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
|
||||
-EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.dll
|
||||
+EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.$(LIBRARY_SUFFIX)
|
||||
EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.pdb
|
||||
EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.map
|
||||
EXPORT_LIST += $(EXPORT_LIB_DIR)/jvm.lib
|
||||
ifeq ($(ARCH_DATA_MODEL), 32)
|
||||
EXPORT_CLIENT_DIR = $(EXPORT_JRE_BIN_DIR)/client
|
||||
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
|
||||
- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.dll
|
||||
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.$(LIBRARY_SUFFIX)
|
||||
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.pdb
|
||||
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.map
|
||||
# kernel vm
|
||||
EXPORT_KERNEL_DIR = $(EXPORT_JRE_BIN_DIR)/kernel
|
||||
EXPORT_LIST += $(EXPORT_KERNEL_DIR)/Xusage.txt
|
||||
- EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.dll
|
||||
+ EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.$(LIBRARY_SUFFIX)
|
||||
EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.pdb
|
||||
EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.map
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_WIN_SA), 1)
|
||||
- EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.dll
|
||||
+ EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX)
|
||||
EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.pdb
|
||||
EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.map
|
||||
EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_cpu_sparc_vm_globals_sparc_hpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/cpu/sparc/vm/globals_sparc.hpp.orig Tue Jan 4 18:51:43 2011
|
||||
+++ hotspot/src/cpu/sparc/vm/globals_sparc.hpp Tue Jan 4 18:52:04 2011
|
||||
@@ -63,4 +63,8 @@ define_pd_global(intx, PreInflateSpin, 40); //
|
||||
define_pd_global(bool, RewriteBytecodes, true);
|
||||
define_pd_global(bool, RewriteFrequentPairs, true);
|
||||
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+define_pd_global(bool, UseMembar, true);
|
||||
+#else
|
||||
define_pd_global(bool, UseMembar, false);
|
||||
+#endif
|
@ -1,14 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_cpu_x86_vm_c1_LIRAssembler_x86_cpp,v 1.3 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp.orig Fri Oct 29 14:46:06 2010
|
||||
+++ hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri Oct 29 14:46:13 2010
|
||||
@@ -469,8 +469,8 @@ int LIR_Assembler::emit_unwind_handler() {
|
||||
// Fetch the exception from TLS and clear out exception related thread state
|
||||
__ get_thread(rsi);
|
||||
__ movptr(rax, Address(rsi, JavaThread::exception_oop_offset()));
|
||||
- __ movptr(Address(rsi, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD);
|
||||
- __ movptr(Address(rsi, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD);
|
||||
+ __ movptr(Address(rsi, JavaThread::exception_oop_offset()), (intptr_t)NULL_WORD);
|
||||
+ __ movptr(Address(rsi, JavaThread::exception_pc_offset()), (intptr_t)NULL_WORD);
|
||||
|
||||
__ bind(_unwind_handler_entry);
|
||||
__ verify_not_null_oop(rax);
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_cpu_x86_vm_globals_x86_hpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/cpu/x86/vm/globals_x86.hpp.orig Tue Jan 4 18:52:24 2011
|
||||
+++ hotspot/src/cpu/x86/vm/globals_x86.hpp Tue Jan 4 18:52:45 2011
|
||||
@@ -64,4 +64,8 @@ define_pd_global(intx, PreInflateSpin, 10);
|
||||
define_pd_global(bool, RewriteBytecodes, true);
|
||||
define_pd_global(bool, RewriteFrequentPairs, true);
|
||||
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+define_pd_global(bool, UseMembar, true);
|
||||
+#else
|
||||
define_pd_global(bool, UseMembar, false);
|
||||
+#endif
|
@ -1,21 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_cpu_x86_vm_interp_masm_x86_32_cpp,v 1.5 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp.orig Fri Aug 13 03:28:18 2010
|
||||
+++ hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Mon Oct 25 18:15:45 2010
|
||||
@@ -1153,7 +1153,7 @@ void InterpreterMacroAssembler::record_klass_in_profil
|
||||
int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row));
|
||||
set_mdp_data_at(mdp, recvr_offset, receiver);
|
||||
int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row));
|
||||
- movptr(reg2, (int32_t)DataLayout::counter_increment);
|
||||
+ movptr(reg2, (intptr_t)DataLayout::counter_increment);
|
||||
set_mdp_data_at(mdp, count_offset, reg2);
|
||||
if (start_row > 0) {
|
||||
jmp(done);
|
||||
@@ -1296,7 +1296,7 @@ void InterpreterMacroAssembler::profile_switch_case(Re
|
||||
test_method_data_pointer(mdp, profile_continue);
|
||||
|
||||
// Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes()
|
||||
- movptr(reg2, (int32_t)in_bytes(MultiBranchData::per_case_size()));
|
||||
+ movptr(reg2, (intptr_t)in_bytes(MultiBranchData::per_case_size()));
|
||||
// index is positive and so should have correct value if this code were
|
||||
// used on 64bits
|
||||
imulptr(index, reg2);
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_cpu_x86_vm_jni_x86_h,v 1.1 2008/03/19 18:05:43 kurt Exp $
|
||||
--- hotspot/src/cpu/x86/vm/jni_x86.h.orig Wed Nov 7 13:22:07 2007
|
||||
+++ hotspot/src/cpu/x86/vm/jni_x86.h Wed Nov 7 13:22:23 2007
|
||||
@@ -26,7 +26,7 @@
|
||||
#ifndef _JAVASOFT_JNI_MD_H_
|
||||
#define _JAVASOFT_JNI_MD_H_
|
||||
|
||||
-#if defined(SOLARIS) || defined(LINUX)
|
||||
+#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)
|
||||
#define JNIEXPORT
|
||||
#define JNIIMPORT
|
||||
#define JNICALL
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_cpu_zero_vm_globals_zero_hpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/cpu/zero/vm/globals_zero.hpp.orig Tue Jan 4 18:53:00 2011
|
||||
+++ hotspot/src/cpu/zero/vm/globals_zero.hpp Tue Jan 4 18:53:18 2011
|
||||
@@ -46,4 +46,8 @@ define_pd_global(intx, StackShadowPages, 5 LP64_O
|
||||
define_pd_global(bool, RewriteBytecodes, true);
|
||||
define_pd_global(bool, RewriteFrequentPairs, true);
|
||||
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+define_pd_global(bool, UseMembar, true);
|
||||
+#else
|
||||
define_pd_global(bool, UseMembar, false);
|
||||
+#endif
|
@ -1,140 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_launcher_java_md_c,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os/bsd/launcher/java_md.c.orig Mon Nov 1 13:14:58 2010
|
||||
+++ hotspot/src/os/bsd/launcher/java_md.c Mon Nov 1 13:16:15 2010
|
||||
@@ -45,8 +45,15 @@
|
||||
#include "version_comp.h"
|
||||
#endif
|
||||
|
||||
+#ifdef __APPLE__
|
||||
+#define JVM_DLL "libjvm.dylib"
|
||||
+#define JAVA_DLL "libjava.dylib"
|
||||
+#define LD_LIBRARY_PATH "DYLD_LIBRARY_PATH"
|
||||
+#else
|
||||
#define JVM_DLL "libjvm.so"
|
||||
#define JAVA_DLL "libjava.so"
|
||||
+#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
|
||||
+#endif
|
||||
|
||||
#ifndef GAMMA /* launcher.make defines ARCH */
|
||||
|
||||
@@ -116,7 +123,7 @@ extern char **environ;
|
||||
* A collection of useful strings. One should think of these as #define
|
||||
* entries, but actual strings can be more efficient (with many compilers).
|
||||
*/
|
||||
-#ifdef __bsd__
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
static const char *system_dir = "/usr/java";
|
||||
static const char *user_dir = "/java";
|
||||
#else /* Solaris */
|
||||
@@ -460,10 +467,10 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
* If not on Solaris, assume only a single LD_LIBRARY_PATH
|
||||
* variable.
|
||||
*/
|
||||
- runpath = getenv("LD_LIBRARY_PATH");
|
||||
+ runpath = getenv(LD_LIBRARY_PATH);
|
||||
#endif /* __sun */
|
||||
|
||||
-#ifdef __bsd
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
/*
|
||||
* On bsd, if a binary is running as sgid or suid, glibc sets
|
||||
* LD_LIBRARY_PATH to the empty string for security purposes. (In
|
||||
@@ -476,7 +483,7 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
* return from the function now. Getting the right libraries to
|
||||
* be found must be handled through other mechanisms.
|
||||
*/
|
||||
- if((getgid() != getegid()) || (getuid() != geteuid()) ) {
|
||||
+ if(issetugid()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -487,7 +494,7 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
new_runpath = MemAlloc( ((runpath!=NULL)?strlen(runpath):0) +
|
||||
2*strlen(jrepath) + 2*strlen(arch) +
|
||||
strlen(jvmpath) + 52);
|
||||
- newpath = new_runpath + strlen("LD_LIBRARY_PATH=");
|
||||
+ newpath = new_runpath + strlen(LD_LIBRARY_PATH "=");
|
||||
|
||||
|
||||
/*
|
||||
@@ -502,7 +509,7 @@ CreateExecutionEnvironment(int *_argcp,
|
||||
|
||||
/* jvmpath, ((running != wanted)?((wanted==64)?"/"BIG_ARCH:"/.."):""), */
|
||||
|
||||
- sprintf(new_runpath, "LD_LIBRARY_PATH="
|
||||
+ sprintf(new_runpath, LD_LIBRARY_PATH "="
|
||||
"%s:"
|
||||
"%s/lib/%s:"
|
||||
"%s/../lib/%s",
|
||||
@@ -840,7 +847,7 @@ GetXUsagePath(char *buf, jint bufsize)
|
||||
jboolean
|
||||
GetApplicationHome(char *buf, jint bufsize)
|
||||
{
|
||||
-#ifdef __bsd__
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
char *execname = GetExecname();
|
||||
if (execname) {
|
||||
strncpy(buf, execname, bufsize-1);
|
||||
@@ -1009,7 +1016,7 @@ SetExecname(char **argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
-#elif defined(__bsd__)
|
||||
+#elif defined(__linux__)
|
||||
{
|
||||
const char* self = "/proc/self/exe";
|
||||
char buf[PATH_MAX+1];
|
||||
@@ -1019,7 +1026,7 @@ SetExecname(char **argv)
|
||||
exec_path = strdup(buf);
|
||||
}
|
||||
}
|
||||
-#else /* !__sun && !__bsd */
|
||||
+#else /* !__sun && !__linux */
|
||||
{
|
||||
/* Not implemented */
|
||||
}
|
||||
@@ -1224,7 +1231,7 @@ get_cpuid(uint32_t arg,
|
||||
|
||||
#endif /* __sun && i586 */
|
||||
|
||||
-#if defined(__bsd__) && defined(i586)
|
||||
+#if defined(_ALLBSD_SOURCE) && defined(i586)
|
||||
|
||||
/*
|
||||
* A utility method for asking the CPU about itself.
|
||||
@@ -1290,7 +1297,7 @@ get_cpuid(uint32_t arg,
|
||||
#endif
|
||||
}
|
||||
|
||||
-#endif /* __bsd__ && i586 */
|
||||
+#endif /* _ALLBSD_SOURCE && i586 */
|
||||
|
||||
#ifdef i586
|
||||
/*
|
||||
@@ -1469,7 +1476,7 @@ solaris_i586_ServerClassMachine(void) {
|
||||
|
||||
#endif /* __sun && i586 */
|
||||
|
||||
-#if defined(__bsd__) && defined(i586)
|
||||
+#if defined(_ALLBSD_SOURCE) && defined(i586)
|
||||
|
||||
/* The definition of a server-class machine for bsd-i586 */
|
||||
jboolean
|
||||
@@ -1500,7 +1507,7 @@ bsd_i586_ServerClassMachine(void) {
|
||||
return result;
|
||||
}
|
||||
|
||||
-#endif /* __bsd__ && i586 */
|
||||
+#endif /* _ALLBSD_SOURCE && i586 */
|
||||
|
||||
/* Dispatch to the platform-specific definition of "server-class" */
|
||||
jboolean
|
||||
@@ -1510,7 +1517,7 @@ ServerClassMachine(void) {
|
||||
result = solaris_sparc_ServerClassMachine();
|
||||
#elif defined(__sun) && defined(i586)
|
||||
result = solaris_i586_ServerClassMachine();
|
||||
-#elif defined(__bsd__) && defined(i586)
|
||||
+#elif defined(_ALLBSD_SOURCE) && defined(i586)
|
||||
result = bsd_i586_ServerClassMachine();
|
||||
#else
|
||||
if (_launcher_debug) {
|
@ -1,57 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_attachListener_bsd_cpp,v 1.4 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/attachListener_bsd.cpp.orig Mon Nov 1 13:14:58 2010
|
||||
+++ hotspot/src/os/bsd/vm/attachListener_bsd.cpp Mon Nov 1 13:16:15 2010
|
||||
@@ -334,6 +334,15 @@ BsdAttachOperation* BsdAttachListener::dequeue() {
|
||||
|
||||
// get the credentials of the peer and check the effective uid/guid
|
||||
// - check with jeff on this.
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+ uid_t puid;
|
||||
+ gid_t pgid;
|
||||
+ if (::getpeereid(s, &puid, &pgid) != 0) {
|
||||
+ int res;
|
||||
+ RESTARTABLE(::close(s), res);
|
||||
+ continue;
|
||||
+ }
|
||||
+#else
|
||||
struct ucred cred_info;
|
||||
socklen_t optlen = sizeof(cred_info);
|
||||
if (::getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void*)&cred_info, &optlen) == -1) {
|
||||
@@ -341,10 +350,13 @@ BsdAttachOperation* BsdAttachListener::dequeue() {
|
||||
RESTARTABLE(::close(s), res);
|
||||
continue;
|
||||
}
|
||||
+ uid_t puid = cred_info.uid;
|
||||
+ gid_t pgid = cred_info.gid;
|
||||
+#endif
|
||||
uid_t euid = geteuid();
|
||||
gid_t egid = getegid();
|
||||
|
||||
- if (cred_info.uid != euid || cred_info.gid != egid) {
|
||||
+ if (puid != euid || pgid != egid) {
|
||||
int res;
|
||||
RESTARTABLE(::close(s), res);
|
||||
continue;
|
||||
@@ -464,16 +476,13 @@ bool AttachListener::is_init_trigger() {
|
||||
if (init_at_startup() || is_initialized()) {
|
||||
return false; // initialized at startup or already initialized
|
||||
}
|
||||
- char fn[PATH_MAX+1];
|
||||
- sprintf(fn, ".attach_pid%d", os::current_process_id());
|
||||
+ char path[PATH_MAX + 1];
|
||||
int ret;
|
||||
- struct stat64 st;
|
||||
- RESTARTABLE(::stat64(fn, &st), ret);
|
||||
- if (ret == -1) {
|
||||
- snprintf(fn, sizeof(fn), "%s/.attach_pid%d",
|
||||
- os::get_temp_directory(), os::current_process_id());
|
||||
- RESTARTABLE(::stat64(fn, &st), ret);
|
||||
- }
|
||||
+ struct stat st;
|
||||
+
|
||||
+ snprintf(path, PATH_MAX + 1, "%s/.attach_pid%d",
|
||||
+ os::get_temp_directory(), os::current_process_id());
|
||||
+ RESTARTABLE(::stat(path, &st), ret);
|
||||
if (ret == 0) {
|
||||
// simple check to avoid starting the attach mechanism when
|
||||
// a bogus user creates the file
|
@ -1,32 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_hpi_bsd_cpp,v 1.1 2009/05/23 03:03:24 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/hpi_bsd.cpp.orig Fri May 15 17:26:11 2009
|
||||
+++ hotspot/src/os/bsd/vm/hpi_bsd.cpp Fri May 15 17:26:18 2009
|
||||
@@ -28,6 +28,14 @@
|
||||
# include <sys/param.h>
|
||||
# include <dlfcn.h>
|
||||
|
||||
+#ifdef __APPLE__
|
||||
+#define HPI_LIB "libhpi.dylib"
|
||||
+#define HPI_G_LIB "libhpi.dylib"
|
||||
+#else
|
||||
+#define HPI_LIB "libhpi.so"
|
||||
+#define HPI_G_LIB "libhpi.so"
|
||||
+#endif
|
||||
+
|
||||
typedef jint (JNICALL *init_t)(GetInterfaceFunc *, void *);
|
||||
|
||||
void hpi::initialize_get_interface(vm_calls_t *callbacks) {
|
||||
@@ -45,11 +53,11 @@ void hpi::initialize_get_interface(vm_calls_t *callbac
|
||||
os::jvm_path(buf, JVM_MAXPATHLEN);
|
||||
|
||||
#ifdef PRODUCT
|
||||
- const char * hpi_lib = "/libhpi.so";
|
||||
+ const char * hpi_lib = "/" HPI_LIB;
|
||||
#else
|
||||
char * ptr = strrchr(buf, '/');
|
||||
assert(strstr(ptr, "/libjvm") == ptr, "invalid library name");
|
||||
- const char * hpi_lib = strstr(ptr, "_g") ? "/libhpi_g.so" : "/libhpi.so";
|
||||
+ const char * hpi_lib = strstr(ptr, "_g") ? "/" HPI_G_LIB : "/" HPI_LIB;
|
||||
#endif
|
||||
|
||||
*(strrchr(buf, '/')) = '\0'; /* get rid of /libjvm.so */
|
@ -1,53 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_hpi_bsd_hpp,v 1.4 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/hpi_bsd.hpp.orig Tue Jun 2 13:44:43 2009
|
||||
+++ hotspot/src/os/bsd/vm/hpi_bsd.hpp Wed Jun 3 16:06:36 2009
|
||||
@@ -36,7 +36,7 @@
|
||||
// HPI_FileInterface
|
||||
|
||||
inline int hpi::close(int fd) {
|
||||
- return ::close(fd);
|
||||
+ RESTARTABLE_RETURN_INT(::close(fd));
|
||||
}
|
||||
|
||||
inline size_t hpi::read(int fd, void *buf, unsigned int nBytes) {
|
||||
@@ -55,7 +55,7 @@ inline size_t hpi::write(int fd, const void *buf, unsi
|
||||
// HPI_SocketInterface
|
||||
|
||||
inline int hpi::socket_close(int fd) {
|
||||
- return ::close(fd);
|
||||
+ RESTARTABLE_RETURN_INT(::close(fd));
|
||||
}
|
||||
|
||||
inline int hpi::socket(int domain, int type, int protocol) {
|
||||
@@ -120,9 +120,9 @@ inline int hpi::accept(int fd, struct sockaddr *him, i
|
||||
// fetch it's value, this cast is safe for now. The java.net group
|
||||
// may need and want to change this interface someday if socklen_t goes
|
||||
// to 64 bits on some platform that we support.
|
||||
- // Bsd doc says this can't return EINTR, unlike accept() on Solaris
|
||||
+ // At least OpenBSD and FreeBSD can return EINTR from accept.
|
||||
|
||||
- return ::accept(fd, him, (socklen_t *)len);
|
||||
+ RESTARTABLE_RETURN_INT(::accept(fd, him, (socklen_t *)len));
|
||||
}
|
||||
|
||||
inline int hpi::recvfrom(int fd, char *buf, int nBytes, int flags,
|
||||
@@ -136,12 +136,16 @@ inline int hpi::sendto(int fd, char *buf, int len, int
|
||||
}
|
||||
|
||||
inline int hpi::socket_available(int fd, jint *pbytes) {
|
||||
- // Bsd doc says EINTR not returned, unlike Solaris
|
||||
- int ret = ::ioctl(fd, FIONREAD, pbytes);
|
||||
+ int ret;
|
||||
|
||||
+ if (fd < 0)
|
||||
+ return OS_OK;
|
||||
+
|
||||
+ RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret);
|
||||
+
|
||||
//%% note ioctl can return 0 when successful, JVM_SocketAvailable
|
||||
// is expected to return 0 on failure and 1 on success to the jdk.
|
||||
- return (ret < 0) ? 0 : 1;
|
||||
+ return (ret == OS_ERR) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_jsig_c,v 1.2 2008/03/19 18:05:43 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/jsig.c.orig Wed Nov 7 12:41:29 2007
|
||||
+++ hotspot/src/os/bsd/vm/jsig.c Wed Nov 7 12:41:35 2007
|
||||
@@ -143,7 +143,8 @@ sa_handler_t signal(int sig, sa_handler_t disp) {
|
||||
}
|
||||
|
||||
sa_handler_t sigset(int sig, sa_handler_t disp) {
|
||||
- return set_signal(sig, disp, true);
|
||||
+ printf("sigset() is not supported by BSD");
|
||||
+ exit(0);
|
||||
}
|
||||
|
||||
static int call_os_sigaction(int sig, const struct sigaction *act,
|
@ -1,52 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_jvm_bsd_cpp,v 1.2 2008/03/19 18:05:43 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/jvm_bsd.cpp.orig Wed Nov 7 12:41:29 2007
|
||||
+++ hotspot/src/os/bsd/vm/jvm_bsd.cpp Wed Nov 7 12:59:03 2007
|
||||
@@ -144,38 +144,31 @@ struct siglabel siglabels[] = {
|
||||
"ILL", SIGILL, /* Illegal instruction (ANSI). */
|
||||
"TRAP", SIGTRAP, /* Trace trap (POSIX). */
|
||||
"ABRT", SIGABRT, /* Abort (ANSI). */
|
||||
- "IOT", SIGIOT, /* IOT trap (4.2 BSD). */
|
||||
- "BUS", SIGBUS, /* BUS error (4.2 BSD). */
|
||||
+ "EMT", SIGEMT, /* EMT trap */
|
||||
"FPE", SIGFPE, /* Floating-point exception (ANSI). */
|
||||
"KILL", SIGKILL, /* Kill, unblockable (POSIX). */
|
||||
- "USR1", SIGUSR1, /* User-defined signal 1 (POSIX). */
|
||||
+ "BUS", SIGBUS, /* BUS error (4.2 BSD). */
|
||||
"SEGV", SIGSEGV, /* Segmentation violation (ANSI). */
|
||||
- "USR2", SIGUSR2, /* User-defined signal 2 (POSIX). */
|
||||
+ "SYS", SIGSYS, /* Bad system call. Only on some Bsden! */
|
||||
"PIPE", SIGPIPE, /* Broken pipe (POSIX). */
|
||||
"ALRM", SIGALRM, /* Alarm clock (POSIX). */
|
||||
"TERM", SIGTERM, /* Termination (ANSI). */
|
||||
-#ifdef SIGSTKFLT
|
||||
- "STKFLT", SIGSTKFLT, /* Stack fault. */
|
||||
-#endif
|
||||
- "CLD", SIGCLD, /* Same as SIGCHLD (System V). */
|
||||
- "CHLD", SIGCHLD, /* Child status has changed (POSIX). */
|
||||
- "CONT", SIGCONT, /* Continue (POSIX). */
|
||||
+ "URG", SIGURG, /* Urgent condition on socket (4.2 BSD). */
|
||||
"STOP", SIGSTOP, /* Stop, unblockable (POSIX). */
|
||||
"TSTP", SIGTSTP, /* Keyboard stop (POSIX). */
|
||||
+ "CONT", SIGCONT, /* Continue (POSIX). */
|
||||
+ "CHLD", SIGCHLD, /* Child status has changed (POSIX). */
|
||||
"TTIN", SIGTTIN, /* Background read from tty (POSIX). */
|
||||
"TTOU", SIGTTOU, /* Background write to tty (POSIX). */
|
||||
- "URG", SIGURG, /* Urgent condition on socket (4.2 BSD). */
|
||||
+ "IO", SIGIO, /* I/O now possible (4.2 BSD). */
|
||||
"XCPU", SIGXCPU, /* CPU limit exceeded (4.2 BSD). */
|
||||
"XFSZ", SIGXFSZ, /* File size limit exceeded (4.2 BSD). */
|
||||
"VTALRM", SIGVTALRM, /* Virtual alarm clock (4.2 BSD). */
|
||||
"PROF", SIGPROF, /* Profiling alarm clock (4.2 BSD). */
|
||||
"WINCH", SIGWINCH, /* Window size change (4.3 BSD, Sun). */
|
||||
- "POLL", SIGPOLL, /* Pollable event occurred (System V). */
|
||||
- "IO", SIGIO, /* I/O now possible (4.2 BSD). */
|
||||
- "PWR", SIGPWR, /* Power failure restart (System V). */
|
||||
-#ifdef SIGSYS
|
||||
- "SYS", SIGSYS /* Bad system call. Only on some Bsden! */
|
||||
-#endif
|
||||
+ "INFO", SIGINFO, /* Information request. */
|
||||
+ "USR1", SIGUSR1, /* User-defined signal 1 (POSIX). */
|
||||
+ "USR2", SIGUSR2 /* User-defined signal 2 (POSIX). */
|
||||
};
|
||||
|
||||
JVM_ENTRY_NO_ENV(jint, JVM_FindSignal(const char *name))
|
@ -1,36 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_jvm_bsd_h,v 1.4 2009/05/23 03:03:24 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/jvm_bsd.h.orig Fri May 15 16:25:27 2009
|
||||
+++ hotspot/src/os/bsd/vm/jvm_bsd.h Fri May 15 17:27:11 2009
|
||||
@@ -51,7 +51,11 @@
|
||||
#define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"}
|
||||
|
||||
#define JNI_LIB_PREFIX "lib"
|
||||
+#ifdef __APPLE__
|
||||
+#define JNI_LIB_SUFFIX ".dylib"
|
||||
+#else
|
||||
#define JNI_LIB_SUFFIX ".so"
|
||||
+#endif
|
||||
|
||||
// Hack: MAXPATHLEN is 4095 on some Bsd and 4096 on others. This may
|
||||
// cause problems if JVM and the rest of JDK are built on different
|
||||
@@ -90,6 +94,20 @@
|
||||
#define SHUTDOWN2_SIGNAL SIGINT
|
||||
#define SHUTDOWN3_SIGNAL SIGTERM
|
||||
|
||||
+#ifndef SIGRTMIN
|
||||
+#ifdef __OpenBSD__
|
||||
+#define SIGRTMIN 1
|
||||
+#else
|
||||
+#define SIGRTMIN 33
|
||||
+#endif
|
||||
+#endif
|
||||
+#ifndef SIGRTMAX
|
||||
+#ifdef __OpenBSD__
|
||||
+#define SIGRTMAX 31
|
||||
+#else
|
||||
+#define SIGRTMAX 63
|
||||
+#endif
|
||||
+#endif
|
||||
#endif /* JVM_MD_H */
|
||||
|
||||
// Reconciliation History
|
@ -1,14 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_osThread_bsd_cpp,v 1.3 2008/03/19 18:05:43 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/osThread_bsd.cpp.orig Wed Nov 7 12:41:29 2007
|
||||
+++ hotspot/src/os/bsd/vm/osThread_bsd.cpp Wed Nov 7 12:41:35 2007
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
void OSThread::pd_initialize() {
|
||||
assert(this != NULL, "check");
|
||||
- _thread_id = 0;
|
||||
- _pthread_id = 0;
|
||||
+ _thread_id = NULL;
|
||||
+ _pthread_id = NULL;
|
||||
_siginfo = NULL;
|
||||
_ucontext = NULL;
|
||||
_expanding_stack = 0;
|
@ -1,60 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_osThread_bsd_hpp,v 1.4 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/osThread_bsd.hpp.orig Sat May 30 10:11:57 2009
|
||||
+++ hotspot/src/os/bsd/vm/osThread_bsd.hpp Sat May 30 10:14:49 2009
|
||||
@@ -36,6 +36,12 @@
|
||||
|
||||
private:
|
||||
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+ // _thread_id and _pthread_id are the same on BSD
|
||||
+ // keep both to minimize code divergence in os_bsd.cpp
|
||||
+ pthread_t _thread_id;
|
||||
+ pthread_t _pthread_id;
|
||||
+#else
|
||||
// _thread_id is kernel thread id (similar to LWP id on Solaris). Each
|
||||
// thread has a unique thread_id (BsdThreads or NPTL). It can be used
|
||||
// to access /proc.
|
||||
@@ -44,6 +50,7 @@
|
||||
// _pthread_id is the pthread id, which is used by library calls
|
||||
// (e.g. pthread_kill).
|
||||
pthread_t _pthread_id;
|
||||
+#endif
|
||||
|
||||
sigset_t _caller_sigmask; // Caller's signal mask
|
||||
|
||||
@@ -53,12 +60,18 @@
|
||||
sigset_t caller_sigmask() const { return _caller_sigmask; }
|
||||
void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }
|
||||
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+ pthread_t thread_id() const {
|
||||
+ return _thread_id;
|
||||
+ }
|
||||
+#else
|
||||
pid_t thread_id() const {
|
||||
return _thread_id;
|
||||
}
|
||||
+#endif
|
||||
#ifndef PRODUCT
|
||||
// Used for debugging, return a unique integer for each thread.
|
||||
- int thread_identifier() const { return _thread_id; }
|
||||
+ intptr_t thread_identifier() const { return (intptr_t)_pthread_id; }
|
||||
#endif
|
||||
#ifdef ASSERT
|
||||
// We expect no reposition failures so kill vm if we get one.
|
||||
@@ -67,9 +80,15 @@
|
||||
return false;
|
||||
}
|
||||
#endif // ASSERT
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+ void set_thread_id(pthread_t id) {
|
||||
+ _thread_id = id;
|
||||
+ }
|
||||
+#else
|
||||
void set_thread_id(pid_t id) {
|
||||
_thread_id = id;
|
||||
}
|
||||
+#endif
|
||||
pthread_t pthread_id() const {
|
||||
return _pthread_id;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,139 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_os_bsd_hpp,v 1.6 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/os_bsd.hpp.orig Sat May 30 10:11:57 2009
|
||||
+++ hotspot/src/os/bsd/vm/os_bsd.hpp Sat May 30 10:15:17 2009
|
||||
@@ -27,6 +27,12 @@
|
||||
/* pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1 */
|
||||
typedef int (*pthread_getattr_func_type) (pthread_t, pthread_attr_t *);
|
||||
|
||||
+#ifdef __APPLE__
|
||||
+// Mac OS X doesn't support clock_gettime. Stub out the type, it is
|
||||
+// unused
|
||||
+typedef int clockid_t;
|
||||
+#endif
|
||||
+
|
||||
class Bsd {
|
||||
friend class os;
|
||||
|
||||
@@ -47,6 +53,7 @@ class Bsd {
|
||||
static int sigflags[MAXSIGNUM];
|
||||
|
||||
static int (*_clock_gettime)(clockid_t, struct timespec *);
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *);
|
||||
|
||||
static address _initial_thread_stack_bottom;
|
||||
@@ -58,6 +65,7 @@ class Bsd {
|
||||
static bool _is_floating_stack;
|
||||
static bool _is_NPTL;
|
||||
static bool _supports_fast_thread_cpu_time;
|
||||
+#endif
|
||||
|
||||
static GrowableArray<int>* _cpu_to_node;
|
||||
|
||||
@@ -65,38 +73,52 @@ class Bsd {
|
||||
|
||||
static julong _physical_memory;
|
||||
static pthread_t _main_thread;
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
static Mutex* _createThread_lock;
|
||||
+#endif
|
||||
static int _page_size;
|
||||
|
||||
static julong available_memory();
|
||||
static julong physical_memory() { return _physical_memory; }
|
||||
static void initialize_system_info();
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
static void set_glibc_version(const char *s) { _glibc_version = s; }
|
||||
static void set_libpthread_version(const char *s) { _libpthread_version = s; }
|
||||
+#endif
|
||||
|
||||
static bool supports_variable_stack_size();
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
static void set_is_NPTL() { _is_NPTL = true; }
|
||||
static void set_is_BsdThreads() { _is_NPTL = false; }
|
||||
static void set_is_floating_stack() { _is_floating_stack = true; }
|
||||
+#endif
|
||||
|
||||
static void rebuild_cpu_to_node_map();
|
||||
static GrowableArray<int>* cpu_to_node() { return _cpu_to_node; }
|
||||
public:
|
||||
+
|
||||
static void init_thread_fpu_state();
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
static int get_fpu_control_word();
|
||||
static void set_fpu_control_word(int fpu_control);
|
||||
+#endif
|
||||
static pthread_t main_thread(void) { return _main_thread; }
|
||||
+
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
// returns kernel thread id (similar to LWP id on Solaris), which can be
|
||||
// used to access /proc
|
||||
static pid_t gettid();
|
||||
static void set_createThread_lock(Mutex* lk) { _createThread_lock = lk; }
|
||||
static Mutex* createThread_lock(void) { return _createThread_lock; }
|
||||
+#endif
|
||||
static void hotspot_sigmask(Thread* thread);
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
static address initial_thread_stack_bottom(void) { return _initial_thread_stack_bottom; }
|
||||
static uintptr_t initial_thread_stack_size(void) { return _initial_thread_stack_size; }
|
||||
+#endif
|
||||
static bool is_initial_thread(void);
|
||||
|
||||
static int page_size(void) { return _page_size; }
|
||||
@@ -133,6 +155,7 @@ class Bsd {
|
||||
static struct sigaction *get_chained_signal_action(int sig);
|
||||
static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
// GNU libc and libpthread version strings
|
||||
static const char *glibc_version() { return _glibc_version; }
|
||||
static const char *libpthread_version() { return _libpthread_version; }
|
||||
@@ -148,6 +171,7 @@ class Bsd {
|
||||
static void libpthread_init();
|
||||
static bool libnuma_init();
|
||||
static void* libnuma_dlsym(void* handle, const char* name);
|
||||
+#endif
|
||||
// Minimum stack size a thread can be created with (allowing
|
||||
// the VM to completely create the thread and enter user code)
|
||||
static size_t min_stack_allowed;
|
||||
@@ -156,17 +180,21 @@ class Bsd {
|
||||
static size_t default_stack_size(os::ThreadType thr_type);
|
||||
static size_t default_guard_size(os::ThreadType thr_type);
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
static void capture_initial_stack(size_t max_size);
|
||||
|
||||
// Stack overflow handling
|
||||
static bool manually_expand_stack(JavaThread * t, address addr);
|
||||
static int max_register_window_saves_before_flushing();
|
||||
+#endif
|
||||
|
||||
// Real-time clock functions
|
||||
static void clock_init(void);
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
// fast POSIX clocks support
|
||||
static void fast_thread_clock_init(void);
|
||||
+#endif
|
||||
|
||||
static bool supports_monotonic_clock() {
|
||||
return _clock_gettime != NULL;
|
||||
@@ -176,6 +204,7 @@ class Bsd {
|
||||
return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
|
||||
}
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
static int pthread_getcpuclockid(pthread_t tid, clockid_t *clock_id) {
|
||||
return _pthread_getcpuclockid ? _pthread_getcpuclockid(tid, clock_id) : -1;
|
||||
}
|
||||
@@ -185,6 +214,7 @@ class Bsd {
|
||||
}
|
||||
|
||||
static jlong fast_thread_cpu_time(clockid_t clockid);
|
||||
+#endif
|
||||
|
||||
// Stack repair handling
|
||||
|
@ -1,19 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_os_bsd_inline_hpp,v 1.3 2009/06/10 19:01:09 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/os_bsd.inline.hpp.orig Sat May 30 10:11:57 2009
|
||||
+++ hotspot/src/os/bsd/vm/os_bsd.inline.hpp Sat May 30 10:15:39 2009
|
||||
@@ -61,7 +61,15 @@ inline bool os::uses_stack_guard_pages() {
|
||||
|
||||
inline bool os::allocate_stack_guard_pages() {
|
||||
assert(uses_stack_guard_pages(), "sanity check");
|
||||
+#if !defined(__FreeBSD__) || __FreeBSD__ < 5
|
||||
+ // Since FreeBSD 4 uses malloc() for allocating the thread stack
|
||||
+ // there is no need to do anything extra to allocate the guard pages
|
||||
+ return false;
|
||||
+#else
|
||||
+ // FreeBSD 5+ uses mmap MAP_STACK for allocating the thread stacks.
|
||||
+ // Must 'allocate' them or guard pages are ignored.
|
||||
return true;
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_bsd_vm_vtune_bsd_cpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os/bsd/vm/vtune_bsd.cpp.orig Mon Oct 25 19:20:23 2010
|
||||
+++ hotspot/src/os/bsd/vm/vtune_bsd.cpp Mon Oct 25 19:20:29 2010
|
||||
@@ -0,0 +1,45 @@
|
||||
+/*
|
||||
+ * Copyright (c) 1999, 2007, 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
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include "incls/_precompiled.incl"
|
||||
+#include "incls/_vtune_bsd.cpp.incl"
|
||||
+
|
||||
+// empty implementation
|
||||
+
|
||||
+void VTune::start_GC() {}
|
||||
+void VTune::end_GC() {}
|
||||
+void VTune::start_class_load() {}
|
||||
+void VTune::end_class_load() {}
|
||||
+void VTune::exit() {}
|
||||
+void VTune::register_stub(const char* name, address start, address end) {}
|
||||
+
|
||||
+void VTune::create_nmethod(nmethod* nm) {}
|
||||
+void VTune::delete_nmethod(nmethod* nm) {}
|
||||
+
|
||||
+void vtune_init() {}
|
||||
+
|
||||
+
|
||||
+// Reconciliation History
|
||||
+// vtune_solaris.cpp 1.8 99/07/12 23:54:21
|
||||
+// End
|
@ -1,203 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_x86_vm_bsd_x86_32_s,v 1.3 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s.orig Mon Oct 25 18:02:18 2010
|
||||
+++ hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s Mon Oct 25 19:20:46 2010
|
||||
@@ -21,6 +21,17 @@
|
||||
# questions.
|
||||
#
|
||||
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+# Darwin uses _ prefixed global symbols
|
||||
+#define SYMBOL(s) _ ## s
|
||||
+#define ELF_TYPE(name, description)
|
||||
+#else
|
||||
+#define SYMBOL(s) s
|
||||
+#define ELF_TYPE(name, description) .type name,description
|
||||
+#endif
|
||||
+
|
||||
+ .globl SYMBOL(fixcw)
|
||||
|
||||
# NOTE WELL! The _Copy functions are called directly
|
||||
# from server-compiler-generated code via CallLeafNoFP,
|
||||
@@ -28,41 +39,61 @@
|
||||
# point or use it in the same manner as does the server
|
||||
# compiler.
|
||||
|
||||
- .globl _Copy_conjoint_bytes
|
||||
- .globl _Copy_arrayof_conjoint_bytes
|
||||
- .globl _Copy_conjoint_jshorts_atomic
|
||||
- .globl _Copy_arrayof_conjoint_jshorts
|
||||
- .globl _Copy_conjoint_jints_atomic
|
||||
- .globl _Copy_arrayof_conjoint_jints
|
||||
- .globl _Copy_conjoint_jlongs_atomic
|
||||
- .globl _mmx_Copy_arrayof_conjoint_jshorts
|
||||
+ .globl SYMBOL(_Copy_conjoint_bytes)
|
||||
+ .globl SYMBOL(_Copy_arrayof_conjoint_bytes)
|
||||
+ .globl SYMBOL(_Copy_conjoint_jshorts_atomic)
|
||||
+ .globl SYMBOL(_Copy_arrayof_conjoint_jshorts)
|
||||
+ .globl SYMBOL(_Copy_conjoint_jints_atomic)
|
||||
+ .globl SYMBOL(_Copy_arrayof_conjoint_jints)
|
||||
+ .globl SYMBOL(_Copy_conjoint_jlongs_atomic)
|
||||
+ .globl SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts)
|
||||
|
||||
- .globl _Atomic_cmpxchg_long
|
||||
+ .globl SYMBOL(_Atomic_cmpxchg_long)
|
||||
|
||||
.text
|
||||
|
||||
- .globl SafeFetch32, Fetch32PFI, Fetch32Resume
|
||||
- .globl SafeFetchN
|
||||
+# Support for void os::Solaris::init_thread_fpu_state() in os_solaris_i486.cpp
|
||||
+# Set fpu to 53 bit precision. This happens too early to use a stub.
|
||||
+# ported from solaris_x86_32.s
|
||||
+#ifdef __APPLE__
|
||||
+ .align 4
|
||||
+#else
|
||||
+ .align 16
|
||||
+#endif
|
||||
+SYMBOL(fixcw):
|
||||
+ pushl $0x27f
|
||||
+ fldcw 0(%esp)
|
||||
+ popl %eax
|
||||
+ ret
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+ .align 4
|
||||
+#else
|
||||
+ .align 16
|
||||
+#endif
|
||||
+
|
||||
+ .globl SYMBOL(SafeFetch32), SYMBOL(Fetch32PFI), SYMBOL(Fetch32Resume)
|
||||
+ .globl SYMBOL(SafeFetchN)
|
||||
## TODO: avoid exposing Fetch32PFI and Fetch32Resume.
|
||||
## Instead, the signal handler would call a new SafeFetchTriage(FaultingEIP)
|
||||
## routine to vet the address. If the address is the faulting LD then
|
||||
## SafeFetchTriage() would return the resume-at EIP, otherwise null.
|
||||
- .type SafeFetch32,@function
|
||||
+ ELF_TYPE(SafeFetch32,@function)
|
||||
.p2align 4,,15
|
||||
-SafeFetch32:
|
||||
-SafeFetchN:
|
||||
+SYMBOL(SafeFetch32):
|
||||
+SYMBOL(SafeFetchN):
|
||||
movl 0x8(%esp), %eax
|
||||
movl 0x4(%esp), %ecx
|
||||
-Fetch32PFI:
|
||||
+SYMBOL(Fetch32PFI):
|
||||
movl (%ecx), %eax
|
||||
-Fetch32Resume:
|
||||
+SYMBOL(Fetch32Resume):
|
||||
ret
|
||||
|
||||
|
||||
- .globl SpinPause
|
||||
- .type SpinPause,@function
|
||||
+ .globl SYMBOL(SpinPause)
|
||||
+ ELF_TYPE(SpinPause,@function)
|
||||
.p2align 4,,15
|
||||
-SpinPause:
|
||||
+SYMBOL(SpinPause):
|
||||
rep
|
||||
nop
|
||||
movl $1, %eax
|
||||
@@ -72,8 +103,8 @@ SpinPause:
|
||||
# void* to,
|
||||
# size_t count)
|
||||
.p2align 4,,15
|
||||
- .type _Copy_conjoint_bytes,@function
|
||||
-_Copy_conjoint_bytes:
|
||||
+ ELF_TYPE(_Copy_conjoint_bytes,@function)
|
||||
+SYMBOL(_Copy_conjoint_bytes):
|
||||
pushl %esi
|
||||
movl 4+12(%esp),%ecx # count
|
||||
pushl %edi
|
||||
@@ -180,8 +211,8 @@ cb_CopyLeft:
|
||||
#
|
||||
# Same as _Copy_conjoint_bytes, except no source alignment check.
|
||||
.p2align 4,,15
|
||||
- .type _Copy_arrayof_conjoint_bytes,@function
|
||||
-_Copy_arrayof_conjoint_bytes:
|
||||
+ ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function)
|
||||
+SYMBOL(_Copy_arrayof_conjoint_bytes):
|
||||
pushl %esi
|
||||
movl 4+12(%esp),%ecx # count
|
||||
pushl %edi
|
||||
@@ -268,8 +299,8 @@ acb_CopyLeft:
|
||||
# void* to,
|
||||
# size_t count)
|
||||
.p2align 4,,15
|
||||
- .type _Copy_conjoint_jshorts_atomic,@function
|
||||
-_Copy_conjoint_jshorts_atomic:
|
||||
+ ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function)
|
||||
+SYMBOL(_Copy_conjoint_jshorts_atomic):
|
||||
pushl %esi
|
||||
movl 4+12(%esp),%ecx # count
|
||||
pushl %edi
|
||||
@@ -355,8 +386,8 @@ cs_CopyLeft:
|
||||
# void* to,
|
||||
# size_t count)
|
||||
.p2align 4,,15
|
||||
- .type _Copy_arrayof_conjoint_jshorts,@function
|
||||
-_Copy_arrayof_conjoint_jshorts:
|
||||
+ ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function)
|
||||
+SYMBOL(_Copy_arrayof_conjoint_jshorts):
|
||||
pushl %esi
|
||||
movl 4+12(%esp),%ecx # count
|
||||
pushl %edi
|
||||
@@ -432,10 +463,10 @@ acs_CopyLeft:
|
||||
# Equivalent to
|
||||
# arrayof_conjoint_jints
|
||||
.p2align 4,,15
|
||||
- .type _Copy_conjoint_jints_atomic,@function
|
||||
- .type _Copy_arrayof_conjoint_jints,@function
|
||||
-_Copy_conjoint_jints_atomic:
|
||||
-_Copy_arrayof_conjoint_jints:
|
||||
+ ELF_TYPE(_Copy_conjoint_jints_atomic,@function)
|
||||
+ ELF_TYPE(_Copy_arrayof_conjoint_jints,@function)
|
||||
+SYMBOL(_Copy_conjoint_jints_atomic):
|
||||
+SYMBOL(_Copy_arrayof_conjoint_jints):
|
||||
pushl %esi
|
||||
movl 4+12(%esp),%ecx # count
|
||||
pushl %edi
|
||||
@@ -497,7 +528,7 @@ ci_CopyLeft:
|
||||
#
|
||||
# count treated as signed
|
||||
#
|
||||
- # if (from > to) {
|
||||
+ # // if (from > to) {
|
||||
# while (--count >= 0) {
|
||||
# *to++ = *from++;
|
||||
# }
|
||||
@@ -507,8 +538,8 @@ ci_CopyLeft:
|
||||
# }
|
||||
# }
|
||||
.p2align 4,,15
|
||||
- .type _Copy_conjoint_jlongs_atomic,@function
|
||||
-_Copy_conjoint_jlongs_atomic:
|
||||
+ ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function)
|
||||
+SYMBOL(_Copy_conjoint_jlongs_atomic):
|
||||
movl 4+8(%esp),%ecx # count
|
||||
movl 4+0(%esp),%eax # from
|
||||
movl 4+4(%esp),%edx # to
|
||||
@@ -536,8 +567,8 @@ cla_CopyLeft:
|
||||
# void* to,
|
||||
# size_t count)
|
||||
.p2align 4,,15
|
||||
- .type _mmx_Copy_arrayof_conjoint_jshorts,@function
|
||||
-_mmx_Copy_arrayof_conjoint_jshorts:
|
||||
+ ELF_TYPE(_mmx_Copy_arrayof_conjoint_jshorts,@function)
|
||||
+SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts):
|
||||
pushl %esi
|
||||
movl 4+12(%esp),%ecx
|
||||
pushl %edi
|
||||
@@ -635,8 +666,8 @@ mmx_acs_CopyLeft:
|
||||
# bool is_MP)
|
||||
#
|
||||
.p2align 4,,15
|
||||
- .type _Atomic_cmpxchg_long,@function
|
||||
-_Atomic_cmpxchg_long:
|
||||
+ ELF_TYPE(_Atomic_cmpxchg_long,@function)
|
||||
+SYMBOL(_Atomic_cmpxchg_long):
|
||||
# 8(%esp) : return PC
|
||||
pushl %ebx # 4(%esp) : old %ebx
|
||||
pushl %edi # 0(%esp) : old %edi
|
@ -1,150 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_x86_vm_bsd_x86_64_s,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s.orig Mon Oct 25 18:02:18 2010
|
||||
+++ hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s Mon Oct 25 18:15:45 2010
|
||||
@@ -21,6 +21,14 @@
|
||||
# questions.
|
||||
#
|
||||
|
||||
+#ifdef __APPLE__
|
||||
+# Darwin uses _ prefixed global symbols
|
||||
+#define SYMBOL(s) _ ## s
|
||||
+#define ELF_TYPE(name, description)
|
||||
+#else
|
||||
+#define SYMBOL(s) s
|
||||
+#define ELF_TYPE(name, description) .type name,description
|
||||
+#endif
|
||||
|
||||
# NOTE WELL! The _Copy functions are called directly
|
||||
# from server-compiler-generated code via CallLeafNoFP,
|
||||
@@ -28,42 +36,54 @@
|
||||
# point or use it in the same manner as does the server
|
||||
# compiler.
|
||||
|
||||
- .globl _Copy_arrayof_conjoint_bytes
|
||||
- .globl _Copy_arrayof_conjoint_jshorts
|
||||
- .globl _Copy_conjoint_jshorts_atomic
|
||||
- .globl _Copy_arrayof_conjoint_jints
|
||||
- .globl _Copy_conjoint_jints_atomic
|
||||
- .globl _Copy_arrayof_conjoint_jlongs
|
||||
- .globl _Copy_conjoint_jlongs_atomic
|
||||
+ .globl SYMBOL(_Copy_arrayof_conjoint_bytes)
|
||||
+ .globl SYMBOL(_Copy_arrayof_conjoint_jshorts)
|
||||
+ .globl SYMBOL(_Copy_conjoint_jshorts_atomic)
|
||||
+ .globl SYMBOL(_Copy_arrayof_conjoint_jints)
|
||||
+ .globl SYMBOL(_Copy_conjoint_jints_atomic)
|
||||
+ .globl SYMBOL(_Copy_arrayof_conjoint_jlongs)
|
||||
+ .globl SYMBOL(_Copy_conjoint_jlongs_atomic)
|
||||
|
||||
.text
|
||||
|
||||
- .globl SafeFetch32, Fetch32PFI, Fetch32Resume
|
||||
+ .globl SYMBOL(SafeFetch32), SYMBOL(Fetch32PFI), SYMBOL(Fetch32Resume)
|
||||
+#ifdef __APPLE__
|
||||
+ .align 4
|
||||
+#else
|
||||
.align 16
|
||||
- .type SafeFetch32,@function
|
||||
+#endif
|
||||
+ ELF_TYPE(SafeFetch32,@function)
|
||||
// Prototype: int SafeFetch32 (int * Adr, int ErrValue)
|
||||
-SafeFetch32:
|
||||
+SYMBOL(SafeFetch32):
|
||||
movl %esi, %eax
|
||||
-Fetch32PFI:
|
||||
+SYMBOL(Fetch32PFI):
|
||||
movl (%rdi), %eax
|
||||
-Fetch32Resume:
|
||||
+SYMBOL(Fetch32Resume):
|
||||
ret
|
||||
|
||||
- .globl SafeFetchN, FetchNPFI, FetchNResume
|
||||
+ .globl SYMBOL(SafeFetchN), SYMBOL(FetchNPFI), SYMBOL(FetchNResume)
|
||||
+#ifdef __APPLE__
|
||||
+ .align 4
|
||||
+#else
|
||||
.align 16
|
||||
- .type SafeFetchN,@function
|
||||
+#endif
|
||||
+ ELF_TYPE(SafeFetchN,@function)
|
||||
// Prototype: intptr_t SafeFetchN (intptr_t * Adr, intptr_t ErrValue)
|
||||
-SafeFetchN:
|
||||
+SYMBOL(SafeFetchN):
|
||||
movq %rsi, %rax
|
||||
-FetchNPFI:
|
||||
+SYMBOL(FetchNPFI):
|
||||
movq (%rdi), %rax
|
||||
-FetchNResume:
|
||||
+SYMBOL(FetchNResume):
|
||||
ret
|
||||
|
||||
- .globl SpinPause
|
||||
- .align 16
|
||||
- .type SpinPause,@function
|
||||
-SpinPause:
|
||||
+ .globl SYMBOL(SpinPause)
|
||||
+#ifdef __APPLE__
|
||||
+ .align 4
|
||||
+#else
|
||||
+ .align 16
|
||||
+#endif
|
||||
+ ELF_TYPE(SpinPause,@function)
|
||||
+SYMBOL(SpinPause):
|
||||
rep
|
||||
nop
|
||||
movq $1, %rax
|
||||
@@ -77,8 +97,8 @@ SpinPause:
|
||||
# rdx - count, treated as ssize_t
|
||||
#
|
||||
.p2align 4,,15
|
||||
- .type _Copy_arrayof_conjoint_bytes,@function
|
||||
-_Copy_arrayof_conjoint_bytes:
|
||||
+ ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function)
|
||||
+SYMBOL(_Copy_arrayof_conjoint_bytes):
|
||||
movq %rdx,%r8 # byte count
|
||||
shrq $3,%rdx # qword count
|
||||
cmpq %rdi,%rsi
|
||||
@@ -179,10 +199,10 @@ acb_CopyLeft:
|
||||
# rdx - count, treated as ssize_t
|
||||
#
|
||||
.p2align 4,,15
|
||||
- .type _Copy_arrayof_conjoint_jshorts,@function
|
||||
- .type _Copy_conjoint_jshorts_atomic,@function
|
||||
-_Copy_arrayof_conjoint_jshorts:
|
||||
-_Copy_conjoint_jshorts_atomic:
|
||||
+ ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function)
|
||||
+ ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function)
|
||||
+SYMBOL(_Copy_arrayof_conjoint_jshorts):
|
||||
+SYMBOL(_Copy_conjoint_jshorts_atomic):
|
||||
movq %rdx,%r8 # word count
|
||||
shrq $2,%rdx # qword count
|
||||
cmpq %rdi,%rsi
|
||||
@@ -269,10 +289,10 @@ acs_CopyLeft:
|
||||
# rdx - count, treated as ssize_t
|
||||
#
|
||||
.p2align 4,,15
|
||||
- .type _Copy_arrayof_conjoint_jints,@function
|
||||
- .type _Copy_conjoint_jints_atomic,@function
|
||||
-_Copy_arrayof_conjoint_jints:
|
||||
-_Copy_conjoint_jints_atomic:
|
||||
+ ELF_TYPE(_Copy_arrayof_conjoint_jints,@function)
|
||||
+ ELF_TYPE(_Copy_conjoint_jints_atomic,@function)
|
||||
+SYMBOL(_Copy_arrayof_conjoint_jints):
|
||||
+SYMBOL(_Copy_conjoint_jints_atomic):
|
||||
movq %rdx,%r8 # dword count
|
||||
shrq %rdx # qword count
|
||||
cmpq %rdi,%rsi
|
||||
@@ -348,10 +368,10 @@ aci_CopyLeft:
|
||||
# rdx - count, treated as ssize_t
|
||||
#
|
||||
.p2align 4,,15
|
||||
- .type _Copy_arrayof_conjoint_jlongs,@function
|
||||
- .type _Copy_conjoint_jlongs_atomic,@function
|
||||
-_Copy_arrayof_conjoint_jlongs:
|
||||
-_Copy_conjoint_jlongs_atomic:
|
||||
+ ELF_TYPE(_Copy_arrayof_conjoint_jlongs,@function)
|
||||
+ ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function)
|
||||
+SYMBOL(_Copy_arrayof_conjoint_jlongs):
|
||||
+SYMBOL(_Copy_conjoint_jlongs_atomic):
|
||||
cmpq %rdi,%rsi
|
||||
leaq -8(%rdi,%rdx,8),%rax # from + count*8 - 8
|
||||
jbe acl_CopyRight
|
@ -1,37 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_x86_vm_bytes_bsd_x86_inline_hpp,v 1.2 2009/05/23 03:03:24 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp.orig Fri May 15 16:25:28 2009
|
||||
+++ hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp Fri May 15 17:44:35 2009
|
||||
@@ -22,7 +22,33 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
#include <byteswap.h>
|
||||
+#endif
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+#include <libkern/OSByteOrder.h>
|
||||
+#endif
|
||||
+
|
||||
+#if defined(AMD64)
|
||||
+# if defined(__APPLE__)
|
||||
+# define bswap_16(x) OSSwapInt16(x)
|
||||
+# define bswap_32(x) OSSwapInt32(x)
|
||||
+# define bswap_64(x) OSSwapInt64(x)
|
||||
+# elif defined(__OpenBSD__)
|
||||
+# 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)
|
||||
+# define bswap_64(x) __bswap64(x)
|
||||
+# endif
|
||||
+#endif
|
||||
|
||||
// Efficient swapping of data bytes from Java byte
|
||||
// ordering to native byte ordering and vice versa.
|
@ -1,29 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_x86_vm_globals_bsd_x86_hpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp.orig Mon Oct 25 19:21:21 2010
|
||||
+++ hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp Mon Oct 25 19:21:36 2010
|
||||
@@ -22,9 +22,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+//
|
||||
// Sets the default values for platform dependent flags used by the runtime system.
|
||||
// (see globals.hpp)
|
||||
-
|
||||
+//
|
||||
define_pd_global(bool, DontYieldALot, false);
|
||||
#ifdef AMD64
|
||||
define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default
|
||||
@@ -38,10 +39,11 @@ define_pd_global(intx, VMThreadStackSize, 512);
|
||||
#endif // AMD64
|
||||
|
||||
define_pd_global(intx, CompilerThreadStackSize, 0);
|
||||
+define_pd_global(intx, SurvivorRatio, 8);
|
||||
|
||||
-define_pd_global(uintx,JVMInvokeMethodSlack, 8192);
|
||||
+define_pd_global(uintx, JVMInvokeMethodSlack, 8192);
|
||||
|
||||
// Only used on 64 bit platforms
|
||||
-define_pd_global(uintx,HeapBaseMinAddress, 2*G);
|
||||
+define_pd_global(uintx, HeapBaseMinAddress, 2*G);
|
||||
// Only used on 64 bit Windows platforms
|
||||
define_pd_global(bool, UseVectoredExceptions, false);
|
@ -1,593 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_x86_vm_os_bsd_x86_cpp,v 1.5 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp.orig Tue Jan 4 18:25:16 2011
|
||||
+++ hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Tue Jan 4 19:03:34 2011
|
||||
@@ -44,23 +44,202 @@
|
||||
# include <sys/wait.h>
|
||||
# include <pwd.h>
|
||||
# include <poll.h>
|
||||
+#ifndef __OpenBSD__
|
||||
# include <ucontext.h>
|
||||
-# include <fpu_control.h>
|
||||
+#endif
|
||||
|
||||
+#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) && !defined(__NetBSD__)
|
||||
+# include <pthread_np.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef AMD64
|
||||
-#define REG_SP REG_RSP
|
||||
-#define REG_PC REG_RIP
|
||||
-#define REG_FP REG_RBP
|
||||
#define SPELL_REG_SP "rsp"
|
||||
#define SPELL_REG_FP "rbp"
|
||||
#else
|
||||
-#define REG_SP REG_UESP
|
||||
-#define REG_PC REG_EIP
|
||||
-#define REG_FP REG_EBP
|
||||
#define SPELL_REG_SP "esp"
|
||||
#define SPELL_REG_FP "ebp"
|
||||
#endif // AMD64
|
||||
|
||||
+#ifdef __FreeBSD__
|
||||
+# define context_trapno uc_mcontext.mc_trapno
|
||||
+# ifdef AMD64
|
||||
+# define context_pc uc_mcontext.mc_rip
|
||||
+# define context_sp uc_mcontext.mc_rsp
|
||||
+# define context_fp uc_mcontext.mc_rbp
|
||||
+# define context_rip uc_mcontext.mc_rip
|
||||
+# define context_rsp uc_mcontext.mc_rsp
|
||||
+# define context_rbp uc_mcontext.mc_rbp
|
||||
+# define context_rax uc_mcontext.mc_rax
|
||||
+# define context_rbx uc_mcontext.mc_rbx
|
||||
+# define context_rcx uc_mcontext.mc_rcx
|
||||
+# define context_rdx uc_mcontext.mc_rdx
|
||||
+# define context_rsi uc_mcontext.mc_rsi
|
||||
+# define context_rdi uc_mcontext.mc_rdi
|
||||
+# define context_r8 uc_mcontext.mc_r8
|
||||
+# define context_r9 uc_mcontext.mc_r9
|
||||
+# define context_r10 uc_mcontext.mc_r10
|
||||
+# define context_r11 uc_mcontext.mc_r11
|
||||
+# define context_r12 uc_mcontext.mc_r12
|
||||
+# define context_r13 uc_mcontext.mc_r13
|
||||
+# define context_r14 uc_mcontext.mc_r14
|
||||
+# define context_r15 uc_mcontext.mc_r15
|
||||
+# define context_flags uc_mcontext.mc_flags
|
||||
+# define context_err uc_mcontext.mc_err
|
||||
+# else
|
||||
+# define context_pc uc_mcontext.mc_eip
|
||||
+# define context_sp uc_mcontext.mc_esp
|
||||
+# define context_fp uc_mcontext.mc_ebp
|
||||
+# define context_eip uc_mcontext.mc_eip
|
||||
+# define context_esp uc_mcontext.mc_esp
|
||||
+# define context_eax uc_mcontext.mc_eax
|
||||
+# define context_ebx uc_mcontext.mc_ebx
|
||||
+# define context_ecx uc_mcontext.mc_ecx
|
||||
+# define context_edx uc_mcontext.mc_edx
|
||||
+# define context_ebp uc_mcontext.mc_ebp
|
||||
+# define context_esi uc_mcontext.mc_esi
|
||||
+# define context_edi uc_mcontext.mc_edi
|
||||
+# define context_eflags uc_mcontext.mc_eflags
|
||||
+# define context_trapno uc_mcontext.mc_trapno
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+# if __DARWIN_UNIX03 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
+ // 10.5 UNIX03 member name prefixes
|
||||
+ #define DU3_PREFIX(s, m) __ ## s.__ ## m
|
||||
+# else
|
||||
+ #define DU3_PREFIX(s, m) s ## . ## m
|
||||
+# endif
|
||||
+
|
||||
+# ifdef AMD64
|
||||
+# define context_pc context_rip
|
||||
+# define context_sp context_rsp
|
||||
+# define context_fp context_rbp
|
||||
+# define context_rip uc_mcontext->DU3_PREFIX(ss,rip)
|
||||
+# define context_rsp uc_mcontext->DU3_PREFIX(ss,rsp)
|
||||
+# define context_rax uc_mcontext->DU3_PREFIX(ss,rax)
|
||||
+# define context_rbx uc_mcontext->DU3_PREFIX(ss,rbx)
|
||||
+# define context_rcx uc_mcontext->DU3_PREFIX(ss,rcx)
|
||||
+# define context_rdx uc_mcontext->DU3_PREFIX(ss,rdx)
|
||||
+# define context_rbp uc_mcontext->DU3_PREFIX(ss,rbp)
|
||||
+# define context_rsi uc_mcontext->DU3_PREFIX(ss,rsi)
|
||||
+# define context_rdi uc_mcontext->DU3_PREFIX(ss,rdi)
|
||||
+# define context_r8 uc_mcontext->DU3_PREFIX(ss,r8)
|
||||
+# define context_r9 uc_mcontext->DU3_PREFIX(ss,r9)
|
||||
+# define context_r10 uc_mcontext->DU3_PREFIX(ss,r10)
|
||||
+# define context_r11 uc_mcontext->DU3_PREFIX(ss,r11)
|
||||
+# define context_r12 uc_mcontext->DU3_PREFIX(ss,r12)
|
||||
+# define context_r13 uc_mcontext->DU3_PREFIX(ss,r13)
|
||||
+# define context_r14 uc_mcontext->DU3_PREFIX(ss,r14)
|
||||
+# define context_r15 uc_mcontext->DU3_PREFIX(ss,r15)
|
||||
+# define context_flags uc_mcontext->DU3_PREFIX(ss,rflags)
|
||||
+# define context_trapno uc_mcontext->DU3_PREFIX(es,trapno)
|
||||
+# define context_err uc_mcontext->DU3_PREFIX(es,err)
|
||||
+# else
|
||||
+# define context_pc context_eip
|
||||
+# define context_sp context_esp
|
||||
+# define context_fp context_ebp
|
||||
+# define context_eip uc_mcontext->DU3_PREFIX(ss,eip)
|
||||
+# define context_esp uc_mcontext->DU3_PREFIX(ss,esp)
|
||||
+# define context_eax uc_mcontext->DU3_PREFIX(ss,eax)
|
||||
+# define context_ebx uc_mcontext->DU3_PREFIX(ss,ebx)
|
||||
+# define context_ecx uc_mcontext->DU3_PREFIX(ss,ecx)
|
||||
+# define context_edx uc_mcontext->DU3_PREFIX(ss,edx)
|
||||
+# define context_ebp uc_mcontext->DU3_PREFIX(ss,ebp)
|
||||
+# define context_esi uc_mcontext->DU3_PREFIX(ss,esi)
|
||||
+# define context_edi uc_mcontext->DU3_PREFIX(ss,edi)
|
||||
+# define context_eflags uc_mcontext->DU3_PREFIX(ss,eflags)
|
||||
+# define context_trapno uc_mcontext->DU3_PREFIX(es,trapno)
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#ifdef __OpenBSD__
|
||||
+# define context_trapno sc_trapno
|
||||
+# ifdef AMD64
|
||||
+# define context_pc sc_rip
|
||||
+# define context_sp sc_rsp
|
||||
+# define context_fp sc_rbp
|
||||
+# define context_rip sc_rip
|
||||
+# define context_rsp sc_rsp
|
||||
+# define context_rbp sc_rbp
|
||||
+# define context_rax sc_rax
|
||||
+# define context_rbx sc_rbx
|
||||
+# define context_rcx sc_rcx
|
||||
+# define context_rdx sc_rdx
|
||||
+# define context_rsi sc_rsi
|
||||
+# define context_rdi sc_rdi
|
||||
+# define context_r8 sc_r8
|
||||
+# define context_r9 sc_r9
|
||||
+# define context_r10 sc_r10
|
||||
+# define context_r11 sc_r11
|
||||
+# define context_r12 sc_r12
|
||||
+# define context_r13 sc_r13
|
||||
+# define context_r14 sc_r14
|
||||
+# define context_r15 sc_r15
|
||||
+# define context_flags sc_rflags
|
||||
+# define context_err sc_err
|
||||
+# else
|
||||
+# define context_pc sc_eip
|
||||
+# define context_sp sc_esp
|
||||
+# define context_fp sc_ebp
|
||||
+# define context_eip sc_eip
|
||||
+# define context_esp sc_esp
|
||||
+# define context_eax sc_eax
|
||||
+# define context_ebx sc_ebx
|
||||
+# define context_ecx sc_ecx
|
||||
+# define context_edx sc_edx
|
||||
+# define context_ebp sc_ebp
|
||||
+# define context_esi sc_esi
|
||||
+# define context_edi sc_edi
|
||||
+# define context_eflags sc_eflags
|
||||
+# define context_trapno sc_trapno
|
||||
+# 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;
|
||||
@@ -85,15 +264,15 @@ void os::initialize_thread() {
|
||||
}
|
||||
|
||||
address os::Bsd::ucontext_get_pc(ucontext_t * uc) {
|
||||
- return (address)uc->uc_mcontext.gregs[REG_PC];
|
||||
+ return (address)uc->context_pc;
|
||||
}
|
||||
|
||||
intptr_t* os::Bsd::ucontext_get_sp(ucontext_t * uc) {
|
||||
- return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
|
||||
+ return (intptr_t*)uc->context_sp;
|
||||
}
|
||||
|
||||
intptr_t* os::Bsd::ucontext_get_fp(ucontext_t * uc) {
|
||||
- return (intptr_t*)uc->uc_mcontext.gregs[REG_FP];
|
||||
+ return (intptr_t*)uc->context_fp;
|
||||
}
|
||||
|
||||
// For Forte Analyzer AsyncGetCallTrace profiling support - thread
|
||||
@@ -245,18 +424,18 @@ JVM_handle_bsd_signal(int sig,
|
||||
pc = (address) os::Bsd::ucontext_get_pc(uc);
|
||||
|
||||
if (pc == (address) Fetch32PFI) {
|
||||
- uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ;
|
||||
+ uc->context_pc = intptr_t(Fetch32Resume) ;
|
||||
return 1 ;
|
||||
}
|
||||
#ifdef AMD64
|
||||
if (pc == (address) FetchNPFI) {
|
||||
- uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ;
|
||||
+ uc->context_pc = intptr_t (FetchNResume) ;
|
||||
return 1 ;
|
||||
}
|
||||
#endif // AMD64
|
||||
|
||||
// Handle ALL stack overflow variations here
|
||||
- if (sig == SIGSEGV) {
|
||||
+ if (sig == SIGSEGV || sig == SIGBUS) {
|
||||
address addr = (address) info->si_addr;
|
||||
|
||||
// check if fault address is within thread stack
|
||||
@@ -278,6 +457,7 @@ JVM_handle_bsd_signal(int sig,
|
||||
// to handle_unexpected_exception way down below.
|
||||
thread->disable_stack_red_zone();
|
||||
tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
} else {
|
||||
// Accessing stack address below sp may cause SEGV if current
|
||||
// thread has MAP_GROWSDOWN stack. This should only happen when
|
||||
@@ -293,6 +473,7 @@ JVM_handle_bsd_signal(int sig,
|
||||
} else {
|
||||
fatal("recursive segv. expanding stack.");
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -301,9 +482,16 @@ JVM_handle_bsd_signal(int sig,
|
||||
// Java thread running in Java code => find exception handler if any
|
||||
// a fault inside compiled code, the interpreter, or a stub
|
||||
|
||||
- if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) {
|
||||
+ if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) {
|
||||
stub = SharedRuntime::get_poll_stub(pc);
|
||||
+#if defined(__APPLE__) && !defined(AMD64)
|
||||
+ // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions.
|
||||
+ // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from
|
||||
+ // being called, so only do so if the implicit NULL check is not necessary.
|
||||
+ } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((int)info->si_addr)) {
|
||||
+#else
|
||||
} else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
|
||||
+#endif
|
||||
// BugId 4454115: A read from a MappedByteBuffer can fault
|
||||
// here if the underlying file has been truncated.
|
||||
// Do not crash the VM in such a case.
|
||||
@@ -324,6 +512,28 @@ JVM_handle_bsd_signal(int sig,
|
||||
pc,
|
||||
SharedRuntime::
|
||||
IMPLICIT_DIVIDE_BY_ZERO);
|
||||
+#ifdef __APPLE__
|
||||
+ } else if (sig == SIGFPE && info->si_code == FPE_NOOP) {
|
||||
+ int op = pc[0];
|
||||
+
|
||||
+ // Skip REX
|
||||
+ if ((pc[0] & 0xf0) == 0x40) {
|
||||
+ op = pc[1];
|
||||
+ } else {
|
||||
+ op = pc[0];
|
||||
+ }
|
||||
+
|
||||
+ // Check for IDIV
|
||||
+ if (op == 0xF7) {
|
||||
+ stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime:: IMPLICIT_DIVIDE_BY_ZERO);
|
||||
+ } else {
|
||||
+ // TODO: handle more cases if we are using other x86 instructions
|
||||
+ // that can generate SIGFPE signal.
|
||||
+ tty->print_cr("unknown opcode 0x%X with SIGFPE.", op);
|
||||
+ fatal("please update this code.");
|
||||
+ }
|
||||
+#endif /* __APPLE__ */
|
||||
+
|
||||
#else
|
||||
if (sig == SIGFPE /* && info->si_code == FPE_INTDIV */) {
|
||||
// HACK: si_code does not work on bsd 2.2.12-20!!!
|
||||
@@ -351,7 +561,7 @@ JVM_handle_bsd_signal(int sig,
|
||||
fatal("please update this code.");
|
||||
}
|
||||
#endif // AMD64
|
||||
- } else if (sig == SIGSEGV &&
|
||||
+ } else if ((sig == SIGSEGV || sig == SIGBUS) &&
|
||||
!MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
|
||||
// Determination of interpreter/vtable stub/compiled code null exception
|
||||
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
|
||||
@@ -375,7 +585,7 @@ JVM_handle_bsd_signal(int sig,
|
||||
// process of write protecting the memory serialization page.
|
||||
// It write enables the page immediately after protecting it
|
||||
// so we can just return to retry the write.
|
||||
- if ((sig == SIGSEGV) &&
|
||||
+ if ((sig == SIGSEGV || sig == SIGBUS) &&
|
||||
os::is_memory_serialize_page(thread, (address) info->si_addr)) {
|
||||
// Block current thread until the memory serialize page permission restored.
|
||||
os::block_on_serialize_page_trap();
|
||||
@@ -396,7 +606,7 @@ JVM_handle_bsd_signal(int sig,
|
||||
// Furthermore, a false-positive should be harmless.
|
||||
if (UnguardOnExecutionViolation > 0 &&
|
||||
(sig == SIGSEGV || sig == SIGBUS) &&
|
||||
- uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) {
|
||||
+ uc->context_trapno == trap_page_fault) {
|
||||
int page_size = os::vm_page_size();
|
||||
address addr = (address) info->si_addr;
|
||||
address pc = os::Bsd::ucontext_get_pc(uc);
|
||||
@@ -466,7 +676,7 @@ JVM_handle_bsd_signal(int sig,
|
||||
// save all thread context in case we need to restore it
|
||||
if (thread != NULL) thread->set_saved_exception_pc(pc);
|
||||
|
||||
- uc->uc_mcontext.gregs[REG_PC] = (greg_t)stub;
|
||||
+ uc->context_pc = (intptr_t)stub;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -496,13 +706,24 @@ JVM_handle_bsd_signal(int sig,
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+// From solaris_i486.s ported to bsd_i486.s
|
||||
+extern "C" void fixcw();
|
||||
+#endif
|
||||
+
|
||||
void os::Bsd::init_thread_fpu_state(void) {
|
||||
#ifndef AMD64
|
||||
+# ifdef _ALLBSD_SOURCE
|
||||
+ // Set fpu to 53 bit precision. This happens too early to use a stub.
|
||||
+ fixcw();
|
||||
+# else
|
||||
// set fpu to 53 bit precision
|
||||
set_fpu_control_word(0x27f);
|
||||
+# endif
|
||||
#endif // !AMD64
|
||||
}
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
int os::Bsd::get_fpu_control_word(void) {
|
||||
#ifdef AMD64
|
||||
return 0;
|
||||
@@ -518,11 +739,12 @@ void os::Bsd::set_fpu_control_word(int fpu_control) {
|
||||
_FPU_SETCW(fpu_control);
|
||||
#endif // !AMD64
|
||||
}
|
||||
+#endif
|
||||
|
||||
// Check that the bsd kernel version is 2.4 or higher since earlier
|
||||
// versions do not support SSE without patches.
|
||||
bool os::supports_sse() {
|
||||
-#ifdef AMD64
|
||||
+#if defined(AMD64) || defined(_ALLBSD_SOURCE)
|
||||
return true;
|
||||
#else
|
||||
struct utsname uts;
|
||||
@@ -576,6 +798,9 @@ size_t os::Bsd::min_stack_allowed = (48 DEBUG_ONLY(+
|
||||
#define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;})
|
||||
#endif
|
||||
|
||||
+#ifdef _ALLBSD_SOURCE
|
||||
+bool os::Bsd::supports_variable_stack_size() { return true; }
|
||||
+#else
|
||||
// Test if pthread library can support variable thread stack size. BsdThreads
|
||||
// in fixed stack mode allocates 2M fixed slot for each thread. BsdThreads
|
||||
// in floating stack mode and NPTL support variable stack size.
|
||||
@@ -612,6 +837,7 @@ bool os::Bsd::supports_variable_stack_size() {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
#endif // AMD64
|
||||
|
||||
// return default stack size for thr_type
|
||||
@@ -665,6 +891,41 @@ size_t os::Bsd::default_guard_size(os::ThreadType thr_
|
||||
// pthread_attr_getstack()
|
||||
|
||||
static void current_stack_region(address * bottom, size_t * size) {
|
||||
+#ifdef __APPLE__
|
||||
+ pthread_t self = pthread_self();
|
||||
+ void *stacktop = pthread_get_stackaddr_np(self);
|
||||
+ *size = pthread_get_stacksize_np(self);
|
||||
+ *bottom = (address) stacktop - *size;
|
||||
+#elif defined(__OpenBSD__)
|
||||
+ stack_t ss;
|
||||
+ int rslt = pthread_stackseg_np(pthread_self(), &ss);
|
||||
+
|
||||
+ if (rslt != 0)
|
||||
+ fatal(err_msg("pthread_stackseg_np failed with err = %d", rslt));
|
||||
+
|
||||
+ *bottom = (address)((char *)ss.ss_sp - ss.ss_size);
|
||||
+ *size = ss.ss_size;
|
||||
+#elif defined(_ALLBSD_SOURCE)
|
||||
+ pthread_attr_t attr;
|
||||
+
|
||||
+ int rslt = pthread_attr_init(&attr);
|
||||
+
|
||||
+ // JVM needs to know exact stack location, abort if it fails
|
||||
+ if (rslt != 0)
|
||||
+ fatal(err_msg("pthread_attr_init failed with err = %d", rslt));
|
||||
+
|
||||
+ rslt = pthread_attr_get_np(pthread_self(), &attr);
|
||||
+
|
||||
+ if (rslt != 0)
|
||||
+ fatal(err_msg("pthread_attr_get_np failed with err = %d", rslt));
|
||||
+
|
||||
+ if (pthread_attr_getstackaddr(&attr, (void **)bottom) != 0 ||
|
||||
+ pthread_attr_getstacksize(&attr, size) != 0) {
|
||||
+ fatal("Can not locate current stack attributes!");
|
||||
+ }
|
||||
+
|
||||
+ pthread_attr_destroy(&attr);
|
||||
+#else
|
||||
if (os::Bsd::is_initial_thread()) {
|
||||
// initial thread needs special handling because pthread_getattr_np()
|
||||
// may return bogus value.
|
||||
@@ -691,6 +952,7 @@ static void current_stack_region(address * bottom, siz
|
||||
pthread_attr_destroy(&attr);
|
||||
|
||||
}
|
||||
+#endif
|
||||
assert(os::current_stack_pointer() >= *bottom &&
|
||||
os::current_stack_pointer() < *bottom + *size, "just checking");
|
||||
}
|
||||
@@ -719,46 +981,44 @@ void os::print_context(outputStream *st, void *context
|
||||
ucontext_t *uc = (ucontext_t*)context;
|
||||
st->print_cr("Registers:");
|
||||
#ifdef AMD64
|
||||
- st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
|
||||
- st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
|
||||
- st->print(", RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]);
|
||||
- st->print(", RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]);
|
||||
+ st->print( "RAX=" INTPTR_FORMAT, uc->context_rax);
|
||||
+ st->print(", RBX=" INTPTR_FORMAT, uc->context_rbx);
|
||||
+ st->print(", RCX=" INTPTR_FORMAT, uc->context_rcx);
|
||||
+ st->print(", RDX=" INTPTR_FORMAT, uc->context_rdx);
|
||||
st->cr();
|
||||
- st->print( "RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]);
|
||||
- st->print(", RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]);
|
||||
- st->print(", RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]);
|
||||
- st->print(", RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]);
|
||||
+ st->print( "RSP=" INTPTR_FORMAT, uc->context_rsp);
|
||||
+ st->print(", RBP=" INTPTR_FORMAT, uc->context_rbp);
|
||||
+ st->print(", RSI=" INTPTR_FORMAT, uc->context_rsi);
|
||||
+ st->print(", RDI=" INTPTR_FORMAT, uc->context_rdi);
|
||||
st->cr();
|
||||
- st->print( "R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]);
|
||||
- st->print(", R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]);
|
||||
- st->print(", R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]);
|
||||
- st->print(", R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]);
|
||||
+ st->print( "R8 =" INTPTR_FORMAT, uc->context_r8);
|
||||
+ st->print(", R9 =" INTPTR_FORMAT, uc->context_r9);
|
||||
+ st->print(", R10=" INTPTR_FORMAT, uc->context_r10);
|
||||
+ st->print(", R11=" INTPTR_FORMAT, uc->context_r11);
|
||||
st->cr();
|
||||
- st->print( "R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]);
|
||||
- st->print(", R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]);
|
||||
- st->print(", R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]);
|
||||
- st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]);
|
||||
+ st->print( "R12=" INTPTR_FORMAT, uc->context_r12);
|
||||
+ st->print(", R13=" INTPTR_FORMAT, uc->context_r13);
|
||||
+ st->print(", R14=" INTPTR_FORMAT, uc->context_r14);
|
||||
+ st->print(", R15=" INTPTR_FORMAT, uc->context_r15);
|
||||
st->cr();
|
||||
- st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]);
|
||||
- st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]);
|
||||
- st->print(", CSGSFS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CSGSFS]);
|
||||
- st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]);
|
||||
+ st->print( "RIP=" INTPTR_FORMAT, uc->context_rip);
|
||||
+ st->print(", EFLAGS=" INTPTR_FORMAT, uc->context_flags);
|
||||
+ st->print(", ERR=" INTPTR_FORMAT, uc->context_err);
|
||||
st->cr();
|
||||
- st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]);
|
||||
+ st->print(" TRAPNO=" INTPTR_FORMAT, uc->context_trapno);
|
||||
#else
|
||||
- st->print( "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]);
|
||||
- st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]);
|
||||
- st->print(", ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ECX]);
|
||||
- st->print(", EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDX]);
|
||||
+ st->print( "EAX=" INTPTR_FORMAT, uc->context_eax);
|
||||
+ st->print(", EBX=" INTPTR_FORMAT, uc->context_ebx);
|
||||
+ st->print(", ECX=" INTPTR_FORMAT, uc->context_ecx);
|
||||
+ st->print(", EDX=" INTPTR_FORMAT, uc->context_edx);
|
||||
st->cr();
|
||||
- st->print( "ESP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_UESP]);
|
||||
- st->print(", EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBP]);
|
||||
- st->print(", ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESI]);
|
||||
- st->print(", EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDI]);
|
||||
+ st->print( "ESP=" INTPTR_FORMAT, uc->context_esp);
|
||||
+ st->print(", EBP=" INTPTR_FORMAT, uc->context_ebp);
|
||||
+ st->print(", ESI=" INTPTR_FORMAT, uc->context_esi);
|
||||
+ st->print(", EDI=" INTPTR_FORMAT, uc->context_edi);
|
||||
st->cr();
|
||||
- st->print( "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EIP]);
|
||||
- st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]);
|
||||
- st->print(", CR2=" INTPTR_FORMAT, uc->uc_mcontext.cr2);
|
||||
+ st->print( "EIP=" INTPTR_FORMAT, uc->context_eip);
|
||||
+ st->print(", EFLAGS=" INTPTR_FORMAT, uc->context_eflags);
|
||||
#endif // AMD64
|
||||
st->cr();
|
||||
st->cr();
|
||||
@@ -791,31 +1051,31 @@ void os::print_register_info(outputStream *st, void *c
|
||||
// this is only for the "general purpose" registers
|
||||
|
||||
#ifdef AMD64
|
||||
- st->print("RAX="); print_location(st, uc->uc_mcontext.gregs[REG_RAX]);
|
||||
- st->print("RBX="); print_location(st, uc->uc_mcontext.gregs[REG_RBX]);
|
||||
- st->print("RCX="); print_location(st, uc->uc_mcontext.gregs[REG_RCX]);
|
||||
- st->print("RDX="); print_location(st, uc->uc_mcontext.gregs[REG_RDX]);
|
||||
- st->print("RSP="); print_location(st, uc->uc_mcontext.gregs[REG_RSP]);
|
||||
- st->print("RBP="); print_location(st, uc->uc_mcontext.gregs[REG_RBP]);
|
||||
- st->print("RSI="); print_location(st, uc->uc_mcontext.gregs[REG_RSI]);
|
||||
- st->print("RDI="); print_location(st, uc->uc_mcontext.gregs[REG_RDI]);
|
||||
- st->print("R8 ="); print_location(st, uc->uc_mcontext.gregs[REG_R8]);
|
||||
- st->print("R9 ="); print_location(st, uc->uc_mcontext.gregs[REG_R9]);
|
||||
- st->print("R10="); print_location(st, uc->uc_mcontext.gregs[REG_R10]);
|
||||
- st->print("R11="); print_location(st, uc->uc_mcontext.gregs[REG_R11]);
|
||||
- st->print("R12="); print_location(st, uc->uc_mcontext.gregs[REG_R12]);
|
||||
- st->print("R13="); print_location(st, uc->uc_mcontext.gregs[REG_R13]);
|
||||
- st->print("R14="); print_location(st, uc->uc_mcontext.gregs[REG_R14]);
|
||||
- st->print("R15="); print_location(st, uc->uc_mcontext.gregs[REG_R15]);
|
||||
+ st->print("RAX="); print_location(st, uc->context_rax);
|
||||
+ st->print("RBX="); print_location(st, uc->context_rbx);
|
||||
+ st->print("RCX="); print_location(st, uc->context_rcx);
|
||||
+ st->print("RDX="); print_location(st, uc->context_rdx);
|
||||
+ st->print("RSP="); print_location(st, uc->context_rsp);
|
||||
+ st->print("RBP="); print_location(st, uc->context_rbp);
|
||||
+ st->print("RSI="); print_location(st, uc->context_rsi);
|
||||
+ st->print("RDI="); print_location(st, uc->context_rdi);
|
||||
+ st->print("R8 ="); print_location(st, uc->context_r8);
|
||||
+ st->print("R9 ="); print_location(st, uc->context_r9);
|
||||
+ st->print("R10="); print_location(st, uc->context_r10);
|
||||
+ st->print("R11="); print_location(st, uc->context_r11);
|
||||
+ st->print("R12="); print_location(st, uc->context_r12);
|
||||
+ st->print("R13="); print_location(st, uc->context_r13);
|
||||
+ st->print("R14="); print_location(st, uc->context_r14);
|
||||
+ st->print("R15="); print_location(st, uc->context_r15);
|
||||
#else
|
||||
- st->print("EAX="); print_location(st, uc->uc_mcontext.gregs[REG_EAX]);
|
||||
- st->print("EBX="); print_location(st, uc->uc_mcontext.gregs[REG_EBX]);
|
||||
- st->print("ECX="); print_location(st, uc->uc_mcontext.gregs[REG_ECX]);
|
||||
- st->print("EDX="); print_location(st, uc->uc_mcontext.gregs[REG_EDX]);
|
||||
- st->print("ESP="); print_location(st, uc->uc_mcontext.gregs[REG_ESP]);
|
||||
- st->print("EBP="); print_location(st, uc->uc_mcontext.gregs[REG_EBP]);
|
||||
- st->print("ESI="); print_location(st, uc->uc_mcontext.gregs[REG_ESI]);
|
||||
- st->print("EDI="); print_location(st, uc->uc_mcontext.gregs[REG_EDI]);
|
||||
+ st->print("EAX="); print_location(st, uc->context_eax);
|
||||
+ st->print("EBX="); print_location(st, uc->context_ebx);
|
||||
+ st->print("ECX="); print_location(st, uc->context_ecx);
|
||||
+ st->print("EDX="); print_location(st, uc->context_edx);
|
||||
+ st->print("ESP="); print_location(st, uc->context_esp);
|
||||
+ st->print("EBP="); print_location(st, uc->context_ebp);
|
||||
+ st->print("ESI="); print_location(st, uc->context_esi);
|
||||
+ st->print("EDI="); print_location(st, uc->context_edi);
|
||||
#endif // AMD64
|
||||
|
||||
st->cr();
|
@ -1,14 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_x86_vm_threadLS_bsd_x86_hpp,v 1.2 2009/05/23 03:03:25 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp.orig Fri May 15 16:25:28 2009
|
||||
+++ hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp Fri May 15 17:48:13 2009
|
||||
@@ -27,8 +27,10 @@
|
||||
#ifndef AMD64
|
||||
// map stack pointer to thread pointer - see notes in threadLS_bsd_x86.cpp
|
||||
#define SP_BITLENGTH 32
|
||||
+#ifndef PAGE_SHIFT
|
||||
#define PAGE_SHIFT 12
|
||||
#define PAGE_SIZE (1UL << PAGE_SHIFT)
|
||||
+#endif
|
||||
static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)];
|
||||
#endif // !AMD64
|
||||
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_x86_vm_vmStructs_bsd_x86_hpp,v 1.1 2008/03/19 18:05:43 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp.orig Wed Nov 7 14:34:18 2007
|
||||
+++ hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp Wed Nov 7 14:31:38 2007
|
||||
@@ -31,7 +31,7 @@
|
||||
/******************************/ \
|
||||
/* Threads (NOTE: incomplete) */ \
|
||||
/******************************/ \
|
||||
- nonstatic_field(OSThread, _thread_id, pid_t) \
|
||||
+ nonstatic_field(OSThread, _thread_id, pthread_t) \
|
||||
nonstatic_field(OSThread, _pthread_id, pthread_t) \
|
||||
/* This must be the last entry, and must be present */ \
|
||||
last_entry()
|
@ -1,660 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_zero_vm_atomic_bsd_zero_inline_hpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp.orig Fri Oct 29 11:43:00 2010
|
||||
+++ hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp Fri Oct 29 12:02:31 2010
|
||||
@@ -23,137 +23,442 @@
|
||||
*
|
||||
*/
|
||||
|
||||
-// Implementation of class atomic
|
||||
+#include <sys/types.h>
|
||||
+#ifdef __NetBSD__
|
||||
+#include <sys/atomic.h>
|
||||
+#elif __FreeBSD__
|
||||
|
||||
-#ifdef M68K
|
||||
+#include <sys/types.h>
|
||||
+#ifndef SPARC
|
||||
+#include <machine/atomic.h>
|
||||
+#else
|
||||
|
||||
/*
|
||||
- * __m68k_cmpxchg
|
||||
+ * On FreeBSD/sparc64, <machine/atomic.h> pulls in <machine/cpufunc.h>
|
||||
+ * which includes definitions which cause conflicts with various
|
||||
+ * definitions within HotSpot source. To avoid that, pull in those
|
||||
+ * definitions verbatim instead of including the header. Yuck.
|
||||
+ */
|
||||
+
|
||||
+/*-
|
||||
+ * Copyright (c) 1998 Doug Rabson.
|
||||
+ * Copyright (c) 2001 Jake Burkholder.
|
||||
+ * All rights reserved.
|
||||
*
|
||||
- * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
|
||||
- * Returns newval on success and oldval if no exchange happened.
|
||||
- * This implementation is processor specific and works on
|
||||
- * 68020 68030 68040 and 68060.
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
- * It will not work on ColdFire, 68000 and 68010 since they lack the CAS
|
||||
- * instruction.
|
||||
- * Using a kernelhelper would be better for arch complete implementation.
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+ * SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
-static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) {
|
||||
- int ret;
|
||||
- __asm __volatile ("cas%.l %0,%2,%1"
|
||||
- : "=d" (ret), "+m" (*(ptr))
|
||||
- : "d" (newval), "0" (oldval));
|
||||
- return ret;
|
||||
-}
|
||||
+#include <machine/asi.h>
|
||||
|
||||
-/* Perform an atomic compare and swap: if the current value of `*PTR'
|
||||
- is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of
|
||||
- `*PTR' before the operation.*/
|
||||
-static inline int m68k_compare_and_swap(volatile int *ptr,
|
||||
- int oldval,
|
||||
- int newval) {
|
||||
- for (;;) {
|
||||
- int prev = *ptr;
|
||||
- if (prev != oldval)
|
||||
- return prev;
|
||||
+/*
|
||||
+ * Membar operand macros for use in other macros when # is a special
|
||||
+ * character. Keep these in sync with what the hardware expects.
|
||||
+ */
|
||||
+#define M_LoadLoad (0)
|
||||
+#define M_StoreLoad (1)
|
||||
+#define M_LoadStore (2)
|
||||
+#define M_StoreStore (3)
|
||||
|
||||
- if (__m68k_cmpxchg (prev, newval, ptr) == newval)
|
||||
- // Success.
|
||||
- return prev;
|
||||
+#define CMASK_SHIFT (4)
|
||||
+#define MMASK_SHIFT (0)
|
||||
|
||||
- // We failed even though prev == oldval. Try again.
|
||||
- }
|
||||
-}
|
||||
+#define CMASK_GEN(bit) ((1 << (bit)) << CMASK_SHIFT)
|
||||
+#define MMASK_GEN(bit) ((1 << (bit)) << MMASK_SHIFT)
|
||||
|
||||
-/* Atomically add an int to memory. */
|
||||
-static inline int m68k_add_and_fetch(volatile int *ptr, int add_value) {
|
||||
- for (;;) {
|
||||
- // Loop until success.
|
||||
+#define LoadLoad MMASK_GEN(M_LoadLoad)
|
||||
+#define StoreLoad MMASK_GEN(M_StoreLoad)
|
||||
+#define LoadStore MMASK_GEN(M_LoadStore)
|
||||
+#define StoreStore MMASK_GEN(M_StoreStore)
|
||||
|
||||
- int prev = *ptr;
|
||||
+#define casa(rs1, rs2, rd, asi) ({ \
|
||||
+ u_int __rd = (uint32_t)(rd); \
|
||||
+ __asm __volatile("casa [%2] %3, %4, %0" \
|
||||
+ : "+r" (__rd), "=m" (*rs1) \
|
||||
+ : "r" (rs1), "n" (asi), "r" (rs2), "m" (*rs1)); \
|
||||
+ __rd; \
|
||||
+})
|
||||
|
||||
- if (__m68k_cmpxchg (prev, prev + add_value, ptr) == prev + add_value)
|
||||
- return prev + add_value;
|
||||
- }
|
||||
-}
|
||||
+#define casxa(rs1, rs2, rd, asi) ({ \
|
||||
+ u_long __rd = (uint64_t)(rd); \
|
||||
+ __asm __volatile("casxa [%2] %3, %4, %0" \
|
||||
+ : "+r" (__rd), "=m" (*rs1) \
|
||||
+ : "r" (rs1), "n" (asi), "r" (rs2), "m" (*rs1)); \
|
||||
+ __rd; \
|
||||
+})
|
||||
|
||||
-/* Atomically write VALUE into `*PTR' and returns the previous
|
||||
- contents of `*PTR'. */
|
||||
-static inline int m68k_lock_test_and_set(volatile int *ptr, int newval) {
|
||||
- for (;;) {
|
||||
- // Loop until success.
|
||||
- int prev = *ptr;
|
||||
+#define membar(mask) do { \
|
||||
+ __asm __volatile("membar %0" : : "n" (mask) : "memory"); \
|
||||
+} while (0)
|
||||
|
||||
- if (__m68k_cmpxchg (prev, newval, ptr) == prev)
|
||||
- return prev;
|
||||
- }
|
||||
-}
|
||||
-#endif // M68K
|
||||
+#ifdef _KERNEL
|
||||
+#define __ASI_ATOMIC ASI_N
|
||||
+#else
|
||||
+#define __ASI_ATOMIC ASI_P
|
||||
+#endif
|
||||
|
||||
-#ifdef ARM
|
||||
+#define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory")
|
||||
+#define wmb() mb()
|
||||
+#define rmb() mb()
|
||||
|
||||
/*
|
||||
- * __kernel_cmpxchg
|
||||
+ * Various simple arithmetic on memory which is atomic in the presence
|
||||
+ * of interrupts and multiple processors. See atomic(9) for details.
|
||||
+ * Note that efficient hardware support exists only for the 32 and 64
|
||||
+ * bit variants; the 8 and 16 bit versions are not provided and should
|
||||
+ * not be used in MI code.
|
||||
*
|
||||
- * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
|
||||
- * Return zero if *ptr was changed or non-zero if no exchange happened.
|
||||
- * The C flag is also set if *ptr was changed to allow for assembly
|
||||
- * optimization in the calling code.
|
||||
+ * This implementation takes advantage of the fact that the sparc64
|
||||
+ * cas instruction is both a load and a store. The loop is often coded
|
||||
+ * as follows:
|
||||
*
|
||||
+ * do {
|
||||
+ * expect = *p;
|
||||
+ * new = expect + 1;
|
||||
+ * } while (cas(p, expect, new) != expect);
|
||||
+ *
|
||||
+ * which performs an unnnecessary load on each iteration that the cas
|
||||
+ * operation fails. Modified as follows:
|
||||
+ *
|
||||
+ * expect = *p;
|
||||
+ * for (;;) {
|
||||
+ * new = expect + 1;
|
||||
+ * result = cas(p, expect, new);
|
||||
+ * if (result == expect)
|
||||
+ * break;
|
||||
+ * expect = result;
|
||||
+ * }
|
||||
+ *
|
||||
+ * the return value of cas is used to avoid the extra reload.
|
||||
+ *
|
||||
+ * The memory barriers provided by the acq and rel variants are intended
|
||||
+ * to be sufficient for use of relaxed memory ordering. Due to the
|
||||
+ * suggested assembly syntax of the membar operands containing a #
|
||||
+ * character, they cannot be used in macros. The cmask and mmask bits
|
||||
+ * are hard coded in machine/cpufunc.h and used here through macros.
|
||||
+ * Hopefully sun will choose not to change the bit numbers.
|
||||
*/
|
||||
|
||||
-typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
|
||||
-#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0)
|
||||
+#define itype(sz) uint ## sz ## _t
|
||||
|
||||
+#define atomic_cas_32(p, e, s) casa(p, e, s, __ASI_ATOMIC)
|
||||
+#define atomic_cas_64(p, e, s) casxa(p, e, s, __ASI_ATOMIC)
|
||||
|
||||
+#define atomic_cas(p, e, s, sz) \
|
||||
+ atomic_cas_ ## sz(p, e, s)
|
||||
|
||||
-/* Perform an atomic compare and swap: if the current value of `*PTR'
|
||||
- is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of
|
||||
- `*PTR' before the operation.*/
|
||||
-static inline int arm_compare_and_swap(volatile int *ptr,
|
||||
- int oldval,
|
||||
- int newval) {
|
||||
- for (;;) {
|
||||
- int prev = *ptr;
|
||||
- if (prev != oldval)
|
||||
- return prev;
|
||||
+#define atomic_cas_acq(p, e, s, sz) ({ \
|
||||
+ itype(sz) v; \
|
||||
+ v = atomic_cas(p, e, s, sz); \
|
||||
+ membar(LoadLoad | LoadStore); \
|
||||
+ v; \
|
||||
+})
|
||||
|
||||
- if (__kernel_cmpxchg (prev, newval, ptr) == 0)
|
||||
- // Success.
|
||||
- return prev;
|
||||
+#define atomic_cas_rel(p, e, s, sz) ({ \
|
||||
+ itype(sz) v; \
|
||||
+ membar(LoadStore | StoreStore); \
|
||||
+ v = atomic_cas(p, e, s, sz); \
|
||||
+ v; \
|
||||
+})
|
||||
|
||||
- // We failed even though prev == oldval. Try again.
|
||||
- }
|
||||
+#define atomic_op(p, op, v, sz) ({ \
|
||||
+ itype(sz) e, r, s; \
|
||||
+ for (e = *(volatile itype(sz) *)p;; e = r) { \
|
||||
+ s = e op v; \
|
||||
+ r = atomic_cas_ ## sz(p, e, s); \
|
||||
+ if (r == e) \
|
||||
+ break; \
|
||||
+ } \
|
||||
+ e; \
|
||||
+})
|
||||
+
|
||||
+#define atomic_op_acq(p, op, v, sz) ({ \
|
||||
+ itype(sz) t; \
|
||||
+ t = atomic_op(p, op, v, sz); \
|
||||
+ membar(LoadLoad | LoadStore); \
|
||||
+ t; \
|
||||
+})
|
||||
+
|
||||
+#define atomic_op_rel(p, op, v, sz) ({ \
|
||||
+ itype(sz) t; \
|
||||
+ membar(LoadStore | StoreStore); \
|
||||
+ t = atomic_op(p, op, v, sz); \
|
||||
+ t; \
|
||||
+})
|
||||
+
|
||||
+#define atomic_load(p, sz) \
|
||||
+ atomic_cas(p, 0, 0, sz)
|
||||
+
|
||||
+#define atomic_load_acq(p, sz) ({ \
|
||||
+ itype(sz) v; \
|
||||
+ v = atomic_load(p, sz); \
|
||||
+ membar(LoadLoad | LoadStore); \
|
||||
+ v; \
|
||||
+})
|
||||
+
|
||||
+#define atomic_load_clear(p, sz) ({ \
|
||||
+ itype(sz) e, r; \
|
||||
+ for (e = *(volatile itype(sz) *)p;; e = r) { \
|
||||
+ r = atomic_cas(p, e, 0, sz); \
|
||||
+ if (r == e) \
|
||||
+ break; \
|
||||
+ } \
|
||||
+ e; \
|
||||
+})
|
||||
+
|
||||
+#define atomic_store(p, v, sz) do { \
|
||||
+ itype(sz) e, r; \
|
||||
+ for (e = *(volatile itype(sz) *)p;; e = r) { \
|
||||
+ r = atomic_cas(p, e, v, sz); \
|
||||
+ if (r == e) \
|
||||
+ break; \
|
||||
+ } \
|
||||
+} while (0)
|
||||
+
|
||||
+#define atomic_store_rel(p, v, sz) do { \
|
||||
+ membar(LoadStore | StoreStore); \
|
||||
+ atomic_store(p, v, sz); \
|
||||
+} while (0)
|
||||
+
|
||||
+#define ATOMIC_GEN(name, ptype, vtype, atype, sz) \
|
||||
+ \
|
||||
+static __inline vtype \
|
||||
+atomic_add_ ## name(volatile ptype p, atype v) \
|
||||
+{ \
|
||||
+ return ((vtype)atomic_op(p, +, v, sz)); \
|
||||
+} \
|
||||
+static __inline vtype \
|
||||
+atomic_add_acq_ ## name(volatile ptype p, atype v) \
|
||||
+{ \
|
||||
+ return ((vtype)atomic_op_acq(p, +, v, sz)); \
|
||||
+} \
|
||||
+static __inline vtype \
|
||||
+atomic_add_rel_ ## name(volatile ptype p, atype v) \
|
||||
+{ \
|
||||
+ return ((vtype)atomic_op_rel(p, +, v, sz)); \
|
||||
+} \
|
||||
+ \
|
||||
+static __inline int \
|
||||
+atomic_cmpset_ ## name(volatile ptype p, vtype e, vtype s) \
|
||||
+{ \
|
||||
+ return (((vtype)atomic_cas(p, e, s, sz)) == e); \
|
||||
+} \
|
||||
+static __inline int \
|
||||
+atomic_cmpset_acq_ ## name(volatile ptype p, vtype e, vtype s) \
|
||||
+{ \
|
||||
+ return (((vtype)atomic_cas_acq(p, e, s, sz)) == e); \
|
||||
+} \
|
||||
+static __inline int \
|
||||
+atomic_cmpset_rel_ ## name(volatile ptype p, vtype e, vtype s) \
|
||||
+{ \
|
||||
+ return (((vtype)atomic_cas_rel(p, e, s, sz)) == e); \
|
||||
+} \
|
||||
+ \
|
||||
+static __inline vtype \
|
||||
+atomic_load_ ## name(volatile ptype p) \
|
||||
+{ \
|
||||
+ return ((vtype)atomic_cas(p, 0, 0, sz)); \
|
||||
+} \
|
||||
+static __inline vtype \
|
||||
+atomic_load_acq_ ## name(volatile ptype p) \
|
||||
+{ \
|
||||
+ return ((vtype)atomic_cas_acq(p, 0, 0, sz)); \
|
||||
+} \
|
||||
+ \
|
||||
+static __inline void \
|
||||
+atomic_store_ ## name(volatile ptype p, vtype v) \
|
||||
+{ \
|
||||
+ atomic_store(p, v, sz); \
|
||||
+} \
|
||||
+static __inline void \
|
||||
+atomic_store_rel_ ## name(volatile ptype p, vtype v) \
|
||||
+{ \
|
||||
+ atomic_store_rel(p, v, sz); \
|
||||
}
|
||||
|
||||
-/* Atomically add an int to memory. */
|
||||
-static inline int arm_add_and_fetch(volatile int *ptr, int add_value) {
|
||||
- for (;;) {
|
||||
- // Loop until a __kernel_cmpxchg succeeds.
|
||||
+ATOMIC_GEN(int, u_int *, u_int, u_int, 32);
|
||||
+ATOMIC_GEN(32, uint32_t *, uint32_t, uint32_t, 32);
|
||||
|
||||
- int prev = *ptr;
|
||||
+ATOMIC_GEN(long, u_long *, u_long, u_long, 64);
|
||||
+ATOMIC_GEN(64, uint64_t *, uint64_t, uint64_t, 64);
|
||||
|
||||
- if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0)
|
||||
- return prev + add_value;
|
||||
- }
|
||||
+ATOMIC_GEN(ptr, uintptr_t *, uintptr_t, uintptr_t, 64);
|
||||
+
|
||||
+#define atomic_fetchadd_int atomic_add_int
|
||||
+#define atomic_fetchadd_32 atomic_add_32
|
||||
+#define atomic_fetchadd_long atomic_add_long
|
||||
+
|
||||
+#undef ATOMIC_GEN
|
||||
+#undef atomic_cas
|
||||
+#undef atomic_cas_acq
|
||||
+#undef atomic_cas_rel
|
||||
+#undef atomic_op
|
||||
+#undef atomic_op_acq
|
||||
+#undef atomic_op_rel
|
||||
+#undef atomic_load_acq
|
||||
+#undef atomic_store_rel
|
||||
+#undef atomic_load_clear
|
||||
+#endif
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+unsigned int atomic_add_int_nv(volatile unsigned int* dest, unsigned int add_value)
|
||||
+{
|
||||
+ atomic_add_acq_int(dest, add_value);
|
||||
+ return *dest;
|
||||
}
|
||||
|
||||
-/* Atomically write VALUE into `*PTR' and returns the previous
|
||||
- contents of `*PTR'. */
|
||||
-static inline int arm_lock_test_and_set(volatile int *ptr, int newval) {
|
||||
- for (;;) {
|
||||
- // Loop until a __kernel_cmpxchg succeeds.
|
||||
- int prev = *ptr;
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+uintptr_t atomic_add_ptr_nv(volatile intptr_t* dest, intptr_t add_value)
|
||||
+{
|
||||
+ atomic_add_acq_ptr((volatile uintptr_t*) dest, (uintptr_t) add_value);
|
||||
+ return *((volatile uintptr_t*) dest);
|
||||
+}
|
||||
|
||||
- if (__kernel_cmpxchg (prev, newval, ptr) == 0)
|
||||
- return prev;
|
||||
- }
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+unsigned int
|
||||
+atomic_swap_uint(volatile unsigned int *dest, unsigned int exchange_value)
|
||||
+{
|
||||
+ jint prev = *dest;
|
||||
+ atomic_store_rel_int(dest, exchange_value);
|
||||
+ return prev;
|
||||
}
|
||||
-#endif // ARM
|
||||
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+void *
|
||||
+atomic_swap_ptr(volatile void *dest, void *exchange_value)
|
||||
+{
|
||||
+ void *prev = *(void **)dest;
|
||||
+ atomic_store_rel_ptr((volatile uintptr_t*) dest, (uintptr_t) exchange_value);
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+unsigned int
|
||||
+atomic_cas_uint(volatile unsigned int *dest, unsigned int compare_value,
|
||||
+ unsigned int exchange_value)
|
||||
+{
|
||||
+ unsigned int prev = *dest;
|
||||
+ atomic_cmpset_acq_int(dest, compare_value, exchange_value);
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+unsigned long
|
||||
+atomic_cas_ulong(volatile unsigned long *dest, unsigned long compare_value,
|
||||
+ unsigned long exchange_value)
|
||||
+{
|
||||
+ unsigned long prev = *dest;
|
||||
+ atomic_cmpset_acq_long(dest, compare_value, exchange_value);
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+void *
|
||||
+atomic_cas_ptr(volatile void *dest, void *compare_value, void *exchange_value)
|
||||
+{
|
||||
+ void *prev = *(void **)dest;
|
||||
+ atomic_cmpset_acq_ptr((volatile uintptr_t*) dest, (uintptr_t) compare_value, (uintptr_t) exchange_value);
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+#elif defined(__APPLE__)
|
||||
+
|
||||
+#include <libkern/OSAtomic.h>
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+unsigned int
|
||||
+atomic_add_int_nv(volatile unsigned int *target, int delta) {
|
||||
+ return (unsigned int) OSAtomicAdd32Barrier(delta, (volatile int32_t *) target);
|
||||
+}
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+void *
|
||||
+atomic_add_ptr_nv(volatile void *target, ssize_t delta) {
|
||||
+#ifdef __LP64__
|
||||
+ return (void *) OSAtomicAdd64Barrier(delta, (volatile int64_t *) target);
|
||||
+#else
|
||||
+ return (void *) OSAtomicAdd32Barrier(delta, (volatile int32_t *) target);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+unsigned int
|
||||
+atomic_swap_uint(volatile unsigned int *dest, unsigned int exchange_value)
|
||||
+{
|
||||
+ /* No xchg support in OSAtomic */
|
||||
+ unsigned int prev;
|
||||
+ do {
|
||||
+ prev = *dest;
|
||||
+ } while (!OSAtomicCompareAndSwapIntBarrier((int) prev, (int) exchange_value, (volatile int *) dest));
|
||||
+
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+void *
|
||||
+atomic_swap_ptr(volatile void *dest, void *exchange_value)
|
||||
+{
|
||||
+ /* No xchg support in OSAtomic */
|
||||
+ void *prev;
|
||||
+ do {
|
||||
+ prev = *((void * volatile *) dest);
|
||||
+ } while (!OSAtomicCompareAndSwapPtrBarrier(prev, exchange_value, (void * volatile *) dest));
|
||||
+
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+unsigned int
|
||||
+atomic_cas_uint(volatile unsigned int *dest, unsigned int compare_value,
|
||||
+ unsigned int exchange_value)
|
||||
+{
|
||||
+ unsigned int prev = *dest;
|
||||
+ OSAtomicCompareAndSwapIntBarrier(compare_value, exchange_value, (volatile int *) dest);
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+unsigned long
|
||||
+atomic_cas_ulong(volatile unsigned long *dest, unsigned long compare_value,
|
||||
+ unsigned long exchange_value)
|
||||
+{
|
||||
+ unsigned long prev = *dest;
|
||||
+ OSAtomicCompareAndSwapLongBarrier(compare_value, exchange_value, (volatile long *) dest);
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+static __inline __attribute__((__always_inline__))
|
||||
+void *
|
||||
+atomic_cas_ptr(volatile void *dest, void *compare_value, void *exchange_value)
|
||||
+{
|
||||
+ void *prev = *(void **)dest;
|
||||
+ OSAtomicCompareAndSwapPtrBarrier(compare_value, exchange_value, (void * volatile *) dest);
|
||||
+ return prev;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
inline void Atomic::store(jint store_value, volatile jint* dest) {
|
||||
*dest = store_value;
|
||||
}
|
||||
@@ -163,27 +468,11 @@ inline void Atomic::store_ptr(intptr_t store_value, in
|
||||
}
|
||||
|
||||
inline jint Atomic::add(jint add_value, volatile jint* dest) {
|
||||
-#ifdef ARM
|
||||
- return arm_add_and_fetch(dest, add_value);
|
||||
-#else
|
||||
-#ifdef M68K
|
||||
- return m68k_add_and_fetch(dest, add_value);
|
||||
-#else
|
||||
- return __sync_add_and_fetch(dest, add_value);
|
||||
-#endif // M68K
|
||||
-#endif // ARM
|
||||
+ return (jint)atomic_add_int_nv((volatile unsigned int*) dest, add_value);
|
||||
}
|
||||
|
||||
inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
|
||||
-#ifdef ARM
|
||||
- return arm_add_and_fetch(dest, add_value);
|
||||
-#else
|
||||
-#ifdef M68K
|
||||
- return m68k_add_and_fetch(dest, add_value);
|
||||
-#else
|
||||
- return __sync_add_and_fetch(dest, add_value);
|
||||
-#endif // M68K
|
||||
-#endif // ARM
|
||||
+ return (intptr_t)atomic_add_ptr_nv(dest, add_value);
|
||||
}
|
||||
|
||||
inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
|
||||
@@ -215,79 +504,41 @@ inline void Atomic::dec_ptr(volatile void* dest) {
|
||||
}
|
||||
|
||||
inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
|
||||
-#ifdef ARM
|
||||
- return arm_lock_test_and_set(dest, exchange_value);
|
||||
-#else
|
||||
-#ifdef M68K
|
||||
- return m68k_lock_test_and_set(dest, exchange_value);
|
||||
-#else
|
||||
- // __sync_lock_test_and_set is a bizarrely named atomic exchange
|
||||
- // operation. Note that some platforms only support this with the
|
||||
- // limitation that the only valid value to store is the immediate
|
||||
- // constant 1. There is a test for this in JNI_CreateJavaVM().
|
||||
- return __sync_lock_test_and_set (dest, exchange_value);
|
||||
-#endif // M68K
|
||||
-#endif // ARM
|
||||
+ return (jint)atomic_swap_uint((volatile u_int *)dest, (u_int)exchange_value);
|
||||
}
|
||||
|
||||
inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
|
||||
volatile intptr_t* dest) {
|
||||
-#ifdef ARM
|
||||
- return arm_lock_test_and_set(dest, exchange_value);
|
||||
-#else
|
||||
-#ifdef M68K
|
||||
- return m68k_lock_test_and_set(dest, exchange_value);
|
||||
-#else
|
||||
- return __sync_lock_test_and_set (dest, exchange_value);
|
||||
-#endif // M68K
|
||||
-#endif // ARM
|
||||
+ return (intptr_t)atomic_swap_ptr((volatile void *)dest,
|
||||
+ (void *)exchange_value);
|
||||
}
|
||||
|
||||
inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
|
||||
- return (void *) xchg_ptr((intptr_t) exchange_value,
|
||||
- (volatile intptr_t*) dest);
|
||||
+ return atomic_swap_ptr(dest, exchange_value);
|
||||
}
|
||||
|
||||
inline jint Atomic::cmpxchg(jint exchange_value,
|
||||
volatile jint* dest,
|
||||
jint compare_value) {
|
||||
-#ifdef ARM
|
||||
- return arm_compare_and_swap(dest, compare_value, exchange_value);
|
||||
-#else
|
||||
-#ifdef M68K
|
||||
- return m68k_compare_and_swap(dest, compare_value, exchange_value);
|
||||
-#else
|
||||
- return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
|
||||
-#endif // M68K
|
||||
-#endif // ARM
|
||||
+ return atomic_cas_uint((volatile u_int *)dest, compare_value, exchange_value);
|
||||
}
|
||||
|
||||
inline jlong Atomic::cmpxchg(jlong exchange_value,
|
||||
volatile jlong* dest,
|
||||
jlong compare_value) {
|
||||
-
|
||||
- return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
|
||||
+ return atomic_cas_ulong((volatile u_long *)dest, compare_value,
|
||||
+ exchange_value);
|
||||
}
|
||||
|
||||
inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value,
|
||||
volatile intptr_t* dest,
|
||||
intptr_t compare_value) {
|
||||
-#ifdef ARM
|
||||
- return arm_compare_and_swap(dest, compare_value, exchange_value);
|
||||
-#else
|
||||
-#ifdef M68K
|
||||
- return m68k_compare_and_swap(dest, compare_value, exchange_value);
|
||||
-#else
|
||||
- return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
|
||||
-#endif // M68K
|
||||
-#endif // ARM
|
||||
+ return (intptr_t)atomic_cas_ptr((volatile void *)dest, (void *)compare_value,
|
||||
+ (void *)exchange_value);
|
||||
}
|
||||
|
||||
inline void* Atomic::cmpxchg_ptr(void* exchange_value,
|
||||
volatile void* dest,
|
||||
void* compare_value) {
|
||||
-
|
||||
- return (void *) cmpxchg_ptr((intptr_t) exchange_value,
|
||||
- (volatile intptr_t*) dest,
|
||||
- (intptr_t) compare_value);
|
||||
+ return atomic_cas_ptr((volatile void *)dest, compare_value, exchange_value);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_zero_vm_bytes_bsd_zero_inline_hpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_zero/vm/bytes_bsd_zero.inline.hpp.orig Fri Oct 29 12:02:41 2010
|
||||
+++ hotspot/src/os_cpu/bsd_zero/vm/bytes_bsd_zero.inline.hpp Fri Oct 29 12:02:50 2010
|
||||
@@ -25,16 +25,23 @@
|
||||
// Efficient swapping of data bytes from Java byte
|
||||
// ordering to native byte ordering and vice versa.
|
||||
|
||||
-#include <byteswap.h>
|
||||
+#ifdef __APPLE__
|
||||
+#include <libkern/OSByteOrder.h>
|
||||
+#define bswap16(x) OSSwapInt16(x)
|
||||
+#define bswap32(x) OSSwapInt32(x)
|
||||
+#define bswap64(x) OSSwapInt64(x)
|
||||
+#else
|
||||
+# include <sys/endian.h>
|
||||
+#endif
|
||||
|
||||
inline u2 Bytes::swap_u2(u2 x) {
|
||||
- return bswap_16(x);
|
||||
+ return bswap16(x);
|
||||
}
|
||||
|
||||
inline u4 Bytes::swap_u4(u4 x) {
|
||||
- return bswap_32(x);
|
||||
+ return bswap32(x);
|
||||
}
|
||||
|
||||
inline u8 Bytes::swap_u8(u8 x) {
|
||||
- return bswap_64(x);
|
||||
+ return bswap64(x);
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_zero_vm_orderAccess_bsd_zero_inline_hpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp.orig Fri Oct 29 12:03:21 2010
|
||||
+++ hotspot/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp Fri Oct 29 12:03:27 2010
|
||||
@@ -40,7 +40,12 @@ typedef void (__kernel_dmb_t) (void);
|
||||
|
||||
#else // ARM
|
||||
|
||||
+#ifdef __APPLE__
|
||||
+#include <libkern/OSAtomic.h>
|
||||
+#define FULL_MEM_BARRIER OSMemoryBarrier()
|
||||
+#else
|
||||
#define FULL_MEM_BARRIER __sync_synchronize()
|
||||
+#endif // __APPLE__
|
||||
|
||||
#ifdef PPC
|
||||
|
@ -1,119 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_os_cpu_bsd_zero_vm_os_bsd_zero_cpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp.orig Fri Oct 29 12:03:50 2010
|
||||
+++ hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp Fri Oct 29 12:03:57 2010
|
||||
@@ -23,6 +23,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) && !defined(__NetBSD__)
|
||||
+# include <pthread_np.h> /* For pthread_attr_get_np */
|
||||
+#endif
|
||||
+
|
||||
// do not include precompiled header file
|
||||
#include "incls/_os_bsd_zero.cpp.incl"
|
||||
|
||||
@@ -145,6 +149,7 @@ JVM_handle_bsd_signal(int sig,
|
||||
thread->disable_stack_red_zone();
|
||||
ShouldNotCallThis();
|
||||
}
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
else {
|
||||
// Accessing stack address below sp may cause SEGV if
|
||||
// current thread has MAP_GROWSDOWN stack. This should
|
||||
@@ -163,6 +168,7 @@ JVM_handle_bsd_signal(int sig,
|
||||
fatal("recursive segv. expanding stack.");
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,6 +236,7 @@ void os::Bsd::init_thread_fpu_state(void) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
+#ifndef _ALLBSD_SOURCE
|
||||
int os::Bsd::get_fpu_control_word() {
|
||||
ShouldNotCallThis();
|
||||
}
|
||||
@@ -237,6 +244,7 @@ int os::Bsd::get_fpu_control_word() {
|
||||
void os::Bsd::set_fpu_control_word(int fpu) {
|
||||
ShouldNotCallThis();
|
||||
}
|
||||
+#endif
|
||||
|
||||
bool os::is_allocatable(size_t bytes) {
|
||||
#ifdef _LP64
|
||||
@@ -281,7 +289,49 @@ size_t os::Bsd::default_guard_size(os::ThreadType thr_
|
||||
}
|
||||
|
||||
static void current_stack_region(address *bottom, size_t *size) {
|
||||
+ address stack_bottom;
|
||||
+ address stack_top;
|
||||
+ size_t stack_bytes;
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+ pthread_t self = pthread_self();
|
||||
+ stack_top = (address) pthread_get_stackaddr_np(self);
|
||||
+ stack_bytes = pthread_get_stacksize_np(self);
|
||||
+ stack_bottom = stack_top - stack_bytes;
|
||||
+#elif defined(__OpenBSD__)
|
||||
+ stack_t ss;
|
||||
+ int rslt = pthread_stackseg_np(pthread_self(), &ss);
|
||||
+
|
||||
+ if (rslt != 0)
|
||||
+ fatal(err_msg("pthread_stackseg_np failed with err = %d", rslt));
|
||||
+
|
||||
+ stack_top = (address) ss.ss_sp;
|
||||
+ stack_bytes = ss.ss_size;
|
||||
+ stack_bottom = stacktop - stack_bytes;
|
||||
+#elif defined(_ALLBSD_SOURCE)
|
||||
pthread_attr_t attr;
|
||||
+
|
||||
+ int rslt = pthread_attr_init(&attr);
|
||||
+
|
||||
+ // JVM needs to know exact stack location, abort if it fails
|
||||
+ if (rslt != 0)
|
||||
+ fatal(err_msg("pthread_attr_init failed with err = %d", rslt));
|
||||
+
|
||||
+ rslt = pthread_attr_get_np(pthread_self(), &attr);
|
||||
+
|
||||
+ if (rslt != 0)
|
||||
+ fatal(err_msg("pthread_attr_get_np failed with err = %d", rslt));
|
||||
+
|
||||
+ if (pthread_attr_getstackaddr(&attr, (void **) &stack_bottom) != 0 ||
|
||||
+ pthread_attr_getstacksize(&attr, &stack_bytes) != 0) {
|
||||
+ fatal("Can not locate current stack attributes!");
|
||||
+ }
|
||||
+
|
||||
+ pthread_attr_destroy(&attr);
|
||||
+
|
||||
+ stack_top = stack_bottom + stack_bytes;
|
||||
+#else /* Linux */
|
||||
+ pthread_attr_t attr;
|
||||
int res = pthread_getattr_np(pthread_self(), &attr);
|
||||
if (res != 0) {
|
||||
if (res == ENOMEM) {
|
||||
@@ -292,13 +342,11 @@ static void current_stack_region(address *bottom, size
|
||||
}
|
||||
}
|
||||
|
||||
- address stack_bottom;
|
||||
- size_t stack_bytes;
|
||||
res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes);
|
||||
if (res != 0) {
|
||||
fatal(err_msg("pthread_attr_getstack failed with errno = %d", res));
|
||||
}
|
||||
- address stack_top = stack_bottom + stack_bytes;
|
||||
+ stack_top = stack_bottom + stack_bytes;
|
||||
|
||||
// The block of memory returned by pthread_attr_getstack() includes
|
||||
// guard pages where present. We need to trim these off.
|
||||
@@ -340,6 +388,7 @@ static void current_stack_region(address *bottom, size
|
||||
|
||||
stack_bottom = stack_top - stack_bytes;
|
||||
}
|
||||
+#endif
|
||||
|
||||
assert(os::current_stack_pointer() >= stack_bottom, "should do");
|
||||
assert(os::current_stack_pointer() < stack_top, "should do");
|
@ -1,15 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_adlc_adlc_hpp,v 1.3 2009/01/04 23:25:16 kurt Exp $
|
||||
--- hotspot/src/share/vm/adlc/adlc.hpp.orig Thu Jul 17 03:40:31 2008
|
||||
+++ hotspot/src/share/vm/adlc/adlc.hpp Sat Aug 2 16:12:52 2008
|
||||
@@ -69,9 +69,9 @@ typedef unsigned int uintptr_t;
|
||||
#endif
|
||||
#endif // _WIN32
|
||||
|
||||
-#ifdef LINUX
|
||||
+#if defined(LINUX) || defined(_ALLBSD_SOURCE)
|
||||
#include <inttypes.h>
|
||||
-#endif // LINUX
|
||||
+#endif // LINUX || _ALLBSD_SOURCE
|
||||
|
||||
// Macros
|
||||
#define uint32 unsigned int
|
@ -1,12 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_classfile_javaClasses_cpp,v 1.1 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/share/vm/classfile/javaClasses.cpp.orig Fri Oct 29 14:47:34 2010
|
||||
+++ hotspot/src/share/vm/classfile/javaClasses.cpp Fri Oct 29 14:47:42 2010
|
||||
@@ -952,7 +952,7 @@ char* java_lang_Throwable::print_stack_element_to_buff
|
||||
}
|
||||
nmethod* nm = method->code();
|
||||
if (WizardMode && nm != NULL) {
|
||||
- sprintf(buf + (int)strlen(buf), "(nmethod " PTR_FORMAT ")", (intptr_t)nm);
|
||||
+ sprintf(buf + (int)strlen(buf), "(nmethod " INTPTR_FORMAT ")", (intptr_t)nm);
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_interpreter_bytecodeTracer_cpp,v 1.5 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/share/vm/interpreter/bytecodeTracer.cpp.orig Fri Aug 13 03:28:22 2010
|
||||
+++ hotspot/src/share/vm/interpreter/bytecodeTracer.cpp Mon Oct 25 19:45:44 2010
|
||||
@@ -83,7 +83,7 @@ class BytecodePrinter: public BytecodeClosure {
|
||||
// the incoming method. We could lose a line of trace output.
|
||||
// This is acceptable in a debug-only feature.
|
||||
st->cr();
|
||||
- st->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
|
||||
+ st->print("[%ld] ", (long) Thread::current()->osthread()->thread_id());
|
||||
method->print_name(st);
|
||||
st->cr();
|
||||
_current_method = method();
|
||||
@@ -97,7 +97,7 @@ class BytecodePrinter: public BytecodeClosure {
|
||||
}
|
||||
_code = code;
|
||||
int bci = bcp - method->code_base();
|
||||
- st->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
|
||||
+ st->print("[%ld] ", (long) Thread::current()->osthread()->thread_id());
|
||||
if (Verbose) {
|
||||
st->print("%8d %4d " INTPTR_FORMAT " " INTPTR_FORMAT " %s",
|
||||
BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code));
|
@ -0,0 +1,29 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_opto_ifnode_cpp,v 1.1 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/src/share/vm/opto/ifnode.cpp.orig Mon Jun 27 12:14:19 2011
|
||||
+++ hotspot/src/share/vm/opto/ifnode.cpp Wed Sep 7 09:44:08 2011
|
||||
@@ -1009,6 +1009,13 @@ void IfNode::dominated_by( Node *prev_dom, PhaseIterGV
|
||||
int prev_op = prev_dom->Opcode();
|
||||
Node *top = igvn->C->top(); // Shortcut to top
|
||||
|
||||
+ // Loop predicates may have depending checks which should not
|
||||
+ // be skipped. For example, range check predicate has two checks
|
||||
+ // for lower and upper bounds.
|
||||
+ ProjNode* unc_proj = proj_out(1 - prev_dom->as_Proj()->_con)->as_Proj();
|
||||
+ if (PhaseIdealLoop::is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate))
|
||||
+ prev_dom = idom;
|
||||
+
|
||||
// Now walk the current IfNode's projections.
|
||||
// Loop ends when 'this' has no more uses.
|
||||
for (DUIterator_Last imin, i = last_outs(imin); i >= imin; --i) {
|
||||
@@ -1019,9 +1026,9 @@ void IfNode::dominated_by( Node *prev_dom, PhaseIterGV
|
||||
// or TOP if the dominating projection is of opposite type.
|
||||
// Data-target will be used as the new control edge for the non-CFG
|
||||
// nodes like Casts and Loads.
|
||||
- Node *data_target = (ifp->Opcode() == prev_op ) ? prev_dom : top;
|
||||
+ Node *data_target = (ifp->Opcode() == prev_op) ? prev_dom : top;
|
||||
// Control-target is just the If's immediate dominator or TOP.
|
||||
- Node *ctrl_target = (ifp->Opcode() == prev_op ) ? idom : top;
|
||||
+ Node *ctrl_target = (ifp->Opcode() == prev_op) ? idom : top;
|
||||
|
||||
// For each child of an IfTrue/IfFalse projection, reroute.
|
||||
// Loop ends when projection has no more uses.
|
@ -0,0 +1,23 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_opto_loopPredicate_cpp,v 1.1 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/src/share/vm/opto/loopPredicate.cpp.orig Mon Jun 27 12:14:20 2011
|
||||
+++ hotspot/src/share/vm/opto/loopPredicate.cpp Wed Sep 7 09:44:08 2011
|
||||
@@ -817,6 +817,10 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTr
|
||||
cl = head->as_CountedLoop();
|
||||
// do nothing for iteration-splitted loops
|
||||
if (!cl->is_normal_loop()) return false;
|
||||
+ // Avoid RCE if Counted loop's test is '!='.
|
||||
+ BoolTest::mask bt = cl->loopexit()->test_trip();
|
||||
+ if (bt != BoolTest::lt && bt != BoolTest::gt)
|
||||
+ cl = NULL;
|
||||
}
|
||||
|
||||
Node* entry = head->in(LoopNode::EntryControl);
|
||||
@@ -958,7 +962,7 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTr
|
||||
if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx);
|
||||
|
||||
// Test the upper bound
|
||||
- Node* upper_bound_bol = rc_predicate(loop, ctrl, scale, offset, init, limit, stride, rng, true);
|
||||
+ Node* upper_bound_bol = rc_predicate(loop, lower_bound_proj, scale, offset, init, limit, stride, rng, true);
|
||||
IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If();
|
||||
_igvn.hash_delete(upper_bound_iff);
|
||||
upper_bound_iff->set_req(1, upper_bound_bol);
|
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_opto_loopnode_hpp,v 1.1 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/src/share/vm/opto/loopnode.hpp.orig Mon Jun 27 12:14:21 2011
|
||||
+++ hotspot/src/share/vm/opto/loopnode.hpp Wed Sep 7 09:44:08 2011
|
||||
@@ -1009,7 +1009,7 @@ class PhaseIdealLoop : public PhaseTransform { (public
|
||||
Node *has_local_phi_input( Node *n );
|
||||
// Mark an IfNode as being dominated by a prior test,
|
||||
// without actually altering the CFG (and hence IDOM info).
|
||||
- void dominated_by( Node *prevdom, Node *iff, bool flip = false );
|
||||
+ void dominated_by( Node *prevdom, Node *iff, bool flip = false, bool exclude_loop_predicate = false );
|
||||
|
||||
// Split Node 'n' through merge point
|
||||
Node *split_thru_region( Node *n, Node *region );
|
@ -0,0 +1,39 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_opto_loopopts_cpp,v 1.1 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/src/share/vm/opto/loopopts.cpp.orig Mon Jun 27 12:14:21 2011
|
||||
+++ hotspot/src/share/vm/opto/loopopts.cpp Wed Sep 7 09:44:08 2011
|
||||
@@ -194,7 +194,7 @@ Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *r
|
||||
// Replace the dominated test with an obvious true or false. Place it on the
|
||||
// IGVN worklist for later cleanup. Move control-dependent data Nodes on the
|
||||
// live path up to the dominating control.
|
||||
-void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip ) {
|
||||
+void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exclude_loop_predicate ) {
|
||||
#ifndef PRODUCT
|
||||
if (VerifyLoopOptimizations && PrintOpto) tty->print_cr("dominating test");
|
||||
#endif
|
||||
@@ -228,7 +228,16 @@ void PhaseIdealLoop::dominated_by( Node *prevdom, Node
|
||||
// Make control-dependent data Nodes on the live path (path that will remain
|
||||
// once the dominated IF is removed) become control-dependent on the
|
||||
// dominating projection.
|
||||
- Node* dp = ((IfNode*)iff)->proj_out(pop == Op_IfTrue);
|
||||
+ Node* dp = iff->as_If()->proj_out(pop == Op_IfTrue);
|
||||
+
|
||||
+ // Loop predicates may have depending checks which should not
|
||||
+ // be skipped. For example, range check predicate has two checks
|
||||
+ // for lower and upper bounds.
|
||||
+ ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp->as_Proj()->_con)->as_Proj();
|
||||
+ if (exclude_loop_predicate &&
|
||||
+ is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate))
|
||||
+ return; // Let IGVN transformation change control dependence.
|
||||
+
|
||||
IdealLoopTree *old_loop = get_loop(dp);
|
||||
|
||||
for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
|
||||
@@ -859,7 +868,7 @@ void PhaseIdealLoop::split_if_with_blocks_post( Node *
|
||||
// Replace the dominated test with an obvious true or false.
|
||||
// Place it on the IGVN worklist for later cleanup.
|
||||
C->set_major_progress();
|
||||
- dominated_by( prevdom, n );
|
||||
+ dominated_by( prevdom, n, false, true );
|
||||
#ifndef PRODUCT
|
||||
if( VerifyLoopOptimizations ) verify();
|
||||
#endif
|
@ -1,23 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_prims_forte_cpp,v 1.2 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/share/vm/prims/forte.cpp.orig Fri Aug 13 03:28:24 2010
|
||||
+++ hotspot/src/share/vm/prims/forte.cpp Mon Oct 25 18:15:45 2010
|
||||
@@ -629,6 +629,11 @@ void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint de
|
||||
// Method to let libcollector know about a dynamically loaded function.
|
||||
// Because it is weakly bound, the calls become NOP's when the library
|
||||
// isn't present.
|
||||
+#ifdef __APPLE__
|
||||
+// XXXDARWIN: Link errors occur even when __attribute__((weak_import))
|
||||
+// is added
|
||||
+#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0)
|
||||
+#else
|
||||
void collector_func_load(char* name,
|
||||
void* null_argument_1,
|
||||
void* null_argument_2,
|
||||
@@ -639,6 +644,7 @@ void collector_func_load(char* name,
|
||||
#pragma weak collector_func_load
|
||||
#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \
|
||||
( collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6),0 : 0 )
|
||||
+#endif // __APPLE__
|
||||
#endif // !_WINDOWS
|
||||
|
||||
} // end extern "C"
|
@ -1,28 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_runtime_os_cpp,v 1.5 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/share/vm/runtime/os.cpp.orig Thu Dec 16 16:53:09 2010
|
||||
+++ hotspot/src/share/vm/runtime/os.cpp Wed Jan 5 22:30:08 2011
|
||||
@@ -79,7 +79,11 @@ char* os::iso8601_time(char* buffer, size_t buffer_len
|
||||
assert(false, "Failed localtime_pd");
|
||||
return NULL;
|
||||
}
|
||||
+#if defined(_ALLBSD_SOURCE)
|
||||
+ const time_t zone = (time_t) time_struct.tm_gmtoff;
|
||||
+#else
|
||||
const time_t zone = timezone;
|
||||
+#endif
|
||||
|
||||
// If daylight savings time is in effect,
|
||||
// we are 1 hour East of our time zone
|
||||
@@ -347,6 +351,12 @@ void* os::native_java_library() {
|
||||
if (_native_java_library == NULL) {
|
||||
vm_exit_during_initialization("Unable to load native library", ebuf);
|
||||
}
|
||||
+#if defined(__OpenBSD__)
|
||||
+ // Work-around OpenBSD's lack of $ORIGIN support by pre-loading libnet.so
|
||||
+ // ignore errors
|
||||
+ dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "net");
|
||||
+ dll_load(buffer, ebuf, sizeof(ebuf));
|
||||
+#endif
|
||||
}
|
||||
static jboolean onLoaded = JNI_FALSE;
|
||||
if (onLoaded) {
|
@ -1,13 +0,0 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_runtime_vm_version_cpp,v 1.7 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/share/vm/runtime/vm_version.cpp.orig Thu Oct 28 20:17:02 2010
|
||||
+++ hotspot/src/share/vm/runtime/vm_version.cpp Mon Nov 1 13:16:17 2010
|
||||
@@ -149,7 +149,8 @@ const char* Abstract_VM_Version::vm_release() {
|
||||
|
||||
#define OS LINUX_ONLY("linux") \
|
||||
WINDOWS_ONLY("windows") \
|
||||
- SOLARIS_ONLY("solaris")
|
||||
+ SOLARIS_ONLY("solaris") \
|
||||
+ BSD_ONLY("bsd")
|
||||
|
||||
#ifdef ZERO
|
||||
#define CPU ZERO_LIBARCH
|
@ -1,69 +1,16 @@
|
||||
$OpenBSD: patch-hotspot_src_share_vm_utilities_globalDefinitions_gcc_hpp,v 1.5 2011/01/11 15:47:49 kurt Exp $
|
||||
--- hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp.orig Thu Oct 28 20:17:03 2010
|
||||
+++ hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp Mon Nov 1 13:16:17 2010
|
||||
@@ -71,12 +71,25 @@
|
||||
# include <sys/procfs.h>
|
||||
# endif
|
||||
|
||||
-#ifdef LINUX
|
||||
+#if defined(LINUX) || defined(_ALLBSD_SOURCE)
|
||||
$OpenBSD: patch-hotspot_src_share_vm_utilities_globalDefinitions_gcc_hpp,v 1.6 2011/09/22 20:26:47 kurt Exp $
|
||||
--- hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp.orig Sun Sep 18 21:21:56 2011
|
||||
+++ hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp Sun Sep 18 21:25:49 2011
|
||||
@@ -80,6 +80,12 @@
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#endif // __STDC_LIMIT_MACROS
|
||||
+#ifndef __STDC_CONSTANT_MACROS
|
||||
+#define __STDC_CONSTANT_MACROS
|
||||
+#endif // __STDC_CONSTANT_MACROS
|
||||
+#ifndef __STDC_FORMAT_MACROS
|
||||
+#define __STDC_FORMAT_MACROS
|
||||
+#endif // __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
+#ifndef __OpenBSD__
|
||||
#include <ucontext.h>
|
||||
+#endif
|
||||
+#ifdef __APPLE__
|
||||
+ #include <AvailabilityMacros.h>
|
||||
+ #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4)
|
||||
+ // Mac OS X 10.4 defines EFL_AC and EFL_ID,
|
||||
+ // which conflict with hotspot variable names.
|
||||
+ //
|
||||
+ // This has been fixed in Mac OS X 10.5.
|
||||
+ #undef EFL_AC
|
||||
+ #undef EFL_ID
|
||||
+ #endif
|
||||
+#endif
|
||||
#include <sys/time.h>
|
||||
-#endif // LINUX
|
||||
+#endif // LINUX || _ALLBSD_SOURCE
|
||||
|
||||
// 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
|
||||
// When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
|
||||
@@ -112,7 +125,7 @@
|
||||
// pointer is stored as integer value. On some platforms, sizeof(intptr_t) >
|
||||
// sizeof(void*), so here we want something which is integer type, but has the
|
||||
// same size as a pointer.
|
||||
-#ifdef LINUX
|
||||
+#ifdef __GNUC__
|
||||
#ifdef _LP64
|
||||
#define NULL_WORD 0L
|
||||
#else
|
||||
@@ -124,7 +137,7 @@
|
||||
#define NULL_WORD NULL
|
||||
#endif
|
||||
|
||||
-#ifndef LINUX
|
||||
+#if !defined(LINUX) && !defined(_ALLBSD_SOURCE)
|
||||
// Compiler-specific primitive types
|
||||
typedef unsigned short uint16_t;
|
||||
#ifndef _UINT32_T
|
||||
@@ -144,7 +157,7 @@ typedef unsigned int uintptr_t;
|
||||
// prior definition of intptr_t, and add "&& !defined(XXX)" above.
|
||||
#endif // _SYS_INT_TYPES_H
|
||||
|
||||
-#endif // !LINUX
|
||||
+#endif // !LINUX && !_ALLBSD_SOURCE
|
||||
|
||||
// Additional Java basic types
|
||||
|
||||
@@ -236,7 +249,9 @@ inline int g_isnan(float f) { return isnanf(f); }
|
||||
inline int g_isnan(float f) { return isnand(f); }
|
||||
#endif
|
||||
inline int g_isnan(double f) { return isnand(f); }
|
||||
-#elif LINUX
|
||||
+#elif defined(__APPLE__)
|
||||
+inline int g_isnan(double f) { return isnan(f); }
|
||||
+#elif defined(LINUX) || defined(_ALLBSD_SOURCE)
|
||||
inline int g_isnan(float f) { return isnanf(f); }
|
||||
inline int g_isnan(double f) { return isnan(f); }
|
||||
#else
|
||||
#ifndef __OpenBSD__
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user