Rebase against ab94abb14f74fe863ae40dafc7a8301db22792fc.

This commit is contained in:
Alistair Leslie-Hughes 2020-08-22 09:32:28 +10:00
parent 4242749b5b
commit 663c3ba497
5 changed files with 180 additions and 14 deletions

View File

@ -0,0 +1,162 @@
From 95aeebee8fa45177e8b721aca8528d7b89c19054 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 4 Feb 2017 16:20:37 +0100
Subject: [PATCH] kernel32: Implement some processor group functions.
---
...pi-ms-win-core-kernel32-legacy-l1-1-0.spec | 2 +-
...pi-ms-win-core-kernel32-legacy-l1-1-1.spec | 2 +-
dlls/kernel32/kernel32.spec | 2 +-
dlls/kernel32/process.c | 26 ++++++++++++++++---
dlls/kernel32/tests/process.c | 23 ++++++++++++++++
5 files changed, 48 insertions(+), 7 deletions(-)
diff --git a/dlls/api-ms-win-core-kernel32-legacy-l1-1-0/api-ms-win-core-kernel32-legacy-l1-1-0.spec b/dlls/api-ms-win-core-kernel32-legacy-l1-1-0/api-ms-win-core-kernel32-legacy-l1-1-0.spec
index e653ac6d212..b6af37ab0aa 100644
--- a/dlls/api-ms-win-core-kernel32-legacy-l1-1-0/api-ms-win-core-kernel32-legacy-l1-1-0.spec
+++ b/dlls/api-ms-win-core-kernel32-legacy-l1-1-0/api-ms-win-core-kernel32-legacy-l1-1-0.spec
@@ -21,7 +21,7 @@
@ stdcall GetComputerNameW(ptr ptr) kernel32.GetComputerNameW
@ stdcall GetConsoleWindow() kernel32.GetConsoleWindow
@ stub GetDurationFormatEx
-@ stub GetMaximumProcessorGroupCount
+@ stdcall GetMaximumProcessorGroupCount() kernel32.GetMaximumProcessorGroupCount
@ stdcall GetNamedPipeClientProcessId(long ptr) kernel32.GetNamedPipeClientProcessId
@ stdcall GetNamedPipeServerProcessId(long ptr) kernel32.GetNamedPipeServerProcessId
@ stdcall GetShortPathNameA(str ptr long) kernel32.GetShortPathNameA
diff --git a/dlls/api-ms-win-core-kernel32-legacy-l1-1-1/api-ms-win-core-kernel32-legacy-l1-1-1.spec b/dlls/api-ms-win-core-kernel32-legacy-l1-1-1/api-ms-win-core-kernel32-legacy-l1-1-1.spec
index 4998af04d9b..5ce8e24713b 100644
--- a/dlls/api-ms-win-core-kernel32-legacy-l1-1-1/api-ms-win-core-kernel32-legacy-l1-1-1.spec
+++ b/dlls/api-ms-win-core-kernel32-legacy-l1-1-1/api-ms-win-core-kernel32-legacy-l1-1-1.spec
@@ -26,7 +26,7 @@
@ stub GetDurationFormatEx
@ stub GetFileAttributesTransactedW
@ stub GetFirmwareType
-@ stub GetMaximumProcessorGroupCount
+@ stdcall GetMaximumProcessorGroupCount() kernel32.GetMaximumProcessorGroupCount
@ stdcall GetNamedPipeClientProcessId(long ptr) kernel32.GetNamedPipeClientProcessId
@ stdcall GetNamedPipeServerProcessId(long ptr) kernel32.GetNamedPipeServerProcessId
@ stdcall GetNumaAvailableMemoryNodeEx(long ptr) kernel32.GetNumaAvailableMemoryNodeEx
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 5671ae7e93d..188c62636e6 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -719,7 +719,7 @@
@ stdcall -import GetLongPathNameW(wstr ptr long)
@ stdcall GetMailslotInfo(long ptr ptr ptr ptr)
@ stdcall GetMaximumProcessorCount(long)
-# @ stub GetMaximumProcessorGroupCount
+@ stdcall GetMaximumProcessorGroupCount()
@ stdcall -import GetModuleFileNameA(long ptr long)
@ stdcall -import GetModuleFileNameW(long ptr long)
@ stdcall -import GetModuleHandleA(str)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 0cf45faf0f3..afed492873c 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -726,7 +726,9 @@ HRESULT WINAPI RegisterApplicationRecoveryCallback(APPLICATION_RECOVERY_CALLBACK
*/
WORD WINAPI GetActiveProcessorGroupCount(void)
{
- FIXME("semi-stub, always returning 1\n");
+ TRACE("()\n");
+
+ /* systems with less than 64 logical processors only have group 0 */
return 1;
}
@@ -735,10 +737,14 @@ WORD WINAPI GetActiveProcessorGroupCount(void)
*/
DWORD WINAPI GetActiveProcessorCount(WORD group)
{
- DWORD cpus = system_info.NumberOfProcessors;
+ TRACE("(%u)\n", group);
- FIXME("semi-stub, returning %u\n", cpus);
- return cpus;
+ if (group && group != ALL_PROCESSOR_GROUPS)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+ return system_info.NumberOfProcessors;
}
/***********************************************************************
@@ -752,6 +758,18 @@ DWORD WINAPI GetMaximumProcessorCount(WORD group)
return cpus;
}
+/***********************************************************************
+ * GetMaximumProcessorGroupCount (KERNEL32.@)
+ */
+WORD WINAPI GetMaximumProcessorGroupCount(void)
+{
+ TRACE("()\n");
+
+ /* systems with less than 64 logical processors only have group 0 */
+ return 1;
+}
+
+
/***********************************************************************
* GetFirmwareEnvironmentVariableA (KERNEL32.@)
*/
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index 5bd7b71d63e..58ccbfbdacc 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -93,6 +93,7 @@ static SIZE_T (WINAPI *pGetLargePageMinimum)(void);
static BOOL (WINAPI *pInitializeProcThreadAttributeList)(struct _PROC_THREAD_ATTRIBUTE_LIST*, DWORD, DWORD, SIZE_T*);
static BOOL (WINAPI *pUpdateProcThreadAttribute)(struct _PROC_THREAD_ATTRIBUTE_LIST*, DWORD, DWORD_PTR, void *,SIZE_T,void*,SIZE_T*);
static void (WINAPI *pDeleteProcThreadAttributeList)(struct _PROC_THREAD_ATTRIBUTE_LIST*);
+static DWORD (WINAPI *pGetActiveProcessorCount)(WORD);
/* ############################### */
static char base[MAX_PATH];
@@ -276,6 +277,7 @@ static BOOL init(void)
pInitializeProcThreadAttributeList = (void *)GetProcAddress(hkernel32, "InitializeProcThreadAttributeList");
pUpdateProcThreadAttribute = (void *)GetProcAddress(hkernel32, "UpdateProcThreadAttribute");
pDeleteProcThreadAttributeList = (void *)GetProcAddress(hkernel32, "DeleteProcThreadAttributeList");
+ pGetActiveProcessorCount = (void *)GetProcAddress(hkernel32, "GetActiveProcessorCount");
return TRUE;
}
@@ -4185,6 +4187,26 @@ void test_parent_process_attribute(unsigned int level, HANDLE read_pipe)
}
}
+static void test_GetActiveProcessorCount(void)
+{
+ DWORD count;
+
+ if (!pGetActiveProcessorCount)
+ {
+ win_skip("GetActiveProcessorCount not available, skipping test\n");
+ return;
+ }
+
+ count = pGetActiveProcessorCount(0);
+ ok(count, "GetActiveProcessorCount failed, error %u\n", GetLastError());
+
+ /* Test would fail on systems with more than 6400 processors */
+ SetLastError(0xdeadbeef);
+ count = pGetActiveProcessorCount(101);
+ ok(count == 0, "Expeced GetActiveProcessorCount to fail\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+}
+
START_TEST(process)
{
HANDLE job;
@@ -4296,6 +4318,7 @@ START_TEST(process)
test_GetNumaProcessorNode();
test_session_info();
test_GetLogicalProcessorInformationEx();
+ test_GetActiveProcessorCount();
test_largepages();
test_ProcThreadAttributeList();
test_SuspendProcessState();
--
2.28.0

View File

@ -1,4 +1,4 @@
From 4b73ac9cedc1531c6ae441c38d0bad37ed29c13f Mon Sep 17 00:00:00 2001
From a35e75bfe3a6358885e756396c8597d7b60be6e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 19 Mar 2017 19:08:34 +0100
Subject: [PATCH] ntdll: Catch windows int 0x2e syscall on i386.
@ -8,12 +8,12 @@ Subject: [PATCH] ntdll: Catch windows int 0x2e syscall on i386.
1 file changed, 5 insertions(+)
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c
index 19ba551773a..e30dbf9398e 100644
index 60a47d53ba8..5cc92ab0ced 100644
--- a/dlls/ntdll/unix/signal_i386.c
+++ b/dlls/ntdll/unix/signal_i386.c
@@ -1584,6 +1584,11 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, vo
@@ -1749,6 +1749,11 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, vo
rec->ExceptionInformation[2] = context->Edx;
setup_raise_exception( sigcontext, stack, rec, context );
setup_raise_exception( sigcontext, stack, rec, xcontext );
return TRUE;
+ case 0x2e:
+ FIXME("unimplemented syscall handler for %#x\n", context->Eax);
@ -24,5 +24,5 @@ index 19ba551773a..e30dbf9398e 100644
return FALSE;
}
--
2.27.0
2.28.0

View File

@ -1,4 +1,4 @@
From 3c08a3d54b19ceb7daff2e033be76115ea013cd9 Mon Sep 17 00:00:00 2001
From 9749f5941c2bc14e4b94dc0ca2cabf25c781d675 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 24 Apr 2020 14:55:15 -0500
Subject: [PATCH] ntdll: Support WRITECOPY on x64.
@ -10,13 +10,13 @@ Signed-off-by: Andrew Wesie <awesie@gmail.com>
2 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 4342ab023775..4984d5bdad72 100644
index 870c0c7e258..e30f7c67ce5 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -2040,6 +2040,30 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, EXCEPTION_RECORD *r
@@ -2204,6 +2204,30 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, EXCEPTION_RECORD *r
return TRUE;
}
+/**********************************************************************
+ * segv_handler_early
+ *
@ -44,7 +44,7 @@ index 4342ab023775..4984d5bdad72 100644
/**********************************************************************
* segv_handler
*
@@ -2414,6 +2438,23 @@ void signal_init_process(void)
@@ -2578,6 +2602,23 @@ void signal_init_process(void)
*/
void signal_init_early(void)
{
@ -69,7 +69,7 @@ index 4342ab023775..4984d5bdad72 100644
/***********************************************************************
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 98c5aad578c6..16cfa8bda2d7 100644
index 5ab87f1aa81..e708f3c44b0 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -818,7 +818,7 @@ static int get_unix_prot( BYTE vprot )
@ -82,5 +82,5 @@ index 98c5aad578c6..16cfa8bda2d7 100644
{
if (experimental_WRITECOPY() && !(vprot & VPROT_WRITTEN))
--
2.20.1
2.28.0

View File

@ -3058,11 +3058,15 @@ fi
# | * api-ms-win-Stub_DLLs
# |
# | Modified files:
# | * dlls/kernelbase/thread.c
# | * dlls/api-ms-win-core-kernel32-legacy-l1-1-0/api-ms-win-core-kernel32-legacy-l1-1-0.spec, dlls/api-ms-win-core-
# | kernel32-legacy-l1-1-1/api-ms-win-core-kernel32-legacy-l1-1-1.spec, dlls/kernel32/kernel32.spec,
# | dlls/kernel32/process.c, dlls/kernel32/tests/process.c, dlls/kernelbase/thread.c
# |
if test "$enable_kernel32_Processor_Group" -eq 1; then
patch_apply kernel32-Processor_Group/0001-kernel32-Implement-some-processor-group-functions.patch
patch_apply kernel32-Processor_Group/0002-kernel32-Add-stub-for-SetThreadIdealProcessorEx.patch
(
printf '%s\n' '+ { "Michael Müller", "kernel32: Implement some processor group functions.", 1 },';
printf '%s\n' '+ { "Michael Müller", "kernel32: Add stub for SetThreadIdealProcessorEx.", 1 },';
) >> "$patchlist"
fi

View File

@ -1 +1 @@
13ea90d80f7275e1ad4f3fc3c1c75b68bdbefbb4
ab94abb14f74fe863ae40dafc7a8301db22792fc