Subject: Re: bin/25633 Was: NetBSD2.0/sparc not ready for prime time?
To: None <port-sparc-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Markus W Kilbinger <kilbi@rad.rwth-aachen.de>
List: netbsd-bugs
Date: 02/02/2005 23:16:02
The following reply was made to PR port-sparc/25633; it has been noted by GNATS.

From: Markus W Kilbinger <kilbi@rad.rwth-aachen.de>
To: bouyer@antioche.eu.org, gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/25633 Was: NetBSD2.0/sparc not ready for prime time?
Date: Thu, 3 Feb 2005 00:15:37 +0100

 >>>>> "Chuck" == Chuck Silvers <chuq@chuq.com> writes:
 
     Chuck> please try the attached patch for the sun4c-specific
     Chuck> pthreads problem. you'll need both a new kernel and a new
     Chuck> libpthread.so (built with the fixed lock.h)
 
     Chuck> -Chuck
     Chuck> Index: src/sys/arch/sparc/include/lock.h
     Chuck> ===================================================================
     Chuck> RCS file: /cvsroot/src/sys/arch/sparc/include/lock.h,v
     Chuck> retrieving revision 1.17
     Chuck> diff -u -p -r1.17 lock.h
     Chuck> --- src/sys/arch/sparc/include/lock.h        20 Apr 2004 08:48:03 -0000      1.17
     Chuck> +++ src/sys/arch/sparc/include/lock.h        2 Feb 2005 16:47:13 -0000
     Chuck> @@ -57,7 +57,7 @@ static __inline__ int __ldstub(__cpu_sim
     Chuck>      int v;
  
     Chuck>      __asm __volatile("ldstub [%1],%0"
     Chuck> -        : "=r" (v)
     Chuck> +        : "=&r" (v)
     Chuck>          : "r" (addr)
     Chuck>          : "memory");
  
     Chuck> Index: src/sys/arch/sparc/sparc/trap.c
     Chuck> ===================================================================
     Chuck> RCS file: /cvsroot/src/sys/arch/sparc/sparc/trap.c,v
     Chuck> retrieving revision 1.155
     Chuck> diff -u -p -r1.155 trap.c
     Chuck> --- src/sys/arch/sparc/sparc/trap.c  28 Aug 2004 17:53:02 -0000      1.155
     Chuck> +++ src/sys/arch/sparc/sparc/trap.c  2 Feb 2005 16:47:22 -0000
     Chuck> @@ -947,6 +947,20 @@ mem_access_fault(type, ser, v, pc, psr, 
     Chuck>           goto fault;
     Chuck>      }
     Chuck>      atype = ser & SER_WRITE ? VM_PROT_WRITE : VM_PROT_READ;
     Chuck> +    if ((ser & SER_PROT) && atype == VM_PROT_READ && type != T_TEXTFAULT) {
     Chuck> +            int inst;
     Chuck> +
     Chuck> +            /*
     Chuck> +             * The hardware reports protection faults by the atomic
     Chuck> +             * load/store instructions as read faults.  If the faulting
     Chuck> +             * instruction is one of those, indicate that this fault is
     Chuck> +             * both read and write.
     Chuck> +             */
     Chuck> +             inst = fuword((void *)pc);
     Chuck> +             if ((inst & 0xc1680000) == 0xc0680000) {
     Chuck> +                     atype = VM_PROT_READ | VM_PROT_WRITE;
     Chuck> +             }
     Chuck> +    }
     Chuck>      va = trunc_page(v);
     Chuck>      if (psr & PSR_PS) {
     Chuck>              extern char Lfsbail[];
 
 Wow! This patch seems to solve
 
   http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=25633
 
 for me! Just tried it on my ipx... :-))
 
 , maybe
 
   http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=25896
 
 too?
 
 Markus.