Please rename the function to KiFreeLdrHackKiArchHackHack or something
like that, and move it away from cpu.c, somewhere like i386/freeldr.c
to make clear that this function has NOTHING TO DO with how NT should
boot and is a hack because FreeLDR is a piece of shit that nobody
seems to want to fix.
On 19-Aug-08, at 12:07 PM, tkreuzer(a)svn.reactos.org wrote:
Author: tkreuzer
Date: Tue Aug 19 14:07:13 2008
New Revision: 35458
URL:
http://svn.reactos.org/svn/reactos?rev=35458&view=rev
Log:
Move some architecture specific code from
KiRosPrepareForSystemStartup into KiArchInitSystem, defined for each
architecture. Enable KiRosBuildReservedMemoryMap for _M_AMD64
Modified:
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/i386/cpu.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/powerpc/cpu.c
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
=
=
=
=
=
=
=
=
======================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c
[iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c
[iso-8859-1] Tue Aug 19 14:07:13 2008
@@ -949,7 +949,7 @@
/* Build entries for ReactOS memory ranges, which uses ARC
Descriptors */
KiRosBuildOsMemoryMap();
-#ifdef _M_IX86
+#if defined(_M_IX86) || defined(_M_AMD64)
/* Build entries for the reserved map, which uses ARC
Descriptors */
KiRosBuildReservedMemoryMap();
#endif
@@ -1266,42 +1266,15 @@
{
PLOADER_PARAMETER_BLOCK NtLoaderBlock;
ULONG size, i = 0, *ent;
-#if defined(_M_IX86)
- PKTSS Tss;
- PKGDTENTRY TssEntry;
-
- /* Load the GDT and IDT */
-
Ke386SetGlobalDescriptorTable(*(PKDESCRIPTOR)&KiGdtDescriptor.Limit);
-
Ke386SetInterruptDescriptorTable
(*(PKDESCRIPTOR)&KiIdtDescriptor.Limit);
-
- /* Initialize the boot TSS */
- Tss = &KiBootTss;
- TssEntry = &KiBootGdt[KGDT_TSS / sizeof(KGDTENTRY)];
- TssEntry->HighWord.Bits.Type = I386_TSS;
- TssEntry->HighWord.Bits.Pres = 1;
- TssEntry->HighWord.Bits.Dpl = 0;
- TssEntry->BaseLow = (USHORT)((ULONG_PTR)Tss & 0xFFFF);
- TssEntry->HighWord.Bytes.BaseMid = (UCHAR)((ULONG_PTR)Tss >> 16);
- TssEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)Tss >> 24);
-#endif
-
-#if defined(_M_PPC)
- // Zero bats. We might have residual bats set that will
interfere with
- // our mapping of ofwldr.
- for (i = 0; i < 4; i++)
- {
- SetBat(i, 0, 0, 0); SetBat(i, 1, 0, 0);
- }
- KiSetupSyscallHandler();
- DbgPrint("Kernel Power (%08x)\n", LoaderBlock);
- DbgPrint("ArchExtra (%08x)!\n", LoaderBlock->ArchExtra);
-#endif
/* Save pointer to ROS Block */
KeRosLoaderBlock = LoaderBlock;
/* Get debugging function */
FrLdrDbgPrint = LoaderBlock->FrLdrDbgPrint;
+
+ /* Per architecture initialisazion code */
+ KiArchInitSystem();
/* Save memory manager data */
KeMemoryMapRangeCount = 0;
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/i386/cpu.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
=
=
=
=
=
=
=
=
======================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/i386/cpu.c
[iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/i386/cpu.c
[iso-8859-1] Tue Aug 19 14:07:13 2008
@@ -1036,3 +1036,24 @@
/* Capture the control state */
KiSaveProcessorControlState(State);
}
+
+VOID
+KiArchInitSystem()
+{
+ PKTSS Tss;
+ PKGDTENTRY TssEntry;
+
+ /* Load the GDT and IDT */
+
Ke386SetGlobalDescriptorTable(*(PKDESCRIPTOR)&KiGdtDescriptor.Limit);
+
Ke386SetInterruptDescriptorTable
(*(PKDESCRIPTOR)&KiIdtDescriptor.Limit);
+
+ /* Initialize the boot TSS */
+ Tss = &KiBootTss;
+ TssEntry = &KiBootGdt[KGDT_TSS / sizeof(KGDTENTRY)];
+ TssEntry->HighWord.Bits.Type = I386_TSS;
+ TssEntry->HighWord.Bits.Pres = 1;
+ TssEntry->HighWord.Bits.Dpl = 0;
+ TssEntry->BaseLow = (USHORT)((ULONG_PTR)Tss & 0xFFFF);
+ TssEntry->HighWord.Bytes.BaseMid = (UCHAR)((ULONG_PTR)Tss >> 16);
+ TssEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)Tss >> 24);
+}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/powerpc/cpu.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
=
=
=
=
=
=
=
=
======================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/powerpc/cpu.c
[iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/powerpc/cpu.c
[iso-8859-1] Tue Aug 19 14:07:13 2008
@@ -275,3 +275,19 @@
/* Capture the control state */
KiSaveProcessorControlState(State);
}
+
+VOID
+KiArchInitSystem()
+{
+ ULONG i;
+
+ // Zero bats. We might have residual bats set that will
interfere with
+ // our mapping of ofwldr.
+ for (i = 0; i < 4; i++)
+ {
+ SetBat(i, 0, 0, 0); SetBat(i, 1, 0, 0);
+ }
+ KiSetupSyscallHandler();
+ DbgPrint("Kernel Power (%08x)\n", KeRosLoaderBlock);
+ DbgPrint("ArchExtra (%08x)!\n", KeRosLoaderBlock->ArchExtra);
+}