Browse Source

Plan 9 from Bell Labs 2003-11-02

David du Colombier 17 years ago
parent
commit
9a56d75026
100 changed files with 2942 additions and 2323 deletions
  1. 167 161
      dist/replica/plan9.db
  2. 202 0
      dist/replica/plan9.log
  3. 22 0
      mail/lib/white.starter
  4. 20 0
      sys/doc/compiler.ms
  5. 2 0
      sys/games/lib/fortunes
  6. 15 1
      sys/include/libc.h
  7. 21 0
      sys/include/tos.h
  8. 21 0
      sys/include/trace.h
  9. 6 0
      sys/man/1/hget
  10. 26 0
      sys/man/1/prof
  11. 9 1
      sys/man/2/quote
  12. 3 2
      sys/man/3/cons
  13. 80 1
      sys/man/3/proc
  14. 113 298
      sys/man/3/realtime
  15. 8 1
      sys/man/8/qer
  16. 17 5
      sys/man/8/smtp
  17. 6 3
      sys/man/8/stats
  18. 1 0
      sys/src/9/alphapc/dat.h
  19. 1 0
      sys/src/9/alphapc/fns.h
  20. 19 0
      sys/src/9/alphapc/l.s
  21. 2 1
      sys/src/9/alphapc/mkfile
  22. 0 1
      sys/src/9/bitsy/bitsy
  23. 1 0
      sys/src/9/bitsy/dat.h
  24. 1 0
      sys/src/9/bitsy/devpenmouse.c
  25. 1 0
      sys/src/9/bitsy/fns.h
  26. 22 0
      sys/src/9/bitsy/main.c
  27. 2 1
      sys/src/9/bitsy/mkfile
  28. 13 4
      sys/src/9/bitsy/trap.c
  29. 1 1
      sys/src/9/boot/paq.c
  30. 3 3
      sys/src/9/ip/devip.c
  31. 3 5
      sys/src/9/ip/tcp.c
  32. 1 0
      sys/src/9/mtx/dat.h
  33. 3 2
      sys/src/9/mtx/fns.h
  34. 20 0
      sys/src/9/mtx/l.s
  35. 2 1
      sys/src/9/mtx/mkfile
  36. 2 1
      sys/src/9/mtx/trap.c
  37. 18 20
      sys/src/9/pc/archmp.c
  38. 1 1
      sys/src/9/pc/dat.h
  39. 7 7
      sys/src/9/pc/ether8390.c
  40. 2 2
      sys/src/9/pc/etherga620.c
  41. 79 20
      sys/src/9/pc/etherigbe.c
  42. 2 2
      sys/src/9/pc/fns.h
  43. 4 4
      sys/src/9/pc/i8253.c
  44. 1 0
      sys/src/9/pc/io.h
  45. 131 4
      sys/src/9/pc/l.s
  46. 18 1
      sys/src/9/pc/main.c
  47. 5 3
      sys/src/9/pc/mkfile
  48. 4 4
      sys/src/9/pc/pc
  49. 0 1
      sys/src/9/pc/pccpu
  50. 26 1
      sys/src/9/pc/pccpuf
  51. 0 2
      sys/src/9/pc/pcdisk
  52. 0 1
      sys/src/9/pc/pcf
  53. 3 4
      sys/src/9/pc/pcflop
  54. 3 3
      sys/src/9/pc/piix4smbus.c
  55. 1 0
      sys/src/9/pc/sdata.c
  56. 96 22
      sys/src/9/pc/trap.c
  57. 69 28
      sys/src/9/pc/uarti8250.c
  58. 0 22
      sys/src/9/port/alarm.c
  59. 1 1
      sys/src/9/port/alloc.c
  60. 2 2
      sys/src/9/port/allocb.c
  61. 9 9
      sys/src/9/port/chan.c
  62. 1 4
      sys/src/9/port/dev.c
  63. 1 1
      sys/src/9/port/devaudio.c
  64. 6 0
      sys/src/9/port/devcons.c
  65. 5 2
      sys/src/9/port/devfs.c
  66. 7 19
      sys/src/9/port/devloopback.c
  67. 8 8
      sys/src/9/port/devmnt.c
  68. 9 8
      sys/src/9/port/devmouse.c
  69. 267 22
      sys/src/9/port/devproc.c
  70. 7 0
      sys/src/9/port/devroot.c
  71. 28 20
      sys/src/9/port/devuart.c
  72. 454 1014
      sys/src/9/port/edf.c
  73. 35 152
      sys/src/9/port/edf.h
  74. 2 0
      sys/src/9/port/fault.c
  75. 2 2
      sys/src/9/port/pgrp.c
  76. 90 73
      sys/src/9/port/portclock.c
  77. 83 48
      sys/src/9/port/portdat.h
  78. 22 4
      sys/src/9/port/portfns.h
  79. 2 1
      sys/src/9/port/portmkfile
  80. 96 70
      sys/src/9/port/proc.c
  81. 2 8
      sys/src/9/port/qlock.c
  82. 39 19
      sys/src/9/port/sysfile.c
  83. 14 4
      sys/src/9/port/sysproc.c
  84. 31 7
      sys/src/9/port/taslock.c
  85. 139 51
      sys/src/9/port/tod.c
  86. 2 3
      sys/src/9/ppc/blast
  87. 12 13
      sys/src/9/ppc/dat.h
  88. 10 11
      sys/src/9/ppc/devirq.c
  89. 8 1
      sys/src/9/ppc/fns.h
  90. 226 11
      sys/src/9/ppc/l.s
  91. 2 2
      sys/src/9/ppc/mkfile
  92. 3 3
      sys/src/9/ppc/ucu
  93. 0 21
      sys/src/cmd/1a/lex.c
  94. 0 21
      sys/src/cmd/2a/lex.c
  95. 0 21
      sys/src/cmd/5a/lex.c
  96. 3 0
      sys/src/cmd/5c/list.c
  97. 2 0
      sys/src/cmd/5c/txt.c
  98. 1 0
      sys/src/cmd/5i/stats.c
  99. 0 21
      sys/src/cmd/6a/lex.c
  100. 5 1
      sys/src/cmd/6c/list.c

File diff suppressed because it is too large
+ 167 - 161
dist/replica/plan9.db


+ 202 - 0
dist/replica/plan9.log

@@ -13933,3 +13933,205 @@
 1067120173 0 c sys/src/9/bitsy/mkfile - 664 sys sys 1067120164 2454
 1067279475 0 c 386/bin/stats - 775 sys sys 1067278459 188751
 1067279475 1 c sys/src/cmd/stats.c - 664 sys sys 1067278458 28129
