port.html 18 KB

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