Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Feb 2016 01:42:51 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r295423 - in projects/release-pkg: lib/libc/gen lib/libc/include lib/libc/sys lib/libthr lib/libthr/thread share/examples/jails sys/boot sys/boot/efi/loader sys/boot/efi/loader/arch/arm...
Message-ID:  <201602090142.u191gpTk019645@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Tue Feb  9 01:42:51 2016
New Revision: 295423
URL: https://svnweb.freebsd.org/changeset/base/295423

Log:
  MFH
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/release-pkg/lib/libc/gen/elf_utils.c
  projects/release-pkg/lib/libc/include/libc_private.h
  projects/release-pkg/lib/libc/sys/interposing_table.c
  projects/release-pkg/lib/libthr/pthread.map
  projects/release-pkg/lib/libthr/thread/thr_private.h
  projects/release-pkg/lib/libthr/thread/thr_stack.c
  projects/release-pkg/lib/libthr/thread/thr_syscalls.c
  projects/release-pkg/share/examples/jails/jib
  projects/release-pkg/share/examples/jails/jng
  projects/release-pkg/sys/boot/Makefile.inc
  projects/release-pkg/sys/boot/efi/loader/arch/arm/ldscript.arm
  projects/release-pkg/sys/boot/efi/loader/main.c
  projects/release-pkg/sys/boot/ficl/words.c
  projects/release-pkg/sys/boot/i386/Makefile
  projects/release-pkg/sys/cam/scsi/scsi_xpt.c
  projects/release-pkg/sys/conf/kmod.mk
  projects/release-pkg/sys/kern/init_main.c
  projects/release-pkg/sys/kern/kern_fork.c
  projects/release-pkg/targets/pseudo/userland/misc/Makefile.depend
Directory Properties:
  projects/release-pkg/   (props changed)
  projects/release-pkg/lib/libc/   (props changed)
  projects/release-pkg/share/   (props changed)
  projects/release-pkg/sys/   (props changed)
  projects/release-pkg/sys/boot/   (props changed)
  projects/release-pkg/sys/conf/   (props changed)
  projects/release-pkg/targets/   (props changed)

Modified: projects/release-pkg/lib/libc/gen/elf_utils.c
==============================================================================
--- projects/release-pkg/lib/libc/gen/elf_utils.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/lib/libc/gen/elf_utils.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -32,6 +32,7 @@
 #include <sys/sysctl.h>
 #include <link.h>
 #include <stddef.h>
+#include "libc_private.h"
 
 int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
 void __pthread_map_stacks_exec(void);
@@ -54,9 +55,8 @@ __elf_phdr_match_addr(struct dl_phdr_inf
 	return (i != phdr_info->dlpi_phnum);
 }
 
-#pragma weak __pthread_map_stacks_exec
 void
-__pthread_map_stacks_exec(void)
+__libc_map_stacks_exec(void)
 {
 	int mib[2];
 	struct rlimit rlim;
@@ -75,3 +75,10 @@ __pthread_map_stacks_exec(void)
 	    rlim.rlim_cur, _rtld_get_stack_prot());
 }
 
+#pragma weak __pthread_map_stacks_exec
+void
+__pthread_map_stacks_exec(void)
+{
+
+	((void (*)(void))__libc_interposing[INTERPOS_map_stacks_exec])();
+}

Modified: projects/release-pkg/lib/libc/include/libc_private.h
==============================================================================
--- projects/release-pkg/lib/libc/include/libc_private.h	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/lib/libc/include/libc_private.h	Tue Feb  9 01:42:51 2016	(r295423)
@@ -224,6 +224,7 @@ enum {
 	INTERPOS_kevent,
 	INTERPOS_wait6,
 	INTERPOS_ppoll,
+	INTERPOS_map_stacks_exec,
 	INTERPOS_MAX
 };
 
