* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: SS_VirtualStrand.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_VirtualStrand_h__
#define __SS_VirtualStrand_h__
#include "SS_SamTracer.h"
class SS_SamTracer
; // forward declaration
class SS_VirtualStrand
: public Sam::Vcpu
config
.delay
-= n
; // skip n instructions
else // step n instruction
int ii
= n
- config
.delay
;
// strand will not increments tick/stick after every step
if(sys_intf
.vtrace
) // tracer is enabled
strand
->add_tracer(&tracer
);
ret
= strand
->trc_step(ii
);
strand
->del_tracer(&tracer
);
else if (strand
->trc_hook
|| strand
->sim_state
.ras_enabled())
ret
= strand
->trc_step(ii
);
ret
= strand
->run_step(ii
);
void update_stick(int64_t stickincr
)
strand
->run_tick(stickincr
);
virtual void update_perfcntr (Sam::Vcpu::perfcntr which
, int64_t incr
)
strand
->run_perf(strand
, which
, incr
); // performance instrumentation counters
int interrupt( Sam::VCPU_InterruptRequest
* );
RegError
get_reg_index( const char* reg_name
, RegIndex
* index
)
for (int i
=SS_Registers::INDEX_BEGIN
; i
< SS_Registers::ALIAS_END
; i
++)
// First check all the alias names like pc for asr5, etc
// If reg_name is not an alias then check if it is say asr5
const char* name
= get_reg_name(i
);
if (strcmp(reg_name
,name
) == 0)
else if (strcmp(reg_name
,SS_Registers::get_name(SS_Registers::Index(i
))) == 0)
return REG_NOT_AVAILABLE
;
return REG_NOT_AVAILABLE
;
const char* get_reg_name( RegIndex index
)
return (strand
->get_state_name
)(strand
,SS_Registers::Index(index
));
RegError
get_reg( RegIndex index
, uint64_t* data
)
return RegError((strand
->get_state
)(strand
,SS_Registers::Index(index
),data
));
RegError
set_reg( RegIndex index
, uint64_t data
)
return RegError((strand
->set_state
)(strand
,SS_Registers::Index(index
),data
));
int get_asi(uint8_t asi
, uint64_t addr
, uint64_t &data
)
return (strand
->asi_map
.rd64( strand
, asi
, addr
, &data
)) != SS_AsiSpace::OK
;
int set_asi(uint8_t asi
, uint64_t addr
, uint64_t data
)
return (strand
->asi_map
.wr64( strand
, asi
, addr
, data
)) != SS_AsiSpace::OK
;
TranslateError
translate( TranslateMode mode
, uint64_t addr
, uint64_t context
, uint64_t partitionid
, uint64_t* phys_addr
)
return (strand
->cnv2pa
)(strand
,mode
,addr
,context
,partitionid
,phys_addr
);
int get_tlb_entries(struct Sam::TLBInfo
* &return_array
);
int read_mem ( uint64_t addr
, uint64_t *value
, int size
, int asi
= 0x82, int is_physical
=0 );
int write_mem ( uint64_t addr
, uint64_t value
, int size
, int asi
= 0x82, int is_physical
=0 );
int set_breakpoint ( int *bp_id
, Sam::VCPU_BpType type
, uint64_t value
,
Sam::VCPU_BpActionFn action
, uint64_t mask
= ~(uint64_t(0)));
int delete_breakpoint ( int bp_id
= ~(0) );
virtual int print_breakpoints ( FILE *fp
);
// print all regs to file/consol
virtual int print_regs ( FILE *fp
) { return 1; }
// print tlbs to file/consol
virtual int print_tlbs ( FILE *fp
);