Author: tfaber
Date: Tue Jul 19 12:51:49 2016
New Revision: 71967
URL:
http://svn.reactos.org/svn/reactos?rev=71967&view=rev
Log:
[NTOS:KE]
- Load LDT on context switch if required.
CORE-11511 #resolve
Modified:
trunk/reactos/ntoskrnl/ke/i386/context.c
trunk/reactos/ntoskrnl/ke/i386/ldt.c
trunk/reactos/ntoskrnl/ke/i386/thrdini.c
Modified: trunk/reactos/ntoskrnl/ke/i386/context.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/context.c…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/context.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/context.c [iso-8859-1] Tue Jul 19 12:51:49 2016
@@ -34,9 +34,17 @@
/* Check for new LDT */
if (NewProcess->LdtDescriptor.LimitLow != OldProcess->LdtDescriptor.LimitLow)
{
- /* Not handled yet */
- UNIMPLEMENTED_DBGBREAK();
- return;
+ if (NewProcess->LdtDescriptor.LimitLow)
+ {
+ KeSetGdtSelector(KGDT_LDT,
+ ((PULONG)&NewProcess->LdtDescriptor)[0],
+ ((PULONG)&NewProcess->LdtDescriptor)[1]);
+ Ke386SetLocalDescriptorTable(KGDT_LDT);
+ }
+ else
+ {
+ Ke386SetLocalDescriptorTable(0);
+ }
}
/* Update CR3 */
Modified: trunk/reactos/ntoskrnl/ke/i386/ldt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ldt.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/ldt.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/ldt.c [iso-8859-1] Tue Jul 19 12:51:49 2016
@@ -167,7 +167,7 @@
if ((Base + SegLimit > (ULONG_PTR) MmHighestUserAddress) ||
(Base > Base+SegLimit))
{
- DPRINT1("WARNING: Windows would mark this descriptor invalid!");
+ DPRINT1("WARNING: Windows would mark this descriptor invalid!\n");
}
/*
Modified: trunk/reactos/ntoskrnl/ke/i386/thrdini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/thrdini.c…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] Tue Jul 19 12:51:49 2016
@@ -345,8 +345,17 @@
/* Check if there is a different LDT */
if (*(PULONGLONG)&OldProcess->LdtDescriptor !=
*(PULONGLONG)&NewProcess->LdtDescriptor)
{
- DPRINT1("LDT switch not implemented\n");
- ASSERT(FALSE);
+ if (NewProcess->LdtDescriptor.LimitLow)
+ {
+ KeSetGdtSelector(KGDT_LDT,
+ ((PULONG)&NewProcess->LdtDescriptor)[0],
+ ((PULONG)&NewProcess->LdtDescriptor)[1]);
+ Ke386SetLocalDescriptorTable(KGDT_LDT);
+ }
+ else
+ {
+ Ke386SetLocalDescriptorTable(0);
+ }
}
/* Switch address space and flush TLB */