diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/cutils.c | 33 | ||||
-rw-r--r-- | util/event_notifier-posix.c | 1 | ||||
-rw-r--r-- | util/id.c | 1 | ||||
-rw-r--r-- | util/iov.c | 1 | ||||
-rw-r--r-- | util/osdep.c | 1 | ||||
-rw-r--r-- | util/oslib-posix.c | 1 | ||||
-rw-r--r-- | util/oslib-win32.c | 1 | ||||
-rw-r--r-- | util/path.c | 2 | ||||
-rw-r--r-- | util/qemu-option.c | 3 | ||||
-rw-r--r-- | util/qemu-sockets.c | 1 | ||||
-rw-r--r-- | util/readline.c | 1 | ||||
-rw-r--r-- | util/unicode.c | 2 |
12 files changed, 47 insertions, 1 deletions
diff --git a/util/cutils.c b/util/cutils.c index c3dd534..43d1afb 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -29,6 +29,7 @@ #include "qemu/sockets.h" #include "qemu/iov.h" #include "net/net.h" +#include "qemu/cutils.h" void strpadcpy(char *buf, int buf_size, const char *str, char pad) { @@ -160,6 +161,38 @@ int qemu_fdatasync(int fd) #endif } +/* vector definitions */ +#ifdef __ALTIVEC__ +#include <altivec.h> +/* The altivec.h header says we're allowed to undef these for + * C++ compatibility. Here we don't care about C++, but we + * undef them anyway to avoid namespace pollution. + */ +#undef vector +#undef pixel +#undef bool +#define VECTYPE __vector unsigned char +#define SPLAT(p) vec_splat(vec_ld(0, p), 0) +#define ALL_EQ(v1, v2) vec_all_eq(v1, v2) +#define VEC_OR(v1, v2) ((v1) | (v2)) +/* altivec.h may redefine the bool macro as vector type. + * Reset it to POSIX semantics. */ +#define bool _Bool +#elif defined __SSE2__ +#include <emmintrin.h> +#define VECTYPE __m128i +#define SPLAT(p) _mm_set1_epi8(*(p)) +#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF) +#define VEC_OR(v1, v2) (_mm_or_si128(v1, v2)) +#else +#define VECTYPE unsigned long +#define SPLAT(p) (*(p) * (~0UL / 255)) +#define ALL_EQ(v1, v2) ((v1) == (v2)) +#define VEC_OR(v1, v2) ((v1) | (v2)) +#endif + +#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8 + static bool can_use_buffer_find_nonzero_offset_inner(const void *buf, size_t len) { diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 2e30e74..b00189a 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/event_notifier.h" #include "sysemu/char.h" #include "qemu/main-loop.h" @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/id.h" bool id_wellformed(const char *id) { @@ -20,6 +20,7 @@ #include "qemu-common.h" #include "qemu/iov.h" #include "qemu/sockets.h" +#include "qemu/cutils.h" size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt, size_t offset, const void *buf, size_t bytes) diff --git a/util/osdep.c b/util/osdep.c index 8356bdd..d56d071 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -37,6 +37,7 @@ extern int madvise(caddr_t, size_t, int); #endif #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/sockets.h" #include "qemu/error-report.h" #include "monitor/monitor.h" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index dcc3c7e..0908256 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -52,6 +52,7 @@ #include <libgen.h> #include <setjmp.h> #include <sys/signal.h> +#include "qemu/cutils.h" #ifdef CONFIG_LINUX #include <sys/syscall.h> diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 4ef4a9a..c926db4 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -37,6 +37,7 @@ #include "qemu/main-loop.h" #include "trace.h" #include "qemu/sockets.h" +#include "qemu/cutils.h" /* this must come after including "trace.h" */ #include <shlobj.h> diff --git a/util/path.c b/util/path.c index d09e8c5..5479f76 100644 --- a/util/path.c +++ b/util/path.c @@ -7,6 +7,8 @@ #include <sys/param.h> #include <dirent.h> #include "qemu-common.h" +#include "qemu/cutils.h" +#include "qemu/path.h" struct pathelem { diff --git a/util/qemu-option.c b/util/qemu-option.c index 98967ff..dd9e73d 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -31,6 +31,9 @@ #include "qapi/qmp/types.h" #include "qapi/qmp/qerror.h" #include "qemu/option_int.h" +#include "qemu/cutils.h" +#include "qemu/id.h" +#include "qemu/help_option.h" /* * Extracts the name of an option from the parameter string (p points at the diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 6f344d4..b87e17f 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -24,6 +24,7 @@ #include "qapi/qmp-input-visitor.h" #include "qapi/qmp-output-visitor.h" #include "qapi-visit.h" +#include "qemu/cutils.h" #ifndef AI_ADDRCONFIG # define AI_ADDRCONFIG 0 diff --git a/util/readline.c b/util/readline.c index e94c975..bbdee79 100644 --- a/util/readline.c +++ b/util/readline.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/readline.h" +#include "qemu/cutils.h" #define IS_NORM 0 #define IS_ESC 1 diff --git a/util/unicode.c b/util/unicode.c index 524dca8..a812a35 100644 --- a/util/unicode.c +++ b/util/unicode.c @@ -11,7 +11,7 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/unicode.h" /** * mod_utf8_codepoint: |