8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / mdb / sun4v / v9 / kmdb / mach_asmutil.h
blob26e4672f73be4df9ec3e3be4cf6e6f6a74aa32ce
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _MACH_ASMUTIL_H
28 #define _MACH_ASMUTIL_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #ifdef _ASM
38 #define GET_NWIN(scr1, reg1) \
39 rdpr %cwp, scr1; /* save current %cwp */ \
40 wrpr %g0, 0x1f, %cwp; \
41 rdpr %cwp, reg1; \
42 wrpr %g0, scr1, %cwp /* restore current %cwp */
44 #define SET_GL(x) \
45 wrpr %g0, x, %gl
47 #define SWITCH_TO_NORMAL_GLOBALS() \
48 /* tempararily save %o5 and %o4 and %o3 */; \
49 stx %o5, [%g5 + KREG_OFF(KREG_O5)]; \
50 stx %o4, [%g5 + KREG_OFF(KREG_O4)]; \
51 stx %o3, [%g5 + KREG_OFF(KREG_O3)]; \
52 /* now save %g5, %g4 and %g7 cause we are going to gl 0 */; \
53 mov %g5, %o5 /* %o5 is gregs pointer now */; \
54 mov %g4, %o4 /* %o4 is %pstate value now */; \
55 mov %g7, %o3 /* %o3 is return pc now */; \
56 SET_GL(0); /* normal globals */
58 #define SWITCH_TO_TL1_GLOBALS_AND_RET() \
59 SET_GL(1) /* use TL1 globals, set %pstate from %o4 */;\
60 mov %o4, %g4 /* restore %g4 as %pstate */; \
61 mov %o5, %g5 /* restore %g5 as gregs pointer */; \
62 mov %o3, %g7 /* retore %g7 as return pc */; \
63 ldx [%g5 + KREG_OFF(KREG_O5)], %o5 /* restore saved %o5 */; \
64 ldx [%g5 + KREG_OFF(KREG_O4)], %o4 /* restore saved %o4 */; \
65 jmp %g7; \
66 ldx [%g5 + KREG_OFF(KREG_O3)], %o3 /* restore saved %o3 */
68 #define KAIF_SAVE_TL1_STATE() \
69 ba kaif_save_tl1_state;\
70 mov PTSTATE_KERN_COMMON, %g4
72 #define KAIF_SAVE_TL1_STATE_SLAVE() KAIF_SAVE_TL1_STATE()
74 #define SET_PSTATE_COMMON_AG(reg1) \
75 or %g0, PTSTATE_KERN_COMMON, reg1;\
76 wrpr reg1, %pstate
78 #define KAIF_DEMAP_TLB_ALL(scr)
80 #endif
82 #ifdef __cplusplus
84 #endif
86 #endif /* _MACH_ASMUTIL_H */