+1067720495 0 c sys/games/lib/fortunes - 664 sys sys 1067718902 246583
+1067720495 1 c sys/include/libc.h - 664 sys sys 1067718922 19305
+1067720495 2 a sys/include/tos.h - 664 sys sys 1067718947 562
+1067720495 3 c sys/man/1/prof - 664 sys sys 1067718952 3561
+1067720495 4 c sys/man/2/quote - 664 sys sys 1067719062 3072
+1067720495 5 c sys/src/9/bitsy/mkfile - 664 sys sys 1067718907 2466
+1067720495 6 c sys/src/cmd/jpg/mkfile - 664 sys sys 1067719079 1000
+1067720495 7 c sys/src/cmd/jpg/torgbv.c - 664 sys sys 1067719080 6443
+1067720495 8 a sys/src/cmd/jpg/yuv.c - 664 sys sys 1067719080 4234
+1067720495 9 c sys/src/cmd/du.c - 664 sys sys 1067719067 3144
+1067720495 10 c sys/src/cmd/prof.c - 664 sys sys 1067718957 5521
+1067720495 11 c sys/src/libc/386/argv0.s - 664 sys sys 1067718932 88
+1067720495 12 a sys/src/libc/386/cycles.s - 664 sys sys 1067718932 213
+1067720495 13 c sys/src/libc/386/main9.s - 664 sys sys 1067718933 373
+1067720495 14 c sys/src/libc/386/main9p.s - 664 sys sys 1067718933 698
+1067720495 15 c sys/src/libc/386/mkfile - 664 sys sys 1067718988 469
+1067720495 16 c sys/src/libc/386/vlop.s - 664 sys sys 1067718935 884
+1067720495 17 c sys/src/libc/9sys/pushtls.c - 664 sys sys 1067718964 2023
+1067720495 18 c sys/src/libc/alpha/argv0.s - 664 sys sys 1067718982 88
+1067720495 19 a sys/src/libc/alpha/cycles.c - 664 sys sys 1067718982 71
+1067720495 20 c sys/src/libc/alpha/main9.s - 664 sys sys 1067718982 522
+1067720495 21 c sys/src/libc/alpha/main9p.s - 664 sys sys 1067718983 698
+1067720495 22 c sys/src/libc/alpha/mkfile - 664 sys sys 1067718983 371
+1067720495 23 c sys/src/libc/arm/argv0.s - 664 sys sys 1067719006 88
+1067720495 24 a sys/src/libc/arm/cycles.c - 664 sys sys 1067719006 71
+1067720495 25 c sys/src/libc/arm/main9.s - 664 sys sys 1067719007 489
+1067720495 26 c sys/src/libc/arm/main9p.s - 664 sys sys 1067719007 745
+1067720495 27 c sys/src/libc/arm/mkfile - 664 sys sys 1067719008 385
+1067720495 28 c sys/src/libc/arm/vlrt.c - 664 sys sys 1067719009 8950
+1067720495 29 c sys/src/libc/mips/argv0.s - 664 sys sys 1067719028 88
+1067720495 30 a sys/src/libc/mips/cycles.c - 664 sys sys 1067719028 71
+1067720495 31 c sys/src/libc/mips/main9.s - 664 sys sys 1067719029 426
+1067720495 32 c sys/src/libc/mips/main9p.s - 664 sys sys 1067719029 619
+1067720495 33 c sys/src/libc/mips/mkfile - 664 sys sys 1067719029 446
+1067720495 34 c sys/src/libc/mips/vlrt.c - 664 sys sys 1067719030 9086
+1067720495 35 c sys/src/libc/port/atexit.c - 664 sys sys 1067719043 741
+1067720495 36 c sys/src/libc/port/mkfile - 664 sys sys 1067719044 1545
+1067720495 37 c sys/src/libc/port/pool.c - 664 sys sys 1067719044 27913
+1067720495 38 c sys/src/libc/port/profile.c - 664 sys sys 1067719045 5495
+1067720495 39 c sys/src/libc/power/argv0.s - 664 sys sys 1067719057 88
+1067720495 40 a sys/src/libc/power/cycles.s - 664 sys sys 1067719057 268
+1067720495 41 c sys/src/libc/power/main9.s - 664 sys sys 1067719057 415
+1067720495 42 c sys/src/libc/power/main9p.s - 664 sys sys 1067719058 620
+1067720495 43 c sys/src/libc/power/mkfile - 664 sys sys 1067719060 416
+1067720495 44 c sys/src/libc/power/vlrt.c - 664 sys sys 1067719060 9023
+1067722295 0 c sys/doc/compiler.ms - 664 sys sys 1067721142 30279
+1067722295 1 c sys/games/lib/fortunes - 664 sys sys 1067720544 246645
+1067722295 2 c sys/src/cmd/5c/list.c - 664 sys sys 1067720726 5290
+1067722295 3 c sys/src/cmd/5c/txt.c - 664 sys sys 1067720681 18592
+1067722295 4 c sys/src/cmd/6c/list.c - 664 sys sys 1067720726 4001
+1067722295 5 c sys/src/cmd/6c/txt.c - 664 sys sys 1067720681 18554
+1067722295 6 c sys/src/cmd/8c/list.c - 664 sys sys 1067720660 3975
+1067722295 7 c sys/src/cmd/8c/txt.c - 664 sys sys 1067720660 23563
+1067722295 8 c sys/src/cmd/9c/list.c - 664 sys sys 1067720727 3516
+1067722295 9 c sys/src/cmd/9c/txt.c - 664 sys sys 1067720683 20271
+1067722295 10 c sys/src/cmd/cc/cc.h - 664 sys sys 1067720645 11717
+1067722295 11 c sys/src/cmd/cc/dpchk.c - 664 sys sys 1067720645 6738
+1067722295 12 c sys/src/cmd/cc/lex.c - 664 sys sys 1067720645 23769
+1067722295 13 c sys/src/cmd/cc/macbody - 664 sys sys 1067720644 11182
+1067722295 14 c sys/src/cmd/kc/list.c - 664 sys sys 1067720728 3785
+1067722295 15 c sys/src/cmd/kc/txt.c - 664 sys sys 1067720683 19514
+1067722295 16 c sys/src/cmd/qc/list.c - 664 sys sys 1067720728 3785
+1067722295 17 c sys/src/cmd/qc/txt.c - 664 sys sys 1067720684 20029
+1067722295 18 c sys/src/cmd/vc/list.c - 664 sys sys 1067720729 4076
+1067722295 19 c sys/src/cmd/vc/txt.c - 664 sys sys 1067720684 22654
+1067723212 0 a sys/include/trace.h - 664 sys sys 1067722708 576
+1067723212 1 c sys/man/1/hget - 664 sys sys 1067722859 1483
+1067723212 2 c sys/man/3/cons - 664 sys sys 1067722911 8683
+1067723212 3 c sys/man/3/proc - 664 sys sys 1067722856 9526
+1067723212 4 c sys/man/3/realtime - 664 sys sys 1067722856 7946
+1067723212 5 c sys/man/8/qer - 664 sys sys 1067723129 4909
+1067723212 6 c sys/man/8/smtp - 664 sys sys 1067722775 4709
+1067723212 7 c sys/man/8/stats - 664 sys sys 1067722908 4291
+1067723212 8 c sys/src/9/alphapc/dat.h - 664 sys sys 1067722581 5162
+1067723212 9 c sys/src/9/alphapc/fns.h - 664 sys sys 1067722581 3906
+1067723212 10 c sys/src/9/alphapc/l.s - 664 sys sys 1067722580 9124
+1067723212 11 c sys/src/9/alphapc/mkfile - 664 sys sys 1067722619 2030
+1067723212 12 c sys/src/9/bitsy/bitsy - 664 sys sys 1067722592 424
+1067723212 13 c sys/src/9/bitsy/dat.h - 664 sys sys 1067722592 5739
+1067723212 14 c sys/src/9/bitsy/devpenmouse.c - 664 sys sys 1067722592 9296
+1067723212 15 c sys/src/9/bitsy/fns.h - 664 sys sys 1067722591 3366
+1067723212 16 c sys/src/9/bitsy/main.c - 664 sys sys 1067722593 9083
+1067723212 17 c sys/src/9/bitsy/trap.c - 664 sys sys 1067722593 19245
+1067723212 18 c sys/src/9/boot/paq.c - 664 sys sys 1067722601 1099
+1067723212 19 c sys/src/9/ip/devip.c - 664 sys sys 1067722615 24186
+1067723212 20 c sys/src/9/ip/tcp.c - 664 sys sys 1067722615 65141
+1067723212 21 c sys/src/9/mtx/dat.h - 664 sys sys 1067722599 3798
+1067723212 22 c sys/src/9/mtx/fns.h - 664 sys sys 1067722598 3154
+1067723212 23 c sys/src/9/mtx/l.s - 664 sys sys 1067722599 10730
+1067723212 24 c sys/src/9/mtx/mkfile - 664 sys sys 1067722598 1520
+1067723212 25 c sys/src/9/mtx/trap.c - 664 sys sys 1067722597 15713
+1067723212 26 c sys/src/9/pc/archmp.c - 664 sys sys 1067722683 2323
+1067723212 27 c sys/src/9/pc/dat.h - 664 sys sys 1067722637 6119
+1067723212 28 c sys/src/9/pc/ether8390.c - 664 sys sys 1067722623 17541
+1067723212 29 c sys/src/9/pc/etherigbe.c - 664 sys sys 1067722636 43330
+1067723212 30 c sys/src/9/pc/fns.h - 664 sys sys 1067722685 4271
+1067723212 31 c sys/src/9/pc/i8253.c - 664 sys sys 1067722684 6217
+1067723212 32 c sys/src/9/pc/io.h - 664 sys sys 1067722633 7991
+1067723212 33 c sys/src/9/pc/l.s - 664 sys sys 1067722634 23586
+1067723212 34 c sys/src/9/pc/main.c - 664 sys sys 1067722634 14685
+1067723212 35 c sys/src/9/pc/mkfile - 664 sys sys 1067722635 3217
+1067723212 36 c sys/src/9/pc/pc - 664 sys sys 1067722635 1335
+1067723212 37 c sys/src/9/pc/pccpu - 664 sys sys 1067722636 777
+1067723212 38 c sys/src/9/pc/pcdisk - 664 sys sys 1067722637 1402
+1067723212 39 c sys/src/9/pc/pcf - 664 sys sys 1067722637 1431
+1067723212 40 c sys/src/9/pc/piix4smbus.c - 664 sys sys 1067722684 5273
+1067723212 41 c sys/src/9/pc/sdata.c - 664 sys sys 1067722685 50288
+1067723212 42 c sys/src/9/pc/trap.c - 664 sys sys 1067722686 20552
+1067723212 43 c sys/src/9/pc/uarti8250.c - 664 sys sys 1067722686 13859
+1067723212 44 c sys/src/9/pc/etherga620.c - 664 sys sys 1067723192 28788
+1067723212 45 c sys/src/9/pc/pccpuf - 664 sys sys 1067722888 1286
+1067723212 46 c sys/src/9/pc/pcflop - 664 sys sys 1067722894 1383
+1067723212 47 c sys/src/9/port/alarm.c - 664 sys sys 1067722766 1426
+1067723212 48 c sys/src/9/port/alloc.c - 664 sys sys 1067722763 5329
+1067723212 49 c sys/src/9/port/allocb.c - 664 sys sys 1067722759 3200
+1067723212 50 c sys/src/9/port/chan.c - 664 sys sys 1067722721 29156
+1067723212 51 c sys/src/9/port/dev.c - 664 sys sys 1067722718 8348
+1067723212 52 c sys/src/9/port/devaudio.c - 664 sys sys 1067722761 21130
+1067723212 53 c sys/src/9/port/devcons.c - 664 sys sys 1067722767 22064
+1067723212 54 c sys/src/9/port/devloopback.c - 664 sys sys 1067722759 14670
+1067723212 55 c sys/src/9/port/devmnt.c - 664 sys sys 1067722762 21601
+1067723212 56 c sys/src/9/port/devmouse.c - 664 sys sys 1067722758 12203
+1067723212 57 c sys/src/9/port/devproc.c - 664 sys sys 1067722717 28273
+1067723212 58 c sys/src/9/port/devroot.c - 664 sys sys 1067722764 4254
+1067723212 59 c sys/src/9/port/devuart.c - 664 sys sys 1067722718 11683
+1067723212 60 c sys/src/9/port/edf.c - 664 sys sys 1067722765 11931
+1067723212 61 c sys/src/9/port/edf.h - 664 sys sys 1067722760 1124
+1067723212 62 c sys/src/9/port/fault.c - 664 sys sys 1067722722 6628
+1067723212 63 c sys/src/9/port/pgrp.c - 664 sys sys 1067722718 3944
+1067723212 64 c sys/src/9/port/portclock.c - 664 sys sys 1067722761 4271
+1067723212 65 c sys/src/9/port/portdat.h - 664 sys sys 1067722763 22621
+1067723212 66 c sys/src/9/port/portfns.h - 664 sys sys 1067722759 11369
+1067723212 67 c sys/src/9/port/portmkfile - 664 sys sys 1067722766 2098
+1067723212 68 c sys/src/9/port/proc.c - 664 sys sys 1067722762 24755
+1067723212 69 c sys/src/9/port/qlock.c - 664 sys sys 1067722765 3196
+1067723212 70 c sys/src/9/port/sysfile.c - 664 sys sys 1067722760 22127
+1067723212 71 c sys/src/9/port/sysproc.c - 664 sys sys 1067722765 15396
+1067723212 72 c sys/src/9/port/taslock.c - 664 sys sys 1067722721 3348
+1067723212 73 c sys/src/9/port/tod.c - 664 sys sys 1067722762 4856
+1067723212 74 c sys/src/9/port/devfs.c - 664 sys sys 1067722764 10760
+1067723212 75 c sys/src/9/ppc/blast - 664 sys sys 1067722850 659
+1067723212 76 c sys/src/9/ppc/dat.h - 664 sys sys 1067723142 4676
+1067723212 77 c sys/src/9/ppc/devirq.c - 664 sys sys 1067722849 6057
+1067723212 78 c sys/src/9/ppc/fns.h - 664 sys sys 1067722798 4211
+1067723212 79 c sys/src/9/ppc/l.s - 664 sys sys 1067722848 21035
+1067723212 80 c sys/src/9/ppc/mkfile - 664 sys sys 1067722849 1813
+1067723212 81 c sys/src/9/ppc/ucu - 664 sys sys 1067722849 672
+1067723212 82 c sys/src/cmd/acme/dat.h - 664 sys sys 1067723164 10956
+1067723212 83 c sys/src/cmd/acme/ecmd.c - 664 sys sys 1067723163 24152
+1067723212 84 c sys/src/cmd/acme/elog.c - 664 sys sys 1067723163 7241
+1067723212 85 c sys/src/cmd/acme/exec.c - 664 sys sys 1067723165 27057
+1067723212 86 c sys/src/cmd/acme/fns.h - 664 sys sys 1067723164 2922
+1067723212 87 c sys/src/cmd/acme/xfid.c - 664 sys sys 1067723165 19180
+1067723212 88 c sys/src/cmd/hget.c - 664 sys sys 1067722871 22715
+1067723212 89 c sys/src/cmd/ip/snoopy/ip6.c - 664 sys sys 1067722979 5362
+1067723212 90 c sys/src/cmd/webfs/http.c - 664 sys sys 1067722969 6726
+1067723212 91 c sys/src/cmd/webfs/main.c - 664 sys sys 1067722969 1062
+1067723212 92 c sys/src/cmd/pwd.c - 664 sys sys 1067722792 287
+1067723212 93 c sys/src/cmd/upas/marshal/marshal.c - 664 sys sys 1067722960 32467
+1067723212 94 c sys/src/cmd/upas/ned/nedmail.c - 664 sys sys 1067722837 42995
+1067723212 95 c sys/src/cmd/upas/smtp/mkfile - 664 sys sys 1067722781 746
+1067723212 96 c sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1067722780 24439
+1067723212 97 c sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1067722781 1111
+1067723212 98 c sys/src/cmd/upas/smtp/spam.c - 664 sys sys 1067722785 9661
+1067723212 99 c sys/src/cmd/7c/list.c - 644 sys sys 1067723063 3862
+1067723212 100 c sys/src/cmd/7c/txt.c - 644 sys sys 1067723062 20149
+1067723212 101 c sys/src/libc/29000/argv0.s - 664 sys sys 1067722825 88
+1067723212 102 c sys/src/libc/29000/main9.s - 664 sys sys 1067722823 489
+1067723212 103 c sys/src/libc/29000/main9p.s - 664 sys sys 1067722815 700
+1067723212 104 c sys/src/libc/29000/mkfile - 664 sys sys 1067723170 320
+1067723212 105 c sys/src/libc/386/vlrt.c - 664 sys sys 1067723053 9567
+1067723212 106 c sys/src/libc/68000/argv0.s - 664 sys sys 1067722826 88
+1067723212 107 c sys/src/libc/68000/main9.s - 664 sys sys 1067722824 336
+1067723212 108 c sys/src/libc/68000/main9p.s - 664 sys sys 1067722815 586
+1067723212 109 c sys/src/libc/68000/mkfile - 664 sys sys 1067723171 462
+1067723212 110 c sys/src/libc/68020/argv0.s - 664 sys sys 1067722826 88
+1067723212 111 c sys/src/libc/68020/main9.s - 664 sys sys 1067722824 355
+1067723212 112 c sys/src/libc/68020/main9p.s - 664 sys sys 1067722816 605
+1067723212 113 c sys/src/libc/68020/mkfile - 664 sys sys 1067723172 615
+1067723212 114 c sys/src/libc/sparc/argv0.s - 664 sys sys 1067722827 88
+1067723212 115 c sys/src/libc/sparc/main9.s - 664 sys sys 1067722825 537
+1067723212 116 c sys/src/libc/sparc/main9p.s - 664 sys sys 1067722817 749
+1067723212 117 c sys/src/libc/sparc/mkfile - 664 sys sys 1067723173 434
+1067723212 118 c sys/src/libc/sparc/vlrt.c - 664 sys sys 1067723054 9066
+1067723212 119 d sys/src/9/boot/libboot.a8 - 664 sys sys 1066515074 0
+1067725175 0 c sys/src/cmd/2a/lex.c - 664 sys sys 1067725158 19370
+1067725175 1 c sys/src/cmd/5a/lex.c - 664 sys sys 1067725159 11049
+1067725175 2 c sys/src/cmd/6a/lex.c - 664 sys sys 1067725159 11684
+1067725175 3 c sys/src/cmd/8a/lex.c - 664 sys sys 1067725160 18023
+1067725175 4 c sys/src/cmd/9a/lex.c - 664 sys sys 1067725161 9981
+1067725175 5 c sys/src/cmd/ka/lex.c - 664 sys sys 1067725162 12759
+1067725175 6 c sys/src/cmd/qa/lex.c - 664 sys sys 1067725162 13720
+1067725175 7 c sys/src/cmd/va/lex.c - 664 sys sys 1067725163 11825
+1067725175 8 c sys/src/cmd/1a/lex.c - 664 sys sys 1067725158 19259
+1067725175 9 c sys/src/cmd/7a/lex.c - 664 sys sys 1067725160 12389
+1067725896 0 c sys/src/cmd/cc/lexbody - 664 sys sys 1067725942 8953
+1067739546 0 c sys/src/cmd/5i/stats.c - 664 sys sys 1067739537 3943
+1067740300 0 a mail/lib/white.starter - 664 upas upas 1067739606 326
+1067742100 0 c sys/src/cmd/ip/httpd/mkfile - 664 sys sys 1067742150 1406
+1067742100 1 a sys/src/cmd/upas/smtp/greylist.c - 664 sys sys 1067741333 5588
+1067742845 0 a sys/src/cmd/jpg/readyuv.c - 664 sys sys 1067742240 3502
+1067746800 0 c sys/src/cmd/vi/stats.c - 664 sys sys 1067746789 5386

+ 22 - 0
mail/lib/white.starter

@@ -0,0 +1,22 @@
+# internal net
+10.0.0.0/8
+# yahoo mail hosts
+66.218.66.0/24
+66.218.84.0/24
+# bellnexxia.net
+209.226.175.0/24
+# telus.net
+199.185.220.0/24
+# amazon
+207.171.188.0/24
+# careerbuilder.com
+66.45.112.0/24
+
+# psuvax1.cse.psu.edu - 9fans
+130.203.4.6
+# plan9.bell-labs.com
+204.178.31.2
+# ieee
+140.98.194.25
+# jetblue.com
+64.50.124.126

+ 20 - 0
sys/doc/compiler.ms

@@ -369,6 +369,26 @@ to be laid out in memory tightly packed in successive bytes, disregarding
 the usual alignment rules.
 Accessing such data can cause faults.
 .LP
