diff options
author | Steve Murphree <smurph@cvs.openbsd.org> | 1998-08-22 07:04:22 +0000 |
---|---|---|
committer | Steve Murphree <smurph@cvs.openbsd.org> | 1998-08-22 07:04:22 +0000 |
commit | 1000160a2b09a1dd62377583a88600e59d4cacb4 (patch) | |
tree | 35c81582befbdb86d9aba6e12b3cec128a0e4b79 /sys/arch/mvme88k | |
parent | 480d88b604e88817b77c5652aa93f9d7ee4c3619 (diff) |
Part of remove to clean stand.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r-- | sys/arch/mvme88k/stand/boot/Makefile | 30 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/boot/main.c | 267 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/boot/wrtvid.c | 108 |
3 files changed, 0 insertions, 405 deletions
diff --git a/sys/arch/mvme88k/stand/boot/Makefile b/sys/arch/mvme88k/stand/boot/Makefile deleted file mode 100644 index df343d81f70..00000000000 --- a/sys/arch/mvme88k/stand/boot/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -all: boot boot.out -CFLAGS+=-fwritable-strings -I${.CURDIR}/../include -CFLAGS+=-I${.CURDIR}/../.. -I${.CURDIR}/../../machine -CFLAGS+=-I/usr/src/sys -LDFLAGS+= -L ${.CURDIR}/../libbug -L/usr/local/lib -BOOT=FC0000 -#BOOT=1000000 - -LIBBUG!= cd $(.CURDIR)/../libbug; \ - printf "xxx:\n\techo \$${.OBJDIR}/libbug.a\n" | ${MAKE} -r -s -f - xxx - -LDADD+=${LIBBUG} #/usr/local/lib/libgcc.a -SRCS+=bugcrt.c bugio.c main.c - -.PATH: ${.CURDIR}/../bugcrt ${.CURDIR}/../libbug ${.CURDIR}/../../../../lib/libc_sa ${.CURDIR}/${MACHINE_ARCH} - -boot: bugcrt.o main.o bcopy.o memset.o printf.o ${LIBBUG} -# ld -o {.TARGET} -x -n -Ttext ${BOOT} bugcrt.o bugio.o main.o bcopy.o memset.o printf.o /usr/local/lib/libgcc.a - ld -o ${.TARGET} -x -N -Ttext ${BOOT} ${.ALLSRC} ${LDADD} - -boot.out: - ${.CURDIR}/wrtvid ${.OBJDIR}/boot && mv ${.OBJDIR}/boot.? ${.CURDIR} - -#main.o: main.c -# ${CC} ${CFLAGS} -c -O ${.ALLSRC} -# ${LD} -x -r ${.TARGET} -# ${LD} -x ${.TARGET} -# mv a.out ${.TARGET} - -.include <bsd.prog.mk> diff --git a/sys/arch/mvme88k/stand/boot/main.c b/sys/arch/mvme88k/stand/boot/main.c deleted file mode 100644 index 1fbc9f65390..00000000000 --- a/sys/arch/mvme88k/stand/boot/main.c +++ /dev/null @@ -1,267 +0,0 @@ -#include <sys/param.h> -#include <sys/reboot.h> -#include "bug.h" -#include "bugio.h" -#include "machine/exec.h" - -int readblk __P((int, char *)); -int loados __P((void)); -void putchar __P((char)); -void _main __P((void)); -void tapefileseek __P((int)); - -char Clun, Dlun; - -#define DEV_BSIZE 512 -#define KERNEL_LOAD_ADDR 0x10000 -#if !defined(BUG_BLKSIZE) -#define BUG_BLKSIZE 256 -#endif /* BUG_BLKSIZE */ -#define sec2blk(x) ((x) * (DEV_BSIZE/BUG_BLKSIZE)) - -struct kernel { - void *entry; - void *symtab; - void *esym; - int bflags; - int bdev; - char *kname; - void *smini; - void *emini; - unsigned int end_loaded; -} kernel; - -int howto = 0; -int bootdev = 0; -int *miniroot; - -void -putchar(char c) -{ - bugoutchr(c); -} - -main(struct bugenv *env) -{ - printf("Clun %x Dlun %x\n", env->clun, env->dlun); - Clun = (char)env->clun; - Dlun = (char)env->dlun; - loados(); - return; -} - - -loados(void) -{ - int i, size; - register char *loadaddr = (char *)KERNEL_LOAD_ADDR; /* load addr 64k*/ - struct exec *hdr; - int (*fptr)(); - int *esym; - int cnt, strtablen, ret; - char *addr; - - howto |= RB_SINGLE|RB_KDB; - - tapefileseek(2); /* seek to file 2 - the OS */ - if (readblk(1, loadaddr) == -1) { - printf("Unable to read blk 0\n"); - return 1; - } - hdr = (struct exec *)loadaddr; - - /* We only deal with ZMAGIC files */ - if ((int)hdr->a_entry != (int)(loadaddr + sizeof(struct exec))) { - printf("a_entry != loadaddr + exec size\n"); - } - size = hdr->a_text + hdr->a_data; - size -= DEV_BSIZE; /* account for the block already read */ - - printf("Loading [%x+%x", hdr->a_text, hdr->a_data); - if (readblk(size / DEV_BSIZE, loadaddr + DEV_BSIZE) == -1) { - printf("Error reading the OS\n"); - return 1; - } - - /* zero out BSS */ - - printf("+%x]", hdr->a_bss); - printf("zero'd out %x (%x)\n", loadaddr + hdr->a_text + hdr->a_data, - hdr->a_bss); - /*memset(loadaddr + hdr->a_text + hdr->a_data, 0, hdr->a_bss); */ - bzero(loadaddr + hdr->a_text + hdr->a_data, hdr->a_bss); - - addr = loadaddr + hdr->a_text + hdr->a_data + hdr->a_bss; - - if (hdr->a_syms != 0 /* && !(kernel.bflags & RB_NOSYM)*/) { - /* - * DDB expects the following layout: - * no. of syms - * symbols - * size of strtab - * entries of strtab - * esym->... - * Where as size of strtab is part of strtab, we need - * to prepend the size of symtab to satisfy ddb. - * esym is expected to point past the last byte of - * string table, rouded up to an int. - */ - bcopy(&hdr->a_syms, addr, sizeof(hdr->a_syms)); - addr += 4; /* account for a_syms copied above */ - printf (" + [ %x",hdr->a_syms); - - cnt = (hdr->a_syms + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1); - - ret = readblk(cnt / DEV_BSIZE, addr); - if (ret != 0) { - printf("unable to load kernel\n"); - return 1; - } - - esym = (void *) ((int)addr + hdr->a_syms); - - if ((int)addr + cnt <= (int)esym) { - printf("missed loading count of symbols\n\r"); - return 1; - } - - addr += cnt; - - strtablen = *esym; -#if 0 - printf("start load %x end load %x %x\n", addr, - len, addr +len); - printf("esym %x *esym %x\n",esym, len); -#endif - /* - * If symbol table size is not a sector multiple, we - * already read part of the string table. Look at the - * part already read, and figure out the string table - * size. Also, adjust the size yet to read. - */ - if (hdr->a_syms != cnt) { - /* already read part of the string table */ - strtablen -= (cnt - hdr->a_syms); - } - - if (strtablen > 0) { - printf(" + %x",*esym); - - cnt = (strtablen + DEV_BSIZE -1) & ~(DEV_BSIZE - 1); - - ret = readblk(cnt / DEV_BSIZE, addr); - if (ret != 0) { - printf("unable to load kernel\n"); - return 1; - } - addr += strtablen; - printf(" ]\n"); - } else { - printf("+ %x ]\n", *esym); - } - esym = (int *)(((int)esym) + *esym); - esym = (int *)(((int)esym + 4 - 1) & ~3); - - kernel.symtab = (void *)hdr->a_syms; - kernel.esym = esym; - } else { - kernel.symtab = 0; - kernel.esym = 0; - } - - kernel.end_loaded = (unsigned int)addr; - miniroot = (int *)esym; - miniroot = (int *)(((int)miniroot + 0x1000 - 1) & ~0xFFF); - tapefileseek(3); /* seek to file 3 - minroot */ -#if 0 - if (readblk(1000, miniroot) != 0) { /* 5 Mb */ - printf("miniroot not loaded\n"); - addr = (char *)miniroot; - } else { - addr = (char *)((int)miniroot + 1000 * DEV_BSIZE); - } -#endif /* 0 */ - readblk(4096, miniroot); /* 2 Mb */ - addr = (char *)((int)miniroot + 4096 * DEV_BSIZE); - printf("esym %x miniroot @ %x (ends @ %x)\n", esym, miniroot, addr); -#if 0 - { - char *symaddr = (char *)0x01F00000; - int i; - - tapefileseek(4); /* seek to file 4 - syms */ - readblk(1, symaddr); - i = *symaddr; - i = (i * 0x1C + 4 + DEV_BSIZE) & ~(DEV_BSIZE - 1); - printf("loading %d symbols (%d sectors)\n", - *symaddr, (i + 1) * DEV_BSIZE); - readblk(i / DEV_BSIZE, symaddr + DEV_BSIZE); - readblk(100, 0x01F00000); - } -#endif - - fptr = (int (*)())hdr->a_entry; - /* - * Args are passed as - * r2 howto - * r3 end addr - * r4 (Clun << 8) | Dlun & FF - * r5 esym - * r6 miniroot - */ - bootdev = ((Clun << 8) & 0xFF00 | Dlun & 0xFF) & 0xFFFF; -#if 0 - asm volatile ("or r2, r0, %0\n\tor r3, r0, %1\n\tor r4, r0, %2\n\tor r5, r0, %3\n\tor r6, r0, %4\n\tor r7, r0, %5" - : /* no outputs */ - : "r" (howto), "r" (addr), "r" (Clun), "r" (Dlun), "r" (esym), "r" (miniroot) - : "r2", "r3", "r4", "r5", "r6", "r7"); -#endif /* 0 */ - (*fptr)(howto, addr, bootdev, esym, miniroot); - return 0; -} - -int -readblk(int n, char *addr) -{ - struct bugdisk_io io; - - io.clun = Clun; - io.dlun = Dlun; - io.status = 0; - io.addr = (void *)addr; - io.fileno = 0; /* for tape reads, start io at current pos */ - io.nblks = sec2blk(n); - io.flag = IGNOREFILENO; - io.am = 0; - bugdskrd(&io); - if (io.status) - return -1; - return 0; -} - -void -_main(void) -{ - return; -} - -void -tapefileseek(int i) -{ - struct bugdisk_io io; - void *addr = (void *)KERNEL_LOAD_ADDR; /* some number - don't care */ - - io.clun = Clun; - io.dlun = Dlun; - io.status = 0; - io.addr = addr; - io.fileno = i; /* for tape reads, this is the file no. */ - io.nblks = 0; - io.flag = 0; /* we want to turn off IFN and EOF bits */ - io.am = 0; - bugdskrd(&io); -} - -__main() -{ -} diff --git a/sys/arch/mvme88k/stand/boot/wrtvid.c b/sys/arch/mvme88k/stand/boot/wrtvid.c deleted file mode 100644 index 6161ccaa85a..00000000000 --- a/sys/arch/mvme88k/stand/boot/wrtvid.c +++ /dev/null @@ -1,108 +0,0 @@ -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#include "vid.h" - -#define sec2blk(x) ((x) * 2) - -main(int argc, char **argv) -{ - struct vid *pvid; - struct cfg *pcfg; - struct stat stat; - int exe_file; - int tape_vid; - int tape_exe; - unsigned int exe_addr; - unsigned short exe_addr_u; - unsigned short exe_addr_l; - char *filename; - char fileext[256]; - - if (argc == 0){ - filename = "a.out"; - } else { - filename = argv[1]; - } - exe_file = open(filename, O_RDONLY,0444); - if (exe_file == -1) - { - printf("file %s does not exist\n",filename); - exit(2); - } - sprintf (fileext,"%s%s",filename,".1"); - tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644); - sprintf (fileext,"%s%s",filename,".2"); - tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644); - - pvid = (struct vid *) malloc(sizeof (struct vid)); - - memset(pvid,0,sizeof(struct vid)); - - strcpy(pvid->vid_id, "NBSD"); - - fstat (exe_file,&stat); - /* size in 512 byte blocks round up after a.out header removed */ - /* Actually, blocks == 256 bytes */ - - pvid->vid_oss = 1; - pvid->vid_osl = (short)sec2blk((stat.st_size - 0x20 + 511) / 512); - - lseek(exe_file,0x14,SEEK_SET); - read(exe_file,&exe_addr,4); - { - union { - struct { - short osa_u; - short osa_l; - } osa_u_l; - int osa; - } u; - u.osa = exe_addr; - pvid->vid_osa_u = u.osa_u_l.osa_u; - pvid->vid_osa_l = u.osa_u_l.osa_l; - } - pvid->vid_cas = 1; - pvid->vid_cal = 1; - /* do not want to write past end of structure, not null terminated */ - strcpy(pvid->vid_mot,"MOTOROL"); - pvid->vid_mot[7] = 'A'; - - write(tape_vid,pvid,sizeof(struct vid)); - - free(pvid); - - pcfg = (struct cfg *) malloc (sizeof(struct cfg)); - - memset(pcfg,0,sizeof(struct cfg)); - - pcfg->cfg_rec = 0x100; - pcfg->cfg_psm = 0x200; - - write(tape_vid,pcfg,sizeof(struct cfg)); - - free(pcfg); - - copy_exe(exe_file,tape_exe); - close (exe_file); - close (tape_vid); - close (tape_exe); -} - -#define BUF_SIZ 512 -copy_exe(exe_file,tape_exe) -{ - char *buf; - int cnt = 0; - - buf = (char *)malloc (BUF_SIZ); - - lseek (exe_file,0x20,SEEK_SET); - while (BUF_SIZ == (cnt = read(exe_file, buf , BUF_SIZ))) { - write (tape_exe,buf,cnt); - } - memset (&buf[cnt],0,BUF_SIZ-cnt); - write (tape_exe,buf,BUF_SIZ); -} |