mirror of
https://github.com/utmapp/qemu.git
synced 2026-05-26 13:51:06 +00:00
coroutine: add libucontext as external library
iOS does not support ucontext natively for aarch64 and the sigaltstack is also unsupported (even worse, it fails silently, see: https://openradar.appspot.com/13002712 ) As a workaround we include a library implementation of ucontext and add it as a build option.
This commit is contained in:
@@ -64,3 +64,6 @@
|
||||
[submodule "roms/vbootrom"]
|
||||
path = roms/vbootrom
|
||||
url = https://gitlab.com/qemu-project/vbootrom.git
|
||||
[submodule "libucontext"]
|
||||
path = subprojects/libucontext
|
||||
url = https://github.com/utmapp/libucontext.git
|
||||
|
||||
@@ -1786,7 +1786,7 @@ Advanced options (experts only):
|
||||
--oss-lib path to OSS library
|
||||
--cpu=CPU Build for host CPU [$cpu]
|
||||
--with-coroutine=BACKEND coroutine backend. Supported options:
|
||||
ucontext, sigaltstack, windows
|
||||
ucontext, libucontext, sigaltstack, windows
|
||||
--enable-gcov enable test coverage analysis with gcov
|
||||
--disable-blobs disable installing provided firmware blobs
|
||||
--with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
|
||||
@@ -4545,12 +4545,26 @@ else
|
||||
error_exit "only the 'windows' coroutine backend is valid for Windows"
|
||||
fi
|
||||
;;
|
||||
libucontext)
|
||||
;;
|
||||
*)
|
||||
error_exit "unknown coroutine backend $coroutine"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case $coroutine in
|
||||
libucontext)
|
||||
git_submodules="${git_submodules} subprojects/libucontext"
|
||||
coroutine_impl=ucontext
|
||||
libucontext="enabled"
|
||||
;;
|
||||
*)
|
||||
coroutine_impl=$coroutine
|
||||
libucontext="disabled"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$coroutine_pool" = ""; then
|
||||
coroutine_pool=yes
|
||||
fi
|
||||
@@ -5887,7 +5901,7 @@ if test "$qom_cast_debug" = "yes" ; then
|
||||
echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
|
||||
echo "CONFIG_COROUTINE_BACKEND=$coroutine_impl" >> $config_host_mak
|
||||
if test "$coroutine_pool" = "yes" ; then
|
||||
echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
|
||||
else
|
||||
@@ -6450,7 +6464,7 @@ NINJA=$ninja $meson setup \
|
||||
-Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
|
||||
-Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
|
||||
-Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \
|
||||
-Dattr=$attr -Ddefault_devices=$default_devices \
|
||||
-Dattr=$attr -Ddefault_devices=$default_devices -Ducontext=$libucontext \
|
||||
-Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
|
||||
-Dvhost_user_blk_server=$vhost_user_blk_server -Dmultiprocess=$multiprocess \
|
||||
-Dfuse=$fuse -Dfuse_lseek=$fuse_lseek -Dguest_agent_msi=$guest_agent_msi \
|
||||
|
||||
+11
-1
@@ -1583,9 +1583,18 @@ if not fdt.found() and fdt_required.length() > 0
|
||||
error('fdt not available but required by targets ' + ', '.join(fdt_required))
|
||||
endif
|
||||
|
||||
ucontext = dependency('libucontext', kwargs: static_kwargs, required : false)
|
||||
if not ucontext.found() and get_option('ucontext').enabled()
|
||||
libucontext_proj = subproject('libucontext',
|
||||
default_options: ['default_library=static',
|
||||
'freestanding=true'])
|
||||
ucontext = libucontext_proj.get_variable('libucontext_dep')
|
||||
endif
|
||||
|
||||
config_host_data.set('CONFIG_CAPSTONE', capstone.found())
|
||||
config_host_data.set('CONFIG_FDT', fdt.found())
|
||||
config_host_data.set('CONFIG_SLIRP', slirp.found())
|
||||
config_host_data.set('CONFIG_LIBUCONTEXT', ucontext.found())
|
||||
|
||||
#####################
|
||||
# Generated sources #
|
||||
@@ -1833,7 +1842,7 @@ util_ss.add_all(trace_ss)
|
||||
util_ss = util_ss.apply(config_all, strict: false)
|
||||
libqemuutil = static_library('qemuutil',
|
||||
sources: util_ss.sources() + stub_ss.sources() + genh,
|
||||
dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
|
||||
dependencies: [util_ss.dependencies(), m, glib, socket, malloc, ucontext])
|
||||
qemuutil = declare_dependency(link_with: libqemuutil,
|
||||
sources: genh + version_res)
|
||||
|
||||
@@ -2577,6 +2586,7 @@ summary(summary_info, bool_yn: true, section: 'Targets and accelerators')
|
||||
|
||||
# Block layer
|
||||
summary_info = {}
|
||||
summary_info += {'libucontext support': ucontext.found()}
|
||||
summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
|
||||
summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
|
||||
if have_block
|
||||
|
||||
@@ -110,6 +110,8 @@ option('fuse', type: 'feature', value: 'auto',
|
||||
description: 'FUSE block device export')
|
||||
option('fuse_lseek', type : 'feature', value : 'auto',
|
||||
description: 'SEEK_HOLE/SEEK_DATA support for FUSE exports')
|
||||
option('ucontext', type : 'feature', value : 'disabled',
|
||||
description: 'libucontext support')
|
||||
|
||||
option('vhost_user_blk_server', type: 'feature', value: 'auto',
|
||||
description: 'build vhost-user-blk server')
|
||||
|
||||
Submodule
+1
Submodule subprojects/libucontext added at 9b1d8f01a6
@@ -23,7 +23,16 @@
|
||||
#undef _FORTIFY_SOURCE
|
||||
#endif
|
||||
#include "qemu/osdep.h"
|
||||
#if defined(CONFIG_LIBUCONTEXT)
|
||||
#include <libucontext/libucontext.h>
|
||||
#define ucontext_t libucontext_ucontext_t
|
||||
#define getcontext libucontext_getcontext
|
||||
#define setcontext libucontext_setcontext
|
||||
#define swapcontext libucontext_swapcontext
|
||||
#define makecontext libucontext_makecontext
|
||||
#else
|
||||
#include <ucontext.h>
|
||||
#endif
|
||||
#include "qemu/coroutine_int.h"
|
||||
|
||||
#ifdef CONFIG_VALGRIND_H
|
||||
|
||||
Reference in New Issue
Block a user