Commit | Line | Data |
---|---|---|
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 | |
30 | extern "C" { | |
31 | #endif | |
32 | ||
33 | int getIHash(unsigned instr); | |
34 | ||
35 | size_t getMemsize(int ih); | |
36 | ||
37 | // These routines assume 64bit addresses | |
38 | void fprintDis(FILE* fp, unsigned instr, uint64_t pc); | |
39 | void fprintDiss(FILE* fp, unsigned instr, uint64_t pc); | |
40 | void sprintDis(char* str, unsigned instr, uint64_t pc); | |
41 | void sprintDiss(char* str, unsigned instr, uint64_t pc); | |
42 | ||
43 | uint64_t getCtiEa(unsigned instr, int ih, uint64_t pc); | |
44 | ||
45 | // These routines assume 32bit addresses | |
46 | void fprintDis32(FILE* fp, unsigned instr, uint32_t pc); | |
47 | void fprintDiss32(FILE* fp, unsigned instr, uint32_t pc); | |
48 | void sprintDis32(char* buf, unsigned instr, uint32_t pc); | |
49 | void sprintDiss32(char* buf, unsigned instr, uint32_t pc); | |
50 | ||
51 | uint32_t getCtiEa32(unsigned instr, int ih, uint32_t pc); | |
52 | ||
53 | void fprintIopName(FILE* fp, int ih); | |
54 | ||
55 | void sprintIopName(char* str, int ih); | |
56 | ||
57 | int64_t signExt(int64_t disp, int bits); | |
58 | ||
59 | extern const char *const aszIopNames[]; | |
60 | ||
61 | // From Spix 5 instr.c and sdas.c | |
62 | #define ihash_names aszIopNames; // opcode names | |
63 | ||
64 | int sdasi(char* s, unsigned i, uint64_t pc); | |
65 | ||
66 | #ifdef __cplusplus | |
67 | } | |
68 | #endif | |
69 | ||
70 | #endif // _MISC_H |