mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-25 04:43:33 +00:00
- Update net/usbredir to 0.6 .
- Update emulators/qemu-devel to 1.4.0 with preliminary bsd-user patches. Thanx to: sson, cognet, and others for much improved bsd-user support - it now runs at least quite a few mips64 and single-threaded arm binaries, see: https://wiki.freebsd.org/QemuUserModeHowTo
This commit is contained in:
parent
8b42986e85
commit
45aa9370f0
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=315552
@ -2,8 +2,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= qemu
|
||||
PORTVERSION= 1.1.1
|
||||
PORTREVISION= 2
|
||||
PORTVERSION= 1.4.0
|
||||
CATEGORIES= emulators
|
||||
MASTER_SITES= http://wiki.qemu.org/download/:release \
|
||||
LOCAL/nox:snapshot
|
||||
@ -14,8 +13,10 @@ DIST_SUBDIR= qemu/${PORTVERSION}
|
||||
MAINTAINER= nox@FreeBSD.org
|
||||
COMMENT= QEMU CPU Emulator - development version
|
||||
|
||||
LIB_DEPENDS= pixman-1:${PORTSDIR}/x11/pixman
|
||||
|
||||
HAS_CONFIGURE= yes
|
||||
EXTRACT_SUFX= .tar.bz2
|
||||
USE_BZIP2= yes
|
||||
USE_GMAKE= yes
|
||||
USE_PERL5_BUILD= yes
|
||||
USE_PYTHON_BUILD= yes
|
||||
@ -29,7 +30,8 @@ CONFLICTS_INSTALL= qemu-[0-9]*
|
||||
MAKE_JOBS_SAFE= yes
|
||||
|
||||
OPTIONS_DEFINE= SAMBA SDL OPENGL GNUTLS SASL JPEG PNG CURL CDROM_DMA PCAP \
|
||||
USBREDIR GNS3 ADD_AUDIO CLANG_HACK X86_TARGETS BSD_USER
|
||||
USBREDIR GNS3 ADD_AUDIO CLANG_HACK X86_TARGETS BSD_USER \
|
||||
STATIC_LINK
|
||||
SAMBA_DESC= samba dependency (for -smb)
|
||||
GNUTLS_DESC= gnutls dependency (vnc encryption)
|
||||
SASL_DESC= cyrus-sasl dependency (vnc encryption)
|
||||
@ -40,11 +42,12 @@ CDROM_DMA_DESC= IDE CDROM DMA
|
||||
PCAP_DESC= pcap dependency (networking with bpf)
|
||||
SEABIOS_GIT_DESC= add seabios snapshot (-bios bios.bin-1.6.3.1)
|
||||
USBREDIR_DESC= usb device network redirection (experimental!)
|
||||
GNS3_DESC= gns3 patches (udp, promiscuous multicast)
|
||||
GNS3_DESC= gns3 patches (promiscuous multicast)
|
||||
ADD_AUDIO_DESC= Emulate more audio hardware (experimental!)
|
||||
CLANG_HACK_DESC= clang workaround (result slow and less stable!)
|
||||
X86_TARGETS_DESC= Don't build non-x86 system targets
|
||||
BSD_USER_DESC= Also build bsd-user targets (for testing)
|
||||
STATIC_LINK_DESC= Statically link the executables
|
||||
OPTIONS_DEFAULT=SDL OPENGL GNUTLS SASL JPEG PNG CURL CDROM_DMA PCAP
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
@ -64,13 +67,22 @@ USE_GCC= any
|
||||
|
||||
.if ${PORT_OPTIONS:MX86_TARGETS}
|
||||
.if ${PORT_OPTIONS:MBSD_USER}
|
||||
CONFIGURE_ARGS+= --target-list=i386-softmmu,x86_64-softmmu,i386-bsd-user,x86_64-bsd-user,sparc-bsd-user,sparc64-bsd-user,arm-bsd-user
|
||||
.if ${ARCH} != "amd64"
|
||||
CONFIGURE_ARGS+= --enable-nptl --target-list=i386-softmmu,x86_64-softmmu,i386-bsd-user,sparc-bsd-user,arm-bsd-user,armeb-bsd-user,mips-bsd-user,mipsel-bsd-user
|
||||
.else
|
||||
CONFIGURE_ARGS+= --enable-nptl --target-list=i386-softmmu,x86_64-softmmu,i386-bsd-user,x86_64-bsd-user,sparc-bsd-user,sparc64-bsd-user,arm-bsd-user,armeb-bsd-user,mips-bsd-user,mipsel-bsd-user,mips64-bsd-user
|
||||
.endif
|
||||
.else
|
||||
CONFIGURE_ARGS+= --target-list=i386-softmmu,x86_64-softmmu
|
||||
.endif
|
||||
.else
|
||||
.if empty(PORT_OPTIONS:MBSD_USER)
|
||||
CONFIGURE_ARGS+= --disable-bsd-user
|
||||
.else
|
||||
CONFIGURE_ARGS+= --enable-nptl
|
||||
.if ${ARCH} != "amd64"
|
||||
CONFIGURE_ARGS+= --target-list=i386-softmmu,x86_64-softmmu,alpha-softmmu,arm-softmmu,cris-softmmu,lm32-softmmu,m68k-softmmu,microblaze-softmmu,microblazeel-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu,or32-softmmu,ppc-softmmu,ppcemb-softmmu,ppc64-softmmu,sh4-softmmu,sh4eb-softmmu,sparc-softmmu,sparc64-softmmu,s390x-softmmu,xtensa-softmmu,xtensaeb-softmmu,unicore32-softmmu,i386-bsd-user,sparc-bsd-user,arm-bsd-user,armeb-bsd-user,mips-bsd-user,mipsel-bsd-user
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
@ -82,6 +94,11 @@ PLIST_SUB+= BSD_USER=""
|
||||
IGNORE= bsd-user targets not tested on sparc64
|
||||
.endif
|
||||
.endif
|
||||
.if empty(PORT_OPTIONS:MBSD_USER) || ${ARCH} != "amd64"
|
||||
PLIST_SUB+= BSD_USER64="@comment "
|
||||
.else
|
||||
PLIST_SUB+= BSD_USER64=""
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MX86_TARGETS}
|
||||
PLIST_SUB+= NONX86="@comment "
|
||||
@ -90,13 +107,7 @@ PLIST_SUB+= NONX86=""
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MGNS3}
|
||||
EXTRA_PATCHES+= ${FILESDIR}/hw_e1000_c.patch \
|
||||
${FILESDIR}/net_c.patch \
|
||||
${FILESDIR}/net_h.patch \
|
||||
${FILESDIR}/net_udp_c.patch \
|
||||
${FILESDIR}/net_udp_h.patch \
|
||||
${FILESDIR}/Makefile_objs.patch \
|
||||
${FILESDIR}/gns3-qemu-options.hx.patch
|
||||
EXTRA_PATCHES+= ${FILESDIR}/hw_e1000_c.patch
|
||||
.endif
|
||||
|
||||
WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation
|
||||
@ -105,6 +116,8 @@ CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC} --enable-docs \
|
||||
--disable-linux-user --disable-linux-aio \
|
||||
--disable-kvm --disable-xen \
|
||||
--smbd=${LOCALBASE}/sbin/smbd \
|
||||
--enable-debug \
|
||||
--enable-debug-info \
|
||||
--extra-cflags=-I${WRKSRC}\ -I${LOCALBASE}/include\ -DPREFIX=\\\"${PREFIX}\\\"
|
||||
|
||||
.if empty(PORT_OPTIONS:MSDL)
|
||||
@ -160,6 +173,10 @@ RUN_DEPENDS+= usbredir>=0.4.3:${PORTSDIR}/net/usbredir
|
||||
CONFIGURE_ARGS+= --enable-pcap
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MSTATIC_LINK}
|
||||
CONFIGURE_ARGS+= --static
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MADD_AUDIO}
|
||||
CONFIGURE_ARGS+= --audio-card-list=ac97,es1370,sb16,cs4231a,adlib,gus,hda
|
||||
.endif
|
||||
@ -201,9 +218,11 @@ MAKE_ENV+= COMPILER_PATH=${LOCALBASE}/bin
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
.if ${OSVERSION} < 900000
|
||||
@${REINPLACE_CMD} -e '/LIBS/s|-lprocstat||' ${WRKSRC}/configure
|
||||
.endif
|
||||
.if ${PORT_OPTIONS:MPCAP}
|
||||
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/pcap-patch
|
||||
@${REINPLACE_CMD} -f ${FILESDIR}/pcap-client-type.sed ${WRKSRC}/net.h
|
||||
.endif
|
||||
.if empty(PORT_OPTIONS:MCDROM_DMA)
|
||||
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/cdrom-dma-patch
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (qemu/1.1.1/qemu-1.1.1.tar.bz2) = 004a3032b504e70174c504d6c156b1ec3445abd9913602af0d7a5ac0703ddf5c
|
||||
SIZE (qemu/1.1.1/qemu-1.1.1.tar.bz2) = 11712524
|
||||
SHA256 (qemu/1.4.0/qemu-1.4.0.tar.bz2) = 066297ed77408fb7588889c271a85cf3c259ad55c939315988e6062d7708eda8
|
||||
SIZE (qemu/1.4.0/qemu-1.4.0.tar.bz2) = 10419510
|
||||
|
@ -1,10 +0,0 @@
|
||||
--- qemu-0.14.1/Makefile.objs.orig Thu Jun 23 17:44:50 2011
|
||||
+++ qemu-0.14.1/Makefile.objs Thu Jun 23 17:45:01 2011
|
||||
@@ -34,6 +34,7 @@
|
||||
net-nested-y = queue.o checksum.o util.o
|
||||
net-nested-y += socket.o
|
||||
net-nested-y += dump.o
|
||||
+net-nested-y += udp.o
|
||||
net-nested-$(CONFIG_POSIX) += tap.o
|
||||
net-nested-$(CONFIG_LINUX) += tap-linux.o
|
||||
net-nested-$(CONFIG_WIN32) += tap-win32.o
|
@ -1,11 +0,0 @@
|
||||
--- a/qemu-options.hx
|
||||
+++ b/qemu-options.hx
|
||||
@@ -1050,6 +1050,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
|
||||
" connect the user mode network stack to VLAN 'n', configure its\n"
|
||||
" DHCP server and enabled optional services\n"
|
||||
#endif
|
||||
+ "-net udp[,vlan=n],sport=sport,dport=dport,daddr=host\n"
|
||||
+ " connect the vlan 'n' to a udp host (for dynamips/pemu/GNS3)\n"
|
||||
#ifdef _WIN32
|
||||
"-net tap[,vlan=n][,name=str],ifname=name\n"
|
||||
" connect the host TAP network interface to VLAN 'n'\n"
|
@ -1,38 +0,0 @@
|
||||
--- qemu-0.15.0/net.c.orig
|
||||
+++ qemu-0.15.0/net.c
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "net/dump.h"
|
||||
#include "net/slirp.h"
|
||||
#include "net/vde.h"
|
||||
+#include "net/udp.h"
|
||||
#include "net/util.h"
|
||||
#include "monitor.h"
|
||||
#include "qemu-common.h"
|
||||
@@ -1029,6 +1030,27 @@ static const struct {
|
||||
},
|
||||
},
|
||||
#endif
|
||||
+ [NET_CLIENT_TYPE_UDP] = {
|
||||
+ .type = "udp",
|
||||
+ .init = net_init_udp,
|
||||
+ .desc = {
|
||||
+ NET_COMMON_PARAMS_DESC,
|
||||
+ {
|
||||
+ .name = "sport",
|
||||
+ .type = QEMU_OPT_NUMBER,
|
||||
+ .help = "source port number",
|
||||
+ }, {
|
||||
+ .name = "daddr",
|
||||
+ .type = QEMU_OPT_STRING,
|
||||
+ .help = "destination IP address",
|
||||
+ }, {
|
||||
+ .name = "dport",
|
||||
+ .type = QEMU_OPT_NUMBER,
|
||||
+ .help = "destination port number",
|
||||
+ },
|
||||
+ { /* end of list */ }
|
||||
+ },
|
||||
+ },
|
||||
[NET_CLIENT_TYPE_DUMP] = {
|
||||
.type = "dump",
|
||||
.init = net_init_dump,
|
@ -1,10 +0,0 @@
|
||||
--- qemu-0.15.0/net.h.orig
|
||||
+++ qemu-0.15.0/net.h
|
||||
@@ -35,6 +35,7 @@ typedef enum {
|
||||
NET_CLIENT_TYPE_TAP,
|
||||
NET_CLIENT_TYPE_SOCKET,
|
||||
NET_CLIENT_TYPE_VDE,
|
||||
+ NET_CLIENT_TYPE_UDP,
|
||||
NET_CLIENT_TYPE_DUMP,
|
||||
|
||||
NET_CLIENT_TYPE_MAX
|
@ -1,141 +0,0 @@
|
||||
--- qemu-0.14.1/net/udp.c.orig Thu Jun 23 17:09:02 2011
|
||||
+++ qemu-0.14.1/net/udp.c Thu Jun 23 17:10:17 2011
|
||||
@@ -0,0 +1,138 @@
|
||||
+/*
|
||||
+ * QEMU System Emulator
|
||||
+ *
|
||||
+ * Copyright (c) 2003-2008 Fabrice Bellard
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
+ * of this software and associated documentation files (the "Software"), to deal
|
||||
+ * in the Software without restriction, including without limitation the rights
|
||||
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
+ * copies of the Software, and to permit persons to whom the Software is
|
||||
+ * furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be included in
|
||||
+ * all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
+ * THE SOFTWARE.
|
||||
+ */
|
||||
+#include "net/udp.h"
|
||||
+
|
||||
+#include "config-host.h"
|
||||
+
|
||||
+#ifndef _WIN32
|
||||
+#include <arpa/inet.h>
|
||||
+#include <netinet/in.h>
|
||||
+#include <netinet/udp.h>
|
||||
+#endif
|
||||
+
|
||||
+#include "net.h"
|
||||
+#include "qemu-char.h"
|
||||
+#include "qemu-common.h"
|
||||
+#include "qemu-option.h"
|
||||
+#include "qemu_socket.h"
|
||||
+#include "sysemu.h"
|
||||
+
|
||||
+
|
||||
+typedef struct UDPState {
|
||||
+ VLANClientState nc;
|
||||
+ int rfd;
|
||||
+ struct sockaddr_in sender;
|
||||
+} UDPState;
|
||||
+
|
||||
+static void udp_to_qemu(void *opaque)
|
||||
+{
|
||||
+ UDPState *s = opaque;
|
||||
+ uint8_t buf[4096];
|
||||
+ int size;
|
||||
+
|
||||
+ size = recvfrom(s->rfd, (char *)buf, sizeof(buf), 0, NULL, NULL);
|
||||
+ if (size > 0) {
|
||||
+ qemu_send_packet(&s->nc, buf, size);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static ssize_t udp_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
|
||||
+{
|
||||
+ UDPState *s = DO_UPCAST(UDPState, nc, nc);
|
||||
+ int ret;
|
||||
+
|
||||
+ do {
|
||||
+ ret = sendto(s->rfd, (const char *)buf, size, 0, (struct sockaddr *)&s->sender, sizeof (s->sender));
|
||||
+ } while (ret < 0 && errno == EINTR);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void udp_cleanup(VLANClientState *nc)
|
||||
+{
|
||||
+ UDPState *s = DO_UPCAST(UDPState, nc, nc);
|
||||
+ qemu_set_fd_handler(s->rfd, NULL, NULL, NULL);
|
||||
+ close(s->rfd);
|
||||
+}
|
||||
+
|
||||
+static NetClientInfo net_udp_info = {
|
||||
+ .type = NET_CLIENT_TYPE_UDP,
|
||||
+ .size = sizeof(UDPState),
|
||||
+ .receive = udp_receive,
|
||||
+ .cleanup = udp_cleanup,
|
||||
+};
|
||||
+
|
||||
+static int net_udp_init(VLANState *vlan, const char *model,
|
||||
+ const char *name, int sport,
|
||||
+ const char *daddr, int dport)
|
||||
+{
|
||||
+ VLANClientState *nc;
|
||||
+ UDPState *s;
|
||||
+ struct sockaddr_in receiver;
|
||||
+ int ret;
|
||||
+
|
||||
+ nc = qemu_new_net_client(&net_udp_info, vlan, NULL, model, name);
|
||||
+
|
||||
+ snprintf(nc->info_str, sizeof(nc->info_str),"udp: %i->%s:%i",
|
||||
+ sport, daddr, dport);
|
||||
+
|
||||
+ s = DO_UPCAST(UDPState, nc, nc);
|
||||
+
|
||||
+ s->rfd = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
|
||||
+ receiver.sin_family = AF_INET;
|
||||
+ receiver.sin_addr.s_addr = INADDR_ANY;
|
||||
+ receiver.sin_port = htons(sport);
|
||||
+ ret = bind(s->rfd, (struct sockaddr *)&receiver, sizeof(receiver));
|
||||
+
|
||||
+ if (ret == -1) {
|
||||
+ fprintf (stderr, "bind error:%s\n", strerror(errno));
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ memset((char*)&s->sender, 0,sizeof(s->sender));
|
||||
+ s->sender.sin_family = AF_INET;
|
||||
+ s->sender.sin_port = htons(dport);
|
||||
+ inet_aton(daddr, &s->sender.sin_addr);
|
||||
+
|
||||
+ qemu_set_fd_handler(s->rfd, udp_to_qemu, NULL, s);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int net_init_udp(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan)
|
||||
+{
|
||||
+ const char *daddr;
|
||||
+ int sport, dport;
|
||||
+
|
||||
+ daddr = qemu_opt_get(opts, "daddr");
|
||||
+
|
||||
+ sport = qemu_opt_get_number(opts, "sport", 0);
|
||||
+ dport = qemu_opt_get_number(opts, "dport", 0);
|
||||
+
|
||||
+ if (net_udp_init(vlan, "udp", name, sport, daddr, dport) == -1) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
@ -1,35 +0,0 @@
|
||||
--- qemu-0.14.1/net/udp.h.orig Thu Jun 23 17:12:45 2011
|
||||
+++ qemu-0.14.1/net/udp.h Thu Jun 23 17:12:28 2011
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * QEMU System Emulator
|
||||
+ *
|
||||
+ * Copyright (c) 2003-2008 Fabrice Bellard
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
+ * of this software and associated documentation files (the "Software"), to deal
|
||||
+ * in the Software without restriction, including without limitation the rights
|
||||
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
+ * copies of the Software, and to permit persons to whom the Software is
|
||||
+ * furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be included in
|
||||
+ * all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
+ * THE SOFTWARE.
|
||||
+ */
|
||||
+#ifndef QEMU_NET_UDP_H
|
||||
+#define QEMU_NET_UDP_H
|
||||
+
|
||||
+#include "qemu-common.h"
|
||||
+#include "qemu-option.h"
|
||||
+
|
||||
+int net_init_udp(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan);
|
||||
+
|
||||
+#endif /* QEMU_NET_UDP_H */
|
@ -15,7 +15,7 @@ Index: qemu/hw/dma.c
|
||||
}
|
||||
|
||||
Index: qemu/hw/fdc.c
|
||||
@@ -1322,7 +1322,8 @@
|
||||
@@ -1445,7 +1445,8 @@ static uint32_t fdctrl_read_data(FDCtrl
|
||||
fd_sector(cur_drv));
|
||||
return 0;
|
||||
}
|
||||
@ -25,16 +25,16 @@ Index: qemu/hw/fdc.c
|
||||
FLOPPY_DPRINTF("error getting sector %d\n",
|
||||
fd_sector(cur_drv));
|
||||
/* Sure, image size is too small... */
|
||||
@@ -1776,7 +1777,8 @@
|
||||
@@ -1905,7 +1906,8 @@ static void fdctrl_write_data(FDCtrl *fd
|
||||
if (pos == FD_SECTOR_LEN - 1 ||
|
||||
fdctrl->data_pos == fdctrl->data_len) {
|
||||
cur_drv = get_cur_drv(fdctrl);
|
||||
- if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) {
|
||||
+ if (cur_drv->bs == NULL ||
|
||||
+ bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) {
|
||||
FLOPPY_ERROR("writing sector %d\n", fd_sector(cur_drv));
|
||||
FLOPPY_DPRINTF("error writing sector %d\n",
|
||||
fd_sector(cur_drv));
|
||||
return;
|
||||
}
|
||||
Index: qemu-0.8.2/hw/sb16.c
|
||||
===================================================================
|
||||
--- qemu-0.8.2.orig/hw/sb16.c 2006-07-22 20:23:34.000000000 +0300
|
||||
|
@ -1,5 +1,5 @@
|
||||
Index: qemu/Makefile
|
||||
@@ -40,7 +40,11 @@ LIBS+=-lz $(LIBS_TOOLS)
|
||||
@@ -53,7 +53,11 @@ LIBS+=-lz $(LIBS_TOOLS)
|
||||
HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
|
||||
|
||||
ifdef BUILD_DOCS
|
||||
@ -11,7 +11,7 @@ Index: qemu/Makefile
|
||||
ifdef CONFIG_VIRTFS
|
||||
DOCS+=fsdev/virtfs-proxy-helper.1
|
||||
endif
|
||||
@@ -270,8 +274,10 @@ endif
|
||||
@@ -311,8 +315,10 @@ endif
|
||||
|
||||
install-doc: $(DOCS)
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
|
||||
@ -22,7 +22,7 @@ Index: qemu/Makefile
|
||||
ifdef CONFIG_POSIX
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
|
||||
$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
|
||||
@@ -290,7 +296,10 @@ install-confdir:
|
||||
@@ -331,7 +337,10 @@ install-confdir:
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)"
|
||||
|
||||
install-sysconfig: install-datadir install-confdir
|
||||
@ -31,6 +31,6 @@ Index: qemu/Makefile
|
||||
+ if [ ! -f "$(qemu_confdir)/target-x86_64.conf" ]; then \
|
||||
+ $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(qemu_confdir)"; \
|
||||
+ fi
|
||||
$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/cpus-x86_64.conf "$(DESTDIR)$(qemu_datadir)"
|
||||
|
||||
install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig install-datadir
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
|
||||
|
@ -1,4 +1,4 @@
|
||||
Index: qemu/net.h
|
||||
Index: qemu/include/net/net.h
|
||||
@@ -174,8 +174,8 @@ void net_host_device_remove(Monitor *mon
|
||||
int do_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret_data);
|
||||
int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
|
||||
@ -10,7 +10,7 @@ Index: qemu/net.h
|
||||
#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
|
||||
#define DEFAULT_BRIDGE_INTERFACE "br0"
|
||||
|
||||
Index: qemu/net/tap.h
|
||||
Index: qemu/net/tap_int.h
|
||||
@@ -29,8 +29,8 @@
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-option.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- a/x86_64.ld
|
||||
+++ b/x86_64.ld
|
||||
--- a/ldscripts/x86_64.ld
|
||||
+++ b/ldscripts/x86_64.ld
|
||||
@@ -1,54 +1,58 @@
|
||||
-/* Default linker script, for normal executables */
|
||||
-OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
|
||||
@ -256,8 +256,8 @@
|
||||
+ .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
|
||||
+ /DISCARD/ : { *(.note.GNU-stack) }
|
||||
}
|
||||
--- a/i386.ld
|
||||
+++ b/i386.ld
|
||||
--- a/ldscripts/i386.ld
|
||||
+++ b/ldscripts/i386.ld
|
||||
@@ -1,45 +1,47 @@
|
||||
-/* ld script to make i386 Linux kernel
|
||||
- * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
|
||||
|
31
emulators/qemu-devel/files/patch-bsd-user-qemu.h
Normal file
31
emulators/qemu-devel/files/patch-bsd-user-qemu.h
Normal file
@ -0,0 +1,31 @@
|
||||
--- a/bsd-user/qemu.h
|
||||
+++ b/bsd-user/qemu.h
|
||||
@@ -50,6 +50,10 @@ struct image_info {
|
||||
abi_ulong entry;
|
||||
abi_ulong code_offset;
|
||||
abi_ulong data_offset;
|
||||
+#if 1
|
||||
+ abi_ulong arg_start;
|
||||
+ abi_ulong arg_end;
|
||||
+#endif
|
||||
int personality;
|
||||
};
|
||||
|
||||
@@ -72,6 +76,17 @@ struct emulated_sigtable {
|
||||
typedef struct TaskState {
|
||||
struct TaskState *next;
|
||||
int used; /* non zero if used */
|
||||
+#if 1
|
||||
+#ifdef TARGET_ARM
|
||||
+ int swi_errno;
|
||||
+#endif
|
||||
+#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
|
||||
+ /* Extra fields for semihosted binaries. */
|
||||
+ uint32_t heap_base;
|
||||
+ uint32_t heap_limit;
|
||||
+#endif
|
||||
+ uint32_t stack_base;
|
||||
+#endif
|
||||
struct image_info *info;
|
||||
|
||||
struct emulated_sigtable sigtab[TARGET_NSIG];
|
@ -1,133 +0,0 @@
|
||||
Message-ID: <4FC741F1.4000905@redhat.com>
|
||||
Date: Thu, 31 May 2012 12:03:29 +0200
|
||||
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||
To: Jan Kiszka <jan.kiszka@web.de>
|
||||
References: <20120530202311.GA1768@onelab2.iet.unipi.it>
|
||||
<20120530212333.GD2672@onelab2.iet.unipi.it>
|
||||
<4FC69389.8050404@web.de>
|
||||
<CA+hQ2+g-2FdgWnqZUh1-oTZkziq8CTNJ5SeA+aCW32FFF=zi4A@mail.gmail.com>
|
||||
<4FC69B28.1000106@web.de>
|
||||
<CA+hQ2+gA5hZ2Zk-kwPNDVcguBsu2UfNiLxs84MgqBUK_MQuC4g@mail.gmail.com>
|
||||
<4FC71FEB.9030100@redhat.com> <4FC72A95.4040808@web.de>
|
||||
In-Reply-To: <4FC72A95.4040808@web.de>
|
||||
Cc: Luigi Rizzo <rizzo.unipi@gmail.com>, rizzo@iet.unipi.it,
|
||||
qemu-devel@nongnu.org,
|
||||
Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
|
||||
Subject: Re: [Qemu-devel] Proposed patch: huge RX speedup for hw/e1000.c
|
||||
|
||||
Il 31/05/2012 10:23, Jan Kiszka ha scritto:
|
||||
>> > @@ -922,6 +923,7 @@ set_rdt(E1000State *s, int index, uint32_t val)
|
||||
>> > {
|
||||
>> > s->check_rxov = 0;
|
||||
>> > s->mac_reg[index] = val & 0xffff;
|
||||
>> > + qemu_notify_event();
|
||||
> This still looks like the wrong tool: Packets that can't be delivered
|
||||
> are queued.
|
||||
|
||||
Packets that are read from the tap but can't be delivered are queued;
|
||||
packets that are left on the tap need qemu_notify_event to be flushed.
|
||||
|
||||
> So we need to flush the queue and clear the blocked delivery
|
||||
> there. qemu_flush_queued_packets appears more appropriate for this.
|
||||
|
||||
Right, and qemu_flush_queued_packets needs to call qemu_notify_event
|
||||
which makes the call in virtio-net unnecessary.
|
||||
|
||||
Paolo
|
||||
|
||||
diff --git a/hw/e1000.c b/hw/e1000.c
|
||||
index 4573f13..43d933a 100644
|
||||
--- a/hw/e1000.c
|
||||
+++ b/hw/e1000.c
|
||||
@@ -295,6 +295,7 @@ set_rx_control(E1000State *s, int index, uint32_t val)
|
||||
s->rxbuf_min_shift = ((val / E1000_RCTL_RDMTS_QUAT) & 3) + 1;
|
||||
DBGOUT(RX, "RCTL: %d, mac_reg[RCTL] = 0x%x\n", s->mac_reg[RDT],
|
||||
s->mac_reg[RCTL]);
|
||||
+ qemu_flush_queued_packets(&s->nic->nc);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -926,6 +927,9 @@ set_rdt(E1000State *s, int index, uint32_t val)
|
||||
{
|
||||
s->check_rxov = 0;
|
||||
s->mac_reg[index] = val & 0xffff;
|
||||
+ if (e1000_has_rxbufs(s, 1)) {
|
||||
+ qemu_flush_queued_packets(&s->nic->nc);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
|
||||
index 3f190d4..0974945 100644
|
||||
--- a/hw/virtio-net.c
|
||||
+++ b/hw/virtio-net.c
|
||||
@@ -447,10 +447,6 @@ static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
|
||||
VirtIONet *n = to_virtio_net(vdev);
|
||||
|
||||
qemu_flush_queued_packets(&n->nic->nc);
|
||||
-
|
||||
- /* We now have RX buffers, signal to the IO thread to break out of the
|
||||
- * select to re-poll the tap file descriptor */
|
||||
- qemu_notify_event();
|
||||
}
|
||||
|
||||
static int virtio_net_can_receive(VLANClientState *nc)
|
||||
diff --git a/net.c b/net.c
|
||||
index 1922d8a..fa846ae 100644
|
||||
--- a/net.c
|
||||
+++ b/net.c
|
||||
@@ -491,7 +491,12 @@ void qemu_flush_queued_packets(VLANClientState *vc)
|
||||
queue = vc->send_queue;
|
||||
}
|
||||
|
||||
- qemu_net_queue_flush(queue);
|
||||
+ if (qemu_net_queue_flush(queue)) {
|
||||
+ /* We emptied the queue successfully, signal to the IO thread to repoll
|
||||
+ * the file descriptor (for tap, for example).
|
||||
+ */
|
||||
+ qemu_notify_event();
|
||||
+ }
|
||||
}
|
||||
|
||||
static ssize_t qemu_send_packet_async_with_flags(VLANClientState *sender,
|
||||
diff --git a/net/queue.c b/net/queue.c
|
||||
index 1ab5247..fd1c7e6 100644
|
||||
--- a/net/queue.c
|
||||
+++ b/net/queue.c
|
||||
@@ -232,7 +232,7 @@ void qemu_net_queue_purge(NetQueue *queue, VLANClientState *from)
|
||||
}
|
||||
}
|
||||
|
||||
-void qemu_net_queue_flush(NetQueue *queue)
|
||||
+bool qemu_net_queue_flush(NetQueue *queue)
|
||||
{
|
||||
while (!QTAILQ_EMPTY(&queue->packets)) {
|
||||
NetPacket *packet;
|
||||
@@ -248,7 +248,7 @@ void qemu_net_queue_flush(NetQueue *queue)
|
||||
packet->size);
|
||||
if (ret == 0) {
|
||||
QTAILQ_INSERT_HEAD(&queue->packets, packet, entry);
|
||||
- break;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
if (packet->sent_cb) {
|
||||
@@ -257,4 +257,5 @@ void qemu_net_queue_flush(NetQueue *queue)
|
||||
|
||||
g_free(packet);
|
||||
}
|
||||
+ return 1;
|
||||
}
|
||||
diff --git a/net/queue.h b/net/queue.h
|
||||
index a31958e..4bf6d3c 100644
|
||||
--- a/net/queue.h
|
||||
+++ b/net/queue.h
|
||||
@@ -66,6 +66,6 @@ ssize_t qemu_net_queue_send_iov(NetQueue *queue,
|
||||
NetPacketSent *sent_cb);
|
||||
|
||||
void qemu_net_queue_purge(NetQueue *queue, VLANClientState *from);
|
||||
-void qemu_net_queue_flush(NetQueue *queue);
|
||||
+bool qemu_net_queue_flush(NetQueue *queue);
|
||||
|
||||
#endif /* QEMU_NET_QUEUE_H */
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- a/hw/ppc_newworld.c
|
||||
+++ b/hw/ppc_newworld.c
|
||||
--- a/hw/ppc/mac_newworld.c
|
||||
+++ b/hw/ppc/mac_newworld.c
|
||||
@@ -68,6 +68,11 @@
|
||||
#include "hw/usb.h"
|
||||
#include "blockdev.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- a/hw/ppc_oldworld.c
|
||||
+++ b/hw/ppc_oldworld.c
|
||||
--- a/hw/ppc/mac_oldworld.c
|
||||
+++ b/hw/ppc/mac_oldworld.c
|
||||
@@ -47,6 +47,11 @@
|
||||
#define MAX_IDE_BUS 2
|
||||
#define CFG_ADDR 0xf0000510
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- a/ppc.ld
|
||||
+++ b/ppc.ld
|
||||
--- a/ldscripts/ppc.ld
|
||||
+++ b/ldscripts/ppc.ld
|
||||
@@ -99,7 +99,7 @@ SECTIONS
|
||||
PROVIDE (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
|
@ -1,13 +1,13 @@
|
||||
Index: qemu/net/tap.c
|
||||
@@ -287,12 +287,13 @@ static void tap_cleanup(VLANClientState
|
||||
@@ -286,12 +286,13 @@ static void tap_cleanup(NetClientState *
|
||||
|
||||
qemu_purge_queued_packets(nc);
|
||||
|
||||
- if (s->down_script[0])
|
||||
- launch_script(s->down_script, s->down_script_arg, s->fd);
|
||||
-
|
||||
tap_read_poll(s, 0);
|
||||
tap_write_poll(s, 0);
|
||||
tap_read_poll(s, false);
|
||||
tap_write_poll(s, false);
|
||||
close(s->fd);
|
||||
+
|
||||
+ if (s->down_script[0])
|
||||
|
@ -289,6 +289,18 @@
|
||||
#endif
|
||||
--- a/bsd-user/syscall.c.orig
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -96,6 +96,11 @@ static abi_long do_obreak(abi_ulong new_
|
||||
return 0;
|
||||
}
|
||||
|
||||
+abi_long do_brk(abi_ulong new_brk)
|
||||
+{
|
||||
+ return do_obreak(new_brk);
|
||||
+}
|
||||
+
|
||||
#if defined(TARGET_I386)
|
||||
static abi_long do_freebsd_sysarch(CPUX86State *env, int op, abi_ulong parms)
|
||||
{
|
||||
@@ -157,6 +161,12 @@ static abi_long do_freebsd_sysarch(void
|
||||
}
|
||||
#endif
|
||||
|
8355
emulators/qemu-devel/files/patch-z2-bsd-user-cognet-sson-002
Normal file
8355
emulators/qemu-devel/files/patch-z2-bsd-user-cognet-sson-002
Normal file
File diff suppressed because it is too large
Load Diff
217
emulators/qemu-devel/files/patch-z2b-bsd-user-sson-002b
Normal file
217
emulators/qemu-devel/files/patch-z2b-bsd-user-sson-002b
Normal file
@ -0,0 +1,217 @@
|
||||
diff --git a/bsd-user/signal.c b/bsd-user/signal.c
|
||||
index 0502a6a..52441c4 100644
|
||||
--- a/bsd-user/signal.c
|
||||
+++ b/bsd-user/signal.c
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "qemu.h"
|
||||
#include "target_signal.h"
|
||||
|
||||
-// #define DEBUG_SIGNAL
|
||||
+//#define DEBUG_SIGNAL
|
||||
|
||||
#ifndef _NSIG
|
||||
#define _NSIG 128
|
||||
@@ -441,7 +441,7 @@ host_signal_handler(int host_signum, siginfo_t *info, void *puc)
|
||||
* we forward to it some signals.
|
||||
*/
|
||||
if ((host_signum == SIGSEGV || host_signum == SIGBUS) &&
|
||||
- info->si_code > 0) {
|
||||
+ info->si_code < 0x10000) {
|
||||
if (cpu_signal_handler(host_signum, info, puc))
|
||||
return;
|
||||
}
|
||||
@@ -1099,6 +1099,7 @@ signal_init(void)
|
||||
|
||||
sigfillset(&act.sa_mask);
|
||||
act.sa_sigaction = host_signal_handler;
|
||||
+ act.sa_flags = SA_SIGINFO;
|
||||
|
||||
for (i = 1; i <= TARGET_NSIG; i++) {
|
||||
host_sig = target_to_host_signal(i);
|
||||
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
|
||||
index c627c62..625c3cf 100644
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -3544,6 +3544,30 @@ do_stat:
|
||||
}
|
||||
break;
|
||||
|
||||
+#ifdef TARGET_FREEBSD_NR_pdwait4
|
||||
+ case TARGET_FREEBSD_NR_pdwait4:
|
||||
+ {
|
||||
+ int status;
|
||||
+ abi_long status_ptr = arg2;
|
||||
+ struct rusage rusage, *rusage_ptr;
|
||||
+ abi_long target_rusage = arg4;
|
||||
+
|
||||
+ if (target_rusage)
|
||||
+ rusage_ptr = &rusage;
|
||||
+ else
|
||||
+ rusage_ptr = NULL;
|
||||
+ ret = get_errno(wait4(arg1, &status, arg3, rusage_ptr));
|
||||
+ if (!is_error(ret)) {
|
||||
+ status = host_to_target_waitstatus(status);
|
||||
+ if (put_user_s32(status, status_ptr))
|
||||
+ goto efault;
|
||||
+ if (target_rusage)
|
||||
+ host_to_target_rusage(target_rusage, &rusage);
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+#endif /* TARGET_FREEBSD_NR_pdwait4 */
|
||||
+
|
||||
case TARGET_FREEBSD_NR_accept:
|
||||
ret = do_accept(arg1, arg2, arg3);
|
||||
break;
|
||||
@@ -3803,6 +3827,20 @@ do_stat:
|
||||
break;
|
||||
#endif
|
||||
|
||||
+ case TARGET_FREEBSD_NR_pdkill:
|
||||
+ ret = get_errno(pdkill(arg1, target_to_host_signal(arg2)));
|
||||
+ break;
|
||||
+
|
||||
+ case TARGET_FREEBSD_NR_pdgetpid:
|
||||
+ {
|
||||
+ pid_t pid;
|
||||
+
|
||||
+ ret = get_errno(pdgetpid(arg1, &pid));
|
||||
+ if (put_user_u32(pid, arg2))
|
||||
+ goto efault;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
case TARGET_FREEBSD_NR_sigaction:
|
||||
{
|
||||
struct target_sigaction *old_act, act, oact, *pact;
|
||||
@@ -4014,27 +4052,88 @@ do_stat:
|
||||
|
||||
#ifdef TARGET_FREEBSD_NR_aio_read
|
||||
case TARGET_FREEBSD_NR_aio_read:
|
||||
+ ret = unimplemented(num);
|
||||
+ break;
|
||||
#endif
|
||||
#ifdef TARGET_FREEBSD_NR_aio_write
|
||||
case TARGET_FREEBSD_NR_aio_write:
|
||||
+ ret = unimplemented(num);
|
||||
+ break;
|
||||
#endif
|
||||
#ifdef TARGET_FREEBSD_NR_aio_return
|
||||
case TARGET_FREEBSD_NR_aio_return:
|
||||
+ ret = unimplemented(num);
|
||||
+ break;
|
||||
#endif
|
||||
#ifdef TARGET_FREEBSD_NR_aio_suspend
|
||||
case TARGET_FREEBSD_NR_aio_suspend:
|
||||
+ ret = unimplemented(num);
|
||||
+ break;
|
||||
#endif
|
||||
#ifdef TARGET_FREEBSD_NR_aio_cancel
|
||||
case TARGET_FREEBSD_NR_aio_cancel:
|
||||
+ ret = unimplemented(num);
|
||||
+ break;
|
||||
#endif
|
||||
#ifdef TARGET_FREEBSD_NR_aio_error
|
||||
case TARGET_FREEBSD_NR_aio_error:
|
||||
+ ret = unimplemented(num);
|
||||
+ break;
|
||||
#endif
|
||||
#ifdef TARGET_FREEBSD_NR_aio_waitcomplete
|
||||
case TARGET_FREEBSD_NR_aio_waitcomplete:
|
||||
+ ret = unimplemented(num);
|
||||
+ break;
|
||||
#endif
|
||||
#ifdef TARGET_FREEBSD_NR_lio_listio
|
||||
case TARGET_FREEBSD_NR_lio_listio:
|
||||
+ ret = unimplemented(num);
|
||||
+ break;
|
||||
+#endif
|
||||
+
|
||||
+#if 0 /* XXX not supported in libc yet, it seems (10.0 addition). */
|
||||
+ case TARGET_FREEBSD_NR_posix_fadvise:
|
||||
+ {
|
||||
+ off_t offset = arg2, len = arg3;
|
||||
+ int advice = arg4;
|
||||
+
|
||||
+#if TARGET_ABI_BITS == 32
|
||||
+ if (regpairs_aligned(cpu_env)) {
|
||||
+ offset = target_offset64(arg3, arg4);
|
||||
+ len = target_offset64(arg5, arg6);
|
||||
+ advice = arg7;
|
||||
+ } else {
|
||||
+ offset = target_offset64(arg2, arg3);
|
||||
+ len = target_offset64(arg4, arg5);
|
||||
+ advice = arg6;
|
||||
+ }
|
||||
+#endif
|
||||
+ ret = get_errno(posix_fadvise(arg1, offset, len, advice));
|
||||
+ }
|
||||
+ break;
|
||||
+#endif
|
||||
+
|
||||
+ case TARGET_FREEBSD_NR_posix_fallocate:
|
||||
+ {
|
||||
+ off_t offset = arg2, len = arg3;
|
||||
+
|
||||
+#if TARGET_ABI_BITS == 32
|
||||
+ if (regpairs_aligned(cpu_env)) {
|
||||
+ offset = target_offset64(arg3, arg4);
|
||||
+ len = target_offset64(arg5, arg6);
|
||||
+ } else {
|
||||
+ offset = target_offset64(arg2, arg3);
|
||||
+ len = target_offset64(arg4, arg5);
|
||||
+ }
|
||||
+#endif
|
||||
+ ret = get_errno(posix_fallocate(arg1, offset, len));
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+#ifdef TARGET_FREEBSD_posix_openpt
|
||||
+ case TARGET_FREEBSD_posix_openpt:
|
||||
+ ret = get_errno(posix_openpt(arg1));
|
||||
+ break;
|
||||
#endif
|
||||
|
||||
case TARGET_FREEBSD_NR_yield:
|
||||
@@ -4054,9 +4153,6 @@ do_stat:
|
||||
case TARGET_FREEBSD_NR_swapon:
|
||||
case TARGET_FREEBSD_NR_swapoff:
|
||||
|
||||
- case TARGET_FREEBSD_NR_pdkill:
|
||||
- case TARGET_FREEBSD_NR_pdgetpid:
|
||||
-
|
||||
case TARGET_FREEBSD_NR_thr_create:
|
||||
case TARGET_FREEBSD_NR_thr_exit:
|
||||
case TARGET_FREEBSD_NR_thr_self:
|
||||
@@ -4080,9 +4176,6 @@ do_stat:
|
||||
case TARGET_FREEBSD_NR__umtx_lock:
|
||||
case TARGET_FREEBSD_NR__umtx_unlock:
|
||||
|
||||
- case TARGET_FREEBSD_NR_posix_fadvise:
|
||||
- case TARGET_FREEBSD_NR_posix_fallocate:
|
||||
-
|
||||
case TARGET_FREEBSD_NR_rctl_get_racct:
|
||||
case TARGET_FREEBSD_NR_rctl_get_rules:
|
||||
case TARGET_FREEBSD_NR_rctl_add_rule:
|
||||
diff --git a/user-exec.c b/user-exec.c
|
||||
index 9ad4858..bf29e84 100644
|
||||
--- a/user-exec.c
|
||||
+++ b/user-exec.c
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <sys/ucontext.h>
|
||||
#endif
|
||||
|
||||
-#define DEBUG_SIGNAL
|
||||
+//#define DEBUG_SIGNAL
|
||||
|
||||
static void exception_action(CPUArchState *env1)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
|
||||
}
|
||||
#endif
|
||||
#if defined(DEBUG_SIGNAL)
|
||||
- qemu_printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
|
||||
+ qemu_printf("qemu: SIGSEGV pc=0x%08lx address=0x%08lx w=%d oldset=0x%08lx\n",
|
||||
pc, address, is_write, *(unsigned long *)old_set);
|
||||
#endif
|
||||
/* XXX: locking issue */
|
2301
emulators/qemu-devel/files/patch-z2c-bsd-user-sson-002c
Normal file
2301
emulators/qemu-devel/files/patch-z2c-bsd-user-sson-002c
Normal file
File diff suppressed because it is too large
Load Diff
30
emulators/qemu-devel/files/patch-z2d-bsd-user-sson-002d
Normal file
30
emulators/qemu-devel/files/patch-z2d-bsd-user-sson-002d
Normal file
@ -0,0 +1,30 @@
|
||||
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
|
||||
index 4deb0db..bde9ee9 100644
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -2377,7 +2377,7 @@ do_thr_exit(CPUArchState *cpu_env, abi_ulong tid_addr)
|
||||
|
||||
if (tid_addr) {
|
||||
/* Signal target userland that it can free the stack. */
|
||||
- if (! put_user_u32(1, tid_addr))
|
||||
+ if (! put_user_sal(1, tid_addr))
|
||||
_umtx_op(g2h(tid_addr), UMTX_OP_WAKE, INT_MAX,
|
||||
NULL, NULL);
|
||||
}
|
||||
@@ -4588,10 +4588,13 @@ do_stat:
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
- if (target_to_host_timespec(&ts, arg1))
|
||||
- goto efault;
|
||||
+ if (arg1) {
|
||||
+ if (target_to_host_timespec(&ts, arg1))
|
||||
+ goto efault;
|
||||
+ ret = do_thr_suspend(&ts);
|
||||
+ } else
|
||||
+ ret = do_thr_suspend(NULL);
|
||||
|
||||
- ret = do_thr_suspend(&ts);
|
||||
}
|
||||
break;
|
||||
|
3316
emulators/qemu-devel/files/patch-z2e-bsd-user-sson-002e
Normal file
3316
emulators/qemu-devel/files/patch-z2e-bsd-user-sson-002e
Normal file
File diff suppressed because it is too large
Load Diff
61
emulators/qemu-devel/files/patch-z3-bsd-user-8fix
Normal file
61
emulators/qemu-devel/files/patch-z3-bsd-user-8fix
Normal file
@ -0,0 +1,61 @@
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -17,6 +17,18 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
+
|
||||
+#if defined(__FreeBSD__)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version < 900000
|
||||
+#define st_atim st_atimespec
|
||||
+#define st_ctim st_ctimespec
|
||||
+#define st_mtim st_mtimespec
|
||||
+#define st_birthtim st_birthtimespec
|
||||
+#endif
|
||||
+
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -1519,9 +1533,11 @@ do_setsockopt(int sockfd, int level, int
|
||||
optname = SO_ERROR;
|
||||
break;
|
||||
|
||||
+#ifdef SO_USER_COOKIE
|
||||
case TARGET_SO_USER_COOKIE:
|
||||
optname = SO_USER_COOKIE;
|
||||
break;
|
||||
+#endif
|
||||
|
||||
default:
|
||||
goto unimplemented;
|
||||
@@ -2091,9 +2107,11 @@ do_fork(CPUArchState *env, int num, int
|
||||
ret = rfork(flags);
|
||||
break;
|
||||
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
case TARGET_FREEBSD_NR_pdfork:
|
||||
ret = pdfork(&fd, flags);
|
||||
break;
|
||||
+#endif
|
||||
|
||||
default:
|
||||
ret = -TARGET_ENOSYS;
|
||||
@@ -3499,6 +3517,7 @@ do_stat:
|
||||
unlock_user(p, arg1, 0);
|
||||
break;
|
||||
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
case TARGET_FREEBSD_NR_setloginclass:
|
||||
if (!(p = lock_user_string(arg1)))
|
||||
goto efault;
|
||||
@@ -3512,6 +3531,7 @@ do_stat:
|
||||
ret = get_errno(getloginclass(p, arg2));
|
||||
unlock_user(p, arg1, 0);
|
||||
break;
|
||||
+#endif
|
||||
|
||||
case TARGET_FREEBSD_NR_getrusage:
|
||||
{
|
34
emulators/qemu-devel/files/patch-z3b-bsd-user-8fix
Normal file
34
emulators/qemu-devel/files/patch-z3b-bsd-user-8fix
Normal file
@ -0,0 +1,34 @@
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -3890,6 +3890,7 @@ do_stat:
|
||||
break;
|
||||
#endif
|
||||
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
case TARGET_FREEBSD_NR_pdkill:
|
||||
ret = get_errno(pdkill(arg1, target_to_host_signal(arg2)));
|
||||
break;
|
||||
@@ -3903,6 +3904,7 @@ do_stat:
|
||||
goto efault;
|
||||
}
|
||||
break;
|
||||
+#endif
|
||||
|
||||
case TARGET_FREEBSD_NR_sigaction:
|
||||
{
|
||||
@@ -4176,6 +4178,7 @@ do_stat:
|
||||
break;
|
||||
#endif
|
||||
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
case TARGET_FREEBSD_NR_posix_fallocate:
|
||||
{
|
||||
off_t offset = arg2, len = arg3;
|
||||
@@ -4192,6 +4195,7 @@ do_stat:
|
||||
ret = get_errno(posix_fallocate(arg1, offset, len));
|
||||
}
|
||||
break;
|
||||
+#endif
|
||||
|
||||
#ifdef TARGET_FREEBSD_posix_openpt
|
||||
case TARGET_FREEBSD_posix_openpt:
|
12
emulators/qemu-devel/files/patch-z3c-bsd-user-8fix
Normal file
12
emulators/qemu-devel/files/patch-z3c-bsd-user-8fix
Normal file
@ -0,0 +1,12 @@
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -54,7 +54,9 @@
|
||||
#include <sys/socket.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/regression.h>
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
#include <sys/procdesc.h>
|
||||
+#endif
|
||||
#include <sys/ucontext.h>
|
||||
#include <sys/thr.h>
|
||||
#include <sys/rtprio.h>
|
47
emulators/qemu-devel/files/patch-z3d-bsd-user-8fix
Normal file
47
emulators/qemu-devel/files/patch-z3d-bsd-user-8fix
Normal file
@ -0,0 +1,47 @@
|
||||
--- qemu-1.4.0/bsd-user/syscall.c.orig
|
||||
+++ qemu-1.4.0/bsd-user/syscall.c
|
||||
@@ -62,7 +62,11 @@
|
||||
#include <sys/rtprio.h>
|
||||
#include <sys/umtx.h>
|
||||
#include <sys/uuid.h>
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
#include <sys/_termios.h>
|
||||
+#else
|
||||
+#include <sys/termios.h>
|
||||
+#endif
|
||||
#include <sys/ttycom.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/timex.h>
|
||||
@@ -6383,6 +6387,7 @@ abi_long do_freebsd_syscall(void *cpu_en
|
||||
val, NULL, NULL));
|
||||
break;
|
||||
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
case TARGET_UMTX_OP_NWAKE_PRIVATE:
|
||||
if (! access_ok(VERIFY_READ, obj,
|
||||
val * sizeof(uint32_t)))
|
||||
@@ -6390,7 +6395,7 @@ abi_long do_freebsd_syscall(void *cpu_en
|
||||
ret = get_errno(_umtx_op(g2h(obj), UMTX_OP_NWAKE_PRIVATE,
|
||||
val, NULL, NULL));
|
||||
break;
|
||||
-
|
||||
+#endif
|
||||
|
||||
case TARGET_UMTX_OP_RW_RDLOCK:
|
||||
if (target_ts) {
|
||||
@@ -6425,6 +6430,7 @@ abi_long do_freebsd_syscall(void *cpu_en
|
||||
break;
|
||||
#endif
|
||||
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
case TARGET_UMTX_OP_SEM_WAIT:
|
||||
/* XXX Assumes struct _usem is opauque to the user */
|
||||
if (! access_ok(VERIFY_WRITE, obj,
|
||||
@@ -6447,6 +6453,7 @@ abi_long do_freebsd_syscall(void *cpu_en
|
||||
ret = get_errno(_umtx_op(g2h(obj), UMTX_OP_SEM_WAKE,
|
||||
val, NULL, NULL));
|
||||
break;
|
||||
+#endif
|
||||
|
||||
default:
|
||||
ret = -TARGET_EINVAL;
|
26
emulators/qemu-devel/files/patch-z4-bsd-user-elfload
Normal file
26
emulators/qemu-devel/files/patch-z4-bsd-user-elfload
Normal file
@ -0,0 +1,26 @@
|
||||
--- a/bsd-user/elfload.c
|
||||
+++ b/bsd-user/elfload.c
|
||||
@@ -812,8 +812,9 @@ static abi_ulong setup_arg_pages(abi_ulo
|
||||
* Add argv strings. Note that the argv[] vectors are added by
|
||||
* loader_build_argptr()
|
||||
*/
|
||||
- i = bprm->argc;
|
||||
- while (i-- > 0) {
|
||||
+ // i = bprm->argc;
|
||||
+ // while (i-- > 0) {
|
||||
+ for (i = 0; i < bprm->argc; ++i) {
|
||||
size_t len = strlen(bprm->argv[i]) + 1;
|
||||
/* XXX - check return value of memcpy_to_target(). */
|
||||
memcpy_to_target(destp, bprm->argv[i], len);
|
||||
@@ -826,8 +827,9 @@ static abi_ulong setup_arg_pages(abi_ulo
|
||||
* Add env strings. Note that the envp[] vectors are added by
|
||||
* loader_build_argptr().
|
||||
*/
|
||||
- i = bprm->envc;
|
||||
- while(i-- > 0) {
|
||||
+ // i = bprm->envc;
|
||||
+ // while(i-- > 0) {
|
||||
+ for (i = 0; i < bprm->envc; ++i) {
|
||||
size_t len = strlen(bprm->envp[i]) + 1;
|
||||
/* XXX - check return value of memcpy_to_target(). */
|
||||
memcpy_to_target(destp, bprm->envp[i], len);
|
18
emulators/qemu-devel/files/patch-z6-bsd-user-usrstack1
Normal file
18
emulators/qemu-devel/files/patch-z6-bsd-user-usrstack1
Normal file
@ -0,0 +1,18 @@
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -377,6 +377,15 @@ static abi_long do_freebsd_sysctl(abi_ul
|
||||
*q++ = tswap32(*p);
|
||||
oidfmt(snamep, namelen, NULL, &kind);
|
||||
/* XXX swap hnewp */
|
||||
+#if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32
|
||||
+ /* XXX there may be more sysctls that differ */
|
||||
+ if (namelen == 2 &&
|
||||
+ snamep[0] == CTL_KERN && snamep[1] == KERN_USRSTACK &&
|
||||
+ holdlen && holdlen == 4 && hnewp == NULL) {
|
||||
+ (*(uint32_t *)holdp) = 0xfffff000U;
|
||||
+ ret = 0;
|
||||
+ } else
|
||||
+#endif
|
||||
ret = get_errno(sysctl(snamep, namelen, holdp, &holdlen, hnewp, newlen));
|
||||
if (!ret)
|
||||
sysctl_oldcvt(holdp, holdlen, kind);
|
171
emulators/qemu-devel/files/patch-z7-bsd-user-tls1-cognet
Normal file
171
emulators/qemu-devel/files/patch-z7-bsd-user-tls1-cognet
Normal file
@ -0,0 +1,171 @@
|
||||
--- oldqemu-1.3.0/bsd-user/syscall.c 2012-12-13 23:51:09.000000000 +0100
|
||||
+++ qemu-1.3.0/bsd-user/syscall.c 2012-12-13 23:46:55.000000000 +0100
|
||||
@@ -258,6 +258,16 @@ static abi_long do_freebsd_sysarch(void
|
||||
#ifdef TARGET_ARM
|
||||
static abi_long do_freebsd_sysarch(void *env, int op, abi_ulong parms)
|
||||
{
|
||||
+ abi_ulong val;
|
||||
+
|
||||
+ switch (op) {
|
||||
+ case TARGET_FREEBSD_ARM_SET_TP:
|
||||
+ if (get_user(val, parms, abi_ulong))
|
||||
+ return -TARGET_EINVAL;
|
||||
+ cpu_set_tls(env, val);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
return -TARGET_EINVAL;
|
||||
}
|
||||
#endif
|
||||
--- oldqemu-1.3.0/bsd-user/elfload.c 2012-12-13 23:51:09.000000000 +0100
|
||||
+++ qemu-1.3.0/bsd-user/elfload.c 2012-12-13 23:50:14.000000000 +0100
|
||||
@@ -948,10 +948,8 @@ static abi_ulong create_elf_tables(abi_u
|
||||
* Force 16 byte _final_ alignment here for generality.
|
||||
*/
|
||||
sp = sp &~ (abi_ulong)15;
|
||||
-#ifdef __FreeBSD__
|
||||
- size = 0;
|
||||
-#else
|
||||
size = (DLINFO_ITEMS + 1) * 2;
|
||||
+#ifndef __FreeBSD__
|
||||
if (k_platform)
|
||||
size += 2;
|
||||
#ifdef DLINFO_ARCH_ITEMS
|
||||
@@ -964,7 +962,6 @@ static abi_ulong create_elf_tables(abi_u
|
||||
if (size & 15)
|
||||
sp -= 16 - (size & 15);
|
||||
|
||||
-#ifndef __FreeBSD__
|
||||
/* This is correct because Linux defines
|
||||
* elf_addr_t as Elf32_Off / Elf64_Off
|
||||
*/
|
||||
@@ -989,8 +986,10 @@ static abi_ulong create_elf_tables(abi_u
|
||||
NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid());
|
||||
NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
|
||||
NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK));
|
||||
+#ifndef __FreeBSD__
|
||||
if (k_platform)
|
||||
NEW_AUX_ENT(AT_PLATFORM, u_platform);
|
||||
+#endif
|
||||
#ifdef ARCH_DLINFO
|
||||
/*
|
||||
* ARCH_DLINFO must come last so platform specific code can enforce
|
||||
@@ -999,7 +998,6 @@ static abi_ulong create_elf_tables(abi_u
|
||||
ARCH_DLINFO;
|
||||
#endif
|
||||
#undef NEW_AUX_ENT
|
||||
-#endif /* ! __FreeBSD__ */
|
||||
|
||||
sp = loader_build_argptr(envc, argc, sp, p, !ibcs);
|
||||
return sp;
|
||||
--- oldqemu-1.3.0/bsd-user/main.c 2012-12-13 23:51:09.000000000 +0100
|
||||
+++ qemu-1.3.0/bsd-user/main.c 2012-12-13 23:01:30.000000000 +0100
|
||||
@@ -392,6 +392,84 @@ void cpu_loop(CPUX86State *env)
|
||||
#ifdef TARGET_ARM
|
||||
// #define DEBUG_ARM
|
||||
|
||||
+static int do_strex(CPUARMState *env)
|
||||
+{
|
||||
+ uint32_t val;
|
||||
+ int size;
|
||||
+ int rc = 1;
|
||||
+ int segv = 0;
|
||||
+ uint32_t addr;
|
||||
+ start_exclusive();
|
||||
+ addr = env->exclusive_addr;
|
||||
+ if (addr != env->exclusive_test) {
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ size = env->exclusive_info & 0xf;
|
||||
+ switch (size) {
|
||||
+ case 0:
|
||||
+ segv = get_user_u8(val, addr);
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ segv = get_user_u16(val, addr);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ case 3:
|
||||
+ segv = get_user_u32(val, addr);
|
||||
+ break;
|
||||
+ default:
|
||||
+ abort();
|
||||
+ }
|
||||
+ if (segv) {
|
||||
+ env->cp15.c6_data = addr;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ if (val != env->exclusive_val) {
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ if (size == 3) {
|
||||
+ segv = get_user_u32(val, addr + 4);
|
||||
+ if (segv) {
|
||||
+ env->cp15.c6_data = addr + 4;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ if (val != env->exclusive_high) {
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ val = env->regs[(env->exclusive_info >> 8) & 0xf];
|
||||
+ switch (size) {
|
||||
+ case 0:
|
||||
+ segv = put_user_u8(val, addr);
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ segv = put_user_u16(val, addr);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ case 3:
|
||||
+ segv = put_user_u32(val, addr);
|
||||
+ break;
|
||||
+ }
|
||||
+ if (segv) {
|
||||
+ env->cp15.c6_data = addr;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ if (size == 3) {
|
||||
+ val = env->regs[(env->exclusive_info >> 12) & 0xf];
|
||||
+ segv = put_user_u32(val, addr + 4);
|
||||
+ if (segv) {
|
||||
+ env->cp15.c6_data = addr + 4;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ }
|
||||
+ rc = 0;
|
||||
+fail:
|
||||
+ env->regs[15] += 4;
|
||||
+ env->regs[(env->exclusive_info >> 4) & 0xf] = rc;
|
||||
+done:
|
||||
+ end_exclusive();
|
||||
+ return segv;
|
||||
+}
|
||||
+
|
||||
void cpu_loop(CPUARMState *env)
|
||||
{
|
||||
int trapnr;
|
||||
@@ -622,6 +700,7 @@ void cpu_loop(CPUARMState *env)
|
||||
if (do_kernel_trap(env))
|
||||
goto error;
|
||||
break;
|
||||
+#endif
|
||||
case EXCP_STREX:
|
||||
if (do_strex(env)) {
|
||||
addr = env->cp15.c6_data;
|
||||
@@ -629,7 +708,6 @@ void cpu_loop(CPUARMState *env)
|
||||
}
|
||||
break;
|
||||
error:
|
||||
-#endif
|
||||
default:
|
||||
fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
|
||||
trapnr);
|
||||
--- oldqemu-1.3.0/bsd-user/arm/syscall.h 2012-12-13 23:51:09.000000000 +0100
|
||||
+++ qemu-1.3.0/bsd-user/arm/syscall.h 2012-12-13 23:45:22.000000000 +0100
|
||||
@@ -21,3 +21,5 @@ struct target_pt_regs {
|
||||
#define ARM_r0 uregs[0]
|
||||
|
||||
#define ARM_SYSCALL_BASE 0 /* XXX: FreeBSD only */
|
||||
+
|
||||
+#define TARGET_FREEBSD_ARM_SET_TP 2
|
13
emulators/qemu-devel/files/patch-z7b-bsd-user-tls2
Normal file
13
emulators/qemu-devel/files/patch-z7b-bsd-user-tls2
Normal file
@ -0,0 +1,13 @@
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -266,9 +268,7 @@ static abi_long do_freebsd_sysarch(void
|
||||
|
||||
switch (op) {
|
||||
case TARGET_FREEBSD_ARM_SET_TP:
|
||||
- if (get_user(val, parms, abi_ulong))
|
||||
- return -TARGET_EINVAL;
|
||||
- cpu_set_tls(env, val);
|
||||
+ cpu_set_tls(env, parms);
|
||||
return 0;
|
||||
}
|
||||
|
11
emulators/qemu-devel/files/patch-z8-bsd-user-unref
Normal file
11
emulators/qemu-devel/files/patch-z8-bsd-user-unref
Normal file
@ -0,0 +1,11 @@
|
||||
--- qemu-1.4.0/bsd-user/syscall.c.orig
|
||||
+++ qemu-1.4.0/bsd-user/syscall.c
|
||||
@@ -2418,7 +2418,7 @@ do_thr_exit(CPUArchState *cpu_env, abi_u
|
||||
}
|
||||
|
||||
thread_env = NULL;
|
||||
- object_delete(OBJECT(ENV_GET_CPU(cpu_env)));
|
||||
+ object_unref(OBJECT(ENV_GET_CPU(cpu_env)));
|
||||
g_free(ts);
|
||||
pthread_exit(NULL);
|
||||
}
|
40
emulators/qemu-devel/files/patch-z9-bsd-user-sson003a
Normal file
40
emulators/qemu-devel/files/patch-z9-bsd-user-sson003a
Normal file
@ -0,0 +1,40 @@
|
||||
diff --git a/bsd-user/freebsd/ioctl.h b/bsd-user/freebsd/ioctl.h
|
||||
index 67c5583..f83f6c1 100644
|
||||
--- a/bsd-user/freebsd/ioctl.h
|
||||
+++ b/bsd-user/freebsd/ioctl.h
|
||||
@@ -8,8 +8,8 @@ IOCTL(TIOCSBRK, IOC_, TYPE_NULL)
|
||||
IOCTL(TIOCCBRK, IOC_, TYPE_NULL)
|
||||
IOCTL(TIOCSDTR, IOC_, TYPE_NULL)
|
||||
IOCTL(TIOCCDTR, IOC_, TYPE_NULL)
|
||||
-IOCTL(TIOCGPGRP, IOC_W, MK_PTR(TYPE_INT))
|
||||
-IOCTL(TIOCSPGRP, IOC_R, MK_PTR(TYPE_INT))
|
||||
+IOCTL(TIOCGPGRP, IOC_R, MK_PTR(TYPE_INT))
|
||||
+IOCTL(TIOCSPGRP, IOC_W, MK_PTR(TYPE_INT))
|
||||
IOCTL(TIOCGETA, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL(TIOCSETA, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL(TIOCSETAW, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
diff --git a/bsd-user/main.c b/bsd-user/main.c
|
||||
index d9a0ecd..7cc77aa 100644
|
||||
--- a/bsd-user/main.c
|
||||
+++ b/bsd-user/main.c
|
||||
@@ -1907,7 +1907,7 @@ int main(int argc, char **argv)
|
||||
env->hflags |= MIPS_HFLAG_M16;
|
||||
}
|
||||
#if defined(TARGET_MIPS64)
|
||||
- env->hflags |= MIPS_HFLAG_UX;
|
||||
+ env->hflags |= MIPS_HFLAG_UX | MIPS_HFLAG_64;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
|
||||
index 581a31f..a40d7ce 100644
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -278,7 +278,6 @@ static abi_long do_freebsd_sysarch(void *env, int op, abi_ulong parms)
|
||||
#ifdef TARGET_ARM
|
||||
static abi_long do_freebsd_sysarch(void *env, int op, abi_ulong parms)
|
||||
{
|
||||
- abi_ulong val;
|
||||
|
||||
switch (op) {
|
||||
case TARGET_FREEBSD_ARM_SET_TP:
|
332
emulators/qemu-devel/files/patch-z9b-bsd-user-sson003b
Normal file
332
emulators/qemu-devel/files/patch-z9b-bsd-user-sson003b
Normal file
@ -0,0 +1,332 @@
|
||||
diff --git a/bsd-user/arm/target_vmparam.h b/bsd-user/arm/target_vmparam.h
|
||||
index 0427244..24dca00 100644
|
||||
--- a/bsd-user/arm/target_vmparam.h
|
||||
+++ b/bsd-user/arm/target_vmparam.h
|
||||
@@ -20,6 +20,10 @@ struct target_ps_strings {
|
||||
|
||||
#define TARGET_SZSIGCODE 0
|
||||
|
||||
+/* Make stack size large enough to hold everything. */
|
||||
+#define TARGET_STACK_SIZE ((x86_stack_size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) ? \
|
||||
+ MAX_ARG_PAGES*TARGET_PAGE_SIZE : x86_stack_size)
|
||||
+
|
||||
#else
|
||||
|
||||
#define TARGET_USRSTACK 0
|
||||
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
|
||||
index 0c48f5a..f5f652f 100644
|
||||
--- a/bsd-user/elfload.c
|
||||
+++ b/bsd-user/elfload.c
|
||||
@@ -715,9 +715,13 @@ static abi_ulong setup_arg_pages(abi_ulong p, struct bsd_binprm *bprm,
|
||||
/* Create enough stack to hold everything. If we don't use
|
||||
* it for args, we'll use it for something else...
|
||||
*/
|
||||
+#ifdef TARGET_STACK_SIZE
|
||||
+ size = TARGET_STACK_SIZE;
|
||||
+#else
|
||||
size = x86_stack_size;
|
||||
if (size < MAX_ARG_PAGES*TARGET_PAGE_SIZE)
|
||||
size = MAX_ARG_PAGES*TARGET_PAGE_SIZE;
|
||||
+#endif
|
||||
|
||||
#ifdef TARGET_USRSTACK
|
||||
stack_base = TARGET_USRSTACK - size;
|
||||
@@ -738,7 +742,7 @@ static abi_ulong setup_arg_pages(abi_ulong p, struct bsd_binprm *bprm,
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
/*
|
||||
- * The inital FreeBSD stack looks like follows:
|
||||
+ * The inital FreeBSD stack is as follows:
|
||||
* (see kern/kern_exec.c exec_copyout_strings() )
|
||||
*
|
||||
* Hi Address -> char **ps_argvstr (struct ps_strings for ps, w, etc.)
|
||||
diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list
|
||||
index bcdd931..c66dcfa 100644
|
||||
--- a/bsd-user/freebsd/strace.list
|
||||
+++ b/bsd-user/freebsd/strace.list
|
||||
@@ -118,6 +118,7 @@
|
||||
{ TARGET_FREEBSD_NR_revoke, "revoke", NULL, NULL, NULL },
|
||||
{ TARGET_FREEBSD_NR_rfork, "rfork", NULL, NULL, NULL },
|
||||
{ TARGET_FREEBSD_NR_rmdir, "rmdir", NULL, NULL, NULL },
|
||||
+{ TARGET_FREEBSD_NR_rtprio_thread, "rtprio_thread", "%s(%d, %d, %p)", NULL, NULL },
|
||||
{ TARGET_FREEBSD_NR_sbrk, "sbrk", NULL, NULL, NULL },
|
||||
{ TARGET_FREEBSD_NR_sched_yield, "sched_yield", NULL, NULL, NULL },
|
||||
{ TARGET_FREEBSD_NR_select, "select", NULL, NULL, NULL },
|
||||
diff --git a/bsd-user/i386/target_vmparam.h b/bsd-user/i386/target_vmparam.h
|
||||
index 8fc98d5..ea7546c 100644
|
||||
--- a/bsd-user/i386/target_vmparam.h
|
||||
+++ b/bsd-user/i386/target_vmparam.h
|
||||
@@ -19,6 +19,10 @@ struct target_ps_strings {
|
||||
|
||||
#define TARGET_SZSIGCODE 0
|
||||
|
||||
+/* Make stack size large enough to hold everything. */
|
||||
+#define TARGET_STACK_SIZE ((x86_stack_size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) ? \
|
||||
+ MAX_ARG_PAGES*TARGET_PAGE_SIZE : x86_stack_size)
|
||||
+
|
||||
#else
|
||||
|
||||
#define TARGET_USRSTACK 0
|
||||
diff --git a/bsd-user/main.c b/bsd-user/main.c
|
||||
index 7cc77aa..32bd3e5 100644
|
||||
--- a/bsd-user/main.c
|
||||
+++ b/bsd-user/main.c
|
||||
@@ -855,7 +855,9 @@ void cpu_loop(CPUARMState *env)
|
||||
goto do_segv;
|
||||
}
|
||||
break;
|
||||
+#if 0
|
||||
error:
|
||||
+#endif
|
||||
default:
|
||||
fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
|
||||
trapnr);
|
||||
diff --git a/bsd-user/mips/target_vmparam.h b/bsd-user/mips/target_vmparam.h
|
||||
index 9fca7f3..8abc26c 100644
|
||||
--- a/bsd-user/mips/target_vmparam.h
|
||||
+++ b/bsd-user/mips/target_vmparam.h
|
||||
@@ -21,6 +21,10 @@ struct target_ps_strings {
|
||||
|
||||
#define TARGET_SZSIGCODE 0
|
||||
|
||||
+/* Make stack size large enough to hold everything. */
|
||||
+#define TARGET_STACK_SIZE ((x86_stack_size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) ? \
|
||||
+ MAX_ARG_PAGES*TARGET_PAGE_SIZE : x86_stack_size)
|
||||
+
|
||||
#else
|
||||
|
||||
#define TARGET_USRSTACK 0
|
||||
diff --git a/bsd-user/mips64/target_vmparam.h b/bsd-user/mips64/target_vmparam.h
|
||||
index 47c2267..55ed254 100644
|
||||
--- a/bsd-user/mips64/target_vmparam.h
|
||||
+++ b/bsd-user/mips64/target_vmparam.h
|
||||
@@ -20,6 +20,10 @@ struct target_ps_strings {
|
||||
|
||||
#define TARGET_PS_STRINGS (TARGET_USRSTACK - sizeof(struct target_ps_strings))
|
||||
|
||||
+/* Make stack size large enough to hold everything. */
|
||||
+#define TARGET_STACK_SIZE ((x86_stack_size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) ? \
|
||||
+ MAX_ARG_PAGES*TARGET_PAGE_SIZE : x86_stack_size)
|
||||
+
|
||||
#else
|
||||
|
||||
#define TARGET_USRSTACK 0
|
||||
diff --git a/bsd-user/sparc/target_vmparam.h b/bsd-user/sparc/target_vmparam.h
|
||||
index 9494c46..82c29ed 100644
|
||||
--- a/bsd-user/sparc/target_vmparam.h
|
||||
+++ b/bsd-user/sparc/target_vmparam.h
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef _TARGET_VMPARAM_H_
|
||||
#define _TARGET_VMPARAM_H_
|
||||
|
||||
-#define TARGET_USRSTACK 0
|
||||
-
|
||||
#ifdef __FreeBSD__
|
||||
struct target_ps_strings {
|
||||
abi_ulong ps_argvstr;
|
||||
@@ -14,9 +12,22 @@ struct target_ps_strings {
|
||||
#define TARGET_SPACE_USRSPACE 4096
|
||||
#define TARGET_ARG_MAX 262144
|
||||
|
||||
+/* XXX */
|
||||
+#define TARGET_VM_MAXUSER_ADDRESS (0xc0000000 - (512 * 1024 * 1024))
|
||||
+#define TARGET_USRSTACK TARGET_VM_MAXUSER_ADDRESS
|
||||
+
|
||||
#define TARGET_PS_STRINGS (TARGET_USRSTACK - sizeof(struct target_ps_strings))
|
||||
|
||||
#define TARGET_SZSIGCODE 0
|
||||
+
|
||||
+/* Make stack size large enough to hold everything. */
|
||||
+#define TARGET_STACK_SIZE ((x86_stack_size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) ? \
|
||||
+ MAX_ARG_PAGES*TARGET_PAGE_SIZE : x86_stack_size)
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+#define TARGET_USRSTACK 0
|
||||
+
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#endif /* _TARGET_VMPARAM_H_ */
|
||||
diff --git a/bsd-user/sparc64/target_vmparam.h b/bsd-user/sparc64/target_vmparam.h
|
||||
index 12af063..7f2b464 100644
|
||||
--- a/bsd-user/sparc64/target_vmparam.h
|
||||
+++ b/bsd-user/sparc64/target_vmparam.h
|
||||
@@ -21,6 +21,10 @@ struct target_ps_strings {
|
||||
|
||||
#define TARGET_SZSIGCODE 0
|
||||
|
||||
+/* Make stack size large enough to hold everything. */
|
||||
+#define TARGET_STACK_SIZE ((x86_stack_size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) ? \
|
||||
+ MAX_ARG_PAGES*TARGET_PAGE_SIZE : x86_stack_size)
|
||||
+
|
||||
#else
|
||||
|
||||
#define TARGET_USRSTACK 0
|
||||
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
|
||||
index a40d7ce..8565ae8 100644
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -409,19 +409,44 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol
|
||||
for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++)
|
||||
*q++ = tswap32(*p);
|
||||
oidfmt(snamep, namelen, NULL, &kind);
|
||||
- /* XXX swap hnewp */
|
||||
-#if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32
|
||||
- /* XXX there may be more sysctls that differ */
|
||||
- if (namelen == 2 &&
|
||||
- snamep[0] == CTL_KERN && snamep[1] == KERN_USRSTACK &&
|
||||
- holdlen && holdlen == 4 && hnewp == NULL) {
|
||||
- (*(uint32_t *)holdp) = 0xfffff000U;
|
||||
- ret = 0;
|
||||
- } else
|
||||
+
|
||||
+ /* Handle some arch/emulator dependent sysctl()'s here. */
|
||||
+ if (CTL_KERN == snamep[0]) {
|
||||
+ switch(snamep[1]) {
|
||||
+ case KERN_USRSTACK:
|
||||
+#if defined(TARGET_ARM) && HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32
|
||||
+ (*(uint32_t *)holdp) = 0xfffff000U;
|
||||
+ holdlen = sizeof(uint32_t);
|
||||
+ ret = 0;
|
||||
+#elif TARGET_USRSTACK != 0
|
||||
+ (*(abi_ulong *)holdp) = tswapal(TARGET_USRSTACK);
|
||||
+ holdlen = sizeof(abi_ulong);
|
||||
+ ret = 0;
|
||||
+#else
|
||||
+ ret = -TARGET_ENOENT;
|
||||
+#endif
|
||||
+ goto out;
|
||||
+
|
||||
+ case KERN_PS_STRINGS:
|
||||
+#if defined(TARGET_PS_STRINGS)
|
||||
+ (*(abi_ulong *)holdp) = tswapal(TARGET_PS_STRINGS);
|
||||
+ holdlen = sizeof(abi_ulong);
|
||||
+ ret = 0;
|
||||
+#else
|
||||
+ ret = -TARGET_ENOENT;
|
||||
#endif
|
||||
+ goto out;
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ret = get_errno(sysctl(snamep, namelen, holdp, &holdlen, hnewp, newlen));
|
||||
if (!ret)
|
||||
sysctl_oldcvt(holdp, holdlen, kind);
|
||||
+
|
||||
+out:
|
||||
put_user_ual(holdlen, oldlenp);
|
||||
unlock_user(hnamep, namep, 0);
|
||||
unlock_user(holdp, oldp, holdlen);
|
||||
@@ -3293,6 +3318,47 @@ host_to_target_fhandle(abi_ulong target_addr, fhandle_t *host_fh)
|
||||
}
|
||||
|
||||
static inline abi_long
|
||||
+target_to_host_rtprio(struct rtprio *host_rtp, abi_ulong target_addr)
|
||||
+{
|
||||
+ struct target_rtprio *target_rtp;
|
||||
+
|
||||
+ if (!lock_user_struct(VERIFY_READ, target_rtp, target_addr, 1))
|
||||
+ return (-TARGET_EFAULT);
|
||||
+ __get_user(host_rtp->type, &target_rtp->type);
|
||||
+ __get_user(host_rtp->prio, &target_rtp->prio);
|
||||
+ unlock_user_struct(target_rtp, target_addr, 0);
|
||||
+ return (0);
|
||||
+}
|
||||
+
|
||||
+static inline abi_long
|
||||
+host_to_target_rtprio(abi_ulong target_addr, struct rtprio *host_rtp)
|
||||
+{
|
||||
+ struct target_rtprio *target_rtp;
|
||||
+
|
||||
+ if (!lock_user_struct(VERIFY_WRITE, target_rtp, target_addr, 0))
|
||||
+ return (-TARGET_EFAULT);
|
||||
+ __put_user(host_rtp->type, &target_rtp->type);
|
||||
+ __put_user(host_rtp->prio, &target_rtp->prio);
|
||||
+ unlock_user_struct(target_rtp, target_addr, 1);
|
||||
+ return (0);
|
||||
+}
|
||||
+
|
||||
+static inline abi_long
|
||||
+do_rtprio_thread(int function, lwpid_t lwpid, abi_ulong target_addr)
|
||||
+{
|
||||
+ int ret;
|
||||
+ struct rtprio rtp;
|
||||
+
|
||||
+ ret = target_to_host_rtprio(&rtp, target_addr);
|
||||
+ if (0 == ret)
|
||||
+ ret = get_errno(rtprio_thread(function, lwpid, &rtp));
|
||||
+ if (0 == ret)
|
||||
+ ret = host_to_target_rtprio(target_addr, &rtp);
|
||||
+
|
||||
+ return (ret);
|
||||
+}
|
||||
+
|
||||
+static inline abi_long
|
||||
target_to_host_sched_param(struct sched_param *host_sp, abi_ulong target_addr)
|
||||
{
|
||||
struct target_sched_param *target_sp;
|
||||
@@ -4617,12 +4683,17 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
struct target_rlimit *target_rlim;
|
||||
struct rlimit rlim;
|
||||
|
||||
- if (!lock_user_struct(VERIFY_READ, target_rlim, arg2, 1))
|
||||
- goto efault;
|
||||
- rlim.rlim_cur = target_to_host_rlim(target_rlim->rlim_cur);
|
||||
- rlim.rlim_max = target_to_host_rlim(target_rlim->rlim_max);
|
||||
- unlock_user_struct(target_rlim, arg2, 0);
|
||||
- ret = get_errno(setrlimit(resource, &rlim));
|
||||
+ if (RLIMIT_STACK == resource) {
|
||||
+ /* XXX We should, maybe, allow the stack size to shrink */
|
||||
+ ret = -TARGET_EPERM;
|
||||
+ } else {
|
||||
+ if (!lock_user_struct(VERIFY_READ, target_rlim, arg2, 1))
|
||||
+ goto efault;
|
||||
+ rlim.rlim_cur = target_to_host_rlim(target_rlim->rlim_cur);
|
||||
+ rlim.rlim_max = target_to_host_rlim(target_rlim->rlim_max);
|
||||
+ unlock_user_struct(target_rlim, arg2, 0);
|
||||
+ ret = get_errno(setrlimit(resource, &rlim));
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -4633,7 +4704,12 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
struct target_rlimit *target_rlim;
|
||||
struct rlimit rlim;
|
||||
|
||||
- ret = get_errno(getrlimit(resource, &rlim));
|
||||
+ /* Return the target stack size */
|
||||
+ if (RLIMIT_STACK == resource) {
|
||||
+ rlim.rlim_cur = rlim.rlim_max = TARGET_STACK_SIZE;
|
||||
+ ret = 0;
|
||||
+ } else
|
||||
+ ret = get_errno(getrlimit(resource, &rlim));
|
||||
if (!is_error(ret)) {
|
||||
if (!lock_user_struct(VERIFY_WRITE, target_rlim, arg2,
|
||||
0))
|
||||
@@ -6148,7 +6224,7 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
break;
|
||||
|
||||
case TARGET_FREEBSD_NR_rtprio_thread:
|
||||
- ret = 0;
|
||||
+ ret = do_rtprio_thread(arg1, arg2, arg3);
|
||||
break;
|
||||
|
||||
case TARGET_FREEBSD_NR_getcontext:
|
||||
diff --git a/bsd-user/x86_64/target_vmparam.h b/bsd-user/x86_64/target_vmparam.h
|
||||
index aa5e0e0..ff9f534 100644
|
||||
--- a/bsd-user/x86_64/target_vmparam.h
|
||||
+++ b/bsd-user/x86_64/target_vmparam.h
|
||||
@@ -20,6 +20,10 @@ struct target_ps_strings {
|
||||
|
||||
#define TARGET_SZSIGCODE 0
|
||||
|
||||
+/* Make stack size large enough to hold everything. */
|
||||
+#define TARGET_STACK_SIZE ((x86_stack_size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) ? \
|
||||
+ MAX_ARG_PAGES*TARGET_PAGE_SIZE : x86_stack_size)
|
||||
+
|
||||
#else
|
||||
|
||||
#define TARGET_USRSTACK 0
|
2425
emulators/qemu-devel/files/patch-z9c-bsd-user-sson003c
Normal file
2425
emulators/qemu-devel/files/patch-z9c-bsd-user-sson003c
Normal file
File diff suppressed because it is too large
Load Diff
92
emulators/qemu-devel/files/patch-z9d-bsd-user-sson003d
Normal file
92
emulators/qemu-devel/files/patch-z9d-bsd-user-sson003d
Normal file
@ -0,0 +1,92 @@
|
||||
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
|
||||
index 8abb1dd..c2c3a65 100644
|
||||
--- a/bsd-user/elfload.c
|
||||
+++ b/bsd-user/elfload.c
|
||||
@@ -798,6 +798,7 @@ static abi_ulong setup_arg_pages(abi_ulong p, struct bsd_binprm *bprm,
|
||||
p -= roundup(execpath_len, sizeof(abi_ulong));
|
||||
/* XXX - check return value of memcpy_to_target() */
|
||||
memcpy_to_target(p, execpath, execpath_len);
|
||||
+ strlcpy(target_proc_pathname, execpath, execpath_len);
|
||||
}
|
||||
|
||||
/* Add canary for SSP. */
|
||||
diff --git a/bsd-user/main.c b/bsd-user/main.c
|
||||
index bb614de..b6aaa7e 100644
|
||||
--- a/bsd-user/main.c
|
||||
+++ b/bsd-user/main.c
|
||||
@@ -62,6 +62,7 @@ unsigned long x86_stack_size = 512 * 1024;
|
||||
|
||||
static void save_proc_pathname(void);
|
||||
char qemu_proc_pathname[PATH_MAX];
|
||||
+char target_proc_pathname[PATH_MAX];
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
static void
|
||||
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
|
||||
index 110b54e..d51f50c 100644
|
||||
--- a/bsd-user/qemu.h
|
||||
+++ b/bsd-user/qemu.h
|
||||
@@ -224,6 +224,7 @@ void mmap_fork_end(int child);
|
||||
/* main.c */
|
||||
extern unsigned long x86_stack_size;
|
||||
extern char qemu_proc_pathname[];
|
||||
+extern char target_proc_pathname[];
|
||||
|
||||
/* user access */
|
||||
|
||||
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
|
||||
index 74b5c86..636083a 100644
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -485,8 +485,6 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol
|
||||
abi_ulong oldlen = 0;
|
||||
int32_t *snamep = g_malloc(sizeof(int32_t) * namelen), *p, *q, i;
|
||||
uint32_t kind = 0;
|
||||
- abi_ulong argv, argv0;
|
||||
- char *fullpath = NULL;
|
||||
|
||||
if (oldlenp)
|
||||
if (get_user_ual(oldlen, oldlenp))
|
||||
@@ -533,30 +531,14 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol
|
||||
case KERN_PROC:
|
||||
switch(snamep[2]) {
|
||||
case KERN_PROC_PATHNAME:
|
||||
- if (get_user_ual(argv, TARGET_PS_STRINGS)) {
|
||||
- ret = -TARGET_EFAULT;
|
||||
- goto out;
|
||||
- }
|
||||
- if (get_user_ual(argv0, argv)) {
|
||||
- ret = -TARGET_EFAULT;
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- fullpath = realpath(g2h(argv0), NULL);
|
||||
- if (NULL == fullpath)
|
||||
- fullpath = (char *)g2h(argv0);
|
||||
- holdlen = strlen(fullpath) + 1;
|
||||
+ holdlen = strlen(target_proc_pathname) + 1;
|
||||
if (holdp) {
|
||||
if (oldlen < holdlen) {
|
||||
ret = -TARGET_EINVAL;
|
||||
goto out;
|
||||
}
|
||||
- if (!access_ok(VERIFY_WRITE, argv0,
|
||||
- holdlen)) {
|
||||
- ret = -TARGET_EFAULT;
|
||||
- goto out;
|
||||
- }
|
||||
- strlcpy(holdp, fullpath, oldlen);
|
||||
+ strlcpy(holdp, target_proc_pathname,
|
||||
+ oldlen);
|
||||
}
|
||||
ret = 0;
|
||||
goto out;
|
||||
@@ -597,8 +579,6 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol
|
||||
#endif
|
||||
|
||||
out:
|
||||
- if (fullpath)
|
||||
- free(fullpath);
|
||||
if (oldlenp)
|
||||
put_user_ual(holdlen, oldlenp);
|
||||
unlock_user(hnamep, namep, 0);
|
15
emulators/qemu-devel/files/patch-z9e-bsd-user-cognet-elfload
Normal file
15
emulators/qemu-devel/files/patch-z9e-bsd-user-cognet-elfload
Normal file
@ -0,0 +1,15 @@
|
||||
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
|
||||
index 8abb1dd..eee159b 100644
|
||||
--- a/bsd-user/elfload.c
|
||||
+++ b/bsd-user/elfload.c
|
||||
@@ -999,9 +999,9 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
||||
NEW_AUX_ENT(AT_EUID, (abi_ulong) geteuid());
|
||||
NEW_AUX_ENT(AT_GID, (abi_ulong) getgid());
|
||||
NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid());
|
||||
+#ifndef __FreeBSD__
|
||||
NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
|
||||
NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK));
|
||||
-#ifndef __FreeBSD__
|
||||
if (k_platform)
|
||||
NEW_AUX_ENT(AT_PLATFORM, u_platform);
|
||||
#endif
|
321
emulators/qemu-devel/files/patch-z9f-bsd-user-sson003f
Normal file
321
emulators/qemu-devel/files/patch-z9f-bsd-user-sson003f
Normal file
@ -0,0 +1,321 @@
|
||||
diff --git a/bsd-user/arm/target_signal.h b/bsd-user/arm/target_signal.h
|
||||
index 6b7bb67..4a9e518 100644
|
||||
--- a/bsd-user/arm/target_signal.h
|
||||
+++ b/bsd-user/arm/target_signal.h
|
||||
@@ -3,15 +3,57 @@
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
-static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
|
||||
-{
|
||||
- return state->regs[13];
|
||||
-}
|
||||
+#define TARGET_REG_R0 0
|
||||
+#define TARGET_REG_R1 1
|
||||
+#define TARGET_REG_R2 2
|
||||
+#define TARGET_REG_R3 3
|
||||
+#define TARGET_REG_R4 4
|
||||
+#define TARGET_REG_R5 5
|
||||
+#define TARGET_REG_R6 6
|
||||
+#define TARGET_REG_R7 7
|
||||
+#define TARGET_REG_R8 8
|
||||
+#define TARGET_REG_R9 9
|
||||
+#define TARGET_REG_R10 10
|
||||
+#define TARGET_REG_R11 11
|
||||
+#define TARGET_REG_R12 12
|
||||
+#define TARGET_REG_R13 13
|
||||
+#define TARGET_REG_R14 14
|
||||
+#define TARGET_REG_R15 15
|
||||
+#define TARGET_REG_CPSR 16
|
||||
+/* Convenience synonyms */
|
||||
+#define TARGET_REG_FP TARGET_REG_R11
|
||||
+#define TARGET_REG_SP TARGET_REG_R13
|
||||
+#define TARGET_REG_LR TARGET_REG_R14
|
||||
+#define TARGET_REG_PC TARGET_REG_R15
|
||||
+
|
||||
+#define TARGET_GET_MC_CLEAR_RET 1
|
||||
|
||||
#define TARGET_MINSIGSTKSZ (1024 * 4)
|
||||
#define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768)
|
||||
+#define TARGET__NGREG 17
|
||||
+
|
||||
+typedef struct {
|
||||
+ uint32_t __fp_fpsr;
|
||||
+ struct {
|
||||
+ uint32_t __fp_exponent;
|
||||
+ uint32_t __fp_mantissa_hi;
|
||||
+ uint32_t __fp_mantissa_lo;
|
||||
+ } __fp_fr[8];
|
||||
+} target__fpregset_t;
|
||||
|
||||
-typedef target_ulong target_mcontext_t; /* dummy */
|
||||
+typedef struct {
|
||||
+ uint32_t __vfp_fpscr;
|
||||
+ uint32_t __vfp_fstmx[33];
|
||||
+ uint32_t __vfp_fpsid;
|
||||
+} target__vfpregset_t;
|
||||
+
|
||||
+typedef struct {
|
||||
+ uint32_t __gregs[TARGET__NGREG];
|
||||
+ union {
|
||||
+ target__fpregset_t __fpregs;
|
||||
+ target__vfpregset_t __vfpregs;
|
||||
+ } __fpu;
|
||||
+} target_mcontext_t;
|
||||
|
||||
typedef struct target_ucontext {
|
||||
target_sigset_t uc_sigmask;
|
||||
@@ -22,18 +64,119 @@ typedef struct target_ucontext {
|
||||
int32_t __spare__[4];
|
||||
} target_ucontext_t;
|
||||
|
||||
+struct target_sigframe {
|
||||
+ target_siginfo_t sf_si; /* saved siginfo */
|
||||
+ target_ucontext_t sf_uc; /* saved ucontext */
|
||||
+};
|
||||
+
|
||||
+#define TARGET_SZSIGCODE (8 * 4)
|
||||
+
|
||||
+/* Compare to arm/arm/locore.S ENTRY_NP(sigcode) */
|
||||
+static inline int
|
||||
+install_sigtramp(abi_ulong offset, unsigned sigf_us, uint32_t sys_sigreturn)
|
||||
+{
|
||||
+ int i;
|
||||
+ uint32_t sys_exit = TARGET_FREEBSD_NR_exit;
|
||||
+ /*
|
||||
+ * The code has to load r7 manually rather than using
|
||||
+ * "ldr r7, =SYS_return to make sure the size of the
|
||||
+ * code is correct.
|
||||
+ */
|
||||
+ uint32_t sigtramp_code[] = {
|
||||
+ /* 1 */ 0xE1A0000D, /* mov r0, sp */
|
||||
+ /* 2 */ 0xE59F700C, /* ldr r7, [pc, #12] */
|
||||
+ /* 3 */ 0xEF000000 + sys_sigreturn, /* swi (SYS_sigreturn) */
|
||||
+ /* 4 */ 0xE59F7008, /* ldr r7, [pc, #8] */
|
||||
+ /* 5 */ 0xEF000000 + sys_exit, /* swi (SYS_exit)*/
|
||||
+ /* 6 */ 0xEAFFFFFA, /* b . -16 */
|
||||
+ /* 7 */ sys_sigreturn,
|
||||
+ /* 8 */ sys_exit
|
||||
+ };
|
||||
+
|
||||
+ for(i = 0; i < 8; i++)
|
||||
+ tswap32s(&sigtramp_code[i]);
|
||||
+
|
||||
+ return(memcpy_to_target(offset, sigtramp_code, TARGET_SZSIGCODE));
|
||||
+}
|
||||
+
|
||||
+static inline abi_ulong
|
||||
+get_sp_from_cpustate(CPUARMState *state)
|
||||
+{
|
||||
+ return state->regs[13]; /* sp */
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Compare to arm/arm/machdep.c sendsig()
|
||||
+ * Assumes that the target stack frame memory is locked.
|
||||
+ */
|
||||
+static inline int
|
||||
+set_sigtramp_args(CPUARMState *regs, int sig, struct target_sigframe *frame,
|
||||
+ abi_ulong frame_addr, struct target_sigaction *ka)
|
||||
+{
|
||||
+ /*
|
||||
+ * Arguments to signal handler:
|
||||
+ * r0 = signal number
|
||||
+ * r1 = siginfo pointer
|
||||
+ * r2 = ucontext pointer
|
||||
+ * r5 = ucontext pointer
|
||||
+ * pc = signal handler pointer
|
||||
+ * sp = sigframe struct pointer
|
||||
+ * lr = sigtramp at base of user stack
|
||||
+ */
|
||||
+
|
||||
+ regs->regs[0] = sig;
|
||||
+ regs->regs[1] = frame_addr +
|
||||
+ offsetof(struct target_sigframe, sf_si);
|
||||
+ regs->regs[2] = frame_addr +
|
||||
+ offsetof(struct target_sigframe, sf_uc);
|
||||
+
|
||||
+ /* the trampoline uses r5 as the uc address */
|
||||
+ regs->regs[5] = frame_addr +
|
||||
+ offsetof(struct target_sigframe, sf_uc);
|
||||
+ regs->regs[TARGET_REG_PC] = ka->_sa_handler;
|
||||
+ regs->regs[TARGET_REG_SP] = frame_addr;
|
||||
+ regs->regs[TARGET_REG_LR] = TARGET_PS_STRINGS - TARGET_SZSIGCODE;
|
||||
+
|
||||
+ return (0);
|
||||
+}
|
||||
+
|
||||
+/* Compare to arm/arm/machdep.c get_mcontext() */
|
||||
static inline int
|
||||
-get_mcontext(CPUArchState *regs, target_mcontext_t *mcp, int flags)
|
||||
+get_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int clear_ret)
|
||||
{
|
||||
- fprintf(stderr, "ARM doesn't have support for get_mcontext()\n");
|
||||
- return (-TARGET_ENOSYS);
|
||||
+ int i, err = 0;
|
||||
+ uint32_t *gr = mcp->__gregs;
|
||||
+
|
||||
+
|
||||
+ if (clear_ret & TARGET_GET_MC_CLEAR_RET)
|
||||
+ gr[TARGET_REG_R0] = 0;
|
||||
+ else
|
||||
+ gr[TARGET_REG_R0] = tswap32(regs->regs[0]);
|
||||
+ for(i = 1; i < 12; i++)
|
||||
+ gr[i] = tswap32(regs->regs[i]);
|
||||
+ gr[TARGET_REG_SP] = tswap32(regs->regs[13]);
|
||||
+ gr[TARGET_REG_LR] = tswap32(regs->regs[14]);
|
||||
+ gr[TARGET_REG_PC] = tswap32(regs->regs[15]);
|
||||
+ gr[TARGET_REG_CPSR] = tswap32(regs->spsr);
|
||||
+
|
||||
+ return (err);
|
||||
}
|
||||
|
||||
+/* Compare to arm/arm/machdep.c set_mcontext() */
|
||||
static inline int
|
||||
-set_mcontext(CPUArchState *regs, target_mcontext_t *mcp, int flags)
|
||||
+set_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int flags)
|
||||
{
|
||||
- fprintf(stderr, "ARM doesn't have support for set_mcontext()\n");
|
||||
- return (-TARGET_ENOSYS);
|
||||
+ int i, err = 0;
|
||||
+ const uint32_t *gr = mcp->__gregs;
|
||||
+
|
||||
+ for(i = 0; i < 12; i++)
|
||||
+ regs->regs[i] = tswap32(gr[i]);
|
||||
+ regs->regs[13] = tswap32(gr[TARGET_REG_SP]);
|
||||
+ regs->regs[14] = tswap32(gr[TARGET_REG_LR]);
|
||||
+ regs->regs[15] = tswap32(gr[TARGET_REG_PC]);
|
||||
+ regs->spsr = tswap32(gr[TARGET_REG_CPSR]);
|
||||
+
|
||||
+ return (err);
|
||||
}
|
||||
|
||||
#endif /* TARGET_SIGNAL_H */
|
||||
diff --git a/bsd-user/arm/target_vmparam.h b/bsd-user/arm/target_vmparam.h
|
||||
index 24dca00..bc50fbb 100644
|
||||
--- a/bsd-user/arm/target_vmparam.h
|
||||
+++ b/bsd-user/arm/target_vmparam.h
|
||||
@@ -18,8 +18,6 @@ struct target_ps_strings {
|
||||
|
||||
#define TARGET_PS_STRINGS (TARGET_USRSTACK - sizeof(struct target_ps_strings))
|
||||
|
||||
-#define TARGET_SZSIGCODE 0
|
||||
-
|
||||
/* Make stack size large enough to hold everything. */
|
||||
#define TARGET_STACK_SIZE ((x86_stack_size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) ? \
|
||||
MAX_ARG_PAGES*TARGET_PAGE_SIZE : x86_stack_size)
|
||||
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
|
||||
index c2c3a65..76681e1 100644
|
||||
--- a/bsd-user/elfload.c
|
||||
+++ b/bsd-user/elfload.c
|
||||
@@ -690,24 +690,6 @@ static abi_ulong copy_elf_strings(int argc,char ** argv, void **page,
|
||||
return p;
|
||||
}
|
||||
|
||||
-#if defined(TARGET_MIPS64)
|
||||
-static inline int
|
||||
-install_sigtramp(abi_ulong offset, unsigned sigf_uc, unsigned syscall)
|
||||
-{
|
||||
- int i;
|
||||
- uint32_t sigtramp_code[] = {
|
||||
- 0x67A40000 + sigf_uc, /* daddu $a0, $sp, (sigf_uc) */
|
||||
- 0x24020000 + syscall, /* li $v0, (syscall) */
|
||||
- 0x0000000C, /* syscall */
|
||||
- 0x0000000D /* break */
|
||||
- };
|
||||
-
|
||||
- for(i = 0; i < 4; i++)
|
||||
- tswap32s(&sigtramp_code[i]);
|
||||
-
|
||||
- return (memcpy_to_target(offset, sigtramp_code, TARGET_SZSIGCODE));
|
||||
-}
|
||||
-#endif
|
||||
|
||||
static abi_ulong setup_arg_pages(abi_ulong p, struct bsd_binprm *bprm,
|
||||
struct image_info *info)
|
||||
diff --git a/bsd-user/mips64/target_signal.h b/bsd-user/mips64/target_signal.h
|
||||
index c592136..f657909 100644
|
||||
--- a/bsd-user/mips64/target_signal.h
|
||||
+++ b/bsd-user/mips64/target_signal.h
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#define TARGET_MINSIGSTKSZ (512 * 4)
|
||||
#define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768)
|
||||
-#define TARGET_SZSIGCODE 16
|
||||
|
||||
struct target_sigcontext {
|
||||
target_sigset_t sc_mask; /* signal mask to retstore */
|
||||
@@ -56,9 +55,29 @@ get_sp_from_cpustate(CPUMIPSState *state)
|
||||
return state->active_tc.gpr[29];
|
||||
}
|
||||
|
||||
+#define TARGET_SZSIGCODE (4 * 4)
|
||||
+
|
||||
+/* Compare to mips/mips/locore.S sigcode() */
|
||||
+static inline int
|
||||
+install_sigtramp(abi_ulong offset, unsigned sigf_uc, unsigned sys_sigreturn)
|
||||
+{
|
||||
+ int i;
|
||||
+ uint32_t sigtramp_code[] = {
|
||||
+ /* 1 */ 0x67A40000 + sigf_uc, /* daddu $a0, $sp, (sigf_uc) */
|
||||
+ /* 2 */ 0x24020000 + sys_sigreturn, /* li $v0, (sys_sigreturn) */
|
||||
+ /* 3 */ 0x0000000C, /* syscall */
|
||||
+ /* 4 */ 0x0000000D /* break */
|
||||
+ };
|
||||
+
|
||||
+ for(i = 0; i < 4; i++)
|
||||
+ tswap32s(&sigtramp_code[i]);
|
||||
+
|
||||
+ return (memcpy_to_target(offset, sigtramp_code, TARGET_SZSIGCODE));
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Compare to mips/mips/pm_machdep.c sendsig()
|
||||
- * Assumes that "frame" memory is locked.
|
||||
+ * Assumes that target stack frame memory is locked.
|
||||
*/
|
||||
static inline int
|
||||
set_sigtramp_args(CPUMIPSState *regs, int sig, struct target_sigframe *frame,
|
||||
@@ -67,6 +86,11 @@ set_sigtramp_args(CPUMIPSState *regs, int sig, struct target_sigframe *frame,
|
||||
|
||||
/* frame->sf_si.si_addr = regs->CP0_BadVAddr; */
|
||||
|
||||
+ /* MIPS only struct target_sigframe members: */
|
||||
+ frame->sf_signum = sig;
|
||||
+ frame->sf_siginfo = (abi_ulong)&frame->sf_si;
|
||||
+ frame->sf_ucontext = (abi_ulong)&frame->sf_uc;
|
||||
+
|
||||
/*
|
||||
* Arguments to signal handler:
|
||||
* a0 ($4) = signal number
|
||||
diff --git a/bsd-user/signal.c b/bsd-user/signal.c
|
||||
index 29e8e12..b04e874 100644
|
||||
--- a/bsd-user/signal.c
|
||||
+++ b/bsd-user/signal.c
|
||||
@@ -613,7 +613,7 @@ do_sigaction(int sig, const struct target_sigaction *act,
|
||||
return (ret);
|
||||
}
|
||||
|
||||
-#if defined(TARGET_MIPS64) /* || defined(TARGET_SPARC64) */
|
||||
+#if defined(TARGET_MIPS64) || defined(TARGET_ARM)
|
||||
|
||||
static inline abi_ulong
|
||||
get_sigframe(struct target_sigaction *ka, CPUArchState *regs, size_t frame_size)
|
||||
@@ -715,17 +715,8 @@ static void setup_frame(int sig, int code, struct target_sigaction *ka,
|
||||
}
|
||||
#endif
|
||||
|
||||
- frame->sf_signum = sig;
|
||||
- frame->sf_siginfo = (abi_ulong)&frame->sf_si;
|
||||
- frame->sf_ucontext = (abi_ulong)&frame->sf_uc;
|
||||
-
|
||||
- } else {
|
||||
- frame->sf_signum = sig;
|
||||
- frame->sf_siginfo = 0;
|
||||
- frame->sf_ucontext = 0;
|
||||
}
|
||||
|
||||
-
|
||||
if (set_sigtramp_args(regs, sig, frame, frame_addr, ka))
|
||||
goto give_sigsegv;
|
||||
|
28
emulators/qemu-devel/files/patch-za-bsd-user-8fix
Normal file
28
emulators/qemu-devel/files/patch-za-bsd-user-8fix
Normal file
@ -0,0 +1,28 @@
|
||||
--- a/bsd-user/syscall.c
|
||||
+++ b/bsd-user/syscall.c
|
||||
@@ -123,6 +123,7 @@ get_filename_from_fd(pid_t pid, int fd,
|
||||
struct filestat *fst;
|
||||
char *ret = NULL;
|
||||
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
procstat = procstat_open_sysctl();
|
||||
if (NULL == procstat)
|
||||
goto out;
|
||||
@@ -152,6 +153,7 @@ out:
|
||||
procstat_freeprocs(procstat, kipp);
|
||||
if (procstat != NULL)
|
||||
procstat_close(procstat);
|
||||
+#endif
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -1739,7 +1741,9 @@ int_case:
|
||||
case IP_RECVDSTADDR:
|
||||
|
||||
case IP_RETOPTS:
|
||||
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900000
|
||||
case IP_RECVTOS:
|
||||
+#endif
|
||||
case IP_MULTICAST_TTL:
|
||||
case IP_MULTICAST_LOOP:
|
||||
case IP_PORTRANGE:
|
1151
emulators/qemu-devel/files/patch-zb-bsd-user-sson004a
Normal file
1151
emulators/qemu-devel/files/patch-zb-bsd-user-sson004a
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,31 +1,33 @@
|
||||
--- configure.orig 2010-01-29 14:36:00.000000000 -0500
|
||||
+++ configure 2010-01-29 14:36:00.000000000 -0500
|
||||
@@ -194,6 +194,9 @@ zlib="yes"
|
||||
guest_agent="yes"
|
||||
libiscsi=""
|
||||
coroutine=""
|
||||
--- configure.orig
|
||||
+++ configure
|
||||
@@ -226,6 +226,9 @@ coroutine=""
|
||||
seccomp=""
|
||||
glusterfs=""
|
||||
virtio_blk_data_plane=""
|
||||
+pcap="no"
|
||||
+pcap_create="no"
|
||||
+bpf="no"
|
||||
|
||||
# parse CC options first
|
||||
for opt do
|
||||
@@ -670,6 +673,8 @@ for opt do
|
||||
@@ -729,6 +732,10 @@ for opt do
|
||||
;;
|
||||
--enable-vnc-thread) vnc_thread="yes"
|
||||
--enable-vnc-ws) vnc_ws="yes"
|
||||
;;
|
||||
+ --enable-pcap) pcap="yes"
|
||||
+ ;;
|
||||
+ --disable-pcap) pcap="no"
|
||||
+ ;;
|
||||
--disable-slirp) slirp="no"
|
||||
;;
|
||||
--disable-uuid) uuid="no"
|
||||
@@ -1619,6 +1624,49 @@ EOF
|
||||
@@ -1730,6 +1737,51 @@ EOF
|
||||
fi
|
||||
|
||||
##########################################
|
||||
+# pcap probe
|
||||
+
|
||||
+if test "$pcap" = "yes" ; then
|
||||
+if test "$pcap" = "yes" -a "$pcap" != "no"; then
|
||||
+ cat > $TMPC << EOF
|
||||
+#include <pcap.h>
|
||||
+int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); }
|
||||
@ -35,7 +37,9 @@
|
||||
+ else
|
||||
+ libpcap=-lwpcap
|
||||
+ fi
|
||||
+ if ! $cc $ARCH_CFLAGS -o $TMPE $libpcap $TMPC 2> /dev/null ; then
|
||||
+ if compile_prog "$libpcap" ; then
|
||||
+ :
|
||||
+ else
|
||||
+ echo
|
||||
+ echo "Error: Could not find pcap"
|
||||
+ echo "Make sure to have the pcap libs and headers installed."
|
||||
@ -50,7 +54,7 @@
|
||||
+ return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0);
|
||||
+}
|
||||
+EOF
|
||||
+ if $cc $ARCH_CFLAGS -o $TMPE $libpcap $TMPC 2> /dev/null ; then
|
||||
+ if compile_prog "$libpcap" ; then
|
||||
+ pcap_create="yes"
|
||||
+ fi
|
||||
+ cat > $TMPC << EOF
|
||||
@ -59,17 +63,25 @@
|
||||
+#include <net/bpf.h>
|
||||
+int main(void) { return (BPF_MAJOR_VERSION); }
|
||||
+EOF
|
||||
+ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
|
||||
+ if compile_prog ; then
|
||||
+ bpf="yes"
|
||||
+ fi
|
||||
+ libs_softmmu="$libpcap $libs_softmmu"
|
||||
+fi # test "$pcap"
|
||||
+
|
||||
+##########################################
|
||||
# VNC TLS detection
|
||||
if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
|
||||
# VNC TLS/WS detection
|
||||
if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
|
||||
cat > $TMPC <<EOF
|
||||
@@ -3117,6 +3165,15 @@ fi
|
||||
@@ -3307,6 +3359,7 @@ echo "Extra audio cards $audio_card_list
|
||||
echo "Block whitelist $block_drv_whitelist"
|
||||
echo "Mixer emulation $mixemu"
|
||||
echo "VirtFS support $virtfs"
|
||||
+echo "pcap support $pcap"
|
||||
echo "VNC support $vnc"
|
||||
if test "$vnc" = "yes" ; then
|
||||
echo "VNC TLS support $vnc_tls"
|
||||
@@ -3445,6 +3498,15 @@ fi
|
||||
if test "$profiler" = "yes" ; then
|
||||
echo "CONFIG_PROFILER=y" >> $config_host_mak
|
||||
fi
|
||||
@ -85,20 +97,33 @@
|
||||
if test "$slirp" = "yes" ; then
|
||||
echo "CONFIG_SLIRP=y" >> $config_host_mak
|
||||
echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
|
||||
Index: net.c
|
||||
@@ -37,6 +37,11 @@
|
||||
#include "hw/qdev.h"
|
||||
#include "iov.h"
|
||||
Index: net/clients.h
|
||||
@@ -47,6 +47,11 @@ int net_init_tap(const NetClientOptions
|
||||
int net_init_bridge(const NetClientOptions *opts, const char *name,
|
||||
NetClientState *peer);
|
||||
|
||||
+#ifdef CONFIG_PCAP
|
||||
+int net_init_pcap(const NetClientOptions *opts, const char *name,
|
||||
+ NetClientState *peer);
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_VDE
|
||||
int net_init_vde(const NetClientOptions *opts, const char *name,
|
||||
NetClientState *peer);
|
||||
Index: net/net.c
|
||||
@@ -40,6 +40,11 @@
|
||||
#include "qapi/opts-visitor.h"
|
||||
#include "qapi/dealloc-visitor.h"
|
||||
|
||||
+#include <sys/ioctl.h>
|
||||
+#ifdef __FreeBSD__
|
||||
+#include <net/if.h>
|
||||
+#endif
|
||||
+
|
||||
static QTAILQ_HEAD(, VLANState) vlans;
|
||||
static QTAILQ_HEAD(, VLANClientState) non_vlan_clients;
|
||||
|
||||
@@ -797,6 +802,226 @@ static int net_init_nic(QemuOpts *opts,
|
||||
/* Net bridge is currently not supported for W32. */
|
||||
#if !defined(_WIN32)
|
||||
# define CONFIG_NET_BRIDGE
|
||||
@@ -704,6 +709,221 @@ static int net_init_nic(const NetClientO
|
||||
return idx;
|
||||
}
|
||||
|
||||
@ -109,26 +134,27 @@ Index: net.c
|
||||
+#endif
|
||||
+#include <pcap.h>
|
||||
+
|
||||
+typedef struct PCAPState {
|
||||
+ VLANClientState nc;
|
||||
+ pcap_t *handle;
|
||||
+ int max_eth_frame_size;
|
||||
+} PCAPState;
|
||||
+struct PCAPState {
|
||||
+ NetClientState nc;
|
||||
+ pcap_t *handle;
|
||||
+ int max_eth_frame_size;
|
||||
+};
|
||||
+
|
||||
+static ssize_t pcap_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
|
||||
+static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
|
||||
+{
|
||||
+ PCAPState *s = DO_UPCAST(PCAPState, nc, nc);
|
||||
+ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
|
||||
+
|
||||
+ return pcap_inject(s->handle, (u_char*)buf, size);
|
||||
+}
|
||||
+
|
||||
+static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata)
|
||||
+static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata
|
||||
+ )
|
||||
+{
|
||||
+ VLANClientState *nc = (VLANClientState *)user;
|
||||
+ NetClientState *nc = (NetClientState *)user;
|
||||
+
|
||||
+ int len = phdr->len;
|
||||
+#ifdef __FreeBSD__
|
||||
+ PCAPState *s = DO_UPCAST(PCAPState, nc, nc);
|
||||
+ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
|
||||
+ int max_eth_frame_size = s->max_eth_frame_size;
|
||||
+
|
||||
+ if (len > max_eth_frame_size) {
|
||||
@ -143,7 +169,7 @@ Index: net.c
|
||||
+
|
||||
+static void pcap_send(void *opaque)
|
||||
+{
|
||||
+ PCAPState *s = (PCAPState *)opaque;
|
||||
+ struct PCAPState *s = (struct PCAPState *)opaque;
|
||||
+
|
||||
+ for (;;) {
|
||||
+ if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0)
|
||||
@ -151,37 +177,48 @@ Index: net.c
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void pcap_cleanup(VLANClientState *nc)
|
||||
+static void pcap_cleanup(NetClientState *nc)
|
||||
+{
|
||||
+ PCAPState *s = DO_UPCAST(PCAPState, nc, nc);
|
||||
+ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
|
||||
+
|
||||
+ qemu_purge_queued_packets(nc);
|
||||
+ pcap_close(s->handle);
|
||||
+}
|
||||
+
|
||||
+static NetClientInfo net_pcap_info = {
|
||||
+ .type = NET_CLIENT_TYPE_PCAP,
|
||||
+ .size = sizeof(PCAPState),
|
||||
+ .type = NET_CLIENT_OPTIONS_KIND_PCAP,
|
||||
+ .size = sizeof(struct PCAPState),
|
||||
+ .receive = pcap_receive,
|
||||
+// .receive_raw = pcap_receive_raw,
|
||||
+// .receive_iov = pcap_receive_iov,
|
||||
+// .poll = pcap_poll,
|
||||
+ .cleanup = pcap_cleanup,
|
||||
+};
|
||||
+/*
|
||||
+ * ... -net pcap,ifname="..."
|
||||
+ */
|
||||
+
|
||||
+static int net_pcap_init(VLANState *vlan, const char *model, const char *name, const char *ifname)
|
||||
+int net_init_pcap(const NetClientOptions *opts, const char *name, NetClientState *peer)
|
||||
+{
|
||||
+ VLANClientState *nc;
|
||||
+ PCAPState *s = NULL;
|
||||
+ const NetdevPcapOptions *pcap_opts = opts->pcap;
|
||||
+ NetClientState *nc;
|
||||
+ struct PCAPState *s;
|
||||
+ const char *ifname;
|
||||
+ char errbuf[PCAP_ERRBUF_SIZE];
|
||||
+#if defined(_WIN32)
|
||||
+ HANDLE h;
|
||||
+#endif
|
||||
+ int i;
|
||||
+
|
||||
+ s = g_malloc0(sizeof(PCAPState));
|
||||
+ nc = qemu_new_net_client(&net_pcap_info, vlan, NULL, model, name);
|
||||
+
|
||||
+ s = DO_UPCAST(PCAPState, nc, nc);
|
||||
+ if (!s)
|
||||
+ if (!pcap_opts->has_ifname)
|
||||
+ return -1;
|
||||
+
|
||||
+ ifname = pcap_opts->ifname;
|
||||
+
|
||||
+ /* create the object */
|
||||
+ nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname);
|
||||
+ s = DO_UPCAST(struct PCAPState, nc, nc);
|
||||
+
|
||||
+ if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
|
||||
+ fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
|
||||
+ goto fail;
|
||||
@ -206,6 +243,7 @@ Index: net.c
|
||||
+ close(i);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32)
|
||||
+ /*
|
||||
+ * Create pcap handle for the device, set promiscuous mode and activate.
|
||||
@ -260,7 +298,6 @@ Index: net.c
|
||||
+ }
|
||||
+ }
|
||||
+#endif /* BIOCIMMEDIATE */
|
||||
+
|
||||
+#if defined(BIOCFEEDBACK)
|
||||
+ /*
|
||||
+ * Tell the kernel that the sent packet has to be fed back.
|
||||
@ -299,72 +336,43 @@ Index: net.c
|
||||
+ if (s) {
|
||||
+ if (s->handle)
|
||||
+ pcap_close(s->handle);
|
||||
+ g_free(s);
|
||||
+ }
|
||||
+
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+static int net_init_pcap(QemuOpts *opts,
|
||||
+ Monitor *mon,
|
||||
+ const char *name,
|
||||
+ VLANState *vlan)
|
||||
+{
|
||||
+ const char *ifname;
|
||||
+
|
||||
+ ifname = qemu_opt_get(opts, "ifname");
|
||||
+
|
||||
+ if (net_pcap_init(vlan, "pcap", name, ifname) == -1) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif /* CONFIG_PCAP */
|
||||
+
|
||||
#define NET_COMMON_PARAMS_DESC \
|
||||
{ \
|
||||
.name = "type", \
|
||||
@@ -973,6 +1198,21 @@ static const struct {
|
||||
{ /* end of list */ }
|
||||
},
|
||||
},
|
||||
+#ifdef CONFIG_PCAP
|
||||
+ [NET_CLIENT_TYPE_PCAP] = {
|
||||
+ .type = "pcap",
|
||||
+ .init = net_init_pcap,
|
||||
+ .desc = {
|
||||
+ NET_COMMON_PARAMS_DESC,
|
||||
+ {
|
||||
+ .name = "ifname",
|
||||
+ .type = QEMU_OPT_STRING,
|
||||
+ .help = "interface name",
|
||||
+ },
|
||||
+ { /* end of list */ }
|
||||
+ },
|
||||
+ },
|
||||
+#endif
|
||||
[NET_CLIENT_TYPE_SOCKET] = {
|
||||
.type = "socket",
|
||||
.init = net_init_socket,
|
||||
@@ -1343,6 +1583,7 @@ void net_check_clients(void)
|
||||
case NET_CLIENT_TYPE_TAP:
|
||||
case NET_CLIENT_TYPE_SOCKET:
|
||||
case NET_CLIENT_TYPE_VDE:
|
||||
+ case NET_CLIENT_TYPE_PCAP:
|
||||
has_host_dev = 1;
|
||||
break;
|
||||
default: ;
|
||||
--- qemu-options.hx.orig 2010-01-14 17:18:00.000000000 -0500
|
||||
+++ qemu-options.hx 2010-01-29 14:36:00.000000000 -0500
|
||||
@@ -799,6 +799,10 @@ DEF("smb", HAS_ARG, QEMU_OPTION_smb, "")
|
||||
DEF("net", HAS_ARG, QEMU_OPTION_net,
|
||||
"-net nic[,vlan=n][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
|
||||
" create a new Network Interface Card and connect it to VLAN 'n'\n"
|
||||
|
||||
static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
|
||||
const NetClientOptions *opts,
|
||||
@@ -722,6 +944,9 @@ static int (* const net_client_init_fun[
|
||||
#ifdef CONFIG_NET_BRIDGE
|
||||
[NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge,
|
||||
#endif
|
||||
+#ifdef CONFIG_PCAP
|
||||
+ "-net pcap[,vlan=n][,name=str][,ifname=name]\n"
|
||||
+ " connect the host network interface using PCAP to VLAN 'n'\n"
|
||||
+ [NET_CLIENT_OPTIONS_KIND_PCAP] = net_init_pcap,
|
||||
+#endif
|
||||
#ifdef CONFIG_SLIRP
|
||||
"-net user[,vlan=n][,name=str][,net=addr[/mask]][,host=addr][,restrict=y|n]\n"
|
||||
" [,hostname=host][,dhcpstart=addr][,dns=addr][,tftp=dir][,bootfile=f]\n"
|
||||
[NET_CLIENT_OPTIONS_KIND_HUBPORT] = net_init_hubport,
|
||||
};
|
||||
|
||||
--- qapi-schema.json.orig
|
||||
+++ qapi-schema.json
|
||||
@@ -2622,6 +2622,10 @@
|
||||
'*br': 'str',
|
||||
'*helper': 'str' } }
|
||||
|
||||
+{ 'type': 'NetdevPcapOptions',
|
||||
+ 'data': {
|
||||
+ '*ifname': 'str' } }
|
||||
+
|
||||
##
|
||||
# @NetdevHubPortOptions
|
||||
#
|
||||
@@ -2648,6 +2652,7 @@
|
||||
'nic': 'NetLegacyNicOptions',
|
||||
'user': 'NetdevUserOptions',
|
||||
'tap': 'NetdevTapOptions',
|
||||
+ 'pcap': 'NetdevPcapOptions',
|
||||
'socket': 'NetdevSocketOptions',
|
||||
'vde': 'NetdevVdeOptions',
|
||||
'dump': 'NetdevDumpOptions',
|
||||
|
@ -14,6 +14,7 @@ bin/qemu-system-i386
|
||||
%%NONX86%%bin/qemu-system-mips64
|
||||
%%NONX86%%bin/qemu-system-mips64el
|
||||
%%NONX86%%bin/qemu-system-mipsel
|
||||
%%NONX86%%bin/qemu-system-or32
|
||||
%%NONX86%%bin/qemu-system-ppc
|
||||
%%NONX86%%bin/qemu-system-ppc64
|
||||
%%NONX86%%bin/qemu-system-ppcemb
|
||||
@ -22,11 +23,16 @@ bin/qemu-system-i386
|
||||
%%NONX86%%bin/qemu-system-sh4eb
|
||||
%%NONX86%%bin/qemu-system-sparc
|
||||
%%NONX86%%bin/qemu-system-sparc64
|
||||
%%NONX86%%bin/qemu-system-unicore32
|
||||
%%BSD_USER%%bin/qemu-arm
|
||||
%%BSD_USER%%bin/qemu-armeb
|
||||
%%BSD_USER%%bin/qemu-i386
|
||||
%%BSD_USER%%bin/qemu-mips
|
||||
%%BSD_USER64%%bin/qemu-mips64
|
||||
%%BSD_USER%%bin/qemu-mipsel
|
||||
%%BSD_USER%%bin/qemu-sparc
|
||||
%%BSD_USER%%bin/qemu-sparc64
|
||||
%%BSD_USER%%bin/qemu-x86_64
|
||||
%%BSD_USER64%%bin/qemu-sparc64
|
||||
%%BSD_USER64%%bin/qemu-x86_64
|
||||
bin/qemu-system-x86_64
|
||||
%%NONX86%%bin/qemu-system-xtensa
|
||||
%%NONX86%%bin/qemu-system-xtensaeb
|
||||
@ -40,6 +46,8 @@ etc/qemu-ifdown.sample
|
||||
etc/qemu/target-x86_64.conf.sample
|
||||
@exec if [ ! -f %D/etc/qemu/target-x86_64.conf ] ; then cp -p %D/%F %D/etc/qemu/target-x86_64.conf; fi
|
||||
@dirrmtry etc/qemu
|
||||
%%DATADIR%%/acpi-dsdt.aml
|
||||
%%DATADIR%%/q35-acpi-dsdt.aml
|
||||
%%DATADIR%%/bios.bin
|
||||
%%DATADIR%%/vgabios.bin
|
||||
%%DATADIR%%/vgabios-cirrus.bin
|
||||
@ -58,7 +66,6 @@ etc/qemu/target-x86_64.conf.sample
|
||||
%%DATADIR%%/pxe-pcnet.rom
|
||||
%%DATADIR%%/pxe-virtio.rom
|
||||
%%DATADIR%%/petalogix-ml605.dtb
|
||||
%%DATADIR%%/mpc8544ds.dtb
|
||||
%%DATADIR%%/spapr-rtas.bin
|
||||
%%DATADIR%%/slof.bin
|
||||
%%DATADIR%%/s390-zipl.rom
|
||||
@ -67,10 +74,10 @@ etc/qemu/target-x86_64.conf.sample
|
||||
%%DATADIR%%/sgabios.bin
|
||||
%%DATADIR%%/petalogix-s3adsp1800.dtb
|
||||
%%DATADIR%%/bamboo.dtb
|
||||
%%DATADIR%%/cpus-x86_64.conf
|
||||
%%DATADIR%%/kvmvapic.bin
|
||||
%%DATADIR%%/qemu-icon.bmp
|
||||
%%DATADIR%%/keymaps/ar
|
||||
%%DATADIR%%/keymaps/bepo
|
||||
%%DATADIR%%/keymaps/common
|
||||
%%DATADIR%%/keymaps/da
|
||||
%%DATADIR%%/keymaps/de
|
||||
|
@ -6,12 +6,12 @@
|
||||
#
|
||||
|
||||
PORTNAME= usbredir
|
||||
PORTVERSION= 0.4.3
|
||||
PORTVERSION= 0.6
|
||||
CATEGORIES= net devel
|
||||
MASTER_SITES= http://spice-space.org/download/usbredir/
|
||||
|
||||
MAINTAINER= nox@FreeBSD.org
|
||||
COMMENT= A protocol for redirection of USB traffic
|
||||
COMMENT= protocol for redirection of USB traffic
|
||||
|
||||
USE_BZIP2= yes
|
||||
MAKE_JOBS_SAFE= yes
|
||||
@ -20,7 +20,7 @@ USE_GNOME= pkgconfig
|
||||
PATCH_STRIP= -p1
|
||||
GNU_CONFIGURE= yes
|
||||
MAKE_ARGS+= PREFIX=${PREFIX}
|
||||
CONFIGURE_ENV+= LIBUSB_CFLAGS=-I/usr/include
|
||||
CONFIGURE_ENV+= LIBUSB_CFLAGS=-I/usr/include\ -DLIBUSB_CALL=
|
||||
CONFIGURE_ENV+= LIBUSB_LIBS=-lusb
|
||||
MAN1= usbredirserver.1
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (usbredir-0.4.3.tar.bz2) = f2cbcc67926c2275837143485407a57cf4c3fda52d199cbb58f73d57a6988f9c
|
||||
SIZE (usbredir-0.4.3.tar.bz2) = 299163
|
||||
SHA256 (usbredir-0.6.tar.bz2) = 028184960044ea4124030000b3c55a35c3238835116e3a0fbcaff449df2c8edf
|
||||
SIZE (usbredir-0.6.tar.bz2) = 305887
|
||||
|
@ -6,4 +6,4 @@ of this protocol.
|
||||
With the official 0.3 release the protocol is now frozen (only extensions
|
||||
advertised through capabilities can be added from now on).
|
||||
|
||||
WWW: http://cgit.freedesktop.org/~jwrdegoede/usbredir/
|
||||
WWW: http://cgit.freedesktop.org/spice/usbredir
|
||||
|
@ -5,11 +5,11 @@ include/usbredirparser.h
|
||||
lib/libusbredirparser.a
|
||||
lib/libusbredirparser.la
|
||||
lib/libusbredirparser.so
|
||||
lib/libusbredirparser.so.0
|
||||
lib/libusbredirparser.so.1
|
||||
lib/libusbredirhost.a
|
||||
lib/libusbredirhost.la
|
||||
lib/libusbredirhost.so
|
||||
lib/libusbredirhost.so.1
|
||||
libdata/pkgconfig/libusbredirparser.pc
|
||||
libdata/pkgconfig/libusbredirparser-0.5.pc
|
||||
libdata/pkgconfig/libusbredirhost.pc
|
||||
sbin/usbredirserver
|
||||
|
Loading…
Reference in New Issue
Block a user