Commit Graph

363 Commits

Author SHA1 Message Date
Stanislav Shwartsman
55ceecf79b Small optimization in icache page-write-stamp 2006-02-28 17:47:33 +00:00
Stanislav Shwartsman
79306b851c Separate fetch/decode instruction block to stand-alone method.
The method could be reused when building instruction trace for DT
2006-02-23 18:23:31 +00:00
Stanislav Shwartsman
5c58b22f44 Fixed opcode names according to Intel docs
Fixed bug found during disasm validation
2006-02-17 13:34:31 +00:00
Stanislav Shwartsman
203a9caf31 SMM mode could leave together with pmode or any other (according to amd docs)
so we need separate bx_bool indicator in_smm instead
2006-02-14 20:03:14 +00:00
Stanislav Shwartsman
024ce249bf Define SMM mode for future implementation.
I would like all next commits be aware of SMM mode.
It can't be implemented right now (too many questions w/o answers) but it will be done till next major release definitelly.
2006-02-14 19:00:08 +00:00
Stanislav Shwartsman
2646484dc1 Fix 'show' command in Boch debugger.
Fully supported show-interrupts, show-mode and show-call options
Enable toggling of show options (bug report from SF)
2006-02-12 20:21:36 +00:00
Stanislav Shwartsman
1d4fa8b327 Available back ability to use eip register as source in 'set reg = <expr>' cmd.
Setting the eip register still not available (deliberatelly).
I don't want to enable it util I find some easy interface to do it.
I don't want to allow setting of part of RIP register using 'set eip=<expr>' and leave the upper part unchanged ....

Remove unused test registres from debugger
Fix compilation error in cpu.h
Change trace-on/trace-off commands. Make one 'trace' command with usage of 'trace on/trace off'
2006-01-31 19:45:34 +00:00
Stanislav Shwartsman
067f23e3da Fix set 'ah,bh,ch,dh' registers from debugger
Enable disasm by default - in adds some useful information to debug messages in log file
Remove defines for 8bit registers from cpu.h, the x86 arch defines not match defines used by set_reg and get_reg methods.
2006-01-27 19:50:00 +00:00
Stanislav Shwartsman
18afa9fd2d This is cumulative patch for bochs debugger, it is only very first step towards working debugger supporting all new simulator functionalitieS.
- move crc.cc from debugger to bochs folder and make it projct-wide and not local for debugger
 - added new 'info sse' command for debugger
 - extend 'modebp' command to break on any mode change
 - remove unimplemened 'info program' function, it is always printed fixed text
 - move debugger help to parser, cleanup and simplify it
