1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
8 SDESC[standard]= Fast CPU emulator and virtualizer for x86 platform
9 HOMEPAGE= https://www.qemu.org/
13 SITES[main]= https://download.qemu.org/
14 DISTFILE[1]= qemu-5.0.0.tar.xz:main
16 SPKGS[standard]= complete
21 OPTIONS_AVAILABLE= none
22 OPTIONS_STANDARD= none
24 BUILD_DEPENDS= texi2html:primary:standard
25 python-Sphinx:single:python_default
26 BUILDRUN_DEPENDS= nettle:primary:standard
27 fontconfig:primary:standard
28 freetype:primary:standard
29 gnutls:primary:standard
30 cyrus-sasl:primary:standard
33 libepoxy:single:standard
35 USES= cpe gmake pkgconfig bison perl:build python:build
36 jpeg png mesa gettext-runtime gettext-tools ncurses
38 GNOME_COMPONENTS= gdkpixbuf gtk2 vte
40 XORG_COMPONENTS= x11 xext
42 LICENSE= GPLv2:primary
43 LICENSE_TERMS= primary:{{WRKSRC}}/LICENSE
44 LICENSE_FILE= GPLv2:{{WRKSRC}}/COPYING
47 FPC_EQUIVALENT= emulators/qemu
50 CONFIGURE_ARGS= --disable-usb-redir
51 --disable-stack-protector
61 --python={{PYTHON_CMD}}
63 --extra-cflags="-I{{WRKSRC}} -I{{LOCALBASE}}/include -DPREFIX=\\\"\"{{PREFIX}}\\\"\""
64 --extra-ldflags="-L/usr/lib -L{{LOCALBASE}}/lib"
66 MAKE_ENV= BSD_MAKE="{{MAKE}}"
69 INSTALL_REQ_TOOLCHAIN= yes
70 PLIST_SUB= JQUERY=3.5.1
72 VAR_OPSYS[freebsd]= CONFIGURE_ARGS=--enable-netmap
73 CONFIGURE_ARGS=--disable-linux-user
74 CONFIGURE_ARGS=--disable-linux-aio
75 VAR_OPSYS[linux]= CONFIGURE_ARGS=--disable-netmap
76 VAR_OPSYS[dragonfly]= CONFIGURE_ARGS=--disable-netmap
77 CONFIGURE_ARGS=--disable-linux-user
78 CONFIGURE_ARGS=--disable-linux-aio
81 ${REINPLACE_CMD} -e '/LIBS/s|-lprocstat|-lprocstat -lelf|' \
82 -e '/libusb/s/ --atleast-version=1\.0\.[0-9]*//' \
85 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing|" \
86 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
87 ${WRKSRC}/Makefile.target
89 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing -I.|" \
90 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
93 -e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \
94 ${WRKSRC}/scripts/texi2pod.pl
95 # GNS3 (promiscuous multicast)
96 ${REINPLACE_CMD} -e 's|(buf\[0\] & 1) && (rctl & E1000_RCTL_MPE)|buf[0] \& 1|' \
97 ${WRKSRC}/hw/net/e1000.c
98 # broken build for optionrom
99 ${REINPLACE_CMD} -e '/roms="optionrom"/d' ${WRKSRC}/configure
100 # silence some include warnings
101 ${MKDIR} ${WRKSRC}/bsd-user/dragonfly
104 # for some reason file is considered out-of-date
105 ${TOUCH} ${WRKSRC}/config-host.mak
107 post-patch-dragonfly:
108 ${REINPLACE_CMD} -e '/libs_qga=..glib_libs/ s|glib_libs|glib_libs -lintl|' \
112 ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample \
113 ${STAGEDIR}${PREFIX}/etc
114 ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample \
115 ${STAGEDIR}${PREFIX}/etc
116 ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-*
117 (cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${STD_DOCDIR}/)
118 # remove empty directories
119 ${RM} -r ${STAGEDIR}/var
122 ${REINPLACE_CMD} -e '/libs_qga=..glib_libs/ s|glib_libs|glib_libs -lintl|' \
125 [FILE:782:descriptions/desc.primary]
126 QEMU is a fast processor emulator using dynamic translation to achieve
127 good emulation speed. QEMU has two operating modes:
129 * Full system emulation. In this mode, QEMU emulates a full system (for
130 example a PC), including a processor and various peripherials. It can
131 be used to launch different Operating Systems without rebooting the PC
132 or to debug system code.
133 * User mode emulation (Linux host only). In this mode, QEMU can launch
134 Linux processes compiled for one CPU on another CPU. It can be used to
135 launch the Wine Windows API emulator or to ease cross-compilation and
138 As QEMU requires no host kernel patches to run, it is safe and easy to use.
140 See also the preconfigured system images on http://oszoo.org/
141 Many live cd isos also work.
145 2f13a92a0fa5c8b69ff0796b59b86b080bbb92ebad5d301a7724dd06b5e78cb6 62426192 qemu-5.0.0.tar.xz
148 [FILE:3493:manifests/plist.primary]
149 @sample etc/qemu-ifdown.sample
150 @sample etc/qemu-ifup.sample
186 %%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:10655:manifests/plist.docs]
373 amd-memory-encryption.txt
375 block-replication.txt
391 multi-thread-compression.txt
394 pci_expander_bridge.txt
401 qemu-option-trace.rst.inc
411 virtio-balloon-stats.txt
412 virtio-net-failover.rst
415 xen-save-devices-state.txt
416 share/doc/qemu/docs/built/index.html
417 share/doc/qemu/docs/built/devel/
433 secure-coding-practices.html
438 share/doc/qemu/docs/built/devel/_static/
443 documentation_options.js
454 share/doc/qemu/docs/built/interop/
461 live-block-operations.html
470 share/doc/qemu/docs/built/interop/_static/
475 documentation_options.js
486 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
554 share/doc/qemu/docs/built/system/_static/
559 documentation_options.js
570 share/doc/qemu/docs/built/system/arm/
582 share/doc/qemu/docs/built/system/s390x/vfio-ap.html
583 share/doc/qemu/docs/built/tools/
596 virtfs-proxy-helper.1
597 virtfs-proxy-helper.html
600 share/doc/qemu/docs/built/tools/_static/
605 documentation_options.js
616 share/doc/qemu/docs/built/user/
624 share/doc/qemu/docs/built/user/_static/
629 documentation_options.js
640 share/doc/qemu/docs/config/
642 mach-virt-graphical.cfg
645 q35-virtio-graphical.cfg
646 q35-virtio-serial.cfg
647 share/doc/qemu/docs/devel/
663 multiple-iothreads.txt
669 secure-coding-practices.rst
676 writing-qmp-commands.txt
677 share/doc/qemu/docs/interop/
684 live-block-operations.rst
709 vnc-ledstate-Pseudo-encoding.txt
710 share/doc/qemu/docs/specs/
712 acpi_hw_reduced_hotplug.rst
725 ppc-spapr-hotplug.txt
726 ppc-spapr-uv-hcalls.txt
736 share/doc/qemu/docs/sphinx/
741 share/doc/qemu/docs/sphinx/__pycache__/
742 hxtool.cpython-38.pyc
743 kerneldoc.cpython-38.pyc
744 kernellog.cpython-38.pyc
745 qmp_lexer.cpython-%%PYTHON_SUFFIX%%.pyc
746 share/doc/qemu/docs/spin/
748 aio_notify_accept.promela
749 aio_notify_bug.promela
750 tcg-exclusive.promela
751 win32-qemu-event.promela
752 share/doc/qemu/docs/system/
755 cpu-models-mips.rst.inc
756 cpu-models-x86.rst.inc
758 device-url-syntax.rst.inc
773 qemu-block-drivers.rst
774 qemu-block-drivers.rst.inc
780 target-i386-desc.rst.inc
793 share/doc/qemu/docs/system/arm/
805 share/doc/qemu/docs/system/s390x/vfio-ap.rst
806 share/doc/qemu/docs/tools/
812 virtfs-proxy-helper.rst
814 share/doc/qemu/docs/user/
818 share/doc/qemu/interop/
825 live-block-operations.html
833 share/doc/qemu/interop/_static/
838 documentation_options.js
849 share/doc/qemu/specs/
851 acpi_hw_reduced_hotplug.html
860 share/doc/qemu/specs/_static/
865 documentation_options.js
876 share/doc/qemu/system/
894 qemu-block-drivers.html
914 share/doc/qemu/system/_static/
919 documentation_options.js
930 share/doc/qemu/system/arm/
942 share/doc/qemu/system/s390x/vfio-ap.html
943 share/doc/qemu/tools/
953 virtfs-proxy-helper.html
955 share/doc/qemu/tools/_static/
960 documentation_options.js
979 share/doc/qemu/user/_static/
984 documentation_options.js
997 [FILE:261:manifests/plist.nls]
998 share/locale/bg/LC_MESSAGES/qemu.mo
999 share/locale/de_DE/LC_MESSAGES/qemu.mo
1000 share/locale/fr_FR/LC_MESSAGES/qemu.mo
1001 share/locale/hu/LC_MESSAGES/qemu.mo
1002 share/locale/it/LC_MESSAGES/qemu.mo
1003 share/locale/tr/LC_MESSAGES/qemu.mo
1004 share/locale/zh_CN/LC_MESSAGES/qemu.mo
1007 [FILE:3416:patches/patch-configure]
1008 --- configure.orig 2020-04-28 16:49:25 UTC
1010 @@ -493,6 +493,9 @@ numa=""
1020 @@ -1168,6 +1171,10 @@ for opt do
1022 --enable-vnc-png) vnc_png="yes"
1024 + --enable-pcap) pcap="yes"
1026 + --disable-pcap) pcap="no"
1028 --disable-slirp) slirp="no"
1030 --enable-slirp=git) slirp="git"
1031 @@ -3137,6 +3144,14 @@ if ! check_include "ifaddrs.h" ; then
1034 ##########################################
1035 +# getifaddrs (for tests/test-io-channel-socket )
1038 +if ! check_include "ifaddrs.h" ; then
1042 +##########################################
1045 if test "$vte" != "no"; then
1046 @@ -5098,7 +5113,7 @@ fi
1049 if test "$libusb" != "no" ; then
1050 - if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
1051 + if $pkg_config libusb-1.0; then
1053 libusb_cflags=$($pkg_config --cflags libusb-1.0)
1054 libusb_libs=$($pkg_config --libs libusb-1.0)
1055 @@ -5501,6 +5516,50 @@ if test "$debug_stack_usage" = "yes"; th
1059 +##########################################
1062 +if test "$pcap" = "yes" -a "$pcap" != "no"; then
1063 + cat > $TMPC << EOF
1065 +int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); }
1067 + if test "$mingw32" = "no" ; then
1072 + if compile_prog "" "$libpcap" ; then
1076 + echo "Error: Could not find pcap"
1077 + echo "Make sure to have the pcap libs and headers installed."
1081 + cat > $TMPC << EOF
1085 + char errbuf[PCAP_ERRBUF_SIZE];
1086 + return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0);
1089 + if compile_prog "" "$libpcap" ; then
1092 + cat > $TMPC << EOF
1093 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
1095 +#include <net/bpf.h>
1096 +int main(void) { return (BPF_MAJOR_VERSION); }
1098 + if compile_prog ; then
1101 + libs_softmmu="$libpcap $libs_softmmu"
1104 ##########################################
1105 # check if we have open_by_handle_at
1106 @@ -6627,6 +6686,7 @@ echo "Audio drivers $audio_drv_list"
1107 echo "Block whitelist (rw) $block_drv_rw_whitelist"
1108 echo "Block whitelist (ro) $block_drv_ro_whitelist"
1109 echo "VirtFS support $virtfs"
1110 +echo "pcap support $pcap"
1111 echo "Multipath support $mpath"
1112 echo "VNC support $vnc"
1113 if test "$vnc" = "yes" ; then
1114 @@ -6864,6 +6924,15 @@ fi
1115 if test "$want_tools" = "yes" ; then
1116 echo "CONFIG_TOOLS=y" >> $config_host_mak
1118 +if test "$pcap" = "yes" ; then
1119 + echo "CONFIG_PCAP=y" >> $config_host_mak
1120 + if test "$pcap_create" = "yes" ; then
1121 + echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak
1123 + if test "$bpf" = "yes" ; then
1124 + echo "CONFIG_BPF=y" >> $config_host_mak
1127 if test "$slirp" != "no"; then
1128 echo "CONFIG_SLIRP=y" >> $config_host_mak
1129 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
1130 @@ -7121,6 +7190,9 @@ fi
1131 if test "$have_fsxattr" = "yes" ; then
1132 echo "HAVE_FSXATTR=y" >> $config_host_mak
1134 +if test "$have_ifaddrs_h" = "yes" ; then
1135 + echo "HAVE_IFADDRS_H=y" >> $config_host_mak
1137 if test "$have_copy_file_range" = "yes" ; then
1138 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
1142 [FILE:365:patches/patch-disas_libvixl_vixl_a64_disasm-a64.cc]
1143 --- disas/libvixl/vixl/a64/disasm-a64.cc.orig 2020-04-28 16:49:24 UTC
1144 +++ disas/libvixl/vixl/a64/disasm-a64.cc
1145 @@ -2693,7 +2693,7 @@ void Disassembler::AppendPCRelativeOffse
1147 abs_offset = -abs_offset;
1149 - AppendToOutput("#%c0x%" PRIx64, sign, abs_offset);
1150 + AppendToOutput("#%c0x%" PRIx64, sign, offset < 0 ? -offset : offset);
1156 [FILE:582:patches/patch-include_net_net.h]
1157 --- include/net/net.h.orig 2020-04-28 16:49:24 UTC
1158 +++ include/net/net.h
1159 @@ -208,8 +208,8 @@ void netdev_add(QemuOpts *opts, Error **
1160 int net_hub_id_for_client(NetClientState *nc, int *id);
1161 NetClientState *net_hub_port_find(int hub_id);
1163 -#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
1164 -#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
1165 +#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup"
1166 +#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown"
1167 #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
1168 #define DEFAULT_BRIDGE_INTERFACE "br0"
1172 [FILE:436:patches/patch-net_clients.h]
1173 --- net/clients.h.orig 2020-04-28 16:49:25 UTC
1175 @@ -61,4 +61,10 @@ int net_init_netmap(const Netdev *netdev
1176 int net_init_vhost_user(const Netdev *netdev, const char *name,
1177 NetClientState *peer, Error **errp);
1180 +int net_init_pcap(const Netdev *netdev, const char *name,
1181 + NetClientState *peer, Error **errp);
1185 #endif /* QEMU_NET_CLIENTS_H */
1188 [FILE:6930:patches/patch-net_net.c]
1189 --- net/net.c.orig 2020-04-28 16:49:25 UTC
1192 #include "net/filter.h"
1193 #include "qapi/string-output-visitor.h"
1195 +#include <sys/ioctl.h>
1196 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1197 +#include <net/if.h>
1200 /* Net bridge is currently not supported for W32. */
1201 #if !defined(_WIN32)
1202 # define CONFIG_NET_BRIDGE
1203 @@ -935,7 +940,225 @@ static int net_init_nic(const Netdev *ne
1207 +#if defined(CONFIG_PCAP)
1208 +#if defined(CONFIG_BPF)
1209 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
1210 +#include <net/bpf.h>
1215 + NetClientState nc;
1217 + int max_eth_frame_size;
1220 +static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
1222 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1224 + return pcap_inject(s->handle, (u_char*)buf, size);
1227 +static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata
1230 + NetClientState *nc = (NetClientState *)user;
1232 + int len = phdr->len;
1233 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1234 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1235 + int max_eth_frame_size = s->max_eth_frame_size;
1237 + if (len > max_eth_frame_size) {
1239 + "pcap_send: packet size > %d (%d), truncating\n",
1240 + max_eth_frame_size, len);
1241 + len = max_eth_frame_size;
1244 + qemu_send_packet(nc, pdata, len);
1247 +static void pcap_send(void *opaque)
1249 + struct PCAPState *s = (struct PCAPState *)opaque;
1252 + if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0)
1257 +static void pcap_cleanup(NetClientState *nc)
1259 + struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
1261 + qemu_purge_queued_packets(nc);
1262 + pcap_close(s->handle);
1265 +static NetClientInfo net_pcap_info = {
1266 + .type = NET_CLIENT_DRIVER_PCAP,
1267 + .size = sizeof(struct PCAPState),
1268 + .receive = pcap_receive,
1269 +// .receive_raw = pcap_receive_raw,
1270 +// .receive_iov = pcap_receive_iov,
1271 +// .poll = pcap_poll,
1272 + .cleanup = pcap_cleanup,
1275 + * ... -net pcap,ifname="..."
1278 +int net_init_pcap(const Netdev *netdev,
1279 + const char *name, NetClientState *peer, Error **errp)
1281 + const NetdevPcapOptions *pcap_opts;
1282 + NetClientState *nc;
1283 + struct PCAPState *s;
1284 + const char *ifname;
1285 + char errbuf[PCAP_ERRBUF_SIZE];
1286 +#if defined(_WIN32)
1291 + assert(netdev->type == NET_CLIENT_DRIVER_PCAP);
1292 + pcap_opts = &netdev->u.pcap;
1293 + if (!pcap_opts->has_ifname)
1296 + ifname = pcap_opts->ifname;
1298 + /* create the object */
1299 + nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname);
1300 + s = DO_UPCAST(struct PCAPState, nc, nc);
1302 + if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
1303 + fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1307 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1309 + * We want to avoid passing oversize packets to the guest, which
1310 + * at least on FreeBSD can happen if the host interface uses tso
1311 + * (seen with an em(4) in this case) - so find out the host
1312 + * interface's mtu and assume the guest is configured the same.
1314 + s->max_eth_frame_size = 1514;
1315 + i = socket(AF_INET, SOCK_DGRAM, 0);
1319 + (void) memset(&ifr, 0, sizeof(ifr));
1320 + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
1321 + if (ioctl(i, SIOCGIFMTU, &ifr) != -1)
1322 + s->max_eth_frame_size = ifr.ifr_mtu + 14;
1327 +#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32)
1329 + * Create pcap handle for the device, set promiscuous mode and activate.
1331 + s->handle = (void *)pcap_create(ifname, errbuf);
1333 + fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1336 + if (pcap_set_promisc(s->handle, 1) != 0) {
1337 + pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:");
1340 + if (pcap_activate(s->handle) != 0) {
1341 + pcap_perror(s->handle, (char *)"qemu: pcap_activate:");
1345 + /* Attempt to connect device. */
1346 + s->handle = (void *)pcap_open_live(ifname, 65535, 1, 0, errbuf);
1348 + fprintf(stderr, "qemu: pcap_open_live: %s\n", errbuf);
1353 + /* Set non-blocking mode. */
1354 + if (pcap_setnonblock(s->handle, 1, errbuf) < 0) {
1355 + fprintf(stderr, "qemu: pcap_setnonblock: %s\n", errbuf);
1359 +#if defined(_WIN32)
1361 + * Tell the kernel that the packet has to be seen immediately.
1363 + if (pcap_setmintocopy(s->handle, 0) < 0) {
1364 + fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1367 +#else /* !_WIN32 */
1368 +#if defined(CONFIG_BPF)
1369 +#if defined(BIOCIMMEDIATE)
1371 + * Tell the kernel that the packet has to be seen immediately.
1374 + unsigned int one = 1;
1375 + if (ioctl(pcap_fileno(s->handle), BIOCIMMEDIATE, &one) < 0) {
1376 + fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1380 +#endif /* BIOCIMMEDIATE */
1381 +#if defined(BIOCFEEDBACK)
1383 + * Tell the kernel that the sent packet has to be fed back.
1384 + * This is necessary to connect host and guest.
1387 + unsigned int one = 1;
1388 + if (ioctl(pcap_fileno(s->handle), BIOCFEEDBACK, &one) < 0) {
1389 + fprintf(stderr, "qemu: pcap failed to set feedback mode\n");
1393 +#endif /* BIOCFEEDBACK */
1394 +#endif /* CONFIG_BPF */
1395 +#endif /* _WIN32 */
1397 + snprintf(s->nc.info_str, sizeof(s->nc.info_str), "pcap redirector");
1399 +#if defined(_WIN32)
1400 + if ((h = pcap_getevent(s->handle)) == NULL) {
1401 + fprintf(stderr, "qemu: pcap_getevent failed\n");
1404 + qemu_add_wait_object(h, pcap_send, s);
1405 +#else /* !_WIN32 */
1406 + if ((i = pcap_get_selectable_fd(s->handle)) < 0) {
1407 + fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n");
1410 + qemu_set_fd_handler(i, pcap_send, NULL, s);
1411 +#endif /* _WIN32 */
1418 + pcap_close(s->handle);
1426 static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])(
1427 const Netdev *netdev,
1429 @@ -962,6 +1185,9 @@ static int (* const net_client_init_fun[
1430 #ifdef CONFIG_L2TPV3
1431 [NET_CLIENT_DRIVER_L2TPV3] = net_init_l2tpv3,
1434 + [NET_CLIENT_DRIVER_PCAP] = net_init_pcap,
1441 [FILE:423:patches/patch-net_tap-bsd.c]
1442 --- net/tap-bsd.c.orig 2020-04-28 16:49:25 UTC
1446 #if defined(__NetBSD__) || defined(__FreeBSD__)
1447 #include <sys/ioctl.h>
1448 +#include <sys/socket.h>
1450 #include <net/if_tap.h>
1452 +#if defined(__DragonFly)
1453 +#include <sys/ioctl.h>
1454 +#include <sys/socket.h>
1455 +#include <net/if.h>
1456 +#include <net/tap/if_tap.h>
1459 #if defined(__OpenBSD__)
1460 #include <sys/param.h>
1463 [FILE:1550:patches/patch-qapi_net.json]
1464 --- qapi/net.json.orig 2020-04-28 16:49:25 UTC
1466 @@ -373,6 +373,19 @@
1467 '*helper': 'str' } }
1470 +# @NetdevPcapOptions:
1472 +# Use ifname as a source to capture
1474 +# @ifname: #required to determine which interface to capture
1478 +{ 'struct': 'NetdevPcapOptions',
1480 + '*ifname': 'str' } }
1483 # @NetdevHubPortOptions:
1485 # Connect two or more net clients through a software hub.
1488 { 'enum': 'NetClientDriver',
1489 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1490 - 'bridge', 'hubport', 'netmap', 'vhost-user' ] }
1491 + 'bridge', 'hubport', 'netmap', 'vhost-user', 'pcap' ] }
1496 'user': 'NetdevUserOptions',
1497 'tap': 'NetdevTapOptions',
1498 'l2tpv3': 'NetdevL2TPv3Options',
1499 + 'pcap': 'NetdevPcapOptions',
1500 'socket': 'NetdevSocketOptions',
1501 'vde': 'NetdevVdeOptions',
1502 'bridge': 'NetdevBridgeOptions',
1505 { 'enum': 'NetLegacyOptionsType',
1506 'data': ['none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1507 - 'bridge', 'netmap', 'vhost-user'] }
1508 + 'bridge', 'netmap', 'vhost-user', 'pcap'] }
1511 # @NetLegacyOptions:
1513 'user': 'NetdevUserOptions',
1514 'tap': 'NetdevTapOptions',
1515 'l2tpv3': 'NetdevL2TPv3Options',
1516 + 'pcap': 'NetdevPcapOptions',
1517 'socket': 'NetdevSocketOptions',
1518 'vde': 'NetdevVdeOptions',
1519 'bridge': 'NetdevBridgeOptions',
1522 [FILE:7685:files/pkg-message-single]
1526 - Needs to set net.link.tap.user_open sysctl in order to use /dev/tap*
1527 networking as non-root. Don't forget to adjust device node permissions in
1530 - slirp (usermode networking) is fixed now in cvs, on FreeSBIE 1.0 guests you
1531 still have to manually do: echo nameserver 10.0.2.3 >/etc/resolv.conf but
1532 i've been told that that's normal. (fixed on FreeSBIE 1.1.) And you have
1533 to wait a bit for dhclient to do its thing; traffic to address 10.0.2.2 is
1534 routed to 127.1 on the host.
1536 - Expect timer problems when guest kernel HZ is > hosts, for example time
1537 sleep 1 takes 49 seconds and booting sleeps for minutes at the acd0 probe
1538 with a FreeSBIE 1.0 guest, thats because its kernel is built with HZ=5000,
1539 and FreeBSD's default is 100... (no longer a problem with FreeSBIE 1.1.)
1540 The linux 2.6 kernel uses 1000 by default btw. (changed to 250 later, and
1541 recent linux kernels now no longer have a fixed HZ, aka `tickless
1542 kernel'...) Enabling /dev/rtc doesn't seem to help either (not included
1543 since it needs a patch to emulators/rtc.)
1545 - Update: the above problem has gotten worse with FreeBSD guests
1546 somewhere before 8.0, mainly since the kernel now usually wants
1547 double or even quadruple number of timer irqs compared to HZ if
1548 it detects an apic (and at least early versions of FreeBSD 8 had
1549 a bug that essentially halved qemu's clock rate too); the only
1550 reason you usually don't see symptoms of this with FreeBSD 8
1551 guests is they automatically reduce their HZ to 100 when running
1552 in a VM while the default for the host kernel is still HZ=1000.
1553 Workaround: you can disable the apic clock in the guest by setting
1555 hint.apic.0.clock="0"
1557 in loader.conf(5) (or manually at the loader prompt), if that
1558 doesn't work the only things you can do is either reduce the
1559 guest's HZ to, say, 100 by setting e.g.
1563 from the loader as above (which usually is a good idea in a VM
1564 anyway and FreeBSD 8 now does by itself as mentioned), or otherwise
1565 increase the host's HZ to 2000 or even 4000 from the loader in
1568 - The -smb option (smb-export local dir to guest using the default
1569 slirp networking) needs the samba port/package installed
1570 in addition to qemu. (SAMBA knob.)
1572 - If you want to use usb devices connected to the host in the guest
1573 yot need either recent 10-current (not tested yet much) or you can
1574 use usbredir over the network (see below); also unless you are
1575 running qemu as root you then need to fix permissions for /dev/ugen*
1576 device nodes: if you are on 5.x or later (devfs) put a rule in
1577 /etc/devfs.rules, activate it in /etc/rc.conf and run /etc/rc.d/devfs
1578 restart. Example devfs.rules:
1581 add path 'ugen*' mode 660 group operator
1583 corresponding rc.conf line:
1585 devfs_system_ruleset="ugen_ruleset"
1587 - If you want to test the new (in 0.15.0) usb network redirection (USBREDIR
1588 option) see this thread by Hans de Goede <hdegoede <at> redhat.com>:
1590 http://thread.gmane.org/gmane.comp.emulators.qemu/110176/focus=110183
1596 1) Start usbredirserver for a usb device:
1597 sudo usbredirserver 045e:0772
1598 2) Start qemu with usb2 support + a chardev talking to usbredirserver +
1599 a usb-redir device using this chardev:
1601 -readconfig docs/ich9-ehci-uhci.cfg \
1602 -chardev socket,id=usbredirchardev,host=localhost,port=4000 \
1603 -device usb-redir,chardev=usbredirchardev,id=usbredirdev ...
1605 [you would replace docs/ich9-ehci-uhci.cfg with e.g.
1606 /raven/share/doc/qemu/docs/ich9-ehci-uhci.cfg, but turns out
1607 ehci was broken for me here with FreeBSD guests and the previous
1608 qemu version at least, I got:
1610 FETCHENTRY: entry at 22C5484 is of type 2 which is not supported yet processing error - resetting ehci HC
1611 Assertion failed: (0), function ehci_advance_state, file /data/ports/emulators/qemu-devel/work/qemu-0.15.0/hw/usb-ehci.c, line 2045.
1613 The new qemu version works better tho.]
1615 - Still usb: since the hub is no longer attached to the uchi controller and
1616 the wakeup mechanism, resume interrupt is not implemented yet linux guests
1617 will suspend the bus, i.e. they wont see devices usb_add'ed after its
1618 (linux') uhci module got loaded. Workaround: either add devices before
1619 linux loads the module or rmmod and modprobe it afterwards. [Not sure
1620 if this still applies to the new libusb host code used on recent
1623 - If you build qemu wihout SDL and then get crashes running it try passing it
1624 -nographic. This should probably be default in that case...
1626 - qemu's network boot roms (-boot n) have a bug when bootfiles sizes are a
1627 multiple of blksize, if this affects you (like with FreeBSD's /boot/pxeboot)
1630 cp /boot/pxeboot pxeboot-qemu && chmod +w pxeboot-qemu && echo >>pxeboot-qemu
1632 and then use pxeboot-qemu. Actually you need recent btx code
1633 (from after 7.0 was released) because of the real mode boot
1634 problem, so use at least pxeboot from there. And I just did that
1635 for the pxeboot extracted out of
1637 ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/200805/7.0-STABLE-200805-i386-bootonly.iso
1641 http://people.freebsd.org/~nox/qemu/pxeboot-qemu
1643 - If you use slirp (usernet, the default) and want to mount nfs into the guest
1644 and you are not running qemu as root, then mountd(8) on the exporting box
1645 needs to be run with -n in order to accept requests from ports >= 1024.
1647 - (not FreeBSD-specific:) There have been reports of qcow2 corruption with (at
1648 least) win2k guests on recent kvm (which uses similar qcow2 code than qemu
1649 now, see this thread:
1651 http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00713.html -
1653 the consensus on that thread seems to be that qcow(2) code has always been
1654 experimental and you should use raw images if you want reliability; raw is
1655 also usually faster.) You should be able to migrate existing images to raw
1656 using qemu-img(1)'s convert function; raw doesn't support advanced features
1657 like snapshots tho. [a few important qcow2 bugfixed have been committed in
1658 the meantime so this _might_ be less of an issue now; and meanwhile there
1659 also is the new qed format - I don't know how stable that one is.]
1661 - (also not FreeBSD-specific:) It is recommended to pass raw images using the
1662 new -drive syntax, specifying format=raw explicitly in order to avoid
1663 malicious guests being able to exploit the format autodetection thats
1664 otherwise getting used. (Not that you should run malicious guests anyway,
1665 but this eleminates at least a known attack vector.)
1667 - qemu now has improved physical cdrom support, but still there is at
1668 least one known problem: you need to have the guest eject the disc if you
1669 want to change it/take it out, or otherwise the guest may continue using
1670 state (like size) of the old disc. (You can also do like `change ide1-cd0
1671 /dev/acd0' in the monitor after taking out the disc if a guest cannot eject
1674 - The default configuration location (qemu-ifup script etc.) has been changed
1675 from /etc to PREFIX/etc (usually /raven/etc). Move your files accordingly.
1677 - The pcap code (-net nic... -net pcap,ifname=...) should work properly now,
1678 with only one exception: Advanced features like TSO used on the host
1679 interface can cause oversize packets which now do get truncated to avoid
1680 confusing/panicing guests but of course still will cause retransmissions.
1681 So if you see slow throughput and `pcap_send: packet size > ..., truncating'
1682 messages on qemu's tty try disabling TSO etc on the host interface at least
1686 [FILE:20:files/qemu-ifdown.sample]
1691 [FILE:20:files/qemu-ifup.sample]
1696 [FILE:66:files/special.mk]
1697 .if "${ARCH_STANDARD}" == "x86_64"
1698 MAKE_ARGS+= ARCH=x86_64
1702 [FILE:436:dragonfly/patch-disas_libvixl_vixl_utils.h]
1703 --- disas/libvixl/vixl/utils.h.orig 2020-04-28 16:49:24 UTC
1704 +++ disas/libvixl/vixl/utils.h
1705 @@ -42,6 +42,13 @@ namespace vixl {
1706 #define PRINTF_CHECK(format_index, varargs_index)
1710 +#define INT32_C(c) c
1711 +#define INT64_C(c) (c ## LL)
1712 +#define UINT32_C(c) (c ## U)
1713 +#define UINT64_C(c) (c ## ULL)
1716 // Check number width.
1717 inline bool is_intn(unsigned n, int64_t x) {
1718 VIXL_ASSERT((0 < n) && (n < 64));
1721 [FILE:323:dragonfly/patch-hw-ppc_newworld.c]
1722 --- hw/ppc/mac_newworld.c.orig 2020-04-28 16:49:24 UTC
1723 +++ hw/ppc/mac_newworld.c
1725 #include "hw/sysbus.h"
1728 +/* FreeBSD headers define this */
1733 #define MAX_IDE_BUS 2
1734 #define CFG_ADDR 0xf0000510
1735 #define TBFREQ (100UL * 1000UL * 1000UL)
1738 [FILE:334:dragonfly/patch-hw_ppc_mac__oldworld.c]
1739 --- hw/ppc/mac_oldworld.c.orig 2020-04-28 16:49:24 UTC
1740 +++ hw/ppc/mac_oldworld.c
1743 #define GRACKLE_BASE 0xfec00000
1745 +/* FreeBSD headers define this */
1750 static void fw_cfg_boot_set(void *opaque, const char *boot_device,
1755 [FILE:843:dragonfly/patch-util_coroutine-ucontext.c]
1756 --- util/coroutine-ucontext.c.orig 2020-04-28 16:49:25 UTC
1757 +++ util/coroutine-ucontext.c
1758 @@ -158,7 +158,15 @@ Coroutine *qemu_coroutine_new(void)
1759 2, arg.i[0], arg.i[1]);
1761 /* swapcontext() in, siglongjmp() back out */
1762 - if (!sigsetjmp(old_env, 0)) {
1763 + /* Save signal mask in this sigsetjmp, because makecontext on DragonFly
1764 + * leaves all signals blocked when entering the new context with
1766 + * Workaround this, by just having the signal mask restored by the
1767 + * siglongjmp that brings us back from qemu_coroutine_new().
1768 + * XXX Remove this workaround when the makecontext behaviour is fixed
1771 + if (!sigsetjmp(old_env, 1)) {
1772 start_switch_fiber(&fake_stack_save, co->stack, co->stack_size);
1773 swapcontext(&old_uc, &uc);