17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*
237c478bdstevel@tonic-gate * Copyright 1999-2002 Sun Microsystems, Inc.  All rights reserved.
247c478bdstevel@tonic-gate * Use is subject to license terms.
257c478bdstevel@tonic-gate */
267c478bdstevel@tonic-gate
277c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
287c478bdstevel@tonic-gate
297c478bdstevel@tonic-gate/*
307c478bdstevel@tonic-gate * cb_srt0.s - cprboot startup code
317c478bdstevel@tonic-gate */
327c478bdstevel@tonic-gate#include <sys/asm_linkage.h>
337c478bdstevel@tonic-gate#include <sys/machthread.h>
347c478bdstevel@tonic-gate#include <sys/privregs.h>
357c478bdstevel@tonic-gate#include <sys/cpr_impl.h>
367c478bdstevel@tonic-gate#include <sys/param.h>
377c478bdstevel@tonic-gate#include <sys/mmu.h>
387c478bdstevel@tonic-gate
397c478bdstevel@tonic-gate#if defined(lint)
407c478bdstevel@tonic-gate#include <sys/cpr.h>
417c478bdstevel@tonic-gatevoid *estack;
427c478bdstevel@tonic-gatecaddr_t _end[1];
437c478bdstevel@tonic-gate#endif
447c478bdstevel@tonic-gate
457c478bdstevel@tonic-gate#include "cprboot.h"
467c478bdstevel@tonic-gate
477c478bdstevel@tonic-gate
487c478bdstevel@tonic-gate#if defined(lint)
497c478bdstevel@tonic-gate
507c478bdstevel@tonic-gate/* ARGSUSED */
517c478bdstevel@tonic-gatevoid
527c478bdstevel@tonic-gate_start(void *a, ...)
537c478bdstevel@tonic-gate{}
547c478bdstevel@tonic-gate
557c478bdstevel@tonic-gate#else	/* !lint */
567c478bdstevel@tonic-gate
577c478bdstevel@tonic-gate	.seg	".bss"
587c478bdstevel@tonic-gate	.align	MMU_PAGESIZE
597c478bdstevel@tonic-gate	.skip	CB_SSS
607c478bdstevel@tonic-gateeslave_stack:				! top of slave cpu stack
617c478bdstevel@tonic-gate	.skip	CB_MSS
627c478bdstevel@tonic-gateestack:					! top of cprboot stack
637c478bdstevel@tonic-gate	.global	estack
647c478bdstevel@tonic-gate
657c478bdstevel@tonic-gate	.seg	".data"
667c478bdstevel@tonic-gate	.align	8
677c478bdstevel@tonic-gatelocal_cif:
687c478bdstevel@tonic-gate	.xword	0			! space for prom cookie
697c478bdstevel@tonic-gate
707c478bdstevel@tonic-gate	.seg	".text"
717c478bdstevel@tonic-gate	.align	8
727c478bdstevel@tonic-gate
737c478bdstevel@tonic-gate	!
747c478bdstevel@tonic-gate	! regs on entry:
757c478bdstevel@tonic-gate	! %o4 = prom cookie
767c478bdstevel@tonic-gate	!
777c478bdstevel@tonic-gate	ENTRY(_start)
787c478bdstevel@tonic-gate	set	estack - STACK_BIAS, %o5
797c478bdstevel@tonic-gate	save	%o5, -SA(MINFRAME), %sp
807c478bdstevel@tonic-gate
817c478bdstevel@tonic-gate	!
827c478bdstevel@tonic-gate	! clear the bss
837c478bdstevel@tonic-gate	!
847c478bdstevel@tonic-gate	set	_edata, %o0
857c478bdstevel@tonic-gate	set	_end, %g2
867c478bdstevel@tonic-gate	call	bzero
877c478bdstevel@tonic-gate	sub	%g2, %o0, %o1		! bss size = (_end - _edata)
887c478bdstevel@tonic-gate
897c478bdstevel@tonic-gate	!
907c478bdstevel@tonic-gate	! Set pstate to a known state:
917c478bdstevel@tonic-gate	! enable fp, privilege, interrupt enable
927c478bdstevel@tonic-gate	!
937c478bdstevel@tonic-gate	wrpr	%g0, PSTATE_PEF|PSTATE_PRIV|PSTATE_IE, %pstate
947c478bdstevel@tonic-gate
957c478bdstevel@tonic-gate	!
967c478bdstevel@tonic-gate	! first stage
977c478bdstevel@tonic-gate	!
987c478bdstevel@tonic-gate	set	local_cif, %g2
997c478bdstevel@tonic-gate	stx	%i4, [%g2]
1007c478bdstevel@tonic-gate	mov	%i4, %o0		! SPARCV9/CIF
1017c478bdstevel@tonic-gate	call	main			! Mcprboot [tag]
1027c478bdstevel@tonic-gate	mov	1, %o1			! first=true
1037c478bdstevel@tonic-gate
1047c478bdstevel@tonic-gate	!
1057c478bdstevel@tonic-gate	! switch to new stack
1067c478bdstevel@tonic-gate	!
1077c478bdstevel@tonic-gate	set	CB_STACK_VIRT + CB_STACK_SIZE, %o5
1087c478bdstevel@tonic-gate	sub	%o5, STACK_BIAS + SA(MINFRAME), %sp
1097c478bdstevel@tonic-gate
1107c478bdstevel@tonic-gate	!
1117c478bdstevel@tonic-gate	! second stage
1127c478bdstevel@tonic-gate	!
1137c478bdstevel@tonic-gate	set	local_cif, %g2
1147c478bdstevel@tonic-gate	ldx	[%g2], %o0		! SPARCV9/CIF
1157c478bdstevel@tonic-gate	call	main			! Mcprboot [tag]
1167c478bdstevel@tonic-gate	mov	0, %o1			! first=false
1177c478bdstevel@tonic-gate
1187c478bdstevel@tonic-gate	call	prom_exit_to_mon	! can't happen... :-)
1197c478bdstevel@tonic-gate	nop
1207c478bdstevel@tonic-gate	SET_SIZE(_start)
1217c478bdstevel@tonic-gate
1227c478bdstevel@tonic-gate#endif	/* lint */
1237c478bdstevel@tonic-gate
1247c478bdstevel@tonic-gate
1257c478bdstevel@tonic-gate#if defined(lint)
1267c478bdstevel@tonic-gate
1277c478bdstevel@tonic-gate/*
1287c478bdstevel@tonic-gate * args from cprboot main:
1297c478bdstevel@tonic-gate * 	%o0	prom cookie
1307c478bdstevel@tonic-gate *	%o1	struct sun4u_machdep *mdp
1317c478bdstevel@tonic-gate *
1327c478bdstevel@tonic-gate * Any change to this register assignment requires
1337c478bdstevel@tonic-gate * changes to uts/sun4u/ml/cpr_resume_setup.s
1347c478bdstevel@tonic-gate */
1357c478bdstevel@tonic-gate
1367c478bdstevel@tonic-gate/* ARGSUSED */
1377c478bdstevel@tonic-gatevoid
1387c478bdstevel@tonic-gateexit_to_kernel(void *cookie, csu_md_t *mdp)
1397c478bdstevel@tonic-gate{}
1407c478bdstevel@tonic-gate
1417c478bdstevel@tonic-gate#else	/* lint */
1427c478bdstevel@tonic-gate
1437c478bdstevel@tonic-gate	ENTRY(exit_to_kernel)
1447c478bdstevel@tonic-gate	!
1457c478bdstevel@tonic-gate	! setup temporary stack and adjust
1467c478bdstevel@tonic-gate	! by the saved kernel stack bias
1477c478bdstevel@tonic-gate	!
1487c478bdstevel@tonic-gate	set	tmp_stack, %g1			! g1 = &tmp_stack
1497c478bdstevel@tonic-gate	ldx	[%g1], %l2			! l2 =  tmp_stack
1507c478bdstevel@tonic-gate	sub	%l2, SA(MINFRAME), %l2
1517c478bdstevel@tonic-gate	ld	[%o1 + CPR_MD_KSB], %l4		! mdp->ksb
1527c478bdstevel@tonic-gate	sub	%l2, %l4, %sp
1537c478bdstevel@tonic-gate
1547c478bdstevel@tonic-gate	!
1557c478bdstevel@tonic-gate	! set pstate and wstate from saved values
1567c478bdstevel@tonic-gate	!
1577c478bdstevel@tonic-gate	lduh	[%o1 + CPR_MD_KPSTATE], %l4	! l4 = mdp->kpstate
1587c478bdstevel@tonic-gate	wrpr	%g0, %l4, %pstate
1597c478bdstevel@tonic-gate	lduh	[%o1 + CPR_MD_KWSTATE], %l4	! l4 = mdp->kwstate
1607c478bdstevel@tonic-gate	wrpr	%g0, %l4, %wstate
1617c478bdstevel@tonic-gate
1627c478bdstevel@tonic-gate	!
1637c478bdstevel@tonic-gate	! jump to kernel with %o0 and %o1 unchanged
1647c478bdstevel@tonic-gate	!
1657c478bdstevel@tonic-gate	ldx	[%o1 + CPR_MD_FUNC], %l3	! l3 = mdp->func
1667c478bdstevel@tonic-gate	jmpl	%l3, %g0
1677c478bdstevel@tonic-gate	nop
1687c478bdstevel@tonic-gate
1697c478bdstevel@tonic-gate	/* there is no return from here */
1707c478bdstevel@tonic-gate	unimp	0
1717c478bdstevel@tonic-gate	SET_SIZE(exit_to_kernel)
1727c478bdstevel@tonic-gate
1737c478bdstevel@tonic-gate#endif	/* lint */
1747c478bdstevel@tonic-gate
1757c478bdstevel@tonic-gate
1767c478bdstevel@tonic-gate#if defined(lint)
1777c478bdstevel@tonic-gate
1787c478bdstevel@tonic-gate/* ARGSUSED */
1797c478bdstevel@tonic-gateint
1807c478bdstevel@tonic-gateclient_handler(void *cif_handler, void *arg_array)
1817c478bdstevel@tonic-gate{ return (0); }
1827c478bdstevel@tonic-gate
1837c478bdstevel@tonic-gate#else
1847c478bdstevel@tonic-gate
1857c478bdstevel@tonic-gate	!
1867c478bdstevel@tonic-gate	! 64/64 client interface for ieee1275 prom
1877c478bdstevel@tonic-gate	!
1887c478bdstevel@tonic-gate	ENTRY(client_handler)
1897c478bdstevel@tonic-gate	mov	%o7, %g1
1907c478bdstevel@tonic-gate	mov	%o0, %g5
1917c478bdstevel@tonic-gate	mov	%o1, %o0
1927c478bdstevel@tonic-gate	jmp	%g5
1937c478bdstevel@tonic-gate	mov	%g1, %o7
1947c478bdstevel@tonic-gate	SET_SIZE(client_handler)
1957c478bdstevel@tonic-gate
1967c478bdstevel@tonic-gate#endif	/* lint */
1977c478bdstevel@tonic-gate
1987c478bdstevel@tonic-gate
1997c478bdstevel@tonic-gate#if defined(lint)
2007c478bdstevel@tonic-gate
2017c478bdstevel@tonic-gate/* ARGSUSED */
2027c478bdstevel@tonic-gatevoid
2037c478bdstevel@tonic-gatebzero(void *base, size_t len)
2047c478bdstevel@tonic-gate{}
2057c478bdstevel@tonic-gate
2067c478bdstevel@tonic-gate#else
2077c478bdstevel@tonic-gate
2087c478bdstevel@tonic-gate	ENTRY(bzero)
2097c478bdstevel@tonic-gate	brz,pn	%o1, 2f
2107c478bdstevel@tonic-gate	nop
2117c478bdstevel@tonic-gate	mov	%o0, %o2
2127c478bdstevel@tonic-gate	mov	%o1, %o3
2137c478bdstevel@tonic-gate1:
2147c478bdstevel@tonic-gate	stub	%g0, [%o2]
2157c478bdstevel@tonic-gate	dec	%o3
2167c478bdstevel@tonic-gate	brgz,pt	%o3, 1b
2177c478bdstevel@tonic-gate	inc	%o2
2187c478bdstevel@tonic-gate2:
2197c478bdstevel@tonic-gate	retl
2207c478bdstevel@tonic-gate	nop
2217c478bdstevel@tonic-gate	SET_SIZE(bzero)
2227c478bdstevel@tonic-gate
2237c478bdstevel@tonic-gate#endif	/* lint */
2247c478bdstevel@tonic-gate
2257c478bdstevel@tonic-gate
2267c478bdstevel@tonic-gate#if defined(lint)
2277c478bdstevel@tonic-gate
2287c478bdstevel@tonic-gate/* ARGSUSED */
2297c478bdstevel@tonic-gatevoid
2307c478bdstevel@tonic-gatephys_xcopy(physaddr_t phys_src, physaddr_t phys_dst, size_t len)
2317c478bdstevel@tonic-gate{}
2327c478bdstevel@tonic-gate
2337c478bdstevel@tonic-gate#else
2347c478bdstevel@tonic-gate
2357c478bdstevel@tonic-gate	!
2367c478bdstevel@tonic-gate	! copy len bytes from src to dst phys addrs;
2377c478bdstevel@tonic-gate	! requires src/dst/len 8-byte alignment;
2387c478bdstevel@tonic-gate	! used only for copying phys pages
2397c478bdstevel@tonic-gate	!
2407c478bdstevel@tonic-gate	ENTRY(phys_xcopy)
2417c478bdstevel@tonic-gate	brz,pn	%o2, 2f
2427c478bdstevel@tonic-gate	mov	%o0, %o3			! %o3 = src
2437c478bdstevel@tonic-gate	mov	%o1, %o4			! %o4 = dst
2447c478bdstevel@tonic-gate1:
2457c478bdstevel@tonic-gate	ldxa	[%o3]ASI_MEM, %o5		! %o5  = *src
2467c478bdstevel@tonic-gate	stxa	%o5, [%o4]ASI_MEM		! *dst = %o5
2477c478bdstevel@tonic-gate	dec	8, %o2				! len  -= 8
2487c478bdstevel@tonic-gate	inc	8, %o3				! src  += 8
2497c478bdstevel@tonic-gate	brgz,pt	%o2, 1b				! branch when (len > 0)
2507c478bdstevel@tonic-gate	inc	8, %o4				! dst  += 8
2517c478bdstevel@tonic-gate2:
2527c478bdstevel@tonic-gate	retl
2537c478bdstevel@tonic-gate	nop
2547c478bdstevel@tonic-gate	SET_SIZE(phys_xcopy)
2557c478bdstevel@tonic-gate
2567c478bdstevel@tonic-gate#endif
2577c478bdstevel@tonic-gate
2587c478bdstevel@tonic-gate
2597c478bdstevel@tonic-gate#if defined(lint)
2607c478bdstevel@tonic-gate
2617c478bdstevel@tonic-gate/* ARGSUSED */
2627c478bdstevel@tonic-gatevoid
2637c478bdstevel@tonic-gateget_dtlb_entry(int index, caddr_t *vaddrp, tte_t *tte)
2647c478bdstevel@tonic-gate{}
2657c478bdstevel@tonic-gate
2667c478bdstevel@tonic-gate#else	/* lint */
2677c478bdstevel@tonic-gate
2687c478bdstevel@tonic-gate	ENTRY(get_dtlb_entry)
2697c478bdstevel@tonic-gate	sllx	%o0, 3, %o0
2707c478bdstevel@tonic-gate	ldxa	[%o0]ASI_DTLB_ACCESS, %o3
2717c478bdstevel@tonic-gate	stx	%o3, [%o2]
2727c478bdstevel@tonic-gate	ldxa	[%o0]ASI_DTLB_TAGREAD, %o4
2737c478bdstevel@tonic-gate	retl
2747c478bdstevel@tonic-gate	stx	%o4, [%o1]
2757c478bdstevel@tonic-gate	SET_SIZE(get_dtlb_entry)
2767c478bdstevel@tonic-gate
2777c478bdstevel@tonic-gate#endif
2787c478bdstevel@tonic-gate
2797c478bdstevel@tonic-gate
2807c478bdstevel@tonic-gate#if defined(lint)
2817c478bdstevel@tonic-gate
2827c478bdstevel@tonic-gate/* ARGSUSED */
2837c478bdstevel@tonic-gatevoid
2847c478bdstevel@tonic-gateset_itlb_entry(int index, caddr_t vaddr, tte_t *tte)
2857c478bdstevel@tonic-gate{}
2867c478bdstevel@tonic-gate
2877c478bdstevel@tonic-gate/* ARGSUSED */
2887c478bdstevel@tonic-gatevoid
2897c478bdstevel@tonic-gateset_dtlb_entry(int index, caddr_t vaddr, tte_t *tte)
2907c478bdstevel@tonic-gate{}
2917c478bdstevel@tonic-gate
2927c478bdstevel@tonic-gate#else	/* lint */
2937c478bdstevel@tonic-gate
2947c478bdstevel@tonic-gate	ENTRY(set_dtlb_entry)
2957c478bdstevel@tonic-gate	sllx    %o0, 3, %o0
2967c478bdstevel@tonic-gate	srlx	%o1, MMU_PAGESHIFT, %o1
2977c478bdstevel@tonic-gate	sllx	%o1, MMU_PAGESHIFT, %o1
2987c478bdstevel@tonic-gate	set	MMU_TAG_ACCESS, %o4
2997c478bdstevel@tonic-gate	ldx	[%o2], %o3
3007c478bdstevel@tonic-gate	stxa	%o1, [%o4]ASI_DMMU
3017c478bdstevel@tonic-gate	stxa	%o3, [%o0]ASI_DTLB_ACCESS
3027c478bdstevel@tonic-gate	membar	#Sync
3037c478bdstevel@tonic-gate	retl
3047c478bdstevel@tonic-gate	nop
3057c478bdstevel@tonic-gate	SET_SIZE(set_dtlb_entry)
3067c478bdstevel@tonic-gate
3077c478bdstevel@tonic-gate	ENTRY(set_itlb_entry)
3087c478bdstevel@tonic-gate	sllx    %o0, 3, %o0
3097c478bdstevel@tonic-gate	srlx	%o1, MMU_PAGESHIFT, %o1
3107c478bdstevel@tonic-gate	sllx	%o1, MMU_PAGESHIFT, %o1
3117c478bdstevel@tonic-gate	set	MMU_TAG_ACCESS, %o4
3127c478bdstevel@tonic-gate	ldx	[%o2], %o3
3137c478bdstevel@tonic-gate	stxa	%o1, [%o4]ASI_IMMU
3147c478bdstevel@tonic-gate	stxa	%o3, [%o0]ASI_ITLB_ACCESS
3157c478bdstevel@tonic-gate	membar	#Sync
3167c478bdstevel@tonic-gate	retl
3177c478bdstevel@tonic-gate	nop
3187c478bdstevel@tonic-gate	SET_SIZE(set_itlb_entry)
3197c478bdstevel@tonic-gate
3207c478bdstevel@tonic-gate#endif
3217c478bdstevel@tonic-gate
3227c478bdstevel@tonic-gate
3237c478bdstevel@tonic-gate#if defined(lint)
3247c478bdstevel@tonic-gate
3257c478bdstevel@tonic-gateuint_t
3267c478bdstevel@tonic-gategetmid(void)
3277c478bdstevel@tonic-gate{ return (0); }
3287c478bdstevel@tonic-gate
3297c478bdstevel@tonic-gate#else	/* lint */
3307c478bdstevel@tonic-gate
3317c478bdstevel@tonic-gate	ENTRY(getmid)
3327c478bdstevel@tonic-gate	CPU_INDEX(%o0, %o1)
3337c478bdstevel@tonic-gate	retl
3347c478bdstevel@tonic-gate	nop
3357c478bdstevel@tonic-gate	SET_SIZE(getmid)
3367c478bdstevel@tonic-gate
3377c478bdstevel@tonic-gate#endif
3387c478bdstevel@tonic-gate
3397c478bdstevel@tonic-gate
3407c478bdstevel@tonic-gate#if defined(lint)
3417c478bdstevel@tonic-gate
3427c478bdstevel@tonic-gate/* ARGSUSED */
3437c478bdstevel@tonic-gatevoid
3447c478bdstevel@tonic-gatecpu_launch(int cpuid)
3457c478bdstevel@tonic-gate{
3467c478bdstevel@tonic-gate	slave_init(cpuid);
3477c478bdstevel@tonic-gate}
3487c478bdstevel@tonic-gate
3497c478bdstevel@tonic-gate#else	/* lint */
3507c478bdstevel@tonic-gate
3517c478bdstevel@tonic-gate	ENTRY(cpu_launch)
3527c478bdstevel@tonic-gate	set	CB_STACK_VIRT + CB_SSS, %o5
3537c478bdstevel@tonic-gate	sub	%o5, STACK_BIAS + SA(MINFRAME), %sp
3547c478bdstevel@tonic-gate	wrpr	%g0, PSTATE_PEF|PSTATE_PRIV|PSTATE_IE, %pstate
3557c478bdstevel@tonic-gate	call	slave_init
3567c478bdstevel@tonic-gate	nop
3577c478bdstevel@tonic-gate	unimp	0
3587c478bdstevel@tonic-gate	SET_SIZE(cpu_launch)
3597c478bdstevel@tonic-gate
3607c478bdstevel@tonic-gate#endif
3617c478bdstevel@tonic-gate
3627c478bdstevel@tonic-gate
3637c478bdstevel@tonic-gate#if defined(lint)
3647c478bdstevel@tonic-gate
3657c478bdstevel@tonic-gatevoid
3667c478bdstevel@tonic-gatemembar_stld(void)
3677c478bdstevel@tonic-gate{}
3687c478bdstevel@tonic-gate
3697c478bdstevel@tonic-gate#else	/* lint */
3707c478bdstevel@tonic-gate
3717c478bdstevel@tonic-gate	ENTRY(membar_stld)
3727c478bdstevel@tonic-gate	retl
3737c478bdstevel@tonic-gate	membar	#StoreLoad
3747c478bdstevel@tonic-gate	SET_SIZE(membar_stld)
3757c478bdstevel@tonic-gate
3767c478bdstevel@tonic-gate#endif
3777c478bdstevel@tonic-gate
3787c478bdstevel@tonic-gate
3797c478bdstevel@tonic-gate#if defined(lint)
3807c478bdstevel@tonic-gate
3817c478bdstevel@tonic-gate/* ARGSUSED */
3827c478bdstevel@tonic-gatevoid
3837c478bdstevel@tonic-gatecb_usec_wait(int usecs)
3847c478bdstevel@tonic-gate{}
3857c478bdstevel@tonic-gate
3867c478bdstevel@tonic-gate#else
3877c478bdstevel@tonic-gate
3887c478bdstevel@tonic-gate	.align	32			! cache alignment for next 8 instr
3897c478bdstevel@tonic-gate	ENTRY(cb_usec_wait)
3907c478bdstevel@tonic-gate
3917c478bdstevel@tonic-gate	sethi	%hi(cpu_delay), %o1
3927c478bdstevel@tonic-gate	ld	[%o1 + %lo(cpu_delay)], %o1
3937c478bdstevel@tonic-gate	mov	%o1, %o2
3947c478bdstevel@tonic-gate1:	brnz,pt	%o2, 1b			! usec countdown loop
3957c478bdstevel@tonic-gate	dec	%o2			! 2 instr in loop
3967c478bdstevel@tonic-gate
3977c478bdstevel@tonic-gate	dec	%o0			! for each usec:
3987c478bdstevel@tonic-gate	brgz,pt	%o0, 1b			! run the above loop
3997c478bdstevel@tonic-gate	mov	%o1, %o2
4007c478bdstevel@tonic-gate
4017c478bdstevel@tonic-gate	retl
4027c478bdstevel@tonic-gate	nop
4037c478bdstevel@tonic-gate	SET_SIZE(cb_usec_wait)
4047c478bdstevel@tonic-gate
4057c478bdstevel@tonic-gate#endif
406