2006-01-24 19:03:55 +00:00
Stanislav Shwartsman
9df8079206 Write to MSR_TSC implemented (patch by Bryce) 2006-01-21 12:06:03 +00:00
Stanislav Shwartsman
08c15c67c0 Don't know how much it helps ...
First step to make bx debugger supporting x86-64. guard_found object fields conerted to bx_address for x86-64 support.
2006-01-19 18:32:39 +00:00
Stanislav Shwartsman
2c8f6f7720 Merged patch: determine number of processors to emulate through .bochsrc 2006-01-18 18:35:38 +00:00
Stanislav Shwartsman
89e3472178 Fix validate_seg_regs check 2006-01-09 19:34:52 +00:00
Stanislav Shwartsman
dfc633ef0a New debug function in cpu 2005-12-19 17:58:08 +00:00
Stanislav Shwartsman
cd2a8da34c Add more debugging/instrumentation functionality 2005-12-14 20:05:40 +00:00
Stanislav Shwartsman
f863d1e902 Generate #GP exception instead of #TS when TSS selector points to bad TSS 2005-12-12 19:44:06 +00:00
Stanislav Shwartsman
8c91790680 Redefine registers accessors in cpu.h
Change BxSupportPAE and BxSupportGlobalPages macros to Bochs style names
Set bx_cpu_id in BX_CPU_C constructor (safe way)
Backup cpu-level check for paging features at compile time (already checked in configure)
Some warnings and indent fixes
speed up get_segment_base method for x86-64 case
2005-11-26 21:36:51 +00:00
Stanislav Shwartsman
670395f1be VME support - beta #1 2005-10-17 13:06:09 +00:00
Stanislav Shwartsman
e83c77db49 Preparing to VME implementation
DO NOT ENABLE VME option until the implementation will be completed !
2005-10-16 23:13:19 +00:00
Stanislav Shwartsman
7022be46f5 Fix undefined flags handling for ROR and RCR instructions 2005-10-13 19:28:10 +00:00
Stanislav Shwartsman
8c783bc329 Fixed cpu_mode corruption in x86-64 mode
Removed all potentially unsafe and duplicated code in setFLAGS methods to avoid such kind of problems in future
2005-09-29 17:32:32 +00:00
Stanislav Shwartsman
d1c722211e Fix duplicate opcodes, fix opcode names and disasm bugs 2005-09-23 16:45:41 +00:00
Stanislav Shwartsman
95b12d7429 #SF patch fixed transition from vm8086 to PM 2005-09-11 20:00:29 +00:00
Stanislav Shwartsman
33c0c5367c Fixed bug in tasking.cc last change 2005-09-03 11:39:26 +00:00
Stanislav Shwartsman
086ee4c9aa Fix code duplication in tas 2005-08-28 17:37:37 +00:00
Stanislav Shwartsman
823dfa6f40 This code will be required for dynamic translation in future.
For now it is no more than code duplication fix ...
2005-08-23 20:01:54 +00:00
Stanislav Shwartsman
126069829d Fixed compilation error when icache is disabled 2005-08-13 14:10:22 +00:00
Stanislav Shwartsman
b192b2af9b Optimize pageWriteStamp checking 2005-08-10 18:18:57 +00:00
Stanislav Shwartsman
37bd193337 Split PUSHF/POPF to 3 different methods according to op size.
By the way fix VIP/VIF flags handling in POPF/PUSHF (future fix for VME)
2005-08-08 19:56:11 +00:00
Stanislav Shwartsman
8be190d848 Implemented RDTSCP instruction 2005-08-05 12:47:33 +00:00
Stanislav Shwartsman
ea30a3ef06 Implemented CALL FAR in 64-bit mode 2005-08-04 19:38:51 +00:00
Stanislav Shwartsman
084b4fa2b2 Fixed IRET implementation for long mode 2005-08-03 21:19:11 +00:00
Stanislav Shwartsman
3681126235 Fixed ugly load_ss64/mode changing workaround in exception.cc 2005-08-03 21:10:42 +00:00
Stanislav Shwartsman
d8ab4e3424 Fully implemented jump_far and ret_far in 64-bit mode.
Note that I am not sure about 100% correctness, I am just coding Intel specs ...
Code review and massive testing still required.
2005-08-02 18:44:20 +00:00
Stanislav Shwartsman
f096a80716 Fix code duplication for check_cs descriptor
The function will execute
 - segment is executable code segment
 - conforming/non-conforming segment priviledge checks
 - segment is present
2005-08-01 21:40:17 +00:00
Stanislav Shwartsman
954aae3f99 Speedup push/pop operations, they actually not needed to do can_push/can_pop checkes, the same checkes already done in read/write_virtial methods
Split push_seg_reg methods according to op size
2005-07-31 17:57:27 +00:00
Stanislav Shwartsman
5da36b7d3d Fixed code duplication, added canonical address checking for RETF in long mode 2005-07-29 06:29:57 +00:00
Stanislav Shwartsman
2b5a812674 Split last bit.cc methods according to os16/32/64 2005-07-25 04:18:20 +00:00
Stanislav Shwartsman
51e03f071d Fixed XLAT instruction for x86-64
Small optimization for lazy flags for ADD/ADC/SUB/SBB instructions
Enable RETF64 for same privelege level return
2005-07-21 01:59:05 +00:00
Stanislav Shwartsman
169fa0c574 Clearify the code. x86-64 code always running in pmode so it is not needed to check if we are in protected mode everytime 2005-07-10 20:32:32 +00:00
Stanislav Shwartsman
01d8a97613 Try to cleanup/rewrite RepeatSpeedups optimization
This code doesn't add new speedups but makes it very easy
After some validation it could be no problem to enable repeat speedups optimization for REP MOVSx with any address size. And REP STOSx too.
2005-07-04 17:44:08 +00:00
Stanislav Shwartsman
64f6d8c293 Separate force_flags function from read_flags (fix code duplication) 2005-06-16 17:25:04 +00:00
Stanislav Shwartsman
0b60100a0d Merged patch for Hkan T. Johansson
TLB access bit optimizations
2005-06-14 20:55:57 +00:00
Stanislav Shwartsman
663f7d5ef3 CMPXCHG16B instruction implemented 2005-05-19 20:25:16 +00:00
Stanislav Shwartsman
caa0648188 Move duplicated code to separate function
And fix a bug I added by previous merge
2005-04-17 21:51:59 +00:00
Stanislav Shwartsman
6fa52214b0 Canonical address check for RIP in x86-64 2005-04-17 18:54:54 +00:00
Stanislav Shwartsman
0b6a3afb53 Fixed compilation problem in segment_ctrl.pro
Restore back the workaround for segmentation checking in exception.cc until the better solution will be found
2005-04-13 17:13:05 +00:00
Stanislav Shwartsman
9b30cad4c4 Just software changes:
1. Separate interrupt function to 3 different functions (real_mode, long_mode, pmode)
2. Added PANIC messages for not implemented FAR CALL, FAR JUMP and FAR RET in long mode
2005-04-12 18:08:10 +00:00
Stanislav Shwartsman
c2c18d2aa4 Clean fix for loading NULL SS selector in exception.cc 2005-04-11 18:53:04 +00:00
Stanislav Shwartsman
1755589376 Separate pageWriteStamp from ICACHE. The pageWriteStamp has totally independant structure and could be used in future with icache structure. Also it could be significantly speeded up using BX_SMF analog constructions. 2005-04-10 19:42:48 +00:00
Stanislav Shwartsman
6d491de4d3 Fixed bug with jumping from long mode when executing interrupt 2005-03-30 22:31:03 +00:00
Stanislav Shwartsman
0f7f728e86 Added debug messages for interrupt function in long mode
Added mode switch debug prints
2005-03-30 20:53:04 +00:00
Stanislav Shwartsman
da9091f04a Fixed compatability mode execution bug, compatability mode and long mode should be treated as protected for all protected_mode() checks 2005-03-29 21:37:06 +00:00
Kevin Lawton
831afe7c40 Removed unused instruction (function) prototypes which were generated as
a result of the initial implementation of AMD64 support.  These appear
  to have been cut-n-paste vestiges.
