Commit graph

54 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto 8331d27b2b [NTVDM]: Implement and export VDDTerminateVDM.
svn path=/branches/ntvdm/; revision=61374
2013-12-24 15:52:31 +00:00
Hermès Bélusca-Maïto 91a882c036 [DDK] - Code formatting only.
svn path=/branches/ntvdm/; revision=61373
2013-12-24 15:50:31 +00:00
Hermès Bélusca-Maïto 4f99547f7d [NTVDM]
Implement and export (and define in vddsvc.h) call_ica_hw_interrupt and VDDSimulateInterrupt macro.
ICA = Interrupt Controller Adapter (in windows terminology)

svn path=/branches/ntvdm/; revision=61372
2013-12-24 15:30:59 +00:00
Hermès Bélusca-Maïto 137d02967b [DDK]: Define registry manipulation APIs.
svn path=/branches/ntvdm/; revision=61360
2013-12-23 18:34:30 +00:00
Hermès Bélusca-Maïto 3cad6a80cf [DDK]
Introduce DDK headers needed for Virtual Device Drivers development. nt_vdd.h and vddsvc.h will get populated with functions as soon as they will be implemented in NTVDM.
isvbop.h/.inc is fully implemented. isvbop.inc defines 3rd-party VDD bops and "function"-calls for 16-bit apps (in assembler), and isvbop.h defines the same in C-language.
They are both MSVC and GCC-compatible.

svn path=/branches/ntvdm/; revision=61352
2013-12-23 17:40:50 +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
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 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 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 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
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
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 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
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
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 62da9a9deb [FAST486]
Physical memory read/write callbacks don't need to return a value.


svn path=/branches/ntvdm/; revision=60765
2013-10-27 01:38:24 +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
Hermès Bélusca-Maïto fcbe98e6b6 [SOFTX86]
Remove the now-unneeded headers. Bye-bye SoftX86 !

svn path=/branches/ntvdm/; revision=60758
2013-10-26 21:26:28 +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 5eb7c07bb8 Sync with trunk for console graphics palettes.
svn path=/branches/ntvdm/; revision=60735
2013-10-23 00:26:50 +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
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
Aleksandar Andrejevic 0e8be812b0 [SOFT386]
Implement the hardware interrupt system.
Modify Soft386Interrupt to assume hardware interrupts, because
software interrupts from outside the emulator may cause race conditions.


svn path=/branches/ntvdm/; revision=60696
2013-10-18 22:50:00 +00:00
Amine Khaldi 25445ea35f * Sync up to trunk head (r60691).
svn path=/branches/ntvdm/; revision=60692
2013-10-17 11:19:05 +00:00
Aleksandar Andrejevic 4b14d9a672 [SOFT386]
Start implementing call gate support.
Implement the direct far call opcode (0x9A).


svn path=/branches/ntvdm/; revision=60685
2013-10-16 00:41:24 +00:00
Aleksandar Andrejevic c425bbc689 [SOFT386]
Implement Soft386Interrupt.
[NTVDM]
Implement EmulatorInterrupt and EmulatorExternalInterrupt for NEW_EMULATOR.


svn path=/branches/ntvdm/; revision=60628
2013-10-12 13:58:34 +00:00
Aleksandar Andrejevic 800969b126 [SOFT386]
Fix a bug in Soft386ExceptionWithErrorCode. The instruction pointer exceptions can
return to should point to the instruction that caused the exception.


svn path=/branches/ntvdm/; revision=60603
2013-10-11 12:24:05 +00:00
Aleksandar Andrejevic aef0bf1635 [SOFT386]
Implement an API for external segment modification.
[NTVDM]
Implement EmulatorSetRegister for NEW_EMULATOR.


svn path=/branches/ntvdm/; revision=60591
2013-10-09 21:48:52 +00:00
Aleksandar Andrejevic 5ef6274619 [SOFT386]
Fix the header in soft386.h.


svn path=/branches/ntvdm/; revision=60486
2013-09-30 22:13:51 +00:00
Aleksandar Andrejevic 7e119cf40b [SOFT386]
Implement the LES and LDS instructions.
Add optional support for BOPs (NTVDM-specific).
Fix prefix handling in some functions.
[NTVDM]
Enable BOPs for Soft386 (when NEW_EMULATOR is defined).
Fix the calling convention issue (softx86 uses cdecl, soft386 uses stdcall).


svn path=/branches/ntvdm/; revision=60395
2013-09-28 00:29:16 +00:00
Aleksandar Andrejevic b5a9d7490a [SOFT386]
Implement the POPF instruction.


