diff options
| author | Chenxi Mao <maochenxi@eswin.com> | 2020-04-20 17:27:19 +0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2020-04-20 21:45:13 -0700 |
| commit | 794d0cc12eb457063fefef49adf5aef493e6f01a (patch) | |
| tree | 383931bda1de5aeb429df9205d137af7b61c9fd9 | |
| parent | 6ca376e8118bb8f0eae26a3a9fca05b67cdc8143 (diff) | |
| download | meta-openembedded-794d0cc12eb457063fefef49adf5aef493e6f01a.tar.gz | |
Android-tools: Support Risc-V ISA
Risc-V ADB implementation is based on ARM64 implemtentation.
The core change is leverage fence command to implement memroy barrier
featrue.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 files changed, 553 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/build/0001-Riscv-Add-risc-v-Android-config-header.patch b/meta-oe/recipes-devtools/android-tools/android-tools/build/0001-Riscv-Add-risc-v-Android-config-header.patch new file mode 100644 index 0000000000..57c443b707 --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/build/0001-Riscv-Add-risc-v-Android-config-header.patch | |||
| @@ -0,0 +1,359 @@ | |||
| 1 | From 82dce13ea7b5b31c63851bd67f66072413917e73 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Chenxi Mao <maochenxi@eswin.com> | ||
| 3 | Date: Mon, 20 Apr 2020 15:32:40 +0800 | ||
| 4 | Subject: [PATCH 1/1] Riscv: Add risc-v Android config header | ||
| 5 | |||
| 6 | --- | ||
| 7 | .../arch/linux-riscv64/AndroidConfig.h | 340 ++++++++++++++++++ | ||
| 8 | 1 file changed, 340 insertions(+) | ||
| 9 | create mode 100644 core/combo/include/arch/linux-riscv64/AndroidConfig.h | ||
| 10 | |||
| 11 | diff --git a/core/combo/include/arch/linux-riscv64/AndroidConfig.h b/core/combo/include/arch/linux-riscv64/AndroidConfig.h | ||
| 12 | new file mode 100644 | ||
| 13 | index 0000000000..bcbda8f87f | ||
| 14 | --- /dev/null | ||
| 15 | +++ b/core/combo/include/arch/linux-riscv64/AndroidConfig.h | ||
| 16 | @@ -0,0 +1,340 @@ | ||
| 17 | +/* | ||
| 18 | + * Copyright (C) 2013 The Android Open Source Project | ||
| 19 | + * | ||
| 20 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 21 | + * you may not use this file except in compliance with the License. | ||
| 22 | + * You may obtain a copy of the License at | ||
| 23 | + * | ||
| 24 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 25 | + * | ||
| 26 | + * Unless required by applicable law or agreed to in writing, software | ||
| 27 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 28 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 29 | + * See the License for the specific language governing permissions and | ||
| 30 | + * limitations under the License. | ||
| 31 | + */ | ||
| 32 | + | ||
| 33 | +/* | ||
| 34 | + * Android config -- "android-aarch64". Used for ARM aarch64 device builds. | ||
| 35 | + */ | ||
| 36 | +#ifndef _ANDROID_CONFIG_H | ||
| 37 | +#define _ANDROID_CONFIG_H | ||
| 38 | + | ||
| 39 | +/* | ||
| 40 | + * =========================================================================== | ||
| 41 | + * !!! IMPORTANT !!! | ||
| 42 | + * =========================================================================== | ||
| 43 | + * | ||
| 44 | + * This file is included by ALL C/C++ source files. Don't put anything in | ||
| 45 | + * here unless you are absolutely certain it can't go anywhere else. | ||
| 46 | + * | ||
| 47 | + * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//" | ||
| 48 | + * comments. | ||
| 49 | + */ | ||
| 50 | + | ||
| 51 | +/* | ||
| 52 | + * Threading model. Choose one: | ||
| 53 | + * | ||
| 54 | + * HAVE_PTHREADS - use the pthreads library. | ||
| 55 | + * HAVE_WIN32_THREADS - use Win32 thread primitives. | ||
| 56 | + * -- combine HAVE_CREATETHREAD, HAVE_CREATEMUTEX, and HAVE__BEGINTHREADEX | ||
| 57 | + */ | ||
| 58 | +#define HAVE_PTHREADS | ||
| 59 | + | ||
| 60 | +/* | ||
| 61 | + * Do we have pthread_setname_np()? | ||
| 62 | + * | ||
| 63 | + * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with | ||
| 64 | + * the same name but different parameters, so we can't use that here.) | ||
| 65 | + */ | ||
| 66 | +#define HAVE_ANDROID_PTHREAD_SETNAME_NP | ||
| 67 | + | ||
| 68 | +/* | ||
| 69 | + * Do we have the futex syscall? | ||
| 70 | + */ | ||
| 71 | +#define HAVE_FUTEX | ||
| 72 | + | ||
| 73 | +/* | ||
| 74 | + * Process creation model. Choose one: | ||
| 75 | + * | ||
| 76 | + * HAVE_FORKEXEC - use fork() and exec() | ||
| 77 | + * HAVE_WIN32_PROC - use CreateProcess() | ||
| 78 | + */ | ||
| 79 | +#define HAVE_FORKEXEC | ||
| 80 | + | ||
| 81 | +/* | ||
| 82 | + * Process out-of-memory adjustment. Set if running on Linux, | ||
| 83 | + * where we can write to /proc/<pid>/oom_adj to modify the out-of-memory | ||
| 84 | + * badness adjustment. | ||
| 85 | + */ | ||
| 86 | +#define HAVE_OOM_ADJ | ||
| 87 | + | ||
| 88 | +/* | ||
| 89 | + * IPC model. Choose one: | ||
| 90 | + * | ||
| 91 | + * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). | ||
| 92 | + * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). | ||
| 93 | + * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). | ||
| 94 | + * HAVE_ANDROID_IPC - use Android versions (?, mmap). | ||
| 95 | + */ | ||
| 96 | +#define HAVE_ANDROID_IPC | ||
| 97 | + | ||
| 98 | +/* | ||
| 99 | + * Memory-mapping model. Choose one: | ||
| 100 | + * | ||
| 101 | + * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h | ||
| 102 | + * HAVE_WIN32_FILEMAP - use Win32 filemaps | ||
| 103 | + */ | ||
| 104 | +#define HAVE_POSIX_FILEMAP | ||
| 105 | + | ||
| 106 | +/* | ||
| 107 | + * Define this if you have <termio.h> | ||
| 108 | + */ | ||
| 109 | +#define HAVE_TERMIO_H 1 | ||
| 110 | + | ||
| 111 | +/* | ||
| 112 | + * Define this if you have <sys/sendfile.h> | ||
| 113 | + */ | ||
| 114 | +#define HAVE_SYS_SENDFILE_H 1 | ||
| 115 | + | ||
| 116 | +/* | ||
| 117 | + * Define this if you build against MSVCRT.DLL | ||
| 118 | + */ | ||
| 119 | +/* #define HAVE_MS_C_RUNTIME */ | ||
| 120 | + | ||
| 121 | +/* | ||
| 122 | + * Define this if you have sys/uio.h | ||
| 123 | + */ | ||
| 124 | +#define HAVE_SYS_UIO_H 1 | ||
| 125 | + | ||
| 126 | +/* | ||
| 127 | + * Define this if your platforms implements symbolic links | ||
| 128 | + * in its filesystems | ||
| 129 | + */ | ||
| 130 | +#define HAVE_SYMLINKS | ||
| 131 | + | ||
| 132 | +/* | ||
| 133 | + * Define this if we have localtime_r(). | ||
| 134 | + */ | ||
| 135 | +/* #define HAVE_LOCALTIME_R 1 */ | ||
| 136 | + | ||
| 137 | +/* | ||
| 138 | + * Define this if we have gethostbyname_r(). | ||
| 139 | + */ | ||
| 140 | +/* #define HAVE_GETHOSTBYNAME_R */ | ||
| 141 | + | ||
| 142 | +/* | ||
| 143 | + * Define this if we have ioctl(). | ||
| 144 | + */ | ||
| 145 | +#define HAVE_IOCTL | ||
| 146 | + | ||
| 147 | +/* | ||
| 148 | + * Define this if we want to use WinSock. | ||
| 149 | + */ | ||
| 150 | +/* #define HAVE_WINSOCK */ | ||
| 151 | + | ||
| 152 | +/* | ||
| 153 | + * Define this if have clock_gettime() and friends | ||
| 154 | + */ | ||
| 155 | +#define HAVE_POSIX_CLOCKS | ||
| 156 | + | ||
| 157 | +/* | ||
| 158 | + * Define this if we have linux style epoll() | ||
| 159 | + */ | ||
| 160 | +#define HAVE_EPOLL | ||
| 161 | + | ||
| 162 | +/* | ||
| 163 | + * Endianness of the target machine. Choose one: | ||
| 164 | + * | ||
| 165 | + * HAVE_ENDIAN_H -- have endian.h header we can include. | ||
| 166 | + * HAVE_LITTLE_ENDIAN -- we are little endian. | ||
| 167 | + * HAVE_BIG_ENDIAN -- we are big endian. | ||
| 168 | + */ | ||
| 169 | +#define HAVE_ENDIAN_H | ||
| 170 | +#define HAVE_LITTLE_ENDIAN | ||
| 171 | + | ||
| 172 | +#define _FILE_OFFSET_BITS 64 | ||
| 173 | +/* #define _LARGEFILE_SOURCE 1 */ | ||
| 174 | + | ||
| 175 | +/* | ||
| 176 | + * Define if platform has off64_t (and lseek64 and other xxx64 functions) | ||
| 177 | + */ | ||
| 178 | +#define HAVE_OFF64_T | ||
| 179 | + | ||
| 180 | +/* | ||
| 181 | + * Defined if we have the backtrace() call for retrieving a stack trace. | ||
| 182 | + * Needed for CallStack to operate; if not defined, CallStack is | ||
| 183 | + * non-functional. | ||
| 184 | + */ | ||
| 185 | +#define HAVE_BACKTRACE 0 | ||
| 186 | + | ||
| 187 | +/* | ||
| 188 | + * Defined if we have the cxxabi.h header for demangling C++ symbols. If | ||
| 189 | + * not defined, stack crawls will be displayed with raw mangled symbols | ||
| 190 | + */ | ||
| 191 | +#define HAVE_CXXABI 0 | ||
| 192 | + | ||
| 193 | +/* | ||
| 194 | + * Defined if we have the gettid() system call. | ||
| 195 | + */ | ||
| 196 | +#define HAVE_GETTID | ||
| 197 | + | ||
| 198 | +/* | ||
| 199 | + * Defined if we have the sched_setscheduler() call | ||
| 200 | + */ | ||
| 201 | +#define HAVE_SCHED_SETSCHEDULER | ||
| 202 | + | ||
| 203 | +/* | ||
| 204 | + * Add any extra platform-specific defines here. | ||
| 205 | + */ | ||
| 206 | +#ifndef __linux__ | ||
| 207 | +#define __linux__ | ||
| 208 | +#endif | ||
| 209 | + | ||
| 210 | +/* | ||
| 211 | + * Define if we have <malloc.h> header | ||
| 212 | + */ | ||
| 213 | +#define HAVE_MALLOC_H | ||
| 214 | + | ||
| 215 | +/* | ||
| 216 | + * Define if we're running on *our* linux on device or emulator. | ||
| 217 | + */ | ||
| 218 | +#define HAVE_ANDROID_OS 1 | ||
| 219 | + | ||
| 220 | +/* | ||
| 221 | + * Define if we have Linux-style non-filesystem Unix Domain Sockets | ||
| 222 | + */ | ||
| 223 | +#define HAVE_LINUX_LOCAL_SOCKET_NAMESPACE 1 | ||
| 224 | + | ||
| 225 | +/* | ||
| 226 | + * Define if we have Linux's inotify in <sys/inotify.h>. | ||
| 227 | + */ | ||
| 228 | +#define HAVE_INOTIFY 1 | ||
| 229 | + | ||
| 230 | +/* | ||
| 231 | + * Define if we have madvise() in <sys/mman.h> | ||
| 232 | + */ | ||
| 233 | +#define HAVE_MADVISE 1 | ||
| 234 | + | ||
| 235 | +/* | ||
| 236 | + * Define if tm struct has tm_gmtoff field | ||
| 237 | + */ | ||
| 238 | +#define HAVE_TM_GMTOFF 1 | ||
| 239 | + | ||
| 240 | +/* | ||
| 241 | + * Define if dirent struct has d_type field | ||
| 242 | + */ | ||
| 243 | +#define HAVE_DIRENT_D_TYPE 1 | ||
| 244 | + | ||
| 245 | +/* | ||
| 246 | + * Define if libc includes Android system properties implementation. | ||
| 247 | + */ | ||
| 248 | +#define HAVE_LIBC_SYSTEM_PROPERTIES 1 | ||
| 249 | + | ||
| 250 | +/* | ||
| 251 | + * Define if system provides a system property server (should be | ||
| 252 | + * mutually exclusive with HAVE_LIBC_SYSTEM_PROPERTIES). | ||
| 253 | + */ | ||
| 254 | +/* #define HAVE_SYSTEM_PROPERTY_SERVER */ | ||
| 255 | + | ||
| 256 | +/* | ||
| 257 | + * What CPU architecture does this platform use? | ||
| 258 | + */ | ||
| 259 | +#define ARCH_AARCH64 | ||
| 260 | + | ||
| 261 | +/* | ||
| 262 | + * Define if the size of enums is as short as possible, | ||
| 263 | + */ | ||
| 264 | +/* #define HAVE_SHORT_ENUMS */ | ||
| 265 | + | ||
| 266 | +/* | ||
| 267 | + * sprintf() format string for shared library naming. | ||
| 268 | + */ | ||
| 269 | +#define OS_SHARED_LIB_FORMAT_STR "lib%s.so" | ||
| 270 | + | ||
| 271 | +/* | ||
| 272 | + * type for the third argument to mincore(). | ||
| 273 | + */ | ||
| 274 | +#define MINCORE_POINTER_TYPE unsigned char * | ||
| 275 | + | ||
| 276 | +/* | ||
| 277 | + * The default path separator for the platform | ||
| 278 | + */ | ||
| 279 | +#define OS_PATH_SEPARATOR '/' | ||
| 280 | + | ||
| 281 | +/* | ||
| 282 | + * Is the filesystem case sensitive? | ||
| 283 | + */ | ||
| 284 | +#define OS_CASE_SENSITIVE | ||
| 285 | + | ||
| 286 | +/* | ||
| 287 | + * Define if <sys/socket.h> exists. | ||
| 288 | + */ | ||
| 289 | +#define HAVE_SYS_SOCKET_H 1 | ||
| 290 | + | ||
| 291 | +/* | ||
| 292 | + * Define if the strlcpy() function exists on the system. | ||
| 293 | + */ | ||
| 294 | +#define HAVE_STRLCPY 1 | ||
| 295 | + | ||
| 296 | +/* | ||
| 297 | + * Define if the open_memstream() function exists on the system. | ||
| 298 | + */ | ||
| 299 | +/* #define HAVE_OPEN_MEMSTREAM 1 */ | ||
| 300 | + | ||
| 301 | +/* | ||
| 302 | + * Define if the BSD funopen() function exists on the system. | ||
| 303 | + */ | ||
| 304 | +#define HAVE_FUNOPEN 1 | ||
| 305 | + | ||
| 306 | +/* | ||
| 307 | + * Define if prctl() exists | ||
| 308 | + */ | ||
| 309 | +#define HAVE_PRCTL 1 | ||
| 310 | + | ||
| 311 | +/* | ||
| 312 | + * Define if writev() exists | ||
| 313 | + */ | ||
| 314 | +#define HAVE_WRITEV 1 | ||
| 315 | + | ||
| 316 | +/* | ||
| 317 | + * Define if <stdint.h> exists. | ||
| 318 | + */ | ||
| 319 | +#define HAVE_STDINT_H 1 | ||
| 320 | + | ||
| 321 | +/* | ||
| 322 | + * Define if <stdbool.h> exists. | ||
| 323 | + */ | ||
| 324 | +#define HAVE_STDBOOL_H 1 | ||
| 325 | + | ||
| 326 | +/* | ||
| 327 | + * Define if <sched.h> exists. | ||
| 328 | + */ | ||
| 329 | +#define HAVE_SCHED_H 1 | ||
| 330 | + | ||
| 331 | +/* | ||
| 332 | + * Define if pread() exists | ||
| 333 | + */ | ||
| 334 | +#define HAVE_PREAD 1 | ||
| 335 | + | ||
| 336 | +/* | ||
| 337 | + * Define if we have st_mtim in struct stat | ||
| 338 | + */ | ||
| 339 | +#define HAVE_STAT_ST_MTIM 1 | ||
| 340 | + | ||
| 341 | +/* | ||
| 342 | + * Define if printf() supports %zd for size_t arguments | ||
| 343 | + */ | ||
| 344 | +#define HAVE_PRINTF_ZD 1 | ||
| 345 | + | ||
| 346 | +/* | ||
| 347 | + * Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype. | ||
| 348 | + */ | ||
| 349 | +#define HAVE_BSD_QSORT_R 0 | ||
| 350 | + | ||
| 351 | +/* | ||
| 352 | + * Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype. | ||
| 353 | + */ | ||
| 354 | +#define HAVE_GNU_QSORT_R 0 | ||
| 355 | + | ||
| 356 | +#endif /* _ANDROID_CONFIG_H */ | ||
| 357 | -- | ||
| 358 | 2.17.1 | ||
| 359 | |||
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0013-adb-Support-riscv64.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0013-adb-Support-riscv64.patch new file mode 100644 index 0000000000..a8434afbad --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/core/0013-adb-Support-riscv64.patch | |||
| @@ -0,0 +1,189 @@ | |||
| 1 | From 48ddf4fb999931942c359350fb31cd557514e1c6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Chenxi Mao <maochenxi@eswin.com> | ||
| 3 | Date: Mon, 20 Apr 2020 15:27:22 +0800 | ||
| 4 | Subject: [PATCH 1/1] adb: Support riscv64 | ||
| 5 | |||
| 6 | --- | ||
| 7 | include/cutils/atomic-inline.h | 2 + | ||
| 8 | include/cutils/atomic-riscv64.h | 156 ++++++++++++++++++++++++++++++++ | ||
| 9 | 2 files changed, 158 insertions(+) | ||
| 10 | create mode 100644 include/cutils/atomic-riscv64.h | ||
| 11 | |||
| 12 | diff --git a/include/cutils/atomic-inline.h b/include/cutils/atomic-inline.h | ||
| 13 | index a31e913579..b5dc38209c 100644 | ||
| 14 | --- a/include/cutils/atomic-inline.h | ||
| 15 | +++ b/include/cutils/atomic-inline.h | ||
| 16 | @@ -55,6 +55,8 @@ extern "C" { | ||
| 17 | #include <cutils/atomic-mips64.h> | ||
| 18 | #elif defined(__mips__) | ||
| 19 | #include <cutils/atomic-mips.h> | ||
| 20 | +#elif defined(__riscv) && __riscv_xlen == 64 | ||
| 21 | +#include <cutils/atomic-riscv64.h> | ||
| 22 | #else | ||
| 23 | #error atomic operations are unsupported | ||
| 24 | #endif | ||
| 25 | diff --git a/include/cutils/atomic-riscv64.h b/include/cutils/atomic-riscv64.h | ||
| 26 | new file mode 100644 | ||
| 27 | index 0000000000..2664db5a86 | ||
| 28 | --- /dev/null | ||
| 29 | +++ b/include/cutils/atomic-riscv64.h | ||
| 30 | @@ -0,0 +1,156 @@ | ||
| 31 | +/* | ||
| 32 | + * Copyright (C) 2014 The Android Open Source Project | ||
| 33 | + * All rights reserved. | ||
| 34 | + * | ||
| 35 | + * Redistribution and use in source and binary forms, with or without | ||
| 36 | + * modification, are permitted provided that the following conditions | ||
| 37 | + * are met: | ||
| 38 | + * * Redistributions of source code must retain the above copyright | ||
| 39 | + * notice, this list of conditions and the following disclaimer. | ||
| 40 | + * * Redistributions in binary form must reproduce the above copyright | ||
| 41 | + * notice, this list of conditions and the following disclaimer in | ||
| 42 | + * the documentation and/or other materials provided with the | ||
| 43 | + * distribution. | ||
| 44 | + * | ||
| 45 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 46 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 47 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 48 | + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 49 | + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 50 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 51 | + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
| 52 | + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
| 53 | + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 54 | + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| 55 | + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 56 | + * SUCH DAMAGE. | ||
| 57 | + */ | ||
| 58 | + | ||
| 59 | +#ifndef ANDROID_CUTILS_ATOMIC_RISCV64_H | ||
| 60 | +#define ANDROID_CUTILS_ATOMIC_RISCV64_H | ||
| 61 | + | ||
| 62 | +#include <stdint.h> | ||
| 63 | + | ||
| 64 | +#ifndef ANDROID_ATOMIC_INLINE | ||
| 65 | +#define ANDROID_ATOMIC_INLINE inline __attribute__((always_inline)) | ||
| 66 | +#endif | ||
| 67 | + | ||
| 68 | +/* | ||
| 69 | + TODOAArch64: Revisit the below functions and check for potential | ||
| 70 | + optimizations using assembly code or otherwise. | ||
| 71 | +*/ | ||
| 72 | + | ||
| 73 | +extern ANDROID_ATOMIC_INLINE | ||
| 74 | +void android_compiler_barrier(void) | ||
| 75 | +{ | ||
| 76 | + __asm__ __volatile__ ("" : : : "memory"); | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +extern ANDROID_ATOMIC_INLINE | ||
| 80 | +void android_memory_barrier(void) | ||
| 81 | +{ | ||
| 82 | + __asm__ __volatile__ ("fence rw,rw" : : : "memory"); | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +extern ANDROID_ATOMIC_INLINE | ||
| 86 | +int32_t android_atomic_acquire_load(volatile const int32_t *ptr) | ||
| 87 | +{ | ||
| 88 | + int32_t value = *ptr; | ||
| 89 | + android_memory_barrier(); | ||
| 90 | + return value; | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +extern ANDROID_ATOMIC_INLINE | ||
| 94 | +int32_t android_atomic_release_load(volatile const int32_t *ptr) | ||
| 95 | +{ | ||
| 96 | + android_memory_barrier(); | ||
| 97 | + return *ptr; | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +extern ANDROID_ATOMIC_INLINE | ||
| 101 | +void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr) | ||
| 102 | +{ | ||
| 103 | + *ptr = value; | ||
| 104 | + android_memory_barrier(); | ||
| 105 | +} | ||
| 106 | + | ||
| 107 | +extern ANDROID_ATOMIC_INLINE | ||
| 108 | +void android_atomic_release_store(int32_t value, volatile int32_t *ptr) | ||
| 109 | +{ | ||
| 110 | + android_memory_barrier(); | ||
| 111 | + *ptr = value; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +extern ANDROID_ATOMIC_INLINE | ||
| 115 | +int android_atomic_cas(int32_t old_value, int32_t new_value, | ||
| 116 | + volatile int32_t *ptr) | ||
| 117 | +{ | ||
| 118 | + return __sync_val_compare_and_swap(ptr, old_value, new_value) != old_value; | ||
| 119 | +} | ||
| 120 | + | ||
| 121 | +extern ANDROID_ATOMIC_INLINE | ||
| 122 | +int android_atomic_acquire_cas(int32_t old_value, int32_t new_value, | ||
| 123 | + volatile int32_t *ptr) | ||
| 124 | +{ | ||
| 125 | + int status = android_atomic_cas(old_value, new_value, ptr); | ||
| 126 | + android_memory_barrier(); | ||
| 127 | + return status; | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +extern ANDROID_ATOMIC_INLINE | ||
| 131 | +int android_atomic_release_cas(int32_t old_value, int32_t new_value, | ||
| 132 | + volatile int32_t *ptr) | ||
| 133 | +{ | ||
| 134 | + android_memory_barrier(); | ||
| 135 | + return android_atomic_cas(old_value, new_value, ptr); | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | +extern ANDROID_ATOMIC_INLINE | ||
| 139 | +int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr) | ||
| 140 | +{ | ||
| 141 | + int32_t prev, status; | ||
| 142 | + android_memory_barrier(); | ||
| 143 | + do { | ||
| 144 | + prev = *ptr; | ||
| 145 | + status = android_atomic_cas(prev, prev + increment, ptr); | ||
| 146 | + } while (__builtin_expect(status != 0, 0)); | ||
| 147 | + return prev; | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +extern ANDROID_ATOMIC_INLINE | ||
| 151 | +int32_t android_atomic_inc(volatile int32_t *addr) | ||
| 152 | +{ | ||
| 153 | + return android_atomic_add(1, addr); | ||
| 154 | +} | ||
| 155 | + | ||
| 156 | +extern ANDROID_ATOMIC_INLINE | ||
| 157 | +int32_t android_atomic_dec(volatile int32_t *addr) | ||
| 158 | +{ | ||
| 159 | + return android_atomic_add(-1, addr); | ||
| 160 | +} | ||
| 161 | + | ||
| 162 | +extern ANDROID_ATOMIC_INLINE | ||
| 163 | +int32_t android_atomic_and(int32_t value, volatile int32_t *ptr) | ||
| 164 | +{ | ||
| 165 | + int32_t prev, status; | ||
| 166 | + android_memory_barrier(); | ||
| 167 | + do { | ||
| 168 | + prev = *ptr; | ||
| 169 | + status = android_atomic_cas(prev, prev & value, ptr); | ||
| 170 | + } while (__builtin_expect(status != 0, 0)); | ||
| 171 | + return prev; | ||
| 172 | +} | ||
| 173 | + | ||
| 174 | +extern ANDROID_ATOMIC_INLINE | ||
| 175 | +int32_t android_atomic_or(int32_t value, volatile int32_t *ptr) | ||
| 176 | +{ | ||
| 177 | + int32_t prev, status; | ||
| 178 | + android_memory_barrier(); | ||
| 179 | + do { | ||
| 180 | + prev = *ptr; | ||
| 181 | + status = android_atomic_cas(prev, prev | value, ptr); | ||
| 182 | + } while (__builtin_expect(status != 0, 0)); | ||
| 183 | + return prev; | ||
| 184 | +} | ||
| 185 | + | ||
| 186 | +#endif /* ANDROID_CUTILS_ATOMIC_RISCV_H */ | ||
| 187 | -- | ||
| 188 | 2.17.1 | ||
| 189 | |||
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb index 3555aff3cd..fb6125e2a5 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb | |||
| @@ -38,11 +38,13 @@ SRC_URI = " \ | |||
| 38 | file://core/0011-Remove-bionic-specific-calls.patch;patchdir=system/core \ | 38 | file://core/0011-Remove-bionic-specific-calls.patch;patchdir=system/core \ |
| 39 | file://core/0012-Fix-implicit-declaration-of-stlcat-strlcopy-function.patch;patchdir=system/core \ | 39 | file://core/0012-Fix-implicit-declaration-of-stlcat-strlcopy-function.patch;patchdir=system/core \ |
| 40 | file://core/adb_libssl_11.diff;patchdir=system/core \ | 40 | file://core/adb_libssl_11.diff;patchdir=system/core \ |
| 41 | file://core/0013-adb-Support-riscv64.patch;patchdir=system/core \ | ||
| 41 | file://extras/0001-ext4_utils-remove-selinux-extensions.patch;patchdir=system/extras \ | 42 | file://extras/0001-ext4_utils-remove-selinux-extensions.patch;patchdir=system/extras \ |
| 42 | file://extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch;patchdir=system/extras \ | 43 | file://extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch;patchdir=system/extras \ |
| 43 | file://libselinux/0001-Remove-bionic-specific-calls.patch;patchdir=external/libselinux \ | 44 | file://libselinux/0001-Remove-bionic-specific-calls.patch;patchdir=external/libselinux \ |
| 44 | file://libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch;patchdir=external/libselinux \ | 45 | file://libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch;patchdir=external/libselinux \ |
| 45 | file://android-tools-adbd.service \ | 46 | file://android-tools-adbd.service \ |
| 47 | file://build/0001-Riscv-Add-risc-v-Android-config-header.patch;patchdir=build \ | ||
| 46 | file://gitignore \ | 48 | file://gitignore \ |
| 47 | file://adb.mk;subdir=${BPN} \ | 49 | file://adb.mk;subdir=${BPN} \ |
| 48 | file://adbd.mk;subdir=${BPN} \ | 50 | file://adbd.mk;subdir=${BPN} \ |
| @@ -94,6 +96,9 @@ do_compile() { | |||
| 94 | aarch64) | 96 | aarch64) |
| 95 | export android_arch=linux-arm64 | 97 | export android_arch=linux-arm64 |
| 96 | ;; | 98 | ;; |
| 99 | riscv64) | ||
| 100 | export android_arch=linux-riscv64 | ||
| 101 | ;; | ||
| 97 | mips|mipsel) | 102 | mips|mipsel) |
| 98 | export android_arch=linux-mips | 103 | export android_arch=linux-mips |
| 99 | ;; | 104 | ;; |
