summaryrefslogtreecommitdiff
path: root/misc/buildroot/toolchain/gdb/6.4/700-m68hc1x-20060122.patch
blob: fbb364c4c69cb1da6c90a5240a0c6b51b4c3fb4a (plain) (blame)
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
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
diff --exclude-from=exclude.lst -Nrup gdb-6.4/bfd/ChangeLog.M68HC11 gdb-6.4-m68hc1x/bfd/ChangeLog.M68HC11
--- gdb-6.4/bfd/ChangeLog.M68HC11	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/bfd/ChangeLog.M68HC11	Sun Jan 22 22:18:25 2006
@@ -0,0 +1,7 @@
+2006-01-21  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* elf32-m68hc1x.c: Include "alloca-conf.h"
+
+2004-02-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* opncls.c: Merge from mingw32 20031011 port.
diff --exclude-from=exclude.lst -Nrup gdb-6.4/bfd/elf32-m68hc1x.c gdb-6.4-m68hc1x/bfd/elf32-m68hc1x.c
--- gdb-6.4/bfd/elf32-m68hc1x.c	Mon Jun 20 20:12:07 2005
+++ gdb-6.4-m68hc1x/bfd/elf32-m68hc1x.c	Sat Jan 21 17:53:08 2006
@@ -1,5 +1,5 @@
 /* Motorola 68HC11/HC12-specific support for 32-bit ELF
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
    Contributed by Stephane Carrez (stcarrez@nerim.fr)
 
@@ -19,6 +19,7 @@ You should have received a copy of the G
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
+#include "alloca-conf.h"
 #include "bfd.h"
 #include "sysdep.h"
 #include "bfdlink.h"
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/ChangeLog.M68HC11 gdb-6.4-m68hc1x/gdb/ChangeLog.M68HC11
--- gdb-6.4/gdb/ChangeLog.M68HC11	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/ChangeLog.M68HC11	Sat Jan 21 17:14:12 2006
@@ -0,0 +1,147 @@
+2006-01-21  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* m68hc11-rom.c (dbug_xfer_memory): Use gdb_byte
+	* remote-bdm12.c (gdbbdm12_insert_breakpoint): Use gdb_byte
+	(gdbbdm12_remove_breakpoint): Likewise.
+	(gdbbdm12_xfer_inferior_memory): Likewise.
+	(gdbbdm12_fetch_register): Use regcache_raw_supply to set the
+	register in gdb's cache. Use register_size.
+	(gdbbdm12_store_register): Likewise.
+
+2004-08-05  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* ser-mingw.c (do_mingw_readchar): Use deprecated_ui_loop_hook instead of
+	ui_loop_hook
+
+2004-08-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* signals/signals.c (SIGTRAP): Define if not defined so that the
+	simulator works on mingw32.
+
+2004-08-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	Patch Savannah/3123:
+	From Marek Peca <marek@tynska.cuni.cz>:
+
+	* remote-bdm12.c (gdbbdm12_cntrl_c): Set stop requested flag.
+	(gdbbdm12_wait): Call gdbbdm12_stop here instead of from sig handler.
+	* remote-bdm12.c (gdbbdm12_stop): Clear stop requested flag.
+
+2004-08-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* remote-bdm12.c (gdbbdm12_create_inferior): Fix prototype.
+
+2004-08-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* remote-bdm12.c (gdbbdm12_fetch_register): Use DEPRECATED_REGISTER_RAW_SIZE.
+	(gdbbdm12_store_register): Likewise.
+
+2004-02-08  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* remote-bdm12.c (gdbbdm12_wait): Use TARGET_SIGNAL_SIGABRT,
+	TARGET_SIGNAL_INT, TARGET_SIGNAL_TRAP
+
+	* bdm12.c (bdm12_stop_reason): Use TARGET_SIGNAL_TRAP and
+	TARGET_SIGNAL_INT.
+
+2004-02-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.in: Bump to 2004-02-01
+
+2004-02-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* bdm12.h (bdm12_create_inferior): Update prototype.
+	Convert prototypes.
+	* bdm12.c (bdm12_create_inferior): Use bfd type.
+
+	* remote-bdm12.c (gdbbdm12_fetch_register): Use MAX_REGISTER_SIZE.
+	(gdbbdm12_store_register): Likewise.
+	(gdbbdm12_store_register): Use deprecated_read_register_gen.
+
+2004-02-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* configure.in, environ.c, environ.h, infcmd.c, inferior.h,
+	win32-nat.c, event-loop.c, event-loop.h, utils.c, top.c, ser-mingw.c,
+        set-mingw.h, ser-tcp.c, ser-unix.c, inferior.h:
+
+	Merge http://www.ming.org 20031011 gdb patch for Mingw32 host.
+
+2002-06-15  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* remote-bdm12.c (gdbbdm12_kill): Use null_ptid.
+	(gdbbdm12_load): Likewise.
+	(gdbbdm12_resume): Use PIDGET.
+	(gdbbdm12_wait): Update prototype.
+	(pass_command): Use target_fetch_register.
+
+2002-06-10  Martin Rod  <martin.rod@ct.cz>
+
+	* bdm12.c: Add small delay after RTS asserting (Linux)
+
+2001-10-14  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* bdm12.c: Don't compile under Mingw32 since serial line code is
+	not ported.
+	* remote-bdm12.c: Likewise.
+
+2001-09-28  Tim Housel	<thousel@usa.net>
+
+	* bdm12.c: New file (BDM12 pod communication support).
+	* bdm12.h: New file.
+	* remote-bdm12.c: New file (BDM12 gdb backend).
+	* bdm12_eraseflash.h: New file.
+	* bdm12_programflash.h: New file.
+	* Makefile.in (ALLDEPFILES): Add new files.
+
+2001-01-13  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dsrec.c (load_srec): Use the LMA address when loading.
+
+2001-01-06  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dsrec.c (load_srec): Use serial_write function to send
+	data on the serial line.
+	* srec.h (load_srec): Add serial_write parameter.
+
+2000-12-28  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* monitor.h (serial_write): New member.
+	* monitor.c (monitor_write): Use it if it is set.
+	(monitor_read_memory): Use monitor_write.
+
+2000-12-28  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-rom.c (set_gdbarch): New function.
+	(m68hc11_serial_write): New function.
+	(console_input): New function.
+	(do_console_input): New function.
+	(m68hc11_wait_filter): New function.
+	(init_buffalo_cmds): Install them.
+	(dbug_dumpregs): New function.
+	(dbug_xfer_memory): New function.
+	(init_dbug_cmds): New function.
+	(dbug_open): New function.
+	(_initialize_m68hc11_rom): Register DBUG monitor.
+
+2000-12-03  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* Makefile.in (m68hc11-tdep.o): Define dependencies.
+	(m68hc11-rom.o): Likewise.
+	(ALLDEPFILES): Add m68hc11-tdep.c
+	* m68hc11-rom.c: New file for 68HC11/68HC12 monitors.
+	* config/m68hc11/m68hc11.mt (TDEPFILES): Add files for monitor
+	support.
+
+2000-09-10  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* monitor.c (monitor_fetch_register): Fix allocation of zerobuf
+	and regbuf (from GDB cvs main branch).
+
+2000-09-10  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* monitor.c (monitor_write_memory): If setmem.resp_delim is set,
+	use a regular expression to check the write memory command.
+	(monitor_store_register): Likewise with setreg.resp_delim.
+	(monitor_open): Compile the setmem and setreg regular expressions.
+	* m68hc11-rom.c: New file for 68hc11 monitors support.
+	* config/m68hc11/m68hc11.mt (TDEPFILES): Add the monitor support.
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/bdm12.c gdb-6.4-m68hc1x/gdb/bdm12.c
--- gdb-6.4/gdb/bdm12.c	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/bdm12.c	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,1340 @@
+/* Target communications support for Kevin Ross' BDM12 pod for the 68HC12
+   Copyright 2001
+   Free Software Foundation, Inc.
+   Contributed by Tim Housel (thousel@usa.net)
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "gdbcore.h"
+#include "gdb_string.h"
+#include <fcntl.h>
+#include "frame.h"
+#include "inferior.h"
+#include "bfd.h"
+#include "symfile.h"
+#include "target.h"
+#include "gdbcmd.h"
+#include "objfiles.h"
+#include "gdb-stabs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <signal.h>
+#include "serial.h"
+#include "bdm12.h"
+#include "bdm12_eraseflash.h"
+#include "bdm12_programflash.h"
+
+#if defined(__CYGWIN32__) || defined(__MINGW32__)
+#include <windows.h>
+#include <io.h>
+#else
+/* assuming UNIX */
+#include <sys/ioctl.h>
+#endif
+
+#define xfree(ptr) free(ptr)
+
+#define BDM12_RTS_DELAY 1
+
+/* Prototypes for local functions */
+
+static int bdm12_eeprom_write (CORE_ADDR memaddr, char *buf, int len);
+
+static int bdm12_flash_write (CORE_ADDR memaddr, char *buf, int len);
+
+static int erase_flash(void);
+
+static int bdm12_put_packet (unsigned char *packet, int pktlen);
+
+static int bdm12_get_packet (unsigned char *packet, int pktlen);
+
+static void write_rts_state (int state);
+
+static int read_cts_state (void);
+
+static int valid_write_range (CORE_ADDR start_addr, CORE_ADDR end_addr);
+
+static int valid_read_range (CORE_ADDR start_addr, CORE_ADDR end_addr);
+
+static long diffms (struct timeval t1, struct timeval t2);
+
+/* serial descriptor for interface to BDM pod */
+static struct serial* ser_desc = NULL;
+
+/* since cygwin doesn't support the ioctls for manually mucking with the
+   RTS and CTS lines, we must use win32 calls. This provides a place to
+   store the windows handle */
+#if defined(__CYGWIN32__) || defined(__MINGW32__)
+static HANDLE win_ser_desc = INVALID_HANDLE_VALUE;
+#endif
+
+static unsigned char reg_page = 0;
+static unsigned int  reg_base = 0;
+static unsigned int ram_base = 0;
+static unsigned int eeprom_base = 0;
+static unsigned int flash_base = 0;
+static int num_breakpoints = 0;
+static int program_loaded = 0;
+static int flash_erased = 0;
+static int stopped = 0;
+static int singlestepped = 1;
+
+static CORE_ADDR breakpoint[BDM12_MAX_BREAKPOINTS] = {0, 0};
+
+struct memory_region_list
+  {
+    CORE_ADDR addr;
+    unsigned int size;
+    unsigned char* data;
+    struct memory_region_list* next;
+    struct memory_region_list* prev;
+  } flash_regions;
+
+struct memory_region_list *cur_region = &flash_regions;
+
+/* Open a connection to a remote debugger.
+   NAME is the filename used for communication.  */
+
+BDM12_RC
+bdm12_open (char **argv)
+{
+  char *ser_name;
+  unsigned char buf[5];
+  int erate, rc;
+
+  if (argv == NULL)
+    return BDM12_RC_FAIL;
+  if (argv[0] == NULL)
+    return BDM12_RC_FAIL;
+  if (argv[1] == NULL)
+    return BDM12_RC_FAIL;
+  if (argv[2] == NULL)
+    return BDM12_RC_FAIL;
+  if (argv[3] == NULL)
+    return BDM12_RC_FAIL;
+  if (argv[4] == NULL)
+    return BDM12_RC_FAIL;
+  if (argv[5] == NULL)
+    return BDM12_RC_FAIL;
+
+  ser_name = alloca (strlen (argv[0]) + 6); /* for "/dev/\0" */
+  if (!ser_name)
+    return BDM12_RC_FAIL;
+
+  strcpy (ser_name, "/dev/");
+  strcat (ser_name, argv[0]);
+  erate = atoi (argv[1]);
+  switch (erate)
+    {
+    case 1:
+      erate = BDM12_ECLOCK_1MHZ;
+      break;
+    case 2:
+      erate = BDM12_ECLOCK_2MHZ;
+      break;
+    case 4:
+      erate = BDM12_ECLOCK_4MHZ;
+      break;
+    case 8:
+      erate = BDM12_ECLOCK_8MHZ;
+      break;
+    default:
+      error ("bad value for target E clock rate - use 1, 2, 4, or 8)");
+      return BDM12_RC_FAIL;
+      break;
+    }
+
+  reg_base = strtoul (argv[2], NULL, 16);
+  if (reg_base & 0x7ff)
+    {
+      error ("bad value for target register base - should be on 2K boundary");
+      return BDM12_RC_FAIL;
+    }
+
+  ram_base = strtoul (argv[3], NULL, 16);
+  if (ram_base & 0x7ff)
+    {
+      error ("bad value for target RAM base - should be on 2K boundary");
+      return BDM12_RC_FAIL;
+    }
+
+  eeprom_base = strtoul (argv[4], NULL, 16);
+  if ((eeprom_base & 0x2ff) || !((eeprom_base & 0xfff) | 0xd00))
+    {
+      error ("bad value for target EEPROM base - should be on 4K boundary + 0xd00");
+      return BDM12_RC_FAIL;
+    }
+
+  flash_base = strtoul (argv[5], NULL, 16);
+  if (flash_base & 0x7fff)
+    {
+      error ("bad value for target FLASH base - should be on 32K boundary");
+      return BDM12_RC_FAIL;
+    }
+
+  reg_page = reg_base >> 8;
+
+  ser_desc = serial_open (ser_name);
+  if (!ser_desc)
+    {
+      error ("unable to open serial port");
+      return BDM12_RC_FAIL;
+    }
+
+#if defined(__CYGWIN32__)
+  win_ser_desc = (HANDLE) get_osfhandle (ser_desc->fd);
+#elif defined(__MINGW32__)
+  win_ser_desc = (HANDLE) ser_desc->fd;
+#endif
+
+  if (!ser_desc)
+    {
+      perror_with_name (ser_name);
+      return BDM12_RC_FAIL;
+    }
+
+  if (serial_setbaudrate (ser_desc, BDM12_BAUD_RATE))
+    {
+      serial_close (ser_desc);
+      perror_with_name (ser_name);
+      return BDM12_RC_FAIL;
+    }
+
+  serial_raw (ser_desc);
+
+  /* If there is something sitting in the buffer we might take it as a
+     response to a command, which would be bad.  */
+  serial_flush_input (ser_desc);
+
+  rc = 0;
+
+  /* synchronize the pod */
+  buf[0] = BDM12_CMD_SYNC;
+  rc = bdm12_put_packet (buf, 1);
+  /* if the first command doesn't work, bail */
+  if (rc)
+    return BDM12_RC_FAIL;
+
+  /* now just collect the errors for the next set of commands */
+
+  /* set the target parameters */
+  buf[0] = BDM12_CMD_EXT;
+  buf[1] = BDM12_CMD_EXT_SETPARAM;
+  buf[2] = erate;
+  buf[3] = 0; /* We don't need no steekin' delays, I hope ;-) */
+  buf[4] = 0;
+  rc += bdm12_put_packet (buf, 5);
+
+  /* reset the target */
+  buf[0] = BDM12_CMD_RESET;
+  rc += bdm12_put_packet (buf, 1);
+
+  /* make sure BDM is enabled */
+  buf[0] = BDM12_CMD_WRITE_BD_BYTE;
+  buf[1] = BDM12_BDM_HI;
+  buf[2] = BDM12_ENABLE_BDM_LO;
+  buf[3] = BDM12_INIT_ENABLE_BDM;
+  buf[4] = buf[3];
+  rc += bdm12_put_packet (buf, 5);
+
+  /* map the registers */
+  buf[0] = BDM12_CMD_WRITE_BYTE;
+  buf[1] = 0;
+  buf[2] = BDM12_REG_INITRG;
+  buf[3] = reg_page;
+  buf[4] = buf[3];
+  rc += bdm12_put_packet (buf, 5);
+
+  /* Let the POD know where we've mapped the registers */
+  buf[0] = BDM12_CMD_SET_REGBASE;
+  buf[1] = reg_page;
+  rc += bdm12_put_packet (buf, 2);
+
+  /* map RAM */
+  buf[0] = BDM12_CMD_WRITE_BYTE;
+  buf[2] = BDM12_REG_INITRM;
+  buf[3] = ram_base >> 8;
+  buf[4] = buf[3];
+  rc += bdm12_put_packet (buf, 5);
+
+  /* map EEPROM */
+  buf[2] = BDM12_REG_INITEE;
+  buf[3] = ((eeprom_base >> 8) & 0xf0) | 0x1;
+  buf[4] = buf[3];
+  rc += bdm12_put_packet (buf, 5);
+
+  /* map FLASH */
+  buf[2] = BDM12_REG_MISC;
+  buf[3] = 0x0d | (flash_base >> 14);
+  buf[4] = buf[3];
+  rc += bdm12_put_packet (buf, 5);
+
+  /* setup breakpoints */
+  buf[2] = BDM12_REG_BRKCT0;
+  buf[3] = BDM12_INIT_BRKCT0;
+  buf[4] = buf[3];
+  rc += bdm12_put_packet (buf, 5);
+
+  /* setup breakpoints */
+  buf[2] = BDM12_REG_BRKCT1;
+  buf[3] = BDM12_INIT_BRKCT1;
+  buf[4] = buf[3];
+  rc += bdm12_put_packet (buf, 5);
+
+  /* disable flash protection */
+  buf[2] = BDM12_REG_FEEMCR;
+  buf[3] = BDM12_INIT_FEEMCR;
+  buf[4] = buf[3];
+  rc += bdm12_put_packet (buf, 5);
+
+  if (rc)
+    return BDM12_RC_FAIL;
+
+  serial_flush_input (ser_desc);
+  return BDM12_RC_OK;
+}
+
+/* Clean up connection to a remote debugger.  */
+
+void
+bdm12_close (int quitting)
+{
+  if (ser_desc)
+    serial_close (ser_desc);
+  ser_desc = NULL;
+#if defined(__CYGWIN32__) || defined(__MINGW32__)
+  win_ser_desc = INVALID_HANDLE_VALUE;
+#endif
+  program_loaded = 0;
+  flash_erased = 0;
+  stopped = 0;
+
+  while (cur_region->prev != NULL)
+    {
+      if (cur_region->data)
+        xfree(cur_region->data);
+      if (cur_region->next)
+        xfree(cur_region->next);
+
+      cur_region = cur_region->prev;
+    }
+}
+
+/* Init processor state - for us just set the PC to _start from the bfd */
+BDM12_RC
+bdm12_create_inferior (bfd *abfd, char **argv, char **env)
+{
+  CORE_ADDR start = bfd_get_start_address (abfd);
+  unsigned char cmdbuf[2];
+
+  /* set the PC */
+  cmdbuf[0] = start >> 8;
+  cmdbuf[1] = start;
+  return (bdm12_store_register (HARD_PC_REGNUM, cmdbuf, 2) != 2);
+}
+
+/* Tell the remote machine to resume.  */
+
+int
+bdm12_resume (int step)
+{
+  unsigned char buf;
+  int rc;
+
+  if (step)
+    {
+      buf = BDM12_CMD_TRACE1;
+      singlestepped = 1;
+    }
+  else
+    {
+      buf = BDM12_CMD_GO;
+      singlestepped = 0;
+    }
+
+  if (!(rc = bdm12_put_packet (&buf, 1)))
+    stopped = 0;
+  return rc;
+}
+
+int
+bdm12_stop (void)
+{
+  BDM12_RC rc;
+  unsigned char buf = BDM12_CMD_BACKGROUND;
+
+  rc = bdm12_put_packet (&buf, 1);
+  if (rc == BDM12_RC_OK)
+    stopped = 1;
+  return !rc;
+}
+
+/* Read register */
+
+int
+bdm12_fetch_register (int regno, unsigned char* buf, int length)
+{
+  unsigned char cmdbuf[3];
+  int rc;
+
+  switch (regno)
+    {
+    case HARD_A_REGNUM:
+    case HARD_B_REGNUM:
+    case HARD_D_REGNUM:
+      cmdbuf[0] = BDM12_CMD_READ_D;
+      break;
+    case HARD_X_REGNUM:
+      cmdbuf[0] = BDM12_CMD_READ_X;
+      break;
+    case HARD_Y_REGNUM:
+      cmdbuf[0] = BDM12_CMD_READ_Y;
+      break;
+    case HARD_SP_REGNUM:
+      cmdbuf[0] = BDM12_CMD_READ_SP;
+      break;
+    case HARD_PC_REGNUM:
+      cmdbuf[0] = BDM12_CMD_READ_PC;
+      break;
+    case HARD_PSW_REGNUM:
+      cmdbuf[0] = BDM12_CMD_READ_BD_BYTE;
+      cmdbuf[1] = BDM12_BDM_HI;
+      cmdbuf[2] = BDM12_CCRSAV_BDM_LO;
+      break;
+    default:
+      return 0;
+    }
+
+  if (regno == HARD_PSW_REGNUM)
+    rc = bdm12_put_packet (cmdbuf, 3);
+  else
+    rc = bdm12_put_packet (cmdbuf, 1);
+
+  if (rc)
+    return 0;
+
+  rc = bdm12_get_packet (cmdbuf, 2);
+  if (rc)
+    return 0;
+
+  switch (regno)
+    {
+    case HARD_A_REGNUM:
+    case HARD_PSW_REGNUM:
+      buf[0] = 0;
+      buf[1] = cmdbuf[0];
+      break;
+    case HARD_B_REGNUM:
+      buf[0] = 0;
+      buf[1] = cmdbuf[1];
+      break;
+    default:
+      buf[0] = cmdbuf[0];
+      buf[1] = cmdbuf[1];
+      break;
+    }
+
+  return length;
+}
+
+/* Write register */
+
+int
+bdm12_store_register (int regno, unsigned char* buf, int length)
+{
+  unsigned char cmdbuf[5];
+  int rc = 0;
+
+  switch (regno)
+    {
+    case HARD_A_REGNUM:
+      cmdbuf[0] = BDM12_CMD_READ_D;
+      rc += bdm12_put_packet (cmdbuf, 1);
+      rc += bdm12_get_packet (cmdbuf, 2);
+      cmdbuf[2] = cmdbuf[1];
+      cmdbuf[1] = buf[0];
+      cmdbuf[0] = BDM12_CMD_WRITE_D;
+      break;
+    case HARD_B_REGNUM:
+      cmdbuf[0] = BDM12_CMD_READ_D;
+      rc += bdm12_put_packet (cmdbuf, 1);
+      rc += bdm12_get_packet (cmdbuf, 2);
+      cmdbuf[2] = buf[1];
+      cmdbuf[1] = cmdbuf[0];
+      cmdbuf[0] = BDM12_CMD_WRITE_D;
+      break;
+    case HARD_D_REGNUM:
+      cmdbuf[0] = BDM12_CMD_WRITE_D;
+      cmdbuf[1] = buf[0];
+      cmdbuf[2] = buf[1];
+      break;
+    case HARD_X_REGNUM:
+      cmdbuf[0] = BDM12_CMD_WRITE_X;
+      cmdbuf[1] = buf[0];
+      cmdbuf[2] = buf[1];
+      break;
+    case HARD_Y_REGNUM:
+      cmdbuf[0] = BDM12_CMD_WRITE_Y;
+      cmdbuf[1] = buf[0];
+      cmdbuf[2] = buf[1];
+      break;
+    case HARD_SP_REGNUM:
+      cmdbuf[0] = BDM12_CMD_WRITE_SP;
+      cmdbuf[1] = buf[0];
+      cmdbuf[2] = buf[1];
+      break;
+    case HARD_PC_REGNUM:
+      cmdbuf[0] = BDM12_CMD_WRITE_PC;
+      cmdbuf[1] = buf[0];
+      cmdbuf[2] = buf[1];
+      break;
+    case HARD_PSW_REGNUM:
+      cmdbuf[0] = BDM12_CMD_WRITE_BD_BYTE;
+      cmdbuf[1] = BDM12_BDM_HI;
+      cmdbuf[2] = BDM12_CCRSAV_BDM_LO;
+      cmdbuf[3] = buf[1];
+      cmdbuf[4] = buf[1];
+      break;
+    default:
+      return 0;
+    }
+
+  if (regno == HARD_PSW_REGNUM)
+    rc += bdm12_put_packet (cmdbuf, 5);
+  else
+    rc += bdm12_put_packet (cmdbuf, 3);
+
+  if (rc)
+    return 0;
+
+  return length;
+}
+
+/* Write memory to the target. */
+
+int
+bdm12_write (CORE_ADDR memaddr, unsigned char *buf, int len)
+{
+  unsigned char *cmdbuf;
+  unsigned int numwritten = 0;
+  int need_final_write = 0;
+
+  /* allow writes to flash and eeprom if the program isn't loaded yet */
+  if (!program_loaded && !valid_write_range (memaddr, memaddr + len - 1))
+    {
+      if (!valid_read_range (memaddr, memaddr + len - 1) || len <= 0)
+        return 0;
+      if (memaddr >= eeprom_base &&
+          memaddr < (eeprom_base + BDM12_SIZE_EEPROM) &&
+          (memaddr + len - 1) >= eeprom_base &&
+          (memaddr + len - 1) < (eeprom_base + BDM12_SIZE_EEPROM))
+        return bdm12_eeprom_write (memaddr, buf, len);
+      else if (memaddr >= flash_base &&
+            memaddr < (flash_base + BDM12_SIZE_FLASH) &&
+            (memaddr + len - 1) >= flash_base &&
+            (memaddr + len - 1) < (flash_base + BDM12_SIZE_FLASH))
+        return bdm12_flash_write (memaddr, buf, len);
+      else
+        {
+          error ("writing between different regions of memory");
+          return 0;
+        }
+    }
+  else if (!valid_write_range (memaddr, memaddr + len - 1) || len <= 0)
+    return 0;
+
+  cmdbuf = alloca (len + 6);
+  if (!cmdbuf)
+    return 0;
+
+  if (memaddr & 0x1)
+    {
+      cmdbuf[0] = BDM12_CMD_WRITE_BYTE;
+      cmdbuf[1] = memaddr >> 8;
+      cmdbuf[2] = memaddr;
+      cmdbuf[3] = *buf;
+      cmdbuf[4] = cmdbuf[3];
+      if (bdm12_put_packet (cmdbuf, 5))
+        return numwritten;
+      len--;
+      buf++;
+      numwritten++;
+      memaddr++;
+    }
+
+  if (len & 0x1)
+    {
+      need_final_write = 1;
+      len--;
+    }
+#if 0 /* MEMPUT command seems to cause communications hangups easily */
+    if (len)
+    {
+      cmdbuf[0] = BDM12_CMD_EXT;
+      cmdbuf[1] = BDM12_CMD_EXT_MEMPUT;
+      cmdbuf[2] = memaddr >> 8;
+      cmdbuf[3] = memaddr ;
+      cmdbuf[4] = (len / 2) >> 8;
+      cmdbuf[5] = (len / 2);
+      memcpy (cmdbuf + 6, buf, len);
+      if (bdm12_put_packet (cmdbuf, len + 6))
+        return numwritten;
+      buf += len;
+      numwritten += len;
+      memaddr += len;
+    }
+#endif
+
+#if 1
+
+  cmdbuf[0] = BDM12_CMD_WRITE_WORD;
+  while (len)
+    {
+      cmdbuf[1] = memaddr >> 8;
+      cmdbuf[2] = memaddr;
+      cmdbuf[3] = *(buf++);
+      cmdbuf[4] = *(buf++);
+      if (bdm12_put_packet (cmdbuf, 5))
+        return numwritten;
+      memaddr += 2;
+      numwritten += 2;
+      len -= 2;
+    }
+
+#endif
+
+  if (need_final_write)
+    {
+      cmdbuf[0] = BDM12_CMD_WRITE_BYTE;
+      cmdbuf[1] = memaddr >> 8;
+      cmdbuf[2] = memaddr;
+      cmdbuf[3] = *buf;
+      cmdbuf[4] = cmdbuf[3];
+      if (bdm12_put_packet (cmdbuf, 5))
+        return numwritten;
+      numwritten++;
+    }
+
+  return numwritten;
+}
+
+static int
+bdm12_eeprom_write (CORE_ADDR memaddr, char *buf, int len)
+{
+  unsigned char cmdbuf[6], recvbuf[2];
+  int numwritten = 0, need_final_write = 0;
+
+  if (memaddr & 0x1)
+    {
+      cmdbuf[0] = BDM12_CMD_READ_BYTE;
+      cmdbuf[1] = (memaddr - 1) >> 8;
+      cmdbuf[2] = (memaddr - 1);
+      if (bdm12_put_packet (cmdbuf, 3))
+        return numwritten;
+      if (bdm12_get_packet (recvbuf, 2))
+        return numwritten;
+      cmdbuf[0] = BDM12_CMD_EEPROM_WRITE;
+      cmdbuf[3] = recvbuf[0];
+      cmdbuf[4] = *buf;
+      if (bdm12_put_packet (cmdbuf, 5))
+        return numwritten;
+      len--;
+      buf++;
+      numwritten++;
+      memaddr++;
+    }
+
+  if (len & 0x1)
+    {
+      need_final_write = 1;
+      len--;
+    }
+
+  while (len)
+    {
+      cmdbuf[1] = memaddr >> 8;
+      cmdbuf[2] = memaddr;
+      cmdbuf[3] = *(buf++);
+      cmdbuf[4] = *(buf++);
+      if (bdm12_put_packet (cmdbuf, 5))
+        return numwritten;
+      memaddr += 2;
+      numwritten += 2;
+      len -= 2;
+    }
+
+  if (need_final_write)
+    {
+      cmdbuf[0] = BDM12_CMD_READ_BYTE;
+      cmdbuf[1] = (memaddr + 1) >> 8;
+      cmdbuf[2] = (memaddr + 1);
+      if (bdm12_put_packet (cmdbuf, 3))
+        return numwritten;
+      if (bdm12_get_packet (recvbuf, 2))
+        return numwritten;
+      cmdbuf[0] = BDM12_CMD_EEPROM_WRITE;
+      cmdbuf[3] = *buf;
+      cmdbuf[4] = recvbuf[1];
+      if (bdm12_put_packet (cmdbuf, 5))
+        return numwritten;
+      numwritten++;
+    }
+  return numwritten;
+}
+
+static int
+bdm12_flash_write (CORE_ADDR memaddr, char *buf, int len)
+{
+  unsigned char cmdbuf[2];
+  int numwritten = 0, dum, expectedsize, actualsize;
+  int packetsize = BDM12_SIZE_RAM - BDM12_PROGRAMFLASH_SIZE;
+
+  struct timeval start_time, cur_time;
+  enum bdm12_stop reason;
+
+  if (!flash_erased)
+    {
+      /* check to see if what is going to be written is the same as
+         what is already in flash, so that we don't write to flash
+         needlessly */
+      cur_region->next = xmalloc (sizeof (struct memory_region_list));
+      if (!cur_region->next)
+        return numwritten;
+      cur_region->data = xmalloc (len);
+      if (!cur_region->data)
+        {
+          xfree (cur_region->next);
+          cur_region->next = NULL;
+          return numwritten;
+        }
+      if (bdm12_read (memaddr, cur_region->data, len) != len)
+        {
+          xfree (cur_region->next);
+          xfree (cur_region->data);
+          cur_region->next = NULL;
+          cur_region->data = NULL;
+          return numwritten;
+        }
+      if (memcmp (cur_region->data, buf, len) == 0)
+        {
+          cur_region->size = len;
+          cur_region->addr = memaddr;
+          cur_region->next->prev = cur_region;
+          cur_region->next->next = NULL;
+          cur_region->next->size = 0;
+          cur_region->next->data = NULL;
+          cur_region = cur_region->next;
+          return len;
+        }
+
+      xfree(cur_region->next);
+      cur_region->next = NULL;
+
+      /* erase the flash array */
+      if (erase_flash ())
+        {
+          error ("Unable to erase flash");
+          return numwritten;
+        }
+      flash_erased = 1;
+      /* write the flash burning program into RAM - the program is in
+         bdm12_programflash.h */
+      if (bdm12_write (ram_base, programflash, BDM12_PROGRAMFLASH_SIZE) !=
+          BDM12_PROGRAMFLASH_SIZE)
+        return numwritten;
+      /* tell the burn program where the registers are */
+      cmdbuf[0] = reg_base >> 8;
+      cmdbuf[1] = reg_base;
+      if (bdm12_write (ram_base + BDM12_PROGRAMFLASH_REGSTART, cmdbuf, 2) != 2)
+        return numwritten;
+      /* tell the burn program where the data starts */
+      cmdbuf[0] = (ram_base + BDM12_PROGRAMFLASH_SIZE) >> 8;
+      cmdbuf[1] = (ram_base + BDM12_PROGRAMFLASH_SIZE);
+      if (bdm12_write (ram_base + BDM12_PROGRAMFLASH_DATASTART, cmdbuf, 2) != 2)
+        return numwritten;
+
+      /* now write all the previously stored regions */
+      for (cur_region = &flash_regions; cur_region->next != NULL;
+           cur_region = cur_region->next)
+        {
+          if (bdm12_flash_write (cur_region->addr, cur_region->data,
+              cur_region->size) != cur_region->size)
+            return numwritten;
+        }
+    }
+
+  /* tell the burn program where flash is */
+  while (len > 0)
+    {
+      if (len < packetsize)
+          expectedsize = len;
+      else
+          expectedsize = packetsize;
+
+      /* write the next packet in target RAM */
+      if (bdm12_write (ram_base + BDM12_PROGRAMFLASH_SIZE, buf,
+          expectedsize) != expectedsize)
+        break;
+
+      /* tell the burn program the starting flash address */
+      cmdbuf[0] = memaddr >> 8;
+      cmdbuf[1] = memaddr;
+      if (bdm12_write (ram_base + BDM12_PROGRAMFLASH_FLASHSTART, cmdbuf, 2) != 2)
+        break;
+      
+      /* tell the burn program the ending flash address (noninclusive) */
+      cmdbuf[0] = (memaddr + expectedsize) >> 8;
+      cmdbuf[1] = (memaddr + expectedsize);
+      if (bdm12_write (ram_base + BDM12_PROGRAMFLASH_FLASHEND, cmdbuf, 2) != 2)
+        break;
+
+      /* set the PC */
+      cmdbuf[0] = (ram_base + BDM12_PROGRAMFLASH_PROGSTART) >> 8;
+      cmdbuf[1] = (ram_base + BDM12_PROGRAMFLASH_PROGSTART);
+      if (bdm12_store_register (HARD_PC_REGNUM, cmdbuf, 2) != 2)
+        break;
+    
+      /* run the burn program */
+      if (bdm12_resume (0))
+        break;
+
+      /* wait for burn program t finish; it should go back into bdm mode */
+      gettimeofday (&start_time, NULL);
+      do
+        { 
+          bdm12_stop_reason (&reason, &dum);
+          gettimeofday (&cur_time, NULL);
+          if (diffms (start_time, cur_time) > BDM12_PROGRAMFLASH_TIMEOUT *
+              expectedsize)
+            {
+              bdm12_stop_reason (&reason, &dum);
+              if (reason == BDM12_RUNNING)
+                break;
+            }
+        } while (reason == BDM12_RUNNING);
+      /* check error flag */
+      if (bdm12_read (ram_base + BDM12_PROGRAMFLASH_NUMWRITTEN, cmdbuf, 2) != 2)
+        break;
+
+      actualsize = (cmdbuf[0] << 8) + cmdbuf[1];
+      numwritten += actualsize;
+      if (expectedsize != actualsize)
+        break;
+      memaddr += actualsize;
+      buf += actualsize;
+      len -= actualsize;
+    }
+  return numwritten;
+}
+
+static int
+erase_flash(void)
+{
+  unsigned char buf[2];
+  struct timeval start_time, cur_time;
+  int dum;
+  enum bdm12_stop reason;
+
+  /* write the erase program into RAM - the program is in bdm12_eraseflash.h */
+  if (bdm12_write (ram_base, eraseflash, BDM12_ERASEFLASH_SIZE) !=
+      BDM12_ERASEFLASH_SIZE)
+    return 1;
+
+  /* tell the erase program where flash is */
+  buf[0] = flash_base >> 8;
+  buf[1] = flash_base;
+  if (bdm12_write (ram_base + BDM12_ERASEFLASH_FLASHSTART, buf, 2) != 2)
+    return 1;
+
+  /* tell the erase program where the registers are */
+  buf[0] = reg_base >> 8;
+  buf[1] = reg_base;
+  if (bdm12_write (ram_base + BDM12_ERASEFLASH_REGSTART, buf, 2) != 2)
+    return 1;
+
+  /* set the PC */
+  buf[0] = (ram_base + BDM12_ERASEFLASH_PROGSTART) >> 8;
+  buf[1] = (ram_base + BDM12_ERASEFLASH_PROGSTART);
+  if (bdm12_store_register (HARD_PC_REGNUM, buf, 2) != 2)
+    return 1;
+
+  /* run the erase program */
+  if (bdm12_resume (0))
+    return 1;
+  /* wait for erase program to finish; it should go back into bdm mode */
+  
+  gettimeofday (&start_time, NULL);
+  do
+    { 
+      bdm12_stop_reason (&reason, &dum);
+      gettimeofday (&cur_time, NULL);
+      if (diffms (start_time, cur_time) > BDM12_ERASEFLASH_TIMEOUT)
+        {
+          bdm12_stop_reason (&reason, &dum);
+          if (reason == BDM12_RUNNING)
+            return 1;
+        }
+    } while (reason == BDM12_RUNNING);
+
+  /* check error flag */
+  if (bdm12_read (ram_base + BDM12_ERASEFLASH_ERRORFLAG, buf, 1) != 1)
+    return 1;
+
+  return buf[0];
+}
+
+void
+bdm12_stop_reason (enum bdm12_stop *reason, int *sigrc)
+{
+  unsigned char buf[3];
+
+  buf[0] = BDM12_CMD_READ_BD_BYTE;
+  buf[1] = BDM12_BDM_HI;
+  buf[2] = BDM12_ENABLE_BDM_LO;
+  if (bdm12_put_packet (buf, 3))
+    {
+      *reason = BDM12_POLLING;
+      return;
+    }
+  if (bdm12_get_packet (buf, 2))
+    {
+      *reason = BDM12_POLLING;
+      return;
+    }
+
+  if (!(buf[1] & BDM12_STATUS_STOPPED))
+    {
+      *reason = BDM12_RUNNING;
+      return;
+    }
+  if (num_breakpoints > 0)
+    {
+      unsigned char pcbuf[2];
+      CORE_ADDR pc;
+      if (bdm12_fetch_register (HARD_PC_REGNUM, pcbuf, 2) != 2)
+        {
+          *reason = BDM12_POLLING;
+          return;
+        }
+      pc = (pcbuf[0] << 8) + pcbuf[1];
+      if (pc == breakpoint[0])
+        {
+          *reason = BDM12_STOPPED;
+          *sigrc = TARGET_SIGNAL_TRAP;
+          return;
+        }
+      if ((num_breakpoints == 2) && (pc == breakpoint[1]))
+        {
+          *reason = BDM12_STOPPED;
+          *sigrc = TARGET_SIGNAL_TRAP;
+          return;
+        }
+    }
+
+  if (stopped)
+    {
+      *reason = BDM12_STOPPED;
+      *sigrc = TARGET_SIGNAL_INT;
+      return;
+    }
+  if (singlestepped)
+    {
+      *reason = BDM12_STOPPED;
+      *sigrc = TARGET_SIGNAL_TRAP;
+      return;
+    }
+
+  /* don't know why we stopped */
+  *reason = BDM12_POLLING;
+  return;
+}
+
+static int
+valid_write_range (CORE_ADDR start_addr, CORE_ADDR end_addr)
+{
+  if (((start_addr >= reg_base && start_addr < (reg_base + BDM12_SIZE_REG)) &&
+       (end_addr >= reg_base && end_addr < (reg_base + BDM12_SIZE_RAM))) ||
+      ((start_addr >= ram_base && start_addr < (ram_base + BDM12_SIZE_RAM)) &&
+       (end_addr >= ram_base && end_addr < (ram_base + BDM12_SIZE_RAM))))
+    return 1;
+
+  return 0;
+}
+
+/* Read memory from the target. */
+
+int
+bdm12_read (CORE_ADDR memaddr, unsigned char *buf, int len)
+{
+  unsigned char cmdbuf[6], *recvbuf;
+  unsigned int numread = 0;
+  int need_final_read = 0;
+
+  if (!valid_read_range (memaddr, memaddr + len - 1) || len < 0)
+    return 0;
+
+  if (len == 0)
+    return 0;
+
+  recvbuf = alloca (len);
+  if (!recvbuf)
+    return 0;
+
+  if (memaddr & 0x1)
+    {
+      cmdbuf[0] = BDM12_CMD_READ_BYTE;
+      cmdbuf[1] = memaddr >> 8;
+      cmdbuf[2] = memaddr;
+      if (bdm12_put_packet (cmdbuf, 3))
+        return numread;
+      if (bdm12_get_packet (recvbuf, 2))
+        return numread;
+      *(buf++) = recvbuf[1];
+      len--;
+      numread++;
+      memaddr++;
+    }
+
+  if (len & 0x1)
+    {
+      need_final_read = 1;
+      len--;
+    }
+
+  if (len)
+    {
+      cmdbuf[0] = BDM12_CMD_EXT;
+      cmdbuf[1] = BDM12_CMD_EXT_MEMDUMP;
+      cmdbuf[2] = memaddr >> 8;
+      cmdbuf[3] = memaddr ;
+      cmdbuf[4] = (len / 2) >> 8;
+      cmdbuf[5] = (len / 2);
+      if (bdm12_put_packet (cmdbuf, 6))
+        return numread;
+      if (bdm12_get_packet (recvbuf, len))
+        return numread;
+      memcpy (buf, recvbuf, len);
+      buf += len;
+      numread += len;
+      memaddr += len;
+    }
+
+  if (need_final_read)
+    {
+      cmdbuf[0] = BDM12_CMD_READ_BYTE;
+      cmdbuf[1] = memaddr >> 8;
+      cmdbuf[2] = memaddr;
+      if (bdm12_put_packet (cmdbuf, 3))
+        return numread;
+      if (bdm12_get_packet (recvbuf, 2))
+        return numread;
+      *(buf++) = recvbuf[0];
+      numread++;
+    }
+
+  return numread;
+}
+
+static int
+valid_read_range (CORE_ADDR start_addr, CORE_ADDR end_addr)
+{
+  if (((start_addr >= reg_base && start_addr < (reg_base + BDM12_SIZE_REG)) &&
+       (end_addr >= reg_base && end_addr < (reg_base + BDM12_SIZE_REG))) ||
+      ((start_addr >= ram_base && start_addr < (ram_base + BDM12_SIZE_RAM)) &&
+       (end_addr >= ram_base && end_addr < (ram_base + BDM12_SIZE_RAM))) ||
+      ((start_addr >= eeprom_base && start_addr < (eeprom_base + BDM12_SIZE_EEPROM)) &&
+       (end_addr >= eeprom_base && end_addr < (eeprom_base + BDM12_SIZE_EEPROM))) ||
+      ((start_addr >= flash_base && start_addr < (flash_base + BDM12_SIZE_FLASH)) &&
+       (end_addr >= flash_base && end_addr < (flash_base + BDM12_SIZE_FLASH))))
+    return 1;
+
+  return 0;
+}
+
+/* Send a packet to the BDM12 pod. This is basically copied from Kevin's
+   BDM12 User Manual */
+
+static int
+bdm12_put_packet (unsigned char *packet, int len)
+{
+  int i, iloop;
+  struct timeval start_time, cur_time;
+
+  for (i = 0; i < len; i++)
+    {
+      write_rts_state (1);
+
+      iloop = 5;
+      gettimeofday (&start_time, NULL);
+      cur_time = start_time;
+      while ((diffms (start_time, cur_time) < BDM12_COMM_TIMEOUT) || iloop)
+        {
+          if (read_cts_state ())
+            break;
+
+          write_rts_state (0);
+          gettimeofday (&cur_time, NULL);
+          if (iloop)
+            --iloop;
+
+          write_rts_state (1);
+        }
+      if (!read_cts_state ())
+        {
+          error ("bdm12_put_packet RTS1->CTS1: Couldn't communicate with BDM12 pod");
+          return 1;
+        }
+
+      if (serial_write (ser_desc, packet, 1))
+        {
+          write_rts_state (0);
+          perror_with_name ("bdm12_put_packet");
+          return 1;
+        }
+
+      iloop = 5;
+      gettimeofday (&start_time, NULL);
+      cur_time = start_time;
+      while ((diffms (start_time, cur_time) < BDM12_COMM_TIMEOUT) || iloop)
+        {
+          if (!read_cts_state ())
+            break;
+
+          gettimeofday (&cur_time, NULL);
+          if (iloop)
+            --iloop;
+
+        }
+      write_rts_state (0);
+      if (read_cts_state ())
+        {
+          error ("bdm12_put_packet RTS0->CTS0: Couldn't communicate with BDM12 pod");
+          return 1;
+        }
+      packet++;
+    }
+  return 0;
+}
+
+/* Raise or lower the RTS line (clear if state==0, set otherwise). This is
+   also based on code from Kevin's BDM12 User's Manual. */
+
+static void 
+write_rts_state (int state)
+{
+  
+#if defined(__CYGWIN32__) || defined(__MINGW32__)
+  EscapeCommFunction (win_ser_desc, state ? SETRTS : CLRRTS);
+#else
+  struct timeval start_time, cur_time;
+
+  int tiocm = TIOCM_RTS;
+  ioctl (ser_desc->fd, state ? TIOCMBIS : TIOCMBIC, &tiocm);
+  
+  gettimeofday (&start_time, NULL);
+  cur_time = start_time;
+  while ((diffms (start_time, cur_time) < BDM12_RTS_DELAY))
+    {
+      gettimeofday (&cur_time, NULL);
+    }
+#endif
+}
+
+/* Return the state of the CTS line (0 if clear, 1 if set). This is also
+   based on code from Kevin's BDM12 User's Manual. */
+
+static int
+read_cts_state (void)
+{
+#if defined(__CYGWIN32__) || defined(__MINGW32__)
+  DWORD cts_state;
+  GetCommModemStatus (win_ser_desc, &cts_state);
+  return (cts_state & MS_CTS_ON) ? 1 : 0;
+#else
+  /* assuming UNIX - if not, add your own #elseif above */
+  unsigned int cts_state;
+  ioctl (ser_desc->fd, TIOCMGET, &cts_state);
+  return (cts_state & TIOCM_CTS) ? 1 : 0;
+#endif
+}
+
+/* take the difference of t2 - t1 in milliseconds */
+
+static long
+diffms (struct timeval t1, struct timeval t2)
+{
+  long diffsec, diffusec;
+
+  diffsec = t2.tv_sec - t1.tv_sec;
+  diffusec = t2.tv_usec - t1.tv_usec;
+
+  if (diffusec < 0)
+    {
+      diffsec--;
+      diffusec += 1000000;
+    }
+
+  return (diffsec * 1000) + (diffusec / 1000);
+}
+
+/* Get a packet from the BDM12.  Timeout is only enforced for the
+   first byte of the packet.  Subsequent bytes are expected to arrive in
+   time <= remote_timeout.  Returns a pointer to a static buffer containing
+   the payload of the packet.  *LENP contains the length of the packet.
+ */
+
+static int bdm12_get_packet (unsigned char *packet, int pktlen)
+{
+  int i, ch;
+
+  for (i = 0; i < pktlen; i++)
+    {
+      ch = serial_readchar (ser_desc, BDM12_COMM_TIMEOUT);
+      switch (ch)
+        {
+        case SERIAL_EOF:
+          error ("Remote connection closed");
+          return 1;
+          break;
+        case SERIAL_ERROR:
+          perror_with_name ("bdm12_get_packet");
+          return 1;
+          break;
+        case SERIAL_TIMEOUT:
+          error ("Remote connection timed out");
+          return 1;
+          break;
+        default:
+          *(packet++) = ch;
+          break;
+        }
+    }
+  return 0;
+}
+
+/* All we actually do is set the PC to the start address of exec_bfd, and start
+   the program at that point.  */
+
+/* load a program into target memory, the bfd struct is not used here */
+
+BDM12_RC
+bdm12_load (char *prog, struct _bfd *abfd, int from_tty)
+{
+  generic_load (prog, from_tty);
+
+  program_loaded = 1;
+/* This is necessary because many things were based on the PC at the time that
+   we attached to the monitor, which is no longer valid now that we have loaded
+   new code (and just changed the PC).  Another way to do this might be to call
+   normal_stop, except that the stack may not be valid, and things would get
+   horribly confused... */
+
+  clear_symtab_users ();
+  return BDM12_RC_OK;
+}
+
+BDM12_RC
+bdm12_set_breakpoint (CORE_ADDR addr)
+{
+  unsigned char buf[5];
+
+  if (num_breakpoints >= BDM12_MAX_BREAKPOINTS)
+    {
+      error ("Maximum breakpoints have already been set");
+      return BDM12_RC_INSUFFICIENT_RESOURCES;
+    }
+
+  if (num_breakpoints == 0)
+    buf[2] = BDM12_REG_BRKAH;
+  else
+    buf[2] = BDM12_REG_BRKDH;
+
+  buf[0] = BDM12_CMD_WRITE_WORD;
+  buf[1] = reg_page;
+  buf[3] = addr >> 8;
+  buf[4] = addr;
+  if (bdm12_put_packet (buf, 5))
+    return BDM12_RC_FAIL;
+  breakpoint[num_breakpoints] = addr;
+  num_breakpoints++;
+  return BDM12_RC_OK;
+}
+
+BDM12_RC
+bdm12_clear_breakpoint (CORE_ADDR addr)
+{
+  unsigned char buf[5];
+  if (breakpoint[0] == addr)
+    {
+      buf[2] = BDM12_REG_BRKAH;
+      breakpoint[0] = 0;
+    }
+  else if (breakpoint[1] == addr)
+    {
+      buf[2] = BDM12_REG_BRKDH;
+      breakpoint[1] = 0;
+    }
+  else
+    {
+       error ("breakpoint doesn't exist");
+       return BDM12_RC_UNKNOWN_BREAKPOINT;
+    }
+
+  buf[0] = BDM12_CMD_WRITE_WORD;
+  buf[1] = reg_page;
+  buf[3] = 0;
+  buf[4] = 0;
+  if (bdm12_put_packet (buf, 5))
+    return BDM12_RC_FAIL;
+
+  num_breakpoints--;
+  return BDM12_RC_OK;
+}
+
+
+void
+_initialize_bdm12 (void)
+{
+  flash_regions.next = NULL;
+  flash_regions.prev = NULL;
+  flash_regions.data = NULL;
+  flash_regions.size = 0;
+}
+
+#if 0
+/* maybe I should do something like this - later*/
+void _initialize_remote_ocd (void)
+{
+  extern struct cmd_list_element *cmdlist;
+  static struct cmd_list_element *ocd_cmd_list = NULL;
+
+  add_show_from_set (add_set_cmd ("remotetimeout", no_class,
+                                  var_integer, (char *) &remote_timeout,
+                     "Set timeout value for remote read.\n", &setlist),
+                     &showlist);
+
+  add_prefix_cmd ("ocd", class_obscure, bdm_command, "", &ocd_cmd_list, "ocd ",
+                   0, &cmdlist);
+
+  add_cmd ("reset", class_obscure, bdm_reset_command, "", &ocd_cmd_list);
+  add_cmd ("restart", class_obscure, bdm_restart_command, "", &ocd_cmd_list);
+  add_cmd ("update-flash", class_obscure, bdm_update_flash_command, "", &ocd_cmd_list);
+}
+#endif
+
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/bdm12.h gdb-6.4-m68hc1x/gdb/bdm12.h
--- gdb-6.4/gdb/bdm12.h	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/bdm12.h	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,289 @@
+/* This file defines the interface between the BDM12 target and gdb.
+   Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+   Contributed by Tim Housel (thousel@usa.net)
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* This is basically  */
+#if !defined (BDM12_H)
+#define BDM12_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef REGISTER_BDM12_REGNO
+#define REGISTER_BDM12_REGNO(N) (N)
+#endif
+
+/* Return codes from various functions.  */
+
+typedef enum {
+  BDM12_RC_FAIL = 0,
+  BDM12_RC_OK = 1,
+  BDM12_RC_UNKNOWN_BREAKPOINT = 2,
+  BDM12_RC_INSUFFICIENT_RESOURCES = 3,
+  BDM12_RC_DUPLICATE_BREAKPOINT = 4
+} BDM12_RC;
+
+/* these defines were pulled from Stephane's code in
+   m68hc11-tdep.c */  
+
+#define HARD_X_REGNUM        0
+#define HARD_D_REGNUM        1
+#define HARD_Y_REGNUM        2
+#define HARD_SP_REGNUM       3
+#define HARD_PC_REGNUM       4
+#define HARD_A_REGNUM        5
+#define HARD_B_REGNUM        6
+#define HARD_PSW_REGNUM      7
+
+/* commands for the BDM12 pod */
+
+typedef enum {
+  BDM12_CMD_SYNC = 0x0,
+  BDM12_CMD_RESET = 0x1,
+  BDM12_CMD_EXT = 0x4,
+  BDM12_CMD_EXT_MEMDUMP = 0x3,
+  BDM12_CMD_EXT_SETPARAM = 0x4,
+  BDM12_CMD_EXT_MEMPUT = 0x6,
+  BDM12_CMD_EEPROM_WRITE = 0x5,
+  BDM12_CMD_SET_REGBASE = 0x6,
+  BDM12_CMD_EEPROM_ERASE = 0x7,
+  BDM12_CMD_BACKGROUND = 0x90,
+  BDM12_CMD_READ_BD_BYTE = 0xe4,
+  BDM12_CMD_READ_BD_WORD = 0xec,
+  BDM12_CMD_READ_WORD = 0xe8,
+  BDM12_CMD_READ_BYTE = 0xe0,
+  BDM12_CMD_WRITE_BD_BYTE = 0xc4,
+  BDM12_CMD_WRITE_BD_WORD = 0xcc,
+  BDM12_CMD_WRITE_WORD = 0xc8,
+  BDM12_CMD_WRITE_BYTE = 0xc0,
+  BDM12_CMD_READ_NEXT = 0x62,
+  BDM12_CMD_READ_PC = 0x63,
+  BDM12_CMD_READ_D = 0x64,
+  BDM12_CMD_READ_X = 0x65,
+  BDM12_CMD_READ_Y = 0x66,
+  BDM12_CMD_READ_SP = 0x67,
+  BDM12_CMD_WRITE_NEXT = 0x42,
+  BDM12_CMD_WRITE_PC = 0x43,
+  BDM12_CMD_WRITE_D = 0x44,
+  BDM12_CMD_WRITE_X = 0x45,
+  BDM12_CMD_WRITE_Y = 0x46,
+  BDM12_CMD_WRITE_SP = 0x47,
+  BDM12_CMD_GO = 0x8,
+  BDM12_CMD_TRACE1 = 0x10,
+  BDM12_CMD_TAGGO = 0x18
+} BDM12_CMD;  
+
+/* e-clock rates as required by the BDM12 pod */
+
+typedef enum {
+  BDM12_ECLOCK_1MHZ = 0x0,
+  BDM12_ECLOCK_2MHZ = 0x1,
+  BDM12_ECLOCK_4MHZ = 0x2,
+  BDM12_ECLOCK_8MHZ = 0x3
+} BDM12_ECLOCK;
+
+/* misc stuff used to avoid magic constants */
+
+typedef enum {
+  BDM12_BDM_HI = 0xff,
+  BDM12_ENABLE_BDM_LO = 0x01,
+  BDM12_CCRSAV_BDM_LO = 0x06,
+  BDM12_REG_INITRG = 0x11,
+  BDM12_REG_INITRM = 0x10,
+  BDM12_REG_INITEE = 0x12,
+  BDM12_REG_MISC = 0x13,
+  BDM12_REG_BRKCT0 = 0x20,
+  BDM12_REG_BRKCT1 = 0x21,
+  BDM12_REG_BRKAH = 0x22,
+  BDM12_REG_BRKAL = 0x23,
+  BDM12_REG_BRKDH = 0x24,
+  BDM12_REG_BRKDL = 0x25,
+  BDM12_REG_FEEMCR = 0xf5,
+  BDM12_SIZE_REG = 512,
+  BDM12_SIZE_RAM = 1024,
+  BDM12_SIZE_EEPROM = 768,
+  BDM12_SIZE_FLASH = 32768,
+  BDM12_INIT_ENABLE_BDM = 0x80,
+  BDM12_INIT_BRKCT0 = 0xec,
+  BDM12_INIT_BRKCT1 = 0x40,
+  BDM12_INIT_FEEMCR = 0x0,
+  BDM12_STATUS_STOPPED = 0x40,
+  BDM12_MAX_BREAKPOINTS = 2,
+  BDM12_BAUD_RATE = 115200,
+  BDM12_COMM_TIMEOUT = 1, /* 1s timeout for serial ops */
+  BDM12_ERASEFLASH_TIMEOUT = 1000, /* 200 ms timeout for flash erase program */
+  BDM12_PROGRAMFLASH_TIMEOUT = 3 /* 3 ms/byte  timeout for flash burn program */
+} BDM12_MISC;
+  
+/* The bfd struct, as an opaque type.  */
+
+struct _bfd;
+
+
+/* Main bdm12 entry points.  */
+
+
+/* Create a fully initialized bdm12 instance.
+
+   (This function is called when the bdm12 target is selected from the
+   gdb command line.)
+
+   ARGV is a standard ARGV pointer such as that passed from the
+   command line.  The syntax of the argument list is is assumed to be
+   ``BDM12 { BDM12-OPTION }''.
+
+   While the bdm12 configuration can be parameterized by (in decreasing
+   precedence) ARGV's BDM12-OPTION and the ABFD argument, the
+   successful creation of the bdm12 target shall not be dependent on the
+   presence of any of these arguments/options. */
+
+
+extern BDM12_RC bdm12_open (char **argv);
+
+
+/* Destory a bdm12 instance.
+
+   QUITTING is non-zero if we cannot hang on errors.
+*/
+
+extern void bdm12_close (int quitting);
+
+
+/* Load program PROG into the target memory.
+
+   If ABFD is non-NULL, the bfd for the file has already been opened.
+   The result is a return code indicating success. */
+
+extern BDM12_RC bdm12_load (char *prog, struct _bfd *abfd, int from_tty);
+
+
+/* Prepare to run the program.
+
+   ABFD, if not NULL, provides initial processor state information.
+   ARGV and ENV, if non NULL, are NULL terminated lists of pointers.
+
+   This function shall initialize the processor
+   registers to a known value.  The program counter and possibly stack
+   pointer shall be set using information obtained from ABFD (or
+   hardware reset defaults).  ARGV and ENV, dependant on the target
+   ABI, may be written to memory. */
+
+extern BDM12_RC bdm12_create_inferior (bfd *abfd, char **argv, char **env);
+
+
+/* Fetch LENGTH bytes of the target's memory.  Start fetch
+   at virtual address MEM and store in BUF.  Result is number of bytes
+   read, or zero if error.  */
+
+extern int bdm12_read (CORE_ADDR mem, unsigned char *buf, int length);
+
+
+/* Store LENGTH bytes from BUF into the target's
+   memory. Store bytes starting at virtual address MEM. Result is
+   number of bytes write, or zero if error.  */
+
+extern int bdm12_write (CORE_ADDR mem, unsigned char *buf, int length);
+
+
+/* Fetch register REGNO storing its raw (target endian) value in the
+   LENGTH byte buffer BUF.  Return the actual size of the register or
+   zero if REGNO is not applicable.
+
+   Legacy implementations ignore LENGTH and always return -1.
+
+   If LENGTH does not match the size of REGNO no data is transfered
+   (the actual register size is still returned). */
+
+extern int bdm12_fetch_register (int regno, unsigned char *buf, int length);
+
+
+/* Store register REGNO from the raw (target endian) value in BUF.
+   Return the actual size of the register or zero if REGNO is not
+   applicable.
+
+   Legacy implementations ignore LENGTH and always return -1.
+
+   If LENGTH does not match the size of REGNO no data is transfered
+   (the actual register size is still returned). */
+
+extern int bdm12_store_register (int regno, unsigned char *buf, int length);
+
+
+/* Run (or resume) the program.
+
+   STEP, when non-zero indicates that only a single instruction
+   should be executed. */
+
+extern int bdm12_resume (int step);
+
+
+/* Asynchronous request to stop execution.
+   A nonzero return indicates that the target is able to handle
+   the request */
+
+extern int bdm12_stop (void);
+
+
+/* Fetch the REASON why the program stopped.
+
+   BDM12_EXITED: The program has terminated. SIGRC indicates the target
+   dependant exit status.
+
+   BDM12_STOPPED: The program has stopped.  SIGRC uses the host's signal
+   numbering as a way of identifying the reaon: program interrupted by
+   user via a bdm12_stop request (SIGINT); a breakpoint instruction
+   (SIGTRAP); a completed single step (SIGTRAP); an internal error
+   condition (SIGABRT); an illegal instruction (SIGILL); Access to an
+   undefined memory region (SIGSEGV); Mis-aligned memory access
+   (SIGBUS).  For some signals information in addition to the signal
+   number may be retained by the target (e.g. offending address);
+   that information is not directly accessable via this interface.
+
+   BDM12_SIGNALLED: The program has been terminated by a signal. The
+   target has encountered code that causes the the program
+   to exit with signal SIGRC.
+
+   BDM12_RUNNING, BDM12_POLLING: The return of one of these values
+   indicates a problem internal to the BDM12 interface. */
+
+enum bdm12_stop { BDM12_RUNNING, BDM12_POLLING, BDM12_EXITED, BDM12_STOPPED, BDM12_SIGNALLED };
+
+extern void bdm12_stop_reason (enum bdm12_stop *reason, int *sigrc);
+
+#if 0
+/* implement later */
+/* Passthru for other commands that the bdm12 interface might support.
+   The interface should be prepared to deal with any combination of NULL
+   or empty CMD. */
+
+void bdm12_do_command PARAMS ((char *cmd));
+
+#endif
+
+/* Call these functions to set and clear breakpoints at ADDR. */
+
+extern BDM12_RC bdm12_set_breakpoint (CORE_ADDR addr);
+extern BDM12_RC bdm12_clear_breakpoint (CORE_ADDR addr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !defined (BDM12_H) */
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/bdm12_eraseflash.h gdb-6.4-m68hc1x/gdb/bdm12_eraseflash.h
--- gdb-6.4/gdb/bdm12_eraseflash.h	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/bdm12_eraseflash.h	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,249 @@
+#define BDM12_ERASEFLASH_SIZE 208
+#define BDM12_ERASEFLASH_FLASHSTART 0
+#define BDM12_ERASEFLASH_REGSTART 2
+#define BDM12_ERASEFLASH_ERRORFLAG 9
+#define BDM12_ERASEFLASH_PROGSTART 10
+
+unsigned char eraseflash[BDM12_ERASEFLASH_SIZE] = {
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+ 0x00, 0x01, 0x1B, 0xD4, 0x14, 0x10, 0xEE, 0xF2, 
+ 0x00, 0x00, 0x69, 0xF2, 0x00, 0x06, 0x69, 0xF2, 
+ 0x00, 0x07, 0x69, 0xF2, 0x00, 0x08, 0xED, 0xF2, 
+ 0x00, 0x02, 0x0F, 0xE8, 0xF7, 0x08, 0x74, 0x19, 
+ 0xE8, 0xF7, 0x18, 0x08, 0x40, 0x06, 0x6C, 0x00, 
+ 0xED, 0xF2, 0x00, 0x02, 0x0C, 0xE8, 0xF7, 0x01, 
+ 0x19, 0xC6, 0x6D, 0xF2, 0x00, 0x04, 0x20, 0x7B, 
+ 0xED, 0xF2, 0x00, 0x02, 0x0D, 0xE8, 0xF7, 0x01, 
+ 0x19, 0xC6, 0x6D, 0xF2, 0x00, 0x04, 0x20, 0x6B, 
+ 0xE7, 0xF2, 0x00, 0x07, 0x27, 0x1E, 0x63, 0xF2, 
+ 0x00, 0x06, 0x26, 0xD4, 0x19, 0xC6, 0x6D, 0xF2, 
+ 0x00, 0x04, 0x20, 0x38, 0xE7, 0xF2, 0x00, 0x08, 
+ 0x27, 0x31, 0xED, 0xF2, 0x00, 0x02, 0x0D, 0xE8, 
+ 0xF7, 0x06, 0x20, 0x22, 0x62, 0xF2, 0x00, 0x06, 
+ 0x19, 0xC6, 0x6D, 0xF2, 0x00, 0x04, 0x20, 0x1C, 
+ 0xE7, 0xF2, 0x00, 0x08, 0x26, 0x0A, 0xE6, 0xF2, 
+ 0x00, 0x06, 0xC1, 0x05, 0x23, 0xA2, 0x20, 0x0B, 
+ 0x62, 0xF2, 0x00, 0x07, 0x20, 0x9A, 0x69, 0xF2, 
+ 0x00, 0x09, 0x00, 0x00, 0x69, 0xF2, 0x00, 0x08, 
+ 0xCD, 0x3C, 0x00, 0xEE, 0xF2, 0x00, 0x00, 0xCC, 
+ 0xFF, 0xFF, 0xAC, 0x31, 0x26, 0x07, 0x04, 0x36, 
+ 0xF9, 0x62, 0xF2, 0x00, 0x08, 0xED, 0xF2, 0x00, 
+ 0x04, 0x05, 0x40, 0xCC, 0x00, 0x0A, 0x20, 0x00, 
+ 0xCE, 0x07, 0xD0, 0xA7, 0x04, 0x35, 0xFC, 0x04, 
+ 0x34, 0xF6, 0xED, 0xF2, 0x00, 0x04, 0x05, 0x40 };
+/* The above was produced by assembling the following program with
+   > m6812-elf-as -o bdm12_eraseflash.o bdm12_eraseflash.s
+   > m6812-elf-objcopy.exe --change-addresses 0x800 -O srec bdm12_eraseflash.o
+     bdm12_eraseflash.s19
+   > ./convert < bdm12_eraseflash.s19 > bdm12_eraseflash.h
+
+   convert.c is listed following the assembly
+
+;-------------------bdm12_eraseflash.s-------------------
+;--------------------------------------------------------
+;--- Application Note Source Code for AN1836 ---
+;--- Erasing and Programming the FLASH ---
+;--- EEPROM on the MC68HC912B32 ---
+;--- ---
+;--- FLASH EEPROM erase routine ---
+;--- MC68HC912B32 1.5T FLASH Module ---
+;--- ---
+;--- Rev. 1.2 February 9, 2000 ---
+;--- Fixed bug in ReadArray routine ---
+;--- Created Bit Name Labels for easier reading ---
+;--- Streamlined Code for efficiency ---
+;--- Rev. 1.1 January 11, 2000 ---
+;--- Changed to 10ms delay for tepulse ---
+;--- to match specification change ---
+;--- Rev. 1.0 April 16, 1998 ---
+;--- Changed to 100ms delay for tepulse ---
+;--- Written November 6, 1997 ---
+;--- ---
+;--- ASSEMBLER: IASM12 v. 3.06 ---
+;--- P & E Microcomputer Systems ---
+;--- ---
+;--- by Matt Ruff, BE/OS Systems Engineering ---
+;--- ---
+;--- This code is intended for instructional use ---
+;--- only. Motorola assumes no liability for use ---
+;--- or modification of this code. It is the ---
+;--- responsibility of the user to verify all ---
+;--- parameters, variables, timings, etc. ---
+;--- ---
+;--------------------------------------------------------
+;----------------------------- Equates -----------------------------
+
+TmpStorage:
+FLASHStart:	.word 0x8000		;FLASH Start address
+REGStart:	.word 0x0		;Register Start Address
+SavePC:		.word 0x0		;saved PC
+Nep:		.byte 0			;Number of programming pulses applied
+MarginFlag:	.byte 0			;Programming margin flag
+ErasedFlag:	.byte 0			;Array Erased Flag
+ErrorFlag:	.byte 1			;Error Flag
+		.equ FLASHSize, 0x8000
+		.equ BootBlkSize, 0x800	;Size of the boot block
+		.equ BCFEEWords, ((FLASHSize-BootBlkSize)/2)
+				;Num of words to blank check
+		.equ MaxNep, 5		;5 pulses maximum
+		.equ FEELCK, 0xF4	;FLASH Lock Control Register
+		.equ FEEMCR, 0xF5	;FLASH Module Configuration Register
+		.equ FEECTL, 0xF7	;FLASH Control Register
+		.equ LOCK, 0x01		;Lock register Bit in FEELCK
+		.equ BOOTP, 0x01	;Boot Protect Bit in FEEMCR
+		.equ SVFP, 0x08		;Status Vfp Voltage Bit in FEECTL
+		.equ ERAS, 0x04		;Erase Control Bit in FEECTL
+		.equ LAT, 0x02		;Programming Latch Control bit in FEECTL
+		.equ ENPE, 0x01		;Enable Program/Erase Voltage Bit in FEECTL
+		.equ Mult, 1000		;Multiplier for EClock, assembler won't do
+					; values over 2^16
+		.equ EClock,(Mult*8000)	;E-clock frequency in Hz.
+		.equ mS1LoopTime, 4	;Num of clock cycles per loop.
+		.equ mS1Delay, (EClock/(mS1LoopTime*1000))
+					;Factor of 1000 used for base time of 1 ms.
+
+Start:
+		LEAS TmpStorage,PC
+		SEI			;disable interrupts - no SP
+		LDX FLASHStart,SP
+		CLR Nep,SP		;Clear number of pulses
+		CLR MarginFlag,SP	;Clear margin flag
+		CLR ErasedFlag,SP	;Clear erased flag
+		LDY REGStart,SP
+		BRCLR FEECTL,Y, SVFP,Error
+					;If Vfp not present, output an error
+;- Step 2 -
+		LEAY FEECTL,Y
+		MOVB #ERAS|LAT, 0,Y
+					;Set ERAS and LAT in FEECTL ( | is bitwise or)
+;- Step 3 -
+		STD 0,X			;Write some data to a valid FLASH address
+;- Step 4 -
+STEP4:
+		LDY REGStart,SP
+		BSET FEECTL,Y, ENPE	;Apply erase voltage (Set ENPE)
+;- Step 5 -
+		LEAY 6,PC
+		STY SavePC,SP
+		BRA dly_10ms		;Delay time for erase pulse (Tepulse)
+		
+;- Step 6 -
+		LDY REGStart,SP
+		BCLR FEECTL,Y, ENPE	;Remove erase voltage (Clear ENPE)
+;- Step 7 -
+		LEAY 6,PC
+		STY SavePC,SP
+		BRA dly_10ms		;Delay for high voltage turn off (Tverase)
+		TST MarginFlag,SP	;Is margin flag set??
+					; (TST sets Z bit in CCR if MarginFlag is 0)
+		BEQ NoFlag		;If not, go bump counter and check data
+					; (BEQ branches if MarginFlag is 0)
+YesFlag:
+		DEC Nep,SP		;Decrement Nep - mod. Z bit in CCR for coming
+					; BNE branch
+		BNE STEP4		;If Nep not 0, go to Step 4
+		LEAY 6,PC
+		STY SavePC,SP
+		BRA ReadArray		;Verify entire array is erased
+		TST ErasedFlag,SP	;Is the array erased?
+					; (TST sets Z bit in CCR if ErasedFlag is 0)
+		BEQ Error		;If not, Erase failed, output an error
+					; (BEQ branches if ErasedFlag is 0)
+;- Step 10 -
+		LDY REGStart,SP
+		BCLR FEECTL,Y, ERAS|LAT
+					;Clear ERAS and LAT in FEECTL
+		BRA Done		;If so, quit.
+NoFlag:
+		INC Nep,SP		;Increment number of erase pulses applied
+		LEAY 6,PC
+		STY SavePC,SP
+		BRA ReadArray		;Verify entire array is erased
+		TST ErasedFlag,SP	;Is it erased?
+					; (TST sets Z bit in CCR if ErasedFlag is 0)
+		BNE SetMarginFlag	;If so, set margin flag
+					; (BNE branches if ErasedFlag is 1)
+		LDAB Nep,SP
+		CMPB #MaxNep		;Have we applied max number of pulses?
+		BLS STEP4		;If not, continue erasing
+		BRA Error		;If so, we have a problem
+SetMarginFlag:
+		INC MarginFlag,SP	;Set Margin Flag
+		BRA STEP4
+Done:
+                CLR ErrorFlag,SP
+		BGND
+Error:
+		BGND
+;-----------------------------------------------------------------------
+;----------------- Read and Verify Erase subroutine ----------------
+;-----------------------------------------------------------------------
+ReadArray:
+		CLR ErasedFlag,SP	; Always start with clear flag.
+		LDY #BCFEEWords		; Num of words to check in FLASH. (No boot
+					; block check)
+		LDX FLASHStart,SP	; Index to the start of FLASH.
+		LDD #0xFFFF		; Erased word value for comparison.
+CheckLoop:
+		CPD 2,X+		; Is word erased?
+		BNE VerifyBad		; If not, return without setting ErasedFlag.
+					; (failure)
+		DBNE Y,CheckLoop	; Yes, Dec the word count, if not done check
+					; the next word.
+		INC ErasedFlag,SP	; All words checked & are erased. Set
+					; ErasedFlag.
+VerifyBad:
+		LDY SavePC,SP
+		JMP 0,Y
+;-----------------------------------------------------------------------
+;---------------------- Delay Subroutines -----------------------
+;-----------------------------------------------------------------------
+dly_10ms:
+		LDD #10 ;Delay for 10ms
+		BRA DelaymS
+
+;-----------------------------------------------------------------------
+;--- Millisecond Delay Routine ---
+;--- ---
+;--- Call with the number of mS to delay in the D accumulator. ---
+;--- The delay is not exact, but close enough when delaying ms. ---
+;-----------------------------------------------------------------------
+DelaymS:
+DlyLoop1mS:
+		LDX #mS1Delay		;Load 1ms delay count into X
+DlyLoop:
+		NOP			;Decrement count
+		DBNE X,DlyLoop		;Loop until done.
+		DBNE D,DlyLoop1mS
+		LDY SavePC,SP
+		JMP 0,Y
+------------------------convert.c---------------------------------------
+#include <stdio.h>
+#include <string.h>
+main()
+{
+  char line[200];
+  char *data = line + 8;
+  int i;
+  int count = 0;
+
+  printf ("unsigned char prog[] = {\n ");
+  while (fgets (line, 200, stdin))
+    {
+      if (strncmp (line, "S1", 2) != 0)
+        continue;
+      for (i = 0; i < strlen(data) - 4; i += 2)
+        {
+          printf ("0x");
+          putchar (data[i]);
+          putchar (data[i+1]);
+          printf (", ");
+          count++;
+          if (!(count % 8))
+            printf("\n ");
+        }
+    }
+    printf(" };\n");
+    printf("#define SIZE_PROG %d\n", count);
+}
+*/
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/bdm12_programflash.h gdb-6.4-m68hc1x/gdb/bdm12_programflash.h
--- gdb-6.4/gdb/bdm12_programflash.h	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/bdm12_programflash.h	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,236 @@
+#define BDM12_PROGRAMFLASH_SIZE 207
+#define BDM12_PROGRAMFLASH_FLASHSTART 0
+#define BDM12_PROGRAMFLASH_FLASHEND 2
+#define BDM12_PROGRAMFLASH_REGSTART 4
+#define BDM12_PROGRAMFLASH_DATASTART 6
+#define BDM12_PROGRAMFLASH_NUMWRITTEN 10
+#define BDM12_PROGRAMFLASH_PROGSTART 14
+
+unsigned char programflash[BDM12_PROGRAMFLASH_SIZE] = {
+ 0x80, 0x00, 0x80, 0x02, 0x00, 0x00, 0x09, 0x00, 
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xD0, 
+ 0x14, 0x10, 0x87, 0xC7, 0x6C, 0xF2, 0x00, 0x0A, 
+ 0xEE, 0xF2, 0x00, 0x00, 0xED, 0xF2, 0x00, 0x04, 
+ 0x0E, 0xE8, 0xF7, 0x08, 0x04, 0x18, 0x20, 0x00, 
+ 0x8B, 0xED, 0xF2, 0x00, 0x06, 0x69, 0xF2, 0x00, 
+ 0x0C, 0x69, 0xF2, 0x00, 0x0D, 0x6D, 0xF2, 0x00, 
+ 0x08, 0xED, 0xF2, 0x00, 0x04, 0xC6, 0x02, 0x6B, 
+ 0xE8, 0xF7, 0xED, 0xF2, 0x00, 0x08, 0xE6, 0x40, 
+ 0x6B, 0x00, 0x6D, 0xF2, 0x00, 0x08, 0xED, 0xF2, 
+ 0x00, 0x04, 0x0C, 0xE8, 0xF7, 0x01, 0x19, 0xC2, 
+ 0x20, 0x65, 0xED, 0xF2, 0x00, 0x04, 0x0D, 0xE8, 
+ 0xF7, 0x01, 0x19, 0xC2, 0x20, 0x61, 0xED, 0xF2, 
+ 0x00, 0x08, 0xE7, 0xF2, 0x00, 0x0D, 0x27, 0x2A, 
+ 0x63, 0xF2, 0x00, 0x0C, 0xE7, 0xF2, 0x00, 0x0C, 
+ 0x26, 0xD0, 0xA6, 0x00, 0xA1, 0x40, 0x26, 0x34, 
+ 0x6D, 0xF2, 0x00, 0x08, 0xED, 0xF2, 0x00, 0x04, 
+ 0x0D, 0xE8, 0xF7, 0x02, 0xED, 0xF2, 0x00, 0x08, 
+ 0x08, 0x02, 0xAE, 0xF2, 0x00, 0x02, 0x26, 0x95, 
+ 0x20, 0x1A, 0x62, 0xF2, 0x00, 0x0C, 0xA6, 0x00, 
+ 0xA1, 0x40, 0x27, 0x0A, 0xE6, 0xF2, 0x00, 0x0C, 
+ 0xC1, 0x32, 0x23, 0x9E, 0x20, 0x06, 0x62, 0xF2, 
+ 0x00, 0x0D, 0x20, 0x96, 0xB7, 0x54, 0xA3, 0xF2, 
+ 0x00, 0x00, 0x6C, 0xF2, 0x00, 0x0A, 0x00, 0xCC, 
+ 0x00, 0x34, 0x04, 0x34, 0xFD, 0x05, 0x40, 0xCC, 
+ 0x00, 0x18, 0x04, 0x34, 0xFD, 0x05, 0x40  };
+
+/* The above was produced by assembling the following program with
+   > m6812-elf-as bdm12_programflash.s
+   > m6812-elf-objcopy.exe --change-addresses 0x800 -O srec
+     bdm12_programflash.o bdm12_programflash.s19
+   > ./convert < bdm12_programflash.s19 > bdm12_programflash.h
+
+   Convert.c is listed following the assembly
+
+;----------------bdm12_programflash.s-----------------
+;-----------------------------------------------------
+;--- Application Note Source Code for AN1836 ---
+;--- Erasing and Programming the FLASH ---
+;--- EEPROM on the MC68HC912B32 ---
+;--- ---
+;--- FLASH EEPROM program routine ---
+;--- MC68HC912B32 1.5T FLASH Module ---
+;--- ---
+;--- Rev. 1.2 February 9, 2000 ---
+;--- Created Bit Name Labels for easier reading---
+;--- Streamlined Code for efficiency ---
+;--- Rev. 1.0 - April 23,1998 ---
+;--- Fixed Tppulse = 25us and Tvprog = 10us ---
+;--- Written November 6, 1997 ---
+;--- ---
+;--- ASSEMBLER: IASM12 v. 3.06 ---
+;--- P & E Microcomputer Systems---
+;--- ---
+;--- by Matt Ruff, BE/OS Systems Engineering ---
+;--- ---
+;--- This code is intended for instructional use ---
+;--- only. Motorola assumes no liability for use ---
+;--- or modification of this code. It is the ---
+;--- responsibility of the user to verify all ---
+;--- parameters, variables, timings, etc. ---
+;--- ---
+;--------------------------------------------------------
+;------------------------------ Equates ----------------------------------
+		
+TmpStorage:
+FLASHStart:	.word 0x8000		;FLASH Start address
+FLASHEnd:	.word 0x8002		;FLASH End address (non-inclusive)
+REGStart:	.word 0x0	     	;Register Start address
+DATAStart:	.word 0x900		;Start of memory address to read from
+SaveY:		.word 0x0		;tmp storage for Y since I don't want
+					;to mess with stack
+NumWritten:	.word 0x0		;how many words have been written
+Npp:		.byte 0			;Number of programming pulses applied
+MarginFlag:	.byte 0			;Programming margin flag
+
+		.equ MaxNpp, 50		;50 pulses maximum
+		.equ FEELCK, 0xF4	;FLASH Lock Control Register
+		.equ FEEMCR, 0xF5	;FLASH Module Configuration Register
+		.equ FEECTL, 0xF7	;FLASH Control Register
+		.equ LOCK, 0x01		;Lock register Bit in FEELCK
+		.equ BOOTP, 0x01	;Boot Protect Bit in FEEMCR
+		.equ SVFP, 0x08		;Status Vfp Voltage Bit in FEECTL
+		.equ ERASE, 0x04	;Erase Control Bit in FEECTL
+		.equ LAT, 0x02		;Programming Latch Control bit in FEECTL
+		.equ ENPE, 0x01		;Enable Program/Erase Voltage Bit in FEECTL
+Start:
+                LEAS TmpStorage,PC	;Set SP to the beginning of tmp vars
+                SEI			;disable interrupts - no SP
+		CLRA
+		CLRB
+		STD NumWritten,SP	;Clear Num Bytes Written counter
+		LDX FLASHStart,SP
+		LDY REGStart,SP
+		BRSET FEECTL,Y, 8,NoError
+					;If Vfp not present, output an error
+		LBRA Done
+NoError:
+		LDY DATAStart,SP
+Loop:
+		CLR Npp,SP		;Clear number of pulses
+		CLR MarginFlag,SP	;Clear MarginFlag
+;- Step 2 -
+		STY SaveY,SP
+		LDY REGStart,SP
+		LDAB #LAT
+		STAB FEECTL,Y
+		LDY SaveY,SP
+				;Set LAT in FEECTL
+		LDAB 0,Y 	;Load from RAM
+;- Step 3 -
+		STAB 0,X	;Store in Flash
+;- Step 4 -
+STEP4:
+		STY SaveY,SP
+		LDY REGStart,SP
+		BSET FEECTL,Y,ENPE
+				;Apply programming voltage (Set ENPE)
+;- Step 5 -
+		LEAY 2,PC
+		BRA dly_22us	;Delay time for prog pulse (Tppulse)
+;- Step 6 -
+		LDY REGStart,SP
+		BCLR FEECTL,Y,ENPE
+				;Remove programming voltage (Clear ENPE)
+;- Step 7 -
+		LEAY 2,PC
+		BRA dly_10us	;Delay for high voltage turn off (Tvprog)
+		LDY SaveY,SP
+		TST MarginFlag,SP	;Is MarginFlag set??
+		BEQ NoFlag	;If not, go bump counter and check data
+YesFlag:
+		DEC Npp,SP	;Decrement Npp
+		TST Npp,SP	;Is Npp=0?
+		BNE STEP4	;If not, go to Step 4
+;- Step 9 -
+		LDAA 0,X	;Read FEEPROM location to verify programming
+		CMPA 0,Y	;Is it the same as the byte to be programmed?
+		BNE Done	;Programming failed, output an error
+;- Step 10 -
+		STY SaveY,SP
+		LDY REGStart,SP
+		BCLR FEECTL,Y,LAT	;Clear LAT in FEECTL
+		LDY SaveY,SP
+
+		INX
+		INY
+		CPX FLASHEnd,SP	;Check for end
+		BNE Loop	;If not, go back to start!
+		BRA Done	;If so, quit.
+NoFlag:
+		INC Npp,SP	;Increment number of prog pulses applied
+		LDAA 0,X	;Read FEEPROM location to verify programming
+		CMPA 0,Y	;Is it the same as the byte to be programmed?
+		BEQ SetMarginFlag
+				;If so, set the margin flag
+		LDAB Npp,SP
+		CMPB #MaxNpp	;Have we applied max number of pulses?
+		BLS STEP4	;If not, continue programming
+		BRA Done	;If so, we have a problem
+SetMarginFlag:
+		INC MarginFlag,SP	;Set MarginFlag
+		BRA STEP4
+Done:
+		TFR X, D
+		SUBD FLASHStart,SP
+		STD NumWritten,SP
+		BGND
+;-----------------------------------------------------------------------
+;---------------------- Delay Subroutines -----------------------
+;-----------------------------------------------------------------------
+;-----------------------------------------------------------------------
+;--- Microsecond Delay Routines (8MHz e clock) ---
+;--- ---
+;--- To reduce loop overhead, the following routines have been ---
+;--- optimized by counting cycle time and calculating the delay ---
+;--- based on an 8MHz system clock. ---
+;-----------------------------------------------------------------------
+dly_22us:			; Delay for about 22-23us
+; JSR or BSR is 4 cycles
+; Total delay is {4+2+(loopcount*3)+5}*125ns
+; For a loopcount of 52 yields 20.875us
+		LDD #52		; -2 cycles-
+d_22u:
+		DBNE D,d_22u	; -3 cycles-
+		JMP 0,Y
+				; -5 cycles-
+
+dly_10us:			; Delay for about 10us
+				; JSR or BSR is 4 cycles
+				; Total delay is {4+2+(loopcount*3)+5}*125ns
+				; For a loopcount of 24 yields 10.375us
+		LDD #24		; -2 cycles-
+d_10u:
+		DBNE D,d_10u	; -3 cycles-
+		JMP 0,Y
+				; -5 cycles-
+--------------------------------convert.c-------------------------------
+#include <stdio.h>
+#include <string.h>
+main()
+{
+  char line[200];
+  char *data = line + 8;
+  int i;
+  int count = 0;
+
+  printf ("unsigned char prog[] = {\n ");
+  while (fgets (line, 200, stdin))
+    {
+      if (strncmp (line, "S1", 2) != 0)
+        continue;
+      for (i = 0; i < strlen(data) - 4; i += 2)
+        {
+          printf ("0x");
+          putchar (data[i]);
+          putchar (data[i+1]);
+          printf (", ");
+          count++;
+          if (!(count % 8))
+            printf("\n ");
+        }
+    }
+    printf(" };\n");
+    printf("#define SIZE_PROG %d\n", count);
+}
+*/
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/config/m68hc11/m68hc11.mt gdb-6.4-m68hc1x/gdb/config/m68hc11/m68hc11.mt
--- gdb-6.4/gdb/config/m68hc11/m68hc11.mt	Wed Sep  3 17:02:50 2003
+++ gdb-6.4-m68hc1x/gdb/config/m68hc11/m68hc11.mt	Sat Jan 21 15:28:49 2006
@@ -1,5 +1,5 @@
 # Target: Motorola 68HC11 processor
-TDEPFILES= m68hc11-tdep.o
+TDEPFILES= m68hc11-tdep.o m68hc11-rom.o monitor.o dsrec.o remote-bdm12.o bdm12.o
 SIM_OBS= remote-sim.o
 SIM= ../sim/m68hc11/libsim.a -lm
 
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/dsrec.c gdb-6.4-m68hc1x/gdb/dsrec.c
--- gdb-6.4/gdb/dsrec.c	Sat Feb 12 01:39:18 2005
+++ gdb-6.4-m68hc1x/gdb/dsrec.c	Sat Jan 21 15:28:49 2006
@@ -49,7 +49,8 @@ static int make_srec (char *srec, CORE_A
 void
 load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
 	   int maxrecsize,
-	   int flags, int hashmark, int (*waitack) (void))
+	   int flags, int hashmark, int (*waitack) (void),
+           int (*serial_write) PARAMS ((struct serial*, char*, int)))
 {
   bfd *abfd;
   asection *s;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/m68hc11-rom.c gdb-6.4-m68hc1x/gdb/m68hc11-rom.c
--- gdb-6.4/gdb/m68hc11-rom.c	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/m68hc11-rom.c	Sat Jan 21 17:12:43 2006
@@ -0,0 +1,732 @@
+/* Remote target glue for various Motorola 68HC11/68HC12 monitors.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Stephane Carrez, stcarrez@worldnet.fr
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+
+#include "defs.h"
+#include "gdbcore.h"
+#include "target.h"
+#include "monitor.h"
+#include "serial.h"
+#include "arch-utils.h"
+#include "event-loop.h"
+#include "event-top.h"
+#include "target.h"
+#include "inferior.h"
+#include <bfd/libbfd.h>
+#include <string.h>
+#ifndef __MINGW32__
+#include <sys/poll.h>
+#endif
+
+/* Register numbers of various important registers.  */
+#define HARD_X_REGNUM 	0
+#define HARD_D_REGNUM	1
+#define HARD_Y_REGNUM   2
+#define HARD_SP_REGNUM 	3
+#define HARD_PC_REGNUM 	4
+
+#define HARD_A_REGNUM   5
+#define HARD_B_REGNUM   6
+#define HARD_CCR_REGNUM 7
+#define M68HC11_LAST_HARD_REG (HARD_CCR_REGNUM)
+#define M68HC11_NUM_REGS (8)
+
+/* Switch gdb to use the given architecture.  The architecture is
+   controlled by the monitor we are connected to, not by our program.
+   Each time we connect to the monitor, update the gdb-arch to
+   reflect the target arch.  */
+static void
+set_gdbarch (enum bfd_architecture arch, unsigned long mach)
+{
+  struct gdbarch_info info;
+  bfd abfd;
+
+  bfd_default_set_arch_mach (&abfd, arch, mach);
+
+  memset (&info, 0, sizeof info);
+  info.bfd_arch_info = bfd_get_arch_info (&abfd);
+
+  if (!gdbarch_update_p (info))
+    {
+      internal_error (__FILE__, __LINE__,
+                      "monitor: failed to select architecture");
+    }
+}
+
+/* Special write routine to send monitor commands on the serial line.
+   The 68HC11/68HC12 have a 1 character SCI input queue.  When a character
+   is sent, it is echoed by the monitor.  SCI read/write operations are
+   made in polling mode.  Due to the 1 character length, the polling
+   and the echo, a character sent by Gdb can be lost.  We pad the
+   monitor command with a \0.  If the \0 is lost we don't care and
+   otherwise it is ignored by the monitor.  */
+static int
+m68hc11_serial_write (struct serial* scb, char* str, int len)
+{
+  int result = 0;
+  
+  while (len)
+    {
+      result = serial_write (scb, str, 1);
+      str++;
+      len--;
+      if (result)
+        break;
+
+      if (str[-1] == '\r' && len == 0)
+        break;
+      
+      /* Pad with a \0.  */
+      result = serial_write (scb, "", 1);
+      if (result)
+        break;
+    }
+  return result;
+}
+
+typedef struct console
+{
+  int escaped;
+  int escape_char;
+  int pos;
+  struct serial* target;
+  char cmd[256];
+  int cmdlen;
+  int interrupt;
+} *console_t;
+
+static struct console console_data;
+
+static int
+console_input (console_t cons, char c)
+{
+  int result;
+  
+  if (cons->escaped)
+    {
+      if (c == '.')
+        cons->interrupt = 1;
+
+      cons->escaped = 0;
+      return 0;
+    }
+  if (cons->pos == 0 && cons->escape_char == c)
+    {
+      cons->escaped = 1;
+      return 0;
+    }
+
+  result = serial_write (cons->target, &c, 1);
+  return 0;
+}
+
+static void
+do_console_input (gdb_client_data d)
+{
+  char c;
+  int result;
+  
+  result = read (input_fd, &c, 1);
+  if (result == 1)
+    {
+      console_input (&console_data, c);
+    }
+}
+
+static int
+m68hc11_wait_filter (char *buf,
+		     int bufmax,
+		     int *ext_resp_len,
+		     struct target_waitstatus *status)
+{
+  char c;
+  int result;
+  extern struct serial* monitor_desc;
+  int seen_zero = 0;
+  int timeout;
+  int i, cnt;
+#ifndef __MINGW32__
+  struct pollfd fds[2];
+
+  fds[0].fd = input_fd;
+  fds[0].events = POLLIN;
+  fds[1].fd = deprecated_serial_fd (monitor_desc);
+  fds[1].events = POLLIN;
+
+  console_data.escaped = 0;
+  console_data.escape_char = '~';
+  console_data.pos = 0;
+  console_data.target = monitor_desc;
+  console_data.interrupt = 0;
+  cnt = 0;
+  timeout = -1;
+  while (1)
+    {
+      gdb_flush (gdb_stdout);
+      result = poll (fds, 2, timeout);
+      if (result > 0 && (fds[0].revents & POLLIN))
+        {
+          do_console_input (0);
+        }
+      if (result > 0 && (fds[1].revents & POLLIN))
+        {
+          while (1)
+            {
+              c = serial_readchar (monitor_desc, 0);
+              if (c == SERIAL_TIMEOUT)
+                break;
+      
+              /* For Buffalo monitor, a \0 is printed before the prompt
+                 and before the monitor output in general.  */
+              if (seen_zero && c == '>')
+                {
+                  *ext_resp_len = 0;
+                  return 0;
+                }
+
+              /* If we see a \0, keep track of the characters for some
+                 delay to have a chance to identify the monitor prompt.
+                 If the delay is too long, what we received is printed
+                 as a standard output produced by the program.  */
+              if (c == 0)
+                {
+                  seen_zero++;
+                  timeout = 1000; /* 250 ms timeout  */
+                }
+              else if (seen_zero && step_range_end == 0)
+                {
+                  if (cnt < bufmax)
+                    buf[cnt++] = c;
+                }
+              /* Don't print when doing a single step.  */
+              else if (step_range_end == 0)
+                {
+                  putchar_unfiltered (c);
+                }
+            }
+        }
+      else if (result < 0)
+        {
+          for (i = 0; i < cnt; i++)
+            putchar_unfiltered (buf[i]);
+
+          cnt = 0;
+          seen_zero = 0;
+          timeout = -1;
+        }
+    }
+#else
+  int dt;
+  
+  console_data.escaped = 0;
+  console_data.escape_char = '~';
+  console_data.pos = 0;
+  console_data.target = monitor_desc;
+  console_data.interrupt = 0;
+  cnt = 0;
+  dt = 0;
+  timeout = -1;
+  while (1)
+    {
+      gdb_flush (gdb_stdout);
+      if (_rl_input_available ())
+        {
+          do_console_input (0);
+        }
+      result = serial_readchar (monitor_desc, 10);
+      if (result == SERIAL_TIMEOUT && (timeout < 0 || dt > 0))
+        {
+          if (timeout > 0)
+            dt--;
+          continue;
+        }
+      
+      if (result != SERIAL_TIMEOUT)
+        {
+          c = result;
+          while (1)
+            {
+              /* For Buffalo monitor, a \0 is printed before the prompt
+                 and before the monitor output in general.  */
+              if (seen_zero && c == '>')
+                {
+                  *ext_resp_len = 0;
+                  return 0;
+                }
+
+              /* If we see a \0, keep track of the characters for some
+                 delay to have a chance to identify the monitor prompt.
+                 If the delay is too long, what we received is printed
+                 as a standard output produced by the program.  */
+              if (c == 0)
+                {
+                  seen_zero++;
+                  timeout = 1000; /* 250 ms timeout  */
+                }
+              else if (seen_zero && step_range_end == 0)
+                {
+                  if (cnt < bufmax)
+                    buf[cnt++] = c;
+                }
+              /* Don't print when doing a single step.  */
+              else if (step_range_end == 0)
+                {
+                  putchar_unfiltered (c);
+                }
+
+              c = serial_readchar (monitor_desc, 0);
+              if (c == SERIAL_TIMEOUT)
+                break;
+            }
+          if (timeout > 0)
+            dt = timeout / 10;
+        }
+      else
+        {
+          for (i = 0; i < cnt; i++)
+            putchar_unfiltered (buf[i]);
+
+          cnt = 0;
+          seen_zero = 0;
+          timeout = -1;
+        }
+    }
+#endif
+  return 0;
+}
+
+
+/* Buffalo 68HC11 monitor.  */
+
+static void buffalo_open (char *args, int from_tty);
+
+/* This array of registers needs to match the indexes used by GDB.  The
+   whole reason this exists is because the various ROM monitors use
+   different names than GDB does, and don't support all the registers
+   either.  So, typing "info reg sp" becomes an "S".  */
+
+static char *buffalo_regnames[M68HC11_NUM_REGS] =
+{
+  "X", NULL, "Y", "S", "P", "A", "B", "C"
+};
+
+static struct target_ops buffalo_ops;
+static struct monitor_ops buffalo_cmds;
+
+/* Initialization strings to wakeup the monitor.
+   Send both \r and \030 (^X) to abort a possible current command.  */
+static char *buffalo_inits[] = {
+  /* First command to invalidate a possible command ('~') and
+     to acknowledge the monitor after a reset ('\r').  */
+  "~\r",
+
+  /* Second command ^X to abort a possible current command
+     such as 'asm' and 'rm'.  */
+  "\030",
+  NULL
+};
+
+static int
+m68hc11_dumpregs (void)
+{
+  char buf[256];
+  int resp_len;
+  char *p;
+  char reg_d[5];
+  
+  /* Send the dump register command to the monitor and
+     get the reply.  */
+  monitor_printf ("rd\r");
+  resp_len = monitor_expect ("\r", buf, sizeof (buf));
+
+  memset (reg_d, 0, sizeof (reg_d));
+  p = buf;
+  while (p && (p[0] == '\r' || p[0] == '\n'))
+    p++;
+  
+  while (p && p[0] != '\r' && p[0] != '\n' && p[1] == '-')
+    {
+      int reg;
+      char *q;
+      
+      if (p[0] == 'P')
+        reg = HARD_PC_REGNUM;
+      else if (p[0] == 'Y')
+        reg = HARD_Y_REGNUM;
+      else if (p[0] == 'X')
+        reg = HARD_X_REGNUM;
+      else if (p[0] == 'S')
+        reg = HARD_SP_REGNUM;
+      else if (p[0] == 'C')
+        reg = HARD_CCR_REGNUM;
+      else if (p[0] == 'A')
+        reg = HARD_A_REGNUM;
+      else if (p[0] == 'B')
+        reg = HARD_B_REGNUM;
+      else
+        break;
+
+      q = &p[2];
+      p = strchr (q, ' ');
+      if (p == 0)
+        p = strchr (q, '\t');
+      if (p == 0)
+        p = strchr (q, '\n');
+      if (p)
+        *p++ = 0;
+
+      if (reg == HARD_A_REGNUM)
+        {
+          reg_d[0] = q[0];
+          reg_d[1] = q[1];
+        }
+      else if (reg == HARD_B_REGNUM)
+        {
+          reg_d[2] = q[0];
+          reg_d[3] = q[1];
+        }
+      monitor_supply_register (reg, q);
+    }
+
+  /* If we got the value of both A and B, set the value of D.  */
+  if (reg_d[0] && reg_d[2])
+    monitor_supply_register (HARD_D_REGNUM, reg_d);
+
+
+  monitor_expect (" ", 0, 0);
+  monitor_printf_noecho ("\r");
+  monitor_expect_prompt (0, 0);
+  return 0;
+}
+
+static void
+init_buffalo_cmds (void)
+{
+  buffalo_cmds.dumpregs = m68hc11_dumpregs;
+  buffalo_cmds.flags = MO_NO_ECHO_ON_OPEN | MO_GETMEM_16_BOUNDARY |
+    MO_SETMEM_INTERACTIVE | MO_SETREG_INTERACTIVE |
+    MO_CLR_BREAK_USES_ADDR | MO_GETMEM_NEEDS_RANGE | MO_FILL_USES_ADDR;
+  buffalo_cmds.init = buffalo_inits;	/* Init strings */
+  buffalo_cmds.cont = "p\r";            /* continue command */
+  buffalo_cmds.step = "t 1\r";          /* single step */
+  buffalo_cmds.stop = NULL;             /* interrupt command */
+  buffalo_cmds.set_break = "br %x\r";	/* set a breakpoint */
+  buffalo_cmds.clr_break = "br -%x\r";	/* clear a breakpoint */
+  buffalo_cmds.clr_all_break = "br -\r";	/* clear all breakpoints */
+  buffalo_cmds.fill = "bf %x %x %x\r";	/* fill (start end val) */
+  buffalo_cmds.setmem.cmdb = "mm %x\r";	/* setmem.cmdb (addr, value) */
+  buffalo_cmds.setmem.cmdw = NULL;
+  buffalo_cmds.setmem.cmdl = NULL;
+  buffalo_cmds.setmem.cmdll = NULL;	/* setmem.cmdll (addr, value) */
+  buffalo_cmds.setmem.resp_delim = "[\r\n]*[0-9a-fA-F]+ [0-9a-fA-F]+ ";
+  buffalo_cmds.setmem.term = NULL;	/* setmem.term */
+  buffalo_cmds.setmem.term_cmd = NULL;	/* setmem.term_cmd */
+  buffalo_cmds.getmem.cmdb = "md %x %x\r";	/* getmem.cmdb (addr, addr2) */
+  buffalo_cmds.getmem.cmdw = NULL;
+  buffalo_cmds.getmem.cmdl = NULL;
+  buffalo_cmds.getmem.cmdll = NULL;	/* getmem.cmdll (addr, addr2) */
+  buffalo_cmds.getmem.resp_delim = " ";	/* getmem.resp_delim */
+  buffalo_cmds.getmem.term = NULL;	/* getmem.term */
+  buffalo_cmds.getmem.term_cmd = NULL;	/* getmem.term_cmd */
+  buffalo_cmds.setreg.cmd = "rm %s\r";	/* setreg.cmd (name, value) */
+  buffalo_cmds.setreg.resp_delim =
+    "\nP.*S\\-[0-9a-fA-F]+ [\r\n]+.[PXYABCS]\\-[0-9a-fA-F]+ ";
+  buffalo_cmds.setreg.term = NULL;	/* setreg.term */
+  buffalo_cmds.setreg.term_cmd = NULL;	/* setreg.term_cmd */
+  buffalo_cmds.getreg.cmd = NULL;	/* getreg.cmd (name) */
+  buffalo_cmds.getreg.resp_delim = NULL;/* getreg.resp_delim */
+  buffalo_cmds.getreg.term = NULL;	/* getreg.term */
+  buffalo_cmds.getreg.term_cmd = NULL;	/* getreg.term_cmd */
+  buffalo_cmds.dump_registers = NULL;   /* dump_registers */
+  /* register_pattern */
+  buffalo_cmds.register_pattern = NULL;
+  buffalo_cmds.supply_register = NULL;	/* supply_register */
+  buffalo_cmds.load_routine = NULL;	/* load_routine (defaults to SRECs) */
+  buffalo_cmds.load = "load t\r";	/* download command */
+  buffalo_cmds.loadresp = NULL;	/* load response */
+  buffalo_cmds.prompt = ">";	/* monitor command prompt */
+  buffalo_cmds.line_term = "\r";	/* end-of-line terminator */
+  buffalo_cmds.cmd_end = NULL;	/* optional command terminator */
+  buffalo_cmds.target = &buffalo_ops;	/* target operations */
+  buffalo_cmds.stopbits = SERIAL_2_STOPBITS;	/* number of stop bits */
+  buffalo_cmds.regnames = buffalo_regnames;	/* registers names */
+  buffalo_cmds.magic = MONITOR_OPS_MAGIC;	/* magic */
+  buffalo_cmds.serial_write = m68hc11_serial_write;
+  buffalo_cmds.wait_filter = m68hc11_wait_filter;
+}
+
+static void
+buffalo_open (char *args, int from_tty)
+{
+  monitor_open (args, &buffalo_cmds, from_tty);
+  set_gdbarch (bfd_arch_m68hc11, 0);
+}
+
+
+/* DBug 68HC12 monitor.  */
+
+static void dbug_open (char *args, int from_tty);
+
+/* This array of registers needs to match the indexes used by GDB.  The
+   whole reason this exists is because the various ROM monitors use
+   different names than GDB does, and don't support all the registers
+   either.  So, typing "info reg sp" becomes an "S".  */
+
+static char *dbug_regnames[M68HC11_NUM_REGS] =
+{
+  "X", "D", "Y", "SP", "PC", "A", "B", "CCR"
+};
+
+static struct target_ops dbug_ops;
+static struct monitor_ops dbug_cmds;
+
+/* Initialization strings to wakeup the monitor.
+   Send both \r and \030 (^X) to abort a possible current command.  */
+static char *dbug_inits[] =
+{ "\r\030", NULL};
+
+static int
+dbug_dumpregs (void)
+{
+  char buf[256];
+  int resp_len;
+  char *p;
+  int i;
+  static int reg_list[] = {
+    HARD_PC_REGNUM,
+    HARD_SP_REGNUM,
+    HARD_X_REGNUM,
+    HARD_Y_REGNUM,
+    HARD_D_REGNUM,
+    -1
+  };
+
+  /* Send the dump register command to the monitor and
+     get the reply.  */
+  monitor_printf ("rd\r");
+  monitor_printf_noecho ("\r");
+  resp_len = monitor_expect_prompt (buf, sizeof (buf));
+
+  p = buf;
+  while (p && strncmp (p, "CCR = SXHI NZVC", 15) != 0)
+    p++;
+
+  if (p == 0)
+    {
+      return -1;
+    }
+  
+  /* Skip the CCR marker.  */
+  while (p && p[0] != '\r' && p[0] != '\n')
+    p++;
+
+  /* Skip end of line markers.  */
+  while (p && (p[0] == '\r' || p[0] == '\n'))
+    p++;
+  
+  for (i = 0; p && reg_list[i] >= 0; i++)
+    {
+      char *q;
+
+      q = strchr (p, ' ');
+      if (q == 0)
+        q = strchr (p, '\t');
+
+      if (q)
+        *q++ = 0;
+
+      /* Value for register D is split with ':' ex: 45:23.  */
+      if (p[2] == ':')
+        {
+          p[2] = p[1];
+          p[1] = p[0];
+          p++;
+        }
+      monitor_supply_register (reg_list[i], p);
+      p = q;
+      while (p && p[0] == ' ')
+        p++;
+    }
+
+  /* Last value is the CCR expressed in bits.  */
+  if (p)
+    {
+      int bit, val;
+
+      val = 0;
+      for (bit = 7; p[0] && bit >= 0; )
+        {
+          char c = *p++;
+
+          if (c == ' ')
+            continue;
+
+          if (c == '1')
+            val |= (1 << bit);
+          bit--;
+        }
+      sprintf (buf, "%x", val);
+      monitor_supply_register (HARD_CCR_REGNUM, buf);
+    }
+  return 0;
+}
+
+static int (* monitor_xfer_memory) (CORE_ADDR, gdb_byte*, int, int,
+                                    struct mem_attrib *attrib,
+                                    struct target_ops*);
+
+static int
+dbug_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
+                  struct mem_attrib *attrib,
+                  struct target_ops *target)
+{
+  unsigned char val;
+  int written = 0;
+  char buf[16];
+  int result;
+
+  if (write == 0)
+    return monitor_xfer_memory (memaddr, myaddr, len, write, attrib, target);
+
+  if (len == 0)
+    return 0;
+
+  /* Enter the sub mode */
+  monitor_printf ("mm %x\r", (int) memaddr);
+
+  /* Wait output (7 chars); If we get the prompt, that's too bad.  */
+  result = monitor_expect (">", buf, 8);
+  if (result > 0)
+    return 0;
+  
+  while (len)
+    {
+      val = *myaddr;
+      monitor_printf ("%x\r", val);
+
+      result = monitor_expect (">", buf, 8);
+      if (result > 0)
+        return written;
+      
+      myaddr++;
+      memaddr++;
+      written++;
+      /* If we wanted to, here we could validate the address */
+      len--;
+    }
+  /* Now exit the sub mode */
+  monitor_printf (".\r");
+  monitor_expect_prompt (NULL, 0);
+  return written;
+}
+
+static void
+init_dbug_cmds (void)
+{
+  dbug_cmds.dumpregs = dbug_dumpregs;
+  dbug_cmds.flags = MO_NO_ECHO_ON_OPEN | MO_GETMEM_16_BOUNDARY |
+    MO_SETMEM_INTERACTIVE |
+    MO_CLR_BREAK_USES_ADDR | MO_GETMEM_NEEDS_RANGE | MO_FILL_USES_ADDR;
+  dbug_cmds.init = dbug_inits;	/* Init strings */
+  dbug_cmds.cont = "g\r";            /* continue command */
+  dbug_cmds.step = "t 1\r";          /* single step */
+  dbug_cmds.stop = NULL;             /* interrupt command */
+  dbug_cmds.set_break = "br %x\r";	/* set a breakpoint */
+  dbug_cmds.clr_break = "nobr %x\r";	/* clear a breakpoint */
+  dbug_cmds.clr_all_break = "nobr\r";	/* clear all breakpoints */
+  dbug_cmds.fill = "bf %x %x %x\r";	/* fill (start end val) */
+  dbug_cmds.setmem.cmdb = "mm %x\r";	/* setmem.cmdb (addr, value) */
+  dbug_cmds.setmem.cmdw = NULL;
+  dbug_cmds.setmem.cmdl = NULL;
+  dbug_cmds.setmem.cmdll = NULL;	/* setmem.cmdll (addr, value) */
+  dbug_cmds.setmem.resp_delim = NULL;
+  dbug_cmds.setmem.term = NULL;	/* setmem.term */
+  dbug_cmds.setmem.term_cmd = ".\r";	/* setmem.term_cmd */
+  dbug_cmds.getmem.cmdb = "md %x %x\r";	/* getmem.cmdb (addr, addr2) */
+  dbug_cmds.getmem.cmdw = NULL;
+  dbug_cmds.getmem.cmdl = NULL;
+  dbug_cmds.getmem.cmdll = NULL;	/* getmem.cmdll (addr, addr2) */
+  dbug_cmds.getmem.resp_delim = " ";	/* getmem.resp_delim */
+  dbug_cmds.getmem.term = NULL;	/* getmem.term */
+  dbug_cmds.getmem.term_cmd = NULL;	/* getmem.term_cmd */
+  dbug_cmds.setreg.cmd = "%s %x\r";	/* setreg.cmd (name, value) */
+  dbug_cmds.setreg.resp_delim = NULL;
+  dbug_cmds.setreg.term = NULL;	/* setreg.term */
+  dbug_cmds.setreg.term_cmd = NULL;	/* setreg.term_cmd */
+  dbug_cmds.getreg.cmd = NULL;	/* getreg.cmd (name) */
+  dbug_cmds.getreg.resp_delim = " ";	/* getreg.resp_delim */
+  dbug_cmds.getreg.term = NULL;	/* getreg.term */
+  dbug_cmds.getreg.term_cmd = NULL;	/* getreg.term_cmd */
+  dbug_cmds.dump_registers = NULL;;     /* dump_registers */
+  /* register_pattern */
+  dbug_cmds.register_pattern = NULL;
+  dbug_cmds.supply_register = NULL;	/* supply_register */
+  dbug_cmds.load_routine = NULL;	/* load_routine (defaults to SRECs) */
+  dbug_cmds.load = "load\r";	/* download command */
+  dbug_cmds.loadresp = NULL;	/* load response */
+  dbug_cmds.prompt = ">";	/* monitor command prompt */
+  dbug_cmds.line_term = "\r";	/* end-of-line terminator */
+  dbug_cmds.cmd_end = NULL;	/* optional command terminator */
+  dbug_cmds.target = &dbug_ops;	/* target operations */
+  dbug_cmds.stopbits = SERIAL_2_STOPBITS;	/* number of stop bits */
+  dbug_cmds.regnames = dbug_regnames;	/* registers names */
+  dbug_cmds.magic = MONITOR_OPS_MAGIC;	/* magic */
+}
+
+static void
+dbug_open (char *args, int from_tty)
+{
+  monitor_open (args, &dbug_cmds, from_tty);
+  set_gdbarch (bfd_arch_m68hc12, 0);
+}
+
+
+/* Initialize all 68HC11/68HC12 monitors.  */
+
+void
+_initialize_m68hc11_rom (void)
+{
+  /* 68HC11 Buffalo monitor.  */
+  init_buffalo_cmds ();
+  init_monitor_ops (&buffalo_ops);
+
+  buffalo_ops.to_shortname = "buffalo";
+  buffalo_ops.to_longname = "Buffalo monitor";
+  buffalo_ops.to_doc = "Debug via the Buffalo 68HC11 monitor.\n\
+Specify the serial device it is connected to (e.g. /dev/ttya).";
+  buffalo_ops.to_open = buffalo_open;
+
+  add_target (&buffalo_ops);
+
+  /* 68HC12 DBug monitor.  */
+  init_dbug_cmds ();
+  init_monitor_ops (&dbug_ops);
+
+  dbug_ops.to_shortname = "dbug";
+  dbug_ops.to_longname = "DBug monitor";
+  dbug_ops.to_doc = "Debug via the DBug 68HC12 monitor.\n\
+Specify the serial device it is connected to (e.g. /dev/ttya).";
+  dbug_ops.to_open = dbug_open;
+  monitor_xfer_memory = dbug_ops.deprecated_xfer_memory;
+  dbug_ops.deprecated_xfer_memory = dbug_xfer_memory;
+  
+  add_target (&dbug_ops);
+} 
+
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/monitor.c gdb-6.4-m68hc1x/gdb/monitor.c
--- gdb-6.4/gdb/monitor.c	Fri Feb 18 19:58:56 2005
+++ gdb-6.4-m68hc1x/gdb/monitor.c	Sat Jan 21 15:28:49 2006
@@ -122,7 +122,7 @@ static CORE_ADDR *breakaddr;
    that monitor_open knows that we don't have a file open when the
    program starts.  */
 
