Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / legion / src / procs / sparcv9 / include / magictraps.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: magictraps.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MAGICTRAPS_H
#define _MAGICTRAPS_H
#pragma ident "@(#)magictraps.h 1.4 06/10/27 SMI"
#ifdef __cplusplus
extern "C" {
#endif
#if ENABLE_MAGIC_TRAPS /* { */
#define MAGIC_TRAP_SETDBG 0x70
#define MAGIC_TRAP_SIMEXIT 0x71
#define MAGIC_TRAP_GOT_HERE 0x72
#define MAGIC_TRAP_LOG_DUMP 0x74
#define MAGIC_TRAP_PABCOPY 0x75
#define MAGIC_TRAP_INST_CNT 0x76
#define MAGIC_TRAP_ALLDBG 0x77
#define MAGIC_TRAP_NO_DBG 0x78
#define MAGIC_TRAP_SAVE_STATE 0x79
#define MAGIC_TRAP_START 0x70
#define MAGIC_TRAP_END 0x79
/* Bits in %o0 for MAGIC_TRAP_INST_CNT: */
#define MT_INST_CNT_SET_PREV 1LL /* Set previous count from ICOUNT */
#define MT_INST_CNT_PRINT 2LL /* Print current and delta counts */
extern bool_t ss_magic_trap(simcpu_t *, uint32_t);
/*
* Test the value of the condition code field for
* magic traps - '== 0' for %icc, '!= 0' for %xcc or
* '(true)' for don't care.
*/
#define SS_MAGIC_TRAP_CC(_cc) ((_cc) != 0)
/*
* Main trap number test, including overall enable.
* Final filtering is done in ss_magic_trap() which
* also performs the magic function requested.
*/
#define SS_MAGIC_TRAP(_sp, _tt) (options.magic_traps && \
(_tt) >= MAGIC_TRAP_START && (_tt) <= MAGIC_TRAP_END && \
ss_magic_trap((_sp), (_tt)))
#else /* } { */
#define SS_MAGIC_TRAP_CC(_cc) (false)
#define SS_MAGIC_TRAP(_sp, _tt) (false)
#endif /* } */
#ifdef __cplusplus
}
#endif
#endif /* _MAGICTRAPS_H */