CVS commit: src/sys/ufs/ufs

2016-11-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Nov 11 22:59:26 UTC 2016

Modified Files:
src/sys/ufs/ufs: ufs_wapbl.h

Log Message:
fix !WAPBL variant of UFS_WAPBL_REGISTER_DEALLOCATION()


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/ufs/ufs/ufs_wapbl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ufs/ufs_wapbl.h
diff -u src/sys/ufs/ufs/ufs_wapbl.h:1.13 src/sys/ufs/ufs/ufs_wapbl.h:1.14
--- src/sys/ufs/ufs/ufs_wapbl.h:1.13	Thu Nov 10 20:56:32 2016
+++ src/sys/ufs/ufs/ufs_wapbl.h	Fri Nov 11 22:59:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_wapbl.h,v 1.13 2016/11/10 20:56:32 jdolecek Exp $	*/
+/*	$NetBSD: ufs_wapbl.h,v 1.14 2016/11/11 22:59:26 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -171,8 +171,8 @@ ufs_wapbl_end(struct mount *mp)
 #define	UFS_WAPBL_JUNLOCK_ASSERT(mp)
 #define	UFS_WAPBL_REGISTER_INODE(mp, ino, mode)		do { } while (0)
 #define	UFS_WAPBL_UNREGISTER_INODE(mp, ino, mode)	do { } while (0)
-#define	UFS_WAPBL_REGISTER_DEALLOCATION(mp, blk, len)		0
-#define	UFS_WAPBL_REGISTER_DEALLOCATION_FORCE(mp, blk, len)	0
+#define	UFS_WAPBL_REGISTER_DEALLOCATION(mp, blk, len, cookiep)		0
+#define	UFS_WAPBL_REGISTER_DEALLOCATION_FORCE(mp, blk, len)		0
 #define	UFS_WAPBL_UNREGISTER_DEALLOCATION(mp, cookie)	do { } while (0)
 #endif
 



CVS commit: src/sys/external/bsd/acpica

2016-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 11 21:11:32 UTC 2016

Modified Files:
src/sys/external/bsd/acpica/conf: files.acpica
src/sys/external/bsd/acpica/dist/common: dmtbdump.c dmtbinfo.c
src/sys/external/bsd/acpica/dist/compiler: aslcompiler.h aslutils.c
aslxref.c dtfield.c dtparser.y dttable.c dtutils.c prparser.y
src/sys/external/bsd/acpica/dist/debugger: dbexec.c dbinput.c
dbmethod.c
src/sys/external/bsd/acpica/dist/disassembler: dmbuffer.c dmcstyle.c
dmresrcl.c
src/sys/external/bsd/acpica/dist/events: evrgnini.c
src/sys/external/bsd/acpica/dist/executer: exconfig.c
src/sys/external/bsd/acpica/dist/include: acapps.h acdebug.h acdisasm.h
acglobal.h aclocal.h acnamesp.h acpiosxf.h acpixf.h actables.h
actypes.h acutils.h
src/sys/external/bsd/acpica/dist/include/platform: acgcc.h acnetbsd.h
src/sys/external/bsd/acpica/dist/tables: tbdata.c tbfadt.c tbinstal.c
tbutils.c tbxface.c tbxfload.c tbxfroot.c
src/sys/external/bsd/acpica/dist/tools/acpidump: apfiles.c
src/sys/external/bsd/acpica/dist/utilities: utdebug.c utosi.c utprint.c
uttrack.c
Removed Files:
src/sys/external/bsd/acpica/dist/include/platform: acwinex.h
src/sys/external/bsd/acpica/dist/os_specific/service_layers: osefitbl.c
osefixf.c oslibcfs.c

Log Message:
Adjust to new acpica


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/acpica/conf/files.acpica
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/acpica/dist/common/dmtbdump.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/common/dmtbinfo.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/acpica/dist/compiler/aslcompiler.h
cvs rdiff -u -r1.14 -r1.15 \
src/sys/external/bsd/acpica/dist/compiler/aslutils.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/acpica/dist/compiler/aslxref.c \
src/sys/external/bsd/acpica/dist/compiler/dtparser.y \
src/sys/external/bsd/acpica/dist/compiler/dttable.c \
src/sys/external/bsd/acpica/dist/compiler/prparser.y
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/acpica/dist/compiler/dtfield.c \
src/sys/external/bsd/acpica/dist/compiler/dtutils.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/debugger/dbexec.c
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/acpica/dist/debugger/dbinput.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/acpica/dist/debugger/dbmethod.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/acpica/dist/disassembler/dmbuffer.c \
src/sys/external/bsd/acpica/dist/disassembler/dmcstyle.c
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/acpica/dist/disassembler/dmresrcl.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/acpica/dist/events/evrgnini.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/acpica/dist/executer/exconfig.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/acpica/dist/include/acapps.h \
src/sys/external/bsd/acpica/dist/include/actables.h
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/include/acdebug.h \
src/sys/external/bsd/acpica/dist/include/acdisasm.h \
src/sys/external/bsd/acpica/dist/include/aclocal.h \
src/sys/external/bsd/acpica/dist/include/actypes.h
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/acpica/dist/include/acglobal.h \
src/sys/external/bsd/acpica/dist/include/acpixf.h \
src/sys/external/bsd/acpica/dist/include/acutils.h
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/acpica/dist/include/acnamesp.h \
src/sys/external/bsd/acpica/dist/include/acpiosxf.h
cvs rdiff -u -r1.1.1.8 -r1.2 \
src/sys/external/bsd/acpica/dist/include/platform/acgcc.h
cvs rdiff -u -r1.13 -r1.14 \
src/sys/external/bsd/acpica/dist/include/platform/acnetbsd.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/external/bsd/acpica/dist/include/platform/acwinex.h
cvs rdiff -u -r1.1.1.4 -r0 \
src/sys/external/bsd/acpica/dist/os_specific/service_layers/osefitbl.c \
src/sys/external/bsd/acpica/dist/os_specific/service_layers/osefixf.c
cvs rdiff -u -r1.1.1.3 -r0 \
src/sys/external/bsd/acpica/dist/os_specific/service_layers/oslibcfs.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/acpica/dist/tables/tbdata.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/acpica/dist/tables/tbfadt.c \
src/sys/external/bsd/acpica/dist/tables/tbxface.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/acpica/dist/tables/tbinstal.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/tables/tbutils.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/acpica/dist/tables/tbxfload.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/acpica/dist/tables/tbxfroot.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/acpica/dist/utilities/utdebug.c
cvs rdiff -u -r1.7 -r1.8 

CVS commit: src/doc

2016-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 11 21:11:03 UTC 2016

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new acpica


To generate a diff of this commit:
cvs rdiff -u -r1.1376 -r1.1377 src/doc/3RDPARTY
cvs rdiff -u -r1.2208 -r1.2209 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1376 src/doc/3RDPARTY:1.1377
--- src/doc/3RDPARTY:1.1376	Fri Nov  4 15:42:54 2016
+++ src/doc/3RDPARTY	Fri Nov 11 16:11:03 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1376 2016/11/04 19:42:54 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1377 2016/11/11 21:11:03 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -40,8 +40,8 @@
 #
 
 Package:	acpica
-Version:	20160527
-Current Vers:	20160527
+Version:	20160930
+Current Vers:	20160930
 Maintainer:	Intel
 Archive Site:	http://www.acpica.org/downloads/
 Home Page:	http://www.acpica.org/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2208 src/doc/CHANGES:1.2209
--- src/doc/CHANGES:1.2208	Fri Nov  4 15:42:54 2016
+++ src/doc/CHANGES	Fri Nov 11 16:11:03 2016
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2208 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2209 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -393,3 +393,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	bind: Import version 9.10.4-P4. [christos 20161101]
 	zoneinfo: Import tzdata2016i.  [kre 20161103]
 	libc: Update to tzcode2016i. [christos 20161104]
+	acpi(4): Updated ACPICA to 20160930. [christos 2016]



CVS commit: src/external/bsd/acpica/bin/iasl

2016-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 11 21:09:22 UTC 2016

Modified Files:
src/external/bsd/acpica/bin/iasl: Makefile

Log Message:
Adjust to new acpica


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/acpica/bin/iasl/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/acpica/bin/iasl/Makefile
diff -u src/external/bsd/acpica/bin/iasl/Makefile:1.12 src/external/bsd/acpica/bin/iasl/Makefile:1.13
--- src/external/bsd/acpica/bin/iasl/Makefile:1.12	Wed May  4 15:28:15 2016
+++ src/external/bsd/acpica/bin/iasl/Makefile	Fri Nov 11 16:09:21 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2016/05/04 19:28:15 christos Exp $
+# $NetBSD: Makefile,v 1.13 2016/11/11 21:09:21 christos Exp $
 
 .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64")
 PROG=	iasl
@@ -38,6 +38,7 @@ SRCS+= \
 	aslfileio.c \
 	aslfiles.c \
 	aslfold.c \
+	aslhelp.c \
 	aslhex.c \
 	asllength.c \
 	asllisting.c \
@@ -237,12 +238,13 @@ SRCS+= \
 	utresrc.c \
 	utstate.c \
 	utstring.c \
+	utstrtoul64.c \
 	utuuid.c \
 	utxface.c \
 	utxferror.c
 
 .PATH: ${TOPDIR}/../os_specific/service_layers
-SRCS+=	osunixxf.c oslibcfs.c
+SRCS+=	osunixxf.c
 
 
 aslparser.y: asltokens.y asltypes.y aslrules.y aslsupport.y



CVS import: src/sys/external/bsd/acpica/dist

2016-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 11 19:24:44 UTC 2016

Update of /cvsroot/src/sys/external/bsd/acpica/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv21931

Log Message:
Import acpica-20160930:


30 September 2016. Summary of changes for version 20160930:


1) ACPICA kernel-resident subsystem:

Fixed a regression in the internal AcpiTbFindTable function where a non 
AE_OK exception could inadvertently be returned even if the function did 
not fail. This problem affects the following operators:
DataTableRegion
LoadTable

Fixed a regression in the LoadTable operator where a load to any 
namespace location other than the root no longer worked properly.

Increased the maximum loop count value that will result in the 
AE_AML_INFINITE_LOOP exception. This is a mechanism that is intended to 
prevent infinite loops within the AML interpreter and thus the host OS 
kernel. The value is increased from 0x to 0xF loops (65,535 to 
1,048,575).

Moved the AcpiGbl_MaxLoopIterations configuration variable to the public 
acpixf.h file. This allows hosts to easily configure the maximum loop 
count at runtime.

Removed an illegal character in the strtoul64.c file. This character 
caused errors with some C compilers.

Example Code and Data Size: These are the sizes for the OS-independent 
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The 
debug version of the code includes the debug output trace mechanism and 
has a much larger code and data size.

  Current Release:
Non-Debug Version: 140.4K Code, 58.1K Data, 198.5K Total
Debug Version: 200.7K Code, 82.1K Data, 282.8K Total
  Previous Release:
Non-Debug Version: 140.0K Code, 58.1K Data, 198.1K Total
Debug Version: 200.3K Code, 82.1K Data, 282.4K Total


2) iASL Compiler/Disassembler and Tools:

Disassembler: Fixed a problem with the conversion of Else{If{ blocks into 
the simpler ASL ElseIf keyword. During the conversion, a trailing If 
block could be lost and missing from the disassembled output.

iASL: Fixed a missing parser rule for the ObjectType operator. For ASL+, 
the missing rule caused a parse error when using the Index operator as an 
operand to ObjectType. This construct now compiles properly. Example:
ObjectType(PKG1[4]).

iASL: Correctly handle unresolved symbols in the hardware map file (-lm 
option). Previously, unresolved symbols could cause a protection fault. 
Such symbols are now marked as unresolved in the map file.

iASL: Implemented support to allow control method invocations as an 
operand to the ASL DeRefOf operator. Example:
DeRefOf(MTH1(Local0))

Disassembler: Improved support for the ToPLD ASL macro. Detection of a 
possible _PLD buffer now includes examination of both the normal buffer 
length (16 or 20) as well as the surrounding AML package length.

Disassembler: Fixed a problem with the decoding of complex expressions 
within the Divide operator for ASL+. For the case where both the quotient 
and remainder targets are specified, the entire statement cannot be 
disassembled. Previously, the output incorrectly contained a mix of ASL- 
and ASL+ operators. This mixed statement causes a syntax error when 
compiled. Example:
Divide (Add (INT1, 6), 128, RSLT, QUOT)  // was incorrectly 
disassembled to:
Divide (INT1 + 6, 128, RSLT, QUOT)

iASL/Tools: Added support to process AML and non-AML ACPI tables 
consistently. For the disassembler and AcpiExec, allow all types of ACPI 
tables (AML and data tables). For the iASL -e option, allow only AML 
tables (DSDT/SSDT).


31 August 2016. Summary of changes for version 20160831:


1) ACPICA kernel-resident subsystem:

Improve support for the so-called "module-level code", which is defined 
to be math, logical and control AML opcodes that appear outside of any 
control method. This change improves the support by adding more opcodes 
that can be executed in the manner. Some other issues have been solved, 
and the ASL grammar changes to support such code under all scope 
operators (Device, etc.) are complete. Lv Zheng.

UEFI support: these OSL functions have been implemented. This is an 
additional step toward supporting the AcpiExec utility natively (with 
full hardware access) under UEFI. Marcelo Ferreira.
AcpiOsReadPciConfiguration
AcpiOsWritePciConfiguration

Fixed a possible mutex error during control method auto-serialization. Lv 
Zheng. 

Updated support for the Generic Address Structure by fully implementing 
all GAS fields when a 32-bit address is expanded to a 64-bit GAS. Lv 
Zheng.

Updated the return value for the internal _OSI method. Instead of 
0x, the "Ones" value is now returned, which is 0x 
for 64-bit ACPI tables. This fixes an incompatibility with other ACPI 
implementations, and will be reflected and clarified in the next version 
of the ACPI specification.


CVS commit: src/tests/kernel

2016-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 11 17:08:54 UTC 2016

Modified Files:
src/tests/kernel: t_ptrace_wait.c

Log Message:
clear failure, print signals symbolically.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/t_ptrace_wait.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/kernel/t_ptrace_wait.c
diff -u src/tests/kernel/t_ptrace_wait.c:1.3 src/tests/kernel/t_ptrace_wait.c:1.4
--- src/tests/kernel/t_ptrace_wait.c:1.3	Fri Nov 11 07:01:14 2016
+++ src/tests/kernel/t_ptrace_wait.c	Fri Nov 11 12:08:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.3 2016/11/11 12:01:14 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.4 2016/11/11 17:08:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.3 2016/11/11 12:01:14 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.4 2016/11/11 17:08:54 christos Exp $");
 
 #include 
 #include 
@@ -203,7 +203,8 @@ validate_status_exited(int status, int e
 ATF_REQUIRE_MSG(!WIFSTOPPED(status), "Reported stopped process");
 
 	ATF_REQUIRE_EQ_MSG(WEXITSTATUS(status), expected,
-	"The process has exited with invalid value");
+	"The process has exited with invalid value %d != %d",
+	WEXITSTATUS(status), expected);
 }
 
 static void __used
@@ -270,8 +271,12 @@ validate_status_stopped(int status, int 
 	ATF_REQUIRE_MSG(!WIFSIGNALED(status), "Reported signaled process");
 	ATF_REQUIRE_MSG(WIFSTOPPED(status), "Reported stopped process");
 
+	char st[128], ex[128];
+	strlcpy(st, strsignal(WSTOPSIG(status)), sizeof(st));
+	strlcpy(ex, strsignal(expected), sizeof(ex));
+
 	ATF_REQUIRE_EQ_MSG(WSTOPSIG(status), expected,
-	"Unexpected stop signal received");
+	"Unexpected stop signal received [%s] != [%s]", st, ex);
 }
 
 static void __used
@@ -826,9 +831,6 @@ ATF_TC_BODY(attach3, tc)
 	int status;
 #endif
 
-	/* PT_ATTACH from a parent is unreliable */
-	atf_tc_expect_fail("PR kern/51621");
-
 	printf("Spawn tracee\n");
 	ATF_REQUIRE(pipe(fds_totracee) == 0);
 	ATF_REQUIRE(pipe(fds_fromtracee) == 0);



