[RFC v6 5/9] target/i386: Add support for native library calls

2023-09-12 Thread Yeqi Fu
This commit introduces support for native library calls on the i386 target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/i386-linux-user.mak | 1

[RFC v6 2/9] build: Implement libnative library and the build machinery for libnative

2023-09-12 Thread Yeqi Fu
This commit implements a shared library, where native functions are rewritten as special instructions. At runtime, user programs load the shared library, and special instructions are executed when native functions are called. Signed-off-by: Yeqi Fu --- Makefile| 2

[RFC v6 9/9] docs/user: Add doc for native library calls

2023-09-12 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- docs/user/index.rst| 1 + docs/user/native_calls.rst | 91 ++ 2 files changed, 92 insertions(+) create mode 100644 docs/user/native_calls.rst diff --git a/docs/user/index.rst b/docs/user/index.rst index 782d27cda2

[RFC v6 3/9] linux-user: Implement native-bypass option support

2023-09-12 Thread Yeqi Fu
effortlessly. Signed-off-by: Yeqi Fu --- include/native/native.h | 7 ++ linux-user/main.c | 20 +++ linux-user/syscall.c| 55 + 3 files changed, 82 insertions(+) create mode 100644 include/native/native.h diff --git a/include

[RFC v6 8/9] tests/tcg/multiarch: Add nativecall.c test

2023-09-12 Thread Yeqi Fu
Introduce a new test for native calls to ensure their functionality. The process involves cross-compiling the test cases, building them as dynamically linked binaries, and running these binaries which necessitates the addition of the appropriate interpreter prefix. Signed-off-by: Yeqi Fu

[RFC v6 6/9] target/mips: Add support for native library calls

2023-09-12 Thread Yeqi Fu
This commit introduces support for native library calls on the mips target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/mips-linux-user.mak | 1

[RFC v6 7/9] target/arm: Add support for native library calls

2023-09-12 Thread Yeqi Fu
This commit introduces support for native library calls on the arm target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/aarch64-linux-user.mak | 1

[RFC v6 4/9] tcg: Add tcg opcodes and helpers for native library calls

2023-09-12 Thread Yeqi Fu
, tcg_gen_g2h and tcg_gen_h2g are used for address conversion. Signed-off-by: Yeqi Fu --- accel/tcg/tcg-runtime.c | 66 +++ accel/tcg/tcg-runtime.h | 12 +++ include/exec/helper-head.h | 1 + include/native/native-defs.h | 41 ++ include/tcg/tcg-op-common.h

[RFC v6 1/9] build: Implement logic for sharing cross-building config files

2023-09-12 Thread Yeqi Fu
configuration is needed. Since config_host_mak essentially contains all the information from the original tests/tcg/config-host.mak, the original config-host.mak has been deleted and replaced with a symbolic link to config_host_mak. Signed-off-by: Yeqi Fu --- configure | 61

[RFC v6 0/9] Native Library Calls

2023-09-12 Thread Yeqi Fu
m*') 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 l

[RFC v5 09/10] tests/tcg/multiarch: Add nativecall.c test

2023-08-25 Thread Yeqi Fu
Introduce a new test for native calls to ensure their functionality. The process involves cross-compiling the test cases, building them as dynamically linked binaries, and running these binaries which necessitates the addition of the appropriate interpreter prefix. Signed-off-by: Yeqi Fu

[RFC v5 08/10] target/arm: Add support for native library calls

2023-08-25 Thread Yeqi Fu
This commit introduces support for native library calls on the arm target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/aarch64-linux-user.mak | 1

[RFC v5 05/10] tcg: Add tcg opcodes and helpers for native library calls

2023-08-25 Thread Yeqi Fu
, tcg_gen_g2h and tcg_gen_h2g are used for address conversion. Signed-off-by: Yeqi Fu --- accel/tcg/tcg-runtime.h | 22 include/native/native-defs.h | 42 include/tcg/tcg-op-common.h | 11 ++ include/tcg/tcg.h| 9 ++ tcg/tcg-op.c | 193