@@ -381,6 +382,7 @@ int _elf_aux_info(int aux, void *buf, in
 struct dl_phdr_info;
 int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
 void __init_elf_aux_vector(void);
+void __libc_map_stacks_exec(void);
 
 void	_pthread_cancel_enter(int);
 void	_pthread_cancel_leave(int);

Modified: projects/release-pkg/lib/libc/sys/interposing_table.c
==============================================================================
--- projects/release-pkg/lib/libc/sys/interposing_table.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/lib/libc/sys/interposing_table.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -78,6 +78,7 @@ interpos_func_t __libc_interposing[INTER
 	SLOT(kevent, __sys_kevent),
 	SLOT(wait6, __sys_wait6),
 	SLOT(ppoll, __sys_ppoll),
+	SLOT(map_stacks_exec, __libc_map_stacks_exec),
 };
 #undef SLOT
 

Modified: projects/release-pkg/lib/libthr/pthread.map
==============================================================================
--- projects/release-pkg/lib/libthr/pthread.map	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/lib/libthr/pthread.map	Tue Feb  9 01:42:51 2016	(r295423)
@@ -295,8 +295,6 @@ FBSDprivate_1.0 {
 	_thread_size_key;
 	_thread_state_running;
 	_thread_state_zoombie;
-
-	__pthread_map_stacks_exec;
 };
 
 FBSD_1.1 {

Modified: projects/release-pkg/lib/libthr/thread/thr_private.h
==============================================================================
--- projects/release-pkg/lib/libthr/thread/thr_private.h	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/lib/libthr/thread/thr_private.h	Tue Feb  9 01:42:51 2016	(r295423)
@@ -927,6 +927,8 @@ int __thr_sigwait(const sigset_t *set, i
 int __thr_sigwaitinfo(const sigset_t *set, siginfo_t *info);
 int __thr_swapcontext(ucontext_t *oucp, const ucontext_t *ucp);
 
+void __thr_map_stacks_exec(void);
+
 struct _spinlock;
 void __thr_spinunlock(struct _spinlock *lck);
 void __thr_spinlock(struct _spinlock *lck);

Modified: projects/release-pkg/lib/libthr/thread/thr_stack.c
==============================================================================
--- projects/release-pkg/lib/libthr/thread/thr_stack.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/lib/libthr/thread/thr_stack.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -161,9 +161,8 @@ singlethread_map_stacks_exec(void)
 	    rlim.rlim_cur, _rtld_get_stack_prot());
 }
 
-void __pthread_map_stacks_exec(void);
 void
-__pthread_map_stacks_exec(void)
+__thr_map_stacks_exec(void)
 {
 	struct pthread *curthread, *thrd;
 	struct stack *st;

Modified: projects/release-pkg/lib/libthr/thread/thr_syscalls.c
==============================================================================
--- projects/release-pkg/lib/libthr/thread/thr_syscalls.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/lib/libthr/thread/thr_syscalls.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -652,6 +652,7 @@ __thr_interpose_libc(void)
 	SLOT(kevent);
 	SLOT(wait6);
 	SLOT(ppoll);
+	SLOT(map_stacks_exec);
 #undef SLOT
 	*(__libc_interposing_slot(
 	    INTERPOS__pthread_mutex_init_calloc_cb)) =

Modified: projects/release-pkg/share/examples/jails/jib
==============================================================================
--- projects/release-pkg/share/examples/jails/jib	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/share/examples/jails/jib	Tue Feb  9 01:42:51 2016	(r295423)
@@ -33,7 +33,11 @@
 ############################################################ INFORMATION
 #
 # Use this tool with jail.conf(5) (or rc.conf(5) ``legacy'' configuration) to
-# manage `vnet' interfaces. In jail.conf(5) format:
+# manage `vnet' interfaces for jails. Designed to automate the creation of vnet
+# interface(s) during jail `prestart' and destroy said interface(s) during jail
+# `poststop'.
+#
+# In jail.conf(5) format:
 #
 # ### BEGIN EXCERPT ###
 #
@@ -223,32 +227,37 @@ jib_addm()
 		# 6. Set the MAC address of the new interface using a sensible
 		# algorithm to prevent conflicts on the network.
 		#
-		# The formula I'm using is ``SP:SS:SI:II:II:II'' where:
-		# + S denotes 16 bits of sum(1) data, split because P (below).
+		# The formula I'm using is ``NP:SS:SS:II:II:II'' where:
+		# + N denotes 4 bits used as a counter to support branching
+		#   each parent interface up to 15 times under the same jail
+		#   name (see S below).
 		# + P denotes the special nibble whose value, if one of
 		#   2, 6, A, or E (but usually 2) denotes a privately
 		#   administered MAC address (while remaining routable).
+		# + S denotes 16 bits, the sum(1) value of the jail name.
 		# + I denotes bits that are inherited from parent interface.
 		#
 		# The S bits are a CRC-16 checksum of NAME, allowing the jail
 		# to change the epair(4) generation order without affecting the
-		# MAC address. Meanwhile, if the jail NAME changes (e.g., it
-		# was duplicated and given a new name with no other changes),
-		# the underlying network interface changes, or the jail is
-		# moved to another host, the MAC address will be recalculated
-		# to a new, similarly unique value preventing conflict.
+		# MAC address. Meanwhile, if...
+		#   + the jail NAME changes (e.g., it was duplicated and given
+		#     a new name with no other changes)
+		#   + the underlying network interface changes
+		#   + the jail is moved to another host
+		# the MAC address will be recalculated to a new, similarly
+		# unique value preventing conflict.
 		#
 		iface_devid=$( ifconfig $iface ether | awk '/ether/,$0=$2' )
-		eiface_devid_a=${iface_devid#??:??:?}
-		eiface_devid_b=${iface_devid#??:??:?}
+		eiface_devid_a=${iface_devid#??:??:??}
+		eiface_devid_b=${iface_devid#??:??:??}
 		num=$( set -- `echo -n $name | sum` && echo $1 )
 		quad=$(( $num & 15 ))
 		case "$quad" in
 		10) quad=a ;; 11) quad=b ;; 12) quad=c ;;
 		13) quad=d ;; 14) quad=e ;; 15) quad=f ;;
 		esac
