riscv64: more <sys/ucontext.h>.
Actually, we don't want to reuse the kernel struct ucontext because its
uc_mcontext has the wrong type, which means the fields within that end
up with the wrong names. Add the call site that made that evident, and
update <sys/ucontext.h> appropriately.
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: If1d079afef0d5953aa22d9b0e049cfb0119c7718
diff --git a/libc/bionic/android_profiling_dynamic.cpp b/libc/bionic/android_profiling_dynamic.cpp
index 3460a6d..8c9127e 100644
--- a/libc/bionic/android_profiling_dynamic.cpp
+++ b/libc/bionic/android_profiling_dynamic.cpp
@@ -204,12 +204,14 @@
auto ret = -ENOSYS;
ucontext_t* ctx = reinterpret_cast<ucontext_t*>(void_context);
-#if defined(__arm__)
+#if defined(__aarch64__)
+ ctx->uc_mcontext.regs[0] = ret;
+#elif defined(__arm__)
ctx->uc_mcontext.arm_r0 = ret;
-#elif defined(__aarch64__)
- ctx->uc_mcontext.regs[0] = ret; // x0
#elif defined(__i386__)
ctx->uc_mcontext.gregs[REG_EAX] = ret;
+#elif defined(__riscv)
+ ctx->uc_mcontext.__gregs[REG_A0] = ret;
#elif defined(__x86_64__)
ctx->uc_mcontext.gregs[REG_RAX] = ret;
#else