sim: ppc: migrate to standard uintXX_t types

Drop the sim-specific unsignedXX types and move to the standard uintXX_t
types that C11 provides.
This commit is contained in:
Mike Frysinger 2021-12-06 02:42:00 -05:00
parent e4c803f5bb
commit 95e40d770e
37 changed files with 1332 additions and 1343 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,12 +24,12 @@
entities. */
typedef union
{
unsigned8 b[16];
unsigned16 h[8];
unsigned32 w[4];
uint8_t b[16];
uint16_t h[8];
uint32_t w[4];
} vreg;
typedef unsigned32 vscreg;
typedef uint32_t vscreg;
struct altivec_regs {
/* AltiVec Registers */

View File

@ -24,8 +24,8 @@
#include "basics.h"
INLINE_BITS\
(unsigned64)
LSMASKED64 (unsigned64 word,
(uint64_t)
LSMASKED64 (uint64_t word,
int start,
int stop)
{
@ -34,8 +34,8 @@ LSMASKED64 (unsigned64 word,
}
INLINE_BITS\
(unsigned64)
LSEXTRACTED64 (unsigned64 val,
(uint64_t)
LSEXTRACTED64 (uint64_t val,
int start,
int stop)
{
@ -45,8 +45,8 @@ LSEXTRACTED64 (unsigned64 val,
}
INLINE_BITS\
(unsigned32)
MASKED32(unsigned32 word,
(uint32_t)
MASKED32(uint32_t word,
unsigned start,
unsigned stop)
{
@ -54,8 +54,8 @@ MASKED32(unsigned32 word,
}
INLINE_BITS\
(unsigned64)
MASKED64(unsigned64 word,
(uint64_t)
MASKED64(uint64_t word,
unsigned start,
unsigned stop)
{
@ -112,8 +112,8 @@ INSERTED(unsigned_word word,
INLINE_BITS\
(unsigned32)
ROTL32(unsigned32 val,
(uint32_t)
ROTL32(uint32_t val,
long shift)
{
ASSERT(shift >= 0 && shift <= 32);
@ -122,8 +122,8 @@ ROTL32(unsigned32 val,
INLINE_BITS\
(unsigned64)
ROTL64(unsigned64 val,
(uint64_t)
ROTL64(uint64_t val,
long shift)
{
ASSERT(shift >= 0 && shift <= 64);

View File

@ -108,7 +108,7 @@
/* multi bit mask */
#define _MASKn(WIDTH, START, STOP) \
(((((unsigned##WIDTH)0) - 1) \
(((((uint##WIDTH##_t)0) - 1) \
>> (WIDTH - ((STOP) - (START) + 1))) \
<< (WIDTH - 1 - (STOP)))
@ -151,14 +151,14 @@
/* mask the required bits, leaving them in place */
INLINE_BITS\
(unsigned32) MASKED32
(unsigned32 word,
(uint32_t) MASKED32
(uint32_t word,
unsigned start,
unsigned stop);
INLINE_BITS\
(unsigned64) MASKED64
(unsigned64 word,
(uint64_t) MASKED64
(uint64_t word,
unsigned start,
unsigned stop);
@ -169,8 +169,8 @@ INLINE_BITS\
unsigned stop);
INLINE_BITS\
(unsigned64) LSMASKED64
(unsigned64 word,
(uint64_t) LSMASKED64
(uint64_t word,
int first,
int last);
@ -191,8 +191,8 @@ INLINE_BITS\
unsigned stop);
INLINE_BITS\
(unsigned64) LSEXTRACTED64
(unsigned64 val,
(uint64_t) LSEXTRACTED64
(uint64_t val,
int start,
int stop);
@ -200,10 +200,10 @@ INLINE_BITS\
/* NB: the wierdness (N>O?N-O:0) is to stop a warning from GCC */
#define _SHUFFLEDn(N, WORD, OLD, NEW) \
((OLD) < (NEW) \
? (((unsigned##N)(WORD) \
? (((uint##N##_t)(WORD) \
>> (((NEW) > (OLD)) ? ((NEW) - (OLD)) : 0)) \
& MASK32((NEW), (NEW))) \
: (((unsigned##N)(WORD) \
: (((uint##N##_t)(WORD) \
<< (((OLD) > (NEW)) ? ((OLD) - (NEW)) : 0)) \
& MASK32((NEW), (NEW))))
@ -229,7 +229,7 @@ INLINE_BITS\
/* depending on MODE return a 64bit or 32bit (sign extended) value */
#if (WITH_TARGET_WORD_BITSIZE == 64)
#define EXTENDED(X) ((signed64)(signed32)(X))
#define EXTENDED(X) ((int64_t)(int32_t)(X))
#else
#define EXTENDED(X) (X)
#endif
@ -270,13 +270,13 @@ do { \
(((VAL) << (SHIFT)) | ((VAL) >> ((N)-(SHIFT))))
INLINE_BITS\
(unsigned32) ROTL32
(unsigned32 val,
(uint32_t) ROTL32
(uint32_t val,
long shift);
INLINE_BITS\
(unsigned64) ROTL64
(unsigned64 val,
(uint64_t) ROTL64
(uint64_t val,
long shift);

View File

@ -227,7 +227,7 @@ core_attach(core *memory,
if (attach == attach_raw_memory) {
/* Padd out the raw buffer to ensure that ADDR starts on a
correctly aligned boundary */
int padding = (addr % sizeof (unsigned64));
int padding = (addr % sizeof (uint64_t));
free_buffer = zalloc(nr_bytes + padding);
buffer = (char*)free_buffer + padding;
}

View File

@ -68,8 +68,8 @@ struct _cpu {
memory_reservation reservation;
/* offset from event time to this cpu's idea of the local time */
signed64 time_base_local_time;
signed64 decrementer_local_time;
int64_t time_base_local_time;
int64_t decrementer_local_time;
event_entry_tag decrementer_event;
};
@ -229,7 +229,7 @@ cpu_error(cpu *processor,
/* The processors local concept of time */
INLINE_CPU\
(signed64)
(int64_t)
cpu_get_time_base(cpu *processor)
{
return (event_queue_time(processor->events)
@ -239,14 +239,14 @@ cpu_get_time_base(cpu *processor)
INLINE_CPU\
(void)
cpu_set_time_base(cpu *processor,
signed64 time_base)
int64_t time_base)
{
processor->time_base_local_time = (event_queue_time(processor->events)
- time_base);
}
INLINE_CPU\
(signed32)
(int32_t)
cpu_get_decrementer(cpu *processor)
{
return (processor->decrementer_local_time
@ -265,9 +265,9 @@ cpu_decrement_event(void *data)
INLINE_CPU\
(void)
cpu_set_decrementer(cpu *processor,
signed32 decrementer)
int32_t decrementer)
{
signed64 old_decrementer = cpu_get_decrementer(processor);
int64_t old_decrementer = cpu_get_decrementer(processor);
event_queue_deschedule(processor->events, processor->decrementer_event);
processor->decrementer_event = NULL;
processor->decrementer_local_time = (event_queue_time(processor->events)

View File

@ -120,22 +120,22 @@ EXTERN_CPU\
/* The processors local concept of time */
INLINE_CPU\
(signed64) cpu_get_time_base
(int64_t) cpu_get_time_base
(cpu *processor);
INLINE_CPU\
(void) cpu_set_time_base
(cpu *processor,
signed64 time_base);
int64_t time_base);
INLINE_CPU\
(signed32) cpu_get_decrementer
(int32_t) cpu_get_decrementer
(cpu *processor);
INLINE_CPU\
(void) cpu_set_decrementer
(cpu *processor,
signed32 decrementer);
int32_t decrementer);
#if WITH_IDECODE_CACHE_SIZE

View File

@ -989,7 +989,7 @@ device_add_boolean_property(device *me,
const char *property,
int boolean)
{
signed32 new_boolean = (boolean ? -1 : 0);
int32_t new_boolean = (boolean ? -1 : 0);
device_add_property(me, property, boolean_property,
&new_boolean, sizeof(new_boolean),
&new_boolean, sizeof(new_boolean),
@ -1879,7 +1879,7 @@ device_instance_to_external(device_instance *instance)
INLINE_DEVICE\
(event_entry_tag)
device_event_queue_schedule(device *me,
signed64 delta_time,
int64_t delta_time,
device_event_handler *handler,
void *data)
{
@ -1899,7 +1899,7 @@ device_event_queue_deschedule(device *me,
}
INLINE_DEVICE\
(signed64)
(int64_t)
device_event_queue_time(device *me)
{
return event_queue_time(psim_event_queue(me->system));

View File

@ -780,7 +780,7 @@ typedef void device_event_handler(void *data);
INLINE_DEVICE\
(event_entry_tag) device_event_queue_schedule
(device *me,
signed64 delta_time,
int64_t delta_time,
device_event_handler *handler,
void *data);
@ -790,7 +790,7 @@ INLINE_DEVICE\
event_entry_tag event_to_remove);
INLINE_DEVICE\
(signed64) device_event_queue_time
(int64_t) device_event_queue_time
(device *me);
#endif /* _DEVICE_H_ */

View File

@ -24,16 +24,16 @@
#include "basics.h"
#include "ansidecls.h"
#define SFtype unsigned32
#define DFtype unsigned64
#define SFtype uint32_t
#define DFtype uint64_t
#define HItype signed16
#define SItype signed32
#define DItype signed64
#define HItype int16_t
#define SItype int32_t
#define DItype int64_t
#define UHItype unsigned16
#define USItype unsigned32
#define UDItype unsigned64
#define UHItype uint16_t
#define USItype uint32_t
#define UDItype uint64_t
#define US_SOFTWARE_GOFAST

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
#define EV_SET_REG4_ACC(sh, sl, h0, h1, h2, h3) do { \
(sh) = (((h0) & 0xffff) << 16) | ((h1) & 0xffff); \
(sl) = (((h2) & 0xffff) << 16) | ((h3) & 0xffff); \
ACC = ((unsigned64)(sh) << 32) | (sl & 0xffffffff); \
ACC = ((uint64_t)(sh) << 32) | (sl & 0xffffffff); \
} while (0)
#define EV_SET_REG2(sh, sl, dh, dl) do { \
@ -38,15 +38,15 @@
#define EV_SET_REG2_ACC(sh, sl, dh, dl) do { \
(sh) = (dh) & 0xffffffff; \
(sl) = (dl) & 0xffffffff; \
ACC = ((unsigned64)(sh) << 32) | ((sl) & 0xffffffff); \
ACC = ((uint64_t)(sh) << 32) | ((sl) & 0xffffffff); \
} while (0)
#define EV_SET_REG1(sh, sl, d) do { \
(sh) = ((unsigned64)(d) >> 32) & 0xffffffff; \
(sh) = ((uint64_t)(d) >> 32) & 0xffffffff; \
(sl) = (d) & 0xffffffff; \
} while (0)
#define EV_SET_REG1_ACC(sh, sl, d) do { \
(sh) = ((unsigned64)(d) >> 32) & 0xffffffff; \
(sh) = ((uint64_t)(d) >> 32) & 0xffffffff; \
(sl) = (d) & 0xffffffff; \
ACC = (d); \
} while (0)
@ -56,12 +56,12 @@
} while (0)
/* get the low or high half word of a word */
#define EV_LOHALF(x) ((unsigned32)(x) & 0xffff)
#define EV_HIHALF(x) (((unsigned32)(x) >> 16) & 0xffff)
#define EV_LOHALF(x) ((uint32_t)(x) & 0xffff)
#define EV_HIHALF(x) (((uint32_t)(x) >> 16) & 0xffff)
/* partially visible accumulator accessors */
#define EV_SET_ACC(rh, rl) \
ACC = ((unsigned64)(rh) << 32) | ((rl) & 0xffffffff)
ACC = ((uint64_t)(rh) << 32) | ((rl) & 0xffffffff)
#define EV_ACCLOW (ACC & 0xffffffff)
#define EV_ACCHIGH ((ACC >> 32) & 0xffffffff)
@ -86,11 +86,11 @@
| (((x) & 0x8000) >> 15)
/* saturation helpers */
#define EV_MUL16_SSF(a,b) ((signed64)((signed32)(signed16)(a) * (signed32)(signed16)(b)) << 1)
#define EV_MUL16_SSF(a,b) ((int64_t)((int32_t)(int16_t)(a) * (int32_t)(int16_t)(b)) << 1)
/* this one loses the top sign bit; be careful */
#define EV_MUL32_SSF(a,b) (((signed64)(signed32)(a) * (signed64)(signed32)(b)) << 1)
#define EV_SAT_P_S32(x) ((((signed64)(x)) < -0x80000000LL) || (((signed64)(x)) > 0x7fffffffLL))
#define EV_SAT_P_U32(x) ((((signed64)(x)) < -0LL) || (((signed64)(x)) > 0xffffffffLL))
#define EV_MUL32_SSF(a,b) (((int64_t)(int32_t)(a) * (int64_t)(int32_t)(b)) << 1)
#define EV_SAT_P_S32(x) ((((int64_t)(x)) < -0x80000000LL) || (((int64_t)(x)) > 0x7fffffffLL))
#define EV_SAT_P_U32(x) ((((int64_t)(x)) < -0LL) || (((int64_t)(x)) > 0xffffffffLL))
#define EV_SATURATE(flag, sat_val, val) \
((flag) ? (sat_val) : (val))
@ -116,7 +116,7 @@
EV_SET_SPEFSCR(SPREG(spr_spefscr) | (s))
#define EV_SET_SPEFSCR_OV(l,h) do { \
unsigned32 _sPefScR = SPREG(spr_spefscr); \
uint32_t _sPefScR = SPREG(spr_spefscr); \
if (l) \
_sPefScR |= spefscr_ov | spefscr_sov; \
else \

View File

@ -22,7 +22,7 @@
/* e500 accumulator. */
typedef unsigned64 accreg;
typedef uint64_t accreg;
enum {
msr_e500_spu_enable = BIT(38)
@ -81,4 +81,4 @@ struct e500_regs {
We need to cast the gpr value to an unsigned type so that it
doesn't get sign-extended when it's or-ed with a 64-bit value; that
would wipe out the upper 32 bits of the register's value. */
#define EVR(N) ((((unsigned64)GPRH(N)) << 32) | (unsigned32) GPR(N))
#define EVR(N) ((((uint64_t)GPRH(N)) << 32) | (uint32_t) GPR(N))

View File

@ -1381,7 +1381,7 @@ chirp_emul_milliseconds(os_emul_data *data,
/*out*/
unsigned_cell ms;
} args;
unsigned64 time;
uint64_t time;
/* read in the arguments */
if (chirp_read_t2h_args(&args, sizeof(args), 1, 1, data, processor, cia))
return -1;
@ -1465,12 +1465,12 @@ static chirp_services services[] = {
typedef struct _chirp_note_desc {
signed32 real_mode;
signed32 real_base;
signed32 real_size;
signed32 virt_base;
signed32 virt_size;
signed32 load_base;
int32_t real_mode;
int32_t real_base;
int32_t real_size;
int32_t virt_base;
int32_t virt_size;
int32_t load_base;
} chirp_note_desc;
typedef enum {
@ -1484,9 +1484,9 @@ typedef struct _chirp_note {
} chirp_note;
typedef struct _chirp_note_head {
unsigned32 namesz;
unsigned32 descsz;
unsigned32 type;
uint32_t namesz;
uint32_t descsz;
uint32_t type;
} chirp_note_head;
static void
@ -1519,7 +1519,7 @@ map_over_chirp_note(bfd *image,
printf_filtered("chirp: note name (%s) not `PowerPC'\n", name);
}
/* check the size */
if (head.descsz == sizeof(note->desc) - sizeof(signed32)) {
if (head.descsz == sizeof(note->desc) - sizeof(int32_t)) {
sim_io_printf_filtered("chirp: note descriptor missing load-base\n");
}
else if (head.descsz != sizeof(note->desc)) {
@ -1543,7 +1543,7 @@ map_over_chirp_note(bfd *image,
if (head.descsz == sizeof(note->desc))
note->desc.load_base = bfd_get_32(image, (void*)&note->desc.load_base);
else
note->desc.load_base = (signed32)-1;
note->desc.load_base = (int32_t)-1;
}
}
@ -1648,7 +1648,7 @@ emul_chirp_create(device *root,
/* resolve real-base */
if (note.found == note_correct
&& note.desc.real_base != (signed32)-1)
&& note.desc.real_base != (int32_t)-1)
chirp->real_base = note.desc.real_base;
else if (tree_find_property(root, "/options/real-base") != NULL)
chirp->real_base = tree_find_integer_property(root, "/options/real-base");
@ -1664,7 +1664,7 @@ emul_chirp_create(device *root,
/* resolve real-size */
if (note.found == note_correct
&& note.desc.real_size != (signed32)-1
&& note.desc.real_size != (int32_t)-1
&& note.desc.real_size != 0
&& chirp->real_size > note.desc.real_size)
error("chirp: insufficient physical memory for firmware\n");
@ -1697,7 +1697,7 @@ emul_chirp_create(device *root,
/* resolve virt-size */
chirp->virt_size = chirp->real_size;
if (note.found == note_correct
&& note.desc.virt_size != (signed32)-1
&& note.desc.virt_size != (int32_t)-1
&& note.desc.virt_size != 0
&& !chirp->real_mode
&& chirp->virt_size > note.desc.virt_size)
@ -1712,7 +1712,7 @@ emul_chirp_create(device *root,
/* resolve load-base */
if (note.found == note_correct
&& note.desc.load_base != (signed32)-1)
&& note.desc.load_base != (int32_t)-1)
chirp->load_base = note.desc.load_base;
else if (tree_find_property(root, "/options/load-base") != NULL)
chirp->load_base = tree_find_integer_property(root, "/options/load-base");

View File

@ -58,12 +58,12 @@ emul_syscall_exit(emul_syscall *emul,
}
INLINE_EMUL_GENERIC unsigned64
INLINE_EMUL_GENERIC uint64_t
emul_read_gpr64(cpu *processor,
int g)
{
unsigned32 hi;
unsigned32 lo;
uint32_t hi;
uint32_t lo;
if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) {
hi = cpu_registers(processor)->gpr[g];
lo = cpu_registers(processor)->gpr[g+1];
@ -79,10 +79,10 @@ emul_read_gpr64(cpu *processor,
INLINE_EMUL_GENERIC void
emul_write_gpr64(cpu *processor,
int g,
unsigned64 val)
uint64_t val)
{
unsigned32 hi = EXTRACTED64(val, 0, 31);
unsigned32 lo = EXTRACTED64(val, 32, 63);
uint32_t hi = EXTRACTED64(val, 0, 31);
uint32_t lo = EXTRACTED64(val, 32, 63);
if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) {
cpu_registers(processor)->gpr[g] = hi;
cpu_registers(processor)->gpr[g+1] = lo;

View File

@ -111,14 +111,14 @@ INLINE_EMUL_GENERIC void emul_do_system_call
unsigned_word cia);
INLINE_EMUL_GENERIC unsigned64 emul_read_gpr64
INLINE_EMUL_GENERIC uint64_t emul_read_gpr64
(cpu *processor,
int g);
INLINE_EMUL_GENERIC void emul_write_gpr64
(cpu *processor,
int g,
unsigned64 val);
uint64_t val);
INLINE_EMUL_GENERIC void emul_write_status
(cpu *processor,

View File

@ -150,13 +150,13 @@ struct _os_emul_data {
/* Structures that are common agmonst the UNIX varients */
struct unix_timeval {
signed32 tv_sec; /* seconds */
signed32 tv_usec; /* microseconds */
int32_t tv_sec; /* seconds */
int32_t tv_usec; /* microseconds */
};
struct unix_timezone {
signed32 tz_minuteswest; /* minutes west of Greenwich */
signed32 tz_dsttime; /* type of dst correction */
int32_t tz_minuteswest; /* minutes west of Greenwich */
int32_t tz_dsttime; /* type of dst correction */
};
#define UNIX_RUSAGE_SELF 0
@ -166,20 +166,20 @@ struct unix_timezone {
struct unix_rusage {
struct unix_timeval ru_utime; /* user time used */
struct unix_timeval ru_stime; /* system time used */
signed32 ru_maxrss; /* maximum resident set size */
signed32 ru_ixrss; /* integral shared memory size */
signed32 ru_idrss; /* integral unshared data size */
signed32 ru_isrss; /* integral unshared stack size */
signed32 ru_minflt; /* any page faults not requiring I/O */
signed32 ru_majflt; /* any page faults requiring I/O */
signed32 ru_nswap; /* swaps */
signed32 ru_inblock; /* block input operations */
signed32 ru_oublock; /* block output operations */
signed32 ru_msgsnd; /* messages sent */
signed32 ru_msgrcv; /* messages received */
signed32 ru_nsignals; /* signals received */
signed32 ru_nvcsw; /* voluntary context switches */
signed32 ru_nivcsw; /* involuntary " */
int32_t ru_maxrss; /* maximum resident set size */
int32_t ru_ixrss; /* integral shared memory size */
int32_t ru_idrss; /* integral unshared data size */
int32_t ru_isrss; /* integral unshared stack size */
int32_t ru_minflt; /* any page faults not requiring I/O */
int32_t ru_majflt; /* any page faults requiring I/O */
int32_t ru_nswap; /* swaps */
int32_t ru_inblock; /* block input operations */
int32_t ru_oublock; /* block output operations */
int32_t ru_msgsnd; /* messages sent */
int32_t ru_msgrcv; /* messages received */
int32_t ru_nsignals; /* signals received */
int32_t ru_nvcsw; /* voluntary context switches */
int32_t ru_nivcsw; /* involuntary " */
};
@ -1051,15 +1051,15 @@ emul_unix_create(device *root,
/* Solaris specific implementation */
typedef signed32 solaris_uid_t;
typedef signed32 solaris_gid_t;
typedef signed32 solaris_off_t;
typedef signed32 solaris_pid_t;
typedef signed32 solaris_time_t;
typedef unsigned32 solaris_dev_t;
typedef unsigned32 solaris_ino_t;
typedef unsigned32 solaris_mode_t;
typedef unsigned32 solaris_nlink_t;
typedef int32_t solaris_uid_t;
typedef int32_t solaris_gid_t;
typedef int32_t solaris_off_t;
typedef int32_t solaris_pid_t;
typedef int32_t solaris_time_t;
typedef uint32_t solaris_dev_t;
typedef uint32_t solaris_ino_t;
typedef uint32_t solaris_mode_t;
typedef uint32_t solaris_nlink_t;
#ifdef HAVE_SYS_STAT_H
#define SOLARIS_ST_FSTYPSZ 16 /* array size for file system type name */
@ -1071,23 +1071,23 @@ typedef unsigned32 solaris_nlink_t;
struct solaris_stat {
solaris_dev_t st_dev;
signed32 st_pad1[3]; /* reserved for network id */
int32_t st_pad1[3]; /* reserved for network id */
solaris_ino_t st_ino;
solaris_mode_t st_mode;
solaris_nlink_t st_nlink;
solaris_uid_t st_uid;
solaris_gid_t st_gid;
solaris_dev_t st_rdev;
signed32 st_pad2[2];
int32_t st_pad2[2];
solaris_off_t st_size;
signed32 st_pad3; /* future off_t expansion */
int32_t st_pad3; /* future off_t expansion */
struct unix_timeval st_atim;
struct unix_timeval st_mtim;
struct unix_timeval st_ctim;
signed32 st_blksize;
signed32 st_blocks;
int32_t st_blksize;
int32_t st_blocks;
char st_fstype[SOLARIS_ST_FSTYPSZ];
signed32 st_pad4[8]; /* expansion area */
int32_t st_pad4[8]; /* expansion area */
};
/* Convert from host stat structure to solaris stat structure */
@ -1264,12 +1264,12 @@ do_solaris_fstat(os_emul_data *emul,
/* Convert to/from host termio structure */
struct solaris_termio {
unsigned16 c_iflag; /* input modes */
unsigned16 c_oflag; /* output modes */
unsigned16 c_cflag; /* control modes */
unsigned16 c_lflag; /* line discipline modes */
unsigned8 c_line; /* line discipline */
unsigned8 c_cc[SOLARIS_NCC]; /* control chars */
uint16_t c_iflag; /* input modes */
uint16_t c_oflag; /* output modes */
uint16_t c_cflag; /* control modes */
uint16_t c_lflag; /* line discipline modes */
uint8_t c_line; /* line discipline */
uint8_t c_cc[SOLARIS_NCC]; /* control chars */
};
STATIC_INLINE_EMUL_UNIX void
@ -1339,9 +1339,9 @@ convert_to_solaris_termio(unsigned_word addr,
#ifdef HAVE_TERMIOS_STRUCTURE
/* Convert to/from host termios structure */
typedef unsigned32 solaris_tcflag_t;
typedef unsigned8 solaris_cc_t;
typedef unsigned32 solaris_speed_t;
typedef uint32_t solaris_tcflag_t;
typedef uint8_t solaris_cc_t;
typedef uint32_t solaris_speed_t;
struct solaris_termios {
solaris_tcflag_t c_iflag;
@ -2002,20 +2002,20 @@ const os_emul emul_solaris = {
/* Linux specific implementation */
typedef unsigned32 linux_dev_t;
typedef unsigned32 linux_ino_t;
typedef unsigned32 linux_mode_t;
typedef unsigned16 linux_nlink_t;
typedef signed32 linux_off_t;
typedef signed32 linux_pid_t;
typedef unsigned32 linux_uid_t;
typedef unsigned32 linux_gid_t;
typedef unsigned32 linux_size_t;
typedef signed32 linux_ssize_t;
typedef signed32 linux_ptrdiff_t;
typedef signed32 linux_time_t;
typedef signed32 linux_clock_t;
typedef signed32 linux_daddr_t;
typedef uint32_t linux_dev_t;
typedef uint32_t linux_ino_t;
typedef uint32_t linux_mode_t;
typedef uint16_t linux_nlink_t;
typedef int32_t linux_off_t;
typedef int32_t linux_pid_t;
typedef uint32_t linux_uid_t;
typedef uint32_t linux_gid_t;
typedef uint32_t linux_size_t;
typedef int32_t linux_ssize_t;
typedef int32_t linux_ptrdiff_t;
typedef int32_t linux_time_t;
typedef int32_t linux_clock_t;
typedef int32_t linux_daddr_t;
#ifdef HAVE_SYS_STAT_H
/* For the PowerPC, don't both with the 'old' stat structure, since there
@ -2030,16 +2030,16 @@ struct linux_stat {
linux_gid_t st_gid;
linux_dev_t st_rdev;
linux_off_t st_size;
unsigned32 st_blksize;
unsigned32 st_blocks;
unsigned32 st_atimx; /* don't use st_{a,c,m}time, that might a macro */
unsigned32 __unused1; /* defined by the host's stat.h */
unsigned32 st_mtimx;
unsigned32 __unused2;
unsigned32 st_ctimx;
unsigned32 __unused3;
unsigned32 __unused4;
unsigned32 __unused5;
uint32_t st_blksize;
uint32_t st_blocks;
uint32_t st_atimx; /* don't use st_{a,c,m}time, that might a macro */
uint32_t __unused1; /* defined by the host's stat.h */
uint32_t st_mtimx;
uint32_t __unused2;
uint32_t st_ctimx;
uint32_t __unused3;
uint32_t __unused4;
uint32_t __unused5;
};
/* Convert from host stat structure to solaris stat structure */
@ -2237,12 +2237,12 @@ do_linux_fstat(os_emul_data *emul,
/* Convert to/from host termio structure */
struct linux_termio {
unsigned16 c_iflag; /* input modes */
unsigned16 c_oflag; /* output modes */
unsigned16 c_cflag; /* control modes */
unsigned16 c_lflag; /* line discipline modes */
unsigned8 c_line; /* line discipline */
unsigned8 c_cc[LINUX_NCC]; /* control chars */
uint16_t c_iflag; /* input modes */
uint16_t c_oflag; /* output modes */
uint16_t c_cflag; /* control modes */
uint16_t c_lflag; /* line discipline modes */
uint8_t c_line; /* line discipline */
uint8_t c_cc[LINUX_NCC]; /* control chars */
};
STATIC_INLINE_EMUL_UNIX void
@ -2319,9 +2319,9 @@ convert_to_linux_termio(unsigned_word addr,
#ifdef HAVE_TERMIOS_STRUCTURE
/* Convert to/from host termios structure */
typedef unsigned32 linux_tcflag_t;
typedef unsigned8 linux_cc_t;
typedef unsigned32 linux_speed_t;
typedef uint32_t linux_tcflag_t;
typedef uint8_t linux_cc_t;
typedef uint32_t linux_speed_t;
struct linux_termios {
linux_tcflag_t c_iflag;
@ -2330,8 +2330,8 @@ struct linux_termios {
linux_tcflag_t c_lflag;
linux_cc_t c_cc[LINUX_NCCS];
linux_cc_t c_line;
signed32 c_ispeed;
signed32 c_ospeed;
int32_t c_ispeed;
int32_t c_ospeed;
};
STATIC_INLINE_EMUL_UNIX void

View File

@ -55,7 +55,7 @@ typedef struct _event_entry event_entry;
struct _event_entry {
void *data;
event_handler *handler;
signed64 time_of_event;
int64_t time_of_event;
event_entry *next;
};
@ -64,8 +64,8 @@ struct _event_queue {
event_entry *queue;
event_entry *volatile held;
event_entry *volatile *volatile held_end;
signed64 time_of_event;
signed64 time_from_event;
int64_t time_of_event;
int64_t time_from_event;
};
@ -142,7 +142,7 @@ event_queue_init(event_queue *queue)
}
INLINE_EVENTS\
(signed64)
(int64_t)
event_queue_time(event_queue *queue)
{
return queue->time_of_event - queue->time_from_event;
@ -152,7 +152,7 @@ STATIC_INLINE_EVENTS\
(void)
update_time_from_event(event_queue *events)
{
signed64 current_time = event_queue_time(events);
int64_t current_time = event_queue_time(events);
if (events->queue != NULL) {
events->time_from_event = (events->queue->time_of_event - current_time);
events->time_of_event = events->queue->time_of_event;
@ -186,11 +186,11 @@ STATIC_INLINE_EVENTS\
(void)
insert_event_entry(event_queue *events,
event_entry *new_event,
signed64 delta)
int64_t delta)
{
event_entry *curr;
event_entry **prev;
signed64 time_of_event;
int64_t time_of_event;
if (delta < 0)
error("what is past is past!\n");
@ -221,7 +221,7 @@ insert_event_entry(event_queue *events,
INLINE_EVENTS\
(event_entry_tag)
event_queue_schedule(event_queue *events,
signed64 delta_time,
int64_t delta_time,
event_handler *handler,
void *data)
{
@ -242,7 +242,7 @@ event_queue_schedule(event_queue *events,
INLINE_EVENTS\
(event_entry_tag)
event_queue_schedule_after_signal(event_queue *events,
signed64 delta_time,
int64_t delta_time,
event_handler *handler,
void *data)
{
@ -323,7 +323,7 @@ INLINE_EVENTS\
(int)
event_queue_tick(event_queue *events)
{
signed64 time_from_event;
int64_t time_from_event;
/* we should only be here when the previous tick has been fully processed */
ASSERT(!events->processing);
@ -372,7 +372,7 @@ INLINE_EVENTS\
(void)
event_queue_process(event_queue *events)
{
signed64 event_time = event_queue_time(events);
int64_t event_time = event_queue_time(events);
ASSERT((events->time_from_event == -1 && events->queue != NULL)
|| events->processing); /* something to do */

View File

@ -40,14 +40,14 @@ INLINE_EVENTS\
INLINE_EVENTS\
(event_entry_tag) event_queue_schedule
(event_queue *queue,
signed64 delta_time,
int64_t delta_time,
event_handler *handler,
void *data);
INLINE_EVENTS\
(event_entry_tag) event_queue_schedule_after_signal
(event_queue *queue,
signed64 delta_time,
int64_t delta_time,
event_handler *handler,
void *data);
@ -72,7 +72,7 @@ INLINE_EVENTS\
/* local concept of time */
INLINE_EVENTS\
(signed64) event_queue_time
(int64_t) event_queue_time
(event_queue *queue);
#endif /* _EVENTS_H_ */

View File

@ -412,9 +412,9 @@ hw_disk_instance_seek(device_instance *instance,
static int
hw_disk_max_transfer(device_instance *instance,
int n_stack_args,
unsigned32 stack_args[/*n_stack_args*/],
uint32_t stack_args[/*n_stack_args*/],
int n_stack_returns,
unsigned32 stack_returns[/*n_stack_returns*/])
uint32_t stack_returns[/*n_stack_returns*/])
{
device *me = device_instance_device(instance);
if ((n_stack_args != 0)
@ -439,9 +439,9 @@ hw_disk_max_transfer(device_instance *instance,
static int
hw_disk_block_size(device_instance *instance,
int n_stack_args,
unsigned32 stack_args[/*n_stack_args*/],
uint32_t stack_args[/*n_stack_args*/],
int n_stack_returns,
unsigned32 stack_returns[/*n_stack_returns*/])
uint32_t stack_returns[/*n_stack_returns*/])
{
device *me = device_instance_device(instance);
if ((n_stack_args != 0)
@ -466,9 +466,9 @@ hw_disk_block_size(device_instance *instance,
static int
hw_disk_nr_blocks(device_instance *instance,
int n_stack_args,
unsigned32 stack_args[/*n_stack_args*/],
uint32_t stack_args[/*n_stack_args*/],
int n_stack_returns,
unsigned32 stack_returns[/*n_stack_returns*/])
uint32_t stack_returns[/*n_stack_returns*/])
{
device *me = device_instance_device(instance);
if ((n_stack_args != 0)

View File

@ -178,20 +178,20 @@ state2a(hw_eeprom_states state)
typedef struct _hw_eeprom_device {
/* general */
hw_eeprom_states state;
unsigned8 *memory;
uint8_t *memory;
unsigned sizeof_memory;
unsigned erase_delay;
signed64 program_start_time;
signed64 program_finish_time;
unsigned8 manufacture_code;
unsigned8 device_code;
unsigned8 toggle_bit;
int64_t program_start_time;
int64_t program_finish_time;
uint8_t manufacture_code;
uint8_t device_code;
uint8_t toggle_bit;
/* initialization */
const char *input_file_name;
const char *output_file_name;
/* for sector and sector programming */
hw_eeprom_states sector_state;
unsigned8 *sectors;
uint8_t *sectors;
unsigned nr_sectors;
unsigned sizeof_sector;
unsigned sector_start_delay;
@ -199,12 +199,12 @@ typedef struct _hw_eeprom_device {
/* byte and byte programming */
unsigned byte_write_delay;
unsigned_word byte_program_address;
unsigned8 byte_program_byte;
uint8_t byte_program_byte;
} hw_eeprom_device;
typedef struct _hw_eeprom_reg_spec {
unsigned32 base;
unsigned32 size;
uint32_t base;
uint32_t size;
} hw_eeprom_reg_spec;
static void
@ -275,7 +275,7 @@ static void
invalid_write(device *me,
hw_eeprom_states state,
unsigned_word address,
unsigned8 data,
uint8_t data,
const char *reason)
{
DTRACE(eeprom, ("Invalid write of 0x%lx to 0x%lx while in state %s (%s)\n",
@ -312,9 +312,9 @@ static void
start_programming_byte(device *me,
hw_eeprom_device *eeprom,
unsigned_word address,
unsigned8 new_byte)
uint8_t new_byte)
{
unsigned8 old_byte = eeprom->memory[address];
uint8_t old_byte = eeprom->memory[address];
DTRACE(eeprom, ("start-programing-byte - address 0x%lx, new 0x%lx, old 0x%lx\n",
(unsigned long)address,
(unsigned long)new_byte,
@ -415,15 +415,15 @@ finish_erasing_sector(device *me,
/* eeprom reads */
static unsigned8
static uint8_t
toggle(hw_eeprom_device *eeprom,
unsigned8 byte)
uint8_t byte)
{
eeprom->toggle_bit = eeprom->toggle_bit ^ 0x40; /* le-bit 6 */
return eeprom->toggle_bit ^ byte;
}
static unsigned8
static uint8_t
read_byte(device *me,
hw_eeprom_device *eeprom,
unsigned_word address)
@ -519,8 +519,8 @@ hw_eeprom_io_read_buffer(device *me,
int i;
for (i = 0; i < nr_bytes; i++) {
unsigned_word address = (addr + i) % eeprom->sizeof_memory;
unsigned8 byte = read_byte(me, eeprom, address);
((unsigned8*)dest)[i] = byte;
uint8_t byte = read_byte(me, eeprom, address);
((uint8_t*)dest)[i] = byte;
}
return nr_bytes;
}
@ -532,7 +532,7 @@ static void
write_byte(device *me,
hw_eeprom_device *eeprom,
unsigned_word address,
unsigned8 data)
uint8_t data)
{
/* may need multiple transitions to process a write */
while (1) {
@ -709,7 +709,7 @@ hw_eeprom_io_write_buffer(device *me,
int i;
for (i = 0; i < nr_bytes; i++) {
unsigned_word address = (addr + i) % eeprom->sizeof_memory;
unsigned8 byte = ((unsigned8*)source)[i];
uint8_t byte = ((uint8_t*)source)[i];
write_byte(me, eeprom, address, byte);
}
return nr_bytes;
@ -741,7 +741,7 @@ hw_eeprom_instance_read(device_instance *instance,
if (data->eeprom->state != read_reset)
DITRACE(eeprom, ("eeprom not idle during instance read\n"));
for (i = 0; i < len; i++) {
((unsigned8*)buf)[i] = data->eeprom->memory[data->pos];
((uint8_t*)buf)[i] = data->eeprom->memory[data->pos];
data->pos = (data->pos + 1) % data->eeprom->sizeof_memory;
}
return len;
@ -757,7 +757,7 @@ hw_eeprom_instance_write(device_instance *instance,
if (data->eeprom->state != read_reset)
DITRACE(eeprom, ("eeprom not idle during instance write\n"));
for (i = 0; i < len; i++) {
data->eeprom->memory[data->pos] = ((unsigned8*)buf)[i];
data->eeprom->memory[data->pos] = ((uint8_t*)buf)[i];
data->pos = (data->pos + 1) % data->eeprom->sizeof_memory;
}
dump_eeprom(data->me, data->eeprom);

View File

@ -204,8 +204,8 @@
static void
htab_decode_hash_table(device *me,
unsigned32 *htaborg,
unsigned32 *htabmask)
uint32_t *htaborg,
uint32_t *htabmask)
{
unsigned_word htab_ra;
unsigned htab_nr_bytes;
@ -242,27 +242,27 @@ htab_decode_hash_table(device *me,
static void
htab_map_page(device *me,
unsigned_word ra,
unsigned64 va,
uint64_t va,
unsigned wimg,
unsigned pp,
unsigned32 htaborg,
unsigned32 htabmask)
uint32_t htaborg,
uint32_t htabmask)
{
/* keep everything left shifted so that the numbering is easier */
unsigned64 vpn = va << 12;
unsigned32 vsid = INSERTED32(EXTRACTED64(vpn, 0, 23), 0, 23);
unsigned32 vpage = INSERTED32(EXTRACTED64(vpn, 24, 39), 0, 15);
unsigned32 hash = INSERTED32(EXTRACTED32(vsid, 5, 23)
uint64_t vpn = va << 12;
uint32_t vsid = INSERTED32(EXTRACTED64(vpn, 0, 23), 0, 23);
uint32_t vpage = INSERTED32(EXTRACTED64(vpn, 24, 39), 0, 15);
uint32_t hash = INSERTED32(EXTRACTED32(vsid, 5, 23)
^ EXTRACTED32(vpage, 0, 15),
7, 31-6);
int h;
for (h = 0; h < 2; h++) {
unsigned32 pteg = (htaborg | (hash & htabmask));
uint32_t pteg = (htaborg | (hash & htabmask));
int pti;
for (pti = 0; pti < 8; pti++) {
unsigned32 pte = pteg + 8 * pti;
unsigned32 current_target_pte0;
unsigned32 current_pte0;
uint32_t pte = pteg + 8 * pti;
uint32_t current_target_pte0;
uint32_t current_pte0;
if (device_dma_read_buffer(device_parent(me),
&current_target_pte0,
0, /*space*/
@ -273,9 +273,9 @@ htab_map_page(device *me,
if (MASKED32(current_pte0, 0, 0)) {
/* full pte, check it isn't already mapping the same virtual
address */
unsigned32 curr_vsid = INSERTED32(EXTRACTED32(current_pte0, 1, 24), 0, 23);
unsigned32 curr_api = INSERTED32(EXTRACTED32(current_pte0, 26, 31), 0, 5);
unsigned32 curr_h = EXTRACTED32(current_pte0, 25, 25);
uint32_t curr_vsid = INSERTED32(EXTRACTED32(current_pte0, 1, 24), 0, 23);
uint32_t curr_api = INSERTED32(EXTRACTED32(current_pte0, 26, 31), 0, 5);
uint32_t curr_h = EXTRACTED32(current_pte0, 25, 25);
if (curr_h == h
&& curr_vsid == vsid
&& curr_api == MASKED32(vpage, 0, 5))
@ -292,15 +292,15 @@ htab_map_page(device *me,
}
else {
/* empty pte fill it */
unsigned32 pte0 = (MASK32(0, 0)
uint32_t pte0 = (MASK32(0, 0)
| INSERTED32(EXTRACTED32(vsid, 0, 23), 1, 24)
| INSERTED32(h, 25, 25)
| INSERTED32(EXTRACTED32(vpage, 0, 5), 26, 31));
unsigned32 target_pte0 = H2T_4(pte0);
unsigned32 pte1 = (INSERTED32(EXTRACTED32(ra, 0, 19), 0, 19)
uint32_t target_pte0 = H2T_4(pte0);
uint32_t pte1 = (INSERTED32(EXTRACTED32(ra, 0, 19), 0, 19)
| INSERTED32(wimg, 25, 28)
| INSERTED32(pp, 30, 31));
unsigned32 target_pte1 = H2T_4(pte1);
uint32_t target_pte1 = H2T_4(pte1);
if (device_dma_write_buffer(device_parent(me),
&target_pte0,
0, /*space*/
@ -339,8 +339,8 @@ claim_memory(device *me,
unsigned_word ra,
unsigned_word size)
{
unsigned32 args[3];
unsigned32 results[1];
uint32_t args[3];
uint32_t results[1];
int status;
args[0] = 0; /* alignment */
args[1] = size;
@ -355,15 +355,15 @@ static void
htab_map_region(device *me,
device_instance *memory,
unsigned_word pte_ra,
unsigned64 pte_va,
uint64_t pte_va,
unsigned nr_bytes,
unsigned wimg,
unsigned pp,
unsigned32 htaborg,
unsigned32 htabmask)
uint32_t htaborg,
uint32_t htabmask)
{
unsigned_word ra;
unsigned64 va;
uint64_t va;
/* claim the memory */
if (memory != NULL)
claim_memory(me, memory, pte_ra, nr_bytes);
@ -499,8 +499,8 @@ htab_map_binary(device *me,
unsigned wimg,
unsigned pp,
const char *file_name,
unsigned32 htaborg,
unsigned32 htabmask)
uint32_t htaborg,
uint32_t htabmask)
{
htab_binary_sizes sizes;
bfd *image;
@ -615,8 +615,8 @@ htab_init_data_callback(device *me)
/* for the pte, do all the real work */
if (strcmp(device_name(me), "pte") == 0) {
unsigned32 htaborg;
unsigned32 htabmask;
uint32_t htaborg;
uint32_t htabmask;
htab_decode_hash_table(me, &htaborg, &htabmask);
@ -626,7 +626,7 @@ htab_init_data_callback(device *me)
unsigned pte_pp = device_find_integer_property(me, "pp");
const char *file_name = device_find_string_property(me, "file-name");
if (device_find_property(me, "real-address") != NULL) {
unsigned32 pte_ra = device_find_integer_property(me, "real-address");
uint32_t pte_ra = device_find_integer_property(me, "real-address");
DTRACE(htab, ("pte - ra=0x%lx, wimg=%ld, pp=%ld, file-name=%s\n",
(unsigned long)pte_ra,
(unsigned long)pte_wimg,
@ -646,8 +646,8 @@ htab_init_data_callback(device *me)
}
else {
/* handle a normal mapping definition */
unsigned64 pte_va = 0;
unsigned32 pte_ra = device_find_integer_property(me, "real-address");
uint64_t pte_va = 0;
uint32_t pte_ra = device_find_integer_property(me, "real-address");
unsigned pte_nr_bytes = device_find_integer_property(me, "nr-bytes");
unsigned pte_wimg = device_find_integer_property(me, "wimg");
unsigned pte_pp = device_find_integer_property(me, "pp");

View File

@ -224,8 +224,8 @@ typedef struct _ide_drive {
typedef struct _ide_controller {
int nr;
ide_states state;
unsigned8 reg[nr_ide_registers];
unsigned8 fifo[nr_fifo_entries];
uint8_t reg[nr_ide_registers];
uint8_t fifo[nr_fifo_entries];
int fifo_pos;
int fifo_size;
ide_drive *current_drive;
@ -235,7 +235,7 @@ typedef struct _ide_controller {
device *me;
event_entry_tag event_tag;
int is_interrupting;
signed64 ready_delay;
int64_t ready_delay;
} ide_controller;
@ -488,7 +488,7 @@ do_command(device *me,
}
}
static unsigned8
static uint8_t
get_status(device *me,
ide_controller *controller)
{
@ -744,11 +744,11 @@ hw_ide_io_read_buffer(device *me,
do_fifo_read(me, controller, dest, nr_bytes);
break;
case ide_status_reg:
*(unsigned8*)dest = get_status(me, controller);
*(uint8_t*)dest = get_status(me, controller);
clear_interrupt(me, controller);
break;
case ide_alternate_status_reg:
*(unsigned8*)dest = get_status(me, controller);
*(uint8_t*)dest = get_status(me, controller);
break;
case ide_error_reg:
case ide_sector_count_reg:
@ -763,7 +763,7 @@ hw_ide_io_read_buffer(device *me,
case ide_dma_prd_table_address_reg1:
case ide_dma_prd_table_address_reg2:
case ide_dma_prd_table_address_reg3:
*(unsigned8*)dest = controller->reg[reg];
*(uint8_t*)dest = controller->reg[reg];
break;
default:
device_error(me, "bus-error at address 0x%lx", (unsigned long)addr);
@ -797,10 +797,10 @@ hw_ide_io_write_buffer(device *me,
do_fifo_write(me, controller, source, nr_bytes);
break;
case ide_command_reg:
do_command(me, controller, *(unsigned8*)source);
do_command(me, controller, *(uint8_t*)source);
break;
case ide_control_reg:
controller->reg[reg] = *(unsigned8*)source;
controller->reg[reg] = *(uint8_t*)source;
/* possibly cancel interrupts */
if ((controller->reg[reg] & 0x02) == 0x02)
clear_interrupt(me, controller);
@ -817,7 +817,7 @@ hw_ide_io_write_buffer(device *me,
case ide_dma_prd_table_address_reg1:
case ide_dma_prd_table_address_reg2:
case ide_dma_prd_table_address_reg3:
controller->reg[reg] = *(unsigned8*)source;
controller->reg[reg] = *(uint8_t*)source;
break;
default:
device_error(me, "bus-error at 0x%lx", (unsigned long)addr);

View File

@ -62,7 +62,7 @@
*/
typedef struct _hw_nvram_device {
unsigned8 *memory;
uint8_t *memory;
unsigned sizeof_memory;
time_t host_time;
unsigned timezone;
@ -87,8 +87,8 @@ hw_nvram_create(const char *name,
}
typedef struct _hw_nvram_reg_spec {
unsigned32 base;
unsigned32 size;
uint32_t base;
uint32_t size;
} hw_nvram_reg_spec;
static void
@ -200,9 +200,9 @@ hw_nvram_io_read_buffer(device *me,
hw_nvram_device *nvram = (hw_nvram_device*)device_data(me);
for (i = 0; i < nr_bytes; i++) {
unsigned address = (addr + i) % nvram->sizeof_memory;
unsigned8 data = nvram->memory[address];
uint8_t data = nvram->memory[address];
hw_nvram_update_clock(nvram, processor);
((unsigned8*)dest)[i] = data;
((uint8_t*)dest)[i] = data;
}
return nr_bytes;
}
@ -220,7 +220,7 @@ hw_nvram_io_write_buffer(device *me,
hw_nvram_device *nvram = (hw_nvram_device*)device_data(me);
for (i = 0; i < nr_bytes; i++) {
unsigned address = (addr + i) % nvram->sizeof_memory;
unsigned8 data = ((unsigned8*)source)[i];
uint8_t data = ((uint8_t*)source)[i];
if (address == nvram->addr_control
&& (data & 0x80) == 0
&& (nvram->memory[address] & 0x80) == 0x80)

View File

@ -305,7 +305,7 @@ typedef struct _opic_timer {
hw_opic_device *opic; /* ditto */
unsigned base_count;
int inhibited;
signed64 count; /* *ONLY* if inhibited */
int64_t count; /* *ONLY* if inhibited */
event_entry_tag timeout_event;
opic_interrupt_source *interrupt_source;
} opic_timer;
@ -347,7 +347,7 @@ struct _hw_opic_device {
unsigned timer_frequency;
/* init register */
unsigned32 init;
uint32_t init;
/* address maps */
opic_idu idu;

View File

@ -80,7 +80,7 @@ do_register_init(device *me,
psim *system = device_system(me);
if (prop != NULL) {
const char *name = prop->name;
unsigned32 value = device_find_integer_property(me, name);
uint32_t value = device_find_integer_property(me, name);
int processor;
do_register_init(me, device_next_property(prop));

View File

@ -187,7 +187,7 @@ hw_sem_io_read_buffer(device *me,
hw_sem_device *sem = (hw_sem_device*)device_data(me);
struct sembuf sb;
int status;
unsigned32 u32;
uint32_t u32;
union semun help;
/* do we need to worry about out of range addresses? */

View File

@ -69,7 +69,7 @@ hw_trace_ioctl(device *me,
const device_property *prop = device_find_property(me, NULL);
while (prop != NULL) {
const char *name = prop->name;
unsigned32 value = device_find_integer_property(me, name);
uint32_t value = device_find_integer_property(me, name);
trace_option(name, value);
prop = device_next_property(prop);
}

View File

@ -30,7 +30,7 @@
/* 32bit target expressions:
Each calculation is performed three times using each of the
signed64, unsigned64 and long integer types. The macro ALU_END
int64_t, uint64_t and long integer types. The macro ALU_END
(in _ALU_RESULT_VAL) then selects which of the three alternative
results will be used in the final assignment of the target
register. As this selection is determined at compile time by
@ -57,8 +57,8 @@
/* Macro's to type cast 32bit constants to 64bits */
#define SIGNED64(val) ((signed64)(signed32)(val))
#define UNSIGNED64(val) ((unsigned64)(unsigned32)(val))
#define SIGNED64(val) ((int64_t)(int32_t)(val))
#define UNSIGNED64(val) ((uint64_t)(uint32_t)(val))
/* Start a section of ALU code */
@ -66,8 +66,8 @@
#define ALU_BEGIN(val) \
{ \
signed_word alu_val; \
unsigned64 alu_carry_val; \
signed64 alu_overflow_val; \
uint64_t alu_carry_val; \
int64_t alu_overflow_val; \
ALU_SET(val)
@ -78,7 +78,7 @@
signed_word const alu_result = _ALU_RESULT_VAL(CA,OE,Rc); \
/* determine the overflow bit if needed */ \
if (OE) { \
if ((((unsigned64)(alu_overflow_val & BIT64(0))) \
if ((((uint64_t)(alu_overflow_val & BIT64(0))) \
>> 32) \
== (alu_overflow_val & BIT64(32))) \
XER &= (~xer_overflow); \
@ -118,23 +118,23 @@
#define ALU_SET(val) \
do { \
alu_val = val; \
alu_carry_val = ((unsigned64)alu_val) >> 32; \
alu_overflow_val = ((signed64)alu_val) >> 32; \
alu_carry_val = ((uint64_t)alu_val) >> 32; \
alu_overflow_val = ((int64_t)alu_val) >> 32; \
} while (0)
#endif
#if (WITH_TARGET_WORD_BITSIZE == 32)
#define ALU_SET(val) \
do { \
alu_val = val; \
alu_carry_val = (unsigned32)(alu_val); \
alu_overflow_val = (signed32)(alu_val); \
alu_carry_val = (uint32_t)(alu_val); \
alu_overflow_val = (int32_t)(alu_val); \
} while (0)
#endif
#if (WITH_TARGET_WORD_BITSIZE == 64)
#define ALU_ADD(val) \
do { \
unsigned64 alu_lo = (UNSIGNED64(alu_val) \
uint64_t alu_lo = (UNSIGNED64(alu_val) \
+ UNSIGNED64(val)); \
signed alu_carry = ((alu_lo & BIT(31)) != 0); \
alu_carry_val = (alu_carry_val \
@ -150,8 +150,8 @@ do { \
#define ALU_ADD(val) \
do { \
alu_val += val; \
alu_carry_val += (unsigned32)(val); \
alu_overflow_val += (signed32)(val); \
alu_carry_val += (uint32_t)(val); \
alu_overflow_val += (int32_t)(val); \
} while (0)
#endif
@ -179,8 +179,8 @@ do { \
#define ALU_SUB(val) \
do { \
alu_val -= val; \
alu_carry_val -= (unsigned32)(val); \
alu_overflow_val -= (signed32)(val); \
alu_carry_val -= (uint32_t)(val); \
alu_overflow_val -= (int32_t)(val); \
} while (0)
#endif
#endif
@ -191,8 +191,8 @@ do { \
#define ALU_OR(val) \
do { \
alu_val |= val; \
alu_carry_val = (unsigned32)(alu_val); \
alu_overflow_val = (signed32)(alu_val); \
alu_carry_val = (uint32_t)(alu_val); \
alu_overflow_val = (int32_t)(alu_val); \
} while (0)
#endif
@ -203,8 +203,8 @@ do { \
#define ALU_XOR(val) \
do { \
alu_val ^= val; \
alu_carry_val = (unsigned32)(alu_val); \
alu_overflow_val = (signed32)(alu_val); \
alu_carry_val = (uint32_t)(alu_val); \
alu_overflow_val = (int32_t)(alu_val); \
} while (0)
#endif
@ -229,8 +229,8 @@ do { \
#define ALU_AND(val) \
do { \
alu_val &= val; \
alu_carry_val = (unsigned32)(alu_val); \
alu_overflow_val = (signed32)(alu_val); \
alu_carry_val = (uint32_t)(alu_val); \
alu_overflow_val = (int32_t)(alu_val); \
} while (0)
#endif
@ -238,7 +238,7 @@ do { \
#if (WITH_TARGET_WORD_BITSIZE == 64)
#define ALU_NOT \
do { \
signed64 new_alu_val = ~alu_val; \
int64_t new_alu_val = ~alu_val; \
ALU_SET(new_alu_val); \
} while (0)
#endif

View File

@ -52,32 +52,32 @@
/* PPCbug location structure */
typedef struct ppcboot_location {
unsigned8 ind;
unsigned8 head;
unsigned8 sector;
unsigned8 cylinder;
uint8_t ind;
uint8_t head;
uint8_t sector;
uint8_t cylinder;
} ppcboot_location_t;
/* PPCbug partition table layout */
typedef struct ppcboot_partition {
ppcboot_location_t partition_begin; /* partition begin */
ppcboot_location_t partition_end; /* partition end */
unsigned8 sector_begin[4]; /* 32-bit start RBA (zero-based), little endian */
unsigned8 sector_length[4]; /* 32-bit RBA count (one-based), little endian */
uint8_t sector_begin[4]; /* 32-bit start RBA (zero-based), little endian */
uint8_t sector_length[4]; /* 32-bit RBA count (one-based), little endian */
} ppcboot_partition_t;
#if 0
/* PPCbug boot layout. */
typedef struct ppcboot_hdr {
unsigned8 pc_compatibility[446]; /* x86 instruction field */
uint8_t pc_compatibility[446]; /* x86 instruction field */
ppcboot_partition_t partition[4]; /* partition information */
unsigned8 signature[2]; /* 0x55 and 0xaa */
unsigned8 entry_offset[4]; /* entry point offset, little endian */
unsigned8 length[4]; /* load image length, little endian */
unsigned8 flags; /* flag field */
unsigned8 os_id; /* OS_ID */
uint8_t signature[2]; /* 0x55 and 0xaa */
uint8_t entry_offset[4]; /* entry point offset, little endian */
uint8_t length[4]; /* load image length, little endian */
uint8_t flags; /* flag field */
uint8_t os_id; /* OS_ID */
char partition_name[32]; /* partition name */
unsigned8 reserved1[470]; /* reserved */
uint8_t reserved1[470]; /* reserved */
} ppcboot_hdr_t;
#endif
@ -92,7 +92,7 @@ typedef struct _disklabel {
static unsigned_word
sector2uw(unsigned8 s[4])
sector2uw(uint8_t s[4])
{
return ((s[3] << 24)
+ (s[2] << 16)
@ -169,7 +169,7 @@ static const device_instance_callbacks package_disklabel_callbacks = {
/* Reconize different types of boot block */
static int
block0_is_bpb(const unsigned8 block[])
block0_is_bpb(const uint8_t block[])
{
const char ebdic_ibma[] = { 0xc9, 0xc2, 0xd4, 0xc1 };
/* ref PowerPC Microprocessor CHRP bindings 1.2b - page 47 */
@ -196,7 +196,7 @@ static int
is_iso9660(device_instance *raw_disk)
{
/* ref PowerPC Microprocessor CHRP bindings 1.2b - page 47 */
unsigned8 block[512];
uint8_t block[512];
if (device_instance_seek(raw_disk, 0, 512 * 64) < 0)
return 0;
if (device_instance_read(raw_disk, block, sizeof(block)) != sizeof(block))
@ -220,7 +220,7 @@ is_iso9660(device_instance *raw_disk)
Return -1: no active partition */
static int
block0_is_fdisk(const unsigned8 block[])
block0_is_fdisk(const uint8_t block[])
{
const int partition_type_fields[] = { 0, 0x1c2, 0x1d2, 0x1e2, 0x1f2 };
const int partition_active_fields[] = { 0, 0x1be, 0x1ce, 0x1de, 0xee };
@ -279,7 +279,7 @@ block0_is_fdisk(const unsigned8 block[])
/* Verify that block0 corresponds to a MAC disk */
static int
block0_is_mac_disk(const unsigned8 block[])
block0_is_mac_disk(const uint8_t block[])
{
/* ref PowerPC Microprocessor CHRP bindings 1.2b - page 47 */
/* signature - BEx4552 at offset 0 */
@ -318,7 +318,7 @@ pk_disklabel_create_instance(device_instance *raw_disk,
return raw_disk;
}
else {
unsigned8 boot_block[512];
uint8_t boot_block[512];
/* get the boot block for examination */
if (device_instance_seek(raw_disk, 0, 0) < 0)
device_error(device_instance_device(raw_disk),

View File

@ -35,49 +35,49 @@
:cache::::RA:RA:
:cache:::signed_word *:rA:RA:(cpu_registers(processor)->gpr + RA)
:cache:::unsigned32:RA_BITMASK:RA:(1 << RA)
:cache:::uint32_t:RA_BITMASK:RA:(1 << RA)
:compute:::int:RA_is_0:RA:(RA == 0)
:cache::::RT:RT:
:cache:::signed_word *:rT:RT:(cpu_registers(processor)->gpr + RT)
:cache:::unsigned32:RT_BITMASK:RT:(1 << RT)
:cache:::uint32_t:RT_BITMASK:RT:(1 << RT)
:cache::::RS:RS:
:cache:::signed_word *:rS:RS:(cpu_registers(processor)->gpr + RS)
:cache:::unsigned32:RS_BITMASK:RS:(1 << RS)
:cache:::uint32_t:RS_BITMASK:RS:(1 << RS)
:cache::::RB:RB:
:cache:::signed_word *:rB:RB:(cpu_registers(processor)->gpr + RB)
:cache:::unsigned32:RB_BITMASK:RB:(1 << RB)
:cache:::uint32_t:RB_BITMASK:RB:(1 << RB)
:scratch::::FRA:FRA:
:cache:::unsigned64 *:frA:FRA:(cpu_registers(processor)->fpr + FRA)
:cache:::unsigned32:FRA_BITMASK:FRA:(1 << FRA)
:cache:::uint64_t *:frA:FRA:(cpu_registers(processor)->fpr + FRA)
:cache:::uint32_t:FRA_BITMASK:FRA:(1 << FRA)
:scratch::::FRB:FRB:
:cache:::unsigned64 *:frB:FRB:(cpu_registers(processor)->fpr + FRB)
:cache:::unsigned32:FRB_BITMASK:FRB:(1 << FRB)
:cache:::uint64_t *:frB:FRB:(cpu_registers(processor)->fpr + FRB)
:cache:::uint32_t:FRB_BITMASK:FRB:(1 << FRB)
:scratch::::FRC:FRC:
:cache:::unsigned64 *:frC:FRC:(cpu_registers(processor)->fpr + FRC)
:cache:::unsigned32:FRC_BITMASK:FRC:(1 << FRC)
:cache:::uint64_t *:frC:FRC:(cpu_registers(processor)->fpr + FRC)
:cache:::uint32_t:FRC_BITMASK:FRC:(1 << FRC)
:scratch::::FRS:FRS:
:cache:::unsigned64 *:frS:FRS:(cpu_registers(processor)->fpr + FRS)
:cache:::unsigned32:FRS_BITMASK:FRS:(1 << FRS)
:cache:::uint64_t *:frS:FRS:(cpu_registers(processor)->fpr + FRS)
:cache:::uint32_t:FRS_BITMASK:FRS:(1 << FRS)
:scratch::::FRT:FRT:
:cache:::unsigned64 *:frT:FRT:(cpu_registers(processor)->fpr + FRT)
:cache:::unsigned32:FRT_BITMASK:FRT:(1 << FRT)
:cache:::unsigned_word:EXTS_SI:SI:((signed_word)(signed16)instruction)
:cache:::uint64_t *:frT:FRT:(cpu_registers(processor)->fpr + FRT)
:cache:::uint32_t:FRT_BITMASK:FRT:(1 << FRT)
:cache:::unsigned_word:EXTS_SI:SI:((signed_word)(int16_t)instruction)
:scratch::::BI:BI:
:cache::::BIT32_BI:BI:BIT32(BI)
:cache::::BF:BF:
:cache:::unsigned32:BF_BITMASK:BF:(1 << BF)
:cache:::uint32_t:BF_BITMASK:BF:(1 << BF)
:scratch::::BA:BA:
:cache::::BIT32_BA:BA:BIT32(BA)
:cache:::unsigned32:BA_BITMASK:BA:(1 << BA)
:cache:::uint32_t:BA_BITMASK:BA:(1 << BA)
:scratch::::BB:BB:
:cache::::BIT32_BB:BB:BIT32(BB)
:cache:::unsigned32:BB_BITMASK:BB:(1 << BB)
:cache:::uint32_t:BB_BITMASK:BB:(1 << BB)
:cache::::BT:BT:
:cache:::unsigned32:BT_BITMASK:BT:(1 << BT)
:cache:::unsigned_word:EXTS_BD_0b00:BD:(((signed_word)(signed16)instruction) & ~3)
:cache:::unsigned_word:EXTS_LI_0b00:LI:((((signed_word)(signed32)(instruction << 6)) >> 6) & ~0x3)
:cache:::unsigned_word:EXTS_D:D:((signed_word)(signed16)(instruction))
:cache:::unsigned_word:EXTS_DS_0b00:DS:(((signed_word)(signed16)instruction) & ~0x3)
:cache:::uint32_t:BT_BITMASK:BT:(1 << BT)
:cache:::unsigned_word:EXTS_BD_0b00:BD:(((signed_word)(int16_t)instruction) & ~3)
:cache:::unsigned_word:EXTS_LI_0b00:LI:((((signed_word)(int32_t)(instruction << 6)) >> 6) & ~0x3)
:cache:::unsigned_word:EXTS_D:D:((signed_word)(int16_t)(instruction))
:cache:::unsigned_word:EXTS_DS_0b00:DS:(((signed_word)(int16_t)instruction) & ~0x3)
#:compute:::int:SPR_is_256:SPR:(SPR == 256)
# PowerPC models
@ -174,9 +174,9 @@
struct _model_time {
ppc_function_unit first_unit; /* first functional unit this insn could use */
ppc_function_unit second_unit; /* second functional unit this insn could use */
signed16 issue; /* # cycles before function unit can process other insns */
signed16 done; /* # cycles before insn is done */
unsigned32 flags; /* any flags that are needed */
int16_t issue; /* # cycles before function unit can process other insns */
int16_t done; /* # cycles before insn is done */
uint32_t flags; /* any flags that are needed */
};
/* Register mappings in status masks */
@ -193,15 +193,15 @@
struct _model_busy {
model_busy *next; /* next function unit */
ppc_function_unit unit; /* function unit name */
unsigned32 int_busy; /* int registers that are busy */
unsigned32 fp_busy; /* floating point registers that are busy */
unsigned32 cr_fpscr_busy; /* CR/FPSCR registers that are busy */
signed16 spr_busy; /* SPR register that is busy or PPC_NO_SPR */
unsigned32 vr_busy; /* AltiVec registers that are busy */
signed16 vscr_busy; /* AltiVec status register busy */
signed16 issue; /* # of cycles until unit can accept another insn */
signed16 done; /* # of cycles until insn is done */
signed16 nr_writebacks; /* # of registers this unit writes back */
uint32_t int_busy; /* int registers that are busy */
uint32_t fp_busy; /* floating point registers that are busy */
uint32_t cr_fpscr_busy; /* CR/FPSCR registers that are busy */
int16_t spr_busy; /* SPR register that is busy or PPC_NO_SPR */
uint32_t vr_busy; /* AltiVec registers that are busy */
int16_t vscr_busy; /* AltiVec status register busy */
int16_t issue; /* # of cycles until unit can accept another insn */
int16_t done; /* # of cycles until insn is done */
int16_t nr_writebacks; /* # of registers this unit writes back */
};
/* Structure to hold the current state information for the simulated CPU model */
@ -225,13 +225,13 @@
count_type nr_stalls_writeback; /* # of stalls waiting for a writeback slot */
count_type nr_units[nr_ppc_function_units]; /* function unit counts */
int max_nr_writebacks; /* max # of writeback slots available */
unsigned32 int_busy; /* int registers that are busy */
unsigned32 fp_busy; /* floating point registers that are busy */
unsigned32 cr_fpscr_busy; /* CR/FPSCR registers that are busy */
unsigned8 spr_busy[nr_of_sprs]; /* SPR registers that are busy */
unsigned32 vr_busy; /* AltiVec registers that are busy */
unsigned8 vscr_busy; /* AltiVec SC register busy */
unsigned8 busy[nr_ppc_function_units]; /* whether a function is busy or not */
uint32_t int_busy; /* int registers that are busy */
uint32_t fp_busy; /* floating point registers that are busy */
uint32_t cr_fpscr_busy; /* CR/FPSCR registers that are busy */
uint8_t spr_busy[nr_of_sprs]; /* SPR registers that are busy */
uint32_t vr_busy; /* AltiVec registers that are busy */
uint8_t vscr_busy; /* AltiVec SC register busy */
uint8_t busy[nr_ppc_function_units]; /* whether a function is busy or not */
};
static const char *const ppc_function_unit_name[ (int)nr_ppc_function_units ] = {
@ -334,7 +334,7 @@ void::model-static::model_trace_release:model_data *model_ptr, model_busy *busy
TRACE(trace_model, ("VSCR Register %s is now available.\n", spr_name(busy->spr_busy)));
# Trace making registers busy
void::model-static::model_trace_make_busy:model_data *model_ptr, unsigned32 int_mask, unsigned32 fp_mask, unsigned32 cr_mask
void::model-static::model_trace_make_busy:model_data *model_ptr, uint32_t int_mask, uint32_t fp_mask, uint32_t cr_mask
int i;
if (int_mask) {
for(i = 0; i < 32; i++) {
@ -359,7 +359,7 @@ void::model-static::model_trace_make_busy:model_data *model_ptr, unsigned32 int_
}
# Trace waiting for registers to become available
void::model-static::model_trace_busy_p:model_data *model_ptr, unsigned32 int_busy, unsigned32 fp_busy, unsigned32 cr_or_fpscr_busy, int spr_busy
void::model-static::model_trace_busy_p:model_data *model_ptr, uint32_t int_busy, uint32_t fp_busy, uint32_t cr_or_fpscr_busy, int spr_busy
int i;
if (int_busy) {
int_busy &= model_ptr->int_busy;
@ -520,7 +520,7 @@ void::model-function::model_serialize:itable_index index, model_data *model_ptr
# Wait for a CR to become unbusy
void::model-function::model_wait_for_cr:model_data *model_ptr, unsigned CRBIT
unsigned u;
unsigned32 cr_mask;
uint32_t cr_mask;
int cr_var = 0;
for (u = 0xc0000000; (u != 0) && (CRBIT & u) == 0; u >>= 4 )
cr_var++;
@ -533,8 +533,8 @@ void::model-function::model_wait_for_cr:model_data *model_ptr, unsigned CRBIT
}
# Schedule an instruction that takes integer input registers and produces output registers
void::model-function::ppc_insn_int:itable_index index, model_data *model_ptr, const unsigned32 out_mask, const unsigned32 in_mask
const unsigned32 int_mask = out_mask | in_mask;
void::model-function::ppc_insn_int:itable_index index, model_data *model_ptr, const uint32_t out_mask, const uint32_t in_mask
const uint32_t int_mask = out_mask | in_mask;
model_busy *busy_ptr;
if ((model_ptr->int_busy & int_mask) != 0) {
@ -559,8 +559,8 @@ void::model-function::ppc_insn_int:itable_index index, model_data *model_ptr, co
model_trace_make_busy(model_ptr, out_mask, 0, 0);
# Schedule an instruction that takes integer input registers and produces output registers & sets a CR register
void::model-function::ppc_insn_int_cr:itable_index index, model_data *model_ptr, const unsigned32 out_mask, const unsigned32 in_mask, const unsigned32 cr_mask
const unsigned32 int_mask = out_mask | in_mask;
void::model-function::ppc_insn_int_cr:itable_index index, model_data *model_ptr, const uint32_t out_mask, const uint32_t in_mask, const uint32_t cr_mask
const uint32_t int_mask = out_mask | in_mask;
model_busy *busy_ptr;
if ((model_ptr->int_busy & int_mask) || (model_ptr->cr_fpscr_busy & cr_mask)) {
@ -591,8 +591,8 @@ void::model-function::ppc_insn_int_cr:itable_index index, model_data *model_ptr,
# Schedule an instruction that takes CR input registers and produces output CR registers
void::model-function::ppc_insn_cr:itable_index index, model_data *model_ptr, const unsigned32 out_mask, const unsigned32 in_mask
const unsigned32 cr_mask = out_mask | in_mask;
void::model-function::ppc_insn_cr:itable_index index, model_data *model_ptr, const uint32_t out_mask, const uint32_t in_mask
const uint32_t cr_mask = out_mask | in_mask;
model_busy *busy_ptr;
if ((model_ptr->cr_fpscr_busy & cr_mask) != 0) {
@ -618,8 +618,8 @@ void::model-function::ppc_insn_cr:itable_index index, model_data *model_ptr, con
# Schedule an instruction that takes floating point input registers and produces an output fp register
void::model-function::ppc_insn_float:itable_index index, model_data *model_ptr, const unsigned32 out_mask, const unsigned32 in_mask
const unsigned32 fp_mask = out_mask | in_mask;
void::model-function::ppc_insn_float:itable_index index, model_data *model_ptr, const uint32_t out_mask, const uint32_t in_mask
const uint32_t fp_mask = out_mask | in_mask;
model_busy *busy_ptr;
if ((model_ptr->fp_busy & fp_mask) != 0) {
@ -643,8 +643,8 @@ void::model-function::ppc_insn_float:itable_index index, model_data *model_ptr,
# Schedule an instruction that takes floating point input registers and produces an output fp register & sets a CR reg
void::model-function::ppc_insn_float_cr:itable_index index, model_data *model_ptr, const unsigned32 out_mask, const unsigned32 in_mask, const unsigned32 cr_mask
const unsigned32 fp_mask = out_mask | in_mask;
void::model-function::ppc_insn_float_cr:itable_index index, model_data *model_ptr, const uint32_t out_mask, const uint32_t in_mask, const uint32_t cr_mask
const uint32_t fp_mask = out_mask | in_mask;
model_busy *busy_ptr;
if ((model_ptr->fp_busy & fp_mask) || (model_ptr->cr_fpscr_busy & cr_mask)) {
@ -670,9 +670,9 @@ void::model-function::ppc_insn_float_cr:itable_index index, model_data *model_pt
# Schedule an instruction that takes both int/float input registers and produces output int/float registers
void::model-function::ppc_insn_int_float:itable_index index, model_data *model_ptr, const unsigned32 out_int_mask, const unsigned32 out_fp_mask, const unsigned32 in_int_mask, const unsigned32 in_fp_mask
const unsigned32 int_mask = out_int_mask | in_int_mask;
const unsigned32 fp_mask = out_fp_mask | in_fp_mask;
void::model-function::ppc_insn_int_float:itable_index index, model_data *model_ptr, const uint32_t out_int_mask, const uint32_t out_fp_mask, const uint32_t in_int_mask, const uint32_t in_fp_mask
const uint32_t int_mask = out_int_mask | in_int_mask;
const uint32_t fp_mask = out_fp_mask | in_fp_mask;
model_busy *busy_ptr;
if ((model_ptr->int_busy & int_mask) || (model_ptr->fp_busy & fp_mask)) {
@ -698,7 +698,7 @@ void::model-function::ppc_insn_int_float:itable_index index, model_data *model_p
}
# Schedule an MFSPR instruction that takes 1 special purpose register and produces an integer output register
void::model-function::ppc_insn_from_spr:itable_index index, model_data *model_ptr, const unsigned32 int_mask, const unsigned nSPR
void::model-function::ppc_insn_from_spr:itable_index index, model_data *model_ptr, const uint32_t int_mask, const unsigned nSPR
model_busy *busy_ptr;
while ((model_ptr->int_busy & int_mask) != 0 || model_ptr->spr_busy[nSPR] != 0) {
@ -717,7 +717,7 @@ void::model-function::ppc_insn_from_spr:itable_index index, model_data *model_pt
model_trace_make_busy(model_ptr, int_mask, 0, 0);
# Schedule an MTSPR instruction that takes 1 integer register and produces a special purpose output register
void::model-function::ppc_insn_to_spr:itable_index index, model_data *model_ptr, const unsigned32 int_mask, const unsigned nSPR
void::model-function::ppc_insn_to_spr:itable_index index, model_data *model_ptr, const uint32_t int_mask, const unsigned nSPR
model_busy *busy_ptr;
while ((model_ptr->int_busy & int_mask) != 0 || model_ptr->spr_busy[nSPR] != 0) {
@ -735,8 +735,8 @@ void::model-function::ppc_insn_to_spr:itable_index index, model_data *model_ptr,
TRACE(trace_model,("Making register %s busy.\n", spr_name(nSPR)));
# Schedule a MFCR instruction that moves the CR into an integer register
void::model-function::ppc_insn_mfcr:itable_index index, model_data *model_ptr, unsigned32 int_mask
const unsigned32 cr_mask = 0xff;
void::model-function::ppc_insn_mfcr:itable_index index, model_data *model_ptr, uint32_t int_mask
const uint32_t cr_mask = 0xff;
model_busy *busy_ptr;
while (((model_ptr->int_busy & int_mask) | (model_ptr->cr_fpscr_busy & cr_mask)) != 0) {
@ -755,10 +755,10 @@ void::model-function::ppc_insn_mfcr:itable_index index, model_data *model_ptr, u
model_trace_make_busy(model_ptr, int_mask, 0, 0);
# Schedule a MTCR instruction that moves an integer register into the CR
void::model-function::ppc_insn_mtcr:itable_index index, model_data *model_ptr, unsigned32 int_mask, unsigned FXM
void::model-function::ppc_insn_mtcr:itable_index index, model_data *model_ptr, uint32_t int_mask, unsigned FXM
int f;
int nr_crs = 0;
unsigned32 cr_mask = 0;
uint32_t cr_mask = 0;
const model_time *normal_time = &model_ptr->timing[index];
static const model_time ppc604_1bit_time = { PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0 };
model_busy *busy_ptr;
@ -996,8 +996,8 @@ void::model-function::model_branch_predict:model_data *model_ptr, int success
#
# Convert 32bit single to 64bit double
unsigned64::function::DOUBLE:unsigned32 WORD
unsigned64 FRT;
uint64_t::function::DOUBLE:uint32_t WORD
uint64_t FRT;
if (EXTRACTED32(WORD, 1, 8) > 0
&& EXTRACTED32(WORD, 1, 8) < 255) {
/* normalized operand */
@ -1013,7 +1013,7 @@ unsigned64::function::DOUBLE:unsigned32 WORD
/* denormalized operand */
int sign = EXTRACTED32(WORD, 0, 0);
int exp = -126;
unsigned64 frac = INSERTED64(EXTRACTED32(WORD, 9, 31), 1, (52 - 29));
uint64_t frac = INSERTED64(EXTRACTED32(WORD, 9, 31), 1, (52 - 29));
/* normalize the operand */
while (MASKED64(frac, 0, 0) == 0) {
frac <<= 1;
@ -1038,8 +1038,8 @@ unsigned64::function::DOUBLE:unsigned32 WORD
return FRT;
# Convert 64bit single to 32bit double
unsigned32::function::SINGLE:unsigned64 FRS
unsigned32 WORD;
uint32_t::function::SINGLE:uint64_t FRS
uint32_t WORD;
if (EXTRACTED64(FRS, 1, 11) > 896
|| EXTRACTED64(FRS, 1, 63) == 0) {
/* no denormalization required (includes Zero/Infinity/NaN) */
@ -1051,7 +1051,7 @@ unsigned32::function::SINGLE:unsigned64 FRS
/* denormalization required */
int sign = EXTRACTED64(FRS, 0, 0);
int exp = EXTRACTED64(FRS, 1, 11) - 1023;
unsigned64 frac = (BIT64(0)
uint64_t frac = (BIT64(0)
| INSERTED64(EXTRACTED64(FRS, 12, 63), 1, 52));
/* denormalize the operand */
while (exp < -126) {
@ -1069,9 +1069,9 @@ unsigned32::function::SINGLE:unsigned64 FRS
# round 64bit double to 64bit but single
void::function::Round_Single:cpu *processor, int sign, int *exp, unsigned64 *frac_grx
void::function::Round_Single:cpu *processor, int sign, int *exp, uint64_t *frac_grx
/* comparisons ignore u bits */
unsigned64 out;
uint64_t out;
int inc = 0;
int lsb = EXTRACTED64(*frac_grx, 23, 23);
int gbit = EXTRACTED64(*frac_grx, 24, 24);
@ -1106,7 +1106,7 @@ void::function::Round_Single:cpu *processor, int sign, int *exp, unsigned64 *fra
#
void::function::Round_Integer:cpu *processor, int sign, unsigned64 *frac, int *frac64, int gbit, int rbit, int xbit, fpscreg round_mode
void::function::Round_Integer:cpu *processor, int sign, uint64_t *frac, int *frac64, int gbit, int rbit, int xbit, fpscreg round_mode
int inc = 0;
if (round_mode == fpscr_rn_round_to_nearest) {
if (*frac64 == 1 && gbit == 1) inc = 1;
@ -1130,7 +1130,7 @@ void::function::Round_Integer:cpu *processor, int sign, unsigned64 *frac, int *f
FPSCR_SET_FI(gbit | rbit | xbit);
void::function::Round_Float:cpu *processor, int sign, int *exp, unsigned64 *frac, fpscreg round_mode
void::function::Round_Float:cpu *processor, int sign, int *exp, uint64_t *frac, fpscreg round_mode
int carry_out;
int inc = 0;
int lsb = EXTRACTED64(*frac, 52, 52);
@ -1163,10 +1163,10 @@ void::function::Round_Float:cpu *processor, int sign, int *exp, unsigned64 *frac
# conversion of FP to integer
void::function::convert_to_integer:cpu *processor, unsigned_word cia, unsigned64 *frt, unsigned64 frb, fpscreg round_mode, int tgt_precision
void::function::convert_to_integer:cpu *processor, unsigned_word cia, uint64_t *frt, uint64_t frb, fpscreg round_mode, int tgt_precision
int i;
int exp = 0;
unsigned64 frac = 0;
uint64_t frac = 0;
int frac64 = 0;
int gbit = 0;
int rbit = 0;
@ -1206,16 +1206,16 @@ void::function::convert_to_integer:cpu *processor, unsigned_word cia, unsigned64
frac64 = (frac64 + 1) & 0x1;
}
if (tgt_precision == 32 /* can ignore frac64 in compare */
&& (signed64)frac > (signed64)MASK64(33+1, 63)/*2^31-1 >>1*/)
&& (int64_t)frac > (int64_t)MASK64(33+1, 63)/*2^31-1 >>1*/)
GOTO(Large_Operand);
if (tgt_precision == 64 /* can ignore frac64 in compare */
&& (signed64)frac > (signed64)MASK64(1+1, 63)/*2^63-1 >>1*/)
&& (int64_t)frac > (int64_t)MASK64(1+1, 63)/*2^63-1 >>1*/)
GOTO(Large_Operand);
if (tgt_precision == 32 /* can ignore frac64 in compare */
&& (signed64)frac < (signed64)MASK64(0, 32+1)/*-2^31 >>1*/)
&& (int64_t)frac < (int64_t)MASK64(0, 32+1)/*-2^31 >>1*/)
GOTO(Large_Operand);
if (tgt_precision == 64 /* can ignore frac64 in compare */
&& (signed64)frac < (signed64)MASK64(0, 0+1)/*-2^63 >>1*/)
&& (int64_t)frac < (int64_t)MASK64(0, 0+1)/*-2^63 >>1*/)
GOTO(Large_Operand);
FPSCR_SET_XX(FPSCR & fpscr_fi);
if (tgt_precision == 32)
@ -1284,16 +1284,16 @@ void::function::convert_to_integer:cpu *processor, unsigned_word cia, unsigned64
# extract out raw fields of a FP number
int::function::sign:unsigned64 FRS
int::function::sign:uint64_t FRS
return (MASKED64(FRS, 0, 0)
? -1
: 1);
int::function::biased_exp:unsigned64 frs, int single
int::function::biased_exp:uint64_t frs, int single
if (single)
return EXTRACTED64(frs, 1, 8);
else
return EXTRACTED64(frs, 1, 11);
unsigned64::function::fraction:unsigned64 frs, int single
uint64_t::function::fraction:uint64_t frs, int single
if (single)
return EXTRACTED64(frs, 9, 31);
else
@ -1301,50 +1301,50 @@ unsigned64::function::fraction:unsigned64 frs, int single
# a number?, each of the below return +1 or -1 (based on sign bit)
# if true.
int::function::is_nor:unsigned64 frs, int single
int::function::is_nor:uint64_t frs, int single
int exp = biased_exp(frs, single);
return (exp >= 1
&& exp <= (single ? 254 : 2046));
int::function::is_zero:unsigned64 FRS
int::function::is_zero:uint64_t FRS
return (MASKED64(FRS, 1, 63) == 0
? sign(FRS)
: 0);
int::function::is_den:unsigned64 frs, int single
int::function::is_den:uint64_t frs, int single
int exp = biased_exp(frs, single);
unsigned64 frac = fraction(frs, single);
uint64_t frac = fraction(frs, single);
return (exp == 0 && frac != 0
? sign(frs)
: 0);
int::function::is_inf:unsigned64 frs, int single
int::function::is_inf:uint64_t frs, int single
int exp = biased_exp(frs, single);
unsigned64 frac = fraction(frs, single);
uint64_t frac = fraction(frs, single);
return (exp == (single ? 255 : 2047) && frac == 0
? sign(frs)
: 0);
int::function::is_NaN:unsigned64 frs, int single
int::function::is_NaN:uint64_t frs, int single
int exp = biased_exp(frs, single);
unsigned64 frac = fraction(frs, single);
uint64_t frac = fraction(frs, single);
return (exp == (single ? 255 : 2047) && frac != 0
? sign(frs)
: 0);
int::function::is_SNaN:unsigned64 frs, int single
int::function::is_SNaN:uint64_t frs, int single
return (is_NaN(frs, single)
&& !(frs & (single ? MASK64(9, 9) : MASK64(12, 12)))
? sign(frs)
: 0);
int::function::is_QNaN:unsigned64 frs, int single
int::function::is_QNaN:uint64_t frs, int single
return (is_NaN(frs, single) && !is_SNaN(frs, single));
int::function::is_less_than:unsigned64 *fra, unsigned64 *frb
int::function::is_less_than:uint64_t *fra, uint64_t *frb
return *(double*)fra < *(double*)frb;
int::function::is_greater_than:unsigned64 *fra, unsigned64 *frb
int::function::is_greater_than:uint64_t *fra, uint64_t *frb
return *(double*)fra > *(double*)frb;
int::function::is_equan_to:unsigned64 *fra, unsigned64 *frb
int::function::is_equan_to:uint64_t *fra, uint64_t *frb
return *(double*)fra == *(double*)frb;
# which quiet nan should become the result
unsigned64::function::select_qnan:unsigned64 fra, unsigned64 frb, unsigned64 frc, int instruction_is_frsp, int generate_qnan, int single
unsigned64 frt = 0;
uint64_t::function::select_qnan:uint64_t fra, uint64_t frb, uint64_t frc, int instruction_is_frsp, int generate_qnan, int single
uint64_t frt = 0;
if (is_NaN(fra, single))
frt = fra;
else if (is_NaN(frb, single))
@ -1362,7 +1362,7 @@ unsigned64::function::select_qnan:unsigned64 fra, unsigned64 frb, unsigned64 frc
# detect invalid operation
int::function::is_invalid_operation:cpu *processor, unsigned_word cia, unsigned64 fra, unsigned64 frb, fpscreg check, int single, int negate
int::function::is_invalid_operation:cpu *processor, unsigned_word cia, uint64_t fra, uint64_t frb, fpscreg check, int single, int negate
int fail = 0;
if ((check & fpscr_vxsnan)
&& (is_SNaN(fra, single) || is_SNaN(frb, single))) {
@ -1419,7 +1419,7 @@ int::function::is_invalid_operation:cpu *processor, unsigned_word cia, unsigned6
# handle case of invalid operation
void::function::invalid_arithemetic_operation:cpu *processor, unsigned_word cia, unsigned64 *frt, unsigned64 fra, unsigned64 frb, unsigned64 frc, int instruction_is_frsp, int instruction_is_convert_to_64bit, int instruction_is_convert_to_32bit, int single
void::function::invalid_arithemetic_operation:cpu *processor, unsigned_word cia, uint64_t *frt, uint64_t fra, uint64_t frb, uint64_t frc, int instruction_is_frsp, int instruction_is_convert_to_64bit, int instruction_is_convert_to_32bit, int single
if (FPSCR & fpscr_ve) {
/* invalid operation exception enabled */
/* FRT unchaged */
@ -1448,7 +1448,7 @@ void::function::invalid_arithemetic_operation:cpu *processor, unsigned_word cia,
# detect divide by zero
int::function::is_invalid_zero_divide:cpu *processor, unsigned_word cia, unsigned64 fra, unsigned64 frb, int single
int::function::is_invalid_zero_divide:cpu *processor, unsigned_word cia, uint64_t fra, uint64_t frb, int single
int fail = 0;
if (is_zero (frb)) {
FPSCR_SET_ZX (1);
@ -1460,7 +1460,7 @@ int::function::is_invalid_zero_divide:cpu *processor, unsigned_word cia, unsigne
# handle case of invalid operation
void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia, unsigned64 *frt, unsigned64 fra, unsigned64 frb, int single
void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia, uint64_t *frt, uint64_t fra, uint64_t frb, int single
if (FPSCR & fpscr_ze) {
/* zero-divide exception enabled */
/* FRT unchaged */
@ -2696,9 +2696,9 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 5, 5, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 5, 5, 0
*604: PPC_UNIT_MCIU, PPC_UNIT_MCIU, 4, 4, 0
signed64 a = (signed32)(*rA);
signed64 b = (signed32)(*rB);
signed64 prod = a * b;
int64_t a = (int32_t)(*rA);
int64_t b = (int32_t)(*rB);
int64_t prod = a * b;
signed_word t = prod;
*rT = *rA * *rB;
if (t != prod && OE)
@ -2713,9 +2713,9 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 5, 5, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 5, 5, 0
*604: PPC_UNIT_MCIU, PPC_UNIT_MCIU, 4, 4, 0
signed64 a = (signed32)(*rA);
signed64 b = (signed32)(*rB);
signed64 prod = a * b;
int64_t a = (int32_t)(*rA);
int64_t b = (int32_t)(*rB);
int64_t prod = a * b;
signed_word t = EXTRACTED64(prod, 0, 31);
*rT = t;
CR0_COMPARE(t, 0, Rc);
@ -2728,9 +2728,9 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 6, 6, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 6, 6, 0
*604: PPC_UNIT_MCIU, PPC_UNIT_MCIU, 4, 4, 0
unsigned64 a = (unsigned32)(*rA);
unsigned64 b = (unsigned32)(*rB);
unsigned64 prod = a * b;
uint64_t a = (uint32_t)(*rA);
uint64_t b = (uint32_t)(*rB);
uint64_t prod = a * b;
signed_word t = EXTRACTED64(prod, 0, 31);
*rT = t;
CR0_COMPARE(t, 0, Rc);
@ -2743,8 +2743,8 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 37, 37, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 37, 37, 0
*604: PPC_UNIT_MCIU, PPC_UNIT_MCIU, 20, 20, 0
signed64 dividend = (signed32)(*rA);
signed64 divisor = (signed32)(*rB);
int64_t dividend = (int32_t)(*rA);
int64_t divisor = (int32_t)(*rB);
if (divisor == 0 /* nb 0x8000..0 is sign extended */
|| (dividend == 0x80000000 && divisor == -1)) {
if (OE)
@ -2752,7 +2752,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
CR0_COMPARE(0, 0, Rc);
}
else {
signed64 quotent = dividend / divisor;
int64_t quotent = dividend / divisor;
*rT = quotent;
CR0_COMPARE((signed_word)quotent, 0, Rc);
}
@ -2765,15 +2765,15 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 37, 37, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 37, 37, 0
*604: PPC_UNIT_MCIU, PPC_UNIT_MCIU, 20, 20, 0
unsigned64 dividend = (unsigned32)(*rA);
unsigned64 divisor = (unsigned32)(*rB);
uint64_t dividend = (uint32_t)(*rA);
uint64_t divisor = (uint32_t)(*rB);
if (divisor == 0) {
if (OE)
XER |= (xer_overflow | xer_summary_overflow);
CR0_COMPARE(0, 0, Rc);
}
else {
unsigned64 quotent = dividend / divisor;
uint64_t quotent = dividend / divisor;
*rT = quotent;
CR0_COMPARE((signed_word)quotent, 0, Rc);
}
@ -3088,7 +3088,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
*rA = (signed_word)(signed8)*rS;
*rA = (signed_word)(int8_t)*rS;
CR0_COMPARE(*rA, 0, Rc);
ITRACE(trace_alu, (" Result = %ld (0x%lx)\n", (long)*rA, (long)*rA));
PPC_INSN_INT(RA_BITMASK, RS_BITMASK, Rc);
@ -3098,7 +3098,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
*rA = (signed_word)(signed16)*rS;
*rA = (signed_word)(int16_t)*rS;
CR0_COMPARE(*rA, 0, Rc);
ITRACE(trace_alu, (" Result = %ld (0x%lx)\n", (long)*rA, (long)*rA));
PPC_INSN_INT(RA_BITMASK, RS_BITMASK, Rc);
@ -3108,13 +3108,13 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
# *rA = (signed_word)(signed32)*rS;
# *rA = (signed_word)(int32_t)*rS;
# CR0_COMPARE(*rA, 0, Rc);
0.31,6.RS,11.RA,16./,21.58,31.Rc:X:64::Count Leading Zeros Doubleword
# int count = 0;
# unsigned64 mask = BIT64(0);
# unsigned64 source = *rS;
# uint64_t mask = BIT64(0);
# uint64_t source = *rS;
# while (!(source & mask) && mask != 0) {
# mask >>= 1;
# count++;
@ -3128,8 +3128,8 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
int count = 0;
unsigned32 mask = BIT32(0);
unsigned32 source = *rS;
uint32_t mask = BIT32(0);
uint32_t source = *rS;
while (!(source & mask) && mask != 0) {
mask >>= 1;
count++;
@ -3177,9 +3177,9 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
long n = SH;
unsigned32 s = *rS;
unsigned32 r = ROTL32(s, n);
unsigned32 m = MASK(MB+32, ME+32);
uint32_t s = *rS;
uint32_t r = ROTL32(s, n);
uint32_t m = MASK(MB+32, ME+32);
signed_word result = r & m;
*rA = result;
CR0_COMPARE(result, 0, Rc);
@ -3209,8 +3209,8 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
0.23,6.RS,11.RA,16.RB,21.MB,26.ME,31.Rc:M:::Rotate Left Word then AND with Mask
long n = MASKED(*rB, 59, 63);
unsigned32 r = ROTL32(*rS, n);
unsigned32 m = MASK(MB+32, ME+32);
uint32_t r = ROTL32(*rS, n);
uint32_t m = MASK(MB+32, ME+32);
signed_word result = r & m;
*rA = result;
CR0_COMPARE(result, 0, Rc);
@ -3230,8 +3230,8 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
long n = SH;
unsigned32 r = ROTL32(*rS, n);
unsigned32 m = MASK(MB+32, ME+32);
uint32_t r = ROTL32(*rS, n);
uint32_t m = MASK(MB+32, ME+32);
signed_word result = (r & m) | (*rA & ~m);
*rA = result;
ITRACE(trace_alu, (": n=%ld *rS=0x%lx r=0x%lx m=0x%lx result=0x%lx\n",
@ -3249,7 +3249,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
int n = MASKED(*rB, 58, 63);
unsigned32 source = *rS;
uint32_t source = *rS;
signed_word shifted;
if (n < 32)
shifted = (source << n);
@ -3270,7 +3270,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
int n = MASKED(*rB, 58, 63);
unsigned32 source = *rS;
uint32_t source = *rS;
signed_word shifted;
if (n < 32)
shifted = (source >> n);
@ -3312,18 +3312,18 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*603e:PPC_UNIT_IU, PPC_UNIT_IU, 1, 1, 0
*604: PPC_UNIT_SCIU1, PPC_UNIT_SCIU2, 1, 1, 0
unsigned64 mask;
uint64_t mask;
int n = MASKED(*rB, 59, 63);
signed32 source = (signed32)*rS; /* signed to keep sign bit */
int32_t source = (int32_t)*rS; /* signed to keep sign bit */
int S = (MASKED(*rS,32,32) != 0);
signed64 r = ((unsigned64) source);
r = ((unsigned64) source) << 32 | (unsigned32) source;
int64_t r = ((uint64_t) source);
r = ((uint64_t) source) << 32 | (uint32_t) source;
r = ROTL64(r,64-n);
if (MASKED(*rB,58,58) == 0)
mask = (unsigned64) MASK64(n+32,63);
mask = (uint64_t) MASK64(n+32,63);
else
mask = (unsigned64) 0;
*rA = (signed_word) ((r & mask) | (((signed64) -1*S) & ~mask)); /* if 64bit will sign extend */
mask = (uint64_t) 0;
*rA = (signed_word) ((r & mask) | (((int64_t) -1*S) & ~mask)); /* if 64bit will sign extend */
if (S && (MASKED(r & ~mask,32,63)!=0))
XER |= xer_carry;
else
@ -3450,7 +3450,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_SRU, PPC_UNIT_SRU, 1, 1, 0
*603e:PPC_UNIT_SRU, PPC_UNIT_SRU, 1, 1, 0
*604: PPC_UNIT_MCIU, PPC_UNIT_MCIU, 3, 3, 0
*rT = (unsigned32)CR;
*rT = (uint32_t)CR;
PPC_INSN_MFCR(RT_BITMASK);
#
@ -3971,7 +3971,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
fpscr_vxsnan | fpscr_vximz,
0, /*single?*/
0) /*negate?*/) {
union { double d; unsigned64 u; } tmp;
union { double d; uint64_t u; } tmp;
invalid_arithemetic_operation(processor, cia,
&tmp.u, *frA, 0, *frC,
0, /*instruction_is_frsp*/
@ -4018,7 +4018,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
fpscr_vxsnan | fpscr_vximz,
1, /*single?*/
0) /*negate?*/) {
union { double d; unsigned64 u; } tmp;
union { double d; uint64_t u; } tmp;
invalid_arithemetic_operation(processor, cia,
&tmp.u, *frA, 0, *frC,
0, /*instruction_is_frsp*/
@ -4065,7 +4065,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
fpscr_vxsnan | fpscr_vximz,
0, /*single?*/
0) /*negate?*/) {
union { double d; unsigned64 u; } tmp;
union { double d; uint64_t u; } tmp;
invalid_arithemetic_operation(processor, cia,
&tmp.u, *frA, 0, *frC,
0, /*instruction_is_frsp*/
@ -4112,7 +4112,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
fpscr_vxsnan | fpscr_vximz,
1, /*single?*/
0) /*negate?*/) {
union { double d; unsigned64 u; } tmp;
union { double d; uint64_t u; } tmp;
invalid_arithemetic_operation(processor, cia,
&tmp.u, *frA, 0, *frC,
0, /*instruction_is_frsp*/
@ -4159,7 +4159,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
fpscr_vxsnan | fpscr_vximz,
0, /*single?*/
0) /*negate?*/) {
union { double d; unsigned64 u; } tmp;
union { double d; uint64_t u; } tmp;
invalid_arithemetic_operation(processor, cia,
&tmp.u, *frA, 0, *frC,
0, /*instruction_is_frsp*/
@ -4206,7 +4206,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
fpscr_vxsnan | fpscr_vximz,
1, /*single?*/
0) /*negate?*/) {
union { double d; unsigned64 u; } tmp;
union { double d; uint64_t u; } tmp;
invalid_arithemetic_operation(processor, cia,
&tmp.u, *frA, 0, *frC,
0, /*instruction_is_frsp*/
@ -4253,7 +4253,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
fpscr_vxsnan | fpscr_vximz,
0, /*single?*/
0) /*negate?*/) {
union { double d; unsigned64 u; } tmp;
union { double d; uint64_t u; } tmp;
invalid_arithemetic_operation(processor, cia,
&tmp.u, *frA, 0, *frC,
0, /*instruction_is_frsp*/
@ -4300,7 +4300,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
fpscr_vxsnan | fpscr_vximz,
1, /*single?*/
0) /*negate?*/) {
union { double d; unsigned64 u; } tmp;
union { double d; uint64_t u; } tmp;
invalid_arithemetic_operation(processor, cia,
&tmp.u, *frA, 0, *frC,
0, /*instruction_is_frsp*/
@ -4346,7 +4346,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*604: PPC_UNIT_FPU, PPC_UNIT_FPU, 1, 3, 0
int sign;
int exp;
unsigned64 frac_grx;
uint64_t frac_grx;
/***/
/* split off cases for what to do */
if (EXTRACTED64(*frB, 1, 11) < 897
@ -4582,7 +4582,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
0.63,6.FRT,11./,16.FRB,21.846,31.Rc:X:64,f::Floating Convert from Integer Doubleword
int sign = EXTRACTED64(*frB, 0, 0);
int exp = 63;
unsigned64 frac = *frB;
uint64_t frac = *frB;
/***/
if (frac == 0) GOTO(Zero_Operand);
if (sign == 1) frac = ~frac + 1;
@ -4699,13 +4699,13 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
0.63,6.BT,11./,16./,21.70,31.Rc:X:f::Move To FPSCR Bit 0
FPSCR_BEGIN;
unsigned32 bit = BIT32(BT);
uint32_t bit = BIT32(BT);
FPSCR &= ~bit;
FPSCR_END(Rc);
0.63,6.BT,11./,16./,21.38,31.Rc:X:f::Move To FPSCR Bit 1
FPSCR_BEGIN;
unsigned32 bit = BIT32(BT);
uint32_t bit = BIT32(BT);
if (bit & fpscr_fi)
bit |= fpscr_xx;
if ((bit & fpscr_vx_bits))
@ -4744,7 +4744,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
if (CURRENT_MODEL == MODEL_ppc601) {
program_interrupt(processor, cia, optional_instruction_program_interrupt);
} else {
unsigned64 zero = 0;
uint64_t zero = 0;
FPSCR_BEGIN;
if (is_NaN(*frA, 0) || is_less_than (frA, &zero)) *frT = *frB;
else *frT = *frC;

View File

@ -873,7 +873,7 @@ psim_read_register(psim *system,
break;
case reg_evr:
*(unsigned64*)cooked_buf = EVR(description.index);
*(uint64_t*)cooked_buf = EVR(description.index);
break;
case reg_acc:
@ -1046,8 +1046,8 @@ psim_write_register(psim *system,
case reg_evr:
{
unsigned64 v;
v = *(unsigned64*)cooked_buf;
uint64_t v;
v = *(uint64_t*)cooked_buf;
cpu_registers(processor)->e500.gprh[description.index] = v >> 32;
cpu_registers(processor)->gpr[description.index] = v;
break;

View File

@ -155,7 +155,7 @@ register_description(const char reg[])
else if (reg[0] == 'e' && reg[1] == 'v' && are_digits(reg + 2)) {
description.type = reg_evr;
description.index = atoi(reg+2);
description.size = sizeof(unsigned64);
description.size = sizeof(uint64_t);
}
else if (reg[0] == 'r' && reg[1] == 'h' && are_digits(reg + 2)) {
description.type = reg_gprh;
@ -165,7 +165,7 @@ register_description(const char reg[])
else if (!strcmp(reg, "acc")) {
description.type = reg_acc;
description.index = 0;
description.size = sizeof(unsigned64);
description.size = sizeof(uint64_t);
}
#endif
else {

View File

@ -53,7 +53,7 @@ typedef signed_word gpreg;
** Floating Point Registers
**/
typedef unsigned64 fpreg;
typedef uint64_t fpreg;
@ -62,7 +62,7 @@ typedef unsigned64 fpreg;
**
**/
typedef unsigned32 creg;
typedef uint32_t creg;
/* The following sub bits are defined for the condition register */
enum {
@ -106,7 +106,7 @@ enum {
** Floating-Point Status and Control Register
**/
typedef unsigned32 fpscreg;
typedef uint32_t fpscreg;
enum {
fpscr_fx_bit = 0,
fpscr_fx = BIT32(0),
@ -170,7 +170,7 @@ enum {
** XER Register
**/
typedef unsigned32 xereg;
typedef uint32_t xereg;
enum {
xer_summary_overflow = BIT32(0), xer_summary_overflow_bit = 0,
@ -192,7 +192,7 @@ enum {
** Segment Registers
**/
typedef unsigned32 sreg;
typedef uint32_t sreg;
enum {
nr_of_srs = 16
};

View File

@ -1,6 +1,6 @@
#include "sim-basics.h"
typedef unsigned32 sim_cia;
typedef uint32_t sim_cia;
#include "sim-base.h"

View File

@ -855,7 +855,7 @@ tree_parse(device *current,
break;
case '[':
{
unsigned8 words[1024];
uint8_t words[1024];
char *curr = spec.value + 1;
int nr_words = 0;
while (1) {
@ -1050,7 +1050,7 @@ print_properties(device *me)
}
}
else {
unsigned8 *w = (unsigned8*)property->array;
uint8_t *w = (uint8_t*)property->array;
printf_filtered(" [");
while ((char*)w - (char*)property->array < property->sizeof_array) {
printf_filtered(" 0x%2x", BE2H_1(*w));

View File

@ -27,8 +27,8 @@
/* TYPES:
signed* signed type of the given size
unsigned* The corresponding insigned type
intNN_t Signed type of the given bit size
uintNN_t The corresponding unsigned type
SIZES
@ -47,27 +47,16 @@
#include <stdint.h>
/* bit based */
typedef int8_t signed8;
typedef int16_t signed16;
typedef int32_t signed32;
typedef int64_t signed64;
typedef uint8_t unsigned8;
typedef uint16_t unsigned16;
typedef uint32_t unsigned32;
typedef uint64_t unsigned64;
/* byte based */
typedef signed8 signed_1;
typedef signed16 signed_2;
typedef signed32 signed_4;
typedef signed64 signed_8;
typedef int8_t signed_1;
typedef int16_t signed_2;
typedef int32_t signed_4;
typedef int64_t signed_8;
typedef unsigned8 unsigned_1;
typedef unsigned16 unsigned_2;
typedef unsigned32 unsigned_4;
typedef unsigned64 unsigned_8;
typedef uint8_t unsigned_1;
typedef uint16_t unsigned_2;
typedef uint32_t unsigned_4;
typedef uint64_t unsigned_8;
/* for general work, the following are defined */
@ -78,19 +67,19 @@ typedef unsigned64 unsigned_8;
/* target architecture based */
#if (WITH_TARGET_WORD_BITSIZE == 64)
typedef unsigned64 unsigned_word;
typedef signed64 signed_word;
typedef uint64_t unsigned_word;
typedef int64_t signed_word;
#else
typedef unsigned32 unsigned_word;
typedef signed32 signed_word;
typedef uint32_t unsigned_word;
typedef int32_t signed_word;
#endif
/* Other instructions */
typedef unsigned32 instruction_word;
typedef uint32_t instruction_word;
/* IEEE 1275 cell size - only support 32bit mode at present */
typedef unsigned32 unsigned_cell;
typedef signed32 signed_cell;
typedef uint32_t unsigned_cell;
typedef int32_t signed_cell;
#endif /* _WORDS_H_ */