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.1.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
69 PLIST_SUB= JQUERY=3.5.1
71 VAR_OPSYS[freebsd]= CONFIGURE_ARGS=--enable-netmap
72 CONFIGURE_ARGS=--disable-linux-user
73 CONFIGURE_ARGS=--disable-linux-aio
74 VAR_OPSYS[linux]= CONFIGURE_ARGS=--disable-netmap
75 VAR_OPSYS[dragonfly]= CONFIGURE_ARGS=--disable-netmap
76 CONFIGURE_ARGS=--disable-linux-user
77 CONFIGURE_ARGS=--disable-linux-aio
80 ${REINPLACE_CMD} -e '/LIBS/s|-lprocstat|-lprocstat -lelf|' \
81 -e '/libusb/s/ --atleast-version=1\.0\.[0-9]*//' \
84 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing|" \
85 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
86 ${WRKSRC}/Makefile.target
88 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing -I.|" \
89 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
92 -e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \
93 ${WRKSRC}/scripts/texi2pod.pl
94 # GNS3 (promiscuous multicast)
95 ${REINPLACE_CMD} -e 's|(buf\[0\] & 1) && (rctl & E1000_RCTL_MPE)|buf[0] \& 1|' \
96 ${WRKSRC}/hw/net/e1000.c
97 # broken build for optionrom
98 ${REINPLACE_CMD} -e '/roms="optionrom"/d' ${WRKSRC}/configure
99 # silence some include warnings
100 ${MKDIR} ${WRKSRC}/bsd-user/dragonfly
103 # for some reason file is considered out-of-date
104 ${TOUCH} ${WRKSRC}/config-host.mak
106 post-patch-dragonfly:
107 ${REINPLACE_CMD} -e '/libs_qga=..glib_libs/ s|glib_libs|glib_libs -lintl|' \
111 ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample \
112 ${STAGEDIR}${PREFIX}/etc
113 ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample \
114 ${STAGEDIR}${PREFIX}/etc
115 ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-*
116 (cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${STD_DOCDIR}/)
117 # remove empty directories
118 ${RM} -r ${STAGEDIR}/var
121 ${REINPLACE_CMD} -e '/libs_qga=..glib_libs/ s|glib_libs|glib_libs -lintl|' \
124 [FILE:782:descriptions/desc.primary]
125 QEMU is a fast processor emulator using dynamic translation to achieve
126 good emulation speed. QEMU has two operating modes:
128 * Full system emulation. In this mode, QEMU emulates a full system (for
129 example a PC), including a processor and various peripherials. It can
130 be used to launch different Operating Systems without rebooting the PC
131 or to debug system code.
132 * User mode emulation (Linux host only). In this mode, QEMU can launch
133 Linux processes compiled for one CPU on another CPU. It can be used to
134 launch the Wine Windows API emulator or to ease cross-compilation and
137 As QEMU requires no host kernel patches to run, it is safe and easy to use.
139 See also the preconfigured system images on http://oszoo.org/
140 Many live cd isos also work.
144 c9174eb5933d9eb5e61f541cd6d1184cd3118dfe4c5c4955bc1bdc4d390fa4e5 62911540 qemu-5.1.0.tar.xz
147 [FILE:3510:manifests/plist.primary]
148 @sample etc/qemu-ifdown.sample
149 @sample etc/qemu-ifup.sample
185 %%ONLY-LINUX%%libexec/qemu-bridge-helper
206 qemu-system-microblaze
207 qemu-system-microblazeel
226 qemu-system-unicore32
231 share/applications/qemu.desktop
232 share/icons/hicolor/128x128/apps/qemu.png
233 share/icons/hicolor/16x16/apps/qemu.png
234 share/icons/hicolor/24x24/apps/qemu.png
235 share/icons/hicolor/256x256/apps/qemu.png
236 share/icons/hicolor/32x32/apps/
239 share/icons/hicolor/48x48/apps/qemu.png
240 share/icons/hicolor/512x512/apps/qemu.png
241 share/icons/hicolor/64x64/apps/qemu.png
242 share/icons/hicolor/scalable/apps/qemu.svg
247 qemu-block-drivers.7.gz
266 edk2-i386-secure-code.fd
270 edk2-x86_64-secure-code.fd
287 opensbi-riscv32-sifive_u-fw_jump.bin
288 opensbi-riscv32-virt-fw_jump.bin
289 opensbi-riscv64-sifive_u-fw_jump.bin
290 opensbi-riscv64-virt-fw_jump.bin
293 petalogix-s3adsp1800.dtb
309 u-boot-sam460-20100605.bin
312 vgabios-bochs-display.bin
321 50-edk2-i386-secure.json
322 50-edk2-x86_64-secure.json
364 [FILE:11393:manifests/plist.docs]
365 share/doc/qemu/index.html
368 amd-memory-encryption.txt
370 block-replication.txt
386 multi-thread-compression.txt
389 pci_expander_bridge.txt
396 qemu-option-trace.rst.inc
406 virtio-balloon-stats.txt
407 virtio-net-failover.rst
410 xen-save-devices-state.txt
411 share/doc/qemu/docs/built/index.html
412 share/doc/qemu/docs/built/devel/
424 multi-thread-tcg.html
430 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
469 share/doc/qemu/docs/built/interop/_static/
474 documentation_options.js
485 share/doc/qemu/docs/built/specs/
488 acpi_hw_reduced_hotplug.html
497 share/doc/qemu/docs/built/specs/_static/
502 documentation_options.js
513 share/doc/qemu/docs/built/system/
532 qemu-block-drivers.html
556 share/doc/qemu/docs/built/system/_static/
561 documentation_options.js
572 share/doc/qemu/docs/built/system/arm/
592 share/doc/qemu/docs/built/system/s390x/
598 share/doc/qemu/docs/built/tools/
611 virtfs-proxy-helper.1
612 virtfs-proxy-helper.html
615 share/doc/qemu/docs/built/tools/_static/
620 documentation_options.js
631 share/doc/qemu/docs/built/user/
639 share/doc/qemu/docs/built/user/_static/
644 documentation_options.js
655 share/doc/qemu/docs/config/
657 mach-virt-graphical.cfg
660 q35-virtio-graphical.cfg
661 q35-virtio-serial.cfg
662 share/doc/qemu/docs/devel/
679 multiple-iothreads.txt
685 secure-coding-practices.rst
693 writing-qmp-commands.txt
694 share/doc/qemu/docs/interop/
701 live-block-operations.rst
727 vnc-ledstate-Pseudo-encoding.txt
728 share/doc/qemu/docs/specs/
731 acpi_hw_reduced_hotplug.rst
744 ppc-spapr-hotplug.txt
745 ppc-spapr-uv-hcalls.txt
755 share/doc/qemu/docs/sphinx/
760 share/doc/qemu/docs/sphinx/__pycache__/
761 hxtool.cpython-38.pyc
762 kerneldoc.cpython-38.pyc
763 kernellog.cpython-38.pyc
764 qmp_lexer.cpython-%%PYTHON_SUFFIX%%.pyc
765 share/doc/qemu/docs/spin/
767 aio_notify_accept.promela
768 aio_notify_bug.promela
769 tcg-exclusive.promela
770 win32-qemu-event.promela
771 share/doc/qemu/docs/system/
774 cpu-models-mips.rst.inc
775 cpu-models-x86.rst.inc
777 device-url-syntax.rst.inc
792 qemu-block-drivers.rst
793 qemu-block-drivers.rst.inc
800 target-i386-desc.rst.inc
814 share/doc/qemu/docs/system/arm/
834 share/doc/qemu/docs/system/s390x/
840 share/doc/qemu/docs/tools/
846 virtfs-proxy-helper.rst
848 share/doc/qemu/docs/user/
852 share/doc/qemu/interop/
859 live-block-operations.html
872 share/doc/qemu/interop/_static/
877 documentation_options.js
888 share/doc/qemu/specs/
891 acpi_hw_reduced_hotplug.html
900 share/doc/qemu/specs/_static/
905 documentation_options.js
916 share/doc/qemu/system/
934 qemu-block-drivers.html
956 share/doc/qemu/system/_static/
961 documentation_options.js
972 share/doc/qemu/system/arm/
992 share/doc/qemu/system/s390x/
998 share/doc/qemu/tools/
1005 qemu-trace-stap.html
1008 virtfs-proxy-helper.html
1010 share/doc/qemu/tools/_static/
1015 documentation_options.js
1017 jquery-%%JQUERY%%.js
1026 share/doc/qemu/user/
1034 share/doc/qemu/user/_static/
1039 documentation_options.js
1041 jquery-%%JQUERY%%.js
1052 [FILE:297:manifests/plist.nls]
1053 share/locale/bg/LC_MESSAGES/qemu.mo
1054 share/locale/de_DE/LC_MESSAGES/qemu.mo
1055 share/locale/fr_FR/LC_MESSAGES/qemu.mo
1056 share/locale/hu/LC_MESSAGES/qemu.mo
1057 share/locale/it/LC_MESSAGES/qemu.mo
1058 share/locale/sv/LC_MESSAGES/qemu.mo
1059 share/locale/tr/LC_MESSAGES/qemu.mo
1060 share/locale/zh_CN/LC_MESSAGES/qemu.mo
1063 [FILE:3366:patches/patch-configure]
1064 --- configure.orig 2020-08-11 19:17:15 UTC
1066 @@ -501,6 +501,9 @@ numa=""
1076 @@ -1191,6 +1194,10 @@ for opt do
1078 --enable-vnc-png) vnc_png="yes"
1080 + --enable-pcap) pcap="yes"
1082 + --disable-pcap) pcap="no"
1084 --disable-slirp) slirp="no"
1086 --enable-slirp=git) slirp="git"
1087 @@ -3246,6 +3253,14 @@ if check_include "sys/signal.h" ; then
1090 ##########################################
1091 +# getifaddrs (for tests/test-io-channel-socket )
1094 +if ! check_include "ifaddrs.h" ; then
1098 +##########################################
1101 if test "$vte" != "no"; then
1102 @@ -5252,7 +5267,7 @@ fi
1105 if test "$libusb" != "no" ; then
1106 - if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
1107 + if $pkg_config libusb-1.0; then
1109 libusb_cflags=$($pkg_config --cflags libusb-1.0)
1110 libusb_libs=$($pkg_config --libs libusb-1.0)
1111 @@ -6514,6 +6529,50 @@ EOF
1115 +##########################################
1118 +if test "$pcap" = "yes" -a "$pcap" != "no"; then
1119 + cat > $TMPC << EOF
1121 +int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); }
1123 + if test "$mingw32" = "no" ; then
1128 + if compile_prog "" "$libpcap" ; then
1132 + echo "Error: Could not find pcap"
1133 + echo "Make sure to have the pcap libs and headers installed."
1137 + cat > $TMPC << EOF
1141 + char errbuf[PCAP_ERRBUF_SIZE];
1142 + return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0);
1145 + if compile_prog "" "$libpcap" ; then
1148 + cat > $TMPC << EOF
1149 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
1151 +#include <net/bpf.h>
1152 +int main(void) { return (BPF_MAJOR_VERSION); }
1154 + if compile_prog ; then
1157 + libs_softmmu="$libpcap $libs_softmmu"
1160 ##########################################
1162 @@ -6910,6 +6969,7 @@ echo "Audio drivers $audio_drv_list"
1163 echo "Block whitelist (rw) $block_drv_rw_whitelist"
1164 echo "Block whitelist (ro) $block_drv_ro_whitelist"
1165 echo "VirtFS support $virtfs"
1166 +echo "pcap support $pcap"
1167 echo "Multipath support $mpath"
1168 echo "VNC support $vnc"
1169 if test "$vnc" = "yes" ; then
1170 @@ -7153,6 +7213,15 @@ fi
1171 if test "$want_tools" = "yes" ; then
1172 echo "CONFIG_TOOLS=y" >> $config_host_mak
1174 +if test "$pcap" = "yes" ; then
1175 + echo "CONFIG_PCAP=y" >> $config_host_mak
1176 + if test "$pcap_create" = "yes" ; then
1177 + echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak
1179 + if test "$bpf" = "yes" ; then
1180 + echo "CONFIG_BPF=y" >> $config_host_mak
1183 if test "$slirp" != "no"; then
1184 echo "CONFIG_SLIRP=y" >> $config_host_mak
1185 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
1186 @@ -7420,6 +7489,9 @@ fi
1187 if test "$have_fsxattr" = "yes" ; then
1188 echo "HAVE_FSXATTR=y" >> $config_host_mak
1190 +if test "$have_ifaddrs_h" = "yes" ; then
1191 + echo "HAVE_IFADDRS_H=y" >> $config_host_mak
1193 if test "$have_copy_file_range" = "yes" ; then
1194 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
1198 [FILE:365:patches/patch-disas_libvixl_vixl_a64_disasm-a64.cc]
1199 --- disas/libvixl/vixl/a64/disasm-a64.cc.orig 2020-08-11 19:17:14 UTC
1200 +++ disas/libvixl/vixl/a64/disasm-a64.cc
1201 @@ -2693,7 +2693,7 @@ void Disassembler::AppendPCRelativeOffse
1203 abs_offset = -abs_offset;
1205 - AppendToOutput("#%c0x%" PRIx64, sign, abs_offset);
1206 + AppendToOutput("#%c0x%" PRIx64, sign, offset < 0 ? -offset : offset);
1212 [FILE:582:patches/patch-include_net_net.h]
1213 --- include/net/net.h.orig 2020-08-11 19:17:15 UTC
1214 +++ include/net/net.h
1215 @@ -209,8 +209,8 @@ void netdev_add(QemuOpts *opts, Error **
1216 int net_hub_id_for_client(NetClientState *nc, int *id);
1217 NetClientState *net_hub_port_find(int hub_id);
1219 -#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
1220 -#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
1221 +#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup"
1222 +#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown"
1223 #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
1224 #define DEFAULT_BRIDGE_INTERFACE "br0"
1228 [FILE:563:patches/patch-net_clients.h]
1229 --- net/clients.h.orig 2020-08-11 19:17:15 UTC
1231 @@ -61,6 +61,12 @@ int net_init_netmap(const Netdev *netdev
1232 int net_init_vhost_user(const Netdev *netdev, const char *name,
1233 NetClientState *peer, Error **errp);
1236 +int net_init_pcap(const Netdev *netdev, const char *name,
1237 + NetClientState *peer, Error **errp);
1241 int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
1242 NetClientState *peer, Error **errp);
1243 #endif /* QEMU_NET_CLIENTS_H */
1246 [FILE:6930:patches/patch-net_net.c]
1247 --- net/net.c.orig 2020-08-11 19:17:15 UTC
1250 #include "net/filter.h"
1251 #include "qapi/string-output-visitor.h"
1253 +#include <sys/ioctl.h>
1254 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1255 +#include <net/if.h>
1258 /* Net bridge is currently not supported for W32. */
1259 #if !defined(_WIN32)
1260 # define CONFIG_NET_BRIDGE
1261 @@ -942,7 +947,225 @@ static int net_init_nic(const Netdev *ne
1265 +#if defined(CONFIG_PCAP)
1266 +#if defined(CONFIG_BPF)
1267 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
1268 +#include <net/bpf.h>
1273 + NetClientState nc;
1275 + int max_eth_frame_size;
1278 +static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
1280 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1282 + return pcap_inject(s->handle, (u_char*)buf, size);
1285 +static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata
1288 + NetClientState *nc = (NetClientState *)user;
1290 + int len = phdr->len;
1291 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1292 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1293 + int max_eth_frame_size = s->max_eth_frame_size;
1295 + if (len > max_eth_frame_size) {
1297 + "pcap_send: packet size > %d (%d), truncating\n",
1298 + max_eth_frame_size, len);
1299 + len = max_eth_frame_size;
1302 + qemu_send_packet(nc, pdata, len);
1305 +static void pcap_send(void *opaque)
1307 + struct PCAPState *s = (struct PCAPState *)opaque;
1310 + if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0)
1315 +static void pcap_cleanup(NetClientState *nc)
1317 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1319 + qemu_purge_queued_packets(nc);
1320 + pcap_close(s->handle);
1323 +static NetClientInfo net_pcap_info = {
1324 + .type = NET_CLIENT_DRIVER_PCAP,
1325 + .size = sizeof(struct PCAPState),
1326 + .receive = pcap_receive,
1327 +// .receive_raw = pcap_receive_raw,
1328 +// .receive_iov = pcap_receive_iov,
1329 +// .poll = pcap_poll,
1330 + .cleanup = pcap_cleanup,
1333 + * ... -net pcap,ifname="..."
1336 +int net_init_pcap(const Netdev *netdev,
1337 + const char *name, NetClientState *peer, Error **errp)
1339 + const NetdevPcapOptions *pcap_opts;
1340 + NetClientState *nc;
1341 + struct PCAPState *s;
1342 + const char *ifname;
1343 + char errbuf[PCAP_ERRBUF_SIZE];
1344 +#if defined(_WIN32)
1349 + assert(netdev->type == NET_CLIENT_DRIVER_PCAP);
1350 + pcap_opts = &netdev->u.pcap;
1351 + if (!pcap_opts->has_ifname)
1354 + ifname = pcap_opts->ifname;
1356 + /* create the object */
1357 + nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname);
1358 + s = DO_UPCAST(struct PCAPState, nc, nc);
1360 + if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
1361 + fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1365 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1367 + * We want to avoid passing oversize packets to the guest, which
1368 + * at least on FreeBSD can happen if the host interface uses tso
1369 + * (seen with an em(4) in this case) - so find out the host
1370 + * interface's mtu and assume the guest is configured the same.
1372 + s->max_eth_frame_size = 1514;
1373 + i = socket(AF_INET, SOCK_DGRAM, 0);
1377 + (void) memset(&ifr, 0, sizeof(ifr));
1378 + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
1379 + if (ioctl(i, SIOCGIFMTU, &ifr) != -1)
1380 + s->max_eth_frame_size = ifr.ifr_mtu + 14;
1385 +#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32)
1387 + * Create pcap handle for the device, set promiscuous mode and activate.
1389 + s->handle = (void *)pcap_create(ifname, errbuf);
1391 + fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1394 + if (pcap_set_promisc(s->handle, 1) != 0) {
1395 + pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:");
1398 + if (pcap_activate(s->handle) != 0) {
1399 + pcap_perror(s->handle, (char *)"qemu: pcap_activate:");
1403 + /* Attempt to connect device. */
1404 + s->handle = (void *)pcap_open_live(ifname, 65535, 1, 0, errbuf);
1406 + fprintf(stderr, "qemu: pcap_open_live: %s\n", errbuf);
1411 + /* Set non-blocking mode. */
1412 + if (pcap_setnonblock(s->handle, 1, errbuf) < 0) {
1413 + fprintf(stderr, "qemu: pcap_setnonblock: %s\n", errbuf);
1417 +#if defined(_WIN32)
1419 + * Tell the kernel that the packet has to be seen immediately.
1421 + if (pcap_setmintocopy(s->handle, 0) < 0) {
1422 + fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1425 +#else /* !_WIN32 */
1426 +#if defined(CONFIG_BPF)
1427 +#if defined(BIOCIMMEDIATE)
1429 + * Tell the kernel that the packet has to be seen immediately.
1432 + unsigned int one = 1;
1433 + if (ioctl(pcap_fileno(s->handle), BIOCIMMEDIATE, &one) < 0) {
1434 + fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1438 +#endif /* BIOCIMMEDIATE */
1439 +#if defined(BIOCFEEDBACK)
1441 + * Tell the kernel that the sent packet has to be fed back.
1442 + * This is necessary to connect host and guest.
1445 + unsigned int one = 1;
1446 + if (ioctl(pcap_fileno(s->handle), BIOCFEEDBACK, &one) < 0) {
1447 + fprintf(stderr, "qemu: pcap failed to set feedback mode\n");
1451 +#endif /* BIOCFEEDBACK */
1452 +#endif /* CONFIG_BPF */
1453 +#endif /* _WIN32 */
1455 + snprintf(s->nc.info_str, sizeof(s->nc.info_str), "pcap redirector");
1457 +#if defined(_WIN32)
1458 + if ((h = pcap_getevent(s->handle)) == NULL) {
1459 + fprintf(stderr, "qemu: pcap_getevent failed\n");
1462 + qemu_add_wait_object(h, pcap_send, s);
1463 +#else /* !_WIN32 */
1464 + if ((i = pcap_get_selectable_fd(s->handle)) < 0) {
1465 + fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n");
1468 + qemu_set_fd_handler(i, pcap_send, NULL, s);
1469 +#endif /* _WIN32 */
1476 + pcap_close(s->handle);
1484 static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])(
1485 const Netdev *netdev,
1487 @@ -972,6 +1195,9 @@ static int (* const net_client_init_fun[
1488 #ifdef CONFIG_L2TPV3
1489 [NET_CLIENT_DRIVER_L2TPV3] = net_init_l2tpv3,
1492 + [NET_CLIENT_DRIVER_PCAP] = net_init_pcap,
1499 [FILE:423:patches/patch-net_tap-bsd.c]
1500 --- net/tap-bsd.c.orig 2020-08-11 19:17:15 UTC
1504 #if defined(__NetBSD__) || defined(__FreeBSD__)
1505 #include <sys/ioctl.h>
1506 +#include <sys/socket.h>
1508 #include <net/if_tap.h>
1510 +#if defined(__DragonFly)
1511 +#include <sys/ioctl.h>
1512 +#include <sys/socket.h>
1513 +#include <net/if.h>
1514 +#include <net/tap/if_tap.h>
1517 #if defined(__OpenBSD__)
1518 #include <sys/param.h>
1521 [FILE:1028:patches/patch-qapi_net.json]
1522 --- qapi/net.json.orig 2020-08-11 19:17:15 UTC
1524 @@ -374,6 +374,19 @@
1525 '*helper': 'str' } }
1528 +# @NetdevPcapOptions:
1530 +# Use ifname as a source to capture
1532 +# @ifname: #required to determine which interface to capture
1536 +{ 'struct': 'NetdevPcapOptions',
1538 + '*ifname': 'str' } }
1541 # @NetdevHubPortOptions:
1543 # Connect two or more net clients through a software hub.
1546 { 'enum': 'NetClientDriver',
1547 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1548 - 'bridge', 'hubport', 'netmap', 'vhost-user', 'vhost-vdpa' ] }
1549 + 'bridge', 'hubport', 'netmap', 'vhost-user', 'vhost-vdpa', 'pcap' ] }
1554 'user': 'NetdevUserOptions',
1555 'tap': 'NetdevTapOptions',
1556 'l2tpv3': 'NetdevL2TPv3Options',
1557 + 'pcap': 'NetdevPcapOptions',
1558 'socket': 'NetdevSocketOptions',
1559 'vde': 'NetdevVdeOptions',
1560 'bridge': 'NetdevBridgeOptions',
1563 [FILE:314:patches/patch-util_getauxval.c]
1564 --- util/getauxval.c.orig 2020-08-11 19:17:15 UTC
1565 +++ util/getauxval.c
1566 @@ -98,7 +98,7 @@ unsigned long qemu_getauxval(unsigned lo
1570 -#elif defined(__FreeBSD__)
1571 +#elif defined(__FreeBSD__) && __FreeBSD_version__ > 1200001
1572 #include <sys/auxv.h>
1574 unsigned long qemu_getauxval(unsigned long type)
1577 [FILE:7685:files/pkg-message-single]
1581 - Needs to set net.link.tap.user_open sysctl in order to use /dev/tap*
1582 networking as non-root. Don't forget to adjust device node permissions in
1585 - slirp (usermode networking) is fixed now in cvs, on FreeSBIE 1.0 guests you
1586 still have to manually do: echo nameserver 10.0.2.3 >/etc/resolv.conf but
1587 i've been told that that's normal. (fixed on FreeSBIE 1.1.) And you have
1588 to wait a bit for dhclient to do its thing; traffic to address 10.0.2.2 is
1589 routed to 127.1 on the host.
1591 - Expect timer problems when guest kernel HZ is > hosts, for example time
1592 sleep 1 takes 49 seconds and booting sleeps for minutes at the acd0 probe
1593 with a FreeSBIE 1.0 guest, thats because its kernel is built with HZ=5000,
1594 and FreeBSD's default is 100... (no longer a problem with FreeSBIE 1.1.)
1595 The linux 2.6 kernel uses 1000 by default btw. (changed to 250 later, and
1596 recent linux kernels now no longer have a fixed HZ, aka `tickless
1597 kernel'...) Enabling /dev/rtc doesn't seem to help either (not included
1598 since it needs a patch to emulators/rtc.)
1600 - Update: the above problem has gotten worse with FreeBSD guests
1601 somewhere before 8.0, mainly since the kernel now usually wants
1602 double or even quadruple number of timer irqs compared to HZ if
1603 it detects an apic (and at least early versions of FreeBSD 8 had
1604 a bug that essentially halved qemu's clock rate too); the only
1605 reason you usually don't see symptoms of this with FreeBSD 8
1606 guests is they automatically reduce their HZ to 100 when running
1607 in a VM while the default for the host kernel is still HZ=1000.
1608 Workaround: you can disable the apic clock in the guest by setting
1610 hint.apic.0.clock="0"
1612 in loader.conf(5) (or manually at the loader prompt), if that
1613 doesn't work the only things you can do is either reduce the
1614 guest's HZ to, say, 100 by setting e.g.
1618 from the loader as above (which usually is a good idea in a VM
1619 anyway and FreeBSD 8 now does by itself as mentioned), or otherwise
1620 increase the host's HZ to 2000 or even 4000 from the loader in
1623 - The -smb option (smb-export local dir to guest using the default
1624 slirp networking) needs the samba port/package installed
1625 in addition to qemu. (SAMBA knob.)
1627 - If you want to use usb devices connected to the host in the guest
1628 yot need either recent 10-current (not tested yet much) or you can
1629 use usbredir over the network (see below); also unless you are
1630 running qemu as root you then need to fix permissions for /dev/ugen*
1631 device nodes: if you are on 5.x or later (devfs) put a rule in
1632 /etc/devfs.rules, activate it in /etc/rc.conf and run /etc/rc.d/devfs
1633 restart. Example devfs.rules:
1636 add path 'ugen*' mode 660 group operator
1638 corresponding rc.conf line:
1640 devfs_system_ruleset="ugen_ruleset"
1642 - If you want to test the new (in 0.15.0) usb network redirection (USBREDIR
1643 option) see this thread by Hans de Goede <hdegoede <at> redhat.com>:
1645 http://thread.gmane.org/gmane.comp.emulators.qemu/110176/focus=110183
1651 1) Start usbredirserver for a usb device:
1652 sudo usbredirserver 045e:0772
1653 2) Start qemu with usb2 support + a chardev talking to usbredirserver +
1654 a usb-redir device using this chardev:
1656 -readconfig docs/ich9-ehci-uhci.cfg \
1657 -chardev socket,id=usbredirchardev,host=localhost,port=4000 \
1658 -device usb-redir,chardev=usbredirchardev,id=usbredirdev ...
1660 [you would replace docs/ich9-ehci-uhci.cfg with e.g.
1661 /raven/share/doc/qemu/docs/ich9-ehci-uhci.cfg, but turns out
1662 ehci was broken for me here with FreeBSD guests and the previous
1663 qemu version at least, I got:
1665 FETCHENTRY: entry at 22C5484 is of type 2 which is not supported yet processing error - resetting ehci HC
1666 Assertion failed: (0), function ehci_advance_state, file /data/ports/emulators/qemu-devel/work/qemu-0.15.0/hw/usb-ehci.c, line 2045.
1668 The new qemu version works better tho.]
1670 - Still usb: since the hub is no longer attached to the uchi controller and
1671 the wakeup mechanism, resume interrupt is not implemented yet linux guests
1672 will suspend the bus, i.e. they wont see devices usb_add'ed after its
1673 (linux') uhci module got loaded. Workaround: either add devices before
1674 linux loads the module or rmmod and modprobe it afterwards. [Not sure
1675 if this still applies to the new libusb host code used on recent
1678 - If you build qemu wihout SDL and then get crashes running it try passing it
1679 -nographic. This should probably be default in that case...
1681 - qemu's network boot roms (-boot n) have a bug when bootfiles sizes are a
1682 multiple of blksize, if this affects you (like with FreeBSD's /boot/pxeboot)
1685 cp /boot/pxeboot pxeboot-qemu && chmod +w pxeboot-qemu && echo >>pxeboot-qemu
1687 and then use pxeboot-qemu. Actually you need recent btx code
1688 (from after 7.0 was released) because of the real mode boot
1689 problem, so use at least pxeboot from there. And I just did that
1690 for the pxeboot extracted out of
1692 ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/200805/7.0-STABLE-200805-i386-bootonly.iso
1696 http://people.freebsd.org/~nox/qemu/pxeboot-qemu
1698 - If you use slirp (usernet, the default) and want to mount nfs into the guest
1699 and you are not running qemu as root, then mountd(8) on the exporting box
1700 needs to be run with -n in order to accept requests from ports >= 1024.
1702 - (not FreeBSD-specific:) There have been reports of qcow2 corruption with (at
1703 least) win2k guests on recent kvm (which uses similar qcow2 code than qemu
1704 now, see this thread:
1706 http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00713.html -
1708 the consensus on that thread seems to be that qcow(2) code has always been
1709 experimental and you should use raw images if you want reliability; raw is
1710 also usually faster.) You should be able to migrate existing images to raw
1711 using qemu-img(1)'s convert function; raw doesn't support advanced features
1712 like snapshots tho. [a few important qcow2 bugfixed have been committed in
1713 the meantime so this _might_ be less of an issue now; and meanwhile there
1714 also is the new qed format - I don't know how stable that one is.]
1716 - (also not FreeBSD-specific:) It is recommended to pass raw images using the
1717 new -drive syntax, specifying format=raw explicitly in order to avoid
1718 malicious guests being able to exploit the format autodetection thats
1719 otherwise getting used. (Not that you should run malicious guests anyway,
1720 but this eleminates at least a known attack vector.)
1722 - qemu now has improved physical cdrom support, but still there is at
1723 least one known problem: you need to have the guest eject the disc if you
1724 want to change it/take it out, or otherwise the guest may continue using
1725 state (like size) of the old disc. (You can also do like `change ide1-cd0
1726 /dev/acd0' in the monitor after taking out the disc if a guest cannot eject
1729 - The default configuration location (qemu-ifup script etc.) has been changed
1730 from /etc to PREFIX/etc (usually /raven/etc). Move your files accordingly.
1732 - The pcap code (-net nic... -net pcap,ifname=...) should work properly now,
1733 with only one exception: Advanced features like TSO used on the host
1734 interface can cause oversize packets which now do get truncated to avoid
1735 confusing/panicing guests but of course still will cause retransmissions.
1736 So if you see slow throughput and `pcap_send: packet size > ..., truncating'
1737 messages on qemu's tty try disabling TSO etc on the host interface at least
1741 [FILE:20:files/qemu-ifdown.sample]
1746 [FILE:20:files/qemu-ifup.sample]
1751 [FILE:66:files/special.mk]
1752 .if "${ARCH_STANDARD}" == "x86_64"
1753 MAKE_ARGS+= ARCH=x86_64
1757 [FILE:436:dragonfly/patch-disas_libvixl_vixl_utils.h]
1758 --- disas/libvixl/vixl/utils.h.orig 2020-08-11 19:17:14 UTC
1759 +++ disas/libvixl/vixl/utils.h
1760 @@ -42,6 +42,13 @@ namespace vixl {
1761 #define PRINTF_CHECK(format_index, varargs_index)
1765 +#define INT32_C(c) c
1766 +#define INT64_C(c) (c ## LL)
1767 +#define UINT32_C(c) (c ## U)
1768 +#define UINT64_C(c) (c ## ULL)
1771 // Check number width.
1772 inline bool is_intn(unsigned n, int64_t x) {
1773 VIXL_ASSERT((0 < n) && (n < 64));
1776 [FILE:323:dragonfly/patch-hw-ppc_newworld.c]
1777 --- hw/ppc/mac_newworld.c.orig 2020-08-11 19:17:15 UTC
1778 +++ hw/ppc/mac_newworld.c
1780 #include "hw/sysbus.h"
1783 +/* FreeBSD headers define this */
1788 #define MAX_IDE_BUS 2
1789 #define CFG_ADDR 0xf0000510
1790 #define TBFREQ (100UL * 1000UL * 1000UL)
1793 [FILE:334:dragonfly/patch-hw_ppc_mac__oldworld.c]
1794 --- hw/ppc/mac_oldworld.c.orig 2020-08-11 19:17:15 UTC
1795 +++ hw/ppc/mac_oldworld.c
1798 #define GRACKLE_BASE 0xfec00000
1800 +/* FreeBSD headers define this */
1805 static void fw_cfg_boot_set(void *opaque, const char *boot_device,
1810 [FILE:906:dragonfly/patch-util_coroutine-ucontext.c]
1811 --- util/coroutine-ucontext.c.orig 2020-08-11 19:17:15 UTC
1812 +++ util/coroutine-ucontext.c
1813 @@ -221,7 +221,15 @@ Coroutine *qemu_coroutine_new(void)
1814 2, arg.i[0], arg.i[1]);
1816 /* swapcontext() in, siglongjmp() back out */
1817 - if (!sigsetjmp(old_env, 0)) {
1818 + /* Save signal mask in this sigsetjmp, because makecontext on DragonFly
1819 + * leaves all signals blocked when entering the new context with
1821 + * Workaround this, by just having the signal mask restored by the
1822 + * siglongjmp that brings us back from qemu_coroutine_new().
1823 + * XXX Remove this workaround when the makecontext behaviour is fixed
1826 + if (!sigsetjmp(old_env, 1)) {
1827 start_switch_fiber_asan(COROUTINE_YIELD, &fake_stack_save, co->stack,
1829 start_switch_fiber_tsan(&fake_stack_save,