Commit graph

103 commits

Author SHA1 Message Date
Aleksandar Andrejevic
6e741d3856 [FAST486]
Implement the LAR instruction.


svn path=/branches/ntvdm/; revision=61650
2014-01-17 03:15:27 +00:00
Aleksandar Andrejevic
d07be4e31b [FAST486]: Fix a comment.
svn path=/branches/ntvdm/; revision=61310
2013-12-21 03:50:19 +00:00
Aleksandar Andrejevic
3dd500ab28 [FAST486]
Implement the LSL instruction.
Remove instructions that don't exist on a 486 from the TODO list.


svn path=/branches/ntvdm/; revision=61309
2013-12-21 03:48:46 +00:00
Aleksandar Andrejevic
f8861a562a [FAST486]
Remove the waiting code for the HLT instruction until I figure out how to do it properly.


svn path=/branches/ntvdm/; revision=61276
2013-12-15 05:08:57 +00:00
Aleksandar Andrejevic
ec32b3ef34 [FAST486]
Fix the calculation of PageLength for the last page.


svn path=/branches/ntvdm/; revision=61275
2013-12-15 05:02:59 +00:00
Aleksandar Andrejevic
4c80791d47 [FAST486]
Fix linear memory access when paging is enabled.


svn path=/branches/ntvdm/; revision=61274
2013-12-15 04:15:03 +00:00
Aleksandar Andrejevic
efcf73c467 [FAST486]
The LDT can be loaded with a NULL descriptor. That invalidates the LDT but doesn't cause
any exception.


svn path=/branches/ntvdm/; revision=61269
2013-12-14 02:30:42 +00:00
Aleksandar Andrejevic
18b844dffa [FAST486]
Fix the emulation of the Local Descriptor Table.


svn path=/branches/ntvdm/; revision=61268
2013-12-14 02:13:01 +00:00
Aleksandar Andrejevic
5303c91efa [FAST486]
Implement the extended opcode group 0x0F, 0x00 (SLDT, STR, LLDT, LTR, VERR, VERW).


svn path=/branches/ntvdm/; revision=61264
2013-12-13 03:32:41 +00:00
Hermès Bélusca-Maïto
a2bd742ecd [FAST486]
- Call Fast486GetCurrentPrivLevel only when needed.
- Fix a type.

svn path=/branches/ntvdm/; revision=61211
2013-12-03 23:51:51 +00:00
Aleksandar Andrejevic
978c08c15c [FAST486]
Implement the BOUND instruction.


svn path=/branches/ntvdm/; revision=61205
2013-12-03 01:30:15 +00:00
Aleksandar Andrejevic
2064d10bad [FAST486]
Check for division by zero, and generate the appropriate exception.


svn path=/branches/ntvdm/; revision=61204
2013-12-03 00:56:47 +00:00
Aleksandar Andrejevic
e7a6deb93f [FAST486]
The current "fast" method used in MOVS gives incorrect results. It has been temporarily
replaced with a slow method that works correctly.
The string functions do nothing when CX is 0 on entry, fix CMPS and SCAS.


svn path=/branches/ntvdm/; revision=61203
2013-12-03 00:12:55 +00:00
Aleksandar Andrejevic
03ecfdff3f [FAST486]
Fix MOVS and STOS when DF = 1. The starting position in the block was off by 1.


svn path=/branches/ntvdm/; revision=61163
2013-12-01 03:16:49 +00:00
Aleksandar Andrejevic
ba237b0251 [FAST486]
Revert r61158, and fix the prefix issue correctly, but resetting the flags
again after the call to Fast486InterruptInternal.


svn path=/branches/ntvdm/; revision=61160
2013-11-30 23:45:59 +00:00
Aleksandar Andrejevic
7393337fcf [FAST486]
Use the size of CS, and not SS, in Fast486OpcodePopReg.


svn path=/branches/ntvdm/; revision=61159
2013-11-30 23:14:54 +00:00
Aleksandar Andrejevic
2cbcfd75c5 [FAST486]
Move the prefix reset below the interrupt check, because Fast486InterruptInternal
might set OPSIZE in some circumstances.


svn path=/branches/ntvdm/; revision=61158
2013-11-30 22:17:18 +00:00
Aleksandar Andrejevic
9c6b9c9bab [FAST486]
FPU instructions never generate #UD. If CR0.EM is set, they generate #NM.
If there is no FPU and CR0.EM is cleared, they do nothing.
Add a helper macro FPU_ST for accessing FPU registers.
Add a compile-time option to disable the FPU.


svn path=/branches/ntvdm/; revision=61150
2013-11-30 02:03:51 +00:00
Aleksandar Andrejevic
81c27b5b19 [FAST486]
Start implementing the FPU. Stubplement the FPU opcode handlers.


svn path=/branches/ntvdm/; revision=61141
2013-11-29 03:00:59 +00:00
Aleksandar Andrejevic
d358641f7c [FAST486]
Fix the order of operations.


svn path=/branches/ntvdm/; revision=61106
2013-11-26 18:11:53 +00:00
Aleksandar Andrejevic
556bace69f [FAST486]
Complete the previous commit with a fix for Fast486WriteLinearMemory too.


svn path=/branches/ntvdm/; revision=61105
2013-11-26 17:56:18 +00:00
Aleksandar Andrejevic
f45361126f [FAST486]
Handle the case when the last page is also the first page in Fast486ReadLinearMemory ( when paging is enabled).


svn path=/branches/ntvdm/; revision=61104
2013-11-26 17:55:07 +00:00
Aleksandar Andrejevic
8e356f7a95 [FAST486]
The 486 doesn't have AC, VIF, VIP or ID.
Fix and simplify POPF.
[NTVDM]
Fix the count in the XMS copy function (INT 15h, AH = 87h).


svn path=/branches/ntvdm/; revision=61082
2013-11-23 01:34:03 +00:00
Aleksandar Andrejevic
9a8c7e2a04 [FAST486]
Fix CF calculation in SHRD/SHLD.


svn path=/branches/ntvdm/; revision=61070
2013-11-22 02:47:48 +00:00
Aleksandar Andrejevic
24954c9d07 [FAST486]
DAA, DAS: Update the flags.
AAA, AAS: Subtract from AX instead of AL. The specification says AL, but
so far in all known CPUs and emulators, AX is subtracted.
AAD: Clear AH.


svn path=/branches/ntvdm/; revision=61069
2013-11-22 02:02:05 +00:00
Aleksandar Andrejevic
363543b325 [FAST486]
Fix the calculation of AF in ADC and the calculation of AF and CF in SBB.


svn path=/branches/ntvdm/; revision=61068
2013-11-22 01:22:00 +00:00
Aleksandar Andrejevic
c0d571c92a [FAST486]
In the string functions, use ADSIZE and not OPSIZE.
In SCAS and CMPS, fix the "(1 << 32) - 1" bug.


svn path=/branches/ntvdm/; revision=61067
2013-11-22 00:46:28 +00:00
Aleksandar Andrejevic
9c999826e1 [FAST486]
Put the conditional expression in parenthesis so that the addition happens after it.


svn path=/branches/ntvdm/; revision=61063
2013-11-21 04:07:15 +00:00
Aleksandar Andrejevic
37b16fec31 [FAST486]
Fix a bug in Fast486LoadSegment.


svn path=/branches/ntvdm/; revision=61062
2013-11-21 03:18:34 +00:00
Aleksandar Andrejevic
f90a1db2b7 [FAST486]
The top half of EIP is cleared after a 16-bit jump.


svn path=/branches/ntvdm/; revision=61058
2013-11-20 14:21:47 +00:00
Aleksandar Andrejevic
459e3a6f48 [FAST486]
Read the LDT instead of the GDT when the table indicator is set.


svn path=/branches/ntvdm/; revision=61057
2013-11-20 10:48:26 +00:00
Aleksandar Andrejevic
e2fb91925e [FAST486]
Implement privilege checks when loading the code selector.


svn path=/branches/ntvdm/; revision=61056
2013-11-20 10:43:12 +00:00
Aleksandar Andrejevic
b456a8b355 [FAST486]
Make the parameters to Fast486ReadModrm*Operands optional, so that
unnecessary extra reads aren't performed. This also eliminates the
need for dummy variables.


svn path=/branches/ntvdm/; revision=61055
2013-11-20 08:01:10 +00:00
Hermès Bélusca-Maïto
8998a96d56 [NTVDM] : Implement getMSW and setMSW for getting and setting the Machine Status Word (lower word of CR0).
[FAST486]: MSW = Machine Status Word

