aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-10-28 01:17:18 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-10-28 01:17:18 +0000
commit8d725eb70bd9f15b4277c724f47aeaad23052478 (patch)
tree9ea5f03dfc92eb019cd30b57d59767ad8b9463f3
parentedd06bffb33f4ac9aecbcd7cfe92a92054733acf (diff)
parentbb377a3bb47175f934950ae47f053c2d1241d7ed (diff)
downloadpdfium-8d725eb70bd9f15b4277c724f47aeaad23052478.tar.gz
Snap for 9227789 from bb377a3bb47175f934950ae47f053c2d1241d7ed to udc-release
Change-Id: Idd8762555a3f8e63ed3ced368b51f2a62105004f
-rw-r--r--third_party/Android.bp6
-rw-r--r--third_party/base/allocator/partition_allocator/address_space_randomization.h6
-rw-r--r--third_party/base/allocator/partition_allocator/spin_lock.cc4
3 files changed, 16 insertions, 0 deletions
diff --git a/third_party/Android.bp b/third_party/Android.bp
index 3fcb08d80..1c8e251cf 100644
--- a/third_party/Android.bp
+++ b/third_party/Android.bp
@@ -39,6 +39,12 @@ cc_library_static {
"-DARCH_CPU_ARM64",
],
},
+ riscv64: {
+ cflags: [
+ "-DARCH_CPU_64_BITS",
+ "-DARCH_CPU_RISCV64",
+ ],
+ },
x86: {
cflags: [
"-DARCH_CPU_32_BITS",
diff --git a/third_party/base/allocator/partition_allocator/address_space_randomization.h b/third_party/base/allocator/partition_allocator/address_space_randomization.h
index 5cb2cccc3..7ed7f6ba4 100644
--- a/third_party/base/allocator/partition_allocator/address_space_randomization.h
+++ b/third_party/base/allocator/partition_allocator/address_space_randomization.h
@@ -100,6 +100,12 @@ constexpr uintptr_t AslrMask(uintptr_t bits) {
#endif
+ #elif defined(ARCH_CPU_RISCV64)
+
+ // RISCV64 on Linux has 39-bit user space.
+ constexpr uintptr_t kASLRMask = AslrMask(38);
+ constexpr uintptr_t kASLROffset = AslrAddress(0x1000000000ULL);
+
#elif defined(ARCH_CPU_PPC64)
#if defined(OS_AIX)
diff --git a/third_party/base/allocator/partition_allocator/spin_lock.cc b/third_party/base/allocator/partition_allocator/spin_lock.cc
index 42055836b..99e56b256 100644
--- a/third_party/base/allocator/partition_allocator/spin_lock.cc
+++ b/third_party/base/allocator/partition_allocator/spin_lock.cc
@@ -45,6 +45,10 @@
#define YIELD_PROCESSOR __asm__ __volatile__("pause")
#elif defined(ARCH_CPU_PPC64_FAMILY)
#define YIELD_PROCESSOR __asm__ __volatile__("or 31,31,31")
+#elif defined(ARCH_CPU_RISCV64)
+// Encoding of the pause instruction from the Zihintpause extension. This
+// is a noop on cpus that don't have the Zihintpause extension.
+#define YIELD_PROCESSOR __asm__ __volatile__ (".4byte 0x100000F");
#elif defined(ARCH_CPU_S390_FAMILY)
// just do nothing
#define YIELD_PROCESSOR ((void)0)