Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / include / cpu_interface.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: cpu_interface.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 ============================================
*/
////////////////////////////////////////////////////////////
//
// File: cpu_interface.h
//
// Copyright (C) 2005 Sun Microsystems, Inc.
// All rights reserved.
//
#ifndef _CPU_INTERFACE_H
#define _CPU_INTERFACE_H
#include <thread.h>
#include "mem.h"
#include "vcpu.h"
#include "vtracer.h"
// This file contains interface for the cpu shared
// library module
// Cpu module may have a few cpu, each cpu may have
// a few cores, each core may have a few strands.
// Cpu cores could run on separate threads
// of the host machine.
// global vcpu table
extern Vcpu *g_vcpu[NCPU_MAX];
extern int g_nvcpu; // total number of vcpu's
extern int g_vcpu_id_max; // max vcpu index
extern VCPU_ExInterface g_cpu_ex_intf;
// cofiguration parameters
int set_param ( int cpu_id, char *param_name );
int set_param ( char *name_value, VCPU_Config *config );
char *get_param ( int cpu_id, char *param_name );
void set_default ( VCPU_Config &config );
extern int volatile cpu_enabled[];
// Vcpu constructor routines
Vcpu* create_cpu
(
char *path, // library path
char *pconfig, // config line with name=value pairs
VCPU_ImpIntf *intf, // cpu imported interface
int version = 1 // cpu lib version number
);
Vcpu* create_cpu
(
char *path, // library path
VCPU_Config &config_info, // cpu config params
VCPU_ImpIntf *intf, // cpu imported interface
int version = 1 // cpu lib version number
);
extern int cpu_set_breakpoint ( int cpu_id, VCPU_BpType type, uint64_t addr );
extern int cpu_remove_breakpoint ( int cpu_id, VCPU_BpType type, uint64_t addr );
extern int cpu_read_register_name( char *cmd );
extern int disassemble ( uint32_t iw, uint64_t addr, char *line, int line_size);
extern char *get_pr_name (uint_t i);
extern char *get_hpr_name (uint_t i);
extern char *get_asr_name (uint_t i);
extern char *get_ireg_name (uint_t i);
inline Vcpu * get_vcpu(int id)
{
if(id < NCPU_MAX)
return g_vcpu[id];
return NULL;
}
#endif // _CPU_INTERFACE_H