From owner-svn-src-all@FreeBSD.ORG Tue Jul 26 13:12:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4854106566B; Tue, 26 Jul 2011 13:12:08 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A11F8FC16; Tue, 26 Jul 2011 13:12:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6QDC8Z3009486; Tue, 26 Jul 2011 13:12:08 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6QDC8AO009484; Tue, 26 Jul 2011 13:12:08 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201107261312.p6QDC8AO009484@svn.freebsd.org> From: Marius Strobl Date: Tue, 26 Jul 2011 13:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224426 - stable/7/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2011 13:12:08 -0000 Author: marius Date: Tue Jul 26 13:12:08 2011 New Revision: 224426 URL: http://svn.freebsd.org/changeset/base/224426 Log: MFC: r219960 MFi386: the part of 219452 - bunch of variables are turned into uint8_t. - the setting and reading of "fmt" in load() is removed. - buf in printf() is made static to save space. Modified: stable/7/sys/boot/pc98/boot2/boot2.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/pc98/boot2/boot2.c ============================================================================== --- stable/7/sys/boot/pc98/boot2/boot2.c Tue Jul 26 13:06:21 2011 (r224425) +++ stable/7/sys/boot/pc98/boot2/boot2.c Tue Jul 26 13:12:08 2011 (r224426) @@ -137,7 +137,7 @@ static const char *kname = NULL; static uint32_t opts; static int comspeed = SIOSPD; static struct bootinfo bootinfo; -static unsigned ioctrl = IO_KEYBOARD; +static uint8_t ioctrl = IO_KEYBOARD; void exit(int); static void load(void); @@ -445,9 +445,8 @@ load(void) static Elf32_Shdr es[2]; caddr_t p; ino_t ino; - uint32_t addr, x; + uint32_t addr; int i, j; - uint8_t fmt; if (!(ino = lookup(kname))) { if (!ls) @@ -456,15 +455,8 @@ load(void) } if (xfsread(ino, &hdr, sizeof(hdr))) return; - if (N_GETMAGIC(hdr.ex) == ZMAGIC) - fmt = 0; - else if (IS_ELF(hdr.eh)) - fmt = 1; - else { - printf("Invalid %s\n", "format"); - return; - } - if (fmt == 0) { + + if (N_GETMAGIC(hdr.ex) == ZMAGIC) { addr = hdr.ex.a_entry & 0xffffff; p = PTOV(addr); fs_off = PAGE_SIZE; @@ -473,7 +465,7 @@ load(void) p += roundup2(hdr.ex.a_text, PAGE_SIZE); if (xfsread(ino, p, hdr.ex.a_data)) return; - } else { + } else if (IS_ELF(hdr.eh)) { fs_off = hdr.eh.e_phoff; for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) { if (xfsread(ino, ep + j, sizeof(ep[0]))) @@ -505,7 +497,11 @@ load(void) } addr = hdr.eh.e_entry & 0xffffff; bootinfo.bi_esymtab = VTOP(p); + } else { + printf("Invalid %s\n", "format"); + return; } + bootinfo.bi_kernelname = VTOP(kname); bootinfo.bi_bios_dev = dsk.daua; __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), @@ -672,7 +668,7 @@ static void printf(const char *fmt,...) { va_list ap; - char buf[10]; + static char buf[10]; char *s; unsigned u; int c;