sim: cr16: clean up misc warnings
This commit is contained in:
parent
ca968da465
commit
5aedb83b9c
6 changed files with 509 additions and 488 deletions
|
@ -1,3 +1,36 @@
|
|||
2015-03-29 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Makefile.in (gencode.o, cr16-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.
|
||||
(write_header): Convert old style prototype and fix printf format.
|
||||
(write_template, write_opcodes): Likewise.
|
||||
(check_opcodes): Mark static void and put behind #if 0.
|
||||
* interp.c: Include inttypes.h and run-sim.h.
|
||||
(add_commas): Delete prototype.
|
||||
(decode_pc): Convert old style prototype.
|
||||
(do_run): Change h->op compare to 0.
|
||||
(add_commas, set_dmap_register, set_imap_register, HELD_SPI_IDX,
|
||||
HELD_SPU_IDX, spu_register, spi_register, set_spi_register,
|
||||
set_spu_register): Wrap in #if 0.
|
||||
(sim_write, sim_read, sim_close, sim_stop, sim_set_callbacks,
|
||||
sim_stop_reason, sim_fetch_register, sim_store_register,
|
||||
sim_do_command): Convert old style prototypes.
|
||||
(sim_create_inferior): Fix pointer cast to use uintptr_t.
|
||||
* simops.c [HAVE_TIME_H]: Include time.h.
|
||||
[HAVE_SYS_TIME_H]: Include sys/time.h.
|
||||
[TARGET_SYS_utime]: Include utime.h.
|
||||
[TARGET_SYS_wait]: Include sys/wait.h.
|
||||
(strrchr): Delete prototype.
|
||||
(cond_stat): Mark static.
|
||||
(trace_input_func): Mark name static.
|
||||
(trace_input_func, trace_output_void, trace_output_flag): Convert old style prototypes.
|
||||
(trace_output_40): Wrap in #if 0.
|
||||
(OP_*): Convert old style prototypes. Move trace_input call below
|
||||
all variable decls. Initialize tmp to 0 when appropriate.
|
||||
|
||||
2015-03-29 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Makefile.in (SIM_EXTRA_CFLAGS): Delete -DSIM_HAVE_ENVIRONMENT.
|
||||
|
|
|
@ -39,13 +39,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
|
||||
|
||||
cr16-opc.o: $(srcdir)/../../opcodes/cr16-opc.c
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/../../opcodes/cr16-opc.c
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(WARN_CFLAGS) -c $(srcdir)/../../opcodes/cr16-opc.c
|
||||
|
||||
gencode: gencode.o cr16-opc.o
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -o gencode gencode.o cr16-opc.o $(BUILD_LIB)
|
||||
$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o gencode gencode.o cr16-opc.o $(BUILD_LIB)
|
||||
|
||||
clean-extra:
|
||||
rm -f table.c simops.h gencode
|
||||
|
|
|
@ -28,22 +28,19 @@
|
|||
#endif
|
||||
|
||||
ENDIAN_INLINE uint16
|
||||
get_word (x)
|
||||
uint8 *x;
|
||||
get_word (uint8 *x)
|
||||
{
|
||||
return *(uint16 *)x;
|
||||
}
|
||||
|
||||
ENDIAN_INLINE uint32
|
||||
get_longword (x)
|
||||
uint8 *x;
|
||||
get_longword (uint8 *x)
|
||||
{
|
||||
return (((uint32) *(uint16 *)x) << 16) | ((uint32) *(uint16 *)(x+2));
|
||||
}
|
||||
|
||||
ENDIAN_INLINE int64
|
||||
get_longlong (x)
|
||||
uint8 *x;
|
||||
get_longlong (uint8 *x)
|
||||
{
|
||||
uint32 top = get_longword (x);
|
||||
uint32 bottom = get_longword (x+4);
|
||||
|
@ -51,9 +48,7 @@ get_longlong (x)
|
|||
}
|
||||
|
||||
ENDIAN_INLINE void
|
||||
write_word (addr, data)
|
||||
uint8 *addr;
|
||||
uint16 data;
|
||||
write_word (uint8 *addr, uint16 data)
|
||||
{
|
||||
addr[1] = (data >> 8) & 0xff;
|
||||
addr[0] = data & 0xff;
|
||||
|
@ -61,18 +56,14 @@ write_word (addr, data)
|
|||
}
|
||||
|
||||
ENDIAN_INLINE void
|
||||
write_longword (addr, data)
|
||||
uint8 *addr;
|
||||
uint32 data;
|
||||
write_longword (uint8 *addr, uint32 data)
|
||||
{
|
||||
*(uint16 *)(addr + 2) = (uint16)(data >> 16);
|
||||
*(uint16 *)(addr) = (uint16)data;
|
||||
}
|
||||
|
||||
ENDIAN_INLINE void
|
||||
write_longlong (addr, data)
|
||||
uint8 *addr;
|
||||
int64 data;
|
||||
write_longlong (uint8 *addr, int64 data)
|
||||
{
|
||||
write_longword (addr+4, (uint32)(data >> 32));
|
||||
write_longword (addr, (uint32)data);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include "ansidecl.h"
|
||||
#include "opcode/cr16.h"
|
||||
|
||||
|
@ -43,7 +44,7 @@ main (int argc, char *argv[])
|
|||
|
||||
|
||||
static void
|
||||
write_header ()
|
||||
write_header (void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -52,9 +53,8 @@ write_header ()
|
|||
|
||||
/* Loop over instruction table until a full match is found. */
|
||||
for ( ; i < NUMOPCODES; i++)
|
||||
{
|
||||
printf("void OP_%X_%X (void);\t\t/* %s */\n",cr16_instruction[i].match, (32 - cr16_instruction[i].match_bits), cr16_instruction[i].mnemonic);
|
||||
}
|
||||
printf("void OP_%lX_%X (void);\t\t/* %s */\n", cr16_instruction[i].match,
|
||||
(32 - cr16_instruction[i].match_bits), cr16_instruction[i].mnemonic);
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ write_header ()
|
|||
ready to be filled out. */
|
||||
|
||||
static void
|
||||
write_template ()
|
||||
write_template (void)
|
||||
{
|
||||
int i = 0,j, k, flags;
|
||||
|
||||
|
@ -73,7 +73,8 @@ write_template ()
|
|||
{
|
||||
if (cr16_instruction[i].size != 0)
|
||||
{
|
||||
printf("/* %s */\nvoid\nOP_%X_%X ()\n{\n",cr16_instruction[i].mnemonic,cr16_instruction[i].match,(32 - cr16_instruction[i].match_bits));
|
||||
printf("/* %s */\nvoid\nOP_%lX_%X ()\n{\n", cr16_instruction[i].mnemonic,
|
||||
cr16_instruction[i].match, (32 - cr16_instruction[i].match_bits));
|
||||
|
||||
/* count operands. */
|
||||
j = 0;
|
||||
|
@ -110,18 +111,20 @@ write_template ()
|
|||
long Opcodes[512];
|
||||
static int curop=0;
|
||||
|
||||
#if 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);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
write_opcodes ()
|
||||
write_opcodes (void)
|
||||
{
|
||||
int i = 0, j = 0, k;
|
||||
|
||||
|
@ -134,7 +137,7 @@ write_opcodes ()
|
|||
{
|
||||
if (cr16_instruction[i].size != 0)
|
||||
{
|
||||
printf (" { \"%s\", %ld, %d, %d, %d, \"OP_%X_%X\", OP_%X_%X, ",
|
||||
printf (" { \"%s\", %u, %d, %ld, %u, \"OP_%lX_%X\", OP_%lX_%X, ",
|
||||
cr16_instruction[i].mnemonic, cr16_instruction[i].size,
|
||||
cr16_instruction[i].match_bits, cr16_instruction[i].match,
|
||||
cr16_instruction[i].flags, ((BIN(cr16_instruction[i].match, cr16_instruction[i].match_bits))>>(cr16_instruction[i].match_bits)),
|
||||
|
@ -170,5 +173,5 @@ write_opcodes ()
|
|||
printf ("},\n");
|
||||
}
|
||||
}
|
||||
printf (" { \"NULL\",1,8,0,0,\"OP_0_20\",OP_0_20,0,{0,0,0}},\n};\n");
|
||||
printf (" { \"NULL\",1,8,0,0,\"OP_0_20\",OP_0_20,0,{{0,0},{0,0},{0,0},{0,0}}},\n};\n");
|
||||
}
|
||||
|
|
|
@ -18,12 +18,14 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "config.h"
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "bfd.h"
|
||||
#include "gdb/callback.h"
|
||||
#include "gdb/remote-sim.h"
|
||||
#include "run-sim.h"
|
||||
|
||||
#include "cr16_sim.h"
|
||||
#include "gdb/sim-cr16.h"
|
||||
|
@ -55,7 +57,6 @@ bfd_vma text_end;
|
|||
static struct hash_entry *lookup_hash (uint64 ins, int size);
|
||||
static void get_operands (operand_desc *s, uint64 mcode, int isize, int nops);
|
||||
static int do_run (uint64 mc);
|
||||
static char *add_commas (char *buf, int sizeof_buf, unsigned long value);
|
||||
extern void sim_set_profile (int n);
|
||||
extern void sim_set_profile_size (int n);
|
||||
static INLINE uint8 *map_memory (unsigned phys_addr);
|
||||
|
@ -363,7 +364,7 @@ get_operands (operand_desc *s, uint64 ins, int isize, int nops)
|
|||
}
|
||||
|
||||
bfd_vma
|
||||
decode_pc ()
|
||||
decode_pc (void)
|
||||
{
|
||||
asection *s;
|
||||
if (!init_text_p && prog_bfd != NULL)
|
||||
|
@ -398,7 +399,8 @@ do_run(uint64 mcode)
|
|||
|
||||
h = lookup_hash(mcode, 1);
|
||||
|
||||
if ((h == NULL) || (h->opcode == NULL)) return 0;
|
||||
if ((h == NULL) || (h->opcode == 0))
|
||||
return 0;
|
||||
|
||||
if (h->size == 3)
|
||||
{
|
||||
|
@ -424,6 +426,7 @@ do_run(uint64 mcode)
|
|||
return h->size;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static char *
|
||||
add_commas(char *buf, int sizeof_buf, unsigned long value)
|
||||
{
|
||||
|
@ -443,6 +446,7 @@ add_commas(char *buf, int sizeof_buf, unsigned long value)
|
|||
|
||||
return endbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
sim_size (int power)
|
||||
|
@ -481,6 +485,7 @@ enum
|
|||
DMAP2_OFFSET = 0xff0c
|
||||
};
|
||||
|
||||
#if 0
|
||||
static void
|
||||
set_dmap_register (int reg_nr, unsigned long value)
|
||||
{
|
||||
|
@ -495,6 +500,7 @@ set_dmap_register (int reg_nr, unsigned long value)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned long
|
||||
dmap_register (void *regcache, int reg_nr)
|
||||
|
@ -504,6 +510,7 @@ dmap_register (void *regcache, int reg_nr)
|
|||
return READ_16 (raw);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
set_imap_register (int reg_nr, unsigned long value)
|
||||
{
|
||||
|
@ -518,6 +525,7 @@ set_imap_register (int reg_nr, unsigned long value)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned long
|
||||
imap_register (void *regcache, int reg_nr)
|
||||
|
@ -527,6 +535,7 @@ imap_register (void *regcache, int reg_nr)
|
|||
return READ_16 (raw);
|
||||
}
|
||||
|
||||
#if 0
|
||||
enum
|
||||
{
|
||||
HELD_SPI_IDX = 0,
|
||||
|
@ -556,6 +565,7 @@ set_spu_register (unsigned long value)
|
|||
{
|
||||
SET_GPR (SP_IDX, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Given a virtual address in the DMAP address space, translate it
|
||||
into a physical address. */
|
||||
|
@ -882,22 +892,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);
|
||||
|
@ -1052,9 +1054,7 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct bfd
|
|||
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1138,8 +1138,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;
|
||||
|
@ -1368,7 +1367,7 @@ 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
|
||||
|
@ -1395,8 +1394,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
|
|||
|
||||
|
||||
void
|
||||
sim_set_callbacks (p)
|
||||
host_callback *p;
|
||||
sim_set_callbacks (host_callback *p)
|
||||
{
|
||||
cr16_callback = p;
|
||||
}
|
||||
|
@ -1410,10 +1408,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)
|
||||
{
|
||||
/* (*cr16_callback->printf_filtered) (cr16_callback, "sim_stop_reason: PC=0x%x\n",PC<<2); */
|
||||
|
||||
|
@ -1452,11 +1447,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_cr16_regs) rn)
|
||||
|
@ -1507,11 +1498,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_cr16_regs) rn)
|
||||
|
@ -1567,9 +1554,7 @@ sim_complete_command (SIM_DESC sd, const char *text, const char *word)
|
|||
}
|
||||
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd;
|
||||
const char *cmd;
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
(*cr16_callback->printf_filtered) (cr16_callback, "sim_do_command: %s\n",cmd);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue