Commit graph

94 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto 045f939e5c [FAST486]: Remove an extra "return TRUE;"
svn path=/branches/ntvdm/; revision=60931
2013-11-11 01:02:48 +00:00
Aleksandar Andrejevic 83b597be5a [FAST486]
Implement SHLD and SHRD.


svn path=/branches/ntvdm/; revision=60930
2013-11-11 00:57:59 +00:00
Aleksandar Andrejevic 43bbc0afb4 [FAST486]
Implement the two operand version of IMUL.


svn path=/branches/ntvdm/; revision=60929
2013-11-11 00:10:46 +00:00
Aleksandar Andrejevic 9677ec13ad [FAST486]
Don't mix up ADSIZE and OPSIZE (continued).


svn path=/branches/ntvdm/; revision=60927
2013-11-10 23:42:57 +00:00
Aleksandar Andrejevic a2f3c339f4 [FAST486]
Don't mix up ADSIZE and OPSIZE.


svn path=/branches/ntvdm/; revision=60926
2013-11-10 23:34:34 +00:00
Aleksandar Andrejevic 7ec93e81ff [FAST486]
Increment SP, not ESP for 16-bit stacks.


svn path=/branches/ntvdm/; revision=60925
2013-11-10 22:49:19 +00:00
Aleksandar Andrejevic c3c7bb89c1 [FAST486]
Modularize linear memory access by adding two new functions:
Fast486ReadLinearMemory and Fast486WriteLinearMemory.
Implement Fast486GetPageTableEntry.


svn path=/branches/ntvdm/; revision=60923
2013-11-10 22:27:24 +00:00
Aleksandar Andrejevic fda5745543 [FAST486]
The number of bit places in a shift operation is ANDed by the width of the type
when it is in a register, so (1 << c), when c is 32, is actually 1, and not 0.
Fix the calculation of MaxValue by using SignFlag | (SignFlag - 1) instead.


svn path=/branches/ntvdm/; revision=60912
2013-11-10 03:11:56 +00:00
Aleksandar Andrejevic cc89902e00 [NTVDM]
Don't enable interrupts unless it's necessary in the interrupt handler.
[FAST486]
When handling interrupt signals, make sure at least one instruction is executed,
to prevent the CPU from being completely blocked by interrupt signals.


svn path=/branches/ntvdm/; revision=60910
2013-11-10 00:53:05 +00:00
Hermès Bélusca-Maïto ecd0b33743 [FAST486][NTVDM]: Rename the last two IO functions parameters in the same way as some CSR functions (ElementCount == DataCount; ElementSize == DataSize).
svn path=/branches/ntvdm/; revision=60896
2013-11-09 15:00:19 +00:00
Hermès Bélusca-Maïto a106a3b21e [FAST486]: Code formatting only (remove endlines spaces).
svn path=/branches/ntvdm/; revision=60894
2013-11-09 14:23:40 +00:00
Hermès Bélusca-Maïto aab2a03dc2 [FAST486]: Fix OUT instruction (IoWrite instead of IoRead).
svn path=/branches/ntvdm/; revision=60893
2013-11-09 14:15:39 +00:00
Aleksandar Andrejevic 43ee57f2f7 [FAST486][NTVDM]
The behavior of the I/O port bus depends on the data width. In the case
of 16-bit/32-bit access, two/four adjacent ports will be accessed.


svn path=/branches/ntvdm/; revision=60891
2013-11-09 03:30:27 +00:00
Aleksandar Andrejevic 4f4d9fe5d2 [FAST486]
Implement LFS, LGS and MOVZX.


svn path=/branches/ntvdm/; revision=60878
2013-11-07 01:06:39 +00:00
Aleksandar Andrejevic 01c10ef5aa [FAST486]
Implement BSF, BSR and MOVSX.


svn path=/branches/ntvdm/; revision=60877
2013-11-07 00:57:08 +00:00
Hermès Bélusca-Maïto 92ce0174ac [FAST486]: Code formatting only.
svn path=/branches/ntvdm/; revision=60857
2013-11-03 23:13:53 +00:00
Hermès Bélusca-Maïto 3b6b1a7f37 [FAST486]: Replace (boolean_condition) ? TRUE : FALSE; by: (boolean_condition) .
svn path=/branches/ntvdm/; revision=60856
2013-11-03 22:44:55 +00:00
Aleksandar Andrejevic 6ecc2dfd24 [FAST486]
BP is certainly not the same register as BX.