2005-03-25 21:33:47 +00:00
Kevin Lawton
e6cb602231 Moved macros for duplicate SSE/SSE2 functions from fetchdecode.h to
cpu.h, and defined function prototypes for the case where bochs
  is compiled with a new #define (called StandAloneDecoder) is set.
  This allows for the decoder to be tested separately from bochs.
2005-03-23 01:45:16 +00:00
Kevin Lawton
4e03c4448c Added some comment tags so that a script can pull out relevant parts
of the decoder to test it in standalone mode.  A few lines in cpu.h
  were re-arranged to make this easy, but no real lines of code were
  changed or generated.
Changed a few PANICs to INFOs after testing corresponding cases.
2005-03-22 18:19:55 +00:00
Stanislav Shwartsman
f77ddd9701 Remove cpu_onlline_map varaible, it wasn't initialized properly and might cause APIC problems 2005-03-19 18:43:00 +00:00
Stanislav Shwartsman
6e53a54907 Extend cpu_mode for :
#define BX_MODE_IA32_REAL       0x0   // CR0.PE=0
#define BX_MODE_IA32_PROTECTED  0x1   // CR0.PE=1, EFLAGS.VM=0
#define BX_MODE_IA32_V8086      0x2   // CR0.PE=1, EFLAGS.VM=1
#define BX_MODE_LONG_COMPAT     0x3   // EFER.LMA = 0, EFER.LME = 1
#define BX_MODE_LONG_64         0x4   // EFER.LMA = 1, EFER.LME = 1
2005-03-15 19:00:04 +00:00
Stanislav Shwartsman
189e55885d put VME initial code in BX_SUPPORT_VME ifdefs 2005-03-13 20:18:37 +00:00
Stanislav Shwartsman
fd13784231 Small cleanup in access.cc
VME feature code should be valid only for CPU LEVEL >= 4
2005-03-12 19:34:18 +00:00
Stanislav Shwartsman
2a5a5c2de5 Fixed compilation error for 486 CPU
small fixes for IRET instructionm
2005-03-12 16:40:14 +00:00
Stanislav Shwartsman
24fa5935c1 Getting little bit closer to VME feature 2005-03-09 22:01:13 +00:00
Stanislav Shwartsman
709b218c10 Reduce metaInfo initialization in fetchDecode 2005-03-01 21:44:01 +00:00
Stanislav Shwartsman
b25088bf2f Merge patch [1153327] ignore segment bases in x86-64 by Avi Kivity 2005-02-28 18:56:05 +00:00
Stanislav Shwartsman
c583a6f9cf move segments and descriptors definitions and macroses for new descriptor.h 2005-02-27 17:41:45 +00:00
Stanislav Shwartsman
2bfc842c09 CPU fixes by Kevin Lawton 2005-02-16 21:27:21 +00:00
Stanislav Shwartsman
91526a90b3 Merged patch
[1123895] x86-64 gdb/debugger fixes by Avi Kivity
2005-02-16 18:58:48 +00:00
Stanislav Shwartsman
799403620e Small speedup in boundaryFetch method 2005-02-12 14:00:13 +00:00
Stanislav Shwartsman
9305305493 First (and may be last) step to implementation of
Virtual Mode Extensions (VME)
and
Protected Mode Virtual Interrupts (PVI)
instructions STI and CLI have full support of these features, according to Intel docs. Need to check POPF and PUSHF instructions and afterwise VME and PVI extensions could be enabled in CR4
2005-02-03 22:08:34 +00:00
Stanislav Shwartsman
bbcc5e0e3a Split BOUND instruction to two different according to operand size
Coding style change
2005-01-28 20:50:48 +00:00
Stanislav Shwartsman
8fe15b0ddc Fixed compilation error 2004-12-17 10:50:49 +00:00
Stanislav Shwartsman
f5b64a3a59 more preparations to NXE feature 2004-12-16 22:21:35 +00:00
Stanislav Shwartsman
da24883199 Extend page directory entries to 8 byte in PAE mode when X86_64 is enabled
(prepartions to NX feature implementation)
2004-12-13 22:26:36 +00:00
Stanislav Shwartsman
46bb3d8853 remove duplicated data arrays from CPU 2004-12-11 20:51:13 +00:00
Stanislav Shwartsman
0d09a8c8a8 fix code duplication 2004-11-26 19:53:04 +00:00
Stanislav Shwartsman
69c0b06955 fixes in disassembler
split REPEAT instructions according to opsize to speedup execution
now each REPEATABLE instruction splitted to 3 different instructions, one for 16-bit operand size, one for 32-bit and one for 64-bit. Choosing of correct instruction occure in fetchdecode step.
2004-11-20 23:26:32 +00:00
Stanislav Shwartsman
645e04860e For now : disable fetching from physical address 0xFFFFFFF0 after #RESET
because ICACHE do not support physical address > mem.len.
This is the first part of the fix, the rest coming soon
2004-11-18 23:16:36 +00:00
Stanislav Shwartsman
7b62a6e206 Fix reset registers in CPU for #RESET signal
Extract ICACHE from cpu.h to separate icache.h
2004-11-14 19:29:34 +00:00
Stanislav Shwartsman
2ce5495d38 Fixed compilation errors 2004-11-03 06:35:48 +00:00
Stanislav Shwartsman
2ed7e4eed5 EIP > CS.limit should be checked in real mode too.
Enable for now for JUMP instructions, still todo - CALL and RET
2004-11-02 17:31:14 +00:00
Stanislav Shwartsman
f06c8b6b95 EIP > CS.limit should not be a problem
Manual says that GP(0) shouldd be generated in this case ALWAYS
Fixed instructions PANIC messages to ERROR for this case
And ... do not leave PANIC messages w/o taking care that user could push CONTINUE button and program should know to continue after the PANIC code line. Mainly in rerurn instructions were several problems ...
2004-11-02 16:10:02 +00:00
Stanislav Shwartsman
a9022ac5cb Fixed compilation prroblem reported in bug
[ bochs-Bugs-913418 ] compiler errors with --enable-external-debugger option
Remove code duplication
2004-10-29 21:15:48 +00:00
Stanislav Shwartsman
5e23909c7c prepations for NX bit implementation 2004-10-21 18:20:40 +00:00
Stanislav Shwartsman
040be015d8 1. Added required GP(0) exception when setting conficting flags in CR0
2. APIC disabled compilation error fixed
2004-09-21 20:19:19 +00:00
Stanislav Shwartsman
760a195c9d * Fix LOCK prefix handling for x86-64
* Split BT*_EvGv functions to 3 different function according to exec mode
2004-09-17 20:47:19 +00:00
Stanislav Shwartsman
bbd55fe16f Merge and commit patch.apic-zwane from CVS patches directory.
the patch release notes by Zwane:

