__writecr3(__readcr3());
}
+FORCEINLINE
+VOID
+KeSweepICache(IN PVOID BaseAddress,
+ IN SIZE_T FlushSize)
+{
+ //
+ // Always sweep the whole cache
+ //
+ UNREFERENCED_PARAMETER(BaseAddress);
+ UNREFERENCED_PARAMETER(FlushSize);
+ __wbinvd();
+}
+
FORCEINLINE
PRKTHREAD
KeGetCurrentThread(VOID)
Ke386SetGdtEntryBase(&Pcr->GDT[KGDT_R3_TEB / sizeof(KGDTENTRY)], TebAddress);
}
+INIT_FUNCTION
VOID
FASTCALL
Ki386InitializeTss(
IN PKGDTENTRY Gdt
);
+INIT_FUNCTION
VOID
NTAPI
KiSetCR0Bits(VOID);
+INIT_FUNCTION
VOID
NTAPI
KiGetCacheInformation(VOID);
+INIT_FUNCTION
BOOLEAN
NTAPI
KiIsNpxPresent(
VOID
);
+INIT_FUNCTION
BOOLEAN
NTAPI
KiIsNpxErrataPresent(
VOID
);
+INIT_FUNCTION
VOID
NTAPI
KiSetProcessorType(VOID);
+INIT_FUNCTION
ULONG
NTAPI
KiGetFeatureBits(VOID);
OUT PTEB VdmTeb
);
+INIT_FUNCTION
VOID
NTAPI
KeI386VdmInitialize(
VOID
);
+INIT_FUNCTION
ULONG_PTR
NTAPI
Ki386EnableGlobalPage(
IN ULONG_PTR Context
);
+INIT_FUNCTION
ULONG_PTR
NTAPI
Ki386EnableTargetLargePage(
IN ULONG Cr3
);
+INIT_FUNCTION
VOID
NTAPI
KiI386PentiumLockErrataFixup(
VOID
);
+INIT_FUNCTION
VOID
NTAPI
KiInitializePAT(
VOID
);
+INIT_FUNCTION
VOID
NTAPI
KiInitializeMTRR(
IN BOOLEAN FinalCpu
);
+INIT_FUNCTION
VOID
NTAPI
KiAmdK6InitializeMTRR(
VOID
);
+INIT_FUNCTION
VOID
NTAPI
KiRestoreFastSyscallReturnState(
VOID
);
+INIT_FUNCTION
ULONG_PTR
NTAPI
Ki386EnableDE(
IN ULONG_PTR Context
);
+INIT_FUNCTION
ULONG_PTR
NTAPI
Ki386EnableFxsr(
IN ULONG_PTR Context
);
+INIT_FUNCTION
ULONG_PTR
NTAPI
Ki386EnableXMMIExceptions(
IN PKTRAP_FRAME TrapFrame
);
+BOOLEAN
+NTAPI
+VdmDispatchPageFault(
+ _In_ PKTRAP_FRAME TrapFrame
+);
+
BOOLEAN
FASTCALL
KiVdmOpcodePrefix(
IN PKTRAP_FRAME TrapFrame
);
+NTSTATUS
+NTAPI
+KiConvertToGuiThread(
+ VOID
+);
+
//
// Global x86 only Kernel data
//
extern ULONG KiMXCsrMask;
extern ULONG KeI386CpuType;
extern ULONG KeI386CpuStep;
-extern ULONG Ke386CacheAlignment;
extern ULONG KiFastSystemCallDisable;
extern UCHAR KiDebugRegisterTrapOffsets[9];
extern UCHAR KiDebugRegisterContextOffsets[9];
extern VOID NTAPI ExpInterlockedPopEntrySListResume(VOID);
extern VOID __cdecl CopyParams(VOID);
extern VOID __cdecl ReadBatch(VOID);
-extern VOID __cdecl FrRestore(VOID);
extern CHAR KiSystemCallExitBranch[];
extern CHAR KiSystemCallExit[];
extern CHAR KiSystemCallExit2[];
}
}
-//
-// Converts a base thread to a GUI thread
-//
-#ifdef __GNUC__
-FORCEINLINE
-NTSTATUS
-KiConvertToGuiThread(VOID)
-{
- NTSTATUS NTAPI PsConvertToGuiThread(VOID);
- NTSTATUS Result;
- PVOID StackFrame;
-
- /*
- * Converting to a GUI thread safely updates ESP in-place as well as the
- * current Thread->TrapFrame and EBP when KeSwitchKernelStack is called.
- *
- * However, PsConvertToGuiThread "helpfully" restores EBP to the original
- * caller's value, since it is considered a nonvolatile register. As such,
- * as soon as we're back after the conversion and we try to store the result
- * which will probably be in some stack variable (EBP-based), we'll crash as
- * we are touching the de-allocated non-expanded stack.
- *
- * Thus we need a way to update our EBP before EBP is touched, and the only
- * way to guarantee this is to do the call itself in assembly, use the EAX
- * register to store the result, fixup EBP, and then let the C code continue
- * on its merry way.
- *
- */
- __asm__ __volatile__
- (
- "movl %%ebp, %1\n\t"
- "subl %%esp, %1\n\t"
- "call _PsConvertToGuiThread@0\n\t"
- "addl %%esp, %1\n\t"
- "movl %1, %%ebp"
- : "=a"(Result), "=r"(StackFrame)
- : "p"(PsConvertToGuiThread)
- : "%esp", "%ecx", "%edx", "memory"
- );
- return Result;
-}
-#elif defined(_MSC_VER)
-NTSTATUS
-NTAPI
-KiConvertToGuiThread(VOID);
-#else
-#error Unknown Compiler
-#endif
-
//
// Switches from boot loader to initial kernel stack
//
+INIT_FUNCTION
FORCEINLINE
VOID
KiSwitchToBootStack(IN ULONG_PTR InitialStack)
{
- VOID NTAPI KiSystemStartupBootStack(VOID);
+ INIT_FUNCTION VOID NTAPI KiSystemStartupBootStack(VOID);
/* We have to switch to a new stack before continuing kernel initialization */
#ifdef __GNUC__