═══ 1. 1 Introduction to the User's Guide to the emx Runtime ═══ User's Guide to the emx Runtime Copyright (c) 1990-1994 by Eberhard Mattes This is the documentation for the emx runtime package. The emx runtime is an environment for 32-bit programs under OS/2 2.0, OS/2 2.1 (OS/2, in short), MS-DOS, and PC-DOS (DOS, in short). Hardware requirements Files included in the emx runtime package ═══ 1.1. 1.1 Hardware requirements ═══ o emx requires an 80386 CPU (80386DX, 80386SX, i486, or later) o emx requires an 80387 coprocessor (or i486 processor) if floating point math is to be used under DOS ═══ 1.2. 1.2 Files included in the emx runtime package ═══ The emx runtime package includes the following files: \emx\bin\emx.exe emx runtime for DOS \emx\bin\emxbind.exe Tool for modifying emx programs (DOS and OS/2) \emx\bin\emxl.exe emx loader (used by emxbind) \emx\bin\emxload.exe Server for keeping OS/2 programs in memory \emx\bin\emxrev.cmd Tool for displaying emx revisions (OS/2) \emx\book\emxrt.inf The text you are looking at (VIEW version) \emx\dll\emx.dll emx runtime for OS/2 \emx\dll\emxio.dll Hardware port I/O under OS/2 \emx\dll\emxlibc.dll C library for emx programs (OS/2) \emx\dll\emxwrap.dll Interface to 16-bit OS/2 functions (OS/2) \emx\doc\emxrt.doc The text you are looking at (text version) \emx\etc\termcap.dat Terminal data base for termcap-based programs ═══ 2. 2 Copyright ═══ emx.exe, emxbind.exe, emxl.exe, emxload.exe emx.dll, emxio.dll, emxwrap.dll, emxrt.doc, and emxrt.inf are Copyright (c) 1990-1994 by Eberhard Mattes. Everybody is allowed to use the emx runtime package. You are allowed to copy the unmodified emx runtime package if you do not charge for the distribution. emxload.exe is under the GNU General Public License; however, as special exception, emxload.exe can be distributed in binary form without source code (unless it has been modified or recompiled) in the emxrt.zip package. The source for emxload.exe is available in emxsrc1.zip on the ftp servers listed below. THERE IS NO WARRANTY! No guarantee is made as to the proper functioning of the software. No liability will be admitted for damage resulting from using the software. ═══ 3. 3 Installing the emx runtime package under OS/2 ═══ Summary for impatient OS/2 users Detailed instructions for OS/2 users ═══ 3.1. 3.1 Summary for impatient OS/2 users ═══ 1. Add \emx\dll to LIBPATH (always use the latest copy of the .dll files!) 2. Add \emx\bin to PATH 3. Reboot ═══ 3.2. 3.2 Detailed instructions for OS/2 users ═══ emx requires OS/2 2.x and does not run in DOS mode of OS/2. Before changing config.sys, make a backup copy of that file! The emx runtime is implemented as a set of dynamic link libraries under OS/2: emx.dll emx run-time support for OS/2 emxio.dll access to hardware ports for emx programs under OS/2 emxlibc.dll emx C library emxwrap.dll 32-bit wrappers for 16-bit OS/2 API functions OS/2 looks for dynamic link libraries in the directories listed in the LIBPATH statement of your config.sys file. Note that LIBPATH is not an environment variable! At any time, at most one version of a dynamic link library is loaded. If there are different versions of a dynamic link library in the directories listed in the LIBPATH statement, the first one listed is loaded. If you already have installed the emx dynamic link libraries, you should be careful to use the latest revision of those dynamic link libraries. Newer emx dynamic link libraries work with older emx programs, but newer emx programs don't work with older emx dynamic link libraries. To find out about already installed emx dynamic link libraries, type cd \emx\bin emxrev If no emx dynamic link libraries are installed, no output is produced. If there are emx dynamic link libraries installed, the names and revision numbers are displayed, for instance EMX : revision = 12 EMXIO : revision = 12 EMXLIBC : revision = 12 EMXWRAP : revision = 12 Only directories listed in the LIBPATH statement are searched. To find out the revision numbers of the dynamic link libraries of this package, type emxrev -d c:\emx\dll if you have put the emx runtime package on drive C. After running emxrev, you should quit the command processor by typing exit to release the dynamic link libraries (they have been loaded by cmd.exe as emxrev is a REXX procedure). Otherwise, you cannot rename, overwrite or delete those files. This also happens if one of the emx dynamic link libraries is currently used by a program. If you get error message SYS0032, use pstat /L to find out about the dynamic link libraries used by the programs currently running. Terminate all the programs using emx.dll, emxio.dll, emxlibc.dll or emxwrap.dll. Either copy the latest revisions of the emx dynamic link libraries (that is, those with the highest revision numbers) to a directory directory listed in the LIBPATH statement of config.sys or modify the LIBPATH statement to include the directory where the latest revisions of the emx dynamic link libraries can be found. The directories of the LIBPATH statement are separated by semicolons. To add c:\emx\dll to the LIBPATH statement, append a semicolon -- if there is not yet a semicolon -- to the end of the line of config.sys that starts with LIBPATH= Then, type the absolute name of the directory. Example: LIBPATH=.;C:\OS2\DLL;C:\OS2\MDOS;C:\;C:\OS2\APPS\DLL;D:\EMX\DLL Optionally, you can append a semicolon at the end. Next, modify the line of config.sys starting with SET PATH= to include the \emx\bin directory. For instance, change SET PATH=C:\OS2;C:\OS2\SYSTEM;C:\OS2\MDOS\WINOS2;C:\OS2\INSTALL; C:\;C:\OS2\MDOS;C:\OS2\APPS to SET PATH=C:\OS2;C:\OS2\SYSTEM;C:\OS2\MDOS\WINOS2;C:\OS2\INSTALL; C:\;C:\OS2\MDOS;C:\OS2\APPS;D:\EMX\BIN As with LIBPATH, you have to put a semicolon between the path names and a trailing semicolon is optional. Note that the last two examples are shown in two lines; in config.sys, however, the complete SET statement must be put into one line. You might want to add \emx\book to the BOOKSHELF environment variable to simplify viewing the on-line documentation. For instance, change the line SET BOOKSHELF=C:\OS2\BOOK; of your config.sys file to SET BOOKSHELF=C:\OS2\BOOK;C:\EMX\BOOK as with PATH, you have to put a semicolon between the path names and a trailing semicolon is optional. Now, you should reboot to activate the changes to config.sys. After booting, run emxrev to verify that the latest revision of emx is now active. If OS/2 says SYS1804: The system cannot find the file EMX. when running an emx program, you have not correctly set the LIBPATH statement of config.sys. See above for details. ═══ 4. 4 Installing the emx runtime package under DOS ═══ Summary for impatient DOS users Detailed instructions for DOS users ═══ 4.1. 4.1 Summary for impatient DOS users ═══ 1. Add \emx\bin to PATH or set EMX to point to \emx\bin\emx.exe 2. If you are using a memory manager which implements DPMI, enable VCPI 3. Remove BREAK=ON from config.sys 4. Reboot ═══ 4.2. 4.2 Detailed instructions for DOS users ═══ emx programs for DOS come in two flavours: those which load emx.exe from a separate file and those which have the emx runtime emx.exe integrated in the executable file of the application program. Before changing autoexec.bat and config.sys, make a backup copy of these files! If you want to use a program which loads emx.exe, you have to put emx.exe into a directory which is listed in your PATH environment variable or you have to change the PATH environment variable (in autoexec.bat) to include the directory in which emx.exe can be found. For instance, if your autoexec.bat file contains the line path c:\dos;d:\bin you have installed the emx runtime on drive D, you should modify that line to read path c:\dos;d:\bin;d:\emx\bin You have to put a semicolon between the path names. Alternatively, you can set an environment variable which directly points to the emx.exe executable. If you use this method, your program can locate emx.exe more quickly. If you have installed the emx runtime on drive D:, you should add the following line to your autoexec.bat file: set emx=d:\emx\bin\emx.exe Note that a directory name is not sufficient -- you have to type the complete path name of the emx.exe file. Programs of the second flavour, having emx.exe integrated, don't require \emx\bin added to the PATH environment variable or the EMX environment variable being set. The program itself, however, may need changes to your autoexec.bat file. See the documentation accompanying the program. The following steps are required for both flavours of emx programs. If you are using a memory manager (such as QEMM or EMM386 or 386max) which implements DPMI (DOS Protected Mode Interface), you have to change the invokation of that memory manager to enable VCPI as emx does not support DPMI. See the documentation of your memory for details. If your memory manager supports DPMI only (without VCPI), you have to remove or disable the memory manager. emx supports XMS and VCPI. Examine your config.sys file: If there is a line BREAK=ON in it, you should remove it as it causes trouble with emx and lots of other programs. If you are using an Intel Inboard 386/PC, add the following line to autoexec.bat: set emxopt=-m3 If the swap file (used to swap memory pages to disk when running out of physical memory) should be in a specific directory or on a specific disk drive, set the EMXTMP environment variable in autoexec.bat. Example: set emxtmp=c:\tmp Now, you should reboot to activate the changes to config.sys and autoexec.bat. ═══ 5. 5 Environment variables (OS/2 and DOS) ═══ The operation of emx and emx programs is controlled by several environment variables. You might have to set one or more of the following environment variables: INIT used by termcap to find termcap.dat TERM used by termcap to define the terminal type EMXETC used by termcap to find termcap.dat EMXOPT emx options (see below) EMXSHELL overrides the COMSPEC environment variable. You can use this to run an alternate command processor (shell) from emx programs EMXPATH search path for programs (usually not relevant) PATH search path for program (used if EMXPATH fails) TERMCAP used by termcap to find termcap.dat Environment variables (DOS) ═══ 5.1. 5.1 Environment variables (DOS) ═══ EMX path name of emx.exe, used by programs which are bound with emxl.exe (the emx loader) instead of emx.exe. Set EMX to speed up loading of emx.exe or to load a specific version of emx.exe EMXTMP directory for the swap file TMP used if EMXTMP is not set ═══ 6. 6 DOS Notes ═══ General notes Using rsx instead of emx ═══ 6.1. 6.1 General notes ═══ o emx requires DOS 3.0 or later o emx does not support DPMI o emx does not support DESQview without VCPI (use QEMM-386 with DESQview) o If emx doesn't work under DESQview (especially if it displays the message Nonmaskable interrupt (NMI) either set the protection level to 0 or use the WATCHDOG=0 option of QEMM-386. o emx supports VCPI o emx supports XMS. Do not use emx with himem.sys 2.06 or earlier. o emx checks for XMS version number 2.00 or later and for XMS driver revision 2.06 or later, as older himem.sys drivers don't work correctly. You can override this check by using the -O emx option (for drivers using a different revision numbering scheme), but emx may not work with your XMS driver, anyway. Actually, emx has not been tested with himem.sys 2.05; 2.04 fails, 2.06 works. o emx supports vdisk.sys 3.3 and later and most other RAM disk drivers o emx uses (or tries to use) all available memory, whether conventional, extended, or expanded memory. But it does not use extended memory and expanded memory at the same time. If there isn't enough memory, emx will swap to disk. The swap file will be created in the directory given by the EMXTMP environment variable. If EMXTMP is not set, TMP will be used. If both variables are not set, the swap file will be created in the root directory of the current drive. ═══ 6.2. 6.2 Using rsx instead of emx ═══ rsx is a DPMI-compliant DOS extender which is more or less compatible to emx. Moreover, rsx contains a floating point emulator. rsx is free software and has been written by Rainer Schnittker. As of this writing, rsx is available for anonymous ftp as ftp.uni-bielefeld.de: /pub/systems/msdos/misc/dpmigcc4.zip ftp.uni-stuttgart.de: /pub/systems/os2/emx-0.8h/contrib/dpmigcc4.zip ftp.informatik.tu-muenchen.de [131.159.0.198]: /pub/comp/os/os2/gnu/emx+gcc/contrib/dpmigcc4.zip If the emx loader emxl.exe finds a DPMI server but no VCPI server, it tries to run rsx.exe instead of emx.exe. The RSX environment variable will be used instead of the EMX environment variable for locating rsx.exe. To load rsx.exe instead of emx.exe even if there is a DPMI server and a VCPI server (for instance if you need the floating point emulation of rsx), set the EMX environment variable to point to rsx.exe. Note that rsx needs a DPMI server. ═══ 7. 7 emx options ═══ You can customize emx by setting the EMXOPT environment variable. This environment variable contains a list of options, similar to command line options. The options must be separated by at least one blank. Example: set emxopt=-c -h40 emx options (OS/2) emx options (DOS) ═══ 7.1. 7.1 emx options (OS/2) ═══ -c Disable core dumps caused by signals and exceptions -h# Set OS/2 file handle limit to #. The number # must be between 10 and 255 -r* Prepend drive letter * to absolute path names. If a path name starts with / but does not start with //, /dev/ or /pipe/, * followed by a colon will be prepended. If -rd has been given, the file name \mydir\abc will be translated to d:\mydir\abc. Note: this option can cause unexpected effects -t Truncate file names to 8.3 -E Run debuggee in same session (window) as debugger ═══ 7.2. 7.2 emx options (DOS) ═══ -c Disable core dumps caused by signals and exceptions -d Don't use extended memory -e Don't check for 387 coprocessor. Assume no coprocessor is present -h# Set DOS file handle limit to #. The number # must be between 10 and 255. This option is ignored for DOS versions earlier than 3.30. This option does not change the emx limit for the number of files per process -- that limit is always 40 -m1 Running on Fujitsu FMR70 (not implemented yet) -m2 Running on NEC PC-98 (not implemented yet) -m3 Running on Intel Inboard 386/PC -o Send the register dump of an exception to stdout. Without -o, the register dump is sent to the CON device. You need -o for redirecting the register dump to a file. emx now creates a core dump file (named `core') instead of a register dump. Please keep that file in case the author of the program needs it for debugging. -r* Prepend drive letter * to absolute path names. If a path name starts with / but does not start with //, /dev/ or /pipe/, * followed by a colon will be prepended. If -rd has been given, the file name \mydir\abc will be translated to d:\mydir\abc. Note: this option can cause unexpected effects -t Truncate file names to 8.3 format. Each part of a pathname is truncated to 8.3 format by taking the first 8 characters before the dot and the first 3 characters after the dot. This is useful to compile programs on a FAT filesystem with minimal changes -O Override XMS version check. By default, emx checks for XMS version number 2.00 or later and for XMS driver revision 2.06 or later, as older himem.sys drivers don't work correctly. You can override this check by giving the -O option (for drivers using a different revision numbering scheme), but emx may not work with your XMS driver, anyway. Actually, emx has not been tested with himem.sys 2.05; 2.04 fails, 2.06 works -V Display emx version. On program start, the emx version will be displayed ═══ 8. 8 Troubleshooting ═══ This section shows how to solve common problems involving the emx runtime. Warning message `WARNING: emx 0.8h or later required' unzip.exe says `cannot create emx/dll/emx.dll' emx.dll cannot be deleted, renamed or overwritten Error message `SYS1804: The system cannot find the file EMX.' Error message `rsx not found, DPMI not supported by emx' ═══ 8.1. 8.1 Warning message `WARNING: emx 0.8h or later required' ═══ If this message appears, an out-of-date version of emx.dll is active. Make sure that the latest version of emx.dll is in a directory pointed to by the LIBPATH statement in your config.sys file. Use emxrev -p c:\config.sys to list all emx dynamic link libraries reachable by the LIBPATH statement of c:\config.sys (use the drive letter of your boot drive instead of c:). To simplify things, you should keep only one version of each DLL. Older programs work with newer emx DLLs, but not vice versa. ═══ 8.2. 8.2 unzip.exe says `cannot create emx/dll/emx.dll' ═══ This happens when you try to unpack emxrt.zip while a program is active which uses emx.dll. Terminate all programs which use emx.dll and try again. If you run emxrev, the command interpreter keeps emx.dll loaded until terminated. Therefore, you should close all OS/2 windows and full-screen sessions in which you have run emxrev. All this also applies to emxlibc.dll etc. ═══ 8.3. 8.3 emx.dll cannot be deleted, renamed or overwritten ═══ See the previous problem. ═══ 8.4. 8.4 Error message `SYS1804: The system cannot find the file EMX.' ═══ You have not correctly set the LIBPATH statement of config.sys, therefore emx.dll could not be found. ═══ 8.5. 8.5 Error message `rsx not found, DPMI not supported by emx' ═══ The current version of emx cannot use DPMI. Therefore, the loader tried to use rsx instead, but couldn't find rsx. Remedy: install rsx or end the DPMI server (MS Windows). ═══ 9. 9 emx messages ═══ emx messages (OS/2) emx messages (DOS) ═══ 9.1. 9.1 emx messages (OS/2) ═══ core dumped The program cannot continue due to a fatal error (exception). An image of the program's memory has been written to a file named `core'. Please keep that file in case the author of the program needs it for debugging. Invalid option in EMXOPT An option in the EMXOPT environement variable is not understood by emx. Invalid syscall function code The program run by emx has called an invalid system function. Most likely, you're using an emx.dll which is out of date. WARNING: emx 0.8h or later required The program requires emx.dll 0.8h or later. However, an older version of emx.dll is active. Make sure that the latest version of emx.dll is in a directory pointed to by the LIBPATH statement in your config.sys file. Use emxrev -p c:\config.sys to list all emx dynamic link libraries reachable by the LIBPATH statement of c:\config.sys (use the drive letter of your boot drive instead of c:). To simplify things, you should keep only one version of each DLL. Older programs work with newer emx DLLs, but not vice versa. ═══ 9.2. 9.2 emx messages (DOS) ═══ Abnormal program termination The program received the SIGABRT signal. The abort() function was called or SIGABRT was raised. Bad environment The program name could not be found in the environment segment or the environment segment is longer than 32768 bytes. This should not happen in practice. Cannot create swap file The swap file could not be created. Remedy: make sure the swap file can be created in the directory given by the EMXTMP (or TMP) environment variable. If EMXTMP and TMP are not set, emx will create the swap file in the root directory of the current drive. Cannot enable A20 emx tried to enable address line A20 and failed. Remedy: contact the author. Cannot enable A20 via XMS emx tried to enable address line A20 by calling the XMS driver. Unfortunately, A20 couldn't be enabled. Remedy: unknown. Cannot open program file The program file given on the emx command line could not be found or opened. Remedy: type the correct file name. (This should not happen with bound programs.) Cannot read program file An error occured while reading the program file. Remedy: make sure the program file given on the emx command line is valid (this does not apply to bound programs). Maybe some other program accesses that file. core dumped The program cannot continue due to a fatal error (exception). An image of the program's memory has been written to a file named `core'. Please keep that file in case the author of the program needs it for debugging. DPMI not supported The current version of emx cannot use DPMI. Maybe some future version will do. Remedy: end the DPMI server (MS Windows) or use rsx. emx not found The emx loader (emxl.exe) failed to find emx.exe. Make sure that emx.exe is in a directory listed in the PATH environment variable. Alternatively, you can set the EMX environment variable to the complete path name of emx.exe. Exception ... The program run by emx tried to do something which is considered illegal by the processor or by emx. Remedy: report to the supplier of the program. Illegal moucall function The program run by emx has called an invalid system function. Remedy: report to the supplier of the program. Illegal syscall function The program run by emx has called an invalid system function. Remedy: report to the supplier of the program. Illegal viocall function The program run by emx has called an invalid system function. Remedy: report to the supplier of the program. Invalid arguments for DOS function xx The program run by emx has used invalid arguments for a system function. Remedy: report to the supplier of the program. Invalid emx option An option in EMXOPT or set by emxbind is not understood by emx. Remedy: check EMXOPT. Use emxbind -i to display the options set by emxbind. Invalid program file The program file given on the emx command line (or bound to emx) is corrupt. Remedy: reload the program from diskette. If this doesn't help you should contact the supplier of the program. Invalid special function code: xx The program run by emx has called an invalid system function. Remedy: report to the supplier of the program. Linear address space exhausted The program run by emx uses far too much memory. Remedy: complain to the author. Nonmaskable interrupt (NMI) at xxxx:yyyyyyyy A nonmaskable interrupt occured. Maybe this is due to a memory error. Remedy: if you are using DESQview, either set the protection level to 0 or use the WATCHDOG=0 option of QEMM-386. Otherwise, run a program for testing memory. Out of memory There isn't enough memory for running emx. Remedy: remove some drivers and/or resident programs. Or add memory to your machine. Out of stacks emx ran out of local stacks. Remedy: complain to the author. Out of memory or swap space emx cannot write to the swap file because the disk is full. Remedy: make sure there is enough space on the drive used for the swap file. Use the EMXTMP (or TMP) environment variable to tell emx where to create the swap file. If neither EMXTMP nor TMP is set, emx will create the swap file in the root directory of the current drive. Out of swap space emx cannot write to the swap file because the disk is full. Remedy: make sure there is enough space on the drive used for the swap file. Use the EMXTMP (or TMP) environment variable to tell emx where to create the swap file. If neither EMXTMP nor TMP is set, emx will create the swap file in the root directory of the current drive. Process terminated by SIGINT You have stopped the program by hitting Ctrl-C or Ctrl-Break. Process terminated by SIG... The program has been stopped due to a signal or exception. Usually, this indicates a fatal error in the program. Program aborted You have aborted the program by answering `Abort' after a critical error had occured. rsx not found, DPMI not supported by emx The current version of emx cannot use DPMI. Therefore, the loader tried to use rsx instead, but couldn't find rsx. Remedy: install rsx or end the DPMI server (MS Windows). Swap file I/O error emx couldn't read or write the swap file. This program does not run in DOS mode of OS/2 DOS emulation of OS/2 doesn't support emx. Remedy: boot DOS or run the program in a OS/2 window This program requires an 80386 CPU You need an 80386DX, 80386SX, i486 or later CPU for running emx. Remedy: get another computer. This program requires DOS 3.0 or later If emx is bound with an application program into one executable, DOS 3.0 or later is required for execution. Too many processes emx supports up to 4 processes. You tried to start 5 or more processes. Unexpected interrupt This cannot happen. Remedy: report to the author. Unsupported VDISK.SYS version emx doesn't support the vdisk.sys device driver you are using. Remedy: remove VDISK.SYS or use a different version. emx should work with vdisk.sys 3.3 or later. Unsupported XMS version emx requires himem.sys 2.06 or later (older versions are too buggy). Remedy: get a newer himem.sys. If you are not using himem.sys, use the -O option of emx and tell the author whether this works or not. Unusable interrupt vector mappings set by VCPI server The configuration of the VCPI server (EMS driver) is illegal. Remedy: read the manual of the EMS driver. Use emxbind You tried to run emxl.exe, which doesn't make sense. emxl.exe is designed to be bound into an executable file by emxbind. Virtual mode not supported without VCPI A VCPI server is required to run emx if the CPU is in virtual mode. You will get this message if you're using an EMS driver (EMS emulator) which doesn't support VCPI or if you have disabled EMS. Remedy: remove the EMS driver, use an EMS driver which supports VCPI or enable EMS if it has been disabled (for instance, remove the NOEMS keyword from the command line of the EMS driver). Wrong emx version The version of emx.exe does not match the version the program was compiled for. Remedy: use the copy of emx.exe that comes with the program. If you are using different programs which need different versions of emx.exe, use the EMX environment variable to set the path name of the correct version of emx.exe before running a program which requires a version different from the default emx.exe. You can also use emxbind -u to put the correct version of emx.exe into the executable files. ═══ 10. 10 Obtaining the complete emx package ═══ emx is available for anonymous ftp on ftp.uni-stuttgart.de [129.69.8.13]: /pub/systems/os2/emx-0.8h ftp-os2.cdrom.com: [192.153.46.2]: /os2/2_x/unix/emx08h src.doc.ic.ac.uk [146.169.2.1]: /pub/packages/os2/2_x/unix/emx08h ftp.informatik.tu-muenchen.de [131.159.0.198]: /pub/comp/os/os2/gnu/emx+gcc ═══ 11. 11 The author of emx ═══ The author of emx is Eberhard Mattes Teckstraсe 81 D-71696 MФglingen Germany Internet: mattes@azu.informatik.uni-stuttgart.de (subject to change) No telephone calls please! It must be stressed that the author does not reply to letters if you don't include return postage (international postal reply coupon if you are outside Germany) and a self-addressed