Einzelnen Beitrag anzeigen
Alt 31.07.2017, 16:14   #15
RalfFriedl
Registrierter Benutzer
Thank you for the 32-Bit fix. With this fix, it works.
I have disassembled the BIOS, it seems it's doing 32-Bit I/O to addresses 0CF8, 0CFC, F000, F004. Ports 0CF8 and 0CFC seem to be PCI config, the result from those is used to determine ports F000 and F004. The BIOS area is writable and accessed via CS register.

I still think it is a stupid idea from Microsoft to use the VGA BIOS at this point (or at all). For all we and Windows knows, the BIOS may pass the parameters to the GPU to do the real work, as the GPU is often faster that the main CPU, especially with Atom and Celeron CPUs. Not that the output speed is an indication of that.
I think fullscreen mode should also not use the BIOS. It is better and faster to require support in the Windows VGA Driver than to call the real mode BIOS and then trap and emulate the I/O access.

I also tried the following program to load a complete BIOS:
Code:
#define i386
#include <windows.h> 

#pragma comment (lib, "user32.lib")

__declspec(dllexport) BOOL __cdecl VDDInitialize(IN PVOID DllHandle, IN ULONG Reason, IN PCONTEXT Context OPTIONAL)
{
  switch (Reason) {

  case DLL_PROCESS_ATTACH:
    {
      HANDLE hFile;
      DWORD dwLen;
      hFile = CreateFile ("C:/WINDOWS/SYSTEM32/VGABIOS.BIN", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
      if (hFile == INVALID_HANDLE_VALUE) {
	OutputDebugString ("VGABIOS.BIN not found.");
	return FALSE;
      }
      ReadFile (hFile, (LPVOID)0xC0000, 0x20000, &dwLen, NULL);
      CloseHandle (hFile);
      break;
    }
  case DLL_PROCESS_DETACH:
    break;
  default:
    break;
  }
  return TRUE;
}
I tried to compile it with the compiler from the "SDK for Windows 7" with "cl -LD vgabios.c". This created a DLL, and I could verify with ProcMon that the DLL is loaded by NTVDM, but I saw no indication that it would try to open the BIOS file. Is this idea generally flawed, do I have to do something else to create a library that can be used by NTVDM, or is it generally no possible to access files this way from NTVDM? Can you tell me what is necessary to create a suitable DLL for NTVDM, or if special tools are necessary, compile the program for me?

Do you know how NTVDM knows how to attach to a DOS command? When I called NTVDM directly, from the command line or in the debugger, it just exits. I also replaced it with a program to display the command line, it seems the NTDVM command line is empty, so there must be something else to tell NTVDM what to do.

The VGA BIOS for this adapter is almost 64kB, while the one from the Virtual Machine is just 32kB. Considering they don't want to support the 16-Bit BIOS, they made it quite big. And is seems to be assembly, not C, so that is not the reason why it is so big.

I will send you the TeamViewer codes in case you are still interested.
RalfFriedl ist offline   Mit Zitat antworten