* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: SS_Types.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 ============================================
// ptr_ofs() is used in the decode functions to get the offset from the
// strand pointer to a particular member, e.g. irf[rd] etc. Keep the
// result type an int32_t as the result is stored in a int16_t variable
#define ptr_ofs(type,member) int32_t((char*)&((type*)0)->member - (char*)0)
// For faster indexing into an array of pointers ... the CC compiler ain't that
// smart and produces unnecesary shift right (index) and shift left (index * size)
#define ptr_sft(s) ((s) - ((sizeof(void*) == 4) ? 2 : 3))
#define ptr_msk(m) ((m) << ((sizeof(void*) == 4) ? 2 : 3))
// Some very often used data types
typedef int64_t SS_Vaddr
; // VA's are signed, see VA hole implementation in N1, N2, etc.
typedef uint64_t SS_Paddr
;
typedef uint16_t SS_Context
;
typedef uint32_t SS_OpcWord
;
const SS_Vaddr SS_VADDR_MIN
= (SS_Vaddr(1) << 63);
const SS_Vaddr SS_VADDR_MAX
= ~SS_VADDR_MIN
;
extern "C" typedef SS_Vaddr (*SS_Decode
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
*, SS_OpcWord
);
extern "C" typedef SS_Vaddr (*SS_Execute
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
* );
extern "C" typedef SS_Vaddr (*SS_Memop
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
*, SS_Vaddr
, SS_Tte
* );
// Irf Ras error detection function for source regs
extern "C" typedef SS_Vaddr (*SS_RasIrfSrc
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
*, int);
// Irf Ras error injection function for dest regs
extern "C" typedef SS_Vaddr (*SS_RasIrfDst
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
*, int);
// Single precision Frf Ras error detection function for source regs
extern "C" typedef SS_Vaddr (*SS_RasFrfSrc
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
*, int);
// Single precision Frf Ras error injection function for dest regs
extern "C" typedef SS_Vaddr (*SS_RasFrfDst
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
*, int);
// Double precision Frf Ras error detection function for source regs
extern "C" typedef SS_Vaddr (*SS_RasDrfSrc
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
*, int);
// Double precision Frf Ras error injection function for dest regs
extern "C" typedef SS_Vaddr (*SS_RasDrfDst
)( SS_Vaddr
, SS_Vaddr
, SS_Strand
*, SS_Instr
*, int);
inline void *ss_malloc(size_t size
)
void* ptr
= malloc(size
);
inline void* ss_memalign(size_t alignment
, size_t size
)
void* ptr
= memalign(alignment
,size
);
// Unless SS_PRAY_MODE is #defined, these macros provide a degree of
// type safely if downcasting from a SS_Node* (or SS_Strand*). They
// are especially useful in ASI st64/ld64 routines.
#define SS_NODE_CAST(T,P) (T)(P)
#define SS_STRAND_CAST(T,P) (T)(P)
#define SS_NODE_CAST(T,P) dynamic_cast<T>(P)
#define SS_STRAND_CAST(T,P) (T)((*(uint64_t*)(P))!=0?0:(P))
#endif /* SS_PRAY_MODE */