diff options
Diffstat (limited to 'distrib/powerpc/common')
-rw-r--r-- | distrib/powerpc/common/rdsetroot.c | 214 | ||||
-rw-r--r-- | distrib/powerpc/common/termcap.vt | 23 |
2 files changed, 0 insertions, 237 deletions
diff --git a/distrib/powerpc/common/rdsetroot.c b/distrib/powerpc/common/rdsetroot.c deleted file mode 100644 index 14655750ab7..00000000000 --- a/distrib/powerpc/common/rdsetroot.c +++ /dev/null @@ -1,214 +0,0 @@ -/* $OpenBSD: rdsetroot.c,v 1.2 1997/11/26 02:32:28 deraadt Exp $ */ -/* $NetBSD: rdsetroot.c,v 1.2 1995/10/13 16:38:39 gwr Exp $ */ - -/* - * Copyright (c) 1994 Gordon W. Ross - * All rights reserved. - * - * ELF modifications Copyright (c) 1997 Per Fogelstrom. - * - * 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. 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. - */ - -/* - * Copy a ramdisk image into the space reserved for it. - * Kernel variables: rd_root_size, rd_root_image - */ - -#include <sys/types.h> -#include <sys/file.h> -#include <sys/mman.h> - -#include <stdio.h> -#include <nlist.h> -#include <sys/exec_elf.h> - -extern off_t lseek(); - -char *file; - -/* Virtual addresses of the symbols we frob. */ -long rd_root_image_va, rd_root_size_va; - -/* Offsets relative to start of data segment. */ -long rd_root_image_off, rd_root_size_off; - -/* value in the location at rd_root_size_off */ -int rd_root_size_val; - -/* pointers to pieces of mapped file */ -char *dataseg; - -/* parameters to mmap digged out from program header */ -int mmap_offs; -int mmap_size; - -main(argc,argv) - char **argv; -{ - int fd, n; - int found; - int *ip; - char *cp; - Elf32_Ehdr eh; - Elf32_Phdr *ph; - int phsize; - - if (argc < 2) { - printf("%s: missing file name\n", argv[0]); - exit(1); - } - file = argv[1]; - - fd = open(file, O_RDWR); - if (fd < 0) { - perror(file); - exit(1); - } - - n = read(fd, &eh, sizeof(eh)); - if (n < sizeof(eh)) { - printf("%s: reading header\n", file); - exit(1); - } - - if (!IS_ELF(eh)) { - printf("%s: not elf\n", file); - exit(1); - } - - phsize = eh.e_phnum * sizeof(Elf32_Phdr); - ph = (Elf32_Phdr *)malloc(phsize); - lseek(fd, eh.e_phoff, 0); - if(read(fd, (char *)ph, phsize) != phsize) { - printf("%s: can't read phdr area\n", file); - exit(1); - } - found = 0; - for(n = 0; n < eh.e_phnum && !found; n++) { - if(ph[n].p_type == PT_LOAD) { - found = find_rd_root_image(file, &eh, &ph[n]); - } - } - if(!found) { - printf("%s: can't locate space for rd_root_image!", file); - exit(1); - } - - /* - * Map in the whole data segment. - * The file offset needs to be page aligned. - */ - dataseg = mmap(NULL, /* any address is ok */ - mmap_size, /* length */ - PROT_READ | PROT_WRITE, - MAP_SHARED, - fd, mmap_offs); - if ((long)dataseg == -1) { - printf("%s: can not map data seg\n", file); - perror(file); - exit(1); - } - - /* - * Find value in the location: rd_root_size - */ - ip = (int*) (dataseg + rd_root_size_off); - rd_root_size_val = *ip; -#ifdef DEBUG - printf("rd_root_size val: 0x%08X (%d blocks)\n", - rd_root_size_val, (rd_root_size_val >> 9)); -#endif - - /* - * Copy the symbol table and string table. - */ -#ifdef DEBUG - printf("copying root image...\n"); -#endif - n = read(0, dataseg + rd_root_image_off, - rd_root_size_val); - if (n < 0) { - perror("read"); - exit(1); - } - - msync(dataseg, mmap_size, 0); - -#ifdef DEBUG - printf("...copied %d bytes\n", n); -#endif - close(fd); - exit(0); -} - - -/* - * Find locations of the symbols to patch. - */ -struct nlist wantsyms[] = { - { "_rd_root_size", 0 }, - { "_rd_root_image", 0 }, - { NULL, 0 }, -}; - -int -find_rd_root_image(file, eh, ph) - char *file; - Elf32_Ehdr *eh; - Elf32_Phdr *ph; -{ - int data_va; - int std_entry; - int kernel_start; - int kernel_size; - - if (nlist(file, wantsyms)) { - printf("%s: no rd_root_image symbols?\n", file); - exit(1); - } - kernel_start = ph->p_paddr; - kernel_size = ph->p_filesz; - - rd_root_size_off = wantsyms[0].n_value - kernel_start; - rd_root_image_off = wantsyms[1].n_value - kernel_start; - -#ifdef DEBUG - printf("rd_root_size_off = 0x%x\n", rd_root_size_off); - printf("rd_root_image_off = 0x%x\n", rd_root_image_off); -#endif - - /* - * Sanity check locations of db_* symbols - */ - if (rd_root_image_off < 0 || rd_root_image_off >= kernel_size) { - return(0); - } - if (rd_root_size_off < 0 || rd_root_size_off >= kernel_size) { - printf("%s: rd_root_size not in data segment?\n", file); - return(0); - } - mmap_offs = ph->p_offset; - mmap_size = kernel_size; - return(1); -} diff --git a/distrib/powerpc/common/termcap.vt b/distrib/powerpc/common/termcap.vt deleted file mode 100644 index 6ab68007c79..00000000000 --- a/distrib/powerpc/common/termcap.vt +++ /dev/null @@ -1,23 +0,0 @@ -vt200|vt220|dec-vt220|vt200-js|vt220-js|dec vt200 series with jump scroll:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:ct=\E[3g:dc=\E[P:dl=\E[M:\ - :ei=\E[4l:im=\E[4h:k1=\E[17~:k2=\E[18~:k3=\E[19~:k4=\E[20~:\ - :k5=\E[21~:k6=\E[23~:k7=\E[24~:k8=\E[25~:kD=\E[3~:kH=\E[4~:\ - :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kh=\E[1~:km:mi:ms:\ - :if=/usr/share/tabset/vt100:se=\E[27m:st=\EH:ue=\E[24m:\ - :tc=vt100: -vt100|dec-vt100|vt100-am|vt100am|dec vt100:\ - :bl=^G:cr=^M:it#8:\ - :do=^J:co#80:li#24:cl=50\E[;H\E[2J:sf=2*\ED:\ - :le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:cb=3\E[1K:\ - :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ - :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\ - :if=/usr/share/tabset/vt100:\ - :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\ - :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\ - :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=2*\EM:vt#3:xn:\ - :sc=\E7:rc=\E8:cs=\E[%i%d;%dr: -dumb|80-column dumb tty:\ - :am:\ - :co#80:\ - :bl=^G:cr=^M:do=^J:sf=^J: |