diff options
author | 2025-01-29 13:24:43 +0100 | |
---|---|---|
committer | 2025-02-05 10:35:47 -0800 | |
commit | 3428f9be71b0d20978d11d63b5d82962b88d02bf (patch) | |
tree | 9932f8416dbc5ea7a1b8e32dab68afc192816236 /libnativebridge/include/nativebridge | |
parent | 65914c03ce6a5568a0c98f05f8217bb89108bf1b (diff) |
nativebridge: Add isNativeBridgeFunctionPointer method
This method lets native bridge report if particular pointer is in the
region of code executable by native bridge implementation.
Bug: 393035780
Test: atest art/libnativebridge/tests
Change-Id: Icaec80cb7efae5b918aed0a98216cbfaeaba330d
Diffstat (limited to 'libnativebridge/include/nativebridge')
-rw-r--r-- | libnativebridge/include/nativebridge/native_bridge.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/libnativebridge/include/nativebridge/native_bridge.h b/libnativebridge/include/nativebridge/native_bridge.h index 491521642c..db3d1e9509 100644 --- a/libnativebridge/include/nativebridge/native_bridge.h +++ b/libnativebridge/include/nativebridge/native_bridge.h @@ -100,6 +100,8 @@ void* NativeBridgeGetTrampolineForFunctionPointer(const void* method, uint32_t len, enum JNICallType jni_call_type); +bool NativeBridgeIsNativeBridgeFunctionPointer(const void* method); + // True if native library paths are valid and is for an ABI that is supported by native bridge. // The *libpath* must point to a library. // @@ -403,9 +405,10 @@ struct NativeBridgeCallbacks { // Get a native bridge trampoline for specified native method implementation pointer. // // Parameters: - // method [IN] pointer to method implementation (ususally registered via call to + // method [IN] pointer to method implementation (usually registered via call to // RegisterNatives). - // shorty [IN] short descriptor of native method len [IN] length of shorty + // shorty [IN] short descriptor of native method + // len [IN] length of shorty // jni_call_type [IN] the type of JNI call // Returns: // address of trampoline if successful, otherwise NULL @@ -413,6 +416,18 @@ struct NativeBridgeCallbacks { const char* shorty, uint32_t len, enum JNICallType jni_call_type); + + // Check if the method pointer belongs to native_bridge address space. + // + // Parameters: + // method [IN] pointer to a method implementation. + // + // Returns: + // true if the method is in native bridge implementation executable address + // space or in other words needs a trampoline to be able to run with native bridge. + // + // Introduced in: version 8 + bool (*isNativeBridgeFunctionPointer)(const void* method); }; // Runtime interfaces to native bridge. |