Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7b49914a
Commit
7b49914a
authored
Jul 28, 2000
by
Ove Kaaven
Committed by
Alexandre Julliard
Jul 28, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the hModule parameter from various DOSMEM routines, the DOSMEM
routines now always use the current memory space.
parent
d7742bd6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
81 deletions
+81
-81
miscemu.h
include/miscemu.h
+5
-5
winnt.h
include/winnt.h
+1
-1
module.c
loader/dos/module.c
+6
-6
global.c
memory/global.c
+5
-5
dosmem.c
msdos/dosmem.c
+44
-44
dpmi.c
msdos/dpmi.c
+12
-12
int21.c
msdos/int21.c
+6
-6
interrupts.c
msdos/interrupts.c
+2
-2
No files found.
include/miscemu.h
View file @
7b49914a
...
...
@@ -137,11 +137,11 @@ extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
extern
BOOL
DOSMEM_Init
(
HMODULE16
hModule
);
extern
void
DOSMEM_Tick
(
WORD
timer
);
extern
WORD
DOSMEM_AllocSelector
(
WORD
);
extern
char
*
DOSMEM_MemoryBase
(
HMODULE16
hModule
);
extern
LPVOID
DOSMEM_GetBlock
(
HMODULE16
hModule
,
UINT
size
,
UINT16
*
p
);
extern
BOOL
DOSMEM_FreeBlock
(
HMODULE16
hModule
,
void
*
ptr
);
extern
LPVOID
DOSMEM_ResizeBlock
(
HMODULE16
hModule
,
void
*
ptr
,
UINT
size
,
UINT16
*
p
);
extern
UINT
DOSMEM_Available
(
HMODULE16
hModule
);
extern
char
*
DOSMEM_MemoryBase
(
void
);
extern
LPVOID
DOSMEM_GetBlock
(
UINT
size
,
UINT16
*
p
);
extern
BOOL
DOSMEM_FreeBlock
(
void
*
ptr
);
extern
LPVOID
DOSMEM_ResizeBlock
(
void
*
ptr
,
UINT
size
,
UINT16
*
p
);
extern
UINT
DOSMEM_Available
(
void
);
extern
LPVOID
DOSMEM_MapRealToLinear
(
DWORD
);
/* real-mode to linear */
extern
LPVOID
DOSMEM_MapDosToLinear
(
UINT
);
/* linear DOS to Wine */
extern
UINT
DOSMEM_MapLinearToDos
(
LPVOID
);
/* linear Wine to DOS */
...
...
include/winnt.h
View file @
7b49914a
...
...
@@ -714,7 +714,7 @@ typedef HANDLE *PHANDLE;
#define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040)
#define ISV86(context) (EFL_reg(context) & 0x00020000)
#define V86BASE(context) DOSMEM_MemoryBase(
0
)
#define V86BASE(context) DOSMEM_MemoryBase()
/* Macros to retrieve the current context */
...
...
loader/dos/module.c
View file @
7b49914a
...
...
@@ -101,7 +101,7 @@ static char int08[]={
static
void
MZ_InitHandlers
(
LPDOSTASK
lpDosTask
)
{
WORD
seg
;
LPBYTE
start
=
DOSMEM_GetBlock
(
lpDosTask
->
hModule
,
sizeof
(
int08
),
&
seg
);
LPBYTE
start
=
DOSMEM_GetBlock
(
sizeof
(
int08
),
&
seg
);
memcpy
(
start
,
int08
,
sizeof
(
int08
));
/* INT 08: point it at our tick-incrementing handler */
((
SEGPTR
*
)(
lpDosTask
->
img
))[
0x08
]
=
PTR_SEG_OFF_TO_SEGPTR
(
seg
,
0
);
...
...
@@ -122,7 +122,7 @@ static char enter_xms[]={
static
void
MZ_InitXMS
(
LPDOSTASK
lpDosTask
)
{
LPBYTE
start
=
DOSMEM_GetBlock
(
lpDosTask
->
hModule
,
sizeof
(
enter_xms
),
&
(
lpDosTask
->
xms_seg
));
LPBYTE
start
=
DOSMEM_GetBlock
(
sizeof
(
enter_xms
),
&
(
lpDosTask
->
xms_seg
));
memcpy
(
start
,
enter_xms
,
sizeof
(
enter_xms
));
}
...
...
@@ -152,7 +152,7 @@ static char enter_pm[]={
static
void
MZ_InitDPMI
(
LPDOSTASK
lpDosTask
)
{
unsigned
size
=
sizeof
(
enter_pm
);
LPBYTE
start
=
DOSMEM_GetBlock
(
lpDosTask
->
hModule
,
size
,
&
(
lpDosTask
->
dpmi_seg
));
LPBYTE
start
=
DOSMEM_GetBlock
(
size
,
&
(
lpDosTask
->
dpmi_seg
));
lpDosTask
->
dpmi_sel
=
SELECTOR_AllocBlock
(
start
,
size
,
SEGMENT_CODE
,
FALSE
,
FALSE
);
...
...
@@ -170,7 +170,7 @@ static WORD MZ_InitEnvironment( LPDOSTASK lpDosTask, LPCSTR env, LPCSTR name )
while
(
env
[
sz
++
])
sz
+=
strlen
(
env
+
sz
)
+
1
;
}
else
sz
++
;
/* allocate it */
envblk
=
DOSMEM_GetBlock
(
lpDosTask
->
hModule
,
sz
+
sizeof
(
WORD
)
+
strlen
(
name
)
+
1
,
&
seg
);
envblk
=
DOSMEM_GetBlock
(
sz
+
sizeof
(
WORD
)
+
strlen
(
name
)
+
1
,
&
seg
);
/* fill it */
if
(
env
)
{
memcpy
(
envblk
,
env
,
sz
);
...
...
@@ -260,14 +260,14 @@ static BOOL MZ_LoadImage( HANDLE hFile, LPCSTR filename, LPCSTR cmdline,
/* allocate memory for the executable */
TRACE
(
"Allocating DOS memory (min=%ld, max=%ld)
\n
"
,
min_size
,
max_size
);
avail
=
DOSMEM_Available
(
lpDosTask
->
hModule
);
avail
=
DOSMEM_Available
();
if
(
avail
<
min_size
)
{
ERR
(
"insufficient DOS memory
\n
"
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
}
if
(
avail
>
max_size
)
avail
=
max_size
;
psp_start
=
DOSMEM_GetBlock
(
lpDosTask
->
hModule
,
avail
,
&
lpDosTask
->
psp_seg
);
psp_start
=
DOSMEM_GetBlock
(
avail
,
&
lpDosTask
->
psp_seg
);
if
(
!
psp_start
)
{
ERR
(
"error allocating DOS memory
\n
"
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
...
...
memory/global.c
View file @
7b49914a
...
...
@@ -312,9 +312,9 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
TRACE
(
"oldsize %08lx
\n
"
,
oldsize
);
if
(
ptr
&&
(
size
==
oldsize
))
return
handle
;
/* Nothing to do */
if
(((
char
*
)
ptr
>=
DOSMEM_MemoryBase
(
0
))
&&
((
char
*
)
ptr
<=
DOSMEM_MemoryBase
(
0
)
+
0x100000
))
ptr
=
DOSMEM_ResizeBlock
(
0
,
ptr
,
size
,
NULL
);
if
(((
char
*
)
ptr
>=
DOSMEM_MemoryBase
())
&&
((
char
*
)
ptr
<=
DOSMEM_MemoryBase
()
+
0x100000
))
ptr
=
DOSMEM_ResizeBlock
(
ptr
,
size
,
NULL
);
else
ptr
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
ptr
,
size
);
if
(
!
ptr
)
...
...
@@ -677,7 +677,7 @@ DWORD WINAPI GlobalDOSAlloc16(
DWORD
size
/* [in] Number of bytes to be allocated */
)
{
UINT16
uParagraph
;
LPVOID
lpBlock
=
DOSMEM_GetBlock
(
0
,
size
,
&
uParagraph
);
LPVOID
lpBlock
=
DOSMEM_GetBlock
(
size
,
&
uParagraph
);
if
(
lpBlock
)
{
...
...
@@ -706,7 +706,7 @@ WORD WINAPI GlobalDOSFree16(
if
(
block
&&
block
<
0x100000
)
{
LPVOID
lpBlock
=
DOSMEM_MapDosToLinear
(
block
);
if
(
DOSMEM_FreeBlock
(
0
,
lpBlock
)
)
if
(
DOSMEM_FreeBlock
(
lpBlock
)
)
GLOBAL_FreeBlock
(
sel
);
sel
=
0
;
}
...
...
msdos/dosmem.c
View file @
7b49914a
...
...
@@ -63,10 +63,10 @@ typedef struct {
*
* Gets the DOS memory base.
*/
char
*
DOSMEM_MemoryBase
(
HMODULE16
hModule
)
char
*
DOSMEM_MemoryBase
(
void
)
{
TDB
*
pTask
=
hModule
?
NULL
:
(
TDB
*
)
GlobalLock16
(
GetCurrentTask
()
);
NE_MODULE
*
pModule
=
(
hModule
||
pTask
)
?
NE_GetPtr
(
hModule
?
hModule
:
pTask
->
hModule
)
:
NULL
;
TDB
*
pTask
=
(
TDB
*
)
GlobalLock16
(
GetCurrentTask
()
);
NE_MODULE
*
pModule
=
pTask
?
NE_GetPtr
(
pTask
->
hModule
)
:
NULL
;
GlobalUnlock16
(
GetCurrentTask
()
);
if
(
pModule
&&
pModule
->
dos_image
)
...
...
@@ -80,9 +80,9 @@ char *DOSMEM_MemoryBase(HMODULE16 hModule)
*
* Gets the DOS memory top.
*/
static
char
*
DOSMEM_MemoryTop
(
HMODULE16
hModule
)
static
char
*
DOSMEM_MemoryTop
(
void
)
{
return
DOSMEM_MemoryBase
(
hModule
)
+
0x9FFFC
;
/* 640K */
return
DOSMEM_MemoryBase
()
+
0x9FFFC
;
/* 640K */
}
/***********************************************************************
...
...
@@ -90,9 +90,9 @@ static char *DOSMEM_MemoryTop(HMODULE16 hModule)
*
* Gets the DOS memory info block.
*/
static
dosmem_info
*
DOSMEM_InfoBlock
(
HMODULE16
hModule
)
static
dosmem_info
*
DOSMEM_InfoBlock
(
void
)
{
return
(
dosmem_info
*
)(
DOSMEM_MemoryBase
(
hModule
)
+
0x10000
);
/* 64K */
return
(
dosmem_info
*
)(
DOSMEM_MemoryBase
()
+
0x10000
);
/* 64K */
}
/***********************************************************************
...
...
@@ -100,10 +100,10 @@ static dosmem_info *DOSMEM_InfoBlock(HMODULE16 hModule)
*
* Gets the DOS memory root block.
*/
static
dosmem_entry
*
DOSMEM_RootBlock
(
HMODULE16
hModule
)
static
dosmem_entry
*
DOSMEM_RootBlock
(
void
)
{
/* first block has to be paragraph-aligned */
return
(
dosmem_entry
*
)(((
char
*
)
DOSMEM_InfoBlock
(
hModule
))
+
return
(
dosmem_entry
*
)(((
char
*
)
DOSMEM_InfoBlock
())
+
((((
sizeof
(
dosmem_info
)
+
0xf
)
&
~
0xf
)
-
sizeof
(
dosmem_entry
))));
}
...
...
@@ -119,9 +119,9 @@ static dosmem_entry *DOSMEM_RootBlock(HMODULE16 hModule)
* to hook interrupts, as well as use their familiar retf tricks to call
* them, AND let Wine handle any unhooked interrupts transparently.
*/
static
void
DOSMEM_FillIsrTable
(
HMODULE16
hModule
)
static
void
DOSMEM_FillIsrTable
(
void
)
{
SEGPTR
*
isr
=
(
SEGPTR
*
)
DOSMEM_MemoryBase
(
hModule
);
SEGPTR
*
isr
=
(
SEGPTR
*
)
DOSMEM_MemoryBase
();
DWORD
*
stub
=
(
DWORD
*
)((
char
*
)
isr
+
(
VM_STUB_SEGMENT
<<
4
));
int
x
;
...
...
@@ -141,19 +141,19 @@ static void DOSMEM_InitDPMI(void)
0xCD
,
0x31
,
/* int $0x31 */
0xCB
/* lret */
};
LPSTR
wrapper
=
(
LPSTR
)
DOSMEM_GetBlock
(
0
,
sizeof
(
wrap_code
),
&
DPMI_wrap_seg
);
LPSTR
wrapper
=
(
LPSTR
)
DOSMEM_GetBlock
(
sizeof
(
wrap_code
),
&
DPMI_wrap_seg
);
memcpy
(
wrapper
,
wrap_code
,
sizeof
(
wrap_code
));
}
BIOSDATA
*
DOSMEM_BiosData
()
{
return
(
BIOSDATA
*
)(
DOSMEM_MemoryBase
(
0
)
+
0x400
);
return
(
BIOSDATA
*
)(
DOSMEM_MemoryBase
()
+
0x400
);
}
BYTE
*
DOSMEM_BiosSys
()
{
return
DOSMEM_MemoryBase
(
0
)
+
0xf0000
;
return
DOSMEM_MemoryBase
()
+
0xf0000
;
}
struct
_DOS_LISTOFLISTS
*
DOSMEM_LOL
()
...
...
@@ -348,16 +348,16 @@ static void DOSMEM_InitErrorTable()
*
* Initialises the DOS memory structures.
*/
static
void
DOSMEM_InitMemory
(
HMODULE16
hModule
)
static
void
DOSMEM_InitMemory
(
void
)
{
/* Low 64Kb are reserved for DOS/BIOS so the useable area starts at
* 1000:0000 and ends at 9FFF:FFEF. */
dosmem_info
*
info_block
=
DOSMEM_InfoBlock
(
hModule
);
dosmem_entry
*
root_block
=
DOSMEM_RootBlock
(
hModule
);
dosmem_info
*
info_block
=
DOSMEM_InfoBlock
();
dosmem_entry
*
root_block
=
DOSMEM_RootBlock
();
dosmem_entry
*
dm
;
root_block
->
size
=
DOSMEM_MemoryTop
(
hModule
)
-
(((
char
*
)
root_block
)
+
sizeof
(
dosmem_entry
));
root_block
->
size
=
DOSMEM_MemoryTop
()
-
(((
char
*
)
root_block
)
+
sizeof
(
dosmem_entry
));
info_block
->
blocks
=
0
;
info_block
->
free
=
root_block
->
size
;
...
...
@@ -418,9 +418,9 @@ BOOL DOSMEM_Init(HMODULE16 hModule)
0x100
,
0
,
FALSE
,
FALSE
,
FALSE
,
NULL
);
DOSMEM_BiosSysSeg
=
GLOBAL_CreateBlock
(
GMEM_FIXED
,
DOSMEM_dosmem
+
0xf0000
,
0x10000
,
0
,
FALSE
,
FALSE
,
FALSE
,
NULL
);
DOSMEM_FillIsrTable
(
0
);
DOSMEM_FillIsrTable
();
DOSMEM_FillBiosSegments
();
DOSMEM_InitMemory
(
0
);
DOSMEM_InitMemory
();
DOSMEM_InitCollateTable
();
DOSMEM_InitErrorTable
();
DOSMEM_InitDPMI
();
...
...
@@ -432,7 +432,7 @@ BOOL DOSMEM_Init(HMODULE16 hModule)
DOSMEM_FillIsrTable(hModule);
DOSMEM_InitMemory(hModule);
#else
LPVOID
base
=
DOSMEM_MemoryBase
(
hModule
);
LPVOID
base
=
DOSMEM_MemoryBase
();
/* bootstrap the new V86 task with a copy of the "system" memory */
memcpy
(
base
,
DOSMEM_dosmem
,
0x100000
);
...
...
@@ -460,18 +460,18 @@ void DOSMEM_Tick( WORD timer )
*
* Carve a chunk of the DOS memory block (without selector).
*/
LPVOID
DOSMEM_GetBlock
(
HMODULE16
hModule
,
UINT
size
,
UINT16
*
pseg
)
LPVOID
DOSMEM_GetBlock
(
UINT
size
,
UINT16
*
pseg
)
{
UINT
blocksize
;
char
*
block
=
NULL
;
dosmem_info
*
info_block
=
DOSMEM_InfoBlock
(
hModule
);
dosmem_info
*
info_block
=
DOSMEM_InfoBlock
();
dosmem_entry
*
dm
;
#ifdef __DOSMEM_DEBUG_
dosmem_entry
*
prev
=
NULL
;
#endif
if
(
size
>
info_block
->
free
)
return
NULL
;
dm
=
DOSMEM_RootBlock
(
hModule
);
dm
=
DOSMEM_RootBlock
();
while
(
dm
&&
dm
->
size
!=
DM_BLOCK_TERMINAL
)
{
...
...
@@ -517,7 +517,7 @@ LPVOID DOSMEM_GetBlock(HMODULE16 hModule, UINT size, UINT16* pseg)
info_block
->
blocks
++
;
info_block
->
free
-=
dm
->
size
;
if
(
pseg
)
*
pseg
=
(
block
-
DOSMEM_MemoryBase
(
hModule
))
>>
4
;
if
(
pseg
)
*
pseg
=
(
block
-
DOSMEM_MemoryBase
())
>>
4
;
#ifdef __DOSMEM_DEBUG__
dm
->
size
|=
DM_BLOCK_DEBUG
;
#endif
...
...
@@ -533,13 +533,13 @@ LPVOID DOSMEM_GetBlock(HMODULE16 hModule, UINT size, UINT16* pseg)
/***********************************************************************
* DOSMEM_FreeBlock
*/
BOOL
DOSMEM_FreeBlock
(
HMODULE16
hModule
,
void
*
ptr
)
BOOL
DOSMEM_FreeBlock
(
void
*
ptr
)
{
dosmem_info
*
info_block
=
DOSMEM_InfoBlock
(
hModule
);
dosmem_info
*
info_block
=
DOSMEM_InfoBlock
();
if
(
ptr
>=
(
void
*
)(((
char
*
)
DOSMEM_RootBlock
(
hModule
))
+
sizeof
(
dosmem_entry
))
&&
ptr
<
(
void
*
)
DOSMEM_MemoryTop
(
hModule
)
&&
!
((((
char
*
)
ptr
)
-
DOSMEM_MemoryBase
(
hModule
))
&
0xf
)
)
if
(
ptr
>=
(
void
*
)(((
char
*
)
DOSMEM_RootBlock
())
+
sizeof
(
dosmem_entry
))
&&
ptr
<
(
void
*
)
DOSMEM_MemoryTop
()
&&
!
((((
char
*
)
ptr
)
-
DOSMEM_MemoryBase
())
&
0xf
)
)
{
dosmem_entry
*
dm
=
(
dosmem_entry
*
)(((
char
*
)
ptr
)
-
sizeof
(
dosmem_entry
));
...
...
@@ -562,18 +562,18 @@ BOOL DOSMEM_FreeBlock(HMODULE16 hModule, void* ptr)
/***********************************************************************
* DOSMEM_ResizeBlock
*/
LPVOID
DOSMEM_ResizeBlock
(
HMODULE16
hModule
,
void
*
ptr
,
UINT
size
,
UINT16
*
pseg
)
LPVOID
DOSMEM_ResizeBlock
(
void
*
ptr
,
UINT
size
,
UINT16
*
pseg
)
{
char
*
block
=
NULL
;
dosmem_info
*
info_block
=
DOSMEM_InfoBlock
(
hModule
);
dosmem_info
*
info_block
=
DOSMEM_InfoBlock
();
if
(
ptr
>=
(
void
*
)(((
char
*
)
DOSMEM_RootBlock
(
hModule
))
+
sizeof
(
dosmem_entry
))
&&
ptr
<
(
void
*
)
DOSMEM_MemoryTop
(
hModule
)
&&
!
((((
char
*
)
ptr
)
-
DOSMEM_MemoryBase
(
hModule
))
&
0xf
)
)
if
(
ptr
>=
(
void
*
)(((
char
*
)
DOSMEM_RootBlock
())
+
sizeof
(
dosmem_entry
))
&&
ptr
<
(
void
*
)
DOSMEM_MemoryTop
()
&&
!
((((
char
*
)
ptr
)
-
DOSMEM_MemoryBase
())
&
0xf
)
)
{
dosmem_entry
*
dm
=
(
dosmem_entry
*
)(((
char
*
)
ptr
)
-
sizeof
(
dosmem_entry
));
if
(
pseg
)
*
pseg
=
((
char
*
)
ptr
-
DOSMEM_MemoryBase
(
hModule
))
>>
4
;
if
(
pseg
)
*
pseg
=
((
char
*
)
ptr
-
DOSMEM_MemoryBase
())
>>
4
;
if
(
!
(
dm
->
size
&
(
DM_BLOCK_FREE
|
DM_BLOCK_TERMINAL
))
)
...
...
@@ -609,7 +609,7 @@ LPVOID DOSMEM_ResizeBlock(HMODULE16 hModule, void* ptr, UINT size, UINT16* pseg)
info_block
->
free
+=
orgsize
-
dm
->
size
;
}
else
{
/* the collapse didn't help, try getting a new block */
block
=
DOSMEM_GetBlock
(
hModule
,
size
,
pseg
);
block
=
DOSMEM_GetBlock
(
size
,
pseg
);
if
(
block
)
{
/* we got one, copy the old data there (we do need to, right?) */
memcpy
(
block
,
((
char
*
)
dm
)
+
sizeof
(
dosmem_entry
),
...
...
@@ -648,12 +648,12 @@ LPVOID DOSMEM_ResizeBlock(HMODULE16 hModule, void* ptr, UINT size, UINT16* pseg)
/***********************************************************************
* DOSMEM_Available
*/
UINT
DOSMEM_Available
(
HMODULE16
hModule
)
UINT
DOSMEM_Available
(
void
)
{
UINT
blocksize
,
available
=
0
;
dosmem_entry
*
dm
;
dm
=
DOSMEM_RootBlock
(
hModule
);
dm
=
DOSMEM_RootBlock
();
while
(
dm
&&
dm
->
size
!=
DM_BLOCK_TERMINAL
)
{
...
...
@@ -693,9 +693,9 @@ UINT DOSMEM_Available(HMODULE16 hModule)
*/
UINT
DOSMEM_MapLinearToDos
(
LPVOID
ptr
)
{
if
(((
char
*
)
ptr
>=
DOSMEM_MemoryBase
(
0
))
&&
((
char
*
)
ptr
<
DOSMEM_MemoryBase
(
0
)
+
0x100000
))
return
(
UINT
)
ptr
-
(
UINT
)
DOSMEM_MemoryBase
(
0
);
if
(((
char
*
)
ptr
>=
DOSMEM_MemoryBase
())
&&
((
char
*
)
ptr
<
DOSMEM_MemoryBase
()
+
0x100000
))
return
(
UINT
)
ptr
-
(
UINT
)
DOSMEM_MemoryBase
();
return
(
UINT
)
ptr
;
}
...
...
@@ -707,7 +707,7 @@ UINT DOSMEM_MapLinearToDos(LPVOID ptr)
*/
LPVOID
DOSMEM_MapDosToLinear
(
UINT
ptr
)
{
if
(
ptr
<
0x100000
)
return
(
LPVOID
)(
ptr
+
(
UINT
)
DOSMEM_MemoryBase
(
0
));
if
(
ptr
<
0x100000
)
return
(
LPVOID
)(
ptr
+
(
UINT
)
DOSMEM_MemoryBase
());
return
(
LPVOID
)
ptr
;
}
...
...
@@ -721,7 +721,7 @@ LPVOID DOSMEM_MapRealToLinear(DWORD x)
{
LPVOID
lin
;
lin
=
DOSMEM_MemoryBase
(
0
)
+
(
x
&
0xffff
)
+
(((
x
&
0xffff0000
)
>>
16
)
*
16
);
lin
=
DOSMEM_MemoryBase
()
+
(
x
&
0xffff
)
+
(((
x
&
0xffff0000
)
>>
16
)
*
16
);
TRACE_
(
selector
)(
"(0x%08lx) returns 0x%p.
\n
"
,
x
,
lin
);
return
lin
;
}
...
...
msdos/dpmi.c
View file @
7b49914a
...
...
@@ -260,7 +260,7 @@ static void DPMI_CallRMCBProc( CONTEXT86 *context, RMCB *rmcb, WORD flag )
DWORD
esp
,
edi
;
INT_SetRealModeContext
((
REALMODECALL
*
)
PTR_SEG_OFF_TO_LIN
(
rmcb
->
regs_sel
,
rmcb
->
regs_ofs
),
context
);
ss
=
SELECTOR_AllocBlock
(
DOSMEM_MemoryBase
(
0
)
+
(
DWORD
)(
SS_reg
(
context
)
<<
4
),
0x10000
,
SEGMENT_DATA
,
FALSE
,
FALSE
);
ss
=
SELECTOR_AllocBlock
(
DOSMEM_MemoryBase
()
+
(
DWORD
)(
SS_reg
(
context
)
<<
4
),
0x10000
,
SEGMENT_DATA
,
FALSE
,
FALSE
);
esp
=
ESP_reg
(
context
);
FIXME
(
"untested!
\n
"
);
...
...
@@ -369,7 +369,7 @@ callrmproc_again:
if
(
!
already
)
{
if
(
!
SS_reg
(
context
))
{
alloc
=
1
;
/* allocate default stack */
stack16
=
addr
=
DOSMEM_GetBlock
(
pModule
->
self
,
64
,
(
UINT16
*
)
&
(
SS_reg
(
context
))
);
stack16
=
addr
=
DOSMEM_GetBlock
(
64
,
(
UINT16
*
)
&
(
SS_reg
(
context
))
);
ESP_reg
(
context
)
=
64
-
2
;
stack16
+=
32
-
1
;
if
(
!
addr
)
{
...
...
@@ -415,7 +415,7 @@ callrmproc_again:
ERR
(
"cannot perform real-mode call
\n
"
);
#endif
}
if
(
alloc
)
DOSMEM_FreeBlock
(
pModule
->
self
,
addr
);
if
(
alloc
)
DOSMEM_FreeBlock
(
addr
);
return
0
;
}
...
...
@@ -487,7 +487,7 @@ static RMCB *DPMI_AllocRMCB( void )
if
(
NewRMCB
)
{
LPVOID
RMCBmem
=
DOSMEM_GetBlock
(
0
,
4
,
&
uParagraph
);
LPVOID
RMCBmem
=
DOSMEM_GetBlock
(
4
,
&
uParagraph
);
LPBYTE
p
=
RMCBmem
;
*
p
++
=
0xcd
;
/* RMCB: */
...
...
@@ -559,7 +559,7 @@ static int DPMI_FreeRMCB( DWORD address )
PrevRMCB
->
next
=
CurrRMCB
->
next
;
else
FirstRMCB
=
CurrRMCB
->
next
;
DOSMEM_FreeBlock
(
0
,
DOSMEM_MapRealToLinear
(
CurrRMCB
->
address
));
DOSMEM_FreeBlock
(
DOSMEM_MapRealToLinear
(
CurrRMCB
->
address
));
HeapFree
(
GetProcessHeap
(),
0
,
CurrRMCB
);
return
0
;
}
...
...
@@ -590,7 +590,7 @@ void WINAPI DPMI_FreeInternalRMCB( FARPROC16 proc )
static
void
StartPM
(
CONTEXT86
*
context
,
LPDOSTASK
lpDosTask
)
{
char
*
base
=
DOSMEM_MemoryBase
(
0
);
char
*
base
=
DOSMEM_MemoryBase
();
UINT16
cs
,
ss
,
ds
,
es
;
CONTEXT86
pm_ctx
;
DWORD
psp_ofs
=
(
DWORD
)(
lpDosTask
->
psp_seg
<<
4
);
...
...
@@ -851,7 +851,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
{
#ifdef MZ_SUPPORTED
if
(
lpDosTask
)
{
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
(
lpDosTask
->
hModule
);
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
();
dw
=
DOS_WINETOAPP
(
dw
,
base
);
}
#endif
...
...
@@ -867,7 +867,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
dw
=
W32S_APP2WINE
(
MAKELONG
(
DX_reg
(
context
),
CX_reg
(
context
)),
offset
);
#ifdef MZ_SUPPORTED
if
(
lpDosTask
)
{
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
(
lpDosTask
->
hModule
);
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
();
dw
=
DOS_APPTOWINE
(
dw
,
base
);
}
#endif
...
...
@@ -879,7 +879,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
dw
=
MAKELONG
(
DX_reg
(
context
),
CX_reg
(
context
)
);
#ifdef MZ_SUPPORTED
if
(
lpDosTask
)
{
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
(
lpDosTask
->
hModule
);
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
();
DWORD
sbase
=
GetSelectorBase
(
BX_reg
(
context
)
);
if
(
!
sbase
)
{
/* the app has set the limit without setting the base,
...
...
@@ -923,7 +923,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
LDT_GetEntry
(
SELECTOR_TO_ENTRY
(
BX_reg
(
context
)
),
&
entry
);
#ifdef MZ_SUPPORTED
if
(
lpDosTask
)
{
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
(
lpDosTask
->
hModule
);
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
();
entry
.
base
=
DOS_WINETOAPP
(
entry
.
base
,
base
);
}
#endif
...
...
@@ -944,7 +944,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
entry
.
base
=
W32S_APP2WINE
(
entry
.
base
,
offset
);
#ifdef MZ_SUPPORTED
if
(
lpDosTask
)
{
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
(
lpDosTask
->
hModule
);
DWORD
base
=
(
DWORD
)
DOSMEM_MemoryBase
();
entry
.
base
=
DOS_APPTOWINE
(
entry
.
base
,
base
);
if
(
DOS_BADLIMIT
(
entry
.
base
,
base
,
entry
.
limit
))
{
AX_reg
(
context
)
=
0x8021
;
/* invalid value */
...
...
@@ -971,7 +971,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
DX_reg
(
context
)
=
LOWORD
(
dw
);
}
else
{
AX_reg
(
context
)
=
0x0008
;
/* insufficient memory */
BX_reg
(
context
)
=
DOSMEM_Available
(
0
)
>>
4
;
BX_reg
(
context
)
=
DOSMEM_Available
()
>>
4
;
SET_CFLAG
(
context
);
}
break
;
...
...
msdos/int21.c
View file @
7b49914a
...
...
@@ -1763,7 +1763,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
LPVOID
*
mem
;
if
(
ISV86
(
context
))
{
mem
=
DOSMEM_GetBlock
(
0
,
(
DWORD
)
BX_reg
(
context
)
<<
4
,
NULL
);
mem
=
DOSMEM_GetBlock
((
DWORD
)
BX_reg
(
context
)
<<
4
,
NULL
);
if
(
mem
)
AX_reg
(
context
)
=
DOSMEM_MapLinearToDos
(
mem
)
>>
4
;
}
...
...
@@ -1777,7 +1777,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
{
SET_CFLAG
(
context
);
AX_reg
(
context
)
=
0x0008
;
/* insufficient memory */
BX_reg
(
context
)
=
DOSMEM_Available
(
0
)
>>
4
;
BX_reg
(
context
)
=
DOSMEM_Available
()
>>
4
;
}
}
break
;
...
...
@@ -1787,7 +1787,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
{
BOOL
ret
;
if
(
ISV86
(
context
))
ret
=
DOSMEM_FreeBlock
(
0
,
DOSMEM_MapDosToLinear
(
ES_reg
(
context
)
<<
4
));
ret
=
DOSMEM_FreeBlock
(
DOSMEM_MapDosToLinear
(
ES_reg
(
context
)
<<
4
));
else
{
ret
=
!
GlobalDOSFree16
(
ES_reg
(
context
));
...
...
@@ -1808,14 +1808,14 @@ void WINAPI DOS3Call( CONTEXT86 *context )
if
(
!
ISV86
(
context
))
FIXME
(
"RESIZE MEMORY probably insufficient implementation. Expect crash soon
\n
"
);
{
LPVOID
*
mem
=
DOSMEM_ResizeBlock
(
0
,
DOSMEM_MapDosToLinear
(
ES_reg
(
context
)
<<
4
),
BX_reg
(
context
)
<<
4
,
NULL
);
LPVOID
*
mem
=
DOSMEM_ResizeBlock
(
DOSMEM_MapDosToLinear
(
ES_reg
(
context
)
<<
4
),
BX_reg
(
context
)
<<
4
,
NULL
);
if
(
mem
)
AX_reg
(
context
)
=
DOSMEM_MapLinearToDos
(
mem
)
>>
4
;
else
{
SET_CFLAG
(
context
);
AX_reg
(
context
)
=
0x0008
;
/* insufficient memory */
BX_reg
(
context
)
=
DOSMEM_Available
(
0
)
>>
4
;
/* not quite right */
BX_reg
(
context
)
=
DOSMEM_Available
()
>>
4
;
/* not quite right */
}
}
break
;
...
...
msdos/interrupts.c
View file @
7b49914a
...
...
@@ -64,7 +64,7 @@ void INT_SetPMHandler( BYTE intnum, FARPROC16 handler )
*/
FARPROC16
INT_GetRMHandler
(
BYTE
intnum
)
{
return
((
FARPROC16
*
)
DOSMEM_MemoryBase
(
0
))[
intnum
];
return
((
FARPROC16
*
)
DOSMEM_MemoryBase
())[
intnum
];
}
...
...
@@ -77,7 +77,7 @@ void INT_SetRMHandler( BYTE intnum, FARPROC16 handler )
{
TRACE
(
"Set real mode interrupt vector %02x <- %04x:%04x
\n
"
,
intnum
,
HIWORD
(
handler
),
LOWORD
(
handler
)
);
((
FARPROC16
*
)
DOSMEM_MemoryBase
(
0
))[
intnum
]
=
handler
;
((
FARPROC16
*
)
DOSMEM_MemoryBase
())[
intnum
]
=
handler
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment