aboutsummaryrefslogtreecommitdiff
path: root/pc-bios/proll.patch
blob: dbe01e432ac57be9ac49d4d7969d7555abb0946e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
diff -ruN proll_18.orig/Makefile proll-patch-15/Makefile
--- proll_18.orig/Makefile	2002-09-13 14:16:59.000000000 +0000
+++ proll-patch-15/Makefile	2005-11-09 18:14:51.000000000 +0000
@@ -4,6 +4,7 @@
 	make -C krups-ser    all
 	make -C espresso     all
 	make -C espresso-ser all
+	make -C qemu all
 
 clean:
 	make -C mrcoffee clean
@@ -11,3 +12,4 @@
 	make -C krups-ser    clean
 	make -C espresso     clean
 	make -C espresso-ser clean
+	make -C qemu clean
diff -ruN proll_18.orig/qemu/Makefile proll-patch-15/qemu/Makefile
--- proll_18.orig/qemu/Makefile	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/qemu/Makefile	2005-08-14 10:25:06.000000000 +0000
@@ -0,0 +1,123 @@
+#
+# proll:
+# qemu/Makefile - make PROLL for QEMU
+# $Id: proll.patch,v 1.6 2005-11-11 00:24:57 bellard Exp $
+#
+# Copyright 1999 Pete Zaitcev
+# This is Free Software is licensed under terms of GNU General Public License.
+#
+
+CC = gcc
+
+#CROSS = /usr/local/sparc/bin/sparc-sun-linux-
+CROSS = sparc-unknown-linux-gnu-
+
+CROSSCC = $(CROSS)gcc
+CROSSLD = $(CROSS)ld
+CROSSNM = $(CROSS)nm
+
+RM = /bin/rm -f
+ELFTOAOUT = elftoaout
+
+#
+SRC = ../src
+
+# Due to remapping algorithm PROLBASE should be algned on PMD.
+# We make PROLBASE a define instead of using _start because we
+# want to shift it to form a PGD entry. A relocatable label will not work.
+# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>.
+PROLBASE =   0xffd00000
+PROLRODATA = 0xffd08000
+PROLDATA =   0xffd0b000
+PROLSIZE = 240*1024
+
+# Linux
+# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6.
+# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them.
+# __ANSI__ is supposed to be on by default but it is not.
+CFLAGS = -O2 -W -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -Wa,-xarch=v8 -g -DQEMU -m32 -fno-builtin
+ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g -Wa,-xarch=v8 -Wa,-32
+# Solaris or Linux/i386 cross compilation
+#CFLAGS = -Iinclude -O
+
+LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA)
+
+ALL = proll.aout
+PROLLEXE = proll.elf
+
+OBJS = head.o wuf.o wof.o main.o $(CONSOLE) \
+ printf.o le.o system_qemu.o iommu.o \
+ arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o \
+ vconsole.o hconsole.o rconsole.o vcons_zs.o esp.o
+
+all:           $(ALL)
+
+$(PROLLEXE):   $(OBJS)
+	$(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS)
+
+head.o:         head.S $(SRC)/phys_jj.h \
+  $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h
+	$(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S
+
+main.o:         main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \
+  $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \
+  $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h
+	$(CROSSCC) $(CFLAGS) -c $*.c
+openprom.o:	openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \
+  $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h
+	$(CROSSCC) $(CFLAGS) -c $*.c
+
+system_qemu.o:       system_qemu.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \
+  $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \
+  $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h
+	$(CROSSCC) $(CFLAGS) -c $*.c
+iommu.o:        $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \
+ $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+vconsole.o:	$(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+vcons_zs.o:	$(SRC)/vcons_zs.c $(SRC)/vconsole.h $(SRC)/system.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+hconsole.o:	$(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+rconsole.o:	$(SRC)/rconsole.c $(SRC)/rconsole.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+printf.o:       $(SRC)/printf.c
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+le.o:		$(SRC)/le.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/netpriv.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/net.h $(SRC)/phys_jj.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+esp.o:		$(SRC)/esp.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/phys_jj.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+arp.o:		$(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+netinit.o:	$(SRC)/netinit.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+tftp.o:		$(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+udp.o:		$(SRC)/udp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+packet.o:	$(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+sched_4m.o:	$(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h
+	$(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
+bootp.o:	$(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \
+  $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h
+	$(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c
+
+wuf.o:		$(SRC)/wuf.S
+	$(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
+wof.o:		$(SRC)/wof.S
+	$(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
+
+#genlab.o:      genlab.c
+#	$(CC) -c $*.c
+#
+#genlab:        genlab.o
+#	$(CC) -o genlab genlab.o
+
+clean:
+	$(RM) $(OBJS)
+	$(RM) $(PROLLEXE) proll.aout
+
+proll.aout:	$(PROLLEXE)
+	$(ELFTOAOUT) -o proll.aout $(PROLLEXE)
diff -ruN proll_18.orig/qemu/head.S proll-patch-15/qemu/head.S
--- proll_18.orig/qemu/head.S	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/qemu/head.S	2005-07-12 22:24:17.000000000 +0000
@@ -0,0 +1,543 @@
+/**
+ ** Standalone startup code for Linux PROM emulator.
+ ** Copyright 1999 Pete A. Zaitcev
+ ** This code is licensed under GNU General Public License.
+ **/
+/*
+ * $Id: proll.patch,v 1.6 2005-11-11 00:24:57 bellard Exp $
+ */
+
+#include <psr.h>
+#include <asi.h>
+#include <crs.h>
+/* #include <asm/head.h> */	/* Trap entries. Do not use. */
+#include "phys_jj.h"
+
+#define C_LABEL(name)	name
+#define REGWIN_SZ   0x40
+
+#define WRITE_PAUSE    nop; nop; nop; /* Have to do this after %wim/%psr chg */
+
+  /* 22 is 24-2, (va)>>(SRMMU_PGDIR_SHIFT-PTESIZESHFT) */
+#define VATOPGDOFF(va) (((va)>>22)&0x3FC)
+#define VATOPMDOFF(va) (((va)>>16)&0xFC)
+
+#define NOP_INSN       0x01000000     /* Used to patch sparc_save_state */
+
+/* Here are some trap goodies */
+
+#if 0
+/* Generic trap entry. */
+#define TRAP_ENTRY(type, label) \
+	rd %psr, %l0; b label; rd %wim, %l3; nop;
+#endif
+
+/* Data/text faults. */
+#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7;
+#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7;
+
+#if 0
+/* This is for traps we should NEVER get. */
+#define BAD_TRAP(num) \
+        rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
+
+/* This is for traps when we want just skip the instruction which caused it */
+#define SKIP_TRAP(type, name) \
+	jmpl %l2, %g0; rett %l2 + 4; nop; nop;
+
+/* Notice that for the system calls we pull a trick.  We load up a
+ * different pointer to the system call vector table in %l7, but call
+ * the same generic system call low-level entry point.  The trap table
+ * entry sequences are also HyperSparc pipeline friendly ;-)
+ */
+
+/* Software trap for Linux system calls. */
+#define LINUX_SYSCALL_TRAP \
+        sethi %hi(C_LABEL(sys_call_table)), %l7; \
+        or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
+        b linux_sparc_syscall; \
+        rd %psr, %l0;
+
+/* Software trap for SunOS4.1.x system calls. */
+#define SUNOS_SYSCALL_TRAP \
+        rd %psr, %l0; \
+        sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
+        b linux_sparc_syscall; \
+        or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
+
+/* Software trap for Slowaris system calls. */
+#define SOLARIS_SYSCALL_TRAP \
+        b solaris_syscall; \
+        rd %psr, %l0; \
+        nop; \
+        nop;
+
+#define INDIRECT_SOLARIS_SYSCALL(x) \
+	mov x, %g1; \
+	b solaris_syscall; \
+	rd %psr, %l0; \
+	nop;
+
+#define BREAKPOINT_TRAP \
+	b breakpoint_trap; \
+	rd %psr,%l0; \
+	nop; \
+	nop;
+
+/* Software trap for Sparc-netbsd system calls. */
+#define NETBSD_SYSCALL_TRAP \
+        sethi %hi(C_LABEL(sys_call_table)), %l7; \
+        or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
+        b bsd_syscall; \
+        rd %psr, %l0;
+
+/* The Get Condition Codes software trap for userland. */
+#define GETCC_TRAP \
+        b getcc_trap_handler; mov %psr, %l0; nop; nop;
+
+/* The Set Condition Codes software trap for userland. */
+#define SETCC_TRAP \
+        b setcc_trap_handler; mov %psr, %l0; nop; nop;
+
+/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
+ * gets handled with another macro.
+ */
+#define TRAP_ENTRY_INTERRUPT(int_level) \
+        mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
+
+/* NMI's (Non Maskable Interrupts) are special, you can't keep them
+ * from coming in, and basically if you get one, the shows over. ;(
+ * On the sun4c they are usually asynchronous memory errors, on the
+ * the sun4m they could be either due to mem errors or a software
+ * initiated interrupt from the prom/kern on an SMP box saying "I
+ * command you to do CPU tricks, read your mailbox for more info."
+ */
+#define NMI_TRAP \
+        rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
+
+#endif
+
+/* Window overflows/underflows are special and we need to try to be as
+ * efficient as possible here....
+ */
+#define WINDOW_SPILL \
+        rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;
+
+#define WINDOW_FILL \
+        rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;
+
+#define STUB_TRAP	ba stub_trap; nop; nop; nop;
+
+#define TRAP_ENTRY(a,b)		STUB_TRAP
+#define SKIP_TRAP(a,b)		STUB_TRAP
+#define SUNOS_SYSCALL_TRAP	STUB_TRAP
+#define SOLARIS_SYSCALL_TRAP	STUB_TRAP
+#define NETBSD_SYSCALL_TRAP	STUB_TRAP
+#define LINUX_SYSCALL_TRAP	STUB_TRAP
+#define BREAKPOINT_TRAP		STUB_TRAP
+#define NMI_TRAP		STUB_TRAP
+#define GETCC_TRAP		STUB_TRAP
+#define SETCC_TRAP		STUB_TRAP
+#define BAD_TRAP(n)		STUB_TRAP
+#define	TRAP_ENTRY_INTERRUPT(i)		STUB_TRAP
+#define	INDIRECT_SOLARIS_SYSCALL(i)	STUB_TRAP
+
+	.section ".text"
+	.globl start, _start
+_start:
+start:
+	.globl spill_window_entry, fill_window_entry
+
+#define	EXPORT_TRAP(trap) \
+	.globl trap; \
+	.type trap,function; \
+	.size trap, 16
+
+EXPORT_TRAP(t_zero)
+EXPORT_TRAP(t_wovf)
+EXPORT_TRAP(t_wunf)
+EXPORT_TRAP(t_irq1)
+EXPORT_TRAP(t_irq2)
+EXPORT_TRAP(t_irq3)
+EXPORT_TRAP(t_irq4)
+EXPORT_TRAP(t_irq5)
+EXPORT_TRAP(t_irq6)
+EXPORT_TRAP(t_irq7)
+EXPORT_TRAP(t_irq8)
+EXPORT_TRAP(t_irq9)
+EXPORT_TRAP(t_irq10)
+EXPORT_TRAP(t_irq11)
+EXPORT_TRAP(t_irq12)
+EXPORT_TRAP(t_irq13)
+EXPORT_TRAP(t_irq14)
+EXPORT_TRAP(t_irq15)
+
+C_LABEL(trapbase):
+t_zero:	b goprol; nop; nop; nop;
+t_tflt:	SRMMU_TFAULT                        /* Inst. Access Exception        */
+t_bins:	TRAP_ENTRY(0x2, bad_instruction)    /* Illegal Instruction           */
+t_pins:	TRAP_ENTRY(0x3, priv_instruction)   /* Privileged Instruction        */
+t_fpd:	TRAP_ENTRY(0x4, fpd_trap_handler)   /* Floating Point Disabled       */
+t_wovf:	WINDOW_SPILL                        /* Window Overflow               */
+t_wunf:	WINDOW_FILL                         /* Window Underflow              */
+t_mna:	TRAP_ENTRY(0x7, mna_handler)        /* Memory Address Not Aligned    */
+t_fpe:	TRAP_ENTRY(0x8, fpe_trap_handler)   /* Floating Point Exception      */
+t_dflt:	SRMMU_DFAULT                        /* Data Miss Exception           */
+t_tio:	TRAP_ENTRY(0xa, do_tag_overflow)    /* Tagged Instruction Ovrflw     */
+t_wpt:	TRAP_ENTRY(0xb, do_watchpoint)      /* Watchpoint Detected           */
+t_badc:	BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
+t_irq1:	TRAP_ENTRY_INTERRUPT(1)             /* IRQ Software/SBUS Level 1     */
+t_irq2:	TRAP_ENTRY_INTERRUPT(2)             /* IRQ SBUS Level 2              */
+t_irq3:	TRAP_ENTRY_INTERRUPT(3)             /* IRQ SCSI/DMA/SBUS Level 3     */
+t_irq4:	TRAP_ENTRY_INTERRUPT(4)             /* IRQ Software Level 4          */
+t_irq5:	TRAP_ENTRY_INTERRUPT(5)             /* IRQ SBUS/Ethernet Level 5     */
+t_irq6:	TRAP_ENTRY_INTERRUPT(6)             /* IRQ Software Level 6          */
+t_irq7:	TRAP_ENTRY_INTERRUPT(7)             /* IRQ Video/SBUS Level 5        */
+t_irq8:	TRAP_ENTRY_INTERRUPT(8)             /* IRQ SBUS Level 6              */
+t_irq9:	TRAP_ENTRY_INTERRUPT(9)             /* IRQ SBUS Level 7              */
+t_irq10:TRAP_ENTRY_INTERRUPT(10)            /* IRQ Timer #1 (one we use)     */
+t_irq11:TRAP_ENTRY_INTERRUPT(11)            /* IRQ Floppy Intr.              */
+t_irq12:TRAP_ENTRY_INTERRUPT(12)            /* IRQ Zilog serial chip         */
+t_irq13:TRAP_ENTRY_INTERRUPT(13)            /* IRQ Audio Intr.               */
+t_irq14:TRAP_ENTRY_INTERRUPT(14)            /* IRQ Timer #2                  */
+t_nmi:	NMI_TRAP                            /* Level 15 (NMI)                */
+t_racc:	TRAP_ENTRY(0x20, do_reg_access)     /* General Register Access Error */
+t_iacce:BAD_TRAP(0x21)                      /* Instr Access Error            */
+t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
+t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled)    /* Co-Processor Disabled         */
+t_uflsh:SKIP_TRAP(0x25, unimp_flush)        /* Unimplemented FLUSH inst.     */
+t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
+t_cpexc:TRAP_ENTRY(0x28, do_cp_exception)   /* Co-Processor Exception        */
+t_dacce:SRMMU_DFAULT                        /* Data Access Error             */
+t_hwdz:	TRAP_ENTRY(0x2a, do_hw_divzero)     /* Division by zero, you lose... */
+t_dserr:BAD_TRAP(0x2b)                      /* Data Store Error              */
+t_daccm:BAD_TRAP(0x2c)                      /* Data Access MMU-Miss          */
+t_bad2d:               BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f)
+        BAD_TRAP(0x30) BAD_TRAP(0x31) BAD_TRAP(0x32) BAD_TRAP(0x33)
+        BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) BAD_TRAP(0x37)
+        BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
+t_iaccm:BAD_TRAP(0x3c)                      /* Instr Access MMU-Miss         */
+ BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f)
+ BAD_TRAP(0x40) BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43)
+ BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) BAD_TRAP(0x47)
+ BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
+ BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
+ BAD_TRAP(0x50) BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53)
+ BAD_TRAP(0x54) BAD_TRAP(0x55) BAD_TRAP(0x56) BAD_TRAP(0x57)
+ BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) BAD_TRAP(0x5b)
+ BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
+ BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63)
+ BAD_TRAP(0x64) BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67)
+ BAD_TRAP(0x68) BAD_TRAP(0x69) BAD_TRAP(0x6a) BAD_TRAP(0x6b)
+ BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) BAD_TRAP(0x6f)
+ BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
+ BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77)
+ BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b)
+ BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f)
+t_sunos:SUNOS_SYSCALL_TRAP                  /* SunOS System Call             */
+t_sbkpt:BREAKPOINT_TRAP                     /* Software Breakpoint/KGDB      */
+t_divz:	BAD_TRAP(0x82)                      /* Divide by zero trap           */
+t_flwin:TRAP_ENTRY(0x83, do_flush_windows)  /* Flush Windows Trap            */
+t_clwin:BAD_TRAP(0x84)                      /* Clean Windows Trap            */
+t_rchk:	BAD_TRAP(0x85)                      /* Range Check                   */
+t_funal:BAD_TRAP(0x86)                      /* Fix Unaligned Access Trap     */
+t_iovf:	BAD_TRAP(0x87)                      /* Integer Overflow Trap         */
+t_slowl:SOLARIS_SYSCALL_TRAP                /* Slowaris System Call          */
+t_netbs:NETBSD_SYSCALL_TRAP                 /* Net-B.S. System Call          */
+t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d)
+ BAD_TRAP(0x8e) BAD_TRAP(0x8f)
+t_linux:LINUX_SYSCALL_TRAP                  /* Linux System Call             */
+t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93)
+ BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97)
+ BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
+t_getcc:GETCC_TRAP                          /* Get Condition Codes           */
+t_setcc:SETCC_TRAP                          /* Set Condition Codes           */
+t_bada2:BAD_TRAP(0xa2) BAD_TRAP(0xa3)
+ BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
+t_slowi:INDIRECT_SOLARIS_SYSCALL(156)
+ BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
+ BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf)
+ BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3)
+ BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7)
+ BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) BAD_TRAP(0xbb)
+ BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
+t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3)
+ BAD_TRAP(0xc4) BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7)
+ BAD_TRAP(0xc8) BAD_TRAP(0xc9) BAD_TRAP(0xca) BAD_TRAP(0xcb)
+ BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) BAD_TRAP(0xcf)
+ BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
+t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7)
+ BAD_TRAP(0xd8) BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb)
+ BAD_TRAP(0xdc) BAD_TRAP(0xdd) BAD_TRAP(0xde) BAD_TRAP(0xdf)
+ BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) BAD_TRAP(0xe3)
+ BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
+t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb)
+ BAD_TRAP(0xec) BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef)
+ BAD_TRAP(0xf0) BAD_TRAP(0xf1) BAD_TRAP(0xf2) BAD_TRAP(0xf3)
+ BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) BAD_TRAP(0xf7)
+ BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
+t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)
+dbtrap:	BAD_TRAP(0xfe)                      /* Debugger/PROM breakpoint #1   */
+dbtrap2:BAD_TRAP(0xff)                      /* Debugger/PROM breakpoint #2   */	
+
+stub_trap:
+   set (PHYS_JJ_TCX_FB + 0xbf0), %g5	/* 2 cells from side */
+   set 0x00ffffff, %g4
+   sta %g4, [%g5] ASI_M_BYPASS
+1:	ba 1b; nop
+
+	.section ".bss"
+	.align 8
+bss_start:
+	.align	0x1000		! PAGE_SIZE
+	.globl C_LABEL(bootup_user_stack)
+        .type   bootup_user_stack,#object
+        .size   bootup_user_stack,0x2000
+C_LABEL(bootup_user_stack):		.skip 0x2000
+
+	.section ".text"
+	.register %g2, #scratch
+	.register %g3, #scratch
+	.register %g6, #scratch
+	.register %g7, #scratch
+
+goprol:
+	! %g1 contains end of memory
+	set	PHYS_JJ_EEPROM + 0x30, %g1
+	lda	[%g1] ASI_M_BYPASS, %g1
+	! map PROLDATA to PROLBASE+PROLSIZE to end of ram
+	set	PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2	! add 0x1000 for temp tables
+	sub	%g1, %g2, %g2			! start of private memory
+	srl	%g2, 0x4, %g7			! ctx table at s+0x0
+	add	%g2, 0x400, %g3			! l1 table at s+0x400
+	srl	%g3, 0x4, %g3
+	or	%g3, 0x1, %g3
+	sta	%g3, [%g2] ASI_M_BYPASS
+	add	%g2, 0x400, %g2			! s+0x400
+	add	%g2, 0x800, %g3			! l2 table for ram (00xxxxxx) at s+0x800
+	srl	%g3, 0x4, %g3
+	or	%g3, 0x1, %g3
+	sta	%g3, [%g2] ASI_M_BYPASS
+	add	%g2, 0x500, %g3			! l2 table for rom (ffxxxxxx) at s+0x900
+	add	%g2, 0x3fc, %g2			! s+0x7fc
+	srl	%g3, 0x4, %g3
+	or	%g3, 0x1, %g3
+	sta	%g3, [%g2] ASI_M_BYPASS
+	add	%g2, 0x4, %g2			! s+0x800
+	set	((7 << 2) | 2), %g3		! 7 = U: --- S: RWX (main memory)
+	sta	%g3, [%g2] ASI_M_BYPASS
+	add	%g2, 0x200, %g3			! l3 table for rom at s+0xa00
+	add	%g2, 0x1d0, %g2			! s+0x9d0
+	srl	%g3, 0x4, %g3
+	or	%g3, 0x1, %g3
+	sta	%g3, [%g2] ASI_M_BYPASS
+	add	%g2, 0x30, %g2			! s+0xa00
+
+	set	PROLBASE, %g3
+	set	0x1000, %g5
+	set	(PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages
+1:	srl	%g3, 0x4, %g4
+	or	%g4, ((7 << 2) | 2), %g4	! 4 = U: --X S: --X (rom, execute only)
+	sta	%g4, [%g2] ASI_M_BYPASS
+	add	%g2, 4, %g2
+	add	%g3, %g5, %g3
+	deccc	%g6
+	bne	1b
+	 nop
+#if 0	
+	set	(PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages
+1:	srl	%g3, 0x4, %g4
+	or	%g4, ((0 << 2) | 2), %g4	! 0 = U: R-- S: R-- (rom, read only)
+	sta	%g4, [%g2] ASI_M_BYPASS
+	add	%g2, 4, %g2
+	add	%g3, %g5, %g3
+	deccc	%g6
+	bne	1b
+	 nop
+#endif
+	set	(PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages
+	set	0x1000, %g4
+	sll	%g7, 0x4, %g3
+	add	%g4, %g3, %g3
+1:	srl	%g3, 0x4, %g4
+	or	%g4, ((7 << 2) | 2), %g4        ! 5 = U: R-- S: RW- (data area, read/write)
+	sta	%g4, [%g2] ASI_M_BYPASS
+	add	%g2, 4, %g2
+	add	%g3, %g5, %g3
+	deccc	%g6
+	bne	1b
+	 nop
+
+	mov	%g1, %g3
+
+	set     AC_M_CTPR, %g2
+	sta     %g7, [%g2] ASI_M_MMUREGS	! set ctx table ptr
+	set	1, %g1
+	sta     %g1, [%g0] ASI_M_MMUREGS	! enable mmu
+
+	/*
+	 * The code which enables traps is a simplified version of
+	 * kernel head.S.
+	 *
+	 * We know number of windows as 8 so we do not calculate them.
+	 * The deadwood is here for any case.
+	 */
+
+	/* Turn on Supervisor, EnableFloating, and all the PIL bits.
+	 * Also puts us in register window zero with traps off.
+	 */
+	set	(PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
+	wr	%g2, 0x0, %psr
+	WRITE_PAUSE
+
+	/* I want a kernel stack NOW! */
+	set	C_LABEL(bootup_user_stack), %g1
+	set	(0x2000 - REGWIN_SZ), %g2
+	add	%g1, %g2, %sp
+	mov	0, %fp			/* And for good luck */
+
+	/* Zero out our BSS section. */
+	set	C_LABEL(bss_start) , %o0	! First address of BSS
+	set	C_LABEL(end) , %o1		! Last address of BSS
+	ba	2f
+	 nop
+1:
+	st	%g0, [%o0]
+2:
+	subcc	%o0, %o1, %g0
+	bl	1b
+	 add	%o0, 0x4, %o0
+
+	mov	2, %g1
+	wr	%g1, 0x0, %wim			! make window 1 invalid
+	WRITE_PAUSE
+
+#if 0
+	wr  %g0, 0x0, %wim
+	WRITE_PAUSE
+	save
+	rd  %psr, %g3
+	restore
+	and  %g3, PSR_CWP, %g3
+	add  %g3, 0x1, %g3
+#else
+	or	%g0, 8, %g3
+#endif
+
+#if 0
+	sethi	%hi( C_LABEL(cputyp) ), %o0
+	st	%g7, [%o0 + %lo( C_LABEL(cputyp) )]
+
+	sethi	%hi( C_LABEL(nwindows) ), %g4
+	st	%g3, [%g4 + %lo( C_LABEL(nwindows) )]
+
+	sub	%g3, 0x1, %g3
+	sethi	%hi( C_LABEL(nwindowsm1) ), %g4
+	st	%g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
+#endif
+
+	/* Here we go, start using Linux's trap table... */
+	set	C_LABEL(trapbase), %g3
+	wr	%g3, 0x0, %tbr
+	WRITE_PAUSE
+
+	/* Finally, turn on traps so that we can call c-code. */
+	rd	%psr, %g3
+	wr	%g3, 0x0, %psr
+	WRITE_PAUSE
+
+	wr	%g3, PSR_ET, %psr
+	WRITE_PAUSE
+
+	.globl prolmain
+	call C_LABEL(prolmain)
+	 nop
+
+3:
+	b       3b
+	 nop
+
+/*
+ * Memory access trap handler
+ *   %l0  program %psr from trap table entry
+ *   %l1  program %pc from hardware
+ *   %l2  program %npc from hardware
+ *   %l3  program %wim from trap table entry
+ *   %l4
+ *   %l5
+ *   %l6
+ *   %l7  text flag from trap table entry
+ */
+
+	.section ".text"
+	.globl srmmu_fault
+C_LABEL(srmmu_fault):
+
+	set AC_M_SFAR, %l6
+	set AC_M_SFSR, %l5
+	lda [%l6] ASI_M_MMUREGS, %l6
+	lda [%l5] ASI_M_MMUREGS, %l5
+
+	set ignore_fault, %l5
+	ld [%l5], %l5
+	subcc %l5, %g0, %g0		/* NULL pointer trap faults always */
+	be 3f
+	 nop
+	subcc %l5, %l6, %g0
+	be 2f
+	 nop
+3:
+
+   set (PHYS_JJ_TCX_FB + 0xbf0), %g5	/* 2 cells from side */
+   set 0x00ffffff, %g4
+   sta %g4, [%g5] ASI_M_BYPASS
+   add %g5, 8, %g5			/* On right side */
+   sta %g4, [%g5] ASI_M_BYPASS
+1:	ba 1b; nop
+
+2:
+	set C_LABEL(fault_ignored), %l5
+	mov 1, %l6
+	st %l6, [%l5]
+
+	/*
+	 * Skip the faulting instruction.
+	 * I think it works when next instruction is a branch even.
+	 */
+	or %l2, 0, %l1
+	add %l2, 4, %l2
+
+	wr %l0, 0, %psr
+	WRITE_PAUSE
+	jmp %l1
+	rett %l2
+
+/*
+ * Slow external versions of st_bypass and ld_bypass.
+ * rconsole.c uses inlines. We call these in places which are not speed
+ * critical, to avoid compiler bugs.
+ */
+	.globl C_LABEL(st_bypass)
+C_LABEL(st_bypass):
+	retl
+	 sta %o1, [%o0] ASI_M_BYPASS
+	.globl C_LABEL(ld_bypass)
+C_LABEL(ld_bypass):
+	retl
+	 lda [%o0] ASI_M_BYPASS, %o0
+	.globl C_LABEL(sth_bypass)
+C_LABEL(sth_bypass):
+	retl
+	 stha %o1, [%o0] ASI_M_BYPASS
+	.globl C_LABEL(ldh_bypass)
+C_LABEL(ldh_bypass):
+	retl
+	 lduha [%o0] ASI_M_BYPASS, %o0
+	.globl C_LABEL(stb_bypass)
+C_LABEL(stb_bypass):
+	retl
+	 stba %o1, [%o0] ASI_M_BYPASS
+	.globl C_LABEL(ldb_bypass)
+C_LABEL(ldb_bypass):
+	retl
+	 lduba [%o0] ASI_M_BYPASS, %o0
diff -ruN proll_18.orig/qemu/main.c proll-patch-15/qemu/main.c
--- proll_18.orig/qemu/main.c	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/qemu/main.c	2005-08-14 10:07:48.000000000 +0000
@@ -0,0 +1,185 @@
+/**
+ ** Proll (PROM replacement)
+ ** Copyright 1999 Pete Zaitcev
+ ** This code is licensed under GNU General Public License.
+ **/
+#include <stdarg.h>
+
+// #include <asm/contregs.h>
+#include <asi.h>
+#include "pgtsrmmu.h"
+#include "iommu.h"		/* Typical SBus IOMMU for sun4m */
+#include "phys_jj.h"
+#include "vconsole.h"
+#include "version.h"
+#include <general.h>		/* __P() */
+#include <net.h>		/* init_net() */
+#include <romlib.h>		/* we are a provider for part of this. */
+#include <netpriv.h>		/* myipaddr */
+#include <arpa.h>
+#include <system.h>		/* our own prototypes */
+
+void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic);
+int vcon_zs_init(struct vconterm *t, unsigned int a0);
+int vcon_zs_write(struct vconterm *t, char *data, int leng);
+int vcon_zs_getch(struct vconterm *t);
+void esp_probe();
+int esp_boot(int unit);
+static void init_idprom(void);
+
+struct vconterm dp0;
+struct mem cmem;		/* Current memory, virtual */
+struct mem cio;			/* Current I/O space */
+struct phym pmem;		/* Current phys. mem. */
+struct iommu ciommu;		/* Our IOMMU on sun4m */
+
+static struct {
+    const char id[16];
+    unsigned int version;
+    char pad1[0x1c]; // Pad to 0x30
+    unsigned int ram_size;
+    char boot_device;
+    unsigned int load_addr, kernel_size;
+    unsigned int cmdline, cmdline_len;
+    char pad2[0x0c]; // Pad to 0x54
+    unsigned short width, height, depth;
+} *hw_idprom;
+
+int ignore_fault, fault_ignored;
+void *printk_fn, *getch_fn;
+unsigned int q_height, q_width;
+
+/*
+ */
+void prolmain()
+{
+	static char fname[14];
+	static struct banks bb;
+	unsigned int hiphybas;
+	const void *romvec;
+	unsigned int ram_size;
+	char nographic, bootdev;
+
+	nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F);
+	if (!nographic) {
+	    q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54);
+	    q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56);
+	    vcon_init(&dp0, PHYS_JJ_TCX_FB);
+	    printk_fn = vcon_write;
+	    getch_fn = vcon_getch;
+	}
+	else {
+	    vcon_zs_init(&dp0, 0x71100004);
+	    printk_fn = vcon_zs_write;
+	    getch_fn = vcon_zs_getch;
+	}
+
+
+	printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);
+	ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);
+	printk("%d MB total\n", ram_size/(1024*1024));
+
+	bb.nbanks = 1;
+	bb.bankv[0].start = 0;
+	bb.bankv[0].length = ram_size;
+
+	hiphybas = ram_size - PROLSIZE;
+
+	mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));
+	makepages(&pmem, hiphybas);
+	init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);
+
+	mem_init(&cio, (char *)(PROLBASE+PROLSIZE),
+	    (char *)(PROLBASE+PROLSIZE+IOMAPSIZE));
+
+	iommu_init(&ciommu, hiphybas);
+
+	/*
+	 */
+	init_idprom();
+	printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version);
+	if (!nographic)
+	    printk("Prom console: TCX %dx%d\n", q_width, q_height);
+	else
+	    printk("Prom console: serial\n");
+	sched_init();
+	le_probe();
+	init_net();
+	esp_probe();
+
+	bootdev = hw_idprom->boot_device;
+	printk("Boot device: %c\n", bootdev);
+	if (hw_idprom->kernel_size > 0) {
+	    printk("Kernel already loaded\n");
+	} else if (bootdev == 'n') {
+	    if (bootp() != 0) fatal();
+	    /*
+	     * boot_rec.bp_file cannot be used because system PROM
+	     * uses it to locate ourselves. If we load from boot_rec.bp_file,
+	     * we will loop reloading PROLL over and over again.
+	     * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L).
+	     */
+	    xtoa(myipaddr, fname, 8);
+	    fname[9] = '.';
+	    fname[10] = 'P';
+	    fname[11] = 'R';
+	    fname[12] = 'O';
+	    fname[13] = 'L';
+	    fname[14] = 0;
+	    
+	    if (load(boot_rec.bp_siaddr, fname) != 0) fatal();
+	} else if (bootdev == 'c') {
+	    if (esp_boot(0) != 0) fatal();
+	} else if (bootdev == 'd') {
+	    if (esp_boot(2) != 0) fatal();
+	}
+
+	romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas,
+				    (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic);
+
+	printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",
+	    PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,
+	    (int)cio.start, (int)cio.curp);
+
+	{
+	    void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr;
+		printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n",
+		       *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline);
+		entry(romvec, 0, 0, 0, 0);
+	}
+
+	mem_fini(&cmem);
+	vcon_fini(&dp0);
+}
+
+/*
+ * dvma_alloc over iommu_alloc.
+ */
+void *dvma_alloc(int size, unsigned int *pphys)
+{
+	return iommu_alloc(&ciommu, size, pphys);
+}
+
+/*
+ */
+void udelay(__attribute__((unused)) unsigned long usecs)
+{
+    // Qemu hardware is perfect and does not need any delays!
+}
+
+static void init_idprom()
+{
+	void *va_prom;
+
+	if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {
+		printk("init_idprom: cannot map eeprom\n");
+		fatal();
+	}
+	bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE);
+	/*
+	 * hw_idprom is not used anywhere.
+	 * It's just as we hate to leave hanging pointers (I/O page here).
+	 */
+	hw_idprom = va_prom; 
+}
+
diff -ruN proll_18.orig/qemu/openprom.c proll-patch-15/qemu/openprom.c
--- proll_18.orig/qemu/openprom.c	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/qemu/openprom.c	2005-11-07 20:11:04.000000000 +0000
@@ -0,0 +1,910 @@
+/*
+ * PROM interface support
+ * Copyright 1996 The Australian National University.
+ * Copyright 1996 Fujitsu Laboratories Limited
+ * Copyright 1999 Pete A. Zaitcev
+ * This software may be distributed under the terms of the Gnu
+ * Public License version 2 or later
+ */
+
+#include <openprom.h>
+#include <general.h>
+#include <romlib.h>
+#include <system.h>
+#include <vconsole.h>
+#include "phys_jj.h"
+
+//#define DEBUG_OBP
+
+#define PAGE_SIZE 4096
+
+struct property {
+	const char *name;
+	const char *value;
+	int length;
+};
+
+struct node {
+	const struct property *properties;
+	/* short */ const int sibling;
+	/* short */ const int child;
+};
+
+static int obp_nextnode(int node);
+static int obp_child(int node);
+static int obp_proplen(int node, char *name);
+static int obp_getprop(int node, char *name, char *val);
+static int obp_setprop(int node, char *name, char *val, int len);
+static const char *obp_nextprop(int node, char *name);
+
+static char obp_idprom[IDPROM_SIZE];
+static const struct property null_properties = { NULL, NULL, -1 };
+static const int prop_true = -1;
+
+static struct property propv_root[7];
+
+static const struct property propv_root_templ[] = {
+	{"name",	"SUNW,SparcStation-5", sizeof("SUNW,SparcStation-5") },
+	{"idprom",	obp_idprom, IDPROM_SIZE},
+	{"banner-name", "SparcStation", sizeof("SparcStation")},
+	{"compatible",	"sun4m", 6},
+};
+
+static const int prop_iommu_reg[] = {
+	0x0, 0x10000000, 0x00000300,
+};
+static const struct property propv_iommu[] = {
+	{"name",	"iommu", sizeof("iommu")},
+	{"reg",		(char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_sbus_ranges[] = {
+	0x0, 0x0, 0x0, 0x30000000, 0x10000000,
+	0x1, 0x0, 0x0, 0x40000000, 0x10000000,
+	0x2, 0x0, 0x0, 0x50000000, 0x10000000,
+	0x3, 0x0, 0x0, 0x60000000, 0x10000000,
+	0x4, 0x0, 0x0, 0x70000000, 0x10000000,
+};
+static const struct property propv_sbus[] = {
+	{"name",	"sbus", 5},
+	{"ranges",	(char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)},
+	{"device_type",	"hierarchical", sizeof("hierarchical") },
+	{NULL, NULL, -1}
+};
+
+static const int prop_tcx_regs[] = {
+	0x2, 0x00800000, 0x00100000,
+	0x2, 0x02000000, 0x00000001,
+	0x2, 0x04000000, 0x00800000,
+	0x2, 0x06000000, 0x00800000,
+	0x2, 0x0a000000, 0x00000001,
+	0x2, 0x0c000000, 0x00000001,
+	0x2, 0x0e000000, 0x00000001,
+	0x2, 0x00700000, 0x00001000,
+	0x2, 0x00200000, 0x00000004,
+	0x2, 0x00300000, 0x0000081c,
+	0x2, 0x00000000, 0x00010000,
+	0x2, 0x00240000, 0x00000004,
+	0x2, 0x00280000, 0x00000001,
+};
+
+#if 1	/* Zaitcev */
+static const int pixfreq = 0x03dfd240;
+static const int hbporch = 0xa0;
+static const int vfreq = 0x3c;
+#endif
+#if 0	/* Kevin Boone - 70Hz refresh */
+static const int pixfreq = 0x047868C0;
+static const int hbporch = 0x90;
+static const int vfreq = 0x46;
+#endif
+
+static const int vbporch = 0x1d;
+static const int vsync = 0x6;
+static const int hsync = 0x88;
+static const int vfporch = 0x3;
+static const int hfporch = 0x18;
+static const int height = 0x300;
+static const int width = 0x400;
+static const int linebytes = 0x400;
+static const int depth = 24;
+static const int tcx_intr[] = { 5, 0 };
+static const int tcx_interrupts = 5;
+static const struct property propv_sbus_tcx[] = {
+	{"name",	"SUNW,tcx", sizeof("SUNW,tcx")},
+	{"vbporch",	(char*)&vbporch, sizeof(int)},
+	{"hbporch",	(char*)&hbporch, sizeof(int)},
+	{"vsync",	(char*)&vsync, sizeof(int)},
+	{"hsync",	(char*)&hsync, sizeof(int)},
+	{"vfporch",	(char*)&vfporch, sizeof(int)},
+	{"hfporch",	(char*)&hfporch, sizeof(int)},
+	{"pixfreq",	(char*)&pixfreq, sizeof(int)},
+	{"vfreq",	(char*)&vfreq, sizeof(int)},
+	{"height",	(char*)&height, sizeof(int)},
+	{"width",	(char*)&width, sizeof(int)},
+	{"linebytes",	(char*)&linebytes, sizeof(int)},
+	{"depth",	(char*)&depth, sizeof(int)},
+	{"reg",		(char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)},
+	{"tcx-8-bit",	0, -1},
+	{"intr",	(char*)&tcx_intr[0], sizeof(tcx_intr)},
+	{"interrupts",	(char*)&tcx_interrupts, sizeof(tcx_interrupts)},
+	{"device_type",	"display", sizeof("display")},
+	{NULL, NULL, -1}
+};
+
+static const int prop_cs4231_reg[] = {
+	0x3, 0x0C000000, 0x00000040
+};
+static const int cs4231_interrupts = 5;
+static const int cs4231_intr[] = { 5, 0 };
+
+static const struct property propv_sbus_cs4231[] = {
+	{"name",	"SUNW,CS4231", sizeof("SUNW,CS4231") },
+	{"intr",	(char*)&cs4231_intr[0], sizeof(cs4231_intr) },
+	{"interrupts",  (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) },	
+	{"reg",		(char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) },
+	{"device_type", "serial", sizeof("serial") },
+	{"alias",	"audio", sizeof("audio") },
+	{NULL, NULL, -1}
+};
+
+static const int cpu_nctx = NCTX_SWIFT;
+static const int cpu_cache_line_size = 0x20;
+static const int cpu_cache_nlines = 0x200;
+static const struct property propv_cpu[] = {
+	{"name",	"STP1012PGA", sizeof("STP1012PGA") },
+	{"device_type",	"cpu", 4 },
+	{"mmu-nctx",	(char*)&cpu_nctx, sizeof(int)},
+	{"cache-line-size",	(char*)&cpu_cache_line_size, sizeof(int)},
+	{"cache-nlines",	(char*)&cpu_cache_nlines, sizeof(int)},
+	{NULL, NULL, -1}
+};
+
+static const int prop_obio_ranges[] = {
+	0x0, 0x0, 0x0, 0x71000000, 0x01000000,
+};
+static const struct property propv_obio[] = {
+	{"name",	"obio", 5 },
+	{"ranges",	(char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },
+	{"device_type",	"hierarchical", sizeof("hierarchical") },
+	{NULL, NULL, -1}
+};
+
+static const int prop_auxio_reg[] = {
+	0x0, 0x00900000, 0x00000001,
+};
+static const struct property propv_obio_auxio[] = {
+	{"name",	"auxio", sizeof("auxio") },
+	{"reg",		(char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_int_reg[] = {
+	0x0, 0x00e00000, 0x00000010,
+	0x0, 0x00e10000, 0x00000010,
+};
+static const struct property propv_obio_int[] = {
+	{"name",	"interrupt", sizeof("interrupt")},
+	{"reg",		(char*)&prop_int_reg[0], sizeof(prop_int_reg) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_cnt_reg[] = {
+	0x0, 0x00d00000, 0x00000010,
+	0x0, 0x00d10000, 0x00000010,
+};
+static const struct property propv_obio_cnt[] = {
+	{"name",	"counter", sizeof("counter")},
+	{"reg",		(char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_eeprom_reg[] = {
+	0x0, 0x00200000, 0x00002000,
+};
+static const struct property propv_obio_eep[] = {
+	{"name",	"eeprom", sizeof("eeprom")},
+	{"reg",		(char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) },
+	{"model",	"mk48t08", sizeof("mk48t08")},
+	{NULL, NULL, -1}
+};
+
+static const int prop_su_reg[] = {
+	0x0, 0x003002f8, 0x00000008,
+};
+static const struct property propv_obio_su[] = {
+	{"name",	"su", sizeof("su")},
+	{"reg",		(char*)&prop_su_reg[0], sizeof(prop_su_reg) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_zs_intr[] = { 0x2c, 0x0 };
+static const int prop_zs_reg[] = {
+	0x0, 0x00000000, 0x00000008,
+};
+static void *prop_zs_addr;
+static const int prop_zs_slave = 1;
+static const struct property propv_obio_zs[] = {
+	{"name",	"zs", sizeof("zs")},
+	{"reg",		(char*)&prop_zs_reg[0], sizeof(prop_zs_reg) },
+	{"slave",	(char*)&prop_zs_slave, sizeof(prop_zs_slave) },
+	{"device_type", "serial", sizeof("serial") },
+	{"intr",	(char*)&prop_zs_intr[0], sizeof(prop_zs_intr) },
+	{"address",	(char*)&prop_zs_addr, sizeof(prop_zs_addr) },
+	{"keyboard",	(char*)&prop_true, 0},
+	{"mouse",	(char*)&prop_true, 0},
+	{NULL, NULL, -1}
+};
+
+static const int prop_zs1_intr[] = { 0x2c, 0x0 };
+static const int prop_zs1_reg[] = {
+	0x0, 0x00100000, 0x00000008,
+};
+static void *prop_zs1_addr;
+static const int prop_zs1_slave = 0;
+static const struct property propv_obio_zs1[] = {
+	{"name",	"zs", sizeof("zs")},
+	{"reg",		(char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) },
+	{"slave",	(char*)&prop_zs1_slave, sizeof(prop_zs1_slave) },
+	{"device_type", "serial", sizeof("serial") },
+	{"intr",	(char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) },
+	{"address",	(char*)&prop_zs1_addr, sizeof(prop_zs1_addr) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_ledma_reg[] = {
+	0x4, 0x08400010, 0x00000020,
+};
+static const int prop_ledma_burst = 0x3f;
+static const struct property propv_sbus_ledma[] = {
+	{"name",	"ledma", sizeof("ledma")},
+	{"reg",		(char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) },
+	{"burst-sizes",	(char*)&prop_ledma_burst, sizeof(int) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_le_reg[] = {
+	0x4, 0x08c00000, 0x00000004,
+};
+static const int prop_le_busmaster_regval = 0x7;
+static const int prop_le_intr[] = { 0x26, 0x0 };
+static const struct property propv_sbus_ledma_le[] = {
+	{"name",	"le", sizeof("le")},
+	{"reg",		(char*)&prop_le_reg[0], sizeof(prop_le_reg) },
+	{"busmaster-regval",	(char*)&prop_le_busmaster_regval, sizeof(int)},
+	{"intr",	(char*)&prop_le_intr[0], sizeof(prop_le_intr) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_espdma_reg[] = {
+	0x4, 0x08400000, 0x00000010,
+};
+
+static const struct property propv_sbus_espdma[] = {
+	{"name",	"espdma", sizeof("espdma")}, 
+	{"reg",		(char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_esp_reg[] = {
+	0x4, 0x08800000, 0x00000040,
+};
+static const int prop_esp_intr[] = { 0x24, 0x0 };
+static const struct property propv_sbus_espdma_esp[] = {
+	{"name",	"esp", sizeof("esp")},
+	{"reg",		(char*)&prop_esp_reg[0], sizeof(prop_esp_reg) },
+	{"intr",	(char*)&prop_esp_intr[0], sizeof(prop_esp_intr) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_bpp_reg[] = {
+	0x4, 0x0c800000, 0x0000001c,
+};
+static const int prop_bpp_intr[] = { 0x33, 0x0 };
+static const struct property propv_sbus_bpp[] = {
+	{"name",	"SUNW,bpp", sizeof("SUNW,bpp")},
+	{"reg",		(char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) },
+	{"intr",	(char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_apc_reg[] = {
+	0x4, 0x0a000000, 0x00000010,
+};
+static const struct property propv_sbus_apc[] = {
+	{"name",	"xxxpower-management", sizeof("xxxpower-management")},
+	{"reg",		(char*)&prop_apc_reg[0], sizeof(prop_apc_reg) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_fd_intr[] = { 0x2b, 0x0 };
+static const int prop_fd_reg[] = {
+	0x0, 0x00400000, 0x0000000f,
+};
+static const struct property propv_obio_fd[] = {
+	{"name",	"SUNW,fdtwo", sizeof("SUNW,fdtwo")},
+	{"reg",		(char*)&prop_fd_reg[0], sizeof(prop_fd_reg) },
+	{"device_type", "block", sizeof("block") },
+	{"intr",	(char*)&prop_fd_intr[0], sizeof(prop_fd_intr) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_pw_intr[] = { 0x22, 0x0 };
+static const int prop_pw_reg[] = {
+	0x0, 0x00910000, 0x00000001,
+};
+static const struct property propv_obio_pw[] = {
+	{"name",	"power", sizeof("power")},
+	{"reg",		(char*)&prop_pw_reg[0], sizeof(prop_pw_reg) },
+	{"intr",	(char*)&prop_pw_intr[0], sizeof(prop_pw_intr) },
+	{NULL, NULL, -1}
+};
+
+static const int prop_cf_reg[] = {
+	0x0, 0x00800000, 0x00000001,
+};
+static const struct property propv_obio_cf[] = {
+	{"name",	"slavioconfig", sizeof("slavioconfig")},
+	{"reg",		(char*)&prop_cf_reg[0], sizeof(prop_cf_reg) },
+	{NULL, NULL, -1}
+};
+
+static const struct property propv_options[] = {
+	{"name",	"options", sizeof("options")},
+	{"screen-#columns",	"80", sizeof("80")},
+	{"screen-#rows",	"25", sizeof("25")},
+	{"tpe-link-test?",	(char *)&prop_true, 0},
+	{"ttya-mode",		"9600,8,n,1,-", sizeof("9600,8,n,1,-")},
+	{"ttya-ignore-cd",	(char *)&prop_true, 0},
+	{"ttya-rts-dtr-off",	0, -1},
+	{"ttyb-mode",		"9600,8,n,1,-", sizeof("9600,8,n,1,-")},
+	{"ttyb-ignore-cd",	(char *)&prop_true, 0},
+	{"ttyb-rts-dtr-off",	0, -1},
+	{NULL, NULL, -1}
+};
+
+static int prop_mem_reg[3];
+static int prop_mem_avail[3];
+
+static const struct property propv_memory[] = {
+	{"name",	"memory", sizeof("memory")},
+	{"reg",		(char*)&prop_mem_reg[0], sizeof(prop_mem_reg) },
+	{"available",	(char*)&prop_mem_avail[0], sizeof(prop_mem_avail) },
+	{NULL, NULL, -1}
+};
+
+static int prop_vmem_avail[6];
+
+static const struct property propv_vmemory[] = {
+	{"name",	"virtual-memory", sizeof("virtual-memory")},
+	{"available",	(char*)&prop_vmem_avail[0], sizeof(prop_vmem_avail) },
+	{NULL, NULL, -1}
+};
+
+static const struct node nodes[] = {
+	{ &null_properties,	 1,  0 }, /* 0 = big brother of root */
+	{ propv_root,		 0,  2 }, /*  1 "/" */
+	{ propv_iommu,		12,  3 }, /*  2 "/iommu" */
+	{ propv_sbus,		 0,  4 }, /*  3 "/iommu/sbus" */
+	{ propv_sbus_tcx,	 5,  0 }, /*  4 "/iommu/sbus/SUNW,tcx" */
+	{ propv_sbus_ledma,	 7,  6 }, /*  5 "/iommu/sbus/ledma" */
+	{ propv_sbus_ledma_le,	 0,  0 }, /*  6 "/iommu/sbus/ledma/le" */
+	{ propv_sbus_cs4231,	 8,  0 }, /*  7 "/iommu/sbus/SUNW,CS4231 */
+	{ propv_sbus_bpp,	 9,  0 }, /*  8 "/iommu/sbus/SUNW,bpp */
+	{ propv_sbus_espdma,	11, 10 }, /*  9 "/iommu/sbus/espdma" */
+	{ propv_sbus_espdma_esp, 0,  0 }, /* 10 "/iommu/sbus/espdma/esp" */
+	{ propv_sbus_apc,	 0,  0 }, /* 11 "/iommu/sbus/power-management */
+	{ propv_cpu,		13,  0 }, /* 12 "/STP1012PGA" */
+	{ propv_obio,		23, 14 }, /* 13 "/obio" */
+	{ propv_obio_int,	15,  0 }, /* 14 "/obio/interrupt" */
+	{ propv_obio_cnt,	16,  0 }, /* 15 "/obio/counter" */
+	{ propv_obio_eep,	17,  0 }, /* 16 "/obio/eeprom" */
+	{ propv_obio_auxio,	18,  0 }, /* 17 "/obio/auxio" */
+	{ propv_obio_zs1,	19,  0 }, /* 18 "/obio/zs@0,100000"
+					     Must be before zs@0,0! */
+	{ propv_obio_zs,	20,  0 }, /* 19 "/obio/zs@0,0" */
+	{ propv_obio_fd,	21,  0 }, /* 20 "/obio/SUNW,fdtwo" */
+	{ propv_obio_pw,	22,  0 }, /* 21 "/obio/power" */
+	{ propv_obio_cf,	 0,  0 }, /* 22 "/obio/slavioconfig@0,800000" */
+	{ propv_options,	24,  0 }, /* 23 "/options" */
+	{ propv_memory,		25,  0 }, /* 24 "/memory" */
+	{ propv_vmemory,	 0,  0 }, /* 25 "/virtual-memory" */
+};
+
+static struct linux_mlist_v0 totphys[MAX_BANKS];
+static struct linux_mlist_v0 totmap[1];
+static struct linux_mlist_v0 totavail[MAX_BANKS];
+
+static struct linux_mlist_v0 *ptphys;
+static struct linux_mlist_v0 *ptmap;
+static struct linux_mlist_v0 *ptavail;
+
+static const struct linux_nodeops nodeops0 = {
+        obp_nextnode,	/* int (*no_nextnode)(int node); */
+        obp_child,	/* int (*no_child)(int node); */
+        obp_proplen,	/* int (*no_proplen)(int node, char *name); */
+        obp_getprop,	/* int (*no_getprop)(int node,char *name,char *val); */
+        obp_setprop,	/* int (*no_setprop)(int node, char *name,
+				 char *val, int len); */
+        obp_nextprop	/* char * (*no_nextprop)(int node, char *name); */
+};
+
+static struct linux_arguments_v0 obp_arg;
+static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
+
+static void (*synch_hook)(void);
+static char obp_stdin, obp_stdout;
+static int obp_fd_stdin, obp_fd_stdout;
+
+static int obp_nbgetchar(void);
+static int obp_nbputchar(int ch);
+static void obp_reboot(char *);
+static void obp_abort(void);
+static void obp_halt(void);
+static int obp_devopen(char *str);
+static int obp_devclose(int dev_desc);
+static int obp_devread(int dev_desc, char *buf, int nbytes);
+static int obp_devwrite(int dev_desc, char *buf, int nbytes);
+static int obp_devseek(int dev_desc, int hi, int lo);
+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf);
+static char *obp_dumb_mmap(char *va, int which_io, unsigned int pa, unsigned int size);
+static void obp_dumb_munmap(char *va, unsigned int size);
+static int obp_inst2pkg(int dev_desc);
+
+static void doublewalk(unsigned ptab1, unsigned va)
+{
+unsigned int proc_tablewalk(int ctx, unsigned int va);
+unsigned int mem_tablewalk(unsigned int pa, unsigned int va);
+
+	proc_tablewalk(0, va);
+	if (ptab1 != 0) mem_tablewalk(ptab1, va);
+}
+
+static struct linux_romvec romvec0;
+
+struct fd {
+    int unit, part;
+    int offset;
+    int (*pread)(int dev_desc, int offset, char *buf, unsigned int nbytes);
+    int (*pwrite)(int dev_desc, int offset, char *buf, unsigned int nbytes);
+} fd_table[16];
+
+static int fd_index;
+static int con_pread(int dev_desc, int offset, char *buf, unsigned int nbytes);
+static int con_pwrite(int dev_desc, int offset, char *buf, unsigned int nbytes);
+
+void *
+init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas,
+		   const char *cmdline, char boot_device, int nographic)
+{
+	int i;
+
+	/*
+	 * Avoid data segment allocations
+	 */
+	ptphys = totphys;
+	ptmap = totmap;
+	ptavail = totavail;
+	/*
+	 * Form memory descriptors.
+	 */
+	for (i = 0; i < bankc; i++) {
+		totphys[i].theres_more = &totphys[i+1];
+		totphys[i].start_adr = (char*) bankv[i].start;
+		totphys[i].num_bytes = bankv[i].length;
+	}
+	totphys[i-1].theres_more = 0;
+
+	/*
+	 * XXX Merged in normal PROM when full banks touch.
+	 */
+	for (i = 0; i < bankc; i++) {
+		unsigned bankbase = bankv[i].start;
+		unsigned banksize = bankv[i].length;
+		if (hiphybas > bankbase &&
+		    hiphybas < bankbase + banksize) {
+			banksize = hiphybas - bankbase;
+		}
+		totavail[i].theres_more = &totavail[i+1];
+		totavail[i].start_adr = (char*) bankbase;
+		totavail[i].num_bytes = banksize;
+	}
+	totavail[i-1].theres_more = 0;
+
+	totmap[0].theres_more = 0;
+	totmap[0].start_adr = (char*) PROLBASE;
+	totmap[0].num_bytes = PROLSIZE;
+	prop_mem_reg[0] = 0;
+	prop_mem_reg[1] = 0;
+	prop_mem_reg[2] = bankv[0].length;
+	prop_mem_avail[0] = 0;
+	prop_mem_avail[1] = 0;
+	prop_mem_avail[2] = hiphybas;
+	prop_vmem_avail[0] = 0;
+	prop_vmem_avail[1] = 0;
+	prop_vmem_avail[2] = PROLBASE-1;
+	prop_vmem_avail[3] = 0;
+	prop_vmem_avail[4] = 0xffe00000;
+	prop_vmem_avail[5] = 0x00200000;
+
+	/*
+	 * idprom
+	 */
+	bcopy(idprom, obp_idprom, IDPROM_SIZE);
+
+	// Linux wants a R/W romvec table
+	romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;
+	romvec0.pv_romvers = 3;
+	romvec0.pv_plugin_revision = 77;
+	romvec0.pv_printrev = 0x10203;
+	romvec0.pv_v0mem.v0_totphys = &ptphys;
+	romvec0.pv_v0mem.v0_prommap = &ptmap;
+	romvec0.pv_v0mem.v0_available = &ptavail;
+	romvec0.pv_nodeops = &nodeops0;
+	romvec0.pv_bootstr = (void *)doublewalk;
+	romvec0.pv_v0devops.v0_devopen = &obp_devopen;
+	romvec0.pv_v0devops.v0_devclose = &obp_devclose;
+	romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev;
+	romvec0.pv_stdin = &obp_stdin;
+	romvec0.pv_stdout = &obp_stdout;
+	romvec0.pv_getchar = obp_nbgetchar;
+	romvec0.pv_putchar = (void (*)(int))obp_nbputchar;
+	romvec0.pv_nbgetchar = obp_nbgetchar;
+	romvec0.pv_nbputchar = obp_nbputchar;
+	romvec0.pv_reboot = obp_reboot;
+	romvec0.pv_printf = (void (*)(const char *fmt, ...))printk;
+	romvec0.pv_abort = obp_abort;
+	romvec0.pv_halt = obp_halt;
+	romvec0.pv_synchook = &synch_hook;
+	romvec0.pv_v0bootargs = &obp_argp;
+	romvec0.pv_v2devops.v2_inst2pkg = obp_inst2pkg;
+	romvec0.pv_v2devops.v2_dumb_mmap = obp_dumb_mmap;
+	romvec0.pv_v2devops.v2_dumb_munmap = obp_dumb_munmap;
+	romvec0.pv_v2devops.v2_dev_open = obp_devopen;
+	romvec0.pv_v2devops.v2_dev_close = (void (*)(int))obp_devclose;
+	romvec0.pv_v2devops.v2_dev_read = obp_devread;
+	romvec0.pv_v2devops.v2_dev_write = obp_devwrite;
+	romvec0.pv_v2devops.v2_dev_seek = obp_devseek;
+	obp_arg.boot_dev_ctrl = 0;
+	obp_arg.boot_dev_unit = '0';
+	obp_arg.argv[0] = "sd(0,0,0):d";
+	switch(boot_device) {
+	default:
+	case 'a':
+	    obp_arg.argv[0] = "fd()";
+	    obp_arg.boot_dev[0] = 'f';
+	    obp_arg.boot_dev[1] = 'd';
+	    break;
+	case 'd':
+	    obp_arg.boot_dev_unit = '2';
+	    obp_arg.argv[0] = "sd(0,2,0):d";
+	    // Fall through
+	case 'c':
+	    obp_arg.boot_dev[0] = 's';
+	    obp_arg.boot_dev[1] = 'd';
+	    break;
+	case 'n':
+	    obp_arg.argv[0] = "le()";
+	    obp_arg.boot_dev[0] = 'l';
+	    obp_arg.boot_dev[1] = 'e';
+	    break;
+	}
+	obp_arg.argv[1] = cmdline;
+	romvec0.pv_v2bootargs.bootpath = &obp_arg.argv[0];
+	romvec0.pv_v2bootargs.bootargs = &cmdline;
+	romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;
+	romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout;
+
+	bcopy(propv_root_templ, propv_root, sizeof(propv_root_templ));
+	propv_root[4].name = "stdin-path";
+	propv_root[5].name = "stdout-path";
+	obp_fd_stdin = 0;
+	obp_fd_stdout = 1;
+	fd_table[0].pread = con_pread;
+	fd_table[0].pwrite = con_pwrite;
+	fd_table[1].pread = con_pread;
+	fd_table[1].pwrite = con_pwrite;
+	fd_index = 2;
+	if (nographic) {
+	    obp_stdin = PROMDEV_TTYA;
+	    propv_root[4].value = "/obio/zs@0,100000:a";
+	    propv_root[4].length = sizeof("/obio/zs@0,100000:a");
+	    fd_table[0].unit = 18;
+	    obp_stdout = PROMDEV_TTYA;
+	    propv_root[5].value = "/obio/zs@0,100000:a";
+	    propv_root[5].length = sizeof("/obio/zs@0,100000:a");
+	    fd_table[1].unit = 18;
+	} else {
+	    obp_stdin = PROMDEV_KBD;
+	    propv_root[4].value = "/obio/zs@0,0";
+	    propv_root[4].length = sizeof("/obio/zs@0,0");
+	    fd_table[0].unit = 19;
+	    obp_stdout = PROMDEV_SCREEN;
+	    propv_root[5].value = "/iommu/sbus/SUNW,tcx";
+	    propv_root[5].length = sizeof("/iommu/sbus/SUNW,tcx");
+	    fd_table[1].unit = 4;
+	}
+	prop_zs_addr = map_io(0x71000000, 8);
+	prop_zs1_addr = map_io(0x71100000, 8);
+	return &romvec0;
+}
+
+static const struct property *find_property(int node,char *name)
+{
+	const struct property *prop = &nodes[node].properties[0];
+	while (prop && prop->name) {
+		if (bcmp(prop->name, name, 128) == 0) return prop;
+		prop++;
+	}
+	return NULL;
+}
+
+static int obp_nextnode(int node)
+{
+#ifdef DEBUG_OBP
+        printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling);
+#endif
+	return nodes[node].sibling;
+}
+
+static int obp_child(int node)
+{
+#ifdef DEBUG_OBP
+        printk("obp_child(%d) = %d\n", node, nodes[node].child);
+#endif
+	return nodes[node].child;
+}
+
+static int obp_proplen(int node, char *name)
+{
+	const struct property *prop = find_property(node,name);
+	if (prop) {
+#ifdef DEBUG_OBP
+	    printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length);
+#endif
+	    return prop->length;
+	}
+#ifdef DEBUG_OBP
+	printk("obp_proplen(%d, %s) (no prop)\n", node, name);
+#endif
+	return -1;
+}
+
+static int obp_getprop(int node, char *name, char *value)
+{
+	const struct property *prop;
+
+	if (!name) {
+	    // NULL name means get first property
+#ifdef DEBUG_OBP
+	    printk("obp_getprop(%d, %x (NULL)) = %s\n", node, name,
+		   nodes[node].properties[0].name);
+#endif
+	    return (int)nodes[node].properties[0].name;
+	}
+	prop = find_property(node,name);
+	if (prop) {
+		memcpy(value,prop->value,prop->length);
+#ifdef DEBUG_OBP
+		printk("obp_getprop(%d, %s) = %s\n", node, name, value);
+#endif
+		return prop->length;
+	}
+#ifdef DEBUG_OBP
+        printk("obp_getprop(%d, %s): not found\n", node, name);
+#endif
+	return -1;
+}
+
+static int obp_setprop(__attribute__((unused)) int node,
+		       __attribute__((unused)) char *name,
+		       __attribute__((unused)) char *value,
+		       __attribute__((unused)) int len)
+{
+#ifdef DEBUG_OBP
+        printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len);
+#endif
+	return -1;
+}
+
+static const char *obp_nextprop(int node,char *name)
+{
+	const struct property *prop;
+	
+	if (!name || *name == '\0') {
+	    // NULL name means get first property
+#ifdef DEBUG_OBP
+	    printk("obp_nextprop(%d, NULL) = %s\n", node,
+		   nodes[node].properties[0].name);
+#endif
+	    return nodes[node].properties[0].name;
+	}
+	prop = find_property(node,name);
+	if (prop && prop[1].name) {
+#ifdef DEBUG_OBP
+	    printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name);
+#endif
+	    return prop[1].name;
+	}
+#ifdef DEBUG_OBP
+        printk("obp_nextprop(%d, %s): not found\n", node, name);
+#endif
+	return "";
+}
+
+extern int (*getch_fn)(struct vconterm *v);
+
+static int obp_nbgetchar(void) {
+	extern struct vconterm dp0;
+	return getch_fn(&dp0);
+}
+
+static int obp_nbputchar(int ch) {
+	printk("%c", ch);
+	return 0;
+}
+
+static void obp_reboot(char *str) {
+	printk("rebooting (%s)\n", str);
+	stb_bypass(0x71f00000, 1);
+	for (;;) {}
+}
+
+static void obp_abort() {
+	printk("abort, power off\n");
+	stb_bypass(0x71910000, 1);
+	for (;;) {}
+}
+
+static void obp_halt() {
+	printk("halt, power off\n");
+	stb_bypass(0x71910000, 1);
+	for (;;) {}
+}
+
+extern void *esp_read(int unit, int part, int offset, short len);
+
+static int esp_pread(int dev_desc, int offset, char *buf, unsigned int nbytes)
+{
+    unsigned int i;
+    void *src;
+
+    for(i = 0; i < nbytes; i += 512) {
+	src = esp_read(fd_table[dev_desc].unit, fd_table[dev_desc].part, (offset + i) / 512, 512);
+	memcpy(&buf[i], src, 512);
+    }
+    return nbytes;
+}
+
+static int con_pread(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes)
+{
+    unsigned int i;
+
+    for(i = 0; i < nbytes; i ++) {
+	buf[i] = obp_nbgetchar();
+    }
+    return nbytes;
+}
+
+static int con_pwrite(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes)
+{
+    unsigned int i;
+
+    for(i = 0; i < nbytes; i ++) {
+	obp_nbputchar(buf[i]);
+    }
+    return nbytes;
+}
+
+#define isnum(c) ((c >= '0') && (c < '9'))
+#define ctoi(c) (c - '0')
+
+static int obp_devopen(char *str) {
+#ifdef DEBUG_OBP
+        printk("obp_devopen(%s)\n", str);
+#endif
+	if (str[0] == 's' && str[1] == 'd' && str[4] == ',') {
+	    unsigned int target;
+
+	    if (str[5] < 7)
+		target = str[5];
+	    else if (isnum(str[6]) && isnum(str[5])) {
+		target = (ctoi(str[5]) * 10 + ctoi(str[6])) & 7;
+	    }
+	    else {
+		target = ctoi(str[5]) & 7;
+	    }
+	    fd_table[fd_index].unit = target;
+	    fd_table[fd_index].part = str[10] - 'a';
+	    fd_table[fd_index].pread = esp_pread;
+	    return fd_index++; // XXX
+	}
+	return 0;
+}
+
+static int obp_devclose(__attribute__((unused)) int dev_desc) {
+#ifdef DEBUG_OBP
+        printk("obp_devclose %d\n", dev_desc);
+#endif
+	fd_index--; // XXX
+	return 0;
+}
+
+static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf)
+{
+#ifdef DEBUG_OBP
+    printk("obp_rdblkdev: fd %d, num_blks %d, offset %d, buf 0x%x\n", dev_desc, num_blks, offset, buf);
+#endif
+    return fd_table[dev_desc].pread(dev_desc, offset, buf, num_blks * 512);
+}
+
+static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io,
+			   unsigned int pa, unsigned int size)
+{
+	unsigned int npages;
+	unsigned int off;
+	unsigned int mva;
+
+#ifdef DEBUG_OBP
+	printk("obp_dumb_mmap: virta %x, which_io %d, paddr %x, sz %d\n", va, which_io, pa, size);
+#endif
+	off = pa & (PAGE_SIZE-1);
+	npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
+	pa &= ~(PAGE_SIZE-1);
+
+	mva = (unsigned int) va;
+	while (npages-- != 0) {
+		map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
+		mva += PAGE_SIZE;
+		pa += PAGE_SIZE;
+	}
+	return va;
+}
+
+static void obp_dumb_munmap(__attribute__((unused)) char *va,
+			    __attribute__((unused)) unsigned int size)
+{
+#ifdef DEBUG_OBP
+	printk("obp_dumb_munmap: virta %x, sz %d\n", va, size);
+#endif
+}
+
+static int obp_devread(int dev_desc, char *buf, int nbytes)
+{
+	int ret;
+#ifdef DEBUG_OBP
+	printk("obp_devread: fd %d, nbytes %d\n", dev_desc, nbytes);
+#endif
+	ret = fd_table[dev_desc].pread(dev_desc, fd_table[dev_desc].offset, buf, nbytes);
+	fd_table[dev_desc].offset += nbytes;
+	return ret;
+}
+
+static int obp_devwrite(int dev_desc, char *buf, int nbytes)
+{
+	int ret;
+#ifdef DEBUG_OBP
+	printk("obp_devwrite: fd %d, buf %s, nbytes %d\n", dev_desc, buf, nbytes);
+#endif
+	ret = fd_table[dev_desc].pwrite(dev_desc, fd_table[dev_desc].offset, buf, nbytes);
+	fd_table[dev_desc].offset += nbytes;
+	return ret;
+}
+
+static int obp_devseek(int dev_desc, __attribute__((unused)) int hi, int lo)
+{
+#ifdef DEBUG_OBP
+	printk("obp_devseek: fd %d, hi %d, lo %d\n", dev_desc, hi, lo);
+#endif
+	fd_table[dev_desc].offset = lo;
+	return 0;
+}
+
+static int obp_inst2pkg(int dev_desc)
+{
+#ifdef DEBUG_OBP
+	printk("obp_inst2pkg: fd %d\n", dev_desc);
+#endif
+	return fd_table[dev_desc].unit;
+}
diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch-15/qemu/system_qemu.c
--- proll_18.orig/qemu/system_qemu.c	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/qemu/system_qemu.c	2005-04-16 06:16:20.000000000 +0000
@@ -0,0 +1,430 @@
+/**
+ ** Proll (PROM replacement)
+ ** system.c: shared miscallenea.
+ ** Copyright 1999 Pete Zaitcev
+ ** This code is licensed under GNU General Public License.
+ **/
+#include <stdarg.h>
+#include <asi.h>
+#include <crs.h>
+#ifndef NULL
+#define	NULL ((void*)0)
+#endif
+
+#include "pgtsrmmu.h"
+
+#include "vconsole.h"
+#include <timer.h>		/* Local copy of 2.2 style include */
+#include <general.h>		/* __P() */
+#include <net.h>		/* init_net() */
+#include <romlib.h>		/* we are a provider for part of this. */
+#include <netpriv.h>		/* myipaddr */
+#include <arpa.h>
+#include <system.h>		/* our own prototypes */
+
+/*
+ * We export this.
+ */
+char idprom[IDPROM_SIZE];
+
+
+/*
+ * Create an I/O mapping to pa[size].
+ * Returns va of the mapping or 0 if unsuccessful.
+ */
+void *
+map_io(unsigned pa, int size)
+{
+	void *va;
+	unsigned int npages;
+	unsigned int off;
+	unsigned int mva;
+
+	off = pa & (PAGE_SIZE-1);
+	npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
+	pa &= ~(PAGE_SIZE-1);
+
+	va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE);
+	if (va == 0) return va;
+
+	mva = (unsigned int) va;
+    /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */
+	while (npages-- != 0) {
+		map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
+		mva += PAGE_SIZE;
+		pa += PAGE_SIZE;
+	}
+
+	return (void *)((unsigned int)va + off);
+}
+
+/*
+ * Tablewalk routine used for testing.
+ * Returns PTP/PTE.
+ */
+unsigned int
+proc_tablewalk(int ctx, unsigned int va)
+{
+	unsigned int pa1;
+
+	__asm__ __volatile__ ("lda [%1] %2, %0" :
+				"=r" (pa1) :
+				"r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
+	/* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */
+	pa1 <<= 4;
+	pa1 = ld_bypass(pa1 + (ctx << 2));
+	if ((pa1 & 0x03) == 0) goto invalid;
+	return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va);
+
+invalid:
+	printk(" invalid %x\n", pa1);
+	return 0;
+}
+
+/*
+ * Walk the tables in memory, starting at physical address pa.
+ */
+unsigned int
+mem_tablewalk(unsigned int pa, unsigned int va)
+{
+	unsigned int pa1;
+
+	printk("pa %x va %x", pa, va);
+	pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2));
+	if ((pa1 & 0x03) == 0) goto invalid;
+	printk(" l1 %x", pa1);
+	pa1 <<= 4;    pa1 &= 0xFFFFFF00;
+	pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2));
+	if ((pa1 & 0x03) == 0) goto invalid;
+	printk(" l2 %x", pa1);
+	pa1 <<= 4;    pa1 &= 0xFFFFFF00;
+	pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2));
+	if ((pa1 & 0x03) == 0) goto invalid;
+	printk(" l3 %x", pa1);
+	printk(" off %x\n", va&0x00000FFF);
+	return pa1;
+invalid:
+	printk(" invalid %x\n", pa1);
+	return 0;
+}
+
+/*
+ * Make CPU page tables.
+ * Returns pointer to context table.
+ * Here we ignore memory allocation errors which "should not happen"
+ * because we cannot print anything anyways if memory initialization fails.
+ */
+void makepages(struct phym *t, unsigned int highbase)
+{
+	unsigned int *ctp, *l1, pte;
+	int i;
+	unsigned int pa, va;
+
+	ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int));
+	l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int));
+
+	pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4);
+	for (i = 0; i < NCTX_SWIFT; i++) {
+		ctp[i] = pte;
+	}
+
+	pa = PROLBASE;
+	for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) {
+	        map_page(l1, va, pa, 0, highbase);
+		pa += PAGE_SIZE;
+	}
+	pa = highbase + PROLDATA - PROLBASE;
+	for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) {
+		map_page(l1, va, pa, 0, highbase);
+		pa += PAGE_SIZE;
+	}
+
+	/* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
+	pa = 0;
+	for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
+		map_page(l1, va, pa, 0, highbase);
+		pa += PAGE_SIZE;
+	}
+
+	t->pctp = ctp;
+	t->pl1 = l1;
+	t->pbas = highbase;
+}
+
+/*
+ * Create a memory mapping from va to epa in page table pgd.
+ * highbase is used for v2p translation.
+ */
+int
+map_page(unsigned int *pgd, unsigned int va,
+    unsigned int epa, int type, unsigned int highbase)
+{
+	unsigned int pte;
+	unsigned int *p;
+	unsigned int pa;
+
+	pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)];
+	if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
+		p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int),
+		    SRMMU_PTRS_PER_PMD*sizeof(int));
+		if (p == 0) goto drop;
+		pte = SRMMU_ET_PTD |
+		    (((unsigned int)p - PROLBASE + highbase) >> 4);
+		pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte;
+		/* barrier() */
+	}
+
+	pa = ((pte & 0xFFFFFFF0) << 4);
+	pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2);
+	pte = ld_bypass(pa);
+	if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
+		p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int),
+		    SRMMU_PTRS_PER_PTE*sizeof(int));
+		if (p == 0) goto drop;
+		pte = SRMMU_ET_PTD |
+		    (((unsigned int)p - PROLBASE + highbase) >> 4);
+		st_bypass(pa, pte);
+	}
+
+	pa = ((pte & 0xFFFFFFF0) << 4);
+	pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2);
+
+	pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4);
+	if (type) {		/* I/O */
+		pte |= SRMMU_REF;
+		/* SRMMU cannot make Supervisor-only, but not exectutable */
+		pte |= SRMMU_PRIV;
+	} else {		/* memory */
+		pte |= SRMMU_REF|SRMMU_CACHE;
+		pte |= SRMMU_PRIV;		/* Supervisor only access */
+	}
+	st_bypass(pa, pte);
+	return 0;
+
+drop:
+	return -1;
+}
+
+/*
+ * Switch page tables.
+ */
+void
+init_mmu_swift(unsigned int ctp_phy)
+{
+	unsigned int addr;
+
+	/*
+	 * Flush cache
+	 */
+	for (addr = 0; addr < 0x2000; addr += 0x10) {
+		__asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
+		    "r" (addr), "i" (ASI_M_DATAC_TAG));
+		__asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
+		    "r" (addr<<1), "i" (ASI_M_TXTC_TAG));
+	}
+
+	/*
+	 * Switch ctx table
+	 */
+	ctp_phy >>= 4;
+	/* printk("done flushing, switching to %x\n", ctp_phy); */
+	__asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
+	    "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
+
+	/*
+	 * Flush old page table references
+	 */
+	__asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
+	    "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory");
+}
+
+/*
+ * add_timer, del_timer
+ * This should go into sched.c, but we have it split for different archs.
+ */
+struct timer_list_head {
+	struct timer_list *head, *tail;
+};
+
+static struct timer_list_head timers;		/* Anonymous heap of timers */
+
+void add_timer(struct timer_list *timer) {
+	struct timer_list *p;
+	if (timer->prev != NULL || timer->next != NULL) {
+		printk("bug: kernel timer added twice at 0x%x.\n",
+		    __builtin_return_address(0));
+		return;
+	}
+	if ((p = timers.tail) != NULL) {
+		timer->prev = p;
+		p->next = timer;
+		timers.tail = timer;
+	} else {
+		timers.head = timer;
+		timers.tail = timer;
+	}
+	return;
+}
+
+int del_timer(struct timer_list *timer) {
+	struct timer_list *p;
+	int ret;
+
+	if (timers.head == timer) timers.head = timer->next;
+	if (timers.tail == timer) timers.tail = timer->prev;
+	if ((p = timer->prev) != NULL) p->next = timer->next;
+	if ((p = timer->next) != NULL) p->prev = timer->prev;
+	ret = timer->next != 0 || timer->prev != 0;
+	timer->next = NULL;
+	timer->prev = NULL;
+	return ret;
+}
+
+void run_timers() {
+	struct timer_list *p;
+
+	p = timers.head;
+	while (p != NULL) {
+		if (p->expires < jiffies) {
+			del_timer(p);		/* XXX make nonstatic member */
+			(*p->function)(p->data);
+			p = timers.head;
+		} else {
+			p = p->next;
+		}
+	}
+}
+
+/*
+ * Allocate memory. This is reusable.
+ */
+void mem_init(struct mem *t, char *begin, char *limit)
+{
+	t->start = begin;
+	t->uplim = limit;
+	t->curp = begin;
+}
+
+void mem_fini(struct mem *t)
+{
+	t->curp = 0;
+}
+
+void *mem_alloc(struct mem *t, int size, int align)
+{
+	char *p;
+
+	p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));
+	if (p >= t->uplim || p + size > t->uplim) return 0;
+	t->curp = p + size;
+	return p;
+}
+
+void *mem_zalloc(struct mem *t, int size, int align)
+{
+	char *p;
+
+	if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);
+	return p;
+}
+
+/*
+ * Library functions
+ */
+void *memset(void *s, int c, size_t len)
+{
+	void *p = s;
+
+	while (len--) {
+		*(char *)s = c;
+		s++;
+	}
+	return p;
+}
+
+void bcopy(const void *f, void *t, int len) {
+	while (len--) {
+		*(char *)t = *(char *)f;
+		f++;
+		t++;
+	}
+}
+
+/* Comparison is 7-bit */
+int bcmp(const void *s1, const void *s2, int len)
+{
+	int i;
+	char ch;
+
+	while (len--) {
+		ch = *(char *)s1;
+		i = ch - *(char *)s2;
+		s1++;
+		s2++;
+		if (i != 0)
+			return i;
+		if (ch == 0)
+			return 0;
+	}
+	return 0;
+}
+
+int strlen(const char *s) {
+	const char *p;
+	for (p = s; *p != 0; p++) { }
+	return p - s;
+}
+
+extern void *printk_fn;
+
+void printk(char *fmt, ...)
+{
+	struct prf_fp {
+		void *xfp;
+		void (*write)(void *, char *, int);
+	} prfa;
+	extern void prf(struct prf_fp *, char *fmt, va_list adx);
+	va_list x1;
+
+	va_start(x1, fmt);
+	prfa.xfp = &dp0;
+	prfa.write = printk_fn;
+	prf(&prfa, fmt, x1);
+	va_end(x1);
+}
+
+void fatal()
+{
+	printk("fatal.");
+loop: goto loop;
+}
+
+/*
+ * Get the highest bit number from the mask.
+ */
+int highc(int mask, int size)
+{
+	int m1;
+
+	m1 = 1 << size;
+	while (size != 0) {
+		size--;
+		m1 >>= 1;
+		if (m1 & mask) break;
+	}
+	return size;
+}
+
+/*
+ */
+unsigned int ld_bp_swap(unsigned int ptr) {
+	unsigned int n;
+	n = ld_bypass(ptr);
+	n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
+	return n;
+}
+
+void st_bp_swap(unsigned int ptr, unsigned int n) {
+	n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
+	st_bypass(ptr, n);
+};
diff -ruN proll_18.orig/src/arp.c proll-patch-15/src/arp.c
--- proll_18.orig/src/arp.c	2001-12-24 05:12:31.000000000 +0000
+++ proll-patch-15/src/arp.c	2005-08-14 10:10:11.000000000 +0000
@@ -45,7 +45,7 @@
 #endif
 static struct arp_cache arp_list[ARPNUM];	/* ARP address cache	*/
 static int next_arp;				/* next table entry	*/
-static t_ipaddr def_gw = IP_ANY;		/* default routing	*/
+static t_ipaddr def_gw;				/* default routing	*/
 
 
 
@@ -100,10 +100,7 @@
  * 
  * ARP receiver routine
  */
-static int arp_recv(buf, bufsize, addr)
-unsigned char *buf;
-int            bufsize;
-unsigned char *addr;
+static int arp_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr)
 {
   register struct arphdr *ahp = (struct arphdr *)buf;
 
@@ -144,7 +141,7 @@
  * 
  * Resolve IP address and return pointer to hardware address.
  */
-unsigned char *ip_resolve(ip)
+const unsigned char *ip_resolve(ip)
 t_ipaddr ip;
 {
   int i;
@@ -230,14 +227,11 @@
  */
 int init_arp()
 {
-  /* Set name of module for error messages */
-  net_module_name = "arp";
-
 #ifndef NOARP
   /* Register ARP packet type and set send buffer pointer */
   if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL)
 	return(FALSE);
 #endif
-
+  def_gw = IP_ANY;
   return(TRUE);
 }
diff -ruN proll_18.orig/src/arp.h proll-patch-15/src/arp.h
--- proll_18.orig/src/arp.h	1999-03-18 03:39:43.000000000 +0000
+++ proll-patch-15/src/arp.h	2004-11-13 15:50:49.000000000 +0000
@@ -104,7 +104,7 @@
 extern int init_arp __P((void));
 
 /* Resolve IP address and return pointer to hardware address */
-extern unsigned char *ip_resolve __P((t_ipaddr ip));
+extern const unsigned char *ip_resolve __P((t_ipaddr ip));
 
 /* Add a new antry to the ARP cache */
 extern void addcache __P((unsigned char *ha, t_ipaddr ip));
diff -ruN proll_18.orig/src/bootp.c proll-patch-15/src/bootp.c
--- proll_18.orig/src/bootp.c	1999-12-15 17:20:30.000000000 +0000
+++ proll-patch-15/src/bootp.c	2005-08-14 10:16:09.000000000 +0000
@@ -151,7 +151,7 @@
   while (TRUE) {
 	boot_xid = get_ticks() + random();
 	bootp_send();
-	i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout, CHR_ESC);
+	i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout);
 	if (i < 0) {				/* user pressed ESC */
 		printf("\nAborted\n");
 		return(1);
diff -ruN proll_18.orig/src/esp.c proll-patch-15/src/esp.c
--- proll_18.orig/src/esp.c	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/src/esp.c	2005-08-15 18:42:46.000000000 +0000
@@ -0,0 +1,305 @@
+#include <system.h>		/* == <asm/system.h> */
+#include <general.h>		/* __P for netpriv.h */
+#include <dma.h>		/* dmaga */
+#include <romlib.h>
+
+#define PHYS_JJ_ESPDMA  0x78400000      /* ESP DMA controller */
+#define PHYS_JJ_ESP     0x78800000      /* ESP SCSI */
+#define PHYS_JJ_ESP_IRQ    4
+#define BUFSIZE         4096
+/*
+ * XXX Crude
+ */
+struct esp_dma {
+	struct sparc_dma_registers *regs;
+	enum dvma_rev revision;
+};
+
+struct esp_regs {
+    unsigned int regs[16];
+};
+
+struct esp_private {
+	int active;			/* initialized */
+	int inst;			/* iface number */
+
+	volatile struct esp_regs *ll;
+	__u32 buffer_dvma;
+	unsigned int irq;		/* device IRQ number    */
+        int interrupt;
+
+	struct esp_dma *espdma;         /* If set this points to espdma    */
+
+        unsigned char *buffer;
+	struct disk_info {
+		unsigned int hw_sector;
+		unsigned int part_offset[8];
+	} disk[8];
+};
+
+static void esp_interrupt(void *dev_id)
+{
+	struct esp_private *lp = (struct esp_private *)dev_id;
+
+	lp->interrupt = 1;
+	/* Acknowledge all the interrupt sources ASAP */
+
+	lp->interrupt = 0;
+}
+
+static int esp_open (void *dev)
+{
+	struct esp_private *lp = (struct esp_private *)dev;
+	int status = 0;
+
+	if (request_irq(lp->irq, &esp_interrupt, (void *)dev)) {
+		printk ("Esp: Can't get irq %d\n", lp->irq);
+		return -1;
+	}
+
+	/* On the 4m, setup the espdma to provide the upper bits for buffers */
+	if (lp->espdma)
+		lp->espdma->regs->dma_test = ((__u32) lp->buffer_dvma) & 0xff000000;
+
+	return status;
+}
+
+static int esp_close (void *dev)
+{
+	struct esp_private *lp = (struct esp_private *)dev;
+
+	free_irq (lp->irq, (void *) dev);
+	return 0;
+}
+
+static int 
+esp_init(struct esp_private *esp, struct esp_dma *espdma, int irq)
+{
+	volatile struct esp_regs *ll;
+
+	/* Get the IO region */
+	ll = map_io(PHYS_JJ_ESP, sizeof (struct esp_regs));
+	if (ll == 0) return -1;
+
+	esp->buffer = dvma_alloc(BUFSIZE, &esp->buffer_dvma);
+	esp->ll = ll;
+	esp->espdma = espdma;
+	esp->irq = irq;
+
+	// Chip reset
+	stb_bypass((int)ll + 3*2, 2);
+	return 0;
+}
+
+static int espdma_init(struct esp_dma *espdma)
+{
+	void *p;
+
+	/* Hardcode everything for MrCoffee. */
+	if ((p = map_io(PHYS_JJ_ESPDMA, 0x10)) == 0) {
+		printk("espdma_init: cannot map registers\n");
+		return -1;
+	}
+	espdma->regs = p;
+
+	printk("dma1: ");
+
+	switch((espdma->regs->cond_reg)&DMA_DEVICE_ID) {
+	case DMA_VERS0:
+		espdma->revision=dvmarev0;
+		printk("Revision 0 ");
+		break;
+	case DMA_ESCV1:
+		espdma->revision=dvmaesc1;
+		printk("ESC Revision 1 ");
+		break;
+	case DMA_VERS1:
+		espdma->revision=dvmarev1;
+		printk("Revision 1 ");
+		break;
+	case DMA_VERS2:
+		espdma->revision=dvmarev2;
+		printk("Revision 2 ");
+		break;
+	case DMA_VERHME:
+		espdma->revision=dvmahme;
+		printk("HME DVMA gate array ");
+		break;
+	case DMA_VERSPLUS:
+		espdma->revision=dvmarevplus;
+		printk("Revision 1 PLUS ");
+		break;
+	default:
+		printk("unknown dma version %x",
+		       (espdma->regs->cond_reg)&DMA_DEVICE_ID);
+		/* espdma->allocated = 1; */
+		break;
+	}
+	printk("\n");
+	return 0;
+}
+
+static struct esp_dma espdma0;
+static struct esp_private esp;
+/*
+ * Find all the esp cards on the system and initialize them
+ */
+void esp_probe ()
+{
+	if (espdma_init(&espdma0) != 0) {
+		return;
+	}
+
+	if (esp_init(&esp, &espdma0, PHYS_JJ_ESP_IRQ) != 0) {
+		printk("esp_probe: esp0 init failed\n");
+		return;
+	}
+	return;
+}
+
+void esp_read_capacity(int unit)
+{
+	// Set SCSI target
+	stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);
+	// Set DMA address
+	st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);
+	// Set DMA length
+	stb_bypass(PHYS_JJ_ESP + 0*4, 10);
+	stb_bypass(PHYS_JJ_ESP + 1*4, 0);
+	// Set DMA direction
+	st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);
+	// Setup command = Read Capacity
+	esp.buffer[0] = 0x80;
+	esp.buffer[1] = 0x25;
+	esp.buffer[2] = 0x00;
+	esp.buffer[3] = 0x00;
+	esp.buffer[4] = 0x00;
+	esp.buffer[5] = 0x00;
+	esp.buffer[6] = 0x00;
+	esp.buffer[7] = 0x00;
+	esp.buffer[8] = 0x00;
+	esp.buffer[9] = 0x00;
+	esp.buffer[10] = 0x00;
+	// Set ATN, issue command
+	stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2);
+
+	// Set DMA length = 512 * read length
+	stb_bypass(PHYS_JJ_ESP + 0*4, 0);
+	stb_bypass(PHYS_JJ_ESP + 1*4, 8 & 0xff);
+	// Set DMA direction
+	st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);
+	// Transfer
+	stb_bypass(PHYS_JJ_ESP + 3*4, 0x90);
+	esp.disk[unit].hw_sector = (esp.buffer[4] << 24) | (esp.buffer[5] << 16) | (esp.buffer[6] << 8) | esp.buffer[7];
+}
+
+// offset is multiple of 512, len in bytes
+void *esp_read(int unit, int part, int offset, short len)
+{
+	int pos, hw_sect, sect_offset, spb;
+
+	// Set SCSI target
+	stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);
+	// Set DMA address
+	st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);
+	// Set DMA length
+	stb_bypass(PHYS_JJ_ESP + 0*4, 10);
+	stb_bypass(PHYS_JJ_ESP + 1*4, 0);
+	// Set DMA direction
+	st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);
+	hw_sect = esp.disk[unit].hw_sector;
+	offset += esp.disk[unit].part_offset[part];
+	spb = hw_sect / 512;
+	sect_offset = offset / spb;
+	pos = (offset - sect_offset * spb) * 512;
+	len /= 512;
+	//printk("Read unit %d, offset %d -> offset %d, pos %d, hw_sect %d\n", unit, offset, sect_offset, pos, hw_sect);
+	// Setup command = Read(10)
+	esp.buffer[0] = 0x80;
+	esp.buffer[1] = 0x28;
+	esp.buffer[2] = 0x00;
+	esp.buffer[3] = (sect_offset >> 24) & 0xff;
+	esp.buffer[4] = (sect_offset >> 16) & 0xff;
+	esp.buffer[5] = (sect_offset >> 8) & 0xff;
+	esp.buffer[6] = sect_offset & 0xff;
+	esp.buffer[7] = 0x00;
+	esp.buffer[8] = (len >> 8) & 0xff;
+	esp.buffer[9] = len & 0xff;
+	// Set ATN, issue command
+	stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2);
+
+	// Set DMA length = sector size * read length
+	stb_bypass(PHYS_JJ_ESP + 0*4, (len * hw_sect) & 0xff);
+	stb_bypass(PHYS_JJ_ESP + 1*4, ((len * hw_sect) >> 8) & 0xff);
+	// Set DMA direction
+	st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);
+	// Transfer
+	stb_bypass(PHYS_JJ_ESP + 3*4, 0x90);
+	return esp.buffer + pos;
+}
+
+// Sparc boot sequence can be found in SILO docs,
+// first-isofs/README.SILO_ISOFS
+int esp_boot(int unit)
+{
+        struct sun_disklabel {
+                unsigned char info[128];   /* Informative text string */
+                unsigned char spare0[14];
+                struct sun_info {
+                        unsigned char spare1;
+                        unsigned char id;
+                        unsigned char spare2;
+                        unsigned char flags;
+                } infos[8];
+                unsigned char spare[246];  /* Boot information etc. */
+                short rspeed;     /* Disk rotational speed */
+                short pcylcount;  /* Physical cylinder count */
+                short sparecyl;   /* extra sects per cylinder */
+                unsigned char spare2[4];   /* More magic... */
+                short ilfact;     /* Interleave factor */
+                short ncyl;       /* Data cylinder count */
+                short nacyl;      /* Alt. cylinder count */
+                short ntrks;      /* Tracks per cylinder */
+                short nsect;      /* Sectors per track */
+                unsigned char spare3[4];   /* Even more magic... */
+                struct sun_partition {
+                        int start_cylinder;
+                        int num_sectors;
+                } partitions[8];
+                short magic;      /* Magic number */
+                short csum;       /* Label xor'd checksum */
+        } *label;
+	unsigned int i, offset;
+	void *src, *dst;
+
+	printk("Loading partition table from target %d:\n", unit);
+	// Chip reset
+	stb_bypass(PHYS_JJ_ESP + 3*4, 2);
+
+	esp_open(&esp);
+	esp_read_capacity(unit);
+
+	label = esp_read(unit, 0, 0, 512);
+	printk("hw sector: %d, CHS: %d/%d/%d, partitions:\n", esp.disk[unit].hw_sector, 
+	       label->ncyl, label->ntrks, label->nsect);
+	for (i = 0; i < 8; i++) {
+	    printk("%c: %d + %d, id %x, flags %x\n", 'a' + i, label->partitions[i].start_cylinder,
+		   label->partitions[i].num_sectors, label->infos[i].id, label->infos[i].flags);
+	    esp.disk[unit].part_offset[i] = label->partitions[3].start_cylinder * label->ntrks * label->nsect;
+	}
+	offset = 1;
+	printk("booting sd(0,%d,0):d (offset %d)\n", unit, offset);
+	// Skip a.out header (0x20)
+	dst = (void *)0x4000;
+	src = esp_read(unit, 3, offset, 512);
+	src = (void *)((unsigned int) src + 0x20);
+	memcpy(dst, src, 512 - 0x20);
+	dst = (void *)0x4000 + 512 - 0x20;
+	for (i = 1; i < 7680/512; i++) {
+	    src = esp_read(unit, 3,  offset + i, 512);
+	    memcpy(dst, src, 512);
+	    dst += 512;
+	}
+	esp_close(&esp);
+	return 0;
+}
diff -ruN proll_18.orig/src/hconsole.c proll-patch-15/src/hconsole.c
--- proll_18.orig/src/hconsole.c	2002-07-23 05:52:48.000000000 +0000
+++ proll-patch-15/src/hconsole.c	2005-11-09 18:46:34.000000000 +0000
@@ -29,6 +29,10 @@
        struct raster r_master;	/* For a case of resize, whole fb */
        struct raster r_0;	/* malloc() erzatz */
 
