mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 08:54:40 +00:00
- Remove all the remaining code in boot.S and make KiRosPrepareForSystemStartup fastcall. Now NtProcessStartup just does a jmp to KiRosPrepareForSystemStartup without any other code.
- Use freeldr's stack during all of freeldr.c, and only switch to the boot stack in KiSystemStartup before calling KiInitializeKernel. This is what NT does as well (it piggybacks on NTLDR's stack until then). This allowed us to clean boot.S and now we can boot from NTLDR properly. svn path=/trunk/; revision=24333
This commit is contained in:
parent
380f89c205
commit
790760dcf4
|
@ -244,8 +244,9 @@ KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock,
|
|||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
FASTCALL
|
||||
KiRosPrepareForSystemStartup(IN ULONG Dummy,
|
||||
IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
ULONG i;
|
||||
ULONG size;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* FILE: ntoskrnl/ke/i386/boot.S
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PURPOSE: Kernel Bootstrap Code
|
||||
* PURPOSE: FreeLDR Wrapper Bootstrap Code
|
||||
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
||||
*/
|
||||
|
||||
|
@ -30,16 +30,6 @@ _KiDoubleFaultStack:
|
|||
.text
|
||||
.func NtProcessStartup
|
||||
_NtProcessStartup:
|
||||
|
||||
/* Load the initial kernel stack */
|
||||
lea eax, _P0BootStack
|
||||
sub eax, (NPX_FRAME_LENGTH + KTRAP_FRAME_LENGTH + KTRAP_FRAME_ALIGN)
|
||||
mov esp, eax
|
||||
|
||||
/* Save initial CR0 state */
|
||||
push CR0_EM + CR0_TS + CR0_MP
|
||||
|
||||
/* Call the main kernel initialization */
|
||||
push edx
|
||||
call _KiRosPrepareForSystemStartup@4
|
||||
jmp @KiRosPrepareForSystemStartup@8
|
||||
.endfunc
|
||||
|
|
|
@ -281,7 +281,7 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
{
|
||||
ULONG Cpu;
|
||||
PKTHREAD InitialThread;
|
||||
PVOID InitialStack;
|
||||
ULONG InitialStack;
|
||||
PKGDTENTRY Gdt;
|
||||
PKIDTENTRY Idt;
|
||||
PKTSS Tss;
|
||||
|
@ -302,7 +302,7 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
}
|
||||
|
||||
/* Save the initial thread and stack */
|
||||
InitialStack = (PVOID)LoaderBlock->KernelStack;
|
||||
InitialStack = LoaderBlock->KernelStack;
|
||||
InitialThread = (PKTHREAD)LoaderBlock->Thread;
|
||||
|
||||
/* Clean the APC List Head */
|
||||
|
@ -375,13 +375,21 @@ AppCpuInit:
|
|||
/* Raise to HIGH_LEVEL */
|
||||
KfRaiseIrql(HIGH_LEVEL);
|
||||
|
||||
/* Align stack and make space for the trap frame and NPX frame */
|
||||
InitialStack &= ~KTRAP_FRAME_ALIGN;
|
||||
__asm__ __volatile__("movl %0,%%esp" : :"r" (InitialStack));
|
||||
__asm__ __volatile__("subl %0,%%esp" : :"r" (NPX_FRAME_LENGTH +
|
||||
KTRAP_FRAME_LENGTH +
|
||||
KTRAP_FRAME_ALIGN));
|
||||
__asm__ __volatile__("push %0" : :"r" (CR0_EM + CR0_TS + CR0_MP));
|
||||
|
||||
/* Call main kernel initialization */
|
||||
KiInitializeKernel(&KiInitialProcess.Pcb,
|
||||
InitialThread,
|
||||
InitialStack,
|
||||
(PVOID)InitialStack,
|
||||
(PKPRCB)__readfsdword(KPCR_PRCB),
|
||||
Cpu,
|
||||
LoaderBlock);
|
||||
KeLoaderBlock);
|
||||
|
||||
/* Set the priority of this thread to 0 */
|
||||
KeGetCurrentThread()->Priority = 0;
|
||||
|
|
Loading…
Reference in a new issue