[Midnightbsd-cvs] src [10212] trunk/sys/boot/common: update and fix partition types

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 2 10:09:31 EDT 2018


Revision: 10212
          http://svnweb.midnightbsd.org/src/?rev=10212
Author:   laffer1
Date:     2018-06-02 10:09:31 -0400 (Sat, 02 Jun 2018)
Log Message:
-----------
update and fix partition types

Modified Paths:
--------------
    trunk/sys/boot/common/Makefile.inc
    trunk/sys/boot/common/bootstrap.h
    trunk/sys/boot/common/console.c
    trunk/sys/boot/common/crc32.c
    trunk/sys/boot/common/dev_net.c
    trunk/sys/boot/common/dev_net.h
    trunk/sys/boot/common/interp.c
    trunk/sys/boot/common/interp_forth.c
    trunk/sys/boot/common/interp_parse.c
    trunk/sys/boot/common/isapnp.c
    trunk/sys/boot/common/isapnp.h
    trunk/sys/boot/common/load_elf.c
    trunk/sys/boot/common/load_elf32.c
    trunk/sys/boot/common/load_elf_obj.c
    trunk/sys/boot/common/loader.8
    trunk/sys/boot/common/ls.c
    trunk/sys/boot/common/misc.c
    trunk/sys/boot/common/module.c
    trunk/sys/boot/common/part.c
    trunk/sys/boot/common/part.h
    trunk/sys/boot/common/reloc_elf64.c
    trunk/sys/boot/common/ufsread.c

Added Paths:
-----------
    trunk/sys/boot/common/paths.h
    trunk/sys/boot/common/rbx.h
    trunk/sys/boot/common/self_reloc.c

Modified: trunk/sys/boot/common/Makefile.inc
===================================================================
--- trunk/sys/boot/common/Makefile.inc	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/Makefile.inc	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,5 +1,5 @@
 # $MidnightBSD$
-# $FreeBSD: stable/9/sys/boot/common/Makefile.inc 272697 2014-10-07 13:37:10Z avg $
+# $FreeBSD: stable/10/sys/boot/common/Makefile.inc 281843 2015-04-22 01:08:40Z dteske $
 
 SRCS+=	boot.c commands.c console.c devopen.c interp.c 
 SRCS+=	interp_backslash.c interp_parse.c ls.c misc.c 
@@ -8,8 +8,17 @@
 .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64"
 SRCS+=	load_elf32.c load_elf32_obj.c reloc_elf32.c
 SRCS+=	load_elf64.c load_elf64_obj.c reloc_elf64.c
+.elif ${MACHINE_CPUARCH} == "ia64"
+SRCS+=	load_elf64.c load_elf64_obj.c reloc_elf64.c
+.elif ${MACHINE} == "pc98"
+SRCS+=	load_elf32.c load_elf32_obj.c reloc_elf32.c
 .elif ${MACHINE_CPUARCH} == "arm"
 SRCS+=	load_elf32.c reloc_elf32.c
+.elif ${MACHINE_CPUARCH} == "powerpc"
+SRCS+=	load_elf32.c reloc_elf32.c
+SRCS+=	load_elf64.c reloc_elf64.c
+.elif ${MACHINE_CPUARCH} == "sparc64"
+SRCS+=	load_elf64.c reloc_elf64.c
 .endif
 
 .if defined(LOADER_NET_SUPPORT)
@@ -48,16 +57,6 @@
 # Forth interpreter
 .if defined(BOOT_FORTH)
 SRCS+=	interp_forth.c
-MAN+=	../forth/beastie.4th.8
-MAN+=	../forth/brand.4th.8
-MAN+=	../forth/check-password.4th.8
-MAN+=	../forth/color.4th.8
-MAN+=	../forth/delay.4th.8
-MAN+=	../forth/loader.conf.5
-MAN+=	../forth/loader.4th.8
-MAN+=	../forth/menu.4th.8
-MAN+=	../forth/menusets.4th.8
-MAN+=	../forth/version.4th.8
 .endif
 
 .if defined(BOOT_PROMPT_123)

Modified: trunk/sys/boot/common/bootstrap.h
===================================================================
--- trunk/sys/boot/common/bootstrap.h	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/bootstrap.h	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/boot/common/bootstrap.h 294985 2016-01-28 12:23:25Z smh $
  */
 
 #ifndef _BOOTSTRAP_H_
@@ -56,7 +57,10 @@
 extern char	*command_errmsg;	
 extern char	command_errbuf[];	/* XXX blah, length */
 #define CMD_OK		0
-#define CMD_ERROR	1
+#define CMD_WARN	1
+#define CMD_ERROR	2
+#define CMD_CRIT	3
+#define CMD_FATAL	4
 
 /* interp.c */
 void	interact(void);
@@ -231,8 +235,9 @@
 int			mod_loadkld(const char *name, int argc, char *argv[]);
 
 struct preloaded_file *file_alloc(void);
-struct preloaded_file *file_findfile(char *name, char *type);
+struct preloaded_file *file_findfile(const char *name, const char *type);
 struct file_metadata *file_findmetadata(struct preloaded_file *fp, int type);
+struct preloaded_file *file_loadraw(const char *name, char *type, int insert);
 void file_discard(struct preloaded_file *fp);
 void file_addmetadata(struct preloaded_file *fp, int type, size_t size, void *p);
 int  file_addmodule(struct preloaded_file *fp, char *modname, int version,
@@ -256,6 +261,9 @@
 int	__elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr,
 	    const void *reldata, int reltype, Elf_Addr relbase,
 	    Elf_Addr dataaddr, void *data, size_t len);
+int __elfN(loadfile_raw)(char *filename, u_int64_t dest,
+	    struct preloaded_file **result, int multiboot);
+int __elfN(load_modmetadata)(struct preloaded_file *fp, u_int64_t dest);
 #endif
 
 /*

Modified: trunk/sys/boot/common/console.c
===================================================================
--- trunk/sys/boot/common/console.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/console.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/console.c 294986 2016-01-28 12:25:27Z smh $");
 
 #include <stand.h>
 #include <string.h>
@@ -38,7 +39,8 @@
 static int	cons_set(struct env_var *ev, int flags, const void *value);
 static int	cons_find(const char *name);
 static int	cons_check(const char *string);
-static void	cons_change(const char *string);
+static int	cons_change(const char *string);
+static int	twiddle_set(struct env_var *ev, int flags, const void *value);
 
 /*
  * Detect possible console(s) to use.  If preferred console(s) have been
@@ -46,12 +48,15 @@
  * as active.  Also create the console variable.
  */
 void