[RFC v5 06/10] target/i386: Add support for native library calls

2023-08-25 Thread Yeqi Fu
This commit introduces support for native library calls on the i386 target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/i386-linux-user.mak | 1

[RFC v5 10/10] docs/user: Add doc for native library calls

2023-08-25 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- docs/user/index.rst| 1 + docs/user/native_calls.rst | 90 ++ 2 files changed, 91 insertions(+) create mode 100644 docs/user/native_calls.rst diff --git a/docs/user/index.rst b/docs/user/index.rst index 782d27cda2

[RFC v5 07/10] target/mips: Add support for native library calls

2023-08-25 Thread Yeqi Fu
This commit introduces support for native library calls on the mips target. When encountering special instructions reserved for native calls, this commit extracts the function name and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/mips-linux-user.mak | 1

[RFC v5 01/10] build: Implement logic for sharing cross-building config files

2023-08-25 Thread Yeqi Fu
configuration is needed. Since config_host_mak essentially contains all the information from the original tests/tcg/config-host.mak, the original config-host.mak has been deleted and replaced with a symbolic link to config_host_mak. Signed-off-by: Yeqi Fu --- configure | 61

[RFC v5 03/10] linux-user: Implement envlist_appendenv and add tests for envlist

2023-08-25 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- include/qemu/envlist.h| 13 ++ tests/unit/meson.build| 1 + tests/unit/test-envlist.c | 94 +++ util/envlist.c| 67 +++- 4 files changed, 165 insertions(+), 10 deletions(-) create

[RFC v5 02/10] build: Implement libnative library and the build machinery for libnative

2023-08-25 Thread Yeqi Fu
This commit implements a shared library, where native functions are rewritten as special instructions. At runtime, user programs load the shared library, and special instructions are executed when native functions are called. Signed-off-by: Yeqi Fu --- Makefile| 2

[RFC v5 04/10] linux-user: Implement native-bypass option support

2023-08-25 Thread Yeqi Fu
This commit implements the -native-bypass support in linux-user. The native_calls_enabled() function can be true only when the '-native-bypass' option is given. Signed-off-by: Yeqi Fu --- include/native/native.h | 9 + linux-user/main.c

[RFC v5 00/10] Native Library Calls

2023-08-25 Thread Yeqi Fu
m*') 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 l

[RFC v4 01/11] build: Implement logic for sharing cross-building config files

2023-08-08 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- configure | 57 +-- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 2b41c49c0d..a076583141 100755 --- a/configure +++ b/configure @@ -1751,56 +1751,67 @@ if test

[RFC v4 09/11] target/arm: Add support for native library calls

2023-08-08 Thread Yeqi Fu
This commit introduces support for native library calls on the arm target. When special instructions reserved for native calls are encountered, the code now performs address translation and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/aarch64-linux

[RFC v4 10/11] tests/tcg/multiarch: Add nativecall.c test

2023-08-08 Thread Yeqi Fu
Introduce a new test for native calls to ensure their functionality. The process involves cross-compiling the test cases, building them as dynamically linked binaries, and running these binaries which necessitates the addition of the appropriate interpreter prefix. Signed-off-by: Yeqi Fu

[RFC v4 04/11] linux-user: Implement native-bypass option support

2023-08-08 Thread Yeqi Fu
This commit implements the -native-bypass support in linux-user. The native_calls_enabled() function can be true only when the '-native-bypass' option is given. Signed-off-by: Yeqi Fu --- include/native/native.h | 9 + linux-user/main.c

[RFC v4 05/11] linux-user/elfload: Add support for parsing symbols of native libraries.

2023-08-08 Thread Yeqi Fu
: Yeqi Fu --- linux-user/elfload.c | 85 +--- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 9a2ec568b0..9448f91005 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -22,6 +22,9