o Define symbols for constants like
o APIC arbitration
o Processor priority
o Various interrupt delivery fixes
o Focus processor checking
o ExtINT delivery

I need to release this now so that i don't fall too far behind CVS, when
it was part of the bochs-smp patch it could boot 2.4.18 4way. Apologies
for the whitespace changes.


Also remove patch.apic-ppr-zwane patch because it already included in
patch.apic-zwane.

I hope it will help to boot x86-64 or cmp systems required missed APIC
features !
2004-09-15 21:48:57 +00:00
Stanislav Shwartsman
283f9ae5d2 Simplify cpu.h
Speedup FYL2X and FYL2XP1 instructions
2004-09-14 20:19:54 +00:00
Stanislav Shwartsman
6cdb42d909 Little bit optimize memory access functions. Now values are calculated only if they actually needed. 2004-09-13 20:48:11 +00:00
Stanislav Shwartsman
fc631037ff remove obsolete comments from fetchdecode 2004-09-06 20:22:39 +00:00
Stanislav Shwartsman
016207b222 Commented problematic check in misc_mem.cc
Implemnted lazy-flags and undocumented flags handling for IMUL instructions
2004-08-30 21:47:24 +00:00
Stanislav Shwartsman
b370a417a4 Optimize lazy-flags for ADC and SBB instructions 2004-08-18 20:47:35 +00:00
Stanislav Shwartsman
1b7b791493 Speedup lazy-flags for INC and DEC instructions 2004-08-14 20:00:24 +00:00
Stanislav Shwartsman
1732e54baa Fixed undocumented flags handling for some instructions.
Bugfix for CF flag handling for SHL64 instruction
2004-08-14 19:34:02 +00:00
Stanislav Shwartsman
a1f830d429 Implemented FAST lazy flags version for logic instructions.
Small code cleanup/simplification for others.
2004-08-13 20:00:03 +00:00
Stanislav Shwartsman
5de51f67d9 Prepare lazy flags macroses for more efficient lazy flags handling 2004-08-11 21:26:23 +00:00
Stanislav Shwartsman
8f0cf91fff This commit is the first commit in long series of changes the have several purposes:
1. Review and commit patch

	[ 896733 ] Lazy flags, for more instructions, only 1 src op

   May be partially, but I hope to get all ideas from patch in

