Subject: Re: lib/30585: Sigcontext misfilled in pthread mode.
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: netbsd-bugs
Date: 06/27/2005 13:00:08
The following reply was made to PR lib/30585; it has been noted by GNATS.

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: gnats-bugs@netbsd.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: lib/30585: Sigcontext misfilled in pthread mode. 
Date: Mon, 27 Jun 2005 14:59:13 +0200

 This is a multipart MIME message.
 
 --==_Exmh_73218017620350
 Content-Type: text/plain; charset=us-ascii
 
 
 Here are 2 patches for the pkgsrc kaffe.
 Can you give them a try?
 
 best regards
 Matthias
 
 
 
 --==_Exmh_73218017620350
 Content-Type: text/plain ; name="patch-af"; charset=us-ascii
 Content-Description: patch-af
 Content-Disposition: attachment; filename="patch-af"
 
 $NetBSD$
 
 --- config/i386/netbsd1/md.h.orig	2005-02-09 20:46:44.000000000 +0100
 +++ config/i386/netbsd1/md.h
 @@ -19,16 +19,26 @@
  #include "i386/sysdepCallMethod.h"
  #include "i386/threads.h"
  
 +#include <signal.h>
 +
  /*
   * Redefine stack pointer offset.
   */
  #undef SP_OFFSET
  #define SP_OFFSET 2
  
 +#ifdef SA_SIGINFO
 +#include <sys/ucontext.h>
 +#define SIGNAL_ARGS(sig, sc) int sig, siginfo_t *__si, void *sc
 +#define SIGNAL_CONTEXT_POINTER(scp) ucontext_t *scp
 +#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
 +#define SIGNAL_PC(scp) ((ucontext_t *)(scp))->uc_mcontext.__gregs[_REG_EIP]
 +#else
  #define SIGNAL_ARGS(sig, sc) int sig, int __code, struct sigcontext *sc
  #define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext *scp
  #define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
  #define SIGNAL_PC(scp) (scp)->sc_pc
 +#endif
  
  #if defined(TRANSLATOR)
  #include "jit-md.h"
 
 --==_Exmh_73218017620350
 Content-Type: text/plain ; name="patch-ag"; charset=us-ascii
 Content-Description: patch-ag
 Content-Disposition: attachment; filename="patch-ag"
 
 $NetBSD$
 
 --- config/i386/netbsd1/jit-md.h.orig	2005-02-09 21:25:34.000000000 +0100
 +++ config/i386/netbsd1/jit-md.h
 @@ -26,7 +26,7 @@
  
  /* Get the first exception frame from a signal handler */
  #define	EXCEPTIONFRAME(f, c)						\
 -	(f).retbp = (c)->sc_ebp;					\
 -	(f).retpc = (c)->sc_eip + 1
 +	(f).retbp = ((ucontext_t *)(c))->uc_mcontext.__gregs[_REG_EBP];					\
 +	(f).retpc = ((ucontext_t *)(c))->uc_mcontext.__gregs[_REG_EIP] + 1
  
  #endif
 
 --==_Exmh_73218017620350--