2015-05-17 17:11:17 +08:00
|
|
|
/* This file is part of SIS (SPARC instruction simulator)
|
|
|
|
|
2022-01-01 22:56:03 +08:00
|
|
|
Copyright (C) 1995-2022 Free Software Foundation, Inc.
|
2015-05-17 17:11:17 +08:00
|
|
|
Contributed by Jiri Gaisler, European Space Agency
|
2015-05-08 22:11:38 +08:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2021-05-02 06:05:23 +08:00
|
|
|
/* This must come before any other includes. */
|
|
|
|
#include "defs.h"
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
#include <signal.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include "sis.h"
|
|
|
|
#include <dis-asm.h>
|
|
|
|
#include "sim-config.h"
|
2015-03-18 05:02:38 +08:00
|
|
|
#include <inttypes.h>
|
2021-04-08 22:52:50 +08:00
|
|
|
#include <sys/time.h>
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
#define VAL(x) strtoul(x,(char **)NULL,0)
|
|
|
|
|
|
|
|
struct disassemble_info dinfo;
|
|
|
|
struct pstate sregs;
|
|
|
|
extern struct estate ebase;
|
|
|
|
int ctrl_c = 0;
|
|
|
|
int sis_verbose = 0;
|
|
|
|
char *sis_version = "2.7.5";
|
|
|
|
int nfp = 0;
|
|
|
|
int ift = 0;
|
|
|
|
int wrp = 0;
|
|
|
|
int rom8 = 0;
|
|
|
|
int uben = 0;
|
|
|
|
int termsave;
|
|
|
|
int sparclite = 0; /* emulating SPARClite instructions? */
|
|
|
|
int sparclite_board = 0; /* emulating SPARClite board RAM? */
|
|
|
|
char uart_dev1[128] = "";
|
|
|
|
char uart_dev2[128] = "";
|
|
|
|
extern int ext_irl;
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t last_load_addr = 0;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
#ifdef ERRINJ
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t errcnt = 0;
|
|
|
|
uint32_t errper = 0;
|
|
|
|
uint32_t errtt = 0;
|
|
|
|
uint32_t errftt = 0;
|
|
|
|
uint32_t errmec = 0;
|
1999-04-16 09:35:26 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
|
2014-01-05 12:43:21 +08:00
|
|
|
static int batch (struct pstate *sregs, char *fname);
|
2021-12-06 01:29:43 +08:00
|
|
|
static void set_rega (struct pstate *sregs, char *reg, uint32_t rval);
|
2014-01-05 12:43:21 +08:00
|
|
|
static void disp_reg (struct pstate *sregs, char *reg);
|
2021-12-06 01:29:43 +08:00
|
|
|
static uint32_t limcalc (float32 freq);
|
|
|
|
static void int_handler (int32_t sig);
|
2014-01-05 12:43:21 +08:00
|
|
|
static void init_event (void);
|
|
|
|
static int disp_fpu (struct pstate *sregs);
|
|
|
|
static void disp_regs (struct pstate *sregs, int cwp);
|
|
|
|
static void disp_ctrl (struct pstate *sregs);
|
2021-12-06 01:29:43 +08:00
|
|
|
static void disp_mem (uint32_t addr, uint32_t len);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
static int
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
batch(struct pstate *sregs, char *fname)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
FILE *fp;
|
2015-03-18 05:02:39 +08:00
|
|
|
char *lbuf = NULL;
|
|
|
|
size_t len = 0;
|
|
|
|
size_t slen;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
if ((fp = fopen(fname, "r")) == NULL) {
|
|
|
|
fprintf(stderr, "couldn't open batch file %s\n", fname);
|
2015-03-28 14:46:48 +08:00
|
|
|
return 0;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
2015-03-18 05:02:39 +08:00
|
|
|
while (getline(&lbuf, &len, fp) > -1) {
|
|
|
|
slen = strlen(lbuf);
|
|
|
|
if (slen && (lbuf[slen - 1] == '\n')) {
|
|
|
|
lbuf[slen - 1] = 0;
|
|
|
|
printf("sis> %s\n", lbuf);
|
|
|
|
exec_cmd(sregs, lbuf);
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
2015-03-18 05:02:39 +08:00
|
|
|
free(lbuf);
|
1999-04-16 09:35:26 +08:00
|
|
|
fclose(fp);
|
2015-03-28 14:46:48 +08:00
|
|
|
return 1;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-06 01:29:43 +08:00
|
|
|
set_regi(struct pstate *sregs, int32_t reg, uint32_t rval)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t cwp;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
cwp = ((sregs->psr & 0x7) << 4);
|
|
|
|
if ((reg > 0) && (reg < 8)) {
|
|
|
|
sregs->g[reg] = rval;
|
|
|
|
} else if ((reg >= 8) && (reg < 32)) {
|
|
|
|
sregs->r[(cwp + reg) & 0x7f] = rval;
|
|
|
|
} else if ((reg >= 32) && (reg < 64)) {
|
|
|
|
sregs->fsi[reg - 32] = rval;
|
|
|
|
} else {
|
|
|
|
switch (reg) {
|
|
|
|
case 64:
|
|
|
|
sregs->y = rval;
|
|
|
|
break;
|
|
|
|
case 65:
|
|
|
|
sregs->psr = rval;
|
|
|
|
break;
|
|
|
|
case 66:
|
|
|
|
sregs->wim = rval;
|
|
|
|
break;
|
|
|
|
case 67:
|
|
|
|
sregs->tbr = rval;
|
|
|
|
break;
|
|
|
|
case 68:
|
|
|
|
sregs->pc = rval;
|
|
|
|
break;
|
|
|
|
case 69:
|
|
|
|
sregs->npc = rval;
|
|
|
|
break;
|
|
|
|
case 70:
|
|
|
|
sregs->fsr = rval;
|
|
|
|
set_fsr(rval);
|
|
|
|
break;
|
|
|
|
default:break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-06 01:29:43 +08:00
|
|
|
get_regi(struct pstate * sregs, int32_t reg, unsigned char *buf)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t cwp;
|
|
|
|
uint32_t rval = 0;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
cwp = ((sregs->psr & 0x7) << 4);
|
|
|
|
if ((reg >= 0) && (reg < 8)) {
|
|
|
|
rval = sregs->g[reg];
|
|
|
|
} else if ((reg >= 8) && (reg < 32)) {
|
|
|
|
rval = sregs->r[(cwp + reg) & 0x7f];
|
|
|
|
} else if ((reg >= 32) && (reg < 64)) {
|
|
|
|
rval = sregs->fsi[reg - 32];
|
|
|
|
} else {
|
|
|
|
switch (reg) {
|
|
|
|
case 64:
|
|
|
|
rval = sregs->y;
|
|
|
|
break;
|
|
|
|
case 65:
|
|
|
|
rval = sregs->psr;
|
|
|
|
break;
|
|
|
|
case 66:
|
|
|
|
rval = sregs->wim;
|
|
|
|
break;
|
|
|
|
case 67:
|
|
|
|
rval = sregs->tbr;
|
|
|
|
break;
|
|
|
|
case 68:
|
|
|
|
rval = sregs->pc;
|
|
|
|
break;
|
|
|
|
case 69:
|
|
|
|
rval = sregs->npc;
|
|
|
|
break;
|
|
|
|
case 70:
|
|
|
|
rval = sregs->fsr;
|
|
|
|
break;
|
|
|
|
default:break;
|
|
|
|
}
|
|
|
|
}
|
2015-04-04 04:35:48 +08:00
|
|
|
buf[0] = (rval >> 24) & 0x0ff;
|
|
|
|
buf[1] = (rval >> 16) & 0x0ff;
|
|
|
|
buf[2] = (rval >> 8) & 0x0ff;
|
|
|
|
buf[3] = rval & 0x0ff;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2021-12-06 01:29:43 +08:00
|
|
|
set_rega(struct pstate *sregs, char *reg, uint32_t rval)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t cwp;
|
|
|
|
int32_t err = 0;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
cwp = ((sregs->psr & 0x7) << 4);
|
|
|
|
if (strcmp(reg, "psr") == 0)
|
|
|
|
sregs->psr = (rval = (rval & 0x00f03fff));
|
|
|
|
else if (strcmp(reg, "tbr") == 0)
|
|
|
|
sregs->tbr = (rval = (rval & 0xfffffff0));
|
|
|
|
else if (strcmp(reg, "wim") == 0)
|
|
|
|
sregs->wim = (rval = (rval & 0x0ff));
|
|
|
|
else if (strcmp(reg, "y") == 0)
|
|
|
|
sregs->y = rval;
|
|
|
|
else if (strcmp(reg, "pc") == 0)
|
|
|
|
sregs->pc = rval;
|
|
|
|
else if (strcmp(reg, "npc") == 0)
|
|
|
|
sregs->npc = rval;
|
|
|
|
else if (strcmp(reg, "fsr") == 0) {
|
|
|
|
sregs->fsr = rval;
|
|
|
|
set_fsr(rval);
|
|
|
|
} else if (strcmp(reg, "g0") == 0)
|
|
|
|
err = 2;
|
|
|
|
else if (strcmp(reg, "g1") == 0)
|
|
|
|
sregs->g[1] = rval;
|
|
|
|
else if (strcmp(reg, "g2") == 0)
|
|
|
|
sregs->g[2] = rval;
|
|
|
|
else if (strcmp(reg, "g3") == 0)
|
|
|
|
sregs->g[3] = rval;
|
|
|
|
else if (strcmp(reg, "g4") == 0)
|
|
|
|
sregs->g[4] = rval;
|
|
|
|
else if (strcmp(reg, "g5") == 0)
|
|
|
|
sregs->g[5] = rval;
|
|
|
|
else if (strcmp(reg, "g6") == 0)
|
|
|
|
sregs->g[6] = rval;
|
|
|
|
else if (strcmp(reg, "g7") == 0)
|
|
|
|
sregs->g[7] = rval;
|
|
|
|
else if (strcmp(reg, "o0") == 0)
|
|
|
|
sregs->r[(cwp + 8) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "o1") == 0)
|
|
|
|
sregs->r[(cwp + 9) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "o2") == 0)
|
|
|
|
sregs->r[(cwp + 10) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "o3") == 0)
|
|
|
|
sregs->r[(cwp + 11) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "o4") == 0)
|
|
|
|
sregs->r[(cwp + 12) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "o5") == 0)
|
|
|
|
sregs->r[(cwp + 13) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "o6") == 0)
|
|
|
|
sregs->r[(cwp + 14) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "o7") == 0)
|
|
|
|
sregs->r[(cwp + 15) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "l0") == 0)
|
|
|
|
sregs->r[(cwp + 16) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "l1") == 0)
|
|
|
|
sregs->r[(cwp + 17) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "l2") == 0)
|
|
|
|
sregs->r[(cwp + 18) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "l3") == 0)
|
|
|
|
sregs->r[(cwp + 19) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "l4") == 0)
|
|
|
|
sregs->r[(cwp + 20) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "l5") == 0)
|
|
|
|
sregs->r[(cwp + 21) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "l6") == 0)
|
|
|
|
sregs->r[(cwp + 22) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "l7") == 0)
|
|
|
|
sregs->r[(cwp + 23) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "i0") == 0)
|
|
|
|
sregs->r[(cwp + 24) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "i1") == 0)
|
|
|
|
sregs->r[(cwp + 25) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "i2") == 0)
|
|
|
|
sregs->r[(cwp + 26) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "i3") == 0)
|
|
|
|
sregs->r[(cwp + 27) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "i4") == 0)
|
|
|
|
sregs->r[(cwp + 28) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "i5") == 0)
|
|
|
|
sregs->r[(cwp + 29) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "i6") == 0)
|
|
|
|
sregs->r[(cwp + 30) & 0x7f] = rval;
|
|
|
|
else if (strcmp(reg, "i7") == 0)
|
|
|
|
sregs->r[(cwp + 31) & 0x7f] = rval;
|
|
|
|
else
|
|
|
|
err = 1;
|
|
|
|
switch (err) {
|
|
|
|
case 0:
|
|
|
|
printf("%s = %d (0x%08x)\n", reg, rval, rval);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
printf("no such regiser: %s\n", reg);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
printf("cannot set g0\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
disp_reg(struct pstate *sregs, char *reg)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (strncmp(reg, "w",1) == 0)
|
|
|
|
disp_regs(sregs, VAL(®[1]));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef ERRINJ
|
|
|
|
|
|
|
|
void
|
|
|
|
errinj()
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
switch (err = (random() % 12)) {
|
|
|
|
case 0: errtt = 0x61; break;
|
|
|
|
case 1: errtt = 0x62; break;
|
|
|
|
case 2: errtt = 0x63; break;
|
|
|
|
case 3: errtt = 0x64; break;
|
|
|
|
case 4: errtt = 0x65; break;
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7: errftt = err;
|
|
|
|
break;
|
|
|
|
case 8: errmec = 1; break;
|
|
|
|
case 9: errmec = 2; break;
|
|
|
|
case 10: errmec = 5; break;
|
|
|
|
case 11: errmec = 6; break;
|
|
|
|
}
|
|
|
|
errcnt++;
|
|
|
|
if (errper) event(errinj, 0, (random()%errper));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
errinjstart()
|
|
|
|
{
|
|
|
|
if (errper) event(errinj, 0, (random()%errper));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-12-06 01:29:43 +08:00
|
|
|
static uint32_t
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
limcalc (float32 freq)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t unit, lim;
|
1999-04-16 09:35:26 +08:00
|
|
|
double flim;
|
|
|
|
char *cmd1, *cmd2;
|
|
|
|
|
|
|
|
unit = 1;
|
|
|
|
lim = -1;
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
lim = VAL(cmd1);
|
|
|
|
if ((cmd2 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
if (strcmp(cmd2,"us")==0) unit = 1;
|
|
|
|
if (strcmp(cmd2,"ms")==0) unit = 1000;
|
|
|
|
if (strcmp(cmd2,"s")==0) unit = 1000000;
|
|
|
|
}
|
|
|
|
flim = (double) lim * (double) unit * (double) freq +
|
|
|
|
(double) ebase.simtime;
|
|
|
|
if ((flim > ebase.simtime) && (flim < 4294967296.0)) {
|
2021-12-06 01:29:43 +08:00
|
|
|
lim = (uint32_t) flim;
|
1999-04-16 09:35:26 +08:00
|
|
|
} else {
|
|
|
|
printf("error in expression\n");
|
|
|
|
lim = -1;
|
|
|
|
}
|
|
|
|
}
|
2015-03-28 14:46:48 +08:00
|
|
|
return lim;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
2015-03-18 05:02:42 +08:00
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
int
|
2015-03-18 05:02:42 +08:00
|
|
|
exec_cmd(struct pstate *sregs, const char *cmd)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
char *cmd1, *cmd2;
|
2021-12-06 01:29:43 +08:00
|
|
|
int32_t stat;
|
|
|
|
uint32_t len, i, clen, j;
|
|
|
|
static uint32_t daddr = 0;
|
2015-03-18 05:02:42 +08:00
|
|
|
char *cmdsave, *cmdsave2 = NULL;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
stat = OK;
|
|
|
|
cmdsave = strdup(cmd);
|
2015-03-18 05:02:42 +08:00
|
|
|
cmdsave2 = strdup (cmd);
|
|
|
|
if ((cmd1 = strtok (cmdsave2, " \t")) != NULL) {
|
1999-04-16 09:35:26 +08:00
|
|
|
clen = strlen(cmd1);
|
|
|
|
if (strncmp(cmd1, "bp", clen) == 0) {
|
|
|
|
for (i = 0; i < sregs->bptnum; i++) {
|
|
|
|
printf(" %d : 0x%08x\n", i + 1, sregs->bpts[i]);
|
|
|
|
}
|
|
|
|
} else if (strncmp(cmd1, "+bp", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
sregs->bpts[sregs->bptnum] = VAL(cmd1) & ~0x3;
|
|
|
|
printf("added breakpoint %d at 0x%08x\n",
|
|
|
|
sregs->bptnum + 1, sregs->bpts[sregs->bptnum]);
|
|
|
|
sregs->bptnum += 1;
|
|
|
|
}
|
|
|
|
} else if (strncmp(cmd1, "-bp", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
i = VAL(cmd1) - 1;
|
|
|
|
if ((i >= 0) && (i < sregs->bptnum)) {
|
|
|
|
printf("deleted breakpoint %d at 0x%08x\n", i + 1,
|
|
|
|
sregs->bpts[i]);
|
|
|
|
for (; i < sregs->bptnum - 1; i++) {
|
|
|
|
sregs->bpts[i] = sregs->bpts[i + 1];
|
|
|
|
}
|
|
|
|
sregs->bptnum -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (strncmp(cmd1, "batch", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) == NULL) {
|
|
|
|
printf("no file specified\n");
|
|
|
|
} else {
|
|
|
|
batch(sregs, cmd1);
|
|
|
|
}
|
|
|
|
} else if (strncmp(cmd1, "cont", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) == NULL) {
|
2010-05-11 22:18:20 +08:00
|
|
|
stat = run_sim(sregs, UINT64_MAX, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
} else {
|
|
|
|
stat = run_sim(sregs, VAL(cmd1), 0);
|
|
|
|
}
|
|
|
|
daddr = sregs->pc;
|
|
|
|
sim_halt();
|
|
|
|
} else if (strncmp(cmd1, "debug", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
sis_verbose = VAL(cmd1);
|
|
|
|
}
|
|
|
|
printf("Debug level = %d\n",sis_verbose);
|
|
|
|
} else if (strncmp(cmd1, "dis", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
daddr = VAL(cmd1);
|
|
|
|
}
|
|
|
|
if ((cmd2 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
len = VAL(cmd2);
|
|
|
|
} else
|
|
|
|
len = 16;
|
|
|
|
printf("\n");
|
|
|
|
dis_mem(daddr, len, &dinfo);
|
|
|
|
printf("\n");
|
|
|
|
daddr += len * 4;
|
|
|
|
} else if (strncmp(cmd1, "echo", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
printf("%s\n", (&cmdsave[clen+1]));
|
|
|
|
}
|
|
|
|
#ifdef ERRINJ
|
|
|
|
} else if (strncmp(cmd1, "error", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
errper = VAL(cmd1);
|
|
|
|
if (errper) {
|
|
|
|
event(errinj, 0, (len = (random()%errper)));
|
|
|
|
printf("Error injection started with period %d\n",len);
|
|
|
|
}
|
|
|
|
} else printf("Injected errors: %d\n",errcnt);
|
|
|
|
#endif
|
|
|
|
} else if (strncmp(cmd1, "float", clen) == 0) {
|
|
|
|
stat = disp_fpu(sregs);
|
|
|
|
} else if (strncmp(cmd1, "go", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) == NULL) {
|
|
|
|
len = last_load_addr;
|
|
|
|
} else {
|
|
|
|
len = VAL(cmd1);
|
|
|
|
}
|
|
|
|
sregs->pc = len & ~3;
|
|
|
|
sregs->npc = sregs->pc + 4;
|
2015-02-20 06:31:21 +08:00
|
|
|
if ((sregs->pc != 0) && (ebase.simtime == 0))
|
|
|
|
boot_init();
|
1999-04-16 09:35:26 +08:00
|
|
|
printf("resuming at 0x%08x\n",sregs->pc);
|
|
|
|
if ((cmd2 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
stat = run_sim(sregs, VAL(cmd2), 0);
|
|
|
|
} else {
|
2010-05-11 22:18:20 +08:00
|
|
|
stat = run_sim(sregs, UINT64_MAX, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
daddr = sregs->pc;
|
|
|
|
sim_halt();
|
|
|
|
} else if (strncmp(cmd1, "help", clen) == 0) {
|
|
|
|
gen_help();
|
|
|
|
} else if (strncmp(cmd1, "history", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
sregs->histlen = VAL(cmd1);
|
|
|
|
if (sregs->histbuf != NULL)
|
|
|
|
free(sregs->histbuf);
|
|
|
|
sregs->histbuf = (struct histype *) calloc(sregs->histlen, sizeof(struct histype));
|
|
|
|
printf("trace history length = %d\n\r", sregs->histlen);
|
|
|
|
sregs->histind = 0;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
j = sregs->histind;
|
|
|
|
for (i = 0; i < sregs->histlen; i++) {
|
|
|
|
if (j >= sregs->histlen)
|
|
|
|
j = 0;
|
|
|
|
printf(" %8d ", sregs->histbuf[j].time);
|
|
|
|
dis_mem(sregs->histbuf[j].addr, 1, &dinfo);
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (strncmp(cmd1, "load", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
|
|
|
last_load_addr = bfd_load(cmd1);
|
|
|
|
while ((cmd1 = strtok(NULL, " \t\n\r")) != NULL)
|
|
|
|
last_load_addr = bfd_load(cmd1);
|
|
|
|
} else {
|
|
|
|
printf("load: no file specified\n");
|
|
|
|
}
|
|
|
|
} else if (strncmp(cmd1, "mem", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL)
|
|
|
|
daddr = VAL(cmd1);
|
|
|
|
if ((cmd2 = strtok(NULL, " \t\n\r")) != NULL)
|
|
|
|
len = VAL(cmd2);
|
|
|
|
else
|
|
|
|
len = 64;
|
|
|
|
disp_mem(daddr, len);
|
|
|
|
daddr += len;
|
|
|
|
} else if (strncmp(cmd1, "perf", clen) == 0) {
|
|
|
|
cmd1 = strtok(NULL, " \t\n\r");
|
|
|
|
if ((cmd1 != NULL) &&
|
|
|
|
(strncmp(cmd1, "reset", strlen(cmd1)) == 0)) {
|
|
|
|
reset_stat(sregs);
|
|
|
|
} else
|
|
|
|
show_stat(sregs);
|
|
|
|
} else if (strncmp(cmd1, "quit", clen) == 0) {
|
|
|
|
exit(0);
|
|
|
|
} else if (strncmp(cmd1, "reg", clen) == 0) {
|
|
|
|
cmd1 = strtok(NULL, " \t\n\r");
|
|
|
|
cmd2 = strtok(NULL, " \t\n\r");
|
|
|
|
if (cmd2 != NULL)
|
|
|
|
set_rega(sregs, cmd1, VAL(cmd2));
|
|
|
|
else if (cmd1 != NULL)
|
|
|
|
disp_reg(sregs, cmd1);
|
|
|
|
else {
|
|
|
|
disp_regs(sregs,sregs->psr);
|
|
|
|
disp_ctrl(sregs);
|
|
|
|
}
|
|
|
|
} else if (strncmp(cmd1, "reset", clen) == 0) {
|
|
|
|
ebase.simtime = 0;
|
|
|
|
reset_all();
|
|
|
|
reset_stat(sregs);
|
|
|
|
} else if (strncmp(cmd1, "run", clen) == 0) {
|
|
|
|
ebase.simtime = 0;
|
|
|
|
reset_all();
|
|
|
|
reset_stat(sregs);
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) == NULL) {
|
2010-05-11 22:18:20 +08:00
|
|
|
stat = run_sim(sregs, UINT64_MAX, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
} else {
|
|
|
|
stat = run_sim(sregs, VAL(cmd1), 0);
|
|
|
|
}
|
|
|
|
daddr = sregs->pc;
|
|
|
|
sim_halt();
|
|
|
|
} else if (strncmp(cmd1, "shell", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) != NULL) {
|
2015-03-18 05:02:39 +08:00
|
|
|
if (system(&cmdsave[clen])) {
|
|
|
|
/* Silence unused return value warning. */
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
} else if (strncmp(cmd1, "step", clen) == 0) {
|
|
|
|
stat = run_sim(sregs, 1, 1);
|
|
|
|
daddr = sregs->pc;
|
|
|
|
sim_halt();
|
|
|
|
} else if (strncmp(cmd1, "tcont", clen) == 0) {
|
|
|
|
sregs->tlimit = limcalc(sregs->freq);
|
2010-05-11 22:18:20 +08:00
|
|
|
stat = run_sim(sregs, UINT64_MAX, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
daddr = sregs->pc;
|
|
|
|
sim_halt();
|
|
|
|
} else if (strncmp(cmd1, "tgo", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) == NULL) {
|
|
|
|
len = last_load_addr;
|
|
|
|
} else {
|
|
|
|
len = VAL(cmd1);
|
|
|
|
sregs->tlimit = limcalc(sregs->freq);
|
|
|
|
}
|
|
|
|
sregs->pc = len & ~3;
|
|
|
|
sregs->npc = sregs->pc + 4;
|
|
|
|
printf("resuming at 0x%08x\n",sregs->pc);
|
2010-05-11 22:18:20 +08:00
|
|
|
stat = run_sim(sregs, UINT64_MAX, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
daddr = sregs->pc;
|
|
|
|
sim_halt();
|
|
|
|
} else if (strncmp(cmd1, "tlimit", clen) == 0) {
|
|
|
|
sregs->tlimit = limcalc(sregs->freq);
|
2021-12-06 01:29:43 +08:00
|
|
|
if (sregs->tlimit != (uint32_t) -1)
|
|
|
|
printf("simulation limit = %u (%.3f ms)\n",(uint32_t) sregs->tlimit,
|
1999-04-16 09:35:26 +08:00
|
|
|
sregs->tlimit / sregs->freq / 1000);
|
|
|
|
} else if (strncmp(cmd1, "tra", clen) == 0) {
|
|
|
|
if ((cmd1 = strtok(NULL, " \t\n\r")) == NULL) {
|
2010-05-11 22:18:20 +08:00
|
|
|
stat = run_sim(sregs, UINT64_MAX, 1);
|
1999-04-16 09:35:26 +08:00
|
|
|
} else {
|
|
|
|
stat = run_sim(sregs, VAL(cmd1), 1);
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
daddr = sregs->pc;
|
|
|
|
sim_halt();
|
|
|
|
} else if (strncmp(cmd1, "trun", clen) == 0) {
|
|
|
|
ebase.simtime = 0;
|
|
|
|
reset_all();
|
|
|
|
reset_stat(sregs);
|
|
|
|
sregs->tlimit = limcalc(sregs->freq);
|
2010-05-11 22:18:20 +08:00
|
|
|
stat = run_sim(sregs, UINT64_MAX, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
daddr = sregs->pc;
|
|
|
|
sim_halt();
|
|
|
|
} else
|
|
|
|
printf("syntax error\n");
|
|
|
|
}
|
2015-03-18 05:02:42 +08:00
|
|
|
if (cmdsave2 != NULL)
|
|
|
|
free(cmdsave2);
|
1999-04-16 09:35:26 +08:00
|
|
|
if (cmdsave != NULL)
|
|
|
|
free(cmdsave);
|
2015-03-28 14:46:48 +08:00
|
|
|
return stat;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
reset_stat(struct pstate *sregs)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2015-02-20 06:31:24 +08:00
|
|
|
sregs->tottime = 0.0;
|
1999-04-16 09:35:26 +08:00
|
|
|
sregs->pwdtime = 0;
|
|
|
|
sregs->ninst = 0;
|
|
|
|
sregs->fholdt = 0;
|
|
|
|
sregs->holdt = 0;
|
|
|
|
sregs->icntt = 0;
|
|
|
|
sregs->finst = 0;
|
|
|
|
sregs->nstore = 0;
|
|
|
|
sregs->nload = 0;
|
|
|
|
sregs->nbranch = 0;
|
|
|
|
sregs->simstart = ebase.simtime;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
show_stat(struct pstate *sregs)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t iinst;
|
|
|
|
uint32_t stime;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2015-02-20 06:31:24 +08:00
|
|
|
if (sregs->tottime == 0.0)
|
|
|
|
sregs->tottime += 1E-6;
|
1999-04-16 09:35:26 +08:00
|
|
|
stime = ebase.simtime - sregs->simstart; /* Total simulated time */
|
|
|
|
#ifdef STAT
|
|
|
|
|
|
|
|
iinst = sregs->ninst - sregs->finst - sregs->nload - sregs->nstore -
|
|
|
|
sregs->nbranch;
|
|
|
|
#endif
|
|
|
|
|
2015-03-18 05:02:38 +08:00
|
|
|
printf("\n Cycles : %9" PRIu64 "\n\r", ebase.simtime - sregs->simstart);
|
|
|
|
printf(" Instructions : %9" PRIu64 "\n", sregs->ninst);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
#ifdef STAT
|
|
|
|
printf(" integer : %9.2f %%\n", 100.0 * (float) iinst / (float) sregs->ninst);
|
|
|
|
printf(" load : %9.2f %%\n",
|
|
|
|
100.0 * (float) sregs->nload / (float) sregs->ninst);
|
|
|
|
printf(" store : %9.2f %%\n",
|
|
|
|
100.0 * (float) sregs->nstore / (float) sregs->ninst);
|
|
|
|
printf(" branch : %9.2f %%\n",
|
|
|
|
100.0 * (float) sregs->nbranch / (float) sregs->ninst);
|
|
|
|
printf(" float : %9.2f %%\n",
|
|
|
|
100.0 * (float) sregs->finst / (float) sregs->ninst);
|
|
|
|
printf(" Integer CPI : %9.2f\n",
|
|
|
|
((float) (stime - sregs->pwdtime - sregs->fholdt - sregs->finst))
|
|
|
|
/
|
|
|
|
(float) (sregs->ninst - sregs->finst));
|
|
|
|
printf(" Float CPI : %9.2f\n",
|
|
|
|
((float) sregs->fholdt / (float) sregs->finst) + 1.0);
|
|
|
|
#endif
|
|
|
|
printf(" Overall CPI : %9.2f\n",
|
|
|
|
(float) (stime - sregs->pwdtime) / (float) sregs->ninst);
|
|
|
|
printf("\n ERC32 performance (%4.1f MHz): %5.2f MOPS (%5.2f MIPS, %5.2f MFLOPS)\n",
|
|
|
|
sregs->freq, sregs->freq * (float) sregs->ninst / (float) (stime - sregs->pwdtime),
|
|
|
|
sregs->freq * (float) (sregs->ninst - sregs->finst) /
|
|
|
|
(float) (stime - sregs->pwdtime),
|
|
|
|
sregs->freq * (float) sregs->finst / (float) (stime - sregs->pwdtime));
|
2015-02-20 06:31:24 +08:00
|
|
|
printf(" Simulated ERC32 time : %.2f s\n",
|
|
|
|
(float) (ebase.simtime - sregs->simstart) / 1000000.0 / sregs->freq);
|
|
|
|
printf(" Processor utilisation : %.2f %%\n",
|
|
|
|
100.0 * (1.0 - ((float) sregs->pwdtime / (float) stime)));
|
|
|
|
printf(" Real-time performance : %.2f %%\n",
|
|
|
|
100.0 / (sregs->tottime / ((double) (stime) / (sregs->freq * 1.0E6))));
|
|
|
|
printf(" Simulator performance : %.2f MIPS\n",
|
|
|
|
(double)(sregs->ninst) / sregs->tottime / 1E6);
|
|
|
|
printf(" Used time (sys + user) : %.2f s\n\n", sregs->tottime);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
init_bpt(struct pstate *sregs)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
sregs->bptnum = 0;
|
|
|
|
sregs->histlen = 0;
|
|
|
|
sregs->histind = 0;
|
|
|
|
sregs->histbuf = NULL;
|
|
|
|
sregs->tlimit = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-12-06 01:29:43 +08:00
|
|
|
int_handler(int32_t sig)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (sig != 2)
|
|
|
|
printf("\n\n Signal handler error (%d)\n\n", sig);
|
|
|
|
ctrl_c = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
init_signals(void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
typedef void (*PFI) ();
|
|
|
|
static PFI int_tab[2];
|
|
|
|
|
|
|
|
int_tab[0] = signal(SIGTERM, int_handler);
|
|
|
|
int_tab[1] = signal(SIGINT, int_handler);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern struct disassemble_info dinfo;
|
|
|
|
|
|
|
|
struct estate ebase;
|
|
|
|
struct evcell evbuf[EVENT_MAX];
|
|
|
|
struct irqcell irqarr[16];
|
|
|
|
|
|
|
|
static int
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
disp_fpu(struct pstate *sregs)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
int i;
|
|
|
|
float t;
|
|
|
|
|
|
|
|
printf("\n fsr: %08X\n\n", sregs->fsr);
|
|
|
|
|
2015-03-16 13:14:09 +08:00
|
|
|
#ifdef HOST_LITTLE_ENDIAN
|
1999-04-16 09:35:26 +08:00
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
sregs->fdp[i ^ 1] = sregs->fs[i];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
t = sregs->fs[i];
|
|
|
|
printf(" f%02d %08x %14e ", i, sregs->fsi[i], sregs->fs[i]);
|
|
|
|
if (!(i & 1))
|
|
|
|
printf("%14e\n", sregs->fd[i >> 1]);
|
|
|
|
else
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
printf("\n");
|
2015-03-28 14:46:48 +08:00
|
|
|
return OK;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
disp_regs(struct pstate *sregs, int cwp)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
cwp = ((cwp & 0x7) << 4);
|
|
|
|
printf("\n\t INS LOCALS OUTS GLOBALS\n");
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
printf(" %d: %08X %08X %08X %08X\n", i,
|
|
|
|
sregs->r[(cwp + i + 24) & 0x7f],
|
|
|
|
sregs->r[(cwp + i + 16) & 0x7f], sregs->r[(cwp + i + 8) & 0x7f],
|
|
|
|
sregs->g[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-06 01:29:43 +08:00
|
|
|
static void print_insn_sparc_sis(uint32_t addr, struct disassemble_info *info)
|
2015-02-20 06:31:19 +08:00
|
|
|
{
|
|
|
|
unsigned char i[4];
|
|
|
|
|
|
|
|
sis_memory_read(addr, i, 4);
|
|
|
|
dinfo.buffer_vma = addr;
|
|
|
|
dinfo.buffer_length = 4;
|
|
|
|
dinfo.buffer = i;
|
|
|
|
print_insn_sparc(addr, info);
|
|
|
|
}
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
static void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
disp_ctrl(struct pstate *sregs)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t i;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
printf("\n psr: %08X wim: %08X tbr: %08X y: %08X\n",
|
|
|
|
sregs->psr, sregs->wim, sregs->tbr, sregs->y);
|
2015-04-04 04:35:48 +08:00
|
|
|
sis_memory_read (sregs->pc, (char *) &i, 4);
|
|
|
|
printf ("\n pc: %08X = %08X ", sregs->pc, i);
|
2015-02-20 06:31:19 +08:00
|
|
|
print_insn_sparc_sis(sregs->pc, &dinfo);
|
2015-04-04 04:35:48 +08:00
|
|
|
sis_memory_read (sregs->npc, (char *) &i, 4);
|
|
|
|
printf ("\n npc: %08X = %08X ", sregs->npc, i);
|
2015-02-20 06:31:19 +08:00
|
|
|
print_insn_sparc_sis(sregs->npc, &dinfo);
|
1999-04-16 09:35:26 +08:00
|
|
|
if (sregs->err_mode)
|
|
|
|
printf("\n IU in error mode");
|
|
|
|
printf("\n\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-12-06 01:29:43 +08:00
|
|
|
disp_mem(uint32_t addr, uint32_t len)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t i;
|
2015-04-04 04:35:48 +08:00
|
|
|
union {
|
|
|
|
unsigned char u8[4];
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t u32;
|
2015-04-04 04:35:48 +08:00
|
|
|
} data;
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t mem[4], j;
|
1999-04-16 09:35:26 +08:00
|
|
|
char *p;
|
|
|
|
|
|
|
|
for (i = addr & ~3; i < ((addr + len) & ~3); i += 16) {
|
|
|
|
printf("\n %8X ", i);
|
|
|
|
for (j = 0; j < 4; j++) {
|
2015-04-04 04:35:48 +08:00
|
|
|
sis_memory_read ((i + (j * 4)), data.u8, 4);
|
|
|
|
printf ("%08x ", data.u32);
|
|
|
|
mem[j] = data.u32;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
printf(" ");
|
|
|
|
p = (char *) mem;
|
|
|
|
for (j = 0; j < 16; j++) {
|
2015-04-04 04:35:48 +08:00
|
|
|
if (isprint (p[j ^ EBT]))
|
|
|
|
putchar (p[j ^ EBT]);
|
1999-04-16 09:35:26 +08:00
|
|
|
else
|
|
|
|
putchar('.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("\n\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-06 01:29:43 +08:00
|
|
|
dis_mem(uint32_t addr, uint32_t len, struct disassemble_info *info)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t i;
|
2015-04-04 04:35:48 +08:00
|
|
|
union {
|
|
|
|
unsigned char u8[4];
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t u32;
|
2015-04-04 04:35:48 +08:00
|
|
|
} data;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
for (i = addr & -3; i < ((addr & -3) + (len << 2)); i += 4) {
|
2015-04-04 04:35:48 +08:00
|
|
|
sis_memory_read (i, data.u8, 4);
|
|
|
|
printf (" %08x %08x ", i, data.u32);
|
2015-02-20 06:31:19 +08:00
|
|
|
print_insn_sparc_sis(i, info);
|
1999-04-16 09:35:26 +08:00
|
|
|
if (i >= 0xfffffffc) break;
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add event to event queue */
|
|
|
|
|
|
|
|
void
|
2021-12-06 01:29:43 +08:00
|
|
|
event(void (*cfunc) (), int32_t arg, uint64_t delta)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct evcell *ev1, *evins;
|
|
|
|
|
|
|
|
if (ebase.freeq == NULL) {
|
|
|
|
printf("Error, too many events in event queue\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ev1 = &ebase.eq;
|
|
|
|
delta += ebase.simtime;
|
|
|
|
while ((ev1->nxt != NULL) && (ev1->nxt->time <= delta)) {
|
|
|
|
ev1 = ev1->nxt;
|
|
|
|
}
|
|
|
|
if (ev1->nxt == NULL) {
|
|
|
|
ev1->nxt = ebase.freeq;
|
|
|
|
ebase.freeq = ebase.freeq->nxt;
|
|
|
|
ev1->nxt->nxt = NULL;
|
|
|
|
} else {
|
|
|
|
evins = ebase.freeq;
|
|
|
|
ebase.freeq = ebase.freeq->nxt;
|
|
|
|
evins->nxt = ev1->nxt;
|
|
|
|
ev1->nxt = evins;
|
|
|
|
}
|
|
|
|
ev1->nxt->time = delta;
|
|
|
|
ev1->nxt->cfunc = cfunc;
|
|
|
|
ev1->nxt->arg = arg;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0 /* apparently not used */
|
|
|
|
void
|
|
|
|
stop_event()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
init_event(void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2021-12-06 01:29:43 +08:00
|
|
|
int32_t i;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
ebase.eq.nxt = NULL;
|
|
|
|
ebase.freeq = evbuf;
|
|
|
|
for (i = 0; i < EVENT_MAX; i++) {
|
|
|
|
evbuf[i].nxt = &evbuf[i + 1];
|
|
|
|
}
|
|
|
|
evbuf[EVENT_MAX - 1].nxt = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-06 01:29:43 +08:00
|
|
|
set_int(int32_t level, void (*callback) (), int32_t arg)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
irqarr[level & 0x0f].callback = callback;
|
|
|
|
irqarr[level & 0x0f].arg = arg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Advance simulator time */
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
advance_time(struct pstate *sregs)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
struct evcell *evrem;
|
|
|
|
void (*cfunc) ();
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t arg;
|
|
|
|
uint64_t endtime;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
#ifdef STAT
|
|
|
|
sregs->fholdt += sregs->fhold;
|
|
|
|
sregs->holdt += sregs->hold;
|
|
|
|
sregs->icntt += sregs->icnt;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
endtime = ebase.simtime + sregs->icnt + sregs->hold + sregs->fhold;
|
|
|
|
|
|
|
|
while ((ebase.eq.nxt->time <= (endtime)) && (ebase.eq.nxt != NULL)) {
|
|
|
|
ebase.simtime = ebase.eq.nxt->time;
|
|
|
|
cfunc = ebase.eq.nxt->cfunc;
|
|
|
|
arg = ebase.eq.nxt->arg;
|
|
|
|
evrem = ebase.eq.nxt;
|
|
|
|
ebase.eq.nxt = ebase.eq.nxt->nxt;
|
|
|
|
evrem->nxt = ebase.freeq;
|
|
|
|
ebase.freeq = evrem;
|
|
|
|
cfunc(arg);
|
|
|
|
}
|
|
|
|
ebase.simtime = endtime;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-12-06 01:29:43 +08:00
|
|
|
uint32_t
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
now(void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2015-03-28 14:46:48 +08:00
|
|
|
return ebase.simtime;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Advance time until an external interrupt is seen */
|
|
|
|
|
|
|
|
int
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
wait_for_irq(void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
struct evcell *evrem;
|
|
|
|
void (*cfunc) ();
|
2021-12-06 01:29:43 +08:00
|
|
|
int32_t arg;
|
|
|
|
uint64_t endtime;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
if (ebase.eq.nxt == NULL)
|
|
|
|
printf("Warning: event queue empty - power-down mode not entered\n");
|
|
|
|
endtime = ebase.simtime;
|
|
|
|
while (!ext_irl && (ebase.eq.nxt != NULL)) {
|
|
|
|
ebase.simtime = ebase.eq.nxt->time;
|
|
|
|
cfunc = ebase.eq.nxt->cfunc;
|
|
|
|
arg = ebase.eq.nxt->arg;
|
|
|
|
evrem = ebase.eq.nxt;
|
|
|
|
ebase.eq.nxt = ebase.eq.nxt->nxt;
|
|
|
|
evrem->nxt = ebase.freeq;
|
|
|
|
ebase.freeq = evrem;
|
|
|
|
cfunc(arg);
|
|
|
|
if (ctrl_c) {
|
|
|
|
printf("\bwarning: power-down mode interrupted\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sregs.pwdtime += ebase.simtime - endtime;
|
2015-03-28 14:46:48 +08:00
|
|
|
return ebase.simtime - endtime;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
check_bpt(struct pstate *sregs)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2021-12-06 01:29:43 +08:00
|
|
|
int32_t i;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
if ((sregs->bphit) || (sregs->annul))
|
2015-03-28 14:46:48 +08:00
|
|
|
return 0;
|
2021-12-06 01:29:43 +08:00
|
|
|
for (i = 0; i < (int32_t) sregs->bptnum; i++) {
|
1999-04-16 09:35:26 +08:00
|
|
|
if (sregs->pc == sregs->bpts[i])
|
2015-03-28 14:46:48 +08:00
|
|
|
return BPT_HIT;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
2015-03-28 14:46:48 +08:00
|
|
|
return 0;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
reset_all(void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
init_event(); /* Clear event queue */
|
|
|
|
init_regs(&sregs);
|
|
|
|
reset();
|
|
|
|
#ifdef ERRINJ
|
|
|
|
errinjstart();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
sys_reset(void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
reset_all();
|
|
|
|
sregs.trap = 256; /* Force fake reset trap */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Do not use old-style definitions in sim
This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.
2021-04-08 Tom Tromey <tom@tromey.com>
* bpf.c (bpf_def_model_init): Use new-style declaration.
sim/common/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
new-style declaration.
sim/erc32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sis.c (run_sim, main): Use new-style declaration.
* interf.c (run_sim, sim_open, sim_close, sim_load)
(sim_create_inferior, sim_store_register, sim_fetch_register)
(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
new-style declaration.
* help.c (usage, gen_help): Use new-style declaration.
* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
(reset_stat, show_stat, init_bpt, int_handler, init_signals)
(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
(reset_all, sys_reset, sys_halt): Use new-style declaration.
* float.c (get_accex, clear_accex, set_fsr): Use new-style
declaration.
* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
(chk_asi, execute_trap, check_interrupts, init_regs): Use
new-style declaration.
* erc32.c (init_sim, reset, decode_ersr, mecparerror)
(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
(port_init, read_uart, write_uart, flush_uart, uarta_tx)
(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
(memory_read, memory_write, get_mem_ptr, sis_memory_write)
(sis_memory_read): Use new-style declaration.
sim/frv/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
new-style declaration.
sim/h8300/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* compile.c (cmdline_location): Use new-style declaration.
sim/iq2000/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
* iq2000.c (fetch_str): Use new-style declaration.
sim/lm32/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
sim/m32r/ChangeLog
2021-04-08 Tom Tromey <tom@tromey.com>
* sim-if.c (sim_open, sim_create_inferior): Use new-style
declaration.
2021-04-08 20:41:25 +08:00
|
|
|
sys_halt(void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
sregs.trap = 257; /* Force fake halt trap */
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "ansidecl.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "libiberty.h"
|
|
|
|
#include "bfd.h"
|
|
|
|
|
2021-10-29 14:42:15 +08:00
|
|
|
#ifndef min
|
1999-04-16 09:35:26 +08:00
|
|
|
#define min(A, B) (((A) < (B)) ? (A) : (B))
|
2021-10-29 14:42:15 +08:00
|
|
|
#endif
|
1999-04-16 09:35:26 +08:00
|
|
|
#define LOAD_ADDRESS 0
|
|
|
|
|
|
|
|
int
|
2015-03-18 05:02:42 +08:00
|
|
|
bfd_load (const char *fname)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
asection *section;
|
|
|
|
bfd *pbfd;
|
|
|
|
const bfd_arch_info_type *arch;
|
2015-04-04 04:35:48 +08:00
|
|
|
int i;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
pbfd = bfd_openr(fname, 0);
|
|
|
|
|
|
|
|
if (pbfd == NULL) {
|
|
|
|
printf("open of %s failed\n", fname);
|
2015-03-28 14:46:48 +08:00
|
|
|
return -1;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
if (!bfd_check_format(pbfd, bfd_object)) {
|
|
|
|
printf("file %s doesn't seem to be an object file\n", fname);
|
2015-03-28 14:46:48 +08:00
|
|
|
return -1;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
arch = bfd_get_arch_info (pbfd);
|
|
|
|
if (sis_verbose)
|
|
|
|
printf("loading %s:", fname);
|
|
|
|
for (section = pbfd->sections; section; section = section->next) {
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
if (bfd_section_flags (section) & SEC_ALLOC) {
|
1999-04-16 09:35:26 +08:00
|
|
|
bfd_vma section_address;
|
|
|
|
unsigned long section_size;
|
|
|
|
const char *section_name;
|
|
|
|
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
section_name = bfd_section_name (section);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
section_address = bfd_section_vma (section);
|
1999-04-16 09:35:26 +08:00
|
|
|
/*
|
|
|
|
* Adjust sections from a.out files, since they don't carry their
|
|
|
|
* addresses with.
|
|
|
|
*/
|
|
|
|
if (bfd_get_flavour(pbfd) == bfd_target_aout_flavour) {
|
|
|
|
if (strcmp (section_name, ".text") == 0)
|
|
|
|
section_address = bfd_get_start_address (pbfd);
|
|
|
|
else if (strcmp (section_name, ".data") == 0) {
|
|
|
|
/* Read the first 8 bytes of the data section.
|
|
|
|
There should be the string 'DaTa' followed by
|
|
|
|
a word containing the actual section address. */
|
|
|
|
struct data_marker
|
|
|
|
{
|
|
|
|
char signature[4]; /* 'DaTa' */
|
|
|
|
unsigned char sdata[4]; /* &sdata */
|
|
|
|
} marker;
|
|
|
|
bfd_get_section_contents (pbfd, section, &marker, 0,
|
|
|
|
sizeof (marker));
|
|
|
|
if (strncmp (marker.signature, "DaTa", 4) == 0)
|
|
|
|
{
|
2015-04-04 04:35:48 +08:00
|
|
|
section_address = bfd_getb32 (marker.sdata);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
section_size = bfd_section_size (section);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
if (sis_verbose)
|
2022-08-04 11:18:05 +08:00
|
|
|
printf("\nsection %s at 0x%08" PRIx64 " (0x%lx bytes)",
|
|
|
|
section_name, (uint64_t) section_address, section_size);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Text, data or lit */
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
if (bfd_section_flags (section) & SEC_LOAD) {
|
1999-04-16 09:35:26 +08:00
|
|
|
file_ptr fptr;
|
|
|
|
|
|
|
|
fptr = 0;
|
|
|
|
|
|
|
|
while (section_size > 0) {
|
|
|
|
char buffer[1024];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
count = min(section_size, 1024);
|
|
|
|
|
|
|
|
bfd_get_section_contents(pbfd, section, buffer, fptr, count);
|
|
|
|
|
2015-04-04 04:35:48 +08:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
sis_memory_write ((section_address + i) ^ EBT, &buffer[i], 1);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
section_address += count;
|
|
|
|
fptr += count;
|
|
|
|
section_size -= count;
|
|
|
|
}
|
|
|
|
} else /* BSS */
|
|
|
|
if (sis_verbose)
|
|
|
|
printf("(not loaded)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sis_verbose)
|
|
|
|
printf("\n");
|
|
|
|
|
2015-03-28 14:46:48 +08:00
|
|
|
return bfd_get_start_address (pbfd);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
2015-02-20 06:31:24 +08:00
|
|
|
|
|
|
|
double get_time (void)
|
|
|
|
{
|
|
|
|
double usec;
|
|
|
|
|
|
|
|
struct timeval tm;
|
|
|
|
|
|
|
|
gettimeofday (&tm, NULL);
|
|
|
|
usec = ((double) tm.tv_sec) * 1E6 + ((double) tm.tv_usec);
|
2015-03-28 14:46:48 +08:00
|
|
|
return usec / 1E6;
|
2015-02-20 06:31:24 +08:00
|
|
|
}
|