[RFC v5 00/10] Native Library Calls

Yeqi Fu posted 10 patches 1 year, 3 months ago
Only 4 patches received!
There is a newer version of this series
Makefile                                |   2 +
accel/tcg/tcg-runtime.h                 |  22 +++
common-user/native/Makefile.include     |   9 ++
common-user/native/Makefile.target      |  22 +++
common-user/native/libnative.S          |  69 +++++++++
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                               | 100 +++++++++---
docs/user/index.rst                     |   1 +
docs/user/native_calls.rst              |  90 +++++++++++
include/native/native-defs.h            |  42 ++++++
include/native/native.h                 |   9 ++
include/qemu/envlist.h                  |  13 ++
include/tcg/tcg-op-common.h             |  11 ++
include/tcg/tcg.h                       |   9 ++
linux-user/main.c                       |  38 +++++
linux-user/syscall.c                    |  21 +++
target/arm/tcg/translate-a64.c          |  31 ++++
target/arm/tcg/translate.c              |  28 ++++
target/arm/tcg/translate.h              |   5 +
target/i386/tcg/translate.c             |  37 +++++
target/mips/tcg/translate.c             |  36 ++++-
tcg/tcg-op.c                            | 193 +++++++++++++++++++++++-
tests/tcg/multiarch/Makefile.target     |  30 ++++
tests/tcg/multiarch/native/nativecall.c | 121 +++++++++++++++
tests/unit/meson.build                  |   1 +
tests/unit/test-envlist.c               |  94 ++++++++++++
util/envlist.c                          |  67 ++++++--
32 files changed, 1072 insertions(+), 35 deletions(-)
create mode 100644 common-user/native/Makefile.include
create mode 100644 common-user/native/Makefile.target
create mode 100644 common-user/native/libnative.S
create mode 100644 docs/user/native_calls.rst
create mode 100644 include/native/native-defs.h
create mode 100644 include/native/native.h
create mode 100644 tests/tcg/multiarch/native/nativecall.c
create mode 100644 tests/unit/test-envlist.c
[RFC v5 00/10] Native Library Calls
Posted by Yeqi Fu 1 year, 3 months ago
Executing a program under QEMU's user mode subjects the entire
program, including all library calls, to translation. It's important
to understand that many of these library functions are optimized
specifically for the guest architecture. Therefore, their
translation might not yield the most efficient execution.

When the semantics of a library function are well defined, we can
capitalize on this by substituting the translated version with a call
to the native equivalent function.

To achieve tangible results, focus should be given to functions such
as memory-related ('mem*') and string-related ('str*') functions.
These subsets of functions often have the most significant effect
on overall performance, making them optimal candidates for
optimization.

Yeqi Fu (10):
  build: Implement logic for sharing cross-building config files
  build: Implement libnative library and the build machinery for
    libnative
  linux-user: Implement envlist_appendenv and add tests for envlist
  linux-user: Implement native-bypass option support
  tcg: Add tcg opcodes and helpers 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 nativecall.c test
  docs/user: Add doc for native library calls

 Makefile                                |   2 +
 accel/tcg/tcg-runtime.h                 |  22 +++
 common-user/native/Makefile.include     |   9 ++
 common-user/native/Makefile.target      |  22 +++
 common-user/native/libnative.S          |  69 +++++++++
 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                               | 100 +++++++++---
 docs/user/index.rst                     |   1 +
 docs/user/native_calls.rst              |  90 +++++++++++
 include/native/native-defs.h            |  42 ++++++
 include/native/native.h                 |   9 ++
 include/qemu/envlist.h                  |  13 ++
 include/tcg/tcg-op-common.h             |  11 ++
 include/tcg/tcg.h                       |   9 ++
 linux-user/main.c                       |  38 +++++
 linux-user/syscall.c                    |  21 +++
 target/arm/tcg/translate-a64.c          |  31 ++++
 target/arm/tcg/translate.c              |  28 ++++
 target/arm/tcg/translate.h              |   5 +
 target/i386/tcg/translate.c             |  37 +++++
 target/mips/tcg/translate.c             |  36 ++++-
 tcg/tcg-op.c                            | 193 +++++++++++++++++++++++-
 tests/tcg/multiarch/Makefile.target     |  30 ++++
 tests/tcg/multiarch/native/nativecall.c | 121 +++++++++++++++
 tests/unit/meson.build                  |   1 +
 tests/unit/test-envlist.c               |  94 ++++++++++++
 util/envlist.c                          |  67 ++++++--
 32 files changed, 1072 insertions(+), 35 deletions(-)
 create mode 100644 common-user/native/Makefile.include
 create mode 100644 common-user/native/Makefile.target
 create mode 100644 common-user/native/libnative.S
 create mode 100644 docs/user/native_calls.rst
 create mode 100644 include/native/native-defs.h
 create mode 100644 include/native/native.h
 create mode 100644 tests/tcg/multiarch/native/nativecall.c
 create mode 100644 tests/unit/test-envlist.c

-- 
2.34.1