2. Get Bochs speedup after lazy flags optimization

3. Most important for me: improve correctness of emulation by handling several
   undocumented EFLAGS modifications. And finally pass

	UFLAGS - Undefined Flags Test v 3.0
	Copyright (C) Potemkin's Hackers Group (PHG) 1989,1995

   The test still fails on > 50% of its checks.
2004-08-09 21:28:47 +00:00
Stanislav Shwartsman
f9bd2b74be 1. Fixed bug in FSUB instruction
2. Fixed bug

[ 989478 ] I-Cache and undefined Instruktions

The L4 microkernel uses an undefined instruction to
trap for a special requests into the kernel (LOCK NOP).
The handler fixes this up and gives the user a special
code page with syscall stubs. If you're not using the
I-Cache optimization everthing works find on bochs. But
if you enable the I-Cache (--enable-icache), then the
undefined opcode exception is thrown only once for ever
virtual address it occurs. See the demodisk of the
L4KA::pistachio
(http://www.l4ka.org/projects/pistachio/download.php).
In this case the pingpong benchmark of this demo is of
interest. Everything runs fine until the program tries
to spawn a new task for its measurements. This new task
shares the code of the creating program. But the new
task stops executing at the undefined instruction
explained above and no exception is thrown.
2004-07-29 20:15:19 +00:00
Stanislav Shwartsman
50aaf8ec6f Implemented FFREEP 287+ compatability instruction 2004-07-15 19:45:33 +00:00
Stanislav Shwartsman
79b1cfdc1c removed unused code 2004-07-12 19:20:55 +00:00
Stanislav Shwartsman
5c5b556f24 Merge softfloat-fpu-implementation_ver4_branch branch 2004-06-18 14:11:11 +00:00
Stanislav Shwartsman
3274e0dd12 Commit patch
[ 950905 ] Do not PANIC on rare, bad input from user-mode
by h.johansson
with little changes and fixes
2004-05-10 21:05:51 +00:00
Stanislav Shwartsman
cf6d1b8bd9 port some changes from spftfloat-fpu branch to the MT 2004-04-09 15:34:59 +00:00
Stanislav Shwartsman
3f7c794b26 commit patch
899972 data xfer performance patch V 2.0.4   2004-02-18 15:38 nobody psychosmur
2004-02-26 19:17:40 +00:00
Christophe Bothamy
e17995f5db - host asms in a specific file
- add msvcc host asm instructions, patch by suzu
2004-02-15 17:57:45 +00:00
Christophe Bothamy
82429b5ac5 - fixes for booting OS/2 by Dmitri Froloff
- v8086 priveleged instruction processing bug (was also reported by
  LightCone Aug  7 2003)
  - exception process bug (was reported by Diego Henriquez Sat Nov 15
  01:16:51 CET 2003)
  - segment validation with IRET instruction
  - CS segment not present exception processing with IRET
2004-02-11 23:47:55 +00:00
Stanislav Shwartsman
9120961241 update checking for pending FPU exceptions code 2004-01-31 13:43:26 +00:00
Michael Brown
d1922bc835 Changed #ifdef MAGIC_BREAKPOINT to #if BX_MAGIC_BREAKPOINT and added a
configure script option --enable-magic-breakpoints (enabled by default).

Documented the instruction required to trigger the magic breakpoint
(xchgw %bx,%bx).
2004-01-29 17:49:03 +00:00
Daniel Gimpelevich
ae66bb33c0 Applied Russ Cox's CPU panic debug patch from Oct 2003. 2004-01-17 08:36:29 +00:00
Christophe Bothamy
e7e0b40bd1 - remove calculation on cr3 in dtranslate_linear, one of the most called functions (patch by Conn Clark) 2003-12-30 22:12:45 +00:00
Daniel Gimpelevich
fb80d47dbf *** empty log message *** 2003-12-29 21:24:35 +00:00
Stanislav Shwartsman
7deb9491da Fixed compilation error for FPU disabled case 2003-12-29 20:26:05 +00:00
Daniel Gimpelevich
68fd1dc95b cleanup optimizations & fix compile error 2003-12-29 07:28:28 +00:00
Stanislav Shwartsman
fd60a984a0 Instructions that should not check pending FPU exceptions 2003-12-28 18:58:15 +00:00
Stanislav Shwartsman
9ccb363ec3 bochs style decode/execute of FPU instructions.
With this coding style each instruction could be implemented separatelly even not together with current Bochs FPU emulator.
Step-by-step I am going to transfer all FPU instructions from current Bochs FPU emulator to new style and remove an old bugged emulator.
Anyway, now I could implement all currently missed FPU instructions without hacking wm-fpu-emu.
2003-12-27 13:50:06 +00:00
Stanislav Shwartsman
d51aece0c1 Change BX_PANIC messages to BX_INFO when behaviour is accepted with Intel/AMD docs.
Instructions MOV_CxRx and MOV_RxCx are not supported in v8086 mode according to Intel manuals.
Also these instructions are treated as register-to-register regardless to MODRM byte fields (according to AMD manuals)
Also commit fix for MOV_EwSw by Kevin
2003-11-13 21:17:31 +00:00
Stanislav Shwartsman
ac50ab3760 Implemented RCPSS/RCPPS SSE instructions 2003-11-07 20:53:27 +00:00
Stanislav Shwartsman
4e74efdf0c Fast fxsave/fxrstor 2003-10-24 20:44:43 +00:00
Stanislav Shwartsman
ac20b6405a - FXSAVE/FXRSTOR instructions should be available in P6 mode
- Added second UD2 opcode to fetchdecode
- Added RDPMC instruction to fetchdecode
- 'changes' updated
2003-10-24 18:34:16 +00:00
Stanislav Shwartsman
7f570b0150 Added PNI new streaming extensions instructions
PNI could be enabled by setting BX_SUPPORT_PNI in config.h
After the feature will be fully validation I'll also add configure option.

The implemntation is ~complete. I've missed only three FPU new opcodes of FUSTTP instruction and MONITOR/WAIT instructions.

Enjoy ! ;)
2003-08-29 21:20:52 +00:00
Stanislav Shwartsman
254ad17328 Changes method of resolving opcode/attributes from group table
New method more flexible and easy to understanding.
Reorganizing fetchdecode code and make it more easy and understandable
2003-08-28 19:25:23 +00:00
Stanislav Shwartsman
79f46df971 separate APIC from CPU 2003-08-17 18:55:16 +00:00
Alexander Krisak
8559551001 iretd cpu instruction in real mode implemented, i hope this closes bugs 537047,
603410, 637822, 664544, 687619.
2003-08-17 18:15:04 +00:00
Stanislav Shwartsman
1616539667 additional FPU changes 2003-08-01 09:32:33 +00:00
Volker Ruppert
2ef0c43c7d - description of ldtr fixed 2003-06-08 09:55:50 +00:00
Stanislav Shwartsman
1d45167e5b Merged NEW-INSTRUCTIONS branch 2003-05-15 16:41:17 +00:00
Kevin Lawton
a17d06abcb Optimized the main cpu loop iCache checks to remove a redundant
check.

