Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / include / cpu_interface.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: cpu_interface.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//
25// File: cpu_interface.h
26//
27// Copyright (C) 2005 Sun Microsystems, Inc.
28// All rights reserved.
29//
30
31#ifndef _CPU_INTERFACE_H
32#define _CPU_INTERFACE_H
33
34
35#include <thread.h>
36#include "mem.h"
37#include "vcpu.h"
38#include "vtracer.h"
39
40
41// This file contains interface for the cpu shared
42// library module
43
44
45
46// Cpu module may have a few cpu, each cpu may have
47// a few cores, each core may have a few strands.
48// Cpu cores could run on separate threads
49// of the host machine.
50
51
52// global vcpu table
53extern Vcpu *g_vcpu[NCPU_MAX];
54extern int g_nvcpu; // total number of vcpu's
55extern int g_vcpu_id_max; // max vcpu index
56
57extern VCPU_ExInterface g_cpu_ex_intf;
58
59
60// cofiguration parameters
61int set_param ( int cpu_id, char *param_name );
62int set_param ( char *name_value, VCPU_Config *config );
63char *get_param ( int cpu_id, char *param_name );
64void set_default ( VCPU_Config &config );
65
66
67
68extern int volatile cpu_enabled[];
69
70// Vcpu constructor routines
71Vcpu* create_cpu
72(
73 char *path, // library path
74 char *pconfig, // config line with name=value pairs
75 VCPU_ImpIntf *intf, // cpu imported interface
76 int version = 1 // cpu lib version number
77);
78
79Vcpu* create_cpu
80(
81 char *path, // library path
82 VCPU_Config &config_info, // cpu config params
83 VCPU_ImpIntf *intf, // cpu imported interface
84 int version = 1 // cpu lib version number
85);
86
87
88extern int cpu_set_breakpoint ( int cpu_id, VCPU_BpType type, uint64_t addr );
89extern int cpu_remove_breakpoint ( int cpu_id, VCPU_BpType type, uint64_t addr );
90extern int cpu_read_register_name( char *cmd );
91
92extern int disassemble ( uint32_t iw, uint64_t addr, char *line, int line_size);
93
94extern char *get_pr_name (uint_t i);
95extern char *get_hpr_name (uint_t i);
96extern char *get_asr_name (uint_t i);
97extern char *get_ireg_name (uint_t i);
98
99
100inline Vcpu * get_vcpu(int id)
101{
102 if(id < NCPU_MAX)
103 return g_vcpu[id];
104 return NULL;
105}
106
107
108
109
110
111
112#endif // _CPU_INTERFACE_H