From owner-svn-src-stable@freebsd.org Mon Dec 3 04:07:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79FAC1314A62; Mon, 3 Dec 2018 04:07:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E3DE6FAF5; Mon, 3 Dec 2018 04:07:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECF4F10B29; Mon, 3 Dec 2018 04:07:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB347JIb086698; Mon, 3 Dec 2018 04:07:19 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB347J9g086694; Mon, 3 Dec 2018 04:07:19 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201812030407.wB347J9g086694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 3 Dec 2018 04:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341421 - in stable/12/stand/i386: common gptboot zfsboot X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/12/stand/i386: common gptboot zfsboot X-SVN-Commit-Revision: 341421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E3DE6FAF5 X-Spamd-Result: default: False [0.41 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.06)[-0.058,0]; NEURAL_SPAM_SHORT(0.41)[0.407,0]; NEURAL_SPAM_LONG(0.06)[0.057,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 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, 03 Dec 2018 04:07:20 -0000 Author: ian Date: Mon Dec 3 04:07:18 2018 New Revision: 341421 URL: https://svnweb.freebsd.org/changeset/base/341421 Log: MFC r341071, r341160 r341071: Restore the ability to override the disk unit/partition at the boot: prompt in gptboot. When arch-independent geli support was added, a new static 'gdsk' struct was added, but there was still a static 'dsk' struct, and when you typed in an alternate disk/partition, the string was parsed into that struct, which was then never used for anything. Now the string gets parsed into gdsk.dsk, the struct that's actually used. r341160: Add comments describing the bootargs handoff between loader(8) and gptboot or zfsboot, when loader(8) is the BTX loader. No functional changes. Modified: stable/12/stand/i386/common/bootargs.h stable/12/stand/i386/gptboot/gptboot.c stable/12/stand/i386/zfsboot/zfsboot.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/i386/common/bootargs.h ============================================================================== --- stable/12/stand/i386/common/bootargs.h Mon Dec 3 03:58:30 2018 (r341420) +++ stable/12/stand/i386/common/bootargs.h Mon Dec 3 04:07:18 2018 (r341421) @@ -43,6 +43,24 @@ #ifndef __ASSEMBLER__ +/* + * This struct describes the contents of the stack on entry to btxldr.S. This + * is the data that follows the return address, so it begins at 4(%esp). On + * the sending side, this data is passed as individual args to __exec(). On the + * receiving side, code in btxldr.S copies the data from the entry stack to a + * known fixed location in the new address space. Then, btxcsu.S sets the + * global variable __args to point to that known fixed location before calling + * main(), which casts __args to a struct bootargs pointer to access the data. + * The btxldr.S code is aware of KARGS_FLAGS_EXTARG, and if it's set, the extra + * args data is copied along with the other bootargs from the entry stack to the + * fixed location in the new address space. + * + * The bootinfo field is actually a pointer to a bootinfo struct that has been + * converted to uint32_t using VTOP(). On the receiving side it must be + * converted back to a pointer using PTOV(). Code in btxldr.S is aware of this + * field and if it's non-NULL it copies the data it points to into another known + * fixed location, and adjusts the bootinfo field to point to that new location. + */ struct bootargs { uint32_t howto; Modified: stable/12/stand/i386/gptboot/gptboot.c ============================================================================== --- stable/12/stand/i386/gptboot/gptboot.c Mon Dec 3 03:58:30 2018 (r341420) +++ stable/12/stand/i386/gptboot/gptboot.c Mon Dec 3 04:07:18 2018 (r341421) @@ -81,7 +81,6 @@ uint32_t opts; static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; static const unsigned char dev_maj[NDEV] = {30, 4, 2}; -static struct dsk dsk; static char kname[1024]; static int comspeed = SIOSPD; static struct bootinfo bootinfo; @@ -488,6 +487,12 @@ load(void) geliargs.keybuf_sentinel = KEYBUF_SENTINEL; geliargs.keybuf = gelibuf; #endif + /* + * Note that the geliargs struct is passed by value, not by pointer. + * Code in btxldr.S copies the values from the entry stack to a fixed + * location within loader(8) at startup due to the presence of the + * KARGS_FLAGS_EXTARG flag. + */ __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), MAKEBOOTDEV(dev_maj[gdsk.dsk.type], gdsk.dsk.part + 1, gdsk.dsk.unit, 0xff), #ifdef LOADER_GELI_SUPPORT @@ -569,22 +574,22 @@ parse_cmds(char *cmdstr, int *dskupdated) arg[1] != dev_nm[i][1]; i++) if (i == NDEV - 1) return (-1); - dsk.type = i; + gdsk.dsk.type = i; arg += 3; - dsk.unit = *arg - '0'; - if (arg[1] != 'p' || dsk.unit > 9) + gdsk.dsk.unit = *arg - '0'; + if (arg[1] != 'p' || gdsk.dsk.unit > 9) return (-1); arg += 2; - dsk.part = *arg - '0'; - if (dsk.part < 1 || dsk.part > 9) + gdsk.dsk.part = *arg - '0'; + if (gdsk.dsk.part < 1 || gdsk.dsk.part > 9) return (-1); arg++; if (arg[0] != ')') return (-1); arg++; if (drv == -1) - drv = dsk.unit; - dsk.drive = (dsk.type <= TYPE_MAXHARD + drv = gdsk.dsk.unit; + gdsk.dsk.drive = (gdsk.dsk.type <= TYPE_MAXHARD ? DRV_HARD : 0) + drv; *dskupdated = 1; } Modified: stable/12/stand/i386/zfsboot/zfsboot.c ============================================================================== --- stable/12/stand/i386/zfsboot/zfsboot.c Mon Dec 3 03:58:30 2018 (r341420) +++ stable/12/stand/i386/zfsboot/zfsboot.c Mon Dec 3 04:07:18 2018 (r341421) @@ -1005,6 +1005,11 @@ load(void) zfsargs.primary_vdev = primary_vdev->v_guid; else printf("failed to detect primary vdev\n"); + /* + * Note that the zfsargs struct is passed by value, not by pointer. Code in + * btxldr.S copies the values from the entry stack to a fixed location + * within loader(8) at startup due to the presence of KARGS_FLAGS_EXTARG. + */ __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), bootdev, KARGS_FLAGS_ZFS | KARGS_FLAGS_EXTARG,