Rebase against 26b26a2e0efcb776e7b0115f15580d2507b10400.

This commit is contained in:
Zebediah Figura 2020-05-12 18:03:01 -05:00
parent 3e3661298c
commit d58990f6ac
11 changed files with 87 additions and 610 deletions

View File

@ -6,7 +6,6 @@ Depends: ntdll-SystemRoot_Symlink
Depends: ws2_32-WSACleanup
Depends: ntdll-RtlCreateUserThread
Depends: server-Realtime_Priority
Depends: ntdll-User_Shared_Data
Depends: advapi32-Token_Integrity_Level
Depends: ntdll-Junction_Points
Depends: kernel32-K32GetPerformanceInfo

View File

@ -1,4 +1,4 @@
From 97f429aab4d3763b2b41f4badbacb5421caf0f75 Mon Sep 17 00:00:00 2001
From a100b0b789c767230ef98eb2201e5ae5a272e907 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 28 May 2017 10:30:43 +0200
Subject: [PATCH] ntdll/tests: Add tests for
@ -9,19 +9,19 @@ Subject: [PATCH] ntdll/tests: Add tests for
1 file changed, 35 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 5f27d8b..7b470cd 100644
index 7a641f8b84e..e335e758175 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -1928,6 +1928,8 @@ static void test_queryvirtualmemory(void)
MEMORY_BASIC_INFORMATION mbi;
@@ -2182,6 +2182,8 @@ static void test_queryvirtualmemory(void)
char stackbuf[42];
HMODULE module;
void *user_shared_data = (void *)0x7ffe0000;
+ char buffer_name[sizeof(MEMORY_SECTION_NAME) + MAX_PATH * sizeof(WCHAR)];
+ MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
module = GetModuleHandleA( "ntdll.dll" );
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
@@ -2008,6 +2010,39 @@ static void test_queryvirtualmemory(void)
@@ -2274,6 +2276,39 @@ static void test_queryvirtualmemory(void)
/* check error code when len is less than MEMORY_BASIC_INFORMATION size */
status = pNtQueryVirtualMemory(NtCurrentProcess(), GetProcessHeap(), MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION) - 1, &readcount);
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
@ -62,5 +62,5 @@ index 5f27d8b..7b470cd 100644
static void test_affinity(void)
--
1.9.1
2.26.2

View File

@ -1,14 +1,14 @@
From 0d410dfc4dea7a5f7422d4c066c2f1d66d7d7f7c Mon Sep 17 00:00:00 2001
From e088b03ac3d6419ba2c6b825b5b14de8527acbe4 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 May 2017 10:33:40 +0200
Subject: ntdll/tests: Add test to ensure section name is full path.
Subject: [PATCH] ntdll/tests: Add test to ensure section name is full path.
---
dlls/ntdll/tests/info.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 4ad639ca81..44d1213b98 100644
index e335e758175..66c5e81830d 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -22,6 +22,7 @@
@ -27,7 +27,7 @@ index 4ad639ca81..44d1213b98 100644
NTDLL_GET_PROC(NtQuerySystemInformation);
NTDLL_GET_PROC(RtlGetNativeSystemInformation);
NTDLL_GET_PROC(NtPowerInformation);
@@ -2120,6 +2122,7 @@ static void test_queryvirtualmemory(void)
@@ -2175,6 +2177,7 @@ static void test_queryvirtualmemory(void)
{
NTSTATUS status;
SIZE_T readcount;
@ -35,8 +35,8 @@ index 4ad639ca81..44d1213b98 100644
static const char teststring[] = "test string";
static char datatestbuf[42] = "abc";
static char rwtestbuf[42];
@@ -2128,6 +2131,8 @@ static void test_queryvirtualmemory(void)
HMODULE module;
@@ -2184,6 +2187,8 @@ static void test_queryvirtualmemory(void)
void *user_shared_data = (void *)0x7ffe0000;
char buffer_name[sizeof(MEMORY_SECTION_NAME) + MAX_PATH * sizeof(WCHAR)];
MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
+ BOOL found;
@ -44,7 +44,7 @@ index 4ad639ca81..44d1213b98 100644
module = GetModuleHandleA( "ntdll.dll" );
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
@@ -2234,6 +2239,10 @@ static void test_queryvirtualmemory(void)
@@ -2302,6 +2307,10 @@ static void test_queryvirtualmemory(void)
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
ok( readcount > 0, "Expected readcount to be > 0\n");
trace ("Section Name: %s\n", wine_dbgstr_w(msn->SectionFileName.Buffer));
@ -56,5 +56,5 @@ index 4ad639ca81..44d1213b98 100644
trace("Check section name of non mapped memory\n");
memset(msn, 0, sizeof(*msn));
--
2.24.1
2.26.2

View File

@ -1,132 +0,0 @@
From 69d23a66b69e6953035cfe02c4268f4bcfc0fb81 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 30 Apr 2020 18:58:58 +0200
Subject: [PATCH] ntdll/tests: Test user_shared_data timestamp updates.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
---
dlls/ntdll/tests/time.c | 78 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c
index 5382a952d8d..fe71d4458c0 100644
--- a/dlls/ntdll/tests/time.c
+++ b/dlls/ntdll/tests/time.c
@@ -18,7 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define NONAMELESSUNION
#include "ntdll_test.h"
+#include "ddk/wdm.h"
#define TICKSPERSEC 10000000
#define TICKSPERMSEC 10000
@@ -29,6 +31,7 @@ static VOID (WINAPI *pRtlTimeFieldsToTime)( PTIME_FIELDS TimeFields, PLARGE_IN
static NTSTATUS (WINAPI *pNtQueryPerformanceCounter)( LARGE_INTEGER *counter, LARGE_INTEGER *frequency );
static NTSTATUS (WINAPI *pRtlQueryTimeZoneInformation)( RTL_TIME_ZONE_INFORMATION *);
static NTSTATUS (WINAPI *pRtlQueryDynamicTimeZoneInformation)( RTL_DYNAMIC_TIME_ZONE_INFORMATION *);
+static BOOL (WINAPI *pRtlQueryUnbiasedInterruptTime)( ULONGLONG *time );
static const int MonthLengths[2][12] =
{
@@ -153,6 +156,79 @@ static void test_RtlQueryTimeZoneInformation(void)
wine_dbgstr_w(tzinfo.DaylightName));
}
+static ULONGLONG read_ksystem_time(volatile KSYSTEM_TIME *time)
+{
+ ULONGLONG high, low;
+ do
+ {
+ high = time->High1Time;
+ low = time->LowPart;
+ }
+ while (high != time->High2Time);
+ return high << 32 | low;
+}
+
+static void test_user_shared_data_time(void)
+{
+ KSHARED_USER_DATA *user_shared_data = (void *)0x7ffe0000;
+ ULONGLONG t1, t2, t3;
+ int i = 0;
+
+ i = 0;
+ do
+ {
+ t1 = GetTickCount();
+ if (user_shared_data->NtMajorVersion <= 5 && user_shared_data->NtMinorVersion <= 1)
+ t2 = ((ULONG64)user_shared_data->TickCountLowDeprecated * user_shared_data->TickCountMultiplier) >> 24;
+ else
+ t2 = (read_ksystem_time(&user_shared_data->u.TickCount) * user_shared_data->TickCountMultiplier) >> 24;
+ t3 = GetTickCount();
+ } while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
+
+ ok(t1 <= t2, "USD TickCount / GetTickCount are out of order: %s %s\n",
+ wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
+ todo_wine
+ ok(t2 <= t3, "USD TickCount / GetTickCount are out of order: %s %s\n",
+ wine_dbgstr_longlong(t2), wine_dbgstr_longlong(t3));
+
+ i = 0;
+ do
+ {
+ LARGE_INTEGER system_time;
+ NtQuerySystemTime(&system_time);
+ t1 = system_time.QuadPart;
+ t2 = read_ksystem_time(&user_shared_data->SystemTime);
+ NtQuerySystemTime(&system_time);
+ t3 = system_time.QuadPart;
+ } while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
+
+ todo_wine
+ ok(t1 <= t2, "USD SystemTime / NtQuerySystemTime are out of order %s %s\n",
+ wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
+ ok(t2 <= t3, "USD SystemTime / NtQuerySystemTime are out of order %s %s\n",
+ wine_dbgstr_longlong(t2), wine_dbgstr_longlong(t3));
+
+ if (!pRtlQueryUnbiasedInterruptTime)
+ win_skip("skipping RtlQueryUnbiasedInterruptTime tests\n");
+ else
+ {
+ i = 0;
+ do
+ {
+ pRtlQueryUnbiasedInterruptTime(&t1);
+ t2 = read_ksystem_time(&user_shared_data->InterruptTime);
+ pRtlQueryUnbiasedInterruptTime(&t3);
+ } while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
+
+ todo_wine
+ ok(t1 <= t2, "USD InterruptTime / RtlQueryUnbiasedInterruptTime are out of order %s %s\n",
+ wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
+ ok(t2 <= t3 || broken(t2 == t3 + 82410089070) /* w864 has some weird offset on testbot */,
+ "USD InterruptTime / RtlQueryUnbiasedInterruptTime are out of order %s %s\n",
+ wine_dbgstr_longlong(t2), wine_dbgstr_longlong(t3));
+ }
+}
+
START_TEST(time)
{
HMODULE mod = GetModuleHandleA("ntdll.dll");
@@ -163,6 +239,7 @@ START_TEST(time)
(void *)GetProcAddress(mod, "RtlQueryTimeZoneInformation");
pRtlQueryDynamicTimeZoneInformation =
(void *)GetProcAddress(mod, "RtlQueryDynamicTimeZoneInformation");
+ pRtlQueryUnbiasedInterruptTime = (void *)GetProcAddress(mod, "RtlQueryUnbiasedInterruptTime");
if (pRtlTimeToTimeFields && pRtlTimeFieldsToTime)
test_pRtlTimeToTimeFields();
@@ -170,4 +247,5 @@ START_TEST(time)
win_skip("Required time conversion functions are not available\n");
test_NtQueryPerformanceCounter();
test_RtlQueryTimeZoneInformation();
+ test_user_shared_data_time();
}
--
2.26.2

View File

@ -1,349 +0,0 @@
From f87e42d852d66331469af5bc18f153f91f4c23b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 30 Apr 2020 18:58:59 +0200
Subject: [PATCH] server: Add USD support with timestamp updates.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The USD page is created when the first process (wineboot.exe) completes
its creation, using its provided user_shared_data for initialization.
The server maps the page write-only and the clients map it read-only,
then the server updates the timestamps every 16 ms.
The tests todo_wine cannot be completely removed as the read may have
missed a server timestamp update whereas the time functions are still
directly calling native clocks to get their values.
It may then be possible to implement time using USD but that would
reduce the clocks accuracy down to the server update frequency.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29168
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
---
dlls/ntdll/ntdll_misc.h | 1 +
dlls/ntdll/server.c | 25 ++++++++++++--
dlls/ntdll/tests/time.c | 9 +++--
dlls/ntdll/thread.c | 2 ++
dlls/ntoskrnl.exe/instr.c | 12 -------
server/file.h | 2 ++
server/mapping.c | 69 +++++++++++++++++++++++++++++++++++++++
server/process.c | 8 +++++
server/protocol.def | 1 +
9 files changed, 112 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 76e8ec284e8..0d2ef09c87b 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -221,6 +221,7 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN;
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
+extern size_t user_shared_data_size DECLSPEC_HIDDEN;
/* completion */
extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue,
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 3832a80f1e2..1a9780e95ba 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -91,6 +91,7 @@
#include "wine/server.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
+#include "ddk/wdm.h"
WINE_DEFAULT_DEBUG_CHANNEL(server);
@@ -1862,8 +1863,15 @@ void server_init_process_done(void)
PEB *peb = NtCurrentTeb()->Peb;
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( peb->ImageBaseAddress );
void *entry = (char *)peb->ImageBaseAddress + nt->OptionalHeader.AddressOfEntryPoint;
+ obj_handle_t usd_handle;
NTSTATUS status;
- int suspend;
+ int suspend, usd_fd = -1;
+ sigset_t old_set;
+ SIZE_T size = user_shared_data_size;
+ void *addr = user_shared_data;
+ ULONG old_prot;
+
+ NtProtectVirtualMemory( NtCurrentProcess(), &addr, &size, PAGE_READONLY, &old_prot );
#ifdef __APPLE__
send_server_task_port();
@@ -1878,6 +1886,7 @@ void server_init_process_done(void)
signal_init_process();
/* Signal the parent process to continue */
+ pthread_sigmask( SIG_BLOCK, &server_block_set, &old_set );
SERVER_START_REQ( init_process_done )
{
req->module = wine_server_client_ptr( peb->ImageBaseAddress );
@@ -1886,10 +1895,22 @@ void server_init_process_done(void)
#endif
req->entry = wine_server_client_ptr( entry );
req->gui = (nt->OptionalHeader.Subsystem != IMAGE_SUBSYSTEM_WINDOWS_CUI);
- status = wine_server_call( req );
+ wine_server_add_data( req, user_shared_data, sizeof(*user_shared_data) );
+ status = server_call_unlocked( req );
suspend = reply->suspend;
}
SERVER_END_REQ;
+ if (!status) usd_fd = receive_fd( &usd_handle );
+ pthread_sigmask( SIG_SETMASK, &old_set, NULL );
+
+ if (usd_fd != -1)
+ {
+ munmap( user_shared_data, user_shared_data_size );
+ if (user_shared_data != mmap( user_shared_data, user_shared_data_size,
+ PROT_READ, MAP_SHARED | MAP_FIXED, usd_fd, 0 ))
+ fatal_error( "failed to remap the process user shared data\n" );
+ close( usd_fd );
+ }
assert( !status );
signal_start_process( entry, suspend );
diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c
index fe71d4458c0..7f81c20f21e 100644
--- a/dlls/ntdll/tests/time.c
+++ b/dlls/ntdll/tests/time.c
@@ -185,9 +185,10 @@ static void test_user_shared_data_time(void)
t3 = GetTickCount();
} while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
+ /* FIXME: not always in order, but should be close */
+ todo_wine_if(t1 > t2 && t1 - t2 < 50)
ok(t1 <= t2, "USD TickCount / GetTickCount are out of order: %s %s\n",
wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
- todo_wine
ok(t2 <= t3, "USD TickCount / GetTickCount are out of order: %s %s\n",
wine_dbgstr_longlong(t2), wine_dbgstr_longlong(t3));
@@ -202,7 +203,8 @@ static void test_user_shared_data_time(void)
t3 = system_time.QuadPart;
} while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
- todo_wine
+ /* FIXME: not always in order, but should be close */
+ todo_wine_if(t1 > t2 && t1 - t2 < 50 * TICKSPERMSEC)
ok(t1 <= t2, "USD SystemTime / NtQuerySystemTime are out of order %s %s\n",
wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
ok(t2 <= t3, "USD SystemTime / NtQuerySystemTime are out of order %s %s\n",
@@ -220,7 +222,8 @@ static void test_user_shared_data_time(void)
pRtlQueryUnbiasedInterruptTime(&t3);
} while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
- todo_wine
+ /* FIXME: not always in order, but should be close */
+ todo_wine_if(t1 > t2 && t1 - t2 < 50 * TICKSPERMSEC)
ok(t1 <= t2, "USD InterruptTime / RtlQueryUnbiasedInterruptTime are out of order %s %s\n",
wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
ok(t2 <= t3 || broken(t2 == t3 + 82410089070) /* w864 has some weird offset on testbot */,
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index d116c7bd571..f4da99db760 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -56,6 +56,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread);
#endif
struct _KUSER_SHARED_DATA *user_shared_data = NULL;
+size_t user_shared_data_size = 0;
static const WCHAR default_windirW[] = {'C',':','\\','w','i','n','d','o','w','s',0};
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
@@ -244,6 +245,7 @@ TEB *thread_init(void)
exit(1);
}
user_shared_data = addr;
+ user_shared_data_size = size;
memcpy( user_shared_data->NtSystemRoot, default_windirW, sizeof(default_windirW) );
/* allocate and initialize the PEB and initial TEB */
diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c
index 77803f07d72..0973b3a80a0 100644
--- a/dlls/ntoskrnl.exe/instr.c
+++ b/dlls/ntoskrnl.exe/instr.c
@@ -593,15 +593,6 @@ static void fake_syscall_function(void)
}
-static void update_shared_data(void)
-{
- struct _KUSER_SHARED_DATA *shared_data = (struct _KUSER_SHARED_DATA *)wine_user_shared_data;
-
- shared_data->u.TickCountQuad = GetTickCount64();
- shared_data->u.TickCount.High2Time = shared_data->u.TickCount.High1Time;
-}
-
-
/***********************************************************************
* emulate_instruction
*
@@ -802,7 +793,6 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
if (offset <= sizeof(KSHARED_USER_DATA) - data_size)
{
ULONGLONG temp = 0;
- update_shared_data();
memcpy( &temp, wine_user_shared_data + offset, data_size );
store_reg_word( context, instr[2], (BYTE *)&temp, long_op, rex );
context->Rip += prefixlen + len + 2;
@@ -823,7 +813,6 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
if (offset <= sizeof(KSHARED_USER_DATA) - data_size)
{
- update_shared_data();
switch (*instr)
{
case 0x8a: store_reg_byte( context, instr[1], wine_user_shared_data + offset, rex ); break;
@@ -845,7 +834,6 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
if (offset <= sizeof(KSHARED_USER_DATA) - data_size)
{
- update_shared_data();
memcpy( &context->Rax, wine_user_shared_data + offset, data_size );
context->Rip += prefixlen + len + 1;
return ExceptionContinueExecution;
diff --git a/server/file.h b/server/file.h
index 7395814dadd..d577aaed3cf 100644
--- a/server/file.h
+++ b/server/file.h
@@ -173,6 +173,8 @@ extern struct file *get_mapping_file( struct process *process, client_ptr_t base
extern void free_mapped_views( struct process *process );
extern int get_page_size(void);
+int get_user_shared_data_fd( const void *usd_init, data_size_t usd_size );
+
/* device functions */
extern struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name );
diff --git a/server/mapping.c b/server/mapping.c
index 6990a1913d7..d73d8de9c28 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -35,6 +35,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
+#include "ddk/wdm.h"
#include "file.h"
#include "handle.h"
@@ -943,6 +944,74 @@ int get_page_size(void)
return page_mask + 1;
}
+static int kusd_fd;
+static KSHARED_USER_DATA *kusd;
+static const timeout_t kusd_timeout = 16 * -TICKS_PER_SEC / 1000;
+
+static void kusd_set_current_time( void *private )
+{
+ ULONG system_time_high = current_time >> 32;
+ ULONG system_time_low = current_time & 0xffffffff;
+ ULONG interrupt_time_high = monotonic_time >> 32;
+ ULONG interrupt_time_low = monotonic_time & 0xffffffff;
+ ULONG tick_count_high = (monotonic_time * 1000 / TICKS_PER_SEC) >> 32;
+ ULONG tick_count_low = (monotonic_time * 1000 / TICKS_PER_SEC) & 0xffffffff;
+ KSHARED_USER_DATA *ptr = kusd;
+
+ add_timeout_user( kusd_timeout, kusd_set_current_time, NULL );
+
+#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
+ __atomic_store_n(&ptr->SystemTime.High2Time, system_time_high, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&ptr->SystemTime.LowPart, system_time_low, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&ptr->SystemTime.High1Time, system_time_high, __ATOMIC_SEQ_CST);
+
+ __atomic_store_n(&ptr->InterruptTime.High2Time, interrupt_time_high, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&ptr->InterruptTime.LowPart, interrupt_time_low, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&ptr->InterruptTime.High1Time, interrupt_time_high, __ATOMIC_SEQ_CST);
+
+ __atomic_store_n(&ptr->TickCount.High2Time, tick_count_high, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&ptr->TickCount.LowPart, tick_count_low, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&ptr->TickCount.High1Time, tick_count_high, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&ptr->TickCountLowDeprecated, tick_count_low, __ATOMIC_SEQ_CST);
+#else
+ ptr->SystemTime.High2Time = system_time_high;
+ ptr->SystemTime.LowPart = system_time_low;
+ ptr->SystemTime.High1Time = system_time_high;
+
+ ptr->InterruptTime.High2Time = interrupt_time_high;
+ ptr->InterruptTime.LowPart = interrupt_time_low;
+ ptr->InterruptTime.High1Time = interrupt_time_high;
+
+ ptr->TickCount.High2Time = tick_count_high;
+ ptr->TickCount.LowPart = tick_count_low;
+ ptr->TickCount.High1Time = tick_count_high;
+ ptr->TickCountLowDeprecated = tick_count_low;
+#endif
+}
+
+int get_user_shared_data_fd( const void *usd_init, data_size_t usd_size )
+{
+ /* keep it the same as user_shared_data_size in ntdll */
+ size_t size = 0x10000;
+
+ if (sizeof(*kusd) != usd_size) return -1;
+ if (kusd) return kusd_fd;
+
+ if ((kusd_fd = create_temp_file( size )) == -1)
+ return -1;
+
+ if ((kusd = mmap( NULL, size, PROT_WRITE, MAP_SHARED, kusd_fd, 0 )) == MAP_FAILED)
+ {
+ close( kusd_fd );
+ return -1;
+ }
+
+ memcpy( kusd, usd_init, usd_size );
+
+ kusd_set_current_time( NULL );
+ return kusd_fd;
+}
+
/* create a file mapping */
DECL_HANDLER(create_mapping)
{
diff --git a/server/process.c b/server/process.c
index 211207ed03b..123dd9b28de 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1361,6 +1361,7 @@ DECL_HANDLER(init_process_done)
{
struct process_dll *dll;
struct process *process = current->process;
+ int usd_fd;
if (is_process_init_done(process))
{
@@ -1372,6 +1373,13 @@ DECL_HANDLER(init_process_done)
set_error( STATUS_DLL_NOT_FOUND );
return;
}
+ if ((usd_fd = get_user_shared_data_fd( get_req_data(), get_req_data_size() )) == -1)
+ {
+ set_error( STATUS_NO_MEMORY );
+ return;
+ }
+
+ send_client_fd( process, usd_fd, -1 );
/* main exe is the first in the dll list */
list_remove( &dll->entry );
diff --git a/server/protocol.def b/server/protocol.def
index 06a29b153ea..b1fe198ad04 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -854,6 +854,7 @@ struct rawinput_device
mod_handle_t module; /* main module base address */
client_ptr_t ldt_copy; /* address of LDT copy (in thread address space) */
client_ptr_t entry; /* process entry point */
+ VARARG(usd,bytes); /* USD initialization data */
@REPLY
int suspend; /* is process suspended? */
@END
--
2.26.2

View File

@ -1 +0,0 @@
Fixes: [29168] Update user shared data at realtime

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "b071d37b8017ff34a29f1555ab6630d4b88d1838"
echo "26b26a2e0efcb776e7b0115f15580d2507b10400"
}
# Show version information
@ -207,7 +207,6 @@ patch_enable_all ()
enable_ntdll_ThreadHideFromDebugger="$1"
enable_ntdll_ThreadTime="$1"
enable_ntdll_Threading="$1"
enable_ntdll_User_Shared_Data="$1"
enable_ntdll_WRITECOPY="$1"
enable_ntdll_Zero_mod_name="$1"
enable_ntdll_aarch_TEB="$1"
@ -727,9 +726,6 @@ patch_enable ()
ntdll-Threading)
enable_ntdll_Threading="$2"
;;
ntdll-User_Shared_Data)
enable_ntdll_User_Shared_Data="$2"
;;
ntdll-WRITECOPY)
enable_ntdll_WRITECOPY="$2"
;;
@ -1786,9 +1782,6 @@ if test "$enable_eventfd_synchronization" -eq 1; then
if test "$enable_ntdll_SystemRoot_Symlink" -gt 1; then
abort "Patchset ntdll-SystemRoot_Symlink disabled, but eventfd_synchronization depends on that."
fi
if test "$enable_ntdll_User_Shared_Data" -gt 1; then
abort "Patchset ntdll-User_Shared_Data disabled, but eventfd_synchronization depends on that."
fi
if test "$enable_server_Realtime_Priority" -gt 1; then
abort "Patchset server-Realtime_Priority disabled, but eventfd_synchronization depends on that."
fi
@ -1806,7 +1799,6 @@ if test "$enable_eventfd_synchronization" -eq 1; then
enable_ntdll_Junction_Points=1
enable_ntdll_RtlCreateUserThread=1
enable_ntdll_SystemRoot_Symlink=1
enable_ntdll_User_Shared_Data=1
enable_server_Realtime_Priority=1
enable_server_Shared_Memory=1
enable_user32_rawinput_mouse=1
@ -1817,9 +1809,6 @@ if test "$enable_server_Shared_Memory" -eq 1; then
if test "$enable_ntdll_Threading" -gt 1; then
abort "Patchset ntdll-Threading disabled, but server-Shared_Memory depends on that."
fi
if test "$enable_ntdll_User_Shared_Data" -gt 1; then
abort "Patchset ntdll-User_Shared_Data disabled, but server-Shared_Memory depends on that."
fi
if test "$enable_ntdll_ext4_case_folder" -gt 1; then
abort "Patchset ntdll-ext4-case-folder disabled, but server-Shared_Memory depends on that."
fi
@ -1836,7 +1825,6 @@ if test "$enable_server_Shared_Memory" -eq 1; then
abort "Patchset user32-rawinput-nolegacy disabled, but server-Shared_Memory depends on that."
fi
enable_ntdll_Threading=1
enable_ntdll_User_Shared_Data=1
enable_ntdll_ext4_case_folder=1
enable_server_Key_State=1
enable_server_PeekMessage=1
@ -1880,13 +1868,6 @@ if test "$enable_ntdll_RtlCreateUserThread" -eq 1; then
enable_winebuild_Fake_Dlls=1
fi
if test "$enable_winebuild_Fake_Dlls" -eq 1; then
if test "$enable_ntdll_User_Shared_Data" -gt 1; then
abort "Patchset ntdll-User_Shared_Data disabled, but winebuild-Fake_Dlls depends on that."
fi
enable_ntdll_User_Shared_Data=1
fi
if test "$enable_dxdiagn_GetChildContainer_Leaf_Nodes" -eq 1; then
if test "$enable_dxdiagn_Enumerate_DirectSound" -gt 1; then
abort "Patchset dxdiagn-Enumerate_DirectSound disabled, but dxdiagn-GetChildContainer_Leaf_Nodes depends on that."
@ -3223,29 +3204,8 @@ if test "$enable_ntdll_Junction_Points" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-User_Shared_Data
# |
# | This patchset fixes the following Wine bugs:
# | * [#29168] Update user shared data at realtime
# |
# | Modified files:
# | * dlls/ntdll/ntdll_misc.h, dlls/ntdll/server.c, dlls/ntdll/tests/time.c, dlls/ntdll/thread.c, dlls/ntoskrnl.exe/instr.c,
# | server/file.h, server/mapping.c, server/process.c, server/protocol.def
# |
if test "$enable_ntdll_User_Shared_Data" -eq 1; then
patch_apply ntdll-User_Shared_Data/0001-ntdll-tests-Test-user_shared_data-timestamp-updates.patch
patch_apply ntdll-User_Shared_Data/0002-server-Add-USD-support-with-timestamp-updates.patch
(
printf '%s\n' '+ { "Rémi Bernon", "ntdll/tests: Test user_shared_data timestamp updates.", 1 },';
printf '%s\n' '+ { "Rémi Bernon", "server: Add USD support with timestamp updates.", 1 },';
) >> "$patchlist"
fi
# Patchset winebuild-Fake_Dlls
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-User_Shared_Data
# |
# | This patchset fixes the following Wine bugs:
# | * [#21232] Chromium-based browser engines (Chrome, Opera, Comodo Dragon, SRWare Iron) crash on startup unless '--no-
# | sandbox' is used (native API sandboxing/hooking scheme incompatible with Wine)
@ -3259,11 +3219,11 @@ fi
# | dlls/krnl386.exe16/kernel16_private.h, dlls/krnl386.exe16/ne_module.c, dlls/krnl386.exe16/ne_segment.c,
# | dlls/krnl386.exe16/task.c, dlls/krnl386.exe16/thunk.c, dlls/krnl386.exe16/wowthunk.c, dlls/ntdll/actctx.c,
# | dlls/ntdll/directory.c, dlls/ntdll/loader.c, dlls/ntdll/locale.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/path.c,
# | dlls/ntdll/process.c, dlls/ntdll/server.c, dlls/ntdll/signal_i386.c, dlls/ntdll/signal_x86_64.c,
# | dlls/ntdll/tests/exception.c, dlls/ntdll/thread.c, dlls/system.drv16/system.c, dlls/toolhelp.dll16/toolhelp.c,
# | dlls/user.exe16/message.c, dlls/user.exe16/user.c, dlls/user.exe16/window.c, include/winternl.h, libs/wine/loader.c,
# | tools/winebuild/build.h, tools/winebuild/import.c, tools/winebuild/parser.c, tools/winebuild/relay.c,
# | tools/winebuild/res32.c, tools/winebuild/spec16.c, tools/winebuild/spec32.c, tools/winebuild/utils.c
# | dlls/ntdll/process.c, dlls/ntdll/signal_i386.c, dlls/ntdll/signal_x86_64.c, dlls/ntdll/tests/exception.c,
# | dlls/ntdll/thread.c, dlls/system.drv16/system.c, dlls/toolhelp.dll16/toolhelp.c, dlls/user.exe16/message.c,
# | dlls/user.exe16/user.c, dlls/user.exe16/window.c, include/winternl.h, libs/wine/loader.c, tools/winebuild/build.h,
# | tools/winebuild/import.c, tools/winebuild/parser.c, tools/winebuild/relay.c, tools/winebuild/res32.c,
# | tools/winebuild/spec16.c, tools/winebuild/spec32.c, tools/winebuild/utils.c
# |
if test "$enable_winebuild_Fake_Dlls" -eq 1; then
patch_apply winebuild-Fake_Dlls/0001-kernel32-tests-Add-basic-tests-for-fake-dlls.patch
@ -3295,7 +3255,7 @@ fi
# Patchset ntdll-RtlCreateUserThread
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-User_Shared_Data, winebuild-Fake_Dlls
# | * winebuild-Fake_Dlls
# |
# | This patchset fixes the following Wine bugs:
# | * [#45571] League of Legends 8.12+ fails to start a game (anticheat engine, hooking of NtCreateThread/Ex)
@ -3543,8 +3503,8 @@ fi
# Patchset server-Shared_Memory
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Threading, ntdll-User_Shared_Data, ntdll-ext4-case-folder, server-Key_State, server-PeekMessage, server-
# | Signal_Thread, loader-KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32-rawinput-nolegacy
# | * ntdll-Threading, ntdll-ext4-case-folder, server-Key_State, server-PeekMessage, server-Signal_Thread, loader-
# | KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32-rawinput-nolegacy
# |
# | Modified files:
# | * dlls/ntdll/ntdll_misc.h, dlls/ntdll/server.c, dlls/ntdll/thread.c, dlls/ntdll/virtual.c, dlls/user32/focus.c,
@ -3595,10 +3555,10 @@ fi
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll-
# | Junction_Points, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll-RtlCreateUserThread, ntdll-SystemRoot_Symlink,
# | ntdll-ThreadTime, server-Realtime_Priority, ntdll-Threading, ntdll-ext4-case-folder, server-Key_State, server-
# | PeekMessage, server-Signal_Thread, loader-KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32
# | -rawinput-nolegacy, server-Shared_Memory, ws2_32-WSACleanup
# | Junction_Points, winebuild-Fake_Dlls, ntdll-RtlCreateUserThread, ntdll-SystemRoot_Symlink, ntdll-ThreadTime, server-
# | Realtime_Priority, ntdll-Threading, ntdll-ext4-case-folder, server-Key_State, server-PeekMessage, server-Signal_Thread,
# | loader-KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32-rawinput-nolegacy, server-
# | Shared_Memory, ws2_32-WSACleanup
# |
# | This patchset fixes the following Wine bugs:
# | * [#36692] Many multi-threaded applications have poor performance due to heavy use of synchronization primitives
@ -4666,7 +4626,7 @@ fi
# Patchset ntdll-NtContinue
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-User_Shared_Data, winebuild-Fake_Dlls
# | * winebuild-Fake_Dlls
# |
# | This patchset fixes the following Wine bugs:
# | * [#31910] Add stub for NtContinue
@ -4869,7 +4829,7 @@ fi
# Patchset ntdll-Syscall_Emulation
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-User_Shared_Data, winebuild-Fake_Dlls
# | * winebuild-Fake_Dlls
# |
# | This patchset fixes the following Wine bugs:
# | * [#48291] Detroit: Become Human crashes on launch
@ -5279,10 +5239,10 @@ fi
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll-
# | Junction_Points, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll-RtlCreateUserThread, ntdll-SystemRoot_Symlink,
# | ntdll-ThreadTime, server-Realtime_Priority, ntdll-Threading, ntdll-ext4-case-folder, server-Key_State, server-
# | PeekMessage, server-Signal_Thread, loader-KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32
# | -rawinput-nolegacy, server-Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization
# | Junction_Points, winebuild-Fake_Dlls, ntdll-RtlCreateUserThread, ntdll-SystemRoot_Symlink, ntdll-ThreadTime, server-
# | Realtime_Priority, ntdll-Threading, ntdll-ext4-case-folder, server-Key_State, server-PeekMessage, server-Signal_Thread,
# | loader-KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32-rawinput-nolegacy, server-
# | Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization
# |
# | This patchset fixes the following Wine bugs:
# | * [#46967] GOG Galaxy doesn't run in virtual desktop.
@ -5370,9 +5330,8 @@ fi
# Patchset server-Object_Types
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Threading, ntdll-User_Shared_Data, ntdll-ext4-case-folder, server-Key_State, server-PeekMessage, server-
# | Signal_Thread, loader-KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32-rawinput-nolegacy,
# | server-Shared_Memory
# | * ntdll-Threading, ntdll-ext4-case-folder, server-Key_State, server-PeekMessage, server-Signal_Thread, loader-
# | KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32-rawinput-nolegacy, server-Shared_Memory
# |
# | This patchset fixes the following Wine bugs:
# | * [#44629] Process Hacker can't enumerate handles
@ -7057,10 +7016,10 @@ fi
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, kernel32-K32GetPerformanceInfo, ntdll-
# | Junction_Points, ntdll-User_Shared_Data, winebuild-Fake_Dlls, ntdll-RtlCreateUserThread, ntdll-SystemRoot_Symlink,
# | ntdll-ThreadTime, server-Realtime_Priority, ntdll-Threading, ntdll-ext4-case-folder, server-Key_State, server-
# | PeekMessage, server-Signal_Thread, loader-KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32
# | -rawinput-nolegacy, server-Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization, server-Desktop_Refcount
# | Junction_Points, winebuild-Fake_Dlls, ntdll-RtlCreateUserThread, ntdll-SystemRoot_Symlink, ntdll-ThreadTime, server-
# | Realtime_Priority, ntdll-Threading, ntdll-ext4-case-folder, server-Key_State, server-PeekMessage, server-Signal_Thread,
# | loader-KeyboardLayouts, winex11.drv-mouse-coorrds, user32-rawinput-mouse, user32-rawinput-nolegacy, server-
# | Shared_Memory, ws2_32-WSACleanup, eventfd_synchronization, server-Desktop_Refcount
# |
# | Modified files:
# | * dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, include/winsock.h, server/protocol.def, server/sock.c