+#ifdef QEMU
+extern unsigned int q_height, q_width;
+#endif
+
 int hcon_init(struct hconsole *t, unsigned int a0)
 {
 	struct raster *q, *r;
@@ -42,7 +46,11 @@
  	 * No probing sequence or argument passing, hardcode everything. XXX
 	 */
 	raster8_cons_a(q, 768, 1024, (char *)a0);
+#ifndef QEMU
 	raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80));
+#else
+	raster_cons_2(r, q, 0, 0, q_height, q_width);
+#endif
 	t->r_ = r;
 	t->r0_ = q;
 	t->f_ = &f_master;
@@ -67,7 +75,7 @@
 	return 0;
 }
 
-void hcon_fini (struct hconsole *t)
+void hcon_fini (__attribute((unused)) struct hconsole *t)
 {
 	return;
 }
@@ -77,12 +85,12 @@
 {
 	struct rfont *f = t->f_;
 
-	if (sy < 0 || sy >= t->ydim_) return -1;
-	if (sx < 0 || sx >= t->xdim_) return -1;
+	if (sy < 0 || (unsigned)sy >= t->ydim_) return -1;
+	if (sx < 0 || (unsigned)sx >= t->xdim_) return -1;
 	if (height < 0) return -1;
-	if (sy + height > t->ydim_) height = t->ydim_ - sy;
+	if ((unsigned)sy + (unsigned)height > t->ydim_) height = t->ydim_ - sy;
 	if (width < 0) return -1;
-	if (sx + width > t->xdim_) width = t->xdim_ - sx;
+	if ((unsigned)sx + (unsigned)width > t->xdim_) width = t->xdim_ - sx;
 
 	/* XXX Clear with correct background color */
 	(*t->r_->clear_)(t->r_,
@@ -107,10 +115,10 @@
 	char c0 = c;
 	RC_color rfg, rbg;
 
-	if (y < 0 || y >= t->ydim_) return -1;
-	if (x < 0 || x >= t->xdim_) return -1;
+	if (y < 0 || (unsigned)y >= t->ydim_) return -1;
+	if (x < 0 || (unsigned)x >= t->xdim_) return -1;
 
-	if (t->curson_ && t->ypos_ == y && t->xpos_ == x) {
+	if (t->curson_ && t->ypos_ == (unsigned)y && t->xpos_ == (unsigned)x) {
 		rfg = t->bg_;    rbg = t->fg_;
 	} else {
 		rfg = t->fg_;    rbg = t->bg_;
@@ -126,9 +134,9 @@
 {	
 	struct rfont *f = t->f_;
 
-	if (y < 0 || y >= t->ydim_) return -1;
-	if (x < 0 || x >= t->xdim_) return -1;
-	if (x + count >= t->xdim_) count = t->xdim_ - x;
+	if (y < 0 || (unsigned)y >= t->ydim_) return -1;
+	if (x < 0 || (unsigned)x >= t->xdim_) return -1;
+	if ((unsigned)x + (unsigned)count >= t->xdim_) count = t->xdim_ - x;
 
 	(*t->r_->render_)(t->r_, y*f->height_, x*f->width_,
 			    s, count, t->bg_, t->fg_, f);
@@ -200,8 +208,8 @@
 
 	rc = 0;
 	if (dir == SM_UP) {
-		if (d < 0 || d >= t->ydim_) return -1;
-		if (b <= d || b > t->ydim_) return -1;
+		if (d < 0 || (unsigned)d >= t->ydim_) return -1;
+		if (b <= d || (unsigned)b > t->ydim_) return -1;
 		if (d + count >= b) count = b - d;
 		if (d + count >= b) count = b - d;
 		(*t->r_->yscroll_)(t->r_,
@@ -213,8 +221,8 @@
 				   count*f->height_, raster_qwidth(t->r_),
 				   t->bg_);
 	} else if (dir == SM_DOWN) {
-		if (d < 0 || d >= t->ydim_) return -1;
-		if (b <= d || b > t->ydim_) return -1;
+		if (d < 0 || (unsigned)d >= t->ydim_) return -1;
+		if (b <= d || (unsigned)b > t->ydim_) return -1;
 		if (d + count >= b) count = b - d;
 		(*t->r_->yscroll_)(t->r_,
 				     d*f->height_, 0,
diff -ruN proll_18.orig/src/hme.c proll-patch-15/src/hme.c
--- proll_18.orig/src/hme.c	2002-07-23 05:52:52.000000000 +0000
+++ proll-patch-15/src/hme.c	2005-04-16 06:16:20.000000000 +0000
@@ -655,10 +655,10 @@
 				    unsigned int flags,
 				    unsigned int addr)
 {
-	__asm__ __volatile__("
-	stwa	%3, [%0] %2
-	stwa	%4, [%1] %2
-"	: /* no outputs */
+	__asm__ __volatile__(
+	"stwa	%3, [%0] %2\n\t"
+	"stwa	%4, [%1] %2\n\t"
+	: /* no outputs */
 	: "r" (&rp->rx_addr), "r" (&rp->rx_flags),
 	  "i" (ASI_PL), "r" (addr), "r" (flags));
 }
@@ -667,10 +667,10 @@
 				    unsigned int flags,
 				    unsigned int addr)
 {
-	__asm__ __volatile__("
-	stwa	%3, [%0] %2
-	stwa	%4, [%1] %2
-"	: /* no outputs */
+	__asm__ __volatile__(
+	"stwa	%3, [%0] %2\n\t"
+	"stwa	%4, [%1] %2\n\t"
+	: /* no outputs */
 	: "r" (&tp->tx_addr), "r" (&tp->tx_flags),
 	  "i" (ASI_PL), "r" (addr), "r" (flags));
 }
@@ -2404,7 +2404,7 @@
 		TXD(("[%d]", elem));
 		this = &txbase[elem];
 #ifdef  __sparc_v9__
-		__asm__ __volatile__("lduwa [%1] %2, %0"
+		__asm__ __volatile__("lduwa [%1] %2, %0\n\t"
 				     : "=r" (flags)
 				     : "r" (&this->tx_flags), "i" (ASI_PL));
 #else
@@ -2447,7 +2447,7 @@
 	RXD(("RX<"));
 	this = &rxbase[elem];
 #ifdef  __sparc_v9__
-	__asm__ __volatile__("lduwa [%1] %2, %0"
+	__asm__ __volatile__("lduwa [%1] %2, %0\n\t"
 			     : "=r" (flags)
 			     : "r" (&this->rx_flags), "i" (ASI_PL));
 #else
@@ -2530,7 +2530,7 @@
 		elem = NEXT_RX(elem);
 		this = &rxbase[elem];
 #ifdef __sparc_v9__ 
-		__asm__ __volatile__("lduwa [%1] %2, %0"
+		__asm__ __volatile__("lduwa [%1] %2, %0\n\t"
 				     : "=r" (flags)
 				     : "r" (&this->rx_flags), "i" (ASI_PL));
 #else
diff -ruN proll_18.orig/src/iommu.c proll-patch-15/src/iommu.c
--- proll_18.orig/src/iommu.c	2002-07-23 05:52:49.000000000 +0000
+++ proll-patch-15/src/iommu.c	2005-08-14 10:08:17.000000000 +0000
@@ -36,7 +36,7 @@
 	unsigned int pa, ba;
 	unsigned int npages;
 	unsigned int mva, mpa;
-	int i;
+	unsigned int i;
 	unsigned int *iopte;
 
 	npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
diff -ruN proll_18.orig/src/lat7_2.bm proll-patch-15/src/lat7_2.bm
--- proll_18.orig/src/lat7_2.bm	1999-02-27 05:48:54.000000000 +0000
+++ proll-patch-15/src/lat7_2.bm	2004-11-13 15:50:49.000000000 +0000
@@ -1,6 +1,6 @@
 #define lat7_2_width 128
 #define lat7_2_height 88
-static unsigned char lat7_2_bits[] = {
+static unsigned const char lat7_2_bits[] = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18,
    0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02,
diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch-15/src/lat7_2_swapped.bm
--- proll_18.orig/src/lat7_2_swapped.bm	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/src/lat7_2_swapped.bm	2004-11-13 15:50:49.000000000 +0000
@@ -0,0 +1,121 @@
+#define lat7_2_width 128
+#define lat7_2_height 88
+static unsigned const char lat7_2_bits[] = {
+   0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48, 
+   0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40, 
+   0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40, 
+   0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 
+   0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 
+   0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10, 
+   0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04, 
+   0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 
+   0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 
+   0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 
+   0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 
+   0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 
+   0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 
+   0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60, 
+   0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36, 
+   0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e, 
+   0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78, 
+   0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 
+   0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 
+   0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00, 
+   0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 
+   0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18, 
+   0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 
+   0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18, 
+   0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18, 
+   0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c, 
+   0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 
+   0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 
+   0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00, 
+   0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+   0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 
+   0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 
+   0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 
+   0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66, 
+   0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 
+   0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30, 
+   0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 
+   0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 
+   0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 
+   0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 
+   0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e, 
+   0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66, 
+   0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66, 
+   0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 
+   0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 
+   0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00, 
+   0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00, 
+   0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 
+   0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 
+   0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 
+   0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c, 
+   0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 
+   0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f, 
+   0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e, 
+   0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 
+   0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 
+   0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02, 
+   0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00, 
+   0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 
+   0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+   0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 
+   0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 
+   0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 
+   0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 
+   0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30, 
+   0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 
+   0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 
+   0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 
+   0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 
+   0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60, 
+   0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 
+   0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 
+   0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78, 
+   0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 
+   0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 
+   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00, 
+   0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 
+   0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00, 
+   0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+   0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 
+   0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 
+   0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60, 
+   0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06, 
+   0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00, 
+   0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 
+   0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 
+   0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c, 
+   0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00, 0x00};
diff -ruN proll_18.orig/src/le.c proll-patch-15/src/le.c
--- proll_18.orig/src/le.c	2002-07-23 05:52:49.000000000 +0000
+++ proll-patch-15/src/le.c	2005-04-16 06:16:20.000000000 +0000
@@ -185,8 +185,6 @@
 	unsigned short rap;			/* register address port */
 };
 
-int sparc_lance_debug = 2;
-
 /* The Lance uses 24 bit addresses */
 /* On the Sun4c the DVMA will provide the remaining bytes for us */
 /* On the Sun4m we have to instruct the ledma to provide them    */
@@ -771,7 +769,7 @@
 	/* Clear the slack of the packet, do I need this? */
 	/* For a firewall its a good idea - AC */
 	if (len != skblen)
-		bzero((char *) &ib->tx_buf [entry][skblen], len - skblen);
+		memset((char *) &ib->tx_buf [entry][skblen], 0, len - skblen);
     
 	/* Now, give the packet to the lance */
 	ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);
diff -ruN proll_18.orig/src/net.h proll-patch-15/src/net.h
--- proll_18.orig/src/net.h	1999-12-15 17:20:17.000000000 +0000
+++ proll-patch-15/src/net.h	2005-08-14 10:17:02.000000000 +0000
@@ -124,7 +124,7 @@
 extern int udp_open __P((t_ipaddr daddr, int source, int dest));
 
 /* Read from a UDP socket */
-extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch));
+extern int udp_read(char *buf, unsigned int bufsize, int timeout);
 
 /* Write to a UDP socket */
 extern int udp_write __P((char *buf, int writelen));
diff -ruN proll_18.orig/src/netinit.c proll-patch-15/src/netinit.c
--- proll_18.orig/src/netinit.c	2002-09-13 21:53:33.000000000 +0000
+++ proll-patch-15/src/netinit.c	2004-11-13 15:50:49.000000000 +0000
@@ -49,13 +49,20 @@
 unsigned char     myhwaddr[ETH_ALEN];		/* my own hardware addr	*/
          t_ipaddr myipaddr;			/* my own IP address	*/
          t_ipaddr mynetmask;			/* my own netmask	*/
-         char    *net_module_name;		/* name of init module	*/
          t_ipaddr servaddr;			/* IP of RARP&TFTP server */
 
 /* Broadcast hardware address */
-unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
 
+unsigned int seed;
+
+/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
+short int random()
+{
+	seed = (seed + 23968)*0x015A4E35 >> 1;
+	return seed & 0x7FFF;
+}
 
 /*
  **************************************************************************
@@ -104,10 +111,17 @@
  */
 void init_net()
 {
+  /* Avoid data segment allocations */
+  seed = 151;
+
   /* Initialize the different network layer modules */
   init_packet();
-  if (!init_arp() || !init_udp()) {
-	printf("\nERROR: init_%s\n", net_module_name);
+  if (!init_arp()) {
+	printf("\nERROR: init_arp\n");
+	fatal();
+  }
+  if (!init_udp()) {
+	printf("\nERROR: init_udp\n");
 	fatal();
   }
 }
diff -ruN proll_18.orig/src/netpriv.h proll-patch-15/src/netpriv.h
--- proll_18.orig/src/netpriv.h	1999-04-27 05:39:37.000000000 +0000
+++ proll-patch-15/src/netpriv.h	2005-08-14 10:12:20.000000000 +0000
@@ -83,7 +83,7 @@
 	 */
 	struct device *dev;
 	char *data;
-	int len;
+	unsigned int len;
 	int protocol;
 	unsigned char ip_summed;
 };
@@ -130,10 +130,9 @@
  *
  */
 extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address	*/
-extern unsigned char bcasthw[ETH_ALEN];  /* broadcast hardware addr	*/
+extern const unsigned char bcasthw[ETH_ALEN];  /* broadcast hardware addr	*/
 extern t_ipaddr      myipaddr;           /* my own IP address		*/
 extern t_ipaddr      mynetmask;		 /* netmask for my network	*/
-extern char         *net_module_name;	 /* initialized module's name	*/
 extern t_ipaddr      servaddr;           /* server IP address		*/
 
 
@@ -150,7 +149,7 @@
 extern unsigned char *reg_type __P((int typeval, int (* receive)()));
 
 /* Write a packet to the network */
-extern int write_packet __P((int bufsize, int typeval, unsigned char *addr));
+extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr));
 
 /* Empty read buffer */
 extern void empty_buf __P((void));
diff -ruN proll_18.orig/src/openprom.h proll-patch-15/src/openprom.h
--- proll_18.orig/src/openprom.h	2002-07-14 02:26:30.000000000 +0000
+++ proll-patch-15/src/openprom.h	2005-05-13 16:23:14.000000000 +0000
@@ -54,29 +54,29 @@
 };
 
 struct linux_mem_v0 {
-	struct linux_mlist_v0 **v0_totphys;
-	struct linux_mlist_v0 **v0_prommap;
-	struct linux_mlist_v0 **v0_available; /* What we can use */
+	struct linux_mlist_v0 * const *v0_totphys;
+	struct linux_mlist_v0 * const *v0_prommap;
+	struct linux_mlist_v0 * const *v0_available; /* What we can use */
 };
 
 /* Arguments sent to the kernel from the boot prompt. */
 struct linux_arguments_v0 {
-	char *argv[8];
+	const char *argv[8];
 	char args[100];
 	char boot_dev[2];
 	int boot_dev_ctrl;
 	int boot_dev_unit;
 	int dev_partition;
-	char *kernel_file_name;
+	const char *kernel_file_name;
 	void *aieee1;           /* XXX */
 };
 
 /* V2 and up boot things. */
 struct linux_bootargs_v2 {
-	char **bootpath;
-	char **bootargs;
-	int *fd_stdin;
-	int *fd_stdout;
+	const char **bootpath;
+	const char **bootargs;
+	const int *fd_stdin;
+	const int *fd_stdout;
 };
 
 /* The top level PROM vector. */
@@ -91,13 +91,13 @@
 	struct linux_mem_v0 pv_v0mem;
 
 	/* Node operations. */
-	struct linux_nodeops *pv_nodeops;
+	const struct linux_nodeops *pv_nodeops;
 
 	char **pv_bootstr;
 	struct linux_dev_v0_funcs pv_v0devops;
 
-	char *pv_stdin;
-	char *pv_stdout;
+	const char *pv_stdin;
+	const char *pv_stdout;
 #define	PROMDEV_KBD	0		/* input from keyboard */
 #define	PROMDEV_SCREEN	0		/* output to screen */
 #define	PROMDEV_TTYA	1		/* in/out to ttya */
@@ -127,7 +127,7 @@
 		void (*v2_eval)(char *str);
 	} pv_fortheval;
 
-	struct linux_arguments_v0 **pv_v0bootargs;
+	const struct linux_arguments_v0 * const *pv_v0bootargs;
 
 	/* Get ether address. */
 	unsigned int (*pv_enaddr)(int d, char *enaddr);
@@ -175,7 +175,7 @@
 	int (*no_proplen)(int node, char *name);
 	int (*no_getprop)(int node, char *name, char *val);
 	int (*no_setprop)(int node, char *name, char *val, int len);
-	char * (*no_nextprop)(int node, char *name);
+	const char * (*no_nextprop)(int node, char *name);
 };
 
 /* More fun PROM structures for device probing. */
diff -ruN proll_18.orig/src/packet.c proll-patch-15/src/packet.c
--- proll_18.orig/src/packet.c	2000-02-11 04:56:45.000000000 +0000
+++ proll-patch-15/src/packet.c	2005-08-14 10:12:49.000000000 +0000
@@ -41,7 +41,7 @@
 	int aligner;
 } wbuf;
 static struct sk_buff *rskb;
-static int nqskb = 0;
+static int nqskb;
 
 
 void init_packet()
@@ -62,6 +62,8 @@
 	for (i = 0; i < MAXSKBS; i++) {
 		skev[i].skb.allocn = i;
 	}
+
+	nqskb = 0;
 }
 
 unsigned char *reg_type(int ptype, int (*func)())
