Author: ion
Date: Thu Aug 31 21:10:58 2006
New Revision: 23845
URL:
http://svn.reactos.org/svn/reactos?rev=23845&view=rev
Log:
- Remove some deprecated code and custom ROS exports/code.
Modified:
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/ke/i386/gdt.c
trunk/reactos/ntoskrnl/ke/i386/kernel.c
trunk/reactos/ntoskrnl/ke/i386/main_asm.S
trunk/reactos/ntoskrnl/ke/i386/tss.c
trunk/reactos/ntoskrnl/ke/main.c
trunk/reactos/ntoskrnl/ntoskrnl.def
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=238…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c (original)
+++ trunk/reactos/ntoskrnl/ex/init.c Thu Aug 31 21:10:58 2006
@@ -565,21 +565,7 @@
if (KdPollBreakIn()) DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
/* Initialize all processors */
- while (!HalAllProcessorsStarted()) {
-
- PVOID ProcessorStack;
-
- /* Set up the Kernel and Process Manager for this CPU */
- KePrepareForApplicationProcessorInit(KeNumberProcessors);
- KeCreateApplicationProcessorIdleThread(KeNumberProcessors);
-
- /* Allocate a stack for use when booting the processor */
- ProcessorStack = RVA(Ki386InitialStackArray[((int)KeNumberProcessors)],
KERNEL_STACK_SIZE);
-
- /* Tell HAL a new CPU is being started */
- HalStartNextProcessor(0, (ULONG)ProcessorStack - 2*sizeof(FX_SAVE_AREA));
- KeNumberProcessors++;
- }
+ HalAllProcessorsStarted();
/* Do Phase 1 HAL Initalization */
HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
Modified: trunk/reactos/ntoskrnl/ke/i386/gdt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/gdt.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/gdt.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/gdt.c Thu Aug 31 21:10:58 2006
@@ -48,12 +48,6 @@
static KSPIN_LOCK GdtLock;
/* FUNCTIONS *****************************************************************/
-
-VOID
-KiGdtPrepareForApplicationProcessorInit(ULONG Id)
-{
- KiGdtArray[Id] = ExAllocatePool(NonPagedPool, sizeof(USHORT) * 4 * 11);
-}
VOID
KiInitializeGdt(PKPCR Pcr)
@@ -247,36 +241,4 @@
KeReleaseSpinLock(&GdtLock, oldIrql);
}
-VOID
-KeDumpGdtSelector(ULONG Entry)
-{
- USHORT a, b, c, d;
- ULONG RawLimit;
-
- a = KiBootGdt[Entry*4];
- b = KiBootGdt[Entry*4 + 1];
- c = KiBootGdt[Entry*4 + 2];
- d = KiBootGdt[Entry*4 + 3];
-
- DbgPrint("Base: %x\n", b + ((c & 0xff) * (1 << 16)) +
- ((d & 0xff00) * (1 << 16)));
- RawLimit = a + ((d & 0xf) * (1 << 16));
- if (d & 0x80)
- {
- DbgPrint("Limit: %x\n", RawLimit * 4096);
- }
- else
- {
- DbgPrint("Limit: %x\n", RawLimit);
- }
- DbgPrint("Accessed: %d\n", (c & 0x100) >> 8);
- DbgPrint("Type: %x\n", (c & 0xe00) >> 9);
- DbgPrint("System: %d\n", (c & 0x1000) >> 12);
- DbgPrint("DPL: %d\n", (c & 0x6000) >> 13);
- DbgPrint("Present: %d\n", (c & 0x8000) >> 15);
- DbgPrint("AVL: %x\n", (d & 0x10) >> 4);
- DbgPrint("D: %d\n", (d & 0x40) >> 6);
- DbgPrint("G: %d\n", (d & 0x80) >> 7);
-}
-
/* EOF */
Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kernel.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/kernel.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/kernel.c Thu Aug 31 21:10:58 2006
@@ -41,8 +41,6 @@
#if defined (ALLOC_PRAGMA)
#pragma alloc_text(INIT, Ki386GetCpuId)
-#pragma alloc_text(INIT, KeCreateApplicationProcessorIdleThread)
-#pragma alloc_text(INIT, KePrepareForApplicationProcessorInit)
#pragma alloc_text(INIT, KeInit1)
#pragma alloc_text(INIT, KeInit2)
#pragma alloc_text(INIT, Ki386SetProcessorFeatures)
@@ -185,148 +183,6 @@
Ki386Cpuid(0x80000006, &Dummy, &Dummy, &Ecx, &Dummy);
Pcr->SecondLevelCacheSize = Ecx >> 16;
}
-}
-
-VOID
-KeApplicationProcessorInitDispatcher(VOID)
-{
- KIRQL oldIrql;
- oldIrql = KeAcquireDispatcherDatabaseLock();
- IdleProcessorMask |= (1 << KeGetCurrentProcessorNumber());
- KeReleaseDispatcherDatabaseLock(oldIrql);
-}
-
-VOID
-INIT_FUNCTION
-KeCreateApplicationProcessorIdleThread(ULONG Id)
-{
- PETHREAD IdleThread;
- PKPRCB Prcb = ((PKPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE))->Prcb;
-
- PsInitializeIdleOrFirstThread(PsIdleProcess,
- &IdleThread,
- NULL,
- KernelMode,
- FALSE);
- IdleThread->Tcb.State = Running;
- IdleThread->Tcb.FreezeCount = 0;
- IdleThread->Tcb.Affinity = 1 << Id;
- IdleThread->Tcb.UserAffinity = 1 << Id;
- IdleThread->Tcb.Priority = LOW_PRIORITY;
- IdleThread->Tcb.BasePriority = LOW_PRIORITY;
- Prcb->IdleThread = &IdleThread->Tcb;
- Prcb->CurrentThread = &IdleThread->Tcb;
-
- Ki386InitialStackArray[Id] = (PVOID)IdleThread->Tcb.StackLimit;
-
- DPRINT("IdleThread for Processor %d has PID %d\n",
- Id, IdleThread->Cid.UniqueThread);
-}
-
-VOID
-INIT_FUNCTION
-NTAPI
-KePrepareForApplicationProcessorInit(ULONG Id)
-{
- PFN_TYPE PrcPfn;
- PKIPCR Pcr;
- PKIPCR BootPcr;
-
- DPRINT("KePrepareForApplicationProcessorInit(Id %d)\n", Id);
-
- BootPcr = (PKIPCR)KPCR_BASE;
- Pcr = (PKIPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE);
-
- MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &PrcPfn);
- MmCreateVirtualMappingForKernel((PVOID)Pcr,
- PAGE_READWRITE,
- &PrcPfn,
- 1);
- /*
- * Create a PCR for this processor
- */
- memset(Pcr, 0, PAGE_SIZE);
- Pcr->Number = Id;
- Pcr->SetMember = 1 << Id;
- Pcr->NtTib.Self = &Pcr->NtTib;
- Pcr->Self = (PKPCR)Pcr;
- Pcr->Prcb = &Pcr->PrcbData;
- Pcr->Irql = SYNCH_LEVEL;
-
- Pcr->PrcbData.SetMember = 1 << Id;
- Pcr->PrcbData.MHz = BootPcr->PrcbData.MHz;
- Pcr->StallScaleFactor = BootPcr->StallScaleFactor;
-
- /* Mark the end of the exception handler list */
- Pcr->NtTib.ExceptionList = (PVOID)-1;
-
- KiGdtPrepareForApplicationProcessorInit(Id);
-
- KeActiveProcessors |= 1 << Id;
-}
-
-VOID
-NTAPI
-KeApplicationProcessorInit(VOID)
-{
- ULONG Offset;
- PKIPCR Pcr;
-
- DPRINT("KeApplicationProcessorInit()\n");
-
- if (Ke386GlobalPagesEnabled)
- {
- /* Enable global pages */
- Ke386SetCr4(Ke386GetCr4() | X86_CR4_PGE);
- }
-
-
- Offset = InterlockedIncrementUL(&PcrsAllocated) - 1;
- Pcr = (PKIPCR)((ULONG_PTR)KPCR_BASE + Offset * PAGE_SIZE);
-
- /*
- * Initialize the GDT
- */
- KiInitializeGdt((PKPCR)Pcr);
-
- /* Get processor information. */
- Ki386GetCpuId();
-
- /* Check FPU/MMX/SSE support. */
- KiCheckFPU();
-
- KeInitDpc(Pcr->Prcb);
- InitializeListHead(&Pcr->PrcbData.WaitListHead);
-
- if (Pcr->PrcbData.FeatureBits & X86_FEATURE_SYSCALL)
- {
- extern void KiFastCallEntry(void);
-
- /* CS Selector of the target segment. */
- Ke386Wrmsr(0x174, KGDT_R0_CODE, 0);
- /* Target ESP. */
- Ke386Wrmsr(0x175, 0, 0);
- /* Target EIP. */
- Ke386Wrmsr(0x176, (ULONG_PTR)KiFastCallEntry, 0);
- }
-
- /*
- * It is now safe to process interrupts
- */
- KeLowerIrql(DISPATCH_LEVEL);
-
- /*
- * Initialize the TSS
- */
- Ki386ApplicationProcessorInitializeTSS();
-
- /*
- * Initialize a default LDT
- */
- Ki386InitializeLdt();
-
- /* Now we can enable interrupts. */
- Ke386EnableInterrupts();
}
VOID
@@ -423,42 +279,8 @@
}
p1 = p2;
}
-#if 0
- /*
- * FIXME:
- * Make the detection of the noexecute feature more portable.
- */
- if(KPCR->PrcbData.CpuType == 0xf &&
- RtlCompareMemory("AuthenticAMD", KPCR->PrcbData.VendorString, 12) ==
12)
- {
- if (NoExecute)
- {
- ULONG Flags, l, h;
- Ke386SaveFlags(Flags);
- Ke386DisableInterrupts();
-
- Ke386Rdmsr(0xc0000080, l, h);
- l |= (1 << 11);
- Ke386Wrmsr(0xc0000080, l, h);
- Ke386NoExecute = TRUE;
- Ke386RestoreFlags(Flags);
- }
- }
- else
- {
- NoExecute=FALSE;
- }
-#endif
Ke386Pae = Ke386GetCr4() & X86_CR4_PAE ? TRUE : FALSE;
-#if 0
- /* Enable PAE mode */
- if ((Pae && (KPCR->PrcbData.FeatureBits & X86_FEATURE_PAE)) ||
NoExecute)
- {
- MiEnablePAE((PVOID*)LastKernelAddress);
- Ke386PaeEnabled = TRUE;
- }
-#endif
if (KPCR->PrcbData.FeatureBits & X86_FEATURE_SYSCALL)
{
extern void KiFastCallEntry(void);
Modified: trunk/reactos/ntoskrnl/ke/i386/main_asm.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/main_asm.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/main_asm.S (original)
+++ trunk/reactos/ntoskrnl/ke/i386/main_asm.S Thu Aug 31 21:10:58 2006
@@ -64,7 +64,7 @@
* Call the application processor initialization code
*/
pushl $0
- call _KiSystemStartup
+ call _KiSystemStartup@4
.m1:
/* Load the initial kernel stack */
Modified: trunk/reactos/ntoskrnl/ke/i386/tss.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/tss.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/tss.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/tss.c Thu Aug 31 21:10:58 2006
@@ -39,149 +39,6 @@
extern VOID KiTrap8(VOID);
/* FUNCTIONS *****************************************************************/
-
-BOOL STDCALL
-Ke386IoSetAccessProcess(PEPROCESS Process, BOOL EnableDisable)
-{
- KIRQL oldIrql;
- USHORT Offset;
-
- if(EnableDisable > 1) return FALSE;
- Offset = (EnableDisable) ? (USHORT) FIELD_OFFSET(KTSS, IoMaps) : 0xffff;
-
- oldIrql = KeRaiseIrqlToSynchLevel();
- Process->Pcb.IopmOffset = Offset;
-
- if(PsGetCurrentProcess() == Process)
- {
- KeGetCurrentKPCR()->TSS->IoMapBase = Offset;
- }
-
- KeLowerIrql(oldIrql);
- return TRUE;
-}
-
-
-BOOL STDCALL
-Ke386SetIoAccessMap(DWORD MapNumber, PULONG IOMapStart)
-{
- KIRQL oldIrql;
-
- if(MapNumber != 1) return FALSE;
-
- oldIrql = KeRaiseIrqlToSynchLevel();
-
- memcpy(&KeGetCurrentKPCR()->TSS->IoMaps[0],
- IOMapStart,
- 0x2000);
-
- KeGetCurrentKPCR()->TSS->IoMapBase = KeGetCurrentProcess()->IopmOffset;
- KeLowerIrql(oldIrql);
- return TRUE;
-}
-
-BOOL STDCALL
-Ke386QueryIoAccessMap(DWORD MapNumber, PULONG IOMapStart)
-{
- KIRQL oldIrql;
-
- if(MapNumber == 0x0)
- {
- memset(IOMapStart, 0xff, 0x2000);
- return TRUE;
- } else if(MapNumber != 1) return FALSE;
-
- oldIrql = KeRaiseIrqlToSynchLevel();
-
- memcpy(IOMapStart,
- &KeGetCurrentKPCR()->TSS->IoMaps[0],
- 0x2000);
-
- KeLowerIrql(oldIrql);
- return TRUE;
-}
-
-VOID
-Ki386ApplicationProcessorInitializeTSS(VOID)
-{
- ULONG cr3_;
- PKTSS Tss;
- PKTSS TrapTss;
- PVOID TrapStack;
- ULONG Id;
- PUSHORT Gdt;
- ULONG base, length;
-
- Id = KeGetCurrentProcessorNumber();
- Gdt = KeGetCurrentKPCR()->GDT;
-
- Ke386GetPageTableDirectory(cr3_);
-
- Tss = ExAllocatePool(NonPagedPool, sizeof(KTSS));
- TrapTss = ExAllocatePool(NonPagedPool, sizeof(KTSSNOIOPM));
- TrapStack = ExAllocatePool(NonPagedPool, KERNEL_STACK_SIZE);
-
- Ki386TssArray[Id] = Tss;
- Ki386TrapTssArray[Id] = (KTSSNOIOPM*)TrapTss;
- Ki386TrapStackArray[Id] = TrapStack;
- KeGetCurrentKPCR()->TSS = Tss;
-
- /* Initialize the boot TSS. */
- Tss->Esp0 = (ULONG)Ki386InitialStackArray[Id] + KERNEL_STACK_SIZE; /* FIXME: -
sizeof(FX_SAVE_AREA)? */
- Tss->Ss0 = KGDT_R0_DATA;
- Tss->IoMapBase = 0xFFFF; /* No i/o bitmap */
- Tss->LDT = 0;
-
- /*
- * Initialize a descriptor for the TSS
- */
- base = (ULONG)Tss;
- length = sizeof(KTSS) - 1;
-
- Gdt[(KGDT_TSS / 2) + 0] = (USHORT)(length & 0xFFFF);
- Gdt[(KGDT_TSS / 2) + 1] = (USHORT)(base & 0xFFFF);
- Gdt[(KGDT_TSS / 2) + 2] = (USHORT)(((base & 0xFF0000) >> 16) | 0x8900);
- Gdt[(KGDT_TSS / 2) + 3] = (USHORT)(((length & 0xF0000) >> 16) |
- ((base & 0xFF000000) >> 16));
-
- /* Initialize the TSS used for handling double faults. */
- TrapTss->Flags = 0;
- TrapTss->Esp0 = ((ULONG)TrapStack + KERNEL_STACK_SIZE); /* FIXME: -
sizeof(FX_SAVE_AREA)? */
- TrapTss->Ss0 = KGDT_R0_DATA;
- TrapTss->Cs = KGDT_R0_CODE;
- TrapTss->Eip = (ULONG)KiTrap8;
- TrapTss->Ds = KGDT_R0_DATA;
- TrapTss->Es = KGDT_R0_DATA;
- TrapTss->Fs = KGDT_R0_PCR;
- TrapTss->IoMapBase = 0xFFFF; /* No i/o bitmap */
- TrapTss->LDT = 0;
-
- /*
- * Initialize a descriptor for the trap TSS.
- */
- base = (ULONG)TrapTss;
- length = sizeof(KTSSNOIOPM) - 1;
-
- Gdt[(KGDT_DF_TSS / 2) + 0] = (USHORT)(length & 0xFFFF);
- Gdt[(KGDT_DF_TSS / 2) + 1] = (USHORT)(base & 0xFFFF);
- Gdt[(KGDT_DF_TSS / 2) + 2] = (USHORT)(((base & 0xFF0000) >> 16) | 0x8900);
- Gdt[(KGDT_DF_TSS / 2) + 3] = (USHORT)(((length & 0xF0000) >> 16) |
- ((base & 0xFF000000) >> 16));
-
- /*
- * Load the task register
- */
-#if defined(__GNUC__)
- __asm__("ltr %%ax"
- : /* no output */
- : "a" (KGDT_TSS));
-#elif defined(_MSC_VER)
- __asm mov ax, KGDT_TSS
- __asm ltr ax
-#else
-#error Unknown compiler for inline assembler
-#endif
-}
VOID INIT_FUNCTION
Ki386BootInitializeTSS(VOID)
Modified: trunk/reactos/ntoskrnl/ke/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/main.c?rev=238…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/main.c (original)
+++ trunk/reactos/ntoskrnl/ke/main.c Thu Aug 31 21:10:58 2006
@@ -66,8 +66,6 @@
extern unsigned int _image_base__;
ULONG_PTR KERNEL_BASE = (ULONG_PTR)&_image_base__;
-VOID INIT_FUNCTION _main(ULONG MultiBootMagic, PROS_LOADER_PARAMETER_BLOCK
_LoaderBlock);
-
#if defined (ALLOC_PRAGMA)
#pragma alloc_text(INIT, _main)
#endif
@@ -87,55 +85,39 @@
}
VOID
-#ifdef __GNUC__
-__attribute((noinline))
-#endif
+NTAPI
KiSystemStartup(BOOLEAN BootProcessor)
{
DPRINT("KiSystemStartup(%d)\n", BootProcessor);
- /* Initialize the Application Processor */
- if (!BootProcessor) KeApplicationProcessorInit();
-
/* Initialize the Processor with HAL */
HalInitializeProcessor(KeNumberProcessors,
(PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
- /* Load the Kernel if this is the Boot CPU, else inialize the App CPU only */
- if (BootProcessor) {
-
- /* Initialize the Kernel Executive */
- ExpInitializeExecutive();
-
- /* Create the IOPM Save Area */
- Ki386IopmSaveArea = ExAllocatePoolWithTag(NonPagedPool,
- PAGE_SIZE * 2,
- TAG('K', 'e', '
', ' '));
-
- /* Free Initial Memory */
- MiFreeInitMemory();
+ /* Initialize the Kernel Executive */
+ ExpInitializeExecutive();
+
+ /* Create the IOPM Save Area */
+ Ki386IopmSaveArea = ExAllocatePoolWithTag(NonPagedPool,
+ PAGE_SIZE * 2,
+ TAG('K', 'e', ' ',
' '));
+
+ /* Free Initial Memory */
+ MiFreeInitMemory();
/* Never returns */
#if 0
- /* FIXME:
- * The initial thread isn't a real ETHREAD object, we cannot call
PspExitThread.
- */
- PspExitThread(STATUS_SUCCESS);
+ /* FIXME:
+ * The initial thread isn't a real ETHREAD object, we cannot call
PspExitThread.
+ */
+ PspExitThread(STATUS_SUCCESS);
#else
- while (1) {
- LARGE_INTEGER Timeout;
- Timeout.QuadPart = 0x7fffffffffffffffLL;
- KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
- }
+ while (1)
+ {
+ LARGE_INTEGER Timeout;
+ Timeout.QuadPart = 0x7fffffffffffffffLL;
+ KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
+ }
#endif
- } else {
-
- /* Do application processor initialization */
- KeApplicationProcessorInitDispatcher();
-
- /* Lower IRQL and go to Idle Thread */
- KeLowerIrql(PASSIVE_LEVEL);
- PsIdleThreadMain(NULL);
- }
/* Bug Check and loop forever if anything failed */
KEBUGCHECK(0);
Modified: trunk/reactos/ntoskrnl/ntoskrnl.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.def?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl.def (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl.def Thu Aug 31 21:10:58 2006
@@ -513,9 +513,6 @@
KdPowerTransition@4
KdpServiceDispatcher@12
Ke386CallBios@8
-Ke386IoSetAccessProcess@8
-Ke386QueryIoAccessMap@8
-Ke386SetIoAccessMap@8
@KeAcquireGuardedMutex@4
@KeAcquireGuardedMutexUnsafe@4
KeAcquireSpinLockAtDpcLevel@4