Commit graph

331 commits

Author SHA1 Message Date
Aleksandar Andrejevic 9c142126d3 [BASESRV]
In BaseSrvGetConsoleRecord and GetConsoleRecordBySessionId, check if the console record was not found instead
of returning the last one in the list.
In BaseSrvCheckVDM, return the session ID to the caller.


svn path=/branches/ntvdm/; revision=63120
2014-05-02 21:45:16 +00:00
Aleksandar Andrejevic fdf472cb6e [NTVDM]
Restore the console to normal size while no DOS task is running and keep track
of the cursor position.
Adapted from a patch by Hermès Bélusca-Maïto.


svn path=/branches/ntvdm/; revision=63119
2014-05-02 21:17:05 +00:00
Aleksandar Andrejevic accafb817a [NTVDM]
Initialize the reference counts of the DOS console handles.


svn path=/branches/ntvdm/; revision=63118
2014-05-02 18:49:15 +00:00
Aleksandar Andrejevic e53148d3f5 [NTVDM]
Use VdmRunning to keep the state of the whole VDM, not a VDM task.
Add an event whose signaled state determines the state of the VDM task.
Use FILE_SHARE_READ when opening executables.


svn path=/branches/ntvdm/; revision=63116
2014-05-02 18:24:40 +00:00
Aleksandar Andrejevic 880d3c125f [NTVDM]
Set VdmRunning to TRUE in EmulatorSimulate.


svn path=/branches/ntvdm/; revision=63109
2014-05-02 15:44:47 +00:00
Aleksandar Andrejevic 3a94de4a0e [BASESRV]
Fix the previous fix. It's not necessary to use a different status value from the one that was returned.


svn path=/branches/ntvdm/; revision=63100
2014-05-02 01:20:40 +00:00
Aleksandar Andrejevic 8be11a5989 [BASESRV]
Make sure that the console record exists before continuing.


svn path=/branches/ntvdm/; revision=63099
2014-05-02 01:18:46 +00:00
Aleksandar Andrejevic 47c1283bd2 [BASESRV][KERNEL32][NTVDM]
Make our BaseSrvGetNextVDMCommand and GetNextVDMCommand a bit more Windows-compatible,
and modify NTVDM accordingly.


svn path=/branches/ntvdm/; revision=63098
2014-05-01 23:52:36 +00:00
Aleksandar Andrejevic d0fad5273f [BASESRV]
Implement BaseSrvDisconnect and BaseSrvCleanupVdmRecords, which will remove VDM console and DOS records
which have been left behind by a terminated ntvdm process.
Implement the "VDM voodoo" in BaseSrvCreateProcess. It's supposed to store the process ID of the VDM
in the VDM console record.
Fix minor bugs.
Add function declarations to the header file.


svn path=/branches/ntvdm/; revision=63042
2014-04-29 00:41:48 +00:00
Hermès Bélusca-Maïto 487d3f80bf [CSRSRV]
When the CsrProcessCreateNewGroup (~= CREATE_NEW_PROCESS_GROUP) flag is set, it means that we are creating a new process group leader, and not the reverse :P

svn path=/branches/ntvdm/; revision=63041
2014-04-28 23:09:09 +00:00
Aleksandar Andrejevic dd049f9da3 [BASESRV]
Don't update the state of the old DOS records if the DOS program executed another program.


svn path=/branches/ntvdm/; revision=63039
2014-04-28 20:51:59 +00:00
Aleksandar Andrejevic 3031b351e8 [NTVDM]
Don't define STANDALONE by default.
Don't quit ntvdm after it becomes the last process on the console if a DOS app is still running.


svn path=/branches/ntvdm/; revision=63024
2014-04-27 22:38:54 +00:00
Aleksandar Andrejevic 2e1e346378 [NTVDM]
DPRINT1 the error code returned by DosLoadExecutable.


svn path=/branches/ntvdm/; revision=62973
2014-04-26 09:40:55 +00:00
Aleksandar Andrejevic e5df0c4dfe [NTVDM]
Rewrite DosCreateProcess, separating the loading code into DosLoadExecutable.
Implement INT 21h function AH = 0x4B (Create Process).


svn path=/branches/ntvdm/; revision=62972
2014-04-26 08:57:17 +00:00
Aleksandar Andrejevic a8caf51cd0 [NTVDM]
Quit when ntvdm becomes the last process attached to the console.


