xref: /plan9/sys/doc/port.ms (revision e06f534bbaa4097bc6f4764ef1dd2dc3338fbd40)
1.HTML "The Various Ports
2.TL
3The Various Ports
4.PP
5This document collects comments about the various
6architectures supported by Plan 9.
7The system tries to hide most of the differences between machines,
8so the machines as seen by a Plan 9
9user look different from how they are perceived through commercial software.
10Also, because we are a small group, we couldn't do everything:
11exploit every optimization, support every model,
12drive every device.
13This document records what we
14.I have
15done.
16The first section discusses the compiler/assembler/loader suite for each machine.
17The second talks about
18the operating system implemented on each of the various
19machines.
20.SH
21The Motorola MC68020 compiler
22.PP
23This is the oldest compiler of the bunch.  Relative to its
24competitors\(emcommercial compilers for the same machine\(emit generates
25quite good code.
26It assumes at least a 68020 architecture: some of the addressing
27modes it generates are not on the 68000 or 68010.
28.PP
29We also use this compiler for the 68040.  Except for a few
30instructions and registers available only from assembly language,
31the only user-visible difference between these machines is in
32floating point.  Our 68020s all have 68881 or 68882 floating
33point units attached, so to execute floating point programs we
34depend on there being appropriate hardware.
35Unfortunately, the 68040 is not quite so thorough in its implementation
36of the IEEE 754 standard or in its provision of built-in instructions
37for the
38transcendental functions.  The latter was easy to get around: we
39don't use them on the 68020 either, but we do have a library,
40.CW -l68881 ,
41that you can use if you need the performance (which can be
42substantial:
43.CW astro
44runs twice as fast).
45We don't use this library by default because we want to run the same
46binaries on both machines and don't want to emulate
47.CW FCOSH
48in the operating system.
49.PP
50The problem with IEEE is nastier.  We didn't really want to deal
51with gradual underflow and all that, especially since we had
52half a dozen machines we'd need to do it on, so on the 68040
53we implement non-trapping underflow as truncation to zero and
54do nothing about denormalized numbers and not-a-numbers.
55This means the 68020
56and the 68040 are not precisely compatible.
57.SH
58The Motorola MC68000 compiler
59.PP
60This compiler is a stripped-down version of the MC68020 compiler
61built for an abortive port to the Dragonball processor on the Palm Pilot.
62It generates position-independent code whose overall quality is much
63poorer than the code for the MC68020.
64.SH
65The MIPS compiler
66.PP
67This compiler generates code for the R2000, R3000, and R4000 machines configured
68to be big-endians.  The compiler generates no R4000-specific instructions
69although the assembler and loader support the new user-mode instructions.
70There is no support for little-endian machines.
71(A little-endian port exists, but is not included in the distribution.
72Contact us if you need it.)
73Considering its speed, the Plan 9 compiler generates good code,
74but the commercial
75MIPS compiler with all the stops pulled out consistently beats it
76by 20% or so, sometimes more.  Since ours compiles about 10 times
77faster and we spend most of our time compiling anyway,
78we are content with the tradeoff.
79.PP
80The compiler is solid: we've used it for several big projects and, of course,
81all our applications run under it.
82The behavior of floating-point programs is much like on the 68040:
83the operating system emulates where necessary to get past non-trapping
84underflow and overflow, but does not handle gradual underflow or
85denormalized numbers or not-a-numbers.
86.SH
87The SPARC compiler
88.PP
89The SPARC compiler is also solid and fast, although we haven't
90used it for a few years, due to a lack of current hardware.  We have seen it do
91much better than GCC with all the optimizations, but on average
92it is probably about the same.
93.PP
94We used to run some old SPARC machines with no multiply or divide instructions,
95so the compiler
96does not produce them by default.
97Instead it calls internal subroutines.
98A loader flag,
99.CW -M ,
100causes the instructions to be emitted.  The operating system has
101trap code to emulate them if necessary, but the traps are slower than
102emulating them in user mode.
103In any modern lab, in which SPARCS have the instructions, it would be worth enabling the
104.CW -M
105flag by default.
106.PP
107The floating point story is the same as on the MIPS.
108.SH
109The Intel i386 compiler
110.PP
111This is really an
112.I x 86
113compiler, for
114.I x >2.
115It works only
116if the machine is in 32-bit protected mode.
117It is solid and generates tolerable code; it is our main compiler these days.
118.PP
119Floating point is well-behaved, but the compiler assumes i387-compatible
120hardware to execute
121the instructions.  With 387 hardware,
122the system does the full IEEE 754 job, just like
123the MC68881.  By default, the libraries don't use the 387 built-ins for
124transcendentals.
125If you want them,
126build the code in
127.CW /sys/src/libc/386/387 .
128.SH
129The Intel i960 compiler
130.PP
131This compiler was built as a weekend hack to let us get the Cyclone
132boards running.  It has only been used to run one program\(emthe on-board
133code in the Cyclone\(emand is therefore likely to be buggy.
134There are a number of obvious optimizations to the code that have
135never been attempted.
136For example, the compiler does not support pipelining.
137The code runs in little-endian mode.
138.SH
139The DEC Alpha compiler
140.PP
141The Alpha compiler is based on a port done by David Hogan while
142studying at the Basser Department of Computer Science, University of Sydney.
143It has been used to build a running version of the operating system, but has
144not been stressed as much as some of the other compilers.
145.PP
146Although the Alpha is a 64-bit architecture, this compiler treats
147.CW int s,
148.CW long s
149and pointers as 32 bits.  Access to the 64-bit operations is available through the
150.CW vlong
151type, as with the other architectures.
152.PP
153The compiler assumes that the target CPU supports the optional byte and
154word memory operations (the ``BWX'' extension).
155If you have an old system, you can generate code without using the extension
156by passing the loader the
157.CW -x
158option.
159.PP
160There are a number of optimizations that the Alpha Architecture Handbook
161recommends, but this compiler does not do.  In particular, there is currently
162no support for the code alignment and code scheduling optimizations.
163.PP
164The compiler tries to conform to IEEE, but some Alpha CPUs do not implement
165all of the rounding and trapping modes in silicon.  Fixing this problem requires
166some software emulation code in the kernel; to date, this has not been attempted.
167.SH
168The PowerPC compiler
169.PP
170The PowerPC compiler supports the 32-bit PowerPC architecture only;
171it does not support either the 64-bit extensions or the POWER compatibility instructions.
172It has been used for production operating system work on the 603, 603e, 604e, 821, 823, and 860.
173On the 8xx floating-point instructions must be emulated.
174Instruction scheduling is not implemented; otherwise the code generated
175is similar to that for the other load-store architectures.
176The compiler makes little or no use of unusual PowerPC features such as the
177counter register, several condition code registers, and multiply-accumulate
178instructions, but they are sometimes
179used by assembly language routines in the libraries.
180.SH
181The Acorn ARM compiler
182.PP
183The ARM compiler is fairly solid; it has been used for some production
184operating system work including Inferno and the Plan 9 kernel
185for the iPAQ, which uses a StrongArm SA1.
186The compiler supports the ARMv4 architecture;
187it does not support the Thumb instruction set.
188It has been used on ARM7500FE processors and the Strongarm SA1 core machines.
189The compiler generates instructions for the ARM floating-point coprocessor.
190.SH
191The AMD 29000 compiler
192.PP
193This compiler was used to port an operating system to an AMD 29240 processor.
194The project is long abandoned, but the compiler lives on.
195.SH
196The Carrera operating system
197.PP
198We used to have a number of MIPS R4400 PC-like devices called Carreras,
199with custom-built frame buffers, that we used as terminals.
200They're almost all decommissioned now, but we're including the source as a reference
201in case someone wants to get another MIPS-based system running.
202.SH
203The IBM PC operating system
204.PP
205The PC version of Plan 9 can boot either from MS-DOS
206or directly from a disk created by the
207.CW format
208command; see
209.I prep (8).
210Plan 9 runs in 32-bit mode\(emwhich requires a 386 or later model x86 processor\(emand
211has an interrupt-driven I/O system, so it does not
212use the BIOS (except for a small portion of the boot program and floppy boot block).
213This helps performance but limits the set of I/O devices that it can support without
214special code.
215.PP
216Plan 9 supports the ISA, EISA, and PCI buses as well as PCMCIA and PC card devices.
217It is infeasible to list all the supported machines, because
218the PC-clone marketplace is too volatile and there is
219no guarantee that the machine you buy today will contain the
220same components as the one you bought yesterday.
221(For our lab, we buy components and assemble the machines
222ourselves in an attempt to lessen this effect.)
223Both IDE/ATA and SCSI disks are supported, and
224there is support for large ATA drives.
225CD-ROMs are supported two ways, either on the SCSI bus, or as ATA(PI) devices.
226The SCSI adapter must be a member of the Mylex Multimaster (old Buslogic BT-*) series
227or the Symbios 53C8XX series.
228Supported Ethernet cards include the
229AMD79C790,
2303COM Etherlink III and 3C589 series,
231Lucent Wavelan and compatibles,
232NE2000,
233WD8003,
234WD8013,
235SMC Elite and Elite Ultra,
236Linksys Combo EthernetCard and EtherFast 10/100,
237and a variety of controllers based on the
238Intel i8255[789] and Digital (now Intel) 21114x chips.
239We mostly use Etherlink III, i8255[789], and 21114x, so those drivers may be more robust.
240There must be an explicit Plan 9 driver for peripherals;
241it cannot use DOS or Windows drivers.
242Also,
243Plan 9 cannot exploit special hardware-related features that fall outside of the
244IBM PC model,
245such as power management,
246unless architecture-dependent code is added to the kernel.
247For more details see
248.I plan9.ini (8).
249.PP
250Over the years,
251Plan 9 has run on a number of VGA cards.
252Recent changes to the graphics system have not been
253tested on most of the older cards; some effort may be needed to get them working again.
254In our lab, most of our machines use the ATI Mach64, S3 ViRGE, or S3 Savage chips,
255so such devices are probably
256the most reliable.
257We also use a few Matrox and TNT cards.
258The system requires a hardware cursor.
259For more details see
260.I vgadb (6)
261and
262.I vga (8).
263The wiki
264.CW http://plan9.bell-labs.com/wiki/plan9 ) (
265contains the definitive list of cards that are known to work; see the ``supported PC hardware''
266page.
267.PP
268For audio, Plan 9 supports the Sound Blaster 16 and compatibles.
269(Note that audio doesn't work under Plan 9 with 8-bit Sound Blasters.)
270There is also user-level support for USB audio devices; see
271.I usb (4).
272.PP
273Finally, it's important to have a three-button mouse with Plan 9.
274The system currently works only with mice on the PS/2 port or USB.
275Serial mouse support should return before long.
276.PP
277Once you have Plan 9 installed (see the wiki's installation document)
278run the program
279.CW ld
280from DOS
281or use a boot disk.  See
282.I booting (8),
283.I 9load (8),
284and
285.I prep (8)
286for more information.
287.SH
288The Alpha PC operating system
289.PP
290Plan 9 runs on the Alpha PC 164.
291The Alpha port has not been used as much as the others,
292and should be considered a preliminary release.
293.PP
294The port uses the OSF/1 flavor
295of PALcode, and should be booted from the SRM firmware (booting
296from ARC is not supported).
297Supported devices are a subset of the PC ones; currently
298this includes DECchip 2114x-based ethernet cards, S3 VGA cards,
299Sound Blaster 16-compatible audio, floppy drives, and ATA hard disks.
300.PP
301The system has to be booted via tftp.
302See
303.I booting (8)
304for details.
305.SH
306The PowerPC operating system
307.PP
308We have a version of the system that runs on the PowerPC
309on a home-grown machine called Viaduct.
310The Viaduct minibrick is a small (12x9x3 cm) low-cost embedded
311computer consisting of a 50Mhz MPC850, 16MB sdram, 2MB flash,
312and two 10Mb Ethernet ports.  It is designed for home/SOHO
313networking applications such as VPN, firewalls, NAT, etc.
314.PP
315The kernel has also been ported to the Motorola MTX embedded motherboard;
316that port is included in the distribution.
317The port only works with a 604e processor (the 603e is substantially different)
318and at present only a single CPU is permitted.
319.SH
320The Compaq iPAQ operating system
321.PP
322Plan 9 was ported to Compaq's iPAQ Pocket PC,
323which uses the StrongArm SA1 processor.
324The model we have is a 3630; neighboring models also work.
325The kernel can drive a PCMCIA sleeve with a WaveLAN card, but no other PCMCIA
326devices have been ported yet.
327.PP
328The iPAQ runs
329.CW rio
330with a small keyboard application that allows Palm-style handwriting
331input as well as typing with the stylus on a miniature keyboard.
332.PP
333Fco. J. Ballesteros
334.CW nemo@plan9.escet.urjc.es ) (
335added support for hibernation, but we haven't been able to
336get that to work again in the new kernel; the code is there, however,
337for volunteers to play with.
338See the file
339.CW /sys/src/9/bitsy/Booting101
340for information about installing Plan 9 on the iPAQ.
341.SH
342The file server
343.PP
344The file server runs on only a handful of distinct machines.
345It is a stand-alone program, distantly related to the CPU server
346code, that runs no user code: all it does is serve files on
347network connections.
348It supports only SCSI disks, which can be interleaved for
349faster throughput.
350A DOS file on
351an IDE drive can hold the configuration information.
352See
353.I fsconfig (8)
354for an explanation of how
355to configure a file server.
356.PP
357To boot a file server, follow the directions for booting a CPU server
358using the file name
359.CW 9\f2machtype\fPfs
360where
361.I machtype
362is
363.CW pc ,
364etc. as appropriate.
365We are releasing only the PC version.
366.SH
367The IBM PC file server
368.PP
369Except for the restriction to SCSI disks,
370the PC file server has the same hardware requirements as
371the regular PC operating system.
372However, only a subset of the supported SCSI (Adaptec 1542, Mylex Multimaster,
373and Symbios 53C8XX) and Ethernet (Digital 2114x,
374Intel 8255x, and 3Com) controllers
375may be
376used.
377Any of the boot methods described in
378.I 9load (8)
379will work.
380.PP
381To boot any PC, the file
382.CW 9load
383must reside on a MS-DOS formatted floppy, IDE disk,
384or SCSI disk.
385However, PCs have no non-volatile RAM in which the
386file server can store its configuration information, so the system
387stores it in a file on an MS-DOS file system instead.
388This file, however, cannot live on a SCSI disk, only a floppy or IDE.
389(This restriction avoids a lot of duplicated interfaces in the
390system.)
391Thus the file server cannot be all-SCSI.
392See
393.I plan9.ini (8)
394for details about the
395.I nvr
396variable and specifying the console device.
397.SH
398Backup
399.PP
400Our main file server is unlikely to be much like yours.
401It is a PC with 128 megabytes
402of cache memory, 56 gigabytes of SCSI magnetic
403disk, and a Hewlett-Packard SureStore Optical 1200ex
404magneto-optical jukebox, with 1.2 terabytes of storage.
405This driver runs the SCSI standard jukebox protocol.
406We also have a driver for a (non-standard)
407SONY WDA-610
408Writable Disk Auto Changer (WORM),
409which stores almost 350 gigabytes of data.
410.PP
411The WORM is actually the prime storage; the SCSI disk is just
412a cache to improve performance.
413Early each morning the system constructs on WORM an image of
414the entire system as it appears that day.  Our backup system
415is therefore just a file server that lets
416you look at yesterday's (or last year's) file system.
417.PP
418If you don't have a magneto-optical jukebox,
419you might consider attaching a CD-R jukebox or even just
420using a single WORM drive and managing the dumps a little less
421automatically.  This is just a long way of saying that the
422system as distributed has no explicit method of backup other
423than through the WORM jukebox.
424.PP
425Not everyone can invest in such expensive hardware, however.
426Although it wouldn't be as luxurious,
427it would be possible to use
428.I mkfs (8)
429to build regular file system archives and use
430.I scuzz (8)
431to stream them to a SCSI 8mm tape drive.
432.CW Mkext
433could then extract them.
434Another alternative is to use
435.I dump9660
436(see
437.I mk9660 (8)),
438which stores incremental backups on CD images
439in the form of a dump hierarchy.
440.PP
441It is also possible to treat a regular disk, or even a part of a disk,
442as a fake WORM, which can then be streamed to tape when it fills.
443This is a bad idea for a production system but a good way to
444learn about the WORM software.
445Again, see
446.I fsconfig (8)
447for details.
448