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
d25e0399
Commit
d25e0399
authored
Oct 08, 2002
by
Jukka Heinonen
Committed by
Alexandre Julliard
Oct 08, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for interrupts in 32-bit code.
Remove some unnecessary code from 16-bit interrupt emulation.
parent
783bab61
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
8 deletions
+68
-8
miscemu.h
include/miscemu.h
+10
-0
instr.c
memory/instr.c
+11
-8
dosmem.c
msdos/dosmem.c
+15
-0
interrupts.c
msdos/interrupts.c
+32
-0
No files found.
include/miscemu.h
View file @
d25e0399
...
...
@@ -171,8 +171,16 @@ struct DPMI_segments
WORD
xms_seg
;
WORD
dpmi_seg
;
WORD
dpmi_sel
;
WORD
int48_seg
;
WORD
int48_sel
;
};
/* 48-bit segmented pointers for DOS DPMI32 */
typedef
struct
{
WORD
selector
;
DWORD
offset
;
}
SEGPTR48
,
FARPROC48
;
extern
struct
DPMI_segments
DOSMEM_dpmi_segments
;
extern
const
struct
DPMI_segments
*
DOSMEM_GetDPMISegments
(
void
);
...
...
@@ -194,6 +202,8 @@ extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context );
typedef
void
(
WINAPI
*
INTPROC
)(
CONTEXT86
*
);
extern
FARPROC16
INT_GetPMHandler
(
BYTE
intnum
);
extern
void
INT_SetPMHandler
(
BYTE
intnum
,
FARPROC16
handler
);
extern
FARPROC48
INT_GetPMHandler48
(
BYTE
intnum
);
extern
void
INT_SetPMHandler48
(
BYTE
intnum
,
FARPROC48
handler
);
/* msdos/ioports.c */
extern
DWORD
IO_inport
(
int
port
,
int
count
);
...
...
memory/instr.c
View file @
d25e0399
...
...
@@ -686,19 +686,22 @@ BOOL INSTR_EmulateInstruction( CONTEXT86 *context )
case
0xcd
:
/* int <XX> */
if
(
long_op
)
{
ERR
(
"int xx from 32-bit code is not supported.
\n
"
);
break
;
/* Unable to emulate it */
FARPROC48
addr
=
INT_GetPMHandler48
(
instr
[
1
]
);
DWORD
*
stack
=
get_stack
(
context
);
/* Push the flags and return address on the stack */
*
(
--
stack
)
=
context
->
EFlags
;
*
(
--
stack
)
=
context
->
SegCs
;
*
(
--
stack
)
=
context
->
Eip
+
prefixlen
+
2
;
add_stack
(
context
,
-
3
*
sizeof
(
DWORD
));
/* Jump to the interrupt handler */
context
->
SegCs
=
addr
.
selector
;
context
->
Eip
=
addr
.
offset
;
return
TRUE
;
}
else
{
FARPROC16
addr
=
INT_GetPMHandler
(
instr
[
1
]
);
WORD
*
stack
=
get_stack
(
context
);
if
(
!
addr
)
{
FIXME
(
"no handler for interrupt %02x, ignoring it
\n
"
,
instr
[
1
]);
context
->
Eip
+=
prefixlen
+
2
;
return
TRUE
;
}
/* Push the flags and return address on the stack */
*
(
--
stack
)
=
LOWORD
(
context
->
EFlags
);
*
(
--
stack
)
=
context
->
SegCs
;
...
...
msdos/dosmem.c
View file @
d25e0399
...
...
@@ -161,6 +161,7 @@ static void DOSMEM_MakeIsrStubs(void)
static
void
DOSMEM_InitDPMI
(
void
)
{
LPSTR
ptr
;
int
i
;
static
const
char
wrap_code
[]
=
{
0xCD
,
0x31
,
/* int $0x31 */
...
...
@@ -210,6 +211,20 @@ static void DOSMEM_InitDPMI(void)
ptr
=
DOSMEM_GetBlock
(
sizeof
(
enter_pm
),
&
DOSMEM_dpmi_segments
.
dpmi_seg
);
memcpy
(
ptr
,
enter_pm
,
sizeof
(
enter_pm
)
);
DOSMEM_dpmi_segments
.
dpmi_sel
=
SELECTOR_AllocBlock
(
ptr
,
sizeof
(
enter_pm
),
WINE_LDT_FLAGS_CODE
);
ptr
=
DOSMEM_GetBlock
(
4
*
256
,
&
DOSMEM_dpmi_segments
.
int48_seg
);
for
(
i
=
0
;
i
<
256
;
i
++
)
{
/*
* Each 32-bit interrupt handler is 4 bytes:
* 0xCD,<i> = int <i> (nested 16-bit interrupt)
* 0x66,0xCF = iretd (32-bit interrupt return)
*/
ptr
[
i
*
4
+
0
]
=
0xCD
;
ptr
[
i
*
4
+
1
]
=
i
;
ptr
[
i
*
4
+
2
]
=
0x66
;
ptr
[
i
*
4
+
3
]
=
0xCF
;
}
DOSMEM_dpmi_segments
.
int48_sel
=
SELECTOR_AllocBlock
(
ptr
,
4
*
256
,
WINE_LDT_FLAGS_CODE
);
}
static
BIOSDATA
*
DOSMEM_BiosData
(
void
)
...
...
msdos/interrupts.c
View file @
d25e0399
...
...
@@ -29,6 +29,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
int
);
static
FARPROC16
INT_Vectors
[
256
];
static
FARPROC48
INT_Vectors48
[
256
];
/* Ordinal number for interrupt 0 handler in WPROCS.DLL */
#define FIRST_INTERRUPT 100
...
...
@@ -77,6 +78,37 @@ void INT_SetPMHandler( BYTE intnum, FARPROC16 handler )
/**********************************************************************
* INT_GetPMHandler48
*
* Return the protected mode interrupt vector for a given interrupt.
* Used to get 48-bit pointer for 32-bit interrupt handlers in DPMI32.
*/
FARPROC48
INT_GetPMHandler48
(
BYTE
intnum
)
{
if
(
!
INT_Vectors48
[
intnum
].
selector
)
{
INT_Vectors48
[
intnum
].
selector
=
DOSMEM_dpmi_segments
.
int48_sel
;
INT_Vectors48
[
intnum
].
offset
=
4
*
intnum
;
}
return
INT_Vectors48
[
intnum
];
}
/**********************************************************************
* INT_SetPMHandler48
*
* Set the protected mode interrupt handler for a given interrupt.
* Used to set 48-bit pointer for 32-bit interrupt handlers in DPMI32.
*/
void
INT_SetPMHandler48
(
BYTE
intnum
,
FARPROC48
handler
)
{
TRACE
(
"Set 32-bit protected mode interrupt vector %02x <- %04x:%08x
\n
"
,
intnum
,
handler
.
selector
,
handler
.
offset
);
INT_Vectors48
[
intnum
]
=
handler
;
}
/**********************************************************************
* INT_DefaultHandler (WPROCS.356)
*
* Default interrupt 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