Module: wine Branch: master Commit: b40be1d43bba7749d9c45dcd42219393300c8124 URL: https://source.winehq.org/git/wine.git/?a=commit;h=b40be1d43bba7749d9c45dcd4...
Author: Paul Gofman pgofman@codeweavers.com Date: Mon May 18 12:25:50 2020 +0300
ntoskrnl.exe: Emulate full user shared data area range.
Signed-off-by: Paul Gofman pgofman@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntoskrnl.exe/instr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c index 0973b3a80a..dad4e5d660 100644 --- a/dlls/ntoskrnl.exe/instr.c +++ b/dlls/ntoskrnl.exe/instr.c @@ -33,6 +33,8 @@ #include "wine/debug.h" #include "wine/exception.h"
+#define KSHARED_USER_DATA_PAGE_SIZE 0x1000 + #ifdef __i386__
WINE_DEFAULT_DEBUG_CHANNEL(int); @@ -790,9 +792,11 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context ) unsigned int data_size = (instr[1] == 0xb7) ? 2 : 1; SIZE_T offset = data - user_shared_data;
- if (offset <= sizeof(KSHARED_USER_DATA) - data_size) + if (offset <= KSHARED_USER_DATA_PAGE_SIZE - data_size) { ULONGLONG temp = 0; + + TRACE("USD offset %#x at %p.\n", (unsigned int)offset, (void *)context->Rip); 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; @@ -811,8 +815,9 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context ) unsigned int data_size = (*instr == 0x8b) ? get_op_size( long_op, rex ) : 1; SIZE_T offset = data - user_shared_data;
- if (offset <= sizeof(KSHARED_USER_DATA) - data_size) + if (offset <= KSHARED_USER_DATA_PAGE_SIZE - data_size) { + TRACE("USD offset %#x at %p.\n", (unsigned int)offset, (void *)context->Rip); switch (*instr) { case 0x8a: store_reg_byte( context, instr[1], wine_user_shared_data + offset, rex ); break; @@ -832,8 +837,9 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context ) SIZE_T offset = data - user_shared_data; len = long_addr ? sizeof(DWORD64) : sizeof(DWORD);
- if (offset <= sizeof(KSHARED_USER_DATA) - data_size) + if (offset <= KSHARED_USER_DATA_PAGE_SIZE - data_size) { + TRACE("USD offset %#x at %p.\n", (unsigned int)offset, (void *)context->Rip); memcpy( &context->Rax, wine_user_shared_data + offset, data_size ); context->Rip += prefixlen + len + 1; return ExceptionContinueExecution;