1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_FPU_GLOBALS_H 28*0Sstevel@tonic-gate #define _SYS_FPU_GLOBALS_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate /* 33*0Sstevel@tonic-gate * Sparc floating-point simulator PRIVATE include file. 34*0Sstevel@tonic-gate */ 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #include <sys/types.h> 37*0Sstevel@tonic-gate #include <vm/seg.h> 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate #ifdef __cplusplus 40*0Sstevel@tonic-gate extern "C" { 41*0Sstevel@tonic-gate #endif 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate /* PRIVATE CONSTANTS */ 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate #define INTEGER_BIAS 31 46*0Sstevel@tonic-gate #define LONGLONG_BIAS 63 47*0Sstevel@tonic-gate #define SINGLE_BIAS 127 48*0Sstevel@tonic-gate #define DOUBLE_BIAS 1023 49*0Sstevel@tonic-gate #define EXTENDED_BIAS 16383 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate /* PRIVATE TYPES */ 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate #define DOUBLE_E(n) (n & 0xfffe) /* More significant word of double. */ 54*0Sstevel@tonic-gate #define DOUBLE_F(n) (1+DOUBLE_E(n)) /* Less significant word of double. */ 55*0Sstevel@tonic-gate #define EXTENDED_E(n) (n & 0xfffc) /* Sign/exponent/significand of extended. */ 56*0Sstevel@tonic-gate #define EXTENDED_F(n) (1+EXTENDED_E(n)) /* 2nd word of extended significand. */ 57*0Sstevel@tonic-gate #define EXTENDED_G(n) (2+EXTENDED_E(n)) /* 3rd word of extended significand. */ 58*0Sstevel@tonic-gate #define EXTENDED_H(n) (3+EXTENDED_E(n)) /* 4th word of extended significand. */ 59*0Sstevel@tonic-gate #define DOUBLE(n) ((n & 0xfffe) >> 1) /* Shift n to access double regs. */ 60*0Sstevel@tonic-gate #define QUAD_E(n) ((n & 0xfffc) >> 1) /* More significant half of quad. */ 61*0Sstevel@tonic-gate #define QUAD_F(n) (1+QUAD_E(n)) /* Less significant half of quad. */ 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate #if defined(_KERNEL) 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate typedef struct { 67*0Sstevel@tonic-gate int sign; 68*0Sstevel@tonic-gate enum fp_class_type fpclass; 69*0Sstevel@tonic-gate int exponent; /* Unbiased exponent */ 70*0Sstevel@tonic-gate uint_t significand[4]; /* Four significand word . */ 71*0Sstevel@tonic-gate int rounded; /* rounded bit */ 72*0Sstevel@tonic-gate int sticky; /* stick bit */ 73*0Sstevel@tonic-gate } unpacked; 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate /* 77*0Sstevel@tonic-gate * PRIVATE FUNCTIONS 78*0Sstevel@tonic-gate * pfreg routines use "physical" FPU registers, in fpusystm.h. 79*0Sstevel@tonic-gate * vfreg routines use "virtual" FPU registers at *_fp_current_pfregs. 80*0Sstevel@tonic-gate */ 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate extern void _fp_read_vfreg(FPU_REGS_TYPE *, uint_t, fp_simd_type *); 83*0Sstevel@tonic-gate extern void _fp_write_vfreg(FPU_REGS_TYPE *, uint_t, fp_simd_type *); 84*0Sstevel@tonic-gate extern void _fp_read_vdreg(FPU_DREGS_TYPE *, uint_t, fp_simd_type *); 85*0Sstevel@tonic-gate extern void _fp_write_vdreg(FPU_DREGS_TYPE *, uint_t, fp_simd_type *); 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate extern enum ftt_type _fp_iu_simulator(fp_simd_type *, fp_inst_type, 88*0Sstevel@tonic-gate struct regs *, void *, kfpu_t *); 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate extern void _fp_unpack(fp_simd_type *, unpacked *, uint_t, enum fp_op_type); 91*0Sstevel@tonic-gate extern void _fp_pack(fp_simd_type *, unpacked *, uint_t, enum fp_op_type); 92*0Sstevel@tonic-gate extern void _fp_unpack_word(fp_simd_type *, uint32_t *, uint_t); 93*0Sstevel@tonic-gate extern void _fp_pack_word(fp_simd_type *, uint32_t *, uint_t); 94*0Sstevel@tonic-gate extern void _fp_unpack_extword(fp_simd_type *, uint64_t *, uint_t); 95*0Sstevel@tonic-gate extern void _fp_pack_extword(fp_simd_type *, uint64_t *, uint_t); 96*0Sstevel@tonic-gate extern enum ftt_type fmovcc(fp_simd_type *, fp_inst_type, fsr_type *); 97*0Sstevel@tonic-gate extern enum ftt_type fmovr(fp_simd_type *, fp_inst_type); 98*0Sstevel@tonic-gate extern enum ftt_type movcc(fp_simd_type *, fp_inst_type, struct regs *, 99*0Sstevel@tonic-gate void *, kfpu_t *); 100*0Sstevel@tonic-gate extern enum ftt_type fldst(fp_simd_type *, fp_inst_type, struct regs *, 101*0Sstevel@tonic-gate void *); 102*0Sstevel@tonic-gate extern void fpu_normalize(unpacked *); 103*0Sstevel@tonic-gate extern void fpu_rightshift(unpacked *, int); 104*0Sstevel@tonic-gate extern void fpu_set_exception(fp_simd_type *, enum fp_exception_type); 105*0Sstevel@tonic-gate extern void fpu_error_nan(fp_simd_type *, unpacked *); 106*0Sstevel@tonic-gate extern void unpacksingle(fp_simd_type *, unpacked *, single_type); 107*0Sstevel@tonic-gate extern void unpackdouble(fp_simd_type *, unpacked *, double_type, uint_t); 108*0Sstevel@tonic-gate extern uint_t fpu_add3wc(uint_t *, uint_t, uint_t, uint_t); 109*0Sstevel@tonic-gate extern uint_t fpu_sub3wc(uint_t *, uint_t, uint_t, uint_t); 110*0Sstevel@tonic-gate extern uint_t fpu_neg2wc(uint_t *, uint_t, uint_t); 111*0Sstevel@tonic-gate extern int fpu_cmpli(uint_t *, uint_t *, int); 112*0Sstevel@tonic-gate 113*0Sstevel@tonic-gate /* extern void _fp_product(uint_t, uint_t, uint_t *); */ 114*0Sstevel@tonic-gate 115*0Sstevel@tonic-gate extern enum fcc_type _fp_compare(fp_simd_type *, unpacked *, unpacked *, int); 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate extern void _fp_add(fp_simd_type *, unpacked *, unpacked *, unpacked *); 118*0Sstevel@tonic-gate extern void _fp_sub(fp_simd_type *, unpacked *, unpacked *, unpacked *); 119*0Sstevel@tonic-gate extern void _fp_mul(fp_simd_type *, unpacked *, unpacked *, unpacked *); 120*0Sstevel@tonic-gate extern void _fp_div(fp_simd_type *, unpacked *, unpacked *, unpacked *); 121*0Sstevel@tonic-gate extern void _fp_sqrt(fp_simd_type *, unpacked *, unpacked *); 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate extern enum ftt_type _fp_write_word(uint32_t *, uint32_t, fp_simd_type *); 124*0Sstevel@tonic-gate extern enum ftt_type _fp_read_word(const uint32_t *, uint32_t *, 125*0Sstevel@tonic-gate fp_simd_type *); 126*0Sstevel@tonic-gate extern enum ftt_type _fp_read_inst(const uint32_t *, uint32_t *, 127*0Sstevel@tonic-gate fp_simd_type *); 128*0Sstevel@tonic-gate extern enum ftt_type _fp_write_extword(uint64_t *, uint64_t, fp_simd_type *); 129*0Sstevel@tonic-gate extern enum ftt_type _fp_read_extword(const uint64_t *, uint64_t *, 130*0Sstevel@tonic-gate fp_simd_type *); 131*0Sstevel@tonic-gate extern enum ftt_type read_iureg(fp_simd_type *, uint_t, struct regs *, 132*0Sstevel@tonic-gate void *, uint64_t *); 133*0Sstevel@tonic-gate extern enum ftt_type write_iureg(fp_simd_type *, uint_t, struct regs *, 134*0Sstevel@tonic-gate void *, uint64_t *); 135*0Sstevel@tonic-gate #endif /* _KERNEL */ 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate #ifdef __cplusplus 138*0Sstevel@tonic-gate } 139*0Sstevel@tonic-gate #endif 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate #endif /* _SYS_FPU_GLOBALS_H */ 142