This was an attempt to boot FreeBSD on the SGI Visual Workstation. diff -uNr arc/CVS/Root arc.sgi/CVS/Root --- arc/CVS/Root Fri Jan 2 15:34:17 2004 +++ arc.sgi/CVS/Root Fri Dec 12 00:29:47 2003 @@ -1 +1 @@ -bms@kimchi.dek.spc.org:/home/ncvs +/home/ncvs diff -uNr arc/Makefile.inc arc.sgi/Makefile.inc --- arc/Makefile.inc Mon May 1 21:26:21 2000 +++ arc.sgi/Makefile.inc Mon Dec 22 23:48:21 2003 @@ -1,6 +1,11 @@ -# $FreeBSD: src/sys/boot/arc/Makefile.inc,v 1.2 2000/05/01 20:26:21 peter Exp $ -# Options used when building app-specific libalpha components +# $FreeBSD: src/sys/boot/arc/Makefile.inc,v 1.2 2000/05/01 20:26:21 peter Exp $ # Options used when building app-specific libalpha components + +.if ${MACHINE_ARCH} == "alpha" LOAD_ADDRESS= 0xffffffff80900000 +.elseif ${MACHINE_ARCH} == "i386" +#LOAD_ADDRESS= 0x80900000 +LOAD_ADDRESS= 0x00400000 +.endif DPADD+= ${DESTDIR}/${LIBDIR}/libstand.a LIBSTANDDIR= ${.CURDIR}/../../../../lib/libstand LIBSTAND= -lstand diff -uNr arc/include/CVS/Root arc.sgi/include/CVS/Root --- arc/include/CVS/Root Fri Jan 2 15:34:17 2004 +++ arc.sgi/include/CVS/Root Fri Dec 12 00:29:47 2003 @@ -1 +1 @@ -bms@kimchi.dek.spc.org:/home/ncvs +/home/ncvs diff -uNr arc/include/arcfuncs.h arc.sgi/include/arcfuncs.h --- arc/include/arcfuncs.h Sat Aug 28 01:39:34 1999 +++ arc.sgi/include/arcfuncs.h Tue Dec 23 00:12:52 2003 @@ -35,13 +35,18 @@ /* System Parameter Block holding ARC and VENDOR function vector addresses */ -#define SPBlock ((SPB *)0xffffffff806fe000ul) +#if defined(__alpha__) + #define SPBlock ((SPB *)0xffffffff806fe000ul) +#else + #define SPBlock ((SPB *)0x1000) +#endif +#if defined (__alpha__) /* * Convert between 32bit (ARC) and 64bit (Alpha) pointers */ -static INLINE void* +static INLINE void * ptr(arcptr p) { return (void*)(int64_t)p.adr; @@ -54,6 +59,23 @@ p32.adr = (int32_t)(int64_t) p; return (p32); } + +#else + +static INLINE void *ptr(arcptr p) +{ + return ((void *)p.adr); +} + +static INLINE arcptr +toarcptr(void *p) +{ + arcptr p32; + p32.adr = (int32_t) p; + return (p32); +} + +#endif /* * Return entry point for ARC BIOS function "funcno" diff -uNr arc/include/libarc.h arc.sgi/include/libarc.h --- arc/include/libarc.h Sat Aug 28 01:39:34 1999 +++ arc.sgi/include/libarc.h Tue Dec 23 00:27:17 2003 @@ -59,7 +59,7 @@ extern int arc_getdev(void **vdev, const char *devspec, const char **path); extern char *arc_fmtdev(void *vdev); -extern int arc_setcurrdev(struct env_var *ev, int flags, void *value); +extern int arc_setcurrdev(struct env_var *ev, int flags, const void *value); #define MAXDEV 31 /* maximum number of distinct devices */ @@ -73,8 +73,8 @@ extern void delay(int); extern void reboot(void); -extern int arc_copyin(void *src, vm_offset_t dest, size_t len); -extern int arc_copyout(vm_offset_t src, void *dest, size_t len); +extern ssize_t arc_copyin(const void *src, vm_offset_t dest, const size_t len); +extern ssize_t arc_copyout(const vm_offset_t src, void *dest, const size_t len); extern int arc_readin(int fd, vm_offset_t dest, size_t len); extern int arc_boot(void); diff -uNr arc/lib/CVS/Root arc.sgi/lib/CVS/Root --- arc/lib/CVS/Root Fri Jan 2 15:34:17 2004 +++ arc.sgi/lib/CVS/Root Fri Dec 12 00:29:48 2003 @@ -1 +1 @@ -bms@kimchi.dek.spc.org:/home/ncvs +/home/ncvs diff -uNr arc/lib/Makefile arc.sgi/lib/Makefile --- arc/lib/Makefile Mon May 13 11:53:24 2002 +++ arc.sgi/lib/Makefile Tue Dec 23 00:28:05 2003 @@ -10,16 +10,36 @@ CFLAGS+= -I${LIBSTANDDIR} CFLAGS+= -DDEBUG +# XXX bms sgi +#CFLAGS+= -D__${MACHINE_ARCH}__ + +# XXX bms sgi +#.if ${MACHINE_ARCH} == "i386" +CFLAGS+= -DMAXPARTITIONS=8 +# -DLABELSECTOR=0 \ +# -DLABELOFFSET=64 \ +# -DDISKMAGIC=0x82564557 +#.endif + # Pick up the bootstrap header for some interface items -CFLAGS+= -I${.CURDIR}/../../common -mno-fp-regs \ - -I${.CURDIR}/../../.. -I${.CURDIR}/../include +CFLAGS+= -I${.CURDIR}/../../common \ + -I${.CURDIR}/../../.. \ + -I${.CURDIR}/../include + +.if ${MACHINE_ARCH} == "alpha" +CFLAGS+= -mno-fp-regs +.endif #CFLAGS+= -DDISK_DEBUG #CPPFLAGS+= -DNO_DISKLABEL #CPPFLAGS+= -DSAVE_MEMORY SRCS= delay.c time.c abort.c setjmperr.c copy.c devicename.c module.c \ - arcconsole.c arcdisk.c elf_freebsd.c bootinfo.c + arcconsole.c arcdisk.c bootinfo.c + +.if ${MACHINE_ARCH} == "alpha" +SRCS+= elf_freebsd.c +.endif .if ${MACHINE_ARCH} == "alpha" SRCS+= rpb.c diff -uNr arc/lib/arcconsole.c arc.sgi/lib/arcconsole.c --- arc/lib/arcconsole.c Sat Aug 28 01:39:36 1999 +++ arc.sgi/lib/arcconsole.c Tue Dec 23 23:19:33 2003 @@ -78,18 +78,37 @@ int arc_getchar() { - char cbuf; + int32_t status; u_int32_t count; + char cbuf; +#if 0 + printf("arc_getchar: entry\n"); +#endif +#if 0 arc_putchar('_'); arc_putchar('\b'); - Read(StandardIn, &cbuf, 1, &count); +#endif + status = Read(StandardIn, &cbuf, sizeof(char), &count); +#if 0 arc_putchar(' '); arc_putchar('\b'); - if (count == 1) - return cbuf; - else - return -1; +#endif +#if 0 + printf("arc_getchar: count = 0x%08lx, cbuf = %u, " + "sizeof(char) == %d\n", count, (unsigned int)cbuf, sizeof(char)); +#endif + if ((status != 0) || (count != sizeof(char))) { +#if 0 + printf("arc_getchar: return (-1), status = %d, count = %d\n", + status, count); +#endif + return (-1); + } +#if 0 + printf("arc_getchar: return (%d)\n", (int)(cbuf & 0xFF)); +#endif + return ((int)cbuf & 0xFF); } int diff -uNr arc/lib/arcdisk.c arc.sgi/lib/arcdisk.c --- arc/lib/arcdisk.c Wed Apr 16 22:09:41 2003 +++ arc.sgi/lib/arcdisk.c Mon Dec 22 18:22:16 2003 @@ -42,6 +42,10 @@ #include +#if 1 +#include +#endif + #include "bootstrap.h" #include "libarc.h" #include "arctypes.h" diff -uNr arc/lib/arch/CVS/Root arc.sgi/lib/arch/CVS/Root --- arc/lib/arch/CVS/Root Fri Jan 2 15:34:17 2004 +++ arc.sgi/lib/arch/CVS/Root Fri Dec 12 00:29:48 2003 @@ -1 +1 @@ -bms@kimchi.dek.spc.org:/home/ncvs +/home/ncvs diff -uNr arc/lib/arch/alpha/CVS/Root arc.sgi/lib/arch/alpha/CVS/Root --- arc/lib/arch/alpha/CVS/Root Fri Jan 2 15:34:17 2004 +++ arc.sgi/lib/arch/alpha/CVS/Root Fri Dec 12 00:29:48 2003 @@ -1 +1 @@ -bms@kimchi.dek.spc.org:/home/ncvs +/home/ncvs diff -uNr arc/lib/arch/i386/CVS/Entries arc.sgi/lib/arch/i386/CVS/Entries --- arc/lib/arch/i386/CVS/Entries Thu Jan 1 01:00:00 1970 +++ arc.sgi/lib/arch/i386/CVS/Entries Mon Dec 22 18:15:33 2003 @@ -0,0 +1,5 @@ +/copy.c/1.2/Sat Aug 28 00:39:40 1999// +/rpb.c/1.2/Sat Aug 28 00:39:40 1999// +/setjmp.S/1.2/Sat Aug 28 00:39:40 1999// +/start.S/1.2/Sat Aug 28 00:39:41 1999// +D diff -uNr arc/lib/arch/i386/CVS/Repository arc.sgi/lib/arch/i386/CVS/Repository --- arc/lib/arch/i386/CVS/Repository Thu Jan 1 01:00:00 1970 +++ arc.sgi/lib/arch/i386/CVS/Repository Mon Dec 22 18:15:33 2003 @@ -0,0 +1 @@ +src/sys/boot/arc/lib/arch/alpha diff -uNr arc/lib/arch/i386/CVS/Root arc.sgi/lib/arch/i386/CVS/Root --- arc/lib/arch/i386/CVS/Root Thu Jan 1 01:00:00 1970 +++ arc.sgi/lib/arch/i386/CVS/Root Mon Dec 22 18:15:33 2003 @@ -0,0 +1 @@ +/home/ncvs diff -uNr arc/lib/arch/i386/copy.c arc.sgi/lib/arch/i386/copy.c --- arc/lib/arch/i386/copy.c Thu Jan 1 01:00:00 1970 +++ arc.sgi/lib/arch/i386/copy.c Tue Dec 23 00:24:15 2003 @@ -0,0 +1,29 @@ +/*- + * $FreeBSD$ + */ +/* + * MD primitives supporting placement of module data + */ +#include + +#include "libarc.h" + +ssize_t +arc_copyin(const void *src, vm_offset_t dest, const size_t len) +{ + bcopy(src, (void *)dest, len); + return(len); +} + +ssize_t +arc_copyout(const vm_offset_t src, void *dest, const size_t len) +{ + bcopy((void *)src, dest, len); + return(len); +} + +int +arc_readin(int fd, vm_offset_t dest, size_t len) +{ + return(read(fd, (void *)dest, len)); +} diff -uNr arc/lib/bootinfo.c arc.sgi/lib/bootinfo.c --- arc/lib/bootinfo.c Fri Apr 4 17:35:14 2003 +++ arc.sgi/lib/bootinfo.c Mon Dec 22 18:24:48 2003 @@ -31,9 +31,13 @@ #include #include #include + +#if 0 #include #include #include +#endif + #include "bootstrap.h" /* @@ -138,6 +142,7 @@ return(addr); } +#if 0 /* * Load the information expected by an alpha kernel. * @@ -201,3 +206,4 @@ return(0); } +#endif diff -uNr arc/lib/devicename.c arc.sgi/lib/devicename.c --- arc/lib/devicename.c Wed Apr 16 22:09:41 2003 +++ arc.sgi/lib/devicename.c Tue Dec 23 00:27:02 2003 @@ -221,7 +221,7 @@ * Set currdev to suit the value being supplied in (value) */ int -arc_setcurrdev(struct env_var *ev, int flags, void *value) +arc_setcurrdev(struct env_var *ev, int flags, const void *value) { struct arc_devdesc *ncurr; int rv; diff -uNr arc/lib/elf_freebsd.c arc.sgi/lib/elf_freebsd.c --- arc/lib/elf_freebsd.c Thu May 1 04:56:29 2003 +++ arc.sgi/lib/elf_freebsd.c Mon Dec 22 18:22:40 2003 @@ -82,9 +82,12 @@ #include #include #include + +#if 0 #include #include #include +#endif #include "bootstrap.h" diff -uNr arc/loader/CVS/Root arc.sgi/loader/CVS/Root --- arc/loader/CVS/Root Fri Jan 2 15:34:17 2004 +++ arc.sgi/loader/CVS/Root Fri Dec 12 00:29:49 2003 @@ -1 +1 @@ -bms@kimchi.dek.spc.org:/home/ncvs +/home/ncvs diff -uNr arc/sgildr/CVS/Entries arc.sgi/sgildr/CVS/Entries --- arc/sgildr/CVS/Entries Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/CVS/Entries Mon Dec 22 18:25:25 2003 @@ -0,0 +1,6 @@ +/Makefile/1.7/Fri May 10 09:26:30 2002// +/conf.c/1.4/Thu Dec 19 19:34:58 2002// +/help.alpha/1.1.1.1/Wed Jul 28 20:28:47 1999// +/main.c/1.3/Sat Aug 28 00:39:42 1999// +/version/1.2/Sat Aug 28 00:39:43 1999// +D diff -uNr arc/sgildr/CVS/Repository arc.sgi/sgildr/CVS/Repository --- arc/sgildr/CVS/Repository Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/CVS/Repository Mon Dec 22 18:25:25 2003 @@ -0,0 +1 @@ +src/sys/boot/arc/loader diff -uNr arc/sgildr/CVS/Root arc.sgi/sgildr/CVS/Root --- arc/sgildr/CVS/Root Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/CVS/Root Mon Dec 22 18:25:25 2003 @@ -0,0 +1 @@ +/home/ncvs diff -uNr arc/sgildr/Makefile arc.sgi/sgildr/Makefile --- arc/sgildr/Makefile Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/Makefile Sun Dec 28 04:30:20 2003 @@ -0,0 +1,77 @@ +# $NetBSD: Makefile,v 1.12 1998/02/19 14:18:36 drochner Exp $ +# $FreeBSD: src/sys/boot/arc/loader/Makefile,v 1.7 2002/05/10 09:26:30 obrien Exp $ + +BASE= loader +PROG= ${BASE}.exe +NOMAN= +NEWVERSWHAT= "ARC disk boot" ${MACHINE_ARCH} + +.PATH: ${.CURDIR}/../common + +# i386-specific bootstrap sources +SRCS+= main.c conf.c + +# Always add MI sources +.PATH: ${.CURDIR}/../../common +.include <${.CURDIR}/../../common/Makefile.inc> +CFLAGS+= -ffreestanding +.if ${MACHINE_ARCH} == "alpha" +CFLAGS+= -mno-fp-regs +.endif +CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR} +CFLAGS+= -I${.CURDIR}/../../.. -I. +CFLAGS+= -DLOADER + +MAPFILE= ${BASE}.map + +CLEANFILES+= setdef0.c setdef0.o setdef1.c setdef1.o setdefs.h \ + vers.c vers.o ${BASE}.exe ${BASE}.sym ${BASE}.list ${MAPFILE} +CLEANFILES+= loader.help +CLEANFILES+= machine + +CFLAGS+= -Wall + +CFLAGS+= -I${LIBSTANDDIR} +CFLAGS+= -I${.CURDIR}/../include +CRT= +STRIP= +BINDIR?= /boot + +LOAD_ADDRESS= 0x0000000080900000 + +PELDFLAGS= -nostdlib -T ${.CURDIR}/ldscript.arcx86 +PELDFLAGS+= --stack 0x100000,0x20000 + +PELD= /usr/local/bin/mingw32-ld + +all: ${PROG} + +vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version + sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} + ${CC} -c vers.c + +${BASE}.exe: ${OBJS} ${LIBSTAND} ${LIBARC} ${CRT} vers.o + ${PELD} ${PELDFLAGS} -o ${BASE}.exe -N \ + --image-base ${LOAD_ADDRESS} \ + ${OBJS} vers.o \ + -L${DESTDIR}${LIBDIR} ${LIBSTAND} ${LIBARC} ${LIBSTAND} \ + -Map ${MAPFILE} + +${BASE}.help: help.common + cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} + +beforeinstall: +.if exists(${.OBJDIR}/loader.help) + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${.OBJDIR}/${BASE}.help ${DESTDIR}/boot +.else + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${.CURDIR}/${BASE}.help ${DESTDIR}/boot +.endif + +machine: + ln -sf ${.CURDIR}/../../../i386/include machine + +.include + +beforedepend ${OBJS}: machine Binary files arc/sgildr/bcache.o and arc.sgi/sgildr/bcache.o differ Binary files arc/sgildr/boot.o and arc.sgi/sgildr/boot.o differ Binary files arc/sgildr/commands.o and arc.sgi/sgildr/commands.o differ diff -uNr arc/sgildr/conf.c arc.sgi/sgildr/conf.c --- arc/sgildr/conf.c Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/conf.c Mon Dec 22 18:40:23 2003 @@ -0,0 +1,89 @@ +/* + * $FreeBSD: src/sys/boot/arc/loader/conf.c,v 1.4 2002/12/19 19:34:58 jake Exp $ + * From $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $ + */ + +/* + * Copyright (c) 1997 + * Matthias Drochner. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the NetBSD Project + * by Matthias Drochner. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 +#include "libarc.h" + +/* + * We could use linker sets for some or all of these, but + * then we would have to control what ended up linked into + * the bootstrap. So it's easier to conditionalise things + * here. + * + * XXX rename these arrays to be consistent and less namespace-hostile + */ + +/* Exported for libstand */ +struct devsw *devsw[] = { + &arcdisk, + NULL +}; + +struct fs_ops *file_system[] = { + &ufs_fsops, + &gzipfs_fsops, + NULL +}; + +/* Exported for alpha only */ +/* + * Sort formats so that those that can detect based on arguments + * rather than reading the file go first. + */ +#if 0 +extern struct file_format alpha_elf; +#endif + +struct file_format *file_formats[] = { +#if 0 + &alpha_elf, +#endif + NULL +}; + +/* + * Consoles + * + * We don't prototype these in libalpha.h because they require + * data structures from bootstrap.h as well. + */ +extern struct console arcconsole; + +struct console *consoles[] = { + &arcconsole, + NULL +}; Binary files arc/sgildr/conf.o and arc.sgi/sgildr/conf.o differ Binary files arc/sgildr/console.o and arc.sgi/sgildr/console.o differ Binary files arc/sgildr/devopen.o and arc.sgi/sgildr/devopen.o differ Binary files arc/sgildr/interp.o and arc.sgi/sgildr/interp.o differ Binary files arc/sgildr/interp_backslash.o and arc.sgi/sgildr/interp_backslash.o differ Binary files arc/sgildr/interp_parse.o and arc.sgi/sgildr/interp_parse.o differ diff -uNr arc/sgildr/ldscript.arcx86 arc.sgi/sgildr/ldscript.arcx86 --- arc/sgildr/ldscript.arcx86 Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/ldscript.arcx86 Sun Dec 28 07:19:53 2003 @@ -0,0 +1,122 @@ +/* Default linker script, for normal executables */ +OUTPUT_FORMAT(pei-i386) +SEARCH_DIR("/usr/local/mingw32/lib"); +ENTRY(main) +SECTIONS +{ + .text __image_base__ + __section_alignment__ : + { + *(.init) + *(.text) + *(SORT(.text$*)) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(SORT(.ctors.*)); *(.ctors); *(.ctor); LONG (0); + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(SORT(.dtors.*)); *(.dtors); *(.dtor); LONG (0); + *(.fini) + /* ??? Why is .gcc_exc here? */ + *(.gcc_exc) + PROVIDE (etext = .); + *(.gcc_except_table) +/* XXX: place strings in text segment... */ + *(.rodata.str*) + *(SORT(.rodata.str*$*)) + } + /* The Cygwin32 library uses a section to avoid copying certain data + on fork. This used to be named ".data". The linker used + to include this between __data_start__ and __data_end__, but that + breaks building the cygwin32 dll. Instead, we name the section + ".data_cygwin_nocopy" and explictly include it after __data_end__. */ + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + __start_set_Xcommand_set = .; + *(set_Xcommand_set) + __stop_set_Xcommand_set = .; + *(.data) + *(.data2) + *(SORT(.data$*)) + __data_end__ = . ; + *(.data_cygwin_nocopy) + } + .rdata BLOCK(__section_alignment__) : + { + *(.rdata) + *(SORT(.rdata$*)) + *(.rodata) + *(SORT(.rodata$*)) + *(.rodata.*) + *(SORT(.rodata.*$*)) + *(.eh_frame) + ___RUNTIME_PSEUDO_RELOC_LIST__ = .; + __RUNTIME_PSEUDO_RELOC_LIST__ = .; + *(.rdata_runtime_pseudo_reloc) + ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .; + __RUNTIME_PSEUDO_RELOC_LIST_END__ = .; + } + .pdata BLOCK(__section_alignment__) : + { + *(.pdata) + } + .bss BLOCK(__section_alignment__) : + { + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + } + .edata BLOCK(__section_alignment__) : + { + *(.edata) + } + /DISCARD/ : + { + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + } + .idata BLOCK(__section_alignment__) : + { + /* This cannot currently be handled with grouped sections. + See pe.em:sort_sections. */ + SORT(*)(.idata$2) + SORT(*)(.idata$3) + /* These zeroes mark the end of the import list. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + } + .CRT BLOCK(__section_alignment__) : + { + *(SORT(.CRT$*)) + } + .endjunk BLOCK(__section_alignment__) : + { + /* end is deprecated, don't use it */ + PROVIDE (end = .); + PROVIDE ( _end = .); + __end__ = .; + } + .rsrc BLOCK(__section_alignment__) : + { + *(.rsrc) + *(SORT(.rsrc$*)) + } + .reloc BLOCK(__section_alignment__) : + { + *(.reloc) + } + .stab BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stab ] + } + .stabstr BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stabstr ] + } +} Binary files arc/sgildr/load_elf32.o and arc.sgi/sgildr/load_elf32.o differ Binary files arc/sgildr/load_elf64.o and arc.sgi/sgildr/load_elf64.o differ Binary files arc/sgildr/loader.exe and arc.sgi/sgildr/loader.exe differ Binary files arc/sgildr/loader.idb and arc.sgi/sgildr/loader.idb differ diff -uNr arc/sgildr/loader.map arc.sgi/sgildr/loader.map --- arc/sgildr/loader.map Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/loader.map Sun Dec 28 07:48:37 2003 @@ -0,0 +1,855 @@ +Archive member included because of file (symbol) + +/usr/lib/libstand.a(gzipfs.o) + conf.o (gzipfs_fsops) +/usr/lib/libstand.a(ufs.o) conf.o (ufs_fsops) +/usr/lib/libstand.a(readdir.o) + ls.o (readdirfd) +/usr/lib/libstand.a(lseek.o) load_elf32.o (lseek) +/usr/lib/libstand.a(stat.o) ls.o (stat) +/usr/lib/libstand.a(_inflate.o) + /usr/lib/libstand.a(gzipfs.o) (inflateEnd) +/usr/lib/libstand.a(_infblock.o) + /usr/lib/libstand.a(_inflate.o) (inflate_blocks_reset) +/usr/lib/libstand.a(adler32.o) + /usr/lib/libstand.a(_inflate.o) (adler32) +/usr/lib/libstand.a(_setjmp.o) + main.o (setjmp) +/usr/lib/libstand.a(strspn.o) + interp.o (strspn) +/usr/lib/libstand.a(strncpy.o) + boot.o (strncpy) +/usr/lib/libstand.a(strncmp.o) + interp.o (strncmp) +/usr/lib/libstand.a(strcpy.o) + main.o (strcpy) +/usr/lib/libstand.a(strcat.o) + main.o (strcat) +/usr/lib/libstand.a(index.o) interp_parse.o (index) +/usr/lib/libstand.a(strcasecmp.o) + boot.o (strcasecmp) +/usr/lib/libstand.a(pager.o) commands.o (pager_open) +/usr/lib/libstand.a(gets.o) commands.o (ngets) +/usr/lib/libstand.a(getopt.o) + commands.o (optind) +/usr/lib/libstand.a(environment.o) + commands.o (environ) +/usr/lib/libstand.a(_zutil.o) + /usr/lib/libstand.a(_inflate.o) (zcalloc) +/usr/lib/libstand.a(_inftrees.o) + /usr/lib/libstand.a(_infblock.o) (inflate_trees_bits) +/usr/lib/libstand.a(_infcodes.o) + /usr/lib/libstand.a(_infblock.o) (inflate_codes_new) +/usr/lib/libstand.a(strchr.o) + boot.o (strchr) +/usr/lib/libstand.a(bcmp.o) module.o (bcmp) +/usr/lib/libstand.a(strtol.o) + boot.o (strtol) +/usr/lib/libstand.a(strerror.o) + commands.o (strerror) +/usr/lib/libstand.a(strdup.o) + boot.o (strdup) +/usr/lib/libstand.a(globals.o) + interp.o (errno) +/usr/lib/libstand.a(_inffast.o) + /usr/lib/libstand.a(_infcodes.o) (inflate_fast) +/usr/lib/libstand.a(_infutil.o) + /usr/lib/libstand.a(_infblock.o) (inflate_mask) +/usr/lib/libstand.a(memcpy.o) + load_elf32.o (memcpy) +/usr/lib/libstand.a(read.o) module.o (read) +/usr/lib/libstand.a(open.o) /usr/lib/libstand.a(readdir.o) (files) +/usr/lib/libstand.a(close.o) boot.o (close) +/usr/lib/libstand.a(fstat.o) ls.o (fstat) +/usr/lib/libstand.a(nullfs.o) + /usr/lib/libstand.a(gzipfs.o) (null_write) +/usr/lib/libstand.a(strrchr.o) + load_elf32.o (strrchr) +/usr/lib/libstand.a(strcmp.o) + main.o (strcmp) +/usr/lib/libstand.a(twiddle.o) + /usr/lib/libstand.a(ufs.o) (twiddle) +/usr/lib/libstand.a(zalloc_malloc.o) + bcache.o (Malloc) +/usr/lib/libstand.a(zalloc.o) + /usr/lib/libstand.a(zalloc_malloc.o) (znalloc) +/usr/lib/libstand.a(sbrk.o) main.o (setheap) +/usr/lib/libstand.a(printf.o) + main.o (printf) +/usr/lib/libstand.a(strlen.o) + boot.o (strlen) +/usr/lib/libstand.a(qdivrem.o) + /usr/lib/libstand.a(printf.o) (_udivdi3) +/usr/lib/libstand.a(bzero.o) main.o (bzero) +/usr/lib/libstand.a(bcopy.o) bcache.o (bcopy) +/usr/lib/libstand.a(bcd.o) /usr/lib/libstand.a(printf.o) (hex2ascii_data) +/usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcdisk.o) + conf.o (arcdisk) +/usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcconsole.o) + conf.o (arcconsole) +/usr/src/sys/boot/arc/sgildr/../lib/libarc.a(module.o) + main.o (arc_autoload) +/usr/src/sys/boot/arc/sgildr/../lib/libarc.a(devicename.o) + main.o (arc_getdev) +/usr/src/sys/boot/arc/sgildr/../lib/libarc.a(copy.o) + main.o (arc_copyin) +/usr/src/sys/boot/arc/sgildr/../lib/libarc.a(time.o) + bcache.o (time) +/usr/src/sys/boot/arc/sgildr/../lib/libarc.a(delay.o) + main.o (delay) +/usr/lib/libstand.a(dev.o) /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcdisk.o) (noioctl) + +Allocating common symbols +Common symbol size file + +domainname 0x80 /usr/lib/libstand.a(globals.o) +nameip 0x4 /usr/lib/libstand.a(globals.o) +hostnamelen 0x4 /usr/lib/libstand.a(globals.o) +command_errmsg 0x4 commands.o +errno 0x4 /usr/lib/libstand.a(globals.o) +swapip 0x4 /usr/lib/libstand.a(globals.o) +exit_env 0x30 main.o +rootip 0x4 /usr/lib/libstand.a(globals.o) +optarg 0x4 /usr/lib/libstand.a(getopt.o) +myip 0x4 /usr/lib/libstand.a(globals.o) +hostname 0x80 /usr/lib/libstand.a(globals.o) +archsw 0x1c main.o +console 0x4 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcconsole.o) +command_errbuf 0x100 commands.o +currdev 0x14 main.o +bootfile 0x80 /usr/lib/libstand.a(globals.o) +gateip 0x4 /usr/lib/libstand.a(globals.o) +files 0x160 /usr/lib/libstand.a(open.o) +ifname 0x10 /usr/lib/libstand.a(globals.o) +domainnamelen 0x4 /usr/lib/libstand.a(globals.o) +optreset 0x4 /usr/lib/libstand.a(getopt.o) +optopt 0x4 /usr/lib/libstand.a(getopt.o) + +Memory Configuration + +Name Origin Length Attributes +*default* 0x00000000 0xffffffff + +Linker script and memory map + + 0x00400000 __image_base__ = 0x400000 + 0x00000000 __dll__ = 0x0 + 0x00001000 __section_alignment__ = 0x1000 + 0x00000200 __file_alignment__ = 0x200 + 0x00000004 __major_os_version__ = 0x4 + 0x00000000 __minor_os_version__ = 0x0 + 0x00000001 __major_image_version__ = 0x1 + 0x00000000 __minor_image_version__ = 0x0 + 0x00000004 __major_subsystem_version__ = 0x4 + 0x00000000 __minor_subsystem_version__ = 0x0 + 0x00000003 __subsystem__ = 0x3 + 0x00100000 __size_of_stack_reserve__ = 0x100000 + 0x00020000 __size_of_stack_commit__ = 0x20000 + 0x00100000 __size_of_heap_reserve__ = 0x100000 + 0x00001000 __size_of_heap_commit__ = 0x1000 + 0x00000000 __loader_flags__ = 0x0 + +.text 0x00401000 0x13a00 + *(.init) + *(.text) + .text 0x00401000 0x9e1 main.o + 0x004010f0 dumpcpu + 0x00401000 dumpdt + 0x00401300 dumpnode + 0x00401320 walktree + 0x00401240 memsize + 0x004015a0 listdisks + 0x00401390 dumpdisk + 0x004016e0 main + 0x00401490 walkdisks + 0x004016b0 exit + *fill* 0x004019e1 0x3 00 + *fill* 0x004019e4 0xc 00 + .text 0x004019f0 0xbdd bcache.o + 0x004021b0 bcache_strategy + 0x004019f0 bcache_init + 0x00401bb0 bcache_flush + *fill* 0x004025cd 0x3 00 + .text 0x004025d0 0x851 boot.o + 0x004027f0 autoboot_maybe + 0x00402b70 getrootmount + 0x00402850 autoboot + *fill* 0x00402e21 0xf 00 + .text 0x00402e30 0xb40 commands.o + .text 0x00403970 0x40e console.o + 0x00403bc0 putchar + 0x00403970 cons_probe + 0x00403b60 ischar + 0x00403b10 getchar + *fill* 0x00403d7e 0x2 00 + .text 0x00403d80 0xb9 devopen.o + 0x00403e00 devclose + 0x00403d80 devopen + *fill* 0x00403e39 0x7 00 + .text 0x00403e40 0x70f interp.o + 0x00403f00 interact + 0x00404150 include + *fill* 0x0040454f 0x1 00 + .text 0x00404550 0x2c8 interp_backslash.o + 0x00404550 backslash + *fill* 0x00404818 0x8 00 + .text 0x00404820 0x5d5 interp_parse.o + 0x00404860 parse + *fill* 0x00404df5 0xb 00 + .text 0x00404e00 0x431 ls.o + *fill* 0x00405231 0xf 00 + .text 0x00405240 0x341 misc.o + 0x00405240 unargv + 0x00405540 dev_cleanup + 0x004053b0 hexdump + 0x004052f0 strlenout + 0x00405340 strdupout + *fill* 0x00405581 0xf 00 + .text 0x00405590 0x1735 module.o + 0x00405dc0 mod_loadkld + 0x00406140 metadata_next + 0x00406610 file_addmodule + 0x004060a0 file_addmetadata + 0x00406110 file_findmetadata + 0x00405f70 file_findfile + 0x00405ce0 mod_load + 0x004067f0 file_alloc + 0x004066c0 file_discard + *fill* 0x00406cc5 0xb 00 + .text 0x00406cd0 0x5d panic.o + 0x00406cd0 panic + *fill* 0x00406d2d 0x3 00 + .text 0x00406d30 0x1182 load_elf32.o + 0x00406d30 elf32_loadfile + *fill* 0x00407eb2 0xe 00 + .text 0x00407ec0 0x13d3 load_elf64.o + 0x00407ec0 elf64_loadfile + *fill* 0x00409293 0x1 00 + *fill* 0x00409294 0xc 00 + .text 0x004092a0 0x6c9 /usr/lib/libstand.a(gzipfs.o) + *fill* 0x00409969 0x7 00 + .text 0x00409970 0x174d /usr/lib/libstand.a(ufs.o) + *fill* 0x0040b0bd 0x3 00 + .text 0x0040b0c0 0x74 /usr/lib/libstand.a(readdir.o) + 0x0040b0c0 readdirfd + *fill* 0x0040b134 0xc 00 + .text 0x0040b140 0x1f1 /usr/lib/libstand.a(lseek.o) + 0x0040b140 lseek + *fill* 0x0040b331 0xf 00 + .text 0x0040b340 0x4f /usr/lib/libstand.a(stat.o) + 0x0040b340 stat + *fill* 0x0040b38f 0x1 00 + .text 0x0040b390 0x814 /usr/lib/libstand.a(_inflate.o) + 0x0040b5f0 inflate + 0x0040bb60 inflateSyncPoint + 0x0040b5c0 inflateInit_ + 0x0040b390 inflateReset + 0x0040ba80 inflateSync + 0x0040b9c0 inflateSetDictionary + 0x0040b400 inflateEnd + 0x0040b470 inflateInit2_ + *fill* 0x0040bba4 0xc 00 + .text 0x0040bbb0 0xed1 /usr/lib/libstand.a(_infblock.o) + 0x0040c9c0 inflate_blocks_free + 0x0040bd50 inflate_blocks + 0x0040bbb0 inflate_blocks_reset + 0x0040ca70 inflate_blocks_sync_point + 0x0040ca30 inflate_set_dictionary + 0x0040bc70 inflate_blocks_new + *fill* 0x0040ca81 0xf 00 + .text 0x0040ca90 0x133 /usr/lib/libstand.a(adler32.o) + 0x0040ca90 adler32 + *fill* 0x0040cbc3 0x1 00 + .text 0x0040cbc4 0x44 /usr/lib/libstand.a(_setjmp.o) + 0x0040cbe4 longjmp + 0x0040cbc4 setjmp + *fill* 0x0040cc08 0x8 00 + .text 0x0040cc10 0x32 /usr/lib/libstand.a(strspn.o) + 0x0040cc10 strspn + *fill* 0x0040cc42 0xe 00 + .text 0x0040cc50 0x49 /usr/lib/libstand.a(strncpy.o) + 0x0040cc50 strncpy + *fill* 0x0040cc99 0x7 00 + .text 0x0040cca0 0x40 /usr/lib/libstand.a(strncmp.o) + 0x0040cca0 strncmp + .text 0x0040cce0 0x30 /usr/lib/libstand.a(strcpy.o) + 0x0040cce0 strcpy + .text 0x0040cd10 0x40 /usr/lib/libstand.a(strcat.o) + 0x0040cd10 strcat + .text 0x0040cd50 0x2d /usr/lib/libstand.a(index.o) + 0x0040cd50 index + *fill* 0x0040cd7d 0x3 00 + .text 0x0040cd80 0x118 /usr/lib/libstand.a(strcasecmp.o) + 0x0040ce00 strncasecmp + 0x0040cd80 strcasecmp + *fill* 0x0040ce98 0x8 00 + .text 0x0040cea0 0x20f /usr/lib/libstand.a(pager.o) + 0x0040cf20 pager_output + 0x0040cf10 pager_close + 0x0040d010 pager_file + 0x0040cea0 pager_open + *fill* 0x0040d0af 0x1 00 + .text 0x0040d0b0 0x18f /usr/lib/libstand.a(gets.o) + 0x0040d1c0 fgetstr + 0x0040d0b0 ngets + *fill* 0x0040d23f 0x1 00 + .text 0x0040d240 0x1ad /usr/lib/libstand.a(getopt.o) + 0x0040d240 getopt + *fill* 0x0040d3ed 0x3 00 + .text 0x0040d3f0 0x3fa /usr/lib/libstand.a(environment.o) + 0x0040d6d0 unsetenv + 0x0040d7e0 env_nounset + 0x0040d5d0 getenv + 0x0040d660 putenv + 0x0040d7d0 env_noset + 0x0040d600 setenv + 0x0040d3f0 env_getenv + 0x0040d440 env_setenv + *fill* 0x0040d7ea 0x6 00 + .text 0x0040d7f0 0x85 /usr/lib/libstand.a(_zutil.o) + 0x0040d7f0 zlibVersion + 0x0040d850 zcfree + 0x0040d800 zError + 0x0040d820 zcalloc + *fill* 0x0040d875 0xb 00 + .text 0x0040d880 0x982 /usr/lib/libstand.a(_inftrees.o) + 0x0040e1d0 inflate_trees_fixed + 0x0040df70 inflate_trees_bits + 0x0040e040 inflate_trees_dynamic + *fill* 0x0040e202 0xe 00 + .text 0x0040e210 0x87d /usr/lib/libstand.a(_infcodes.o) + 0x0040e210 inflate_codes_new + 0x0040e260 inflate_codes + 0x0040ea70 inflate_codes_free + *fill* 0x0040ea8d 0x3 00 + .text 0x0040ea90 0x2d /usr/lib/libstand.a(strchr.o) + 0x0040ea90 strchr + *fill* 0x0040eabd 0x3 00 + .text 0x0040eac0 0x35 /usr/lib/libstand.a(bcmp.o) + 0x0040eac0 bcmp + *fill* 0x0040eaf5 0xb 00 + .text 0x0040eb00 0x1e3 /usr/lib/libstand.a(strtol.o) + 0x0040eb00 strtol + *fill* 0x0040ece3 0xd 00 + .text 0x0040ecf0 0x57 /usr/lib/libstand.a(strerror.o) + 0x0040ecf0 strerror + *fill* 0x0040ed47 0x9 00 + .text 0x0040ed50 0x68 /usr/lib/libstand.a(strdup.o) + 0x0040ed50 strdup + *fill* 0x0040edb8 0x8 00 + .text 0x0040edc0 0x3fc /usr/lib/libstand.a(_inffast.o) + 0x0040edc0 inflate_fast + *fill* 0x0040f1bc 0x4 00 + .text 0x0040f1c0 0x147 /usr/lib/libstand.a(_infutil.o) + 0x0040f1c0 inflate_flush + *fill* 0x0040f307 0x9 00 + .text 0x0040f310 0x147 /usr/lib/libstand.a(memcpy.o) + 0x0040f310 memcpy + *fill* 0x0040f457 0x9 00 + .text 0x0040f460 0x1a8 /usr/lib/libstand.a(read.o) + 0x0040f460 read + *fill* 0x0040f608 0x8 00 + .text 0x0040f610 0x1e9 /usr/lib/libstand.a(open.o) + 0x0040f6a0 open + *fill* 0x0040f7f9 0x7 00 + .text 0x0040f800 0x102 /usr/lib/libstand.a(close.o) + 0x0040f800 close + *fill* 0x0040f902 0xe 00 + .text 0x0040f910 0x75 /usr/lib/libstand.a(fstat.o) + 0x0040f910 fstat + *fill* 0x0040f985 0xb 00 + .text 0x0040f990 0xc4 /usr/lib/libstand.a(nullfs.o) + 0x0040f9e0 null_write + 0x0040fa20 null_stat + 0x0040f9b0 null_close + 0x0040f9c0 null_read + 0x0040fa40 null_readdir + 0x0040f990 null_open + 0x0040fa00 null_seek + *fill* 0x0040fa54 0xc 00 + .text 0x0040fa60 0x2d /usr/lib/libstand.a(strrchr.o) + 0x0040fa60 strrchr + *fill* 0x0040fa8d 0x3 00 + .text 0x0040fa90 0x50 /usr/lib/libstand.a(strcmp.o) + 0x0040fa90 strcmp + .text 0x0040fae0 0x35 /usr/lib/libstand.a(twiddle.o) + 0x0040fae0 twiddle + *fill* 0x0040fb15 0xb 00 + .text 0x0040fb20 0x354 /usr/lib/libstand.a(zalloc_malloc.o) + 0x0040fb20 Malloc + 0x0040fd40 Realloc + 0x0040fde0 Reallocf + 0x0040fbd0 Free + 0x0040fe40 mallocstats + 0x0040fcd0 Calloc + *fill* 0x0040fe74 0xc 00 + .text 0x0040fe80 0x2e8 /usr/lib/libstand.a(zalloc.o) + 0x00410050 zextendPool + 0x0040fe80 znalloc + 0x0040ff10 zfree + 0x004100d0 zallocstats + *fill* 0x00410168 0x8 00 + .text 0x00410170 0x79 /usr/lib/libstand.a(sbrk.o) + 0x00410170 setheap + 0x00410190 sbrk + *fill* 0x004101e9 0x7 00 + .text 0x004101f0 0xb4e /usr/lib/libstand.a(printf.o) + 0x004101f0 printf + 0x004102b0 vsprintf + 0x00410230 vprintf + 0x00410270 sprintf + *fill* 0x00410d3e 0x2 00 + .text 0x00410d40 0x1a /usr/lib/libstand.a(strlen.o) + 0x00410d40 strlen + *fill* 0x00410d5a 0x6 00 + .text 0x00410d60 0x691 /usr/lib/libstand.a(qdivrem.o) + 0x004112b0 _divdi3 + 0x00410de0 _qdivrem + 0x00411270 _umoddi3 + 0x00411230 _udivdi3 + 0x00411350 _moddi3 + *fill* 0x004113f1 0xf 00 + .text 0x00411400 0x93 /usr/lib/libstand.a(bzero.o) + 0x00411400 bzero + *fill* 0x00411493 0xd 00 + .text 0x004114a0 0x144 /usr/lib/libstand.a(bcopy.o) + 0x004114a0 bcopy + *fill* 0x004115e4 0xc 00 + .text 0x004115f0 0x3a2 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcdisk.o) + *fill* 0x00411992 0xe 00 + .text 0x004119a0 0xfa /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcconsole.o) + 0x00411a90 arc_open + *fill* 0x00411a9a 0x6 00 + .text 0x00411aa0 0xa /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(module.o) + 0x00411aa0 arc_autoload + *fill* 0x00411aaa 0x6 00 + .text 0x00411ab0 0x499 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(devicename.o) + 0x00411ab0 arc_getdev + 0x00411db0 arc_fmtdev + 0x00411ec0 arc_setcurrdev + *fill* 0x00411f49 0x7 00 + .text 0x00411f50 0x83 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(copy.o) + 0x00411fb0 arc_readin + 0x00411f80 arc_copyout + 0x00411f50 arc_copyin + *fill* 0x00411fd3 0xd 00 + .text 0x00411fe0 0x21 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(time.o) + 0x00411fe0 time + *fill* 0x00412001 0xf 00 + .text 0x00412010 0x1a /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(delay.o) + 0x00412010 delay + *fill* 0x0041202a 0x6 00 + .text 0x00412030 0x2a /usr/lib/libstand.a(dev.o.c) + 0x00412030 nodev + 0x00412050 noioctl + 0x00412040 nullsys + *(SORT(.text$*)) + *(.glue_7t) + *(.glue_7) + 0x0041205a ___CTOR_LIST__ = . + 0x0041205a __CTOR_LIST__ = . + 0x0041205a 0x4 LONG 0xffffffff + *(SORT(.ctors.*)) + *(.ctors) + *(.ctor) + 0x0041205e 0x4 LONG 0x0 + 0x00412062 ___DTOR_LIST__ = . + 0x00412062 __DTOR_LIST__ = . + 0x00412062 0x4 LONG 0xffffffff + *(SORT(.dtors.*)) + *(.dtors) + *(.dtor) + 0x00412066 0x4 LONG 0x0 + *(.fini) + *(.gcc_exc) + 0x0041206a PROVIDE (etext, .) + *(.gcc_except_table) + *(.rodata.str*) + .rodata.str1.1 + 0x0041206a 0x67b main.o + *fill* 0x004126e5 0x1b 00 + .rodata.str1.32 + 0x00412700 0x306 main.o + *fill* 0x00412a06 0x1a 00 + .rodata.str1.32 + 0x00412a20 0x76 bcache.o + .rodata.str1.1 + 0x00412a96 0x38 bcache.o + .rodata.str1.1 + 0x00412ace 0xe1 boot.o + *fill* 0x00412baf 0x11 00 + .rodata.str1.32 + 0x00412bc0 0x160 boot.o + .rodata.str1.1 + 0x00412d20 0x1b7 commands.o + *fill* 0x00412ed7 0x9 00 + .rodata.str1.32 + 0x00412ee0 0xa4 commands.o + .rodata.str1.1 + 0x00412f84 0x48 console.o + *fill* 0x00412fcc 0x14 00 + .rodata.str1.32 + 0x00412fe0 0x23 console.o + *fill* 0x00413003 0x1d 00 + .rodata.str1.32 + 0x00413020 0x23 devopen.o + .rodata.str1.1 + 0x00413043 0xd7 interp.o + *fill* 0x0041311a 0x6 00 + .rodata.str1.32 + 0x00413120 0x82 interp.o + *fill* 0x004131a2 0x1e 00 + .rodata.str1.32 + 0x004131c0 0x28 interp_parse.o + .rodata.str1.1 + 0x004131e8 0x11 interp_parse.o + .rodata.str1.1 + 0x004131f9 0x8d ls.o + *fill* 0x00413286 0x1a 00 + .rodata.str1.32 + 0x004132a0 0x20 misc.o + .rodata.str1.1 + 0x004132c0 0x1d misc.o + .rodata.str1.1 + 0x004132dd 0x19f module.o + *fill* 0x0041347c 0x4 00 + .rodata.str1.32 + 0x00413480 0x183 module.o + .rodata.str1.1 + 0x00413603 0x18 panic.o + *fill* 0x0041361b 0x5 00 + .rodata.str1.32 + 0x00413620 0x2e panic.o + .rodata.str1.1 + 0x0041364e 0xb3 load_elf32.o + *fill* 0x00413701 0x1f 00 + .rodata.str1.32 + 0x00413720 0x334 load_elf32.o + .rodata.str1.1 + 0x00413a54 0xb3 load_elf64.o + *fill* 0x00413b07 0x19 00 + .rodata.str1.32 + 0x00413b20 0x334 load_elf64.o + .rodata.str1.1 + 0x00413e54 0x86 /usr/lib/libstand.a(gzipfs.o) + *fill* 0x00413eda 0x6 00 + .rodata.str1.32 + 0x00413ee0 0x47 /usr/lib/libstand.a(gzipfs.o) + .rodata.str1.1 + 0x00413f27 0x2b /usr/lib/libstand.a(ufs.o) + .rodata.str1.1 + 0x00413f52 0x6b /usr/lib/libstand.a(_inflate.o) + .rodata.str1.1 + 0x00413fbd 0x4a /usr/lib/libstand.a(_infblock.o) + *fill* 0x00414007 0x19 00 + .rodata.str1.32 + 0x00414020 0x24 /usr/lib/libstand.a(_infblock.o) + *fill* 0x00414044 0x1c 00 + .rodata.str1.32 + 0x00414060 0x79 /usr/lib/libstand.a(pager.o) + .rodata.str1.1 + 0x004140d9 0x23 /usr/lib/libstand.a(pager.o) + .rodata.str1.1 + 0x004140fc 0x17 /usr/lib/libstand.a(getopt.o) + *fill* 0x00414113 0xd 00 + .rodata.str1.32 + 0x00414120 0x23 /usr/lib/libstand.a(getopt.o) + *fill* 0x00414143 0x1d 00 + .rodata.str1.32 + 0x00414160 0x24 /usr/lib/libstand.a(environment.o) + .rodata.str1.1 + 0x00414184 0x1 /usr/lib/libstand.a(environment.o) + .rodata.str1.1 + 0x00414185 0x84 /usr/lib/libstand.a(_zutil.o) + *fill* 0x00414209 0x17 00 + .rodata.str1.32 + 0x00414220 0x101 /usr/lib/libstand.a(_inftrees.o) + .rodata.str1.1 + 0x00414321 0x36 /usr/lib/libstand.a(_inftrees.o) + .rodata.str1.1 + 0x00414357 0x32 /usr/lib/libstand.a(_infcodes.o) + .rodata.str1.1 + 0x00414389 0x1 /usr/lib/libstand.a(strtol.o) + .rodata.str1.1 + 0x0041438a 0x1fb /usr/lib/libstand.a(strerror.o) + *fill* 0x00414585 0x1b 00 + .rodata.str1.32 + 0x004145a0 0x62 /usr/lib/libstand.a(strerror.o) + *fill* 0x00414602 0x1e 00 + .rodata.str1.32 + 0x00414620 0x1f /usr/lib/libstand.a(strdup.o) + .rodata.str1.1 + 0x0041463f 0x32 /usr/lib/libstand.a(_inffast.o) + .rodata.str1.1 + 0x00414671 0x1d /usr/lib/libstand.a(open.o) + .rodata.str1.1 + 0x0041468e 0x1e /usr/lib/libstand.a(close.o) + .rodata.str1.1 + 0x004146ac 0x5 /usr/lib/libstand.a(twiddle.o) + .rodata.str1.1 + 0x004146b1 0x23 /usr/lib/libstand.a(zalloc_malloc.o) + *fill* 0x004146d4 0xc 00 + .rodata.str1.32 + 0x004146e0 0xe7 /usr/lib/libstand.a(zalloc_malloc.o) + .rodata.str1.1 + 0x004147c7 0x2d /usr/lib/libstand.a(zalloc.o) + *fill* 0x004147f4 0xc 00 + .rodata.str1.32 + 0x00414800 0x78 /usr/lib/libstand.a(zalloc.o) + .rodata.str1.1 + 0x00414878 0x13 /usr/lib/libstand.a(printf.o) + .rodata.str1.1 + 0x0041488b 0x27 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcdisk.o) + *fill* 0x004148b2 0xe 00 + .rodata.str1.32 + 0x004148c0 0xe4 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcdisk.o) + .rodata.str1.1 + 0x004149a4 0x19 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcconsole.o) + .rodata.str1.1 + 0x004149bd 0x35 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(devicename.o) + *(SORT(.rodata.str*$*)) + +.data 0x00415000 0x1a00 + 0x00415000 __data_start__ = . + 0x00415000 __start_set_Xcommand_set = . + *(set_Xcommand_set) + set_Xcommand_set + 0x00415000 0xc main.o + set_Xcommand_set + 0x0041500c 0x4 bcache.o + set_Xcommand_set + 0x00415010 0x8 boot.o + set_Xcommand_set + 0x00415018 0x24 commands.o + set_Xcommand_set + 0x0041503c 0x4 interp.o + set_Xcommand_set + 0x00415040 0x4 ls.o + set_Xcommand_set + 0x00415044 0xc module.o + 0x00415050 __stop_set_Xcommand_set = . + *(.data) + *fill* 0x00415050 0x10 00 + .data 0x00415060 0x1c0 main.o + .data 0x00415220 0x1c conf.o + 0x00415228 file_system + 0x00415234 consoles + 0x00415220 devsw + .data 0x0041523c 0x10 bcache.o + .data 0x0041524c 0x1c boot.o + .data 0x00415268 0x6c commands.o + .data 0x004152d4 0xc interp.o + .data 0x004152e0 0x1c ls.o + .data 0x004152fc 0x44 module.o + .data 0x00415340 0xc load_elf32.o + 0x00415344 elf32_moduletype + 0x00415340 elf32_kerneltype + .data 0x0041534c 0xc load_elf64.o + 0x00415350 elf64_moduletype + 0x0041534c elf64_kerneltype + .data 0x00415358 0x55 vers.o + 0x00415373 bootprog_rev + 0x00415377 bootprog_date + 0x00415394 bootprog_maker + 0x00415358 bootprog_name + *fill* 0x004153ad 0x13 00 + .data 0x004153c0 0x28 /usr/lib/libstand.a(gzipfs.o) + 0x004153c0 gzipfs_fsops + *fill* 0x004153e8 0x18 00 + .data 0x00415400 0x34 /usr/lib/libstand.a(ufs.o) + 0x00415400 ufs_fsops + .data 0x00415434 0xc /usr/lib/libstand.a(pager.o) + .data 0x00415440 0xc /usr/lib/libstand.a(getopt.o) + 0x00415440 opterr + 0x00415444 optind + *fill* 0x0041544c 0x14 00 + .data 0x00415460 0x28 /usr/lib/libstand.a(_zutil.o) + 0x00415460 z_errmsg + *fill* 0x00415488 0x18 00 + .data 0x004154a0 0x1120 /usr/lib/libstand.a(_inftrees.o) + .data 0x004165c0 0xe8 /usr/lib/libstand.a(strerror.o) + *fill* 0x004166a8 0x18 00 + .data 0x004166c0 0xa4 /usr/lib/libstand.a(globals.o) + 0x004166e0 rootpath + 0x00416760 netmask + 0x004166c0 bcea + *fill* 0x00416764 0x1c 00 + .data 0x00416780 0x44 /usr/lib/libstand.a(_infutil.o) + 0x00416780 inflate_mask + .data 0x004167c4 0x4 /usr/lib/libstand.a(qdivrem.o) + *fill* 0x004167c8 0x18 00 + .data 0x004167e0 0x28 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcdisk.o) + 0x004167e0 arcdisk + *fill* 0x00416808 0x18 00 + .data 0x00416820 0x24 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcconsole.o) + 0x00416820 arcconsole + *(.data2) + *(SORT(.data$*)) + 0x00416844 __data_end__ = . + *(.data_cygwin_nocopy) + +.rdata 0x00417000 0xa00 + *(.rdata) + *(SORT(.rdata$*)) + *(.rodata) + .rodata 0x00417000 0x80 main.o + .rodata 0x00417080 0x164 interp_backslash.o + *fill* 0x004171e4 0x1c 00 + .rodata 0x00417200 0x4b load_elf32.o + *fill* 0x0041724b 0x15 00 + .rodata 0x00417260 0x4b load_elf64.o + *fill* 0x004172ab 0x1 00 + .rodata 0x004172ac 0x3c /usr/lib/libstand.a(_inflate.o) + *fill* 0x004172e8 0x18 00 + .rodata 0x00417300 0x74 /usr/lib/libstand.a(_infblock.o) + *fill* 0x00417374 0xc 00 + .rodata 0x00417380 0x238 /usr/lib/libstand.a(_inftrees.o) + 0x00417380 inflate_copyright + .rodata 0x004175b8 0x28 /usr/lib/libstand.a(_infcodes.o) + .rodata 0x004175e0 0x160 /usr/lib/libstand.a(printf.o) + .rodata 0x00417740 0x145 /usr/lib/libstand.a(bcd.o) + 0x00417860 hex2ascii_data + 0x00417740 bcd2bin_data + 0x004177e0 bin2bcd_data + *(SORT(.rodata$*)) + *(.rodata.*) + *(SORT(.rodata.*$*)) + *(.eh_frame) + 0x00417885 ___RUNTIME_PSEUDO_RELOC_LIST__ = . + 0x00417885 __RUNTIME_PSEUDO_RELOC_LIST__ = . + *(.rdata_runtime_pseudo_reloc) + 0x00417885 ___RUNTIME_PSEUDO_RELOC_LIST_END__ = . + 0x00417885 __RUNTIME_PSEUDO_RELOC_LIST_END__ = . + +.pdata + *(.pdata) + +.bss 0x00418000 0x10c4 + 0x00418000 __bss_start__ = . + *(.bss) + .bss 0x00418000 0x4 main.o + .bss 0x00418004 0x4 conf.o + 0x00418004 file_formats + .bss 0x00418008 0x2c bcache.o + .bss 0x00418034 0x8 boot.o + *fill* 0x0041803c 0x4 00 + .bss 0x00418040 0x50 interp_parse.o + .bss 0x00418090 0x8 module.o + 0x00418094 preloaded_files + .bss 0x00418098 0x4 /usr/lib/libstand.a(gzipfs.o) + *fill* 0x0041809c 0x4 00 + .bss 0x004180a0 0x108 /usr/lib/libstand.a(readdir.o) + .bss 0x004181a8 0x4 /usr/lib/libstand.a(pager.o) + .bss 0x004181ac 0x4 /usr/lib/libstand.a(environment.o) + 0x004181ac environ + *fill* 0x004181b0 0x10 00 + .bss 0x004181c0 0x20 /usr/lib/libstand.a(strerror.o) + .bss 0x004181e0 0x4 /usr/lib/libstand.a(twiddle.o) + .bss 0x004181e4 0x1c /usr/lib/libstand.a(zalloc_malloc.o) + .bss 0x00418200 0xc /usr/lib/libstand.a(sbrk.o) + *fill* 0x0041820c 0x14 00 + .bss 0x00418220 0x954 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcdisk.o) + *fill* 0x00418b74 0xc 00 + .bss 0x00418b80 0x80 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(devicename.o) + *(COMMON) + COMMON 0x00418c00 0x60 main.o + 0x0 (size before relaxing) + 0x00418c00 exit_env + 0x00418c30 archsw + 0x00418c4c currdev + COMMON 0x00418c60 0x120 commands.o + 0x0 (size before relaxing) + 0x00418c60 command_errmsg + 0x00418c80 command_errbuf + COMMON 0x00418d80 0xc /usr/lib/libstand.a(getopt.o) + 0x0 (size before relaxing) + 0x00418d80 optarg + 0x00418d84 optreset + 0x00418d88 optopt + *fill* 0x00418d8c 0x14 00 + COMMON 0x00418da0 0x1b8 /usr/lib/libstand.a(globals.o) + 0x0 (size before relaxing) + 0x00418da0 domainname + 0x00418e20 nameip + 0x00418e24 hostnamelen + 0x00418e28 errno + 0x00418e2c swapip + 0x00418e30 rootip + 0x00418e34 myip + 0x00418e40 hostname + 0x00418ec0 bootfile + 0x00418f40 gateip + 0x00418f44 ifname + 0x00418f54 domainnamelen + *fill* 0x00418f58 0x8 00 + COMMON 0x00418f60 0x160 /usr/lib/libstand.a(open.o) + 0x0 (size before relaxing) + 0x00418f60 files + COMMON 0x004190c0 0x4 /usr/src/sys/boot/arc/sgildr/../lib/libarc.a(arcconsole.o) + 0x0 (size before relaxing) + 0x004190c0 console + 0x004190c4 __bss_end__ = . + +.edata + *(.edata) + +/DISCARD/ + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + +.idata 0x0041a000 0x200 + SORT(*)(.idata$2) + SORT(*)(.idata$3) + 0x0041a000 0x4 LONG 0x0 + 0x0041a004 0x4 LONG 0x0 + 0x0041a008 0x4 LONG 0x0 + 0x0041a00c 0x4 LONG 0x0 + 0x0041a010 0x4 LONG 0x0 + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + +.CRT + *(SORT(.CRT$*)) + +.endjunk 0x0041b000 0x0 + 0x0041b000 PROVIDE (end, .) + 0x0041b000 PROVIDE (_end, .) + 0x0041b000 __end__ = . + +.rsrc + *(.rsrc) + *(SORT(.rsrc$*)) + +.reloc + *(.reloc) + +.stab + *(.stab) + +.stabstr + *(.stabstr) +LOAD main.o +LOAD conf.o +LOAD bcache.o +LOAD boot.o +LOAD commands.o +LOAD console.o +LOAD devopen.o +LOAD interp.o +LOAD interp_backslash.o +LOAD interp_parse.o +LOAD ls.o +LOAD misc.o +LOAD module.o +LOAD panic.o +LOAD load_elf32.o +LOAD load_elf64.o +LOAD vers.o +LOAD /usr/lib/libstand.a +LOAD /usr/src/sys/boot/arc/sgildr/../lib/libarc.a +LOAD /usr/lib/libstand.a +OUTPUT(loader.exe pei-i386) Binary files arc/sgildr/ls.o and arc.sgi/sgildr/ls.o differ diff -uNr arc/sgildr/main.c arc.sgi/sgildr/main.c --- arc/sgildr/main.c Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/main.c Sun Dec 28 07:48:36 2003 @@ -0,0 +1,730 @@ +/*- + * Copyright (c) 1998 Michael Smith + * Copyright (c) 1998 Doug Rabson + * 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. + * + * $FreeBSD: src/sys/boot/arc/loader/main.c,v 1.3 1999/08/28 00:39:42 peter Exp $ + */ + + +#include +#include +#include + +#include + +#if 1 +#include +#include +#endif + +#include "bootstrap.h" +#include "libarc.h" +#include "arctypes.h" +#include "arcfuncs.h" + +#define elementsof(x) (sizeof(x)/sizeof(*(x))) + +#define __stdcall __attribute__((__stdcall__)) +#define __noinline __attribute__((__noinline__)) + +extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; + +struct arc_devdesc currdev; /* our current device */ +struct arch_switch archsw; /* MI/MD interface boundary */ + +extern char end[]; +extern void halt(void); + +#define ARCENV_BOOTFILE "OSLoadFilename" + +#if 1 + +static __inline void +sgdt(struct region_descriptor *addr) +{ + __asm __volatile("sgdt (%0)" : "=r" (addr)); +} + +static __inline void +sidt(struct region_descriptor *addr) +{ + __asm __volatile("sidt (%0)" : "=r" (addr)); +} + +static __inline void +sldt(struct region_descriptor *addr) +{ + __asm __volatile("sldt (%0)" : "=r" (addr)); +} + +static __inline u_int +rds(void) +{ + u_int sel; + __asm __volatile("movl %%ds,%0" : "=rm" (sel)); + return (sel); +} + +static __inline u_int +res(void) +{ + u_int sel; + __asm __volatile("movl %%es,%0" : "=rm" (sel)); + return (sel); +} + +static __inline u_int +rcs(void) +{ + u_int sel; + __asm __volatile("movl %%cs,%0" : "=rm" (sel)); + return (sel); +} + +static __inline u_int +rss(void) +{ + u_int sel; + __asm __volatile("movl %%ss,%0" : "=rm" (sel)); + return (sel); +} + +static __inline u_int +resp(void) +{ + u_int esp; + __asm __volatile("movl %%esp,%0" : "=rm" (esp)); + return (esp); +} + +static __inline u_int +reip(void) +{ + return((u_int)__builtin_return_address(0)); +} + +#endif /* cpu state inlines */ + +static const char * const SegmentTypes[] = { + "NULL", + "286TSS", + "LDT", + "286BSY", + "286CGT", + "TASKGT", + "286IGT", + "286TGT", + "NULL", + "386TSS", + "NULL", + "386BSY", + "386CGT", + "NULL", + "386IGT", + "386TGT", + "RO", + "ROA", + "RW", + "RWA", + "ROD", + "RODA", + "RWD", + "RWDA", + "E", + "EA", + "ER", + "ERA", + "EC", + "EAC", + "ERC", + "ERAC" +}; + +static __inline const char * const +segtype2str(const int type) +{ + + if (type < 0 || type > SDT_MEMERAC) + return ("(invalid)"); + + return (SegmentTypes[type]); +} + +void +dumpdt(struct region_descriptor *dt) +{ + int i, lim; + struct segment_descriptor *sd; + + sd = (struct segment_descriptor *)(dt->rd_base); + lim = dt->rd_limit/sizeof(*sd); + + for (i = 0; i < lim; i++, sd++) { + if (!sd->sd_p) + continue; + printf("seg 0x%04x: type=%s base=0x%08x " + "lim=0x%08x %s %s pri=%1d\n", i * sizeof(*sd), + segtype2str(sd->sd_type), + (sd->sd_hibase << 24) | sd->sd_lobase, + (sd->sd_hilimit << 16) | sd->sd_lolimit, + sd->sd_gran ? "pages" : "bytes", + sd->sd_def32 ? "def32" : "def16", + sd->sd_p); + } +} + +static __inline void +dumpeip(void) +{ + printf("ss:esp 0x%04x:%08x cs:eip 0x%04x:%08x\n", + rss(), resp(), rcs(), reip()); +} + +static __inline void +dumpstack(void) +{ + register int i; + register char *cp; + + dumpeip(); + + printf("esp-16: "); + cp = (char *)resp() - 16; + for (i = 0; i < 16; i++) + printf("%02x ", (unsigned int) *cp++ & 0xFF); + printf("\n"); + printf("esp+16: "); + for (i = 0; i < 16; i++) + printf("%02x ", (unsigned int) *cp++ & 0xFF); + printf("\n"); +} + +void +dumpcpu(void) +{ + struct region_descriptor gdt, ldt, idt; + + printf("dumping cpu state:\n"); + bzero(&gdt, sizeof(gdt)); sgdt(&gdt); + bzero(&ldt, sizeof(ldt)); sldt(&gdt); + bzero(&idt, sizeof(idt)); sidt(&gdt); + printf("ss:esp 0x%04x:%08x cs:eip 0x%04x:%08x gdt: 0x%04x:%08x\n", + rss(), resp(), rcs(), reip(), gdt.rd_limit, gdt.rd_base); + printf("ldt: 0x%04x:%08x idt: 0x%04x:%08x\n", + ldt.rd_limit, ldt.rd_base, idt.rd_limit, idt.rd_base); + printf("ds: 0x%04x es: 0x%04x, fs: 0x%04x gs: 0x%04x\n", + rds(), res(), rfs(), rgs()); + printf("cr0: 0x%08x cr2: 0x%08x cr3: 0x%08x cr4: 0x%08x\n", + rcr0(), rcr2(), rcr3(), rcr4()); + + if (gdt.rd_base != 0 && gdt.rd_limit != 0) { + printf("hit a key to dump the gdt:\n"); + getchar(); + dumpdt(&gdt); + } + printf("\n"); +} + +static char *MemoryTypes[] = { + "MemoryExceptionBlock", + "MemorySystemBlock", + "MemoryFree", + "MemoryBad", + "MemoryLoadedProgram", + "MemoryFirmwareTemporary", + "MemoryFirmwarePermanent", + "MemoryFreeContiguous", + "MemorySpecialMemory", + "MemoryMaximum", +}; + +#ifdef __alpha__ +#define ptob(p) ((p) << 13) +#else +#define ptob(x) i386_ptob(x) +#endif + +unsigned long +memsize() +{ + unsigned long amount = 0; + MEMORY_DESCRIPTOR *desc; + + for (desc = GetMemoryDescriptor(NULL); desc; + desc = GetMemoryDescriptor(desc)) { + printf("%s at %x-%x\n", MemoryTypes[desc->Type], + ptob(desc->BasePage), + ptob(desc->BasePage + desc->PageCount)); + if (desc->Type == MemoryFree + || desc->Type == MemoryFirmwareTemporary) + amount += (desc->PageCount << 13); /* XXX pagesize */ + } + + return amount; +} + +static char *ConfigurationClasses[] = { + "SystemClass", + "ProcessorClass", + "CacheClass", + "AdapterClass", + "ControllerClass", + "PeripheralClass", + "MemoryClass", + "MaximumClass", +}; + + +static char *ConfigurationTypes[] = { + "ArcSystem", + "CentralProcessor", + "FloatingPointProcessor", + "PrimaryIcache", + "PrimaryDcache", + "SecondaryIcache", + "SecondaryDcache", + "SecondaryCache", + "EisaAdapter", + "TcAdapter", + "ScsiAdapter", + "DtiAdapter", + "MultiFunctionAdapter", + "DiskController", + "TapeController", + "CdromController", + "WormController", + "SerialController", + "NetworkController", + "DisplayController", + "ParallelController", + "PointerController", + "KeyboardController", + "AudioController", + "OtherController", + "DiskPeripheral", + "FloppyDiskPeripheral", + "TapePeripheral", + "ModemPeripheral", + "MonitorPeripheral", + "PrinterPeripheral", + "PointerPeripheral", + "KeyboardPeripheral", + "TerminalPeripheral", + "OtherPeripheral", + "LinePeripheral", + "NetworkPeripheral", + "SystemMemory", + "MaximumType", +}; + + +static char *ConfigurationTypeCodes[] = { + "ARC", + "CPU", + "FPC", + "PrimaryIcache", + "PrimaryDcache", + "SecondaryIcache", + "SecondaryDcache", + "SecondaryCache", + "eisa", + "tc", + "scsi", + "dti", + "multi", + "disk", + "tape", + "cdrom", + "worm", + "serial", + "network", + "video", + "par", + "point", + "key", + "audio", + "other", + "rdisk", + "fdisk", + "tape", + "modem", + "monitor", + "print", + "pointer", + "keyboard", + "term", + "other", + "line", + "network", + "Memory", + "MaximumType" +}; + +static __inline const char * const +confclass2str(int class) +{ + + if (class >= 0 && class < (sizeof(ConfigurationClasses)/sizeof(char *))) + return (ConfigurationClasses[class]); + + return ("null"); +} + +static __inline const char * const +conftype2str(int type) +{ + + if (type >= 0 && type < (sizeof(ConfigurationTypes)/sizeof(char *))) + return (ConfigurationTypes[type]); + + return ("null"); +} + +static __inline const char * const +conftypecode2str(int type) +{ + + if (type >= 0 && type < (sizeof(ConfigurationTypeCodes)/sizeof(char *))) + return (ConfigurationTypeCodes[type]); + + return ("null"); +} + +static void +indent(int level) +{ + while (level--) + putchar(' '); +} + +typedef void walktree_func_t(CONFIGURATION_COMPONENT *, void *); + +void +dumpnode(CONFIGURATION_COMPONENT *c, void *cbp) +{ + + printf("%p\n", c); +#if 0 + if (c->IdentifierLength > 0 && (ptr(c->Identifier) != NULL)) + printf("=%d,%s", c->IdentifierLength, + (char *)ptr(c->Identifier)); + putchar('\n'); +#endif +#if 0 + printf("Hit a key to see the next node.\n"); + getchar(); +#endif +} + +CONFIGURATION_COMPONENT * +walktree(CONFIGURATION_COMPONENT *c) +{ + CONFIGURATION_COMPONENT *c1; + + if (c == NULL) + return (NULL); + + printf("%p", c); + + if ((c1 = walktree(GetChild(c))) != NULL) + return (NULL); + + if ((c1 = walktree(GetPeer(c))) != NULL) + return (NULL); + + return (NULL); +} + +void +dumpdisk(const char *name) +{ + u_int32_t fd, count; + unsigned char buf[512]; + int i, j; + + printf("dump first sector of %s\n", name); + if (Open(name, OpenReadOnly, &fd) != ESUCCESS) { + printf("can't open disk\n"); + return; + } + if (Read(fd, buf, 512, &count) != ESUCCESS) { + printf("can't read from disk\n"); + Close(fd); + return; + } + for (i = 0; i < 16; i++) { + for (j = 0; j < 32; j++) + printf("%02x", buf[i*32 + j]); + putchar('\n'); + } + Close(fd); +} + +CONFIGURATION_COMPONENT * +walkdisks(char *path, CONFIGURATION_COMPONENT *c) +{ + CONFIGURATION_COMPONENT *c1; + char newpath[80]; + char keybuf[20]; + + if (c == NULL) + return (NULL); + + if (path == NULL) { + printf("\nARC disk devices:\n"); + newpath[0] = '\0'; + } else { + strcpy(newpath, path); + strcat(newpath, ConfigurationTypeCodes[c->Type]); + sprintf(keybuf, "(%d)", c->Key); + strcat(newpath, keybuf); + } + + if (c->Type == DiskPeripheral || c->Type == FloppyDiskPeripheral) + printf("%s\n", newpath); + + if ((c1 = walkdisks(newpath, GetChild(c))) != NULL) + return (NULL); + + if ((c1 = walkdisks(newpath, GetPeer(c))) != NULL) + return (NULL); + + return (NULL); +} + +void +listdisks(char *path, CONFIGURATION_COMPONENT *component) +{ + CONFIGURATION_COMPONENT *child; + char newpath[80]; + char keybuf[20]; + + if (path == NULL) { + printf("\nARC disk devices:\n"); + newpath[0] = '\0'; + } else { + strcpy(newpath, path); + strcat(newpath, ConfigurationTypeCodes[component->Type]); + sprintf(keybuf, "(%d)", component->Key); + strcat(newpath, keybuf); + } + if (!strcmp(ConfigurationTypeCodes[component->Type], "rdisk") || + !strcmp(ConfigurationTypeCodes[component->Type], "fdisk")) { + printf("%s\n", newpath); + } + for (child = GetChild(component); child; child = GetPeer(child)) { + listdisks(newpath, child); + } +} + +static int exit_code = 0; +jmp_buf exit_env; + +void +exit(int code) +{ + exit_code = 0; + longjmp(exit_env, 1); +} + +__stdcall int +main(int argc, int argv[], int envp[]) +{ + int i; + char *bootfile; + + if (setjmp(exit_env)) + return exit_code; + + /* + * Initialise the heap as early as possible. Once this is done, + * alloc() is usable. The stack is buried inside us, so this is + * safe. + */ + setheap((void *)end, (void *)(end + 512*1024)); + + /* + * XXX Chicken-and-egg problem; we want to have console output + * early, but some console attributes may depend on reading from + * eg. the boot device, which we can't do yet. We can use + * printf() etc. once this is done. + */ + cons_probe(); +#if 0 + printf("hit a key to dump cpu state...\n"); + getchar(); + dumpcpu(); +#endif +#if 1 + printf("\nattempting to dump firmware config\n"); + (void)walktree(GetChild(NULL)); +#endif +#if 0 + printf("back in main()...\n"); + printf("hit a key to dump eip/ss...\n"); + getchar(); + dumpeip(); +#endif +#if 0 + /* dumpdisk() never seems to return */ + printf("\nattempting to dump basic disk config\n"); + dumpdisk("scsi(0)disk(0)rdisk(0)partition(0)"); +#endif +#if 1 + walkdisks(NULL, GetChild(NULL)); + printf("back in main()...\n"); + printf("hit a key to dump eip/ss...\n"); + getchar(); + dumpeip(); +#endif +#if 0 // XXX + listdisks(NULL, GetChild(NULL)); + printf("\n"); +#endif + +#if 0 + make_rpb(); +#endif + + /* + * Initialise the block cache + */ + printf("\nattempting to initialize block cache\n"); + bcache_init(32, 512); /* 16k XXX tune this */ + + /* + * March through the device switch probing for things. + */ + printf("\nattempting to initialize onboard devices\n"); + for (i = 0; devsw[i] != NULL; i++) { + if (devsw[i]->dv_init != NULL) { + printf("calling dv_init vector %d at %p", i, devsw[i]->dv_init); + (devsw[i]->dv_init)(); + } + } + + printf("\nattempting to walk memory list\n"); + printf("\n"); + printf("%s, Revision %s\n", bootprog_name, bootprog_rev); + printf("(%s, %s)\n", bootprog_maker, bootprog_date); +#if 0 + /* memsize() seems never to return */ + printf("Memory: %ld k\n", memsize() / 1024); +#endif + + +#if 0 + /* We're booting from an SRM disk, try to spiff this */ + /* XXX presumes that biosdisk is first in devsw */ + currdev.d_dev = devsw[0]; + currdev.d_type = currdev.d_dev->dv_type; + currdev.d_kind.arcdisk.unit = 0; + /* XXX should be able to detect this, default to autoprobe */ + currdev.d_kind.arcdisk.slice = -1; + /* default to 'a' */ + currdev.d_kind.arcdisk.partition = 0; +#endif + + /* Create arc-specific variables */ + printf("\nattempting to set environment variables\n"); + bootfile = GetEnvironmentVariable(ARCENV_BOOTFILE); + if (bootfile) + setenv("bootfile", bootfile, 1); + +#if 0 + env_setenv("currdev", EV_VOLATILE, + arc_fmtdev(&currdev), arc_setcurrdev, + env_nounset); + env_setenv("loaddev", EV_VOLATILE, + arc_fmtdev(&currdev), env_noset, env_nounset); +#endif + +#if 1 + setenv("LINES", "24", 1); /* optional */ +#endif + + archsw.arch_autoload = arc_autoload; + archsw.arch_getdev = arc_getdev; + archsw.arch_copyin = arc_copyin; + archsw.arch_copyout = arc_copyout; + archsw.arch_readin = arc_readin; + + printf("entering interact()\n"); + interact(); /* doesn't return */ + + return 0; /* keep compiler happy */ +} + +COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); + +static int +command_reboot(int argc, char *argv[]) +{ + + printf("Rebooting...\n"); + delay(1000000); + FwReboot(); + /* Note: we shouldn't get to this point! */ + panic("Reboot failed!"); + exit(0); +} + +COMMAND_SET(quit, "quit", "exit the loader", command_quit); + +static int +command_quit(int argc, char *argv[]) +{ + exit(0); + return(CMD_OK); +} + +#if 0 + +COMMAND_SET(stack, "stack", "show stack usage", command_stack); + +static int +command_stack(int argc, char *argv[]) +{ + char *cp; + + for (cp = &stackbase; cp < &stacktop; cp++) + if (*cp != 0) + break; + + printf("%d bytes of stack used\n", &stacktop - cp); + return(CMD_OK); +} + +#endif + +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 %ld\n", end, sbrk(0), + (long)(sbrk(0) - end)); + return(CMD_OK); +} Binary files arc/sgildr/main.o and arc.sgi/sgildr/main.o differ Binary files arc/sgildr/misc.o and arc.sgi/sgildr/misc.o differ Binary files arc/sgildr/module.o and arc.sgi/sgildr/module.o differ Binary files arc/sgildr/panic.o and arc.sgi/sgildr/panic.o differ diff -uNr arc/sgildr/vers.c arc.sgi/sgildr/vers.c --- arc/sgildr/vers.c Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/vers.c Sun Dec 28 07:22:18 2003 @@ -0,0 +1,4 @@ +char bootprog_name[] = "FreeBSD/i386 ARC disk boot"; +char bootprog_rev[] = "0.1"; +char bootprog_date[] = "Sun Dec 28 07:22:18 GMT 2003"; +char bootprog_maker[] = "bms@saboteur.dek.spc.org"; Binary files arc/sgildr/vers.o and arc.sgi/sgildr/vers.o differ diff -uNr arc/sgildr/version arc.sgi/sgildr/version --- arc/sgildr/version Thu Jan 1 01:00:00 1970 +++ arc.sgi/sgildr/version Mon Dec 22 18:25:25 2003 @@ -0,0 +1,7 @@ +$FreeBSD: src/sys/boot/arc/loader/version,v 1.2 1999/08/28 00:39:43 peter Exp $ + +NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this +file is important. Make sure the current version number is on line 6. + +0.1: Initial i386 version, germinated from the NetBSD i386 + standalone, but enormously modified.