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
|
diff -Nru a/Makefile b/Makefile
--- a/Makefile Sat May 26 15:06:42 2001
+++ b/Makefile Sat May 26 15:06:42 2001
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 0
-EXTRAVERSION = -test1
+EXTRAVERSION = -test1-rtl
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
diff -Nru a/arch/alpha/config.in b/arch/alpha/config.in
--- a/arch/alpha/config.in Sat May 26 15:06:42 2001
+++ b/arch/alpha/config.in Sat May 26 15:06:42 2001
@@ -52,6 +52,11 @@
SX164 CONFIG_ALPHA_SX164 \
Sable CONFIG_ALPHA_SABLE \
Takara CONFIG_ALPHA_TAKARA" Generic
+bool 'RTLinux (Real-Time) Support' CONFIG_RTLINUX
+
+if [ "$CONFIG_RTLINUX" = "y" ]; then
+ define_bool CONFIG_RTL y
+fi
# clear all implied options (don't want default values for those):
unset CONFIG_ALPHA_EV4 CONFIG_ALPHA_EV5 CONFIG_ALPHA_EV6
diff -Nru a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
--- a/arch/alpha/kernel/alpha_ksyms.c Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/alpha_ksyms.c Sat May 26 15:06:42 2001
@@ -16,6 +16,7 @@
#include <linux/pci.h>
#include <linux/tty.h>
#include <linux/mm.h>
+#include <linux/irq.h>
#include <asm/io.h>
#include <asm/hwrpb.h>
@@ -29,15 +30,22 @@
#include <asm/machvec.h>
#include <asm/pgalloc.h>
#include <asm/semaphore.h>
+#include "irq_impl.h"
#define __KERNEL_SYSCALLS__
#include <asm/unistd.h>
+#include "proto.h"
+
extern struct hwrpb_struct *hwrpb;
extern void dump_thread(struct pt_regs *, struct user *);
extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
extern spinlock_t kernel_flag;
extern spinlock_t rtc_lock;
+irq_desc_t irq_desc[NR_IRQS];
+extern void ret_from_sys_call(void);
+extern void restore_all(void);
+extern void restore_all_rtl(void);
/* these are C runtime functions with special calling conventions: */
extern void __divl (void);
@@ -56,6 +64,7 @@
EXPORT_SYMBOL(probe_irq_mask);
EXPORT_SYMBOL(screen_info);
EXPORT_SYMBOL(perf_irq);
+EXPORT_SYMBOL(irq_desc);
/* platform dependent support */
EXPORT_SYMBOL(_inb);
@@ -227,3 +236,59 @@
EXPORT_SYMBOL_NOVERS(memset);
EXPORT_SYMBOL(get_wchan);
+
+#ifdef CONFIG_RTLINUX
+EXPORT_SYMBOL(linux_soft_sti);
+EXPORT_SYMBOL(__swpipl);
+EXPORT_SYMBOL(__rdps);
+EXPORT_SYMBOL(handle_irq);
+EXPORT_SYMBOL(restore_all);
+EXPORT_SYMBOL(restore_all_rtl);
+EXPORT_SYMBOL(ret_from_sys_call);
+extern struct console *console_drivers;
+EXPORT_SYMBOL(console_drivers);
+extern spinlock_t console_lock;
+EXPORT_SYMBOL(console_lock);
+EXPORT_SYMBOL(do_softirq);
+extern unsigned long rtlinux_do_entArith, rtlinux_do_entIF,
+ rtlinux_do_page_fault, rtlinux_do_entDbg, rtlinux_do_entUna,
+ rtlinux_sys_call_table;
+EXPORT_SYMBOL(rtlinux_do_entIF);
+EXPORT_SYMBOL(rtlinux_do_entArith);
+EXPORT_SYMBOL(rtlinux_do_page_fault);
+EXPORT_SYMBOL(rtlinux_do_entDbg);
+EXPORT_SYMBOL(rtlinux_do_entUna);
+EXPORT_SYMBOL(rtlinux_sys_call_table);
+extern void do_entArith(unsigned long summary, unsigned long write_mask,
+ unsigned long a2, unsigned long a3, unsigned long a4,
+ unsigned long a5, struct pt_regs regs);
+EXPORT_SYMBOL(do_entArith);
+extern void do_entIF(unsigned long type, unsigned long a1,
+ unsigned long a2, unsigned long a3, unsigned long a4,
+ unsigned long a5, struct pt_regs regs);
+EXPORT_SYMBOL(do_entIF);
+extern void do_page_fault(unsigned long address, unsigned long mmcsr,
+ long cause, struct pt_regs *regs);
+EXPORT_SYMBOL(do_page_fault);
+extern void do_entDbg(unsigned long type, unsigned long a1,
+ unsigned long a2, unsigned long a3, unsigned long a4,
+ unsigned long a5, struct pt_regs regs);
+EXPORT_SYMBOL(do_entDbg);
+struct allregs {
+ unsigned long regs[32];
+ unsigned long ps, pc, gp, a0, a1, a2;
+};
+extern void do_entUna(void * va, unsigned long opcode, unsigned long reg,
+ unsigned long a3, unsigned long a4, unsigned long a5,
+ struct allregs regs);
+EXPORT_SYMBOL(do_entUna);
+extern unsigned search_exception_table(unsigned long addr);
+EXPORT_SYMBOL(search_exception_table);
+#ifdef CONFIG_SMP
+EXPORT_SYMBOL(__cpu_logical_map);
+EXPORT_SYMBOL(smp_call_function);
+extern void (*smp_percpu_timer_interrupt)(struct pt_regs *);
+EXPORT_SYMBOL(smp_percpu_timer_interrupt);
+EXPORT_SYMBOL(handle_ipi);
+#endif /* CONFIG_SMP */
+#endif /* CONFIG_RTLINUX */
diff -Nru a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
--- a/arch/alpha/kernel/entry.S Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/entry.S Sat May 26 15:06:42 2001
@@ -152,7 +152,43 @@
/* handle the fault */
lda $8,0x3fff
bic $30,$8,$8
+#ifdef CONFIG_RTLINUX
+ /* check if the RTLinux debugger is loaded */
+ lda $1,rtlinux_do_page_fault
+ ldq $3,0($1)
+ beq $3,1f
+
+ mov $3,$27
+ /* save arg regs */
+ subq $30,56,$30
+ stq $16,0($30)
+ stq $17,8($30)
+ stq $18,16($30)
+ stq $19,24($30)
+ stq $20,32($30)
+ stq $21,40($30)
+ stq $22,48($30)
+ /* call the RTLinux debugger */
+ jsr $26,($27),0
+ ldgp $29,0($26)
+ /* restore arg regs */
+ ldq $16,0($30)
+ ldq $17,8($30)
+ ldq $18,16($30)
+ ldq $19,24($30)
+ ldq $20,32($30)
+ ldq $21,40($30)
+ ldq $22,48($30)
+ addq $30,56,$30
+ /* check the return value of RTLinux debugger */
+ beq $0,1f
+ br 2f
+1:
+#endif /* CONFIG_RTLINUX */
jsr $26,do_page_fault
+#ifdef CONFIG_RTLINUX
+2:
+#endif /* CONFIG_RTLINUX */
/* reload the registers after the exception code played. */
ldq $9,0($30)
ldq $10,8($30)
@@ -172,8 +208,41 @@
entArith:
SAVE_ALL
lda $8,0x3fff
- lda $26,ret_from_sys_call
bic $30,$8,$8
+#ifdef CONFIG_RTLINUX
+ /* check if the RTLinux debugger wants this trap */
+ lda $1,rtlinux_do_entArith
+ ldq $3,0($1)
+ beq $3,1f
+
+ mov $3,$27
+ /* save arg regs */
+ subq $30,56,$30
+ stq $16,0($30)
+ stq $17,8($30)
+ stq $18,16($30)
+ stq $19,24($30)
+ stq $20,32($30)
+ stq $21,40($30)
+ stq $22,48($30)
+ /* call the RTLinux debugger */
+ jsr $26,($27),0
+ ldgp $29,0($26)
+ /* restore arg regs */
+ ldq $16,0($30)
+ ldq $17,8($30)
+ ldq $18,16($30)
+ ldq $19,24($30)
+ ldq $20,32($30)
+ ldq $21,40($30)
+ ldq $22,48($30)
+ addq $30,56,$30
+ /* check the return value of RTLinux debugger */
+ beq $0,1f
+ br ret_from_sys_call
+1:
+#endif /* CONFIG_RTLINUX */
+ lda $26,ret_from_sys_call
jsr $31,do_entArith
.end entArith
@@ -183,8 +252,41 @@
entIF:
SAVE_ALL
lda $8,0x3fff
- lda $26,ret_from_sys_call
bic $30,$8,$8
+#ifdef CONFIG_RTLINUX
+ /* check if the RTLinux debugger wants this trap */
+ lda $1,rtlinux_do_entIF
+ ldq $3,0($1)
+ beq $3,1f
+
+ mov $3,$27
+ /* save arg regs */
+ subq $30,56,$30
+ stq $16,0($30)
+ stq $17,8($30)
+ stq $18,16($30)
+ stq $19,24($30)
+ stq $20,32($30)
+ stq $21,40($30)
+ stq $22,48($30)
+ /* call the RTLinux debugger */
+ jsr $26,($27),0
+ ldgp $29,0($26)
+ /* restore arg regs */
+ ldq $16,0($30)
+ ldq $17,8($30)
+ ldq $18,16($30)
+ ldq $19,24($30)
+ ldq $20,32($30)
+ ldq $21,40($30)
+ ldq $22,48($30)
+ addq $30,56,$30
+ /* check the return value of RTLinux debugger */
+ beq $0,1f
+ br ret_from_sys_call
+1:
+#endif /* CONFIG_RTLINUX */
+ lda $26,ret_from_sys_call
jsr $31,do_entIF
.end entIF
@@ -194,8 +296,41 @@
entDbg:
SAVE_ALL
lda $8,0x3fff
- lda $26,ret_from_sys_call
bic $30,$8,$8
+#ifdef CONFIG_RTLINUX
+ /* check if the RTLinux debugger is loaded */
+ lda $1,rtlinux_do_entDbg
+ ldq $3,0($1)
+ beq $3,1f
+
+ mov $3,$27
+ /* save arg regs */
+ subq $30,56,$30
+ stq $16,0($30)
+ stq $17,8($30)
+ stq $18,16($30)
+ stq $19,24($30)
+ stq $20,32($30)
+ stq $21,40($30)
+ stq $22,48($30)
+ /* call the RTLinux debugger */
+ jsr $26,($27),0
+ ldgp $29,0($26)
+ /* restore arg regs */
+ ldq $16,0($30)
+ ldq $17,8($30)
+ ldq $18,16($30)
+ ldq $19,24($30)
+ ldq $20,32($30)
+ ldq $21,40($30)
+ ldq $22,48($30)
+ addq $30,56,$30
+ /* check the return value of RTLinux debugger */
+ beq $0,1f
+ br $26,ret_from_sys_call
+1:
+#endif /* CONFIG_RTLINUX */
+ lda $26,ret_from_sys_call
jsr $31,do_entDbg
.end entDbg
@@ -423,6 +558,68 @@
lda $8,0x3fff
stq $31,248($30)
bic $30,$8,$8
+#ifdef CONFIG_RTLINUX
+ /* check if the RTLinux debugger wants this trap */
+ lda $1,rtlinux_do_entUna
+ ldq $3,0($1)
+ beq $3,1f
+
+ mov $3,$27
+ /* save arg regs */
+ subq $30,56,$30
+ stq $16,0($30)
+ stq $17,8($30)
+ stq $18,16($30)
+ stq $19,24($30)
+ stq $20,32($30)
+ stq $21,40($30)
+ stq $22,48($30)
+ /* call the RTLinux debugger */
+ jsr $26,($27),0
+ ldgp $29,0($26)
+ /* restore arg regs */
+ ldq $16,0($30)
+ ldq $17,8($30)
+ ldq $18,16($30)
+ ldq $19,24($30)
+ ldq $20,32($30)
+ ldq $21,40($30)
+ ldq $22,48($30)
+ addq $30,56,$30
+ ldq $0,0($30)
+ ldq $1,8($30)
+ ldq $2,16($30)
+ ldq $3,24($30)
+ ldq $4,32($30)
+ ldq $5,40($30)
+ ldq $6,48($30)
+ ldq $7,56($30)
+ ldq $8,64($30)
+ ldq $9,72($30)
+ ldq $10,80($30)
+ ldq $11,88($30)
+ ldq $12,96($30)
+ ldq $13,104($30)
+ ldq $14,112($30)
+ ldq $15,120($30)
+ /* 16-18 PAL-saved */
+ ldq $19,152($30)
+ ldq $20,160($30)
+ ldq $21,168($30)
+ ldq $22,176($30)
+ ldq $23,184($30)
+ ldq $24,192($30)
+ ldq $25,200($30)
+ ldq $26,208($30)
+ ldq $27,216($30)
+ ldq $28,224($30)
+ ldq $29,232($30)
+ lda $30,256($30)
+ /* check the return value of RTLinux debugger */
+ beq $0,1f
+ br ret_from_sys_call
+1:
+#endif /* CONFIG_RTLINUX */
jsr $26,do_entUna
ldq $0,0($30)
ldq $1,8($30)
@@ -565,6 +762,21 @@
bne $3,strace
beq $4,1f
ldq $27,0($5)
+#ifdef CONFIG_RTLINUX
+ /* check if the RTLinux debugger wants this trap */
+ lda $1, rtlinux_sys_call_table
+ ldq $3, 0($1)
+ beq $3, 1f
+
+ /* call the RTLinux debugger */
+ mov $3, $27
+ jsr $26, ($27), 0
+ ldgp $29, 0($26)
+ blt $0,syscall_error /* the call failed */
+ stq $0,0($30)
+ stq $31,72($30) /* a3=0 => no error */
+ br ret_from_sys_call
+#endif /* CONFIG_RTLINUX */
1: jsr $26,($27),alpha_ni_syscall
ldgp $29,0($26)
blt $0,syscall_error /* the call failed */
@@ -578,11 +790,23 @@
lda $4,softirq_state
sll $3,5,$3
addq $3,$4,$4
+.globl cort_1
+ cort_1:
ldq $4,0($4)
sll $4,32,$3
and $4,$3,$4
bne $4,handle_softirq
ret_from_softirq:
+#ifdef CONFIG_RTLINUX
+ lda $1,linux_soft_sti
+ ldq $3,0($1)
+ beq $3,1f
+
+ mov $3,$27
+ jsr $26,($27),0
+ ldgp $29,0($26)
+1:
+#endif /* CONFIG_RTLINUX */
ldq $0,SP_OFF($30)
and $0,8,$0
beq $0,restore_all
@@ -594,7 +818,20 @@
ldl $5,TASK_SIGPENDING($8)
beq $4,restore_all
bne $5,signal_return
+ .globl restore_all
restore_all:
+#ifdef CONFIG_RTLINUX
+ lda $1,linux_soft_sti
+ ldq $3,0($1)
+ beq $3,1f
+
+ mov $3,$27
+ jsr $26,($27),0
+ ldgp $29,0($26)
+1:
+#endif /* CONFIG_RTLINUX */
+ .globl restore_all_rtl
+restore_all_rtl:
RESTORE_ALL
call_pal PAL_rti
diff -Nru a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
--- a/arch/alpha/kernel/irq.c Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/irq.c Sat May 26 15:06:42 2001
@@ -29,6 +29,9 @@
#include <asm/bitops.h>
#include <asm/uaccess.h>
+#include "proto.h"
+#include "irq_impl.h"
+
/*
* Controller mappings for all interrupt sources:
*/
@@ -83,9 +86,9 @@
status = 1; /* Force the "do bottom halves" bit */
do {
- if (!(action->flags & SA_INTERRUPT))
+ if (!(action->flags & SA_INTERRUPT))
__sti();
- else
+ else
__cli();
status |= action->flags;
@@ -563,6 +566,11 @@
return p - buf;
}
+#ifdef CONFIG_RTLINUX
+unsigned long linux_soft_sti;
+unsigned long (*__rdps)(void) = rdps;
+unsigned long (*__swpipl)(unsigned long) = swpipl;
+#endif /* CONFIG_RTLINUX */
/*
* do_IRQ handles all normal device IRQ's (the special
@@ -570,7 +578,11 @@
* handlers).
*/
void
+#ifdef CONFIG_RTLINUX
+hard_handle_irq(int irq, struct pt_regs * regs)
+#else
handle_irq(int irq, struct pt_regs * regs)
+#endif /* CONFIG_RTLINUX */
{
/*
* We ack quickly, we don't want the irq controller
@@ -595,6 +607,18 @@
}
irq_attempt(cpu, irq)++;
+#ifdef CONFIG_RTLINUX
+ /*
+ * Special case check (hack) for RTLinux SMP on alpha.
+ * We want control to end up in the rtlinux intercept routine
+ * which doesn't happen for RTC interrupts on non-primary cpus
+ * so add this check to make sure it does.
+ * -- Cort
+ */
+ if ((cpu != boot_cpuid) && (irq == RTC_IRQ))
+ return;
+#endif /* CONFIG_RTLINUX */
+
spin_lock_irq(&desc->lock); /* mask also the higher prio events */
desc->handler->ack(irq);
/*
@@ -653,6 +677,10 @@
desc->handler->end(irq);
spin_unlock(&desc->lock);
}
+
+#ifdef CONFIG_RTLINUX
+void (*handle_irq)(int irq, struct pt_regs * regs) = hard_handle_irq;
+#endif /* CONFIG_RTLINUX */
/*
* IRQ autodetection code..
diff -Nru a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
--- a/arch/alpha/kernel/irq_alpha.c Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/irq_alpha.c Sat May 26 15:06:42 2001
@@ -66,12 +66,16 @@
long cpu;
smp_percpu_timer_interrupt(®s);
cpu = smp_processor_id();
+#if !(defined(CONFIG_RTLINUX) && defined(CONFIG_SMP))
if (cpu != boot_cpuid) {
irq_attempt(cpu, RTC_IRQ)++;
kstat.irqs[cpu][RTC_IRQ]++;
} else {
+#endif
handle_irq(RTC_IRQ, ®s);
+#if !(defined(CONFIG_RTLINUX) && defined(CONFIG_SMP))
}
+#endif
}
#else
handle_irq(RTC_IRQ, ®s);
diff -Nru a/arch/alpha/kernel/irq_impl.h b/arch/alpha/kernel/irq_impl.h
--- a/arch/alpha/kernel/irq_impl.h Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/irq_impl.h Sat May 26 15:06:42 2001
@@ -8,10 +8,10 @@
* with the IRQ handling routines in irq.c.
*/
+#include <linux/config.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
-
#define RTC_IRQ 8
extern void isa_device_interrupt(unsigned long, struct pt_regs *);
@@ -38,7 +38,13 @@
extern struct hw_interrupt_type i8259a_irq_type;
extern void init_i8259a_irqs(void);
+#ifdef CONFIG_RTLINUX
+extern unsigned long linux_soft_sti, rtl_last_cli;
+extern void (*handle_irq)(int irq, struct pt_regs * regs);
+extern void hard_handle_irq(int irq, struct pt_regs * regs);
+#else
extern void handle_irq(int irq, struct pt_regs * regs);
+#endif /* CONFIG_RTLINUX */
extern unsigned long prof_cpu_mask;
diff -Nru a/arch/alpha/kernel/irq_smp.c b/arch/alpha/kernel/irq_smp.c
--- a/arch/alpha/kernel/irq_smp.c Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/irq_smp.c Sat May 26 15:06:42 2001
@@ -142,7 +142,7 @@
* Maximize ipl. If ipl was previously 0 and if this thread
* is not in an irq, then take global_irq_lock.
*/
- if (swpipl(IPL_MAX) == IPL_MIN && !local_irq_count(cpu))
+ if (__swpipl(IPL_MAX) == IPL_MIN && !local_irq_count(cpu))
get_irqlock(cpu, where);
}
diff -Nru a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h
--- a/arch/alpha/kernel/proto.h Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/proto.h Sat May 26 15:06:42 2001
@@ -75,8 +75,13 @@
/* smp.c */
extern void setup_smp(void);
extern int smp_info(char *buffer);
+#ifdef CONFIG_RTLINUX
+extern void (*handle_ipi)(struct pt_regs *);
+extern void (*smp_percpu_timer_interrupt)(struct pt_regs *);
+#else
extern void handle_ipi(struct pt_regs *);
extern void smp_percpu_timer_interrupt(struct pt_regs *);
+#endif
/* bios32.c */
/* extern void reset_for_srm(void); */
diff -Nru a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
--- a/arch/alpha/kernel/smp.c Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/smp.c Sat May 26 15:06:42 2001
@@ -614,7 +614,11 @@
int cpu);
void
+#ifdef CONFIG_RTLINUX
+hard_smp_percpu_timer_interrupt(struct pt_regs *regs)
+#else
smp_percpu_timer_interrupt(struct pt_regs *regs)
+#endif /* CONFIG_RTLINUX */
{
int cpu = smp_processor_id();
unsigned long user = user_mode(regs);
@@ -656,6 +660,11 @@
}
}
+#ifdef CONFIG_RTLINUX
+void (*smp_percpu_timer_interrupt)(struct pt_regs *) =
+ hard_smp_percpu_timer_interrupt;
+#endif /* CONFIG_RTLINUX */
+
int __init
setup_profiling_timer(unsigned int multiplier)
{
@@ -732,7 +741,11 @@
}
void
+#ifdef CONFIG_RTLINUX
+hard_handle_ipi(struct pt_regs *regs)
+#else
handle_ipi(struct pt_regs *regs)
+#endif CONFIG_RTLINUX
{
int this_cpu = smp_processor_id();
unsigned long *pending_ipis = &ipi_data[this_cpu].bits;
@@ -796,6 +809,10 @@
if (hwrpb->txrdy)
recv_secondary_console_msg();
}
+
+#ifdef CONFIG_RTLINUX
+void (*handle_ipi)(struct pt_regs *) = hard_handle_ipi;
+#endif /* CONFIG_RTLINUX */
void
smp_send_reschedule(int cpu)
diff -Nru a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
--- a/arch/alpha/kernel/traps.c Sat May 26 15:06:42 2001
+++ b/arch/alpha/kernel/traps.c Sat May 26 15:06:42 2001
@@ -20,6 +20,15 @@
#include <asm/unaligned.h>
#include <asm/sysinfo.h>
+#ifdef CONFIG_RTLINUX
+unsigned long rtlinux_do_entArith = 0;
+unsigned long rtlinux_do_entIF = 0;
+unsigned long rtlinux_do_page_fault = 0;
+unsigned long rtlinux_do_entDbg = 0;
+unsigned long rtlinux_do_entUna = 0;
+unsigned long rtlinux_sys_call_table = 0;
+#endif /* CONFIG_RTLINUX */
+
#include "proto.h"
void
@@ -100,8 +109,9 @@
#endif
printk("%s(%d): %s %ld\n", current->comm, current->pid, str, err);
dik_show_regs(regs, r9_15);
- dik_show_code((unsigned int *)regs->pc);
- dik_show_trace((unsigned long *)(regs+1));
+while(1);
+ /*dik_show_code((unsigned int *)regs->pc);
+ dik_show_trace((unsigned long *)(regs+1));*/
if (current->thread.flags & (1UL << 63)) {
printk("die_if_kernel recursion detected.\n");
diff -Nru a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile
--- a/arch/i386/boot/Makefile Sat May 26 15:06:42 2001
+++ b/arch/i386/boot/Makefile Sat May 26 15:06:42 2001
@@ -43,7 +43,7 @@
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< -I$(TOPDIR)/include
bootsect: bootsect.o
- $(LD) -Ttext 0x0 -s -oformat binary -o $@ $<
+ $(LD) -Ttext 0x0 -s --oformat binary -o $@ $<
bootsect.o: bootsect.s
$(AS) -o $@ $<
@@ -52,7 +52,7 @@
$(CPP) $(CPPFLAGS) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
bbootsect: bbootsect.o
- $(LD) -Ttext 0x0 -s -oformat binary $< -o $@
+ $(LD) -Ttext 0x0 -s --oformat binary $< -o $@
bbootsect.o: bbootsect.s
$(AS) -o $@ $<
@@ -61,7 +61,7 @@
$(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
setup: setup.o
- $(LD) -Ttext 0x0 -s -oformat binary -e begtext -o $@ $<
+ $(LD) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
setup.o: setup.s
$(AS) -o $@ $<
@@ -70,7 +70,7 @@
$(CPP) $(CPPFLAGS) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
bsetup: bsetup.o
- $(LD) -Ttext 0x0 -s -oformat binary -e begtext -o $@ $<
+ $(LD) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
bsetup.o: bsetup.s
$(AS) -o $@ $<
diff -Nru a/arch/i386/config.in b/arch/i386/config.in
--- a/arch/i386/config.in Sat May 26 15:06:42 2001
+++ b/arch/i386/config.in Sat May 26 15:06:42 2001
@@ -2,11 +2,16 @@
# For a description of the syntax of this configuration file,
# see the Configure script.
#
-mainmenu_name "Linux Kernel Configuration"
+mainmenu_name "RTLinux Kernel Configuration"
define_bool CONFIG_X86 y
define_bool CONFIG_ISA y
define_bool CONFIG_SBUS n
+define_bool CONFIG_RTLINUX y
+
+if [ "$CONFIG_RTLINUX" = "y" ]; then
+ define_bool CONFIG_RTL y
+fi
define_bool CONFIG_UID16 y
diff -Nru a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
--- a/arch/i386/kernel/Makefile Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/Makefile Sat May 26 15:06:42 2001
@@ -15,7 +15,7 @@
O_TARGET := kernel.o
O_OBJS := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
- pci-dma.o
+ pci-dma.o rtlinux.o
OX_OBJS := i386_ksyms.o
MX_OBJS :=
diff -Nru a/arch/i386/kernel/acpi.c b/arch/i386/kernel/acpi.c
--- a/arch/i386/kernel/acpi.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/acpi.c Sat May 26 15:06:42 2001
@@ -1096,7 +1096,7 @@
if (current->need_resched)
goto out;
time = TIME_BEGIN(pm_tmr);
- __asm__ __volatile__("sti ; hlt": : :"memory");
+ safe_halt();
time = TIME_END(pm_tmr, time);
if (time > acpi_enter_lvl2_lat)
goto sleep2;
@@ -1107,7 +1107,7 @@
__cli();
if (current->need_resched)
goto out;
- __asm__ __volatile__("sti ; hlt": : :"memory");
+ safe_halt();
}
out:
diff -Nru a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/entry.S Sat May 26 15:06:42 2001
@@ -189,7 +189,22 @@
* but we want the default path for a system call return to
* go as quickly as possible which is why some of this is
* less clear than it otherwise should be.
+ *
+ * (c) Victor Yodaiken 1999
+ * RTLINUX_IRET emulates the turn on interrupts effect of
+ * iret since, under RTLinux we may have pended interrupts
+ * that will not be automatically enabled on an iret.
*/
+#ifdef CONFIG_RTLINUX
+#define RTLINUX_IRET \
+ movl rtl_emulate_iret,%eax; \
+ testl %eax, %eax; \
+ je 1f; \
+ call *%eax; \
+ 1:
+#else
+#define RTLINUX_IRET
+#endif
ENTRY(system_call)
pushl %eax # save orig_eax
@@ -219,11 +234,13 @@
cmpl $0,sigpending(%ebx)
jne signal_return
restore_all:
+ RTLINUX_IRET
RESTORE_ALL
ALIGN
signal_return:
sti # we can get here from an interrupt handler
+ RTLINUX_IRET
testl $(VM_MASK),EFLAGS(%esp)
movl %esp,%eax
jne v86_signal_return
@@ -287,6 +304,12 @@
call SYMBOL_NAME(schedule) # test
jmp ret_from_sys_call
+#define RTL_PUSH_VECTOR(vector,routine) \
+1: cmpl $routine, %ecx; \
+ jne 1f; \
+ pushl $vector; \
+ jmp 7f;
+
ENTRY(divide_error)
pushl $0 # no error code
pushl $ SYMBOL_NAME(do_divide_error)
@@ -312,6 +335,37 @@
movl $(__KERNEL_DS),%edx
movl %edx,%ds
movl %edx,%es
+#ifdef CONFIG_RTLINUX
+ movl rtl_exception_intercept,%eax
+ testl %eax, %eax
+ je 8f
+ RTL_PUSH_VECTOR(0,do_divide_error)
+ RTL_PUSH_VECTOR(1,do_debug)
+ RTL_PUSH_VECTOR(3,do_int3)
+ RTL_PUSH_VECTOR(4,do_overflow)
+ RTL_PUSH_VECTOR(5,do_bounds)
+ RTL_PUSH_VECTOR(6,do_invalid_op)
+ RTL_PUSH_VECTOR(8,do_double_fault)
+ RTL_PUSH_VECTOR(9,do_coprocessor_segment_overrun)
+ RTL_PUSH_VECTOR(10,do_invalid_TSS)
+ RTL_PUSH_VECTOR(11,do_segment_not_present)
+ RTL_PUSH_VECTOR(12,do_stack_segment)
+ RTL_PUSH_VECTOR(13,do_general_protection)
+ RTL_PUSH_VECTOR(14,do_page_fault)
+ RTL_PUSH_VECTOR(15,do_spurious_interrupt_bug)
+ RTL_PUSH_VECTOR(16,do_coprocessor_error)
+ RTL_PUSH_VECTOR(17,do_alignment_check)
+1: push $-1
+7: mov %ecx, %ebx # ebx will not be corrupted by a C routine
+ call *%eax
+ popl %ecx
+ mov %ebx, %ecx
+ testl %eax, %eax
+ je 8f
+ addl $8,%esp
+ RESTORE_ALL
+8:
+#endif
GET_CURRENT(%ebx)
call *%ecx
addl $8,%esp
@@ -325,6 +379,21 @@
ENTRY(device_not_available)
pushl $-1 # mark this as an int
SAVE_ALL
+#ifdef CONFIG_RTLINUX
+ movl rtl_exception_intercept,%eax
+ testl %eax, %eax
+ je 8f
+ movl %esp,%edx
+ pushl $0 # no error code
+ pushl %edx
+ pushl $7 # vector
+ call *%eax
+ addl $12,%esp
+ testl %eax, %eax
+ je 8f
+ RESTORE_ALL
+8:
+#endif
GET_CURRENT(%ebx)
pushl $ret_from_exception
movl %cr0,%eax
diff -Nru a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
--- a/arch/i386/kernel/i386_ksyms.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/i386_ksyms.c Sat May 26 15:06:42 2001
@@ -22,6 +22,7 @@
#include <asm/irq.h>
#include <asm/mmx.h>
#include <asm/desc.h>
+#include <asm/pgalloc.h>
extern void dump_thread(struct pt_regs *, struct user *);
extern int dump_fpu(elf_fpregset_t *);
@@ -106,6 +107,11 @@
EXPORT_SYMBOL(mmx_copy_page);
#endif
+#include <asm/mpspec.h>
+#ifdef CONFIG_X86_IO_APIC
+EXPORT_SYMBOL(smp_found_config);
+#endif
+
#ifdef CONFIG_SMP
EXPORT_SYMBOL(cpu_data);
EXPORT_SYMBOL(kernel_flag);
@@ -116,6 +122,7 @@
/* Global SMP irq stuff */
EXPORT_SYMBOL(synchronize_irq);
+EXPORT_SYMBOL(flush_tlb_all);
EXPORT_SYMBOL(global_irq_holder);
EXPORT_SYMBOL(__global_cli);
EXPORT_SYMBOL(__global_sti);
@@ -132,8 +139,49 @@
EXPORT_SYMBOL(screen_info);
#endif
+#ifdef CONFIG_RTLINUX
+#include <linux/vt_kern.h>
+EXPORT_SYMBOL(kd_mksound);
+extern void *__start_rtlinux_funcs,*__stop_rtlinux_funcs;
+EXPORT_SYMBOL(__start_rtlinux_funcs);
+EXPORT_SYMBOL(__stop_rtlinux_funcs);
+EXPORT_SYMBOL(irq_control);
+extern unsigned long (*do_gettimeoffset)(void);
+extern unsigned int use_tsc;
+EXPORT_SYMBOL(do_gettimeoffset);
+EXPORT_SYMBOL(use_tsc);
+EXPORT_SYMBOL(tick);
+extern volatile unsigned long lost_ticks;
+extern rwlock_t xtime_lock;
+EXPORT_SYMBOL(lost_ticks);
+EXPORT_SYMBOL(xtime_lock);
+extern unsigned char *rtl_cached21;
+EXPORT_SYMBOL(rtl_cached21);
+#ifdef CONFIG_SMP
+extern int rtl_reserved_cpumask;
+EXPORT_SYMBOL(rtl_reserved_cpumask);
+extern unsigned long irq_affinity [NR_IRQS];
+EXPORT_SYMBOL(irq_affinity);
+EXPORT_SYMBOL(x86_apicid_to_cpu);
+extern unsigned long flush_cpumask;
+EXPORT_SYMBOL(flush_cpumask);
+#endif
+#endif
+
EXPORT_SYMBOL(get_wchan);
EXPORT_SYMBOL(irq_stat);
EXPORT_SYMBOL(rtc_lock);
+#ifdef CONFIG_RTLINUX
+extern struct console *console_drivers;
+EXPORT_SYMBOL(console_drivers);
+extern spinlock_t console_lock;
+EXPORT_SYMBOL(console_lock);
+EXPORT_SYMBOL(do_softirq);
+EXPORT_SYMBOL(set_ldt_desc);
+EXPORT_SYMBOL(default_ldt);
+#ifdef CONFIG_SMP
+EXPORT_SYMBOL(cpu_tlbstate);
+#endif
+#endif
diff -Nru a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c
--- a/arch/i386/kernel/i8259.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/i8259.c Sat May 26 15:06:42 2001
@@ -129,6 +129,12 @@
static spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
+#undef spin_lock_irqsave
+#define spin_lock_irqsave(lock, flags) do { rtl_hard_local_irq_save_kernel(flags); spin_lock(lock); } while (0)
+
+#undef spin_unlock_irqrestore
+#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); rtl_hard_local_irq_restore_kernel(flags); } while (0)
+
static void end_8259A_irq (unsigned int irq)
{
if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
@@ -168,6 +174,7 @@
#define __byte(x,y) (((unsigned char *)&(y))[x])
#define cached_21 (__byte(0,cached_irq_mask))
#define cached_A1 (__byte(1,cached_irq_mask))
+unsigned char *rtl_cached21 = &cached_21;
/*
* Not all IRQs can be routed through the IO-APIC, eg. on certain (older)
diff -Nru a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
--- a/arch/i386/kernel/io_apic.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/io_apic.c Sat May 26 15:06:42 2001
@@ -33,6 +33,12 @@
static spinlock_t ioapic_lock = SPIN_LOCK_UNLOCKED;
+#undef spin_lock_irqsave
+#define spin_lock_irqsave(lock, flags) do { rtl_hard_local_irq_save_kernel(flags); spin_lock(lock); } while (0)
+
+#undef spin_unlock_irqrestore
+#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); rtl_hard_local_irq_restore_kernel(flags); } while (0)
+
/*
* # of IO-APICs and # of IRQ routing registers
*/
diff -Nru a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
--- a/arch/i386/kernel/irq.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/irq.c Sat May 26 15:06:42 2001
@@ -162,7 +162,7 @@
p += sprintf(p, "%10u ",
atomic_read(&nmi_counter(cpu_logical_map(j))));
p += sprintf(p, "\n");
-#if CONFIG_SMP
+#if CONFIG_X86_LOCAL_APIC
p += sprintf(p, "LOC: ");
for (j = 0; j < smp_num_cpus; j++)
p += sprintf(p, "%10u ",
@@ -1011,7 +1011,7 @@
static struct proc_dir_entry * irq_dir [NR_IRQS];
static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
-static unsigned long irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = ~0UL };
+unsigned long irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = ~0UL };
#define HEX_DIGITS 8
diff -Nru a/arch/i386/kernel/rtlinux.c b/arch/i386/kernel/rtlinux.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/kernel/rtlinux.c Sat May 26 15:06:42 2001
@@ -0,0 +1,79 @@
+#include <linux/config.h>
+#include <linux/ptrace.h>
+#include <linux/errno.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/ioport.h>
+#include <linux/interrupt.h>
+#include <linux/timex.h>
+#include <linux/malloc.h>
+#include <linux/random.h>
+#include <linux/smp_lock.h>
+#include <linux/init.h>
+#include <linux/kernel_stat.h>
+
+#include <asm/system.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/bitops.h>
+#include <asm/pgtable.h>
+#include <asm/delay.h>
+#include <asm/desc.h>
+
+#include <linux/irq.h>
+
+static void rtl_hard_save_flags_f(unsigned long *z){
+ unsigned long y;
+ rtl_hard_save_flags_kernel(y);
+ *z=y;
+}
+static void rtl_hard_restore_flags_f(unsigned long x) { rtl_hard_restore_flags_kernel(x); }
+static void rtl_hard_cli_f(void) { rtl_hard_cli_kernel(); }
+static void rtl_hard_sti_f(void) { rtl_hard_sti_kernel(); }
+static void rtl_hard_local_irq_save_f(unsigned long *x)
+{ unsigned long y;rtl_hard_local_irq_save_kernel(y);*x=y; }
+static void rtl_hard_local_irq_restore_f(unsigned long x){
+ rtl_hard_local_irq_restore_kernel(x);
+}
+struct irq_control_s irq_control = {
+ rtl_hard_save_flags_f,
+ rtl_hard_restore_flags_f,
+ rtl_hard_cli_f,
+ rtl_hard_sti_f,
+ rtl_hard_local_irq_save_f,
+ rtl_hard_local_irq_restore_f
+ };
+void *rtl_emulate_iret = 0;
+void *rtl_exception_intercept = 0;
+
+extern void *__start_rtlinux_patch,*__stop_rtlinux_patch;
+extern asmlinkage void do_IRQ(struct pt_regs );
+extern void ret_from_intr(void);
+RTLINUX_EXPORT(__start_rtlinux_patch);
+RTLINUX_EXPORT(__stop_rtlinux_patch);
+RTLINUX_EXPORT(rtl_emulate_iret);
+RTLINUX_EXPORT(irq_desc);
+RTLINUX_EXPORT(do_IRQ);
+RTLINUX_EXPORT(ret_from_intr);
+RTLINUX_EXPORT(rtl_exception_intercept);
+
+#ifdef CONFIG_X86_LOCAL_APIC
+extern asmlinkage void smp_spurious_interrupt(void);
+extern asmlinkage void smp_error_interrupt(void);
+extern void smp_apic_timer_interrupt(struct pt_regs *);
+
+RTLINUX_EXPORT(smp_spurious_interrupt);
+RTLINUX_EXPORT(smp_error_interrupt);
+RTLINUX_EXPORT(smp_apic_timer_interrupt);
+#endif
+
+#ifdef CONFIG_SMP
+extern void rtl_reschedule(int cpu);
+extern asmlinkage void smp_reschedule_interrupt(void);
+extern asmlinkage void smp_invalidate_interrupt(void);
+extern asmlinkage void smp_call_function_interrupt(void);
+RTLINUX_EXPORT(smp_reschedule_interrupt);
+RTLINUX_EXPORT(smp_invalidate_interrupt);
+RTLINUX_EXPORT(smp_call_function_interrupt);
+RTLINUX_EXPORT(rtl_reschedule);
+#endif
diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/setup.c Sat May 26 15:06:42 2001
@@ -1736,3 +1736,4 @@
current->used_math = 0;
stts();
}
+
diff -Nru a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c
--- a/arch/i386/kernel/smp.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/smp.c Sat May 26 15:06:42 2001
@@ -166,7 +166,10 @@
void send_IPI_self(int vector)
{
+ unsigned long flags;
+ rtl_hard_local_irq_save_kernel(flags);
__send_IPI_shortcut(APIC_DEST_SELF, vector);
+ rtl_hard_local_irq_restore_kernel(flags);
}
static inline void send_IPI_mask(int mask, int vector)
@@ -174,8 +177,7 @@
unsigned long cfg;
unsigned long flags;
- __save_flags(flags);
- __cli();
+ rtl_hard_local_irq_save_kernel(flags);
/*
* Wait for idle.
@@ -197,7 +199,7 @@
* Send the IPI. The write to APIC_ICR fires this off.
*/
apic_write_around(APIC_ICR, cfg);
- __restore_flags(flags);
+ rtl_hard_local_irq_restore_kernel(flags);
}
/*
@@ -210,7 +212,7 @@
* Optimizations Manfred Spraul <manfreds@colorfullife.com>
*/
-static volatile unsigned long flush_cpumask;
+volatile unsigned long flush_cpumask;
static struct mm_struct * flush_mm;
static unsigned long flush_va;
static spinlock_t tlbstate_lock = SPIN_LOCK_UNLOCKED;
@@ -272,6 +274,8 @@
clear_bit(cpu, &flush_cpumask);
}
+extern int rtl_reserved_cpumask;
+
static void flush_tlb_others (unsigned long cpumask, struct mm_struct *mm,
unsigned long va)
{
@@ -302,6 +306,7 @@
flush_mm = mm;
flush_va = va;
atomic_set_mask(cpumask, &flush_cpumask);
+ atomic_clear_mask(rtl_reserved_cpumask, &flush_cpumask);
/*
* We have to send the IPI only to
* CPUs affected.
@@ -365,7 +370,7 @@
leave_mm(cpu);
}
-static void flush_tlb_all_ipi(void* info)
+void flush_tlb_all_ipi(void* info)
{
do_flush_tlb_all_local();
}
@@ -388,6 +393,12 @@
send_IPI_mask(1 << cpu, RESCHEDULE_VECTOR);
}
+#define RTL_RESCHEDULE_VECTOR 0xEE
+void rtl_reschedule(int cpu)
+{
+ send_IPI_mask(1 << cpu, RTL_RESCHEDULE_VECTOR);
+}
+
/*
* Structure and data for smp_call_function(). This is designed to minimise
* static memory requirements. It also looks cleaner.
@@ -508,4 +519,5 @@
if (wait)
atomic_inc(&call_data->finished);
}
+
diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
--- a/arch/i386/kernel/time.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/time.c Sat May 26 15:06:42 2001
@@ -114,7 +114,7 @@
#define TICK_SIZE tick
-#ifndef CONFIG_X86_TSC
+/* #ifndef CONFIG_X86_TSC */
spinlock_t i8253_lock = SPIN_LOCK_UNLOCKED;
@@ -232,13 +232,13 @@
return count;
}
-static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
+unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
-#else
+/* #else */
-#define do_gettimeoffset() do_fast_gettimeoffset()
+/* #define do_gettimeoffset() do_fast_gettimeoffset() */
-#endif
+/* #endif */
/*
* This version of gettimeofday has microsecond resolution
@@ -421,7 +421,7 @@
#endif
}
-static int use_tsc = 0;
+int use_tsc = 0;
/*
* This is the same as the above, except we _also_ save the current
diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
--- a/arch/i386/kernel/traps.c Sat May 26 15:06:42 2001
+++ b/arch/i386/kernel/traps.c Sat May 26 15:06:42 2001
@@ -47,6 +47,7 @@
#include <linux/irq.h>
+
asmlinkage int system_call(void);
asmlinkage void lcall7(void);
asmlinkage void lcall27(void);
@@ -395,7 +396,6 @@
}
#if CONFIG_X86_IO_APIC
-
int nmi_watchdog = 1;
static int __init setup_nmi_watchdog(char *str)
@@ -409,6 +409,8 @@
extern spinlock_t console_lock;
static spinlock_t nmi_print_lock = SPIN_LOCK_UNLOCKED;
+int rtl_reserved_cpumask = 0;
+
inline void nmi_watchdog_tick(struct pt_regs * regs)
{
/*
@@ -433,7 +435,12 @@
* Since current-> is always on the stack, and we always switch
* the stack NMI-atomically, it's safe to use smp_processor_id().
*/
- int sum, cpu = smp_processor_id();
+ /* For RTLinux this is not always the case, hence hard_smp_processor_id */
+ int sum, cpu = hw_smp_processor_id();
+
+ if (test_bit(cpu, &rtl_reserved_cpumask)) {
+ return;
+ }
sum = apic_timer_irqs[cpu];
@@ -469,8 +476,8 @@
{
unsigned char reason = inb(0x61);
+ atomic_inc(&nmi_counter(hw_smp_processor_id()));
- atomic_inc(&nmi_counter(smp_processor_id()));
if (!(reason & 0xc0)) {
#if CONFIG_X86_IO_APIC
/*
diff -Nru a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c
--- a/arch/i386/mm/ioremap.c Sat May 26 15:06:42 2001
+++ b/arch/i386/mm/ioremap.c Sat May 26 15:06:42 2001
@@ -11,6 +11,7 @@
#include <linux/vmalloc.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
+#include <asm/smplock.h>
static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
unsigned long phys_addr, unsigned long flags)
@@ -78,7 +79,9 @@
if (remap_area_pmd(pmd, address, end - address,
phys_addr + address, flags))
return -ENOMEM;
+ lock_kernel();
set_pgdir(address, *dir);
+ unlock_kernel();
address = (address + PGDIR_SIZE) & PGDIR_MASK;
dir++;
} while (address && (address < end));
diff -Nru a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
--- a/arch/ppc/kernel/entry.S Sat May 26 15:06:42 2001
+++ b/arch/ppc/kernel/entry.S Sat May 26 15:06:42 2001
@@ -276,7 +276,7 @@
lwz r1,GPR1(r1)
SYNC
rfi
-
+
#ifdef CONFIG_SMP
.globl ret_from_smpfork
ret_from_smpfork:
@@ -327,22 +327,22 @@
do_bottom_half_ret:
2: lwz r3,_MSR(r1) /* Returning to user mode? */
andi. r3,r3,MSR_PR
- beq+ restore /* if so, check need_resched and signals */
- .globl ret_to_user_hook
-ret_to_user_hook:
- nop
+ beq+ /*restore*/do_signal_ret /* if so, check need_resched and signals */
lwz r3,NEED_RESCHED(r2)
cmpi 0,r3,0 /* check need_resched flag */
beq+ 7f
bl schedule
7: lwz r5,SIGPENDING(r2) /* Check for pending unblocked signals */
cmpwi 0,r5,0
- beq+ restore
+ beq+ /*restore*/do_signal_ret
li r3,0
addi r4,r1,STACK_FRAME_OVERHEAD
bl do_signal
.globl do_signal_ret
do_signal_ret:
+ .globl ret_to_user_hook
+ret_to_user_hook:
+ nop
restore:
lwz r3,_CTR(r1)
lwz r0,_LINK(r1)
diff -Nru a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
--- a/arch/ppc/kernel/head.S Sat May 26 15:06:42 2001
+++ b/arch/ppc/kernel/head.S Sat May 26 15:06:42 2001
@@ -321,6 +321,7 @@
addi r3,r1,STACK_FRAME_OVERHEAD; \
li r20,MSR_KERNEL; \
bl transfer_to_handler; \
+i##n: \
.long hdlr; \
.long ret_from_except
@@ -358,6 +359,7 @@
li r20,MSR_KERNEL
rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
bl transfer_to_handler
+i0x300:
.long do_page_fault
.long ret_from_except
@@ -377,6 +379,7 @@
li r20,MSR_KERNEL
rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
bl transfer_to_handler
+i0x400:
.long do_page_fault
.long ret_from_except
@@ -409,6 +412,7 @@
li r20,MSR_KERNEL
rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
bl transfer_to_handler
+i0x600:
.long AlignmentException
.long ret_from_except
@@ -420,6 +424,7 @@
li r20,MSR_KERNEL
rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
bl transfer_to_handler
+i0x700:
.long ProgramCheckException
.long ret_from_except
@@ -428,8 +433,11 @@
FPUnavailable:
EXCEPTION_PROLOG
bne load_up_fpu /* if from user, just load it up */
+ addi r3,r1,STACK_FRAME_OVERHEAD
li r20,MSR_KERNEL
+ rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
bl transfer_to_handler /* if from kernel, take a trap */
+i0x800:
.long KernelFP
.long ret_from_except
@@ -1592,3 +1600,13 @@
.globl cmd_line
cmd_line:
.space 512
+
+ .globl intercept_table
+intercept_table:
+ .long 0, i0x100, i0x200, i0x300, i0x400, 0, i0x600, i0x700
+ .long i0x800, 0, 0, 0, 0, i0xd00, 0, 0
+ .long 0, 0, 0, i0x1300, 0, 0, 0, 0
+ .long 0, 0, 0, 0, 0, 0, 0, 0
+ .long 0, 0, 0, 0, 0, 0, 0, 0
+ .long 0, 0, 0, 0, 0, 0, 0, 0
+
diff -Nru a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
--- a/arch/ppc/kernel/ppc_ksyms.c Sat May 26 15:06:42 2001
+++ b/arch/ppc/kernel/ppc_ksyms.c Sat May 26 15:06:42 2001
@@ -35,6 +35,7 @@
#include <asm/dma.h>
#include <asm/machdep.h>
#include <asm/hw_irq.h>
+#include <asm/mmu_context.h>
#ifdef CONFIG_SMP
#include <asm/smplock.h>
#endif /* CONFIG_SMP */
@@ -257,6 +258,10 @@
EXPORT_SYMBOL(screen_info);
#endif
+extern long *intercept_table;
+extern long *ret_from_intercept;
+EXPORT_SYMBOL(intercept_table);
+EXPORT_SYMBOL(ret_from_intercept);
EXPORT_SYMBOL(int_control);
EXPORT_SYMBOL(timer_interrupt_intercept);
EXPORT_SYMBOL(timer_interrupt);
@@ -267,23 +272,14 @@
EXPORT_SYMBOL(decrementer_count);
EXPORT_SYMBOL(get_wchan);
EXPORT_SYMBOL(console_drivers);
+EXPORT_SYMBOL(console_lock);
#ifdef CONFIG_XMON
EXPORT_SYMBOL(xmon);
#endif
EXPORT_SYMBOL(down_read_failed);
-extern void (*debugger)(struct pt_regs *regs);
-extern int (*debugger_bpt)(struct pt_regs *regs);
-extern int (*debugger_sstep)(struct pt_regs *regs);
-extern int (*debugger_iabr_match)(struct pt_regs *regs);
-extern int (*debugger_dabr_match)(struct pt_regs *regs);
-extern void (*debugger_fault_handler)(struct pt_regs *regs);
-
-EXPORT_SYMBOL(debugger);
-EXPORT_SYMBOL(debugger_bpt);
-EXPORT_SYMBOL(debugger_sstep);
-EXPORT_SYMBOL(debugger_iabr_match);
-EXPORT_SYMBOL(debugger_dabr_match);
-EXPORT_SYMBOL(debugger_fault_handler);
-
EXPORT_SYMBOL(ret_to_user_hook);
+EXPORT_SYMBOL(do_softirq);
+EXPORT_SYMBOL(next_mmu_context);
+EXPORT_SYMBOL(set_context);
+EXPORT_SYMBOL(mmu_context_overflow);
diff -Nru a/include/asm-alpha/system.h b/include/asm-alpha/system.h
--- a/include/asm-alpha/system.h Sat May 26 15:06:42 2001
+++ b/include/asm-alpha/system.h Sat May 26 15:06:42 2001
@@ -248,8 +248,8 @@
__CALL_PAL_W1(cflush, unsigned long);
__CALL_PAL_R0(rdmces, unsigned long);
__CALL_PAL_R0(rdps, unsigned long);
-__CALL_PAL_R0(rdusp, unsigned long);
__CALL_PAL_RW1(swpipl, unsigned long, unsigned long);
+__CALL_PAL_R0(rdusp, unsigned long);
__CALL_PAL_R0(whami, unsigned long);
__CALL_PAL_W2(wrent, void*, unsigned long);
__CALL_PAL_W1(wripir, unsigned long);
@@ -276,13 +276,28 @@
extern int __min_ipl;
#endif
+#ifdef CONFIG_RTLINUX
+extern unsigned long (*__rdps)(void);
+extern unsigned long (*__swpipl)(unsigned long);
+#endif /* CONFIG_RTLINUX */
+
+#ifdef CONFIG_RTLINUX
+#define getipl() (__rdps() & 7)
+#define setipl(ipl) ((void) __swpipl(ipl))
+#else /* CONFIG_RTLINUX */
#define getipl() (rdps() & 7)
#define setipl(ipl) ((void) swpipl(ipl))
+#endif /* CONFIG_RTLINUX */
#define __cli() setipl(IPL_MAX)
#define __sti() setipl(IPL_MIN)
+#ifdef CONFIG_RTLINUX
+#define __save_flags(flags) ((flags) = __rdps())
+#define __save_and_cli(flags) ((flags) = __swpipl(IPL_MAX))
+#else
#define __save_flags(flags) ((flags) = rdps())
#define __save_and_cli(flags) ((flags) = swpipl(IPL_MAX))
+#endif /* CONFIG_RTLINUX */
#define __restore_flags(flags) setipl(flags)
#define local_irq_save(flags) __save_and_cli(flags)
diff -Nru a/include/asm-i386/apic.h b/include/asm-i386/apic.h
--- a/include/asm-i386/apic.h Sat May 26 15:06:42 2001
+++ b/include/asm-i386/apic.h Sat May 26 15:06:42 2001
@@ -53,6 +53,7 @@
extern inline void ack_APIC_irq(void)
{
+ label_ack_APIC(); /* used to generate RTLinux patch point */
/*
* ack_APIC_irq() actually gets compiled as a single instruction:
* - a single rmw on Pentium/82489DX
diff -Nru a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
--- a/include/asm-i386/hw_irq.h Sat May 26 15:06:42 2001
+++ b/include/asm-i386/hw_irq.h Sat May 26 15:06:42 2001
@@ -14,6 +14,7 @@
#include <linux/config.h>
#include <asm/irq.h>
+#include <asm/rtlinux.h>
/*
* IDT vectors usable for external interrupt sources start
@@ -123,20 +124,19 @@
#define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v)
#define XBUILD_SMP_INTERRUPT(x,v)\
asmlinkage void x(void); \
-asmlinkage void call_##x(void); \
__asm__( \
"\n"__ALIGN_STR"\n" \
SYMBOL_NAME_STR(x) ":\n\t" \
"pushl $"#v"\n\t" \
SAVE_ALL \
- SYMBOL_NAME_STR(call_##x)":\n\t" \
- "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
+ "pushl $ret_from_intr\n\t" \
+ RTLINUX_LABEL(smp_##x)\
+ "jmp "SYMBOL_NAME_STR(smp_##x)"\n\t" \
"jmp ret_from_intr\n");
#define BUILD_SMP_TIMER_INTERRUPT(x,v) XBUILD_SMP_TIMER_INTERRUPT(x,v)
#define XBUILD_SMP_TIMER_INTERRUPT(x,v) \
asmlinkage void x(struct pt_regs * regs); \
-asmlinkage void call_##x(void); \
__asm__( \
"\n"__ALIGN_STR"\n" \
SYMBOL_NAME_STR(x) ":\n\t" \
@@ -144,19 +144,18 @@
SAVE_ALL \
"movl %esp,%eax\n\t" \
"pushl %eax\n\t" \
- SYMBOL_NAME_STR(call_##x)":\n\t" \
+ RTLINUX_LABEL(smp_##x)\
"call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
"addl $4,%esp\n\t" \
"jmp ret_from_intr\n");
#define BUILD_COMMON_IRQ() \
-asmlinkage void call_do_IRQ(void); \
__asm__( \
"\n" __ALIGN_STR"\n" \
"common_interrupt:\n\t" \
SAVE_ALL \
"pushl $ret_from_intr\n\t" \
- SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \
+ RTLINUX_LABEL(do_IRQ)"\n\t" \
"jmp "SYMBOL_NAME_STR(do_IRQ));
/*
diff -Nru a/include/asm-i386/rtlinux.h b/include/asm-i386/rtlinux.h
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/rtlinux.h Sat May 26 15:06:42 2001
@@ -0,0 +1,14 @@
+
+/* RTLinux support for patching the running kernel.
+ * (c) Victor Yodaiken 1999
+*/
+
+#define label_ack_APIC() xlabel_code(0x12344321)
+#define xlabel_code(x) asm __volatile__(".section rtlinux_patch,\"a\"\n .align 4\n"\
+ ".long 1f,"#x"\n" ".previous\n 1:\n" );
+#define RTLINUX_LABEL(x)\
+ ".section rtlinux_patch,\"a\"\n .align 4\n .long 1f,"#x"\n .previous\n 1:\n"
+
+#define RTLINUX_EXPORT(x)\
+ asm (".section rtlinux_funcs,\"a\"\n .align 4\n"\
+ ".long "#x"\n .previous\n" );
diff -Nru a/include/asm-i386/rtlinux_cli.h b/include/asm-i386/rtlinux_cli.h
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/rtlinux_cli.h Sat May 26 15:06:42 2001
@@ -0,0 +1,43 @@
+#ifndef RTLINUX_CLI_H
+#define RTLINUX_CLI_H
+
+/* interrupt control.. */
+#define rtl_hard_save_flags_kernel(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory")
+#define rtl_hard_restore_flags_kernel(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
+#define rtl_hard_cli_kernel() __asm__ __volatile__("cli": : :"memory")
+#define rtl_hard_sti_kernel() __asm__ __volatile__("sti": : :"memory")
+
+/* For spinlocks etc */
+#define rtl_hard_local_irq_save_kernel(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
+#define rtl_hard_local_irq_restore_kernel(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
+#define rtl_hard_local_irq_disable_kernel() __asm__ __volatile__("cli": : :"memory")
+#define rtl_hard_local_irq_enable_kernel() __asm__ __volatile__("sti": : :"memory")
+struct irq_control_s {
+ void (*do_save_flags)(unsigned long *);
+ void (*do_restore_flags)(unsigned long);
+ void (*do_cli)(void);
+ void (*do_sti)(void);
+ void (*do_local_irq_save)(unsigned long *);
+ void (*do_local_irq_restore)(unsigned long);
+};
+extern struct irq_control_s irq_control;
+#undef __cli()
+#undef __sti()
+#undef __save_flags(x)
+#undef __restore_flags(x)
+#undef local_irq_save(x)
+#undef local_irq_restore(x)
+#undef local_irq_disable()
+#undef local_irq_enable()
+#define __save_flags(x) irq_control.do_save_flags(&x)
+#define __restore_flags(x) irq_control.do_restore_flags(x)
+#define __cli() irq_control.do_cli()
+#define __sti() irq_control.do_sti()
+#define local_irq_save(x) irq_control.do_local_irq_save((&x))
+#define local_irq_restore(x) irq_control.do_local_irq_restore(x)
+#define local_irq_disable() irq_control.do_cli()
+#define local_irq_enable() irq_control.do_sti()
+
+#undef safe_halt()
+#define safe_halt() do { __asm__ __volatile__("cli; nop; sti; hlt": : :"memory"); irq_control.do_sti(); } while (0)
+#endif /* RTLINUX_CLI_H */
diff -Nru a/include/asm-i386/rwlock.h b/include/asm-i386/rwlock.h
--- a/include/asm-i386/rwlock.h Sat May 26 15:06:42 2001
+++ b/include/asm-i386/rwlock.h Sat May 26 15:06:42 2001
@@ -31,7 +31,7 @@
"2:\tcall " helper "\n\t" \
"jmp 1b\n" \
".previous" \
- ::"a" (rw) : "memory")
+ : :"a" (rw) : "memory")
#define __build_read_lock_const(rw, helper) \
asm volatile(LOCK "subl $1,%0\n\t" \
@@ -61,7 +61,7 @@
"2:\tcall " helper "\n\t" \
"jmp 1b\n" \
".previous" \
- ::"a" (rw) : "memory")
+ : :"a" (rw) : "memory")
#define __build_write_lock_const(rw, helper) \
asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
diff -Nru a/include/asm-i386/smp.h b/include/asm-i386/smp.h
--- a/include/asm-i386/smp.h Sat May 26 15:06:41 2001
+++ b/include/asm-i386/smp.h Sat May 26 15:06:41 2001
@@ -11,6 +11,7 @@
#endif
#ifdef CONFIG_X86_LOCAL_APIC
+#include <asm/rtlinux.h>
#ifndef ASSEMBLY
#include <asm/fixmap.h>
#include <asm/bitops.h>
@@ -82,6 +83,7 @@
/* we don't want to mark this access volatile - bad code generation */
return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
}
+#define hw_smp_processor_id() (x86_apicid_to_cpu[hard_smp_processor_id() ])
#endif /* !ASSEMBLY */
@@ -99,5 +101,7 @@
#define PROC_CHANGE_PENALTY 15 /* Schedule penalty */
+#else
+#define hw_smp_processor_id() (0)
#endif
#endif
diff -Nru a/include/asm-i386/system.h b/include/asm-i386/system.h
--- a/include/asm-i386/system.h Sat May 26 15:06:42 2001
+++ b/include/asm-i386/system.h Sat May 26 15:06:42 2001
@@ -4,6 +4,7 @@
#include <linux/config.h>
#include <linux/kernel.h>
#include <asm/segment.h>
+#include <asm/rtlinux.h>
#include <linux/bitops.h> /* for LOCK_PREFIX */
#ifdef __KERNEL__
@@ -288,6 +289,7 @@
#define local_irq_restore(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
#define local_irq_disable() __asm__ __volatile__("cli": : :"memory")
#define local_irq_enable() __asm__ __volatile__("sti": : :"memory")
+#include <asm/rtlinux_cli.h>
#ifdef CONFIG_SMP
|