ntoskrnl-Emulator: Move logic for user shared data into separate patchset.

This commit is contained in:
Sebastian Lackner
2014-11-26 11:02:03 +01:00
parent 1979f90644
commit dd4efb315a
4 changed files with 110 additions and 18 deletions

View File

@@ -1,15 +1,16 @@
From 9cdc9686cbdd77bfbed039f4811570c955ac26b3 Mon Sep 17 00:00:00 2001
From 015edd2598d688bdf15ef2f647042537423b15ce Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 10 Nov 2014 21:27:39 +0100
Subject: ntoskrnl: Emulate memory access to KI_USER_SHARED_DATA on x86_64.
(try 2)
---
dlls/ntoskrnl.exe/instr.c | 277 ++++++++++++++++++++++++++++++++++++++++++-
dlls/ntoskrnl.exe/instr.c | 273 ++++++++++++++++++++++++++++++++++++++++++-
dlls/ntoskrnl.exe/ntoskrnl.c | 2 +-
2 files changed, 277 insertions(+), 2 deletions(-)
2 files changed, 273 insertions(+), 2 deletions(-)
diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c
index 05cd238..51b7bec 100644
index 05cd238..eda16f4 100644
--- a/dlls/ntoskrnl.exe/instr.c
+++ b/dlls/ntoskrnl.exe/instr.c
@@ -4,6 +4,7 @@
@@ -20,7 +21,7 @@ index 05cd238..51b7bec 100644
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -470,4 +471,278 @@ LONG CALLBACK vectored_handler( EXCEPTION_POINTERS *ptrs )
@@ -470,4 +471,274 @@ LONG CALLBACK vectored_handler( EXCEPTION_POINTERS *ptrs )
return EXCEPTION_CONTINUE_SEARCH;
}
@@ -32,6 +33,8 @@ index 05cd238..51b7bec 100644
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+#define WIN32_NO_STATUS
+#include "ddk/wdm.h"
+#include "excpt.h"
+#include "wine/debug.h"
+#include "wine/exception.h"
@@ -52,7 +55,7 @@ index 05cd238..51b7bec 100644
+#define SIB_BASE(sib, rex) (((sib) & 7) | (((rex) & REX_B) ? 8 : 0))
+
+#define KI_USER_SHARED_DATA 0xfffff78000000000
+static BYTE user_shared_data[0x1000];
+extern void* CDECL __wine_user_shared_data(void);
+
+static inline DWORD64 *get_int_reg( CONTEXT *context, int index )
+{
@@ -154,12 +157,6 @@ index 05cd238..51b7bec 100644
+#undef GET_VAL
+}
+
+/* update the content of the user shared data page */
+static void update_user_shared_data(void)
+{
+ FIXME("TODO: update user shared data\n");
+}
+
+
+/***********************************************************************
+ * emulate_instruction
@@ -244,9 +241,9 @@ index 05cd238..51b7bec 100644
+ unsigned int data_size = (*instr == 0x8b) ? get_op_size( long_op, rex ) : 1;
+ unsigned int offset = data - (BYTE *)KI_USER_SHARED_DATA;
+
+ if (offset <= sizeof(user_shared_data) - data_size)
+ if (offset <= sizeof(KSHARED_USER_DATA) - data_size)
+ {
+ update_user_shared_data();
+ BYTE *user_shared_data = __wine_user_shared_data();
+ switch (*instr)
+ {
+ case 0x8a: store_reg_byte( context, instr[1], user_shared_data + offset, rex ); break;
@@ -266,9 +263,9 @@ index 05cd238..51b7bec 100644
+ unsigned int offset = data - (BYTE *)KI_USER_SHARED_DATA;
+ len = long_addr ? sizeof(DWORD64) : sizeof(DWORD);
+
+ if (offset <= sizeof(user_shared_data) - data_size)
+ if (offset <= sizeof(KSHARED_USER_DATA) - data_size)
+ {
+ update_user_shared_data();
+ BYTE *user_shared_data = __wine_user_shared_data();
+ memcpy( &context->Rax, user_shared_data + offset, data_size );
+ context->Rip += prefixlen + len + 1;
+ return ExceptionContinueExecution;

View File

@@ -1 +1,2 @@
Fixes: [33849] Emulate access to KI_USER_SHARED_DATA kernel page on x86_64
Depends: ntdll-User_Shared_Data