-cons_probe(void) 
+cons_probe(void)
 {
     int			cons;
     int			active;
     char		*prefconsole;
-    
+
+    /* We want a callback to install the new value when this var changes. */
+    env_setenv("twiddle_divisor", EV_VOLATILE, "1", twiddle_set, env_nounset);
+
     /* Do all console probes */
     for (cons = 0; consoles[cons] != NULL; cons++) {
 	consoles[cons]->c_flags = 0;
@@ -158,54 +163,69 @@
 static int
 cons_set(struct env_var *ev, int flags, const void *value)
 {
-    int		cons;
+    int		ret;
 
-    if ((value == NULL) || (cons_check(value) == -1)) {
-	if (value != NULL) 
-	    printf("no such console!\n");
-	printf("Available consoles:\n");
-	for (cons = 0; consoles[cons] != NULL; cons++)
-	    printf("    %s\n", consoles[cons]->c_name);
-	return(CMD_ERROR);
+    if ((value == NULL) || (cons_check(value) == 0)) {
+	/*
+	 * Return CMD_OK instead of CMD_ERROR to prevent forth syntax error,
+	 * which would prevent it processing any further loader.conf entries.
+	 */
+	return (CMD_OK);
     }
 
-    cons_change(value);
+    ret = cons_change(value);
+    if (ret != CMD_OK)
+	return (ret);
 
     env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
-    return(CMD_OK);
+    return (CMD_OK);
 }
 
 /*
- * Check that all of the consoles listed in *string are valid consoles
+ * Check that at least one the consoles listed in *string is valid
  */
 static int
 cons_check(const char *string)
 {
-    int		cons;
+    int		cons, found, failed;
     char	*curpos, *dup, *next;
 
     dup = next = strdup(string);
-    cons = -1;
+    found = failed = 0;
     while (next != NULL) {
 	curpos = strsep(&next, " ,");
 	if (*curpos != '\0') {
 	    cons = cons_find(curpos);
-	    if (cons == -1)
-		break;
+	    if (cons == -1) {
+		printf("console %s is invalid!\n", curpos);
+		failed++;
+	    } else {
+		found++;
+	    }
 	}
     }
 
     free(dup);
-    return (cons);
+
+    if (found == 0)
+	printf("no valid consoles!\n");
+
+    if (found == 0 || failed != 0) {
+	printf("Available consoles:\n");
+	for (cons = 0; consoles[cons] != NULL; cons++)
+	    printf("    %s\n", consoles[cons]->c_name);
+    }
+
+    return (found);
 }
 
 /*
- * Activate all of the consoles listed in *string and disable all the others.
+ * Activate all the valid consoles listed in *string and disable all others.
  */
-static void
+static int
 cons_change(const char *string)
 {
-    int		cons;
+    int		cons, active;
     char	*curpos, *dup, *next;
 
     /* Disable all consoles */
@@ -215,6 +235,7 @@
 
     /* Enable selected consoles */
     dup = next = strdup(string);
+    active = 0;
     while (next != NULL) {
 	curpos = strsep(&next, " ,");
 	if (*curpos == '\0')
@@ -223,12 +244,60 @@
 	if (cons >= 0) {
 	    consoles[cons]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT;
 	    consoles[cons]->c_init(0);
-	    if ((consoles[cons]->c_flags & (C_PRESENTIN | C_PRESENTOUT)) !=
+	    if ((consoles[cons]->c_flags & (C_PRESENTIN | C_PRESENTOUT)) ==
+		(C_PRESENTIN | C_PRESENTOUT)) {
+		active++;
+		continue;
+	    }
+
+	    if (active != 0) {
+		/* If no consoles have initialised we wouldn't see this. */
+		printf("console %s failed to initialize\n", consoles[cons]->c_name);
+	    }
+	}
+    }
+
+    free(dup);
+
+    if (active == 0) {
+	/* All requested consoles failed to initialise, try to recover. */
+	for (cons = 0; consoles[cons] != NULL; cons++) {
+	    consoles[cons]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT;
+	    consoles[cons]->c_init(0);
+	    if ((consoles[cons]->c_flags &
+		(C_PRESENTIN | C_PRESENTOUT)) ==
 		(C_PRESENTIN | C_PRESENTOUT))
-		printf("console %s failed to initialize\n",
-		    consoles[cons]->c_name);
+		active++;
 	}
+
+	if (active == 0)
+	    return (CMD_ERROR); /* Recovery failed. */
     }
 
-    free(dup);
+    return (CMD_OK);
 }
+
+/*
+ * Change the twiddle divisor.
+ *
+ * The user can set the twiddle_divisor variable to directly control how fast
+ * the progress twiddle spins, useful for folks with slow serial consoles.  The
+ * code to monitor changes to the variable and propagate them to the twiddle
+ * routines has to live somewhere.  Twiddling is console-related so it's here.
+ */
+static int
+twiddle_set(struct env_var *ev, int flags, const void *value)
+{
+    u_long tdiv;
+    char * eptr;
+
+    tdiv = strtoul(value, &eptr, 0);
+    if (*(const char *)value == 0 || *eptr != 0) {
+	printf("invalid twiddle_divisor '%s'\n", (const char *)value);
+	return (CMD_ERROR);
+    }
+    twiddle_divisor((u_int)tdiv);
+    env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
+
+    return(CMD_OK);
+}

Modified: trunk/sys/boot/common/crc32.c
===================================================================
--- trunk/sys/boot/common/crc32.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/crc32.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  *  COPYRIGHT (C) 1986 Gary S. Brown.  You may use this program, or
  *  code or tables extracted from it, as desired without restriction.
@@ -43,13 +44,13 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/crc32.c 233517 2012-03-26 18:22:04Z marius $");
 
 #include <sys/types.h>
 
 #include "crc32.h"
 
-static uint32_t crc32_tab[] = {
+static const uint32_t crc32_tab[] = {
 	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
 	0xe963a535, 0x9e6495a3,	0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
 	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,

Modified: trunk/sys/boot/common/dev_net.c
===================================================================
--- trunk/sys/boot/common/dev_net.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/dev_net.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: dev_net.c,v 1.23 2008/04/28 20:24:06 martin Exp $	*/
 
 /*-
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/dev_net.c 301056 2016-05-31 17:01:54Z ian $");
 
 /*-
  * This module implements a "raw device" interface suitable for
@@ -111,6 +112,8 @@
 static int
 net_open(struct open_file *f, ...)
 {
+	char temp[FNAME_SIZE];
+	struct iodesc *d;
 	va_list args;
 	char *devname;		/* Device part of file name (or NULL). */
 	int error = 0;
@@ -140,6 +143,10 @@
 				printf("net_open: netif_open() succeeded\n");
 #endif
 		}
+		/*
+		 * If network params were not set by netif_open(), try to get
+		 * them via bootp, rarp, etc.
+		 */
 		if (rootip.s_addr == 0) {
 			/* Get root IP address, and path, etc. */
 			error = net_getparams(netdev_sock);
@@ -151,6 +158,26 @@
 				return (error);
 			}
 		}
+		/*
+		 * Set the variables required by the kernel's nfs_diskless
+		 * mechanism.  This is the minimum set of variables required to
+		 * mount a root filesystem without needing to obtain additional
+		 * info from bootp or other sources.
+		 */
+		d = socktodesc(netdev_sock);
+		sprintf(temp, "%6D", d->myea, ":");
+		setenv("boot.netif.hwaddr", temp, 1);
+		setenv("boot.netif.ip", inet_ntoa(myip), 1);
+		setenv("boot.netif.netmask", intoa(netmask), 1);
+		setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
+		setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
+		setenv("boot.nfsroot.path", rootpath, 1);
+		if (intf_mtu != 0) {
+			char mtu[16];
+			sprintf(mtu, "%u", intf_mtu);
+			setenv("boot.netif.mtu", mtu, 1);
+		}
+
 	}
 	netdev_opens++;
 	f->f_devdata = &netdev_sock;
@@ -232,10 +259,7 @@
 net_getparams(int sock)
 {
 	char buf[MAXHOSTNAMELEN];
-	char temp[FNAME_SIZE];
-	struct iodesc *d;
-	int i;
-	n_long smask;
+	n_long rootaddr, smask;
 
 #ifdef	SUPPORT_BOOTP
 	/*
@@ -302,21 +326,9 @@
 		return (EIO);
 	}
 exit:
-	/*
-	 * If present, strip the server's address off of the rootpath
-	 * before passing it along.  This allows us to be compatible with
-	 * the kernel's diskless (BOOTP_NFSROOT) booting conventions
-	 */
-	for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
-		if (rootpath[i] == ':')
-			break;
-	if (i && i != FNAME_SIZE && rootpath[i] == ':') {
-		rootpath[i++] = '\0';
-		if (inet_addr(&rootpath[0]) != INADDR_NONE)
-			rootip.s_addr = inet_addr(&rootpath[0]);
-		bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
-		bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);
-	}
+	if ((rootaddr = net_parse_rootpath()) != INADDR_NONE)
+		rootip.s_addr = rootaddr;
+
 #ifdef	NETIF_DEBUG
 	if (debug) {
 		printf("net_open: server addr: %s\n", inet_ntoa(rootip));
@@ -324,15 +336,6 @@
 	}
 #endif
 
-	d = socktodesc(sock);
-	sprintf(temp, "%6D", d->myea, ":");
-	setenv("boot.netif.ip", inet_ntoa(myip), 1);
-	setenv("boot.netif.netmask", intoa(netmask), 1);
-	setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
-	setenv("boot.netif.hwaddr", temp, 1);
-	setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
-	setenv("boot.nfsroot.path", rootpath, 1);
-
 	return (0);
 }
 
@@ -354,3 +357,24 @@
 	}
 	printf("\n");
 }
+
+/*
+ * Strip the server's address off of the rootpath if present and return it in
+ * network byte order, leaving just the pathname part in the global rootpath.
+ */
+uint32_t
+net_parse_rootpath()
+{
+	int i;
+	n_long addr = INADDR_NONE;
+
+	for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
+		if (rootpath[i] == ':')
+			break;
+	if (i && i != FNAME_SIZE && rootpath[i] == ':') {
+		rootpath[i++] = '\0';
+		addr = inet_addr(&rootpath[0]);
+		bcopy(&rootpath[i], rootpath, strlen(&rootpath[i])+1);
+	}
+	return (addr);
+}

Modified: trunk/sys/boot/common/dev_net.h
===================================================================
--- trunk/sys/boot/common/dev_net.h	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/dev_net.h	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Doug Rabson <dfr at freebsd.org>
  * All rights reserved.
@@ -23,8 +24,14 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/boot/common/dev_net.h 283510 2015-05-25 01:29:45Z ian $
  */
 
+#ifndef _BOOT_DEV_NET_H_
+#define _BOOT_DEV_NET_H_
+
 extern struct devsw netdev;
 
+uint32_t net_parse_rootpath(void);
+
+#endif

Modified: trunk/sys/boot/common/interp.c
===================================================================
--- trunk/sys/boot/common/interp.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/interp.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/interp.c 242084 2012-10-25 15:45:32Z mav $");
 
 /*
  * Simple commandline interpreter, toplevel and misc.
@@ -211,7 +212,7 @@
 #endif
 
     if (((fd = open(filename, O_RDONLY)) == -1)) {
-	sprintf(command_errbuf,"can't open '%s': %s\n", filename, strerror(errno));
+	sprintf(command_errbuf,"can't open '%s': %s", filename, strerror(errno));
 	return(CMD_ERROR);
     }
 
@@ -254,7 +255,7 @@
 			free(se);
 		}
 		sprintf(command_errbuf, "file '%s' line %d: memory allocation "
-		    "failure - aborting\n", filename, line);
+		    "failure - aborting", filename, line);
 		return (CMD_ERROR);
 	}
 	strcpy(sp->text, cp);

Modified: trunk/sys/boot/common/interp_forth.c
===================================================================
--- trunk/sys/boot/common/interp_forth.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/interp_forth.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/interp_forth.c 294985 2016-01-28 12:23:25Z smh $");
 
 #include <sys/param.h>		/* to pick up __FreeBSD_version */
 #include <string.h>
@@ -51,6 +52,13 @@
 #define BF_PARSE 100
 
 /*
+ * FreeBSD loader default dictionary cells
+ */
+#ifndef	BF_DICTSIZE
+#define	BF_DICTSIZE	10000
+#endif
+
+/*
  * BootForth   Interface to Ficl Forth interpreter.
  */
 
@@ -131,7 +139,23 @@
     } else {
 	result=BF_PARSE;
     }
+
+    switch (result) {
+    case CMD_CRIT:
+	printf("%s\n", command_errmsg);
+	break;
+    case CMD_FATAL:
+	panic("%s\n", command_errmsg);
+    }
+
     free(line);
+    /*
+     * If there was error during nested ficlExec(), we may no longer have
+     * valid environment to return.  Throw all exceptions from here.
+     */
+    if (result != CMD_OK)
+	vmThrow(vm, result);
+
     /* This is going to be thrown!!! */
     stackPushINT(vm->pStack,result);
 }
@@ -233,8 +257,8 @@
     struct bootblk_command	**cmdp;
     char create_buf[41];	/* 31 characters-long builtins */
     int fd;
-   
-    bf_sys = ficlInitSystem(10000);	/* Default dictionary ~4000 cells */
+
+    bf_sys = ficlInitSystem(BF_DICTSIZE);
     bf_vm = ficlNewVM(bf_sys);
 
     /* Put all private definitions in a "builtins" vocabulary */

Modified: trunk/sys/boot/common/interp_parse.c
===================================================================
--- trunk/sys/boot/common/interp_parse.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/interp_parse.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -15,7 +16,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/interp_parse.c 229403 2012-01-03 18:51:58Z ed $");
 
 #include <stand.h>
 #include <string.h>
