mbox series

[RFC,v3,00/10] Native Library Calls

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

Message

Yeqi Fu June 25, 2023, 9:26 p.m. UTC
This patch introduces a set of specialized 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 specialized instructions. At runtime, user
programs load the shared library, and specialized 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.

Yeqi Fu (10):
  docs: Add specification for native library calls
  build: Add configure options for native calls
  build: Implement libnative library and configure options
  linux-user: Implement envlist_appendenv
  linux-user: Implement native-bypass option support
  accel/tcg: Add support for native library calls
  target/i386: Add support for native library calls
  target/mips: Add support for native library calls
  target/arm: Add support for native library calls
  tests/tcg/multiarch: Add nativecalls.c test

 Makefile                                 |   2 +
 accel/tcg/tcg-runtime.c                  |  37 ++++++++
 accel/tcg/tcg-runtime.h                  |   4 +
 common-user/native/Makefile.include      |   9 ++
 common-user/native/Makefile.target       |  26 ++++++
 common-user/native/libnative.c           | 112 +++++++++++++++++++++++
 configs/targets/aarch64-linux-user.mak   |   1 +
 configs/targets/arm-linux-user.mak       |   1 +
 configs/targets/i386-linux-user.mak      |   1 +
 configs/targets/mips-linux-user.mak      |   1 +
 configs/targets/mips64-linux-user.mak    |   1 +
 configs/targets/x86_64-linux-user.mak    |   1 +
 configure                                |  84 +++++++++++++----
 docs/native_calls.txt                    |  70 ++++++++++++++
 include/native/libnative.h               |  12 +++
 include/native/native-calls.h            |  75 +++++++++++++++
 include/native/native-defs.h             |  65 +++++++++++++
 include/qemu/envlist.h                   |   1 +
 linux-user/main.c                        |  36 ++++++++
 target/arm/tcg/translate-a64.c           |  27 +++++-
 target/arm/tcg/translate.c               |  25 ++++-
 target/arm/tcg/translate.h               |   6 ++
 target/i386/tcg/translate.c              |  33 +++++++
 target/mips/tcg/translate.c              |  26 ++++++
 target/mips/tcg/translate.h              |   2 +
 tests/tcg/multiarch/Makefile.target      |   9 +-
 tests/tcg/multiarch/native/nativecalls.c | 103 +++++++++++++++++++++
 util/envlist.c                           |  61 ++++++++++++
 28 files changed, 810 insertions(+), 21 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 docs/native_calls.txt
 create mode 100644 include/native/libnative.h
 create mode 100644 include/native/native-calls.h
 create mode 100644 include/native/native-defs.h
 create mode 100644 tests/tcg/multiarch/native/nativecalls.c