diff options
-rw-r--r-- | sim/erc32/ChangeLog | 13 | ||||
-rw-r--r-- | sim/erc32/erc32.c | 78 | ||||
-rw-r--r-- | sim/erc32/exec.c | 30 | ||||
-rw-r--r-- | sim/erc32/float.c | 2 | ||||
-rw-r--r-- | sim/erc32/func.c | 28 | ||||
-rw-r--r-- | sim/erc32/interf.c | 14 | ||||
-rw-r--r-- | sim/erc32/sis.c | 8 |
7 files changed, 93 insertions, 80 deletions
diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog index a1e6ed7..36fcbf4 100644 --- a/sim/erc32/ChangeLog +++ b/sim/erc32/ChangeLog @@ -1,3 +1,16 @@ +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. diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c index 6b771b4..740d778 100644 --- a/sim/erc32/erc32.c +++ b/sim/erc32/erc32.c @@ -732,7 +732,7 @@ mec_read(addr, asi, data) case MEC_UARTB: /* 0xE4 */ if (asi != 0xb) { set_sfsr(MEC_ACC, addr, asi, 1); - return (1); + return 1; } *data = read_uart(addr); break; @@ -752,10 +752,10 @@ mec_read(addr, asi, data) default: set_sfsr(MEC_ACC, addr, asi, 1); - return (1); + return 1; break; } - return (MOK); + return MOK; } static int @@ -931,10 +931,10 @@ mec_write(addr, data) default: set_sfsr(MEC_ACC, addr, 0xb, 0); - return (1); + return 1; break; } - return (MOK); + return MOK; } @@ -1086,7 +1086,7 @@ read_uart(addr) return tmp; #endif #else - return(0); + return 0; #endif break; @@ -1118,7 +1118,7 @@ read_uart(addr) return tmp; #endif #else - return(0); + return 0; #endif break; @@ -1153,12 +1153,12 @@ read_uart(addr) } Ucontrol |= 0x00060006; - return (Ucontrol); + return Ucontrol; #else - return (uart_stat_reg); + return uart_stat_reg; #endif #else - return(0x00060006); + return 0x00060006; #endif break; default: @@ -1166,7 +1166,7 @@ read_uart(addr) printf("Read from unimplemented MEC register (%x)\n", addr); } - return (0); + return 0; } static void @@ -1428,7 +1428,7 @@ rtc_start() static uint32 rtc_counter_read() { - return (rtc_counter); + return rtc_counter; } static void @@ -1481,7 +1481,7 @@ gpt_start() static uint32 gpt_counter_read() { - return (gpt_counter); + return gpt_counter; } static void @@ -1665,14 +1665,14 @@ memory_read(asi, addr, data, sz, ws) 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) { @@ -1681,7 +1681,7 @@ memory_read(asi, addr, data, sz, ws) } else { *ws = 0; } - return (mexc); + return mexc; #ifdef ERA @@ -1690,24 +1690,24 @@ memory_read(asi, addr, data, sz, ws) ((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 } @@ -1715,7 +1715,7 @@ memory_read(asi, addr, data, sz, ws) 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 @@ -1742,7 +1742,7 @@ memory_write(asi, addr, data, sz, ws) if (errmec == 5) mecparerror(); if (errmec == 6) iucomperr(); errmec = 0; - return(1); + return 1; } #endif @@ -1764,7 +1764,7 @@ memory_write(asi, addr, data, sz, ws) 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; } } @@ -1782,12 +1782,12 @@ memory_write(asi, addr, data, sz, ws) *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) { @@ -1796,7 +1796,7 @@ memory_write(asi, addr, data, sz, ws) } else { *ws = 0; } - return (mexc); + return mexc; #ifdef ERA @@ -1806,12 +1806,12 @@ memory_write(asi, addr, data, sz, ws) 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) && @@ -1822,7 +1822,7 @@ memory_write(asi, addr, data, sz, ws) 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) && @@ -1833,7 +1833,7 @@ memory_write(asi, addr, data, sz, ws) if (sz == 3) *ws += mem_romw_ws + STD_WS; store_bytes (&romb[addr], data, sz); - return (0); + return 0; #endif @@ -1841,7 +1841,7 @@ memory_write(asi, addr, data, sz, ws) *ws = MEM_EX_WS; set_sfsr(UIMP_ACC, addr, asi, 0); - return (1); + return 1; } static unsigned char * @@ -1850,19 +1850,19 @@ get_mem_ptr(addr, size) 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 @@ -1874,10 +1874,10 @@ sis_memory_write(addr, data, length) char *mem; if ((mem = get_mem_ptr(addr, length)) == ((char *) -1)) - return (0); + return 0; memcpy(mem, data, length); - return (length); + return length; } int @@ -1889,10 +1889,10 @@ sis_memory_read(addr, data, length) 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; diff --git a/sim/erc32/exec.c b/sim/erc32/exec.c index 275218a..e6ce6c5 100644 --- a/sim/erc32/exec.c +++ b/sim/erc32/exec.c @@ -252,7 +252,7 @@ sub_cc(psr, operand1, operand2, result) (~operand1 & operand2 & result)) >> 10) & PSR_V); psr = (psr & ~PSR_C) | ((((~operand1 & operand2) | ((~operand1 | operand2) & result)) >> 11) & PSR_C); - return (psr); + return psr; } uint32 @@ -271,7 +271,7 @@ add_cc(psr, operand1, operand2, result) (~operand1 & ~operand2 & result)) >> 10) & PSR_V); psr = (psr & ~PSR_C) | ((((operand1 & operand2) | ((operand1 | operand2) & ~result)) >> 11) & PSR_C); - return(psr); + return psr; } static void @@ -293,7 +293,7 @@ add32 (uint32 n1, uint32 n2, int *carry) uint32 result = n1 + n2; *carry = result < n1 || result < n1; - return(result); + return result; } /* Multiply two 32-bit integers. */ @@ -1583,7 +1583,7 @@ dispatch_instruction(sregs) sregs->pc = pc; sregs->npc = npc; } - return (0); + return 0; } #define T_FABSs 2 @@ -1645,11 +1645,11 @@ fpexec(op3, rd, rs1, rs2, sregs) 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; @@ -1909,7 +1909,7 @@ fpexec(op3, rd, rs1, rs2, sregs) } clear_accex(); - return (0); + return 0; } @@ -1922,13 +1922,13 @@ chk_asi(sregs, asi, op3) { 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 @@ -1942,11 +1942,11 @@ execute_trap(sregs) 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; @@ -1973,7 +1973,7 @@ execute_trap(sregs) } - return (0); + return 0; } @@ -1996,10 +1996,10 @@ check_interrupts(sregs) 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 diff --git a/sim/erc32/float.c b/sim/erc32/float.c index e8807fb..e5beb7d 100644 --- a/sim/erc32/float.c +++ b/sim/erc32/float.c @@ -52,7 +52,7 @@ get_accex() accx |= 8; if (fexc & FE_INVALID) accx |= 0x10; - return(accx); + return accx; } /* How to clear the accrued exceptions */ diff --git a/sim/erc32/func.c b/sim/erc32/func.c index 265d42f..cef66ed 100644 --- a/sim/erc32/func.c +++ b/sim/erc32/func.c @@ -86,7 +86,7 @@ batch(sregs, fname) 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); @@ -98,7 +98,7 @@ batch(sregs, fname) } free(lbuf); fclose(fp); - return (1); + return 1; } void @@ -375,7 +375,7 @@ limcalc (freq) lim = -1; } } - return (lim); + return lim; } int @@ -610,7 +610,7 @@ exec_cmd(sregs, cmd) } if (cmdsave != NULL) free(cmdsave); - return (stat); + return stat; } @@ -749,7 +749,7 @@ disp_fpu(sregs) printf("\n"); } printf("\n"); - return (OK); + return OK; } static void @@ -950,7 +950,7 @@ advance_time(sregs) uint32 now() { - return(ebase.simtime); + return ebase.simtime; } @@ -982,7 +982,7 @@ wait_for_irq() } } sregs.pwdtime += ebase.simtime - endtime; - return (ebase.simtime - endtime); + return ebase.simtime - endtime; } int @@ -992,12 +992,12 @@ check_bpt(sregs) 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 @@ -1046,11 +1046,11 @@ bfd_load(fname) 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); @@ -1135,7 +1135,7 @@ bfd_load(fname) if (sis_verbose) printf("\n"); - return(bfd_get_start_address (pbfd)); + return bfd_get_start_address (pbfd); } double get_time (void) @@ -1146,5 +1146,5 @@ double get_time (void) gettimeofday (&tm, NULL); usec = ((double) tm.tv_sec) * 1E6 + ((double) tm.tv_usec); - return (usec / 1E6); + return usec / 1E6; } diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c index 7d64ed6..f3764f1 100644 --- a/sim/erc32/interf.c +++ b/sim/erc32/interf.c @@ -125,7 +125,7 @@ run_sim(sregs, icount, dis) sim_halt(); restore_stdio(); clearerr(stdin); - return (BPT_HIT); + return BPT_HIT; } else dispatch_instruction(sregs); } @@ -148,18 +148,18 @@ run_sim(sregs, icount, dis) 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 @@ -343,7 +343,7 @@ sim_write(sd, mem, buf, length) const unsigned char *buf; int length; { - return (sis_memory_write(mem, buf, length)); + return sis_memory_write (mem, buf, length); } int @@ -353,7 +353,7 @@ sim_read(sd, mem, buf, length) unsigned char *buf; int length; { - return (sis_memory_read(mem, buf, length)); + return sis_memory_read (mem, buf, length); } void diff --git a/sim/erc32/sis.c b/sim/erc32/sis.c index 931e3f3..c13b246 100644 --- a/sim/erc32/sis.c +++ b/sim/erc32/sis.c @@ -104,7 +104,7 @@ run_sim(sregs, icount, dis) 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; @@ -140,12 +140,12 @@ run_sim(sregs, icount, dis) 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 |