diffs wrt plan 9. Reference: /n/patches.lsub.org/patch/plan9-20120531 Date: Thu May 31 17:48:03 CES 2012 Signed-off-by: nemo@lsub.org # rm /sys/src/9/pcboot/mboot.s # rm /sys/src/9/pcboot/mbootstart.s --- /rc/bin/pdf2ps Thu Apr 12 12:24:35 2012 +++ /rc/bin/pdf2ps Thu May 31 16:51:11 2012 @@ -1,19 +1,26 @@ #!/bin/rc -# pdf2ps [gs-options] [input.pdf] [output.ps] - generate PS from PDF +# pdf2ps [-e] [gs-options] [input.pdf [output.ps]] - generate (e)ps from pdf rfork e -fn cleanup { } fn usage { - echo 'usage: pdf2ps [gs-options] [input.pdf] [output.ps]' >[1=2] + echo 'usage: pdf2ps [-e] [gs-options] [input.pdf [output.ps]]' >[1=2] exit usage } +outdev=pswrite +fin=/fd/0 +fout=/fd/1 lang=(-'dLanguageLevel=2') opt=() while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 - --){ if(~ $1 '-dLanguageLevel='*) lang=() - opt=($opt $1) + if not if(~ '-?' $1) + usage + if(~ $1 -e) + outdev=epswrite + if not + opt=($opt $1) shift } if(~ $1 --) @@ -21,11 +28,9 @@ switch($#*){ case 0 - fin=- - fout=- + ; case 1 fin=$1 - fout=- case 2 fin=$1 fout=$2 @@ -33,12 +38,8 @@ usage } -if(~ $fin -){ - # fin=/tmp/pdf2ps.$pid.^`{date -n} - # fn cleanup { rm -f $fin } - # cat >$tmp +if(~ $fin -) fin=/fd/0 -} if(~ $fout -) fout=/fd/1 @@ -46,8 +47,5 @@ # pages. We have to include the options twice because -I only takes # effect if it appears before other options. -gs $opt -dSAFER -dNOPAUSE -dBATCH -q -s'DEVICE=pswrite' \ - $opt $lang \ - -s'OutputFile='$fout -c save pop -f $fin - -cleanup +exec gs $opt -dSAFER -dNOPAUSE -dBATCH -q -s'DEVICE='$outdev $opt $lang \ + -s'OutputFile=-' -c save pop -f $fin >$fout --- /sys/doc/port.ms Thu Apr 12 12:24:37 2012 +++ /sys/doc/port.ms Thu May 31 16:50:22 2012 @@ -278,13 +278,10 @@ The system currently works only with mice on the PS/2 port or USB. Serial mouse support should return before long. .PP -Once you have Plan 9 installed (see the wiki's installation document) -run the program -.CW ld -from DOS -or use a boot disk. See +Once you have Plan 9 installed (see the wiki's installation document), +use PXE or a boot disk to load the system. See .I booting (8), -.I 9load (8), +.I 9boot (8), and .I prep (8) for more information. @@ -370,7 +367,6 @@ that it does not exploit. There are currently drivers for a Fast Ethernet interface, -.\" USB and the console serial port; we hope to add crypto acceleration, and a video driver. .SH @@ -386,7 +382,21 @@ interface in the IGEPv2 and Overo, and the console serial port; we hope to add USB, flash memory and video drivers. -. +.SH +The Nvidia Tegra2 operating system +.PP +This is an ARM kernel for the dual Cortex-A9 processors +in the Nvidia Tegra2 system-on-a-chip +and it emulates pre-VFPv3 floating-point and +CAS (compare-and-swap) instructions +(the hardware has VFP3 floating-point but +.CW 5l +doesn't generate the new opcodes yet). +It runs on the Compulab Trimslice. +There are many features of the system-on-a-chip that it does not exploit. +Initially, there are drivers for the Ethernet interface +and the console serial port; +we hope to add USB, flash memory and video drivers. . .ig .SH --- /sys/doc/port.ps Thu Apr 12 12:24:37 2012 +++ /sys/doc/port.ps Thu May 31 16:50:22 2012 @@ -5523,51 +5523,48 @@ (should) 4712 2628 w (return before long.) 720 2748 w (Once) 970 2904 w -(you) 1259 2904 w -(have) 1476 2904 w -(Plan) 1743 2904 w -(9) 1986 2904 w -(installed) 2091 2904 w -(\(see) 2544 2904 w -(the) 2782 2904 w -(wiki) 2979 2904 w +(you) 1255 2904 w +(have) 1468 2904 w +(Plan) 1731 2904 w +(9) 1970 2904 w +(installed) 2071 2904 w +(\(see) 2520 2904 w +(the) 2754 2904 w +(wiki) 2947 2904 w 10 /LucidaSansUnicode20 f -(\031) 3172 2904 w +(\031) 3140 2904 w 10 /LucidaSansUnicode00 f -(s) 3204 2904 w -(installation) 3297 2904 w -(document\)) 3875 2904 w -(run) 4436 2904 w -(the) 4644 2904 w -(pro\255) 4842 2904 w -(gram) 720 3024 w -10 /LucidaTypewriter f -(ld) 1013 3024 w -10 /LucidaSansUnicode00 f -(from) 1199 3024 w -(DOS) 1473 3024 w -(or) 1722 3024 w -(use) 1866 3024 w -(a) 2077 3024 w -(boot) 2174 3024 w -(disk.) 2438 3024 w -(See) 2745 3024 w +(s) 3172 2904 w +(installation) 3261 2904 w +(document\),) 3836 2904 w +(use) 4425 2904 w +(PXE) 4633 2904 w +(or) 4844 2904 w +(a) 4985 2904 w +(boot) 720 3024 w +(disk) 986 3024 w +(to) 1231 3024 w +(load) 1373 3024 w +(the) 1625 3024 w +(system.) 1824 3024 w +(See) 2272 3024 w 10 /LucidaSans-Italic f -(booting) 2953 3024 w +(booting) 2482 3024 w 10 /LucidaSansUnicode00 f -(\(8\),) 3318 3024 w +(\(8\),) 2847 3024 w 10 /LucidaSans-Italic f -(9load) 3521 3024 w +(9boot) 3052 3024 w 10 /LucidaSansUnicode00 f -(\(8\),) 3792 3024 w -(and) 3995 3024 w +(\(8\),) 3328 3024 w +(and) 3533 3024 w 10 /LucidaSans-Italic f -(prep) 4216 3024 w +(prep) 3757 3024 w 10 /LucidaSansUnicode00 f -(\(8\)) 4439 3024 w -(for) 4609 3024 w -(more) 4789 3024 w -(information.) 720 3144 w +(\(8\)) 3980 3024 w +(for) 4153 3024 w +(more) 4335 3024 w +(informa\255) 4629 3024 w +(tion.) 720 3144 w 10 /LucidaSans-Demi f (The Alpha PC operating system) 720 3384 w 10 /LucidaSansUnicode00 f @@ -6082,6 +6079,94 @@ (USB,) 4547 3708 w (flash) 4806 3708 w (memory and video drivers.) 720 3828 w +10 /LucidaSans-Demi f +(The Nvidia Tegra2 operating system) 720 4068 w +10 /LucidaSansUnicode00 f +(This) 970 4224 w +(is) 1230 4224 w +(an) 1365 4224 w +(ARM) 1537 4224 w +(kernel) 1810 4224 w +(for) 2167 4224 w +(the) 2361 4224 w +(dual) 2571 4224 w +(Cortex-A9) 2835 4224 w +(processors) 3405 4224 w +(in) 3987 4224 w +(the) 4133 4224 w +(Nvidia) 4343 4224 w +(Tegra2) 4700 4224 w +(system-on-a-chip) 720 4344 w +(and) 1671 4344 w +(it) 1905 4344 w +(emulates) 2025 4344 w +(pre-VFPv3) 2518 4344 w +(floating-point) 3078 4344 w +(and) 3813 4344 w +(CAS) 4046 4344 w +(\(compare-and-) 4291 4344 w +(swap\)) 720 4464 w +(instructions) 1044 4464 w +(\(the) 1662 4464 w +(hardware) 1895 4464 w +(has) 2390 4464 w +(VFP3) 2603 4464 w +(floating-point) 2885 4464 w +(but) 3612 4464 w +10 /LucidaTypewriter f +(5l) 3819 4464 w +10 /LucidaSansUnicode00 f +(doesn) 4008 4464 w +10 /LucidaSansUnicode20 f +(\031) 4301 4464 w +10 /LucidaSansUnicode00 f +(t) 4333 4464 w +(generate) 4415 4464 w +(the) 4885 4464 w +(new) 720 4584 w +(opcodes) 957 4584 w +(yet\).) 1405 4584 w +(It) 1688 4584 w +(runs) 1795 4584 w +(on) 2052 4584 w +(the) 2216 4584 w +(Compulab) 2412 4584 w +(Trimslice.) 2948 4584 w +(There) 3495 4584 w +(are) 3814 4584 w +(many) 4007 4584 w +(features) 4310 4584 w +(of) 4746 4584 w +(the) 4885 4584 w +(system-on-a-chip) 720 4704 w +(that) 1663 4704 w +(it) 1900 4704 w +(does) 2012 4704 w +(not) 2289 4704 w +(exploit.) 2495 4704 w +(Initially,) 2941 4704 w +(there) 3370 4704 w +(are) 3668 4704 w +(drivers) 3867 4704 w +(for) 4247 4704 w +(the) 4433 4704 w +(Ethernet) 4635 4704 w +(interface) 720 4824 w +(and) 1199 4824 w +(the) 1433 4824 w +(console) 1642 4824 w +(serial) 2067 4824 w +(port;) 2382 4824 w +(we) 2670 4824 w +(hope) 2857 4824 w +(to) 3153 4824 w +(add) 3305 4824 w +(USB,) 3540 4824 w +(flash) 3807 4824 w +(memory) 4095 4824 w +(and) 4545 4824 w +(video) 4779 4824 w +(drivers.) 720 4944 w cleartomark showpage saveobj restore --- /sys/games/lib/fortunes Mon Apr 23 15:42:01 2012 +++ /sys/games/lib/fortunes Thu May 31 16:41:06 2012 @@ -4292,3 +4292,4 @@ people who program actually have a lot to learn from the fashion industry. -someone on hacker news Does that say 25 or 29? - rae; It says PH1. - jmk "The advantage of being an Ethernet device is so strong that even the plip interface (the interface that uses the printer ports) declares itself as [one]" - some linux book +Error: Dependency is not satisfiable: libpython2.7 (>= 2.7) --- /sys/lib/dist/pc/mkfile Mon Apr 23 15:38:41 2012 +++ /sys/lib/dist/pc/mkfile Thu May 31 16:44:45 2012 @@ -55,11 +55,9 @@ # binding 9loadusb onto 9load will store the name 9loadusb in the # generated fat filesystem. the same is true for plan9.ini.cd and plan9.ini. -9load: /386/9loadlite +9load: /386/9load cp $prereq $target -# if (test -e /386/9loadnousb) -# cp /386/9loadnousb $target # cater to old bioses - cp /386/9loadlitedebug 9loaddebug + cp /386/9loaddebug 9loaddebug ndisk: 9load /sys/src/9/pc/9pcflop.gz plan9.ini /lib/vgadb dd -if /dev/zero -of ndisk -bs 1024 -count 1440 >[2]/dev/null @@ -76,7 +74,7 @@ cp -x plan9.ini.cd subst/plan9.ini dd -if /dev/zero -of cddisk -bs 1024 -count 2880 >[2]/dev/null disk/format -t 3½QD -f -b /386/pbs -d cddisk \ - 9load /sys/src/9/pc/^(9pcflop.gz 9pccd.gz) \ + /sys/src/9/pc/^(9pcflop.gz 9pccd.gz) \ subst/plan9.ini /lib/vgadb ls -l cddisk --- /sys/lib/dist/pc/sub/boota: Thu Apr 12 12:24:43 2012 +++ /sys/lib/dist/pc/sub/boota: Thu May 31 16:44:11 2012 @@ -1,5 +1,5 @@ #!/bin/rc - +# boota: rfork e if(! test -f /srv/dos) dossrv >/dev/null [2]/dev/null @@ -8,7 +8,7 @@ switch($bootfile) { case sd*!cdboot!* # just look for the right file. bootfile isn''t trustworthy - adisk=/dev/sd*/cdboot + adisk=/dev/sd*/9fat if(! ~ $#adisk 1) adisk=$adisk(1) case sd* @@ -21,4 +21,3 @@ } mount -c /srv/dos /n/a: $adisk - --- /sys/lib/dist/pc/sub/termrc Thu Apr 12 12:24:43 2012 +++ /sys/lib/dist/pc/sub/termrc Thu May 31 16:44:11 2012 @@ -1,5 +1,5 @@ #!/bin/rc - +# termrc if(~ $#debug 1 && ~ $debug yes) flag x + if not @@ -118,4 +118,3 @@ echo -n 'hwblank off' >'#v/vgactl' >[2]/dev/null } } - --- /sys/lib/sysconfig/proto/portproto Thu Apr 12 12:24:52 2012 +++ /sys/lib/sysconfig/proto/portproto Thu May 31 16:46:28 2012 @@ -169,13 +169,13 @@ tab.utf tab.37 log - cs 666 sys sys /sys/lib/pcdist/disk/empty - dns 666 sys sys /sys/lib/pcdist/disk/empty - mail 666 sys sys /sys/lib/pcdist/disk/empty - smtp 666 sys sys /sys/lib/pcdist/disk/empty - smtpd 666 sys sys /sys/lib/pcdist/disk/empty - listen 666 sys sys /sys/lib/pcdist/disk/empty - ipboot 666 sys sys /sys/lib/pcdist/disk/empty + cs 666 sys sys /sys/lib/dist/pc/emptyfile + dns 666 sys sys /sys/lib/dist/pc/emptyfile + mail 666 sys sys /sys/lib/dist/pc/emptyfile + smtp 666 sys sys /sys/lib/dist/pc/emptyfile + smtpd 666 sys sys /sys/lib/dist/pc/emptyfile + listen 666 sys sys /sys/lib/dist/pc/emptyfile + ipboot 666 sys sys /sys/lib/dist/pc/emptyfile man fonts 1pub --- /sys/man/1/ps2pdf Thu Apr 12 12:24:56 2012 +++ /sys/man/1/ps2pdf Thu May 31 16:51:11 2012 @@ -15,6 +15,9 @@ .PP .B pdf2ps [ +.B -e +] +[ .I gs-options ] [ @@ -37,6 +40,11 @@ nor .I output-file is not specified, they read from standard input and write to standard output. +.PP +Under +.BR -e , +.I pdf2ps +emits Encapsulated Postscript (eps). .PP The .I gs-options --- /sys/man/8/9boot Mon May 14 11:54:48 2012 +++ /sys/man/8/9boot Thu May 31 16:42:00 2012 @@ -548,4 +548,5 @@ .B bios and .B sdB -usually only work on the first LBA device in the BIOS's list of boot devices. +usually only work on the first LBA device in the BIOS's list of boot devices, +if they work at all. --- /sys/man/8/plan9.ini Thu Apr 12 12:25:01 2012 +++ /sys/man/8/plan9.ini Thu May 31 16:33:20 2012 @@ -5,14 +5,14 @@ .I none .SH DESCRIPTION When booting Plan 9 on a PC, the bootstrap programs described in -.IR 9load (8) +.IR 9boot (8) first read, via TFTP or a FAT filesystem on the boot disk, a file containing configuration information. This file, .BI /cfg/pxe/ hex-digits (TFTP; see -.IR 9load (8)) +.IR 9boot (8)) or .B plan9.ini (FAT), @@ -89,12 +89,12 @@ to specify an .B ether0 line so that -.I 9load +.I 9boot 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. +Many cards are software configurable and do not require all options. Unspecified options default to the factory defaults. .PP Known @@ -123,7 +123,6 @@ 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 @@ -137,7 +136,6 @@ .B m10g The Myricom 10-Gigabit Ethernet 10G-PCIE-8A controller. Completely configurable. -Can't boot through these due to enormous firmware loads. .TP .B i82598 The Intel 8259[89] 10-Gigabit Ethernet PCI-Express controllers. @@ -737,7 +735,7 @@ On PCs, .I 9load (but not -.IR 9load ) +.IR 9boot ) normally does this and passes the partitions found in .BR #ec/sd\fICn\fPpart . .SS \fLfs=\fIa.b.c.d @@ -1012,7 +1010,7 @@ audio0=type=sb16 port=0x220 irq=5 dma=1 .EE .SH "SEE ALSO" -.IR 9load (8), +.IR 9boot (8), .IR booting (8), .IR boot (8) .SH BUGS --- /sys/man/8/prep Mon May 21 11:17:11 2012 +++ /sys/man/8/prep Thu May 31 16:33:20 2012 @@ -165,7 +165,7 @@ .IR swap (8) swap partition. .PD -.PP +.SS "fdisk and prep" .I Fdisk edits the PC partition table and is usually invoked with a disk like @@ -478,7 +478,7 @@ .I fdisk will display a list of choices and then prompt for it. .PD -.PP +.SS "format and pbs" .I Format prepares for use the disk partition or the floppy diskette in the file named .IR disk , @@ -617,7 +617,7 @@ The file .B /386/pbs is an example of a suitable -.I bfile +.I bootblock to make the disk a boot disk. It gets loaded by the BIOS at 0x7C00, reads the first sector of the @@ -632,7 +632,9 @@ .B /386/pbslba is similar, but because it uses LBA addressing (not supported by older BIOSes), it can access more than the first 8.5GB of the disk. -.PP +.B /386/pbsraw +is suitable for CDs. +.SS mbr .I Mbr installs a new boot block in sector 0 (the master boot record) of a disk such as @@ -733,6 +735,7 @@ .IR sd (3), .IR usb (4), .IR 9boot (8), +.IR mk9660 (8), .IR mkusbboot (8), .IR partfs (8) .SH BUGS --- /sys/src/9/mkfile Mon May 21 11:17:13 2012 +++ /sys/src/9/mkfile Thu May 31 16:33:21 2012 @@ -13,15 +13,24 @@ cd $i mk } + # build pc boots last + @{ cd pc; mk clean } + @{ cd pcboot; mk } +pcboot:V: + @{ cd pc; mk clean } + @{ cd pcboot; mk } installall install:V: for(i in $ARCH) @{ cd $i mk install } + @{ cd pc; mk clean } + @{ cd pcboot; mk install } + @{ cd pc; mk clean } clean:V: - for(i in $ARCH) @{ + for(i in $ARCH pcboot) @{ cd $i mk clean } --- /sys/src/9/pc/archmp.c Thu Apr 12 12:25:05 2012 +++ /sys/src/9/pc/archmp.c Thu May 31 16:50:56 2012 @@ -48,7 +48,7 @@ } else{ p = ((bda[0x14]<<8)|bda[0x13])*1024; - if(mp = mpscan(KADDR(p-1024), 1024)) + if(p != 0 && (mp = mpscan(KADDR(p-1024), 1024)) != nil) return mp; } return mpscan(KADDR(0xF0000), 0x10000); --- /sys/src/9/pc/ether8169.c Thu Apr 12 12:25:05 2012 +++ /sys/src/9/pc/ether8169.c Thu May 31 16:44:11 2012 @@ -113,6 +113,7 @@ Macv15 = 0x38800000, /* RTL8100E */ // Macv19 = 0x3c000000, /* dup Macv12a: RTL8111c-gr */ Macv25 = 0x28000000, /* RTL8168D */ + Macv2c = 0x2c000000, /* RTL8168E */ Ifg0 = 0x01000000, /* Interframe Gap 0 */ Ifg1 = 0x02000000, /* Interframe Gap 1 */ }; @@ -737,6 +738,7 @@ case Macv14: case Macv15: case Macv25: + case Macv2c: break; } @@ -1091,6 +1093,7 @@ case Macv14: case Macv15: case Macv25: + case Macv2c: break; } return 0; --- /sys/src/9/pc/ether82598.c Thu Apr 12 12:25:05 2012 +++ /sys/src/9/pc/ether82598.c Thu May 31 16:49:12 2012 @@ -583,34 +583,31 @@ e = v; c = e->ctlr; m = c->nrd - 1; - rdh = 0; -loop: - replenish(c, rdh); - im(c, Irx0); - sleep(&c->rrendez, rim, c); -loop1: - c->rim = 0; - if(c->nrd - c->rdfree >= 16) + for (rdh = 0; ; rdh = Next(rdh, m)) { replenish(c, rdh); - r = c->rdba + rdh; - if(!(r->status & Rdd)) - goto loop; /* UGH */ - b = c->rb[rdh]; - c->rb[rdh] = 0; - b->wp += r->length; - b->lim = b->wp; /* lie like a dog */ - if(!(r->status & Ixsm)){ - if(r->status & Ipcs) - b->flag |= Bipck; - if(r->status & Tcpcs) - b->flag |= Btcpck | Budpck; - b->checksum = r->cksum; + im(c, Irx0); + sleep(&c->rrendez, rim, c); + do { + c->rim = 0; + if(c->nrd - c->rdfree >= 16) + replenish(c, rdh); + r = c->rdba + rdh; + } while(!(r->status & Rdd)); + b = c->rb[rdh]; + c->rb[rdh] = 0; + b->wp += r->length; + b->lim = b->wp; /* lie like a dog */ + if(!(r->status & Ixsm)){ + if(r->status & Ipcs) + b->flag |= Bipck; + if(r->status & Tcpcs) + b->flag |= Btcpck | Budpck; + b->checksum = r->cksum; + } +// r->status = 0; + etheriq(e, b, 1); + c->rdfree--; } -// r->status = 0; - etheriq(e, b, 1); - c->rdfree--; - rdh = Next(rdh, m); - goto loop1; /* UGH */ } static void --- /sys/src/9/pc/etherigbe.c Thu Apr 12 12:25:05 2012 +++ /sys/src/9/pc/etherigbe.c Thu May 31 16:49:12 2012 @@ -820,8 +820,10 @@ edev = arg; ctlr = edev->ctlr; for(;;){ - if(ctlr->mii == nil || ctlr->mii->curphy == nil) + if(ctlr->mii == nil || ctlr->mii->curphy == nil) { + sched(); continue; + } /* * To do: --- /sys/src/9/pc/l.s Thu Apr 26 16:19:16 2012 +++ /sys/src/9/pc/l.s Thu May 31 16:33:21 2012 @@ -756,8 +756,13 @@ * FNxxx variations) so WAIT instructions must be explicitly placed in the * code as necessary. */ -#define FPOFF ;\ +#define FPOFF(l) ;\ + MOVL CR0, AX ;\ + ANDL $0xC, AX /* EM, TS */ ;\ + CMPL AX, $0x8 ;\ + JEQ l ;\ WAIT ;\ +l: ;\ MOVL CR0, AX ;\ ANDL $~0x4, AX /* EM=0 */ ;\ ORL $0x28, AX /* NE=1, TS=1 */ ;\ @@ -769,7 +774,7 @@ MOVL AX, CR0 TEXT fpoff(SB), $0 /* disable */ - FPOFF + FPOFF(l1) RET TEXT fpinit(SB), $0 /* enable and init */ @@ -785,9 +790,9 @@ RET TEXT fpx87save(SB), $0 /* save state and disable */ - MOVL p+0(FP), AX /* points to pointer */ + MOVL p+0(FP), AX FSAVE 0(AX) /* no WAIT */ - FPOFF + FPOFF(l2) RET TEXT fpx87restore(SB), $0 /* enable and restore state */ @@ -809,13 +814,13 @@ TEXT fpclear(SB), $0 /* clear pending exceptions */ FPON FCLEX /* no WAIT */ - FPOFF + FPOFF(l3) RET TEXT fpssesave0(SB), $0 /* save state and disable */ MOVL p+0(FP), AX FXSAVE /* no WAIT */ - FPOFF + FPOFF(l4) RET TEXT fpsserestore0(SB), $0 /* enable and restore state */ --- /sys/src/9/pc/mp.c Thu Apr 12 12:25:06 2012 +++ /sys/src/9/pc/mp.c Thu May 31 16:44:12 2012 @@ -25,6 +25,7 @@ extern int i8259elcr; /* mask of level-triggered interrupts */ /* static */ Apic mpapic[MaxAPICNO+1]; /* static */ int machno2apicno[MaxAPICNO+1]; /* inverse map: machno -> APIC ID */ +/* static */ Apic ioapic[MaxAPICNO+1]; static Ref mpvnoref; /* unique vector assignment */ static int mpmachno = 1; static Lock mpphysidlock; @@ -161,7 +162,7 @@ if((va = vmap(p->addr, 1024)) == nil) return 0; - apic = &mpapic[apicno]; + apic = &ioapic[apicno]; apic->type = PcmpIOAPIC; apic->apicno = apicno; apic->addr = va; @@ -217,7 +218,7 @@ } if ((unsigned)p->apicno >= nelem(mpapic)) panic("mkiointr: apic %d out of range", p->apicno); - aintr->apic = &mpapic[p->apicno]; + aintr->apic = &ioapic[p->apicno]; aintr->next = bus->aintr; bus->aintr = aintr; --- /sys/src/9/pcboot/bootld.c Mon May 14 11:35:57 2012 +++ /sys/src/9/pcboot/bootld.c Thu May 31 16:42:00 2012 @@ -331,6 +331,7 @@ warp9(ulong entry) { // prstackuse(0); /* debugging */ + mkmultiboot(); impulse(); /* get out of KZERO space, turn off paging and jump to entry */ --- /sys/src/9/pcboot/bootmkfile Mon May 14 13:15:34 2012 +++ /sys/src/9/pcboot/bootmkfile Thu May 31 16:41:06 2012 @@ -1,5 +1,5 @@ # make 9boot(pbs) and 9load(usb) -# inherit KTZERO, START, MBOOT, CONF, BASE and SFX from mkfile +# inherit KTZERO, START, CONF, BASE and SFX from mkfile x=`{bindpc $BASE $SFX} CONFLIST=$CONF EXTRACOPIES= @@ -39,7 +39,6 @@ $START\ l32p.$O\ l32v.$O\ - $MBOOT\ l64p.$O\ realmode0.$O\ l.$O\ @@ -102,7 +101,6 @@ devfloppy.$O: floppy.h inflate.$O: /sys/include/flate.h main.$O: reboot.h -l16r.$O mbootstart.$O: mboot.s sd53c8xx.$O: sd53c8xx.i sdiahci.$O: ahci.h trap.$O: /sys/include/tos.h --- /sys/src/9/pcboot/l16r.s Mon May 14 11:36:44 2012 +++ /sys/src/9/pcboot/l16r.s Thu May 31 16:42:00 2012 @@ -25,37 +25,6 @@ TEXT _start16r(SB), $0 CLI /* interrupts off */ - /* make the jump conditional to keep 8l from moving _multibootheader */ - LWI(1, rAX) - SUBI(1, rAX) - JEQ pastmboothdr - -/* - * Must be 4-byte aligned & within 8K of the image's start. - */ - NOP - NOP -#include "mboot.s" - -TEXT _hello(SB), $0 - BYTE $'\r'; - BYTE $'\n'; - BYTE $'P'; BYTE $'l'; BYTE $'a'; BYTE $'n'; - BYTE $' '; BYTE $'9'; BYTE $' '; BYTE $'f'; - BYTE $'r'; BYTE $'o'; BYTE $'m'; BYTE $' '; - BYTE $'B'; BYTE $'e'; BYTE $'l'; BYTE $'l'; - BYTE $' '; BYTE $'L'; BYTE $'a'; BYTE $'b'; - BYTE $'s'; - BYTE $'\z'; - -TEXT _DI(SB), $0 - BYTE $0; BYTE $0; BYTE $0; BYTE $0; - -TEXT _ES(SB), $0 - BYTE $0; BYTE $0; BYTE $0; BYTE $0; - - /* continued from before _multibootheader */ -pastmboothdr: MFSR(rCS, rAX) MTSR(rAX, rDS) /* set the data segment */ @@ -122,18 +91,18 @@ /* * Check for APM1.2 BIOS support. */ -_apmstart: LWI(0x5304, rAX) /* disconnect anyone else */ CLR(rBX) BIOSCALL(0x15) + JCS _apmfail LWI(0x5303, rAX) /* connect */ CLR(rBX) CLC BIOSCALL(0x15) - JCC _apmpush - LW(_ES(SB), rAX) +_apmfail: + LW(_ES(SB), rAX) /* no support */ MTSR(rAX, rES) LW(_DI(SB), rDI) JCS _apmend @@ -168,8 +137,6 @@ * ES/DI on failure. Consequently they may not be valid * at _e820end:. */ - -_e820start: SW(rDI, _DI(SB)) /* save DI */ CLR(rAX) /* write terminator */ STOSW @@ -189,7 +156,7 @@ LLI(0x534D4150, rDX) /* signature - ASCII "SMAP" */ LLI(0x0000E820, rAX) /* function code */ - BIOSCALL(0x15) + BIOSCALL(0x15) /* writes 20 bytes at (es,di) */ JCS _e820pop /* some kind of error */ LLI(0x534D4150, rDX) @@ -246,3 +213,20 @@ MTSR(rAX, rSS) FARJUMP32(SELECTOR(2, SELGDT, 0), _start32p-KZERO(SB)) + +TEXT _hello(SB), $0 + BYTE $'\r'; + BYTE $'\n'; + BYTE $'P'; BYTE $'l'; BYTE $'a'; BYTE $'n'; + BYTE $' '; BYTE $'9'; BYTE $' '; BYTE $'f'; + BYTE $'r'; BYTE $'o'; BYTE $'m'; BYTE $' '; + BYTE $'B'; BYTE $'e'; BYTE $'l'; BYTE $'l'; + BYTE $' '; BYTE $'L'; BYTE $'a'; BYTE $'b'; + BYTE $'s'; + BYTE $'\z'; + +TEXT _DI(SB), $0 + LONG $0 + +TEXT _ES(SB), $0 + LONG $0 --- /sys/src/9/pcboot/l32v.s Fri May 11 00:07:17 2012 +++ /sys/src/9/pcboot/l32v.s Thu May 31 16:42:00 2012 @@ -68,6 +68,7 @@ HLT RET +#ifdef UNUSED /* */ TEXT _warp9o(SB), $0 @@ -118,6 +119,7 @@ JMP* BP JMP _idle +#endif /* * input a byte --- /sys/src/9/pcboot/ldecomp.s Mon May 14 11:36:55 2012 +++ /sys/src/9/pcboot/ldecomp.s Thu May 31 16:42:00 2012 @@ -35,13 +35,10 @@ MOVW CS, AX MOVW AX, DS - /* from ../l16r.s */ LWI(0, rAX) /* always put stack in first 64k */ MTSR(rAX, rSS) LWI(origin(SB), rSP) /* set the stack pointer */ - DELAY - LWI(0x2401, rAX) /* enable a20 line */ BIOSCALL(0x15) @@ -66,9 +63,6 @@ LWI(_hello(SB), rSI) CALL _cgaputs(SB) -/* - * start of transplanted apm & e820 scan code from l16r.s - */ LLI(BIOSTABLES, rAX) /* tables in low memory, not after end */ OPSIZE; ANDL $~(BY2PG-1), AX OPSIZE; SHRL $4, AX @@ -81,7 +75,6 @@ /* * Check for APM1.2 BIOS support. */ - DELAY LWI(0x5304, rAX) /* disconnect anyone else */ CLR(rBX) BIOSCALL(0x15) @@ -96,7 +89,6 @@ LW(_ES(SB), rAX) /* no support */ MTSR(rAX, rES) LW(_DI(SB), rDI) - DELAY JCS _apmend _apmpush: @@ -110,7 +102,6 @@ LW(_ES(SB), rAX) MTSR(rAX, rES) LW(_DI(SB), rDI) - DELAY LWI(0x5041, rAX) /* first 4 bytes are APM\0 */ STOSW @@ -131,7 +122,7 @@ * at _e820end:. */ SW(rDI, _DI(SB)) /* save DI */ - CLR(rAX) /* write terminator (for APM?) */ + CLR(rAX) /* write terminator */ STOSW STOSW @@ -180,11 +171,7 @@ LW(_DI(SB), rDI) CLR(rAX) MTSR(rAX, rES) - DELAY _e820end: -/* - * end of transplanted apm & e820 scan code from l16r.s - */ /* * goto protected mode --- /sys/src/9/pcboot/mkfile Mon May 14 13:15:34 2012 +++ /sys/src/9/pcboot/mkfile Thu May 31 16:41:07 2012 @@ -56,7 +56,7 @@ 9bootmain 9bootmaindebug:V: cp boot bootmain @ { rfork ne; bind bootmkfile mkfile - KTZERO=$BOOTBASE CONF=bootmain NPROC=$ONPROC MBOOT=mbootstart.$O + KTZERO=$BOOTBASE CONF=bootmain NPROC=$ONPROC mk all } # creating $O.expand also creates $O.expanddebug, out of mk's sight --- /sys/src/9/pcboot/realmode.c Fri May 11 00:07:17 2012 +++ /sys/src/9/pcboot/realmode.c Thu May 31 16:41:07 2012 @@ -52,7 +52,7 @@ /* copy l.s so that it can be run from 16-bit mode */ sz = (char *)realmodeend - (char *)KTZERO; if (sz > RMSIZE) - panic("RMCODE < %d bytes", sz); + panic("real mode code %d bytes > %d", sz, RMSIZE); rmseg = (RMCODE - KZERO) >> 4; /* into JMPFAR instr. */ memmove((void*)RMCODE, (void*)KTZERO, sz); } --- /sys/src/9/pcboot/realmode0.s Fri May 11 00:07:17 2012 +++ /sys/src/9/pcboot/realmode0.s Thu May 31 16:41:07 2012 @@ -270,3 +270,47 @@ RET TEXT realmodeend(SB), $0 + +/* + * Must be 4-byte aligned & within 8K of the image's start to be seen. + */ + NOP + NOP + NOP +TEXT _multibootheader(SB), $0 /* CHECK alignment (4) */ + LONG $0x1BADB002 /* magic */ + LONG $0x00010003 /* flags */ + LONG $-(0x1BADB002 + 0x00010003) /* checksum */ + LONG $_multibootheader-KZERO(SB) /* header_addr */ + LONG $_start32p-KZERO(SB) /* load_addr */ + LONG $edata-KZERO(SB) /* load_end_addr */ + LONG $end-KZERO(SB) /* bss_end_addr */ + LONG $_start32p-KZERO(SB) /* entry_addr */ + LONG $0 /* mode_type */ + LONG $0 /* width */ + LONG $0 /* height */ + LONG $0 /* depth */ + + LONG $0 /* +48: saved AX - magic */ + LONG $0 /* +52: saved BX - info* */ + +/* + * There's no way with 8[al] to make this into local data, hence + * the TEXT definitions. Also, it should be in the same segment as + * the LGDT instruction. + * In real mode only 24-bits of the descriptor are loaded so the + * -KZERO is superfluous for the usual mappings. + * The segments are + * NULL + * DATA 32b 4GB PL0 + * EXEC 32b 4GB PL0 + * EXEC 16b 4GB PL0 + */ +TEXT _gdt16r(SB), $0 + LONG $0x0000; LONG $0 + LONG $0xFFFF; LONG $(SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(0)|SEGDATA|SEGW) + LONG $0xFFFF; LONG $(SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(0)|SEGEXEC|SEGR) + LONG $0xFFFF; LONG $(SEGG |(0xF<<16)|SEGP|SEGPL(0)|SEGEXEC|SEGR) +TEXT _gdtptr16r(SB), $0 + WORD $(4*8) + LONG $_gdt16r-KZERO(SB) --- /sys/src/9/pcboot/warp64.c Fri May 11 00:07:17 2012 +++ /sys/src/9/pcboot/warp64.c Thu May 31 16:49:13 2012 @@ -6,8 +6,39 @@ #include "io.h" #include "ureg.h" +enum { + Ax, + Bx, + Cx, + Dx, + + /* + * common to intel & amd + */ + Extfunc = 0x80000000, + Procsig, + + /* Procsig bits */ + Dxlongmode = 1<<29, +}; + typedef unsigned long long u64intptr; +static int +havelongmode(void) +{ + ulong regs[4]; + + memset(regs, 0, sizeof regs); + cpuid(Extfunc, regs); + if(regs[Ax] < Extfunc) + return 0; + + memset(regs, 0, sizeof regs); + cpuid(Procsig, regs); + return (regs[Dx] & Dxlongmode) != 0; +} + void warp64(uvlong entry) { @@ -15,6 +46,11 @@ extern void _warp64(ulong); print("warp64(%#llux) %#llux %d\n", entry, entry & ~kzero64, nmmap); + if(!havelongmode()) { + print("can't run 64-bit kernel on 32-bit cpu\n"); + delay(5000); + exit(0); + } if(v_flag) print("mkmultiboot\n"); mkmultiboot(); --- /sys/src/9/teg2/words Mon May 14 10:03:18 2012 +++ /sys/src/9/teg2/words Thu May 31 16:49:13 2012 @@ -1,5 +1,5 @@ this is a plan 9 port to the Trimslice with tegra2 soc: dual-core, -dual-issue 1GHz Cortex-A9 system. +dual-issue 1GHz Cortex-A9 system (v7a arch). dram is 1GB at 0. linux believes that u-boot runs in the bottom 4MB. --- /sys/src/cmd/aux/vga/mga4xx.c Thu Apr 12 12:25:25 2012 +++ /sys/src/cmd/aux/vga/mga4xx.c Thu May 31 16:41:07 2012 @@ -1080,7 +1080,7 @@ ctlr->flag |= Ulinear; /* - * Set the right bppShitf based on depth + * Set the right bppShift based on depth */ switch(mode->z) { --- /sys/src/cmd/gs/9fixes Thu Jan 1 00:00:00 1970 +++ /sys/src/cmd/gs/9fixes Thu May 31 16:44:45 2012 @@ -0,0 +1 @@ +gdevpsft.c: limit range of doubles before converting to integers. --- /sys/src/cmd/lp/lpsend.c Thu Apr 12 12:25:53 2012 +++ /sys/src/cmd/lp/lpsend.c Thu May 31 16:50:56 2012 @@ -217,7 +217,7 @@ if (*jobbuf == '\0') error(1, "read failed\n"); else - error(1, "received <0x%x> instead\n", *jobbuf); + error(1, "received <%#x> instead\n", (uchar)*jobbuf); rv = 0; } else rv = 1; alarm(0); --- /sys/src/libndb/dnsquery.c Thu Apr 12 12:26:24 2012 +++ /sys/src/libndb/dnsquery.c Thu May 31 16:50:56 2012 @@ -81,7 +81,7 @@ char *p, *np; int len; - if(strstr(ip, "in-addr.arpa") || strstr(ip, "IN-ADDR.ARPA")){ + if(cistrstr(ip, "in-addr.arpa") || cistrstr(ip, "ip6.arpa")){ nstrcpy(rip, ip, rlen); return; }