@@ -81,7 +83,7 @@
 	return wbuf.s;
 }
 
-int write_packet(int leng, int type, unsigned char *dst)
+int write_packet(int leng, int type, const unsigned char *dst)
 {
 	struct sk_buff *skb;
 	unsigned char *s;
@@ -209,12 +211,12 @@
 /*
  */
 void
-eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, int base)
+eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, __attribute__((unused)) int base)
 {
 	bcopy(src, dest->data, len);
 }
 
-unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev)
+unsigned short eth_type_trans(struct sk_buff *skb, __attribute__((unused)) struct device *dev)
 {
 	unsigned char *s = skb->data + 12;
 	return s[0] << 8 | s[1];		/* Network order word */
diff -ruN proll_18.orig/src/printf.c proll-patch-15/src/printf.c
--- proll_18.orig/src/printf.c	1999-03-19 07:03:59.000000000 +0000
+++ proll-patch-15/src/printf.c	2005-08-14 10:07:26.000000000 +0000
@@ -19,7 +19,7 @@
 static void printn(struct prf_fp *, unsigned long, unsigned int);
 static void putchar(char, struct prf_fp *);
 
-static char hextab[] = "0123456789ABCDEF";
+static const char hextab[] = "0123456789ABCDEF";
 
 /*
  * Scaled down version of C Library printf.
@@ -41,7 +41,7 @@
 void
 prf(struct prf_fp *filog, char *fmt, va_list adx)
 {
-        register c;
+        register int c;
         char *s;
 
 	for(;;) {
@@ -60,7 +60,7 @@
                 	putchar(va_arg(adx,unsigned), filog);
         	} else if(c == 's') {
                 	s = va_arg(adx,char*);
-               		while(c = *s++)
+               		while((c = *s++))
                         	putchar(c,filog);
        		} else if (c == 'l' || c == 'O') {
         	        printn(filog, (long)va_arg(adx,long), c=='l'?10:8);
@@ -77,10 +77,6 @@
         char prbuf[24];
         register char *cp;
 
-        if (b == 10 && n < 0) {
-                putchar('-',filog);
-                n = (~n) + 1;		/* n = -n */
-        }
         cp = prbuf;
         do
 		*cp++ = hextab[(unsigned int)(n%b)];
