tstate.h revision 88631
1696Ssundar/*- 2696Ssundar * Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved. 3696Ssundar * 4877Sattila * Redistribution and use in source and binary forms, with or without 5696Ssundar * modification, are permitted provided that the following conditions 6696Ssundar * are met: 7696Ssundar * 1. Redistributions of source code must retain the above copyright 8877Sattila * notice, this list of conditions and the following disclaimer. 9696Ssundar * 2. Redistributions in binary form must reproduce the above copyright 10696Ssundar * notice, this list of conditions and the following disclaimer in the 11696Ssundar * documentation and/or other materials provided with the distribution. 12696Ssundar * 13696Ssundar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14877Sattila * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15696Ssundar * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16696Ssundar * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17696Ssundar * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18877Sattila * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19696Ssundar * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20696Ssundar * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21696Ssundar * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 22696Ssundar * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23696Ssundar * 24696Ssundar * $FreeBSD: head/sys/sparc64/include/tstate.h 88631 2001-12-29 07:11:00Z jake $ 25696Ssundar */ 26696Ssundar 27696Ssundar#ifndef _MACHINE_TSTATE_H_ 28696Ssundar#define _MACHINE_TSTATE_H_ 29696Ssundar 30696Ssundar#include <machine/pstate.h> 31696Ssundar#include <machine/ccr.h> 32696Ssundar 33696Ssundar#define TSTATE_CWP_SHIFT 0 34#define TSTATE_CWP_BITS 5 35#define TSTATE_CWP_MASK \ 36 (((1 << TSTATE_CWP_BITS) - 1) << TSTATE_CWP_SHIFT) 37#define TSTATE_CWP(x) ((x & TSTATE_CWP_MASK) >> TSTATE_CWP_SHIFT) 38 39#define TSTATE_PSTATE_SHIFT 8 40#define TSTATE_PSTATE_BITS 12 41#define TSTATE_PSTATE_MASK \ 42 (((1 << TSTATE_PSTATE_BITS) - 1) << TSTATE_PSTATE_SHIFT) 43#define TSTATE_PSTATE(x) ((x) << TSTATE_PSTATE_SHIFT) 44#define TSTATE_AG TSTATE_PSTATE(PSTATE_AG) 45#define TSTATE_IE TSTATE_PSTATE(PSTATE_IE) 46#define TSTATE_PRIV TSTATE_PSTATE(PSTATE_PRIV) 47#define TSTATE_AM TSTATE_PSTATE(PSTATE_AM) 48#define TSTATE_PEF TSTATE_PSTATE(PSTATE_PEF) 49#define TSTATE_RED TSTATE_PSTATE(PSTATE_RED) 50#define TSTATE_MM_TSO TSTATE_PSTATE(PSTATE_MM_TSO) 51#define TSTATE_MM_PSO TSTATE_PSTATE(PSTATE_MM_PSO) 52#define TSTATE_MM_RMO TSTATE_PSTATE(PSTATE_MM_RMO) 53#define TSTATE_TLE TSTATE_PSTATE(PSTATE_TLE) 54#define TSTATE_CLE TSTATE_PSTATE(PSTATE_CLE) 55#define TSTATE_MG TSTATE_PSTATE(PSTATE_MG) 56#define TSTATE_IG TSTATE_PSTATE(PSTATE_IG) 57 58#define TSTATE_ASI_SHIFT 24 59#define TSTATE_ASI_BITS 8 60#define TSTATE_ASI_MASK \ 61 (((1 << TSTATE_ASI_BITS) - 1) << TSTATE_ASI_SHIFT) 62#define TSTATE_ASI(x) ((x & TSTATE_ASI_MASK) >> TSTATE_ASI_SHIFT) 63 64#define TSTATE_CCR_SHIFT 32 65#define TSTATE_ICC_SHIFT (TSTATE_CCR_SHIFT + ICC_SHIFT) 66#define TSTATE_ICC_MASK (ICC_MASK << TSTATE_CCR_SHIFT) 67#define TSTATE_XCC_SHIFT (TSTATE_CCR_SHIFT + XCC_SHIFT) 68#define TSTATE_XCC_MASK (XCC_MASK << TSTATE_CCR_SHIFT) 69#define TSTATE_CCR(x) ((x) << TSTATE_CCR_SHIFT) 70#define TSTATE_ICC_C TSTATE_CCR(ICC_C) 71#define TSTATE_ICC_V TSTATE_CCR(ICC_V) 72#define TSTATE_ICC_Z TSTATE_CCR(ICC_Z) 73#define TSTATE_ICC_N TSTATE_CCR(ICC_N) 74#define TSTATE_XCC_C TSTATE_CCR(XCC_C) 75#define TSTATE_XCC_V TSTATE_CCR(XCC_V) 76#define TSTATE_XCC_Z TSTATE_CCR(XCC_Z) 77#define TSTATE_XCC_N TSTATE_CCR(XCC_N) 78 79#define TSTATE_SECURE(tstate) \ 80 PSTATE_SECURE(((tstate) >> TSTATE_PSTATE_SHIFT) & ((1 << TSTATE_PSTATE_BITS) - 1)) 81 82#endif /* !_MACHINE_TSTATE_H_ */ 83