CVS commit: src/sys/kern

2016-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 11 17:10:04 UTC 2016

Modified Files:
src/sys/kern: sys_ptrace_common.c

Log Message:
kern/51621: When attaching to a child send it a SIGTRAP not a SIGSTOP like
Linux and FreeBSD do.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/sys_ptrace_common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.2 src/sys/kern/sys_ptrace_common.c:1.3
--- src/sys/kern/sys_ptrace_common.c:1.2	Fri Nov  4 14:14:04 2016
+++ src/sys/kern/sys_ptrace_common.c	Fri Nov 11 12:10:04 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.2 2016/11/04 18:14:04 christos Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.3 2016/11/11 17:10:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.2 2016/11/04 18:14:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.3 2016/11/11 17:10:04 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -814,7 +814,7 @@ do_ptrace(struct ptrace_methods *ptm, st
 		 * Stop the target.
 		 */
 		proc_changeparent(t, p);
-		signo = SIGSTOP;
+		signo = SIGTRAP;
 		goto sendsig;
 
 	case  PT_GET_EVENT_MASK:



CVS commit: src/sys/arch/mips/mips

2016-11-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Nov 11 16:49:30 UTC 2016

Modified Files:
src/sys/arch/mips/mips: spl.S

Log Message:
switch post-mfc0 call "hazard barrier" from NOP_L to MFC0_HAZARD.

this means it will be applied if MIPS3 too, and now with the prior
commit, it will be a superscalar nop, not just a plain nop.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/mips/spl.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/spl.S
diff -u src/sys/arch/mips/mips/spl.S:1.13 src/sys/arch/mips/mips/spl.S:1.14
--- src/sys/arch/mips/mips/spl.S:1.13	Fri Nov 11 16:45:14 2016
+++ src/sys/arch/mips/mips/spl.S	Fri Nov 11 16:49:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.13 2016/11/11 16:45:14 maya Exp $	*/
+/*	$NetBSD: spl.S,v 1.14 2016/11/11 16:49:30 maya Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: spl.S,v 1.13 2016/11/11 16:45:14 maya Exp $")
+RCSID("$NetBSD: spl.S,v 1.14 2016/11/11 16:49:30 maya Exp $")
 
 #include "assym.h"
 
@@ -76,7 +76,7 @@ _splraise:
 	bnez	v1, 1f# yes, don't change.
 	 nop	#  branch delay
 	mfc0	v1, MIPS_COP_0_STATUS		# fetch status register
-	NOP_L	# load delay
+	MFC0_HAZARD# load delay
 	or	v1, MIPS_INT_MASK		# enable all interrupts
 	xor	a0, v1# disable ipl's masked bits
 	DYNAMIC_STATUS_MASK(a0,v0)		# machine dependent masking
@@ -101,7 +101,7 @@ _splraise:
 1:
 #ifdef PARANOIA
 	mfc0	v1, MIPS_COP_0_STATUS
-	NOP_L	# load delay
+	MFC0_HAZARD# load delay
 	and	a0, v1# a1 contains bit that MBZ
 3:	bnez	a0, 3b# loop forever
 	 nop	#  branch delay
@@ -167,7 +167,7 @@ STATIC_LEAF(_splsw_spl0)
 	or	v1, MIPS_SR_INT_IE		# mask sure interrupts are on
 	xor	v1, MIPS_INT_MASK		# invert
 	mfc0	a0, MIPS_COP_0_STATUS
-	NOP_L	# load delay
+	MFC0_HAZARD# load delay
 	or	v0, a0, v1
 	DYNAMIC_STATUS_MASK(v0,t0)		# machine dependent masking
 	mtc0	zero, MIPS_COP_0_STATUS		## disable interrupts
@@ -186,7 +186,7 @@ STATIC_LEAF(_splsw_setsoftintr)
 	mtc0	zero, MIPS_COP_0_STATUS		# disable interrupts (2 cycles)
 	COP0_SYNC
 	mfc0	v0, MIPS_COP_0_CAUSE		# fetch cause register
-	NOP_L	# load delay
+	MFC0_HAZARD# load delay
 	or	v0, v0, a0			# set soft intr. bits
 	mtc0	v0, MIPS_COP_0_CAUSE		# store back
 	COP0_SYNC
@@ -228,7 +228,7 @@ STATIC_XLEAF(_splsw_splhigh_noprof)
 	beq	v0, a1, 1f			# don't do anything if IPL_HIGH
 	 nop	# branch delay
 	mfc0	v1, MIPS_COP_0_STATUS		# fetch status register
-	NOP_L	# load delay
+	MFC0_HAZARD# load delay
 	and	a0, v1, MIPS_INT_MASK		# select all interrupts
 	xor	a0, v1# clear all interrupts
 	DYNAMIC_STATUS_MASK(a0,a2)		# machine dependent masking
@@ -306,7 +306,7 @@ END(_splsw_splsoftclock)
 
 STATIC_LEAF(_splsw_splintr)
 	mfc0	ta1, MIPS_COP_0_CAUSE		# get active interrupts
-	NOP_L	# load delay
+	MFC0_HAZARD# load delay
 		# restrict to hard int bits
 	and	v1, ta1, MIPS_HARD_INT_MASK	# now have pending interrupts
 	li	v0, IPL_NONE			#  return IPL_NONE



CVS commit: src/sys/arch/mips/mips

2016-11-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Nov 11 16:45:14 UTC 2016

Modified Files:
src/sys/arch/mips/mips: spl.S

Log Message:
remove redundant NOP_L. we do not use the register immediately after
load, so it's not needed.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/mips/spl.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/spl.S
diff -u src/sys/arch/mips/mips/spl.S:1.12 src/sys/arch/mips/mips/spl.S:1.13
--- src/sys/arch/mips/mips/spl.S:1.12	Sat Aug 13 08:08:11 2016
+++ src/sys/arch/mips/mips/spl.S	Fri Nov 11 16:45:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.12 2016/08/13 08:08:11 skrll Exp $	*/
+/*	$NetBSD: spl.S,v 1.13 2016/11/11 16:45:14 maya Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: spl.S,v 1.12 2016/08/13 08:08:11 skrll Exp $")
+RCSID("$NetBSD: spl.S,v 1.13 2016/11/11 16:45:14 maya Exp $")
 
 #include "assym.h"
 
@@ -133,7 +133,6 @@ STATIC_XLEAF(_splsw_splx_noprof)		# does
 	INT_L	a1, (v1)			# load SR bits for this IPL
 1:
 	mfc0	v1, MIPS_COP_0_STATUS		# fetch status register
-	NOP_L	# load delay
 	xor	a1, MIPS_INT_MASK		# invert SR bits
 	or	v1, a1# set any bits for this IPL
 	DYNAMIC_STATUS_MASK(v1,t0)		# machine dependent masking



CVS commit: src/sys/arch/mips/include

2016-11-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Nov 11 16:41:32 UTC 2016

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
switch mfc0_hazard to be superscalar nop, some mips3 are superscalar
and need this to do the right thing


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/mips/include/asm.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.52 src/sys/arch/mips/include/asm.h:1.53
--- src/sys/arch/mips/include/asm.h:1.52	Wed Nov  9 11:50:09 2016
+++ src/sys/arch/mips/include/asm.h	Fri Nov 11 16:41:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.52 2016/11/09 11:50:09 maya Exp $	*/
+/*	$NetBSD: asm.h,v 1.53 2016/11/11 16:41:32 maya Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -512,7 +512,7 @@ _C_LABEL(x):
 
 /* CPU dependent hook for cp0 load delays */
 #if defined(MIPS1) || defined(MIPS2) || defined(MIPS3)
-#define MFC0_HAZARD	nop
+#define MFC0_HAZARD	sll $0,$0,1	/* super scalar nop */
 #else
 #define MFC0_HAZARD	/* nothing */
 #endif



CVS commit: src/lib/libc/sys

2016-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 11 16:07:05 UTC 2016

Modified Files:
src/lib/libc/sys: nanosleep.2

Log Message:
Explain rmtp setting.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/sys/nanosleep.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/nanosleep.2
diff -u src/lib/libc/sys/nanosleep.2:1.21 src/lib/libc/sys/nanosleep.2:1.22
--- src/lib/libc/sys/nanosleep.2:1.21	Thu Jun 16 08:48:09 2016
+++ src/lib/libc/sys/nanosleep.2	Fri Nov 11 11:07:05 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: nanosleep.2,v 1.21 2016/06/16 12:48:09 ryoon Exp $
+.\"	$NetBSD: nanosleep.2,v 1.22 2016/11/11 16:07:05 christos Exp $
 .\"
 .\" Copyright (c) 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)sleep.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd June 16, 2016
+.Dd November 11, 2016
 .Dt NANOSLEEP 2
 .Os
 .Sh NAME
@@ -124,7 +124,16 @@ If
 is
 .Pf non- Dv NULL ,
 the timespec structure it references is updated to contain the
-unslept amount (the request time minus the time actually slept).
+unslept amount (the request time minus the time actually slept),
+unless it is called from
+.Fn clock_nanosleep
+with a 
+.Fa flags
+argument of
+.Dv TIMER_ABSTIME .
+In that case, the
+.Fa rmtp
+argument is left unmodified.
 .Sh ERRORS
 If any of the following conditions occur, the
 .Fn nanosleep



CVS commit: src/sys/kern

2016-11-11 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Fri Nov 11 15:29:37 UTC 2016

Modified Files:
src/sys/kern: kern_time.c

Log Message:
Adjust clock_nanosleep(2) to not copyout remaining time struct if
TIMER_ABSTIME flag is set.

Ok Christos.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/kern/kern_time.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.188 src/sys/kern/kern_time.c:1.189
--- src/sys/kern/kern_time.c:1.188	Thu Jul  7 06:55:43 2016
+++ src/sys/kern/kern_time.c	Fri Nov 11 15:29:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.188 2016/07/07 06:55:43 msaitoh Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.189 2016/11/11 15:29:36 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.188 2016/07/07 06:55:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.189 2016/11/11 15:29:36 njoly Exp $");
 
 #include 
 #include 
@@ -319,7 +319,8 @@ sys_clock_nanosleep(struct lwp *l, const
 	if (SCARG(uap, rmtp) == NULL || (error != 0 && error != EINTR))
 		goto out;
 
-	if ((error1 = copyout(, SCARG(uap, rmtp), sizeof(rmt))) != 0)
+	if ((SCARG(uap, flags) & TIMER_ABSTIME) == 0 &&
+	(error1 = copyout(, SCARG(uap, rmtp), sizeof(rmt))) != 0)
 		error = error1;
 out:
 	*retval = error;



CVS commit: src

2016-11-11 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Fri Nov 11 15:30:44 UTC 2016

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/lib/libc/sys: Makefile
Added Files:
src/tests/lib/libc/sys: t_clock_nanosleep.c

Log Message:
New clock_nanosleep(2) testcase.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.698 -r1.699 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.44 -r1.45 src/tests/lib/libc/sys/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_clock_nanosleep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.175 src/distrib/sets/lists/debug/mi:1.176
--- src/distrib/sets/lists/debug/mi:1.175	Fri Nov 11 07:39:58 2016
+++ src/distrib/sets/lists/debug/mi	Fri Nov 11 15:30:44 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.175 2016/11/11 07:39:58 alnsn Exp $
+# $NetBSD: mi,v 1.176 2016/11/11 15:30:44 njoly Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2014,6 +2014,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_cerror.debug		tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_chroot.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_clock_gettime.debug	tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_clock_nanosleep.debug	tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_clone.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_connect.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_context.debug		tests-obsolete		obsolete,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.698 src/distrib/sets/lists/tests/mi:1.699
--- src/distrib/sets/lists/tests/mi:1.698	Fri Nov 11 07:39:58 2016
+++ src/distrib/sets/lists/tests/mi	Fri Nov 11 15:30:44 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.698 2016/11/11 07:39:58 alnsn Exp $
+# $NetBSD: mi,v 1.699 2016/11/11 15:30:44 njoly Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2685,6 +2685,7 @@
 ./usr/tests/lib/libc/sys/t_cerror		tests-obsolete		obsolete
 ./usr/tests/lib/libc/sys/t_chroot		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_clock_gettime	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/sys/t_clock_nanosleep	tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_clone		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_connect		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_context		tests-obsolete		obsolete

Index: src/tests/lib/libc/sys/Makefile
diff -u src/tests/lib/libc/sys/Makefile:1.44 src/tests/lib/libc/sys/Makefile:1.45
--- src/tests/lib/libc/sys/Makefile:1.44	Sun Nov  6 15:04:14 2016
+++ src/tests/lib/libc/sys/Makefile	Fri Nov 11 15:30:44 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.44 2016/11/06 15:04:14 kamil Exp $
+# $NetBSD: Makefile,v 1.45 2016/11/11 15:30:44 njoly Exp $
 
 MKMAN=	no
 
@@ -12,6 +12,7 @@ TESTS_C+=		t_access
 TESTS_C+=		t_bind
 TESTS_C+=		t_chroot
 TESTS_C+=		t_clock_gettime
+TESTS_C+=		t_clock_nanosleep
 TESTS_C+=		t_clone
 TESTS_C+=		t_connect
 TESTS_C+=		t_dup

Added files:

Index: src/tests/lib/libc/sys/t_clock_nanosleep.c
diff -u /dev/null src/tests/lib/libc/sys/t_clock_nanosleep.c:1.1
--- /dev/null	Fri Nov 11 15:30:44 2016
+++ src/tests/lib/libc/sys/t_clock_nanosleep.c	Fri Nov 11 15:30:44 2016
@@ -0,0 +1,63 @@
+/* $NetBSD: t_clock_nanosleep.c,v 1.1 2016/11/11 15:30:44 njoly Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 

CVS commit: src/sys/arch/amd64/include

2016-11-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 11 12:06:31 UTC 2016

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
Remove useless values, and explain where some others come from


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amd64/include/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.38 src/sys/arch/amd64/include/pmap.h:1.39
--- src/sys/arch/amd64/include/pmap.h:1.38	Fri Jul 22 14:08:33 2016
+++ src/sys/arch/amd64/include/pmap.h	Fri Nov 11 12:06:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.38 2016/07/22 14:08:33 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.39 2016/11/11 12:06:31 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -128,17 +128,6 @@
  */
 
 /*
- * The first generation of Hammer processors can use 48 bits of
- * virtual memory, and 40 bits of physical memory. This will be
- * more for later generations. These defines can be changed to
- * variable names containing the # of bits, extracted from an
- * extended cpuid instruction (variables are harder to use during
- * bootstrap, though)
- */
-#define VIRT_BITS	48
-#define PHYS_BITS	40
-
-/*
  * Mask to get rid of the sign-extended part of addresses.
  */
 #define VA_SIGN_MASK		0x
@@ -150,10 +139,10 @@
 
 #define L4_SLOT_PTE		255
 #ifndef XEN
-#define L4_SLOT_KERN		256
+#define L4_SLOT_KERN		256 /* pl4_i(VM_MIN_KERNEL_ADDRESS) */
 #else
 /* Xen use slots 256-272, let's move farther */
-#define L4_SLOT_KERN		320
+#define L4_SLOT_KERN		320 /* pl4_i(VM_MIN_KERNEL_ADDRESS) */
 #endif
 #define L4_SLOT_KERNBASE	511 /* pl4_i(KERNBASE) */
 



CVS commit: src/tests/kernel

2016-11-11 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Nov 11 12:01:14 UTC 2016

Modified Files:
src/tests/kernel: t_ptrace_wait.c

Log Message:
Add new test t_ptrace_attach3 in t_ptrace

Assert that tracer parent can PT_ATTACH to its child.
This test is for all members of the wait(2) family.

Currently it is marked as an explicit failure PR kern/51621.

I faced the following issues (noted and discussed in the bug report):

- PT_ATTACH seems to work, but waiting for stopped status and signal from the
  child results in getting SIGTRAP, not SIGSTOP like in Linux and FreeBSD. This
  might be by design, I'm unsure. However, so far I was getting SIGSTOP from a
  tracer process that was not the parent. SIGSTOP vs SIGTRAP logic also
  complicates the things up as tracer must check whether is a parent for tracee
  or not - this shouldn't be needed.

- PT_CONTINUE seems to have no effect at all, the child hangs. This operation
  works on Linux and FreeBSD and in the end, test passes correctly.

- Debugging this with gdb(1) results in receiving SIGABRT from the GNU
  debugger (in the moment of raising/receiving SIGTRAP). This is making the
  things harder in general.

Sponsored by .


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/t_ptrace_wait.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/kernel/t_ptrace_wait.c
diff -u src/tests/kernel/t_ptrace_wait.c:1.2 src/tests/kernel/t_ptrace_wait.c:1.3
--- src/tests/kernel/t_ptrace_wait.c:1.2	Thu Nov 10 18:33:52 2016
+++ src/tests/kernel/t_ptrace_wait.c	Fri Nov 11 12:01:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.2 2016/11/10 18:33:52 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.3 2016/11/11 12:01:14 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.2 2016/11/10 18:33:52 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.3 2016/11/11 12:01:14 kamil Exp $");
 
 #include 
 #include 
@@ -808,6 +808,88 @@ ATF_TC_BODY(attach2, tc)
 }
 #endif
 
+ATF_TC(attach3);
+ATF_TC_HEAD(attach3, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Assert that tracer parent can PT_ATTACH to its child");
+}
+
+ATF_TC_BODY(attach3, tc)
+{
+	int fds_totracee[2], fds_fromtracee[2];
+	int rv;
+	const int exitval_tracee = 5;
+	pid_t tracee, wpid;
+	uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+
+	/* PT_ATTACH from a parent is unreliable */
+	atf_tc_expect_fail("PR kern/51621");
+
+	printf("Spawn tracee\n");
+	ATF_REQUIRE(pipe(fds_totracee) == 0);
+	ATF_REQUIRE(pipe(fds_fromtracee) == 0);
+	tracee = atf_utils_fork();
+	if (tracee == 0) {
+		FORKEE_ASSERT(close(fds_totracee[1]) == 0);
+		FORKEE_ASSERT(close(fds_fromtracee[0]) == 0);
+
+		/* Wait for message from the parent */
+		rv = read(fds_totracee[0], , sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		printf("Parent should now attach to tracee\n");
+
+		/* Wait for message from the parent */
+		rv = write(fds_fromtracee[1], , sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		_exit(exitval_tracee);
+	}
+	ATF_REQUIRE(close(fds_totracee[0]) == 0);
+	ATF_REQUIRE(close(fds_fromtracee[1]) == 0);
+
+	printf("Wait for the tracee to become ready\n");
+	rv = write(fds_totracee[1], , sizeof(msg));
+	ATF_REQUIRE(rv == sizeof(msg));
+
+	printf("Before calling PT_ATTACH for tracee %d\n", tracee);
+	ATF_REQUIRE(ptrace(PT_ATTACH, tracee, NULL, 0) != -1);
+
+	printf("Wait for the stopped tracee process with %s()\n",
+	TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(
+	wpid = TWAIT_GENERIC(tracee, , 0), tracee);
+
+	validate_status_stopped(status, SIGTRAP);
+
+	printf("Resume tracee with PT_CONTINUE\n");
+	ATF_REQUIRE(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1);
+
+	printf("Let the tracee exit now\n");
+	rv = read(fds_fromtracee[0], , sizeof(msg));
+	ATF_REQUIRE(rv == sizeof(msg));
+
+	printf("Wait for tracee to exit with %s()\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(
+	wpid = TWAIT_GENERIC(tracee, , 0), tracee);
+
+	validate_status_exited(status, exitval_tracee);
+
+	printf("Before calling %s() for tracee\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_FAILURE(ECHILD,
+	wpid = TWAIT_GENERIC(tracee, , 0));
+
+	printf("fds_fromtracee is no longer needed - close it\n");
+	ATF_REQUIRE(close(fds_fromtracee[0]) == 0);
+
+	printf("fds_totracee is no longer needed - close it\n");
+	ATF_REQUIRE(close(fds_totracee[1]) == 0);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, traceme1);
@@ -819,6 +901,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, attach1);
 	ATF_TP_ADD_TC(tp, attach2);
 #endif
+	ATF_TP_ADD_TC(tp, attach3);
 
 #if defined(TWAIT_WAIT4TYPE)
 	/* TODO */



CVS commit: src/sys/arch

2016-11-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 11 11:34:52 UTC 2016

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S machdep.c
src/sys/arch/x86/x86: pmap.c
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Rename xen_pmap_bootstrap to xen_locore, it really has nothing to do with
pmap and is just a C version of what amd64 and i386 do in asm.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.762 -r1.763 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.224 -r1.225 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/xen/x86/x86_xpmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.112 src/sys/arch/amd64/amd64/locore.S:1.113
--- src/sys/arch/amd64/amd64/locore.S:1.112	Fri Nov 11 11:31:26 2016
+++ src/sys/arch/amd64/amd64/locore.S	Fri Nov 11 11:34:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.112 2016/11/11 11:31:26 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.113 2016/11/11 11:34:51 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -940,10 +940,10 @@ longmode_hi:
 	movq	$1,%rsi
 	call	cpu_init_msrs	/* cpu_init_msrs(ci, true); */
 
-	call	xen_pmap_bootstrap
+	call	xen_locore
 
 	/*
-	 * The first VA available is returned by xen_pmap_bootstrap in %rax. We
+	 * The first VA available is returned by xen_locore in %rax. We
 	 * use it as the UAREA, and set up the stack here.
 	 */
 	movq	%rax,%rsi

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.139 src/sys/arch/i386/i386/locore.S:1.140
--- src/sys/arch/i386/i386/locore.S:1.139	Fri Nov 11 11:00:38 2016
+++ src/sys/arch/i386/i386/locore.S	Fri Nov 11 11:34:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.139 2016/11/11 11:00:38 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.140 2016/11/11 11:34:51 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.139 2016/11/11 11:00:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.140 2016/11/11 11:34:51 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -917,10 +917,10 @@ begin:
 	call	_C_LABEL(initgdt)
 	addl	$4,%esp
 
-	call	xen_pmap_bootstrap
+	call	xen_locore
 
 	/*
-	 * The first VA available is returned by xen_pmap_bootstrap in %eax. We
+	 * The first VA available is returned by xen_locore in %eax. We
 	 * use it as the UAREA, and set up the stack here.
 	 */
 	movl	%eax,%esi

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.762 src/sys/arch/i386/i386/machdep.c:1.763
--- src/sys/arch/i386/i386/machdep.c:1.762	Sun Sep 25 12:59:19 2016
+++ src/sys/arch/i386/i386/machdep.c	Fri Nov 11 11:34:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.762 2016/09/25 12:59:19 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.763 2016/11/11 11:34:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.762 2016/09/25 12:59:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.763 2016/11/11 11:34:51 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -993,7 +993,7 @@ initgdt(union descriptor *tgdt)
 	/*
 	 * We jumpstart the bootstrap process a bit so we can update
 	 * page permissions. This is done redundantly later from
-	 * x86_xpmap.c:xen_pmap_bootstrap() - harmless.
+	 * x86_xpmap.c:xen_locore() - harmless.
 	 */
 	xpmap_phys_to_machine_mapping =
 	(unsigned long *)xen_start_info.mfn_list;
@@ -1173,7 +1173,7 @@ init386(paddr_t first_avail)
 #if defined(PAE) && !defined(XEN)
 	/*
 	 * Save VA and PA of L3 PD of boot processor (for Xen, this is done
-	 * in xen_pmap_bootstrap())
+	 * in xen_locore())
 	 */
 	cpu_info_primary.ci_pae_l3_pdirpa = rcr3();
 	cpu_info_primary.ci_pae_l3_pdir = (pd_entry_t *)(rcr3() + KERNBASE);

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.224 src/sys/arch/x86/x86/pmap.c:1.225
--- src/sys/arch/x86/x86/pmap.c:1.224	Fri Nov 11 09:47:18 2016
+++ src/sys/arch/x86/x86/pmap.c	Fri Nov 11 11:34:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.224 2016/11/11 09:47:18 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.225 2016/11/11 11:34:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.224 2016/11/11 09:47:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.225 2016/11/11 11:34:51 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -512,7 +512,7 @@ static struct pool_cache pmap_pv_cache;
 static pt_entry_t *csrc_pte, *cdst_pte, *zero_pte, *ptp_pte, *early_zero_pte;
 static char 

CVS commit: src/sys/arch/amd64/amd64

2016-11-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 11 11:31:26 UTC 2016

Modified Files:
src/sys/arch/amd64/amd64: locore.S

Log Message:
Mmh, I mistakenly removed the lapic page (which is part of another diff),
put it back in.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/amd64/amd64/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/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.111 src/sys/arch/amd64/amd64/locore.S:1.112
--- src/sys/arch/amd64/amd64/locore.S:1.111	Fri Nov 11 10:40:00 2016
+++ src/sys/arch/amd64/amd64/locore.S	Fri Nov 11 11:31:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.111 2016/11/11 10:40:00 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.112 2016/11/11 11:31:26 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -313,6 +313,16 @@
  */
 	.data
 
+#if NLAPIC > 0
+	.align	PAGE_SIZE
+	.globl	_C_LABEL(local_apic)
+
+	.type	_C_LABEL(local_apic), @object
+LABEL(local_apic)
+	.space	PAGE_SIZE
+END(local_apic)
+#endif
+
 	.globl	_C_LABEL(tablesize)
 	.globl	_C_LABEL(nox_flag)
 	.globl	_C_LABEL(cputype)



CVS commit: src/sys/arch/xen/x86

2016-11-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 11 11:12:42 UTC 2016

Modified Files:
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Start simplifying the Xen locore: rename and reorder several things, remove
awful debug messages, use unsigned counters, fix typos and KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/xen/x86/x86_xpmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.63 src/sys/arch/xen/x86/x86_xpmap.c:1.64
--- src/sys/arch/xen/x86/x86_xpmap.c:1.63	Tue Nov  1 12:16:10 2016
+++ src/sys/arch/xen/x86/x86_xpmap.c	Fri Nov 11 11:12:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.63 2016/11/01 12:16:10 maxv Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.64 2016/11/11 11:12:42 maxv Exp $	*/
 
 /*
  * Copyright (c) 2006 Mathieu Ropert 
@@ -42,7 +42,6 @@
  */
 
 /*
- *
  * Copyright (c) 2004 Christian Limpach.
  * All rights reserved.
  *
@@ -69,7 +68,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.63 2016/11/01 12:16:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.64 2016/11/11 11:12:42 maxv Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -91,13 +90,12 @@ __KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,
 
 #undef	XENDEBUG
 /* #define XENDEBUG_SYNC */
-/* #define	XENDEBUG_LOW */
+/* #define XENDEBUG_LOW */
 
 #ifdef XENDEBUG
 #define	XENPRINTF(x) printf x
 #define	XENPRINTK(x) printk x
 #define	XENPRINTK2(x) /* printk x */
-
 static char XBUF[256];
 #else
 #define	XENPRINTF(x)
@@ -118,6 +116,14 @@ void xen_failsafe_handler(void);
 #define HYPERVISOR_mmu_update_self(req, count, success_count) \
 	HYPERVISOR_mmu_update((req), (count), (success_count), DOMID_SELF)
 
+extern volatile struct xencons_interface *xencons_interface; /* XXX */
+extern struct xenstore_domain_interface *xenstore_interface; /* XXX */
+
+static void xen_bt_set_readonly(vaddr_t);
+static void xen_bootstrap_tables(vaddr_t, vaddr_t, size_t, size_t, int);
+
+vaddr_t xen_pmap_bootstrap(void);
+
 /*
  * kcpuset internally uses an array of uint32_t while xen uses an array of
  * u_long. As we're little-endian we can cast one to the other.
@@ -127,8 +133,8 @@ typedef union {
 	uint32_t xcpum_km[2];
 #else
 	uint32_t xcpum_km[1];
-#endif	
-	u_long   xcpum_xm;
+#endif
+	u_long xcpum_xm;
 } xcpumask_t;
 
 void
@@ -138,7 +144,6 @@ xen_failsafe_handler(void)
 	panic("xen_failsafe_handler called!\n");
 }
 
-
 void
 xen_set_ldt(vaddr_t base, uint32_t entries)
 {
@@ -568,37 +573,16 @@ xpq_debug_dump(void)
 #endif
 
 
-extern volatile struct xencons_interface *xencons_interface; /* XXX */
-extern struct xenstore_domain_interface *xenstore_interface; /* XXX */
-
-static void xen_bt_set_readonly(vaddr_t);
-static void xen_bootstrap_tables(vaddr_t, vaddr_t, int, int, int);
-
-/* How many PDEs ? */
 #if L2_SLOT_KERNBASE > 0
 #define TABLE_L2_ENTRIES (2 * (NKL2_KIMG_ENTRIES + 1))
 #else
 #define TABLE_L2_ENTRIES (NKL2_KIMG_ENTRIES + 1)
 #endif
 
-/* 
- * Construct and switch to new pagetables
- * first_avail is the first vaddr we can use after
- * we get rid of Xen pagetables
- */
-
-vaddr_t xen_pmap_bootstrap(void);
-
-/*
- * Function to get rid of Xen bootstrap tables
- */
-
-/* How many PDP do we need: */
 #ifdef PAE
 /*
- * For PAE, we consider a single contigous L2 "superpage" of 4 pages,
- * all of them mapped by the L3 page. We also need a shadow page
- * for L3[3].
+ * For PAE, we consider a single contigous L2 "superpage" of 4 pages, all of
+ * them mapped by the L3 page. We also need a shadow page for L3[3].
  */
 static const int l2_4_count = 6;
 #elif defined(__x86_64__)
@@ -607,11 +591,14 @@ static const int l2_4_count = PTP_LEVELS
 static const int l2_4_count = PTP_LEVELS - 1;
 #endif
 
+/*
+ * Xen locore: get rid of the Xen bootstrap tables. Build and switch to new page
+ * tables.
+ */
 vaddr_t
 xen_pmap_bootstrap(void)
 {
-	int count, oldcount;
-	long mapsize;
+	size_t count, oldcount, mapsize;
 	vaddr_t bootstrap_tables, init_tables;
 
 	xen_init_features();
@@ -620,16 +607,15 @@ xen_pmap_bootstrap(void)
 
 	xpmap_phys_to_machine_mapping =
 	(unsigned long *)xen_start_info.mfn_list;
-	init_tables = xen_start_info.pt_base;
-	__PRINTK(("xen_arch_pmap_bootstrap init_tables=0x%lx\n", init_tables));
 
 	/* Space after Xen boostrap tables should be free */
-	bootstrap_tables = xen_start_info.pt_base +
-		(xen_start_info.nr_pt_frames * PAGE_SIZE);
+	init_tables = xen_start_info.pt_base;
+	bootstrap_tables = init_tables +
+	(xen_start_info.nr_pt_frames * PAGE_SIZE);
 
 	/*
-	 * Calculate how many space we need
-	 * first everything mapped before the Xen bootstrap tables
+	 * Calculate how much space we need. First, everything mapped before
+	 * the Xen bootstrap tables.
 	 */
 	mapsize = init_tables - KERNTEXTOFF;
 	/* after the tables we'll have:
@@ -645,30 +631,33 @@ 

CVS commit: src/sys/arch/i386/i386

2016-11-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 11 11:00:38 UTC 2016

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
KNF and simplify Xen, and reduce the diff with amd64 a little


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/i386/i386/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/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.138 src/sys/arch/i386/i386/locore.S:1.139
--- src/sys/arch/i386/i386/locore.S:1.138	Sun Oct 16 10:51:31 2016
+++ src/sys/arch/i386/i386/locore.S	Fri Nov 11 11:00:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.138 2016/10/16 10:51:31 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.139 2016/11/11 11:00:38 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.138 2016/10/16 10:51:31 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.139 2016/11/11 11:00:38 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -847,7 +847,7 @@ begin:
 	pushl	$0	/* init386() expects a 64 bits paddr_t with PAE */
 #endif
 	pushl	%eax
-	call	_C_LABEL(init386)	/* wire 386 chip for unix operation */
+	call	_C_LABEL(init386)
 	addl	$PDE_SIZE,%esp		/* pop paddr_t */
 	addl	$NGDT*8,%esp		/* pop temporary gdt */
 
@@ -876,38 +876,43 @@ begin:
 	popfl
 
 	cld
-	movl	%esp, %ebx		/* save start of available space */
-	movl	$_RELOC(tmpstk),%esp	/* bootstrap stack end location */
+
+	/*
+	 * Xen info:
+	 * - %esp -> stack, *theoretically* the last used page by Xen bootstrap
+	 */
+	movl	%esp,%ebx
+	movl	$_RELOC(tmpstk),%esp
 
 	/* Clear BSS. */
 	xorl	%eax,%eax
 	movl	$RELOC(__bss_start),%edi
 	movl	$RELOC(_end),%ecx
 	subl	%edi,%ecx
-	rep stosb
+	rep
+	stosb
 
 	/* Copy the necessary stuff from start_info structure. */
 	/* We need to copy shared_info early, so that sti/cli work */
 	movl	$RELOC(start_info_union),%edi
 	movl	$128,%ecx
-	rep movsl
+	rep
+	movsl
 
-	/* Clear segment registers; always null in proc0. */
+	/* Clear segment registers. */
 	xorl	%eax,%eax
 	movw	%ax,%fs
 	movw	%ax,%gs
-	decl	%eax
-	movl	%eax,RELOC(cpuid_level)
 
 	xorl	%eax,%eax
 	cpuid
 	movl	%eax,RELOC(cpuid_level)
 
 	/*
-	 * Use a temp page. We'll re- add it to uvm(9) once we're
-	 * done using it.
+	 * Use a temporary GDT page. We'll re-add it to uvm(9) once we're done
+	 * using it.
 	 */
-	movl	$RELOC(tmpgdt), %eax
+	movl	$RELOC(tmpgdt),%eax
 	pushl	%eax		/* start of temporary gdt */
 	call	_C_LABEL(initgdt)
 	addl	$4,%esp
@@ -915,23 +920,23 @@ begin:
 	call	xen_pmap_bootstrap
 
 	/*
-	 * First avail returned by xen_pmap_bootstrap in %eax
+	 * The first VA available is returned by xen_pmap_bootstrap in %eax. We
+	 * use it as the UAREA, and set up the stack here.
 	 */
-	movl	%eax, %esi;
-	movl	%esi, _C_LABEL(lwp0uarea)
-
-	/* Set up bootstrap stack. */
+	movl	%eax,%esi
+	movl	%esi,_C_LABEL(lwp0uarea)
 	leal	(USPACE-FRAMESIZE)(%eax),%esp
 	xorl	%ebp,%ebp		/* mark end of frames */
 
-	addl	$USPACE, %esi
-	subl	$KERNBASE, %esi		/* init386 wants a physical address */
+	/* Set first_avail after the UAREA. */
+	addl	$USPACE,%esi
+	subl	$KERNBASE,%esi		/* init386 wants a physical address */
 
 #ifdef PAE
 	pushl	$0	/* init386() expects a 64 bits paddr_t with PAE */
 #endif
 	pushl	%esi
-	call	_C_LABEL(init386)	/* wire 386 chip for unix operation */
+	call	_C_LABEL(init386)
 	addl	$PDE_SIZE,%esp		/* pop paddr_t */
 	call 	_C_LABEL(main)
 #endif /* XEN */



CVS commit: src/sys/ufs/ffs

2016-11-11 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Nov 11 10:50:16 UTC 2016

Modified Files:
src/sys/ufs/ffs: ffs_inode.c

Log Message:
Fix a "slight tweak" from Rev. 1.121:  bap1/bap2 must be valid
before using BAP_ASSIGN().

Prevents NULL pointer dereference when "lastbn >= 0".


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/ufs/ffs/ffs_inode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ffs/ffs_inode.c
diff -u src/sys/ufs/ffs/ffs_inode.c:1.122 src/sys/ufs/ffs/ffs_inode.c:1.123
--- src/sys/ufs/ffs/ffs_inode.c:1.122	Thu Nov 10 20:56:32 2016
+++ src/sys/ufs/ffs/ffs_inode.c	Fri Nov 11 10:50:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_inode.c,v 1.122 2016/11/10 20:56:32 jdolecek Exp $	*/
+/*	$NetBSD: ffs_inode.c,v 1.123 2016/11/11 10:50:16 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.122 2016/11/10 20:56:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.123 2016/11/11 10:50:16 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -659,6 +659,10 @@ ffs_indirtrunc(struct inode *ip, daddr_t
 	 * This assumes the truncate process would not fail, contrary
 	 * to the wapbl case.
 	 */
+	if (ip->i_ump->um_fstype == UFS1)
+		bap1 = (int32_t *)bp->b_data;
+	else
+		bap2 = (int64_t *)bp->b_data;
 	if (lastbn >= 0 && !wapbl) {
 		copy = kmem_alloc(fs->fs_bsize, KM_SLEEP);
 		memcpy((void *)copy, bp->b_data, (u_int)fs->fs_bsize);
@@ -672,11 +676,6 @@ ffs_indirtrunc(struct inode *ip, daddr_t
 			bap1 = (int32_t *)copy;
 		else
 			bap2 = (int64_t *)copy;
-	} else {
-		if (ip->i_ump->um_fstype == UFS1)
-			bap1 = (int32_t *)bp->b_data;
-		else
-			bap2 = (int64_t *)bp->b_data;
 	}
 
 	/*



CVS commit: src/sys/arch/amd64/amd64

2016-11-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 11 10:40:00 UTC 2016

Modified Files:
src/sys/arch/amd64/amd64: locore.S

Log Message:
KNF and simplify Xen


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/amd64/amd64/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/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.110 src/sys/arch/amd64/amd64/locore.S:1.111
--- src/sys/arch/amd64/amd64/locore.S:1.110	Sun Oct 16 10:51:31 2016
+++ src/sys/arch/amd64/amd64/locore.S	Fri Nov 11 10:40:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.110 2016/10/16 10:51:31 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.111 2016/11/11 10:40:00 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -313,16 +313,6 @@
  */
 	.data
 
-#if NLAPIC > 0
-	.align	PAGE_SIZE
-	.globl	_C_LABEL(local_apic)
-
-	.type	_C_LABEL(local_apic), @object
-LABEL(local_apic)
-	.space	PAGE_SIZE
-END(local_apic)
-#endif
-
 	.globl	_C_LABEL(tablesize)
 	.globl	_C_LABEL(nox_flag)
 	.globl	_C_LABEL(cputype)
@@ -887,10 +877,9 @@ longmode_hi:
 	/*
 	 * Xen info:
 	 * - %rsi -> start_info struct
-	 * - %rsp -> stack, *theoretically* the last used page
-	 *	by Xen bootstrap
+	 * - %rsp -> stack, *theoretically* the last used page by Xen bootstrap
 	 */
-	movq	%rsi, %rbx
+	movq	%rsi,%rbx
 
 	/* Clear BSS. */
 	xorq	%rax,%rax
@@ -900,7 +889,7 @@ longmode_hi:
 	rep
 	stosb
 
-	/* Copy start_info to a safe place */
+	/* Copy start_info to a safe place. */
 	movq	%rbx,%rsi
 	movq	$_C_LABEL(start_info_union),%rdi
 	movq	$64,%rcx
@@ -924,45 +913,40 @@ longmode_hi:
 	 */
 
 	/*
-	 * We want our own page tables, let's rebuild them
-	 * We will reclaim xen space afterward INCLUDING stack
-	 * so let's change it to a temporary one
-	 */
-
-	movq	$tmpstk, %rax
-	subq	$8, %rax
-	movq	%rax, %rsp
+	 * We want our own page tables, and will rebuild them. We will reclaim
+	 * the Xen space later, INCLUDING the stack. So we need to switch to a
+	 * temporary one now.
+	 */
+	movq	$tmpstk,%rax
+	subq	$8,%rax
+	movq	%rax,%rsp
 
 	xorl	%eax,%eax
 	cpuid
 	movl	%eax,_C_LABEL(cpuid_level)
 
-	movq	$cpu_info_primary, %rdi
-	movq	%rdi, CPU_INFO_SELF(%rdi) /* ci->ci_self = ci */
-	movq	$1, %rsi
+	movq	$cpu_info_primary,%rdi
+	movq	%rdi,CPU_INFO_SELF(%rdi) /* ci->ci_self = ci */
+	movq	$1,%rsi
 	call	cpu_init_msrs	/* cpu_init_msrs(ci, true); */
 
 	call	xen_pmap_bootstrap
 
 	/*
-	 * First avail returned by xen_pmap_bootstrap in %rax
+	 * The first VA available is returned by xen_pmap_bootstrap in %rax. We
+	 * use it as the UAREA, and set up the stack here.
 	 */
-	movq	%rax, %rsi
+	movq	%rax,%rsi
 	movq	%rsi,(_C_LABEL(lwp0)+L_PCB)	/* XXX L_PCB != uarea */
-
-	/*
-	 * Set new stack and clear segments
-	 */
 	leaq	(USPACE-FRAMESIZE)(%rsi),%rsp
 	xorq	%rbp,%rbp
 
+	/* Clear segment registers. */
 	xorw	%ax,%ax
 	movw	%ax,%gs
 	movw	%ax,%fs
 
-	/*
-	 * Set first_avail after proc0
-	 */
+	/* Set first_avail after the UAREA. */
 	movq	%rsi,%rdi
 	addq	$USPACE,%rdi
 	subq	$KERNBASE,%rdi	/* init_x86_64 wants a physical address */



CVS commit: src/sys/arch/x86/x86

2016-11-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 11 09:47:18 UTC 2016

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Update the pmap only once


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/arch/x86/x86/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.223 src/sys/arch/x86/x86/pmap.c:1.224
--- src/sys/arch/x86/x86/pmap.c:1.223	Tue Nov  8 03:05:36 2016
+++ src/sys/arch/x86/x86/pmap.c	Fri Nov 11 09:47:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.223 2016/11/08 03:05:36 christos Exp $	*/
+/*	$NetBSD: pmap.c,v 1.224 2016/11/11 09:47:18 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.223 2016/11/08 03:05:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.224 2016/11/11 09:47:18 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4547,8 +4547,8 @@ pmap_init_tmp_pgtbl(paddr_t pg)
 			pmap_kenter_pa(x86_tmp_pml_vaddr[level],
 			x86_tmp_pml_paddr[level],
 			VM_PROT_READ | VM_PROT_WRITE, 0);
-			pmap_update(pmap_kernel());
 		}
+		pmap_update(pmap_kernel());
 		maps_loaded = true;
 	}