@ -32,23 +32,23 @@ int old_segment_mapping;
unsigned long ins_type_counters [ ( int ) INS_MAX ] ;
uint16 OP [ 4 ] ;
uint16_t OP [ 4 ] ;
static long hash ( long insn , int format ) ;
static struct hash_entry * lookup_hash ( SIM_DESC , SIM_CPU * , uint32 ins , int size ) ;
static void get_operands ( struct simops * s , uint32 ins ) ;
static void do_long ( SIM_DESC , SIM_CPU * , uint32 ins ) ;
static void do_2_short ( SIM_DESC , SIM_CPU * , uint16 ins1 , uint16 ins2 , enum _leftright leftright ) ;
static void do_parallel ( SIM_DESC , SIM_CPU * , uint16 ins1 , uint16 ins2 ) ;
static struct hash_entry * lookup_hash ( SIM_DESC , SIM_CPU * , uint32_t ins , int size ) ;
static void get_operands ( struct simops * s , uint32_t ins ) ;
static void do_long ( SIM_DESC , SIM_CPU * , uint32_t ins ) ;
static void do_2_short ( SIM_DESC , SIM_CPU * , uint16_t ins1 , uint16_t ins2 , enum _leftright leftright ) ;
static void do_parallel ( SIM_DESC , SIM_CPU * , uint16_t ins1 , uint16_t ins2 ) ;
static char * add_commas ( char * buf , int sizeof_buf , unsigned long value ) ;
static INLINE uint8 * map_memory ( SIM_DESC , SIM_CPU * , unsigned phys_addr ) ;
static INLINE uint8_t * map_memory ( SIM_DESC , SIM_CPU * , unsigned phys_addr ) ;
# define MAX_HASH 63
struct hash_entry
{
struct hash_entry * next ;
uint32 opcode ;
uint32 mask ;
uint32_t opcode ;
uint32_t mask ;
int size ;
struct simops * ops ;
} ;
@ -65,7 +65,7 @@ hash (long insn, int format)
}
INLINE static struct hash_entry *
lookup_hash ( SIM_DESC sd , SIM_CPU * cpu , uint32 ins , int size )
lookup_hash ( SIM_DESC sd , SIM_CPU * cpu , uint32_t ins , int size )
{
struct hash_entry * h ;
@ -84,10 +84,10 @@ lookup_hash (SIM_DESC sd, SIM_CPU *cpu, uint32 ins, int size)
}
INLINE static void
get_operands ( struct simops * s , uint32 ins )
get_operands ( struct simops * s , uint32_t ins )
{
int i , shift , bits , flags ;
uint32 mask ;
uint32_t mask ;
for ( i = 0 ; i < s - > numops ; i + + )
{
shift = s - > operands [ 3 * i ] ;
@ -102,7 +102,7 @@ get_operands (struct simops *s, uint32 ins)
}
static void
do_long ( SIM_DESC sd , SIM_CPU * cpu , uint32 ins )
do_long ( SIM_DESC sd , SIM_CPU * cpu , uint32_t ins )
{
struct hash_entry * h ;
# ifdef DEBUG
@ -119,7 +119,7 @@ do_long (SIM_DESC sd, SIM_CPU *cpu, uint32 ins)
}
static void
do_2_short ( SIM_DESC sd , SIM_CPU * cpu , uint16 ins1 , uint16 ins2 , enum _leftright leftright )
do_2_short ( SIM_DESC sd , SIM_CPU * cpu , uint16_t ins1 , uint16_t ins2 , enum _leftright leftright )
{
struct hash_entry * h ;
enum _ins_type first , second ;
@ -171,7 +171,7 @@ do_2_short (SIM_DESC sd, SIM_CPU *cpu, uint16 ins1, uint16 ins2, enum _leftright
}
static void
do_parallel ( SIM_DESC sd , SIM_CPU * cpu , uint16 ins1 , uint16 ins2 )
do_parallel ( SIM_DESC sd , SIM_CPU * cpu , uint16_t ins1 , uint16_t ins2 )
{
struct hash_entry * h1 , * h2 ;
# ifdef DEBUG
@ -293,7 +293,7 @@ enum
static void
set_dmap_register ( SIM_DESC sd , int reg_nr , unsigned long value )
{
uint8 * raw = map_memory ( sd , NULL , SIM_D10V_MEMORY_DATA
uint8_t * raw = map_memory ( sd , NULL , SIM_D10V_MEMORY_DATA
+ DMAP0_OFFSET + 2 * reg_nr ) ;
WRITE_16 ( raw , value ) ;
# ifdef DEBUG
@ -307,7 +307,7 @@ set_dmap_register (SIM_DESC sd, int reg_nr, unsigned long value)
static unsigned long
dmap_register ( SIM_DESC sd , SIM_CPU * cpu , void * regcache , int reg_nr )
{
uint8 * raw = map_memory ( sd , cpu , SIM_D10V_MEMORY_DATA
uint8_t * raw = map_memory ( sd , cpu , SIM_D10V_MEMORY_DATA
+ DMAP0_OFFSET + 2 * reg_nr ) ;
return READ_16 ( raw ) ;
}
@ -315,7 +315,7 @@ dmap_register (SIM_DESC sd, SIM_CPU *cpu, void *regcache, int reg_nr)
static void
set_imap_register ( SIM_DESC sd , int reg_nr , unsigned long value )
{
uint8 * raw = map_memory ( sd , NULL , SIM_D10V_MEMORY_DATA
uint8_t * raw = map_memory ( sd , NULL , SIM_D10V_MEMORY_DATA
+ IMAP0_OFFSET + 2 * reg_nr ) ;
WRITE_16 ( raw , value ) ;
# ifdef DEBUG
@ -329,7 +329,7 @@ set_imap_register (SIM_DESC sd, int reg_nr, unsigned long value)
static unsigned long
imap_register ( SIM_DESC sd , SIM_CPU * cpu , void * regcache , int reg_nr )
{
uint8 * raw = map_memory ( sd , cpu , SIM_D10V_MEMORY_DATA
uint8_t * raw = map_memory ( sd , cpu , SIM_D10V_MEMORY_DATA
+ IMAP0_OFFSET + 2 * reg_nr ) ;
return READ_16 ( raw ) ;
}
@ -597,11 +597,11 @@ sim_d10v_translate_addr (SIM_DESC sd,
is assumed that the client has already ensured that the access
isn ' t going to cross a segment boundary . */
uint8 *
uint8_t *
map_memory ( SIM_DESC sd , SIM_CPU * cpu , unsigned phys_addr )
{
uint8 * * memory ;
uint8 * raw ;
uint8_t * * memory ;
uint8_t * raw ;
unsigned offset ;
int segment = ( ( phys_addr > > 24 ) & 0xff ) ;
@ -669,7 +669,7 @@ xfer_mem (SIM_DESC sd,
int size ,
int write_p )
{
uint8 * memory ;
uint8_t * memory ;
unsigned long phys ;
int phys_size ;
phys_size = sim_d10v_translate_addr ( sd , NULL , virt , size , & phys , NULL ,
@ -866,16 +866,16 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
return sd ;
}
uint8 *
dmem_addr ( SIM_DESC sd , SIM_CPU * cpu , uint16 offset )
uint8_t *
dmem_addr ( SIM_DESC sd , SIM_CPU * cpu , uint16_t offset )
{
unsigned long phys ;
uint8 * mem ;
uint8_t * mem ;
int phys_size ;
/* Note: DMEM address range is 0..0x10000. Calling code can compute
things like ` ` 0xfffe + 0x0e60 = = 0x10e5d ' ' . Since offset ' s type
is uint16 this is modulo ' ed onto 0x0e5d . */
is uint16_t this is modulo ' ed onto 0x0e5d . */
phys_size = sim_d10v_translate_dmap_addr ( sd , cpu , offset , 1 , & phys , NULL ,
dmap_register ) ;
@ -896,11 +896,11 @@ dmem_addr (SIM_DESC sd, SIM_CPU *cpu, uint16 offset)
return mem ;
}
uint8 *
imem_addr ( SIM_DESC sd , SIM_CPU * cpu , uint32 offset )
uint8_t *
imem_addr ( SIM_DESC sd , SIM_CPU * cpu , uint32_t offset )
{
unsigned long phys ;
uint8 * mem ;
uint8_t * mem ;
int phys_size = sim_d10v_translate_imap_addr ( sd , cpu , offset , 1 , & phys , NULL ,
imap_register ) ;
if ( phys_size = = 0 )
@ -923,12 +923,12 @@ imem_addr (SIM_DESC sd, SIM_CPU *cpu, uint32 offset)
static void
step_once ( SIM_DESC sd , SIM_CPU * cpu )
{
uint32 inst ;
uint8 * iaddr ;
uint32_t inst ;
uint8_t * iaddr ;
/* TODO: Unindent this block. */
{
iaddr = imem_addr ( sd , cpu , ( uint32 ) PC < < 2 ) ;
iaddr = imem_addr ( sd , cpu , ( uint32_t ) PC < < 2 ) ;
inst = get_longword ( iaddr ) ;