2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2008-02-07 06:40:42 +00:00
|
|
|
|
2009-12-16 20:59:06 +00:00
|
|
|
#include "intrin_i.h"
|
|
|
|
|
2010-02-01 03:51:45 +00:00
|
|
|
#define KiServiceExit2 KiExceptionExit
|
|
|
|
|
2008-02-12 16:32:13 +00:00
|
|
|
//
|
|
|
|
//Lockdown TLB entries
|
|
|
|
//
|
2008-02-12 18:34:33 +00:00
|
|
|
#define PCR_ENTRY 0
|
|
|
|
#define PDR_ENTRY 2
|
2008-02-12 16:32:13 +00:00
|
|
|
|
2009-10-04 16:53:15 +00:00
|
|
|
//
|
|
|
|
// BKPT is 4 bytes long
|
|
|
|
//
|
2009-10-10 19:27:54 +00:00
|
|
|
#define KD_BREAKPOINT_TYPE ULONG
|
|
|
|
#define KD_BREAKPOINT_SIZE sizeof(ULONG)
|
|
|
|
//#define KD_BREAKPOINT_VALUE
|
2009-10-04 16:53:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Macros for getting and setting special purpose registers in portable code
|
|
|
|
//
|
|
|
|
#define KeGetContextPc(Context) \
|
|
|
|
((Context)->Pc)
|
|
|
|
|
|
|
|
#define KeSetContextPc(Context, ProgramCounter) \
|
|
|
|
((Context)->Pc = (ProgramCounter))
|
|
|
|
|
|
|
|
#define KeGetTrapFramePc(TrapFrame) \
|
|
|
|
((TrapFrame)->Pc)
|
|
|
|
|
|
|
|
#define KeGetContextReturnRegister(Context) \
|
|
|
|
((Context)->R0)
|
|
|
|
|
|
|
|
#define KeSetContextReturnRegister(Context, ReturnValue) \
|
|
|
|
((Context)->R0 = (ReturnValue))
|
|
|
|
|
2009-12-17 20:58:58 +00:00
|
|
|
//
|
|
|
|
// Macro to get trap and exception frame from a thread stack
|
|
|
|
//
|
|
|
|
#define KeGetTrapFrame(Thread) \
|
|
|
|
(PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \
|
|
|
|
sizeof(KTRAP_FRAME))
|
|
|
|
|
|
|
|
#define KeGetExceptionFrame(Thread) \
|
|
|
|
(PKEXCEPTION_FRAME)((ULONG_PTR)KeGetTrapFrame(Thread) - \
|
|
|
|
sizeof(KEXCEPTION_FRAME))
|
|
|
|
|
|
|
|
//
|
|
|
|
// Macro to get context switches from the PRCB
|
|
|
|
// All architectures but x86 have it in the PRCB's KeContextSwitches
|
|
|
|
//
|
|
|
|
#define KeGetContextSwitches(Prcb) \
|
2010-02-09 02:12:27 +00:00
|
|
|
CONTAINING_RECORD(Prcb, KIPCR, PrcbData)->ContextSwitches
|
2009-12-17 20:58:58 +00:00
|
|
|
|
2010-05-17 21:26:51 +00:00
|
|
|
//
|
|
|
|
// Macro to get the second level cache size field name which differs between
|
|
|
|
// CISC and RISC architectures, as the former has unified I/D cache
|
|
|
|
//
|
|
|
|
#define KiGetSecondLevelDCacheSize() ((PKIPCR)KeGetPcr())->SecondLevelDcacheSize
|
|
|
|
|
2009-10-10 19:27:54 +00:00
|
|
|
//
|
|
|
|
// Returns the Interrupt State from a Trap Frame.
|
|
|
|
// ON = TRUE, OFF = FALSE
|
|
|
|
//
|
2009-12-16 20:59:06 +00:00
|
|
|
//#define KeGetTrapFrameInterruptState(TrapFrame)
|
2009-10-10 19:27:54 +00:00
|
|
|
|
2009-11-04 22:40:18 +00:00
|
|
|
//
|
|
|
|
// Invalidates the TLB entry for a specified address
|
|
|
|
//
|
|
|
|
FORCEINLINE
|
|
|
|
VOID
|
|
|
|
KeInvalidateTlbEntry(IN PVOID Address)
|
|
|
|
{
|
|
|
|
/* Invalidate the TLB entry for this address */
|
|
|
|
KeArmInvalidateTlbEntry(Address);
|
|
|
|
}
|
|
|
|
|
2009-12-20 13:30:35 +00:00
|
|
|
FORCEINLINE
|
|
|
|
VOID
|
|
|
|
KeFlushProcessTb(VOID)
|
|
|
|
{
|
2010-02-09 18:06:26 +00:00
|
|
|
KeArmFlushTlb();
|
2009-12-20 13:30:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FORCEINLINE
|
|
|
|
VOID
|
|
|
|
KiRundownThread(IN PKTHREAD Thread)
|
|
|
|
{
|
|
|
|
/* FIXME */
|
|
|
|
}
|
2009-10-10 19:27:54 +00:00
|
|
|
|
2008-02-12 22:50:54 +00:00
|
|
|
VOID
|
|
|
|
KiPassiveRelease(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-02-01 03:51:45 +00:00
|
|
|
VOID
|
|
|
|
KiSystemService(IN PKTHREAD Thread,
|
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN ULONG Instruction);
|
|
|
|
|
2008-02-12 22:50:54 +00:00
|
|
|
VOID
|
|
|
|
KiApcInterrupt(
|
2010-12-22 16:14:58 +00:00
|
|
|
VOID
|
2008-02-12 22:50:54 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
#include "mm.h"
|
|
|
|
|
|
|
|
VOID
|
|
|
|
KeFlushTb(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-02-01 03:51:45 +00:00
|
|
|
#define Ki386PerfEnd()
|
|
|
|
#define KiEndInterrupt(x,y)
|
|
|
|
|
|
|
|
#define KiGetLinkedTrapFrame(x) \
|
|
|
|
(PKTRAP_FRAME)((x)->PreviousTrapFrame)
|
2008-02-07 20:04:31 +00:00
|
|
|
|
2008-07-19 06:13:10 +00:00
|
|
|
#define KiGetPreviousMode(tf) \
|
|
|
|
((tf->Spsr & CPSR_MODES) == CPSR_USER_MODE) ? UserMode: KernelMode
|