svn path=/branches/ntvdm/; revision=60851
2013-11-03 18:31:00 +00:00
Aleksandar Andrejevic 6e6e0bac08 [FAST486]
The RCL, RCR, ROL and ROR instructions do not update SF, ZF or PF.


svn path=/branches/ntvdm/; revision=60841
2013-11-03 01:05:40 +00:00
Aleksandar Andrejevic d80b788ff4 [FAST486]
Fix segment initialization. The cached descriptors must have valid values
during the switch to protected mode.
For some odd reason, GCC makes the FAST486_GDT_ENTRY structure 12 bytes
instead of 8 if there is a bit field with more than 16 bits, so split
the Base field into Base and BaseMid.
Add size checks below important structure declarations.


svn path=/branches/ntvdm/; revision=60825
2013-11-02 00:47:43 +00:00
Aleksandar Andrejevic dcbdbb7d9f [FAST486]
Implement opcode group 0x0F, 0x01 (SGDT, SIDT, LGDT, LIDT, SMSW and LMSW).
Only INVLPG is not implemented yet.


svn path=/branches/ntvdm/; revision=60824
2013-11-01 22:39:43 +00:00
Aleksandar Andrejevic 20c0db9f08 [FAST486]
Implement the XADD instruction.


svn path=/branches/ntvdm/; revision=60819
2013-11-01 02:48:28 +00:00
Hermès Bélusca-Maïto 5c220ef022 [FAST486]
Fix the type of a variable.

[NTVDM]
Introduce a BOP handler table for the 256 possible BOP functions and use it.

svn path=/branches/ntvdm/; revision=60818
2013-11-01 02:28:47 +00:00
Aleksandar Andrejevic 13b771ac15 [FAST486]
Fix a bug in the IRET instruction.


svn path=/branches/ntvdm/; revision=60817
2013-11-01 02:08:34 +00:00
Hermès Bélusca-Maïto f62b9a81d4 Fix a comment...
svn path=/branches/ntvdm/; revision=60815
2013-11-01 01:51:15 +00:00
Hermès Bélusca-Maïto 861776bd7e [FAST486][NTVDM]
- Introduce a Fast486Initialize which is used to set up the CPU callbacks (and use default ones if some of the given callbacks are NULL), and to reset it the first time. Now Fast486Reset is meant to be used for only resetting the CPU to a safe state.
- Hence we are now sure that State->WhateverCallback is never NULL (and is theoretically valid), so don't do NULL-checks when calling them, but call them directly. The default cases for those checks become the default calls for the default callbacks.
- Remove the now-unneeded EmulatorIdle function.

svn path=/branches/ntvdm/; revision=60814
2013-11-01 01:46:58 +00:00
Aleksandar Andrejevic 1c12c6fe0d [FAST486]
In real mode, the value in the IVT is a far pointer, not an IDT entry.
Fix the case when MemReadCallback is NULL.


svn path=/branches/ntvdm/; revision=60813
2013-11-01 00:30:26 +00:00
Hermès Bélusca-Maïto 39a527a21e [FAST486][NTVDM]
BOP numbers are 1 byte and map to a function (over 255). But one can pass additional "parameters" to those functions by adding extra bytes, however such functions must advance "by hand" the instruction pointer.

[NTVDM]
- Take into account our previous remark for the BIOS interrupt stubs, and comment them.
- Rework EmulatorBiosOperation (move almost all of its existing code into subfunctions in bop.c) so that one can call many other BOP functions in the future (WIP). The BOP number (still called) EMULATOR_INT_BOP (of value 0xFF) is used for internal 16 --> 32 bit switching for our 32bit bios.
- It appears that the IoRead/WriteCallback and IdleCallback must not be NULL for using fast486. I'm committing a temporary fix that I will definitely fix in a subsequent commit.

svn path=/branches/ntvdm/; revision=60812
2013-11-01 00:01:07 +00:00
Hermès Bélusca-Maïto 2c8e8ba5d3 [FAST486]
- Remove an unneeded inclusion to the CRT header: limits.h (and use instead NDK definitions for max/min long values).
- Remove unneeded comments...
[NTVDM]
Remove an unneeded add_dependencies(...) command.