[RFC v4 11/11] docs/user: Add doc for native library calls

2023-08-08 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- docs/user/index.rst| 1 + docs/user/native_calls.rst | 90 ++ 2 files changed, 91 insertions(+) create mode 100644 docs/user/native_calls.rst diff --git a/docs/user/index.rst b/docs/user/index.rst index 782d27cda2

[RFC v4 07/11] target/i386: Add support for native library calls

2023-08-08 Thread Yeqi Fu
This commit introduces support for native library calls on the i386 target. When special instructions reserved for native calls are encountered, the code now performs address translation and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/i386-linux-user.mak

[RFC v4 03/11] linux-user: Implement envlist_appendenv and add tests for envlist

2023-08-08 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- include/qemu/envlist.h| 13 ++ tests/unit/meson.build| 1 + tests/unit/test-envlist.c | 94 +++ util/envlist.c| 71 - 4 files changed, 169 insertions(+), 10 deletions(-) create

[RFC v4 06/11] tcg: Add tcg opcodes and helpers for native library calls

2023-08-08 Thread Yeqi Fu
This commit implements tcg opcodes and helpers for extracting and invoke native functions. Signed-off-by: Yeqi Fu --- accel/tcg/tcg-runtime.h | 22 ++ include/tcg/tcg-op-common.h | 11 +++ include/tcg/tcg.h | 9 +++ tcg/tcg-op.c| 140

[RFC v4 08/11] target/mips: Add support for native library calls

2023-08-08 Thread Yeqi Fu
This commit introduces support for native library calls on the mips target. When special instructions reserved for native calls are encountered, the code now performs address translation and generates the corresponding native call. Signed-off-by: Yeqi Fu --- configs/targets/mips-linux-user.mak

[RFC v4 02/11] build: Implement libnative library and the build machinery for libnative

2023-08-08 Thread Yeqi Fu
This commit implements a shared library, where native functions are rewritten as special instructions. At runtime, user programs load the shared library, and special instructions are executed when native functions are called. Signed-off-by: Yeqi Fu --- Makefile| 2

[RFC v4 00/11] Native Library Calls

2023-08-08 Thread Yeqi Fu
m*') 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 (11): build: Implement logic for sharing cross-building config files build: Implement l

[RFC v3 10/10] tests/tcg/multiarch: Add nativecalls.c test

2023-06-25 Thread Yeqi Fu
Add a test for native calls to verify the functionality of native functions. This requires cross-compiling test cases and building them as dynamically linked binaries. Also, introduce necessary system libraries in QEMU. Signed-off-by: Yeqi Fu --- tests/tcg/multiarch/Makefile.target | 9

[RFC v3 08/10] target/mips: Add support for native library calls

2023-06-25 Thread Yeqi Fu
Upon encountering specialized instructions reserved for native calls, store the function id and argument types, then invoke helper. Signed-off-by: Yeqi Fu --- target/mips/tcg/translate.c | 26 ++ target/mips/tcg/translate.h | 2 ++ 2 files changed, 28 insertions

[RFC v3 01/10] docs: Add specification for native library calls

2023-06-25 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- docs/native_calls.txt | 70 +++ 1 file changed, 70 insertions(+) create mode 100644 docs/native_calls.txt diff --git a/docs/native_calls.txt b/docs/native_calls.txt new file mode 100644 index 00..8906566b13 --- /dev

[RFC v3 05/10] linux-user: Implement native-bypass option support

2023-06-25 Thread Yeqi Fu
This commit implements the -native-bypass support in linux-user. The native_calls_enabled() function can be true only when the '-native-bypass' option is given. Signed-off-by: Yeqi Fu --- linux-user/main.c | 36 1 file changed, 36 insertions(+) di

[RFC v3 00/10] Native Library Calls

2023-06-25 Thread Yeqi Fu
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

[RFC v3 07/10] target/i386: Add support for native library calls

