1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[standard]= Fast CPU emulator and virtualizer for x86 platform
8 HOMEPAGE= https://www.qemu.org/
12 SITES[main]= https://download.qemu.org/
13 DISTFILE[1]= qemu-5.0.0.tar.xz:main
15 SPKGS[standard]= complete
20 OPTIONS_AVAILABLE= none
21 OPTIONS_STANDARD= none
23 BUILD_DEPENDS= texi2html:primary:standard
24 python-Sphinx:single:python_default
25 BUILDRUN_DEPENDS= nettle:primary:standard
26 fontconfig:primary:standard
27 freetype:primary:standard
28 gnutls:primary:standard
29 cyrus-sasl:primary:standard
32 libepoxy:single:standard
34 USES= cpe gmake pkgconfig bison perl:build python:build
35 jpeg png mesa gettext-runtime gettext-tools ncurses
37 GNOME_COMPONENTS= gdkpixbuf gtk2 vte
39 XORG_COMPONENTS= x11 xext
41 LICENSE= GPLv2:primary
42 LICENSE_TERMS= primary:{{WRKSRC}}/LICENSE
43 LICENSE_FILE= GPLv2:{{WRKSRC}}/COPYING
46 FPC_EQUIVALENT= emulators/qemu
49 CONFIGURE_ARGS= --disable-usb-redir
50 --disable-stack-protector
60 --python={{PYTHON_CMD}}
62 --extra-cflags="-I{{WRKSRC}} -I{{LOCALBASE}}/include -DPREFIX=\\\"\"{{PREFIX}}\\\"\""
63 --extra-ldflags="-L/usr/lib -L{{LOCALBASE}}/lib"
65 MAKE_ENV= BSD_MAKE="{{MAKE}}"
68 INSTALL_REQ_TOOLCHAIN= yes
70 VAR_OPSYS[freebsd]= CONFIGURE_ARGS=--enable-netmap
71 CONFIGURE_ARGS=--disable-linux-user
72 CONFIGURE_ARGS=--disable-linux-aio
73 VAR_OPSYS[linux]= CONFIGURE_ARGS=--disable-netmap
74 VAR_OPSYS[dragonfly]= CONFIGURE_ARGS=--disable-netmap
75 CONFIGURE_ARGS=--disable-linux-user
76 CONFIGURE_ARGS=--disable-linux-aio
79 ${REINPLACE_CMD} -e '/LIBS/s|-lprocstat|-lprocstat -lelf|' \
80 -e '/libusb/s/ --atleast-version=1\.0\.[0-9]*//' \
83 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing|" \
84 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
85 ${WRKSRC}/Makefile.target
87 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing -I.|" \
88 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
91 -e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \
92 ${WRKSRC}/scripts/texi2pod.pl
93 # GNS3 (promiscuous multicast)
94 ${REINPLACE_CMD} -e 's|(buf\[0\] & 1) && (rctl & E1000_RCTL_MPE)|buf[0] \& 1|' \
95 ${WRKSRC}/hw/net/e1000.c
96 # broken build for optionrom
97 ${REINPLACE_CMD} -e '/roms="optionrom"/d' ${WRKSRC}/configure
98 # silence some include warnings
99 ${MKDIR} ${WRKSRC}/bsd-user/dragonfly
102 # for some reason file is considered out-of-date
103 ${TOUCH} ${WRKSRC}/config-host.mak
105 post-patch-dragonfly:
106 ${REINPLACE_CMD} -e '/libs_qga=..glib_libs/ s|glib_libs|glib_libs -lintl|' \
110 ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample \
111 ${STAGEDIR}${PREFIX}/etc
112 ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample \
113 ${STAGEDIR}${PREFIX}/etc
114 ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-*
115 (cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${STD_DOCDIR}/)
116 # remove empty directories
117 ${RM} -r ${STAGEDIR}/var
120 ${REINPLACE_CMD} -e '/libs_qga=..glib_libs/ s|glib_libs|glib_libs -lintl|' \
123 [FILE:782:descriptions/desc.primary]
124 QEMU is a fast processor emulator using dynamic translation to achieve
125 good emulation speed. QEMU has two operating modes:
127 * Full system emulation. In this mode, QEMU emulates a full system (for
128 example a PC), including a processor and various peripherials. It can
129 be used to launch different Operating Systems without rebooting the PC
130 or to debug system code.
131 * User mode emulation (Linux host only). In this mode, QEMU can launch
132 Linux processes compiled for one CPU on another CPU. It can be used to
133 launch the Wine Windows API emulator or to ease cross-compilation and
136 As QEMU requires no host kernel patches to run, it is safe and easy to use.
138 See also the preconfigured system images on http://oszoo.org/
139 Many live cd isos also work.
143 2f13a92a0fa5c8b69ff0796b59b86b080bbb92ebad5d301a7724dd06b5e78cb6 62426192 qemu-5.0.0.tar.xz
146 [FILE:3493:manifests/plist.primary]
147 @sample etc/qemu-ifdown.sample
148 @sample etc/qemu-ifup.sample
184 %%ONLY-LINUX%%libexec/qemu-bridge-helper
204 qemu-system-microblaze
205 qemu-system-microblazeel
224 qemu-system-unicore32
229 share/applications/qemu.desktop
230 share/icons/hicolor/128x128/apps/qemu.png
231 share/icons/hicolor/16x16/apps/qemu.png
232 share/icons/hicolor/24x24/apps/qemu.png
233 share/icons/hicolor/256x256/apps/qemu.png
234 share/icons/hicolor/32x32/apps/
237 share/icons/hicolor/48x48/apps/qemu.png
238 share/icons/hicolor/512x512/apps/qemu.png
239 share/icons/hicolor/64x64/apps/qemu.png
240 share/icons/hicolor/scalable/apps/qemu.svg
245 qemu-block-drivers.7.gz
264 edk2-i386-secure-code.fd
268 edk2-x86_64-secure-code.fd
285 opensbi-riscv32-sifive_u-fw_jump.bin
286 opensbi-riscv32-virt-fw_jump.bin
287 opensbi-riscv64-sifive_u-fw_jump.bin
288 opensbi-riscv64-virt-fw_jump.bin
291 petalogix-s3adsp1800.dtb
307 u-boot-sam460-20100605.bin
310 vgabios-bochs-display.bin
319 50-edk2-i386-secure.json
320 50-edk2-x86_64-secure.json
362 [FILE:10600:manifests/plist.docs]
371 amd-memory-encryption.txt
373 block-replication.txt
389 multi-thread-compression.txt
392 pci_expander_bridge.txt
399 qemu-option-trace.rst.inc
409 virtio-balloon-stats.txt
410 virtio-net-failover.rst
413 xen-save-devices-state.txt
414 share/doc/qemu/docs/built/index.html
415 share/doc/qemu/docs/built/devel/
431 secure-coding-practices.html
436 share/doc/qemu/docs/built/devel/_static/
441 documentation_options.js
452 share/doc/qemu/docs/built/interop/
459 live-block-operations.html
468 share/doc/qemu/docs/built/interop/_static/
473 documentation_options.js
484 share/doc/qemu/docs/built/specs/
486 acpi_hw_reduced_hotplug.html
495 share/doc/qemu/docs/built/specs/_static/
500 documentation_options.js
511 share/doc/qemu/docs/built/system/
530 qemu-block-drivers.html
552 share/doc/qemu/docs/built/system/_static/
557 documentation_options.js
568 share/doc/qemu/docs/built/system/arm/
580 share/doc/qemu/docs/built/system/s390x/vfio-ap.html
581 share/doc/qemu/docs/built/tools/
594 virtfs-proxy-helper.1
595 virtfs-proxy-helper.html
598 share/doc/qemu/docs/built/tools/_static/
603 documentation_options.js
614 share/doc/qemu/docs/built/user/
622 share/doc/qemu/docs/built/user/_static/
627 documentation_options.js
638 share/doc/qemu/docs/config/
640 mach-virt-graphical.cfg
643 q35-virtio-graphical.cfg
644 q35-virtio-serial.cfg
645 share/doc/qemu/docs/devel/
661 multiple-iothreads.txt
667 secure-coding-practices.rst
674 writing-qmp-commands.txt
675 share/doc/qemu/docs/interop/
682 live-block-operations.rst
707 vnc-ledstate-Pseudo-encoding.txt
708 share/doc/qemu/docs/specs/
710 acpi_hw_reduced_hotplug.rst
723 ppc-spapr-hotplug.txt
724 ppc-spapr-uv-hcalls.txt
734 share/doc/qemu/docs/sphinx/
739 share/doc/qemu/docs/sphinx/__pycache__/
740 hxtool.cpython-38.pyc
741 kerneldoc.cpython-38.pyc
742 kernellog.cpython-38.pyc
743 qmp_lexer.cpython-%%PYTHON_SUFFIX%%.pyc
744 share/doc/qemu/docs/spin/
746 aio_notify_accept.promela
747 aio_notify_bug.promela
748 tcg-exclusive.promela
749 win32-qemu-event.promela
750 share/doc/qemu/docs/system/
753 cpu-models-mips.rst.inc
754 cpu-models-x86.rst.inc
756 device-url-syntax.rst.inc
771 qemu-block-drivers.rst
772 qemu-block-drivers.rst.inc
778 target-i386-desc.rst.inc
791 share/doc/qemu/docs/system/arm/
803 share/doc/qemu/docs/system/s390x/vfio-ap.rst
804 share/doc/qemu/docs/tools/
810 virtfs-proxy-helper.rst
812 share/doc/qemu/docs/user/
816 share/doc/qemu/interop/
823 live-block-operations.html
831 share/doc/qemu/interop/_static/
836 documentation_options.js
847 share/doc/qemu/specs/
849 acpi_hw_reduced_hotplug.html
858 share/doc/qemu/specs/_static/
863 documentation_options.js
874 share/doc/qemu/system/
892 qemu-block-drivers.html
912 share/doc/qemu/system/_static/
917 documentation_options.js
928 share/doc/qemu/system/arm/
940 share/doc/qemu/system/s390x/vfio-ap.html
941 share/doc/qemu/tools/
951 virtfs-proxy-helper.html
953 share/doc/qemu/tools/_static/
958 documentation_options.js
977 share/doc/qemu/user/_static/
982 documentation_options.js
995 [FILE:261:manifests/plist.nls]
996 share/locale/bg/LC_MESSAGES/qemu.mo
997 share/locale/de_DE/LC_MESSAGES/qemu.mo
998 share/locale/fr_FR/LC_MESSAGES/qemu.mo
999 share/locale/hu/LC_MESSAGES/qemu.mo
1000 share/locale/it/LC_MESSAGES/qemu.mo
1001 share/locale/tr/LC_MESSAGES/qemu.mo
1002 share/locale/zh_CN/LC_MESSAGES/qemu.mo
1005 [FILE:3416:patches/patch-configure]
1006 --- configure.orig 2020-04-28 16:49:25 UTC
1008 @@ -493,6 +493,9 @@ numa=""
1018 @@ -1168,6 +1171,10 @@ for opt do
1020 --enable-vnc-png) vnc_png="yes"
1022 + --enable-pcap) pcap="yes"
1024 + --disable-pcap) pcap="no"
1026 --disable-slirp) slirp="no"
1028 --enable-slirp=git) slirp="git"
1029 @@ -3137,6 +3144,14 @@ if ! check_include "ifaddrs.h" ; then
1032 ##########################################
1033 +# getifaddrs (for tests/test-io-channel-socket )
1036 +if ! check_include "ifaddrs.h" ; then
1040 +##########################################
1043 if test "$vte" != "no"; then
1044 @@ -5098,7 +5113,7 @@ fi
1047 if test "$libusb" != "no" ; then
1048 - if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
1049 + if $pkg_config libusb-1.0; then
1051 libusb_cflags=$($pkg_config --cflags libusb-1.0)
1052 libusb_libs=$($pkg_config --libs libusb-1.0)
1053 @@ -5501,6 +5516,50 @@ if test "$debug_stack_usage" = "yes"; th
1057 +##########################################
1060 +if test "$pcap" = "yes" -a "$pcap" != "no"; then
1061 + cat > $TMPC << EOF
1063 +int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); }
1065 + if test "$mingw32" = "no" ; then
1070 + if compile_prog "" "$libpcap" ; then
1074 + echo "Error: Could not find pcap"
1075 + echo "Make sure to have the pcap libs and headers installed."
1079 + cat > $TMPC << EOF
1083 + char errbuf[PCAP_ERRBUF_SIZE];
1084 + return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0);
1087 + if compile_prog "" "$libpcap" ; then
1090 + cat > $TMPC << EOF
1091 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
1093 +#include <net/bpf.h>
1094 +int main(void) { return (BPF_MAJOR_VERSION); }
1096 + if compile_prog ; then
1099 + libs_softmmu="$libpcap $libs_softmmu"
1102 ##########################################
1103 # check if we have open_by_handle_at
1104 @@ -6627,6 +6686,7 @@ echo "Audio drivers $audio_drv_list"
1105 echo "Block whitelist (rw) $block_drv_rw_whitelist"
1106 echo "Block whitelist (ro) $block_drv_ro_whitelist"
1107 echo "VirtFS support $virtfs"
1108 +echo "pcap support $pcap"
1109 echo "Multipath support $mpath"
1110 echo "VNC support $vnc"
1111 if test "$vnc" = "yes" ; then
1112 @@ -6864,6 +6924,15 @@ fi
1113 if test "$want_tools" = "yes" ; then
1114 echo "CONFIG_TOOLS=y" >> $config_host_mak
1116 +if test "$pcap" = "yes" ; then
1117 + echo "CONFIG_PCAP=y" >> $config_host_mak
1118 + if test "$pcap_create" = "yes" ; then
1119 + echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak
1121 + if test "$bpf" = "yes" ; then
1122 + echo "CONFIG_BPF=y" >> $config_host_mak
1125 if test "$slirp" != "no"; then
1126 echo "CONFIG_SLIRP=y" >> $config_host_mak
1127 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
1128 @@ -7121,6 +7190,9 @@ fi
1129 if test "$have_fsxattr" = "yes" ; then
1130 echo "HAVE_FSXATTR=y" >> $config_host_mak
1132 +if test "$have_ifaddrs_h" = "yes" ; then
1133 + echo "HAVE_IFADDRS_H=y" >> $config_host_mak
1135 if test "$have_copy_file_range" = "yes" ; then
1136 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
1140 [FILE:365:patches/patch-disas_libvixl_vixl_a64_disasm-a64.cc]
1141 --- disas/libvixl/vixl/a64/disasm-a64.cc.orig 2020-04-28 16:49:24 UTC
1142 +++ disas/libvixl/vixl/a64/disasm-a64.cc
1143 @@ -2693,7 +2693,7 @@ void Disassembler::AppendPCRelativeOffse
1145 abs_offset = -abs_offset;
1147 - AppendToOutput("#%c0x%" PRIx64, sign, abs_offset);
1148 + AppendToOutput("#%c0x%" PRIx64, sign, offset < 0 ? -offset : offset);
1154 [FILE:582:patches/patch-include_net_net.h]
1155 --- include/net/net.h.orig 2020-04-28 16:49:24 UTC
1156 +++ include/net/net.h
1157 @@ -208,8 +208,8 @@ void netdev_add(QemuOpts *opts, Error **
1158 int net_hub_id_for_client(NetClientState *nc, int *id);
1159 NetClientState *net_hub_port_find(int hub_id);
1161 -#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
1162 -#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
1163 +#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup"
1164 +#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown"
1165 #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
1166 #define DEFAULT_BRIDGE_INTERFACE "br0"
1170 [FILE:436:patches/patch-net_clients.h]
1171 --- net/clients.h.orig 2020-04-28 16:49:25 UTC
1173 @@ -61,4 +61,10 @@ int net_init_netmap(const Netdev *netdev
1174 int net_init_vhost_user(const Netdev *netdev, const char *name,
1175 NetClientState *peer, Error **errp);
1178 +int net_init_pcap(const Netdev *netdev, const char *name,
1179 + NetClientState *peer, Error **errp);
1183 #endif /* QEMU_NET_CLIENTS_H */
1186 [FILE:6930:patches/patch-net_net.c]
1187 --- net/net.c.orig 2020-04-28 16:49:25 UTC
1190 #include "net/filter.h"
1191 #include "qapi/string-output-visitor.h"
1193 +#include <sys/ioctl.h>
1194 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1195 +#include <net/if.h>
1198 /* Net bridge is currently not supported for W32. */
1199 #if !defined(_WIN32)
1200 # define CONFIG_NET_BRIDGE
1201 @@ -935,7 +940,225 @@ static int net_init_nic(const Netdev *ne
1205 +#if defined(CONFIG_PCAP)
1206 +#if defined(CONFIG_BPF)
1207 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
1208 +#include <net/bpf.h>
1213 + NetClientState nc;
1215 + int max_eth_frame_size;
1218 +static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
1220 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1222 + return pcap_inject(s->handle, (u_char*)buf, size);
1225 +static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata
1228 + NetClientState *nc = (NetClientState *)user;
1230 + int len = phdr->len;
1231 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1232 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1233 + int max_eth_frame_size = s->max_eth_frame_size;
1235 + if (len > max_eth_frame_size) {
1237 + "pcap_send: packet size > %d (%d), truncating\n",
1238 + max_eth_frame_size, len);
1239 + len = max_eth_frame_size;
1242 + qemu_send_packet(nc, pdata, len);
1245 +static void pcap_send(void *opaque)
1247 + struct PCAPState *s = (struct PCAPState *)opaque;
1250 + if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0)
1255 +static void pcap_cleanup(NetClientState *nc)
1257 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1259 + qemu_purge_queued_packets(nc);
1260 + pcap_close(s->handle);
1263 +static NetClientInfo net_pcap_info = {
1264 + .type = NET_CLIENT_DRIVER_PCAP,
1265 + .size = sizeof(struct PCAPState),
1266 + .receive = pcap_receive,
1267 +// .receive_raw = pcap_receive_raw,
1268 +// .receive_iov = pcap_receive_iov,
1269 +// .poll = pcap_poll,
1270 + .cleanup = pcap_cleanup,
1273 + * ... -net pcap,ifname="..."
1276 +int net_init_pcap(const Netdev *netdev,
1277 + const char *name, NetClientState *peer, Error **errp)
1279 + const NetdevPcapOptions *pcap_opts;
1280 + NetClientState *nc;
1281 + struct PCAPState *s;
1282 + const char *ifname;
1283 + char errbuf[PCAP_ERRBUF_SIZE];
1284 +#if defined(_WIN32)
1289 + assert(netdev->type == NET_CLIENT_DRIVER_PCAP);
1290 + pcap_opts = &netdev->u.pcap;
1291 + if (!pcap_opts->has_ifname)
1294 + ifname = pcap_opts->ifname;
1296 + /* create the object */
1297 + nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname);
1298 + s = DO_UPCAST(struct PCAPState, nc, nc);
1300 + if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
1301 + fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1305 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1307 + * We want to avoid passing oversize packets to the guest, which
1308 + * at least on FreeBSD can happen if the host interface uses tso
1309 + * (seen with an em(4) in this case) - so find out the host
1310 + * interface's mtu and assume the guest is configured the same.
1312 + s->max_eth_frame_size = 1514;
1313 + i = socket(AF_INET, SOCK_DGRAM, 0);
1317 + (void) memset(&ifr, 0, sizeof(ifr));
1318 + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
1319 + if (ioctl(i, SIOCGIFMTU, &ifr) != -1)
1320 + s->max_eth_frame_size = ifr.ifr_mtu + 14;
1325 +#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32)
1327 + * Create pcap handle for the device, set promiscuous mode and activate.
1329 + s->handle = (void *)pcap_create(ifname, errbuf);
1331 + fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1334 + if (pcap_set_promisc(s->handle, 1) != 0) {
1335 + pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:");
1338 + if (pcap_activate(s->handle) != 0) {
1339 + pcap_perror(s->handle, (char *)"qemu: pcap_activate:");
1343 + /* Attempt to connect device. */
1344 + s->handle = (void *)pcap_open_live(ifname, 65535, 1, 0, errbuf);
1346 + fprintf(stderr, "qemu: pcap_open_live: %s\n", errbuf);
1351 + /* Set non-blocking mode. */
1352 + if (pcap_setnonblock(s->handle, 1, errbuf) < 0) {
1353 + fprintf(stderr, "qemu: pcap_setnonblock: %s\n", errbuf);
1357 +#if defined(_WIN32)
1359 + * Tell the kernel that the packet has to be seen immediately.
1361 + if (pcap_setmintocopy(s->handle, 0) < 0) {
1362 + fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1365 +#else /* !_WIN32 */
1366 +#if defined(CONFIG_BPF)
1367 +#if defined(BIOCIMMEDIATE)
1369 + * Tell the kernel that the packet has to be seen immediately.
1372 + unsigned int one = 1;
1373 + if (ioctl(pcap_fileno(s->handle), BIOCIMMEDIATE, &one) < 0) {
1374 + fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1378 +#endif /* BIOCIMMEDIATE */
1379 +#if defined(BIOCFEEDBACK)
1381 + * Tell the kernel that the sent packet has to be fed back.
1382 + * This is necessary to connect host and guest.
1385 + unsigned int one = 1;
1386 + if (ioctl(pcap_fileno(s->handle), BIOCFEEDBACK, &one) < 0) {
1387 + fprintf(stderr, "qemu: pcap failed to set feedback mode\n");
1391 +#endif /* BIOCFEEDBACK */
1392 +#endif /* CONFIG_BPF */
1393 +#endif /* _WIN32 */
1395 + snprintf(s->nc.info_str, sizeof(s->nc.info_str), "pcap redirector");
1397 +#if defined(_WIN32)
1398 + if ((h = pcap_getevent(s->handle)) == NULL) {
1399 + fprintf(stderr, "qemu: pcap_getevent failed\n");
1402 + qemu_add_wait_object(h, pcap_send, s);
1403 +#else /* !_WIN32 */
1404 + if ((i = pcap_get_selectable_fd(s->handle)) < 0) {
1405 + fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n");
1408 + qemu_set_fd_handler(i, pcap_send, NULL, s);
1409 +#endif /* _WIN32 */
1416 + pcap_close(s->handle);
1424 static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])(
1425 const Netdev *netdev,
1427 @@ -962,6 +1185,9 @@ static int (* const net_client_init_fun[
1428 #ifdef CONFIG_L2TPV3
1429 [NET_CLIENT_DRIVER_L2TPV3] = net_init_l2tpv3,
1432 + [NET_CLIENT_DRIVER_PCAP] = net_init_pcap,
1439 [FILE:423:patches/patch-net_tap-bsd.c]
1440 --- net/tap-bsd.c.orig 2020-04-28 16:49:25 UTC
1444 #if defined(__NetBSD__) || defined(__FreeBSD__)
1445 #include <sys/ioctl.h>
1446 +#include <sys/socket.h>
1448 #include <net/if_tap.h>
1450 +#if defined(__DragonFly)
1451 +#include <sys/ioctl.h>
1452 +#include <sys/socket.h>
1453 +#include <net/if.h>
1454 +#include <net/tap/if_tap.h>
1457 #if defined(__OpenBSD__)
1458 #include <sys/param.h>
1461 [FILE:1550:patches/patch-qapi_net.json]
1462 --- qapi/net.json.orig 2020-04-28 16:49:25 UTC
1464 @@ -373,6 +373,19 @@
1465 '*helper': 'str' } }
1468 +# @NetdevPcapOptions:
1470 +# Use ifname as a source to capture
1472 +# @ifname: #required to determine which interface to capture
1476 +{ 'struct': 'NetdevPcapOptions',
1478 + '*ifname': 'str' } }
1481 # @NetdevHubPortOptions:
1483 # Connect two or more net clients through a software hub.
1486 { 'enum': 'NetClientDriver',
1487 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1488 - 'bridge', 'hubport', 'netmap', 'vhost-user' ] }
1489 + 'bridge', 'hubport', 'netmap', 'vhost-user', 'pcap' ] }
1494 'user': 'NetdevUserOptions',
1495 'tap': 'NetdevTapOptions',
1496 'l2tpv3': 'NetdevL2TPv3Options',
1497 + 'pcap': 'NetdevPcapOptions',
1498 'socket': 'NetdevSocketOptions',
1499 'vde': 'NetdevVdeOptions',
1500 'bridge': 'NetdevBridgeOptions',
1503 { 'enum': 'NetLegacyOptionsType',
1504 'data': ['none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1505 - 'bridge', 'netmap', 'vhost-user'] }
1506 + 'bridge', 'netmap', 'vhost-user', 'pcap'] }
1509 # @NetLegacyOptions:
1511 'user': 'NetdevUserOptions',
1512 'tap': 'NetdevTapOptions',
1513 'l2tpv3': 'NetdevL2TPv3Options',
1514 + 'pcap': 'NetdevPcapOptions',
1515 'socket': 'NetdevSocketOptions',
1516 'vde': 'NetdevVdeOptions',
1517 'bridge': 'NetdevBridgeOptions',
1520 [FILE:7685:files/pkg-message-single]
1524 - Needs to set net.link.tap.user_open sysctl in order to use /dev/tap*
1525 networking as non-root. Don't forget to adjust device node permissions in
1528 - slirp (usermode networking) is fixed now in cvs, on FreeSBIE 1.0 guests you
1529 still have to manually do: echo nameserver 10.0.2.3 >/etc/resolv.conf but
1530 i've been told that that's normal. (fixed on FreeSBIE 1.1.) And you have
1531 to wait a bit for dhclient to do its thing; traffic to address 10.0.2.2 is
1532 routed to 127.1 on the host.
1534 - Expect timer problems when guest kernel HZ is > hosts, for example time
1535 sleep 1 takes 49 seconds and booting sleeps for minutes at the acd0 probe
1536 with a FreeSBIE 1.0 guest, thats because its kernel is built with HZ=5000,
1537 and FreeBSD's default is 100... (no longer a problem with FreeSBIE 1.1.)
1538 The linux 2.6 kernel uses 1000 by default btw. (changed to 250 later, and
1539 recent linux kernels now no longer have a fixed HZ, aka `tickless
1540 kernel'...) Enabling /dev/rtc doesn't seem to help either (not included
1541 since it needs a patch to emulators/rtc.)
1543 - Update: the above problem has gotten worse with FreeBSD guests
1544 somewhere before 8.0, mainly since the kernel now usually wants
1545 double or even quadruple number of timer irqs compared to HZ if
1546 it detects an apic (and at least early versions of FreeBSD 8 had
1547 a bug that essentially halved qemu's clock rate too); the only
1548 reason you usually don't see symptoms of this with FreeBSD 8
1549 guests is they automatically reduce their HZ to 100 when running
1550 in a VM while the default for the host kernel is still HZ=1000.
1551 Workaround: you can disable the apic clock in the guest by setting
1553 hint.apic.0.clock="0"
1555 in loader.conf(5) (or manually at the loader prompt), if that
1556 doesn't work the only things you can do is either reduce the
1557 guest's HZ to, say, 100 by setting e.g.
1561 from the loader as above (which usually is a good idea in a VM
1562 anyway and FreeBSD 8 now does by itself as mentioned), or otherwise
1563 increase the host's HZ to 2000 or even 4000 from the loader in
1566 - The -smb option (smb-export local dir to guest using the default
1567 slirp networking) needs the samba port/package installed
1568 in addition to qemu. (SAMBA knob.)
1570 - If you want to use usb devices connected to the host in the guest
1571 yot need either recent 10-current (not tested yet much) or you can
1572 use usbredir over the network (see below); also unless you are
1573 running qemu as root you then need to fix permissions for /dev/ugen*
1574 device nodes: if you are on 5.x or later (devfs) put a rule in
1575 /etc/devfs.rules, activate it in /etc/rc.conf and run /etc/rc.d/devfs
1576 restart. Example devfs.rules:
1579 add path 'ugen*' mode 660 group operator
1581 corresponding rc.conf line:
1583 devfs_system_ruleset="ugen_ruleset"
1585 - If you want to test the new (in 0.15.0) usb network redirection (USBREDIR
1586 option) see this thread by Hans de Goede <hdegoede <at> redhat.com>:
1588 http://thread.gmane.org/gmane.comp.emulators.qemu/110176/focus=110183
1594 1) Start usbredirserver for a usb device:
1595 sudo usbredirserver 045e:0772
1596 2) Start qemu with usb2 support + a chardev talking to usbredirserver +
1597 a usb-redir device using this chardev:
1599 -readconfig docs/ich9-ehci-uhci.cfg \
1600 -chardev socket,id=usbredirchardev,host=localhost,port=4000 \
1601 -device usb-redir,chardev=usbredirchardev,id=usbredirdev ...
1603 [you would replace docs/ich9-ehci-uhci.cfg with e.g.
1604 /raven/share/doc/qemu/docs/ich9-ehci-uhci.cfg, but turns out
1605 ehci was broken for me here with FreeBSD guests and the previous
1606 qemu version at least, I got:
1608 FETCHENTRY: entry at 22C5484 is of type 2 which is not supported yet processing error - resetting ehci HC
1609 Assertion failed: (0), function ehci_advance_state, file /data/ports/emulators/qemu-devel/work/qemu-0.15.0/hw/usb-ehci.c, line 2045.
1611 The new qemu version works better tho.]
1613 - Still usb: since the hub is no longer attached to the uchi controller and
1614 the wakeup mechanism, resume interrupt is not implemented yet linux guests
1615 will suspend the bus, i.e. they wont see devices usb_add'ed after its
1616 (linux') uhci module got loaded. Workaround: either add devices before
1617 linux loads the module or rmmod and modprobe it afterwards. [Not sure
1618 if this still applies to the new libusb host code used on recent
1621 - If you build qemu wihout SDL and then get crashes running it try passing it
1622 -nographic. This should probably be default in that case...
1624 - qemu's network boot roms (-boot n) have a bug when bootfiles sizes are a
1625 multiple of blksize, if this affects you (like with FreeBSD's /boot/pxeboot)
1628 cp /boot/pxeboot pxeboot-qemu && chmod +w pxeboot-qemu && echo >>pxeboot-qemu
1630 and then use pxeboot-qemu. Actually you need recent btx code
1631 (from after 7.0 was released) because of the real mode boot
1632 problem, so use at least pxeboot from there. And I just did that
1633 for the pxeboot extracted out of
1635 ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/200805/7.0-STABLE-200805-i386-bootonly.iso
1639 http://people.freebsd.org/~nox/qemu/pxeboot-qemu
1641 - If you use slirp (usernet, the default) and want to mount nfs into the guest
1642 and you are not running qemu as root, then mountd(8) on the exporting box
1643 needs to be run with -n in order to accept requests from ports >= 1024.
1645 - (not FreeBSD-specific:) There have been reports of qcow2 corruption with (at
1646 least) win2k guests on recent kvm (which uses similar qcow2 code than qemu
1647 now, see this thread:
1649 http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00713.html -
1651 the consensus on that thread seems to be that qcow(2) code has always been
1652 experimental and you should use raw images if you want reliability; raw is
1653 also usually faster.) You should be able to migrate existing images to raw
1654 using qemu-img(1)'s convert function; raw doesn't support advanced features
1655 like snapshots tho. [a few important qcow2 bugfixed have been committed in
1656 the meantime so this _might_ be less of an issue now; and meanwhile there
1657 also is the new qed format - I don't know how stable that one is.]
1659 - (also not FreeBSD-specific:) It is recommended to pass raw images using the
1660 new -drive syntax, specifying format=raw explicitly in order to avoid
1661 malicious guests being able to exploit the format autodetection thats
1662 otherwise getting used. (Not that you should run malicious guests anyway,
1663 but this eleminates at least a known attack vector.)
1665 - qemu now has improved physical cdrom support, but still there is at
1666 least one known problem: you need to have the guest eject the disc if you
1667 want to change it/take it out, or otherwise the guest may continue using
1668 state (like size) of the old disc. (You can also do like `change ide1-cd0
1669 /dev/acd0' in the monitor after taking out the disc if a guest cannot eject
1672 - The default configuration location (qemu-ifup script etc.) has been changed
1673 from /etc to PREFIX/etc (usually /raven/etc). Move your files accordingly.
1675 - The pcap code (-net nic... -net pcap,ifname=...) should work properly now,
1676 with only one exception: Advanced features like TSO used on the host
1677 interface can cause oversize packets which now do get truncated to avoid
1678 confusing/panicing guests but of course still will cause retransmissions.
1679 So if you see slow throughput and `pcap_send: packet size > ..., truncating'
1680 messages on qemu's tty try disabling TSO etc on the host interface at least
1684 [FILE:20:files/qemu-ifdown.sample]
1689 [FILE:20:files/qemu-ifup.sample]
1694 [FILE:66:files/special.mk]
1695 .if "${ARCH_STANDARD}" == "x86_64"
1696 MAKE_ARGS+= ARCH=x86_64
1700 [FILE:436:dragonfly/patch-disas_libvixl_vixl_utils.h]
1701 --- disas/libvixl/vixl/utils.h.orig 2020-04-28 16:49:24 UTC
1702 +++ disas/libvixl/vixl/utils.h
1703 @@ -42,6 +42,13 @@ namespace vixl {
1704 #define PRINTF_CHECK(format_index, varargs_index)
1708 +#define INT32_C(c) c
1709 +#define INT64_C(c) (c ## LL)
1710 +#define UINT32_C(c) (c ## U)
1711 +#define UINT64_C(c) (c ## ULL)
1714 // Check number width.
1715 inline bool is_intn(unsigned n, int64_t x) {
1716 VIXL_ASSERT((0 < n) && (n < 64));
1719 [FILE:323:dragonfly/patch-hw-ppc_newworld.c]
1720 --- hw/ppc/mac_newworld.c.orig 2020-04-28 16:49:24 UTC
1721 +++ hw/ppc/mac_newworld.c
1723 #include "hw/sysbus.h"
1726 +/* FreeBSD headers define this */
1731 #define MAX_IDE_BUS 2
1732 #define CFG_ADDR 0xf0000510
1733 #define TBFREQ (100UL * 1000UL * 1000UL)
1736 [FILE:334:dragonfly/patch-hw_ppc_mac__oldworld.c]
1737 --- hw/ppc/mac_oldworld.c.orig 2020-04-28 16:49:24 UTC
1738 +++ hw/ppc/mac_oldworld.c
1741 #define GRACKLE_BASE 0xfec00000
1743 +/* FreeBSD headers define this */
1748 static void fw_cfg_boot_set(void *opaque, const char *boot_device,
1753 [FILE:843:dragonfly/patch-util_coroutine-ucontext.c]
1754 --- util/coroutine-ucontext.c.orig 2020-04-28 16:49:25 UTC
1755 +++ util/coroutine-ucontext.c
1756 @@ -158,7 +158,15 @@ Coroutine *qemu_coroutine_new(void)
1757 2, arg.i[0], arg.i[1]);
1759 /* swapcontext() in, siglongjmp() back out */
1760 - if (!sigsetjmp(old_env, 0)) {
1761 + /* Save signal mask in this sigsetjmp, because makecontext on DragonFly
1762 + * leaves all signals blocked when entering the new context with
1764 + * Workaround this, by just having the signal mask restored by the
1765 + * siglongjmp that brings us back from qemu_coroutine_new().
1766 + * XXX Remove this workaround when the makecontext behaviour is fixed
1769 + if (!sigsetjmp(old_env, 1)) {
1770 start_switch_fiber(&fake_stack_save, co->stack, co->stack_size);
1771 swapcontext(&old_uc, &uc);