4c87473f47e26ce02114dd7d95853dbe272a5f03
[reactos.git] / reactos / ntoskrnl / include / internal / powerpc / ke.h
1 /*
2 * ReactOS kernel
3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4 *
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.
9 *
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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_POWERPC_KE_H
20 #define __NTOSKRNL_INCLUDE_INTERNAL_POWERPC_KE_H
21
22 #include <ndk/powerpc/ketypes.h>
23
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
29
30 #ifndef __ASM__
31
32 typedef struct _KIRQ_TRAPFRAME
33 {
34 } KIRQ_TRAPFRAME, *PKIRQ_TRAPFRAME;
35
36 extern ULONG KePPCCacheAlignment;
37
38 #define IMAGE_FILE_MACHINE_ARCHITECTURE IMAGE_FILE_MACHINE_POWERPC
39
40 //
41 // Macros for getting and setting special purpose registers in portable code
42 //
43 #define KeGetContextPc(Context) \
44 ((Context)->Dr0)
45
46 #define KeSetContextPc(Context, ProgramCounter) \
47 ((Context)->Dr0 = (ProgramCounter))
48
49 #define KeGetTrapFramePc(TrapFrame) \
50 ((TrapFrame)->Dr0)
51
52 #define KeGetContextReturnRegister(Context) \
53 ((Context)->Gpr3)
54
55 #define KeSetContextReturnRegister(Context, ReturnValue) \
56 ((Context)->Gpr3 = (ReturnValue))
57
58 #define KePPCRdmsr(msr,val1,val2) __asm__ __volatile__("mfmsr 3")
59
60 #define KePPCWrmsr(msr,val1,val2) __asm__ __volatile__("mtmsr 3")
61
62 #define PPC_MIN_CACHE_LINE_SIZE 32
63
64 FORCEINLINE struct _KPCR * NTHALAPI KeGetCurrentKPCR(
65 VOID)
66 {
67 return (struct _KPCR *)__readfsdword(0x1c);
68 }
69
70 #ifdef _NTOSKRNL_ /* FIXME: Move flags above to NDK instead of here */
71 VOID
72 NTAPI
73 KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine,
74 PKSTART_ROUTINE StartRoutine,
75 PVOID StartContext,
76 BOOLEAN UserThread,
77 KTRAP_FRAME TrapFrame);
78 #endif
79
80 #endif /* __ASM__ */
81
82 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_POWERPC_KE_H */
83
84 /* EOF */