diff -ruN proll_18.orig/src/rconsole.c proll-patch-15/src/rconsole.c
--- proll_18.orig/src/rconsole.c	1999-01-16 07:16:55.000000000 +0000
+++ proll-patch-15/src/rconsole.c	2005-08-14 10:25:53.000000000 +0000
@@ -28,12 +28,18 @@
  * move to California. Only plain lat7 survived. 
  * I recreated lat7-1 changes in lat7-2.  --zaitcev
  */
+#ifdef ORIG
 #include "lat7_2.bm"	/* lat7_1.bm */
+#else
+#include "lat7_2_swapped.bm"	/* lat7_1.bm */
+#endif
 #define LAT7_NCHARS  128
 #define LAT7_HEIGHT   11
 #define LAT7_WIDTH     8
 
+#ifdef ORIG
 static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ];
+#endif
 
 #if 1
 /*
@@ -46,18 +52,18 @@
 #endif
 
 static __inline__ void stfb_w(void *ptr, unsigned int data) {
-	__asm__ __volatile__ ("sta %0, [%1] %2" : :
+	__asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
 				"r" (data), "r" (ptr), "i" (ASI_M_BYPASS));
 }
 
 static __inline__ void stfb_b(void *ptr, unsigned int data) {
-	__asm__ __volatile__ ("stba %0, [%1] %2" : :
+	__asm__ __volatile__ ("stba %0, [%1] %2\n\t" : :
 				"r" (data), "r" (ptr), "i" (ASI_M_BYPASS));
 }
 
 static __inline__ unsigned int ldfb_w(void *ptr) {
 	unsigned int data;
-	__asm__ __volatile__ ("lda [%1] %2, %0" :
+	__asm__ __volatile__ ("lda [%1] %2, %0\n\t" :
 				"=r" (data) :
 				"r" (ptr), "i" (ASI_M_BYPASS));
 	return data;
@@ -65,7 +71,7 @@
 
 static __inline__ unsigned int ldfb_b(void *ptr) {
 	unsigned int data;
-	__asm__ __volatile__ ("lduba [%1] %2, %0" :
+	__asm__ __volatile__ ("lduba [%1] %2, %0\n\t" :
 				"=r" (data) :
 				"r" (ptr), "i" (ASI_M_BYPASS));
 	return data;
@@ -94,6 +100,7 @@
 
 #endif
 
+#ifdef ORIG
 static inline int swapbits(int w0)
 {
   int w1 = 0;
@@ -105,13 +112,16 @@
   }
   return w1;
 }
+#endif
 
 void font_cons_7(struct rfont *p)
 {
+#ifdef ORIG
   int x;
   int col = 0;
   int row = 0;
   int erow = 0;
+
   for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) {
     lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] =
                                             swapbits(lat7_2_bits[x]) & 0xFF;
@@ -124,6 +134,9 @@
     }
   }
   p->body_ = lat7_body;
+#else
+  p->body_ = lat7_2_bits;
+#endif
   p->nchars_ = LAT7_NCHARS;
   p->width_ = LAT7_WIDTH;
   p->height_ = LAT7_HEIGHT;
@@ -175,7 +188,7 @@
   r->render_ = p->render_;
 }
 
-void raster_dest(struct raster *r)
+void raster_dest(__attribute((unused)) struct raster *r)
 {
 }
 
diff -ruN proll_18.orig/src/rconsole.h proll-patch-15/src/rconsole.h
--- proll_18.orig/src/rconsole.h	1999-01-16 05:00:59.000000000 +0000
+++ proll-patch-15/src/rconsole.h	2004-11-13 15:50:49.000000000 +0000
@@ -13,10 +13,10 @@
  */
 
 #define RF_MAXWIDTH  16
