xref: /titanic_51/usr/src/uts/i86pc/ml/kdi_subr.s (revision ae115bc77f6fcde83175c75b4206dc2e50747966)
1*ae115bc7Smrj/*
2*ae115bc7Smrj * CDDL HEADER START
3*ae115bc7Smrj *
4*ae115bc7Smrj * The contents of this file are subject to the terms of the
5*ae115bc7Smrj * Common Development and Distribution License (the "License").
6*ae115bc7Smrj * You may not use this file except in compliance with the License.
7*ae115bc7Smrj *
8*ae115bc7Smrj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ae115bc7Smrj * or http://www.opensolaris.org/os/licensing.
10*ae115bc7Smrj * See the License for the specific language governing permissions
11*ae115bc7Smrj * and limitations under the License.
12*ae115bc7Smrj *
13*ae115bc7Smrj * When distributing Covered Code, include this CDDL HEADER in each
14*ae115bc7Smrj * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ae115bc7Smrj * If applicable, add the following below this CDDL HEADER, with the
16*ae115bc7Smrj * fields enclosed by brackets "[]" replaced with your own identifying
17*ae115bc7Smrj * information: Portions Copyright [yyyy] [name of copyright owner]
18*ae115bc7Smrj *
19*ae115bc7Smrj * CDDL HEADER END
20*ae115bc7Smrj */
21*ae115bc7Smrj
22*ae115bc7Smrj/*
23*ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*ae115bc7Smrj * Use is subject to license terms.
25*ae115bc7Smrj */
26*ae115bc7Smrj
27*ae115bc7Smrj#pragma	ident	"%Z%%M%	%I%	%E% SMI"
28*ae115bc7Smrj
29*ae115bc7Smrj#include <sys/asm_linkage.h>
30*ae115bc7Smrj#include <sys/asm_misc.h>
31*ae115bc7Smrj#include <sys/regset.h>
32*ae115bc7Smrj#include <sys/privregs.h>
33*ae115bc7Smrj#include <sys/psw.h>
34*ae115bc7Smrj
35*ae115bc7Smrj#if defined(__lint)
36*ae115bc7Smrj#include <sys/types.h>
37*ae115bc7Smrj#include <sys/segments.h>
38*ae115bc7Smrj#endif
39*ae115bc7Smrj
40*ae115bc7Smrj#if defined(__lint)
41*ae115bc7Smrj
42*ae115bc7Smrjulong_t
43*ae115bc7Smrjkdi_getdr0(void)
44*ae115bc7Smrj{
45*ae115bc7Smrj	return (0);
46*ae115bc7Smrj}
47*ae115bc7Smrj
48*ae115bc7Smrjulong_t
49*ae115bc7Smrjkdi_getdr1(void)
50*ae115bc7Smrj{
51*ae115bc7Smrj	return (0);
52*ae115bc7Smrj}
53*ae115bc7Smrj
54*ae115bc7Smrjulong_t
55*ae115bc7Smrjkdi_getdr2(void)
56*ae115bc7Smrj{
57*ae115bc7Smrj	return (0);
58*ae115bc7Smrj}
59*ae115bc7Smrj
60*ae115bc7Smrjulong_t
61*ae115bc7Smrjkdi_getdr3(void)
62*ae115bc7Smrj{
63*ae115bc7Smrj	return (0);
64*ae115bc7Smrj}
65*ae115bc7Smrj
66*ae115bc7Smrjulong_t
67*ae115bc7Smrjkdi_getdr6(void)
68*ae115bc7Smrj{
69*ae115bc7Smrj	return (0);
70*ae115bc7Smrj}
71*ae115bc7Smrj
72*ae115bc7Smrjulong_t
73*ae115bc7Smrjkdi_getdr7(void)
74*ae115bc7Smrj{
75*ae115bc7Smrj	return (0);
76*ae115bc7Smrj}
77*ae115bc7Smrj
78*ae115bc7Smrj/*ARGSUSED*/
79*ae115bc7Smrjvoid
80*ae115bc7Smrjkdi_setdr0(ulong_t value)
81*ae115bc7Smrj{}
82*ae115bc7Smrj
83*ae115bc7Smrj/*ARGSUSED*/
84*ae115bc7Smrjvoid
85*ae115bc7Smrjkdi_setdr1(ulong_t value)
86*ae115bc7Smrj{}
87*ae115bc7Smrj
88*ae115bc7Smrj/*ARGSUSED*/
89*ae115bc7Smrjvoid
90*ae115bc7Smrjkdi_setdr2(ulong_t value)
91*ae115bc7Smrj{}
92*ae115bc7Smrj
93*ae115bc7Smrj/*ARGSUSED*/
94*ae115bc7Smrjvoid
95*ae115bc7Smrjkdi_setdr3(ulong_t value)
96*ae115bc7Smrj{}
97*ae115bc7Smrj
98*ae115bc7Smrj/*ARGSUSED*/
99*ae115bc7Smrjvoid
100*ae115bc7Smrjkdi_setdr4(ulong_t value)
101*ae115bc7Smrj{}
102*ae115bc7Smrj
103*ae115bc7Smrj/*ARGSUSED*/
104*ae115bc7Smrjvoid
105*ae115bc7Smrjkdi_setdr6(ulong_t value)
106*ae115bc7Smrj{}
107*ae115bc7Smrj
108*ae115bc7Smrj/*ARGSUSED*/
109*ae115bc7Smrjvoid
110*ae115bc7Smrjkdi_setdr7(ulong_t value)
111*ae115bc7Smrj{}
112*ae115bc7Smrj
113*ae115bc7Smrj#else
114*ae115bc7Smrj
115*ae115bc7Smrj#if defined(__amd64)
116*ae115bc7Smrj
117*ae115bc7Smrj#define	GETDREG(name, r)	\
118*ae115bc7Smrj	ENTRY_NP(name);		\
119*ae115bc7Smrj	movq	r, %rax;	\
120*ae115bc7Smrj	ret;			\
121*ae115bc7Smrj	SET_SIZE(name)
122*ae115bc7Smrj
123*ae115bc7Smrj#define	SETDREG(name, r)	\
124*ae115bc7Smrj	ENTRY_NP(name);		\
125*ae115bc7Smrj	movq	%rdi, r;	\
126*ae115bc7Smrj	ret;			\
127*ae115bc7Smrj	SET_SIZE(name)
128*ae115bc7Smrj
129*ae115bc7Smrj#elif defined(__i386)
130*ae115bc7Smrj
131*ae115bc7Smrj#define	GETDREG(name, r)	\
132*ae115bc7Smrj	ENTRY_NP(name);		\
133*ae115bc7Smrj	movl	r, %eax;	\
134*ae115bc7Smrj	ret;			\
135*ae115bc7Smrj	SET_SIZE(name)
136*ae115bc7Smrj
137*ae115bc7Smrj#define	SETDREG(name, r)	\
138*ae115bc7Smrj	ENTRY_NP(name);		\
139*ae115bc7Smrj	movl	4(%esp), %eax;	\
140*ae115bc7Smrj	movl	%eax, r;	\
141*ae115bc7Smrj	ret;			\
142*ae115bc7Smrj	SET_SIZE(name)
143*ae115bc7Smrj
144*ae115bc7Smrj#endif
145*ae115bc7Smrj
146*ae115bc7Smrj	GETDREG(kdi_getdr0, %dr0)
147*ae115bc7Smrj	GETDREG(kdi_getdr1, %dr1)
148*ae115bc7Smrj	GETDREG(kdi_getdr2, %dr2)
149*ae115bc7Smrj	GETDREG(kdi_getdr3, %dr3)
150*ae115bc7Smrj	GETDREG(kdi_getdr6, %dr6)
151*ae115bc7Smrj	GETDREG(kdi_getdr7, %dr7)
152*ae115bc7Smrj
153*ae115bc7Smrj	SETDREG(kdi_setdr0, %dr0)
154*ae115bc7Smrj	SETDREG(kdi_setdr1, %dr1)
155*ae115bc7Smrj	SETDREG(kdi_setdr2, %dr2)
156*ae115bc7Smrj	SETDREG(kdi_setdr3, %dr3)
157*ae115bc7Smrj	SETDREG(kdi_setdr6, %dr6)
158*ae115bc7Smrj	SETDREG(kdi_setdr7, %dr7)
159*ae115bc7Smrj
160*ae115bc7Smrj#endif	/* __lint */
161