summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386/loader/main.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1998-09-26 01:31:10 +0000
committermsmith <msmith@FreeBSD.org>1998-09-26 01:31:10 +0000
commit73ca5cb35b01711ebbbdbdc1d00d3f320d0a852c (patch)
treec931c7dd05faa4436e944c901689d9ce74a97a0a /sys/boot/i386/loader/main.c
parentac22d58edf1712c91a71e643b18fed3ef6c05f09 (diff)
downloadFreeBSD-src-73ca5cb35b01711ebbbdbdc1d00d3f320d0a852c.zip
FreeBSD-src-73ca5cb35b01711ebbbdbdc1d00d3f320d0a852c.tar.gz
Recover the arguments passed in from the previous load stage, use them to set
the default console. Print malloc stats from the new libstand allocator.
Diffstat (limited to 'sys/boot/i386/loader/main.c')
-rw-r--r--sys/boot/i386/loader/main.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c
index 9f1de34..d70a370 100644
--- a/sys/boot/i386/loader/main.c
+++ b/sys/boot/i386/loader/main.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: main.c,v 1.5 1998/09/17 23:52:15 msmith Exp $
+ * $Id: main.c,v 1.6 1998/09/18 02:03:30 msmith Exp $
*/
/*
@@ -33,11 +33,26 @@
#include <stand.h>
#include <string.h>
+#include <machine/bootinfo.h>
+#include <sys/reboot.h>
#include "bootstrap.h"
#include "libi386/libi386.h"
#include "btxv86.h"
+/* Arguments passed in from the boot1/boot2 loader */
+static struct
+{
+ u_int32_t howto;
+ u_int32_t bootdev;
+ u_int32_t res0;
+ u_int32_t res1;
+ u_int32_t res2;
+ u_int32_t bootinfo;
+} *kargs;
+
+struct bootinfo *initial_bootinfo;
+
struct arch_switch archsw; /* MI/MD interface boundary */
/* from vers.c */
@@ -52,6 +67,10 @@ main(void)
struct i386_devdesc currdev;
int i;
+ /* Pick up arguments */
+ kargs = (void *)__args;
+ initial_bootinfo = (struct bootinfo *)PTOV(kargs->bootinfo);
+
/*
* Initialise the heap as early as possible. Once this is done, malloc() is usable.
*
@@ -65,7 +84,10 @@ main(void)
* can't do yet.
*
* We can use printf() etc. once this is done.
+ * If the previous boot stage has requested a serial console, prefer that.
*/
+ if (kargs->howto & RB_SERIAL)
+ setenv("console", "com", 1);
cons_probe();
/*
@@ -154,6 +176,7 @@ COMMAND_SET(heap, "heap", "show heap usage", command_heap);
static int
command_heap(int argc, char *argv[])
{
- printf("heap base at %p, top at %p, used %d\n", end, sbrk(0), sbrk(0) - end);
+ mallocstats();
+ printf("heap base at %p, top at %p", end, sbrk(0));
return(CMD_OK);
}
OpenPOWER on IntegriCloud