-typedef unsigned short Rf_scan;        /*  __w16 to be used */
+typedef unsigned char Rf_scan;        /*  __w16 to be used */
 
 struct rfont {
-  Rf_scan *body_;
+  const Rf_scan *body_;
   int nchars_;                 /* 128 for ASCII ...  65536 for Unicode   */
   int width_;                  /* [Pixels]. Maximum size is 16.          */
   int height_;                 /* [Pixels == scan lines].                */
diff -ruN proll_18.orig/src/romlib.h proll-patch-15/src/romlib.h
--- proll_18.orig/src/romlib.h	1999-04-20 04:26:45.000000000 +0000
+++ proll-patch-15/src/romlib.h	2005-04-16 20:32:49.000000000 +0000
@@ -72,13 +72,13 @@
  */
 #define memcpy(dst, src, len)	bcopy(src, dst, len)
 #define memcmp(x1, x2, len)	bcmp(x1, x2, len)
-#define memset(p, len, zero)	bzero(p, len)
-extern void bcopy(void *b1, void *b2, int length);
-extern int  bcmp(void *b1, void *b2, int length);
-extern void bzero(void *b, int c);
+extern void bcopy(const void *b1, void *b2, int length);
+extern int  bcmp(const void *b1, const void *b2, int length);
+typedef unsigned int size_t;
+extern void *memset(void *p, int c, size_t len);
 /* gcc complains about "conflicting types for builtin function strlen". */
 #define strlen(s)		ssize(s)
-extern int ssize(char *s);
+extern int ssize(const char *s);
 
 
 /*
diff -ruN proll_18.orig/src/sched_4m.c proll-patch-15/src/sched_4m.c
--- proll_18.orig/src/sched_4m.c	1999-04-27 05:48:51.000000000 +0000
+++ proll-patch-15/src/sched_4m.c	2005-08-14 10:18:14.000000000 +0000
@@ -108,7 +108,7 @@
 static int set_bolt;			/* Tick counter limit */
 static struct handsc hndv[16];
 
-static unsigned int intr_to_mask[16] = {
+static unsigned const int intr_to_mask[16] = {
 	0,	0,	0,	0,	0,	0, SUN4M_INT_ETHERNET,	0,
 	0,	0,	0,	0,	0,	0,	0,	0,
 };
@@ -130,7 +130,7 @@
 int	/* 0 - not expired yet; <>0 - timer expired */
 chk_timeout()
 {
-	int lim = (((1000000/HZ) + 1) << 10);
+	unsigned int lim = (((1000000/HZ) + 1) << 10);
 	unsigned int clear;
 	unsigned int intc;
 	int n;
@@ -182,7 +182,7 @@
 	struct handsc *hndp;
 	unsigned int mask;
 
-	if (irq < 0 || irq >= 16) {
+	if (irq == 0 || irq >= 16) {
 		printk("request_irq: bad irq %d\n", irq);
 		return -1;
 	}
@@ -207,7 +207,7 @@
 {
 	struct handsc *hndp;
 
-	if (irq < 0 || irq >= 16) {
+	if (irq == 0 || irq >= 16) {
 		printk("free_irq: bad irq %d\n", irq);
 		return;
 	}
diff -ruN proll_18.orig/src/swap.c proll-patch-15/src/swap.c
--- proll_18.orig/src/swap.c	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/src/swap.c	2004-11-13 15:50:49.000000000 +0000
@@ -0,0 +1,21 @@
+// Convert the lat7 font so that no conversion is needed at runtime.
+#define ORIG
+#include "rconsole.c"
+
+#include <stdio.h>
+
+int main()
+{
+    struct rfont p;
+    int i;
+
+    font_cons_7(&p);
+
+    printf("   ");
+    for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) {
+	printf("0x%02x, ", p.body_[i]);
+	if ((i % 12) == 11)
+	    printf("\n   ");
+    }
+    printf("\n");
+}
diff -ruN proll_18.orig/src/system.c proll-patch-15/src/system.c
--- proll_18.orig/src/system.c	2002-07-23 05:52:49.000000000 +0000
+++ proll-patch-15/src/system.c	2005-04-16 06:16:20.000000000 +0000
@@ -298,8 +298,8 @@
 	}
 
 	/* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
-	pa = PAGE_SIZE;
-	for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) {
+	pa = 0;
+	for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
 		map_page(l1, va, pa, 0, highbase);
 		pa += PAGE_SIZE;
 	}
@@ -507,30 +507,44 @@
 {
 	char *p;
 
-	if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size);
+	if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);
 	return p;
 }
 
 /*
  * Library functions
  */
-void bzero(void *s, int len) {
-	while (len--) *((char *)s)++ = 0;
+void *memset(void *s, int c, size_t len)
+{
+	void *p = s;
+
+	while (len--) {
+		*(char *)s = c;
+		s++;
+	}
+	return p;
 }
 
-void bcopy(void *f, void *t, int len) {
-	while (len--) *((char *)t)++ = *((char *)f)++;
+void bcopy(const void *f, void *t, int len) {
+	while (len--) {
+		*(char *)t = *(char *)f;
+		f++;
+		t++;
+	}
 }
 
 /* Comparison is 7-bit */
-int bcmp(void *s1, void *s2, int len)
+int bcmp(const void *s1, const void *s2, int len)
 {
 	int i;
 	char ch;
 
 	while (len--) {
-		ch = *((char *)s1)++;
-		if ((i = ch - *((char *)s2)++) != 0)
+		ch = *(char *)s1;
+		i = ch - *(char *)s2;
+		s1++;
+		s2++;
+		if (i != 0)
 			return i;
 		if (ch == 0)
 			return 0;
@@ -538,8 +552,8 @@
 	return 0;
 }
 
-int strlen(char *s) {
-	char *p;
+int strlen(const char *s) {
+	const char *p;
 	for (p = s; *p != 0; p++) { }
 	return p - s;
 }
@@ -560,14 +574,6 @@
 	va_end(x1);
 }
 
-/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
-short int random()
-{
-	static unsigned int seed = 151;
-	seed = (seed + 23968)*0x015A4E35 >> 1;
-	return seed & 0x7FFF;
-}
-
 void fatal()
 {
 	printk("fatal.");
diff -ruN proll_18.orig/src/system.h proll-patch-15/src/system.h
--- proll_18.orig/src/system.h	2002-09-13 21:53:32.000000000 +0000
+++ proll-patch-15/src/system.h	2005-04-16 06:16:20.000000000 +0000
@@ -16,7 +16,7 @@
 #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */
 #define NCTX_SWIFT  0x100
 
-#define MAX_BANKS      3		/* Allocation for all machines */
+#define MAX_BANKS      8		/* Allocation for all machines */
 
 #ifndef __ASSEMBLY__
 struct bank {
@@ -164,10 +164,10 @@
 
 extern __inline__ void setipl(unsigned long __orig_psr)
 {
-	__asm__ __volatile__("
-		wr	%0, 0x0, %%psr
-		nop; nop; nop
-"		: /* no outputs */
+	__asm__ __volatile__(
+		"wr	%0, 0x0, %%psr\n\t"
+		"nop; nop; nop\n\t"
+		: /* no outputs */
 		: "r" (__orig_psr)
 		: "memory", "cc");
 }
@@ -176,13 +176,13 @@
 {
 	unsigned long tmp;
 
-	__asm__ __volatile__("
-		rd	%%psr, %0
-		nop; nop; nop;		/* Sun4m + Cypress + SMP bug */
-		or	%0, %1, %0
-		wr	%0, 0x0, %%psr
-		nop; nop; nop
-"		: "=r" (tmp)
+	__asm__ __volatile__(
+		"rd	%%psr, %0\n\t"
+		"nop; nop; nop;\n\t"	/* Sun4m + Cypress + SMP bug */
+		"or	%0, %1, %0\n\t"
+		"wr	%0, 0x0, %%psr\n\t"
+		"nop; nop; nop\n\t"
+		: "=r" (tmp)
 		: "i" (PSR_PIL)
 		: "memory");
 }
@@ -191,13 +191,13 @@
 {
 	unsigned long tmp;
 
-	__asm__ __volatile__("
-		rd	%%psr, %0	
-		nop; nop; nop;		/* Sun4m + Cypress + SMP bug */
-		andn	%0, %1, %0
-		wr	%0, 0x0, %%psr
-		nop; nop; nop
-"		: "=r" (tmp)
+	__asm__ __volatile__(
+		"rd	%%psr, %0\n\t"
+		"nop; nop; nop;\n\t"	/* Sun4m + Cypress + SMP bug */
+		"andn	%0, %1, %0\n\t"
+		"wr	%0, 0x0, %%psr\n\t"
+		"nop; nop; nop\n\t"
+		: "=r" (tmp)
 		: "i" (PSR_PIL)
 		: "memory");
 }
@@ -214,18 +214,18 @@
 {
 	unsigned long retval;
 
-	__asm__ __volatile__("
-		rd	%%psr, %0
-		nop; nop; nop;		/* Sun4m + Cypress + SMP bug */
-		and	%0, %2, %%g1
-		and	%1, %2, %%g2
-		xorcc	%%g1, %%g2, %%g0
-		be	1f
-		 nop
-		wr	%0, %2, %%psr
-		nop; nop; nop;
-1:
-"		: "=r" (retval)
+	__asm__ __volatile__(
+		"rd	%%psr, %0\n\t"
+		"nop; nop; nop;\n\t"	/* Sun4m + Cypress + SMP bug */
+		"and	%0, %2, %%g1\n\t"
+		"and	%1, %2, %%g2\n\t"
+		"xorcc	%%g1, %%g2, %%g0\n\t"
+		"be	1f\n\t"
+		"nop\n\t"
+		"wr	%0, %2, %%psr\n\t"
+		"nop; nop; nop;\n\t"
+		"1:\n\t"
+		: "=r" (retval)
 		: "r" (__new_psr), "i" (PSR_PIL)
 		: "g1", "g2", "memory", "cc");
 
@@ -236,13 +236,13 @@
 {
 	unsigned long retval;
 
-	__asm__ __volatile__("
-		rd	%%psr, %0
-		nop; nop; nop;		/* Sun4m + Cypress + SMP bug */
-		or	%0, %1, %%g1
-		wr	%%g1, 0x0, %%psr
-		nop; nop; nop
-"		: "=r" (retval)
+	__asm__ __volatile__(
+		"rd	%%psr, %0\n\t"
+		"nop; nop; nop;\n\t"	/* Sun4m + Cypress + SMP bug */
+		"or	%0, %1, %%g1\n\t"
+		"wr	%%g1, 0x0, %%psr\n\t"
+		"nop; nop; nop\n\t"
+		: "=r" (retval)
 		: "i" (PSR_PIL)
 		: "g1", "memory");
 
diff -ruN proll_18.orig/src/tftp.c proll-patch-15/src/tftp.c
--- proll_18.orig/src/tftp.c	2002-09-13 21:53:34.000000000 +0000
+++ proll-patch-15/src/tftp.c	2005-08-14 10:16:15.000000000 +0000
@@ -127,7 +127,7 @@
   int len;
 
   /* Read packet with timeout */
-  len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT, CHR_ESC);
+  len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT);
   if (len == 0) {
 	printf("TFTP: Timeout\n");
 	return(ERR_TIMEOUT);
diff -ruN proll_18.orig/src/udp.c proll-patch-15/src/udp.c
--- proll_18.orig/src/udp.c	2001-12-24 05:12:53.000000000 +0000
+++ proll-patch-15/src/udp.c	2005-08-14 10:17:19.000000000 +0000
@@ -76,12 +76,9 @@
  * 
  * Open a new UDP socket.
  */
-int udp_open(daddr, source, dest)
-t_ipaddr daddr;
-int      source;
-int      dest;
+int udp_open(t_ipaddr daddr, int source, int dest)
 {
-  register unsigned char *addr;
+  const unsigned char *addr;
 
   /* Set global variables */
   usource = source;
@@ -101,16 +98,13 @@
  * 
  * IP receiver routine
  */
-static int ip_recv(buf, bufsize, addr)
-unsigned char *buf;
-int            bufsize;
-unsigned char *addr;
+static int ip_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr)
 {
   struct iphdr *ipp = ((struct iphdr *)buf);
   struct udphdr *udpp = ((struct udphdr *)(buf + IP_MIN_HSIZE));
   struct udp_pseudo psehdr;
 
-  int size;
+  unsigned int size;
   t_ipaddr dadr;
 
 #ifdef DEBUG
@@ -194,13 +188,9 @@
  * 
  * Read one packet from a UDP socket
  */
-int udp_read(buf, bufsize, timeout, abortch)
-char *buf;
-int   bufsize;
-int   timeout;
-char  abortch;
+int udp_read(char *buf, unsigned int bufsize, int timeout)
 {
-  int len;
+  unsigned int len;
 
   /* Wait until we get something */
   set_timeout(timeout);
@@ -299,9 +289,6 @@
  */
 int init_udp()
 {
-  /* Set module name for error handling */
-  net_module_name = "udp";
-
   /* Register IP packet type and set write buffer pointer */
   if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL)
 	return(FALSE);
diff -ruN proll_18.orig/src/udp.h proll-patch-15/src/udp.h
--- proll_18.orig/src/udp.h	2001-12-24 05:12:34.000000000 +0000
+++ proll-patch-15/src/udp.h	2005-08-14 10:16:40.000000000 +0000
@@ -53,7 +53,7 @@
 extern int udp_open __P((t_ipaddr daddr, int source, int dest));
 
 /* Read from a UDP socket */
-extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch));
+extern int udp_read(char *buf, unsigned int bufsize, int timeout);
 
 /* Write to a UDP socket */
 extern int udp_write __P((char *buf, int writelen));
diff -ruN proll_18.orig/src/vcons_zs.c proll-patch-15/src/vcons_zs.c
--- proll_18.orig/src/vcons_zs.c	1970-01-01 00:00:00.000000000 +0000
+++ proll-patch-15/src/vcons_zs.c	2005-08-14 10:25:51.000000000 +0000
@@ -0,0 +1,68 @@
+/**
+ ** Console over 'zs' (Zilog serial port)
+ ** Copyright 1999 Pete Zaitcev
+ ** This code is licensed under GNU General Public License.
+ **/
+
+#include "vconsole.h"
+#include <system.h>
+
+#define ZS_DATA 0x02
+
+int vcon_zs_init(struct vconterm *t, unsigned int a0)
+{
+
+	t->impl = (void *) a0;
+
+	t->vc_x = 0;    t->vc_y = 0;
+	t->backp = 0;    t->backc = 0;
+
+	stb_bypass(a0, 3); // reg 3
+	stb_bypass(a0, 1); // enable rx
+
+	stb_bypass(a0, 5); // reg 5
+	stb_bypass(a0, 8); // enable tx
+
+	return 0;
+}
+
+int vcon_zs_putch(struct vconterm *t, char c)
+{
+	unsigned zs_ptr = (unsigned) t->impl;
+
+	//while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { }
+	stb_bypass(zs_ptr + ZS_DATA, c);
+	return 0;
+}
+
+int vcon_zs_write(struct vconterm *t, char *data, int leng)
+{
+	while (leng != 0) {
+		leng--;
+		vcon_zs_putch(t, *data++);
+	}
+	return leng;
+}
+
+int vcon_zs_read(struct vconterm *t, char *data, __attribute((unused)) int leng)
+{
+	unsigned zs_ptr = (unsigned) t->impl;
+
+	while ((ldb_bypass(zs_ptr) & 1) != 1) { }
+	*data = ldb_bypass(zs_ptr + ZS_DATA);
+	return 0;
+}
+
+int vcon_zs_getch(struct vconterm *t)
+{
+	unsigned zs_ptr = (unsigned) t->impl;
+
+	while ((ldb_bypass(zs_ptr) & 1) != 1) { }
+	return ldb_bypass(zs_ptr + ZS_DATA) & 0xff;
+}
+
+void vcon_zs_fini(__attribute((unused)) struct vconterm *t)
+{
+	/* violent crash in the end */
+	;
+}
diff -ruN proll_18.orig/src/vconsole.c proll-patch-15/src/vconsole.c
--- proll_18.orig/src/vconsole.c	1999-11-08 03:10:28.000000000 +0000
+++ proll-patch-15/src/vconsole.c	2005-08-14 10:24:49.000000000 +0000
@@ -7,12 +7,17 @@
 #include "vconsole.h"
 
 #include "hconsole.h"
+#include <system.h>
 
 static void vcon_i_cursfeed(struct vconterm *t);
 static void vcon_i_backflush(struct vconterm *t);
 
 struct hconsole hcons0;
 
+enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
+	EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
+	ESpalette };
+
 int vcon_init(struct vconterm *t, unsigned int a0)
 {
 	struct hconsole *hconp;
@@ -25,11 +30,49 @@
 
 	t->vc_x = 0;    t->vc_y = 0;
 	t->backp = 0;    t->backc = 0;
+	t->vc_state = ESnormal;
 
 	hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_);
 	return 0;
 }
 
+/*
+ * gotoxy() must verify all boundaries, because the arguments
+ * might also be negative. If the given position is out of
+ * bounds, the cursor is placed at the nearest margin.
+ */
+static void gotoxy(struct vconterm *vc, int new_x, int new_y)
+{
+	int max_x, max_y;
+	struct hconsole *hconp = vc->impl;
+
+	max_x = hcon_qxdim(hconp);
+	max_y = hcon_qydim(hconp);
+
+	if (new_x < 0)
+		vc->vc_x = 0;
+	else {
+		if (new_x >= max_x)
+			vc->vc_x = max_x - 1;
+		else
+			vc->vc_x = new_x;
+	}
+
+	if (new_y < 0)
+		vc->vc_y = 0;
+	else if (new_y >= max_y)
+		vc->vc_y = max_y - 1;
+	else
+		vc->vc_y = new_y;
+
+}
+
+/* for absolute user moves, when decom is set */
+static void gotoxay(struct vconterm *t, int new_x, int new_y)
+{
+	gotoxy(t, new_x, new_y);
+}
+
 int vcon_write(struct vconterm *t, char *data, int leng)
 {
 	int l = leng;
@@ -40,29 +83,101 @@
 		if (l <= 0) break;
 		c = *data++;    --l;
 
-		switch (c) {
-		case 0x07:		/* Bell */
-			vcon_i_backflush(t);
-			break;
-		case 0x0A:		/* Linefeed */
-			vcon_i_backflush(t);
-			vcon_i_cursfeed(t);
+		switch(t->vc_state) {
+		case ESesc:
+			t->vc_state = ESnormal;
+			switch (c) {
+			case '[':
+				t->vc_state = ESsquare;
+				break;
+			case 'M':
+				hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
+				break;
+			default:
+			        //printk("Unhandled escape code '%c'\n", c);
+				break;
+			}
 			break;
-		case 0x0D:		/* Return */
-			vcon_i_backflush(t);
-			t->vc_x = 0;
+		case ESsquare:
+			for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++)
+				t->vc_par[t->vc_npar] = 0;
+			t->vc_npar = 0;
+			t->vc_state = ESgetpars;
+		case ESgetpars:
+			if (c==';' && t->vc_npar<NPAR-1) {
+				t->vc_npar++;
+				break;
+			} else if (c>='0' && c<='9') {
+				t->vc_par[t->vc_npar] *= 10;
+				t->vc_par[t->vc_npar] += c-'0';
+				break;
+			} else t->vc_state=ESgotpars;
+		case ESgotpars:
+			t->vc_state = ESnormal;
+			switch(c) {
+			case 'H': case 'f':
+				if (t->vc_par[0]) t->vc_par[0]--;
+				if (t->vc_par[1]) t->vc_par[1]--;
+				gotoxay(t, t->vc_par[1], t->vc_par[0]);
+				break;
+			case 'J':
+				if (t->vc_par[0] == 0) {
+					//erase from cursor to end of display
+					hcon_clear(hconp, t->vc_y, t->vc_x, hconp->ydim_, hconp->xdim_);
+				}
+				break;
+			case 'M':
+				hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
+				break;
+			case 'm':
+				break;
+			default:
+#if 0
+			        printk("Unhandled escape code '%c', par[%d, %d, %d, %d, %d]\n",
+				   c, t->vc_par[0], t->vc_par[1], t->vc_par[2], t->vc_par[3], t->vc_par[4]);
+#endif
+				break;
+			}
 			break;
 		default:
-			if (t->backp == 0) {
-				t->backc = 1;
-				t->backp = data-1;
-			} else {
-				t->backc++;
-			}
-			if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
+			t->vc_state = ESnormal;
+			switch (c) {
+			case 0x07:		/* Bell */
+				vcon_i_backflush(t);
+				break;
+			case 0x08:		/* BS */
+				vcon_i_backflush(t);
+				if (t->vc_x > 0)
+					t->vc_x--;
+				break;
+			case 0x0A:		/* Linefeed */
 				vcon_i_backflush(t);
-				t->vc_x = 0;
 				vcon_i_cursfeed(t);
+				break;
+			case 0x0D:		/* Return */
+				vcon_i_backflush(t);
+				t->vc_x = 0;
+				break;
+			case 24: case 26:
+				vcon_i_backflush(t);
+				t->vc_state = ESnormal;
+				break;
+			case 27:
+				vcon_i_backflush(t);
+				t->vc_state = ESesc;
+				break;
+			default:
+				if (t->backp == 0) {
+					t->backc = 1;
+					t->backp = data-1;
+				} else {
+					t->backc++;
+				}
+				if ((unsigned int)t->vc_x + t->backc >= hcon_qxdim(hconp)) {
+					vcon_i_backflush(t);
+					t->vc_x = 0;
+					vcon_i_cursfeed(t);
+				}
 			}
 		}
 	}
@@ -73,7 +188,7 @@
 static void vcon_i_cursfeed(struct vconterm *t) {
 	struct hconsole *hconp = t->impl;
 
-	if (++t->vc_y >= hcon_qydim(hconp)) {
+	if ((unsigned int)++t->vc_y >= hcon_qydim(hconp)) {
 		t->vc_y = hcon_qydim(hconp)-1;
 		hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
 	}
@@ -90,22 +205,75 @@
 	t->backp = 0;    t->backc = 0;
 }
 
-int vcon_putch(struct vconterm *t, char c)
+int vcon_putch(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char c)
 {
 	return -1;
 }
 
-int vcon_read(struct vconterm *t, char *data, int leng)
+int vcon_read(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char *data, __attribute__((unused)) int leng)
 {
 	return 0;
 }
 
-int vcon_getch(struct vconterm *t)
+static const unsigned char sunkbd_keycode[128] = {
+    0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0,
+    '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 8,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
+    'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '\\', 13,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    ' ',
+};
+
+static const unsigned char sunkbd_keycode_shifted[128] = {
+    0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0,
+    '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 8,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
+    'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '|', 13,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    ' ',
+};
+
+static int shiftstate;
+
+int vcon_getch(__attribute__((unused)) struct vconterm *t)
 {
-	return -1;
+        int ch;
+
+	while ((ldb_bypass(0x71000004) & 1) != 1) { }
+	do {
+	    ch = ldb_bypass(0x71000006) & 0xff;
+	    if (ch == 99)
+		shiftstate |= 1;
+	    else if (ch == 110)
+		shiftstate |= 2;
+	    else if (ch == 227)
+		shiftstate &= ~1;
+	    else if (ch == 238)
+		shiftstate &= ~2;
+	    //printk("getch: %d\n", ch);
+	}
+	while ((ch & 0x80) == 0 || ch == 238 || ch == 227); // Wait for key release
+	//printk("getch rel: %d\n", ch);
+	ch &= 0x7f;
+	if (shiftstate)
+	    ch = sunkbd_keycode_shifted[ch];
+	else
+	    ch = sunkbd_keycode[ch];
+	//printk("getch xlate: %d\n", ch);
+	return ch;
 }
 
-void vcon_fini(struct vconterm *t)
+void vcon_fini(__attribute__((unused)) struct vconterm *t)
 {
 	/* violent crash in the end */
 	;
diff -ruN proll_18.orig/src/vconsole.h proll-patch-15/src/vconsole.h
--- proll_18.orig/src/vconsole.h	1999-11-08 00:58:13.000000000 +0000
+++ proll-patch-15/src/vconsole.h	2005-03-02 12:40:12.000000000 +0000
@@ -6,6 +6,8 @@
 #ifndef VCONSOLE_H
 #define VCONSOLE_H
 
+#define NPAR 16
+
 struct vconterm {
 	void *impl;
 
@@ -13,6 +15,8 @@
 	int backc;		/* Same, count */
 
 	int vc_x, vc_y;		/* XXX Make vcon_xxx() to use cellmap->xpos_ */
+	int vc_state;
+	unsigned int	vc_npar,vc_par[NPAR];	/* Parameters of current escape sequence */
 };
 
 int vcon_init(struct vconterm *t, unsigned int a0);