mach_subr_asm.s revision bd28a477274db2b836577dfd6f223c696ad00720
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* General machine architecture & implementation specific
* assembly language routines.
*/
#if defined(lint)
#else /* lint */
#include "assym.h"
#endif /* lint */
#define CPU_MODULE /* need it for NSEC_SHIFT used by NATIVE_TIME_TO_NSEC() */
#include <sys/asm_linkage.h>
#include <sys/machsystm.h>
#include <sys/machthread.h>
#include <sys/machclock.h>
#include <sys/privregs.h>
#include <sys/soft_state.h>
#if defined(lint)
ultra_gettick(void)
{ return (0); }
#else /* lint */
/*
* This isn't the routine you're looking for.
*
* The routine simply returns the value of %tick on the *current* processor.
* Most of the time, gettick() [which in turn maps to %stick on platforms
* that have different CPU %tick rates] is what you want.
*/
#endif /* lint */
#if defined(lint)
/* ARGSUSED */
void
{ }
#else /* lint */
#endif /* lint */
#if defined(lint)
{ return (0); }
#else /* lint */
#endif /* lint */
#if defined(lint)
/* ARGSUSED */
void
{}
#else /* lint */
/*
* Called from a x-trap at tl1 must use %g1 as arg
*/
/*
* Save %o regs
*/
/*
* set done flag to 0
*/
/*
* Restore %o regs
*/
/*
* This CPU is on its way out. Spin here
* until the DR unconfigure code stops it.
* Returning would put it back in the OS
* where it might grab resources like locks,
* causing some nastiness to occur.
*/
0:
ba,a 0b
#endif /* lint */
#if defined(lint)
/* ARGSUSED */
int
getprocessorid(void)
{ return (0); }
#else /* lint */
/*
* Get the processor ID.
* === MID reg as specified in 15dec89 sun4u spec, sec 5.4.3
*/
#endif /* lint */
/* ARGSUSED */
{ return 0; }
#else /* lint */
!
!
#endif /* lint */
#if defined(lint)
/* ARGSUSED */
void
set_cmp_error_steering(void)
{}
#else /* lint */
#endif /* lint */
#if defined(lint)
/* ARGSUSED */
ultra_getver(void)
{
return (0);
}
#else /* lint */
#endif /* lint */
#if defined(lint)
int
fpras_chkfn_type1(void)
{ return 0; }
#else /* lint */
/*
* Check instructions using just the AX pipelines, designed by
* C.B. Liaw of PNP.
*
* This function must match a struct fpras_chkfn and must be
* block aligned. A zero return means all was well. These
* instructions are chosen to be sensitive to bit corruptions
* on the fpras rewrite, so if a bit corruption still produces
* a valid instruction we should still get an incorrect result
* here. This function is never called directly - it is copied
* into per-cpu and per-operation buffers; it must therefore
* be absolutely position independent. If an illegal instruction
* is encountered then the trap handler trampolines to the final
* three instructions of this function.
*
* We want two instructions that are complements of one another,
* and which can perform a calculation with a known result.
*
* SETHI:
*
* | 0 0 | rd | 1 0 0 | imm22 |
* 31 30 29 25 24 22 21 0
*
* ADDCCC with two source registers:
*
* | 1 0 | rd | 0 1 1 0 0 0 | rs1 | 0 | - | rs2 |
* 31 30 29 25 24 19 18 14 13 12 5 4 0
*
* We can choose rd and imm2 of the SETHI and rd, rs1 and rs2 of
* the ADDCCC to obtain instructions that are complements in all but
* bit 30.
*
* Registers are numbered as follows:
*
* r[31] %i7
* r[30] %i6
* r[29] %i5
* r[28] %i4
* r[27] %i3
* r[26] %i2
* r[25] %i1
* r[24] %i0
* r[23] %l7
* r[22] %l6
* r[21] %l5
* r[20] %l4
* r[19] %l3
* r[18] %l2
* r[17] %l1
* r[16] %l0
* r[15] %o7
* r[14] %o6
* r[13] %o5
* r[12] %o4
* r[11] %o3
* r[10] %o2
* r[9] %o1
* r[8] %o0
* r[7] %g7
* r[6] %g6
* r[5] %g5
* r[4] %g4
* r[3] %g3
* r[2] %g2
* r[1] %g1
* r[0] %g0
*
* For register r[n], register r[31-n] is the complement. We must
* avoid use of %i6/%i7 and %o6/%o7 as well as %g7. Clearly we need
* to use a local or input register as one half of the pair, which
* requires us to obtain our own register window or take steps
* to preserve any local or input we choose to use. We choose
* %o1 as rd for the SETHI, so rd of the ADDCCC must be %l6.
* We'll use %o1 as rs1 and %l6 as rs2 of the ADDCCC, which then
* requires that imm22 be 0b111 10110 1 11111111 01001 or 0x3dbfe9,
* or %hi(0xf6ffa400). This determines the value of the constant
* CBV2 below.
*
* The constant CBV1 is chosen such that an initial subcc %g0, CBV1
* will set the carry bit and every addccc thereafter will continue
* to generate a carry. Other values are possible for CBV1 - this
* is just one that works this way.
*
* Finally CBV3 is the expected answer when we perform our repeated
* calculations on CBV1 and CBV2 - it is not otherwise specially
* derived. If this result is not obtained then a corruption has
* occured during the FPRAS_REWRITE of one of the two blocks of
* 16 instructions. A corruption could also result in an illegal
* instruction or other unexpected trap - we catch illegal
* instruction traps in the PC range and trampoline to the
* last instructions of the function to return a failure indication.
*
*/
#define CBV1 0xc11
#define CBV2 0xf6ffa400
#define CBV3 0x66f9d800
.align 64
! 5 - 16
.align 64
SETHI_CBV2_CBR1 ! 3
SETHI_CBV2_CBR1 ! 5
SETHI_CBV2_CBR1 ! 7
SETHI_CBV2_CBR1 ! 9
SETHI_CBV2_CBR1 ! 11
SETHI_CBV2_CBR1 ! 13
SETHI_CBV2_CBR1 ! 15
SETHI_CBV2_CBR1 ! 2
SETHI_CBV2_CBR1 ! 4
SETHI_CBV2_CBR1 ! 6
SETHI_CBV2_CBR1 ! 8
SETHI_CBV2_CBR1 ! 10
SETHI_CBV2_CBR1 ! 12
SETHI_CBV2_CBR1 ! 14
SETHI_CBV2_CBR1 ! 16
retl ! 5
!
!
mov CBO2, CBR2 ! 14, restore borrowed register
retl ! 15
mov FPRAS_BADTRAP, %o0 ! 16, how detected
SET_SIZE(fpras_chkfn_type1)
#endif /* lint */
#if defined(lint)
char soft_state_message_strings[SOLARIS_SOFT_STATE_MSG_CNT][SSM_SIZE];
#else /* lint */
.seg ".data"
.global soft_state_message_strings
.align SSM_SIZE
soft_state_message_strings:
.asciz SOLARIS_SOFT_STATE_BOOT_MSG_STR
.align SSM_SIZE
.asciz SOLARIS_SOFT_STATE_RUN_MSG_STR
.align SSM_SIZE
.asciz SOLARIS_SOFT_STATE_HALT_MSG_STR
.align SSM_SIZE
.asciz SOLARIS_SOFT_STATE_POWER_MSG_STR
.align SSM_SIZE
.asciz SOLARIS_SOFT_STATE_PANIC_MSG_STR
.align SSM_SIZE
.asciz SOLARIS_SOFT_STATE_REBOOT_MSG_STR
.align SSM_SIZE
.asciz SOLARIS_SOFT_STATE_DEBUG_MSG_STR
.align SSM_SIZE
.skip SSM_SIZE /* saved message */
.nword 0
.seg ".text"
#endif /* lint */