Commented out a number of instances of invalidate_prefetch_q(),
for branches which do not change CS since the EIP window mechanism
takes care of validating that EIP lands in the current page or not
in the main cpu loop anyways.

Fixed a couple cases (v8086 mode and real mode) of loading CS where
the EIP page window was not invalidated in segment_ctrl_pro.cc.
That may fix some aliasing problems reported before (OS2).
2003-05-10 22:25:55 +00:00
Stanislav Shwartsman
d1d2fb34f0 Fixed number of compilation errors for FPU disabled case
Transfer fpu.cc from /fpu to /cpu
2003-04-22 20:21:34 +00:00
Stanislav Shwartsman
7db893970c Read attributes bits even for BxSplit11b opcodes
Move lock prefix check later in fetchdecode function when all attributes is ready.
2003-04-06 19:08:31 +00:00
Stanislav Shwartsman
a050c1ac7d Reserved cpu attribute bit for 3DNOW instructions decoding 2003-04-05 16:40:55 +00:00
Stanislav Shwartsman
1e71c9e56e Merged patch-unallowed-lock-cases patch.
According to the Intel manuals:

  The  LOCK  prefix  can be prepended only to the following instructions
  and  only  to  those  forms  of the instructions where the destination
  operand  is  a  memory operand: ADD, ADC, AND, BTC, BTR, BTS, CMPXCHG,
  CMPXCH8B,  DEC,  INC,  NEG, NOT, OR, SBB, SUB, XOR, XADD, and XCHG. If
  the  LOCK prefix is used with one of these instructions and the source
  operand  is a memory operand, an undefined opcode exception (#UD) will
  be  generated. An undefined opcode exception will also be generated if
  the  LOCK  prefix  is used with any instruction not in the above list.

 Checking of the LOCK prefix done in fetchDecode state and not overloads
 Bochs's execution.
2003-04-05 12:16:53 +00:00
Christophe Bothamy
1a518b81fe - add __attribute__((regparm(X))) performance trick with gcc on x86
on some cpu instructions (patch from Conn Clark)
- performance improvement is 1% on win95 boot
2003-03-17 00:41:01 +00:00
Christophe Bothamy
50efc3b8c7 - apply Conn Clark's patch.perf-regparm-cclark :
- it works only on x86 with gcc2.95+
  - uses the GCC function atribute "regparm(n)" to declare that certain
    functions use the register calling convention
  - performance improvement is about 6%
2003-03-02 23:59:12 +00:00
Peter Tattam
94880d1412 Fix guest2host and related optimizations to work on 64 bit host.
1) fixed the type of "hostPageAddr" and associated typecasts.
2) fixed the type of "pages" and associated typecasts (overloaded variable)
3) patch to cpu.cc to calculate "eipPageBias" correctly in 64 bit mode
2003-02-28 02:37:18 +00:00
Peter Tattam
70d752c8c2 external debugger only: fixed ask() to be virtual to let a panic trap into external debugger 2003-02-26 02:41:30 +00:00
Stanislav Shwartsman
7fa75388a1 Added bx_cpuid value to the BX_CPU class to avoid any problems with BX_CPU_ID implementation 2003-02-13 15:51:22 +00:00
Stanislav Shwartsman
cdfc3cbce4 instrumentation enchancements:
* renamed CPU_ID to BX_CPU_ID.
  with this new name there is no possibility for name contentions and BX_CPU_ID
  definition could be moved out to NEED_CPU_REG_SHORTCUTS block

