Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: magictraps.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | /* | |
24 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved. | |
25 | * Use is subject to license terms. | |
26 | */ | |
27 | ||
28 | #ifndef _MAGICTRAPS_H | |
29 | #define _MAGICTRAPS_H | |
30 | ||
31 | #pragma ident "@(#)magictraps.h 1.4 06/10/27 SMI" | |
32 | ||
33 | #ifdef __cplusplus | |
34 | extern "C" { | |
35 | #endif | |
36 | ||
37 | #if ENABLE_MAGIC_TRAPS /* { */ | |
38 | ||
39 | #define MAGIC_TRAP_SETDBG 0x70 | |
40 | #define MAGIC_TRAP_SIMEXIT 0x71 | |
41 | #define MAGIC_TRAP_GOT_HERE 0x72 | |
42 | #define MAGIC_TRAP_LOG_DUMP 0x74 | |
43 | #define MAGIC_TRAP_PABCOPY 0x75 | |
44 | #define MAGIC_TRAP_INST_CNT 0x76 | |
45 | #define MAGIC_TRAP_ALLDBG 0x77 | |
46 | #define MAGIC_TRAP_NO_DBG 0x78 | |
47 | #define MAGIC_TRAP_SAVE_STATE 0x79 | |
48 | ||
49 | #define MAGIC_TRAP_START 0x70 | |
50 | #define MAGIC_TRAP_END 0x79 | |
51 | ||
52 | /* Bits in %o0 for MAGIC_TRAP_INST_CNT: */ | |
53 | #define MT_INST_CNT_SET_PREV 1LL /* Set previous count from ICOUNT */ | |
54 | #define MT_INST_CNT_PRINT 2LL /* Print current and delta counts */ | |
55 | ||
56 | extern bool_t ss_magic_trap(simcpu_t *, uint32_t); | |
57 | ||
58 | /* | |
59 | * Test the value of the condition code field for | |
60 | * magic traps - '== 0' for %icc, '!= 0' for %xcc or | |
61 | * '(true)' for don't care. | |
62 | */ | |
63 | #define SS_MAGIC_TRAP_CC(_cc) ((_cc) != 0) | |
64 | ||
65 | /* | |
66 | * Main trap number test, including overall enable. | |
67 | * Final filtering is done in ss_magic_trap() which | |
68 | * also performs the magic function requested. | |
69 | */ | |
70 | #define SS_MAGIC_TRAP(_sp, _tt) (options.magic_traps && \ | |
71 | (_tt) >= MAGIC_TRAP_START && (_tt) <= MAGIC_TRAP_END && \ | |
72 | ss_magic_trap((_sp), (_tt))) | |
73 | ||
74 | #else /* } { */ | |
75 | ||
76 | #define SS_MAGIC_TRAP_CC(_cc) (false) | |
77 | #define SS_MAGIC_TRAP(_sp, _tt) (false) | |
78 | ||
79 | #endif /* } */ | |
80 | ||
81 | #ifdef __cplusplus | |
82 | } | |
83 | #endif | |
84 | ||
85 | #endif /* _MAGICTRAPS_H */ |