From e5c66c7c4185f55e8a514fade9e09626d1b1cf92 Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Tue, 8 May 2012 14:49:33 +0900 Subject: [PATCH] [Title] Merge release-1.0 into develop branch to support hax feature. [Type] [Module] emulator [Priority] Major [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- audio/audio.c | 34 ++++++++++++++++++++++++++++++++++ package/build.windows | 11 ++++++++--- tizen/Makefile | 2 ++ tizen/src/Makefile | 20 ++++++++++++++++++-- tizen/src/Makefile.tizen | 4 ---- tizen/src/check_hax.c | 8 +++++++- tizen/src/sdb.c | 32 +++++++++++--------------------- vl.c | 1 + 8 files changed, 81 insertions(+), 31 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 50d0d7183f..cf1a30e074 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -39,6 +39,11 @@ #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" +#ifdef CONFIG_MARU +#include "../tizen/src/debug_ch.h" +MULTI_DEBUG_CHANNEL(tizen, qemu_audio); +#endif + /* Order of CONFIG_AUDIO_DRIVERS is import. The 1st one is the one used by default, that is the reason that we generate the list. @@ -339,11 +344,15 @@ void AUD_vlog (const char *cap, const char *fmt, va_list ap) monitor_vprintf(default_mon, fmt, ap); } else { +#ifdef CONFIG_MARU + TRACE(fmt, ap); +#else if (cap) { fprintf (stderr, "%s: ", cap); } vfprintf (stderr, fmt, ap); +#endif } } @@ -1872,6 +1881,31 @@ static void audio_init (void) } } +#ifdef CONFIG_MARU +// Try to avoid certain wave out locking action in recent Windows... +// If wave out is locked (because nothing is wired to output jack, ...), +// QEMU can find voice out device, but open will failed. And it will cause guest audio lock-up. +// So, we test whether opening is success or not. +// It can not prevent lock-up caused by runtime voice out lock. +// To prevent it, QEMU audio backend structure must be changed. +// We should do it, but now we used simple fix temporarily. + HWVoiceOut* hw = audio_calloc(AUDIO_FUNC, 1, s->drv->voice_size_out); + if (!hw) { + dolog ("Can not allocate voice `%s' size %d\n", + s->drv->name, s->drv->voice_size_out); + } + if(s->drv->pcm_ops->init_out(hw, &conf.fixed_out.settings)) { + INFO("Host audio out [%s] is malfunction. Change to noaudio driver\n", + s->drv->name); + done = 0; + } + else { + INFO("Host audio out [%s] is normal.\n", s->drv->name); + s->drv->pcm_ops->fini_out(hw); + } + g_free(hw); +#endif + if (!done) { done = !audio_driver_init (s, &no_audio_driver); if (!done) { diff --git a/package/build.windows b/package/build.windows index fd96b98e9c..7e4174a804 100755 --- a/package/build.windows +++ b/package/build.windows @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh -xe # clean clean() @@ -48,6 +48,13 @@ build() cd $SRCDIR/tizen/ ./qemu_configure.sh "$BUILD_CFLAGS $BUILD_LDFLAGS" make + if [ -f "../i386-softmmu/qemu-system-i386.exe" ] + then + echo "BUILD SUCCESS" + else + echo "BUILD FAIL!!!" + exit 1; + fi } # install @@ -57,14 +64,12 @@ install() prepare BIN_DIR=$SRCDIR/package/emulator.package.windows/data - EMUL_DIR=$BIN_DIR/Emulator/bin/emulator-x86.exe mkdir -p $BIN_DIR cd $SRCDIR/tizen make install mv Emulator $BIN_DIR - editbin.exe /SUBSYSTEM:WINDOWS $EMUL_DIR } [ "$1" = "clean" ] && clean diff --git a/tizen/Makefile b/tizen/Makefile index e0a4844e19..05d761f025 100644 --- a/tizen/Makefile +++ b/tizen/Makefile @@ -1,5 +1,7 @@ all: cd src && $(MAKE) +check_hax: + cd src && $(MAKE) check_hax qemu: cd src && $(MAKE) qemu skin_client: diff --git a/tizen/src/Makefile b/tizen/src/Makefile index 660cffe9a5..45e7515e9f 100755 --- a/tizen/src/Makefile +++ b/tizen/src/Makefile @@ -8,9 +8,15 @@ config-host.mak: @exit 1 endif -all: build_info qemu skin_client +all: build_info qemu skin_client check_hax qemu: cd ../../ && $(MAKE) +check_hax: +ifdef CONFIG_WIN32 + $(CC) -o check-hax.exe check_hax.c +else + +endif skin_client: ifdef CONFIG_WIN32 ant -buildfile skin/client/build.xml windows-jar @@ -30,6 +36,11 @@ build_info: @echo "const char pkginfo_version[] = \"`sed -n '2p' ./../../package/pkginfo.manifest`\";" >> build_info.h clean: +ifdef CONFIG_WIN32 + rm -f check-hax.exe +else + +endif cd ../../ && $(MAKE) clean distclean: cd ../../ && $(MAKE) distclean @@ -37,14 +48,19 @@ install: all mkdir -p $(EMUL_DIR)/bin mkdir -p $(EMUL_DIR)/etc mkdir -p $(EMUL_DIR)/x86 + mkdir -p $(EMUL_DIR)/x86/data mkdir -p $(EMUL_DIR)/arm mkdir -p $(EMUL_DIR)/x86/data/pc-bios cp ../../i386-softmmu/qemu-system-i386 $(EMUL_DIR)/bin/emulator-x86 cp skin/client/emulator-skin.jar $(EMUL_DIR)/bin +ifdef CONFIG_WIN32 + cp check-hax.exe $(EMUL_DIR)/bin +else + +endif cp ../../qemu-img $(EMUL_DIR)/bin cp -dpr skin/client/skins $(EMUL_DIR) cp -dpr ../license $(EMUL_DIR) - cp -dpr ../data $(EMUL_DIR)/x86 cp -dpr ../../pc-bios/bios.bin $(EMUL_DIR)/x86/data/pc-bios cp -dpr ../../pc-bios/linuxboot.bin $(EMUL_DIR)/x86/data/pc-bios cp -dpr ../../pc-bios/pxe-rtl8139.rom $(EMUL_DIR)/x86/data/pc-bios diff --git a/tizen/src/Makefile.tizen b/tizen/src/Makefile.tizen index c5afd02a55..bd9f2b6203 100755 --- a/tizen/src/Makefile.tizen +++ b/tizen/src/Makefile.tizen @@ -85,10 +85,6 @@ ifdef CONFIG_LINUX # libs for maru camera on linux host LIBS += -lv4l2 -lv4lconvert endif -ifdef CONFIG_WIN32 -obj-i386-y += check_hax.o -endif - ifdef CONFIG_WIN32 # libs for maru camera on windows host LIBS += -lole32 -loleaut32 -luuid -lstrmiids endif diff --git a/tizen/src/check_hax.c b/tizen/src/check_hax.c index c454f08024..2ca1de30ce 100644 --- a/tizen/src/check_hax.c +++ b/tizen/src/check_hax.c @@ -83,7 +83,7 @@ static int hax_open_device( hax_fd *fd ); static int hax_get_capability( struct hax_state *hax ); static int hax_capability( struct hax_state *hax, struct hax_capabilityinfo *cap ); -int check_hax( void ) { +static int check_hax( void ) { struct hax_state hax; memset( &hax, 0, sizeof( struct hax_state ) ); @@ -156,12 +156,14 @@ static int hax_get_capability( struct hax_state *hax ) { return -ENXIO; } +/* if ( cap->wstatus & HAX_CAP_MEMQUOTA ) { if ( cap->mem_quota < hax->mem_quota ) { fprintf( stderr, "The memory needed by this VM exceeds the driver limit.\n" ); return -ENOSPC; } } +*/ return 0; } @@ -188,3 +190,7 @@ static int hax_capability( struct hax_state *hax, struct hax_capabilityinfo *cap return 0; } + +int main(int argc, char* argv[]) { + return check_hax(); +} diff --git a/tizen/src/sdb.c b/tizen/src/sdb.c index 56d2e74efa..4291fdd6a7 100644 --- a/tizen/src/sdb.c +++ b/tizen/src/sdb.c @@ -225,10 +225,12 @@ static int check_port_bind_listen(u_int port) addr.sin_addr.s_addr = INADDR_ANY; addr.sin_port = htons(port); - if (((s = qemu_socket(AF_INET,SOCK_STREAM,0)) < 0) || - (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) || - (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) || - (listen(s,1) < 0)) { + if (((s = qemu_socket(AF_INET, SOCK_STREAM, 0)) < 0) || +#ifndef _WIN32 + (setsockopt(s, SOL_SOCKET,SO_REUSEADDR, (char *)&opt, sizeof(int)) < 0) || +#endif + (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) || + (listen(s, 1) < 0)) { /* fail */ ret = -1; @@ -257,7 +259,7 @@ int get_sdb_base_port(void) if(tizen_base_port == 0){ for ( ; tries > 0; tries--, port += 10 ) { - if(check_port_bind_listen(port+1) < 0 ) + if(check_port_bind_listen(port + 1) < 0 ) continue; success = 1; @@ -279,24 +281,19 @@ int get_sdb_base_port(void) void sdb_setup(void) { int tries = 10; - const char *base_port = "26100"; int success = 0; - int port; uint32_t guest_ip; - const char *p; char buf[64] = {0,}; inet_strtoip("10.0.2.16", &guest_ip); - port = strtol(base_port, (char **)&p, 0); - - for ( ; tries > 0; tries--, port += 10 ) { + for ( ; tries > 0; tries--, tizen_base_port += 10 ) { // redir form [tcp:26101:10.0.2.16:26101] - sprintf(buf, "tcp:%d:10.0.2.16:26101", port+1); + sprintf(buf, "tcp:%d:10.0.2.16:26101", tizen_base_port + 1); if(net_slirp_redir((char*)buf) < 0) continue; - INFO( "SDBD established on port %d\n", port+1); + INFO( "SDBD established on port %d\n", tizen_base_port + 1); success = 1; break; } @@ -307,17 +304,10 @@ void sdb_setup(void) exit(1); } - if( tizen_base_port != port ){ - ERR( "sdb port is miss match. Aborting port :%d, tizen_base_port: %d\n", port, tizen_base_port); - exit(1); - } - - /* Save base port. */ - tizen_base_port = port; INFO( "Port(%d/tcp) listen for SDB \n", tizen_base_port + 1); /* for sensort */ - sprintf(buf, "tcp:%d:10.0.2.16:3577", get_sdb_base_port() + SDB_TCP_EMULD_INDEX ); + sprintf(buf, "tcp:%d:10.0.2.16:3577", tizen_base_port + SDB_TCP_EMULD_INDEX ); if(net_slirp_redir((char*)buf) < 0){ ERR( "redirect [%s] fail \n", buf); }else{ diff --git a/vl.c b/vl.c index 303643fc50..bc3a1fdff3 100644 --- a/vl.c +++ b/vl.c @@ -3184,6 +3184,7 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_enable_hax: olist = qemu_find_opts("machine"); qemu_opts_reset(olist); + hax_disabled = 0; //qemu_opts_parse(olist, "accel=hax", 0); break; #ifdef CONFIG_MARU -- 2.34.1