Commit 8a47d575 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/weil/tags/pull-wxx-20150924' into staging



wxx patch queue

# gpg: Signature made Thu 24 Sep 2015 20:24:50 BST using RSA key ID 677450AD
# gpg: Good signature from "Stefan Weil <sw@weilnetz.de>"
# gpg:                 aka "Stefan Weil <stefan.weil@weilnetz.de>"
# gpg:                 aka "Stefan Weil <stefan.weil@bib.uni-mannheim.de>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4923 6FEA 75C9 5D69 8EC2  B78A E08C 21D5 6774 50AD

* remotes/weil/tags/pull-wxx-20150924:
  oslib-win32: only provide localtime_r/gmtime_r if missing
  gtk: avoid redefining _WIN32_WINNT macro
  qemu-thread: add a fast path to the Win32 QemuEvent
  slirp: Fix non blocking connect for w32
  nsis: Add QEMU version information to Windows registry

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 9438fe9e 4d9310f4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -623,6 +623,7 @@ endif # SIGNCODE
                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
                -DSRCDIR="$(SRC_PATH)" \
                -DOUTFILE="$(INSTALLER)" \
                -DDISPLAYVERSION="$(VERSION)" \
                $(SRC_PATH)/qemu.nsi
	rm -r ${INSTDIR}
ifdef SIGNCODE
+34 −0
Original line number Diff line number Diff line
@@ -1736,6 +1736,37 @@ else
  l2tpv3=no
fi

##########################################
# MinGW / Mingw-w64 localtime_r/gmtime_r check

if test "$mingw32" = "yes"; then
    # Some versions of MinGW / Mingw-w64 lack localtime_r
    # and gmtime_r entirely.
    #
    # Some versions of Mingw-w64 define a macro for
    # localtime_r/gmtime_r.
    #
    # Some versions of Mingw-w64 will define functions
    # for localtime_r/gmtime_r, but only if you have
    # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
    # though, unistd.h and pthread.h both define
    # that for you.
    #
    # So this #undef localtime_r and #include <unistd.h>
    # are not in fact redundant.
cat > $TMPC << EOF
#include <unistd.h>
#include <time.h>
#undef localtime_r
int main(void) { localtime_r(NULL, NULL); return 0; }
EOF
    if compile_prog "" "" ; then
        localtime_r="yes"
    else
        localtime_r="no"
    fi
fi

##########################################
# pkg-config probe

@@ -5034,6 +5065,9 @@ fi
if test "$zero_malloc" = "yes" ; then
  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
fi
if test "$localtime_r" = "yes" ; then
  echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
fi
if test "$qom_cast_debug" = "yes" ; then
  echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
fi
+98 −0
Original line number Diff line number Diff line
/*
 * This model describes the implementation of QemuEvent in
 * util/qemu-thread-win32.c.
 *
 * Author: Paolo Bonzini <pbonzini@redhat.com>
 *
 * This file is in the public domain.  If you really want a license,
 * the WTFPL will do.
 *
 * To verify it:
 *     spin -a docs/event.promela
 *     gcc -O2 pan.c -DSAFETY
 *     ./a.out
 */

bool event;
int value;

/* Primitives for a Win32 event */
#define RAW_RESET event = false
#define RAW_SET   event = true
#define RAW_WAIT  do :: event -> break; od

#if 0
/* Basic sanity checking: test the Win32 event primitives */
#define RESET     RAW_RESET
#define SET       RAW_SET
#define WAIT      RAW_WAIT
#else
/* Full model: layer a userspace-only fast path on top of the RAW_*
 * primitives.  SET/RESET/WAIT have exactly the same semantics as
 * RAW_SET/RAW_RESET/RAW_WAIT, but try to avoid invoking them.
 */
#define EV_SET 0
#define EV_FREE 1
#define EV_BUSY -1

int state = EV_FREE;

int xchg_result;
#define SET   if :: state != EV_SET ->                                      \
                    atomic { /* xchg_result=xchg(state, EV_SET) */          \
                        xchg_result = state;                                \
                        state = EV_SET;                                     \
                    }                                                       \
                    if :: xchg_result == EV_BUSY -> RAW_SET;                \
                       :: else -> skip;                                     \
                    fi;                                                     \
                 :: else -> skip;                                           \
              fi

#define RESET if :: state == EV_SET -> atomic { state = state | EV_FREE; }  \
                 :: else            -> skip;                                \
              fi

int tmp1, tmp2;
#define WAIT  tmp1 = state;                                                 \
              if :: tmp1 != EV_SET ->                                       \
                    if :: tmp1 == EV_FREE ->                                \
                          RAW_RESET;                                        \
                          atomic { /* tmp2=cas(state, EV_FREE, EV_BUSY) */  \
                              tmp2 = state;                                 \
                              if :: tmp2 == EV_FREE -> state = EV_BUSY;     \
                                 :: else            -> skip;                \
                              fi;                                           \
                          }                                                 \
                          if :: tmp2 == EV_SET -> tmp1 = EV_SET;            \
                             :: else           -> tmp1 = EV_BUSY;           \
                          fi;                                               \
                       :: else -> skip;                                     \
                    fi;                                                     \
                    assert(tmp1 != EV_FREE);                                \
                    if :: tmp1 == EV_BUSY -> RAW_WAIT;                      \
                       :: else -> skip;                                     \
                    fi;                                                     \
                 :: else -> skip;                                           \
              fi
#endif

active proctype waiter()
{
     if
         :: !value ->
             RESET;
             if
                 :: !value -> WAIT;
                 :: else   -> skip;
             fi;
        :: else -> skip;
    fi;
    assert(value);
}

active proctype notifier()
{
    value = true;
    SET;
}
+3 −1
Original line number Diff line number Diff line
@@ -38,10 +38,12 @@
#include <strings.h>
#include <inttypes.h>
#include <limits.h>
/* Put unistd.h before time.h as that triggers localtime_r/gmtime_r
 * function availability on recentish Mingw-w64 platforms. */
#include <unistd.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/time.h>
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ struct QemuSemaphore {
};

struct QemuEvent {
    int value;
    HANDLE event;
};

Loading