* [PATCH/committed] sim: ppc: drop natural types
@ 2022-01-01 18:32 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2022-01-01 18:32 UTC (permalink / raw)
To: gdb-patches
These are almost entirely unused. For the very few places using them,
replace with explicit signed types. This matches what was done in the
common sim code.
---
sim/ppc/bits.h | 6 +++---
sim/ppc/emul_netbsd.c | 12 ++++++------
sim/ppc/idecode_expression.h | 2 +-
sim/ppc/words.h | 21 ---------------------
4 files changed, 10 insertions(+), 31 deletions(-)
diff --git a/sim/ppc/bits.h b/sim/ppc/bits.h
index 58173f78cd5c..d3b765addb50 100644
--- a/sim/ppc/bits.h
+++ b/sim/ppc/bits.h
@@ -89,7 +89,7 @@
/* MakeBit */
-#define _BITn(WIDTH, pos) (((natural##WIDTH)(1)) \
+#define _BITn(WIDTH, pos) (((uint##WIDTH##_t)(1)) \
<< _MAKE_SHIFT(WIDTH, pos))
#define BIT4(POS) (1 << _MAKE_SHIFT(4, POS))
@@ -177,7 +177,7 @@ INLINE_BITS\
/* extract the required bits aligning them with the lsb */
#define _EXTRACTEDn(WIDTH, WORD, START, STOP) \
-((((natural##WIDTH)(WORD)) >> (WIDTH - (STOP) - 1)) \
+((((uint##WIDTH##_t)(WORD)) >> (WIDTH - (STOP) - 1)) \
& _MASKn(WIDTH, WIDTH-1+(START)-(STOP), WIDTH-1))
/* #define EXTRACTED10(WORD, START, STOP) _EXTRACTEDn(10, WORD, START, STOP) */
@@ -215,7 +215,7 @@ INLINE_BITS\
/* move a group of bits around */
#define _INSERTEDn(N, WORD, START, STOP) \
-(((natural##N)(WORD) << _MAKE_SHIFT(N, STOP)) & _MASKn(N, START, STOP))
+(((uint##N##_t)(WORD) << _MAKE_SHIFT(N, STOP)) & _MASKn(N, START, STOP))
#define INSERTED32(WORD, START, STOP) _INSERTEDn(32, WORD, START, STOP)
#define INSERTED64(WORD, START, STOP) _INSERTEDn(64, WORD, START, STOP)
diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c
index d1595c5985f1..322b584a3f13 100644
--- a/sim/ppc/emul_netbsd.c
+++ b/sim/ppc/emul_netbsd.c
@@ -631,7 +631,7 @@ do_sigprocmask(os_emul_data *emul,
cpu *processor,
unsigned_word cia)
{
- natural_word how = cpu_registers(processor)->gpr[arg0];
+ signed_word how = cpu_registers(processor)->gpr[arg0];
unsigned_word set = cpu_registers(processor)->gpr[arg0+1];
unsigned_word oset = cpu_registers(processor)->gpr[arg0+2];
#ifdef SYS_sigprocmask
@@ -1010,12 +1010,12 @@ do___sysctl(os_emul_data *emul,
{
/* call the arguments by their real name */
unsigned_word name = cpu_registers(processor)->gpr[arg0];
- natural_word namelen = cpu_registers(processor)->gpr[arg0+1];
+ signed_word namelen = cpu_registers(processor)->gpr[arg0+1];
unsigned_word oldp = cpu_registers(processor)->gpr[arg0+2];
unsigned_word oldlenp = cpu_registers(processor)->gpr[arg0+3];
- natural_word oldlen;
- natural_word mib;
- natural_word int_val;
+ signed_word oldlen;
+ signed_word mib;
+ signed_word int_val;
SYS(__sysctl);
/* pluck out the management information base id */
@@ -1049,7 +1049,7 @@ do___sysctl(os_emul_data *emul,
oldlenp,
processor,
cia);
- if (sizeof(natural_word) > oldlen)
+ if (sizeof(signed_word) > oldlen)
error("system_call()sysctl - CTL_HW.HW_PAGESIZE - to small\n");
int_val = 8192;
oldlen = sizeof(int_val);
diff --git a/sim/ppc/idecode_expression.h b/sim/ppc/idecode_expression.h
index 28d39a75ce6a..01b7ebb74a3b 100644
--- a/sim/ppc/idecode_expression.h
+++ b/sim/ppc/idecode_expression.h
@@ -65,7 +65,7 @@
#define ALU_BEGIN(val) \
{ \
- natural_word alu_val; \
+ signed_word alu_val; \
unsigned64 alu_carry_val; \
signed64 alu_overflow_val; \
ALU_SET(val)
diff --git a/sim/ppc/words.h b/sim/ppc/words.h
index 406bb1fdfaea..df9278ad1166 100644
--- a/sim/ppc/words.h
+++ b/sim/ppc/words.h
@@ -27,7 +27,6 @@
/* TYPES:
- natural* sign determined by host
signed* signed type of the given size
unsigned* The corresponding insigned type
@@ -49,18 +48,6 @@
#include <stdint.h>
/* bit based */
-typedef char natural8;
-typedef short natural16;
-typedef int natural32;
-
-#ifdef __GNUC__
-typedef long long natural64;
-#endif
-
-#ifdef _MSC_VER
-typedef __int64 natural64;
-#endif
-
typedef int8_t signed8;
typedef int16_t signed16;
typedef int32_t signed32;
@@ -72,11 +59,6 @@ typedef uint32_t unsigned32;
typedef uint64_t unsigned64;
/* 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;
@@ -96,11 +78,9 @@ typedef unsigned64 unsigned_8;
/* 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
@@ -110,7 +90,6 @@ typedef signed32 signed_word;
typedef unsigned32 instruction_word;
/* IEEE 1275 cell size - only support 32bit mode at present */
-typedef natural32 natural_cell;
typedef unsigned32 unsigned_cell;
typedef signed32 signed_cell;
--
2.33.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-01 18:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-01 18:32 [PATCH/committed] sim: ppc: drop natural types Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).