svn path=/branches/ntvdm/; revision=60767
2013-10-27 11:42:44 +00:00
Aleksandar Andrejevic f5d3c9254c [FAST486]
Separate external interrupts from interrupt signals (which are
interrupts whose number is not known until they can be serviced,
just like hardware interrupts on a real CPU).
[NTVDM]
Improve the PIC emulation code (IRQ priorities, etc...).
Instead of checking for interrupts in the main loop, move the
PS/2 input parsing to a different thread.
Improve BIOS keyboard IRQ handling.


svn path=/branches/ntvdm/; revision=60761
2013-10-27 00:37:01 +00:00
Aleksandar Andrejevic dfd1c031d6 [FAST486]
Implement the CLTS instruction.


svn path=/branches/ntvdm/; revision=60752
2013-10-26 17:33:10 +00:00
Aleksandar Andrejevic 1525a235a2 [FAST486]
Implement the MOV instruction for control and debug registers.
Remove definitions for non-existant registers CR1, CR4, CR5, CR6 and CR7.
The standard 80486 doesn't have a CR4 register (although some implementations
of the 80486 had large page support and CR4, it was not reliable).
As for the debug registers, DR4 is the same as DR6, and DR5 is the same as DR7.


svn path=/branches/ntvdm/; revision=60747
2013-10-26 00:56:11 +00:00
Aleksandar Andrejevic 87f5903d48 [FAST486]
Implement extended opcode groups 0xB9 (UD2) and 0xBA (BT/BTS/BTR/BTC).


svn path=/branches/ntvdm/; revision=60745
2013-10-25 18:15:24 +00:00
Aleksandar Andrejevic 67b093f38c [FAST486]
Create a macro SWAP (swaps two variables) to shorten the code.
Implement the BSWAP instruction.


svn path=/branches/ntvdm/; revision=60717
2013-10-20 00:55:31 +00:00
Aleksandar Andrejevic a93095e678 [FAST486]
Implement BT, BTS, BTR and BTC.


svn path=/branches/ntvdm/; revision=60716
2013-10-20 00:25:41 +00:00
Aleksandar Andrejevic 1a968e6f61 [FAST486]
Fix more prefix handling.
Create the macros TOGGLE_ADSIZE and TOGGLE_OPSIZE to shorten the code.


svn path=/branches/ntvdm/; revision=60715
2013-10-19 23:43:53 +00:00
Aleksandar Andrejevic 97c51f53c4 [FAST486]
Fix prefix handling.
Create a macro NO_LOCK_PREFIX to shorten the code.


svn path=/branches/ntvdm/; revision=60714
2013-10-19 23:03:40 +00:00
Aleksandar Andrejevic 75a0ca07a1 [FAST486]
Implement CMPXCHG.


svn path=/branches/ntvdm/; revision=60712
2013-10-19 18:56:58 +00:00
Aleksandar Andrejevic a98544e517 [FAST486]
Implement PUSH/POP FS/GS.


svn path=/branches/ntvdm/; revision=60711
2013-10-19 18:36:04 +00:00
Aleksandar Andrejevic ca7d21eff4 [FAST486]
The 80486 doesn't have any time stamp counter (TSC) at all.


svn path=/branches/ntvdm/; revision=60710
2013-10-19 18:28:27 +00:00
Aleksandar Andrejevic d3bc33ee5d [FAST486]
And add those newly implemented opcodes into the table...


svn path=/branches/ntvdm/; revision=60708
2013-10-19 18:00:19 +00:00
Aleksandar Andrejevic 7105c52d86 [FAST486]
Implement SETO, SETNO, SETC, SETNC, SETZ, SETNZ, SETBE, SETNBE, SETS, SETNS, SETP
SETNP, SETL, SETNL, SETLE and SETNLE.


svn path=/branches/ntvdm/; revision=60706
2013-10-19 17:57:26 +00:00
Aleksandar Andrejevic 2583e4f51e [FAST486]
Remove TODOs for instructions that don't exist on the 80486.


svn path=/branches/ntvdm/; revision=60704
2013-10-19 17:29:44 +00:00
Hermès Bélusca-Maïto 51040fc61e Bye bye Soft386, welcome Fast486, courtesy Aleksandar Andrejevic.
[NTVDM]: Define by default NEW_EMULATOR, i.e. use Fast486 instead of softx86.

svn path=/branches/ntvdm/; revision=60703
2013-10-19 16:55:51 +00:00