svn path=/branches/ntvdm/; revision=62892
2014-04-22 20:46:50 +00:00
Aleksandar Andrejevic e2dbefc310 Sync with trunk.
svn path=/branches/ntvdm/; revision=62849
2014-04-21 01:45:58 +00:00
Hermès Bélusca-Maïto 259f3d86e3 [NTVDM]
Fix few DPRINTs. The DOS program starting code (common for STANDALONE and OS-integrated modes) can be moved into a helper function later on.

svn path=/branches/ntvdm/; revision=62688
2014-04-08 14:57:24 +00:00
Hermès Bélusca-Maïto 67c46a3b02 [NTVDM]
- Just define GetNextVDMCommand and ExitVDM at their correct places.
- Code cleaning.

svn path=/branches/ntvdm/; revision=62687
2014-04-08 14:35:35 +00:00
Aleksandar Andrejevic e5a9861dc9 [NTVDM]
Start implementing the BaseVDM interface.


svn path=/branches/ntvdm/; revision=62686
2014-04-08 00:28:49 +00:00
Aleksandar Andrejevic bd153df890 [BASESRV]
Fix BaseSrvCheckVDM - DOS records should be initialized with a state of VDM_NOT_LOADED.
Fix BaseSrvFillCommandInfo - Check the size of the buffers.
Start implementing BaseSrvGetNextVDMCommand.


svn path=/branches/ntvdm/; revision=62683
2014-04-07 23:16:22 +00:00
Aleksandar Andrejevic 6c0fe9b984 [BASESRV]
Implement BaseSrvFillCommandInfo, a function that fills a BASE_GET_NEXT_VDM_COMMAND
structure with command information.


svn path=/branches/ntvdm/; revision=62602
2014-04-02 21:29:44 +00:00
Aleksandar Andrejevic 0e0f35fea9 [BASESRV]
Add a pair of event handles to the console record.
Implement BaseSrvSetReenterCount.


svn path=/branches/ntvdm/; revision=62600
2014-04-02 01:29:50 +00:00
Aleksandar Andrejevic 4c68eccd0a [NTVDM]
Set the base address to a high address, so that BaseVDM can allocate 16 MB at address 0.


svn path=/branches/ntvdm/; revision=62453
2014-03-08 01:40:08 +00:00
Aleksandar Andrejevic 9c283d7508 [BASESRV]
- Move more constants to the global header.
- Implement GetConsoleRecordBySessionId.
- Implement BaseSrvUpdateVDMEntry.
- Improve and fix bugs in the cleanup code.


svn path=/branches/ntvdm/; revision=62451
2014-03-07 23:46:43 +00:00
Aleksandar Andrejevic bdd88c2413 [BASESRV]
BaseSrvCopyCommand should return TRUE if it was successful.


svn path=/branches/ntvdm/; revision=62435
2014-03-05 20:01:57 +00:00
Hermès Bélusca-Maïto 7a52bcd33a [NTVDM]: Add a common helper to sync the BIOS cursor for the active display page, with VGA.
svn path=/branches/ntvdm/; revision=62409
2014-03-03 00:09:22 +00:00
Hermès Bélusca-Maïto 667b254535 [NTVDM]: Improve some DPRINTs.
svn path=/branches/ntvdm/; revision=62407
2014-03-02 23:37:42 +00:00
Hermès Bélusca-Maïto b9b4ce1df4 [NTVDM]
Refactor more code to move common BIOS code from our bios32 into /bios/ .

svn path=/branches/ntvdm/; revision=62406
2014-03-02 22:50:31 +00:00
Hermès Bélusca-Maïto b960a23921 [NTVDM]: Fix INT 10h, AH=8h,9h,Ah ; remove AH=12h because it corresponds to video "alternate function select" (and not scroll window). Stubplement INT 10h, AH=13h.
svn path=/branches/ntvdm/; revision=62381
2014-03-02 18:41:22 +00:00
Hermès Bélusca-Maïto cab63e90c0 [NTVDM]
Definitively fix console resizing when exiting the VDM.

svn path=/branches/ntvdm/; revision=62379
2014-03-02 15:04:56 +00:00
Hermès Bélusca-Maïto e53f7b173c [NTVDM]
Use a helper function for stopping the VDM (in case we add other steps for that), instead of just setting the flag to TRUE.

