* interp.c, mn10300_sim.h, op_utils.c: Convert function prototypes

and definitions to ISO C.
This commit is contained in:
Alexandre Oliva 2004-06-26 21:53:47 +00:00
parent 622c89b6e6
commit 489503ee33
4 changed files with 64 additions and 79 deletions

View File

@ -1,5 +1,8 @@
2004-06-26 Alexandre Oliva <aoliva@redhat.com> 2004-06-26 Alexandre Oliva <aoliva@redhat.com>
* interp.c, mn10300_sim.h, op_utils.c: Convert function prototypes
and definitions to ISO C.
* gencode.c, simops.c: Delete. * gencode.c, simops.c: Delete.
* Makefile.in: Remove non-COMMON dependencies and commands. * Makefile.in: Remove non-COMMON dependencies and commands.

View File

@ -47,12 +47,11 @@ enum {
}; };
static SIM_RC static SIM_RC
mn10300_option_handler (sd, cpu, opt, arg, is_command) mn10300_option_handler (SIM_DESC sd,
SIM_DESC sd; sim_cpu *cpu,
sim_cpu *cpu; int opt,
int opt; char *arg,
char *arg; int is_command)
int is_command;
{ {
int cpu_nr; int cpu_nr;
switch (opt) switch (opt)
@ -88,11 +87,10 @@ SIM_DESC simulator;
/* These default values correspond to expected usage for the chip. */ /* These default values correspond to expected usage for the chip. */
SIM_DESC SIM_DESC
sim_open (kind, cb, abfd, argv) sim_open (SIM_OPEN_KIND kind,
SIM_OPEN_KIND kind; host_callback *cb,
host_callback *cb; struct bfd *abfd,
struct bfd *abfd; char **argv)
char **argv;
{ {
SIM_DESC sd = sim_state_alloc (kind, cb); SIM_DESC sd = sim_state_alloc (kind, cb);
mn10300_callback = cb; mn10300_callback = cb;
@ -304,20 +302,17 @@ sim_open (kind, cb, abfd, argv)
void void
sim_close (sd, quitting) sim_close (SIM_DESC sd, int quitting)
SIM_DESC sd;
int quitting;
{ {
sim_module_uninstall (sd); sim_module_uninstall (sd);
} }
SIM_RC SIM_RC
sim_create_inferior (sd, prog_bfd, argv, env) sim_create_inferior (SIM_DESC sd,
SIM_DESC sd; struct bfd *prog_bfd,
struct bfd *prog_bfd; char **argv,
char **argv; char **env)
char **env;
{ {
memset (&State, 0, sizeof (State)); memset (&State, 0, sizeof (State));
if (prog_bfd != NULL) { if (prog_bfd != NULL) {
@ -331,9 +326,7 @@ sim_create_inferior (sd, prog_bfd, argv, env)
} }
void void
sim_do_command (sd, cmd) sim_do_command (SIM_DESC sd, char *cmd)
SIM_DESC sd;
char *cmd;
{ {
char *mm_cmd = "memory-map"; char *mm_cmd = "memory-map";
char *int_cmd = "interrupt"; char *int_cmd = "interrupt";
@ -353,41 +346,34 @@ sim_do_command (sd, cmd)
but need to be changed to use the memory map. */ but need to be changed to use the memory map. */
uint8 uint8
get_byte (x) get_byte (uint8 *x)
uint8 *x;
{ {
return *x; return *x;
} }
uint16 uint16
get_half (x) get_half (uint8 *x)
uint8 *x;
{ {
uint8 *a = x; uint8 *a = x;
return (a[1] << 8) + (a[0]); return (a[1] << 8) + (a[0]);
} }
uint32 uint32
get_word (x) get_word (uint8 *x)
uint8 *x;
{ {
uint8 *a = x; uint8 *a = x;
return (a[3]<<24) + (a[2]<<16) + (a[1]<<8) + (a[0]); return (a[3]<<24) + (a[2]<<16) + (a[1]<<8) + (a[0]);
} }
void void
put_byte (addr, data) put_byte (uint8 *addr, uint8 data)
uint8 *addr;
uint8 data;
{ {
uint8 *a = addr; uint8 *a = addr;
a[0] = data; a[0] = data;
} }
void void
put_half (addr, data) put_half (uint8 *addr, uint16 data)
uint8 *addr;
uint16 data;
{ {
uint8 *a = addr; uint8 *a = addr;
a[0] = data & 0xff; a[0] = data & 0xff;
@ -395,9 +381,7 @@ put_half (addr, data)
} }
void void
put_word (addr, data) put_word (uint8 *addr, uint32 data)
uint8 *addr;
uint32 data;
{ {
uint8 *a = addr; uint8 *a = addr;
a[0] = data & 0xff; a[0] = data & 0xff;
@ -407,22 +391,20 @@ put_word (addr, data)
} }
int int
sim_fetch_register (sd, rn, memory, length) sim_fetch_register (SIM_DESC sd,
SIM_DESC sd; int rn,
int rn; unsigned char *memory,
unsigned char *memory; int length)
int length;
{ {
put_word (memory, State.regs[rn]); put_word (memory, State.regs[rn]);
return -1; return -1;
} }
int int
sim_store_register (sd, rn, memory, length) sim_store_register (SIM_DESC sd,
SIM_DESC sd; int rn,
int rn; unsigned char *memory,
unsigned char *memory; int length)
int length;
{ {
State.regs[rn] = get_word (memory); State.regs[rn] = get_word (memory);
return -1; return -1;
@ -431,13 +413,13 @@ sim_store_register (sd, rn, memory, length)
void void
mn10300_core_signal (SIM_DESC sd, mn10300_core_signal (SIM_DESC sd,
sim_cpu *cpu, sim_cpu *cpu,
sim_cia cia, sim_cia cia,
unsigned map, unsigned map,
int nr_bytes, int nr_bytes,
address_word addr, address_word addr,
transfer_type transfer, transfer_type transfer,
sim_core_signals sig) sim_core_signals sig)
{ {
const char *copy = (transfer == read_transfer ? "read" : "write"); const char *copy = (transfer == read_transfer ? "read" : "write");
address_word ip = CIA_ADDR (cia); address_word ip = CIA_ADDR (cia);

View File

@ -161,32 +161,32 @@ sim_core_write_unaligned_4 (STATE_CPU (simulator, 0), \
/* Function declarations. */ /* Function declarations. */
uint32 get_word PARAMS ((uint8 *)); uint32 get_word (uint8 *);
uint16 get_half PARAMS ((uint8 *)); uint16 get_half (uint8 *);
uint8 get_byte PARAMS ((uint8 *)); uint8 get_byte (uint8 *);
void put_word PARAMS ((uint8 *, uint32)); void put_word (uint8 *, uint32);
void put_half PARAMS ((uint8 *, uint16)); void put_half (uint8 *, uint16);
void put_byte PARAMS ((uint8 *, uint8)); void put_byte (uint8 *, uint8);
extern uint8 *map PARAMS ((SIM_ADDR addr)); extern uint8 *map (SIM_ADDR addr);
INLINE_SIM_MAIN (void) genericAdd PARAMS ((unsigned32 source, unsigned32 destReg)); INLINE_SIM_MAIN (void) genericAdd (unsigned32 source, unsigned32 destReg);
INLINE_SIM_MAIN (void) genericSub PARAMS ((unsigned32 source, unsigned32 destReg)); INLINE_SIM_MAIN (void) genericSub (unsigned32 source, unsigned32 destReg);
INLINE_SIM_MAIN (void) genericCmp PARAMS ((unsigned32 leftOpnd, unsigned32 rightOpnd)); INLINE_SIM_MAIN (void) genericCmp (unsigned32 leftOpnd, unsigned32 rightOpnd);
INLINE_SIM_MAIN (void) genericOr PARAMS ((unsigned32 source, unsigned32 destReg)); INLINE_SIM_MAIN (void) genericOr (unsigned32 source, unsigned32 destReg);
INLINE_SIM_MAIN (void) genericXor PARAMS ((unsigned32 source, unsigned32 destReg)); INLINE_SIM_MAIN (void) genericXor (unsigned32 source, unsigned32 destReg);
INLINE_SIM_MAIN (void) genericBtst PARAMS ((unsigned32 leftOpnd, unsigned32 rightOpnd)); INLINE_SIM_MAIN (void) genericBtst (unsigned32 leftOpnd, unsigned32 rightOpnd);
INLINE_SIM_MAIN (int) syscall_read_mem PARAMS ((host_callback *cb, INLINE_SIM_MAIN (int) syscall_read_mem (host_callback *cb,
struct cb_syscall *sc, struct cb_syscall *sc,
unsigned long taddr, unsigned long taddr,
char *buf, char *buf,
int bytes)); int bytes);
INLINE_SIM_MAIN (int) syscall_write_mem PARAMS ((host_callback *cb, INLINE_SIM_MAIN (int) syscall_write_mem (host_callback *cb,
struct cb_syscall *sc, struct cb_syscall *sc,
unsigned long taddr, unsigned long taddr,
const char *buf, const char *buf,
int bytes)); int bytes);
INLINE_SIM_MAIN (void) do_syscall PARAMS ((void)); INLINE_SIM_MAIN (void) do_syscall (void);
void program_interrupt (SIM_DESC sd, sim_cpu *cpu, sim_cia cia, SIM_SIGNAL sig); void program_interrupt (SIM_DESC sd, sim_cpu *cpu, sim_cia cia, SIM_SIGNAL sig);
void mn10300_cpu_exception_trigger(SIM_DESC sd, sim_cpu* cpu, address_word pc); void mn10300_cpu_exception_trigger(SIM_DESC sd, sim_cpu* cpu, address_word pc);

View File

@ -164,7 +164,7 @@ syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
/* syscall */ /* syscall */
INLINE_SIM_MAIN (void) INLINE_SIM_MAIN (void)
do_syscall () do_syscall (void)
{ {
/* We use this for simulated system calls; we may need to change /* We use this for simulated system calls; we may need to change