mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-05 21:50:21 +08:00
Define SIGNED64 and UNSIGNED64 macros - handle MSC/GCC LL issue.
This commit is contained in:
@ -1,3 +1,17 @@
|
||||
Fri Sep 5 08:39:02 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim-alu.h (ALU64_ADD): Use explicit MSEXTRACTED64, do not assume
|
||||
bit endianness.
|
||||
(SIGNED64, UNSIGNED64): Delete.
|
||||
(ALU64_ADD): Don't rely on bit endianness.
|
||||
(ALU64_BEGIN): Define.
|
||||
|
||||
* sim-n-bits.h (MSEXTRACTEDn, LSEXTRACTED): New functions.
|
||||
(EXTRACTEDn): Delete, define as either LSEXTRACTED or MSEXTRACTED.
|
||||
|
||||
* sim-types.h (SIGNED64, UNSIGNED64): New macros, attach relevant
|
||||
suffix - u64, LL - to 64 bit constants.
|
||||
|
||||
Thu Sep 4 09:27:54 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim-config.c (sim_config): Add assert for SIM_MAGIC_NUMBER.
|
||||
|
@ -62,11 +62,6 @@
|
||||
values */
|
||||
|
||||
|
||||
/* Macro's to type cast 32bit constants to 64bits */
|
||||
#define SIGNED64(val) ((signed64)(signed32)(val))
|
||||
#define UNSIGNED64(val) ((unsigned64)(unsigned32)(val))
|
||||
|
||||
|
||||
/* Start a section of ALU code */
|
||||
|
||||
#define ALU16_BEGIN(VAL) \
|
||||
@ -82,6 +77,14 @@
|
||||
signed64 alu_overflow_val; \
|
||||
ALU32_SET(VAL)
|
||||
|
||||
#define ALU64_BEGIN(VAL) \
|
||||
{ \
|
||||
natural64 alu_val; \
|
||||
unsigned64 alu_carry_val; \
|
||||
signed64 alu_overflow_val; \
|
||||
ALU64_SET(VAL)
|
||||
|
||||
|
||||
#define ALU_BEGIN(VAL) XCONCAT3(ALU,WITH_TARGET_WORD_BITSIZE,_BEGIN)(VAL)
|
||||
|
||||
/* More basic alu operations */
|
||||
@ -128,14 +131,14 @@ do { \
|
||||
|
||||
#define ALU64_ADD(VAL) \
|
||||
do { \
|
||||
unsigned64 alu_lo = (UNSIGNED64(alu_val) \
|
||||
+ UNSIGNED64(VAL)); \
|
||||
signed alu_carry = ((alu_lo & BIT(31)) != 0); \
|
||||
unsigned64 val = (VAL); \
|
||||
unsigned64 alu_lo = alu_val + val); \
|
||||
signed alu_carry = ((alu_lo & LSBIT64 (31)) != 0); \
|
||||
alu_carry_val = (alu_carry_val \
|
||||
+ UNSIGNED64(EXTRACTED(val, 0, 31)) \
|
||||
+ MSEXTRACTED64 (val, 0, 31) \
|
||||
+ alu_carry); \
|
||||
alu_overflow_val = (alu_overflow_val \
|
||||
+ SIGNED64(EXTRACTED(val, 0, 31)) \
|
||||
+ MSEXTRACTED64 (val, 0, 31) \
|
||||
+ alu_carry); \
|
||||
alu_val = alu_val + val; \
|
||||
} while (0)
|
||||
|
@ -39,6 +39,9 @@
|
||||
architectures ignoring the first 32bits leaving bit 32 as the most
|
||||
significant.
|
||||
|
||||
NB: Use EXTRACTED, MSEXTRACTED and LSEXTRACTED as a guideline for
|
||||
naming. LSMASK and LSMASKED are wrong.
|
||||
|
||||
BIT*(POS): Constant with just 1 bit set.
|
||||
|
||||
LSBIT*(OFFSET): Constant with just 1 bit set - LS bit is zero.
|
||||
@ -66,6 +69,12 @@
|
||||
also right shifts the masked value so that bit LAST becomes the
|
||||
least significant (right most).
|
||||
|
||||
LSEXTRACTED*(VALUE, FIRST, LAST): Same as extracted - LS bit is
|
||||
zero.
|
||||
|
||||
MSEXTRACTED*(VALUE, FIRST, LAST): Same as extracted - MS bit is
|
||||
zero.
|
||||
|
||||
SHUFFLED**(VALUE, OLD, NEW): Mask then move a single bit from OLD
|
||||
new NEW.
|
||||
|
||||
@ -377,9 +386,26 @@ INLINE_SIM_BITS(unsigned_word) MSMASKED (unsigned_word word, unsigned nr_bits);
|
||||
|
||||
/* extract the required bits aligning them with the lsb */
|
||||
|
||||
INLINE_SIM_BITS(unsigned16) EXTRACTED16 (unsigned16 val, unsigned start, unsigned stop);
|
||||
INLINE_SIM_BITS(unsigned32) EXTRACTED32 (unsigned32 val, unsigned start, unsigned stop);
|
||||
INLINE_SIM_BITS(unsigned64) EXTRACTED64 (unsigned64 val, unsigned start, unsigned stop);
|
||||
INLINE_SIM_BITS(unsigned16) LSEXTRACTED16 (unsigned16 val, unsigned start, unsigned stop);
|
||||
INLINE_SIM_BITS(unsigned32) LSEXTRACTED32 (unsigned32 val, unsigned start, unsigned stop);
|
||||
INLINE_SIM_BITS(unsigned64) LSEXTRACTED64 (unsigned64 val, unsigned start, unsigned stop);
|
||||
|
||||
INLINE_SIM_BITS(unsigned16) MSEXTRACTED16 (unsigned16 val, unsigned start, unsigned stop);
|
||||
INLINE_SIM_BITS(unsigned32) MSEXTRACTED32 (unsigned32 val, unsigned start, unsigned stop);
|
||||
INLINE_SIM_BITS(unsigned64) MSEXTRACTED64 (unsigned64 val, unsigned start, unsigned stop);
|
||||
|
||||
#if (WITH_TARGET_WORD_MSB == 0)
|
||||
#define EXTRACTED16 MSEXTRACTED32
|
||||
#define EXTRACTED32 MSEXTRACTED32
|
||||
#define EXTRACTED64 MSEXTRACTED32
|
||||
#else
|
||||
#define EXTRACTED16 LSEXTRACTED32
|
||||
#define EXTRACTED32 LSEXTRACTED32
|
||||
#define EXTRACTED64 LSEXTRACTED32
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
INLINE_SIM_BITS(unsigned_word) EXTRACTED (unsigned_word val, unsigned start, unsigned stop);
|
||||
|
||||
|
@ -408,7 +408,7 @@ sim_core_map_detach (SIM_DESC sd,
|
||||
entry = &(*entry)->next)
|
||||
{
|
||||
if ((*entry)->base == addr
|
||||
&& (*entry)->level == attach
|
||||
&& (*entry)->level == (int) attach
|
||||
&& (*entry)->space == space)
|
||||
{
|
||||
sim_core_mapping *dead = (*entry);
|
||||
|
@ -42,7 +42,8 @@
|
||||
#define LSMASKn XCONCAT2(LSMASK,N)
|
||||
#define MSMASKEDn XCONCAT2(MSMASKED,N)
|
||||
#define MSMASKn XCONCAT2(MSMASK,N)
|
||||
#define EXTRACTEDn XCONCAT2(EXTRACTED,N)
|
||||
#define LSEXTRACTEDn XCONCAT2(LSEXTRACTED,N)
|
||||
#define MSEXTRACTEDn XCONCAT2(MSEXTRACTED,N)
|
||||
#define INSERTEDn XCONCAT2(INSERTED,N)
|
||||
#define ROTn XCONCAT2(ROT,N)
|
||||
#define ROTLn XCONCAT2(ROTL,N)
|
||||
@ -80,16 +81,29 @@ MSMASKEDn (unsignedN word,
|
||||
return (word & MSMASKn (nr_bits));
|
||||
}
|
||||
|
||||
/* TAGS: EXTRACTED16 EXTRACTED32 EXTRACTED64 */
|
||||
/* TAGS: LSEXTRACTED16 LSEXTRACTED32 LSEXTRACTED64 */
|
||||
|
||||
INLINE_SIM_BITS\
|
||||
(unsignedN)
|
||||
EXTRACTEDn (unsignedN val,
|
||||
unsigned start,
|
||||
unsigned stop)
|
||||
LSEXTRACTEDn (unsignedN val,
|
||||
unsigned start,
|
||||
unsigned stop)
|
||||
{
|
||||
val <<= _MSB_SHIFT (N, start);
|
||||
val >>= (_MSB_SHIFT (N, start) + _LSB_SHIFT (N, stop));
|
||||
val <<= (N - 1 - start); /* drop high bits */
|
||||
val >>= (N - 1 - start) + (stop); /* drop low bits */
|
||||
return val;
|
||||
}
|
||||
|
||||
/* TAGS: MSEXTRACTED16 MSEXTRACTED32 MSEXTRACTED64 */
|
||||
|
||||
INLINE_SIM_BITS\
|
||||
(unsignedN)
|
||||
MSEXTRACTEDn (unsignedN val,
|
||||
unsigned start,
|
||||
unsigned stop)
|
||||
{
|
||||
val <<= (start); /* drop high bits */
|
||||
val >>= (start) + (N - 1 - stop); /* drop low bits */
|
||||
return val;
|
||||
}
|
||||
|
||||
@ -169,7 +183,8 @@ SEXTn (signedN val,
|
||||
#undef ROTRn
|
||||
#undef ROTn
|
||||
#undef INSERTEDn
|
||||
#undef EXTRACTEDn
|
||||
#undef LSEXTRACTEDn
|
||||
#undef MSEXTRACTEDn
|
||||
#undef LSMASKEDn
|
||||
#undef LSMASKn
|
||||
#undef MSMASKEDn
|
||||
|
139
sim/common/sim-types.h
Normal file
139
sim/common/sim-types.h
Normal file
@ -0,0 +1,139 @@
|
||||
/* This file is part of psim (model of the PowerPC(tm) architecture)
|
||||
|
||||
Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
|
||||
Copyright (C) 1997, Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License
|
||||
as published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
--
|
||||
|
||||
PowerPC is a trademark of International Business Machines Corporation. */
|
||||
|
||||
|
||||
/* Basic type sizes for the PowerPC */
|
||||
|
||||
#ifndef _SIM_TYPES_H_
|
||||
#define _SIM_TYPES_H_
|
||||
|
||||
|
||||
|
||||
|
||||
/* INTEGER QUANTITIES:
|
||||
|
||||
TYPES:
|
||||
|
||||
natural* sign determined by host
|
||||
signed* signed type of the given size
|
||||
unsigned* The corresponding insigned type
|
||||
|
||||
SIZES
|
||||
|
||||
*NN Size based on the number of bits
|
||||
*_NN Size according to the number of bytes
|
||||
*_word Size based on the target architecture's word
|
||||
word size (32/64 bits)
|
||||
*_cell Size based on the target architecture's
|
||||
IEEE 1275 cell size (almost always 32 bits)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* bit based */
|
||||
typedef char natural8;
|
||||
typedef short natural16;
|
||||
typedef long natural32;
|
||||
|
||||
typedef signed char signed8;
|
||||
typedef signed short signed16;
|
||||
typedef signed long signed32;
|
||||
|
||||
typedef unsigned char unsigned8;
|
||||
typedef unsigned short unsigned16;
|
||||
typedef unsigned long unsigned32;
|
||||
|
||||
#if defined __GNUC__ || defined _WIN32
|
||||
#ifdef __GNUC__
|
||||
|
||||
typedef long long natural64;
|
||||
typedef signed long long signed64;
|
||||
typedef unsigned long long unsigned64;
|
||||
|
||||
#define UNSIGNED64(X) (X##ULL)
|
||||
#define SIGNED64(X) (X##LL)
|
||||
|
||||
#define UNSIGNED32(X) (X##UL)
|
||||
#define SIGNED32(X) (X##L)
|
||||
|
||||
#else /* _WIN32 */
|
||||
|
||||
typedef __int64 natural64;
|
||||
typedef signed __int64 signed64;
|
||||
typedef unsigned __int64 unsigned64;
|
||||
|
||||
#define UNSIGNED64(X) (X##ui64)
|
||||
#define SIGNED64(X) (X##i64)
|
||||
|
||||
#define SIGNED32(X) (X)
|
||||
#define UNSIGNED32(X) (X)
|
||||
|
||||
#endif /* _WIN32 */
|
||||
#else /* Not GNUC or WIN32 */
|
||||
/* Not supported */
|
||||
#endif
|
||||
|
||||
/* byte based */
|
||||
typedef natural8 natural_1;
|
||||
typedef natural16 natural_2;
|
||||
typedef natural32 natural_4;
|
||||
typedef natural64 natural_8;
|
||||
|
||||
typedef signed8 signed_1;
|
||||
typedef signed16 signed_2;
|
||||
typedef signed32 signed_4;
|
||||
typedef signed64 signed_8;
|
||||
|
||||
typedef unsigned8 unsigned_1;
|
||||
typedef unsigned16 unsigned_2;
|
||||
typedef unsigned32 unsigned_4;
|
||||
typedef unsigned64 unsigned_8;
|
||||
|
||||
|
||||
/* for general work, the following are defined */
|
||||
/* unsigned: >= 32 bits */
|
||||
/* signed: >= 32 bits */
|
||||
/* long: >= 32 bits, sign undefined */
|
||||
/* int: small indicator */
|
||||
|
||||
/* target architecture based */
|
||||
#if (WITH_TARGET_WORD_BITSIZE == 64)
|
||||
typedef natural64 natural_word;
|
||||
typedef unsigned64 unsigned_word;
|
||||
typedef signed64 signed_word;
|
||||
#else
|
||||
typedef natural32 natural_word;
|
||||
typedef unsigned32 unsigned_word;
|
||||
typedef signed32 signed_word;
|
||||
#endif
|
||||
|
||||
|
||||
/* Other instructions */
|
||||
typedef unsigned32 address_word;
|
||||
|
||||
/* IEEE 1275 cell size - only support 32bit mode at present */
|
||||
typedef natural32 natural_cell;
|
||||
typedef unsigned32 unsigned_cell;
|
||||
typedef signed32 signed_cell;
|
||||
|
||||
#endif /* _SIM_TYPES_H_ */
|
@ -1,3 +1,7 @@
|
||||
Fri Sep 5 10:21:48 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* Makefile.in (SIM_OBJS): Add sim-memopt.o module.
|
||||
|
||||
Thu Sep 4 10:30:02 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim-if.c (sim_open): Pass zero modulo arg to sim_core_attach.
|
||||
|
Reference in New Issue
Block a user