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 IMAGE_FILE_MACHINE_ARCHITECTURE IMAGE_FILE_MACHINE_POWERPC
40 //#define KD_BREAKPOINT_TYPE
41 //#define KD_BREAKPOINT_SIZE
42 //#define KD_BREAKPOINT_VALUE
45 // Macros for getting and setting special purpose registers in portable code
47 #define KeGetContextPc(Context) \
50 #define KeSetContextPc(Context, ProgramCounter) \
51 ((Context)->Dr0 = (ProgramCounter))
53 #define KeGetTrapFramePc(TrapFrame) \
56 #define KeGetContextReturnRegister(Context) \
59 #define KeSetContextReturnRegister(Context, ReturnValue) \
60 ((Context)->Gpr3 = (ReturnValue))
63 // Returns the Interrupt State from a Trap Frame.
64 // ON = TRUE, OFF = FALSE
66 //#define KeGetTrapFrameInterruptState(TrapFrame) \
68 #define KePPCRdmsr(msr,val1,val2) __asm__ __volatile__("mfmsr 3")
70 #define KePPCWrmsr(msr,val1,val2) __asm__ __volatile__("mtmsr 3")
72 #define PPC_MIN_CACHE_LINE_SIZE 32
74 FORCEINLINE
struct _KPCR
* NTHALAPI
KeGetCurrentKPCR(
77 return (struct _KPCR
*)__readfsdword(0x1c);
82 KeFlushProcessTb(VOID
)
85 __asm__("sync\n\tisync\n\t");
90 KeGetCurrentThread(VOID
)
92 /* Return the current thread */
93 return KeGetCurrentPrcb()->CurrentThread
;
98 KiRundownThread(IN PKTHREAD Thread
)
103 #ifdef _NTOSKRNL_ /* FIXME: Move flags above to NDK instead of here */
106 KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine
,
107 PKSTART_ROUTINE StartRoutine
,
110 KTRAP_FRAME TrapFrame
);