* returned back `unsigned BX_CPU::which_cpu(void)` function

* added BX_CPU_ID parameter for
	BX_INSTR_PHY_READ(a20addr, len);
	BX_INSTR_PHY_WRITE(a20addr, len);
    now it will be
	BX_INSTR_PHY_READ(cpu_id, a20addr, len);
	BX_INSTR_PHY_WRITE(cpu_id, a20addr, len);
2003-02-13 15:04:11 +00:00
Bryce Denney
7336c891ee - CPU_ID fix from Shai Fultheim, who writes:
> CPU_ID is defined as
  > #define CPU_ID (BX_CPU_THIS_PTR local_apic.get_id())
  > This is not true when the APIC name is changed (true in Linux). Please
  > change this to:
  > #define CPU_ID (BX_CPU_THIS - BX_CPU(0))
2003-02-09 13:30:39 +00:00
Christophe Bothamy
939b558fdf - apply patch.sysenterexit-mrieker:
- adds sysenter/sysexit support for cpu-level>=6
  - enabled by ./configure --enable-sep
2003-01-20 20:10:31 +00:00
Stanislav Shwartsman
29ab05b4da Removed duplicate SSE opcodes 2002-12-22 20:48:45 +00:00
Stanislav Shwartsman
1cd38bb7dd Recommitted SSE code reorganization.
Fix in FXSAVE/FXRESTOR opcodes -> If the OSFXSR bitCR4 is not set, the FXRSTOR instruction does not restore the states of the XMM and MXCSR registers.
2002-12-22 20:13:00 +00:00
Stanislav Shwartsman
4906ffef7c Clean Peter's commit with MOVNTDQ instruction implementation 2002-12-20 09:11:39 +00:00
Bryce Denney
9b2914fd1d - Temporarily revert Stanislav's changes between 2002-12-18 and 2002-12-19.
Because source files were added/removed it would require an update
  of the windows and macos project files, so I want to wait until after 2.0.
    M Makefile.in         1.51 back to 1.50
    M cpu.h               1.121 back to 1.120
    M fetchdecode.cc      1.37 back to 1.36
    M fetchdecode64.cc    1.33 back to 1.32
    M sse.cc              1.17 back to 1.16
    A sse2.cc             1.27 back to 1.26  (added back)
    R sse_move.cc         removed
    R sse_pfp.cc          removed
- to bring these changes back again, all we have to do is
  "cvs update -j tmp-before1 -j tmp-after1"
2002-12-19 05:53:18 +00:00
Stanislav Shwartsman
aa361badf2 Reorganized SSE/SSE2 code
sse.cc -> general SSE stuff and SSE integer (MMX extensions)
sse_move.cc -> memory transfer and shuffle opcodes
sse_pfp.cc -> packed floating point operations
2002-12-18 22:33:44 +00:00
Christophe Bothamy
16ebfdb9e1 - update for macos compile 2002-12-12 15:29:45 +00:00
Stanislav Shwartsman
bcd57bdcaf *** Current duplicate SSE/SSE2 instructions list ***
MOVUPS_VpsWps  (0f 10) = MOVUPD_VpdWpd  (66 0f 10) = MOVDQU_VdqWdq (f3 0f 6f)
MOVUPS_WpsVps  (0f 11) = MOVUPD_WpdVpd  (66 0f 11) = MOVDQU_WdqVdq (f3 0f 7f)
MOVAPS_VpsWps  (0f 28) = MOVAPD_VpdWpd  (66 0f 28) = MOVDQA_VdqWdq (66 0f 6f)
MOVAPS_WpsVps  (0f 29) = MOVAPD_WpdVpd  (66 0f 29) = MOVDQA_WdqVdq (66 0f 7f)

MOVNTPS_MdqVps (0f 2b) = MOVNTPD_MdqVpd (66 0f 2b)
MOVLPS_VpsMq   (0f 12) = MOVLPD_VsdMq   (66 0f 12)
MOVLPS_MqVps   (0f 13) = MOVLPD_MqVsd   (66 0f 13)
MOVHPS_VpsMq   (0f 16) = MOVHPD_VpdMq   (66 0f 16)
MOVHPS_MqVps   (0f 17) = MOVHPD_MqVpd   (66 0f 17)

ANDPS_VpsWps   (0f 54) = ANDPD_VpdWpd   (66 0f 54) = PAND_VpdWpd   (66 0f db)
ANDNPS_VpsWps  (0f 55) = ANDNPD_VpdWpd  (66 0f 55) = PANDN_VpdWpd  (66 0f df)
ORPS_VpsWps    (0f 56) = ORPD_VpdWpd    (66 0f 56) = POR_VpdWpd    (66 0f eb)
XORPS_VpsWps   (0f 57) = XORPD_VpdWpd   (66 0f 57) = PXOR_VpdWpd   (66 0f ef)

Removed dupes
2002-11-25 21:58:55 +00:00
Bryce Denney
dcedff8d46 - fix some minor compile bugs that appear when you mix up instrumentation,
debugger, SMP, and x86-64.  A few macros were missing the CPU_ID argument,
  and a few passed nonexistent variables to the instrumentation macros.
- I changed CPU_ID into a plain old macro instead of an inline call to a
  trivial which_cpu() function, and removed which_cpu().

Modified Files:
  cpu/cpu.h cpu/ctrl_xfer64.cc debug/dbg_main.cc
2002-11-21 18:22:03 +00:00
Bryce Denney
add9107dae - add BOCHSAPI to bxICache_c 2002-11-15 18:12:04 +00:00
Stanislav Shwartsman
ccbc8e0ef7 MOVAPS/MOVAPD have a different exceptions 2002-11-15 12:44:39 +00:00
Stanislav Shwartsman
7ccf1de78f According to the Intel (and AMD) manuals a lot different SSE/SSE2 opcodes has EXACTLY the same operation.
Deleted first three redundant opcodes (move integer data):
   MOVLPS_VpsMq   (0f 12) = MOVLPD_VsdMq   (66 0f 12)
   MOVLPS_MqVps   (0f 13) = MOVLPD_MqVsd   (66 0f 13)
   MOVHPS_VpsMq   (0f 16) = MOVHPD_VpdMq   (66 0f 16)
   MOVHPS_MqVps   (0f 17) = MOVHPD_MqVpd   (66 0f 17)

Until under examination:
XORPS,XORPD
ORPS,ORPD
ANDPS,ANDPD
ANDNPS,ANDNPD
MOVUPS,MOVUPD
2002-11-13 22:24:03 +00:00
Stanislav Shwartsman
968b2744f4 According to the Intel (and AMD) manuals a lot different SSE/SSE2 opcodes
has EXACTLY the same operation.

Deleted first three redundant opcodes:
   MOVAPS_VpsWps  (0f 28) = MOVAPD_VpdWpd  (66 0f 28)
   MOVAPS_WpsVps  (0f 29) = MOVAPD_WpdVpd  (66 0f 29)
   MOVNTPS_MdqVps (0f 2b) = MOVNTPD_MdqVpd (66 0f 2b)

Until checking:
XORPS,XORPD
ORPS,ORPD
ANDPS,ANDPD
ANDNPS,ANDNPD
MOVUPS,MOVUPD
MOVLPS,MOVLPD
MOVHPS,MOVHPD
2002-11-13 21:35:17 +00:00