1207151Smarius/*- 2207151Smarius * Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.org> 3207151Smarius * All rights reserved. 4207151Smarius * 5207151Smarius * Redistribution and use in source and binary forms, with or without 6207151Smarius * modification, are permitted provided that the following conditions 7207151Smarius * are met: 8207151Smarius * 1. Redistributions of source code must retain the above copyright 9207151Smarius * notice, this list of conditions and the following disclaimer. 10207151Smarius * 2. Redistributions in binary form must reproduce the above copyright 11207151Smarius * notice, this list of conditions and the following disclaimer in the 12207151Smarius * documentation and/or other materials provided with the distribution. 13207151Smarius * 14207151Smarius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15207151Smarius * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16207151Smarius * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17207151Smarius * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18207151Smarius * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19207151Smarius * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20207151Smarius * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21207151Smarius * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22207151Smarius * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 23207151Smarius * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24207151Smarius * 25207151Smarius * $FreeBSD: releng/11.0/tools/test/testfloat/sparc64/fpu_reg.h 207151 2010-04-24 12:11:41Z marius $ 26207151Smarius */ 27207151Smarius 28207151Smarius#ifndef _TESTFLOAT_SPARC64_FPU_REG_H_ 29207151Smarius#define _TESTFLOAT_SPARC64_FPU_REG_H_ 30207151Smarius 31207151Smarius#include <sys/types.h> 32207151Smariusextern u_int32_t __fpreg[64]; 33207151Smarius 34207151Smariusstatic __inline u_int32_t 35207151Smarius__fpu_getreg(int r) 36207151Smarius{ 37207151Smarius 38207151Smarius return (__fpreg[r]); 39207151Smarius} 40207151Smarius 41207151Smariusstatic __inline u_int64_t 42207151Smarius__fpu_getreg64(int r) 43207151Smarius{ 44207151Smarius 45207151Smarius return ((u_int64_t)__fpreg[r] << 32 | (u_int64_t)__fpreg[r + 1]); 46207151Smarius} 47207151Smarius 48207151Smariusstatic __inline void 49207151Smarius__fpu_setreg(int r, u_int32_t v) 50207151Smarius{ 51207151Smarius 52207151Smarius __fpreg[r] = v; 53207151Smarius} 54207151Smarius 55207151Smariusstatic __inline void 56207151Smarius__fpu_setreg64(int r, u_int64_t v) 57207151Smarius{ 58207151Smarius 59207151Smarius __fpreg[r] = (u_int32_t)(v >> 32); 60207151Smarius __fpreg[r + 1] = (u_int32_t)v; 61207151Smarius} 62207151Smarius 63207151Smarius#endif /* _TESTFLOAT_SPARC64_FPU_REG_H_ */ 64