Annotation of researchv10no/cmd/compat/Readme, revision 1.1.1.1

1.1       root        1: .sp
                      2: .ce 100
                      3: A Package to Support VAX Compatability Mode on UNIX-32V
                      4: .sp
                      5: Arthur W. Wetzel
                      6: .br
                      7: 735 LIS Bldg
                      8: .br
                      9: Interdisciplinary Department of Information Science
                     10: .br
                     11: University of Pittsburgh
                     12: .br
                     13: Pittsburgh, Pa. 15260
                     14: (412)-624-5203
                     15: .ce 0
                     16: .sp 2
                     17: This is a brief description of a 
                     18: package to support the execution of PDP-11 programs on
                     19: VAX UNIX-32V
                     20: or Berkeley VMUNIX
                     21: in compatability mode.
                     22: The major functions are to
                     23: .in +5
                     24: .sp
                     25: .ti -5
                     26: 1) allocate a block
                     27: of memory as the PDP-11 memory space (this must start at location 0),
                     28: .ti -5
                     29: 2) read compatability
                     30: mode program images into memory and lay them out properly (with arguments etc),
                     31: .ti -5
                     32: 3) actually handle the change to and from compatability mode,
                     33: .ti -5
                     34: 4) simulate system calls for what ever operating system is being simulated
                     35: and
                     36: .ti -5
                     37: 5) simulate floating point (FPU and FIS) instructions.
                     38: .sp
                     39: .in -5
                     40: Unfortunately programs requiring separated I/D space can not be run.
                     41: Loading of the package is rather slow since the entire process is about
                     42: 80K bytes
                     43: (64K is the PDP-11 space).
                     44: Once execution begins however, the speed is similar to a PDP-11/70.
                     45: There is considerable overhead for each exception condition
                     46: so that programs with a lot of system calls or especially with
                     47: floating point will be greatly slowed down.
                     48: Note that the text segment must be writable since the PDP-11
                     49: memory space is there.
                     50: .sp
                     51: Three quick changes to UNIX-32V and Berkeley VMUNIX
                     52: were made in the course of constructing this package.
                     53: .in 5
                     54: .sp
                     55: .ti -5
                     56: First, it is necessary to patch a bug in the original mchdep.c.
                     57: The bug in the sendsig routine is that the condition codes are masked out
                     58: of the psl before it is stacked when catching signals.
                     59: This affects all
                     60: programs not just compatability mode ones although is is not usually a frequent
                     61: problem execept in this application.
                     62: The mask which was 0xfff1
                     63: should be changed to 0xffff.
                     64: If this is not done, the condition codes
                     65: after a signal trap routine returns will always be cleared which can result
                     66: in many strange problems when condition codes are being checked in loops
                     67: or in this case after an "illegal instruction" trap.
                     68: This same bug remains in the
                     69: Third Berkeley Software Tape version of Virtual Memory UNIX.
                     70: .sp
                     71: .ti -5
                     72: Second, although it is easy to get into compatability mode one also
                     73: needs a way to get back when an exception condition arises.
                     74: This can be done
                     75: by changing another mask in the last line of the same routine.
                     76: The 0x1f
                     77: mask should be changed to 0x8000001f.
                     78: This clears the compatability mode bit
                     79: so that all signals are necessarily caught in native mode where native code
                     80: can do something about the situation.
                     81: .sp
                     82: .ti -5
                     83: Finally, if one wants compatibility
                     84: mode programs to have SETUID and SETGID status, there must be a way to change
                     85: the effective uid or gid without clobbering the real uid or gid.
                     86: This is
                     87: easily done by adding seteuid and setegid system calls to UNIX-32V.
                     88: My method
                     89: of doing this was to modify setuid and getuid so that the high order 16 bits
                     90: of the argument in the actual system calls is a flag (uids and gids are only
                     91: 16 bits in the low order part of the word) to indicate either a regular
                     92: setuid or getuid function or alternately a seteuid and setegid function.
                     93: Appropriate functions seteuid() and setegid() have been added to our libc.a
                     94: which automatically set up the flags while setuid() and setgid() insure
                     95: that the flags are zeroed.
                     96: .in -5
                     97: .sp
                     98: Most of the programming was done in late August 1979 with additions being made
                     99: occasionally thru August 1980.
                    100: Compilation procedures are specified in Makefile.
                    101: An effort was made to minimize the amount of assembly language coding
                    102: so that only two small assembler routines are found here.
                    103: One of these (memsiz.s) simply specifies
                    104: how much memory is being allocated for PDP-11 images
                    105: and makes it available through certain global variables.
                    106: The other assembler file (compat.s) handles the protocol for getting
                    107: into compatability mode at a certain pc and with a certain ps.
                    108: It also includes a getreg function which copies machine registers into
                    109: known places.
                    110: The heart of the entire package is runcompat.c which is used for all RTSs
                    111: (Run Time Systems).
                    112: The function main here simply checks for the existence of the
                    113: file to be executed and sets the required uid and gid.
                    114: The execute function actually copies the file to memory
                    115: and sets trap conditions.
                    116: Finally illtrap() catches illegal instructions and goes to the
                    117: code appropriate for what is found as the illegal instruction.
                    118: The bulk of the lines of C code are in unixtraps.c and dofloat.c
                    119: which do UNIX system calls in either version 6 or 7 format
                    120: and simulate floating point operations.
                    121: (Since PWB-UNIX is upward compatable with version 6, the version 6
                    122: system support also includes PWB sys calls.)
                    123: There are probably a number of bugs in the floating point simulation
                    124: code just waiting to be found.
                    125: If you are running programs which already include the PDP-11
                    126: floating point interpretation code, you may want to disable
                    127: dofloat as the illegal instructions can be caught and simulated
                    128: in the PDP-11 code.
                    129: To do this just make dofloat.o with "cc -c -O -DNOFPSIM dofloat.c".
                    130: .sp
                    131: A shell which will automatically invoke compatability mode programs
                    132: is in the modshell directory as difference listings from the original
                    133: UNIX-32V shell.
                    134: Most of the new code is in a new function compat.c.
                    135: The automatic recognition of PDP-11 UNIX version 6/7 programs
                    136: relies on the fact that the second word (16 bit) of a PDP-11
                    137: a.out file (text size) is nonzero whereas it is 0 for 32V a.outs.
                    138: No easy distinction can be made between version 6 and version 7 a.outs
                    139: so that a shell variable RTS sets up the name of a default Run
                    140: Time System.
                    141: On our system version 6 a.outs have been patched so that word 6 of the header
                    142: which is unused is a 1.
                    143: This hoaky? method seems to work just fine.
                    144: A program v6flag.c is in the modshell directory to do this.
                    145: .sp
                    146: One possible use of this package is to get programs like INGRES running
                    147: on the VAX without going through what appears to be a nontrivial
                    148: conversion effort.
                    149: There are two ways of running such programs.
                    150: Firstly if the shell is patched to automatically recognize and
                    151: run compatability mode a.outs (as in modshell), the PDP-11 a.out files
                    152: for the program can be just put on the system with their
                    153: normal names and run as usual.
                    154: Note however that you will be using the UNIX-32V shell so that
                    155: any shell files from PDP-11 version 6 will have to be modified
                    156: for this to work correctly with something like INGRES.
                    157: The second approach
                    158: is to make a directory hierarchy somewhere which corresponds
                    159: to what would be on a PDP-11 including the appropriate PDP-11 shell.
                    160: In that case just execute that shell in compatability mode with
                    161: the root directory set to the top of the PDP-11 hierarchy.
                    162: This is the quickest way to get something going in a hurry since no
                    163: changes are required to existing PDP-11 code or shell files.
                    164: .sp
                    165: Emulation of RT-11 system calls provided by Dan Strick are not being
                    166: distributed at this time.
                    167: .sp
                    168: Please foreward any comments, bug fixes or quick questions to the author
                    169: at the above address.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.