You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1212b7ddff | ||
|
16dce52124 | ||
|
8a4e32eb32 | ||
|
1baaa8fbfc | ||
|
f09458658e | ||
|
e68e4dbb75 | ||
|
2e768aee87 | ||
|
b6944be810 | ||
|
ce31cba943 | ||
|
52f5128abc | ||
|
d7706d345c |
@@ -1,4 +1,4 @@
|
||||
From 3b9e832890ad710eecf08f7901d708cfebb3520c Mon Sep 17 00:00:00 2001
|
||||
From 6dbedd8d7aebe117b013c61f9549848f13619f0e Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 13 Jun 2018 10:44:49 -0500
|
||||
Subject: [PATCH] configure: Check for sys/eventfd.h, ppoll(), and shm_open().
|
||||
@@ -7,12 +7,12 @@ We use ppoll() instead of poll() for the better time granularity.
|
||||
|
||||
Although perhaps we shouldn't since the server doesn't do this.
|
||||
---
|
||||
configure.ac | 8 ++++++++
|
||||
include/config.h.in | 9 +++++++++
|
||||
2 files changed, 17 insertions(+)
|
||||
configure.ac | 8 ++++++++
|
||||
include/config.h.in | 11 ++++++++++-
|
||||
2 files changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 4314be5553c..920d8343925 100644
|
||||
index 67775f9cd15..c03d4c3688b 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -407,6 +407,7 @@ AC_CHECK_HEADERS(\
|
||||
@@ -23,7 +23,7 @@ index 4314be5553c..920d8343925 100644
|
||||
sys/extattr.h \
|
||||
sys/filio.h \
|
||||
sys/ipc.h \
|
||||
@@ -2076,6 +2077,7 @@ AC_CHECK_FUNCS(\
|
||||
@@ -2067,6 +2068,7 @@ AC_CHECK_FUNCS(\
|
||||
port_create \
|
||||
posix_fadvise \
|
||||
posix_fallocate \
|
||||
@@ -31,9 +31,9 @@ index 4314be5553c..920d8343925 100644
|
||||
prctl \
|
||||
sched_yield \
|
||||
renameat \
|
||||
@@ -2100,6 +2102,12 @@ case $host_os in
|
||||
;;
|
||||
esac
|
||||
@@ -2087,6 +2089,12 @@ AC_SEARCH_LIBS(clock_gettime, rt,
|
||||
test "$ac_res" = "none required" || AC_SUBST(RT_LIBS,"$ac_res")])
|
||||
LIBS=$ac_save_LIBS
|
||||
|
||||
+ac_save_LIBS=$LIBS
|
||||
+AC_SEARCH_LIBS(shm_open, rt,
|
||||
@@ -45,30 +45,32 @@ index 4314be5553c..920d8343925 100644
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <sched.h>]], [[sched_setaffinity(0, 0, 0);]])],[wine_cv_have_sched_setaffinity=yes],[wine_cv_have_sched_setaffinity=no]))
|
||||
diff --git a/include/config.h.in b/include/config.h.in
|
||||
index 096ecdf94ec..303fb7f2b69 100644
|
||||
index 1c3d4c4d62b..e9686e04a2a 100644
|
||||
--- a/include/config.h.in
|
||||
+++ b/include/config.h.in
|
||||
@@ -312,6 +312,9 @@
|
||||
/* Define to 1 if you have the `posix_fallocate' function. */
|
||||
@@ -318,6 +318,9 @@
|
||||
/* Define to 1 if you have the 'posix_fallocate' function. */
|
||||
#undef HAVE_POSIX_FALLOCATE
|
||||
|
||||
+/* Define to 1 if you have the `ppoll' function. */
|
||||
+#undef HAVE_PPOLL
|
||||
+
|
||||
/* Define to 1 if you have the `prctl' function. */
|
||||
/* Define to 1 if you have the 'prctl' function. */
|
||||
#undef HAVE_PRCTL
|
||||
|
||||
@@ -369,6 +372,9 @@
|
||||
/* Define to 1 if `interface_id' is a member of `sg_io_hdr_t'. */
|
||||
@@ -375,7 +378,10 @@
|
||||
/* Define to 1 if 'interface_id' is a member of 'sg_io_hdr_t'. */
|
||||
#undef HAVE_SG_IO_HDR_T_INTERFACE_ID
|
||||
|
||||
-/* Define to 1 if 'si_fd' is a member of 'siginfo_t'. */
|
||||
+/* Define to 1 if you have the `shm_open' function. */
|
||||
+#undef HAVE_SHM_OPEN
|
||||
+
|
||||
/* Define to 1 if `si_fd' is a member of `siginfo_t'. */
|
||||
+/* Define to 1 if `si_fd' is a member of `siginfo_t'. */
|
||||
#undef HAVE_SIGINFO_T_SI_FD
|
||||
|
||||
@@ -498,6 +504,9 @@
|
||||
/* Define to 1 if you have the 'sigprocmask' function. */
|
||||
@@ -504,6 +510,9 @@
|
||||
/* Define to 1 if you have the <sys/epoll.h> header file. */
|
||||
#undef HAVE_SYS_EPOLL_H
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 8f9e309dc4b3e9c7328c86cc4993b9359f0e6839 Mon Sep 17 00:00:00 2001
|
||||
From 4c246e61f0de05a8b80e7a5d5ff2edcd21036fec Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Mon, 25 Nov 2019 12:19:20 +0300
|
||||
Subject: [PATCH] ntdll: Force virtual memory allocation order.
|
||||
@@ -16,10 +16,10 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46568
|
||||
1 file changed, 164 insertions(+), 246 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index cd1655d41b2..c0537375ab8 100644
|
||||
index 1a3d527f186..ec72d692c3a 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -1241,43 +1241,15 @@ static struct file_view *find_view_range( const void *addr, size_t size )
|
||||
@@ -1269,43 +1269,15 @@ static struct file_view *find_view_range( const void *addr, size_t size )
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
|
||||
/***********************************************************************
|
||||
* try_map_free_area
|
||||
@@ -1312,112 +1284,6 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
|
||||
@@ -1338,112 +1310,6 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
/***********************************************************************
|
||||
* remove_reserved_area
|
||||
*
|
||||
@@ -1527,8 +1393,7 @@ static void free_view( struct file_view *view )
|
||||
@@ -1553,8 +1419,7 @@ static void free_view( struct file_view *view )
|
||||
*/
|
||||
static void unregister_view( struct file_view *view )
|
||||
{
|
||||
@@ -194,7 +194,7 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
wine_rb_remove( &views_tree, &view->entry );
|
||||
}
|
||||
|
||||
@@ -1556,8 +1421,7 @@ static void delete_view( struct file_view *view ) /* [in] View */
|
||||
@@ -1582,8 +1447,7 @@ static void delete_view( struct file_view *view ) /* [in] View */
|
||||
static void register_view( struct file_view *view )
|
||||
{
|
||||
wine_rb_put( &views_tree, view->base, &view->entry );
|
||||
@@ -204,7 +204,7 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
}
|
||||
|
||||
|
||||
@@ -1830,89 +1694,176 @@ static inline void *unmap_extra_space( void *ptr, size_t total_size, size_t want
|
||||
@@ -1855,89 +1719,176 @@ static inline void *unmap_extra_space( void *ptr, size_t total_size, size_t want
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
+static void *alloc_free_area( char *limit_low, char *limit_high, size_t size, BOOL top_down, int unix_prot, UINT_PTR align_mask )
|
||||
{
|
||||
- void *ptr = NULL;
|
||||
- struct reserved_area *area = LIST_ENTRY( ptr, struct reserved_area, entry );
|
||||
- struct reserved_area *area;
|
||||
+ struct range_entry *range, *ranges_start, *ranges_end;
|
||||
+ char *reserve_start, *reserve_end;
|
||||
+ struct alloc_area area;
|
||||
@@ -442,7 +442,7 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -2016,48 +1967,13 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
|
||||
@@ -2041,48 +1992,13 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -495,7 +495,7 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
status = create_view( view_ret, ptr, size, vprot );
|
||||
if (status != STATUS_SUCCESS) unmap_area( ptr, size );
|
||||
return status;
|
||||
@@ -3236,6 +3152,7 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P
|
||||
@@ -3275,6 +3191,7 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P
|
||||
done:
|
||||
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
if (needs_close) close( unix_handle );
|
||||
@@ -503,7 +503,7 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -6143,6 +6060,7 @@ NTSTATUS WINAPI NtWow64AllocateVirtualMemory64( HANDLE process, ULONG64 *ret, UL
|
||||
@@ -6394,6 +6311,7 @@ NTSTATUS WINAPI NtWow64AllocateVirtualMemory64( HANDLE process, ULONG64 *ret, UL
|
||||
*ret = (ULONG_PTR)base;
|
||||
*size_ptr = size;
|
||||
}
|
||||
@@ -512,5 +512,5 @@ index cd1655d41b2..c0537375ab8 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
2.45.2
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
From d13a3f4498ddc7f10a1d435edb5c59b71dca1efc Mon Sep 17 00:00:00 2001
|
||||
From 844ba5e56a7231f65b65cabf06fe44ee49876aa0 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 1 Dec 2023 14:55:20 -0600
|
||||
Subject: [PATCH] ntdll: Exclude natively mapped areas from free areas list.
|
||||
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 104 ++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 95 insertions(+), 9 deletions(-)
|
||||
dlls/ntdll/unix/virtual.c | 106 ++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 97 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index c0537375ab8..b4d7f6a580d 100644
|
||||
index ec72d692c3a..30d43afc076 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -127,6 +127,7 @@ struct file_view
|
||||
@@ -28,7 +28,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
|
||||
ULONG_PTR user_space_wow_limit = 0;
|
||||
struct _KUSER_SHARED_DATA *user_shared_data = (void *)0x7ffe0000;
|
||||
@@ -1129,7 +1132,9 @@ static void dump_view( struct file_view *view )
|
||||
@@ -1157,7 +1160,9 @@ static void dump_view( struct file_view *view )
|
||||
BYTE prot = get_page_vprot( addr );
|
||||
|
||||
TRACE( "View: %p - %p", addr, addr + view->size - 1 );
|
||||
@@ -39,7 +39,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
TRACE( " (builtin image)\n" );
|
||||
else if (view->protect & VPROT_FREE_PLACEHOLDER)
|
||||
TRACE( " (placeholder)\n" );
|
||||
@@ -1249,6 +1254,8 @@ struct alloc_area
|
||||
@@ -1277,6 +1282,8 @@ struct alloc_area
|
||||
int unix_prot;
|
||||
BOOL top_down;
|
||||
UINT_PTR align_mask;
|
||||
@@ -48,7 +48,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
@@ -1257,9 +1264,12 @@ struct alloc_area
|
||||
@@ -1285,9 +1292,14 @@ struct alloc_area
|
||||
* Try mmaping some expected free memory region, eventually stepping and
|
||||
* retrying inside it, and return where it actually succeeded, or NULL.
|
||||
*/
|
||||
@@ -60,10 +60,12 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
+ size_t abs_step = step > 0 ? step : -step;
|
||||
+ size_t size = area->size;
|
||||
+ int unix_prot = area->unix_prot;
|
||||
void *ptr;
|
||||
|
||||
+ void *ptr;
|
||||
+
|
||||
while (start && base <= start && (char*)start + size <= (char*)end)
|
||||
@@ -1272,12 +1282,19 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
|
||||
{
|
||||
if (anon_mmap_tryfixed( start, size, unix_prot, 0 ) != MAP_FAILED) return start;
|
||||
@@ -1298,12 +1310,19 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
|
||||
strerror(errno), start, (char *)start + size, unix_prot );
|
||||
return NULL;
|
||||
}
|
||||
@@ -84,7 +86,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1702,11 +1719,11 @@ static void *try_map_free_area_range( struct alloc_area *area, char *start, char
|
||||
@@ -1727,11 +1746,11 @@ static void *try_map_free_area_range( struct alloc_area *area, char *start, char
|
||||
{
|
||||
if (end - start < area->size) return NULL;
|
||||
alloc_start = ROUND_ADDR( end - area->size, area->align_mask );
|
||||
@@ -98,7 +100,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
}
|
||||
|
||||
static void *alloc_free_area_in_range( struct alloc_area *area, char *base, char *end )
|
||||
@@ -1796,9 +1813,10 @@ static void *alloc_free_area( char *limit_low, char *limit_high, size_t size, BO
|
||||
@@ -1821,9 +1840,10 @@ static void *alloc_free_area( char *limit_low, char *limit_high, size_t size, BO
|
||||
struct range_entry *range, *ranges_start, *ranges_end;
|
||||
char *reserve_start, *reserve_end;
|
||||
struct alloc_area area;
|
||||
@@ -110,7 +112,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
|
||||
TRACE("limit %p-%p, size %p, top_down %#x.\n", limit_low, limit_high, (void *)size, top_down);
|
||||
|
||||
@@ -1863,6 +1881,50 @@ static void *alloc_free_area( char *limit_low, char *limit_high, size_t size, BO
|
||||
@@ -1888,6 +1908,50 @@ static void *alloc_free_area( char *limit_low, char *limit_high, size_t size, BO
|
||||
if ((result = alloc_free_area_in_range( &area, base, end )))
|
||||
break;
|
||||
}
|
||||
@@ -161,7 +163,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1922,6 +1984,17 @@ failed:
|
||||
@@ -1947,6 +2011,17 @@ failed:
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -179,7 +181,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
/***********************************************************************
|
||||
* map_view
|
||||
*
|
||||
@@ -1972,7 +2045,15 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
|
||||
@@ -1997,7 +2072,15 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
|
||||
if (!align_mask) align_mask = granularity_mask;
|
||||
|
||||
if (!(ptr = alloc_free_area( (void *)limit_low, (void *)limit_high, size, top_down, get_unix_prot( vprot ), align_mask )))
|
||||
@@ -196,7 +198,7 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
}
|
||||
status = create_view( view_ret, ptr, size, vprot );
|
||||
if (status != STATUS_SUCCESS) unmap_area( ptr, size );
|
||||
@@ -4287,7 +4368,12 @@ void virtual_set_force_exec( BOOL enable )
|
||||
@@ -4346,7 +4429,12 @@ void virtual_set_force_exec( BOOL enable )
|
||||
WINE_RB_FOR_EACH_ENTRY( view, &views_tree, struct file_view, entry )
|
||||
{
|
||||
/* file mappings are always accessible */
|
||||
@@ -211,5 +213,5 @@ index c0537375ab8..b4d7f6a580d 100644
|
||||
mprotect_range( view->base, view->size, commit, 0 );
|
||||
}
|
||||
--
|
||||
2.43.0
|
||||
2.45.2
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 5306b83f69d37bf99110fc1b662fccc89552be3d Mon Sep 17 00:00:00 2001
|
||||
From c2236d2048faf1e01da3130fdb81688da6829d4a Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 16 Jan 2014 21:02:11 -0700
|
||||
Subject: [PATCH] server: Implement FILE_OPEN_REPARSE_POINT option.
|
||||
@@ -10,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
|
||||
2 files changed, 142 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
|
||||
index e1ba92a6448..04cb6760872 100644
|
||||
index 1f13511fa7b..1c41e0011f3 100644
|
||||
--- a/dlls/kernelbase/file.c
|
||||
+++ b/dlls/kernelbase/file.c
|
||||
@@ -732,6 +732,8 @@ static UINT get_nt_file_options( DWORD attributes )
|
||||
@@ -769,6 +769,8 @@ static UINT get_nt_file_options( DWORD attributes )
|
||||
options |= FILE_SEQUENTIAL_ONLY;
|
||||
if (attributes & FILE_FLAG_WRITE_THROUGH)
|
||||
options |= FILE_WRITE_THROUGH;
|
||||
@@ -23,18 +23,18 @@ index e1ba92a6448..04cb6760872 100644
|
||||
}
|
||||
|
||||
diff --git a/server/fd.c b/server/fd.c
|
||||
index 8576882aaa9..0d5964b2427 100644
|
||||
index 04688c5eb0d..94b8bd088ed 100644
|
||||
--- a/server/fd.c
|
||||
+++ b/server/fd.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <stdio.h>
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
+#include <libgen.h>
|
||||
#include <poll.h>
|
||||
#ifdef HAVE_LINUX_MAJOR_H
|
||||
#include <linux/major.h>
|
||||
@@ -101,6 +102,10 @@
|
||||
@@ -99,6 +100,10 @@
|
||||
#include "winioctl.h"
|
||||
#include "ddk/wdm.h"
|
||||
|
||||
@@ -45,7 +45,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
#if defined(HAVE_SYS_EPOLL_H) && defined(HAVE_EPOLL_CREATE)
|
||||
# include <sys/epoll.h>
|
||||
# define USE_EPOLL
|
||||
@@ -1066,6 +1071,9 @@ static void device_destroy( struct object *obj )
|
||||
@@ -1064,6 +1069,9 @@ static void device_destroy( struct object *obj )
|
||||
list_remove( &device->entry ); /* remove it from the hash table */
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
/****************************************************************/
|
||||
/* inode functions */
|
||||
|
||||
@@ -1073,10 +1081,29 @@ static void unlink_closed_fd( struct inode *inode, struct closed_fd *fd )
|
||||
@@ -1071,10 +1079,29 @@ static void unlink_closed_fd( struct inode *inode, struct closed_fd *fd )
|
||||
{
|
||||
/* make sure it is still the same file */
|
||||
struct stat st;
|
||||
@@ -86,7 +86,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1115,6 +1142,59 @@ static void inode_dump( struct object *obj, int verbose )
|
||||
@@ -1113,6 +1140,59 @@ static void inode_dump( struct object *obj, int verbose )
|
||||
fprintf( stderr, "\n" );
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
static void inode_destroy( struct object *obj )
|
||||
{
|
||||
struct inode *inode = (struct inode *)obj;
|
||||
@@ -1870,6 +1950,38 @@ void get_nt_name( struct fd *fd, struct unicode_str *name )
|
||||
@@ -1861,6 +1941,38 @@ void get_nt_name( struct fd *fd, struct unicode_str *name )
|
||||
name->len = fd->nt_namelen;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
/* open() wrapper that returns a struct fd with no fd user set */
|
||||
struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_name,
|
||||
int flags, mode_t *mode, unsigned int access,
|
||||
@@ -1930,6 +2042,15 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
@@ -1921,6 +2033,15 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
}
|
||||
else rw_mode = O_RDONLY;
|
||||
|
||||
@@ -201,7 +201,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
if ((fd->unix_fd = open( name, rw_mode | (flags & ~O_TRUNC), *mode )) == -1)
|
||||
{
|
||||
/* if we tried to open a directory for write access, retry read-only */
|
||||
@@ -1954,7 +2075,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
@@ -1945,7 +2066,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
fd->unix_name = NULL;
|
||||
if ((path = dup_fd_name( root, name )))
|
||||
{
|
||||
@@ -210,7 +210,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
free( path );
|
||||
}
|
||||
|
||||
@@ -1965,10 +2086,11 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
@@ -1956,10 +2077,11 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
*mode = st.st_mode;
|
||||
|
||||
/* only bother with an inode for normal files and directories */
|
||||
@@ -223,7 +223,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
|
||||
if (!inode)
|
||||
{
|
||||
@@ -1983,13 +2105,17 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
@@ -1974,13 +2096,17 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
||||
list_add_head( &inode->open, &fd->inode_entry );
|
||||
closed_fd = NULL;
|
||||
|
||||
@@ -243,7 +243,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
{
|
||||
set_error( STATUS_FILE_IS_A_DIRECTORY );
|
||||
goto error;
|
||||
@@ -2436,6 +2562,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl
|
||||
@@ -2427,6 +2553,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl
|
||||
|
||||
static int is_dir_empty( int fd )
|
||||
{
|
||||
@@ -251,7 +251,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
DIR *dir;
|
||||
int empty;
|
||||
struct dirent *de;
|
||||
@@ -2443,8 +2570,13 @@ static int is_dir_empty( int fd )
|
||||
@@ -2434,8 +2561,13 @@ static int is_dir_empty( int fd )
|
||||
if ((fd = dup( fd )) == -1)
|
||||
return -1;
|
||||
|
||||
@@ -266,7 +266,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
close( fd );
|
||||
return -1;
|
||||
}
|
||||
@@ -2456,6 +2588,7 @@ static int is_dir_empty( int fd )
|
||||
@@ -2447,6 +2579,7 @@ static int is_dir_empty( int fd )
|
||||
empty = 0;
|
||||
}
|
||||
closedir( dir );
|
||||
@@ -274,7 +274,7 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
return empty;
|
||||
}
|
||||
|
||||
@@ -2494,7 +2627,7 @@ static void set_fd_disposition( struct fd *fd, unsigned int flags )
|
||||
@@ -2485,7 +2618,7 @@ static void set_fd_disposition( struct fd *fd, unsigned int flags )
|
||||
file_set_error();
|
||||
return;
|
||||
}
|
||||
@@ -284,5 +284,5 @@ index 8576882aaa9..0d5964b2427 100644
|
||||
if (!(flags & FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE) &&
|
||||
!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
|
||||
--
|
||||
2.43.0
|
||||
2.45.2
|
||||
|
||||
|
@@ -1,35 +0,0 @@
|
||||
From 00a5e4e8b55ad439d5c3d8faa876d08df8be759f Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sat, 4 Oct 2014 02:35:44 +0200
|
||||
Subject: [PATCH] ntdll: Trigger write watches before passing userdata pointer
|
||||
to wait_reply.
|
||||
|
||||
---
|
||||
dlls/ntdll/unix/server.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
|
||||
index 6af8effe9e1..6dbd9cb3ea0 100644
|
||||
--- a/dlls/ntdll/unix/server.c
|
||||
+++ b/dlls/ntdll/unix/server.c
|
||||
@@ -282,9 +282,17 @@ unsigned int server_call_unlocked( void *req_ptr )
|
||||
*/
|
||||
unsigned int CDECL wine_server_call( void *req_ptr )
|
||||
{
|
||||
+ struct __server_request_info * const req = req_ptr;
|
||||
sigset_t old_set;
|
||||
unsigned int ret;
|
||||
|
||||
+ /* trigger write watches, otherwise read() might return EFAULT */
|
||||
+ if (req->u.req.request_header.reply_size &&
|
||||
+ !virtual_check_buffer_for_write( req->reply_data, req->u.req.request_header.reply_size ))
|
||||
+ {
|
||||
+ return STATUS_ACCESS_VIOLATION;
|
||||
+ }
|
||||
+
|
||||
pthread_sigmask( SIG_BLOCK, &server_block_set, &old_set );
|
||||
ret = server_call_unlocked( req_ptr );
|
||||
pthread_sigmask( SIG_SETMASK, &old_set, NULL );
|
||||
--
|
||||
2.20.1
|
||||
|
@@ -1,26 +0,0 @@
|
||||
From 3d340d4f31aa1cb3ad6cd9e7a59118e84ab040f1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Aida=20Jonikien=C4=97?= <aidas957@gmail.com>
|
||||
Date: Fri, 8 Mar 2024 17:52:24 -0600
|
||||
Subject: [PATCH] ntdll: Trigger write watches on the "info" pointer in
|
||||
SystemInterruptInformation.
|
||||
|
||||
---
|
||||
dlls/ntdll/unix/system.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
|
||||
index 4c6c4cd23e2..9dc1ff80152 100644
|
||||
--- a/dlls/ntdll/unix/system.c
|
||||
+++ b/dlls/ntdll/unix/system.c
|
||||
@@ -2943,7 +2943,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
|
||||
len = peb->NumberOfProcessors * sizeof(SYSTEM_INTERRUPT_INFORMATION);
|
||||
if (size >= len)
|
||||
{
|
||||
- if (!info) ret = STATUS_ACCESS_VIOLATION;
|
||||
+ if (!info || !virtual_check_buffer_for_write( info, len )) ret = STATUS_ACCESS_VIOLATION;
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_GETRANDOM
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,63 +0,0 @@
|
||||
From 96831bd0bda656192510397cd18cb2c4bff5d8f4 Mon Sep 17 00:00:00 2001
|
||||
From: Elizabeth Figura <zfigura@codeweavers.com>
|
||||
Date: Thu, 22 Aug 2024 18:42:33 -0500
|
||||
Subject: [PATCH 03/10] ntdll: Install signal handlers a bit earlier.
|
||||
|
||||
The wine-staging WRITECOPY implementation needs to be able to handle write faults while relocating builtin modules loaded during process initialization.
|
||||
|
||||
Note that the comment about debug events isn't relevant anymore because these exceptions all happen on the Unix stack anyway.
|
||||
|
||||
Probably there's a better solution involving simply not write-protecting these pages until we get to PE code, but that's not worth writing when this whole patch set is moribund anyway.
|
||||
---
|
||||
dlls/ntdll/unix/loader.c | 1 +
|
||||
dlls/ntdll/unix/server.c | 5 -----
|
||||
dlls/ntdll/unix/signal_i386.c | 5 ++++-
|
||||
3 files changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
|
||||
index 92f2e2eb3a3..a6ea16bb7bb 100644
|
||||
--- a/dlls/ntdll/unix/loader.c
|
||||
+++ b/dlls/ntdll/unix/loader.c
|
||||
@@ -1866,6 +1866,7 @@ static void start_main_thread(void)
|
||||
set_load_order_app_name( main_wargv[0] );
|
||||
init_thread_stack( teb, 0, 0, 0 );
|
||||
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
||||
+ signal_init_process();
|
||||
load_ntdll();
|
||||
load_wow64_ntdll( main_image_info.Machine );
|
||||
load_apiset_dll();
|
||||
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
|
||||
index 27dbf1331aa..80504e3459c 100644
|
||||
--- a/dlls/ntdll/unix/server.c
|
||||
+++ b/dlls/ntdll/unix/server.c
|
||||
@@ -1674,11 +1674,6 @@ void server_init_process_done(void)
|
||||
send_server_task_port();
|
||||
#endif
|
||||
|
||||
- /* Install signal handlers; this cannot be done earlier, since we cannot
|
||||
- * send exceptions to the debugger before the create process event that
|
||||
- * is sent by init_process_done */
|
||||
- signal_init_process();
|
||||
-
|
||||
/* always send the native TEB */
|
||||
if (!(teb = NtCurrentTeb64())) teb = NtCurrentTeb();
|
||||
|
||||
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c
|
||||
index 61d41ec3589..b838a7a8669 100644
|
||||
--- a/dlls/ntdll/unix/signal_i386.c
|
||||
+++ b/dlls/ntdll/unix/signal_i386.c
|
||||
@@ -719,7 +719,10 @@ static inline void *init_handler( const ucontext_t *sigcontext )
|
||||
{
|
||||
struct x86_thread_data *thread_data = (struct x86_thread_data *)&teb->GdiTebBatch;
|
||||
set_fs( thread_data->fs );
|
||||
- set_gs( thread_data->gs );
|
||||
+ /* FIXME ZF: This is a bit of a hack, but it doesn't matter,
|
||||
+ * since this patch set goes in the wrong direction anyway. */
|
||||
+ if (thread_data->gs)
|
||||
+ set_gs( thread_data->gs );
|
||||
}
|
||||
#endif
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
@@ -1,105 +0,0 @@
|
||||
From 8ec23a75cf45f9b2841b76504c827d368682c126 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 4 Oct 2014 03:22:09 +0200
|
||||
Subject: [PATCH] ntdll: Properly handle PAGE_WRITECOPY protection. (try 5)
|
||||
|
||||
For now, only enable it when a special environment variable is set.
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 46 +++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 39 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index b108e49ad4d..70211bbfa3d 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -506,6 +506,21 @@ static void reserve_area( void *addr, void *end )
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
|
||||
+/* This might look like a hack, but it actually isn't - the 'experimental' version
|
||||
+ * is correct, but it already has revealed a couple of additional Wine bugs, which
|
||||
+ * were not triggered before, and there are probably some more.
|
||||
+ * To avoid breaking Wine for everyone, the new correct implementation has to be
|
||||
+ * manually enabled, until it is tested a bit more. */
|
||||
+static inline BOOL experimental_WRITECOPY( void )
|
||||
+{
|
||||
+ static int enabled = -1;
|
||||
+ if (enabled == -1)
|
||||
+ {
|
||||
+ const char *str = getenv("STAGING_WRITECOPY");
|
||||
+ enabled = str && (atoi(str) != 0);
|
||||
+ }
|
||||
+ return enabled;
|
||||
+}
|
||||
|
||||
static void mmap_init( const struct preload_info *preload_info )
|
||||
{
|
||||
@@ -1136,8 +1151,19 @@ static int get_unix_prot( BYTE vprot )
|
||||
{
|
||||
if (vprot & VPROT_READ) prot |= PROT_READ;
|
||||
if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ;
|
||||
- if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE | PROT_READ;
|
||||
if (vprot & VPROT_EXEC) prot |= PROT_EXEC | PROT_READ;
|
||||
+#if defined(__i386__)
|
||||
+ if (vprot & VPROT_WRITECOPY)
|
||||
+ {
|
||||
+ if (experimental_WRITECOPY())
|
||||
+ prot = (prot & ~PROT_WRITE) | PROT_READ;
|
||||
+ else
|
||||
+ prot |= PROT_WRITE | PROT_READ;
|
||||
+ }
|
||||
+#else
|
||||
+ /* FIXME: Architecture needs implementation of signal_init_early. */
|
||||
+ if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE | PROT_READ;
|
||||
+#endif
|
||||
if (vprot & VPROT_WRITEWATCH) prot &= ~PROT_WRITE;
|
||||
}
|
||||
if (!prot) prot = PROT_NONE;
|
||||
@@ -1817,7 +1843,7 @@ static void update_write_watches( void *base, size_t size, size_t accessed_size
|
||||
{
|
||||
TRACE( "updating watch %p-%p-%p\n", base, (char *)base + accessed_size, (char *)base + size );
|
||||
/* clear write watch flag on accessed pages */
|
||||
- set_page_vprot_bits( base, accessed_size, 0, VPROT_WRITEWATCH );
|
||||
+ set_page_vprot_bits( base, accessed_size, VPROT_WRITE, VPROT_WRITEWATCH | VPROT_WRITECOPY );
|
||||
/* restore page protections on the entire range */
|
||||
mprotect_range( base, size, 0, 0 );
|
||||
}
|
||||
@@ -4065,12 +4091,13 @@ NTSTATUS virtual_handle_fault( EXCEPTION_RECORD *rec, void *stack )
|
||||
mprotect_range( page, page_size, 0, 0 );
|
||||
}
|
||||
}
|
||||
- /* ignore fault if page is writable now */
|
||||
- if (get_unix_prot( get_page_vprot( page )) & PROT_WRITE)
|
||||
+ if (vprot & VPROT_WRITECOPY)
|
||||
{
|
||||
- if ((vprot & VPROT_WRITEWATCH) || is_write_watch_range( page, page_size ))
|
||||
- ret = STATUS_SUCCESS;
|
||||
+ set_page_vprot_bits( page, page_size, VPROT_WRITE, VPROT_WRITECOPY );
|
||||
+ mprotect_range( page, page_size, 0, 0 );
|
||||
}
|
||||
+ /* ignore fault if page is writable now */
|
||||
+ if (get_unix_prot( get_page_vprot( page ) ) & PROT_WRITE) ret = STATUS_SUCCESS;
|
||||
}
|
||||
mutex_unlock( &virtual_mutex );
|
||||
rec->ExceptionCode = ret;
|
||||
@@ -4144,11 +4171,16 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat
|
||||
{
|
||||
BYTE vprot = get_page_vprot( addr + i );
|
||||
if (vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE;
|
||||
+ if (vprot & VPROT_WRITECOPY)
|
||||
+ {
|
||||
+ vprot = (vprot & ~VPROT_WRITECOPY) | VPROT_WRITE;
|
||||
+ *has_write_watch = TRUE;
|
||||
+ }
|
||||
if (!(get_unix_prot( vprot & ~VPROT_WRITEWATCH ) & PROT_WRITE))
|
||||
return STATUS_INVALID_USER_BUFFER;
|
||||
}
|
||||
if (*has_write_watch)
|
||||
- mprotect_range( addr, size, 0, VPROT_WRITEWATCH ); /* temporarily enable write access */
|
||||
+ mprotect_range( addr, size, VPROT_WRITE, VPROT_WRITEWATCH | VPROT_WRITECOPY ); /* temporarily enable write access */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
@@ -1,92 +0,0 @@
|
||||
From 10f273da9caa0b7c814f46b76279065a956393af Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Wesie <awesie@gmail.com>
|
||||
Date: Fri, 24 Apr 2020 14:55:14 -0500
|
||||
Subject: [PATCH] ntdll: Track if a WRITECOPY page has been modified.
|
||||
|
||||
Once a WRITECOPY page is modified, it should be mapped as if it is a normal
|
||||
read-write page.
|
||||
|
||||
Signed-off-by: Andrew Wesie <awesie@gmail.com>
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 30 ++++++++++++++++++++++++------
|
||||
1 file changed, 24 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 5eadabf7dca..58fd4d0edfc 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -122,6 +122,7 @@ struct file_view
|
||||
#define VPROT_GUARD 0x10
|
||||
#define VPROT_COMMITTED 0x20
|
||||
#define VPROT_WRITEWATCH 0x40
|
||||
+#define VPROT_WRITTEN 0x80
|
||||
/* per-mapping protection flags */
|
||||
#define VPROT_ARM64EC 0x0100 /* view may contain ARM64EC code */
|
||||
#define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */
|
||||
@@ -1155,7 +1156,7 @@ static int get_unix_prot( BYTE vprot )
|
||||
#if defined(__i386__)
|
||||
if (vprot & VPROT_WRITECOPY)
|
||||
{
|
||||
- if (experimental_WRITECOPY())
|
||||
+ if (experimental_WRITECOPY() && !(vprot & VPROT_WRITTEN))
|
||||
prot = (prot & ~PROT_WRITE) | PROT_READ;
|
||||
else
|
||||
prot |= PROT_WRITE | PROT_READ;
|
||||
@@ -1672,7 +1673,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
|
||||
*/
|
||||
static DWORD get_win32_prot( BYTE vprot, unsigned int map_prot )
|
||||
{
|
||||
- DWORD ret = VIRTUAL_Win32Flags[vprot & 0x0f];
|
||||
+ DWORD ret;
|
||||
+
|
||||
+ if ((vprot & VPROT_WRITECOPY) && (vprot & VPROT_WRITTEN))
|
||||
+ vprot = (vprot & ~VPROT_WRITECOPY) | VPROT_WRITE;
|
||||
+ ret = VIRTUAL_Win32Flags[vprot & 0x0f];
|
||||
if (vprot & VPROT_GUARD) ret |= PAGE_GUARD;
|
||||
if (map_prot & SEC_NOCACHE) ret |= PAGE_NOCACHE;
|
||||
return ret;
|
||||
@@ -1778,16 +1783,29 @@ static void mprotect_range( void *base, size_t size, BYTE set, BYTE clear )
|
||||
*/
|
||||
static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vprot )
|
||||
{
|
||||
+ int unix_prot;
|
||||
+
|
||||
if (view->protect & VPROT_WRITEWATCH)
|
||||
{
|
||||
/* each page may need different protections depending on write watch flag */
|
||||
- set_page_vprot_bits( base, size, vprot & ~VPROT_WRITEWATCH, ~vprot & ~VPROT_WRITEWATCH );
|
||||
+ set_page_vprot_bits( base, size, vprot & ~VPROT_WRITEWATCH, ~vprot & ~(VPROT_WRITEWATCH|VPROT_WRITTEN) );
|
||||
mprotect_range( base, size, 0, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
+
|
||||
if (enable_write_exceptions && is_vprot_exec_write( vprot )) vprot |= VPROT_WRITEWATCH;
|
||||
- if (mprotect_exec( base, size, get_unix_prot(vprot) )) return FALSE;
|
||||
- set_page_vprot( base, size, vprot );
|
||||
+ unix_prot = get_unix_prot(vprot);
|
||||
+
|
||||
+ /* check that we can map this memory with PROT_WRITE since we cannot fail later */
|
||||
+ if (vprot & VPROT_WRITECOPY)
|
||||
+ unix_prot |= PROT_WRITE;
|
||||
+
|
||||
+ if (mprotect_exec( base, size, unix_prot )) return FALSE;
|
||||
+ /* each page may need different protections depending on writecopy */
|
||||
+ set_page_vprot_bits( base, size, vprot, ~vprot & ~VPROT_WRITTEN );
|
||||
+ if (vprot & VPROT_WRITECOPY)
|
||||
+ mprotect_range( base, size, 0, 0 );
|
||||
+
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -4093,7 +4111,7 @@ NTSTATUS virtual_handle_fault( EXCEPTION_RECORD *rec, void *stack )
|
||||
}
|
||||
if (vprot & VPROT_WRITECOPY)
|
||||
{
|
||||
- set_page_vprot_bits( page, page_size, VPROT_WRITE, VPROT_WRITECOPY );
|
||||
+ set_page_vprot_bits( page, page_size, VPROT_WRITE | VPROT_WRITTEN, VPROT_WRITECOPY );
|
||||
mprotect_range( page, page_size, 0, 0 );
|
||||
}
|
||||
/* ignore fault if page is writable now */
|
||||
--
|
||||
2.45.2
|
||||
|
@@ -1,39 +0,0 @@
|
||||
From b083e23347c3f50112410d1c886eb17c75f34a4e Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Wesie <awesie@gmail.com>
|
||||
Date: Fri, 24 Apr 2020 14:55:17 -0500
|
||||
Subject: [PATCH] ntdll: Report unmodified WRITECOPY pages as shared.
|
||||
|
||||
We also need to clear the modified bit after we clear memory in map_image to
|
||||
match the behavior of Windows.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48665
|
||||
Signed-off-by: Andrew Wesie <awesie@gmail.com>
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index b3d8b2f7a95..568a0cef74c 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -2897,6 +2897,8 @@ static NTSTATUS map_image_into_view( struct file_view *view, const WCHAR *filena
|
||||
ptr + sec->VirtualAddress + file_size,
|
||||
ptr + sec->VirtualAddress + end );
|
||||
memset( ptr + sec->VirtualAddress + file_size, 0, end - file_size );
|
||||
+ /* clear WRITTEN mark so QueryVirtualMemory returns correct values */
|
||||
+ set_page_vprot_bits( ptr + sec->VirtualAddress + file_size, 1, 0, VPROT_WRITTEN );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5326,7 +5328,7 @@ static void fill_working_set_info( struct fill_working_set_info_data *d, struct
|
||||
pagemap = d->pm_buffer[page - d->buffer_start];
|
||||
|
||||
p->VirtualAttributes.Valid = !(vprot & VPROT_GUARD) && (vprot & 0x0f) && (pagemap >> 63);
|
||||
- p->VirtualAttributes.Shared = !is_view_valloc( view ) && ((pagemap >> 61) & 1);
|
||||
+ p->VirtualAttributes.Shared = (!is_view_valloc( view ) && ((pagemap >> 61) & 1)) || ((view->protect & VPROT_WRITECOPY) && !(vprot & VPROT_WRITTEN));
|
||||
if (p->VirtualAttributes.Shared && p->VirtualAttributes.Valid)
|
||||
p->VirtualAttributes.ShareCount = 1; /* FIXME */
|
||||
if (p->VirtualAttributes.Valid)
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,65 +0,0 @@
|
||||
From 1d8b9ce07aaafd3184a118c8d986b54617571c7b Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Wesie <awesie@gmail.com>
|
||||
Date: Tue, 28 Apr 2020 03:27:16 -0500
|
||||
Subject: [PATCH] ntdll: Fallback to copy pages for WRITECOPY.
|
||||
|
||||
When a file is first mapped, whether it is mapped shared or private is
|
||||
determined by whether it is mapped with WRITECOPY. If the page protection later
|
||||
changes to include WRITECOPY, then virtual_handle_fault needs to change the page
|
||||
from shared to private. The only way to do this on Linux is to copy the page
|
||||
contents to a temporary location, map an anonymous page to the old location,
|
||||
then copy the contents to the new page.
|
||||
|
||||
Signed-off-by: Andrew Wesie <awesie@gmail.com>
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 25 +++++++++++++++++++++----
|
||||
1 file changed, 21 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 71fe33cdb0e..ba5701d7bfe 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -1796,8 +1796,9 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr
|
||||
if (enable_write_exceptions && is_vprot_exec_write( vprot )) vprot |= VPROT_WRITEWATCH;
|
||||
unix_prot = get_unix_prot(vprot);
|
||||
|
||||
- /* check that we can map this memory with PROT_WRITE since we cannot fail later */
|
||||
- if (vprot & VPROT_WRITECOPY)
|
||||
+ /* check that we can map this memory with PROT_WRITE since we cannot fail later,
|
||||
+ * but we fallback to copying pages for read-only mappings in virtual_handle_fault */
|
||||
+ if ((vprot & VPROT_WRITECOPY) && (view->protect & VPROT_WRITECOPY))
|
||||
unix_prot |= PROT_WRITE;
|
||||
|
||||
if (mprotect_exec( base, size, unix_prot )) return FALSE;
|
||||
@@ -4111,10 +4112,26 @@ NTSTATUS virtual_handle_fault( EXCEPTION_RECORD *rec, void *stack )
|
||||
mprotect_range( page, page_size, 0, 0 );
|
||||
}
|
||||
}
|
||||
- if (vprot & VPROT_WRITECOPY)
|
||||
+ if ((vprot & VPROT_WRITECOPY) && (vprot & VPROT_COMMITTED))
|
||||
{
|
||||
+ struct file_view *view = find_view( page, 0 );
|
||||
+
|
||||
set_page_vprot_bits( page, page_size, VPROT_WRITE | VPROT_WRITTEN, VPROT_WRITECOPY );
|
||||
- mprotect_range( page, page_size, 0, 0 );
|
||||
+ if (view->protect & VPROT_WRITECOPY)
|
||||
+ {
|
||||
+ mprotect_range( page, page_size, 0, 0 );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ static BYTE *temp_page = NULL;
|
||||
+ if (!temp_page)
|
||||
+ temp_page = anon_mmap_alloc( page_size, PROT_READ | PROT_WRITE );
|
||||
+
|
||||
+ /* original mapping is shared, replace with a private page */
|
||||
+ memcpy( temp_page, page, page_size );
|
||||
+ anon_mmap_fixed( page, page_size, get_unix_prot( vprot | VPROT_WRITE | VPROT_WRITTEN ), 0 );
|
||||
+ memcpy( page, temp_page, page_size );
|
||||
+ }
|
||||
}
|
||||
/* ignore fault if page is writable now */
|
||||
if (get_unix_prot( get_page_vprot( page ) ) & PROT_WRITE) ret = STATUS_SUCCESS;
|
||||
--
|
||||
2.45.2
|
||||
|
@@ -1,116 +0,0 @@
|
||||
From ada6b6d8363f2eeac8d8ed99d50f61610b047efe Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Wesie <awesie@gmail.com>
|
||||
Date: Mon, 27 Apr 2020 15:32:22 +0300
|
||||
Subject: [PATCH] kernel32/tests, psapi/tests: Update tests.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/virtual.c | 19 ++-----------------
|
||||
dlls/psapi/tests/psapi_main.c | 3 +++
|
||||
2 files changed, 5 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
|
||||
index 365194b9065..8055e93faa0 100644
|
||||
--- a/dlls/kernel32/tests/virtual.c
|
||||
+++ b/dlls/kernel32/tests/virtual.c
|
||||
@@ -3604,9 +3604,7 @@ static void test_CreateFileMapping_protection(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = VirtualQuery(base, &info, sizeof(info));
|
||||
ok(ret, "VirtualQuery failed %ld\n", GetLastError());
|
||||
- /* FIXME: remove the condition below once Wine is fixed */
|
||||
- todo_wine_if (td[i].prot == PAGE_WRITECOPY || td[i].prot == PAGE_EXECUTE_WRITECOPY)
|
||||
- ok(info.Protect == td[i].prot_after_write, "%ld: got %#lx != expected %#lx\n", i, info.Protect, td[i].prot_after_write);
|
||||
+ ok(info.Protect == td[i].prot_after_write, "%ld: got %#lx != expected %#lx\n", i, info.Protect, td[i].prot_after_write);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3620,9 +3618,7 @@ static void test_CreateFileMapping_protection(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = VirtualProtect(base, si.dwPageSize, PAGE_NOACCESS, &old_prot);
|
||||
ok(ret, "%ld: VirtualProtect error %ld\n", i, GetLastError());
|
||||
- /* FIXME: remove the condition below once Wine is fixed */
|
||||
- todo_wine_if (td[i].prot == PAGE_WRITECOPY || td[i].prot == PAGE_EXECUTE_WRITECOPY)
|
||||
- ok(old_prot == td[i].prot_after_write, "%ld: got %#lx != expected %#lx\n", i, old_prot, td[i].prot_after_write);
|
||||
+ ok(old_prot == td[i].prot_after_write, "%ld: got %#lx != expected %#lx\n", i, old_prot, td[i].prot_after_write);
|
||||
|
||||
UnmapViewOfFile(base);
|
||||
}
|
||||
@@ -3975,15 +3971,12 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
|
||||
continue;
|
||||
}
|
||||
|
||||
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
||||
ok(ret, "VirtualProtect error %ld, map %#lx, view %#lx, requested prot %#lx\n", GetLastError(), page_prot[i], view[j].prot, page_prot[k]);
|
||||
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
||||
ok(old_prot == prev_prot, "got %#lx, expected %#lx\n", old_prot, prev_prot);
|
||||
prev_prot = actual_prot;
|
||||
|
||||
ret = VirtualQuery(base, &info, sizeof(info));
|
||||
ok(ret, "%ld: VirtualQuery failed %ld\n", j, GetLastError());
|
||||
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
||||
ok(info.Protect == actual_prot,
|
||||
"VirtualProtect wrong prot, map %#lx, view %#lx, requested prot %#lx got %#lx\n",
|
||||
page_prot[i], view[j].prot, page_prot[k], info.Protect );
|
||||
@@ -4038,15 +4031,12 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
|
||||
if (!anon_mapping && is_compatible_protection(alloc_prot, PAGE_WRITECOPY))
|
||||
{
|
||||
ret = VirtualProtect(base, sec_flags & SEC_IMAGE ? si.dwPageSize : 2*si.dwPageSize, PAGE_WRITECOPY, &old_prot);
|
||||
- todo_wine_if(readonly && view[j].prot != PAGE_WRITECOPY)
|
||||
ok(ret, "VirtualProtect error %ld, map %#lx, view %#lx\n", GetLastError(), page_prot[i], view[j].prot);
|
||||
if (ret) *(DWORD*)base = 0xdeadbeef;
|
||||
ret = VirtualQuery(base, &info, sizeof(info));
|
||||
ok(ret, "%ld: VirtualQuery failed %ld\n", j, GetLastError());
|
||||
- todo_wine
|
||||
ok(info.Protect == PAGE_READWRITE, "VirtualProtect wrong prot, map %#lx, view %#lx got %#lx\n",
|
||||
page_prot[i], view[j].prot, info.Protect );
|
||||
- todo_wine_if (!(sec_flags & SEC_IMAGE))
|
||||
ok(info.RegionSize == si.dwPageSize, "wrong region size %#Ix after write, map %#lx, view %#lx got %#lx\n",
|
||||
info.RegionSize, page_prot[i], view[j].prot, info.Protect );
|
||||
|
||||
@@ -4057,7 +4047,6 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
|
||||
{
|
||||
ret = VirtualQuery((char*)base + si.dwPageSize, &info, sizeof(info));
|
||||
ok(ret, "%ld: VirtualQuery failed %ld\n", j, GetLastError());
|
||||
- todo_wine_if(readonly && view[j].prot != PAGE_WRITECOPY)
|
||||
ok(info.Protect == PAGE_WRITECOPY, "wrong prot, map %#lx, view %#lx got %#lx\n",
|
||||
page_prot[i], view[j].prot, info.Protect);
|
||||
}
|
||||
@@ -4077,14 +4066,11 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
|
||||
continue;
|
||||
}
|
||||
|
||||
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
||||
ok(ret, "VirtualProtect error %ld, map %#lx, view %#lx, requested prot %#lx\n", GetLastError(), page_prot[i], view[j].prot, page_prot[k]);
|
||||
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
||||
ok(old_prot == prev_prot, "got %#lx, expected %#lx\n", old_prot, prev_prot);
|
||||
|
||||
ret = VirtualQuery(base, &info, sizeof(info));
|
||||
ok(ret, "%ld: VirtualQuery failed %ld\n", j, GetLastError());
|
||||
- todo_wine_if( map_prot_written( page_prot[k] ) != actual_prot )
|
||||
ok(info.Protect == map_prot_written( page_prot[k] ),
|
||||
"VirtualProtect wrong prot, map %#lx, view %#lx, requested prot %#lx got %#lx\n",
|
||||
page_prot[i], view[j].prot, page_prot[k], info.Protect );
|
||||
@@ -4125,7 +4111,6 @@ static void test_mappings(void)
|
||||
SetFilePointer(hfile, 0, NULL, FILE_BEGIN);
|
||||
ok(ReadFile(hfile, &data, sizeof(data), &num_bytes, NULL), "ReadFile failed\n");
|
||||
ok(num_bytes == sizeof(data), "num_bytes = %ld\n", num_bytes);
|
||||
- todo_wine
|
||||
ok(!data, "data = %lx\n", data);
|
||||
|
||||
CloseHandle( hfile );
|
||||
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
|
||||
index 185a4062092..1721968395d 100644
|
||||
--- a/dlls/psapi/tests/psapi_main.c
|
||||
+++ b/dlls/psapi/tests/psapi_main.c
|
||||
@@ -821,6 +821,9 @@ static void test_QueryWorkingSetEx(void)
|
||||
check_QueryWorkingSetEx(addr, "exe,readonly1", 0, 0, 1, TRUE);
|
||||
|
||||
*(volatile char *)addr;
|
||||
+ check_QueryWorkingSetEx(addr, "exe,readonly2", 1, PAGE_READONLY, 1, FALSE);
|
||||
+
|
||||
+ ret = VirtualProtect(addr, 0x1000, PAGE_EXECUTE_READWRITE, &prot);
|
||||
ok(ret, "VirtualProtect failed with %ld\n", GetLastError());
|
||||
check_QueryWorkingSetEx(addr, "exe,readonly2", 1, PAGE_READONLY, 1, FALSE);
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
@@ -0,0 +1,28 @@
|
||||
From 321e3228c6c28256bfb209efdc372b61f9c8535f Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Maurer <dark.shadow4@web.de>
|
||||
Date: Thu, 21 Dec 2023 20:09:23 +0100
|
||||
Subject: [PATCH] kernelbase: Correct return value in VirtualProtect for
|
||||
PAGE_WRITECOPY
|
||||
|
||||
---
|
||||
dlls/kernelbase/memory.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c
|
||||
index 4f4bba9a13b..de42395b33b 100644
|
||||
--- a/dlls/kernelbase/memory.c
|
||||
+++ b/dlls/kernelbase/memory.c
|
||||
@@ -481,7 +481,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH VirtualLock( void *addr, SIZE_T size )
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH VirtualProtect( void *addr, SIZE_T size, DWORD new_prot, DWORD *old_prot )
|
||||
{
|
||||
- return VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
|
||||
+ BOOL ret = VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
|
||||
+ if (*old_prot == PAGE_WRITECOPY) *old_prot = PAGE_READWRITE;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -0,0 +1,30 @@
|
||||
From d455916aec7649a816deb36c303341a6c7732a97 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Aida=20Jonikien=C4=97?= <aidas957@gmail.com>
|
||||
Date: Fri, 26 Jul 2024 20:33:57 +0300
|
||||
Subject: [PATCH] kernelbase: Handle NULL old_prot parameter in
|
||||
VirtualProtect().
|
||||
|
||||
This fixes a segfault when launching any game with the EA Desktop application.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56694
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56711
|
||||
---
|
||||
dlls/kernelbase/memory.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c
|
||||
index 2b0e674bb9b..d1408cf4c0e 100644
|
||||
--- a/dlls/kernelbase/memory.c
|
||||
+++ b/dlls/kernelbase/memory.c
|
||||
@@ -548,7 +548,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH VirtualLock( void *addr, SIZE_T size )
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH VirtualProtect( void *addr, SIZE_T size, DWORD new_prot, DWORD *old_prot )
|
||||
{
|
||||
BOOL ret = VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
|
||||
- if (*old_prot == PAGE_WRITECOPY) *old_prot = PAGE_READWRITE;
|
||||
+ if (old_prot && *old_prot == PAGE_WRITECOPY) *old_prot = PAGE_READWRITE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 94f5ff2ca72ce78d339f1247adc58a10b1690af4 Mon Sep 17 00:00:00 2001
|
||||
From 2b9d0c9e955f188d5e5ba2311ed96ff9821f7d44 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 30 Mar 2015 12:32:34 +0200
|
||||
Subject: [PATCH] server: Add a helper function set_sd_from_token_internal to
|
||||
@@ -10,10 +10,10 @@ Subject: [PATCH] server: Add a helper function set_sd_from_token_internal to
|
||||
2 files changed, 40 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/server/object.c b/server/object.c
|
||||
index 907bc087444..494d6e94569 100644
|
||||
index 1a3bff65969..d46dbf01b6f 100644
|
||||
--- a/server/object.c
|
||||
+++ b/server/object.c
|
||||
@@ -538,8 +538,9 @@ struct security_descriptor *default_get_sd( struct object *obj )
|
||||
@@ -563,8 +563,9 @@ struct security_descriptor *default_get_sd( struct object *obj )
|
||||
return obj->sd;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ index 907bc087444..494d6e94569 100644
|
||||
{
|
||||
struct security_descriptor new_sd, *new_sd_ptr;
|
||||
int present;
|
||||
@@ -548,8 +549,6 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
@@ -573,8 +574,6 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
struct acl *replaced_sacl = NULL;
|
||||
char *ptr;
|
||||
|
||||
@@ -34,7 +34,7 @@ index 907bc087444..494d6e94569 100644
|
||||
new_sd.control = sd->control & ~SE_SELF_RELATIVE;
|
||||
|
||||
if (set_info & OWNER_SECURITY_INFORMATION && sd->owner_len)
|
||||
@@ -557,10 +556,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
@@ -582,10 +581,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
owner = sd_get_owner( sd );
|
||||
new_sd.owner_len = sd->owner_len;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ index 907bc087444..494d6e94569 100644
|
||||
}
|
||||
else if (token)
|
||||
{
|
||||
@@ -574,10 +573,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
@@ -599,10 +598,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
group = sd_get_group( sd );
|
||||
new_sd.group_len = sd->group_len;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ index 907bc087444..494d6e94569 100644
|
||||
}
|
||||
else if (token)
|
||||
{
|
||||
@@ -595,20 +594,20 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
@@ -620,20 +619,20 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
else if (set_info & LABEL_SECURITY_INFORMATION && present)
|
||||
{
|
||||
const struct acl *old_sacl = NULL;
|
||||
@@ -88,7 +88,7 @@ index 907bc087444..494d6e94569 100644
|
||||
}
|
||||
else
|
||||
new_sd.sacl_len = 0;
|
||||
@@ -622,12 +621,12 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
@@ -647,12 +646,12 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -104,7 +104,7 @@ index 907bc087444..494d6e94569 100644
|
||||
}
|
||||
else if (token)
|
||||
{
|
||||
@@ -643,7 +642,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
@@ -668,7 +667,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
if (!ptr)
|
||||
{
|
||||
free( replaced_sacl );
|
||||
@@ -113,8 +113,8 @@ index 907bc087444..494d6e94569 100644
|
||||
}
|
||||
new_sd_ptr = (struct security_descriptor*)ptr;
|
||||
|
||||
@@ -658,9 +657,25 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
memcpy( ptr, dacl, new_sd.dacl_len );
|
||||
@@ -679,9 +678,25 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
|
||||
mem_append( ptr, dacl, new_sd.dacl_len );
|
||||
|
||||
free( replaced_sacl );
|
||||
- free( obj->sd );
|
||||
@@ -143,10 +143,10 @@ index 907bc087444..494d6e94569 100644
|
||||
|
||||
/** Set the security descriptor using the current primary token for defaults. */
|
||||
diff --git a/server/object.h b/server/object.h
|
||||
index c98e45125a0..f4261d0d585 100644
|
||||
index e38913d430d..e61d29d91ea 100644
|
||||
--- a/server/object.h
|
||||
+++ b/server/object.h
|
||||
@@ -173,6 +173,9 @@ extern struct fd *no_get_fd( struct object *obj );
|
||||
@@ -175,6 +175,9 @@ extern struct fd *no_get_fd( struct object *obj );
|
||||
extern unsigned int default_map_access( struct object *obj, unsigned int access );
|
||||
extern struct security_descriptor *default_get_sd( struct object *obj );
|
||||
extern int default_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info );
|
||||
@@ -157,5 +157,5 @@ index c98e45125a0..f4261d0d585 100644
|
||||
unsigned int set_info, struct token *token );
|
||||
extern WCHAR *no_get_full_name( struct object *obj, data_size_t *ret_len );
|
||||
--
|
||||
2.34.1
|
||||
2.45.2
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 075859526b7d11f65c195a4cc0f2c7b954fec6af Mon Sep 17 00:00:00 2001
|
||||
From 2fef300f9d8c19f4344a90d842c109ad35d4b593 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 3 Sep 2024 07:18:49 +1000
|
||||
Subject: [PATCH] Updated vkd3d to 6d28cc131b0cad61c681aed6b9f6611a12b352d1.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 9ef5dd9c786b5614acff15554de4b1ba2e5874c7 Mon Sep 17 00:00:00 2001
|
||||
From f04037713b67a027bb91fdb4c5424e629b189daa Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 5 Sep 2024 06:59:11 +1000
|
||||
Subject: [PATCH] Updated vkd3d to 0a6bcf5da78863cc6402756a429b21b623400790.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From a6e448523e93d3ade908df12b1d8675b19420de4 Mon Sep 17 00:00:00 2001
|
||||
From e48d811509a661939136b1567d165fc400a38784 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 6 Sep 2024 08:13:50 +1000
|
||||
Subject: [PATCH] Updated vkd3d to bfd1fc9cd6cf9cf4e9c23b4ffad2ba8a3282c1f9.
|
||||
|
@@ -0,0 +1,485 @@
|
||||
From 974ebb67f03cda95a36c014378acd627f913f47b Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Wed, 11 Sep 2024 07:14:31 +1000
|
||||
Subject: [PATCH] Updated vkd3d to 3b4e0ce8e94cd4091b9f2fe80d86588b64c88111.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 10 ++-
|
||||
libs/vkd3d/libs/vkd3d-shader/dxil.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/fx.c | 8 ++-
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 15 ++++
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 69 ++++++++++---------
|
||||
libs/vkd3d/libs/vkd3d-shader/tpf.c | 19 +++++
|
||||
.../libs/vkd3d-shader/vkd3d_shader_private.h | 4 +-
|
||||
libs/vkd3d/libs/vkd3d/command.c | 20 ++++--
|
||||
libs/vkd3d/libs/vkd3d/state.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d/vkd3d_private.h | 1 -
|
||||
10 files changed, 100 insertions(+), 50 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
index de5f28c1815..a41182e1f4a 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
@@ -1481,10 +1481,8 @@ struct d3dbc_compiler
|
||||
|
||||
static uint32_t sm1_version(enum vkd3d_shader_type type, unsigned int major, unsigned int minor)
|
||||
{
|
||||
- if (type == VKD3D_SHADER_TYPE_VERTEX)
|
||||
- return D3DVS_VERSION(major, minor);
|
||||
- else
|
||||
- return D3DPS_VERSION(major, minor);
|
||||
+ return vkd3d_make_u32(vkd3d_make_u16(minor, major),
|
||||
+ type == VKD3D_SHADER_TYPE_VERTEX ? VKD3D_SM1_VS : VKD3D_SM1_PS);
|
||||
}
|
||||
|
||||
D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
|
||||
@@ -1867,8 +1865,8 @@ void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buff
|
||||
|
||||
static uint32_t sm1_encode_register_type(enum vkd3d_shader_register_type type)
|
||||
{
|
||||
- return ((type << D3DSP_REGTYPE_SHIFT) & D3DSP_REGTYPE_MASK)
|
||||
- | ((type << D3DSP_REGTYPE_SHIFT2) & D3DSP_REGTYPE_MASK2);
|
||||
+ return ((type << VKD3D_SM1_REGISTER_TYPE_SHIFT) & VKD3D_SM1_REGISTER_TYPE_MASK)
|
||||
+ | ((type << VKD3D_SM1_REGISTER_TYPE_SHIFT2) & VKD3D_SM1_REGISTER_TYPE_MASK2);
|
||||
}
|
||||
|
||||
struct sm1_instruction
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
index 4a17c62292b..1c62a305d30 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
@@ -3888,7 +3888,7 @@ static void sm6_parser_init_signature(struct sm6_parser *sm6, const struct shade
|
||||
if (is_control_point)
|
||||
{
|
||||
if (reg_type == VKD3DSPR_OUTPUT)
|
||||
- param->reg.idx[count].rel_addr = instruction_array_create_outpointid_param(&sm6->p.program->instructions);
|
||||
+ param->reg.idx[count].rel_addr = vsir_program_create_outpointid_param(sm6->p.program);
|
||||
param->reg.idx[count++].offset = 0;
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/fx.c b/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
index e3ab71fb386..2c2e486aa0e 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
@@ -38,6 +38,7 @@ struct type_entry
|
||||
struct list entry;
|
||||
const char *name;
|
||||
uint32_t elements_count;
|
||||
+ uint32_t modifiers;
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
@@ -278,9 +279,9 @@ static void write_fx_4_state_block(struct hlsl_ir_var *var, unsigned int block_i
|
||||
|
||||
static uint32_t write_type(const struct hlsl_type *type, struct fx_write_context *fx)
|
||||
{
|
||||
+ unsigned int elements_count, modifiers;
|
||||
const struct hlsl_type *element_type;
|
||||
struct type_entry *type_entry;
|
||||
- unsigned int elements_count;
|
||||
const char *name;
|
||||
|
||||
VKD3D_ASSERT(fx->ctx->profile->major_version >= 4);
|
||||
@@ -297,6 +298,7 @@ static uint32_t write_type(const struct hlsl_type *type, struct fx_write_context
|
||||
}
|
||||
|
||||
name = get_fx_4_type_name(element_type);
|
||||
+ modifiers = element_type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(type_entry, &fx->types, struct type_entry, entry)
|
||||
{
|
||||
@@ -306,6 +308,9 @@ static uint32_t write_type(const struct hlsl_type *type, struct fx_write_context
|
||||
if (type_entry->elements_count != elements_count)
|
||||
continue;
|
||||
|
||||
+ if (type_entry->modifiers != modifiers)
|
||||
+ continue;
|
||||
+
|
||||
return type_entry->offset;
|
||||
}
|
||||
|
||||
@@ -315,6 +320,7 @@ static uint32_t write_type(const struct hlsl_type *type, struct fx_write_context
|
||||
type_entry->offset = write_fx_4_type(type, fx);
|
||||
type_entry->name = name;
|
||||
type_entry->elements_count = elements_count;
|
||||
+ type_entry->modifiers = modifiers;
|
||||
|
||||
list_add_tail(&fx->types, &type_entry->entry);
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index 816d992afa8..38642025b52 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -4152,6 +4152,20 @@ static bool intrinsic_log2(struct hlsl_ctx *ctx,
|
||||
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_LOG2, arg, loc);
|
||||
}
|
||||
|
||||
+static bool intrinsic_mad(struct hlsl_ctx *ctx,
|
||||
+ const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
+{
|
||||
+ struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0};
|
||||
+
|
||||
+ if (!elementwise_intrinsic_convert_args(ctx, params, loc))
|
||||
+ return false;
|
||||
+
|
||||
+ args[0] = params->args[0];
|
||||
+ args[1] = params->args[1];
|
||||
+ args[2] = params->args[2];
|
||||
+ return add_expr(ctx, params->instrs, HLSL_OP3_MAD, args, args[0]->data_type, loc);
|
||||
+}
|
||||
+
|
||||
static bool intrinsic_max(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -5053,6 +5067,7 @@ intrinsic_functions[] =
|
||||
{"log", 1, true, intrinsic_log},
|
||||
{"log10", 1, true, intrinsic_log10},
|
||||
{"log2", 1, true, intrinsic_log2},
|
||||
+ {"mad", 3, true, intrinsic_mad},
|
||||
{"max", 2, true, intrinsic_max},
|
||||
{"min", 2, true, intrinsic_min},
|
||||
{"mul", 2, true, intrinsic_mul},
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index a483c25f3ad..68f2e2f795e 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -551,9 +551,11 @@ static const struct vkd3d_shader_varying_map *find_varying_map(
|
||||
}
|
||||
|
||||
static enum vkd3d_result vsir_program_remap_output_signature(struct vsir_program *program,
|
||||
- const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context)
|
||||
+ struct vsir_normalisation_context *ctx)
|
||||
{
|
||||
- const struct vkd3d_shader_location location = {.source_name = compile_info->source_name};
|
||||
+ const struct vkd3d_shader_location location = {.source_name = ctx->compile_info->source_name};
|
||||
+ struct vkd3d_shader_message_context *message_context = ctx->message_context;
|
||||
+ const struct vkd3d_shader_compile_info *compile_info = ctx->compile_info;
|
||||
struct shader_signature *signature = &program->output_signature;
|
||||
const struct vkd3d_shader_varying_map_info *varying_map;
|
||||
unsigned int i;
|
||||
@@ -862,9 +864,10 @@ static bool vsir_instruction_init_label(struct vkd3d_shader_instruction *ins,
|
||||
return true;
|
||||
}
|
||||
|
||||
-static enum vkd3d_result instruction_array_flatten_hull_shader_phases(struct vkd3d_shader_instruction_array *src_instructions)
|
||||
+static enum vkd3d_result vsir_program_flatten_hull_shader_phases(struct vsir_program *program,
|
||||
+ struct vsir_normalisation_context *ctx)
|
||||
{
|
||||
- struct hull_flattener flattener = {*src_instructions};
|
||||
+ struct hull_flattener flattener = {program->instructions};
|
||||
struct vkd3d_shader_instruction_array *instructions;
|
||||
struct shader_phase_location_array locations;
|
||||
enum vkd3d_result result = VKD3D_OK;
|
||||
@@ -886,7 +889,7 @@ static enum vkd3d_result instruction_array_flatten_hull_shader_phases(struct vkd
|
||||
vsir_instruction_init(&instructions->elements[instructions->count++], &flattener.last_ret_location, VKD3DSIH_RET);
|
||||
}
|
||||
|
||||
- *src_instructions = flattener.instructions;
|
||||
+ program->instructions = flattener.instructions;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -902,9 +905,9 @@ static bool control_point_normaliser_is_in_control_point_phase(const struct cont
|
||||
return normaliser->phase == VKD3DSIH_HS_CONTROL_POINT_PHASE;
|
||||
}
|
||||
|
||||
-struct vkd3d_shader_src_param *instruction_array_create_outpointid_param(
|
||||
- struct vkd3d_shader_instruction_array *instructions)
|
||||
+struct vkd3d_shader_src_param *vsir_program_create_outpointid_param(struct vsir_program *program)
|
||||
{
|
||||
+ struct vkd3d_shader_instruction_array *instructions = &program->instructions;
|
||||
struct vkd3d_shader_src_param *rel_addr;
|
||||
|
||||
if (instructions->outpointid_param)
|
||||
@@ -1001,7 +1004,7 @@ static enum vkd3d_result control_point_normaliser_emit_hs_input(struct control_p
|
||||
}
|
||||
|
||||
static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_io(
|
||||
- struct vkd3d_shader_instruction_array *src_instructions, const struct shader_signature *input_signature)
|
||||
+ struct vsir_program *program, struct vsir_normalisation_context *ctx)
|
||||
{
|
||||
struct vkd3d_shader_instruction_array *instructions;
|
||||
struct control_point_normaliser normaliser;
|
||||
@@ -1011,12 +1014,12 @@ static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_i
|
||||
enum vkd3d_result ret;
|
||||
unsigned int i, j;
|
||||
|
||||
- if (!(normaliser.outpointid_param = instruction_array_create_outpointid_param(src_instructions)))
|
||||
+ if (!(normaliser.outpointid_param = vsir_program_create_outpointid_param(program)))
|
||||
{
|
||||
ERR("Failed to allocate src param.\n");
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
- normaliser.instructions = *src_instructions;
|
||||
+ normaliser.instructions = program->instructions;
|
||||
instructions = &normaliser.instructions;
|
||||
normaliser.phase = VKD3DSIH_INVALID;
|
||||
|
||||
@@ -1053,22 +1056,22 @@ static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_i
|
||||
input_control_point_count = ins->declaration.count;
|
||||
break;
|
||||
case VKD3DSIH_HS_CONTROL_POINT_PHASE:
|
||||
- *src_instructions = normaliser.instructions;
|
||||
+ program->instructions = normaliser.instructions;
|
||||
return VKD3D_OK;
|
||||
case VKD3DSIH_HS_FORK_PHASE:
|
||||
case VKD3DSIH_HS_JOIN_PHASE:
|
||||
/* ins may be relocated if the instruction array expands. */
|
||||
location = ins->location;
|
||||
- ret = control_point_normaliser_emit_hs_input(&normaliser, input_signature,
|
||||
+ ret = control_point_normaliser_emit_hs_input(&normaliser, &program->input_signature,
|
||||
input_control_point_count, i, &location);
|
||||
- *src_instructions = normaliser.instructions;
|
||||
+ program->instructions = normaliser.instructions;
|
||||
return ret;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- *src_instructions = normaliser.instructions;
|
||||
+ program->instructions = normaliser.instructions;
|
||||
return VKD3D_OK;
|
||||
}
|
||||
|
||||
@@ -1398,6 +1401,8 @@ static bool shader_signature_merge(struct shader_signature *s, uint8_t range_map
|
||||
else
|
||||
e->interpolation_mode = f->interpolation_mode;
|
||||
}
|
||||
+
|
||||
+ vkd3d_free((void *)f->semantic_name);
|
||||
}
|
||||
}
|
||||
element_count = new_count;
|
||||
@@ -1425,6 +1430,12 @@ static bool shader_signature_merge(struct shader_signature *s, uint8_t range_map
|
||||
TRACE("Merging %s, base reg %u, count %u.\n", e->semantic_name, e->register_index, register_count);
|
||||
e->register_count = register_count;
|
||||
e->mask = signature_element_range_expand_mask(e, register_count, range_map);
|
||||
+
|
||||
+ for (j = 1; j < register_count; ++j)
|
||||
+ {
|
||||
+ f = &elements[i + j];
|
||||
+ vkd3d_free((void *)f->semantic_name);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
element_count = new_count;
|
||||
@@ -1761,8 +1772,9 @@ static bool use_flat_interpolation(const struct vsir_program *program,
|
||||
}
|
||||
|
||||
static enum vkd3d_result vsir_program_normalise_io_registers(struct vsir_program *program,
|
||||
- struct vkd3d_shader_message_context *message_context)
|
||||
+ struct vsir_normalisation_context *ctx)
|
||||
{
|
||||
+ struct vkd3d_shader_message_context *message_context = ctx->message_context;
|
||||
struct io_normaliser normaliser = {program->instructions};
|
||||
struct vkd3d_shader_instruction *ins;
|
||||
unsigned int i;
|
||||
@@ -1909,7 +1921,8 @@ static void shader_register_normalise_flat_constants(struct vkd3d_shader_src_par
|
||||
param->reg.idx_count = 3;
|
||||
}
|
||||
|
||||
-static enum vkd3d_result instruction_array_normalise_flat_constants(struct vsir_program *program)
|
||||
+static enum vkd3d_result vsir_program_normalise_flat_constants(struct vsir_program *program,
|
||||
+ struct vsir_normalisation_context *ctx)
|
||||
{
|
||||
struct flat_constants_normaliser normaliser = {0};
|
||||
unsigned int i, j;
|
||||
@@ -6657,30 +6670,20 @@ enum vkd3d_result vsir_program_normalise(struct vsir_program *program, uint64_t
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (ctx.result < 0)
|
||||
- return ctx.result;
|
||||
-
|
||||
if (program->shader_version.type != VKD3D_SHADER_TYPE_PIXEL)
|
||||
- {
|
||||
- if ((result = vsir_program_remap_output_signature(program, compile_info, message_context)) < 0)
|
||||
- return result;
|
||||
- }
|
||||
+ vsir_transform(&ctx, vsir_program_remap_output_signature);
|
||||
|
||||
if (program->shader_version.type == VKD3D_SHADER_TYPE_HULL)
|
||||
{
|
||||
- if ((result = instruction_array_flatten_hull_shader_phases(&program->instructions)) < 0)
|
||||
- return result;
|
||||
-
|
||||
- if ((result = instruction_array_normalise_hull_shader_control_point_io(&program->instructions,
|
||||
- &program->input_signature)) < 0)
|
||||
- return result;
|
||||
+ vsir_transform(&ctx, vsir_program_flatten_hull_shader_phases);
|
||||
+ vsir_transform(&ctx, instruction_array_normalise_hull_shader_control_point_io);
|
||||
}
|
||||
|
||||
- if ((result = vsir_program_normalise_io_registers(program, message_context)) < 0)
|
||||
- return result;
|
||||
+ vsir_transform(&ctx, vsir_program_normalise_io_registers);
|
||||
+ vsir_transform(&ctx, vsir_program_normalise_flat_constants);
|
||||
|
||||
- if ((result = instruction_array_normalise_flat_constants(program)) < 0)
|
||||
- return result;
|
||||
+ if (ctx.result < 0)
|
||||
+ return ctx.result;
|
||||
|
||||
remove_dead_code(program);
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
index c61086419a6..b76a596bb60 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
@@ -2814,6 +2814,7 @@ bool sysval_semantic_from_hlsl(enum vkd3d_shader_sysval_semantic *semantic,
|
||||
{"sv_isfrontface", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_IS_FRONT_FACE},
|
||||
{"sv_rendertargetarrayindex", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX},
|
||||
{"sv_viewportarrayindex", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX},
|
||||
+ {"sv_sampleindex", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_SAMPLE_INDEX},
|
||||
|
||||
{"color", true, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_TARGET},
|
||||
{"depth", true, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_DEPTH},
|
||||
@@ -4461,6 +4462,7 @@ static void write_sm4_dcl_semantic(const struct tpf_writer *tpf, const struct hl
|
||||
case VKD3D_SHADER_SV_INSTANCE_ID:
|
||||
case VKD3D_SHADER_SV_PRIMITIVE_ID:
|
||||
case VKD3D_SHADER_SV_VERTEX_ID:
|
||||
+ case VKD3D_SHADER_SV_SAMPLE_INDEX:
|
||||
instr.opcode = (profile->type == VKD3D_SHADER_TYPE_PIXEL)
|
||||
? VKD3D_SM4_OP_DCL_INPUT_PS_SGV : VKD3D_SM4_OP_DCL_INPUT_SGV;
|
||||
break;
|
||||
@@ -5578,6 +5580,23 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex
|
||||
write_sm4_ternary_op(tpf, VKD3D_SM4_OP_MOVC, &expr->node, arg1, arg2, arg3);
|
||||
break;
|
||||
|
||||
+ case HLSL_OP3_MAD:
|
||||
+ switch (dst_type->e.numeric.type)
|
||||
+ {
|
||||
+ case HLSL_TYPE_FLOAT:
|
||||
+ write_sm4_ternary_op(tpf, VKD3D_SM4_OP_MAD, &expr->node, arg1, arg2, arg3);
|
||||
+ break;
|
||||
+
|
||||
+ case HLSL_TYPE_INT:
|
||||
+ case HLSL_TYPE_UINT:
|
||||
+ write_sm4_ternary_op(tpf, VKD3D_SM4_OP_IMAD, &expr->node, arg1, arg2, arg3);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ hlsl_fixme(tpf->ctx, &expr->node.loc, "SM4 %s negation expression.", dst_type_string->buffer);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
hlsl_fixme(tpf->ctx, &expr->node.loc, "SM4 %s expression.", debug_hlsl_expr_op(expr->op));
|
||||
}
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
index 327461371a4..ffec48daa17 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
@@ -1354,8 +1354,6 @@ bool shader_instruction_array_add_icb(struct vkd3d_shader_instruction_array *ins
|
||||
struct vkd3d_shader_immediate_constant_buffer *icb);
|
||||
bool shader_instruction_array_clone_instruction(struct vkd3d_shader_instruction_array *instructions,
|
||||
unsigned int dst, unsigned int src);
|
||||
-struct vkd3d_shader_src_param *instruction_array_create_outpointid_param(
|
||||
- struct vkd3d_shader_instruction_array *instructions);
|
||||
void shader_instruction_array_destroy(struct vkd3d_shader_instruction_array *instructions);
|
||||
|
||||
enum vkd3d_shader_config_flags
|
||||
@@ -1399,6 +1397,8 @@ enum vkd3d_result vsir_program_normalise(struct vsir_program *program, uint64_t
|
||||
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context);
|
||||
enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t config_flags,
|
||||
const char *source_name, struct vkd3d_shader_message_context *message_context);
|
||||
+struct vkd3d_shader_src_param *vsir_program_create_outpointid_param(
|
||||
+ struct vsir_program *program);
|
||||
bool vsir_instruction_init_with_params(struct vsir_program *program,
|
||||
struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location,
|
||||
enum vkd3d_shader_opcode opcode, unsigned int dst_count, unsigned int src_count);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/command.c b/libs/vkd3d/libs/vkd3d/command.c
|
||||
index dcc7690876f..188162f9e6e 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/command.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/command.c
|
||||
@@ -3078,7 +3078,7 @@ done:
|
||||
vkd3d_free(vk_descriptor_writes);
|
||||
}
|
||||
|
||||
-static void d3d12_command_list_update_descriptors(struct d3d12_command_list *list,
|
||||
+static void d3d12_command_list_update_virtual_descriptors(struct d3d12_command_list *list,
|
||||
enum vkd3d_pipeline_bind_point bind_point)
|
||||
{
|
||||
struct vkd3d_pipeline_bindings *bindings = &list->pipeline_bindings[bind_point];
|
||||
@@ -3210,6 +3210,9 @@ static void command_list_flush_vk_heap_updates(struct d3d12_command_list *list)
|
||||
|
||||
static void command_list_add_descriptor_heap(struct d3d12_command_list *list, struct d3d12_descriptor_heap *heap)
|
||||
{
|
||||
+ if (!list->device->use_vk_heaps)
|
||||
+ return;
|
||||
+
|
||||
if (!contains_heap(list->descriptor_heaps, list->descriptor_heap_count, heap))
|
||||
{
|
||||
if (list->descriptor_heap_count == ARRAY_SIZE(list->descriptor_heaps))
|
||||
@@ -3296,6 +3299,15 @@ static void d3d12_command_list_update_heap_descriptors(struct d3d12_command_list
|
||||
d3d12_command_list_bind_descriptor_heap(list, bind_point, sampler_heap);
|
||||
}
|
||||
|
||||
+static void d3d12_command_list_update_descriptors(struct d3d12_command_list *list,
|
||||
+ enum vkd3d_pipeline_bind_point bind_point)
|
||||
+{
|
||||
+ if (list->device->use_vk_heaps)
|
||||
+ d3d12_command_list_update_heap_descriptors(list, bind_point);
|
||||
+ else
|
||||
+ d3d12_command_list_update_virtual_descriptors(list, bind_point);
|
||||
+}
|
||||
+
|
||||
static bool d3d12_command_list_update_compute_state(struct d3d12_command_list *list)
|
||||
{
|
||||
d3d12_command_list_end_current_render_pass(list);
|
||||
@@ -3303,7 +3315,7 @@ static bool d3d12_command_list_update_compute_state(struct d3d12_command_list *l
|
||||
if (!d3d12_command_list_update_compute_pipeline(list))
|
||||
return false;
|
||||
|
||||
- list->update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_COMPUTE);
|
||||
+ d3d12_command_list_update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_COMPUTE);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -3320,7 +3332,7 @@ static bool d3d12_command_list_begin_render_pass(struct d3d12_command_list *list
|
||||
if (!d3d12_command_list_update_current_framebuffer(list))
|
||||
return false;
|
||||
|
||||
- list->update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_GRAPHICS);
|
||||
+ d3d12_command_list_update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_GRAPHICS);
|
||||
|
||||
if (list->current_render_pass != VK_NULL_HANDLE)
|
||||
return true;
|
||||
@@ -6189,8 +6201,6 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d
|
||||
|
||||
list->allocator = allocator;
|
||||
|
||||
- list->update_descriptors = device->use_vk_heaps ? d3d12_command_list_update_heap_descriptors
|
||||
- : d3d12_command_list_update_descriptors;
|
||||
list->descriptor_heap_count = 0;
|
||||
|
||||
if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator, list)))
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/state.c b/libs/vkd3d/libs/vkd3d/state.c
|
||||
index 682d488faa8..bc887fa2f33 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/state.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/state.c
|
||||
@@ -738,7 +738,7 @@ static bool vkd3d_validate_descriptor_set_count(struct d3d12_device *device, uns
|
||||
if (set_count > max_count)
|
||||
{
|
||||
/* NOTE: If maxBoundDescriptorSets is < 9, try VKD3D_CONFIG=virtual_heaps */
|
||||
- ERR("Required descriptor set count exceeds maximum allowed count of %u.\n", max_count);
|
||||
+ WARN("Required descriptor set count exceeds maximum allowed count of %u.\n", max_count);
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
index ba4e2e8488d..729b1baee18 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
@@ -1271,7 +1271,6 @@ struct d3d12_command_list
|
||||
VkBuffer so_counter_buffers[D3D12_SO_BUFFER_SLOT_COUNT];
|
||||
VkDeviceSize so_counter_buffer_offsets[D3D12_SO_BUFFER_SLOT_COUNT];
|
||||
|
||||
- void (*update_descriptors)(struct d3d12_command_list *list, enum vkd3d_pipeline_bind_point bind_point);
|
||||
struct d3d12_descriptor_heap *descriptor_heaps[64];
|
||||
unsigned int descriptor_heap_count;
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user