From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 00:21:39 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 85D3545A; Sun, 20 Jul 2014 00:21:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CEBA2D1B; Sun, 20 Jul 2014 00:21:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K0LdEV070274; Sun, 20 Jul 2014 00:21:39 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K0LduN070272; Sun, 20 Jul 2014 00:21:39 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407200021.s6K0LduN070272@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 20 Jul 2014 00:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268899 - in stable/10: contrib/byacc contrib/byacc/package contrib/byacc/package/debian contrib/byacc/package/pkgsrc contrib/byacc/test contrib/byacc/test/btyacc contrib/byacc/test/yac... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 00:21:39 -0000 Author: bapt Date: Sun Jul 20 00:21:38 2014 New Revision: 268899 URL: http://svnweb.freebsd.org/changeset/base/268899 Log: MFC: r257315, r260445, r264803 Update byacc to 20140422 Added: stable/10/contrib/byacc/MANIFEST - copied, changed from r264803, head/contrib/byacc/MANIFEST stable/10/contrib/byacc/NOTES-btyacc-Changes - copied unchanged from r264803, head/contrib/byacc/NOTES-btyacc-Changes stable/10/contrib/byacc/NOTES-btyacc-Disposition - copied unchanged from r264803, head/contrib/byacc/NOTES-btyacc-Disposition stable/10/contrib/byacc/README.BTYACC - copied, changed from r264803, head/contrib/byacc/README.BTYACC stable/10/contrib/byacc/btyaccpar.c - copied unchanged from r264803, head/contrib/byacc/btyaccpar.c stable/10/contrib/byacc/btyaccpar.skel - copied unchanged from r264803, head/contrib/byacc/btyaccpar.skel stable/10/contrib/byacc/mstring.c - copied, changed from r264803, head/contrib/byacc/mstring.c stable/10/contrib/byacc/package/mingw-byacc.spec - copied, changed from r257315, head/contrib/byacc/package/mingw-byacc.spec stable/10/contrib/byacc/skel2c - copied unchanged from r264803, head/contrib/byacc/skel2c stable/10/contrib/byacc/test/btyacc/ - copied from r264803, head/contrib/byacc/test/btyacc/ stable/10/contrib/byacc/test/btyacc_calc1.y - copied unchanged from r264803, head/contrib/byacc/test/btyacc_calc1.y stable/10/contrib/byacc/test/btyacc_demo.y - copied unchanged from r264803, head/contrib/byacc/test/btyacc_demo.y stable/10/contrib/byacc/test/code_debug.y - copied unchanged from r264803, head/contrib/byacc/test/code_debug.y stable/10/contrib/byacc/test/empty.y - copied unchanged from r264803, head/contrib/byacc/test/empty.y stable/10/contrib/byacc/test/err_inherit1.y - copied unchanged from r264803, head/contrib/byacc/test/err_inherit1.y stable/10/contrib/byacc/test/err_inherit2.y - copied unchanged from r264803, head/contrib/byacc/test/err_inherit2.y stable/10/contrib/byacc/test/err_inherit3.y - copied unchanged from r264803, head/contrib/byacc/test/err_inherit3.y stable/10/contrib/byacc/test/err_inherit4.y - copied unchanged from r264803, head/contrib/byacc/test/err_inherit4.y stable/10/contrib/byacc/test/err_inherit5.y - copied unchanged from r264803, head/contrib/byacc/test/err_inherit5.y stable/10/contrib/byacc/test/err_syntax1.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax1.y stable/10/contrib/byacc/test/err_syntax10.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax10.y stable/10/contrib/byacc/test/err_syntax11.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax11.y stable/10/contrib/byacc/test/err_syntax12.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax12.y stable/10/contrib/byacc/test/err_syntax13.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax13.y stable/10/contrib/byacc/test/err_syntax14.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax14.y stable/10/contrib/byacc/test/err_syntax15.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax15.y stable/10/contrib/byacc/test/err_syntax16.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax16.y stable/10/contrib/byacc/test/err_syntax17.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax17.y stable/10/contrib/byacc/test/err_syntax18.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax18.y stable/10/contrib/byacc/test/err_syntax19.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax19.y stable/10/contrib/byacc/test/err_syntax2.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax2.y stable/10/contrib/byacc/test/err_syntax20.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax20.y stable/10/contrib/byacc/test/err_syntax21.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax21.y stable/10/contrib/byacc/test/err_syntax22.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax22.y stable/10/contrib/byacc/test/err_syntax23.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax23.y stable/10/contrib/byacc/test/err_syntax24.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax24.y stable/10/contrib/byacc/test/err_syntax25.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax25.y stable/10/contrib/byacc/test/err_syntax26.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax26.y stable/10/contrib/byacc/test/err_syntax27.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax27.y stable/10/contrib/byacc/test/err_syntax3.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax3.y stable/10/contrib/byacc/test/err_syntax4.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax4.y stable/10/contrib/byacc/test/err_syntax5.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax5.y stable/10/contrib/byacc/test/err_syntax6.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax6.y stable/10/contrib/byacc/test/err_syntax7.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax7.y stable/10/contrib/byacc/test/err_syntax7a.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax7a.y stable/10/contrib/byacc/test/err_syntax7b.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax7b.y stable/10/contrib/byacc/test/err_syntax8.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax8.y stable/10/contrib/byacc/test/err_syntax8a.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax8a.y stable/10/contrib/byacc/test/err_syntax9.y - copied unchanged from r264803, head/contrib/byacc/test/err_syntax9.y stable/10/contrib/byacc/test/inherit0.y - copied unchanged from r264803, head/contrib/byacc/test/inherit0.y stable/10/contrib/byacc/test/inherit1.y - copied unchanged from r264803, head/contrib/byacc/test/inherit1.y stable/10/contrib/byacc/test/inherit2.y - copied unchanged from r264803, head/contrib/byacc/test/inherit2.y stable/10/contrib/byacc/test/ok_syntax1.y - copied unchanged from r264803, head/contrib/byacc/test/ok_syntax1.y stable/10/contrib/byacc/test/varsyntax_calc1.y - copied unchanged from r264803, head/contrib/byacc/test/varsyntax_calc1.y stable/10/contrib/byacc/test/yacc/ - copied from r264803, head/contrib/byacc/test/yacc/ stable/10/contrib/byacc/yaccpar.c - copied unchanged from r264803, head/contrib/byacc/yaccpar.c stable/10/contrib/byacc/yaccpar.skel - copied unchanged from r264803, head/contrib/byacc/yaccpar.skel Deleted: stable/10/contrib/byacc/skeleton.c stable/10/contrib/byacc/test/calc.output stable/10/contrib/byacc/test/calc.tab.c stable/10/contrib/byacc/test/calc.tab.h stable/10/contrib/byacc/test/calc1.output stable/10/contrib/byacc/test/calc1.tab.c stable/10/contrib/byacc/test/calc1.tab.h stable/10/contrib/byacc/test/calc2.output stable/10/contrib/byacc/test/calc2.tab.c stable/10/contrib/byacc/test/calc2.tab.h stable/10/contrib/byacc/test/calc3.output stable/10/contrib/byacc/test/calc3.tab.c stable/10/contrib/byacc/test/calc3.tab.h stable/10/contrib/byacc/test/code_calc.code.c stable/10/contrib/byacc/test/code_calc.output stable/10/contrib/byacc/test/code_calc.tab.c stable/10/contrib/byacc/test/code_calc.tab.h stable/10/contrib/byacc/test/code_error.code.c stable/10/contrib/byacc/test/code_error.output stable/10/contrib/byacc/test/code_error.tab.c stable/10/contrib/byacc/test/code_error.tab.h stable/10/contrib/byacc/test/error.output stable/10/contrib/byacc/test/error.tab.c stable/10/contrib/byacc/test/error.tab.h stable/10/contrib/byacc/test/ftp.output stable/10/contrib/byacc/test/ftp.tab.c stable/10/contrib/byacc/test/ftp.tab.h stable/10/contrib/byacc/test/ftp.y stable/10/contrib/byacc/test/grammar.output stable/10/contrib/byacc/test/grammar.tab.c stable/10/contrib/byacc/test/grammar.tab.h stable/10/contrib/byacc/test/pure_calc.output stable/10/contrib/byacc/test/pure_calc.tab.c stable/10/contrib/byacc/test/pure_calc.tab.h stable/10/contrib/byacc/test/pure_error.output stable/10/contrib/byacc/test/pure_error.tab.c stable/10/contrib/byacc/test/pure_error.tab.h stable/10/contrib/byacc/test/quote_calc-s.output stable/10/contrib/byacc/test/quote_calc-s.tab.c stable/10/contrib/byacc/test/quote_calc-s.tab.h stable/10/contrib/byacc/test/quote_calc.output stable/10/contrib/byacc/test/quote_calc.tab.c stable/10/contrib/byacc/test/quote_calc.tab.h stable/10/contrib/byacc/test/quote_calc2-s.output stable/10/contrib/byacc/test/quote_calc2-s.tab.c stable/10/contrib/byacc/test/quote_calc2-s.tab.h stable/10/contrib/byacc/test/quote_calc2.output stable/10/contrib/byacc/test/quote_calc2.tab.c stable/10/contrib/byacc/test/quote_calc2.tab.h stable/10/contrib/byacc/test/quote_calc3-s.output stable/10/contrib/byacc/test/quote_calc3-s.tab.c stable/10/contrib/byacc/test/quote_calc3-s.tab.h stable/10/contrib/byacc/test/quote_calc3.output stable/10/contrib/byacc/test/quote_calc3.tab.c stable/10/contrib/byacc/test/quote_calc3.tab.h stable/10/contrib/byacc/test/quote_calc4-s.output stable/10/contrib/byacc/test/quote_calc4-s.tab.c stable/10/contrib/byacc/test/quote_calc4-s.tab.h stable/10/contrib/byacc/test/quote_calc4.output stable/10/contrib/byacc/test/quote_calc4.tab.c stable/10/contrib/byacc/test/quote_calc4.tab.h Modified: stable/10/contrib/byacc/CHANGES stable/10/contrib/byacc/VERSION stable/10/contrib/byacc/aclocal.m4 stable/10/contrib/byacc/closure.c stable/10/contrib/byacc/config.guess stable/10/contrib/byacc/config.sub stable/10/contrib/byacc/config_h.in stable/10/contrib/byacc/configure stable/10/contrib/byacc/configure.in stable/10/contrib/byacc/defs.h stable/10/contrib/byacc/descrip.mms stable/10/contrib/byacc/error.c stable/10/contrib/byacc/graph.c stable/10/contrib/byacc/lalr.c stable/10/contrib/byacc/lr0.c stable/10/contrib/byacc/main.c stable/10/contrib/byacc/makefile.in stable/10/contrib/byacc/mkpar.c stable/10/contrib/byacc/output.c stable/10/contrib/byacc/package/byacc.spec stable/10/contrib/byacc/package/debian/changelog stable/10/contrib/byacc/package/pkgsrc/Makefile stable/10/contrib/byacc/reader.c stable/10/contrib/byacc/symtab.c stable/10/contrib/byacc/test/calc2.y stable/10/contrib/byacc/test/calc3.y stable/10/contrib/byacc/test/run_lint.sh stable/10/contrib/byacc/test/run_make.sh stable/10/contrib/byacc/test/run_test.sh stable/10/contrib/byacc/verbose.c stable/10/contrib/byacc/vmsbuild.com stable/10/contrib/byacc/yacc.1 stable/10/usr.bin/yacc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/byacc/CHANGES ============================================================================== --- stable/10/contrib/byacc/CHANGES Sun Jul 20 00:08:50 2014 (r268898) +++ stable/10/contrib/byacc/CHANGES Sun Jul 20 00:21:38 2014 (r268899) @@ -1,3 +1,767 @@ +2014-04-22 Thomas E. Dickey + + * mstring.c: + use vsnprintf() to ensure that msprintf's buffer is large enough. + + * main.c, defs.h: add mstring_leaks() + + * configure: regen + + * output.c: fix a complementary warning + + * mstring.c: introduce vsnprintf + + * configure.in, config_h.in: add check for vsnprintf + + * output.c: quiet a type-conversion warning + + * mstring.c: fix a potential memory leak on ENOMEM + quiet a couple of type-conversion warnings + + * defs.h: add/use GCC_PRINTFLIKE for msprintf() + +2014-04-22 Tom.Shields + + * README.BTYACC: + drop "NOTES-btyacc-Changes" and "NOTES-btyacc-Disposition", merging relevant + content into README.BTYACC + +2014-04-22 Thomas E. Dickey + + * package/pkgsrc/Makefile, VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec: + bump + +2014-04-19 Thomas E. Dickey + + * config.sub: 2014-04-03 + + * config.guess: 2014-03-23 + +2014-04-09 Rick.Spates + + * main.c, defs.h: patch to allow DEBUG build with WIN32 system + +2014-04-09 Thomas E. Dickey + + * output.c, reader.c: gcc warnings + + * reader.c: fix const-cast warnings + + * test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/code_error.tab.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/error.tab.c, test/btyacc/rename_debug.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.tab.c, output.c: + fix a few clang --analyze warnings; one was a case where output_ctable emitted + an empty table (which should be an error). + + * reader.c: appease clang --analyze + + * defs.h: mark two functions as no-return. + + * package/debian/changelog: reason for release + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + + * makefile.in: use $LINT_OPTS from environment via configure script + + * test/btyacc/ok_syntax1.output, test/btyacc/ok_syntax1.tab.c, test/yacc/ok_syntax1.tab.c, test/ok_syntax1.y, test/yacc/ok_syntax1.output: + tweaks to make generated files from ok_syntax1.y compile with check_make rule + + * test/btyacc/rename_debug.c, test/btyacc/rename_debug.error, test/btyacc/rename_debug.h, test/btyacc/rename_debug.i, test/btyacc/rename_debug.output, test/yacc/rename_debug.c: + reference output for testing + + * test/run_test.sh: + retain the renaming done for code_debug.y so that check_make will work. + + * test/yacc/rename_debug.error, test/yacc/rename_debug.h, test/yacc/rename_debug.i, test/yacc/rename_debug.output: + reference output for testing + + * test/btyacc/ok_syntax1.error: RCS_BASE + + * test/yacc/quote_calc4-s.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/ok_syntax1.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, yaccpar.c: + regen + + * yacc.1: + clarify relationship of btyacc features to default configuration. + +2014-04-08 Thomas E. Dickey + + * test/yacc/ok_syntax1.output, test/yacc/ok_syntax1.tab.c, test/yacc/ok_syntax1.tab.h, test/btyacc/ok_syntax1.output, test/btyacc/ok_syntax1.tab.c, test/btyacc/ok_syntax1.tab.h: + reference output for testing + + * test/ok_syntax1.y: RCS_BASE + + * test/yacc/ok_syntax1.error: reference output for testing + + * test/yacc/big_b.error, test/yacc/big_b.output, test/yacc/big_l.error, test/yacc/big_l.output, test/btyacc/big_b.error, test/btyacc/big_b.output, test/btyacc/big_l.error, test/btyacc/big_l.output, test/run_test.sh: + exercise -L/-B options + + * test/yacc/code_debug.c, test/btyacc/code_debug.c, test/yacc/err_syntax15.tab.c, test/yacc/err_syntax16.tab.c, test/yacc/err_syntax17.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax19.tab.c, test/yacc/err_syntax2.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/err_syntax21.tab.c, test/yacc/err_syntax22.tab.c, test/yacc/err_syntax23.tab.c, test/yacc/err_syntax24.tab.c, test/yacc/err_syntax25.tab.c, test/yacc/err_syntax26.tab.c, test/yacc/err_syntax27.tab.c, test/yacc/err_syntax3.tab.c, test/yacc/err_syntax4.tab.c, test/yacc/err_syntax5.tab.c, test/yacc/err_syntax6.tab.c, test/yacc/err_syntax7.tab.c, test/yacc/err_syntax7a.tab.c, test/yacc/err_syntax7b.tab.c, test/yacc/err_syntax8.tab.c, test/yacc/err_syntax8a.tab.c, test/yacc/err_syntax9.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/q uote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax1.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax13.tab.c, test/yacc/err_syntax14.tab.c, test/btyacc/err_syntax13.tab.c, test/btyacc/err_syntax14.tab.c, test/btyacc/err_syntax15.tab.c, test/btyacc/err_syntax16.tab.c, test/btyacc/err_syntax17.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax19.tab.c, test/btyacc/err_syntax2.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/err_syntax21.tab.c, test/btyacc/err_syntax22.tab.c, test/btyacc/err_syntax23.tab.c, test/btyacc/err_syntax24.tab.c, test/btyacc/err_syntax25.tab.c, test/btyacc/err_syntax26.tab.c, test/btyacc/err_syntax27.t ab.c, test/btyacc/err_syntax3.tab.c, test/bt! yacc/err_syntax4.tab.c, test/btyacc/err_syntax5.tab.c, test/btyacc/err_syntax6.tab.c, test/btyacc/err_syntax7.tab.c, test/btyacc/err_syntax7a.tab.c, test/btyacc/err_syntax7b.tab.c, test/btyacc/err_syntax8.tab.c, test/btyacc/err_syntax8a.tab.c, test/btyacc/err_syntax9.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit1.tab.c, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_inherit5.tab.c, test/btyacc/err_syntax1.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.t ab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/run_test.sh, test/yacc/no_b_opt1.output: + use a better renaming of the YYPATCH definition (none of the test-cases rely + upon it, but redefinition in the "make check_make" rule is a problem). + + * test/btyacc/err_syntax1.tab.c, test/btyacc/err_syntax13.tab.c, test/btyacc/err_syntax2.tab.c, test/btyacc/err_syntax25.tab.c, test/btyacc/err_syntax26.tab.c, test/btyacc/err_syntax27.tab.c, test/btyacc/err_syntax3.tab.c, test/btyacc/err_syntax4.tab.c, test/btyacc/err_syntax5.tab.c, test/btyacc/err_syntax6.tab.c, test/btyacc/err_syntax7.tab.c, test/btyacc/err_syntax7a.tab.c, test/btyacc/err_syntax7b.tab.c, test/btyacc/err_syntax8.tab.c, test/btyacc/err_syntax8a.tab.c, test/btyacc/err_syntax9.tab.c, test/btyacc/varsyntax_calc1.tab.c: + undid temporary reordering in reader() by Tom Shields to align with byacc outputs + + * test/run_test.sh: remove a repeated test-case + + * mstring.c: minor reformatting to make coverage analysis simpler + +2014-04-07 Thomas E. Dickey + + * test/run_test.sh: tidy + + * test/yacc/help.error, test/yacc/help.output, test/yacc/no_b_opt.error, test/yacc/no_b_opt.output, test/yacc/no_b_opt1.error, test/yacc/no_b_opt1.output, test/yacc/no_code_c.error, test/yacc/no_code_c.output, test/yacc/no_defines.error, test/yacc/no_defines.output, test/yacc/no_graph.error, test/yacc/no_graph.output, test/yacc/no_include.error, test/yacc/no_include.output, test/yacc/no_opts.error, test/yacc/no_opts.output, test/yacc/no_output.error, test/yacc/no_output.output, test/yacc/no_output1.error, test/yacc/no_output1.output, test/yacc/no_output2.error, test/yacc/no_output2.output, test/yacc/no_p_opt.error, test/yacc/no_p_opt.output, test/yacc/no_p_opt1.error, test/yacc/no_p_opt1.output, test/yacc/no_verbose.error, test/yacc/no_verbose.output, test/yacc/nostdin.error, test/yacc/nostdin.output, test/yacc/test-no_b_opt1.output: + reference output for testing + + * test/run_test.sh: + add special checks for flags which depend on writable/existing files + + * test/btyacc/no_b_opt1.output, test/btyacc/no_p_opt1.output, test/btyacc/no_b_opt.error, test/btyacc/no_b_opt.output, test/btyacc/no_b_opt1.error, test/btyacc/no_code_c.output, test/btyacc/no_p_opt.error, test/btyacc/no_p_opt.output, test/btyacc/no_p_opt1.error, test/btyacc/no_output2.output, test/btyacc/no_code_c.error, test/btyacc/no_output2.error, test/btyacc/no_include.error, test/btyacc/no_include.output, test/btyacc/no_defines.output, test/btyacc/no_defines.error, test/btyacc/no_verbose.output, test/btyacc/no_graph.output, test/btyacc/no_graph.error, test/btyacc/no_opts.error, test/btyacc/no_opts.output, test/btyacc/no_verbose.error, test/btyacc/nostdin.error, test/btyacc/nostdin.output, test/btyacc/no_output.error, test/btyacc/no_output.output, test/btyacc/no_output1.error, test/btyacc/no_output1.output: + reference output for testing + + * main.c: + change CREATE_FILE_NAMES() to use local function rather than inline code, + to simplify coverage analysis. + + * test/btyacc/err_syntax27.error, test/btyacc/err_syntax27.output, test/btyacc/err_syntax27.tab.c, test/btyacc/err_syntax27.tab.h, test/btyacc/help.error, test/btyacc/help.output, test/yacc/err_syntax27.error, test/yacc/err_syntax27.output, test/yacc/err_syntax27.tab.c, test/yacc/err_syntax27.tab.h: + reference output for testing + + * test/err_syntax27.y: testcase for missing_brace() + + * error.c: ifdef'd non-btyacc function + + * lr0.c: ifdef'd debug-code + + * yaccpar.skel: use YYINT's to replace short's as in btyaccpar.skel + + * test/btyacc/code_debug.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax14.tab.c, test/btyacc/err_syntax15.tab.c, test/btyacc/err_syntax16.tab.c, test/btyacc/err_syntax17.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax19.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/err_syntax21.tab.c, test/btyacc/err_syntax22.tab.c, test/btyacc/err_syntax23.tab.c, test/btyacc/err_syntax24.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/calc.tab.c, test/btyacc/c alc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit1.tab.c, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_inherit5.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/co de_debug.c, test/yacc/code_error.code.c, tes! t/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, output.c, test/yacc/err_syntax1.tab.c, test/yacc/err_syntax13.tab.c, test/yacc/err_syntax14.tab.c, test/yacc/err_syntax15.tab.c, test/yacc/err_syntax16.tab.c, test/yacc/err_syntax17.tab.c, test/yacc/err_syntax19.tab.c, test/yacc/err_syntax2.tab.c, test/yacc/err_syntax21.tab.c, test/yacc/err_syntax22.tab.c, test/yacc/err_syntax23.tab.c, test/yacc/err_syntax24.tab.c, test/yacc/err_syntax25.tab.c, test/yacc/err_syntax26.tab.c, test/yacc/err_syntax3.tab.c, test/yacc/err_syntax4.tab.c, test/yacc/err_syntax5.tab.c, test/yacc/err_syntax6.tab.c, test/yacc/err_syntax7.tab.c, test/yacc/err_syntax7a.tab.c, test/yacc/err_syntax7b.tab.c, test/yacc/err_syntax8.tab.c, test/yacc/err_syntax8a.tab.c, test/yacc/err_syntax9.tab.c, test/run_test.sh: + 2010/11/26 simplification of output.c using putc_code() and putl_code() + omitted an adjustment of the #line value used for code-file. Fix that. + Also, amend 2005/05/04 change to run_test.sh to retain a dummy line for + YYPATCH #define's to make test-outputs easier to compare #line's (report + by Tom Shields) + +2014-04-06 Thomas E. Dickey + + * reader.c: fix for valgrind + (the calloc's are intentional - valgrind reported use of uninitialized memory) + + * lr0.c, output.c: fix for valgrind + + * test/btyacc/code_debug.c, test/btyacc/code_debug.error, test/btyacc/code_debug.h, test/btyacc/code_debug.i, test/btyacc/code_debug.output: + RCS_BASE + + * test/yacc/code_debug.c, test/yacc/code_debug.h: + exercise the -i option + + * test/yacc/code_debug.i: reference output for testing + + * test/run_test.sh: exercise the -i option + + * test/yacc/code_debug.c: reference output for testing + + * test/run_test.sh: exercise the "-o" option + + * test/yacc/code_debug.error, test/yacc/code_debug.h, test/yacc/code_debug.output: + reference output for testing + + * output.c: don't call exit() without giving a chance to cleanup. + + * mstring.c: ifdef'd functions not used in byacc + + * btyaccpar.c: generated from btyaccpar.skel + + * yaccpar.c: generated from yaccpar.skel + + * skel2c: + change the generated-by comment to show which version of this script (and + which version of the given skeleton file) were used to produce the C-file. + + * configure: regen + + * makefile.in: + add rules to generate byacc and btyacc parser skeleton files independently + + * aclocal.m4: CF_PROG_AWK - add to byacc's configure script + CF_INTEL_COMPILER + cleanup the -no-gcc option which was leftover from testing - prcs does + not build with this option. + CF_MAKE_DOCS + protect $2 from substitution, for luit's "$(manext)" + CF_XOPEN_SOURCE + for Solaris (tested with gcc/g++ 3.4.3 on Solaris 10 and gcc/g++ 4.5.2 + on Solaris 11), suppress the followup check for defining _XOPEN_SOURCE + because it is not needed, as well as because g++ 4.7.3 (no package, + used in Sage for Solaris 10) has some unspecified header breakage which + is triggered by the duplicate definition. + + * configure.in: + modify so skeleton-source is determined by configure options rather than by + having developer rename yaccpar.skel.old to yaccpar.skel + + * descrip.mms: rename skeleton + + * vmsbuild.com: + fwiw, renamed the skeleton for consistency with makefile + + * skel2c, skeleton.c: resync skeleton and its generating files + + * yaccpar.skel: + renamed yaccpar.skel.old to yaccpar.skel, to allow using makefile suffix rules + + * yaccpar.skel.old: resync skeleton and its generating files + + * test/run_make.sh: improve cleanup after error recovery + + * test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, output.c, skeleton.c, defs.h: + use improvement from Tom Shield's btyacc changes, getting rid of special cases for generating two yyerror calls in skeleton + + * output.c: simplify output_yyerror_decl() + + * test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.tab.c, test/yacc/code_error.tab.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, output.c: + add second "const" to string-table declarations, from Tom Shield's btyacc changes + + * test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c: + discard unnecessary call on write_code_lineno() from Tom Shield's changes + + * test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_calc.tab.c, test/yacc/code_error.code.c, test/yacc/code_error.tab.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax20.tab.c, output.c: + use YYINT typedef from Tom Shield's btyacc changes to replace explicit "short" + + * test/yacc/code_calc.code.c, test/yacc/code_error.code.c, output.c: + use fix from Tom Shield's btyacc changes: remove redundant extern-declaration for YYPARSE_DECL() + + * test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c: + discard unnecessary call on write_code_lineno() from Tom Shield's changes + + * output.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/code_calc.tab.c, test/yacc/code_error.tab.c: + use fix from Tom Shield's btyacc changes: prefix-definitions went to the + output (.tab.c) file in a case where they should have gone to the code + (.code.c) file. Remove now-redundant call to output_prefix(). + + * main.c: do the same for help-message + + * main.c: use OUTPUT_SUFFIX symbol in an overlooked case + + * test/run_make.sh: + modify to avoid use of VPATH, which has no standard implementation + +2014-04-05 Thomas E. Dickey + + * test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c: + discard a change which merged CountLines() with explicit comparisons against + code_file because that adds extra to the #line values + + * test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/calc.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/error.tab.c, output.c: + add Tom Shield's change to allow definition of YYSTYPE_IS_DECLARED symbol to + override fallback typedef for YYSTYPE when that symbol is undefined + + * test/btyacc/error.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c: + minor tweak to coding style - use parenthesis for "defined" operator's parameter + + * test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c: + regen to make YYMAXTOKEN and YYUNDFTOKEN adjacent + + * test/yacc/err_syntax20.tab.c, test/yacc/grammar.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_calc.tab.c, test/yacc/code_error.code.c, test/yacc/code_error.tab.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c: + regen after adding the YYUNDFTOKEN symbol + + * output.c: + integrate Tom Shield's btyacc changes which introduce the YYUNDFTOKEN symbol + (I changed order of output to keep this adjacent to YYMAXTOKEN) + + * reader.c: + merge all but one small change from Tom Shield's btyacc changes - that + changes the order of code-file in the tests. + + * test/btyacc/btyacc_demo.tab.c: regen + + * test/btyacc_demo.y: fix prototypes + +2014-04-04 Thomas E. Dickey + + * reader.c, defs.h, main.c: + more merging of Tom Shield's btyacc changes. In the merge, I moved the + symbol_pval inside the btyacc ifdef's and added some more btyacc ifdefs + +2014-04-03 Thomas E. Dickey + + * reader.c: + merge-in 3/4 of btyacc's changes, deferring those which change test-outputs. + Tom Shield's changes split-out copy_string() and copy_comment() functions + to simplify some logic, as well as adding btyacc-only chunks + + * makefile.in: build mstring.o, needed for changes in reader.c + + * output.c: + merge-in all of btyacc's changes which do not change byacc's test-output. + Some of the merge uses ifdef-changes which I applied to ongoing resync, + e.g., the introduction of PER_STATE. + +2014-04-02 Thomas E. Dickey + + * test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c: regen + + * output.c: fix typo + + * output.c, reader.c: + merge in some chunks of reader and output files which do not affect byacc tests + + * test/yacc/calc2.tab.c, test/yacc/calc3.tab.c: regen + + * test/yacc/err_syntax6.tab.c, test/yacc/err_syntax7.tab.c, test/yacc/err_syntax7a.tab.c, test/yacc/err_syntax7b.tab.c, test/yacc/err_syntax8.tab.c, test/yacc/err_syntax8a.tab.c, test/yacc/err_syntax9.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax1.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax13.tab.c, test/yacc/err_syntax14.tab.c, test/yacc/err_syntax15.tab.c, test/yacc/err_syntax16.tab.c, test /yacc/err_syntax17.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax19.tab.c, test/yacc/err_syntax2.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/err_syntax21.tab.c, test/yacc/err_syntax22.tab.c, test/yacc/err_syntax23.tab.c, test/yacc/err_syntax24.tab.c, test/yacc/err_syntax25.tab.c, test/yacc/err_syntax26.tab.c, test/yacc/err_syntax3.tab.c, test/yacc/err_syntax4.tab.c, test/yacc/err_syntax5.tab.c, skeleton.c: + incorporate YYENOMEM and YYEOF symbols from btyacc + + * output.c: merge chunk from btyacc changes for header-guards + + * btyaccpar.skel: RCS_BASE + + * yaccpar.skel: comment-out yysccsid[], for FreeBSD build-issues + remove GCC_UNUSED to reduce name-pollution as well as being simpler + + * main.c: + move a btyacc symbol outside ifdef to work around current state of merge + + * defs.h: + add USE_HEADER_GUARDS to defer whether to modify byacc's header-output + + * test/run_make.sh: + do not try to compile files used for testing syntax-errors, since they are + likely to be incomplete + +2014-04-02 Tom.Shields + + * main.c: changes for btyacc + +2014-04-01 Thomas E. Dickey + + * reader.c: + integrate change by Tom Shields to use bsearch rather than successive + calls to matchec() + + * defs.h: typedef __compar_fn_t is unnecessary + + * test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c: + omit the GCC_UNUSED, as noted by Tom Shields not really essential + +2014-04-01 Tom.Shields + + * verbose.c: changes for btyacc, ifdef'd + +2014-04-01 Thomas E. Dickey + + * mkpar.c: eliminate most of the ifdef's using macros + +2014-04-01 Tom.Shields + + * mkpar.c: merge btyacc changes (ifdef'd - no change to byacc) + + * error.c: + new functions used for reporting errors from the btyacc configuration + (I reordered some, and ifdef'd the new ones -TD) + +2014-03-31 Thomas E. Dickey + + * test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c: + omit the GCC_UNUSED, as noted by Tom Shields not really essential + + * test/btyacc/empty.tab.c, test/btyacc/err_inherit1.tab.c, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_inherit5.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax14.tab.c, test/btyacc/err_syntax15.tab.c, test/btyacc/err_syntax16.tab.c, test/btyacc/err_syntax17.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax19.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/err_syntax21.tab.c, test/btyacc/err_syntax22.tab.c, test/btyacc/err_syntax23.tab.c, test/btyacc/err_syntax24.tab.c: + regen + +2014-03-29 Thomas E. Dickey + + * test/yacc/err_syntax22.tab.c, test/yacc/err_syntax23.tab.c, test/yacc/err_syntax24.tab.c, test/yacc/err_syntax25.tab.c, test/yacc/err_syntax26.tab.c, test/yacc/err_syntax3.tab.c, test/yacc/err_syntax4.tab.c, test/yacc/err_syntax5.tab.c, test/yacc/err_syntax6.tab.c, test/yacc/err_syntax7.tab.c, test/yacc/err_syntax7a.tab.c, test/yacc/err_syntax7b.tab.c, test/yacc/err_syntax8.tab.c, test/yacc/err_syntax8a.tab.c, test/yacc/err_syntax9.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/y acc/err_syntax1.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax13.tab.c, test/yacc/err_syntax14.tab.c, test/yacc/err_syntax15.tab.c, test/yacc/err_syntax16.tab.c, test/yacc/err_syntax17.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax19.tab.c, test/yacc/err_syntax2.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/err_syntax21.tab.c, skeleton.c: + comment-out yysccsid in the banner because it produces unnecessary compiler + warnings. The suggested alternative (using #pragma ident) in the preceding + comment is also obsolete; remove that comment (request by Gleb Smirnoff). + + * test/run_test.sh: + for yacc, ignore the inherit testcases, since they are btyacc-specific + +2014-03-28 Thomas E. Dickey + + * test/yacc/varsyntax_calc1.error, test/yacc/varsyntax_calc1.output, test/yacc/varsyntax_calc1.tab.c, test/yacc/varsyntax_calc1.tab.h, test/yacc/err_inherit3.error, test/yacc/err_inherit3.output, test/yacc/err_inherit3.tab.c, test/yacc/err_inherit3.tab.h, test/yacc/err_inherit4.error, test/yacc/err_inherit4.output, test/yacc/err_inherit4.tab.c, test/yacc/err_inherit4.tab.h, test/yacc/err_inherit5.error, test/yacc/err_inherit5.output, test/yacc/err_inherit5.tab.c, test/yacc/err_inherit5.tab.h, test/yacc/inherit0.error, test/yacc/inherit0.output, test/yacc/inherit0.tab.c, test/yacc/inherit0.tab.h, test/yacc/inherit1.error, test/yacc/inherit1.output, test/yacc/inherit1.tab.c, test/yacc/inherit1.tab.h, test/yacc/inherit2.error, test/yacc/inherit2.output, test/yacc/inherit2.tab.c, test/yacc/inherit2.tab.h, test/yacc/empty.error, test/yacc/empty.output, test/yacc/empty.tab.c, test/yacc/empty.tab.h, test/yacc/err_inherit1.error, test/yacc/err_inherit1.output, test/yacc/err_inherit1.tab.c, test/yacc/err_inherit1.tab.h, test/yacc/err_inherit2.error, test/yacc/err_inherit2.output, test/yacc/err_inherit2.tab.c, test/yacc/err_inherit2.tab.h: + reference output for testing + + * test/run_lint.sh, test/run_make.sh, test/run_test.sh: + moving #define's out of makefile broke check for yacc vs btyacc (fix) + +2014-03-28 Tom.Shields + + * test/btyacc/btyacc_demo.tab.c, test/btyacc/err_inherit3.error, test/btyacc/err_inherit3.output, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit3.tab.h, test/btyacc/err_inherit2.error, test/btyacc/err_inherit2.output, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit2.tab.h, test/btyacc/err_inherit4.error, test/btyacc/err_inherit4.output, test/btyacc/err_inherit4.tab.c, test/btyacc/err_inherit4.tab.h, test/btyacc/err_inherit5.error, test/btyacc/err_inherit5.output, test/btyacc/err_inherit5.tab.c, test/btyacc/err_inherit5.tab.h, test/btyacc/inherit0.error, test/btyacc/inherit0.output, test/btyacc/inherit0.tab.c, test/btyacc/inherit0.tab.h, test/btyacc/inherit1.error, test/btyacc/inherit1.output, test/btyacc/inherit1.tab.c, test/btyacc/inherit1.tab.h, test/btyacc/inherit2.error, test/btyacc/inherit2.output, test/btyacc/inherit2.tab.c, test/btyacc/inherit2.tab.h, test/btyacc/calc.error, test/btyacc/err_inherit1.error, test/btyacc/err_inherit1.output, test/btyacc/err_inh erit1.tab.c, test/btyacc/err_inherit1.tab.h: + reference output for testing + + * defs.h: new functions/variables for btyacc + (I reordered and ifdef'd -TD) + + * test/inherit0.y, test/inherit1.y: testcase for btyacc + +2014-03-27 Tom.Shields + + * test/err_inherit5.y, test/err_inherit4.y, test/err_inherit3.y, test/err_inherit2.y, test/err_inherit1.y, test/inherit2.y: + testcase for btyacc + +2014-03-25 Tom.Shields + + * symtab.c: extra initialization needed for btyacc + (I ifdef'd -TD) + + * yacc.1: document -L/-B features from btyacc + +2014-03-25 Thomas E. Dickey + + * yacc.1: typo + + * configure: regen + + * configure.in: + modified new options to act like those in my other configure-scripts, e.g., + showing what option is being tested, and the resulting value. Put the + definitions in config.h rather than in the makefile. + +2014-03-25 Tom.Shields + + * makefile.in: add/use LINTFLAGS variable + make all of the objects (not just skeleton) rebuild if makefile changes + modify check-rule to reflect updates to run_test.sh vs subdirectory + + * mstring.c: byacc-btyacc-20140323 + +2014-03-25 Thomas E. Dickey + + * test/btyacc/RCS, test/yacc/RCS: PERMIT FILE + + * config_h.in: updated with autoheader-252 + +2014-03-25 Tom.Shields + + * README.BTYACC: byacc-btyacc-20140323 + +2014-03-24 Tom.Shields + + * test/btyacc/err_syntax1.output, test/btyacc/err_syntax1.tab.c, test/btyacc/err_syntax1.tab.h, test/btyacc/err_syntax10.error, test/btyacc/err_syntax10.output, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax10.tab.h, test/btyacc/err_syntax11.error, test/btyacc/err_syntax11.output, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax11.tab.h, test/btyacc/err_syntax12.error, test/btyacc/err_syntax12.output, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax12.tab.h, test/btyacc/err_syntax13.error, test/btyacc/err_syntax13.output, test/btyacc/err_syntax13.tab.c, test/btyacc/err_syntax13.tab.h, test/btyacc/err_syntax14.error, test/btyacc/err_syntax14.output, test/btyacc/err_syntax14.tab.c, test/btyacc/err_syntax14.tab.h, test/btyacc/err_syntax15.error, test/btyacc/err_syntax15.output, test/btyacc/err_syntax15.tab.c, test/btyacc/err_syntax15.tab.h, test/btyacc/err_syntax16.error, test/btyacc/err_syntax16.output, test/btyacc/err_syntax16.tab.c, test/btyacc/err_syntax16.tab. h, test/btyacc/err_syntax17.error, test/btyacc/err_syntax17.output, test/btyacc/err_syntax17.tab.c, test/btyacc/err_syntax17.tab.h, test/btyacc/err_syntax18.error, test/btyacc/err_syntax18.output, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax18.tab.h, test/btyacc/err_syntax19.error, test/btyacc/err_syntax19.output, test/btyacc/err_syntax19.tab.c, test/btyacc/err_syntax19.tab.h, test/btyacc/err_syntax2.output, test/btyacc/err_syntax2.tab.c, test/btyacc/err_syntax2.tab.h, test/btyacc/err_syntax20.error, test/btyacc/err_syntax20.output, test/btyacc/err_syntax20.tab.c, test/btyacc/err_syntax20.tab.h, test/btyacc/err_syntax21.error, test/btyacc/err_syntax21.output, test/btyacc/err_syntax21.tab.c, test/btyacc/err_syntax21.tab.h, test/btyacc/err_syntax22.error, test/btyacc/err_syntax22.output, test/btyacc/err_syntax22.tab.c, test/btyacc/err_syntax22.tab.h, test/btyacc/err_syntax23.error, test/btyacc/err_syntax23.output, test/btyacc/err_syntax23.tab.c, test/btyacc/err_syntax23.tab. h, test/btyacc/err_syntax24.error, test/btya! cc/err_syntax24.output, test/btyacc/err_syntax24.tab.c, test/btyacc/err_syntax24.tab.h, test/btyacc/err_syntax25.error, test/btyacc/err_syntax25.output, test/btyacc/err_syntax25.tab.c, test/btyacc/err_syntax25.tab.h, test/btyacc/err_syntax26.error, test/btyacc/err_syntax26.output, test/btyacc/err_syntax26.tab.c, test/btyacc/err_syntax26.tab.h, test/btyacc/err_syntax3.output, test/btyacc/err_syntax3.tab.c, test/btyacc/err_syntax3.tab.h, test/btyacc/err_syntax4.output, test/btyacc/err_syntax4.tab.c, test/btyacc/err_syntax4.tab.h, test/btyacc/err_syntax5.output, test/btyacc/err_syntax5.tab.c, test/btyacc/err_syntax5.tab.h, test/btyacc/err_syntax6.output, test/btyacc/err_syntax6.tab.c, test/btyacc/err_syntax6.tab.h, test/btyacc/err_syntax7.output, test/btyacc/err_syntax7.tab.c, test/btyacc/err_syntax7.tab.h, test/btyacc/err_syntax7a.output, test/btyacc/err_syntax7a.tab.c, test/btyacc/err_syntax7a.tab.h, test/btyacc/err_syntax7b.output, test/btyacc/err_syntax7b.tab.c, test/btyacc/err_syn tax7b.tab.h, test/btyacc/err_syntax8.output, test/btyacc/err_syntax8.tab.c, test/btyacc/err_syntax8.tab.h, test/btyacc/err_syntax8a.output, test/btyacc/err_syntax8a.tab.c, test/btyacc/err_syntax8a.tab.h, test/btyacc/err_syntax9.output, test/btyacc/err_syntax9.tab.c, test/btyacc/err_syntax9.tab.h: + reference output for testing + +2014-03-24 Thomas E. Dickey + + * defs.h: fix compiler warnings due to mputc() + +2014-03-23 Tom.Shields + + * test/btyacc_demo.y: testcase for btyacc + + * test/btyacc/varsyntax_calc1.error, test/btyacc/varsyntax_calc1.output, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/varsyntax_calc1.tab.h: + reference output for testing + + * test/varsyntax_calc1.y, test/btyacc_calc1.y: testcase for btyacc + +2014-03-23 Thomas E. Dickey + + * test/err_syntax26.error, test/err_syntax26.output, test/err_syntax26.tab.c, test/err_syntax26.tab.h, test/yacc/err_syntax26.error, test/yacc/err_syntax26.output, test/yacc/err_syntax26.tab.c, test/yacc/err_syntax26.tab.h: + reference output for testing + + * test/err_syntax26.y: testcase for missing_brace() + + * test/err_syntax25.error, test/err_syntax25.output, test/err_syntax25.tab.c, test/err_syntax25.tab.h, test/yacc/err_syntax25.error, test/yacc/err_syntax25.output, test/yacc/err_syntax25.tab.c, test/yacc/err_syntax25.tab.h: + reference output for testing + + * test/err_syntax25.y: testcase for over_unionized() + + * test/err_syntax24.error, test/err_syntax24.output, test/err_syntax24.tab.c, test/err_syntax24.tab.h, test/yacc/err_syntax24.error, test/yacc/err_syntax24.output, test/yacc/err_syntax24.tab.c, test/yacc/err_syntax24.tab.h: + reference output for testing + + * test/err_syntax24.y: testcase for default_action_warning() + +2014-03-23 Tom.Shields + + * test/btyacc/quote_calc3-s.error, test/btyacc/quote_calc4-s.error, test/btyacc/quote_calc4.error, test/btyacc/grammar.dot, test/btyacc/grammar.error, test/btyacc/pure_calc.error, test/btyacc/pure_error.error, test/btyacc/quote_calc-s.error, test/btyacc/quote_calc.error, test/btyacc/quote_calc2-s.error, test/btyacc/quote_calc2.error, test/btyacc/quote_calc3.error, test/btyacc/err_syntax2.error, test/btyacc/err_syntax3.error, test/btyacc/err_syntax4.error, test/btyacc/err_syntax5.error, test/btyacc/err_syntax6.error, test/btyacc/err_syntax7.error, test/btyacc/err_syntax7a.error, test/btyacc/err_syntax7b.error, test/btyacc/err_syntax8.error, test/btyacc/err_syntax8a.error, test/btyacc/err_syntax9.error, test/btyacc/error.error, test/btyacc/calc1.error, test/btyacc/calc2.error, test/btyacc/calc3.error, test/btyacc/code_calc.error, test/btyacc/code_error.error, test/btyacc/empty.error, test/btyacc/err_syntax1.error, test/btyacc/btyacc_calc1.error, test/btyacc/btyacc_demo.error: + reference output for testing + +2014-03-23 Thomas E. Dickey + + * test/err_syntax23.error, test/err_syntax23.output, test/err_syntax23.tab.c, test/err_syntax23.tab.h, test/yacc/err_syntax23.error, test/yacc/err_syntax23.output, test/yacc/err_syntax23.tab.c, test/yacc/err_syntax23.tab.h: + reference output for testing + + * test/err_syntax23.y: testcase for untyped_lhs() + +2014-03-23 Tom.Shields + + * test/run_test.sh: + move test-outputs into subdirectories to keep btyacc/yacc results separate + +2014-03-23 Thomas E. Dickey + + * test/err_syntax22.error, test/err_syntax22.output, test/err_syntax22.tab.c, test/err_syntax22.tab.h, test/yacc/err_syntax22.error, test/yacc/err_syntax22.output, test/yacc/err_syntax22.tab.c, test/yacc/err_syntax22.tab.h: + reference output for testing + + * test/err_syntax22.y: testcase for untyped_rhs() + + * test/err_syntax21.error, test/err_syntax21.output, test/err_syntax21.tab.c, test/err_syntax21.tab.h, test/yacc/err_syntax21.error, test/yacc/err_syntax21.output, test/yacc/err_syntax21.tab.c, test/yacc/err_syntax21.tab.h, test/err_syntax20.error, test/err_syntax20.output, test/err_syntax20.tab.c, test/err_syntax20.tab.h, test/yacc/err_syntax20.error, test/yacc/err_syntax20.output, test/yacc/err_syntax20.tab.c, test/yacc/err_syntax20.tab.h: + reference output for testing + + * test/err_syntax20.y: testcase for undefined_symbol_warning() + + * test/err_syntax21.y: testcase for unknown_rhs() + + * test/err_syntax19.error, test/err_syntax19.output, test/err_syntax19.tab.c, test/err_syntax19.tab.h, test/yacc/err_syntax19.error, test/yacc/err_syntax19.output, test/yacc/err_syntax19.tab.c, test/yacc/err_syntax19.tab.h: + reference output for testing + + * test/err_syntax19.y: testcase for dollar_error() + + * test/err_syntax18.error, test/err_syntax18.output, test/err_syntax18.tab.c, test/err_syntax18.tab.h, test/yacc/err_syntax18.error, test/yacc/err_syntax18.output, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax18.tab.h: + reference output for testing + + * test/err_syntax18.y: testcase for dollar_warning() + + * test/err_syntax17.error, test/err_syntax17.output, test/err_syntax17.tab.c, test/err_syntax17.tab.h, test/yacc/err_syntax17.error, test/yacc/err_syntax17.output, test/yacc/err_syntax17.tab.c, test/yacc/err_syntax17.tab.h: + reference output for testing + + * test/err_syntax17.y: testcase for unterminated_action() + +2014-03-22 Thomas E. Dickey + + * test/err_syntax16.error, test/err_syntax16.output, test/err_syntax16.tab.c, test/err_syntax16.tab.h, test/yacc/err_syntax16.error, test/yacc/err_syntax16.output, test/yacc/err_syntax16.tab.c, test/yacc/err_syntax16.tab.h: + reference output for testing + + * test/err_syntax16.y: testcase for terminal_lhs() + + * test/err_syntax15.error, test/err_syntax15.output, test/err_syntax15.tab.c, test/err_syntax15.tab.h, test/yacc/err_syntax15.error, test/yacc/err_syntax15.output, test/yacc/err_syntax15.tab.c, test/yacc/err_syntax15.tab.h: + reference output for testing + + * test/err_syntax15.y: testcase for no_grammar() + + * test/err_syntax14.error, test/err_syntax14.output, test/err_syntax14.tab.c, test/err_syntax14.tab.h, test/yacc/err_syntax14.error, test/yacc/err_syntax14.output, test/yacc/err_syntax14.tab.c, test/yacc/err_syntax14.tab.h: + reference output for testing + + * test/err_syntax14.y: + testcase for restarted_warning() and undefined_goal() + + * test/err_syntax13.error, test/err_syntax13.output, test/err_syntax13.tab.c, test/err_syntax13.tab.h, test/yacc/err_syntax13.error, test/yacc/err_syntax13.output, test/yacc/err_syntax13.tab.c, test/yacc/err_syntax13.tab.h: + reference output for testing + + * test/err_syntax13.y: testcase for terminal_start() + + * test/err_syntax12.error, test/err_syntax12.output, test/err_syntax12.tab.c, test/err_syntax12.tab.h, test/yacc/err_syntax12.error, test/yacc/err_syntax12.output, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax12.tab.h: + reference output for testing + + * test/err_syntax12.y: testcase for revalued_warning() + + * test/err_syntax11.error, test/err_syntax11.output, test/err_syntax11.tab.c, test/err_syntax11.tab.h, test/yacc/err_syntax11.error, test/yacc/err_syntax11.output, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax11.tab.h: + reference output for testing + + * test/err_syntax11.y: testcase for reprec_warning() + + * test/err_syntax10.error, test/err_syntax10.output, test/err_syntax10.tab.c, test/err_syntax10.tab.h, test/yacc/err_syntax10.error, test/yacc/err_syntax10.output, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax10.tab.h: + reference output for testing + + * test/err_syntax10.y: testcase for retyped_warning() + +2014-03-21 Thomas E. Dickey + + * test/err_syntax9.error, test/err_syntax9.output, test/err_syntax9.tab.c, test/err_syntax9.tab.h, test/yacc/err_syntax9.error, test/yacc/err_syntax9.output, test/yacc/err_syntax9.tab.c, test/yacc/err_syntax9.tab.h: + reference output for testing + + * test/err_syntax9.y: testcase for tokenized_start() + + * test/err_syntax8.error, test/err_syntax8.output, test/err_syntax8.tab.c, test/err_syntax8.tab.h, test/err_syntax8a.error, test/err_syntax8a.output, test/err_syntax8a.tab.c, test/err_syntax8a.tab.h, test/yacc/err_syntax8.error, test/yacc/err_syntax8.output, test/yacc/err_syntax8.tab.c, test/yacc/err_syntax8.tab.h, test/yacc/err_syntax8a.error, test/yacc/err_syntax8a.output, test/yacc/err_syntax8a.tab.c, test/yacc/err_syntax8a.tab.h: + reference output for testing + + * test/err_syntax8a.y, test/err_syntax8.y: testcase for used_reserved() + + * test/err_syntax7.error, test/err_syntax7.output, test/err_syntax7.tab.c, test/err_syntax7.tab.h, test/err_syntax7a.error, test/err_syntax7a.output, test/err_syntax7a.tab.c, test/err_syntax7a.tab.h, test/err_syntax7b.error, test/err_syntax7b.output, test/err_syntax7b.tab.c, test/err_syntax7b.tab.h, test/yacc/err_syntax7.error, test/yacc/err_syntax7.output, test/yacc/err_syntax7.tab.c, test/yacc/err_syntax7.tab.h, test/yacc/err_syntax7a.error, test/yacc/err_syntax7a.output, test/yacc/err_syntax7a.tab.c, test/yacc/err_syntax7a.tab.h, test/yacc/err_syntax7b.error, test/yacc/err_syntax7b.output, test/yacc/err_syntax7b.tab.c, test/yacc/err_syntax7b.tab.h: + reference output for testing + + * test/err_syntax7b.y, test/err_syntax7a.y, test/err_syntax7.y: + testcase for illegal_character() + + * test/err_syntax6.error, test/err_syntax6.output, test/err_syntax6.tab.c, test/err_syntax6.tab.h, test/yacc/err_syntax6.error, test/yacc/err_syntax6.output, test/yacc/err_syntax6.tab.c, test/yacc/err_syntax6.tab.h: + reference output for testing + + * test/err_syntax6.y: testcase for illegal_tag() + + * test/err_syntax5.error, test/err_syntax5.output, test/err_syntax5.tab.c, test/err_syntax5.tab.h, test/yacc/err_syntax5.error, test/yacc/err_syntax5.output, test/yacc/err_syntax5.tab.c, test/yacc/err_syntax5.tab.h: + reference output for testing + + * test/err_syntax5.y: testcase for unterminated_union() + + * test/err_syntax4.error, test/err_syntax4.output, test/err_syntax4.tab.c, test/err_syntax4.tab.h, test/yacc/err_syntax4.error, test/yacc/err_syntax4.output, test/yacc/err_syntax4.tab.c, test/yacc/err_syntax4.tab.h: + reference output for testing + + * test/err_syntax4.y: testcase for unterminated_text() + + * test/err_syntax3.error, test/err_syntax3.output, test/err_syntax3.tab.c, test/err_syntax3.tab.h, test/yacc/err_syntax3.error, test/yacc/err_syntax3.output, test/yacc/err_syntax3.tab.c, test/yacc/err_syntax3.tab.h: + reference output for testing + + * test/err_syntax3.y: testcase for unterminated_string() + + * test/err_syntax2.error, test/err_syntax2.output, test/err_syntax2.tab.c, test/err_syntax2.tab.h, test/yacc/err_syntax2.error, test/yacc/err_syntax2.output, test/yacc/err_syntax2.tab.c, test/yacc/err_syntax2.tab.h: + reference output for testing + + * test/err_syntax2.y: testcase for unterminated_comment() + + * test/err_syntax1.error, test/yacc/err_syntax1.error: + reference output for testing + + * test/err_syntax1.y: + test-case with syntax error (and nonprinting character) + + * test/calc.error, test/calc1.error, test/calc2.error, test/calc3.error, test/code_calc.error, test/code_error.error, test/err_syntax1.error, test/error.error, test/grammar.error, test/pure_calc.error, test/pure_error.error, test/quote_calc-s.error, test/quote_calc.error, test/quote_calc2-s.error, test/quote_calc2.error, test/quote_calc3-s.error, test/quote_calc3.error, test/quote_calc4-s.error, test/quote_calc4.error, test/yacc/calc.error, test/yacc/calc1.error, test/yacc/calc2.error, test/yacc/calc3.error, test/yacc/code_calc.error, test/yacc/code_error.error, test/yacc/error.error, test/yacc/grammar.error, test/yacc/pure_calc.error, test/yacc/pure_error.error, test/yacc/quote_calc-s.error, test/yacc/quote_calc.error, test/yacc/quote_calc2-s.error, test/yacc/quote_calc2.error, test/yacc/quote_calc3-s.error, test/yacc/quote_calc3.error, test/yacc/quote_calc4-s.error, test/yacc/quote_calc4.error: + reference output for testing + + * test/run_test.sh: + save stderr to reference files, to capture shift/reduce messages as well + as syntax-error messages + + * test/err_syntax1.output, test/err_syntax1.tab.c, test/err_syntax1.tab.h, test/yacc/err_syntax1.output, test/yacc/err_syntax1.tab.c, test/yacc/err_syntax1.tab.h: + reference output for testing + + * test/run_test.sh: generate a ".dot" file for the grammar file + + * test/grammar.dot: RCS_BASE + + * test/yacc/grammar.dot: reference output for testing + +2014-03-19 Tom.Shields + + * output.c: rename MAXSHORT to MAXYYINT + +2014-03-18 Tom.Shields + + * yaccpar.skel: skeleton with btyacc additions + + * NOTES-btyacc-Changes: byacc-btyacc-20140323 + + * test/btyacc/btyacc_calc1.output, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_calc1.tab.h: + reference output for testing + + * test/run_make.sh: + move test-outputs into subdirectories to keep btyacc/yacc results separate + + * test/btyacc/pure_calc.tab.c, test/btyacc/pure_calc.tab.h, test/btyacc/pure_error.output, test/btyacc/pure_error.tab.c, test/btyacc/pure_error.tab.h, test/btyacc/quote_calc-s.output, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc-s.tab.h, test/btyacc/quote_calc.output, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc.tab.h, test/btyacc/quote_calc2-s.output, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2-s.tab.h, test/btyacc/quote_calc2.output, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc2.tab.h, test/btyacc/quote_calc3-s.output, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3-s.tab.h, test/btyacc/quote_calc3.output, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc3.tab.h, test/btyacc/quote_calc4-s.output, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4-s.tab.h, test/btyacc/quote_calc4.output, test/btyacc/quote_calc4.tab.c, test/btyacc/quote_calc4.tab.h, test/btyacc/calc1.output, test/btyacc/calc1.tab.c, test/btyacc/calc1.tab.h, test/btyacc/calc2.output, test/btyacc/calc2.tab.c, test/btyacc/calc2.tab.h, test/btyacc/calc3.output, test/btyacc/calc3.tab.c, test/btyacc/calc3.tab.h, test/btyacc/code_calc.code.c, test/btyacc/code_calc.output, test/btyacc/code_calc.tab.c, test/btyacc/code_calc.tab.h, test/btyacc/code_error.code.c, test/btyacc/code_error.output, test/btyacc/code_error.tab.c, test/btyacc/code_error.tab.h, test/btyacc/empty.output, test/btyacc/empty.tab.c, test/btyacc/empty.tab.h, test/btyacc/error.output, test/btyacc/error.tab.c, test/btyacc/error.tab.h, test/btyacc/grammar.output, test/btyacc/grammar.tab.c, test/btyacc/grammar.tab.h, test/btyacc/pure_calc.output, test/btyacc/btyacc_demo.output, test/btyacc/btyacc_demo.tab.h, test/btyacc/calc.output, test/btyacc/calc.tab.c, test/btyacc/calc.tab.h: + reference output for testing + + * defs.h: + several changes to help decouple the use of 'short' as the type of value + used in yacc parsers. + + * NOTES-btyacc-Disposition: byacc-btyacc-20140323 + +2014-03-17 Tom.Shields + + * skel2c, yaccpar.skel, yaccpar.skel.old: RCS_BASE + + * test/run_lint.sh: + move test-outputs into subdirectories to keep btyacc/yacc results separate + + * configure.in: add --with-max-table-size and --enable-btyacc options + +2014-03-16 Tom.Shields + + * main.c: use Value_t rather than short + +2014-03-11 Tom.Shields + + * test/empty.y: testcase for btyacc + +2014-03-10 Tom.Shields + + * test/calc3.y, test/calc2.y: fix unused-variable warning + +2014-02-18 Tom.Shields + + * lr0.c, graph.c: use Value_t rather than short + + * closure.c: use Value_t rather than short + ifdef'd forward-reference prototypes to match ifdef'ing of the actual functions + + * lalr.c: rename MAXSHORT to MAXYYINT + +2014-01-01 Thomas E. Dickey + + * yacc.1: document %token-table, improve presentation of double-quotes + + * VERSION, package/byacc.spec, package/debian/changelog: bump + + * test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_calc.tab.c, test/yacc/code_error.code.c, test/yacc/code_error.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c: + reference output for testing + + * test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_calc.tab.c, test/code_error.code.c, test/code_error.tab.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/quote_calc-s.tab.c, test/quote_calc.tab.c, test/quote_calc2-s.tab.c, test/quote_calc2.tab.c, test/quote_calc3-s.tab.c, test/quote_calc3.tab.c, test/quote_calc4-s.tab.c, test/quote_calc4.tab.c: + regen + + * output.c, skeleton.c: + amend the last change so that yytname is #define'd as needed rather than + permanent - to avoid breaking cproto for instance. + +2014-01-01 Christos.Zoulas + + * output.c, defs.h, main.c, reader.c, skeleton.c: + changes to build ntpd using byacc: + - rename yyname[] to yytname[] + - add YYTRANSLATE() macro + - recognize bison's %token-table declaration + +2014-01-01 Thomas E. Dickey + + * configure: regen + + * yacc.1: s/EE/XE/ to work around groff bug on Debian 6 + + * makefile.in: use CF_MAKE_DOCS + + * aclocal.m4: add CF_MAKE_DOCS + + * configure.in: use CF_MAKE_DOCS + +2013-12-26 Thomas E. Dickey + + * config.guess: 2013-11-29 + +2013-11-19 Thomas E. Dickey + + * aclocal.m4: resync with my-autoconf (fixes for clang and mingw) + +2013-10-25 Thomas E. Dickey + + * config.sub: 2013-10-01 + +2013-09-25 Thomas E. Dickey + + * reader.c: fix two loop-limits found by clang 3.3 --analyze + + * configure: regen + + * aclocal.m4: + tweaks to CF_MIXEDCASE_FILENAMES and CF_XOPEN_SOURCE for msys from ncurses + + * package/mingw-byacc.spec: RCS_BASE + + * test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/quote_calc-s.tab.c, test/quote_calc.tab.c, test/quote_calc2-s.tab.c, test/quote_calc2.tab.c, test/quote_calc3-s.tab.c, test/quote_calc3.tab.c, test/quote_calc4-s.tab.c, test/quote_calc4.tab.c: + regen + + * skeleton.c: + Increase default stack-size to match FreeBSD version noted as from + "BSD 4.4 Lite Usr.bin Sources". See + + http://svnweb.freebsd.org/base/vendor/CSRG/dist/usr.bin/yacc/ + http://svnweb.freebsd.org/base/head/usr.bin/yacc/ + http://svnweb.freebsd.org/base/vendor/byacc/ + + The original 1.9 sources (on which I based development) used 500 for + stacksize; the BSD Lite sources (a year or two later) used 10000. + + This is a change to default values; the YYMAXDEPTH and YYSTACKSIZE + symbols have "always" been overridable by applications, but rarely + needed to do this. RedHat began using the FreeBSD source in 2000, + and switched to this source in 2007 using the 20050813 snapshot. + + RedHat #743343 misattributed the change in default stacksize to + a regression in byacc, but did not report the issue upstream. + + * package/debian/changelog, VERSION, package/byacc.spec: bump + +2013-09-07 Thomas E. Dickey + + * config.sub: update to 2013-09-15 + + * config.guess: update to 2013-06-10 + 2013-03-04 Thomas E. Dickey * package/debian/changelog, VERSION, package/byacc.spec: bump @@ -30,7 +794,7 @@ 2013-02-10 Thomas E. Dickey - * config.sub, config.guess: 2013-02-04 + * config.sub, config.guess: update to 2013-02-04 2012-10-03 Thomas E. Dickey @@ -162,6 +926,8 @@ * VERSION, package/debian/changelog, package/byacc.spec: bump + * test/yacc/calc1.output: reference output for testing + * test/calc1.output, test/calc1.tab.c: regen * test/calc1.y: @@ -181,6 +947,8 @@ * test/calc2.tab.c, test/calc3.tab.c, test/code_error.code.c, test/ftp.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c: regen + * test/code_debug.y: RCS_BASE + * test/calc2.y, test/calc3.y, test/code_error.y, test/ftp.y: byacc already declares yyerror @@ -273,6 +1041,9 @@ * test/quote_calc-s.output, test/quote_calc-s.tab.c, test/quote_calc-s.tab.h, test/quote_calc2-s.output, test/quote_calc2-s.tab.c, test/quote_calc2-s.tab.h, test/quote_calc3-s.output, test/quote_calc3-s.tab.c, test/quote_calc3-s.tab.h, test/quote_calc4-s.output, test/quote_calc4-s.tab.c, test/quote_calc4-s.tab.h: RCS_BASE + * test/yacc/quote_calc-s.output, test/yacc/quote_calc-s.tab.h, test/yacc/quote_calc2-s.output, test/yacc/quote_calc2-s.tab.h, test/yacc/quote_calc3-s.output, test/yacc/quote_calc3-s.tab.h, test/yacc/quote_calc4-s.output, test/yacc/quote_calc4-s.tab.h: + reference output for testing + * test/run_test.sh: generate/test with "-s" option applied. 2012-01-13 Thomas E. Dickey @@ -285,9 +1056,24 @@ * main.c: add -s option to usage message. - * test/quote_calc3.output, test/quote_calc3.tab.c, test/quote_calc4.output, test/quote_calc4.tab.c, test/quote_calc4.tab.h, test/quote_calc3.y, test/quote_calc.tab.h, test/quote_calc.output, test/quote_calc.tab.c, test/quote_calc2.output, test/quote_calc2.tab.c, test/quote_calc2.tab.h, test/quote_calc3.tab.h, test/quote_calc4.y, test/quote_calc.y, test/quote_calc2.y: + * test/quote_calc3.output, test/quote_calc3.tab.c, test/quote_calc4.output, test/quote_calc4.tab.c, test/quote_calc4.tab.h: + RCS_BASE + + * test/yacc/quote_calc3.output, test/yacc/quote_calc4.output, test/yacc/quote_calc4.tab.h: + reference output for testing + + * test/quote_calc3.y, test/quote_calc.tab.h: RCS_BASE + + * test/yacc/quote_calc.tab.h: reference output for testing + + * test/quote_calc.output, test/quote_calc.tab.c, test/quote_calc2.output, test/quote_calc2.tab.c, test/quote_calc2.tab.h, test/quote_calc3.tab.h: RCS_BASE + * test/yacc/quote_calc.output, test/yacc/quote_calc2.output, test/yacc/quote_calc2.tab.h, test/yacc/quote_calc3.tab.h: + reference output for testing + + * test/quote_calc4.y, test/quote_calc.y, test/quote_calc2.y: RCS_BASE + * configure: regen * aclocal.m4: resync with my-autoconf, i.e., fixes for CF_XOPEN_SOURCE @@ -348,11 +1134,11 @@ 2011-04-01 Thomas E. Dickey - * config.sub: 2011-04-01 + * config.sub: update to 2011-04-01 2011-02-02 Thomas E. Dickey - * config.guess: 2011-01-01 + * config.guess: update to 2011-01-01 2010-12-29 Thomas E. Dickey @@ -470,6 +1256,8 @@ * output.c: simplified a little, using putc_code() and putl_code() + * test/yacc/calc1.tab.h: reference output for testing + * test/calc1.tab.h: regen * reader.c: @@ -530,11 +1318,11 @@ 2010-09-28 Thomas E. Dickey - * config.guess: 2010-09-24 + * config.guess: update to 2010-09-24 2010-09-10 Thomas E. Dickey - * config.sub: 2010-09-11 + * config.sub: update to 2010-09-11 2010-06-10 Thomas E. Dickey @@ -551,9 +1339,20 @@ improve %lex-param / %parse-param implementation by allowing for arrays to be passed as parameters, e.g., "int regs[26]". - * test/calc3.tab.c, test/calc3.y, test/calc3.output, test/calc3.tab.h, test/calc2.tab.c, test/calc2.y, test/calc2.tab.h, test/calc2.output: + * test/calc3.tab.c, test/calc3.y, test/calc3.output, test/calc3.tab.h: RCS_BASE + * test/yacc/calc3.output, test/yacc/calc3.tab.h: + reference output for testing + + * test/calc2.tab.c, test/calc2.y, test/calc2.tab.h: RCS_BASE + + * test/yacc/calc2.tab.h: reference output for testing + + * test/calc2.output: RCS_BASE + + * test/yacc/calc2.output: reference output for testing + * output.c: improve %lex-param / %parse-param implementation by allowing for arrays to be passed as parameters, e.g., "int regs[26]". @@ -613,9 +1412,27 @@ provide for testing -r and -P options by checking if the ".y" filename begins with "code_" or "pure_", respectively. - * test/code_error.code.c, test/code_error.tab.c, test/code_error.tab.h, test/code_calc.code.c, test/code_calc.tab.c, test/code_calc.tab.h, test/pure_calc.output, test/pure_calc.tab.h, test/pure_error.output, test/pure_error.tab.h, test/code_calc.output, test/code_error.output: + * test/code_error.code.c, test/code_error.tab.c, test/code_error.tab.h: + RCS_BASE + + * test/yacc/code_error.tab.h: reference output for testing + + * test/code_calc.code.c, test/code_calc.tab.c, test/code_calc.tab.h: RCS_BASE + * test/yacc/code_calc.tab.h: reference output for testing + + * test/pure_calc.output, test/pure_calc.tab.h, test/pure_error.output, test/pure_error.tab.h: + RCS_BASE + + * test/yacc/pure_calc.output, test/yacc/pure_calc.tab.h, test/yacc/pure_error.output, test/yacc/pure_error.tab.h: + reference output for testing + + * test/code_calc.output, test/code_error.output: RCS_BASE + + * test/yacc/code_calc.output, test/yacc/code_error.output: + reference output for testing + * test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c: regen * test/run_test.sh: @@ -770,9 +1587,9 @@ 2009-12-31 Thomas E. Dickey - * config.guess: 2009-12-30 + * config.guess: update to 2009-12-30 - * config.sub: 2009-12-31 + * config.sub: update to 2009-12-31 2009-10-27 Thomas E. Dickey @@ -798,7 +1615,7 @@ 2009-08-25 Thomas E. Dickey - * config.guess, config.sub: 2009-08-19 + * config.guess, config.sub: update to 2009-08-19 2009-02-21 Thomas E. Dickey @@ -979,11 +1796,11 @@ 2006-12-22 Thomas E. Dickey - * config.guess: 2006/12/22 + * config.guess: update to 2006/12/22 2006-12-08 Thomas E. Dickey - * config.sub: 2006/12/08 + * config.sub: update to 2006/12/08 2005-08-13 Thomas E. Dickey @@ -1012,9 +1829,9 @@ 2005-06-25 Thomas E. Dickey - * config.sub: 2005/6/2 + * config.sub: update to 2005/6/2 - * config.guess: 2005/5/27 + * config.guess: update to 2005/5/27 2005-05-05 Thomas E. Dickey @@ -1108,9 +1925,9 @@ 2005-04-16 Thomas E. Dickey - * config.sub: 2005/2/10 + * config.sub: update to 2005/2/10 - * config.guess: 2005/3/24 + * config.guess: update to 2005/3/24 2005-04-13 Thomas E. Dickey @@ -1164,9 +1981,18 @@ * test/grammar.output, test/grammar.tab.c, test/grammar.tab.h: RCS_BASE + * test/yacc/grammar.output, test/yacc/grammar.tab.h: + reference output for testing + * makefile.in: turn on "make check" rule - * test/calc.output, test/run_test.sh, test/calc.tab.h: RCS_BASE + * test/calc.output: RCS_BASE + + * test/yacc/calc.output: reference output for testing + + * test/run_test.sh, test/calc.tab.h: RCS_BASE + + * test/yacc/calc.tab.h: reference output for testing * test/ftp.tab.c: yyparse() is now yyparse(void) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 00:29:43 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0E92A67A; Sun, 20 Jul 2014 00:29:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEE452D6F; Sun, 20 Jul 2014 00:29:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K0Tgs8074175; Sun, 20 Jul 2014 00:29:42 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K0TgEU074162; Sun, 20 Jul 2014 00:29:42 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407200029.s6K0TgEU074162@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 20 Jul 2014 00:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268900 - stable/10/lib/libfetch X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 00:29:43 -0000 Author: bapt Date: Sun Jul 20 00:29:41 2014 New Revision: 268900 URL: http://svnweb.freebsd.org/changeset/base/268900 Log: MFC: r267131, r267132, r267133, r268493, r268671 Use NULL instead of 0 (Patch by Sascha Wildner for Dragonfly) Remove unnecessary semicolons (Patch by Sascha Wildner for Dragonfly) Add support for arbitrary http requests [1] Support EAGAIN in fetch_writev Submitted by: Alex Hornung [1] Reviewed by: des Modified: stable/10/lib/libfetch/common.c stable/10/lib/libfetch/common.h stable/10/lib/libfetch/fetch.h stable/10/lib/libfetch/http.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libfetch/common.c ============================================================================== --- stable/10/lib/libfetch/common.c Sun Jul 20 00:21:38 2014 (r268899) +++ stable/10/lib/libfetch/common.c Sun Jul 20 00:29:41 2014 (r268900) @@ -1110,6 +1110,9 @@ fetch_writev(conn_t *conn, struct iovec errno = 0; pfd.revents = 0; if (poll(&pfd, 1, deltams) < 0) { + /* POSIX compliance */ + if (errno == EAGAIN) + continue; if (errno == EINTR && fetchRestartCalls) continue; return (-1); Modified: stable/10/lib/libfetch/common.h ============================================================================== --- stable/10/lib/libfetch/common.h Sun Jul 20 00:21:38 2014 (r268899) +++ stable/10/lib/libfetch/common.h Sun Jul 20 00:29:41 2014 (r268900) @@ -117,6 +117,9 @@ int fetch_no_proxy_match(const char *) */ FILE *http_request(struct url *, const char *, struct url_stat *, struct url *, const char *); +FILE *http_request_body(struct url *, const char *, + struct url_stat *, struct url *, const char *, + const char *, const char *); FILE *ftp_request(struct url *, const char *, struct url_stat *, struct url *, const char *); Modified: stable/10/lib/libfetch/fetch.h ============================================================================== --- stable/10/lib/libfetch/fetch.h Sun Jul 20 00:21:38 2014 (r268899) +++ stable/10/lib/libfetch/fetch.h Sun Jul 20 00:29:41 2014 (r268900) @@ -102,6 +102,8 @@ FILE *fetchGetHTTP(struct url *, const FILE *fetchPutHTTP(struct url *, const char *); int fetchStatHTTP(struct url *, struct url_stat *, const char *); struct url_ent *fetchListHTTP(struct url *, const char *); +FILE *fetchReqHTTP(struct url *, const char *, const char *, + const char *, const char *); /* FTP-specific functions */ FILE *fetchXGetFTP(struct url *, struct url_stat *, const char *); Modified: stable/10/lib/libfetch/http.c ============================================================================== --- stable/10/lib/libfetch/http.c Sun Jul 20 00:21:38 2014 (r268899) +++ stable/10/lib/libfetch/http.c Sun Jul 20 00:29:41 2014 (r268900) @@ -1030,7 +1030,7 @@ typedef struct { static void init_http_auth_params(http_auth_params_t *s) { - s->scheme = s->realm = s->user = s->password = 0; + s->scheme = s->realm = s->user = s->password = NULL; } static void @@ -1129,7 +1129,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) Hex[i*2] = hexchars[j]; j = Bin[i] & 0xf; Hex[i*2+1] = hexchars[j]; - }; + } Hex[HASHHEXLEN] = '\0'; }; @@ -1164,7 +1164,7 @@ DigestCalcHA1( MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); MD5Final(HA1, &Md5Ctx); - }; + } CvtHex(HA1, SessionKey); } @@ -1198,7 +1198,7 @@ DigestCalcResponse( if (strcasecmp(pszQop, "auth-int") == 0) { MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, HEntity, HASHHEXLEN); - }; + } MD5Final(HA2, &Md5Ctx); CvtHex(HA2, HA2Hex); @@ -1215,7 +1215,7 @@ DigestCalcResponse( MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, pszQop, strlen(pszQop)); MD5Update(&Md5Ctx, ":", 1); - }; + } MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN); MD5Final(RespHash, &Md5Ctx); CvtHex(RespHash, Response); @@ -1249,7 +1249,7 @@ http_digest_auth(conn_t *conn, const cha int r; char noncecount[10]; char cnonce[40]; - char *options = 0; + char *options = NULL; if (!c->realm || !c->nonce) { DEBUG(fprintf(stderr, "realm/nonce not set in challenge\n")); @@ -1494,6 +1494,14 @@ http_print_html(FILE *out, FILE *in) * Core */ +FILE * +http_request(struct url *URL, const char *op, struct url_stat *us, + struct url *purl, const char *flags) +{ + + return (http_request_body(URL, op, us, purl, flags, NULL, NULL)); +} + /* * Send a request and process the reply * @@ -1501,8 +1509,9 @@ http_print_html(FILE *out, FILE *in) * XXX off into a separate function. */ FILE * -http_request(struct url *URL, const char *op, struct url_stat *us, - struct url *purl, const char *flags) +http_request_body(struct url *URL, const char *op, struct url_stat *us, + struct url *purl, const char *flags, const char *content_type, + const char *body) { char timebuf[80]; char hbuf[MAXHOSTNAMELEN + 7], *host; @@ -1519,6 +1528,7 @@ http_request(struct url *URL, const char http_headerbuf_t headerbuf; http_auth_challenges_t server_challenges; http_auth_challenges_t proxy_challenges; + size_t body_len; /* The following calls don't allocate anything */ init_http_headerbuf(&headerbuf); @@ -1690,8 +1700,19 @@ http_request(struct url *URL, const char if (url->offset > 0) http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset); http_cmd(conn, "Connection: close"); + + if (body) { + body_len = strlen(body); + http_cmd(conn, "Content-Length: %zu", body_len); + if (content_type != NULL) + http_cmd(conn, "Content-Type: %s", content_type); + } + http_cmd(conn, ""); + if (body) + fetch_write(conn, body, body_len); + /* * Force the queued request to be dispatched. Normally, one * would do this with shutdown(2) but squid proxies can be @@ -2042,3 +2063,12 @@ fetchListHTTP(struct url *url __unused, warnx("fetchListHTTP(): not implemented"); return (NULL); } + +FILE * +fetchReqHTTP(struct url *URL, const char *method, const char *flags, + const char *content_type, const char *body) +{ + + return (http_request_body(URL, method, NULL, http_get_proxy(URL, flags), + flags, content_type, body)); +} From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 00:30:30 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14B7D7CA; Sun, 20 Jul 2014 00:30:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 012692DE5; Sun, 20 Jul 2014 00:30:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K0UT2d075375; Sun, 20 Jul 2014 00:30:29 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K0UTO1075370; Sun, 20 Jul 2014 00:30:29 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407200030.s6K0UTO1075370@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 20 Jul 2014 00:30:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268901 - stable/9/lib/libfetch X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 00:30:30 -0000 Author: bapt Date: Sun Jul 20 00:30:28 2014 New Revision: 268901 URL: http://svnweb.freebsd.org/changeset/base/268901 Log: MFC: r267131, r267132, r267133, r268493, r268671 Use NULL instead of 0 (Patch by Sascha Wildner for Dragonfly) Remove unnecessary semicolons (Patch by Sascha Wildner for Dragonfly) Add support for arbitrary http requests [1] Support EAGAIN in fetch_writev Submitted by: Alex Hornung [1] Reviewed by: des Modified: stable/9/lib/libfetch/common.c stable/9/lib/libfetch/common.h stable/9/lib/libfetch/fetch.h stable/9/lib/libfetch/http.c Directory Properties: stable/9/lib/libfetch/ (props changed) Modified: stable/9/lib/libfetch/common.c ============================================================================== --- stable/9/lib/libfetch/common.c Sun Jul 20 00:29:41 2014 (r268900) +++ stable/9/lib/libfetch/common.c Sun Jul 20 00:30:28 2014 (r268901) @@ -1110,6 +1110,9 @@ fetch_writev(conn_t *conn, struct iovec errno = 0; pfd.revents = 0; if (poll(&pfd, 1, deltams) < 0) { + /* POSIX compliance */ + if (errno == EAGAIN) + continue; if (errno == EINTR && fetchRestartCalls) continue; return (-1); Modified: stable/9/lib/libfetch/common.h ============================================================================== --- stable/9/lib/libfetch/common.h Sun Jul 20 00:29:41 2014 (r268900) +++ stable/9/lib/libfetch/common.h Sun Jul 20 00:30:28 2014 (r268901) @@ -117,6 +117,9 @@ int fetch_no_proxy_match(const char *) */ FILE *http_request(struct url *, const char *, struct url_stat *, struct url *, const char *); +FILE *http_request_body(struct url *, const char *, + struct url_stat *, struct url *, const char *, + const char *, const char *); FILE *ftp_request(struct url *, const char *, struct url_stat *, struct url *, const char *); Modified: stable/9/lib/libfetch/fetch.h ============================================================================== --- stable/9/lib/libfetch/fetch.h Sun Jul 20 00:29:41 2014 (r268900) +++ stable/9/lib/libfetch/fetch.h Sun Jul 20 00:30:28 2014 (r268901) @@ -102,6 +102,8 @@ FILE *fetchGetHTTP(struct url *, const FILE *fetchPutHTTP(struct url *, const char *); int fetchStatHTTP(struct url *, struct url_stat *, const char *); struct url_ent *fetchListHTTP(struct url *, const char *); +FILE *fetchReqHTTP(struct url *, const char *, const char *, + const char *, const char *); /* FTP-specific functions */ FILE *fetchXGetFTP(struct url *, struct url_stat *, const char *); Modified: stable/9/lib/libfetch/http.c ============================================================================== --- stable/9/lib/libfetch/http.c Sun Jul 20 00:29:41 2014 (r268900) +++ stable/9/lib/libfetch/http.c Sun Jul 20 00:30:28 2014 (r268901) @@ -1030,7 +1030,7 @@ typedef struct { static void init_http_auth_params(http_auth_params_t *s) { - s->scheme = s->realm = s->user = s->password = 0; + s->scheme = s->realm = s->user = s->password = NULL; } static void @@ -1129,7 +1129,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) Hex[i*2] = hexchars[j]; j = Bin[i] & 0xf; Hex[i*2+1] = hexchars[j]; - }; + } Hex[HASHHEXLEN] = '\0'; }; @@ -1164,7 +1164,7 @@ DigestCalcHA1( MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); MD5Final(HA1, &Md5Ctx); - }; + } CvtHex(HA1, SessionKey); } @@ -1198,7 +1198,7 @@ DigestCalcResponse( if (strcasecmp(pszQop, "auth-int") == 0) { MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, HEntity, HASHHEXLEN); - }; + } MD5Final(HA2, &Md5Ctx); CvtHex(HA2, HA2Hex); @@ -1215,7 +1215,7 @@ DigestCalcResponse( MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, pszQop, strlen(pszQop)); MD5Update(&Md5Ctx, ":", 1); - }; + } MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN); MD5Final(RespHash, &Md5Ctx); CvtHex(RespHash, Response); @@ -1249,7 +1249,7 @@ http_digest_auth(conn_t *conn, const cha int r; char noncecount[10]; char cnonce[40]; - char *options = 0; + char *options = NULL; if (!c->realm || !c->nonce) { DEBUG(fprintf(stderr, "realm/nonce not set in challenge\n")); @@ -1494,6 +1494,14 @@ http_print_html(FILE *out, FILE *in) * Core */ +FILE * +http_request(struct url *URL, const char *op, struct url_stat *us, + struct url *purl, const char *flags) +{ + + return (http_request_body(URL, op, us, purl, flags, NULL, NULL)); +} + /* * Send a request and process the reply * @@ -1501,8 +1509,9 @@ http_print_html(FILE *out, FILE *in) * XXX off into a separate function. */ FILE * -http_request(struct url *URL, const char *op, struct url_stat *us, - struct url *purl, const char *flags) +http_request_body(struct url *URL, const char *op, struct url_stat *us, + struct url *purl, const char *flags, const char *content_type, + const char *body) { char timebuf[80]; char hbuf[MAXHOSTNAMELEN + 7], *host; @@ -1519,6 +1528,7 @@ http_request(struct url *URL, const char http_headerbuf_t headerbuf; http_auth_challenges_t server_challenges; http_auth_challenges_t proxy_challenges; + size_t body_len; /* The following calls don't allocate anything */ init_http_headerbuf(&headerbuf); @@ -1690,8 +1700,19 @@ http_request(struct url *URL, const char if (url->offset > 0) http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset); http_cmd(conn, "Connection: close"); + + if (body) { + body_len = strlen(body); + http_cmd(conn, "Content-Length: %zu", body_len); + if (content_type != NULL) + http_cmd(conn, "Content-Type: %s", content_type); + } + http_cmd(conn, ""); + if (body) + fetch_write(conn, body, body_len); + /* * Force the queued request to be dispatched. Normally, one * would do this with shutdown(2) but squid proxies can be @@ -2042,3 +2063,12 @@ fetchListHTTP(struct url *url __unused, warnx("fetchListHTTP(): not implemented"); return (NULL); } + +FILE * +fetchReqHTTP(struct url *URL, const char *method, const char *flags, + const char *content_type, const char *body) +{ + + return (http_request_body(URL, method, NULL, http_get_proxy(URL, flags), + flags, content_type, body)); +} From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 00:32:23 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A741922; Sun, 20 Jul 2014 00:32:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 770C22DF3; Sun, 20 Jul 2014 00:32:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K0WNTU077819; Sun, 20 Jul 2014 00:32:23 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K0WNpY077817; Sun, 20 Jul 2014 00:32:23 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407200032.s6K0WNpY077817@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 20 Jul 2014 00:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268902 - stable/10/lib/libz X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 00:32:23 -0000 Author: bapt Date: Sun Jul 20 00:32:22 2014 New Revision: 268902 URL: http://svnweb.freebsd.org/changeset/base/268902 Log: MFC: r267376 Add a zlib pkg-config file (more and more ports requires it) Approved by: delphij Added: stable/10/lib/libz/zlib.pc - copied unchanged from r267376, head/lib/libz/zlib.pc Modified: stable/10/lib/libz/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libz/Makefile ============================================================================== --- stable/10/lib/libz/Makefile Sun Jul 20 00:30:28 2014 (r268901) +++ stable/10/lib/libz/Makefile Sun Jul 20 00:32:22 2014 (r268902) @@ -68,6 +68,10 @@ test: example minigzip (export LD_LIBRARY_PATH=. ; \ echo hello world | ./minigzip | ./minigzip -d ) +beforeinstall: + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.CURDIR}/zlib.pc ${DESTDIR}${LIBDATADIR}/pkgconfig + .include ## XXX: clang integrated-as doesn't grok .intel_syntax directives yet Copied: stable/10/lib/libz/zlib.pc (from r267376, head/lib/libz/zlib.pc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libz/zlib.pc Sun Jul 20 00:32:22 2014 (r268902, copy of r267376, head/lib/libz/zlib.pc) @@ -0,0 +1,14 @@ +# $FreeBSD$ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +sharedlibdir=${libdir} +includedir=${prefix}/include + +Name: zlib +Description: zlib compression library +Version: 1.2.8 + +Requires: +Libs: -L${libdir} -L${sharedlibdir} -lz +Cflags: -I${includedir} From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 00:34:55 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B3E6A63; Sun, 20 Jul 2014 00:34:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC4D52DFF; Sun, 20 Jul 2014 00:34:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K0YsoJ078296; Sun, 20 Jul 2014 00:34:54 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K0YsO6078294; Sun, 20 Jul 2014 00:34:54 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407200034.s6K0YsO6078294@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 20 Jul 2014 00:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268903 - stable/10/sbin/kldstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 00:34:55 -0000 Author: bapt Date: Sun Jul 20 00:34:54 2014 New Revision: 268903 URL: http://svnweb.freebsd.org/changeset/base/268903 Log: MFC: r261032 Add quiet support for kldstat -n PR: bin/180014 Submitted by: Olivier Cochard-Labbé Modified: stable/10/sbin/kldstat/kldstat.8 stable/10/sbin/kldstat/kldstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/kldstat/kldstat.8 ============================================================================== --- stable/10/sbin/kldstat/kldstat.8 Sun Jul 20 00:32:22 2014 (r268902) +++ stable/10/sbin/kldstat/kldstat.8 Sun Jul 20 00:34:54 2014 (r268903) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2005 +.Dd January 22, 2014 .Dt KLDSTAT 8 .Os .Sh NAME @@ -33,6 +33,7 @@ .Nd display status of dynamic kernel linker .Sh SYNOPSIS .Nm +.Op Fl q .Op Fl v .Op Fl i Ar id .Op Fl n Ar filename Modified: stable/10/sbin/kldstat/kldstat.c ============================================================================== --- stable/10/sbin/kldstat/kldstat.c Sun Jul 20 00:32:22 2014 (r268902) +++ stable/10/sbin/kldstat/kldstat.c Sun Jul 20 00:34:54 2014 (r268903) @@ -78,7 +78,7 @@ printfile(int fileid, int verbose) static void usage(void) { - fprintf(stderr, "usage: kldstat [-v] [-i id] [-n filename]\n"); + fprintf(stderr, "usage: kldstat [-q] [-v] [-i id] [-n filename]\n"); fprintf(stderr, " kldstat [-q] [-m modname]\n"); exit(1); } @@ -146,8 +146,13 @@ main(int argc, char** argv) } if (filename != NULL) { - if ((fileid = kldfind(filename)) < 0) - err(1, "can't find file %s", filename); + if ((fileid = kldfind(filename)) < 0) { + if (!quiet) + warn("can't find file %s", filename); + return 1; + } else if (quiet) { + return 0; + } } printf("Id Refs Address%*c Size Name\n", POINTER_WIDTH - 7, ' '); From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 01:03:09 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 632C3E25; Sun, 20 Jul 2014 01:03:09 +0000 (UTC) Received: from smtp1.multiplay.co.uk (smtp1.multiplay.co.uk [85.236.96.35]) by mx1.freebsd.org (Postfix) with ESMTP id A4C972FEA; Sun, 20 Jul 2014 01:03:08 +0000 (UTC) Received: by smtp1.multiplay.co.uk (Postfix, from userid 65534) id 5960520E7088C; Sun, 20 Jul 2014 01:03:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.multiplay.co.uk X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=8.0 tests=AWL,BAYES_00,DOS_OE_TO_MX, FSL_HELO_NON_FQDN_1,HELO_NO_DOMAIN,RDNS_DYNAMIC,STOX_REPLY_TYPE autolearn=no version=3.3.1 Received: from r2d2 (82-69-141-170.dsl.in-addr.zen.co.uk [82.69.141.170]) by smtp1.multiplay.co.uk (Postfix) with ESMTPS id 5A1D620E7088A; Sun, 20 Jul 2014 01:02:57 +0000 (UTC) Message-ID: <32EEE9A6E8FE4D6FBE0E8CD53F2709CE@multiplay.co.uk> From: "Steven Hartland" To: "Baptiste Daroussin" , , , , References: <201407200029.s6K0TgEU074162@svn.freebsd.org> Subject: Re: svn commit: r268900 - stable/10/lib/libfetch Date: Sun, 20 Jul 2014 02:02:48 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 01:03:09 -0000 poll isnt documented as ever returning EAGAIN, are the docs for poll incorrect or does that part of this patch require reverting? Regards Steve ----- Original Message ----- From: "Baptiste Daroussin" To: ; ; ; Sent: Sunday, July 20, 2014 1:29 AM Subject: svn commit: r268900 - stable/10/lib/libfetch > Author: bapt > Date: Sun Jul 20 00:29:41 2014 > New Revision: 268900 > URL: http://svnweb.freebsd.org/changeset/base/268900 > > Log: > MFC: r267131, r267132, r267133, r268493, r268671 > > Use NULL instead of 0 (Patch by Sascha Wildner for Dragonfly) > Remove unnecessary semicolons (Patch by Sascha Wildner for Dragonfly) > Add support for arbitrary http requests [1] > Support EAGAIN in fetch_writev > > Submitted by: Alex Hornung [1] > Reviewed by: des > > Modified: > stable/10/lib/libfetch/common.c > stable/10/lib/libfetch/common.h > stable/10/lib/libfetch/fetch.h > stable/10/lib/libfetch/http.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/lib/libfetch/common.c > ============================================================================== > --- stable/10/lib/libfetch/common.c Sun Jul 20 00:21:38 2014 (r268899) > +++ stable/10/lib/libfetch/common.c Sun Jul 20 00:29:41 2014 (r268900) > @@ -1110,6 +1110,9 @@ fetch_writev(conn_t *conn, struct iovec > errno = 0; > pfd.revents = 0; > if (poll(&pfd, 1, deltams) < 0) { > + /* POSIX compliance */ > + if (errno == EAGAIN) > + continue; > if (errno == EINTR && fetchRestartCalls) > continue; > return (-1); > > Modified: stable/10/lib/libfetch/common.h > ============================================================================== > --- stable/10/lib/libfetch/common.h Sun Jul 20 00:21:38 2014 (r268899) > +++ stable/10/lib/libfetch/common.h Sun Jul 20 00:29:41 2014 (r268900) > @@ -117,6 +117,9 @@ int fetch_no_proxy_match(const char *) > */ > FILE *http_request(struct url *, const char *, > struct url_stat *, struct url *, const char *); > +FILE *http_request_body(struct url *, const char *, > + struct url_stat *, struct url *, const char *, > + const char *, const char *); > FILE *ftp_request(struct url *, const char *, > struct url_stat *, struct url *, const char *); > > > Modified: stable/10/lib/libfetch/fetch.h > ============================================================================== > --- stable/10/lib/libfetch/fetch.h Sun Jul 20 00:21:38 2014 (r268899) > +++ stable/10/lib/libfetch/fetch.h Sun Jul 20 00:29:41 2014 (r268900) > @@ -102,6 +102,8 @@ FILE *fetchGetHTTP(struct url *, const > FILE *fetchPutHTTP(struct url *, const char *); > int fetchStatHTTP(struct url *, struct url_stat *, const char *); > struct url_ent *fetchListHTTP(struct url *, const char *); > +FILE *fetchReqHTTP(struct url *, const char *, const char *, > + const char *, const char *); > > /* FTP-specific functions */ > FILE *fetchXGetFTP(struct url *, struct url_stat *, const char *); > > Modified: stable/10/lib/libfetch/http.c > ============================================================================== > --- stable/10/lib/libfetch/http.c Sun Jul 20 00:21:38 2014 (r268899) > +++ stable/10/lib/libfetch/http.c Sun Jul 20 00:29:41 2014 (r268900) > @@ -1030,7 +1030,7 @@ typedef struct { > static void > init_http_auth_params(http_auth_params_t *s) > { > - s->scheme = s->realm = s->user = s->password = 0; > + s->scheme = s->realm = s->user = s->password = NULL; > } > > static void > @@ -1129,7 +1129,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) > Hex[i*2] = hexchars[j]; > j = Bin[i] & 0xf; > Hex[i*2+1] = hexchars[j]; > - }; > + } > Hex[HASHHEXLEN] = '\0'; > }; > > @@ -1164,7 +1164,7 @@ DigestCalcHA1( > MD5Update(&Md5Ctx, ":", 1); > MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); > MD5Final(HA1, &Md5Ctx); > - }; > + } > CvtHex(HA1, SessionKey); > } > > @@ -1198,7 +1198,7 @@ DigestCalcResponse( > if (strcasecmp(pszQop, "auth-int") == 0) { > MD5Update(&Md5Ctx, ":", 1); > MD5Update(&Md5Ctx, HEntity, HASHHEXLEN); > - }; > + } > MD5Final(HA2, &Md5Ctx); > CvtHex(HA2, HA2Hex); > > @@ -1215,7 +1215,7 @@ DigestCalcResponse( > MD5Update(&Md5Ctx, ":", 1); > MD5Update(&Md5Ctx, pszQop, strlen(pszQop)); > MD5Update(&Md5Ctx, ":", 1); > - }; > + } > MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN); > MD5Final(RespHash, &Md5Ctx); > CvtHex(RespHash, Response); > @@ -1249,7 +1249,7 @@ http_digest_auth(conn_t *conn, const cha > int r; > char noncecount[10]; > char cnonce[40]; > - char *options = 0; > + char *options = NULL; > > if (!c->realm || !c->nonce) { > DEBUG(fprintf(stderr, "realm/nonce not set in challenge\n")); > @@ -1494,6 +1494,14 @@ http_print_html(FILE *out, FILE *in) > * Core > */ > > +FILE * > +http_request(struct url *URL, const char *op, struct url_stat *us, > + struct url *purl, const char *flags) > +{ > + > + return (http_request_body(URL, op, us, purl, flags, NULL, NULL)); > +} > + > /* > * Send a request and process the reply > * > @@ -1501,8 +1509,9 @@ http_print_html(FILE *out, FILE *in) > * XXX off into a separate function. > */ > FILE * > -http_request(struct url *URL, const char *op, struct url_stat *us, > - struct url *purl, const char *flags) > +http_request_body(struct url *URL, const char *op, struct url_stat *us, > + struct url *purl, const char *flags, const char *content_type, > + const char *body) > { > char timebuf[80]; > char hbuf[MAXHOSTNAMELEN + 7], *host; > @@ -1519,6 +1528,7 @@ http_request(struct url *URL, const char > http_headerbuf_t headerbuf; > http_auth_challenges_t server_challenges; > http_auth_challenges_t proxy_challenges; > + size_t body_len; > > /* The following calls don't allocate anything */ > init_http_headerbuf(&headerbuf); > @@ -1690,8 +1700,19 @@ http_request(struct url *URL, const char > if (url->offset > 0) > http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset); > http_cmd(conn, "Connection: close"); > + > + if (body) { > + body_len = strlen(body); > + http_cmd(conn, "Content-Length: %zu", body_len); > + if (content_type != NULL) > + http_cmd(conn, "Content-Type: %s", content_type); > + } > + > http_cmd(conn, ""); > > + if (body) > + fetch_write(conn, body, body_len); > + > /* > * Force the queued request to be dispatched. Normally, one > * would do this with shutdown(2) but squid proxies can be > @@ -2042,3 +2063,12 @@ fetchListHTTP(struct url *url __unused, > warnx("fetchListHTTP(): not implemented"); > return (NULL); > } > + > +FILE * > +fetchReqHTTP(struct url *URL, const char *method, const char *flags, > + const char *content_type, const char *body) > +{ > + > + return (http_request_body(URL, method, NULL, http_get_proxy(URL, flags), > + flags, content_type, body)); > +} > > From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 01:15:08 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE3B0361; Sun, 20 Jul 2014 01:15:08 +0000 (UTC) Received: from mail-oa0-x236.google.com (mail-oa0-x236.google.com [IPv6:2607:f8b0:4003:c02::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6483520D6; Sun, 20 Jul 2014 01:15:08 +0000 (UTC) Received: by mail-oa0-f54.google.com with SMTP id n16so5604850oag.27 for ; Sat, 19 Jul 2014 18:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=cPEEMB6e1FHr/u+4mW0Rx6ttz45SwQeGDpw3ITtom7s=; b=xj9pR0mDpa7oShgK28mkjry/iht9cs9ExR8rx0fjzJOaCaIBT6Eo5Q/OYxSS7MHkqN 0uhhk3jJenOssBy+0tU1z0pKbmgrXzJMxt0criJLPRFzN9YY9kWZMTzMNZ3CDpvJv1Rl dnnJCyoBGZthnGiJvXSefKYY+wO4RAY+xF+T80PSO6p516jcQRgHfPrq2bE+lIiXZGj5 ZmPaKhD1ZQY0tJX2kiIoVUgf8IqbxziyPSP2uMEXGFr8dAAtMg00OkSM70PYqU8kI/kt vX+AojkZS+tnLd8omUAt5LNdDHF85jo7emQ14XWga4y5soVs+B1Gv2xAyrPkPXzIfo7R HU7A== MIME-Version: 1.0 X-Received: by 10.60.116.166 with SMTP id jx6mr22222190oeb.6.1405818907733; Sat, 19 Jul 2014 18:15:07 -0700 (PDT) Received: by 10.182.142.34 with HTTP; Sat, 19 Jul 2014 18:15:07 -0700 (PDT) In-Reply-To: <32EEE9A6E8FE4D6FBE0E8CD53F2709CE@multiplay.co.uk> References: <201407200029.s6K0TgEU074162@svn.freebsd.org> <32EEE9A6E8FE4D6FBE0E8CD53F2709CE@multiplay.co.uk> Date: Sat, 19 Jul 2014 21:15:07 -0400 Message-ID: Subject: Re: svn commit: r268900 - stable/10/lib/libfetch From: Benjamin Kaduk To: Steven Hartland Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: svn-src-stable@freebsd.org, Baptiste Daroussin , "src-committers@freebsd.org" , svn-src-stable-10@freebsd.org, "svn-src-all@freebsd.org" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 01:15:08 -0000 On Sat, Jul 19, 2014 at 9:02 PM, Steven Hartland wrote: > poll isnt documented as ever returning EAGAIN, are the docs for poll > incorrect > or does that part of this patch require reverting? > This was covered after the initial commit to head; see http://lists.freebsd.org/pipermail/svn-src-head/2014-July/060301.html -Ben From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 01:21:21 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8EEE74D3; Sun, 20 Jul 2014 01:21:21 +0000 (UTC) Received: from mail-we0-x230.google.com (mail-we0-x230.google.com [IPv6:2a00:1450:400c:c03::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A651F2162; Sun, 20 Jul 2014 01:21:20 +0000 (UTC) Received: by mail-we0-f176.google.com with SMTP id q58so6082291wes.7 for ; Sat, 19 Jul 2014 18:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=HJXeUH0mtohUKn3fhMFcCYYZ3teM0w8pjpwH3/fiXI8=; b=q9LEfQ40lveMJ73kAvyDVNqJKKQsKE6H/JTp/VuXni0mz/cWBm5J5oHSnMSZY/oMUc 1sd2TlJfToJRDi1JVDDBxeSIp9msZEykaTKrBUkddQkJuZSJstGYbxzLo8pxHFxbec9j M8OPSawST8B6un4j/sMcFRxK+r7X9ENxaSMTTMcsfVfCpDcD37Nka3Np1afjPv1rZsMR Hs0c6m/Pq25SYm1m/t0tLy29XT9/zFcurdrrbKWBeZkJ4pgK8clEn57OQ1zgMfAUYFTg gB99ORbaRv2VG1px1u544Q75LhazwY5BfOvDN8bSedu4YKXa5g0N4ebn1/awTvRv7uL8 /Kdw== X-Received: by 10.195.11.132 with SMTP id ei4mr868531wjd.95.1405819278775; Sat, 19 Jul 2014 18:21:18 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id jy8sm25813740wjc.7.2014.07.19.18.21.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jul 2014 18:21:17 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 20 Jul 2014 03:21:15 +0200 From: Baptiste Daroussin To: Steven Hartland Subject: Re: svn commit: r268900 - stable/10/lib/libfetch Message-ID: <20140720012112.GA26778@ivaldir.etoilebsd.net> References: <201407200029.s6K0TgEU074162@svn.freebsd.org> <32EEE9A6E8FE4D6FBE0E8CD53F2709CE@multiplay.co.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vkogqOf2sHV7VnPd" Content-Disposition: inline In-Reply-To: <32EEE9A6E8FE4D6FBE0E8CD53F2709CE@multiplay.co.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 01:21:21 -0000 --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jul 20, 2014 at 02:02:48AM +0100, Steven Hartland wrote: > poll isnt documented as ever returning EAGAIN, are the docs for poll inco= rrect > or does that part of this patch require reverting? >=20 > Regards > Steve Hence the comment about the POSIX compatibility, libfetch can work on other operating systems where poll can return EAGAIN according to POSIX: http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html This kib's comment here: http://lists.freebsd.org/pipermail/svn-src-head/2014-July/060314.html regards, Bapt --vkogqOf2sHV7VnPd Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlPLGYgACgkQ8kTtMUmk6ExnJQCff0hdClN0s7BJYdwdBw8y/0dp PnoAnjXqs2qKZamx0mCBqo8e5qOUjY9v =7AFv -----END PGP SIGNATURE----- --vkogqOf2sHV7VnPd-- From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 02:15:15 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53C3AB75; Sun, 20 Jul 2014 02:15:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40FA92481; Sun, 20 Jul 2014 02:15:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K2FFOp029860; Sun, 20 Jul 2014 02:15:15 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K2FF2L029859; Sun, 20 Jul 2014 02:15:15 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201407200215.s6K2FF2L029859@svn.freebsd.org> From: Hiren Panchasara Date: Sun, 20 Jul 2014 02:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268904 - stable/10/sys/dev/ixgbe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 02:15:15 -0000 Author: hiren Date: Sun Jul 20 02:15:14 2014 New Revision: 268904 URL: http://svnweb.freebsd.org/changeset/base/268904 Log: MFC r268790 Fix a typo. Modified: stable/10/sys/dev/ixgbe/ixgbe.c Modified: stable/10/sys/dev/ixgbe/ixgbe.c ============================================================================== --- stable/10/sys/dev/ixgbe/ixgbe.c Sun Jul 20 00:34:54 2014 (r268903) +++ stable/10/sys/dev/ixgbe/ixgbe.c Sun Jul 20 02:15:14 2014 (r268904) @@ -306,7 +306,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, num_queues, static int ixgbe_txd = PERFORM_TXD; TUNABLE_INT("hw.ixgbe.txd", &ixgbe_txd); SYSCTL_INT(_hw_ix, OID_AUTO, txd, CTLFLAG_RDTUN, &ixgbe_txd, 0, - "Number of receive descriptors per queue"); + "Number of transmit descriptors per queue"); /* Number of RX descriptors per ring */ static int ixgbe_rxd = PERFORM_RXD; From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 02:20:04 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C804CFF; Sun, 20 Jul 2014 02:20:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4964D2496; Sun, 20 Jul 2014 02:20:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K2K4KU030640; Sun, 20 Jul 2014 02:20:04 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K2K4ZE030639; Sun, 20 Jul 2014 02:20:04 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201407200220.s6K2K4ZE030639@svn.freebsd.org> From: Hiren Panchasara Date: Sun, 20 Jul 2014 02:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268905 - stable/9/sys/dev/ixgbe X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 02:20:04 -0000 Author: hiren Date: Sun Jul 20 02:20:03 2014 New Revision: 268905 URL: http://svnweb.freebsd.org/changeset/base/268905 Log: MFC r268790 Fix a typo. Modified: stable/9/sys/dev/ixgbe/ixgbe.c Modified: stable/9/sys/dev/ixgbe/ixgbe.c ============================================================================== --- stable/9/sys/dev/ixgbe/ixgbe.c Sun Jul 20 02:15:14 2014 (r268904) +++ stable/9/sys/dev/ixgbe/ixgbe.c Sun Jul 20 02:20:03 2014 (r268905) @@ -306,7 +306,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, num_queues, static int ixgbe_txd = PERFORM_TXD; TUNABLE_INT("hw.ixgbe.txd", &ixgbe_txd); SYSCTL_INT(_hw_ix, OID_AUTO, txd, CTLFLAG_RDTUN, &ixgbe_txd, 0, - "Number of receive descriptors per queue"); + "Number of transmit descriptors per queue"); /* Number of RX descriptors per ring */ static int ixgbe_rxd = PERFORM_RXD; From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 02:38:59 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FB22183; Sun, 20 Jul 2014 02:38:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C7D925E6; Sun, 20 Jul 2014 02:38:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K2cwfa039649; Sun, 20 Jul 2014 02:38:58 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K2cwdd039648; Sun, 20 Jul 2014 02:38:58 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201407200238.s6K2cwdd039648@svn.freebsd.org> From: Hiren Panchasara Date: Sun, 20 Jul 2014 02:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268906 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 02:38:59 -0000 Author: hiren Date: Sun Jul 20 02:38:58 2014 New Revision: 268906 URL: http://svnweb.freebsd.org/changeset/base/268906 Log: MFC r250764 Fix rte leak introduced in r248070. Modified: stable/9/sys/net/route.c Modified: stable/9/sys/net/route.c ============================================================================== --- stable/9/sys/net/route.c Sun Jul 20 02:20:03 2014 (r268905) +++ stable/9/sys/net/route.c Sun Jul 20 02:38:58 2014 (r268906) @@ -1638,7 +1638,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int info.rti_ifa = NULL; info.rti_flags = RTF_RNH_LOCKED; - error = rtrequest1_fib(RTM_DELETE, &info, &rt, fibnum); + error = rtrequest1_fib(RTM_DELETE, &info, NULL, fibnum); if (error == 0) { info.rti_ifa = ifa; info.rti_flags = flags | RTF_RNH_LOCKED | From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 03:28:44 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60447929 for ; Sun, 20 Jul 2014 03:28:44 +0000 (UTC) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com [209.85.215.52]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D89172A16 for ; Sun, 20 Jul 2014 03:28:43 +0000 (UTC) Received: by mail-la0-f52.google.com with SMTP id e16so3817544lan.25 for ; Sat, 19 Jul 2014 20:28:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=y8heppdZLvTyYt8ENQOO4NkYq7EOkydV1vD+FfrAuq8=; b=I6GUxcAOS/FvtOZZBTSAcLSqdcQXHgb4fce00QQAAQBCeT0lo65TEoRh3FbSwKafIU cEo03jGPsBC+qvubOeOyh0Vg65dpBww9mFAzfCIhYexuUKV7z9klQ+FRNhyEaeYft6oO TF+Vt05XeRMRn+99Nbut1Y/PurdYJEoE7aJ//wTpVBqykhmRqaHOE4t4exhOs1qSMeBr qEh5QRiNGjwcLpe1V1w+vPwtDBVsBoXFV64sJt7DLbN7Bn+MZNJOfjDQpXYZkCJrE3ZD MfH7QlUAEVF4WctBMhrrKVMa9LhnS1ar4m6KMs1D2cOxc8lLTdHds4M6lLNMB7HG7ge4 A8ZA== X-Gm-Message-State: ALoCoQkpKgIVKZc2je9Tv5vaeju/oBVQLtAuZME+FNE/c5bUL3a9mPQHfCfJBcLv2DN3uto1Lui8 X-Received: by 10.112.84.199 with SMTP id b7mr14953226lbz.25.1405826915022; Sat, 19 Jul 2014 20:28:35 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id q8sm17658470lbr.28.2014.07.19.20.28.33 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 19 Jul 2014 20:28:34 -0700 (PDT) Message-ID: <53CB3760.5050008@freebsd.org> Date: Sun, 20 Jul 2014 07:28:32 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r268896 - in stable/10: contrib/libucl contrib/libucl/cmake contrib/libucl/doc contrib/libucl/include contrib/libucl/src contrib/libucl/tests contrib/libucl/tests/basic contrib/libucl/t... References: <201407192344.s6JNiwhg052804@svn.freebsd.org> In-Reply-To: <201407192344.s6JNiwhg052804@svn.freebsd.org> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 03:28:44 -0000 On 20.07.2014 3:44, Baptiste Daroussin wrote: > Adapt pkg(7) to the new libucl API There is no -lm added, as result: cc -O2 -pipe -march=core2 -I/usr/src/usr.sbin/pkg/../../contrib/libucl/include -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wmissing-variable-declarations -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -L/usr/lib/private -rpath /usr/lib/private -o pkg pkg.o dns_utils.o config.o -larchive -lelf -lfetch -lucl -lsbuf -lssl -lcrypto /usr/lib/private/libucl.so: undefined reference to `remainder' cc: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1 Stop. make: stopped in /usr/src/usr.sbin/pkg -- http://ache.vniz.net/ From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 06:03:53 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71003B45; Sun, 20 Jul 2014 06:03:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5286024E9; Sun, 20 Jul 2014 06:03:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K63rde040455; Sun, 20 Jul 2014 06:03:53 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K63rwQ040454; Sun, 20 Jul 2014 06:03:53 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201407200603.s6K63rwQ040454@svn.freebsd.org> From: Don Lewis Date: Sun, 20 Jul 2014 06:03:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r268908 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 06:03:53 -0000 Author: truckman Date: Sun Jul 20 06:03:52 2014 New Revision: 268908 URL: http://svnweb.freebsd.org/changeset/base/268908 Log: MFC r268373 Declaration whitespace changes for style(9). Modified: stable/8/sys/kern/subr_rman.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/subr_rman.c ============================================================================== --- stable/8/sys/kern/subr_rman.c Sun Jul 20 04:11:18 2014 (r268907) +++ stable/8/sys/kern/subr_rman.c Sun Jul 20 06:03:52 2014 (r268908) @@ -94,12 +94,12 @@ struct resource_i { u_long r_end; /* index of the last entry (inclusive) */ u_int r_flags; void *r_virtual; /* virtual address of this resource */ - struct device *r_dev; /* device which has allocated this resource */ - struct rman *r_rm; /* resource manager from whence this came */ + struct device *r_dev; /* device which has allocated this resource */ + struct rman *r_rm; /* resource manager from whence this came */ int r_rid; /* optional rid for this resource. */ }; -static int rman_debug = 0; +static int rman_debug = 0; TUNABLE_INT("debug.rman_debug", &rman_debug); SYSCTL_INT(_debug, OID_AUTO, rman_debug, CTLFLAG_RW, &rman_debug, 0, "rman debug"); @@ -108,12 +108,12 @@ SYSCTL_INT(_debug, OID_AUTO, rman_debug, static MALLOC_DEFINE(M_RMAN, "rman", "Resource manager"); -struct rman_head rman_head; -static struct mtx rman_mtx; /* mutex to protect rman_head */ -static int int_rman_activate_resource(struct rman *rm, struct resource_i *r, +struct rman_head rman_head; +static struct mtx rman_mtx; /* mutex to protect rman_head */ +static int int_rman_activate_resource(struct rman *rm, struct resource_i *r, struct resource_i **whohas); -static int int_rman_deactivate_resource(struct resource_i *r); -static int int_rman_release_resource(struct rman *rm, struct resource_i *r); +static int int_rman_deactivate_resource(struct resource_i *r); +static int int_rman_release_resource(struct rman *rm, struct resource_i *r); static __inline struct resource_i * int_alloc_resource(int malloc_flag) @@ -312,8 +312,8 @@ rman_last_free_region(struct rman *rm, u int rman_adjust_resource(struct resource *rr, u_long start, u_long end) { - struct resource_i *r, *s, *t, *new; - struct rman *rm; + struct resource_i *r, *s, *t, *new; + struct rman *rm; /* Not supported for shared resources. */ r = rr->__r_i; @@ -434,12 +434,12 @@ rman_adjust_resource(struct resource *rr struct resource * rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end, - u_long count, u_long bound, u_int flags, - struct device *dev) + u_long count, u_long bound, u_int flags, + struct device *dev) { - u_int new_rflags; - struct resource_i *r, *s, *rv; - u_long rstart, rend, amask, bmask; + u_int new_rflags; + struct resource_i *r, *s, *rv; + u_long rstart, rend, amask, bmask; rv = NULL; @@ -716,9 +716,9 @@ rman_activate_resource(struct resource * int rman_await_resource(struct resource *re, int pri, int timo) { - int rv; - struct resource_i *r, *whohas; - struct rman *rm; + int rv; + struct resource_i *r, *whohas; + struct rman *rm; r = re->__r_i; rm = r->r_rm; @@ -754,7 +754,7 @@ int_rman_deactivate_resource(struct reso int rman_deactivate_resource(struct resource *r) { - struct rman *rm; + struct rman *rm; rm = r->__r_i->r_rm; mtx_lock(rm->rm_mtx); @@ -766,7 +766,7 @@ rman_deactivate_resource(struct resource static int int_rman_release_resource(struct rman *rm, struct resource_i *r) { - struct resource_i *s, *t; + struct resource_i *s, *t; if (r->r_flags & RF_ACTIVE) int_rman_deactivate_resource(r); @@ -860,9 +860,9 @@ out: int rman_release_resource(struct resource *re) { - int rv; - struct resource_i *r; - struct rman *rm; + int rv; + struct resource_i *r; + struct rman *rm; r = re->__r_i; rm = r->r_rm; @@ -875,7 +875,7 @@ rman_release_resource(struct resource *r uint32_t rman_make_alignment_flags(uint32_t size) { - int i; + int i; /* * Find the hightest bit set, and add one if more than one bit @@ -893,96 +893,112 @@ rman_make_alignment_flags(uint32_t size) void rman_set_start(struct resource *r, u_long start) { + r->__r_i->r_start = start; } u_long rman_get_start(struct resource *r) { + return (r->__r_i->r_start); } void rman_set_end(struct resource *r, u_long end) { + r->__r_i->r_end = end; } u_long rman_get_end(struct resource *r) { + return (r->__r_i->r_end); } u_long rman_get_size(struct resource *r) { + return (r->__r_i->r_end - r->__r_i->r_start + 1); } u_int rman_get_flags(struct resource *r) { + return (r->__r_i->r_flags); } void rman_set_virtual(struct resource *r, void *v) { + r->__r_i->r_virtual = v; } void * rman_get_virtual(struct resource *r) { + return (r->__r_i->r_virtual); } void rman_set_bustag(struct resource *r, bus_space_tag_t t) { + r->r_bustag = t; } bus_space_tag_t rman_get_bustag(struct resource *r) { + return (r->r_bustag); } void rman_set_bushandle(struct resource *r, bus_space_handle_t h) { + r->r_bushandle = h; } bus_space_handle_t rman_get_bushandle(struct resource *r) { + return (r->r_bushandle); } void rman_set_rid(struct resource *r, int rid) { + r->__r_i->r_rid = rid; } int rman_get_rid(struct resource *r) { + return (r->__r_i->r_rid); } void rman_set_device(struct resource *r, struct device *dev) { + r->__r_i->r_dev = dev; } struct device * rman_get_device(struct resource *r) { + return (r->__r_i->r_dev); } From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 07:35:00 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D4C4C7F3; Sun, 20 Jul 2014 07:35:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C16B02AEC; Sun, 20 Jul 2014 07:35:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6K7Z08F082895; Sun, 20 Jul 2014 07:35:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6K7Z0qb082892; Sun, 20 Jul 2014 07:35:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407200735.s6K7Z0qb082892@svn.freebsd.org> From: Alexander Motin Date: Sun, 20 Jul 2014 07:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268910 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 07:35:00 -0000 Author: mav Date: Sun Jul 20 07:35:00 2014 New Revision: 268910 URL: http://svnweb.freebsd.org/changeset/base/268910 Log: MFC r268795: Fix ctld crash on startup if target alias is not set. Modified: stable/10/usr.sbin/ctld/kernel.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/kernel.c ============================================================================== --- stable/10/usr.sbin/ctld/kernel.c Sun Jul 20 07:31:55 2014 (r268909) +++ stable/10/usr.sbin/ctld/kernel.c Sun Jul 20 07:35:00 2014 (r268910) @@ -851,9 +851,12 @@ kernel_port_add(struct target *targ) req.args[0].value = &port_id; req.args[0].flags = CTL_BEARG_WR; str_arg(&req.args[1], "cfiscsi_target", targ->t_name); - str_arg(&req.args[2], "cfiscsi_target_alias", targ->t_alias); snprintf(tagstr, sizeof(tagstr), "%d", targ->t_portal_group->pg_tag); - str_arg(&req.args[3], "cfiscsi_portal_group_tag", tagstr); + str_arg(&req.args[2], "cfiscsi_portal_group_tag", tagstr); + if (targ->t_alias) + str_arg(&req.args[3], "cfiscsi_target_alias", targ->t_alias); + else + req.num_args--; error = ioctl(ctl_fd, CTL_PORT_REQ, &req); free(req.args); From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 10:54:46 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2368E581; Sun, 20 Jul 2014 10:54:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D1AC28C4; Sun, 20 Jul 2014 10:54:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6KAsjQh079345; Sun, 20 Jul 2014 10:54:45 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6KAsjUZ079344; Sun, 20 Jul 2014 10:54:45 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407201054.s6KAsjUZ079344@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 20 Jul 2014 10:54:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268918 - stable/10/usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 10:54:46 -0000 Author: bapt Date: Sun Jul 20 10:54:45 2014 New Revision: 268918 URL: http://svnweb.freebsd.org/changeset/base/268918 Log: MFC: r263650, r263686 Add missing dependency on libm Modified: stable/10/usr.sbin/pkg/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pkg/Makefile ============================================================================== --- stable/10/usr.sbin/pkg/Makefile Sun Jul 20 08:43:53 2014 (r268917) +++ stable/10/usr.sbin/pkg/Makefile Sun Jul 20 10:54:45 2014 (r268918) @@ -7,8 +7,8 @@ MAN= pkg.7 CFLAGS+=-I${.CURDIR}/../../contrib/libucl/include .PATH: ${.CURDIR}/../../contrib/libucl/include DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBUCL} ${LIBSBUF} ${LIBSSL} \ - ${LIBCRYPTO} -LDADD= -larchive -lelf -lfetch -lucl -lsbuf -lssl -lcrypto + ${LIBCRYPTO} ${LIBM} +LDADD= -larchive -lelf -lfetch -lucl -lsbuf -lssl -lcrypto -lm USEPRIVATELIB= ucl .include From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 11:00:51 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A31D575A; Sun, 20 Jul 2014 11:00:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F1E628EB; Sun, 20 Jul 2014 11:00:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6KB0pHI081440; Sun, 20 Jul 2014 11:00:51 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6KB0pR0081439; Sun, 20 Jul 2014 11:00:51 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407201100.s6KB0pR0081439@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 20 Jul 2014 11:00:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268919 - stable/9/usr.sbin/pkg X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 11:00:51 -0000 Author: bapt Date: Sun Jul 20 11:00:51 2014 New Revision: 268919 URL: http://svnweb.freebsd.org/changeset/base/268919 Log: MFC: r263650, r263686 Add missing dependency on libm Modified: stable/9/usr.sbin/pkg/Makefile Directory Properties: stable/9/usr.sbin/pkg/ (props changed) Modified: stable/9/usr.sbin/pkg/Makefile ============================================================================== --- stable/9/usr.sbin/pkg/Makefile Sun Jul 20 10:54:45 2014 (r268918) +++ stable/9/usr.sbin/pkg/Makefile Sun Jul 20 11:00:51 2014 (r268919) @@ -7,8 +7,8 @@ MAN= pkg.7 CFLAGS+=-I${.CURDIR}/../../contrib/libucl/include .PATH: ${.CURDIR}/../../contrib/libucl/include DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBUCL} ${LIBSBUF} ${LIBSSL} \ - ${LIBCRYPTO} -LDADD= -larchive -lelf -lfetch -lucl -lsbuf -lssl -lcrypto + ${LIBCRYPTO} ${LIBM} +LDADD= -larchive -lelf -lfetch -lucl -lsbuf -lssl -lcrypto -lm USEPRIVATELIB= ucl .include From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 11:08:40 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 107808FE; Sun, 20 Jul 2014 11:08:40 +0000 (UTC) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 04F88299E; Sun, 20 Jul 2014 11:08:38 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id hi2so2775427wib.16 for ; Sun, 20 Jul 2014 04:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=hUwdBCFPuv/I1c49jfw8uVbtyJaUVsRqIfPyHSDdWIw=; b=1G0rbW8oexxXATtn1xqFfqMd80SUtMqfOzM09KoDmQDWuzW8Iit4ivWWyMhX/8DeLQ XV8jXFRKikUEtMQSNJ1Qe8e1BaRvAEN80KQD+SXs0yNqvAXIPYhwaQQbstoEaR2mzcmM qm33tBaZu+xE9TL8uIbNaki4ALYaaeCmEIGhIkobvsrgGPwB6DXhn0e2KLQ/6LItlKnc iEbTxvLPctrV6d3rw0cQwbRAquSW/n+doXuQGl/DmOdzQwhJzTr/gJZY+FzbQJVlqCGQ Bx1wknTMxRyb2lHIOAqokWu51pBJhEYWskEDdxQKhpl6vG52dJ6h6Vtz/4rpn6gprBN9 y/Zg== X-Received: by 10.194.90.201 with SMTP id by9mr12299073wjb.94.1405854517226; Sun, 20 Jul 2014 04:08:37 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id pl1sm6855032wic.17.2014.07.20.04.08.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Jul 2014 04:08:36 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 20 Jul 2014 13:08:34 +0200 From: Baptiste Daroussin To: Andrey Chernov Subject: Re: svn commit: r268896 - in stable/10: contrib/libucl contrib/libucl/cmake contrib/libucl/doc contrib/libucl/include contrib/libucl/src contrib/libucl/tests contrib/libucl/tests/basic contrib/libucl/t... Message-ID: <20140720110834.GC26778@ivaldir.etoilebsd.net> References: <201407192344.s6JNiwhg052804@svn.freebsd.org> <53CB3760.5050008@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9Ek0hoCL9XbhcSqy" Content-Disposition: inline In-Reply-To: <53CB3760.5050008@freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 11:08:40 -0000 --9Ek0hoCL9XbhcSqy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jul 20, 2014 at 07:28:32AM +0400, Andrey Chernov wrote: > On 20.07.2014 3:44, Baptiste Daroussin wrote: > > Adapt pkg(7) to the new libucl API >=20 this is fixed, sorry about, I forgot 2 ci in this MFC Bapt --9Ek0hoCL9XbhcSqy Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlPLozIACgkQ8kTtMUmk6ExGswCfZABXAC4ntD341nwvxTv3aSof x4QAni37hbMBFjMH/afhimLtcLmB61yh =rm7E -----END PGP SIGNATURE----- --9Ek0hoCL9XbhcSqy-- From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 22:54:05 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1BD2D641; Sun, 20 Jul 2014 22:54:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0A2625A9; Sun, 20 Jul 2014 22:54:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6KMs4aR028758; Sun, 20 Jul 2014 22:54:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6KMs3xn028748; Sun, 20 Jul 2014 22:54:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407202254.s6KMs3xn028748@svn.freebsd.org> From: John Baldwin Date: Sun, 20 Jul 2014 22:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268932 - in stable/10: sys/boot/userboot sys/boot/userboot/userboot sys/boot/userboot/zfs usr.sbin/bhyveload X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 22:54:05 -0000 Author: jhb Date: Sun Jul 20 22:54:03 2014 New Revision: 268932 URL: http://svnweb.freebsd.org/changeset/base/268932 Log: MFC 262331,262487,262495,262523: ZFS boot support for bhyveload. Added: stable/10/sys/boot/userboot/zfs/ - copied from r262331, head/sys/boot/userboot/zfs/ Modified: stable/10/sys/boot/userboot/Makefile stable/10/sys/boot/userboot/userboot/Makefile stable/10/sys/boot/userboot/userboot/conf.c stable/10/sys/boot/userboot/userboot/devicename.c stable/10/sys/boot/userboot/userboot/main.c stable/10/usr.sbin/bhyveload/bhyveload.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/userboot/Makefile ============================================================================== --- stable/10/sys/boot/userboot/Makefile Sun Jul 20 22:13:51 2014 (r268931) +++ stable/10/sys/boot/userboot/Makefile Sun Jul 20 22:54:03 2014 (r268932) @@ -2,7 +2,7 @@ .include -SUBDIR= ficl libstand test userboot +SUBDIR= ficl libstand test zfs userboot .include Modified: stable/10/sys/boot/userboot/userboot/Makefile ============================================================================== --- stable/10/sys/boot/userboot/userboot/Makefile Sun Jul 20 22:13:51 2014 (r268931) +++ stable/10/sys/boot/userboot/userboot/Makefile Sun Jul 20 22:54:03 2014 (r268932) @@ -51,12 +51,17 @@ LIBFICL= ${.OBJDIR}/../ficl/libficl.a LIBSTAND= ${.OBJDIR}/../libstand/libstand.a .endif +.if ${MK_ZFS} != "no" +CFLAGS+= -DUSERBOOT_ZFS_SUPPORT +LIBZFSBOOT= ${.OBJDIR}/../zfs/libzfsboot.a +.endif + # Always add MI sources .PATH: ${.CURDIR}/../../common .include "${.CURDIR}/../../common/Makefile.inc" CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -DPADD= ${LIBFICL} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBSTAND} +DPADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND} +LDADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND} .include Modified: stable/10/sys/boot/userboot/userboot/conf.c ============================================================================== --- stable/10/sys/boot/userboot/userboot/conf.c Sun Jul 20 22:13:51 2014 (r268931) +++ stable/10/sys/boot/userboot/userboot/conf.c Sun Jul 20 22:54:03 2014 (r268932) @@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" +#if defined(USERBOOT_ZFS_SUPPORT) +#include "../zfs/libzfs.h" +#endif + /* * We could use linker sets for some or all of these, but * then we would have to control what ended up linked into @@ -51,6 +55,9 @@ __FBSDID("$FreeBSD$"); struct devsw *devsw[] = { &host_dev, &userboot_disk, +#if defined(USERBOOT_ZFS_SUPPORT) + &zfs_dev, +#endif NULL }; @@ -59,6 +66,9 @@ struct fs_ops *file_system[] = { &ufs_fsops, &cd9660_fsops, &gzipfs_fsops, +#if defined(USERBOOT_ZFS_SUPPORT) + &zfs_fsops, +#endif NULL }; Modified: stable/10/sys/boot/userboot/userboot/devicename.c ============================================================================== --- stable/10/sys/boot/userboot/userboot/devicename.c Sun Jul 20 22:13:51 2014 (r268931) +++ stable/10/sys/boot/userboot/userboot/devicename.c Sun Jul 20 22:54:03 2014 (r268932) @@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$"); #include "disk.h" #include "libuserboot.h" +#if defined(USERBOOT_ZFS_SUPPORT) +#include "../zfs/libzfs.h" +#endif + static int userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **path); /* @@ -119,7 +123,6 @@ userboot_parsedev(struct disk_devdesc ** case DEVT_CD: case DEVT_NET: - case DEVT_ZFS: unit = 0; if (*np && (*np != ':')) { @@ -141,6 +144,16 @@ userboot_parsedev(struct disk_devdesc ** *path = (*cp == 0) ? cp : cp + 1; break; + case DEVT_ZFS: +#if defined(USERBOOT_ZFS_SUPPORT) + err = zfs_parsedev((struct zfs_devdesc *)idev, np, path); + if (err != 0) + goto fail; + break; +#else + /* FALLTHROUGH */ +#endif + default: err = EINVAL; goto fail; @@ -179,8 +192,15 @@ userboot_fmtdev(void *vdev) return (disk_fmtdev(vdev)); case DEVT_NET: + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); + break; + case DEVT_ZFS: +#if defined(USERBOOT_ZFS_SUPPORT) + return (zfs_fmtdev(vdev)); +#else sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); +#endif break; } return(buf); Modified: stable/10/sys/boot/userboot/userboot/main.c ============================================================================== --- stable/10/sys/boot/userboot/userboot/main.c Sun Jul 20 22:13:51 2014 (r268931) +++ stable/10/sys/boot/userboot/userboot/main.c Sun Jul 20 22:54:03 2014 (r268932) @@ -36,8 +36,17 @@ __FBSDID("$FreeBSD$"); #include "disk.h" #include "libuserboot.h" +#if defined(USERBOOT_ZFS_SUPPORT) +#include "../zfs/libzfs.h" + +static void userboot_zfs_probe(void); +static int userboot_zfs_found; +#endif + #define USERBOOT_VERSION USERBOOT_VERSION_3 +#define MALLOCSZ (10*1024*1024) + struct loader_callbacks *callbacks; void *callbacks_arg; @@ -69,7 +78,7 @@ exit(int v) void loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks) { - static char malloc[1024*1024]; + static char mallocbuf[MALLOCSZ]; const char *var; int i; @@ -82,23 +91,15 @@ loader_main(struct loader_callbacks *cb, /* * initialise the heap as early as possible. Once this is done, - * alloc() is usable. The stack is buried inside us, so this is - * safe. + * alloc() is usable. */ - setheap((void *)malloc, (void *)(malloc + 1024*1024)); + setheap((void *)mallocbuf, (void *)(mallocbuf + sizeof(mallocbuf))); /* * Hook up the console */ cons_probe(); - /* - * March through the device switch probing for things. - */ - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); - printf("\n"); printf("%s, Revision %s\n", bootprog_name, bootprog_rev); printf("(%s, %s)\n", bootprog_maker, bootprog_date); @@ -124,6 +125,16 @@ loader_main(struct loader_callbacks *cb, archsw.arch_copyin = userboot_copyin; archsw.arch_copyout = userboot_copyout; archsw.arch_readin = userboot_readin; +#if defined(USERBOOT_ZFS_SUPPORT) + archsw.arch_zfs_probe = userboot_zfs_probe; +#endif + + /* + * March through the device switch probing for things. + */ + for (i = 0; devsw[i] != NULL; i++) + if (devsw[i]->dv_init != NULL) + (devsw[i]->dv_init)(); extract_currdev(); @@ -146,6 +157,19 @@ extract_currdev(void) //bzero(&dev, sizeof(dev)); +#if defined(USERBOOT_ZFS_SUPPORT) + if (userboot_zfs_found) { + struct zfs_devdesc zdev; + + /* Leave the pool/root guid's unassigned */ + bzero(&zdev, sizeof(zdev)); + zdev.d_dev = &zfs_dev; + zdev.d_type = zdev.d_dev->dv_type; + + dev = *(struct disk_devdesc *)&zdev; + } else +#endif + if (userboot_disk_maxunit > 0) { dev.d_dev = &userboot_disk; dev.d_type = dev.d_dev->dv_type; @@ -172,6 +196,49 @@ extract_currdev(void) env_noset, env_nounset); } +#if defined(USERBOOT_ZFS_SUPPORT) +static void +userboot_zfs_probe(void) +{ + char devname[32]; + uint64_t pool_guid; + int unit; + + /* + * Open all the disks we can find and see if we can reconstruct + * ZFS pools from them. Record if any were found. + */ + for (unit = 0; unit < userboot_disk_maxunit; unit++) { + sprintf(devname, "disk%d:", unit); + pool_guid = 0; + zfs_probe_dev(devname, &pool_guid); + if (pool_guid != 0) + userboot_zfs_found = 1; + } +} + +COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", + command_lszfs); + +static int +command_lszfs(int argc, char *argv[]) +{ + int err; + + if (argc != 2) { + command_errmsg = "a single dataset must be supplied"; + return (CMD_ERROR); + } + + err = zfs_list(argv[1]); + if (err != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } + return (CMD_OK); +} +#endif /* USERBOOT_ZFS_SUPPORT */ + COMMAND_SET(quit, "quit", "exit the loader", command_quit); static int Modified: stable/10/usr.sbin/bhyveload/bhyveload.c ============================================================================== --- stable/10/usr.sbin/bhyveload/bhyveload.c Sun Jul 20 22:13:51 2014 (r268931) +++ stable/10/usr.sbin/bhyveload/bhyveload.c Sun Jul 20 22:54:03 2014 (r268932) @@ -88,9 +88,12 @@ __FBSDID("$FreeBSD$"); #define GB (1024 * 1024 * 1024UL) #define BSP 0 +#define NDISKS 32 + static char *host_base; static struct termios term, oldterm; -static int disk_fd = -1; +static int disk_fd[NDISKS]; +static int ndisks; static int consin_fd, consout_fd; static char *vmname, *progname; @@ -287,9 +290,9 @@ cb_diskread(void *arg, int unit, uint64_ { ssize_t n; - if (unit != 0 || disk_fd == -1) + if (unit < 0 || unit >= ndisks ) return (EIO); - n = pread(disk_fd, to, size, from); + n = pread(disk_fd[unit], to, size, from); if (n < 0) return (errno); *resid = size - n; @@ -301,7 +304,7 @@ cb_diskioctl(void *arg, int unit, u_long { struct stat sb; - if (unit != 0 || disk_fd == -1) + if (unit < 0 || unit >= ndisks) return (EBADF); switch (cmd) { @@ -309,7 +312,7 @@ cb_diskioctl(void *arg, int unit, u_long *(u_int *)data = 512; break; case DIOCGMEDIASIZE: - if (fstat(disk_fd, &sb) == 0) + if (fstat(disk_fd[unit], &sb) == 0) *(off_t *)data = sb.st_size; else return (ENOTTY); @@ -601,6 +604,26 @@ altcons_open(char *path) return (err); } +static int +disk_open(char *path) +{ + int err, fd; + + if (ndisks > NDISKS) + return (ERANGE); + + err = 0; + fd = open(path, O_RDONLY); + + if (fd > 0) { + disk_fd[ndisks] = fd; + ndisks++; + } else + err = errno; + + return (err); +} + static void usage(void) { @@ -620,12 +643,10 @@ main(int argc, char** argv) void (*func)(struct loader_callbacks *, void *, int, int); uint64_t mem_size; int opt, error; - char *disk_image; progname = basename(argv[0]); mem_size = 256 * MB; - disk_image = NULL; consin_fd = STDIN_FILENO; consout_fd = STDOUT_FILENO; @@ -637,8 +658,11 @@ main(int argc, char** argv) if (error != 0) errx(EX_USAGE, "Could not open '%s'", optarg); break; + case 'd': - disk_image = optarg; + error = disk_open(optarg); + if (error != 0) + errx(EX_USAGE, "Could not open '%s'", optarg); break; case 'e': @@ -704,12 +728,8 @@ main(int argc, char** argv) return (1); } - if (disk_image) { - disk_fd = open(disk_image, O_RDONLY); - } - addenv("smbios.bios.vendor=BHYVE"); addenv("boot_serial=1"); - func(&cb, NULL, USERBOOT_VERSION_3, disk_fd >= 0); + func(&cb, NULL, USERBOOT_VERSION_3, ndisks); } From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 00:22:00 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31048872; Mon, 21 Jul 2014 00:22:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00AEF2D42; Mon, 21 Jul 2014 00:22:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6L0LxET072265; Mon, 21 Jul 2014 00:21:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6L0Lv1W072248; Mon, 21 Jul 2014 00:21:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407210021.s6L0Lv1W072248@svn.freebsd.org> From: John Baldwin Date: Mon, 21 Jul 2014 00:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268933 - in stable/10: share/man/man4 sys/amd64/conf sys/conf sys/dev/virtio/random sys/i386/conf sys/modules/virtio sys/modules/virtio/random sys/sys usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 00:22:00 -0000 Author: jhb Date: Mon Jul 21 00:21:56 2014 New Revision: 268933 URL: http://svnweb.freebsd.org/changeset/base/268933 Log: MFC 260847,264055,264867: - Add a very simple virtio_random(4) driver for FreeBSD guests to harvest entropy from hypervisors. - Add support to bhyve for the virtio RNG entropy-source device to provide entry to bhyve guests. Added: stable/10/share/man/man4/virtio_random.4 - copied unchanged from r260847, head/share/man/man4/virtio_random.4 stable/10/sys/dev/virtio/random/ - copied from r260847, head/sys/dev/virtio/random/ stable/10/sys/modules/virtio/random/ - copied from r260847, head/sys/modules/virtio/random/ stable/10/usr.sbin/bhyve/pci_virtio_rnd.c - copied unchanged from r264055, head/usr.sbin/bhyve/pci_virtio_rnd.c Modified: stable/10/share/man/man4/Makefile stable/10/sys/amd64/conf/NOTES stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/virtio/random/virtio_random.c stable/10/sys/i386/conf/NOTES stable/10/sys/modules/virtio/Makefile stable/10/sys/sys/random.h stable/10/usr.sbin/bhyve/Makefile stable/10/usr.sbin/bhyve/bhyve.8 stable/10/usr.sbin/bhyve/virtio.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/share/man/man4/Makefile Mon Jul 21 00:21:56 2014 (r268933) @@ -555,6 +555,7 @@ MAN= aac.4 \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ + ${_virtio_random.4} \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ @@ -804,6 +805,7 @@ _nxge.4= nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 +_virtio_random.4= virtio_random.4 _virtio_scsi.4= virtio_scsi.4 _vmx.4= vmx.4 _vtnet.4= vtnet.4 Copied: stable/10/share/man/man4/virtio_random.4 (from r260847, head/share/man/man4/virtio_random.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/man/man4/virtio_random.4 Mon Jul 21 00:21:56 2014 (r268933, copy of r260847, head/share/man/man4/virtio_random.4) @@ -0,0 +1,61 @@ +.\" Copyright (c) 2013 Bryan Venteicher +.\" 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 AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 28, 2013 +.Dt VIRTIO_RANDOM 4 +.Os +.Sh NAME +.Nm virtio_random +.Nd VirtIO Entropy driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device virtio_random" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +virtio_random_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for VirtIO entropy devices. +.Pp +The entropy device supplies high-quality randomness from the +hypervisor to the guest. +.Sh SEE ALSO +.Xr random 4 +.Xr virtio 4 +.Sh HISTORY +The +.Nm +driver was written by +.An Bryan Venteicher Aq bryanv@FreeBSD.org . Modified: stable/10/sys/amd64/conf/NOTES ============================================================================== --- stable/10/sys/amd64/conf/NOTES Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/sys/amd64/conf/NOTES Mon Jul 21 00:21:56 2014 (r268933) @@ -472,6 +472,7 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device +device virtio_random # VirtIO Entropy device device hyperv # HyperV drivers Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/sys/conf/files.amd64 Mon Jul 21 00:21:56 2014 (r268933) @@ -448,6 +448,7 @@ dev/virtio/network/if_vtnet.c optional dev/virtio/block/virtio_blk.c optional virtio_blk dev/virtio/balloon/virtio_balloon.c optional virtio_balloon dev/virtio/scsi/virtio_scsi.c optional virtio_scsi +dev/virtio/random/virtio_random.c optional virtio_random isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_binmisc.c optional imagact_binmisc Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/sys/conf/files.i386 Mon Jul 21 00:21:56 2014 (r268933) @@ -413,6 +413,7 @@ dev/virtio/network/if_vtnet.c optional dev/virtio/block/virtio_blk.c optional virtio_blk dev/virtio/balloon/virtio_balloon.c optional virtio_balloon dev/virtio/scsi/virtio_scsi.c optional virtio_scsi +dev/virtio/random/virtio_random.c optional virtio_random i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \ Modified: stable/10/sys/dev/virtio/random/virtio_random.c ============================================================================== --- head/sys/dev/virtio/random/virtio_random.c Sat Jan 18 06:14:38 2014 (r260847) +++ stable/10/sys/dev/virtio/random/virtio_random.c Mon Jul 21 00:21:56 2014 (r268933) @@ -156,7 +156,7 @@ vtrnd_detach(device_t dev) sc = device_get_softc(dev); - callout_stop(&sc->vtrnd_callout); + callout_drain(&sc->vtrnd_callout); return (0); } Modified: stable/10/sys/i386/conf/NOTES ============================================================================== --- stable/10/sys/i386/conf/NOTES Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/sys/i386/conf/NOTES Mon Jul 21 00:21:56 2014 (r268933) @@ -800,6 +800,7 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device +device virtio_random # VirtIO Entropy device device hyperv # HyperV drivers Modified: stable/10/sys/modules/virtio/Makefile ============================================================================== --- stable/10/sys/modules/virtio/Makefile Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/sys/modules/virtio/Makefile Mon Jul 21 00:21:56 2014 (r268933) @@ -23,6 +23,6 @@ # SUCH DAMAGE. # -SUBDIR= virtio pci network block balloon scsi +SUBDIR= virtio pci network block balloon scsi random .include Modified: stable/10/sys/sys/random.h ============================================================================== --- stable/10/sys/sys/random.h Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/sys/sys/random.h Mon Jul 21 00:21:56 2014 (r268933) @@ -56,6 +56,7 @@ enum esource { RANDOM_PURE_RDRAND, RANDOM_PURE_NEHEMIAH, RANDOM_PURE_RNDTEST, + RANDOM_PURE_VIRTIO, ENTROPYSOURCE }; void random_harvest(void *, u_int, u_int, enum esource); Modified: stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- stable/10/usr.sbin/bhyve/Makefile Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/usr.sbin/bhyve/Makefile Mon Jul 21 00:21:56 2014 (r268933) @@ -26,6 +26,7 @@ SRCS= \ pci_passthru.c \ pci_virtio_block.c \ pci_virtio_net.c \ + pci_virtio_rnd.c \ pci_uart.c \ pm.c \ pmtmr.c \ Modified: stable/10/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/10/usr.sbin/bhyve/bhyve.8 Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/usr.sbin/bhyve/bhyve.8 Mon Jul 21 00:21:56 2014 (r268933) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 27, 2014 +.Dd April 2, 2014 .Dt BHYVE 8 .Os .Sh NAME @@ -126,6 +126,8 @@ PCI pass-through device. Virtio network interface. .It Li virtio-blk Virtio block storage interface. +.It Li virtio-rnd +Virtio RNG interface. .It Li ahci-cd AHCI controller attached to an ATAPI CD/DVD. .It Li ahci-hd Copied: stable/10/usr.sbin/bhyve/pci_virtio_rnd.c (from r264055, head/usr.sbin/bhyve/pci_virtio_rnd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/bhyve/pci_virtio_rnd.c Mon Jul 21 00:21:56 2014 (r268933, copy of r264055, head/usr.sbin/bhyve/pci_virtio_rnd.c) @@ -0,0 +1,189 @@ +/*- + * Copyright (c) 2014 Nahanni Systems 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 + * in this position and unchanged. + * 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 AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * virtio entropy device emulation. + * Randomness is sourced from /dev/random which does not block + * once it has been seeded at bootup. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bhyverun.h" +#include "pci_emul.h" +#include "virtio.h" + +#define VTRND_RINGSZ 64 + + +static int pci_vtrnd_debug; +#define DPRINTF(params) if (pci_vtrnd_debug) printf params +#define WPRINTF(params) printf params + +/* + * Per-device softc + */ +struct pci_vtrnd_softc { + struct virtio_softc vrsc_vs; + struct vqueue_info vrsc_vq; + pthread_mutex_t vrsc_mtx; + uint64_t vrsc_cfg; + int vrsc_fd; +}; + +static void pci_vtrnd_reset(void *); +static void pci_vtrnd_notify(void *, struct vqueue_info *); + +static struct virtio_consts vtrnd_vi_consts = { + "vtrnd", /* our name */ + 1, /* we support 1 virtqueue */ + 0, /* config reg size */ + pci_vtrnd_reset, /* reset */ + pci_vtrnd_notify, /* device-wide qnotify */ + NULL, /* read virtio config */ + NULL, /* write virtio config */ + 0, /* our capabilities */ +}; + + +static void +pci_vtrnd_reset(void *vsc) +{ + struct pci_vtrnd_softc *sc; + + sc = vsc; + + DPRINTF(("vtrnd: device reset requested !\n")); + vi_reset_dev(&sc->vrsc_vs); +} + + +static void +pci_vtrnd_notify(void *vsc, struct vqueue_info *vq) +{ + struct iovec iov; + struct pci_vtrnd_softc *sc; + int len; + + sc = vsc; + + vq_startchains(vq); + + if (sc->vrsc_fd < 0) { + vq_endchains(vq, 0); + return; + } + + while (vq_has_descs(vq)) { + vq_getchain(vq, &iov, 1, NULL); + + len = read(sc->vrsc_fd, iov.iov_base, iov.iov_len); + + DPRINTF(("vtrnd: vtrnd_notify(): %d\r\n", len)); + + /* Catastrophe if unable to read from /dev/random */ + assert(len > 0); + + /* + * Release this chain and handle more + */ + vq_relchain(vq, len); + } + vq_endchains(vq, 1); /* Generate interrupt if appropriate. */ +} + + +static int +pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) +{ + struct pci_vtrnd_softc *sc; + int fd; + int len; + uint8_t v; + + /* + * Should always be able to open /dev/random. + */ + fd = open("/dev/random", O_RDONLY | O_NONBLOCK); + + assert(fd >= 0); + + /* + * Check that device is seeded and non-blocking. + */ + len = read(fd, &v, sizeof(v)); + if (len <= 0) { + WPRINTF(("vtrnd: /dev/random not ready, read(): %d", len)); + return (1); + } + + sc = malloc(sizeof(struct pci_vtrnd_softc)); + memset(sc, 0, sizeof(struct pci_vtrnd_softc)); + + vi_softc_linkup(&sc->vrsc_vs, &vtrnd_vi_consts, sc, pi, &sc->vrsc_vq); + sc->vrsc_vs.vs_mtx = &sc->vrsc_mtx; + + sc->vrsc_vq.vq_qsize = VTRND_RINGSZ; + + /* keep /dev/random opened while emulating */ + sc->vrsc_fd = fd; + + /* initialize config space */ + pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_RANDOM); + pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); + pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_CRYPTO); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_ENTROPY); + + if (vi_intr_init(&sc->vrsc_vs, 1, fbsdrun_virtio_msix())) + return (1); + vi_set_io_bar(&sc->vrsc_vs, 0); + + return (0); +} + + +struct pci_devemu pci_de_vrnd = { + .pe_emu = "virtio-rnd", + .pe_init = pci_vtrnd_init, + .pe_barwrite = vi_pci_write, + .pe_barread = vi_pci_read +}; +PCI_EMUL_SET(pci_de_vrnd); Modified: stable/10/usr.sbin/bhyve/virtio.h ============================================================================== --- stable/10/usr.sbin/bhyve/virtio.h Sun Jul 20 22:54:03 2014 (r268932) +++ stable/10/usr.sbin/bhyve/virtio.h Mon Jul 21 00:21:56 2014 (r268933) @@ -209,6 +209,7 @@ struct vring_used { #define VIRTIO_VENDOR 0x1AF4 #define VIRTIO_DEV_NET 0x1000 #define VIRTIO_DEV_BLOCK 0x1001 +#define VIRTIO_DEV_RANDOM 0x1002 /* * PCI config space constants. From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 02:17:29 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3E7DBF0; Mon, 21 Jul 2014 02:17:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8A7D25E3; Mon, 21 Jul 2014 02:17:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6L2HTkt024772; Mon, 21 Jul 2014 02:17:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6L2HTaK024769; Mon, 21 Jul 2014 02:17:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407210217.s6L2HTaK024769@svn.freebsd.org> From: John Baldwin Date: Mon, 21 Jul 2014 02:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268934 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 02:17:29 -0000 Author: jhb Date: Mon Jul 21 02:17:28 2014 New Revision: 268934 URL: http://svnweb.freebsd.org/changeset/base/268934 Log: MFC 264916,267611: Provide a very basic stub for the 8042 PS/2 keyboard controller. Added: stable/10/usr.sbin/bhyve/atkbdc.c - copied, changed from r264916, head/usr.sbin/bhyve/atkbdc.c Modified: stable/10/usr.sbin/bhyve/Makefile stable/10/usr.sbin/bhyve/bhyverun.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- stable/10/usr.sbin/bhyve/Makefile Mon Jul 21 00:21:56 2014 (r268933) +++ stable/10/usr.sbin/bhyve/Makefile Mon Jul 21 02:17:28 2014 (r268934) @@ -9,6 +9,7 @@ DEBUG_FLAGS= -g -O0 MAN= bhyve.8 SRCS= \ + atkbdc.c \ acpi.c \ bhyverun.c \ block_if.c \ Copied and modified: stable/10/usr.sbin/bhyve/atkbdc.c (from r264916, head/usr.sbin/bhyve/atkbdc.c) ============================================================================== --- head/usr.sbin/bhyve/atkbdc.c Fri Apr 25 13:38:18 2014 (r264916, copy source) +++ stable/10/usr.sbin/bhyve/atkbdc.c Mon Jul 21 02:17:28 2014 (r268934) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #define KBD_DATA_PORT 0x60 #define KBD_STS_CTL_PORT 0x64 -#define KDB_SYS_FLAG 0x4 +#define KBD_SYS_FLAG 0x4 #define KBDC_RESET 0xfe @@ -66,7 +66,7 @@ atkbdc_sts_ctl_handler(struct vmctx *ctx retval = INOUT_OK; if (in) { - *eax = KDB_SYS_FLAG; /* system passed POST */ + *eax = KBD_SYS_FLAG; /* system passed POST */ } else { switch (*eax) { case KBDC_RESET: /* Pulse "reset" line. */ Modified: stable/10/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.c Mon Jul 21 00:21:56 2014 (r268933) +++ stable/10/usr.sbin/bhyve/bhyverun.c Mon Jul 21 02:17:28 2014 (r268934) @@ -315,10 +315,6 @@ vmexit_inout(struct vmctx *ctx, struct v if (vme->u.inout.string || vme->u.inout.rep) return (VMEXIT_ABORT); - /* Special case of guest reset */ - if (out && port == 0x64 && (uint8_t)eax == 0xFE) - return (vmexit_catch_reset()); - /* Extra-special case of host notifications */ if (out && port == GUEST_NIO_PORT) return (vmexit_handle_notify(ctx, vme, pvcpu, eax)); From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 02:39:19 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C1DCFD8; Mon, 21 Jul 2014 02:39:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6615E2783; Mon, 21 Jul 2014 02:39:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6L2dJwH034214; Mon, 21 Jul 2014 02:39:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6L2dHxo034200; Mon, 21 Jul 2014 02:39:17 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407210239.s6L2dHxo034200@svn.freebsd.org> From: John Baldwin Date: Mon, 21 Jul 2014 02:39:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268935 - in stable/10: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 02:39:19 -0000 Author: jhb Date: Mon Jul 21 02:39:17 2014 New Revision: 268935 URL: http://svnweb.freebsd.org/changeset/base/268935 Log: MFC 263780,264516,265062,265101,265203,265364: Add an ioctl to suspend a virtual machine (VM_SUSPEND). Add logic in the HLT exit handler to detect if the guest has put all vcpus to sleep permanently by executing a HLT with interrupts disabled. When this condition is detected the guest with be suspended with a reason of VM_SUSPEND_HALT and the bhyve(8) process will exit. This logic can be disabled via the tunable 'hw.vmm.halt_detection'. Modified: stable/10/lib/libvmmapi/vmmapi.c stable/10/lib/libvmmapi/vmmapi.h stable/10/sys/amd64/include/vmm.h stable/10/sys/amd64/include/vmm_dev.h stable/10/sys/amd64/vmm/amd/amdv.c stable/10/sys/amd64/vmm/intel/vmx.c stable/10/sys/amd64/vmm/vmm.c stable/10/sys/amd64/vmm/vmm_dev.c stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyvectl/bhyvectl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libvmmapi/vmmapi.c ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.c Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/lib/libvmmapi/vmmapi.c Mon Jul 21 02:39:17 2014 (r268935) @@ -342,6 +342,16 @@ vm_run(struct vmctx *ctx, int vcpu, uint return (error); } +int +vm_suspend(struct vmctx *ctx, enum vm_suspend_how how) +{ + struct vm_suspend vmsuspend; + + bzero(&vmsuspend, sizeof(vmsuspend)); + vmsuspend.how = how; + return (ioctl(ctx->fd, VM_SUSPEND, &vmsuspend)); +} + static int vm_inject_exception_real(struct vmctx *ctx, int vcpu, int vector, int error_code, int error_code_valid) Modified: stable/10/lib/libvmmapi/vmmapi.h ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.h Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/lib/libvmmapi/vmmapi.h Mon Jul 21 02:39:17 2014 (r268935) @@ -61,6 +61,7 @@ int vm_set_register(struct vmctx *ctx, i int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval); int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *ret_vmexit); +int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how); int vm_apicid2vcpu(struct vmctx *ctx, int apicid); int vm_inject_exception(struct vmctx *ctx, int vcpu, int vec); int vm_inject_exception2(struct vmctx *ctx, int vcpu, int vec, int errcode); Modified: stable/10/sys/amd64/include/vmm.h ============================================================================== --- stable/10/sys/amd64/include/vmm.h Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/sys/amd64/include/vmm.h Mon Jul 21 02:39:17 2014 (r268935) @@ -29,6 +29,14 @@ #ifndef _VMM_H_ #define _VMM_H_ +enum vm_suspend_how { + VM_SUSPEND_NONE, + VM_SUSPEND_RESET, + VM_SUSPEND_POWEROFF, + VM_SUSPEND_HALT, + VM_SUSPEND_LAST +}; + #ifdef _KERNEL #define VM_MAX_NAMELEN 32 @@ -53,7 +61,8 @@ typedef int (*vmm_cleanup_func_t)(void); typedef void (*vmm_resume_func_t)(void); typedef void * (*vmi_init_func_t)(struct vm *vm, struct pmap *pmap); typedef int (*vmi_run_func_t)(void *vmi, int vcpu, register_t rip, - struct pmap *pmap, void *rendezvous_cookie); + struct pmap *pmap, void *rendezvous_cookie, + void *suspend_cookie); typedef void (*vmi_cleanup_func_t)(void *vmi); typedef int (*vmi_get_register_t)(void *vmi, int vcpu, int num, uint64_t *retval); @@ -114,6 +123,7 @@ int vm_get_seg_desc(struct vm *vm, int v int vm_set_seg_desc(struct vm *vm, int vcpu, int reg, struct seg_desc *desc); int vm_run(struct vm *vm, struct vm_run *vmrun); +int vm_suspend(struct vm *vm, enum vm_suspend_how how); int vm_inject_nmi(struct vm *vm, int vcpu); int vm_nmi_pending(struct vm *vm, int vcpuid); void vm_nmi_clear(struct vm *vm, int vcpuid); @@ -132,6 +142,7 @@ int vm_apicid2vcpuid(struct vm *vm, int void vm_activate_cpu(struct vm *vm, int vcpu); cpuset_t vm_active_cpus(struct vm *vm); struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid); +void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip); /* * Rendezvous all vcpus specified in 'dest' and execute 'func(arg)'. @@ -158,6 +169,13 @@ vcpu_rendezvous_pending(void *rendezvous return (*(uintptr_t *)rendezvous_cookie != 0); } +static __inline int +vcpu_suspended(void *suspend_cookie) +{ + + return (*(int *)suspend_cookie); +} + /* * Return 1 if device indicated by bus/slot/func is supposed to be a * pci passthrough device. @@ -308,9 +326,10 @@ enum vm_exitcode { VM_EXITCODE_PAGING, VM_EXITCODE_INST_EMUL, VM_EXITCODE_SPINUP_AP, - VM_EXITCODE_SPINDOWN_CPU, + VM_EXITCODE_DEPRECATED1, /* used to be SPINDOWN_CPU */ VM_EXITCODE_RENDEZVOUS, VM_EXITCODE_IOAPIC_EOI, + VM_EXITCODE_SUSPENDED, VM_EXITCODE_MAX }; @@ -372,6 +391,9 @@ struct vm_exit { struct { int vector; } ioapic_eoi; + struct { + enum vm_suspend_how how; + } suspended; } u; }; Modified: stable/10/sys/amd64/include/vmm_dev.h ============================================================================== --- stable/10/sys/amd64/include/vmm_dev.h Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/sys/amd64/include/vmm_dev.h Mon Jul 21 02:39:17 2014 (r268935) @@ -159,12 +159,17 @@ struct vm_hpet_cap { uint32_t capabilities; /* lower 32 bits of HPET capabilities */ }; +struct vm_suspend { + enum vm_suspend_how how; +}; + enum { /* general routines */ IOCNUM_ABIVERS = 0, IOCNUM_RUN = 1, IOCNUM_SET_CAPABILITY = 2, IOCNUM_GET_CAPABILITY = 3, + IOCNUM_SUSPEND = 4, /* memory apis */ IOCNUM_MAP_MEMORY = 10, @@ -212,6 +217,8 @@ enum { #define VM_RUN \ _IOWR('v', IOCNUM_RUN, struct vm_run) +#define VM_SUSPEND \ + _IOW('v', IOCNUM_SUSPEND, struct vm_suspend) #define VM_MAP_MEMORY \ _IOWR('v', IOCNUM_MAP_MEMORY, struct vm_memory_segment) #define VM_GET_MEMORY_SEG \ Modified: stable/10/sys/amd64/vmm/amd/amdv.c ============================================================================== --- stable/10/sys/amd64/vmm/amd/amdv.c Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/sys/amd64/vmm/amd/amdv.c Mon Jul 21 02:39:17 2014 (r268935) @@ -67,7 +67,8 @@ amdv_vminit(struct vm *vm, struct pmap * } static int -amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap, void *cookie) +amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap, + void *rptr, void *sptr) { printf("amdv_vmrun: not implemented\n"); Modified: stable/10/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx.c Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/sys/amd64/vmm/intel/vmx.c Mon Jul 21 02:39:17 2014 (r268935) @@ -2136,7 +2136,7 @@ vmx_exit_handle_nmi(struct vmx *vmx, int static int vmx_run(void *arg, int vcpu, register_t startrip, pmap_t pmap, - void *rendezvous_cookie) + void *rendezvous_cookie, void *suspend_cookie) { int rc, handled, launched; struct vmx *vmx; @@ -2193,9 +2193,10 @@ vmx_run(void *arg, int vcpu, register_t * pmap_invalidate_ept(). */ disable_intr(); - if (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED)) { + if (vcpu_suspended(suspend_cookie)) { enable_intr(); - handled = vmx_exit_astpending(vmx, vcpu, vmexit); + vm_exit_suspended(vmx->vm, vcpu, vmcs_guest_rip()); + handled = UNHANDLED; break; } @@ -2205,6 +2206,12 @@ vmx_run(void *arg, int vcpu, register_t break; } + if (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED)) { + enable_intr(); + handled = vmx_exit_astpending(vmx, vcpu, vmexit); + break; + } + vmx_inject_interrupts(vmx, vcpu, vlapic); vmx_run_trace(vmx, vcpu); rc = vmx_enter_guest(vmxctx, vmx, launched); Modified: stable/10/sys/amd64/vmm/vmm.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm.c Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/sys/amd64/vmm/vmm.c Mon Jul 21 02:39:17 2014 (r268935) @@ -139,6 +139,11 @@ struct vm { cpuset_t rendezvous_done_cpus; void *rendezvous_arg; vm_rendezvous_func_t rendezvous_func; + + int suspend; + volatile cpuset_t suspended_cpus; + + volatile cpuset_t halted_cpus; }; static int vmm_initialized; @@ -149,8 +154,8 @@ static struct vmm_ops *ops; #define VMM_RESUME() (ops != NULL ? (*ops->resume)() : 0) #define VMINIT(vm, pmap) (ops != NULL ? (*ops->vminit)(vm, pmap): NULL) -#define VMRUN(vmi, vcpu, rip, pmap, rptr) \ - (ops != NULL ? (*ops->vmrun)(vmi, vcpu, rip, pmap, rptr) : ENXIO) +#define VMRUN(vmi, vcpu, rip, pmap, rptr, sptr) \ + (ops != NULL ? (*ops->vmrun)(vmi, vcpu, rip, pmap, rptr, sptr) : ENXIO) #define VMCLEANUP(vmi) (ops != NULL ? (*ops->vmcleanup)(vmi) : NULL) #define VMSPACE_ALLOC(min, max) \ (ops != NULL ? (*ops->vmspace_alloc)(min, max) : NULL) @@ -184,12 +189,20 @@ static VMM_STAT(VCPU_TOTAL_RUNTIME, "vcp SYSCTL_NODE(_hw, OID_AUTO, vmm, CTLFLAG_RW, NULL, NULL); +/* + * Halt the guest if all vcpus are executing a HLT instruction with + * interrupts disabled. + */ +static int halt_detection_enabled = 1; +TUNABLE_INT("hw.vmm.halt_detection", &halt_detection_enabled); +SYSCTL_INT(_hw_vmm, OID_AUTO, halt_detection, CTLFLAG_RDTUN, + &halt_detection_enabled, 0, + "Halt VM if all vcpus execute HLT with interrupts disabled"); + static int vmm_ipinum; SYSCTL_INT(_hw_vmm, OID_AUTO, ipinum, CTLFLAG_RD, &vmm_ipinum, 0, "IPI vector used for vcpu notifications"); -static void vm_deactivate_cpu(struct vm *vm, int vcpuid); - static void vcpu_cleanup(struct vm *vm, int i) { @@ -1003,56 +1016,73 @@ vm_handle_rendezvous(struct vm *vm, int static int vm_handle_hlt(struct vm *vm, int vcpuid, bool intr_disabled, bool *retu) { - struct vm_exit *vmexit; struct vcpu *vcpu; - int t, timo, spindown; + const char *wmesg; + int t, vcpu_halted, vm_halted; + + KASSERT(!CPU_ISSET(vcpuid, &vm->halted_cpus), ("vcpu already halted")); vcpu = &vm->vcpu[vcpuid]; - spindown = 0; + vcpu_halted = 0; + vm_halted = 0; vcpu_lock(vcpu); + while (1) { + /* + * Do a final check for pending NMI or interrupts before + * really putting this thread to sleep. Also check for + * software events that would cause this vcpu to wakeup. + * + * These interrupts/events could have happened after the + * vcpu returned from VMRUN() and before it acquired the + * vcpu lock above. + */ + if (vm->rendezvous_func != NULL || vm->suspend) + break; + if (vm_nmi_pending(vm, vcpuid)) + break; + if (!intr_disabled) { + if (vm_extint_pending(vm, vcpuid) || + vlapic_pending_intr(vcpu->vlapic, NULL)) { + break; + } + } - /* - * Do a final check for pending NMI or interrupts before - * really putting this thread to sleep. - * - * These interrupts could have happened any time after we - * returned from VMRUN() and before we grabbed the vcpu lock. - */ - if (!vm_nmi_pending(vm, vcpuid) && - (intr_disabled || !vlapic_pending_intr(vcpu->vlapic, NULL))) { - t = ticks; - vcpu_require_state_locked(vcpu, VCPU_SLEEPING); - if (vlapic_enabled(vcpu->vlapic)) { - /* - * XXX msleep_spin() is not interruptible so use the - * 'timo' to put an upper bound on the sleep time. - */ - timo = hz; - msleep_spin(vcpu, &vcpu->mtx, "vmidle", timo); + /* + * Some Linux guests implement "halt" by having all vcpus + * execute HLT with interrupts disabled. 'halted_cpus' keeps + * track of the vcpus that have entered this state. When all + * vcpus enter the halted state the virtual machine is halted. + */ + if (intr_disabled) { + wmesg = "vmhalt"; + VCPU_CTR0(vm, vcpuid, "Halted"); + if (!vcpu_halted && halt_detection_enabled) { + vcpu_halted = 1; + CPU_SET_ATOMIC(vcpuid, &vm->halted_cpus); + } + if (CPU_CMP(&vm->halted_cpus, &vm->active_cpus) == 0) { + vm_halted = 1; + break; + } } else { - /* - * Spindown the vcpu if the apic is disabled and it - * had entered the halted state. - */ - spindown = 1; + wmesg = "vmidle"; } + + t = ticks; + vcpu_require_state_locked(vcpu, VCPU_SLEEPING); + msleep_spin(vcpu, &vcpu->mtx, wmesg, 0); vcpu_require_state_locked(vcpu, VCPU_FROZEN); vmm_stat_incr(vm, vcpuid, VCPU_IDLE_TICKS, ticks - t); } + + if (vcpu_halted) + CPU_CLR_ATOMIC(vcpuid, &vm->halted_cpus); + vcpu_unlock(vcpu); - /* - * Since 'vm_deactivate_cpu()' grabs a sleep mutex we must call it - * outside the confines of the vcpu spinlock. - */ - if (spindown) { - *retu = true; - vmexit = vm_exitinfo(vm, vcpuid); - vmexit->exitcode = VM_EXITCODE_SPINDOWN_CPU; - vm_deactivate_cpu(vm, vcpuid); - VCPU_CTR0(vm, vcpuid, "spinning down cpu"); - } + if (vm_halted) + vm_suspend(vm, VM_SUSPEND_HALT); return (0); } @@ -1152,6 +1182,100 @@ vm_handle_inst_emul(struct vm *vm, int v return (error); } +static int +vm_handle_suspend(struct vm *vm, int vcpuid, bool *retu) +{ + int i, done; + struct vcpu *vcpu; + + done = 0; + vcpu = &vm->vcpu[vcpuid]; + + CPU_SET_ATOMIC(vcpuid, &vm->suspended_cpus); + + /* + * Wait until all 'active_cpus' have suspended themselves. + * + * Since a VM may be suspended at any time including when one or + * more vcpus are doing a rendezvous we need to call the rendezvous + * handler while we are waiting to prevent a deadlock. + */ + vcpu_lock(vcpu); + while (1) { + if (CPU_CMP(&vm->suspended_cpus, &vm->active_cpus) == 0) { + VCPU_CTR0(vm, vcpuid, "All vcpus suspended"); + break; + } + + if (vm->rendezvous_func == NULL) { + VCPU_CTR0(vm, vcpuid, "Sleeping during suspend"); + vcpu_require_state_locked(vcpu, VCPU_SLEEPING); + msleep_spin(vcpu, &vcpu->mtx, "vmsusp", hz); + vcpu_require_state_locked(vcpu, VCPU_FROZEN); + } else { + VCPU_CTR0(vm, vcpuid, "Rendezvous during suspend"); + vcpu_unlock(vcpu); + vm_handle_rendezvous(vm, vcpuid); + vcpu_lock(vcpu); + } + } + vcpu_unlock(vcpu); + + /* + * Wakeup the other sleeping vcpus and return to userspace. + */ + for (i = 0; i < VM_MAXCPU; i++) { + if (CPU_ISSET(i, &vm->suspended_cpus)) { + vcpu_notify_event(vm, i, false); + } + } + + *retu = true; + return (0); +} + +int +vm_suspend(struct vm *vm, enum vm_suspend_how how) +{ + int i; + + if (how <= VM_SUSPEND_NONE || how >= VM_SUSPEND_LAST) + return (EINVAL); + + if (atomic_cmpset_int(&vm->suspend, 0, how) == 0) { + VM_CTR2(vm, "virtual machine already suspended %d/%d", + vm->suspend, how); + return (EALREADY); + } + + VM_CTR1(vm, "virtual machine successfully suspended %d", how); + + /* + * Notify all active vcpus that they are now suspended. + */ + for (i = 0; i < VM_MAXCPU; i++) { + if (CPU_ISSET(i, &vm->active_cpus)) + vcpu_notify_event(vm, i, false); + } + + return (0); +} + +void +vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip) +{ + struct vm_exit *vmexit; + + KASSERT(vm->suspend > VM_SUSPEND_NONE && vm->suspend < VM_SUSPEND_LAST, + ("vm_exit_suspended: invalid suspend type %d", vm->suspend)); + + vmexit = vm_exitinfo(vm, vcpuid); + vmexit->rip = rip; + vmexit->inst_length = 0; + vmexit->exitcode = VM_EXITCODE_SUSPENDED; + vmexit->u.suspended.how = vm->suspend; +} + int vm_run(struct vm *vm, struct vm_run *vmrun) { @@ -1162,12 +1286,15 @@ vm_run(struct vm *vm, struct vm_run *vmr struct vm_exit *vme; bool retu, intr_disabled; pmap_t pmap; + void *rptr, *sptr; vcpuid = vmrun->cpuid; if (vcpuid < 0 || vcpuid >= VM_MAXCPU) return (EINVAL); + rptr = &vm->rendezvous_func; + sptr = &vm->suspend; pmap = vmspace_pmap(vm->vmspace); vcpu = &vm->vcpu[vcpuid]; vme = &vcpu->exitinfo; @@ -1187,7 +1314,7 @@ restart: restore_guest_fpustate(vcpu); vcpu_require_state(vm, vcpuid, VCPU_RUNNING); - error = VMRUN(vm->cookie, vcpuid, rip, pmap, &vm->rendezvous_func); + error = VMRUN(vm->cookie, vcpuid, rip, pmap, rptr, sptr); vcpu_require_state(vm, vcpuid, VCPU_FROZEN); save_guest_fpustate(vcpu); @@ -1200,6 +1327,9 @@ restart: if (error == 0) { retu = false; switch (vme->exitcode) { + case VM_EXITCODE_SUSPENDED: + error = vm_handle_suspend(vm, vcpuid, &retu); + break; case VM_EXITCODE_IOAPIC_EOI: vioapic_process_eoi(vm, vcpuid, vme->u.ioapic_eoi.vector); @@ -1567,30 +1697,6 @@ vm_activate_cpu(struct vm *vm, int vcpui CPU_SET_ATOMIC(vcpuid, &vm->active_cpus); } -static void -vm_deactivate_cpu(struct vm *vm, int vcpuid) -{ - - KASSERT(vcpuid >= 0 && vcpuid < VM_MAXCPU, - ("vm_deactivate_cpu: invalid vcpuid %d", vcpuid)); - KASSERT(CPU_ISSET(vcpuid, &vm->active_cpus), - ("vm_deactivate_cpu: vcpuid %d is not active", vcpuid)); - - VCPU_CTR0(vm, vcpuid, "deactivated"); - CPU_CLR_ATOMIC(vcpuid, &vm->active_cpus); - - /* - * If a vcpu rendezvous is in progress then it could be blocked - * on 'vcpuid' - unblock it before disappearing forever. - */ - mtx_lock(&vm->rendezvous_mtx); - if (vm->rendezvous_func != NULL) { - VCPU_CTR0(vm, vcpuid, "unblock rendezvous after deactivation"); - wakeup(&vm->rendezvous_func); - } - mtx_unlock(&vm->rendezvous_mtx); -} - cpuset_t vm_active_cpus(struct vm *vm) { Modified: stable/10/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm_dev.c Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/sys/amd64/vmm/vmm_dev.c Mon Jul 21 02:39:17 2014 (r268935) @@ -166,6 +166,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long c struct vm_stat_desc *statdesc; struct vm_x2apic *x2apic; struct vm_gpa_pte *gpapte; + struct vm_suspend *vmsuspend; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -240,6 +241,10 @@ vmmdev_ioctl(struct cdev *cdev, u_long c vmrun = (struct vm_run *)data; error = vm_run(sc->vm, vmrun); break; + case VM_SUSPEND: + vmsuspend = (struct vm_suspend *)data; + error = vm_suspend(sc->vm, vmsuspend->how); + break; case VM_STAT_DESC: { statdesc = (struct vm_stat_desc *)data; error = vmm_stat_desc_copy(statdesc->index, Modified: stable/10/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.c Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/usr.sbin/bhyve/bhyverun.c Mon Jul 21 02:39:17 2014 (r268935) @@ -113,6 +113,7 @@ struct bhyvestats { uint64_t cpu_switch_rotate; uint64_t cpu_switch_direct; int io_reset; + int io_poweroff; } stats; struct mt_vmm_info { @@ -271,13 +272,6 @@ fbsdrun_deletecpu(struct vmctx *ctx, int } static int -vmexit_catch_reset(void) -{ - stats.io_reset++; - return (VMEXIT_RESET); -} - -static int vmexit_catch_inout(void) { return (VMEXIT_ABORT); @@ -327,8 +321,10 @@ vmexit_inout(struct vmctx *ctx, struct v case INOUT_OK: return (VMEXIT_CONTINUE); case INOUT_RESET: + stats.io_reset++; return (VMEXIT_RESET); case INOUT_POWEROFF: + stats.io_poweroff++; return (VMEXIT_POWEROFF); default: fprintf(stderr, "Unhandled %s%c 0x%04x\n", @@ -399,17 +395,6 @@ vmexit_spinup_ap(struct vmctx *ctx, stru } static int -vmexit_spindown_cpu(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) -{ - int lastcpu; - - lastcpu = fbsdrun_deletecpu(ctx, *pvcpu); - if (!lastcpu) - pthread_exit(NULL); - return (vmexit_catch_reset()); -} - -static int vmexit_vmx(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { @@ -493,6 +478,45 @@ vmexit_inst_emul(struct vmctx *ctx, stru return (VMEXIT_CONTINUE); } +static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t resetcpu_cond = PTHREAD_COND_INITIALIZER; + +static int +vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) +{ + enum vm_suspend_how how; + + how = vmexit->u.suspended.how; + + fbsdrun_deletecpu(ctx, *pvcpu); + + if (*pvcpu != BSP) { + pthread_mutex_lock(&resetcpu_mtx); + pthread_cond_signal(&resetcpu_cond); + pthread_mutex_unlock(&resetcpu_mtx); + pthread_exit(NULL); + } + + pthread_mutex_lock(&resetcpu_mtx); + while (!CPU_EMPTY(&cpumask)) { + pthread_cond_wait(&resetcpu_cond, &resetcpu_mtx); + } + pthread_mutex_unlock(&resetcpu_mtx); + + switch (how) { + case VM_SUSPEND_RESET: + exit(0); + case VM_SUSPEND_POWEROFF: + exit(1); + case VM_SUSPEND_HALT: + exit(2); + default: + fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how); + exit(100); + } + return (0); /* NOTREACHED */ +} + static vmexit_handler_t handler[VM_EXITCODE_MAX] = { [VM_EXITCODE_INOUT] = vmexit_inout, [VM_EXITCODE_VMX] = vmexit_vmx, @@ -502,7 +526,7 @@ static vmexit_handler_t handler[VM_EXITC [VM_EXITCODE_MTRAP] = vmexit_mtrap, [VM_EXITCODE_INST_EMUL] = vmexit_inst_emul, [VM_EXITCODE_SPINUP_AP] = vmexit_spinup_ap, - [VM_EXITCODE_SPINDOWN_CPU] = vmexit_spindown_cpu, + [VM_EXITCODE_SUSPENDED] = vmexit_suspend }; static void @@ -510,6 +534,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uin { int error, rc, prevcpu; enum vm_exitcode exitcode; + enum vm_suspend_how how; if (vcpumap[vcpu] != NULL) { error = pthread_setaffinity_np(pthread_self(), @@ -541,7 +566,15 @@ vm_loop(struct vmctx *ctx, int vcpu, uin rip = vmexit[vcpu].rip; break; case VMEXIT_RESET: - exit(0); + case VMEXIT_POWEROFF: + if (rc == VMEXIT_RESET) + how = VM_SUSPEND_RESET; + else + how = VM_SUSPEND_POWEROFF; + error = vm_suspend(ctx, how); + assert(error == 0 || errno == EALREADY); + rip = vmexit[vcpu].rip + vmexit[vcpu].inst_length; + break; default: exit(1); } Modified: stable/10/usr.sbin/bhyvectl/bhyvectl.c ============================================================================== --- stable/10/usr.sbin/bhyvectl/bhyvectl.c Mon Jul 21 02:17:28 2014 (r268934) +++ stable/10/usr.sbin/bhyvectl/bhyvectl.c Mon Jul 21 02:39:17 2014 (r268935) @@ -191,13 +191,16 @@ usage(void) " [--get-highmem]\n" " [--get-gpa-pmap]\n" " [--assert-lapic-lvt=]\n" - " [--inject-nmi]\n", + " [--inject-nmi]\n" + " [--force-reset]\n" + " [--force-poweroff]\n", progname); exit(1); } static int get_stats, getcap, setcap, capval, get_gpa_pmap; static int inject_nmi, assert_lapic_lvt; +static int force_reset, force_poweroff; static const char *capname; static int create, destroy, get_lowmem, get_highmem; static uint64_t memsize; @@ -565,6 +568,8 @@ main(int argc, char *argv[]) { "create", NO_ARG, &create, 1 }, { "destroy", NO_ARG, &destroy, 1 }, { "inject-nmi", NO_ARG, &inject_nmi, 1 }, + { "force-reset", NO_ARG, &force_reset, 1 }, + { "force-poweroff", NO_ARG, &force_poweroff, 1 }, { NULL, 0, NULL, 0 } }; @@ -1534,6 +1539,12 @@ main(int argc, char *argv[]) printf("vm_run error %d\n", error); } + if (!error && force_reset) + error = vm_suspend(ctx, VM_SUSPEND_RESET); + + if (!error && force_poweroff) + error = vm_suspend(ctx, VM_SUSPEND_POWEROFF); + if (error) printf("errno = %d\n", errno); From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 06:45:19 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EEC6A34E; Mon, 21 Jul 2014 06:45:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB6B52B8D; Mon, 21 Jul 2014 06:45:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6L6jJuW051923; Mon, 21 Jul 2014 06:45:19 GMT (envelope-from cy@svn.freebsd.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6L6jJdS051921; Mon, 21 Jul 2014 06:45:19 GMT (envelope-from cy@svn.freebsd.org) Message-Id: <201407210645.s6L6jJdS051921@svn.freebsd.org> From: Cy Schubert Date: Mon, 21 Jul 2014 06:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268937 - in stable/10: contrib/ipfilter/lib sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 06:45:20 -0000 Author: cy Date: Mon Jul 21 06:45:19 2014 New Revision: 268937 URL: http://svnweb.freebsd.org/changeset/base/268937 Log: MFC r268532 and r268585. When world and kernel are built without INET6 support, the userland was still built with INET6 turned on. PR: 190964 Approved by: glebius (mentor, implicit) Modified: stable/10/contrib/ipfilter/lib/printipfexpr.c stable/10/sys/contrib/ipfilter/netinet/ip_compat.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/ipfilter/lib/printipfexpr.c ============================================================================== --- stable/10/contrib/ipfilter/lib/printipfexpr.c Mon Jul 21 04:48:02 2014 (r268936) +++ stable/10/contrib/ipfilter/lib/printipfexpr.c Mon Jul 21 06:45:19 2014 (r268937) @@ -3,7 +3,9 @@ static void printport __P((int *)); static void printhosts __P((int *)); static void printsingle __P((int *)); +#ifdef USE_INET6 static void printhostsv6 __P((int *)); +#endif void printipfexpr(array) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_compat.h ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_compat.h Mon Jul 21 04:48:02 2014 (r268936) +++ stable/10/sys/contrib/ipfilter/netinet/ip_compat.h Mon Jul 21 06:45:19 2014 (r268937) @@ -33,10 +33,6 @@ #endif #define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) -#if defined(__FreeBSD_version) && (__FreeBSD_version >= 400000) && \ - !defined(_KERNEL) && !defined(USE_INET6) && !defined(NOINET6) -# define USE_INET6 -#endif #if defined(__SVR4) || defined(__svr4__) || defined(__sgi) From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 13:51:30 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3ADE2A7E; Mon, 21 Jul 2014 13:51:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 270EA2853; Mon, 21 Jul 2014 13:51:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LDpUHT044156; Mon, 21 Jul 2014 13:51:30 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LDpTfm044152; Mon, 21 Jul 2014 13:51:29 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407211351.s6LDpTfm044152@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Jul 2014 13:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268940 - stable/10/share/vt/keymaps X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 13:51:30 -0000 Author: emaste Date: Mon Jul 21 13:51:29 2014 New Revision: 268940 URL: http://svnweb.freebsd.org/changeset/base/268940 Log: MFC r267603 by trasz: Add polish vt(4) keymap. Sponsored by: The FreeBSD Foundation Added: stable/10/share/vt/keymaps/pl.kbd - copied unchanged from r267603, head/share/vt/keymaps/pl.kbd Modified: stable/10/share/vt/keymaps/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/vt/keymaps/Makefile ============================================================================== --- stable/10/share/vt/keymaps/Makefile Mon Jul 21 08:47:54 2014 (r268939) +++ stable/10/share/vt/keymaps/Makefile Mon Jul 21 13:51:29 2014 (r268940) @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= ua.kbd ua.shift.alt.kbd +FILES= pl.kbd ua.kbd ua.shift.alt.kbd FILESDIR= ${SHAREDIR}/vt/keymaps Copied: stable/10/share/vt/keymaps/pl.kbd (from r267603, head/share/vt/keymaps/pl.kbd) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/vt/keymaps/pl.kbd Mon Jul 21 13:51:29 2014 (r268940, copy of r267603, head/share/vt/keymaps/pl.kbd) @@ -0,0 +1,116 @@ +# Polish ISO-8859-2 keymap by Krzysztof Mlynarski (17:46 27-04-1996 MET DST) +# (krzysio@hydra.mimuw.edu.pl) +# $FreeBSD$ +# alt +# scan cntrl alt alt cntrl lock +# code base shift cntrl shift alt shift cntrl shift state +# ------------------------------------------------------------------ + 000 nop nop nop nop nop nop nop nop O + 001 esc esc esc esc esc esc debug esc O + 002 '1' '!' nop nop '1' '!' nop nop O + 003 '2' '@' nul nul '2' '@' nul nul O + 004 '3' '#' nop nop '3' '#' nop nop O + 005 '4' '$' nop nop '4' '$' nop nop O + 006 '5' '%' nop nop '5' '%' nop nop O + 007 '6' '^' rs rs '6' '^' rs rs O + 008 '7' '&' nop nop '7' '&' nop nop O + 009 '8' '*' nop nop '8' '*' nop nop O + 010 '9' '(' nop nop '9' '(' nop nop O + 011 '0' ')' nop nop '0' ')' nop nop O + 012 '-' '_' us us '-' '_' us us O + 013 '=' '+' nop nop '=' '+' nop nop O + 014 bs bs del del bs bs del del O + 015 ht btab nop nop ht btab nop nop O + 016 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C + 017 'w' 'W' etb etb 'w' 'W' etb etb C + 018 'e' 'E' enq enq 281 280 enq enq C + 019 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C + 020 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C + 021 'y' 'Y' em em 'y' 'Y' em em C + 022 'u' 'U' nak nak 'u' 'U' nak nak C + 023 'i' 'I' ht ht 'i' 'I' ht ht C + 024 'o' 'O' si si 243 211 si si C + 025 'p' 'P' dle dle 'p' 'P' dle dle C + 026 '[' '{' esc esc '[' '{' esc esc O + 027 ']' '}' gs gs ']' '}' gs gs O + 028 cr cr nl nl cr cr nl nl O + 029 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 030 'a' 'A' soh soh 261 260 soh soh C + 031 's' 'S' dc3 dc3 347 346 dc3 dc3 C + 032 'd' 'D' eot eot 'd' 'D' eot eot C + 033 'f' 'F' ack ack 'f' 'F' ack ack C + 034 'g' 'G' bel bel 'g' 'G' bel bel C + 035 'h' 'H' bs bs 'h' 'H' bs bs C + 036 'j' 'J' nl nl 'j' 'J' nl nl C + 037 'k' 'K' vt vt 'k' 'K' vt vt C + 038 'l' 'L' ff ff 322 321 ff ff C + 039 ';' ':' nop nop ';' ':' nop nop O + 040 ''' '"' nop nop ''' '"' nop nop O + 041 '`' '~' nop nop '`' '~' nop nop O + 042 lshift lshift lshift lshift lshift lshift lshift lshift O + 043 '\' '|' fs fs '\' '|' fs fs O + 044 'z' 'Z' sub sub 380 379 sub sub C + 045 'x' 'X' can can 378 377 can can C + 046 'c' 'C' etx etx 263 262 etx etx C + 047 'v' 'V' syn syn 'v' 'V' syn syn C + 048 'b' 'B' stx stx 'b' 'B' stx stx C + 049 'n' 'N' so so 324 323 so so C + 050 'm' 'M' cr cr 'm' 'M' cr cr C + 051 ',' '<' nop nop ',' '<' nop nop O + 052 '.' '>' nop nop '.' '>' nop nop O + 053 '/' '?' nop nop '/' '?' nop nop O + 054 rshift rshift rshift rshift rshift rshift rshift rshift O + 055 '*' '*' '*' '*' '*' '*' '*' '*' O + 056 lalt lalt lalt lalt lalt lalt lalt lalt O + 057 ' ' ' ' nul ' ' ' ' ' ' susp ' ' O + 058 clock clock clock clock clock clock clock clock O + 059 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O + 060 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O + 061 fkey03 fkey15 fkey27 fkey39 scr03 scr13 scr03 scr13 O + 062 fkey04 fkey16 fkey28 fkey40 scr04 scr14 scr04 scr14 O + 063 fkey05 fkey17 fkey29 fkey41 scr05 scr15 scr05 scr15 O + 064 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O + 065 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O + 066 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O + 067 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O + 068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O + 069 nlock nlock nlock nlock nlock nlock nlock nlock O + 070 slock slock slock slock slock slock slock slock O + 071 fkey49 '7' '7' '7' '7' '7' '7' '7' N + 072 fkey50 '8' '8' '8' '8' '8' '8' '8' N + 073 fkey51 '9' '9' '9' '9' '9' '9' '9' N + 074 fkey52 '-' '-' '-' '-' '-' '-' '-' N + 075 fkey53 '4' '4' '4' '4' '4' '4' '4' N + 076 fkey54 '5' '5' '5' '5' '5' '5' '5' N + 077 fkey55 '6' '6' '6' '6' '6' '6' '6' N + 078 fkey56 '+' '+' '+' '+' '+' '+' '+' N + 079 fkey57 '1' '1' '1' '1' '1' '1' '1' N + 080 fkey58 '2' '2' '2' '2' '2' '2' '2' N + 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N + 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N + 083 del '.' '.' '.' '.' '.' boot boot N + 084 nop nop nop nop nop nop nop nop O + 085 nop nop nop nop nop nop nop nop O + 086 nop nop nop nop nop nop nop nop O + 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O + 088 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O + 089 cr cr cr cr cr cr cr cr O + 090 rctrl rctrl rctrl rctrl rctrl rctrl rctrl rctrl O + 091 '/' '/' '/' '/' '/' '/' '/' '/' O + 092 nscr pscr debug debug nop nop nop nop O + 093 ralt ralt ralt ralt ralt ralt ralt ralt O + 094 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O + 095 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O + 096 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O + 097 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O + 098 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O + 099 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O + 100 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O + 101 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O + 102 fkey60 paste fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O + 103 fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot fkey61 O + 104 slock saver slock saver susp nop susp nop O + 105 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O + 106 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O + 107 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O + 108 nop nop nop nop nop nop nop nop O From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 14:31:58 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2542EA4E; Mon, 21 Jul 2014 14:31:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 114D72CC7; Mon, 21 Jul 2014 14:31:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LEVvgj061767; Mon, 21 Jul 2014 14:31:57 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LEVvHI061766; Mon, 21 Jul 2014 14:31:57 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407211431.s6LEVvHI061766@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Jul 2014 14:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268941 - stable/10/sys/dev/vt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 14:31:58 -0000 Author: emaste Date: Mon Jul 21 14:31:57 2014 New Revision: 268941 URL: http://svnweb.freebsd.org/changeset/base/268941 Log: MFC r268460 by ray: Fix inconsistent token parameters for kbd_allocate() and kbd_release() in vt(4). PR: 191306 Submitted by: jau789 at gmail.com Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/vt_core.c ============================================================================== --- stable/10/sys/dev/vt/vt_core.c Mon Jul 21 13:51:29 2014 (r268940) +++ stable/10/sys/dev/vt/vt_core.c Mon Jul 21 14:31:57 2014 (r268941) @@ -618,7 +618,7 @@ vt_kbdevent(keyboard_t *kbd, int event, case KBDIO_UNLOADING: mtx_lock(&Giant); vd->vd_keyboard = -1; - kbd_release(kbd, (void *)&vd->vd_keyboard); + kbd_release(kbd, (void *)vd); mtx_unlock(&Giant); return (0); default: @@ -1785,11 +1785,10 @@ skip_thunk: return (EINVAL); } i = kbd_allocate(kbd->kb_name, kbd->kb_unit, - (void *)&vd->vd_keyboard, vt_kbdevent, vd); + (void *)vd, vt_kbdevent, vd); if (i >= 0) { if (vd->vd_keyboard != -1) { - kbd_release(kbd, - (void *)&vd->vd_keyboard); + kbd_release(kbd, (void *)vd); } kbd = kbd_get_keyboard(i); vd->vd_keyboard = i; @@ -1811,7 +1810,7 @@ skip_thunk: mtx_unlock(&Giant); return (EINVAL); } - error = kbd_release(kbd, (void *)&vd->vd_keyboard); + error = kbd_release(kbd, (void *)vd); if (error == 0) { vd->vd_keyboard = -1; } From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 14:36:36 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 48596D89; Mon, 21 Jul 2014 14:36:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34A012D21; Mon, 21 Jul 2014 14:36:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LEaa1U062541; Mon, 21 Jul 2014 14:36:36 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LEaavM062540; Mon, 21 Jul 2014 14:36:36 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407211436.s6LEaavM062540@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Jul 2014 14:36:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268942 - stable/9/sys/dev/vt X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 14:36:36 -0000 Author: emaste Date: Mon Jul 21 14:36:35 2014 New Revision: 268942 URL: http://svnweb.freebsd.org/changeset/base/268942 Log: MFC r268460 by ray: Fix inconsistent token parameters for kbd_allocate() and kbd_release() in vt(4). PR: 191306 Submitted by: jau789 at gmail.com Sponsored by: The FreeBSD Foundation Modified: stable/9/sys/dev/vt/vt_core.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/vt/vt_core.c ============================================================================== --- stable/9/sys/dev/vt/vt_core.c Mon Jul 21 14:31:57 2014 (r268941) +++ stable/9/sys/dev/vt/vt_core.c Mon Jul 21 14:36:35 2014 (r268942) @@ -536,7 +536,7 @@ vt_kbdevent(keyboard_t *kbd, int event, case KBDIO_UNLOADING: mtx_lock(&Giant); vd->vd_keyboard = -1; - kbd_release(kbd, (void *)&vd->vd_keyboard); + kbd_release(kbd, (void *)vd); mtx_unlock(&Giant); return (0); default: @@ -1651,11 +1651,10 @@ skip_thunk: return (EINVAL); } i = kbd_allocate(kbd->kb_name, kbd->kb_unit, - (void *)&vd->vd_keyboard, vt_kbdevent, vd); + (void *)vd, vt_kbdevent, vd); if (i >= 0) { if (vd->vd_keyboard != -1) { - kbd_release(kbd, - (void *)&vd->vd_keyboard); + kbd_release(kbd, (void *)vd); } kbd = kbd_get_keyboard(i); vd->vd_keyboard = i; @@ -1677,7 +1676,7 @@ skip_thunk: mtx_unlock(&Giant); return (EINVAL); } - error = kbd_release(kbd, (void *)&vd->vd_keyboard); + error = kbd_release(kbd, (void *)vd); if (error == 0) { vd->vd_keyboard = -1; } From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 16:21:18 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 523D3524; Mon, 21 Jul 2014 16:21:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24FE52723; Mon, 21 Jul 2014 16:21:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LGLIu5010806; Mon, 21 Jul 2014 16:21:18 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LGLIqC010805; Mon, 21 Jul 2014 16:21:18 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407211621.s6LGLIqC010805@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Jul 2014 16:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268946 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 16:21:18 -0000 Author: emaste Date: Mon Jul 21 16:21:17 2014 New Revision: 268946 URL: http://svnweb.freebsd.org/changeset/base/268946 Log: MFC syscons(4) man page updates: r268050: Add a vt(4) cross reference to syscons(4) r268169: Clarify the setting of syscons driver flags Submitted by: wblock r268215: Describe kern.vty sc/vt tunable in syscons(4) Reviewed by: wblock Modified: stable/10/share/man/man4/syscons.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/syscons.4 ============================================================================== --- stable/10/share/man/man4/syscons.4 Mon Jul 21 15:44:59 2014 (r268945) +++ stable/10/share/man/man4/syscons.4 Mon Jul 21 16:21:17 2014 (r268946) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 11, 2009 +.Dd July 21, 2014 .Dt SYSCONS 4 .Os .Sh NAME @@ -62,6 +62,10 @@ In .Pa /boot/device.hints : .Cd hint.sc.0.at="isa" .Cd hint.sc.0.vesa_mode=0x103 +.Pp +In +.Pa /boot/loader.conf : +.Cd kern.vty=sc .Sh DESCRIPTION The .Nm @@ -403,7 +407,9 @@ option too. The following driver flags can be used to control the .Nm driver. -They can be set either in +Driver flags can be set with the +.Cd hint.sc.0.flags +tunable, either in .Pa /boot/device.hints , or else at the loader prompt (see .Xr loader 8 ) . @@ -446,6 +452,26 @@ This option instructs the syscons driver for a keyboard device if it is not currently attached to one. Otherwise, the driver only probes for a keyboard once during bootup. .El +.Ss Loader Tunables +These settings can be entered at the +.Xr loader 8 +prompt or in +.Xr loader.conf 5 . +.Bl -tag -width indent +.It Va kern.vty +When both +.Nm +and +.Xr vt 4 +have been compiled into the kernel, the one to use for the system console can +be selected by setting this variable to +.Ql sc +or +.Ql vt . +If not set, +.Nm +provides the default system console. +.El .Sh FILES .Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact .It Pa /dev/console @@ -533,6 +559,7 @@ to the kernel. .Xr splash 4 , .Xr ukbd 4 , .Xr vga 4 , +.Xr vt 4 , .Xr kbdmap 5 , .Xr rc.conf 5 , .Xr ttys 5 , From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 18:13:15 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F156DD27; Mon, 21 Jul 2014 18:13:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEC2223A4; Mon, 21 Jul 2014 18:13:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LIDEvQ061761; Mon, 21 Jul 2014 18:13:14 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LIDEcj061760; Mon, 21 Jul 2014 18:13:14 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407211813.s6LIDEcj061760@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Jul 2014 18:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268950 - stable/10/tools/tools/vt/mkkfont X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 18:13:15 -0000 Author: emaste Date: Mon Jul 21 18:13:14 2014 New Revision: 268950 URL: http://svnweb.freebsd.org/changeset/base/268950 Log: MFC r266847: Add missing , in converted font output Modified: stable/10/tools/tools/vt/mkkfont/mkkfont.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/tools/vt/mkkfont/mkkfont.c ============================================================================== --- stable/10/tools/tools/vt/mkkfont/mkkfont.c Mon Jul 21 17:43:37 2014 (r268949) +++ stable/10/tools/tools/vt/mkkfont/mkkfont.c Mon Jul 21 18:13:14 2014 (r268950) @@ -139,7 +139,7 @@ print_info(struct file_header *fh) else printf("\t\t\t\t NULL,\n"); } - printf("\t\t\t\t }\n"); + printf("\t\t\t\t },\n"); printf("\t.vf_map_count\t\t= { %u, %u, %u, %u },\n", be32toh(fh->map_count[0]), be32toh(fh->map_count[1]), From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 18:23:49 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 322D2F45; Mon, 21 Jul 2014 18:23:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F4472493; Mon, 21 Jul 2014 18:23:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LINm8i066303; Mon, 21 Jul 2014 18:23:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LINmqR066302; Mon, 21 Jul 2014 18:23:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407211823.s6LINmqR066302@svn.freebsd.org> From: John Baldwin Date: Mon, 21 Jul 2014 18:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268951 - stable/10/usr.sbin/bhyvectl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 18:23:49 -0000 Author: jhb Date: Mon Jul 21 18:23:48 2014 New Revision: 268951 URL: http://svnweb.freebsd.org/changeset/base/268951 Log: MFC 264275: Explicitly initialize 'vmname' to NULL. Modified: stable/10/usr.sbin/bhyvectl/bhyvectl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyvectl/bhyvectl.c ============================================================================== --- stable/10/usr.sbin/bhyvectl/bhyvectl.c Mon Jul 21 18:13:14 2014 (r268950) +++ stable/10/usr.sbin/bhyvectl/bhyvectl.c Mon Jul 21 18:23:48 2014 (r268951) @@ -574,6 +574,7 @@ main(int argc, char *argv[]) }; vcpu = 0; + vmname = NULL; assert_lapic_lvt = -1; progname = basename(argv[0]); From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 18:26:52 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31DD015B; Mon, 21 Jul 2014 18:26:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EE8624B4; Mon, 21 Jul 2014 18:26:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LIQpHL066773; Mon, 21 Jul 2014 18:26:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LIQp8E066772; Mon, 21 Jul 2014 18:26:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407211826.s6LIQp8E066772@svn.freebsd.org> From: John Baldwin Date: Mon, 21 Jul 2014 18:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268952 - stable/10/sys/amd64/vmm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 18:26:52 -0000 Author: jhb Date: Mon Jul 21 18:26:51 2014 New Revision: 268952 URL: http://svnweb.freebsd.org/changeset/base/268952 Log: MFC 264347: Account for the "plus 1" encoding of the CPUID Function 4 reported core per package and cache sharing values. Modified: stable/10/sys/amd64/vmm/x86.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/vmm/x86.c ============================================================================== --- stable/10/sys/amd64/vmm/x86.c Mon Jul 21 18:23:48 2014 (r268951) +++ stable/10/sys/amd64/vmm/x86.c Mon Jul 21 18:26:51 2014 (r268952) @@ -219,9 +219,18 @@ x86_emulate_cpuid(struct vm *vm, int vcp /* * Do not expose topology. + * + * The maximum number of processor cores in + * this physical processor package and the + * maximum number of threads sharing this + * cache are encoded with "plus 1" encoding. + * Adding one to the value in this register + * field to obtains the actual value. + * + * Therefore 0 for both indicates 1 core per + * package and no cache sharing. */ regs[0] &= 0xffff8000; - regs[0] |= 0x04008000; break; case CPUID_0000_0007: From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 19:08:08 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4B95382; Mon, 21 Jul 2014 19:08:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF5A92898; Mon, 21 Jul 2014 19:08:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LJ88D0086189; Mon, 21 Jul 2014 19:08:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LJ83SF086092; Mon, 21 Jul 2014 19:08:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407211908.s6LJ83SF086092@svn.freebsd.org> From: John Baldwin Date: Mon, 21 Jul 2014 19:08:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268953 - in stable/10: lib/libvmmapi sys/amd64/vmm sys/amd64/vmm/intel sys/amd64/vmm/io sys/boot/userboot/userboot usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 19:08:09 -0000 Author: jhb Date: Mon Jul 21 19:08:02 2014 New Revision: 268953 URL: http://svnweb.freebsd.org/changeset/base/268953 Log: MFC 264353,264509,264768,264770,264825,264846,264988,265114,265165,265365, 265941,265951,266390,266550,266910: Various bhyve fixes: - Don't save host's return address in 'struct vmxctx'. - Permit non-32-bit accesses to local APIC registers. - Factor out common ioport handler code. - Use calloc() in favor of malloc + memset. - Change the vlapic timer frequency to be in the ballpark of contemporary hardware. - Allow the guest to read the TSC via MSR 0x10. - A VMCS is always inactive when it exits the vmx_run() loop. Remove redundant code and the misleading comment that suggest otherwise. - Ignore writes to microcode update MSR. This MSR is accessed by RHEL7 guest. Add KTR tracepoints to annotate wrmsr and rdmsr VM exits. - Provide an alias for the userboot console and name it 'comconsole'. - Use EV_ADD to create an mevent and EV_ENABLE to enable it. - abort(3) the process in response to a VMEXIT_ABORT. - Don't include the guest memory segments in the bhyve(8) process core dump. - Make the vmx asm code dtrace-fbt-friendly. - Allow vmx_getdesc() and vmx_setdesc() to be called for a vcpu that is in the VCPU_RUNNING state. - Enable VMX in the IA32_FEATURE_CONTROL MSR if it not enabled and the MSR isn't locked. Modified: stable/10/lib/libvmmapi/vmmapi.c stable/10/lib/libvmmapi/vmmapi.h stable/10/sys/amd64/vmm/intel/vmcs.c stable/10/sys/amd64/vmm/intel/vmcs.h stable/10/sys/amd64/vmm/intel/vmx.c stable/10/sys/amd64/vmm/intel/vmx.h stable/10/sys/amd64/vmm/intel/vmx_genassym.c stable/10/sys/amd64/vmm/intel/vmx_support.S stable/10/sys/amd64/vmm/io/vlapic.c stable/10/sys/amd64/vmm/vmm_ioport.c stable/10/sys/amd64/vmm/vmm_lapic.c stable/10/sys/boot/userboot/userboot/conf.c stable/10/sys/boot/userboot/userboot/userboot_cons.c stable/10/usr.sbin/bhyve/bhyve.8 stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyve/block_if.c stable/10/usr.sbin/bhyve/inout.c stable/10/usr.sbin/bhyve/mevent.c stable/10/usr.sbin/bhyve/pci_ahci.c stable/10/usr.sbin/bhyve/pci_emul.c stable/10/usr.sbin/bhyve/pci_passthru.c stable/10/usr.sbin/bhyve/pci_virtio_block.c stable/10/usr.sbin/bhyve/pci_virtio_net.c stable/10/usr.sbin/bhyve/pci_virtio_rnd.c stable/10/usr.sbin/bhyve/uart_emul.c stable/10/usr.sbin/bhyve/xmsr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libvmmapi/vmmapi.c ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/lib/libvmmapi/vmmapi.c Mon Jul 21 19:08:02 2014 (r268953) @@ -57,6 +57,7 @@ struct vmctx { int fd; uint32_t lowmem_limit; enum vm_mmap_style vms; + int memflags; size_t lowmem; char *lowmem_addr; size_t highmem; @@ -101,6 +102,7 @@ vm_open(const char *name) assert(vm != NULL); vm->fd = -1; + vm->memflags = 0; vm->lowmem_limit = 3 * GB; vm->name = (char *)(vm + 1); strcpy(vm->name, name); @@ -180,10 +182,17 @@ vm_set_lowmem_limit(struct vmctx *ctx, u ctx->lowmem_limit = limit; } +void +vm_set_memflags(struct vmctx *ctx, int flags) +{ + + ctx->memflags = flags; +} + static int setup_memory_segment(struct vmctx *ctx, vm_paddr_t gpa, size_t len, char **addr) { - int error; + int error, mmap_flags; struct vm_memory_segment seg; /* @@ -195,8 +204,11 @@ setup_memory_segment(struct vmctx *ctx, seg.len = len; error = ioctl(ctx->fd, VM_MAP_MEMORY, &seg); if (error == 0 && addr != NULL) { - *addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, - ctx->fd, gpa); + mmap_flags = MAP_SHARED; + if ((ctx->memflags & VM_MEM_F_INCORE) == 0) + mmap_flags |= MAP_NOCORE; + *addr = mmap(NULL, len, PROT_READ | PROT_WRITE, mmap_flags, + ctx->fd, gpa); } return (error); } Modified: stable/10/lib/libvmmapi/vmmapi.h ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.h Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/lib/libvmmapi/vmmapi.h Mon Jul 21 19:08:02 2014 (r268953) @@ -42,6 +42,8 @@ enum vm_mmap_style { VM_MMAP_SPARSE, /* mappings created on-demand */ }; +#define VM_MEM_F_INCORE 0x01 /* include guest memory in core file */ + int vm_create(const char *name); struct vmctx *vm_open(const char *name); void vm_destroy(struct vmctx *ctx); @@ -53,6 +55,7 @@ void *vm_map_gpa(struct vmctx *ctx, vm_p int vm_get_gpa_pmap(struct vmctx *, uint64_t gpa, uint64_t *pte, int *num); uint32_t vm_get_lowmem_limit(struct vmctx *ctx); void vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit); +void vm_set_memflags(struct vmctx *ctx, int flags); int vm_set_desc(struct vmctx *ctx, int vcpu, int reg, uint64_t base, uint32_t limit, uint32_t access); int vm_get_desc(struct vmctx *ctx, int vcpu, int reg, Modified: stable/10/sys/amd64/vmm/intel/vmcs.c ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmcs.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/intel/vmcs.c Mon Jul 21 19:08:02 2014 (r268953) @@ -231,7 +231,7 @@ vmcs_setreg(struct vmcs *vmcs, int runni } int -vmcs_setdesc(struct vmcs *vmcs, int seg, struct seg_desc *desc) +vmcs_setdesc(struct vmcs *vmcs, int running, int seg, struct seg_desc *desc) { int error; uint32_t base, limit, access; @@ -240,7 +240,8 @@ vmcs_setdesc(struct vmcs *vmcs, int seg, if (error != 0) panic("vmcs_setdesc: invalid segment register %d", seg); - VMPTRLD(vmcs); + if (!running) + VMPTRLD(vmcs); if ((error = vmwrite(base, desc->base)) != 0) goto done; @@ -252,12 +253,13 @@ vmcs_setdesc(struct vmcs *vmcs, int seg, goto done; } done: - VMCLEAR(vmcs); + if (!running) + VMCLEAR(vmcs); return (error); } int -vmcs_getdesc(struct vmcs *vmcs, int seg, struct seg_desc *desc) +vmcs_getdesc(struct vmcs *vmcs, int running, int seg, struct seg_desc *desc) { int error; uint32_t base, limit, access; @@ -267,7 +269,8 @@ vmcs_getdesc(struct vmcs *vmcs, int seg, if (error != 0) panic("vmcs_getdesc: invalid segment register %d", seg); - VMPTRLD(vmcs); + if (!running) + VMPTRLD(vmcs); if ((error = vmread(base, &u64)) != 0) goto done; desc->base = u64; @@ -282,7 +285,8 @@ vmcs_getdesc(struct vmcs *vmcs, int seg, desc->access = u64; } done: - VMCLEAR(vmcs); + if (!running) + VMCLEAR(vmcs); return (error); } Modified: stable/10/sys/amd64/vmm/intel/vmcs.h ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmcs.h Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/intel/vmcs.h Mon Jul 21 19:08:02 2014 (r268953) @@ -49,9 +49,9 @@ int vmcs_set_msr_save(struct vmcs *vmcs, int vmcs_init(struct vmcs *vmcs); int vmcs_getreg(struct vmcs *vmcs, int running, int ident, uint64_t *rv); int vmcs_setreg(struct vmcs *vmcs, int running, int ident, uint64_t val); -int vmcs_getdesc(struct vmcs *vmcs, int ident, +int vmcs_getdesc(struct vmcs *vmcs, int running, int ident, struct seg_desc *desc); -int vmcs_setdesc(struct vmcs *vmcs, int ident, +int vmcs_setdesc(struct vmcs *vmcs, int running, int ident, struct seg_desc *desc); static __inline uint64_t Modified: stable/10/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/intel/vmx.c Mon Jul 21 19:08:02 2014 (r268953) @@ -509,6 +509,15 @@ static void vmx_enable(void *arg __unused) { int error; + uint64_t feature_control; + + feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL); + if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 0 || + (feature_control & IA32_FEATURE_CONTROL_VMX_EN) == 0) { + wrmsr(MSR_IA32_FEATURE_CONTROL, + feature_control | IA32_FEATURE_CONTROL_VMX_EN | + IA32_FEATURE_CONTROL_LOCK); + } load_cr4(rcr4() | CR4_VMXE); @@ -544,7 +553,7 @@ vmx_init(int ipinum) * are set (bits 0 and 2 respectively). */ feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL); - if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 0 || + if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 1 && (feature_control & IA32_FEATURE_CONTROL_VMX_EN) == 0) { printf("vmx_init: VMX operation disabled by BIOS\n"); return (ENXIO); @@ -863,6 +872,11 @@ vmx_vminit(struct vm *vm, pmap_t pmap) * MSR_EFER is saved and restored in the guest VMCS area on a * VM exit and entry respectively. It is also restored from the * host VMCS area on a VM exit. + * + * The TSC MSR is exposed read-only. Writes are disallowed as that + * will impact the host TSC. + * XXX Writes would be implemented with a wrmsr trap, and + * then modifying the TSC offset in the VMCS. */ if (guest_msr_rw(vmx, MSR_GSBASE) || guest_msr_rw(vmx, MSR_FSBASE) || @@ -870,7 +884,8 @@ vmx_vminit(struct vm *vm, pmap_t pmap) guest_msr_rw(vmx, MSR_SYSENTER_ESP_MSR) || guest_msr_rw(vmx, MSR_SYSENTER_EIP_MSR) || guest_msr_rw(vmx, MSR_KGSBASE) || - guest_msr_rw(vmx, MSR_EFER)) + guest_msr_rw(vmx, MSR_EFER) || + guest_msr_ro(vmx, MSR_TSC)) panic("vmx_vminit: error setting guest msr access"); /* @@ -1829,6 +1844,7 @@ vmx_exit_process(struct vmx *vmx, int vc vmm_stat_incr(vmx->vm, vcpu, VMEXIT_RDMSR, 1); retu = false; ecx = vmxctx->guest_rcx; + VCPU_CTR1(vmx->vm, vcpu, "rdmsr 0x%08x", ecx); error = emulate_rdmsr(vmx->vm, vcpu, ecx, &retu); if (error) { vmexit->exitcode = VM_EXITCODE_RDMSR; @@ -1847,6 +1863,8 @@ vmx_exit_process(struct vmx *vmx, int vc eax = vmxctx->guest_rax; ecx = vmxctx->guest_rcx; edx = vmxctx->guest_rdx; + VCPU_CTR2(vmx->vm, vcpu, "wrmsr 0x%08x value 0x%016lx", + ecx, (uint64_t)edx << 32 | eax); error = emulate_wrmsr(vmx->vm, vcpu, ecx, (uint64_t)edx << 32 | eax, &retu); if (error) { @@ -2257,7 +2275,7 @@ vmx_run(void *arg, int vcpu, register_t static void vmx_vmcleanup(void *arg) { - int i, error; + int i; struct vmx *vmx = arg; if (apic_access_virtualization(vmx, 0)) @@ -2266,13 +2284,6 @@ vmx_vmcleanup(void *arg) for (i = 0; i < VM_MAXCPU; i++) vpid_free(vmx->state[i].vpid); - /* - * XXXSMP we also need to clear the VMCS active on the other vcpus. - */ - error = vmclear(&vmx->vmcs[0]); - if (error != 0) - panic("vmx_vmcleanup: vmclear error %d on vcpu 0", error); - free(vmx, M_VMX); return; @@ -2430,17 +2441,27 @@ vmx_setreg(void *arg, int vcpu, int reg, static int vmx_getdesc(void *arg, int vcpu, int reg, struct seg_desc *desc) { + int hostcpu, running; struct vmx *vmx = arg; - return (vmcs_getdesc(&vmx->vmcs[vcpu], reg, desc)); + running = vcpu_is_running(vmx->vm, vcpu, &hostcpu); + if (running && hostcpu != curcpu) + panic("vmx_getdesc: %s%d is running", vm_name(vmx->vm), vcpu); + + return (vmcs_getdesc(&vmx->vmcs[vcpu], running, reg, desc)); } static int vmx_setdesc(void *arg, int vcpu, int reg, struct seg_desc *desc) { + int hostcpu, running; struct vmx *vmx = arg; - return (vmcs_setdesc(&vmx->vmcs[vcpu], reg, desc)); + running = vcpu_is_running(vmx->vm, vcpu, &hostcpu); + if (running && hostcpu != curcpu) + panic("vmx_setdesc: %s%d is running", vm_name(vmx->vm), vcpu); + + return (vmcs_setdesc(&vmx->vmcs[vcpu], running, reg, desc)); } static int Modified: stable/10/sys/amd64/vmm/intel/vmx.h ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx.h Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/intel/vmx.h Mon Jul 21 19:08:02 2014 (r268953) @@ -60,7 +60,6 @@ struct vmxctx { register_t host_rbp; register_t host_rsp; register_t host_rbx; - register_t host_rip; /* * XXX todo debug registers and fpu state */ @@ -68,7 +67,7 @@ struct vmxctx { int inst_fail_status; /* - * The pmap needs to be deactivated in vmx_exit_guest() + * The pmap needs to be deactivated in vmx_enter_guest() * so keep a copy of the 'pmap' in each vmxctx. */ struct pmap *pmap; @@ -122,10 +121,11 @@ CTASSERT((offsetof(struct vmx, pir_desc[ #define VMX_VMLAUNCH_ERROR 2 #define VMX_INVEPT_ERROR 3 int vmx_enter_guest(struct vmxctx *ctx, struct vmx *vmx, int launched); -void vmx_exit_guest(void); void vmx_call_isr(uintptr_t entry); u_long vmx_fix_cr0(u_long cr0); u_long vmx_fix_cr4(u_long cr4); +extern char vmx_exit_guest[]; + #endif Modified: stable/10/sys/amd64/vmm/intel/vmx_genassym.c ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx_genassym.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/intel/vmx_genassym.c Mon Jul 21 19:08:02 2014 (r268953) @@ -65,7 +65,6 @@ ASSYM(VMXCTX_HOST_R12, offsetof(struct v ASSYM(VMXCTX_HOST_RBP, offsetof(struct vmxctx, host_rbp)); ASSYM(VMXCTX_HOST_RSP, offsetof(struct vmxctx, host_rsp)); ASSYM(VMXCTX_HOST_RBX, offsetof(struct vmxctx, host_rbx)); -ASSYM(VMXCTX_HOST_RIP, offsetof(struct vmxctx, host_rip)); ASSYM(VMXCTX_INST_FAIL_STATUS, offsetof(struct vmxctx, inst_fail_status)); ASSYM(VMXCTX_PMAP, offsetof(struct vmxctx, pmap)); Modified: stable/10/sys/amd64/vmm/intel/vmx_support.S ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx_support.S Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/intel/vmx_support.S Mon Jul 21 19:08:02 2014 (r268953) @@ -37,6 +37,10 @@ #define LK #endif +/* Be friendly to DTrace FBT's prologue/epilogue pattern matching */ +#define VENTER push %rbp ; mov %rsp,%rbp +#define VLEAVE pop %rbp + /* * Assumes that %rdi holds a pointer to the 'vmxctx'. * @@ -72,8 +76,7 @@ * * Assumes that %rdi holds a pointer to the 'vmxctx'. */ -#define VMX_HOST_SAVE(tmpreg) \ - movq (%rsp), tmpreg; /* return address */ \ +#define VMX_HOST_SAVE \ movq %r15, VMXCTX_HOST_R15(%rdi); \ movq %r14, VMXCTX_HOST_R14(%rdi); \ movq %r13, VMXCTX_HOST_R13(%rdi); \ @@ -81,9 +84,8 @@ movq %rbp, VMXCTX_HOST_RBP(%rdi); \ movq %rsp, VMXCTX_HOST_RSP(%rdi); \ movq %rbx, VMXCTX_HOST_RBX(%rdi); \ - movq tmpreg, VMXCTX_HOST_RIP(%rdi) -#define VMX_HOST_RESTORE(tmpreg) \ +#define VMX_HOST_RESTORE \ movq VMXCTX_HOST_R15(%rdi), %r15; \ movq VMXCTX_HOST_R14(%rdi), %r14; \ movq VMXCTX_HOST_R13(%rdi), %r13; \ @@ -91,8 +93,6 @@ movq VMXCTX_HOST_RBP(%rdi), %rbp; \ movq VMXCTX_HOST_RSP(%rdi), %rsp; \ movq VMXCTX_HOST_RBX(%rdi), %rbx; \ - movq VMXCTX_HOST_RIP(%rdi), tmpreg; \ - movq tmpreg, (%rsp) /* return address */ /* * vmx_enter_guest(struct vmxctx *vmxctx, int launched) @@ -102,10 +102,11 @@ * Interrupts must be disabled on entry. */ ENTRY(vmx_enter_guest) + VENTER /* * Save host state before doing anything else. */ - VMX_HOST_SAVE(%r10) + VMX_HOST_SAVE /* * Activate guest pmap on this cpu. @@ -186,15 +187,18 @@ inst_error: movl PCPU(CPUID), %r10d LK btrl %r10d, PM_ACTIVE(%r11) - VMX_HOST_RESTORE(%r10) + VMX_HOST_RESTORE + VLEAVE ret -END(vmx_enter_guest) /* - * void vmx_exit_guest(void) - * %rsp points to the struct vmxctx + * Non-error VM-exit from the guest. Make this a label so it can + * be used by C code when setting up the VMCS. + * The VMCS-restored %rsp points to the struct vmxctx */ -ENTRY(vmx_exit_guest) + ALIGN_TEXT + .globl vmx_exit_guest +vmx_exit_guest: /* * Save guest state that is not automatically saved in the vmcs. */ @@ -226,15 +230,16 @@ ENTRY(vmx_exit_guest) movl PCPU(CPUID), %r10d LK btrl %r10d, PM_ACTIVE(%r11) - VMX_HOST_RESTORE(%r10) + VMX_HOST_RESTORE /* * This will return to the caller of 'vmx_enter_guest()' with a return * value of VMX_GUEST_VMEXIT. */ movl $VMX_GUEST_VMEXIT, %eax + VLEAVE ret -END(vmx_exit_guest) +END(vmx_enter_guest) /* * %rdi = interrupt handler entry point @@ -243,6 +248,7 @@ END(vmx_exit_guest) * instruction in Intel SDM, Vol 2. */ ENTRY(vmx_call_isr) + VENTER mov %rsp, %r11 /* save %rsp */ and $~0xf, %rsp /* align on 16-byte boundary */ pushq $KERNEL_SS /* %ss */ @@ -251,5 +257,6 @@ ENTRY(vmx_call_isr) pushq $KERNEL_CS /* %cs */ cli /* disable interrupts */ callq *%rdi /* push %rip and call isr */ + VLEAVE ret END(vmx_call_isr) Modified: stable/10/sys/amd64/vmm/io/vlapic.c ============================================================================== --- stable/10/sys/amd64/vmm/io/vlapic.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/io/vlapic.c Mon Jul 21 19:08:02 2014 (r268953) @@ -70,7 +70,12 @@ __FBSDID("$FreeBSD$"); #define VLAPIC_TIMER_UNLOCK(vlapic) mtx_unlock_spin(&((vlapic)->timer_mtx)) #define VLAPIC_TIMER_LOCKED(vlapic) mtx_owned(&((vlapic)->timer_mtx)) -#define VLAPIC_BUS_FREQ tsc_freq +/* + * APIC timer frequency: + * - arbitrary but chosen to be in the ballpark of contemporary hardware. + * - power-of-two to avoid loss of precision when converted to a bintime. + */ +#define VLAPIC_BUS_FREQ (128 * 1024 * 1024) static __inline uint32_t vlapic_get_id(struct vlapic *vlapic) Modified: stable/10/sys/amd64/vmm/vmm_ioport.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm_ioport.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/vmm_ioport.c Mon Jul 21 19:08:02 2014 (r268953) @@ -69,18 +69,19 @@ emulate_ioport(struct vm *vm, int vcpuid if (handler == NULL) return (-1); + switch (vmexit->u.inout.bytes) { + case 1: + mask = 0xff; + break; + case 2: + mask = 0xffff; + break; + default: + mask = 0xffffffff; + break; + } + if (!vmexit->u.inout.in) { - switch (vmexit->u.inout.bytes) { - case 1: - mask = 0xff; - break; - case 2: - mask = 0xffff; - break; - default: - mask = 0xffffffff; - break; - } val = vmexit->u.inout.eax & mask; } @@ -88,17 +89,6 @@ emulate_ioport(struct vm *vm, int vcpuid vmexit->u.inout.port, vmexit->u.inout.bytes, &val); if (!error && vmexit->u.inout.in) { - switch (vmexit->u.inout.bytes) { - case 1: - mask = 0xff; - break; - case 2: - mask = 0xffff; - break; - default: - mask = 0xffffffff; - break; - } vmexit->u.inout.eax &= ~mask; vmexit->u.inout.eax |= val & mask; } Modified: stable/10/sys/amd64/vmm/vmm_lapic.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm_lapic.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/amd64/vmm/vmm_lapic.c Mon Jul 21 19:08:02 2014 (r268953) @@ -230,10 +230,12 @@ lapic_mmio_read(void *vm, int cpu, uint6 off = gpa - DEFAULT_APIC_BASE; /* - * Memory mapped local apic accesses must be 4 bytes wide and - * aligned on a 16-byte boundary. + * Memory mapped local apic accesses should be aligned on a + * 16-byte boundary. They are also suggested to be 4 bytes + * wide, alas not all OSes follow suggestions. */ - if (size != 4 || off & 0xf) + off &= ~3; + if (off & 0xf) return (EINVAL); vlapic = vm_lapic(vm, cpu); Modified: stable/10/sys/boot/userboot/userboot/conf.c ============================================================================== --- stable/10/sys/boot/userboot/userboot/conf.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/boot/userboot/userboot/conf.c Mon Jul 21 19:08:02 2014 (r268953) @@ -97,8 +97,10 @@ struct file_format *file_formats[] = { * data structures from bootstrap.h as well. */ extern struct console userboot_console; +extern struct console userboot_comconsole; struct console *consoles[] = { &userboot_console, + &userboot_comconsole, NULL }; Modified: stable/10/sys/boot/userboot/userboot/userboot_cons.c ============================================================================== --- stable/10/sys/boot/userboot/userboot/userboot_cons.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/sys/boot/userboot/userboot/userboot_cons.c Mon Jul 21 19:08:02 2014 (r268953) @@ -33,8 +33,12 @@ __FBSDID("$FreeBSD$"); int console; +static struct console *userboot_comconsp; + static void userboot_cons_probe(struct console *cp); static int userboot_cons_init(int); +static void userboot_comcons_probe(struct console *cp); +static int userboot_comcons_init(int); static void userboot_cons_putchar(int); static int userboot_cons_getchar(void); static int userboot_cons_poll(void); @@ -50,6 +54,21 @@ struct console userboot_console = { userboot_cons_poll, }; +/* + * Provide a simple alias to allow loader scripts to set the + * console to comconsole without resulting in an error + */ +struct console userboot_comconsole = { + "comconsole", + "comconsole", + 0, + userboot_comcons_probe, + userboot_comcons_init, + userboot_cons_putchar, + userboot_cons_getchar, + userboot_cons_poll, +}; + static void userboot_cons_probe(struct console *cp) { @@ -65,6 +84,31 @@ userboot_cons_init(int arg) } static void +userboot_comcons_probe(struct console *cp) +{ + + /* + * Save the console pointer so the comcons_init routine + * can set the C_PRESENT* flags. They are not set + * here to allow the existing userboot console to + * be elected the default. + */ + userboot_comconsp = cp; +} + +static int +userboot_comcons_init(int arg) +{ + + /* + * Set the C_PRESENT* flags to allow the comconsole + * to be selected as the active console + */ + userboot_comconsp->c_flags |= (C_PRESENTIN | C_PRESENTOUT); + return (0); +} + +static void userboot_cons_putchar(int c) { Modified: stable/10/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/10/usr.sbin/bhyve/bhyve.8 Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/bhyve.8 Mon Jul 21 19:08:02 2014 (r268953) @@ -32,7 +32,7 @@ .Nd "run a guest operating system inside a virtual machine" .Sh SYNOPSIS .Nm -.Op Fl aehwxAHPW +.Op Fl aehwxACHPW .Op Fl c Ar numcpus .Op Fl g Ar gdbport .Op Fl p Ar vcpu:hostcpu @@ -69,6 +69,8 @@ guests. .It Fl c Ar numcpus Number of guest virtual CPUs. The default is 1 and the maximum is 16. +.It Fl C +Include guest memory in core file. .It Fl H Yield the virtual CPU thread when a HLT instruction is detected. If this option is not specified, virtual CPUs will use 100% of a host CPU. Modified: stable/10/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/bhyverun.c Mon Jul 21 19:08:02 2014 (r268953) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */ -#define VMEXIT_SWITCH 0 /* force vcpu switch in mux mode */ #define VMEXIT_CONTINUE 1 /* continue from next instruction */ #define VMEXIT_RESTART 2 /* restart current instruction */ #define VMEXIT_ABORT 3 /* abort the vm run loop */ @@ -135,6 +134,7 @@ usage(int code) " -A: create an ACPI table\n" " -g: gdb port\n" " -c: # cpus (default 1)\n" + " -C: include guest memory in core file\n" " -p: pin 'vcpu' to 'hostcpu'\n" " -H: vmexit from the guest on hlt\n" " -P: vmexit from the guest on pause\n" @@ -272,12 +272,6 @@ fbsdrun_deletecpu(struct vmctx *ctx, int } static int -vmexit_catch_inout(void) -{ - return (VMEXIT_ABORT); -} - -static int vmexit_handle_notify(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu, uint32_t eax) { @@ -330,7 +324,7 @@ vmexit_inout(struct vmctx *ctx, struct v fprintf(stderr, "Unhandled %s%c 0x%04x\n", in ? "in" : "out", bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), port); - return (vmexit_catch_inout()); + return (VMEXIT_ABORT); } } @@ -575,6 +569,8 @@ vm_loop(struct vmctx *ctx, int vcpu, uin assert(error == 0 || errno == EALREADY); rip = vmexit[vcpu].rip + vmexit[vcpu].inst_length; break; + case VMEXIT_ABORT: + abort(); default: exit(1); } @@ -647,19 +643,20 @@ int main(int argc, char *argv[]) { int c, error, gdb_port, err, bvmcons; - int max_vcpus, mptgen; + int dump_guest_memory, max_vcpus, mptgen; struct vmctx *ctx; uint64_t rip; size_t memsize; bvmcons = 0; + dump_guest_memory = 0; progname = basename(argv[0]); gdb_port = 0; guest_ncpus = 1; memsize = 256 * MB; mptgen = 1; - while ((c = getopt(argc, argv, "abehwxAHIPWYp:g:c:s:m:l:U:")) != -1) { + while ((c = getopt(argc, argv, "abehwxACHIPWYp:g:c:s:m:l:U:")) != -1) { switch (c) { case 'a': x2apic_mode = 0; @@ -679,6 +676,9 @@ main(int argc, char *argv[]) case 'c': guest_ncpus = atoi(optarg); break; + case 'C': + dump_guest_memory = 1; + break; case 'g': gdb_port = atoi(optarg); break; @@ -760,6 +760,8 @@ main(int argc, char *argv[]) fbsdrun_set_capabilities(ctx, BSP); + if (dump_guest_memory) + vm_set_memflags(ctx, VM_MEM_F_INCORE); err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL); if (err) { fprintf(stderr, "Unable to setup memory (%d)\n", err); Modified: stable/10/usr.sbin/bhyve/block_if.c ============================================================================== --- stable/10/usr.sbin/bhyve/block_if.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/block_if.c Mon Jul 21 19:08:02 2014 (r268953) @@ -270,13 +270,12 @@ blockif_open(const char *optstr, const c assert(sectsz != 0); } - bc = malloc(sizeof(struct blockif_ctxt)); + bc = calloc(1, sizeof(struct blockif_ctxt)); if (bc == NULL) { close(fd); return (NULL); } - memset(bc, 0, sizeof(*bc)); bc->bc_magic = BLOCKIF_SIG; bc->bc_fd = fd; bc->bc_size = size; Modified: stable/10/usr.sbin/bhyve/inout.c ============================================================================== --- stable/10/usr.sbin/bhyve/inout.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/inout.c Mon Jul 21 19:08:02 2014 (r268953) @@ -107,18 +107,19 @@ emulate_inout(struct vmctx *ctx, int vcp if (strict && handler == default_inout) return (-1); + switch (bytes) { + case 1: + mask = 0xff; + break; + case 2: + mask = 0xffff; + break; + default: + mask = 0xffffffff; + break; + } + if (!in) { - switch (bytes) { - case 1: - mask = 0xff; - break; - case 2: - mask = 0xffff; - break; - default: - mask = 0xffffffff; - break; - } val = *eax & mask; } @@ -131,17 +132,6 @@ emulate_inout(struct vmctx *ctx, int vcp error = -1; if (!error && in) { - switch (bytes) { - case 1: - mask = 0xff; - break; - case 2: - mask = 0xffff; - break; - default: - mask = 0xffffffff; - break; - } *eax &= ~mask; *eax |= val & mask; } Modified: stable/10/usr.sbin/bhyve/mevent.c ============================================================================== --- stable/10/usr.sbin/bhyve/mevent.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/mevent.c Mon Jul 21 19:08:02 2014 (r268953) @@ -52,9 +52,10 @@ __FBSDID("$FreeBSD$"); #define MEVENT_MAX 64 -#define MEV_ENABLE 1 -#define MEV_DISABLE 2 -#define MEV_DEL_PENDING 3 +#define MEV_ADD 1 +#define MEV_ENABLE 2 +#define MEV_DISABLE 3 +#define MEV_DEL_PENDING 4 extern char *vmname; @@ -147,10 +148,11 @@ mevent_kq_flags(struct mevent *mevp) int ret; switch (mevp->me_state) { + case MEV_ADD: + ret = EV_ADD; /* implicitly enabled */ + break; case MEV_ENABLE: - ret = EV_ADD; - if (mevp->me_type == EVF_TIMER) - ret |= EV_ENABLE; + ret = EV_ENABLE; break; case MEV_DISABLE: ret = EV_DISABLE; @@ -158,6 +160,9 @@ mevent_kq_flags(struct mevent *mevp) case MEV_DEL_PENDING: ret = EV_DELETE; break; + default: + assert(0); + break; } return (ret); @@ -268,12 +273,11 @@ mevent_add(int tfd, enum ev_type type, /* * Allocate an entry, populate it, and add it to the change list. */ - mevp = malloc(sizeof(struct mevent)); + mevp = calloc(1, sizeof(struct mevent)); if (mevp == NULL) { goto exit; } - memset(mevp, 0, sizeof(struct mevent)); if (type == EVF_TIMER) { mevp->me_msecs = tfd; mevp->me_timid = mevent_timid++; @@ -285,7 +289,7 @@ mevent_add(int tfd, enum ev_type type, LIST_INSERT_HEAD(&change_head, mevp, me_list); mevp->me_cq = 1; - mevp->me_state = MEV_ENABLE; + mevp->me_state = MEV_ADD; mevent_notify(); exit: Modified: stable/10/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_ahci.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/pci_ahci.c Mon Jul 21 19:08:02 2014 (r268953) @@ -1786,8 +1786,7 @@ pci_ahci_init(struct vmctx *ctx, struct dbg = fopen("/tmp/log", "w+"); #endif - sc = malloc(sizeof(struct pci_ahci_softc)); - memset(sc, 0, sizeof(struct pci_ahci_softc)); + sc = calloc(1, sizeof(struct pci_ahci_softc)); pi->pi_arg = sc; sc->asc_pi = pi; sc->ports = MAX_PORTS; Modified: stable/10/usr.sbin/bhyve/pci_emul.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_emul.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/pci_emul.c Mon Jul 21 19:08:02 2014 (r268953) @@ -705,8 +705,7 @@ pci_emul_init(struct vmctx *ctx, struct struct pci_devinst *pdi; int err; - pdi = malloc(sizeof(struct pci_devinst)); - bzero(pdi, sizeof(*pdi)); + pdi = calloc(1, sizeof(struct pci_devinst)); pdi->pi_vmctx = ctx; pdi->pi_bus = bus; @@ -798,8 +797,7 @@ pci_msix_table_init(struct pci_devinst * assert(table_entries <= MAX_MSIX_TABLE_ENTRIES); table_size = table_entries * MSIX_TABLE_ENTRY_SIZE; - pi->pi_msix.table = malloc(table_size); - bzero(pi->pi_msix.table, table_size); + pi->pi_msix.table = calloc(1, table_size); /* set mask bit of vector control register */ for (i = 0; i < table_entries; i++) @@ -1809,8 +1807,7 @@ pci_emul_dinit(struct vmctx *ctx, struct int error; struct pci_emul_dsoftc *sc; - sc = malloc(sizeof(struct pci_emul_dsoftc)); - memset(sc, 0, sizeof(struct pci_emul_dsoftc)); + sc = calloc(1, sizeof(struct pci_emul_dsoftc)); pi->pi_arg = sc; Modified: stable/10/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_passthru.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/pci_passthru.c Mon Jul 21 19:08:02 2014 (r268953) @@ -232,8 +232,7 @@ cfginitmsi(struct passthru_softc *sc) /* Allocate the emulated MSI-X table array */ table_size = pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE; - pi->pi_msix.table = malloc(table_size); - bzero(pi->pi_msix.table, table_size); + pi->pi_msix.table = calloc(1, table_size); /* Mask all table entries */ for (i = 0; i < pi->pi_msix.table_count; i++) { @@ -574,8 +573,7 @@ passthru_init(struct vmctx *ctx, struct if (vm_assign_pptdev(ctx, bus, slot, func) != 0) goto done; - sc = malloc(sizeof(struct passthru_softc)); - memset(sc, 0, sizeof(struct passthru_softc)); + sc = calloc(1, sizeof(struct passthru_softc)); pi->pi_arg = sc; sc->psc_pi = pi; Modified: stable/10/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_virtio_block.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/pci_virtio_block.c Mon Jul 21 19:08:02 2014 (r268953) @@ -299,8 +299,7 @@ pci_vtblk_init(struct vmctx *ctx, struct assert(sectsz != 0); } - sc = malloc(sizeof(struct pci_vtblk_softc)); - memset(sc, 0, sizeof(struct pci_vtblk_softc)); + sc = calloc(1, sizeof(struct pci_vtblk_softc)); /* record fd of storage device/file */ sc->vbsc_fd = fd; Modified: stable/10/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_virtio_net.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/pci_virtio_net.c Mon Jul 21 19:08:02 2014 (r268953) @@ -513,8 +513,7 @@ pci_vtnet_init(struct vmctx *ctx, struct char *vtopts; int mac_provided; - sc = malloc(sizeof(struct pci_vtnet_softc)); - memset(sc, 0, sizeof(struct pci_vtnet_softc)); + sc = calloc(1, sizeof(struct pci_vtnet_softc)); pthread_mutex_init(&sc->vsc_mtx, NULL); Modified: stable/10/usr.sbin/bhyve/pci_virtio_rnd.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_virtio_rnd.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/pci_virtio_rnd.c Mon Jul 21 19:08:02 2014 (r268953) @@ -155,8 +155,7 @@ pci_vtrnd_init(struct vmctx *ctx, struct return (1); } - sc = malloc(sizeof(struct pci_vtrnd_softc)); - memset(sc, 0, sizeof(struct pci_vtrnd_softc)); + sc = calloc(1, sizeof(struct pci_vtrnd_softc)); vi_softc_linkup(&sc->vrsc_vs, &vtrnd_vi_consts, sc, pi, &sc->vrsc_vq); sc->vrsc_vs.vs_mtx = &sc->vrsc_mtx; Modified: stable/10/usr.sbin/bhyve/uart_emul.c ============================================================================== --- stable/10/usr.sbin/bhyve/uart_emul.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/uart_emul.c Mon Jul 21 19:08:02 2014 (r268953) @@ -594,8 +594,7 @@ uart_init(uart_intr_func_t intr_assert, { struct uart_softc *sc; - sc = malloc(sizeof(struct uart_softc)); - bzero(sc, sizeof(struct uart_softc)); + sc = calloc(1, sizeof(struct uart_softc)); sc->arg = arg; sc->intr_assert = intr_assert; Modified: stable/10/usr.sbin/bhyve/xmsr.c ============================================================================== --- stable/10/usr.sbin/bhyve/xmsr.c Mon Jul 21 18:26:51 2014 (r268952) +++ stable/10/usr.sbin/bhyve/xmsr.c Mon Jul 21 19:08:02 2014 (r268953) @@ -47,6 +47,8 @@ emulate_wrmsr(struct vmctx *ctx, int vcp case 0xd04: /* Sandy Bridge uncore PMC MSRs */ case 0xc24: return (0); + case 0x79: + return (0); /* IA32_BIOS_UPDT_TRIG MSR */ default: break; } From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 20:08:54 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2BF088E3; Mon, 21 Jul 2014 20:08:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E2292E3D; Mon, 21 Jul 2014 20:08:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LK8rFv014473; Mon, 21 Jul 2014 20:08:53 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LK8rdx014471; Mon, 21 Jul 2014 20:08:53 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201407212008.s6LK8rdx014471@svn.freebsd.org> From: Sean Bruno Date: Mon, 21 Jul 2014 20:08:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268955 - stable/10/sys/dev/ciss X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 20:08:54 -0000 Author: sbruno Date: Mon Jul 21 20:08:53 2014 New Revision: 268955 URL: http://svnweb.freebsd.org/changeset/base/268955 Log: MFC r268017 and r268018 268017: Check return of cam_periph_find() before using it in a printf. 268018: Add detection for ciss(4) controllers that are set to non-raid JBOD mode. Modified: stable/10/sys/dev/ciss/ciss.c stable/10/sys/dev/ciss/cissreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ciss/ciss.c ============================================================================== --- stable/10/sys/dev/ciss/ciss.c Mon Jul 21 19:33:08 2014 (r268954) +++ stable/10/sys/dev/ciss/ciss.c Mon Jul 21 20:08:53 2014 (r268955) @@ -1220,7 +1220,7 @@ ciss_identify_adapter(struct ciss_softc } /* sanity-check reply */ - if (!sc->ciss_id->big_map_supported) { + if (!(sc->ciss_id->controller_flags & CONTROLLER_FLAGS_BIG_MAP_SUPPORT)) { ciss_printf(sc, "adapter does not support BIG_MAP\n"); error = ENXIO; goto out; @@ -1250,7 +1250,7 @@ ciss_identify_adapter(struct ciss_softc sc->ciss_id->configured_logical_drives, (sc->ciss_id->configured_logical_drives == 1) ? "" : "s"); ciss_printf(sc, " firmware %4.4s\n", sc->ciss_id->running_firmware_revision); - ciss_printf(sc, " %d SCSI channels\n", sc->ciss_id->scsi_bus_count); + ciss_printf(sc, " %d SCSI channels\n", sc->ciss_id->scsi_chip_count); ciss_printf(sc, " signature '%.4s'\n", sc->ciss_cfg->signature); ciss_printf(sc, " valence %d\n", sc->ciss_cfg->valence); @@ -1274,6 +1274,10 @@ ciss_identify_adapter(struct ciss_softc ciss_printf(sc, " max logical logical volumes: %d\n", sc->ciss_cfg->max_logical_supported); ciss_printf(sc, " max physical disks supported: %d\n", sc->ciss_cfg->max_physical_supported); ciss_printf(sc, " max physical disks per logical volume: %d\n", sc->ciss_cfg->max_physical_per_logical); + ciss_printf(sc, " JBOD Support is %s\n", (sc->ciss_id->uiYetMoreControllerFlags & YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED) ? + "Available" : "Unavailable"); + ciss_printf(sc, " JBOD Mode is %s\n", (sc->ciss_id->PowerUPNvramFlags & PWR_UP_FLAG_JBOD_ENABLED) ? + "Enabled" : "Disabled"); } out: @@ -3387,25 +3391,28 @@ ciss_cam_complete_fixup(struct ciss_soft bus = cam_sim_bus(xpt_path_sim(csio->ccb_h.path)); /* - * Don't let hard drives be seen by the DA driver. They will still be - * attached by the PASS driver. + * If the controller is in JBOD mode, there are no logical volumes. + * Let the disks be probed and dealt with via CAM. Else, mask off + * the physical disks and setup the parts of the inq structure for + * the logical volume. swb */ - if (CISS_IS_PHYSICAL(bus)) { - if (SID_TYPE(inq) == T_DIRECT) - inq->device = (inq->device & 0xe0) | T_NODEVICE; - return; + if( !(sc->ciss_id->PowerUPNvramFlags & PWR_UP_FLAG_JBOD_ENABLED)){ + if (CISS_IS_PHYSICAL(bus)) { + if (SID_TYPE(inq) == T_DIRECT) + inq->device = (inq->device & 0xe0) | T_NODEVICE; + return; + } + cl = &sc->ciss_logical[bus][target]; + + padstr(inq->vendor, "HP", + SID_VENDOR_SIZE); + padstr(inq->product, + ciss_name_ldrive_org(cl->cl_ldrive->fault_tolerance), + SID_PRODUCT_SIZE); + padstr(inq->revision, + ciss_name_ldrive_status(cl->cl_lstatus->status), + SID_REVISION_SIZE); } - - cl = &sc->ciss_logical[bus][target]; - - padstr(inq->vendor, "HP", - SID_VENDOR_SIZE); - padstr(inq->product, - ciss_name_ldrive_org(cl->cl_ldrive->fault_tolerance), - SID_PRODUCT_SIZE); - padstr(inq->revision, - ciss_name_ldrive_status(cl->cl_lstatus->status), - SID_REVISION_SIZE); } } @@ -3429,13 +3436,17 @@ ciss_name_device(struct ciss_softc *sc, target, 0); if (status == CAM_REQ_CMP) { + mtx_lock(&sc->ciss_mtx); xpt_path_lock(path); periph = cam_periph_find(path, NULL); - sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d", - periph->periph_name, periph->unit_number); xpt_path_unlock(path); + mtx_unlock(&sc->ciss_mtx); xpt_free_path(path); - return(0); + if (periph != NULL) { + sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d", + periph->periph_name, periph->unit_number); + return(0); + } } sc->ciss_logical[bus][target].cl_name[0] = 0; return(ENOENT); Modified: stable/10/sys/dev/ciss/cissreg.h ============================================================================== --- stable/10/sys/dev/ciss/cissreg.h Mon Jul 21 19:33:08 2014 (r268954) +++ stable/10/sys/dev/ciss/cissreg.h Mon Jul 21 20:08:53 2014 (r268955) @@ -615,26 +615,124 @@ struct ciss_bmic_id_table { char running_firmware_revision[4]; char stored_firmware_revision[4]; u_int8_t hardware_revision; - u_int8_t res1[4]; + u_int8_t boot_block_revision[4]; u_int32_t deprecated_drive_present_map; u_int32_t deprecated_external_drive_present_map; u_int32_t board_id; - u_int8_t res2; + u_int8_t swapped_error_cable; u_int32_t deprecated_non_disk_map; - u_int8_t res3[5]; + u_int8_t bad_host_ram_addr; + u_int8_t cpu_revision; + u_int8_t res3[3]; char marketting_revision; - u_int8_t res4:3; - u_int8_t more_than_seven_supported:1; - u_int8_t res5:3; - u_int8_t big_map_supported:1; /* must be set! */ - u_int8_t res6[2]; - u_int8_t scsi_bus_count; - u_int32_t res7; + u_int8_t controller_flags; +#define CONTROLLER_FLAGS_FLASH_ROM_INSTALLED 0x01 +#define CONTROLLER_FLAGS_DIAGS_MODE_BIT 0x02 +#define CONTROLLER_FLAGS_EXPAND_32MB_FX 0x04 +#define CONTROLLER_FLAGS_MORE_THAN_7_SUPPORT 0x08 +#define CONTROLLER_FLAGS_DAISY_SUPPORT_BIT 0x10 +#define CONTROLLER_FLAGS_RES6 0x20 +#define CONTROLLER_FLAGS_RES7 0x40 +#define CONTROLLER_FLAGS_BIG_MAP_SUPPORT 0x80 + u_int8_t host_flags; +#define HOST_FLAGS_SDB_ASIC_WORK_AROUND 0x01 +#define HOST_FLAGS_PCI_DATA_BUS_PARITY_SUPPORT 0x02 +#define HOST_FLAGS_RES3 0x04 +#define HOST_FLAGS_RES4 0x08 +#define HOST_FLAGS_RES5 0x10 +#define HOST_FLAGS_RES6 0x20 +#define HOST_FLAGS_RES7 0x30 +#define HOST_FLAGS_RES8 0x40 + u_int8_t expand_disable_code; +#define EXPAND_DISABLE_NOT_NEEDED 0x01 +#define EXPAND_DISABLE_MISSING_CACHE_BOARD 0x02 +#define EXPAND_DISABLE_WCXC_FATAL_CACHE_BITS 0x04 +#define EXPAND_DISABLE_CACHE_PERM_DISABLED 0x08 +#define EXPAND_DISABLE_RAM_ALLOCATION_FAILED 0x10 +#define EXPAND_DISABLE_BATTEREIS_DISCHARGED 0x20 +#define EXPAND_DISABLE_RES7 0x40 +#define EXPAND_DISABLE_REBUILD_RUNNING 0x80 + u_int8_t scsi_chip_count; + u_int32_t maximum_blocks; u_int32_t controller_clock; u_int8_t drives_per_scsi_bus; u_int8_t big_drive_present_map[CISS_BIG_MAP_ENTRIES / 8]; u_int8_t big_external_drive_present_map[CISS_BIG_MAP_ENTRIES / 8]; u_int8_t big_non_disk_map[CISS_BIG_MAP_ENTRIES / 8]; + + u_int16_t task_flags; /* used for FW debugging */ + u_int8_t ICL_bus_map; /* Bitmap used for ICL between controllers */ + u_int8_t redund_ctlr_modes_support; /* See REDUNDANT MODE VALUES */ + u_int8_t curr_redund_ctlr_mode; + u_int8_t redund_ctlr_status; + u_int8_t redund_op_failure_code; + + u_int8_t unsupported_nile_bus; + u_int8_t host_i2c_autorev; + u_int8_t cpld_revision; + u_int8_t fibre_chip_count; + u_int8_t daughterboard_type; + u_int8_t more_swapped_config_cable_error; + + u_int8_t license_key_status; + u_int8_t access_module_status; + u_int8_t features_supported[12]; + u_int8_t rec_rom_inact_rev[4]; /* Recovery ROM inactive f/w revision */ + u_int8_t rec_rom_act_status; /* Recovery ROM flags */ + u_int8_t pci_to_pci_status; /* PCI to PCI bridge status */ + u_int32_t redundant_server_info; /* Reserved for future use */ + u_int8_t percent_write_cache; /* Percent of memory allocated to write cache */ + u_int16_t daughterboard_size_mb; /* Total size (MB) of cache board */ + u_int8_t cache_batter_count; /* Number of cache batteries */ + u_int16_t total_controller_mem_mb; /* Total size (MB) of atttached memory */ + u_int8_t more_controller_flags; /* Additional controller flags byte */ + u_int8_t x_board_host_i2c_rev; /* 2nd byte of 3 byte autorev field */ + u_int8_t battery_pic_rev; /* BBWC PIC revision */ +/* + * Below here I have no documentation on the rest of this data structure. It is + * inferred from the opensource cciss_vol_status application. I assume that this + * data strucutre is 512 bytes in total size, do not exceed it. + */ + u_int8_t bDdffVersion[4]; /* DDFF update engine version */ + u_int16_t usMaxLogicalUnits; /* Maximum logical units supported */ + u_int16_t usExtLogicalUnitCount; /* Big num configured logical units */ + u_int16_t usMaxPhysicalDevices; /* Maximum physical devices supported */ + u_int16_t usMaxPhyDrvPerLogicalUnit; /* Max physical drive per logical unit */ + u_int8_t bEnclosureCount; /* Number of attached enclosures */ + u_int8_t bExpanderCount; /* Number of expanders detected */ + u_int16_t usOffsetToEDPbitmap; /* Offset to extended drive present map*/ + u_int16_t usOffsetToEEDPbitmap; /* Offset to extended external drive present map */ + u_int16_t usOffsetToENDbitmap; /* Offset to extended non-disk map */ + u_int8_t bInternalPortStatus[8]; /* Internal port status bytes */ + u_int8_t bExternalPortStatus[8]; /* External port status bytes */ + u_int32_t uiYetMoreControllerFlags;/* Yet More Controller flags */ +#define YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED \ + ( 1 << 25 ) /* Controller has JBOD support */ + + u_int8_t bLastLockup; /* Last lockup code */ + u_int8_t bSlot; /* PCI slot according to option ROM*/ + u_int16_t usBuildNum; /* Build number */ + u_int32_t uiMaxSafeFullStripeSize; /* Maximum safe full stripe size */ + u_int32_t uiTotalLength; /* Total structure length */ + u_int8_t bVendorID[8]; /* Vendor ID */ + u_int8_t bProductID[16]; /* Product ID */ +/* + * These are even more obscure as they seem to only be available in cciss_vol_status + */ + u_int32_t ExtendedLastLockupCode; + u_int16_t MaxRaid; + u_int16_t MaxParity; + u_int16_t MaxADGStripSize; + u_int16_t YetMoreSwappedCables; + u_int8_t MaxDevicePaths; + u_int8_t PowerUPNvramFlags; +#define PWR_UP_FLAG_JBOD_ENABLED 0x08 /*JBOD mode is enabled, all RAID features off */ + + u_int16_t ZonedOffset; + u_int32_t FixedFieldsLength; + u_int8_t FWCompileTimeStamp[24]; + u_int32_t EvenMoreControllerFlags; + u_int8_t padding[240]; } __packed; /* CISS_BMIC_ID_PDRIVE */ From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 20:38:22 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9062A5B0; Mon, 21 Jul 2014 20:38:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6402820EA; Mon, 21 Jul 2014 20:38:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LKcM49028732; Mon, 21 Jul 2014 20:38:22 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LKcM9V028731; Mon, 21 Jul 2014 20:38:22 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201407212038.s6LKcM9V028731@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 21 Jul 2014 20:38:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268956 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 20:38:22 -0000 Author: np Date: Mon Jul 21 20:38:21 2014 New Revision: 268956 URL: http://svnweb.freebsd.org/changeset/base/268956 Log: MFC r268450 (by glebius). The leak affects stable/10 too. In several cases in ip_output() we obtain reference on ifa. Do not leak it. Modified: stable/10/sys/netinet/ip_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_output.c ============================================================================== --- stable/10/sys/netinet/ip_output.c Mon Jul 21 20:08:53 2014 (r268955) +++ stable/10/sys/netinet/ip_output.c Mon Jul 21 20:38:21 2014 (r268956) @@ -135,6 +135,7 @@ ip_output(struct mbuf *m, struct mbuf *o struct rtentry *rte; /* cache for ro->ro_rt */ struct in_addr odst; struct m_tag *fwd_tag = NULL; + int have_ia_ref; #ifdef IPSEC int no_route_but_check_spd = 0; #endif @@ -200,6 +201,7 @@ ip_output(struct mbuf *m, struct mbuf *o gw = dst = (struct sockaddr_in *)&ro->ro_dst; again: ia = NULL; + have_ia_ref = 0; /* * If there is a cached route, * check that it is to the same destination @@ -237,6 +239,7 @@ again: error = ENETUNREACH; goto bad; } + have_ia_ref = 1; ip->ip_dst.s_addr = INADDR_BROADCAST; dst->sin_addr = ip->ip_dst; ifp = ia->ia_ifp; @@ -249,6 +252,7 @@ again: error = ENETUNREACH; goto bad; } + have_ia_ref = 1; ifp = ia->ia_ifp; ip->ip_ttl = 1; isbroadcast = in_broadcast(dst->sin_addr, ifp); @@ -260,6 +264,8 @@ again: */ ifp = imo->imo_multicast_ifp; IFP_TO_IA(ifp, ia); + if (ia) + have_ia_ref = 1; isbroadcast = 0; /* fool gcc */ } else { /* @@ -531,8 +537,11 @@ sendit: #endif error = netisr_queue(NETISR_IP, m); goto done; - } else + } else { + if (have_ia_ref) + ifa_free(&ia->ia_ifa); goto again; /* Redo the routing table lookup. */ + } } /* See if local, if yes, send it to netisr with IP_FASTFWD_OURS. */ @@ -561,6 +570,8 @@ sendit: m->m_flags |= M_SKIP_FIREWALL; m->m_flags &= ~M_IP_NEXTHOP; m_tag_delete(m, fwd_tag); + if (have_ia_ref) + ifa_free(&ia->ia_ifa); goto again; } @@ -671,6 +682,8 @@ passout: done: if (ro == &iproute) RO_RTFREE(ro); + if (have_ia_ref) + ifa_free(&ia->ia_ifa); return (error); bad: m_freem(m); From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 22:21:10 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB500DCD; Mon, 21 Jul 2014 22:21:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A760E2B43; Mon, 21 Jul 2014 22:21:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LMLA7u080689; Mon, 21 Jul 2014 22:21:10 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LMLAst080686; Mon, 21 Jul 2014 22:21:10 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201407212221.s6LMLAst080686@svn.freebsd.org> From: Bryan Drewery Date: Mon, 21 Jul 2014 22:21:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268961 - in stable/10/sys: fs/nfsserver nfsserver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 22:21:10 -0000 Author: bdrewery Date: Mon Jul 21 22:21:09 2014 New Revision: 268961 URL: http://svnweb.freebsd.org/changeset/base/268961 Log: MFC r268114: Change NFS readdir() to only ignore cookies preceding the given offset for UFS rather than for all but ZFS. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c stable/10/sys/nfsserver/nfs_serv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Mon Jul 21 22:10:29 2014 (r268960) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Mon Jul 21 22:21:09 2014 (r268961) @@ -1551,7 +1551,7 @@ nfsrvd_readdir(struct nfsrv_descript *nd u_long *cookies = NULL, *cookiep; struct uio io; struct iovec iv; - int not_zfs; + int is_ufs; if (nd->nd_repstat) { nfsrv_postopattr(nd, getret, &at); @@ -1606,7 +1606,7 @@ nfsrvd_readdir(struct nfsrv_descript *nd nfsrv_postopattr(nd, getret, &at); goto out; } - not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs"); + is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); again: eofflag = 0; @@ -1686,12 +1686,10 @@ again: * skip over the records that precede the requested offset. This * requires the assumption that file offset cookies monotonically * increase. - * Since the offset cookies don't monotonically increase for ZFS, - * this is not done when ZFS is the file system. */ while (cpos < cend && ncookies > 0 && (dp->d_fileno == 0 || dp->d_type == DT_WHT || - (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff))) { + (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff))) { cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++; @@ -1804,7 +1802,7 @@ nfsrvd_readdirplus(struct nfsrv_descript struct uio io; struct iovec iv; struct componentname cn; - int at_root, needs_unbusy, not_zfs, supports_nfsv4acls; + int at_root, is_ufs, is_zfs, needs_unbusy, supports_nfsv4acls; struct mount *mp, *new_mp; uint64_t mounted_on_fileno; @@ -1884,7 +1882,8 @@ nfsrvd_readdirplus(struct nfsrv_descript nfsrv_postopattr(nd, getret, &at); goto out; } - not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs"); + is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; + is_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") == 0; MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); again: @@ -1957,12 +1956,10 @@ again: * skip over the records that precede the requested offset. This * requires the assumption that file offset cookies monotonically * increase. - * Since the offset cookies don't monotonically increase for ZFS, - * this is not done when ZFS is the file system. */ while (cpos < cend && ncookies > 0 && (dp->d_fileno == 0 || dp->d_type == DT_WHT || - (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff) || + (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff) || ((nd->nd_flag & ND_NFSV4) && ((dp->d_namlen == 1 && dp->d_name[0] == '.') || (dp->d_namlen==2 && dp->d_name[0]=='.' && dp->d_name[1]=='.'))))) { @@ -2004,7 +2001,7 @@ again: * This needs to be done here for NFSv4, since NFSv4 never does * a VFS_VGET() for "." or "..". */ - if (not_zfs == 0) { + if (is_zfs == 1) { r = VFS_VGET(mp, at.na_fileid, LK_SHARED, &nvp); if (r == EOPNOTSUPP) { usevget = 0; @@ -2153,7 +2150,7 @@ again: if (!r) r = nfsvno_getattr(nvp, nvap, nd->nd_cred, p, 1); - if (r == 0 && not_zfs == 0 && + if (r == 0 && is_zfs == 1 && nfsrv_enable_crossmntpt != 0 && (nd->nd_flag & ND_NFSV4) != 0 && nvp->v_type == VDIR && Modified: stable/10/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/10/sys/nfsserver/nfs_serv.c Mon Jul 21 22:10:29 2014 (r268960) +++ stable/10/sys/nfsserver/nfs_serv.c Mon Jul 21 22:21:09 2014 (r268961) @@ -2627,7 +2627,7 @@ nfsrv_readdir(struct nfsrv_descript *nfs int v3 = (nfsd->nd_flag & ND_NFSV3); u_quad_t off, toff, verf; u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */ - int not_zfs; + int is_ufs; nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); fhp = &nfh.fh_generic; @@ -2690,7 +2690,7 @@ nfsrv_readdir(struct nfsrv_descript *nfs error = 0; goto nfsmout; } - not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") != 0; + is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; VOP_UNLOCK(vp, 0); /* @@ -2777,12 +2777,10 @@ again: * skip over the records that precede the requested offset. This * requires the assumption that file offset cookies monotonically * increase. - * Since the offset cookies don't monotonically increase for ZFS, - * this is not done when ZFS is the file system. */ while (cpos < cend && ncookies > 0 && (dp->d_fileno == 0 || dp->d_type == DT_WHT || - (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff))) { + (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff))) { cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++; @@ -2928,7 +2926,7 @@ nfsrv_readdirplus(struct nfsrv_descript int usevget = 1; struct componentname cn; struct mount *mntp = NULL; - int not_zfs; + int is_ufs; nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); vp_locked = 0; @@ -2988,7 +2986,7 @@ nfsrv_readdirplus(struct nfsrv_descript error = 0; goto nfsmout; } - not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") != 0; + is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; VOP_UNLOCK(vp, 0); vp_locked = 0; rbuf = malloc(siz, M_TEMP, M_WAITOK); @@ -3068,12 +3066,10 @@ again: * skip over the records that precede the requested offset. This * requires the assumption that file offset cookies monotonically * increase. - * Since the offset cookies don't monotonically increase for ZFS, - * this is not done when ZFS is the file system. */ while (cpos < cend && ncookies > 0 && (dp->d_fileno == 0 || dp->d_type == DT_WHT || - (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff))) { + (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff))) { cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++; From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 22:37:34 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD4DD50E; Mon, 21 Jul 2014 22:37:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ED752C6A; Mon, 21 Jul 2014 22:37:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LMbYeH086534; Mon, 21 Jul 2014 22:37:34 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LMbYbp086531; Mon, 21 Jul 2014 22:37:34 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407212237.s6LMbYbp086531@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 21 Jul 2014 22:37:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268962 - stable/10/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 22:37:34 -0000 Author: pfg Date: Mon Jul 21 22:37:33 2014 New Revision: 268962 URL: http://svnweb.freebsd.org/changeset/base/268962 Log: MFC r268642: libc/gen: small updates to code originating at OpenBSD arc4random.c - CVS rev. 1.22 Change arc4random_uniform() to calculate ``2**32 % upper_bound'' as ``-upper_bound % upper_bound''. Simplifies the code and makes it the same on both ILP32 and LP64 architectures, and also slightly faster on LP64 architectures by using a 32-bit remainder instead of a 64-bit remainder. - CVS rev. 1.23 Spacing readpassphrase.c -CVS rev. v 1.24 most obvious unsigned char casts for ctype Obtained from: OpenBSD Modified: stable/10/lib/libc/gen/arc4random.c stable/10/lib/libc/gen/readpassphrase.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/arc4random.c ============================================================================== --- stable/10/lib/libc/gen/arc4random.c Mon Jul 21 22:21:09 2014 (r268961) +++ stable/10/lib/libc/gen/arc4random.c Mon Jul 21 22:37:33 2014 (r268962) @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random.c,v 1.22 2010/12/22 08:23:42 otto Exp $ */ +/* $OpenBSD: arc4random.c,v 1.24 2013/06/11 16:59:50 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -182,8 +182,7 @@ arc4_stir_if_needed(void) { pid_t pid = getpid(); - if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) - { + if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) { arc4_stir_pid = pid; arc4_stir(); } @@ -276,18 +275,8 @@ arc4random_uniform(u_int32_t upper_bound if (upper_bound < 2) return 0; -#if (ULONG_MAX > 0xffffffffUL) - min = 0x100000000UL % upper_bound; -#else - /* Calculate (2**32 % upper_bound) avoiding 64-bit math */ - if (upper_bound > 0x80000000) - min = 1 + ~upper_bound; /* 2**32 - upper_bound */ - else { - /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */ - min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound; - } -#endif - + /* 2**32 % x == (2**32 - x) % x */ + min = -upper_bound % upper_bound; /* * This could theoretically loop forever but each retry has * p > 0.5 (worst case, usually far better) of selecting a Modified: stable/10/lib/libc/gen/readpassphrase.c ============================================================================== --- stable/10/lib/libc/gen/readpassphrase.c Mon Jul 21 22:21:09 2014 (r268961) +++ stable/10/lib/libc/gen/readpassphrase.c Mon Jul 21 22:37:33 2014 (r268962) @@ -1,4 +1,4 @@ -/* $OpenBSD: readpassphrase.c,v 1.23 2010/05/14 13:30:34 millert Exp $ */ +/* $OpenBSD: readpassphrase.c,v 1.24 2013/11/24 23:51:29 deraadt Exp $ */ /* * Copyright (c) 2000-2002, 2007, 2010 @@ -122,11 +122,11 @@ restart: if (p < end) { if ((flags & RPP_SEVENBIT)) ch &= 0x7f; - if (isalpha(ch)) { + if (isalpha((unsigned char)ch)) { if ((flags & RPP_FORCELOWER)) - ch = (char)tolower(ch); + ch = (char)tolower((unsigned char)ch); if ((flags & RPP_FORCEUPPER)) - ch = (char)toupper(ch); + ch = (char)toupper((unsigned char)ch); } *p++ = ch; } From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 22:44:07 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7027674A; Mon, 21 Jul 2014 22:44:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5151A2CF8; Mon, 21 Jul 2014 22:44:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LMi7Jh090622; Mon, 21 Jul 2014 22:44:07 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LMi6lV090618; Mon, 21 Jul 2014 22:44:06 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407212244.s6LMi6lV090618@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 21 Jul 2014 22:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268963 - stable/9/lib/libc/gen X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 22:44:07 -0000 Author: pfg Date: Mon Jul 21 22:44:06 2014 New Revision: 268963 URL: http://svnweb.freebsd.org/changeset/base/268963 Log: MFC r268642: libc/gen: small updates to code originating at OpenBSD arc4random.c - CVS rev. 1.22 Change arc4random_uniform() to calculate ``2**32 % upper_bound'' as ``-upper_bound % upper_bound''. Simplifies the code and makes it the same on both ILP32 and LP64 architectures, and also slightly faster on LP64 architectures by using a 32-bit remainder instead of a 64-bit remainder. - CVS rev. 1.23 Spacing readpassphrase.c -CVS rev. v 1.24 most obvious unsigned char casts for ctype Obtained from: OpenBSD Modified: stable/9/lib/libc/gen/arc4random.c stable/9/lib/libc/gen/readpassphrase.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/arc4random.c ============================================================================== --- stable/9/lib/libc/gen/arc4random.c Mon Jul 21 22:37:33 2014 (r268962) +++ stable/9/lib/libc/gen/arc4random.c Mon Jul 21 22:44:06 2014 (r268963) @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random.c,v 1.22 2010/12/22 08:23:42 otto Exp $ */ +/* $OpenBSD: arc4random.c,v 1.24 2013/06/11 16:59:50 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -182,8 +182,7 @@ arc4_stir_if_needed(void) { pid_t pid = getpid(); - if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) - { + if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) { arc4_stir_pid = pid; arc4_stir(); } @@ -276,18 +275,8 @@ arc4random_uniform(u_int32_t upper_bound if (upper_bound < 2) return 0; -#if (ULONG_MAX > 0xffffffffUL) - min = 0x100000000UL % upper_bound; -#else - /* Calculate (2**32 % upper_bound) avoiding 64-bit math */ - if (upper_bound > 0x80000000) - min = 1 + ~upper_bound; /* 2**32 - upper_bound */ - else { - /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */ - min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound; - } -#endif - + /* 2**32 % x == (2**32 - x) % x */ + min = -upper_bound % upper_bound; /* * This could theoretically loop forever but each retry has * p > 0.5 (worst case, usually far better) of selecting a Modified: stable/9/lib/libc/gen/readpassphrase.c ============================================================================== --- stable/9/lib/libc/gen/readpassphrase.c Mon Jul 21 22:37:33 2014 (r268962) +++ stable/9/lib/libc/gen/readpassphrase.c Mon Jul 21 22:44:06 2014 (r268963) @@ -1,4 +1,4 @@ -/* $OpenBSD: readpassphrase.c,v 1.23 2010/05/14 13:30:34 millert Exp $ */ +/* $OpenBSD: readpassphrase.c,v 1.24 2013/11/24 23:51:29 deraadt Exp $ */ /* * Copyright (c) 2000-2002, 2007, 2010 @@ -122,11 +122,11 @@ restart: if (p < end) { if ((flags & RPP_SEVENBIT)) ch &= 0x7f; - if (isalpha(ch)) { + if (isalpha((unsigned char)ch)) { if ((flags & RPP_FORCELOWER)) - ch = (char)tolower(ch); + ch = (char)tolower((unsigned char)ch); if ((flags & RPP_FORCEUPPER)) - ch = (char)toupper(ch); + ch = (char)toupper((unsigned char)ch); } *p++ = ch; } From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 22:48:00 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 939099A1; Mon, 21 Jul 2014 22:48:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 754A62D28; Mon, 21 Jul 2014 22:48:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LMm0Hx091220; Mon, 21 Jul 2014 22:48:00 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LMlxtc091208; Mon, 21 Jul 2014 22:47:59 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407212247.s6LMlxtc091208@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 21 Jul 2014 22:47:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268964 - stable/10/lib/libc/stdlib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 22:48:00 -0000 Author: pfg Date: Mon Jul 21 22:47:59 2014 New Revision: 268964 URL: http://svnweb.freebsd.org/changeset/base/268964 Log: MFC r268644: libc/stdlib: Minor cleanups to code originating in NetBSD Mostly ANSIfication and typos. Obtained from: NetBSD Modified: stable/10/lib/libc/stdlib/hcreate.c stable/10/lib/libc/stdlib/tsearch.c stable/10/lib/libc/stdlib/twalk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdlib/hcreate.c ============================================================================== --- stable/10/lib/libc/stdlib/hcreate.c Mon Jul 21 22:44:06 2014 (r268963) +++ stable/10/lib/libc/stdlib/hcreate.c Mon Jul 21 22:47:59 2014 (r268964) @@ -1,4 +1,4 @@ -/* $NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $ */ +/* $NetBSD: hcreate.c,v 1.6 2008/07/21 12:05:43 lukem Exp $ */ /* * Copyright (c) 2001 Christopher G. Demetriou @@ -15,7 +15,7 @@ * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the - * NetBSD Project. See http://www.netbsd.org/ for + * NetBSD Project. See http://www.NetBSD.org/ for * information about NetBSD. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. @@ -49,7 +49,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $"); +__RCSID("$NetBSD: hcreate.c,v 1.6 2008/07/21 12:05:43 lukem Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); Modified: stable/10/lib/libc/stdlib/tsearch.c ============================================================================== --- stable/10/lib/libc/stdlib/tsearch.c Mon Jul 21 22:44:06 2014 (r268963) +++ stable/10/lib/libc/stdlib/tsearch.c Mon Jul 21 22:47:59 2014 (r268964) @@ -1,4 +1,4 @@ -/* $NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $ */ +/* $NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -14,7 +14,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $"); +__RCSID("$NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -25,10 +25,8 @@ __FBSDID("$FreeBSD$"); /* find or insert datum into search tree */ void * -tsearch(vkey, vrootp, compar) - const void *vkey; /* key to be located */ - void **vrootp; /* address of tree root */ - int (*compar)(const void *, const void *); +tsearch(const void *vkey, void **vrootp, + int (*compar)(const void *, const void *)) { node_t *q; node_t **rootp = (node_t **)vrootp; @@ -50,8 +48,7 @@ tsearch(vkey, vrootp, compar) q = malloc(sizeof(node_t)); /* T5: key not found */ if (q != 0) { /* make new node */ *rootp = q; /* link new node to old */ - /* LINTED const castaway ok */ - q->key = (void *)vkey; /* initialize new node */ + q->key = __DECONST(void *, vkey);/* initialize new node */ q->llink = q->rlink = NULL; } return q; Modified: stable/10/lib/libc/stdlib/twalk.c ============================================================================== --- stable/10/lib/libc/stdlib/twalk.c Mon Jul 21 22:44:06 2014 (r268963) +++ stable/10/lib/libc/stdlib/twalk.c Mon Jul 21 22:47:59 2014 (r268964) @@ -1,4 +1,4 @@ -/* $NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $ */ +/* $NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -14,7 +14,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $"); +__RCSID("$NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -23,15 +23,12 @@ __FBSDID("$FreeBSD$"); #include #include -static void trecurse(const node_t *, - void (*action)(const void *, VISIT, int), int level); +typedef void (*cmp_fn_t)(const void *, VISIT, int); /* Walk the nodes of a tree */ static void -trecurse(root, action, level) - const node_t *root; /* Root of the tree to be walked */ - void (*action)(const void *, VISIT, int); - int level; +trecurse(const node_t *root, /* Root of the tree to be walked */ + cmp_fn_t action, int level) { if (root->llink == NULL && root->rlink == NULL) @@ -49,9 +46,7 @@ trecurse(root, action, level) /* Walk the nodes of a tree */ void -twalk(vroot, action) - const void *vroot; /* Root of the tree to be walked */ - void (*action)(const void *, VISIT, int); +twalk(const void *vroot, cmp_fn_t action) /* Root of the tree to be walked */ { if (vroot != NULL && action != NULL) trecurse(vroot, action, 0); From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 22:48:39 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F0691ADB; Mon, 21 Jul 2014 22:48:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D17C42D33; Mon, 21 Jul 2014 22:48:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LMmdwA091357; Mon, 21 Jul 2014 22:48:39 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LMmdaK091354; Mon, 21 Jul 2014 22:48:39 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407212248.s6LMmdaK091354@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 21 Jul 2014 22:48:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268965 - stable/9/lib/libc/stdlib X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 22:48:40 -0000 Author: pfg Date: Mon Jul 21 22:48:38 2014 New Revision: 268965 URL: http://svnweb.freebsd.org/changeset/base/268965 Log: MFC r268644: libc/stdlib: Minor cleanups to code originating in NetBSD Mostly ANSIfication and typos. Obtained from: NetBSD Modified: stable/9/lib/libc/stdlib/hcreate.c stable/9/lib/libc/stdlib/tsearch.c stable/9/lib/libc/stdlib/twalk.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdlib/hcreate.c ============================================================================== --- stable/9/lib/libc/stdlib/hcreate.c Mon Jul 21 22:47:59 2014 (r268964) +++ stable/9/lib/libc/stdlib/hcreate.c Mon Jul 21 22:48:38 2014 (r268965) @@ -1,4 +1,4 @@ -/* $NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $ */ +/* $NetBSD: hcreate.c,v 1.6 2008/07/21 12:05:43 lukem Exp $ */ /* * Copyright (c) 2001 Christopher G. Demetriou @@ -15,7 +15,7 @@ * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the - * NetBSD Project. See http://www.netbsd.org/ for + * NetBSD Project. See http://www.NetBSD.org/ for * information about NetBSD. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. @@ -49,7 +49,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $"); +__RCSID("$NetBSD: hcreate.c,v 1.6 2008/07/21 12:05:43 lukem Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); Modified: stable/9/lib/libc/stdlib/tsearch.c ============================================================================== --- stable/9/lib/libc/stdlib/tsearch.c Mon Jul 21 22:47:59 2014 (r268964) +++ stable/9/lib/libc/stdlib/tsearch.c Mon Jul 21 22:48:38 2014 (r268965) @@ -1,4 +1,4 @@ -/* $NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $ */ +/* $NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -14,7 +14,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $"); +__RCSID("$NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -25,10 +25,8 @@ __FBSDID("$FreeBSD$"); /* find or insert datum into search tree */ void * -tsearch(vkey, vrootp, compar) - const void *vkey; /* key to be located */ - void **vrootp; /* address of tree root */ - int (*compar)(const void *, const void *); +tsearch(const void *vkey, void **vrootp, + int (*compar)(const void *, const void *)) { node_t *q; node_t **rootp = (node_t **)vrootp; @@ -50,8 +48,7 @@ tsearch(vkey, vrootp, compar) q = malloc(sizeof(node_t)); /* T5: key not found */ if (q != 0) { /* make new node */ *rootp = q; /* link new node to old */ - /* LINTED const castaway ok */ - q->key = (void *)vkey; /* initialize new node */ + q->key = __DECONST(void *, vkey);/* initialize new node */ q->llink = q->rlink = NULL; } return q; Modified: stable/9/lib/libc/stdlib/twalk.c ============================================================================== --- stable/9/lib/libc/stdlib/twalk.c Mon Jul 21 22:47:59 2014 (r268964) +++ stable/9/lib/libc/stdlib/twalk.c Mon Jul 21 22:48:38 2014 (r268965) @@ -1,4 +1,4 @@ -/* $NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $ */ +/* $NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -14,7 +14,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $"); +__RCSID("$NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -23,15 +23,12 @@ __FBSDID("$FreeBSD$"); #include #include -static void trecurse(const node_t *, - void (*action)(const void *, VISIT, int), int level); +typedef void (*cmp_fn_t)(const void *, VISIT, int); /* Walk the nodes of a tree */ static void -trecurse(root, action, level) - const node_t *root; /* Root of the tree to be walked */ - void (*action)(const void *, VISIT, int); - int level; +trecurse(const node_t *root, /* Root of the tree to be walked */ + cmp_fn_t action, int level) { if (root->llink == NULL && root->rlink == NULL) @@ -49,9 +46,7 @@ trecurse(root, action, level) /* Walk the nodes of a tree */ void -twalk(vroot, action) - const void *vroot; /* Root of the tree to be walked */ - void (*action)(const void *, VISIT, int); +twalk(const void *vroot, cmp_fn_t action) /* Root of the tree to be walked */ { if (vroot != NULL && action != NULL) trecurse(vroot, action, 0); From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 22:59:41 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA62DE61; Mon, 21 Jul 2014 22:59:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B64F2DF7; Mon, 21 Jul 2014 22:59:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LMxfdW096008; Mon, 21 Jul 2014 22:59:41 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LMxeEk096004; Mon, 21 Jul 2014 22:59:40 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407212259.s6LMxeEk096004@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 21 Jul 2014 22:59:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268966 - stable/10/usr.bin/grep X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 22:59:41 -0000 Author: pfg Date: Mon Jul 21 22:59:40 2014 New Revision: 268966 URL: http://svnweb.freebsd.org/changeset/base/268966 Log: MFC r268798, r268799, r268801: grep: Fix type. grep: fix some memory leaks. queue.c (CVS Rev. 1.4. 1.5) Fix memory leaks. NULL does not need a cast. grep.c (CVS Rev. 1.6) Use the more portable getline. Obtained from: NetBSD Modified: stable/10/usr.bin/grep/grep.c stable/10/usr.bin/grep/queue.c stable/10/usr.bin/grep/util.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/grep/grep.c ============================================================================== --- stable/10/usr.bin/grep/grep.c Mon Jul 21 22:48:38 2014 (r268965) +++ stable/10/usr.bin/grep/grep.c Mon Jul 21 22:59:40 2014 (r268966) @@ -1,4 +1,4 @@ -/* $NetBSD: grep.c,v 1.4 2011/02/16 01:31:33 joerg Exp $ */ +/* $NetBSD: grep.c,v 1.6 2011/04/18 03:48:23 joerg Exp $ */ /* $FreeBSD$ */ /* $OpenBSD: grep.c,v 1.42 2010/07/02 22:18:03 tedu Exp $ */ @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#define _WITH_GETLINE #include #include #include @@ -304,6 +305,7 @@ read_patterns(const char *fn) FILE *f; char *line; size_t len; + ssize_t rlen; if ((f = fopen(fn, "r")) == NULL) err(2, "%s", fn); @@ -311,8 +313,11 @@ read_patterns(const char *fn) fclose(f); return; } - while ((line = fgetln(f, &len)) != NULL) + len = 0; + line = NULL; + while ((rlen = getline(&line, &len, f)) != -1) add_pattern(line, line[0] == '\n' ? 0 : len); + free(line); if (ferror(f)) err(2, "%s", fn); fclose(f); Modified: stable/10/usr.bin/grep/queue.c ============================================================================== --- stable/10/usr.bin/grep/queue.c Mon Jul 21 22:48:38 2014 (r268965) +++ stable/10/usr.bin/grep/queue.c Mon Jul 21 22:59:40 2014 (r268966) @@ -1,4 +1,4 @@ -/* $NetBSD: queue.c,v 1.2 2011/02/16 01:31:33 joerg Exp $ */ +/* $NetBSD: queue.c,v 1.5 2011/08/31 16:24:57 plunky Exp $ */ /* $FreeBSD$ */ /*- @@ -68,8 +68,11 @@ enqueue(struct str *x) STAILQ_INSERT_TAIL(&queue, item, list); - if (++count > Bflag) - free(dequeue()); + if (++count > Bflag) { + item = dequeue(); + free(item->data.dat); + free(item); + } } static struct qentry * @@ -92,7 +95,8 @@ printqueue(void) struct qentry *item; while ((item = dequeue()) != NULL) { - printline(&item->data, '-', (regmatch_t *)NULL, 0); + printline(&item->data, '-', NULL, 0); + free(item->data.dat); free(item); } } @@ -102,6 +106,8 @@ clearqueue(void) { struct qentry *item; - while ((item = dequeue()) != NULL) + while ((item = dequeue()) != NULL) { + free(item->data.dat); free(item); + } } Modified: stable/10/usr.bin/grep/util.c ============================================================================== --- stable/10/usr.bin/grep/util.c Mon Jul 21 22:48:38 2014 (r268965) +++ stable/10/usr.bin/grep/util.c Mon Jul 21 22:59:40 2014 (r268966) @@ -302,7 +302,7 @@ procline(struct str *l, int nottext) r = REG_NOMATCH; /* Check for whole word match */ if (r == 0 && (wflag || fg_pattern[i].word)) { - wint_t wbegin, wend; + wchar_t wbegin, wend; wbegin = wend = L' '; if (pmatch.rm_so != 0 && From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 23:00:28 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 06B5EFCE; Mon, 21 Jul 2014 23:00:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBF182E75; Mon, 21 Jul 2014 23:00:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LN0Rqm098115; Mon, 21 Jul 2014 23:00:27 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LN0RuV098108; Mon, 21 Jul 2014 23:00:27 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407212300.s6LN0RuV098108@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 21 Jul 2014 23:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268967 - stable/9/usr.bin/grep X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 23:00:28 -0000 Author: pfg Date: Mon Jul 21 23:00:26 2014 New Revision: 268967 URL: http://svnweb.freebsd.org/changeset/base/268967 Log: MFC r268798, r268799, r268801: grep: Fix type. grep: fix some memory leaks. queue.c (CVS Rev. 1.4. 1.5) Fix memory leaks. NULL does not need a cast. grep.c (CVS Rev. 1.6) Use the more portable getline. Obtained from: NetBSD Modified: stable/9/usr.bin/grep/grep.c stable/9/usr.bin/grep/queue.c stable/9/usr.bin/grep/util.c Directory Properties: stable/9/usr.bin/grep/ (props changed) Modified: stable/9/usr.bin/grep/grep.c ============================================================================== --- stable/9/usr.bin/grep/grep.c Mon Jul 21 22:59:40 2014 (r268966) +++ stable/9/usr.bin/grep/grep.c Mon Jul 21 23:00:26 2014 (r268967) @@ -1,4 +1,4 @@ -/* $NetBSD: grep.c,v 1.4 2011/02/16 01:31:33 joerg Exp $ */ +/* $NetBSD: grep.c,v 1.6 2011/04/18 03:48:23 joerg Exp $ */ /* $FreeBSD$ */ /* $OpenBSD: grep.c,v 1.42 2010/07/02 22:18:03 tedu Exp $ */ @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#define _WITH_GETLINE #include #include #include @@ -303,6 +304,7 @@ read_patterns(const char *fn) FILE *f; char *line; size_t len; + ssize_t rlen; if ((f = fopen(fn, "r")) == NULL) err(2, "%s", fn); @@ -310,8 +312,11 @@ read_patterns(const char *fn) fclose(f); return; } - while ((line = fgetln(f, &len)) != NULL) + len = 0; + line = NULL; + while ((rlen = getline(&line, &len, f)) != -1) add_pattern(line, line[0] == '\n' ? 0 : len); + free(line); if (ferror(f)) err(2, "%s", fn); fclose(f); Modified: stable/9/usr.bin/grep/queue.c ============================================================================== --- stable/9/usr.bin/grep/queue.c Mon Jul 21 22:59:40 2014 (r268966) +++ stable/9/usr.bin/grep/queue.c Mon Jul 21 23:00:26 2014 (r268967) @@ -1,4 +1,4 @@ -/* $NetBSD: queue.c,v 1.2 2011/02/16 01:31:33 joerg Exp $ */ +/* $NetBSD: queue.c,v 1.5 2011/08/31 16:24:57 plunky Exp $ */ /* $FreeBSD$ */ /*- @@ -68,8 +68,11 @@ enqueue(struct str *x) STAILQ_INSERT_TAIL(&queue, item, list); - if (++count > Bflag) - free(dequeue()); + if (++count > Bflag) { + item = dequeue(); + free(item->data.dat); + free(item); + } } static struct qentry * @@ -92,7 +95,8 @@ printqueue(void) struct qentry *item; while ((item = dequeue()) != NULL) { - printline(&item->data, '-', (regmatch_t *)NULL, 0); + printline(&item->data, '-', NULL, 0); + free(item->data.dat); free(item); } } @@ -102,6 +106,8 @@ clearqueue(void) { struct qentry *item; - while ((item = dequeue()) != NULL) + while ((item = dequeue()) != NULL) { + free(item->data.dat); free(item); + } } Modified: stable/9/usr.bin/grep/util.c ============================================================================== --- stable/9/usr.bin/grep/util.c Mon Jul 21 22:59:40 2014 (r268966) +++ stable/9/usr.bin/grep/util.c Mon Jul 21 23:00:26 2014 (r268967) @@ -302,7 +302,7 @@ procline(struct str *l, int nottext) r = REG_NOMATCH; /* Check for whole word match */ if (r == 0 && (wflag || fg_pattern[i].word)) { - wint_t wbegin, wend; + wchar_t wbegin, wend; wbegin = wend = L' '; if (pmatch.rm_so != 0 && From owner-svn-src-stable@FreeBSD.ORG Mon Jul 21 23:23:21 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 730156D0; Mon, 21 Jul 2014 23:23:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F53B2069; Mon, 21 Jul 2014 23:23:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LNNLPa009002; Mon, 21 Jul 2014 23:23:21 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LNNLdZ009000; Mon, 21 Jul 2014 23:23:21 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407212323.s6LNNLdZ009000@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 21 Jul 2014 23:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268968 - stable/10/sbin/fsck_msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 23:23:21 -0000 Author: pfg Date: Mon Jul 21 23:23:20 2014 New Revision: 268968 URL: http://svnweb.freebsd.org/changeset/base/268968 Log: MFC r268632: fsck_msdosfs: Assorted fixes from other BSDs. When truncating cluster chains fix the length of the cluster head. http://marc.info/?t=140304310700005&r=1&w=2 Avoid infinite loops in cluster chain linked lists. http://marc.info/?l=openbsd-tech&m=140275150804337&w=2 Avoid off-by-one on FAT12 filesystems. http://marc.info/?l=openbsd-tech&m=140234174104724&w=2 Obtained from: NetBSD (from OpenBSD) Modified: stable/10/sbin/fsck_msdosfs/dir.c stable/10/sbin/fsck_msdosfs/fat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_msdosfs/dir.c ============================================================================== --- stable/10/sbin/fsck_msdosfs/dir.c Mon Jul 21 23:00:26 2014 (r268967) +++ stable/10/sbin/fsck_msdosfs/dir.c Mon Jul 21 23:23:20 2014 (r268968) @@ -419,13 +419,14 @@ checksize(struct bootblock *boot, struct fullpath(dir)); if (ask(1, "Drop superfluous clusters")) { cl_t cl; - u_int32_t sz = 0; + u_int32_t sz, len; - for (cl = dir->head; (sz += boot->ClusterSize) < - dir->size;) + for (cl = dir->head, len = sz = 0; + (sz += boot->ClusterSize) < dir->size; len++) cl = fat[cl].next; clearchain(boot, fat, fat[cl].next); fat[cl].next = CLUST_EOF; + fat[dir->head].length = len; return FSFATMOD; } else return FSERROR; Modified: stable/10/sbin/fsck_msdosfs/fat.c ============================================================================== --- stable/10/sbin/fsck_msdosfs/fat.c Mon Jul 21 23:00:26 2014 (r268967) +++ stable/10/sbin/fsck_msdosfs/fat.c Mon Jul 21 23:23:20 2014 (r268968) @@ -436,7 +436,15 @@ tryclear(struct bootblock *boot, struct clearchain(boot, fat, head); return FSFATMOD; } else if (ask(0, "Truncate")) { + uint32_t len; + cl_t p; + + for (p = head, len = 0; + p >= CLUST_FIRST && p < boot->NumClusters; + p = fat[p].next, len++) + continue; *truncp = CLUST_EOF; + fat[head].length = len; return FSFATMOD; } else return FSERROR; @@ -465,7 +473,8 @@ checkfat(struct bootblock *boot, struct /* follow the chain and mark all clusters on the way */ for (len = 0, p = head; - p >= CLUST_FIRST && p < boot->NumClusters; + p >= CLUST_FIRST && p < boot->NumClusters && + fat[p].head != head; p = fat[p].next) { fat[p].head = head; len++; @@ -486,10 +495,10 @@ checkfat(struct bootblock *boot, struct continue; /* follow the chain to its end (hopefully) */ - for (p = head; + for (len = fat[head].length, p = head; (n = fat[p].next) >= CLUST_FIRST && n < boot->NumClusters; p = n) - if (fat[n].head != head) + if (fat[n].head != head || len-- < 2) break; if (n >= CLUST_EOFS) continue; @@ -497,14 +506,20 @@ checkfat(struct bootblock *boot, struct if (n == CLUST_FREE || n >= CLUST_RSRVD) { pwarn("Cluster chain starting at %u ends with cluster marked %s\n", head, rsrvdcltype(n)); +clear: ret |= tryclear(boot, fat, head, &fat[p].next); continue; } if (n < CLUST_FIRST || n >= boot->NumClusters) { pwarn("Cluster chain starting at %u ends with cluster out of range (%u)\n", - head, n); - ret |= tryclear(boot, fat, head, &fat[p].next); - continue; + head, n); + goto clear; + } + if (head == fat[n].head) { + pwarn("Cluster chain starting at %u loops at cluster %u\n", + + head, p); + goto clear; } pwarn("Cluster chains starting at %u and %u are linked at cluster %u\n", head, fat[n].head, n); @@ -621,13 +636,15 @@ writefat(int fs, struct bootblock *boot, default: if (fat[cl].next == CLUST_FREE) boot->NumFree++; - if (cl + 1 < boot->NumClusters - && fat[cl + 1].next == CLUST_FREE) - boot->NumFree++; *p++ = (u_char)fat[cl].next; - *p++ = (u_char)((fat[cl].next >> 8) & 0xf) - |(u_char)(fat[cl+1].next << 4); - *p++ = (u_char)(fat[++cl].next >> 4); + *p = (u_char)((fat[cl].next >> 8) & 0xf); + cl++; + if (cl >= boot->NumClusters) + break; + if (fat[cl].next == CLUST_FREE) + boot->NumFree++; + *p++ |= (u_char)(fat[cl + 1].next << 4); + *p++ = (u_char)(fat[cl + 1].next >> 4); break; } } From owner-svn-src-stable@FreeBSD.ORG Tue Jul 22 00:33:42 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 77F9BF7B; Tue, 22 Jul 2014 00:33:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 648C92574; Tue, 22 Jul 2014 00:33:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6M0XgGU040467; Tue, 22 Jul 2014 00:33:42 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6M0XgKd040466; Tue, 22 Jul 2014 00:33:42 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201407220033.s6M0XgKd040466@svn.freebsd.org> From: Bryan Drewery Date: Tue, 22 Jul 2014 00:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268969 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2014 00:33:42 -0000 Author: bdrewery Date: Tue Jul 22 00:33:41 2014 New Revision: 268969 URL: http://svnweb.freebsd.org/changeset/base/268969 Log: MFC r268715,r268722: Document the 'show bio' command added in 2009. Also link 'show bio' to g_bio(9.) Modified: stable/10/share/man/man4/ddb.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ddb.4 ============================================================================== --- stable/10/share/man/man4/ddb.4 Mon Jul 21 23:23:20 2014 (r268968) +++ stable/10/share/man/man4/ddb.4 Tue Jul 22 00:33:41 2014 (r268969) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 30, 2013 +.Dd July 15, 2014 .Dt DDB 4 .Os .Sh NAME @@ -584,17 +584,26 @@ Dump data about APIC IDT vector mappings Show breakpoints set with the "break" command. .\" .Pp -.It Ic show Cm buffer -Show buffer structure of +.It Ic show Cm bio Ar addr +Show information about the bio structure +.Vt struct bio +present at +.Ar addr . +See the +.Pa sys/bio.h +header file and +.Xr g_bio 9 +for more details on the exact meaning of the structure fields. +.\" +.Pp +.It Ic show Cm buffer Ar addr +Show information about the buf structure .Vt struct buf -type. -Such a structure is used within the -.Fx -kernel for the I/O subsystem -implementation. -For an exact interpretation of the output, please see the +present at +.Ar addr . +See the .Pa sys/buf.h -header file. +header file for more details on the exact meaning of the structure fields. .\" .Pp .It Ic show Cm cbstat From owner-svn-src-stable@FreeBSD.ORG Tue Jul 22 03:14:41 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A546A494; Tue, 22 Jul 2014 03:14:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F4AC21E3; Tue, 22 Jul 2014 03:14:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6M3EfdD012146; Tue, 22 Jul 2014 03:14:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6M3EcJb012124; Tue, 22 Jul 2014 03:14:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407220314.s6M3EcJb012124@svn.freebsd.org> From: John Baldwin Date: Tue, 22 Jul 2014 03:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268972 - in stable/10: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/io usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2014 03:14:41 -0000 Author: jhb Date: Tue Jul 22 03:14:37 2014 New Revision: 268972 URL: http://svnweb.freebsd.org/changeset/base/268972 Log: MFC 266125: Implement a PCI interrupt router to route PCI legacy INTx interrupts to the legacy 8259A PICs. Added: stable/10/usr.sbin/bhyve/pci_irq.c - copied unchanged from r266125, head/usr.sbin/bhyve/pci_irq.c stable/10/usr.sbin/bhyve/pci_irq.h - copied unchanged from r266125, head/usr.sbin/bhyve/pci_irq.h Modified: stable/10/lib/libvmmapi/vmmapi.c stable/10/lib/libvmmapi/vmmapi.h stable/10/sys/amd64/include/vmm.h stable/10/sys/amd64/include/vmm_dev.h stable/10/sys/amd64/vmm/io/vatpic.c stable/10/sys/amd64/vmm/io/vatpic.h stable/10/sys/amd64/vmm/vmm_dev.c stable/10/usr.sbin/bhyve/Makefile stable/10/usr.sbin/bhyve/acpi.c stable/10/usr.sbin/bhyve/acpi.h stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyve/mptbl.c stable/10/usr.sbin/bhyve/pci_emul.c stable/10/usr.sbin/bhyve/pci_emul.h stable/10/usr.sbin/bhyve/pci_lpc.c stable/10/usr.sbin/bhyve/pci_lpc.h stable/10/usr.sbin/bhyve/pm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libvmmapi/vmmapi.c ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.c Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/lib/libvmmapi/vmmapi.c Tue Jul 22 03:14:37 2014 (r268972) @@ -507,6 +507,7 @@ int vm_isa_pulse_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq) { struct vm_isa_irq isa_irq; + bzero(&isa_irq, sizeof(struct vm_isa_irq)); isa_irq.atpic_irq = atpic_irq; isa_irq.ioapic_irq = ioapic_irq; @@ -515,6 +516,19 @@ vm_isa_pulse_irq(struct vmctx *ctx, int } int +vm_isa_set_irq_trigger(struct vmctx *ctx, int atpic_irq, + enum vm_intr_trigger trigger) +{ + struct vm_isa_irq_trigger isa_irq_trigger; + + bzero(&isa_irq_trigger, sizeof(struct vm_isa_irq_trigger)); + isa_irq_trigger.atpic_irq = atpic_irq; + isa_irq_trigger.trigger = trigger; + + return (ioctl(ctx->fd, VM_ISA_SET_IRQ_TRIGGER, &isa_irq_trigger)); +} + +int vm_inject_nmi(struct vmctx *ctx, int vcpu) { struct vm_nmi vmnmi; Modified: stable/10/lib/libvmmapi/vmmapi.h ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.h Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/lib/libvmmapi/vmmapi.h Tue Jul 22 03:14:37 2014 (r268972) @@ -78,6 +78,8 @@ int vm_ioapic_pincount(struct vmctx *ctx int vm_isa_assert_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq); int vm_isa_deassert_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq); int vm_isa_pulse_irq(struct vmctx *ctx, int atpic_irq, int ioapic_irq); +int vm_isa_set_irq_trigger(struct vmctx *ctx, int atpic_irq, + enum vm_intr_trigger trigger); int vm_inject_nmi(struct vmctx *ctx, int vcpu); int vm_capability_name2type(const char *capname); const char *vm_capability_type2name(int type); Modified: stable/10/sys/amd64/include/vmm.h ============================================================================== --- stable/10/sys/amd64/include/vmm.h Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/sys/amd64/include/vmm.h Tue Jul 22 03:14:37 2014 (r268972) @@ -301,6 +301,11 @@ enum x2apic_state { X2APIC_STATE_LAST }; +enum vm_intr_trigger { + EDGE_TRIGGER, + LEVEL_TRIGGER +}; + /* * The 'access' field has the format specified in Table 21-2 of the Intel * Architecture Manual vol 3b. Modified: stable/10/sys/amd64/include/vmm_dev.h ============================================================================== --- stable/10/sys/amd64/include/vmm_dev.h Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/sys/amd64/include/vmm_dev.h Tue Jul 22 03:14:37 2014 (r268972) @@ -84,6 +84,11 @@ struct vm_isa_irq { int ioapic_irq; }; +struct vm_isa_irq_trigger { + int atpic_irq; + enum vm_intr_trigger trigger; +}; + struct vm_capability { int cpuid; enum vm_cap_type captype; @@ -213,6 +218,7 @@ enum { IOCNUM_ISA_ASSERT_IRQ = 80, IOCNUM_ISA_DEASSERT_IRQ = 81, IOCNUM_ISA_PULSE_IRQ = 82, + IOCNUM_ISA_SET_IRQ_TRIGGER = 83, }; #define VM_RUN \ @@ -253,6 +259,8 @@ enum { _IOW('v', IOCNUM_ISA_DEASSERT_IRQ, struct vm_isa_irq) #define VM_ISA_PULSE_IRQ \ _IOW('v', IOCNUM_ISA_PULSE_IRQ, struct vm_isa_irq) +#define VM_ISA_SET_IRQ_TRIGGER \ + _IOW('v', IOCNUM_ISA_SET_IRQ_TRIGGER, struct vm_isa_irq_trigger) #define VM_SET_CAPABILITY \ _IOW('v', IOCNUM_SET_CAPABILITY, struct vm_capability) #define VM_GET_CAPABILITY \ Modified: stable/10/sys/amd64/vmm/io/vatpic.c ============================================================================== --- stable/10/sys/amd64/vmm/io/vatpic.c Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/sys/amd64/vmm/io/vatpic.c Tue Jul 22 03:14:37 2014 (r268972) @@ -446,6 +446,43 @@ vatpic_pulse_irq(struct vm *vm, int irq) return (vatpic_set_irqstate(vm, irq, IRQSTATE_PULSE)); } +int +vatpic_set_irq_trigger(struct vm *vm, int irq, enum vm_intr_trigger trigger) +{ + struct vatpic *vatpic; + + if (irq < 0 || irq > 15) + return (EINVAL); + + /* + * See comment in vatpic_elc_handler. These IRQs must be + * edge triggered. + */ + if (trigger == LEVEL_TRIGGER) { + switch (irq) { + case 0: + case 1: + case 2: + case 8: + case 13: + return (EINVAL); + } + } + + vatpic = vm_atpic(vm); + + VATPIC_LOCK(vatpic); + + if (trigger == LEVEL_TRIGGER) + vatpic->elc[irq >> 3] |= 1 << (irq & 0x7); + else + vatpic->elc[irq >> 3] &= ~(1 << (irq & 0x7)); + + VATPIC_UNLOCK(vatpic); + + return (0); +} + void vatpic_pending_intr(struct vm *vm, int *vecptr) { Modified: stable/10/sys/amd64/vmm/io/vatpic.h ============================================================================== --- stable/10/sys/amd64/vmm/io/vatpic.h Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/sys/amd64/vmm/io/vatpic.h Tue Jul 22 03:14:37 2014 (r268972) @@ -49,6 +49,7 @@ int vatpic_elc_handler(void *vm, int vcp int vatpic_assert_irq(struct vm *vm, int irq); int vatpic_deassert_irq(struct vm *vm, int irq); int vatpic_pulse_irq(struct vm *vm, int irq); +int vatpic_set_irq_trigger(struct vm *vm, int irq, enum vm_intr_trigger trigger); void vatpic_pending_intr(struct vm *vm, int *vecptr); void vatpic_intr_accepted(struct vm *vm, int vector); Modified: stable/10/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm_dev.c Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/sys/amd64/vmm/vmm_dev.c Tue Jul 22 03:14:37 2014 (r268972) @@ -156,6 +156,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long c struct vm_lapic_msi *vmmsi; struct vm_ioapic_irq *ioapic_irq; struct vm_isa_irq *isa_irq; + struct vm_isa_irq_trigger *isa_irq_trigger; struct vm_capability *vmcap; struct vm_pptdev *pptdev; struct vm_pptdev_mmio *pptmmio; @@ -346,6 +347,11 @@ vmmdev_ioctl(struct cdev *cdev, u_long c if (error == 0 && isa_irq->ioapic_irq != -1) error = vioapic_pulse_irq(sc->vm, isa_irq->ioapic_irq); break; + case VM_ISA_SET_IRQ_TRIGGER: + isa_irq_trigger = (struct vm_isa_irq_trigger *)data; + error = vatpic_set_irq_trigger(sc->vm, + isa_irq_trigger->atpic_irq, isa_irq_trigger->trigger); + break; case VM_MAP_MEMORY: seg = (struct vm_memory_segment *)data; error = vm_malloc(sc->vm, seg->gpa, seg->len); Modified: stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- stable/10/usr.sbin/bhyve/Makefile Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/usr.sbin/bhyve/Makefile Tue Jul 22 03:14:37 2014 (r268972) @@ -23,6 +23,7 @@ SRCS= \ pci_ahci.c \ pci_emul.c \ pci_hostbridge.c \ + pci_irq.c \ pci_lpc.c \ pci_passthru.c \ pci_virtio_block.c \ Modified: stable/10/usr.sbin/bhyve/acpi.c ============================================================================== --- stable/10/usr.sbin/bhyve/acpi.c Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/usr.sbin/bhyve/acpi.c Tue Jul 22 03:14:37 2014 (r268972) @@ -704,7 +704,7 @@ basl_fwrite_dsdt(FILE *fp) dsdt_line("DefinitionBlock (\"bhyve_dsdt.aml\", \"DSDT\", 2," "\"BHYVE \", \"BVDSDT \", 0x00000001)"); dsdt_line("{"); - dsdt_line(" Name (_S5, Package (0x02)"); + dsdt_line(" Name (_S5, Package ()"); dsdt_line(" {"); dsdt_line(" 0x05,"); dsdt_line(" Zero,"); Modified: stable/10/usr.sbin/bhyve/acpi.h ============================================================================== --- stable/10/usr.sbin/bhyve/acpi.h Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/usr.sbin/bhyve/acpi.h Tue Jul 22 03:14:37 2014 (r268972) @@ -49,5 +49,6 @@ void dsdt_fixed_irq(uint8_t irq); void dsdt_fixed_mem32(uint32_t base, uint32_t length); void dsdt_indent(int levels); void dsdt_unindent(int levels); +void sci_init(struct vmctx *ctx); #endif /* _ACPI_H_ */ Modified: stable/10/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.c Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/usr.sbin/bhyve/bhyverun.c Tue Jul 22 03:14:37 2014 (r268972) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include "mevent.h" #include "mptbl.h" #include "pci_emul.h" +#include "pci_irq.h" #include "pci_lpc.h" #include "smbiostbl.h" #include "xmsr.h" @@ -770,9 +771,11 @@ main(int argc, char *argv[]) init_mem(); init_inout(); + pci_irq_init(ctx); ioapic_init(ctx); rtc_init(ctx); + sci_init(ctx); /* * Exit if a device emulation finds an error in it's initilization Modified: stable/10/usr.sbin/bhyve/mptbl.c ============================================================================== --- stable/10/usr.sbin/bhyve/mptbl.c Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/usr.sbin/bhyve/mptbl.c Tue Jul 22 03:14:37 2014 (r268972) @@ -210,7 +210,8 @@ mpt_count_ioint_entries(void) } static void -mpt_generate_pci_int(int bus, int slot, int pin, int ioapic_irq, void *arg) +mpt_generate_pci_int(int bus, int slot, int pin, int pirq_pin, int ioapic_irq, + void *arg) { int_entry_ptr *mpiep, mpie; Modified: stable/10/usr.sbin/bhyve/pci_emul.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_emul.c Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/usr.sbin/bhyve/pci_emul.c Tue Jul 22 03:14:37 2014 (r268972) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "ioapic.h" #include "mem.h" #include "pci_emul.h" +#include "pci_irq.h" #include "pci_lpc.h" #define CONF1_ADDR_PORT 0x0cf8 @@ -81,6 +82,7 @@ struct funcinfo { struct intxinfo { int ii_count; + int ii_pirq_pin; int ii_ioapic_irq; }; @@ -113,6 +115,7 @@ static uint64_t pci_emul_membase64; #define PCI_EMUL_MEMLIMIT64 0xFD00000000UL static struct pci_devemu *pci_emul_finddev(char *name); +static void pci_lintr_route(struct pci_devinst *pi); static void pci_lintr_update(struct pci_devinst *pi); static struct mem_range pci_mem_hole; @@ -714,6 +717,7 @@ pci_emul_init(struct vmctx *ctx, struct pthread_mutex_init(&pdi->pi_lintr.lock, NULL); pdi->pi_lintr.pin = 0; pdi->pi_lintr.state = IDLE; + pdi->pi_lintr.pirq_pin = 0; pdi->pi_lintr.ioapic_irq = 0; pdi->pi_d = pde; snprintf(pdi->pi_name, PI_NAMESZ, "%s-pci-%d", pde->pe_emu, slot); @@ -1084,6 +1088,27 @@ init_pci(struct vmctx *ctx) } /* + * PCI backends are initialized before routing INTx interrupts + * so that LPC devices are able to reserve ISA IRQs before + * routing PIRQ pins. + */ + for (bus = 0; bus < MAXBUSES; bus++) { + if ((bi = pci_businfo[bus]) == NULL) + continue; + + for (slot = 0; slot < MAXSLOTS; slot++) { + si = &bi->slotinfo[slot]; + for (func = 0; func < MAXFUNCS; func++) { + fi = &si->si_funcs[func]; + if (fi->fi_devi == NULL) + continue; + pci_lintr_route(fi->fi_devi); + } + } + } + lpc_pirq_routed(); + + /* * The guest physical memory map looks like the following: * [0, lowmem) guest system memory * [lowmem, lowmem_limit) memory hole (may be absent) @@ -1110,19 +1135,36 @@ init_pci(struct vmctx *ctx) } static void -pci_prt_entry(int bus, int slot, int pin, int ioapic_irq, void *arg) +pci_apic_prt_entry(int bus, int slot, int pin, int pirq_pin, int ioapic_irq, + void *arg) { - int *count; - count = arg; - dsdt_line(" Package (0x04)"); + dsdt_line(" Package ()"); dsdt_line(" {"); dsdt_line(" 0x%X,", slot << 16 | 0xffff); dsdt_line(" 0x%02X,", pin - 1); dsdt_line(" Zero,"); dsdt_line(" 0x%X", ioapic_irq); - dsdt_line(" }%s", *count == 1 ? "" : ","); - (*count)--; + dsdt_line(" },"); +} + +static void +pci_pirq_prt_entry(int bus, int slot, int pin, int pirq_pin, int ioapic_irq, + void *arg) +{ + char *name; + + name = lpc_pirq_name(pirq_pin); + if (name == NULL) + return; + dsdt_line(" Package ()"); + dsdt_line(" {"); + dsdt_line(" 0x%X,", slot << 16 | 0xffff); + dsdt_line(" 0x%02X,", pin - 1); + dsdt_line(" %s,", name); + dsdt_line(" 0x00"); + dsdt_line(" },"); + free(name); } /* @@ -1135,7 +1177,7 @@ pci_bus_write_dsdt(int bus) struct businfo *bi; struct slotinfo *si; struct pci_devinst *pi; - int count, slot, func; + int count, func, slot; /* * If there are no devices on this 'bus' then just return. @@ -1150,9 +1192,6 @@ pci_bus_write_dsdt(int bus) return; } - dsdt_indent(1); - dsdt_line("Scope (_SB)"); - dsdt_line("{"); dsdt_line(" Device (PC%02X)", bus); dsdt_line(" {"); dsdt_line(" Name (_HID, EisaId (\"PNP0A03\"))"); @@ -1245,10 +1284,25 @@ pci_bus_write_dsdt(int bus) count = pci_count_lintr(bus); if (count != 0) { dsdt_indent(2); - dsdt_line("Name (_PRT, Package (0x%02X)", count); + dsdt_line("Name (PPRT, Package ()"); dsdt_line("{"); - pci_walk_lintr(bus, pci_prt_entry, &count); - dsdt_line("})"); + pci_walk_lintr(bus, pci_pirq_prt_entry, NULL); + dsdt_line("})"); + dsdt_line("Name (APRT, Package ()"); + dsdt_line("{"); + pci_walk_lintr(bus, pci_apic_prt_entry, NULL); + dsdt_line("})"); + dsdt_line("Method (_PRT, 0, NotSerialized)"); + dsdt_line("{"); + dsdt_line(" If (PICM)"); + dsdt_line(" {"); + dsdt_line(" Return (APRT)"); + dsdt_line(" }"); + dsdt_line(" Else"); + dsdt_line(" {"); + dsdt_line(" Return (PPRT)"); + dsdt_line(" }"); + dsdt_line("}"); dsdt_unindent(2); } @@ -1264,8 +1318,6 @@ pci_bus_write_dsdt(int bus) dsdt_unindent(2); done: dsdt_line(" }"); - dsdt_line("}"); - dsdt_unindent(1); } void @@ -1273,8 +1325,19 @@ pci_write_dsdt(void) { int bus; + dsdt_indent(1); + dsdt_line("Name (PICM, 0x00)"); + dsdt_line("Method (_PIC, 1, NotSerialized)"); + dsdt_line("{"); + dsdt_line(" Store (Arg0, PICM)"); + dsdt_line("}"); + dsdt_line(""); + dsdt_line("Scope (_SB)"); + dsdt_line("{"); for (bus = 0; bus < MAXBUSES; bus++) pci_bus_write_dsdt(bus); + dsdt_line("}"); + dsdt_unindent(1); } int @@ -1347,18 +1410,19 @@ pci_lintr_permitted(struct pci_devinst * (cmd & PCIM_CMD_INTxDIS))); } -int +void pci_lintr_request(struct pci_devinst *pi) { struct businfo *bi; struct slotinfo *si; - int bestpin, bestcount, irq, pin; + int bestpin, bestcount, pin; bi = pci_businfo[pi->pi_bus]; assert(bi != NULL); /* - * First, allocate a pin from our slot. + * Just allocate a pin from our slot. The pin will be + * assigned IRQs later when interrupts are routed. */ si = &bi->slotinfo[pi->pi_slot]; bestpin = 0; @@ -1370,26 +1434,43 @@ pci_lintr_request(struct pci_devinst *pi } } - /* - * Attempt to allocate an I/O APIC pin for this intpin. If - * 8259A support is added we will need a separate field to - * assign the intpin to an input pin on the PCI interrupt - * router. - */ - if (si->si_intpins[bestpin].ii_count == 0) { - irq = ioapic_pci_alloc_irq(); - if (irq < 0) - return (-1); - si->si_intpins[bestpin].ii_ioapic_irq = irq; - } else - irq = si->si_intpins[bestpin].ii_ioapic_irq; si->si_intpins[bestpin].ii_count++; - pi->pi_lintr.pin = bestpin + 1; - pi->pi_lintr.ioapic_irq = irq; - pci_set_cfgdata8(pi, PCIR_INTLINE, irq); pci_set_cfgdata8(pi, PCIR_INTPIN, bestpin + 1); - return (0); +} + +static void +pci_lintr_route(struct pci_devinst *pi) +{ + struct businfo *bi; + struct intxinfo *ii; + + if (pi->pi_lintr.pin == 0) + return; + + bi = pci_businfo[pi->pi_bus]; + assert(bi != NULL); + ii = &bi->slotinfo[pi->pi_slot].si_intpins[pi->pi_lintr.pin - 1]; + + /* + * Attempt to allocate an I/O APIC pin for this intpin if one + * is not yet assigned. + */ + if (ii->ii_ioapic_irq == 0) + ii->ii_ioapic_irq = ioapic_pci_alloc_irq(); + assert(ii->ii_ioapic_irq > 0); + + /* + * Attempt to allocate a PIRQ pin for this intpin if one is + * not yet assigned. + */ + if (ii->ii_pirq_pin == 0) + ii->ii_pirq_pin = pirq_alloc_pin(pi->pi_vmctx); + assert(ii->ii_pirq_pin > 0); + + pi->pi_lintr.ioapic_irq = ii->ii_ioapic_irq; + pi->pi_lintr.pirq_pin = ii->ii_pirq_pin; + pci_set_cfgdata8(pi, PCIR_INTLINE, pirq_irq(ii->ii_pirq_pin)); } void @@ -1402,8 +1483,7 @@ pci_lintr_assert(struct pci_devinst *pi) if (pi->pi_lintr.state == IDLE) { if (pci_lintr_permitted(pi)) { pi->pi_lintr.state = ASSERTED; - vm_ioapic_assert_irq(pi->pi_vmctx, - pi->pi_lintr.ioapic_irq); + pci_irq_assert(pi); } else pi->pi_lintr.state = PENDING; } @@ -1419,7 +1499,7 @@ pci_lintr_deassert(struct pci_devinst *p pthread_mutex_lock(&pi->pi_lintr.lock); if (pi->pi_lintr.state == ASSERTED) { pi->pi_lintr.state = IDLE; - vm_ioapic_deassert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq); + pci_irq_deassert(pi); } else if (pi->pi_lintr.state == PENDING) pi->pi_lintr.state = IDLE; pthread_mutex_unlock(&pi->pi_lintr.lock); @@ -1431,11 +1511,11 @@ pci_lintr_update(struct pci_devinst *pi) pthread_mutex_lock(&pi->pi_lintr.lock); if (pi->pi_lintr.state == ASSERTED && !pci_lintr_permitted(pi)) { - vm_ioapic_deassert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq); + pci_irq_deassert(pi); pi->pi_lintr.state = PENDING; } else if (pi->pi_lintr.state == PENDING && pci_lintr_permitted(pi)) { pi->pi_lintr.state = ASSERTED; - vm_ioapic_assert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq); + pci_irq_assert(pi); } pthread_mutex_unlock(&pi->pi_lintr.lock); } @@ -1475,7 +1555,8 @@ pci_walk_lintr(int bus, pci_lintr_cb cb, for (pin = 0; pin < 4; pin++) { ii = &si->si_intpins[pin]; if (ii->ii_count != 0) - cb(bus, slot, pin + 1, ii->ii_ioapic_irq, arg); + cb(bus, slot, pin + 1, ii->ii_pirq_pin, + ii->ii_ioapic_irq, arg); } } } @@ -1772,20 +1853,6 @@ INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+ INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+2, IOPORT_F_INOUT, pci_emul_cfgdata); INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+3, IOPORT_F_INOUT, pci_emul_cfgdata); -/* - * I/O ports to configure PCI IRQ routing. We ignore all writes to it. - */ -static int -pci_irq_port_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, - uint32_t *eax, void *arg) -{ - assert(in == 0); - return (0); -} -INOUT_PORT(pci_irq, 0xC00, IOPORT_F_OUT, pci_irq_port_handler); -INOUT_PORT(pci_irq, 0xC01, IOPORT_F_OUT, pci_irq_port_handler); -SYSRES_IO(0xC00, 2); - #define PCI_EMUL_TEST #ifdef PCI_EMUL_TEST /* Modified: stable/10/usr.sbin/bhyve/pci_emul.h ============================================================================== --- stable/10/usr.sbin/bhyve/pci_emul.h Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/usr.sbin/bhyve/pci_emul.h Tue Jul 22 03:14:37 2014 (r268972) @@ -120,6 +120,7 @@ struct pci_devinst { struct { int8_t pin; enum lintr_stat state; + int pirq_pin; int ioapic_irq; pthread_mutex_t lock; } pi_lintr; @@ -200,7 +201,8 @@ struct pciecap { uint16_t slot_status2; } __packed; -typedef void (*pci_lintr_cb)(int b, int s, int pin, int ioapic_irq, void *arg); +typedef void (*pci_lintr_cb)(int b, int s, int pin, int pirq_pin, + int ioapic_irq, void *arg); int init_pci(struct vmctx *ctx); void msicap_cfgwrite(struct pci_devinst *pi, int capoff, int offset, @@ -218,7 +220,7 @@ void pci_generate_msi(struct pci_devinst void pci_generate_msix(struct pci_devinst *pi, int msgnum); void pci_lintr_assert(struct pci_devinst *pi); void pci_lintr_deassert(struct pci_devinst *pi); -int pci_lintr_request(struct pci_devinst *pi); +void pci_lintr_request(struct pci_devinst *pi); int pci_msi_enabled(struct pci_devinst *pi); int pci_msix_enabled(struct pci_devinst *pi); int pci_msix_table_bar(struct pci_devinst *pi); Copied: stable/10/usr.sbin/bhyve/pci_irq.c (from r266125, head/usr.sbin/bhyve/pci_irq.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/bhyve/pci_irq.c Tue Jul 22 03:14:37 2014 (r268972, copy of r266125, head/usr.sbin/bhyve/pci_irq.c) @@ -0,0 +1,349 @@ +/*- + * Copyright (c) 2014 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * 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 AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "acpi.h" +#include "inout.h" +#include "pci_emul.h" +#include "pci_irq.h" +#include "pci_lpc.h" + +/* + * Implement an 8 pin PCI interrupt router compatible with the router + * present on Intel's ICH10 chip. + */ + +/* Fields in each PIRQ register. */ +#define PIRQ_DIS 0x80 +#define PIRQ_IRQ 0x0f + +/* Only IRQs 3-7, 9-12, and 14-15 are permitted. */ +#define PERMITTED_IRQS 0xdef8 +#define IRQ_PERMITTED(irq) (((1U << (irq)) & PERMITTED_IRQS) != 0) + +/* IRQ count to disable an IRQ. */ +#define IRQ_DISABLED 0xff + +static struct pirq { + uint8_t reg; + int use_count; + int active_count; + pthread_mutex_t lock; +} pirqs[8]; + +static u_char irq_counts[16]; +static int pirq_cold = 1; + +/* + * Returns true if this pin is enabled with a valid IRQ. Setting the + * register to a reserved IRQ causes interrupts to not be asserted as + * if the pin was disabled. + */ +static bool +pirq_valid_irq(int reg) +{ + + if (reg & PIRQ_DIS) + return (false); + return (IRQ_PERMITTED(reg & PIRQ_IRQ)); +} + +uint8_t +pirq_read(int pin) +{ + + assert(pin > 0 && pin <= nitems(pirqs)); + return (pirqs[pin - 1].reg); +} + +void +pirq_write(struct vmctx *ctx, int pin, uint8_t val) +{ + struct pirq *pirq; + + assert(pin > 0 && pin <= nitems(pirqs)); + pirq = &pirqs[pin - 1]; + pthread_mutex_lock(&pirq->lock); + if (pirq->reg != (val & (PIRQ_DIS | PIRQ_IRQ))) { + if (pirq->active_count != 0 && pirq_valid_irq(pirq->reg)) + vm_isa_deassert_irq(ctx, pirq->reg & PIRQ_IRQ, -1); + pirq->reg = val & (PIRQ_DIS | PIRQ_IRQ); + if (pirq->active_count != 0 && pirq_valid_irq(pirq->reg)) + vm_isa_assert_irq(ctx, pirq->reg & PIRQ_IRQ, -1); + } + pthread_mutex_unlock(&pirq->lock); +} + +void +pci_irq_reserve(int irq) +{ + + assert(irq < nitems(irq_counts)); + assert(pirq_cold); + assert(irq_counts[irq] == 0 || irq_counts[irq] == IRQ_DISABLED); + irq_counts[irq] = IRQ_DISABLED; +} + +void +pci_irq_use(int irq) +{ + + assert(irq < nitems(irq_counts)); + assert(pirq_cold); + if (irq_counts[irq] != IRQ_DISABLED) + irq_counts[irq]++; +} + +void +pci_irq_init(struct vmctx *ctx) +{ + int i; + + for (i = 0; i < nitems(pirqs); i++) { + pirqs[i].reg = PIRQ_DIS; + pirqs[i].use_count = 0; + pirqs[i].active_count = 0; + pthread_mutex_init(&pirqs[i].lock, NULL); + } + for (i = 0; i < nitems(irq_counts); i++) { + if (IRQ_PERMITTED(i)) + irq_counts[i] = 0; + else + irq_counts[i] = IRQ_DISABLED; + } +} + +void +pci_irq_assert(struct pci_devinst *pi) +{ + struct pirq *pirq; + + if (pi->pi_lintr.pirq_pin > 0) { + assert(pi->pi_lintr.pirq_pin <= nitems(pirqs)); + pirq = &pirqs[pi->pi_lintr.pirq_pin - 1]; + pthread_mutex_lock(&pirq->lock); + pirq->active_count++; + if (pirq->active_count == 1 && pirq_valid_irq(pirq->reg)) { + vm_isa_assert_irq(pi->pi_vmctx, pirq->reg & PIRQ_IRQ, + pi->pi_lintr.ioapic_irq); + pthread_mutex_unlock(&pirq->lock); + return; + } + pthread_mutex_unlock(&pirq->lock); + } + vm_ioapic_assert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq); +} + +void +pci_irq_deassert(struct pci_devinst *pi) +{ + struct pirq *pirq; + + if (pi->pi_lintr.pirq_pin > 0) { + assert(pi->pi_lintr.pirq_pin <= nitems(pirqs)); + pirq = &pirqs[pi->pi_lintr.pirq_pin - 1]; + pthread_mutex_lock(&pirq->lock); + pirq->active_count--; + if (pirq->active_count == 0 && pirq_valid_irq(pirq->reg)) { + vm_isa_deassert_irq(pi->pi_vmctx, pirq->reg & PIRQ_IRQ, + pi->pi_lintr.ioapic_irq); + pthread_mutex_unlock(&pirq->lock); + return; + } + pthread_mutex_unlock(&pirq->lock); + } + vm_ioapic_deassert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq); +} + +int +pirq_alloc_pin(struct vmctx *ctx) +{ + int best_count, best_irq, best_pin, irq, pin; + + pirq_cold = 1; + + /* First, find the least-used PIRQ pin. */ + best_pin = 0; + best_count = pirqs[0].use_count; + for (pin = 1; pin < nitems(pirqs); pin++) { + if (pirqs[pin].use_count < best_count) { + best_pin = pin; + best_count = pirqs[pin].use_count; + } + } + pirqs[best_pin].use_count++; + + /* Second, route this pin to an IRQ. */ + if (pirqs[best_pin].reg == PIRQ_DIS) { + best_irq = -1; + best_count = 0; + for (irq = 0; irq < nitems(irq_counts); irq++) { + if (irq_counts[irq] == IRQ_DISABLED) + continue; + if (best_irq == -1 || irq_counts[irq] < best_count) { + best_irq = irq; + best_count = irq_counts[irq]; + } + } + assert(best_irq != 0); + irq_counts[best_irq]++; + pirqs[best_pin].reg = best_irq; + vm_isa_set_irq_trigger(ctx, best_irq, LEVEL_TRIGGER); + } + + return (best_pin + 1); +} + +int +pirq_irq(int pin) +{ + + if (pin == -1) + return (255); + assert(pin > 0 && pin <= nitems(pirqs)); + return (pirqs[pin - 1].reg & PIRQ_IRQ); +} + +/* XXX: Generate $PIR table. */ + +static void +pirq_dsdt(void) +{ + char *irq_prs, *old; + int irq, pin; + + irq_prs = NULL; + for (irq = 0; irq < nitems(irq_counts); irq++) { + if (!IRQ_PERMITTED(irq)) + continue; + if (irq_prs == NULL) + asprintf(&irq_prs, "%d", irq); + else { + old = irq_prs; + asprintf(&irq_prs, "%s,%d", old, irq); + free(old); + } + } + + /* + * A helper method to validate a link register's value. This + * duplicates pirq_valid_irq(). + */ + dsdt_line(""); + dsdt_line("Method (PIRV, 1, NotSerialized)"); + dsdt_line("{"); + dsdt_line(" If (And (Arg0, 0x%02X))", PIRQ_DIS); + dsdt_line(" {"); + dsdt_line(" Return (0x00)"); + dsdt_line(" }"); + dsdt_line(" And (Arg0, 0x%02X, Local0)", PIRQ_IRQ); + dsdt_line(" If (LLess (Local0, 0x03))"); + dsdt_line(" {"); + dsdt_line(" Return (0x00)"); + dsdt_line(" }"); + dsdt_line(" If (LEqual (Local0, 0x08))"); + dsdt_line(" {"); + dsdt_line(" Return (0x00)"); + dsdt_line(" }"); + dsdt_line(" If (LEqual (Local0, 0x0D))"); + dsdt_line(" {"); + dsdt_line(" Return (0x00)"); + dsdt_line(" }"); + dsdt_line(" Return (0x01)"); + dsdt_line("}"); + + for (pin = 0; pin < nitems(pirqs); pin++) { + dsdt_line(""); + dsdt_line("Device (LNK%c)", 'A' + pin); + dsdt_line("{"); + dsdt_line(" Name (_HID, EisaId (\"PNP0C0F\"))"); + dsdt_line(" Name (_UID, 0x%02X)", pin + 1); + dsdt_line(" Method (_STA, 0, NotSerialized)"); + dsdt_line(" {"); + dsdt_line(" If (PIRV (PIR%c))", 'A' + pin); + dsdt_line(" {"); + dsdt_line(" Return (0x0B)"); + dsdt_line(" }"); + dsdt_line(" Else"); + dsdt_line(" {"); + dsdt_line(" Return (0x09)"); + dsdt_line(" }"); + dsdt_line(" }"); + dsdt_line(" Name (_PRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_line(" IRQ (Level, ActiveLow, Shared, )"); + dsdt_line(" {%s}", irq_prs); + dsdt_line(" })"); + dsdt_line(" Name (CB%02X, ResourceTemplate ()", pin + 1); + dsdt_line(" {"); + dsdt_line(" IRQ (Level, ActiveLow, Shared, )"); + dsdt_line(" {}"); + dsdt_line(" })"); + dsdt_line(" CreateWordField (CB%02X, 0x01, CIR%c)", + pin + 1, 'A' + pin); + dsdt_line(" Method (_CRS, 0, NotSerialized)"); + dsdt_line(" {"); + dsdt_line(" And (PIR%c, 0x%02X, Local0)", 'A' + pin, + PIRQ_DIS | PIRQ_IRQ); + dsdt_line(" If (PIRV (Local0))"); + dsdt_line(" {"); + dsdt_line(" ShiftLeft (0x01, Local0, CIR%c)", 'A' + pin); + dsdt_line(" }"); + dsdt_line(" Else"); + dsdt_line(" {"); + dsdt_line(" Store (0x00, CIR%c)", 'A' + pin); + dsdt_line(" }"); + dsdt_line(" Return (CB%02X)", pin + 1); + dsdt_line(" }"); + dsdt_line(" Method (_DIS, 0, NotSerialized)"); + dsdt_line(" {"); + dsdt_line(" Store (0x80, PIR%c)", 'A' + pin); + dsdt_line(" }"); + dsdt_line(" Method (_SRS, 1, NotSerialized)"); + dsdt_line(" {"); + dsdt_line(" CreateWordField (Arg0, 0x01, SIR%c)", 'A' + pin); + dsdt_line(" FindSetRightBit (SIR%c, Local0)", 'A' + pin); + dsdt_line(" Store (Decrement (Local0), PIR%c)", 'A' + pin); + dsdt_line(" }"); + dsdt_line("}"); + } + free(irq_prs); +} +LPC_DSDT(pirq_dsdt); Copied: stable/10/usr.sbin/bhyve/pci_irq.h (from r266125, head/usr.sbin/bhyve/pci_irq.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/bhyve/pci_irq.h Tue Jul 22 03:14:37 2014 (r268972, copy of r266125, head/usr.sbin/bhyve/pci_irq.h) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2014 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * 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 AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __PCI_IRQ_H__ +#define __PCI_IRQ_H__ + +struct pci_devinst; + +void pci_irq_assert(struct pci_devinst *pi); +void pci_irq_deassert(struct pci_devinst *pi); +void pci_irq_init(struct vmctx *ctx); +void pci_irq_reserve(int irq); +void pci_irq_use(int irq); +int pirq_alloc_pin(struct vmctx *ctx); +int pirq_irq(int pin); +uint8_t pirq_read(int pin); +void pirq_write(struct vmctx *ctx, int pin, uint8_t val); + +#endif Modified: stable/10/usr.sbin/bhyve/pci_lpc.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_lpc.c Tue Jul 22 02:02:39 2014 (r268971) +++ stable/10/usr.sbin/bhyve/pci_lpc.c Tue Jul 22 03:14:37 2014 (r268972) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include "acpi.h" #include "inout.h" #include "pci_emul.h" +#include "pci_irq.h" #include "pci_lpc.h" #include "uart_emul.h" @@ -173,6 +174,7 @@ lpc_init(void) "LPC device %s\n", name); return (-1); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Tue Jul 22 04:39:18 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB2441FF; Tue, 22 Jul 2014 04:39:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5A2E2846; Tue, 22 Jul 2014 04:39:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6M4dI5g047912; Tue, 22 Jul 2014 04:39:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6M4dHeV047899; Tue, 22 Jul 2014 04:39:17 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407220439.s6M4dHeV047899@svn.freebsd.org> From: John Baldwin Date: Tue, 22 Jul 2014 04:39:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268976 - in stable/10: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/intel usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2014 04:39:19 -0000 Author: jhb Date: Tue Jul 22 04:39:16 2014 New Revision: 268976 URL: http://svnweb.freebsd.org/changeset/base/268976 Log: MFC 266424,266476,266524,266573,266595,266626,266627,266633,266641,266642, 266708,266724,266934,266935,268521: Emulation of the "ins" and "outs" instructions. Various fixes for translating guest linear addresses to guest physical addresses. Modified: stable/10/lib/libvmmapi/vmmapi.c stable/10/lib/libvmmapi/vmmapi.h stable/10/sys/amd64/include/vmm.h stable/10/sys/amd64/include/vmm_dev.h stable/10/sys/amd64/include/vmm_instruction_emul.h stable/10/sys/amd64/vmm/intel/vmx.c stable/10/sys/amd64/vmm/vmm.c stable/10/sys/amd64/vmm/vmm_dev.c stable/10/sys/amd64/vmm/vmm_instruction_emul.c stable/10/sys/amd64/vmm/vmm_ioport.c stable/10/sys/amd64/vmm/vmm_ioport.h stable/10/sys/amd64/vmm/vmm_ktr.h stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyve/inout.c stable/10/usr.sbin/bhyve/inout.h stable/10/usr.sbin/bhyve/mem.c stable/10/usr.sbin/bhyve/pci_virtio_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libvmmapi/vmmapi.c ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.c Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/lib/libvmmapi/vmmapi.c Tue Jul 22 04:39:16 2014 (r268976) @@ -33,8 +33,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -937,3 +939,107 @@ vm_get_hpet_capabilities(struct vmctx *c *capabilities = cap.capabilities; return (error); } + +static int +gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, + uint64_t gla, int prot, int *fault, uint64_t *gpa) +{ + struct vm_gla2gpa gg; + int error; + + bzero(&gg, sizeof(struct vm_gla2gpa)); + gg.vcpuid = vcpu; + gg.prot = prot; + gg.gla = gla; + gg.paging = *paging; + + error = ioctl(ctx->fd, VM_GLA2GPA, &gg); + if (error == 0) { + *fault = gg.fault; + *gpa = gg.gpa; + } + return (error); +} + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +int +vm_gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, + uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt) +{ + uint64_t gpa; + int error, fault, i, n, off; + + for (i = 0; i < iovcnt; i++) { + iov[i].iov_base = 0; + iov[i].iov_len = 0; + } + + while (len) { + assert(iovcnt > 0); + error = gla2gpa(ctx, vcpu, paging, gla, prot, &fault, &gpa); + if (error) + return (-1); + if (fault) + return (1); + + off = gpa & PAGE_MASK; + n = min(len, PAGE_SIZE - off); + + iov->iov_base = (void *)gpa; + iov->iov_len = n; + iov++; + iovcnt--; + + gla += n; + len -= n; + } + return (0); +} + +void +vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *iov, void *vp, size_t len) +{ + const char *src; + char *dst; + uint64_t gpa; + size_t n; + + dst = vp; + while (len) { + assert(iov->iov_len); + gpa = (uint64_t)iov->iov_base; + n = min(len, iov->iov_len); + src = vm_map_gpa(ctx, gpa, n); + bcopy(src, dst, n); + + iov++; + dst += n; + len -= n; + } +} + +void +vm_copyout(struct vmctx *ctx, int vcpu, const void *vp, struct iovec *iov, + size_t len) +{ + const char *src; + char *dst; + uint64_t gpa; + size_t n; + + src = vp; + while (len) { + assert(iov->iov_len); + gpa = (uint64_t)iov->iov_base; + n = min(len, iov->iov_len); + dst = vm_map_gpa(ctx, gpa, n); + bcopy(src, dst, n); + + iov++; + src += n; + len -= n; + } +} Modified: stable/10/lib/libvmmapi/vmmapi.h ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.h Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/lib/libvmmapi/vmmapi.h Tue Jul 22 04:39:16 2014 (r268976) @@ -29,6 +29,7 @@ #ifndef _VMMAPI_H_ #define _VMMAPI_H_ +struct iovec; struct vmctx; enum x2apic_state; @@ -109,6 +110,18 @@ int vm_set_x2apic_state(struct vmctx *ct int vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities); +/* + * Translate the GLA range [gla,gla+len) into GPA segments in 'iov'. + * The 'iovcnt' should be big enough to accomodate all GPA segments. + * Returns 0 on success, 1 on a guest fault condition and -1 otherwise. + */ +int vm_gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, + uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt); +void vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *guest_iov, + void *host_dst, size_t len); +void vm_copyout(struct vmctx *ctx, int vcpu, const void *host_src, + struct iovec *guest_iov, size_t len); + /* Reset vcpu register state */ int vcpu_reset(struct vmctx *ctx, int vcpu); Modified: stable/10/sys/amd64/include/vmm.h ============================================================================== --- stable/10/sys/amd64/include/vmm.h Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/sys/amd64/include/vmm.h Tue Jul 22 04:39:16 2014 (r268976) @@ -54,6 +54,7 @@ struct vmspace; struct vm_object; struct pmap; +enum vm_reg_name; enum x2apic_state; typedef int (*vmm_init_func_t)(int ipinum); @@ -236,10 +237,11 @@ int vm_exception_pending(struct vm *vm, void vm_inject_gp(struct vm *vm, int vcpuid); /* general protection fault */ void vm_inject_ud(struct vm *vm, int vcpuid); /* undefined instruction fault */ +void vm_inject_pf(struct vm *vm, int vcpuid, int error_code, uint64_t cr2); -#endif /* KERNEL */ +enum vm_reg_name vm_segment_name(int seg_encoding); -#include +#endif /* KERNEL */ #define VM_MAXCPU 16 /* maximum virtual cpus */ @@ -280,6 +282,7 @@ enum vm_reg_name { VM_REG_GUEST_IDTR, VM_REG_GUEST_GDTR, VM_REG_GUEST_EFER, + VM_REG_GUEST_CR2, VM_REG_LAST }; @@ -318,6 +321,76 @@ struct seg_desc { uint32_t limit; uint32_t access; }; +#define SEG_DESC_TYPE(desc) ((desc)->access & 0x001f) +#define SEG_DESC_PRESENT(desc) ((desc)->access & 0x0080) +#define SEG_DESC_DEF32(desc) ((desc)->access & 0x4000) +#define SEG_DESC_GRANULARITY(desc) ((desc)->access & 0x8000) +#define SEG_DESC_UNUSABLE(desc) ((desc)->access & 0x10000) + +enum vm_cpu_mode { + CPU_MODE_COMPATIBILITY, /* IA-32E mode (CS.L = 0) */ + CPU_MODE_64BIT, /* IA-32E mode (CS.L = 1) */ +}; + +enum vm_paging_mode { + PAGING_MODE_FLAT, + PAGING_MODE_32, + PAGING_MODE_PAE, + PAGING_MODE_64, +}; + +struct vm_guest_paging { + uint64_t cr3; + int cpl; + enum vm_cpu_mode cpu_mode; + enum vm_paging_mode paging_mode; +}; + +/* + * The data structures 'vie' and 'vie_op' are meant to be opaque to the + * consumers of instruction decoding. The only reason why their contents + * need to be exposed is because they are part of the 'vm_exit' structure. + */ +struct vie_op { + uint8_t op_byte; /* actual opcode byte */ + uint8_t op_type; /* type of operation (e.g. MOV) */ + uint16_t op_flags; +}; + +#define VIE_INST_SIZE 15 +struct vie { + uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */ + uint8_t num_valid; /* size of the instruction */ + uint8_t num_processed; + + uint8_t rex_w:1, /* REX prefix */ + rex_r:1, + rex_x:1, + rex_b:1, + rex_present:1; + + uint8_t mod:2, /* ModRM byte */ + reg:4, + rm:4; + + uint8_t ss:2, /* SIB byte */ + index:4, + base:4; + + uint8_t disp_bytes; + uint8_t imm_bytes; + + uint8_t scale; + int base_register; /* VM_REG_GUEST_xyz */ + int index_register; /* VM_REG_GUEST_xyz */ + + int64_t displacement; /* optional addr displacement */ + int64_t immediate; /* optional immediate operand */ + + uint8_t decoded; /* set to 1 if successfully decoded */ + + struct vie_op op; /* opcode description */ +}; enum vm_exitcode { VM_EXITCODE_INOUT, @@ -335,22 +408,38 @@ enum vm_exitcode { VM_EXITCODE_RENDEZVOUS, VM_EXITCODE_IOAPIC_EOI, VM_EXITCODE_SUSPENDED, + VM_EXITCODE_INOUT_STR, VM_EXITCODE_MAX }; +struct vm_inout { + uint16_t bytes:3; /* 1 or 2 or 4 */ + uint16_t in:1; + uint16_t string:1; + uint16_t rep:1; + uint16_t port; + uint32_t eax; /* valid for out */ +}; + +struct vm_inout_str { + struct vm_inout inout; /* must be the first element */ + struct vm_guest_paging paging; + uint64_t rflags; + uint64_t cr0; + uint64_t index; + uint64_t count; /* rep=1 (%rcx), rep=0 (1) */ + int addrsize; + enum vm_reg_name seg_name; + struct seg_desc seg_desc; +}; + struct vm_exit { enum vm_exitcode exitcode; int inst_length; /* 0 means unknown */ uint64_t rip; union { - struct { - uint16_t bytes:3; /* 1 or 2 or 4 */ - uint16_t in:1; /* out is 0, in is 1 */ - uint16_t string:1; - uint16_t rep:1; - uint16_t port; - uint32_t eax; /* valid for out */ - } inout; + struct vm_inout inout; + struct vm_inout_str inout_str; struct { uint64_t gpa; int fault_type; @@ -358,9 +447,7 @@ struct vm_exit { struct { uint64_t gpa; uint64_t gla; - uint64_t cr3; - enum vie_cpu_mode cpu_mode; - enum vie_paging_mode paging_mode; + struct vm_guest_paging paging; struct vie vie; } inst_emul; /* Modified: stable/10/sys/amd64/include/vmm_dev.h ============================================================================== --- stable/10/sys/amd64/include/vmm_dev.h Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/sys/amd64/include/vmm_dev.h Tue Jul 22 04:39:16 2014 (r268976) @@ -168,6 +168,15 @@ struct vm_suspend { enum vm_suspend_how how; }; +struct vm_gla2gpa { + int vcpuid; /* inputs */ + int prot; /* PROT_READ or PROT_WRITE */ + uint64_t gla; + struct vm_guest_paging paging; + int fault; /* outputs */ + uint64_t gpa; +}; + enum { /* general routines */ IOCNUM_ABIVERS = 0, @@ -180,6 +189,7 @@ enum { IOCNUM_MAP_MEMORY = 10, IOCNUM_GET_MEMORY_SEG = 11, IOCNUM_GET_GPA_PMAP = 12, + IOCNUM_GLA2GPA = 13, /* register/state accessors */ IOCNUM_SET_REGISTER = 20, @@ -289,4 +299,6 @@ enum { _IOR('v', IOCNUM_GET_HPET_CAPABILITIES, struct vm_hpet_cap) #define VM_GET_GPA_PMAP \ _IOWR('v', IOCNUM_GET_GPA_PMAP, struct vm_gpa_pte) +#define VM_GLA2GPA \ + _IOWR('v', IOCNUM_GLA2GPA, struct vm_gla2gpa) #endif Modified: stable/10/sys/amd64/include/vmm_instruction_emul.h ============================================================================== --- stable/10/sys/amd64/include/vmm_instruction_emul.h Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/sys/amd64/include/vmm_instruction_emul.h Tue Jul 22 04:39:16 2014 (r268976) @@ -29,63 +29,7 @@ #ifndef _VMM_INSTRUCTION_EMUL_H_ #define _VMM_INSTRUCTION_EMUL_H_ -enum vie_cpu_mode { - CPU_MODE_COMPATIBILITY, /* IA-32E mode (CS.L = 0) */ - CPU_MODE_64BIT, /* IA-32E mode (CS.L = 1) */ -}; - -enum vie_paging_mode { - PAGING_MODE_FLAT, - PAGING_MODE_32, - PAGING_MODE_PAE, - PAGING_MODE_64, -}; - -/* - * The data structures 'vie' and 'vie_op' are meant to be opaque to the - * consumers of instruction decoding. The only reason why their contents - * need to be exposed is because they are part of the 'vm_exit' structure. - */ -struct vie_op { - uint8_t op_byte; /* actual opcode byte */ - uint8_t op_type; /* type of operation (e.g. MOV) */ - uint16_t op_flags; -}; - -#define VIE_INST_SIZE 15 -struct vie { - uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */ - uint8_t num_valid; /* size of the instruction */ - uint8_t num_processed; - - uint8_t rex_w:1, /* REX prefix */ - rex_r:1, - rex_x:1, - rex_b:1, - rex_present:1; - - uint8_t mod:2, /* ModRM byte */ - reg:4, - rm:4; - - uint8_t ss:2, /* SIB byte */ - index:4, - base:4; - - uint8_t disp_bytes; - uint8_t imm_bytes; - - uint8_t scale; - int base_register; /* VM_REG_GUEST_xyz */ - int index_register; /* VM_REG_GUEST_xyz */ - - int64_t displacement; /* optional addr displacement */ - int64_t immediate; /* optional immediate operand */ - - uint8_t decoded; /* set to 1 if successfully decoded */ - - struct vie_op op; /* opcode description */ -}; +#include /* * Callback functions to read and write memory regions. @@ -111,6 +55,24 @@ int vmm_emulate_instruction(void *vm, in mem_region_read_t mrr, mem_region_write_t mrw, void *mrarg); +int vie_update_register(void *vm, int vcpuid, enum vm_reg_name reg, + uint64_t val, int size); + +/* + * Returns 1 if an alignment check exception should be injected and 0 otherwise. + */ +int vie_alignment_check(int cpl, int operand_size, uint64_t cr0, + uint64_t rflags, uint64_t gla); + +/* Returns 1 if the 'gla' is not canonical and 0 otherwise. */ +int vie_canonical_check(enum vm_cpu_mode cpu_mode, uint64_t gla); + +uint64_t vie_size2mask(int size); + +int vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg, + struct seg_desc *desc, uint64_t off, int length, int addrsize, int prot, + uint64_t *gla); + #ifdef _KERNEL /* * APIs to fetch and decode the instruction from nested page fault handler. @@ -118,8 +80,18 @@ int vmm_emulate_instruction(void *vm, in * 'vie' must be initialized before calling 'vmm_fetch_instruction()' */ int vmm_fetch_instruction(struct vm *vm, int cpuid, - uint64_t rip, int inst_length, uint64_t cr3, - enum vie_paging_mode paging_mode, struct vie *vie); + struct vm_guest_paging *guest_paging, + uint64_t rip, int inst_length, struct vie *vie); + +/* + * Translate the guest linear address 'gla' to a guest physical address. + * + * Returns 0 on success and '*gpa' contains the result of the translation. + * Returns 1 if an exception was injected into the guest. + * Returns -1 otherwise. + */ +int vmm_gla2gpa(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, + uint64_t gla, int prot, uint64_t *gpa); void vie_init(struct vie *vie); @@ -136,7 +108,7 @@ void vie_init(struct vie *vie); */ #define VIE_INVALID_GLA (1UL << 63) /* a non-canonical address */ int vmm_decode_instruction(struct vm *vm, int cpuid, uint64_t gla, - enum vie_cpu_mode cpu_mode, struct vie *vie); + enum vm_cpu_mode cpu_mode, struct vie *vie); #endif /* _KERNEL */ #endif /* _VMM_INSTRUCTION_EMUL_H_ */ Modified: stable/10/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx.c Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/sys/amd64/vmm/intel/vmx.c Tue Jul 22 04:39:16 2014 (r268976) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "vmm_host.h" #include "vmm_ioport.h" #include "vmm_ipi.h" @@ -185,6 +186,8 @@ SYSCTL_UINT(_hw_vmm_vmx, OID_AUTO, vpid_ */ #define APIC_ACCESS_ADDRESS 0xFFFFF000 +static int vmx_getdesc(void *arg, int vcpu, int reg, struct seg_desc *desc); +static int vmx_getreg(void *arg, int vcpu, int reg, uint64_t *retval); static void vmx_inject_pir(struct vlapic *vlapic); #ifdef KTR @@ -539,7 +542,7 @@ static int vmx_init(int ipinum) { int error, use_tpr_shadow; - uint64_t fixed0, fixed1, feature_control; + uint64_t basic, fixed0, fixed1, feature_control; uint32_t tmp, procbased2_vid_bits; /* CPUID.1:ECX[bit 5] must be 1 for processor to support VMX */ @@ -559,6 +562,17 @@ vmx_init(int ipinum) return (ENXIO); } + /* + * Verify capabilities MSR_VMX_BASIC: + * - bit 54 indicates support for INS/OUTS decoding + */ + basic = rdmsr(MSR_VMX_BASIC); + if ((basic & (1UL << 54)) == 0) { + printf("vmx_init: processor does not support desired basic " + "capabilities\n"); + return (EINVAL); + } + /* Check support for primary processor-based VM-execution controls */ error = vmx_set_ctlreg(MSR_VMX_PROCBASED_CTLS, MSR_VMX_TRUE_PROCBASED_CTLS, @@ -1539,7 +1553,19 @@ vmx_emulate_cr_access(struct vmx *vmx, i return (HANDLED); } -static enum vie_cpu_mode +/* + * From section "Guest Register State" in the Intel SDM: CPL = SS.DPL + */ +static int +vmx_cpl(void) +{ + uint32_t ssar; + + ssar = vmcs_read(VMCS_GUEST_SS_ACCESS_RIGHTS); + return ((ssar >> 5) & 0x3); +} + +static enum vm_cpu_mode vmx_cpu_mode(void) { @@ -1549,7 +1575,7 @@ vmx_cpu_mode(void) return (CPU_MODE_COMPATIBILITY); } -static enum vie_paging_mode +static enum vm_paging_mode vmx_paging_mode(void) { @@ -1563,6 +1589,89 @@ vmx_paging_mode(void) return (PAGING_MODE_PAE); } +static uint64_t +inout_str_index(struct vmx *vmx, int vcpuid, int in) +{ + uint64_t val; + int error; + enum vm_reg_name reg; + + reg = in ? VM_REG_GUEST_RDI : VM_REG_GUEST_RSI; + error = vmx_getreg(vmx, vcpuid, reg, &val); + KASSERT(error == 0, ("%s: vmx_getreg error %d", __func__, error)); + return (val); +} + +static uint64_t +inout_str_count(struct vmx *vmx, int vcpuid, int rep) +{ + uint64_t val; + int error; + + if (rep) { + error = vmx_getreg(vmx, vcpuid, VM_REG_GUEST_RCX, &val); + KASSERT(!error, ("%s: vmx_getreg error %d", __func__, error)); + } else { + val = 1; + } + return (val); +} + +static int +inout_str_addrsize(uint32_t inst_info) +{ + uint32_t size; + + size = (inst_info >> 7) & 0x7; + switch (size) { + case 0: + return (2); /* 16 bit */ + case 1: + return (4); /* 32 bit */ + case 2: + return (8); /* 64 bit */ + default: + panic("%s: invalid size encoding %d", __func__, size); + } +} + +static void +inout_str_seginfo(struct vmx *vmx, int vcpuid, uint32_t inst_info, int in, + struct vm_inout_str *vis) +{ + int error, s; + + if (in) { + vis->seg_name = VM_REG_GUEST_ES; + } else { + s = (inst_info >> 15) & 0x7; + vis->seg_name = vm_segment_name(s); + } + + error = vmx_getdesc(vmx, vcpuid, vis->seg_name, &vis->seg_desc); + KASSERT(error == 0, ("%s: vmx_getdesc error %d", __func__, error)); + + /* XXX modify svm.c to update bit 16 of seg_desc.access (unusable) */ +} + +static void +vmx_paging_info(struct vm_guest_paging *paging) +{ + paging->cr3 = vmcs_guest_cr3(); + paging->cpl = vmx_cpl(); + paging->cpu_mode = vmx_cpu_mode(); + paging->paging_mode = vmx_paging_mode(); +} + +static void +vmexit_inst_emul(struct vm_exit *vmexit, uint64_t gpa, uint64_t gla) +{ + vmexit->exitcode = VM_EXITCODE_INST_EMUL; + vmexit->u.inst_emul.gpa = gpa; + vmexit->u.inst_emul.gla = gla; + vmx_paging_info(&vmexit->u.inst_emul.paging); +} + static int ept_fault_type(uint64_t ept_qual) { @@ -1754,12 +1863,8 @@ vmx_handle_apic_access(struct vmx *vmx, } if (allowed) { - vmexit->exitcode = VM_EXITCODE_INST_EMUL; - vmexit->u.inst_emul.gpa = DEFAULT_APIC_BASE + offset; - vmexit->u.inst_emul.gla = VIE_INVALID_GLA; - vmexit->u.inst_emul.cr3 = vmcs_guest_cr3(); - vmexit->u.inst_emul.cpu_mode = vmx_cpu_mode(); - vmexit->u.inst_emul.paging_mode = vmx_paging_mode(); + vmexit_inst_emul(vmexit, DEFAULT_APIC_BASE + offset, + VIE_INVALID_GLA); } /* @@ -1776,10 +1881,12 @@ vmx_handle_apic_access(struct vmx *vmx, static int vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) { - int error, handled; + int error, handled, in; struct vmxctx *vmxctx; struct vlapic *vlapic; - uint32_t eax, ecx, edx, idtvec_info, idtvec_err, intr_info, reason; + struct vm_inout_str *vis; + uint32_t eax, ecx, edx, idtvec_info, idtvec_err, intr_info, inst_info; + uint32_t reason; uint64_t qual, gpa; bool retu; @@ -1936,15 +2043,22 @@ vmx_exit_process(struct vmx *vmx, int vc vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INOUT, 1); vmexit->exitcode = VM_EXITCODE_INOUT; vmexit->u.inout.bytes = (qual & 0x7) + 1; - vmexit->u.inout.in = (qual & 0x8) ? 1 : 0; + vmexit->u.inout.in = in = (qual & 0x8) ? 1 : 0; vmexit->u.inout.string = (qual & 0x10) ? 1 : 0; vmexit->u.inout.rep = (qual & 0x20) ? 1 : 0; vmexit->u.inout.port = (uint16_t)(qual >> 16); vmexit->u.inout.eax = (uint32_t)(vmxctx->guest_rax); - error = emulate_ioport(vmx->vm, vcpu, vmexit); - if (error == 0) { - handled = 1; - vmxctx->guest_rax = vmexit->u.inout.eax; + if (vmexit->u.inout.string) { + inst_info = vmcs_read(VMCS_EXIT_INSTRUCTION_INFO); + vmexit->exitcode = VM_EXITCODE_INOUT_STR; + vis = &vmexit->u.inout_str; + vmx_paging_info(&vis->paging); + vis->rflags = vmcs_read(VMCS_GUEST_RFLAGS); + vis->cr0 = vmcs_read(VMCS_GUEST_CR0); + vis->index = inout_str_index(vmx, vcpu, in); + vis->count = inout_str_count(vmx, vcpu, vis->inout.rep); + vis->addrsize = inout_str_addrsize(inst_info); + inout_str_seginfo(vmx, vcpu, inst_info, in, vis); } break; case EXIT_REASON_CPUID: @@ -1990,12 +2104,7 @@ vmx_exit_process(struct vmx *vmx, int vc vmexit->u.paging.fault_type = ept_fault_type(qual); vmm_stat_incr(vmx->vm, vcpu, VMEXIT_NESTED_FAULT, 1); } else if (ept_emulation_fault(qual)) { - vmexit->exitcode = VM_EXITCODE_INST_EMUL; - vmexit->u.inst_emul.gpa = gpa; - vmexit->u.inst_emul.gla = vmcs_gla(); - vmexit->u.inst_emul.cr3 = vmcs_guest_cr3(); - vmexit->u.inst_emul.cpu_mode = vmx_cpu_mode(); - vmexit->u.inst_emul.paging_mode = vmx_paging_mode(); + vmexit_inst_emul(vmexit, gpa, vmcs_gla()); vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INST_EMUL, 1); } /* @@ -2324,6 +2433,8 @@ vmxctx_regptr(struct vmxctx *vmxctx, int return (&vmxctx->guest_r14); case VM_REG_GUEST_R15: return (&vmxctx->guest_r15); + case VM_REG_GUEST_CR2: + return (&vmxctx->guest_cr2); default: break; } Modified: stable/10/sys/amd64/vmm/vmm.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm.c Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/sys/amd64/vmm/vmm.c Tue Jul 22 04:39:16 2014 (r268976) @@ -62,7 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include "vmm_ioport.h" #include "vmm_ktr.h" #include "vmm_host.h" #include "vmm_mem.h" @@ -1131,34 +1133,33 @@ vm_handle_inst_emul(struct vm *vm, int v struct vie *vie; struct vcpu *vcpu; struct vm_exit *vme; - int error, inst_length; - uint64_t rip, gla, gpa, cr3; - enum vie_cpu_mode cpu_mode; - enum vie_paging_mode paging_mode; + uint64_t gla, gpa; + struct vm_guest_paging *paging; mem_region_read_t mread; mem_region_write_t mwrite; + int error; vcpu = &vm->vcpu[vcpuid]; vme = &vcpu->exitinfo; - rip = vme->rip; - inst_length = vme->inst_length; - gla = vme->u.inst_emul.gla; gpa = vme->u.inst_emul.gpa; - cr3 = vme->u.inst_emul.cr3; - cpu_mode = vme->u.inst_emul.cpu_mode; - paging_mode = vme->u.inst_emul.paging_mode; vie = &vme->u.inst_emul.vie; + paging = &vme->u.inst_emul.paging; vie_init(vie); /* Fetch, decode and emulate the faulting instruction */ - if (vmm_fetch_instruction(vm, vcpuid, rip, inst_length, cr3, - paging_mode, vie) != 0) + error = vmm_fetch_instruction(vm, vcpuid, paging, vme->rip, + vme->inst_length, vie); + if (error == 1) + return (0); /* Resume guest to handle page fault */ + else if (error == -1) return (EFAULT); + else if (error != 0) + panic("%s: vmm_fetch_instruction error %d", __func__, error); - if (vmm_decode_instruction(vm, vcpuid, gla, cpu_mode, vie) != 0) + if (vmm_decode_instruction(vm, vcpuid, gla, paging->cpu_mode, vie) != 0) return (EFAULT); /* return to userland unless this is an in-kernel emulated device */ @@ -1348,6 +1349,10 @@ restart: case VM_EXITCODE_INST_EMUL: error = vm_handle_inst_emul(vm, vcpuid, &retu); break; + case VM_EXITCODE_INOUT: + case VM_EXITCODE_INOUT_STR: + error = vm_handle_inout(vm, vcpuid, vme, &retu); + break; default: retu = true; /* handled in userland */ break; @@ -1430,6 +1435,25 @@ vm_inject_fault(struct vm *vm, int vcpui } void +vm_inject_pf(struct vm *vm, int vcpuid, int error_code, uint64_t cr2) +{ + struct vm_exception pf = { + .vector = IDT_PF, + .error_code_valid = 1, + .error_code = error_code + }; + int error; + + VCPU_CTR2(vm, vcpuid, "Injecting page fault: error_code %#x, cr2 %#lx", + error_code, cr2); + + error = vm_set_register(vm, vcpuid, VM_REG_GUEST_CR2, cr2); + KASSERT(error == 0, ("vm_set_register(cr2) error %d", error)); + + vm_inject_fault(vm, vcpuid, &pf); +} + +void vm_inject_gp(struct vm *vm, int vcpuid) { struct vm_exception gpf = { @@ -1856,3 +1880,20 @@ vm_atpit(struct vm *vm) { return (vm->vatpit); } + +enum vm_reg_name +vm_segment_name(int seg) +{ + static enum vm_reg_name seg_names[] = { + VM_REG_GUEST_ES, + VM_REG_GUEST_CS, + VM_REG_GUEST_SS, + VM_REG_GUEST_DS, + VM_REG_GUEST_FS, + VM_REG_GUEST_GS + }; + + KASSERT(seg >= 0 && seg < nitems(seg_names), + ("%s: invalid segment encoding %d", __func__, seg)); + return (seg_names[seg]); +} Modified: stable/10/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm_dev.c Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/sys/amd64/vmm/vmm_dev.c Tue Jul 22 04:39:16 2014 (r268976) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "vmm_lapic.h" @@ -168,6 +169,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long c struct vm_x2apic *x2apic; struct vm_gpa_pte *gpapte; struct vm_suspend *vmsuspend; + struct vm_gla2gpa *gg; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -192,6 +194,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long c case VM_PPTDEV_MSI: case VM_PPTDEV_MSIX: case VM_SET_X2APIC_STATE: + case VM_GLA2GPA: /* * XXX fragile, handle with care * Assumes that the first field of the ioctl data is the vcpu. @@ -415,6 +418,27 @@ vmmdev_ioctl(struct cdev *cdev, u_long c case VM_GET_HPET_CAPABILITIES: error = vhpet_getcap((struct vm_hpet_cap *)data); break; + case VM_GLA2GPA: { + CTASSERT(PROT_READ == VM_PROT_READ); + CTASSERT(PROT_WRITE == VM_PROT_WRITE); + CTASSERT(PROT_EXEC == VM_PROT_EXECUTE); + gg = (struct vm_gla2gpa *)data; + error = vmm_gla2gpa(sc->vm, gg->vcpuid, &gg->paging, gg->gla, + gg->prot, &gg->gpa); + KASSERT(error == 0 || error == 1 || error == -1, + ("%s: vmm_gla2gpa unknown error %d", __func__, error)); + if (error >= 0) { + /* + * error = 0: the translation was successful + * error = 1: a fault was injected into the guest + */ + gg->fault = error; + error = 0; + } else { + error = EFAULT; + } + break; + } default: error = ENOTTY; break; Modified: stable/10/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm_instruction_emul.c Tue Jul 22 04:38:28 2014 (r268975) +++ stable/10/sys/amd64/vmm/vmm_instruction_emul.c Tue Jul 22 04:39:16 2014 (r268976) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -46,9 +47,15 @@ __FBSDID("$FreeBSD$"); #include +#include #include +#define KASSERT(exp,msg) assert((exp)) #endif /* _KERNEL */ +#include +#include +#include + /* struct vie_op.op_type */ enum { VIE_OP_TYPE_NONE = 0, @@ -205,7 +212,7 @@ vie_read_bytereg(void *vm, int vcpuid, s return (error); } -static int +int vie_update_register(void *vm, int vcpuid, enum vm_reg_name reg, uint64_t val, int size) { @@ -560,6 +567,155 @@ vmm_emulate_instruction(void *vm, int vc return (error); } +int +vie_alignment_check(int cpl, int size, uint64_t cr0, uint64_t rf, uint64_t gla) +{ + KASSERT(size == 1 || size == 2 || size == 4 || size == 8, + ("%s: invalid size %d", __func__, size)); + KASSERT(cpl >= 0 && cpl <= 3, ("%s: invalid cpl %d", __func__, cpl)); + + if (cpl != 3 || (cr0 & CR0_AM) == 0 || (rf & PSL_AC) == 0) + return (0); + + return ((gla & (size - 1)) ? 1 : 0); +} + +int +vie_canonical_check(enum vm_cpu_mode cpu_mode, uint64_t gla) +{ + uint64_t mask; + + if (cpu_mode != CPU_MODE_64BIT) + return (0); + + /* + * The value of the bit 47 in the 'gla' should be replicated in the + * most significant 16 bits. + */ + mask = ~((1UL << 48) - 1); + if (gla & (1UL << 47)) + return ((gla & mask) != mask); + else + return ((gla & mask) != 0); +} + +uint64_t +vie_size2mask(int size) +{ + KASSERT(size == 1 || size == 2 || size == 4 || size == 8, + ("vie_size2mask: invalid size %d", size)); + return (size2mask[size]); +} + +int +vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg, + struct seg_desc *desc, uint64_t offset, int length, int addrsize, + int prot, uint64_t *gla) +{ + uint64_t firstoff, low_limit, high_limit, segbase; + int glasize, type; + + KASSERT(seg >= VM_REG_GUEST_ES && seg <= VM_REG_GUEST_GS, + ("%s: invalid segment %d", __func__, seg)); + KASSERT(length == 1 || length == 2 || length == 4 || length == 8, + ("%s: invalid operand size %d", __func__, length)); + KASSERT((prot & ~(PROT_READ | PROT_WRITE)) == 0, + ("%s: invalid prot %#x", __func__, prot)); + + firstoff = offset; + if (cpu_mode == CPU_MODE_64BIT) { + KASSERT(addrsize == 4 || addrsize == 8, ("%s: invalid address " + "size %d for cpu_mode %d", __func__, addrsize, cpu_mode)); + glasize = 8; + } else { + KASSERT(addrsize == 2 || addrsize == 4, ("%s: invalid address " + "size %d for cpu mode %d", __func__, addrsize, cpu_mode)); + glasize = 4; + /* + * If the segment selector is loaded with a NULL selector + * then the descriptor is unusable and attempting to use + * it results in a #GP(0). + */ + if (SEG_DESC_UNUSABLE(desc)) + return (-1); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Tue Jul 22 23:16:30 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43C26B1E; Tue, 22 Jul 2014 23:16:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DD0B22E2; Tue, 22 Jul 2014 23:16:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6MNGU2I064487; Tue, 22 Jul 2014 23:16:30 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6MNGSpt064478; Tue, 22 Jul 2014 23:16:28 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407222316.s6MNGSpt064478@svn.freebsd.org> From: Ed Maste Date: Tue, 22 Jul 2014 23:16:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269000 - in stable/10/contrib/llvm: include/llvm lib/CodeGen/AsmPrinter patches tools/clang/lib/CodeGen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2014 23:16:30 -0000 Author: emaste Date: Tue Jul 22 23:16:28 2014 New Revision: 269000 URL: http://svnweb.freebsd.org/changeset/base/269000 Log: MFC debug info for variadic functions r264826: Merge LLVM r202188: Debug info: Support variadic functions. Variadic functions have an unspecified parameter tag after the last argument. In IR this is represented as an unspecified parameter in the subroutine type. Paired commit with CFE r202185. rdar://problem/13690847 This re-applies r202184 + a bugfix in DwarfDebug's argument handling. This merge includes a change to use the LLVM 3.4 API in lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp: DwarfUnit -> CompileUnit r264827: Merge Clang r202185: Debug info: Generate debug info for variadic functions. Paired commit with LLVM. rdar://problem/13690847 This merege includes changes to use the Clang 3.4 API (revisions 199686 and 200082) in lib/CodeGen/CGDebugInfo.cpp: getParamType -> getArgType getNumParams -> getNumArgs getReturnType -> getResultType r264828: Add patches corresponding to r264826 and r264827 Sponsored by: DARPA, AFRL Added: stable/10/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff - copied unchanged from r264828, head/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff stable/10/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff - copied unchanged from r264828, head/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff Modified: stable/10/contrib/llvm/include/llvm/DIBuilder.h stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/llvm/include/llvm/DIBuilder.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/DIBuilder.h Tue Jul 22 23:10:12 2014 (r268999) +++ stable/10/contrib/llvm/include/llvm/DIBuilder.h Tue Jul 22 23:16:28 2014 (r269000) @@ -439,7 +439,7 @@ namespace llvm { /// through debug info anchors. void retainType(DIType T); - /// createUnspecifiedParameter - Create unspeicified type descriptor + /// createUnspecifiedParameter - Create unspecified type descriptor /// for a subroutine type. DIDescriptor createUnspecifiedParameter(); Modified: stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Tue Jul 22 23:10:12 2014 (r268999) +++ stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Tue Jul 22 23:16:28 2014 (r269000) @@ -1116,6 +1116,22 @@ void CompileUnit::constructTypeDIE(DIE & addSourceLine(&Buffer, DTy); } +/// constructSubprogramArguments - Construct function argument DIEs. +void CompileUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) { + for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) { + DIDescriptor Ty = Args.getElement(i); + if (Ty.isUnspecifiedParameter()) { + assert(i == N-1 && "ellipsis must be the last argument"); + createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer); + } else { + DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, Buffer); + addType(Arg, DIType(Ty)); + if (DIType(Ty).isArtificial()) + addFlag(Arg, dwarf::DW_AT_artificial); + } + } +} + /// Return true if the type is appropriately scoped to be contained inside /// its own type unit. static bool isTypeUnitScoped(DIType Ty, const DwarfDebug *DD) { @@ -1170,19 +1186,12 @@ void CompileUnit::constructTypeDIE(DIE & addType(&Buffer, RTy); bool isPrototyped = true; - // Add arguments. - for (unsigned i = 1, N = Elements.getNumElements(); i < N; ++i) { - DIDescriptor Ty = Elements.getElement(i); - if (Ty.isUnspecifiedParameter()) { - createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer); - isPrototyped = false; - } else { - DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, Buffer); - addType(Arg, DIType(Ty)); - if (DIType(Ty).isArtificial()) - addFlag(Arg, dwarf::DW_AT_artificial); - } - } + if (Elements.getNumElements() == 2 && + Elements.getElement(1).isUnspecifiedParameter()) + isPrototyped = false; + + constructSubprogramArguments(Buffer, Elements); + // Add prototype flag if we're dealing with a C language and the // function has been prototyped. uint16_t Language = getLanguage(); @@ -1475,13 +1484,7 @@ DIE *CompileUnit::getOrCreateSubprogramD // Add arguments. Do not add arguments for subprogram definition. They will // be handled while processing variables. - for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) { - DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, *SPDie); - DIType ATy(Args.getElement(i)); - addType(Arg, ATy); - if (ATy.isArtificial()) - addFlag(Arg, dwarf::DW_AT_artificial); - } + constructSubprogramArguments(*SPDie, Args); } if (SP.isArtificial()) Modified: stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Tue Jul 22 23:10:12 2014 (r268999) +++ stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Tue Jul 22 23:16:28 2014 (r269000) @@ -342,6 +342,9 @@ public: void emitHeader(const MCSection *ASection, const MCSymbol *ASectionSym); private: + /// constructSubprogramArguments - Construct function argument DIEs. + void constructSubprogramArguments(DIE &Buffer, DIArray Args); + /// constructTypeDIE - Construct basic type die from DIBasicType. void constructTypeDIE(DIE &Buffer, DIBasicType BTy); Modified: stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Jul 22 23:10:12 2014 (r268999) +++ stable/10/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Jul 22 23:16:28 2014 (r269000) @@ -404,15 +404,21 @@ DIE *DwarfDebug::updateSubprogramScopeDI DIArray Args = SPTy.getTypeArray(); uint16_t SPTag = SPTy.getTag(); if (SPTag == dwarf::DW_TAG_subroutine_type) + // FIXME: Use DwarfUnit::constructSubprogramArguments() here. for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) { - DIE *Arg = - SPCU->createAndAddDIE(dwarf::DW_TAG_formal_parameter, *SPDie); DIType ATy(Args.getElement(i)); - SPCU->addType(Arg, ATy); - if (ATy.isArtificial()) - SPCU->addFlag(Arg, dwarf::DW_AT_artificial); - if (ATy.isObjectPointer()) - SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg); + if (ATy.isUnspecifiedParameter()) { + assert(i == N-1 && "ellipsis must be the last argument"); + SPCU->createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, *SPDie); + } else { + DIE *Arg = + SPCU->createAndAddDIE(dwarf::DW_TAG_formal_parameter, *SPDie); + SPCU->addType(Arg, ATy); + if (ATy.isArtificial()) + SPCU->addFlag(Arg, dwarf::DW_AT_artificial); + if (ATy.isObjectPointer()) + SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg); + } } DIE *SPDeclDie = SPDie; SPDie = @@ -579,7 +585,7 @@ DIE *DwarfDebug::createScopeChildrenDIE( DIE *ObjectPointer = NULL; // Collect arguments for current function. - if (LScopes.isCurrentFunctionScope(Scope)) + if (LScopes.isCurrentFunctionScope(Scope)) { for (unsigned i = 0, N = CurrentFnArguments.size(); i < N; ++i) if (DbgVariable *ArgDV = CurrentFnArguments[i]) if (DIE *Arg = @@ -588,6 +594,16 @@ DIE *DwarfDebug::createScopeChildrenDIE( if (ArgDV->isObjectPointer()) ObjectPointer = Arg; } + // Create the unspecified parameter that marks a function as variadic. + DISubprogram SP(Scope->getScopeNode()); + assert(SP.Verify()); + DIArray FnArgs = SP.getType().getTypeArray(); + if (FnArgs.getElement(FnArgs.getNumElements()-1).isUnspecifiedParameter()) { + DIE *Ellipsis = new DIE(dwarf::DW_TAG_unspecified_parameters); + Children.push_back(Ellipsis); + } + } + // Collect lexical scope children first. const SmallVectorImpl &Variables =ScopeVariables.lookup(Scope); for (unsigned i = 0, N = Variables.size(); i < N; ++i) Copied: stable/10/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff (from r264828, head/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff Tue Jul 22 23:16:28 2014 (r269000, copy of r264828, head/contrib/llvm/patches/patch-r264826-llvm-r202188-variadic-fn-debug-info.diff) @@ -0,0 +1,176 @@ +Merge LLVM r202188: + + Debug info: Support variadic functions. + Variadic functions have an unspecified parameter tag after the last + argument. In IR this is represented as an unspecified parameter in the + subroutine type. + + Paired commit with CFE r202185. + + rdar://problem/13690847 + + This re-applies r202184 + a bugfix in DwarfDebug's argument handling. + +This merge includes a change to use the LLVM 3.4 API in +lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp: + +DwarfUnit -> CompileUnit + +Sponsored by: DARPA, AFRL + +http://svnweb.freebsd.org/changeset/base/264826 + +Index: include/llvm/DIBuilder.h +=================================================================== +--- include/llvm/DIBuilder.h (revision 264825) ++++ include/llvm/DIBuilder.h (revision 264826) +@@ -439,7 +439,7 @@ + /// through debug info anchors. + void retainType(DIType T); + +- /// createUnspecifiedParameter - Create unspeicified type descriptor ++ /// createUnspecifiedParameter - Create unspecified type descriptor + /// for a subroutine type. + DIDescriptor createUnspecifiedParameter(); + +Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp +=================================================================== +--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp (revision 264825) ++++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp (revision 264826) +@@ -404,15 +404,21 @@ + DIArray Args = SPTy.getTypeArray(); + uint16_t SPTag = SPTy.getTag(); + if (SPTag == dwarf::DW_TAG_subroutine_type) ++ // FIXME: Use DwarfUnit::constructSubprogramArguments() here. + for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) { +- DIE *Arg = ++ DIType ATy(Args.getElement(i)); ++ if (ATy.isUnspecifiedParameter()) { ++ assert(i == N-1 && "ellipsis must be the last argument"); ++ SPCU->createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, *SPDie); ++ } else { ++ DIE *Arg = + SPCU->createAndAddDIE(dwarf::DW_TAG_formal_parameter, *SPDie); +- DIType ATy(Args.getElement(i)); +- SPCU->addType(Arg, ATy); +- if (ATy.isArtificial()) +- SPCU->addFlag(Arg, dwarf::DW_AT_artificial); +- if (ATy.isObjectPointer()) +- SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg); ++ SPCU->addType(Arg, ATy); ++ if (ATy.isArtificial()) ++ SPCU->addFlag(Arg, dwarf::DW_AT_artificial); ++ if (ATy.isObjectPointer()) ++ SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg); ++ } + } + DIE *SPDeclDie = SPDie; + SPDie = +@@ -579,7 +585,7 @@ + DIE *ObjectPointer = NULL; + + // Collect arguments for current function. +- if (LScopes.isCurrentFunctionScope(Scope)) ++ if (LScopes.isCurrentFunctionScope(Scope)) { + for (unsigned i = 0, N = CurrentFnArguments.size(); i < N; ++i) + if (DbgVariable *ArgDV = CurrentFnArguments[i]) + if (DIE *Arg = +@@ -588,6 +594,16 @@ + if (ArgDV->isObjectPointer()) ObjectPointer = Arg; + } + ++ // Create the unspecified parameter that marks a function as variadic. ++ DISubprogram SP(Scope->getScopeNode()); ++ assert(SP.Verify()); ++ DIArray FnArgs = SP.getType().getTypeArray(); ++ if (FnArgs.getElement(FnArgs.getNumElements()-1).isUnspecifiedParameter()) { ++ DIE *Ellipsis = new DIE(dwarf::DW_TAG_unspecified_parameters); ++ Children.push_back(Ellipsis); ++ } ++ } ++ + // Collect lexical scope children first. + const SmallVectorImpl &Variables =ScopeVariables.lookup(Scope); + for (unsigned i = 0, N = Variables.size(); i < N; ++i) +Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +=================================================================== +--- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (revision 264825) ++++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (revision 264826) +@@ -1116,6 +1116,22 @@ + addSourceLine(&Buffer, DTy); + } + ++/// constructSubprogramArguments - Construct function argument DIEs. ++void CompileUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) { ++ for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) { ++ DIDescriptor Ty = Args.getElement(i); ++ if (Ty.isUnspecifiedParameter()) { ++ assert(i == N-1 && "ellipsis must be the last argument"); ++ createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer); ++ } else { ++ DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, Buffer); ++ addType(Arg, DIType(Ty)); ++ if (DIType(Ty).isArtificial()) ++ addFlag(Arg, dwarf::DW_AT_artificial); ++ } ++ } ++} ++ + /// Return true if the type is appropriately scoped to be contained inside + /// its own type unit. + static bool isTypeUnitScoped(DIType Ty, const DwarfDebug *DD) { +@@ -1170,19 +1186,12 @@ + addType(&Buffer, RTy); + + bool isPrototyped = true; +- // Add arguments. +- for (unsigned i = 1, N = Elements.getNumElements(); i < N; ++i) { +- DIDescriptor Ty = Elements.getElement(i); +- if (Ty.isUnspecifiedParameter()) { +- createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer); +- isPrototyped = false; +- } else { +- DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, Buffer); +- addType(Arg, DIType(Ty)); +- if (DIType(Ty).isArtificial()) +- addFlag(Arg, dwarf::DW_AT_artificial); +- } +- } ++ if (Elements.getNumElements() == 2 && ++ Elements.getElement(1).isUnspecifiedParameter()) ++ isPrototyped = false; ++ ++ constructSubprogramArguments(Buffer, Elements); ++ + // Add prototype flag if we're dealing with a C language and the + // function has been prototyped. + uint16_t Language = getLanguage(); +@@ -1475,13 +1484,7 @@ + + // Add arguments. Do not add arguments for subprogram definition. They will + // be handled while processing variables. +- for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) { +- DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, *SPDie); +- DIType ATy(Args.getElement(i)); +- addType(Arg, ATy); +- if (ATy.isArtificial()) +- addFlag(Arg, dwarf::DW_AT_artificial); +- } ++ constructSubprogramArguments(*SPDie, Args); + } + + if (SP.isArtificial()) +Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +=================================================================== +--- lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (revision 264825) ++++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (revision 264826) +@@ -342,6 +342,9 @@ + void emitHeader(const MCSection *ASection, const MCSymbol *ASectionSym); + + private: ++ /// constructSubprogramArguments - Construct function argument DIEs. ++ void constructSubprogramArguments(DIE &Buffer, DIArray Args); ++ + /// constructTypeDIE - Construct basic type die from DIBasicType. + void constructTypeDIE(DIE &Buffer, DIBasicType BTy); + Copied: stable/10/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff (from r264828, head/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff Tue Jul 22 23:16:28 2014 (r269000, copy of r264828, head/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff) @@ -0,0 +1,74 @@ +Merge Clang r202185: + + Debug info: Generate debug info for variadic functions. + Paired commit with LLVM. + + rdar://problem/13690847 + +This merege includes changes to use the Clang 3.4 API (revisions +199686 and 200082) in lib/CodeGen/CGDebugInfo.cpp: + +getParamType -> getArgType +getNumParams -> getNumArgs +getReturnType -> getResultType + +Sponsored by: DARPA, AFRL + +http://svnweb.freebsd.org/changeset/base/264827 + +Index: tools/clang/lib/CodeGen/CGDebugInfo.cpp +=================================================================== +--- tools/clang/lib/CodeGen/CGDebugInfo.cpp (revision 264826) ++++ tools/clang/lib/CodeGen/CGDebugInfo.cpp (revision 264827) +@@ -37,7 +37,7 @@ + #include "llvm/IR/Module.h" + #include "llvm/Support/Dwarf.h" + #include "llvm/Support/FileSystem.h" +-#include "llvm/Support/Path.h" ++#include "llvm/Support/Path.h" + using namespace clang; + using namespace clang::CodeGen; + +@@ -342,9 +342,9 @@ + if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) { + MainFileDir = MainFile->getDir()->getName(); + if (MainFileDir != ".") { +- llvm::SmallString<1024> MainFileDirSS(MainFileDir); +- llvm::sys::path::append(MainFileDirSS, MainFileName); +- MainFileName = MainFileDirSS.str(); ++ llvm::SmallString<1024> MainFileDirSS(MainFileDir); ++ llvm::sys::path::append(MainFileDirSS, MainFileName); ++ MainFileName = MainFileDirSS.str(); + } + } + +@@ -760,6 +760,8 @@ + else if (const FunctionProtoType *FPT = dyn_cast(Ty)) { + for (unsigned i = 0, e = FPT->getNumArgs(); i != e; ++i) + EltTys.push_back(getOrCreateType(FPT->getArgType(i), Unit)); ++ if (FPT->isVariadic()) ++ EltTys.push_back(DBuilder.createUnspecifiedParameter()); + } + + llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys); +@@ -2420,6 +2422,20 @@ + llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(Elts); + return DBuilder.createSubroutineType(F, EltTypeArray); + } ++ ++ // Variadic function. ++ if (const FunctionDecl *FD = dyn_cast(D)) ++ if (FD->isVariadic()) { ++ SmallVector EltTys; ++ EltTys.push_back(getOrCreateType(FD->getResultType(), F)); ++ if (const FunctionProtoType *FPT = dyn_cast(FnType)) ++ for (unsigned i = 0, e = FPT->getNumArgs(); i != e; ++i) ++ EltTys.push_back(getOrCreateType(FPT->getArgType(i), F)); ++ EltTys.push_back(DBuilder.createUnspecifiedParameter()); ++ llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys); ++ return DBuilder.createSubroutineType(F, EltTypeArray); ++ } ++ + return llvm::DICompositeType(getOrCreateType(FnType, F)); + } + Modified: stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp ============================================================================== --- stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Tue Jul 22 23:10:12 2014 (r268999) +++ stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Tue Jul 22 23:16:28 2014 (r269000) @@ -37,7 +37,7 @@ #include "llvm/IR/Module.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/FileSystem.h" -#include "llvm/Support/Path.h" +#include "llvm/Support/Path.h" using namespace clang; using namespace clang::CodeGen; @@ -342,9 +342,9 @@ void CGDebugInfo::CreateCompileUnit() { if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) { MainFileDir = MainFile->getDir()->getName(); if (MainFileDir != ".") { - llvm::SmallString<1024> MainFileDirSS(MainFileDir); - llvm::sys::path::append(MainFileDirSS, MainFileName); - MainFileName = MainFileDirSS.str(); + llvm::SmallString<1024> MainFileDirSS(MainFileDir); + llvm::sys::path::append(MainFileDirSS, MainFileName); + MainFileName = MainFileDirSS.str(); } } @@ -760,6 +760,8 @@ llvm::DIType CGDebugInfo::CreateType(con else if (const FunctionProtoType *FPT = dyn_cast(Ty)) { for (unsigned i = 0, e = FPT->getNumArgs(); i != e; ++i) EltTys.push_back(getOrCreateType(FPT->getArgType(i), Unit)); + if (FPT->isVariadic()) + EltTys.push_back(DBuilder.createUnspecifiedParameter()); } llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys); @@ -2420,6 +2422,20 @@ llvm::DICompositeType CGDebugInfo::getOr llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(Elts); return DBuilder.createSubroutineType(F, EltTypeArray); } + + // Variadic function. + if (const FunctionDecl *FD = dyn_cast(D)) + if (FD->isVariadic()) { + SmallVector EltTys; + EltTys.push_back(getOrCreateType(FD->getResultType(), F)); + if (const FunctionProtoType *FPT = dyn_cast(FnType)) + for (unsigned i = 0, e = FPT->getNumArgs(); i != e; ++i) + EltTys.push_back(getOrCreateType(FPT->getArgType(i), F)); + EltTys.push_back(DBuilder.createUnspecifiedParameter()); + llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys); + return DBuilder.createSubroutineType(F, EltTypeArray); + } + return llvm::DICompositeType(getOrCreateType(FnType, F)); } From owner-svn-src-stable@FreeBSD.ORG Wed Jul 23 00:35:08 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 790BFC43; Wed, 23 Jul 2014 00:35:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 635B22912; Wed, 23 Jul 2014 00:35:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6N0Z8Qf001984; Wed, 23 Jul 2014 00:35:08 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6N0Z6s7001973; Wed, 23 Jul 2014 00:35:06 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407230035.s6N0Z6s7001973@svn.freebsd.org> From: Xin LI Date: Wed, 23 Jul 2014 00:35:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269002 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jul 2014 00:35:08 -0000 Author: delphij Date: Wed Jul 23 00:35:06 2014 New Revision: 269002 URL: http://svnweb.freebsd.org/changeset/base/269002 Log: MFC r268464: MFV r268452: Explicitly mark file removal transactions as "presumed to result in a net free of space" so they will not fail with ENOSPC. Illumos issue: 4950 files sometimes can't be removed from a full filesystem Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Jul 22 23:29:54 2014 (r269001) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Jul 23 00:35:06 2014 (r269002) @@ -673,6 +673,12 @@ dmu_free_long_range_impl(objset_t *os, d dmu_tx_t *tx = dmu_tx_create(os); dmu_tx_hold_free(tx, dn->dn_object, chunk_begin, chunk_end - chunk_begin); + + /* + * Mark this transaction as typically resulting in a net + * reduction in space used. + */ + dmu_tx_mark_netfree(tx); err = dmu_tx_assign(tx, TXG_WAIT); if (err) { dmu_tx_abort(tx); @@ -724,6 +730,7 @@ dmu_free_long_object(objset_t *os, uint6 tx = dmu_tx_create(os); dmu_tx_hold_bonus(tx, object); dmu_tx_hold_free(tx, object, 0, DMU_OBJECT_END); + dmu_tx_mark_netfree(tx); err = dmu_tx_assign(tx, TXG_WAIT); if (err == 0) { err = dmu_object_free(os, object, tx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Tue Jul 22 23:29:54 2014 (r269001) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Jul 23 00:35:06 2014 (r269002) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -583,6 +583,32 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, ui txh->txh_space_tounref += unref; } +/* + * This function marks the transaction as being a "net free". The end + * result is that refquotas will be disabled for this transaction, and + * this transaction will be able to use half of the pool space overhead + * (see dsl_pool_adjustedsize()). Therefore this function should only + * be called for transactions that we expect will not cause a net increase + * in the amount of space used (but it's OK if that is occasionally not true). + */ +void +dmu_tx_mark_netfree(dmu_tx_t *tx) +{ + dmu_tx_hold_t *txh; + + txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, + DMU_NEW_OBJECT, THT_FREE, 0, 0); + + /* + * Pretend that this operation will free 1GB of space. This + * should be large enough to cancel out the largest write. + * We don't want to use something like UINT64_MAX, because that would + * cause overflows when doing math with these values (e.g. in + * dmu_tx_try_assign()). + */ + txh->txh_space_tofree = txh->txh_space_tounref = 1024 * 1024 * 1024; +} + void dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Tue Jul 22 23:29:54 2014 (r269001) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Jul 23 00:35:06 2014 (r269002) @@ -569,6 +569,7 @@ void dmu_tx_abort(dmu_tx_t *tx); int dmu_tx_assign(dmu_tx_t *tx, enum txg_how txg_how); void dmu_tx_wait(dmu_tx_t *tx); void dmu_tx_commit(dmu_tx_t *tx); +void dmu_tx_mark_netfree(dmu_tx_t *tx); /* * To register a commit callback, dmu_tx_callback_register() must be called. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Jul 22 23:29:54 2014 (r269001) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Wed Jul 23 00:35:06 2014 (r269002) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. */ #include @@ -559,6 +559,7 @@ zfs_purgedir(znode_t *dzp) dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); /* Is this really needed ? */ zfs_sa_upgrade_txholds(tx, xzp); + dmu_tx_mark_netfree(tx); error = dmu_tx_assign(tx, TXG_WAIT); if (error) { dmu_tx_abort(tx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jul 22 23:29:54 2014 (r269001) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Jul 23 00:35:06 2014 (r269002) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ @@ -1558,7 +1558,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode * cr - credentials of caller. * flag - large file flag [UNUSED]. * ct - caller context - * vsecp - ACL to be set + * vsecp - ACL to be set * * OUT: vpp - vnode of created or trunc'd entry. * @@ -1840,7 +1840,7 @@ zfs_remove(vnode_t *dvp, char *name, cre zfsvfs_t *zfsvfs = dzp->z_zfsvfs; zilog_t *zilog; uint64_t acl_obj, xattr_obj; - uint64_t xattr_obj_unlinked = 0; + uint64_t xattr_obj_unlinked = 0; uint64_t obj = 0; zfs_dirlock_t *dl; dmu_tx_t *tx; @@ -1940,6 +1940,14 @@ top: /* charge as an update -- would be nice not to charge at all */ dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); + /* + * Mark this transaction as typically resulting in a net free of + * space, unless object removal will be delayed indefinitely + * (due to active holds on the vnode due to the file being open). + */ + if (may_delete_now) + dmu_tx_mark_netfree(tx); + error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); @@ -1970,7 +1978,6 @@ top: } if (unlinked) { - /* * Hold z_lock so that we can make sure that the ACL obj * hasn't changed. Could have been deleted due to @@ -5039,13 +5046,13 @@ zfs_addmap(vnode_t *vp, offset_t off, st * last page is pushed. The problem occurs when the msync() call is omitted, * which by far the most common case: * - * open() - * mmap() - * - * munmap() - * close() - *