Ravenports generated: 20 Nov 2019 10:14
[ravenports.git] / bucket_A9 / qemu
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               qemu
4 VERSION=                4.1.1
5 KEYWORDS=               emulators
6 VARIANTS=               standard
7 SDESC[standard]=        Fast CPU emulator and virtualizer for x86 platform
8 HOMEPAGE=               https://www.qemu.org/
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            https://download.qemu.org/
13 DISTFILE[1]=            qemu-4.1.1.tar.xz:main
14 DF_INDEX=               1
15 SPKGS[standard]=        complete
16                         primary
17                         docs
18
19 OPTIONS_AVAILABLE=      none
20 OPTIONS_STANDARD=       none
21
22 BUILD_DEPENDS=          texi2html:primary:standard
23                         python-Sphinx:single:python_default
24 BUILDRUN_DEPENDS=       nettle:primary:standard
25                         fontconfig:primary:standard
26                         freetype:primary:standard
27                         gnutls:single:standard
28                         cyrus-sasl:primary:standard
29                         curl:primary:standard
30                         vde2:single:standard
31                         libepoxy:single:standard
32
33 USES=                   cpe gmake pkgconfig bison perl:build python:build
34                         jpeg png mesa gettext-runtime gettext-tools ncurses
35                         makeinfo
36 GNOME_COMPONENTS=       gdkpixbuf gtk2 vte
37 SDL_COMPONENTS=         sdl2
38 XORG_COMPONENTS=        x11 xext
39
40 LICENSE=                GPLv2:primary
41 LICENSE_TERMS=          primary:{{WRKSRC}}/LICENSE
42 LICENSE_FILE=           GPLv2:{{WRKSRC}}/COPYING
43 LICENSE_SCHEME=         solo
44
45 FPC_EQUIVALENT=         emulators/qemu
46
47 MUST_CONFIGURE=         yes
48 CONFIGURE_ARGS=         --disable-usb-redir
49                         --disable-stack-protector
50                         --disable-kvm
51                         --disable-xen
52                         --disable-vde
53                         --enable-pcap
54                         --enable-docs
55                         --enable-debug
56                         --enable-debug-info
57                         --prefix={{PREFIX}}
58                         --cc={{CC}}
59                         --python={{PYTHON_CMD}}
60                         --localstatedir=/var
61                         --extra-cflags="-I{{WRKSRC}} -I{{LOCALBASE}}/include -DPREFIX=\\\"\"{{PREFIX}}\\\"\""
62                         --extra-ldflags="-L/usr/lib -L{{LOCALBASE}}/lib"
63
64 MAKE_ENV=               BSD_MAKE="{{MAKE}}"
65                         V=1
66
67 INSTALL_REQ_TOOLCHAIN=  yes
68
69 VAR_OPSYS[freebsd]=     CONFIGURE_ARGS=--enable-netmap
70                         CONFIGURE_ARGS=--disable-linux-user
71                         CONFIGURE_ARGS=--disable-linux-aio
72 VAR_OPSYS[linux]=       CONFIGURE_ARGS=--enable-netmap
73 VAR_OPSYS[dragonfly]=   CONFIGURE_ARGS=--disable-netmap
74                         CONFIGURE_ARGS=--disable-linux-user
75                         CONFIGURE_ARGS=--disable-linux-aio
76
77 post-patch:
78         ${REINPLACE_CMD} -e '/LIBS/s|-lprocstat|-lprocstat -lelf|' \
79                  -e '/libusb/s/ --atleast-version=1\.0\.[0-9]*//' \
80                 ${WRKSRC}/configure
81         ${REINPLACE_CMD} -e '/libs_qga=/s|glib_libs|glib_libs -lintl|' \
82                 ${WRKSRC}/configure
83         ${REINPLACE_CMD} -E \
84                 -e "/^by Tibor .TS. S/s|Sch.*z.$$|Schuetz.|" \
85                 ${WRKSRC}/qemu-doc.texi
86         ${REINPLACE_CMD} -E \
87                 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing|" \
88                 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
89                 ${WRKSRC}/Makefile.target
90         ${REINPLACE_CMD} -E \
91                 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing -I.|" \
92                 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
93                 ${WRKSRC}/Makefile
94         ${REINPLACE_CMD} -E \
95                 -e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \
96                 ${WRKSRC}/scripts/texi2pod.pl
97         # GNS3 (promiscuous multicast)
98         ${REINPLACE_CMD} -e 's|(buf\[0\] & 1) && (rctl & E1000_RCTL_MPE)|buf[0] \& 1|' \
99                 ${WRKSRC}/hw/net/e1000.c
100         # broken build for optionrom
101         ${REINPLACE_CMD} -e '/roms="optionrom"/d' ${WRKSRC}/configure
102         # silence some include warnings
103         ${MKDIR} ${WRKSRC}/bsd-user/dragonfly
104
105 pre-install:
106         # for some reason file is considered out-of-date
107         ${TOUCH} ${WRKSRC}/config-host.mak
108
109 post-install:
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
118
119 [FILE:782:descriptions/desc.primary]
120 QEMU is a fast processor emulator using dynamic translation to achieve
121 good emulation speed.  QEMU has two operating modes:
122
123  * Full system emulation. In this mode, QEMU emulates a full system (for
124    example a PC), including a processor and various peripherials.  It can
125    be used to launch different Operating Systems without rebooting the PC
126    or to debug system code.
127  * User mode emulation (Linux host only). In this mode, QEMU can launch
128    Linux processes compiled for one CPU on another CPU. It can be used to
129    launch the Wine Windows API emulator or to ease cross-compilation and
130    cross-debugging.
131
132 As QEMU requires no host kernel patches to run, it is safe and easy to use.
133
134 See also the preconfigured system images on http://oszoo.org/
135 Many live cd isos also work.
136
137
138 [FILE:96:distinfo]
139 ed6fdbbdd272611446ff8036991e9b9f04a2ab2e3ffa9e79f3bab0eb9a95a1d2     61932460 qemu-4.1.1.tar.xz
140
141
142 [FILE:3169:manifests/plist.primary]
143 @sample etc/qemu-ifdown.sample
144 @sample etc/qemu-ifup.sample
145 bin/
146  elf2dmp
147  qemu-edid
148  qemu-ga
149  qemu-i386
150  qemu-img
151  qemu-io
152  qemu-nbd
153  qemu-sparc
154  qemu-sparc64
155  qemu-system-aarch64
156  qemu-system-alpha
157  qemu-system-arm
158  qemu-system-cris
159  qemu-system-hppa
160  qemu-system-i386
161  qemu-system-lm32
162  qemu-system-m68k
163  qemu-system-microblaze
164  qemu-system-microblazeel
165  qemu-system-mips
166  qemu-system-mips64
167  qemu-system-mips64el
168  qemu-system-mipsel
169  qemu-system-moxie
170  qemu-system-nios2
171  qemu-system-or1k
172  qemu-system-ppc
173  qemu-system-ppc64
174  qemu-system-riscv32
175  qemu-system-riscv64
176  qemu-system-s390x
177  qemu-system-sh4
178  qemu-system-sh4eb
179  qemu-system-sparc
180  qemu-system-sparc64
181  qemu-system-tricore
182  qemu-system-unicore32
183  qemu-system-x86_64
184  qemu-system-xtensa
185  qemu-system-xtensaeb
186  qemu-x86_64
187 share/applications/qemu.desktop
188 share/icons/hicolor/128x128/apps/qemu.png
189 share/icons/hicolor/16x16/apps/qemu.png
190 share/icons/hicolor/24x24/apps/qemu.png
191 share/icons/hicolor/256x256/apps/qemu.png
192 share/icons/hicolor/32x32/apps/
193  qemu.bmp
194  qemu.png
195 share/icons/hicolor/48x48/apps/qemu.png
196 share/icons/hicolor/512x512/apps/qemu.png
197 share/icons/hicolor/64x64/apps/qemu.png
198 share/icons/hicolor/scalable/apps/qemu.svg
199 share/locale/bg/LC_MESSAGES/qemu.mo
200 share/locale/de_DE/LC_MESSAGES/qemu.mo
201 share/locale/fr_FR/LC_MESSAGES/qemu.mo
202 share/locale/hu/LC_MESSAGES/qemu.mo
203 share/locale/it/LC_MESSAGES/qemu.mo
204 share/locale/tr/LC_MESSAGES/qemu.mo
205 share/locale/zh_CN/LC_MESSAGES/qemu.mo
206 share/man/man1/
207  qemu-img.1.gz
208  qemu.1.gz
209 share/man/man7/
210  qemu-block-drivers.7.gz
211  qemu-cpu-models.7.gz
212  qemu-ga-ref.7.gz
213  qemu-qmp-ref.7.gz
214 share/man/man8/
215  qemu-ga.8.gz
216  qemu-nbd.8.gz
217 share/qemu/
218  QEMU,cgthree.bin
219  QEMU,tcx.bin
220  bamboo.dtb
221  bios-256k.bin
222  bios.bin
223  canyonlands.dtb
224  edk2-aarch64-code.fd
225  edk2-arm-code.fd
226  edk2-arm-vars.fd
227  edk2-i386-code.fd
228  edk2-i386-secure-code.fd
229  edk2-i386-vars.fd
230  edk2-licenses.txt
231  edk2-x86_64-code.fd
232  edk2-x86_64-secure-code.fd
233  efi-e1000.rom
234  efi-e1000e.rom
235  efi-eepro100.rom
236  efi-ne2k_pci.rom
237  efi-pcnet.rom
238  efi-rtl8139.rom
239  efi-virtio.rom
240  efi-vmxnet3.rom
241  hppa-firmware.img
242  kvmvapic.bin
243  linuxboot.bin
244  linuxboot_dma.bin
245  multiboot.bin
246  openbios-ppc
247  openbios-sparc32
248  openbios-sparc64
249  opensbi-riscv32-virt-fw_jump.bin
250  opensbi-riscv64-sifive_u-fw_jump.bin
251  opensbi-riscv64-virt-fw_jump.bin
252  palcode-clipper
253  petalogix-ml605.dtb
254  petalogix-s3adsp1800.dtb
255  ppc_rom.bin
256  pvh.bin
257  pxe-e1000.rom
258  pxe-eepro100.rom
259  pxe-ne2k_pci.rom
260  pxe-pcnet.rom
261  pxe-rtl8139.rom
262  pxe-virtio.rom
263  qemu-nsis.bmp
264  qemu_vga.ndrv
265  s390-ccw.img
266  s390-netboot.img
267  sgabios.bin
268  skiboot.lid
269  slof.bin
270  spapr-rtas.bin
271  trace-events-all
272  u-boot-sam460-20100605.bin
273  u-boot.e500
274  vgabios-ati.bin
275  vgabios-bochs-display.bin
276  vgabios-cirrus.bin
277  vgabios-qxl.bin
278  vgabios-ramfb.bin
279  vgabios-stdvga.bin
280  vgabios-virtio.bin
281  vgabios-vmware.bin
282  vgabios.bin
283 share/qemu/firmware/
284  50-edk2-i386-secure.json
285  50-edk2-x86_64-secure.json
286  60-edk2-aarch64.json
287  60-edk2-arm.json
288  60-edk2-i386.json
289  60-edk2-x86_64.json
290 share/qemu/keymaps/
291  ar
292  bepo
293  cz
294  da
295  de
296  de-ch
297  en-gb
298  en-us
299  es
300  et
301  fi
302  fo
303  fr
304  fr-be
305  fr-ca
306  fr-ch
307  hr
308  hu
309  is
310  it
311  ja
312  lt
313  lv
314  mk
315  nl
316  no
317  pl
318  pt
319  pt-br
320  ru
321  sl
322  sv
323  th
324  tr
325
326
327 [FILE:4915:manifests/plist.docs]
328 share/doc/qemu/
329  qemu-doc.html
330  qemu-doc.txt
331  qemu-ga-ref.html
332  qemu-ga-ref.txt
333  qemu-qmp-ref.html
334  qemu-qmp-ref.txt
335 share/doc/qemu/docs/
336  COLO-FT.txt
337  amd-memory-encryption.txt
338  block-replication.txt
339  bootindex.txt
340  can.txt
341  ccid.txt
342  colo-proxy.txt
343  conf.py
344  cpu-hotplug.rst
345  generic-loader.txt
346  hyperv.txt
347  igd-assign.txt
348  image-fuzzer.txt
349  index.rst
350  memory-hotplug.txt
351  multi-thread-compression.txt
352  multiseat.txt
353  nvdimm.txt
354  pci_expander_bridge.txt
355  pcie.txt
356  pcie_pci_bridge.txt
357  pr-manager.rst
358  pvrdma.txt
359  qcow2-cache.txt
360  qdev-device-use.txt
361  qemu-block-drivers.7
362  qemu-block-drivers.7.pod
363  qemu-block-drivers.texi
364  qemu-cpu-models.7
365  qemu-cpu-models.7.pod
366  qemu-cpu-models.texi
367  qemu_logo.pdf
368  qemupciserial.inf
369  rdma.txt
370  replay.txt
371  security.texi
372  spice-port-fqdn.txt
373  throttle.txt
374  usb-storage.txt
375  usb2.txt
376  version.texi
377  vfio-ap.txt
378  virtio-balloon-stats.txt
379  xbzrle.txt
380  xen-save-devices-state.txt
381 share/doc/qemu/docs/built/devel/
382  .buildinfo
383  decodetree.html
384  genindex.html
385  index.html
386  kconfig.html
387  loads-stores.html
388  memory.html
389  migration.html
390  objects.inv
391  search.html
392  searchindex.js
393  secure-coding-practices.html
394  stable-process.html
395  tcg.html
396  testing.html
397 share/doc/qemu/docs/built/devel/_static/
398  alabaster.css
399  basic.css
400  custom.css
401  doctools.js
402  documentation_options.js
403  file.png
404  jquery-3.4.1.js
405  jquery.js
406  language_data.js
407  minus.png
408  plus.png
409  pygments.css
410  searchtools.js
411  underscore-1.3.1.js
412  underscore.js
413 share/doc/qemu/docs/built/interop/
414  .buildinfo
415  bitmaps.html
416  genindex.html
417  index.html
418  live-block-operations.html
419  objects.inv
420  pr-helper.html
421  search.html
422  searchindex.js
423  vhost-user-gpu.html
424  vhost-user.html
425 share/doc/qemu/docs/built/interop/_static/
426  alabaster.css
427  basic.css
428  custom.css
429  doctools.js
430  documentation_options.js
431  file.png
432  jquery-3.4.1.js
433  jquery.js
434  language_data.js
435  minus.png
436  plus.png
437  pygments.css
438  searchtools.js
439  underscore-1.3.1.js
440  underscore.js
441 share/doc/qemu/docs/built/specs/
442  .buildinfo
443  genindex.html
444  index.html
445  objects.inv
446  ppc-spapr-xive.html
447  ppc-xive.html
448  search.html
449  searchindex.js
450 share/doc/qemu/docs/built/specs/_static/
451  alabaster.css
452  basic.css
453  custom.css
454  doctools.js
455  documentation_options.js
456  file.png
457  jquery-3.4.1.js
458  jquery.js
459  language_data.js
460  minus.png
461  plus.png
462  pygments.css
463  searchtools.js
464  underscore-1.3.1.js
465  underscore.js
466 share/doc/qemu/docs/config/
467  ich9-ehci-uhci.cfg
468  mach-virt-graphical.cfg
469  mach-virt-serial.cfg
470  q35-emulated.cfg
471  q35-virtio-graphical.cfg
472  q35-virtio-serial.cfg
473 share/doc/qemu/docs/devel/
474  atomics.txt
475  blkdebug.txt
476  blkverify.txt
477  build-system.txt
478  conf.py
479  decodetree.rst
480  index.rst
481  kconfig.rst
482  loads-stores.rst
483  lockcnt.txt
484  memory.rst
485  migration.rst
486  multi-thread-tcg.txt
487  multiple-iothreads.txt
488  qapi-code-gen.txt
489  rcu.txt
490  s390-dasd-ipl.txt
491  secure-coding-practices.rst
492  stable-process.rst
493  tcg.rst
494  testing.rst
495  tracing.txt
496  virtio-migration.txt
497  writing-qmp-commands.txt
498 share/doc/qemu/docs/interop/
499  bitmaps.rst
500  conf.py
501  firmware.json
502  index.rst
503  live-block-operations.rst
504  nbd.txt
505  parallels.txt
506  pr-helper.rst
507  prl-xml.txt
508  qcow2.txt
509  qed_spec.txt
510  qemu-ga-qapi.texi
511  qemu-ga-ref.7
512  qemu-ga-ref.7.pod
513  qemu-ga-ref.html
514  qemu-ga-ref.texi
515  qemu-ga-ref.txt
516  qemu-qmp-qapi.texi
517  qemu-qmp-ref.7
518  qemu-qmp-ref.7.pod
519  qemu-qmp-ref.html
520  qemu-qmp-ref.texi
521  qemu-qmp-ref.txt
522  qmp-intro.txt
523  qmp-spec.txt
524  vhost-user-gpu.rst
525  vhost-user.json
526  vhost-user.rst
527  vnc-ledstate-Pseudo-encoding.txt
528 share/doc/qemu/docs/specs/
529  acpi_cpu_hotplug.txt
530  acpi_mem_hotplug.txt
531  acpi_nvdimm.txt
532  acpi_pci_hotplug.txt
533  conf.py
534  edu.txt
535  fw_cfg.txt
536  index.rst
537  ivshmem-spec.txt
538  pci-ids.txt
539  pci-serial.txt
540  pci-testdev.txt
541  ppc-spapr-hcalls.txt
542  ppc-spapr-hotplug.txt
543  ppc-spapr-xive.rst
544  ppc-xive.rst
545  pvpanic.txt
546  rocker.txt
547  standard-vga.txt
548  tpm.txt
549  vmcoreinfo.txt
550  vmgenid.txt
551  vmw_pvscsi-spec.txt
552 share/doc/qemu/docs/sphinx/qmp_lexer.py
553 share/doc/qemu/docs/sphinx/__pycache__/qmp_lexer.cpython-37.pyc
554 share/doc/qemu/docs/spin/
555  aio_notify.promela
556  aio_notify_accept.promela
557  aio_notify_bug.promela
558  tcg-exclusive.promela
559  win32-qemu-event.promela
560 share/doc/qemu/interop/
561  .buildinfo
562  bitmaps.html
563  genindex.html
564  index.html
565  live-block-operations.html
566  objects.inv
567  pr-helper.html
568  search.html
569  searchindex.js
570  vhost-user-gpu.html
571  vhost-user.html
572 share/doc/qemu/interop/_static/
573  alabaster.css
574  basic.css
575  custom.css
576  doctools.js
577  documentation_options.js
578  file.png
579  jquery-3.4.1.js
580  jquery.js
581  language_data.js
582  minus.png
583  plus.png
584  pygments.css
585  searchtools.js
586  underscore-1.3.1.js
587  underscore.js
588 share/doc/qemu/specs/
589  .buildinfo
590  genindex.html
591  index.html
592  objects.inv
593  ppc-spapr-xive.html
594  ppc-xive.html
595  search.html
596  searchindex.js
597 share/doc/qemu/specs/_static/
598  alabaster.css
599  basic.css
600  custom.css
601  doctools.js
602  documentation_options.js
603  file.png
604  jquery-3.4.1.js
605  jquery.js
606  language_data.js
607  minus.png
608  plus.png
609  pygments.css
610  searchtools.js
611  underscore-1.3.1.js
612  underscore.js
613
614
615 [FILE:4087:patches/patch-configure]
616 --- configure.orig      2019-11-14 18:06:20 UTC
617 +++ configure
618 @@ -484,6 +484,9 @@ numa=""
619  tcmalloc="no"
620  jemalloc="no"
621  replication="yes"
622 +pcap="no"
623 +pcap_create="no"
624 +bpf="no"
625  vxhs=""
626  bochs="yes"
627  cloop="yes"
628 @@ -1141,6 +1144,10 @@ for opt do
629    ;;
630    --enable-vnc-png) vnc_png="yes"
631    ;;
632 +  --enable-pcap) pcap="yes"
633 +  ;;
634 +  --disable-pcap) pcap="no"
635 +  ;;
636    --disable-slirp) slirp="no"
637    ;;
638    --enable-slirp=git) slirp="git"
639 @@ -2998,6 +3005,14 @@ if ! check_include "ifaddrs.h" ; then
640  fi
641  
642  ##########################################
643 +# getifaddrs (for tests/test-io-channel-socket )
644 +
645 +have_ifaddrs_h=yes
646 +if ! check_include "ifaddrs.h" ; then
647 +  have_ifaddrs_h=no
648 +fi
649 +
650 +##########################################
651  # VTE probe
652  
653  if test "$vte" != "no"; then
654 @@ -3655,7 +3670,7 @@ for i in $glib_modules; do
655          glib_libs=$($pkg_config --libs $i)
656          QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
657          LIBS="$glib_libs $LIBS"
658 -        libs_qga="$glib_libs $libs_qga"
659 +        libs_qga="$glib_libs -lintl $libs_qga"
660      else
661          error_exit "glib-$glib_req_ver $i is required to compile QEMU"
662      fi
663 @@ -4747,11 +4762,6 @@ has_sphinx_build() {
664  if test "$docs" != "no" ; then
665    if has makeinfo && has pod2man && has_sphinx_build; then
666      docs=yes
667 -  else
668 -    if test "$docs" = "yes" ; then
669 -      feature_not_found "docs" "Install texinfo, Perl/perl-podlators and python-sphinx"
670 -    fi
671 -    docs=no
672    fi
673  fi
674  
675 @@ -4885,7 +4895,7 @@ fi
676  
677  # check for libusb
678  if test "$libusb" != "no" ; then
679 -    if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
680 +    if $pkg_config libusb-1.0; then
681          libusb="yes"
682          libusb_cflags=$($pkg_config --cflags libusb-1.0)
683          libusb_libs=$($pkg_config --libs libusb-1.0)
684 @@ -5275,6 +5285,50 @@ if test "$debug_stack_usage" = "yes"; th
685    fi
686  fi
687  
688 +##########################################
689 +# pcap probe
690 +
691 +if test "$pcap" = "yes" -a "$pcap" != "no"; then
692 +  cat > $TMPC << EOF
693 +#include <pcap.h>
694 +int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); }
695 +EOF
696 +  if test "$mingw32" = "no" ; then
697 +    libpcap=-lpcap
698 +  else
699 +    libpcap=-lwpcap
700 +  fi
701 +  if compile_prog "" "$libpcap" ; then
702 +    :
703 +  else
704 +    echo
705 +    echo "Error: Could not find pcap"
706 +    echo "Make sure to have the pcap libs and headers installed."
707 +    echo
708 +    exit 1
709 +  fi
710 +  cat > $TMPC << EOF
711 +#include <pcap.h>
712 +int main(void)
713 +{
714 +  char errbuf[PCAP_ERRBUF_SIZE];
715 +  return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0);
716 +}
717 +EOF
718 +  if compile_prog "" "$libpcap" ; then
719 +    pcap_create="yes"
720 +  fi
721 +  cat > $TMPC << EOF
722 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
723 +#include <pcap.h>
724 +#include <net/bpf.h>
725 +int main(void) { return (BPF_MAJOR_VERSION); }
726 +EOF
727 +  if compile_prog ; then
728 +    bpf="yes"
729 +  fi
730 +  libs_softmmu="$libpcap $libs_softmmu"
731 +fi # test "$pcap"
732  
733  ##########################################
734  # check if we have open_by_handle_at
735 @@ -6377,6 +6431,7 @@ echo "Audio drivers     $audio_drv_list"
736  echo "Block whitelist (rw) $block_drv_rw_whitelist"
737  echo "Block whitelist (ro) $block_drv_ro_whitelist"
738  echo "VirtFS support    $virtfs"
739 +echo "pcap support      $pcap"
740  echo "Multipath support $mpath"
741  echo "VNC support       $vnc"
742  if test "$vnc" = "yes" ; then
743 @@ -6617,6 +6672,15 @@ fi
744  if test "$profiler" = "yes" ; then
745    echo "CONFIG_PROFILER=y" >> $config_host_mak
746  fi
747 +if test "$pcap" = "yes" ; then
748 +  echo "CONFIG_PCAP=y" >> $config_host_mak
749 +  if test "$pcap_create" = "yes" ; then
750 +    echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak
751 +  fi
752 +  if test "$bpf" = "yes" ; then
753 +    echo "CONFIG_BPF=y" >> $config_host_mak
754 +  fi
755 +fi
756  if test "$slirp" != "no"; then
757    echo "CONFIG_SLIRP=y" >> $config_host_mak
758    echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
759 @@ -6865,6 +6929,9 @@ fi
760  if test "$have_fsxattr" = "yes" ; then
761      echo "HAVE_FSXATTR=y" >> $config_host_mak
762  fi
763 +if test "$have_ifaddrs_h" = "yes" ; then
764 +    echo "HAVE_IFADDRS_H=y" >> $config_host_mak
765 +fi
766  if test "$have_copy_file_range" = "yes" ; then
767      echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
768  fi
769
770
771 [FILE:365:patches/patch-disas_libvixl_vixl_a64_disasm-a64.cc]
772 --- disas/libvixl/vixl/a64/disasm-a64.cc.orig   2019-11-14 18:06:20 UTC
773 +++ disas/libvixl/vixl/a64/disasm-a64.cc
774 @@ -2693,7 +2693,7 @@ void Disassembler::AppendPCRelativeOffse
775    if (offset < 0) {
776      abs_offset = -abs_offset;
777    }
778 -  AppendToOutput("#%c0x%" PRIx64, sign, abs_offset);
779 +  AppendToOutput("#%c0x%" PRIx64, sign, offset < 0 ? -offset : offset);
780  }
781  
782  
783
784
785 [FILE:582:patches/patch-include_net_net.h]
786 --- include/net/net.h.orig      2019-11-14 18:06:20 UTC
787 +++ include/net/net.h
788 @@ -209,8 +209,8 @@ void qmp_netdev_add(QDict *qdict, QObjec
789  int net_hub_id_for_client(NetClientState *nc, int *id);
790  NetClientState *net_hub_port_find(int hub_id);
791  
792 -#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
793 -#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
794 +#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup"
795 +#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown"
796  #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
797  #define DEFAULT_BRIDGE_INTERFACE "br0"
798  
799
800
801 [FILE:2733:patches/patch-include_qemu_atomic.h]
802 --- include/qemu/atomic.h.orig  2019-11-14 18:06:20 UTC
803 +++ include/qemu/atomic.h
804 @@ -208,10 +208,12 @@
805  /* Provide shorter names for GCC atomic builtins, return old value */
806  #define atomic_fetch_inc(ptr)  __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST)
807  #define atomic_fetch_dec(ptr)  __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST)
808 +#ifndef __cplusplus
809  #define atomic_fetch_add(ptr, n) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST)
810  #define atomic_fetch_sub(ptr, n) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST)
811  #define atomic_fetch_and(ptr, n) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST)
812  #define atomic_fetch_or(ptr, n)  __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST)
813 +#endif
814  #define atomic_fetch_xor(ptr, n) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST)
815  
816  #define atomic_inc_fetch(ptr)    __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
817 @@ -225,10 +227,12 @@
818  /* And even shorter names that return void.  */
819  #define atomic_inc(ptr)    ((void) __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST))
820  #define atomic_dec(ptr)    ((void) __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST))
821 +#ifndef __cplusplus
822  #define atomic_add(ptr, n) ((void) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST))
823  #define atomic_sub(ptr, n) ((void) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST))
824  #define atomic_and(ptr, n) ((void) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST))
825  #define atomic_or(ptr, n)  ((void) __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST))
826 +#endif
827  #define atomic_xor(ptr, n) ((void) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST))
828  
829  #else /* __ATOMIC_RELAXED */
830 @@ -400,10 +404,12 @@
831  
832  #define atomic_inc_fetch(ptr)  __sync_add_and_fetch(ptr, 1)
833  #define atomic_dec_fetch(ptr)  __sync_add_and_fetch(ptr, -1)
834 +#ifndef __cplusplus
835  #define atomic_add_fetch(ptr, n) __sync_add_and_fetch(ptr, n)
836  #define atomic_sub_fetch(ptr, n) __sync_sub_and_fetch(ptr, n)
837  #define atomic_and_fetch(ptr, n) __sync_and_and_fetch(ptr, n)
838  #define atomic_or_fetch(ptr, n) __sync_or_and_fetch(ptr, n)
839 +#endif
840  #define atomic_xor_fetch(ptr, n) __sync_xor_and_fetch(ptr, n)
841  
842  #define atomic_cmpxchg(ptr, old, new) __sync_val_compare_and_swap(ptr, old, new)
843 @@ -412,10 +418,12 @@
844  /* And even shorter names that return void.  */
845  #define atomic_inc(ptr)        ((void) __sync_fetch_and_add(ptr, 1))
846  #define atomic_dec(ptr)        ((void) __sync_fetch_and_add(ptr, -1))
847 +#ifndef __cplusplus
848  #define atomic_add(ptr, n)     ((void) __sync_fetch_and_add(ptr, n))
849  #define atomic_sub(ptr, n)     ((void) __sync_fetch_and_sub(ptr, n))
850  #define atomic_and(ptr, n)     ((void) __sync_fetch_and_and(ptr, n))
851  #define atomic_or(ptr, n)      ((void) __sync_fetch_and_or(ptr, n))
852 +#endif
853  #define atomic_xor(ptr, n)     ((void) __sync_fetch_and_xor(ptr, n))
854  
855  #endif /* __ATOMIC_RELAXED */
856
857
858 [FILE:436:patches/patch-net_clients.h]
859 --- net/clients.h.orig  2019-11-14 18:06:20 UTC
860 +++ net/clients.h
861 @@ -61,4 +61,10 @@ int net_init_netmap(const Netdev *netdev
862  int net_init_vhost_user(const Netdev *netdev, const char *name,
863                          NetClientState *peer, Error **errp);
864  
865 +#ifdef CONFIG_PCAP
866 +int net_init_pcap(const Netdev *netdev, const char *name,
867 +                    NetClientState *peer, Error **errp);
868 +#endif
869 +
870 +
871  #endif /* QEMU_NET_CLIENTS_H */
872
873
874 [FILE:6930:patches/patch-net_net.c]
875 --- net/net.c.orig      2019-11-14 18:06:20 UTC
876 +++ net/net.c
877 @@ -53,6 +53,11 @@
878  #include "net/filter.h"
879  #include "qapi/string-output-visitor.h"
880  
881 +#include <sys/ioctl.h>
882 +#if defined(__FreeBSD__) || defined(__DragonFly__)
883 +#include <net/if.h>
884 +#endif
885 +
886  /* Net bridge is currently not supported for W32. */
887  #if !defined(_WIN32)
888  # define CONFIG_NET_BRIDGE
889 @@ -933,7 +938,225 @@ static int net_init_nic(const Netdev *ne
890      return idx;
891  }
892  
893 +#if defined(CONFIG_PCAP)
894 +#if defined(CONFIG_BPF)
895 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
896 +#include <net/bpf.h>
897 +#endif
898 +#include <pcap.h>
899 +
900 +struct PCAPState {
901 +    NetClientState     nc;
902 +    pcap_t            *handle;
903 +    int                max_eth_frame_size;
904 +};
905 +
906 +static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
907 +{
908 +    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
909 +
910 +    return pcap_inject(s->handle, (u_char*)buf, size);
911 +}
912 +
913 +static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata
914 +               )
915 +{
916 +    NetClientState *nc = (NetClientState *)user;
917 +
918 +    int len = phdr->len;
919 +#if defined(__FreeBSD__) || defined(__DragonFly__)
920 +    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
921 +    int max_eth_frame_size = s->max_eth_frame_size;
922 +
923 +    if (len > max_eth_frame_size) {
924 +        fprintf(stderr,
925 +            "pcap_send: packet size > %d (%d), truncating\n",
926 +            max_eth_frame_size, len);
927 +        len = max_eth_frame_size;
928 +    }
929 +#endif
930 +    qemu_send_packet(nc, pdata, len);
931 +}
932 +
933 +static void pcap_send(void *opaque)
934 +{
935 +    struct PCAPState *s = (struct PCAPState *)opaque;
936 +
937 +    for (;;) {
938 +        if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0)
939 +            break;
940 +    }
941 +}
942 +
943 +static void pcap_cleanup(NetClientState *nc)
944 +{
945 +    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
946 +
947 +    qemu_purge_queued_packets(nc);
948 +    pcap_close(s->handle);
949 +}
950 +
951 +static NetClientInfo net_pcap_info = {
952 +    .type = NET_CLIENT_DRIVER_PCAP,
953 +    .size = sizeof(struct PCAPState),
954 +    .receive = pcap_receive,
955 +//    .receive_raw = pcap_receive_raw,
956 +//    .receive_iov = pcap_receive_iov,
957 +//    .poll = pcap_poll,
958 +    .cleanup = pcap_cleanup,
959 +};
960 +/*
961 + * ... -net pcap,ifname="..."
962 + */
963 +
964 +int net_init_pcap(const Netdev *netdev,
965 +    const char *name, NetClientState *peer, Error **errp)
966 +{
967 +    const NetdevPcapOptions *pcap_opts;
968 +    NetClientState *nc;
969 +    struct PCAPState *s;
970 +    const char *ifname;
971 +    char errbuf[PCAP_ERRBUF_SIZE];
972 +#if defined(_WIN32)
973 +    HANDLE h;
974 +#endif
975 +    int i;
976 +
977 +    assert(netdev->type == NET_CLIENT_DRIVER_PCAP);
978 +    pcap_opts = &netdev->u.pcap;
979 +    if (!pcap_opts->has_ifname)
980 +        return -1;
981 +
982 +    ifname = pcap_opts->ifname;
983 +
984 +    /* create the object */
985 +    nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname);
986 +    s = DO_UPCAST(struct PCAPState, nc, nc);
987 +
988 +    if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
989 +        fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
990 +        goto fail;
991 +    }
992
993 +#if defined(__FreeBSD__) || defined(__DragonFly__)
994 +    /*
995 +     * We want to avoid passing oversize packets to the guest, which
996 +     * at least on FreeBSD can happen if the host interface uses tso
997 +     * (seen with an em(4) in this case) - so find out the host
998 +    * interface's mtu and assume the guest is configured the same.
999 +     */
1000 +    s->max_eth_frame_size = 1514;
1001 +    i = socket(AF_INET, SOCK_DGRAM, 0);
1002 +    if (i >= 0) {
1003 +        struct ifreq ifr;
1004 +
1005 +        (void) memset(&ifr, 0, sizeof(ifr));
1006 +        strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
1007 +        if (ioctl(i, SIOCGIFMTU, &ifr) != -1)
1008 +            s->max_eth_frame_size = ifr.ifr_mtu + 14;
1009 +        close(i);
1010 +    }
1011 +#endif
1012 +
1013 +#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32)
1014 +    /*
1015 +     * Create pcap handle for the device, set promiscuous mode and activate.
1016 +     */
1017 +    s->handle = (void *)pcap_create(ifname, errbuf);
1018 +    if (!s->handle) {
1019 +        fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1020 +        goto fail;
1021 +    }
1022 +    if (pcap_set_promisc(s->handle, 1) != 0) {
1023 +        pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:");
1024 +        goto fail;
1025 +    }
1026 +   if (pcap_activate(s->handle) != 0) {
1027 +        pcap_perror(s->handle, (char *)"qemu: pcap_activate:");
1028 +        goto fail;
1029 +    }
1030 +#else
1031 +    /* Attempt to connect device. */
1032 +    s->handle = (void *)pcap_open_live(ifname, 65535, 1, 0, errbuf);
1033 +    if (!s->handle) {
1034 +        fprintf(stderr, "qemu: pcap_open_live: %s\n", errbuf);
1035 +        goto fail;
1036 +    }
1037 +#endif
1038 +
1039 +    /* Set non-blocking mode. */
1040 +    if (pcap_setnonblock(s->handle, 1, errbuf) < 0) {
1041 +        fprintf(stderr, "qemu: pcap_setnonblock: %s\n", errbuf);
1042 +        goto fail;
1043 +    }
1044 +
1045 +#if defined(_WIN32)
1046 +    /*
1047 +     * Tell the kernel that the packet has to be seen immediately.
1048 +     */
1049 +    if (pcap_setmintocopy(s->handle, 0) < 0) {
1050 +        fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1051 +        goto fail;
1052 +    }
1053 +#else /* !_WIN32 */
1054 +#if defined(CONFIG_BPF)
1055 +#if defined(BIOCIMMEDIATE)
1056 +    /*
1057 +     * Tell the kernel that the packet has to be seen immediately.
1058 +     */
1059 +    {
1060 +        unsigned int one = 1;
1061 +        if (ioctl(pcap_fileno(s->handle), BIOCIMMEDIATE, &one) < 0) {
1062 +            fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1063 +            goto fail;
1064 +        }
1065 +    }
1066 +#endif /* BIOCIMMEDIATE */
1067 +#if defined(BIOCFEEDBACK)
1068 +    /*
1069 +     * Tell the kernel that the sent packet has to be fed back.
1070 +     * This is necessary to connect host and guest.
1071 +     */
1072 +    {
1073 +        unsigned int one = 1;
1074 +        if (ioctl(pcap_fileno(s->handle), BIOCFEEDBACK, &one) < 0) {
1075 +            fprintf(stderr, "qemu: pcap failed to set feedback mode\n");
1076 +            goto fail;
1077 +        }
1078 +    }
1079 +#endif /* BIOCFEEDBACK */
1080 +#endif /* CONFIG_BPF */
1081 +#endif /* _WIN32 */
1082 +
1083 +    snprintf(s->nc.info_str, sizeof(s->nc.info_str), "pcap redirector");
1084 +
1085 +#if defined(_WIN32)
1086 +    if ((h = pcap_getevent(s->handle)) == NULL) {
1087 +        fprintf(stderr, "qemu: pcap_getevent failed\n");
1088 +        goto fail;
1089 +    }
1090 +    qemu_add_wait_object(h, pcap_send, s);
1091 +#else /* !_WIN32 */
1092 +    if ((i = pcap_get_selectable_fd(s->handle)) < 0) {
1093 +        fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n");
1094 +        goto fail;
1095 +    }
1096 +    qemu_set_fd_handler(i, pcap_send, NULL, s);
1097 +#endif /* _WIN32 */
1098 +
1099 +    return 0;
1100 +
1101 +fail:
1102 +    if (s) {
1103 +        if (s->handle)
1104 +            pcap_close(s->handle);
1105 +    }
1106 +
1107 +    return -1;
1108 +}
1109  
1110 +#endif
1111
1112  static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])(
1113      const Netdev *netdev,
1114      const char *name,
1115 @@ -960,6 +1183,9 @@ static int (* const net_client_init_fun[
1116  #ifdef CONFIG_L2TPV3
1117          [NET_CLIENT_DRIVER_L2TPV3]    = net_init_l2tpv3,
1118  #endif
1119 +#ifdef CONFIG_PCAP
1120 +       [NET_CLIENT_DRIVER_PCAP]      = net_init_pcap,
1121 +#endif
1122  };
1123  
1124  
1125
1126
1127 [FILE:423:patches/patch-net_tap-bsd.c]
1128 --- net/tap-bsd.c.orig  2019-11-14 18:06:20 UTC
1129 +++ net/tap-bsd.c
1130 @@ -32,9 +32,16 @@
1131  
1132  #if defined(__NetBSD__) || defined(__FreeBSD__)
1133  #include <sys/ioctl.h>
1134 +#include <sys/socket.h>
1135  #include <net/if.h>
1136  #include <net/if_tap.h>
1137  #endif
1138 +#if defined(__DragonFly)
1139 +#include <sys/ioctl.h>
1140 +#include <sys/socket.h>
1141 +#include <net/if.h>
1142 +#include <net/tap/if_tap.h>
1143 +#endif
1144  
1145  #if defined(__OpenBSD__)
1146  #include <sys/param.h>
1147
1148
1149 [FILE:1550:patches/patch-qapi_net.json]
1150 --- qapi/net.json.orig  2019-11-14 18:06:21 UTC
1151 +++ qapi/net.json
1152 @@ -385,6 +385,19 @@
1153      '*helper': 'str' } }
1154  
1155  ##
1156 +# @NetdevPcapOptions:
1157 +#
1158 +# Use ifname as a source to capture
1159 +#
1160 +# @ifname: #required to determine which interface to capture
1161 +#
1162 +# Since: 1.2
1163 +##
1164 +{ 'struct': 'NetdevPcapOptions',
1165 +  'data': {
1166 +    '*ifname':     'str' } }
1167 +
1168 +##
1169  # @NetdevHubPortOptions:
1170  #
1171  # Connect two or more net clients through a software hub.
1172 @@ -451,7 +464,7 @@
1173  ##
1174  { 'enum': 'NetClientDriver',
1175    'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1176 -            'bridge', 'hubport', 'netmap', 'vhost-user' ] }
1177 +            'bridge', 'hubport', 'netmap', 'vhost-user', 'pcap' ] }
1178  
1179  ##
1180  # @Netdev:
1181 @@ -474,6 +487,7 @@
1182      'user':     'NetdevUserOptions',
1183      'tap':      'NetdevTapOptions',
1184      'l2tpv3':   'NetdevL2TPv3Options',
1185 +    'pcap':     'NetdevPcapOptions',
1186      'socket':   'NetdevSocketOptions',
1187      'vde':      'NetdevVdeOptions',
1188      'bridge':   'NetdevBridgeOptions',
1189 @@ -509,7 +523,7 @@
1190  ##
1191  { 'enum': 'NetLegacyOptionsType',
1192    'data': ['none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1193 -           'bridge', 'netmap', 'vhost-user'] }
1194 +           'bridge', 'netmap', 'vhost-user', 'pcap'] }
1195  
1196  ##
1197  # @NetLegacyOptions:
1198 @@ -526,6 +540,7 @@
1199      'user':     'NetdevUserOptions',
1200      'tap':      'NetdevTapOptions',
1201      'l2tpv3':   'NetdevL2TPv3Options',
1202 +    'pcap':     'NetdevPcapOptions',
1203      'socket':   'NetdevSocketOptions',
1204      'vde':      'NetdevVdeOptions',
1205      'bridge':   'NetdevBridgeOptions',
1206
1207
1208 [FILE:756:patches/patch-qemu-doc.texi]
1209 --- qemu-doc.texi.orig  2019-11-14 18:06:21 UTC
1210 +++ qemu-doc.texi
1211 @@ -201,7 +201,7 @@ VGA BIOS.
1212  QEMU uses YM3812 emulation by Tatsuyuki Satoh.
1213  
1214  QEMU uses GUS emulation (GUSEMU32 @url{http://www.deinmeister.de/gusemu/})
1215 -by Tibor "TS" Schütz.
1216 +by Tibor "TS" Schuetz.
1217  
1218  Note that, by default, GUS shares IRQ(7) with parallel ports and so
1219  QEMU must be told to not have parallel ports to have working GUS.
1220 @@ -561,7 +561,8 @@ Send the escape character to the fronten
1221  
1222  @c man begin SEEALSO
1223  The HTML documentation of QEMU for more precise information and Linux
1224 -user mode emulator invocation.
1225 +user mode emulator invocation, as well as the FreeBSD host notes in
1226 +@file{pkg-message} in the relevant qemu port directory.
1227  @c man end
1228  
1229  @c man begin AUTHOR
1230
1231
1232 [FILE:7685:files/pkg-message-single]
1233 FreeBSD host notes
1234 ==================
1235
1236 - Needs to set net.link.tap.user_open sysctl in order to use /dev/tap*
1237   networking as non-root.  Don't forget to adjust device node permissions in
1238   /etc/devfs.rules.
1239
1240 - slirp (usermode networking) is fixed now in cvs, on FreeSBIE 1.0 guests you
1241   still have to manually do: echo nameserver 10.0.2.3 >/etc/resolv.conf but
1242   i've been told that that's normal.  (fixed on FreeSBIE 1.1.) And you have
1243   to wait a bit for dhclient to do its thing; traffic to address 10.0.2.2 is
1244   routed to 127.1 on the host.
1245
1246 - Expect timer problems when guest kernel HZ is > hosts, for example time
1247   sleep 1 takes 49 seconds and booting sleeps for minutes at the acd0 probe
1248   with a FreeSBIE 1.0 guest, thats because its kernel is built with HZ=5000,
1249   and FreeBSD's default is 100...  (no longer a problem with FreeSBIE 1.1.)
1250   The linux 2.6 kernel uses 1000 by default btw.  (changed to 250 later, and
1251   recent linux kernels now no longer have a fixed HZ, aka `tickless
1252   kernel'...)  Enabling /dev/rtc doesn't seem to help either (not included
1253   since it needs a patch to emulators/rtc.)
1254
1255 - Update: the above problem has gotten worse with FreeBSD guests
1256   somewhere before 8.0, mainly since the kernel now usually wants
1257   double or even quadruple number of timer irqs compared to HZ if
1258   it detects an apic (and at least early versions of FreeBSD 8 had
1259   a bug that essentially halved qemu's clock rate too); the only
1260   reason you usually don't see symptoms of this with FreeBSD 8
1261   guests is they automatically reduce their HZ to 100 when running
1262   in a VM while the default for the host kernel is still HZ=1000.
1263   Workaround: you can disable the apic clock in the guest by setting
1264
1265     hint.apic.0.clock="0"
1266
1267   in loader.conf(5) (or manually at the loader prompt), if that
1268   doesn't work the only things you can do is either reduce the
1269   guest's HZ to, say, 100 by setting e.g.
1270
1271     kern.hz="100"
1272
1273   from the loader as above (which usually is a good idea in a VM
1274   anyway and FreeBSD 8 now does by itself as mentioned), or otherwise
1275   increase the host's HZ to 2000 or even 4000 from the loader in
1276   the same way.
1277
1278 - The -smb option (smb-export local dir to guest using the default
1279   slirp networking) needs the samba port/package installed
1280   in addition to qemu. (SAMBA knob.)
1281
1282 - If you want to use usb devices connected to the host in the guest
1283   yot need either recent 10-current (not tested yet much) or you can
1284   use usbredir over the network (see below); also unless you are
1285   running qemu as root you then need to fix permissions for /dev/ugen*
1286   device nodes: if you are on 5.x or later (devfs) put a rule in
1287   /etc/devfs.rules, activate it in /etc/rc.conf and run /etc/rc.d/devfs
1288   restart.  Example devfs.rules:
1289
1290     [ugen_ruleset=20]
1291     add path 'ugen*' mode 660 group operator
1292
1293   corresponding rc.conf line:
1294
1295     devfs_system_ruleset="ugen_ruleset"
1296
1297 - If you want to test the new (in 0.15.0) usb network redirection (USBREDIR
1298   option) see this thread by Hans de Goede <hdegoede <at> redhat.com>:
1299
1300     http://thread.gmane.org/gmane.comp.emulators.qemu/110176/focus=110183
1301
1302   Quote:
1303
1304   Example usage:
1305
1306   1) Start usbredirserver for a usb device:
1307   sudo usbredirserver 045e:0772
1308   2) Start qemu with usb2 support + a chardev talking to usbredirserver +
1309      a usb-redir device using this chardev:
1310   qemu -usb \
1311     -readconfig docs/ich9-ehci-uhci.cfg \
1312     -chardev socket,id=usbredirchardev,host=localhost,port=4000 \
1313     -device usb-redir,chardev=usbredirchardev,id=usbredirdev ...
1314
1315   [you would replace docs/ich9-ehci-uhci.cfg with e.g.
1316   /raven/share/doc/qemu/docs/ich9-ehci-uhci.cfg, but turns out
1317   ehci was broken for me here with FreeBSD guests and the previous
1318   qemu version at least, I got:
1319
1320     FETCHENTRY: entry at 22C5484 is of type 2 which is not supported yet processing error - resetting ehci HC
1321     Assertion failed: (0), function ehci_advance_state, file /data/ports/emulators/qemu-devel/work/qemu-0.15.0/hw/usb-ehci.c, line 2045.
1322
1323   The new qemu version works better tho.]
1324
1325 - Still usb: since the hub is no longer attached to the uchi controller and
1326   the wakeup mechanism, resume interrupt is not implemented yet linux guests
1327   will suspend the bus, i.e. they wont see devices usb_add'ed after its
1328   (linux') uhci module got loaded.  Workaround: either add devices before
1329   linux loads the module or rmmod and modprobe it afterwards.  [Not sure
1330   if this still applies to the new libusb host code used on recent
1331   10-current.]
1332
1333 - If you build qemu wihout SDL and then get crashes running it try passing it
1334   -nographic.  This should probably be default in that case...
1335
1336 - qemu's network boot roms (-boot n) have a bug when bootfiles sizes are a
1337   multiple of blksize, if this affects you (like with FreeBSD's /boot/pxeboot)
1338   you can do like
1339
1340     cp /boot/pxeboot pxeboot-qemu && chmod +w pxeboot-qemu && echo >>pxeboot-qemu
1341
1342   and then use pxeboot-qemu.  Actually you need recent btx code
1343   (from after 7.0 was released) because of the real mode boot
1344   problem, so use at least pxeboot from there.  And I just did that
1345   for the pxeboot extracted out of
1346
1347     ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/200805/7.0-STABLE-200805-i386-bootonly.iso
1348
1349   and placed it here:
1350
1351     http://people.freebsd.org/~nox/qemu/pxeboot-qemu
1352
1353 - If you use slirp (usernet, the default) and want to mount nfs into the guest
1354   and you are not running qemu as root, then mountd(8) on the exporting box
1355   needs to be run with -n in order to accept requests from ports >= 1024.
1356
1357 - (not FreeBSD-specific:) There have been reports of qcow2 corruption with (at
1358   least) win2k guests on recent kvm (which uses similar qcow2 code than qemu
1359   now, see this thread:
1360
1361     http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00713.html -
1362
1363   the consensus on that thread seems to be that qcow(2) code has always been
1364   experimental and you should use raw images if you want reliability; raw is
1365   also usually faster.)  You should be able to migrate existing images to raw
1366   using qemu-img(1)'s convert function; raw doesn't support advanced features
1367   like snapshots tho.  [a few important qcow2 bugfixed have been committed in
1368   the meantime so this _might_ be less of an issue now; and meanwhile there
1369   also is the new qed format - I don't know how stable that one is.]
1370
1371 - (also not FreeBSD-specific:)  It is recommended to pass raw images using the
1372   new -drive syntax, specifying format=raw explicitly in order to avoid
1373   malicious guests being able to exploit the format autodetection thats
1374   otherwise getting used.  (Not that you should run malicious guests anyway,
1375   but this eleminates at least a known attack vector.)
1376
1377 - qemu now has improved physical cdrom support, but still there is at
1378   least one known problem: you need to have the guest eject the disc if you
1379   want to change it/take it out, or otherwise the guest may continue using
1380   state (like size) of the old disc.  (You can also do like `change ide1-cd0
1381   /dev/acd0' in the monitor after taking out the disc if a guest cannot eject
1382   it itself.)
1383
1384 - The default configuration location (qemu-ifup script etc.) has been changed
1385   from /etc to PREFIX/etc (usually /raven/etc).  Move your files accordingly.
1386
1387 - The pcap code (-net nic... -net pcap,ifname=...) should work properly now,
1388   with only one exception:  Advanced features like TSO used on the host
1389   interface can cause oversize packets which now do get truncated to avoid
1390   confusing/panicing guests but of course still will cause retransmissions.
1391   So if you see slow throughput and `pcap_send: packet size > ..., truncating'
1392   messages on qemu's tty try disabling TSO etc on the host interface at least
1393   while using pcap.
1394
1395
1396 [FILE:20:files/qemu-ifdown.sample]
1397 #!/bin/sh
1398 exec true
1399
1400
1401 [FILE:20:files/qemu-ifup.sample]
1402 #!/bin/sh
1403 exec true
1404
1405
1406 [FILE:66:files/special.mk]
1407 .if "${ARCH_STANDARD}" == "x86_64"
1408 MAKE_ARGS+=     ARCH=x86_64
1409 .endif
1410
1411
1412 [FILE:436:dragonfly/patch-disas_libvixl_vixl_utils.h]
1413 --- disas/libvixl/vixl/utils.h.orig     2019-11-14 18:06:20 UTC
1414 +++ disas/libvixl/vixl/utils.h
1415 @@ -42,6 +42,13 @@ namespace vixl {
1416  #define PRINTF_CHECK(format_index, varargs_index)
1417  #endif
1418  
1419 +#ifndef INT64_C
1420 +#define INT32_C(c) c
1421 +#define INT64_C(c) (c ## LL)
1422 +#define UINT32_C(c) (c ## U)
1423 +#define UINT64_C(c) (c ## ULL)
1424 +#endif
1425 +
1426  // Check number width.
1427  inline bool is_intn(unsigned n, int64_t x) {
1428    VIXL_ASSERT((0 < n) && (n < 64));
1429
1430
1431 [FILE:323:dragonfly/patch-hw-ppc_newworld.c]
1432 --- hw/ppc/mac_newworld.c.orig  2019-11-14 18:06:20 UTC
1433 +++ hw/ppc/mac_newworld.c
1434 @@ -74,6 +74,11 @@
1435  #include "hw/sysbus.h"
1436  #include "trace.h"
1437  
1438 +/* FreeBSD headers define this */
1439 +#ifdef round_page
1440 +#undef round_page
1441 +#endif
1442 +
1443  #define MAX_IDE_BUS 2
1444  #define CFG_ADDR 0xf0000510
1445  #define TBFREQ (100UL * 1000UL * 1000UL)
1446
1447
1448 [FILE:334:dragonfly/patch-hw_ppc_mac__oldworld.c]
1449 --- hw/ppc/mac_oldworld.c.orig  2019-11-14 18:06:20 UTC
1450 +++ hw/ppc/mac_oldworld.c
1451 @@ -60,6 +60,11 @@
1452  
1453  #define GRACKLE_BASE 0xfec00000
1454  
1455 +/* FreeBSD headers define this */
1456 +#ifdef round_page
1457 +#undef round_page
1458 +#endif
1459 +
1460  static void fw_cfg_boot_set(void *opaque, const char *boot_device,
1461                              Error **errp)
1462  {
1463
1464
1465 [FILE:843:dragonfly/patch-util_coroutine-ucontext.c]
1466 --- util/coroutine-ucontext.c.orig      2019-11-14 18:06:21 UTC
1467 +++ util/coroutine-ucontext.c
1468 @@ -158,7 +158,15 @@ Coroutine *qemu_coroutine_new(void)
1469                  2, arg.i[0], arg.i[1]);
1470  
1471      /* swapcontext() in, siglongjmp() back out */
1472 -    if (!sigsetjmp(old_env, 0)) {
1473 +    /* Save signal mask in this sigsetjmp, because makecontext on DragonFly
1474 +     * leaves all signals blocked when entering the new context with
1475 +     * swapcontext.
1476 +     * Workaround this, by just having the signal mask restored by the
1477 +     * siglongjmp that brings us back from qemu_coroutine_new().
1478 +     * XXX Remove this workaround when the makecontext behaviour is fixed
1479 +     *     on DragonFly.
1480 +     */
1481 +    if (!sigsetjmp(old_env, 1)) {
1482          start_switch_fiber(&fake_stack_save, co->stack, co->stack_size);
1483          swapcontext(&old_uc, &uc);
1484      }
1485