Author: tkreuzer
Date: Fri Aug 22 05:07:57 2008
New Revision: 35524
URL:
http://svn.reactos.org/svn/reactos?rev=35524&view=rev
Log:
revert my last change, yes it IS a stupid idea to mess with the stack in the middle of a C
function....
Added:
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S
- copied unchanged from r35517,
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S
Modified:
branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S
branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-amd64hack.rbuild
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h
[iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h
[iso-8859-1] Fri Aug 22 05:07:57 2008
@@ -10,17 +10,6 @@
#define KeSetCurrentIrql(x) __writecr8(x)
#if defined(__GNUC__)
-
-ULONG64
-FORCEINLINE
-KiSwapStack(ULONG64 NewStack)
-{
- ULONG64 OldStack;
- asm volatile ("movq %%rsp, %[oldstack]\n movq %[newstack], %%rsp\n"
- : [oldstack] "=rm" (OldStack)
- : [newstack] "rm" (NewStack));
- return OldStack;
-}
#define Ke386SetInterruptDescriptorTable(X) \
__asm__("lidt %0\n\t" \
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] Fri Aug 22
05:07:57 2008
@@ -366,7 +366,6 @@
/* Start us out at PASSIVE_LEVEL */
// Pcr->Irql = PASSIVE_LEVEL;
- KeSetCurrentIrql(PASSIVE_LEVEL);
/* Set the GDI, IDT, TSS and DPC Stack */
Pcr->GdtBase = (PVOID)Gdt;
@@ -387,7 +386,6 @@
IN CCHAR Number,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
- FrLdrDbgPrint("Enter KiInitializeKernel\n");
#if 0
BOOLEAN NpxPresent;
ULONG FeatureBits;
@@ -644,17 +642,6 @@
(ULONG64)TssSelector.BaseUpper << 32);
}
-// Hack
-VOID KiRosPrepareForSystemStartup(ULONG, PROS_LOADER_PARAMETER_BLOCK);
-
-VOID
-NTAPI
-KiSystemStartup(IN ULONG_PTR Dummy,
- IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
-{
- KiRosPrepareForSystemStartup(Dummy, LoaderBlock);
-}
-
VOID
NTAPI
KiSystemStartupReal(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
@@ -753,15 +740,13 @@
// RtlCopyMemory(&Idt[8], &DoubleFaultEntry, sizeof(KIDTENTRY));
}
-#if 0 // FIXME: InterlockedBitTestAndSet64 is broken! It needs to be specified
- // that it should reference an absolute address!
+
/* Loop until we can release the freeze lock */
do
{
/* Loop until execution can continue */
while (*(volatile PKSPIN_LOCK*)&KiFreezeExecutionLock == (PVOID)1);
- } while(InterlockedBitTestAndSet64((PLONG64)&KiFreezeExecutionLock, 0));
-#endif
+ } while(InterlockedBitTestAndSet((PLONG)&KiFreezeExecutionLock, 0));
/* Setup CPU-related fields */
Pcr->Prcb.Number = Cpu;
@@ -788,29 +773,16 @@
KfRaiseIrql(HIGH_LEVEL);
/* Align stack and make space for the trap frame and NPX frame */
- InitialStack &= ~(16 - 1);
-
- /* Switch to new kernel Stack */
- KiSwapStack(InitialStack);
-
- /* Initialize kernel */
- KiInitializeKernel(&KiInitialProcess.Pcb,
- InitialThread,
- (PVOID)InitialStack,
- &Pcr->Prcb,
- (CCHAR)Cpu,
- KeLoaderBlock);
-
- /* Set the priority of this thread to 0 */
- InitialThread->Priority = 0;
-
- /* Force interrupts enabled and lower IRQL back to DISPATCH_LEVEL */
- _enable();
- KeLowerIrql(DISPATCH_LEVEL);
-
- /* Set the right wait IRQL */
- InitialThread->WaitIrql = DISPATCH_LEVEL;
-
- /* Jump into the idle loop */
- KiIdleLoop();
+ InitialStack &= ~(KTRAP_FRAME_ALIGN - 1);
+
+FrLdrDbgPrint("Before KiSetupStackAndInitializeKernel\n");
+for(;;);
+
+ /* Switch to new kernel stack and start kernel bootstrapping */
+ KiSetupStackAndInitializeKernel(&KiInitialProcess.Pcb,
+ InitialThread,
+ (PVOID)InitialStack,
+ &Pcr->Prcb,
+ (CCHAR)Cpu,
+ KeLoaderBlock);
}
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] Fri Aug 22
05:07:57 2008
@@ -13,22 +13,7 @@
.intel_syntax noprefix
.code64
-#define KERNEL_STACK_SIZE 0x6000
-
/* GLOBALS *******************************************************************/
-
-.bss
-.align 16
-
-/* Kernel Boot Stack */
-.globl _P0BootStack
-.space KERNEL_STACK_SIZE
-_P0BootStack:
-
-/* Kernel Double-Fault and Temporary DPC Stack */
-.globl _KiDoubleFaultStack
-.space KERNEL_STACK_SIZE
-_KiDoubleFaultStack:
.data
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-amd64hack.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-amd64hack.rbuild [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-amd64hack.rbuild [iso-8859-1] Fri
Aug 22 05:07:57 2008
@@ -90,6 +90,7 @@
</if>
<if property="ARCH" value="amd64">
<directory name="amd64">
+ <file first="true">boot.S</file>
<file>cpu.c</file>
<file>except.c</file>
<file>irql.c</file>