svn path=/branches/ntvdm/; revision=60341
2013-09-23 14:10:14 +00:00
Aleksandar Andrejevic 7328873681 [SOFT386]
Implement external stack modification.
[NTVDM]
Implement EmulatorSetStack for NEW_EMULATOR.


svn path=/branches/ntvdm/; revision=60257
2013-09-21 00:41:41 +00:00
Hermès Bélusca-Maïto 85f05060e4 [SOFT386]
- Put inlined functions in a .inl file, which gets included by the corresponding header file (i.e. fix MSVC builds).
- Use enums types instead of "only" INTs...

svn path=/branches/ntvdm/; revision=60193
2013-09-17 23:02:22 +00:00
Hermès Bélusca-Maïto c27ff5b52f [SOFT386]
- Code formatting (align on 4-space)
- Fix union / struct problem in _SOFT386_PAGE_TABLE.

svn path=/branches/ntvdm/; revision=60189
2013-09-17 21:47:38 +00:00
Hermès Bélusca-Maïto 7588e8cb68 Add a fictitious (commented) field to help the reader to know that indeed, the high bits are indeed reserved.
svn path=/branches/ntvdm/; revision=60188
2013-09-17 21:27:29 +00:00
Aleksandar Andrejevic 375bcfd674 [SOFT386]
Fix hypothetical bug.


svn path=/branches/ntvdm/; revision=60187
2013-09-17 21:15:52 +00:00
Aleksandar Andrejevic 758bdf41d9 [SOFT386]
Fix the "persistant prefix" bug.
Fix the conditional jump bug.
Implement Soft386ExecuteAt.
[NTVDM]
Add Soft386 support to ntvdm.


svn path=/branches/ntvdm/; revision=59929
2013-08-31 19:18:12 +00:00
Aleksandar Andrejevic c0a39279ae [SOFT386]
Add checks for illegal prefixes.
Implement HLT and PAUSE.


svn path=/branches/ntvdm/; revision=59890
2013-08-29 22:07:53 +00:00
Aleksandar Andrejevic 610999cb63 [SOFT386]
Implement prefix support.


svn path=/branches/ntvdm/; revision=59810
2013-08-24 11:48:38 +00:00
Hermès Bélusca-Maïto 8e37700e5c Synchronize with trunk revision 59781.
svn path=/branches/ntvdm/; revision=59784
2013-08-19 18:55:28 +00:00
Aleksandar Andrejevic 6f769d6314 [SOFT386]
Implement instruction fetch functions.
Implement CPU exception system.


svn path=/branches/ntvdm/; revision=59782
2013-08-19 18:23:39 +00:00
Hermès Bélusca-Maïto 2672ec8ee5 [SOFT386]
- In the interface header soft386.h, do not include other particular headers (windows.h and debug.h). Those must be included by the different applications which also will include soft386.h.
- LPVOID --> PVOID (do it general, not just à-la Win32).
- The .c files include the headers, and each .c files must have its "#define NDEBUG\n#include <debug.h>" lines, to activate (or deactivate here in the example) debugging output.
- In the .c files, include the header windef.h for having the basic types, and temporarily comment out the needed #defines which will be needed if one needs to include other win***.h files. Those will be deleted if they aren't needed at the end.

svn path=/branches/ntvdm/; revision=59766
2013-08-17 21:15:55 +00:00
Aleksandar Andrejevic fb158ecbe1 [SOFT386]
Add definition for Soft386Interrupt.
Implement Soft386DumpState.


svn path=/branches/ntvdm/; revision=59757
2013-08-17 01:41:22 +00:00
Aleksandar Andrejevic 005e1f0559 [SOFT386]
Start implementing a new emulator library to provide 386/486 emulation support to NTVDM
and perhaps other components aswell.


svn path=/branches/ntvdm/; revision=59752
2013-08-16 19:21:02 +00:00
Aleksandar Andrejevic 5a7a26d750 [NTVDM]
Synchronize with trunk again for SetConsolePalette.
Implement VGA palettes for graphics mode and DAC register access.


svn path=/branches/ntvdm/; revision=59713
2013-08-12 19:31:54 +00:00
Aleksandar Andrejevic ed55d73cfd Sync with trunk.
svn path=/branches/ntvdm/; revision=59679
2013-08-09 13:26:07 +00:00
Hermès Bélusca-Maïto f66525ee02 Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
svn path=/branches/ntvdm/; revision=59665
2013-08-07 14:57:30 +00:00
Aleksandar Andrejevic fb7355f834 Synchronize with trunk.
svn path=/branches/ntvdm/; revision=59499
2013-07-18 00:46:28 +00:00