summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-07-05 20:09:26 +0300
committerAvi Kivity <avi@redhat.com>2009-07-05 20:09:26 +0300
commitae00eadddf49f3389516fcf7fc79325da4d7d08d (patch)
tree379bb27a421494d729d0d845758ca6cdef93bdc7
parente3d40136a1e3f97b3828e5a4c147487fc5d7aeda (diff)
parent600309b6108484a60be4a84cfe68e6b8d645799c (diff)
Merge commit '600309b6108484a60be4a84cfe68e6b8d645799c' into upstream-merge
* commit '600309b6108484a60be4a84cfe68e6b8d645799c': Rename target_cpu to target_arch2 monitor: Fix typo in documentation target-mips: fix MADD and MSUB/MSUBU instructions Fix hxtool. Use ctz64 in favor of ffsll Respect the standard Use pstrcpy and pstrcat to avoid OpenBSD linker warning Suppress a GCC warning Fix breakage by obsolete _P() for good Fix sdl_zoom compile problems on OpenBSD Fix missing strnlen problems Fix typo Remove bogus -Werror Conflicts: configure Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--Makefile2
-rw-r--r--Makefile.target2
-rw-r--r--block.c2
-rw-r--r--bsd-user/uaccess.c11
-rwxr-xr-xconfigure91
-rw-r--r--cutils.c13
-rw-r--r--hxtool4
-rw-r--r--linux-user/uaccess.c11
-rw-r--r--net.c7
-rw-r--r--qemu-common.h1
-rw-r--r--qemu-monitor.hx2
-rw-r--r--sdl_zoom.c1
-rw-r--r--sdl_zoom.h6
-rw-r--r--slirp/ip_icmp.h4
-rw-r--r--slirp/mbuf.h16
-rw-r--r--slirp/misc.h32
-rw-r--r--slirp/sbuf.h10
-rw-r--r--slirp/slirp.h81
-rw-r--r--slirp/socket.h28
-rw-r--r--slirp/tcp_timer.h6
-rw-r--r--slirp/udp.h14
-rw-r--r--target-i386/helper.c2
-rw-r--r--target-i386/machine.c7
-rw-r--r--target-mips/translate.c6
24 files changed, 173 insertions, 186 deletions
diff --git a/Makefile b/Makefile
index 5c98108be..eb648864c 100644
--- a/Makefile
+++ b/Makefile
@@ -203,7 +203,7 @@ sdl_zoom.o: sdl_zoom.c sdl_zoom.h sdl_zoom_template.h
sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h
-sdl.o audio/sdlaudio.o baum.o: CFLAGS += $(SDL_CFLAGS)
+sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: CFLAGS += $(SDL_CFLAGS)
acl.o: acl.h acl.c
diff --git a/Makefile.target b/Makefile.target
index fc715ae41..660a8554f 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -575,7 +575,7 @@ sound-obj-$(CONFIG_ES1370) += es1370.o
sound-obj-$(CONFIG_AC97) += ac97.o
sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
-sound-obj-$(CONFIG_CS4321A) += cs4231a.o
+sound-obj-$(CONFIG_CS4231A) += cs4231a.o
ifdef CONFIG_ADLIB
adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
diff --git a/block.c b/block.c
index c66c0319a..ddd055ca2 100644
--- a/block.c
+++ b/block.c
@@ -225,7 +225,7 @@ static BlockDriver *find_protocol(const char *filename)
{
BlockDriver *drv1;
char protocol[128];
- int len = strnlen(filename, 127)+1;
+ int len = qemu_strnlen(filename, 127) + 1;
const char *p;
#ifdef _WIN32
diff --git a/bsd-user/uaccess.c b/bsd-user/uaccess.c
index cc51449b4..9ec1b2343 100644
--- a/bsd-user/uaccess.c
+++ b/bsd-user/uaccess.c
@@ -37,17 +37,6 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len)
return ret;
}
-/* XXX: use host strnlen if available ? */
-static int qemu_strnlen(const char *s, int max_len)
-{
- int i;
- for(i = 0; i < max_len; i++) {
- if (s[i] == '\0')
- break;
- }
- return i;
-}
-
/* Return the length of a string in target memory or -TARGET_EFAULT if
access error */
abi_long target_strlen(abi_ulong guest_addr1)
diff --git a/configure b/configure
index 5f11eb078..3a224d18f 100755
--- a/configure
+++ b/configure
@@ -499,11 +499,11 @@ for opt do
sparc_cpu="$optarg"
case $sparc_cpu in
v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
- target_cpu="sparc"; cpu="sparc" ;;
+ target_arch2="sparc"; cpu="sparc" ;;
v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
- target_cpu="sparc"; cpu="sparc" ;;
+ target_arch2="sparc"; cpu="sparc" ;;
v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
- target_cpu="sparc64"; cpu="sparc64" ;;
+ target_arch2="sparc64"; cpu="sparc64" ;;
*) echo "undefined SPARC architecture. Exiting";exit 1;;
esac
;;
@@ -2039,40 +2039,40 @@ for target in $target_list; do
target_dir="$target"
config_mak=$target_dir/config.mak
config_h=$target_dir/config.h
-target_cpu=`echo $target | cut -d '-' -f 1`
+target_arch2=`echo $target | cut -d '-' -f 1`
target_bigendian="no"
-[ "$target_cpu" = "armeb" ] && target_bigendian=yes
-[ "$target_cpu" = "m68k" ] && target_bigendian=yes
-[ "$target_cpu" = "microblaze" ] && target_bigendian=yes
-[ "$target_cpu" = "mips" ] && target_bigendian=yes
-[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
-[ "$target_cpu" = "mips64" ] && target_bigendian=yes
-[ "$target_cpu" = "ppc" ] && target_bigendian=yes
-[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
-[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
-[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
-[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
-[ "$target_cpu" = "sparc" ] && target_bigendian=yes
-[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
-[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
+[ "$target_arch2" = "armeb" ] && target_bigendian=yes
+[ "$target_arch2" = "m68k" ] && target_bigendian=yes
+[ "$target_arch2" = "microblaze" ] && target_bigendian=yes
+[ "$target_arch2" = "mips" ] && target_bigendian=yes
+[ "$target_arch2" = "mipsn32" ] && target_bigendian=yes
+[ "$target_arch2" = "mips64" ] && target_bigendian=yes
+[ "$target_arch2" = "ppc" ] && target_bigendian=yes
+[ "$target_arch2" = "ppcemb" ] && target_bigendian=yes
+[ "$target_arch2" = "ppc64" ] && target_bigendian=yes
+[ "$target_arch2" = "ppc64abi32" ] && target_bigendian=yes
+[ "$target_arch2" = "sh4eb" ] && target_bigendian=yes
+[ "$target_arch2" = "sparc" ] && target_bigendian=yes
+[ "$target_arch2" = "sparc64" ] && target_bigendian=yes
+[ "$target_arch2" = "sparc32plus" ] && target_bigendian=yes
target_softmmu="no"
target_user_only="no"
target_linux_user="no"
target_darwin_user="no"
target_bsd_user="no"
case "$target" in
- ${target_cpu}-softmmu)
+ ${target_arch2}-softmmu)
target_softmmu="yes"
;;
- ${target_cpu}-linux-user)
+ ${target_arch2}-linux-user)
target_user_only="yes"
target_linux_user="yes"
;;
- ${target_cpu}-darwin-user)
+ ${target_arch2}-darwin-user)
target_user_only="yes"
target_darwin_user="yes"
;;
- ${target_cpu}-bsd-user)
+ ${target_arch2}-bsd-user)
target_user_only="yes"
target_bsd_user="yes"
;;
@@ -2110,7 +2110,7 @@ echo "#include \"../config-host.h\"" >> $config_h
bflt="no"
elfload32="no"
target_nptl="no"
-interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
+interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
gdb_xml_files=""
target_kvm="$kvm"
@@ -2141,11 +2141,10 @@ configure_kvm() {
}
# Make sure the target and host cpus are compatible
-if test ! \( "$target_cpu" = "$cpu" -o \
- \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
- \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
- \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) -o \
- \( "$target_cpu" = "ia64" -a "$cpu" = "ia64" \) \) ; then
+if test ! \( "$target_arch2" = "$cpu" -o \
+ \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
+ \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
+ \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
target_kvm="no"
fi
# Disable KVM for linux-user
@@ -2153,7 +2152,7 @@ if test "$target_softmmu" = "no" ; then
target_kvm="no"
fi
-case "$target_cpu" in
+case "$target_arch2" in
i386)
echo "TARGET_ARCH=i386" >> $config_mak
echo "#define TARGET_ARCH \"i386\"" >> $config_h
@@ -2382,23 +2381,23 @@ if test ! -z "$gdb_xml_files" ; then
fi
echo "TARGET_XML_FILES=$list" >> $config_mak
-if test "$target_cpu" = "arm" \
- -o "$target_cpu" = "armeb" \
- -o "$target_cpu" = "m68k" \
- -o "$target_cpu" = "microblaze" \
- -o "$target_cpu" = "mips" \
- -o "$target_cpu" = "mipsel" \
- -o "$target_cpu" = "mipsn32" \
- -o "$target_cpu" = "mipsn32el" \
- -o "$target_cpu" = "mips64" \
- -o "$target_cpu" = "mips64el" \
- -o "$target_cpu" = "ppc" \
- -o "$target_cpu" = "ppc64" \
- -o "$target_cpu" = "ppc64abi32" \
- -o "$target_cpu" = "ppcemb" \
- -o "$target_cpu" = "sparc" \
- -o "$target_cpu" = "sparc64" \
- -o "$target_cpu" = "sparc32plus"; then
+if test "$target_arch2" = "arm" \
+ -o "$target_arch2" = "armeb" \
+ -o "$target_arch2" = "m68k" \
+ -o "$target_arch2" = "microblaze" \
+ -o "$target_arch2" = "mips" \
+ -o "$target_arch2" = "mipsel" \
+ -o "$target_arch2" = "mipsn32" \
+ -o "$target_arch2" = "mipsn32el" \
+ -o "$target_arch2" = "mips64" \
+ -o "$target_arch2" = "mips64el" \
+ -o "$target_arch2" = "ppc" \
+ -o "$target_arch2" = "ppc64" \
+ -o "$target_arch2" = "ppc64abi32" \
+ -o "$target_arch2" = "ppcemb" \
+ -o "$target_arch2" = "sparc" \
+ -o "$target_arch2" = "sparc64" \
+ -o "$target_arch2" = "sparc32plus"; then
echo "CONFIG_SOFTFLOAT=y" >> $config_mak
echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
fi
diff --git a/cutils.c b/cutils.c
index f78300cad..346477b15 100644
--- a/cutils.c
+++ b/cutils.c
@@ -109,6 +109,19 @@ int stristart(const char *str, const char *val, const char **ptr)
return 1;
}
+/* XXX: use host strnlen if available ? */
+int qemu_strnlen(const char *s, int max_len)
+{
+ int i;
+
+ for(i = 0; i < max_len; i++) {
+ if (s[i] == '\0') {
+ break;
+ }
+ }
+ return i;
+}
+
time_t mktimegm(struct tm *tm)
{
time_t t;
diff --git a/hxtool b/hxtool
index 885abe222..0fdbc641c 100644
--- a/hxtool
+++ b/hxtool
@@ -26,10 +26,10 @@ hxtotexi()
STEXI*|ETEXI*) flag=$(($flag^1))
;;
DEFHEADING*)
- echo $(expr "$str" : "DEFHEADING(\(.*\))")
+ echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
;;
*)
- test $flag -eq 1 && echo $str
+ test $flag -eq 1 && echo "$str"
;;
esac
done
diff --git a/linux-user/uaccess.c b/linux-user/uaccess.c
index 4d506935f..a4d108c2f 100644
--- a/linux-user/uaccess.c
+++ b/linux-user/uaccess.c
@@ -37,17 +37,6 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len)
return ret;
}
-/* XXX: use host strnlen if available ? */
-static int qemu_strnlen(const char *s, int max_len)
-{
- int i;
- for(i = 0; i < max_len; i++) {
- if (s[i] == '\0')
- break;
- }
- return i;
-}
-
/* Return the length of a string in target memory or -TARGET_EFAULT if
access error */
abi_long target_strlen(abi_ulong guest_addr1)
diff --git a/net.c b/net.c
index 6ead76ac7..ac06ea152 100644
--- a/net.c
+++ b/net.c
@@ -2660,10 +2660,11 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
goto out;
}
if (get_param_value(buf, sizeof(buf), "ip", p)) {
+ int vnet_buflen = strlen(buf) + strlen("/24") + 1;
/* emulate legacy parameter */
- vnet = qemu_malloc(strlen(buf) + strlen("/24") + 1);
- strcpy(vnet, buf);
- strcat(vnet, "/24");
+ vnet = qemu_malloc(vnet_buflen);
+ pstrcpy(vnet, vnet_buflen, buf);
+ pstrcat(vnet, vnet_buflen, "/24");
}
if (get_param_value(buf, sizeof(buf), "net", p)) {
vnet = qemu_strdup(buf);
diff --git a/qemu-common.h b/qemu-common.h
index 8916502b8..53ff1d600 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -109,6 +109,7 @@ void pstrcpy(char *buf, int buf_size, const char *str);
char *pstrcat(char *buf, int buf_size, const char *s);
int strstart(const char *str, const char *val, const char **ptr);
int stristart(const char *str, const char *val, const char **ptr);
+int qemu_strnlen(const char *s, int max_len);
time_t mktimegm(struct tm *tm);
int qemu_fls(int i);
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 3fdf2d249..17572224e 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -582,7 +582,7 @@ ETEXI
{ "acl_policy", "ss", do_acl_policy, "aclname allow|deny",
"set default access control list policy" },
STEXI
-@item acl_policy @var{aclname] @code{allow|deny}
+@item acl_policy @var{aclname} @code{allow|deny}
Set the default access control list policy, used in the event that
none of the explicit rules match. The default policy at startup is
always @code{deny}.
diff --git a/sdl_zoom.c b/sdl_zoom.c
index 56d3604fc..a986c7c14 100644
--- a/sdl_zoom.c
+++ b/sdl_zoom.c
@@ -14,6 +14,7 @@
#include "sdl_zoom.h"
#include "osdep.h"
#include <stdint.h>
+#include <stdio.h>
static int sdl_zoom_rgb16(SDL_Surface *src, SDL_Surface *dst, int smooth,
SDL_Rect *dst_rect);
diff --git a/sdl_zoom.h b/sdl_zoom.h
index 33dc63408..9bc13ae05 100644
--- a/sdl_zoom.h
+++ b/sdl_zoom.h
@@ -11,8 +11,8 @@
*
*/
-#ifndef _SDL_zoom_h
-#define _SDL_zoom_h
+#ifndef SDL_zoom_h
+#define SDL_zoom_h
#include <SDL/SDL.h>
@@ -22,4 +22,4 @@
int sdl_zoom_blit(SDL_Surface *src_sfc, SDL_Surface *dst_sfc,
int smooth, SDL_Rect *src_rect);
-#endif /* _SDL_zoom_h */
+#endif /* SDL_zoom_h */
diff --git a/slirp/ip_icmp.h b/slirp/ip_icmp.h
index 03301313e..e793990d2 100644
--- a/slirp/ip_icmp.h
+++ b/slirp/ip_icmp.h
@@ -153,9 +153,9 @@ struct icmp {
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
-void icmp_input _P((struct mbuf *, int));
+void icmp_input(struct mbuf *, int);
void icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
const char *message);
-void icmp_reflect _P((struct mbuf *));
+void icmp_reflect(struct mbuf *);
#endif
diff --git a/slirp/mbuf.h b/slirp/mbuf.h
index 99fca4389..97729e24b 100644
--- a/slirp/mbuf.h
+++ b/slirp/mbuf.h
@@ -115,13 +115,13 @@ struct mbuf {
#define M_DOFREE 0x08 /* when m_free is called on the mbuf, free()
* it rather than putting it on the free list */
-void m_init _P((Slirp *));
-struct mbuf * m_get _P((Slirp *));
-void m_free _P((struct mbuf *));
-void m_cat _P((register struct mbuf *, register struct mbuf *));
-void m_inc _P((struct mbuf *, int));
-void m_adj _P((struct mbuf *, int));
-int m_copy _P((struct mbuf *, struct mbuf *, int, int));
-struct mbuf * dtom _P((Slirp *, void *));
+void m_init(Slirp *);
+struct mbuf * m_get(Slirp *);
+void m_free(struct mbuf *);
+void m_cat(register struct mbuf *, register struct mbuf *);
+void m_inc(struct mbuf *, int);
+void m_adj(struct mbuf *, int);
+int m_copy(struct mbuf *, struct mbuf *, int, int);
+struct mbuf * dtom(Slirp *, void *);
#endif
diff --git a/slirp/misc.h b/slirp/misc.h
index e43519dcb..c33539435 100644
--- a/slirp/misc.h
+++ b/slirp/misc.h
@@ -17,10 +17,10 @@ struct ex_list {
};
#ifndef HAVE_STRDUP
-char *strdup _P((const char *));
+char *strdup(const char *);
#endif
-void do_wait _P((int));
+void do_wait(int);
#define EMU_NONE 0x0
@@ -58,20 +58,20 @@ struct emu_t {
extern int x_port, x_server, x_display;
-int show_x _P((char *, struct socket *));
-void redir_x _P((u_int32_t, int, int, int));
-void slirp_insque _P((void *, void *));
-void slirp_remque _P((void *));
-int add_exec _P((struct ex_list **, int, char *, struct in_addr, int));
-int slirp_openpty _P((int *, int *));
+int show_x(char *, struct socket *);
+void redir_x(u_int32_t, int, int, int);
+void slirp_insque(void *, void *);
+void slirp_remque(void *);
+int add_exec(struct ex_list **, int, char *, struct in_addr, int);
+int slirp_openpty(int *, int *);
int fork_exec(struct socket *so, const char *ex, int do_pty);
-void snooze_hup _P((int));
-void snooze _P((void));
-void relay _P((int));
-void add_emu _P((char *));
-void u_sleep _P((int));
-void fd_nonblock _P((int));
-void fd_block _P((int));
-int rsh_exec _P((struct socket *, struct socket *, char *, char *, char *));
+void snooze_hup(int);
+void snooze(void);
+void relay(int);
+void add_emu(char *);
+void u_sleep(int);
+void fd_nonblock(int);
+void fd_block(int);
+int rsh_exec(struct socket *, struct socket *, char *, char *, char *);
#endif
diff --git a/slirp/sbuf.h b/slirp/sbuf.h
index a4f103623..4f22e7c38 100644
--- a/slirp/sbuf.h
+++ b/slirp/sbuf.h
@@ -21,10 +21,10 @@ struct sbuf {
char *sb_data; /* Actual data */
};
-void sbfree _P((struct sbuf *));
-void sbdrop _P((struct sbuf *, int));
-void sbreserve _P((struct sbuf *, int));
-void sbappend _P((struct socket *, struct mbuf *));
-void sbcopy _P((struct sbuf *, int, int, char *));
+void sbfree(struct sbuf *);
+void sbdrop(struct sbuf *, int);
+void sbreserve(struct sbuf *, int);
+void sbappend(struct socket *, struct mbuf *);
+void sbcopy(struct sbuf *, int, int, char *);
#endif
diff --git a/slirp/slirp.h b/slirp/slirp.h
index 920d7a621..22058cd05 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -103,13 +103,6 @@ typedef unsigned char u_int8_t;
#include <sys/uio.h>
#endif
-#undef _P
-#ifndef NO_PROTOTYPES
-# define _P(x) x
-#else
-# define _P(x) ()
-#endif
-
#ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -121,17 +114,17 @@ typedef unsigned char u_int8_t;
/* Systems lacking strdup() definition in <string.h>. */
#if defined(ultrix)
-char *strdup _P((const char *));
+char *strdup(const char *);
#endif
/* Systems lacking malloc() definition in <stdlib.h>. */
#if defined(ultrix) || defined(hcx)
-void *malloc _P((size_t arg));
-void free _P((void *ptr));
+void *malloc(size_t arg);
+void free(void *ptr);
#endif
#ifndef HAVE_INET_ATON
-int inet_aton _P((const char *cp, struct in_addr *ia));
+int inet_aton(const char *cp, struct in_addr *ia);
#endif
#include <fcntl.h>
@@ -270,38 +263,38 @@ extern Slirp *slirp_instance;
#endif
#ifndef FULL_BOLT
-void if_start _P((Slirp *));
+void if_start(Slirp *);
#else
-void if_start _P((struct ttys *));
+void if_start(struct ttys *);
#endif
#ifdef BAD_SPRINTF
# define vsprintf vsprintf_len
# define sprintf sprintf_len
- extern int vsprintf_len _P((char *, const char *, va_list));
- extern int sprintf_len _P((char *, const char *, ...));
+ extern int vsprintf_len(char *, const char *, va_list);
+ extern int sprintf_len(char *, const char *, ...);
#endif
#ifdef DECLARE_SPRINTF
# ifndef BAD_SPRINTF
- extern int vsprintf _P((char *, const char *, va_list));
+ extern int vsprintf(char *, const char *, va_list);
# endif
- extern int vfprintf _P((FILE *, const char *, va_list));
+ extern int vfprintf(FILE *, const char *, va_list);
#endif
#ifndef HAVE_STRERROR
- extern char *strerror _P((int error));
+ extern char *strerror(int error);
#endif
#ifndef HAVE_INDEX
- char *index _P((const char *, int));
+ char *index(const char *, int);
#endif
#ifndef HAVE_GETHOSTID
- long gethostid _P((void));
+ long gethostid(void);
#endif
-void lprint _P((const char *, ...));
+void lprint(const char *, ...);
#ifndef _WIN32
#include <netdb.h>
@@ -316,39 +309,39 @@ void lprint _P((const char *, ...));
int cksum(struct mbuf *m, int len);
/* if.c */
-void if_init _P((Slirp *));
-void if_output _P((struct socket *, struct mbuf *));
+void if_init(Slirp *);
+void if_output(struct socket *, struct mbuf *);
/* ip_input.c */
-void ip_init _P((Slirp *));
-void ip_input _P((struct mbuf *));
-void ip_slowtimo _P((Slirp *));
-void ip_stripoptions _P((register struct mbuf *, struct mbuf *));
+void ip_init(Slirp *);
+void ip_input(struct mbuf *);
+void ip_slowtimo(Slirp *);
+void ip_stripoptions(register struct mbuf *, struct mbuf *);
/* ip_output.c */
-int ip_output _P((struct socket *, struct mbuf *));
+int ip_output(struct socket *, struct mbuf *);
/* tcp_input.c */
-void tcp_input _P((register struct mbuf *, int, struct socket *));
-int tcp_mss _P((register struct tcpcb *, u_int));
+void tcp_input(register struct mbuf *, int, struct socket *);
+int tcp_mss(register struct tcpcb *, u_int);
/* tcp_output.c */
-int tcp_output _P((register struct tcpcb *));
-void tcp_setpersist _P((register struct tcpcb *));
+int tcp_output(register struct tcpcb *);
+void tcp_setpersist(register struct tcpcb *);
/* tcp_subr.c */
-void tcp_init _P((Slirp *));
-void tcp_template _P((struct tcpcb *));
-void tcp_respond _P((struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int));
-struct tcpcb * tcp_newtcpcb _P((struct socket *));
-struct tcpcb * tcp_close _P((register struct tcpcb *));
-void tcp_sockclosed _P((struct tcpcb *));
-int tcp_fconnect _P((struct socket *));
-void tcp_connect _P((struct socket *));
-int tcp_attach _P((struct socket *));
-u_int8_t tcp_tos _P((struct socket *));
-int tcp_emu _P((struct socket *, struct mbuf *));
-int tcp_ctl _P((struct socket *));
+void tcp_init(Slirp *);
+void tcp_template(struct tcpcb *);
+void tcp_respond(struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int);
+struct tcpcb * tcp_newtcpcb(struct socket *);
+struct tcpcb * tcp_close(register struct tcpcb *);
+void tcp_sockclosed(struct tcpcb *);
+int tcp_fconnect(struct socket *);
+void tcp_connect(struct socket *);
+int tcp_attach(struct socket *);
+u_int8_t tcp_tos(struct socket *);
+int tcp_emu(struct socket *, struct mbuf *);
+int tcp_ctl(struct socket *);
struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
#ifdef USE_PPP
diff --git a/slirp/socket.h b/slirp/socket.h
index dcf27430b..6e85d0358 100644
--- a/slirp/socket.h
+++ b/slirp/socket.h
@@ -74,20 +74,20 @@ struct socket {
#define SS_HOSTFWD 0x1000 /* Socket describes host->guest forwarding */
#define SS_INCOMING 0x2000 /* Connection was initiated by a host on the internet */
-struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int));
-struct socket * socreate _P((Slirp *));
-void sofree _P((struct socket *));
-int soread _P((struct socket *));
-void sorecvoob _P((struct socket *));
-int sosendoob _P((struct socket *));
-int sowrite _P((struct socket *));
-void sorecvfrom _P((struct socket *));
-int sosendto _P((struct socket *, struct mbuf *));
-struct socket * tcp_listen _P((Slirp *, u_int32_t, u_int, u_int32_t, u_int,
- int));
-void soisfconnecting _P((register struct socket *));
-void soisfconnected _P((register struct socket *));
-void sofwdrain _P((struct socket *));
+struct socket * solookup(struct socket *, struct in_addr, u_int, struct in_addr, u_int);
+struct socket * socreate(Slirp *);
+void sofree(struct socket *);
+int soread(struct socket *);
+void sorecvoob(struct socket *);
+int sosendoob(struct socket *);
+int sowrite(struct socket *);
+void sorecvfrom(struct socket *);
+int sosendto(struct socket *, struct mbuf *);
+struct socket * tcp_listen(Slirp *, u_int32_t, u_int, u_int32_t, u_int,
+ int);
+void soisfconnecting(register struct socket *);
+void soisfconnected(register struct socket *);
+void sofwdrain(struct socket *);
struct iovec; /* For win32 */
size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np);
int soreadbuf(struct socket *so, const char *buf, int size);
diff --git a/slirp/tcp_timer.h b/slirp/tcp_timer.h
index cfb06ffc8..ff17914f4 100644
--- a/slirp/tcp_timer.h
+++ b/slirp/tcp_timer.h
@@ -120,8 +120,8 @@ extern const int tcp_backoff[];
struct tcpcb;
-void tcp_fasttimo _P((Slirp *));
-void tcp_slowtimo _P((Slirp *));
-void tcp_canceltimers _P((struct tcpcb *));
+void tcp_fasttimo(Slirp *);
+void tcp_slowtimo(Slirp *);
+void tcp_canceltimers(struct tcpcb *);
#endif
diff --git a/slirp/udp.h b/slirp/udp.h
index cc814a3f4..47d2f3d4c 100644
--- a/slirp/udp.h
+++ b/slirp/udp.h
@@ -73,13 +73,13 @@ struct udpiphdr {
struct mbuf;
-void udp_init _P((Slirp *));
-void udp_input _P((register struct mbuf *, int));
-int udp_output _P((struct socket *, struct mbuf *, struct sockaddr_in *));
-int udp_attach _P((struct socket *));
-void udp_detach _P((struct socket *));
-struct socket * udp_listen _P((Slirp *, u_int32_t, u_int, u_int32_t, u_int,
- int));
+void udp_init(Slirp *);
+void udp_input(register struct mbuf *, int);
+int udp_output(struct socket *, struct mbuf *, struct sockaddr_in *);
+int udp_attach(struct socket *);
+void udp_detach(struct socket *);
+struct socket * udp_listen(Slirp *, u_int32_t, u_int, u_int32_t, u_int,
+ int);
int udp_output2(struct socket *so, struct mbuf *m,
struct sockaddr_in *saddr, struct sockaddr_in *daddr,
int iptos);
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 87c04e541..72ea6cf72 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -316,7 +316,7 @@ static int cpu_x86_fill_model_id(char *str)
static int cpu_x86_fill_host(x86_def_t *x86_cpu_def)
{
- uint32_t eax, ebx, ecx, edx;
+ uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
x86_cpu_def->name = "host";
host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx);
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 14942c026..10aa19b00 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -2,6 +2,7 @@
#include "hw/boards.h"
#include "hw/pc.h"
#include "hw/isa.h"
+#include "host-utils.h"
#include "exec-all.h"
#include "kvm.h"
@@ -151,9 +152,9 @@ void cpu_save(QEMUFile *f, void *opaque)
to find it and save its number instead (-1 for none). */
pending_irq = -1;
for (i = 0; i < ARRAY_SIZE(env->interrupt_bitmap); i++) {
- bit = ffsll(env->interrupt_bitmap[i]);
- if (bit) {
- pending_irq = i * 64 + bit - 1;
+ if (env->interrupt_bitmap[i]) {
+ bit = ctz64(env->interrupt_bitmap[i]);
+ pending_irq = i * 64 + bit;
break;
}
}
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 6f5bea4b0..d316b9d1e 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -2132,7 +2132,7 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc,
tcg_gen_trunc_i64_tl(t1, t2);
tcg_temp_free_i64(t2);
tcg_gen_ext32s_tl(cpu_LO[0], t0);
- tcg_gen_ext32s_tl(cpu_LO[1], t1);
+ tcg_gen_ext32s_tl(cpu_HI[0], t1);
}
opn = "madd";
break;
@@ -2167,7 +2167,7 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc,
tcg_gen_ext_tl_i64(t3, t1);
tcg_gen_mul_i64(t2, t2, t3);
tcg_gen_concat_tl_i64(t3, cpu_LO[0], cpu_HI[0]);
- tcg_gen_sub_i64(t2, t2, t3);
+ tcg_gen_sub_i64(t2, t3, t2);
tcg_temp_free_i64(t3);
tcg_gen_trunc_i64_tl(t0, t2);
tcg_gen_shri_i64(t2, t2, 32);
@@ -2189,7 +2189,7 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc,
tcg_gen_extu_tl_i64(t3, t1);
tcg_gen_mul_i64(t2, t2, t3);
tcg_gen_concat_tl_i64(t3, cpu_LO[0], cpu_HI[0]);
- tcg_gen_sub_i64(t2, t2, t3);
+ tcg_gen_sub_i64(t2, t3, t2);
tcg_temp_free_i64(t3);
tcg_gen_trunc_i64_tl(t0, t2);
tcg_gen_shri_i64(t2, t2, 32);