sim: d10v: clean up misc warnings
This commit is contained in:
parent
ef9535c6bc
commit
11558abc20
6 changed files with 240 additions and 285 deletions
|
@ -1,3 +1,28 @@
|
|||
2015-03-30 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Makefile.in (gencode.o, d10v-opc.o): Add $(WARN_CFLAGS).
|
||||
(gencode): Add $(BUILD_LDFLAGS).
|
||||
* endian.c (get_word, get_longword, get_longlong, write_word,
|
||||
write_longword, write_longlong): Convert old style prototypes.
|
||||
* gencode.c: Include string.h.
|
||||
(main): Convert old style prototype.
|
||||
(write_header): Convert old style prototype and fix printf format.
|
||||
(write_template, write_opcodes): Likewise.
|
||||
(check_opcodes): Mark static void.
|
||||
* interp.c: Include inttypes.h and run-sim.h.
|
||||
(hash, lookup_hash, decode_pc, do_long, do_2_short, do_parallel,
|
||||
add_commas, sim_size, sim_write, sim_read, sim_open, sim_close,
|
||||
sim_set_profile, sim_set_profile_size, sim_stop, +sim_resume,
|
||||
sim_info, sim_set_callbacks, sim_stop_reason, sim_fetch_register,
|
||||
sim_store_register, sim_do_command, sim_load): Convert old style
|
||||
prototypes.
|
||||
(sim_create_inferior): Fix pointer cast to use uintptr_t.
|
||||
* simops.c (strrchr): Delete prototype.
|
||||
(trace_input_func): Mark name static.
|
||||
(trace_input_func, trace_output_void, trace_output_flag): Convert old style
|
||||
prototypes.
|
||||
(OP_*): Convert old style prototypes.
|
||||
|
||||
2015-03-30 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Makefile.in (interp.o, simops.o, endian.o, table.o): Delete rules.
|
||||
|
|
|
@ -40,13 +40,13 @@ table.c: gencode simops.h
|
|||
./gencode >$@
|
||||
|
||||
gencode.o: gencode.c $(INCLUDE)
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gencode.c
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(WARN_CFLAGS) -c $(srcdir)/gencode.c
|
||||
|
||||
d10v-opc.o: $(srcdir)/../../opcodes/d10v-opc.c
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/../../opcodes/d10v-opc.c
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(WARN_CFLAGS) -c $(srcdir)/../../opcodes/d10v-opc.c
|
||||
|
||||
gencode: gencode.o d10v-opc.o
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -o gencode gencode.o d10v-opc.o $(BUILD_LIB)
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o gencode gencode.o d10v-opc.o $(BUILD_LIB)
|
||||
|
||||
clean-extra:
|
||||
rm -f table.c simops.h gencode
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
#endif
|
||||
|
||||
ENDIAN_INLINE uint16
|
||||
get_word (x)
|
||||
uint8 *x;
|
||||
get_word (uint8 *x)
|
||||
{
|
||||
#if (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__)
|
||||
|
||||
|
@ -28,8 +27,7 @@ get_word (x)
|
|||
}
|
||||
|
||||
ENDIAN_INLINE uint32
|
||||
get_longword (x)
|
||||
uint8 *x;
|
||||
get_longword (uint8 *x)
|
||||
{
|
||||
#if (defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__) && defined(USE_BSWAP)
|
||||
|
||||
|
@ -62,8 +60,7 @@ get_longword (x)
|
|||
}
|
||||
|
||||
ENDIAN_INLINE int64
|
||||
get_longlong (x)
|
||||
uint8 *x;
|
||||
get_longlong (uint8 *x)
|
||||
{
|
||||
uint32 top = get_longword (x);
|
||||
uint32 bottom = get_longword (x+4);
|
||||
|
@ -71,9 +68,7 @@ get_longlong (x)
|
|||
}
|
||||
|
||||
ENDIAN_INLINE void
|
||||
write_word (addr, data)
|
||||
uint8 *addr;
|
||||
uint16 data;
|
||||
write_word (uint8 *addr, uint16 data)
|
||||
{
|
||||
#if (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__)
|
||||
|
||||
|
@ -92,9 +87,7 @@ write_word (addr, data)
|
|||
}
|
||||
|
||||
ENDIAN_INLINE void
|
||||
write_longword (addr, data)
|
||||
uint8 *addr;
|
||||
uint32 data;
|
||||
write_longword (uint8 *addr, uint32 data)
|
||||
{
|
||||
#if (defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__) && defined(USE_BSWAP)
|
||||
|
||||
|
@ -128,9 +121,7 @@ write_longword (addr, data)
|
|||
}
|
||||
|
||||
ENDIAN_INLINE void
|
||||
write_longlong (addr, data)
|
||||
uint8 *addr;
|
||||
int64 data;
|
||||
write_longlong (uint8 *addr, int64 data)
|
||||
{
|
||||
write_longword (addr, (uint32)(data >> 32));
|
||||
write_longword (addr+4, (uint32)data);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include "ansidecl.h"
|
||||
#include "opcode/d10v.h"
|
||||
|
||||
|
@ -10,9 +11,7 @@ static void write_opcodes (void);
|
|||
static void write_template (void);
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
if ((argc > 1) && (strcmp (argv[1],"-h") == 0))
|
||||
write_header();
|
||||
|
@ -25,13 +24,13 @@ main (argc, argv)
|
|||
|
||||
|
||||
static void
|
||||
write_header ()
|
||||
write_header (void)
|
||||
{
|
||||
struct d10v_opcode *opcode;
|
||||
|
||||
for (opcode = (struct d10v_opcode *)d10v_opcodes; opcode->name; opcode++)
|
||||
if (opcode->format != OPCODE_FAKE)
|
||||
printf("void OP_%X (void);\t\t/* %s */\n",opcode->opcode, opcode->name);
|
||||
printf("void OP_%lX (void);\t\t/* %s */\n", opcode->opcode, opcode->name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +38,7 @@ write_header ()
|
|||
/* to be filled out */
|
||||
|
||||
static void
|
||||
write_template ()
|
||||
write_template (void)
|
||||
{
|
||||
struct d10v_opcode *opcode;
|
||||
int i,j;
|
||||
|
@ -51,7 +50,7 @@ write_template ()
|
|||
{
|
||||
if (opcode->format != OPCODE_FAKE)
|
||||
{
|
||||
printf("/* %s */\nvoid\nOP_%X ()\n{\n",opcode->name,opcode->opcode);
|
||||
printf("/* %s */\nvoid\nOP_%lX ()\n{\n", opcode->name, opcode->opcode);
|
||||
|
||||
/* count operands */
|
||||
j = 0;
|
||||
|
@ -87,18 +86,18 @@ write_template ()
|
|||
long Opcodes[512];
|
||||
static int curop=0;
|
||||
|
||||
static void
|
||||
check_opcodes( long op)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<curop;i++)
|
||||
if (Opcodes[i] == op)
|
||||
fprintf(stderr,"DUPLICATE OPCODES: %x\n",op);
|
||||
fprintf(stderr,"DUPLICATE OPCODES: %lx\n", op);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
write_opcodes ()
|
||||
write_opcodes (void)
|
||||
{
|
||||
struct d10v_opcode *opcode;
|
||||
int i, j;
|
||||
|
@ -112,7 +111,7 @@ write_opcodes ()
|
|||
{
|
||||
if (opcode->format != OPCODE_FAKE)
|
||||
{
|
||||
printf (" { %ld,%d,%ld,%d,%d,%d,%d,OP_%X,", opcode->opcode,
|
||||
printf (" { %ld,%d,%ld,%d,%d,%d,%d,OP_%lX,", opcode->opcode,
|
||||
(opcode->format & LONG_OPCODE) ? 1 : 0, opcode->mask, opcode->format,
|
||||
opcode->cycles, opcode->unit, opcode->exec_type, opcode->opcode);
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "config.h"
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
#include "bfd.h"
|
||||
#include "gdb/callback.h"
|
||||
#include "gdb/remote-sim.h"
|
||||
#include "run-sim.h"
|
||||
|
||||
#include "d10v_sim.h"
|
||||
#include "gdb/sim-d10v.h"
|
||||
|
@ -86,9 +88,7 @@ struct hash_entry
|
|||
struct hash_entry hash_table[MAX_HASH+1];
|
||||
|
||||
INLINE static long
|
||||
hash(insn, format)
|
||||
long insn;
|
||||
int format;
|
||||
hash (long insn, int format)
|
||||
{
|
||||
if (format & LONG_OPCODE)
|
||||
return ((insn & 0x3F000000) >> 24);
|
||||
|
@ -97,9 +97,7 @@ hash(insn, format)
|
|||
}
|
||||
|
||||
INLINE static struct hash_entry *
|
||||
lookup_hash (ins, size)
|
||||
uint32 ins;
|
||||
int size;
|
||||
lookup_hash (uint32 ins, int size)
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
|
@ -140,7 +138,7 @@ get_operands (struct simops *s, uint32 ins)
|
|||
}
|
||||
|
||||
bfd_vma
|
||||
decode_pc ()
|
||||
decode_pc (void)
|
||||
{
|
||||
asection *s;
|
||||
if (!init_text_p && prog_bfd != NULL)
|
||||
|
@ -160,8 +158,7 @@ decode_pc ()
|
|||
}
|
||||
|
||||
static void
|
||||
do_long (ins)
|
||||
uint32 ins;
|
||||
do_long (uint32 ins)
|
||||
{
|
||||
struct hash_entry *h;
|
||||
#ifdef DEBUG
|
||||
|
@ -178,9 +175,7 @@ do_long (ins)
|
|||
}
|
||||
|
||||
static void
|
||||
do_2_short (ins1, ins2, leftright)
|
||||
uint16 ins1, ins2;
|
||||
enum _leftright leftright;
|
||||
do_2_short (uint16 ins1, uint16 ins2, enum _leftright leftright)
|
||||
{
|
||||
struct hash_entry *h;
|
||||
enum _ins_type first, second;
|
||||
|
@ -232,8 +227,7 @@ do_2_short (ins1, ins2, leftright)
|
|||
}
|
||||
|
||||
static void
|
||||
do_parallel (ins1, ins2)
|
||||
uint16 ins1, ins2;
|
||||
do_parallel (uint16 ins1, uint16 ins2)
|
||||
{
|
||||
struct hash_entry *h1, *h2;
|
||||
#ifdef DEBUG
|
||||
|
@ -299,10 +293,7 @@ do_parallel (ins1, ins2)
|
|||
}
|
||||
|
||||
static char *
|
||||
add_commas(buf, sizeof_buf, value)
|
||||
char *buf;
|
||||
int sizeof_buf;
|
||||
unsigned long value;
|
||||
add_commas (char *buf, int sizeof_buf, unsigned long value)
|
||||
{
|
||||
int comma = 3;
|
||||
char *endbuf = buf + sizeof_buf - 1;
|
||||
|
@ -322,9 +313,7 @@ add_commas(buf, sizeof_buf, value)
|
|||
}
|
||||
|
||||
void
|
||||
sim_size (power)
|
||||
int power;
|
||||
|
||||
sim_size (int power)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < IMEM_SEGMENTS; i++)
|
||||
|
@ -770,22 +759,14 @@ xfer_mem (SIM_ADDR virt,
|
|||
|
||||
|
||||
int
|
||||
sim_write (sd, addr, buffer, size)
|
||||
SIM_DESC sd;
|
||||
SIM_ADDR addr;
|
||||
const unsigned char *buffer;
|
||||
int size;
|
||||
sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size)
|
||||
{
|
||||
/* FIXME: this should be performing a virtual transfer */
|
||||
return xfer_mem( addr, buffer, size, 1);
|
||||
}
|
||||
|
||||
int
|
||||
sim_read (sd, addr, buffer, size)
|
||||
SIM_DESC sd;
|
||||
SIM_ADDR addr;
|
||||
unsigned char *buffer;
|
||||
int size;
|
||||
sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
|
||||
{
|
||||
/* FIXME: this should be performing a virtual transfer */
|
||||
return xfer_mem( addr, buffer, size, 0);
|
||||
|
@ -793,11 +774,7 @@ sim_read (sd, addr, buffer, size)
|
|||
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind, callback, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *callback;
|
||||
struct bfd *abfd;
|
||||
char **argv;
|
||||
sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, char **argv)
|
||||
{
|
||||
struct simops *s;
|
||||
struct hash_entry *h;
|
||||
|
@ -863,9 +840,7 @@ sim_open (kind, callback, abfd, argv)
|
|||
|
||||
|
||||
void
|
||||
sim_close (sd, quitting)
|
||||
SIM_DESC sd;
|
||||
int quitting;
|
||||
sim_close (SIM_DESC sd, int quitting)
|
||||
{
|
||||
if (prog_bfd != NULL && prog_bfd_was_opened_p)
|
||||
{
|
||||
|
@ -876,15 +851,13 @@ sim_close (sd, quitting)
|
|||
}
|
||||
|
||||
void
|
||||
sim_set_profile (n)
|
||||
int n;
|
||||
sim_set_profile (int n)
|
||||
{
|
||||
(*d10v_callback->printf_filtered) (d10v_callback, "sim_set_profile %d\n",n);
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_profile_size (n)
|
||||
int n;
|
||||
sim_set_profile_size (int n)
|
||||
{
|
||||
(*d10v_callback->printf_filtered) (d10v_callback, "sim_set_profile_size %d\n",n);
|
||||
}
|
||||
|
@ -951,8 +924,7 @@ imem_addr (uint32 offset)
|
|||
static int stop_simulator = 0;
|
||||
|
||||
int
|
||||
sim_stop (sd)
|
||||
SIM_DESC sd;
|
||||
sim_stop (SIM_DESC sd)
|
||||
{
|
||||
stop_simulator = 1;
|
||||
return 1;
|
||||
|
@ -961,9 +933,7 @@ sim_stop (sd)
|
|||
|
||||
/* Run (or resume) the program. */
|
||||
void
|
||||
sim_resume (sd, step, siggnal)
|
||||
SIM_DESC sd;
|
||||
int step, siggnal;
|
||||
sim_resume (SIM_DESC sd, int step, int siggnal)
|
||||
{
|
||||
uint32 inst;
|
||||
uint8 *iaddr;
|
||||
|
@ -1096,9 +1066,7 @@ sim_set_trace (void)
|
|||
}
|
||||
|
||||
void
|
||||
sim_info (sd, verbose)
|
||||
SIM_DESC sd;
|
||||
int verbose;
|
||||
sim_info (SIM_DESC sd, int verbose)
|
||||
{
|
||||
char buf1[40];
|
||||
char buf2[40];
|
||||
|
@ -1201,16 +1169,12 @@ sim_info (sd, verbose)
|
|||
}
|
||||
|
||||
SIM_RC
|
||||
sim_create_inferior (sd, abfd, argv, env)
|
||||
SIM_DESC sd;
|
||||
struct bfd *abfd;
|
||||
char **argv;
|
||||
char **env;
|
||||
sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
|
||||
{
|
||||
bfd_vma start_address;
|
||||
|
||||
/* reset all state information */
|
||||
memset (&State.regs, 0, (int)&State.mem - (int)&State.regs);
|
||||
memset (&State.regs, 0, (uintptr_t)&State.mem - (uintptr_t)&State.regs);
|
||||
|
||||
/* There was a hack here to copy the values of argc and argv into r0
|
||||
and r1. The values were also saved into some high memory that
|
||||
|
@ -1262,8 +1226,7 @@ sim_create_inferior (sd, abfd, argv, env)
|
|||
|
||||
|
||||
void
|
||||
sim_set_callbacks (p)
|
||||
host_callback *p;
|
||||
sim_set_callbacks (host_callback *p)
|
||||
{
|
||||
d10v_callback = p;
|
||||
}
|
||||
|
@ -1277,10 +1240,7 @@ sim_trace (SIM_DESC sd)
|
|||
}
|
||||
|
||||
void
|
||||
sim_stop_reason (sd, reason, sigrc)
|
||||
SIM_DESC sd;
|
||||
enum sim_stop *reason;
|
||||
int *sigrc;
|
||||
sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
|
||||
{
|
||||
/* (*d10v_callback->printf_filtered) (d10v_callback, "sim_stop_reason: PC=0x%x\n",PC<<2); */
|
||||
|
||||
|
@ -1314,11 +1274,7 @@ sim_stop_reason (sd, reason, sigrc)
|
|||
}
|
||||
|
||||
int
|
||||
sim_fetch_register (sd, rn, memory, length)
|
||||
SIM_DESC sd;
|
||||
int rn;
|
||||
unsigned char *memory;
|
||||
int length;
|
||||
sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
|
||||
{
|
||||
int size;
|
||||
switch ((enum sim_d10v_regs) rn)
|
||||
|
@ -1401,11 +1357,7 @@ sim_fetch_register (sd, rn, memory, length)
|
|||
}
|
||||
|
||||
int
|
||||
sim_store_register (sd, rn, memory, length)
|
||||
SIM_DESC sd;
|
||||
int rn;
|
||||
unsigned char *memory;
|
||||
int length;
|
||||
sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
|
||||
{
|
||||
int size;
|
||||
switch ((enum sim_d10v_regs) rn)
|
||||
|
@ -1488,19 +1440,13 @@ sim_store_register (sd, rn, memory, length)
|
|||
|
||||
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd;
|
||||
const char *cmd;
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
(*d10v_callback->printf_filtered) (d10v_callback, "sim_do_command: %s\n",cmd);
|
||||
}
|
||||
|
||||
SIM_RC
|
||||
sim_load (sd, prog, abfd, from_tty)
|
||||
SIM_DESC sd;
|
||||
const char *prog;
|
||||
bfd *abfd;
|
||||
int from_tty;
|
||||
sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
|
||||
{
|
||||
extern bfd *sim_load_file (); /* ??? Don't know where this should live. */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue