* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: SS_BreakPoint.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 ============================================
#ifndef __SS_BreakPoint_h__
#define __SS_BreakPoint_h__
extern "C" SS_Vaddr
run_exe_breakpoint( SS_Vaddr pc
, SS_Vaddr npc
, SS_Strand
* s
, SS_Instr
* i
);
class SS_BreakPoint
/*{{{*/
typedef uint_t Ident
; // Break point id type
ID_UNKNOWN
// Specified breakpoint id is unknown
SS_BreakPoint( Break _type
, SS_BreakPoint
* _next
=0 );
Break type
; // The type of the breakpoint
Ident id
; // The id of this breakpoint
bool enabled
; // Whether the breakpoint is enabled or not
bool triggered
; // Whether the breakpoint triggered a break or not
SS_BreakPoint
* next
; // Next breakpoint in the list of allocated breakpoints
SS_BreakPoint
* link
; // Next breakpoint in the link
bool trigger( SS_Strand
* s
);
void unlink( SS_BreakPoint
** root
);
SS_Instr inst
; // The original instruction once breakpoint has been inserted
SS_Vaddr va
; // The virtual address that causes the breakpoint match
SS_Paddr pa
; // The physical address that causes the breakpoint match
SS_Trap::Type tt
; // trap type for trap breakpoints
void insert( SS_Instr
* i
) // Insert this breakpoint in instruction i
orig
= i
; // Keep this method inline to avoid a call & save/restore
inst
.exe
= i
->exe
; // Copy fields individually ... instr cache striping
i
->exe
= run_exe_breakpoint
;
void remove(); // Remove this breakpoint on instruction
static BL_Mutex id_mutex
;
SS_Instr
* orig
; // The original place of breakpoint insertion
class SS_BreakTrap
: public SS_BreakPoint
/*{{{*/
SS_BreakTrap( SS_Trap::Type _tt
, SS_BreakPoint
* _next
)
SS_BreakPoint(ON_TRAP
,_next
)
class SS_BreakRedMode
: public SS_BreakPoint
/*{{{*/
SS_BreakRedMode( SS_BreakPoint
* _next
) : SS_BreakPoint(ON_RED_MODE
,_next
) {}
class SS_BreakInstVa
: public SS_BreakPoint
/*{{{*/
SS_BreakInstVa( SS_Vaddr _va
, SS_BreakPoint
* _next
)
SS_BreakPoint(ON_INST_VA
,_next
)
// check_inst_va() checks is the va of the breakpoint matches
// the giving va hen both have been applied to the mask first.
bool check_inst_va( SS_Vaddr mask
, SS_Vaddr _va
)
assert(type
== ON_INST_VA
);
return enabled
&& ((va
& mask
) == (_va
& mask
));
bool break_inst_va( SS_Strand
* strand
, SS_Vaddr _va
)
assert(type
== ON_INST_VA
);
return enabled
&& (va
== _va
) && trigger(strand
);