+Similarly, 
+.CW #pragma
+.CW profile
+.CW off
+(or
+.CW no
+or
+.CW 0 )
+causes subsequently declared functions, until
+.CW #pragma
+.CW profile
+.CW on
+(or
+.CW yes
+or
+.CW 1 ),
+to be marked as unprofiled.
+Such functions will not be profiled when 
+profiling is enabled for the rest of the program.
+.LP
 Two
 .CW #pragma
 statements allow type-checking of

+ 2 - 0
sys/games/lib/fortunes

@@ -3989,3 +3989,5 @@ if_de.c:2401: 		    sc->tulip_mediums[media] = mi;
 Please let us know if there is anything we can do to make your stay more magical.  Please note the field below is limited to 29 characters.  - Disney World hotel reservation web page
 Telegraph is a kind of a very, very long cat. You pull his tail in New York and his head meows in Los Angeles. And radio operates exactly the same way — you send signals here, they receive them there. The only difference is that there is no cat. -Albert Einstein
 Hi.  My name is %{NAME%}%, I am 25 years of age.  I happen to see your profile on the internet.  Come visit me some more by viewing my site.  Ethel
+As complicated as the semantics of virtual inheritance may seem, its support within the compiler has proven even more complicated.  - Stanley Lippman, Inside the C++ Object Model
+Who needs hallucinatory drugs when we've got quantum physics?

+ 15 - 1
sys/include/libc.h

@@ -312,6 +312,8 @@ extern	long	times(long*);
 extern	long	tm2sec(Tm*);
 extern	vlong	nsec(void);
 
+extern	void	cycles(uvlong*);	/* 64-bit value of the cycle counter if there is one, 0 if there isn't */
+
 /*
  * one-of-a-kind
  */
@@ -358,7 +360,7 @@ extern	double	modf(double, double*);
 extern	int	netcrypt(void*, void*);
 extern	void	notejmp(void*, jmp_buf, int);
 extern	void	perror(char*);
-extern  int	postnote(int, int, char *);
+extern	int	postnote(int, int, char *);
 extern	double	pow10(int);
 extern	int	putenv(char*, char*);
 extern	void	qsort(void*, long, long, int (*)(void*, void*));
@@ -376,6 +378,18 @@ extern	long	time(long*);
 extern	int	tolower(int);
 extern	int	toupper(int);
 
+/*
+ *  profiling
+ */
+enum {
+	Profoff,			/* No profiling */
+	Profuser,			/* Measure user time only (default) */
+	Profkernel,		/* Measure user + kernel time */
+	Proftime,			/* Measure total time */
+	Profsample,		/* Use clock interrupt to sample (default when there is no cycle counter) */
+}; /* what */
+extern	void	prof(void (*fn)(void*), void *arg, int entries, int what);
+
 /*
  *  synchronization
  */

+ 21 - 0
sys/include/tos.h

@@ -0,0 +1,21 @@
+typedef struct Tos Tos;
+typedef struct Plink Plink;
+struct Tos {
+	struct			/* Per process profiling */
+	{
+		Plink		*pp;		/* known to be 0(ptr) */
+		Plink		*next;	/* known to be 4(ptr) */
+		Plink		*last;
+		Plink		*first;
+		ulong	pid;
+		ulong	what;
+	} prof;
+	uvlong		cyclefreq;		/* cycle clock frequency if there is one, 0 otherwise */
+	vlong		kcycles;		/* cycles spent in kernel */
+	vlong		pcycles;		/* cycles spent in process (kernel + user) */
+	ulong		pid;			/* might as well put the pid here */
+	ulong		clock;
+	/* top of stack is here */
+};
+
+extern Tos *_tos;

+ 21 - 0
sys/include/trace.h

@@ -0,0 +1,21 @@
+typedef enum Tevent {
+	SAdmit,		/* Edf admit */
+	SRelease,	/* Edf release, waiting to be scheduled */
+	SEdf,		/* running under EDF */
+	SRun,		/* running best effort */
+	SReady,		/* runnable but not running  */
+	SSleep,		/* blocked */
+	SYield,		/* blocked waiting for release */
+	SSlice,		/* slice exhausted */
+	SDeadline,	/* proc's deadline */
+	SExpel,		/* Edf expel */
+	SDead,		/* proc dies */
+	SUser,		/* user event */
+} Tevent;
+
+typedef struct Traceevent	Traceevent;
+struct Traceevent {
+	ulong	pid;	
+	Tevent	etype;		/* Event type */
+	vlong	time;		/* time stamp (ns)  */
+};

+ 6 - 0
sys/man/1/hget

@@ -67,6 +67,12 @@ Option
 writes progress lines to standard output once a second.
 Each line contains two numbers, the bytes transferred so
 far and the total length to be transferred.
+.PP
+If the environment variable
+.B httpproxy
+is set, it is used as a URL denoting an HTTP proxy server.
+All HTTP accesses use this server to get the page instead of
+calling the destination server.
 .SH SOURCE
 .B /sys/src/cmd/hget.c
 .SH "SEE ALSO"

+ 26 - 0
sys/man/1/prof

@@ -82,6 +82,32 @@ before running
 .IR program .
 If the buffer fills, subsequent function calls may not be recorded.
 .PP
+The profiling code provided by the linker initializes itself to profile the current pid,
+producing a file called
+.B prof.\f2pid\fP.
+If a process forks, only the parent will continue to be profiled.  Forked children
+can cause themselves to be profile by calling
+.EX
+    prof(fn, arg, entries, what)
+.EE
+which causes the function \f2fn\fP(\f2arg\fP) to be profiled.  When \f2fn\fP
+returns 
+.B prof.\f2pid\fP
+is produced for the current process pid.
+.PP
+The environment variable
+.B proftype
+can be set to one of
+.BR user ,
+.BR kernel ,
+.BR elapsed ,
+or
+.BR sample ,
+to profile time measured spent in user mode, time spent in user+kernel mode, or elapsed time,
+using the cycle counter, or the time in user mode using the kernel's HZ clock.  The cycle counter
+is currently only available on modern PCs and on the PowerPC.  Default profiling measures user
+time, using the cycle counter if it is available.
+.PP
 .I Tprof
 is similar to
 .IR prof ,

+ 9 - 1
sys/man/2/quote

@@ -1,6 +1,6 @@
 .TH QUOTE 2
 .SH NAME
-quotestrdup, quoterunestrdup, unquotestrdup, unquoterunestrdup, quotestrfmt, quoterunestrfmt, quotefmtinstall, doquote \- quoted character strings
+quotestrdup, quoterunestrdup, unquotestrdup, unquoterunestrdup, quotestrfmt, quoterunestrfmt, quotefmtinstall, doquote, needsrcquote \- quoted character strings
 .SH SYNOPSIS
 .B #include <u.h>
 .br
@@ -30,6 +30,9 @@ void quotefmtinstall(void)
 .B
 int (*doquote)(int c)
 .PP
+.B
+int needsrcquote(int c)
+.PP
 .SH DESCRIPTION
 These routines manipulate character strings, either adding or removing
 quotes as necessary.
@@ -117,6 +120,11 @@ characters other than blanks, control characters, or quotes be quoted.
 Regardless of the return value of
 .IR *doquote ,
 blanks, control characters, and quotes are always quoted.
+.I Needsrcquote
+is provided as a
+.I doquote
+function that flags any character special to
+.IR rc (1).
 .PP
 .I Quotestrfmt
 and

+ 3 - 2
sys/man/3/cons

@@ -282,10 +282,11 @@ if known.
 .PP
 The
 .B sysstat
-file holds 8 numbers:
+file holds 10 numbers:
 processor number, context switches, interrupts, system calls, page faults,
-TLB faults, TLB purges, and load average.
+TLB faults, TLB purges, load average, idle time and time spent servicing interrupts.
 The load average is in units of milli-CPUs and is decayed over time;
+idle time and interrupt time are percentage units;
 the others are total counts from boot time.
 If the machine is a multiprocessor,
 .B sysstat

+ 80 - 1
sys/man/3/proc

@@ -265,7 +265,86 @@ Set the base priority for the process to the integer
 .B "wire\ \fIn
 Wire the process to processor
 .IR n .
-.PD
+.TP 10n
+.B "period\ \fInu
+Set the real-time scheduling period of the process to
+.IR nu ,
+where
+.I n
+is an optionally signed number containing an optional decimal point and
+.I u
+is one of
+.BR s ,
+.BR ms ,
+.BR us ,
+.BR µs ,
+.BR ns ,
+or
+empty.  The time is interpreted, respectively, as
+.IR seconds ,
+.IR milliseconds ,
+.IR microseconds ,
+.IR microseconds ,
+.IR nanoseconds ,
+or, in the case of an absent units specifier, as
+.IR nanoseconds .
+If the time specifier is signed, it is interpreted as an increment or decrement
+from a previously set value.
+See
+.IR realtime (3).
+.TP 10n
+.B "deadline\ \fInu
+Set the real-time deadline interval of the process to
+.IR nu ,
+where
+.I n
+and
+.I u
+are interpreted as for
+.B period
+above.
+See
+.IR realtime (3).
+.TP 10n
+.B "cost\ \fInu
+Set the real-time cost (maximum CPU time per period) of the process to
+.IR nu ,
+where
+.I n
+and
+.I u
+are interpreted as for
+.B period
+above.
+.TP 10n
+.B "sporadic
+Use sporadic scheduling for the real-time process.
+See
+.IR realtime (3).
+.TP 10n
+.B "yieldonblock
+Make the real-time process yield on blocking I/O.
+See
+.IR realtime (3).
+.TP 10n
+.B "admit
+Given real-time
+.IR period ,
+.I deadline
+and
+.I cost
+are set (an unset
+.I deadline
+will set
+.I deadline
+to
+.IR period ),
+perform a schedulability test and start scheduling the process as a real-time
+process if the test succeeds.  If the test fails, the
+.B write
+will fail with error set to the reason for failure.
+See
+.IR realtime (3).
 .PP
 The priority is interpreted by Plan 9's multilevel process scheduler.
 Priorities run from 0 to 19, with higher

+ 113 - 298
sys/man/3/realtime

@@ -10,43 +10,7 @@ realtime \- real time scheduling
 .B bind -a #R /dev
 .ift .sp 0.5
 .ifn .sp
-/dev/realtime/clone
-/dev/realtime/debug
-/dev/realtime/log
-/dev/realtime/nblog
-/dev/realtime/resources
-/dev/realtime/task/0
-/dev/realtime/task/1
-/dev/realtime/task/...
-/dev/realtime/time
-.sp
-#include "realtime.h"
-.ift .sp 0.5
-.ifn .sp
-enum SEvent {
-	SAdmit,	/* new proc arrives*/
-	SRelease,	/* released, but not yet scheduled */
-	SRun,	/* one of this task's procs started running */
-	SPreempt,	/* the running task was preempted */
-	SBlock,	/* the last of the runnable procs in a task blocked */
-	SResume,	/* task was scheduled after blocking */
-	SDeadline,	/* proc's deadline (reported ahead of time) */
-	SYield,	/* proc reached voluntary early deadline */
-	SSlice,	/* slice exhausted */
-	SExpel,	/* proc was expelled */
-	SResack,	/* acquire resource */
-	SResrel,	/* release resource */
-};
-typedef enum SEvent SEvent;
-typedef vlong Time;
-typedef struct Schedevent Schedevent;
-.ift .sp 0.5
-.ifn .sp
-struct Schedevent {
-	ushort	tid;	/* Task ID */
-	SEvent	etype;	/* Event type */
-	Time	ts;	/* Event time */
-};
+/proc/\fIn\fP/ctl
 .EE
 .SH DESCRIPTION
 The Plan 9 real-time scheduler allows mixing real-time processes and best-effort
@@ -55,145 +19,112 @@ under 100% CPU utilization with minimum periods in the order of a hundred thousa
 instruction times.  The precision of the scheduler depends on the precision of the
 machine's programmable real-time clock.
 .PP
-The unit of real-time scheduling is a
-.BR task .
-A task can contain zero or more processes.  The processes in a task
-share a common period, deadline and CPU allocation.  Tasks allow
-cooperating processes to collaborate to achieve a common deadline, for
-instance, processes receiving, decompressing and displaying video in a
-pipeline can share a single task.
-.PP
-Tasks are scheduled using Earliest-Deadline First (EDF).  Each task
+Real-time processes are scheduled using Earliest-Deadline First (EDF).  Each process
 has three primary scheduling parameters, a period $T$, a deadline $D$
-and a cost $C$, expressed in nanoseconds (but converted internally to
-a machine- and architecture-dependent unit called
-.IR tick ).
-Every $T$ nanoseconds, the task is
+and a cost $C$, expressed in nanoseconds.
+Every $T$ nanoseconds, the process is
 .I released
 — i.e., it becomes schedulable — and it receives a
 .I slice
 of $C$ nsec.
-When the task is released, its
+When the process is released, its
 .I "release time"
 $r$ is set to the current time.
