Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / include / MISC.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: MISC.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 _MISC_H
#define _MISC_H
#include <sys/types.h>
#include <IHASH.h>
#ifdef __cplusplus
extern "C" {
#endif
int getIHash(unsigned instr);
size_t getMemsize(int ih);
// These routines assume 64bit addresses
void fprintDis(FILE* fp, unsigned instr, uint64_t pc);
void fprintDiss(FILE* fp, unsigned instr, uint64_t pc);
void sprintDis(char* str, unsigned instr, uint64_t pc);
void sprintDiss(char* str, unsigned instr, uint64_t pc);
uint64_t getCtiEa(unsigned instr, int ih, uint64_t pc);
// These routines assume 32bit addresses
void fprintDis32(FILE* fp, unsigned instr, uint32_t pc);
void fprintDiss32(FILE* fp, unsigned instr, uint32_t pc);
void sprintDis32(char* buf, unsigned instr, uint32_t pc);
void sprintDiss32(char* buf, unsigned instr, uint32_t pc);
uint32_t getCtiEa32(unsigned instr, int ih, uint32_t pc);
void fprintIopName(FILE* fp, int ih);
void sprintIopName(char* str, int ih);
int64_t signExt(int64_t disp, int bits);
extern const char *const aszIopNames[];
// From Spix 5 instr.c and sdas.c
#define ihash_names aszIopNames; // opcode names
int sdasi(char* s, unsigned i, uint64_t pc);
#ifdef __cplusplus
}
#endif
#endif // _MISC_H