-		eiface_devid_a=:$quad$eiface_devid_a
-		eiface_devid_b=:$quad$eiface_devid_b
+		eiface_devid_a=$quad$eiface_devid_a
+		eiface_devid_b=$quad$eiface_devid_b
 		num=$(( $num >> 4 ))
 		quad=$(( $num & 15 ))
 		case "$quad" in
@@ -263,27 +272,49 @@ jib_addm()
 		10) quad=a ;; 11) quad=b ;; 12) quad=c ;;
 		13) quad=d ;; 14) quad=e ;; 15) quad=f ;;
 		esac
-		eiface_devid_a=2:$quad$eiface_devid_a
-		eiface_devid_b=6:$quad$eiface_devid_b
+		eiface_devid_a=$quad:$eiface_devid_a
+		eiface_devid_b=$quad:$eiface_devid_b
 		num=$(( $num >> 4 ))
 		quad=$(( $num & 15 ))
 		case "$quad" in
 		10) quad=a ;; 11) quad=b ;; 12) quad=c ;;
 		13) quad=d ;; 14) quad=e ;; 15) quad=f ;;
 		esac
+		case "$iface_devid" in
+		?2:*|?6:*)
+			eiface_devid_a=a:$quad$eiface_devid_a
+			eiface_devid_b=e:$quad$eiface_devid_b
+			;;
+		*)
+			eiface_devid_a=2:$quad$eiface_devid_a
+			eiface_devid_b=6:$quad$eiface_devid_b
+		esac
+		eval num=\$_${iface}_num
+		if [ "$num" ]; then
+			num=$(( $num + 1 ))
+			eval _${iface}_num=$num
+		else
+			num=0
+			local _${iface}_num=$num
+		fi
+		quad=$(( $num & 15 ))
+		case "$quad" in
+		10) quad=a ;; 11) quad=b ;; 12) quad=c ;;
+		13) quad=d ;; 14) quad=e ;; 15) quad=f ;;
+		esac
 		eiface_devid_a=$quad$eiface_devid_a
 		eiface_devid_b=$quad$eiface_devid_b
 		ifconfig "e${i}a_$name" ether $eiface_devid_a > /dev/null 2>&1
 		ifconfig "e${i}b_$name" ether $eiface_devid_b > /dev/null 2>&1
 
-		i=$(( $i + 1 )) # on to next ng{i}_name
+		i=$(( $i + 1 )) # on to next e{i}b_name
 	done # for iface
 }
 
 jib_show_usage="show"
 jib_show_descr="List possible NAME values for \`show NAME'"
 jib_show1_usage="show NAME"
