port.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  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, 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, although there is no Plan 9 kernel for the machine.
  208. The compiler supports the ARMv4 architecture;
  209. it does not support the Thumb instruction set.
  210. It has been used on ARM7500FE processors and the Strongarm SA1 core machines.
  211. The compiler generates instructions for the ARM floating-point coprocessor.
  212. </P>
  213. <H4>The AMD 29000 compiler
  214. </H4>
  215. <P>
  216. This compiler was used to port an operating system to an AMD 29240 processor.
  217. The project is long abandoned, but the compiler lives on.
  218. </P>
  219. <H4>The Carrera operating system
  220. </H4>
  221. <P>
  222. We used to have a number of MIPS R4400 PC-like devices called Carreras,
  223. with custom-built frame buffers, that we used as terminals.
  224. They're almost all decommissioned now, but we're including the source as a reference
  225. in case someone wants to get another MIPS-based system running.
  226. </P>
  227. <H4>The IBM PC operating system
  228. </H4>
  229. <P>
  230. The PC version of Plan 9 can boot either from MS-DOS
  231. or directly from a disk created by the
  232. <TT>format</TT>
  233. command; see
  234. <A href="/magic/man2html/8/prep"><I>prep</I>(8).
  235. </A>Plan 9 runs in 32-bit mode&#173;which requires a 386, 486, or Pentium&#173;and
  236. has an interrupt-driven I/O system, so it does not
  237. use the BIOS (except for a small portion of the boot program and floppy boot block).
  238. This helps performance but limits the set of I/O devices that it can support without
  239. special code.
  240. </P>
  241. <P>
  242. Plan 9 supports the ISA, EISA, and PCI buses as well as PCMCIA devices.
  243. It is infeasible to list all the supported machines, because
  244. the PC-clone marketplace is too volatile and there is
  245. no guarantee that the machine you buy today will contain the
  246. same components as the one you bought yesterday.
  247. (For our lab, we buy components and assemble the machines
  248. ourselves in an attempt to lessen this effect.)
  249. Both IDE/ATA and SCSI disks are supported, and
  250. there is support for large ATA drives.
  251. CD-ROMs are supported two ways, either on the SCSI bus, or as ATA(PI) devices.
  252. The SCSI adapter must be a member of the Mylex Multimaster (old Buslogic BT-*) series
  253. or the Symbios 53C8XX series.
  254. Supported Ethernet cards include the
  255. AMD79C790,
  256. 3COM Etherlink III and 3C589 series,
  257. NE2000,
  258. WD8003,
  259. WD8013,
  260. SMC Elite and Elite Ultra,
  261. Linksys Combo EthernetCard and EtherFast 10/100,
  262. and a variety of controllers based on the
  263. Intel i8255[789] and Digital (now Intel) 21114x chips.
  264. We mostly use Etherlink III, i8255[789], and 21114x, so those drivers may be more robust.
  265. There must be an explicit Plan 9 driver for peripherals;
  266. it cannot use DOS or Windows drivers.
  267. Also,
  268. Plan 9 cannot exploit special hardware-related features that fall outside of the
  269. IBM PC model,
  270. such as power management,
  271. unless architecture-dependent code is added to the kernel.
  272. For more details see
  273. <A href="/magic/man2html/8/plan9.ini"><I>plan9.ini</I>(8).
  274. </A></P>
  275. <P>
  276. Over the years,
  277. Plan 9 has run on a number of VGA cards using the
  278. S3 80[15],
  279. S3 928,
  280. S3 864,
  281. Tseng ET4000,
  282. ATI Mach32/64
  283. and Cirrus Logic CLGD-54[23]x chips.
  284. However, recent changes to the graphics system have not been
  285. tested on all these cards; some effort may be needed to get them working again.
  286. In our lab, most of our machines use the Mach64 chips, so such devices are probably
  287. the most reliable.
  288. The system requires a hardware cursor.
  289. For more details see
  290. <A href="/magic/man2html/6/vgadb"><I>vgadb</I>(6)
  291. </A>and
  292. <A href="/magic/man2html/8/vga"><I>vga</I>(8).
  293. </A></P>
  294. <P>
  295. For audio, Plan 9 supports the Sound Blaster 16 and compatibles.
  296. (Note that audio doesn't work under Plan 9 with 8-bit Sound Blasters.)
  297. </P>
  298. <P>
  299. Finally, it's important to have a three-button mouse with Plan 9.
  300. The system works with either a PS/2 or serial mouse.
  301. </P>
  302. <P>
  303. Once you have Plan 9 installed (see the separate installation document)
  304. run the program
  305. <TT>ld</TT>
  306. from DOS
  307. or use a boot disk. See
  308. <A href="/magic/man2html/8/booting"><I>booting</I>(8),
  309. </A><A href="/magic/man2html/8/9load"><I>9load</I>(8),
  310. </A>and
  311. <A href="/magic/man2html/8/prep"><I>prep</I>(8)
  312. </A>for more information.
  313. </P>
  314. <H4>The Alpha PC operating system
  315. </H4>
  316. <P>
  317. Plan 9 runs on the Alpha PC 164.
  318. The Alpha port has not been used as much as the others,
  319. and should be considered a preliminary release.
  320. </P>
  321. <P>
  322. The port uses the OSF/1 flavor
  323. of PALcode, and should be booted from the SRM firmware (booting
  324. from ARC is not supported).
  325. Supported devices are a subset of the PC ones; currently
  326. this includes DECchip 2114x-based ethernet cards, S3 VGA cards,
  327. Sound Blaster 16-compatible audio, floppy drives, and ATA hard disks.
  328. </P>
  329. <P>
  330. The system has to be booted via tftp.
  331. See
  332. <A href="/magic/man2html/8/booting"><I>booting</I>(8)
  333. </A>for details.
  334. </P>
  335. <H4>The PowerPC operating system
  336. </H4>
  337. <P>
  338. We have a version of the system that runs on the PowerPC,
  339. but only on a home-grown machine called Viaduct.
  340. The Viaduct minibrick is a small (12x9x3 cm) low-cost embedded
  341. computer consisting of a 50Mhz MPC850, 16MB sdram, 2MB flash,
  342. and two 10Mb Ethernet ports. It is designed for home/SOHO
  343. networking applications such as VPN, firewalls, NAT, etc.
  344. </P>
  345. <H4>The file server
  346. </H4>
  347. <P>
  348. The file server runs on only a handful of distinct machines.
  349. It is a stand-alone program, distantly related to the CPU server
  350. code, that runs no user code: all it does is serve files on
  351. network connections.
  352. It supports only SCSI disks, which can be interleaved for
  353. faster throughput.
  354. A DOS file on
  355. an IDE drive can hold the configuration information.
  356. See
  357. <A href="/magic/man2html/8/fsconfig"><I>fsconfig</I>(8)
  358. </A>for an explanation of how
  359. to configure a file server.
  360. </P>
  361. <P>
  362. To boot a file server, follow the directions for booting a CPU server
  363. using the file name
  364. <TT>9&lt;I&gt;machtype&lt;/I&gt;fs</TT>
  365. where
  366. <I>machtype</I>
  367. is
  368. <TT>pc</TT>,
  369. etc. as appropriate.
  370. We are releasing only the PC version.
  371. </P>
  372. <H4>The IBM PC file server
  373. </H4>
  374. <P>
  375. Except for the restriction to SCSI disks,
  376. the PC file server has the same hardware requirements as
  377. the regular PC operating system.
  378. However, only a subset of the supported SCSI (Adaptec 1542, Buslogic Multimaster,
  379. and Symbios 53C8XX) and Ethernet (Digital 2114x,
  380. Intel 8255x, and 3Com) controllers
  381. may be
  382. used.
  383. Any of the boot methods described in
  384. <A href="/magic/man2html/8/b.com"><I>b.com</I>(8)
  385. </A>will work.
  386. </P>
  387. <P>
  388. To boot any PC, the file
  389. <TT>b.com</TT>
  390. must reside on a MS-DOS formatted floppy, IDE disc,
  391. or SCSI partition.
  392. However, PCs have no non-volatile RAM in which the
  393. file server can store its configuration information, so the system
  394. stores it in a file on an MS-DOS file system instead.
  395. This file, however, cannot live on a SCSI disc, only a floppy or IDE.
  396. (This restriction avoids a lot of duplicated interfaces in the
  397. system.)
  398. Thus the file server cannot be all-SCSI.
  399. See
  400. <A href="/magic/man2html/8/plan9.ini"><I>plan9.ini</I>(8)
  401. </A>for details about the
  402. <I>nvr</I>
  403. variable and specifying the console device.
  404. </P>
  405. <H4>Backup
  406. </H4>
  407. <P>
  408. Our main file server is unlikely to be much like yours.
  409. It is a PC with 128 megabytes
  410. of cache memory, 56 gigabytes of SCSI magnetic
  411. disk, and a Hewlett-Packard SureStore Optical 1200ex
  412. magneto-optical jukebox, with 1.2 terabytes of storage.
  413. This driver runs the SCSI standard jukebox protocol.
  414. We also have a driver for a (non-standard)
  415. SONY WDA-610
  416. Writable Disk Auto Changer (WORM),
  417. which stores almost 350 gigabytes of data.
  418. </P>
  419. <P>
  420. The WORM is actually the prime storage; the SCSI disk is just
  421. a cache to improve performance.
  422. Early each morning the system constructs on WORM an image of
  423. the entire system as it appears that day. Our backup system
  424. is therefore just a file server that lets
  425. you look at yesterday's (or last year's) file system.
  426. </P>
  427. <P>
  428. If you don't have a magneto-optical jukebox,
  429. you might consider attaching a CD-R jukebox or even just
  430. using a single WORM drive and managing the dumps a little less
  431. automatically. This is just a long way of saying that the
  432. system as distributed has no explicit method of backup other
  433. than through the WORM jukebox.
  434. </P>
  435. <P>
  436. Not everyone can invest in such expensive hardware, however.
  437. Although it wouldn't be as luxurious,
  438. it would be possible to use
  439. <A href="/magic/man2html/8/mkfs"><I>mkfs</I>(8)
  440. </A>to build regular file system archives and use
  441. <A href="/magic/man2html/8/scuzz"><I>scuzz</I>(8)
  442. </A>to stream them to a SCSI 8mm tape drive.
  443. <TT>Mkext</TT>
  444. could then extract them.
  445. </P>
  446. <P>
  447. It is also possible to treat a regular disk, or even a part of a disk,
  448. as a fake WORM, which can then be streamed to tape when it fills.
  449. This is a bad idea for a production system but a good way to
  450. learn about the WORM software.
  451. Again, see
  452. <A href="/magic/man2html/8/fsconfig"><I>fsconfig</I>(8)
  453. </A>for details.
  454. &#191;</P>
  455. <br>&#32;<br>
  456. <A href=http://www.lucent.com/copyright.html>
  457. Copyright</A> &#169; 2002 Lucent Technologies Inc. All rights reserved.
  458. </body></html>