@@ -137,7 +138,7 @@
 
 	case VAR:
 	    if (token) {
-		PARSE_FAIL((q = index(p, token)) == NULL);
+		PARSE_FAIL((q = strchr(p, token)) == NULL);
 	    } else {
 		q = p;
 		while (*q && !isspace(*q))

Modified: trunk/sys/boot/common/isapnp.c
===================================================================
--- trunk/sys/boot/common/isapnp.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/isapnp.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998, Michael Smith
  * Copyright (c) 1996, Sujal M. Patel
@@ -26,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/isapnp.c 119483 2003-08-25 23:30:41Z obrien $");
 
 /*
  * Machine-independant ISA PnP enumerator implementing a subset of the

Modified: trunk/sys/boot/common/isapnp.h
===================================================================
--- trunk/sys/boot/common/isapnp.h	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/isapnp.h	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1996, Sujal M. Patel
  * All rights reserved.
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/boot/common/isapnp.h 92766 2002-03-20 08:00:54Z alfred $
  */
 
 #ifndef _I386_ISA_PNP_H_

Modified: trunk/sys/boot/common/load_elf.c
===================================================================
--- trunk/sys/boot/common/load_elf.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/load_elf.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
  * Copyright (c) 1998 Peter Wemm <peter at freebsd.org>
@@ -26,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/load_elf.c 295531 2016-02-11 17:31:17Z smh $");
 
 #include <sys/param.h>
 #include <sys/exec.h>
@@ -76,7 +77,8 @@
 static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, const char* name, Elf_Sym* sym);
 static int __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef,
     Elf_Addr p, void *val, size_t len);
-static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef);
+static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef,
+    Elf_Addr p_start, Elf_Addr p_end);
 static symaddr_fn __elfN(symaddr);
 static char	*fake_modname(const char *name);
 
@@ -85,6 +87,61 @@
 
 u_int64_t	__elfN(relocation_offset) = 0;
 
+static int
+__elfN(load_elf_header)(char *filename, elf_file_t ef)
+{
+	ssize_t			 bytes_read;
+	Elf_Ehdr		*ehdr;
+	int 			 err;
+
+	/*
+	* Open the image, read and validate the ELF header 
+	*/
+	if (filename == NULL)	/* can't handle nameless */
+		return (EFTYPE);
+	if ((ef->fd = open(filename, O_RDONLY)) == -1)
+		return (errno);
+	ef->firstpage = malloc(PAGE_SIZE);
+	if (ef->firstpage == NULL) {
+		close(ef->fd);
+		return (ENOMEM);
+	}
+	bytes_read = read(ef->fd, ef->firstpage, PAGE_SIZE);
+	ef->firstlen = (size_t)bytes_read;
+	if (bytes_read < 0 || ef->firstlen <= sizeof(Elf_Ehdr)) {
+		err = EFTYPE; /* could be EIO, but may be small file */
+		goto error;
+	}
+	ehdr = ef->ehdr = (Elf_Ehdr *)ef->firstpage;
+
+	/* Is it ELF? */
+	if (!IS_ELF(*ehdr)) {
+		err = EFTYPE;
+		goto error;
+	}
+	if (ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || /* Layout ? */
+	    ehdr->e_ident[EI_DATA] != ELF_TARG_DATA ||
+	    ehdr->e_ident[EI_VERSION] != EV_CURRENT || /* Version ? */
+	    ehdr->e_version != EV_CURRENT ||
+	    ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */
+		err = EFTYPE;
+		goto error;
+	}
+
+	return (0);
+
+error:
+	if (ef->firstpage != NULL) {
+		free(ef->firstpage);
+		ef->firstpage = NULL;
+	}
+	if (ef->fd != -1) {
+		close(ef->fd);
+		ef->fd = -1;
+	}
+	return (err);
+}
+
 /*
  * Attempt to load the file (file) as an ELF module.  It will be stored at
  * (dest), and a pointer to a module structure describing the loaded object
@@ -93,56 +150,73 @@
 int
 __elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result)
 {
+	return (__elfN(loadfile_raw)(filename, dest, result, 0));
+}
+
+int
+__elfN(loadfile_raw)(char *filename, u_int64_t dest,
+    struct preloaded_file **result, int multiboot)
+{
     struct preloaded_file	*fp, *kfp;
     struct elf_file		ef;
     Elf_Ehdr 			*ehdr;
     int				err;
-    ssize_t			bytes_read;
 
     fp = NULL;
     bzero(&ef, sizeof(struct elf_file));
+    ef.fd = -1;
 
-    /*
-     * Open the image, read and validate the ELF header 
-     */
-    if (filename == NULL)	/* can't handle nameless */
-	return(EFTYPE);
-    if ((ef.fd = open(filename, O_RDONLY)) == -1)
-	return(errno);
-    ef.firstpage = malloc(PAGE_SIZE);
-    if (ef.firstpage == NULL) {
-	close(ef.fd);
-	return(ENOMEM);
-    }
-    bytes_read = read(ef.fd, ef.firstpage, PAGE_SIZE);
-    ef.firstlen = (size_t)bytes_read;
-    if (bytes_read < 0 || ef.firstlen <= sizeof(Elf_Ehdr)) {
-	err = EFTYPE;		/* could be EIO, but may be small file */
-	goto oerr;
-    }
-    ehdr = ef.ehdr = (Elf_Ehdr *)ef.firstpage;
+    err = __elfN(load_elf_header)(filename, &ef);
+    if (err != 0)
+    	return (err);
 
-    /* Is it ELF? */
-    if (!IS_ELF(*ehdr)) {
-	err = EFTYPE;
-	goto oerr;
-    }
-    if (ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS ||	/* Layout ? */
-	ehdr->e_ident[EI_DATA] != ELF_TARG_DATA ||
-	ehdr->e_ident[EI_VERSION] != EV_CURRENT ||	/* Version ? */
-	ehdr->e_version != EV_CURRENT ||
-	ehdr->e_machine != ELF_TARG_MACH) {		/* Machine ? */
-	err = EFTYPE;
-	goto oerr;
-    }
+    ehdr = ef.ehdr;
 
-
     /*
      * Check to see what sort of module we are.
      */
-    kfp = file_findfile(NULL, NULL);
-    if (ehdr->e_type == ET_DYN) {
+    kfp = file_findfile(NULL, __elfN(kerneltype));
+#ifdef __powerpc__
+    /*
+     * Kernels can be ET_DYN, so just assume the first loaded object is the
+     * kernel. This assumption will be checked later.
+     */
+    if (kfp == NULL)
+        ef.kernel = 1;
+#endif
+    if (ef.kernel || ehdr->e_type == ET_EXEC) {
+	/* Looks like a kernel */
+	if (kfp != NULL) {
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: kernel already loaded\n");
+	    err = EPERM;
+	    goto oerr;
+	}
+	/* 
+	 * Calculate destination address based on kernel entrypoint.
+	 *
+	 * For ARM, the destination address is independent of any values in the
+	 * elf header (an ARM kernel can be loaded at any 2MB boundary), so we
+	 * leave dest set to the value calculated by archsw.arch_loadaddr() and
+	 * passed in to this function.
+	 */
+#ifndef __arm__
+        if (ehdr->e_type == ET_EXEC)
+	    dest = (ehdr->e_entry & ~PAGE_MASK);
+#endif
+	if ((ehdr->e_entry & ~PAGE_MASK) == 0) {
+	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n");
+	    err = EPERM;
+	    goto oerr;
+	}
+	ef.kernel = 1;
+
+    } else if (ehdr->e_type == ET_DYN) {
 	/* Looks like a kld module */
+	if (multiboot != 0) {
+		printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module as multiboot\n");
+		err = EPERM;
+		goto oerr;
+	}
 	if (kfp == NULL) {
 	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module before kernel\n");
 	    err = EPERM;
@@ -156,24 +230,6 @@
 	/* Looks OK, got ahead */
 	ef.kernel = 0;
 
-    } else if (ehdr->e_type == ET_EXEC) {
-	/* Looks like a kernel */
-	if (kfp != NULL) {
-	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: kernel already loaded\n");
-	    err = EPERM;
-	    goto oerr;
-	}
-	/* 
-	 * Calculate destination address based on kernel entrypoint 	
-	 */
-	dest = (ehdr->e_entry & ~PAGE_MASK);
-	if (dest == 0) {
-	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n");
-	    err = EPERM;
-	    goto oerr;
-	}
-	ef.kernel = 1;
-
     } else {
 	err = EFTYPE;
 	goto oerr;
@@ -193,10 +249,14 @@
 	    err = EPERM;
 	    goto out;
     }
-    if (ef.kernel)
+    if (ef.kernel == 1 && multiboot == 0)
 	setenv("kernelname", filename, 1);
     fp->f_name = strdup(filename);
-    fp->f_type = strdup(ef.kernel ? __elfN(kerneltype) : __elfN(moduletype));
+    if (multiboot == 0)
+    	fp->f_type = strdup(ef.kernel ?
+    	    __elfN(kerneltype) : __elfN(moduletype));
+    else
+    	fp->f_type = strdup("elf multiboot kernel");
 
 #ifdef ELF_VERBOSE
     if (ef.kernel)
@@ -224,7 +284,8 @@
  out:
     if (ef.firstpage)
 	free(ef.firstpage);
-    close(ef.fd);
+    if (ef.fd != -1)
+    	close(ef.fd);
     return(err);
 }
 
@@ -253,6 +314,8 @@
     int		symtabindex;
     Elf_Size	size;
     u_int	fpcopy;
+    Elf_Sym	sym;
+    Elf_Addr	p_start, p_end;
 
     dp = NULL;
     shdr = NULL;
@@ -259,7 +322,7 @@
     ret = 0;
     firstaddr = lastaddr = 0;
     ehdr = ef->ehdr;
-    if (ef->kernel) {
+    if (ehdr->e_type == ET_EXEC) {
 #if defined(__i386__) || defined(__amd64__)
 #if __ELF_WORD_SIZE == 64
 	off = - (off & 0xffffffffff000000ull);/* x86_64 relocates after locore */
@@ -290,21 +353,31 @@
 	} else
 	    off = 0;
 #elif defined(__arm__)
-	if (off & 0xf0000000u) {
-	    off = -(off & 0xf0000000u);
-	    ehdr->e_entry += off;
+	/*
+	 * The elf headers in arm kernels specify virtual addresses in all
+	 * header fields, even the ones that should be physical addresses.
+	 * We assume the entry point is in the first page, and masking the page
+	 * offset will leave us with the virtual address the kernel was linked
+	 * at.  We subtract that from the load offset, making 'off' into the
+	 * value which, when added to a virtual address in an elf header,
+	 * translates it to a physical address.  We do the va->pa conversion on
+	 * the entry point address in the header now, so that later we can
+	 * launch the kernel by just jumping to that address.
+	 */
+	off -= ehdr->e_entry & ~PAGE_MASK;
+	ehdr->e_entry += off;
 #ifdef ELF_VERBOSE
-	    printf("Converted entry 0x%08x\n", ehdr->e_entry);
+	printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", ehdr->e_entry, off);
 #endif
-	} else
-	    off = 0;
 #else
 	off = 0;		/* other archs use direct mapped kernels */
 #endif
-	__elfN(relocation_offset) = off;
     }
     ef->off = off;
 
+    if (ef->kernel)
+	__elfN(relocation_offset) = off;
+
     if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) {
 	printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: program header not within first page\n");
 	goto out;
@@ -385,6 +458,8 @@
 	    "_loadimage: failed to read section headers");
 	goto nosyms;
     }
