# Platform Support

## Supported platforms

PM3 has been ported to several platforms. Bootstraps for the following platforms are currently produced regularly.

ALPHA_OSF
  Alpha/AXP, OSF/1.
DS3100
  DECstation 5000/200 Ultrix 4.2.
FreeBSD2
  IBM PC, FreeBSD 2.0.
HPPA
  HP 700/800, HP-UX 8.0.
IRIX5
  SGI/MIPS, IRIX 5.2.
LINUXELF
  IBM PC, Linux (ELF object file format), C library version 5.
LINUXLIBC6
  IBM PC, Linux (ELF object file format), C library version 6.
NT386GNU
  IBM PC, Windows/NT and Windows 95 using gnu-win32 tools.
SOLgnu
  Sparcstation, Solaris-2.x w/ unbundled gcc.
SPARC
  Sparcstation-1, SunOS 4.1.x.

The following platforms are still active but bootstraps could not be built lately, mostly because of problems in the gcc based backend.

IBMR2
  IBM RS/6000, AIX 3.1.
NEXT
  NeXT(M68K).
NT386
  IBM PC, Windows/NT and Windows 95.

The following platforms have not been active lately.

AP3000
  Apollo DN4500, Domain/OS 10.2
ARM
  Acorn R260, RISC iX 1.21.
FreeBSD
  IBM PC, FreeBSD 1.1.5
HP300
  HP 9000/300, HP-UX 7.0
IBMRT
  IBM RT, IBM/4.3 (AOS 4.3).
LINUX
  IBM PC, Linux.
OKI
  Okidata 7300 (i860) AT&T SVR4.0.
SEQUENT
  Sequent 386
SOLsun
  Sparcstation, Solaris-2.x w/ bundled Sun C.
SUN3
  Sun 3, SunOS 4.1
SUN386
  Sun 386i, SunOS 4.0.1.
UMAX
  Encore Multimax, UMAX 4.3 (R4.1.1).
VAX
  VAX 8800, Ultrix 4.2.

## Porting to new platforms

In order to port PM3 to a new platform, the following steps are required. The differences in PM3 between different POSIX platforms are relatively small and a new port may often be achieved in a matter of a few days or less. New entries in tables, and new directories, are obtained by copying the corresponding portions from an existing similar platform and making a few modifications. It is assumed that the new platform already fits in 32 or 64 bits, and POSIX or WIN32; if not, additional work will be required.

- Install PM3 on a supported platform.
- Select a short unique name for the new platform.
- Add an entry for the platform in table Platforms of the template file `m3config/src/COMMON`. Add a platform specific template in directory `m3config/src`.
- In file `language/modula3/m3compiler/m3middle/src/Target.m3`, add an entry in table Systems, and a section describing the new platform in the `CASE sys OF` statement in the Init procedure.
- In directory `libs/m3core/src/C`, add a platform specific subdirectory defining the interface to C functions such as `setjmp`, `longjmp`, `_setjmp`, `_longjmp`, to `stdio.h`, and to `string.h`. Be careful to get the size of the `jmp_buf` right. The procedure `Csetjmp.setjmp` saves the execution state including the signal mask while `Csetjmp.usetjmp` does not include the signal mask.
- In directory `libs/m3core/src/Csupport`, add a platform specific subdirectory containing a properly configured `dtoa.c`.
- In file `libs/m3core/src/float/m3makefile` add an entry for the new platform in table _FloatPieces.
- In file `libs/m3core/src/runtime/m3makefile` add an entry for the new platform in table EXCEPTION_IMPL. Add a platform specific subdirectory in `libs/m3core/src/runtime` implementing the creation and manipulation of stacks for threads, and defining and installing signal handlers for signals such as SIGVTALRM and SIGSEGV.
- In file `libs/m3core/src/time/POSIX/m3makefile` add an entry for the new platform in table _DateImpls.
- In file `libs/m3core/src/unix/m3makefile` add an entry for the new platform in table _UnixPieces. If needed, add a platform specific subdirectory in `libs/m3core/src/unix` defining the interface to system services.
- In file `libs/libm3/src/random/m3makefile` add an entry for the new platform in table _RandomPieces.
- Check in `network/pkgserver/pkgobj/src/POSIX/m3makefile`, `libs/m3core/src/runtime/ex_frame/m3makefile`, `language/modula3/m3tools/pp/src/m3makefile`, `language/modula3/m3tools/gnuemacs/src/m3makefile`, `language/modula3/m3compiler/m3objfile/src/m3makefile`, `language/modula3/m3compiler/m3driver/src/m3makefile`, `language/modula3/m3compiler/m3back/src/m3makefile`, and `src/PACKAGES` to enable some system specific features such as integrated backend, or yacc vs bison.
- In package `language/modula3/m3compiler/m3bootstrap` issue the command `m3build -DBOOTTARGET=XXX`, where XXX should be replaced by the new platform. If all goes well, a bootstrap should be produced in the subdirectory `YYY/pm3-XXX` where YYY is the platform from which the port is initiated. This bootstrap may then be used as described in the installation instructions.