From 8a49b77cb948f365a377a56217120439088b0d1a Mon Sep 17 00:00:00 2001 From: fgsch Date: Thu, 17 Jun 2010 09:57:55 +0000 Subject: [PATCH] Add debug flavor. --- emulators/qemu/Makefile | 8 +++- emulators/qemu/patches/patch-configure | 16 +++---- .../patches/patch-target-sparc_translate_c | 42 +++++++++++++++++++ 3 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 emulators/qemu/patches/patch-target-sparc_translate_c diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile index a70ca6870db..54498fb1f4f 100644 --- a/emulators/qemu/Makefile +++ b/emulators/qemu/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.49 2010/06/08 01:08:20 fgsch Exp $ +# $OpenBSD: Makefile,v 1.50 2010/06/17 09:57:55 fgsch Exp $ # no success building on other archs yet ONLY_FOR_ARCHS = amd64 i386 sparc64 @@ -6,6 +6,7 @@ ONLY_FOR_ARCHS = amd64 i386 sparc64 COMMENT = multi system emulator DISTNAME = qemu-0.12.4 +PKGNAME = ${DISTNAME}p0 CATEGORIES = emulators HOMEPAGE = http://www.qemu.org/ @@ -33,7 +34,7 @@ CONFIGURE_ARGS = --prefix=${PREFIX} \ --disable-guest-base \ --extra-cflags=-fno-stack-protector -FLAVORS = no_x11 +FLAVORS = debug no_x11 FLAVOR ?= .if ${FLAVOR:L:Mno_x11} @@ -44,6 +45,9 @@ LIB_DEPENDS = SDL::devel/sdl USE_X11 = Yes WANTLIB += X11 .endif +.if ${FLAVOR:L:Mdebug} +CONFIGURE_ARGS += --enable-debug +.endif # Currently, the regression tests are utterly broken. REGRESS_TARGET = test diff --git a/emulators/qemu/patches/patch-configure b/emulators/qemu/patches/patch-configure index f34a3a18101..586103bb9b9 100644 --- a/emulators/qemu/patches/patch-configure +++ b/emulators/qemu/patches/patch-configure @@ -1,6 +1,6 @@ -$OpenBSD: patch-configure,v 1.13 2010/05/27 17:55:05 fgsch Exp $ ---- configure.orig Tue Feb 23 20:54:38 2010 -+++ configure Tue Mar 9 08:12:32 2010 +$OpenBSD: patch-configure,v 1.14 2010/06/17 09:57:55 fgsch Exp $ +--- configure.orig Tue May 4 16:27:48 2010 ++++ configure Wed Jun 16 21:24:04 2010 @@ -34,12 +34,12 @@ interp_prefix="/usr/gnemul/qemu-%M" static="no" sparc_cpu="" @@ -25,16 +25,18 @@ $OpenBSD: patch-configure,v 1.13 2010/05/27 17:55:05 fgsch Exp $ QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" -@@ -1788,7 +1788,7 @@ fi +@@ -1788,7 +1788,9 @@ fi # After here, no more $cc or $ld runs if test "$debug" = "no" ; then - CFLAGS="-O2 $CFLAGS" + CFLAGS="$CFLAGS" ++else ++ CFLAGS="-g $CFLAGS" fi # Consult white-list to determine whether to enable werror -@@ -1836,7 +1836,7 @@ else +@@ -1836,7 +1838,7 @@ else if test -z "$prefix" ; then prefix="/usr/local" fi @@ -43,7 +45,7 @@ $OpenBSD: patch-configure,v 1.13 2010/05/27 17:55:05 fgsch Exp $ datasuffix="/share/qemu" docsuffix="/share/doc/qemu" binsuffix="/bin" -@@ -2167,7 +2167,7 @@ echo "datadir=\${prefix}$datasuffix" >> $config_host_m +@@ -2167,7 +2169,7 @@ echo "datadir=\${prefix}$datasuffix" >> $config_host_m echo "docdir=\${prefix}$docsuffix" >> $config_host_mak echo "MAKE=$make" >> $config_host_mak echo "INSTALL=$install" >> $config_host_mak @@ -52,7 +54,7 @@ $OpenBSD: patch-configure,v 1.13 2010/05/27 17:55:05 fgsch Exp $ echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak echo "CC=$cc" >> $config_host_mak -@@ -2575,7 +2575,11 @@ if test "$gprof" = "yes" ; then +@@ -2575,7 +2577,11 @@ if test "$gprof" = "yes" ; then fi fi diff --git a/emulators/qemu/patches/patch-target-sparc_translate_c b/emulators/qemu/patches/patch-target-sparc_translate_c new file mode 100644 index 00000000000..8e5c0e65064 --- /dev/null +++ b/emulators/qemu/patches/patch-target-sparc_translate_c @@ -0,0 +1,42 @@ +$OpenBSD: patch-target-sparc_translate_c,v 1.1 2010/06/17 09:57:55 fgsch Exp $ +--- target-sparc/translate.c.orig Tue May 4 16:27:48 2010 ++++ target-sparc/translate.c Wed Jun 16 23:36:33 2010 +@@ -1663,27 +1663,27 @@ static inline TCGv get_src2(unsigned int insn, TCGv de + #ifdef TARGET_SPARC64 + static inline void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr, TCGv_ptr cpu_env) + { +- TCGv r_tl = tcg_temp_new(); ++ TCGv_i32 r_tl = tcg_temp_new_i32(); + + /* load env->tl into r_tl */ +- { +- TCGv_i32 r_tl_tmp = tcg_temp_new_i32(); +- tcg_gen_ld_i32(r_tl_tmp, cpu_env, offsetof(CPUSPARCState, tl)); +- tcg_gen_ext_i32_tl(r_tl, r_tl_tmp); +- tcg_temp_free_i32(r_tl_tmp); +- } ++ tcg_gen_ld_i32(r_tl, cpu_env, offsetof(CPUSPARCState, tl)); + + /* tl = [0 ... MAXTL_MASK] where MAXTL_MASK must be power of 2 */ +- tcg_gen_andi_tl(r_tl, r_tl, MAXTL_MASK); ++ tcg_gen_andi_i32(r_tl, r_tl, MAXTL_MASK); + + /* calculate offset to current trap state from env->ts, reuse r_tl */ +- tcg_gen_muli_tl(r_tl, r_tl, sizeof (trap_state)); ++ tcg_gen_muli_i32(r_tl, r_tl, sizeof (trap_state)); + tcg_gen_addi_ptr(r_tsptr, cpu_env, offsetof(CPUState, ts)); + + /* tsptr = env->ts[env->tl & MAXTL_MASK] */ +- tcg_gen_add_ptr(r_tsptr, r_tsptr, r_tl); ++ { ++ TCGv_ptr r_tl_tmp = tcg_temp_new_ptr(); ++ tcg_gen_ext_i32_ptr(r_tl_tmp, r_tl); ++ tcg_gen_add_ptr(r_tsptr, r_tsptr, r_tl_tmp); ++ tcg_temp_free_ptr(r_tl_tmp); ++ } + +- tcg_temp_free(r_tl); ++ tcg_temp_free_i32(r_tl); + } + #endif +