Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / include / MISC.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: MISC.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#ifndef _MISC_H
24#define _MISC_H
25
26#include <sys/types.h>
27#include <IHASH.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33int getIHash(unsigned instr);
34
35size_t getMemsize(int ih);
36
37// These routines assume 64bit addresses
38void fprintDis(FILE* fp, unsigned instr, uint64_t pc);
39void fprintDiss(FILE* fp, unsigned instr, uint64_t pc);
40void sprintDis(char* str, unsigned instr, uint64_t pc);
41void sprintDiss(char* str, unsigned instr, uint64_t pc);
42
43uint64_t getCtiEa(unsigned instr, int ih, uint64_t pc);
44
45// These routines assume 32bit addresses
46void fprintDis32(FILE* fp, unsigned instr, uint32_t pc);
47void fprintDiss32(FILE* fp, unsigned instr, uint32_t pc);
48void sprintDis32(char* buf, unsigned instr, uint32_t pc);
49void sprintDiss32(char* buf, unsigned instr, uint32_t pc);
50
51uint32_t getCtiEa32(unsigned instr, int ih, uint32_t pc);
52
53void fprintIopName(FILE* fp, int ih);
54
55void sprintIopName(char* str, int ih);
56
57int64_t signExt(int64_t disp, int bits);
58
59extern const char *const aszIopNames[];
60
61// From Spix 5 instr.c and sdas.c
62#define ihash_names aszIopNames; // opcode names
63
64int sdasi(char* s, unsigned i, uint64_t pc);
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif // _MISC_H