- 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.

svn path=/trunk/; revision=24334
This commit is contained in:
Alex Ionescu 2006-10-01 06:43:26 +00:00
parent 790760dcf4
commit aebf830821
2 changed files with 7 additions and 2 deletions

View file

@ -30,6 +30,11 @@ _KiDoubleFaultStack:
.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

View file

@ -294,7 +294,7 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
/* 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;