-jib_show1_descr="Lists ng0_NAME [ng1_NAME ...]"
+jib_show1_descr="Lists e0b_NAME [e1b_NAME ...]"
 jib_show2_usage="show [NAME]"
 jib_show()
 {

Modified: projects/release-pkg/share/examples/jails/jng
==============================================================================
--- projects/release-pkg/share/examples/jails/jng	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/share/examples/jails/jng	Tue Feb  9 01:42:51 2016	(r295423)
@@ -33,7 +33,11 @@
 ############################################################ INFORMATION
 #
 # Use this tool with jail.conf(5) (or rc.conf(5) ``legacy'' configuration) to
-# manage `vnet' interfaces. In jail.conf(5) format:
+# manage `vnet' interfaces for jails. Designed to automate the creation of vnet
+# interface(s) during jail `prestart' and destroy said interface(s) during jail
+# `poststop'.
+#
+# In jail.conf(5) format:
 #
 # ### BEGIN EXCERPT ###
 #
@@ -256,30 +260,35 @@ jng_bridge()
 		# 6. Set the MAC address of the new interface using a sensible
 		# algorithm to prevent conflicts on the network.
 		#
-		# The formula I'm using is ``SP:SS:SI:II:II:II'' where:
-		# + S denotes 16 bits of sum(1) data, split because P (below).
+		# The formula I'm using is ``NP:SS:SS:II:II:II'' where:
+		# + N denotes 4 bits used as a counter to support branching
+		#   each parent interface up to 15 times under the same jail
+		#   name (see S below).
 		# + P denotes the special nibble whose value, if one of
 		#   2, 6, A, or E (but usually 2) denotes a privately
 		#   administered MAC address (while remaining routable).
+		# + S denotes 16 bits, the sum(1) value of the jail name.
 		# + I denotes bits that are inherited from parent interface.
 		#
 		# The S bits are a CRC-16 checksum of NAME, allowing the jail
 		# to change link numbers in ng_bridge(4) without affecting the
-		# MAC address. Meanwhile, if the jail NAME changes (e.g., it
-		# was duplicated and given a new name with no other changes),
-		# the underlying network interface changes, or the jail is
-		# moved to another host, the MAC address will be recalculated
-		# to a new, similarly unique value preventing conflict.
+		# MAC address. Meanwhile, if...
+		#   + the jail NAME changes (e.g., it was duplicated and given
+		#     a new name with no other changes)
+		#   + the underlying network interface changes
+		#   + the jail is moved to another host
+		# the MAC address will be recalculated to a new, similarly
+		# unique value preventing conflict.
 		#
 		iface_devid=$( ifconfig $iface ether | awk '/ether/,$0=$2' )
-		eiface_devid=${iface_devid#??:??:?}
+		eiface_devid=${iface_devid#??:??:??}
 		num=$( set -- `echo -n $name | sum` && echo $1 )
 		quad=$(( $num & 15 ))
 		case "$quad" in
 		10) quad=a ;; 11) quad=b ;; 12) quad=c ;;
 		13) quad=d ;; 14) quad=e ;; 15) quad=f ;;
 		esac
-		eiface_devid=:$quad$eiface_devid
+		eiface_devid=$quad$eiface_devid
 		num=$(( $num >> 4 ))
 		quad=$(( $num & 15 ))
 		case "$quad" in
@@ -293,13 +302,30 @@ jng_bridge()
 		10) quad=a ;; 11) quad=b ;; 12) quad=c ;;
 		13) quad=d ;; 14) quad=e ;; 15) quad=f ;;
 		esac
-		eiface_devid=2:$quad$eiface_devid
+		eiface_devid=$quad:$eiface_devid
 		num=$(( $num >> 4 ))
 		quad=$(( $num & 15 ))
 		case "$quad" in
 		10) quad=a ;; 11) quad=b ;; 12) quad=c ;;
 		13) quad=d ;; 14) quad=e ;; 15) quad=f ;;
 		esac
