+2015-03-28 Mike Frysinger <vapier@gentoo.org>
+
+ * erc32.c (mec_read): Delete parenthesis around return statement.
+ (mec_write, read_uart, rtc_counter_read, gpt_counter_read, memory_read,
+ memory_write, get_mem_ptr, sis_memory_write, sis_memory_read): Likewise.
+ * exec.c (sub_cc, add_cc, add32, dispatch_instruction, fpexec, chk_asi,
+ execute_trap, check_interrupts): Likewise.
+ * float.c (get_accex): Likewise.
+ * func.c (batch, limcalc, exec_cmd, disp_fpu, now, wait_for_irq,
+ check_bpt, bfd_load, get_time): Likewise.
+ * interf.c (run_sim, sim_write, sim_read): Likewise.
+ * sis.c (run_sim): Likewise.
+
2015-03-24 Mike Frysinger <vapier@gentoo.org>
* interf.c (sim_set_callbacks, sim_size, sim_trace): Delete.
case MEC_UARTB: /* 0xE4 */
if (asi != 0xb) {
set_sfsr(MEC_ACC, addr, asi, 1);
- return (1);
+ return 1;
}
*data = read_uart(addr);
break;
default:
set_sfsr(MEC_ACC, addr, asi, 1);
- return (1);
+ return 1;
break;
}
- return (MOK);
+ return MOK;
}
static int
default:
set_sfsr(MEC_ACC, addr, 0xb, 0);
- return (1);
+ return 1;
break;
}
- return (MOK);
+ return MOK;
}
return tmp;
#endif
#else
- return(0);
+ return 0;
#endif
break;
return tmp;
#endif
#else
- return(0);
+ return 0;
#endif
break;
}
Ucontrol |= 0x00060006;
- return (Ucontrol);
+ return Ucontrol;
#else
- return (uart_stat_reg);
+ return uart_stat_reg;
#endif
#else
- return(0x00060006);
+ return 0x00060006;
#endif
break;
default:
printf("Read from unimplemented MEC register (%x)\n", addr);
}
- return (0);
+ return 0;
}
static void
static uint32
rtc_counter_read()
{
- return (rtc_counter);
+ return rtc_counter;
}
static void
static uint32
gpt_counter_read()
{
- return (gpt_counter);
+ return gpt_counter;
}
static void
if (errmec == 5) mecparerror();
if (errmec == 6) iucomperr();
errmec = 0;
- return(1);
+ return 1;
}
#endif
if ((addr >= mem_ramstart) && (addr < (mem_ramstart + mem_ramsz))) {
fetch_bytes (asi, &ramb[addr & mem_rammask], data, sz);
*ws = mem_ramr_ws;
- return (0);
+ return 0;
} else if ((addr >= MEC_START) && (addr < MEC_END)) {
mexc = mec_read(addr, asi, data);
if (mexc) {
} else {
*ws = 0;
}
- return (mexc);
+ return mexc;
#ifdef ERA
((addr>= 0x80000000) && (addr < 0x80100000))) {
fetch_bytes (asi, &romb[addr & ROM_MASK], data, sz);
*ws = 4;
- return (0);
+ return 0;
} else if ((addr >= 0x10000000) &&
(addr < (0x10000000 + (512 << (mec_iocr & 0x0f)))) &&
(mec_iocr & 0x10)) {
*data = erareg;
- return (0);
+ return 0;
}
} else if (addr < mem_romsz) {
fetch_bytes (asi, &romb[addr], data, sz);
*ws = mem_romr_ws;
- return (0);
+ return 0;
#else
} else if (addr < mem_romsz) {
fetch_bytes (asi, &romb[addr], data, sz);
*ws = mem_romr_ws;
- return (0);
+ return 0;
#endif
}
printf("Memory exception at %x (illegal address)\n", addr);
set_sfsr(UIMP_ACC, addr, asi, 1);
*ws = MEM_EX_WS;
- return (1);
+ return 1;
}
int
if (errmec == 5) mecparerror();
if (errmec == 6) iucomperr();
errmec = 0;
- return(1);
+ return 1;
}
#endif
printf("Memory access protection error at 0x%08x\n", addr);
set_sfsr(PROT_EXC, addr, asi, 0);
*ws = MEM_EX_WS;
- return (1);
+ return 1;
}
}
*ws = 2 * mem_ramw_ws + STD_WS;
break;
}
- return (0);
+ return 0;
} else if ((addr >= MEC_START) && (addr < MEC_END)) {
if ((sz != 2) || (asi != 0xb)) {
set_sfsr(MEC_ACC, addr, asi, 0);
*ws = MEM_EX_WS;
- return (1);
+ return 1;
}
mexc = mec_write(addr, *data);
if (mexc) {
} else {
*ws = 0;
}
- return (mexc);
+ return mexc;
#ifdef ERA
addr &= ROM_MASK;
*ws = sz == 3 ? 8 : 4;
store_bytes (&romb[addr], data, sz);
- return (0);
+ return 0;
} else if ((addr >= 0x10000000) &&
(addr < (0x10000000 + (512 << (mec_iocr & 0x0f)))) &&
(mec_iocr & 0x10)) {
erareg = *data & 0x0e;
- return (0);
+ return 0;
}
} else if ((addr < mem_romsz) && (mec_memcfg & 0x10000) && (wrp) &&
if (sz == 3)
*ws += mem_romw_ws + STD_WS;
store_bytes (&romb[addr], data, sz);
- return (0);
+ return 0;
#else
} else if ((addr < mem_romsz) && (mec_memcfg & 0x10000) && (wrp) &&
if (sz == 3)
*ws += mem_romw_ws + STD_WS;
store_bytes (&romb[addr], data, sz);
- return (0);
+ return 0;
#endif
*ws = MEM_EX_WS;
set_sfsr(UIMP_ACC, addr, asi, 0);
- return (1);
+ return 1;
}
static unsigned char *
uint32 size;
{
if ((addr + size) < ROM_SZ) {
- return (&romb[addr]);
+ return &romb[addr];
} else if ((addr >= mem_ramstart) && ((addr + size) < mem_ramend)) {
- return (&ramb[addr & mem_rammask]);
+ return &ramb[addr & mem_rammask];
}
#ifdef ERA
else if ((era) && ((addr <0x100000) ||
((addr >= (unsigned) 0x80000000) && ((addr + size) < (unsigned) 0x80100000)))) {
- return (&romb[addr & ROM_MASK]);
+ return &romb[addr & ROM_MASK];
}
#endif
- return ((char *) -1);
+ return (char *) -1;
}
int
char *mem;
if ((mem = get_mem_ptr(addr, length)) == ((char *) -1))
- return (0);
+ return 0;
memcpy(mem, data, length);
- return (length);
+ return length;
}
int
char *mem;
if ((mem = get_mem_ptr(addr, length)) == ((char *) -1))
- return (0);
+ return 0;
memcpy(data, mem, length);
- return (length);
+ return length;
}
extern struct pstate sregs;
(~operand1 & operand2 & result)) >> 10) & PSR_V);
psr = (psr & ~PSR_C) | ((((~operand1 & operand2) |
((~operand1 | operand2) & result)) >> 11) & PSR_C);
- return (psr);
+ return psr;
}
uint32
(~operand1 & ~operand2 & result)) >> 10) & PSR_V);
psr = (psr & ~PSR_C) | ((((operand1 & operand2) |
((operand1 | operand2) & ~result)) >> 11) & PSR_C);
- return(psr);
+ return psr;
}
static void
uint32 result = n1 + n2;
*carry = result < n1 || result < n1;
- return(result);
+ return result;
}
/* Multiply two 32-bit integers. */
sregs->pc = pc;
sregs->npc = npc;
}
- return (0);
+ return 0;
}
#define T_FABSs 2
if (sregs->fpstate == FP_EXC_MODE) {
sregs->fsr = (sregs->fsr & ~FSR_TT) | FP_SEQ_ERR;
sregs->fpstate = FP_EXC_PE;
- return (0);
+ return 0;
}
if (sregs->fpstate == FP_EXC_PE) {
sregs->fpstate = FP_EXC_MODE;
- return (TRAP_FPEXC);
+ return TRAP_FPEXC;
}
opf = (sregs->inst >> 5) & 0x1ff;
}
clear_accex();
- return (0);
+ return 0;
}
{
if (!(sregs->psr & PSR_S)) {
sregs->trap = TRAP_PRIVI;
- return (0);
+ return 0;
} else if (sregs->inst & INST_I) {
sregs->trap = TRAP_UNIMP;
- return (0);
+ return 0;
} else
*asi = (sregs->inst >> 5) & 0x0ff;
- return(1);
+ return 1;
}
int
sregs->npc = 4;
sregs->trap = 0;
} else if (sregs->trap == 257) {
- return (ERROR);
+ return ERROR;
} else {
if ((sregs->psr & PSR_ET) == 0)
- return (ERROR);
+ return ERROR;
sregs->tbr = (sregs->tbr & 0xfffff000) | (sregs->trap << 4);
sregs->trap = 0;
}
- return (0);
+ return 0;
}
if (sregs->trap == 0) {
sregs->trap = 16 + ext_irl;
irqarr[ext_irl & 0x0f].callback(irqarr[ext_irl & 0x0f].arg);
- return(1);
+ return 1;
}
}
- return(0);
+ return 0;
}
void
accx |= 8;
if (fexc & FE_INVALID)
accx |= 0x10;
- return(accx);
+ return accx;
}
/* How to clear the accrued exceptions */
if ((fp = fopen(fname, "r")) == NULL) {
fprintf(stderr, "couldn't open batch file %s\n", fname);
- return (0);
+ return 0;
}
while (getline(&lbuf, &len, fp) > -1) {
slen = strlen(lbuf);
}
free(lbuf);
fclose(fp);
- return (1);
+ return 1;
}
void
lim = -1;
}
}
- return (lim);
+ return lim;
}
int
}
if (cmdsave != NULL)
free(cmdsave);
- return (stat);
+ return stat;
}
printf("\n");
}
printf("\n");
- return (OK);
+ return OK;
}
static void
uint32
now()
{
- return(ebase.simtime);
+ return ebase.simtime;
}
}
}
sregs.pwdtime += ebase.simtime - endtime;
- return (ebase.simtime - endtime);
+ return ebase.simtime - endtime;
}
int
int32 i;
if ((sregs->bphit) || (sregs->annul))
- return (0);
+ return 0;
for (i = 0; i < (int32) sregs->bptnum; i++) {
if (sregs->pc == sregs->bpts[i])
- return (BPT_HIT);
+ return BPT_HIT;
}
- return (0);
+ return 0;
}
void
if (pbfd == NULL) {
printf("open of %s failed\n", fname);
- return (-1);
+ return -1;
}
if (!bfd_check_format(pbfd, bfd_object)) {
printf("file %s doesn't seem to be an object file\n", fname);
- return (-1);
+ return -1;
}
arch = bfd_get_arch_info (pbfd);
if (sis_verbose)
printf("\n");
- return(bfd_get_start_address (pbfd));
+ return bfd_get_start_address (pbfd);
}
double get_time (void)
gettimeofday (&tm, NULL);
usec = ((double) tm.tv_sec) * 1E6 + ((double) tm.tv_usec);
- return (usec / 1E6);
+ return usec / 1E6;
}
sim_halt();
restore_stdio();
clearerr(stdin);
- return (BPT_HIT);
+ return BPT_HIT;
} else
dispatch_instruction(sregs);
}
if (sregs->err_mode)
error_mode(sregs->pc);
if (sregs->err_mode)
- return (ERROR);
+ return ERROR;
if (sregs->bphit) {
if (sis_verbose)
(*sim_callback->printf_filtered) (sim_callback,
"HW BP hit at %x\n", sregs->pc);
- return (BPT_HIT);
+ return BPT_HIT;
}
if (ctrl_c) {
ctrl_c = 0;
- return (CTRL_C);
+ return CTRL_C;
}
- return (TIME_OUT);
+ return TIME_OUT;
}
SIM_DESC
const unsigned char *buf;
int length;
{
- return (sis_memory_write(mem, buf, length));
+ return sis_memory_write (mem, buf, length);
}
int
unsigned char *buf;
int length;
{
- return (sis_memory_read(mem, buf, length));
+ return sis_memory_read (mem, buf, length);
}
void
if (deb) {
if ((sregs->bphit = check_bpt(sregs)) != 0) {
restore_stdio();
- return (BPT_HIT);
+ return BPT_HIT;
}
if (sregs->histlen) {
sregs->histbuf[sregs->histind].addr = sregs->pc;
sregs->tottime += get_time() - sregs->starttime;
restore_stdio();
if (sregs->err_mode)
- return (ERROR);
+ return ERROR;
if (ctrl_c) {
ctrl_c = 0;
- return (CTRL_C);
+ return CTRL_C;
}
- return (TIME_OUT);
+ return TIME_OUT;
}
int