Merge "Reserve TLS slot for native bridge" into main am: 0144257234
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2824791
Change-Id: If6f6e9f6a61b4c85baa631a3f82cd389dccf42d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libc/platform/bionic/tls_defines.h b/libc/platform/bionic/tls_defines.h
index 3e2efa3..8fe8701 100644
--- a/libc/platform/bionic/tls_defines.h
+++ b/libc/platform/bionic/tls_defines.h
@@ -68,6 +68,11 @@
//
// - TLS_SLOT_APP: Available for use by apps in Android Q and later. (This slot
// was used for errno in P and earlier.)
+//
+// - TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE: Pointer to the guest state for native
+// bridge implementations. It is (to be) used by debuggerd to access this
+// state for guest aware crash reporting of the binary translated code.
+// (Introduced in V)
#if defined(__arm__) || defined(__aarch64__)
@@ -80,7 +85,8 @@
// [1] "Addenda to, and Errata in, the ABI for the ARM Architecture". Section 3.
// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045e/IHI0045E_ABI_addenda.pdf
-#define MIN_TLS_SLOT (-1) // update this value when reserving a slot
+#define MIN_TLS_SLOT (-2) // update this value when reserving a slot
+#define TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE (-2)
#define TLS_SLOT_BIONIC_TLS (-1)
#define TLS_SLOT_DTV 0
#define TLS_SLOT_THREAD_ID 1
@@ -112,7 +118,8 @@
#define TLS_SLOT_ART_THREAD_SELF 7
#define TLS_SLOT_DTV 8
#define TLS_SLOT_BIONIC_TLS 9
-#define MAX_TLS_SLOT 9 // update this value when reserving a slot
+#define TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE 10
+#define MAX_TLS_SLOT 10 // update this value when reserving a slot
#elif defined(__riscv)
@@ -123,8 +130,9 @@
// [1]: RISC-V ELF Specification. Section: Thread Local Storage
// https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#thread-local-storage
-#define MIN_TLS_SLOT (-9) // update this value when reserving a slot
+#define MIN_TLS_SLOT (-10) // update this value when reserving a slot
+#define TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE (-10)
#define TLS_SLOT_BIONIC_TLS (-9)
#define TLS_SLOT_DTV (-8)
#define TLS_SLOT_THREAD_ID (-7)