+    file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr);
+
     symtabindex = -1;
     symstrindex = -1;
     for (i = 0; i < ehdr->e_shnum; i++) {
@@ -543,7 +618,15 @@
     COPYOUT(ef->hashtab + 1, &ef->nchains, sizeof(ef->nchains));
     ef->buckets = ef->hashtab + 2;
     ef->chains = ef->buckets + ef->nbuckets;
-    if (__elfN(parse_modmetadata)(fp, ef) == 0)
+
+    if (__elfN(lookup_symbol)(fp, ef, "__start_set_modmetadata_set", &sym) != 0)
+	return 0;
+    p_start = sym.st_value + ef->off;
+    if (__elfN(lookup_symbol)(fp, ef, "__stop_set_modmetadata_set", &sym) != 0)
+	return ENOENT;
+    p_end = sym.st_value + ef->off;
+
+    if (__elfN(parse_modmetadata)(fp, ef, p_start, p_end) == 0)
 	goto out;
 
     if (ef->kernel)			/* kernel must not depend on anything */
@@ -596,30 +679,149 @@
 	u_int64_t	md_cval;	/* common string label */
 };
 #endif
+#if defined(__amd64__) && __ELF_WORD_SIZE == 32
+struct mod_metadata32 {
+	int		md_version;	/* structure version MDTV_* */  
+	int		md_type;	/* type of entry MDT_* */
+	u_int32_t	md_data;	/* specific data */
+	u_int32_t	md_cval;	/* common string label */
+};
+#endif
 
 int