svn path=/branches/ntvdm/; revision=62378
2014-03-02 14:37:51 +00:00
Aleksandar Andrejevic 8656d3a5f6 [BASESRV]
Move the GET_NEXT_VDM_COMMAND_DATA structure to a global header, and
rename it to VDM_COMMAND_INFO.
Implement BaseSrvCopyCommand, which moves the BASE_CHECK_VDM structure data
into a new VDM_COMMAND_INFO structure.
Implement BaseSrvFreeVDMInfo which frees a VDM_COMMAND_INFO structure and
everything in it.


svn path=/branches/ntvdm/; revision=62374
2014-03-02 02:50:40 +00:00
Hermès Bélusca-Maïto ab9978f190 [NTVDM]
- Finally get rid of console output handles in the BIOS.
- Move console text buffer copy from BIOS back into VGA memory (~= revert part of r61542), but do it ONLY when attaching the VGA emulation to the console.
- Fix cursor positioning in BIOS & VGA (work in progress).

- Initialize PS/2 after having setting basic console modes.
- Showing/hiding mouse cursor (see the option in the console menu) is done in while() loops to be sure the cursor is really shown/hidden (based on the return value of ShowConsoleCursor).

svn path=/branches/ntvdm/; revision=62373
2014-03-02 01:45:57 +00:00
Hermès Bélusca-Maïto b152f5cf43 [NTVDM]
The RegisterConsoleVDM API (undocumented) allows NTVDM to get a VGA-like text framebuffer hold by the console server. This text framebuffer is unique, per-console (so that changing the active text screen buffer doesn't change the text framebuffer) and exists even if you use a graphics screen buffer.
NTVDM can write in this framebuffer, and when a call to InvalidateConsoleDIBits is done, it is painted on the screen.

Since RegisterConsoleVDM is unimplemented on ReactOS, I start an implementation of this API *inside* NTVDM (that will then be moved to kernel32/winsrv when it will work correctly).

I adapt the code of the VGA emulation to support RegisterConsoleVDM.

svn path=/branches/ntvdm/; revision=62371
2014-03-01 20:58:42 +00:00
Hermès Bélusca-Maïto 129e5d0305 [NTVDM]: Rework the code template to be used when we will support mice in ntvdm.
svn path=/branches/ntvdm/; revision=62370
2014-03-01 20:52:46 +00:00
Aleksandar Andrejevic d01148ac9b [BASESRV]
Implement a function that creates a pair of event handles - BaseSrvCreatePairWaitHandles.
As already explained in the comments of BaseCheckForVDM (in kernel32), the hParent parameter
is actually an event handle (or more precisely, the client event handle), not a process handle.


svn path=/branches/ntvdm/; revision=62367
2014-03-01 15:13:54 +00:00
Aleksandar Andrejevic f488f7003e [BASESRV]
Continue implementing BaseSrvCheckVDM.


svn path=/branches/ntvdm/; revision=62363
2014-03-01 04:37:01 +00:00
Hermès Bélusca-Maïto 9e1ba5c534 [NTVDM]
Get rid of ConsoleInput handles in the BIOS; setting input console modes should be done in the emulator.c module itself (when setting user interface modes), and if a mouse is present, handle it in the ps2.c module.
Next step will be to get rid of ConsoleOutput handle in the BIOS.

svn path=/branches/ntvdm/; revision=62359
2014-02-28 21:21:41 +00:00
Aleksandar Andrejevic bde24e0bb4 [BASESRV]
Implement BaseSrvIsVdmAllowed.


svn path=/branches/ntvdm/; revision=62349
2014-02-27 22:44:56 +00:00
Hermès Bélusca-Maïto e29c05a3d5 [NTVDM]
Be able to load an external DOS BIOS file (at 70:0000) and, in case it is the DOS BIOS file of the NT VDM, load the DOS kernel file ntdos.sys when the ntio.sys calls BOP DOS function 0x11 (and put the kernel at DI:0000).
Work in progress...

svn path=/branches/ntvdm/; revision=62343
2014-02-27 03:08:23 +00:00
Hermès Bélusca-Maïto cb45ae15fa [NTVDM]
- Add BOP 0x12 "BiosGetMemorySize" (same number as the corresponding INTerrupt). Needed by ntio.sys when initializing (see next commit).
- Use ASCII names for bios image and dos kernel files names.
- Use the file helper functions committed before for implementing ROM image file loading.

svn path=/branches/ntvdm/; revision=62342
2014-02-27 03:05:42 +00:00
Hermès Bélusca-Maïto 7c73e239b0 [NTVDM]
Add some utility functions (only file-oriented for now :) ). Will be used in the next commit.

