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
|
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue Sep 11 13:53:39 CEST 2001
Fixed compilation problem with curses.cc. Still some kind of problem
(perhaps with screen updates), so only the VGA BIOS init messages
are displaying so far.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Sep 10 20:44:42 CEST 2001
Cleaned up duplicate include directives ("-I") in Makefiles. They
were a result of mods to allow for compilation in a separate directory,
but the diffs left duplicates of some include dirs.
Fixed the 'bitmaps' directory problem with CVS. You shouldn't need
a symlink anymore. Make sure to "cvs update -APd" before trying.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Wed Aug 15 18:32:28 CEST 2001
Many more moularization changes. Now, all the IO devices which are
compiled by default, use a plugin interface and are loaded as
individual plugins. I haven't cleaned up some of the devices which
are not compiled in by default.
Only tested and fixed the conf/ files for freedos and win95.
If you try with your own conf files, you must modify them
like 'freedos' or 'win95'. This interface will be in flux for
a while, as I'm making several passes through the code to
clean it up, while keeping things in working condition.
Currently, options are set through the old bx_options structure,
but next I plan to fix this, passing options directly to each
plugin via a more modular/intelligent get/set option interface.
Here is a list of the devices which are now plugins (an
excerpt from a conf file):
plugin = ./plugins/bochs/iodev/cmos.so
plugin = ./plugins/bochs/iodev/dma.so
plugin = ./plugins/bochs/iodev/system.so
plugin = ./plugins/bochs/iodev/vga.so
plugin = ./plugins/bochs/iodev/serial.so
plugin = ./plugins/bochs/iodev/parallel.so
plugin = ./plugins/bochs/iodev/keyboard.so
plugin = ./plugins/bochs/iodev/floppy.so
plugin = ./plugins/bochs/iodev/harddrv.so
Also as I make passes through the code, I'll clean up the plugin
interface too. It's a little hacky in parts. But if I redesign
it all in one shot, I'm sure I'm going to introduce some big errors
which will make testing/debugging really difficult.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Aug 10 18:53:17 CEST 2001
Yet another wad of modularization changes to IO devices and glue logic.
CMOS and DMA interaction now go through a plugin interface. Getting
there... Most of the inter-device interaction is now modularized to
use plugin interfaces. iodev/devices.cc is trimmed way down. Soon
I can work on compiling/calling the devices as individual plugins.
And some .plex86rc directives to go with this.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Wed Aug 8 14:03:17 CEST 2001
More cleanup of IO devices glue logic. Removed pc_devices.{cc,h}
completely. Moved logic up to the plugin interface, or down to
the DMA controller emulation.
I'll need to make a few more logical passes through the code to effect
the splitup to IO device plugins.
Ultimately, will put in a requirments flag/mechanism so, for example,
you can only load a floppy plugin if you have already loaded a
DMA plugin and a PIC plugin. (or they are intrinsically offered
by the VM core)
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue Aug 7 16:44:54 CEST 2001
Cleanup of plugin glue code in user/plugins/bochs/. I'm working toward
splitting the IO devices into individual plugins. This will give
us more flexibility for sharing devices with bochs, and distributing
updated device models without updating the entire core.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Aug 6 11:37:57 CEST 2001
Integrated small diff for Linux header space conflict of timer_t
from Arjan van de Ven <arjanv@redhat.com>
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Jun 11 00:19:20 EDT 2001
Oops, there was an include problem - when the default linux source
path was used, an extra /include component was appended. The path
should point to the top linux directory. The Makefile adds
in the /include component. When I added in that `uname -r` idea
I didn't notice it broke things until I passed '-v' to GCC. Fixed.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Jun 10 12:34:56 EDT 2001
ACK! I had a goto jumping around the native CS:EIP fetch accelerations,
in emulation/emulation.c. Forgot and left that in there. Man,
do things work faster now!!! Check this out:
Yesterday Today
Pragma 5:50 2:54
Win95 3:23 1:59
And we still have many performance tweaks to do, running app code
natively, better video (still getting wacked with 1E+06 redirects for
VGA 640x480x16color latches), drivers, better page-on-demand logic,
etc. Pragma is getting hit with a lot of redirects to the CMOS
in user space. That can be fixed also, by a move to VM space, like
I did with the PICs/PITs already.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Jun 9 23:04:50 EDT 2001
Added code to handle OUTS in chunks. (Already had INS support). This
helps with Windows a little - less redirects to user space.
Designated FS descriptor for virtualized guest CS to avoid reloading
a descriptor many times for each instruction fetch.
Optimized access to PDE/PTE fields in function to map a guest
page into the monitor.
Moved the port 0x80 handler to the VM. Pragma was nailing it with
millions of accesses. Eliminated that waste.
Win95 boots in 3:23, Pragma in 5:50. Win95 is getting hit with
about a million memory mapped IO redirects during a boot/shutdown.
Perhaps I'll move the latches into the VM space. Pragma is hitting
the CMOS IO ports a few million times. Yuk. Gotta fix that too.
Added some instrumentation macros, turn on by editing end of config.h
after you run ./configure. Will add more. Some are not compatible
with multiple VMs when enabled (because I was lazy and used global
variables).
My guess is that the current 1-page-at-a-time demand paging scheme
is not so good for performance either. Should really map in
neighboring guest pages. Could handle virtualized page tables
much better. I have a feeling if this is done right, the above
execution times will go down signficantly.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Jun 9 03:13:32 EDT 2001
More optimizations, performance is definitely better.
Added native seg:offset accesses for emulation of read-modify-write
instructions. Previously I only implemented for strict read or
write instructions.
Modified assembly handlers for native accesses, to take advantage
of GCC doing caller-saves on certain registers. So no need to
push/pop state info when using them. Also biased the C part
of this stuff for 32bit accesses in the if-then-else constructs.
Restructured the keyboard emulation a little, to eliminate the
constant delivery of time events. Only one event per request
is now delivered. That eliminated a lot of wasteful round-trips
to user space!
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Jun 8 15:39:42 EDT 2001
Added idea from Arjan van de Ven <arjanv@redhat.com>, to default
Linux kernel include path to /lib/modules/`uname -r`/build/include.
Added mods from Roland McGrath <roland@frob.com> to build plex86
in a separate directory.
Added mods from Eyal Lotem for physical memory access outside of
bounds (for OS memory sizing).
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Jun 7 11:26:47 EDT 2001
Moved PIC/PIT device emulation into the VM monitor. Definitely
a performance win. A lot less round trips to user space!
Other components could be moved to the VM monitor space also.
Some more instrumentation measurements; the number of requests
from monitor to user space:
Win95:
874354 MemMapIOWriteRequest
811118 TimeElapsed
299860 IOOutRequest
285533 MemMapIOReadRequest
123386 IOInRequest
10450 IOInBatchRequest
105 PrintBuf
Pragma Linux:
3029470 IOOutRequest
1448653 TimeElapsed
1032759 IOInRequest
27931 MemMapIOWriteRequest
38 PrintBuf
1 IOInBatchRequest
Win95 is taking a lot of MemMapIO hits (VGA framebuffer). That
can be remedied with smarter video handling (emulation of a better
card, special drivers, or moving part of the VGA emulation to the
monitor also). Both OSes are being hit with TimeElapsed request,
which comes from the timer framework in the VM monitor. This is
due to the ::periodic function in the keyboard emulation which
is receiving timer events every 100useconds, whether it needs it
or not. I'll squash that soon! Anyways, it's a lot easier to
move devices to the monitor, since the PIC/PIT are there now.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Jun 4 22:58:26 EDT 2001
Fixed the bug that prevented 1st execution of plex86 to work. Linux
appears to be demand allocating/mapping the pages of memory returned
by a vmalloc. No problem, I just touch each page with one read
to force the lazy allocation to map the page in, so that we can
get the physical page address from the page tables. Just added a
little code in host_alloc(). Don't know if other hostOSes will need
this also.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Jun 4 17:03:44 EDT 2001
Changes to host-linux.c, thanks to suggestions from Jeff Garzik.
Moved plex86 proc entry to /proc/driver, where it should be.
Moved assignment of file_operations to declaration statement
and used field labels (GCC specific).
Elminated use of MOD_{DEC,INC}_USE_COUNT for kernel 2.4, and set
file_operations::owner to THIS_MODULE instead. This eliminates
a race between the time dev->release is called and module
unload is initiated on another CPU.
Used {>>,<<} instead of {/,*} where possible for page size oriented
calculations, in case the compiler doesn't optimize this for us.
Manage a set of virtualized descriptors in the monitor GDT, one for
each guest descriptor, and use those directly for native memory
accesses in the emulation, rather than always loading a new
GDT entry for each access. Things can be optimized further.
TODO next:
Fix error on first invocation of plex86.
Move some critical IO device emulation to VM monitor space for
performance. Mostly, the PIT/PIC and the hardware component
of the VGA emulation. JFYI, here's some instrumentation data
I gathered from a Win95 boot in plex86. I quote the number of
VM to user space requests necessary. The MemMapIOW is due to
writes to the VGA memory (latched planar mode sucks). TimeElapsed
is mostly due to time delivery events to the PIT. IOOut in
large part due to PIC EOI and etc. If I move PIT/PIC/VGA
into the VM, these will disappear. These redirects are expensive,
so I expect to see performance increase nicely without them!
The GUI component of the VGA emulation will stay in user space,
of course.
872068 MemMapIOWriteRequest
800406 TimeElapsed
324176 IOOutRequest
283248 MemMapIOReadRequest
153986 IOInRequest
10449 IOInBatchRequest
4029 IACRequest
78 PrintBuf
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue May 29 01:22:49 EDT 2001
The emulation code attempts to use native segment:offset accesses from
special assembly routines. A monitor fault handler catches when
these don't work and fixes things so that code flows through to
normal emulation. That really helped emulation speed!
Adjusted the cycles-per-instruction factor, since emulation is faster.
That helped significantly too.
I've got a bunch more accelerations to do. Will add some of these
before adding ability to run application code natively.
Some IO accelerations will be necessary *soon*. The faster the VM
gets, the slower IO is relatively speaking. Video/disk/floppy are
prime candidates.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat May 26 00:55:39 EDT 2001
Run everything in pure emulation mode (in VM monitor space).
I'll optimize the cpuEmulate() loop tomorrow. Currently, it
does the map_guest_laddr() call for every iteration. Only
need to do this when branching out of the current page, or paging
change occurs. Fortunately, I've done this trick before in bochs. :^)
Rebuilt the timer delivery system. I gutted out the framework that
was in plugins/bochs/pc_system.cc and built timer delivery services
into the VM monitor. The video/GUI updates are still based on
host time though.
I tested this stuff with FreeDOS/Pragma Linux.
I'm going to tune the emulation and some other things that are long
overdue next.
You may find some things run faster already, even with the inefficient
cpu emulation loop.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu May 24 15:01:00 EDT 2001
Created 'PATCHES' files at top-level.
Added static branch translations from DT prototype. Tested on
FreeDOS/Pragma - both work.
OK, most of the pieces are here now. There's still some more
instructions to deal with translations for, but it's more of the
same stuff. Plex86 is running the guest in 100% DT mode currently,
(though some instructions are translated as INT3 for now)
which is great for testing (abusing) the DT logic. But not
good for performance. Only really active ("hot") code should be DT'd.
Anyways, with enough DT working, on to the next steps:
1) Make plex86 default to running everything in emulation mode.
(should be quick to implement as it can already do this)
2) Let protected mode user code run natively. (Should
be reasonable - I did some of the work previously)
3) Release code for 1) & 2) to CVS. This should be a reasonable
step forward with performance.
4) Gather instruction frequency use and other data from 1),
and DT only active and well behaved code.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue May 15 12:33:05 EDT 2001
Integrated small NetBSD diffs from Frank van der Linden.
I moved a small amount of code out of the host-*.c files, into
monitor-host.c, beginning the process of migrating as much generic
code out of the kernel-specific modules as possible.
Uploading all new code (including DT stuff) to CVS.
BTW, I moved the names of the space specific files in kernel/, so
they made more sense. For example, 'mon-mode.c' became 'mode-mon.c'.
This way I can see all the related files for mode switching grouped
together with one 'ls' command.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon May 14 14:03:20 EDT 2001
Integrated a lot of new DT architecture (from dt-testbed/proto4) into
plex86. Eliminated the previous Software Instruction Virtualization
layer (SBE). Parts that are now integrated/added:
- Tcode (translated code) storage/allocation.
- Guest instruction address to tcode address sparse tables. These
are on a per-page basis.
- Reverse tcode address to guest instruction address sparse tables
for exception handling.
- Maintenance of two hash tables for high speed lookups. One
for guest offset (EIP) to tcode address, and one for linear
page address to page meta info index. These will be more important
when I integrate the branch translations.
- Invalidation of tcode based on writes to managed tcode pages.
- Revalidation of tcode pages across guest OS context switches.
- Arbitrary code expansion. We're not locked into maintain the
same page offsets anymore.
- Updated the 'PERFORMANCE' file with more related ideas/todos.
Parts not integrated yet. The only thing that wasn't integrated is
the branch translations. To make debugging easier, for this phase,
_all_ branches (even static intra-page branches) are translated as
INT3 and emulated by the monitor. This means performance will suck
until I add them. The code is prototyped already in dt-testbed/proto4,
and now the hash table management logic is tested and works. So this
should be reasonable to add in short time.
FreeDOS / Pragma Linux (kernel 2.0.33) / Win95 all work again.
I used 'conf/freedos', 'conf/pragma', and 'conf/win95'.
This release is for testing only. To decrease noise on the developers
list, test it only with host = {single processor Linux kernel}, and
guest = {FreeDOS, Pragma Linux} and guest = {Win95} if you already
have an installed disk image.
Performance will be very slow for this phase. This is OK and expected,
as every guest branch instruction is monitored/emulated. First,
I need your help to test this code. After a small amount of time
to shake out bugs, I will integrate the branch translation logic
from the prototype (phase#2), and things should get fun!
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Apr 28 15:30:00 EDT 2001
Changed xml FAQ doc to real xml QandA type.
More cleanup of proto4.
Enough work on the prototype - time to integrate this puppy!
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Apr 27 14:17:02 EDT 2001
Added top-level 'FAQ' which points users to docs dir. Better notes
in docs/README on how to ftp or generate formatted docs.
Entry in FAQ letting users know to wait for new OSes to run to
reduce list noise/redundancy.
Some more testing of proto4.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Apr 26 18:00:12 EDT 2001
More work on dt-testbed/proto4. Implemented reverse address lookup
table (tcode address to instruction address) capability. This is
needed for proper exception handling when the code is integrated
into the real VM environment.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue Apr 24 15:04:33 EDT 2001
More work on dt-testbed/proto4. Implemented real sparse lookup table
and storage mechanisms for tcode (translated code). Each code page
has it's own lookup table and a set of storage chunks, in which tcode
and lookup table information is stored. This plays nicely with the
dynamic page invalidation/revalidation scheme and guest instruction
address to tcode address hash table centricies.
Next, to implement a reverse lookup capability; mapping tcode addresses
to the corresponding guest instruction address, for handling
guest exceptions. This will use the same mechanisms as already
implemented so it should be fairly straighforward.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Apr 20 16:58:11 EDT 2001
Created dt-testbed/proto4. Added some framework in the header files
for tcode storage and forward/reverse instruction addr <--> tcode addr
lookup mechanisms. This is the last major component of this
testbed code to be coded, before integrating the new architecture
into the main code. Hopefully the last prototype revision.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Apr 13 12:43:45 EDT 2001
Wrote some more text in the Plex86 Users Guide.
A little docs/ clean-up.
Uploaded a formatted docs (docs/output/) tarball to
ftp://plex86.org/docs/
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Wed Apr 11 23:59:02 EDT 2001
Restrutured docs/xml. Put Plex86 Users Guide (PUG) and the
Plex86 Internals Guide (PIG) in separate directories. Makefiles
now use stock DocBook/XML tools from Mandrake 8.0 Beta 3.
Added one more graphic to the PIG (DT code cache storage).
More explanation text to come for this.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue Jan 23 19:31:58 EST 2001
Rerun of performance tests for dynamic branch handling, better
results now.
More notes in dt-testbed/proto3/README.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>:
Small mod to get NetBSD to boot from Krister Walfridsson in vga.cc.
Integrated dt-testbed/proto3 from Ramon. Ramon restructured some
things so he can research more advanced DT techniques in parallel
to the lightweight DT development.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Jan 19 12:11:14 EST 2001
More enhancements to dt-testbed/proto2, and more notes in the README.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Jan 14 21:36:48 EST 2001
More enhancements to dt-testbed/proto2, and more notes in the README.
Modeled computed branches.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Jan 12 22:57:11 EST 2001
More enhancements to dt-testbed/proto2, and more notes in the README.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Jan 12 15:54:22 EST 2001
More enhancements to dt-testbed/proto2, and more notes in the README.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Jan 12 01:13:29 EST 2001
Created new dir dt-testbed/proto2. Check out README in that dir.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Wed Jan 10 17:24:18 EST 2001
Moved previous files in dt-testbed to dt-testbed/proto0.
Created new dir dt-testbed/proto1. Check out README in that dir.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Jan 6 23:39:58 EST 2001
Integrated updates to write-cache from Tom Vijlbrief.
Reorganized docs/ a little. Split the xml docs into 2 docbooks.
There is now a PUG (Plex86 User's Guide) and a
PIG (Plex86 Internals Guide). I removed the tarball out of
the CVS tree, and will upload pre-generated docs to the FTP
server periodically. Look for docs-yyyy_hhmm.tar.gz.
The tarball now contains both HTML and PS formats.
There's also some notes on what packages are needed to generate
and develop your own docs. (docs/xml/README) This release should
make it easier for people to help out.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Jan 1 23:26:44 EST 2001
Added another docs chapter (17) to the user's manual, relating to
dynamic translation (DT) ideas for maintaining linear to translated
code address mappings and some other stuff. You can update from
CVS and just untar the docs/ tarball if you want.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Jan 1 11:04:34 EST 2001
Integrated write-cache plugin from Tom Vijlbrief, and his related
mods to the hard drive code, to handle > 32-bit file IO.
Integrated small FreeBSD Makefile mods from Alexander Langer.
Regenerated configure.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Dec 30 10:17:23 EST 2000
Integrated FreeBSD host port by Alexander Langer <alex@big.endian.de>
Note: this port does not work yet, but was uploaded so others
can work on it.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Dec 28 13:51:50 EST 2000
Integrated LBA patches from Tom Vijlbrief, to rombios.c and harddrv.cc.
I modified the patches slightly, and have not tested them much.
Am uploading changes to let Tom test them as integrated.
Tom was able to access up to 2GB partitions with his changes.
Generated new BIOS. Changed all conf files to use new BIOS.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Dec 28 10:32:57 EST 2000
Added dt-testbed dir. This is just a small separate testbed program
for developing thoughts about generated code for a quasi-dynamic
translation scheme. If you're interested in such developments,
look at the README file in that dir.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue Dec 26 16:34:49 EST 2000
Added framework for write-cache buffering (for "persistent disks").
Created new plugin, in directory user/plugins/write-cache/. It
does nothing currently, other than pass disk accesses to libc.
This is to make it easier for others to implement the actual logic,
without having to know much about plex86 internals. There are some
notes in the plugin C code.
I also created a new button (really lame) on the GUI. This triggers
a call to the plugin, so the user can select when to flush (commit)
the writes in the write-cache to disk and clear the cache.
Eventually, a nice menu system might do this with a "Are you sure?"
dialog or something similar.
It is possible that a large number of disk writes may exceed the
size of the write-cache (which should be configured by an option
to the plugin eventually). In that case, it would be good to present
the user with 2 options: 1) Quit altogether and ignore writes,
and 2) commit writes and continue. This should eventually be
GUI oriented, by stdin would be OK for now.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Dec 24 19:07:34 EST 2000
Integrated mods from Warwick Duncan for some remaining C++ -> C
comment conversions in plugin directories.
Added dynamic translation idea chapter to docs.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Dec 14 11:00:07 EST 2000
Guest NetBSD 1.5 works, small patches from:
"Frank van der Linden" <fvdl@wasabisystems.com>
Added loopback mount instructions to docs/ tree.
New docs/output.tar.gz file.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Dec 14 08:11:40 EST 2000
Integrated small diffs from Frank van der Linden:
Small patches to host-netbsd.c to fix minor interface changes,
and make plex86 compile on upcoming 1.5.x releases, as well as
the development NetBSD sources.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Dec 14 01:04:17 EST 2000
Integrated NetBSD port from
"Frank van der Linden" <fvdl@wasabisystems.com>
Added framework for running user code (ring3) without prescanning.
This isn't complete yet, so don't turn off prescanning.
IsNullSelector() takes type selector_t now.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Dec 10 17:27:17 EST 2000
Windows NT 4.0 Build 1381 Service Pack 1 boots. (added conf/winnt)
Enabled CDROM emulation. By default, CDROM emulation is compiled
into the bochs plugin now. Pass '--enable-cdrom=no' to configure
if you don't want it.
Added OUTSB_DXXb instruction emulation.
Replaced some monpanic calls with monprint.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Dec 9 15:14:55 EST 2000
Added 'docs/xml' directory.
Moved most existing documentation to XML/DocBook format.
There is a file 'docs/output.tar.gz' which is a pre-generated
set of HTML docs files, since most people won't want to generate
their own from the XML/DocBook source. Whenever you update
from CVS, go into 'docs' and type:
user:docs-> make clean
user:docs-> tar xvfz output.tar.gz
This will put files in 'docs/output/html/', as if you generated them
yourself. Then point your browser at 'docs/output/html/book1.htm'.
These docs need to be filled out and beautified. I just copied some
of the text files into <literallayout> sections.
Ultimately, I'm hoping some other people take over maintaining the
documentation tree.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Dec 7 21:38:38 EST 2000
Fixed handling of 16-bit stack segments in guest when monitored in PM.
QNX v4 demo boot floppy works now. (added conf/qnx)
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Nov 26 17:52:27 EST 2000
Urgent fix to nexus-mode.c. Was using pointers from wrong space!
If you ran a version recently, make sure to do the following:
- Reboot you system. You may have stepped on random memory addresses.
- 'make clean; make' from the top.
I'm going to give QNX a spin again after this fix.
If the recent mods broke something for you, give it a try again.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Nov 26 00:16:11 EST 2000
Optimization: prescan() returns -1 if the very first instruction
has already been prescanned, and is virtualized. Since this
instruction must be emulated, flagging this condition allows
us to eliminate unnecessary exception processing. Pretty cool,
just a few lines of code eliminated about 5% of execution time
in plex86.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Nov 25 23:22:53 EST 2000
Implemented IO instructions which were bombing Debian rescue floppy.
Fixed mode handling of monitor running guest code in v86 mode.
I booted the Debian rescue floppy image (2.2.17 kernel). The
root floppy seemed to mount OK, but I didn't have the patience
to continue the boot process. Let me know if you test this.
Added 'createdisk.sh' & 'createdisk.README' to the misc/ dir,
from Eric Laberge. These are scripts to create empty hard disk
images. I haven't tried them.
Also reran Prama Linux (2.0.33 kernel), FreeDOS, and Win95.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Nov 24 16:29:41 EST 2000
Integrated small bug fix from Robert Fitzsimons for plex86.c for
processing of command args.
Created REQUIREMENTS file, which lists CPUs that plex86 will work on.
This list was generated some time ago from the TLB test program.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Nov 24 14:18:59 EST 2000
Integrated small floppy.cc patch from Hanish Menon. If you specify
a floppy A or B as the boot device, but don't provide a valid
file/device, a panic will be generated. The BIOS still needs to
be fixed to detect if you do provide a floppy but it is not bootable.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Nov 24 10:38:25 EST 2000
Fixed problem with FreeDOS mini boot floppy image EIP > limit.
I forgot that (floppy) DMA transfers are writing to memory mapped
guest memory, so the prescan cache was not being invalidated.
Added an ioctl to invalidate the cache, and works fine again.
This may fix problems with other boot floppies not working.
BTW, the FreeDOS beta5 mini.bin image is not good. I got it from:
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/beta5/mini/mini.bin
Execution gets "sent into the weeds". After some time debugging
it, I popped it in a real PC, and it hangs on that too.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Nov 23 21:28:30 EST 2000
Replaced C structure copy with a call to our helper function
copy_memory() in nexus-prescan.c. User reported undef'd memcpy
without this.
Rehashed plex86.c options handling. You can pass all the config
file options on the command line now. Just use -o "option line".
Make sure to quote the text of the option if it has spaces or
magic characters, as each argument is passed to the config
option parser as it where an entire line in the config file.
You can also use multiple config files, or no config files at all,
though some options have to be set to do anything useful. Options
and config files are processed in the order in which they are
passed. You can now do things like:
./plex86 -o "memory=4" -f ../conf/freedos -o "db_syntax = at&t"
./plex86 -f /tmp/conf1 -f /tmp/conf2 -o "..."
./plex86 -o "..." -o "..." -o "..."
./plex86 -f ../conf/freedos
Added intelligent error reporting for options from command line
and/or config files. Exact line and character of errors are
reported to user, along with a message.
Config file option "load-rom" now has a colon following it, and
a comma delimiting options, for example:
"load-rom: file=../bios/BIOS-plex86-2000_0817a, address=0xf0000"
Config file option "prescan_depth" was replaced by:
"prescan: depth = N, ring3 = {on,off,auto}"
The "ring3" clause is not used yet, but will ultimately modify
the behaviour of SBE on ring3 code, according to your preference:
on = always control execution of ring3 code with SBE. (current)
auto = turn off SBE intervention when conditions look reasonable.
off = always turn off SBE intervention of ring3 code.
Some other cosmetics.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Wed Nov 22 14:55:57 EST 2000
Integrated small curses GUI patch from Josh Wilmes.
Integrated small load_module.sh patch from Mark Zealey.
Implemented INSB_YbDX instruction.
Small hacks to dma.cc to allow word read.
Use different virtualization opcode map when running guest in
v86 mode. This allows natural execution of instructions which
read selectors or reload segment registers. I notice this shaved
about 15% off the boot time for FreeDOS. Protected mode code
won't benefit from this mod.
Commented panic which was causing Windows to panic when you fired
up the Settings or Programs menu. Should handle cross dword boundary
memory mapped IO better in case it matters for a device in the
future. Anyways, I was able to start the Control Panel, and
shutdown Windows all the way to the final "OK to shutdown" screen.
Added docs/txt/DOS622.HOWTO from Michael Madore's email.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue Nov 21 14:33:14 EST 2000
Integrated patches for color text handling in curses GUI from
Josh Wilmes.
Converted all C++ comments to C for files in kernel space.
There's only a couple more straight C files in user space left to go.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue Nov 21 00:49:47 EST 2000
Added a bogus RDTSC instruction, implemented RETfar32_Iw and
defined bits in CR4 to get QNX to boot quite a ways. Panics
on use of PCD/PWT bits in PTE. Probably harmless. Will
try to update handling and re-run later.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Nov 20 22:25:53 EST 2000
Bug fixes and recoding of mon-paging.c. Some of the comments
for the mods need to be changed. I'll do that next.
Added an acceleration for INSW, transfer is done in user space
potentially in blocks of words direct to guest memory. I notice
FreeDOS boots from the disk image file in only a few seconds
after this mod. :^) This only helps if you do a REP INSW, which
the BIOS does. Could extend this method to other instructions.
Gives us an idea what special data transfer can do for performance.
This should model the kinds of gains we can get with special
guest OS device drivers.
VCode cache entries are invalidated individually. Before I was
dumping the whole set when one got stepped on.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Nov 19 16:04:40 EST 2000
Implemented WBINVD instruction. Ingnored for now. This was
tripping up some people's attempts to install/boot OSes.
Moved part of mon-prescan.c to host-prescan.c. This will eventually
contain multiple maps, one for each of various CPU modes. The
current map is used for all modes, which is very inefficient, since
in v86 mode, there is no need to monitor segment loads or selector
reads etc.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Nov 19 12:51:38 EST 2000
Integrated patches from Josh Wilmes for gui/curses.cc.
Integrated/completed code cache patches from Ramon van Handel.
There are now N code cache pages, rather than 1. We'll need
to look at various page algorithms to figure out which pages
to kick out of the cache when a new one is needed. For now,
ICACHE_PAGES pages is hardwired in kernel/include/monitor.h
Keep in mind there is one meta page and one vcode page for each
virtualized code page, thus we consume 2*ICACHE_PAGES. I have
this set to 64 pages which is 2*64*4096 = 512KB total.
Reworked mon-paging.c a little.
Bug fixed of macro LOG_BUFF_SIZE:
from (LOG_BUFF_PAGES*512) to ((LOG_BUFF_PAGES)*4096)
Single word disk IO is still dragging down performance. Need to
handle disk IO in blocks.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Nov 16 02:27:24 EST 2000
Changed use of macro current_got_fatal_signal() to
signal_pending(current), for Linux2.4.0-test10, as
per suggestion from Eric Warmenhoven. That macro was in
wrapper.h and went away with test10.
Fixes to emulation/fpu.c. Had '&&' instead of '||'.
Renamed files in kernel/. Files starting with 'host-' contain
code existing in host space. Files starting with 'mon-' contain
code existing in monitor space. And files starting with 'nexus-'
contain code existing in nexus space (access to both spaces).
This way routines can be coded to access memory in a particular
space more efficiently, without extra pointer dereferencing.
Added support of the A20 Enable line.
Many changes regarding handling of various guest CPU modes, and
the modes they are 'monitored' in.
Implemented more protected mode instructions and control transfer
logic.
Support guest v86 mode.
Handle legacy protected mode values in descriptor caches, after
transitioning to real mode, using virtualized segments and running
guest code in protected mode.
There are many #warning directives. Excuse the mess for now,
there is much to clean up.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Nov 2 16:56:09 EST 2000
Redirect memory mapped IO addresses in the VGA framebuffer,
to the VGA emulation. Took out hack to periodically copy
physical guest memory to VGA framebuffer. VGA graphics
modes should be enabled now.
Added an abort_code to the vm_t so we can tell where a panic
happened, if it is not safe to print a message. (for example
in the exception handler)
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Tue Oct 31 17:45:07 EST 2000
Filled in a little more emulation of task switches
and interrupt handling.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Oct 29 21:28:04 EST 2000
Linux kernel 2.4 works as a host now. (I used linux-2.4.0-test9).
There is a bug as of that version in the Linux kernel header
file 'include/linux/wrapper.h'. Macros mem_map_reserve()
and mem_map_unreserve() do not use the proper parenthesis.
They are listed as:
#define mem_map_reserve(p) set_bit(PG_reserved, &p->flags)
#define mem_map_unreserve(p) clear_bit(PG_reserved, &p->flags)
...but should be:
#define mem_map_reserve(p) set_bit(PG_reserved, &((p)->flags))
#define mem_map_unreserve(p) clear_bit(PG_reserved, &((p)->flags))
I just used set_bit() and clear_bit() directly to get around using
these macros.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Oct 27 14:58:38 EDT 2000
Added toplevel files 'TODO' and 'PERFORMANCE'. These describe
general stuff to-do and performance to-dos respectively.
Integrated patches from Jeff Dubrule:
user/user.c: also try opening /dev/misc/plex86.
kernel/monprint.c: get rid of varargs warning.
Couple small hacks to avoid panics in harddrv.cc for Tom's root-boot.
Search in that file for tomsrtbt, and uncomment the hacks. I
don't want to have these hacks in the code normally yet.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Oct 26 23:17:55 EDT 2000
Integrated DevFS support patches from Jeff Dubrule
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Oct 26 12:55:59 EDT 2000
Linux 2.0.31 boots! (Used a disk image file from bochs with
Linux already installed)
Added RTEMS to GUESTS file
Moved guest_context_t to kernel space. User code now interfaces
with monitor via guest_cpu_t. Got rid of set_guest_context()
and get_guest_context(). This broke the ICE plugin, which
I have commented out temporarily in the Makefile.
Monitor can now handle running guest in 3 modes:
1) Execution as normal (SBE controlled)
2) Execution by breakpointing (setting TF and run guest for
duration of one instruction at a time.
3) Emulation. Monitor keeps in an emulation loop.
Monitor print output is now channeled to user space program,
rather than system log. Mapped the 4k monitor print buffer
to user space for efficiency. Still have to clean up the
print code.
Fixed bug Ramon found in handle_fault, where 'from =' code was
evaluated too soon, possibly before a guest mode transition
resulting from emulation of a guest system instruction.
Lot's of #warning directives in C files to remind myself things
that need to be cleaned up. :^)
Fixed bug in kernel/prescan.c. If a branch instruction was found
at the maximum level of prescan recursion, then it would not
be virtualized.
Updated the paging code, both in kernel/vpaging.c and
emulation/paging.c. It now accurately handles error codes
and A&D bit updates in the page dir/table entries.
Changed the delivery of guest execution times and user space
periodic callbacks to the user code. Some stuff is hacky
and needs to be reworked.
Turned SBE on for real mode code (run in monitor as v86 code).
This will slow FreeDOS down until I optimize things.
SBE still only is dealing with one page at a time. This I
will change very soon. This rev will be very slow because
of this. Picture that every out of page branch dumps the
virtualized code cache. Ouch!
I think tomorrow, I can put a preinstalled Linux disk image file
on the 'net for developer to try. It's 126Meg file generated
some time ago with bochs.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Fri Sep 8 09:05:49 EDT 2000
Added FWAIT to list of instructions to virtualize
Coded POPAD32.
Filled out a little more of jump_protected
Created a suite of tests to examine updates of A&D bits in
PDE/PTE, test various paging permission handling, and
error reporting on real processor. Updated paging.c accordingly.
The virtualized paging in the monitor (vpaging.c) needs to be
synchronized with the emulation paging facility. Also, A&D
bits from the actual monitor page tables and the guest's page
tables need to be synchronized. (Same deal for the A bit of
data segment descriptors)
Need to detect case where guest code is modifying the page directory,
or the page table of the currently executing code. On a processor,
the TLB cache will be used until reloaded. Since plex86 is
dumping the page tables and rebuilding upon a write, this can
cause problems, and send guest code "into the weeds".
I'm also occasionally preparing some tests to throw into a test
suite for plex86, to validate the virtualization/emulation.
Think I'll make a separate validation module for the plex86
CVS tree. This well let people interested in being "testers"
help out more.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Sep 4 16:53:14 EDT 2000
In special cosimulation mode, plex86 boots Linux!
Fixes to virtualized paging; CR2 was not being set
More emulation of instructions which require virtualization.
Mods to paging code.
Created kernel/vsegment_nexus.c. Moved stuff here that needs to
be accessed from either host or monitor space.
Fixed some handling of segment/virtualized-segment synchronicity.
Fixed error handling init_module(). Must unregister services if
an error is returned, otherwise kernel goes unstable. Also
return negative error now.
Added emulation of hardware tasking.
Increased PLEX86_MAX_MONITOR_PAGES so bigger monitor will fit.
Fixed a bunch of inline assembly statements, so they explicitly
request 8-bit registers when necessary.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Aug 31 20:33:04 EDT 2000
Implemented OUTS instruction.
Fixed inline asms for some 8-bit instructions - added directives
to force compiler to use 8-bit capable registers, where
appropriate.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Aug 31 15:37:01 EDT 2000
Finished emulation of user-level integer instructions. The rest of
the instructions can be added as they are encountered. That
was a lot of typing. Anyways, I tried to implement emulation in
terms of inlined assembly use of the native instruction, whenever
possible for speed.
Now back to virtualization framework hacking, while booting
Linux/Windows in plex86...
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Wed Aug 30 17:03:40 EDT 2000
Added emulation of more user level integer-oriented instructions.
Only a few more to go... Then on to running Linux/Windows in the VM.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Aug 28 14:39:23 EDT 2000
Added emulation of a bunch more instructions. I'm working towards
being able to emulate all integer unit instructions. There's
another batch to do. Soon, I'll move on to getting Linux and
Windows running in plex86. Note that a lot of the emulation
isn't regularly used, but it will eliminate future panics
when a virtualization condition hits a random instruction.
It is also very useful for cosimulating against bochs and
debugging.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Aug 21 13:17:05 EDT 2000
Changes from Ramon:
BOCHS plugin now recognises the vga_update_interval
setting correctly.
Reduced the user executable size from approx 1.4MB
to 0.1MB.
Removed the superfluous --with-sdl command from
configure.in. {I generated a new configure (KPL)}
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Aug 17 00:55:17 EDT 2000
Added SDL code from Martin Garton (untested)
System BIOS now scans for additional ROMs, and calls the initialization
routine in them, if they exist.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Mon Aug 14 14:04:16 EDT 2000
Bugfix to kernel/emulation/fetchdecode.c. Not all prefixes would
be handled properly with respect to page boundaries.
Moved plex86.conf.* files to a newly created top-level 'conf' dir.
Added VGABIOS-elpin-LICENSE file.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sun Aug 13 17:31:04 EDT 2000
Tagged last version with 'plex86-0_1_0'
- "Kevin P. Lawton" <kevin@mandrakesoft.com>:
Plex86 now boots FreeDOS! Some real base instructions in
README.DOS
VGA BIOS from Elpin Systems, Inc, is now licensed for use with
plex86, courtesy of MandrakeSoft. It's in bios/VGABIOS-elpin-2.40.
Implemented emulation of a bunch of 16-bit instructions in
case virtualization conditions necessitate them.
Add ioctl calls to set/get complete guest CPU state.
Debug information now displays correct disassembly information for
real-mode, and protected-mode with segment bases not 0.
Converted C++ to C comments for files in the kernel/ tree
and top level of the user/ directory.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Aug 3 13:14:16 EDT 2000
Integrated patches from Ramon. He coded a new and more efficient
IO redirection service for routing IO requests from the VM
to the proper user space handler.
Integrated patches from Josh Wilmes. Minor error reporting on
failed open()/fstat() calls, and a wait option before terminating
program execution.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Wed Aug 2 15:30:46 EDT 2000
DOS 6.22 boots from floppy and disk image file. Anything other
than booting and typing 'DIR' will likely resulting in a panic,
since I only implemented enough instruction to get there.
Added running real-mode guest code capability to the VM. Code
is run in v86 mode in the VM. Modified the guest_context
stack frame conventions a little to accommodate the extra
data seg selector pushes in v86 mode.
Added more emulation of instructions.
Rearranged the user/plugin code to add more flexibility to
the plex86.conf initialization.
Plex86.conf can now pass bochs options to the bochs plugins.
Moved the BIOS over from bochs. A precompiled BIOS is available
in bios/BIOS-plex86-*. Added instructions to the toplevel README
on how to compile your own.
You can now load a system BIOS and VGA BIOS into memory. If
you load a VGA BIOS, then you don't need to use the replay_io
plugin.
Hacks:
Int 0x15, AH=0x87 is hacked in kernel/emulation/soft_int.c to
return CF=1 (error). This is because I don't support a
transition to PM yet from RM, necessary for extended memory
BIOS operations.
SBE is effectively disabled for running RM guest code. In
kernel/fault.c, there is a goto hack. I will take this
out at some point, after I get more instructions emulated,
so that SBE works.
In user/plugin.c, there are hacks to inport and output routines
for port 0x01f0 (hard disk).
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Jul 22 12:26:15 EDT 2000
prescan() is passed a linear address to read from instead of opening
a guest phy page. This is more efficient as the guest addr has
to be mapped in anyways.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Sat Jul 22 12:26:15 EDT 2000
Added all the remaining devices from bochs to plex86: CDROM,
CMOS, floppy, ...
Moved x86 instruction emulation code to kernel/emulation.
Corresponding header info was moved to kernel/include/emulation.h.
Emulation files are compile with -DEMULATION; emulation.h
exports only a few features to the monitor without this defined.
Linux as a guest partially boots. You will need 'initrd.img' and
'linux.img' if you want to play with this. These are the initial
ramdisk and kernel image files. Should panic with a HLT with IF==0.
The VGA text framebuffer at the time of panic is dumped to the
system log. Grab these files from the ftp site.
Fixed some bugs.
Added extra options to plex86.conf and code to be able to load
Linux into memory and set up the environment as it were loaded by
a real boot-loader.
Rehashed the way time events are delivered. This is unfinished.
Eventually there will be both a wall-clock time reference for
things like GUI updates, and a VM time reference. Will fix this.
VGA updates will be slow for now. Don't worry about this for now.
Added a macro ANAL_CHECKS to config.h.in. By default it's on. Some
extra safety checks are made or debugging purposes.
There is now a bios directory. This will ultimately contain the sytem
ROM BIOS. For now, it's a null BIOS. I changed the way the kernel
image loading was hooked with the BIOS. It is independent now.
VGA IO event replaying behaves like it did previously. Events are
read from a file.
Implemented a setjmp/longjmp for use with guest excepion handling.
In the file kernel/include/vmsetjmp.h, you can also use the gcc
builtin ones as well. These calls are bracketed with CLI/STI
instructions because I was debugging stuff, and I just realized
now that I left them in there.
Need to move 'user/plugins/bios' to something more suitable like
'user/plugins/load-kernel'.
Other stuff that I forgot about. Also, there might be some legacy
debug stuff in there that I forgot about.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: Thu Jun 29 01:25:34 EDT 2000
Bios plugin no longer loads the kernel image. This is done
separately now, by 'load-kernel.so'.
Added 'replay_io.so' in lieu of the vga.S file.
It replays the IO trace file 'misc/vga_io.log' to the vga
emulation. This is more efficient, and allowed for separation
of the BIOS functionality. This is in a new plugin directory 'misc'.
Added 'load-rom.so' which does nothing effectively, since we
don't have a ROM BIOS yet, but will load one when we do.
I changed plugin_load() so it adds modules to the end of the list.
This way, they are added in the order in which they are
used in the 'plex86.conf' file.
Created a new toplevel dir 'bios' which will ultimately hold
our ROM BIOS.
Stack_address is now a parameter to the kernel loader plugin.
Added line continuation character to plex86.conf for readability.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>:
Incoporated fix from Ulrich for broken logic in fetchdecode.c.
Added support for monitor interruptibility. Interrupts
disabled dwell time is really short. This version should
be a lot nicer to your host OS.
Fixed bug in sbe(); for guest CR0.PG==1, getting address of
monitor page table was wrong.
Fixed bug in get_cpu_capability(); added ecx and edx to list
of registers 'touched' by cpuid instruction for eax==1 case.
Split vm->state into vm->mon_state and vm->mon_request, to
keep things sane for an interruptible monitor. Because even
a HW interrupt needs to call sbe() after it's done, even the
end of the HW interrupt handler has to be interruptible
(the sbe() function can be long). Thus, HW int redirection
does not step on the vm->mon_state.
I added some extra push/pops to the transition code. Not sure
if all of it was needed. Will look into eliminating code
not needed. But, I wanted to quickly get a release out
that had the above fixes in int.
Please try all 3 guests: cooperative, preemptible, paging on
your machine and report.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>:
Added prescan_depth option to plex86.conf, and corresponding
ioctl kernel code so this parameter is now configurable.
Filled out some support for a guest with paging enabled.
The 'paging' guest now works!
Added a function to grok the CPUID instruction for feature
support.
Changed use of KERNEL_VERSION() to VERSION_CODE() in host-linux.
That wasn't defined on a lesser kernel.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Minor simplicfication of SBE logic.
Various interface cleanups.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: (plex86-2000_0618g)
Removed user/{emulation.c,emulation.h}; no longer needed. This
stuff is all done in the monitor now.
Abstracted a lot of the host-linux.c code to host-all.c. This
is a first step in making porting to other platforms easier.
Reworked some framework so that supporting a guest that uses
paging will be easier.
Renabled passing interrupts from user code to monitor.
The 'preemptive' guest works again.
Page tables are built dynamically.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>: (plex86-2000_0605b)
Added monitor log facility to use (printk like) to print
debug messages in either host or monitor space. Text
is redirected to the host kernel print facility.
Changed nexus functions to switch from host<-->monitor,
rather than host<-->guest. This gives us flexibility to
return to monitor code anywhere, including in the middle
of emulating an instruction.
Moved some fields out of nexus. Only data needed to
transition between host<-->monitor/guest context should be
in nexus. All other fields are easily accessible from either
space and should be in VM structure proper.
kernel/emulation.c now uses same fetchdecode function as
prescan code.
Totally recoded emulation.c, and split out emulation of
many functions into *.c files, which strangely mirror
the names of files in bochs. :^) Sorry, this helped
me keep things straight.
Added segmentation protection checks to data accesses,
control transfers, etc, in instruction emulation.
Added much protection model framework to instruction
emulation.
Paged guests are not supported yet, though much of the
new framework has been thought out with that in mind.
Likely only the cooperative guest works so far, as that's
the only one I've been working with, and I implemented
just enough to get it going.
Changed the user<-->host<-->monitor interface. The user
code does not participate in the emulation of instructions
any more, except to serve IO and other hardware requests.
SBE (Scan Before Execute = Prescan) logic is now an integral
part of plex86. In fact, both ring0 and ring3 code are
currently always controlled by SBE. Much thought went into
structuring the code, so that we can make a dynamic decision
to switch SBE off when running ring3 code, yet the emulation
functions will still work.
Lots of other doings...
NOTE: Things should and do run a _lot_ slower for the moment,
as everything is being controlled by SBE, and I'm not doing
some things very optimally. Things will speed up greatly
in the future.
- "Edouard G. Parmelan" <Edouard.Parmelan@quadratec.fr>:
Add module option to choose static device major number.
- "Jens Nerche" <jn4@os.inf.tu-dresden.de>:
Support for multiboot guest kernels.
Add shadow descriptors after LGDT.
Add ljmp emulation.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Added BIOS plugin; moved guest loading and VGA init there.
Port I/O dispatching fixes.
Don't call X routines from within signal handler.
Some coding style clean-up.
- "Bryan Meredith" <bryan@bear-mountain.demon.co.uk>:
Use dynamically allocated /dev/plex86 major number.
- "Edouard G. Parmelan" <Edouard.Parmelan@quadratec.fr>:
Fix incorrect plex86_proc_entry.namelen.
Fix OOPS in host2guest when compiled without SBE.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Automatically choose appropriate warning level when using gcc.
configure.linux removed.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Removed some more references to FreeMWare or FMW.
- "Edouard G. Parmelan" <Edouard.Parmelan@quadratec.fr>:
Fixed Makefiles to allow build in separate directory.
Added --with-linux-source= configure option.
- "C Hanish Menon" <hanish@innomedia.soft.net>:
Don't load guest code beyond available guest memory.
Removed data / bss offsets.
- "Kevin P. Lawton" <kevin@mandrakesoft.com>:
Mapped VM (vm_t) structure into monitor space.
Rehashed the vm_t structure and other framework so that
we can access VM fields from either host or guest address
spaces. If you stick to accessing VM fields using only
pointers in the 'common' substructure, code will work in
either space. The 'addr' field is actually just a pointer
which is changed during a space transition, to point to
set of pointers for that space. This way, general code
doesn't need to know or care what space it executes in.
Functions in kernel/fault.c now pass the 'vm' pointer on
to functions in kernel/emulate.c. Also, all functions in
kernel/emulate.c pass the vm pointer. These functions should
execute in either space now.
Moved vm_nexus() from kernel/include/monitor.c to kernel/fault.c
so it won't be used outside of these functions. It is space
dependent, and shouldn't be used outside of this file anymore.
It is used to grab the vm pointer from the nexus upon fault,
and is not needed thereafter during the fault handling.
- "Janek Hiis" <janekh@math.ut.ee>
Added #ifdef in kernel/host-linux.c for move of i_mmap field,
in newer Linux kernels. 2.3.99?
- "Kevin P. Lawton" <kevin@mandrakesoft.com>:
Integrated scan-before-execute (prescan) code into main
source tree. (It was previously developed independently)
Integrated split I&D TLB code into main source tree. (It
was previously implemented only in a small test program)
The above components are not fully operational yet. They
are not used by default. To try them, after typing
configure.linux, modify the kernel/Makefile CFLAGS
variable as per the commented line, then compile.
Otherwise they are not used, and things should function
as per previous revs.
Changed references to FreeMWare to plex86.
Added checks to return value of retrieve_vm_pages() calls
in kernel/host-linux.c. Also fixed one minor flaw there.
Created a docs/ directory structure. Moved the public paper
and memory address space graphic there.
- "Nick Bastin" <nbastin@mil3.com>:
Partially converted public paper to sgml/DocBook format.
Added new output targets to docs Makefile system.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Initial import of freemware-20000213 into plex86.
FreeMWare ChangeLog file is appended.
==========================================================================
- "Ramon van Handel" <vhandel@chem.vu.nl>:
New guest vs. monitor eflags handling.
IOPL dependent behaviour of STI/CLI/IRET.
Bugfix: correct limit handling for big segments.
Added new 'paging' guest kernel.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Added interrupt interception to kernel module and plugin interface.
Moved IF handling to kernel-side, using a VIF/VIP mechanism.
Various fixes/cleanups for the ICE plugin.
Use US keyboard map in virtcode.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Added VGA font and updated README accordingly.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Simplified loading of guest kernel.
Store page numbers instead of addresses in VM data structure.
Removed all dependecies on host.h from non-OS specific files.
Moved freemware.h to root, don't include kernel headers from user.
Removed unnecessary #include directives.
Removed Bochs macintosh GUI.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Removed the 'NT-flag hack'; instead set all but current code segment
descriptors to type 'data' to make iret trap. This allows to run the
*unmodified* cooperative and preemptive kernels.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Clean up: split user.c into multiple files.
Main executable renamed to 'freemware'.
Added emulation for ins/outs instructions (including rep variants).
[partially based on a patch due to Jens Nerche]
Added emulation of int3 instruction.
Always use 'bx_printf' for Bochs debug output.
- "Josh Wilmes" <josh@hitchhiker.org>:
Added curses UI for bochs plugin.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Added support for raising hardware interrupts to kernel module.
Added INTR interface between user and plugins.
Added PIC/PIT hardware models from Bochs.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Cleaned up user/kernel interface a bit.
General clean up: CFLAGS simplified, compiler warnings fixed.
- "Jens Nerche" <jn4@os.inf.tu-dresden.de>:
Added emulation for more instructions.
Updated 'virtcode' app to include minishell.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Miscellaneous bugfixes.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Simplified user mode instruction emulation interface.
Increased Bochs timer update frequency.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Resource allocation and event handling for plugins.
user.c reorganization / cleanup.
Added I/O emulation plugin interface to Bochs.
Updated 'virtcode' app to test keyboard input.
- "Jens Nerche" <jn4@os.inf.tu-dresden.de>:
Added support for in/out instruction emulation.
Fixed and improved VM dump.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Fixed AT&T syntax suffixes.
Added gdb remote protocol documentation.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Allow to change 'safe' guest flags from user mode.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Bugfix to 'mywait'. Make VGA timer handler restartable.
Fixed 'Power' button.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Removed .bin guest kernels (always use ELF).
Compile shared libraries with -fPIC.
Compile everything except kernel with debug symbols.
Fixed memory overwrite bug in plugin handling.
- "Oleg Drokin" <green@crimea.edu>:
Disable VGA timer handler before unmapping guest memory.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Added support for plugins.
Make Bochs device emulation framework a plugin.
Added ICE plugin for remote GDB debugger support.
Added AT&T syntax instruction decoding to decode.c.
Removed timeout handling; general clean-up of user.c.
- "Kevin P. Lawton" <kevin@bochs.com>
Integrated VGA, keyboard and certain IO device emulation framework
from bochs into FreeMWare. Writes to the text video memory
are now displayed in an X window via the VGA emulation. The
cooperative kernel was tested and displays fine.
Added periodic timer signal handler to user code, so it can
drive updates in the IO device emulation.
Expanded copyrights in user/ from 1999 to 1999-2000.
- "Ramon van Handel" <vhandel@chem.vu.nl>:
Updated README file.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Bugfix: return modified guest_context on EINTR.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Bugfix: monitor_pages should contain virtual, not physical addresses.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Removed linker script; retrieve module address range from kernel data.
Use standard 'current_got_fatal_signal()' test.
Return -EINTR instead of -ERESTARTSYS.
Added some missing .globl definitions in nexus.S.
Added NT flag hack to preemptive kernel as well.
Bugfix: do *not* allow direct I/O access to guest!
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Added emulation for lgdt/lidt/lldt/ltr/int/iret instructions.
Activated nexus selector migration (after lgdt).
Hack: set NT flag during guest execution so that iret traps.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Improved/fixed kernel emulation operand decoding.
Added decoding of some more instructions.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Separated monitor from guest initialization code.
Prepared for monitor/nexus linear address / selector migration.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Made transition code more self-contained; don't rely on host
parameters not changing over time.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Map module pages into guest at arbitrary linear adresses
by shifting the monitor segment bases accordingly.
Re-enabled monitor-side fault handlers.
- "Kevin P. Lawton" <kevin@bochs.com>:
Simplified nexus access via C structure.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Support for multiple VMs on the host (Linux) side.
- "Kevin P. Lawton" <kevin@bochs.com>:
Implemented transition into guest space using 'nexus' page.
Prepared for managing multiple VMs.
- <beef@niggard.org>:
Fixed some warnings.
- "Ben" <ben@comp.uark.edu>:
Portability fixes for Linux versions >= 2.3.25.
- "Todd T. Fries" <toddf@acm.org>:
Portability fixes.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Fixed incorrect decoding of some instructions (user).
Added effective address decoding to kernel emulator.
- "Jens Nerche" <jn4@os.inf.tu-dresden.de>:
Added beginnings of emulation framework.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Added Intel instruction decoder to 'user'.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Bug fix: run guest at IOPL 0, not IOPL 3.
- "Oleg Drokin" <green@crimea.edu>:
Fix signal handling on glibc systems.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Pass guest context from/to user space on FMWRUNGUEST ioctl.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Removed 'quanta' argument to FMWRUNGUEST ioctl.
Replaced 'quanta' handling in 'user' by SIGALRM-based timeout mechanism.
- "Jens Nerche" <jn4@os.inf.tu-dresden.de>:
here comes the patch for loading ELF binaries. I enhanced
the config file: text address, data address, stack address
and bss address are new options, and user.c undertands -d
for debugging messages now.
If the file is in ELF format, the text address is taken from
file, if it is a pure binary it's taken from config file.
data address and bss address are still unused.
- "Love" <lha@stacken.kth.se>:
Adapted Makefiles to allow build outside the source-tree.
- "Jens Nerche" <jn4@os.inf.tu-dresden.de>:
Command line parameters and config file for 'user'.
- "Ulrich Weigand" <weigand@informatik.uni-erlangen.de>:
Created 'guest' directory to contain various test guest kernels.
Moved dummy virtcode to guest/virtcode.
Added Ramon's nullkernel as guest/cooperative and guest/preemptive.
Made guest kernel to load a command line parameter to 'user'.
Reorganized interrupt/exception handling in kernel module.
- "Kevin P. Lawton" <kevin@bochs.com>:
Fixed soft_int macro.
fmw-19990826a:
- (UW) [host-linux.c] [host-linux.h]
Added check to prevent the guest physical memory from being
freed while still mapped to user space.
Added check to prevent duplicate allocation (memory leak!).
Use 'mem_map_(un)reserve' macros instead of manipulating page
flags directly.
- (UW) [user.c]
Unmap guest physical memory before freeing it.
fmw-19990825a:
[patch1 from UW]
- Use some linker/ELF magic to retrieve the linear address space
occupied by the kernel module at runtime.
- Walk the host page tables to retrieve a list of all physical pages
underlying the kernel module's code and data sections.
- Allocate memory for the monitor page tables, and set them up as follows:
* An identity mapping of the complete guest physical memory (at address 0)
* A mapping of the kernel module's code/data pages at the same
linear address as in the host space.
- Remove the dynamic allocation of interrupt reflection stubs
(sorry Ramon :-/).
These stubs are called in the guest VM, so using kmalloc() -- which
returns some arbitrary address inside host physical memory -- to
allocate them is not a real good idea ;-) I've moved them to memory
inside the module's data pages.
- Add the actual PDBR reloading.
[patch2 from UW]
- The do_nothing task is removed from the kernel module.
Instead, it is built as standalone executable 'virtcode.bin',
which gets loaded by the user app into the guest memory.
- The kernel module, on initial switch to the monitor, starts
executing the guest code in ring-3.
- A nasty problem with the mmap() implementation appeared:
It seems that Linux doesn't like if we map normal memory
pages using remap_page_range; apparently you are only allowed
to map 'hardware' pages. While it did seem to work, what
actually happened was that remap_page_range recognized the
page as normal memory page, and decided to map in an anonymous
page instead. Thus, the guest could access the mapped memory
perfectly well --- the only problem is that is accessed completely
different pages, which were mapped in by the standard nopage
handler :-/
This patch circumvent the problem by a very ugly hack: it
simply sets the PG_reserved bit of all those pages used for
guest memory, thereby declaring them as 'hardware range' ;-)
This works fine on my system (2.0.36), but I'm not at all sure
that it will work on other versions ...
Anyway, this needs to be fixed correctly, of course. I'll be
looking into this problem. For now, we need the hack, because
otherwise the user app is unable to load the guest code in ...
fmw-19990822b:
- (KPL) Converted to using GNU autoconf for easier configuration
on multiple host OS platforms. You only have to run autoconf
if you change the configure.in file. Otherwise, re-run
configure. To make things simple, and so that it's easy
to run configure with known flags etc, run ./configure.hostos,
where hostos is your host OS. I made one for Linux and
BeOS, though the BeOS one may be broken.
- (KPL) Integrated patch from Ulrich regarding looking for
signals in kernel module before looping on running guest OS.
- (KPL) Moved sti() call in host-linux.c into soft_int macro.
The IF change will not be recognised until after the INT
instruction, in this case, so there is no chance of an
interrupt intervening.
- (KPL) Created a NEED_RESCHED macro, so we can compile
for various Linux kernel versions. I don't know when the
change was made to put need_resched in the "current" structure.
I guessed 2.2.0. If this is not right, please let us know
when the change occurred.
- (KPL) added inline function pending_signals() to host-linux.c.
Please also fix the version number code that controls which
method to use to access the signals field in the "current"
structure. This was a small fix to get Ramon's changes
to compile on my 2.2.5 kernel. I'm not sure if the signals
> 31 are interesting to us. If not, we don't need the loop
code I put in the inline function.
fmw-19990821a:
- (RvH) I cleaned up all of the code, giving it bigger indents
and converting to C-style comments whenever things got really
ugly. It's still not the clearest code I've ever seen but it'll
do for now. I also moved the virtualised test code into a
separate file, virtcode.c.
- (RvH) I changed host-linux.c so that it takes the amount of
quanta to run as an argument to ioctl(). Now it doesn't trap
back to the user application on ever quantum. Question:
on 2.2 we use current->need_resched, but is this true for
2.0 too, or does it have need_resched as a global variable ?
- (RvH) I integrated Ulrich's mmap() code into the module, and
fixed it so that it compiles on 2.2 kernels.
- (RvH) I changed the way interrupts are allocated. Now, the
host code needs to call init_reflect() (in monitor.c) after
init_monitor() for every interrupt that needs to be reflected
back to the host OS. The monitor.c code then dynamically
generates and relocates a correct interrupt stub. The host
code is responsible for allocating/freeing memory for the
stubs.
- (RvH) I fixed up the interrupts so that the code works on my
SMP machine. I still have 2.0 code in there too, but I can't
test that --- can anybody test this on a 2.0 SMP box ?
2.2 SMP is rather annoying because it allocates lots of IPIs,
and most of them aren't fixed (2.2 SMP does not use the 0x20-
0x2f mapping for the PIC, but has everything go through the
I/O APIC with rather weird interrupt mappings). In order to
allocate the correct interrupts I need access to a kernel
array called irq_vector[], which unfortunately is not exported
to modules. Thus you need to patch the linux kernel if you
want to run this code on a 2.2 SMP box. The patch is simple:
put the following code in linux/arch/i386/kernel/i386_ksyms.c:
#ifdef __SMP__
#include "irq.h"
EXPORT_SYMBOL(irq_vector);
#endif
and everything will work just beautifully (or anyway, that's
what it looks like.)
fmw-990817c:
- (KPL) I added irq16 vector to the init_monitor() call.
If you pass a 0, no irq16 redirect handler is installed.
Irq16 is the APIC IPI interrupt, which is used on multiple
processor compiles of Linux (SMP). The code is untested.
In kernel/include/host-linux.h, I do this:
#ifdef __SMP__
# define IRQ16_BASE_VECTOR 0x30 // IPI vector
#else
# define IRQ16_BASE_VECTOR 0 // IPI not used on non-SMP
#endif
Let me know if this makes this code work on your SMP
Linux machine.
- (KPL) Fixed the previous interrupt bug, thanks to a find
by Ulrich and Ramon.
fmw-990817b:
- (KPL) Initial release. Has interrupt bug.
|