Author: sginsberg
Date: Sun Sep 27 12:09:38 2009
New Revision: 43180
URL:
http://svn.reactos.org/svn/reactos?rev=43180&view=rev
Log:
- Change CPUID to match the old Ki386Cpuid and take 4 output arguments instead of an
array. This way we save some stack when using a dummy cpuid for synchronization and can
query only the registers we want in the case we don't want all 4.
- Simplify Ke386GetTr and Ke386GetLocalDescriptorTable to return by value instead of
reference.
- Make RDMSR smaller by making it fastcall as rdmsr takes its argument in ecx.
- Fix KiGetCacheInformation -- it only handled the Intel and AMD case.
- Replace Ke386HaltProcessor with __halt.
- KiHaltProcessorDpcRoutine: Always halt the processor for the architectures we support
for consistency.
- Clean up x86 and PPC headers from deprecated stuff.
- Fix broken LOCK undefine in v86m_sup.S -- LOCK is used both in a macro and the code, so
only undefine it where required and redefine it after it is used (this worked because LOCK
was interpreted as lock).
Get rid of KeArch*:
- Rename KeArchInitThreadWithContext to KiInitializeContextThread and use the same name
for all architectures.
- Kill KeArchHaltProcessor. Use __halt and KeArmHaltProcessor directly instead.
- Use Ke386FnInit instead of KeArchFnInit -- it is only used for x86.
Modified:
trunk/reactos/hal/halx86/generic/processor.c
trunk/reactos/hal/halx86/generic/reboot.c
trunk/reactos/include/crt/mingw32/intrin_x86.h
trunk/reactos/include/crt/msc/intrin.h
trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
trunk/reactos/ntoskrnl/ex/shutdown.c
trunk/reactos/ntoskrnl/include/internal/arm/ke.h
trunk/reactos/ntoskrnl/include/internal/i386/intrin_i.h
trunk/reactos/ntoskrnl/include/internal/i386/ke.h
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/include/internal/ke_x.h
trunk/reactos/ntoskrnl/include/internal/powerpc/ke.h
trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
trunk/reactos/ntoskrnl/ke/arm/thrdini.c
trunk/reactos/ntoskrnl/ke/bug.c
trunk/reactos/ntoskrnl/ke/i386/cpu.c
trunk/reactos/ntoskrnl/ke/i386/kiinit.c
trunk/reactos/ntoskrnl/ke/i386/thrdini.c
trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S
trunk/reactos/ntoskrnl/ke/powerpc/thrdini.c
trunk/reactos/ntoskrnl/ke/thrdobj.c
Modified: trunk/reactos/hal/halx86/generic/processor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/process…
==============================================================================
--- trunk/reactos/hal/halx86/generic/processor.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/processor.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -70,7 +70,7 @@
{
/* Enable interrupts and halt the processor */
_enable();
- Ke386HaltProcessor();
+ __halt();
}
/*
Modified: trunk/reactos/hal/halx86/generic/reboot.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/reboot.…
==============================================================================
--- trunk/reactos/hal/halx86/generic/reboot.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/reboot.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -67,7 +67,7 @@
HalpWriteResetCommand();
/* Halt the CPU */
- Ke386HaltProcessor();
+ __halt();
}
/* PUBLIC FUNCTIONS **********************************************************/
Modified: trunk/reactos/include/crt/mingw32/intrin_x86.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin…
==============================================================================
--- trunk/reactos/include/crt/mingw32/intrin_x86.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/mingw32/intrin_x86.h [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -1107,6 +1107,10 @@
__asm__("sti");
}
+__INTRIN_INLINE void __halt(void)
+{
+ __asm__("hlt\n\t");
+}
/*** Protected memory management ***/
Modified: trunk/reactos/include/crt/msc/intrin.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/msc/intrin.h?r…
==============================================================================
--- trunk/reactos/include/crt/msc/intrin.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/msc/intrin.h [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -145,6 +145,7 @@
void __int2c(void);
void _disable(void);
void _enable(void);
+void __halt(void);
/*** Protected memory management ***/
void __writecr0(const unsigned __int64 Data);
Modified: trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/i386/cmhar…
==============================================================================
--- trunk/reactos/ntoskrnl/config/i386/cmhardwr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/i386/cmhardwr.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -238,7 +238,7 @@
HANDLE KeyHandle, BiosHandle, SystemHandle, FpuHandle, SectionHandle;
CONFIGURATION_COMPONENT_DATA ConfigData;
CHAR Buffer[128];
- ULONG ExtendedId, CpuInfo[4];
+ ULONG ExtendedId, Dummy;
PKPRCB Prcb;
USHORT IndexTable[MaximumType + 1] = {0};
ANSI_STRING TempString;
@@ -428,8 +428,7 @@
else
{
/* Check if we have extended CPUID that supports name ID */
- CPUID(CpuInfo, 0x80000000);
- ExtendedId = CpuInfo[0];
+ CPUID(0x80000000, &ExtendedId, &Dummy, &Dummy,
&Dummy);
if (ExtendedId >= 0x80000004)
{
/* Do all the CPUIDs required to get the full name */
@@ -437,8 +436,11 @@
for (ExtendedId = 2; ExtendedId <= 4; ExtendedId++)
{
/* Do the CPUID and save the name string */
- CPUID((PULONG)PartialString,
- 0x80000000 | ExtendedId);
+ CPUID(0x80000000 | ExtendedId,
+ (PULONG)PartialString,
+ (PULONG)PartialString + 1,
+ (PULONG)PartialString + 2,
+ (PULONG)PartialString + 3);
/* Go to the next name string */
PartialString += 16;
Modified: trunk/reactos/ntoskrnl/ex/shutdown.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/shutdown.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/shutdown.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/shutdown.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -14,26 +14,30 @@
/* FUNCTIONS *****************************************************************/
-VOID NTAPI
+VOID
+NTAPI
KiHaltProcessorDpcRoutine(IN PKDPC Dpc,
- IN PVOID DeferredContext,
- IN PVOID SystemArgument1,
- IN PVOID SystemArgument2)
-{
- KIRQL OldIrql;
- if (DeferredContext)
- {
- ExFreePool(DeferredContext);
- }
- while (TRUE)
- {
- KeRaiseIrql(SYNCH_LEVEL, &OldIrql);
-#if defined(_M_IX86)
- Ke386HaltProcessor();
+ IN PVOID DeferredContext,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2)
+{
+ KIRQL OldIrql;
+ if (DeferredContext)
+ {
+ ExFreePool(DeferredContext);
+ }
+
+ while (TRUE)
+ {
+ KeRaiseIrql(SYNCH_LEVEL, &OldIrql);
+#if defined(_M_IX86) || defined(_M_AMD64)
+ __halt();
+#elif defined(_M_ARM)
+ KeArmHaltProcessor();
#else
- HalProcessorIdle();
+ HalProcessorIdle();
#endif
- }
+ }
}
VOID NTAPI
Modified: trunk/reactos/ntoskrnl/include/internal/arm/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] Sun Sep 27 12:09:38
2009
@@ -6,18 +6,6 @@
//
#define PCR_ENTRY 0
#define PDR_ENTRY 2
-
-#define KeArchHaltProcessor() KeArmHaltProcessor()
-
-VOID
-NTAPI
-KeArmInitThreadWithContext(
- IN PKTHREAD Thread,
- IN PKSYSTEM_ROUTINE SystemRoutine,
- IN PKSTART_ROUTINE StartRoutine,
- IN PVOID StartContext,
- IN PCONTEXT Context
-);
VOID
KiPassiveRelease(
@@ -44,7 +32,6 @@
VOID
);
-#define KeArchInitThreadWithContext KeArmInitThreadWithContext
#define KiSystemStartupReal KiSystemStartup
#define KiGetPreviousMode(tf) \
Modified: trunk/reactos/ntoskrnl/include/internal/i386/intrin_i.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/intrin_i.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/intrin_i.h [iso-8859-1] Sun Sep 27
12:09:38 2009
@@ -1,11 +1,5 @@
#ifndef _INTRIN_INTERNAL_
#define _INTRIN_INTERNAL_
-
-#ifdef CONFIG_SMP
-#define LOCK "lock ; "
-#else
-#define LOCK ""
-#endif
#if defined(__GNUC__)
@@ -20,11 +14,17 @@
: /* no input */ \
: "memory");
-#define Ke386GetLocalDescriptorTable(X) \
- __asm__("sldt %0\n\t" \
- : "=m" (*X) \
- : /* no input */ \
+FORCEINLINE
+USHORT
+Ke386GetLocalDescriptorTable()
+{
+ USHORT Ldt;
+ __asm__("sldt %0\n\t"
+ : "=m" (Ldt)
+ : /* no input */
: "memory");
+ return Ldt;
+}
#define Ke386SetLocalDescriptorTable(X) \
__asm__("lldt %w0\n\t" \
@@ -33,19 +33,23 @@
#define Ke386SetTr(X) __asm__ __volatile__("ltr %%ax" :
:"a" (X));
-#define Ke386GetTr(X) \
- __asm__("str %0\n\t" \
- : "=m" (*X));
+FORCEINLINE
+USHORT
+Ke386GetTr(VOID)
+{
+ USHORT Tr;
+ __asm__("str %0\n\t"
+ : "=m" (Tr));
+ return Tr;
+}
#define _Ke386GetSeg(N) ({ \
unsigned int __d; \
__asm__("movl %%" #N ",%0\n\t"
:"=r" (__d)); \
__d; \
- })
+ })
#define _Ke386SetSeg(N,X) __asm__ __volatile__("movl %0,%%" #N :
:"r" (X));
-
-#define Ke386HaltProcessor() __asm__("hlt\n\t");
#define Ke386FnInit() __asm__("fninit\n\t");
@@ -77,13 +81,6 @@
FORCEINLINE
VOID
-Ke386HaltProcessor(VOID)
-{
- __asm hlt;
-}
-
-FORCEINLINE
-VOID
Ke386GetGlobalDescriptorTable(OUT PVOID Descriptor)
{
__asm sgdt [Descriptor];
@@ -97,12 +94,10 @@
}
FORCEINLINE
-VOID
-Ke386GetLocalDescriptorTable(OUT PUSHORT Descriptor)
-{
- USHORT _Descriptor;
- __asm sldt _Descriptor;
- *Descriptor = _Descriptor;
+USHORT
+Ke386GetLocalDescriptorTable(VOID)
+{
+ __asm sldt ax;
}
FORCEINLINE
@@ -121,11 +116,9 @@
FORCEINLINE
USHORT
-Ke386GetTr(OUT PUSHORT Tr)
-{
- USHORT _Tr;
- __asm str _Tr;
- *Tr = _Tr;
+Ke386GetTr(VOID)
+{
+ __asm str ax;
}
//
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Sun Sep 27 12:09:38
2009
@@ -1,23 +1,12 @@
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_I386_KE_H
#define __NTOSKRNL_INCLUDE_INTERNAL_I386_KE_H
-
-#define FRAME_EDITED 0xFFF8
#ifndef __ASM__
#include "intrin_i.h"
#include "v86m.h"
-#define KeArchFnInit() Ke386FnInit()
-#define KeArchHaltProcessor() Ke386HaltProcessor()
-
extern ULONG Ke386CacheAlignment;
-
-struct _KPCR;
-VOID
-KiInitializeGdt(struct _KPCR* Pcr);
-VOID
-Ki386ApplicationProcessorInitializeTSS(VOID);
VOID
FASTCALL
@@ -26,13 +15,6 @@
IN PKIDTENTRY Idt,
IN PKGDTENTRY Gdt
);
-
-VOID
-KiGdtPrepareForApplicationProcessorInit(ULONG Id);
-VOID
-Ki386InitializeLdt(VOID);
-VOID
-Ki386SetProcessorFeatures(VOID);
VOID
NTAPI
@@ -62,23 +44,6 @@
NTAPI
KiGetFeatureBits(VOID);
-ULONG KeAllocateGdtSelector(ULONG Desc[2]);
-VOID KeFreeGdtSelector(ULONG Entry);
-VOID
-KeApplicationProcessorInitDispatcher(VOID);
-VOID
-KeCreateApplicationProcessorIdleThread(ULONG Id);
-
-VOID
-NTAPI
-Ke386InitThreadWithContext(PKTHREAD Thread,
- PKSYSTEM_ROUTINE SystemRoutine,
- PKSTART_ROUTINE StartRoutine,
- PVOID StartContext,
- PCONTEXT Context);
-#define
KeArchInitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context) \
- Ke386InitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context)
-
#ifdef _NTOSKRNL_ /* FIXME: Move flags above to NDK instead of here */
VOID
NTAPI
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -276,8 +276,11 @@
VOID
NTAPI
CPUID(
- OUT ULONG CpuInfo[4],
- IN ULONG InfoType
+ IN ULONG InfoType,
+ OUT PULONG CpuInfoEax,
+ OUT PULONG CpuInfoEbx,
+ OUT PULONG CpuInfoEcx,
+ OUT PULONG CpuInfoEdx
);
BOOLEAN
@@ -482,6 +485,16 @@
VOID
NTAPI
+KiInitializeContextThread(
+ PKTHREAD Thread,
+ PKSYSTEM_ROUTINE SystemRoutine,
+ PKSTART_ROUTINE StartRoutine,
+ PVOID StartContext,
+ PCONTEXT Context
+);
+
+VOID
+NTAPI
KeStartThread(
IN OUT PKTHREAD Thread
);
Modified: trunk/reactos/ntoskrnl/include/internal/ke_x.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke_x.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke_x.h [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -392,7 +392,7 @@
{
/* Clear it */
KeGetCurrentPrcb()->NpxThread = NULL;
- KeArchFnInit();
+ Ke386FnInit();
}
#endif
}
Modified: trunk/reactos/ntoskrnl/include/internal/powerpc/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/powerpc/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/powerpc/ke.h [iso-8859-1] Sun Sep 27 12:09:38
2009
@@ -35,96 +35,9 @@
extern ULONG KePPCCacheAlignment;
-struct _KPCR;
-VOID
-KiInitializeGdt(struct _KPCR* Pcr);
-VOID
-KiPPCApplicationProcessorInitializeTSS(VOID);
-VOID
-KiPPCBootInitializeTSS(VOID);
-VOID
-KiGdtPrepareForApplicationProcessorInit(ULONG Id);
-VOID
-KiPPCInitializeLdt(VOID);
-VOID
-KiPPCSetProcessorFeatures(VOID);
-ULONG KeAllocateGdtSelector(ULONG Desc[2]);
-VOID KeFreeGdtSelector(ULONG Entry);
-
-#ifdef CONFIG_SMP
-#define LOCK "isync ; "
-#else
-#define LOCK ""
-#endif
-
-
-static inline LONG KePPCTestAndClearBit(ULONG BitPos, volatile PULONG Addr)
-{
- ULONG OldValue, NewValue;
-
- __asm__ __volatile__ ("lwarx %0,0,%1"
- : "=r" (OldValue), "=r" (*Addr)
- :
- : "memory");
-
- NewValue = OldValue & ~(1<<BitPos);
-
- __asm__ __volatile__ ("stwcx. %0,0,%3\n\t"
- "beq success\n\t"
- "add %2,0,%1\n"
- "success:\n\t"
- "isync\n\t"
- : "=r" (NewValue), "=r" (OldValue)
- : "w" (NewValue), "w" (*Addr)
- : "memory");
-
- return NewValue & (1 << BitPos);
-}
-
-static inline LONG KePPCTestAndSetBit(ULONG BitPos, volatile PULONG Addr)
-{
- ULONG OldValue, NewValue;
-
- __asm__ __volatile__ ("lwarx %0,0,%1"
- : "=r" (OldValue), "=r" (*Addr)
- :
- : "memory");
-
- NewValue = OldValue | (1<<BitPos);
-
- __asm__ __volatile__ ("stwcx. %0,0,%3\n\t"
- "beq success\n\t"
- "add %2,0,%1\n"
- "success:\n\t"
- "isync\n\t"
- : "=r" (NewValue), "=r" (OldValue)
- : "w" (NewValue), "w" (*Addr)
- : "memory");
-
- return NewValue & (1 << BitPos);
-}
-
#define KePPCRdmsr(msr,val1,val2) __asm__ __volatile__("mfmsr 3")
#define KePPCWrmsr(msr,val1,val2) __asm__ __volatile__("mtmsr 3")
-
-
-#define KePPCDisableInterrupts() \
-__asm__ __volatile__("mfmsr 0\n\t" \
- "li 8,0x7fff\n\t" \
- "and 0,8,0\n\t" \
- "mtmsr 0\n\t")
-
-#define KePPCEnableInterrupts() \
- __asm__ __volatile__("mfmsr 0\n\t" \
- "lis 8,0x8000@ha\n\t" \
- "or 0,8,0\n\t" \
- "mtmsr 0\n\t")
-
-#define KePPCHaltProcessor()
-
-#define KeArchEraseFlags()
-#define KeArchDisableInterrupts() KePPCDisableInterrupts()
#define PPC_MIN_CACHE_LINE_SIZE 32
@@ -132,30 +45,6 @@
VOID)
{
return (struct _KPCR *)__readfsdword(0x1c);
-}
-
-VOID
-NTAPI
-KePPCInitThreadWithContext(
- PKTHREAD Thread,
- PKSYSTEM_ROUTINE SystemRoutine,
- PKSTART_ROUTINE StartRoutine,
- PVOID StartContext,
- PCONTEXT Context);
-
-VOID
-NTAPI
-KeApplicationProcessorInitDispatcher(
- VOID);
-
-VOID
-NTAPI
-KeCreateApplicationProcessorIdleThread(
- ULONG Id);
-
-static VOID KePPCFnInit()
-{
- __asm__("mfmsr 0\n\tori 0,0,0x2000\n\tmtmsr 0");
}
#ifdef _NTOSKRNL_ /* FIXME: Move flags above to NDK instead of here */
@@ -167,16 +56,8 @@
BOOLEAN UserThread,
KTRAP_FRAME TrapFrame);
#endif
-VOID
-NTAPI
-KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState);
#endif /* __ASM__ */
-
-#define KeArchFnInit() KePPCFnInit()
-#define KeArchHaltProcessor() KePPCHaltProcessor()
-#define
KeArchInitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context) \
- KePPCInitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context)
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_POWERPC_KE_H */
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_cli.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -648,8 +648,8 @@
else if (Argv[0][0] == 'c') /* cregs */
{
ULONG Cr0, Cr2, Cr3, Cr4;
- KDESCRIPTOR Gdtr, Ldtr, Idtr;
- ULONG Tr;
+ KDESCRIPTOR Gdtr, Idtr;
+ USHORT Ldtr;
static const PCHAR Cr0Bits[32] = { " PE", " MP", "
EM", " TS", " ET", " NE", NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL,
" WP", NULL, " AM", NULL,
NULL, NULL, NULL, NULL,
@@ -666,11 +666,8 @@
/* Get descriptor table regs */
Ke386GetGlobalDescriptorTable(&Gdtr.Limit);
- Ke386GetLocalDescriptorTable(&Ldtr.Limit);
+ Ldtr = Ke386GetLocalDescriptorTable();
__sidt(&Idtr.Limit);
-
- /* Get the task register */
- Ke386GetTr((PUSHORT)&Tr);
/* Display the control registers */
KdbpPrint("CR0 0x%08x ", Cr0);
@@ -700,7 +697,7 @@
/* Display the descriptor table regs */
KdbpPrint("\nGDTR Base 0x%08x Size 0x%04x\n", Gdtr.Base,
Gdtr.Limit);
- KdbpPrint("LDTR Base 0x%08x Size 0x%04x\n", Ldtr.Base, Ldtr.Limit);
+ KdbpPrint("LDTR 0x%04x\n", Ldtr);
KdbpPrint("IDTR Base 0x%08x Size 0x%04x\n", Idtr.Base, Idtr.Limit);
}
else if (Argv[0][0] == 's') /* sregs */
@@ -1619,7 +1616,8 @@
ASSERT(Argv[0][0] == 'l');
/* Read LDTR */
- Ke386GetLocalDescriptorTable(&Reg.Limit);
+ Reg.Limit = Ke386GetLocalDescriptorTable();
+ Reg.Base = 0;
i = 0;
ul = 1 << 2;
}
Modified: trunk/reactos/ntoskrnl/ke/arm/thrdini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/thrdini.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/thrdini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/thrdini.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -34,11 +34,11 @@
VOID
NTAPI
-KeArmInitThreadWithContext(IN PKTHREAD Thread,
- IN PKSYSTEM_ROUTINE SystemRoutine,
- IN PKSTART_ROUTINE StartRoutine,
- IN PVOID StartContext,
- IN PCONTEXT ContextPointer)
+KiInitializeContextThread(IN PKTHREAD Thread,
+ IN PKSYSTEM_ROUTINE SystemRoutine,
+ IN PKSTART_ROUTINE StartRoutine,
+ IN PVOID StartContext,
+ IN PCONTEXT ContextPointer)
{
PKTRAP_FRAME TrapFrame;
PKEXCEPTION_FRAME ExceptionFrame = NULL, CtxSwitchFrame;
Modified: trunk/reactos/ntoskrnl/ke/bug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=4318…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -552,7 +552,13 @@
KiBugCheckDebugBreak(IN ULONG StatusCode)
{
/* If KDBG isn't connected, freeze the CPU, otherwise, break */
- if (KdDebuggerNotPresent) for (;;) KeArchHaltProcessor();
+#if defined(_M_IX86) || defined(_M_AMD64)
+ if (KdDebuggerNotPresent) for (;;) __halt();
+#elif defined(_M_ARM)
+ if (KdDebuggerNotPresent) for (;;) KeArmHaltProcessor();
+#else
+#error
+#endif
DbgBreakPointWithStatus(StatusCode);
while (TRUE);
}
@@ -1176,7 +1182,13 @@
else if (KeBugCheckOwnerRecursionCount > 2)
{
/* Halt the CPU */
- for (;;) KeArchHaltProcessor();
+#if defined(_M_IX86) || defined(_M_AMD64)
+ for (;;) __halt();
+#elif defined(_M_ARM)
+ for (;;) KeArmHaltProcessor();
+#else
+#error
+#endif
}
}
Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -87,11 +87,22 @@
VOID
NTAPI
-CPUID(OUT ULONG CpuInfo[4],
- IN ULONG InfoType)
-{
+CPUID(IN ULONG InfoType,
+ OUT PULONG CpuInfoEax,
+ OUT PULONG CpuInfoEbx,
+ OUT PULONG CpuInfoEcx,
+ OUT PULONG CpuInfoEdx)
+{
+ ULONG CpuInfo[4];
+
/* Perform the CPUID Operation */
__cpuid((int*)CpuInfo, InfoType);
+
+ /* Return the results */
+ *CpuInfoEax = CpuInfo[0];
+ *CpuInfoEbx = CpuInfo[1];
+ *CpuInfoEcx = CpuInfo[2];
+ *CpuInfoEdx = CpuInfo[3];
}
VOID
@@ -104,7 +115,7 @@
}
LONGLONG
-NTAPI
+FASTCALL
RDMSR(IN ULONG Register)
{
/* Read from the MSR */
@@ -118,7 +129,7 @@
KiSetProcessorType(VOID)
{
ULONG EFlags, NewEFlags;
- ULONG Reg[4];
+ ULONG Reg, Dummy;
ULONG Stepping, Type;
/* Start by assuming no CPUID data */
@@ -140,11 +151,11 @@
__writeeflags(EFlags);
/* Peform CPUID 0 to see if CPUID 1 is supported */
- CPUID(Reg, 0);
- if (Reg[0] > 0)
+ CPUID(0, &Reg, &Dummy, &Dummy, &Dummy);
+ if (Reg > 0)
{
/* Do CPUID 1 now */
- CPUID(Reg, 1);
+ CPUID(1, &Reg, &Dummy, &Dummy, &Dummy);
/*
* Get the Stepping and Type. The stepping contains both the
@@ -153,11 +164,11 @@
*
* For the stepping, we convert this: zzzzzzxy into this: x0y
*/
- Stepping = Reg[0] & 0xF0;
+ Stepping = Reg & 0xF0;
Stepping <<= 4;
- Stepping += (Reg[0] & 0xFF);
+ Stepping += (Reg & 0xFF);
Stepping &= 0xF0F;
- Type = Reg[0] & 0xF00;
+ Type = Reg & 0xF00;
Type >>= 8;
/* Save them in the PRCB */
@@ -192,7 +203,7 @@
if (!Prcb->CpuID) return 0;
/* Get the Vendor ID and null-terminate it */
- CPUID(Vendor, 0);
+ CPUID(0, &Vendor[0], &Vendor[1], &Vendor[2], &Vendor[3]);
Vendor[4] = 0;
/* Re-arrange vendor string */
@@ -247,7 +258,7 @@
PKPRCB Prcb = KeGetCurrentPrcb();
ULONG Vendor;
ULONG FeatureBits = KF_WORKING_PTE;
- ULONG Reg[4];
+ ULONG Reg[4], Dummy;
BOOLEAN ExtendedCPUID = TRUE;
ULONG CpuFeatures = 0;
@@ -258,7 +269,7 @@
if (!Vendor) return FeatureBits;
/* Get the CPUID Info. Features are in Reg[3]. */
- CPUID(Reg, 1);
+ CPUID(1, &Reg[0], &Reg[1], &Dummy, &Reg[3]);
/* Set the initial APIC ID */
Prcb->InitialApicId = (UCHAR)(Reg[1] >> 24);
@@ -267,12 +278,13 @@
{
/* Intel CPUs */
case CPU_INTEL:
- /* Check if it's a P6 */
+
+ /* Check if it's a P6 or higher */
if (Prcb->CpuType == 6)
{
/* Perform the special sequence to get the MicroCode Signature */
WRMSR(0x8B, 0);
- CPUID(Reg, 1);
+ CPUID(1, &Dummy, &Dummy, &Dummy, &Dummy);
Prcb->UpdateSignature.QuadPart = RDMSR(0x8B);
}
else if (Prcb->CpuType == 5)
@@ -356,10 +368,14 @@
/* Cyrix CPUs */
case CPU_CYRIX:
+
+ /* FIXME: CMPXCGH8B */
+
break;
/* Transmeta CPUs */
case CPU_TRANSMETA:
+
/* Enable CMPXCHG8B if the family (>= 5), model and stepping (>= 4.2)
support it */
if ((Reg[0] & 0x0FFF) >= 0x0542)
{
@@ -372,6 +388,7 @@
/* Centaur, IDT, Rise and VIA CPUs */
case CPU_CENTAUR:
case CPU_RISE:
+
/* These CPUs don't report the presence of CMPXCHG8B through CPUID.
However, this feature exists and operates properly without any additional
steps. */
FeatureBits |= KF_CMPXCHG8B;
@@ -416,14 +433,14 @@
if (ExtendedCPUID)
{
/* Do the call */
- CPUID(Reg, 0x80000000);
+ CPUID(0x80000000, &Reg[0], &Dummy, &Dummy, &Dummy);
if ((Reg[0] & 0xffffff00) == 0x80000000)
{
/* Check if CPUID 0x80000001 is supported */
if (Reg[0] >= 0x80000001)
{
/* Check which extended features are available. */
- CPUID(Reg, 0x80000001);
+ CPUID(0x80000001, &Dummy, &Dummy, &Dummy, &Reg[3]);
/* Check if NX-bit is supported */
if (Reg[3] & 0x00100000) FeatureBits |= KF_NX_BIT;
@@ -450,7 +467,7 @@
{
PKIPCR Pcr = (PKIPCR)KeGetPcr();
ULONG Vendor;
- ULONG Data[4];
+ ULONG Data[4], Dummy;
ULONG CacheRequests = 0, i;
ULONG CurrentRegister;
UCHAR RegisterByte;
@@ -470,14 +487,14 @@
case CPU_INTEL:
/*Check if we support CPUID 2 */
- CPUID(Data, 0);
+ CPUID(0, &Data[0], &Dummy, &Dummy, &Dummy);
if (Data[0] >= 2)
{
/* We need to loop for the number of times CPUID will tell us to */
do
{
/* Do the CPUID call */
- CPUID(Data, 2);
+ CPUID(2, &Data[0], &Data[1], &Data[2], &Data[3]);
/* Check if it was the first call */
if (FirstPass)
@@ -539,15 +556,23 @@
case CPU_AMD:
/* Check if we support CPUID 0x80000006 */
- CPUID(Data, 0x80000000);
+ CPUID(0x80000000, &Data[0], &Dummy, &Dummy, &Dummy);
if (Data[0] >= 6)
{
/* Get 2nd level cache and tlb size */
- CPUID(Data, 0x80000006);
+ CPUID(0x80000006, &Dummy, &Dummy, &Data[2], &Dummy);
/* Set the L2 Cache Size */
Pcr->SecondLevelCacheSize = (Data[2] & 0xFFFF0000) >> 6;
}
+ break;
+
+ case CPU_CYRIX:
+ case CPU_TRANSMETA:
+ case CPU_CENTAUR:
+ case CPU_RISE:
+
+ /* FIXME */
break;
}
}
@@ -760,8 +785,8 @@
/* Save GDT, IDT, LDT and TSS */
Ke386GetGlobalDescriptorTable(&ProcessorState->SpecialRegisters.Gdtr.Limit);
__sidt(&ProcessorState->SpecialRegisters.Idtr.Limit);
- Ke386GetTr(&ProcessorState->SpecialRegisters.Tr);
- Ke386GetLocalDescriptorTable(&ProcessorState->SpecialRegisters.Ldtr);
+ ProcessorState->SpecialRegisters.Tr = Ke386GetTr();
+ ProcessorState->SpecialRegisters.Ldtr = Ke386GetLocalDescriptorTable();
}
VOID
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -32,7 +32,7 @@
ULONG i, Affinity, Sample = 0;
PFX_SAVE_AREA FxSaveArea;
ULONG MXCsrMask = 0xFFBF;
- ULONG Dummy[4];
+ ULONG Dummy;
KI_SAMPLE_MAP Samples[4];
PKI_SAMPLE_MAP CurrentSample = Samples;
@@ -179,7 +179,7 @@
for (;;)
{
/* Do a dummy CPUID to start the sample */
- CPUID(Dummy, 0);
+ CPUID(0, &Dummy, &Dummy, &Dummy, &Dummy);
/* Fill out the starting data */
CurrentSample->PerfStart = KeQueryPerformanceCounter(NULL);
@@ -192,7 +192,7 @@
&CurrentSample->PerfFreq);
/* Do another dummy CPUID */
- CPUID(Dummy, 0);
+ CPUID(0, &Dummy, &Dummy, &Dummy, &Dummy);
/* Fill out the ending data */
CurrentSample->PerfEnd =
@@ -620,7 +620,7 @@
*Idt = (PKIDTENTRY)IdtDescriptor.Base;
/* Get TSS and FS Selectors */
- Ke386GetTr(&Tr);
+ Tr = Ke386GetTr();
if (Tr != KGDT_TSS) Tr = KGDT_TSS; // FIXME: HACKHACK
Fs = Ke386GetFs();
Modified: trunk/reactos/ntoskrnl/ke/i386/thrdini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/thrdini.c…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -46,11 +46,11 @@
VOID
NTAPI
-Ke386InitThreadWithContext(IN PKTHREAD Thread,
- IN PKSYSTEM_ROUTINE SystemRoutine,
- IN PKSTART_ROUTINE StartRoutine,
- IN PVOID StartContext,
- IN PCONTEXT ContextPointer)
+KiInitializeContextThread(IN PKTHREAD Thread,
+ IN PKSYSTEM_ROUTINE SystemRoutine,
+ IN PKSTART_ROUTINE StartRoutine,
+ IN PVOID StartContext,
+ IN PCONTEXT ContextPointer)
{
PFX_SAVE_AREA FxSaveArea;
PFXSAVE_FORMAT FxSaveFormat;
Modified: trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/v86m_sup.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -10,7 +10,6 @@
#include <asm.h>
#include <internal/i386/asmmacro.S>
-#undef LOCK
.intel_syntax noprefix
/* FIXME: Can we make a nice macro to generate V86 Opcode handlers? */
@@ -140,6 +139,8 @@
UNHANDLED_V86_OPCODE
.endfunc
+#undef LOCK
+
GENERATE_PREFIX_HANDLER ES
GENERATE_PREFIX_HANDLER CS
GENERATE_PREFIX_HANDLER DS
@@ -151,6 +152,12 @@
GENERATE_PREFIX_HANDLER LOCK
GENERATE_PREFIX_HANDLER REP
GENERATE_PREFIX_HANDLER REPNE
+
+#ifdef CONFIG_SMP
+#define LOCK lock
+#else
+#define LOCK
+#endif
.func OpcodeINSBV86
_OpcodeINSBV86:
Modified: trunk/reactos/ntoskrnl/ke/powerpc/thrdini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/powerpc/thrdin…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/powerpc/thrdini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/powerpc/thrdini.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -50,11 +50,11 @@
VOID
NTAPI
-KePPCInitThreadWithContext(IN PKTHREAD Thread,
- IN PKSYSTEM_ROUTINE SystemRoutine,
- IN PKSTART_ROUTINE StartRoutine,
- IN PVOID StartContext,
- IN PCONTEXT ContextPointer)
+KiInitializeContextThread(IN PKTHREAD Thread,
+ IN PKSYSTEM_ROUTINE SystemRoutine,
+ IN PKSTART_ROUTINE StartRoutine,
+ IN PVOID StartContext,
+ IN PCONTEXT ContextPointer)
{
PFX_SAVE_AREA FxSaveArea;
PKSTART_FRAME StartFrame;
Modified: trunk/reactos/ntoskrnl/ke/thrdobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/thrdobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/thrdobj.c [iso-8859-1] Sun Sep 27 12:09:38 2009
@@ -818,11 +818,11 @@
_SEH2_TRY
{
/* Initalize the Thread Context */
- KeArchInitThreadWithContext(Thread,
- SystemRoutine,
- StartRoutine,
- StartContext,
- Context);
+ KiInitializeContextThread(Thread,
+ SystemRoutine,
+ StartRoutine,
+ StartContext,
+ Context);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{