mbox series

[RFC,v2,0/6] Native Library Calls

Message ID 20230607164750.829586-1-fufuyqqqqqq@gmail.com
Headers show
Series Native Library Calls | expand

Message

Yeqi Fu June 7, 2023, 4:47 p.m. UTC
This patch introduces a set of feature instructions for native calls
and provides helpers to translate these instructions to corresponding
native functions. A shared library is also implemented, where native
functions are rewritten as feature instructions. At runtime, user
programs load the shared library, and feature instructions are
executed when native functions are called. This patch is applicable
to user programs with architectures x86, x86_64, arm, aarch64, mips,
and mips64. To build, compile libnative.c into a shared library for
the user program's architecture and run the
'../configure --enable-user-native-call && make' command.

Yeqi Fu (6):
  build: Add configure options for native calls
  Add the libnative library
  target/i386: Add native library calls
  target/mips: Add native library calls
  target/arm: Add native library calls
  linux-user: Add '-native-bypass' option

 Makefile                             |  4 ++
 common-user/native/Makefile.include  |  9 ++++
 common-user/native/Makefile.target   | 22 ++++++++++
 common-user/native/libnative.c       | 65 ++++++++++++++++++++++++++++
 configure                            | 50 +++++++++++++++++++++
 docs/devel/build-system.rst          |  4 ++
 include/native/libnative.h           | 11 +++++
 include/native/native-func.h         | 11 +++++
 include/qemu/envlist.h               |  1 +
 linux-user/main.c                    | 23 ++++++++++
 meson.build                          |  8 ++++
 meson_options.txt                    |  2 +
 scripts/meson-buildoptions.sh        |  4 ++
 target/arm/helper.c                  | 47 ++++++++++++++++++++
 target/arm/helper.h                  |  6 +++
 target/arm/tcg/translate-a64.c       | 22 ++++++++++
 target/arm/tcg/translate.c           | 25 ++++++++++-
 target/arm/tcg/translate.h           | 19 ++++++++
 target/i386/helper.h                 |  6 +++
 target/i386/tcg/translate.c          | 20 +++++++++
 target/i386/tcg/user/meson.build     |  1 +
 target/i386/tcg/user/native_helper.c | 65 ++++++++++++++++++++++++++++
 target/mips/helper.h                 |  6 +++
 target/mips/tcg/meson.build          |  1 +
 target/mips/tcg/native_helper.c      | 55 +++++++++++++++++++++++
 target/mips/tcg/translate.c          | 20 ++++++++-
 target/mips/tcg/translate.h          | 12 +++++
 util/envlist.c                       | 56 ++++++++++++++++++++++++
 28 files changed, 573 insertions(+), 2 deletions(-)
 create mode 100644 common-user/native/Makefile.include
 create mode 100644 common-user/native/Makefile.target
 create mode 100644 common-user/native/libnative.c
 create mode 100644 include/native/libnative.h
 create mode 100644 include/native/native-func.h
 create mode 100644 target/i386/tcg/user/native_helper.c
 create mode 100644 target/mips/tcg/native_helper.c