View File

@ -7,4 +7,3 @@ Depends: server-PeekMessage
Depends: server-Signal_Thread
Depends: user32-rawinput-nolegacy
Depends: ntdll-ext4-case-folder
Depends: ntdll-User_Shared_Data

View File

@ -1,17 +1,16 @@
From 566ba5ef5b751764a15be0571000dfbf72b10127 Mon Sep 17 00:00:00 2001
From cd9a767f1486be67feac18d7ea78a1ce6c1d0abc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 7 Sep 2017 00:38:09 +0200
Subject: [PATCH] tools/winebuild: Add syscall thunks for 64 bit.
---
dlls/kernel32/tests/loader.c | 7 +-
dlls/ntdll/server.c | 3 +-
dlls/ntdll/signal_x86_64.c | 2 +
dlls/ntdll/thread.c | 10 ++
dlls/ntdll/thread.c | 14 +-
libs/wine/loader.c | 4 +
tools/winebuild/parser.c | 2 +-
tools/winebuild/spec32.c | 285 ++++++++++++++++++++++++++++++++++-
7 files changed, 303 insertions(+), 10 deletions(-)
6 files changed, 304 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 5373dc4efe1..67d04876bd6 100644
@ -40,20 +39,6 @@ index 5373dc4efe1..67d04876bd6 100644
{
todo_wine ok(0, "%s: Export is a stub-function, skipping\n", func_name);
continue;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 973804967d1..6d3e981e4ad 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -2056,8 +2056,7 @@ void server_init_process_done(void)
if (usd_fd != -1)
{
- munmap( user_shared_data, user_shared_data_size );
- if (user_shared_data != mmap( user_shared_data, user_shared_data_size,
+ if (user_shared_data != mmap( user_shared_data, 0x1000,
PROT_READ, MAP_SHARED | MAP_FIXED, usd_fd, 0 ))
fatal_error( "failed to remap the process user shared data\n" );
close( usd_fd );
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 31af1e98d3f..324a92b41a9 100644
--- a/dlls/ntdll/signal_x86_64.c
@ -75,11 +60,11 @@ index 31af1e98d3f..324a92b41a9 100644
}
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index a054164ee70..4a90e16d2ee 100644
index 0fc8aa9e928..bae49792ce5 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -59,6 +59,8 @@ struct _KUSER_SHARED_DATA *user_shared_data = NULL;
size_t user_shared_data_size = 0;
static size_t user_shared_data_size;
static const WCHAR default_windirW[] = {'C',':','\\','w','i','n','d','o','w','s',0};
+extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
@ -87,7 +72,25 @@ index a054164ee70..4a90e16d2ee 100644
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
/* info passed to a starting thread */
@@ -275,6 +277,14 @@ TEB *thread_init(void)
@@ -294,7 +296,7 @@ TEB *thread_init(void)
/* reserve space for shared user data */
addr = (void *)0x7ffe0000;
- size = 0x1000;
+ size = 0x2000;
status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size,
MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE );
if (status)
@@ -303,7 +305,7 @@ TEB *thread_init(void)
exit(1);
}
user_shared_data = addr;
- user_shared_data_size = size;
+ user_shared_data_size = 0x1000;
memcpy( user_shared_data->NtSystemRoot, default_windirW, sizeof(default_windirW) );
/* allocate and initialize the PEB and initial TEB */
@@ -333,6 +335,14 @@ TEB *thread_init(void)
InitializeListHead( &ldr.InInitializationOrderModuleList );
*(ULONG_PTR *)peb->Reserved = get_image_addr();

View File

@ -3,4 +3,3 @@ Fixes: [42741] StarCraft I: 1.18 PTR fails to initialize ClientSdk.dll
Fixes: [45349] Multiple applications and games crash due to missing support for 64-bit syscall thunks (StreetFighter V)
Fixes: [45573] League of Legends 8.12+ fails to start a game (anticheat engine, hooking of syscall return instructions)
Fixes: [45650] chromium 32-bit sandbox expects different syscall thunks depending on Windows version
Depends: ntdll-User_Shared_Data

View File

@ -1,4 +1,4 @@
From 54647a8a35d864c07adfe10ed6206a33483bed21 Mon Sep 17 00:00:00 2001
From a95b88ac21b040a62d5b17bc916b63d4f3e5e30b Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Feb 2019 15:05:12 +0300
Subject: [PATCH] wined3d: Support SWVP vertex shader constants limit in state
@ -15,10 +15,10 @@ Subject: [PATCH] wined3d: Support SWVP vertex shader constants limit in state
7 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 16f42216c..75251ef02 100644
index 41cfc1519c1..21247319853 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -6428,13 +6428,10 @@ static void test_vertex_shader_constant(void)
@@ -6544,13 +6544,10 @@ static void test_vertex_shader_constant(void)
ok(consts_swvp == 8192, "Unexpected consts_swvp %u.\n", consts_swvp);
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts + 0, c, 1);
@ -32,7 +32,7 @@ index 16f42216c..75251ef02 100644
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts_swvp - 1, c, 1);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
@@ -6459,7 +6456,6 @@ static void test_vertex_shader_constant(void)
@@ -6575,7 +6572,6 @@ static void test_vertex_shader_constant(void)
IDirect3DDevice9_SetSoftwareVertexProcessing(device, 0);
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts + 0, c, 1);
@ -40,7 +40,7 @@ index 16f42216c..75251ef02 100644
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts_swvp - 1, c, 1);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
@@ -6467,7 +6463,6 @@ static void test_vertex_shader_constant(void)
@@ -6583,7 +6579,6 @@ static void test_vertex_shader_constant(void)
IDirect3DDevice9_SetSoftwareVertexProcessing(device, 1);
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts + 0, c, 1);
@ -49,10 +49,10 @@ index 16f42216c..75251ef02 100644
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, consts_swvp - 1, c, 1);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 9ceb758c6..0ae4eb7a3 100644
index f873f3ae9b3..0b3fd91328d 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -24877,7 +24877,6 @@ static void test_mvp_software_vertex_shaders(void)
@@ -24880,7 +24880,6 @@ static void test_mvp_software_vertex_shaders(void)
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, c_index, 1);
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_SetVertexShaderConstantF(device, (unsigned int)c_index[0], c_color, 1);
@ -61,10 +61,10 @@ index 9ceb758c6..0ae4eb7a3 100644
hr = IDirect3DDevice9_BeginScene(device);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 119721d22..cf26b46ba 100644
index 541d091816b..b83a8f49d72 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3484,7 +3484,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
@@ -3255,7 +3255,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
const struct wined3d_saved_states *changed = &stateblock->changed;
const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT;
BOOL set_blend_state = FALSE, set_rasterizer_state = FALSE;
@ -73,7 +73,7 @@ index 119721d22..cf26b46ba 100644
struct wined3d_range range;
uint32_t map;
@@ -3495,9 +3495,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
@@ -3266,9 +3266,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
if (changed->pixelShader)
wined3d_device_set_pixel_shader(device, state->ps);
@ -87,7 +87,7 @@ index 119721d22..cf26b46ba 100644
wined3d_device_set_vs_consts_f(device, range.offset, range.size, &state->vs_consts_f[range.offset]);
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index b8b463372..99273becb 100644
index bb632ecca7b..1ac4ae92953 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1913,7 +1913,7 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
@ -100,7 +100,7 @@ index b8b463372..99273becb 100644
update_heap_entry(heap, i, priv->next_constant_version);
}
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index b6c3169c4..a7201a8df 100644
index 7e97c84c19e..b439e70b4f4 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -714,8 +714,8 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
@ -167,7 +167,7 @@ index b6c3169c4..a7201a8df 100644
return WINED3DERR_INVALIDCALL;
memcpy(&stateblock->stateblock_state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
@@ -1936,7 +1941,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -1933,7 +1938,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
stateblock_init_lights(stateblock->stateblock_state.light_state->light_map,
device_state->stateblock_state.light_state->light_map);
stateblock_savedstates_set_all(&stateblock->changed,
@ -176,7 +176,7 @@ index b6c3169c4..a7201a8df 100644
break;
case WINED3D_SBT_PIXEL_STATE:
@@ -1948,7 +1953,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
@@ -1945,7 +1950,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
stateblock_init_lights(stateblock->stateblock_state.light_state->light_map,
device_state->stateblock_state.light_state->light_map);
stateblock_savedstates_set_vertex(&stateblock->changed,
@ -186,10 +186,10 @@ index b6c3169c4..a7201a8df 100644
default:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1a1568818..2f8ee1fc1 100644
index 49120a2dda2..f2040eec334 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3209,7 +3209,7 @@ struct wined3d_state
@@ -3441,7 +3441,7 @@ struct wined3d_state
struct wined3d_shader_resource_view *shader_resource_view[WINED3D_SHADER_TYPE_COUNT][MAX_SHADER_RESOURCE_VIEWS];
struct wined3d_unordered_access_view *unordered_access_view[WINED3D_PIPELINE_COUNT][MAX_UNORDERED_ACCESS_VIEWS];
@ -198,7 +198,7 @@ index 1a1568818..2f8ee1fc1 100644
struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I];
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
@@ -3357,6 +3357,15 @@ HRESULT wined3d_device_set_implicit_swapchain(struct wined3d_device *device,
@@ -3585,6 +3585,15 @@ HRESULT wined3d_device_set_implicit_swapchain(struct wined3d_device *device,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void wined3d_device_uninit_3d(struct wined3d_device *device) DECLSPEC_HIDDEN;
@ -214,20 +214,20 @@ index 1a1568818..2f8ee1fc1 100644
struct wined3d_device_no3d
{
struct wined3d_device d;
@@ -3926,7 +3935,7 @@ struct wined3d_vertex_declaration
@@ -4242,7 +4251,7 @@ struct wined3d_vertex_declaration
struct wined3d_saved_states
{
- DWORD vs_consts_f[WINED3D_MAX_VS_CONSTS_F >> 5];
+ DWORD vs_consts_f[WINED3D_MAX_VS_CONSTS_F_SWVP >> 5];
- uint32_t vs_consts_f[WINED3D_BITMAP_SIZE(WINED3D_MAX_VS_CONSTS_F)];
+ uint32_t vs_consts_f[WINED3D_BITMAP_SIZE(WINED3D_MAX_VS_CONSTS_F_SWVP)];
WORD vertexShaderConstantsI; /* WINED3D_MAX_CONSTS_I, 16 */
WORD vertexShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */
DWORD ps_consts_f[WINED3D_MAX_PS_CONSTS_F >> 5];
uint32_t ps_consts_f[WINED3D_BITMAP_SIZE(WINED3D_MAX_PS_CONSTS_F)];
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 3606c4e24..845cd6745 100644
index 0ffeecfb297..9b1e64385e0 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2165,7 +2165,7 @@ struct wined3d_stateblock_state
@@ -2158,7 +2158,7 @@ struct wined3d_stateblock_state
int base_vertex_index;
struct wined3d_shader *vs;
@ -237,5 +237,5 @@ index 3606c4e24..845cd6745 100644
BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
--
2.25.1
2.26.2