svn path=/branches/ntvdm/; revision=62341
2014-02-27 03:02:11 +00:00
Hermès Bélusca-Maïto ae22dab753 [NTVDM]
- BIOS32: As a demonstration, load a BIOS expansion ROM (the one I've tested is the "OS in PCI expansion ROM" from: https://sites.google.com/site/pinczakko/building-a-kernel-in-pci-expansion-rom ; we don't support PCI thingies at all, but the bootstrap code works correctly).
- Initialize the BIOS32 stack for the callbacks.
- In the common BIOS functions, if we try to load the Windows NTVDM (SoftPC) BIOS (file: bios4.rom), we immediately hit a BOP 0x00 followed by INT 0x19 (bootstrap to run an OS). The BOP 0x00 is the function used by the BIOS to ask NTVDM to initialize the hardware, the IVT with data and so on. Also we finish to load the low part of the NTVDM BIOS in it (file: bios1.rom).
It's work-in-progress, nothing is done, there are lots of debugging code...

Have fun!

(to load a custom bios you need to put its filename as the first parameter of the BiosInitialize call, in the main() function in ntvdm.c).

svn path=/branches/ntvdm/; revision=62333
2014-02-26 01:16:56 +00:00
Hermès Bélusca-Maïto e03a6d7ebb [NTVDM]
- Add utility functions for loading ROM images from files, and running them.
- Add a missing PVOID in the MEM_ALIGN_DOWN macro.

svn path=/branches/ntvdm/; revision=62332
2014-02-26 01:07:09 +00:00
Hermès Bélusca-Maïto 4179d7890c [NTVDM]
- Reduce the size of the trampoline needed to perform 32 ---> 16 bit callbacks.
- Fix some comments, improve DPRINTs.

svn path=/branches/ntvdm/; revision=62331
2014-02-26 01:03:14 +00:00
Aleksandar Andrejevic 5036028dd4 [BASESRV]
Implement BaseSrvExitVDM.


svn path=/branches/ntvdm/; revision=62315
2014-02-24 03:51:49 +00:00
Hermès Bélusca-Maïto 9542b86934 [NTVDM]
- Move an "enable interrupts" command to where it belongs (i.e. in the BIOS32 initialization code; we do it at the very end). Otherwise some problems appears when trying to load 16-bit bios images.
- Use the new macro REAL_TO_PHYS to convert "real-mode" pointers (valid inside the VM only) into "physical" ones (valid in ROS/Windows/whatever).
- Add BIG HACKs (thanks Aleksander ;) ) in EmulatorRead/WriteMemory for wrapping up high memory addresses to low ones, so that we can load bios images (when you start running code at F000:FFF0).

To test 16-bit bios images: in ntvdm.c, put a valid bios file name in the BiosInitialize(...) call, and disable all DOS calls that happen before EmulatorSimulate().

svn path=/branches/ntvdm/; revision=62314
2014-02-24 00:33:21 +00:00
Hermès Bélusca-Maïto 679980a06c [NTVDM]
- BIOS location must be aligned on 32bit boundaries (or 16, I have to check). This fixes BIOS images loading when they miss a (null) byte to make them (e.g.) 8192 bytes long (example: the BIOS image of windows ntvdm).
- Add useful alignment (and others) macros.

svn path=/branches/ntvdm/; revision=62312
2014-02-23 20:40:09 +00:00
Hermès Bélusca-Maïto 6f5166457c [NTVDM]: We can call now directly the interrupts instead of the internal functions BiosPeekCharacter and VidBiosPrintCharacter (so that if some program hooks them, we behave correctly).
svn path=/branches/ntvdm/; revision=62311
2014-02-23 19:43:31 +00:00
Hermès Bélusca-Maïto b33a34bec1 [NTVDM]
- Use callbacks in BIOS/DOS (and disable int32.c)
- Move DOS bops to dem.c

svn path=/branches/ntvdm/; revision=62306
2014-02-23 16:09:35 +00:00