svn path=/branches/ntvdm/; revision=61044
2013-11-18 20:25:10 +00:00
Aleksandar Andrejevic
4b005f11bf [FAST486]
- When accessing memory using ESP, make the SS segment default.
- The INT instructions always pushes 16-bit values in real mode, regardless
  of the operand/address size attributes.


svn path=/branches/ntvdm/; revision=61000
2013-11-15 20:49:48 +00:00
Aleksandar Andrejevic
f5d0d3e784 [FAST486]
The CS cached descriptor has the default operand size, even for stack
operations.


svn path=/branches/ntvdm/; revision=60996
2013-11-15 04:16:25 +00:00
Aleksandar Andrejevic
bbc9efd2d9 [FAST486]
- Fix the privilege checks.
- Store the CPL in a special field, so that it doesn't get mixed up
  with the lowest 2 bits of real mode selectors while switching
  into protected mode.
- Reset the exception count after a successful ISR call.
- In Fast486OpcodeGroup0F01, check for prefix overrides after parsing
  the Mod-Reg-R/M, which might add a SS: prefix override in some cases.


svn path=/branches/ntvdm/; revision=60995
2013-11-15 02:32:08 +00:00
Aleksandar Andrejevic
5e54387a9c [FAST486]
Fix the previous fix. ESI was already updated earlier in the function.


svn path=/branches/ntvdm/; revision=60990
2013-11-14 03:11:33 +00:00
Aleksandar Andrejevic
14a31007fc [FAST486]
Fix previous fix.


svn path=/branches/ntvdm/; revision=60989
2013-11-14 03:03:23 +00:00
Aleksandar Andrejevic
9c66549845 [FAST486]
Update the register values in REP LODS.


svn path=/branches/ntvdm/; revision=60988
2013-11-14 02:54:20 +00:00
Aleksandar Andrejevic
cdf876ead9 [FAST486]
Fix the BSF and BSR instructions. Partially fix SHLD and SHRD.


svn path=/branches/ntvdm/; revision=60987
2013-11-14 02:39:54 +00:00
Aleksandar Andrejevic
a3513c8f18 [FAST486]
Fix previous fix.


svn path=/branches/ntvdm/; revision=60985
2013-11-13 22:34:38 +00:00
Aleksandar Andrejevic
cd496c8e21 [FAST486]
XADD: Fix the order of operations.
POP <modrm>: The value must be popped from the stack before parsing the
Mod-Reg-R/M, because of the "POP DWORD [ESP]" case.


svn path=/branches/ntvdm/; revision=60984
2013-11-13 22:33:37 +00:00
Aleksandar Andrejevic
53dfb7da48 [FAST486]
LOOP and JECXZ use the ADSIZE attribute, not OPSIZE.


svn path=/branches/ntvdm/; revision=60977
2013-11-13 19:20:04 +00:00
Aleksandar Andrejevic
ace025dca9 [FAST486]
The bit number should be normalized to [0, DataSize- 1], not [0, 2 ^ DataSize - 1].


svn path=/branches/ntvdm/; revision=60975
2013-11-13 18:14:01 +00:00
Aleksandar Andrejevic
acccaf3a90 [FAST486]
Fix a bug in the ROL and ROR instructions.


svn path=/branches/ntvdm/; revision=60972
2013-11-13 13:32:00 +00:00
Aleksandar Andrejevic
c7de214d81 [FAST486]
Fix several bugs in Fast486RotateOperation.


svn path=/branches/ntvdm/; revision=60969
2013-11-13 02:38:36 +00:00
Aleksandar Andrejevic
677810ea95 [FAST486]
Don't return uninitialized variables.


svn path=/branches/ntvdm/; revision=60967
2013-11-12 21:55:05 +00:00
Aleksandar Andrejevic
2da0e38fbc [FAST486]
In rotate operations, the count is always masked with 0x1F, regardless
of the operand size.


svn path=/branches/ntvdm/; revision=60966
2013-11-12 19:25:50 +00:00
Aleksandar Andrejevic
ac9f8a81e3 [FAST486]
Don't forget to check for the operand/address size prefix.


svn path=/branches/ntvdm/; revision=60964
2013-11-12 18:40:13 +00:00