diff options
author | nyan <nyan@FreeBSD.org> | 2011-03-24 15:09:36 +0000 |
---|---|---|
committer | nyan <nyan@FreeBSD.org> | 2011-03-24 15:09:36 +0000 |
commit | ccc0d4f3248e30679b9f2d1675e09818a34a767c (patch) | |
tree | 24f7966c30fd1d23879a94de10d762792b96b858 /sys/boot/pc98 | |
parent | 893f1d69bf1b0ffd6e4e649e185fb43570b5c316 (diff) | |
download | FreeBSD-src-ccc0d4f3248e30679b9f2d1675e09818a34a767c.zip FreeBSD-src-ccc0d4f3248e30679b9f2d1675e09818a34a767c.tar.gz |
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.
Diffstat (limited to 'sys/boot/pc98')
-rw-r--r-- | sys/boot/pc98/boot2/boot2.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/sys/boot/pc98/boot2/boot2.c b/sys/boot/pc98/boot2/boot2.c index bae7c9e..c7d0e54 100644 --- a/sys/boot/pc98/boot2/boot2.c +++ b/sys/boot/pc98/boot2/boot2.c @@ -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; |