#include "qapi/error.h"
#include "qemu.h"
#include "qemu/path.h"
+#include "qemu/config-file.h"
#include "qemu/cutils.h"
#include "qemu/help_option.h"
#include "cpu.h"
#include "qemu/envlist.h"
#include "elf.h"
#include "exec/log.h"
+#include "trace/control.h"
+#include "glib-compat.h"
char *exec_path;
}
/* Start an exclusive operation.
- Must only be called from outside cpu_arm_exec. */
+ Must only be called from outside cpu_exec. */
static inline void start_exclusive(void)
{
CPUState *other_cpu;
for(;;) {
cpu_exec_start(cs);
- trapnr = cpu_x86_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch(trapnr) {
case 0x80:
for(;;) {
cpu_exec_start(cs);
- trapnr = cpu_arm_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch(trapnr) {
case EXCP_UDEF:
for (;;) {
cpu_exec_start(cs);
- trapnr = cpu_arm_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch (trapnr) {
for (;;) {
cpu_exec_start(cs);
- trapnr = uc32_cpu_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch (trapnr) {
case UC32_EXCP_PRIV:
while (1) {
cpu_exec_start(cs);
- trapnr = cpu_sparc_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
/* Compute PSR before exposing state. */
for(;;) {
cpu_exec_start(cs);
- trapnr = cpu_ppc_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch(trapnr) {
case POWERPC_EXCP_NONE:
for(;;) {
cpu_exec_start(cs);
- trapnr = cpu_mips_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch(trapnr) {
case EXCP_SYSCALL:
for (;;) {
cpu_exec_start(cs);
- trapnr = cpu_openrisc_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
gdbsig = 0;
while (1) {
cpu_exec_start(cs);
- trapnr = cpu_sh4_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch (trapnr) {
while (1) {
cpu_exec_start(cs);
- trapnr = cpu_cris_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch (trapnr) {
case 0xaa:
while (1) {
cpu_exec_start(cs);
- trapnr = cpu_mb_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch (trapnr) {
case 0xaa:
for(;;) {
cpu_exec_start(cs);
- trapnr = cpu_m68k_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch(trapnr) {
case EXCP_ILLEGAL:
while (1) {
cpu_exec_start(cs);
- trapnr = cpu_alpha_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
/* All of the traps imply a transition through PALcode, which
while (1) {
cpu_exec_start(cs);
- trapnr = cpu_s390x_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch (trapnr) {
case EXCP_INTERRUPT:
while (1) {
cpu_exec_start(cs);
- trapnr = cpu_tilegx_exec(cs);
+ trapnr = cpu_exec(cs);
cpu_exec_end(cs);
switch (trapnr) {
case TILEGX_EXCP_SYSCALL:
static void handle_arg_version(const char *arg)
{
printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION
- ", Copyright (c) 2003-2008 Fabrice Bellard\n");
+ ", " QEMU_COPYRIGHT "\n");
exit(EXIT_SUCCESS);
}
+static char *trace_file;
+static void handle_arg_trace(const char *arg)
+{
+ g_free(trace_file);
+ trace_file = trace_opt_parse(arg);
+}
+
struct qemu_argument {
const char *argv;
const char *env;
"", "log system calls"},
{"seed", "QEMU_RAND_SEED", true, handle_arg_randseed,
"", "Seed for pseudo-random number generator"},
+ {"trace", "QEMU_TRACE", true, handle_arg_trace,
+ "", "[[enable=]<pattern>][,events=<file>][,file=<file>]"},
{"version", "QEMU_VERSION", false, handle_arg_version,
"", "display version information and exit"},
{NULL, NULL, false, NULL, NULL, NULL}
srand(time(NULL));
+ qemu_add_opts(&qemu_trace_opts);
+
optind = parse_args(argc, argv);
+ if (!trace_init_backends()) {
+ exit(1);
+ }
+ trace_init_file(trace_file);
+
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));
if (regs->cp0_epc & 1) {
env->hflags |= MIPS_HFLAG_M16;
}
+ if (((info->elf_flags & EF_MIPS_NAN2008) != 0) !=
+ ((env->active_fpu.fcr31 & (1 << FCR31_NAN2008)) != 0)) {
+ if ((env->active_fpu.fcr31_rw_bitmask &
+ (1 << FCR31_NAN2008)) == 0) {
+ fprintf(stderr, "ELF binary's NaN mode not supported by CPU\n");
+ exit(1);
+ }
+ if ((info->elf_flags & EF_MIPS_NAN2008) != 0) {
+ env->active_fpu.fcr31 |= (1 << FCR31_NAN2008);
+ } else {
+ env->active_fpu.fcr31 &= ~(1 << FCR31_NAN2008);
+ }
+ restore_snan_bit_mode(env);
+ }
}
#elif defined(TARGET_OPENRISC)
{
}
gdb_handlesig(cpu, 0);
}
+ trace_init_vcpu_events();
cpu_loop(env);
/* never exits */
return 0;