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 (9): build: Implement logic for sharing cross-building config files build: Implement libnative library and the build machinery for libnative 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.c | 66 ++++++++++ accel/tcg/tcg-runtime.h | 12 ++ common-user/native/Makefile.include | 8 ++ common-user/native/Makefile.target | 22 ++++ common-user/native/libnative.S | 51 ++++++++ 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 | 91 ++++++++++++++ include/exec/helper-head.h | 1 + include/native/native-defs.h | 41 +++++++ include/native/native.h | 7 ++ include/tcg/tcg-op-common.h | 13 ++ include/tcg/tcg-op.h | 2 + include/tcg/tcg.h | 8 ++ linux-user/main.c | 20 +++ linux-user/syscall.c | 55 +++++++++ target/arm/tcg/translate-a64.c | 32 +++++ target/arm/tcg/translate.c | 29 +++++ target/arm/tcg/translate.h | 5 + target/i386/tcg/translate.c | 38 ++++++ target/mips/tcg/translate.c | 30 ++++- tcg/tcg-op.c | 36 ++++++ tcg/tcg.c | 154 ++++++++++++++++++++++++ tests/tcg/multiarch/Makefile.target | 32 +++++ tests/tcg/multiarch/native/nativecall.c | 132 ++++++++++++++++++++ 32 files changed, 970 insertions(+), 24 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 -- 2.34.1