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