-The task's
+The process's
 .I "absolute deadline"
 $d$ is set to $r + D$.
 (Note the use of capital letters to indicate intervals and lower-case
 letters to indicate `points in time'.)
-Between release and deadline the task must be scheduled often enough
+Between release and deadline, the process must be scheduled often enough
 to be able to consume its slice of $C$ nsec of CPU time.
 So, to be schedulable, $C <= D <= T$ must hold.
-If $D < T$, tasks are not schedulable (runnable) between their
-deadline and the next release.
-Tasks are
-.I released
+If $D < T$, processes are not real-time schedulable (runnable) between their
+deadline and the next release, but they may run as best-effort processes and compete with
+other processes for the CPU.
+Processes are scheduled according to the EDF rule
 from the moment of release until their deadline or their slice runs
-out, whichever happens first.  Additionally, tasks can voluntarily
+out, whichever happens first.  Additionally, processes can voluntarily
 declare the slice for the current period empty, allowing other
-real-time tasks or best-effort tasks the CPU time remaining in their
+real-time processes or best-effort processes to use the CPU time remaining in their
 slice.
 .PP
-Before they are released for the first time, tasks have to be
+Before they are released for the first time, processes have to be
 .IR admitted
 into the system.  Before admission, a test is conducted to determine
-whether the task, plus the already admitted tasks can all meet their
-deadlines, given their scheduling parameters.  When a task changes its
-scheduling parameters, it is temporarily
+whether the process, plus the already admitted processes, given their
+scheduling parameters, can all meet their deadlines.  When a process
+changes its scheduling parameters, it is temporarily
 .I expelled
-and will be readmitted if the new scheduling parameters allow all
-tasks to continue to meet their deadlines.
+and will be readmitted only if the new scheduling parameters allow all
+processes to continue to meet their deadlines.
 .PP
-The EDF scheduler schedules the released task with the earliest
-deadline.  When a task is released it can, therefore, preempt a task
+The EDF scheduler schedules the released process with the earliest
+deadline.  When a process is released it can, therefore, preempt a process
 that has a later deadline, but was released earlier.
-.PP
-Real-time tasks sharing resources, however, may need to be prevented
-from preempting each other.  They must do this by declaring their shared
-resources.  The scheduler will not preempt one task with another that
-shares a common resource.  To do this, the scheduler needs to know the
-names of the sharable resources used by each of the tasks, the amount
-of time the resources are used, and the way in which resource usage is
-nested.
-.PP
-Resource usage must be strictly nested; i.e., it is legal for a task to
-first to acquire resource $A$, then to acquire resource $B$, to
-release $B$ again and finally to release $A$.  It is also legal for it
-to acquire and release $A$ before acquiring and releasing $B$.  But
-it is not legal to acquire $A$, acquire $B$, release $A$ and release $B$
-in that order.
-.PP
-During the admission test, information about resource sharing is used
-to calculate
-.IR "inherited deadlines" ,
-for each task.  A resource's
-.IR "inherited deadline" ,
-$Δ$, is the minimum of the deadlines $D$ of each of the tasks
-that shares that resource.  A task's $Δ$ is the minimum of the
-resource $Δ$s of all resources held by the task.
-.PP
-Acquiring a resource may lower the $Δ$ of the task; releasing one
-may increase it.
-.PP
-The scheduler allows a released task $T$ to preempt running task $T'$
-iff $d < d' ^ D < Δ'$; the first half of the condition says that the
-released task's deadline must be earlier, the second implies that the
-released task may not share resources with the running one (after all,
-if $T'$ had acquired a resource that $T$ uses, its $Δ'$ would, by the
-definition of inherited deadlines, be less than or equal to $D$).
-.PP
-The admission test takes these limitations into account.  Note that,
-in practice, tasks rarely share resources.
-.PP
-Normally, tasks can block (when all their processes are blocked on
-system calls) during their release.  The time spent blocking is not
-accounted against the current slice, but, since the scheduler has no
-control over the time spent blocking, there are no guarantees that the
-deadline will be made if a task blocks during its release.  Whether or
-not tasks actually block, they will normally complete the work to be
-done in a period (slightly) before the slice runs out — and before
-the deadline.  To tell the scheduler that they no longer require the
-CPU until the next release, tasks can
-.I yield
+.\" .PP
+.\" Real-time processes sharing resources, however, may need to be prevented
+.\" from preempting each other.  They must do this by declaring their shared
+.\" resources.  The scheduler will not preempt one process with another that
+.\" shares a common resource.  To do this, processes can name resources they use
+.\" and the scheduler will not allow preemption of a process by another that
+.\" has named the same resource.
+.\" .PP
+.\" Note that, if all processes share a common resource, the scheduler reduces to
+.\" non-preemptive EDF scheduling.  Note also that resources in this context
+.\" are just named placeholders for the actual resources shared by the processes.
+.\" It is up to the programmer to define the relationship between actual
+.\" shared resources (data structures, for example) and the named resources
+.\" used by the scheduler.
+.\" .PP
+.\" During the admission test, information about resource sharing is used
+.\" to calculate
+.\" .IR "inherited deadlines" ,
+.\" for each process.  A resource's
+.\" .IR "inherited deadline" ,
+.\" $Δ$, is the minimum of the deadlines $D$ of each of the processes
+.\" that shares that resource.  A process's $Δ$ is the minimum of the
+.\" resource $Δ$s of all resources held by the process.
+.\" .PP
+.\" The scheduler allows a released process $T$ to preempt running process $T'$
+.\" iff $d < d' ^ D < Δ'$; the first half of the condition says that the
+.\" released process's deadline must be earlier, the second implies that the
+.\" released process may not share resources with the running one (after all,
+.\" if $T'$ had acquired a resource that $T$ uses, its $Δ'$ would, by the
+.\" definition of inherited deadlines, be less than or equal to $D$).
+.\" .PP
+.\" The admission test takes these limitations into account.  Note that,
+.\" in practice, processes rarely share resources.
+.PP
+Normally, processes can block (when all their processes are blocked on
+system calls) during their release.  The time spent blocking may be
+accounted against the current slice, because blocked processes may stop
+other processes from getting the processor (due to shared resources).
+Processes can tell the scheduler that they no longer require the CPU until the next
+release, by
+.I yielding
 (see below).
 .PP
-Tasks can also run in another mode where blocking automatically
+Processes can also run in another mode where blocking automatically
 implies immediate yielding.  This mode truly guarantees that deadlines
 will be made, but programmers must know more about the (blocking)
-nature of the system calls used in order to use this mode.
+nature of system calls used in order to use this mode.
 .sp
 .LP
-The real-time scheduler is controlled through the
-.B #R
-file system, normally bound to
-.BR /dev .
-Opening
-.B /dev/realtime/clone
-for writing (and reading, if desired), causes a new task to be created in the
-non-admitted (expelled) state.  The new task will be represented by a file in
-the
-.B /dev/realtime/task
-directory whose name $n$ is the task's number.
-The file descriptor resulting from opening
-.B /dev/realtime/clone
-provides the equivalent functionality as that resulting from opening
-.BI /dev/realtime/task/ n
-except for the initial creation of a new task when opening the
-.B clone
-file.  The task file may also be opened read-only.
+The real-time scheduler is controlled through
+.BR /proc/\fPpid\fP/ctl .
+See
+.IR proc (3).
 .PP
-The task's parameters are set or modified by writing one of these files and they
+The process' parameters are set or modified by writing one of these files and they
 can be examined by reading it.
 A parameter is presented in the form
-\f2name\fP=\f2value\fP, \f2name\fP+=\f2value\fP, or \f2name\fP-=\f2value\fP.
+\f2name\fP \f2value\fP, \f2name\fP +\f2value\fP, or \f2name\fP -\f2value\fP.
 A command is presented in the form
 .IR commandname .
-Parameters and commands are separated by white space; quoting conventions apply
-(see
-.IR quote (2)).
+Parameters and commands are separated by semicolons.
 The settable parameters are
 .TP
-.B T
+.B period
 Sets the period.  The value must be given as a number with or without decimal point
 and directly followed (no white space) by one of
 .I s
@@ -207,190 +138,74 @@ for microseconds,
 .I ns
 or
 nothing
-for nanoseconds.  The
-.B +=
-operator adds to the period already set, the
-.B -=
-operator subtracts from it.
-.TP
-.B D
-Sets the deadline.  Value syntax and operators as above.
+for nanoseconds.
+If the value is signed, it is taken as an increment (decrement) of the value
+perviously set.
 .TP
-.B C
-Sets the cost.  Value syntax and operators as above.
+.B deadline
+Sets the deadline.  Value specified as above.
 .TP
-.B resources
-Sets the list of resources; resource names must consist of letters, digits, or underscores
-and they must not start with a digit.  A resource name may be followed by its cost
-(using the same notation of time as in setting the $T$ attribute) and by resources
-nested within.  These nested resources are indicated by an open brace '{', a list of
-nested resources and a closing brace '}'.  Quoting is usually necessary.
-An example of a resource specification is
-.ti +2m
-.B "resources='a 10ms { b 2ms c 3ms {d} }'
-.br
-Here, resource $a$ is held for at most 10 ms; during this time, resource $b$ is
-acquired and then released within 2 ms.  After releasing $b$, resource $c$ can
-be acquired and then resource $d$.  No time is specified for $d$, so its cost
-is inherited from its parent: 3 ms.  Resources $d$, $c$ and $a$ must be released
-in that order.
-.br
-.ti +1m
-The
-.B +=
-and
-.B -=
-operators are not allowed for resources (they must be specified completely every time).
-.TP
-.B acquire
-is a run time command which tells the scheduler that the named resource is being acquired.
-The scheduler will adjust the task's $Δ$ accordingly.  It is illegal to acquire a resource
-not specified or not to follow the nesting order.  It is legal, however, not to acquire a resource
-(and all the ones nested inside) that may legally be acquired.
-The
-.B +=
-and
-.B -=
-operators do not apply.
-.TP
-.B procs
-Sets, adds to, or subtracts from the process membership of a task.  Processes
-are identified by their
-.I pid
-or the special value
-.B self
-identifying the process writing the
-.I clone
-or
-.I task
-file.
+.B cost
+Sets the cost.  Value specified as above.
 .TP
 .B yieldonblock
-When the (integer) value is non-zero, the task is placed in
+When the (integer) value is non-zero or absent, the process is placed in
 .I yield-on-block
-mode: when all processes in the task are blocked on system calls, the task automatically
-declares the current deadline reached and will be released again in the next period.
-When the value is zero, the task can block without forfeiting the current release.
-However, when the task blocks long, the deadline may be missed.  The default value is zero.
-.LP
-In addition to these settable attributes, there are a number of attributes
-to be read:
-.TP
-.B n
-Number of releases of this task,
-.TP
-.B m
-Number of deadlines missed,
-.TP
-.B p
-Number of times the task was preempted by one with an earlier deadline,
-.TP
-.B t
-Total time used (divide this by
-.I n
-to get the average time used per period),
-.TP
-.B c
-Aged average time used,
-.LP
-The commands accepted are
-.TP
-.B verbose
-This is for debugging and causes the progression of the admission test to be displayed.
+mode: when the process is blocked on a system call, the process automatically
+declares the current deadline reached and will be released again in the next period or when the process
+becomes runnable again, whichever occurs last.
+When the value is zero, the process can block without forfeiting the current release.
+The default value is zero.
+.TP
+.B sporadic
+When the (integer) value is non-zero or absent, the process is placed in
+.I sporadic
+mode.  This mode resembles
+.IR yield-on-block .
+When the process unblocks and the time elapsed since last release is more than the period, it
+is released immediately, rather than at the next period boundary.  Sporadic scheduling is
+useful for processes that are interrupt driven.  The period merely specifies the maximum
+invocation rate.  The default value is zero.
 .TP
 .B admit
 This initiates an admission test.  If the test fails, the write containing the
 .B admit
-command will fail.  If the test succeeds the task is admitted and, if it contains
-runnable processes, it will be released (almost) immediately.
+command will fail.  If the test succeeds the process is admitted and will be released.
 .TP
 .B expel
-Expel the task.
-.TP
-.B remove
-Remove the task, the file descriptor will become invalid.
-.TP
-.B release
-Release the last resource acquired.  There is no attribute.
-.TP
-.B yield
-Gives up the processor until the next release.
+Expels the process by turning it back into a regular best-effort process.
 .LP
-.sp
-.B /dev/realtime/debug
-prints debugging information about the task queues maintained by the scheduler.
-This file will go away.
-.PP
-.B /dev/realtime/log
-and
-.B /dev/realtime/nblog
-are files used by real-time monitoring processes such as
-.B rtstats
-(see
-.IR rtstats (1)).
-Reading them produces a stream of
-.B Schedevent
-structures in the machine representation.  These events are
-nearly ordered by Time (nanoseconds since boot); some events can
-be reported earlier or later than they occur.
-.I Tid
-corresponds to the file name in the directory
-.BR /dev/realtime/task ,
-.I etype
-is one of the events of
-.I SEvent
-as explained in
-.BR /sys/src/9/port/devrealtime.h ,
-and
-.I ts
-is the time at which the event occurred (or will occur).
-.B Nblog
-is a non-blocking version that returns zero bytes each time there is
-nothing left to read.
-.PP
-.B /dev/realtime/resources
-is a read-only file listing the resources declared by the current set of tasks.
-.PP
-.B /dev/realtime/time
-returns the number of nanoseconds since boot, the number of ticks since boot and
-.IR fasthz ,
-the number of clock ticks per second, a billion times the ratio between the other two numbers.
-Each number is returned as a binary
-.I vlong
-in architecture-dependent representation.
+.BR Sleep(0)
+will yield (i.e., giveup the processor until the next release time).  In non-real-time
+processes,
+.B sleep(0)
+will invoke the scheduler, allowing higher priority processes to run.
+.TP
 .SH EXAMPLE
 .EX
 .ta 4n +4n +4n +4n +4n +4n +4n
-char *clonedev = "#R/realtime/clone";
+char *ctl[128];
 
 void
 processvideo(){
 	int fd;
 
-	if ((fd = open(clonedev, ORDWR)) < 0) 
-		sysfatal("%s: %r", clonedev);
-	if (fprint(fd, "T=33ms D=20ms C=8ms procs=self admit") < 0)
-		sysfatal("%s: admit: %r", clonedev);
+	snprint(ctl, sizeof ctl, "/proc/%ld/ctl", getpid());
+	if ((fd = open(ctl, ORDWR)) < 0) 
+		sysfatal("%s: %r", ctl);
+	if (fprint(fd, "period 33ms;deadline 20ms;cost 8ms;admit") < 0)
+		sysfatal("%s: admit: %r", ctl);
+	close(fd);
 	for (;;){
 		processframe();
-		if (fprint(fd, "yield") < 0)
-			sysfatal("%s: yield: %r", clonedev);
+		sleep(0);
 	}
-	if (fprint(fd, "remove") < 0)
-		sysfatal("%s: remove: %r", clonedev);
-	close(fd);
 }
 .EE
 .SH "SEE ALSO
-.IR rtstats (1)
-.SH FILES
-.B /sys/src/cmd/rtstats/edfproc.c
-as an example of using the scheduler for a trivial test run.
-.B /sys/src/cmd/rtstats/resproc.c
-as an example of using resources.
+.IR trace (1)
+.LP
 .SH SOURCE
-.B /sys/src/9/port/devrealtime.c
-.br
 .B /sys/src/9/port/edf.c
 .SH BUGS
 The admission test does not take multiprocessors into account.  The total

+ 8 - 1
sys/man/8/qer

@@ -15,7 +15,7 @@ qer, runq \- queue management for spooled files
 .br
 .B runq
 [
-.B -adsE
+.B -adsER
 ]
 [
 .B -f
@@ -140,6 +140,13 @@ flag causes all files to be reprocessed regardless of
 the file times.
 .P
 The
+.B -R
+flag instructs
+.I runq
+never to give up on a failed queue job, instead leaving
+it in the queue to be retried.
+.P
+The
 .B -d
 option causes debugging output on standard error
 describing the progress through the queues.

+ 17 - 5
sys/man/8/smtp

@@ -24,7 +24,7 @@ smtp, smtpd \-  mail transport
 .PP
 .B upas/smtpd
 [
-.B -dfr
+.B -dfrg
 ][
 .B -n
 .I netdir
@@ -76,10 +76,7 @@ use
 .I host
 as the local system name;
 it may be fully-qualified or not.  If not
-specified, the local system name will be
-contents of the environment variable
-.BR site .
-If that isn't specified, it will be the contents of
+specified, it will default to the contents of
 .BR /dev/sysname .
 .TP
 .B -f
@@ -115,6 +112,21 @@ turns on debugging output to standard error.
 .B -r
 turns on forward DNS validation of non-trusted sender address.
 .TP
+.B -g
+turns on grey/white list processing.  All mail is rejected (with a
+retry code) unless the sender's IP address is on the whitelist,
+.BR /mail/lib/whitelist .
+Addresses can be added to the whitelist by the administrator.  However,
+the usual way for addresses to be added is by smtpd itself.  Whenever,
+a message is received and the sender's address isn't on the whitelist,
+.B smtpd
+first looks for the file,
+.B /mail/grey/<remote ipaddr>/<local ipaddr>/<recipient> .
+If that file exists, the remote address is added to the whitelist.  If
+not, the file is created and the mail is rejected with a 'try again'
+code.  The expectation is that spammers will not retry and that others
+will.
+.TP
 .B -f
 prevents relaying from non-trusted networks.
 It also tags messages from non-trusted sites when they deliver mail

+ 6 - 3
sys/man/8/stats

@@ -93,12 +93,15 @@ a midrange value represents a strong signal.
 .PD
 .PP
 The graphs are plotted with time on the horizontal axis.
-The vertical axes range from 0 to 1000, multiplied by the number of processors on the machine
+The vertical axes range from 0 to 1000*sleepsecs, 
+multiplied by the number of processors on the machine
 when appropriate.
 The only exceptions are
-memory
+memory,
 and swap space,
-which display fractions of the total available, and the Ethernet error count,
+which display fractions of the total available, 
+system load, which displays a number between 0 and 1000, 
+idle and intr, which display percentages and the Ethernet error count,
 which goes from 0 to 10..
 If the value of the parameter is too large for the visible range, its value is shown
 in decimal in the upper left corner of the graph.

+ 1 - 0
sys/src/9/alphapc/dat.h

@@ -148,6 +148,7 @@ struct Mach
 	ulong	fairness;		/* for runproc */
 
 	vlong	cpuhz;			/* hwrpb->cfreq */
+	uvlong	cyclefreq;		/* Frequency of user readable cycle counter */
 	ulong	pcclast;
 	uvlong	fastclock;
 	Perf	perf;			/* performance counters */

+ 1 - 0
sys/src/9/alphapc/fns.h

@@ -13,6 +13,7 @@ int		cistrcmp(char*, char*);
 int		cistrncmp(char*, char*, int);
 void		cpuidprint(void);
 void		cserve(ulong, ulong);
+#define cycles(x)
 void		timeradd(Timer *);
 void		timerdel(Timer *);
 int	dmacount(int);

+ 19 - 0
sys/src/9/alphapc/l.s

@@ -173,6 +173,25 @@ tas1:
 tas2:
 	RET
 
+TEXT	_xdec(SB), $-8
+	MOVQ	R0, R1		/* p */
+dec1:
+	MOVLL	(R1), R0		/* *p */
+	SUBL		$1, R0
+	MOVQ	R0, R2
+	MOVLC	R2, (R1)		/* --(*p) */
+	BEQ		R2, dec1		/* write failed, retry */
+	RET
+
+TEXT	_xinc(SB), $-8
+	MOVQ	R0, R1		/* p */
+inc1:
+	MOVLL	(R1), R0		/* *p */
+	ADDL	$1, R0
+	MOVLC	R0, (R1)		/* (*p)++ */
+	BEQ		R0, inc1		/* write failed, retry */
+	RET
+
 TEXT	fpenab(SB), $-8
 	MOVQ	R0, R16
 	CALL_PAL $PALwrfen

+ 2 - 1
sys/src/9/alphapc/mkfile

@@ -18,7 +18,8 @@ PORT=\
 	fault.$O\
 	latin1.$O\
 	log.$O\
-	nulledf.$O\
+	edf.$O\
+	mul64fract.$O\
 	page.$O\
 	parse.$O\
 	pgrp.$O\

+ 0 - 1
sys/src/9/bitsy/bitsy

@@ -14,7 +14,6 @@ dev
 	penmouse
 	pipe
 	proc
-	realtime	realtimesub edf
 	cap
 	srv
 	ssl

+ 1 - 0
sys/src/9/bitsy/dat.h

@@ -145,6 +145,7 @@ struct Mach
 
 	int	cpumhz;			/* speed of cpu */
 	vlong	cpuhz;			/* ... */
+	uvlong	cyclefreq;		/* Frequency of user readable cycle counter */
 
 	/* save areas for exceptions */
 	ulong	sfiq[5];

+ 1 - 0
sys/src/9/bitsy/devpenmouse.c

@@ -50,6 +50,7 @@ struct Mousestate
 
 struct Mouseinfo
 {
+	Lock;
 	Mousestate;
 	ulong	lastcounter;	/* value when /dev/mouse read */
 	Rendez	r;

+ 1 - 0
sys/src/9/bitsy/fns.h

@@ -15,6 +15,7 @@ int	cistrncmp(char*, char*, int);
 void	clockinit(void);
 ulong	clockpower(int);
 #define	coherence()
+#define cycles(x)
 #define	dcflush(a, b)
 void	delay(int);
 void	µcpower(int);

+ 22 - 0
sys/src/9/bitsy/main.c

@@ -529,3 +529,25 @@ getconf(char*)
 {
 	return nil;
 }
+
+long
+_xdec(long *p)
+{
+	int x;
+	long v;
+
+	x = splhi();
+	v = --*p;
+	splx(x);
+	return v;
+}
+
+void
+_xinc(long *p)
+{
+	int x;
+
+	x = splhi();
+	++*p;
+	splx(x);
+}

+ 2 - 1
sys/src/9/bitsy/mkfile

@@ -15,8 +15,10 @@ PORT=\
 	cache.$O\
 	chan.$O\
 	dev.$O\
+	edf.$O\
 	fault.$O\
 	latin1.$O\
+	mul64fract.$O\
 	rebootcmd.$O\
 	page.$O\
 	parse.$O\
@@ -24,7 +26,6 @@ PORT=\
 	portclock.$O\
 	print.$O\
 	proc.$O\
-	nulledf.$O\
 	qio.$O\
 	qlock.$O\
 	segment.$O\

+ 13 - 4
sys/src/9/bitsy/trap.c

@@ -6,6 +6,7 @@
 #include	"io.h"
 #include	"ureg.h"
 #include	"../port/error.h"
+#include	"tos.h"
 
 Intrregs *intrregs;
 
@@ -440,9 +441,14 @@ trap(Ureg *ureg)
 		break;
 	}
 
-	splhi();
-	if(user && (up->procctl || up->nnote))
-		notify(ureg);
+	if(user){
+		if(up->delaysched)
+			sched();
+		splhi();
+		if(up->procctl || up->nnote)
+			notify(ureg);
+	}else
+		splhi();
 }
 
 /*
@@ -570,6 +576,9 @@ syscall(Ureg* ureg)
 	if(scallnr == NOTED)
 		noted(ureg, *(ulong*)(sp+BY2WD));
 
+	if(up->delaysched)
+		sched();
+
 	splhi();
 	if(scallnr != RFORK && (up->procctl || up->nnote))
 		notify(ureg);
@@ -826,7 +835,7 @@ execregs(ulong entry, ulong ssize, ulong nargs)
 	ureg->r13 = (ulong)sp;
 	ureg->pc = entry;
 //print("%lud: EXECREGS pc 0x%lux sp 0x%lux\n", up->pid, ureg->pc, ureg->r13);
-	return USTKTOP-BY2WD;		/* address of user-level clock */
+	return USTKTOP-sizeof(Tos);		/* address of kernel/user shared data */
 }
 
 /*

+ 1 - 1
sys/src/9/boot/paq.c

@@ -8,7 +8,7 @@ char *fparts[] =
 	"add params	0x0040000 0x0080000",
 	"add kernel	0x0080000 0x0140000",
 	"add user	0x0140000 0x0200000",
-	"add ramdisk	0x0200000 0x0800000",
+	"add ramdisk	0x0200000 0x0600000",
 };
 
 void

+ 3 - 3
sys/src/9/ip/devip.c

@@ -730,7 +730,7 @@ setladdr(Conv* c)
 /*
  *  set a local port making sure the quad of raddr,rport,laddr,lport is unique
  */
-static char*
+char*
 setluniqueport(Conv* c, int lport)
 {
 	Proto *p;
@@ -764,7 +764,7 @@ setluniqueport(Conv* c, int lport)
 /*
  *  pick a local port and set it
  */
-static void
+void
 setlport(Conv* c)
 {
 	Proto *p;
@@ -813,7 +813,7 @@ setlport(Conv* c)
  *  set a local address and port from a string of the form
  *	[address!]port[!r]
  */
-static char*
+char*
 setladdrport(Conv* c, char* str, int announcing)
 {
 	char *p;

+ 3 - 5
sys/src/9/ip/tcp.c

@@ -49,7 +49,7 @@ enum
 	DEF_MSS		= 1460,		/* Default mean segment */
 	DEF_MSS6	= 1280,		/* Default mean segment (min) for v6 */
 	DEF_RTT		= 500,		/* Default round trip */
-	DEF_KAT		= 30000,	/* Default time ms) between keep alives */
+	DEF_KAT		= 120000,	/* Default time ms) between keep alives */
 	TCP_LISTEN	= 0,		/* Listen connection */
 	TCP_CONNECT	= 1,		/* Outgoing connection */
 	SYNACK_RXTIMER	= 250,		/* ms between SYNACK retransmits */
@@ -2066,9 +2066,7 @@ reset:
 	seg.wnd <<= tcb->rcv.scale;
 
 	if(tcb->kacounter > 0)
-		tcb->kacounter = MAXBACKMS / (tcb->katimer.start*MSPTICK);
-	if(tcb->kacounter < 3)
-		tcb->kacounter = 3;
+		tcpsetkacounter(tcb);
 
 	switch(tcb->state) {
 	case Closed:
@@ -2667,7 +2665,7 @@ tcpsendka(Conv *s)
 void
 tcpsetkacounter(Tcpctl *tcb)
 {
-	tcb->kacounter = MAXBACKMS / (tcb->katimer.start*MSPTICK);;
+	tcb->kacounter = (12 * 60 * 1000) / (tcb->katimer.start*MSPTICK);
 	if(tcb->kacounter < 3)
 		tcb->kacounter = 3;
 }

+ 1 - 0
sys/src/9/mtx/dat.h

@@ -138,6 +138,7 @@ struct Mach
 	ulong	bushz;
 	ulong	dechz;
 	ulong	tbhz;
+	uvlong	cyclefreq;		/* Frequency of user readable cycle counter */
 
 	ulong	pcclast;
 	uvlong	fastclock;

+ 3 - 2
sys/src/9/mtx/fns.h

@@ -8,10 +8,9 @@ void	clockinit(void);
 void	clockintr(Ureg*);
 void	clockintrsched(void);
 #define coherence()	eieio()
-void	timeradd(Timer *);
-void	timerdel(Timer *);
 void	cpuidentify(void);
 void	cpuidprint(void);
+#define cycles(x)
 void	dcflush(void*, ulong);
 void	delay(int);
 void	dumpregs(Ureg*);
@@ -109,6 +108,8 @@ int	screenprint(char*, ...);			/* debugging */
 int	segflush(void*, ulong);
 void	sync(void);
 int	tas(void*);
+void	timeradd(Timer *);
+void	timerdel(Timer *);
 void	touser(void*);
 void	trapinit(void);
 void	trapvec(void);

+ 20 - 0
sys/src/9/mtx/l.s

@@ -281,6 +281,26 @@ tas0:
 	ISYNC
 	RETURN
 
+TEXT	_xinc(SB),$0	/* void _xinc(long *); */
+	MOVW	R3, R4
+xincloop:
+	DCBF	(R4)	/* fix for 603x bug */
+	LWAR	(R4), R3
+	ADD		$1, R3
+	STWCCC	R3, (R4)
+	BNE		xincloop
+	RETURN
+
+TEXT	_xdec(SB),$0	/* long _xdec(long *); */
+	MOVW	R3, R4
+xdecloop:
+	DCBF	(R4)	/* fix for 603x bug */
+	LWAR	(R4), R3
+	ADD		$-1, R3
+	STWCCC	R3, (R4)
+	BNE		xdecloop
+	RETURN
+
 TEXT	getpvr(SB), $0
 	MOVW	SPR(PVR), R3
 	RETURN

+ 2 - 1
sys/src/9/mtx/mkfile

@@ -15,10 +15,11 @@ PORT=\
 	cache.$O\
 	chan.$O\
 	dev.$O\
+	edf.$O\
 	fault.$O\
 	latin1.$O\
 	log.$O\
-	nulledf.$O\
+	mul64fract.$O\
 	rebootcmd.$O\
 	page.$O\
 	parse.$O\

+ 2 - 1
sys/src/9/mtx/trap.c

@@ -5,6 +5,7 @@
 #include	"fns.h"
 #include	"ureg.h"
 #include	"io.h"
+#include	"tos.h"
 #include	"../port/error.h"
 
 static Lock vctllock;
@@ -536,7 +537,7 @@ execregs(ulong entry, ulong ssize, ulong nargs)
 	ureg->usp = (ulong)sp;
 	ureg->pc = entry;
 	ureg->srr1 &= ~MSR_FP;
-	return USTKTOP-BY2WD;		/* address of user-level clock */
+	return USTKTOP-sizeof(Tos);		/* address of kernel/user shared data */
 }
 
 void

+ 18 - 20
sys/src/9/pc/archmp.c

@@ -54,6 +54,18 @@ mpsearch(void)
 	return mpscan(KADDR(0xF0000), 0x10000);
 }
 
+static int identify(void);
+
+PCArch archmp = {
+.id=		"_MP_",	
+.ident=		identify,
+.reset=		mpshutdown,
+.intrinit=	mpinit,
+.intrenable=	mpintrenable,
+.fastclock=	i8253read,
+.timerset=	lapictimerset,
+};
+
 static int
 identify(void)
 {
@@ -86,6 +98,8 @@ identify(void)
 	if(sum || (pcmp->version != 1 && pcmp->version != 4))
 		return 1;
 
+	if(cpuserver && m->havetsc)
+		archmp.fastclock = tscticks;
 	return 0;
 }
 
@@ -102,37 +116,21 @@ syncclock(void)
 	if(m->machno == 0){
 		wrmsr(0x10, 0);
 		m->tscticks = 0;
-		m->tscoff = 0;
 	} else {
 		x = MACHP(0)->tscticks;
 		while(x == MACHP(0)->tscticks)
 			;
-		m->tscoff = MACHP(0)->tscticks;
-		wrmsr(0x10, 0);
-		m->tscticks = 0;
+		wrmsr(0x10, MACHP(0)->tscticks);
+		m->tscticks = MACHP(0)->tscticks;
 	}
 }
 
 uvlong
 tscticks(uvlong *hz)
 {
-	uvlong t;
-
 	if(hz != nil)
 		*hz = m->cpuhz;
 
-	rdtsc(&t);
-	m->tscticks = t;
-
-	return t+m->tscoff;
+	cycles(&m->tscticks);	/* Uses the rdtsc instruction */
+	return m->tscticks;
 }
-
-PCArch archmp = {
-.id=		"_MP_",	
-.ident=		identify,
-.reset=		mpshutdown,
-.intrinit=	mpinit,
-.intrenable=	mpintrenable,
-.fastclock=	i8253read,
-.timerset=	lapictimerset,
-};

+ 1 - 1
sys/src/9/pc/dat.h

@@ -190,6 +190,7 @@ struct Mach
 
 	Lock	apictimerlock;
 	int	cpumhz;
+	uvlong	cyclefreq;		/* Frequency of user readable cycle counter */
 	uvlong	cpuhz;
 	int	cpuidax;
 	int	cpuiddx;
@@ -198,7 +199,6 @@ struct Mach
 	int	havetsc;
 	int	havepge;
 	uvlong	tscticks;
-	uvlong	tscoff;
 
 	vlong	mtrrcap;
 	vlong	mtrrdef;

+ 7 - 7
sys/src/9/pc/ether8390.c

@@ -28,9 +28,9 @@ enum {					/* NIC core registers */
 	Crda0		= 0x08,		/* current remote DMA address 0 */
 	Crda1		= 0x09,		/* current remote DMA address 1 */
 	Rsr		= 0x0C,		/* receive status register */
-	Cntr0		= 0x0D,		/* frame alignment errors */
-	Cntr1		= 0x0E,		/* CRC errors */
-	Cntr2		= 0x0F,		/* missed packet errors */
+	Ref0		= 0x0D,		/* frame alignment errors */
+	Ref1		= 0x0E,		/* CRC errors */
+	Ref2		= 0x0F,		/* missed packet errors */
 
 					/* Page 0, write */
 	Pstart		= 0x01,		/* page start register */
@@ -594,9 +594,9 @@ interrupt(Ureg*, void* arg)
 		}
 
 		if(isr & Cnt){
-			ether->frames += regr(ctlr, Cntr0);
-			ether->crcs += regr(ctlr, Cntr1);
-			ether->buffs += regr(ctlr, Cntr2);
+			ether->frames += regr(ctlr, Ref0);
+			ether->crcs += regr(ctlr, Ref1);
+			ether->buffs += regr(ctlr, Ref2);
 			regw(ctlr, Isr, Cnt);
 		}
 	}
@@ -719,7 +719,7 @@ attach(Ether* ether)
 	regw(ctlr, Isr, 0xFF);
 	regw(ctlr, Imr, Cnt|Ovw|Txe|Rxe|Ptx|Prx);
 	regw(ctlr, Rcr, r);
-	r = regr(ctlr, Cntr2);
+	r = regr(ctlr, Ref2);
 	regw(ctlr, Tcr, LpbkNORMAL);
 	iunlock(ctlr);
 	USED(r);

+ 2 - 2
sys/src/9/pc/etherga620.c

@@ -628,7 +628,7 @@ ga620interrupt(Ureg*, void* arg)
 	if(!(csr32r(ctlr, Mhc) & Is))
 		return;
 	if(m->havetsc)
-		rdtsc(&tsc0);
+		cycles(&tsc0);
 
 	ctlr->interrupts++;
 	csr32w(ctlr, Hi, 1);
@@ -661,7 +661,7 @@ ga620interrupt(Ureg*, void* arg)
 	}
 
 	if(m->havetsc)
-		rdtsc(&tsc1);
+		cycles(&tsc1);
 	ctlr->ticks += tsc1-tsc0;
 }
 

+ 79 - 20
sys/src/9/pc/etherigbe.c

@@ -13,6 +13,15 @@
  *	add tuning control via ctl file;
  *	this driver is little-endian specific.
  */
+
+#ifdef FS
+#include "all.h"
+#include "io.h"
+#include "mem.h"
+#include "../ip/ip.h"
+
+#else
+
 #include "u.h"
 #include "../port/lib.h"
 #include "mem.h"
@@ -21,10 +30,22 @@
 #include "io.h"
 #include "../port/error.h"
 #include "../port/netif.h"
+#endif			/* FS */
 
 #include "etherif.h"
 #include "ethermii.h"
-
+#include "compat.h"
+
+/* from pci.c */
+enum
+{					/* command register (pcidev->pcr) */
+	IOen		= (1<<0),
+	MEMen		= (1<<1),
+	MASen		= (1<<2),
+	MemWrInv	= (1<<4),
+	PErrEn		= (1<<6),
+	SErrEn		= (1<<8),
+};
 enum {
 	Ctrl		= 0x00000000,	/* Device Control */
 	Status		= 0x00000008,	/* Device Status */
@@ -173,6 +194,8 @@ enum {					/* EEPROM content offsets */
 	Ea		= 0x00,		/* Ethernet Address */
 	Cf		= 0x03,		/* Compatibility Field */
 	Pba		= 0x08,		/* Printed Board Assembly number */
+	/* in fs kernel, Icw1 is defined in io.h; changed it here */
+#define Icw1 Igbe_icw1
 	Icw1		= 0x0A,		/* Initialization Control Word 1 */
 	Sid		= 0x0B,		/* Subsystem ID */
 	Svid		= 0x0C,		/* Subsystem Vendor ID */
@@ -557,6 +580,7 @@ static char* statistics[Nstatistics] = {
 	"TCP Segmentation Context Fail",
 };
 
+#ifndef FS
 static long
 igbeifstat(Ether* edev, void* a, long n, ulong offset)
 {
@@ -568,6 +592,8 @@ igbeifstat(Ether* edev, void* a, long n, ulong offset)
 	ctlr = edev->ctlr;
 	qlock(&ctlr->slock);
 	p = malloc(2*READSTR);
+	if (p == nil)
+		panic("igbeifstat: no mem");
 	l = 0;
 	for(i = 0; i < Nstatistics; i++){
 		r = csr32r(ctlr, Statistics+i*4);
@@ -678,6 +704,7 @@ igbectl(Ether* edev, void* buf, long n)
 
 	return n;
 }
+#endif		/* FS */
 
 static void
 igbepromiscuous(void* arg, int on)
@@ -717,9 +744,7 @@ igberballoc(void)
 static void
 igberbfree(Block* bp)
 {
-	bp->rp = bp->lim - Rbsz;
-	bp->wp = bp->rp;
-
+	BLKRESET(bp);
 	ilock(&igberblock);
 	bp->next = igberbpool;
 	igberbpool = bp;
@@ -742,14 +767,14 @@ igbelim(void* ctlr)
 }
 
 static void
-igbelproc(void* arg)
+igbelproc(PROCARG(void *arg))
 {
 	Ctlr *ctlr;
 	Ether *edev;
 	MiiPhy *phy;
 	int ctrl, r;
 
-	edev = arg;
+	edev = GETARG(arg);
 	ctlr = edev->ctlr;
 	for(;;){
 		if(ctlr->mii == nil || ctlr->mii->curphy == nil)
@@ -911,7 +936,7 @@ igbetransmit(Ether* edev)
 	 */
 	tdt = ctlr->tdt;
 	while(NEXT(tdt, ctlr->ntd) != tdh){
-		if((bp = qget(edev->oq)) == nil)
+		if((bp = etheroq(edev)) == nil)
 			break;
 		td = &ctlr->tdba[tdt];
 		td->addr[0] = PCIWADDR(bp->rp);
@@ -1009,7 +1034,7 @@ igberim(void* ctlr)
 }
 
 static void
-igberproc(void* arg)
+igberproc(PROCARG(void *arg))
 {
 	Rd *rd;
 	Block *bp;
@@ -1017,7 +1042,7 @@ igberproc(void* arg)
 	int r, rdh;
 	Ether *edev;
 
-	edev = arg;
+	edev = GETARG(arg);
 	ctlr = edev->ctlr;
 
 	igberxinit(ctlr);
@@ -1048,7 +1073,7 @@ igberproc(void* arg)
 			if((rd->status & Reop) && rd->errors == 0){
 				bp = ctlr->rb[rdh];
 				ctlr->rb[rdh] = nil;
-				bp->wp += rd->length;
+				INCRPTR(bp, rd->length);
 				bp->next = nil;
 				if(!(rd->status & Ixsm)){
 					ctlr->ixsm++;
@@ -1058,7 +1083,9 @@ igberproc(void* arg)
 						 * (and valid as errors == 0).
 						 */
 						ctlr->ipcs++;
+#ifndef FS
 						bp->flag |= Bipck;
+#endif
 					}
 					if(rd->status & Tcpcs){
 						/*
@@ -1066,12 +1093,16 @@ igberproc(void* arg)
 						 * (and valid as errors == 0).
 						 */
 						ctlr->tcpcs++;
+#ifndef FS
 						bp->flag |= Btcpck|Budpck;
+#endif
 					}
+#ifndef FS
 					bp->checksum = rd->checksum;
 					bp->flag |= Bpktck;
+#endif
 				}
-				etheriq(edev, bp, 1);
+				ETHERIQ(edev, bp, 1);
 			}
 			else if(ctlr->rb[rdh] != nil){
 				freeb(ctlr->rb[rdh]);
@@ -1116,6 +1147,8 @@ igbeattach(Ether* edev)
 
 	ctlr->rb = malloc(ctlr->nrd*sizeof(Block*));
 	ctlr->tb = malloc(ctlr->ntd*sizeof(Block*));
+	if (ctlr->tb == nil)
+		panic("igbeattach: no mem");
 
 	if(waserror()){
 		while(ctlr->nrb > 0){
@@ -1567,20 +1600,22 @@ release:
 static void
 igbedetach(Ctlr* ctlr)
 {
-	int r;
+	int r, s;
 
 	/*
 	 * Perform a device reset to get the chip back to the
 	 * power-on state, followed by an EEPROM reset to read
 	 * the defaults for some internal registers.
 	 */
+	s = splhi();		/* in case reset generates an interrupt */
 	csr32w(ctlr, Imc, ~0);
 	csr32w(ctlr, Rctl, 0);
 	csr32w(ctlr, Tctl, 0);
 
-	delay(10);
+	delay(100);		/* was 10 */
 
 	csr32w(ctlr, Ctrl, Devrst);
+	delay(100);		/* new */
 	while(csr32r(ctlr, Ctrl) & Devrst)
 		;
 
@@ -1599,12 +1634,14 @@ igbedetach(Ctlr* ctlr)
 	}
 
 	csr32w(ctlr, Imc, ~0);
+	delay(100);		/* new */
 	while(csr32r(ctlr, Icr))
 		;
+	splx(s);
 }
 
-static int
-igbereset(Ctlr* ctlr)
+int
+etherigbereset(Ctlr* ctlr)
 {
 	int ctrl, i, pause, r, swdpio, txcw;
 
@@ -1741,27 +1778,46 @@ igbepci(void)
 			print("igbe: can't map %8.8luX\n", p->mem[0].bar);
 			continue;
 		}
+
+		/*
+		 * from etherga620.c:
+		 * If PCI Write-and-Invalidate is enabled set the max write DMA
+		 * value to the host cache-line size (32 on Pentium or later).
+		 */
+		if(p->pcr & MemWrInv){
+			cls = pcicfgr8(p, PciCLS) * 4;
+			if(cls != CACHELINESZ)
+				pcicfgw8(p, PciCLS, CACHELINESZ/4);
+		}
+
 		cls = pcicfgr8(p, PciCLS);
 		switch(cls){
 			default:
-				print("igbe: unexpected CLS - %d\n", cls*4);
+				print("igbe: unexpected CLS - %d bytes\n",
+					cls*sizeof(long));
 				break;
 			case 0x00:
 			case 0xFF:
-				print("igbe: unusable CLS\n");
-				continue;
+				/* alphapc 164lx returns 0 */
+				print("igbe: unusable PciCLS: %d, using %d longs\n",
+					cls, CACHELINESZ/sizeof(long));
+				cls = CACHELINESZ/sizeof(long);
+				pcicfgw8(p, PciCLS, cls);
+				break;
 			case 0x08:
 			case 0x10:
 				break;
 		}
 		ctlr = malloc(sizeof(Ctlr));
+		if (ctlr == nil)
+			panic("ibgepci: no mem");
 		ctlr->port = port;
 		ctlr->pcidev = p;
 		ctlr->id = (p->did<<16)|p->vid;
 		ctlr->cls = cls*4;
 		ctlr->nic = KADDR(ctlr->port);
 
-		if(igbereset(ctlr)){
+		if(etherigbereset(ctlr)){
 			free(ctlr);
 			continue;
 		}
@@ -1811,18 +1867,21 @@ igbepnp(Ether* edev)
 	edev->attach = igbeattach;
 	edev->transmit = igbetransmit;
 	edev->interrupt = igbeinterrupt;
+#ifndef FS
 	edev->ifstat = igbeifstat;
 	edev->ctl = igbectl;
 
 	edev->arg = edev;
 	edev->promiscuous = igbepromiscuous;
-
+#endif
 	return 0;
 }
 
+#ifndef FS
 void
 etherigbelink(void)
 {
 	addethercard("i82543", igbepnp);
 	addethercard("igbe", igbepnp);
 }
+#endif

+ 2 - 2
sys/src/9/pc/fns.h

@@ -13,6 +13,7 @@ void	(*coherence)(void);
 void	cpuid(char*, int*, int*);
 int	cpuidentify(void);
 void	cpuidprint(void);
+void	cycles(uvlong*);
 void	delay(int);
 int	dmacount(int);
 int	dmadone(int);
@@ -118,13 +119,12 @@ void	pcmspecialclose(int);
 void	(*_pcmspecialclose)(int);
 void	pcmunmap(int, PCMmap*);
 void	printcpufreq(void);
-#define	procrestore(p)
+void	procrestore(Proc*);
 void	procsave(Proc*);
 void	procsetup(Proc*);
 void	putcr3(ulong);
 void	putcr4(ulong);
 void	rdmsr(int, vlong*);
-void	rdtsc(uvlong*);
 void	screeninit(void);
 int	screenprint(char*, ...);			/* debugging */
 void	(*screenputs)(char*, int);

+ 4 - 4
sys/src/9/pc/i8253.c

@@ -139,13 +139,13 @@ guesscpuhz(int aalcycles)
 		 */
 		outb(Tmode, Latch0);
 		if(m->havetsc)
-			rdtsc(&a);
+			cycles(&a);
 		x = inb(T0cntr);
 		x |= inb(T0cntr)<<8;
 		aamloop(loops);
 		outb(Tmode, Latch0);
 		if(m->havetsc)
-			rdtsc(&b);
+			cycles(&b);
 		y = inb(T0cntr);
 		y |= inb(T0cntr)<<8;
 		x -= y;
@@ -176,6 +176,7 @@ guesscpuhz(int aalcycles)
 		 */
 		m->cpumhz = (b+500000)/1000000L;
 		m->cpuhz = b;
+		m->cyclefreq = b;
 	} else {
 		/*
 		 *  add in possible 0.5% error and convert to MHz
@@ -234,7 +235,6 @@ i8253clock(Ureg* ureg, void*)
 void
 i8253enable(void)
 {
-print("i8253enable...");
 	i8253.enabled = 1;
 	i8253.period = Freq/HZ;
 	intrenable(IrqCLOCK, i8253clock, 0, BUSUNKNOWN, "clock");
@@ -306,6 +306,6 @@ perfticks(void)
 
 	if(!m->havetsc)
 		return m->ticks;
-	rdtsc(&x);
+	cycles(&x);
 	return x;
 }

+ 1 - 0
sys/src/9/pc/io.h

@@ -7,6 +7,7 @@ enum {
 	VectorBPT	= 3,		/* breakpoint */
 	VectorUD	= 6,		/* invalid opcode exception */
 	VectorCNA	= 7,		/* coprocessor not available */
+	Vector2F	= 8,		/* double fault */
 	VectorCSO	= 9,		/* coprocessor segment overrun */
 	VectorPF	= 14,		/* page fault */
 	VectorCERR	= 16,		/* coprocessor error */

+ 131 - 4
sys/src/9/pc/l.s

@@ -11,7 +11,7 @@
 #define CPUID		BYTE $0x0F; BYTE $0xA2	/* CPUID, argument in AX */
 #define WRMSR		BYTE $0x0F; BYTE $0x30	/* WRMSR, argument in AX/DX (lo/hi) */
 #define RDMSR		BYTE $0x0F; BYTE $0x32	/* RDMSR, result in AX/DX (lo/hi) */
-#define RDTSC 		BYTE $0x0F; BYTE $0x31
+#define RDTSC 		BYTE $0x0F; BYTE $0x31	/* RDTSC, result in AX/DX (lo/hi) */
 #define WBINVD		BYTE $0x0F; BYTE $0x09
 #define HLT		BYTE $0xF4
 #define SFENCE		BYTE $0x0F; BYTE $0xAE; BYTE $0xF8
@@ -47,6 +47,31 @@ TEXT _start0x80100020(SB),$0
 TEXT _start0x00100020(SB),$0
 	CLI					/* make sure interrupts are off */
 
+	/* set up the gdt so we have sane plan 9 style gdts. */
+	MOVL	$tgdtptr(SB), AX
+	ANDL	$~KZERO, AX
+	MOVL	(AX), GDTR
+	MOVW	$1, AX
+	MOVW	AX,MSW
+
+	/* clear prefetch queue (weird code to avoid optimizations) */
+	DELAY
+
+	/* set segs to something sane (avoid traps later) */
+	MOVW	$(1<<3),AX
+	MOVW	AX,DS
+	MOVW	AX,SS
+	MOVW	AX,ES
+	MOVW	AX,FS
+	MOVW	AX,GS
+
+/*	JMP	$(2<<3):$mode32bit(SB) /**/
+	 BYTE	$0xEA
+	 LONG	$mode32bit-KZERO(SB)
+	 WORD	$(2<<3)
+TEXT	mode32bit(SB),$0
+	/* At this point, the GDT setup is done. */
+
 	MOVL	$PADDR(CPU0PDB), DI		/* clear 4 pages for the tables etc. */
 	XORL	AX, AX
 	MOVL	$(4*BY2PG), CX
@@ -94,6 +119,33 @@ _setpte:
 	MOVL	DX, CR0				/* turn on paging */
 	JMP*	AX				/* jump to the virtual nirvana */
 
+/*
+ *  gdt to get us to 32-bit/segmented/unpaged mode
+ */
+TEXT	tgdt(SB),$0
+
+	/* null descriptor */
+	LONG	$0
+	LONG	$0
+
+	/* data segment descriptor for 4 gigabytes (PL 0) */
+	LONG	$(0xFFFF)
+	LONG	$(SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(0)|SEGDATA|SEGW)
+
+	/* exec segment descriptor for 4 gigabytes (PL 0) */
+	LONG	$(0xFFFF)
+	LONG	$(SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(0)|SEGEXEC|SEGR)
+
+/*
+ *  pointer to initial gdt
+ *  Note the -KZERO which puts the physical address in the gdtptr. 
+ *  that's needed as we start executing in physical addresses. 
+ */
+TEXT	tgdtptr(SB),$0
+
+	WORD	$(3*8)
+	LONG	$tgdt-KZERO(SB)
+
 /*
  * Basic machine environment set, can clear BSS and create a stack.
  * The stack starts at the top of the page containing the Mach structure.
@@ -278,17 +330,31 @@ TEXT putcr4(SB), $0
 	MOVL	AX, CR4
 	RET
 
-TEXT rdtsc(SB), $0				/* time stamp counter; cycles since power up */
+TEXT cycles(SB), $0				/* time stamp counter; cycles since power up */
 	RDTSC
-	MOVL	vlong+0(FP), CX			/* &vlong */
+	MOVL	vlong+0(FP), CX	/* &vlong */
 	MOVL	AX, 0(CX)			/* lo */
 	MOVL	DX, 4(CX)			/* hi */
 	RET
 
+TEXT rd0(SB), $0
+	MOVL	vlong+0(FP), CX
+	MOVL	$0, 0(CX)
+	MOVL	$0, 4(CX)
+	RET
+
+TEXT rdmsr10(SB), $0
+	MOVL	$0x10, CX
+	RDMSR
+	MOVL	vlong+0(FP), CX
+	MOVL	AX, 0(CX)
+	MOVL	DX, 4(CX)
+	RET
+
 TEXT rdmsr(SB), $0				/* model-specific register */
 	MOVL	index+0(FP), CX
 	RDMSR
-	MOVL	vlong+4(FP), CX			/* &vlong */
+	MOVL	vlong+4(FP), CX	/* &vlong */
 	MOVL	AX, 0(CX)			/* lo */
 	MOVL	DX, 4(CX)			/* hi */
 	RET
@@ -449,6 +515,7 @@ TEXT splx(SB), $0
 	MOVL	$(MACHADDR+0x04), AX 		/* save PC in m->splpc */
 	MOVL	(SP), BX
 	MOVL	BX, (AX)
+	/* fall through */
 
 TEXT splxpc(SB), $0				/* for iunlock */
 	MOVL	s+0(FP), AX
@@ -474,6 +541,23 @@ TEXT tas(SB), $0
 	XCHGL	AX, (BX)			/* lock->key */
 	RET
 
+TEXT	_xinc(SB),$0	/* void _xinc(long *); */
+	MOVL	l+0(FP),AX
+	LOCK
+	INCL	0(AX)
+	RET
+
+TEXT	_xdec(SB),$0	/* long _xdec(long *); */
+	MOVL	l+0(FP),AX
+	LOCK
+	DECL	0(AX)
+	JZ	iszero
+	MOVL	$1, AX
+	RET
+iszero:
+	MOVL	$0, AX
+	RET
+
 TEXT wbflush(SB), $0
 	CPUID
 	RET
@@ -492,6 +576,49 @@ TEXT xchgl(SB), $0
 	RET
  */
 
+TEXT	mul64fract(SB), $0
+	/* mul64fract(uvlong*r, uvlong a, uvlong b)
+	 *
+	 * multiply uvlong a by uvlong b and return a uvlong result.
+	 *
+	 * One of the input arguments is a uvlong integer,
+	 * the other represents a fractional number with
+	 * the integer portion in the most significant word and
+	 * the fractional portion in the least significant word.
+	 *
+	 * Example: mul64fract(&r, 2ULL, 3ULL << 31) returns 1ULL
+	 *
+	 * The uvlong integer result is returned through r
+	 *
+	 *	ignored		r0 = lo(a0*b0)
+	 *	lsw of result	r1 = hi(a0*b0) +lo(a0*b1) +	lo(a1*b0)
+	 *	msw of result	r2 = 		hi(a0*b1) +	hi(a1*b0) +	lo(a1*b1)
+	 *	ignored		r3 =						hi(a1*b1)
+	 */
+
+	MOVL	r+0(FP), CX
+	XORL	BX, BX		/* BX = 0 */
+
+	MOVL	a+8(FP),AX
+	MULL	b+16(FP)	/* a1*b1 */
+	MOVL	AX, 4(CX)	/* r2 = lo(a1*b1) */
+
+	MOVL	a+8(FP), AX
+	MULL	b+12(FP)	/* a1*b0 */
+	MOVL	AX, 0(CX)	/* r1 = lo(a1*b0) */
+	ADDL	DX, 4(CX)	/* r2 += hi(a1*b0) */
+
+	MOVL	a+4(FP), AX
+	MULL	b+16(FP)	/* a0*b1 */
+	ADDL	AX, 0(CX)	/* r1 += lo(a0*b1) */
+	ADCL	DX, 4(CX)	/* r2 += hi(a0*b1) + carry */
+
+	MOVL	a+4(FP), AX
+	MULL	b+12(FP)	/* a0*b0 */
+	ADDL	DX, 0(CX)	/* r1 += hi(a0*b0) */
+	ADCL	BX, 4(CX)	/* r2 += carry */
+	RET
+
 /*
  *  label consists of a stack pointer and a PC
  */

+ 18 - 1
sys/src/9/pc/main.c

@@ -548,18 +548,35 @@ mathinit(void)
  *  set up floating point for a new process
  */
 void
-procsetup(Proc *p)
+procsetup(Proc*p)
 {
 	p->fpstate = FPinit;
 	fpoff();
 }
 
+void
+procrestore(Proc *p)
+{
+	uvlong t;
+
+	if(p->kp || m->havetsc == 0)
+		return;
+	cycles(&t);
+	p->pcycles -= t;
+}
+
 /*
  *  Save the mach dependent part of the process state.
  */
 void
 procsave(Proc *p)
 {
+	uvlong t;
+
+	if(m->havetsc){
+		cycles(&t);
+		p->pcycles += t;
+	}
 	if(p->fpstate == FPactive){
 		if(p->state == Moribund)
 			fpoff();

+ 5 - 3
sys/src/9/pc/mkfile

@@ -1,5 +1,6 @@
 CONF=pc
-CONFLIST=pc pccpu pcdisk pcauth
+CONFLIST=pc pccpu pcf pccpuf pcdisk pcauth
+CRAPLIST=pccd pccpud pccpusape pcext pcf pcflop pcglenda pcgr pclml pcmartha pcsape pcblast
 
 objtype=386
 </$objtype/mkfile
@@ -17,7 +18,7 @@ PORT=\
 	dev.$O\
 	fault.$O\
 	latin1.$O\
-	nulledf.$O\
+	edf.$O\
 	page.$O\
 	parse.$O\
 	pgrp.$O\
@@ -74,7 +75,7 @@ $p$CONF.gz: $p$CONF
 
 install:V: $p$CONF $p$CONF.gz
 	cp $p$CONF $p$CONF.gz /$objtype/
-	# import lookout / /n/lookout && cp $p$CONF $p$CONF.gz /n/lookout/$objtype/
+	import lookout / /n/lookout && cp $p$CONF $p$CONF.gz /n/lookout/$objtype/
 
 <../boot/bootmkfile
 <../port/portmkfile
@@ -92,6 +93,7 @@ main.$O:			init.h reboot.h
 wavelan.$O:	wavelan.c ../pc/wavelan.c ../pc/wavelan.h
 etherwavelan.$O:	etherwavelan.c  ../pc/wavelan.h
 devusb.$O usbuhci.$O usbohci.$O:	usb.h
+trap.$O:	/sys/include/tos.h
 
 sd53c8xx.i:	sd53c8xx.n
 	aux/na $prereq > $target

+ 4 - 4
sys/src/9/pc/pc

@@ -1,6 +1,7 @@
 dev
 	root
 	cons
+
 	arch
 	pnp		pci
 	env
@@ -14,7 +15,6 @@ dev
 	tls
 	cap
 	kprof
-	realtime	realtimesub edf
 
 	ether		netif
 	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno
@@ -29,7 +29,7 @@ dev
 
 	audio		dma
 	pccard
-	i82365		cis	
+	i82365		cis
 	uart
 	usb
 	tv
@@ -63,7 +63,7 @@ misc
 	archmp		mp apic
 
 	sdata		pci sdscsi
-	sd53c8xx	pci sdscsi
+	sd53c8xx		pci sdscsi
 	sdmylex		pci sdscsi
 
 	uarti8250
@@ -81,6 +81,7 @@ misc
 	vgai81x	+cur
 	vgamach64xx	+cur
 	vgamga2164w	+cur
+	vgamga4xx	+cur
 	vganeomagic	+cur
 	vganvidia	+cur
 	vgargb524	=cur
@@ -89,7 +90,6 @@ misc
 	vgatvp3020	=cur
 	vgatvp3026	=cur
 	vgavmware	+cur
-	vgamga4xx	+cur
 
 ip
 	il

+ 0 - 1
sys/src/9/pc/pccpu

@@ -16,7 +16,6 @@ dev
 	sdp		thwack unthwack
 	cap
 	kprof
-	realtime	realtimesub edf
 
 	ether		netif
 	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno

+ 26 - 1
sys/src/9/pc/pccpuf

@@ -16,11 +16,14 @@ dev
 	sdp		thwack unthwack
 	cap
 	kprof
-	realtime	realtimesub edf
 
 	ether		netif
 	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno
 
+	draw		screen vga vgax
+	mouse		mouse
+	vga
+
 	sd
 	floppy		dma
 
@@ -54,6 +57,28 @@ misc
 	sdata		pci sdscsi
 	sd53c8xx	pci sdscsi
 
+	vga3dfx		+cur
+	vgaark2000pv	+cur
+	vgabt485	=cur
+	vgaclgd542x	+cur
+	vgaclgd546x	+cur
+	vgact65545	+cur
+	vgacyber938x	+cur
+	vgaet4000	+cur
+	vgahiqvideo	+cur
+	vgai81x	+cur
+	vgamach64xx	+cur
+	vgamga2164w	+cur
+	vgamga4xx	+cur
+	vganeomagic	+cur
+	vganvidia	+cur
+	vgargb524	=cur
+	vgas3		+cur vgasavage
+	vgat2r4		+cur
+	vgatvp3020	=cur
+	vgatvp3026	=cur
+	vgavmware	+cur
+
 
 ip
 	il

+ 0 - 2
sys/src/9/pc/pcdisk

@@ -14,7 +14,6 @@ dev
 	tls
 	cap
 	kprof
-	realtime	realtimesub edf
 
 	ether		netif
 	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno
@@ -24,7 +23,6 @@ dev
 	vga
 
 	sd
-	fs
 	floppy		dma
 	lpt
 

+ 0 - 1
sys/src/9/pc/pcf

@@ -14,7 +14,6 @@ dev
 	tls
 	cap
 	kprof
-	realtime	realtimesub edf
 
 	ether		netif
 	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno

+ 3 - 4
sys/src/9/pc/pcflop

@@ -14,7 +14,6 @@ dev
 #	tls
 	cap
 #	kprof
-#	realtime	realtimesub edf
 
 	ether		netif
 	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno
@@ -49,7 +48,7 @@ link
 	etherec2t	ether8390
 	etherelnk3	pci
 	etherga620	pci
-	etherigbe pci ethermii
+	etherigbe	pci ethermii
 #	ethersink
 	ethersmc	devi82365 cis
 	etherwavelan	wavelan devi82365 cis pci
@@ -63,7 +62,7 @@ misc
 #	archmp		mp apic
 
 	sdata		pci sdscsi
-	sd53c8xx		pci sdscsi
+	sd53c8xx	pci sdscsi
 	sdmylex		pci sdscsi
 
 	uarti8250
@@ -77,7 +76,7 @@ misc
 	vgacyber938x	+cur
 	vgaet4000	+cur
 	vgahiqvideo	+cur
-	vgai81x	+cur
+	vgai81x		+cur
 	vgamach64xx	+cur
 	vgamga2164w	+cur
 	vgamga4xx	+cur

+ 3 - 3
sys/src/9/pc/piix4smbus.c

@@ -96,7 +96,7 @@ transact(SMBus *s, int type, int addr, int cmd, uchar *data)
 	for(tries = 0; tries < 1000000; tries++){
 		if((inb(s->base+Hoststatus) & Host_busy) == 0)
 			break;
-		sched();
+		sched(nil);
 	}
 	if(tries >= 1000000){
 		// try aborting current transaction
@@ -104,7 +104,7 @@ transact(SMBus *s, int type, int addr, int cmd, uchar *data)
 		for(tries = 0; tries < 1000000; tries++){
 			if((inb(s->base+Hoststatus) & Host_busy) == 0)
 				break;
-			sched();
+			sched(nil);
 		}
 		if(tries >= 1000000){
 			snprint(err, sizeof(err), "SMBus jammed: %2.2ux", inb(s->base+Hoststatus));
@@ -138,7 +138,7 @@ transact(SMBus *s, int type, int addr, int cmd, uchar *data)
 		status = inb(s->base+Hoststatus);
 		if(status & (Failed|Bus_error|Dev_error|Host_complete))
 			break;
-		sched();
+		sched(nil);
 	}
 	if((status & Host_complete) == 0){
 		snprint(err, sizeof(err), "SMBus request failed: %2.2ux", status);

+ 1 - 0
sys/src/9/pc/sdata.c

@@ -1898,6 +1898,7 @@ atapnp(void)
 		case (0x244B<<16)|0x8086:	/* 82801BA (ICH2, High-End) */
 		case (0x248A<<16)|0x8086:	/* 82801CA (ICH3, Mobile) */
 		case (0x248B<<16)|0x8086:	/* 82801CA (ICH3, High-End) */
+		case (0x24CA<<16)|0x8086:	/* 82801DBM (ICH4, Mobile) */
 		case (0x24CB<<16)|0x8086:	/* 82801DB (ICH4, High-End) */
 		case (0x24DB<<16)|0x8086:	/* 82801EB (ICH5) */
 			break;

+ 96 - 22
sys/src/9/pc/trap.c

@@ -1,4 +1,5 @@
 #include	"u.h"
+#include	"tos.h"
 #include	"../port/lib.h"
 #include	"mem.h"
 #include	"dat.h"
@@ -11,15 +12,16 @@ void	noted(Ureg*, ulong);
 
 static void debugbpt(Ureg*, void*);
 static void fault386(Ureg*, void*);
+static void doublefault(Ureg*, void*);
 
 static Lock vctllock;
 static Vctl *vctl[256];
-ulong *intrtimes[256];
 
 enum
 {
-	Ntimevec = 1000		/* number of time buckets for each intr */
+	Ntimevec = 10		/* number of time buckets for each intr */
 };
+ulong intrtimes[256][Ntimevec];
 
 void
 intrenable(int irq, void (*f)(Ureg*, void*), void* a, int tbdf, char *name)
@@ -58,8 +60,6 @@ intrenable(int irq, void (*f)(Ureg*, void*), void* a, int tbdf, char *name)
 				vctl[vno]->isr, v->isr, vctl[vno]->eoi, v->eoi);
 		v->next = vctl[vno];
 	}
-	if(intrtimes[vno] == nil)
-		intrtimes[vno] = xalloc(Ntimevec*sizeof(ulong));
 	vctl[vno] = v;
 	iunlock(&vctllock);
 }
@@ -89,7 +89,7 @@ intrdisable(int irq, void (*f)(Ureg *, void *), void *a, int tbdf, char *name)
 	v = *pv;
 	*pv = (*pv)->next;	/* Link out the entry */
 	
-	if (vctl[vno] == nil && arch->intrdisable != nil)
+	if(vctl[vno] == nil && arch->intrdisable != nil)
 		arch->intrdisable(irq);
 	iunlock(&vctllock);
 	xfree(v);
@@ -208,6 +208,7 @@ trapinit(void)
 	 */
 	trapenable(VectorBPT, debugbpt, 0, "debugpt");
 	trapenable(VectorPF, fault386, 0, "fault386");
+	trapenable(Vector2F, doublefault, 0, "doublefault");
 
 	nmienable();
 
@@ -256,8 +257,9 @@ void
 intrtime(Mach*, int vno)
 {
 	ulong diff;
-	ulong x = perfticks();
+	ulong x;
 
+	x = perfticks();
 	diff = x - m->perf.intrts;
 	m->perf.intrts = x;
 
@@ -265,13 +267,29 @@ intrtime(Mach*, int vno)
 	if(up == nil && m->perf.inidle > diff)
 		m->perf.inidle -= diff;
 
-	diff /= m->cpumhz;
-	if(diff >= Ntimevec){
+	diff /= m->cpumhz*10;	// quantum = 10µsec
+	if(diff >= Ntimevec)
 		diff = Ntimevec-1;
-	}
 	intrtimes[vno][diff]++;
 }
 
+/* go to user space */
+void
+kexit(Ureg*)
+{
+	uvlong t;
+	Tos *tos;
+
+	/* precise time accounting, kernel exit */
+	tos = (Tos*)(USTKTOP-sizeof(Tos));
+	if(m->havetsc){
+		cycles(&t);
+		tos->kcycles += t - up->kentry;
+	}
+	tos->pcycles = up->pcycles;
+	tos->pid = up->pid;
+}
+
 /*
  *  All traps come here.  It is slower to have all traps call trap()
  *  rather than directly vectoring the handler.  However, this avoids a
@@ -286,12 +304,18 @@ trap(Ureg* ureg)
 	char buf[ERRMAX];
 	Vctl *ctl, *v;
 	Mach *mach;
+	Ureg urcopy;
+	ulong *u;
+
+	urcopy = *ureg;
+	memset(buf, 0, sizeof(buf));
 
 	m->perf.intrts = perfticks();
-	user = 0;
-	if((ureg->cs & 0xFFFF) == UESEL){
-		user = 1;
+	user = (ureg->cs & 0xFFFF) == UESEL;
+	if(user){
 		up->dbgreg = ureg;
+		if (m->havetsc)
+			cycles(&up->kentry);
 	}
 
 	vno = ureg->trap;
@@ -305,8 +329,20 @@ trap(Ureg* ureg)
 		if(ctl->isr)
 			ctl->isr(vno);
 		for(v = ctl; v != nil; v = v->next){
-			if(v->f)
+			if(v->f){
 				v->f(ureg, v->a);
+				if (vno & ~0xff){
+					u = (ulong*)&u;
+					for(i = 0; i < 40; ++i && (u+=4))
+						iprint("0x%lux:	0x%lux	0x%lux	0x%lux	0x%lux\n", u, u[0], u[1], u[2], u[3]);
+					iprint("vno 0x%ux after calling %s\n", vno, v->name);
+					iprint("ureg di si bp nsp bx dx cx ax gs fs es ds trap ecode pc cs flags sp ss\n");
+					u = (ulong*)ureg;
+					for(i = 0; i < 19; i++)
+						iprint("0x%lux ", u[i]);
+					panic("vno");
+				}
+			}
 		}
 		if(ctl->eoi)
 			ctl->eoi(vno);
@@ -363,6 +399,12 @@ trap(Ureg* ureg)
 		}
 		print("\n");
 		m->spuriousintr++;
+		if(user){
+			/* if we delayed sched because we held a lock, sched now */
+			if(up->delaysched)
+				sched();
+			kexit(ureg);