Short: VAX Emulator, a "Virtual VAX" for Mac OS Computers Author: Tom Cole Uploader: louise amiga hu (LouiSe/AMIGAonly) Type: misc/emu Version: 1.1 Architecture: m68k-amigaos VAX emulator for AmigaOS 68k - ported by LouiSe (sources included) http://louise.amiga.hu http://amigaonly.ahol.com/louise [This change history was started 8/23/99 since contributions from the "outside world" are beginning to appear.] 08/23/99 Integrated fixes to clean up compiler warnings and added MATCHC instruction from Carl Fongheiser (cmf@iabears.org). 08/25/99 Integrated new instructions REMQTI and REMQHI from CMF 08/26/99 Separated disassembly code from operand decode for performance. Added DECC$STRCAT shim and sample program and executable SIEVE.C and SIEVE.EXE for performance testing. 08/27/99 Added SKPC from CMF. Added License.txt to the source area describing the open source license nature of the software. Modified header comments accordingly. 08/28/99 Published (in-progress) draft of user guide as HTML to web site. http://www.forest-edge.net/evaxdoc.html 09/03/99 Added profiling of instruction modes. Need this to figure out how to optimize operand decoding more. Use SHOW INSTRUCTION MODES to see the profile data. Also, made sure VMS build tools DESCRIP.MMS and EVAX.OPT are included in tar files for distribution. 09/04/99 Tinkering around with supporting LIB$GET_INPUT as a generalized input routine. This moves us one step closer to being able to run useful programs compiled on a VAX. Implemented EXE$INPUT shim for handling the low-level console input, and LIB$GET_INPUT in the microkernel to support rest of the functionality. This will have to do for now until a byte-for-byte console input function works. I need to come up with a suite of character input test-and-read routines for all the various hosts next! 09/07/99 Started on keyboard console input proper. Created a MacOS version to start with, and stubbed it out for other ports. This allows a keystroke hit while the emulator is executing VAX instructions to capture the data in RXDB and optionally generate an interrupt. Started changing kernel.asm to allow for a generalized input buffer handler. 09/13/99 CMF contributed ASHQ and found the ASHL bug which is also fixed here. This version also contains a very first stab at segmenting out memory addresses in the RAM versus ROM or memory-mapped I/O. On VAXstations (at least the two I have gotten hold of) there is CPU data stored at E0040004 that the booter needs. So you can now read this address outside the regular memory map. This needs LOTS OF THOUGHT. This release contains a few more misc. performance tweaks, to wring out a teeny bit more performance from instruction decoding. This will be doubly important if the I/O-memory- and ROM-addressing becomes more expensive. 09/20/99 Small tweaks to protect against crashes; there are a number of commands and pseudo-opcodes that depend on the VMINIT and microkernel environment. The changes detect when it is valid or not, and prevent bogus command execution. Also, the attendant eVAX.doc documentation file (MS Word 97) has been updated to Draft 1.2 and contains most of the console and microassembler documentation at this point. 09/21/99 Added "sequential translation cache" to VM. 80% or more of all VM translations are done on the very same page just translated (instruction decoding, block moves, etc.). So keep the last page as a single-slot level 1 cache before the translation buffer is read. Also updated the format of the eVAX.doc file to make it a little more readable. 09/22/99 Added support for a ROM at physical address 20040000. The virtual memory handler, storage handler, and anciliary functions that read memory were modified to allow reading from a ROM that is 256k long. This ROM exists on various small VAXstation systems to support native console functions. Also added the ROM command which reads a file "rom.txt" from the default directory. This file is assumed to be a dump of the console ROM, with lines in the format P aaaaaaaa xxxxxxxx Where "P" is a literal constant (means physical memory), "aaaaaaaa" is the address in the ROM, and "xxxxxxxx" is a hexadecimal longword at that location. If you use the EXAM command in the console of a VAX this is the format of the output you get. Use the (currently undocumented) ROM command to load this file (often over a megabyte of text) into the special memory reserved for the ROM. Later this will be made more elegant, I'm sure. 09/23/99 More support for ROM images. You can now SAVE/ROM "file" to save the currently loaded ROM image as a binary file. It uses the same kind of mechanism as the SAVE binary operation. The LOAD/ROM command can now sense a binary image (magic first 8 bytes) and load accordingly. Binary ROM images are more-or-less the size of the ROM, where text files are 4-5x larger. Use binary when you can! Also changed the default file name to "default.rom". When you load a ROM file you can specify the base and size with /BASE=hex-address and /SIZE=size-in-K qualifiers to the ROM command. SHOW ROM now displays info about the currently-loaded ROM. You can INIT/ROM to create empty ROM space if you are building your own, and use the /BASE and /SIZE qualifiers. Also updated the EXAM command so it accepts /AD and /AZ as qualifiers to mirror the VMS debugger environment. Also updated numerous little errors in the Word doc. 09/24/99 And even more wierd address stuff. The physical address mapping is now abstracted enough that disjoint address space areas and memory_mapped I/O are all handled reasonably smoothly. There are at least four distinct memory areas in the emulator now: main memory, ROM memory, NVRAM memory, and special I/O memory locations. There is a LOAD/NVRAM, SAVE/NVRAM, and INIT/NVRAM command that will allow the non-volatile RAM to be managed. It supports /BASE and /SIZE qualifiers on the INIT command, and assumes that something will be assembled or run in the console ROM to initialize it. Created symbols CONSOLE$ROM_BASE, CONSOLE$ROM_END, CONSOLE$ROM_SIZE, CONSOLE$NVRAM_BASE, CONSOLE$NVRAM_END, and CONSOLE$NVRAM_SIZE to record the info on these special areas. Extended the privileged register set from 64 to 128 register, and "enabled" the SAVIPL, SAVPC, and SAVPSL registers which are used by the console. 09/27/99 First pass at being 64-bit friendly if not 64-bit clean. A user is trying to build on Tru64, so here are some fixes to correct memory access errors (can no longer assume native long and VAX long are same sizes) and use __int32 types where math overflow matters. Added new TRU64 architecture type. 09/28/99 Bug fix to MOVC5 from Sergey Tikhonov . I also fixed a bug in the image activator for loading OpenVMS images into the emulator; multi-page sections were overwritten on the same physical address. Bad. 10/03/99 Second try on 64-bit clean. It doesn't seem to make sense to use 64-bit longs in general, so I've create explicit data types of LONGWORD and QUADWORD for 32- and 64-bit integers. Globally changed everywhere. Ports may be a little rough if arch.h isn't quite right, let me know if I goofed up somewhere. 10/07/99 Numerous bug fixes in the assembler. Added support for a few missing addressing modes ( @b^nn(Rn), for example) and a few nuances found in assemblers such as @(Rn). Added pseudo-ops to support GAS extensions like JEQL, etc. Added aliases to handle overloaded opcodes, like BEQLU being same as BEQL. 10/09/99 Cleaned up a number of warnings generated by Visual Studio on Windows. 10/12/99 Added more SHIM support, to try to support a handful of minimal NetBSD-style system service interfaces. Updated the microkernel with new shim support for open, close, read, and write. Assembling a forth interpreter for VAX written for NetBSD, I'm getting close to making it run. Seems like a good next test for correctness of instructions. Added STEP/OVER, STEP/INTO, STEP/RETURN to the console. Added SET STEP to define default STEP mode. These slowed down the execution model again (somewhat) so soon it will be time to again review vax.c for cleanup and performance tweaks. 10/15/99 Fixed a number of errors in handling of floating point conversions. This made the floating point parts of the Forth interpreter work much better. There still appears to be a precision problem; don't know yet if that's inherent in the Forth code or in my F_FLOAT support. Also fixed bug where disassembling an operand with side effects (such as "(R3)+") actually changed the register value. Bad. Found and fixed bug in BCS handler. 10/17/99 Fixed major bugs in FPU.C which prevented floating point from working correctly on little-endian ports (Alpha, x86, etc). 10/29/99 Fixed minor bug in HELP command that caused crashes if trailing spaces on keywords. Also added rounding support in FPU.C such that F_FLOAT values appear to be correct now when imprecise fractions result from calculations. 11/01/99 Fixes in the microkernel to support exception trapping. 11/03/99 Added printf() support to the LIBRTL shim library. 11/04/99 Split LIBRTL.C into several modules based on function. Added a number of basic RTL functions for VMS. This makes it much easier to write test programs in C that can print results, etc. Use the SHOW SHIM command to list the implemented runtime functions. Also fixed bug in STEP/RETURN so it works correctly. 11/08/99 Performance fixes to execution model. STEP/RETURN and STEP/OVER used a different mechanism than BREAK to handle control flowing back to console. Changed to support a temporary "one-shot" break type. This squeezes 2-3% performance gain back out of execution handler by not checking two places for break info. Fixed bugs in CALL/STEP that caused bogus syntax error message. Added LOAD/IMAGE which just loads a VMS image without executing it. Updated the documentation somewhat. The Word doc still lags behind the code but it's getting better. Started on "architectural overview" section but didn't get far yet. This is a near-term goal, to describe the structure of the emulator code itself better, to encourage more participation. 11/09/99 Updates to microkernel support for VM. I need to be able to have a "sparse" address map, rather than the old system of mapping each sequential physical page to a virtual page. This allows supporting the P1 vector area for VMS system services in the microkernel. This did force me to finally confirm my suspicion that the memory read routines wouldn't work if a read spanned non- contiguous pages. They now detect "split" memory reads and do a slower but more correct byte-for-byte read in this case. When a TNV fault is hit and the microkernel is active, a new page of physical memory is mapped to the faulting page. This continues until there are no more physical pages available. Note that there is no page writer, so when all physical pages are used, then a TNV fault is returned by the emulator. Of course, if the microkernel is not active, then the emulator TNV handler is not used. Also fixed annoying bug where two RUN commands could not be executed in a row (bad ICB chain reset). Also if image open fails, try adding ".exe" to the name. 11/14/99 Parsing commands had become rather cumbersome in some places in the console, so I decided to take a day and integrate an old peice of code I had sitting around that is similar to DCL on VMS. To get started, I've converted the CLEAR and SHOW commands to use DCL syntax. For example, "SHOW ALL SYMBOLS" is now "SHOW SYMBOL/ALL". See the new file "evax.dcl" which contains the command grammar definitions. Once all the console commands are converted, I'll integrate the grammar into command initialization. 11/16/99 Fixed bugs on DCLRTL regarding ambiguous keyword detection. As of 11/16/99, the only version that includes this week's DCL-related changes is the Unix .tar.gz file. I'm at COMDEX this week and don't have a connection good enough to push the 1MB Windows and Mac files. These will be updated around 11/22/99. 11/29/99 Removed about 100 warnings generated by Visual Studio. Most were nuisance warnings but a few were bugs. Also fixed an annoying bug where EXAM/AZ displayed wrong number of bytes. 12/06/99 Fixed bug in SHOW command. Updated Word document and online help. 12/09/99 Fixed bug in LOCC handling of Z bit. Added SHOW IMAGES command which shows active images. Added SYS$EXPREG and SYS$DCLEXH services. Major bug fixes in the VMS image loader. I can now run a C program, activating the VAX runtime libraries as needed. At the "bottom" of the call chain, system services are called to do "real" work. Staring to fill in a minimal set of services to allow RUN execution of more "real" programs. For example, supporting SYS$EXPREG for P0 space allows the LIB$ family of VM routines to work out-of-the-box using the LIBRTL.EXE from the Hobbyist CD. [An interestin possible outcome of this would be to write an Alpha/VMS specific version of the system services that re-marshalled the arguments and called _real_ VMS system services on Alpha to do the work of the program. This would make running VAX images on Alpha feasible without depending on the now-discontinued VAX Migration Package.] Fixed bug(s) in string pool allocation in VMINIT. 12/20/99 Added more runtime support for images, including memory mgmt routines like malloc() and LIB$GET_VM for VMS users. Added SHOW MEMORY/RUNTIME command to display runtime memory use for VAX programs. More bug fixes. 12/28/99 Fixed dumb bug in writing multibyte values across pages on little-endian systems, where often zero was written instead of desired values. Also added sanity checking to structure management in RUN command support for VMS shared images; I suspect I still have a memory corruption lurking that I have not yet found. 01/11/00 More C runtime support; trying to get a snobol processor to run. Added librtl_time.c to support time functions, updates to the kernel to support runtime data storage required by DECC$RTL on VMS. Fixed bug in emul_integer_math.c that prevented correct decoding of BISx and BICx instructions. 01/14/00 Finished cleanup of STEP command, so the formatting (and behavior!) are pretty much like the VMS debugger, and consistent between the various STEP modes. Setting the default mode to STEP/OVER now makes sense... Also fixed a small disassembly formatting error when indexed mode is used for other than the first operand. 01/27/00 Several minor performance tweaks to eke out a few more micro-mips. It seems likely that the entire suite of branch handlers need to be made separate handlers rather than groups with a switch() statement, to avoid the unneeded overhead of the comparisons, and to give optimizers a break. 01/28/00 Restructured rest of branch handlers to make simple branch handler separated out. [BOTTOM]