+		case "$iface_devid" in
+		?2:*) eiface_devid=a:$quad$eiface_devid ;;
+		*) eiface_devid=2:$quad$eiface_devid
+		esac
+		eval num=\$_${iface}_num
+		if [ "$num" ]; then
+			num=$(( $num + 1 ))
+			eval _${iface}_num=$num
+		else
+			num=0
+			local _${iface}_num=$num
+		fi
+		quad=$(( $num & 15 ))
+		case "$quad" in
+		10) quad=a ;; 11) quad=b ;; 12) quad=c ;;
+		13) quad=d ;; 14) quad=e ;; 15) quad=f ;;
+		esac
 		eiface_devid=$quad$eiface_devid
 		ifconfig $eiface ether $eiface_devid > /dev/null 2>&1
 

Modified: projects/release-pkg/sys/boot/Makefile.inc
==============================================================================
--- projects/release-pkg/sys/boot/Makefile.inc	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/boot/Makefile.inc	Tue Feb  9 01:42:51 2016	(r295423)
@@ -1,3 +1,11 @@
 # $FreeBSD$
 
 SSP_CFLAGS=
+
+.if ${MACHINE_CPUARCH} == "arm"
+# Do not generate movt/movw, because the relocation fixup for them does not
+# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8).
+# Also, the fpu is not available in a standalone environment.
+CFLAGS.clang+=  -mllvm -arm-use-movt=0
+CFLAGS.clang+=  -mfpu=none
+.endif

Modified: projects/release-pkg/sys/boot/efi/loader/arch/arm/ldscript.arm
==============================================================================
--- projects/release-pkg/sys/boot/efi/loader/arch/arm/ldscript.arm	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/boot/efi/loader/arch/arm/ldscript.arm	Tue Feb  9 01:42:51 2016	(r295423)
@@ -15,7 +15,7 @@ SECTIONS
   } =0
   _etext = .;
   PROVIDE (etext = .);
-  . = ALIGN(4096);
+  . = ALIGN(16);
   .data    :
   {
     *(.data *.data.*)
@@ -24,6 +24,7 @@ SECTIONS
     *(.rodata.*)
     CONSTRUCTORS
 
+    . = ALIGN(4);
     PROVIDE (__bss_start = .);
     *(.sbss)
     *(.scommon)
@@ -31,6 +32,7 @@ SECTIONS
     *(.dynbss)
     *(.bss)
     *(COMMON)
+    . = ALIGN(4);
     PROVIDE (__bss_end = .);
   }
   /* We want the small data sections together, so single-instruction offsets

Modified: projects/release-pkg/sys/boot/efi/loader/main.c
==============================================================================
--- projects/release-pkg/sys/boot/efi/loader/main.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/boot/efi/loader/main.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -66,6 +66,7 @@ EFI_GUID hoblist = HOB_LIST_TABLE_GUID;
 EFI_GUID memtype = MEMORY_TYPE_INFORMATION_TABLE_GUID;
 EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID;
 EFI_GUID fdtdtb = FDT_TABLE_GUID;
+EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL;
 
 #ifdef EFI_ZFS_BOOT
 static void efi_zfs_probe(void);
@@ -94,6 +95,88 @@ cp16to8(const CHAR16 *src, char *dst, si
 		dst[i] = (char)src[i];
 }
 
+static int
+has_keyboard(void)
+{
+	EFI_STATUS status;
+	EFI_DEVICE_PATH *path;
+	EFI_HANDLE *hin, *hin_end, *walker;
+	UINTN sz;
+	int retval = 0;
+	
+	/*
+	 * Find all the handles that support the SIMPLE_TEXT_INPUT_PROTOCOL and
+	 * do the typical dance to get the right sized buffer.
+	 */
+	sz = 0;
+	hin = NULL;
+	status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz, 0);
+	if (status == EFI_BUFFER_TOO_SMALL) {
+		hin = (EFI_HANDLE *)malloc(sz);
+		status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz,
+		    hin);
+		if (EFI_ERROR(status))
+			free(hin);
+	}
+	if (EFI_ERROR(status))
+		return retval;
+
+	/*
+	 * Look at each of the handles. If it supports the device path protocol,
+	 * use it to get the device path for this handle. Then see if that
+	 * device path matches either the USB device path for keyboards or the
+	 * legacy device path for keyboards.
+	 */
+	hin_end = &hin[sz / sizeof(*hin)];
+	for (walker = hin; walker < hin_end; walker++) {
+		status = BS->HandleProtocol(*walker, &devid, (VOID **)&path);
+		if (EFI_ERROR(status))
+			continue;
+
+		while (!IsDevicePathEnd(path)) {
+			/*
+			 * Check for the ACPI keyboard node. All PNP3xx nodes
+			 * are keyboards of different flavors. Note: It is
+			 * unclear of there's always a keyboard node when
+			 * there's a keyboard controller, or if there's only one
+			 * when a keyboard is detected at boot.
+			 */
+			if (DevicePathType(path) == ACPI_DEVICE_PATH &&
+			    (DevicePathSubType(path) == ACPI_DP ||
+				DevicePathSubType(path) == ACPI_EXTENDED_DP)) {
+				ACPI_HID_DEVICE_PATH  *acpi;
+
+				acpi = (ACPI_HID_DEVICE_PATH *)(void *)path;
+				if ((EISA_ID_TO_NUM(acpi->HID) & 0xff00) == 0x300 &&
+				    (acpi->HID & 0xffff) == PNP_EISA_ID_CONST) {
+					retval = 1;
+					goto out;
+				}
+			/*
+			 * Check for USB keyboard node, if present. Unlike a
+			 * PS/2 keyboard, these definitely only appear when
+			 * connected to the system.
+			 */
+			} else if (DevicePathType(path) == MESSAGING_DEVICE_PATH &&
+			    DevicePathSubType(path) == MSG_USB_CLASS_DP) {
+				USB_CLASS_DEVICE_PATH *usb;
+			       
+				usb = (USB_CLASS_DEVICE_PATH *)(void *)path;
+				if (usb->DeviceClass == 3 && /* HID */
+				    usb->DeviceSubClass == 1 && /* Boot devices */
+				    usb->DeviceProtocol == 1) { /* Boot keyboards */
+					retval = 1;
+					goto out;
+				}
+			}
+			path = NextDevicePathNode(path);
+		}
+	}
+out:
+	free(hin);
+	return retval;
+}
+
 EFI_STATUS
 main(int argc, CHAR16 *argv[])
 {
@@ -104,6 +187,7 @@ main(int argc, CHAR16 *argv[])
 	struct devsw *dev;
 	uint64_t pool_guid;
 	UINTN k;
+	int has_kbd;
 
 	archsw.arch_autoload = efi_autoload;
 	archsw.arch_getdev = efi_getdev;
@@ -115,6 +199,8 @@ main(int argc, CHAR16 *argv[])
 	archsw.arch_zfs_probe = efi_zfs_probe;
 #endif
 
+	has_kbd = has_keyboard();
+
 	/*
 	 * XXX Chicken-and-egg problem; we want to have console output
 	 * early, but some console attributes may depend on reading from
@@ -150,15 +236,19 @@ main(int argc, CHAR16 *argv[])
 				case 'D':
 					howto |= RB_MULTIPLE;
 					break;
-				case 'm':
-					howto |= RB_MUTE;
-					break;
 				case 'h':
 					howto |= RB_SERIAL;
 					break;
+				case 'm':
+					howto |= RB_MUTE;
+					break;
 				case 'p':
 					howto |= RB_PAUSE;
 					break;
+				case 'P':
+					if (!has_kbd)
+						howto |= RB_SERIAL | RB_MULTIPLE;
+					break;
 				case 'r':
 					howto |= RB_DFLTROOT;
 					break;

Modified: projects/release-pkg/sys/boot/ficl/words.c
==============================================================================
--- projects/release-pkg/sys/boot/ficl/words.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/boot/ficl/words.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -4822,7 +4822,7 @@ WORDKIND ficlWordClassify(FICL_WORD *pFW
 **************************************************************************/
 static void ficlRandom(FICL_VM *pVM)
 {
-    PUSHINT(rand());
+    PUSHUNS(random());
 }
 
 
@@ -4832,7 +4832,7 @@ static void ficlRandom(FICL_VM *pVM)
 **************************************************************************/
 static void ficlSeedRandom(FICL_VM *pVM)
 {
-    srand(POPINT());
+    srandom(POPUNS());
 }
 #endif
 

Modified: projects/release-pkg/sys/boot/i386/Makefile
==============================================================================
--- projects/release-pkg/sys/boot/i386/Makefile	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/boot/i386/Makefile	Tue Feb  9 01:42:51 2016	(r295423)
@@ -8,6 +8,10 @@ SUBDIR=		mbr pmbr boot0 boot0sio btx boo
 # special boot programs, 'self-extracting boot2+loader'
 SUBDIR+=	pxeldr
 
+.if ${MACHINE_CPUARCH} == "i386"
+SUBDIR+=	kgzldr
+.endif
+
 .if ${MK_ZFS} != "no"
 SUBDIR+=	zfsboot gptzfsboot zfsloader
 .endif

Modified: projects/release-pkg/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- projects/release-pkg/sys/cam/scsi/scsi_xpt.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/cam/scsi/scsi_xpt.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -1518,7 +1518,7 @@ out:
 		} else if (cam_periph_error(done_ccb, 0,
 					    SF_RETRY_UA,
 					    &softc->saved_ccb) == ERESTART) {
-			return;
+			goto outr;
 		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
 			/* Don't wedge the queue */
 			xpt_release_devq(done_ccb->ccb_h.path, /*count*/1,

Modified: projects/release-pkg/sys/conf/kmod.mk
==============================================================================
--- projects/release-pkg/sys/conf/kmod.mk	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/conf/kmod.mk	Tue Feb  9 01:42:51 2016	(r295423)
@@ -249,9 +249,11 @@ _ILINKS+=x86
 .endif
 CLEANFILES+=${_ILINKS}
 
-all: objwarn ${PROG}
+all: beforebuild .WAIT ${PROG}
+beforebuild: objwarn
 
 beforedepend: ${_ILINKS}
+beforebuild: ${_ILINKS}
 
 # Ensure that the links exist without depending on it when it exists which
 # causes all the modules to be rebuilt when the directory pointed to changes.

Modified: projects/release-pkg/sys/kern/init_main.c
==============================================================================
--- projects/release-pkg/sys/kern/init_main.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/kern/init_main.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -479,7 +479,7 @@ proc0_init(void *dummy __unused)
 	session0.s_leader = p;
 
 	p->p_sysent = &null_sysvec;
-	p->p_flag = P_SYSTEM | P_INMEM;
+	p->p_flag = P_SYSTEM | P_INMEM | P_KTHREAD;
 	p->p_flag2 = 0;
 	p->p_state = PRS_NORMAL;
 	knlist_init_mtx(&p->p_klist, &p->p_mtx);

Modified: projects/release-pkg/sys/kern/kern_fork.c
==============================================================================
--- projects/release-pkg/sys/kern/kern_fork.c	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/sys/kern/kern_fork.c	Tue Feb  9 01:42:51 2016	(r295423)
@@ -1040,7 +1040,7 @@ fork_exit(void (*callout)(void *, struct
 	if (p->p_flag & P_KTHREAD) {
 		printf("Kernel thread \"%s\" (pid %d) exited prematurely.\n",
 		    td->td_name, p->p_pid);
-		kproc_exit(0);
+		kthread_exit();
 	}
 	mtx_assert(&Giant, MA_NOTOWNED);
 

Modified: projects/release-pkg/targets/pseudo/userland/misc/Makefile.depend
==============================================================================
--- projects/release-pkg/targets/pseudo/userland/misc/Makefile.depend	Tue Feb  9 01:41:03 2016	(r295422)
+++ projects/release-pkg/targets/pseudo/userland/misc/Makefile.depend	Tue Feb  9 01:42:51 2016	(r295423)
@@ -40,6 +40,7 @@ DIRDEPS.x86sys= \
 	sys/boot/i386/btx/lib \
 	sys/boot/i386/cdboot \
 	sys/boot/i386/gptboot \
+	sys/boot/i386/kgzldr \
 	sys/boot/i386/libfirewire \
 	sys/boot/i386/libi386 \
 	sys/boot/i386/loader \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602090142.u191gpTk019645>