Commit Graph

850 Commits

Author SHA1 Message Date
Stanislav Shwartsman
cc694377b9 Standartization of Bochs instruction handlers.
Bochs instruction emulation handlers won't refer to direct fields of instructions like MODRM.NNN or MODRM.RM anymore.
Use generic source/destination indications like SRC1, SRC2 and DST.
All handlers are modified to support new notation. In addition fetchDecode module was modified to assign sources to instructions properly.

Immediate benefits:
- Removal of several duplicated handlers (FMA3 duplicated with FMA4 is a trivial example)
- Simpler to understand fetch-decode code

Future benefits:
- Integration of disassembler into Bochs CPU module, ability to disasm bx_instruction_c instance (planned)

Huge patch. Almost all source files wre modified.
2012-08-05 13:52:40 +00:00
Stanislav Shwartsman
a1ebdc41ac Fixed SF bug [3548109] VMX State Not Restored After Entering SMM on 32-bit Systems
Fixed .conf.nothing configure script

Fixed copyright for some files
2012-07-27 08:13:39 +00:00
Stanislav Shwartsman
e0729e32b8 fixed bug 3548108 VMEXIT instruction length Not always getting updated 2012-07-26 16:03:26 +00:00
Stanislav Shwartsman
d9998269ef added branch_eip into near branch instructiontation callbacks 2012-07-24 15:32:55 +00:00
Stanislav Shwartsman
5d66e8450e implemented ADCX/ADOX instructions from rev013 of arch extensions published by Intel 2012-07-12 14:51:54 +00:00
Stanislav Shwartsman
1964ef679a fixed compilation with x86-64 disabled 2012-07-01 14:46:27 +00:00
Stanislav Shwartsman
f12396566c added CR8 to control registers print in debugger 2012-06-28 18:27:26 +00:00
Stanislav Shwartsman
515d8b5c25 add new instrumentation callbacks for physical memory access from CPU 2012-06-18 11:41:26 +00:00
Stanislav Shwartsman
39c14ef0d1 Implemented EPT A/D extensions support.
Bochs is fully aligned with the latest published revision of
Intel Architecture Manual (revision 043) now.
2012-05-02 18:11:39 +00:00
Stanislav Shwartsman
d4688e8b95 - Do not compile support for alignment check (#AC exception) by default
for CPU emulation performance reasons, the alignment check compilation
    still can be enabled using configure option --enable-alignment-check.

There is no software in the world which enable #AC exception checking, this
x86 feature is completely legacy but its emulation support costs up to 3-5%
emulation speed.

The checking for #AC exception enable still will be done, if

 CPL == 3, EFLAGS.AC = 1 and CR0.AM = 1

but the alignment check is not compiled in, the Bochs will PANIC with corresponding message.
You can press 'always continue' and ignore the PANIC, the simulation will continue as if alignment checking is not enabled.
2012-03-25 19:07:17 +00:00
Stanislav Shwartsman
3ca29cbdf3 stack direct access optimization - 5% emu speedup to all 32-bit guests, for 64-bit guests speedup is less because they have less stack accesses 2012-03-25 11:54:32 +00:00
Stanislav Shwartsman
b5a33e82ac fixed a lot of code duplication in debugging/instrumentation of mem access 2012-03-20 18:26:04 +00:00
Stanislav Shwartsman
e1506e3e29 some cleanup in CPU code + patch SVM SS.DPL instead of failing VMRUN 2012-03-19 19:24:15 +00:00
Stanislav Shwartsman
bd4aa017fe Lazy flags improvement patch by Darek Mihocka - measured 5% speedup everywhere accross the board
The problem with Parity is it is generally referenced very rarely so the current lazy flags code is not efficient to updated Parify flag only (because it updates low 8 bits of .result value the existing Zero Flag has to be shadowed in .auxbits.
So I flipped it around, to make Parity be shadowed in auxbits.  .result now is only needed to derive Zero Flag, and both Sign and Parify are derived from .result + .auxbits (as Zero Flag is now).  For the 90% of the conditional jumps that are JZ or JNZ, this is a speedup.
Parity is now derived from 8 bits in .result and 8 bits in .auxbits, and Sign is derived from one flag in .result and 1 bit in .auxbits by XOR-ing them all together.  It makes the code sequences for SAHF and POPF simpler too.
2012-03-17 08:51:52 +00:00
Stanislav Shwartsman
25ffaeeea8 fixed VMX issue + small code reorg 2012-03-13 15:18:21 +00:00
Stanislav Shwartsman
1f14c171ed rename some SSE handlers 2012-02-28 18:53:58 +00:00
Stanislav Shwartsman
d4541f1a88 removed dedicated handler for MOVNTI - can be replaced with existing handlers 2012-02-27 15:50:43 +00:00
Stanislav Shwartsman
959ab435cf fixed compilation err with SVM 2012-02-24 21:31:31 +00:00
Stanislav Shwartsman
92376fb693 svm updates 2012-02-19 12:16:58 +00:00
Stanislav Shwartsman
bb7a648d91 Major commit !
------------

Implemented SVN nested paging support - the Virtual Box boots perfectly with Nested Paging guest !
A lot of code duplication was added for now - major cleanup will follow later.

! Added AMD Phenom X3 8650 (Toliman) configuration to the CPUDB - this configuration has Nested Paging enabled.

Some CPUID modules rework done to enable Toliman configuration.

Ckean up 'executable' attribute from all CPU source files.
2012-02-13 23:29:01 +00:00
Stanislav Shwartsman
813fe4e6b9 reduce code duplication - continue preparing for nested paging implementation 2012-02-13 20:06:04 +00:00
Stanislav Shwartsman
0b5f798af1 re-commit changes from SVN rev11026 which were accidentially undo'ed by last Volker's commit 2012-02-12 19:13:57 +00:00
Volker Ruppert
de94b08a1a - class bx_list_c now contains a chained list of parameters. Removed the now
obsolete maxsize parameter from all lists.
2012-02-12 18:43:20 +00:00
Stanislav Shwartsman
855d2adece cleanups in paging code 2012-02-12 16:09:35 +00:00
Stanislav Shwartsman
9bebe91826 eliminate duplicated cpu methods by adding extra param to opcodes with no modrm 2012-02-03 10:24:59 +00:00
Stanislav Shwartsman
14ec87768e expand FCMOV function to 8 different functions - each one is much simpler to implement and understand 2012-02-01 12:07:53 +00:00
Stanislav Shwartsman
9461797886 added extra param to debugger phy access callback + cleanup in vmexit functions 2012-01-17 21:50:15 +00:00
Stanislav Shwartsman
7d641450ec remove param from check_entry_PAE function - it is always the same for all calls 2012-01-15 20:25:39 +00:00
Stanislav Shwartsman
4db23355cd rework in paging code before nested paging implementation for SVM - step 1 2012-01-15 17:54:13 +00:00
Stanislav Shwartsman
f5d55f5eb6 - Implemented Task Switch intercept in SVM, cleanup in task switch handling code
- Changed (c) year in several cpu files
- Cleanup and indent fixes in VMX code
2012-01-11 20:21:29 +00:00
Stanislav Shwartsman
cb366e00c5 fixed code duplication in exceptions 2012-01-11 06:27:35 +00:00
Stanislav Shwartsman
2900956327 Split back some frequently used arithmetic and logic opcodes (which were done as Load+Op before). 2012-01-09 13:09:59 +00:00
Stanislav Shwartsman
76ee7b499b svm updates 2012-01-08 14:09:51 +00:00
Stanislav Shwartsman
0e17f8f195 implemented AMD APIC extensions for SVM support 2012-01-04 16:06:37 +00:00
Stanislav Shwartsman
a0b5ff48ec more SVM fixes 2011-12-31 14:22:51 +00:00
Stanislav Shwartsman
3c0d712146 SVM fixes 2011-12-31 13:58:55 +00:00
Stanislav Shwartsman
0a14f08f16 completing SVM coding, missed - CPUID, extended APIC 2011-12-28 16:12:28 +00:00
Stanislav Shwartsman
2b8371f2b6 implemented SVM_GIF handling 2011-12-27 20:46:15 +00:00
Stanislav Shwartsman
7f5f917a34 more SVM implementation 2011-12-27 19:42:11 +00:00
Stanislav Shwartsman
6ae86a059b firt cleanup in SVM code. added intercept check for MSR and IO 2011-12-26 19:57:39 +00:00
Stanislav Shwartsman
8b4a2c2034 implemented some more intercepts.
fixed compilation without SVM
2011-12-26 16:33:13 +00:00
Stanislav Shwartsman
bfcbb81602 SVM:
- IO intercept is not implemented yet
 - MSR intercept is not implemented yet

VMX:
 Fixed Bochs PANIC crash when doing I/O access crossing VMX I/O permission bitmaps.
 This can happen because access_physical_read and access_physical_write cannot access memory cross 4K boundary.
2011-12-25 22:09:31 +00:00
Stanislav Shwartsman
a44c1b8e1e SVM and VMX share tsc offset code 2011-12-25 19:53:23 +00:00
Stanislav Shwartsman
75bda1d5cd implemented SVM emulation support for Bochs (incomplete yet)
I am merging the code in order to start making shortcuts between VMX emulation and SVM emulation.
Of course SVM emulation is incomplete, completely untested and not expected to work.
But someone could already take a look one the code and give some suggestions.

Also looking for anybody with existing SVM kernels - as simple as possible - for testing.

Status:
 - exceptions intercept is not implemented yet
 - IO intercept is not implemented yet
 - MSR intercept is not implemented yet
 - virtual interrupts are not implemented yet
 - CPUID is not implemented yet

No advanced SVM featurez planned - I am implementing the very basic 'Pacifica' document from 2005 using QEMU code as reference.
2011-12-25 19:35:29 +00:00
Stanislav Shwartsman
e7ed8aca5c move inhibit interrrupts functionality to icount interface 2011-12-21 06:17:45 +00:00
Stanislav Shwartsman
f6203dae7d instrumentation: added special indication for indirect call/jump 2011-12-18 18:11:56 +00:00
Stanislav Shwartsman
b8f2d91b9a fixed compilation err 2011-11-28 21:16:40 +00:00
Stanislav Shwartsman
8cb359fab5 fixed flags handling for BMI instructions 2011-11-27 13:23:26 +00:00
Stanislav Shwartsman
100622e958 fix ULL suffix for 64bit int, use BX_CONST64 instead 2011-11-26 19:01:53 +00:00
Stanislav Shwartsman
c74f590077 implemented TSC-Deadline APIC timer mode 2011-11-21 12:51:50 +00:00