Author: ion Date: Sun Oct 1 10:43:26 2006 New Revision: 24334
URL: http://svn.reactos.org/svn/reactos?rev=24334&view=rev Log: - Add two more lines in boot.S which detect boot-by-NTLDR and jump into KiSystemService (I thought FreeLdr didn't use the entrypoint, but it looks like it does, so this hack is needed). Detection is done by checking for the high bit in the PLOADER_PARAMETER_BLOCK pointer, which will be set on NT. - Fix a double bug in KiSystemStartup. First, we were setting KPCR->Number instead of KPRCB->Number. Second, we were using KeGetPcr instead of __writefsdword. It worked on ROS because KeGetPcr is hard-coded to ROS's KPCR buffer.
Modified: trunk/reactos/ntoskrnl/ke/i386/boot.S trunk/reactos/ntoskrnl/ke/i386/kiinit.c
Modified: trunk/reactos/ntoskrnl/ke/i386/boot.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/boot.S?rev... ============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/boot.S (original) +++ trunk/reactos/ntoskrnl/ke/i386/boot.S Sun Oct 1 10:43:26 2006 @@ -30,6 +30,11 @@ .text .func NtProcessStartup _NtProcessStartup: - /* Call the main kernel initialization */ + + /* NTLDR Boot: Call the main kernel initialization */ + test dword ptr [esp+4], 0x80000000 + jnz _KiSystemStartup@4 + + /* FREELDR Boot: Cal the FreeLDR wrapper */ jmp @KiRosPrepareForSystemStartup@8 .endfunc
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?r... ============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/kiinit.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c Sun Oct 1 10:43:26 2006 @@ -294,7 +294,7 @@ { /* If this is the boot CPU, set FS and the CPU Number*/ Ke386SetFs(KGDT_R0_PCR); - KeGetPcr()->Number = Cpu; + __writefsdword(0x130, Cpu);
/* Set the initial stack and idle thread as well */ LoaderBlock->KernelStack = (ULONG_PTR)P0BootStack;