Rebase against f7503d0a996ae1243dd6c87b39a9143624a80465.

This commit is contained in:
Alistair Leslie-Hughes
2025-04-26 09:03:13 +10:00
parent 1b8ab6cb68
commit e54c70a009
2 changed files with 26 additions and 25 deletions

View File

@@ -1,27 +1,28 @@
From 1de2ab4f1d48391f112897c2c89d4c1d77d4ac3f Mon Sep 17 00:00:00 2001
From 05dfee93e261b38037c370611ab0f63a2785a08c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 27 Feb 2016 00:04:10 +0100
Subject: krnl386.exe16: Emulate GDT and LDT access.
Subject: [PATCH] krnl386.exe16: Emulate GDT and LDT access.
---
dlls/krnl386.exe16/instr.c | 64 +++++++++++++++++++++++++++++++++++++++-------
1 file changed, 55 insertions(+), 9 deletions(-)
dlls/krnl386.exe16/instr.c | 65 ++++++++++++++++++++++++++++++++------
1 file changed, 56 insertions(+), 9 deletions(-)
diff --git a/dlls/krnl386.exe16/instr.c b/dlls/krnl386.exe16/instr.c
index b0de30f..865d944 100644
index 666ef71363f..c6d05b7a0c9 100644
--- a/dlls/krnl386.exe16/instr.c
+++ b/dlls/krnl386.exe16/instr.c
@@ -67,7 +67,7 @@ static inline void *get_stack( CONTEXT *context )
@@ -60,7 +60,8 @@ static inline void *get_stack( CONTEXT *context )
}
#include "pshpack1.h"
#pragma pack(push,1)
-struct idtr
+
+struct dtr
{
WORD limit;
BYTE *base;
@@ -75,19 +75,41 @@ struct idtr
#include "poppack.h"
@@ -68,19 +69,41 @@ struct idtr
#pragma pack(pop)
static LDT_ENTRY idt[256];
+static LDT_ENTRY gdt[8192];
@@ -35,6 +36,18 @@ index b0de30f..865d944 100644
+ struct dtr ret;
__asm__( "sidtl %0" : "=m" (ret) );
+ *offset = data - ret.base;
+ return (*offset <= ret.limit + 1 - data_size);
+#else
+ return FALSE;
+#endif
+}
+
+static BOOL emulate_gdtr( BYTE *data, unsigned int data_size, unsigned int *offset )
+{
+#if defined(__i386__) && defined(__GNUC__)
+ struct dtr ret;
+ __asm__( "sgdtl %0" : "=m" (ret) );
+ *offset = data - ret.base;
+ return (*offset <= ret.limit + 1 - data_size);
#else
- ret.base = (BYTE *)idt;
@@ -44,18 +57,6 @@ index b0de30f..865d944 100644
- return ret;
}
+static BOOL emulate_gdtr( BYTE *data, unsigned int data_size, unsigned int *offset )
+{
+#if defined(__i386__) && defined(__GNUC__)
+ struct dtr ret;
+ __asm__( "sgdtl %0" : "=m" (ret) );
+ *offset = data - ret.base;
+ return (*offset <= ret.limit + 1 - data_size);
+#else
+ return FALSE;
+#endif
+}
+
+static inline WORD get_ldt(void)
+{
+ WORD seg = 1;
@@ -67,7 +68,7 @@ index b0de30f..865d944 100644
/***********************************************************************
* INSTR_ReplaceSelector
@@ -711,10 +733,9 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
@@ -705,10 +728,9 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
BYTE *data = INSTR_GetOperandAddr(context, instr + 1, long_addr,
segprefix, &len);
unsigned int data_size = (*instr == 0x8b) ? (long_op ? 4 : 2) : 1;
@@ -80,7 +81,7 @@ index b0de30f..865d944 100644
{
idt[1].LimitLow = 0x100; /* FIXME */
idt[2].LimitLow = 0x11E; /* FIXME */
@@ -728,6 +749,31 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
@@ -722,6 +744,31 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
context->Eip += prefixlen + len + 1;
return ExceptionContinueExecution;
}
@@ -113,5 +114,5 @@ index b0de30f..865d944 100644
break; /* Unable to emulate it */
--
2.7.1
2.47.2

View File

@@ -1 +1 @@
ba6adef9bfc209f1247ba88acec64b58d97100c3
f7503d0a996ae1243dd6c87b39a9143624a80465