xref: /titanic_50/usr/src/cmd/mdb/sparc/kmdb/kmdb_asmutil.s (revision 186d582bd9dbcd38e0aeea49036d47d3426a3536)
17c478bd9Sstevel@tonic-gate/*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*186d582bSSurya Prakki * Common Development and Distribution License (the "License").
6*186d582bSSurya Prakki * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
21*186d582bSSurya Prakki
227c478bd9Sstevel@tonic-gate/*
23*186d582bSSurya Prakki * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate/*
287c478bd9Sstevel@tonic-gate * Utility Assembly routines used by the debugger.
297c478bd9Sstevel@tonic-gate */
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate#if defined(__lint)
327c478bd9Sstevel@tonic-gate#include <sys/types.h>
337c478bd9Sstevel@tonic-gate#include <kmdb/kmdb_asmutil.h>
347c478bd9Sstevel@tonic-gate#endif
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate#include <sys/asm_linkage.h>
377c478bd9Sstevel@tonic-gate#include <sys/privregs.h>
387c478bd9Sstevel@tonic-gate#include "mach_asmutil.h"
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate#if defined(__lint)
417c478bd9Sstevel@tonic-gateint
427c478bd9Sstevel@tonic-gateget_nwin(void)
437c478bd9Sstevel@tonic-gate{
447c478bd9Sstevel@tonic-gate	return (0);	/* wouldn't that be amusing */
457c478bd9Sstevel@tonic-gate}
467c478bd9Sstevel@tonic-gate#else
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gate	ENTRY(get_nwin)
497c478bd9Sstevel@tonic-gate	GET_NWIN(%g4, %g3);	/* %g4 is scratch, %g3 set to nwin-1 */
507c478bd9Sstevel@tonic-gate	mov	%g3, %o0
517c478bd9Sstevel@tonic-gate	retl
527c478bd9Sstevel@tonic-gate	add	%o0, 1, %o0
537c478bd9Sstevel@tonic-gate	SET_SIZE(get_nwin)
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate#endif
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate#if defined(__lint)
587c478bd9Sstevel@tonic-gateuintptr_t
597c478bd9Sstevel@tonic-gateget_fp(void)
607c478bd9Sstevel@tonic-gate{
617c478bd9Sstevel@tonic-gate	return (0);
627c478bd9Sstevel@tonic-gate}
637c478bd9Sstevel@tonic-gate#else
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate	ENTRY(get_fp)
667c478bd9Sstevel@tonic-gate	retl
677c478bd9Sstevel@tonic-gate	mov	%fp, %o0
687c478bd9Sstevel@tonic-gate	SET_SIZE(get_fp)
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gate#endif
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gate#if defined(__lint)
737c478bd9Sstevel@tonic-gatevoid
747c478bd9Sstevel@tonic-gateinterrupts_on(void)
757c478bd9Sstevel@tonic-gate{
767c478bd9Sstevel@tonic-gate}
777c478bd9Sstevel@tonic-gate#else
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gate	ENTRY(interrupts_on)
807c478bd9Sstevel@tonic-gate	rdpr	%pstate, %o0
817c478bd9Sstevel@tonic-gate	bset	PSTATE_IE, %o0
827c478bd9Sstevel@tonic-gate	retl
837c478bd9Sstevel@tonic-gate	wrpr	%o0, %pstate
847c478bd9Sstevel@tonic-gate	SET_SIZE(interrupts_on)
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate#endif
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate#if defined(__lint)
897c478bd9Sstevel@tonic-gatevoid
907c478bd9Sstevel@tonic-gateinterrupts_off(void)
917c478bd9Sstevel@tonic-gate{
927c478bd9Sstevel@tonic-gate}
937c478bd9Sstevel@tonic-gate#else
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gate	ENTRY(interrupts_off)
967c478bd9Sstevel@tonic-gate	rdpr	%pstate, %o0
977c478bd9Sstevel@tonic-gate	bclr	PSTATE_IE, %o0
987c478bd9Sstevel@tonic-gate	retl
997c478bd9Sstevel@tonic-gate	wrpr	%o0, %pstate
1007c478bd9Sstevel@tonic-gate	SET_SIZE(interrupts_off)
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gate#endif
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gate#if defined(__lint)
1057c478bd9Sstevel@tonic-gatecaddr_t
1067c478bd9Sstevel@tonic-gateget_tba(void)
1077c478bd9Sstevel@tonic-gate{
1087c478bd9Sstevel@tonic-gate	return (0);
1097c478bd9Sstevel@tonic-gate}
1107c478bd9Sstevel@tonic-gate#else
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gate	ENTRY(get_tba)
1137c478bd9Sstevel@tonic-gate	retl
1147c478bd9Sstevel@tonic-gate	rdpr	%tba, %o0
1157c478bd9Sstevel@tonic-gate	SET_SIZE(get_tba)
1167c478bd9Sstevel@tonic-gate
1177c478bd9Sstevel@tonic-gate#endif
1187c478bd9Sstevel@tonic-gate
1197c478bd9Sstevel@tonic-gate#if defined(__lint)
1207c478bd9Sstevel@tonic-gate/*ARGSUSED*/
121*186d582bSSurya Prakkivoid *
122*186d582bSSurya Prakkiset_tba(void *new)
1237c478bd9Sstevel@tonic-gate{
124*186d582bSSurya Prakki	return (0);
1257c478bd9Sstevel@tonic-gate}
1267c478bd9Sstevel@tonic-gate#else
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gate	ENTRY(set_tba)
1297c478bd9Sstevel@tonic-gate	retl
1307c478bd9Sstevel@tonic-gate	wrpr	%o0, %tba
1317c478bd9Sstevel@tonic-gate	SET_SIZE(set_tba)
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gate#endif
134