static void gpt_scaler_set (uint32 val);
static void gpt_reload_set (uint32 val);
static void timer_ctrl (uint32 val);
-static unsigned char *
- get_mem_ptr (uint32 addr, uint32 size);
+static void * get_mem_ptr (uint32 addr, uint32 size);
static void store_bytes (unsigned char *mem, uint32 waddr,
uint32 *data, int sz, int32 *ws);
/* Memory emulation */
int
-memory_iread (uint32 addr, uint32 *data, int32 *ws)
+memory_iread (uint32 addr, uint32 *data, uint32 *ws)
{
uint32 asi;
if ((addr >= mem_ramstart) && (addr < (mem_ramstart + mem_ramsz))) {
}
int
-memory_read(int32 asi, uint32 addr, uint32 *data, int32 sz, int32 *ws)
+memory_read(int32 asi, uint32 addr, void *data, int32 sz, int32 *ws)
{
int32 mexc;
} else if ((addr >= 0x10000000) &&
(addr < (0x10000000 + (512 << (mec_iocr & 0x0f)))) &&
(mec_iocr & 0x10)) {
- *data = erareg;
+ memcpy (data, &erareg, 4);
return 0;
}
return 1;
}
-static unsigned char *
+static void *
get_mem_ptr(uint32 addr, uint32 size)
{
if ((addr + size) < ROM_SZ) {
}
#endif
- return (char *) -1;
+ return (void *) -1;
}
int
-sis_memory_write(uint32 addr, const unsigned char *data, uint32 length)
+sis_memory_write(uint32 addr, const void *data, uint32 length)
{
- char *mem;
+ void *mem;
- if ((mem = get_mem_ptr(addr, length)) == ((char *) -1))
+ if ((mem = get_mem_ptr(addr, length)) == ((void *) -1))
return 0;
memcpy(mem, data, length);
}
int
-sis_memory_read(uint32 addr, char *data, uint32 length)
+sis_memory_read(uint32 addr, void *data, uint32 length)
{
char *mem;
- if ((mem = get_mem_ptr(addr, length)) == ((char *) -1))
+ if ((mem = get_mem_ptr(addr, length)) == ((void *) -1))
return 0;
memcpy(data, mem, length);
uint32 cwp, op, op2, op3, asi, rd, cond, rs1,
rs2;
- uint32 ldep, icc;
- int32 operand1, operand2, *rdd, result, eicc,
+ uint32 ldep, icc, data, *rdd;
+ int32 operand1, operand2, result, eicc,
new_cwp;
- int32 pc, npc, data, address, ws, mexc, fcc;
- int32 ddata[2];
+ int32 pc, npc, address, ws, mexc, fcc;
+ uint32 ddata[2];
sregs->ninst++;
cwp = ((sregs->psr & PSR_CWP) << 4);
break;
}
sregs->psr = (sregs->psr & 0xff000000) |
- (rs1 ^ operand2) & 0x00f03fff;
+ ((rs1 ^ operand2) & 0x00f03fff);
break;
case WRWIM:
if (!(sregs->psr & PSR_S)) {
if (sregs->frd == rd)
sregs->fhold += (sregs->ftime - ebase.simtime);
}
- mexc = memory_write(asi, address, &sregs->fsi[rd], 2, &ws);
+ mexc = memory_write(asi, address, (uint32 *)&sregs->fsi[rd], 2, &ws);
sregs->hold += ws;
if (mexc) {
sregs->trap = TRAP_DEXC;
if ((sregs->frd == rd) || (sregs->frd + 1 == rd))
sregs->fhold += (sregs->ftime - ebase.simtime);
}
- mexc = memory_write(asi, address, &sregs->fsi[rd], 3, &ws);
+ mexc = memory_write(asi, address, (uint32 *)&sregs->fsi[rd], 3, &ws);
sregs->hold += ws;
sregs->icnt = T_STD;
#ifdef STAT
}
void
-get_regi(struct pstate * sregs, int32 reg, char *buf)
+get_regi(struct pstate * sregs, int32 reg, unsigned char *buf)
{
uint32 cwp;
uint32 rval = 0;
#include "libiberty.h"
#include "bfd.h"
+#ifndef min
#define min(A, B) (((A) < (B)) ? (A) : (B))
+#endif
#define LOAD_ADDRESS 0
int
extern void exit_sim (void);
extern void init_stdio (void);
extern void restore_stdio (void);
-extern int memory_iread (uint32 addr, uint32 *data, int32 *ws);
-extern int memory_read (int32 asi, uint32 addr, uint32 *data,
+extern int memory_iread (uint32 addr, uint32 *data, uint32 *ws);
+extern int memory_read (int32 asi, uint32 addr, void *data,
int32 sz, int32 *ws);
extern int memory_write (int32 asi, uint32 addr, uint32 *data,
int32 sz, int32 *ws);
extern int sis_memory_write (uint32 addr,
- const unsigned char *data, uint32 length);
-extern int sis_memory_read (uint32 addr, char *data,
+ const void *data, uint32 length);
+extern int sis_memory_read (uint32 addr, void *data,
uint32 length);
+extern void boot_init (void);
/* func.c */
extern struct pstate sregs;
extern void set_regi (struct pstate *sregs, int32 reg,
uint32 rval);
-extern void get_regi (struct pstate *sregs, int32 reg, char *buf);
+extern void get_regi (struct pstate *sregs, int32 reg, unsigned char *buf);
extern int exec_cmd (struct pstate *sregs, const char *cmd);
extern void reset_stat (struct pstate *sregs);
extern void show_stat (struct pstate *sregs);