mirror of
https://github.com/reactos/reactos.git
synced 2024-11-09 08:08:38 +00:00
b819608ed8
svn path=/branches/condrv_restructure/; revision=63104
147 lines
2.9 KiB
C
147 lines
2.9 KiB
C
#pragma once
|
|
|
|
#include "intrin_i.h"
|
|
|
|
#define KiServiceExit2 KiExceptionExit
|
|
|
|
//
|
|
//Lockdown TLB entries
|
|
//
|
|
#define PCR_ENTRY 0
|
|
#define PDR_ENTRY 2
|
|
|
|
//
|
|
// BKPT is 4 bytes long
|
|
//
|
|
#define KD_BREAKPOINT_TYPE ULONG
|
|
#define KD_BREAKPOINT_SIZE sizeof(ULONG)
|
|
//#define KD_BREAKPOINT_VALUE
|
|
|
|
//
|
|
// 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))
|
|
|
|
//
|
|
// 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) \
|
|
CONTAINING_RECORD(Prcb, KIPCR, PrcbData)->ContextSwitches
|
|
|
|
//
|
|
// 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
|
|
|
|
//
|
|
// Returns the Interrupt State from a Trap Frame.
|
|
// ON = TRUE, OFF = FALSE
|
|
//
|
|
//#define KeGetTrapFrameInterruptState(TrapFrame)
|
|
|
|
FORCEINLINE
|
|
BOOLEAN
|
|
KeDisableInterrupts(VOID)
|
|
{
|
|
ARM_STATUS_REGISTER Flags;
|
|
|
|
//
|
|
// Get current interrupt state and disable interrupts
|
|
//
|
|
Flags = KeArmStatusRegisterGet();
|
|
_disable();
|
|
|
|
//
|
|
// Return previous interrupt state
|
|
//
|
|
return Flags.IrqDisable;
|
|
}
|
|
|
|
FORCEINLINE
|
|
VOID
|
|
KeRestoreInterrupts(BOOLEAN WereEnabled)
|
|
{
|
|
if (WereEnabled) _enable();
|
|
}
|
|
|
|
//
|
|
// Invalidates the TLB entry for a specified address
|
|
//
|
|
FORCEINLINE
|
|
VOID
|
|
KeInvalidateTlbEntry(IN PVOID Address)
|
|
{
|
|
/* Invalidate the TLB entry for this address */
|
|
KeArmInvalidateTlbEntry(Address);
|
|
}
|
|
|
|
FORCEINLINE
|
|
VOID
|
|
KeFlushProcessTb(VOID)
|
|
{
|
|
KeArmFlushTlb();
|
|
}
|
|
|
|
FORCEINLINE
|
|
VOID
|
|
KiRundownThread(IN PKTHREAD Thread)
|
|
{
|
|
/* FIXME */
|
|
}
|
|
|
|
VOID
|
|
KiPassiveRelease(
|
|
VOID
|
|
);
|
|
|
|
VOID
|
|
KiSystemService(IN PKTHREAD Thread,
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
IN ULONG Instruction);
|
|
|
|
VOID
|
|
KiApcInterrupt(
|
|
VOID
|
|
);
|
|
|
|
#include "mm.h"
|
|
|
|
VOID
|
|
KeFlushTb(
|
|
VOID
|
|
);
|
|
|
|
#define Ki386PerfEnd()
|
|
#define KiEndInterrupt(x,y)
|
|
|
|
#define KiGetLinkedTrapFrame(x) \
|
|
(PKTRAP_FRAME)((x)->PreviousTrapFrame)
|
|
|
|
#define KiGetPreviousMode(tf) \
|
|
((tf->Spsr & CPSR_MODES) == CPSR_USER_MODE) ? UserMode: KernelMode
|