mirror of
https://github.com/reactos/reactos.git
synced 2024-10-30 19:41:57 +00:00
182 lines
3.3 KiB
C
182 lines
3.3 KiB
C
#pragma once
|
|
|
|
#include "intrin_i.h"
|
|
|
|
#define KiServiceExit2 KiExceptionExit
|
|
|
|
#define SYNCH_LEVEL DISPATCH_LEVEL
|
|
#define PCR ((KPCR * const)KIP0PCRADDRESS)
|
|
|
|
//
|
|
//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 0xDEFE
|
|
|
|
//
|
|
// Maximum IRQs
|
|
//
|
|
#define MAXIMUM_VECTOR 16
|
|
|
|
//
|
|
// 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) \
|
|
(Prcb)->KeContextSwitches
|
|
|
|
//
|
|
// 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) 0
|
|
|
|
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
|
|
KeSweepICache(IN PVOID BaseAddress,
|
|
IN SIZE_T FlushSize)
|
|
{
|
|
//
|
|
// Always sweep the whole cache
|
|
//
|
|
UNREFERENCED_PARAMETER(BaseAddress);
|
|
UNREFERENCED_PARAMETER(FlushSize);
|
|
_MoveToCoprocessor(0, CP15_ICIALLU);
|
|
}
|
|
|
|
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
|
|
);
|
|
|
|
//
|
|
// Cache clean and flush
|
|
//
|
|
VOID
|
|
HalSweepDcache(
|
|
VOID
|
|
);
|
|
|
|
VOID
|
|
HalSweepIcache(
|
|
VOID
|
|
);
|
|
|
|
#define Ki386PerfEnd()
|
|
#define KiEndInterrupt(x,y)
|
|
|
|
#define KiGetLinkedTrapFrame(x) \
|
|
(PKTRAP_FRAME)((x)->TrapFrame)
|
|
|
|
#define KiGetPreviousMode(tf) \
|
|
((tf->Cpsr & CPSRM_MASK) == CPSRM_USER) ? UserMode: KernelMode
|