Fixed some dll separation issues.

This commit is contained in:
Alexandre Julliard 2002-08-30 00:03:25 +00:00
parent ca13564733
commit 0d875e773e
14 changed files with 41 additions and 70 deletions

View File

@ -150,8 +150,7 @@ typedef struct
struct _DOS_LISTOFLISTS * DOSMEM_LOL()
{
return (struct _DOS_LISTOFLISTS *)DOSMEM_MapRealToLinear
(MAKESEGPTR(HIWORD(DOS_LOLSeg),0));
return PTR_REAL_TO_LIN(HIWORD(DOS_LOLSeg),0);
}
@ -218,7 +217,7 @@ static void WINAPI con_interrupt(CONTEXT86*ctx)
{
int *scan;
REQUEST_HEADER *hdr = get_hdr(SYSTEM_STRATEGY_CON,(void **)&scan);
BIOSDATA *bios = DOSMEM_BiosData();
BIOSDATA *bios = BIOS_DATA;
WORD CurOfs = bios->NextKbdCharPtr;
DOS_LISTOFLISTS *lol = DOSMEM_LOL();
DOS_DATASEG *dataseg = (DOS_DATASEG *)lol;
@ -505,7 +504,7 @@ DWORD DOSDEV_Console(void)
DWORD DOSDEV_FindCharDevice(char*name)
{
SEGPTR cur_ptr = MAKESEGPTR(HIWORD(DOS_LOLSeg), FIELD_OFFSET(DOS_LISTOFLISTS,NUL_dev));
DOS_DEVICE_HEADER *cur = DOSMEM_MapRealToLinear(cur_ptr);
DOS_DEVICE_HEADER *cur = PTR_REAL_TO_LIN(SELECTOROF(cur_ptr),OFFSETOF(cur_ptr));
char dname[8];
int cnt;
@ -521,7 +520,7 @@ DWORD DOSDEV_FindCharDevice(char*name)
memcmp(cur->name,dname,8))) {
cur_ptr = cur->next_dev;
if (cur_ptr == NONEXT) cur=NULL;
else cur = DOSMEM_MapRealToLinear(cur_ptr);
else cur = PTR_REAL_TO_LIN(SELECTOROF(cur_ptr),OFFSETOF(cur_ptr));
}
return cur_ptr;
}
@ -533,7 +532,7 @@ static void DOSDEV_DoReq(void*req, DWORD dev)
CONTEXT86 ctx;
char *phdr;
dhdr = DOSMEM_MapRealToLinear(dev);
dhdr = PTR_REAL_TO_LIN(SELECTOROF(dev),OFFSETOF(dev));
phdr = ((char*)DOSMEM_LOL()) + DOS_DATASEG_OFF(req);
/* copy request to request scratch area */

View File

@ -40,7 +40,7 @@ DOSASPI_PostProc( SRB_ExecSCSICmd *lpPRB )
memcpy(&ptrSRB,lpPRB->SenseArea + lpPRB->SRB_SenseLen,sizeof(DWORD));
TRACE("Copying data back to DOS client at 0x%8lx\n",ptrSRB);
lpSRB16 = DOSMEM_MapRealToLinear(ptrSRB);
lpSRB16 = PTR_REAL_TO_LIN(SELECTOROF(ptrSRB),OFFSETOF(ptrSRB));
lpSRB16->cmd.SRB_TargStat = lpPRB->SRB_TargStat;
lpSRB16->cmd.SRB_HaStat = lpPRB->SRB_HaStat;
memcpy(lpSRB16->cmd.CDBByte + lpSRB16->cmd.SRB_CDBLen,lpPRB->SenseArea,lpSRB16->cmd.SRB_SenseLen);
@ -106,7 +106,7 @@ DWORD ASPI_SendASPIDOSCommand(DWORD ptrSRB)
DWORD retval;
union tagSRB16 * lpSRB16;
lpSRB16 = DOSMEM_MapRealToLinear(ptrSRB);
lpSRB16 = PTR_REAL_TO_LIN(SELECTOROF(ptrSRB),OFFSETOF(ptrSRB));
retval = SS_ERR;
switch( lpSRB16->common.SRB_Cmd )
@ -143,7 +143,8 @@ DWORD ASPI_SendASPIDOSCommand(DWORD ptrSRB)
lpPRB->SRB_Flags = SRB_POSTING | (lpSRB16->cmd.SRB_Flags&(SRB_DIR_IN|SRB_DIR_OUT|SRB_ENABLE_RESIDUAL_COUNT));
/* Pointer to data buffer */
lpPRB->SRB_BufPointer = DOSMEM_MapRealToLinear(lpSRB16->cmd.SRB_BufPointer);
lpPRB->SRB_BufPointer = PTR_REAL_TO_LIN(SELECTOROF(lpSRB16->cmd.SRB_BufPointer),
OFFSETOF(lpSRB16->cmd.SRB_BufPointer));
/* Copy CDB in */
memcpy(&lpPRB->CDBByte[0],&lpSRB16->cmd.CDBByte[0],lpSRB16->cmd.SRB_CDBLen);

View File

@ -45,6 +45,9 @@ extern WORD DOSVM_retval; /* return value of previous DOS task */
#define V86_FLAG 0x00020000
#define BIOS_DATA ((void *)0x400)
#define BIOS_SYS ((void *)0xf0000)
extern void WINAPI MZ_LoadImage( LPCSTR filename, HANDLE hFile );
extern BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk );
extern void WINAPI MZ_Exit( CONTEXT86 *context, BOOL cs_psp, WORD retval );

View File

@ -630,7 +630,7 @@ void WINAPI DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVOID data
*/
FARPROC16 DOSVM_GetRMHandler( BYTE intnum )
{
return ((FARPROC16*)DOSMEM_SystemBase())[intnum];
return ((FARPROC16*)0)[intnum];
}
@ -643,7 +643,7 @@ void DOSVM_SetRMHandler( BYTE intnum, FARPROC16 handler )
{
TRACE("Set real mode interrupt vector %02x <- %04x:%04x\n",
intnum, HIWORD(handler), LOWORD(handler) );
((FARPROC16*)DOSMEM_SystemBase())[intnum] = handler;
((FARPROC16*)0)[intnum] = handler;
}

View File

@ -84,14 +84,14 @@ static void BIOS_SetCursorPos(BIOSDATA*data,unsigned page,unsigned X,unsigned Y)
static void DOSVM_Int10Handler_VESA( CONTEXT86 *context )
{
BIOSDATA *data = DOSMEM_BiosData();
BIOSDATA *data = BIOS_DATA;
switch(AL_reg(context)) {
case 0x00: /* GET SuperVGA INFORMATION */
TRACE("VESA GET SuperVGA INFORMATION\n");
memcpy(CTX_SEG_OFF_TO_LIN(context,context->SegEs,context->Edi),
DOSMEM_BiosSys()+DOSMEM_GetBiosSysStructOffset(OFF_VESAINFO),
(char *)BIOS_SYS + DOSMEM_GetBiosSysStructOffset(OFF_VESAINFO),
sizeof(VESAINFO));
AL_reg(context) = 0x4f;
AH_reg(context) = 0x00; /* 0x00 = successful 0x01 = failed */
@ -336,7 +336,7 @@ static void DOSVM_Int10Handler_VESA( CONTEXT86 *context )
void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
{
BIOSDATA *data = DOSMEM_BiosData();
BIOSDATA *data = BIOS_DATA;
switch(AH_reg(context)) {
@ -788,7 +788,7 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
AL_reg(context) = 0x1b;
/* Copy state information structure to ES:DI */
memcpy(CTX_SEG_OFF_TO_LIN(context,context->SegEs,context->Edi),
DOSMEM_BiosSys()+DOSMEM_GetBiosSysStructOffset(OFF_VIDEOSTATE),sizeof(VIDEOSTATE));
(char *)BIOS_SYS + DOSMEM_GetBiosSysStructOffset(OFF_VIDEOSTATE),sizeof(VIDEOSTATE));
}
break;
@ -839,7 +839,7 @@ static void scroll_window(int direction, char lines, char row1,
void WINAPI DOSVM_PutChar(BYTE ascii)
{
BIOSDATA *data = DOSMEM_BiosData();
BIOSDATA *data = BIOS_DATA;
unsigned xpos, ypos;
TRACE("char: 0x%02x(%c)\n", ascii, ascii);

View File

@ -150,7 +150,7 @@ void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
int WINAPI DOSVM_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek)
{
BIOSDATA *data = DOSMEM_BiosData();
BIOSDATA *data = BIOS_DATA;
WORD CurOfs = data->NextKbdCharPtr;
/* check if there's data in buffer */
@ -177,7 +177,7 @@ int WINAPI DOSVM_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek)
int WINAPI DOSVM_Int16AddChar(BYTE ascii,BYTE scan)
{
BIOSDATA *data = DOSMEM_BiosData();
BIOSDATA *data = BIOS_DATA;
WORD CurOfs = data->FirstKbdCharPtr;
WORD NextOfs = CurOfs + 2;

View File

@ -158,7 +158,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
case 0x0b: /* GET STDIN STATUS */
{
BIOSDATA *data = DOSMEM_BiosData();
BIOSDATA *data = BIOS_DATA;
if(data->FirstKbdCharPtr == data->NextKbdCharPtr)
AL_reg(context) = 0;
else

View File

@ -496,7 +496,7 @@ static int DPMI_FreeRMCB( DWORD address )
PrevRMCB->next = CurrRMCB->next;
else
FirstRMCB = CurrRMCB->next;
DOSMEM_FreeBlock(DOSMEM_MapRealToLinear(CurrRMCB->address));
DOSMEM_FreeBlock(PTR_REAL_TO_LIN(SELECTOROF(CurrRMCB->address),OFFSETOF(CurrRMCB->address)));
HeapFree(GetProcessHeap(), 0, CurrRMCB);
return 0;
}

View File

@ -101,7 +101,7 @@ static void EMS_init(void)
HEAP_ZERO_MEMORY,
sizeof(*EMS_record));
EMS_record->frame_address = DOSMEM_MapDosToLinear(base);
EMS_record->frame_address = (void *)base;
EMS_record->frame_selector = base >> 4;
}

View File

@ -365,7 +365,7 @@ BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID para
* let's work on the new values now */
LPBYTE psp_start = (LPBYTE)((DWORD)DOSVM_psp << 4);
ExecBlock *blk = (ExecBlock *)paramblk;
LPBYTE cmdline = DOSMEM_MapRealToLinear(blk->cmdline);
LPBYTE cmdline = PTR_REAL_TO_LIN(SELECTOROF(blk->cmdline),OFFSETOF(blk->cmdline));
/* First character contains the length of the command line. */
MZ_FillPSP(psp_start, cmdline + 1, cmdline[0]);
@ -473,15 +473,17 @@ static BOOL MZ_InitTask(void)
static void MZ_Launch(void)
{
TDB *pTask = TASK_GetCurrent();
TDB *pTask = TASK_GetPtr( GetCurrentTask() );
BYTE *psp_start = PTR_REAL_TO_LIN( DOSVM_psp, 0 );
LPSTR cmdline = GetCommandLineA();
DWORD rv;
SYSLEVEL *lock;
MZ_FillPSP(psp_start, cmdline, cmdline ? strlen(cmdline) : 0);
pTask->flags |= TDBF_WINOLDAP;
_LeaveWin16Lock();
GetpWin16Lock( &lock );
_LeaveSysLevel( lock );
ResumeThread(dosvm_thread);
rv = DOSVM_Loop(dosvm_thread);
@ -515,8 +517,8 @@ void WINAPI MZ_Exit( CONTEXT86 *context, BOOL cs_psp, WORD retval )
/* FIXME: deallocate file handles etc */
/* free process's associated memory
* FIXME: walk memory and deallocate all blocks owned by process */
DOSMEM_FreeBlock(DOSMEM_MapRealToLinear(MAKELONG(0,psp->environment)));
DOSMEM_FreeBlock(DOSMEM_MapRealToLinear(MAKELONG(0,DOSVM_psp)));
DOSMEM_FreeBlock( PTR_REAL_TO_LIN(psp->environment,0) );
DOSMEM_FreeBlock( PTR_REAL_TO_LIN(DOSVM_psp,0) );
/* switch to parent's PSP */
DOSVM_psp = parpsp;
psp_start = (LPBYTE)((DWORD)parpsp << 4);

View File

@ -279,7 +279,7 @@ HANDLE VGA_AlphaConsole(void)
char*VGA_AlphaBuffer(void)
{
return DOSMEM_MapDosToLinear(0xb8000);
return (char *)0xb8000;
}
/*** GRAPHICS MODE ***/
@ -529,14 +529,14 @@ void VGA_SetWindowStart(int start)
if(vga_fb_window == -1)
FIXME("Remove VGA memory emulation.\n");
else
memmove(vga_fb_data + vga_fb_window, DOSMEM_MapDosToLinear(0xa0000), 64 * 1024);
memmove(vga_fb_data + vga_fb_window, (char *)0xa0000, 64 * 1024);
vga_fb_window = start;
if(vga_fb_window == -1)
FIXME("Install VGA memory emulation.\n");
else
memmove(DOSMEM_MapDosToLinear(0xa0000), vga_fb_data + vga_fb_window, 64 * 1024);
memmove( (char *)0xa0000, vga_fb_data + vga_fb_window, 64 * 1024);
}
/*
@ -826,7 +826,7 @@ static void VGA_Poll_Graphics(void)
* Synchronize framebuffer contents.
*/
if(vga_fb_window != -1)
memmove(vga_fb_data + vga_fb_window, DOSMEM_MapDosToLinear(0xa0000), 64 * 1024);
memmove(vga_fb_data + vga_fb_window, (char *)0xa0000, 64 * 1024);
/*
* Double VGA framebuffer (320x200 -> 640x400), if needed.

View File

@ -30,7 +30,6 @@
#include "wine/winbase16.h"
#include "module.h"
#include "miscemu.h"
#include "toolhelp.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(int31);
@ -49,7 +48,7 @@ typedef struct {
static BYTE * XMS_Offset( MOVEOFS *ofs )
{
if (ofs->Handle) return (BYTE*)GlobalLock16(ofs->Handle)+ofs->Offset;
else return (BYTE*)DOSMEM_MapRealToLinear(ofs->Offset);
else return (BYTE*)PTR_REAL_TO_LIN(SELECTOROF(ofs->Offset),OFFSETOF(ofs->Offset));
}
/**********************************************************************
@ -68,13 +67,11 @@ void WINAPI XMS_Handler( CONTEXT86 *context )
break;
case 0x08: /* Query Free Extended Memory */
{
MEMMANINFO mmi;
MEMORYSTATUS status;
TRACE("query free extended memory\n");
mmi.dwSize = sizeof(mmi);
MemManInfo16(&mmi);
AX_reg(context) = mmi.dwLargestFreeBlock >> 10;
DX_reg(context) = (mmi.dwFreePages * mmi.wPageSize) >> 10;
GlobalMemoryStatus( &status );
AX_reg(context) = DX_reg(context) = status.dwAvailVirtual >> 10;
TRACE("returning largest %dK, total %dK\n", AX_reg(context), DX_reg(context));
}
break;

View File

@ -155,9 +155,6 @@ extern WORD DOSMEM_GetBiosSysStructOffset(int);
extern WORD DOSMEM_0000H;
extern WORD DOSMEM_BiosDataSeg;
extern WORD DOSMEM_BiosSysSeg;
extern BIOSDATA * DOSMEM_BiosData();
extern BYTE * DOSMEM_BiosSys();
extern DWORD DOSMEM_CollateTable;
/* various real-mode code stubs */
@ -172,8 +169,6 @@ extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
extern BOOL DOSMEM_Init(BOOL);
extern void DOSMEM_Tick(WORD timer);
extern WORD DOSMEM_AllocSelector(WORD);
extern char * DOSMEM_MemoryBase(void);
extern char * DOSMEM_SystemBase(void);
extern LPVOID DOSMEM_GetBlock(UINT size, WORD* p);
extern BOOL DOSMEM_FreeBlock(void* ptr);
extern LPVOID DOSMEM_ResizeBlock(void* ptr, UINT size, WORD* p);

View File

@ -93,26 +93,6 @@ WORD DOSMEM_dpmi_sel;
DWORD DOS_LOLSeg;
/***********************************************************************
* DOSMEM_SystemBase
*
* Gets the virtual DOS memory base (interrupt table).
*/
char *DOSMEM_SystemBase(void)
{
return DOSMEM_sysmem;
}
/***********************************************************************
* DOSMEM_MemoryBase
*
* Gets the DOS memory base.
*/
char *DOSMEM_MemoryBase(void)
{
return DOSMEM_dosmem;
}
/***********************************************************************
* DOSMEM_MemoryTop
*
@ -232,16 +212,11 @@ static void DOSMEM_InitDPMI(void)
DOSMEM_dpmi_sel = SELECTOR_AllocBlock( ptr, sizeof(enter_pm), WINE_LDT_FLAGS_CODE );
}
BIOSDATA * DOSMEM_BiosData()
static BIOSDATA * DOSMEM_BiosData(void)
{
return (BIOSDATA *)(DOSMEM_sysmem + 0x400);
}
BYTE * DOSMEM_BiosSys()
{
return DOSMEM_dosmem+0xf0000;
}
/* Add a structure in the BiosSys area (with size and index) and
return its offset */
WORD DOSMEM_AddBiosSysStruct(int size,int index)
@ -266,7 +241,7 @@ WORD DOSMEM_GetBiosSysStructOffset(int index)
*/
static void DOSMEM_FillBiosSegments(void)
{
BYTE *pBiosSys = DOSMEM_BiosSys();
BYTE *pBiosSys = DOSMEM_dosmem + 0xf0000;
BYTE *pBiosROMTable = pBiosSys+0xe6f5;
BIOSDATA *pBiosData = DOSMEM_BiosData();
@ -895,4 +870,3 @@ WORD DOSMEM_AllocSelector(WORD realsel)
TRACE_(selector)("(0x%04x) returns 0x%04x.\n", realsel,sel);
return sel;
}