Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
faf70e2f
Commit
faf70e2f
authored
Jan 21, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Fix calculation of process and thread affinity masks on systems with a…
ntdll: Fix calculation of process and thread affinity masks on systems with a large number of processors.
parent
b51476ad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
7 deletions
+19
-7
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-0
process.c
dlls/ntdll/process.c
+14
-3
thread.c
dlls/ntdll/thread.c
+3
-3
virtual.c
dlls/ntdll/virtual.c
+1
-1
No files found.
dlls/ntdll/ntdll_misc.h
View file @
faf70e2f
...
...
@@ -46,6 +46,7 @@ struct drive_info
};
extern
NTSTATUS
close_handle
(
HANDLE
)
DECLSPEC_HIDDEN
;
extern
ULONG_PTR
get_system_affinity_mask
(
void
)
DECLSPEC_HIDDEN
;
/* exceptions */
extern
void
wait_suspend
(
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/process.c
View file @
faf70e2f
...
...
@@ -98,6 +98,13 @@ static UINT process_error_mode;
ret = STATUS_INVALID_INFO_CLASS; \
break
ULONG_PTR
get_system_affinity_mask
(
void
)
{
ULONG
num_cpus
=
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
;
if
(
num_cpus
>=
sizeof
(
ULONG_PTR
)
*
8
)
return
~
(
ULONG_PTR
)
0
;
return
((
ULONG_PTR
)
1
<<
num_cpus
)
-
1
;
}
/******************************************************************************
* NtQueryInformationProcess [NTDLL.@]
* ZwQueryInformationProcess [NTDLL.@]
...
...
@@ -145,7 +152,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
case
ProcessBasicInformation
:
{
PROCESS_BASIC_INFORMATION
pbi
;
const
ULONG_PTR
affinity_mask
=
((
ULONG_PTR
)
1
<<
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
)
-
1
;
const
ULONG_PTR
affinity_mask
=
get_system_affinity_mask
()
;
if
(
ProcessInformationLength
>=
sizeof
(
PROCESS_BASIC_INFORMATION
))
{
...
...
@@ -389,7 +396,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
len
=
sizeof
(
ULONG_PTR
);
if
(
ProcessInformationLength
==
len
)
{
const
ULONG_PTR
system_mask
=
((
ULONG_PTR
)
1
<<
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
)
-
1
;
const
ULONG_PTR
system_mask
=
get_system_affinity_mask
()
;
SERVER_START_REQ
(
get_process_info
)
{
...
...
@@ -487,8 +494,11 @@ NTSTATUS WINAPI NtSetInformationProcess(
process_error_mode
=
*
(
UINT
*
)
ProcessInformation
;
break
;
case
ProcessAffinityMask
:
{
const
ULONG_PTR
system_mask
=
get_system_affinity_mask
();
if
(
ProcessInformationLength
!=
sizeof
(
DWORD_PTR
))
return
STATUS_INVALID_PARAMETER
;
if
(
*
(
PDWORD_PTR
)
ProcessInformation
&
~
(((
DWORD_PTR
)
1
<<
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
)
-
1
)
)
if
(
*
(
PDWORD_PTR
)
ProcessInformation
&
~
system_mask
)
return
STATUS_INVALID_PARAMETER
;
if
(
!*
(
PDWORD_PTR
)
ProcessInformation
)
return
STATUS_INVALID_PARAMETER
;
...
...
@@ -501,6 +511,7 @@ NTSTATUS WINAPI NtSetInformationProcess(
}
SERVER_END_REQ
;
break
;
}
case
ProcessPriorityClass
:
if
(
ProcessInformationLength
!=
sizeof
(
PROCESS_PRIORITY_CLASS
))
return
STATUS_INVALID_PARAMETER
;
...
...
dlls/ntdll/thread.c
View file @
faf70e2f
...
...
@@ -900,7 +900,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
case
ThreadBasicInformation
:
{
THREAD_BASIC_INFORMATION
info
;
const
ULONG_PTR
affinity_mask
=
((
ULONG_PTR
)
1
<<
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
)
-
1
;
const
ULONG_PTR
affinity_mask
=
get_system_affinity_mask
()
;
SERVER_START_REQ
(
get_thread_info
)
{
...
...
@@ -927,7 +927,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
return
status
;
case
ThreadAffinityMask
:
{
const
ULONG_PTR
affinity_mask
=
((
ULONG_PTR
)
1
<<
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
)
-
1
;
const
ULONG_PTR
affinity_mask
=
get_system_affinity_mask
()
;
ULONG_PTR
affinity
=
0
;
SERVER_START_REQ
(
get_thread_info
)
...
...
@@ -1170,7 +1170,7 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
return
status
;
case
ThreadAffinityMask
:
{
const
ULONG_PTR
affinity_mask
=
((
ULONG_PTR
)
1
<<
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
)
-
1
;
const
ULONG_PTR
affinity_mask
=
get_system_affinity_mask
()
;
ULONG_PTR
req_aff
;
if
(
length
!=
sizeof
(
ULONG_PTR
))
return
STATUS_INVALID_PARAMETER
;
...
...
dlls/ntdll/virtual.c
View file @
faf70e2f
...
...
@@ -1409,7 +1409,7 @@ void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
info
->
AllocationGranularity
=
get_mask
(
0
)
+
1
;
info
->
LowestUserAddress
=
(
void
*
)
0x10000
;
info
->
HighestUserAddress
=
(
char
*
)
user_space_limit
-
1
;
info
->
ActiveProcessorsAffinityMask
=
(
1
<<
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
)
-
1
;
info
->
ActiveProcessorsAffinityMask
=
get_system_affinity_mask
()
;
info
->
NumberOfProcessors
=
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
;
}
...
...
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