Commit e6d8768e authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Made DOSMEM_Init() take a BOOL parameter instead of a HMODULE16, and

initialize DOS memory properly in the new process model. Made DOSMEM_MemoryBase() use MZ_Current()->img instead of pModule->dos_image.
parent 3bbd167a
...@@ -134,7 +134,7 @@ extern DWORD DOSMEM_ErrorBuffer; ...@@ -134,7 +134,7 @@ extern DWORD DOSMEM_ErrorBuffer;
extern DWORD DOS_LOLSeg; extern DWORD DOS_LOLSeg;
extern struct _DOS_LISTOFLISTS * DOSMEM_LOL(); extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
extern BOOL DOSMEM_Init(HMODULE16 hModule); extern BOOL DOSMEM_Init(BOOL);
extern void DOSMEM_Tick(WORD timer); extern void DOSMEM_Tick(WORD timer);
extern WORD DOSMEM_AllocSelector(WORD); extern WORD DOSMEM_AllocSelector(WORD);
extern char * DOSMEM_MemoryBase(void); extern char * DOSMEM_MemoryBase(void);
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
#include "ldt.h" #include "ldt.h"
#include "miscemu.h" #include "miscemu.h"
#include "vga.h" #include "vga.h"
#include "module.h" #include "dosexe.h"
#include "task.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(dosmem) DEFAULT_DEBUG_CHANNEL(dosmem)
...@@ -65,12 +64,10 @@ typedef struct { ...@@ -65,12 +64,10 @@ typedef struct {
*/ */
char *DOSMEM_MemoryBase(void) char *DOSMEM_MemoryBase(void)
{ {
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() ); LPDOSTASK lpDosTask = MZ_Current();
NE_MODULE *pModule = pTask ? NE_GetPtr( pTask->hModule ) : NULL;
GlobalUnlock16( GetCurrentTask() ); if (lpDosTask && lpDosTask->img)
if (pModule && pModule->dos_image) return lpDosTask->img;
return pModule->dos_image;
else else
return DOSMEM_dosmem; return DOSMEM_dosmem;
} }
...@@ -399,13 +396,14 @@ static void DOSMEM_MovePointers(LPVOID dest, LPVOID src, DWORD size) ...@@ -399,13 +396,14 @@ static void DOSMEM_MovePointers(LPVOID dest, LPVOID src, DWORD size)
* Create the dos memory segments, and store them into the KERNEL * Create the dos memory segments, and store them into the KERNEL
* exported values. * exported values.
*/ */
BOOL DOSMEM_Init(HMODULE16 hModule) BOOL DOSMEM_Init(BOOL dos_init)
{ {
if (!hModule) LPVOID base = DOSMEM_MemoryBase();
BOOL do_init = dos_init && !DOSMEM_dosmem;
if (!base)
{ {
/* Allocate 1 MB dosmemory /* Allocate 1 MB dosmemory
* - it is mostly wasted but we can use some of it to
* store internal translation tables, etc...
*/ */
DOSMEM_dosmem = VirtualAlloc( NULL, 0x100000, MEM_COMMIT, DOSMEM_dosmem = VirtualAlloc( NULL, 0x100000, MEM_COMMIT,
PAGE_EXECUTE_READWRITE ); PAGE_EXECUTE_READWRITE );
...@@ -418,6 +416,11 @@ BOOL DOSMEM_Init(HMODULE16 hModule) ...@@ -418,6 +416,11 @@ BOOL DOSMEM_Init(HMODULE16 hModule)
0x100, 0, FALSE, FALSE, FALSE, NULL ); 0x100, 0, FALSE, FALSE, FALSE, NULL );
DOSMEM_BiosSysSeg = GLOBAL_CreateBlock(GMEM_FIXED,DOSMEM_dosmem+0xf0000, DOSMEM_BiosSysSeg = GLOBAL_CreateBlock(GMEM_FIXED,DOSMEM_dosmem+0xf0000,
0x10000, 0, FALSE, FALSE, FALSE, NULL ); 0x10000, 0, FALSE, FALSE, FALSE, NULL );
base = DOSMEM_dosmem;
do_init = TRUE;
}
if (do_init) {
DOSMEM_FillIsrTable(); DOSMEM_FillIsrTable();
DOSMEM_FillBiosSegments(); DOSMEM_FillBiosSegments();
DOSMEM_InitMemory(); DOSMEM_InitMemory();
...@@ -426,19 +429,12 @@ BOOL DOSMEM_Init(HMODULE16 hModule) ...@@ -426,19 +429,12 @@ BOOL DOSMEM_Init(HMODULE16 hModule)
DOSMEM_InitDPMI(); DOSMEM_InitDPMI();
DOSDEV_InstallDOSDevices(); DOSDEV_InstallDOSDevices();
} }
else else if (dos_init)
{ {
#if 0
DOSMEM_FillIsrTable(hModule);
DOSMEM_InitMemory(hModule);
#else
LPVOID base = DOSMEM_MemoryBase();
/* bootstrap the new V86 task with a copy of the "system" memory */ /* bootstrap the new V86 task with a copy of the "system" memory */
memcpy(base, DOSMEM_dosmem, 0x100000); memcpy(base, DOSMEM_dosmem, 0x100000);
/* then move existing selectors to it */ /* then move existing selectors to it */
DOSMEM_MovePointers(base, DOSMEM_dosmem, 0x100000); DOSMEM_MovePointers(base, DOSMEM_dosmem, 0x100000);
#endif
} }
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment