Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / legion / src / include / breakpoint.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: breakpoint.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 2007 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28#ifndef _BREAKPOINT_H_
29#define _BREAKPOINT_H_
30
31#pragma ident "@(#)breakpoint.h 1.7 07/05/30 SMI"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#define BREAK_HASH_BITS 4
38#define BREAK_HASH_SIZE (1<<BREAK_HASH_BITS)
39#define BREAK_HASH_MASK (BREAK_HASH_SIZE-1)
40
41
42struct BP_INFO {
43 breakpoint_t *hash[BREAK_HASH_SIZE];
44
45 int next_id;
46 breakpoint_t *free_listp;
47 int active_count;
48 breakpoint_t *active_listp;
49 int disabled_count;
50 breakpoint_t *disabled_listp;
51
52 int do_step;
53 int on_this;
54};
55
56struct BREAKPOINT {
57 uint64_t pc;
58 uint32_t context;
59 bool_t enabled;
60 bool_t first_strike;
61 int id;
62 breakpoint_t *free_nextp;
63 breakpoint_t *active_nextp;
64 breakpoint_t *disabled_nextp;
65 breakpoint_t *hash_nextp;
66};
67
68
69 /*
70 * for the moment use a global to indicate system wide
71 * breakpoints ... will go away when we define multiple
72 * systems.
73 */
74
75typedef enum {
76 NOTHING, ON_BREAKPOINT
77} breakpoint_check_code_t;
78
79
80 /*
81 * FIXME: eventually blaze will understand different
82 * MMU translation contexts - ultimately this will
83 * morph into thread ids .... so we can properly
84 * debug this stuff ..
85 */
86#define DEFAULT_BP_CONTEXT 0
87
88
89 /*
90 * FIXME - need to decide if breakpoints are global
91 * or isolated to certian cpus, or both ?
92 */
93
94extern bp_info_t *system_breakpointsp;
95
96
97 /* Internal breakpoint manipulation interface */
98extern bp_info_t *breakpoint_init();
99extern breakpoint_t *breakpoint_insert(bp_info_t *bip, tvaddr_t pc,
100 int context);
101extern void breakpoint_insert_next(bp_info_t *bip);
102extern void breakpoint_clear_next(bp_info_t *bip);
103extern int breakpoint_delete_by_id(bp_info_t *bip, int id);
104extern breakpoint_t *breakpoint_find_by_addr(bp_info_t *bip, uint64_t addr,
105 int context);
106extern int breakpoint_delete_by_addr(bp_info_t *bip, uint64_t addr,
107 int context);
108extern int breakpoint_disable_by_id(bp_info_t *bip, int id);
109extern int breakpoint_enable_by_id(bp_info_t *bip, int id);
110extern bool_t breakpoint_any_reached(void);
111
112
113
114
115 /* Blaze UI calls for breakpoint stuff */
116extern bool_t breakpoint_parse_command(bp_info_t *bip, char *args,
117 char *stage_name /* default: NULL */);
118extern void breakpoint_print(bp_info_t *);
119extern bool_t breakpoint_dump(bp_info_t *, FILE *);
120extern bool_t breakpoint_restore(bp_info_t *, FILE *);
121
122extern breakpoint_check_code_t breakpoint_check(bp_info_t *bip, uint64_t pc,
123 int context, breakpoint_t **bpp);
124
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* !_BREAKPOINT_H_ */