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
1591e01e
Commit
1591e01e
authored
Jul 10, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wow64: Implement backend notification functions.
Co-authored-by:
Billy Laws
<
blaws05@gmail.com
>
parent
04ffca6e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
15 deletions
+62
-15
process.c
dlls/wow64/process.c
+3
-0
syscall.c
dlls/wow64/syscall.c
+15
-0
virtual.c
dlls/wow64/virtual.c
+35
-14
wow64_private.h
dlls/wow64/wow64_private.h
+9
-1
No files found.
dlls/wow64/process.c
View file @
1591e01e
...
...
@@ -435,6 +435,9 @@ NTSTATUS WINAPI wow64_NtFlushInstructionCache( UINT *args )
const
void
*
addr
=
get_ptr
(
&
args
);
SIZE_T
size
=
get_ulong
(
&
args
);
if
(
pBTCpuNotifyFlushInstructionCache2
&&
RtlIsCurrentProcess
(
process
))
pBTCpuNotifyFlushInstructionCache2
(
addr
,
size
);
return
NtFlushInstructionCache
(
process
,
addr
,
size
);
}
...
...
dlls/wow64/syscall.c
View file @
1591e01e
...
...
@@ -100,6 +100,7 @@ static HMODULE win32u_module;
static
WOW64INFO
*
wow64info
;
/* cpu backend dll functions */
/* the function prototypes most likely differ from Windows */
static
void
*
(
WINAPI
*
pBTCpuGetBopCode
)(
void
);
static
NTSTATUS
(
WINAPI
*
pBTCpuGetContext
)(
HANDLE
,
HANDLE
,
void
*
,
void
*
);
static
BOOLEAN
(
WINAPI
*
pBTCpuIsProcessorFeaturePresent
)(
UINT
);
...
...
@@ -110,6 +111,13 @@ static void (WINAPI *pBTCpuSimulate)(void);
static
NTSTATUS
(
WINAPI
*
pBTCpuResetToConsistentState
)(
EXCEPTION_POINTERS
*
);
static
void
*
(
WINAPI
*
p__wine_get_unix_opcode
)(
void
);
static
void
*
(
WINAPI
*
pKiRaiseUserExceptionDispatcher
)(
void
);
void
(
WINAPI
*
pBTCpuNotifyFlushInstructionCache2
)(
const
void
*
,
SIZE_T
)
=
NULL
;
void
(
WINAPI
*
pBTCpuNotifyMapViewOfSection
)(
void
*
)
=
NULL
;
void
(
WINAPI
*
pBTCpuNotifyMemoryAlloc
)(
void
*
,
SIZE_T
,
ULONG
,
ULONG
)
=
NULL
;
void
(
WINAPI
*
pBTCpuNotifyMemoryDirty
)(
void
*
,
SIZE_T
)
=
NULL
;
void
(
WINAPI
*
pBTCpuNotifyMemoryFree
)(
void
*
,
SIZE_T
)
=
NULL
;
void
(
WINAPI
*
pBTCpuNotifyMemoryProtect
)(
void
*
,
SIZE_T
,
ULONG
)
=
NULL
;
void
(
WINAPI
*
pBTCpuNotifyUnmapViewOfSection
)(
void
*
)
=
NULL
;
void
(
WINAPI
*
pBTCpuUpdateProcessorInformation
)(
SYSTEM_CPU_INFORMATION
*
)
=
NULL
;
void
*
dummy
=
RtlUnwind
;
...
...
@@ -896,6 +904,13 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex
GET_PTR
(
BTCpuResetToConsistentState
);
GET_PTR
(
BTCpuSetContext
);
GET_PTR
(
BTCpuSimulate
);
GET_PTR
(
BTCpuNotifyFlushInstructionCache2
);
GET_PTR
(
BTCpuNotifyMapViewOfSection
);
GET_PTR
(
BTCpuNotifyMemoryAlloc
);
GET_PTR
(
BTCpuNotifyMemoryDirty
);
GET_PTR
(
BTCpuNotifyMemoryFree
);
GET_PTR
(
BTCpuNotifyMemoryProtect
);
GET_PTR
(
BTCpuNotifyUnmapViewOfSection
);
GET_PTR
(
BTCpuUpdateProcessorInformation
);
GET_PTR
(
__wine_get_unix_opcode
);
...
...
dlls/wow64/virtual.c
View file @
1591e01e
...
...
@@ -126,6 +126,8 @@ NTSTATUS WINAPI wow64_NtAllocateVirtualMemory( UINT *args )
size_32to64
(
&
size
,
size32
),
type
,
protect
);
if
(
!
status
)
{
if
(
pBTCpuNotifyMemoryAlloc
&&
RtlIsCurrentProcess
(
process
))
pBTCpuNotifyMemoryAlloc
(
addr
,
size
,
type
,
protect
);
put_addr
(
addr32
,
addr
);
put_size
(
size32
,
size
);
}
...
...
@@ -150,7 +152,8 @@ NTSTATUS WINAPI wow64_NtAllocateVirtualMemoryEx( UINT *args )
SIZE_T
size
;
NTSTATUS
status
;
MEM_EXTENDED_PARAMETER
*
params64
;
BOOL
set_limit
=
(
!*
addr32
&&
process
==
GetCurrentProcess
());
BOOL
is_current
=
RtlIsCurrentProcess
(
process
);
BOOL
set_limit
=
(
!*
addr32
&&
is_current
);
if
((
status
=
mem_extended_parameters_32to64
(
&
params64
,
params32
,
&
count
,
set_limit
)))
return
status
;
...
...
@@ -158,6 +161,7 @@ NTSTATUS WINAPI wow64_NtAllocateVirtualMemoryEx( UINT *args )
type
,
protect
,
params64
,
count
);
if
(
!
status
)
{
if
(
pBTCpuNotifyMemoryAlloc
&&
is_current
)
pBTCpuNotifyMemoryAlloc
(
addr
,
size
,
type
,
protect
);
put_addr
(
addr32
,
addr
);
put_size
(
size32
,
size
);
}
...
...
@@ -212,12 +216,14 @@ NTSTATUS WINAPI wow64_NtFreeVirtualMemory( UINT *args )
ULONG
*
size32
=
get_ptr
(
&
args
);
ULONG
type
=
get_ulong
(
&
args
);
void
*
addr
;
SIZE_T
size
;
void
*
addr
=
ULongToPtr
(
*
addr32
)
;
SIZE_T
size
=
*
size32
;
NTSTATUS
status
;
status
=
NtFreeVirtualMemory
(
process
,
addr_32to64
(
&
addr
,
addr32
),
size_32to64
(
&
size
,
size32
),
type
);
if
(
pBTCpuNotifyMemoryFree
&&
RtlIsCurrentProcess
(
process
))
pBTCpuNotifyMemoryFree
(
addr
,
size
);
status
=
NtFreeVirtualMemory
(
process
,
&
addr
,
&
size
,
type
);
if
(
!
status
)
{
put_addr
(
addr32
,
addr
);
...
...
@@ -353,9 +359,12 @@ NTSTATUS WINAPI wow64_NtMapViewOfSection( UINT *args )
{
SECTION_IMAGE_INFORMATION
info
;
if
(
!
NtQuerySection
(
handle
,
SectionImageInformation
,
&
info
,
sizeof
(
info
),
NULL
))
if
(
RtlIsCurrentProcess
(
process
)
&&
!
NtQuerySection
(
handle
,
SectionImageInformation
,
&
info
,
sizeof
(
info
),
NULL
)
&&
info
.
Machine
==
current_machine
)
{
if
(
info
.
Machine
==
current_machine
)
init_image_mapping
(
addr
);
if
(
pBTCpuNotifyMapViewOfSection
)
pBTCpuNotifyMapViewOfSection
(
addr
);
init_image_mapping
(
addr
);
}
put_addr
(
addr32
,
addr
);
put_size
(
size32
,
size
);
...
...
@@ -382,7 +391,8 @@ NTSTATUS WINAPI wow64_NtMapViewOfSectionEx( UINT *args )
SIZE_T
size
;
NTSTATUS
status
;
MEM_EXTENDED_PARAMETER
*
params64
;
BOOL
set_limit
=
(
!*
addr32
&&
process
==
GetCurrentProcess
());
BOOL
is_current
=
RtlIsCurrentProcess
(
process
);
BOOL
set_limit
=
(
!*
addr32
&&
is_current
);
if
((
status
=
mem_extended_parameters_32to64
(
&
params64
,
params32
,
&
count
,
set_limit
)))
return
status
;
...
...
@@ -392,9 +402,12 @@ NTSTATUS WINAPI wow64_NtMapViewOfSectionEx( UINT *args )
{
SECTION_IMAGE_INFORMATION
info
;
if
(
!
NtQuerySection
(
handle
,
SectionImageInformation
,
&
info
,
sizeof
(
info
),
NULL
))
if
(
is_current
&&
!
NtQuerySection
(
handle
,
SectionImageInformation
,
&
info
,
sizeof
(
info
),
NULL
)
&&
info
.
Machine
==
current_machine
)
{
if
(
info
.
Machine
==
current_machine
)
init_image_mapping
(
addr
);
if
(
pBTCpuNotifyMapViewOfSection
)
pBTCpuNotifyMapViewOfSection
(
addr
);
init_image_mapping
(
addr
);
}
put_addr
(
addr32
,
addr
);
put_size
(
size32
,
size
);
...
...
@@ -413,12 +426,14 @@ NTSTATUS WINAPI wow64_NtProtectVirtualMemory( UINT *args )
ULONG
new_prot
=
get_ulong
(
&
args
);
ULONG
*
old_prot
=
get_ptr
(
&
args
);
void
*
addr
;
SIZE_T
size
;
void
*
addr
=
ULongToPtr
(
*
addr32
)
;
SIZE_T
size
=
*
size32
;
NTSTATUS
status
;
status
=
NtProtectVirtualMemory
(
process
,
addr_32to64
(
&
addr
,
addr32
),
size_32to64
(
&
size
,
size32
),
new_prot
,
old_prot
);
if
(
pBTCpuNotifyMemoryProtect
&&
RtlIsCurrentProcess
(
process
))
pBTCpuNotifyMemoryProtect
(
addr
,
size
,
new_prot
);
status
=
NtProtectVirtualMemory
(
process
,
&
addr
,
&
size
,
new_prot
,
old_prot
);
if
(
!
status
)
{
put_addr
(
addr32
,
addr
);
...
...
@@ -686,6 +701,9 @@ NTSTATUS WINAPI wow64_NtUnmapViewOfSection( UINT *args )
HANDLE
process
=
get_handle
(
&
args
);
void
*
addr
=
get_ptr
(
&
args
);
if
(
pBTCpuNotifyUnmapViewOfSection
&&
RtlIsCurrentProcess
(
process
))
pBTCpuNotifyUnmapViewOfSection
(
addr
);
return
NtUnmapViewOfSection
(
process
,
addr
);
}
...
...
@@ -699,6 +717,9 @@ NTSTATUS WINAPI wow64_NtUnmapViewOfSectionEx( UINT *args )
void
*
addr
=
get_ptr
(
&
args
);
ULONG
flags
=
get_ulong
(
&
args
);
if
(
pBTCpuNotifyUnmapViewOfSection
&&
RtlIsCurrentProcess
(
process
))
pBTCpuNotifyUnmapViewOfSection
(
addr
);
return
NtUnmapViewOfSectionEx
(
process
,
addr
,
flags
);
}
...
...
dlls/wow64/wow64_private.h
View file @
1591e01e
...
...
@@ -38,7 +38,15 @@ extern ULONG_PTR args_alignment DECLSPEC_HIDDEN;
extern
ULONG_PTR
highest_user_address
DECLSPEC_HIDDEN
;
extern
ULONG_PTR
default_zero_bits
DECLSPEC_HIDDEN
;
extern
SYSTEM_DLL_INIT_BLOCK
*
pLdrSystemDllInitBlock
DECLSPEC_HIDDEN
;
extern
void
(
WINAPI
*
pBTCpuUpdateProcessorInformation
)(
SYSTEM_CPU_INFORMATION
*
)
DECLSPEC_HIDDEN
;
extern
void
(
WINAPI
*
pBTCpuNotifyFlushInstructionCache2
)(
const
void
*
,
SIZE_T
);
extern
void
(
WINAPI
*
pBTCpuNotifyMapViewOfSection
)(
void
*
);
extern
void
(
WINAPI
*
pBTCpuNotifyMemoryAlloc
)(
void
*
,
SIZE_T
,
ULONG
,
ULONG
);
extern
void
(
WINAPI
*
pBTCpuNotifyMemoryDirty
)(
void
*
,
SIZE_T
);
extern
void
(
WINAPI
*
pBTCpuNotifyMemoryFree
)(
void
*
,
SIZE_T
);
extern
void
(
WINAPI
*
pBTCpuNotifyMemoryProtect
)(
void
*
,
SIZE_T
,
ULONG
);
extern
void
(
WINAPI
*
pBTCpuNotifyUnmapViewOfSection
)(
void
*
);
extern
void
(
WINAPI
*
pBTCpuUpdateProcessorInformation
)(
SYSTEM_CPU_INFORMATION
*
);
struct
object_attr64
{
...
...
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