-static struct serial *monitor_desc = NULL;
+struct serial *monitor_desc = NULL;
 
 /* Pointer to regexp pattern matching data */
 
@@ -138,6 +138,12 @@ static char setmem_resp_delim_fastmap[25
 static struct re_pattern_buffer setreg_resp_delim_pattern;
 static char setreg_resp_delim_fastmap[256];
 
+static struct re_pattern_buffer setmem_resp_delim_pattern;
+static char setmem_resp_delim_fastmap[256];
+
+static struct re_pattern_buffer setreg_resp_delim_pattern;
+static char setreg_resp_delim_fastmap[256];
+
 static int dump_reg_flag;	/* Non-zero means do a dump_registers cmd when
 				   monitor_wait wakes up.  */
 
@@ -2161,7 +2167,8 @@ monitor_load (char *file, int from_tty)
       load_srec (monitor_desc, file, (bfd_vma) load_offset,
 		 32, SREC_ALL, hashmark,
 		 current_monitor->flags & MO_SREC_ACK ?
-		 monitor_wait_srec_ack : NULL);
+		 monitor_wait_srec_ack : NULL,
+                 current_monitor->serial_write);
 
       monitor_expect_prompt (NULL, 0);
     }
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/monitor.h gdb-6.4-m68hc1x/gdb/monitor.h
--- gdb-6.4/gdb/monitor.h	Tue Aug  5 04:44:50 2003
+++ gdb-6.4-m68hc1x/gdb/monitor.h	Sat Jan 21 15:28:49 2006
@@ -109,6 +109,7 @@ struct monitor_ops
 			int bufmax,
 			int *response_length,
 			struct target_waitstatus * status);
+    int (*serial_write) (struct serial*, char* buf, int buflen);
     char *load;			/* load command */
     char *loadresp;		/* Response to load command */
     char *prompt;		/* monitor command prompt */
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/remote-bdm12.c gdb-6.4-m68hc1x/gdb/remote-bdm12.c
--- gdb-6.4/gdb/remote-bdm12.c	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/remote-bdm12.c	Sat Jan 21 17:09:25 2006
@@ -0,0 +1,718 @@
+/* remote debugging interface for Kevin Ross' BDM12 BDM pod for the 68HC12.
+   Copyright 2001
+   Free Software Foundation, Inc.
+   Contributed by Tim Housel (thousel@usa.net)
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "inferior.h"
+#include "value.h"
+#include "gdb_string.h"
+#include <ctype.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <errno.h>
+#include "terminal.h"
+#include "target.h"
+#include "gdbcore.h"
+#include "gdb/callback.h"
+#include "gdb/signals.h"
+#include "bdm12.h"
+#include "remote-utils.h"
+#include "command.h"
+#include "regcache.h"
+
+/* Prototypes */
+
+extern void _initialize_remote_bdm12 (void);
+
+static void dump_mem (char *buf, int len);
+
+static void gdbbdm12_fetch_register (int regno);
+
+static void gdbbdm12_store_register (int regno);
+
+static void gdbbdm12_kill (void);
+
+static void gdbbdm12_load (char *prog, int fromtty);
+
+static void gdbbdm12_create_inferior (char *exec_file, char *args, char **env, int);
+
+static void gdbbdm12_open (char *args, int from_tty);
+
+static void gdbbdm12_close (int quitting);
+
+static void gdbbdm12_detach (char *args, int from_tty);
+
+static void gdbbdm12_resume (ptid_t pid, int step, enum target_signal siggnal);
+
+static ptid_t gdbbdm12_wait (ptid_t pid, struct target_waitstatus *status);
+
+static void gdbbdm12_prepare_to_store (void);
+struct mem_attrib;
+static int gdbbdm12_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, 
+                                          int len, int write,
+                                          struct mem_attrib *attrib,
+                                          struct target_ops *target);
+
+static void gdbbdm12_files_info (struct target_ops *target);
+
+static void gdbbdm12_mourn_inferior (void);
+
+static void gdbbdm12_stop (void);
+
+static int gdbbdm12_insert_breakpoint (CORE_ADDR addr, gdb_byte *contents_cache);
+
+static int gdbbdm12_remove_breakpoint (CORE_ADDR addr, gdb_byte *contents_cache);
+
+void pass_command (char *args, int from_tty);
+
+/* Naming convention:
+
+   bdm12_* are the interface to the BDM Hardware (see bdm12.h).
+   gdbbdm12_* are stuff which is internal to gdb.  */
+
+/* Forward data declarations */
+extern struct target_ops gdbbdm12_ops;
+
+static int program_loaded = 0;
+
+/* We must keep track of whether the BDM has been opened or not because
+   GDB can call a target's close routine twice, but bdm12_close doesn't allow
+   this.  We also need to record the result of bdm12_open so we can pass it
+   back to the other bdm12_foo routines.  */
+static int gdbbdm12_opened = 0;
+
+static int bdm12_stop_requested = 0;
+
+static void
+dump_mem (char *buf, int len)
+{
+  if (len <= 8)
+    {
+      if (len == 8 || len == 4)
+        {
+          long l[2];
+          memcpy (l, buf, len);
+          printf_filtered ("\t0x%lx", l[0]);
+          if (len == 8)
+            printf_filtered (" 0x%lx", l[1]);
+          printf_filtered ("\n");
+        }
+      else
+        {
+          int i;
+          printf_filtered ("\t");
+          for (i = 0; i < len; i++)
+            printf_filtered ("0x%x ", buf[i]);
+          printf_filtered ("\n");
+        }
+    }
+}
+
+static void
+gdbbdm12_fetch_register (int regno)
+{
+  static int warn_user = 1;
+  if (regno == -1)
+    {
+      for (regno = 0; regno < NUM_REGS; regno++)
+        gdbbdm12_fetch_register (regno);
+    }
+  else if (REGISTER_NAME (regno) != NULL
+           && *REGISTER_NAME (regno) != '\0')
+    {
+      char buf[MAX_REGISTER_SIZE];
+      int nr_bytes;
+      if (REGISTER_BDM12_REGNO (regno) >= 0)
+        nr_bytes = bdm12_fetch_register (REGISTER_BDM12_REGNO (regno),
+                                         buf, register_size (current_gdbarch, regno));
+      else
+        nr_bytes = 0;
+      if (nr_bytes == 0)
+        /* register not applicable, supply zero's */
+        memset (buf, 0, MAX_REGISTER_SIZE);
+      else if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno)
+               && warn_user)
+        {
+          fprintf_unfiltered (gdb_stderr,
+                              "Size of register %s (%d/%d) incorrect (%d instead of %d))",
+                              REGISTER_NAME (regno),
+                              regno, REGISTER_BDM12_REGNO (regno),
+                              nr_bytes, register_size (current_gdbarch, regno));
+          warn_user = 0;
+      }
+      regcache_raw_supply (current_regcache, regno, buf);
+      if (sr_get_debug ())
+        {
+          printf_filtered ("gdbbdm12_fetch_register: %d", regno);
+          /* FIXME: We could print something more intelligible.  */
+          dump_mem (buf, register_size (current_gdbarch, regno));
+        }
+    }
+}
+
+
+static void
+gdbbdm12_store_register (int regno)
+{
+  if (regno == -1)
+    {
+      for (regno = 0; regno < NUM_REGS; regno++)
+        gdbbdm12_store_register (regno);
+    }
+  else if (REGISTER_NAME (regno) != NULL
+           && *REGISTER_NAME (regno) != '\0'
+           && REGISTER_BDM12_REGNO (regno) >= 0)
+    {
+      char tmp[MAX_REGISTER_SIZE];
+      int nr_bytes;
+      deprecated_read_register_gen (regno, tmp);
+      nr_bytes = bdm12_store_register (REGISTER_BDM12_REGNO (regno),
+                                       tmp, register_size (current_gdbarch, regno));
+      if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno))
+        internal_error (__FILE__, __LINE__,
+                        "Register size different than expected");
+      if (sr_get_debug ())
+        {
+          printf_filtered ("gdbbdm12_store_register: %d", regno);
+          /* FIXME: We could print something more intelligible.  */
+          dump_mem (tmp, register_size (current_gdbarch, regno));
+        }
+    }
+}
+
+/* Kill the running program. */
+
+static void
+gdbbdm12_kill (void)
+{
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_kill\n");
+
+  /* make sure everything is closed up okay (e.g. serial port) */
+
+  bdm12_close (1);
+  inferior_ptid = null_ptid;
+}
+
+/* Load an executable file into the target process.  This is expected to
+   not only bring new code into the target process, but also to update
+   GDB's symbol tables to match.  */
+
+static void
+gdbbdm12_load (char *prog, int fromtty)
+{
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_load: prog \"%s\"\n", prog);
+
+  inferior_ptid = null_ptid;
+
+  /* FIXME: We will print two messages on error.
+     Need error to either not print anything if passed NULL or need
+     another routine that doesn't take any arguments.  */
+  if (bdm12_load (prog, NULL, fromtty) == BDM12_RC_FAIL)
+    error ("unable to load program");
+
+  /* FIXME: If a load command should reset the targets registers then
+     a call to bdm12_create_inferior() should go here. */
+
+  program_loaded = 1;
+}
+
+
+/* Start an inferior process and set inferior_pid to its pid.
+   EXEC_FILE is the file to run.
+   ARGS is a string containing the arguments to the program.
+   ENV is the environment vector to pass.  Errors reported with error().
+   This is called not only when we first attach, but also when the
+   user types "run" after having attached.  */
+
+static void
+gdbbdm12_create_inferior (char *exec_file, char *args, char **env, int from_tty)
+{
+  int len;
+  char *arg_buf, **argv;
+
+  if (exec_file == 0 || exec_bfd == 0)
+    warning ("No executable file specified.");
+  if (!program_loaded)
+    warning ("No program loaded.");
+  if (!gdbbdm12_opened)
+      error ("Not connected to the bdm12 interface");
+
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_create_inferior: exec_file \"%s\", args \"%s\"\n",
+                     (exec_file ? exec_file : "(NULL)"),
+                     args);
+
+  remove_breakpoints ();
+  init_wait_for_inferior ();
+
+  if (exec_file != NULL)
+    {
+      len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
+      arg_buf = (char *) alloca (len);
+      arg_buf[0] = '\0';
+      strcat (arg_buf, exec_file);
+      strcat (arg_buf, " ");
+      strcat (arg_buf, args);
+      argv = buildargv (arg_buf);
+      make_cleanup_freeargv (argv);
+    }
+  else
+    argv = NULL;
+  bdm12_create_inferior (exec_bfd, argv, env);
+
+  inferior_ptid = pid_to_ptid (42);
+  insert_breakpoints ();
+
+  clear_proceed_status ();
+
+  /* NB: Entry point already set by bdm12_create_inferior. */
+  proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
+}
+
+/* The open routine takes the rest of the parameters from the command,
+   and (if successful) pushes a new target onto the stack.
+   Called when selecting the bdm12 target. EG: (gdb) target bdm12 name.  */
+
+static void
+gdbbdm12_open (char *args, int from_tty)
+{
+  int len;
+  char **argv;
+  BDM12_RC retval;
+
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_open: args \"%s\"\n", args ? args : "(null)");
+
+  /* Remove current bdm12 if one exists.  Only do this if the bdm12 interface
+     has been opened because bdm12_close requires it.
+     This is important because the call to push_target below will cause
+     bdm12_close to be called if the bdm12 interface is already open, but
+     push_target is called after bdm12_open!  We can't move the call to
+     push_target before the call to bdm12_open because bdm12_open may invoke
+     'error'.  */
+
+  if (args == NULL)
+    error("\n\
+Usage: target bdm12 <serial_device> <E-clock rate (1,2,4, or 8 MHz) \n\
+                           <register base> <ram base> <eeprom base> <flash base> \n\
+(ex. target bdm12 com1 8 0x0 0x800 0xd00 0x8000 on Win32, \n\
+  or target bdm12 ttya 8 0x0 0x800 0xd00 0x8000 on UNIX)");
+
+  if (gdbbdm12_opened != 0)
+    unpush_target (&gdbbdm12_ops);
+
+  argv = buildargv (args);
+  if (argv == NULL)
+    error("Insufficient memory available to allocate arg list");
+  make_cleanup_freeargv (argv);
+
+  retval = bdm12_open (argv);
+  if (retval != BDM12_RC_OK)
+    error ("unable to open bdm12 interface\n\
+Usage: target bdm12 <serial_device> <E-clock rate (1,2,4, or 8 MHz) \n\
+                    <register base> <ram base> <eeprom base> <flash base> \n\
+(ex. target bdm12 com1 8 0x0 0x800 0xd00 0x8000 on Win32, \n\
+  or target bdm12 ttya 8 0x0 0x800 0xd00 0x8000 on UNIX)");
+  else
+    gdbbdm12_opened = 1;
+
+  push_target (&gdbbdm12_ops);
+  target_fetch_registers (-1);
+  printf_filtered ("Connected to the bdm12 interface.\n");
+}
+
+/* Does whatever cleanup is required for a target that we are no longer
+   going to be calling.  Argument says whether we are quitting gdb and
+   should not get hung in case of errors, or whether we want a clean
+   termination even if it takes a while.  This routine is automatically
+   always called just before a routine is popped off the target stack.
+   Closing file and freeing memory are typical things it should
+   do.  */
+/* Close out all files and local state before this target loses control. */
+
+static void
+gdbbdm12_close (int quitting)
+{
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_close: quitting %d\n", quitting);
+
+  program_loaded = 0;
+
+  if (gdbbdm12_opened != 0)
+    {
+      bdm12_close (quitting);
+      gdbbdm12_opened = 0;
+    }
+
+  generic_mourn_inferior ();
+}
+
+/* Takes a program previously attached to and detaches it.
+   The program may resume execution (some targets do, some don't) and will
+   no longer stop on signals, etc.  We better not have left any breakpoints
+   in the program or it'll die when it hits one.  ARGS is arguments
+   typed by the user (e.g. a signal to send the process).  FROM_TTY
+   says whether to be verbose or not.  */
+/* Terminate the open connection to the remote debugger.
+   Use this when you want to detach and do something else with your gdb.  */
+
+static void
+gdbbdm12_detach (char *args, int from_tty)
+{
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_detach: args \"%s\"\n", args);
+
+  pop_target ();  /* calls gdbbdm12_close to do the real work */
+  if (from_tty)
+    printf_filtered ("Ending %s debugging\n", target_shortname);
+}
+
+/* Resume execution of the target process.  STEP says whether to single-step
+   or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
+   to the target, or zero for no signal.  */
+
+static enum target_signal resume_siggnal;
+static int resume_step;
+
+static void
+gdbbdm12_resume (ptid_t pid, int step, enum target_signal siggnal)
+{
+  if (PIDGET (inferior_ptid) != 42)
+    error ("The program is not being run.");
+
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_resume: step %d, signal %d\n", step, siggnal);
+
+  resume_siggnal = siggnal;
+  resume_step = step;
+}
+
+/* Notify the bdm12 interface of an asynchronous request to stop. */
+
+static void
+gdbbdm12_stop (void)
+{
+  bdm12_stop_requested = 0;
+  if (!bdm12_stop ())
+    {
+      quit ();
+    }
+}
+
+static void
+gdbbdm12_cntrl_c (int signo)
+{
+  bdm12_stop_requested = 1;
+}
+
+/* Wait for inferior process to do something.  Return pid of child,
+   or -1 in case of error; store status through argument pointer STATUS,
+   just as `wait' would. */
+
+static ptid_t
+gdbbdm12_wait (ptid_t pid, struct target_waitstatus *status)
+{
+  static RETSIGTYPE (*prev_sigint) ();
+  int sigrc = 0;
+  enum bdm12_stop reason;
+
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_wait\n");
+
+#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+  {
+    struct sigaction sa, osa;
+    sa.sa_handler = gdbbdm12_cntrl_c;
+    sigemptyset (&sa.sa_mask);
+    sa.sa_flags = 0;
+    sigaction (SIGINT, &sa, &osa);
+    prev_sigint = osa.sa_handler;
+  }
+#else
+  prev_sigint = signal (SIGINT, gdbbdm12_cntrl_c);
+#endif
+  
+  bdm12_resume (resume_step);
+
+  do
+    bdm12_stop_reason (&reason, &sigrc);
+  while ((reason == BDM12_RUNNING) && !bdm12_stop_requested);
+
+  if (bdm12_stop_requested)
+    gdbbdm12_stop ();
+
+  signal (SIGINT, prev_sigint);
+  resume_step = 0;
+
+  switch (reason)
+    {
+    case BDM12_EXITED:
+      status->kind = TARGET_WAITKIND_EXITED;
+      status->value.integer = sigrc;
+      break;
+    case BDM12_STOPPED:
+      switch (sigrc)
+        {
+        case TARGET_SIGNAL_ABRT:
+          quit ();
+          break;
+        case TARGET_SIGNAL_INT:
+        case TARGET_SIGNAL_TRAP:
+        default:
+          status->kind = TARGET_WAITKIND_STOPPED;
+          status->value.sig = sigrc;
+          break;
+        }
+      break;
+    case BDM12_SIGNALLED:
+      status->kind = TARGET_WAITKIND_SIGNALLED;
+      status->value.sig = sigrc;
+      break;
+    case BDM12_RUNNING:
+    case BDM12_POLLING:
+      /* FIXME: Is this correct? */
+      break;
+    }
+
+  return inferior_ptid;
+}
+
+/* Get ready to modify the registers array.  On machines which store
+   individual registers, this doesn't need to do anything.  On machines
+   which store all the registers in one fell swoop, this makes sure
+   that registers contains all the registers from the program being
+   debugged.  */
+
+static void
+gdbbdm12_prepare_to_store (void)
+{
+  /* Do nothing, since we can store individual regs */
+}
+
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
+static int
+gdbbdm12_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
+                               int write, 
+                               struct mem_attrib *attrib ATTRIBUTE_UNUSED,
+                               struct target_ops *target ATTRIBUTE_UNUSED)
+{
+  if (sr_get_debug ())
+    {
+      /* FIXME: Send to something other than STDOUT? */
+      printf_filtered ("gdbbdm12_xfer_inferior_memory: myaddr 0x");
+      gdb_print_host_address (myaddr, gdb_stdout);
+      printf_filtered (", memaddr 0x%s, len %d, write %d\n",
+                       paddr_nz (memaddr), len, write);
+      if (sr_get_debug () && write)
+        dump_mem (myaddr, len);
+    }
+
+  if (write)
+    {
+      len = bdm12_write (memaddr, myaddr, len);
+    }
+  else
+    {
+      len = bdm12_read (memaddr, myaddr, len);
+      if (sr_get_debug () && len > 0)
+        dump_mem (myaddr, len);
+    }
+  return len;
+}
+
+static void
+gdbbdm12_files_info (struct target_ops *target)
+{
+  char *file = "nothing";
+
+  if (exec_bfd)
+    file = bfd_get_filename (exec_bfd);
+
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_files_info: file \"%s\"\n", file);
+
+  if (exec_bfd)
+    {
+      printf_filtered ("\tAttached to %s running program %s\n",
+                       target_shortname, file);
+    }
+}
+
+/* Clear the BDM interface's notion of what the breakpoints are.  */
+
+static void
+gdbbdm12_mourn_inferior (void)
+{
+  if (sr_get_debug ())
+    printf_filtered ("gdbbdm12_mourn_inferior:\n");
+
+  remove_breakpoints ();
+  generic_mourn_inferior ();
+}
+
+static int
+gdbbdm12_insert_breakpoint (CORE_ADDR addr, gdb_byte *contents_cache)
+{
+  BDM12_RC retcode;
+
+  retcode = bdm12_set_breakpoint (addr);
+
+  switch (retcode)
+    {
+    case BDM12_RC_OK:
+      return 0;
+    case BDM12_RC_INSUFFICIENT_RESOURCES:
+      return ENOMEM;
+    default:
+      return EIO;
+    }
+}
+
+static int
+gdbbdm12_remove_breakpoint (CORE_ADDR addr, gdb_byte *contents_cache)
+{
+  BDM12_RC retcode;
+
+  retcode = bdm12_clear_breakpoint (addr);
+
+  switch (retcode)
+    {
+    case BDM12_RC_OK:
+    case BDM12_RC_UNKNOWN_BREAKPOINT:
+      return 0;
+    case BDM12_RC_INSUFFICIENT_RESOURCES:
+      return ENOMEM;
+    default:
+      return EIO;
+    }
+}
+
+/* Pass the command argument through to the bdm12 interface verbatim.  The
+   bdm12 must do any command interpretation work.  */
+
+void
+pass_command (char *args, int from_tty)
+{
+  if (gdbbdm12_opened == 0)
+    {
+      /* Don't send commands if the interface isn't opened! */
+      error ("Not connected to the bdm12 interface");
+    }
+
+#if 0
+  /* implement later */ 
+  bdm12_do_command (args);
+#endif
+
+  /* Invalidate the register cache, in case the command does
+     something funny. */
+  registers_changed ();
+}
+
+/* Define the target subroutine names */
+
+struct target_ops gdbbdm12_ops;
+
+static void
+init_gdbbdm12_ops (void)
+{
+  gdbbdm12_ops.to_shortname = "bdm12";
+  gdbbdm12_ops.to_longname = "Kevin Ross' BDM12 Pod for BDM on the 68HC12";
+  gdbbdm12_ops.to_doc = "Debug using Kevin Ross' BDM12 Pod\n\
+(http://www.nwlink.com/~kevinro/bdm.html) for the Motorola 68HC12 series of\n\
+microcontrollers. This processor features a single wire background debug mode\n\
+interface.\n\
+Usage: target bdm12 <serial_device> <E-clock rate (1,2,4, or 8 MHz) \n\
+                    <register base> <ram base> <eeprom base> <flash base> \n\
+(ex. target bdm12 com1 8 0x0 0x800 0xd00 0x8000 on Win32, \n\
+  or target bdm12 ttya 8 0x0 0x800 0xd00 0x8000 on UNIX)";
+  gdbbdm12_ops.to_open = gdbbdm12_open;
+  gdbbdm12_ops.to_close = gdbbdm12_close;
+  gdbbdm12_ops.to_attach = NULL;
+  gdbbdm12_ops.to_post_attach = NULL;
+  gdbbdm12_ops.to_detach = gdbbdm12_detach;
+  gdbbdm12_ops.to_resume = gdbbdm12_resume;
+  gdbbdm12_ops.to_wait = gdbbdm12_wait;
+  gdbbdm12_ops.to_fetch_registers = gdbbdm12_fetch_register;
+  gdbbdm12_ops.to_store_registers = gdbbdm12_store_register;
+  gdbbdm12_ops.to_prepare_to_store = gdbbdm12_prepare_to_store;
+  gdbbdm12_ops.deprecated_xfer_memory = gdbbdm12_xfer_inferior_memory;
+  gdbbdm12_ops.to_files_info = gdbbdm12_files_info;
+  gdbbdm12_ops.to_insert_breakpoint = gdbbdm12_insert_breakpoint;
+  gdbbdm12_ops.to_remove_breakpoint = gdbbdm12_remove_breakpoint;
+  gdbbdm12_ops.to_terminal_init = NULL;
+  gdbbdm12_ops.to_terminal_inferior = NULL;
+  gdbbdm12_ops.to_terminal_ours_for_output = NULL;
+  gdbbdm12_ops.to_terminal_ours = NULL;
+  gdbbdm12_ops.to_terminal_info = NULL;
+  gdbbdm12_ops.to_kill = gdbbdm12_kill;
+  gdbbdm12_ops.to_load = gdbbdm12_load;
+  gdbbdm12_ops.to_lookup_symbol = NULL;
+  gdbbdm12_ops.to_create_inferior = gdbbdm12_create_inferior;
+  gdbbdm12_ops.to_post_startup_inferior = NULL;
+  gdbbdm12_ops.to_acknowledge_created_inferior = NULL;
+  gdbbdm12_ops.to_insert_fork_catchpoint = NULL;
+  gdbbdm12_ops.to_remove_fork_catchpoint = NULL;
+  gdbbdm12_ops.to_insert_vfork_catchpoint = NULL;
+  gdbbdm12_ops.to_remove_vfork_catchpoint = NULL;
+  gdbbdm12_ops.to_insert_exec_catchpoint = NULL;
+  gdbbdm12_ops.to_remove_exec_catchpoint = NULL;
+  gdbbdm12_ops.to_reported_exec_events_per_exec_call = NULL;
+  gdbbdm12_ops.to_has_exited = NULL;
+  gdbbdm12_ops.to_mourn_inferior = gdbbdm12_mourn_inferior;
+  gdbbdm12_ops.to_can_run = 0;
+  gdbbdm12_ops.to_notice_signals = 0;
+  gdbbdm12_ops.to_thread_alive = 0;
+  gdbbdm12_ops.to_stop = gdbbdm12_stop;
+  gdbbdm12_ops.to_pid_to_exec_file = NULL;
+  gdbbdm12_ops.to_stratum = process_stratum;
+  gdbbdm12_ops.to_has_all_memory = 1;
+  gdbbdm12_ops.to_has_memory = 1;
+  gdbbdm12_ops.to_has_stack = 1;
+  gdbbdm12_ops.to_has_registers = 1;
+  gdbbdm12_ops.to_has_execution = 1;
+  gdbbdm12_ops.to_sections = NULL;
+  gdbbdm12_ops.to_sections_end = NULL;
+  gdbbdm12_ops.to_magic = OPS_MAGIC;
+
+#ifdef TARGET_REDEFINE_DEFAULT_OPS
+  TARGET_REDEFINE_DEFAULT_OPS (&gdbbdm12_ops);
+#endif
+}
+
+
+void
+_initialize_remote_bdm12 (void)
+{
+  init_gdbbdm12_ops ();
+  add_target (&gdbbdm12_ops);
+
+  add_com ("bdm12 <command>", class_obscure, pass_command,
+           "Send a command to the BDM interface directly.");
+}
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/ser-dummy.c gdb-6.4-m68hc1x/gdb/ser-dummy.c
--- gdb-6.4/gdb/ser-dummy.c	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/ser-dummy.c	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,153 @@
+/* Dummy (do-nothing) serial interface */
+
+/*
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "serial.h"
+
+static int
+ser_dummy_open (struct serial *scb ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED)
+{
+  scb->fd = -1;
+  return 0;
+}
+
+void
+ser_dummy_close (struct serial *scb ATTRIBUTE_UNUSED)
+{
+}
+
+/* Wait for the output to drain away, as opposed to flushing (discarding) it */
+
+serial_ttystate
+ser_dummy_get_tty_state (struct serial *scb ATTRIBUTE_UNUSED)
+{
+  /* allocate a dummy */
+  return (serial_ttystate) xmalloc (8);
+}
+
+int
+ser_dummy_set_tty_state (struct serial *scb ATTRIBUTE_UNUSED, serial_ttystate ttystate ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
+void
+ser_dummy_go_raw (struct serial *scb ATTRIBUTE_UNUSED)
+{
+  return;			/* Always in raw mode */
+}
+
+
+int
+ser_dummy_readchar (struct serial *scb ATTRIBUTE_UNUSED, int timeout ATTRIBUTE_UNUSED)
+{
+  return SERIAL_EOF;
+}
+
+int
+ser_dummy_noflush_set_tty_state (struct serial *scb ATTRIBUTE_UNUSED,
+				    serial_ttystate new_ttystate ATTRIBUTE_UNUSED,
+				    serial_ttystate old_ttystate ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
+void
+ser_dummy_print_tty_state (struct serial *scb ATTRIBUTE_UNUSED, 
+			      serial_ttystate ttystate ATTRIBUTE_UNUSED,
+			      struct ui_file *stream ATTRIBUTE_UNUSED)
+{
+  /* Nothing to print.  */
+  return;
+}
+
+int
+ser_dummy_setbaudrate (struct serial *scb ATTRIBUTE_UNUSED, int rate ATTRIBUTE_UNUSED)
+{
+  return 0;			/* Never fails! */
+}
+
+int
+ser_dummy_setstopbits (struct serial *scb ATTRIBUTE_UNUSED, int num ATTRIBUTE_UNUSED)
+{
+  return 0;			/* Never fails! */
+}
+
+int
+ser_dummy_write (struct serial *scb ATTRIBUTE_UNUSED, const char *str ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
+int
+ser_dummy_flush_output (struct serial *scb ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
+int
+ser_dummy_flush_input (struct serial *scb ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+ser_dummy_send_break (struct serial *scb ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
+static int
+ser_dummy_drain_output (struct serial *scb ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
+/* Put the SERIAL device into/out-of ASYNC mode.  */
+
+void
+ser_dummy_async (struct serial *scb ATTRIBUTE_UNUSED,
+		int async_p ATTRIBUTE_UNUSED)
+{
+}
+
+void
+_initialize_dummy_ser_hardwire (void)
+{
+  struct serial_ops *ops = (struct serial_ops *) xmalloc (sizeof (struct serial_ops));
+  memset (ops, sizeof (struct serial_ops), 0);
+  ops->name = "hardwire";
+  ops->next = 0;
+  ops->open = ser_dummy_open;
+  ops->close = ser_dummy_close;
+  ops->readchar = ser_dummy_readchar;
+  ops->write = ser_dummy_write;
+  ops->flush_output = ser_dummy_flush_output;
+  ops->flush_input = ser_dummy_flush_input;
+  ops->send_break = ser_dummy_send_break;
+  ops->go_raw = ser_dummy_go_raw;
+  ops->get_tty_state = ser_dummy_get_tty_state;
+  ops->set_tty_state = ser_dummy_set_tty_state;
+  ops->print_tty_state = ser_dummy_print_tty_state;
+  ops->noflush_set_tty_state = ser_dummy_noflush_set_tty_state;
+  ops->setbaudrate = ser_dummy_setbaudrate;
+  ops->setstopbits = ser_dummy_setstopbits;
+  ops->drain_output = ser_dummy_drain_output;
+  ops->async = ser_dummy_async;
+  serial_add_interface (ops);
+}
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/ser-mingw.c gdb-6.4-m68hc1x/gdb/ser-mingw.c
--- gdb-6.4/gdb/ser-mingw.c	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/ser-mingw.c	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,533 @@
+/* Serial interface for TCP connections on MingW Windows systems
+   Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "serial.h"
+#include "ser-mingw.h"
+
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/timeb.h>
+
+#include <winsock2.h>
+
+#include "gdb_string.h"
+#include "event-loop.h"
+
+void
+gettimeofday(struct timeval* tv, struct timezone* tz)
+{
+  struct timeb tb;
+
+  ftime(&tb);
+  tv->tv_sec = (unsigned long) tb.time;
+  tv->tv_usec = ((unsigned long) tb.millitm) * 1000L;
+}
+
+static int do_mingw_readchar (struct serial *scb, int timeout);
+static timer_handler_func push_event;
+static handler_func fd_event;
+static void reschedule (struct serial *scb);
+
+extern int (*deprecated_ui_loop_hook) (int);
+
+/* Generic operations used by all UNIX/FD based serial interfaces. */
+
+serial_ttystate
+ser_mingw_nop_get_tty_state (struct serial *scb)
+{
+  /* allocate a dummy */
+  return (serial_ttystate) XMALLOC (int);
+}
+
+int
+ser_mingw_nop_set_tty_state (struct serial *scb, serial_ttystate ttystate)
+{
+  return 0;
+}
+
+void
+ser_mingw_nop_raw (struct serial *scb)
+{
+  return;			/* Always in raw mode */
+}
+
+/* Wait for input on scb, with timeout seconds.  Returns 0 on success,
+   otherwise SERIAL_TIMEOUT or SERIAL_ERROR. */
+
+int
+ser_mingw_wait_for (struct serial *scb, int timeout)
+{
+  while (1)
+    {
+      int numfds;
+      struct timeval tv;
+      fd_set readfds, exceptfds;
+
+      /* NOTE: Some OS's can scramble the READFDS when the select()
+         call fails (ex the kernel with Red Hat 5.2).  Initialize all
+         arguments before each call. */
+
+      tv.tv_sec = timeout;
+      tv.tv_usec = 0;
+
+      FD_ZERO (&readfds);
+      FD_ZERO (&exceptfds);
+      FD_SET (scb->fd, &readfds);
+      FD_SET (scb->fd, &exceptfds);
+
+      if (timeout >= 0)
+	numfds = select (scb->fd + 1, &readfds, 0, &exceptfds, &tv);
+      else
+	numfds = select (scb->fd + 1, &readfds, 0, &exceptfds, 0);
+
+      if (numfds <= 0)
+	{
+	  if (numfds == 0)
+	    return SERIAL_TIMEOUT;
+	  else if (errno == EINTR)
+	    continue;
+	  else
+	    return SERIAL_ERROR;	/* Got an error from select or poll */
+	}
+
+      return 0;
+    }
+}
+
+/* Read a character with user-specified timeout.  TIMEOUT is number of seconds
+   to wait, or -1 to wait forever.  Use timeout of 0 to effect a poll.  Returns
+   char if successful.  Returns -2 if timeout expired, EOF if line dropped
+   dead, or -3 for any other error (see errno in that case). */
+
+static int
+do_mingw_readchar (struct serial *scb, int timeout)
+{
+  int status;
+  int delta;
+
+  /* We have to be able to keep the GUI alive here, so we break the original
+     timeout into steps of 1 second, running the "keep the GUI alive" hook 
+     each time through the loop.
+
+     Also, timeout = 0 means to poll, so we just set the delta to 0, so we
+     will only go through the loop once. */
+
+  delta = (timeout == 0 ? 0 : 1);
+  while (1)
+    {
+
+      /* N.B. The UI may destroy our world (for instance by calling
+         remote_stop,) in which case we want to get out of here as
+         quickly as possible.  It is not safe to touch scb, since
+         someone else might have freed it.  The ui_loop_hook signals that 
+         we should exit by returning 1. */
+
+      if (deprecated_ui_loop_hook)
+	{
+	  if (deprecated_ui_loop_hook (0))
+	    return SERIAL_TIMEOUT;
+	}
+
+      status = ser_mingw_wait_for (scb, delta);
+      if (timeout > 0)
+        timeout -= delta;
+
+      /* If we got a character or an error back from wait_for, then we can 
+         break from the loop before the timeout is completed. */
+
+      if (status != SERIAL_TIMEOUT)
+	{
+	  break;
+	}
+
+      /* If we have exhausted the original timeout, then generate
+         a SERIAL_TIMEOUT, and pass it out of the loop. */
+
+      else if (timeout == 0)
+	{
+	  status = SERIAL_TIMEOUT;
+	  break;
+	}
+    }
+
+  if (status < 0)
+    return status;
+
+  while (1)
+    {
+      status = recv (scb->fd, scb->buf, BUFSIZ, 0);
+      if (status != -1 || errno != EINTR)
+	break;
+    }
+
+  if (status <= 0)
+    {
+      if (status == 0)
+	return SERIAL_TIMEOUT;	/* 0 chars means timeout [may need to
+				   distinguish between EOF & timeouts
+				   someday] */
+      else
+	return SERIAL_ERROR;	/* Got an error from read */
+    }
+
+  scb->bufcnt = status;
+  scb->bufcnt--;
+  scb->bufp = scb->buf;
+  return *scb->bufp++;
+}
+
+/* Perform operations common to both old and new readchar. */
+
+/* Return the next character from the input FIFO.  If the FIFO is
+   empty, call the SERIAL specific routine to try and read in more
+   characters.
+
+   Initially data from the input FIFO is returned (fd_event()
+   pre-reads the input into that FIFO.  Once that has been emptied,
+   further data is obtained by polling the input FD using the device
+   specific readchar() function.  Note: reschedule() is called after
+   every read.  This is because there is no guarentee that the lower
+   level fd_event() poll_event() code (which also calls reschedule())
+   will be called. */
+
+static int
+generic_readchar (struct serial *scb, int timeout,
+		  int (do_readchar) (struct serial *scb, int timeout))
+{
+  int ch;
+  if (scb->bufcnt > 0)
+    {
+      ch = *scb->bufp;
+      scb->bufcnt--;
+      scb->bufp++;
+    }
+  else if (scb->bufcnt < 0)
+    {
+      /* Some errors/eof are are sticky. */
+      ch = scb->bufcnt;
+    }
+  else
+    {
+      ch = do_readchar (scb, timeout);
+      if (ch < 0)
+	{
+	  switch ((enum serial_rc) ch)
+	    {
+	    case SERIAL_EOF:
+	    case SERIAL_ERROR:
+	      /* Make the error/eof stick. */
+	      scb->bufcnt = ch;
+	      break;
+	    case SERIAL_TIMEOUT:
+	      scb->bufcnt = 0;
+	      break;
+	    }
+	}
+    }
+  reschedule (scb);
+  return ch;
+}
+
+int
+ser_mingw_readchar (struct serial *scb, int timeout)
+{
+  return generic_readchar (scb, timeout, do_mingw_readchar);
+}
+
+int
+ser_mingw_nop_noflush_set_tty_state (struct serial *scb,
+				    serial_ttystate new_ttystate,
+				    serial_ttystate old_ttystate)
+{
+  return 0;
+}
+
+void
+ser_mingw_nop_print_tty_state (struct serial *scb, 
+			      serial_ttystate ttystate,
+			      struct ui_file *stream)
+{
+  /* Nothing to print.  */
+  return;
+}
+
+int
+ser_mingw_nop_setbaudrate (struct serial *scb, int rate)
+{
+  return 0;			/* Never fails! */
+}
+
+int
+ser_mingw_nop_setstopbits (struct serial *scb, int num)
+{
+  return 0;			/* Never fails! */
+}
+
+int
+ser_mingw_write (struct serial *scb, const char *str, int len)
+{
+  int cc;
+
+  while (len > 0)
+    {
+      cc = send (scb->fd, str, len, 0);
+
+      if (cc < 0)
+	return 1;
+      len -= cc;
+      str += cc;
+    }
+  return 0;
+}
+
+int
+ser_mingw_nop_flush_output (struct serial *scb)
+{
+  return 0;
+}
+
+int
+ser_mingw_flush_input (struct serial *scb)
+{
+  if (scb->bufcnt >= 0)
+    {
+      scb->bufcnt = 0;
+      scb->bufp = scb->buf;
+      return 0;
+    }
+  else
+    return SERIAL_ERROR;
+}
+
+int
+ser_mingw_nop_send_break (struct serial *scb)
+{
+  return 0;
+}
+
+int
+ser_mingw_nop_drain_output (struct serial *scb)
+{
+  return 0;
+}
+
+
+
+/* Event handling for ASYNC serial code.
+
+   At any time the SERIAL device either: has an empty FIFO and is
+   waiting on a FD event; or has a non-empty FIFO/error condition and
+   is constantly scheduling timer events.
+
+   ASYNC only stops pestering its client when it is de-async'ed or it
+   is told to go away. */
+
+/* Value of scb->async_state: */
+enum {
+  /* >= 0 (TIMER_SCHEDULED) */
+  /* The ID of the currently scheduled timer event. This state is
+     rarely encountered.  Timer events are one-off so as soon as the
+     event is delivered the state is shanged to NOTHING_SCHEDULED. */
+  FD_SCHEDULED = -1,
+  /* The fd_event() handler is scheduled.  It is called when ever the
+     file descriptor becomes ready. */
+  NOTHING_SCHEDULED = -2
+  /* Either no task is scheduled (just going into ASYNC mode) or a
+     timer event has just gone off and the current state has been
+     forced into nothing scheduled. */
+};
+
+/* Identify and schedule the next ASYNC task based on scb->async_state
+   and scb->buf* (the input FIFO).  A state machine is used to avoid
+   the need to make redundant calls into the event-loop - the next
+   scheduled task is only changed when needed. */
+
+static void
+reschedule (struct serial *scb)
+{
+  if (serial_is_async_p (scb))
+    {
+      int next_state;
+      switch (scb->async_state)
+	{
+	case FD_SCHEDULED:
+	  if (scb->bufcnt == 0)
+	    next_state = FD_SCHEDULED;
+	  else
+	    {
+	      delete_file_handler (scb->fd);
+	      next_state = create_timer (0, push_event, scb);
+	    }
+	  break;
+	case NOTHING_SCHEDULED:
+	  if (scb->bufcnt == 0)
+	    {
+	      add_file_handler (scb->fd, fd_event, scb);
+	      next_state = FD_SCHEDULED;
+	    }
+	  else
+	    {
+	      next_state = create_timer (0, push_event, scb);
+	    }
+	  break;
+	default: /* TIMER SCHEDULED */
+	  if (scb->bufcnt == 0)
+	    {
+	      delete_timer (scb->async_state);
+	      add_file_handler (scb->fd, fd_event, scb);
+	      next_state = FD_SCHEDULED;
+	    }
+	  else
+	    next_state = scb->async_state;
+	  break;
+	}
+      if (serial_debug_p (scb))
+	{
+	  switch (next_state)
+	    {
+	    case FD_SCHEDULED:
+	      if (scb->async_state != FD_SCHEDULED)
+		fprintf_unfiltered (gdb_stdlog, "[fd%d->fd-scheduled]\n",
+				    scb->fd);
+	      break;
+	    default: /* TIMER SCHEDULED */
+	      if (scb->async_state == FD_SCHEDULED)
+		fprintf_unfiltered (gdb_stdlog, "[fd%d->timer-scheduled]\n",
+				    scb->fd);
+	      break;
+	    }
+	}
+      scb->async_state = next_state;
+    }
+}
+
+/* FD_EVENT: This is scheduled when the input FIFO is empty (and there
+   is no pending error).  As soon as data arrives, it is read into the
+   input FIFO and the client notified.  The client should then drain
+   the FIFO using readchar().  If the FIFO isn't immediatly emptied,
+   push_event() is used to nag the client until it is. */
+
+static void
+fd_event (int error, void *context)
+{
+  struct serial *scb = context;
+  if (error != 0)
+    {
+      scb->bufcnt = SERIAL_ERROR;
+    }
+  else if (scb->bufcnt == 0)
+    {
+      /* Prime the input FIFO.  The readchar() function is used to
+         pull characters out of the buffer.  See also
+         generic_readchar(). */
+      int nr;
+      do
+	{
+	  nr = read (scb->fd, scb->buf, BUFSIZ);
+	}
+      while (nr == -1 && errno == EINTR);
+      if (nr == 0)
+	{
+	  scb->bufcnt = SERIAL_EOF;
+	}
+      else if (nr > 0)
+	{
+	  scb->bufcnt = nr;
+	  scb->bufp = scb->buf;
+	}
+      else
+	{
+	  scb->bufcnt = SERIAL_ERROR;
+	}
+    }
+  scb->async_handler (scb, scb->async_context);
+  reschedule (scb);
+}
+
+/* PUSH_EVENT: The input FIFO is non-empty (or there is a pending
+   error).  Nag the client until all the data has been read.  In the
+   case of errors, the client will need to close or de-async the
+   device before naging stops. */
+
+static void
+push_event (void *context)
+{
+  struct serial *scb = context;
+  scb->async_state = NOTHING_SCHEDULED; /* Timers are one-off */
+  scb->async_handler (scb, scb->async_context);
+  /* re-schedule */
+  reschedule (scb);
+}
+
+/* Put the SERIAL device into/out-of ASYNC mode.  */
+
+void
+ser_mingw_async (struct serial *scb,
+		int async_p)
+{
+  if (async_p)
+    {
+      /* Force a re-schedule. */
+      scb->async_state = NOTHING_SCHEDULED;
+      if (serial_debug_p (scb))
+	fprintf_unfiltered (gdb_stdlog, "[fd%d->asynchronous]\n",
+			    scb->fd);
+      reschedule (scb);
+    }
+  else
+    {
+      if (serial_debug_p (scb))
+	fprintf_unfiltered (gdb_stdlog, "[fd%d->synchronous]\n",
+			    scb->fd);
+      /* De-schedule whatever tasks are currently scheduled. */
+      switch (scb->async_state)
+	{
+	case FD_SCHEDULED:
+	  delete_file_handler (scb->fd);
+	  break;
+	NOTHING_SCHEDULED:
+	  break;
+	default: /* TIMER SCHEDULED */
+	  delete_timer (scb->async_state);
+	  break;
+	}
+    }
+}
+
+void
+ser_platform_tcp_init (struct serial_ops *ops)
+{
+  ops->readchar = ser_mingw_readchar;
+  ops->write = ser_mingw_write;
+  ops->flush_output = ser_mingw_nop_flush_output;
+  ops->flush_input = ser_mingw_flush_input;
+  ops->send_break = ser_mingw_nop_send_break;
+  ops->go_raw = ser_mingw_nop_raw;
+  ops->get_tty_state = ser_mingw_nop_get_tty_state;
+  ops->set_tty_state = ser_mingw_nop_set_tty_state;
+  ops->print_tty_state = ser_mingw_nop_print_tty_state;
+  ops->noflush_set_tty_state = ser_mingw_nop_noflush_set_tty_state;
+  ops->setbaudrate = ser_mingw_nop_setbaudrate;
+  ops->setstopbits = ser_mingw_nop_setstopbits;
+  ops->drain_output = ser_mingw_nop_drain_output;
+  ops->async = ser_mingw_async;
+}
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/ser-mingw.h gdb-6.4-m68hc1x/gdb/ser-mingw.h
--- gdb-6.4/gdb/ser-mingw.h	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/ser-mingw.h	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,51 @@
+/* Serial interface for MinGW Winsock file-descriptor based connection.
+
+   Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef SER_MINGW_H
+#define SER_MINGW_H
+
+/* Generic MinGW Winsock functions */
+
+extern int ser_mingw_nop_flush_output (struct serial *scb);
+extern int ser_mingw_flush_input (struct serial *scb);
+extern int ser_mingw_nop_send_break (struct serial *scb);
+extern void ser_mingw_nop_raw (struct serial *scb);
+extern serial_ttystate ser_mingw_nop_get_tty_state (struct serial *scb);
+extern int ser_mingw_nop_set_tty_state (struct serial *scb,
+				       serial_ttystate ttystate);
+extern void ser_mingw_nop_print_tty_state (struct serial *scb,
+					  serial_ttystate ttystate,
+					  struct ui_file *stream);
+extern int ser_mingw_nop_noflush_set_tty_state (struct serial *scb,
+					       serial_ttystate new_ttystate,
+					       serial_ttystate old_ttystate);
+extern int ser_mingw_nop_setbaudrate (struct serial *scb, int rate);
+extern int ser_mingw_nop_setstopbits (struct serial *scb, int rate);
+extern int ser_mingw_nop_drain_output (struct serial *scb);
+
+extern int ser_mingw_wait_for (struct serial *scb, int timeout);
+extern int ser_mingw_readchar (struct serial *scb, int timeout);
+
+extern int ser_mingw_write (struct serial *scb, const char *str, int len);
+
+extern void ser_mingw_async (struct serial *scb, int async_p);
+
+#endif
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/serial.c gdb-6.4-m68hc1x/gdb/serial.c
--- gdb-6.4/gdb/serial.c	Mon Feb 21 05:31:58 2005
+++ gdb-6.4-m68hc1x/gdb/serial.c	Sat Jan 21 15:28:49 2006
@@ -329,12 +329,16 @@ do_serial_close (struct serial *scb, int
 void
 serial_close (struct serial *scb)
 {
+  if (!scb)
+    return;
   do_serial_close (scb, 1);
 }
 
 void
 serial_un_fdopen (struct serial *scb)
 {
+  if (!scb)
+    return;
   do_serial_close (scb, 0);
 }
 
@@ -343,6 +347,9 @@ serial_readchar (struct serial *scb, int
 {
   int ch;
 
+  if (!scb)
+    return 0;
+
   /* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
      code is finished. */
   if (0 && serial_is_async_p (scb) && timeout < 0)
@@ -384,6 +391,9 @@ serial_write (struct serial *scb, const 
       gdb_flush (serial_logfp);
     }
 
+  if (!scb)
+    return 0;
+
   return (scb->ops->write (scb, str, len));
 }
 
@@ -404,24 +414,33 @@ serial_printf (struct serial *desc, cons
 int
 serial_drain_output (struct serial *scb)
 {
+  if (!scb)
+    return 0;
   return scb->ops->drain_output (scb);
 }
 
 int
 serial_flush_output (struct serial *scb)
 {
+  if (!scb)
+    return 0;
   return scb->ops->flush_output (scb);
 }
 
 int
 serial_flush_input (struct serial *scb)
 {
+  if (!scb)
+    return 0;
   return scb->ops->flush_input (scb);
 }
 
 int
 serial_send_break (struct serial *scb)
 {
+  if (!scb)
+    return 0;
+
   if (serial_logfp != NULL)
     serial_logchar (serial_logfp, 'w', SERIAL_BREAK, 0);
 
@@ -431,18 +450,24 @@ serial_send_break (struct serial *scb)
 void
 serial_raw (struct serial *scb)
 {
+  if (!scb)
+    return;
   scb->ops->go_raw (scb);
 }
 
 serial_ttystate
 serial_get_tty_state (struct serial *scb)
 {
+  if (!scb)
+    return 0;
   return scb->ops->get_tty_state (scb);
 }
 
 int
 serial_set_tty_state (struct serial *scb, serial_ttystate ttystate)
 {
+  if (!scb)
+    return 0;
   return scb->ops->set_tty_state (scb, ttystate);
 }
 
@@ -451,6 +476,8 @@ serial_print_tty_state (struct serial *s
 			serial_ttystate ttystate,
 			struct ui_file *stream)
 {
+  if (!scb)
+    return;
   scb->ops->print_tty_state (scb, ttystate, stream);
 }
 
@@ -459,30 +486,40 @@ serial_noflush_set_tty_state (struct ser
 			      serial_ttystate new_ttystate,
 			      serial_ttystate old_ttystate)
 {
+  if (!scb)
+    return 0;
   return scb->ops->noflush_set_tty_state (scb, new_ttystate, old_ttystate);
 }
 
 int
 serial_setbaudrate (struct serial *scb, int rate)
 {
+  if (!scb)
+    return 0;
   return scb->ops->setbaudrate (scb, rate);
 }
 
 int
 serial_setstopbits (struct serial *scb, int num)
 {
+  if (!scb)
+    return 0;
   return scb->ops->setstopbits (scb, num);
 }
 
 int
 serial_can_async_p (struct serial *scb)
 {
+  if (!scb)
+    return 0;
   return (scb->ops->async != NULL);
 }
 
 int
 serial_is_async_p (struct serial *scb)
 {
+  if (!scb)
+    return 0;
   return (scb->ops->async != NULL) && (scb->async_handler != NULL);
 }
 
@@ -491,6 +528,9 @@ serial_async (struct serial *scb,
 	      serial_event_ftype *handler,
 	      void *context)
 {
+  if (!scb)
+    return;
+
   /* Only change mode if there is a need. */
   if ((scb->async_handler == NULL)
       != (handler == NULL))
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/signals/signals.c gdb-6.4-m68hc1x/gdb/signals/signals.c
--- gdb-6.4/gdb/signals/signals.c	Sun Jun  8 20:27:14 2003
+++ gdb-6.4-m68hc1x/gdb/signals/signals.c	Sat Jan 21 15:28:49 2006
@@ -44,6 +44,11 @@
 # endif
 #endif
 
+/* SCz: We need SIGTRAP for interaction with the gdb simulator  */
+#ifndef SIGTRAP
+# define SIGTRAP 5
+#endif
+
 /* This table must match in order and size the signals in enum target_signal
    in target.h.  */
 /* *INDENT-OFF* */
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/srec.h gdb-6.4-m68hc1x/gdb/srec.h
--- gdb-6.4/gdb/srec.h	Sat Apr 12 19:41:25 2003
+++ gdb-6.4-m68hc1x/gdb/srec.h	Sat Jan 21 15:28:49 2006
@@ -22,7 +22,8 @@ struct serial;
 
 void load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
 		int maxrecsize, int flags, int hashmark,
-		int (*waitack) (void));
+		int (*waitack) (void),
+                int (*serial_write) (struct serial*, char*, int));
 
 /* S-record capability flags */
 
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/ChangeLog.M68HC11 gdb-6.4-m68hc1x/gdb/testsuite/ChangeLog.M68HC11
--- gdb-6.4/gdb/testsuite/ChangeLog.M68HC11	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/gdb/testsuite/ChangeLog.M68HC11	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,22 @@
+2002-11-13  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gdb.base/huge.exp: Skip this test.
+	* gdb.fortran/types.exp: Likewise.
+	* gdb.fortran/exprs.exp: Don't run fortran float tests for 68HC11.
+
+2002-11-13  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gdb.base/remote.exp: Compile remote.c with -mshort for 68HC11.
+	* gdb.base/printcmds.exp: Run the test after we are in the main.
+	* gdb.base/break.exp: Fix test because there is also a marker4()
+	at line 46.
+
+2002-08-12  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gdb.trace/deltrace.exp: Don't fail if target does not support
+	trace points.
+	* gdb.trace/passcount.exp: Likewise.
+	* gdb.trace/save-trace.exp: Likewise.
+	* lib/gdb.exp: Don't run C++ test on 68HC11.
+	* gdb.threads/gcore-thread.exp: Don't run the test for 68HC11.
+	* gdb.asm/m68hc11.inc: New file.
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.base/huge.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.base/huge.exp
--- gdb-6.4/gdb/testsuite/gdb.base/huge.exp	Mon Feb  2 06:15:27 2004
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.base/huge.exp	Sat Jan 21 15:28:49 2006
@@ -32,7 +32,9 @@ set bug_id 0
 if [target_info exists gdb,skip_huge_test] {
     return;
 }
-
+if [istarget "m6811-*-*"] {
+    return;
+}
 set testfile "huge"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.base/printcmds.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.base/printcmds.exp
--- gdb-6.4/gdb/testsuite/gdb.base/printcmds.exp	Thu Feb 26 18:23:23 2004
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.base/printcmds.exp	Sat Jan 21 15:28:49 2006
@@ -694,9 +694,9 @@ gdb_test "set print address off" ""
 gdb_test "set width 0" ""
 
 if [set_lang_c] then {
-    gdb_test "p ctable1\[120\]" "120 'x'" "p ctable1\[120\] #1"
-
     if [runto_main] then {
+	gdb_test "p ctable1\[120\]" "120 'x'" "p ctable1\[120\] #1"
+
 	test_integer_literals_accepted
 	test_integer_literals_rejected
 	test_character_literals_accepted
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.base/remote.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.base/remote.exp
--- gdb-6.4/gdb/testsuite/gdb.base/remote.exp	Fri Sep 10 03:04:58 2004
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.base/remote.exp	Sat Jan 21 15:28:49 2006
@@ -36,7 +36,12 @@ set binfile ${objdir}/${subdir}/${testfi
 
 gdb_start
 
-set result [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}]
+# Must compile remote.c with 16-bit int
+if [istarget "m6811-*-*"] then {
+   set result [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-mshort}]
+} else {
+   set result [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}]
+}
 if {$result != "" } then {
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.fortran/exprs.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.fortran/exprs.exp
--- gdb-6.4/gdb/testsuite/gdb.fortran/exprs.exp	Tue Sep 20 08:37:03 2005
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.fortran/exprs.exp	Sat Jan 21 15:28:49 2006
@@ -280,7 +280,9 @@ if [set_lang_fortran] then {
     test_integer_literals_rejected
     test_logical_literals_accepted
     test_character_literals_accepted
-    test_float_literals_accepted
+    if {! [istarget "m6811-*-*"]} {
+        test_float_literals_accepted
+    }
     test_arithmetic_expressions
 } else {
     warning "$test_name tests suppressed." 0
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.fortran/types.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.fortran/types.exp
--- gdb-6.4/gdb/testsuite/gdb.fortran/types.exp	Mon Dec 16 20:33:53 2002
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.fortran/types.exp	Sat Jan 21 15:28:49 2006
@@ -109,7 +109,9 @@ if [set_lang_fortran] then {
     test_integer_literal_types_rejected
     test_logical_literal_types_accepted
     test_character_literal_types_accepted
-    test_float_literal_types_accepted
+    if {! [istarget "m6811-*-*"]} {
+        test_float_literal_types_accepted
+    }
 } else {
     warning "$test_name tests suppressed." 0
 }
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.threads/gcore-thread.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.threads/gcore-thread.exp
--- gdb-6.4/gdb/testsuite/gdb.threads/gcore-thread.exp	Mon Feb  2 06:15:27 2004
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.threads/gcore-thread.exp	Sat Jan 21 15:28:49 2006
@@ -24,6 +24,11 @@ if $tracelevel then {
 	strace $tracelevel
 }
 
+# Threads are not supported for 68HC11.
+if [istarget "m6811-*-*"] then {
+    return;
+}
+
 set prms_id 0
 set bug_id 0
 
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.trace/deltrace.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.trace/deltrace.exp
--- gdb-6.4/gdb/testsuite/gdb.trace/deltrace.exp	Tue Apr 17 22:16:31 2001
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.trace/deltrace.exp	Sat Jan 21 15:28:49 2006
@@ -50,6 +50,15 @@ gdb_reinitialize_dir $srcdir/$subdir
 
 gdb_file_cmd $binfile
 
+
+# We generously give ourselves one "pass" if we successfully 
+# detect that this test cannot be run on this target!
+if { ![gdb_target_supports_trace] } then {
+    pass "Current target does not supporst trace"
+    return 1;
+
+}
+
 # define relative source line numbers:
 # all subsequent line numbers are relative to this first one (baseline)
 set baseline [gdb_find_recursion_test_baseline $srcfile];
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.trace/passcount.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.trace/passcount.exp
--- gdb-6.4/gdb/testsuite/gdb.trace/passcount.exp	Tue Apr 17 22:16:31 2001
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.trace/passcount.exp	Sat Jan 21 15:28:49 2006
@@ -49,6 +49,14 @@ gdb_reinitialize_dir $srcdir/$subdir
 
 gdb_file_cmd $binfile
 
+# We generously give ourselves one "pass" if we successfully 
+# detect that this test cannot be run on this target!
+if { ![gdb_target_supports_trace] } then {
+    pass "Current target does not supporst trace"
+    return 1;
+
+}
+
 # define relative source line numbers:
 # all subsequent line numbers are relative to this first one (baseline)
 set baseline  [gdb_find_recursion_test_baseline $srcfile];
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/gdb.trace/save-trace.exp gdb-6.4-m68hc1x/gdb/testsuite/gdb.trace/save-trace.exp
--- gdb-6.4/gdb/testsuite/gdb.trace/save-trace.exp	Thu Aug  7 19:55:41 2003
+++ gdb-6.4-m68hc1x/gdb/testsuite/gdb.trace/save-trace.exp	Sat Jan 21 15:28:49 2006
@@ -58,6 +58,14 @@ if { $baseline == -1 } then {
     return;
 }
 
+# We generously give ourselves one "pass" if we successfully 
+# detect that this test cannot be run on this target!
+if { ![gdb_target_supports_trace] } then {
+    pass "Current target does not supporst trace"
+    return 1;
+
+}
+
 set testline1 [expr $baseline + 4]
 set testline2 [expr $baseline + 5]
 set testline3 [expr $baseline + 6]
diff --exclude-from=exclude.lst -Nrup gdb-6.4/gdb/testsuite/lib/gdb.exp gdb-6.4-m68hc1x/gdb/testsuite/lib/gdb.exp
--- gdb-6.4/gdb/testsuite/lib/gdb.exp	Wed Sep 28 00:39:03 2005
+++ gdb-6.4-m68hc1x/gdb/testsuite/lib/gdb.exp	Sat Jan 21 15:28:49 2006
@@ -1153,6 +1153,9 @@ proc skip_cplus_tests {} {
     if { [istarget "m6812-*-*"] } {
 	return 1
     }
+    if { [istarget "m6811-*-*"] } {
+	return 1
+    }
     return 0
 }
 
diff --exclude-from=exclude.lst -Nrup gdb-6.4/include/gdb/ChangeLog.M68HC11 gdb-6.4-m68hc1x/include/gdb/ChangeLog.M68HC11
--- gdb-6.4/include/gdb/ChangeLog.M68HC11	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/include/gdb/ChangeLog.M68HC11	Sun Jan 22 22:19:11 2006
@@ -0,0 +1,4 @@
+2006-01-22  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* remote-sim.h (SIGTRAP): Define for mingw32
+
diff --exclude-from=exclude.lst -Nrup gdb-6.4/include/gdb/remote-sim.h gdb-6.4-m68hc1x/include/gdb/remote-sim.h
--- gdb-6.4/include/gdb/remote-sim.h	Fri Feb 28 00:13:32 2003
+++ gdb-6.4-m68hc1x/include/gdb/remote-sim.h	Sat Jan 21 17:57:30 2006
@@ -22,6 +22,10 @@ Foundation, Inc., 59 Temple Place - Suit
 #if !defined (REMOTE_SIM_H)
 #define REMOTE_SIM_H 1
 
+#ifndef SIGTRAP
+#define SIGTRAP 5
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/ChangeLog.M68HC11 gdb-6.4-m68hc1x/sim/common/ChangeLog.M68HC11
--- gdb-6.4/sim/common/ChangeLog.M68HC11	Thu Jan  1 01:00:00 1970
+++ gdb-6.4-m68hc1x/sim/common/ChangeLog.M68HC11	Sat Jan 21 15:28:49 2006
@@ -0,0 +1,44 @@
+2004-08-03  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* callback.c (os_ftruncate): Don't compile on Mingw32.
+	(os_truncate): Likewise.
+	(default_callback): Use null for the above
+
+2004-02-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* aclocal.m4 (SIM_AC_COMMON): Check for winsock.h and bind().
+
+2003-10-05  Stephane Carrez  <stcarrez@nerim.fr>
+
+	From 2003-05-10 <fernando@seventh.com.br>
+	* sim-io.c (sim_io_poll_read): Fix reading of input keyboard on
+	Windows.
+
+2002-08-11  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* sim-core.h: Use address_word to specify the base and size
+	of the memory mapping (necessary when sizeof(address_word) >
+	sizeof(unsigned_word)).
+	* sim-memopt.h: Likewise.
+	* hw-base.c (panic_hw_io_read_buffer): Likewise.
+	(panic_hw_io_write_buffer): Likewise.
+	* sim-core.c (sim_core_write_buffer): Likewise for raddr.
+	(sim_core_read_buffer): Likewise.
+	* dv-glue.c (hw_glue_io_read_buffer): Likewise.
+	(hw_glue_io_write_buffer): Likewise.
+	* dv-pal.c (hw_pal_io_write_buffer): Likewise.
+	(hw_pal_io_read_buffer): Likewise.
+	* sim-hw.c (sim_hw_io_read_buffer): Likewise.
+	(sim_hw_io_write_buffer): Likewise.
+	(sim_cpu_hw_io_read_buffer): Likewise.
+	(sim_cpu_hw_io_write_buffer): Likewise.
+
+2002-08-11  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* hw-instances.c (panic_hw_instance_read): Use unsigned_cell for
+	the length to conform to hw_instance_read_method type.
+	* sim-profile.c (profile_print_addr_ranges): Compile only when
+	SIM_HAVE_ADDR_RANGE.
+	* sim-memopt.c: Include <unistd.h> for close prototype.
+	(do_memopt_add): Use %ld since bytes is a unsigned long.
+
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/aclocal.m4 gdb-6.4-m68hc1x/sim/common/aclocal.m4
--- gdb-6.4/sim/common/aclocal.m4	Wed Mar 23 19:55:14 2005
+++ gdb-6.4-m68hc1x/sim/common/aclocal.m4	Sat Jan 21 15:28:49 2006
@@ -53,11 +53,37 @@ AC_CHECK_HEADERS(stdlib.h string.h strin
 AC_CHECK_HEADERS(sys/time.h sys/resource.h)
 AC_CHECK_HEADERS(fcntl.h fpu_control.h)
 AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)
+AC_CHECK_HEADERS(winsock.h)
 AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
 
 # Check for socket libraries
 AC_CHECK_LIB(socket, bind)
 AC_CHECK_LIB(nsl, gethostbyname)
+
+dnl Check for Windows socket library.
+dnl We need a special program that include <winsock.h> and we must not
+dnl define bind() because the winsock definition can be special
+dnl (The real symbol for bind() seems to be bind@12)
+ac_save_libs="$LIBS"
+LIBS="-lwsock32 ${LIBS}"
+
+AC_MSG_CHECKING([for bind in -lwsock32])
+AC_TRY_LINK([#include <winsock.h>
+],[
+ bind(0, 0, 0);
+],found=yes, found=no)
+AC_MSG_RESULT($found)
+if test $found = yes; then
+  ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+  LIBS="-lwsock32 ${LIBS}"
+
+else
+  LIBS="$ac_save_libs"
+fi
 
 . ${srcdir}/../../bfd/configure.host
 
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/callback.c gdb-6.4-m68hc1x/sim/common/callback.c
--- gdb-6.4/sim/common/callback.c	Fri Jul  8 10:05:35 2005
+++ gdb-6.4-m68hc1x/sim/common/callback.c	Sat Jan 21 15:28:49 2006
@@ -584,6 +584,7 @@ os_lstat (p, file, buf)
 #endif
 }
 
+#if !defined(__MINGW32__)
 static int 
 os_ftruncate (p, fd, len)
      host_callback *p;
@@ -608,6 +609,7 @@ os_ftruncate (p, fd, len)
 #endif
   return result;
 }
+#endif
 
 static int
 os_truncate (p, file, len)
@@ -811,8 +813,12 @@ host_callback default_callback =
   os_fstat,
   os_lstat,
 
+#if defined(__MINGW32__)
+  0, 0,
+#else
   os_ftruncate,
   os_truncate,
+#endif
 
   os_pipe,
   os_pipe_empty,
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/dv-glue.c gdb-6.4-m68hc1x/sim/common/dv-glue.c
--- gdb-6.4/sim/common/dv-glue.c	Tue May 18 23:20:07 2004
+++ gdb-6.4-m68hc1x/sim/common/dv-glue.c	Sat Jan 21 15:28:49 2006
@@ -278,7 +278,7 @@ static unsigned
 hw_glue_io_read_buffer (struct hw *me,
 			void *dest,
 			int space,
-			unsigned_word addr,
+			address_word addr,
 			unsigned nr_bytes)
 {
   struct hw_glue *glue = (struct hw_glue *) hw_data (me);
@@ -298,7 +298,7 @@ static unsigned
 hw_glue_io_write_buffer (struct hw *me,
 			 const void *source,
 			 int space,
-			 unsigned_word addr,
+			 address_word addr,
 			 unsigned nr_bytes)
 {
   struct hw_glue *glue = (struct hw_glue *) hw_data (me);
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/dv-pal.c gdb-6.4-m68hc1x/sim/common/dv-pal.c
--- gdb-6.4/sim/common/dv-pal.c	Sat Nov 23 02:12:05 2002
+++ gdb-6.4-m68hc1x/sim/common/dv-pal.c	Sat Jan 21 15:28:49 2006
@@ -341,7 +341,7 @@ static unsigned
 hw_pal_io_read_buffer (struct hw *me,
 		       void *dest,
 		       int space,
-		       unsigned_word addr,
+		       address_word addr,
 		       unsigned nr_bytes)
 {
   hw_pal_device *hw_pal = (hw_pal_device *) hw_data (me);
@@ -426,7 +426,7 @@ static unsigned
 hw_pal_io_write_buffer (struct hw *me,
 			const void *source,
 			int space,
-			unsigned_word addr,
+			address_word addr,
 			unsigned nr_bytes)
 {
   hw_pal_device *hw_pal = (hw_pal_device*) hw_data (me);
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/dv-sockser.c gdb-6.4-m68hc1x/sim/common/dv-sockser.c
--- gdb-6.4/sim/common/dv-sockser.c	Fri Aug 11 02:48:51 2000
+++ gdb-6.4-m68hc1x/sim/common/dv-sockser.c	Sat Jan 21 15:28:49 2006
@@ -42,6 +42,9 @@ with this program; if not, write to the 
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/time.h>
+#ifdef _WIN32
+#include <winsock.h>
+#else
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
@@ -50,6 +53,7 @@ with this program; if not, write to the 
 #ifndef __CYGWIN32__
 #include <netinet/tcp.h>
 #endif
+#endif
 
 #include "sim-assert.h"
 #include "sim-options.h"
@@ -198,6 +202,7 @@ dv_sockser_init (SIM_DESC sd)
       return SIM_RC_OK;
     }
 
+#ifdef SIGPIPE
   /* Handle writes to missing client -> SIGPIPE.
      ??? Need a central signal management module.  */
   {
@@ -207,7 +212,7 @@ dv_sockser_init (SIM_DESC sd)
     if (orig != SIG_DFL && orig != SIG_IGN)
       signal (SIGPIPE, orig);
   }
-
+#endif
   return SIM_RC_OK;
 }
 
@@ -274,6 +279,7 @@ connected_p (SIM_DESC sd)
   if (sockser_fd < 0)
     return 0;
 
+#ifdef F_GETFL
   /* Set non-blocking i/o.  */
   flags = fcntl (sockser_fd, F_GETFL);
   flags |= O_NONBLOCK | O_NDELAY;
@@ -284,6 +290,7 @@ connected_p (SIM_DESC sd)
       sockser_fd = -1;
       return 0;
     }
+#endif
   return 1;
 }
 
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/hw-base.c gdb-6.4-m68hc1x/sim/common/hw-base.c
--- gdb-6.4/sim/common/hw-base.c	Sat Nov 23 02:12:05 2002
+++ gdb-6.4-m68hc1x/sim/common/hw-base.c	Sat Jan 21 15:28:49 2006
@@ -217,7 +217,7 @@ static unsigned
 panic_hw_io_read_buffer (struct hw *me,
 			 void *dest,
 			 int space,
-			 unsigned_word addr,
+			 address_word addr,
 			 unsigned nr_bytes)
 {
   hw_abort (me, "no io-read method");
@@ -228,7 +228,7 @@ static unsigned
 panic_hw_io_write_buffer (struct hw *me,
 			  const void *source,
 			  int space,
-			  unsigned_word addr,
+			  address_word addr,
 			  unsigned nr_bytes)
 {
   hw_abort (me, "no io-write method");
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/hw-device.h gdb-6.4-m68hc1x/sim/common/hw-device.h
--- gdb-6.4/sim/common/hw-device.h	Sat Nov 23 02:12:05 2002
+++ gdb-6.4-m68hc1x/sim/common/hw-device.h	Sat Jan 21 15:28:49 2006
@@ -231,7 +231,7 @@ typedef unsigned (hw_io_read_buffer_meth
      (struct hw *me,
       void *dest,
       int space,
-      unsigned_word addr,
+      address_word addr,
       unsigned nr_bytes);
 
 #define hw_io_read_buffer(hw, dest, space, addr, nr_bytes) \
@@ -244,7 +244,7 @@ typedef unsigned (hw_io_write_buffer_met
      (struct hw *me,
       const void *source,
       int space,
-      unsigned_word addr,
+      address_word addr,
       unsigned nr_bytes);
 
 #define hw_io_write_buffer(hw, src, space, addr, nr_bytes) \
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/hw-instances.c gdb-6.4-m68hc1x/sim/common/hw-instances.c
--- gdb-6.4/sim/common/hw-instances.c	Sat Nov 23 02:12:05 2002
+++ gdb-6.4-m68hc1x/sim/common/hw-instances.c	Sat Jan 21 15:28:49 2006
@@ -126,7 +126,7 @@ hw_instance_delete (struct hw_instance *
 static int
 panic_hw_instance_read (struct hw_instance *instance,
 			void *addr,
-			unsigned_word len)
+			unsigned_cell len)
 {
   hw_abort (hw_instance_hw (instance), "no read method");
   return -1;
@@ -137,7 +137,7 @@ panic_hw_instance_read (struct hw_instan
 static int
 panic_hw_instance_write (struct hw_instance *instance,
 			 const void *addr,
-			 unsigned_word len)
+			 unsigned_cell len)
 {
   hw_abort (hw_instance_hw (instance), "no write method");
   return -1;
@@ -146,8 +146,8 @@ panic_hw_instance_write (struct hw_insta
 
 static int
 panic_hw_instance_seek (struct hw_instance *instance,
-			unsigned_word pos_hi,
-			unsigned_word pos_lo)
+			unsigned_cell pos_hi,
+			unsigned_cell pos_lo)
 {
   hw_abort (hw_instance_hw (instance), "no seek method");
   return -1;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-core.c gdb-6.4-m68hc1x/sim/common/sim-core.c
--- gdb-6.4/sim/common/sim-core.c	Fri Dec 19 12:43:56 2003
+++ gdb-6.4-m68hc1x/sim/common/sim-core.c	Sat Jan 21 15:28:49 2006
@@ -518,7 +518,7 @@ sim_core_read_buffer (SIM_DESC sd,
   unsigned count = 0;
   while (count < len)
  {
-    unsigned_word raddr = addr + count;
+    address_word raddr = addr + count;
     sim_core_mapping *mapping =
       sim_core_find_mapping (core, map,
 			    raddr, /*nr-bytes*/1,
@@ -584,7 +584,7 @@ sim_core_write_buffer (SIM_DESC sd,
   unsigned count = 0;
   while (count < len)
     {
-      unsigned_word raddr = addr + count;
+      address_word raddr = addr + count;
       sim_core_mapping *mapping =
 	sim_core_find_mapping (core, map,
 			       raddr, /*nr-bytes*/1,
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-core.h gdb-6.4-m68hc1x/sim/common/sim-core.h
--- gdb-6.4/sim/common/sim-core.h	Sat Nov 23 02:12:05 2002
+++ gdb-6.4-m68hc1x/sim/common/sim-core.h	Sat Jan 21 15:28:49 2006
@@ -51,9 +51,9 @@ struct _sim_core_mapping {
   /* common */
   int level;
   int space;
-  unsigned_word base;
-  unsigned_word bound;
-  unsigned_word nr_bytes;
+  address_word base;
+  address_word bound;
+  address_word nr_bytes;
   unsigned mask;
   /* memory map */
   void *free_buffer;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-hw.c gdb-6.4-m68hc1x/sim/common/sim-hw.c
--- gdb-6.4/sim/common/sim-hw.c	Thu Jul 27 13:34:30 2000
+++ gdb-6.4-m68hc1x/sim/common/sim-hw.c	Sat Jan 21 15:28:49 2006
@@ -1,5 +1,5 @@
 /* Simulator hardware option handling.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
    Contributed by Cygnus Support and Andrew Cagney.
 
 This file is part of GDB, the GNU debugger.
@@ -339,7 +339,7 @@ sim_cpu_hw_io_read_buffer (sim_cpu *cpu,
 			   struct hw *hw,
 			   void *dest,
 			   int space,
-			   unsigned_word addr,
+			   address_word addr,
 			   unsigned nr_bytes)
 {
   SIM_DESC sd = CPU_STATE (cpu);
@@ -355,7 +355,7 @@ sim_cpu_hw_io_write_buffer (sim_cpu *cpu
 			    struct hw *hw,
 			    const void *source,
 			    int space,
-			    unsigned_word addr,
+			    address_word addr,
 			    unsigned nr_bytes)
 {
   SIM_DESC sd = CPU_STATE (cpu);
@@ -375,7 +375,7 @@ sim_hw_io_read_buffer (struct sim_state 
 		       struct hw *hw,
 		       void *dest,
 		       int space,
-		       unsigned_word addr,
+		       address_word addr,
 		       unsigned nr_bytes)
 {
   STATE_HW (sd)->cpu = NULL;
@@ -387,7 +387,7 @@ sim_hw_io_write_buffer (struct sim_state
 			struct hw *hw,
 			const void *source,
 			int space,
-			unsigned_word addr,
+			address_word addr,
 			unsigned nr_bytes)
 {
   STATE_HW (sd)->cpu = NULL;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-hw.h gdb-6.4-m68hc1x/sim/common/sim-hw.h
--- gdb-6.4/sim/common/sim-hw.h	Fri Apr 16 03:34:57 1999
+++ gdb-6.4-m68hc1x/sim/common/sim-hw.h	Sat Jan 21 15:28:49 2006
@@ -1,5 +1,5 @@
 /* Device definitions.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
@@ -62,7 +62,7 @@ void sim_cpu_hw_io_read_buffer
  struct hw *hw,
  void *dest,
  int space,
- unsigned_word addr,
+ address_word addr,
  unsigned nr_bytes);
 
 void sim_cpu_hw_io_write_buffer
@@ -71,7 +71,7 @@ void sim_cpu_hw_io_write_buffer
  struct hw *hw,
  const void *source,
  int space,
- unsigned_word addr,
+ address_word addr,
  unsigned nr_bytes);
 
 
@@ -83,7 +83,7 @@ unsigned sim_hw_io_read_buffer
  struct hw *hw,
  void *dest,
  int space,
- unsigned_word addr,
+ address_word addr,
  unsigned nr_bytes);
 
 unsigned sim_hw_io_write_buffer
@@ -91,7 +91,7 @@ unsigned sim_hw_io_write_buffer
  struct hw *hw,
  const void *source,
  int space,
- unsigned_word addr,
+ address_word addr,
  unsigned nr_bytes);
 
 
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-io.c gdb-6.4-m68hc1x/sim/common/sim-io.c
--- gdb-6.4/sim/common/sim-io.c	Sat Nov 23 02:12:05 2002
+++ gdb-6.4-m68hc1x/sim/common/sim-io.c	Sat Jan 21 15:28:49 2006
@@ -386,6 +386,15 @@ sim_io_poll_read (SIM_DESC sd,
     }
   return result;
 #else
+#ifdef _WIN32
+  /* For Windows, use _kbhit() to see whether some input is available.  */
+  if (sim_io_fd == STDIN_FILENO) {
+    int result = 0;
+    while (_kbhit() && result < sizeof_buf)
+      buf[result++] = _getch();
+    return result;
+  } else
+#endif
   return sim_io_read (sd, sim_io_fd, buf, sizeof_buf);
 #endif
 }
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-memopt.h gdb-6.4-m68hc1x/sim/common/sim-memopt.h
--- gdb-6.4/sim/common/sim-memopt.h	Tue Mar 20 18:13:39 2001
+++ gdb-6.4-m68hc1x/sim/common/sim-memopt.h	Sat Jan 21 15:28:49 2006
@@ -27,8 +27,8 @@ typedef struct _sim_memopt sim_memopt;
 struct _sim_memopt {
   int level;
   int space;
-  unsigned_word addr;
-  unsigned_word nr_bytes;
+  address_word addr;
+  address_word nr_bytes;
   unsigned modulo;
   void *buffer;
   unsigned long munmap_length;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-profile.c gdb-6.4-m68hc1x/sim/common/sim-profile.c
--- gdb-6.4/sim/common/sim-profile.c	Thu Feb 15 22:14:40 2001
+++ gdb-6.4-m68hc1x/sim/common/sim-profile.c	Sat Jan 21 15:28:49 2006
@@ -1050,6 +1050,7 @@ profile_print_speed (sim_cpu *cpu)
     }
 }
 
+#ifdef SIM_HAVE_ADDR_RANGE
 /* Print selected address ranges.  */
 
 static void
@@ -1070,6 +1071,7 @@ profile_print_addr_ranges (sim_cpu *cpu)
       sim_io_printf (sd, "\n");
     }
 }
+#endif
 
 /* Top level function to print all summary profile information.
    It is [currently] intended that all such data is printed by this function.
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-signal.c gdb-6.4-m68hc1x/sim/common/sim-signal.c
--- gdb-6.4/sim/common/sim-signal.c	Fri Apr 16 03:34:59 1999
+++ gdb-6.4-m68hc1x/sim/common/sim-signal.c	Sat Jan 21 15:28:49 2006
@@ -27,7 +27,7 @@ with this program; if not, write to the 
    to not think the process has died (so it can be debugged at the point of
    failure).  */
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
 #ifndef SIGTRAP
 #define SIGTRAP 5
 #endif
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/common/sim-trace.c gdb-6.4-m68hc1x/sim/common/sim-trace.c
--- gdb-6.4/sim/common/sim-trace.c	Fri Oct 31 06:32:46 2003
+++ gdb-6.4-m68hc1x/sim/common/sim-trace.c	Sat Jan 21 15:28:49 2006
@@ -241,7 +241,9 @@ trace_option_handler (SIM_DESC sd, sim_c
 		      char *arg, int is_command)
 {
   int n;
+#ifdef SIM_HAVE_ADDR_RANGE
   int cpu_nr;
+#endif
 
   switch (opt)
     {
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/m68hc11/configure gdb-6.4-m68hc1x/sim/m68hc11/configure
--- gdb-6.4/sim/m68hc11/configure	Wed Mar 23 19:55:17 2005
+++ gdb-6.4-m68hc1x/sim/m68hc11/configure	Sat Jan 21 15:28:49 2006
@@ -6800,6 +6800,45 @@ _ACEOF
 fi
 
 
+ac_save_libs="$LIBS"
+LIBS="-lwsock32 ${LIBS}"
+
+echo $ac_n "checking for bind in -lwsock32""... $ac_c" 1>&6
+echo "configure:3297: checking for bind in -lwsock32" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3299 "configure"
+#include "confdefs.h"
+#include <winsock.h>
+
+int main() {
+
+ bind(0, 0, 0);
+
+; return 0; }
+EOF
+if { (eval echo configure:3309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  found=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  found=no
+fi
+rm -f conftest*
+echo "$ac_t""$found" 1>&6
+if test $found = yes; then
+  ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+  LIBS="-lwsock32 ${LIBS}"
+
+else
+  LIBS="$ac_save_libs"
+fi
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/m68hc11/dv-m68hc11.c gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11.c
--- gdb-6.4/sim/m68hc11/dv-m68hc11.c	Fri Aug  8 23:00:55 2003
+++ gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11.c	Sat Jan 21 15:28:50 2006
@@ -831,7 +831,7 @@ static unsigned
 m68hc11cpu_io_read_buffer (struct hw *me,
 			   void *dest,
 			   int space,
-			   unsigned_word base,
+			   address_word base,
 			   unsigned nr_bytes)
 {
   SIM_DESC sd;
@@ -981,7 +981,7 @@ m68hc11cpu_set_port (struct hw *me, sim_
 
 static void
 m68hc11cpu_io_write (struct hw *me, sim_cpu *cpu,
-                     unsigned_word addr, uint8 val)
+                     address_word addr, uint8 val)
 {
   switch (addr)
     {
@@ -1079,7 +1079,7 @@ static unsigned
 m68hc11cpu_io_write_buffer (struct hw *me,
 			    const void *source,
 			    int space,
-			    unsigned_word base,
+			    address_word base,
 			    unsigned nr_bytes)
 {
   SIM_DESC sd;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/m68hc11/dv-m68hc11eepr.c gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11eepr.c
--- gdb-6.4/sim/m68hc11/dv-m68hc11eepr.c	Tue Aug 13 11:01:16 2002
+++ gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11eepr.c	Sat Jan 21 15:28:50 2006
@@ -393,7 +393,7 @@ static unsigned
 m68hc11eepr_io_read_buffer (struct hw *me,
 			    void *dest,
 			    int space,
-			    unsigned_word base,
+			    address_word base,
 			    unsigned nr_bytes)
 {
   SIM_DESC sd;
@@ -448,7 +448,7 @@ static unsigned
 m68hc11eepr_io_write_buffer (struct hw *me,
 			     const void *source,
 			     int space,
-			     unsigned_word base,
+			     address_word base,
 			     unsigned nr_bytes)
 {
   SIM_DESC sd;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/m68hc11/dv-m68hc11sio.c gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11sio.c
--- gdb-6.4/sim/m68hc11/dv-m68hc11sio.c	Fri Aug  8 23:02:24 2003
+++ gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11sio.c	Sat Jan 21 15:28:50 2006
@@ -492,7 +492,7 @@ static unsigned
 m68hc11sio_io_read_buffer (struct hw *me,
                            void *dest,
                            int space,
-                           unsigned_word base,
+                           address_word base,
                            unsigned nr_bytes)
 {
   SIM_DESC sd;
@@ -537,7 +537,7 @@ static unsigned
 m68hc11sio_io_write_buffer (struct hw *me,
                             const void *source,
                             int space,
-                            unsigned_word base,
+                            address_word base,
                             unsigned nr_bytes)
 {
   SIM_DESC sd;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/m68hc11/dv-m68hc11spi.c gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11spi.c
--- gdb-6.4/sim/m68hc11/dv-m68hc11spi.c	Fri Aug  8 23:02:24 2003
+++ gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11spi.c	Sat Jan 21 15:28:50 2006
@@ -381,7 +381,7 @@ static unsigned
 m68hc11spi_io_read_buffer (struct hw *me,
                            void *dest,
                            int space,
-                           unsigned_word base,
+                           address_word base,
                            unsigned nr_bytes)
 {
   SIM_DESC sd;
@@ -426,7 +426,7 @@ static unsigned
 m68hc11spi_io_write_buffer (struct hw *me,
                             const void *source,
                             int space,
-                            unsigned_word base,
+                            address_word base,
                             unsigned nr_bytes)
 {
   SIM_DESC sd;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/m68hc11/dv-m68hc11tim.c gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11tim.c
--- gdb-6.4/sim/m68hc11/dv-m68hc11tim.c	Fri Aug  8 23:02:24 2003
+++ gdb-6.4-m68hc1x/sim/m68hc11/dv-m68hc11tim.c	Sat Jan 21 15:28:50 2006
@@ -638,7 +638,7 @@ static unsigned
 m68hc11tim_io_read_buffer (struct hw *me,
                            void *dest,
                            int space,
-                           unsigned_word base,
+                           address_word base,
                            unsigned nr_bytes)
 {
   SIM_DESC sd;
@@ -687,7 +687,7 @@ static unsigned
 m68hc11tim_io_write_buffer (struct hw *me,
                             const void *source,
                             int space,
-                            unsigned_word base,
+                            address_word base,
                             unsigned nr_bytes)
 {
   SIM_DESC sd;
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/m68hc11/dv-nvram.c gdb-6.4-m68hc1x/sim/m68hc11/dv-nvram.c
--- gdb-6.4/sim/m68hc11/dv-nvram.c	Fri Nov 24 21:53:35 2000
+++ gdb-6.4-m68hc1x/sim/m68hc11/dv-nvram.c	Sat Jan 21 15:28:50 2006
@@ -258,7 +258,7 @@ static unsigned
 nvram_io_read_buffer (struct hw *me,
                       void *dest,
                       int space,
-                      unsigned_word base,
+                      address_word base,
                       unsigned nr_bytes)
 {
   struct nvram *controller = hw_data (me);
@@ -281,7 +281,7 @@ static unsigned
 nvram_io_write_buffer (struct hw *me,
                        const void *source,
                        int space,
-                       unsigned_word base,
+                       address_word base,
                        unsigned nr_bytes)
 {
   struct nvram *controller = hw_data (me);
diff --exclude-from=exclude.lst -Nrup gdb-6.4/sim/m68hc11/m68hc11_sim.c gdb-6.4-m68hc1x/sim/m68hc11/m68hc11_sim.c
--- gdb-6.4/sim/m68hc11/m68hc11_sim.c	Fri Aug  8 23:00:55 2003
+++ gdb-6.4-m68hc1x/sim/m68hc11/m68hc11_sim.c	Sat Jan 21 15:28:50 2006
@@ -291,8 +291,8 @@ cpu_get_indexed_operand_addr (sim_cpu* c
 	  return 0;
 	}
       reg = (code >> 3) & 0x03;
-      addr = cpu_get_reg (cpu, reg);
-      addr += cpu_fetch16 (cpu);
+      addr = cpu_fetch16 (cpu);
+      addr += cpu_get_reg (cpu, reg);
       addr = memory_read16 (cpu, addr);
       cpu_add_cycles (cpu, 1);
     }
@@ -765,7 +765,7 @@ cpu_special (sim_cpu *cpu, enum M6811_Sp
     case M6811_WAI:
       /* In the ELF-start mode, we are in a special mode where
 	 the WAI corresponds to an exit.  */
-      if (cpu->cpu_use_elf_start)
+      if (cpu->cpu_use_elf_start || 1)
         {
           cpu_set_pc (cpu, cpu->cpu_insn_pc);
           sim_engine_halt (CPU_STATE (cpu), cpu,