-__elfN(parse_modmetadata)(struct preloaded_file *fp, elf_file_t ef)
+__elfN(load_modmetadata)(struct preloaded_file *fp, u_int64_t dest)
 {
+	struct elf_file		 ef;
+	int			 err, i, j;
+	Elf_Shdr		*sh_meta, *shdr = NULL;
+	Elf_Shdr		*sh_data[2];
+	char			*shstrtab = NULL;
+	size_t			 size;
+	Elf_Addr		 p_start, p_end;
+
+	bzero(&ef, sizeof(struct elf_file));
+	ef.fd = -1;
+
+	err = __elfN(load_elf_header)(fp->f_name, &ef);
+	if (err != 0)
+		goto out;
+
+	if (ef.ehdr->e_type == ET_EXEC) {
+		ef.kernel = 1;
+	} else if (ef.ehdr->e_type != ET_DYN) {
+		err = EFTYPE;
+		goto out;
+	}
+
+	size = ef.ehdr->e_shnum * ef.ehdr->e_shentsize;
+	shdr = alloc_pread(ef.fd, ef.ehdr->e_shoff, size);
+	if (shdr == NULL) {
+		err = ENOMEM;
+		goto out;
+	}
+
+	/* Load shstrtab. */
+	shstrtab = alloc_pread(ef.fd, shdr[ef.ehdr->e_shstrndx].sh_offset,
+	    shdr[ef.ehdr->e_shstrndx].sh_size);
+	if (shstrtab == NULL) {
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE)
+		    "load_modmetadata: unable to load shstrtab\n");
+		err = EFTYPE;
+		goto out;
+	}
+
+	/* Find set_modmetadata_set and data sections. */
+	sh_data[0] = sh_data[1] = sh_meta = NULL;
+	for (i = 0, j = 0; i < ef.ehdr->e_shnum; i++) {
+		if (strcmp(&shstrtab[shdr[i].sh_name],
+		    "set_modmetadata_set") == 0) {
+			sh_meta = &shdr[i];
+		}
+		if ((strcmp(&shstrtab[shdr[i].sh_name], ".data") == 0) ||
+		    (strcmp(&shstrtab[shdr[i].sh_name], ".rodata") == 0)) {
+			sh_data[j++] = &shdr[i];
+		}
+	}
+	if (sh_meta == NULL || sh_data[0] == NULL || sh_data[1] == NULL) {
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE)
+    "load_modmetadata: unable to find set_modmetadata_set or data sections\n");
+		err = EFTYPE;
+		goto out;
+	}
+
+	/* Load set_modmetadata_set into memory */
+	err = kern_pread(ef.fd, dest, sh_meta->sh_size, sh_meta->sh_offset);
+	if (err != 0) {
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE)
+    "load_modmetadata: unable to load set_modmetadata_set: %d\n", err);
+		goto out;
+	}
+	p_start = dest;
+	p_end = dest + sh_meta->sh_size;
+	dest += sh_meta->sh_size;
+
+	/* Load data sections into memory. */
+	err = kern_pread(ef.fd, dest, sh_data[0]->sh_size,
+	    sh_data[0]->sh_offset);
+	if (err != 0) {
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE)
+		    "load_modmetadata: unable to load data: %d\n", err);
+		goto out;
+	}
+
+	/*
+	 * We have to increment the dest, so that the offset is the same into
+	 * both the .rodata and .data sections.
+	 */
+	ef.off = -(sh_data[0]->sh_addr - dest);
+	dest +=	(sh_data[1]->sh_addr - sh_data[0]->sh_addr);
+
+	err = kern_pread(ef.fd, dest, sh_data[1]->sh_size,
+	    sh_data[1]->sh_offset);
+	if (err != 0) {
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE)
+		    "load_modmetadata: unable to load data: %d\n", err);
+		goto out;
+	}
+
+	err = __elfN(parse_modmetadata)(fp, &ef, p_start, p_end);
+	if (err != 0) {
+		printf("\nelf" __XSTRING(__ELF_WORD_SIZE)
+		    "load_modmetadata: unable to parse metadata: %d\n", err);
+		goto out;
+	}
+
+out:
+	if (shstrtab != NULL)
+		free(shstrtab);
+	if (shdr != NULL)
+		free(shdr);
+	if (ef.firstpage != NULL)
+		free(ef.firstpage);
+	if (ef.fd != -1)
+		close(ef.fd);
+	return (err);
+}
+
+int
+__elfN(parse_modmetadata)(struct preloaded_file *fp, elf_file_t ef,
+    Elf_Addr p_start, Elf_Addr p_end)
+{
     struct mod_metadata md;
 #if (defined(__i386__) || defined(__powerpc__)) && __ELF_WORD_SIZE == 64
     struct mod_metadata64 md64;
+#elif defined(__amd64__) && __ELF_WORD_SIZE == 32
+    struct mod_metadata32 md32;
 #endif
     struct mod_depend *mdepend;
     struct mod_version mver;
-    Elf_Sym sym;
     char *s;
     int error, modcnt, minfolen;
-    Elf_Addr v, p, p_stop;
+    Elf_Addr v, p;
 
-    if (__elfN(lookup_symbol)(fp, ef, "__start_set_modmetadata_set", &sym) != 0)
-	return 0;
-    p = sym.st_value + ef->off;
-    if (__elfN(lookup_symbol)(fp, ef, "__stop_set_modmetadata_set", &sym) != 0)
-	return ENOENT;
-    p_stop = sym.st_value + ef->off;
-
     modcnt = 0;
-    while (p < p_stop) {
+    p = p_start;
+    while (p < p_end) {
 	COPYOUT(p, &v, sizeof(v));
 	error = __elfN(reloc_ptr)(fp, ef, p, &v, sizeof(v));
 	if (error == EOPNOTSUPP)
@@ -638,12 +840,24 @@
 	md.md_type = md64.md_type;
 	md.md_cval = (const char *)(uintptr_t)md64.md_cval;
 	md.md_data = (void *)(uintptr_t)md64.md_data;
+#elif defined(__amd64__) && __ELF_WORD_SIZE == 32
+	COPYOUT(v, &md32, sizeof(md32));
+	error = __elfN(reloc_ptr)(fp, ef, v, &md32, sizeof(md32));
+	if (error == EOPNOTSUPP) {
+	    md32.md_cval += ef->off;
+	    md32.md_data += ef->off;
+	} else if (error != 0)
+	    return (error);
+	md.md_version = md32.md_version;
+	md.md_type = md32.md_type;
+	md.md_cval = (const char *)(uintptr_t)md32.md_cval;
+	md.md_data = (void *)(uintptr_t)md32.md_data;
 #else
 	COPYOUT(v, &md, sizeof(md));
 	error = __elfN(reloc_ptr)(fp, ef, v, &md, sizeof(md));
 	if (error == EOPNOTSUPP) {
 	    md.md_cval += ef->off;
-	    md.md_data += ef->off;
+	    md.md_data = (void *)((uintptr_t)md.md_data + (uintptr_t)ef->off);
 	} else if (error != 0)
 	    return (error);
 #endif

Modified: trunk/sys/boot/common/load_elf32.c
===================================================================
--- trunk/sys/boot/common/load_elf32.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/load_elf32.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,6 +1,8 @@
+/* $MidnightBSD$ */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/load_elf32.c 267399 2014-06-12 15:20:59Z jhb $");
 
 #define __ELF_WORD_SIZE 32
+#define	_MACHINE_ELF_WANT_32BIT
 
 #include "load_elf.c"

Modified: trunk/sys/boot/common/load_elf_obj.c
===================================================================
--- trunk/sys/boot/common/load_elf_obj.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/load_elf_obj.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004 Ian Dowse <iedowse at freebsd.org>
  * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/load_elf_obj.c 298493 2016-04-22 21:38:37Z emaste $");
 
 #include <sys/param.h>
 #include <sys/exec.h>
@@ -129,7 +130,7 @@
 		goto oerr;
 	}
 
-	kfp = file_findfile(NULL, NULL);
+	kfp = file_findfile(NULL, __elfN(obj_kerneltype));
 	if (kfp == NULL) {
 		printf("elf" __XSTRING(__ELF_WORD_SIZE)
 		    "_obj_loadfile: can't load module before kernel\n");
@@ -136,13 +137,6 @@
 		err = EPERM;
 		goto oerr;
 	}
-	if (strcmp(__elfN(obj_kerneltype), kfp->f_type)) {
-		printf("elf" __XSTRING(__ELF_WORD_SIZE)
-		    "_obj_loadfile: can't load module with kernel type '%s'\n",
-		    kfp->f_type);
-		err = EPERM;
-		goto oerr;
-	}
 
 	if (archsw.arch_loadaddr != NULL)
 		dest = archsw.arch_loadaddr(LOAD_ELF, hdr, dest);
@@ -419,6 +413,7 @@
 			modcnt++;
 			break;
 		case MDT_MODULE:
+		case MDT_PNP_INFO:
 			break;
 		default:
 			printf("unknown type %d\n", md.md_type);
@@ -529,10 +524,8 @@
 {
 	Elf_Sym sym;
 	Elf_Addr base;
-	int symcnt;
 
-	symcnt = ef->e_shdr[ef->symtabindex].sh_size / sizeof(Elf_Sym);
-	if (symidx >= symcnt)
+	if (symidx >= ef->e_shdr[ef->symtabindex].sh_size / sizeof(Elf_Sym))
 		return (0);
 	COPYOUT(ef->e_shdr[ef->symtabindex].sh_addr + symidx * sizeof(Elf_Sym),
 	    &sym, sizeof(sym));

Modified: trunk/sys/boot/common/loader.8
===================================================================
--- trunk/sys/boot/common/loader.8	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/loader.8	2018-06-02 14:09:31 UTC (rev 10212)
@@ -23,9 +23,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $MidnightBSD$
-.\" $FreeBSD: stable/9/sys/boot/common/loader.8 266013 2014-05-14 13:45:51Z marius $
+.\" $FreeBSD: stable/10/sys/boot/common/loader.8 291295 2015-11-25 08:58:07Z smh $
 .\"
-.Dd October 1, 2013
+.Dd November 18, 2015
 .Dt LOADER 8
 .Os
 .Sh NAME
@@ -208,12 +208,18 @@
 .Op Fl t Ar type
 .Ar file Cm ...
 .Xc
-Loads a kernel, kernel loadable module (kld), or file of opaque
-contents tagged as being of the type
+Loads a kernel, kernel loadable module (kld), disk image,
+or file of opaque contents tagged as being of the type
 .Ar type .
 Kernel and modules can be either in a.out or ELF format.
 Any arguments passed after the name of the file to be loaded
 will be passed as arguments to that file.
+Use the
+.Li md_image
+type to make the kernel create a file-backed
+.Xr md 4
+disk.
+This is useful for booting from a temporary rootfs.
 Currently, argument passing does not work for the kernel.
 .Pp
 .It Ic load_geli Xo
@@ -466,6 +472,14 @@
 .It Va currdev
 Selects the default device.
 Syntax for devices is odd.
+.It Va dumpdev
+Sets the device for kernel dumps.
+This can be used to ensure that a device is configured before the corresponding
+.Va dumpdev
+directive from
+.Xr rc.conf 5
+has been processed, allowing kernel panics that happen during the early stages
+of boot to be captured.
 .It Va init_chroot
 If set to a valid directory in the root file system, it causes
 .Xr init 8
@@ -481,7 +495,7 @@
 process.
 The first matching binary is used.
 The default list is
-.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall .
+.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init .
 .It Va init_script
 If set to a valid file name in the root file system,
 instructs
@@ -671,6 +685,13 @@
 .Dv TCBHASHSIZE
 or the preset default of 512.
 Must be a power of 2.
+.It Va twiddle_divisor
+Throttles the output of the 
+.Sq twiddle
+I/O progress indicator displayed while loading the kernel and modules.
+This is useful on slow serial consoles where the time spent waiting for
+these characters to be written can add up to many seconds.
+The default is 1 (full speed); a value of 2 spins half as fast, and so on.
 .It Va vm.kmem_size
 Sets the size of kernel memory (bytes).
 This overrides the value determined when the kernel was compiled.

Modified: trunk/sys/boot/common/ls.c
===================================================================
--- trunk/sys/boot/common/ls.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/ls.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * $NetBSD: ls.c,v 1.3 1997/06/13 13:48:47 drochner Exp $
  */
@@ -38,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/ls.c 316319 2017-03-31 04:43:25Z ngie $");
 
 #include <sys/param.h>
 #include <ufs/ufs/dinode.h>
@@ -139,9 +140,8 @@
     struct stat	sb;
     int		fd;
     const char	*cp;
-    char	*path, *tail;
+    char	*path;
     
-    tail = NULL;
     fd = -1;
 
     /* one extra byte for a possible trailing slash required */

Modified: trunk/sys/boot/common/misc.c
===================================================================
--- trunk/sys/boot/common/misc.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/misc.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/misc.c 294981 2016-01-28 12:11:42Z smh $");
 
 #include <string.h>
 #include <stand.h>
@@ -118,14 +119,12 @@
 int
 kern_pread(int fd, vm_offset_t dest, size_t len, off_t off)
 {
-	ssize_t nread;
 
 	if (lseek(fd, off, SEEK_SET) == -1) {
 		printf("\nlseek failed\n");
 		return (-1);
 	}
-	nread = archsw.arch_readin(fd, dest, len);
-	if (nread != len) {
+	if ((size_t)archsw.arch_readin(fd, dest, len) != len) {
 		printf("\nreadin failed\n");
 		return (-1);
 	}
@@ -140,7 +139,6 @@
 alloc_pread(int fd, off_t off, size_t len)
 {
 	void *buf;
-	ssize_t nread;
 
 	buf = malloc(len);
 	if (buf == NULL) {
@@ -152,8 +150,7 @@
 		free(buf);
 		return (NULL);
 	}
-	nread = read(fd, buf, len);
-	if (nread != len) {
+	if ((size_t)read(fd, buf, len) != len) {
 		printf("\nread failed\n");
 		free(buf);
 		return (NULL);

Modified: trunk/sys/boot/common/module.c
===================================================================
--- trunk/sys/boot/common/module.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/module.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/module.c 294985 2016-01-28 12:23:25Z smh $");
 
 /*
  * file/module function dispatcher, support, etc.
@@ -52,7 +53,6 @@
 };
 
 static int			file_load(char *filename, vm_offset_t dest, struct preloaded_file **result);
-static int			file_loadraw(char *type, char *name);
 static int			file_load_dependencies(struct preloaded_file *base_mod);
 static char *			file_search(const char *name, char **extlist);
 static struct kernel_module *	file_findmodule(struct preloaded_file *fp, char *modname, struct mod_depend *verinfo);
@@ -66,7 +66,12 @@
 /* load address should be tweaked by first module loaded (kernel) */
 static vm_offset_t	loadaddr = 0;
 
+#if defined(LOADER_FDT_SUPPORT)
+static const char	*default_searchpath =
+    "/boot/kernel;/boot/modules;/boot/dtb";
+#else
 static const char	*default_searchpath ="/boot/kernel;/boot/modules";
+#endif
 
 static STAILQ_HEAD(, moduledir) moduledir_list = STAILQ_HEAD_INITIALIZER(moduledir_list);
 
@@ -97,6 +102,7 @@
 static int
 command_load(int argc, char *argv[])
 {
+    struct preloaded_file *fp;
     char	*typestr;
     int		dofile, dokld, ch, error;
     
@@ -106,7 +112,7 @@
     typestr = NULL;
     if (argc == 1) {
 	command_errmsg = "no filename specified";
-	return(CMD_ERROR);
+	return (CMD_CRIT);
     }
     while ((ch = getopt(argc, argv, "kt:")) != -1) {
 	switch(ch) {
@@ -120,7 +126,7 @@
 	case '?':
 	default:
 	    /* getopt has already reported an error */
-	    return(CMD_OK);
+	    return (CMD_OK);
 	}
     }
     argv += (optind - 1);
@@ -132,9 +138,23 @@
     if (dofile) {
 	if ((argc != 2) || (typestr == NULL) || (*typestr == 0)) {
 	    command_errmsg = "invalid load type";
-	    return(CMD_ERROR);
+	    return (CMD_CRIT);
 	}
-	return(file_loadraw(typestr, argv[1]));
+
+	fp = file_findfile(argv[1], typestr);
+	if (fp) {
+		sprintf(command_errbuf, "warning: file '%s' already loaded", argv[1]);
+		return (CMD_WARN);
+	}
+
+	if (file_loadraw(argv[1], typestr, 1) != NULL)
+		return (CMD_OK);
+
+	/* Failing to load mfs_root is never going to end well! */
+	if (strcmp("mfs_root", typestr) == 0)
+		return (CMD_FATAL);
+
+	return (CMD_ERROR);
     }
     /*
      * Do we have explicit KLD load ?
@@ -141,17 +161,23 @@
      */
     if (dokld || file_havepath(argv[1])) {
 	error = mod_loadkld(argv[1], argc - 2, argv + 2);
-	if (error == EEXIST)
+	if (error == EEXIST) {
 	    sprintf(command_errbuf, "warning: KLD '%s' already loaded", argv[1]);
-	return (error == 0 ? CMD_OK : CMD_ERROR);
+	    return (CMD_WARN);
+	}
+	
+	return (error == 0 ? CMD_OK : CMD_CRIT);
     }
     /*
      * Looks like a request for a module.
      */
     error = mod_load(argv[1], NULL, argc - 2, argv + 2);
-    if (error == EEXIST)
+    if (error == EEXIST) {
 	sprintf(command_errbuf, "warning: module '%s' already loaded", argv[1]);
-    return (error == 0 ? CMD_OK : CMD_ERROR);
+	return (CMD_WARN);
+    }
+
+    return (error == 0 ? CMD_OK : CMD_CRIT);
 }
 
 COMMAND_SET(load_geli, "load_geli", "load a geli key", command_load_geli);
@@ -189,7 +215,7 @@
     argv += (optind - 1);
     argc -= (optind - 1);
     sprintf(typestr, "%s:geli_keyfile%d", argv[1], num);
-    return(file_loadraw(typestr, argv[2]));
+    return (file_loadraw(argv[2], typestr, 1) ? CMD_OK : CMD_ERROR);
 }
 
 COMMAND_SET(unload, "unload", "unload all modules", command_unload);
@@ -352,15 +378,16 @@
     }
     return (error);
 }
+
 /*
- * We've been asked to load (name) as (type), so just suck it in,
+ * We've been asked to load (fname) as (type), so just suck it in,
  * no arguments or anything.
  */
-int
-file_loadraw(char *type, char *name)
+struct preloaded_file *
+file_loadraw(const char *fname, char *type, int insert)
 {
     struct preloaded_file	*fp;
-    char			*cp;
+    char			*name;
     int				fd, got;
     vm_offset_t			laddr;
 
@@ -367,21 +394,20 @@
     /* We can't load first */
     if ((file_findfile(NULL, NULL)) == NULL) {
 	command_errmsg = "can't load file before kernel";
-	return(CMD_ERROR);
+	return(NULL);
     }
 
     /* locate the file on the load path */
-    cp = file_search(name, NULL);
-    if (cp == NULL) {
-	sprintf(command_errbuf, "can't find '%s'", name);
-	return(CMD_ERROR);
+    name = file_search(fname, NULL);
+    if (name == NULL) {
+	sprintf(command_errbuf, "can't find '%s'", fname);
+	return(NULL);
     }
-    name = cp;
 
     if ((fd = open(name, O_RDONLY)) < 0) {
 	sprintf(command_errbuf, "can't open '%s': %s", name, strerror(errno));
 	free(name);
-	return(CMD_ERROR);
+	return(NULL);
     }
 
     if (archsw.arch_loadaddr != NULL)
@@ -397,7 +423,7 @@
 	    sprintf(command_errbuf, "error reading '%s': %s", name, strerror(errno));
 	    free(name);
 	    close(fd);
-	    return(CMD_ERROR);
+	    return(NULL);
 	}
 	laddr += got;
     }
@@ -416,9 +442,10 @@
     loadaddr = laddr;
 
     /* Add to the list of loaded files */
-    file_insert_tail(fp);
+    if (insert != 0)
+    	file_insert_tail(fp);
     close(fd);
-    return(CMD_OK);
+    return(fp);
 }
 
 /*
@@ -519,7 +546,7 @@
  * NULL may be passed as a wildcard to either.
  */
 struct preloaded_file *
-file_findfile(char *name, char *type)
+file_findfile(const char *name, const char *type)
 {
     struct preloaded_file *fp;
 
@@ -956,7 +983,7 @@
 {
     struct	moduledir *mdp, *mtmp;
     const char	*path, *cp, *ep;
-    int		cplen;
+    size_t	cplen;
 
     path = getenv("module_path");
     if (path == NULL)

Modified: trunk/sys/boot/common/part.c
===================================================================
--- trunk/sys/boot/common/part.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/part.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/9/sys/boot/common/part.c 272934 2014-10-11 06:22:57Z ae $");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/part.c 323052 2017-08-31 13:32:01Z oleg $");
 
 #include <stand.h>
 #include <sys/param.h>
@@ -52,14 +52,14 @@
 #define	MAXTBLSZ	64
 static const uuid_t gpt_uuid_unused = GPT_ENT_TYPE_UNUSED;
 static const uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA;
-static const uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
+static const uuid_t gpt_uuid_midnightbsd_ufs = GPT_ENT_TYPE_MIDNIGHTBSD_UFS;
 static const uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI;
-static const uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD;
-static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
-static const uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS;
-static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
-static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
-static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
+static const uuid_t gpt_uuid_midnightbsd = GPT_ENT_TYPE_MIDNIGHTBSD;
+static const uuid_t gpt_uuid_midnightbsd_boot = GPT_ENT_TYPE_MIDNIGHTBSD_BOOT;
+static const uuid_t gpt_uuid_midnightbsd_nandfs = GPT_ENT_TYPE_MIDNIGHTBSD_NANDFS;
+static const uuid_t gpt_uuid_midnightbsd_swap = GPT_ENT_TYPE_MIDNIGHTBSD_SWAP;
+static const uuid_t gpt_uuid_midnightsd_zfs = GPT_ENT_TYPE_MIDNIGHTBSD_ZFS;
+static const uuid_t gpt_uuid_midnightbsd_vinum = GPT_ENT_TYPE_MIDNIGHTBSD_VINUM;
 #endif
 
 struct pentry {
@@ -88,13 +88,13 @@
 } ptypes[] = {
 	{ PART_UNKNOWN,		"Unknown" },
 	{ PART_EFI,		"EFI" },
-	{ PART_FREEBSD,		"FreeBSD" },
-	{ PART_FREEBSD_BOOT,	"FreeBSD boot" },
-	{ PART_FREEBSD_NANDFS,	"FreeBSD nandfs" },
-	{ PART_FREEBSD_UFS,	"FreeBSD UFS" },
-	{ PART_FREEBSD_ZFS,	"FreeBSD ZFS" },
-	{ PART_FREEBSD_SWAP,	"FreeBSD swap" },
-	{ PART_FREEBSD_VINUM,	"FreeBSD vinum" },
+	{ PART_MIDNIGHTBSD,		"FreeBSD" },
+	{ PART_MIDNIGHTBSD_BOOT,	"FreeBSD boot" },
+	{ PART_MIDNIGHTBSD_NANDFS,	"FreeBSD nandfs" },
+	{ PART_MIDNIGHTBSD_UFS,	"FreeBSD UFS" },
+	{ PART_MIDNIGHTBSD_ZFS,	"FreeBSD ZFS" },
+	{ PART_MIDNIGHTBSD_SWAP,	"FreeBSD swap" },
+	{ PART_MIDNIGHTBSD_VINUM,	"FreeBSD vinum" },
 	{ PART_LINUX,		"Linux" },
 	{ PART_LINUX_SWAP,	"Linux swap" },
 	{ PART_DOS,		"DOS/Windows" },
@@ -103,7 +103,7 @@
 const char *
 parttype2str(enum partition_type type)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < sizeof(ptypes) / sizeof(ptypes[0]); i++)
 		if (ptypes[i].type == type)
@@ -129,20 +129,20 @@
 		return (PART_EFI);
 	else if (uuid_equal(&type, &gpt_uuid_ms_basic_data, NULL))
 		return (PART_DOS);
-	else if (uuid_equal(&type, &gpt_uuid_freebsd_boot, NULL))
-		return (PART_FREEBSD_BOOT);
-	else if (uuid_equal(&type, &gpt_uuid_freebsd_ufs, NULL))
-		return (PART_FREEBSD_UFS);
-	else if (uuid_equal(&type, &gpt_uuid_freebsd_zfs, NULL))
-		return (PART_FREEBSD_ZFS);
-	else if (uuid_equal(&type, &gpt_uuid_freebsd_swap, NULL))
-		return (PART_FREEBSD_SWAP);
-	else if (uuid_equal(&type, &gpt_uuid_freebsd_vinum, NULL))
-		return (PART_FREEBSD_VINUM);
-	else if (uuid_equal(&type, &gpt_uuid_freebsd_nandfs, NULL))
-		return (PART_FREEBSD_NANDFS);
-	else if (uuid_equal(&type, &gpt_uuid_freebsd, NULL))
-		return (PART_FREEBSD);
+	else if (uuid_equal(&type, &gpt_uuid_midnightbsd_boot, NULL))
+		return (PART_MIDNIGHTBSD_BOOT);
+	else if (uuid_equal(&type, &gpt_uuid_midnightbsd_ufs, NULL))
+		return (PART_MIDNIGHTBSD_UFS);
+	else if (uuid_equal(&type, &gpt_uuid_midnightbsd_zfs, NULL))
+		return (PART_MIDNIGHTBSD_ZFS);
+	else if (uuid_equal(&type, &gpt_uuid_midnightbsd_swap, NULL))
+		return (PART_MIDNIGHTBSD_SWAP);
+	else if (uuid_equal(&type, &gpt_uuid_midnightbsd_vinum, NULL))
+		return (PART_MIDNIGHTBSD_VINUM);
+	else if (uuid_equal(&type, &gpt_uuid_midnightbsd_nandfs, NULL))
+		return (PART_MIDNIGHTBSD_NANDFS);
+	else if (uuid_equal(&type, &gpt_uuid_midnightbsd, NULL))
+		return (PART_MIDNIGHTBSD);
 	return (PART_UNKNOWN);
 }
 
@@ -204,7 +204,7 @@
     uint64_t lba_last)
 {
 	struct gpt_ent *ent;
-	int i, cnt;
+	uint32_t i, cnt;
 
 	cnt = size / hdr->hdr_entsz;
 	if (hdr->hdr_entries <= cnt) {
@@ -235,8 +235,8 @@
 	struct gpt_ent *ent;
 	u_char *buf, *tbl;
 	uint64_t offset;
-	int pri, sec, i;
-	size_t size;
+	int pri, sec;
+	size_t size, i;
 
 	buf = malloc(table->sectorsize);
 	if (buf == NULL)
@@ -307,6 +307,7 @@
 		table->type = PTABLE_NONE;
 		goto out;
 	}
+	DEBUG("GPT detected");
 	size = MIN(hdr.hdr_entries * hdr.hdr_entsz,
 	    MAXTBLSZ * table->sectorsize);
 	for (i = 0; i < size / hdr.hdr_entsz; i++) {
@@ -341,7 +342,7 @@
 
 	switch (type) {
 	case DOSPTYP_386BSD:
-		return (PART_FREEBSD);
+		return (PART_MIDNIGHTBSD);
 	case DOSPTYP_LINSWP:
 		return (PART_LINUX_SWAP);
 	case DOSPTYP_LINUX:
@@ -358,7 +359,7 @@
 	return (PART_UNKNOWN);
 }
 
-struct ptable*
+static struct ptable*
 ptable_ebrread(struct ptable *table, void *dev, diskread_t dread)
 {
 	struct dos_partition *dp;
@@ -422,20 +423,20 @@
 
 	switch (type) {
 	case FS_NANDFS:
-		return (PART_FREEBSD_NANDFS);
+		return (PART_MDINIGHTBSD_NANDFS);
 	case FS_SWAP:
-		return (PART_FREEBSD_SWAP);
+		return (PART_MIDNIGHTBSD_SWAP);
 	case FS_BSDFFS:
-		return (PART_FREEBSD_UFS);
+		return (PART_MIDNIGHTBSD_UFS);
 	case FS_VINUM:
-		return (PART_FREEBSD_VINUM);
+		return (PART_MIDNIGHTBSD_VINUM);
 	case FS_ZFS:
-		return (PART_FREEBSD_ZFS);
+		return (PART_MIDNIGHTBSD_ZFS);
 	}
 	return (PART_UNKNOWN);
 }
 
-struct ptable*
+static struct ptable*
 ptable_bsdread(struct ptable *table, void *dev, diskread_t dread)
 {
 	struct disklabel *dl;
@@ -483,7 +484,7 @@
 			break;
 		entry->part.start = le32toh(part->p_offset) - raw_offset;
 		entry->part.end = entry->part.start +
-		    le32toh(part->p_size) + 1;
+		    le32toh(part->p_size) - 1;
 		entry->part.type = bsd_parttype(part->p_fstype);
 		entry->part.index = i; /* starts from zero */
 		entry->type.bsd = part->p_fstype;
@@ -502,16 +503,16 @@
 {
 
 	switch (type) {
-	case VTOC_TAG_FREEBSD_NANDFS:
-		return (PART_FREEBSD_NANDFS);
-	case VTOC_TAG_FREEBSD_SWAP:
-		return (PART_FREEBSD_SWAP);
-	case VTOC_TAG_FREEBSD_UFS:
-		return (PART_FREEBSD_UFS);
-	case VTOC_TAG_FREEBSD_VINUM:
-		return (PART_FREEBSD_VINUM);
-	case VTOC_TAG_FREEBSD_ZFS:
-		return (PART_FREEBSD_ZFS);
+	case VTOC_TAG_MIDNIGHTBSD_NANDFS:
+		return (PART_MIDNIGHTBSD_NANDFS);
+	case VTOC_TAG_MIDNIGHTBSD_SWAP:
+		return (PART_MIDNIGHTBSD_SWAP);
+	case VTOC_TAG_MIDNIGHTBSD_UFS:
+		return (PART_MIDNIGHTBSD_UFS);
+	case VTOC_TAG_MIDNIGHTBSD_VINUM:
+		return (PART_MIDNIGHTBSD_VINUM);
+	case VTOC_TAG_MIDNIGHTBSD_ZFS:
+		return (PART_MIDNIGHTBSD_ZFS);
 	};
 	return (PART_UNKNOWN);
 }
@@ -632,6 +633,11 @@
 	if (buf[DOSMAGICOFFSET] != 0x55 ||
 	    buf[DOSMAGICOFFSET + 1] != 0xaa) {
 		DEBUG("magic sequence not found");
+#if defined(LOADER_GPT_SUPPORT)
+		/* There is no PMBR, check that we have backup GPT */
+		table->type = PTABLE_GPT;
+		table = ptable_gptread(table, dev, dread);
+#endif
 		goto out;
 	}
 	/* Check that we have PMBR. Also do some validation. */
@@ -655,8 +661,9 @@
 		if (dp[1].dp_typ != DOSPTYP_HFS) {
 			table->type = PTABLE_NONE;
 			DEBUG("Incorrect PMBR, ignore it");
-		} else
+		} else {
 			DEBUG("Bootcamp detected");
+		}
 	}
 #ifdef LOADER_GPT_SUPPORT
 	if (table->type == PTABLE_GPT) {
@@ -800,8 +807,8 @@
 		if (table->type == PTABLE_GPT) {
 			if (entry->part.type == PART_DOS)
 				pref = PREF_DOS;
-			else if (entry->part.type == PART_FREEBSD_UFS ||
-			    entry->part.type == PART_FREEBSD_ZFS)
+			else if (entry->part.type == PART_MIDNIGHTBSD_UFS ||
+			    entry->part.type == PART_MIDNIGHTBSD_ZFS)
 				pref = PREF_FBSD;
 			else
 				pref = PREF_NONE;

Modified: trunk/sys/boot/common/part.h
===================================================================
--- trunk/sys/boot/common/part.h	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/part.h	2018-06-02 14:09:31 UTC (rev 10212)
@@ -43,13 +43,13 @@
 enum partition_type {
 	PART_UNKNOWN,
 	PART_EFI,
-	PART_FREEBSD,
-	PART_FREEBSD_BOOT,
-	PART_FREEBSD_NANDFS,
-	PART_FREEBSD_UFS,
-	PART_FREEBSD_ZFS,
-	PART_FREEBSD_SWAP,
-	PART_FREEBSD_VINUM,
+	PART_MIDNIGHTBSD,
+	PART_MIDNIGHTBSD_BOOT,
+	PART_MIDNIGHTBSD_NANDFS,
+	PART_MIDNIGHTBSD_UFS,
+	PART_MIDNIGHTBSD_ZFS,
+	PART_MIDNIGHTBSD_SWAP,
+	PART_MIDNIGHTBSD_VINUM,
 	PART_LINUX,
 	PART_LINUX_SWAP,
 	PART_DOS,

Added: trunk/sys/boot/common/paths.h
===================================================================
--- trunk/sys/boot/common/paths.h	                        (rev 0)
+++ trunk/sys/boot/common/paths.h	2018-06-02 14:09:31 UTC (rev 10212)
@@ -0,0 +1,40 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2016 M. Warner Losh <imp at freebsd.org>
+ * 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 AUTHORS 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 AUTHORS 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: stable/10/sys/boot/common/paths.h 295453 2016-02-09 22:32:24Z emaste $
+ */
+
+#ifndef _PATHS_H_
+#define	_PATHS_H_
+
+#define PATH_DOTCONFIG	"/boot.config"
+#define PATH_CONFIG	"/boot/config"
+#define PATH_LOADER	"/boot/loader"
+#define PATH_LOADER_EFI	"/boot/loader.efi"
+#define PATH_LOADER_ZFS	"/boot/zfsloader"
+#define PATH_KERNEL	"/boot/kernel/kernel"
+
+#endif /* _PATHS_H_ */


Property changes on: trunk/sys/boot/common/paths.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/boot/common/rbx.h
===================================================================
--- trunk/sys/boot/common/rbx.h	                        (rev 0)
+++ trunk/sys/boot/common/rbx.h	2018-06-02 14:09:31 UTC (rev 10212)
@@ -0,0 +1,62 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 1998 Robert Nordier
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are freely
+ * permitted provided that the above copyright notice and this
+ * paragraph and the following disclaimer are duplicated in all
+ * such forms.
+ *
+ * This software is provided "AS IS" and without any express or
+ * implied warranties, including, without limitation, the implied
+ * warranties of merchantability and fitness for a particular
+ * purpose.
+ *
+ * $FreeBSD: stable/10/sys/boot/common/rbx.h 295453 2016-02-09 22:32:24Z emaste $
+ */
+
+#ifndef _RBX_H_
+#define	_RBX_H_
+
+#define RBX_ASKNAME	0x0	/* -a */
+#define RBX_SINGLE	0x1	/* -s */
+/* 0x2 is reserved for log2(RB_NOSYNC). */
+/* 0x3 is reserved for log2(RB_HALT). */
+/* 0x4 is reserved for log2(RB_INITNAME). */
+#define RBX_DFLTROOT	0x5	/* -r */
+#define RBX_KDB 	0x6	/* -d */
+/* 0x7 is reserved for log2(RB_RDONLY). */
+/* 0x8 is reserved for log2(RB_DUMP). */
+/* 0x9 is reserved for log2(RB_MINIROOT). */
+#define RBX_CONFIG	0xa	/* -c */
+#define RBX_VERBOSE	0xb	/* -v */
+#define RBX_SERIAL	0xc	/* -h */
+#define RBX_CDROM	0xd	/* -C */
+/* 0xe is reserved for log2(RB_POWEROFF). */
+#define RBX_GDB 	0xf	/* -g */
+#define RBX_MUTE	0x10	/* -m */
+/* 0x11 is reserved for log2(RB_SELFTEST). */
+/* 0x12 is reserved for boot programs. */
+/* 0x13 is reserved for boot programs. */
+#define RBX_PAUSE	0x14	/* -p */
+#define RBX_QUIET	0x15	/* -q */
+#define RBX_NOINTR	0x1c	/* -n */
+/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
+#define RBX_DUAL	0x1d	/* -D */
+/* 0x1f is reserved for log2(RB_BOOTINFO). */
+
+/* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */
+#define RBX_MASK	(OPT_SET(RBX_ASKNAME) | OPT_SET(RBX_SINGLE) | \
+			OPT_SET(RBX_DFLTROOT) | OPT_SET(RBX_KDB ) | \
+			OPT_SET(RBX_CONFIG) | OPT_SET(RBX_VERBOSE) | \
+			OPT_SET(RBX_SERIAL) | OPT_SET(RBX_CDROM) | \
+			OPT_SET(RBX_GDB ) | OPT_SET(RBX_MUTE) | \
+			OPT_SET(RBX_PAUSE) | OPT_SET(RBX_DUAL))
+
+#define OPT_SET(opt)	(1 << (opt))
+#define OPT_CHECK(opt)	((opts) & OPT_SET(opt))
+
+extern uint32_t opts;
+
+#endif	/* !_RBX_H_ */


Property changes on: trunk/sys/boot/common/rbx.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/boot/common/reloc_elf64.c
===================================================================
--- trunk/sys/boot/common/reloc_elf64.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/reloc_elf64.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/reloc_elf64.c 134458 2004-08-28 23:03:05Z iedowse $");
 
 #define __ELF_WORD_SIZE 64
 

Added: trunk/sys/boot/common/self_reloc.c
===================================================================
--- trunk/sys/boot/common/self_reloc.c	                        (rev 0)
+++ trunk/sys/boot/common/self_reloc.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -0,0 +1,126 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2008-2010 Rui Paulo <rpaulo at FreeBSD.org>
+ * 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/self_reloc.c 294981 2016-01-28 12:11:42Z smh $");
+
+#include <sys/types.h>
+#include <elf.h>
+#include <bootstrap.h>
+
+#if defined(__aarch64__)
+#define	ElfW_Rel	Elf64_Rela
+#define	ElfW_Dyn	Elf64_Dyn
+#define	ELFW_R_TYPE	ELF64_R_TYPE
+#define	ELF_RELA
+#elif defined(__arm__) || defined(__i386__)
+#define	ElfW_Rel	Elf32_Rel
+#define	ElfW_Dyn	Elf32_Dyn
+#define	ELFW_R_TYPE	ELF32_R_TYPE
+#elif defined(__amd64__)
+#define	ElfW_Rel	Elf64_Rel
+#define	ElfW_Dyn	Elf64_Dyn
+#define	ELFW_R_TYPE	ELF64_R_TYPE
+#else
+#error architecture not supported
+#endif
+#if defined(__aarch64__)
+#define	RELOC_TYPE_NONE		R_AARCH64_NONE
+#define	RELOC_TYPE_RELATIVE	R_AARCH64_RELATIVE
+#elif defined(__amd64__)
+#define	RELOC_TYPE_NONE		R_X86_64_NONE
+#define	RELOC_TYPE_RELATIVE	R_X86_64_RELATIVE
+#elif defined(__arm__)
+#define	RELOC_TYPE_NONE		R_ARM_NONE
+#define	RELOC_TYPE_RELATIVE	R_ARM_RELATIVE
+#elif defined(__i386__)
+#define	RELOC_TYPE_NONE		R_386_NONE
+#define	RELOC_TYPE_RELATIVE	R_386_RELATIVE
+#endif
+
+void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic);
+
+/*
+ * A simple elf relocator.
+ */
+void
+self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic)
+{
+	Elf_Word relsz, relent;
+	Elf_Addr *newaddr;
+	ElfW_Rel *rel;
+	ElfW_Dyn *dynp;
+
+	/*
+	 * Find the relocation address, its size and the relocation entry.
+	 */
+	relsz = 0;
+	relent = 0;
+	for (dynp = dynamic; dynp->d_tag != DT_NULL; dynp++) {
+		switch (dynp->d_tag) {
+		case DT_REL:
+		case DT_RELA:
+			rel = (ElfW_Rel *)(dynp->d_un.d_ptr + baseaddr);
+			break;
+		case DT_RELSZ:
+		case DT_RELASZ:
+			relsz = dynp->d_un.d_val;
+			break;
+		case DT_RELENT:
+		case DT_RELAENT:
+			relent = dynp->d_un.d_val;
+			break;
+		default:
+			break;
+		}
+	}
+
+	/*
+	 * Perform the actual relocation.
+	 */
+	for (; relsz > 0; relsz -= relent) {
+		switch (ELFW_R_TYPE(rel->r_info)) {
+		case RELOC_TYPE_NONE:
+			/* No relocation needs be performed. */
+			break;
+
+		case RELOC_TYPE_RELATIVE:
+			/* Address relative to the base address. */
+			newaddr = (Elf_Addr *)(rel->r_offset + baseaddr);
+			*newaddr += baseaddr;
+			/* Add the addend when the ABI uses them */ 
+#ifdef ELF_RELA
+			*newaddr += rel->r_addend;
+#endif
+			break;
+		default:
+			/* XXX: do we need other relocations ? */
+			break;
+		}
+		rel = (ElfW_Rel *)(void *)((caddr_t) rel + relent);
+	}
+}


Property changes on: trunk/sys/boot/common/self_reloc.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/boot/common/ufsread.c
===================================================================
--- trunk/sys/boot/common/ufsread.c	2018-06-02 13:45:11 UTC (rev 10211)
+++ trunk/sys/boot/common/ufsread.c	2018-06-02 14:09:31 UTC (rev 10212)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002 McAfee, Inc.
  * All rights reserved.
@@ -44,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/common/ufsread.c 294997 2016-01-28 16:52:02Z smh $");
 
 #include <ufs/ufs/dinode.h>
 #include <ufs/ufs/dir.h>
@@ -58,6 +59,8 @@
 #define cgbase(fs, c)   ((ufs2_daddr_t)((fs)->fs_fpg * (c)))
 #endif
 
+typedef	uint32_t	ufs_ino_t;
+
 /*
  * We use 4k `virtual' blocks for filesystem data, whatever the actual
  * filesystem block size. FFS blocks are always a multiple of 4k.
@@ -85,14 +88,14 @@
 };
 static struct dmadat *dmadat;
 
-static ino_t lookup(const char *);
-static ssize_t fsread(ino_t, void *, size_t);
+static ufs_ino_t lookup(const char *);
+static ssize_t fsread(ufs_ino_t, void *, size_t);
 
 static uint8_t ls, dsk_meta;
 static uint32_t fs_off;
 
 static __inline uint8_t
-fsfind(const char *name, ino_t * ino)
+fsfind(const char *name, ufs_ino_t * ino)
 {
 	static char buf[DEV_BSIZE];
 	struct direct *d;
@@ -116,12 +119,12 @@
 	return 0;
 }
 
-static ino_t
+static ufs_ino_t
 lookup(const char *path)
 {
 	static char name[MAXNAMLEN + 1];
 	const char *s;
-	ino_t ino;
+	ufs_ino_t ino;
 	ssize_t n;
 	uint8_t dt;
 
@@ -163,7 +166,7 @@
 #endif
 
 static ssize_t
-fsread(ino_t inode, void *buf, size_t nbyte)
+fsread_size(ufs_ino_t inode, void *buf, size_t nbyte, size_t *fsizep)
 {
 #ifndef UFS2_ONLY
 	static struct ufs1_dinode dp1;
@@ -173,7 +176,7 @@
 	static struct ufs2_dinode dp2;
 #endif
 	static struct fs fs;
-	static ino_t inomap;
+	static ufs_ino_t inomap;
 	char *blkbuf;
 	void *indbuf;
 	char *s;
@@ -183,10 +186,21 @@
 	static ufs2_daddr_t blkmap, indmap;
 	u_int u;
 
+	/* Basic parameter validation. */
+	if ((buf == NULL && nbyte != 0) || dmadat == NULL)
+		return (-1);
+
 	blkbuf = dmadat->blkbuf;
 	indbuf = dmadat->indbuf;
-	if (!dsk_meta) {
+
+	/*
+	 * Force probe if inode is zero to ensure we have a valid fs, otherwise
+	 * when probing multiple paritions, reads from subsequent parititions
+	 * will incorrectly succeed.
+	 */
+	if (!dsk_meta || inode == 0) {
 		inomap = 0;
+		dsk_meta = 0;
 		for (n = 0; sblock_try[n] != -1; n++) {
 			if (dskread(dmadat->sbbuf, sblock_try[n] / DEV_BSIZE,
 			    SBLOCKSIZE / DEV_BSIZE))
@@ -205,11 +219,10 @@
 #endif
 			    ) &&
 			    fs.fs_bsize <= MAXBSIZE &&
-			    fs.fs_bsize >= sizeof(struct fs))
+			    fs.fs_bsize >= (int32_t)sizeof(struct fs))
 				break;
 		}
 		if (sblock_try[n] == -1) {
-			printf("Not ufs\n");
 			return -1;
 		}
 		dsk_meta++;
@@ -223,18 +236,18 @@
 			return -1;
 		n = INO_TO_VBO(n, inode);
 #if defined(UFS1_ONLY)
-		memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
-		    sizeof(struct ufs1_dinode));
+		memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n,
+		    sizeof(dp1));
 #elif defined(UFS2_ONLY)
-		memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
-		    sizeof(struct ufs2_dinode));
+		memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n,
+		    sizeof(dp2));
 #else
 		if (fs.fs_magic == FS_UFS1_MAGIC)
-			memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
-			    sizeof(struct ufs1_dinode));
+			memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n,
+			    sizeof(dp1));
 		else
-			memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
-			    sizeof(struct ufs2_dinode));
+			memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n,
+			    sizeof(dp2));
 #endif
 		inomap = inode;
 		fs_off = 0;
@@ -282,7 +295,7 @@
 			return -1;
 		vbaddr = fsbtodb(&fs, addr2) + (off >> VBLKSHIFT) * DBPERVBLK;
 		vboff = off & VBLKMASK;
-		n = sblksize(&fs, size, lbn) - (off & ~VBLKMASK);
+		n = sblksize(&fs, (off_t)size, lbn) - (off & ~VBLKMASK);
 		if (n > VBLKSIZE)
 			n = VBLKSIZE;
 		if (blkmap != vbaddr) {
@@ -298,5 +311,17 @@
 		fs_off += n;
 		nb -= n;
 	}
+
+	if (fsizep != NULL)
+		*fsizep = size;
+
 	return nbyte;
 }
+
+static ssize_t
+fsread(ufs_ino_t inode, void *buf, size_t nbyte)
+{
+
+	return fsread_size(inode, buf, nbyte, NULL);
+}
+



More information about the Midnightbsd-cvs mailing list