diff options
author | Junfeng Dong <junfeng.dong@intel.com> | 2013-11-19 17:45:23 +0800 |
---|---|---|
committer | Junfeng Dong <junfeng.dong@intel.com> | 2013-11-19 17:45:23 +0800 |
commit | 340f06c9eaee097e626c251bf7a013350649c091 (patch) | |
tree | 107e5705050a12da68fc80a56ae37afd50a2cc94 /bsd-user | |
parent | 42bf3037d458a330856a0be584200c1e41c3f417 (diff) | |
download | qemu-340f06c9eaee097e626c251bf7a013350649c091.tar.gz qemu-340f06c9eaee097e626c251bf7a013350649c091.tar.bz2 qemu-340f06c9eaee097e626c251bf7a013350649c091.zip |
Import upstream 1.6.0.upstream/1.6.0
Change-Id: Icf52b556470cac8677297f2ef14ded16684f7887
Signed-off-by: Junfeng Dong <junfeng.dong@intel.com>
Diffstat (limited to 'bsd-user')
-rw-r--r-- | bsd-user/elfload.c | 8 | ||||
-rw-r--r-- | bsd-user/main.c | 63 | ||||
-rw-r--r-- | bsd-user/mmap.c | 4 | ||||
-rw-r--r-- | bsd-user/qemu-types.h | 24 | ||||
-rw-r--r-- | bsd-user/qemu.h | 8 | ||||
-rw-r--r-- | bsd-user/syscall.c | 5 |
6 files changed, 46 insertions, 66 deletions
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 55b213609..93fd9e425 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -10,7 +10,7 @@ #include <string.h> #include "qemu.h" -#include "disas.h" +#include "disas/disas.h" #ifdef _ARCH_PPC64 #undef ARCH_DLINFO @@ -98,7 +98,7 @@ enum { static const char *get_elf_platform(void) { static char elf_platform[] = "i386"; - int family = (thread_env->cpuid_version >> 8) & 0xff; + int family = object_property_get_int(OBJECT(thread_cpu), "family", NULL); if (family > 6) family = 6; if (family >= 3) @@ -110,7 +110,9 @@ static const char *get_elf_platform(void) static uint32_t get_elf_hwcap(void) { - return thread_env->cpuid_features; + X86CPU *cpu = X86_CPU(thread_cpu); + + return cpu->env.features[FEAT_1_EDX]; } #ifdef TARGET_X86_64 diff --git a/bsd-user/main.c b/bsd-user/main.c index 095ae8eaa..f9246aa10 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -31,10 +31,8 @@ /* For tb_lock */ #include "cpu.h" #include "tcg.h" -#include "qemu-timer.h" -#include "envlist.h" - -#define DEBUG_LOGFILE "/tmp/qemu.log" +#include "qemu/timer.h" +#include "qemu/envlist.h" int singlestep; #if defined(CONFIG_USE_GUEST_BASE) @@ -94,7 +92,7 @@ void fork_start(void) void fork_end(int child) { if (child) { - gdbserver_fork(thread_env); + gdbserver_fork((CPUArchState *)thread_cpu->env_ptr); } } @@ -513,6 +511,7 @@ static void flush_windows(CPUSPARCState *env) void cpu_loop(CPUSPARCState *env) { + CPUState *cs = CPU(sparc_env_get_cpu(env)); int trapnr, ret, syscall_nr; //target_siginfo_t info; @@ -644,7 +643,7 @@ void cpu_loop(CPUSPARCState *env) { int sig; - sig = gdb_handlesig (env, TARGET_SIGTRAP); + sig = gdb_handlesig(cs, TARGET_SIGTRAP); #if 0 if (sig) { @@ -661,7 +660,7 @@ void cpu_loop(CPUSPARCState *env) badtrap: #endif printf ("Unhandled trap: 0x%x\n", trapnr); - cpu_dump_state(env, stderr, fprintf, 0); + cpu_dump_state(cs, stderr, fprintf, 0); exit (1); } process_pending_signals (env); @@ -672,8 +671,8 @@ void cpu_loop(CPUSPARCState *env) static void usage(void) { - printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n" - "usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n" + printf("qemu-" TARGET_NAME " version " QEMU_VERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n" + "usage: qemu-" TARGET_NAME " [options] program [arguments...]\n" "BSD CPU emulator (compiled for %s emulation)\n" "\n" "Standard options:\n" @@ -691,11 +690,12 @@ static void usage(void) "-bsd type select emulated BSD type FreeBSD/NetBSD/OpenBSD (default)\n" "\n" "Debug options:\n" - "-d options activate log (default logfile=%s)\n" - "-D logfile override default logfile location\n" - "-p pagesize set the host page size to 'pagesize'\n" - "-singlestep always run in singlestep mode\n" - "-strace log system calls\n" + "-d item1[,...] enable logging of specified items\n" + " (use '-d help' for a list of log items)\n" + "-D logfile write logs to 'logfile' (default stderr)\n" + "-p pagesize set the host page size to 'pagesize'\n" + "-singlestep always run in singlestep mode\n" + "-strace log system calls\n" "\n" "Environment variables:\n" "QEMU_STRACE Print system calls and arguments similar to the\n" @@ -707,14 +707,13 @@ static void usage(void) "Note that if you provide several changes to single variable\n" "last change will stay in effect.\n" , - TARGET_ARCH, + TARGET_NAME, interp_prefix, - x86_stack_size, - DEBUG_LOGFILE); + x86_stack_size); exit(1); } -THREAD CPUArchState *thread_env; +THREAD CPUState *thread_cpu; /* Assumes contents are already zeroed. */ void init_task_state(TaskState *ts) @@ -733,12 +732,13 @@ int main(int argc, char **argv) { const char *filename; const char *cpu_model; - const char *log_file = DEBUG_LOGFILE; + const char *log_file = NULL; const char *log_mask = NULL; struct target_pt_regs regs1, *regs = ®s1; struct image_info info1, *info = &info1; TaskState ts1, *ts = &ts1; CPUArchState *env; + CPUState *cpu; int optind; const char *r; int gdbstub_port = 0; @@ -861,20 +861,16 @@ int main(int argc, char **argv) } /* init debug */ - cpu_set_log_filename(log_file); + qemu_set_log_filename(log_file); if (log_mask) { int mask; - const CPULogItem *item; - mask = cpu_str_to_log_mask(log_mask); + mask = qemu_str_to_log_mask(log_mask); if (!mask) { - printf("Log items (comma separated):\n"); - for (item = cpu_log_items; item->mask != 0; item++) { - printf("%-10s %s\n", item->name, item->help); - } + qemu_print_log_usage(stdout); exit(1); } - cpu_set_log(mask); + qemu_set_log(mask); } if (optind >= argc) { @@ -917,10 +913,11 @@ int main(int argc, char **argv) fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } -#if defined(TARGET_I386) || defined(TARGET_SPARC) || defined(TARGET_PPC) - cpu_reset(ENV_GET_CPU(env)); + cpu = ENV_GET_CPU(env); +#if defined(TARGET_SPARC) || defined(TARGET_PPC) + cpu_reset(cpu); #endif - thread_env = env; + thread_cpu = cpu; if (getenv("QEMU_STRACE")) { do_strace = 1; @@ -1010,13 +1007,13 @@ int main(int argc, char **argv) env->cr[0] = CR0_PG_MASK | CR0_WP_MASK | CR0_PE_MASK; env->hflags |= HF_PE_MASK; - if (env->cpuid_features & CPUID_SSE) { + if (env->features[FEAT_1_EDX] & CPUID_SSE) { env->cr[4] |= CR4_OSFXSR_MASK; env->hflags |= HF_OSFXSR_MASK; } #ifndef TARGET_ABI32 /* enable 64 bit mode if possible */ - if (!(env->cpuid_ext2_features & CPUID_EXT2_LM)) { + if (!(env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM)) { fprintf(stderr, "The selected x86 CPU does not support 64 bit mode\n"); exit(1); } @@ -1139,7 +1136,7 @@ int main(int argc, char **argv) if (gdbstub_port) { gdbserver_start (gdbstub_port); - gdb_handlesig(env, 0); + gdb_handlesig(cpu, 0); } cpu_loop(env); /* never exits */ diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 5d6cffc45..aae8ea10b 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -74,7 +74,7 @@ void mmap_unlock(void) } #endif -void *qemu_vmalloc(size_t size) +static void *bsd_vmalloc(size_t size) { void *p; mmap_lock(); @@ -98,7 +98,7 @@ void *g_malloc(size_t size) { char * p; size += 16; - p = qemu_vmalloc(size); + p = bsd_vmalloc(size); *(size_t *)p = size; return p + 16; } diff --git a/bsd-user/qemu-types.h b/bsd-user/qemu-types.h deleted file mode 100644 index 1adda9fbd..000000000 --- a/bsd-user/qemu-types.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef QEMU_TYPES_H -#define QEMU_TYPES_H -#include "cpu.h" - -#ifdef TARGET_ABI32 -typedef uint32_t abi_ulong; -typedef int32_t abi_long; -#define TARGET_ABI_FMT_lx "%08x" -#define TARGET_ABI_FMT_ld "%d" -#define TARGET_ABI_FMT_lu "%u" -#define TARGET_ABI_BITS 32 -#else -typedef target_ulong abi_ulong; -typedef target_long abi_long; -#define TARGET_ABI_FMT_lx TARGET_FMT_lx -#define TARGET_ABI_FMT_ld TARGET_FMT_ld -#define TARGET_ABI_FMT_lu TARGET_FMT_lu -#define TARGET_ABI_BITS TARGET_LONG_BITS -/* for consistency, define ABI32 too */ -#if TARGET_ABI_BITS == 32 -#define TARGET_ABI32 1 -#endif -#endif -#endif diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 8a5ee3d81..325f564f8 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -11,7 +11,7 @@ #include <stdlib.h> #endif /* DEBUG_REMAP */ -#include "qemu-types.h" +#include "exec/user/abitypes.h" enum BSDType { target_freebsd, @@ -23,7 +23,7 @@ extern enum BSDType bsd_type; #include "syscall_defs.h" #include "syscall.h" #include "target_signal.h" -#include "gdbstub.h" +#include "exec/gdbstub.h" #if defined(CONFIG_USE_NPTL) #define THREAD __thread @@ -139,14 +139,14 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6); void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2); -extern THREAD CPUArchState *thread_env; +extern THREAD CPUState *thread_cpu; void cpu_loop(CPUArchState *env); char *target_strerror(int err); int get_osversion(void); void fork_start(void); void fork_end(int child); -#include "qemu-log.h" +#include "qemu/log.h" /* strace.c */ void diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 18b43f1a2..a4d1583fe 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -211,7 +211,12 @@ static int sysctl_oldcvt(void *holdp, size_t holdlen, uint32_t kind) *(uint64_t *)holdp = tswap64(*(unsigned long *)holdp); break; #endif +#ifdef CTLTYPE_U64 + case CTLTYPE_S64: + case CTLTYPE_U64: +#else case CTLTYPE_QUAD: +#endif *(uint64_t *)holdp = tswap64(*(uint64_t *)holdp); break; case CTLTYPE_STRING: |