?? readme
字號:
.\".\" Readme 4.1 82/05/12.\".sp.ce 100A Package to Support VAX Compatability Mode on UNIX-32V.spArthur W. Wetzel.br735 LIS Bldg.brInterdisciplinary Department of Information Science.brUniversity of Pittsburgh.brPittsburgh, Pa. 15260(412)-624-5203.ce 0.sp 2This is a brief description of a package to support the execution of PDP-11 programs onVAX UNIX-32Vor Berkeley VMUNIXin compatability mode.The major functions are to.in +5.sp.ti -51) allocate a blockof memory as the PDP-11 memory space (this must start at location 0),.ti -52) read compatabilitymode program images into memory and lay them out properly (with arguments etc),.ti -53) actually handle the change to and from compatability mode,.ti -54) simulate system calls for what ever operating system is being simulatedand.ti -55) simulate floating point (FPU and FIS) instructions..sp.in -5Unfortunately programs requiring separated I/D space can not be run.Loading of the package is rather slow since the entire process is about80K bytes(64K is the PDP-11 space).Once execution begins however, the speed is similar to a PDP-11/70.There is considerable overhead for each exception conditionso that programs with a lot of system calls or especially withfloating point will be greatly slowed down.Note that the text segment must be writable since the PDP-11memory space is there..spThree quick changes to UNIX-32V and Berkeley VMUNIXwere made in the course of constructing this package..in 5.sp.ti -5First, it is necessary to patch a bug in the original mchdep.c.The bug in the sendsig routine is that the condition codes are masked outof the psl before it is stacked when catching signals.This affects allprograms not just compatability mode ones although is is not usually a frequentproblem execept in this application.The mask which was 0xfff1should be changed to 0xffff.If this is not done, the condition codesafter a signal trap routine returns will always be cleared which can resultin many strange problems when condition codes are being checked in loopsor in this case after an "illegal instruction" trap.This same bug remains in theThird Berkeley Software Tape version of Virtual Memory UNIX..sp.ti -5Second, although it is easy to get into compatability mode one alsoneeds a way to get back when an exception condition arises.This can be doneby changing another mask in the last line of the same routine.The 0x1fmask should be changed to 0x8000001f.This clears the compatability mode bitso that all signals are necessarily caught in native mode where native codecan do something about the situation..sp.ti -5Finally, if one wants compatibilitymode programs to have SETUID and SETGID status, there must be a way to changethe effective uid or gid without clobbering the real uid or gid.This iseasily done by adding seteuid and setegid system calls to UNIX-32V.My methodof doing this was to modify setuid and getuid so that the high order 16 bitsof the argument in the actual system calls is a flag (uids and gids are only16 bits in the low order part of the word) to indicate either a regularsetuid or getuid function or alternately a seteuid and setegid function.Appropriate functions seteuid() and setegid() have been added to our libc.awhich automatically set up the flags while setuid() and setgid() insurethat the flags are zeroed..in -5.spMost of the programming was done in late August 1979 with additions being madeoccasionally thru August 1980.Compilation procedures are specified in Makefile.An effort was made to minimize the amount of assembly language codingso that only two small assembler routines are found here.One of these (memsiz.s) simply specifieshow much memory is being allocated for PDP-11 imagesand makes it available through certain global variables.The other assembler file (compat.s) handles the protocol for gettinginto compatability mode at a certain pc and with a certain ps.It also includes a getreg function which copies machine registers intoknown places.The heart of the entire package is runcompat.c which is used for all RTSs(Run Time Systems).The function main here simply checks for the existence of thefile to be executed and sets the required uid and gid.The execute function actually copies the file to memoryand sets trap conditions.Finally illtrap() catches illegal instructions and goes to thecode appropriate for what is found as the illegal instruction.The bulk of the lines of C code are in unixtraps.c and dofloat.cwhich do UNIX system calls in either version 6 or 7 formatand simulate floating point operations.(Since PWB-UNIX is upward compatable with version 6, the version 6system support also includes PWB sys calls.)There are probably a number of bugs in the floating point simulationcode just waiting to be found.If you are running programs which already include the PDP-11floating point interpretation code, you may want to disabledofloat as the illegal instructions can be caught and simulatedin the PDP-11 code.To do this just make dofloat.o with "cc -c -O -DNOFPSIM dofloat.c"..spA shell which will automatically invoke compatability mode programsis in the modshell directory as difference listings from the originalUNIX-32V shell.Most of the new code is in a new function compat.c.The automatic recognition of PDP-11 UNIX version 6/7 programsrelies on the fact that the second word (16 bit) of a PDP-11a.out file (text size) is nonzero whereas it is 0 for 32V a.outs.No easy distinction can be made between version 6 and version 7 a.outsso that a shell variable RTS sets up the name of a default RunTime System.On our system version 6 a.outs have been patched so that word 6 of the headerwhich is unused is a 1.This hoaky? method seems to work just fine.A program v6flag.c is in the modshell directory to do this..spOne possible use of this package is to get programs like INGRES runningon the VAX without going through what appears to be a nontrivialconversion effort.There are two ways of running such programs.Firstly if the shell is patched to automatically recognize andrun compatability mode a.outs (as in modshell), the PDP-11 a.out filesfor the program can be just put on the system with theirnormal names and run as usual.Note however that you will be using the UNIX-32V shell so thatany shell files from PDP-11 version 6 will have to be modifiedfor this to work correctly with something like INGRES.The second approachis to make a directory hierarchy somewhere which correspondsto what would be on a PDP-11 including the appropriate PDP-11 shell.In that case just execute that shell in compatability mode withthe root directory set to the top of the PDP-11 hierarchy.This is the quickest way to get something going in a hurry since nochanges are required to existing PDP-11 code or shell files..spEmulation of RT-11 system calls provided by Dan Strick are not beingdistributed at this time..spPlease foreward any comments, bug fixes or quick questions to the authorat the above address.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -