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
0cbb5d0a
Commit
0cbb5d0a
authored
Mar 01, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe: Add a helper function for accessing registers.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
81e698da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
instr.c
dlls/ntoskrnl.exe/instr.c
+20
-16
No files found.
dlls/ntoskrnl.exe/instr.c
View file @
0cbb5d0a
...
...
@@ -117,12 +117,29 @@ static void store_reg_byte( CONTEXT *context, BYTE regmodrm, const BYTE *addr )
}
}
static
DWORD
*
get_reg_address
(
CONTEXT
*
context
,
BYTE
rm
)
{
switch
(
rm
&
7
)
{
case
0
:
return
&
context
->
Eax
;
case
1
:
return
&
context
->
Ecx
;
case
2
:
return
&
context
->
Edx
;
case
3
:
return
&
context
->
Ebx
;
case
4
:
return
&
context
->
Esp
;
case
5
:
return
&
context
->
Ebp
;
case
6
:
return
&
context
->
Esi
;
case
7
:
return
&
context
->
Edi
;
}
return
NULL
;
}
/***********************************************************************
* INSTR_GetOperandAddr
*
* Return the address of an instruction operand (from the mod/rm byte).
*/
static
BYTE
*
INSTR_GetOperandAddr
(
CONTEXT
*
context
,
BYTE
*
instr
,
static
void
*
INSTR_GetOperandAddr
(
CONTEXT
*
context
,
BYTE
*
instr
,
int
long_addr
,
int
segprefix
,
int
*
len
)
{
int
mod
,
rm
,
base
=
0
,
index
=
0
,
ss
=
0
,
off
;
...
...
@@ -135,20 +152,7 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr,
rm
=
mod
&
7
;
mod
>>=
6
;
if
(
mod
==
3
)
{
switch
(
rm
)
{
case
0
:
return
(
BYTE
*
)
&
context
->
Eax
;
case
1
:
return
(
BYTE
*
)
&
context
->
Ecx
;
case
2
:
return
(
BYTE
*
)
&
context
->
Edx
;
case
3
:
return
(
BYTE
*
)
&
context
->
Ebx
;
case
4
:
return
(
BYTE
*
)
&
context
->
Esp
;
case
5
:
return
(
BYTE
*
)
&
context
->
Ebp
;
case
6
:
return
(
BYTE
*
)
&
context
->
Esi
;
case
7
:
return
(
BYTE
*
)
&
context
->
Edi
;
}
}
if
(
mod
==
3
)
return
get_reg_address
(
context
,
rm
);
if
(
long_addr
)
{
...
...
@@ -254,7 +258,7 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr,
base
&=
0xffff
;
}
/* FIXME: we assume that all segments have a base of 0 */
return
(
BYTE
*
)(
base
+
(
index
<<
ss
));
return
(
void
*
)(
base
+
(
index
<<
ss
));
#undef GET_VAL
}
...
...
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