From owner-freebsd-java Thu May 2 6:22:53 2002 Delivered-To: freebsd-java@freebsd.org Received: from uni-sb.de (uni-sb.de [134.96.252.33]) by hub.freebsd.org (Postfix) with ESMTP id 97C0D37B416 for ; Thu, 2 May 2002 06:22:45 -0700 (PDT) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.12.2/2002030600) with ESMTP id g42DMhd01937 for ; Thu, 2 May 2002 15:22:44 +0200 (CEST) Received: from gigasun.cs.uni-sb.de (IDENT:f+dUag7u0ycvFsBNaRNmY+nobV2EjYI1@gigasun.cs.uni-sb.de [134.96.242.3]) by cs.uni-sb.de (8.12.1/2002030600) with ESMTP id g42DMgW10526 for ; Thu, 2 May 2002 15:22:42 +0200 (CEST) Received: from gargoyle.cs.uni-sb.de (gargoyle.cs.uni-sb.de [134.96.242.163]) by gigasun.cs.uni-sb.de (8.11.6/2001012500) with ESMTP id g42DMcR20263 for ; Thu, 2 May 2002 15:22:38 +0200 (CEST) Received: (from thesing@localhost) by gargoyle.cs.uni-sb.de (8.11.6/8.10.1) id g42DMcr12437 for freebsd-java@freebsd.org; Thu, 2 May 2002 15:22:38 +0200 (CEST) Date: Thu, 2 May 2002 15:22:38 +0200 (CEST) From: Stephan Thesing Message-Id: <200205021322.g42DMcr12437@gargoyle.cs.uni-sb.de> To: freebsd-java@freebsd.org Subject: JDK1.3.1p6 and NetBSD-current Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hello, having played with patchset 6 on NetBSD/i386-1.5ZC (current), I have observed some problems: - compile problems (i.e. gethostent() is not defined on NetBSD), as already observed by someone else on this list - signal related: one place uses dlopen() and dlsym() for "sigprocmask" which, unfortunately is the old compatibility one for NetBSD <=1.3, using the wrong type arg: some time ago the sigset_t in NetBSD changed from one `int' to an array of four `int's. For compatibility, the sigprocmask() still uses one `int', while the new function is __sigprocmask14() (the include files do some renaming so that newly compiled programs use __sigprocmask14() automatically) - `appletviewer' or the Java Plugin for mozilla dumps core by receiving an SIGFPE. This problem is caused by the different layout of the `sigjmp_buf' argument passed to the sigsetjmp/siglongjmp() calls (which are involved in thread switching in green_threads, I guess). The Floating point unit control word is stored in the sigjmp_buf at slot BSD_FPU_MASK (defined to `7' in j2sdk1.3.1/src/solaris/hpi/green_threads/include/context_md_bsd.h) and restored from there. In the same sigjmp_buf the signal mask of the process is stored at offset 6, but as pointed out before, this mask is four ints long in NetBSD>=1.4, thus overwrites the FPU control word, causing `interesting' effects when it is later restored, resulting in FPE signals being sent later. This only seems to happen if several threads are running, so it does not occur during normal use of java or the bootstrap via the freshly build javac. Attached is a patch that seems to work on NetBSD/i386-current so far that I can use the java plugin and appletviewer. It replaces the argument to dlsym() for sigprocmask(), replaces the gethostent() et.al. calls to appropriate replacements and changes the place where the FPU control word is saved/restored from in the sigsetjmp/siglongjmp() frame to 11 (which seems to be free at the moment). No attempt was made to make this work for NetBSD<1.4, which seems to be no longer actively supported anyhow. Could someone please look at this and comment on its usefulness? Best regards.... Stephan ------------------- SNIP ----------------------- --- j2sdk1.3.1/src/solaris/hpi/green_threads/include/context_md_bsd.h.orig Mon Apr 29 13:47:05 2002 +++ j2sdk1.3.1/src/solaris/hpi/green_threads/include/context_md_bsd.h Thu May 2 11:40:31 2002 @@ -27,9 +27,15 @@ #endif } lj_ucontext_t; + #if defined(i386) # if defined(__NetBSD__) || defined(__OpenBSD__) || (defined(__FreeBSD__) && (__FreeBSD__ < 4)) -#define BSD_FPU_MASK 7 +#if defined(__NetBSD__) +/* NetBSD uses slot 7 for its extended signal mask */ +#define BSD_FPU_MASK 11 +#else +#define BSD_FPU_MASK 7 +#endif #define BSD_SIGNAL_MASK 6 # else #define BSD_FPU_MASK 6 @@ -102,6 +108,7 @@ __asm__ ("frstor %0"::"m" (*fdata)); \ } \ } + #elif defined(alpha) #define getcontext(lj_ucontextp) { \ sigsetjmp((lj_ucontextp)->jmpbuf, -1); \ --- j2sdk1.3.1/src/solaris/hpi/green_threads/src/signals.c.orig Mon Apr 29 13:47:05 2002 +++ j2sdk1.3.1/src/solaris/hpi/green_threads/src/signals.c Thu May 2 10:02:37 2002 @@ -596,7 +596,13 @@ #ifndef RTLD_NEXT #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) void *dlMain = dlopen("/usr/lib/libc.so", RTLD_LAZY); - func = (fn_t *)dlsym(dlMain, "sigprocmask"); + func = (fn_t *)dlsym(dlMain, +#if defined(__NetBSD__) + "__sigprocmask14" +#else + "sigprocmask" +#endif + ); #else dlMain = dlopen("/lib/libc.so.6", RTLD_LAZY); func = (fn_t *)dlsym(dlMain, "__sigprocmask"); --- j2sdk1.3.1/src/solaris/native/java/net/InetAddressImpl.c.orig Mon Apr 29 13:47:05 2002 +++ j2sdk1.3.1/src/solaris/native/java/net/InetAddressImpl.c Tue Apr 23 01:14:21 2002 @@ -368,7 +368,13 @@ HOST_R_RETURN gethostent_r(struct hostent *hptr, HOST_R_ARGS) { - struct hostent *he = gethostent(); + struct hostent *he = +#if defined(__NetBSD__) +_gethtent() +#else +gethostent() +#endif +; HOST_R_ERRNO; @@ -385,7 +391,11 @@ sethostent_r(int stay_open) #endif { +#if defined(__NetBSD__) + _sethtent(stay_open); +#else sethostent(stay_open); +#endif #ifdef HOST_R_SET_RESULT return (HOST_R_SET_RESULT); #endif ----------------------- SNIP ------------------------ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message