1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27/*
28 * Utility Assembly routines used by the debugger.
29 */
30
31#if defined(__lint)
32#include <sys/types.h>
33#include <kmdb/kmdb_asmutil.h>
34#endif
35
36#include <sys/asm_linkage.h>
37#include <sys/privregs.h>
38#include "mach_asmutil.h"
39
40#if defined(__lint)
41int
42get_nwin(void)
43{
44	return (0);	/* wouldn't that be amusing */
45}
46#else
47
48	ENTRY(get_nwin)
49	GET_NWIN(%g4, %g3);	/* %g4 is scratch, %g3 set to nwin-1 */
50	mov	%g3, %o0
51	retl
52	add	%o0, 1, %o0
53	SET_SIZE(get_nwin)
54
55#endif
56
57#if defined(__lint)
58uintptr_t
59get_fp(void)
60{
61	return (0);
62}
63#else
64
65	ENTRY(get_fp)
66	retl
67	mov	%fp, %o0
68	SET_SIZE(get_fp)
69
70#endif
71
72#if defined(__lint)
73void
74interrupts_on(void)
75{
76}
77#else
78
79	ENTRY(interrupts_on)
80	rdpr	%pstate, %o0
81	bset	PSTATE_IE, %o0
82	retl
83	wrpr	%o0, %pstate
84	SET_SIZE(interrupts_on)
85
86#endif
87
88#if defined(__lint)
89void
90interrupts_off(void)
91{
92}
93#else
94
95	ENTRY(interrupts_off)
96	rdpr	%pstate, %o0
97	bclr	PSTATE_IE, %o0
98	retl
99	wrpr	%o0, %pstate
100	SET_SIZE(interrupts_off)
101
102#endif
103
104#if defined(__lint)
105caddr_t
106get_tba(void)
107{
108	return (0);
109}
110#else
111
112	ENTRY(get_tba)
113	retl
114	rdpr	%tba, %o0
115	SET_SIZE(get_tba)
116
117#endif
118
119#if defined(__lint)
120/*ARGSUSED*/
121void *
122set_tba(void *new)
123{
124	return (0);
125}
126#else
127
128	ENTRY(set_tba)
129	retl
130	wrpr	%o0, %tba
131	SET_SIZE(set_tba)
132
133#endif
134