xref: /titanic_50/usr/src/uts/i86pc/ml/kdi_subr.s (revision b494511a9cf72b1fc4eb13a0e593f55c624ab829)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma	ident	"%Z%%M%	%I%	%E% SMI"
28
29#include <sys/asm_linkage.h>
30#include <sys/asm_misc.h>
31#include <sys/regset.h>
32#include <sys/privregs.h>
33#include <sys/psw.h>
34
35#if defined(__lint)
36#include <sys/types.h>
37#include <sys/segments.h>
38#endif
39
40#if defined(__lint)
41
42ulong_t
43kdi_getdr0(void)
44{
45	return (0);
46}
47
48ulong_t
49kdi_getdr1(void)
50{
51	return (0);
52}
53
54ulong_t
55kdi_getdr2(void)
56{
57	return (0);
58}
59
60ulong_t
61kdi_getdr3(void)
62{
63	return (0);
64}
65
66ulong_t
67kdi_getdr6(void)
68{
69	return (0);
70}
71
72ulong_t
73kdi_getdr7(void)
74{
75	return (0);
76}
77
78/*ARGSUSED*/
79void
80kdi_setdr0(ulong_t value)
81{}
82
83/*ARGSUSED*/
84void
85kdi_setdr1(ulong_t value)
86{}
87
88/*ARGSUSED*/
89void
90kdi_setdr2(ulong_t value)
91{}
92
93/*ARGSUSED*/
94void
95kdi_setdr3(ulong_t value)
96{}
97
98/*ARGSUSED*/
99void
100kdi_setdr4(ulong_t value)
101{}
102
103/*ARGSUSED*/
104void
105kdi_setdr6(ulong_t value)
106{}
107
108/*ARGSUSED*/
109void
110kdi_setdr7(ulong_t value)
111{}
112
113#else
114
115#if defined(__amd64)
116
117#define	GETDREG(name, r)	\
118	ENTRY_NP(name);		\
119	movq	r, %rax;	\
120	ret;			\
121	SET_SIZE(name)
122
123#define	SETDREG(name, r)	\
124	ENTRY_NP(name);		\
125	movq	%rdi, r;	\
126	ret;			\
127	SET_SIZE(name)
128
129#elif defined(__i386)
130
131#define	GETDREG(name, r)	\
132	ENTRY_NP(name);		\
133	movl	r, %eax;	\
134	ret;			\
135	SET_SIZE(name)
136
137#define	SETDREG(name, r)	\
138	ENTRY_NP(name);		\
139	movl	4(%esp), %eax;	\
140	movl	%eax, r;	\
141	ret;			\
142	SET_SIZE(name)
143
144#endif
145
146	GETDREG(kdi_getdr0, %dr0)
147	GETDREG(kdi_getdr1, %dr1)
148	GETDREG(kdi_getdr2, %dr2)
149	GETDREG(kdi_getdr3, %dr3)
150	GETDREG(kdi_getdr6, %dr6)
151	GETDREG(kdi_getdr7, %dr7)
152
153	SETDREG(kdi_setdr0, %dr0)
154	SETDREG(kdi_setdr1, %dr1)
155	SETDREG(kdi_setdr2, %dr2)
156	SETDREG(kdi_setdr3, %dr3)
157	SETDREG(kdi_setdr6, %dr6)
158	SETDREG(kdi_setdr7, %dr7)
159
160#endif	/* __lint */
161