3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <ndk/powerpc/ketypes.h>
24 /* Possible values for KTHREAD's NpxState */
25 #define KPCR_BASE 0xff000000
26 #define NPX_STATE_INVALID 0x01
27 #define NPX_STATE_VALID 0x02
28 #define NPX_STATE_DIRTY 0x04
32 typedef struct _KIRQ_TRAPFRAME
34 } KIRQ_TRAPFRAME
, *PKIRQ_TRAPFRAME
;
36 extern ULONG KePPCCacheAlignment
;
38 //#define KD_BREAKPOINT_TYPE
39 //#define KD_BREAKPOINT_SIZE
40 //#define KD_BREAKPOINT_VALUE
43 // Macro to get the second level cache size field name which differs between
44 // CISC and RISC architectures, as the former has unified I/D cache
46 #define KiGetSecondLevelDCacheSize() ((PKIPCR)KeGetPcr())->SecondLevelDcacheSize
49 // Macros for getting and setting special purpose registers in portable code
51 #define KeGetContextPc(Context) \
54 #define KeSetContextPc(Context, ProgramCounter) \
55 ((Context)->Dr0 = (ProgramCounter))
57 #define KeGetTrapFramePc(TrapFrame) \
60 #define KeGetContextReturnRegister(Context) \
63 #define KeSetContextReturnRegister(Context, ReturnValue) \
64 ((Context)->Gpr3 = (ReturnValue))
67 // Returns the Interrupt State from a Trap Frame.
68 // ON = TRUE, OFF = FALSE
70 //#define KeGetTrapFrameInterruptState(TrapFrame) \
72 #define KePPCRdmsr(msr,val1,val2) __asm__ __volatile__("mfmsr 3")
74 #define KePPCWrmsr(msr,val1,val2) __asm__ __volatile__("mtmsr 3")
76 #define PPC_MIN_CACHE_LINE_SIZE 32
78 FORCEINLINE
struct _KPCR
* NTHALAPI
KeGetCurrentKPCR(
81 return (struct _KPCR
*)__readfsdword(0x1c);
86 KeFlushProcessTb(VOID
)
89 __asm__("sync\n\tisync\n\t");
94 KeGetCurrentThread(VOID
)
96 /* Return the current thread */
97 return KeGetCurrentPrcb()->CurrentThread
;
102 KiRundownThread(IN PKTHREAD Thread
)
107 #ifdef _NTOSKRNL_ /* FIXME: Move flags above to NDK instead of here */
110 KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine
,
111 PKSTART_ROUTINE StartRoutine
,
114 KTRAP_FRAME TrapFrame
);