xref: /titanic_52/usr/src/uts/sun4v/ml/mach_subr_asm.s (revision bd28a477274db2b836577dfd6f223c696ad00720)
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
51ae08745Sheppo * Common Development and Distribution License (the "License").
61ae08745Sheppo * 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 */
217c478bd9Sstevel@tonic-gate/*
22*bd28a477SPrashanth Sreenivasa * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate */
247c478bd9Sstevel@tonic-gate
257c478bd9Sstevel@tonic-gate/*
267c478bd9Sstevel@tonic-gate * General machine architecture & implementation specific
277c478bd9Sstevel@tonic-gate * assembly language routines.
287c478bd9Sstevel@tonic-gate */
297c478bd9Sstevel@tonic-gate#if defined(lint)
307c478bd9Sstevel@tonic-gate#include <sys/types.h>
317c478bd9Sstevel@tonic-gate#include <sys/t_lock.h>
327c478bd9Sstevel@tonic-gate#else	/* lint */
337c478bd9Sstevel@tonic-gate#include "assym.h"
347c478bd9Sstevel@tonic-gate#endif	/* lint */
357c478bd9Sstevel@tonic-gate
36*bd28a477SPrashanth Sreenivasa#define CPU_MODULE /* need it for NSEC_SHIFT used by NATIVE_TIME_TO_NSEC() */
37*bd28a477SPrashanth Sreenivasa
387c478bd9Sstevel@tonic-gate#include <sys/asm_linkage.h>
397c478bd9Sstevel@tonic-gate#include <sys/machsystm.h>
407c478bd9Sstevel@tonic-gate#include <sys/machthread.h>
41023e71deSHaik Aftandilian#include <sys/machclock.h>
427c478bd9Sstevel@tonic-gate#include <sys/privregs.h>
437c478bd9Sstevel@tonic-gate#include <sys/cmpregs.h>
447c478bd9Sstevel@tonic-gate#include <sys/clock.h>
457c478bd9Sstevel@tonic-gate#include <sys/fpras.h>
463b890a5bSjb145095#include <sys/soft_state.h>
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gate#if defined(lint)
49023e71deSHaik Aftandilian
50023e71deSHaik Aftandilianuint64_t
51023e71deSHaik Aftandilianultra_gettick(void)
52023e71deSHaik Aftandilian{ return (0); }
53023e71deSHaik Aftandilian
54023e71deSHaik Aftandilian#else	/* lint */
55023e71deSHaik Aftandilian
56023e71deSHaik Aftandilian/*
57023e71deSHaik Aftandilian * This isn't the routine you're looking for.
58023e71deSHaik Aftandilian *
59023e71deSHaik Aftandilian * The routine simply returns the value of %tick on the *current* processor.
60023e71deSHaik Aftandilian * Most of the time, gettick() [which in turn maps to %stick on platforms
61023e71deSHaik Aftandilian * that have different CPU %tick rates] is what you want.
62023e71deSHaik Aftandilian */
63023e71deSHaik Aftandilian
64023e71deSHaik Aftandilian	ENTRY(ultra_gettick)
65023e71deSHaik Aftandilian	RD_TICK(%o0,%o1,%o2,__LINE__)
66023e71deSHaik Aftandilian	retl
67023e71deSHaik Aftandilian	nop
68023e71deSHaik Aftandilian	SET_SIZE(ultra_gettick)
69023e71deSHaik Aftandilian
70023e71deSHaik Aftandilian#endif	/* lint */
71023e71deSHaik Aftandilian
72023e71deSHaik Aftandilian#if defined(lint)
737c478bd9Sstevel@tonic-gate/* ARGSUSED */
747c478bd9Sstevel@tonic-gatevoid
757c478bd9Sstevel@tonic-gateset_mmfsa_scratchpad(caddr_t vaddr)
767c478bd9Sstevel@tonic-gate{ }
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gate#else	/* lint */
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate	ENTRY(set_mmfsa_scratchpad)
817c478bd9Sstevel@tonic-gate	stxa	%o0, [%g0]ASI_SCRATCHPAD
827c478bd9Sstevel@tonic-gate	retl
837c478bd9Sstevel@tonic-gate	nop
847c478bd9Sstevel@tonic-gate	SET_SIZE(set_mmfsa_scratchpad)
857c478bd9Sstevel@tonic-gate#endif	/* lint */
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gate#if defined(lint)
887c478bd9Sstevel@tonic-gatecaddr_t
897c478bd9Sstevel@tonic-gateget_mmfsa_scratchpad()
907c478bd9Sstevel@tonic-gate{  return (0); }
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gate#else	/* lint */
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate	ENTRY(get_mmfsa_scratchpad)
957c478bd9Sstevel@tonic-gate	ldxa	[%g0]ASI_SCRATCHPAD, %o0
967c478bd9Sstevel@tonic-gate	retl
977c478bd9Sstevel@tonic-gate	nop
987c478bd9Sstevel@tonic-gate	SET_SIZE(get_mmfsa_scratchpad)
997c478bd9Sstevel@tonic-gate#endif	/* lint */
1007c478bd9Sstevel@tonic-gate
1011ae08745Sheppo
1021ae08745Sheppo
1031ae08745Sheppo#if defined(lint)
1041ae08745Sheppo/* ARGSUSED */
1051ae08745Sheppovoid
1061ae08745Sheppocpu_intrq_unregister_powerdown(uint64_t doneflag_va)
1071ae08745Sheppo{}
1081ae08745Sheppo
1091ae08745Sheppo#else	/* lint */
1101ae08745Sheppo
1111ae08745Sheppo/*
1121ae08745Sheppo * Called from a x-trap at tl1 must use %g1 as arg
1131ae08745Sheppo * and save/restore %o0-%o5 after hypervisor calls
1141ae08745Sheppo */
1151ae08745Sheppo
1161ae08745Sheppo	ENTRY(cpu_intrq_unregister_powerdown)
1171ae08745Sheppo
1181ae08745Sheppo	CPU_ADDR(%g2, %g3)
1191ae08745Sheppo	add %g2, CPU_MCPU, %g2
1201ae08745Sheppo	/*
1211ae08745Sheppo	 * Save %o regs
1221ae08745Sheppo	 */
1231ae08745Sheppo	mov %o0, %g3
1241ae08745Sheppo	mov %o1, %g4
1251ae08745Sheppo	mov %o2, %g5
1261ae08745Sheppo	mov %o5, %g6
1271ae08745Sheppo
1281ae08745Sheppo	ldx [%g2 + MCPU_CPU_Q_BASE], %o1
1291ae08745Sheppo	mov INTR_CPU_Q, %o0
1301ae08745Sheppo	call hv_cpu_qconf
1311ae08745Sheppo	mov %g0, %o2
1321ae08745Sheppo
1331ae08745Sheppo	ldx [%g2 + MCPU_DEV_Q_BASE], %o1
1341ae08745Sheppo	mov INTR_DEV_Q, %o0
1351ae08745Sheppo	call hv_cpu_qconf
1361ae08745Sheppo	mov %g0, %o2
1371ae08745Sheppo
1381ae08745Sheppo	ldx [%g2 + MCPU_RQ_BASE], %o1
1391ae08745Sheppo	mov CPU_RQ, %o0
1401ae08745Sheppo	call hv_cpu_qconf
1411ae08745Sheppo	mov %g0, %o2
1421ae08745Sheppo
1431ae08745Sheppo	ldx [%g2 + MCPU_NRQ_BASE], %o1
1441ae08745Sheppo	mov CPU_NRQ, %o0
1451ae08745Sheppo	call hv_cpu_qconf
1461ae08745Sheppo	mov %g0, %o2
1471ae08745Sheppo
1481ae08745Sheppo	/*
1491ae08745Sheppo	 * set done flag to 0
1501ae08745Sheppo	 */
1511ae08745Sheppo	stub %g0, [%g1]
1521ae08745Sheppo
1531ae08745Sheppo	/*
1541ae08745Sheppo	 * Restore %o regs
1551ae08745Sheppo	 */
1561ae08745Sheppo	mov %g3, %o0
1571ae08745Sheppo	mov %g4, %o1
1581ae08745Sheppo	mov %g5, %o2
1591ae08745Sheppo	mov %g6, %o5
1601ae08745Sheppo
1611ae08745Sheppo	/*
1621ae08745Sheppo	 * This CPU is on its way out. Spin here
1631ae08745Sheppo	 * until the DR unconfigure code stops it.
1641ae08745Sheppo	 * Returning would put it back in the OS
1651ae08745Sheppo	 * where it might grab resources like locks,
1661ae08745Sheppo	 * causing some nastiness to occur.
1671ae08745Sheppo	 */
1681ae08745Sheppo0:
1691ae08745Sheppo	ba,a	0b
1701ae08745Sheppo
1711ae08745Sheppo	SET_SIZE(cpu_intrq_unregister_powerdown)
1721ae08745Sheppo#endif	/* lint */
1731ae08745Sheppo
1741ae08745Sheppo
1757c478bd9Sstevel@tonic-gate#if defined(lint)
1767c478bd9Sstevel@tonic-gate/* ARGSUSED */
1777c478bd9Sstevel@tonic-gateint
1787c478bd9Sstevel@tonic-gategetprocessorid(void)
1797c478bd9Sstevel@tonic-gate{ return (0); }
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate#else	/* lint */
1827c478bd9Sstevel@tonic-gate
1837c478bd9Sstevel@tonic-gate/*
1847c478bd9Sstevel@tonic-gate * Get the processor ID.
1857c478bd9Sstevel@tonic-gate * === MID reg as specified in 15dec89 sun4u spec, sec 5.4.3
1867c478bd9Sstevel@tonic-gate */
1877c478bd9Sstevel@tonic-gate
1887c478bd9Sstevel@tonic-gate	ENTRY(getprocessorid)
1897c478bd9Sstevel@tonic-gate	CPU_INDEX(%o0, %o1)
1907c478bd9Sstevel@tonic-gate	retl
1917c478bd9Sstevel@tonic-gate	nop
1927c478bd9Sstevel@tonic-gate	SET_SIZE(getprocessorid)
1937c478bd9Sstevel@tonic-gate
1947c478bd9Sstevel@tonic-gate#endif	/* lint */
1957c478bd9Sstevel@tonic-gate
1967c478bd9Sstevel@tonic-gate#if defined(lint) || defined(__lint)
1977c478bd9Sstevel@tonic-gate
1987c478bd9Sstevel@tonic-gate/* ARGSUSED */
1997c478bd9Sstevel@tonic-gatehrtime_t
2007c478bd9Sstevel@tonic-gatetick2ns(hrtime_t tick, uint_t cpuid)
2017c478bd9Sstevel@tonic-gate{ return 0; }
2027c478bd9Sstevel@tonic-gate
2037c478bd9Sstevel@tonic-gate#else	/* lint */
2047c478bd9Sstevel@tonic-gate
2057c478bd9Sstevel@tonic-gate	ENTRY_NP(tick2ns)
2067c478bd9Sstevel@tonic-gate	!
207*bd28a477SPrashanth Sreenivasa	! Use nsec_scale for sun4v which is based on %stick
2087c478bd9Sstevel@tonic-gate	!
209*bd28a477SPrashanth Sreenivasa	NATIVE_TIME_TO_NSEC(%o0, %o2, %o3)
2107c478bd9Sstevel@tonic-gate	retl
2117c478bd9Sstevel@tonic-gate	nop
2127c478bd9Sstevel@tonic-gate	SET_SIZE(tick2ns)
2137c478bd9Sstevel@tonic-gate
2147c478bd9Sstevel@tonic-gate#endif  /* lint */
2157c478bd9Sstevel@tonic-gate
2167c478bd9Sstevel@tonic-gate#if defined(lint)
2177c478bd9Sstevel@tonic-gate
2187c478bd9Sstevel@tonic-gate/* ARGSUSED */
2197c478bd9Sstevel@tonic-gatevoid
2207c478bd9Sstevel@tonic-gateset_cmp_error_steering(void)
2217c478bd9Sstevel@tonic-gate{}
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gate#else	/* lint */
2247c478bd9Sstevel@tonic-gate
2257c478bd9Sstevel@tonic-gate	ENTRY(set_cmp_error_steering)
2267c478bd9Sstevel@tonic-gate	retl
2277c478bd9Sstevel@tonic-gate	nop
2287c478bd9Sstevel@tonic-gate	SET_SIZE(set_cmp_error_steering)
2297c478bd9Sstevel@tonic-gate
2307c478bd9Sstevel@tonic-gate#endif	/* lint */
2317c478bd9Sstevel@tonic-gate
2327c478bd9Sstevel@tonic-gate#if defined(lint)
2337c478bd9Sstevel@tonic-gate
2347c478bd9Sstevel@tonic-gate/* ARGSUSED */
2357c478bd9Sstevel@tonic-gateuint64_t
2367c478bd9Sstevel@tonic-gateultra_getver(void)
2377c478bd9Sstevel@tonic-gate{
2387c478bd9Sstevel@tonic-gate	return (0);
2397c478bd9Sstevel@tonic-gate}
2407c478bd9Sstevel@tonic-gate
2417c478bd9Sstevel@tonic-gate#else /* lint */
2427c478bd9Sstevel@tonic-gate
2437c478bd9Sstevel@tonic-gate	ENTRY(ultra_getver)
2447c478bd9Sstevel@tonic-gate	retl
2457c478bd9Sstevel@tonic-gate	mov	-1, %o0		! XXXQ no version available
2467c478bd9Sstevel@tonic-gate	SET_SIZE(ultra_getver)
2477c478bd9Sstevel@tonic-gate
2487c478bd9Sstevel@tonic-gate#endif /* lint */
2497c478bd9Sstevel@tonic-gate
2507c478bd9Sstevel@tonic-gate#if defined(lint)
2517c478bd9Sstevel@tonic-gate
2527c478bd9Sstevel@tonic-gateint
2537c478bd9Sstevel@tonic-gatefpras_chkfn_type1(void)
2547c478bd9Sstevel@tonic-gate{ return 0; }
2557c478bd9Sstevel@tonic-gate
2567c478bd9Sstevel@tonic-gate#else	/* lint */
2577c478bd9Sstevel@tonic-gate
2587c478bd9Sstevel@tonic-gate	/*
2597c478bd9Sstevel@tonic-gate	 * Check instructions using just the AX pipelines, designed by
2607c478bd9Sstevel@tonic-gate	 * C.B. Liaw of PNP.
2617c478bd9Sstevel@tonic-gate	 *
2627c478bd9Sstevel@tonic-gate	 * This function must match a struct fpras_chkfn and must be
2637c478bd9Sstevel@tonic-gate	 * block aligned.  A zero return means all was well.  These
2647c478bd9Sstevel@tonic-gate	 * instructions are chosen to be sensitive to bit corruptions
2657c478bd9Sstevel@tonic-gate	 * on the fpras rewrite, so if a bit corruption still produces
2667c478bd9Sstevel@tonic-gate	 * a valid instruction we should still get an incorrect result
2677c478bd9Sstevel@tonic-gate	 * here.  This function is never called directly - it is copied
2687c478bd9Sstevel@tonic-gate	 * into per-cpu and per-operation buffers;  it must therefore
2697c478bd9Sstevel@tonic-gate	 * be absolutely position independent.  If an illegal instruction
2707c478bd9Sstevel@tonic-gate	 * is encountered then the trap handler trampolines to the final
2717c478bd9Sstevel@tonic-gate	 * three instructions of this function.
2727c478bd9Sstevel@tonic-gate	 *
2737c478bd9Sstevel@tonic-gate	 * We want two instructions that are complements of one another,
2747c478bd9Sstevel@tonic-gate	 * and which can perform a calculation with a known result.
2757c478bd9Sstevel@tonic-gate	 *
2767c478bd9Sstevel@tonic-gate	 * SETHI:
2777c478bd9Sstevel@tonic-gate	 *
2787c478bd9Sstevel@tonic-gate	 * | 0 0 |  rd   | 1 0 0 |	imm22				|
2797c478bd9Sstevel@tonic-gate	 *  31 30 29   25 24   22 21				       0
2807c478bd9Sstevel@tonic-gate	 *
2817c478bd9Sstevel@tonic-gate	 * ADDCCC with two source registers:
2827c478bd9Sstevel@tonic-gate	 *
2837c478bd9Sstevel@tonic-gate	 * | 1 0 |  rd   | 0 1 1   0 0 0 |  rs1  | 0 |	   -	|  rs2  |
2847c478bd9Sstevel@tonic-gate	 *  31 30 29   25 24           19 18   14 13  12       5 4     0
2857c478bd9Sstevel@tonic-gate	 *
2867c478bd9Sstevel@tonic-gate	 * We can choose rd and imm2 of the SETHI and rd, rs1 and rs2 of
2877c478bd9Sstevel@tonic-gate	 * the ADDCCC to obtain instructions that are complements in all but
2887c478bd9Sstevel@tonic-gate	 * bit 30.
2897c478bd9Sstevel@tonic-gate	 *
2907c478bd9Sstevel@tonic-gate	 * Registers are numbered as follows:
2917c478bd9Sstevel@tonic-gate	 *
2927c478bd9Sstevel@tonic-gate	 * r[31]	%i7
2937c478bd9Sstevel@tonic-gate	 * r[30]	%i6
2947c478bd9Sstevel@tonic-gate	 * r[29]	%i5
2957c478bd9Sstevel@tonic-gate	 * r[28]	%i4
2967c478bd9Sstevel@tonic-gate	 * r[27]	%i3
2977c478bd9Sstevel@tonic-gate	 * r[26]	%i2
2987c478bd9Sstevel@tonic-gate	 * r[25]	%i1
2997c478bd9Sstevel@tonic-gate	 * r[24]	%i0
3007c478bd9Sstevel@tonic-gate	 * r[23]	%l7
3017c478bd9Sstevel@tonic-gate	 * r[22]	%l6
3027c478bd9Sstevel@tonic-gate	 * r[21]	%l5
3037c478bd9Sstevel@tonic-gate	 * r[20]	%l4
3047c478bd9Sstevel@tonic-gate	 * r[19]	%l3
3057c478bd9Sstevel@tonic-gate	 * r[18]	%l2
3067c478bd9Sstevel@tonic-gate	 * r[17]	%l1
3077c478bd9Sstevel@tonic-gate	 * r[16]	%l0
3087c478bd9Sstevel@tonic-gate	 * r[15]	%o7
3097c478bd9Sstevel@tonic-gate	 * r[14]	%o6
3107c478bd9Sstevel@tonic-gate	 * r[13]	%o5
3117c478bd9Sstevel@tonic-gate	 * r[12]	%o4
3127c478bd9Sstevel@tonic-gate	 * r[11]	%o3
3137c478bd9Sstevel@tonic-gate	 * r[10]	%o2
3147c478bd9Sstevel@tonic-gate	 * r[9]		%o1
3157c478bd9Sstevel@tonic-gate	 * r[8]		%o0
3167c478bd9Sstevel@tonic-gate	 * r[7]		%g7
3177c478bd9Sstevel@tonic-gate	 * r[6]		%g6
3187c478bd9Sstevel@tonic-gate	 * r[5]		%g5
3197c478bd9Sstevel@tonic-gate	 * r[4]		%g4
3207c478bd9Sstevel@tonic-gate	 * r[3]		%g3
3217c478bd9Sstevel@tonic-gate	 * r[2]		%g2
3227c478bd9Sstevel@tonic-gate	 * r[1]		%g1
3237c478bd9Sstevel@tonic-gate	 * r[0]		%g0
3247c478bd9Sstevel@tonic-gate	 *
3257c478bd9Sstevel@tonic-gate	 * For register r[n], register r[31-n] is the complement.  We must
3267c478bd9Sstevel@tonic-gate	 * avoid use of %i6/%i7 and %o6/%o7 as well as %g7.  Clearly we need
3277c478bd9Sstevel@tonic-gate	 * to use a local or input register as one half of the pair, which
3287c478bd9Sstevel@tonic-gate	 * requires us to obtain our own register window or take steps
3297c478bd9Sstevel@tonic-gate	 * to preserve any local or input we choose to use.  We choose
3307c478bd9Sstevel@tonic-gate	 * %o1 as rd for the SETHI, so rd of the ADDCCC must be %l6.
3317c478bd9Sstevel@tonic-gate	 * We'll use %o1 as rs1 and %l6 as rs2 of the ADDCCC, which then
3327c478bd9Sstevel@tonic-gate	 * requires that imm22 be 0b111 10110 1 11111111 01001 or 0x3dbfe9,
3337c478bd9Sstevel@tonic-gate	 * or %hi(0xf6ffa400).  This determines the value of the constant
3347c478bd9Sstevel@tonic-gate	 * CBV2 below.
3357c478bd9Sstevel@tonic-gate	 *
3367c478bd9Sstevel@tonic-gate	 * The constant CBV1 is chosen such that an initial subcc %g0, CBV1
3377c478bd9Sstevel@tonic-gate	 * will set the carry bit and every addccc thereafter will continue
3387c478bd9Sstevel@tonic-gate	 * to generate a carry.  Other values are possible for CBV1 - this
3397c478bd9Sstevel@tonic-gate	 * is just one that works this way.
3407c478bd9Sstevel@tonic-gate	 *
3417c478bd9Sstevel@tonic-gate	 * Finally CBV3 is the expected answer when we perform our repeated
3427c478bd9Sstevel@tonic-gate	 * calculations on CBV1 and CBV2 - it is not otherwise specially
3437c478bd9Sstevel@tonic-gate	 * derived.  If this result is not obtained then a corruption has
3447c478bd9Sstevel@tonic-gate	 * occured during the FPRAS_REWRITE of one of the two blocks of
3457c478bd9Sstevel@tonic-gate	 * 16 instructions.  A corruption could also result in an illegal
3467c478bd9Sstevel@tonic-gate	 * instruction or other unexpected trap - we catch illegal
3477c478bd9Sstevel@tonic-gate	 * instruction traps in the PC range and trampoline to the
3487c478bd9Sstevel@tonic-gate	 * last instructions of the function to return a failure indication.
3497c478bd9Sstevel@tonic-gate	 *
3507c478bd9Sstevel@tonic-gate	 */
3517c478bd9Sstevel@tonic-gate
3527c478bd9Sstevel@tonic-gate#define	CBV1		0xc11
3537c478bd9Sstevel@tonic-gate#define	CBV2		0xf6ffa400
3547c478bd9Sstevel@tonic-gate#define	CBV3		0x66f9d800
3557c478bd9Sstevel@tonic-gate#define	CBR1		%o1
3567c478bd9Sstevel@tonic-gate#define	CBR2		%l6
3577c478bd9Sstevel@tonic-gate#define	CBO2		%o2
3587c478bd9Sstevel@tonic-gate#define	SETHI_CBV2_CBR1		sethi %hi(CBV2), CBR1
3597c478bd9Sstevel@tonic-gate#define	ADDCCC_CBR1_CBR2_CBR2	addccc CBR1, CBR2, CBR2
3607c478bd9Sstevel@tonic-gate
3617c478bd9Sstevel@tonic-gate	.align	64
3627c478bd9Sstevel@tonic-gate	ENTRY_NP(fpras_chkfn_type1)
3637c478bd9Sstevel@tonic-gate	mov	CBR2, CBO2		! 1, preserve CBR2 of (callers) window
3647c478bd9Sstevel@tonic-gate	mov	FPRAS_OK, %o0		! 2, default return value
3657c478bd9Sstevel@tonic-gate	ba,pt	%icc, 1f		! 3
3667c478bd9Sstevel@tonic-gate	  subcc %g0, CBV1, CBR2		! 4
3677c478bd9Sstevel@tonic-gate					! 5 - 16
3687c478bd9Sstevel@tonic-gate	.align	64
3697c478bd9Sstevel@tonic-gate1:	SETHI_CBV2_CBR1			! 1
3707c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 2
3717c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 3
3727c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 4
3737c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 5
3747c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 6
3757c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 7
3767c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 8
3777c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 9
3787c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 10
3797c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 11
3807c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 12
3817c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 13
3827c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 14
3837c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 15
3847c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 16
3857c478bd9Sstevel@tonic-gate
3867c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 1
3877c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 2
3887c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 3
3897c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 4
3907c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 5
3917c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 6
3927c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 7
3937c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 8
3947c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 9
3957c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 10
3967c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 11
3977c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 12
3987c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 13
3997c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 14
4007c478bd9Sstevel@tonic-gate	ADDCCC_CBR1_CBR2_CBR2		! 15
4017c478bd9Sstevel@tonic-gate	SETHI_CBV2_CBR1			! 16
4027c478bd9Sstevel@tonic-gate
4037c478bd9Sstevel@tonic-gate	addc	CBR1, CBR2, CBR2	! 1
4047c478bd9Sstevel@tonic-gate	sethi	%hi(CBV3), CBR1		! 2
4057c478bd9Sstevel@tonic-gate	cmp	CBR1, CBR2		! 3
4067c478bd9Sstevel@tonic-gate	movnz	%icc, FPRAS_BADCALC, %o0! 4, how detected
4077c478bd9Sstevel@tonic-gate	retl				! 5
4087c478bd9Sstevel@tonic-gate	  mov	CBO2, CBR2		! 6, restore borrowed register
4097c478bd9Sstevel@tonic-gate	.skip 4*(13-7+1)		! 7 - 13
4107c478bd9Sstevel@tonic-gate					!
4117c478bd9Sstevel@tonic-gate					! illegal instr'n trap comes here
4127c478bd9Sstevel@tonic-gate					!
4137c478bd9Sstevel@tonic-gate	mov	CBO2, CBR2		! 14, restore borrowed register
4147c478bd9Sstevel@tonic-gate	retl				! 15
4157c478bd9Sstevel@tonic-gate	  mov	FPRAS_BADTRAP, %o0	! 16, how detected
4167c478bd9Sstevel@tonic-gate	SET_SIZE(fpras_chkfn_type1)
4173b890a5bSjb145095#endif	/* lint */
4187c478bd9Sstevel@tonic-gate
4193b890a5bSjb145095#if defined(lint)
4203b890a5bSjb145095char	soft_state_message_strings[SOLARIS_SOFT_STATE_MSG_CNT][SSM_SIZE];
4213b890a5bSjb145095#else	/* lint */
4223b890a5bSjb145095	.seg	".data"
4233b890a5bSjb145095	.global soft_state_message_strings
4243b890a5bSjb145095
4253b890a5bSjb145095	.align	SSM_SIZE
4263b890a5bSjb145095soft_state_message_strings:
4273b890a5bSjb145095	.asciz	SOLARIS_SOFT_STATE_BOOT_MSG_STR
4283b890a5bSjb145095	.align	SSM_SIZE
4293b890a5bSjb145095	.asciz	SOLARIS_SOFT_STATE_RUN_MSG_STR
4303b890a5bSjb145095	.align	SSM_SIZE
4313b890a5bSjb145095	.asciz	SOLARIS_SOFT_STATE_HALT_MSG_STR
4323b890a5bSjb145095	.align	SSM_SIZE
4333b890a5bSjb145095	.asciz	SOLARIS_SOFT_STATE_POWER_MSG_STR
4343b890a5bSjb145095	.align	SSM_SIZE
4353b890a5bSjb145095	.asciz	SOLARIS_SOFT_STATE_PANIC_MSG_STR
4363b890a5bSjb145095	.align	SSM_SIZE
4373b890a5bSjb145095	.asciz	SOLARIS_SOFT_STATE_REBOOT_MSG_STR
4383b890a5bSjb145095	.align	SSM_SIZE
4393b890a5bSjb145095	.asciz	SOLARIS_SOFT_STATE_DEBUG_MSG_STR
4403b890a5bSjb145095	.align	SSM_SIZE
4413b890a5bSjb145095	.skip	SSM_SIZE			/* saved message */
4423b890a5bSjb145095	.nword	0
4433b890a5bSjb145095
4443b890a5bSjb145095	.seg	".text"
4457c478bd9Sstevel@tonic-gate#endif	/* lint */
446