Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ekaterine Papava
wine
Commits
1591e01e
Commit
1591e01e
authored
1 year ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
wow64: Implement backend notification functions.
Co-authored-by:
Billy Laws
<
blaws05@gmail.com
>
parent
04ffca6e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dlls/wow64/process.c
+3
-0
3 additions, 0 deletions
dlls/wow64/process.c
dlls/wow64/syscall.c
+15
-0
15 additions, 0 deletions
dlls/wow64/syscall.c
dlls/wow64/virtual.c
+35
-14
35 additions, 14 deletions
dlls/wow64/virtual.c
dlls/wow64/wow64_private.h
+9
-1
9 additions, 1 deletion
dlls/wow64/wow64_private.h
with
62 additions
and
15 deletions
dlls/wow64/process.c
+
3
−
0
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
);
}
...
...
This diff is collapsed.
Click to expand it.
dlls/wow64/syscall.c
+
15
−
0
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
);
...
...
This diff is collapsed.
Click to expand it.
dlls/wow64/virtual.c
+
35
−
14
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
);
}
...
...
This diff is collapsed.
Click to expand it.
dlls/wow64/wow64_private.h
+
9
−
1
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
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment