Browse Source

Plan 9 from Bell Labs 2012-03-29

David du Colombier 12 years ago
parent
commit
9a78c50dc2

+ 2 - 2
rc/bin/patch/list

@@ -12,7 +12,7 @@ builtin cd /n/sources/patch || {
 	exit no-sources
 }
 
-if(~ $1 applied saved sorry maybe){
+if(~ $1 applied saved sorry maybe bad){
 	pref=$1^'/'
 	shift
 }
@@ -20,7 +20,7 @@ if(~ $#* 0)
 	*=(`{
 		if(~ $pref *?*)
 			builtin cd $pref
-		ls -t | grep -v '^(applied|saved|sorry|maybe)$'
+		ls -t | grep -v '^(applied|saved|sorry|maybe|bad)$'
 	})
 
 trunc=(sed 5q)

+ 0 - 4
sys/lib/dist/mkfile

@@ -82,10 +82,6 @@ odump:V:
 		-p /sys/lib/sysconfig/proto/allproto $scr/distdump.iso
 
 cd.install:V:
-#	if(~ $sysname achille){
-#		echo; echo; echo '*** run this on a real machine, like chips.'
-#		exit bad
-#	}
 	bzip2 -9 <$scr/plan9.iso >web.protect/nplan9.iso.bz2
 
 D.install:V:

+ 2 - 2
sys/man/6/ndb

@@ -186,7 +186,7 @@ attribute.
 .TP
 .B bootf
 file to download for initial bootstrap;
-.B /386/9pxeload
+.B /386/9boot
 to boot a PC via PXE.
 .TP
 .B ipnet
@@ -344,7 +344,7 @@ first database file searched
 .IR con (1),
 .IR dial (2),
 .IR ndb (2),
-.IR 9load (8),
+.IR 9boot (8),
 .IR booting (8),
 .IR dhcpd (8),
 .IR ipconfig (8),

+ 1 - 1
sys/man/6/vgadb

@@ -416,7 +416,7 @@ entries.
 .IR ndb (2),
 .IR vga (3),
 .IR ndb (6),
-.IR 9load (8),
+.IR 9boot (8),
 .IR vga (8)
 .br
 Richard E. Ferraro,

+ 20 - 15
sys/man/8/booting

@@ -24,7 +24,7 @@ reboots the machine;
 other methods of rebooting are mentioned for some machines.
 .SS PCs
 To boot a PC, it is necessary to get
-.B /386/9boot
+.B /386/9load
 or
 .B /386/9load
 loaded into memory.
@@ -36,14 +36,14 @@ will load
 .B 9load
 when the PC is reset or powered on.
 Other methods are described in 
-.IR 9boot (8).
-.I 9boot
+.IR 9load (8).
+.I 9load
 or
 .I 9load
 then locates and loads a Plan 9 kernel, using configuration information
 from the matching file in
 .B /cfg/pxe
-.RI ( 9boot )
+.RI ( 9load )
 or the file
 .B plan9.ini
 stored in the
@@ -51,7 +51,7 @@ stored in the
 configuration partition or on a DOS file system
 .RI ( 9load ).
 See 
-.IR 9boot (8)
+.IR 9load (8)
 for details.
 .PP
 Once the kernel is booted, it behaves like the others.
@@ -179,6 +179,12 @@ in lower case
 .L ether
 .I ndb
 attribute).
+If loading from a non-Plan-9
+TFTP server,
+replace
+.L %C
+with
+.BI /cfg/pxe/ MAC.
 .PP
 First, establish a
 .I /cfg/pxe
@@ -223,8 +229,8 @@ type this at U-boot once:
 .EX
 setenv bootdelay 2
 # \fItype the next two lines as one\fP
-setenv bootcmd 'bootp; bootp; tftp 0x1000 /cfg/pxe/\fIMAC\fP; bootp;
-	tftp 0x800000; go 0x800000'
+setenv bootcmd 'bootp; bootp; tftp 0x1000 %C; bootp; tftp 0x800000;
+	go 0x800000'
 saveenv
 .EE
 .PP
@@ -234,7 +240,7 @@ do the same but type this after
 instead:
 .IP
 .EX
-\&'dhcp; tftpboot; tftpboot 0x1000 /cfg/pxe/\fIMAC\fP; bootz 0x500000'
+\&'dhcp; tftpboot; tftpboot 0x1000 %C; bootz 0x500000'
 .EE
 .PP
 For Kirkwood Guruplugs,
@@ -242,7 +248,7 @@ type this after
 .LR "setenv bootcmd" :
 .IP
 .EX
-\&'dhcp 0x800000; tftp 0x1000 /cfg/pxe/\fIMAC\fP; go 0x800000'
+\&'dhcp 0x800000; tftp 0x1000 %C; go 0x800000'
 .EE
 .PP
 For IGEPv2 boards,
@@ -250,7 +256,7 @@ type this after
 .LR "setenv bootcmd" :
 .IP
 .EX
-\&'tftp 0x80300000 /cfg/pxe/\fIMAC\fP; dhcp 0x80310000; go 0x80310000'
+\&'tftp 0x80300000 %C; dhcp 0x80310000; go 0x80310000'
 .EE
 .PP
 For Gumstix Overo boards,
@@ -258,16 +264,15 @@ type this after
 .LR "setenv bootcmd" :
 .IP
 .EX
-\&'bootp 0x80310000; bootp 0x80300000 /cfg/pxe/\fIMAC\fP; go 0x80310000'
+\&'bootp 0x80310000; bootp 0x80300000 %C; go 0x80310000'
 .EE
 .PP
 For Trimslice systems,
-type this as one line after
+type this after
 .LR "setenv bootcmd" :
 .IP
 .EX
-\&'dhcp; dhcp; tftpboot 0x410000;
-	tftpboot 0x400000 /cfg/pxe/\fIMAC\fP; go 0x410000'
+\&'dhcp; dhcp; tftpboot 0x410000; tftpboot 0x400000 %C; go 0x410000'
 .EE
 .PP
 Thereafter, the boards will automatically boot via BOOTP and TFTP
@@ -275,7 +280,7 @@ when reset.
 .
 .SH "SEE ALSO"
 .IR ndb (6),
-.IR 9boot (8),
+.IR 9load (8),
 .IR boot (8),
 .IR init (8),
 .IR plan9.ini (8)

+ 2 - 2
sys/man/8/ndb

@@ -753,10 +753,10 @@ plan9.bell-labs.com ip	204.178.31.2
 >
 .EE
 .LP
-Print the names of all systems that boot via PXE.
+Print the names of all PCs that boot via PXE.
 .IP
 .EX
-% ndb/query -a bootf /386/9pxeload sys
+% ndb/query -a bootf /386/9boot sys
 .EE
 .SH FILES
 .TF /lib/ndb/local.*xxx

+ 3 - 1
sys/man/8/partfs

@@ -57,7 +57,9 @@ option causes
 to treat
 .I 9load-parts
 as a partition environment variable constructed by
-.IR 9load (8)
+.I 9load
+(see
+.IR 9boot (8))
 and adds the defined partitions.
 This is used primarily by
 .IR boot (8)

+ 113 - 109
sys/man/8/plan9.ini

@@ -1,15 +1,21 @@
 .TH PLAN9.INI 8
 .SH NAME
-plan9.ini \- configuration file for PCs
+plan9.ini \- configuration file primarily for PCs
 .SH SYNOPSIS
 .I none
 .SH DESCRIPTION
-When booting Plan 9 on a PC, the DOS program
+When booting Plan 9 on a PC, the bootstrap programs described in
 .IR 9load (8)
-first reads a DOS file
-containing configuration information from the boot disk.
+first read,
+via TFTP or a FAT filesystem on the boot disk,
+a file containing configuration information.
 This file,
-.BR plan9.ini ,
+.BI /cfg/pxe/ hex-digits
+(TFTP; see
+.IR 9load (8))
+or
+.B plan9.ini
+(FAT),
 looks like a shell script containing lines of the form
 .IP
 .EX
@@ -17,16 +23,6 @@ name=\f2value\fP
 .EE
 .LP
 each of which defines a kernel or device parameter.
-If
-.I 9load
-or
-.I 9pxeload
-loads the kernel over the network instead,
-this file will be named
-.BI /cfg/pxe/ hex-digits
-(see
-.IR 9load (8))
-on the local TFTP server.
 .PP
 Blank lines and
 Carriage Returns
@@ -53,21 +49,25 @@ and for Ethernets an override of the physical network address.
 Not all elements are relevant to all devices; the relevant values
 and their defaults are defined below in the description of each device.
 .PP
-The file is used by
-.B 9load
-and the kernel to configure the hardware available.
+The file is used by the bootstrap programs
+and the kernel to configure the hardware available,
+although nowadays the kernel can usually detect the attached hardware
+by itself.
 The information it contains is also passed to the boot
 process, and subsequently other programs,
 as environment variables
 (see
 .IR boot (8)).
 However, values whose names begin with an asterisk
-.B *
-are used by the kernel and are not converted into environment variables.
+.L *
+are used by the kernel and are stored in
+.L #ec
+rather than
+.LR #e .
 .PP
 The following sections describe how variables are used.
 .SS ETHERNET
-.SS \fLetherX=value\fP
+.SS \fLetherX=\fIvalue
 This defines an Ethernet interface.
 .IR X ,
 a unique monotonically increasing number beginning at 0,
@@ -81,9 +81,10 @@ detected are added.
 Almost all cards can be automatically detected.
 For debugging purposes, automatic probing can
 be disabled by specifying the line
-.BR *noetherprobe= .
+.LR *noetherprobe= .
+.ig
 This automatic probing is only done by the kernel, not by
-.IR 9load (8).
+the bootstrap programs.
 Thus, if you want to load a kernel over the Ethernet, you need
 to specify an
 .B ether0
@@ -91,6 +92,7 @@ line so that
 .I 9load
 can find the Ethernet card, even if the kernel would
 have automatically detected it.
+..
 .PP
 Some cards are software configurable and do not require all options.
 Unspecified options default to the factory defaults.
@@ -98,7 +100,6 @@ Unspecified options default to the factory defaults.
 Known
 .IR TYPE s
 are
-.\" .TF ga620
 .TF vt6102
 .PD
 .TP
@@ -122,6 +123,7 @@ and other cards using the Alteon Acenic chip such as the
 Alteon Acenic fiber and copper cards,
 the DEC DEGPA-SA and the SGI Acenic.
 Completely configurable.
+Can't boot through these due to enormous firmware loads.
 .TP
 .B dp83820
 National Semiconductor DP83820-based Gigabit Ethernet adapters, notably
@@ -140,9 +142,6 @@ Can't boot through these due to enormous firmware loads.
 .B i82598
 The Intel 8259[89] 10-Gigabit Ethernet PCI-Express controllers.
 Completely configurable.
-Can't boot through these due to lack of a
-.I 9load
-driver.
 .TP
 .B i82557
 Cards using the Intel 8255[789] Fast Ethernet PCI Bus LAN Controller such as the
@@ -191,6 +190,9 @@ Completely configurable.
 .B vt6102
 The VIA VT6102 Fast Ethernet Controller (Rhine II).
 .TP
+.B vt6105m
+The VIA VT6105M Fast Ethernet Controller (Rhine III).
+.TP
 .B smc91cxx
 SMC 91cXX chip-based PCMCIA adapters, notably the SMC EtherEZ card.
 .TP
@@ -409,7 +411,8 @@ Intersil Prism 2.5 chipset.
 (S)ATA controllers are autodetected.
 .SS \fLusbX=type=uhci\fP
 .SS \fLusbX=type=ohci\fP
-This specifies the settings for a USB UHCI or OHCI controller.
+.SS \fLusbX=type=ehci\fP
+This specifies the settings for a USB UHCI, OHCI or EHCI controller.
 Like the Ethernet controllers, USB controllers are autodetected
 after scanning for the ones listed in
 .IR plan9.ini .
@@ -419,7 +422,7 @@ line.
 Also like the Ethernet controllers, USB autoprobing can be
 disabled by specifying the line
 .BR *nousbprobe= .
-.SS \fLscsiX=value\fP
+.SS \fLscsiX=\fIvalue
 This defines a SCSI interface which cannot be automatically detected
 by the kernel.
 .PP
@@ -466,8 +469,8 @@ and
 .I slot
 to use as a root device for bootstrapping.
 .SS AUDIO
-.SS \fLaudioX=value\fP
-This defines a sound interface.
+.SS \fLaudioX=\fIvalue
+This defines a pre-USB sound interface.
 .PP
 Known types are
 .TF ess1688
@@ -515,7 +518,7 @@ and need no configuration lines.
 The line
 .B serial=type=com
 can be used to specify settings for a PCMCIA modem.
-.SS \fLmouseport=value\fP
+.SS \fLmouseport=\fIvalue
 This specifies where the mouse is attached.
 .I Value
 can be
@@ -532,13 +535,13 @@ for COM1
 .TP
 .B 1
 for COM2
-.SS \fLmodemport=value\fP
+.SS \fLmodemport=\fIvalue
 Picks the UART line to call out on.
 This is used when connecting to a file server over
 an async line.
 .I Value
 is the number of the port.
-.SS \fLconsole=value params\fP
+.SS \fLconsole=\fIvalue params
 This is used to specify the console device.
 The default
 value is
@@ -581,7 +584,7 @@ with odd parity.
 .SS "PC CARD"
 .SS \fLpccard0=disabled\fP
 Disable probing for and automatic configuration of PC card controllers.
-.SS \fLpcmciaX=type=XXX irq=value\fP
+.SS \fLpcmciaX=type=XXX irq=\fIirq
 If the default IRQ for the
 PCMCIA
 is correct, this entry can be omitted.  The value of
@@ -589,15 +592,49 @@ is correct, this entry can be omitted.  The value of
 is ignored.
 .SS \fLpcmcia0=disabled\fP
 Disable probing for and automatic configuration of PCMCIA controllers.
+.SS NVRAM
+.SS \fLnvram=\fIfile\fP
+.SS \fLnvrlen=\fIlength\fP
+.SS \fLnvroff=\fIoffset\fP
+This is used to specify an nvram device and optionally the length of the ram
+and read/write offset to use.
+These values are consulted by
+.I readnvram
+(see
+.IR authsrv (2)).
+The most common use of the nvram is to hold a
+.IR secstore (1)
+password for use by
+.IR factotum (4).
+.SS \fLnvr=\fIvalue
+This is used by the WORM file server kernel to locate a file holding information
+to configure the file system.
+The file cannot live on a SCSI disk.
+The default is
+.B fd!0!plan9.nvr
+(sic),
+unless
+.B bootfile
+is set, in which case it is
+.B plan9.nvr
+on the same disk as
+.BR bootfile .
+The syntax is either
+.BI fd! unit ! name
+or
+.BI hd! unit ! name
+where
+.I unit
+is the numeric unit id.
+This variant syntax is a vestige of the file server kernel's origins.
 .SS BOOTING
-.SS \fLbootfile=value\fP
+.SS \fLbootfile=\fIvalue
 This is used to direct the actions of
-.IR 9load (8)
+the bootstrap programs
 by naming the device and file from which to load the kernel.
-.SS \fLrootdir=dir\fP
-.SS \fLrootspec=spec\fP
-These are used by
-.IR 9load (8)
+.SS \fLrootdir=\fIdir
+.SS \fLrootspec=\fIspec
+These are used by the bootstrap programs
 to identify the directory
 .I dir
 to make the root directory for the kernel, and the
@@ -609,7 +646,7 @@ in
 .IR bind (2))
 on which it can be found.
 These are usually used to test variant file systems for distributions, etc.
-.SS \fLbootargs=value\fP
+.SS \fLbootargs=\fIargs
 The value of this variable is passed to
 .IR boot (8)
 by the kernel as the name of the root file system.
@@ -625,17 +662,17 @@ partition, the definition might read
 See
 .IR boot (8)
 for more.
-.SS \fLnobootprompt=value\fP
+.SS \fLnobootprompt=\fIroot
 Suppress the
 .L "root from"
 prompt and use
-.I value
+.I root
 as the answer instead.
-.SS \fLuser=value\fP
+.SS \fLuser=\fIuser
 Suppress the
 .L "user"
 prompt and use
-.I value
+.I user
 as the answer instead.
 .SS \fLdebugfactotum=\fP
 Causes
@@ -645,7 +682,7 @@ to start
 with the
 .B -p
 option, so that it can be debugged.
-.SS \fLfactotumopts=options\fP
+.SS \fLfactotumopts=\fIoptions
 Causes
 .IR boot (8)
 to start
@@ -653,7 +690,7 @@ to start
 with the given
 .IR options ,
 which must be a single word (i.e., contain no whitespace).
-.SS \fLventi=value\fP
+.SS \fLventi=\fIvalue
 When booting from a local fossil server backed by a local
 or remote venti server,
 this variable specifies how to establish the connection to the
@@ -661,22 +698,22 @@ venti server.
 See
 .IR boot (8)
 for more.
-.SS \fLcfs=value\fP
-This gives the name of the file holding the disk partition
+.SS \fLcfs=\fIpartition
+This names the file holding the disk partition
 for the cache file system,
 .IR cfs (4).
 Extending the
 .B bootargs
 example, one would write
 .BR cfs=#S/sdC0/cache .
-.SS \fLbootdisk=value\fP
+.SS \fLbootdisk=\fIvalue
 This deprecated variable was used to specify the disk used by
 the cache file system and other disk-resident services.
 It is superseded by
 .B bootargs
 and
 .BR cfs .
-.SS \fLpartition=value\fP
+.SS \fLpartition=\fIvalue
 This defines the partition table
 .IR 9load (8)
 will examine to find disk partitioning information.
@@ -691,7 +728,7 @@ consults only the first table,
 only the second.
 .SS \fLreadparts=\fP
 Causes
-.I boot
+.IR boot (8)
 to look for MBR and Plan 9 partition tables on all
 .IR sd (3)
 disks, even before
@@ -699,10 +736,12 @@ disks, even before
 is started, so NVRAM, for example, may be found.
 On PCs,
 .I 9load
-normally does this,
-so this variable is intended for other architectures.
-.SS \fLfs=a.b.c.d\fP
-.SS \fLauth=a.b.c.d\fP
+(but not
+.IR 9load )
+normally does this and passes the partitions found in
+.BR #ec/sd\fICn\fPpart .
+.SS \fLfs=\fIa.b.c.d
+.SS \fLauth=\fIa.b.c.d
 These specify the IP address of the file and authentication server
 to use when mounting a network-provided root file system.
 They are used only if the addresses cannot be determined via DHCP.
@@ -714,7 +753,7 @@ This variable disables such switches.
 .SS \fL*noe820scan=\fP
 When available, the PC kernel uses the BIOS E820 memory map
 to size memory.  This variable disables the scan.
-.SS \fL*maxmem=value\fP
+.SS \fL*maxmem=\fIaddress
 This defines the maximum physical address that the system will scan when sizing memory.
 By default the PC operating system will scan up to 3.75 gigabytes
 (0xF0000000, the base of kernel virtual address space), but setting
@@ -723,10 +762,10 @@ will limit the scan.
 .B *maxmem
 must be less than 3.75 gigabytes.
 This variable is not consulted if using the E820 memory map.
-.SS \fL*kernelpercent=value\fP
-This defines what percentage of available memory is reserved for the kernel allocation pool.
+.SS \fL*kernelpercent=\fIpercent
+This defines the percentage of available memory reserved for the kernel allocation pool.
 The remainder is left for user processes.  The default
-.I value
+.I percent
 is
 .B 30
 on CPU servers,
@@ -739,7 +778,7 @@ Terminals use more kernel memory because
 .IR draw (3)
 maintains its graphic images in kernel memory.
 This deprecated option is rarely necessary in newer kernels.
-.SS \fL*nomce=value\fP
+.SS \fL*nomce=\fIvalue
 If machine check exceptions are supported by the processor,
 then they are enabled by default.
 Setting this variable to
@@ -751,23 +790,23 @@ Setting
 .B *nomp
 restricts the kernel to starting only one processor and using the
 traditional interrupt controller.
-.SS \fL*ncpu=value\fP
+.SS \fL*ncpu=\fIcpus\fP
 Setting
 .B *ncpu
 restricts the kernel to starting at most
-.I value
+.I cpus
 processors.
-.SS \fL*pcimaxbno=value\fP
-This puts a limit on the maximum bus number probed
+.SS \fL*pcimaxbno=\fIbno\fP
+Limits the maximum bus number probed
 on a PCI bus (default 7).
 For example, a
-.I value
+.I bno
 of 1 should suffice on a 'standard' motherboard with an AGP slot.
 This, and
 .B *pcimaxdno
 below are rarely used and only on troublesome or suspect hardware.
-.SS \fL*pcimaxdno=value\fP
-This puts a limit on the maximum device number probed
+.SS \fL*pcimaxdno=\fIdno\fP
+Limits the maximum device number probed
 on a PCI bus (default 31).
 .SS \fL*nopcirouting=\fP
 Disable pci routing during boot.  May solve interrupt routing
@@ -778,14 +817,14 @@ Useful if there is only a limited cga screen available,
 otherwise the textual information about the panic may scroll off.
 .\" .SS \fL*nobios=\fP
 .\" what does this do?  something with pci
-.SS \fLioexclude=value\fP
+.SS \fLioexclude=\fIrange\fP
 Specifies a list of ranges of I/O ports to exclude from use by drivers.
 Ranges are inclusive on both ends and separated by commas.
 For example:
 .EX
     ioexclude=0x330-0x337,0x430-0x43F
 .EE
-.SS \fLumbexclude=value\fP
+.SS \fLumbexclude=\fIrange\fP
 Specifies a list of ranges of UMB to exclude from use by drivers.
 Ranges are inclusive on both ends and separated by commas.
 For example:
@@ -803,15 +842,15 @@ battery life (see
 .IR stats (8)).
 It is not on by default because it causes problems on some laptops.
 .SS VIDEO
-.SS \fLmonitor=value\fP
-.SS \fLvgasize=value\fP
+.SS \fLmonitor=\fImonitor
+.SS \fLvgasize=\fIx\fPx\fIy\fPx\fId
 These are used not by the kernel but by
 .I termrc
 (see
 .IR cpurc (8))
 when starting
 .IR vga (8).
-.SS \fL*dpms=value\fP
+.SS \fL*dpms=\fIvalue
 This is used to specify the screen blanking behavior of the MGA4xx
 video driver.
 Values are
@@ -821,41 +860,6 @@ and
 .BR off .
 The first two specify differing levels of power saving;
 the third turns the monitor off completely.
-.SS NVRAM
-.SS \fLnvram=file\fP
-.SS \fLnvrlen=length\fP
-.SS \fLnvroff=offset\fP
-This is used to specify an nvram device and optionally the length of the ram
-and read/write offset to use.
-These values are consulted by
-.I readnvram
-(see
-.IR authsrv (2)).
-The most common use of the nvram is to hold a
-.IR secstore (1)
-password for use by
-.IR factotum (4).
-.SS \fLnvr=value\fP
-This is used by the WORM file server kernel to locate a file holding information
-to configure the file system.
-The file cannot live on a SCSI disk.
-The default is
-.B fd!0!plan9.nvr
-(sic),
-unless
-.B bootfile
-is set, in which case it is
-.B plan9.nvr
-on the same disk as
-.BR bootfile .
-The syntax is either
-.BI fd! unit ! name
-or
-.BI hd! unit ! name
-where
-.I unit
-is the numeric unit id.
-This variant syntax is a vestige of the file server kernel's origins.
 .SS Multiple Configurations
 .PP
 A

+ 1 - 1
sys/man/8/update

@@ -119,7 +119,7 @@ prototype files.
 .B /rc/bin/pc/*
 .SH "SEE ALSO"
 .IR kfs (4),
-.IR 9load (8),
+.IR 9boot (8),
 .IR mkfs (8),
 .IR prep (8),
 .IR sd (3)

+ 2 - 2
sys/man/8/vga

@@ -80,7 +80,7 @@ value.
 is usually set by including it in the
 .B plan9.ini
 file read by the PC boot program
-.IR 9load (8).
+.IR 9boot (8).
 .TP
 .B -p
 print the current or expected register values at appropriate points depending on
@@ -204,7 +204,7 @@ VGA configuration file.
 .SH SEE ALSO
 .IR vga (3),
 .IR vgadb (6),
-.IR 9load (8)
+.IR 9boot (8)
 .SH BUGS
 .B Aux/vga
 makes every effort possible to verify that the mode it is about

+ 5 - 1
sys/src/9/pc/vgavmware.c

@@ -176,7 +176,11 @@ vmwarelinear(VGAscr* scr, int, int)
 	if(p == nil)
 		error(err[0]? err: "no vmware vga card found");
 
-	vgalinearaddr(scr, vmrd(vm, Rfbstart), vmrd(vm, Rfbsize));
+	/*
+	 * empirically, 2*fbsize enables 1280x1024x32, not just 1024x768x32.
+	 * is fbsize in bytes or pixels?
+	 */
+	vgalinearaddr(scr, vmrd(vm, Rfbstart), 2*vmrd(vm, Rfbsize));
 	if(scr->apsize)
 		addvgaseg("vmwarescreen", scr->paddr, scr->apsize);
 }

+ 19 - 2
sys/src/9/port/portclock.c

@@ -7,6 +7,10 @@
 #include "ureg.h"
 #include "../port/error.h"
 
+enum {
+	Maxtimerloops = 20*1000,
+};
+
 struct Timers
 {
 	Lock;
@@ -14,6 +18,7 @@ struct Timers
 };
 
 static Timers timers[MAXMACH];
+static int timersinited;
 
 ulong intrcount[MAXMACH];
 ulong fcallcount[MAXMACH];
@@ -166,15 +171,18 @@ timerintr(Ureg *u, Tval)
 	Timer *t;
 	Timers *tt;
 	uvlong when, now;
-	int callhzclock;
+	int count, callhzclock;
 	static int sofar;
 
 	intrcount[m->machno]++;
 	callhzclock = 0;
 	tt = &timers[m->machno];
 	now = fastticks(nil);
+	if(now == 0)
+		panic("timerintr: zero fastticks()");
 	ilock(tt);
-	while(t = tt->head){
+	count = Maxtimerloops;
+	while((t = tt->head) != nil){
 		/*
 		 * No need to ilock t here: any manipulation of t
 		 * requires tdel(t) and this must be done with a
@@ -201,6 +209,12 @@ timerintr(Ureg *u, Tval)
 		ilock(tt);
 		if(t->tmode == Tperiodic)
 			tadd(tt, t);
+		if (--count <= 0) {
+			count = Maxtimerloops;
+			iprint("timerintr: probably stuck in while loop; "
+				"scrutinise clock.c or use faster cycle "
+				"counter\n");
+		}
 	}
 	iunlock(tt);
 }
@@ -213,6 +227,7 @@ timersinit(void)
 	/*
 	 * T->tf == nil means the HZ clock for this processor.
 	 */
+	timersinited = 1;
 	todinit();
 	t = malloc(sizeof(*t));
 	if(t == nil)
@@ -230,6 +245,8 @@ addclock0link(void (*f)(void), int ms)
 	Timer *nt;
 	uvlong when;
 
+	if(!timersinited)
+		panic("addclock0link: timersinit not called yet");
 	/* Synchronize to hztimer if ms is 0 */
 	nt = malloc(sizeof(Timer));
 	if(nt == nil)

+ 0 - 4
sys/src/cmd/5a/a.h

@@ -175,9 +175,5 @@ int	mywait(int*);
 int	mycreat(char*, int);
 int	systemtype(int);
 int	pathchar(void);
-char*	mygetwd(char*, int);
-int	myexec(char*, char*[]);
-int	mydup(int, int);
 int	myfork(void);
-int	mypipe(int*);
 void*	mysbrk(ulong);

+ 9 - 2
sys/src/cmd/5a/lex.c

@@ -311,6 +311,11 @@ struct
 	"MOVWD",	LTYPE3, AMOVWD,
 	"MOVWF",		LTYPE3, AMOVWF,
 
+	"LDREX",		LTYPE3, ALDREX,
+	"LDREXD",		LTYPE3, ALDREXD,
+	"STREX",		LTYPE9, ASTREX,
+	"STREXD",		LTYPE9, ASTREXD,
+
 /*
 	"ABSF",		LTYPEI, AABSF,
 	"ABSD",		LTYPEI, AABSD,
@@ -326,6 +331,8 @@ struct
 	"NRMD",		LTYPEI,	ANRMD,
 */
 
+	"SQRTF",	LTYPEI, ASQRTF,
+	"SQRTD",	LTYPEI, ASQRTD,
 	"CMPF",		LTYPEL, ACMPF,
 	"CMPD",		LTYPEL, ACMPD,
 	"ADDF",		LTYPEK,	AADDF,
@@ -417,9 +424,9 @@ cinit(void)
 	}
 
 	pathname = allocn(pathname, 0, 100);
-	if(mygetwd(pathname, 99) == 0) {
+	if(getwd(pathname, 99) == 0) {
 		pathname = allocn(pathname, 100, 900);
-		if(mygetwd(pathname, 999) == 0)
+		if(getwd(pathname, 999) == 0)
 			strcpy(pathname, "/???");
 	}
 }

+ 1 - 1
sys/src/cmd/5a/mkfile

@@ -16,4 +16,4 @@ BIN=/$objtype/bin
 < /sys/src/cmd/mkone
 YFLAGS=-D1 -d
 
-lex.$O:	../cc/macbody ../cc/lexbody ../cc/compat
+lex.$O:	../cc/macbody ../cc/lexbody

+ 1 - 1
sys/src/cmd/5c/gc.h

@@ -3,7 +3,7 @@
 
 /*
  * 5c/arm
- * Arm 7500
+ * Arm
  */
 #define	SZ_CHAR		1
 #define	SZ_SHORT	2

+ 2 - 2
sys/src/cmd/5c/peep.c

@@ -1069,7 +1069,7 @@ copyu(Prog *p, Adr *v, Adr *s)
 		if(v->type == D_REG) {
 			if(v->reg <= REGEXT && v->reg > exregoffset)
 				return 2;
-			if(v->reg == REGARG)
+			if(v->reg == (uchar)REGARG)
 				return 2;
 		}
 		if(v->type == D_FREG)
@@ -1087,7 +1087,7 @@ copyu(Prog *p, Adr *v, Adr *s)
 
 	case ATEXT:	/* funny */
 		if(v->type == D_REG)
-			if(v->reg == REGARG)
+			if(v->reg == (uchar)REGARG)
 				return 3;
 		return 0;
 	}

+ 1 - 1
sys/src/cmd/5c/reg.c

@@ -1125,7 +1125,7 @@ RtoB(int r)
 int
 BtoR(long b)
 {
-	b &= 0x01fcL;
+	b &= 0x01fcL;	// excluded R9 and R10 for m and g
 	if(b == 0)
 		return 0;
 	return bitno(b);

+ 3 - 3
sys/src/cmd/5c/swt.c

@@ -579,7 +579,7 @@ align(long i, Type *t, int op)
 			w = packflg;
 		break;
 
-	case Ael1:	/* initial allign of struct element */
+	case Ael1:	/* initial align of struct element */
 		for(v=t; v->etype==TARRAY; v=v->link)
 			;
 		w = ewidth[v->etype];
@@ -600,7 +600,7 @@ align(long i, Type *t, int op)
 		}
 		break;
 
-	case Aarg1:	/* initial allign of parameter */
+	case Aarg1:	/* initial align of parameter */
 		w = ewidth[t->etype];
 		if(w <= 0 || w >= SZ_LONG) {
 			w = SZ_LONG;
@@ -614,7 +614,7 @@ align(long i, Type *t, int op)
 		w = SZ_LONG;
 		break;
 
-	case Aaut3:	/* total allign of automatic */
+	case Aaut3:	/* total align of automatic */
 		o = align(o, t, Ael2);
 		o = align(o, t, Ael1);
 		w = SZ_LONG;	/* because of a pun in cc/dcl.c:contig() */

+ 21 - 3
sys/src/cmd/ndb/dn.c

@@ -17,6 +17,7 @@ enum {
 	Deftarget	= 1<<30,	/* effectively disable aging */
 	Minage		= 1<<30,
 	Defagefreq	= 1<<30,	/* age names this often (seconds) */
+	Restartmins	= 600,
 
 	/* these settings will trigger frequent aging */
 //	Deftarget	= 4000,
@@ -139,6 +140,7 @@ char *opname[] =
 };
 
 ulong target = Deftarget;
+ulong start;
 Lock	dnlock;
 
 static ulong agefreq = Defagefreq;
@@ -715,6 +717,17 @@ putactivity(int recursive)
 	unlock(&dnvars);
 
 	db2cache(needrefresh);
+
+	/* if we've been running for long enough, restart */
+	if(start == 0)
+		start = time(nil);
+	if(0 && time(nil) - start > Restartmins*60){	// TODO
+		dnslog("killing all dns procs for timed restart");
+		postnote(PNGROUP, getpid(), "die");
+		dnvars.mutex = 0;
+		exits("restart");
+	}
+
 	dnageall(0);
 
 	/* let others back in */
@@ -2006,11 +2019,16 @@ rrfree(RR *rp)
 	assert(rp->magic == RRmagic);
 	assert(!rp->cached);
 
+	/* our callers often hold dnlock.  it's needed to examine dp safely. */
 	dp = rp->owner;
 	if(dp){
-		assert(dp->magic == DNmagic);
-		for(nrp = dp->rr; nrp; nrp = nrp->next)
-			assert(nrp != rp);	/* "rrfree of live rr" */
+		/* if someone else holds dnlock, skip the sanity check. */
+		if (canlock(&dnlock)) {
+			assert(dp->magic == DNmagic);
+			for(nrp = dp->rr; nrp; nrp = nrp->next)
+				assert(nrp != rp);   /* "rrfree of live rr" */
+			unlock(&dnlock);
+		}
 	}
 
 	switch(rp->type){

+ 41 - 16
sys/src/cmd/ndb/dns.c

@@ -25,6 +25,8 @@ typedef struct Mfile	Mfile;
 typedef struct Job	Job;
 typedef struct Network	Network;
 
+extern	ulong	start;
+
 int vers;		/* incremented each clone/attach */
 
 static volatile int stop;
@@ -115,6 +117,20 @@ usage(void)
 	exits("usage");
 }
 
+void
+justremount(char *service, char *mntpt)
+{
+	int f;
+
+	f = open(service, ORDWR);
+	if(f < 0)
+		abort(); 	/* service */;
+	while (mount(f, -1, mntpt, MAFTER, "") < 0) {
+		dnslog("dns mount -a on %s failed: %r", mntpt);
+		sleep(5000);
+	}
+}
+
 void
 main(int argc, char *argv[])
 {
@@ -211,9 +227,10 @@ main(int argc, char *argv[])
 		sysfatal("%s exists; another dns instance is running",
 			servefile);
 	free(dir);
-//	unmount(servefile, mntpt);
-//	remove(servefile);
 
+	/* don't unmount here; could deadlock */
+//	while (unmount(servefile, mntpt) >= 0)
+//		;
 	mountinit(servefile, mntpt);	/* forks, parent exits */
 
 	srand(now*getpid());
@@ -226,11 +243,18 @@ main(int argc, char *argv[])
 	 * fork without sharing heap.
 	 * parent waits around for child to die, then forks & restarts.
 	 * child may spawn udp server, notify procs, etc.; when it gets too
-	 * big, it kills itself and any children.
-	 * /srv/dns and /net/dns remain open and valid.
+	 * big or too old, it kills itself and any children.
+	 *
+	 * /srv/dns remains open and valid, but /net/dns was only mounted in
+	 * a child's separate namespace from 9p service, to avoid a deadlock
+	 * from serving our own namespace, so we must remount it upon restart,
+	 * in a separate process and namespace.
 	 */
 	for (;;) {
-		kid = rfork(RFPROC|RFFDG|RFNOTEG);
+		start = time(nil);
+		/* don't unmount here; could deadlock */
+//		unmount(servefile, mntpt);
+		kid = rfork(RFPROC|RFFDG|RFNOTEG|RFNAMEG);
 		switch (kid) {
 		case -1:
 			sysfatal("fork failed: %r");
@@ -239,14 +263,14 @@ main(int argc, char *argv[])
 				dnudpserver(mntpt);
 			if(sendnotifies)
 				notifyproc();
-			io();
+			io();		/* serve 9p; return implies restart */
 			_exits("restart");
-		default:
-			while ((pid = waitpid()) != kid && pid != -1)
-				continue;
-			break;
 		}
-		dnslog("dns restarting");
+		sleep(1000);	/* wait for 9p service to start */
+		justremount(servefile, mntpt);
+		while ((pid = waitpid()) != kid && pid != -1)
+			continue;
+		dnslog("restarting");
 	}
 }
 
@@ -280,11 +304,11 @@ mountinit(char *service, char *mntpt)
 
 	if(pipe(p) < 0)
 		abort(); /* "pipe failed" */;
-	/* copy namespace to avoid a deadlock */
-	switch(rfork(RFFDG|RFPROC|RFNAMEG)){
+	switch(rfork(RFFDG|RFPROC)){
 	case 0:			/* child: hang around and (re)start main proc */
 		close(p[1]);
 		procsetname("%s restarter", mntpt);
+		mfd[0] = mfd[1] = p[0];
 		break;
 	case -1:
 		abort(); /* "fork failed\n" */;
@@ -304,12 +328,13 @@ mountinit(char *service, char *mntpt)
 
 		/*
 		 *  put ourselves into the file system
+		 *  it's too soon; we need 9p service running.
 		 */
-		if(mount(p[1], -1, mntpt, MAFTER, "") < 0)
-			fprint(2, "dns mount failed: %r\n");
+//		if(mount(p[1], -1, mntpt, MAFTER, "") < 0)
+//			dnslog("dns mount -a on %s failed: %r", mntpt);
+		close(p[1]);
 		_exits(0);
 	}
-	mfd[0] = mfd[1] = p[0];
 }
 
 Mfile*

+ 5 - 1
sys/src/cmd/upas/fs/imap4.c

@@ -412,7 +412,11 @@ starttls(Imap *imap, TLSconn *connp)
 		return -1;
 	}
 	sha1(connp->cert, connp->certlen, digest, nil);
-	if(!imap->thumb || !okThumbprint(digest, imap->thumb)){
+	/*
+	 * don't do this any more.  our local it people are rotating their
+	 * certificates faster than we can keep up.
+	 */
+	if(0 && (!imap->thumb || !okThumbprint(digest, imap->thumb))){
 		close(sfd);
 		werrstr("server certificate %.*H not recognized",
 			SHA1dlen, digest);

+ 5 - 1
sys/src/cmd/upas/fs/pop3.c

@@ -130,7 +130,11 @@ pop3pushtls(Pop *pop)
 		return "server did not provide TLS certificate";
 	}
 	sha1(conn.cert, conn.certlen, digest, nil);
-	if(!pop->thumb || !okThumbprint(digest, pop->thumb)){
+	/*
+	 * don't do this any more.  our local it people are rotating their
+	 * certificates faster than we can keep up.
+	 */
+	if(0 && (!pop->thumb || !okThumbprint(digest, pop->thumb))){
 		fmtinstall('H', encodefmt);
 		close(fd);
 		free(conn.cert);

+ 5 - 1
sys/src/cmd/usb/usbd/usbd.c

@@ -731,6 +731,10 @@ cfswrite(Usbfs*, Fid *, void *data, long cnt, vlong )
 		werrstr("reset not implemented");
 		return -1;
 	}
+	if(strncmp(buf, "exit", 4) == 0){
+		threadexitsall(nil);
+		return cnt;
+	}
 	if(tokenize(buf, toks, nelem(toks)) != 2){
 		werrstr("usage: debug|fsdebug n");
 		return -1;
@@ -744,7 +748,7 @@ cfswrite(Usbfs*, Fid *, void *data, long cnt, vlong )
 	else if(strcmp(toks[0], "diskargs") == 0)
 		setdrvargs("disk", toks[1]);
 	else{
-		werrstr("unkown ctl '%s'", buf);
+		werrstr("unknown ctl '%s'", buf);
 		return -1;
 	}
 	fprint(2, "%s: debug %d fsdebug %d\n", argv0, usbdebug, usbfsdebug);