Module Name: src
Committed By: bouyer
Date: Sat Mar 17 19:40:41 UTC 2012
Modified Files:
src/doc [netbsd-4]: HACKS
src/sys/arch/sparc64/conf [netbsd-4]: Makefile.sparc64 files.sparc64
src/sys/arch/sparc64/sparc64 [netbsd-4]: locore.s
Log Message:
Pull up following revision(s) via patch (requested by nakayama in ticket #1443):
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.71
doc/HACKS: revision 1.123
sys/arch/sparc64/conf/files.sparc64: revision 1.138
sys/arch/sparc64/sparc64/locore.s: revision 1.340
Fix the root cause of the hack "disable optimizations for uvm_bio.c
on 32 bit kernels".
gcc converts a division in the calculation of UBC_UMAP_ADDR macro
to multiplication (smul or combination of add/sll), and the
register of its result contains a garbage in upper 32 bits (the
upper 32 bits of smul/add/sll's result isn't zero cleared).
Then it passes to pseg_get{,_real} through pmap_extract without the
zero clear of upper 32 bits in the optimization case. So the
result of pseg_get and pmap_extact sometimes gets screwed up.
The hack has been resolved in the revision 1.340 of
sys/arch/sparc64/sparc64/locore.s.
To generate a diff of this commit:
cvs rdiff -u -r1.91.2.3 -r1.91.2.4 src/doc/HACKS
cvs rdiff -u -r1.62.12.1 -r1.62.12.2 \
src/sys/arch/sparc64/conf/Makefile.sparc64
cvs rdiff -u -r1.107 -r1.107.2.1 src/sys/arch/sparc64/conf/files.sparc64
cvs rdiff -u -r1.232.2.5 -r1.232.2.6 src/sys/arch/sparc64/sparc64/locore.s
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/doc/HACKS
diff -u src/doc/HACKS:1.91.2.3 src/doc/HACKS:1.91.2.4
--- src/doc/HACKS:1.91.2.3 Mon Sep 29 20:23:31 2008
+++ src/doc/HACKS Sat Mar 17 19:40:41 2012
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.91.2.3 2008/09/29 20:23:31 jdc Exp $
+# $NetBSD: HACKS,v 1.91.2.4 2012/03/17 19:40:41 bouyer Exp $
#
# This file is intended to document workarounds for currently unsolved
# (mostly) compiler bugs.
@@ -578,18 +578,6 @@ port m68000
toolchains on sun2 with its maximum 4MB RAM)
kcah
-port sparc64
-
- hack disable optimzations for uvm_bio.c on 32 bit kernels
- cdate Sun Mar 21 14:14:04 MET 2004
- who martin
- file sys/arch/sparc64/conf/Makefile.sparc64 : 1.53-1.54
- file sys/arch/sparc64/conf/files.sparc64 : 1.93
- descr
- The sparc compiler miscompiles uvm_bio.c when using
- any optimization. This results in ubc_release panics.
- kcah
-
port macppc
hack remove inline from rotate_{left,right}
Index: src/sys/arch/sparc64/conf/Makefile.sparc64
diff -u src/sys/arch/sparc64/conf/Makefile.sparc64:1.62.12.1 src/sys/arch/sparc64/conf/Makefile.sparc64:1.62.12.2
--- src/sys/arch/sparc64/conf/Makefile.sparc64:1.62.12.1 Tue Jun 5 20:22:33 2007
+++ src/sys/arch/sparc64/conf/Makefile.sparc64 Sat Mar 17 19:40:40 2012
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.sparc64,v 1.62.12.1 2007/06/05 20:22:33 bouyer Exp $
+# $NetBSD: Makefile.sparc64,v 1.62.12.2 2012/03/17 19:40:40 bouyer Exp $
#=========================================================================
#
@@ -57,7 +57,6 @@ CPPFLAGS+= -Dsparc64 -D__sparc64__
# 64-bit kernels
CPPFLAGS+= -D_LP64 -Wa,-Av9a
AFLAGS+= -Wa,-Av9a
-CC_NOOPT= ${NORMAL_C}
.if defined(PROF)
# Profiling is only supported in the medium low memory model.
CFLAGS+= -mcmodel=medlow
@@ -69,10 +68,6 @@ CFLAGS+= -mcmodel=medlow
# 32-bit kernels
CPPFLAGS+= -m32 -Wa,-Av8plusa -mcpu=ultrasparc
AFLAGS+= -Wa,-Av8plusa
-# XXX
-# The sparc gcc version 3.3.3 (NetBSD nb1 20040301) does not compile this
-# file properly with higher optimizations
-CC_NOOPT= ${NORMAL_C:C/-O./-O0/}
.endif
CFLAGS+= -mno-fpu
AFLAGS+= -x assembler-with-cpp -traditional-cpp
Index: src/sys/arch/sparc64/conf/files.sparc64
diff -u src/sys/arch/sparc64/conf/files.sparc64:1.107 src/sys/arch/sparc64/conf/files.sparc64:1.107.2.1
--- src/sys/arch/sparc64/conf/files.sparc64:1.107 Thu Nov 9 15:08:04 2006
+++ src/sys/arch/sparc64/conf/files.sparc64 Sat Mar 17 19:40:40 2012
@@ -1,4 +1,4 @@
-# $NetBSD: files.sparc64,v 1.107 2006/11/09 15:08:04 tsutsui Exp $
+# $NetBSD: files.sparc64,v 1.107.2.1 2012/03/17 19:40:40 bouyer Exp $
# @(#)files.sparc64 8.1 (Berkeley) 7/19/93
# sparc64-specific configuration info
@@ -248,6 +248,3 @@ file netns/ns_cksum.c ns
file dev/md_root.c memory_disk_hooks
include "arch/sparc64/conf/majors.sparc64"
-
-# special compiler settings (no optimization if 32bit kernel)
-file uvm/uvm_bio.c compile-with "${CC_NOOPT}"
Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.232.2.5 src/sys/arch/sparc64/sparc64/locore.s:1.232.2.6
--- src/sys/arch/sparc64/sparc64/locore.s:1.232.2.5 Thu Sep 25 19:40:12 2008
+++ src/sys/arch/sparc64/sparc64/locore.s Sat Mar 17 19:40:41 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.232.2.5 2008/09/25 19:40:12 bouyer Exp $ */
+/* $NetBSD: locore.s,v 1.232.2.6 2012/03/17 19:40:41 bouyer Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath
@@ -7856,6 +7856,9 @@ ENTRY(pmap_copy_page)
*/
ENTRY(pseg_get)
! flushw ! Make sure we don't have stack probs & lose hibits of %o
+#ifndef _LP64
+ clruw %o1 ! Zero extend
+#endif
ldx [%o0 + PM_PHYS], %o2 ! pmap->pm_segs
srax %o1, HOLESHIFT, %o3 ! Check for valid address