Add a minimal dlcall plugin that lets the guest invoke host functions through magic system calls. The plugin registers a vCPU syscall filter callback that intercepts a reserved syscall number and dispatches a set of pass-through operations: querying host attributes, loading and freeing shared libraries, resolving symbols, retrieving the last library error, and invoking a host function through a common interface. The magic syscall number defaults to 4096 and can be overridden at load time with the "syscall_num=N" argument; values low enough to clash with a real syscall are rejected. Co-authored-by: Kailiang Xu <xukl2019@sjtu.edu.cn> Co-authored-by: Mingyuan Xia <xiamy@ultrarisc.com> Signed-off-by: Ziyang Zhang <functioner@sjtu.edu.cn> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/20260711094523.622997-2-functioner@sjtu.edu.cn Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
45 lines
799 B
Meson
45 lines
799 B
Meson
contrib_plugins = [
|
|
'bbv.c',
|
|
'cache.c',
|
|
'cflow.c',
|
|
'drcov.c',
|
|
'execlog.c',
|
|
'hotblocks.c',
|
|
'hotpages.c',
|
|
'howvec.c',
|
|
'hwprofile.c',
|
|
'ips.c',
|
|
'stoptrigger.c',
|
|
'traps.c',
|
|
'uftrace.c',
|
|
]
|
|
|
|
if host_os != 'windows'
|
|
# lockstep uses socket.h
|
|
contrib_plugins += 'lockstep.c'
|
|
endif
|
|
|
|
if host_os == 'linux'
|
|
# dlcall passes guest calls through to host libraries; linux-user only
|
|
contrib_plugins += 'dlcall.c'
|
|
endif
|
|
|
|
if 'cpp' in all_languages
|
|
contrib_plugins += 'cpp.cpp'
|
|
endif
|
|
|
|
t = []
|
|
if get_option('plugins')
|
|
foreach i : contrib_plugins
|
|
t += shared_module(fs.stem(i), files(i),
|
|
dependencies: plugins_deps)
|
|
endforeach
|
|
endif
|
|
if t.length() > 0
|
|
alias_target('contrib-plugins', t)
|
|
else
|
|
run_target('contrib-plugins', command: [python, '-c', ''])
|
|
endif
|
|
|
|
plugin_modules += t
|