Browse Source

First pull from upstream 12/17/16

RISCi_ATOM 7 years ago
commit
886e736bff
100 changed files with 7325 additions and 0 deletions
  1. 956 0
      CHANGES
  2. 0 0
      DragonFly/386/bin/.dreg
  3. 30 0
      DragonFly/386/include/emu.h
  4. 76 0
      DragonFly/386/include/fpuctl.h
  5. 474 0
      DragonFly/386/include/lib9.h
  6. 0 0
      DragonFly/386/lib/.dreg
  7. BIN
      FreeBSD/386/bin/data2c
  8. BIN
      FreeBSD/386/bin/iyacc
  9. BIN
      FreeBSD/386/bin/mk
  10. BIN
      FreeBSD/386/bin/mkext
  11. 30 0
      FreeBSD/386/include/emu.h
  12. 76 0
      FreeBSD/386/include/fpuctl.h
  13. 475 0
      FreeBSD/386/include/lib9.h
  14. 86 0
      INSTALL
  15. 8 0
      Inferno/386/include/lib9.h
  16. 64 0
      Inferno/386/include/u.h
  17. 25 0
      Inferno/386/include/ureg.h
  18. 8 0
      Inferno/arm/include/lib9.h
  19. 65 0
      Inferno/arm/include/u.h
  20. 24 0
      Inferno/arm/include/ureg.h
  21. 8 0
      Inferno/mips/include/lib9.h
  22. 65 0
      Inferno/mips/include/u.h
  23. 4 0
      Inferno/power/include/lib9.h
  24. 84 0
      Inferno/power/include/u.h
  25. 43 0
      Inferno/power/include/ureg.h
  26. 9 0
      Inferno/sparc/include/lib9.h
  27. 64 0
      Inferno/sparc/include/u.h
  28. 45 0
      Inferno/sparc/include/ureg.h
  29. 8 0
      Inferno/spim/include/lib9.h
  30. 56 0
      Inferno/spim/include/u.h
  31. 8 0
      Inferno/thumb/include/lib9.h
  32. 65 0
      Inferno/thumb/include/u.h
  33. 24 0
      Inferno/thumb/include/ureg.h
  34. BIN
      Irix/mips/bin/awk
  35. BIN
      Irix/mips/bin/data2c
  36. BIN
      Irix/mips/bin/iyacc
  37. BIN
      Irix/mips/bin/mk
  38. BIN
      Irix/mips/bin/mkext
  39. 22 0
      Irix/mips/include/emu.h
  40. 456 0
      Irix/mips/include/lib9.h
  41. BIN
      Linux/386/bin/data2c
  42. BIN
      Linux/386/bin/iyacc
  43. BIN
      Linux/386/bin/mk
  44. BIN
      Linux/386/bin/mkext
  45. 33 0
      Linux/386/include/emu.h
  46. 0 0
      Linux/386/include/fpuctl.h
  47. 495 0
      Linux/386/include/lib9.h
  48. 34 0
      Linux/arm/include/emu.h
  49. 0 0
      Linux/arm/include/fpuctl.h
  50. 504 0
      Linux/arm/include/lib9.h
  51. BIN
      Linux/power/bin/data2c
  52. BIN
      Linux/power/bin/iyacc
  53. BIN
      Linux/power/bin/limbo
  54. BIN
      Linux/power/bin/mk
  55. BIN
      Linux/power/bin/mkext
  56. 37 0
      Linux/power/include/emu.h
  57. 517 0
      Linux/power/include/lib9.h
  58. 39 0
      Linux/spim/include/emu.h
  59. 0 0
      Linux/spim/include/fpuctl.h
  60. 499 0
      Linux/spim/include/lib9.h
  61. BIN
      MacOSX/386/bin/data2c
  62. BIN
      MacOSX/386/bin/iyacc
  63. BIN
      MacOSX/386/bin/mk
  64. BIN
      MacOSX/386/bin/mkext
  65. 34 0
      MacOSX/386/include/emu.h
  66. 0 0
      MacOSX/386/include/fpuctl.h
  67. 516 0
      MacOSX/386/include/lib9.h
  68. 72 0
      MacOSX/README
  69. BIN
      MacOSX/power/bin/data2c
  70. BIN
      MacOSX/power/bin/iyacc
  71. BIN
      MacOSX/power/bin/mk
  72. BIN
      MacOSX/power/bin/mkext
  73. 22 0
      MacOSX/power/include/emu.h
  74. 537 0
      MacOSX/power/include/lib9.h
  75. 12 0
      MacOSX/tcshrc
  76. 32 0
      NOTICE
  77. BIN
      NetBSD/386/bin/data2c
  78. BIN
      NetBSD/386/bin/mk
  79. BIN
      NetBSD/386/bin/mkext
  80. BIN
      NetBSD/386/bin/yacc
  81. 30 0
      NetBSD/386/include/emu.h
  82. 76 0
      NetBSD/386/include/fpuctl.h
  83. 478 0
      NetBSD/386/include/lib9.h
  84. BIN
      Nt/386/bin/awk.exe
  85. BIN
      Nt/386/bin/c2l.exe
  86. BIN
      Nt/386/bin/cat.exe
  87. BIN
      Nt/386/bin/cp.exe
  88. BIN
      Nt/386/bin/data2c.exe
  89. BIN
      Nt/386/bin/echo.exe
  90. BIN
      Nt/386/bin/format.exe
  91. BIN
      Nt/386/bin/gzip.exe
  92. BIN
      Nt/386/bin/infdb.exe
  93. BIN
      Nt/386/bin/iyacc.exe
  94. BIN
      Nt/386/bin/mk.exe
  95. BIN
      Nt/386/bin/mkdir.exe
  96. BIN
      Nt/386/bin/mkext.exe
  97. BIN
      Nt/386/bin/mv.exe
  98. BIN
      Nt/386/bin/rcsh.exe
  99. BIN
      Nt/386/bin/rm.exe
  100. BIN
      Nt/386/bin/sed.exe

+ 956 - 0
CHANGES

@@ -0,0 +1,956 @@
+20140525
+	implement & in replacement text in sed
+20140524
+	utflen in styx.b (probably ought to be in Sys) supporting 21-bit unicode (issue 314)
+	allow slashes in anames [fixed by kristofwyzc, issue 312]
+20140518
+	sh(2): exec -> run [issue 311]
+20140501
+	add -s option to dns in cs(8) [issue 310]
+	don't send nil soa to dnscache [issue 309]
+20140302
+	utils/cc/funct.c - remove out-of-bounds reference
+	os/ipaq1110, ip/ipaux.c, os/sa1110 - add default cases to keep compiler happy
+20140223
+	/dis/sig: use raise not exit for errors
+20140105
+	incorrect check on keyname in getauthinfo [issue 306]
+20130906
+	remove redundant code
+20130529
+	appl/cmd/cpu.b: use Dial, and neither test /dev/draw/new nor bind #d (which is wrong anyway, it's #i for drawing now)
+20130423
+	mkfiles/mkfile-MacOSX-386: set 32-bit mode, and macosx-version-min to 10.6 [via http://debu.gs/entries/interlude-inferno-at-work]
+20121210
+	utils/awk/run.c - prevent free of pointer still in use [cinap]
+20121205
+	appl/cmd/mk/mksubdirs [issue 290 change suggested by powerman]
+20120918
+	remove unused/unusable debug/setdebug from appl/lib/auth9.b and replace Keyring by Crypt
+20120820
+	emu/port/devip.c reset headers flag in Conv
+20120725
+	increase KSTACK for Linux/arm
+20120615
+	add configuration emu/FreeBSD/emu-g [powerman]
+20120509
+	utils/libmach: add missing user stack top initialisers, minor changes to sync with 9
+20120507
+	mkfiles/mkfile-MacOSX-386 change cc to gcc
+	emu/MacOSX/win.c null out drawcursor
+20120424
+	utils/cc/Posix.c and utils/c2l/Posix.c: correct definition of mydup for POSIX dup/dup2
+	libbio/bprint.c error handling if flush or print fails
+20120305
+	add -I$ROOT/(Plan9|Inferno)/include to CFLAGS in mkfiles/^(mkfile-Plan9* mkfile-Inferno*)
+		change specific object type to $OBJTYPE in the same
+	libmath/fdlibm/fdlibm.h and libmath/dtoa.c, if USE_FPdbleword defined, use FPdbleword to crack doubles into integers
+20120304
+	rabin(2) added (preliminary)
+20120213
+	styxservers: add .error operation (preliminary)
+20120116
+	lib9.h: internally rename qsort as infqsort to avoid C library clash
+	lib9/qsort.c: include lib9.h
+	lib9/mkfile: move qsort to IMPORTFILES from COMMONFILES
+20120103
+	avoid re-defining isnan; use isNaN instead
+20111231
+	Linux/*/include/emu.h adjustments for USE_PTHREADS for non-x86 processors
+20111221
+	add `...` uninterpreted string literals to limbo/lex.c, appl/cmd/limbo/lex.b
+20111215
+	liblogfs,libnandfs: use logfsos.h (added to include) to make library source independent of os
+	add fonts/vera
+	add fonts/courier
+20111214
+	change Linux port to use pthreads instead of clone directly
+	emu/Linux: rename os.c to os-clone.c; rename osp.c to os.c
+	emu/Linux/mkfile: remove -lrt, add kproc-pthreads.$O
+	Linux/*/include: define USE_PTHREADS
+	Linux/386/include/emu.h: increase KSTACK to 32k for Linux gethost* functions
+20111003
+	libinterp/heap.c:/^dtype discount size of map [issue 258]
+20110820
+	emu/*/devfs.c, emu/port/devfs-posix.c - stubs for osdisksize, Linux implementation of osdisksize
+	emu/port/devfs-posix.c - also try SOCK_DGRAM for AF_UNIX [issue 269]
+20110819
+	appl/cmd/mk/mk.b - use raise "fail:..." for exit status [issue 268]
+20110629
+	change x86 getcallerpc to avoid use of %ebp [issue 266]
+	change type of getcallerpc to uintptr from ulong
+20110619
+	emu/port/devfs-posix.c: put major/minor st_dev into path without mapping (with luck)
+	emu/port/kproc-pthreads.c: ensure pthread stack is at least PTHREAD_STACK_MIN (plus slop)
+20110526
+	change osyield in Windows to use SwitchToThread instead of sleep(0) [e-mail list]
+20110525
+	utils/[5678kqv]c/mkfile - include -I. before $CFLAGS to ensure right gc.h [issue 264]
+20110516
+	merge changes from vac branch of mechiel-inferno-os (googlecode)
+20110426
+	emu/Linux/asm-arm.S linux system call interface changed [issue 215, mechiel]
+20110419
+	libinterp/tk.c:/^Tk_rect shouldn't return non-canonical rectangles
+	/appl/wm/mand.b handle reshape to empty rectangles
+20110408
+	appl/lib/json.b - have writeval produce same (correct) form as .text for Real [issue 230]
+20110407
+	fix embarrassingly broken Lists->delete; add Lists->find [issue 257]
+	add some extra explanation to sys-dup(2) about fildes
+20110404
+	update Nt/386/bin
+	/limbo/com.c - count constants in qualifiers, not qualifiers [issue 212, mechiel]
+	/appl/cmd/limbo/com.b [also issue 212]
+20110403
+	secstore(2) and secstore(1) updated to implement writing [issue 256, mechiel]
+20110402
+	revision to devsrv.c change [issue 244] to avoid two calls to delwaiting
+20110330
+	call strtol not atoi for hex numbers [issue 255, mechiel]
+20110329
+	utils/mkdir/mkdir.c - add -p option [mechiel, issue 250]
+	emu/Linux/mkfile - try searching -lpthread after -lrt for sem_* [issue 247]
+	emu/port/devfs-posix.c - treat unix domain sockets as files (open/read/write/close) [npe, rsc, issue 254]
+	emu/port/devfs-posix.c - use volatile correctly; slight code tidy
+	emu/lib9/errstr-posix.c replace EINTR's error string by Eintr's text
+20110315
+	libtk/textw.c - fix mysterious control characters for editing (D and K) [issue 253, fix from mechiel]
+20110225
+	split emu.h from lib9.h for all platforms
+	kproc in emu is now a void type as in os
+20110224
+	move private mem flag to Progs [issue 240, mechiel]
+20110224
+20110208
+	emu/Linux/os.c - use -lrt's semaphores instead of signals
+	emu/Linux/mkfile - add -lrt to library list, and push out separation of X11LIBS from SYSLIBS for emu-g done ages ago
+20110126
+	emu/MacOSX/os.c - move a free to a more sensible place
+20110117
+	emu/Nt/ipif.c changed to work with ipv6 interface changes
+20110116
+	add Plan9/arm support [provided by richard miller]
+20110110	
+	utils/libmach/qdb.c [issue 245] restore renaming of qdiv as qmuldiv
+20110104
+	emu/MacOSX/win.c detect double clicks [issue 232, jas]
+	emu/MacOSX/os.c replace erendezvous by a per-kproc semaphore for osblock/osready
+20101220
+	changes to srv(3) to notify client when server vanishes [issue 244, thanks to powerman and roger]
+20101205
+	change a few types in ipif-posix.c to appease the gods
+	emu/MacOSX/mkfile - include portmkfile at correct point for LIBFILES to work (and other, minor, changes) [issue 24]
+20101127
+	emu/port/*ip*.[ch] and emu/Nt/ipif*.c updated with new interface for ipv6 support [mechiel] [issue 193]
+	emu/Linux/os.c address compilation warnings (setfcr etc still to do)
+20101125
+	asm/assem.c don't attempt to use missing src (issue 243)
+20100925
+	appl/lib/w3c/uris.b - handle existing Unicode characters if they happen not to have been encoded into string
+	appl/svc/httpd/parser.b - similar [response to issue 233]
+20100914
+	emu/Nt/os.c - replace trap handling
+20100822
+	correct handling of mouse focus in sub-widgets of widget windowed in text [issue 241]
+	add various warnings to mkfile-Linux-386
+20100821
+	correct handling of mouse focus in sub-widgets of widget windowed in canvas [issue 241]
+20100819
+	failed to push Solaris/sparc/include/lib9.h with u64int change [issue 151]
+	appl/cmd/ar.b eliminate false error return
+20100810
+	initial introduction of crypt-*(2) and ipints(2)
+	replace keyring.m in module/runt.m by ipints.m and crypt.m; compensate in libinterp and libkeyring by using keyringif.m to generate Keyring's interface
+20100802
+	various changes held back by accident, notably stackv in stack(1), better diagnostics by cat(1)
+20100801
+	libtk/coval.c - simplify vlong expression for some compilers [issue 216, mechiel]
+20100727
+	on Linux and MacOSX, look at faulting address to decide if it's dereference of nil
+20100722
+	include/bio.h add varargck and repair resulting diagnostics in utils and limbo/ [issue 237, mechiel]
+20100719
+	appl/cmd/disk/mkfs.b change getname/getpath to cope with missing newline [issue 236]
+20100715
+	appl/wm/toolbar.b changed not to create new /chan/snarf if one exists, unless -p (private) option given [toolbar(1)]
+	utils/cc/macbody - add overlooked change to implement __VA_ARGS__
+	other minor updates to the compilers to resync
+20100714
+	correctly initialise types in utils/cc/sub.c
+20100504
+	change lib9/strtoull.c for MS
+20100503
+	updated libmach/8db.c to avoid [] initialisers
+20100501
+	update libmach to compensate for MS compiler
+20100426
+	updated libmach
+	updated compiler suites (continuing)
+20100425
+	appl/wm/wm.b shorten processing of wmctl close if client hadn't started
+20100406
+	fix handling of boundary case in libtk/utils.c
+20100402
+	add new option OPTflags to libtk for later use
+20100325
+	more swizzling of libtk for later use. revised radio and check buttons.
+20100322
+	a few tweaks to Tk for later use
+20100320
+	appl/lib/json.b dis/lib/json.dis - use %f not string <real-value> to ensure json value acceptable [issue 230, powerman]
+20100310
+	stop tabs(2) from issuing pointless tk cmd that produces diagnostics
+20100305
+	add emu/Linux/audio-oss.c from saoret.one [issue 226]
+20100226
+	mention -n nvram option in keyfs(4)
+20100220
+	appl/cmd/keyfs.b wasn't clunking fids on error in remove [issue 225]
+20100213
+	apply saoret.one's changes for thumb [issue 155]
+20100205
+	update man pages to replace most references to Styx by 9P
+	update man pages to replace references to sys-dial(2) by dial(2)
+	add DragonFly files (from fgudin and extrudedaluminiu, issue 181); possibly should automatically keep aligned with FreeBSD
+	fpe handling in OpenBSD and FreeBSD [mechiel, issue 190]
+	appl/cmd/vacfs.b apply fix from mechiel [issue 204]
+20100203
+	appl/lib/cfg.b treat \r as white space [issue 69, issue 70]
+	add u64int to lib9.h files that needed it
+	add sha2.c sha256block.c sha512block.c to libsec/port and include/libsec.h [issue 185, mechiel]
+	add new sha functions to module/keyring.m and libinterp/keyring.c
+20100115
+	appl/cmd/tarfs.b man/4/tarfs changes to permission handling from mechiel [issue 220]
+	appl/spree/mkfile add explicit -I$ROOT/module [issue 209, powerman]
+20100110
+	appl/cmd/tcs.b [issue 12, arvindht]: process unconverted bytes next cycle, flush conversion state; improve error checking
+20091219
+	change default roots in Nt utils to c:\inferno
+20091215
+	factotum(2) updated to include keyspec in signature
+	appl/cmd/mount.b uses -k value as keyspec if -9 selected [not to much purpose with current factotum's p9any]
+	bind(1) [for mount] updated to describe -k used for keyspec if -9 selected
+20091214
+	switch more commands to use dial(2)
+	change emu/Linux/emu-g not to require X11 libs (again)
+20091213
+	temper the tendancy of port/dis.c to yield during idle gc: it's compensating for os scheduling, but yield less often
+20091208
+	add mkdir -p to makemk.sh to ensure output directories exist [issue 213]
+20091127
+	problems fixed in styxconv(2), which can now convert both ways [rog]
+20091119
+	emu/port/devfs-posix.c	missing waserror in dirread (obscure but possible failure)
+20091007
+	remove intermediate exception-raising function from charon implementation
+20091004
+	restore "keyring" to lib section of emu/Plan9/emu
+20090930
+	emu/*/ipif*.c make "hangup" act as in native Inferno; also delete unused so_setsockopt
+	provide correct version of devmnt.c
+20090928
+	update import(4) to remove the restriction to Plan 9 (can use Inferno's own factotum)
+	(emu os)^/port/devmnt.c fix from plan 9 (don't access vanished data)
+20090830
+	check subexp length in ed [cmbrannon79]
+20090825
+	add netmkaddr call to /appl/cmd/ftpfs.b; send errors to standard error
+20090824
+	delete unused (and somewhat incomplete) pin support
+20090822
+	in the what were we thinking dept: appl/cmd/touch.b and dis/touch.dis updated to avoid using an Arg after nil'ing it [thanks to cmbrannon]
+	make progmode propagate to pgrps; recover from exceptions in pgrp creation
+20090821
+	emu/Nt/^(os.c ie-os.c) add #include <excpt.h>
+20090819
+	appl/cmd/mk/mk.b replace maketmp/mktemp (issue 202, mechiel); also old change: don't persist with bulkmtime on non-directories
+20090816
+	registry(4) Event.post increased rootvers when entries are written or removed (issue 179, powerman)
+20090809
+	bring mkfs(8) up to date (issue 176)
+	remove -q options from mkfs and mkext (-q was a transitional option to suppress quoting of file names)
+20090806
+	increase `backlog' value in all listen calls in hosted Inferno (emu/*/ipif*.c) [powerman]
+20090805
+	further checking added to libinterp/keyring.c: rejects incorrect states and out of bounds values of f->n
+	add lib/emptydirs and mkdirs target to /mkfile (utils/mkdir needs to be changed for Windows use)
+20090730
+	improve the error checking in strtosk and strtopk to help detect mangled or inappropriate keys
+20090728
+	emu/port/main.c: put host's working directory name as emuwdir
+	document initial environment variables in emu(1)
+	appl/lib/bufio.b dis/lib/bufio.dis [issue 199] don't lose track of actual file seek offset (following second suggestion of mjl)
+	issue 196: after general apologies for appl/svc/httpd/cache.b (don't look if you don't need it, not one of ours, etc. etc.) will patch as suggested by extrudedaluminiu(!) [vs]
+20090719
+	correct order of operands to memset(!), eg in ipif [mjl]
+20090718
+	fix appl/cmd/stream.b error exits to include fail: [mjl]
+20090717
+	fix appl/lib/ip.b (see issue 186) [mjl]
+	re-enable XK_ keys in port/win-x11a.c [mjl]
+20090716
+	add segflush calls to comp-386.c [probably need different name eventually to avoid time wasting when not needed]
+20090630
+	add sig (see man(1)) [via p9p and caerwyn]
+20090627
+	push changes described for arm in 20090330 (but not previously pushed)
+	begin change of inferno-os.googlecode.com from svn to mercurial
+200090612
+	added support for Linux-power (ericvh; and further simplified)
+20090605
+	appl/cmd/disk/kfs.b dis/disk/kfs.dis - don't try to update super block if readonly(!) [issue 175]
+20090526
+	emu/Nt/os.c allow /dev/hoststdin input on file or pipe (thanks to caerwyn, issue 173)
+	emu/port/devfs-posix.c correct handling of error return from pread (issue 172, but goes beyond that)
+	emu/port/exportfs.c os/port/exportfs.c use vlong for offset
+20090524
+	appl/cmd/tarfs.b dis/tarfs.dis - remove accidentally small limit on file size in tar file (issue 172)
+20090521
+	module/vac.m appl/cmd/vacfs.b appl/lib/vac.b [issue 152] (Mecchiel)
+20090505
+	add -h/-t header/trailer options to man2html
+20090430
+	filter-deflate(2), appl/lib/^(inflate.b deflate.b): changes from mjl to support zlib headers for deflate streams as well as gzip's
+20090417
+	add m4(1) in its initial form (might split the macro processing proper off into a library module)
+20090409
+	tools/odbc/odbc.c data read should return 0 if no columns or rows (issue 170)
+20090408
+	tools/odbc/odbc.c use strecpy and more care in allocation (issue 169)
+20090403
+	change ,2 to ,#function in Solaris sparc assembler files (apparently works in gcc and sun's)
+	make appl/wm/brutus.b pass input to its widgets (issue 105)
+	enable fullscreen mode in MacOSX (issue 148)
+20090402
+	add missing emu/Linux/segflush-*.c files and remove ARM segflush from os.c
+20090402
+	ramfile and logfile shouldn't set Sys->MCREATE (issue 137)
+20090401
+	appl/cmd/limbo/typecheck.b check correctly for function prevented from inline expansion
+20090330
+	use (low, high) order for words in vlong and fp on arm: libinterp/comp-arm.c, Inferno/arm/include/^(lib9.h u.h)
+		also os/*/fpi.h (for arm platforms), exchanging order of ulongs in Double
+		also libkern/^(vlrt-arm.c vlop-arm.s vlop-thumb.s frexp-arm.c frexp-thumb.c)
+	include changes from richard miller for little-endian mips (spim) and Linux/spim hosted
+	libmath/dtoa.c: use simpler code to avoid gcc bug on mips and perhaps other platforms (rmiller)
+20090330-branches/forse
+	include appl/cmd/ssh source (won't compile here because it needs the keyring changes)
+20090325-branches/forse
+	emu/* adopt changes to Chan (Dev* dev pointer instead of int type)
+20090320
+	emu/port/win-x11a.c: unintuitively use xdisplay not xkbdcon to send to kbdproc (with big stack) to change cursor
+		(the big stack is needed because XCreateBitmapFromData and XPutImage pass control to theme-related code that uses lots of stack space)
+	use uname not aname for user name in libstyx and set aname to "" by default
+	make odbc's new file have mode 666 so others can open it
+	add styxsetowner function to styxserver.h to set default owner (eve)
+	move styxserver.h to inferno's include directory
+20090222
+	appl/cmd/ndb/registry.b and dis/registry.dis - implement flush for event file (issue 162)
+20090217
+	appl/cmd/limbo/stubs.b limbo/stubs.c - include length parameter to builtinmod (could just be 0 in most cases)
+	change f->ret/destroy code in stubs.c/stubs.b to destroy correctly in case of exceptions
+20090202
+	emu/port/win-x11a.c: might as well try this everywhere now
+20090127
+	libinterp/xec.c: fix gc problem with self
+20090122
+	libinterp/string.c: slicer can return H for empty slice after bounds check (brucee)
+20081119
+	os/pc/^(main.c fns.h) more idle idlehands
+20081112
+	emu/Linux/asm-arm.S old failure to use different regs for swp finally changed here
+	libmath/blas.c compensate for gcc bug on arm
+20081107
+	replace calls to calloc by malloc
+20081106
+	os/port/dis.c prevent new spawns during killgrp
+	also synchronise two killgrps of the same group
+20081105
+	emu/port/dis.c prevent new spawns during killgrp [#117]
+20081022
+	sh: ignore leading white space in fail: strings, and change empty tail to "failed"
+	/emu/port/devfs-posix.c don't call readdir after it has returned end of file
+20081021
+	/appl/cmd/auth/ai2key.b new command to convert authinfo files to factotum keys
+	/appl/cmd/auth/factotum/proto/infauth.b allow new key format
+20081019
+	/appl/cmd/man2html.b implement "\ " => "&nbsp;"
+	/man/3/prog change way a literal " was formatted
+	/man/8/srv deleted (obsolete)
+	removed reference to srv(8) from sys-pctl(2)
+20080909
+	/appl/cmd/puttar.b add extra empty block at end of archive as required by format
+20080907
+	include some changes from acme-sac in emu/Nt/devfs.c; need further control of usesec (or discard it)
+20080723
+	rename Inferno's yacc to iyacc to avoid clash with system's own (now that Linux and others distribute it)
+20080707
+	update emu/port/win-x11a.c (fix someone's earlier patch to stop using undefined value)
+	emu/port/main.c mark obsolete options and remove from usage
+20080705
+	update utils/sed, eliminating anonymous unions (just by commenting them out, to keep source in step with 9)
+		and several other changes for portability
+20080703
+	remove anonymous unions (and unused structs) from unpacking structures in emu/Nt/vlrt.c, not that it's used
+20080617
+	win-x11a.c add sqweek's change to pass on KeyRelease values (but perhaps 1-byte values are no longer enough?)
+20080614
+	change os/port/devcons.c to use error not panic in sysfatal
+20080612
+	change several libmp/port functions to use sysfatal not abort
+	change emu/port/main.c to have sysfatal call error not exit
+20080611
+	Keyring->dhparams to use DSAprimes in special case
+	IPint.random now ignores minint (will go next revision)
+	BigInt -> mpint*
+	checkIPint in libinterp/ipint.c
+	default keys in auth/createsignerkey are 1024 not 512 bits
+	update os/boot/pc
+20080610
+	push sh-mload(1) and changes to sh-expr(1)
+20080609
+	_tas type changed from ulong to int
+20080530
+	issue 91: _declspec changed to __declspec in Nt files
+	issue 92: argv0 declaration changed to extern from static in emu/Nt/win.c
+20080529
+	limbo/stubs.c: allow pick adt types
+20080528
+	emu/port/win-x11a.c screen depth checks from drawterm via tim@nop.cx
+20080524
+	add missing NetBSD files
+20080522
+	dis/lib/msgio.dis appl/lib/msgio.b - fix incorrect check for 16rFF
+	add OpenBSD changes from tim@nop.cx (more changes to follow shortly that cause changes elsewhere)
+20080416
+	fix emu/Nt/os.c use of wrong name for null value
+	move win/win-x11a references to emu/*/emu config files from emu/*/mkfile
+20080415
+	googlecode update with correct dis files for acme
+	tidier code for hoststderr
+	emu/port/win-x11a.c changes that attempt to satisfy libxcb's locking requirements
+20080322
+	enable hoststderr, following acme-sac
+20080319
+	ip/sntp neither read nor set the time correctly
+20080311
+	in appl/lib/names.b define "" as valid prefix for anything
+20080304
+	auth/secstore uses dial module
+20080210
+	add auth/dsagen
+20080204
+	emu/*/*ipif*.c and devip.c: try to allow local address to be set (changes so_bind signature in emu/ip.h)
+20080201
+	change foldbranch in limbo/gen.c to prevent loss of `no return value' diagnostics
+20080131
+	update emu/Nt/^(os.c ie-os.c ie-win.c ie emu), but properly this time [issue 81]
+	remove _USE_32BIT_TIME_T from Nt/386/include/lib9.h, and time() def'n from emu/Nt/*.c [issue 81]
+20080130
+	failed to return nil from Jvalue.get in appl/lib/json.b if member name didn't match
+	similar problem in appl/lib/ubfa.b
+	add msgio(2)
+20080124
+	fix emu/port/devssl.c os/port/devssl.c not to keep the directory numbers(!)
+20080122
+	update appl/lib/db.b: allow for split i/o on pipes or tcp/ip; eliminate lock process
+	eliminate more unused identifier warnings (courtesy acme-sac)
+20080121
+	skip trailing '=' in b64 rep of IPint
+20080120
+	forgot to push updated appl/lib/x509.b during keyring changes
+20080116
+	add rsa to factotum
+	set but not used changes from Acme-sac
+	mdb(1) changes from Acme-sac
+	ftpfs uses new dial(2)
+	add qbypass to emu/port/qio.c
+	sed fix issue 49
+	add blowfish to keyring-crypt(2)
+	add challenge/response to factotum(2)
+20080115
+	add blowfish to keyring (not yet documented)
+	add explicit public and private key types to keyring (in development: not yet documented)
+	add IPint.mod, IPint.iptob64z
+20080111
+	add newuser to newns(2)
+20080109
+	Sys->iounit should accept any valid file descriptor, not just ORDWR
+20071227
+	add styxflush(2) etc.
+	add NetBSD, emu/NetBSD
+20071217
+	emu/port/devmnt.c needs volatile for alloc
+20071213
+	emu/port/dev.c needs volatile for alloc
+20071129
+	emu/port/devip.c: moan about bad IP addresses
+20071127
+	added /module/dial.m and /appl/lib/dial.b
+20071031
+	module/keyring.m and libinterp/keyring.c: add algorithm-specific adts for public key systems
+	appl/lib/spki/spki.b: correct names for dsa parameters
+20071030
+	libkeyring/rsaalg.c should call rsaprivfree not free
+20071027
+	appl/lib/names.b correction for "/" as prefix
+20071019
+	change emu/port/devfs-posix.c to update uid/gid map incrementally
+20071015
+	add cap creation to infauth in server role in factotum
+20071011
+	remove obsolete references to sh-exception(2)
+20071010
+	add abhey's changes for cmd key as unicode compose key for MacOS X to emu/MacOSX/win.c
+20071008
+	nemo's change to emu/port/random.c; really the file needs a little rewriting for clarity (too many overlapping states)
+20071002
+	ensure fmtdef.h included by some lib9 functions so that va_copy is defined on older systems that lack that needless notion
+	<{} and >{} added to sh(1)
+20070929
+	move emu/MacOSX/mkfile to .../mkfile-x11 and replace it by the variant that builds for Carbon, now the default
+20070927
+	add working drawcursor to emu/MacOSX/win.c, based on mirtchovski's changes (but mapping general cursor images to Mac's form)
+20070910
+	update spki(2) [change handling of hashes, add signature functions] appl/lib/spki/spki.b module/spki.m, updated for GSoC
+20070906
+	add toreal to string(2)
+20070905
+	/appl/cmd/ed.b (caerwyn's fix for g/.../d)
+	also /appl/lib/ecmascript/builtin.b (toupper fix)
+20070902
+	make /appl/lib/daytime.b accept Daytime->text's output; add string2tm to man page (issue 59)
+20070901
+	add andrey's changes to emu/MacOSX/win.c (used by emu/MacOSX/mkfile-a)
+	add saoret's changes to dis/lookman, dis/man (issue 58)
+	add micah.stetson's change to /appl/cmd/src.b (issue 57)
+20070817
+	two old changes that weren't in the distribution...
+	libkeyring/rsaalg.c: previously failed to ensure the output key was the right length (really rsagen should do that)
+	libinterp/alt.c: use a better random number generator
+20070814
+	bufio.b didn't update the buffer pointers correctly on write errors
+20070807
+	libinterp/keyring.c don't include owner= if owner is nil or ""
+	add auth/rsagen
+20070806
+	/module/lists.m add PATH(!), also simplify concat implementation
+20070725
+	/dis/man initialise fils correctly to empty list and remove hack (issue 56)
+20070720
+	utils/5l/asm.c: ensure SBZ field in MOV is regarded as MBZ (ie, force to zero)
+20070714
+	add Sys->readn, update sys-read(2)
+	copy two repairs from emu/port/inferno.c to os/port/inferno.c
+	remove readn implementation from several commands
+	print correct diagnostic in appl/cmd/crypt.b
+	prevent window titlebars from being dragged out of the main window in wm/wm.b
+20070619
+	remembered to include /appl/cmd/trfs.b /dis/trfs.dis
+20070614
+	/appl/lib/venti.b bug fixes, a few more errstrs, remove prints to stderr
+	add initial module/vac.m appl/lib/vac.b from mjl (gsoc project ventivac)
+	add initial /appl/cmd/^(vacfs.b vacget.b vacput.b) /man/4/vacfs /man/1/vacget from mjl (gsoc:ventivac)
+	include omitted man/mkfile man/lib
+20070608
+	update /lib9 functions to use silly va_copy (and then va_end) instead of just assigning, to account for silly C implementations
+	change /appl/cmd/mc.b not to require Draw or Env (so lc works on smaller systems)
+	update acme to include the font size data (eg, for use by mc(1))
+20070607
+	/appl/wm/man.b /appl/lib/man.b to allow 10.1 etc as section references
+20070605
+	add another xopen #define to lib9.h includes for Linux
+	copy plan9 acme's colormix
+20070601
+	/appl/cmd/ls.b /dis/ls.dis /man/1/ls: document new -F option and -T option
+	/appl/cmd/auth/factotum/factotum.b: ignore empty writes, don't fail; make a few diagnostics match plan 9
+	rename /appl/cmd/mc.b to /appl/cmd/calc.b; also /man/1/mc to /man/1/calc; /dis/mc.dis to /dis/calc.dis
+	add /appl/cmd/mc.b (initial version)
+	replace /dis/lc.dis by /dis/lc; remove /appl/cmd/lc.b
+	remove /appl/cmd/mathcalc.b /dis/mathcalc.dis /man/1/mathcalc
+20070510
+	quickly remove references to udp's "oldheaders" because plan 9 removed it
+	remove obootpd completely
+20070418
+	add scan code to X11 (issue 45)
+20070411
+	if mkconfig has been changed from the distribution, use it to set parameters in makemk.sh (issue 41)
+	add iso8859-15 (what? will the line stretch on to the crack of doom?) (issue 43)
+20070410
+	fix some porting errors in /appl/cmd/look.b
+	document look's -r option in look(1)
+20070407
+	/os/port/^(portdat.h lib.h portfns.h xalloc.c) compatiblity changes with plan 9
+	/os/pc ether drivers updated to match plan 9, and os/ip (and a few files in /os/port) also updated, including removing some unreachable code
+	/os/ip/tcp.c changes from plan 9 for out-of-sequence segments
+20070319
+	emu/port/devsrv.c and os/port/devsrv.c delete wc at correct time
+20070312
+	rename -D and -k options to plumb (old ones still accepted); add -i option to take data from standard input; update man page
+	enable 64-bit seeks in /emu/Nt/devfs.c
+20070302
+	change /mkfile to build yacc earlier, mainly to make bootstrap of a new host easier (makemk.sh and mk install)
+	change /utils/mkfile not to build k[acl] and q[acl] on Plan 9, since the system ones are the same
+20070228
+	make array bounds checking the default for on-the-fly compilers (emu/port/main.c)
+	improve wording in security-ssl(2) and ssl(3)
+20070227
+	/include/fcall.h: ensure unsigned promotion to counter ansi sign-extending rules for GBIT64
+	/libmemdraw/draw.c: copy fix to memfillcolor
+20070220
+	add 0x92 as chip ID for ether91c111.c
+20070217
+	repair /appl/lib/libc.b and /appl/lib/libc0.b strncmp implementations (used only by c2l output) [inferno-os issue 9]
+	/emu/port/devip.c, get socket fd on reopen of ctl
+	/appl/acme/exec.b, trim string correctly [inferno-os issue 11]
+20070216
+	add /module/lists.m, /appl/lib/lists.b, and lists(2)
+20070209
+	remove debugging -d option to exportfs call in emu/Plan9/devsrv9.c(!)
+20070206
+	/appl/svc/auth.sh: replace exit by raise
+	/man/2/styxservers: document replychan and replydirect
+20070201
+	update US timezone files to save energy
+20070131
+	add /appl/lib/convcs/utf16_btos.b, utf16_stob.b etc [rog]
+20070130
+	fix wording in some of the licence files (eg, remove references to old liberal licence)
+20070123
+	check lengths properly in devenv.c
+	move all of doc into lib/proto/inferno from lib/proto/src
+20070122
+	add doc/port.ms, doc/port.pdf to src proto.  add brief instructions for source rebuild to port.ms
+20070118
+	add json(2) {/appl/lib/json.b, /module/json.m, /dis/lib/json.dis} for RFC4627 notation [json(6)]
+20070117
+	remove duplicate libmp/libsec reference from /mkfile (i assume it wasn't necessary to visit them twice!)
+20070116
+	move Man from /dis/man.dis (which vanished a few changes ago) to /dis/lib/man.dis.  honestly.  wm/man works again.
+20070114
+	remove some unused static declarations in /utils/mk/shprint.c
+20070111
+	delete drawxflush from devdraw.c (call drawq(un)?lock instead)
+20070107
+	have emu (/emu/port/main.c) check environment variables INFERNO and ROOT before EMU and -r, for inferno root directory
+		(haven't yet changed the build system and mkfiles to match)
+	remove /include/libcrypt_o.h since the library isn't used
+	add complete(2)
+20070103
+	replace man.dis by Salva Peiró's sh version of plan 9's man script
+20061221
+	add data2c to Irix package prototype
+	remove unwanted .dis/.sbl files from /appl packages
+	change liblogfs to GPLv2 from proprietary, to fit google code
+	correct cmd(3) to account for new stderr file
+20061219
+	cmd(3) and thus os(1) change to separate standard output and error streams
+	all /emu/*/cmd.c change to account for that (original changes to devcmd.c and MacOSX/cmd.c courtesy Cibernet)
+20061215
+	replaced things like <???> because gcc annoyingly whines even with 1950's trigraphs off
+	libtk/textu.c: uninitialised field in boundary case
+	libtk/textw.c: possibly uninitialised value; leave unchanged
+	utils/ql/l.h: uchar as to ushort, because of extra ops
+20061214
+	added fopen to xml.m to allow bufio->sopen and others to be used
+20061213
+	added MacOSX/386 components
+20061013
+	updated /os/ip/lookbackmedium.c and /os/ip/rudp.c
+20061021
+	change /os/port/exportfs.c to allow negotiating up to 64k msize
+	(matching /emu/port/exportfs.c)
+20060809
+	/appl/lib/newns.b uses String->unquoted, if it can load it
+20060803
+	/libtk/textw.c: default page up/down scrolls 0.75 of a page (to give context); also allows fractional value
+20060801
+	/utils/data2s/data2s.c: allocate at least one linker byte to empty files to avoid complaints
+20060715
+	/appl/lib/pop3.b remove defaultserver(); update pop3(2) to remove references to /services
+	similarly update smtp(2)
+	avoid some boundary cases in /appl/charon/^(build.b layout.b)
+20060625
+	added caerwynj@gmail.com changes to /appl/acme/acme/mail/src/Mailpop3.b
+20060622
+	/appl/lib/sets*.b: correct op's implementation of 2r1101
+20060613
+	added csv(2), /module/csv.m, /appl/lib/csv.b
+20060608
+	preliminary rfc822(2), /appl/lib/rfc822.b
+20060605
+	/appl/lib/chanfill.b: remove alt => *
+20060601
+	fix /appl/lib/dis.b to save the real array once read in
+20060526
+	/appl/lib/venti.b: fix g64's byte ordering [not that it is, or can be called yet]
+20060524
+	copy end fix to lib*/utfecpy.c
+20060523
+	w3c-uris(2): add a .copy() operation
+20060518
+	/Nt/386/include/lib9.h define _USE_32BIT_TIME_T and deprecate `deprecated' warnings
+20060504
+	remove use of HEAP_ALIGN from /*/port/devprof.c; change Heap.pad to Heap.hprof in /include/interp.h
+20060426
+	correct text and selection colours in wm/sh for loss-of-focus and holding modes
+20060423
+	add /appl/lib/w3c/uris.b w3c-uris(2) /module/uris.m
+20060419
+	/emu/port/devcmd.c: correct wakeup state for started command
+20060412
+	/appl/svc/webget	include caerwyn's changes
+20060411
+	put `|| exit 1' after each (command-list) in the mkfiles, just for bash
+20060410
+	/appl/cmd/limbo/typecheck.b /limbo/typecheck.c - stop wrong warning wrt use of ref fn
+20060313
+	remembered to install cddb port from last year... cddb(7)
+20060312
+	/emu/Nt/win.c; #define windows names out of the way to remove IPoint etc
+	/emu/Nt/os.c, simplify osblock/osready and eliminate erendezvous
+	/emu/port/devcons.c, tug into line with /os/port, to prepare for single-window changes
+	echo ^U on CAN (ctrl-U)
+20060311
+	replace Limbo version of shutdown by sh script; it's still a bit silly
+20060309
+	/*/port/inferno.c: 0 or -1 return value from dial functions
+	/os/port/portmkfile: remove reference to ../kfs
+	/man/8/httpd document -a; /appl/svc/httpd/httpd.b
+	/libmp/port/mptouv.c sign extension fix from 9
+	/module/keyring.m, /libinterp/ipint.c: add some bitwise operators
+	change (undocumented) /appl/cmd/test.b so that `host' mkfiles will work in Inferno
+		should probably change the mkfiles to replace it
+20060303
+	/emu/Plan9/win.c replace ldepthof
+20060302
+	add KPX11 flag to hosted kproc to boost the stack for silly x11 & co.
+	put keyboard and cursor processing into a separate kproc with big stack in /emu/port/win-x11a.c
+	change various os.c to match
+20060301
+	/appl/cmd/rioimport.b fix initialisation race
+20060227
+	fix /utils/ql/l.h: oprange should be [ALAST] (with extra 405xx opcodes), also AEND->ALIST elsewhere
+	put faster gethunk in ql and kl (mimic other compilers)
+20060226
+	enable /emu/port/devpointer.c, with changes to /emu/*/win*.c to call mousetrack, /emu/port/main.c to bind #m,
+		and code for pointer and cursor removed from devcons.c
+	update Nt/win.c and port/win-x11a.c from drawterm to get/put host snarf buffer
+	change devmem.c from #m to #% not to clash with pointer
+20060225
+	add /emu/port/devsnarf.c (#^) and put clipread from drawterm in /emu/Nt/win.c
+20060224
+	modify /appl/lib/secstore.b, /module/secstore.m, secstore(2) [add dial, auth, mkseckey, mkfilekey, remove]
+	add /appl/cmd/auth/secstore.b, secstore(1)
+	remove strange exception handling in /appl/cmd/dd.b
+	add dhcpclient(2)
+20060223
+	add /appl/cmd/auth/aescbc.c
+	add /appl/cmd/crypt.b [rog]
+	add crypt(1)
+	add /appl/lib/secstore.b /module/secstore.m secstore(2)
+20060221
+	/libsec/port/hmac.c: treat existing but not seeded digest correctly
+	/libinterp/ipint.c, /module/keyring.m, add new operator `invert'
+20060220
+	add ida(2), /appl/lib/ida, /module/ida.m
+20060216
+	add ubfa(2), ubfa(6), /module/ubfa.m, /appl/lib/ubfa.b
+20060214
+	[rog] add cursor changing support to tk, wm, wmlib (eg, for acme)
+20060213
+	remove libcrypt_o from distribution
+20060211
+	add /man/1/9win [rog]
+	change /appl/cmd/auth/keyfs.b to confirm key only when creating the file [rog]
+	punt floating-point conversions in powerpc jit on macos for time being
+		(have particular values in certain FP registers when native)
+20060210
+	update /libmemdraw/draw.c to include 9's changes for concurrent use
+	remove canlock as assembly language interface, replaced by _tas
+	replace native use of tas by _tas; make declarations all agree
+	add holdon/holdoff ctl request to wm/sh
+	wmproxy in appl/lib/wmlib.b does not create new pgrp
+20060206
+	update /appl/cmd/cp.b with digbyt's changes (mode/uid/gid correct on copied directories)
+20060203
+	update /appl/cmd/ip/dhcp.b /appl/cmd/lib/dhcpclient.b
+	update /os/init/i4e.b to use it
+	add /man/8/dhcp
+20060118
+	add ksize(10.1), kstrip(10.1), /utils/kstrip
+	new _MAGIC definitions in utils/libmach/a.out.h
+20060114
+	change /os/boot/arm1110 mkfile to work on unix and windows; add to /lib/proto/os
+20060111
+	-s (exportonly) -x/-y (geometry) options to 9win (TODO: rog, manual page!)
+	wm/sh.b: correct hold mode; remove little-used and undocumented history file
+20060109
+	delete #pragma from flate.h
+	ensure lib9 compiles replacement sbrk for MacOSX
+20060106
+	update compilers
+	update compilers' manual page
+	fix os/port/portmkfile for Plan 9: don't use $OBJDIR but Inferno/$OBJTYPE
+	have os/port/portmkfile check for i$CONF.p9 and use that not i$CONF for acid
+	add srclist(10.1)
+20060105
+	account for new definition of rendezvous (void* not ulong)
+	add dummy setmalloctag to utils where needed (for Plan 9)
+	set profileflg only for ATEXT in utils/?c/txt.c
+	update /os/boot/pc
+20060103
+	/os/ip updated from Plan 9
+	/os/ip/^(bootp.c dhcp.c ihbootp.c) changed to use announce not connect for udp
+20051215
+	/man/6/keytext added
+20051207
+	/tools/odbc.c portability changes, and fix modes on several files
+20051202
+	/emu/Plan9/devfs.c strip Inferno root from file system diagnostics
+20051130
+	change /appl/svc/httpd to use lock(2) not lockprocs
+20051123
+	/appl/cmd/bind.b changed not to use arg.dis, implement -q, and diagnostic change
+	/appl/cmd/mount.b acquired a -q option as well
+20051114
+	avoid limit==0 in wm/memory.b
+20051108
+	have poolmaxsize return 0 for pool of size 0
+	remove /os/*/u.h (in favour of /$SYSTARG/$OBJTYPE/include/u.h)
+	update mkfiles accordingly
+	adjust mkfiles for libsec and libmp compilation for native kernels
+20051107
+	added /os/manga
+20051101
+	fixed /os/port/devloopback.c
+	updated netif.c netif.h
+20051028
+	updated gettar(1) and /appl/cmd/gettar.b
+20051025
+	fix British Summer Time in locales
+20051021
+	updated /appl/lib/newns.b and namespace(6) for environment variable substitution
+20051018
+	moved in changes from home to os/port: cis.c devbridge.c ethermii.c portclock.c devuart.c devbench.c random.c portfns.h tod.c uart.h
+	- mainly for changes to implement fasttick and timers
+20051017
+	/limbo/ecom.c and /appl/cmd/limbo/ecom.c: ensure src set in temporary Node to avoid `no file specified' in sbl.[bc]
+20050925
+	added format(2)
+20050922
+	iostats(4) added
+20050919
+	improve behaviour in wm/sh when in raw mode
+20050916
+	/appl/lib/styx.b: return value for Rmsg.unpack for Rstat didn't include len[2]
+20050912
+	update /appl/lib/disks.b, disks(2)
+	update /appl/cmd/disk/format.b
+	add /appl/cmd/disk/prep, /appl/cmd/disk/mbr.b
+	replace format(8) by prep(8)
+	delete undocumented /appl/cmd/disk/part.b
+20050908
+	added disks(2) and scsiio(2)
+20050906
+	os/port/devsrv.c and emu/port/devsrv.c to allow setting length by wstat (also DMAPPEND)
+	appl/cmd/dossrv.b fix to interpret aname:offset
+	usb updated to support current native uhci drivers
+	/appl/lib/usb/usbmass.b changed to work with new driver and more devices
+20050901
+	new /appl/cmd/ip/sntp.b, sntp(8)
+20050824
+	cp(1): added -gux options
+20050810
+	mangaload(8): new
+20050812
+	/appl/cmd/limbo/nodes.b didn't always initialise n.c (eg, a != a)
+20050712
+	updated utils/[12][acl] to match Plan 9's
+20050627
+	added streamcp (renamed fcp since that's what plan 9 calls a similar thing)
+20050626
+	added write lock to emu/port/devip.c to stop Linux (and perhaps others) splitting socket writes by different processes
+20050620
+	added w3c-xpointers(2) [/module/xpointers.m; /appl/lib/w3c/xpointers.b]
+20050617
+	fixed qid array reference in /appl/cmd/lockfs.b [cjones83]
+20050610
+	updated lib/ndb/dns
+	fixed count < 0 when reading beyond end of file in disk/kfs
+20050526
+	fixed factotum's p9any to use user= attribute in key not /dev/user
+	fix /appl/lib/daytime.b's handling of dlpairs; also read /env/timezone if that's there
+	update /appl/lib/w3c/css.b to read CSS2.1
+	add w3c-css(2); possibly should move module file to w3c/css.m?
+20050518
+	added GPL/LGPL notice files
+	made single mk.b from many included source files
+	added MIT-template or LGPL NOTICE files to lib* directories
+	updated doc/port.ms
+	included libmp and libsec in lib/proto/src (Lucent Public License), not yet used
+	fix bug in cmd(3) introduced by killonclose
+20050425
+	add sexprs(6)
+	add truerand/ntruerand and nsec[defined as osnsec] to lib9.h
+	redefine fmax and log2 in lib9.h
+	some/all FreeBSD-5.x-y don't initialise rfork_thread's procmask from parent (contrary to docs); compensate in FreeBSD/os.c
+	finally copy last year's changes to 1c from home
+	call logs->init in applylog
+	changed /appl/cmd/cmp.b to work correctly for differing buffer sizes, errors, etc.
+	included /os/pc/sd53c8xx.[in] and added /utils/na [not compiled by default]
+	mask off OEXCL in (emu/port os/port)^/sysfile.c:/^kcreate's openmode
+	wm/sh.b: keep menuitem 0 if noscroll selected
+	added units(1)
+20050413
+	licence following MIT-template replaces `free for all' instances
+	"-N nice" option in os(1)
+	geodesy(2) is new
+	ebook(1) is newly released (Open Ebook browser)
+	wm-sh(1) has a rearranged menu, with scroll/noscroll option added
+	/doc/asm.ms has been updated
+	section 10 has been updated
+	limbo compiler will make simple functions inline if possible
+	limbo compiler supports `ref fn' type
+	/doc/limbo/addendum.ms [also .ps .pdf] updated to reflect `ref fn' and other changes
+	keyring-ipint(2) has a few new operations (shl, shr, copy)
+	DigestState has new copy operation replacing cloneDigestState
+	Keyring has new functions certtoattr, pktoattr and sktoattr each returning
+		a string containing attr=value ... representations of certificates and keys
+	u.h has been updated for all platforms, hosted and native
+		new ptrint, u8int, u16int, u64int, FPdbleword, and more accurate varargs for < 4 byte values
+	lib9.h has extra encode/decode functions moved from libcrypt
+	string.m has new quotec function [TODO: man page]
+	crypt/ssl3.b handles a particular certificate type better
+	charon has several bug fixes in javascript, notably parsing of certain expressions
+	/doc/descent/* `Descent into Limbo' updated
+	internally libinterp uses a different representation for parts of the linkage table
+	/doc/lprof.ms [also .ps and .pdf] gives overview of Limbo profiling
+	/doc/ebookimp.ms [also .ps and .pdf] discusses implementation of its XML browsing
+	/doc/compiler.ms has been updated
+	/doc/dis.ms  eclr has been removed
+	emu(1) -b enables bounds checking in JIT
+	cs(8) handles general query (!attr=val ...)
+	mkfs/mkext(8) handles big archives
+	emuinit tries sh -c on command if not immediately dis
+	/appl/lib/string.b: rewritten unquoted for correct handling of embedded quotes
+	limbo warns about unused local variables
+	limbo: -F enables new implementation of function ref
+	limbo: -O runs optimiser
+	mount -9 uses 9fs not styx as service address
+	cmd(3) adds "killonclose" and parameter to "nice"
+	TODO: group check in styxserver
+	styxlisten accumulates algs correctly
+	os/port/mkdevc builds vgacursor table
+	touch uses OEXCL
+	/appl/lib/debug knows about ref fn
+	ecmascript: for(... in ...) parsed correctly
+	getuserpasswd added to factotum(2)
+	/appl/lib/print reincorporated
+	wm/clock
+	ftpfs calls factotum (getuserpasswd)
+	hoststdin/hoststdout/hoststderr [preliminary]
+	/os/boot/pc updated, as is its shipping list
+20041217
+	base point

+ 0 - 0
DragonFly/386/bin/.dreg


+ 30 - 0
DragonFly/386/include/emu.h

@@ -0,0 +1,30 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+typedef struct FPU FPU;
+struct FPU
+{
+	uchar	env[28];
+};
+
+#define KSTACK (32 * 1024)
+
+static __inline Proc *getup(void) {
+	Proc *p;
+	__asm__(	"movl	%%esp, %%eax\n\t"
+			: "=a" (p)
+	);
+	return *(Proc **)((unsigned long)p & ~(KSTACK - 1));
+};
+
+#define	up	(getup())
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)
+

+ 76 - 0
DragonFly/386/include/fpuctl.h

@@ -0,0 +1,76 @@
+/*
+ * Linux 386 fpu support
+ * Mimic Plan9 floating point support
+ */
+
+static void
+setfcr(ulong fcr)
+{
+	__asm__(	"xorb	$0x3f, %%al\n\t"
+			"pushw	%%ax\n\t"
+			"fwait\n\t"
+			"fldcw	(%%esp)\n\t"
+			"popw	%%ax\n\t"
+			: /* no output */
+			: "al" (fcr)
+	);
+}
+
+static ulong
+getfcr(void)
+{
+	ulong fcr = 0;
+
+	__asm__(	"pushl	%%eax\n\t"
+			"fwait\n\t"
+			"fstcw	(%%esp)\n\t"
+			"popl	%%eax\n\t"
+			"xorb	$0x3f, %%al\n\t"
+			: "=a"  (fcr)
+			: "eax"	(fcr)
+	);
+	return fcr; 
+}
+
+static ulong
+getfsr(void)
+{
+	ulong fsr = -1;
+
+	__asm__(	"fwait\n\t"
+			"fstsw	(%%eax)\n\t"
+			"movl	(%%eax), %%eax\n\t"
+			"andl	$0xffff, %%eax\n\t"
+			: "=a"  (fsr)
+			: "eax" (&fsr)
+	);
+	return fsr;
+}
+
+static void
+setfsr(ulong fsr)
+{
+	__asm__("fclex\n\t");
+}
+
+/* FCR */
+#define	FPINEX	(1<<5)
+#define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
+#define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
+#define	FPRNR	(0<<10)
+#define	FPRZ	(3<<10)
+#define	FPRPINF	(2<<10)
+#define	FPRNINF	(1<<10)
+#define	FPRMASK	(3<<10)
+#define	FPPEXT	(3<<8)
+#define	FPPSGL	(0<<8)
+#define	FPPDBL	(2<<8)
+#define	FPPMASK	(3<<8)
+/* FSR */
+#define	FPAINEX	FPINEX
+#define	FPAOVFL	FPOVFL
+#define	FPAUNFL	FPUNFL
+#define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL

+ 474 - 0
DragonFly/386/include/lib9.h

@@ -0,0 +1,474 @@
+/* define _BSD_SOURCE to use ISO C, POSIX, and 4.3BSD things. */
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+/* these aren't really needed because FreeBSD does the right thing and makes off_t 64 bits, full stop */
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <time.h>
+
+#define	getwd	infgetwd
+
+#define	round	infround
+#define	fmax	inffmax
+#define	log2	inflog2
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ */
+#define __LITTLE_ENDIAN
+
+#define	nil		((void*)0)
+
+typedef unsigned char	uchar;
+typedef signed char	schar;
+typedef unsigned long	ulong;
+typedef unsigned int Rune;
+typedef long long int	vlong;
+typedef unsigned long long int	uvlong;
+typedef unsigned int u32int;
+typedef uvlong u64int;
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+typedef signed char	int8;
+typedef unsigned char	uint8;
+typedef short	int16;
+typedef unsigned short	uint16;
+typedef int	int32;
+typedef unsigned int	uint32;
+typedef long long	int64;
+typedef unsigned long long	uint64;
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#undef nelem
+#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#undef assert
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * most mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+extern	int	nrand(int);
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	int	isInf(double, int);
+extern	double	pow(double, double);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+	
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	double	frexp(double, int*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+extern	double	ldexp(double, int);
+extern	double	modf(double, double*);
+#define	pow10	infpow10
+extern	double	pow10(int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+

+ 0 - 0
DragonFly/386/lib/.dreg


BIN
FreeBSD/386/bin/data2c


BIN
FreeBSD/386/bin/iyacc


BIN
FreeBSD/386/bin/mk


BIN
FreeBSD/386/bin/mkext


+ 30 - 0
FreeBSD/386/include/emu.h

@@ -0,0 +1,30 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+typedef struct FPU FPU;
+struct FPU
+{
+	uchar	env[28];
+};
+
+#define KSTACK (32 * 1024)
+
+static __inline Proc *getup(void) {
+	Proc *p;
+	__asm__(	"movl	%%esp, %%eax\n\t"
+			: "=a" (p)
+	);
+	return *(Proc **)((unsigned long)p & ~(KSTACK - 1));
+};
+
+#define	up	(getup())
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)
+

+ 76 - 0
FreeBSD/386/include/fpuctl.h

@@ -0,0 +1,76 @@
+/*
+ * Linux 386 fpu support
+ * Mimic Plan9 floating point support
+ */
+
+static void
+setfcr(ulong fcr)
+{
+	__asm__(	"xorb	$0x3f, %%al\n\t"
+			"pushw	%%ax\n\t"
+			"fwait\n\t"
+			"fldcw	(%%esp)\n\t"
+			"popw	%%ax\n\t"
+			: /* no output */
+			: "al" (fcr)
+	);
+}
+
+static ulong
+getfcr(void)
+{
+	ulong fcr = 0;
+
+	__asm__(	"pushl	%%eax\n\t"
+			"fwait\n\t"
+			"fstcw	(%%esp)\n\t"
+			"popl	%%eax\n\t"
+			"xorb	$0x3f, %%al\n\t"
+			: "=a"  (fcr)
+			: "eax"	(fcr)
+	);
+	return fcr; 
+}
+
+static ulong
+getfsr(void)
+{
+	ulong fsr = -1;
+
+	__asm__(	"fwait\n\t"
+			"fstsw	(%%eax)\n\t"
+			"movl	(%%eax), %%eax\n\t"
+			"andl	$0xffff, %%eax\n\t"
+			: "=a"  (fsr)
+			: "eax" (&fsr)
+	);
+	return fsr;
+}
+
+static void
+setfsr(ulong fsr)
+{
+	__asm__("fclex\n\t");
+}
+
+/* FCR */
+#define	FPINEX	(1<<5)
+#define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
+#define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
+#define	FPRNR	(0<<10)
+#define	FPRZ	(3<<10)
+#define	FPRPINF	(2<<10)
+#define	FPRNINF	(1<<10)
+#define	FPRMASK	(3<<10)
+#define	FPPEXT	(3<<8)
+#define	FPPSGL	(0<<8)
+#define	FPPDBL	(2<<8)
+#define	FPPMASK	(3<<8)
+/* FSR */
+#define	FPAINEX	FPINEX
+#define	FPAOVFL	FPOVFL
+#define	FPAUNFL	FPUNFL
+#define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL

+ 475 - 0
FreeBSD/386/include/lib9.h

@@ -0,0 +1,475 @@
+/* define _BSD_SOURCE to use ISO C, POSIX, and 4.3BSD things. */
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+/* these aren't really needed because FreeBSD does the right thing and makes off_t 64 bits, full stop */
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <time.h>
+
+#define	getwd	infgetwd
+
+#define	round	infround
+#define	fmax	inffmax
+#define	log2	inflog2
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ */
+#define __LITTLE_ENDIAN
+
+#define	nil		((void*)0)
+
+typedef unsigned char	uchar;
+typedef signed char	schar;
+typedef unsigned long	ulong;
+typedef unsigned int Rune;
+typedef long long int	vlong;
+typedef unsigned long long int	uvlong;
+typedef unsigned int u32int;
+typedef uvlong u64int;
+
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+typedef signed char	int8;
+typedef unsigned char	uint8;
+typedef short	int16;
+typedef unsigned short	uint16;
+typedef int	int32;
+typedef unsigned int	uint32;
+typedef long long	int64;
+typedef unsigned long long	uint64;
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#undef nelem
+#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#undef assert
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * most mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+extern	int	nrand(int);
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	int	isInf(double, int);
+extern	double	pow(double, double);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+	
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	double	frexp(double, int*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+extern	double	ldexp(double, int);
+extern	double	modf(double, double*);
+#define	pow10	infpow10
+extern	double	pow10(int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+

+ 86 - 0
INSTALL

@@ -0,0 +1,86 @@
+Installing hosted Inferno from source
+
+Overview
+
+     Like the native kernels  emu relies on  several  auxil-
+iary libraries (the source of which it often shares with the
+native kernels).  Emu itself is built by the  mkfile in the
+emu subdirectory containing the platform-specific source for
+the host platform.  Each library has its own    mkfile;  the
+various  components  are  made  in  the  right order by the
+mkfile at the root of the Inferno tree.   The    mkfile  for
+each  platform  will also invoke  mk recursively to make the
+appropriate libraries for a given configuration.
+
+     The Unix emu variant generally is  covered  by  `POSIX'
+(with  common  extensions)  but  each Unix port has one file
+that   differs   considerably   for   each   port,    namely
+emu/platform/os.c, the differences corresponding to the dif-
+ferent ways  under  Unix  of  implementing  kernel-scheduled
+threads efficiently.
+
+     There  are  working  emu  versions   for   FreeBSD/386,
+Irix/mips,  Linux/386, NetBSD/386, MacOSX/386, MacOSX/power,
+Plan 9, Solaris/sparc, and Windows (NT,  2000  and  Explorer
+plug-in).   Each platform typically uses mechanisms specific
+to the host operating system to implement Inferno's internal
+thread/process  structure.   POSIX  threads  have often been
+found to be insufficient (poorly implemented) on some  plat-
+forms, and if so are avoided.  See  kproc in  emu/*/os.c.
+
+     Source is included for ports to HP/UX  (S800  architec-
+ture),  Solaris/386, and Unixware, in case someone wishes to
+take them up now, but we have not determined their fitness.
+
+     The Plan 9 hosted implementation is unusual in that  it
+supports several processor types:  386,  mips,  power (Power
+PC) and  sparc.  Furthermore, all versions of   emu  can  be
+built on any processor type, in the usual way for Plan 9.
+
+     Otherwise, as distributed,  emu for a platform can only
+be built when running on that platform.
+
+     One unusual variant makes the whole of Inferno a  plug-
+in  for Microsoft's Internet Explorer, giving the same envi-
+ronment for Inferno applications running in an HTML page  as
+is  provided by hosted or native Inferno.  That is, there is
+not a distinct `applet' environment with special programming
+interfaces.   The  source for the various plug-in components
+is found in  /tools/plugin and    /usr/internet  within  the
+Inferno  tree;  they  use the version of  emu defined by the
+configuration file  /emu/Nt/ie.
+
+Build steps
+
+     All the libraries and executables can  be  built  in  a
+tree containing only the source code.  To do that for a sup-
+ported variant of hosted Inferno, on Unix or Plan 9, do  the
+following in the root of the Inferno tree:
+
+1    Edit    mkconfig  to  reflect  your  host  environment,
+     specifically  ROOT  (which  must  be  an  absolute path
+     name), SYSHOST and OBJTYPE.  The comments in  the  file
+     should help you choose.
+
+2    Run  makemk.sh to rebuild the   mk  command,  which  is
+     used to build everything else.
+
+3    Set  PATH (or  path on Plan 9)  to  include  the    bin
+     directory for the platform, which will now contain the
+     mk binary just built.  On Unix, export  PATH.
+
+4    Then  mk nuke to remove any extraneous object files.
+
+5    Finally,    mk  install  to  create  and  install   the
+     libraries,    limbo  compiler,  emu for hosted Inferno,
+     and auxiliary commands.  The rules do that in an  order
+     that ensures that the commands or libraries needed by a
+     later stage are built and installed first.  (Note  that
+     a  plain   mk will not suffice, because it does not put
+     the results in the search path.)
+
+Doing something similar  on  Windows  or  Plan  9  currently
+requires  the  executable  for    mk  to be available in the
+search path, since there is no  equivalent  of    makemk.sh.
+Otherwise  the procedure is the same.  On Plan 9, of course,
+the host system's normal version of  mk should be adequate.

+ 8 - 0
Inferno/386/include/lib9.h

@@ -0,0 +1,8 @@
+#include <u.h>
+#include <kern.h>
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define __LITTLE_ENDIAN	/* math/dtoa.c only */

+ 64 - 0
Inferno/386/include/u.h

@@ -0,0 +1,64 @@
+#define nil		((void*)0)
+typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef unsigned long	ulong;
+typedef unsigned int	uint;
+typedef   signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long uvlong;
+typedef unsigned long	uintptr;
+typedef	uint		Rune;
+typedef union FPdbleword FPdbleword;
+typedef long		jmp_buf[2];
+#define	JMPBUFSP	0
+#define	JMPBUFPC	1
+#define	JMPBUFDPC	0
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned char	u8int;
+typedef unsigned short	u16int;
+typedef unsigned int	u32int;
+typedef unsigned long long u64int;
+
+/* FCR */
+#define	FPINEX	(1<<5)
+#define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
+#define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
+#define	FPRNR	(0<<10)
+#define	FPRZ	(3<<10)
+#define	FPRPINF	(2<<10)
+#define	FPRNINF	(1<<10)
+#define	FPRMASK	(3<<10)
+#define	FPPEXT	(3<<8)
+#define	FPPSGL	(0<<8)
+#define	FPPDBL	(2<<8)
+#define	FPPMASK	(3<<8)
+/* FSR */
+#define	FPAINEX	FPINEX
+#define	FPAOVFL	FPOVFL
+#define	FPAUNFL	FPUNFL
+#define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL
+union FPdbleword
+{
+	double	x;
+	struct {	/* little endian */
+		ulong lo;
+		ulong hi;
+	};
+};
+
+typedef	char*	va_list;
+#define va_start(list, start) list =\
+	(sizeof(start) < 4?\
+		(char*)((int*)&(start)+1):\
+		(char*)(&(start)+1))
+#define va_end(list)\
+	USED(list)
+#define va_arg(list, mode)\
+	((sizeof(mode) == 1)?\
+		((mode*)(list += 4))[-4]:\
+	(sizeof(mode) == 2)?\
+		((mode*)(list += 4))[-2]:\
+		((mode*)(list += sizeof(mode)))[-1])

+ 25 - 0
Inferno/386/include/ureg.h

@@ -0,0 +1,25 @@
+struct Ureg
+{
+	ulong	di;		/* general registers */
+	ulong	si;		/* ... */
+	ulong	bp;		/* ... */
+	ulong	nsp;
+	ulong	bx;		/* ... */
+	ulong	dx;		/* ... */
+	ulong	cx;		/* ... */
+	ulong	ax;		/* ... */
+	ulong	gs;		/* data segments */
+	ulong	fs;		/* ... */
+	ulong	es;		/* ... */
+	ulong	ds;		/* ... */
+	ulong	trap;		/* trap type */
+	ulong	ecode;		/* error code (or zero) */
+	ulong	pc;		/* pc */
+	ulong	cs;		/* old context */
+	ulong	flags;		/* old flags */
+	union {
+		ulong	usp;
+		ulong	sp;
+	};
+	ulong	ss;		/* old stack segment */
+};

+ 8 - 0
Inferno/arm/include/lib9.h

@@ -0,0 +1,8 @@
+#include <u.h>
+#include <kern.h>
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define __LITTLE_ENDIAN /* math/dtoa.c */

+ 65 - 0
Inferno/arm/include/u.h

@@ -0,0 +1,65 @@
+#define nil		((void*)0)
+
+typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef	unsigned long	ulong;
+typedef	unsigned int	uint;
+typedef	signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long uvlong;
+typedef	uint		Rune;
+typedef 	union FPdbleword FPdbleword;
+typedef long	jmp_buf[2];
+#define	JMPBUFSP	0
+#define	JMPBUFPC	1
+#define	JMPBUFDPC	0
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned char u8int;
+typedef unsigned short u16int;
+typedef unsigned int	u32int;
+typedef unsigned long long u64int;
+typedef unsigned long uintptr;
+
+/* FCR */
+#define	FPINEX	(1<<20)
+#define	FPUNFL	(1<<19)
+#define	FPOVFL	(1<<18)
+#define	FPZDIV	(1<<17)
+#define	FPINVAL	(1<<16)
+#define	FPRNR	(0<<0)
+#define	FPRZ	(1<<0)
+#define	FPRPINF	(2<<0)
+#define	FPRNINF	(3<<0)
+#define	FPRMASK	(3<<0)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+/* FSR */
+#define	FPAINEX	(1<<4)
+#define	FPAUNFL	(1<<3)
+#define	FPAOVFL	(1<<2)
+#define	FPAZDIV	(1<<1)
+#define	FPAINVAL	(1<<0)
+union FPdbleword
+{
+	double	x;
+	struct {	/* little endian (on VFP and now in software) */
+		ulong lo;
+		ulong hi;
+	};
+};
+
+typedef	char*	va_list;
+#define va_start(list, start) list =\
+	(sizeof(start) < 4?\
+		(char*)((int*)&(start)+1):\
+		(char*)(&(start)+1))
+#define va_end(list)\
+	USED(list)
+#define va_arg(list, mode)\
+	((sizeof(mode) == 1)?\
+		((mode*)(list += 4))[-4]:\
+	(sizeof(mode) == 2)?\
+		((mode*)(list += 4))[-2]:\
+		((mode*)(list += sizeof(mode)))[-1])

+ 24 - 0
Inferno/arm/include/ureg.h

@@ -0,0 +1,24 @@
+typedef struct Ureg {
+	uint	r0;
+	uint	r1;
+	uint	r2;
+	uint	r3;
+	uint	r4;
+	uint	r5;
+	uint	r6;
+	uint	r7;
+	uint	r8;
+	uint	r9;
+	uint	r10;
+	uint	r11;
+	uint	r12;
+	union {
+		uint	r13;
+		uint	sp;
+	};
+	uint	r14;
+	uint	link;
+	uint	type;
+	uint	psr;
+	uint	pc;
+} Ureg;

+ 8 - 0
Inferno/mips/include/lib9.h

@@ -0,0 +1,8 @@
+#include <u.h>
+#include <kern.h>
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#undef __LITTLE_ENDIAN /* math/dtoa.c; longs in MIPS doubles are big-endian */

+ 65 - 0
Inferno/mips/include/u.h

@@ -0,0 +1,65 @@
+#define nil		((void*)0)
+typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef	unsigned long	ulong;
+typedef	unsigned int	uint;
+typedef	signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long uvlong;
+typedef unsigned long	uintptr;
+typedef	uint		Rune;
+typedef 	union FPdbleword FPdbleword;
+typedef long	jmp_buf[2];
+#define	JMPBUFSP	0
+#define	JMPBUFPC	1
+#define	JMPBUFDPC	0
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned char u8int;
+typedef unsigned short u16int;
+typedef unsigned int	u32int;
+typedef unsigned long long u64int;
+
+/* FCR */
+#define	FPINEX	(1<<7)
+#define	FPUNFL	(1<<8)
+#define	FPOVFL	(1<<9)
+#define	FPZDIV	(1<<10)
+#define	FPINVAL	(1<<11)
+#define	FPRNR	(0<<0)
+#define	FPRZ	(1<<0)
+#define	FPRPINF	(2<<0)
+#define	FPRNINF	(3<<0)
+#define	FPRMASK	(3<<0)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+/* FSR */
+#define	FPAINEX	(1<<2)
+#define	FPAOVFL	(1<<4)
+#define	FPAUNFL	(1<<3)
+#define	FPAZDIV	(1<<5)
+#define	FPAINVAL	(1<<6)
+union FPdbleword
+{
+	double	x;
+	struct {	/* big endian */
+		ulong hi;
+		ulong lo;
+	};
+};
+
+/* stdarg */
+typedef	char*	va_list;
+#define va_start(list, start) list =\
+	(sizeof(start) < 4?\
+		(char*)((int*)&(start)+1):\
+		(char*)(&(start)+1))
+#define va_end(list)\
+	USED(list)
+#define va_arg(list, mode)\
+	((sizeof(mode) == 1)?\
+		((mode*)(list += 4))[-1]:\
+	(sizeof(mode) == 2)?\
+		((mode*)(list += 4))[-1]:\
+		((mode*)(list += sizeof(mode)))[-1])

+ 4 - 0
Inferno/power/include/lib9.h

@@ -0,0 +1,4 @@
+#include <u.h>
+#include <kern.h>
+
+#undef __LITTLE_ENDIAN /* math/dtoa.c; longs in PowerPC doubles are big-endian */

+ 84 - 0
Inferno/power/include/u.h

@@ -0,0 +1,84 @@
+#define nil		((void*)0)
+typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef	unsigned long	ulong;
+typedef	unsigned int	uint;
+typedef	signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long uvlong;
+typedef unsigned long	uintptr;
+typedef	uint		Rune;
+typedef 	union FPdbleword FPdbleword;
+typedef long	jmp_buf[2];
+#define	JMPBUFSP	0
+#define	JMPBUFPC	1
+#define	JMPBUFDPC	0
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned char u8int;
+typedef unsigned short u16int;
+typedef unsigned int	u32int;
+typedef unsigned long long u64int;
+
+/* FPSCR */
+#define	FPSFX	(1<<31)	/* exception summary (sticky) */
+#define	FPSEX	(1<<30)	/* enabled exception summary */
+#define	FPSVX	(1<<29)	/* invalid operation exception summary */
+#define	FPSOX	(1<<28)	/* overflow exception OX (sticky) */
+#define	FPSUX	(1<<27)	/* underflow exception UX (sticky) */
+#define	FPSZX	(1<<26)	/* zero divide exception ZX (sticky) */
+#define	FPSXX	(1<<25)	/* inexact exception XX (sticky) */
+#define	FPSVXSNAN (1<<24)	/* invalid operation exception for SNaN (sticky) */
+#define	FPSVXISI	(1<<23)	/* invalid operation exception for ∞-∞ (sticky) */
+#define	FPSVXIDI	(1<<22)	/* invalid operation exception for ∞/∞ (sticky) */
+#define	FPSVXZDZ (1<<21)	/* invalid operation exception for 0/0 (sticky) */
+#define	FPSVXIMZ	(1<<20)	/* invalid operation exception for ∞*0 (sticky) */
+#define	FPSVXVC	(1<<19)	/* invalid operation exception for invalid compare (sticky) */
+#define	FPSFR	(1<<18)	/* fraction rounded */
+#define	FPSFI	(1<<17)	/* fraction inexact */
+#define	FPSFPRF	(1<<16)	/* floating point result class */
+#define	FPSFPCC	(0xF<<12)	/* <, >, =, unordered */
+#define	FPVXCVI	(1<<8)	/* enable exception for invalid integer convert (sticky) */
+#define	FPVE	(1<<7)	/* invalid operation exception enable */
+#define	FPOVFL	(1<<6)	/* enable overflow exceptions */
+#define	FPUNFL	(1<<5)	/* enable underflow */
+#define	FPZDIV	(1<<4)	/* enable zero divide */
+#define	FPINEX	(1<<3)	/* enable inexact exceptions */
+#define	FPRMASK	(3<<0)	/* rounding mode */
+#define	FPRNR	(0<<0)
+#define	FPRZ	(1<<0)
+#define	FPRPINF	(2<<0)
+#define	FPRNINF	(3<<0)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+#define	FPINVAL	FPVE
+
+#define	FPAOVFL	FPSOX
+#define	FPAINEX	FPSXX
+#define	FPAUNFL	FPSUX
+#define	FPAZDIV	FPSZX
+#define	FPAINVAL	FPSVX
+
+union FPdbleword
+{
+	double	x;
+	struct {	/* big endian */
+		ulong hi;
+		ulong lo;
+	};
+};
+
+typedef	char*	va_list;
+#define va_start(list, start) list =\
+	(sizeof(start) < 4?\
+		(char*)((int*)&(start)+1):\
+		(char*)(&(start)+1))
+#define va_end(list)\
+	USED(list)
+#define va_arg(list, mode)\
+	((sizeof(mode) == 1)?\
+		((mode*)(list += 4))[-1]:\
+	(sizeof(mode) == 2)?\
+		((mode*)(list += 4))[-1]:\
+		((mode*)(list += sizeof(mode)))[-1])

+ 43 - 0
Inferno/power/include/ureg.h

@@ -0,0 +1,43 @@
+struct Ureg
+{
+	ulong	cause;
+	union { ulong	srr1; ulong status;};
+	ulong	pc;	/* SRR0 */
+	ulong	pad;
+	ulong	lr;
+	ulong	cr;
+	ulong	xer;
+	ulong	ctr;
+	ulong	r0;
+	union{ ulong r1;	ulong	sp;	ulong	usp; };
+	ulong	r2;
+	ulong	r3;
+	ulong	r4;
+	ulong	r5;
+	ulong	r6;
+	ulong	r7;
+	ulong	r8;
+	ulong	r9;
+	ulong	r10;
+	ulong	r11;
+	ulong	r12;
+	ulong	r13;
+	ulong	r14;
+	ulong	r15;
+	ulong	r16;
+	ulong	r17;
+	ulong	r18;
+	ulong	r19;
+	ulong	r20;
+	ulong	r21;
+	ulong	r22;
+	ulong	r23;
+	ulong	r24;
+	ulong	r25;
+	ulong	r26;
+	ulong	r27;
+	ulong	r28;
+	ulong	r29;
+	ulong	r30;
+	ulong	r31;
+};

+ 9 - 0
Inferno/sparc/include/lib9.h

@@ -0,0 +1,9 @@
+#include <u.h>
+#include <kern.h>
+
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#undef __LITTLE_ENDIAN /* math/dtoa.c; longs in SPARC doubles are big-endian */

+ 64 - 0
Inferno/sparc/include/u.h

@@ -0,0 +1,64 @@
+#define nil		((void*)0)
+typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef	unsigned long	ulong;
+typedef	unsigned int	uint;
+typedef	signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long uvlong;
+typedef unsigned long	uintptr;
+typedef	uint		Rune;
+typedef 	union FPdbleword FPdbleword;
+typedef long	jmp_buf[2];
+#define	JMPBUFSP	0
+#define	JMPBUFPC	1
+#define	JMPBUFDPC	(-8)
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned char u8int;
+typedef unsigned short u16int;
+typedef unsigned int	u32int;
+typedef unsigned long long u64int;
+
+/* FCR */
+#define	FPINEX	(1<<23)
+#define	FPOVFL	(1<<26)
+#define	FPUNFL	(1<<25)
+#define	FPZDIV	(1<<24)
+#define	FPRNR	(0<<30)
+#define	FPRZ	(1<<30)
+#define	FPINVAL	(1<<27)
+#define	FPRPINF	(2<<30)
+#define	FPRNINF	(3<<30)
+#define	FPRMASK	(3<<30)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+/* FSR */
+#define	FPAINEX	(1<<5)
+#define	FPAZDIV	(1<<6)
+#define	FPAUNFL	(1<<7)
+#define	FPAOVFL	(1<<8)
+#define	FPAINVAL	(1<<9)
+union FPdbleword
+{
+	double	x;
+	struct {	/* big endian */
+		ulong hi;
+		ulong lo;
+	};
+};
+
+typedef	char*	va_list;
+#define va_start(list, start) list =\
+	(sizeof(start) < 4?\
+		(char*)((int*)&(start)+1):\
+		(char*)(&(start)+1))
+#define va_end(list)\
+	USED(list)
+#define va_arg(list, mode)\
+	((sizeof(mode) == 1)?\
+		((mode*)(list += 4))[-1]:\
+	(sizeof(mode) == 2)?\
+		((mode*)(list += 4))[-1]:\
+		((mode*)(list += sizeof(mode)))[-1])

+ 45 - 0
Inferno/sparc/include/ureg.h

@@ -0,0 +1,45 @@
+struct Ureg
+{
+	ulong	r0;			/* unnecessary; just for symmetry */
+	union{
+		ulong	sp;		/* r1 */
+		ulong	usp;		/* r1 */
+		ulong	r1;
+	};
+	ulong	r2;
+	ulong	r3;
+	ulong	r4;
+	ulong	r5;
+	ulong	r6;
+	ulong	r7;
+	ulong	r8;
+	ulong	r9;
+	ulong	r10;
+	ulong	r11;
+	ulong	r12;
+	ulong	r13;
+	ulong	r14;
+	ulong	r15;
+	ulong	r16;
+	ulong	r17;
+	ulong	r18;
+	ulong	r19;
+	ulong	r20;
+	ulong	r21;
+	ulong	r22;
+	ulong	r23;
+	ulong	r24;
+	ulong	r25;
+	ulong	r26;
+	ulong	r27;
+	ulong	r28;
+	ulong	r29;
+	ulong	r30;
+	ulong	r31;
+	ulong	y;
+	ulong	tbr;
+	ulong	psr;
+	ulong	npc;
+	ulong	pc;
+	ulong	pad;	/* so structure is double word aligned */
+};

+ 8 - 0
Inferno/spim/include/lib9.h

@@ -0,0 +1,8 @@
+#include <u.h>
+#include <kern.h>
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define __LITTLE_ENDIAN /* math/dtoa.c; longs in MIPS doubles are little-endian in LE mode */

+ 56 - 0
Inferno/spim/include/u.h

@@ -0,0 +1,56 @@
+#define nil		((void*)0)
+typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef	unsigned long	ulong;
+typedef	unsigned int	uint;
+typedef	signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long uvlong;
+typedef	uint		Rune;
+typedef 	union FPdbleword FPdbleword;
+typedef long	jmp_buf[2];
+#define	JMPBUFSP	0
+#define	JMPBUFPC	1
+#define	JMPBUFDPC	0
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned int	u32int;		/* for /sys/include/libsec.h */
+typedef unsigned char u8int;
+typedef unsigned short u16int;
+typedef unsigned long uintptr;
+
+/* FCR */
+#define	FPINEX	(1<<7)
+#define	FPUNFL	(1<<8)
+#define	FPOVFL	(1<<9)
+#define	FPZDIV	(1<<10)
+#define	FPINVAL	(1<<11)
+#define	FPRNR	(0<<0)
+#define	FPRZ	(1<<0)
+#define	FPRPINF	(2<<0)
+#define	FPRNINF	(3<<0)
+#define	FPRMASK	(3<<0)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+/* FSR */
+#define	FPAINEX	(1<<2)
+#define	FPAOVFL	(1<<4)
+#define	FPAUNFL	(1<<3)
+#define	FPAZDIV	(1<<5)
+#define	FPAINVAL	(1<<6)
+union FPdbleword
+{
+	double	x;
+	struct {	/* little endian */
+		ulong lo;
+		ulong hi;
+	};
+};
+
+/* stdarg */
+typedef char *va_list;
+#define va_start(list, start) list = (sizeof(start)<4 ? (char *)((int *)&(start)+1) : \
+(char *)(&(start)+1))
+#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
+#define va_end(list)

+ 8 - 0
Inferno/thumb/include/lib9.h

@@ -0,0 +1,8 @@
+#include <u.h>
+#include <kern.h>
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#undef __LITTLE_ENDIAN /* math/dtoa.c; longs in ARM doubles are big-endian */

+ 65 - 0
Inferno/thumb/include/u.h

@@ -0,0 +1,65 @@
+#define nil		((void*)0)
+
+typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef	unsigned long	ulong;
+typedef	unsigned int	uint;
+typedef	signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long uvlong;
+typedef	uint		Rune;
+typedef 	union FPdbleword FPdbleword;
+typedef long	jmp_buf[2];
+#define	JMPBUFSP	0
+#define	JMPBUFPC	1
+#define	JMPBUFDPC	0
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned char u8int;
+typedef unsigned short u16int;
+typedef unsigned int	u32int;
+typedef unsigned long long u64int;
+typedef unsigned long uintptr;
+
+/* FCR */
+#define	FPINEX	(1<<20)
+#define	FPUNFL	(1<<19)
+#define	FPOVFL	(1<<18)
+#define	FPZDIV	(1<<17)
+#define	FPINVAL	(1<<16)
+#define	FPRNR	(0<<0)
+#define	FPRZ	(1<<0)
+#define	FPRPINF	(2<<0)
+#define	FPRNINF	(3<<0)
+#define	FPRMASK	(3<<0)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+/* FSR */
+#define	FPAINEX	(1<<4)
+#define	FPAUNFL	(1<<3)
+#define	FPAOVFL	(1<<2)
+#define	FPAZDIV	(1<<1)
+#define	FPAINVAL	(1<<0)
+union FPdbleword
+{
+	double	x;
+	struct {	/* big endian (on 7500) */
+		ulong hi;
+		ulong lo;
+	};
+};
+
+typedef	char*	va_list;
+#define va_start(list, start) list =\
+	(sizeof(start) < 4?\
+		(char*)((int*)&(start)+1):\
+		(char*)(&(start)+1))
+#define va_end(list)\
+	USED(list)
+#define va_arg(list, mode)\
+	((sizeof(mode) == 1)?\
+		((mode*)(list += 4))[-4]:\
+	(sizeof(mode) == 2)?\
+		((mode*)(list += 4))[-2]:\
+		((mode*)(list += sizeof(mode)))[-1])

+ 24 - 0
Inferno/thumb/include/ureg.h

@@ -0,0 +1,24 @@
+typedef struct Ureg {
+	uint	r0;
+	uint	r1;
+	uint	r2;
+	uint	r3;
+	uint	r4;
+	uint	r5;
+	uint	r6;
+	uint	r7;
+	uint	r8;
+	uint	r9;
+	uint	r10;
+	uint	r11;
+	uint	r12;
+	union {
+		uint	r13;
+		uint	sp;
+	};
+	uint	r14;
+	uint	link;
+	uint	type;
+	uint	psr;
+	uint	pc;
+} Ureg;

BIN
Irix/mips/bin/awk


BIN
Irix/mips/bin/data2c


BIN
Irix/mips/bin/iyacc


BIN
Irix/mips/bin/mk


BIN
Irix/mips/bin/mkext


+ 22 - 0
Irix/mips/include/emu.h

@@ -0,0 +1,22 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+extern	Proc**	Xup;
+#define	up	(*Xup)
+
+typedef	struct	FPU	FPU;
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+struct FPU
+{
+	ulong	fcr31;
+};
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)
+

+ 456 - 0
Irix/mips/include/lib9.h

@@ -0,0 +1,456 @@
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+#include <sys/stat.h>
+#define _POSIX_SOURCE
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <sys/bsd_types.h>
+#include <time.h>
+
+#define	getwd	infgetwd
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+#define	nil		((void*)0)
+
+typedef unsigned char	uchar;
+typedef signed char	schar;
+typedef unsigned int Rune;
+typedef long long int	vlong;
+typedef unsigned long long int	uvlong;
+typedef unsigned int u32int;
+typedef uvlong u64int;
+
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+typedef signed char	int8;
+typedef unsigned char	uint8;
+typedef short	int16;
+typedef unsigned short	uint16;
+typedef int	int32;
+typedef unsigned int	uint32;
+typedef long long	int64;
+typedef unsigned long long	uint64;
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#undef nelem
+#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#undef assert
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * most mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	int	isInf(double, int);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+	
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+#define	pow10	infpow10
+extern	double	pow10(int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+

BIN
Linux/386/bin/data2c


BIN
Linux/386/bin/iyacc


BIN
Linux/386/bin/mk


BIN
Linux/386/bin/mkext


+ 33 - 0
Linux/386/include/emu.h

@@ -0,0 +1,33 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+typedef struct FPU FPU;
+struct FPU
+{
+	uchar	env[28];
+};
+
+#define KSTACK (32 * 1024)
+
+#ifndef USE_PTHREADS
+static __inline Proc *getup(void) {
+	Proc *p;
+	__asm__(	"movl	%%esp, %%eax\n\t"
+			: "=a" (p)
+	);
+	return *(Proc **)((uintptr)p & ~(KSTACK - 1));
+}
+#else
+extern	Proc*	getup(void);
+#endif
+
+#define	up	(getup())
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)

+ 0 - 0
Linux/386/include/fpuctl.h


+ 495 - 0
Linux/386/include/lib9.h

@@ -0,0 +1,495 @@
+/* define _BSD_SOURCE to use ISO C, POSIX, and 4.3BSD things. */
+#define	USE_PTHREADS
+#ifndef _DEFAULT_SOURCE
+#define	_DEFAULT_SOURCE
+#endif
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#define _XOPEN_SOURCE  500
+#define _LARGEFILE_SOURCE	1
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+#ifdef USE_PTHREADS
+#define	_REENTRANT	1
+#endif
+#include <features.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#define sync __os_sync
+#include <unistd.h>
+#undef sync
+#include <errno.h>
+#define __NO_STRING_INLINES
+#include <string.h>
+#include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <time.h>
+#include <endian.h>
+
+#define	getwd	infgetwd
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ * #define __LITTLE_ENDIAN /usr/include/endian.h under linux
+ */
+
+#define	nil		((void*)0)
+
+typedef unsigned char	uchar;
+typedef signed char	schar;
+typedef unsigned int Rune;
+typedef long long int	vlong;
+typedef unsigned long long int	uvlong;
+typedef unsigned int u32int;
+typedef uvlong u64int;
+
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#undef nelem
+#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#undef assert
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * most mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	double	NaN(void);
+extern	int	isInf(double, int);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+	
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+#define	pow10	infpow10
+extern	double	pow10(int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+
+/* FCR */
+#define	FPINEX	(1<<5)
+#define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
+#define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
+#define	FPRNR	(0<<10)
+#define	FPRZ	(3<<10)
+#define	FPRPINF	(2<<10)
+#define	FPRNINF	(1<<10)
+#define	FPRMASK	(3<<10)
+#define	FPPEXT	(3<<8)
+#define	FPPSGL	(0<<8)
+#define	FPPDBL	(2<<8)
+#define	FPPMASK	(3<<8)
+/* FSR */
+#define	FPAINEX	FPINEX
+#define	FPAOVFL	FPOVFL
+#define	FPAUNFL	FPUNFL
+#define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL
+
+extern	void	setfcr(ulong);
+extern	void	setfsr(ulong);
+extern	ulong	getfcr(void);
+extern	ulong	getfsr(void);

+ 34 - 0
Linux/arm/include/emu.h

@@ -0,0 +1,34 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+typedef struct FPU FPU;
+struct FPU
+{
+	uchar	env[28];
+};
+
+
+#ifndef USE_PTHREADS
+#define KSTACK (16 * 1024)	/* must be power of two */
+static __inline Proc *getup(void) {
+	Proc *p;
+	__asm__(	"mov	%0, %%sp;" 
+			: "=r" (p) 
+ 	); 
+	return *(Proc **)((uintptr)p & ~(KSTACK - 1));
+}
+#else
+#define KSTACK (32 * 1024)	/* need not be power of two */
+extern	Proc*	getup(void);
+#endif
+
+#define	up	(getup())
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)

+ 0 - 0
Linux/arm/include/fpuctl.h


+ 504 - 0
Linux/arm/include/lib9.h

@@ -0,0 +1,504 @@
+/* define _BSD_SOURCE to use ISO C, POSIX, and 4.3BSD things. */
+#define	USE_PTHREADS
+#ifndef _DEFAULT_SOURCE
+#define	_DEFAULT_SOURCE
+#endif
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#define _XOPEN_SOURCE  500
+#define _LARGEFILE_SOURCE	1
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+#ifdef USE_PTHREADS
+#define	_REENTRANT	1
+#endif
+#include <features.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#define sync __os_sync
+#include <unistd.h>
+#undef sync
+#include <errno.h>
+#define __NO_STRING_INLINES
+#include <string.h>
+#include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <endian.h>
+
+#define	getwd	infgetwd
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ * #define __LITTLE_ENDIAN /usr/include/endian.h under linux
+ */
+
+#define	nil		((void*)0)
+
+typedef unsigned char	uchar;
+typedef signed char	schar;
+typedef unsigned int Rune;
+typedef long long int	vlong;
+typedef unsigned long long int	uvlong;
+typedef unsigned int u32int;
+typedef uvlong u64int;
+
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#undef nelem
+#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#undef assert
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * most mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	double	NaN(void);
+extern	int	isInf(double, int);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+	
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+//extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+#define	pow10	infpow10
+extern	double	pow10(int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+
+/* need the inline because the link register is not saved in a known location */
+static __inline uintptr getcallerpc(void* dummy) {
+	ulong lr;
+ 	__asm__(	"mov	%0, %%lr;" 
+ 			: "=r" (lr) 
+ 	); 
+	return lr;
+}
+
+
+extern	void	setfcr(ulong);
+extern	void	setfsr(ulong);
+extern	ulong	getfcr(void);
+extern	ulong	getfsr(void);
+
+/* FCR */
+#define	FPINEX	(1<<5)
+#define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
+#define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
+#define	FPRNR	(0<<10)
+#define	FPRZ	(3<<10)
+#define	FPRPINF	(2<<10)
+#define	FPRNINF	(1<<10)
+#define	FPRMASK	(3<<10)
+#define	FPPEXT	(3<<8)
+#define	FPPSGL	(0<<8)
+#define	FPPDBL	(2<<8)
+#define	FPPMASK	(3<<8)
+/* FSR */
+#define	FPAINEX	FPINEX
+#define	FPAOVFL	FPOVFL
+#define	FPAUNFL	FPUNFL
+#define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL

BIN
Linux/power/bin/data2c


BIN
Linux/power/bin/iyacc


BIN
Linux/power/bin/limbo


BIN
Linux/power/bin/mk


BIN
Linux/power/bin/mkext


+ 37 - 0
Linux/power/include/emu.h

@@ -0,0 +1,37 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+typedef struct FPU FPU;
+struct FPU
+{
+	uchar	env[18*8];
+};
+
+/*
+ * Later versions of Linux seemed to need large stack for gethostbyname()
+ * so we had this at 128k, which is excessive.  More recently, we've
+ * reduced it again after testing stack usage by gethostbyname.
+ */
+#define KSTACK (16 * 1024)
+
+#ifndef USE_PTHREADS
+static __inline Proc *getup(void) {
+	Proc *p;
+	__asm__(	"mr	%0, 1" : "=r" (p));
+	return *(Proc **)((unsigned long)p & ~(KSTACK - 1));
+}
+#else
+extern	Proc*	getup(void);
+#endif
+
+#define	up	(getup())
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)
+

+ 517 - 0
Linux/power/include/lib9.h

@@ -0,0 +1,517 @@
+/* define _BSD_SOURCE to use ISO C, POSIX, and 4.3BSD things. */
+#define	USE_PTHREADS
+#ifndef _DEFAULT_SOURCE
+#define	_DEFAULT_SOURCE
+#endif
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#define _XOPEN_SOURCE  500
+#define _LARGEFILE_SOURCE	1
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+#ifdef USE_PTHREADS
+#define	_REENTRANT	1
+#endif
+#include <features.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#define sync __os_sync
+#include <unistd.h>
+#undef sync
+#include <errno.h>
+#define __NO_STRING_INLINES
+#include <string.h>
+#include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <endian.h>
+
+#define	getwd	infgetwd
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ * #define __LITTLE_ENDIAN /usr/include/endian.h under linux
+ */
+#undef __LITTLE_ENDIAN
+
+#define	nil		((void*)0)
+
+typedef unsigned char	uchar;
+typedef signed char	schar;
+typedef unsigned int Rune;
+typedef long long int	vlong;
+typedef unsigned long long int	uvlong;
+typedef unsigned int u32int;
+typedef uvlong u64int;
+
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#undef nelem
+#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#undef assert
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * most mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	double	NaN(void);
+extern	int	isInf(double, int);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+	
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+#define	pow10	infpow10
+extern	double	pow10(int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+
+extern	void	setfcr(ulong);
+extern	void	setfsr(ulong);
+extern	ulong	getfcr(void);
+extern	ulong	getfsr(void);
+
+
+/* FPSCR */
+#define	FPSFX	(1<<31)	/* exception summary (sticky) */
+#define	FPSEX	(1<<30)	/* enabled exception summary */
+#define	FPSVX	(1<<29)	/* invalid operation exception summary */
+#define	FPSOX	(1<<28)	/* overflow exception OX (sticky) */
+#define	FPSUX	(1<<27)	/* underflow exception UX (sticky) */
+#define	FPSZX	(1<<26)	/* zero divide exception ZX (sticky) */
+#define	FPSXX	(1<<25)	/* inexact exception XX (sticky) */
+#define	FPSVXSNAN (1<<24)	/* invalid operation exception for SNaN (sticky) */
+#define	FPSVXISI	(1<<23)	/* invalid operation exception for ∞-∞ (sticky) */
+#define	FPSVXIDI	(1<<22)	/* invalid operation exception for ∞/∞ (sticky) */
+#define	FPSVXZDZ (1<<21)	/* invalid operation exception for 0/0 (sticky) */
+#define	FPSVXIMZ	(1<<20)	/* invalid operation exception for ∞*0 (sticky) */
+#define	FPSVXVC	(1<<19)	/* invalid operation exception for invalid compare (sticky) */
+#define	FPSFR	(1<<18)	/* fraction rounded */
+#define	FPSFI	(1<<17)	/* fraction inexact */
+#define	FPSFPRF	(1<<16)	/* floating point result class */
+#define	FPSFPCC	(0xF<<12)	/* <, >, =, unordered */
+#define	FPVXCVI	(1<<8)	/* enable exception for invalid integer convert (sticky) */
+
+/* FCR */
+#define	FPVE	(1<<7)	/* invalid operation exception enable */
+#define	FPOVFL	(1<<6)	/* enable overflow exceptions */
+#define	FPUNFL	(1<<5)	/* enable underflow */
+#define	FPZDIV	(1<<4)	/* enable zero divide */
+#define	FPINEX	(1<<3)	/* enable inexact exceptions */
+#define	FPRMASK	(3<<0)	/* rounding mode */
+#define	FPRNR	(0<<0)
+#define	FPRZ	(1<<0)
+#define	FPRPINF	(2<<0)
+#define	FPRNINF	(3<<0)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+#define	FPINVAL	FPVE
+/* FSR */
+#define	FPAOVFL	FPSOX
+#define	FPAINEX	FPSXX
+#define	FPAUNFL	FPSUX
+#define	FPAZDIV	FPSZX
+#define	FPAINVAL	FPSVX

+ 39 - 0
Linux/spim/include/emu.h

@@ -0,0 +1,39 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+typedef struct FPU FPU;
+struct FPU
+{
+	uchar	env[28];
+};
+
+/*
+ * Later versions of Linux seemed to need large stack for gethostbyname()
+ * so we had this at 128k, which is excessive.  More recently, we've
+ * reduced it again after testing stack usage by gethostbyname.
+ */
+#define KSTACK (16 * 1024)
+
+#ifndef USE_PTHREADS
+static __inline Proc *getup(void) {
+	Proc *p;
+	__asm__(	"move	%0, $29\n\t"
+			: "=r" (p)
+	);
+	return *(Proc **)((unsigned long)p & ~(KSTACK - 1));
+}
+#else
+extern	Proc*	getup(void);
+#endif
+
+#define	up	(getup())
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)
+

+ 0 - 0
Linux/spim/include/fpuctl.h


+ 499 - 0
Linux/spim/include/lib9.h

@@ -0,0 +1,499 @@
+/* define _BSD_SOURCE to use ISO C, POSIX, and 4.3BSD things. */
+#define	USE_PTHREADS
+#ifndef _DEFAULT_SOURCE
+#define	_DEFAULT_SOURCE
+#endif
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#define _LARGEFILE_SOURCE	1
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+#include <features.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#define sync __os_sync
+#include <unistd.h>
+#undef sync
+#include <errno.h>
+#define __NO_STRING_INLINES
+#include <string.h>
+#include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <endian.h>
+
+#define	getwd	infgetwd
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ * #define __LITTLE_ENDIAN according to target under linux
+ */
+
+#ifdef __MIPSEB__
+#undef __LITTLE_ENDIAN
+#else
+#define __LITTLE_ENDIAN 1234
+#endif
+
+#define	nil		((void*)0)
+
+typedef unsigned char	uchar;
+typedef signed char	schar;
+typedef unsigned int Rune;
+typedef long long int	vlong;
+typedef unsigned long long int	uvlong;
+typedef unsigned int u32int;
+typedef uvlong u64int;
+
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#undef nelem
+#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#undef assert
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * most mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	double	NaN(void);
+extern	int	isInf(double, int);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+	
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+#define	pow10	infpow10
+extern	double	pow10(int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	ulong	val;
+	int	pid;
+} Lock;
+
+extern ulong	_tas(ulong*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+
+
+extern	void	setfcr(ulong);
+extern	void	setfsr(ulong);
+extern	ulong	getfcr(void);
+extern	ulong	getfsr(void);
+
+/* FCR */
+#define	FCRBITS	0x00000F83
+#define	FPINEX	(1<<7)
+#define	FPUNFL	(1<<8)
+#define	FPOVFL	(1<<9)
+#define	FPZDIV	(1<<10)
+#define	FPINVAL	(1<<11)
+#define	FPRNR	(0<<0)
+#define	FPRZ	(1<<0)
+#define	FPRPINF	(2<<0)
+#define	FPRNINF	(3<<0)
+#define	FPRMASK	(3<<0)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+/* FSR */
+#define	FSRBITS	0x0003F07C
+#define	FPAINEX	(1<<2)
+#define	FPAOVFL	(1<<4)
+#define	FPAUNFL	(1<<3)
+#define	FPAZDIV	(1<<5)
+#define	FPAINVAL	(1<<6)

BIN
MacOSX/386/bin/data2c


BIN
MacOSX/386/bin/iyacc


BIN
MacOSX/386/bin/mk


BIN
MacOSX/386/bin/mkext


+ 34 - 0
MacOSX/386/include/emu.h

@@ -0,0 +1,34 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+extern Proc *getup(void);
+#define	up	(getup())
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+
+// something is at odds between i386/fpu.h and some of the thread headers
+#define fp_control inffp_control
+#define fp_control_t inffp_control_t
+#define fp_status inffp_status
+#define fp_status_t inffp_status_t
+
+#include <architecture/i386/fpu.h>
+
+typedef struct FPU FPU;
+struct FPU
+{
+	fp_state_t	env;
+};
+
+#undef fp_control
+#undef fp_control_t
+#undef fp_status
+#undef fp_status_t
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)

+ 0 - 0
MacOSX/386/include/fpuctl.h


+ 516 - 0
MacOSX/386/include/lib9.h

@@ -0,0 +1,516 @@
+/*
+ * Based on FreeBSD lib9.h
+ * Copyright © 1998, 1999 Lucent Technologies Inc.  All rights reserved.
+ * Revisions Copyright © 1999, 2002 Vita Nuova Limited.  All rights reserved.
+ * Revisions Copyright © 2002, 2003 Corpus Callosum Corporation.  All rights reserved.
+ */
+
+/* define _BSD_SOURCE to use ISO C, POSIX, and 4.4BSD things. */
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <time.h>
+
+#define nil		((void*)0)
+
+// typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef unsigned long	ulong;
+// typedef unsigned int	uint;
+typedef	  signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long	uvlong;
+typedef unsigned int Rune;
+typedef unsigned int	u32int;
+typedef uvlong u64int;
+
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+typedef signed char	int8;
+typedef unsigned char	uint8;
+typedef short	int16;
+typedef unsigned short	uint16;
+typedef int	int32;
+typedef unsigned int	uint32;
+typedef long long	int64;
+typedef unsigned long long	uint64;
+
+/* handle conflicts with host os libs */
+#define	getwd	infgetwd
+#define scalb	infscalb
+#define div 	infdiv
+#define panic	infpanic
+#define rint	infrint
+#define	rcmd	infrcmd
+#define	pow10	infpow10
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ */
+#include <machine/endian.h>
+#define __LITTLE_ENDIAN
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#define nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#undef assert
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+
+extern	int	nrand(int);
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	double	NaN(void);
+extern	int	isInf(double, int);
+extern	double	pow(double, double);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	double	frexp(double, int*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+extern	double	ldexp(double, int);
+extern	double	modf(double, double*);
+extern	void	perror(const char*);
+extern	double	pow10(int);
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt=0;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+
+/* FCR */
+#define	FPINEX	(1<<5)
+#define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
+#define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
+#define	FPRNR	(0<<10)
+#define	FPRZ	(3<<10)
+#define	FPRPINF	(2<<10)
+#define	FPRNINF	(1<<10)
+#define	FPRMASK	(3<<10)
+#define	FPPEXT	(3<<8)
+#define	FPPSGL	(0<<8)
+#define	FPPDBL	(2<<8)
+#define	FPPMASK	(3<<8)
+/* FSR */
+#define	FPAINEX	FPINEX
+#define	FPAOVFL	FPOVFL
+#define	FPAUNFL	FPUNFL
+#define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL
+
+extern	void	setfcr(ulong);
+extern	void	setfsr(ulong);
+extern	ulong	getfcr(void);
+extern	ulong	getfsr(void);

+ 72 - 0
MacOSX/README

@@ -0,0 +1,72 @@
+This file is of historical interest only, but serves to note that
+much of the work of the MacOSX ports was originally done by Corpus Callosum.
+Bugs to support@vitanuova.com, though.
+
+March 2006: initial MacOSX 10.4/x86 port
+
+12-Dec-2003
+Emu can use wm with Apple's X11R6 again.
+
+08-Dec-2003
+Inferno Services (6660, 6666-6676, 2202)
+
+26-Aug-2003
+In order to run and use Inferno services appropriately on OSX, you need to ensure that the Sharing System Preferences include an entry in the Firewall section that is turned on and looks like the following line:
+
+Inferno services (6660, 6666-6674)
+
+
+05-Jul-2003
+In order to support 1.4, the build will now use the default 'mk' provided with the Inferno distribution.  You can also copy tcshrc to the Inferno ROOT and source the file from that directory before running or building emu.  Modified mkfiles and sources are now available in the srcMacOSX archive.  You may also want to change 'mkconfig' with the following diff
+
+% cvs diff -r 1.1 mkconfig
+Index: mkconfig
+===================================================================
+RCS file: /usr/local/Repository/cvs/vitanuova/inferno_v14/mkconfig,v
+retrieving revision 1.1
+retrieving revision 1.3
+diff -r1.1 -r1.3
+7c7
+< ROOT=/usr/inferno
+---
+> ROOT=$ROOT
+17c17
+< SYSHOST=Plan9         # build system OS type (Hp, Inferno, Irix, Linux, Nt, Plan9, Solaris)
+---
+> SYSHOST=MacOSX                # build system OS type (Hp, Inferno, Irix, Linux, Nt, Plan9, Solaris)
+25c25
+< OBJTYPE=$objtype
+---
+> OBJTYPE=power
+
+
+
+16-May-2003
+
+The build now uses the open sourced 'mk' from http://www.pdos.lcs.mit.edu/~rsc/software/
+
+There is a file .tcshrc at the root of this tree (..) that can be used to set up the environment required to build emu.
+
+
+
+28-Feb-2001
+
+The initial port has been provided by Corpus Callosum Corporation.
+
+This port of Inferno for Darwin, Mac OS X, and Mac OS X Server hosted environments currently provides base 'emu' support.  Wm, audio, and other services are not currently ported.  It has only been tested on UFS partitions and will require further testing for HFS+ support.
+
+Emu -c1 currently errors out as "Illegal instruction"
+
+Various malloc/free (from libc/System on Mac OS X/Darwin) warnings should be removed in the following version.
+
+eia devices will recognize /dev/ttyd.irda and /dev/ttyd.modem though both are completely untested (need to get updates to the RCX interface to test irda).
+
+The following modification was added to various 'mkfile' to support required redefinition of varios core functions.
+
+	<$ROOT/mkfiles/mkalloc-$SYSHOST-$OBJTYPE
+
+Some of the base libraries and utils will have *.pbproj files which were used to bootstrap the initial build system on Mac OS X (Public Beta).
+
+
+
+"Mac OS X" and "Mac OS X Server" are trade marks of Apple Computer, Inc.

BIN
MacOSX/power/bin/data2c


BIN
MacOSX/power/bin/iyacc


BIN
MacOSX/power/bin/mk


BIN
MacOSX/power/bin/mkext


+ 22 - 0
MacOSX/power/include/emu.h

@@ -0,0 +1,22 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+extern Proc *getup(void);
+#define	up	(getup())
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+
+#include <architecture/ppc/fp_regs.h>
+
+typedef union {
+	double 			__dbl;
+	ppc_fp_scr_t	__src;
+} FPU;
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)

+ 537 - 0
MacOSX/power/include/lib9.h

@@ -0,0 +1,537 @@
+/*
+ * Based on FreeBSD lib9.h
+ * Copyright © 1998, 1999 Lucent Technologies Inc.  All rights reserved.
+ * Revisions Copyright © 1999, 2002 Vita Nuova Limited.  All rights reserved.
+ * Revisions Copyright © 2002, 2003 Corpus Callosum Corporation.  All rights reserved.
+ */
+
+/* define _BSD_SOURCE to use ISO C, POSIX, and 4.4BSD things. */
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#define _LARGEFILE64_SOURCE	1
+#define _FILE_OFFSET_BITS 64
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+// #include "math.h"
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <time.h>
+
+#define nil		((void*)0)
+
+// typedef	unsigned short	ushort;
+typedef	unsigned char	uchar;
+typedef unsigned long	ulong;
+// typedef unsigned int	uint;
+typedef	  signed char	schar;
+typedef	long long	vlong;
+typedef	unsigned long long	uvlong;
+typedef unsigned int Rune;
+typedef unsigned int	u32int;
+typedef uvlong u64int;
+
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef unsigned long uintptr;
+
+typedef signed char	int8;
+typedef unsigned char	uint8;
+typedef short	int16;
+typedef unsigned short	uint16;
+typedef int	int32;
+typedef unsigned int	uint32;
+typedef long long	int64;
+typedef unsigned long long	uint64;
+
+/* handle conflicts with host os libs */
+#define	getwd	infgetwd
+#define scalb	infscalb
+#define div 	infdiv
+#define panic	infpanic
+#define rint	infrint
+#define	rcmd	infrcmd
+#define	pow10	infpow10
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ */
+#include <machine/endian.h>
+#define __BIG_ENDIAN
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#define nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#undef assert
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#define	assert(x)	if(x){}else _assert("x")
+
+/*
+ * mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+
+extern	int	nrand(int);
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	int	isInf(double, int);
+extern	double	pow(double, double);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	double	frexp(double, int*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+extern	double	ldexp(double, int);
+extern	double	modf(double, double*);
+extern	void	perror(const char*);
+extern	double	pow10(int);
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+
+
+/* FPSCR */
+#define	FPSFX	(1<<31)	/* exception summary (sticky) */
+#define	FPSEX	(1<<30)	/* enabled exception summary */
+#define	FPSVX	(1<<29)	/* invalid operation exception summary */
+#define	FPSOX	(1<<28)	/* overflow exception OX (sticky) */
+#define	FPSUX	(1<<27)	/* underflow exception UX (sticky) */
+#define	FPSZX	(1<<26)	/* zero divide exception ZX (sticky) */
+#define	FPSXX	(1<<25)	/* inexact exception XX (sticky) */
+#define	FPSVXSNAN (1<<24)	/* invalid operation exception for SNaN (sticky) */
+#define	FPSVXISI	(1<<23)	/* invalid operation exception for ∞-∞ (sticky) */
+#define	FPSVXIDI	(1<<22)	/* invalid operation exception for ∞/∞ (sticky) */
+#define	FPSVXZDZ (1<<21)	/* invalid operation exception for 0/0 (sticky) */
+#define	FPSVXIMZ	(1<<20)	/* invalid operation exception for ∞*0 (sticky) */
+#define	FPSVXVC	(1<<19)	/* invalid operation exception for invalid compare (sticky) */
+#define	FPSFR	(1<<18)	/* fraction rounded */
+#define	FPSFI	(1<<17)	/* fraction inexact */
+#define	FPSFPRF	(1<<16)	/* floating point result class */
+#define	FPSFPCC	(0xF<<12)	/* <, >, =, unordered */
+#define	FPVXCVI	(1<<8)	/* enable exception for invalid integer convert (sticky) */
+
+/* FCR */
+#define	FPVE	(1<<7)	/* invalid operation exception enable */
+#define	FPOVFL	(1<<6)	/* enable overflow exceptions */
+#define	FPUNFL	(1<<5)	/* enable underflow */
+#define	FPZDIV	(1<<4)	/* enable zero divide */
+#define	FPINEX	(1<<3)	/* enable inexact exceptions */
+#define	FPRMASK	(3<<0)	/* rounding mode */
+#define	FPRNR	(0<<0)
+#define	FPRZ	(1<<0)
+#define	FPRPINF	(2<<0)
+#define	FPRNINF	(3<<0)
+#define	FPPEXT	0
+#define	FPPSGL	0
+#define	FPPDBL	0
+#define	FPPMASK	0
+#define	FPINVAL	FPVE
+/* FSR */
+#define	FPAOVFL	FPSOX
+#define	FPAINEX	FPSXX
+#define	FPAUNFL	FPSUX
+#define	FPAZDIV	FPSZX
+#define	FPAINVAL	FPSVX
+
+extern	void	setfcr(ulong);
+extern	void	setfsr(ulong);
+extern	ulong	getfcr(void):
+extern	ulong	getfsr(void);

+ 12 - 0
MacOSX/tcshrc

@@ -0,0 +1,12 @@
+#
+# needed for the build process
+#
+set path=( $path `pwd`/MacOSX/power/bin )
+
+setenv EMU "-r`pwd` -g1024x768"
+
+setenv ROOT `pwd`
+setenv SYSHOST MacOSX
+setenv OBJTYPE power
+setenv ACIDLIB $ROOT/lib/acid
+

+ 32 - 0
NOTICE

@@ -0,0 +1,32 @@
+This Inferno® distribution includes software from various sources and
+different portions are therefore subject to different licence terms.
+The most stringent is the GNU Public License (version 2), which governs the collection.
+Individual components might have their own NOTICE and licence files (LICENCE
+or COPYING) that cover their content.  All of them allow modification and redistribution.
+They are all compatible with the GPLv2.
+
+The following copyright notice covers the contents of this
+distribution unless otherwise specified by a given file, directory, or
+directory tree:
+
+Inferno® Copyright © 1996-1999 Lucent Technologies Inc.  All rights reserved.
+Inferno revisions Copyright © 1997-1999 Vita Nuova Limited.  All rights reserved.
+Inferno revisions Copyright © 2000-2015 Vita Nuova Holdings Limited.  All rights reserved.
+Inferno new material Copyright © 2000-2015 Vita Nuova Holdings Limited.  All rights reserved.
+
+Inferno, Styx, Dis and Limbo are registered trademarks of Vita Nuova Holdings Limited in the USA and other countries.
+Plan 9 is a registered trademark of Lucent Technologies Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License (`GPL') as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

BIN
NetBSD/386/bin/data2c


BIN
NetBSD/386/bin/mk


BIN
NetBSD/386/bin/mkext


BIN
NetBSD/386/bin/yacc


+ 30 - 0
NetBSD/386/include/emu.h

@@ -0,0 +1,30 @@
+/*
+ * system- and machine-specific declarations for emu:
+ * floating-point save and restore, signal handling primitive, and
+ * implementation of the current-process variable `up'.
+ */
+
+/*
+ * This structure must agree with FPsave and FPrestore asm routines
+ */
+typedef struct FPU FPU;
+struct FPU
+{
+	uchar	env[28];
+};
+
+#define KSTACK (32 * 1024)
+
+static __inline Proc *getup(void) {
+	Proc *p;
+	__asm__(	"movl	%%esp, %%eax\n\t"
+			: "=a" (p)
+	);
+	return *(Proc **)((unsigned long)p & ~(KSTACK - 1));
+};
+
+#define	up	(getup())
+
+typedef sigjmp_buf osjmpbuf;
+#define	ossetjmp(buf)	sigsetjmp(buf, 1)
+

+ 76 - 0
NetBSD/386/include/fpuctl.h

@@ -0,0 +1,76 @@
+/*
+ * Linux 386 fpu support
+ * Mimic Plan9 floating point support
+ */
+
+static void
+setfcr(ulong fcr)
+{
+	__asm__(	"xorb	$0x3f, %%al\n\t"
+			"pushw	%%ax\n\t"
+			"fwait\n\t"
+			"fldcw	(%%esp)\n\t"
+			"popw	%%ax\n\t"
+			: /* no output */
+			: "al" (fcr)
+	);
+}
+
+static ulong
+getfcr(void)
+{
+	ulong fcr = 0;
+
+	__asm__(	"pushl	%%eax\n\t"
+			"fwait\n\t"
+			"fstcw	(%%esp)\n\t"
+			"popl	%%eax\n\t"
+			"xorb	$0x3f, %%al\n\t"
+			: "=a"  (fcr)
+			: "eax"	(fcr)
+	);
+	return fcr; 
+}
+
+static ulong
+getfsr(void)
+{
+	ulong fsr = -1;
+
+	__asm__(	"fwait\n\t"
+			"fstsw	(%%eax)\n\t"
+			"movl	(%%eax), %%eax\n\t"
+			"andl	$0xffff, %%eax\n\t"
+			: "=a"  (fsr)
+			: "eax" (&fsr)
+	);
+	return fsr;
+}
+
+static void
+setfsr(ulong fsr)
+{
+	__asm__("fclex\n\t");
+}
+
+/* FCR */
+#define	FPINEX	(1<<5)
+#define	FPUNFL	((1<<4)|(1<<1))
+#define	FPOVFL	(1<<3)
+#define	FPZDIV	(1<<2)
+#define	FPINVAL	(1<<0)
+#define	FPRNR	(0<<10)
+#define	FPRZ	(3<<10)
+#define	FPRPINF	(2<<10)
+#define	FPRNINF	(1<<10)
+#define	FPRMASK	(3<<10)
+#define	FPPEXT	(3<<8)
+#define	FPPSGL	(0<<8)
+#define	FPPDBL	(2<<8)
+#define	FPPMASK	(3<<8)
+/* FSR */
+#define	FPAINEX	FPINEX
+#define	FPAOVFL	FPOVFL
+#define	FPAUNFL	FPUNFL
+#define	FPAZDIV	FPZDIV
+#define	FPAINVAL	FPINVAL

+ 478 - 0
NetBSD/386/include/lib9.h

@@ -0,0 +1,478 @@
+#include <sys/types.h>
+#include <sys/endian.h>
+#include <sys/stat.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <math.h>
+#include <fcntl.h>
+#include <setjmp.h>
+#include <float.h>
+#include <time.h>
+
+#define	getwd	infgetwd
+
+#define	round	infround
+#define	fmax	inffmax
+#define	log2	inflog2
+
+#ifndef EMU
+typedef struct Proc Proc;
+#endif
+
+/*
+ * math module dtoa
+ */
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define __LITTLE_ENDIAN
+#endif
+
+#define	nil		((void*)0)
+
+typedef unsigned char	uchar;
+typedef signed char	schar;
+#if 0 /* XXX: uwe: already defined in <sys/types.h> */
+typedef unsigned long	ulong;
+#endif
+
+typedef int64_t		vlong;
+typedef uint64_t	uvlong;
+
+typedef uint8_t		u8int;
+typedef uint16_t	u16int;
+typedef uint32_t	u32int;
+typedef uvlong u64int;
+
+typedef uintptr_t	uintptr;
+
+typedef signed char	int8;
+typedef unsigned char	uint8;
+typedef short	int16;
+typedef unsigned short	uint16;
+typedef int	int32;
+typedef unsigned int	uint32;
+typedef long long	int64;
+typedef unsigned long long	uint64;
+
+typedef unsigned int Rune;
+typedef unsigned int	mpdigit;	/* for /sys/include/mp.h */
+
+
+#define	USED(x)		if(x){}else{}
+#define	SET(x)
+
+#undef nelem
+#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
+#undef offsetof
+#define	offsetof(s, m)	(ulong)(&(((s*)0)->m))
+#undef assert
+#define	assert(x)	if(x){}else _assert(#x)
+
+/*
+ * most mem and string routines are declared by ANSI/POSIX files above
+ */
+
+extern	char*	strecpy(char*, char*, char*);
+extern	char*	strdup(const char*);
+extern	int	cistrncmp(char*, char*, int);
+extern	int	cistrcmp(char*, char*);
+extern	char*	cistrstr(char*, char*);
+extern	int	tokenize(char*, char**, int);
+
+enum
+{
+	UTFmax		= 4,		/* maximum bytes per rune */
+	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
+	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
+	Runeerror	= 0xFFFD,	/* decoding error in UTF */
+	Runemax		= 0x10FFFF,	/* 21-bit rune */
+	Runemask	= 0x1FFFFF,	/* bits used by runes (see grep) */
+};
+
+/*
+ * rune routines
+ */
+extern	int	runetochar(char*, Rune*);
+extern	int	chartorune(Rune*, char*);
+extern	int	runelen(long);
+extern	int	runenlen(Rune*, int);
+extern	int	fullrune(char*, int);
+extern	int	utflen(char*);
+extern	int	utfnlen(char*, long);
+extern	char*	utfrune(char*, long);
+extern	char*	utfrrune(char*, long);
+extern	char*	utfutf(char*, char*);
+extern	char*	utfecpy(char*, char*, char*);
+
+extern	Rune*	runestrcat(Rune*, Rune*);
+extern	Rune*	runestrchr(Rune*, Rune);
+extern	int	runestrcmp(Rune*, Rune*);
+extern	Rune*	runestrcpy(Rune*, Rune*);
+extern	Rune*	runestrncpy(Rune*, Rune*, long);
+extern	Rune*	runestrecpy(Rune*, Rune*, Rune*);
+extern	Rune*	runestrdup(Rune*);
+extern	Rune*	runestrncat(Rune*, Rune*, long);
+extern	int	runestrncmp(Rune*, Rune*, long);
+extern	Rune*	runestrrchr(Rune*, Rune);
+extern	long	runestrlen(Rune*);
+extern	Rune*	runestrstr(Rune*, Rune*);
+
+extern	Rune	tolowerrune(Rune);
+extern	Rune	totitlerune(Rune);
+extern	Rune	toupperrune(Rune);
+extern	int	isalpharune(Rune);
+extern	int	islowerrune(Rune);
+extern	int	isspacerune(Rune);
+extern	int	istitlerune(Rune);
+extern	int	isupperrune(Rune);
+
+/*
+ * malloc
+ */
+extern	void*	malloc(size_t);
+extern	void*	mallocz(ulong, int);
+extern	void	free(void*);
+extern	ulong	msize(void*);
+extern	void*	calloc(size_t, size_t);
+extern	void*	realloc(void*, size_t);
+extern	void		setmalloctag(void*, ulong);
+extern	void		setrealloctag(void*, ulong);
+extern	ulong	getmalloctag(void*);
+extern	ulong	getrealloctag(void*);
+extern	void*	malloctopoolblock(void*);
+
+/*
+ * print routines
+ */
+typedef struct Fmt	Fmt;
+struct Fmt{
+	uchar	runes;			/* output buffer is runes or chars? */
+	void	*start;			/* of buffer */
+	void	*to;			/* current place in the buffer */
+	void	*stop;			/* end of the buffer; overwritten if flush fails */
+	int	(*flush)(Fmt *);	/* called when to == stop */
+	void	*farg;			/* to make flush a closure */
+	int	nfmt;			/* num chars formatted so far */
+	va_list	args;			/* args passed to dofmt */
+	int	r;			/* % format Rune */
+	int	width;
+	int	prec;
+	ulong	flags;
+};
+
+enum{
+	FmtWidth	= 1,
+	FmtLeft		= FmtWidth << 1,
+	FmtPrec		= FmtLeft << 1,
+	FmtSharp	= FmtPrec << 1,
+	FmtSpace	= FmtSharp << 1,
+	FmtSign		= FmtSpace << 1,
+	FmtZero		= FmtSign << 1,
+	FmtUnsigned	= FmtZero << 1,
+	FmtShort	= FmtUnsigned << 1,
+	FmtLong		= FmtShort << 1,
+	FmtVLong	= FmtLong << 1,
+	FmtComma	= FmtVLong << 1,
+	FmtByte	= FmtComma << 1,
+
+	FmtFlag		= FmtByte << 1
+};
+
+extern	int	print(char*, ...);
+extern	char*	seprint(char*, char*, char*, ...);
+extern	char*	vseprint(char*, char*, char*, va_list);
+extern	int	snprint(char*, int, char*, ...);
+extern	int	vsnprint(char*, int, char*, va_list);
+extern	char*	smprint(char*, ...);
+extern	char*	vsmprint(char*, va_list);
+extern	int	sprint(char*, char*, ...);
+extern	int	fprint(int, char*, ...);
+extern	int	vfprint(int, char*, va_list);
+
+extern	int	runesprint(Rune*, char*, ...);
+extern	int	runesnprint(Rune*, int, char*, ...);
+extern	int	runevsnprint(Rune*, int, char*, va_list);
+extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
+extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
+extern	Rune*	runesmprint(char*, ...);
+extern	Rune*	runevsmprint(char*, va_list);
+
+extern	int	fmtfdinit(Fmt*, int, char*, int);
+extern	int	fmtfdflush(Fmt*);
+extern	int	fmtstrinit(Fmt*);
+extern	char*	fmtstrflush(Fmt*);
+extern	int	runefmtstrinit(Fmt*);
+extern	Rune*	runefmtstrflush(Fmt*);
+
+extern	int	fmtinstall(int, int (*)(Fmt*));
+extern	int	dofmt(Fmt*, char*);
+extern	int	dorfmt(Fmt*, Rune*);
+extern	int	fmtprint(Fmt*, char*, ...);
+extern	int	fmtvprint(Fmt*, char*, va_list);
+extern	int	fmtrune(Fmt*, int);
+extern	int	fmtstrcpy(Fmt*, char*);
+extern	int	fmtrunestrcpy(Fmt*, Rune*);
+/*
+ * error string for %r
+ * supplied on per os basis, not part of fmt library
+ */
+extern	int	errfmt(Fmt *f);
+
+/*
+ * quoted strings
+ */
+extern	char	*unquotestrdup(char*);
+extern	Rune	*unquoterunestrdup(Rune*);
+extern	char	*quotestrdup(char*);
+extern	Rune	*quoterunestrdup(Rune*);
+extern	int	quotestrfmt(Fmt*);
+extern	int	quoterunestrfmt(Fmt*);
+extern	void	quotefmtinstall(void);
+extern	int	(*doquote)(int);
+
+/*
+ * random number
+ */
+extern	int	nrand(int);
+extern	ulong	truerand(void);
+extern	ulong	ntruerand(ulong);
+
+/*
+ * math
+ */
+extern	int	isNaN(double);
+extern	int	isInf(double, int);
+extern	double	pow(double, double);
+
+/*
+ * Time-of-day
+ */
+
+typedef struct Tm Tm;
+struct Tm {
+	int	sec;
+	int	min;
+	int	hour;
+	int	mday;
+	int	mon;
+	int	year;
+	int	wday;
+	int	yday;
+	char	zone[4];
+	int	tzoff;
+};
+extern	vlong	osnsec(void);
+#define	nsec	osnsec
+	
+/*
+ * one-of-a-kind
+ */
+extern	void	_assert(char*);
+extern	double	charstod(int(*)(void*), void*);
+extern	char*	cleanname(char*);
+extern	double	frexp(double, int*);
+extern	uintptr	getcallerpc(void*);
+extern	int	getfields(char*, char**, int, int, char*);
+extern	char*	getuser(void);
+extern	char*	getwd(char*, int);
+extern	double	ipow10(int);
+extern	double	ldexp(double, int);
+extern	double	modf(double, double*);
+#define	pow10	infpow10
+extern	double	pow10(int);
+extern	vlong	strtoll(const char*, char**, int);
+#define	qsort	infqsort
+extern	void	qsort(void*, long, long, int (*)(void*, void*));
+extern	uvlong	strtoull(const char*, char**, int);
+extern	void	sysfatal(char*, ...);
+extern	int	dec64(uchar*, int, char*, int);
+extern	int	enc64(char*, int, uchar*, int);
+extern	int	dec32(uchar*, int, char*, int);
+extern	int	enc32(char*, int, uchar*, int);
+extern	int	dec16(uchar*, int, char*, int);
+extern	int	enc16(char*, int, uchar*, int);
+extern	int	encodefmt(Fmt*);
+
+/*
+ *  synchronization
+ */
+typedef
+struct Lock {
+	int	val;
+	int	pid;
+} Lock;
+
+extern int	_tas(int*);
+
+extern	void	lock(Lock*);
+extern	void	unlock(Lock*);
+extern	int	canlock(Lock*);
+
+typedef struct QLock QLock;
+struct QLock
+{
+	Lock	use;			/* to access Qlock structure */
+	Proc	*head;			/* next process waiting for object */
+	Proc	*tail;			/* last process waiting for object */
+	int	locked;			/* flag */
+};
+
+extern	void	qlock(QLock*);
+extern	void	qunlock(QLock*);
+extern	int	canqlock(QLock*);
+extern	void	_qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */
+
+typedef
+struct RWLock
+{
+	Lock	l;			/* Lock modify lock */
+	QLock	x;			/* Mutual exclusion lock */
+	QLock	k;			/* Lock for waiting writers */
+	int	readers;		/* Count of readers in lock */
+} RWLock;
+
+extern	int	canrlock(RWLock*);
+extern	int	canwlock(RWLock*);
+extern	void	rlock(RWLock*);
+extern	void	runlock(RWLock*);
+extern	void	wlock(RWLock*);
+extern	void	wunlock(RWLock*);
+
+/*
+ * network dialing
+ */
+#define NETPATHLEN 40
+
+/*
+ * system calls
+ *
+ */
+#define	STATMAX	65535U	/* max length of machine-independent stat structure */
+#define	DIRMAX	(sizeof(Dir)+STATMAX)	/* max length of Dir structure */
+#define	ERRMAX	128	/* max length of error string */
+
+#define	MORDER	0x0003	/* mask for bits defining order of mounting */
+#define	MREPL	0x0000	/* mount replaces object */
+#define	MBEFORE	0x0001	/* mount goes before others in union directory */
+#define	MAFTER	0x0002	/* mount goes after others in union directory */
+#define	MCREATE	0x0004	/* permit creation in mounted directory */
+#define	MCACHE	0x0010	/* cache some data */
+#define	MMASK	0x0017	/* all bits on */
+
+#define	OREAD	0	/* open for read */
+#define	OWRITE	1	/* write */
+#define	ORDWR	2	/* read and write */
+#define	OEXEC	3	/* execute, == read but check execute permission */
+#define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
+#define	OCEXEC	32	/* or'ed in, close on exec */
+#define	ORCLOSE	64	/* or'ed in, remove on close */
+#define	OEXCL	0x1000	/* or'ed in, exclusive use (create only) */
+
+#define	AEXIST	0	/* accessible: exists */
+#define	AEXEC	1	/* execute access */
+#define	AWRITE	2	/* write access */
+#define	AREAD	4	/* read access */
+
+/* bits in Qid.type */
+#define QTDIR		0x80		/* type bit for directories */
+#define QTAPPEND	0x40		/* type bit for append only files */
+#define QTEXCL		0x20		/* type bit for exclusive use files */
+#define QTMOUNT		0x10		/* type bit for mounted channel */
+#define QTAUTH		0x08		/* type bit for authentication file */
+#define QTFILE		0x00		/* plain file */
+
+/* bits in Dir.mode */
+#define DMDIR		0x80000000	/* mode bit for directories */
+#define DMAPPEND	0x40000000	/* mode bit for append only files */
+#define DMEXCL		0x20000000	/* mode bit for exclusive use files */
+#define DMMOUNT		0x10000000	/* mode bit for mounted channel */
+#define DMAUTH		0x08000000	/* mode bit for authentication file */
+#define DMREAD		0x4		/* mode bit for read permission */
+#define DMWRITE		0x2		/* mode bit for write permission */
+#define DMEXEC		0x1		/* mode bit for execute permission */
+
+typedef
+struct Qid
+{
+	uvlong	path;
+	ulong	vers;
+	uchar	type;
+} Qid;
+
+typedef
+struct Dir {
+	/* system-modified data */
+	ushort	type;	/* server type */
+	uint	dev;	/* server subtype */
+	/* file data */
+	Qid	qid;	/* unique id from server */
+	ulong	mode;	/* permissions */
+	ulong	atime;	/* last read time */
+	ulong	mtime;	/* last write time */
+	vlong	length;	/* file length */
+	char	*name;	/* last element of path */
+	char	*uid;	/* owner name */
+	char	*gid;	/* group name */
+	char	*muid;	/* last modifier name */
+} Dir;
+
+extern	Dir*	dirstat(char*);
+extern	Dir*	dirfstat(int);
+extern	int	dirwstat(char*, Dir*);
+extern	int	dirfwstat(int, Dir*);
+extern	long	dirread(int, Dir**);
+extern	void	nulldir(Dir*);
+extern	long	dirreadall(int, Dir**);
+
+typedef
+struct Waitmsg
+{
+	int pid;	/* of loved one */
+	ulong time[3];	/* of loved one & descendants */
+	char	*msg;
+} Waitmsg;
+
+extern	void	_exits(char*);
+
+extern	void	exits(char*);
+extern	int	create(char*, int, int);
+extern	int	errstr(char*, uint);
+
+extern	void	perror(const char*);
+extern	long	readn(int, void*, long);
+extern	int	remove(const char*);
+extern	void	rerrstr(char*, uint);
+extern	vlong	seek(int, vlong, int);
+extern	int	segflush(void*, ulong);
+extern	void	werrstr(char*, ...);
+
+extern char *argv0;
+#define	ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
+			    argv[0] && argv[0][0]=='-' && argv[0][1];\
+			    argc--, argv++) {\
+				char *_args, *_argt;\
+				Rune _argc;\
+				_args = &argv[0][1];\
+				if(_args[0]=='-' && _args[1]==0){\
+					argc--; argv++; break;\
+				}\
+				_argc = 0;\
+				while(*_args && (_args += chartorune(&_argc, _args)))\
+				switch(_argc)
+#define	ARGEND		SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
+#define	ARGF()		(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
+#define	EARGF(x)	(_argt=_args, _args="",\
+				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
+
+#define	ARGC()		_argc
+
+/*
+ *	Extensions for Inferno to basic libc.h
+ */
+
+#define	setbinmode()
+

BIN
Nt/386/bin/awk.exe


BIN
Nt/386/bin/c2l.exe


BIN
Nt/386/bin/cat.exe


BIN
Nt/386/bin/cp.exe


BIN
Nt/386/bin/data2c.exe


BIN
Nt/386/bin/echo.exe


BIN
Nt/386/bin/format.exe


BIN
Nt/386/bin/gzip.exe


BIN
Nt/386/bin/infdb.exe


BIN
Nt/386/bin/iyacc.exe


BIN
Nt/386/bin/mk.exe


BIN
Nt/386/bin/mkdir.exe


BIN
Nt/386/bin/mkext.exe


BIN
Nt/386/bin/mv.exe


BIN
Nt/386/bin/rcsh.exe


BIN
Nt/386/bin/rm.exe


BIN
Nt/386/bin/sed.exe


Some files were not shown because too many files changed in this diff