2023-06-25 Thread Yeqi Fu
Upon encountering specialized instructions reserved for native calls, store the function id and argument types, then invoke helper. Signed-off-by: Yeqi Fu --- target/i386/tcg/translate.c | 33 + 1 file changed, 33 insertions(+) diff --git a/target/i386/tcg

[RFC v3 02/10] build: Add configure options for native calls

2023-06-25 Thread Yeqi Fu
Add CONFIG_NATIVE_CALL to architectures supporting native calls. Signed-off-by: Yeqi Fu --- 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

[RFC v3 06/10] accel/tcg: Add support for native library calls

2023-06-25 Thread Yeqi Fu
This commit implements several helpers for extracting function id and argument types, and then using this information to invoke native functions. Signed-off-by: Yeqi Fu --- accel/tcg/tcg-runtime.c | 37 + accel/tcg/tcg-runtime.h | 4 ++ include/native/native-calls.h

[RFC v3 09/10] target/arm: Add support for native library calls

2023-06-25 Thread Yeqi Fu
Upon encountering specialized instructions reserved for native calls, store the function id and argument types, then invoke helper. Signed-off-by: Yeqi Fu --- target/arm/tcg/translate-a64.c | 27 ++- target/arm/tcg/translate.c | 25 +++-- target

[RFC v3 04/10] linux-user: Implement envlist_appendenv

2023-06-25 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- include/qemu/envlist.h | 1 + util/envlist.c | 61 ++ 2 files changed, 62 insertions(+) diff --git a/include/qemu/envlist.h b/include/qemu/envlist.h index 6006dfae44..865eb18e17 100644 --- a/include/qemu/envlist.h +++ b

[RFC v3 03/10] build: Implement libnative library and configure options

2023-06-25 Thread Yeqi Fu
This commit implements a shared library, 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. Signed-off-by: Yeqi Fu --- Makefile

[RFC v2 4/6] target/mips: Add native library calls

2023-06-07 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- 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 +++ 5 files changed

[RFC v2 6/6] linux-user: Add '-native-bypass' option

2023-06-07 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- include/qemu/envlist.h | 1 + linux-user/main.c | 23 + util/envlist.c | 56 ++ 3 files changed, 80 insertions(+) diff --git a/include/qemu/envlist.h b/include/qemu/envlist.h index 6006dfae44

[RFC v2 2/6] Add the libnative library

2023-06-07 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- common-user/native/libnative.c | 65 ++ include/native/libnative.h | 11 ++ include/native/native-func.h | 11 ++ 3 files changed, 87 insertions(+) create mode 100644 common-user/native/libnative.c create mode 100644

[RFC v2 5/6] target/arm: Add native library calls

2023-06-07 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- 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

[RFC v2 1/6] build: Add configure options for native calls

2023-06-07 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- Makefile| 4 +++ common-user/native/Makefile.include | 9 ++ common-user/native/Makefile.target | 22 + configure | 50 + docs/devel/build-system.rst | 4

[RFC v2 0/6] Native Library Calls

2023-06-07 Thread Yeqi Fu
n 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

[RFC v2 3/6] target/i386: Add native library calls

2023-06-07 Thread Yeqi Fu
Signed-off-by: Yeqi Fu --- 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 4 files changed, 92 insertions(+) create mode

[RFC] Native Library Calls

2023-05-30 Thread Yeqi Fu
n the '../configure --enable-user-native-call && make' command. Signed-off-by: Yeqi Fu --- include/exec/user/native-func.h | 8 +++ libnative.c | 76 meson.build | 8 +++ meson_options.txt

[PATCH v3] block: replace TABs with space

2023-03-25 Thread Yeqi Fu
Bring the block files in line with the QEMU coding style, with spaces for indentation. This patch partially resolves the issue 371. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/371 Signed-off-by: Yeqi Fu --- block/bochs.c | 18 +++ block/file-posix.c | 126