Author: tkreuzer
Date: Wed Feb 3 01:18:24 2010
New Revision: 45384
URL:
http://svn.reactos.org/svn/reactos?rev=45384&view=rev
Log:
[NTOS]
- Fix KGDT64 names,
- Add missing .ALLOCSTACK
Modified:
branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kdx64.c
branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kddata.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/context.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/except.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kdx64.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kdx64.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kdx64.c [iso-8859-1] Wed Feb 3
01:18:24 2010
@@ -85,7 +85,7 @@
/* Set Report Flags */
WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_SEGS;
- if (WaitStateChange->ControlReport.SegCs == KGDT_64_R0_CODE)
+ if (WaitStateChange->ControlReport.SegCs == KGDT64_R0_CODE)
{
WaitStateChange->ControlReport.ReportFlags |= REPORT_STANDARD_CS;
}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kddata.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kddata.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kddata.c [iso-8859-1] Wed Feb 3
01:18:24 2010
@@ -526,14 +526,14 @@
//
// AMD64 GDT/LDT/TSS constants
//
- KGDT_64_R0_CODE,
- KGDT_64_DATA,
- KGDT_64_DATA,
- KGDT_64_R3_CODE,
- KGDT_64_DATA,
- KGDT_64_DATA,
- 0,
- KGDT_TSS,
+ KGDT64_R0_CODE,
+ KGDT64_R3_DATA,
+ KGDT64_R3_DATA,
+ KGDT64_R3_CODE,
+ KGDT64_R3_DATA,
+ KGDT64_R3_DATA,
+ 0,
+ KGDT64_SYS_TSS,
0,
0,
#else
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/context.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/context.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/context.c [iso-8859-1] Wed Feb 3
01:18:24 2010
@@ -74,11 +74,11 @@
if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL)
{
/* Check if this was a Kernel Trap */
- if (Context->SegCs == KGDT_64_R0_CODE)
- {
- /* Set valid selectors */
- TrapFrame->SegCs = KGDT_64_R0_CODE;
- TrapFrame->SegSs = KGDT_64_R0_SS;
+ if (Context->SegCs == KGDT64_R0_CODE)
+ {
+ /* Set valid selectors */
+ TrapFrame->SegCs = KGDT64_R0_CODE;
+ TrapFrame->SegSs = KGDT64_R0_DATA;
}
else
{
@@ -97,13 +97,13 @@
if ((Context->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS)
{
/* Check if this was a Kernel Trap */
- if (Context->SegCs == KGDT_64_R0_CODE)
- {
- /* Set valid selectors */
- TrapFrame->SegDs = KGDT_64_DATA | RPL_MASK;
- TrapFrame->SegEs = KGDT_64_DATA | RPL_MASK;
- TrapFrame->SegFs = KGDT_32_R3_TEB | RPL_MASK;
- TrapFrame->SegGs = KGDT_64_DATA | RPL_MASK;
+ if (Context->SegCs == KGDT64_R0_CODE)
+ {
+ /* Set valid selectors */
+ TrapFrame->SegDs = KGDT64_R3_DATA | RPL_MASK;
+ TrapFrame->SegEs = KGDT64_R3_DATA | RPL_MASK;
+ TrapFrame->SegFs = KGDT64_R3_CMTEB | RPL_MASK;
+ TrapFrame->SegGs = KGDT64_R3_DATA | RPL_MASK;
}
else
{
@@ -190,11 +190,11 @@
if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL)
{
/* Check if this was a Kernel Trap */
- if (TrapFrame->SegCs == KGDT_64_R0_CODE)
- {
- /* Set valid selectors */
- Context->SegCs = KGDT_64_R0_CODE;
- Context->SegSs = KGDT_64_R0_SS;
+ if (TrapFrame->SegCs == KGDT64_R0_CODE)
+ {
+ /* Set valid selectors */
+ Context->SegCs = KGDT64_R0_CODE;
+ Context->SegSs = KGDT64_R0_DATA;
}
else
{
@@ -213,13 +213,13 @@
if ((Context->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS)
{
/* Check if this was a Kernel Trap */
- if (TrapFrame->SegCs == KGDT_64_R0_CODE)
- {
- /* Set valid selectors */
- Context->SegDs = KGDT_64_DATA | RPL_MASK;
- Context->SegEs = KGDT_64_DATA | RPL_MASK;
- Context->SegFs = KGDT_32_R3_TEB | RPL_MASK;
- Context->SegGs = KGDT_64_DATA | RPL_MASK;
+ if (TrapFrame->SegCs == KGDT64_R0_CODE)
+ {
+ /* Set valid selectors */
+ Context->SegDs = KGDT64_R3_DATA | RPL_MASK;
+ Context->SegEs = KGDT64_R3_DATA | RPL_MASK;
+ Context->SegFs = KGDT64_R3_CMTEB | RPL_MASK;
+ Context->SegGs = KGDT64_R3_DATA | RPL_MASK;
}
else
{
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] Wed Feb 3
01:18:24 2010
@@ -379,7 +379,7 @@
PKGDTENTRY64 TssEntry;
/* Get pointer to the GDT entry */
- TssEntry = KiGetGdtEntry(KeGetPcr()->GdtBase, KGDT_TSS);
+ TssEntry = KiGetGdtEntry(KeGetPcr()->GdtBase, KGDT64_SYS_TSS);
/* Initialize the GDT entry */
KiInitGdtEntry(TssEntry, (ULONG64)Tss, sizeof(KTSS64), AMD64_TSS, 0);
@@ -403,7 +403,7 @@
Tss->Ist[3] = (ULONG64)KiDoubleFaultStack;
/* Load the task register */
- __ltr(KGDT_TSS);
+ __ltr(KGDT64_SYS_TSS);
}
VOID
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/except.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/except.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/except.c [iso-8859-1] Wed Feb 3
01:18:24 2010
@@ -50,9 +50,8 @@
KIDTENTRY64 KiIdt[256];
KDESCRIPTOR KiIdtDescriptor = {{0}, sizeof(KiIdt) - 1, KiIdt};
+
/* FUNCTIONS *****************************************************************/
-
-
VOID
INIT_FUNCTION
@@ -80,7 +79,7 @@
KiIdt[i].IstIndex = 0;
}
KiIdt[i].OffsetLow = Offset & 0xffff;
- KiIdt[i].Selector = KGDT_64_R0_CODE;
+ KiIdt[i].Selector = KGDT64_R0_CODE;
KiIdt[i].Type = 0x0e;
KiIdt[i].Reserved0 = 0;
KiIdt[i].Present = 1;
@@ -242,6 +241,20 @@
ASSERT(FALSE);
}
+ /* Check for lazy segment load */
+ if (TrapFrame->SegDs != (KGDT64_R3_DATA | RPL_MASK))
+ {
+ /* Fix it */
+ TrapFrame->SegDs = (KGDT64_R3_DATA | RPL_MASK);
+ return STATUS_SUCCESS;
+ }
+ else if (TrapFrame->SegEs != (KGDT64_R3_DATA | RPL_MASK))
+ {
+ /* Fix it */
+ TrapFrame->SegEs = (KGDT64_R3_DATA | RPL_MASK);
+ return STATUS_SUCCESS;
+ }
+
/* Check for nested exception */
if ((TrapFrame->Rip >= (ULONG64)KiGeneralProtectionFaultHandler) &&
(TrapFrame->Rip < (ULONG64)KiGeneralProtectionFaultHandler))
@@ -271,20 +284,6 @@
return STATUS_ACCESS_VIOLATION;
}
- /* Check for lazy segment load */
- if (TrapFrame->SegDs != (KGDT64_R0_DATA | RPL_MASK))
- {
- /* Fix it */
- TrapFrame->SegDs = (KGDT64_R0_DATA | RPL_MASK);
- return STATUS_SUCCESS;
- }
- else if (TrapFrame->SegEs != (KGDT64_R0_DATA | RPL_MASK))
- {
- /* Fix it */
- TrapFrame->SegEs = (KGDT64_R0_DATA | RPL_MASK);
- return STATUS_SUCCESS;
- }
-
ASSERT(FALSE);
return STATUS_UNSUCCESSFUL;
}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c [iso-8859-1] Wed Feb 3
01:18:24 2010
@@ -120,7 +120,7 @@
/* Get TSS Selector */
__str(&Tr);
- ASSERT(Tr == KGDT_TSS);
+ ASSERT(Tr == KGDT64_SYS_TSS);
/* Get TSS Entry */
TssEntry = KiGetGdtEntry(Pcr->GdtBase, Tr);
@@ -390,9 +390,9 @@
__writemsr(X86_MSR_KERNEL_GSBASE, (ULONG64)Pcr);
/* Load Ring 3 selectors for DS/ES/FS */
- Ke386SetDs(KGDT_64_DATA | RPL_MASK);
- Ke386SetEs(KGDT_64_DATA | RPL_MASK);
- Ke386SetFs(KGDT_32_R3_TEB | RPL_MASK);
+ Ke386SetDs(KGDT64_R3_DATA | RPL_MASK);
+ Ke386SetEs(KGDT64_R3_DATA | RPL_MASK);
+ Ke386SetFs(KGDT64_R3_CMTEB | RPL_MASK);
/* LDT is unused */
__lldt(0);
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S [iso-8859-1] Wed Feb 3
01:18:24 2010
@@ -274,6 +274,7 @@
/* Allocate stack space for EXCEPTION_RECORD and KEXCEPTION_FRAME */
sub rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME
+ .allocstack (SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME)
/* Set up EXCEPTION_RECORD */
lea rcx, [rsp + SIZE_KEXCEPTION_FRAME]