Merge "sys_statvfs_test: fix expectation for Linux 6.7." into android13-tests-dev am: 7123abff51
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2928751
Change-Id: I38541b1db092dd37044970a52494dafc5ed6ed26
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/OWNERS b/OWNERS
index 670f88d..3818b1d 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,6 +1,7 @@
enh@google.com
cferris@google.com
+chiahungduan@google.com
danalbert@google.com
rprichard@google.com
yabinc@google.com
diff --git a/README.md b/README.md
index f397fee..8d8e583 100644
--- a/README.md
+++ b/README.md
@@ -158,30 +158,63 @@
Adding a system call usually involves:
- 1. Add entries to SYSCALLS.TXT.
+ 1. Add an entry (or entries, in some cases) to SYSCALLS.TXT.
See SYSCALLS.TXT itself for documentation on the format.
- 2. Add constants (and perhaps types) to the appropriate header file.
+ See also the notes below for how to deal with tricky cases like `off_t`.
+ 2. Find the right header file to work in by looking up your system call
+ on [man7.org](https://man7.org/linux/man-pages/dir_section_2.html).
+ (If there's no header file given, see the points above about whether we
+ should really be adding this or not!)
+ 3. Add constants (and perhaps types) to the appropriate header file.
Note that you should check to see whether the constants are already in
kernel uapi header files, in which case you just need to make sure that
- the appropriate POSIX header file in libc/include/ includes the
- relevant file or files.
- 3. Add function declarations to the appropriate header file. Don't forget
- to include the appropriate `__INTRODUCED_IN()`. If you need to create a new
- header file, libc/include/sys/sysinfo.h is a good short example to copy and
- paste from.
- 4. Add basic documentation to the header file. libc/include/sys/sysinfo.h is a
- good short example that shows the expected style. Most of the detail
- should actually be left to the man7.org page, with only a brief
- one-sentence explanation in our documentation. Alway include the return
- value/error reporting details. Explicitly say which version of Android the
- function was added to. Explicitly call out any Android-specific
- changes/additions/limitations because they won't be on the man7.org page.
- 5. Add the function name to the correct section in libc/libc.map.txt.
- 6. Add a basic test. Don't try to test everything; concentrate on just testing
+ the appropriate header file in libc/include/ `#include`s the relevant
+ `linux/` file or files.
+ 4. Add function declarations to the appropriate header file. Don't forget
+ to include the appropriate `__INTRODUCED_IN()`, with the right API level
+ for the first release your system call wrapper will be in. See
+ libc/include/android/api_level.h for the API levels.
+ If the header file doesn't exist, copy all of libc/include/sys/sysinfo.h
+ into your new file --- it's a good short example to start from.
+
+ Note also our style for naming arguments: always use two leading
+ underscores (so developers are free to use any of the unadorned names as
+ macros without breaking things), avoid abbreviations, and ideally try to
+ use the same name as an existing system call (to reduce the amount of
+ English vocabulary required by people who just want to use the function
+ signatures). If there's a similar function already in the C library,
+ check what names it's used. Finally, prefer the `void*` orthography we
+ use over the `void *` you'll see on man7.org.)
+ 5. Add basic documentation to the header file. Again, the existing
+ libc/include/sys/sysinfo.h is a good short example that shows the
+ expected style.
+
+ Most of the detail should actually be left to the man7.org page, with
+ only a brief one-sentence explanation (usually based on the description
+ in the NAME section of the man page) in our documentation. Always
+ include the return value/error reporting details (you can find out
+ what the system call returns from the RETURN VALUE of the man page),
+ but try to match the wording and style wording from _our_ existing
+ documentation; we're trying to minimize the amount of English readers
+ need to understand by using the exact same wording where possible).
+ Explicitly say which version of Android the function was added to in
+ the documentation because the documentation generation tool doesn't yet
+ understand `__INTRODUCED_IN()`.
+
+ Explicitly call out any Android-specific changes/additions/limitations
+ because they won't be on the man7.org page.
+ 6. Add the function name to the correct section in libc/libc.map.txt; it'll
+ be near the end of the file. You may need to add a new section if you're
+ the first to add a system call to this version of Android.
+ 7. Add a basic test. Don't try to test everything; concentrate on just testing
the code that's actually in *bionic*, not all the functionality that's
implemented in the kernel. For simple syscalls, that's just the
auto-generated argument and return value marshalling.
+ Add a test in the right file in tests/. We have one file per header, so if
+ your system call is exposed in <unistd.h>, for example, your test would go
+ in tests/unistd_test.cpp.
+
A trivial test that deliberately supplies an invalid argument helps check
that we're generating the right symbol and have the right declaration in
the header file, and that the change to libc.map.txt from step 5 is
@@ -208,6 +241,41 @@
than 2GiB, say -- so you may end up just writing a "meaningless" program whose
only purpose is to give you patterns to look for when run under strace(1).)
+A general example of adding a system call:
+https://android-review.googlesource.com/c/platform/bionic/+/2073827
+
+### Debugging tips
+1. Key error for a new codename in libc/libc.map.txt
+
+e.g. what you add in libc/libc.map.txt is:
+
+```
+LIBC_V { # introduced=Vanilla
+ global:
+ xxx; // the new system call you add
+} LIBC_U;
+```
+
+The error output is:
+
+```
+Traceback (most recent call last):
+ File "/path/tp/out/soong/.temp/Soong.python_qucjwd7g/symbolfile/__init__.py", line 171,
+ in decode_api_level_tag
+ decoded = str(decode_api_level(value, api_map))
+ File "/path/to/out/soong/.temp/Soong.python_qucjwd7g/symbolfile/__init__.py", line 157,
+ in decode_api_level
+ return api_map[api]
+KeyError: 'Vanilla'
+```
+
+Solution: Ask in the team and wait for the update.
+
+2. Use of undeclared identifier of the new system call in the test
+
+Possible Solution: Check everything ready in the files mentioned above first.
+Maybe glibc matters. Follow the example and try #if defined(__GLIBC__).
+
## Updating kernel header files
As mentioned above, this is currently a two-step process:
@@ -257,7 +325,7 @@
Note that we use our own custom gtest runner that offers a superset of the
options documented at
-<https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#running-test-programs-advanced-options>,
+<https://github.com/google/googletest/blob/main/docs/advanced.md#running-test-programs-advanced-options>,
in particular for test isolation and parallelism (both on by default).
### Device tests via CTS
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 2db0efe..f56e16a 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -38,6 +38,9 @@
},
{
"name": "memunreachable_unit_test"
+ },
+ {
+ "name": "toybox-tests"
}
],
"hwasan-presubmit": [
@@ -73,6 +76,17 @@
},
{
"name": "malloc_hooks_system_tests"
+ },
+ {
+ "name": "memunreachable_unit_test"
+ },
+ {
+ "name": "toybox-tests"
+ }
+ ],
+ "kernel-presubmit": [
+ {
+ "name": "CtsBionicTestCases"
}
]
}
diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md
index 13c8911..8ffd96f 100644
--- a/android-changes-for-ndk-developers.md
+++ b/android-changes-for-ndk-developers.md
@@ -107,7 +107,7 @@
## Correct soname/path handling (Available in API level >= 23)
The dynamic linker now understands the difference
-between a library’s soname and its path (public bug
+between a library’s soname and its path (public bug
https://code.google.com/p/android/issues/detail?id=6670). API level 23
is the first release where search by soname is implemented. Earlier
releases would assume that the basename of the library was the soname,
@@ -326,12 +326,12 @@
## Missing SONAME (Enforced for API level >= 23)
-Each ELF shared object (“native library”) must have a SONAME (Shared
-Object Name) attribute. The NDK toolchain adds this attribute by default,
-so its absence indicates either a misconfigured alternative toolchain
-or a misconfiguration in your build system. A missing SONAME may lead
-to runtime issues such as the wrong library being loaded: the filename
-is used instead when this attribute is missing.
+Each ELF shared object (“native library”) must have a SONAME
+(Shared Object Name) attribute. The NDK build systems add this
+attribute by default, so its absence (or an incorrect soname) indicates
+a misconfiguration in your build system. A missing SONAME may lead to
+runtime issues such as the wrong library being loaded: the filename is
+used instead when this attribute is missing.
```
$ readelf --dynamic libWithSoName.so | grep SONAME
@@ -346,7 +346,7 @@
*Resolution*: the current NDK generates the correct SONAME by
default. Ensure you're using the current NDK and that you haven't
configured your build system to generate incorrect SONAME entries (using
-the -soname linker option).
+the `-soname` linker option).
## `__register_atfork` (Available in API level >= 23)
@@ -475,3 +475,7 @@
There are no plans to remove support for ELF files using the older
OS private use constants for RELR, nor for ELF files using packed
relocations.
+
+You can read more about relative relocations
+and their long and complicated history at
+https://maskray.me/blog/2021-10-31-relative-relocations-and-relr.
diff --git a/apex/Android.bp b/apex/Android.bp
index 90a14b2..6201ad1 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -41,6 +41,11 @@
"libc_malloc_debug",
"libc_malloc_hooks",
],
+ arch: {
+ arm64: {
+ native_shared_libs: ["libc_hwasan", "libclang_rt.hwasan"],
+ },
+ },
binaries: [
"linkerconfig",
],
diff --git a/benchmarks/Android.bp b/benchmarks/Android.bp
index 5dfc38f..17d2d68 100644
--- a/benchmarks/Android.bp
+++ b/benchmarks/Android.bp
@@ -156,3 +156,23 @@
],
data: ["test_suites/*"],
}
+
+cc_binary {
+ name: "malloc-rss-benchmark",
+ srcs: [
+ "malloc_rss_benchmark.cpp",
+ ],
+
+ shared_libs: [
+ "libbase",
+ ],
+
+ target: {
+ android: {
+ static_libs: [
+ "libmeminfo",
+ "libprocinfo",
+ ],
+ },
+ },
+}
diff --git a/benchmarks/NOTICE b/benchmarks/NOTICE
index f720e23..e46a624 100644
--- a/benchmarks/NOTICE
+++ b/benchmarks/NOTICE
@@ -178,3 +178,31 @@
-------------------------------------------------------------------
+Copyright (C) 2022 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
diff --git a/benchmarks/linker_relocation/include/linker_reloc_bench_asm.h b/benchmarks/linker_relocation/include/linker_reloc_bench_asm.h
index 2ff3d81..885e47f 100644
--- a/benchmarks/linker_relocation/include/linker_reloc_bench_asm.h
+++ b/benchmarks/linker_relocation/include/linker_reloc_bench_asm.h
@@ -42,6 +42,15 @@
#define DATA_WORD(val) .quad val
#define MAIN .globl main; main: mov w0, wzr; ret
+#elif defined(__riscv)
+
+// No `lga` in clang unless https://reviews.llvm.org/D107278 lands.
+// `la` is equivalent when using PIC (which we do) though.
+#define GOT_RELOC(sym) la a0, sym
+#define CALL(sym) call sym@plt
+#define DATA_WORD(val) .quad val
+#define MAIN .globl main; main: li a0, 0; ret
+
#elif defined(__i386__)
#define GOT_RELOC(sym) .long sym@got
diff --git a/benchmarks/malloc_benchmark.cpp b/benchmarks/malloc_benchmark.cpp
index 18ba523..e733cd0 100644
--- a/benchmarks/malloc_benchmark.cpp
+++ b/benchmarks/malloc_benchmark.cpp
@@ -36,11 +36,11 @@
#if defined(__BIONIC__)
-static void BM_mallopt_purge(benchmark::State& state) {
+static void RunMalloptPurge(benchmark::State& state, int purge_value) {
static size_t sizes[] = {8, 16, 32, 64, 128, 1024, 4096, 16384, 65536, 131072, 1048576};
static int pagesize = getpagesize();
mallopt(M_DECAY_TIME, 1);
- mallopt(M_PURGE, 0);
+ mallopt(M_PURGE_ALL, 0);
for (auto _ : state) {
state.PauseTiming();
std::vector<void*> ptrs;
@@ -63,10 +63,19 @@
ptrs.clear();
state.ResumeTiming();
- mallopt(M_PURGE, 0);
+ mallopt(purge_value, 0);
}
mallopt(M_DECAY_TIME, 0);
}
+
+static void BM_mallopt_purge(benchmark::State& state) {
+ RunMalloptPurge(state, M_PURGE);
+}
BIONIC_BENCHMARK(BM_mallopt_purge);
+static void BM_mallopt_purge_all(benchmark::State& state) {
+ RunMalloptPurge(state, M_PURGE_ALL);
+}
+BIONIC_BENCHMARK(BM_mallopt_purge_all);
+
#endif
diff --git a/benchmarks/malloc_map_benchmark.cpp b/benchmarks/malloc_map_benchmark.cpp
index ba4d62c..5757325 100644
--- a/benchmarks/malloc_map_benchmark.cpp
+++ b/benchmarks/malloc_map_benchmark.cpp
@@ -69,7 +69,7 @@
for (auto _ : state) {
#if defined(__BIONIC__)
state.PauseTiming();
- mallopt(M_PURGE, 0);
+ mallopt(M_PURGE_ALL, 0);
uint64_t rss_bytes_before = 0;
Gather(&rss_bytes_before);
state.ResumeTiming();
@@ -80,7 +80,7 @@
}
#if defined(__BIONIC__)
state.PauseTiming();
- mallopt(M_PURGE, 0);
+ mallopt(M_PURGE_ALL, 0);
Gather(&rss_bytes);
// Try and record only the memory used in the map.
rss_bytes -= rss_bytes_before;
diff --git a/benchmarks/malloc_rss_benchmark.cpp b/benchmarks/malloc_rss_benchmark.cpp
new file mode 100644
index 0000000..4b34e72
--- /dev/null
+++ b/benchmarks/malloc_rss_benchmark.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <malloc.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <chrono>
+#include <iostream>
+#include <memory>
+#include <random>
+#include <thread>
+#include <vector>
+
+#include <android-base/strings.h>
+#if defined(__BIONIC__)
+#include <malloc.h>
+#include <meminfo/procmeminfo.h>
+#include <procinfo/process_map.h>
+#endif
+
+constexpr size_t kMaxThreads = 8;
+// The max number of bytes that can be allocated by a thread. Note that each
+// allocator may have its own limitation on each size allocation. For example,
+// Scudo has a 256 MB limit for each size-class in the primary allocator. The
+// amount of memory allocated should not exceed the limit in each allocator.
+constexpr size_t kMaxBytes = 1 << 24;
+constexpr size_t kMaxLen = kMaxBytes;
+void* MemPool[kMaxThreads][kMaxLen];
+
+void dirtyMem(void* ptr, size_t bytes) {
+ memset(ptr, 1U, bytes);
+}
+
+void ThreadTask(int id, size_t allocSize) {
+ // In the following, we will first allocate blocks with kMaxBytes of memory
+ // and release all of them in random order. In the end, we will do another
+ // round of allocations until it reaches 1/10 kMaxBytes.
+
+ // Total number of blocks
+ const size_t maxCounts = kMaxBytes / allocSize;
+ // The number of blocks in the end
+ const size_t finalCounts = maxCounts / 10;
+
+ for (size_t i = 0; i < maxCounts; ++i) {
+ MemPool[id][i] = malloc(allocSize);
+ if (MemPool[id][i] == 0) {
+ std::cout << "Allocation failure."
+ "Please consider reducing the number of threads"
+ << std::endl;
+ exit(1);
+ }
+ dirtyMem(MemPool[id][i], allocSize);
+ }
+
+ // Each allocator may apply different strategies to manage the free blocks and
+ // each strategy may have different impacts on future memory usage. For
+ // example, managing free blocks in simple FIFO list may have its memory usage
+ // highly correlated with the blocks releasing pattern. Therefore, release the
+ // blocks in random order to observe the impact of free blocks handling.
+ unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
+ std::shuffle(MemPool[id], MemPool[id] + maxCounts, std::default_random_engine(seed));
+ for (size_t i = 0; i < maxCounts; ++i) {
+ free(MemPool[id][i]);
+ MemPool[id][i] = nullptr;
+ }
+
+ for (size_t i = 0; i < finalCounts; ++i) {
+ MemPool[id][i] = malloc(allocSize);
+ dirtyMem(MemPool[id][i], allocSize);
+ }
+}
+
+void StressSizeClass(size_t numThreads, size_t allocSize) {
+ // We would like to see the minimum memory usage under aggressive page
+ // releasing.
+ mallopt(M_DECAY_TIME, 0);
+
+ std::thread* threads[kMaxThreads];
+ for (size_t i = 0; i < numThreads; ++i) threads[i] = new std::thread(ThreadTask, i, allocSize);
+
+ for (size_t i = 0; i < numThreads; ++i) {
+ threads[i]->join();
+ delete threads[i];
+ }
+
+ // Do an explicit purge to ensure we will be more likely to get the actual
+ // in-use memory.
+ mallopt(M_PURGE_ALL, 0);
+
+ android::meminfo::ProcMemInfo proc_mem(getpid());
+ const std::vector<android::meminfo::Vma>& maps = proc_mem.MapsWithoutUsageStats();
+ uint64_t rss_bytes = 0;
+ uint64_t vss_bytes = 0;
+
+ for (auto& vma : maps) {
+ if (vma.name == "[anon:libc_malloc]" || android::base::StartsWith(vma.name, "[anon:scudo:") ||
+ android::base::StartsWith(vma.name, "[anon:GWP-ASan")) {
+ android::meminfo::Vma update_vma(vma);
+ if (!proc_mem.FillInVmaStats(update_vma)) {
+ std::cout << "Failed to parse VMA" << std::endl;
+ exit(1);
+ }
+ rss_bytes += update_vma.usage.rss;
+ vss_bytes += update_vma.usage.vss;
+ }
+ }
+
+ std::cout << "RSS: " << rss_bytes / (1024.0 * 1024.0) << " MB" << std::endl;
+ std::cout << "VSS: " << vss_bytes / (1024.0 * 1024.0) << " MB" << std::endl;
+
+ for (size_t i = 0; i < numThreads; ++i) {
+ for (size_t j = 0; j < kMaxLen; ++j) free(MemPool[i][j]);
+ }
+}
+
+int main(int argc, char* argv[]) {
+ if (argc != 3) {
+ std::cerr << "usage: " << argv[0] << " $NUM_THREADS $ALLOC_SIZE" << std::endl;
+ return 1;
+ }
+
+ size_t numThreads = atoi(argv[1]);
+ size_t allocSize = atoi(argv[2]);
+
+ if (numThreads == 0 || allocSize == 0) {
+ std::cerr << "Please provide valid $NUM_THREADS and $ALLOC_SIZE" << std::endl;
+ return 1;
+ }
+
+ if (numThreads > kMaxThreads) {
+ std::cerr << "The max number of threads is " << kMaxThreads << std::endl;
+ return 1;
+ }
+
+ StressSizeClass(numThreads, allocSize);
+
+ return 0;
+}
diff --git a/benchmarks/spawn/AndroidTest.xml b/benchmarks/spawn/AndroidTest.xml
index 466dc7f..5232aa0 100644
--- a/benchmarks/spawn/AndroidTest.xml
+++ b/benchmarks/spawn/AndroidTest.xml
@@ -4,18 +4,18 @@
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
- <option name="push" value="bionic-spawn-benchmarks->/data/local/tmp/bionic-spawn-benchmarks" />
+ <option name="push" value="bionic-spawn-benchmarks->/data/local/tests/unrestricted/bionic-spawn-benchmarks" />
</target_preparer>
<!-- TODO(b/120549168): This seems necessary for consistent results on a walleye, but it's not working with atest
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
- <option name="push" value="perf-setup.sh->/data/local/tmp/perf-setup.sh" />
- <option name="post-push" value="chmod 755 /data/local/tmp/perf-setup.sh;/data/local/tmp/perf-setup.sh" />
+ <option name="push" value="perf-setup.sh->/data/local/tests/unrestricted/perf-setup.sh" />
+ <option name="post-push" value="chmod 755 /data/local/tests/unrestricted/perf-setup.sh;/data/local/tests/unrestricted/perf-setup.sh" />
</target_preparer>
-->
<test class="com.android.tradefed.testtype.GoogleBenchmarkTest" >
- <option name="native-benchmark-device-path" value="/data/local/tmp" />
+ <option name="native-benchmark-device-path" value="/data/local/tests/unrestricted" />
<option name="benchmark-module-name" value="bionic-spawn-benchmarks" />
<!-- The GoogleBenchmarkTest class ordinarily expects every file in the benchmark's
diff --git a/docs/clang_fortify_anatomy.md b/docs/clang_fortify_anatomy.md
new file mode 100644
index 0000000..4b95fdc
--- /dev/null
+++ b/docs/clang_fortify_anatomy.md
@@ -0,0 +1,841 @@
+*This document was originally written for a broad audience, and it was*
+*determined that it'd be good to hold in Bionic's docs, too. Due to the*
+*ever-changing nature of code, it tries to link to a stable tag of*
+*Bionic's libc, rather than the live code in Bionic. Same for Clang.*
+*Reader beware. :)*
+
+# The Anatomy of Clang FORTIFY
+
+## Objective
+
+The intent of this document is to run through the minutiae of how Clang FORTIFY
+actually works in Bionic at the time of writing. Other FORTIFY implementations
+that target Clang should use very similar mechanics. This document exists in part
+because many Clang-specific features serve multiple purposes simultaneously, so
+getting up-to-speed on how things function can be quite difficult.
+
+## Background
+
+FORTIFY is a broad suite of extensions to libc aimed at catching misuses of
+common library functions. Textually, these extensions exist purely in libc, but
+all implementations of FORTIFY rely heavily on C language extensions in order
+to function at all.
+
+Broadly, FORTIFY implementations try to guard against many misuses of C
+standard(-ish) libraries:
+- Buffer overruns in functions where pointers+sizes are passed (e.g., `memcpy`,
+ `poll`), or where sizes exist implicitly (e.g., `strcpy`).
+- Arguments with incorrect values passed to libc functions (e.g.,
+ out-of-bounds bits in `umask`).
+- Missing arguments to functions (e.g., `open()` with `O_CREAT`, but no mode
+ bits).
+
+FORTIFY is traditionally enabled by passing `-D_FORTIFY_SOURCE=N` to your
+compiler. `N==0` disables FORTIFY, whereas `N==1`, `N==2`, and `N==3` enable
+increasingly strict versions of it. In general, FORTIFY doesn't require user
+code changes; that said, some code patterns
+are [incompatible with stricter versions of FORTIFY checking]. This is largely
+because FORTIFY has significant flexibility in what it considers to be an
+"out-of-bounds" access.
+
+FORTIFY implementations use a mix of compiler diagnostics and runtime checks to
+flag and/or mitigate the impacts of the misuses mentioned above.
+
+Further, given FORTIFY's design, the effectiveness of FORTIFY is a function of
+-- among other things -- the optimization level you're compiling your code at.
+Many FORTIFY implementations are implicitly disabled when building with `-O0`,
+since FORTIFY's design for both Clang and GCC relies on optimizations in order
+to provide useful run-time checks. For the purpose of this document, all
+analysis of FORTIFY functions and commentary on builtins assume that code is
+being built with some optimization level > `-O0`.
+
+### A note on GCC
+
+This document talks specifically about Bionic's FORTIFY implementation targeted
+at Clang. While GCC also provides a set of language extensions necessary to
+implement FORTIFY, these tools are different from what Clang offers. This
+divergence is an artifact of Clang and GCC's differing architecture as
+compilers.
+
+Textually, quite a bit can be shared between a FORTIFY implementation for GCC
+and one for Clang (e.g., see [ChromeOS' Glibc patch]), but this kind of sharing
+requires things like macros that expand to unbalanced braces depending on your
+compiler:
+
+```c
+/*
+ * Highly simplified; if you're interested in FORTIFY's actual implementation,
+ * please see the patch linked above.
+ */
+#ifdef __clang__
+# define FORTIFY_PRECONDITIONS
+# define FORTIFY_FUNCTION_END
+#else
+# define FORTIFY_PRECONDITIONS {
+# define FORTIFY_FUNCTION_END }
+#endif
+
+/*
+ * FORTIFY_WARNING_ONLY_IF_SIZE_OF_BUF_LESS_THAN is not defined, due to its
+ * complexity and irrelevance. It turns into a compile-time warning if the
+ * compiler can determine `*buf` has fewer than `size` bytes available.
+ */
+
+char *getcwd(char *buf, size_t size)
+FORTIFY_PRECONDITIONS
+ FORTIFY_WARNING_ONLY_IF_SIZE_OF_BUF_LESS_THAN(buf, size, "`buf` is too smol.")
+{
+ // Actual shared function implementation goes here.
+}
+FORTIFY_FUNCTION_END
+```
+
+All talk of GCC-focused implementations and how to merge Clang and GCC
+implementations is out-of-scope for this doc, however.
+
+## The Life of a Clang FORTIFY Function
+
+As referenced in the Background section, FORTIFY performs many different checks
+for many functions. This section intends to go through real-world examples of
+FORTIFY functions in Bionic, breaking down how each part of these functions
+work, and how the pieces fit together to provide FORTIFY-like functionality.
+
+While FORTIFY implementations may differ between stdlibs, they broadly follow
+the same patterns when implementing their checks for Clang, and they try to
+make similar promises with respect to FORTIFY compiling to be zero-overhead in
+some cases, etc. Moreover, while this document specifically examines Bionic,
+many stdlibs will operate _very similarly_ to Bionic in their Clang FORTIFY
+implementations.
+
+**In general, when reading the below, be prepared for exceptions, subtlety, and
+corner cases. The individual function breakdowns below try to not offer
+redundant information. Each one focuses on different aspects of FORTIFY.**
+
+### Terminology
+
+Because FORTIFY should be mostly transparent to developers, there are inherent
+naming collisions here: `memcpy(x, y, z)` turns into fundamentally different
+generated code depending on the value of `_FORTIFY_SOURCE`. Further, said
+`memcpy` call with `_FORTIFY_SOURCE` enabled needs to be able to refer to the
+`memcpy` that would have been called, had `_FORTIFY_SOURCE` been disabled.
+Hence, the following convention is followed in the subsections below for all
+prose (namely, multiline code blocks are exempted from this):
+
+- Standard library function names preceded by `__builtin_` refer to the use of
+ the function with `_FORTIFY_SOURCE` disabled.
+- Standard library function names without a prefix refer to the use of the
+ function with `_FORTIFY_SOURCE` enabled.
+
+This convention also applies in `clang`. `__builtin_memcpy` will always call
+`memcpy` as though `_FORTIFY_SOURCE` were disabled.
+
+## Breakdown of `mempcpy`
+
+The [FORTIFY'ed version of `mempcpy`] is a full, featureful example of a
+FORTIFY'ed function from Bionic. From the user's perspective, it supports a few
+things:
+- Producing a compile-time error if the number of bytes to copy trivially
+ exceeds the number of bytes available at the destination pointer.
+- If the `mempcpy` has the potential to write to more bytes than what is
+ available at the destination, a run-time check is inserted to crash the
+ program if more bytes are written than what is allowed.
+- Compiling away to be zero overhead when none of the buffer sizes can be
+ determined at compile-time[^1].
+
+The declaration in Bionic's headers for `__builtin_mempcpy` is:
+```c
+void* mempcpy(void* __dst, const void* __src, size_t __n) __INTRODUCED_IN(23);
+```
+
+Which is annotated with nothing special, except for Bionic's versioner, which
+is Android-specific (and orthogonal to FORTIFY anyway), so it will be ignored.
+
+The [source for `mempcpy`] in Bionic's headers for is:
+```c
+__BIONIC_FORTIFY_INLINE
+void* mempcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
+ __overloadable
+ __clang_error_if(__bos_unevaluated_lt(__bos0(dst), copy_amount),
+ "'mempcpy' called with size bigger than buffer") {
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+ size_t bos_dst = __bos0(dst);
+ if (!__bos_trivially_ge(bos_dst, copy_amount)) {
+ return __builtin___mempcpy_chk(dst, src, copy_amount, bos_dst);
+ }
+#endif
+ return __builtin_mempcpy(dst, src, copy_amount);
+}
+```
+
+Expanding some of the important macros here, this function expands to roughly:
+```c
+static
+__inline__
+__attribute__((no_stack_protector))
+__attribute__((always_inline))
+void* mempcpy(
+ void* const dst __attribute__((pass_object_size(0))),
+ const void* src,
+ size_t copy_amount)
+ __attribute__((overloadable))
+ __attribute__((diagnose_if(
+ __builtin_object_size(dst, 0) != -1 && __builtin_object_size(dst, 0) <= copy_amount),
+ "'mempcpy' called with size bigger than buffer"))) {
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+ size_t bos_dst = __builtin_object_size(dst, 0);
+ if (!(__bos_trivially_ge(bos_dst, copy_amount))) {
+ return __builtin___mempcpy_chk(dst, src, copy_amount, bos_dst);
+ }
+#endif
+ return __builtin_mempcpy(dst, src, copy_amount);
+}
+```
+
+So let's walk through this step by step, to see how FORTIFY does what it says on
+the tin here.
+
+[^1]: "Zero overhead" in a way [similar to C++11's `std::unique_ptr`]: this will
+turn into a direct call `__builtin_mempcpy` (or an optimized form thereof) with
+no other surrounding checks at runtime. However, the additional complexity may
+hinder optimizations that are performed before the optimizer can prove that the
+`if (...) { ... }` can be optimized out. Depending on how late this happens,
+the additional complexity may skew inlining costs, hide opportunities for e.g.,
+`memcpy` coalescing, etc etc.
+
+### How does Clang select `mempcpy`?
+
+First, it's critical to notice that `mempcpy` is marked `overloadable`. This
+function is a `static inline __attribute__((always_inline))` overload of
+`__builtin_mempcpy`:
+- `__attribute__((overloadable))` allows us to perform overloading in C.
+- `__attribute__((overloadable))` mangles all calls to functions marked with
+ `__attribute__((overloadable))`.
+- `__attribute__((overloadable))` allows exactly one function signature with a
+ given name to not be marked with `__attribute__((overloadable))`. Calls to
+ this overload will not be mangled.
+
+Second, one might note that this `mempcpy` implementation has the same C-level
+signature as `__builtin_mempcpy`. `pass_object_size` is a Clang attribute that
+is generally needed by FORTIFY, but it carries the side-effect that functions
+may be overloaded simply on the presence (or lack of presence) of
+`pass_object_size` attributes. Given two overloads of a function that only
+differ on the presence of `pass_object_size` attributes, the candidate with
+`pass_object_size` attributes is preferred.
+
+Finally, the prior paragraph gets thrown out if one tries to take the address of
+`mempcpy`. It is impossible to take the address of a function with one or more
+parameters that are annotated with `pass_object_size`. Hence,
+`&__builtin_mempcpy == &mempcpy`. Further, because this is an issue of overload
+resolution, `(&mempcpy)(x, y, z);` is functionally identical to
+`__builtin_mempcpy(x, y, z);`.
+
+All of this accomplishes the following:
+- Direct calls to `mempcpy` should call the FORTIFY-protected `mempcpy`.
+- Indirect calls to `&mempcpy` should call `__builtin_mempcpy`.
+
+### How does Clang offer compile-time diagnostics?
+
+Once one is convinced that the FORTIFY-enabled overload of `mempcpy` will be
+selected for direct calls, Clang's `diagnose_if` and `__builtin_object_size` do
+all of the work from there.
+
+Subtleties here primarily fall out of the discussion in the above section about
+`&__builtin_mempcpy == &mempcpy`:
+```c
+#define _FORTIFY_SOURCE 2
+#include <string.h>
+void example_code() {
+ char buf[4]; // ...Assume sizeof(char) == 1.
+ const char input_buf[] = "Hello, World";
+ mempcpy(buf, input_buf, 4); // Valid, no diagnostic issued.
+
+ mempcpy(buf, input_buf, 5); // Emits a compile-time error since sizeof(buf) < 5.
+ __builtin_mempcpy(buf, input_buf, 5); // No compile-time error.
+ (&mempcpy)(buf, input_buf, 5); // No compile-time error, since __builtin_mempcpy is selected.
+}
+```
+
+Otherwise, the rest of this subsection is dedicated to preliminary discussion
+about `__builtin_object_size`.
+
+Clang's frontend can do one of two things with `__builtin_object_size(p, n)`:
+- Evaluate it as a constant.
+ - This can either mean declaring that the number of bytes at `p` is definitely
+ impossible to know, so the default value is used, or the number of bytes at
+ `p` can be known without optimizations.
+- Declare that the expression cannot form a constant, and lower it to
+ `@llvm.objectsize`, which is discussed in depth later.
+
+In the examples above, since `diagnose_if` is evaluated with context from the
+caller, Clang should be able to trivially determine that `buf` refers to a
+`char` array with 4 elements.
+
+The primary consequence of the above is that diagnostics can only be emitted if
+no optimizations are required to detect a broken code pattern. To be specific,
+clang's constexpr evaluator must be able to determine the logical object that
+any given pointer points to in order to fold `__builtin_object_size` to a
+constant, non-default answer:
+
+```c
+#define _FORTIFY_SOURCE 2
+#include <string.h>
+void example_code() {
+ char buf[4]; // ...Assume sizeof(char) == 1.
+ const char input_buf[] = "Hello, World";
+ mempcpy(buf, input_buf, 4); // Valid, no diagnostic issued.
+ mempcpy(buf, input_buf, 5); // Emits a compile-time error since sizeof(buf) < 5.
+ char *buf_ptr = buf;
+ mempcpy(buf_ptr, input_buf, 5); // No compile-time error; `buf_ptr`'s target can't be determined.
+}
+```
+
+### How does Clang insert run-time checks?
+
+This section expands on the following statement: FORTIFY has zero runtime cost
+in instances where there is no chance of catching a bug at run-time. Otherwise,
+it introduces a tiny additional run-time cost to ensure that functions aren't
+misused.
+
+In prior sections, the following was established:
+- `overloadable` and `pass_object_size` prompt Clang to always select this
+ overload of `mempcpy` over `__builtin_mempcpy` for direct calls.
+- If a call to `mempcpy` was trivially broken, Clang would produce a
+ compile-time error, rather than producing a binary.
+
+Hence, the case we're interested in here is one where Clang's frontend selected
+a FORTIFY'ed function's implementation for a function call, but was unable to
+find anything seriously wrong with said function call. Since the frontend is
+powerless to detect bugs at this point, our focus shifts to the mechanisms that
+LLVM uses to support FORTIFY.
+
+Going back to Bionic's `mempcpy` implementation, we have the following (ignoring
+diagnose_if and assuming run-time checks are enabled):
+```c
+static
+__inline__
+__attribute__((no_stack_protector))
+__attribute__((always_inline))
+void* mempcpy(
+ void* const dst __attribute__((pass_object_size(0))),
+ const void* src,
+ size_t copy_amount)
+ __attribute__((overloadable)) {
+ size_t bos_dst = __builtin_object_size(dst, 0);
+ if (bos_dst != -1 &&
+ !(__builtin_constant_p(copy_amount) && bos_dst >= copy_amount)) {
+ return __builtin___mempcpy_chk(dst, src, copy_amount, bos_dst);
+ }
+ return __builtin_mempcpy(dst, src, copy_amount);
+}
+```
+
+In other words, we have a `static`, `always_inline` function which:
+- If `__builtin_object_size(dst, 0)` cannot be determined (in which case, it
+ returns -1), calls `__builtin_mempcpy`.
+- Otherwise, if `copy_amount` can be folded to a constant, and if
+ `__builtin_object_size(dst, 0) >= copy_amount`, calls `__builtin_mempcpy`.
+- Otherwise, calls `__builtin___mempcpy_chk`.
+
+
+How can this be "zero overhead"? Let's focus on the following part of the
+function:
+
+```c
+ size_t bos_dst = __builtin_object_size(dst, 0);
+ if (bos_dst != -1 &&
+ !(__builtin_constant_p(copy_amount) && bos_dst >= copy_amount)) {
+```
+
+If Clang's frontend cannot determine a value for `__builtin_object_size`, Clang
+lowers it to LLVM's `@llvm.objectsize` intrinsic. The `@llvm.objectsize`
+invocation corresponding to `__builtin_object_size(p, 0)` is guaranteed to
+always fold to a constant value by the time LLVM emits machine code.
+
+Hence, `bos_dst` is guaranteed to be a constant; if it's -1, the above branch
+can be eliminated entirely, since it folds to `if (false && ...)`. Further, the
+RHS of the `&&` in this branch has us call `__builtin_mempcpy` if `copy_amount`
+is a known value less than `bos_dst` (yet another constant value). Therefore,
+the entire condition is always knowable when LLVM is done with LLVM IR-level
+optimizations, so no condition is ever emitted to machine code in practice.
+
+#### Why is "zero overhead" in quotes? Why is `unique_ptr` relevant?
+
+`__builtin_object_size` and `__builtin_constant_p` are forced to be constants
+after most optimizations take place. Until LLVM replaces both of these with
+constants and optimizes them out, we have additional branches and function calls
+in our IR. This can have negative effects, such as distorting inlining costs and
+inhibiting optimizations that are conservative around branches in control-flow.
+
+So FORTIFY is free in these cases _in isolation of any of the code around it_.
+Due to its implementation, it may impact the optimizations that occur on code
+around the literal call to the FORTIFY-hardened libc function.
+
+`unique_ptr` was just the first thing that came to the author's mind for "the
+type should be zero cost with any level of optimization enabled, but edge-cases
+might make it only-mostly-free to use."
+
+### How is checking actually performed?
+
+In cases where checking can be performed (e.g., where we call
+`__builtin___mempcpy_chk(dst, src, copy_amount, bos_dst);`), Bionic provides [an
+implementation for `__mempcpy_chk`]. This is:
+
+```c
+extern "C" void* __mempcpy_chk(void* dst, const void* src, size_t count, size_t dst_len) {
+ __check_count("mempcpy", "count", count);
+ __check_buffer_access("mempcpy", "write into", count, dst_len);
+ return mempcpy(dst, src, count);
+}
+```
+This function itself boils down to a few small branches which abort the program
+if they fail, and a direct call to `__builtin_mempcpy`.
+
+### Wrapping up
+
+In the above breakdown, it was shown how Clang and Bionic work together to:
+- represent FORTIFY-hardened overloads of functions,
+- report misuses of stdlib functions at compile-time, and
+- insert run-time checks for uses of functions that might be incorrect, but only
+ if we have the potential of proving the incorrectness of these.
+
+## Breakdown of open
+
+In Bionic, the [FORTIFY'ed implementation of `open`] is quite large. Much like
+`mempcpy`, the `__builtin_open` declaration is simple:
+
+```c
+int open(const char* __path, int __flags, ...);
+```
+
+With some macros expanded, the FORTIFY-hardened header implementation is:
+```c
+int __open_2(const char*, int);
+int __open_real(const char*, int, ...) __asm__(open);
+
+#define __open_modes_useful(flags) (((flags) & O_CREAT) || ((flags) & O_TMPFILE) == O_TMPFILE)
+
+static
+int open(const char* pathname, int flags, mode_t modes, ...) __overloadable
+ __attribute__((diagnose_if(1, "error", "too many arguments")));
+
+static
+__inline__
+__attribute__((no_stack_protector))
+__attribute__((always_inline))
+int open(const char* const __attribute__((pass_object_size(1))) pathname, int flags)
+ __attribute__((overloadable))
+ __attribute__((diagnose_if(
+ __open_modes_useful(flags),
+ "error",
+ "'open' called with O_CREAT or O_TMPFILE, but missing mode"))) {
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+ return __open_2(pathname, flags);
+#else
+ return __open_real(pathname, flags);
+#endif
+}
+static
+__inline__
+__attribute__((no_stack_protector))
+__attribute__((always_inline))
+int open(const char* const __attribute__((pass_object_size(1))) pathname, int flags, mode_t modes)
+ __attribute__((overloadable))
+ __clang_warning_if(!__open_modes_useful(flags) && modes,
+ "'open' has superfluous mode bits; missing O_CREAT?") {
+ return __open_real(pathname, flags, modes);
+}
+```
+
+Which may be a lot to take in.
+
+Before diving too deeply, please note that the remainder of these subsections
+assume that the programmer didn't make any egregious typos. Moreover, there's no
+real way that Bionic tries to prevent calls to `open` like
+`open("foo", 0, "how do you convert a const char[N] to mode_t?");`. The only
+real C-compatible solution the author can think of is "stamp out many overloads
+to catch sort-of-common instances of this very uncommon typo." This isn't great.
+
+More directly, no effort is made below to recognize calls that, due to
+incompatible argument types, cannot go to any `open` implementation other than
+`__builtin_open`, since it's recognized right here. :)
+
+### Implementation breakdown
+
+This `open` implementation does a few things:
+- Turns calls to `open` with too many arguments into a compile-time error.
+- Diagnoses calls to `open` with missing modes at compile-time and run-time
+ (both cases turn into errors).
+- Emits warnings on calls to `open` with useless mode bits, unless the mode bits
+ are all 0.
+
+One common bit of code not explained below is the `__open_real` declaration above:
+```c
+int __open_real(const char*, int, ...) __asm__(open);
+```
+
+This exists as a way for us to call `__builtin_open` without needing clang to
+have a pre-defined `__builtin_open` function.
+
+#### Compile-time error on too many arguments
+
+```c
+static
+int open(const char* pathname, int flags, mode_t modes, ...) __overloadable
+ __attribute__((diagnose_if(1, "error", "too many arguments")));
+```
+
+Which matches most calls to open that supply too many arguments, since
+`int(const char *, int, ...)` matches less strongly than
+`int(const char *, int, mode_t, ...)` for calls where the 3rd arg can be
+converted to `mode_t` without too much effort. Because of the `diagnose_if`
+attribute, all of these calls turn into compile-time errors.
+
+#### Compile-time or run-time error on missing arguments
+The following overload handles all two-argument calls to `open`.
+```c
+static
+__inline__
+__attribute__((no_stack_protector))
+__attribute__((always_inline))
+int open(const char* const __attribute__((pass_object_size(1))) pathname, int flags)
+ __attribute__((overloadable))
+ __attribute__((diagnose_if(
+ __open_modes_useful(flags),
+ "error",
+ "'open' called with O_CREAT or O_TMPFILE, but missing mode"))) {
+#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+ return __open_2(pathname, flags);
+#else
+ return __open_real(pathname, flags);
+#endif
+}
+```
+
+Like `mempcpy`, `diagnose_if` handles emitting a compile-time error if the call
+to `open` is broken in a way that's visible to Clang's frontend. This
+essentially boils down to "`open` is being called with a `flags` value that
+requires mode bits to be set."
+
+If that fails to catch a bug, we [unconditionally call `__open_2`], which
+performs a run-time check:
+```c
+int __open_2(const char* pathname, int flags) {
+ if (needs_mode(flags)) __fortify_fatal("open: called with O_CREAT/O_TMPFILE but no mode");
+ return FDTRACK_CREATE_NAME("open", __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), 0));
+}
+```
+
+#### Compile-time warning if modes are pointless
+
+Finally, we have the following `open` call:
+```c
+static
+__inline__
+__attribute__((no_stack_protector))
+__attribute__((always_inline))
+int open(const char* const __attribute__((pass_object_size(1))) pathname, int flags, mode_t modes)
+ __attribute__((overloadable))
+ __clang_warning_if(!__open_modes_useful(flags) && modes,
+ "'open' has superfluous mode bits; missing O_CREAT?") {
+ return __open_real(pathname, flags, modes);
+}
+```
+
+This simply issues a warning if Clang's frontend can determine that `flags`
+isn't necessary. Due to conventions in existing code, a `modes` value of `0` is
+not diagnosed.
+
+#### What about `&open`?
+One yet-unaddressed aspect of the above is how `&open` works. This is thankfully
+a short answer:
+- It happens that `open` takes a parameter of type `const char*`.
+- It happens that `pass_object_size` -- an attribute only applicable to
+ parameters of type `T*` -- makes it impossible to take the address of a
+ function.
+
+Since clang doesn't support a "this function should never have its address
+taken," attribute, Bionic uses the next best thing: `pass_object_size`. :)
+
+## Breakdown of poll
+
+(Preemptively: at the time of writing, Clang has no literal `__builtin_poll`
+builtin. `__builtin_poll` is referenced below to remain consistent with the
+convention established in the Terminology section.)
+
+Bionic's `poll` implementation is closest to `mempcpy` above, though it has a
+few interesting aspects worth examining.
+
+The [full header implementation of `poll`] is, with some macros expanded:
+```c
+#define __bos_fd_count_trivially_safe(bos_val, fds, fd_count) \
+ ((bos_val) == -1) || \
+ (__builtin_constant_p(fd_count) && \
+ (bos_val) >= sizeof(*fds) * (fd_count)))
+
+static
+__inline__
+__attribute__((no_stack_protector))
+__attribute__((always_inline))
+int poll(struct pollfd* const fds __attribute__((pass_object_size(1))), nfds_t fd_count, int timeout)
+ __attribute__((overloadable))
+ __attriubte__((diagnose_if(
+ __builtin_object_size(fds, 1) != -1 && __builtin_object_size(fds, 1) < sizeof(*fds) * fd_count,
+ "error",
+ "in call to 'poll', fd_count is larger than the given buffer"))) {
+ size_t bos_fds = __builtin_object_size(fds, 1);
+ if (!__bos_fd_count_trivially_safe(bos_fds, fds, fd_count)) {
+ return __poll_chk(fds, fd_count, timeout, bos_fds);
+ }
+ return (&poll)(fds, fd_count, timeout);
+}
+```
+
+To get the commonality with `mempcpy` and `open` out of the way:
+- This function is an overload with `__builtin_poll`.
+- The signature is the same, modulo the presence of a `pass_object_size`
+ attribute. Hence, for direct calls, overload resolution will always prefer it
+ over `__builtin_poll`. Taking the address of `poll` is forbidden, so all
+ references to `&poll` actually reference `__builtin_poll`.
+- When `fds` is too small to hold `fd_count` `pollfd`s, Clang will emit a
+ compile-time error if possible using `diagnose_if`.
+- If this can't be observed until run-time, `__poll_chk` verifies this.
+- When `fds` is a constant according to `__builtin_constant_p`, this always
+ compiles into `__poll_chk` for always-broken calls to `poll`, or
+ `__builtin_poll` for always-safe calls to `poll`.
+
+The critical bits to highlight here are on this line:
+```c
+int poll(struct pollfd* const fds __attribute__((pass_object_size(1))), nfds_t fd_count, int timeout)
+```
+
+And this line:
+```c
+ return (&poll)(fds, fd_count, timeout);
+```
+
+Starting with the simplest, we call `__builtin_poll` with `(&poll)(...);`. As
+referenced above, taking the address of an overloaded function where all but one
+overload has a `pass_object_size` attribute on one or more parameters always
+resolves to the function without any `pass_object_size` attributes.
+
+The other line deserves a section. The subtlety of it is almost entirely in the
+use of `pass_object_size(1)` instead of `pass_object_size(0)`. on the `fds`
+parameter, and the corresponding use of `__builtin_object_size(fds, 1);` in the
+body of `poll`.
+
+### Subtleties of __builtin_object_size(p, N)
+
+Earlier in this document, it was said that a full description of each
+attribute/builtin necessary to power FORTIFY was out of scope. This is... only
+somewhat the case when we talk about `__builtin_object_size` and
+`pass_object_size`, especially when their second argument is `1`.
+
+#### tl;dr
+`__builtin_object_size(p, N)` and `pass_object_size(N)`, where `(N & 1) == 1`,
+can only be accurately determined by Clang. LLVM's `@llvm.objectsize` intrinsic
+ignores the value of `N & 1`, since handling `(N & 1) == 1` accurately requires
+data that's currently entirely inaccessible to LLVM, and that is difficult to
+preserve through LLVM's optimization passes.
+
+`pass_object_size`'s "lifting" of the evaluation of
+`__builtin_object_size(p, N)` to the caller is critical, since it allows Clang
+full visibility into the expression passed to e.g., `poll(&foo->bar, baz, qux)`.
+It's not a perfect solution, but it allows `N == 1` to be fully accurate in at
+least some cases.
+
+#### Background
+Clang's implementation of `__builtin_object_size` aims to be compatible with
+GCC's, which has [a decent bit of documentation]. Put simply,
+`__builtin_object_size(p, N)` is intended to evaluate at compile-time how many
+bytes can be accessed after `p` in a well-defined way. Straightforward examples
+of this are:
+```c
+char buf[8];
+assert(__builtin_object_size(buf, N) == 8);
+assert(__builtin_object_size(buf + 1, N) == 7);
+```
+
+This should hold for all values of N that are valid to pass to
+`__builtin_object_size`. The `N` value of `__builtin_object_size` is a mask of
+settings.
+
+##### (N & 2) == ?
+
+This is mostly for completeness sake; in Bionic's FORTIFY implementation, N is
+always either 0 or 1.
+
+If there are multiple possible values of `p` in a call to
+`__builtin_object_size(p, N)`, the second bit in `N` determines the behavior of
+the compiler. If `(N & 2) == 0`, `__builtin_object_size` should return the
+greatest possible size for each possible value of `p`. Otherwise, it should
+return the least possible value. For example:
+
+```c
+char smol_buf[7];
+char buf[8];
+char *p = rand() ? smol_buf : buf;
+assert(__builtin_object_size(p, 0) == 8);
+assert(__builtin_object_size(p, 2) == 7);
+```
+
+##### (N & 1) == 0
+
+`__builtin_object_size(p, 0)` is more or less as simple as the example in the
+Background section directly above. When Clang attempts to evaluate
+`__builtin_object_size(p, 0);` and when LLVM tries to determine the result of a
+corresponding `@llvm.objectsize` call to, they search for the storage underlying
+the pointer in question. If that can be determined, Clang or LLVM can provide an
+answer; otherwise, they cannot.
+
+##### (N & 1) == 1, and the true magic of pass_object_size
+
+`__builtin_object_size(p, 1)` has a less uniform implementation between LLVM and
+Clang. According to GCC's documentation, "If the least significant bit [of
+__builtin_object_size's second argument] is clear, objects are whole variables,
+if it is set, a closest surrounding subobject is considered the object a pointer
+points to."
+
+The "closest surrounding subobject," means that `(N & 1) == 1` depends on type
+information in order to operate in many cases. Consider the following examples:
+```c
+struct Foo {
+ int a;
+ int b;
+};
+
+struct Foo foo;
+assert(__builtin_object_size(&foo, 0) == sizeof(foo));
+assert(__builtin_object_size(&foo, 1) == sizeof(foo));
+assert(__builtin_object_size(&foo->a, 0) == sizeof(foo));
+assert(__builtin_object_size(&foo->a, 1) == sizeof(int));
+
+struct Foo foos[2];
+assert(__builtin_object_size(&foos[0], 0) == 2 * sizeof(foo));
+assert(__builtin_object_size(&foos[0], 1) == sizeof(foo));
+assert(__builtin_object_size(&foos[0]->a, 0) == 2 * sizeof(foo));
+assert(__builtin_object_size(&foos[0]->a, 1) == sizeof(int));
+```
+
+...And perhaps somewhat surprisingly:
+```c
+void example(struct Foo *foo) {
+ // (As a reminder, `-1` is "I don't know" when `(N & 2) == 0`.)
+ assert(__builtin_object_size(foo, 0) == -1);
+ assert(__builtin_object_size(foo, 1) == -1);
+ assert(__builtin_object_size(foo->a, 0) == -1);
+ assert(__builtin_object_size(foo->a, 1) == sizeof(int));
+}
+```
+
+In Clang, [this type-aware requirement poses problems for us]: Clang's frontend
+knows everything we could possibly want about the types of variables, but
+optimizations are only performed by LLVM. LLVM has no reliable source for C or
+C++ data types, so calls to `__builtin_object_size(p, N)` that cannot be
+resolved by clang are lowered to the equivalent of
+`__builtin_object_size(p, N & ~1)` in LLVM IR.
+
+Moreover, Clang's frontend is the best-equipped part of the compiler to
+accurately determine the answer for `__builtin_object_size(p, N)`, given we know
+what `p` is. LLVM is the best-equipped part of the compiler to determine the
+value of `p`. This ordering issue is unfortunate.
+
+This is where `pass_object_size(N)` comes in. To summarize [the docs for
+`pass_object_size`], it evaluates `__builtin_object_size(p, N)` within the
+context of the caller of the function annotated with `pass_object_size`, and
+passes the value of that into the callee as an invisible parameter. All calls to
+`__builtin_object_size(parameter, N)` are substituted with references to this
+invisible parameter.
+
+Putting this plainly, Clang's frontend struggles to evaluate the following:
+```c
+int foo(void *p) {
+ return __builtin_object_size(p, 1);
+}
+
+void bar() {
+ struct { int i, j } k;
+ // The frontend can't figure this interprocedural objectsize out, so it gets lowered to
+ // LLVM, which determines that the answer here is sizeof(k).
+ int baz = foo(&k.i);
+}
+```
+
+However, with the magic of `pass_object_size`, we get one level of inlining to
+look through:
+```c
+int foo(void *const __attribute__((pass_object_size(1))) p) {
+ return __builtin_object_size(p, 1);
+}
+
+void bar() {
+ struct { int i, j } k;
+ // Due to pass_object_size, this is equivalent to:
+ // int baz = foo(&k.i, __builtin_object_size(&k.i, 1));
+ // ...and `int foo(void *)` is actually equivalent to:
+ // int foo(void *const, size_t size) {
+ // return size;
+ // }
+ int baz = foo(&k.i);
+}
+```
+
+So we can obtain an accurate result in this case.
+
+##### What about pass_object_size(0)?
+It's sort of tangential, but if you find yourself wondering about the utility of
+`pass_object_size(0)` ... it's somewhat split. `pass_object_size(0)` in Bionic's
+FORTIFY exists mostly for visual consistency, simplicity, and as a useful way to
+have e.g., `&mempcpy` == `&__builtin_mempcpy`.
+
+Outside of these fringe benefits, all of the functions with
+`pass_object_size(0)` on parameters are marked with `always_inline`, so
+"lifting" the `__builtin_object_size` call isn't ultimately very helpful. In
+theory, users can always have something like:
+
+```c
+// In some_header.h
+// This function does cool and interesting things with the `__builtin_object_size` of its parameter,
+// and is able to work with that as though the function were defined inline.
+void out_of_line_function(void *__attribute__((pass_object_size(0))));
+```
+
+Though the author isn't aware of uses like this in practice, beyond a few folks
+on LLVM's mailing list seeming interested in trying it someday.
+
+#### Wrapping up
+In the (long) section above, two things were covered:
+- The use of `(&poll)(...);` is a convenient shorthand for calling
+ `__builtin_poll`.
+- `__builtin_object_size(p, N)` with `(N & 1) == 1` is not easy for Clang to
+ answer accurately, since it relies on type info only available in the
+ frontend, and it sometimes relies on optimizations only available in the
+ middle-end. `pass_object_size` helps mitigate this.
+
+## Miscellaneous Notes
+The above should be a roughly comprehensive view of how FORTIFY works in the
+real world. The main thing it fails to mention is the use of [the `diagnose_as_builtin` attribute] in Clang.
+
+As time has moved on, Clang has increasingly gained support for emitting
+warnings that were previously emitted by FORTIFY machinery.
+`diagnose_as_builtin` allows us to remove the `diagnose_if`s from some of the
+`static inline` overloads of stdlib functions above, so Clang may diagnose them
+instead.
+
+Clang's built-in diagnostics are often better than `diagnose_if` diagnostics,
+since Clang can format its diagnostics to include e.g., information about the
+sizes of buffers in a suspect call to a function. `diagnose_if` can only have
+the compiler output constant strings.
+
+[ChromeOS' Glibc patch]: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/90fa9b27731db10a6010c7f7c25b24028145b091/sys-libs/glibc/files/local/glibc-2.33/0007-glibc-add-clang-style-FORTIFY.patch
+[FORTIFY'ed implementation of `open`]: https://android.googlesource.com/platform/bionic/+/refs/heads/android12-release/libc/include/bits/fortify/fcntl.h#41
+[FORTIFY'ed version of `mempcpy`]: https://android.googlesource.com/platform/bionic/+/refs/heads/android12-release/libc/include/bits/fortify/string.h#45
+[a decent bit of documentation]: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html
+[an implementation for `__mempcpy_chk`]: https://android.googlesource.com/platform/bionic/+/refs/heads/android12-release/libc/bionic/fortify.cpp#501
+[full header implementation of `poll`]: https://android.googlesource.com/platform/bionic/+/refs/heads/android12-release/libc/include/bits/fortify/poll.h#43
+[incompatible with stricter versions of FORTIFY checking]: https://godbolt.org/z/fGfEYxfnf
+[similar to C++11's `std::unique_ptr`]: https://stackoverflow.com/questions/58339165/why-can-a-t-be-passed-in-register-but-a-unique-ptrt-cannot
+[source for `mempcpy`]: https://android.googlesource.com/platform/bionic/+/refs/heads/android12-release/libc/include/string.h#55
+[the `diagnose_as_builtin` attribute]: https://releases.llvm.org/14.0.0/tools/clang/docs/AttributeReference.html#diagnose-as-builtin
+[the docs for `pass_object_size`]: https://releases.llvm.org/14.0.0/tools/clang/docs/AttributeReference.html#pass-object-size-pass-dynamic-object-size
+[this type-aware requirement poses problems for us]: https://github.com/llvm/llvm-project/issues/55742
+[unconditionally call `__open_2`]: https://android.googlesource.com/platform/bionic/+/refs/heads/android12-release/libc/bionic/open.cpp#70
diff --git a/docs/elf-tls.md b/docs/elf-tls.md
index 4a62793..d408b3f 100644
--- a/docs/elf-tls.md
+++ b/docs/elf-tls.md
@@ -101,9 +101,9 @@
`R_TLS_DTPOFF` is a dynamic relocation to the offset of `tls_var` within its module's `PT_TLS`
segment.
-`__tls_get_addr` looks up `TlsIndex::module`'s entry in the DTV and adds `TlsIndex::offset` to the
-module's TLS block. Before it can do this, it ensures that the module's TLS block is allocated. A
-simple approach is to allocate memory lazily:
+`__tls_get_addr` looks up `TlsIndex::module_id`'s entry in the DTV and adds `TlsIndex::offset` to
+the module's TLS block. Before it can do this, it ensures that the module's TLS block is allocated.
+A simple approach is to allocate memory lazily:
1. If the current thread's DTV generation count is less than the current global TLS generation, then
`__tls_get_addr` may reallocate the DTV or free blocks for unloaded modules.
diff --git a/docs/status.md b/docs/status.md
index bf246a6..c2ed944 100644
--- a/docs/status.md
+++ b/docs/status.md
@@ -29,19 +29,24 @@
* `gethostid`
* `shm_open`/`shm_unlink`
* `sockatmark`
+ * `ualarm`
Missing functionality:
* `<aio.h>`
* `<monetary.h>`. See
[discussion](https://github.com/android/ndk/issues/1182).
* `<wordexp.h>`
+ * Locales. Although bionic contains the various `_l()` functions, the only
+ locale supported is a UTF-8 C/POSIX locale. Most of the POSIX APIs are
+ insufficient to support the wide range of languages used by Android users,
+ and apps should use icu4c (or do their i18n work in Java) instead.
+ * Robust mutexes. See
+ [discussion](https://github.com/android/ndk/issues/1181).
* Thread cancellation (`pthread_cancel`). Unlikely to ever be implemented
because of the difficulty and cost of implementing it, and the difficulty
of using it correctly. See
[This is why we can't have safe cancellation points](https://lwn.net/Articles/683118/)
for more about thread cancellation.
- * Robust mutexes. See
- [discussion](https://github.com/android/ndk/issues/1181).
Run `./libc/tools/check-symbols-glibc.py` in bionic/ for the current
list of POSIX functions implemented by glibc but not by bionic.
@@ -50,6 +55,21 @@
Current libc symbols: https://android.googlesource.com/platform/bionic/+/master/libc/libc.map.txt
+New libc functions in U (API level 34):
+ * `close_range` and `copy_file_range` (Linux-specific GNU extensions).
+ * `memset_explicit` in <string.h> (C23 addition).
+ * `__freadahead` in <stdio_ext.h> (in musl but not glibc).
+ * `posix_spawn_file_actions_addchdir_np` and
+ `posix_spawn_file_actions_addfchdir_np` in <spawn.h> (in musl/glibc
+ and macOS, but not iOS).
+
+New libc behavior in U (API level 34):
+ * Support for `%b` and `%B` in the printf/wprintf family, `%b` in the
+ scanf/wscanf family, and `0b` prefixes with base 0 in the strtol/wcstol
+ family.
+ * Support for `wN` length modifiers in the printf/wprintf family.
+ * tmpfile() now respects $TMPDIR.
+
New libc functions in T (API level 33):
* `backtrace`, `backtrace_symbols`, `backtrace_symbols_fd` (`<execinfo.h>`).
* New system call wrappers: `preadv2`, `preadv64v2`, `pwritev2`,
diff --git a/libc/Android.bp b/libc/Android.bp
index 97146aa..f5f5f7c 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -35,7 +35,7 @@
"stdio/stdio.cpp",
"stdio/stdio_ext.cpp",
"stdio/vfscanf.cpp",
- "stdio/vfwscanf.c",
+ "stdio/vfwscanf.cpp",
]
// off64_t/time64_t support on LP32.
@@ -95,7 +95,6 @@
header_libs: [
"libc_headers",
- "gwp_asan_headers",
"liblog_headers", // needed by bionic/libc/async_safe/include
],
export_header_lib_headers: [
@@ -198,6 +197,9 @@
arm64: {
srcs: ["arch-arm64/bionic/__set_tls.c"],
},
+ riscv64: {
+ srcs: ["arch-riscv64/bionic/__set_tls.c"],
+ },
x86: {
srcs: [
"arch-x86/bionic/__libc_init_sysinfo.cpp",
@@ -246,10 +248,14 @@
cc_library_static {
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"tzcode/**/*.c",
"tzcode/bionic.cpp",
- "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
+ // tzcode doesn't include strptime or wcsftime, so we use the OpenBSD
+ // code (with some local changes in the strptime case).
+ "upstream-openbsd/lib/libc/locale/_def_time.c",
+ "upstream-openbsd/lib/libc/time/wcsftime.c",
],
cflags: [
@@ -259,18 +265,22 @@
// Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
"-DSTD_INSPIRED",
// Obviously, we want to be thread-safe.
- "-DTHREAD_SAFE",
+ "-DTHREAD_SAFE=1",
// The name of the tm_gmtoff field in our struct tm.
"-DTM_GMTOFF=tm_gmtoff",
+ // TZDEFAULT is not applicable to Android as there is no one file per time zone mapping
+ "-DTZDEFAULT=NULL",
// Where we store our tzdata.
"-DTZDIR=\"/system/usr/share/zoneinfo\"",
// Include `tzname`, `timezone`, and `daylight` globals.
"-DHAVE_POSIX_DECLS=0",
- "-DUSG_COMPAT=1",
+ "-DUSG_COMPAT=2",
+ "-DHAVE_TZNAME=2",
+ // stdbool.h is available
+ "-DHAVE_STDBOOL_H",
// Use the empty string (instead of " ") as the timezone abbreviation
// fallback.
"-DWILDABBR=\"\"",
- "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
"-Dlint",
],
@@ -285,6 +295,7 @@
cc_library_static {
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"dns/**/*.c*",
@@ -320,6 +331,7 @@
cc_library_static {
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"upstream-freebsd/lib/libc/gen/ldexp.c",
"upstream-freebsd/lib/libc/stdlib/getopt_long.c",
@@ -357,11 +369,6 @@
"upstream-freebsd/lib/libc/string/wmemset.c",
],
arch: {
- arm64: {
- exclude_srcs: [
- "upstream-freebsd/lib/libc/string/wmemmove.c",
- ],
- },
x86: {
exclude_srcs: [
"upstream-freebsd/lib/libc/string/wcschr.c",
@@ -372,7 +379,6 @@
"upstream-freebsd/lib/libc/string/wcscat.c",
"upstream-freebsd/lib/libc/string/wcscpy.c",
"upstream-freebsd/lib/libc/string/wmemcmp.c",
- "upstream-freebsd/lib/libc/string/wmemset.c",
],
},
},
@@ -392,6 +398,7 @@
cc_library_static {
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"upstream-freebsd/lib/libc/gen/glob.c",
],
@@ -419,6 +426,7 @@
cc_library_static {
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"upstream-netbsd/common/lib/libc/stdlib/random.c",
"upstream-netbsd/lib/libc/gen/nice.c",
@@ -476,6 +484,7 @@
cc_library_static {
name: "libc_openbsd_ndk",
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"upstream-openbsd/lib/libc/gen/alarm.c",
"upstream-openbsd/lib/libc/gen/ctype_.c",
@@ -497,13 +506,7 @@
"upstream-openbsd/lib/libc/locale/mbstowcs.c",
"upstream-openbsd/lib/libc/locale/mbtowc.c",
"upstream-openbsd/lib/libc/locale/wcscoll.c",
- "upstream-openbsd/lib/libc/locale/wcstoimax.c",
- "upstream-openbsd/lib/libc/locale/wcstol.c",
- "upstream-openbsd/lib/libc/locale/wcstoll.c",
"upstream-openbsd/lib/libc/locale/wcstombs.c",
- "upstream-openbsd/lib/libc/locale/wcstoul.c",
- "upstream-openbsd/lib/libc/locale/wcstoull.c",
- "upstream-openbsd/lib/libc/locale/wcstoumax.c",
"upstream-openbsd/lib/libc/locale/wcsxfrm.c",
"upstream-openbsd/lib/libc/locale/wctob.c",
"upstream-openbsd/lib/libc/locale/wctomb.c",
@@ -600,6 +603,7 @@
cc_library_static {
name: "libc_openbsd_large_stack",
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"stdio/vfprintf.cpp",
"stdio/vfwprintf.cpp",
@@ -629,6 +633,7 @@
// automatically included.
cc_library_static {
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
// These two depend on getentropy, which isn't in libc_ndk.a.
"upstream-openbsd/lib/libc/crypt/arc4random.c",
@@ -665,6 +670,16 @@
"upstream-openbsd/lib/libc/string/strncmp.c",
],
},
+ riscv64: {
+ srcs: [
+ "upstream-freebsd/lib/libc/string/memcmp.c",
+ "upstream-freebsd/lib/libc/string/memcpy.c",
+ "upstream-freebsd/lib/libc/string/memmove.c",
+ "upstream-freebsd/lib/libc/string/memset.c",
+ "upstream-openbsd/lib/libc/string/strcmp.c",
+ "upstream-openbsd/lib/libc/string/strlen.c",
+ ],
+ },
x86: {
exclude_srcs: [
"upstream-openbsd/lib/libc/string/memchr.c",
@@ -717,6 +732,7 @@
cc_library_static {
defaults: ["libc_defaults"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"upstream-openbsd/android/gdtoa_support.cpp",
"upstream-openbsd/lib/libc/gdtoa/dmisc.c",
@@ -758,7 +774,7 @@
}
// ========================================================
-// libc_fortify.a - container for our FORITFY
+// libc_fortify.a - container for our FORTIFY
// implementation details
// ========================================================
cc_library_static {
@@ -777,7 +793,6 @@
arch: {
arm: {
cflags: [
- "-DNO___MEMCPY_CHK",
"-DRENAME___STRCAT_CHK",
"-DRENAME___STRCPY_CHK",
],
@@ -804,9 +819,15 @@
],
},
arm64: {
- cflags: ["-DNO___MEMCPY_CHK"],
srcs: [
- "arch-arm64/generic/bionic/__memcpy_chk.S",
+ "arch-arm64/string/__memcpy_chk.S",
+ "arch-arm64/string/__memset_chk.S",
+ ],
+ },
+ riscv64: {
+ srcs: [
+ "arch-riscv64/string/__memset_chk.S",
+ "arch-riscv64/string/__memcpy_chk.S",
],
},
},
@@ -890,11 +911,6 @@
},
arm64: {
srcs: [
- "arch-arm64/generic/bionic/memcpy.S",
- "arch-arm64/generic/bionic/memmove.S",
- "arch-arm64/generic/bionic/memset.S",
- "arch-arm64/generic/bionic/wmemmove.S",
-
"arch-arm64/bionic/__bionic_clone.S",
"arch-arm64/bionic/_exit_with_stack_teardown.S",
"arch-arm64/bionic/setjmp.S",
@@ -902,7 +918,6 @@
"arch-arm64/bionic/vfork.S",
],
exclude_srcs: [
- "bionic/__memcpy_chk.cpp",
"bionic/strchr.cpp",
"bionic/strchrnul.cpp",
"bionic/strnlen.c",
@@ -910,6 +925,16 @@
],
},
+ riscv64: {
+ srcs: [
+ "arch-riscv64/bionic/__bionic_clone.S",
+ "arch-riscv64/bionic/_exit_with_stack_teardown.S",
+ "arch-riscv64/bionic/setjmp.S",
+ "arch-riscv64/bionic/syscall.S",
+ "arch-riscv64/bionic/vfork.S",
+ ],
+ },
+
x86: {
srcs: [
"arch-x86/generic/string/memcmp.S",
@@ -923,24 +948,42 @@
"arch-x86/generic/string/wcscat.c",
"arch-x86/generic/string/wcscpy.c",
"arch-x86/generic/string/wmemcmp.c",
- "arch-x86/generic/string/wmemset.c",
- "arch-x86/atom/string/sse2-memchr-atom.S",
- "arch-x86/atom/string/sse2-memrchr-atom.S",
- "arch-x86/atom/string/sse2-strchr-atom.S",
- "arch-x86/atom/string/sse2-strnlen-atom.S",
- "arch-x86/atom/string/sse2-strrchr-atom.S",
- "arch-x86/atom/string/sse2-wcschr-atom.S",
- "arch-x86/atom/string/sse2-wcsrchr-atom.S",
- "arch-x86/atom/string/sse2-wcslen-atom.S",
- "arch-x86/atom/string/sse2-wcscmp-atom.S",
- "arch-x86/silvermont/string/sse2-memmove-slm.S",
- "arch-x86/silvermont/string/sse2-memset-slm.S",
- "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
- "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
- "arch-x86/silvermont/string/sse2-strcpy-slm.S",
- "arch-x86/silvermont/string/sse2-strlen-slm.S",
- "arch-x86/silvermont/string/sse2-strncpy-slm.S",
+ "arch-x86/string/sse2-memchr-atom.S",
+ "arch-x86/string/sse2-memmove-slm.S",
+ "arch-x86/string/sse2-memrchr-atom.S",
+ "arch-x86/string/sse2-memset-atom.S",
+ "arch-x86/string/sse2-memset-slm.S",
+ "arch-x86/string/sse2-stpcpy-slm.S",
+ "arch-x86/string/sse2-stpncpy-slm.S",
+ "arch-x86/string/sse2-strchr-atom.S",
+ "arch-x86/string/sse2-strcpy-slm.S",
+ "arch-x86/string/sse2-strlen-slm.S",
+ "arch-x86/string/sse2-strncpy-slm.S",
+ "arch-x86/string/sse2-strnlen-atom.S",
+ "arch-x86/string/sse2-strrchr-atom.S",
+ "arch-x86/string/sse2-wcschr-atom.S",
+ "arch-x86/string/sse2-wcsrchr-atom.S",
+ "arch-x86/string/sse2-wcslen-atom.S",
+ "arch-x86/string/sse2-wcscmp-atom.S",
+ "arch-x86/string/sse2-strlen-atom.S",
+
+ "arch-x86/string/ssse3-memcmp-atom.S",
+ "arch-x86/string/ssse3-memmove-atom.S",
+ "arch-x86/string/ssse3-strcat-atom.S",
+ "arch-x86/string/ssse3-strcmp-atom.S",
+ "arch-x86/string/ssse3-strcpy-atom.S",
+ "arch-x86/string/ssse3-strlcat-atom.S",
+ "arch-x86/string/ssse3-strlcpy-atom.S",
+ "arch-x86/string/ssse3-strncat-atom.S",
+ "arch-x86/string/ssse3-strncmp-atom.S",
+ "arch-x86/string/ssse3-strncpy-atom.S",
+ "arch-x86/string/ssse3-wcscat-atom.S",
+ "arch-x86/string/ssse3-wcscpy-atom.S",
+ "arch-x86/string/ssse3-wmemcmp-atom.S",
+
+ "arch-x86/string/sse4-memcmp-slm.S",
+ "arch-x86/string/sse4-wmemcmp-slm.S",
"arch-x86/bionic/__bionic_clone.S",
"arch-x86/bionic/_exit_with_stack_teardown.S",
@@ -950,32 +993,6 @@
"arch-x86/bionic/syscall.S",
"arch-x86/bionic/vfork.S",
"arch-x86/bionic/__x86.get_pc_thunk.S",
-
- // ssse3 functions
- "arch-x86/atom/string/ssse3-strcat-atom.S",
- "arch-x86/atom/string/ssse3-strcmp-atom.S",
- "arch-x86/atom/string/ssse3-strlcat-atom.S",
- "arch-x86/atom/string/ssse3-strlcpy-atom.S",
- "arch-x86/atom/string/ssse3-strncat-atom.S",
- "arch-x86/atom/string/ssse3-strncmp-atom.S",
- "arch-x86/atom/string/ssse3-wcscat-atom.S",
- "arch-x86/atom/string/ssse3-wcscpy-atom.S",
-
- // sse4 functions
- "arch-x86/silvermont/string/sse4-memcmp-slm.S",
- "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
-
- // atom functions
- "arch-x86/atom/string/sse2-memset-atom.S",
- "arch-x86/atom/string/sse2-strlen-atom.S",
- "arch-x86/atom/string/ssse3-memcmp-atom.S",
- "arch-x86/atom/string/ssse3-memmove-atom.S",
- "arch-x86/atom/string/ssse3-strcpy-atom.S",
- "arch-x86/atom/string/ssse3-strncpy-atom.S",
- "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
-
- // avx2 functions
- "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
],
exclude_srcs: [
@@ -986,6 +1003,7 @@
},
x86_64: {
srcs: [
+ "arch-x86_64/string/avx2-memset-kbl.S",
"arch-x86_64/string/sse2-memmove-slm.S",
"arch-x86_64/string/sse2-memset-slm.S",
"arch-x86_64/string/sse2-stpcpy-slm.S",
@@ -998,7 +1016,6 @@
"arch-x86_64/string/sse4-memcmp-slm.S",
"arch-x86_64/string/ssse3-strcmp-slm.S",
"arch-x86_64/string/ssse3-strncmp-slm.S",
- "arch-x86_64/string/avx2-wmemset-kbl.S",
"arch-x86_64/bionic/__bionic_clone.S",
"arch-x86_64/bionic/_exit_with_stack_teardown.S",
@@ -1076,7 +1093,6 @@
"bionic/ffs.cpp",
"bionic/fgetxattr.cpp",
"bionic/flistxattr.cpp",
- "bionic/flockfile.cpp",
"bionic/fpclassify.cpp",
"bionic/fsetxattr.cpp",
"bionic/ftruncate.cpp",
@@ -1115,6 +1131,7 @@
"bionic/mbrtoc16.cpp",
"bionic/mbrtoc32.cpp",
"bionic/mempcpy.cpp",
+ "bionic/memset_explicit.cpp",
"bionic/mkdir.cpp",
"bionic/mkfifo.cpp",
"bionic/mknod.cpp",
@@ -1188,6 +1205,7 @@
"bionic/termios.cpp",
"bionic/thread_private.cpp",
"bionic/threads.cpp",
+ "bionic/time_l.cpp",
"bionic/timespec_get.cpp",
"bionic/tmpfile.cpp",
"bionic/umount.cpp",
@@ -1300,47 +1318,43 @@
// ========================================================
genrule {
- name: "syscalls-arm.S",
+ name: "syscalls-arm",
out: ["syscalls-arm.S"],
srcs: ["SYSCALLS.TXT"],
- tool_files: [":bionic-gensyscalls"],
- cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
- bazel_module: {
- bp2build_available: true,
- }
+ tools: ["gensyscalls"],
+ cmd: "$(location gensyscalls) arm $(in) > $(out)",
}
genrule {
- name: "syscalls-arm64.S",
+ name: "syscalls-arm64",
out: ["syscalls-arm64.S"],
srcs: ["SYSCALLS.TXT"],
- tool_files: [":bionic-gensyscalls"],
- cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
- bazel_module: {
- bp2build_available: true,
- },
+ tools: ["gensyscalls"],
+ cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
}
genrule {
- name: "syscalls-x86.S",
+ name: "syscalls-riscv64",
+ out: ["syscalls-riscv64.S"],
+ srcs: ["SYSCALLS.TXT"],
+ tools: ["gensyscalls"],
+ cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
+}
+
+genrule {
+ name: "syscalls-x86",
out: ["syscalls-x86.S"],
srcs: ["SYSCALLS.TXT"],
- tool_files: [":bionic-gensyscalls"],
- cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
- bazel_module: {
- bp2build_available: true,
- },
+ tools: ["gensyscalls"],
+ cmd: "$(location gensyscalls) x86 $(in) > $(out)",
}
genrule {
- name: "syscalls-x86_64.S",
+ name: "syscalls-x86_64",
out: ["syscalls-x86_64.S"],
srcs: ["SYSCALLS.TXT"],
- tool_files: [":bionic-gensyscalls"],
- cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
- bazel_module: {
- bp2build_available: true,
- },
+ tools: ["gensyscalls"],
+ cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
}
cc_library_static {
@@ -1348,16 +1362,19 @@
srcs: ["bionic/__set_errno.cpp"],
arch: {
arm: {
- srcs: [":syscalls-arm.S"],
+ srcs: [":syscalls-arm"],
},
arm64: {
- srcs: [":syscalls-arm64.S"],
+ srcs: [":syscalls-arm64"],
+ },
+ riscv64: {
+ srcs: [":syscalls-riscv64"],
},
x86: {
- srcs: [":syscalls-x86.S"],
+ srcs: [":syscalls-x86"],
},
x86_64: {
- srcs: [":syscalls-x86_64.S"],
+ srcs: [":syscalls-x86_64"],
},
},
name: "libc_syscalls",
@@ -1431,6 +1448,7 @@
whole_static_libs: [
"gwp_asan",
+ "gwp_asan_crash_handler",
"libarm-optimized-routines-string",
"libasync_safe",
"libc_bionic_ndk",
@@ -1511,6 +1529,9 @@
name: "libc_static_dispatch",
arch: {
+ x86_64: {
+ srcs: ["arch-x86_64/static_function_dispatch.S"],
+ },
x86: {
srcs: ["arch-x86/static_function_dispatch.S"],
},
@@ -1536,6 +1557,9 @@
"-fno-jump-tables",
],
arch: {
+ x86_64: {
+ srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
+ },
x86: {
srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
},
@@ -1627,7 +1651,6 @@
"bionic/NetdClient.cpp",
"arch-common/bionic/crtend_so.S",
],
- bazel_module: { bp2build_available: true },
}
filegroup {
@@ -1638,7 +1661,6 @@
"bionic/malloc_common.cpp",
"bionic/malloc_limit.cpp",
],
- bazel_module: { bp2build_available: true },
}
filegroup {
@@ -1647,19 +1669,17 @@
"arch-arm/bionic/exidx_dynamic.c",
"arch-arm/bionic/atexit_legacy.c",
],
- bazel_module: { bp2build_available: true },
}
// ========================================================
// libc.a + libc.so
// ========================================================
-cc_library {
+cc_defaults {
defaults: [
"libc_defaults",
"libc_native_allocator_defaults",
],
- name: "libc",
- static_ndk_lib: true,
+ name: "libc_library_defaults",
product_variables: {
platform_sdk_version: {
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
@@ -1670,6 +1690,7 @@
cflags: ["-DLIBC_STATIC"],
whole_static_libs: [
"gwp_asan",
+ "gwp_asan_crash_handler",
"libc_init_static",
"libc_common_static",
"libc_unwind_static",
@@ -1679,6 +1700,7 @@
srcs: [ ":libc_sources_shared" ],
whole_static_libs: [
"gwp_asan",
+ "gwp_asan_crash_handler",
"libc_init_dynamic",
"libc_common_shared",
"libunwind-exported",
@@ -1686,8 +1708,8 @@
},
required: [
- "tzdata",
- "tz_version", // Version metadata for tzdata to help debugging.
+ "tzdata_prebuilt",
+ "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
],
// Do not pack libc.so relocations; see http://b/20645321 for details.
@@ -1745,6 +1767,15 @@
keep_symbols: true,
},
},
+ riscv64: {
+ version_script: ":libc.riscv64.map",
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
+ },
x86: {
// TODO: This is to work around b/24465209. Remove after root cause is fixed.
pack_relocations: false,
@@ -1775,20 +1806,7 @@
},
},
- stubs: {
- symbol_file: "libc.map.txt",
- versions: [
- "29",
- "R",
- "current",
- ],
- },
- llndk: {
- symbol_file: "libc.map.txt",
- export_headers_as_system: true,
- export_preprocessed_headers: ["include"],
- export_llndk_headers: ["libc_llndk_headers"],
- },
+
apex_available: [
"//apex_available:platform",
"com.android.runtime",
@@ -1803,40 +1821,93 @@
},
}
+cc_library {
+ name: "libc",
+ defaults: [
+ "libc_library_defaults",
+ ],
+ stubs: {
+ symbol_file: "libc.map.txt",
+ versions: [
+ "29",
+ "R",
+ "current",
+ ],
+ },
+ static_ndk_lib: true,
+ llndk: {
+ symbol_file: "libc.map.txt",
+ export_headers_as_system: true,
+ export_preprocessed_headers: ["include"],
+ export_llndk_headers: ["libc_llndk_headers"],
+ },
+}
+
+cc_library {
+ name: "libc_hwasan",
+ defaults: [
+ "libc_library_defaults",
+ ],
+ sanitize: {
+ hwaddress: true,
+ },
+ enabled: false,
+ target: {
+ android_arm64: {
+ enabled: true,
+ },
+ },
+ stem: "libc",
+ relative_install_path: "hwasan",
+ // We don't really need the stubs, but this needs to stay to trigger the
+ // symlink logic in soong.
+ stubs: {
+ symbol_file: "libc.map.txt",
+ },
+ native_bridge_supported: false,
+ // It is never correct to depend on this directly. This is only
+ // needed for the runtime apex, and in base_system.mk.
+ visibility: ["//bionic/apex"],
+}
+
genrule {
name: "libc.arm.map",
- out: ["libc.arm.map"],
+ out: ["libc.arm.map.txt"],
srcs: ["libc.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
- bazel_module: { bp2build_available: true },
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) arm $(in) $(out)",
}
genrule {
name: "libc.arm64.map",
- out: ["libc.arm64.map"],
+ out: ["libc.arm64.map.txt"],
srcs: ["libc.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
- bazel_module: { bp2build_available: true },
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) arm64 $(in) $(out)",
+}
+
+genrule {
+ name: "libc.riscv64.map",
+ out: ["libc.riscv64.map.txt"],
+ srcs: ["libc.map.txt"],
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
}
genrule {
name: "libc.x86.map",
- out: ["libc.x86.map"],
+ out: ["libc.x86.map.txt"],
srcs: ["libc.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
- bazel_module: { bp2build_available: true },
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) x86 $(in) $(out)",
}
genrule {
name: "libc.x86_64.map",
- out: ["libc.x86_64.map"],
+ out: ["libc.x86_64.map.txt"],
srcs: ["libc.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
- bazel_module: { bp2build_available: true },
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
}
// Headers that only other parts of the platform can include.
@@ -1852,6 +1923,7 @@
"//external/perfetto:__subpackages__",
"//external/scudo:__subpackages__",
"//system/core/debuggerd:__subpackages__",
+ "//system/core/init:__subpackages__",
"//system/core/libcutils:__subpackages__",
"//system/memory/libmemunreachable:__subpackages__",
"//system/unwinding/libunwindstack:__subpackages__",
@@ -1875,7 +1947,6 @@
"//apex_available:platform",
"//apex_available:anyapex",
],
- bazel_module: { bp2build_available: true },
}
cc_library_headers {
@@ -1925,6 +1996,9 @@
arm64: {
export_system_include_dirs: ["kernel/uapi/asm-arm64"],
},
+ riscv64: {
+ export_system_include_dirs: ["kernel/uapi/asm-riscv"],
+ },
x86: {
export_system_include_dirs: ["kernel/uapi/asm-x86"],
},
@@ -1932,7 +2006,6 @@
export_system_include_dirs: ["kernel/uapi/asm-x86"],
},
},
- bazel_module: { bp2build_available: true },
}
cc_library_headers {
@@ -1980,7 +2053,6 @@
export_header_lib_headers: ["libc_llndk_headers"],
},
},
- bazel_module: { bp2build_available: true },
}
// ========================================================
@@ -2021,6 +2093,9 @@
arm64: {
version_script: ":libstdc++.arm64.map",
},
+ riscv64: {
+ version_script: ":libstdc++.riscv64.map",
+ },
x86: {
pack_relocations: false,
ldflags: ["-Wl,--hash-style=both"],
@@ -2034,34 +2109,42 @@
genrule {
name: "libstdc++.arm.map",
- out: ["libstdc++.arm.map"],
+ out: ["libstdc++.arm.map.txt"],
srcs: ["libstdc++.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) arm $(in) $(out)",
}
genrule {
name: "libstdc++.arm64.map",
- out: ["libstdc++.arm64.map"],
+ out: ["libstdc++.arm64.map.txt"],
srcs: ["libstdc++.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) arm64 $(in) $(out)",
+}
+
+genrule {
+ name: "libstdc++.riscv64.map",
+ out: ["libstdc++.riscv64.map.txt"],
+ srcs: ["libstdc++.map.txt"],
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
}
genrule {
name: "libstdc++.x86.map",
- out: ["libstdc++.x86.map"],
+ out: ["libstdc++.x86.map.txt"],
srcs: ["libstdc++.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) x86 $(in) $(out)",
}
genrule {
name: "libstdc++.x86_64.map",
- out: ["libstdc++.x86_64.map"],
+ out: ["libstdc++.x86_64.map.txt"],
srcs: ["libstdc++.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
}
// ========================================================
@@ -2131,8 +2214,8 @@
srcs: ["arch-common/bionic/crtbrand.S"],
defaults: ["crt_so_defaults"],
-
- bazel_module: { bp2build_available: true },
+ // crtbrand is an intermediate artifact, not a final CRT object.
+ exclude_from_ndk_sysroot: true,
}
cc_object {
@@ -2144,8 +2227,6 @@
objs: [
"crtbrand",
],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2157,8 +2238,6 @@
srcs: ["arch-common/bionic/crtend_so.S"],
defaults: ["crt_so_defaults"],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2176,8 +2255,6 @@
defaults: ["crt_defaults"],
// When using libc.a, we're using the latest library regardless of target API level.
min_sdk_version: "current",
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2200,8 +2277,6 @@
},
},
defaults: ["crt_defaults"],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2215,8 +2290,6 @@
srcs: ["arch-common/bionic/crtend.S"],
defaults: ["crt_defaults"],
-
- bazel_module: { bp2build_available: true },
}
cc_library_static {
@@ -2244,6 +2317,53 @@
}
// ========================================================
+// libc dependencies for baremetal Rust projects.
+// ========================================================
+
+// This library contains the following unresolved symbols:
+// __errno
+// abort
+// async_safe_fatal_va_list
+cc_library_static {
+ name: "librust_baremetal",
+ header_libs: ["libc_headers"],
+ include_dirs: [
+ "bionic/libc/async_safe/include",
+ "bionic/libc/platform",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ srcs: [
+ "bionic/fortify.cpp",
+ "bionic/strtol.cpp",
+ ],
+ arch: {
+ arm64: {
+ srcs: [
+ "arch-arm64/string/__memcpy_chk.S",
+ ],
+ },
+ riscv64: {
+ srcs: [
+ "arch-riscv64/string/__memcpy_chk.S",
+ ],
+ },
+ },
+ whole_static_libs: [
+ "libarm-optimized-routines-mem",
+ "libc_netbsd",
+ ],
+ system_shared_libs: [],
+ nocrt: true,
+ stl: "none",
+ visibility: [
+ "//packages/modules/Virtualization/vmbase",
+ ],
+}
+
+// ========================================================
// NDK headers.
// ========================================================
@@ -2306,6 +2426,14 @@
}
ndk_headers {
+ name: "libc_asm_riscv64",
+ from: "kernel/uapi/asm-riscv",
+ to: "riscv64-linux-android",
+ srcs: ["kernel/uapi/asm-riscv/**/*.h"],
+ license: "NOTICE",
+}
+
+ndk_headers {
name: "libc_asm_x86",
from: "kernel/uapi/asm-x86",
to: "i686-linux-android",
@@ -2327,6 +2455,17 @@
first_version: "9",
// APIs implemented in asm don't have debug info: http://b/190554910.
allow_untyped_symbols: true,
+ export_header_libs: [
+ "common_libc",
+ "libc_uapi",
+ "libc_kernel_android_uapi_linux",
+ "libc_kernel_android_scsi",
+ "libc_asm_arm",
+ "libc_asm_arm64",
+ "libc_asm_riscv64",
+ "libc_asm_x86",
+ "libc_asm_x86_64",
+ ],
}
ndk_library {
@@ -2342,7 +2481,6 @@
"kernel/uapi/linux/input.h",
"kernel/uapi/linux/input-event-codes.h",
],
- bazel_module: { bp2build_available: true },
}
// Generate a syscall name / number mapping. These objects are text files
@@ -2368,8 +2506,6 @@
"kernel/uapi/asm-arm",
"kernel/uapi",
],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2379,8 +2515,15 @@
"kernel/uapi/asm-arm64",
"kernel/uapi",
],
+}
- bazel_module: { bp2build_available: true },
+cc_object {
+ name: "libseccomp_gen_syscall_nrs_riscv64",
+ defaults: ["libseccomp_gen_syscall_nrs_defaults"],
+ local_include_dirs: [
+ "kernel/uapi/asm-riscv",
+ "kernel/uapi",
+ ],
}
cc_object {
@@ -2392,8 +2535,6 @@
"kernel/uapi/asm-x86",
"kernel/uapi",
],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2405,14 +2546,11 @@
"kernel/uapi/asm-x86",
"kernel/uapi",
],
-
- bazel_module: { bp2build_available: true },
}
filegroup {
name: "all_kernel_uapi_headers",
srcs: ["kernel/uapi/**/*.h"],
- bazel_module: { bp2build_available: true },
}
@@ -2425,12 +2563,38 @@
srcs: [
"SYSCALLS.TXT",
- ":libseccomp_gen_syscall_nrs_arm",
- ":libseccomp_gen_syscall_nrs_arm64",
- ":libseccomp_gen_syscall_nrs_x86",
- ":libseccomp_gen_syscall_nrs_x86_64",
],
+ arch: {
+ arm: {
+ srcs: [
+ ":libseccomp_gen_syscall_nrs_arm",
+ ":libseccomp_gen_syscall_nrs_arm64",
+ ],
+ },
+ arm64: {
+ srcs: [
+ ":libseccomp_gen_syscall_nrs_arm",
+ ":libseccomp_gen_syscall_nrs_arm64",
+ ],
+ },
+ riscv64: {
+ srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
+ },
+ x86: {
+ srcs: [
+ ":libseccomp_gen_syscall_nrs_x86",
+ ":libseccomp_gen_syscall_nrs_x86_64",
+ ],
+ },
+ x86_64: {
+ srcs: [
+ ":libseccomp_gen_syscall_nrs_x86",
+ ":libseccomp_gen_syscall_nrs_x86_64",
+ ],
+ },
+ },
+
out: [
"func_to_syscall_nrs.h",
],
@@ -2444,13 +2608,8 @@
cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
}
-cc_genrule {
- name: "libseccomp_policy_app_zygote_sources",
- recovery_available: true,
- cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
-
- tools: [ "genseccomp" ],
-
+filegroup {
+ name: "seccomp_syscalls_sources_zygote",
srcs: [
"SYSCALLS.TXT",
"SECCOMP_ALLOWLIST_COMMON.TXT",
@@ -2458,27 +2617,11 @@
"SECCOMP_BLOCKLIST_COMMON.TXT",
"SECCOMP_PRIORITY.TXT",
":generate_app_zygote_blocklist",
- ":libseccomp_gen_syscall_nrs_arm",
- ":libseccomp_gen_syscall_nrs_arm64",
- ":libseccomp_gen_syscall_nrs_x86",
- ":libseccomp_gen_syscall_nrs_x86_64",
- ],
-
- out: [
- "arm64_app_zygote_policy.cpp",
- "arm_app_zygote_policy.cpp",
- "x86_64_app_zygote_policy.cpp",
- "x86_app_zygote_policy.cpp",
],
}
-cc_genrule {
- name: "libseccomp_policy_app_sources",
- recovery_available: true,
- cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
-
- tools: [ "genseccomp" ],
-
+filegroup {
+ name: "seccomp_syscalls_sources_app",
srcs: [
"SYSCALLS.TXT",
"SECCOMP_ALLOWLIST_COMMON.TXT",
@@ -2486,56 +2629,242 @@
"SECCOMP_BLOCKLIST_COMMON.TXT",
"SECCOMP_BLOCKLIST_APP.TXT",
"SECCOMP_PRIORITY.TXT",
- ":libseccomp_gen_syscall_nrs_arm",
- ":libseccomp_gen_syscall_nrs_arm64",
- ":libseccomp_gen_syscall_nrs_x86",
- ":libseccomp_gen_syscall_nrs_x86_64",
- ],
-
- out: [
- "arm64_app_policy.cpp",
- "arm_app_policy.cpp",
- "x86_64_app_policy.cpp",
- "x86_app_policy.cpp",
],
}
-cc_genrule {
- name: "libseccomp_policy_system_sources",
- recovery_available: true,
- cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
-
- tools: [ "genseccomp" ],
-
+filegroup {
+ name: "seccomp_syscalls_sources_system",
srcs: [
"SYSCALLS.TXT",
"SECCOMP_ALLOWLIST_COMMON.TXT",
"SECCOMP_ALLOWLIST_SYSTEM.TXT",
"SECCOMP_BLOCKLIST_COMMON.TXT",
"SECCOMP_PRIORITY.TXT",
- ":libseccomp_gen_syscall_nrs_arm",
- ":libseccomp_gen_syscall_nrs_arm64",
+ ],
+}
+
+cc_genrule {
+ name: "libseccomp_policy_app_zygote_sources_x86",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_zygote",
":libseccomp_gen_syscall_nrs_x86",
":libseccomp_gen_syscall_nrs_x86_64",
],
-
out: [
- "arm64_system_policy.cpp",
- "arm_system_policy.cpp",
- "x86_64_system_policy.cpp",
- "x86_system_policy.cpp",
+ "x86_app_zygote_policy.cpp",
+ "x86_64_app_zygote_policy.cpp",
],
+ enabled: false,
+ arch: {
+ x86: { enabled: true },
+ x86_64: { enabled: true },
+ },
+}
+
+cc_genrule {
+ name: "libseccomp_policy_app_zygote_sources_arm",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_zygote",
+ ":libseccomp_gen_syscall_nrs_arm",
+ ":libseccomp_gen_syscall_nrs_arm64",
+ ],
+ out: [
+ "arm_app_zygote_policy.cpp",
+ "arm64_app_zygote_policy.cpp",
+ ],
+ enabled: false,
+ arch: {
+ arm: { enabled: true },
+ arm64: { enabled: true },
+ },
+}
+
+cc_genrule {
+ name: "libseccomp_policy_app_zygote_sources_riscv64",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_zygote",
+ ":libseccomp_gen_syscall_nrs_riscv64",
+ ],
+ out: [
+ "riscv64_app_zygote_policy.cpp",
+ ],
+ enabled: false,
+ arch: {
+ riscv64: { enabled: true },
+ },
+}
+
+cc_genrule {
+ name: "libseccomp_policy_app_sources_x86",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_app",
+ ":libseccomp_gen_syscall_nrs_x86",
+ ":libseccomp_gen_syscall_nrs_x86_64",
+ ],
+ out: [
+ "x86_app_policy.cpp",
+ "x86_64_app_policy.cpp",
+ ],
+ enabled: false,
+ arch: {
+ x86: { enabled: true },
+ x86_64: { enabled: true },
+ },
+}
+
+cc_genrule {
+ name: "libseccomp_policy_app_sources_arm",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_app",
+ ":libseccomp_gen_syscall_nrs_arm",
+ ":libseccomp_gen_syscall_nrs_arm64",
+ ],
+ out: [
+ "arm_app_policy.cpp",
+ "arm64_app_policy.cpp",
+ ],
+ enabled: false,
+ arch: {
+ arm: { enabled: true },
+ arm64: { enabled: true },
+ },
+}
+
+cc_genrule {
+ name: "libseccomp_policy_app_sources_riscv64",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_app",
+ ":libseccomp_gen_syscall_nrs_riscv64",
+ ],
+ out: [
+ "riscv64_app_policy.cpp",
+ ],
+ enabled: false,
+ arch: {
+ riscv64: { enabled: true },
+ },
+}
+
+cc_genrule {
+ name: "libseccomp_policy_system_sources_x86",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_system",
+ ":libseccomp_gen_syscall_nrs_x86",
+ ":libseccomp_gen_syscall_nrs_x86_64",
+ ],
+ out: [
+ "x86_system_policy.cpp",
+ "x86_64_system_policy.cpp",
+ ],
+ enabled: false,
+ arch: {
+ x86: { enabled: true },
+ x86_64: { enabled: true },
+ },
+}
+
+cc_genrule {
+ name: "libseccomp_policy_system_sources_arm",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_system",
+ ":libseccomp_gen_syscall_nrs_arm",
+ ":libseccomp_gen_syscall_nrs_arm64",
+ ],
+ out: [
+ "arm_system_policy.cpp",
+ "arm64_system_policy.cpp",
+ ],
+ enabled: false,
+ arch: {
+ arm: { enabled: true },
+ arm64: { enabled: true },
+ },
+}
+
+cc_genrule {
+ name: "libseccomp_policy_system_sources_riscv64",
+ recovery_available: true,
+ cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
+ tools: [ "genseccomp" ],
+ srcs: [
+ ":seccomp_syscalls_sources_system",
+ ":libseccomp_gen_syscall_nrs_riscv64",
+ ],
+ out: [
+ "riscv64_system_policy.cpp",
+ ],
+ enabled: false,
+ arch: {
+ riscv64: { enabled: true },
+ },
}
cc_library {
name: "libseccomp_policy",
recovery_available: true,
generated_headers: ["func_to_syscall_nrs"],
- generated_sources: [
- "libseccomp_policy_app_sources",
- "libseccomp_policy_app_zygote_sources",
- "libseccomp_policy_system_sources",
- ],
+
+ arch: {
+ arm: {
+ generated_sources: [
+ "libseccomp_policy_app_sources_arm",
+ "libseccomp_policy_app_zygote_sources_arm",
+ "libseccomp_policy_system_sources_arm",
+ ],
+ },
+ arm64: {
+ generated_sources: [
+ "libseccomp_policy_app_sources_arm",
+ "libseccomp_policy_app_zygote_sources_arm",
+ "libseccomp_policy_system_sources_arm",
+ ],
+ },
+ riscv64: {
+ generated_sources: [
+ "libseccomp_policy_app_sources_riscv64",
+ "libseccomp_policy_app_zygote_sources_riscv64",
+ "libseccomp_policy_system_sources_riscv64",
+ ],
+ },
+ x86: {
+ generated_sources: [
+ "libseccomp_policy_app_sources_x86",
+ "libseccomp_policy_app_zygote_sources_x86",
+ "libseccomp_policy_system_sources_x86",
+ ],
+ },
+ x86_64: {
+ generated_sources: [
+ "libseccomp_policy_app_sources_x86",
+ "libseccomp_policy_app_zygote_sources_x86",
+ "libseccomp_policy_system_sources_x86",
+ ],
+ },
+ },
srcs: [
"seccomp/seccomp_policy.cpp",
@@ -2556,6 +2885,7 @@
cc_library_host_static {
name: "libfts",
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"bionic/fts.c",
"upstream-openbsd/lib/libc/stdlib/recallocarray.c",
@@ -2598,6 +2928,7 @@
cc_library_host_static {
name: "libb64",
visibility: ["//external/musl"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
export_include_dirs: ["b64/include"],
local_include_dirs: [
@@ -2666,6 +2997,7 @@
" -D $${BIONIC_LIBC_DIR}/b64/include " +
" && " +
"$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
+ " -x **/BUILD " +
" include/**/*:include/ " +
" NOTICE:NOTICE.bionic " +
" && " +
@@ -2705,3 +3037,53 @@
tools: ["soong_zip"],
cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
}
+
+cc_genrule {
+ name: "bionic_sysroot_crt_objects",
+ visibility: ["//visibility:private"],
+ out: ["bionic_sysroot_crt_objects.zip"],
+ tools: ["soong_zip"],
+ srcs: [
+ ":crtbegin_dynamic",
+ ":crtbegin_so",
+ ":crtbegin_static",
+ ":crtend_android",
+ ":crtend_so",
+ ],
+ cmd: "$(location soong_zip) -o $(out) -j " +
+ "-f $(location :crtbegin_dynamic) " +
+ "-f $(location :crtbegin_so) " +
+ "-f $(location :crtbegin_static) " +
+ "-f $(location :crtend_android) " +
+ "-f $(location :crtend_so)",
+ dist: {
+ targets: ["bionic_sysroot_crt_objects"],
+ },
+ arch: {
+ arm: {
+ dist: {
+ suffix: "_arm",
+ },
+ },
+ arm64: {
+ dist: {
+ suffix: "_arm64",
+ },
+ },
+ riscv64: {
+ dist: {
+ suffix: "_riscv64",
+ },
+ },
+ x86: {
+ dist: {
+ suffix: "_x86",
+ },
+ },
+ x86_64: {
+ dist: {
+ suffix: "_x86_64",
+ },
+ },
+ },
+}
diff --git a/libc/BUILD b/libc/BUILD
new file mode 100644
index 0000000..1777ae9
--- /dev/null
+++ b/libc/BUILD
@@ -0,0 +1,42 @@
+# Copyright (C) 2022 The Android Open Source Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load("//build/bazel/rules/apis:cc_api_contribution.bzl", "cc_api_contribution")
+
+cc_api_contribution(
+ name = "libc_contributions",
+ hdrs = [
+ "//bionic/libc/kernel/android:libc_kernel_android_scsi_headers",
+ "//bionic/libc/kernel/android:libc_kernel_android_uapi_headers",
+ "//bionic/libc/kernel/uapi:libc_kernel_uapi_asm_arm64_headers", #arm64
+ "//bionic/libc/kernel/uapi:libc_kernel_uapi_asm_arm_headers", #arm
+ "//bionic/libc/kernel/uapi:libc_kernel_uapi_asm_x86_64_headers", #x86_64
+ "//bionic/libc/kernel/uapi:libc_kernel_uapi_asm_x86_headers", #x86
+ "//bionic/libc/kernel/uapi:libc_kernel_uapi_headers",
+ ],
+ api = ":libc.map.txt",
+ library_name = "libc",
+)
diff --git a/libc/NOTICE b/libc/NOTICE
index 9cbbde2..4d3a108 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -783,22 +783,6 @@
-------------------------------------------------------------------
Copyright (C) 2019 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
--------------------------------------------------------------------
-
-Copyright (C) 2019 The Android Open Source Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -826,34 +810,6 @@
-------------------------------------------------------------------
-Copyright (C) 2019 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (C) 2020 The Android Open Source Project
All rights reserved.
@@ -938,6 +894,34 @@
-------------------------------------------------------------------
+Copyright (C) 2023 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 1980, 1983, 1988, 1993
The Regents of the University of California. All rights reserved.
@@ -2096,6 +2080,38 @@
Copyright (c) 1990, 1993
The Regents of the University of California. All rights reserved.
+
+This code is derived from software contributed to Berkeley by
+Mike Hibler and Chris Torek.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 1990, 1993
+ The Regents of the University of California. All rights reserved.
(c) UNIX System Laboratories, Inc.
All or some portions of this file are derived from material licensed
to the University of California by American Telephone and Telegraph
@@ -2451,9 +2467,15 @@
-------------------------------------------------------------------
+Copyright (c) 1992, 1993, 1994 Henry Spencer.
Copyright (c) 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
+Copyright (c) 2011 The FreeBSD Foundation
+All rights reserved.
+Portions of this software were developed by David Chisnall
+under sponsorship from the FreeBSD Foundation.
+
This code is derived from software contributed to Berkeley by
Henry Spencer.
@@ -2484,6 +2506,8 @@
-------------------------------------------------------------------
Copyright (c) 1992, 1993, 1994 Henry Spencer.
+Copyright (c) 1992, 1993, 1994
+ The Regents of the University of California. All rights reserved.
This code is derived from software contributed to Berkeley by
Henry Spencer.
@@ -2496,11 +2520,7 @@
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by the University of
- California, Berkeley and its contributors.
-4. Neither the name of the University nor the names of its contributors
+3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
@@ -2587,6 +2607,36 @@
-------------------------------------------------------------------
+Copyright (c) 1994 Winning Strategies, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by Winning Strategies, Inc.
+4. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 1996 by Internet Software Consortium.
Permission to use, copy, modify, and distribute this software for any
@@ -2787,41 +2837,6 @@
-------------------------------------------------------------------
-Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
-All rights reserved.
-
-This code was contributed to The NetBSD Foundation by Klaus Klein.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by the NetBSD
- Foundation, Inc. and its contributors.
-4. Neither the name of The NetBSD Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc.
All rights reserved.
@@ -2887,6 +2902,34 @@
-------------------------------------------------------------------
+Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
+All rights reserved.
+
+This code was contributed to The NetBSD Foundation by Klaus Klein.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 1997, 2005 Todd C. Miller <Todd.Miller@courtesan.com>
Permission to use, copy, modify, and distribute this software for any
@@ -3444,32 +3487,6 @@
-------------------------------------------------------------------
-Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
Copyright (c) 1995,1999 by Internet Software Consortium.
@@ -4310,33 +4327,6 @@
-------------------------------------------------------------------
-Copyright (c) 2012-2013, Linaro Limited
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Linaro nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-
--------------------------------------------------------------------
-
Copyright (c) 2012-2014 ARM Ltd
All rights reserved.
@@ -4438,33 +4428,6 @@
-------------------------------------------------------------------
-Copyright (c) 2013, Linaro Limited
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Linaro nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-
--------------------------------------------------------------------
-
Copyright (c) 2014, Intel Corporation
All rights reserved.
@@ -4495,62 +4458,6 @@
-------------------------------------------------------------------
-Copyright (c) 2014, Linaro Limited
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Linaro nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2015 ARM Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. The name of the company may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2015 Joerg Sonnenberger <joerg@NetBSD.org>.
All rights reserved.
@@ -4605,6 +4512,34 @@
-------------------------------------------------------------------
+Copyright (c) 2017, 2018 Dell EMC
+Copyright (c) 2000, 2001, 2008, 2011, David E. O'Brien
+Copyright (c) 1998 John D. Polstra.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c)1999 Citrus Project,
All rights reserved.
diff --git a/libc/SECCOMP_ALLOWLIST_APP.TXT b/libc/SECCOMP_ALLOWLIST_APP.TXT
index ba40b60..7e1ecde 100644
--- a/libc/SECCOMP_ALLOWLIST_APP.TXT
+++ b/libc/SECCOMP_ALLOWLIST_APP.TXT
@@ -56,3 +56,7 @@
# b/62090571
int mkdir(const char *pathname, mode_t mode) lp32
+
+# Not used by bionic in U because riscv64 doesn't have it, but still
+# used by legacy apps (http://b/254179267).
+int renameat(int, const char*, int, const char*) arm,x86,arm64,x86_64
diff --git a/libc/SECCOMP_ALLOWLIST_COMMON.TXT b/libc/SECCOMP_ALLOWLIST_COMMON.TXT
index 0366fdf..efbf28b 100644
--- a/libc/SECCOMP_ALLOWLIST_COMMON.TXT
+++ b/libc/SECCOMP_ALLOWLIST_COMMON.TXT
@@ -3,60 +3,60 @@
#
# This file is processed by a python script named genseccomp.py.
-# syscalls needed to boot android
-int pivot_root:pivot_root(const char *new_root, const char *put_old) lp64
-int ioprio_get:ioprio_get(int which, int who) lp64
-int ioprio_set:ioprio_set(int which, int who, int ioprio) lp64
-pid_t gettid:gettid() all
-int futex:futex(int *uaddr, int futex_op, int val, const struct timespec *timeout, int *uaddr2, int val3) all
-int clone:clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ..) all
-int sigreturn:sigreturn(unsigned long __unused) lp32
-int rt_sigreturn:rt_sigreturn(unsigned long __unused) all
-int rt_tgsigqueueinfo:int rt_tgsigqueueinfo(pid_t tgid, pid_t tid, int sig, siginfo_t *uinfo) all
-int restart_syscall:int restart_syscall() all
+# Syscalls needed to boot android
+int pivot_root(const char*, const char*) lp64
+int ioprio_get(int, int) lp64
+int ioprio_set(int, int, int) lp64
-# vfork is used by java.lang.ProcessBuilder
-pid_t vfork:vfork() arm,x86,x86_64
+# Syscalls used internally by bionic, but not exposed directly.
+pid_t gettid() all
+int futex(int*, int, int, const timespec*, int*, int) all
+int clone(int (*)(void*), void*, int, void*, ...) all
+int sigreturn(unsigned long) lp32
+int rt_sigreturn(unsigned long) all
+int rt_tgsigqueueinfo(pid_t, pid_t, int, siginfo_t*) all
+int restart_syscall() all
-# Needed for performance tools
-int perf_event_open:perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags) all
+# vfork is used by bionic (and java.lang.ProcessBuilder) on some
+# architectures. (The others use clone(2) directly instead.)
+pid_t vfork() arm,x86,x86_64
-# Needed for strace
-int tkill:tkill(int tid, int sig) all
+# Needed for performance tools.
+int perf_event_open(perf_event_attr*, pid_t, int, int, unsigned long) all
-# b/34763393
-int seccomp:seccomp(unsigned int operation, unsigned int flags, void *args) all
+# Needed for strace.
+int tkill(int, int) all
-# Needed by sanitizers (b/34606909, b/136777266).
-int open:open(const char*, int, ...) arm,x86,x86_64
-int stat64:stat64(const char*, struct stat64*) arm,x86
-ssize_t readlink:readlink(const char*, char*, size_t) arm,x86,x86_64
-# Needed by ubsan in T? (http://b/229989971)
-int stat(const char*, struct stat*) arm,x86,x86_64
+# Needed for a CTS test of seccomp (b/34763393).
+int seccomp(unsigned, unsigned, void*) all
+
+# TODO: remove these now we've updated the toolchain (http://b/229989971).
+int open(const char*, int, ...) arm,x86,x86_64
+int stat64(const char*, stat64*) arm,x86
+ssize_t readlink(const char*, char*, size_t) arm,x86,x86_64
+int stat(const char*, stat*) arm,x86,x86_64
#
-# Useful new syscalls which we don't yet use in bionic.
+# (Potentially) useful new syscalls which we don't yet use in bionic.
#
# Since Linux 2.5, not in glibc.
-int io_setup(unsigned nr, aio_context_t *ctxp) all
-int io_destroy(aio_context_t ctx) all
-int io_submit(aio_context_t ctx, long nr, struct iocb **iocbpp) all
-int io_getevents(aio_context_t ctx, long min_nr, long max_nr, struct io_event *events, struct timespec *timeout) all
-int io_cancel(aio_context_t ctx, struct iocb *, struct io_event *result) all
+int io_setup(unsigned, aio_context_t*) all
+int io_destroy(aio_context_t) all
+int io_submit(aio_context_t, long, iocb**) all
+int io_getevents(aio_context_t, long, long, io_event*, timespec*) all
+int io_cancel(aio_context_t, iocb*, io_event*) all
# Since Linux 3.14, not in glibc.
-int sched_getattr(pid_t pid, struct sched_attr* attr, unsigned int flags) all
-int sched_setattr(pid_t pid, struct sched_attr* attr, unsigned int size, unsigned int flags) all
+int sched_getattr(pid_t, sched_attr*, unsigned) all
+int sched_setattr(pid_t, sched_attr*, unsigned, unsigned) all
# Since Linux 3.19, not in glibc (and not really needed to implement fexecve).
-int execveat(int dirfd, const char* pathname, char* const* argv, char* const* envp, int flags) all
+int execveat(int, const char*, char* const*, char* const*, int) all
# Since Linux 4.3, not in glibc. Probed for and conditionally used by ART.
-int membarrier(int cmd, int flags) all
-# Since Linux 4.5, glibc 2.27.
-ssize_t copy_file_range(int fd_in, loff_t* off_in, int fd_out, loff_t* off_out, size_t len, unsigned int flags) all
-# Since Linux 4.6, glibc 2.26.
-ssize_t preadv2(int fd, const struct iovec* iov, int iovcnt, off_t offset, int flags) all
-ssize_t pwritev2(int fd, const struct iovec* iov, int iovcnt, off_t offset, int flags) all
-# Since Linux 5.1, not in glibc.
+int membarrier(int, int) all
+# Since Linux 5.1, not in glibc. Not used by bionic, and not likely ever
+# to be (because the last thing anyone needs is a new 32-bit ABI in the
+# 2020s!) but http://b/138781460 showed cuttlefish needed at least the
+# clock_gettime64 syscall.
int clock_gettime64(clockid_t, timespec64*) lp32
int clock_settime64(clockid_t, const timespec64*) lp32
int clock_adjtime64(clockid_t, timex64*) lp32
@@ -70,11 +70,8 @@
int pselect6_time64(int, fd_set*, fd_set*, timespec64*, void*) lp32
int ppoll_time64(pollfd*, unsigned int, timespec64*, const sigset64_t*, size_t) lp32
int recvmmsg_time64(int, mmsghdr*, unsigned int, int, const timespec64*) lp32
-int semtimedop_time64(int, sembuf*, size_t, const timespec64*) lp32
int rt_sigtimedwait_time64(const sigset64_t*, siginfo_t*, const timespec64*, size_t) lp32
int futex_time64(int*, int, int, const timespec64*, int*, int) lp32
int sched_rr_get_interval_time64(pid_t, timespec64*) lp32
# Since Linux 5.4, not in glibc. Probed for and conditionally used by ART.
int userfaultfd(int) all
-# Since Linux 5.9, used by POSIX_SPAWN_CLOEXEC_DEFAULT
-int close_range(unsigned int, unsigned int, int) all
diff --git a/libc/SECCOMP_BLOCKLIST_APP.TXT b/libc/SECCOMP_BLOCKLIST_APP.TXT
index f14e11c..049d577 100644
--- a/libc/SECCOMP_BLOCKLIST_APP.TXT
+++ b/libc/SECCOMP_BLOCKLIST_APP.TXT
@@ -22,8 +22,10 @@
int setresgid:setresgid32(gid_t, gid_t, gid_t) lp32
int setresgid:setresgid(gid_t, gid_t, gid_t) lp64
# setresuid is explicitly allowed, see above.
-int setfsgid(gid_t) all
-int setfsuid(uid_t) all
+int setfsgid:setfsgid32(gid_t) lp32
+int setfsgid:setfsgid(gid_t) lp64
+int setfsuid:setfsuid32(uid_t) lp32
+int setfsuid:setfsuid(uid_t) lp64
int setgroups:setgroups32(int, const gid_t*) lp32
int setgroups:setgroups(int, const gid_t*) lp64
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index a09c614..08017f1 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -7,7 +7,7 @@
# where:
# arch_list ::= "all" | arches
# arches ::= arch | arch "," arches
-# arch ::= "arm" | "arm64" | "x86" | "x86_64" | "lp32" | "lp64"
+# arch ::= "arm" | "arm64" | "riscv64" | "x86" | "x86_64" | "lp32" | "lp64"
#
# Note:
# - syscall_name corresponds to the name of the syscall, which may differ from
@@ -26,41 +26,47 @@
# This file is processed by a python script named gensyscalls.py, run via
# genrules in Android.bp.
-int execve(const char*, char* const*, char* const*) all
+# Calls that have historical 16-bit variants camping on the best names (CONFIG_UID16).
+uid_t getuid:getuid32() lp32
+uid_t getuid:getuid() lp64
+gid_t getgid:getgid32() lp32
+gid_t getgid:getgid() lp64
+uid_t geteuid:geteuid32() lp32
+uid_t geteuid:geteuid() lp64
+gid_t getegid:getegid32() lp32
+gid_t getegid:getegid() lp64
+uid_t getresuid:getresuid32(uid_t* ruid, uid_t* euid, uid_t* suid) lp32
+uid_t getresuid:getresuid(uid_t* ruid, uid_t* euid, uid_t* suid) lp64
+gid_t getresgid:getresgid32(gid_t* rgid, gid_t* egid, gid_t* sgid) lp32
+gid_t getresgid:getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid) lp64
+int getgroups:getgroups32(int, gid_t*) lp32
+int getgroups:getgroups(int, gid_t*) lp64
+int setgid:setgid32(gid_t) lp32
+int setgid:setgid(gid_t) lp64
+int setuid:setuid32(uid_t) lp32
+int setuid:setuid(uid_t) lp64
+int setreuid:setreuid32(uid_t, uid_t) lp32
+int setreuid:setreuid(uid_t, uid_t) lp64
+int setresuid:setresuid32(uid_t, uid_t, uid_t) lp32
+int setresuid:setresuid(uid_t, uid_t, uid_t) lp64
+int setresgid:setresgid32(gid_t, gid_t, gid_t) lp32
+int setresgid:setresgid(gid_t, gid_t, gid_t) lp64
+int setfsgid:setfsgid32(gid_t) lp32
+int setfsgid:setfsgid(gid_t) lp64
+int setfsuid:setfsuid32(uid_t) lp32
+int setfsuid:setfsuid(uid_t) lp64
-uid_t getuid:getuid32() lp32
-uid_t getuid:getuid() lp64
-gid_t getgid:getgid32() lp32
-gid_t getgid:getgid() lp64
-uid_t geteuid:geteuid32() lp32
-uid_t geteuid:geteuid() lp64
-gid_t getegid:getegid32() lp32
-gid_t getegid:getegid() lp64
-uid_t getresuid:getresuid32(uid_t* ruid, uid_t* euid, uid_t* suid) lp32
-uid_t getresuid:getresuid(uid_t* ruid, uid_t* euid, uid_t* suid) lp64
-gid_t getresgid:getresgid32(gid_t* rgid, gid_t* egid, gid_t* sgid) lp32
-gid_t getresgid:getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid) lp64
-ssize_t readahead(int, off64_t, size_t) all
-int getgroups:getgroups32(int, gid_t*) lp32
-int getgroups:getgroups(int, gid_t*) lp64
-pid_t getpgid(pid_t) all
-pid_t getppid() all
-pid_t getsid(pid_t) all
-pid_t setsid() all
-int setgid:setgid32(gid_t) lp32
-int setgid:setgid(gid_t) lp64
-int setuid:setuid32(uid_t) lp32
-int setuid:setuid(uid_t) lp64
-int setreuid:setreuid32(uid_t, uid_t) lp32
-int setreuid:setreuid(uid_t, uid_t) lp64
-int setresuid:setresuid32(uid_t, uid_t, uid_t) lp32
-int setresuid:setresuid(uid_t, uid_t, uid_t) lp64
-int setresgid:setresgid32(gid_t, gid_t, gid_t) lp32
-int setresgid:setresgid(gid_t, gid_t, gid_t) lp64
-void* __brk:brk(void*) all
-int kill(pid_t, int) all
-int tgkill(pid_t tgid, pid_t tid, int sig) all
-int __ptrace:ptrace(int request, int pid, void* addr, void* data) all
+ssize_t readahead(int, off64_t, size_t) all
+pid_t getpgid(pid_t) all
+pid_t getppid() all
+pid_t getsid(pid_t) all
+pid_t setsid() all
+int kill(pid_t, int) all
+int tgkill(pid_t tgid, pid_t tid, int sig) all
+
+void* __brk:brk(void*) all
+int __execve:execve(const char*, char* const*, char* const*) all
+int __ptrace:ptrace(int request, int pid, void* addr, void* data) all
# <sys/resource.h>
int getrusage(int, struct rusage*) all
@@ -107,6 +113,8 @@
ssize_t __pwritev64v2:pwritev2(int, const struct iovec*, int, long, long, int) all
int __close:close(int) all
+int close_range(unsigned int, unsigned int, int) all
+ssize_t copy_file_range(int, off64_t*, int, off64_t*, size_t, unsigned int) all
pid_t __getpid:getpid() all
int memfd_create(const char*, unsigned) all
int munmap(void*, size_t) all
@@ -154,7 +162,6 @@
int mkdirat(int, const char*, mode_t) all
int mknodat(int, const char*, mode_t, dev_t) all
int readlinkat(int, const char*, char*, size_t) all
-int renameat(int, const char*, int, const char*) all
int renameat2(int, const char*, int, const char*, unsigned) all
int symlinkat(const char*, int, const char*) all
int unlinkat(int, const char*, int) all
@@ -318,7 +325,7 @@
int __eventfd:eventfd2(unsigned int, int) all
-void _exit|_Exit:exit_group(int) all
+void __exit_group:exit_group(int) all
void __exit:exit(int) all
int inotify_init1(int) all
@@ -335,9 +342,6 @@
int __set_tid_address:set_tid_address(int*) all
-int setfsgid(gid_t) all
-int setfsuid(uid_t) all
-
int setdomainname(const char*, size_t) all
int sethostname(const char*, size_t) all
@@ -351,6 +355,9 @@
int __set_tls:__ARM_NR_set_tls(void*) arm
int cacheflush:__ARM_NR_cacheflush(long start, long end, long flags) arm
+# riscv64-specific
+int _flush_icache:riscv_flush_icache(void*, void*, unsigned long) riscv64
+
# x86-specific
int __set_thread_area:set_thread_area(void*) x86
diff --git a/libc/arch-arm64/bionic/setjmp.S b/libc/arch-arm64/bionic/setjmp.S
index d2fafdb..d787a56 100644
--- a/libc/arch-arm64/bionic/setjmp.S
+++ b/libc/arch-arm64/bionic/setjmp.S
@@ -46,8 +46,6 @@
// 0 sigflag/cookie setjmp cookie in top 31 bits, signal mask flag in low bit
// 1 sigmask signal mask (not used with _setjmp / _longjmp)
// 2 core_base base of core registers (x18-x30, sp)
-// (We only store the low bits of x18 to avoid leaking the
-// shadow call stack address into memory.)
// 16 float_base base of float registers (d8-d15)
// 24 checksum checksum of core registers
// 25 reserved reserved entries (room to grow)
@@ -68,8 +66,6 @@
#define _JB_D8_D9 (_JB_D10_D11 + 2)
#define _JB_CHECKSUM (_JB_D8_D9 + 2)
-#define SCS_MASK (SCS_SIZE - 1)
-
.macro m_mangle_registers reg, sp_reg
eor x3, x3, \reg
eor x19, x19, \reg
@@ -155,6 +151,9 @@
bic x1, x1, #1
// Mask off the high bits of the shadow call stack pointer.
+ // We only store the low bits of x18 to avoid leaking the
+ // shadow call stack address into memory.
+ // See the SCS commentary in pthread_internal.h for more detail.
and x3, x18, #SCS_MASK
// Save core registers.
@@ -194,7 +193,7 @@
cmp x2, x12
bne __bionic_setjmp_checksum_mismatch
-#if __has_feature(hwaddress_sanitizer)
+ // Update stack memory tags (MTE + hwasan).
stp x0, x30, [sp, #-16]!
.cfi_adjust_cfa_offset 16
.cfi_rel_offset x0, 0
@@ -206,7 +205,7 @@
bic x2, x2, #1
ldr x0, [x0, #(_JB_X30_SP * 8 + 8)]
eor x0, x0, x2
- bl __hwasan_handle_longjmp
+ bl memtag_handle_longjmp
mov x1, x19 // Restore 'value'.
// Restore original x0 and lr.
@@ -214,7 +213,6 @@
.cfi_adjust_cfa_offset -16
.cfi_restore x0
.cfi_restore x30
-#endif
// Do we need to restore the signal mask?
ldr x2, [x0, #(_JB_SIGFLAG * 8)]
diff --git a/libc/arch-arm64/bionic/vfork.S b/libc/arch-arm64/bionic/vfork.S
index df7b063..9eb82d8 100644
--- a/libc/arch-arm64/bionic/vfork.S
+++ b/libc/arch-arm64/bionic/vfork.S
@@ -29,10 +29,7 @@
#include <platform/bionic/tls_defines.h>
#include <private/bionic_asm.h>
#include <asm/signal.h>
-
-// Must match the defines in linux/sched.h
-#define CLONE_VM 0x00000100
-#define CLONE_VFORK 0x00004000
+#include <linux/sched.h>
ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
@@ -45,6 +42,9 @@
ldr w10, [x9, #20]
str w0, [x9, #20]
+ // Clear vfork_child_stack_bottom_.
+ str xzr, [x9, #776]
+
mov x0, #(CLONE_VM | CLONE_VFORK | SIGCHLD)
mov x1, xzr
mov x2, xzr
@@ -62,9 +62,6 @@
cneg x0, x0, hi
b.hi __set_errno_internal
-#if __has_feature(hwaddress_sanitizer)
- cbz x0, .L_exit
-
// Clean up stack shadow in the parent process.
// https://github.com/google/sanitizers/issues/925
paciasp
@@ -75,7 +72,7 @@
.cfi_rel_offset x30, 8
add x0, sp, #16
- bl __hwasan_handle_vfork
+ bl memtag_handle_vfork
ldp x0, x30, [sp], #16
.cfi_adjust_cfa_offset -16
@@ -84,8 +81,6 @@
autiasp
.cfi_negate_ra_state
-#endif
-
.L_exit:
ret
END(vfork)
diff --git a/libc/arch-arm64/dynamic_function_dispatch.cpp b/libc/arch-arm64/dynamic_function_dispatch.cpp
index 83e5ca4..cd55311 100644
--- a/libc/arch-arm64/dynamic_function_dispatch.cpp
+++ b/libc/arch-arm64/dynamic_function_dispatch.cpp
@@ -41,13 +41,34 @@
}
}
+typedef void* memcmp_func(void*, const void*, size_t);
+DEFINE_IFUNC_FOR(memcmp) {
+ // TODO: enable the SVE version.
+ RETURN_FUNC(memcmp_func, __memcmp_aarch64);
+}
+
+typedef void* memcpy_func(void*, const void*, size_t);
+DEFINE_IFUNC_FOR(memcpy) {
+ if (arg->_hwcap & HWCAP_ASIMD) {
+ RETURN_FUNC(memcpy_func, __memcpy_aarch64_simd);
+ } else {
+ RETURN_FUNC(memcpy_func, __memcpy_aarch64);
+ }
+}
+
+typedef void* memmove_func(void*, const void*, size_t);
+DEFINE_IFUNC_FOR(memmove) {
+ if (arg->_hwcap & HWCAP_ASIMD) {
+ RETURN_FUNC(memmove_func, __memmove_aarch64_simd);
+ } else {
+ RETURN_FUNC(memmove_func, __memmove_aarch64);
+ }
+}
+
typedef int stpcpy_func(char*, const char*);
DEFINE_IFUNC_FOR(stpcpy) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(stpcpy_func, __stpcpy_aarch64_mte);
- } else {
- RETURN_FUNC(stpcpy_func, __stpcpy_aarch64);
- }
+ // TODO: enable the SVE version.
+ RETURN_FUNC(stpcpy_func, __stpcpy_aarch64);
}
typedef char* strchr_func(const char*, int);
@@ -70,20 +91,14 @@
typedef int strcmp_func(const char*, const char*);
DEFINE_IFUNC_FOR(strcmp) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strcmp_func, __strcmp_aarch64_mte);
- } else {
- RETURN_FUNC(strcmp_func, __strcmp_aarch64);
- }
+ // TODO: enable the SVE version.
+ RETURN_FUNC(strcmp_func, __strcmp_aarch64);
}
typedef int strcpy_func(char*, const char*);
DEFINE_IFUNC_FOR(strcpy) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strcpy_func, __strcpy_aarch64_mte);
- } else {
- RETURN_FUNC(strcpy_func, __strcpy_aarch64);
- }
+ // TODO: enable the SVE version.
+ RETURN_FUNC(strcpy_func, __strcpy_aarch64);
}
typedef size_t strlen_func(const char*);
@@ -97,11 +112,14 @@
typedef int strncmp_func(const char*, const char*, int);
DEFINE_IFUNC_FOR(strncmp) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strncmp_func, __strncmp_aarch64_mte);
- } else {
- RETURN_FUNC(strncmp_func, __strncmp_aarch64);
- }
+ // TODO: enable the SVE version.
+ RETURN_FUNC(strncmp_func, __strncmp_aarch64);
+}
+
+typedef size_t strnlen_func(const char*);
+DEFINE_IFUNC_FOR(strnlen) {
+ // TODO: enable the SVE version.
+ RETURN_FUNC(strnlen_func, __strnlen_aarch64);
}
typedef char* strrchr_func(const char*, int);
diff --git a/libc/arch-arm64/generic/bionic/memcpy_base.S b/libc/arch-arm64/generic/bionic/memcpy_base.S
deleted file mode 100644
index f850624..0000000
--- a/libc/arch-arm64/generic/bionic/memcpy_base.S
+++ /dev/null
@@ -1,217 +0,0 @@
-/* Copyright (c) 2012-2013, Linaro Limited
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Linaro nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/*
- * Copyright (c) 2015 ARM Ltd
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the company may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64, unaligned accesses.
- *
- */
-
-#include <private/bionic_asm.h>
-
-#define dstin x0
-#define src x1
-#define count x2
-#define dst x3
-#define srcend x4
-#define dstend x5
-#define A_l x6
-#define A_lw w6
-#define A_h x7
-#define A_hw w7
-#define B_l x8
-#define B_lw w8
-#define B_h x9
-#define C_l x10
-#define C_h x11
-#define D_l x12
-#define D_h x13
-#define E_l src
-#define E_h count
-#define F_l srcend
-#define F_h dst
-#define tmp1 x9
-
-#define L(l) .L ## l
-
-/* Copies are split into 3 main cases: small copies of up to 16 bytes,
- medium copies of 17..96 bytes which are fully unrolled. Large copies
- of more than 96 bytes align the destination and use an unrolled loop
- processing 64 bytes per iteration.
- Small and medium copies read all data before writing, allowing any
- kind of overlap, and memmove tailcalls memcpy for these cases as
- well as non-overlapping copies.
-*/
-
- prfm PLDL1KEEP, [src]
- add srcend, src, count
- add dstend, dstin, count
- cmp count, 16
- b.ls L(copy16)
- cmp count, 96
- b.hi L(copy_long)
-
- /* Medium copies: 17..96 bytes. */
- sub tmp1, count, 1
- ldp A_l, A_h, [src]
- tbnz tmp1, 6, L(copy96)
- ldp D_l, D_h, [srcend, -16]
- tbz tmp1, 5, 1f
- ldp B_l, B_h, [src, 16]
- ldp C_l, C_h, [srcend, -32]
- stp B_l, B_h, [dstin, 16]
- stp C_l, C_h, [dstend, -32]
-1:
- stp A_l, A_h, [dstin]
- stp D_l, D_h, [dstend, -16]
- ret
-
- .p2align 4
-
- /* Small copies: 0..16 bytes. */
-L(copy16):
- cmp count, 8
- b.lo 1f
- ldr A_l, [src]
- ldr A_h, [srcend, -8]
- str A_l, [dstin]
- str A_h, [dstend, -8]
- ret
- .p2align 4
-1:
- tbz count, 2, 1f
- ldr A_lw, [src]
- ldr A_hw, [srcend, -4]
- str A_lw, [dstin]
- str A_hw, [dstend, -4]
- ret
-
- /* Copy 0..3 bytes. Use a branchless sequence that copies the same
- byte 3 times if count==1, or the 2nd byte twice if count==2. */
-1:
- cbz count, 2f
- lsr tmp1, count, 1
- ldrb A_lw, [src]
- ldrb A_hw, [srcend, -1]
- ldrb B_lw, [src, tmp1]
- strb A_lw, [dstin]
- strb B_lw, [dstin, tmp1]
- strb A_hw, [dstend, -1]
-2: ret
-
- .p2align 4
- /* Copy 64..96 bytes. Copy 64 bytes from the start and
- 32 bytes from the end. */
-L(copy96):
- ldp B_l, B_h, [src, 16]
- ldp C_l, C_h, [src, 32]
- ldp D_l, D_h, [src, 48]
- ldp E_l, E_h, [srcend, -32]
- ldp F_l, F_h, [srcend, -16]
- stp A_l, A_h, [dstin]
- stp B_l, B_h, [dstin, 16]
- stp C_l, C_h, [dstin, 32]
- stp D_l, D_h, [dstin, 48]
- stp E_l, E_h, [dstend, -32]
- stp F_l, F_h, [dstend, -16]
- ret
-
- /* Align DST to 16 byte alignment so that we don't cross cache line
- boundaries on both loads and stores. There are at least 96 bytes
- to copy, so copy 16 bytes unaligned and then align. The loop
- copies 64 bytes per iteration and prefetches one iteration ahead. */
-
- .p2align 4
-L(copy_long):
- and tmp1, dstin, 15
- bic dst, dstin, 15
- ldp D_l, D_h, [src]
- sub src, src, tmp1
- add count, count, tmp1 /* Count is now 16 too large. */
- ldp A_l, A_h, [src, 16]
- stp D_l, D_h, [dstin]
- ldp B_l, B_h, [src, 32]
- ldp C_l, C_h, [src, 48]
- ldp D_l, D_h, [src, 64]!
- subs count, count, 128 + 16 /* Test and readjust count. */
- b.ls 2f
-1:
- stp A_l, A_h, [dst, 16]
- ldp A_l, A_h, [src, 16]
- stp B_l, B_h, [dst, 32]
- ldp B_l, B_h, [src, 32]
- stp C_l, C_h, [dst, 48]
- ldp C_l, C_h, [src, 48]
- stp D_l, D_h, [dst, 64]!
- ldp D_l, D_h, [src, 64]!
- subs count, count, 64
- b.hi 1b
-
- /* Write the last full set of 64 bytes. The remainder is at most 64
- bytes, so it is safe to always copy 64 bytes from the end even if
- there is just 1 byte left. */
-2:
- ldp E_l, E_h, [srcend, -64]
- stp A_l, A_h, [dst, 16]
- ldp A_l, A_h, [srcend, -48]
- stp B_l, B_h, [dst, 32]
- ldp B_l, B_h, [srcend, -32]
- stp C_l, C_h, [dst, 48]
- ldp C_l, C_h, [srcend, -16]
- stp D_l, D_h, [dst, 64]
- stp E_l, E_h, [dstend, -64]
- stp A_l, A_h, [dstend, -48]
- stp B_l, B_h, [dstend, -32]
- stp C_l, C_h, [dstend, -16]
- ret
diff --git a/libc/arch-arm64/generic/bionic/memmove.S b/libc/arch-arm64/generic/bionic/memmove.S
deleted file mode 100644
index 0f752ea..0000000
--- a/libc/arch-arm64/generic/bionic/memmove.S
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Copyright (c) 2013, Linaro Limited
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Linaro nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/*
- * Copyright (c) 2015 ARM Ltd
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the company may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64, unaligned accesses, wchar_t is 4 bytes
- */
-
-#include <private/bionic_asm.h>
-
-/* Parameters and result. */
-#define dstin x0
-#define src x1
-#define count x2
-#define srcend x3
-#define dstend x4
-#define tmp1 x5
-#define A_l x6
-#define A_h x7
-#define B_l x8
-#define B_h x9
-#define C_l x10
-#define C_h x11
-#define D_l x12
-#define D_h x13
-#define E_l count
-#define E_h tmp1
-
-/* All memmoves up to 96 bytes are done by memcpy as it supports overlaps.
- Larger backwards copies are also handled by memcpy. The only remaining
- case is forward large copies. The destination is aligned, and an
- unrolled loop processes 64 bytes per iteration.
-*/
-
-#if defined(WMEMMOVE)
-ENTRY(wmemmove)
- lsl count, count, #2
-#else
-ENTRY(memmove)
-#endif
- sub tmp1, dstin, src
- cmp count, 96
- ccmp tmp1, count, 2, hi
- b.hs __memcpy
-
- cbz tmp1, 3f
- add dstend, dstin, count
- add srcend, src, count
-
- /* Align dstend to 16 byte alignment so that we don't cross cache line
- boundaries on both loads and stores. There are at least 96 bytes
- to copy, so copy 16 bytes unaligned and then align. The loop
- copies 64 bytes per iteration and prefetches one iteration ahead. */
-
- and tmp1, dstend, 15
- ldp D_l, D_h, [srcend, -16]
- sub srcend, srcend, tmp1
- sub count, count, tmp1
- ldp A_l, A_h, [srcend, -16]
- stp D_l, D_h, [dstend, -16]
- ldp B_l, B_h, [srcend, -32]
- ldp C_l, C_h, [srcend, -48]
- ldp D_l, D_h, [srcend, -64]!
- sub dstend, dstend, tmp1
- subs count, count, 128
- b.ls 2f
- nop
-1:
- stp A_l, A_h, [dstend, -16]
- ldp A_l, A_h, [srcend, -16]
- stp B_l, B_h, [dstend, -32]
- ldp B_l, B_h, [srcend, -32]
- stp C_l, C_h, [dstend, -48]
- ldp C_l, C_h, [srcend, -48]
- stp D_l, D_h, [dstend, -64]!
- ldp D_l, D_h, [srcend, -64]!
- subs count, count, 64
- b.hi 1b
-
- /* Write the last full set of 64 bytes. The remainder is at most 64
- bytes, so it is safe to always copy 64 bytes from the start even if
- there is just 1 byte left. */
-2:
- ldp E_l, E_h, [src, 48]
- stp A_l, A_h, [dstend, -16]
- ldp A_l, A_h, [src, 32]
- stp B_l, B_h, [dstend, -32]
- ldp B_l, B_h, [src, 16]
- stp C_l, C_h, [dstend, -48]
- ldp C_l, C_h, [src]
- stp D_l, D_h, [dstend, -64]
- stp E_l, E_h, [dstin, 48]
- stp A_l, A_h, [dstin, 32]
- stp B_l, B_h, [dstin, 16]
- stp C_l, C_h, [dstin]
-3: ret
-
-#if defined(WMEMMOVE)
-END(wmemmove)
-#else
-END(memmove)
-
-ALIAS_SYMBOL(memcpy, memmove)
-#endif
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/generic/bionic/memset.S b/libc/arch-arm64/generic/bionic/memset.S
deleted file mode 100644
index 19d3510..0000000
--- a/libc/arch-arm64/generic/bionic/memset.S
+++ /dev/null
@@ -1,253 +0,0 @@
-/* Copyright (c) 2012-2013, Linaro Limited
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Linaro nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/*
- * Copyright (c) 2015 ARM Ltd
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the company may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64, unaligned accesses
- *
- */
-
-#include <private/bionic_asm.h>
-
-/* By default we assume that the DC instruction can be used to zero
- data blocks more efficiently. In some circumstances this might be
- unsafe, for example in an asymmetric multiprocessor environment with
- different DC clear lengths (neither the upper nor lower lengths are
- safe to use).
-
- If code may be run in a virtualized environment, then define
- MAYBE_VIRT. This will cause the code to cache the system register
- values rather than re-reading them each call. */
-
-#define dstin x0
-#define val x1
-#define valw w1
-#define count x2
-#define dst x3
-#define dstend x4
-#define tmp1 x5
-#define tmp1w w5
-#define tmp2 x6
-#define tmp2w w6
-#define zva_len x7
-#define zva_lenw w7
-
-#define L(l) .L ## l
-
-ENTRY(__memset_chk)
- cmp count, dst
- bls memset
-
- // Preserve for accurate backtrace.
- stp x29, x30, [sp, -16]!
- .cfi_def_cfa_offset 16
- .cfi_rel_offset x29, 0
- .cfi_rel_offset x30, 8
-
- bl __memset_chk_fail
-END(__memset_chk)
-
-ENTRY(memset)
-
- dup v0.16B, valw
- add dstend, dstin, count
-
- cmp count, 96
- b.hi L(set_long)
- cmp count, 16
- b.hs L(set_medium)
- mov val, v0.D[0]
-
- /* Set 0..15 bytes. */
- tbz count, 3, 1f
- str val, [dstin]
- str val, [dstend, -8]
- ret
- nop
-1: tbz count, 2, 2f
- str valw, [dstin]
- str valw, [dstend, -4]
- ret
-2: cbz count, 3f
- strb valw, [dstin]
- tbz count, 1, 3f
- strh valw, [dstend, -2]
-3: ret
-
- /* Set 17..96 bytes. */
-L(set_medium):
- str q0, [dstin]
- tbnz count, 6, L(set96)
- str q0, [dstend, -16]
- tbz count, 5, 1f
- str q0, [dstin, 16]
- str q0, [dstend, -32]
-1: ret
-
- .p2align 4
- /* Set 64..96 bytes. Write 64 bytes from the start and
- 32 bytes from the end. */
-L(set96):
- str q0, [dstin, 16]
- stp q0, q0, [dstin, 32]
- stp q0, q0, [dstend, -32]
- ret
-
- .p2align 3
- nop
-L(set_long):
- and valw, valw, 255
- bic dst, dstin, 15
- str q0, [dstin]
- cmp count, 256
- ccmp valw, 0, 0, cs
- b.eq L(try_zva)
-L(no_zva):
- sub count, dstend, dst /* Count is 16 too large. */
- add dst, dst, 16
- sub count, count, 64 + 16 /* Adjust count and bias for loop. */
-1: stp q0, q0, [dst], 64
- stp q0, q0, [dst, -32]
-L(tail64):
- subs count, count, 64
- b.hi 1b
-2: stp q0, q0, [dstend, -64]
- stp q0, q0, [dstend, -32]
- ret
-
- .p2align 3
-L(try_zva):
- mrs tmp1, dczid_el0
- tbnz tmp1w, 4, L(no_zva)
- and tmp1w, tmp1w, 15
- cmp tmp1w, 4 /* ZVA size is 64 bytes. */
- b.ne L(zva_128)
-
- /* Write the first and last 64 byte aligned block using stp rather
- than using DC ZVA. This is faster on some cores.
- */
-L(zva_64):
- str q0, [dst, 16]
- stp q0, q0, [dst, 32]
- bic dst, dst, 63
- stp q0, q0, [dst, 64]
- stp q0, q0, [dst, 96]
- sub count, dstend, dst /* Count is now 128 too large. */
- sub count, count, 128+64+64 /* Adjust count and bias for loop. */
- add dst, dst, 128
- nop
-1: dc zva, dst
- add dst, dst, 64
- subs count, count, 64
- b.hi 1b
- stp q0, q0, [dst, 0]
- stp q0, q0, [dst, 32]
- stp q0, q0, [dstend, -64]
- stp q0, q0, [dstend, -32]
- ret
-
- .p2align 3
-L(zva_128):
- cmp tmp1w, 5 /* ZVA size is 128 bytes. */
- b.ne L(zva_other)
-
- str q0, [dst, 16]
- stp q0, q0, [dst, 32]
- stp q0, q0, [dst, 64]
- stp q0, q0, [dst, 96]
- bic dst, dst, 127
- sub count, dstend, dst /* Count is now 128 too large. */
- sub count, count, 128+128 /* Adjust count and bias for loop. */
- add dst, dst, 128
-1: dc zva, dst
- add dst, dst, 128
- subs count, count, 128
- b.hi 1b
- stp q0, q0, [dstend, -128]
- stp q0, q0, [dstend, -96]
- stp q0, q0, [dstend, -64]
- stp q0, q0, [dstend, -32]
- ret
-
-L(zva_other):
- mov tmp2w, 4
- lsl zva_lenw, tmp2w, tmp1w
- add tmp1, zva_len, 64 /* Max alignment bytes written. */
- cmp count, tmp1
- blo L(no_zva)
-
- sub tmp2, zva_len, 1
- add tmp1, dst, zva_len
- add dst, dst, 16
- subs count, tmp1, dst /* Actual alignment bytes to write. */
- bic tmp1, tmp1, tmp2 /* Aligned dc zva start address. */
- beq 2f
-1: stp q0, q0, [dst], 64
- stp q0, q0, [dst, -32]
- subs count, count, 64
- b.hi 1b
-2: mov dst, tmp1
- sub count, dstend, tmp1 /* Remaining bytes to write. */
- subs count, count, zva_len
- b.lo 4f
-3: dc zva, dst
- add dst, dst, zva_len
- subs count, count, zva_len
- b.hs 3b
-4: add count, count, zva_len
- b L(tail64)
-
-END(memset)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/generic/bionic/wmemmove.S b/libc/arch-arm64/generic/bionic/wmemmove.S
deleted file mode 100644
index b130530..0000000
--- a/libc/arch-arm64/generic/bionic/wmemmove.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Linaro nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#define WMEMMOVE
-#include "memmove.S"
-#undef WMEMMOVE
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/static_function_dispatch.S b/libc/arch-arm64/static_function_dispatch.S
index 161ece8..c7557f8 100644
--- a/libc/arch-arm64/static_function_dispatch.S
+++ b/libc/arch-arm64/static_function_dispatch.S
@@ -34,13 +34,17 @@
END(name)
FUNCTION_DELEGATE(memchr, __memchr_aarch64_mte)
-FUNCTION_DELEGATE(stpcpy, __stpcpy_aarch64_mte)
+FUNCTION_DELEGATE(memcmp, __memcmp_aarch64)
+FUNCTION_DELEGATE(memcpy, __memcpy_aarch64)
+FUNCTION_DELEGATE(memmove, __memmove_aarch64)
+FUNCTION_DELEGATE(stpcpy, __stpcpy_aarch64)
FUNCTION_DELEGATE(strchr, __strchr_aarch64_mte)
FUNCTION_DELEGATE(strchrnul, __strchrnul_aarch64_mte)
-FUNCTION_DELEGATE(strcmp, __strcmp_aarch64_mte)
-FUNCTION_DELEGATE(strcpy, __strcpy_aarch64_mte)
+FUNCTION_DELEGATE(strcmp, __strcmp_aarch64)
+FUNCTION_DELEGATE(strcpy, __strcpy_aarch64)
FUNCTION_DELEGATE(strlen, __strlen_aarch64_mte)
FUNCTION_DELEGATE(strrchr, __strrchr_aarch64_mte)
-FUNCTION_DELEGATE(strncmp, __strncmp_aarch64_mte)
+FUNCTION_DELEGATE(strncmp, __strncmp_aarch64)
+FUNCTION_DELEGATE(strnlen, __strnlen_aarch64)
NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/generic/bionic/__memcpy_chk.S b/libc/arch-arm64/string/__memcpy_chk.S
similarity index 100%
rename from libc/arch-arm64/generic/bionic/__memcpy_chk.S
rename to libc/arch-arm64/string/__memcpy_chk.S
diff --git a/libc/arch-arm64/generic/bionic/memcpy.S b/libc/arch-arm64/string/__memset_chk.S
similarity index 78%
copy from libc/arch-arm64/generic/bionic/memcpy.S
copy to libc/arch-arm64/string/__memset_chk.S
index bc1945c..e1e29d0 100644
--- a/libc/arch-arm64/generic/bionic/memcpy.S
+++ b/libc/arch-arm64/string/__memset_chk.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2017 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,12 +26,22 @@
* SUCH DAMAGE.
*/
-// Prototype: void *memcpy (void *dst, const void *src, size_t count).
-
#include <private/bionic_asm.h>
-ENTRY(__memcpy)
- #include "memcpy_base.S"
-END(__memcpy)
+ENTRY(__memset_chk)
+ cmp x2, x3
+ // Direct b.ls memcpy may not have enough range
+ b.hi .L_memset_chk_fail
+ b memset
+
+.L_memset_chk_fail:
+ // Preserve for accurate backtrace.
+ stp x29, x30, [sp, -16]!
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset x29, 0
+ .cfi_rel_offset x30, 8
+
+ bl __memset_chk_fail
+END(__memset_chk)
NOTE_GNU_PROPERTY()
diff --git a/libc/arch-common/bionic/crtbegin.c b/libc/arch-common/bionic/crtbegin.c
index 9b8ad4e..b87db64 100644
--- a/libc/arch-common/bionic/crtbegin.c
+++ b/libc/arch-common/bionic/crtbegin.c
@@ -56,6 +56,8 @@
__asm__(PRE
"xorl %ebp,%ebp; movl %esp,%eax; andl $~0xf,%esp; subl $12,%esp; pushl %eax;"
"call _start_main" POST);
+#elif defined(__riscv)
+__asm__(PRE "li fp,0; li ra,0; mv a0,sp; tail _start_main" POST);
#elif defined(__x86_64__)
__asm__(PRE "xorl %ebp, %ebp; movq %rsp,%rdi; andq $~0xf,%rsp; callq _start_main" POST);
#else
diff --git a/libc/arch-common/bionic/crtend.S b/libc/arch-common/bionic/crtend.S
index 9676db8..49c729f 100644
--- a/libc/arch-common/bionic/crtend.S
+++ b/libc/arch-common/bionic/crtend.S
@@ -46,11 +46,10 @@
ASM_ALIGN_TO_PTR_SIZE
ASM_PTR_SIZE(0)
-#if defined(__linux__) && defined(__ELF__)
- .section .note.GNU-stack,"",%progbits
-#endif
+ .section .note.GNU-stack, "", %progbits
+
#if !defined(__arm__)
- .section .eh_frame,"a",@progbits
+ .section .eh_frame, "a", @progbits
.balign 4
.type __FRAME_END__, @object
.size __FRAME_END__, 4
diff --git a/libc/arch-common/bionic/crtend_so.S b/libc/arch-common/bionic/crtend_so.S
index 5875acb..bc4bfb6 100644
--- a/libc/arch-common/bionic/crtend_so.S
+++ b/libc/arch-common/bionic/crtend_so.S
@@ -32,11 +32,10 @@
__bionic_asm_custom_note_gnu_section()
#endif
-#if defined(__linux__) && defined(__ELF__)
- .section .note.GNU-stack,"",%progbits
-#endif
+ .section .note.GNU-stack, "", %progbits
+
#if !defined(__arm__)
- .section .eh_frame,"a",@progbits
+ .section .eh_frame, "a", @progbits
.balign 4
.type __FRAME_END__, @object
.size __FRAME_END__, 4
diff --git a/libc/arch-riscv64/bionic/__bionic_clone.S b/libc/arch-riscv64/bionic/__bionic_clone.S
new file mode 100644
index 0000000..2827857
--- /dev/null
+++ b/libc/arch-riscv64/bionic/__bionic_clone.S
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <private/bionic_asm.h>
+
+// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
+
+ENTRY_PRIVATE(__bionic_clone)
+ # Push 'fn' and 'arg' onto the child stack.
+ addi a1, a1, -16
+ sd a5, 0(a1)
+ sd a6, 8(a1)
+
+ # Make the system call.
+ li a7, __NR_clone
+ ecall
+
+ # Are we the child?
+ beqz a0, .L_bc_child
+
+ # Did the clone(2) fail?
+ bltz a0, .L_bc_failure
+ # Nope, we're the parent, and our work here is done.
+ ret
+
+.L_bc_failure:
+ # Set errno if something went wrong.
+ neg a0, a0
+ tail __set_errno_internal
+
+.L_bc_child:
+ # We're in the child now. Set the end of the frame record chain.
+ li fp, 0
+ # Setting ra to 0 will make the unwinder stop at __start_thread.
+ li ra, 0
+ # Call __start_thread with the 'fn' and 'arg' we stored on the child stack.
+ ld a0, 0(sp)
+ ld a1, 8(sp)
+ addi sp, sp, 16
+ tail __start_thread
+END(__bionic_clone)
diff --git a/libc/include/android/legacy_errno_inlines.h b/libc/arch-riscv64/bionic/__set_tls.c
similarity index 84%
rename from libc/include/android/legacy_errno_inlines.h
rename to libc/arch-riscv64/bionic/__set_tls.c
index fcbca13..57383ab 100644
--- a/libc/include/android/legacy_errno_inlines.h
+++ b/libc/arch-riscv64/bionic/__set_tls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,8 @@
* SUCH DAMAGE.
*/
-#pragma once
-
#include <sys/cdefs.h>
-#if __ANDROID_API__ < 21
-
-#include <errno.h>
-
-__BEGIN_DECLS
-
-static __inline int __attribute__((deprecated)) __set_errno(int n) {
- errno = n;
- return -1;
+__LIBC_HIDDEN__ void __set_tls(void* tls) {
+ asm("mv tp, %0" : : "r"(tls));
}
-
-__END_DECLS
-
-#endif
diff --git a/libc/arch-arm64/generic/bionic/memcpy.S b/libc/arch-riscv64/bionic/_exit_with_stack_teardown.S
similarity index 78%
copy from libc/arch-arm64/generic/bionic/memcpy.S
copy to libc/arch-riscv64/bionic/_exit_with_stack_teardown.S
index bc1945c..f7bf58b 100644
--- a/libc/arch-arm64/generic/bionic/memcpy.S
+++ b/libc/arch-riscv64/bionic/_exit_with_stack_teardown.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,12 +26,16 @@
* SUCH DAMAGE.
*/
-// Prototype: void *memcpy (void *dst, const void *src, size_t count).
-
#include <private/bionic_asm.h>
-ENTRY(__memcpy)
- #include "memcpy_base.S"
-END(__memcpy)
+// void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
+ENTRY_PRIVATE(_exit_with_stack_teardown)
+ li a7, __NR_munmap
+ ecall
+ // If munmap failed, we ignore the failure and exit anyway.
-NOTE_GNU_PROPERTY()
+ li a0, 0
+ li a7, __NR_exit
+ ecall
+ // The exit syscall does not return.
+END(_exit_with_stack_teardown)
diff --git a/libc/arch-riscv64/bionic/setjmp.S b/libc/arch-riscv64/bionic/setjmp.S
new file mode 100644
index 0000000..26f7ec9
--- /dev/null
+++ b/libc/arch-riscv64/bionic/setjmp.S
@@ -0,0 +1,304 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <private/bionic_asm.h>
+#include <private/bionic_constants.h>
+
+// The internal structure of a jmp_buf is totally private.
+// Current layout (changes from release to release):
+//
+// word name description
+// 0 sigflag/cookie setjmp cookie in top 31 bits, signal mask flag in low bit
+// 1 sigmask 64-bit signal mask
+// 2 ra
+// 3 sp
+// 4 gp
+// 5 s0
+// ......
+// 16 s11
+// 17 fs0
+// ......
+// 28 fs11
+// 29 checksum
+// _JBLEN: defined in bionic/libc/include/setjmp.h
+
+#define _JB_SIGFLAG 0
+#define _JB_SIGMASK 1 * 8
+#define _JB_RA 2 * 8
+#define _JB_SP 3 * 8
+#define _JB_GP 4 * 8
+#define _JB_S0 5 * 8
+#define _JB_S1 6 * 8
+#define _JB_S2 7 * 8
+#define _JB_S3 8 * 8
+#define _JB_S4 9 * 8
+#define _JB_S5 10 * 8
+#define _JB_S6 11 * 8
+#define _JB_S7 12 * 8
+#define _JB_S8 13 * 8
+#define _JB_S9 14 * 8
+#define _JB_S10 15 * 8
+#define _JB_S11 16 * 8
+#define _JB_FS0 17 * 8
+#define _JB_FS1 18 * 8
+#define _JB_FS2 19 * 8
+#define _JB_FS3 20 * 8
+#define _JB_FS4 21 * 8
+#define _JB_FS5 22 * 8
+#define _JB_FS6 23 * 8
+#define _JB_FS7 24 * 8
+#define _JB_FS8 25 * 8
+#define _JB_FS9 26 * 8
+#define _JB_FS10 27 * 8
+#define _JB_FS11 28 * 8
+#define _JB_CHECKSUM 29 * 8
+
+.macro m_mangle_registers reg, sp_reg
+ xor s0, s0, \reg
+ xor s1, s1, \reg
+ xor s2, s2, \reg
+ xor s3, s3, \reg
+ xor s4, s4, \reg
+ xor s5, s5, \reg
+ xor s6, s6, \reg
+ xor s7, s7, \reg
+ xor s8, s8, \reg
+ xor s9, s9, \reg
+ xor s10, s10, \reg
+ xor s11, s11, \reg
+ xor a4, a4, \reg // a4 is the masked gp (x3) for SCS.
+ xor \sp_reg, \sp_reg, \reg
+.endm
+
+.macro m_calculate_checksum dst, src, scratch
+ li \dst, 0
+ .irp i,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
+ ld \scratch, (\i * 8)(\src)
+ xor \dst, \dst, \scratch
+ .endr
+.endm
+
+.macro m_unmangle_registers reg, sp_reg
+ m_mangle_registers \reg, sp_reg=\sp_reg
+.endm
+
+ENTRY(setjmp)
+__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
+ li a1, 1
+ tail sigsetjmp
+END(setjmp)
+
+ENTRY(_setjmp)
+__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
+ li a1, 0
+ tail sigsetjmp
+END(_setjmp)
+
+// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
+ENTRY(sigsetjmp)
+__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
+ addi sp, sp, -24
+ sd a0, 0(sp)
+ sd a1, 8(sp)
+ sd ra, 16(sp)
+
+ // Get the cookie and store it along with the signal flag.
+ mv a0, a1
+ call __bionic_setjmp_cookie_get
+ mv a1, a0
+ ld a0, 0(sp)
+ sd a1, _JB_SIGFLAG(a0)
+
+ // Do we need to save the signal mask?
+ andi a1, a1, 1
+ beqz a1, 1f
+
+ // Save current signal mask.
+ // The 'how'/a0 argument is ignored if set is NULL.
+ li a1, 0 // NULL
+ addi a2, a0, _JB_SIGMASK // old_mask.
+ call sigprocmask
+
+1:
+ // Restore original a0/ra.
+ ld a0, 0(sp)
+ ld ra, 16(sp)
+ addi sp, sp, 24
+
+ // Get the cookie.
+ ld a1, _JB_SIGFLAG(a0)
+ andi a1, a1, -2
+
+ // Mask off the high bits of the shadow call stack pointer.
+ // We only store the low bits of gp to avoid leaking the
+ // shadow call stack address into memory.
+ // See the SCS commentary in pthread_internal.h for more detail.
+ li a4, SCS_MASK
+ and a4, a4, gp
+
+ // Save core registers.
+ mv a2, sp
+ m_mangle_registers a1, sp_reg=a2
+ sd ra, _JB_RA(a0)
+ sd a4, _JB_GP(a0) // a4 is the masked gp (x3) for SCS.
+ sd a2, _JB_SP(a0)
+ sd s0, _JB_S0(a0)
+ sd s1, _JB_S1(a0)
+ sd s2, _JB_S2(a0)
+ sd s3, _JB_S3(a0)
+ sd s4, _JB_S4(a0)
+ sd s5, _JB_S5(a0)
+ sd s6, _JB_S6(a0)
+ sd s7, _JB_S7(a0)
+ sd s8, _JB_S8(a0)
+ sd s9, _JB_S9(a0)
+ sd s10, _JB_S10(a0)
+ sd s11, _JB_S11(a0)
+ m_unmangle_registers a1, sp_reg=a2
+
+ // Save floating point registers.
+ fsd fs0, _JB_FS0(a0)
+ fsd fs1, _JB_FS1(a0)
+ fsd fs2, _JB_FS2(a0)
+ fsd fs3, _JB_FS3(a0)
+ fsd fs4, _JB_FS4(a0)
+ fsd fs5, _JB_FS5(a0)
+ fsd fs6, _JB_FS6(a0)
+ fsd fs7, _JB_FS7(a0)
+ fsd fs8, _JB_FS8(a0)
+ fsd fs9, _JB_FS9(a0)
+ fsd fs10, _JB_FS10(a0)
+ fsd fs11, _JB_FS11(a0)
+
+ // Calculate the checksum and save it.
+ m_calculate_checksum t0, a0, t1
+ sd t0, _JB_CHECKSUM(a0)
+
+ li a0, 0
+ ret
+END(sigsetjmp)
+
+// void siglongjmp(sigjmp_buf env, int value);
+ENTRY(siglongjmp)
+__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
+ // Check the checksum before doing anything.
+ m_calculate_checksum t0, a0, t1
+ ld t1, _JB_CHECKSUM(a0)
+ bne t0, t1, 3f
+
+ // Do we need to restore the signal mask?
+ ld a2, _JB_SIGFLAG(a0)
+ andi a3, a2, 1
+ beqz a3, 1f
+
+ addi sp, sp, -16
+ sd a0, 0(sp)
+ sd ra, 8(sp)
+
+ // Restore the signal mask.
+ mv t0, a1 // Save 'value'.
+
+ mv a2, a0
+ li a0, 2 // SIG_SETMASK
+ addi a1, a2, _JB_SIGMASK // new_mask
+ li a2, 0 // NULL
+ call sigprocmask
+ mv a1, t0 // Restore 'value'.
+
+ // Restore original a0 and ra.
+ ld a0, 0(sp)
+ ld ra, 8(sp)
+ addi sp, sp, 16
+
+ ld a2, _JB_SIGFLAG(a0)
+1:
+ // Restore core registers.
+ andi a2, a2, -2
+ ld ra, _JB_RA(a0)
+ ld a4, _JB_GP(a0) // Don't clobber the upper bits of gp (x3) used for SCS yet.
+ ld s0, _JB_S0(a0)
+ ld s1, _JB_S1(a0)
+ ld s2, _JB_S2(a0)
+ ld s3, _JB_S3(a0)
+ ld s4, _JB_S4(a0)
+ ld s5, _JB_S5(a0)
+ ld s6, _JB_S6(a0)
+ ld s7, _JB_S7(a0)
+ ld s8, _JB_S8(a0)
+ ld s9, _JB_S9(a0)
+ ld s10, _JB_S10(a0)
+ ld s11, _JB_S11(a0)
+ ld a3, _JB_SP(a0)
+ m_unmangle_registers a2, sp_reg=a3
+ mv sp, a3
+
+ // Restore the low bits of the shadow call stack pointer.
+ li a5, ~SCS_MASK
+ and gp, gp, a5
+ or gp, gp, a4
+
+ addi sp, sp, -24
+ sd ra, 0(sp)
+ sd a0, 8(sp)
+ sd a1, 16(sp)
+ ld a0, _JB_SIGFLAG(a0)
+ call __bionic_setjmp_cookie_check
+ ld ra, 0(sp)
+ ld a0, 8(sp)
+ ld a1, 16(sp)
+ addi sp, sp, 24
+
+ // Restore floating point registers.
+ fld fs0, _JB_FS0(a0)
+ fld fs1, _JB_FS1(a0)
+ fld fs2, _JB_FS2(a0)
+ fld fs3, _JB_FS3(a0)
+ fld fs4, _JB_FS4(a0)
+ fld fs5, _JB_FS5(a0)
+ fld fs6, _JB_FS6(a0)
+ fld fs7, _JB_FS7(a0)
+ fld fs8, _JB_FS8(a0)
+ fld fs9, _JB_FS9(a0)
+ fld fs10, _JB_FS10(a0)
+ fld fs11, _JB_FS11(a0)
+
+ // Set return value.
+ beqz a1, 2f
+ li a0, 1
+2:
+ mv a0, a1
+ ret
+
+3:
+ call __bionic_setjmp_checksum_mismatch
+END(siglongjmp)
+
+ALIAS_SYMBOL(longjmp, siglongjmp)
+__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
+ALIAS_SYMBOL(_longjmp, siglongjmp)
+__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
diff --git a/libc/arch-arm64/generic/bionic/memcpy.S b/libc/arch-riscv64/bionic/syscall.S
similarity index 79%
copy from libc/arch-arm64/generic/bionic/memcpy.S
copy to libc/arch-riscv64/bionic/syscall.S
index bc1945c..1a6e60a 100644
--- a/libc/arch-arm64/generic/bionic/memcpy.S
+++ b/libc/arch-riscv64/bionic/syscall.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,12 +26,28 @@
* SUCH DAMAGE.
*/
-// Prototype: void *memcpy (void *dst, const void *src, size_t count).
-
#include <private/bionic_asm.h>
-ENTRY(__memcpy)
- #include "memcpy_base.S"
-END(__memcpy)
+ENTRY(syscall)
+ // Move the syscall number up.
+ mv a7, a0
-NOTE_GNU_PROPERTY()
+ // Shuffle the arguments down.
+ mv a0, a1
+ mv a1, a2
+ mv a2, a3
+ mv a3, a4
+ mv a4, a5
+ mv a5, a6
+
+ ecall
+
+ // Did it fail?
+ li a7, -MAX_ERRNO
+ bgtu a0, a7, 1f
+
+ ret
+1:
+ neg a0, a0
+ tail __set_errno_internal
+END(syscall)
diff --git a/libc/arch-riscv64/bionic/vfork.S b/libc/arch-riscv64/bionic/vfork.S
new file mode 100644
index 0000000..29ab405
--- /dev/null
+++ b/libc/arch-riscv64/bionic/vfork.S
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <platform/bionic/tls_defines.h>
+#include <private/bionic_asm.h>
+#include <asm/signal.h>
+#include <linux/sched.h>
+
+ENTRY(vfork)
+ // t0 = __get_tls()[TLS_SLOT_THREAD_ID]
+ mv t0, tp
+ ld t0, TLS_SLOT_THREAD_ID * 8(t0)
+
+ // Set cached_pid_ to 0, vforked_ to 1, and stash the previous value.
+ li t1, 0x80000000
+ lw t2, 20(t0)
+ sw t1, 20(t0)
+
+ li a0, (CLONE_VM | CLONE_VFORK | SIGCHLD)
+ li a1, 0 //uses a duplicate of the parent's stack
+ li a2, 0
+ li a3, 0
+ li a4, 0
+
+ li a7, __NR_clone
+ ecall
+
+ // if (rc == 0) we're the child, and finished...
+ beqz a0, .L_success
+
+ // else if (rc != 0): reset cached_pid_ and vforked_...
+ sw t2, 20(t0)
+ // ...and work out whether we succeeded or failed.
+ bltz a0, .L_failure
+.L_success:
+ ret
+
+.L_failure:
+ neg a0, a0
+ tail __set_errno_internal
+END(vfork)
diff --git a/libc/arch-riscv64/string/__memcpy_chk.S b/libc/arch-riscv64/string/__memcpy_chk.S
new file mode 100644
index 0000000..4a2d13d
--- /dev/null
+++ b/libc/arch-riscv64/string/__memcpy_chk.S
@@ -0,0 +1,9 @@
+#include <private/bionic_asm.h>
+
+ENTRY(__memcpy_chk)
+ bleu a2, a3, 1f
+ call __memcpy_chk_fail
+
+1:
+ tail memcpy
+END(__memcpy_chk)
diff --git a/libc/arch-riscv64/string/__memset_chk.S b/libc/arch-riscv64/string/__memset_chk.S
new file mode 100644
index 0000000..a5562cb
--- /dev/null
+++ b/libc/arch-riscv64/string/__memset_chk.S
@@ -0,0 +1,10 @@
+#include <private/bionic_asm.h>
+
+ENTRY(__memset_chk)
+ bleu a2, a3, 1f
+ call __memset_chk_fail
+
+1:
+ tail memset
+END(__memset_chk)
+
diff --git a/libc/arch-x86/atom/string/cache.h b/libc/arch-x86/atom/string/cache.h
deleted file mode 100644
index 823bb1e..0000000
--- a/libc/arch-x86/atom/string/cache.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2010, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Values are optimized for Atom */
-#define SHARED_CACHE_SIZE (512*1024) /* Atom L2 Cache */
-#define DATA_CACHE_SIZE (24*1024) /* Atom L1 Data Cache */
-
-#define SHARED_CACHE_SIZE_HALF (SHARED_CACHE_SIZE / 2)
-#define DATA_CACHE_SIZE_HALF (DATA_CACHE_SIZE / 2)
diff --git a/libc/arch-x86/dynamic_function_dispatch.cpp b/libc/arch-x86/dynamic_function_dispatch.cpp
index e94fa1f..38d8a0a 100644
--- a/libc/arch-x86/dynamic_function_dispatch.cpp
+++ b/libc/arch-x86/dynamic_function_dispatch.cpp
@@ -95,13 +95,6 @@
RETURN_FUNC(wmemcmp_func, wmemcmp_freebsd);
}
-typedef int wmemset_func(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
-DEFINE_IFUNC_FOR(wmemset) {
- __builtin_cpu_init();
- if (__builtin_cpu_supports("avx2")) RETURN_FUNC(wmemset_func, wmemset_avx2);
- RETURN_FUNC(wmemset_func, wmemset_freebsd);
-}
-
typedef int strcmp_func(const char* __lhs, const char* __rhs);
DEFINE_IFUNC_FOR(strcmp) {
__builtin_cpu_init();
diff --git a/libc/arch-x86/generic/string/wmemset.c b/libc/arch-x86/generic/string/wmemset.c
deleted file mode 100644
index 35d489f..0000000
--- a/libc/arch-x86/generic/string/wmemset.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-#define wmemset wmemset_freebsd
-
-#include <upstream-freebsd/lib/libc/string/wmemset.c>
diff --git a/libc/arch-x86/kabylake/string/avx2-wmemset-kbl.S b/libc/arch-x86/kabylake/string/avx2-wmemset-kbl.S
deleted file mode 100644
index 69b66c7..0000000
--- a/libc/arch-x86/kabylake/string/avx2-wmemset-kbl.S
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-Copyright (C) 2019 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-#ifndef WMEMSET
- #define WMEMSET wmemset_avx2
-#endif
-
-ENTRY(WMEMSET)
-# BB#0:
- pushl %ebp
- pushl %ebx
- pushl %edi
- pushl %esi
- pushl %eax
- movl 32(%esp), %ecx
- movl 24(%esp), %eax
- testl %ecx, %ecx
- je .LBB0_12
-# BB#1:
- movl 28(%esp), %edx
- xorl %edi, %edi
- movl %eax, %esi
- cmpl $32, %ecx
- jb .LBB0_10
-# BB#2:
- movl %ecx, %eax
- andl $-32, %eax
- vmovd %edx, %xmm0
- vpbroadcastd %xmm0, %ymm0
- movl %eax, (%esp) # 4-byte Spill
- leal -32(%eax), %esi
- movl %esi, %eax
- shrl $5, %eax
- leal 1(%eax), %edi
- andl $7, %edi
- xorl %ebx, %ebx
- cmpl $224, %esi
- jb .LBB0_5
-# BB#3:
- movl 24(%esp), %esi
- leal 992(%esi), %ebp
- leal -1(%edi), %esi
- subl %eax, %esi
- xorl %ebx, %ebx
- .p2align 4, 0x90
-.LBB0_4: # =>This Inner Loop Header: Depth=1
- vmovdqu %ymm0, -992(%ebp,%ebx,4)
- vmovdqu %ymm0, -960(%ebp,%ebx,4)
- vmovdqu %ymm0, -928(%ebp,%ebx,4)
- vmovdqu %ymm0, -896(%ebp,%ebx,4)
- vmovdqu %ymm0, -864(%ebp,%ebx,4)
- vmovdqu %ymm0, -832(%ebp,%ebx,4)
- vmovdqu %ymm0, -800(%ebp,%ebx,4)
- vmovdqu %ymm0, -768(%ebp,%ebx,4)
- vmovdqu %ymm0, -736(%ebp,%ebx,4)
- vmovdqu %ymm0, -704(%ebp,%ebx,4)
- vmovdqu %ymm0, -672(%ebp,%ebx,4)
- vmovdqu %ymm0, -640(%ebp,%ebx,4)
- vmovdqu %ymm0, -608(%ebp,%ebx,4)
- vmovdqu %ymm0, -576(%ebp,%ebx,4)
- vmovdqu %ymm0, -544(%ebp,%ebx,4)
- vmovdqu %ymm0, -512(%ebp,%ebx,4)
- vmovdqu %ymm0, -480(%ebp,%ebx,4)
- vmovdqu %ymm0, -448(%ebp,%ebx,4)
- vmovdqu %ymm0, -416(%ebp,%ebx,4)
- vmovdqu %ymm0, -384(%ebp,%ebx,4)
- vmovdqu %ymm0, -352(%ebp,%ebx,4)
- vmovdqu %ymm0, -320(%ebp,%ebx,4)
- vmovdqu %ymm0, -288(%ebp,%ebx,4)
- vmovdqu %ymm0, -256(%ebp,%ebx,4)
- vmovdqu %ymm0, -224(%ebp,%ebx,4)
- vmovdqu %ymm0, -192(%ebp,%ebx,4)
- vmovdqu %ymm0, -160(%ebp,%ebx,4)
- vmovdqu %ymm0, -128(%ebp,%ebx,4)
- vmovdqu %ymm0, -96(%ebp,%ebx,4)
- vmovdqu %ymm0, -64(%ebp,%ebx,4)
- vmovdqu %ymm0, -32(%ebp,%ebx,4)
- vmovdqu %ymm0, (%ebp,%ebx,4)
- addl $256, %ebx # imm = 0x100
- addl $8, %esi
- jne .LBB0_4
-.LBB0_5:
- testl %edi, %edi
- movl 24(%esp), %eax
- je .LBB0_8
-# BB#6:
- leal (%eax,%ebx,4), %esi
- addl $96, %esi
- negl %edi
- .p2align 4, 0x90
-.LBB0_7: # =>This Inner Loop Header: Depth=1
- vmovdqu %ymm0, -96(%esi)
- vmovdqu %ymm0, -64(%esi)
- vmovdqu %ymm0, -32(%esi)
- vmovdqu %ymm0, (%esi)
- subl $-128, %esi
- addl $1, %edi
- jne .LBB0_7
-.LBB0_8:
- movl (%esp), %edi # 4-byte Reload
- cmpl %ecx, %edi
- je .LBB0_12
-# BB#9:
- leal (%eax,%edi,4), %esi
-.LBB0_10:
- subl %edi, %ecx
- .p2align 4, 0x90
-.LBB0_11: # =>This Inner Loop Header: Depth=1
- movl %edx, (%esi)
- addl $4, %esi
- addl $-1, %ecx
- jne .LBB0_11
-.LBB0_12:
- addl $4, %esp
- popl %esi
- popl %edi
- popl %ebx
- popl %ebp
- vzeroupper
- retl
-END(WMEMSET)
diff --git a/libc/arch-x86/static_function_dispatch.S b/libc/arch-x86/static_function_dispatch.S
index 1560c04..7e8e63d 100644
--- a/libc/arch-x86/static_function_dispatch.S
+++ b/libc/arch-x86/static_function_dispatch.S
@@ -45,7 +45,6 @@
FUNCTION_DELEGATE(strncmp, strncmp_generic)
FUNCTION_DELEGATE(strcat, strcat_generic)
FUNCTION_DELEGATE(wmemcmp, wmemcmp_freebsd)
-FUNCTION_DELEGATE(wmemset, wmemset_freebsd)
FUNCTION_DELEGATE(wcscat, wcscat_freebsd)
FUNCTION_DELEGATE(strncat, strncat_openbsd)
FUNCTION_DELEGATE(strlcat, strlcat_openbsd)
diff --git a/libc/arch-x86/silvermont/string/cache.h b/libc/arch-x86/string/cache.h
similarity index 80%
rename from libc/arch-x86/silvermont/string/cache.h
rename to libc/arch-x86/string/cache.h
index c342b1c..33719a0 100644
--- a/libc/arch-x86/silvermont/string/cache.h
+++ b/libc/arch-x86/string/cache.h
@@ -28,9 +28,14 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* Values are optimized for Silvermont */
-#define SHARED_CACHE_SIZE (1024*1024) /* Silvermont L2 Cache */
-#define DATA_CACHE_SIZE (24*1024) /* Silvermont L1 Data Cache */
+#ifdef FOR_ATOM
+#define SHARED_CACHE_SIZE (512 * 1024) /* Atom L2 Cache */
+#endif
+#ifdef FOR_SILVERMONT
+#define SHARED_CACHE_SIZE (1024 * 1024) /* Silvermont L2 Cache */
+#endif
-#define SHARED_CACHE_SIZE_HALF (SHARED_CACHE_SIZE / 2)
-#define DATA_CACHE_SIZE_HALF (DATA_CACHE_SIZE / 2)
+#define DATA_CACHE_SIZE (24 * 1024) /* Atom and Silvermont L1 Data Cache */
+
+#define SHARED_CACHE_SIZE_HALF (SHARED_CACHE_SIZE / 2)
+#define DATA_CACHE_SIZE_HALF (DATA_CACHE_SIZE / 2)
diff --git a/libc/arch-x86/atom/string/sse2-memchr-atom.S b/libc/arch-x86/string/sse2-memchr-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-memchr-atom.S
rename to libc/arch-x86/string/sse2-memchr-atom.S
diff --git a/libc/arch-x86/silvermont/string/sse2-memmove-slm.S b/libc/arch-x86/string/sse2-memmove-slm.S
similarity index 99%
rename from libc/arch-x86/silvermont/string/sse2-memmove-slm.S
rename to libc/arch-x86/string/sse2-memmove-slm.S
index da6456c..79b5d1b 100644
--- a/libc/arch-x86/silvermont/string/sse2-memmove-slm.S
+++ b/libc/arch-x86/string/sse2-memmove-slm.S
@@ -28,6 +28,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define FOR_SILVERMONT
#include "cache.h"
#ifndef MEMMOVE
diff --git a/libc/arch-x86/atom/string/sse2-memrchr-atom.S b/libc/arch-x86/string/sse2-memrchr-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-memrchr-atom.S
rename to libc/arch-x86/string/sse2-memrchr-atom.S
diff --git a/libc/arch-x86/atom/string/sse2-memset-atom.S b/libc/arch-x86/string/sse2-memset-atom.S
similarity index 99%
rename from libc/arch-x86/atom/string/sse2-memset-atom.S
rename to libc/arch-x86/string/sse2-memset-atom.S
index e4cd038..320afec 100644
--- a/libc/arch-x86/atom/string/sse2-memset-atom.S
+++ b/libc/arch-x86/string/sse2-memset-atom.S
@@ -30,6 +30,7 @@
#include <private/bionic_asm.h>
+#define FOR_ATOM
#include "cache.h"
#ifndef L
diff --git a/libc/arch-x86/silvermont/string/sse2-memset-slm.S b/libc/arch-x86/string/sse2-memset-slm.S
similarity index 99%
rename from libc/arch-x86/silvermont/string/sse2-memset-slm.S
rename to libc/arch-x86/string/sse2-memset-slm.S
index b7633f5..5cff141 100644
--- a/libc/arch-x86/silvermont/string/sse2-memset-slm.S
+++ b/libc/arch-x86/string/sse2-memset-slm.S
@@ -30,6 +30,7 @@
#include <private/bionic_asm.h>
+#define FOR_SILVERMONT
#include "cache.h"
#ifndef L
diff --git a/libc/arch-x86/silvermont/string/sse2-stpcpy-slm.S b/libc/arch-x86/string/sse2-stpcpy-slm.S
similarity index 100%
rename from libc/arch-x86/silvermont/string/sse2-stpcpy-slm.S
rename to libc/arch-x86/string/sse2-stpcpy-slm.S
diff --git a/libc/arch-x86/silvermont/string/sse2-stpncpy-slm.S b/libc/arch-x86/string/sse2-stpncpy-slm.S
similarity index 100%
rename from libc/arch-x86/silvermont/string/sse2-stpncpy-slm.S
rename to libc/arch-x86/string/sse2-stpncpy-slm.S
diff --git a/libc/arch-x86/atom/string/sse2-strchr-atom.S b/libc/arch-x86/string/sse2-strchr-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-strchr-atom.S
rename to libc/arch-x86/string/sse2-strchr-atom.S
diff --git a/libc/arch-x86/silvermont/string/sse2-strcpy-slm.S b/libc/arch-x86/string/sse2-strcpy-slm.S
similarity index 100%
rename from libc/arch-x86/silvermont/string/sse2-strcpy-slm.S
rename to libc/arch-x86/string/sse2-strcpy-slm.S
diff --git a/libc/arch-x86/atom/string/sse2-strlen-atom.S b/libc/arch-x86/string/sse2-strlen-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-strlen-atom.S
rename to libc/arch-x86/string/sse2-strlen-atom.S
diff --git a/libc/arch-x86/silvermont/string/sse2-strlen-slm.S b/libc/arch-x86/string/sse2-strlen-slm.S
similarity index 100%
rename from libc/arch-x86/silvermont/string/sse2-strlen-slm.S
rename to libc/arch-x86/string/sse2-strlen-slm.S
diff --git a/libc/arch-x86/silvermont/string/sse2-strncpy-slm.S b/libc/arch-x86/string/sse2-strncpy-slm.S
similarity index 100%
rename from libc/arch-x86/silvermont/string/sse2-strncpy-slm.S
rename to libc/arch-x86/string/sse2-strncpy-slm.S
diff --git a/libc/arch-x86/atom/string/sse2-strnlen-atom.S b/libc/arch-x86/string/sse2-strnlen-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-strnlen-atom.S
rename to libc/arch-x86/string/sse2-strnlen-atom.S
diff --git a/libc/arch-x86/atom/string/sse2-strrchr-atom.S b/libc/arch-x86/string/sse2-strrchr-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-strrchr-atom.S
rename to libc/arch-x86/string/sse2-strrchr-atom.S
diff --git a/libc/arch-x86/atom/string/sse2-wcschr-atom.S b/libc/arch-x86/string/sse2-wcschr-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-wcschr-atom.S
rename to libc/arch-x86/string/sse2-wcschr-atom.S
diff --git a/libc/arch-x86/atom/string/sse2-wcscmp-atom.S b/libc/arch-x86/string/sse2-wcscmp-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-wcscmp-atom.S
rename to libc/arch-x86/string/sse2-wcscmp-atom.S
diff --git a/libc/arch-x86/atom/string/sse2-wcslen-atom.S b/libc/arch-x86/string/sse2-wcslen-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-wcslen-atom.S
rename to libc/arch-x86/string/sse2-wcslen-atom.S
diff --git a/libc/arch-x86/atom/string/sse2-wcsrchr-atom.S b/libc/arch-x86/string/sse2-wcsrchr-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/sse2-wcsrchr-atom.S
rename to libc/arch-x86/string/sse2-wcsrchr-atom.S
diff --git a/libc/arch-x86/silvermont/string/sse4-memcmp-slm.S b/libc/arch-x86/string/sse4-memcmp-slm.S
similarity index 100%
rename from libc/arch-x86/silvermont/string/sse4-memcmp-slm.S
rename to libc/arch-x86/string/sse4-memcmp-slm.S
diff --git a/libc/arch-x86/silvermont/string/sse4-wmemcmp-slm.S b/libc/arch-x86/string/sse4-wmemcmp-slm.S
similarity index 100%
rename from libc/arch-x86/silvermont/string/sse4-wmemcmp-slm.S
rename to libc/arch-x86/string/sse4-wmemcmp-slm.S
diff --git a/libc/arch-x86/atom/string/ssse3-memcmp-atom.S b/libc/arch-x86/string/ssse3-memcmp-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-memcmp-atom.S
rename to libc/arch-x86/string/ssse3-memcmp-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-memcpy-atom.S b/libc/arch-x86/string/ssse3-memcpy-atom.S
similarity index 99%
rename from libc/arch-x86/atom/string/ssse3-memcpy-atom.S
rename to libc/arch-x86/string/ssse3-memcpy-atom.S
index 5532e2e..fe3082e 100644
--- a/libc/arch-x86/atom/string/ssse3-memcpy-atom.S
+++ b/libc/arch-x86/string/ssse3-memcpy-atom.S
@@ -28,6 +28,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define FOR_ATOM
#include "cache.h"
#ifndef MEMCPY
diff --git a/libc/arch-x86/atom/string/ssse3-memmove-atom.S b/libc/arch-x86/string/ssse3-memmove-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-memmove-atom.S
rename to libc/arch-x86/string/ssse3-memmove-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-strcat-atom.S b/libc/arch-x86/string/ssse3-strcat-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-strcat-atom.S
rename to libc/arch-x86/string/ssse3-strcat-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-strcmp-atom.S b/libc/arch-x86/string/ssse3-strcmp-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-strcmp-atom.S
rename to libc/arch-x86/string/ssse3-strcmp-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-strcpy-atom.S b/libc/arch-x86/string/ssse3-strcpy-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-strcpy-atom.S
rename to libc/arch-x86/string/ssse3-strcpy-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-strlcat-atom.S b/libc/arch-x86/string/ssse3-strlcat-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-strlcat-atom.S
rename to libc/arch-x86/string/ssse3-strlcat-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-strlcpy-atom.S b/libc/arch-x86/string/ssse3-strlcpy-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-strlcpy-atom.S
rename to libc/arch-x86/string/ssse3-strlcpy-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-strncat-atom.S b/libc/arch-x86/string/ssse3-strncat-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-strncat-atom.S
rename to libc/arch-x86/string/ssse3-strncat-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-strncmp-atom.S b/libc/arch-x86/string/ssse3-strncmp-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-strncmp-atom.S
rename to libc/arch-x86/string/ssse3-strncmp-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-strncpy-atom.S b/libc/arch-x86/string/ssse3-strncpy-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-strncpy-atom.S
rename to libc/arch-x86/string/ssse3-strncpy-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-wcscat-atom.S b/libc/arch-x86/string/ssse3-wcscat-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-wcscat-atom.S
rename to libc/arch-x86/string/ssse3-wcscat-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-wcscpy-atom.S b/libc/arch-x86/string/ssse3-wcscpy-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-wcscpy-atom.S
rename to libc/arch-x86/string/ssse3-wcscpy-atom.S
diff --git a/libc/arch-x86/atom/string/ssse3-wmemcmp-atom.S b/libc/arch-x86/string/ssse3-wmemcmp-atom.S
similarity index 100%
rename from libc/arch-x86/atom/string/ssse3-wmemcmp-atom.S
rename to libc/arch-x86/string/ssse3-wmemcmp-atom.S
diff --git a/libc/include/android/legacy_sys_stat_inlines.h b/libc/arch-x86_64/dynamic_function_dispatch.cpp
similarity index 67%
copy from libc/include/android/legacy_sys_stat_inlines.h
copy to libc/arch-x86_64/dynamic_function_dispatch.cpp
index d42ac01..c846ded 100644
--- a/libc/include/android/legacy_sys_stat_inlines.h
+++ b/libc/arch-x86_64/dynamic_function_dispatch.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,20 +26,24 @@
* SUCH DAMAGE.
*/
-#pragma once
+#include <stddef.h>
-#include <sys/cdefs.h>
+#include <private/bionic_ifuncs.h>
-#if __ANDROID_API__ < 21
+extern "C" {
-#include <sys/stat.h>
-
-__BEGIN_DECLS
-
-static __inline int mkfifo(const char* __path, mode_t __mode) {
- return mknod(__path, (__mode & ~S_IFMT) | S_IFIFO, (dev_t)0);
+typedef int memset_func(void* __dst, int __ch, size_t __n);
+DEFINE_IFUNC_FOR(memset) {
+ __builtin_cpu_init();
+ if (__builtin_cpu_supports("avx2")) RETURN_FUNC(memset_func, memset_avx2);
+ RETURN_FUNC(memset_func, memset_generic);
}
-__END_DECLS
+typedef void* __memset_chk_func(void* s, int c, size_t n, size_t n2);
+DEFINE_IFUNC_FOR(__memset_chk) {
+ __builtin_cpu_init();
+ if (__builtin_cpu_supports("avx2")) RETURN_FUNC(__memset_chk_func, __memset_chk_avx2);
+ RETURN_FUNC(__memset_chk_func, __memset_chk_generic);
+}
-#endif
+} // extern "C"
diff --git a/libc/arch-arm64/generic/bionic/memcpy.S b/libc/arch-x86_64/static_function_dispatch.S
similarity index 84%
copy from libc/arch-arm64/generic/bionic/memcpy.S
copy to libc/arch-x86_64/static_function_dispatch.S
index bc1945c..93ff5f2 100644
--- a/libc/arch-arm64/generic/bionic/memcpy.S
+++ b/libc/arch-x86_64/static_function_dispatch.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,12 +26,12 @@
* SUCH DAMAGE.
*/
-// Prototype: void *memcpy (void *dst, const void *src, size_t count).
-
#include <private/bionic_asm.h>
-ENTRY(__memcpy)
- #include "memcpy_base.S"
-END(__memcpy)
+#define FUNCTION_DELEGATE(name, impl) \
+ENTRY(name); \
+ jmp impl; \
+END(name)
-NOTE_GNU_PROPERTY()
+FUNCTION_DELEGATE(memset, memset_generic)
+FUNCTION_DELEGATE(__memset_chk, __memset_chk_generic)
diff --git a/libc/arch-x86_64/string/avx2-memset-kbl.S b/libc/arch-x86_64/string/avx2-memset-kbl.S
new file mode 100644
index 0000000..09dd07d
--- /dev/null
+++ b/libc/arch-x86_64/string/avx2-memset-kbl.S
@@ -0,0 +1,160 @@
+/*
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+
+ * Neither the name of Intel Corporation nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <private/bionic_asm.h>
+
+#include "cache.h"
+
+#ifndef L
+# define L(label) .L##label
+#endif
+
+#ifndef ALIGN
+# define ALIGN(n) .p2align n
+#endif
+
+ .section .text.avx2,"ax",@progbits
+
+ENTRY(__memset_chk_avx2)
+ # %rdi = dst, %rsi = byte, %rdx = n, %rcx = dst_len
+ cmp %rcx, %rdx
+ ja __memset_chk_fail
+ // Fall through to memset...
+END(__memset_chk_avx2)
+
+ENTRY(memset_avx2)
+ movq %rdi, %rax
+ and $0xff, %rsi
+ mov $0x0101010101010101, %rcx
+ imul %rsi, %rcx
+ cmpq $16, %rdx
+ jae L(16bytesormore)
+ testb $8, %dl
+ jnz L(8_15bytes)
+ testb $4, %dl
+ jnz L(4_7bytes)
+ testb $2, %dl
+ jnz L(2_3bytes)
+ testb $1, %dl
+ jz L(return)
+ movb %cl, (%rdi)
+L(return):
+ ret
+
+L(8_15bytes):
+ movq %rcx, (%rdi)
+ movq %rcx, -8(%rdi, %rdx)
+ ret
+
+L(4_7bytes):
+ movl %ecx, (%rdi)
+ movl %ecx, -4(%rdi, %rdx)
+ ret
+
+L(2_3bytes):
+ movw %cx, (%rdi)
+ movw %cx, -2(%rdi, %rdx)
+ ret
+
+ ALIGN (4)
+L(16bytesormore):
+ movd %rcx, %xmm0
+ pshufd $0, %xmm0, %xmm0
+ movdqu %xmm0, (%rdi)
+ movdqu %xmm0, -16(%rdi, %rdx)
+ cmpq $32, %rdx
+ jbe L(32bytesless)
+ movdqu %xmm0, 16(%rdi)
+ movdqu %xmm0, -32(%rdi, %rdx)
+ cmpq $64, %rdx
+ jbe L(64bytesless)
+ movdqu %xmm0, 32(%rdi)
+ movdqu %xmm0, 48(%rdi)
+ movdqu %xmm0, -64(%rdi, %rdx)
+ movdqu %xmm0, -48(%rdi, %rdx)
+ cmpq $128, %rdx
+ jbe L(128bytesless)
+ vpbroadcastb %xmm0, %ymm0
+ vmovdqu %ymm0, 64(%rdi)
+ vmovdqu %ymm0, 96(%rdi)
+ vmovdqu %ymm0, -128(%rdi, %rdx)
+ vmovdqu %ymm0, -96(%rdi, %rdx)
+ cmpq $256, %rdx
+ ja L(256bytesmore)
+L(32bytesless):
+L(64bytesless):
+L(128bytesless):
+ ret
+
+ ALIGN (4)
+L(256bytesmore):
+ leaq 128(%rdi), %rcx
+ andq $-128, %rcx
+ movq %rdx, %r8
+ addq %rdi, %rdx
+ andq $-128, %rdx
+ cmpq %rcx, %rdx
+ je L(return)
+
+#ifdef SHARED_CACHE_SIZE
+ cmp $SHARED_CACHE_SIZE, %r8
+#else
+ cmp __x86_64_shared_cache_size(%rip), %r8
+#endif
+ ja L(256bytesmore_nt)
+
+ ALIGN (4)
+L(256bytesmore_normal):
+ vmovdqa %ymm0, (%rcx)
+ vmovdqa %ymm0, 32(%rcx)
+ vmovdqa %ymm0, 64(%rcx)
+ vmovdqa %ymm0, 96(%rcx)
+ addq $128, %rcx
+ cmpq %rcx, %rdx
+ jne L(256bytesmore_normal)
+ ret
+
+ ALIGN (4)
+L(256bytesmore_nt):
+ movntdq %xmm0, (%rcx)
+ movntdq %xmm0, 16(%rcx)
+ movntdq %xmm0, 32(%rcx)
+ movntdq %xmm0, 48(%rcx)
+ movntdq %xmm0, 64(%rcx)
+ movntdq %xmm0, 80(%rcx)
+ movntdq %xmm0, 96(%rcx)
+ movntdq %xmm0, 112(%rcx)
+ leaq 128(%rcx), %rcx
+ cmpq %rcx, %rdx
+ jne L(256bytesmore_nt)
+ sfence
+ ret
+
+END(memset_avx2)
diff --git a/libc/arch-x86_64/string/avx2-wmemset-kbl.S b/libc/arch-x86_64/string/avx2-wmemset-kbl.S
deleted file mode 100644
index 7c485cf..0000000
--- a/libc/arch-x86_64/string/avx2-wmemset-kbl.S
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-Copyright (C) 2019 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-#ifndef WMEMSET
- #define WMEMSET wmemset_avx2
-#endif
-
- .section .text.avx2,"ax",@progbits
-
-ENTRY (WMEMSET)
-# BB#0:
- testq %rdx, %rdx
- je .LBB0_14
-# BB#1:
- cmpq $32, %rdx
- jae .LBB0_3
-# BB#2:
- xorl %r8d, %r8d
- movq %rdi, %rax
- jmp .LBB0_12
-.LBB0_3:
- movq %rdx, %r8
- andq $-32, %r8
- vmovd %esi, %xmm0
- vpbroadcastd %xmm0, %ymm0
- leaq -32(%r8), %rcx
- movq %rcx, %rax
- shrq $5, %rax
- leal 1(%rax), %r9d
- andl $7, %r9d
- cmpq $224, %rcx
- jae .LBB0_5
-# BB#4:
- xorl %eax, %eax
- testq %r9, %r9
- jne .LBB0_8
- jmp .LBB0_10
-.LBB0_5:
- leaq 992(%rdi), %rcx
- leaq -1(%r9), %r10
- subq %rax, %r10
- xorl %eax, %eax
- .p2align 4, 0x90
-.LBB0_6: # =>This Inner Loop Header: Depth=1
- vmovdqu %ymm0, -992(%rcx,%rax,4)
- vmovdqu %ymm0, -960(%rcx,%rax,4)
- vmovdqu %ymm0, -928(%rcx,%rax,4)
- vmovdqu %ymm0, -896(%rcx,%rax,4)
- vmovdqu %ymm0, -864(%rcx,%rax,4)
- vmovdqu %ymm0, -832(%rcx,%rax,4)
- vmovdqu %ymm0, -800(%rcx,%rax,4)
- vmovdqu %ymm0, -768(%rcx,%rax,4)
- vmovdqu %ymm0, -736(%rcx,%rax,4)
- vmovdqu %ymm0, -704(%rcx,%rax,4)
- vmovdqu %ymm0, -672(%rcx,%rax,4)
- vmovdqu %ymm0, -640(%rcx,%rax,4)
- vmovdqu %ymm0, -608(%rcx,%rax,4)
- vmovdqu %ymm0, -576(%rcx,%rax,4)
- vmovdqu %ymm0, -544(%rcx,%rax,4)
- vmovdqu %ymm0, -512(%rcx,%rax,4)
- vmovdqu %ymm0, -480(%rcx,%rax,4)
- vmovdqu %ymm0, -448(%rcx,%rax,4)
- vmovdqu %ymm0, -416(%rcx,%rax,4)
- vmovdqu %ymm0, -384(%rcx,%rax,4)
- vmovdqu %ymm0, -352(%rcx,%rax,4)
- vmovdqu %ymm0, -320(%rcx,%rax,4)
- vmovdqu %ymm0, -288(%rcx,%rax,4)
- vmovdqu %ymm0, -256(%rcx,%rax,4)
- vmovdqu %ymm0, -224(%rcx,%rax,4)
- vmovdqu %ymm0, -192(%rcx,%rax,4)
- vmovdqu %ymm0, -160(%rcx,%rax,4)
- vmovdqu %ymm0, -128(%rcx,%rax,4)
- vmovdqu %ymm0, -96(%rcx,%rax,4)
- vmovdqu %ymm0, -64(%rcx,%rax,4)
- vmovdqu %ymm0, -32(%rcx,%rax,4)
- vmovdqu %ymm0, (%rcx,%rax,4)
- addq $256, %rax # imm = 0x100
- addq $8, %r10
- jne .LBB0_6
-# BB#7:
- testq %r9, %r9
- je .LBB0_10
-.LBB0_8:
- leaq (%rdi,%rax,4), %rax
- addq $96, %rax
- negq %r9
- .p2align 4, 0x90
-.LBB0_9: # =>This Inner Loop Header: Depth=1
- vmovdqu %ymm0, -96(%rax)
- vmovdqu %ymm0, -64(%rax)
- vmovdqu %ymm0, -32(%rax)
- vmovdqu %ymm0, (%rax)
- subq $-128, %rax
- addq $1, %r9
- jne .LBB0_9
-.LBB0_10:
- cmpq %rdx, %r8
- je .LBB0_14
-# BB#11:
- leaq (%rdi,%r8,4), %rax
-.LBB0_12:
- subq %r8, %rdx
- .p2align 4, 0x90
-.LBB0_13: # =>This Inner Loop Header: Depth=1
- movl %esi, (%rax)
- addq $4, %rax
- addq $-1, %rdx
- jne .LBB0_13
-.LBB0_14:
- movq %rdi, %rax
- vzeroupper
- retq
-END(WMEMSET)
diff --git a/libc/arch-x86_64/string/sse2-memset-slm.S b/libc/arch-x86_64/string/sse2-memset-slm.S
index fc502c0..cceadd2 100644
--- a/libc/arch-x86_64/string/sse2-memset-slm.S
+++ b/libc/arch-x86_64/string/sse2-memset-slm.S
@@ -41,16 +41,16 @@
#endif
-ENTRY(__memset_chk)
+ENTRY(__memset_chk_generic)
# %rdi = dst, %rsi = byte, %rdx = n, %rcx = dst_len
cmp %rcx, %rdx
ja __memset_chk_fail
// Fall through to memset...
-END(__memset_chk)
+END(__memset_chk_generic)
.section .text.sse2,"ax",@progbits
-ENTRY(memset)
+ENTRY(memset_generic)
movq %rdi, %rax
and $0xff, %rsi
mov $0x0101010101010101, %rcx
@@ -146,4 +146,4 @@
sfence
ret
-END(memset)
+END(memset_generic)
diff --git a/libc/async_safe/Android.bp b/libc/async_safe/Android.bp
index 531317d..eb690dd 100644
--- a/libc/async_safe/Android.bp
+++ b/libc/async_safe/Android.bp
@@ -30,13 +30,8 @@
stl: "none",
apex_available: [
+ "//apex_available:anyapex",
"//apex_available:platform",
- "com.android.runtime",
- "com.android.art",
- "com.android.art.debug",
- "com.android.media",
- "com.android.media.swcodec",
- "com.android.virt",
],
min_sdk_version: "apex_inherit",
}
diff --git a/libc/async_safe/async_safe_log.cpp b/libc/async_safe/async_safe_log.cpp
index 2380e68..420560f 100644
--- a/libc/async_safe/async_safe_log.cpp
+++ b/libc/async_safe/async_safe_log.cpp
@@ -254,7 +254,7 @@
bool alternate = false;
size_t bytelen = sizeof(int);
int slen;
- char buffer[32]; /* temporary buffer used to format numbers */
+ char buffer[64]; // temporary buffer used to format numbers/format errno string
char c;
@@ -359,8 +359,7 @@
buffer[1] = 'x';
format_integer(buffer + 2, sizeof(buffer) - 2, value, 'x');
} else if (c == 'm') {
- char buf[256];
- str = strerror_r(errno, buf, sizeof(buf));
+ strerror_r(errno, buffer, sizeof(buffer));
} else if (c == 'd' || c == 'i' || c == 'o' || c == 'u' || c == 'x' || c == 'X') {
/* integers - first read value from stack */
uint64_t value;
diff --git a/libc/bionic/__libc_current_sigrtmax.cpp b/libc/bionic/__libc_current_sigrtmax.cpp
index 32179bb..328ede17 100644
--- a/libc/bionic/__libc_current_sigrtmax.cpp
+++ b/libc/bionic/__libc_current_sigrtmax.cpp
@@ -28,8 +28,6 @@
#include <signal.h>
-int __libc_current_sigrtmax(void) {
- // If you change this, also change __ndk_legacy___libc_current_sigrtmax
- // in <android/legacy_signal_inlines.h> to match.
+int __libc_current_sigrtmax() {
return __SIGRTMAX;
}
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
diff --git a/libc/bionic/android_unsafe_frame_pointer_chase.cpp b/libc/bionic/android_unsafe_frame_pointer_chase.cpp
index a1cb3c6..1a59718 100644
--- a/libc/bionic/android_unsafe_frame_pointer_chase.cpp
+++ b/libc/bionic/android_unsafe_frame_pointer_chase.cpp
@@ -72,7 +72,13 @@
size_t num_frames = 0;
while (1) {
+#if defined(__riscv)
+ // Frame addresses seem to have been implemented incorrectly for RISC-V.
+ // See https://reviews.llvm.org/D87579.
+ auto* frame = reinterpret_cast<frame_record*>(begin - 16);
+#else
auto* frame = reinterpret_cast<frame_record*>(begin);
+#endif
if (num_frames < num_entries) {
buf[num_frames] = __bionic_clear_pac_bits(frame->return_addr);
}
diff --git a/libc/bionic/bionic_elf_tls.cpp b/libc/bionic/bionic_elf_tls.cpp
index d5fb05a..79893e3 100644
--- a/libc/bionic/bionic_elf_tls.cpp
+++ b/libc/bionic/bionic_elf_tls.cpp
@@ -137,6 +137,15 @@
offset_bionic_tcb_ = reserve(sizeof(bionic_tcb), max_align);
return offset_bionic_tcb_ - exe_size;
+#elif defined(__riscv)
+
+ // First reserve enough space for the TCB before the executable segment.
+ offset_bionic_tcb_ = reserve(sizeof(bionic_tcb), 1);
+
+ // Then reserve the segment itself.
+ const size_t exe_size = round_up_with_overflow_check(exe_segment->size, exe_segment->alignment);
+ return reserve(exe_size, 1);
+
#else
#error "Unrecognized architecture"
#endif
@@ -312,7 +321,7 @@
}
}
- return static_cast<char*>(mod_ptr) + ti->offset;
+ return static_cast<char*>(mod_ptr) + ti->offset + TLS_DTV_OFFSET;
}
// Returns the address of a thread's TLS memory given a module ID and an offset
@@ -332,7 +341,7 @@
if (__predict_true(generation == dtv->generation)) {
void* mod_ptr = dtv->modules[__tls_module_id_to_idx(ti->module_id)];
if (__predict_true(mod_ptr != nullptr)) {
- return static_cast<char*>(mod_ptr) + ti->offset;
+ return static_cast<char*>(mod_ptr) + ti->offset + TLS_DTV_OFFSET;
}
}
diff --git a/libc/bionic/exec.cpp b/libc/bionic/exec.cpp
index fd2c401..40612e7 100644
--- a/libc/bionic/exec.cpp
+++ b/libc/bionic/exec.cpp
@@ -39,10 +39,12 @@
#include <string.h>
#include <unistd.h>
-#include "private/__bionic_get_shell_path.h"
#include "private/FdPath.h"
+#include "private/__bionic_get_shell_path.h"
+#include "pthread_internal.h"
extern "C" char** environ;
+extern "C" int __execve(const char* pathname, char* const* argv, char* const* envp);
enum { ExecL, ExecLE, ExecLP };
@@ -181,3 +183,9 @@
if (errno == ENOENT) errno = EBADF;
return -1;
}
+
+__attribute__((no_sanitize("memtag"))) int execve(const char* pathname, char* const* argv,
+ char* const* envp) {
+ __get_thread()->vfork_child_stack_bottom = __builtin_frame_address(0);
+ return __execve(pathname, argv, envp);
+}
diff --git a/libc/bionic/exit.cpp b/libc/bionic/exit.cpp
index a5aed78..52fd193 100644
--- a/libc/bionic/exit.cpp
+++ b/libc/bionic/exit.cpp
@@ -30,9 +30,18 @@
#include <unistd.h>
#include "private/bionic_defs.h"
+#include "pthread_internal.h"
extern "C" void __cxa_finalize(void* dso_handle);
extern "C" void __cxa_thread_finalize();
+extern "C" __noreturn void __exit_group(int status);
+
+__attribute__((no_sanitize("memtag"))) void _exit(int status) {
+ __get_thread()->vfork_child_stack_bottom = __builtin_frame_address(0);
+ __exit_group(status);
+}
+
+__strong_alias(_Exit, _exit);
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
void exit(int status) {
diff --git a/libc/bionic/fcntl.cpp b/libc/bionic/fcntl.cpp
index c508131..754277b 100644
--- a/libc/bionic/fcntl.cpp
+++ b/libc/bionic/fcntl.cpp
@@ -30,21 +30,29 @@
#include <fcntl.h>
#include "private/bionic_fdtrack.h"
-
-#if defined(__LP64__)
+#include "private/bionic_fortify.h"
extern "C" int __fcntl(int fd, int cmd, ...);
+extern "C" int __fcntl64(int, int, ...);
int fcntl(int fd, int cmd, ...) {
va_list args;
va_start(args, cmd);
-
- // This is a bit sketchy, especially because arg can be an int, but all of our
- // supported 64-bit ABIs pass arg in a register.
+ // This is a bit sketchy for LP64, especially because arg can be an int,
+ // but all of our supported 64-bit ABIs pass the argument in a register.
void* arg = va_arg(args, void*);
va_end(args);
+ if (cmd == F_SETFD && (reinterpret_cast<uintptr_t>(arg) & ~FD_CLOEXEC) != 0) {
+ __fortify_fatal("fcntl(F_SETFD) passed non-FD_CLOEXEC flag: %p", arg);
+ }
+
+#if defined(__LP64__)
int rc = __fcntl(fd, cmd, arg);
+#else
+ // For LP32 we use the fcntl64 system call to signal that we're using struct flock64.
+ int rc = __fcntl64(fd, cmd, arg);
+#endif
if (cmd == F_DUPFD) {
return FDTRACK_CREATE_NAME("F_DUPFD", rc);
} else if (cmd == F_DUPFD_CLOEXEC) {
@@ -52,25 +60,3 @@
}
return rc;
}
-
-#else
-
-extern "C" int __fcntl64(int, int, ...);
-
-// For fcntl we use the fcntl64 system call to signal that we're using struct flock64.
-int fcntl(int fd, int cmd, ...) {
- va_list ap;
-
- va_start(ap, cmd);
- void* arg = va_arg(ap, void*);
- va_end(ap);
-
- if (cmd == F_DUPFD) {
- return FDTRACK_CREATE_NAME("F_DUPFD", __fcntl64(fd, cmd, arg));
- } else if (cmd == F_DUPFD_CLOEXEC) {
- return FDTRACK_CREATE_NAME("F_DUPFD_CLOEXEC", __fcntl64(fd, cmd, arg));
- }
- return __fcntl64(fd, cmd, arg);
-}
-
-#endif
diff --git a/libc/bionic/fdsan.cpp b/libc/bionic/fdsan.cpp
index 48e8674..6433b59 100644
--- a/libc/bionic/fdsan.cpp
+++ b/libc/bionic/fdsan.cpp
@@ -101,7 +101,7 @@
}
size_t offset = idx - inline_fds;
- if (local_overflow->len < offset) {
+ if (local_overflow->len <= offset) {
return nullptr;
}
return &local_overflow->entries[offset];
@@ -216,6 +216,8 @@
return "SocketImpl";
case ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE:
return "ZipArchive";
+ case ANDROID_FDSAN_OWNER_TYPE_NATIVE_HANDLE:
+ return "native_handle_t";
case ANDROID_FDSAN_OWNER_TYPE_GENERIC_00:
default:
diff --git a/libc/bionic/flockfile.cpp b/libc/bionic/flockfile.cpp
deleted file mode 100644
index db53828..0000000
--- a/libc/bionic/flockfile.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdio.h>
-
-#include "local.h"
-
-// We can't use the OpenBSD implementation which uses kernel-specific
-// APIs not available on Linux. Instead we use a pthread_mutex_t within
-// struct __sfileext (see fileext.h).
-
-void flockfile(FILE* fp) {
- if (fp != nullptr) {
- pthread_mutex_lock(&_FLOCK(fp));
- }
-}
-
-int ftrylockfile(FILE* fp) {
- // The specification for ftrylockfile() says it returns 0 on success,
- // or non-zero on error. So return an errno code directly on error.
- if (fp == nullptr) {
- return EINVAL;
- }
-
- return pthread_mutex_trylock(&_FLOCK(fp));
-}
-
-void funlockfile(FILE* fp) {
- if (fp != nullptr) {
- pthread_mutex_unlock(&_FLOCK(fp));
- }
-}
diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp
index 88ae477..7dee5e3 100644
--- a/libc/bionic/fortify.cpp
+++ b/libc/bionic/fortify.cpp
@@ -489,14 +489,15 @@
return strcpy(dst, src);
}
-#if !defined(NO___MEMCPY_CHK)
+#if !defined(__arm__) && !defined(__aarch64__) && !defined(__riscv)
// Runtime implementation of __memcpy_chk (used directly by compiler, not in headers).
+// arm32,arm64,riscv have assembler implementations, and don't need this C fallback.
extern "C" void* __memcpy_chk(void* dst, const void* src, size_t count, size_t dst_len) {
__check_count("memcpy", "count", count);
__check_buffer_access("memcpy", "write into", count, dst_len);
return memcpy(dst, src, count);
}
-#endif // NO___MEMCPY_CHK
+#endif
// Runtime implementation of __mempcpy_chk (used directly by compiler, not in headers).
extern "C" void* __mempcpy_chk(void* dst, const void* src, size_t count, size_t dst_len) {
diff --git a/libc/bionic/gwp_asan_wrappers.cpp b/libc/bionic/gwp_asan_wrappers.cpp
index 7e19b31..251633d 100644
--- a/libc/bionic/gwp_asan_wrappers.cpp
+++ b/libc/bionic/gwp_asan_wrappers.cpp
@@ -36,11 +36,13 @@
#include <string.h>
#include <sys/types.h>
+#include "gwp_asan/crash_handler.h"
#include "gwp_asan/guarded_pool_allocator.h"
#include "gwp_asan/options.h"
#include "gwp_asan_wrappers.h"
#include "malloc_common.h"
#include "platform/bionic/android_unsafe_frame_pointer_chase.h"
+#include "platform/bionic/macros.h"
#include "platform/bionic/malloc.h"
#include "private/bionic_arc4random.h"
#include "private/bionic_globals.h"
@@ -188,6 +190,7 @@
}
bool GwpAsanInitialized = false;
+bool GwpAsanRecoverable = false;
// The probability (1 / SampleRate) that an allocation gets chosen to be put
// into the special GWP-ASan pool.
@@ -221,6 +224,32 @@
static const char* kMaxAllocsTargetedSyspropPrefix = "libc.debug.gwp_asan.max_allocs.";
static const char* kMaxAllocsEnvVar = "GWP_ASAN_MAX_ALLOCS";
+static const char* kRecoverableSystemSysprop = "libc.debug.gwp_asan.recoverable.system_default";
+static const char* kRecoverableAppSysprop = "libc.debug.gwp_asan.recoverable.app_default";
+static const char* kRecoverableTargetedSyspropPrefix = "libc.debug.gwp_asan.recoverable.";
+static const char* kRecoverableEnvVar = "GWP_ASAN_RECOVERABLE";
+
+static const char kPersistPrefix[] = "persist.";
+
+bool NeedsGwpAsanRecovery(void* fault_ptr) {
+ fault_ptr = untag_address(fault_ptr);
+ return GwpAsanInitialized && GwpAsanRecoverable &&
+ __gwp_asan_error_is_mine(GuardedAlloc.getAllocatorState(),
+ reinterpret_cast<uintptr_t>(fault_ptr));
+}
+
+void GwpAsanPreCrashHandler(void* fault_ptr) {
+ fault_ptr = untag_address(fault_ptr);
+ if (!NeedsGwpAsanRecovery(fault_ptr)) return;
+ GuardedAlloc.preCrashReport(fault_ptr);
+}
+
+void GwpAsanPostCrashHandler(void* fault_ptr) {
+ fault_ptr = untag_address(fault_ptr);
+ if (!NeedsGwpAsanRecovery(fault_ptr)) return;
+ GuardedAlloc.postCrashReportRecoverableOnly(fault_ptr);
+}
+
void SetDefaultGwpAsanOptions(Options* options, unsigned* process_sample_rate,
const android_mallopt_gwp_asan_options_t& mallopt_options) {
options->Enabled = true;
@@ -233,45 +262,70 @@
*process_sample_rate = 1;
if (mallopt_options.desire == Action::TURN_ON_WITH_SAMPLING) {
*process_sample_rate = kDefaultProcessSampling;
+ } else if (mallopt_options.desire == Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING) {
+ *process_sample_rate = kDefaultProcessSampling;
+ options->Recoverable = true;
+ GwpAsanRecoverable = true;
}
}
-bool GetGwpAsanOption(unsigned long long* result,
- const android_mallopt_gwp_asan_options_t& mallopt_options,
- const char* system_sysprop, const char* app_sysprop,
- const char* targeted_sysprop_prefix, const char* env_var,
- const char* descriptive_name) {
+bool GetGwpAsanOptionImpl(char* value_out,
+ const android_mallopt_gwp_asan_options_t& mallopt_options,
+ const char* system_sysprop, const char* app_sysprop,
+ const char* targeted_sysprop_prefix, const char* env_var) {
const char* basename = "";
if (mallopt_options.program_name) basename = __gnu_basename(mallopt_options.program_name);
- size_t program_specific_sysprop_size = strlen(targeted_sysprop_prefix) + strlen(basename) + 1;
- char* program_specific_sysprop_name = static_cast<char*>(alloca(program_specific_sysprop_size));
- async_safe_format_buffer(program_specific_sysprop_name, program_specific_sysprop_size, "%s%s",
- targeted_sysprop_prefix, basename);
-
- const char* sysprop_names[2] = {nullptr, nullptr};
+ constexpr size_t kSyspropMaxLen = 512;
+ char program_specific_sysprop[kSyspropMaxLen] = {};
+ char persist_program_specific_sysprop[kSyspropMaxLen] = {};
+ char persist_default_sysprop[kSyspropMaxLen] = {};
+ const char* sysprop_names[4] = {};
// Tests use a blank program name to specify that system properties should not
// be used. Tests still continue to use the environment variable though.
if (*basename != '\0') {
- sysprop_names[0] = program_specific_sysprop_name;
+ const char* default_sysprop = system_sysprop;
if (mallopt_options.desire == Action::TURN_ON_FOR_APP) {
- sysprop_names[1] = app_sysprop;
- } else {
- sysprop_names[1] = system_sysprop;
+ default_sysprop = app_sysprop;
}
+ async_safe_format_buffer(&program_specific_sysprop[0], kSyspropMaxLen, "%s%s",
+ targeted_sysprop_prefix, basename);
+ async_safe_format_buffer(&persist_program_specific_sysprop[0], kSyspropMaxLen, "%s%s",
+ kPersistPrefix, program_specific_sysprop);
+ async_safe_format_buffer(&persist_default_sysprop[0], kSyspropMaxLen, "%s%s", kPersistPrefix,
+ default_sysprop);
+
+ // In order of precedence, always take the program-specific sysprop (e.g.
+ // '[persist.]libc.debug.gwp_asan.sample_rate.cameraserver') over the
+ // generic sysprop (e.g.
+ // '[persist.]libc.debug.gwp_asan.(system_default|app_default)'). In
+ // addition, always take the non-persistent option over the persistent
+ // option.
+ sysprop_names[0] = program_specific_sysprop;
+ sysprop_names[1] = persist_program_specific_sysprop;
+ sysprop_names[2] = default_sysprop;
+ sysprop_names[3] = persist_default_sysprop;
}
- char settings_buf[PROP_VALUE_MAX];
- if (!get_config_from_env_or_sysprops(env_var, sysprop_names,
- /* sys_prop_names_size */ 2, settings_buf, PROP_VALUE_MAX)) {
+ return get_config_from_env_or_sysprops(env_var, sysprop_names, arraysize(sysprop_names),
+ value_out, PROP_VALUE_MAX);
+}
+
+bool GetGwpAsanIntegerOption(unsigned long long* result,
+ const android_mallopt_gwp_asan_options_t& mallopt_options,
+ const char* system_sysprop, const char* app_sysprop,
+ const char* targeted_sysprop_prefix, const char* env_var,
+ const char* descriptive_name) {
+ char buffer[PROP_VALUE_MAX];
+ if (!GetGwpAsanOptionImpl(buffer, mallopt_options, system_sysprop, app_sysprop,
+ targeted_sysprop_prefix, env_var)) {
return false;
}
-
char* end;
- unsigned long long value = strtoull(settings_buf, &end, 10);
+ unsigned long long value = strtoull(buffer, &end, 10);
if (value == ULLONG_MAX || *end != '\0') {
warning_log("Invalid GWP-ASan %s: \"%s\". Using default value instead.", descriptive_name,
- settings_buf);
+ buffer);
return false;
}
@@ -279,6 +333,33 @@
return true;
}
+bool GetGwpAsanBoolOption(bool* result, const android_mallopt_gwp_asan_options_t& mallopt_options,
+ const char* system_sysprop, const char* app_sysprop,
+ const char* targeted_sysprop_prefix, const char* env_var,
+ const char* descriptive_name) {
+ char buffer[PROP_VALUE_MAX] = {};
+ if (!GetGwpAsanOptionImpl(buffer, mallopt_options, system_sysprop, app_sysprop,
+ targeted_sysprop_prefix, env_var)) {
+ return false;
+ }
+
+ if (strncasecmp(buffer, "1", PROP_VALUE_MAX) == 0 ||
+ strncasecmp(buffer, "true", PROP_VALUE_MAX) == 0) {
+ *result = true;
+ return true;
+ } else if (strncasecmp(buffer, "0", PROP_VALUE_MAX) == 0 ||
+ strncasecmp(buffer, "false", PROP_VALUE_MAX) == 0) {
+ *result = false;
+ return true;
+ }
+
+ warning_log(
+ "Invalid GWP-ASan %s: \"%s\". Using default value \"%s\" instead. Valid values are \"true\", "
+ "\"1\", \"false\", or \"0\".",
+ descriptive_name, buffer, *result ? "true" : "false");
+ return false;
+}
+
// Initialize the GWP-ASan options structure in *options, taking into account whether someone has
// asked for specific GWP-ASan settings. The order of priority is:
// 1. Environment variables.
@@ -293,22 +374,23 @@
bool had_overrides = false;
unsigned long long buf;
- if (GetGwpAsanOption(&buf, mallopt_options, kSampleRateSystemSysprop, kSampleRateAppSysprop,
- kSampleRateTargetedSyspropPrefix, kSampleRateEnvVar, "sample rate")) {
+ if (GetGwpAsanIntegerOption(&buf, mallopt_options, kSampleRateSystemSysprop,
+ kSampleRateAppSysprop, kSampleRateTargetedSyspropPrefix,
+ kSampleRateEnvVar, "sample rate")) {
options->SampleRate = buf;
had_overrides = true;
}
- if (GetGwpAsanOption(&buf, mallopt_options, kProcessSamplingSystemSysprop,
- kProcessSamplingAppSysprop, kProcessSamplingTargetedSyspropPrefix,
- kProcessSamplingEnvVar, "process sampling rate")) {
+ if (GetGwpAsanIntegerOption(&buf, mallopt_options, kProcessSamplingSystemSysprop,
+ kProcessSamplingAppSysprop, kProcessSamplingTargetedSyspropPrefix,
+ kProcessSamplingEnvVar, "process sampling rate")) {
*process_sample_rate = buf;
had_overrides = true;
}
- if (GetGwpAsanOption(&buf, mallopt_options, kMaxAllocsSystemSysprop, kMaxAllocsAppSysprop,
- kMaxAllocsTargetedSyspropPrefix, kMaxAllocsEnvVar,
- "maximum simultaneous allocations")) {
+ if (GetGwpAsanIntegerOption(&buf, mallopt_options, kMaxAllocsSystemSysprop, kMaxAllocsAppSysprop,
+ kMaxAllocsTargetedSyspropPrefix, kMaxAllocsEnvVar,
+ "maximum simultaneous allocations")) {
options->MaxSimultaneousAllocations = buf;
had_overrides = true;
} else if (had_overrides) {
@@ -320,6 +402,16 @@
options->MaxSimultaneousAllocations =
/* default */ kDefaultMaxAllocs / frequency_multiplier;
}
+
+ bool recoverable = false;
+ if (GetGwpAsanBoolOption(&recoverable, mallopt_options, kRecoverableSystemSysprop,
+ kRecoverableAppSysprop, kRecoverableTargetedSyspropPrefix,
+ kRecoverableEnvVar, "recoverable")) {
+ options->Recoverable = recoverable;
+ GwpAsanRecoverable = recoverable;
+ had_overrides = true;
+ }
+
return had_overrides;
}
@@ -379,6 +471,9 @@
__libc_shared_globals()->gwp_asan_state = GuardedAlloc.getAllocatorState();
__libc_shared_globals()->gwp_asan_metadata = GuardedAlloc.getMetadataRegion();
+ __libc_shared_globals()->debuggerd_needs_gwp_asan_recovery = NeedsGwpAsanRecovery;
+ __libc_shared_globals()->debuggerd_gwp_asan_pre_crash_report = GwpAsanPreCrashHandler;
+ __libc_shared_globals()->debuggerd_gwp_asan_post_crash_report = GwpAsanPostCrashHandler;
return true;
}
diff --git a/libc/bionic/heap_tagging.cpp b/libc/bionic/heap_tagging.cpp
index 41aa205..78d21b0 100644
--- a/libc/bionic/heap_tagging.cpp
+++ b/libc/bionic/heap_tagging.cpp
@@ -32,6 +32,8 @@
#include <bionic/pthread_internal.h>
#include <platform/bionic/malloc.h>
+#include <sanitizer/hwasan_interface.h>
+#include <sys/auxv.h>
extern "C" void scudo_malloc_disable_memory_tagging();
extern "C" void scudo_malloc_set_track_allocation_stacks(int);
@@ -44,61 +46,61 @@
#if !__has_feature(hwaddress_sanitizer)
heap_tagging_level = __libc_shared_globals()->initial_heap_tagging_level;
#endif
- switch (heap_tagging_level) {
- case M_HEAP_TAGGING_LEVEL_TBI:
- __libc_globals.mutate([](libc_globals* globals) {
+
+ __libc_globals.mutate([](libc_globals* globals) {
+ switch (heap_tagging_level) {
+ case M_HEAP_TAGGING_LEVEL_TBI:
// Arrange for us to set pointer tags to POINTER_TAG, check tags on
// deallocation and untag when passing pointers to the allocator.
globals->heap_pointer_tag = (reinterpret_cast<uintptr_t>(POINTER_TAG) << TAG_SHIFT) |
(0xffull << CHECK_SHIFT) | (0xffull << UNTAG_SHIFT);
- });
-#if defined(USE_SCUDO)
- scudo_malloc_disable_memory_tagging();
-#endif // USE_SCUDO
- break;
-#if defined(USE_SCUDO)
- case M_HEAP_TAGGING_LEVEL_SYNC:
- scudo_malloc_set_track_allocation_stacks(1);
- break;
+ break;
+ case M_HEAP_TAGGING_LEVEL_SYNC:
+ case M_HEAP_TAGGING_LEVEL_ASYNC:
+ atomic_store(&globals->memtag_stack, __libc_shared_globals()->initial_memtag_stack);
+ break;
+ default:
+ break;
+ };
+ });
+#if defined(USE_SCUDO)
+ switch (heap_tagging_level) {
+ case M_HEAP_TAGGING_LEVEL_TBI:
case M_HEAP_TAGGING_LEVEL_NONE:
scudo_malloc_disable_memory_tagging();
break;
-#endif // USE_SCUDO
+ case M_HEAP_TAGGING_LEVEL_SYNC:
+ scudo_malloc_set_track_allocation_stacks(1);
+ break;
default:
break;
}
+#endif // USE_SCUDO
#endif // aarch64
}
static bool set_tcf_on_all_threads(int tcf) {
- static int g_tcf;
- g_tcf = tcf;
-
return android_run_on_all_threads(
- [](void*) {
+ [](void* arg) {
+ int tcf = *reinterpret_cast<int*>(arg);
int tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
if (tagged_addr_ctrl < 0) {
return false;
}
- tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | g_tcf;
+ tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | tcf;
if (prctl(PR_SET_TAGGED_ADDR_CTRL, tagged_addr_ctrl, 0, 0, 0) < 0) {
return false;
}
return true;
},
- nullptr);
+ &tcf);
}
pthread_mutex_t g_heap_tagging_lock = PTHREAD_MUTEX_INITIALIZER;
// Requires `g_heap_tagging_lock` to be held.
-HeapTaggingLevel GetHeapTaggingLevel() {
- return heap_tagging_level;
-}
-
-// Requires `g_heap_tagging_lock` to be held.
bool SetHeapTaggingLevel(HeapTaggingLevel tag_level) {
if (tag_level == heap_tagging_level) {
return true;
@@ -106,16 +108,21 @@
switch (tag_level) {
case M_HEAP_TAGGING_LEVEL_NONE:
- if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_TBI) {
- __libc_globals.mutate([](libc_globals* globals) {
+ __libc_globals.mutate([](libc_globals* globals) {
+ if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_TBI) {
// Preserve the untag mask (we still want to untag pointers when passing them to the
// allocator), but clear the fixed tag and the check mask, so that pointers are no longer
// tagged and checks no longer happen.
globals->heap_pointer_tag = static_cast<uintptr_t>(0xffull << UNTAG_SHIFT);
- });
- } else if (!set_tcf_on_all_threads(PR_MTE_TCF_NONE)) {
- error_log("SetHeapTaggingLevel: set_tcf_on_all_threads failed");
- return false;
+ }
+ atomic_store(&globals->memtag_stack, false);
+ });
+
+ if (heap_tagging_level != M_HEAP_TAGGING_LEVEL_TBI) {
+ if (!set_tcf_on_all_threads(PR_MTE_TCF_NONE)) {
+ error_log("SetHeapTaggingLevel: set_tcf_on_all_threads failed");
+ return false;
+ }
}
#if defined(USE_SCUDO)
scudo_malloc_disable_memory_tagging();
@@ -165,3 +172,69 @@
return true;
}
+
+#ifdef __aarch64__
+static inline __attribute__((no_sanitize("memtag"))) void untag_memory(void* from, void* to) {
+ __asm__ __volatile__(
+ ".arch_extension mte\n"
+ "1:\n"
+ "stg %[Ptr], [%[Ptr]], #16\n"
+ "cmp %[Ptr], %[End]\n"
+ "b.lt 1b\n"
+ : [Ptr] "+&r"(from)
+ : [End] "r"(to)
+ : "memory");
+}
+#endif
+
+#ifdef __aarch64__
+// 128Mb of stack should be enough for anybody.
+static constexpr size_t kUntagLimit = 128 * 1024 * 1024;
+#endif // __aarch64__
+
+extern "C" __LIBC_HIDDEN__ __attribute__((no_sanitize("memtag"))) void memtag_handle_longjmp(
+ void* sp_dst __unused) {
+#ifdef __aarch64__
+ if (__libc_globals->memtag_stack) {
+ void* sp = __builtin_frame_address(0);
+ size_t distance = reinterpret_cast<uintptr_t>(sp_dst) - reinterpret_cast<uintptr_t>(sp);
+ if (distance > kUntagLimit) {
+ async_safe_fatal(
+ "memtag_handle_longjmp: stack adjustment too large! %p -> %p, distance %zx > %zx\n", sp,
+ sp_dst, distance, kUntagLimit);
+ } else {
+ untag_memory(sp, sp_dst);
+ }
+ }
+#endif // __aarch64__
+
+#if __has_feature(hwaddress_sanitizer)
+ __hwasan_handle_longjmp(sp_dst);
+#endif // __has_feature(hwaddress_sanitizer)
+}
+
+extern "C" __LIBC_HIDDEN__ __attribute__((no_sanitize("memtag"), no_sanitize("hwaddress"))) void
+memtag_handle_vfork(void* sp __unused) {
+#ifdef __aarch64__
+ if (__libc_globals->memtag_stack) {
+ void* child_sp = __get_thread()->vfork_child_stack_bottom;
+ __get_thread()->vfork_child_stack_bottom = nullptr;
+ if (child_sp) {
+ size_t distance = reinterpret_cast<uintptr_t>(sp) - reinterpret_cast<uintptr_t>(child_sp);
+ if (distance > kUntagLimit) {
+ async_safe_fatal(
+ "memtag_handle_vfork: stack adjustment too large! %p -> %p, distance %zx > %zx\n",
+ child_sp, sp, distance, kUntagLimit);
+ } else {
+ untag_memory(child_sp, sp);
+ }
+ } else {
+ async_safe_fatal("memtag_handle_vfork: child SP unknown\n");
+ }
+ }
+#endif // __aarch64__
+
+#if __has_feature(hwaddress_sanitizer)
+ __hwasan_handle_vfork(sp);
+#endif // __has_feature(hwaddress_sanitizer)
+}
diff --git a/libc/bionic/heap_tagging.h b/libc/bionic/heap_tagging.h
index 110b6ed..5bc1da0 100644
--- a/libc/bionic/heap_tagging.h
+++ b/libc/bionic/heap_tagging.h
@@ -40,7 +40,22 @@
// useful for RAII on this lock.
extern pthread_mutex_t g_heap_tagging_lock;
-// These functions can be called in a multithreaded context, and thus should
+// This function can be called in a multithreaded context, and thus should
// only be called when holding the `g_heap_tagging_lock`.
bool SetHeapTaggingLevel(HeapTaggingLevel level);
-HeapTaggingLevel GetHeapTaggingLevel();
+
+// This is static because libc_nomalloc uses this but does not need to link the
+// cpp file.
+__attribute__((unused)) static inline const char* DescribeTaggingLevel(
+ HeapTaggingLevel level) {
+ switch (level) {
+ case M_HEAP_TAGGING_LEVEL_NONE:
+ return "none";
+ case M_HEAP_TAGGING_LEVEL_TBI:
+ return "tbi";
+ case M_HEAP_TAGGING_LEVEL_ASYNC:
+ return "async";
+ case M_HEAP_TAGGING_LEVEL_SYNC:
+ return "sync";
+ }
+}
diff --git a/libc/bionic/jemalloc_wrapper.cpp b/libc/bionic/jemalloc_wrapper.cpp
index ef488ee..ce3f314 100644
--- a/libc/bionic/jemalloc_wrapper.cpp
+++ b/libc/bionic/jemalloc_wrapper.cpp
@@ -102,7 +102,7 @@
}
}
return 1;
- } else if (param == M_PURGE) {
+ } else if (param == M_PURGE || param == M_PURGE_ALL) {
// Only clear the current thread cache since there is no easy way to
// clear the caches of other threads.
// This must be done first so that cleared allocations get purged
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index 8084e73..59b2ddb 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -27,11 +27,12 @@
*/
#include "libc_init_common.h"
-#include "heap_tagging.h"
+#include <async_safe/log.h>
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
@@ -42,8 +43,8 @@
#include <sys/time.h>
#include <unistd.h>
-#include <async_safe/log.h>
-
+#include "heap_tagging.h"
+#include "private/ScopedPthreadMutexLocker.h"
#include "private/WriteProtected.h"
#include "private/bionic_defs.h"
#include "private/bionic_globals.h"
@@ -104,6 +105,51 @@
}
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
+__attribute__((no_sanitize("hwaddress", "memtag"))) void
+__libc_init_mte_late() {
+#if defined(__aarch64__)
+ if (!__libc_shared_globals()->heap_tagging_upgrade_timer_sec) {
+ return;
+ }
+ struct sigevent event = {};
+ static timer_t timer;
+ event.sigev_notify = SIGEV_THREAD;
+ event.sigev_notify_function = [](union sigval) {
+ async_safe_format_log(ANDROID_LOG_INFO, "libc",
+ "Downgrading MTE to async.");
+ ScopedPthreadMutexLocker l(&g_heap_tagging_lock);
+ SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC);
+ timer_delete(timer);
+ };
+
+ if (timer_create(CLOCK_REALTIME, &event, &timer) == -1) {
+ async_safe_format_log(ANDROID_LOG_ERROR, "libc",
+ "Failed to create MTE downgrade timer: %m");
+ // Revert back to ASYNC. If we fail to create or arm the timer, otherwise
+ // the process would be indefinitely stuck in SYNC.
+ SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC);
+ return;
+ }
+
+ struct itimerspec timerspec = {};
+ timerspec.it_value.tv_sec =
+ __libc_shared_globals()->heap_tagging_upgrade_timer_sec;
+ if (timer_settime(timer, /* flags= */ 0, &timerspec, nullptr) == -1) {
+ async_safe_format_log(ANDROID_LOG_ERROR, "libc",
+ "Failed to arm MTE downgrade timer: %m");
+ // Revert back to ASYNC. If we fail to create or arm the timer, otherwise
+ // the process would be indefinitely stuck in SYNC.
+ SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC);
+ timer_delete(timer);
+ return;
+ }
+ async_safe_format_log(
+ ANDROID_LOG_INFO, "libc", "Armed MTE downgrade timer for %" PRId64 " s",
+ __libc_shared_globals()->heap_tagging_upgrade_timer_sec);
+#endif
+}
+
+__BIONIC_WEAK_FOR_NATIVE_BRIDGE
void __libc_add_main_thread() {
// Get the main thread from TLS and add it to the thread list.
pthread_internal_t* main_thread = __get_thread();
@@ -243,6 +289,7 @@
"LD_DEBUG",
"LD_DEBUG_OUTPUT",
"LD_DYNAMIC_WEAK",
+ "LD_HWASAN",
"LD_LIBRARY_PATH",
"LD_ORIGIN_PATH",
"LD_PRELOAD",
diff --git a/libc/bionic/libc_init_common.h b/libc/bionic/libc_init_common.h
index 15c747e..6b39d6d 100644
--- a/libc/bionic/libc_init_common.h
+++ b/libc/bionic/libc_init_common.h
@@ -60,6 +60,8 @@
__LIBC_HIDDEN__ void __libc_init_scudo();
+__LIBC_HIDDEN__ void __libc_init_mte_late();
+
__LIBC_HIDDEN__ void __libc_init_AT_SECURE(char** envp);
// The fork handler must be initialised after __libc_init_malloc, as
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index 24efbf5..c61810e 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -154,6 +154,8 @@
__cxa_atexit(__libc_fini,structors->fini_array,nullptr);
}
+ __libc_init_mte_late();
+
exit(slingshot(args.argc - __libc_shared_globals()->initial_linker_arg_count,
args.argv + __libc_shared_globals()->initial_linker_arg_count,
args.envp));
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index 575da62..d64d402 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -29,6 +29,7 @@
#include <android/api-level.h>
#include <elf.h>
#include <errno.h>
+#include <malloc.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
@@ -36,10 +37,9 @@
#include <sys/auxv.h>
#include <sys/mman.h>
+#include "async_safe/log.h"
+#include "heap_tagging.h"
#include "libc_init_common.h"
-#include "pthread_internal.h"
-#include "sysprop_helpers.h"
-
#include "platform/bionic/macros.h"
#include "platform/bionic/mte.h"
#include "platform/bionic/page.h"
@@ -51,7 +51,9 @@
#include "private/bionic_elf_tls.h"
#include "private/bionic_globals.h"
#include "private/bionic_tls.h"
+#include "pthread_internal.h"
#include "sys/system_properties.h"
+#include "sysprop_helpers.h"
#if __has_feature(hwaddress_sanitizer)
#include <sanitizer/hwasan_interface.h>
@@ -74,33 +76,12 @@
}
}
-#if defined(__aarch64__) || defined(__x86_64__)
-extern __LIBC_HIDDEN__ __attribute__((weak)) ElfW(Rela) __rela_iplt_start[], __rela_iplt_end[];
-
-static void call_ifunc_resolvers() {
- if (__rela_iplt_start == nullptr || __rela_iplt_end == nullptr) {
- // These symbols are not emitted by gold. Gold has code to do so, but for
- // whatever reason it is not being run. In these cases ifuncs cannot be
- // resolved, so we do not support using ifuncs in static executables linked
- // with gold.
- //
- // Since they are weak, they will be non-null when linked with bfd/lld and
- // null when linked with gold.
- return;
- }
-
- for (ElfW(Rela) *r = __rela_iplt_start; r != __rela_iplt_end; ++r) {
- ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset);
- ElfW(Addr) resolver = r->r_addend;
- *offset = __bionic_call_ifunc_resolver(resolver);
- }
-}
-#else
+#if defined(__arm__) || defined(__i386__) // Legacy architectures used REL...
extern __LIBC_HIDDEN__ __attribute__((weak)) ElfW(Rel) __rel_iplt_start[], __rel_iplt_end[];
static void call_ifunc_resolvers() {
if (__rel_iplt_start == nullptr || __rel_iplt_end == nullptr) {
- // These symbols are not emitted by gold. Gold has code to do so, but for
+ // These symbols were not emitted by gold. Gold has code to do so, but for
// whatever reason it is not being run. In these cases ifuncs cannot be
// resolved, so we do not support using ifuncs in static executables linked
// with gold.
@@ -110,12 +91,33 @@
return;
}
- for (ElfW(Rel) *r = __rel_iplt_start; r != __rel_iplt_end; ++r) {
+ for (ElfW(Rel)* r = __rel_iplt_start; r != __rel_iplt_end; ++r) {
ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset);
ElfW(Addr) resolver = *offset;
*offset = __bionic_call_ifunc_resolver(resolver);
}
}
+#else // ...but modern architectures use RELA instead.
+extern __LIBC_HIDDEN__ __attribute__((weak)) ElfW(Rela) __rela_iplt_start[], __rela_iplt_end[];
+
+static void call_ifunc_resolvers() {
+ if (__rela_iplt_start == nullptr || __rela_iplt_end == nullptr) {
+ // These symbols were not emitted by gold. Gold has code to do so, but for
+ // whatever reason it is not being run. In these cases ifuncs cannot be
+ // resolved, so we do not support using ifuncs in static executables linked
+ // with gold.
+ //
+ // Since they are weak, they will be non-null when linked with bfd/lld and
+ // null when linked with gold.
+ return;
+ }
+
+ for (ElfW(Rela)* r = __rela_iplt_start; r != __rela_iplt_end; ++r) {
+ ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset);
+ ElfW(Addr) resolver = r->r_addend;
+ *offset = __bionic_call_ifunc_resolver(resolver);
+ }
+}
#endif
static void apply_gnu_relro() {
@@ -218,23 +220,25 @@
static bool get_environment_memtag_setting(HeapTaggingLevel* level) {
static const char kMemtagPrognameSyspropPrefix[] = "arm64.memtag.process.";
static const char kMemtagGlobalSysprop[] = "persist.arm64.memtag.default";
+ static const char kMemtagOverrideSyspropPrefix[] =
+ "persist.device_config.memory_safety_native.mode_override.process.";
const char* progname = __libc_shared_globals()->init_progname;
if (progname == nullptr) return false;
const char* basename = __gnu_basename(progname);
- static constexpr size_t kOptionsSize = PROP_VALUE_MAX;
- char options_str[kOptionsSize];
- size_t sysprop_size = strlen(basename) + strlen(kMemtagPrognameSyspropPrefix) + 1;
- char* sysprop_name = static_cast<char*>(alloca(sysprop_size));
-
- async_safe_format_buffer(sysprop_name, sysprop_size, "%s%s", kMemtagPrognameSyspropPrefix,
+ char options_str[PROP_VALUE_MAX];
+ char sysprop_name[512];
+ async_safe_format_buffer(sysprop_name, sizeof(sysprop_name), "%s%s", kMemtagPrognameSyspropPrefix,
basename);
- const char* sys_prop_names[] = {sysprop_name, kMemtagGlobalSysprop};
+ char remote_sysprop_name[512];
+ async_safe_format_buffer(remote_sysprop_name, sizeof(remote_sysprop_name), "%s%s",
+ kMemtagOverrideSyspropPrefix, basename);
+ const char* sys_prop_names[] = {sysprop_name, remote_sysprop_name, kMemtagGlobalSysprop};
if (!get_config_from_env_or_sysprops("MEMTAG_OPTIONS", sys_prop_names, arraysize(sys_prop_names),
- options_str, kOptionsSize)) {
+ options_str, sizeof(options_str))) {
return false;
}
@@ -259,17 +263,18 @@
// M_HEAP_TAGGING_LEVEL_NONE, if MTE isn't enabled for this process we enable
// M_HEAP_TAGGING_LEVEL_TBI.
static HeapTaggingLevel __get_heap_tagging_level(const void* phdr_start, size_t phdr_ct,
- uintptr_t load_bias) {
+ uintptr_t load_bias, bool* stack) {
+ unsigned note_val =
+ __get_memtag_note(reinterpret_cast<const ElfW(Phdr)*>(phdr_start), phdr_ct, load_bias);
+ *stack = note_val & NT_MEMTAG_STACK;
+
HeapTaggingLevel level;
if (get_environment_memtag_setting(&level)) return level;
- unsigned note_val =
- __get_memtag_note(reinterpret_cast<const ElfW(Phdr)*>(phdr_start), phdr_ct, load_bias);
-
// Note, previously (in Android 12), any value outside of bits [0..3] resulted
// in a check-fail. In order to be permissive of further extensions, we
- // relaxed this restriction. For now, we still only support MTE heap.
- if (!(note_val & NT_MEMTAG_HEAP)) return M_HEAP_TAGGING_LEVEL_TBI;
+ // relaxed this restriction.
+ if (!(note_val & (NT_MEMTAG_HEAP | NT_MEMTAG_STACK))) return M_HEAP_TAGGING_LEVEL_TBI;
unsigned mode = note_val & NT_MEMTAG_LEVEL_MASK;
switch (mode) {
@@ -295,9 +300,47 @@
// This function is called from the linker before the main executable is relocated.
__attribute__((no_sanitize("hwaddress", "memtag"))) void __libc_init_mte(const void* phdr_start,
size_t phdr_ct,
- uintptr_t load_bias) {
- HeapTaggingLevel level = __get_heap_tagging_level(phdr_start, phdr_ct, load_bias);
-
+ uintptr_t load_bias,
+ void* stack_top) {
+ bool memtag_stack;
+ HeapTaggingLevel level = __get_heap_tagging_level(phdr_start, phdr_ct, load_bias, &memtag_stack);
+ char* env = getenv("BIONIC_MEMTAG_UPGRADE_SECS");
+ static const char kAppProcessName[] = "app_process64";
+ const char* progname = __libc_shared_globals()->init_progname;
+ progname = progname ? __gnu_basename(progname) : nullptr;
+ if (progname &&
+ strncmp(progname, kAppProcessName, sizeof(kAppProcessName)) == 0) {
+ // disable timed upgrade for zygote, as the thread spawned will violate the requirement
+ // that it be single-threaded.
+ env = nullptr;
+ }
+ int64_t timed_upgrade = 0;
+ if (env) {
+ char* endptr;
+ timed_upgrade = strtoll(env, &endptr, 10);
+ if (*endptr != '\0' || timed_upgrade < 0) {
+ async_safe_format_log(ANDROID_LOG_ERROR, "libc",
+ "Invalid value for BIONIC_MEMTAG_UPGRADE_SECS: %s",
+ env);
+ timed_upgrade = 0;
+ }
+ // Make sure that this does not get passed to potential processes inheriting
+ // this environment.
+ unsetenv("BIONIC_MEMTAG_UPGRADE_SECS");
+ }
+ if (timed_upgrade) {
+ if (level == M_HEAP_TAGGING_LEVEL_ASYNC) {
+ async_safe_format_log(ANDROID_LOG_INFO, "libc",
+ "Attempting timed MTE upgrade from async to sync.");
+ __libc_shared_globals()->heap_tagging_upgrade_timer_sec = timed_upgrade;
+ level = M_HEAP_TAGGING_LEVEL_SYNC;
+ } else if (level != M_HEAP_TAGGING_LEVEL_SYNC) {
+ async_safe_format_log(
+ ANDROID_LOG_ERROR, "libc",
+ "Requested timed MTE upgrade from invalid %s to sync. Ignoring.",
+ DescribeTaggingLevel(level));
+ }
+ }
if (level == M_HEAP_TAGGING_LEVEL_SYNC || level == M_HEAP_TAGGING_LEVEL_ASYNC) {
unsigned long prctl_arg = PR_TAGGED_ADDR_ENABLE | PR_MTE_TAG_SET_NONZERO;
prctl_arg |= (level == M_HEAP_TAGGING_LEVEL_SYNC) ? PR_MTE_TCF_SYNC : PR_MTE_TCF_ASYNC;
@@ -308,6 +351,17 @@
if (prctl(PR_SET_TAGGED_ADDR_CTRL, prctl_arg | PR_MTE_TCF_SYNC, 0, 0, 0) == 0 ||
prctl(PR_SET_TAGGED_ADDR_CTRL, prctl_arg, 0, 0, 0) == 0) {
__libc_shared_globals()->initial_heap_tagging_level = level;
+ __libc_shared_globals()->initial_memtag_stack = memtag_stack;
+
+ if (memtag_stack) {
+ void* page_start =
+ reinterpret_cast<void*>(PAGE_START(reinterpret_cast<uintptr_t>(stack_top)));
+ if (mprotect(page_start, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_MTE | PROT_GROWSDOWN)) {
+ async_safe_fatal("error: failed to set PROT_MTE on main thread stack: %s\n",
+ strerror(errno));
+ }
+ }
+
return;
}
}
@@ -317,9 +371,11 @@
if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0) {
__libc_shared_globals()->initial_heap_tagging_level = M_HEAP_TAGGING_LEVEL_TBI;
}
+ // We did not enable MTE, so we do not need to arm the upgrade timer.
+ __libc_shared_globals()->heap_tagging_upgrade_timer_sec = 0;
}
#else // __aarch64__
-void __libc_init_mte(const void*, size_t, uintptr_t) {}
+void __libc_init_mte(const void*, size_t, uintptr_t, void*) {}
#endif // __aarch64__
void __libc_init_profiling_handlers() {
@@ -331,11 +387,9 @@
signal(BIONIC_SIGNAL_ART_PROFILER, SIG_IGN);
}
-__noreturn static void __real_libc_init(void *raw_args,
- void (*onexit)(void) __unused,
- int (*slingshot)(int, char**, char**),
- structors_array_t const * const structors,
- bionic_tcb* temp_tcb) {
+__attribute__((no_sanitize("memtag"))) __noreturn static void __real_libc_init(
+ void* raw_args, void (*onexit)(void) __unused, int (*slingshot)(int, char**, char**),
+ structors_array_t const* const structors, bionic_tcb* temp_tcb) {
BIONIC_STOP_UNWIND;
// Initialize TLS early so system calls and errno work.
@@ -349,7 +403,7 @@
__libc_init_main_thread_final();
__libc_init_common();
__libc_init_mte(reinterpret_cast<ElfW(Phdr)*>(getauxval(AT_PHDR)), getauxval(AT_PHNUM),
- /*load_bias = */ 0);
+ /*load_bias = */ 0, /*stack_top = */ raw_args);
__libc_init_scudo();
__libc_init_profiling_handlers();
__libc_init_fork_handler();
@@ -370,6 +424,8 @@
__cxa_atexit(__libc_fini,structors->fini_array,nullptr);
}
+ __libc_init_mte_late();
+
exit(slingshot(args.argc, args.argv, args.envp));
}
@@ -379,11 +435,9 @@
//
// The 'structors' parameter contains pointers to various initializer
// arrays that must be run before the program's 'main' routine is launched.
-__attribute__((no_sanitize("hwaddress")))
-__noreturn void __libc_init(void* raw_args,
- void (*onexit)(void) __unused,
- int (*slingshot)(int, char**, char**),
- structors_array_t const * const structors) {
+__attribute__((no_sanitize("hwaddress", "memtag"))) __noreturn void __libc_init(
+ void* raw_args, void (*onexit)(void) __unused, int (*slingshot)(int, char**, char**),
+ structors_array_t const* const structors) {
bionic_tcb temp_tcb = {};
#if __has_feature(hwaddress_sanitizer)
// Install main thread TLS early. It will be initialized later in __libc_init_main_thread. For now
diff --git a/libc/bionic/locale.cpp b/libc/bionic/locale.cpp
index 0b7037a..2f4d206 100644
--- a/libc/bionic/locale.cpp
+++ b/libc/bionic/locale.cpp
@@ -54,23 +54,23 @@
struct __locale_t {
size_t mb_cur_max;
-
- explicit __locale_t(size_t mb_cur_max) : mb_cur_max(mb_cur_max) {
- }
-
- explicit __locale_t(const __locale_t* other) {
- if (other == LC_GLOBAL_LOCALE) {
- mb_cur_max = __bionic_current_locale_is_utf8 ? 4 : 1;
- } else {
- mb_cur_max = other->mb_cur_max;
- }
- }
-
- BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(__locale_t);
};
-size_t __ctype_get_mb_cur_max() {
- locale_t l = uselocale(nullptr);
+// Avoid using new/delete in this file, because a user may have overridden
+// new/delete, and we want to avoid making extraneous calls to them. This isn't
+// an issue for libc.so in the platform, but this file is also compiled into the
+// NDK's libandroid_support.a, and there are libc++ tests that count the number
+// of calls to new/delete.
+#pragma clang poison new delete
+
+static inline locale_t __alloc_locale(size_t mb_cur_max) {
+ auto result = static_cast<__locale_t*>(malloc(sizeof(__locale_t)));
+ if (result == nullptr) return nullptr;
+ result->mb_cur_max = mb_cur_max;
+ return result;
+}
+
+static inline size_t get_locale_mb_cur_max(locale_t l) {
if (l == LC_GLOBAL_LOCALE) {
return __bionic_current_locale_is_utf8 ? 4 : 1;
} else {
@@ -78,6 +78,10 @@
}
}
+size_t __ctype_get_mb_cur_max() {
+ return get_locale_mb_cur_max(uselocale(nullptr));
+}
+
#if !USE_TLS_SLOT
static thread_local locale_t g_current_locale;
#endif
@@ -133,11 +137,11 @@
}
locale_t duplocale(locale_t l) {
- return new __locale_t(l);
+ return __alloc_locale(get_locale_mb_cur_max(l));
}
void freelocale(locale_t l) {
- delete l;
+ free(l);
}
locale_t newlocale(int category_mask, const char* locale_name, locale_t /*base*/) {
@@ -152,7 +156,7 @@
return nullptr;
}
- return new __locale_t(__is_utf8_locale(locale_name) ? 4 : 1);
+ return __alloc_locale(__is_utf8_locale(locale_name) ? 4 : 1);
}
char* setlocale(int category, const char* locale_name) {
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
index 9744968..e159fdc 100644
--- a/libc/bionic/malloc_common.cpp
+++ b/libc/bionic/malloc_common.cpp
@@ -333,6 +333,14 @@
return EnableGwpAsan(*reinterpret_cast<android_mallopt_gwp_asan_options_t*>(arg));
}
+ if (opcode == M_MEMTAG_STACK_IS_ON) {
+ if (arg == nullptr || arg_size != sizeof(bool)) {
+ errno = EINVAL;
+ return false;
+ }
+ *reinterpret_cast<bool*>(arg) = atomic_load(&__libc_globals->memtag_stack);
+ return true;
+ }
errno = ENOTSUP;
return false;
}
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
index 6c2f4d9..802a94f 100644
--- a/libc/bionic/malloc_common_dynamic.cpp
+++ b/libc/bionic/malloc_common_dynamic.cpp
@@ -371,6 +371,7 @@
extern "C" const char* __scudo_get_stack_depot_addr();
extern "C" const char* __scudo_get_region_info_addr();
extern "C" const char* __scudo_get_ring_buffer_addr();
+extern "C" size_t __scudo_get_ring_buffer_size();
// Initializes memory allocation framework once per process.
static void MallocInitImpl(libc_globals* globals) {
@@ -383,6 +384,7 @@
__libc_shared_globals()->scudo_stack_depot = __scudo_get_stack_depot_addr();
__libc_shared_globals()->scudo_region_info = __scudo_get_region_info_addr();
__libc_shared_globals()->scudo_ring_buffer = __scudo_get_ring_buffer_addr();
+ __libc_shared_globals()->scudo_ring_buffer_size = __scudo_get_ring_buffer_size();
#endif
// Prefer malloc debug since it existed first and is a more complete
@@ -533,6 +535,14 @@
return EnableGwpAsan(*reinterpret_cast<android_mallopt_gwp_asan_options_t*>(arg));
}
+ if (opcode == M_MEMTAG_STACK_IS_ON) {
+ if (arg == nullptr || arg_size != sizeof(bool)) {
+ errno = EINVAL;
+ return false;
+ }
+ *reinterpret_cast<bool*>(arg) = atomic_load(&__libc_globals->memtag_stack);
+ return true;
+ }
// Try heapprofd's mallopt, as it handles options not covered here.
return HeapprofdMallopt(opcode, arg, arg_size);
}
diff --git a/libc/include/android/legacy_errno_inlines.h b/libc/bionic/memset_explicit.cpp
similarity index 81%
copy from libc/include/android/legacy_errno_inlines.h
copy to libc/bionic/memset_explicit.cpp
index fcbca13..2bcc20c 100644
--- a/libc/include/android/legacy_errno_inlines.h
+++ b/libc/bionic/memset_explicit.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,11 @@
* SUCH DAMAGE.
*/
-#pragma once
+#include <string.h>
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 21
-
-#include <errno.h>
-
-__BEGIN_DECLS
-
-static __inline int __attribute__((deprecated)) __set_errno(int n) {
- errno = n;
- return -1;
+void* memset_explicit(void* __dst, int __ch, size_t __n) {
+ void* result = memset(__dst, __ch, __n);
+ // https://bugs.llvm.org/show_bug.cgi?id=15495
+ __asm__ __volatile__("" : : "r"(__dst) : "memory");
+ return result;
}
-
-__END_DECLS
-
-#endif
diff --git a/libc/bionic/mmap.cpp b/libc/bionic/mmap.cpp
index 9aad0b3..ed6b9c6 100644
--- a/libc/bionic/mmap.cpp
+++ b/libc/bionic/mmap.cpp
@@ -39,37 +39,20 @@
#define MMAP2_SHIFT 12 // 2**12 == 4096
-static bool kernel_has_MADV_MERGEABLE = true;
-
void* mmap64(void* addr, size_t size, int prot, int flags, int fd, off64_t offset) {
if (offset < 0 || (offset & ((1UL << MMAP2_SHIFT)-1)) != 0) {
errno = EINVAL;
return MAP_FAILED;
}
- // prevent allocations large enough for `end - start` to overflow
+ // Prevent allocations large enough for `end - start` to overflow.
size_t rounded = __BIONIC_ALIGN(size, PAGE_SIZE);
if (rounded < size || rounded > PTRDIFF_MAX) {
errno = ENOMEM;
return MAP_FAILED;
}
- bool is_private_anonymous =
- (flags & (MAP_PRIVATE | MAP_ANONYMOUS)) == (MAP_PRIVATE | MAP_ANONYMOUS);
- bool is_stack_or_grows_down = (flags & (MAP_STACK | MAP_GROWSDOWN)) != 0;
-
- void* result = __mmap2(addr, size, prot, flags, fd, offset >> MMAP2_SHIFT);
-
- if (result != MAP_FAILED && kernel_has_MADV_MERGEABLE &&
- is_private_anonymous && !is_stack_or_grows_down) {
- ErrnoRestorer errno_restorer;
- int rc = madvise(result, size, MADV_MERGEABLE);
- if (rc == -1 && errno == EINVAL) {
- kernel_has_MADV_MERGEABLE = false;
- }
- }
-
- return result;
+ return __mmap2(addr, size, prot, flags, fd, offset >> MMAP2_SHIFT);
}
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset) {
diff --git a/libc/bionic/pthread_cond.cpp b/libc/bionic/pthread_cond.cpp
index 793dcd9..f444676 100644
--- a/libc/bionic/pthread_cond.cpp
+++ b/libc/bionic/pthread_cond.cpp
@@ -249,15 +249,18 @@
}
#if !defined(__LP64__)
-// TODO: this exists only for backward binary compatibility on 32 bit platforms.
+// This exists only for backward binary compatibility on 32 bit platforms.
+// (This is actually a _new_ function in API 28 that we could only implement for LP64.)
extern "C" int pthread_cond_timedwait_monotonic(pthread_cond_t* cond_interface,
pthread_mutex_t* mutex,
const timespec* abs_timeout) {
return pthread_cond_timedwait_monotonic_np(cond_interface, mutex, abs_timeout);
}
+#endif
-// Force this function using CLOCK_MONOTONIC because it was always using
-// CLOCK_MONOTONIC in history.
+#if !defined(__LP64__)
+// This exists only for backward binary compatibility on 32 bit platforms.
+// (This function never existed for LP64.)
extern "C" int pthread_cond_timedwait_relative_np(pthread_cond_t* cond_interface,
pthread_mutex_t* mutex,
const timespec* rel_timeout) {
@@ -269,11 +272,15 @@
}
return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, false, abs_timeout);
}
+#endif
+#if !defined(__LP64__)
+// This exists only for backward binary compatibility on 32 bit platforms.
+// (This function never existed for LP64.)
extern "C" int pthread_cond_timeout_np(pthread_cond_t* cond_interface,
pthread_mutex_t* mutex, unsigned ms) {
timespec ts;
timespec_from_ms(ts, ms);
return pthread_cond_timedwait_relative_np(cond_interface, mutex, &ts);
}
-#endif // !defined(__LP64__)
+#endif
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 121b26f..7bf9b40 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -40,15 +40,16 @@
#include <async_safe/log.h>
+#include "platform/bionic/macros.h"
+#include "platform/bionic/mte.h"
+#include "private/ErrnoRestorer.h"
#include "private/ScopedRWLock.h"
#include "private/bionic_constants.h"
#include "private/bionic_defs.h"
#include "private/bionic_globals.h"
-#include "platform/bionic/macros.h"
#include "private/bionic_ssp.h"
#include "private/bionic_systrace.h"
#include "private/bionic_tls.h"
-#include "private/ErrnoRestorer.h"
// x86 uses segment descriptors rather than a direct pointer to TLS.
#if defined(__i386__)
@@ -88,7 +89,13 @@
static void __init_alternate_signal_stack(pthread_internal_t* thread) {
// Create and set an alternate signal stack.
- void* stack_base = mmap(nullptr, SIGNAL_STACK_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ int prot = PROT_READ | PROT_WRITE;
+#ifdef __aarch64__
+ if (atomic_load(&__libc_globals->memtag_stack)) {
+ prot |= PROT_MTE;
+ }
+#endif
+ void* stack_base = mmap(nullptr, SIGNAL_STACK_SIZE, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (stack_base != MAP_FAILED) {
// Create a guard to catch stack overflows in signal handlers.
if (mprotect(stack_base, PTHREAD_GUARD_SIZE, PROT_NONE) == -1) {
@@ -109,14 +116,14 @@
}
static void __init_shadow_call_stack(pthread_internal_t* thread __unused) {
-#ifdef __aarch64__
+#if defined(__aarch64__) || defined(__riscv)
// Allocate the stack and the guard region.
char* scs_guard_region = reinterpret_cast<char*>(
mmap(nullptr, SCS_GUARD_REGION_SIZE, 0, MAP_PRIVATE | MAP_ANON, -1, 0));
thread->shadow_call_stack_guard_region = scs_guard_region;
// The address is aligned to SCS_SIZE so that we only need to store the lower log2(SCS_SIZE) bits
- // in jmp_buf.
+ // in jmp_buf. See the SCS commentary in pthread_internal.h for more detail.
char* scs_aligned_guard_region =
reinterpret_cast<char*>(align_up(reinterpret_cast<uintptr_t>(scs_guard_region), SCS_SIZE));
@@ -126,11 +133,15 @@
size_t scs_offset =
(getpid() == 1) ? 0 : (arc4random_uniform(SCS_GUARD_REGION_SIZE / SCS_SIZE - 1) * SCS_SIZE);
- // Make the stack readable and writable and store its address in register x18. This is
- // deliberately the only place where the address is stored.
- char *scs = scs_aligned_guard_region + scs_offset;
+ // Make the stack read-write, and store its address in the register we're using as the shadow
+ // stack pointer. This is deliberately the only place where the address is stored.
+ char* scs = scs_aligned_guard_region + scs_offset;
mprotect(scs, SCS_SIZE, PROT_READ | PROT_WRITE);
+#if defined(__aarch64__)
__asm__ __volatile__("mov x18, %0" ::"r"(scs));
+#elif defined(__riscv)
+ __asm__ __volatile__("mv gp, %0" ::"r"(scs));
+#endif
#endif
}
@@ -224,12 +235,19 @@
return {};
}
const size_t writable_size = mmap_size - stack_guard_size - PTHREAD_GUARD_SIZE;
- if (mprotect(space + stack_guard_size,
- writable_size,
- PROT_READ | PROT_WRITE) != 0) {
- async_safe_format_log(ANDROID_LOG_WARN, "libc",
- "pthread_create failed: couldn't mprotect R+W %zu-byte thread mapping region: %s",
- writable_size, strerror(errno));
+ int prot = PROT_READ | PROT_WRITE;
+ const char* prot_str = "R+W";
+#ifdef __aarch64__
+ if (atomic_load(&__libc_globals->memtag_stack)) {
+ prot |= PROT_MTE;
+ prot_str = "R+W+MTE";
+ }
+#endif
+ if (mprotect(space + stack_guard_size, writable_size, prot) != 0) {
+ async_safe_format_log(
+ ANDROID_LOG_WARN, "libc",
+ "pthread_create failed: couldn't mprotect %s %zu-byte thread mapping region: %s", prot_str,
+ writable_size, strerror(errno));
munmap(space, mmap_size);
return {};
}
diff --git a/libc/bionic/pthread_exit.cpp b/libc/bionic/pthread_exit.cpp
index bde95ec..f584b27 100644
--- a/libc/bionic/pthread_exit.cpp
+++ b/libc/bionic/pthread_exit.cpp
@@ -117,7 +117,7 @@
__rt_sigprocmask(SIG_BLOCK, &set, nullptr, sizeof(sigset64_t));
}
-#ifdef __aarch64__
+#if defined(__aarch64__) || defined(__riscv)
// Free the shadow call stack and guard pages.
munmap(thread->shadow_call_stack_guard_region, SCS_GUARD_REGION_SIZE);
#endif
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 071a5bc..a3a4ccd 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -105,9 +105,14 @@
void* alternate_signal_stack;
- // The start address of the shadow call stack's guard region (arm64 only).
+ // The start address of the shadow call stack's guard region (arm64/riscv64).
+ // This region is SCS_GUARD_REGION_SIZE bytes large, but only SCS_SIZE bytes
+ // are actually used.
+ //
// This address is only used to deallocate the shadow call stack on thread
- // exit; the address of the stack itself is stored only in the x18 register.
+ // exit; the address of the stack itself is stored only in the register used
+ // as the shadow stack pointer (x18 on arm64, gp on riscv64).
+ //
// Because the protection offered by SCS relies on the secrecy of the stack
// address, storing the address here weakens the protection, but only
// slightly, because it is relatively easy for an attacker to discover the
@@ -115,13 +120,24 @@
// to other allocations), but not the stack itself, which is <0.1% of the size
// of the guard region.
//
+ // longjmp()/setjmp() don't store all the bits of the shadow stack pointer,
+ // only the bottom bits covered by SCS_MASK. Since longjmp()/setjmp() between
+ // different threads is undefined behavior (and unsupported on Android), we
+ // can retrieve the high bits of the shadow stack pointer from the current
+ // value in the register --- all the jmp_buf needs to store is where exactly
+ // the shadow stack pointer is *within* the thread's shadow stack: the bottom
+ // bits of the register.
+ //
// There are at least two other options for discovering the start address of
// the guard region on thread exit, but they are not as simple as storing in
// TLS.
- // 1) Derive it from the value of the x18 register. This is only possible in
- // processes that do not contain legacy code that might clobber x18,
- // therefore each process must declare early during process startup whether
- // it might load legacy code.
+ //
+ // 1) Derive it from the current value of the shadow stack pointer. This is
+ // only possible in processes that do not contain legacy code that might
+ // clobber x18 on arm64, therefore each process must declare early during
+ // process startup whether it might load legacy code.
+ // TODO: riscv64 has no legacy code, so we can actually go this route
+ // there, but hopefully we'll actually get the Zsslpcfi extension instead.
// 2) Mark the guard region as such using prctl(PR_SET_VMA_ANON_NAME) and
// discover its address by reading /proc/self/maps. One issue with this is
// that reading /proc/self/maps can race with allocations, so we may need
@@ -160,6 +176,13 @@
bionic_tls* bionic_tls;
int errno_value;
+
+ // The last observed value of SP in a vfork child process.
+ // The part of the stack between this address and the value of SP when the vfork parent process
+ // regains control may have stale MTE tags and needs cleanup. This field is only meaningful while
+ // the parent is waiting for the vfork child to return control by calling either exec*() or
+ // exit().
+ void* vfork_child_stack_bottom;
};
struct ThreadMapping {
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp
index a15e981..9b37225 100644
--- a/libc/bionic/pthread_mutex.cpp
+++ b/libc/bionic/pthread_mutex.cpp
@@ -945,6 +945,8 @@
}
#if !defined(__LP64__)
+// This exists only for backward binary compatibility on 32 bit platforms.
+// (This function never existed for LP64.)
extern "C" int pthread_mutex_lock_timeout_np(pthread_mutex_t* mutex_interface, unsigned ms) {
timespec ts;
timespec_from_ms(ts, ms);
diff --git a/libc/bionic/rename.cpp b/libc/bionic/rename.cpp
index 8295559..89786f7 100644
--- a/libc/bionic/rename.cpp
+++ b/libc/bionic/rename.cpp
@@ -30,5 +30,9 @@
#include <stdio.h>
int rename(const char* old_path, const char* new_path) {
- return renameat(AT_FDCWD, old_path, AT_FDCWD, new_path);
+ return renameat2(AT_FDCWD, old_path, AT_FDCWD, new_path, 0);
+}
+
+int renameat(int old_dir_fd, const char* old_path, int new_dir_fd, const char* new_path) {
+ return renameat2(old_dir_fd, old_path, new_dir_fd, new_path, 0);
}
diff --git a/libc/bionic/scandir.cpp b/libc/bionic/scandir.cpp
index f528286..0acef36 100644
--- a/libc/bionic/scandir.cpp
+++ b/libc/bionic/scandir.cpp
@@ -69,11 +69,8 @@
}
void Sort(int (*comparator)(const dirent**, const dirent**)) {
- // If we have entries and a comparator, sort them.
- if (size_ > 0 && comparator != nullptr) {
- qsort(names_, size_, sizeof(dirent*),
- reinterpret_cast<int (*)(const void*, const void*)>(comparator));
- }
+ qsort(names_, size_, sizeof(dirent*),
+ reinterpret_cast<int (*)(const void*, const void*)>(comparator));
}
private:
@@ -120,7 +117,9 @@
names.Add(entry);
}
- names.Sort(comparator);
+ if (comparator != nullptr) {
+ names.Sort(comparator);
+ }
size_t size = names.size();
*name_list = names.release();
diff --git a/libc/bionic/spawn.cpp b/libc/bionic/spawn.cpp
index 59f7631..5d76f77 100644
--- a/libc/bionic/spawn.cpp
+++ b/libc/bionic/spawn.cpp
@@ -52,7 +52,7 @@
// mark all open fds except stdin/out/err as close-on-exec
static int cloexec_except_stdioe() {
// requires 5.11+ or ACK 5.10-T kernel, otherwise returns ENOSYS or EINVAL
- if (!syscall(SYS_close_range, 3, ~0U, CLOSE_RANGE_CLOEXEC)) return 0;
+ if (!close_range(3, ~0U, CLOSE_RANGE_CLOEXEC)) return 0;
// unfortunately getrlimit can lie:
// - both soft and hard limits can be lowered to 0, with fds still open, so it can underestimate
@@ -68,7 +68,9 @@
enum Action {
kOpen,
kClose,
- kDup2
+ kDup2,
+ kChdir,
+ kFchdir,
};
struct __posix_spawn_file_action {
@@ -93,6 +95,10 @@
} else if (what == kClose) {
// Failure to close is ignored.
close(fd);
+ } else if (what == kChdir) {
+ if (chdir(path) == -1) _exit(127);
+ } else if (what == kFchdir) {
+ if (fchdir(fd) == -1) _exit(127);
} else {
// It's a dup2.
if (fd == new_fd) {
@@ -340,7 +346,7 @@
if (action == nullptr) return errno;
action->next = nullptr;
- if (path != nullptr) {
+ if (what == kOpen || what == kChdir) {
action->path = strdup(path);
if (action->path == nullptr) {
free(action);
@@ -380,3 +386,12 @@
if (fd < 0 || new_fd < 0) return EBADF;
return posix_spawn_add_file_action(actions, kDup2, fd, new_fd, nullptr, 0, 0);
}
+
+int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t* actions, const char* path) {
+ return posix_spawn_add_file_action(actions, kChdir, -1, -1, path, 0, 0);
+}
+
+int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t* actions, int fd) {
+ if (fd < 0) return EBADF;
+ return posix_spawn_add_file_action(actions, kFchdir, fd, -1, nullptr, 0, 0);
+}
diff --git a/libc/bionic/strtol.cpp b/libc/bionic/strtol.cpp
index 77f1d92..05b4b53 100644
--- a/libc/bionic/strtol.cpp
+++ b/libc/bionic/strtol.cpp
@@ -32,11 +32,13 @@
#include <inttypes.h>
#include <limits.h>
#include <stdlib.h>
+#include <wchar.h>
-template <typename T, T Min, T Max> T StrToI(const char* nptr, char** endptr, int base) {
+template <typename T, T Min, T Max, typename CharT>
+T StrToI(const CharT* nptr, CharT** endptr, int base) {
// Ensure that base is between 2 and 36 inclusive, or the special value of 0.
if (base < 0 || base == 1 || base > 36) {
- if (endptr != nullptr) *endptr = const_cast<char*>(nptr);
+ if (endptr != nullptr) *endptr = const_cast<CharT*>(nptr);
errno = EINVAL;
return 0;
}
@@ -44,7 +46,7 @@
// Skip white space and pick up leading +/- sign if any.
// If base is 0, allow 0x for hex and 0 for octal, else
// assume decimal; if base is already 16, allow 0x.
- const char* s = nptr;
+ const CharT* s = nptr;
int c;
do {
c = *s++;
@@ -62,6 +64,11 @@
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) && c == '0' && (*s == 'b' || *s == 'B') && isdigit(s[1])) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0) base = (c == '0') ? 8 : 10;
// We always work in the negative space because the most negative value has a
@@ -91,7 +98,7 @@
acc -= c;
}
}
- if (endptr != nullptr) *endptr = const_cast<char*>(any ? s - 1 : nptr);
+ if (endptr != nullptr) *endptr = const_cast<CharT*>(any ? s - 1 : nptr);
if (!neg) {
if (acc == Min) {
errno = ERANGE;
@@ -103,14 +110,15 @@
return acc;
}
-template <typename T, T Max> T StrToU(const char* nptr, char** endptr, int base) {
+template <typename T, T Max, typename CharT>
+T StrToU(const CharT* nptr, CharT** endptr, int base) {
if (base < 0 || base == 1 || base > 36) {
- if (endptr != nullptr) *endptr = const_cast<char*>(nptr);
+ if (endptr != nullptr) *endptr = const_cast<CharT*>(nptr);
errno = EINVAL;
return 0;
}
- const char* s = nptr;
+ const CharT* s = nptr;
int c;
do {
c = *s++;
@@ -128,6 +136,11 @@
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) && c == '0' && (*s == 'b' || *s == 'B') && isdigit(s[1])) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0) base = (c == '0') ? 8 : 10;
T cutoff = Max / static_cast<T>(base);
@@ -155,7 +168,7 @@
}
}
if (neg && any > 0) acc = -acc;
- if (endptr != nullptr) *endptr = const_cast<char*>(any ? s - 1 : nptr);
+ if (endptr != nullptr) *endptr = const_cast<CharT*>(any ? s - 1 : nptr);
return acc;
}
@@ -172,31 +185,49 @@
}
intmax_t strtoimax(const char* s, char** end, int base) {
- return StrToI<intmax_t, INTMAX_MIN, INTMAX_MAX>(s, end, base);
+ return StrToI<intmax_t, INTMAX_MIN, INTMAX_MAX, char>(s, end, base);
+}
+
+intmax_t wcstoimax(const wchar_t* s, wchar_t** end, int base) {
+ return StrToI<intmax_t, INTMAX_MIN, INTMAX_MAX, wchar_t>(s, end, base);
}
long strtol(const char* s, char** end, int base) {
- return StrToI<long, LONG_MIN, LONG_MAX>(s, end, base);
+ return StrToI<long, LONG_MIN, LONG_MAX, char>(s, end, base);
+}
+
+long wcstol(const wchar_t* s, wchar_t** end, int base) {
+ return StrToI<long, LONG_MIN, LONG_MAX, wchar_t>(s, end, base);
}
long long strtoll(const char* s, char** end, int base) {
- return StrToI<long long, LLONG_MIN, LLONG_MAX>(s, end, base);
+ return StrToI<long long, LLONG_MIN, LLONG_MAX, char>(s, end, base);
}
-// Public API since L, but not in any header.
-__strong_alias(strtoq, strtoll);
+long long wcstoll(const wchar_t* s, wchar_t** end, int base) {
+ return StrToI<long long, LLONG_MIN, LLONG_MAX, wchar_t>(s, end, base);
+}
unsigned long strtoul(const char* s, char** end, int base) {
- return StrToU<unsigned long, ULONG_MAX>(s, end, base);
+ return StrToU<unsigned long, ULONG_MAX, char>(s, end, base);
+}
+
+unsigned long wcstoul(const wchar_t* s, wchar_t** end, int base) {
+ return StrToU<unsigned long, ULONG_MAX, wchar_t>(s, end, base);
}
unsigned long long strtoull(const char* s, char** end, int base) {
- return StrToU<unsigned long long, ULLONG_MAX>(s, end, base);
+ return StrToU<unsigned long long, ULLONG_MAX, char>(s, end, base);
+}
+
+unsigned long long wcstoull(const wchar_t* s, wchar_t** end, int base) {
+ return StrToU<unsigned long long, ULLONG_MAX, wchar_t>(s, end, base);
}
uintmax_t strtoumax(const char* s, char** end, int base) {
- return StrToU<uintmax_t, UINTMAX_MAX>(s, end, base);
+ return StrToU<uintmax_t, UINTMAX_MAX, char>(s, end, base);
}
-// Public API since L, but not in any header.
-__strong_alias(strtouq, strtoull);
+uintmax_t wcstoumax(const wchar_t* s, wchar_t** end, int base) {
+ return StrToU<uintmax_t, UINTMAX_MAX, wchar_t>(s, end, base);
+}
diff --git a/libc/bionic/sys_statvfs.cpp b/libc/bionic/sys_statvfs.cpp
index ef5dc57..b3a0aca 100644
--- a/libc/bionic/sys_statvfs.cpp
+++ b/libc/bionic/sys_statvfs.cpp
@@ -14,17 +14,36 @@
* limitations under the License.
*/
+#include <sys/statfs.h>
#include <sys/statvfs.h>
-// libc++ uses statvfs (for Darwin compatibility), but on Linux statvfs is
-// just another name for statfs, so it didn't arrive until API level 19. We
-// make the implementation available as inlines to support std::filesystem
-// for NDK users (see https://github.com/android-ndk/ndk/issues/609).
+static __inline void __bionic_statfs_to_statvfs(const struct statfs* src, struct statvfs* dst) {
+ dst->f_bsize = src->f_bsize;
+ dst->f_frsize = src->f_frsize;
+ dst->f_blocks = src->f_blocks;
+ dst->f_bfree = src->f_bfree;
+ dst->f_bavail = src->f_bavail;
+ dst->f_files = src->f_files;
+ dst->f_ffree = src->f_ffree;
+ dst->f_favail = src->f_ffree;
+ dst->f_fsid = src->f_fsid.__val[0] | static_cast<uint64_t>(src->f_fsid.__val[1]) << 32;
+ dst->f_flag = src->f_flags;
+ dst->f_namemax = src->f_namelen;
+}
-#define __BIONIC_SYS_STATVFS_INLINE /* Out of line. */
-#define __BIONIC_NEED_STATVFS_INLINES
-#undef __BIONIC_NEED_STATVFS64_INLINES
-#include <bits/sys_statvfs_inlines.h>
+int statvfs(const char* path, struct statvfs* result) {
+ struct statfs tmp;
+ if (statfs(path, &tmp) == -1) return -1;
+ __bionic_statfs_to_statvfs(&tmp, result);
+ return 0;
+}
+
+int fstatvfs(int fd, struct statvfs* result) {
+ struct statfs tmp;
+ if (fstatfs(fd, &tmp) == -1) return -1;
+ __bionic_statfs_to_statvfs(&tmp, result);
+ return 0;
+}
// Historically we provided actual symbols for statvfs64 and fstatvfs64.
// They're not particularly useful, but we can't take them away.
diff --git a/libc/bionic/sysconf.cpp b/libc/bionic/sysconf.cpp
index dd6b129..1c06c9e 100644
--- a/libc/bionic/sysconf.cpp
+++ b/libc/bionic/sysconf.cpp
@@ -88,7 +88,7 @@
case _SC_PAGESIZE:
case _SC_PAGE_SIZE:
// _SC_PAGESIZE and _SC_PAGE_SIZE are distinct, but return the same value.
- return static_cast<long>(getauxval(AT_PAGESZ));
+ return getpagesize();
case _SC_PHYS_PAGES: return get_phys_pages();
diff --git a/libc/bionic/sysinfo.cpp b/libc/bionic/sysinfo.cpp
index 7ab8e9e..1e4a0e8 100644
--- a/libc/bionic/sysinfo.cpp
+++ b/libc/bionic/sysinfo.cpp
@@ -36,47 +36,31 @@
#include "private/get_cpu_count_from_string.h"
#include "private/ScopedReaddir.h"
-static bool __matches_cpuN(const char* s) {
- // The %c trick is to ensure that we have the anchored match "^cpu[0-9]+$".
- // We can't use %*c because the return value is how many were *assigned*.
- unsigned cpu;
- char unused;
- return (sscanf(s, "cpu%u%c", &cpu, &unused) == 1);
-}
-
-int get_nprocs_conf() {
- // On x86 kernels you can use /proc/cpuinfo for this, but on ARM kernels offline CPUs disappear
- // from there. This method works on both.
- ScopedReaddir reader("/sys/devices/system/cpu");
- if (reader.IsBad()) {
- return 1;
- }
-
- int result = 0;
- dirent* entry;
- while ((entry = reader.ReadEntry()) != nullptr) {
- if (entry->d_type == DT_DIR && __matches_cpuN(entry->d_name)) {
- ++result;
- }
- }
- return result;
-}
-
-int get_nprocs() {
+int __get_cpu_count(const char* sys_file) {
int cpu_count = 1;
- FILE* fp = fopen("/sys/devices/system/cpu/online", "re");
+ FILE* fp = fopen(sys_file, "re");
if (fp != nullptr) {
char* line = nullptr;
- size_t len = 0;
- if (getline(&line, &len, fp) != -1) {
+ size_t allocated_size = 0;
+ if (getline(&line, &allocated_size, fp) != -1) {
cpu_count = GetCpuCountFromString(line);
- free(line);
}
+ free(line);
fclose(fp);
}
return cpu_count;
}
+int get_nprocs_conf() {
+ // It's unclear to me whether this is intended to be "possible" or "present",
+ // but on mobile they're unlikely to differ.
+ return __get_cpu_count("/sys/devices/system/cpu/possible");
+}
+
+int get_nprocs() {
+ return __get_cpu_count("/sys/devices/system/cpu/online");
+}
+
long get_phys_pages() {
struct sysinfo si;
sysinfo(&si);
diff --git a/libc/bionic/sysprop_helpers.cpp b/libc/bionic/sysprop_helpers.cpp
index edae6cc..5627034 100644
--- a/libc/bionic/sysprop_helpers.cpp
+++ b/libc/bionic/sysprop_helpers.cpp
@@ -53,9 +53,7 @@
strncpy(cb_cookie->dest, value, cb_cookie->size);
},
&cb_cookie);
- if (*dest != '\0' && *dest != '0') return true;
-
- return false;
+ return *dest != '\0';
}
bool get_config_from_env_or_sysprops(const char* env_var_name, const char* const* sys_prop_names,
diff --git a/libc/bionic/system_property_set.cpp b/libc/bionic/system_property_set.cpp
index 212aafc..845ff27 100644
--- a/libc/bionic/system_property_set.cpp
+++ b/libc/bionic/system_property_set.cpp
@@ -49,21 +49,34 @@
#include "private/ScopedFd.h"
static const char property_service_socket[] = "/dev/socket/" PROP_SERVICE_NAME;
+static const char property_service_for_system_socket[] =
+ "/dev/socket/" PROP_SERVICE_FOR_SYSTEM_NAME;
static const char* kServiceVersionPropertyName = "ro.property_service.version";
class PropertyServiceConnection {
public:
- PropertyServiceConnection() : last_error_(0) {
+ PropertyServiceConnection(const char* name) : last_error_(0) {
socket_.reset(::socket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0));
if (socket_.get() == -1) {
last_error_ = errno;
return;
}
- const size_t namelen = strlen(property_service_socket);
+ // If we're trying to set "sys.powerctl" from a privileged process, use the special
+ // socket. Because this socket is only accessible to privileged processes, it can't
+ // be DoSed directly by malicious apps. (The shell user should be able to reboot,
+ // though, so we don't just always use the special socket for "sys.powerctl".)
+ // See b/262237198 for context
+ const char* socket = property_service_socket;
+ if (strcmp(name, "sys.powerctl") == 0 &&
+ access(property_service_for_system_socket, W_OK) == 0) {
+ socket = property_service_for_system_socket;
+ }
+
+ const size_t namelen = strlen(socket);
sockaddr_un addr;
memset(&addr, 0, sizeof(addr));
- strlcpy(addr.sun_path, property_service_socket, sizeof(addr.sun_path));
+ strlcpy(addr.sun_path, socket, sizeof(addr.sun_path));
addr.sun_family = AF_LOCAL;
socklen_t alen = namelen + offsetof(sockaddr_un, sun_path) + 1;
@@ -176,7 +189,7 @@
};
static int send_prop_msg(const prop_msg* msg) {
- PropertyServiceConnection connection;
+ PropertyServiceConnection connection(msg->name);
if (!connection.IsValid()) {
return connection.GetLastError();
}
@@ -269,7 +282,7 @@
// New protocol only allows long values for ro. properties only.
if (strlen(value) >= PROP_VALUE_MAX && strncmp(key, "ro.", 3) != 0) return -1;
// Use proper protocol
- PropertyServiceConnection connection;
+ PropertyServiceConnection connection(key);
if (!connection.IsValid()) {
errno = connection.GetLastError();
async_safe_format_log(
diff --git a/libc/bionic/time64.c b/libc/bionic/time64.c
index da38bf3b..73f24ab 100644
--- a/libc/bionic/time64.c
+++ b/libc/bionic/time64.c
@@ -483,6 +483,11 @@
}
+/* This implementation violates mktime specification, according to which
+ tm_yday, tm_wday, and tm_isdst fields should be updated. This function
+ leaves input_date unmodified. Given that there were no bug reports, fixing
+ it might cause more troubles than just leaving it as it is.
+ */
Time64_T mktime64(const struct TM *input_date) {
struct tm safe_date;
struct TM date;
diff --git a/libc/arch-arm64/generic/bionic/memcpy.S b/libc/bionic/time_l.cpp
similarity index 84%
rename from libc/arch-arm64/generic/bionic/memcpy.S
rename to libc/bionic/time_l.cpp
index bc1945c..e5fa9a5 100644
--- a/libc/arch-arm64/generic/bionic/memcpy.S
+++ b/libc/bionic/time_l.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,12 +26,9 @@
* SUCH DAMAGE.
*/
-// Prototype: void *memcpy (void *dst, const void *src, size_t count).
+#include <time.h>
+//#include <xlocale.h>
-#include <private/bionic_asm.h>
-
-ENTRY(__memcpy)
- #include "memcpy_base.S"
-END(__memcpy)
-
-NOTE_GNU_PROPERTY()
+char* strptime_l(const char* buf, const char* fmt, struct tm* tm, locale_t) {
+ return strptime(buf, fmt, tm);
+}
diff --git a/libc/bionic/tmpfile.cpp b/libc/bionic/tmpfile.cpp
index 3d04610..4d6a1fb 100644
--- a/libc/bionic/tmpfile.cpp
+++ b/libc/bionic/tmpfile.cpp
@@ -51,6 +51,9 @@
return nullptr;
}
+// O_TMPFILE isn't available until Linux 3.11, so we fall back to this on
+// older kernels. AOSP was on a new enough kernel in the Lollipop timeframe,
+// so this code should be obsolete by 2025.
static FILE* __tmpfile_dir_legacy(const char* tmp_dir) {
char* path = nullptr;
if (asprintf(&path, "%s/tmp.XXXXXXXXXX", tmp_dir) == -1) {
@@ -79,25 +82,18 @@
return __fd_to_fp(fd);
}
-static FILE* __tmpfile_dir(const char* tmp_dir) {
- int fd = open(tmp_dir, O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR);
- if (fd == -1) return __tmpfile_dir_legacy(tmp_dir);
- return __fd_to_fp(fd);
+const char* __get_TMPDIR() {
+ // Use $TMPDIR if set, or fall back to /data/local/tmp otherwise.
+ // Useless for apps, but good enough for the shell.
+ const char* tmpdir = getenv("TMPDIR");
+ return (tmpdir == nullptr) ? "/data/local/tmp" : tmpdir;
}
FILE* tmpfile() {
- // TODO: get this app's temporary directory from the framework ("/data/data/app/cache").
-
- // $EXTERNAL_STORAGE turns out not to be very useful because it doesn't support hard links.
- // This means we can't do the usual trick of calling unlink before handing the file back.
-
- FILE* fp = __tmpfile_dir("/data/local/tmp");
- if (fp == nullptr) {
- // P_tmpdir is "/tmp/", but POSIX explicitly says that tmpdir(3) should try P_tmpdir before
- // giving up. This is potentially useful for bionic on the host anyway.
- fp = __tmpfile_dir(P_tmpdir);
- }
- return fp;
+ const char* tmpdir = __get_TMPDIR();
+ int fd = open(tmpdir, O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR);
+ if (fd == -1) return __tmpfile_dir_legacy(tmpdir);
+ return __fd_to_fp(fd);
}
__strong_alias(tmpfile64, tmpfile);
@@ -107,7 +103,7 @@
// since we can't easily remove it...
// $TMPDIR overrides any directory passed in.
- char* tmpdir = getenv("TMPDIR");
+ const char* tmpdir = getenv("TMPDIR");
if (tmpdir != nullptr) dir = tmpdir;
// If we still have no directory, we'll give you a default.
@@ -136,12 +132,7 @@
static char buf[L_tmpnam];
if (s == nullptr) s = buf;
- // Use $TMPDIR if set, or fall back to /data/local/tmp otherwise.
- // Useless for apps, but good enough for the shell.
- const char* dir = getenv("TMPDIR");
- if (dir == nullptr) dir = "/data/local/tmp";
-
// Make up a mktemp(3) template and defer to it for the real work.
- snprintf(s, L_tmpnam, "%s/tmpnam.XXXXXXXXXX", dir);
+ snprintf(s, L_tmpnam, "%s/tmpnam.XXXXXXXXXX", __get_TMPDIR());
return mktemp(s);
}
diff --git a/libc/dns/resolv/res_send.c b/libc/dns/resolv/res_send.c
index fa81e6d..a95997d 100644
--- a/libc/dns/resolv/res_send.c
+++ b/libc/dns/resolv/res_send.c
@@ -680,8 +680,7 @@
/* Private */
static int
-get_salen(sa)
- const struct sockaddr *sa;
+get_salen(const struct sockaddr *sa)
{
#ifdef HAVE_SA_LEN
@@ -702,9 +701,7 @@
* pick appropriate nsaddr_list for use. see res_init() for initialization.
*/
static struct sockaddr *
-get_nsaddr(statp, n)
- res_state statp;
- size_t n;
+get_nsaddr(res_state statp, size_t n)
{
if (!statp->nsaddr_list[n].sin_family && EXT(statp).ext) {
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index ecf318d..6602e5d 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -139,21 +139,38 @@
#define __ANDROID_API_P__ 28
/**
- * Names the "Q" API level (29), for comparison against `__ANDROID_API__`.
- * This release was called Android 10 publicly, not to be (but sure to be)
- * confused with API level 10.
+ * Names the Android 10 (aka "Q" or "Quince Tart") API level (29), for
+ * comparison against `__ANDROID_API__`.
*/
#define __ANDROID_API_Q__ 29
-/** Names the "R" API level (30), for comparison against `__ANDROID_API__`. */
+/**
+ * Names the Android 11 (aka "R" or "Red Velvet Cake") API level (30), for
+ * comparison against `__ANDROID_API__`.
+ */
#define __ANDROID_API_R__ 30
-/** Names the "S" API level (31), for comparison against `__ANDROID_API__`. */
+/**
+ * Names the Android 12 (aka "S" or "Snowcone") API level (31), for
+ * comparison against `__ANDROID_API__`.
+ */
#define __ANDROID_API_S__ 31
-/** Names the "T" API level (33), for comparison against `__ANDROID_API__`. */
+/**
+ * Names the Android 13 (aka "T" or "Tiramisu") API level (33), for
+ * comparison against `__ANDROID_API__`.
+ */
#define __ANDROID_API_T__ 33
+/**
+ * Names the Android 14 (aka "U" or "UpsideDownCake") API level (34),
+ * for comparison against `__ANDROID_API__`.
+ */
+#define __ANDROID_API_U__ 34
+
+/** Names the "V" API level (35), for comparison against `__ANDROID_API__`. */
+#define __ANDROID_API_V__ 35
+
/* This file is included in <features.h>, and might be used from .S files. */
#if !defined(__ASSEMBLY__)
diff --git a/libc/include/android/dlext.h b/libc/include/android/dlext.h
index f0b731c..f216aab 100644
--- a/libc/include/android/dlext.h
+++ b/libc/include/android/dlext.h
@@ -157,7 +157,7 @@
uint64_t flags;
/** Used by `ANDROID_DLEXT_RESERVED_ADDRESS` and `ANDROID_DLEXT_RESERVED_ADDRESS_HINT`. */
- void* reserved_addr;
+ void* _Nullable reserved_addr;
/** Used by `ANDROID_DLEXT_RESERVED_ADDRESS` and `ANDROID_DLEXT_RESERVED_ADDRESS_HINT`. */
size_t reserved_size;
@@ -170,7 +170,7 @@
off64_t library_fd_offset;
/** Used by `ANDROID_DLEXT_USE_NAMESPACE`. */
- struct android_namespace_t* library_namespace;
+ struct android_namespace_t* _Nullable library_namespace;
} android_dlextinfo;
/**
@@ -180,7 +180,7 @@
*
* Available since API level 21.
*/
-void* android_dlopen_ext(const char* __filename, int __flags, const android_dlextinfo* __info)
+void* _Nullable android_dlopen_ext(const char* _Nullable __filename, int __flags, const android_dlextinfo* _Nullable __info)
__INTRODUCED_IN(21);
__END_DECLS
diff --git a/libc/include/android/fdsan.h b/libc/include/android/fdsan.h
index e23de85..3de0649 100644
--- a/libc/include/android/fdsan.h
+++ b/libc/include/android/fdsan.h
@@ -123,6 +123,9 @@
/* libziparchive's ZipArchive */
ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE = 12,
+
+ /* native_handle_t */
+ ANDROID_FDSAN_OWNER_TYPE_NATIVE_HANDLE = 13,
};
/*
@@ -156,7 +159,7 @@
*
* The return value points to memory with static lifetime, do not attempt to modify it.
*/
-const char* android_fdsan_get_tag_type(uint64_t tag) __INTRODUCED_IN(29);
+const char* _Nonnull android_fdsan_get_tag_type(uint64_t tag) __INTRODUCED_IN(29);
/*
* Get an owner tag's value, with the type masked off.
diff --git a/libc/include/android/legacy_fenv_inlines_arm.h b/libc/include/android/legacy_fenv_inlines_arm.h
deleted file mode 100644
index 92caa72..0000000
--- a/libc/include/android/legacy_fenv_inlines_arm.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-/**
- * @file legacy_fenv_inlines_arm.h
- * @brief Inline ARM-specific definitions of fenv for old API levels.
- */
-
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 21 && defined(__arm__)
-
-#define __BIONIC_FENV_INLINE static __inline
-#include <bits/fenv_inlines_arm.h>
-
-#endif
diff --git a/libc/include/android/legacy_signal_inlines.h b/libc/include/android/legacy_signal_inlines.h
deleted file mode 100644
index f2bdcf6..0000000
--- a/libc/include/android/legacy_signal_inlines.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 21
-
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-
-__BEGIN_DECLS
-
-sighandler_t bsd_signal(int __signal, sighandler_t __handler) __REMOVED_IN(21);
-
-/* These weren't introduced until L. */
-int __libc_current_sigrtmax() __attribute__((__weak__)) __VERSIONER_NO_GUARD;
-int __libc_current_sigrtmin() __attribute__((__weak__)) __VERSIONER_NO_GUARD;
-
-static __inline int __ndk_legacy___libc_current_sigrtmax() {
- /*
- * The NDK doesn't use libclang_rt.builtins yet (https://github.com/android/ndk/issues/1231) so it
- * can't use __builtin_available, but the platform builds with -Werror=unguarded-availability so
- * it requires __builtin_available.
- */
-#if defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
- if (__builtin_available(android 21, *)) {
-#else
- if (__libc_current_sigrtmax) {
-#endif
- return __libc_current_sigrtmax();
- }
- return __SIGRTMAX; /* Should match __libc_current_sigrtmax. */
-}
-
-static __inline int __ndk_legacy___libc_current_sigrtmin() {
- /*
- * The NDK doesn't use libclang_rt.builtins yet (https://github.com/android/ndk/issues/1231) so it
- * can't use __builtin_available, but the platform builds with -Werror=unguarded-availability so
- * it requires __builtin_available.
- */
-#if defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
- if (__builtin_available(android 21, *)) {
-#else
- if (__libc_current_sigrtmin) {
-#endif
- return __libc_current_sigrtmin();
- }
- return __SIGRTMIN + 7; /* Should match __libc_current_sigrtmin. */
-}
-
-#undef SIGRTMAX
-#define SIGRTMAX __ndk_legacy___libc_current_sigrtmax()
-#undef SIGRTMIN
-#define SIGRTMIN __ndk_legacy___libc_current_sigrtmin()
-
-static __inline int sigismember(const sigset_t *set, int signum) {
- /* Signal numbers start at 1, but bit positions start at 0. */
- int bit = signum - 1;
- const unsigned long *local_set = (const unsigned long *)set;
- if (set == NULL || bit < 0 || bit >= (int)(8 * sizeof(sigset_t))) {
- errno = EINVAL;
- return -1;
- }
- return (int)((local_set[bit / (8 * sizeof(long))] >> (bit % (8 * sizeof(long)))) & 1);
-}
-
-static __inline int sigaddset(sigset_t *set, int signum) {
- /* Signal numbers start at 1, but bit positions start at 0. */
- int bit = signum - 1;
- unsigned long *local_set = (unsigned long *)set;
- if (set == NULL || bit < 0 || bit >= (int)(8 * sizeof(sigset_t))) {
- errno = EINVAL;
- return -1;
- }
- local_set[bit / (8 * sizeof(long))] |= 1UL << (bit % (8 * sizeof(long)));
- return 0;
-}
-
-static __inline int sigdelset(sigset_t *set, int signum) {
- /* Signal numbers start at 1, but bit positions start at 0. */
- int bit = signum - 1;
- unsigned long *local_set = (unsigned long *)set;
- if (set == NULL || bit < 0 || bit >= (int)(8 * sizeof(sigset_t))) {
- errno = EINVAL;
- return -1;
- }
- local_set[bit / (8 * sizeof(long))] &= ~(1UL << (bit % (8 * sizeof(long))));
- return 0;
-}
-
-static __inline int sigemptyset(sigset_t *set) {
- if (set == NULL) {
- errno = EINVAL;
- return -1;
- }
- memset(set, 0, sizeof(sigset_t));
- return 0;
-}
-
-static __inline int sigfillset(sigset_t *set) {
- if (set == NULL) {
- errno = EINVAL;
- return -1;
- }
- memset(set, ~0, sizeof(sigset_t));
- return 0;
-}
-
-static __inline sighandler_t signal(int s, sighandler_t f) {
- return bsd_signal(s, f);
-}
-
-__END_DECLS
-
-#endif
diff --git a/libc/include/android/legacy_stdlib_inlines.h b/libc/include/android/legacy_stdlib_inlines.h
index aeb1575..f0985fe 100644
--- a/libc/include/android/legacy_stdlib_inlines.h
+++ b/libc/include/android/legacy_stdlib_inlines.h
@@ -30,63 +30,6 @@
#include <sys/cdefs.h>
-#if __ANDROID_API__ < 19
-
-__BEGIN_DECLS
-
-static __inline int abs(int __n) { return (__n < 0) ? -__n : __n; }
-
-static __inline long labs(long __n) { return (__n < 0L) ? -__n : __n; }
-
-static __inline long long llabs(long long __n) {
- return (__n < 0LL) ? -__n : __n;
-}
-
-__END_DECLS
-
-#endif
-
-
-
-#if __ANDROID_API__ < 21
-
-#include <errno.h>
-#include <float.h>
-#include <stdlib.h>
-
-__BEGIN_DECLS
-
-static __inline float strtof(const char* nptr, char** endptr) {
- double d = strtod(nptr, endptr);
- if (d > FLT_MAX) {
- errno = ERANGE;
- return __builtin_huge_valf();
- } else if (d < -FLT_MAX) {
- errno = ERANGE;
- return -__builtin_huge_valf();
- }
- return __BIONIC_CAST(static_cast, float, d);
-}
-
-static __inline double atof(const char *nptr) { return (strtod(nptr, NULL)); }
-
-static __inline int rand(void) { return (int)lrand48(); }
-
-static __inline void srand(unsigned int __s) { srand48(__s); }
-
-static __inline long random(void) { return lrand48(); }
-
-static __inline void srandom(unsigned int __s) { srand48(__s); }
-
-static __inline int grantpt(int __fd __attribute((unused))) {
- return 0; /* devpts does this all for us! */
-}
-
-__END_DECLS
-
-#endif
-
-
#if __ANDROID_API__ < 26
@@ -95,15 +38,15 @@
__BEGIN_DECLS
-static __inline double strtod_l(const char* __s, char** __end_ptr, locale_t __l) {
+static __inline double strtod_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) {
return strtod(__s, __end_ptr);
}
-static __inline float strtof_l(const char* __s, char** __end_ptr, locale_t __l) {
+static __inline float strtof_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) {
return strtof(__s, __end_ptr);
}
-static __inline long strtol_l(const char* __s, char** __end_ptr, int __base, locale_t __l) {
+static __inline long strtol_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) {
return strtol(__s, __end_ptr, __base);
}
diff --git a/libc/include/android/legacy_sys_mman_inlines.h b/libc/include/android/legacy_sys_mman_inlines.h
deleted file mode 100644
index 04b3e97..0000000
--- a/libc/include/android/legacy_sys_mman_inlines.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 21
-
-#include <errno.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-__BEGIN_DECLS
-
-/*
- * While this was never an inline, this function alone has caused most of the
- * bug reports related to _FILE_OFFSET_BITS=64. Providing an inline for it
- * should allow a lot more code to build with _FILE_OFFSET_BITS=64 when
- * targeting pre-L.
- */
-static __inline void* mmap64(void* __addr, size_t __size, int __prot, int __flags, int __fd,
- off64_t __offset) __RENAME(mmap64);
-static __inline void* mmap64(void* __addr, size_t __size, int __prot, int __flags, int __fd,
- off64_t __offset) {
- const int __mmap2_shift = 12; // 2**12 == 4096
- if (__offset < 0 || (__offset & ((1UL << __mmap2_shift) - 1)) != 0) {
- errno = EINVAL;
- return MAP_FAILED;
- }
-
- // prevent allocations large enough for `end - start` to overflow
- size_t __rounded = __BIONIC_ALIGN(__size, PAGE_SIZE);
- if (__rounded < __size || __rounded > PTRDIFF_MAX) {
- errno = ENOMEM;
- return MAP_FAILED;
- }
-
- extern void* __mmap2(void* __addr, size_t __size, int __prot, int __flags, int __fd,
- size_t __offset);
- return __mmap2(__addr, __size, __prot, __flags, __fd, __offset >> __mmap2_shift);
-}
-
-__END_DECLS
-
-#endif
diff --git a/libc/include/android/legacy_sys_statvfs_inlines.h b/libc/include/android/legacy_sys_statvfs_inlines.h
deleted file mode 100644
index 369e6a2..0000000
--- a/libc/include/android/legacy_sys_statvfs_inlines.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-/**
- * @file legacy_sys_statvfs_inlines.h
- * @brief Inline definitions of statvfs/fstatvfs for old API levels.
- */
-
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 21
-
-#define __BIONIC_NEED_STATVFS64_INLINES
-#if __ANDROID_API__ < 19
-#define __BIONIC_NEED_STATVFS_INLINES
-#endif
-
-#define __BIONIC_SYS_STATVFS_INLINE static __inline
-#include <bits/sys_statvfs_inlines.h>
-
-#endif
diff --git a/libc/include/android/legacy_sys_wait_inlines.h b/libc/include/android/legacy_sys_wait_inlines.h
deleted file mode 100644
index eadc752..0000000
--- a/libc/include/android/legacy_sys_wait_inlines.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 18
-
-#include <sys/syscall.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-__BEGIN_DECLS
-
-static __inline pid_t wait4(pid_t pid, int* status, int options, struct rusage* rusage) {
- return __BIONIC_CAST(static_cast, pid_t, syscall(__NR_wait4, pid, status, options, rusage));
-}
-
-__END_DECLS
-
-#endif
diff --git a/libc/include/android/set_abort_message.h b/libc/include/android/set_abort_message.h
index 5d8d8ee..2be01a9 100644
--- a/libc/include/android/set_abort_message.h
+++ b/libc/include/android/set_abort_message.h
@@ -46,6 +46,6 @@
*
* Available since API level 21.
*/
-void android_set_abort_message(const char* __msg) __INTRODUCED_IN(21);
+void android_set_abort_message(const char* _Nullable __msg) __INTRODUCED_IN(21);
__END_DECLS
diff --git a/libc/include/assert.h b/libc/include/assert.h
index 79e7b86..8db970b 100644
--- a/libc/include/assert.h
+++ b/libc/include/assert.h
@@ -75,12 +75,12 @@
* __assert() is called by assert() on failure. Most users want assert()
* instead, but this can be useful for reporting other failures.
*/
-void __assert(const char* __file, int __line, const char* __msg) __noreturn;
+void __assert(const char* _Nonnull __file, int __line, const char* _Nonnull __msg) __noreturn;
/**
* __assert2() is called by assert() on failure. Most users want assert()
* instead, but this can be useful for reporting other failures.
*/
-void __assert2(const char* __file, int __line, const char* __function, const char* __msg) __noreturn;
+void __assert2(const char* _Nonnull __file, int __line, const char* _Nonnull __function, const char* _Nonnull __msg) __noreturn;
__END_DECLS
diff --git a/libc/include/bits/elf_arm.h b/libc/include/bits/elf_arm.h
deleted file mode 100644
index 08fe1d5..0000000
--- a/libc/include/bits/elf_arm.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* $NetBSD: elf_machdep.h,v 1.17 2014/02/25 19:20:09 matt Exp $ */
-
-#ifndef _ARM_ELF_MACHDEP_H_
-#define _ARM_ELF_MACHDEP_H_
-
-/* Android-added. */
-#define R_ARM_IRELATIVE 160
-
-/* Processor specific flags for the ELF header e_flags field. */
-#define EF_ARM_RELEXEC 0x00000001
-#define EF_ARM_HASENTRY 0x00000002
-#define EF_ARM_INTERWORK 0x00000004 /* GNU binutils 000413 */
-#define EF_ARM_SYMSARESORTED 0x00000004 /* ARM ELF A08 */
-#define EF_ARM_APCS_26 0x00000008 /* GNU binutils 000413 */
-#define EF_ARM_DYNSYMSUSESEGIDX 0x00000008 /* ARM ELF B01 */
-#define EF_ARM_APCS_FLOAT 0x00000010 /* GNU binutils 000413 */
-#define EF_ARM_MAPSYMSFIRST 0x00000010 /* ARM ELF B01 */
-#define EF_ARM_PIC 0x00000020
-#define EF_ARM_ALIGN8 0x00000040 /* 8-bit structure alignment. */
-#define EF_ARM_NEW_ABI 0x00000080
-#define EF_ARM_OLD_ABI 0x00000100
-#define EF_ARM_SOFT_FLOAT 0x00000200
-#define EF_ARM_BE8 0x00800000
-#define EF_ARM_EABIMASK 0xff000000
-#define EF_ARM_EABI_VER1 0x01000000
-#define EF_ARM_EABI_VER2 0x02000000
-#define EF_ARM_EABI_VER3 0x03000000
-#define EF_ARM_EABI_VER4 0x04000000
-#define EF_ARM_EABI_VER5 0x05000000
-
-/* Processor specific relocation types */
-
-#define R_ARM_NONE 0
-#define R_ARM_PC24 1
-#define R_ARM_ABS32 2
-#define R_ARM_REL32 3
-#define R_ARM_PC13 4
-#define R_ARM_ABS16 5
-#define R_ARM_ABS12 6
-#define R_ARM_THM_ABS5 7
-#define R_ARM_ABS8 8
-#define R_ARM_SBREL32 9
-#define R_ARM_THM_PC22 10
-#define R_ARM_THM_PC8 11
-#define R_ARM_AMP_VCALL9 12
-#define R_ARM_SWI24 13 /* obsolete static relocation */
-#define R_ARM_TLS_DESC 13 /* dynamic relocation */
-#define R_ARM_THM_SWI8 14
-#define R_ARM_XPC25 15
-#define R_ARM_THM_XPC22 16
-
-/* TLS relocations */
-#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */
-#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */
-#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */
-
-/* 20-31 are reserved for ARM Linux. */
-#define R_ARM_COPY 20
-#define R_ARM_GLOB_DAT 21
-#define R_ARM_JUMP_SLOT 22
-#define R_ARM_RELATIVE 23
-#define R_ARM_GOTOFF 24
-#define R_ARM_GOTPC 25
-#define R_ARM_GOT32 26
-#define R_ARM_PLT32 27
-#define R_ARM_CALL 28
-#define R_ARM_JUMP24 29
-#define R_ARM_THM_JUMP24 30
-#define R_ARM_BASE_ABS 31
-#define R_ARM_ALU_PCREL_7_0 32
-#define R_ARM_ALU_PCREL_15_8 33
-#define R_ARM_ALU_PCREL_23_15 34
-#define R_ARM_ALU_SBREL_11_0 35
-#define R_ARM_ALU_SBREL_19_12 36
-#define R_ARM_ALU_SBREL_27_20 37 // depcreated
-#define R_ARM_TARGET1 38
-#define R_ARM_SBREL31 39 // deprecated
-#define R_ARM_V4BX 40
-#define R_ARM_TARGET2 41
-#define R_ARM_PREL31 42
-#define R_ARM_MOVW_ABS_NC 43
-#define R_ARM_MOVT_ABS 44
-#define R_ARM_MOVW_PREL_NC 45
-#define R_ARM_MOVT_PREL 46
-#define R_ARM_THM_MOVW_ABS_NC 47
-#define R_ARM_THM_MOVT_ABS 48
-#define R_ARM_THM_MOVW_PREL_NC 49
-#define R_ARM_THM_MOVT_PREL 50
-
-/* 96-111 are reserved to G++. */
-#define R_ARM_GNU_VTENTRY 100
-#define R_ARM_GNU_VTINHERIT 101
-#define R_ARM_THM_PC11 102
-#define R_ARM_THM_PC9 103
-
-/* More TLS relocations */
-#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic */
-#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic */
-#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS */
-#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of */
-#define R_ARM_TLS_LE32 108
-#define R_ARM_TLS_LDO12 109
-#define R_ARM_TLS_LE12 110
-#define R_ARM_TLS_IE12GP 111
-
-/* 112-127 are reserved for private experiments. */
-
-#define R_ARM_RXPC25 249
-#define R_ARM_RSBREL32 250
-#define R_ARM_THM_RPC22 251
-#define R_ARM_RREL32 252
-#define R_ARM_RABS32 253
-#define R_ARM_RPC24 254
-#define R_ARM_RBASE 255
-
-/* Processor specific program header flags */
-#define PF_ARM_SB 0x10000000
-#define PF_ARM_PI 0x20000000
-#define PF_ARM_ENTRY 0x80000000
-
-/* Processor specific program header types */
-#define PT_ARM_EXIDX (PT_LOPROC + 1)
-
-/* Processor specific section header flags */
-#define SHF_ENTRYSECT 0x10000000
-#define SHF_COMDEF 0x80000000
-
-/* Processor specific symbol types */
-#define STT_ARM_TFUNC STT_LOPROC
-
-#endif /* _ARM_ELF_MACHDEP_H_ */
diff --git a/libc/include/bits/elf_arm64.h b/libc/include/bits/elf_arm64.h
deleted file mode 100644
index 9330d7b..0000000
--- a/libc/include/bits/elf_arm64.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _AARCH64_ELF_MACHDEP_H_
-#define _AARCH64_ELF_MACHDEP_H_
-
-/* Null relocations */
-#define R_ARM_NONE 0
-#define R_AARCH64_NONE 256
-
-/* Static Data relocations */
-#define R_AARCH64_ABS64 257
-#define R_AARCH64_ABS32 258
-#define R_AARCH64_ABS16 259
-#define R_AARCH64_PREL64 260
-#define R_AARCH64_PREL32 261
-#define R_AARCH64_PREL16 262
-
-#define R_AARCH64_MOVW_UABS_G0 263
-#define R_AARCH64_MOVW_UABS_G0_NC 264
-#define R_AARCH64_MOVW_UABS_G1 265
-#define R_AARCH64_MOVW_UABS_G1_NC 266
-#define R_AARCH64_MOVW_UABS_G2 267
-#define R_AARCH64_MOVW_UABS_G2_NC 268
-#define R_AARCH64_MOVW_UABS_G3 269
-#define R_AARCH64_MOVW_SABS_G0 270
-#define R_AARCH64_MOVW_SABS_G1 271
-#define R_AARCH64_MOVW_SABS_G2 272
-
-/* PC-relative addresses */
-#define R_AARCH64_LD_PREL_LO19 273
-#define R_AARCH64_ADR_PREL_LO21 274
-#define R_AARCH64_ADR_PREL_PG_HI21 275
-#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
-#define R_AARCH64_ADD_ABS_LO12_NC 277
-#define R_AARCH64_LDST8_ABS_LO12_NC 278
-
-/* Control-flow relocations */
-#define R_AARCH64_TSTBR14 279
-#define R_AARCH64_CONDBR19 280
-#define R_AARCH64_JUMP26 282
-#define R_AARCH64_CALL26 283
-#define R_AARCH64_LDST16_ABS_LO12_NC 284
-#define R_AARCH64_LDST32_ABS_LO12_NC 285
-#define R_AARCH64_LDST64_ABS_LO12_NC 286
-#define R_AARCH64_LDST128_ABS_LO12_NC 299
-
-#define R_AARCH64_MOVW_PREL_G0 287
-#define R_AARCH64_MOVW_PREL_G0_NC 288
-#define R_AARCH64_MOVW_PREL_G1 289
-#define R_AARCH64_MOVW_PREL_G1_NC 290
-#define R_AARCH64_MOVW_PREL_G2 291
-#define R_AARCH64_MOVW_PREL_G2_NC 292
-#define R_AARCH64_MOVW_PREL_G3 293
-
-/* Dynamic relocations */
-#define R_AARCH64_COPY 1024
-#define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
-#define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
-#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
-#define R_AARCH64_TLS_DTPMOD 1028 /* Module index. */
-#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset. */
-#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset. */
-#define R_AARCH64_TLSDESC 1031 /* 16-byte descriptor: resolver func + arg. */
-#define R_AARCH64_IRELATIVE 1032
-
-/* Dynamic array tags */
-#define DT_AARCH64_BTI_PLT 0x70000001
-#define DT_AARCH64_PAC_PLT 0x70000003
-#define DT_AARCH64_VARIANT_PCS 0x70000005
-
-#endif /* _AARCH64_ELF_MACHDEP_H_ */
diff --git a/libc/include/bits/elf_common.h b/libc/include/bits/elf_common.h
new file mode 100644
index 0000000..b3c57a2
--- /dev/null
+++ b/libc/include/bits/elf_common.h
@@ -0,0 +1,1435 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2017, 2018 Dell EMC
+ * Copyright (c) 2000, 2001, 2008, 2011, David E. O'Brien
+ * Copyright (c) 1998 John D. Polstra.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_ELF_COMMON_H_
+#define _SYS_ELF_COMMON_H_ 1
+
+/*
+ * ELF definitions that are independent of architecture or word size.
+ */
+
+/*
+ * Option kinds.
+ */
+#define ODK_NULL 0 /* undefined */
+#define ODK_REGINFO 1 /* register usage info */
+#define ODK_EXCEPTIONS 2 /* exception processing info */
+#define ODK_PAD 3 /* section padding */
+#define ODK_HWPATCH 4 /* hardware patch applied */
+#define ODK_FILL 5 /* fill value used by the linker */
+#define ODK_TAGS 6 /* reserved space for tools */
+#define ODK_HWAND 7 /* hardware AND patch applied */
+#define ODK_HWOR 8 /* hardware OR patch applied */
+#define ODK_GP_GROUP 9 /* GP group for text/data sections */
+#define ODK_IDENT 10 /* ID information */
+#define ODK_PAGESIZE 11 /* page size information */
+
+/*
+ * ODK_EXCEPTIONS info field masks.
+ */
+#define OEX_FPU_MIN 0x0000001f /* min FPU exception required */
+#define OEX_FPU_MAX 0x00001f00 /* max FPU exception allowed */
+#define OEX_PAGE0 0x00010000 /* page zero must be mapped */
+#define OEX_SMM 0x00020000 /* run in sequential memory mode */
+#define OEX_PRECISEFP 0x00040000 /* run in precise FP exception mode */
+#define OEX_DISMISS 0x00080000 /* dismiss invalid address traps */
+
+/*
+ * ODK_PAD info field masks.
+ */
+#define OPAD_PREFIX 0x0001
+#define OPAD_POSTFIX 0x0002
+#define OPAD_SYMBOL 0x0004
+
+/*
+ * ODK_HWPATCH info field masks.
+ */
+#define OHW_R4KEOP 0x00000001 /* patch for R4000 branch at end-of-page bug */
+#define OHW_R8KPFETCH 0x00000002 /* R8000 prefetch bug may occur */
+#define OHW_R5KEOP 0x00000004 /* patch for R5000 branch at end-of-page bug */
+#define OHW_R5KCVTL 0x00000008 /* R5000 cvt.[ds].l bug: clean == 1 */
+#define OHW_R10KLDL 0x00000010UL /* need patch for R10000 misaligned load */
+
+/*
+ * ODK_HWAND/ODK_HWOR info field and hwp_flags[12] masks.
+ */
+#define OHWA0_R4KEOP_CHECKED 0x00000001 /* object checked for R4000 end-of-page bug */
+#define OHWA0_R4KEOP_CLEAN 0x00000002 /* object verified clean for R4000 end-of-page bug */
+#define OHWO0_FIXADE 0x00000001 /* object requires call to fixade */
+
+/*
+ * ODK_IDENT/ODK_GP_GROUP info field masks.
+ */
+#define OGP_GROUP 0x0000ffff /* GP group number */
+#define OGP_SELF 0x00010000 /* GP group is self-contained */
+
+/* Indexes into the e_ident array. Keep synced with
+ http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
+#define EI_MAG0 0 /* Magic number, byte 0. */
+#define EI_MAG1 1 /* Magic number, byte 1. */
+#define EI_MAG2 2 /* Magic number, byte 2. */
+#define EI_MAG3 3 /* Magic number, byte 3. */
+#define EI_CLASS 4 /* Class of machine. */
+#define EI_DATA 5 /* Data format. */
+#define EI_VERSION 6 /* ELF format version. */
+#define EI_OSABI 7 /* Operating system / ABI identification */
+#define EI_ABIVERSION 8 /* ABI version */
+#define OLD_EI_BRAND 8 /* Start of architecture identification. */
+#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */
+#define EI_NIDENT 16 /* Size of e_ident array. */
+
+/* Values for the magic number bytes. */
+#define ELFMAG0 0x7f
+#define ELFMAG1 'E'
+#define ELFMAG2 'L'
+#define ELFMAG3 'F'
+#define ELFMAG "\177ELF" /* magic string */
+#define SELFMAG 4 /* magic string size */
+
+/* Values for e_ident[EI_VERSION] and e_version. */
+#define EV_NONE 0
+#define EV_CURRENT 1
+
+/* Values for e_ident[EI_CLASS]. */
+#define ELFCLASSNONE 0 /* Unknown class. */
+#define ELFCLASS32 1 /* 32-bit architecture. */
+#define ELFCLASS64 2 /* 64-bit architecture. */
+
+/* Values for e_ident[EI_DATA]. */
+#define ELFDATANONE 0 /* Unknown data format. */
+#define ELFDATA2LSB 1 /* 2's complement little-endian. */
+#define ELFDATA2MSB 2 /* 2's complement big-endian. */
+
+/* Values for e_ident[EI_OSABI]. */
+#define ELFOSABI_NONE 0 /* UNIX System V ABI */
+#define ELFOSABI_HPUX 1 /* HP-UX operating system */
+#define ELFOSABI_NETBSD 2 /* NetBSD */
+#define ELFOSABI_LINUX 3 /* GNU/Linux */
+#define ELFOSABI_HURD 4 /* GNU/Hurd */
+#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */
+#define ELFOSABI_SOLARIS 6 /* Solaris */
+#define ELFOSABI_AIX 7 /* AIX */
+#define ELFOSABI_IRIX 8 /* IRIX */
+#define ELFOSABI_FREEBSD 9 /* FreeBSD */
+#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
+#define ELFOSABI_MODESTO 11 /* Novell Modesto */
+#define ELFOSABI_OPENBSD 12 /* OpenBSD */
+#define ELFOSABI_OPENVMS 13 /* Open VMS */
+#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */
+#define ELFOSABI_AROS 15 /* Amiga Research OS */
+#define ELFOSABI_FENIXOS 16 /* FenixOS */
+#define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */
+#define ELFOSABI_OPENVOS 18 /* Stratus Technologies OpenVOS */
+#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */
+#define ELFOSABI_ARM 97 /* ARM */
+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
+
+#define ELFOSABI_MONTEREY ELFOSABI_AIX /* Monterey */
+
+/* e_ident */
+#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
+ (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
+ (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
+ (ehdr).e_ident[EI_MAG3] == ELFMAG3)
+
+/* Values for e_type. */
+#define ET_NONE 0 /* Unknown type. */
+#define ET_REL 1 /* Relocatable. */
+#define ET_EXEC 2 /* Executable. */
+#define ET_DYN 3 /* Shared object. */
+#define ET_CORE 4 /* Core file. */
+#define ET_LOOS 0xfe00 /* First operating system specific. */
+#define ET_HIOS 0xfeff /* Last operating system-specific. */
+#define ET_LOPROC 0xff00 /* First processor-specific. */
+#define ET_HIPROC 0xffff /* Last processor-specific. */
+
+/* Values for e_machine. */
+#define EM_NONE 0 /* Unknown machine. */
+#define EM_M32 1 /* AT&T WE32100. */
+#define EM_SPARC 2 /* Sun SPARC. */
+#define EM_386 3 /* Intel i386. */
+#define EM_68K 4 /* Motorola 68000. */
+#define EM_88K 5 /* Motorola 88000. */
+#define EM_IAMCU 6 /* Intel MCU. */
+#define EM_860 7 /* Intel i860. */
+#define EM_MIPS 8 /* MIPS R3000 Big-Endian only. */
+#define EM_S370 9 /* IBM System/370. */
+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 Little-Endian. */
+#define EM_PARISC 15 /* HP PA-RISC. */
+#define EM_VPP500 17 /* Fujitsu VPP500. */
+#define EM_SPARC32PLUS 18 /* SPARC v8plus. */
+#define EM_960 19 /* Intel 80960. */
+#define EM_PPC 20 /* PowerPC 32-bit. */
+#define EM_PPC64 21 /* PowerPC 64-bit. */
+#define EM_S390 22 /* IBM System/390. */
+#define EM_V800 36 /* NEC V800. */
+#define EM_FR20 37 /* Fujitsu FR20. */
+#define EM_RH32 38 /* TRW RH-32. */
+#define EM_RCE 39 /* Motorola RCE. */
+#define EM_ARM 40 /* ARM. */
+#define EM_SH 42 /* Hitachi SH. */
+#define EM_SPARCV9 43 /* SPARC v9 64-bit. */
+#define EM_TRICORE 44 /* Siemens TriCore embedded processor. */
+#define EM_ARC 45 /* Argonaut RISC Core. */
+#define EM_H8_300 46 /* Hitachi H8/300. */
+#define EM_H8_300H 47 /* Hitachi H8/300H. */
+#define EM_H8S 48 /* Hitachi H8S. */
+#define EM_H8_500 49 /* Hitachi H8/500. */
+#define EM_IA_64 50 /* Intel IA-64 Processor. */
+#define EM_MIPS_X 51 /* Stanford MIPS-X. */
+#define EM_COLDFIRE 52 /* Motorola ColdFire. */
+#define EM_68HC12 53 /* Motorola M68HC12. */
+#define EM_MMA 54 /* Fujitsu MMA. */
+#define EM_PCP 55 /* Siemens PCP. */
+#define EM_NCPU 56 /* Sony nCPU. */
+#define EM_NDR1 57 /* Denso NDR1 microprocessor. */
+#define EM_STARCORE 58 /* Motorola Star*Core processor. */
+#define EM_ME16 59 /* Toyota ME16 processor. */
+#define EM_ST100 60 /* STMicroelectronics ST100 processor. */
+#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ processor. */
+#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */
+#define EM_AMD64 EM_X86_64 /* Advanced Micro Devices x86-64 (compat) */
+#define EM_PDSP 63 /* Sony DSP Processor. */
+#define EM_FX66 66 /* Siemens FX66 microcontroller. */
+#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16
+ microcontroller. */
+#define EM_ST7 68 /* STmicroelectronics ST7 8-bit
+ microcontroller. */
+#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller. */
+#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller. */
+#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller. */
+#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller. */
+#define EM_SVX 73 /* Silicon Graphics SVx. */
+#define EM_ST19 74 /* STMicroelectronics ST19 8-bit mc. */
+#define EM_VAX 75 /* Digital VAX. */
+#define EM_CRIS 76 /* Axis Communications 32-bit embedded
+ processor. */
+#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded
+ processor. */
+#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor. */
+#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor. */
+#define EM_MMIX 80 /* Donald Knuth's educational 64-bit proc. */
+#define EM_HUANY 81 /* Harvard University machine-independent
+ object files. */
+#define EM_PRISM 82 /* SiTera Prism. */
+#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller. */
+#define EM_FR30 84 /* Fujitsu FR30. */
+#define EM_D10V 85 /* Mitsubishi D10V. */
+#define EM_D30V 86 /* Mitsubishi D30V. */
+#define EM_V850 87 /* NEC v850. */
+#define EM_M32R 88 /* Mitsubishi M32R. */
+#define EM_MN10300 89 /* Matsushita MN10300. */
+#define EM_MN10200 90 /* Matsushita MN10200. */
+#define EM_PJ 91 /* picoJava. */
+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor. */
+#define EM_ARC_A5 93 /* ARC Cores Tangent-A5. */
+#define EM_XTENSA 94 /* Tensilica Xtensa Architecture. */
+#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor. */
+#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose
+ Processor. */
+#define EM_NS32K 97 /* National Semiconductor 32000 series. */
+#define EM_TPC 98 /* Tenor Network TPC processor. */
+#define EM_SNP1K 99 /* Trebia SNP 1000 processor. */
+#define EM_ST200 100 /* STMicroelectronics ST200 microcontroller. */
+#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family. */
+#define EM_MAX 102 /* MAX Processor. */
+#define EM_CR 103 /* National Semiconductor CompactRISC
+ microprocessor. */
+#define EM_F2MC16 104 /* Fujitsu F2MC16. */
+#define EM_MSP430 105 /* Texas Instruments embedded microcontroller
+ msp430. */
+#define EM_BLACKFIN 106 /* Analog Devices Blackfin (DSP) processor. */
+#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processors. */
+#define EM_SEP 108 /* Sharp embedded microprocessor. */
+#define EM_ARCA 109 /* Arca RISC Microprocessor. */
+#define EM_UNICORE 110 /* Microprocessor series from PKU-Unity Ltd.
+ and MPRC of Peking University */
+#define EM_AARCH64 183 /* AArch64 (64-bit ARM) */
+#define EM_RISCV 243 /* RISC-V */
+
+/* Non-standard or deprecated. */
+#define EM_486 6 /* Intel i486. */
+#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
+#define EM_ALPHA_STD 41 /* Digital Alpha (standard value). */
+#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI) */
+
+/**
+ * e_flags
+ */
+#define EF_ARM_RELEXEC 0x1
+#define EF_ARM_HASENTRY 0x2
+#define EF_ARM_SYMSARESORTED 0x4
+#define EF_ARM_DYNSYMSUSESEGIDX 0x8
+#define EF_ARM_MAPSYMSFIRST 0x10
+#define EF_ARM_LE8 0x00400000
+#define EF_ARM_BE8 0x00800000
+#define EF_ARM_EABIMASK 0xFF000000
+#define EF_ARM_EABI_UNKNOWN 0x00000000
+#define EF_ARM_EABI_VER1 0x01000000
+#define EF_ARM_EABI_VER2 0x02000000
+#define EF_ARM_EABI_VER3 0x03000000
+#define EF_ARM_EABI_VER4 0x04000000
+#define EF_ARM_EABI_VER5 0x05000000
+#define EF_ARM_INTERWORK 0x00000004
+#define EF_ARM_APCS_26 0x00000008
+#define EF_ARM_APCS_FLOAT 0x00000010
+#define EF_ARM_PIC 0x00000020
+#define EF_ARM_ALIGN8 0x00000040
+#define EF_ARM_NEW_ABI 0x00000080
+#define EF_ARM_OLD_ABI 0x00000100
+#define EF_ARM_ABI_FLOAT_SOFT 0x00000200
+#define EF_ARM_SOFT_FLOAT EF_ARM_ABI_FLOAT_SOFT /* Pre-V5 ABI name */
+#define EF_ARM_ABI_FLOAT_HARD 0x00000400
+#define EF_ARM_VFP_FLOAT EF_ARM_ABI_FLOAT_HARD /* Pre-V5 ABI name */
+#define EF_ARM_MAVERICK_FLOAT 0x00000800
+
+#define EF_MIPS_NOREORDER 0x00000001
+#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */
+#define EF_MIPS_CPIC 0x00000004 /* STD PIC calling sequence */
+#define EF_MIPS_UCODE 0x00000010
+#define EF_MIPS_ABI2 0x00000020 /* N32 */
+#define EF_MIPS_OPTIONS_FIRST 0x00000080
+#define EF_MIPS_ABI 0x0000F000
+#define EF_MIPS_ABI_O32 0x00001000
+#define EF_MIPS_ABI_O64 0x00002000
+#define EF_MIPS_ABI_EABI32 0x00003000
+#define EF_MIPS_ABI_EABI64 0x00004000
+#define EF_MIPS_ARCH_ASE 0x0F000000 /* Architectural extensions */
+#define EF_MIPS_ARCH_ASE_MDMX 0x08000000 /* MDMX multimedia extension */
+#define EF_MIPS_ARCH_ASE_M16 0x04000000 /* MIPS-16 ISA extensions */
+#define EF_MIPS_ARCH 0xF0000000 /* Architecture field */
+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code */
+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code */
+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code */
+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code */
+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code */
+#define EF_MIPS_ARCH_32 0x50000000 /* -mips32 code */
+#define EF_MIPS_ARCH_64 0x60000000 /* -mips64 code */
+#define EF_MIPS_ARCH_32R2 0x70000000 /* -mips32r2 code */
+#define EF_MIPS_ARCH_64R2 0x80000000 /* -mips64r2 code */
+
+#define EF_PPC_EMB 0x80000000
+#define EF_PPC_RELOCATABLE 0x00010000
+#define EF_PPC_RELOCATABLE_LIB 0x00008000
+
+#define EF_RISCV_RVC 0x00000001
+#define EF_RISCV_FLOAT_ABI_MASK 0x00000006
+#define EF_RISCV_FLOAT_ABI_SOFT 0x00000000
+#define EF_RISCV_FLOAT_ABI_SINGLE 0x000002
+#define EF_RISCV_FLOAT_ABI_DOUBLE 0x000004
+#define EF_RISCV_FLOAT_ABI_QUAD 0x00000006
+#define EF_RISCV_RVE 0x00000008
+#define EF_RISCV_TSO 0x00000010
+
+#define EF_SPARC_EXT_MASK 0x00ffff00
+#define EF_SPARC_32PLUS 0x00000100
+#define EF_SPARC_SUN_US1 0x00000200
+#define EF_SPARC_HAL_R1 0x00000200
+#define EF_SPARC_SUN_US3 0x00000800
+
+#define EF_SPARCV9_MM 0x00000003
+#define EF_SPARCV9_TSO 0x00000000
+#define EF_SPARCV9_PSO 0x00000001
+#define EF_SPARCV9_RMO 0x00000002
+
+/* Special section indexes. */
+#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */
+#define SHN_LORESERVE 0xff00 /* First of reserved range. */
+#define SHN_LOPROC 0xff00 /* First processor-specific. */
+#define SHN_HIPROC 0xff1f /* Last processor-specific. */
+#define SHN_LOOS 0xff20 /* First operating system-specific. */
+#define SHN_FBSD_CACHED SHN_LOOS /* Transient, for sys/kern/link_elf_obj
+ linker only: Cached global in local
+ symtab. */
+#define SHN_HIOS 0xff3f /* Last operating system-specific. */
+#define SHN_ABS 0xfff1 /* Absolute values. */
+#define SHN_COMMON 0xfff2 /* Common data. */
+#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere. */
+#define SHN_HIRESERVE 0xffff /* Last of reserved range. */
+
+/* sh_type */
+#define SHT_NULL 0 /* inactive */
+#define SHT_PROGBITS 1 /* program defined information */
+#define SHT_SYMTAB 2 /* symbol table section */
+#define SHT_STRTAB 3 /* string table section */
+#define SHT_RELA 4 /* relocation section with addends */
+#define SHT_HASH 5 /* symbol hash table section */
+#define SHT_DYNAMIC 6 /* dynamic section */
+#define SHT_NOTE 7 /* note section */
+#define SHT_NOBITS 8 /* no space section */
+#define SHT_REL 9 /* relocation section - no addends */
+#define SHT_SHLIB 10 /* reserved - purpose unknown */
+#define SHT_DYNSYM 11 /* dynamic symbol table section */
+#define SHT_INIT_ARRAY 14 /* Initialization function pointers. */
+#define SHT_FINI_ARRAY 15 /* Termination function pointers. */
+#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs. */
+#define SHT_GROUP 17 /* Section group. */
+#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX). */
+#define SHT_LOOS 0x60000000 /* First of OS specific semantics */
+#define SHT_LOSUNW 0x6ffffff4
+#define SHT_SUNW_dof 0x6ffffff4
+#define SHT_SUNW_cap 0x6ffffff5
+#define SHT_GNU_ATTRIBUTES 0x6ffffff5
+#define SHT_SUNW_SIGNATURE 0x6ffffff6
+#define SHT_GNU_HASH 0x6ffffff6
+#define SHT_GNU_LIBLIST 0x6ffffff7
+#define SHT_SUNW_ANNOTATE 0x6ffffff7
+#define SHT_SUNW_DEBUGSTR 0x6ffffff8
+#define SHT_SUNW_DEBUG 0x6ffffff9
+#define SHT_SUNW_move 0x6ffffffa
+#define SHT_SUNW_COMDAT 0x6ffffffb
+#define SHT_SUNW_syminfo 0x6ffffffc
+#define SHT_SUNW_verdef 0x6ffffffd
+#define SHT_GNU_verdef 0x6ffffffd /* Symbol versions provided */
+#define SHT_SUNW_verneed 0x6ffffffe
+#define SHT_GNU_verneed 0x6ffffffe /* Symbol versions required */
+#define SHT_SUNW_versym 0x6fffffff
+#define SHT_GNU_versym 0x6fffffff /* Symbol version table */
+#define SHT_HISUNW 0x6fffffff
+#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */
+#define SHT_LOPROC 0x70000000 /* reserved range for processor */
+#define SHT_X86_64_UNWIND 0x70000001 /* unwind information */
+#define SHT_AMD64_UNWIND SHT_X86_64_UNWIND
+
+#define SHT_ARM_EXIDX 0x70000001 /* Exception index table. */
+#define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking
+ pre-emption map. */
+#define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility
+ attributes. */
+#define SHT_ARM_DEBUGOVERLAY 0x70000004 /* See DBGOVL for details. */
+#define SHT_ARM_OVERLAYSECTION 0x70000005 /* See DBGOVL for details. */
+#define SHT_MIPS_LIBLIST 0x70000000
+#define SHT_MIPS_MSYM 0x70000001
+#define SHT_MIPS_CONFLICT 0x70000002
+#define SHT_MIPS_GPTAB 0x70000003
+#define SHT_MIPS_UCODE 0x70000004
+#define SHT_MIPS_DEBUG 0x70000005
+#define SHT_MIPS_REGINFO 0x70000006
+#define SHT_MIPS_PACKAGE 0x70000007
+#define SHT_MIPS_PACKSYM 0x70000008
+#define SHT_MIPS_RELD 0x70000009
+#define SHT_MIPS_IFACE 0x7000000b
+#define SHT_MIPS_CONTENT 0x7000000c
+#define SHT_MIPS_OPTIONS 0x7000000d
+#define SHT_MIPS_DELTASYM 0x7000001b
+#define SHT_MIPS_DELTAINST 0x7000001c
+#define SHT_MIPS_DELTACLASS 0x7000001d
+#define SHT_MIPS_DWARF 0x7000001e /* MIPS gcc uses MIPS_DWARF */
+#define SHT_MIPS_DELTADECL 0x7000001f
+#define SHT_MIPS_SYMBOL_LIB 0x70000020
+#define SHT_MIPS_EVENTS 0x70000021
+#define SHT_MIPS_TRANSLATE 0x70000022
+#define SHT_MIPS_PIXIE 0x70000023
+#define SHT_MIPS_XLATE 0x70000024
+#define SHT_MIPS_XLATE_DEBUG 0x70000025
+#define SHT_MIPS_WHIRL 0x70000026
+#define SHT_MIPS_EH_REGION 0x70000027
+#define SHT_MIPS_XLATE_OLD 0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+#define SHT_MIPS_ABIFLAGS 0x7000002a
+
+#define SHT_SPARC_GOTDATA 0x70000000
+
+#define SHTORDERED
+#define SHT_HIPROC 0x7fffffff /* specific section header types */
+#define SHT_LOUSER 0x80000000 /* reserved range for application */
+#define SHT_HIUSER 0xffffffff /* specific indexes */
+
+/* Flags for sh_flags. */
+#define SHF_WRITE 0x1 /* Section contains writable data. */
+#define SHF_ALLOC 0x2 /* Section occupies memory. */
+#define SHF_EXECINSTR 0x4 /* Section contains instructions. */
+#define SHF_MERGE 0x10 /* Section may be merged. */
+#define SHF_STRINGS 0x20 /* Section contains strings. */
+#define SHF_INFO_LINK 0x40 /* sh_info holds section index. */
+#define SHF_LINK_ORDER 0x80 /* Special ordering requirements. */
+#define SHF_OS_NONCONFORMING 0x100 /* OS-specific processing required. */
+#define SHF_GROUP 0x200 /* Member of section group. */
+#define SHF_TLS 0x400 /* Section contains TLS data. */
+#define SHF_COMPRESSED 0x800 /* Section contains compressed data. */
+#define SHF_MASKOS 0x0ff00000 /* OS-specific semantics. */
+#define SHF_MASKPROC 0xf0000000 /* Processor-specific semantics. */
+
+/* Flags for section groups. */
+#define GRP_COMDAT 0x1 /* COMDAT semantics. */
+
+/*
+ * Flags / mask for .gnu.versym sections.
+ */
+#define VERSYM_VERSION 0x7fff
+#define VERSYM_HIDDEN 0x8000
+
+/* Values for p_type. */
+#define PT_NULL 0 /* Unused entry. */
+#define PT_LOAD 1 /* Loadable segment. */
+#define PT_DYNAMIC 2 /* Dynamic linking information segment. */
+#define PT_INTERP 3 /* Pathname of interpreter. */
+#define PT_NOTE 4 /* Auxiliary information. */
+#define PT_SHLIB 5 /* Reserved (not used). */
+#define PT_PHDR 6 /* Location of program header itself. */
+#define PT_TLS 7 /* Thread local storage segment */
+#define PT_LOOS 0x60000000 /* First OS-specific. */
+#define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */
+#define PT_DUMP_DELTA 0x6fb5d000 /* va->pa map for kernel dumps
+ (currently arm). */
+#define PT_LOSUNW 0x6ffffffa
+#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+#define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */
+#define PT_SUNWDTRACE 0x6ffffffc /* private */
+#define PT_SUNWCAP 0x6ffffffd /* hard/soft capabilities segment */
+#define PT_HISUNW 0x6fffffff
+#define PT_HIOS 0x6fffffff /* Last OS-specific. */
+#define PT_LOPROC 0x70000000 /* First processor-specific type. */
+#define PT_ARM_ARCHEXT 0x70000000 /* ARM arch compat information. */
+#define PT_ARM_EXIDX 0x70000001 /* ARM exception unwind tables. */
+#define PT_MIPS_REGINFO 0x70000000 /* MIPS register usage info */
+#define PT_MIPS_RTPROC 0x70000001 /* MIPS runtime procedure tbl */
+#define PT_MIPS_OPTIONS 0x70000002 /* MIPS e_flags value*/
+#define PT_MIPS_ABIFLAGS 0x70000003 /* MIPS fp mode */
+#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */
+
+#define PT_OPENBSD_RANDOMIZE 0x65A3DBE6 /* OpenBSD random data segment */
+#define PT_OPENBSD_WXNEEDED 0x65A3DBE7 /* OpenBSD EXEC/WRITE pages needed */
+#define PT_OPENBSD_BOOTDATA 0x65A41BE6 /* OpenBSD section for boot args */
+
+/* Values for p_flags. */
+#define PF_X 0x1 /* Executable. */
+#define PF_W 0x2 /* Writable. */
+#define PF_R 0x4 /* Readable. */
+#define PF_MASKOS 0x0ff00000 /* Operating system-specific. */
+#define PF_MASKPROC 0xf0000000 /* Processor-specific. */
+
+/* Extended program header index. */
+#define PN_XNUM 0xffff
+
+/* Values for d_tag. */
+#define DT_NULL 0 /* Terminating entry. */
+#define DT_NEEDED 1 /* String table offset of a needed shared
+ library. */
+#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */
+#define DT_PLTGOT 3 /* Processor-dependent address. */
+#define DT_HASH 4 /* Address of symbol hash table. */
+#define DT_STRTAB 5 /* Address of string table. */
+#define DT_SYMTAB 6 /* Address of symbol table. */
+#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */
+#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */
+#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */
+#define DT_STRSZ 10 /* Size of string table. */
+#define DT_SYMENT 11 /* Size of each symbol table entry. */
+#define DT_INIT 12 /* Address of initialization function. */
+#define DT_FINI 13 /* Address of finalization function. */
+#define DT_SONAME 14 /* String table offset of shared object
+ name. */
+#define DT_RPATH 15 /* String table offset of library path. [sup] */
+#define DT_SYMBOLIC 16 /* Indicates "symbolic" linking. [sup] */
+#define DT_REL 17 /* Address of ElfNN_Rel relocations. */
+#define DT_RELSZ 18 /* Total size of ElfNN_Rel relocations. */
+#define DT_RELENT 19 /* Size of each ElfNN_Rel relocation. */
+#define DT_PLTREL 20 /* Type of relocation used for PLT. */
+#define DT_DEBUG 21 /* Reserved (not used). */
+#define DT_TEXTREL 22 /* Indicates there may be relocations in
+ non-writable segments. [sup] */
+#define DT_JMPREL 23 /* Address of PLT relocations. */
+#define DT_BIND_NOW 24 /* [sup] */
+#define DT_INIT_ARRAY 25 /* Address of the array of pointers to
+ initialization functions */
+#define DT_FINI_ARRAY 26 /* Address of the array of pointers to
+ termination functions */
+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of
+ initialization functions. */
+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of
+ termination functions. */
+#define DT_RUNPATH 29 /* String table offset of a null-terminated
+ library search path string. */
+#define DT_FLAGS 30 /* Object specific flag values. */
+#define DT_ENCODING 32 /* Values greater than or equal to DT_ENCODING
+ and less than DT_LOOS follow the rules for
+ the interpretation of the d_un union
+ as follows: even == 'd_ptr', odd == 'd_val'
+ or none */
+#define DT_PREINIT_ARRAY 32 /* Address of the array of pointers to
+ pre-initialization functions. */
+#define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of
+ pre-initialization functions. */
+#define DT_MAXPOSTAGS 34 /* number of positive tags */
+#define DT_RELRSZ 35 /* Total size of ElfNN_Relr relocations. */
+#define DT_RELR 36 /* Address of ElfNN_Relr relocations. */
+#define DT_RELRENT 37 /* Size of each ElfNN_Relr relocation. */
+#define DT_LOOS 0x6000000d /* First OS-specific */
+#define DT_SUNW_AUXILIARY 0x6000000d /* symbol auxiliary name */
+#define DT_SUNW_RTLDINF 0x6000000e /* ld.so.1 info (private) */
+#define DT_SUNW_FILTER 0x6000000f /* symbol filter name */
+#define DT_SUNW_CAP 0x60000010 /* hardware/software */
+#define DT_SUNW_ASLR 0x60000023 /* ASLR control */
+#define DT_HIOS 0x6ffff000 /* Last OS-specific */
+
+/*
+ * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
+ * Dyn.d_un.d_val field of the Elf*_Dyn structure.
+ */
+#define DT_VALRNGLO 0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5 /* prelinking timestamp */
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* size of conflict section */
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* size of library list */
+#define DT_CHECKSUM 0x6ffffdf8 /* elf checksum */
+#define DT_PLTPADSZ 0x6ffffdf9 /* pltpadding size */
+#define DT_MOVEENT 0x6ffffdfa /* move table entry size */
+#define DT_MOVESZ 0x6ffffdfb /* move table size */
+#define DT_FEATURE 0x6ffffdfc /* feature holder */
+#define DT_FEATURE_1 DT_FEATURE
+#define DT_POSFLAG_1 0x6ffffdfd /* flags for DT_* entries, effecting */
+ /* the following DT_* entry. */
+ /* See DF_P1_* definitions */
+#define DT_SYMINSZ 0x6ffffdfe /* syminfo table size (in bytes) */
+#define DT_SYMINENT 0x6ffffdff /* syminfo entry size (in bytes) */
+#define DT_VALRNGHI 0x6ffffdff
+
+/*
+ * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
+ * Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
+ *
+ * If any adjustment is made to the ELF object after it has been
+ * built, these entries will need to be adjusted.
+ */
+#define DT_ADDRRNGLO 0x6ffffe00
+#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table */
+#define DT_TLSDESC_PLT 0x6ffffef6 /* loc. of PLT for tlsdesc resolver */
+#define DT_TLSDESC_GOT 0x6ffffef7 /* loc. of GOT for tlsdesc resolver */
+#define DT_GNU_CONFLICT 0x6ffffef8 /* address of conflict section */
+#define DT_GNU_LIBLIST 0x6ffffef9 /* address of library list */
+#define DT_CONFIG 0x6ffffefa /* configuration information */
+#define DT_DEPAUDIT 0x6ffffefb /* dependency auditing */
+#define DT_AUDIT 0x6ffffefc /* object auditing */
+#define DT_PLTPAD 0x6ffffefd /* pltpadding (sparcv9) */
+#define DT_MOVETAB 0x6ffffefe /* move table */
+#define DT_SYMINFO 0x6ffffeff /* syminfo table */
+#define DT_ADDRRNGHI 0x6ffffeff
+
+#define DT_VERSYM 0x6ffffff0 /* Address of versym section. */
+#define DT_RELACOUNT 0x6ffffff9 /* number of RELATIVE relocations */
+#define DT_RELCOUNT 0x6ffffffa /* number of RELATIVE relocations */
+#define DT_FLAGS_1 0x6ffffffb /* state flags - see DF_1_* defs */
+#define DT_VERDEF 0x6ffffffc /* Address of verdef section. */
+#define DT_VERDEFNUM 0x6ffffffd /* Number of elems in verdef section */
+#define DT_VERNEED 0x6ffffffe /* Address of verneed section. */
+#define DT_VERNEEDNUM 0x6fffffff /* Number of elems in verneed section */
+
+#define DT_LOPROC 0x70000000 /* First processor-specific type. */
+
+#define DT_AARCH64_BTI_PLT 0x70000001
+#define DT_AARCH64_PAC_PLT 0x70000003
+#define DT_AARCH64_VARIANT_PCS 0x70000005
+#define DT_AARCH64_MEMTAG_MODE 0x70000009
+#define DT_AARCH64_MEMTAG_HEAP 0x7000000b
+#define DT_AARCH64_MEMTAG_STACK 0x7000000c
+#define DT_AARCH64_MEMTAG_GLOBALS 0x7000000d
+#define DT_AARCH64_MEMTAG_GLOBALSSZ 0x7000000f
+
+#define DT_ARM_SYMTABSZ 0x70000001
+#define DT_ARM_PREEMPTMAP 0x70000002
+
+#define DT_SPARC_REGISTER 0x70000001
+#define DT_DEPRECATED_SPARC_REGISTER 0x7000001
+
+#define DT_MIPS_RLD_VERSION 0x70000001
+#define DT_MIPS_TIME_STAMP 0x70000002
+#define DT_MIPS_ICHECKSUM 0x70000003
+#define DT_MIPS_IVERSION 0x70000004
+#define DT_MIPS_FLAGS 0x70000005
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_CONFLICT 0x70000008
+#define DT_MIPS_LIBLIST 0x70000009
+#define DT_MIPS_LOCAL_GOTNO 0x7000000a
+#define DT_MIPS_CONFLICTNO 0x7000000b
+#define DT_MIPS_LIBLISTNO 0x70000010
+#define DT_MIPS_SYMTABNO 0x70000011
+#define DT_MIPS_UNREFEXTNO 0x70000012
+#define DT_MIPS_GOTSYM 0x70000013
+#define DT_MIPS_HIPAGENO 0x70000014
+#define DT_MIPS_RLD_MAP 0x70000016
+#define DT_MIPS_DELTA_CLASS 0x70000017
+#define DT_MIPS_DELTA_CLASS_NO 0x70000018
+#define DT_MIPS_DELTA_INSTANCE 0x70000019
+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001A
+#define DT_MIPS_DELTA_RELOC 0x7000001B
+#define DT_MIPS_DELTA_RELOC_NO 0x7000001C
+#define DT_MIPS_DELTA_SYM 0x7000001D
+#define DT_MIPS_DELTA_SYM_NO 0x7000001E
+#define DT_MIPS_DELTA_CLASSSYM 0x70000020
+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
+#define DT_MIPS_CXX_FLAGS 0x70000022
+#define DT_MIPS_PIXIE_INIT 0x70000023
+#define DT_MIPS_SYMBOL_LIB 0x70000024
+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
+#define DT_MIPS_LOCAL_GOTIDX 0x70000026
+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
+#define DT_MIPS_OPTIONS 0x70000029
+#define DT_MIPS_INTERFACE 0x7000002A
+#define DT_MIPS_DYNSTR_ALIGN 0x7000002B
+#define DT_MIPS_INTERFACE_SIZE 0x7000002C
+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002D
+#define DT_MIPS_PERF_SUFFIX 0x7000002E
+#define DT_MIPS_COMPACT_SIZE 0x7000002F
+#define DT_MIPS_GP_VALUE 0x70000030
+#define DT_MIPS_AUX_DYNAMIC 0x70000031
+#define DT_MIPS_PLTGOT 0x70000032
+#define DT_MIPS_RLD_OBJ_UPDATE 0x70000033
+#define DT_MIPS_RWPLT 0x70000034
+#define DT_MIPS_RLD_MAP_REL 0x70000035
+
+#define DT_PPC_GOT 0x70000000
+#define DT_PPC_TLSOPT 0x70000001
+
+#define DT_PPC64_GLINK 0x70000000
+#define DT_PPC64_OPD 0x70000001
+#define DT_PPC64_OPDSZ 0x70000002
+#define DT_PPC64_TLSOPT 0x70000003
+
+#define DT_AUXILIARY 0x7ffffffd /* shared library auxiliary name */
+#define DT_USED 0x7ffffffe /* ignored - same as needed */
+#define DT_FILTER 0x7fffffff /* shared library filter name */
+#define DT_HIPROC 0x7fffffff /* Last processor-specific type. */
+
+/* Values for DT_FLAGS */
+#define DF_ORIGIN 0x0001 /* Indicates that the object being loaded may
+ make reference to the $ORIGIN substitution
+ string */
+#define DF_SYMBOLIC 0x0002 /* Indicates "symbolic" linking. */
+#define DF_TEXTREL 0x0004 /* Indicates there may be relocations in
+ non-writable segments. */
+#define DF_BIND_NOW 0x0008 /* Indicates that the dynamic linker should
+ process all relocations for the object
+ containing this entry before transferring
+ control to the program. */
+#define DF_STATIC_TLS 0x0010 /* Indicates that the shared object or
+ executable contains code using a static
+ thread-local storage scheme. */
+
+/* Values for DT_FLAGS_1 */
+#define DF_1_BIND_NOW 0x00000001 /* Same as DF_BIND_NOW */
+#define DF_1_GLOBAL 0x00000002 /* Set the RTLD_GLOBAL for object */
+#define DF_1_NODELETE 0x00000008 /* Set the RTLD_NODELETE for object */
+#define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filtees */
+#define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */
+#define DF_1_ORIGIN 0x00000080 /* Process $ORIGIN */
+#define DF_1_INTERPOSE 0x00000400 /* Interpose all objects but main */
+#define DF_1_NODEFLIB 0x00000800 /* Do not search default paths */
+#define DF_1_PIE 0x08000000 /* Is position-independent executable */
+
+/* Values for l_flags. */
+#define LL_NONE 0x0 /* no flags */
+#define LL_EXACT_MATCH 0x1 /* require an exact match */
+#define LL_IGNORE_INT_VER 0x2 /* ignore version incompatibilities */
+#define LL_REQUIRE_MINOR 0x4
+#define LL_EXPORTS 0x8
+#define LL_DELAY_LOAD 0x10
+#define LL_DELTA 0x20
+
+/* Note section names */
+#define ELF_NOTE_FREEBSD "FreeBSD"
+#define ELF_NOTE_NETBSD "NetBSD"
+#define ELF_NOTE_SOLARIS "SUNW Solaris"
+#define ELF_NOTE_GNU "GNU"
+
+/* Values for n_type used in executables. */
+#define NT_FREEBSD_ABI_TAG 1
+#define NT_FREEBSD_NOINIT_TAG 2
+#define NT_FREEBSD_ARCH_TAG 3
+#define NT_FREEBSD_FEATURE_CTL 4
+
+/* NT_FREEBSD_FEATURE_CTL desc[0] bits */
+#define NT_FREEBSD_FCTL_ASLR_DISABLE 0x00000001
+#define NT_FREEBSD_FCTL_PROTMAX_DISABLE 0x00000002
+#define NT_FREEBSD_FCTL_STKGAP_DISABLE 0x00000004
+#define NT_FREEBSD_FCTL_WXNEEDED 0x00000008
+#define NT_FREEBSD_FCTL_LA48 0x00000010
+/* was ASG_DISABLE, do not reuse 0x00000020 */
+
+/* Values for n_type. Used in core files. */
+#define NT_PRSTATUS 1 /* Process status. */
+#define NT_FPREGSET 2 /* Floating point registers. */
+#define NT_PRPSINFO 3 /* Process state info. */
+#define NT_THRMISC 7 /* Thread miscellaneous info. */
+#define NT_PROCSTAT_PROC 8 /* Procstat proc data. */
+#define NT_PROCSTAT_FILES 9 /* Procstat files data. */
+#define NT_PROCSTAT_VMMAP 10 /* Procstat vmmap data. */
+#define NT_PROCSTAT_GROUPS 11 /* Procstat groups data. */
+#define NT_PROCSTAT_UMASK 12 /* Procstat umask data. */
+#define NT_PROCSTAT_RLIMIT 13 /* Procstat rlimit data. */
+#define NT_PROCSTAT_OSREL 14 /* Procstat osreldate data. */
+#define NT_PROCSTAT_PSSTRINGS 15 /* Procstat ps_strings data. */
+#define NT_PROCSTAT_AUXV 16 /* Procstat auxv data. */
+#define NT_PTLWPINFO 17 /* Thread ptrace miscellaneous info. */
+#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
+#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
+#define NT_X86_SEGBASES 0x200 /* x86 FS/GS base addresses. */
+#define NT_X86_XSTATE 0x202 /* x86 XSAVE extended state. */
+#define NT_ARM_VFP 0x400 /* ARM VFP registers */
+#define NT_ARM_TLS 0x401 /* ARM TLS register */
+#define NT_ARM_ADDR_MASK 0x406 /* arm64 address mask (e.g. for TBI) */
+
+/* GNU note types. */
+#define NT_GNU_ABI_TAG 1
+#define NT_GNU_HWCAP 2
+#define NT_GNU_BUILD_ID 3
+#define NT_GNU_GOLD_VERSION 4
+#define NT_GNU_PROPERTY_TYPE_0 5
+
+#define GNU_PROPERTY_LOPROC 0xc0000000
+#define GNU_PROPERTY_HIPROC 0xdfffffff
+
+#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
+
+#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC 0x00000002
+
+#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
+
+#define GNU_PROPERTY_X86_FEATURE_1_IBT 0x00000001
+#define GNU_PROPERTY_X86_FEATURE_1_SHSTK 0x00000002
+
+/* Symbol Binding - ELFNN_ST_BIND - st_info */
+#define STB_LOCAL 0 /* Local symbol */
+#define STB_GLOBAL 1 /* Global symbol */
+#define STB_WEAK 2 /* like global - lower precedence */
+#define STB_LOOS 10 /* Start of operating system reserved range. */
+#define STB_GNU_UNIQUE 10 /* Unique symbol (GNU) */
+#define STB_HIOS 12 /* End of operating system reserved range. */
+#define STB_LOPROC 13 /* reserved range for processor */
+#define STB_HIPROC 15 /* specific semantics. */
+
+/* Symbol type - ELFNN_ST_TYPE - st_info */
+#define STT_NOTYPE 0 /* Unspecified type. */
+#define STT_OBJECT 1 /* Data object. */
+#define STT_FUNC 2 /* Function. */
+#define STT_SECTION 3 /* Section. */
+#define STT_FILE 4 /* Source file. */
+#define STT_COMMON 5 /* Uninitialized common block. */
+#define STT_TLS 6 /* TLS object. */
+#define STT_NUM 7
+#define STT_LOOS 10 /* Reserved range for operating system */
+#define STT_GNU_IFUNC 10
+#define STT_HIOS 12 /* specific semantics. */
+#define STT_LOPROC 13 /* Start of processor reserved range. */
+#define STT_SPARC_REGISTER 13 /* SPARC register information. */
+#define STT_HIPROC 15 /* End of processor reserved range. */
+
+/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */
+#define STV_DEFAULT 0x0 /* Default visibility (see binding). */
+#define STV_INTERNAL 0x1 /* Special meaning in relocatable objects. */
+#define STV_HIDDEN 0x2 /* Not visible. */
+#define STV_PROTECTED 0x3 /* Visible but not preemptible. */
+#define STV_EXPORTED 0x4
+#define STV_SINGLETON 0x5
+#define STV_ELIMINATE 0x6
+
+/* Special symbol table indexes. */
+#define STN_UNDEF 0 /* Undefined symbol index. */
+
+/* Symbol versioning flags. */
+#define VER_DEF_CURRENT 1
+#define VER_DEF_IDX(x) VER_NDX(x)
+
+#define VER_FLG_BASE 0x01
+#define VER_FLG_WEAK 0x02
+
+#define VER_NEED_CURRENT 1
+#define VER_NEED_WEAK (1u << 15)
+#define VER_NEED_HIDDEN VER_NDX_HIDDEN
+#define VER_NEED_IDX(x) VER_NDX(x)
+
+#define VER_NDX_LOCAL 0
+#define VER_NDX_GLOBAL 1
+#define VER_NDX_GIVEN 2
+
+#define VER_NDX_HIDDEN (1u << 15)
+#define VER_NDX(x) ((x) & ~(1u << 15))
+
+#define CA_SUNW_NULL 0
+#define CA_SUNW_HW_1 1 /* first hardware capabilities entry */
+#define CA_SUNW_SF_1 2 /* first software capabilities entry */
+
+/*
+ * Syminfo flag values
+ */
+#define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association */
+ /* to object containing defn. */
+#define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */
+#define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */
+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be */
+ /* lazily-loaded */
+#define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to */
+ /* object containing defn. */
+#define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference */
+ /* directly bind to this symbol */
+#define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */
+#define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */
+
+/*
+ * Syminfo.si_boundto values.
+ */
+#define SYMINFO_BT_SELF 0xffff /* symbol bound to self */
+#define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */
+#define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */
+#define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */
+#define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */
+
+/*
+ * Syminfo version values.
+ */
+#define SYMINFO_NONE 0 /* Syminfo version */
+#define SYMINFO_CURRENT 1
+#define SYMINFO_NUM 2
+
+/* Values for ch_type (compressed section headers). */
+#define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE */
+#define ELFCOMPRESS_ZSTD 2 /* Zstandard */
+#define ELFCOMPRESS_LOOS 0x60000000 /* OS-specific */
+#define ELFCOMPRESS_HIOS 0x6fffffff
+#define ELFCOMPRESS_LOPROC 0x70000000 /* Processor-specific */
+#define ELFCOMPRESS_HIPROC 0x7fffffff
+
+/*
+ * Relocation types.
+ *
+ * All machine architectures are defined here to allow tools on one to
+ * handle others.
+ */
+
+#define R_386_NONE 0 /* No relocation. */
+#define R_386_32 1 /* Add symbol value. */
+#define R_386_PC32 2 /* Add PC-relative symbol value. */
+#define R_386_GOT32 3 /* Add PC-relative GOT offset. */
+#define R_386_PLT32 4 /* Add PC-relative PLT offset. */
+#define R_386_COPY 5 /* Copy data from shared object. */
+#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */
+#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */
+#define R_386_RELATIVE 8 /* Add load address of shared object. */
+#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */
+#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */
+#define R_386_32PLT 11
+#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */
+#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */
+#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */
+#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */
+#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */
+#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */
+#define R_386_16 20
+#define R_386_PC16 21
+#define R_386_8 22
+#define R_386_PC8 23
+#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */
+#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */
+#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */
+#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */
+#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */
+#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */
+#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */
+#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */
+#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */
+#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */
+#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */
+#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */
+#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */
+#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */
+#define R_386_SIZE32 38
+#define R_386_TLS_GOTDESC 39
+#define R_386_TLS_DESC_CALL 40
+#define R_386_TLS_DESC 41
+#define R_386_IRELATIVE 42 /* PLT entry resolved indirectly at runtime */
+#define R_386_GOT32X 43
+
+#define R_AARCH64_NONE 0 /* No relocation */
+#define R_AARCH64_ABS64 257 /* Absolute offset */
+#define R_AARCH64_ABS32 258 /* Absolute, 32-bit overflow check */
+#define R_AARCH64_ABS16 259 /* Absolute, 16-bit overflow check */
+#define R_AARCH64_PREL64 260 /* PC relative */
+#define R_AARCH64_PREL32 261 /* PC relative, 32-bit overflow check */
+#define R_AARCH64_PREL16 262 /* PC relative, 16-bit overflow check */
+#define R_AARCH64_TSTBR14 279 /* TBZ/TBNZ immediate */
+#define R_AARCH64_CONDBR19 280 /* Conditional branch immediate */
+#define R_AARCH64_JUMP26 282 /* Branch immediate */
+#define R_AARCH64_CALL26 283 /* Call immediate */
+#define R_AARCH64_COPY 1024 /* Copy data from shared object */
+#define R_AARCH64_GLOB_DAT 1025 /* Set GOT entry to data address */
+#define R_AARCH64_JUMP_SLOT 1026 /* Set GOT entry to code address */
+#define R_AARCH64_RELATIVE 1027 /* Add load address of shared object */
+#define R_AARCH64_TLS_DTPREL64 1028
+#define R_AARCH64_TLS_DTPMOD64 1029
+#define R_AARCH64_TLS_TPREL64 1030
+#define R_AARCH64_TLSDESC 1031 /* Identify the TLS descriptor */
+#define R_AARCH64_IRELATIVE 1032
+
+#define R_ARM_NONE 0 /* No relocation. */
+#define R_ARM_PC24 1
+#define R_ARM_ABS32 2
+#define R_ARM_REL32 3
+#define R_ARM_PC13 4
+#define R_ARM_ABS16 5
+#define R_ARM_ABS12 6
+#define R_ARM_THM_ABS5 7
+#define R_ARM_ABS8 8
+#define R_ARM_SBREL32 9
+#define R_ARM_THM_PC22 10
+#define R_ARM_THM_PC8 11
+#define R_ARM_AMP_VCALL9 12
+#define R_ARM_SWI24 13
+#define R_ARM_THM_SWI8 14
+#define R_ARM_XPC25 15
+#define R_ARM_THM_XPC22 16
+/* TLS relocations */
+#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */
+#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */
+#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */
+#define R_ARM_COPY 20 /* Copy data from shared object. */
+#define R_ARM_GLOB_DAT 21 /* Set GOT entry to data address. */
+#define R_ARM_JUMP_SLOT 22 /* Set GOT entry to code address. */
+#define R_ARM_RELATIVE 23 /* Add load address of shared object. */
+#define R_ARM_GOTOFF 24 /* Add GOT-relative symbol address. */
+#define R_ARM_GOTPC 25 /* Add PC-relative GOT table address. */
+#define R_ARM_GOT32 26 /* Add PC-relative GOT offset. */
+#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */
+#define R_ARM_GNU_VTENTRY 100
+#define R_ARM_GNU_VTINHERIT 101
+#define R_ARM_RSBREL32 250
+#define R_ARM_THM_RPC22 251
+#define R_ARM_RREL32 252
+#define R_ARM_RABS32 253
+#define R_ARM_RPC24 254
+#define R_ARM_RBASE 255
+
+/* Name Value Field Calculation */
+#define R_IA_64_NONE 0 /* None */
+#define R_IA_64_IMM14 0x21 /* immediate14 S + A */
+#define R_IA_64_IMM22 0x22 /* immediate22 S + A */
+#define R_IA_64_IMM64 0x23 /* immediate64 S + A */
+#define R_IA_64_DIR32MSB 0x24 /* word32 MSB S + A */
+#define R_IA_64_DIR32LSB 0x25 /* word32 LSB S + A */
+#define R_IA_64_DIR64MSB 0x26 /* word64 MSB S + A */
+#define R_IA_64_DIR64LSB 0x27 /* word64 LSB S + A */
+#define R_IA_64_GPREL22 0x2a /* immediate22 @gprel(S + A) */
+#define R_IA_64_GPREL64I 0x2b /* immediate64 @gprel(S + A) */
+#define R_IA_64_GPREL32MSB 0x2c /* word32 MSB @gprel(S + A) */
+#define R_IA_64_GPREL32LSB 0x2d /* word32 LSB @gprel(S + A) */
+#define R_IA_64_GPREL64MSB 0x2e /* word64 MSB @gprel(S + A) */
+#define R_IA_64_GPREL64LSB 0x2f /* word64 LSB @gprel(S + A) */
+#define R_IA_64_LTOFF22 0x32 /* immediate22 @ltoff(S + A) */
+#define R_IA_64_LTOFF64I 0x33 /* immediate64 @ltoff(S + A) */
+#define R_IA_64_PLTOFF22 0x3a /* immediate22 @pltoff(S + A) */
+#define R_IA_64_PLTOFF64I 0x3b /* immediate64 @pltoff(S + A) */
+#define R_IA_64_PLTOFF64MSB 0x3e /* word64 MSB @pltoff(S + A) */
+#define R_IA_64_PLTOFF64LSB 0x3f /* word64 LSB @pltoff(S + A) */
+#define R_IA_64_FPTR64I 0x43 /* immediate64 @fptr(S + A) */
+#define R_IA_64_FPTR32MSB 0x44 /* word32 MSB @fptr(S + A) */
+#define R_IA_64_FPTR32LSB 0x45 /* word32 LSB @fptr(S + A) */
+#define R_IA_64_FPTR64MSB 0x46 /* word64 MSB @fptr(S + A) */
+#define R_IA_64_FPTR64LSB 0x47 /* word64 LSB @fptr(S + A) */
+#define R_IA_64_PCREL60B 0x48 /* immediate60 form1 S + A - P */
+#define R_IA_64_PCREL21B 0x49 /* immediate21 form1 S + A - P */
+#define R_IA_64_PCREL21M 0x4a /* immediate21 form2 S + A - P */
+#define R_IA_64_PCREL21F 0x4b /* immediate21 form3 S + A - P */
+#define R_IA_64_PCREL32MSB 0x4c /* word32 MSB S + A - P */
+#define R_IA_64_PCREL32LSB 0x4d /* word32 LSB S + A - P */
+#define R_IA_64_PCREL64MSB 0x4e /* word64 MSB S + A - P */
+#define R_IA_64_PCREL64LSB 0x4f /* word64 LSB S + A - P */
+#define R_IA_64_LTOFF_FPTR22 0x52 /* immediate22 @ltoff(@fptr(S + A)) */
+#define R_IA_64_LTOFF_FPTR64I 0x53 /* immediate64 @ltoff(@fptr(S + A)) */
+#define R_IA_64_LTOFF_FPTR32MSB 0x54 /* word32 MSB @ltoff(@fptr(S + A)) */
+#define R_IA_64_LTOFF_FPTR32LSB 0x55 /* word32 LSB @ltoff(@fptr(S + A)) */
+#define R_IA_64_LTOFF_FPTR64MSB 0x56 /* word64 MSB @ltoff(@fptr(S + A)) */
+#define R_IA_64_LTOFF_FPTR64LSB 0x57 /* word64 LSB @ltoff(@fptr(S + A)) */
+#define R_IA_64_SEGREL32MSB 0x5c /* word32 MSB @segrel(S + A) */
+#define R_IA_64_SEGREL32LSB 0x5d /* word32 LSB @segrel(S + A) */
+#define R_IA_64_SEGREL64MSB 0x5e /* word64 MSB @segrel(S + A) */
+#define R_IA_64_SEGREL64LSB 0x5f /* word64 LSB @segrel(S + A) */
+#define R_IA_64_SECREL32MSB 0x64 /* word32 MSB @secrel(S + A) */
+#define R_IA_64_SECREL32LSB 0x65 /* word32 LSB @secrel(S + A) */
+#define R_IA_64_SECREL64MSB 0x66 /* word64 MSB @secrel(S + A) */
+#define R_IA_64_SECREL64LSB 0x67 /* word64 LSB @secrel(S + A) */
+#define R_IA_64_REL32MSB 0x6c /* word32 MSB BD + A */
+#define R_IA_64_REL32LSB 0x6d /* word32 LSB BD + A */
+#define R_IA_64_REL64MSB 0x6e /* word64 MSB BD + A */
+#define R_IA_64_REL64LSB 0x6f /* word64 LSB BD + A */
+#define R_IA_64_LTV32MSB 0x74 /* word32 MSB S + A */
+#define R_IA_64_LTV32LSB 0x75 /* word32 LSB S + A */
+#define R_IA_64_LTV64MSB 0x76 /* word64 MSB S + A */
+#define R_IA_64_LTV64LSB 0x77 /* word64 LSB S + A */
+#define R_IA_64_PCREL21BI 0x79 /* immediate21 form1 S + A - P */
+#define R_IA_64_PCREL22 0x7a /* immediate22 S + A - P */
+#define R_IA_64_PCREL64I 0x7b /* immediate64 S + A - P */
+#define R_IA_64_IPLTMSB 0x80 /* function descriptor MSB special */
+#define R_IA_64_IPLTLSB 0x81 /* function descriptor LSB speciaal */
+#define R_IA_64_SUB 0x85 /* immediate64 A - S */
+#define R_IA_64_LTOFF22X 0x86 /* immediate22 special */
+#define R_IA_64_LDXMOV 0x87 /* immediate22 special */
+#define R_IA_64_TPREL14 0x91 /* imm14 @tprel(S + A) */
+#define R_IA_64_TPREL22 0x92 /* imm22 @tprel(S + A) */
+#define R_IA_64_TPREL64I 0x93 /* imm64 @tprel(S + A) */
+#define R_IA_64_TPREL64MSB 0x96 /* word64 MSB @tprel(S + A) */
+#define R_IA_64_TPREL64LSB 0x97 /* word64 LSB @tprel(S + A) */
+#define R_IA_64_LTOFF_TPREL22 0x9a /* imm22 @ltoff(@tprel(S+A)) */
+#define R_IA_64_DTPMOD64MSB 0xa6 /* word64 MSB @dtpmod(S + A) */
+#define R_IA_64_DTPMOD64LSB 0xa7 /* word64 LSB @dtpmod(S + A) */
+#define R_IA_64_LTOFF_DTPMOD22 0xaa /* imm22 @ltoff(@dtpmod(S+A)) */
+#define R_IA_64_DTPREL14 0xb1 /* imm14 @dtprel(S + A) */
+#define R_IA_64_DTPREL22 0xb2 /* imm22 @dtprel(S + A) */
+#define R_IA_64_DTPREL64I 0xb3 /* imm64 @dtprel(S + A) */
+#define R_IA_64_DTPREL32MSB 0xb4 /* word32 MSB @dtprel(S + A) */
+#define R_IA_64_DTPREL32LSB 0xb5 /* word32 LSB @dtprel(S + A) */
+#define R_IA_64_DTPREL64MSB 0xb6 /* word64 MSB @dtprel(S + A) */
+#define R_IA_64_DTPREL64LSB 0xb7 /* word64 LSB @dtprel(S + A) */
+#define R_IA_64_LTOFF_DTPREL22 0xba /* imm22 @ltoff(@dtprel(S+A)) */
+
+#define R_MIPS_NONE 0 /* No reloc */
+#define R_MIPS_16 1 /* Direct 16 bit */
+#define R_MIPS_32 2 /* Direct 32 bit */
+#define R_MIPS_REL32 3 /* PC relative 32 bit */
+#define R_MIPS_26 4 /* Direct 26 bit shifted */
+#define R_MIPS_HI16 5 /* High 16 bit */
+#define R_MIPS_LO16 6 /* Low 16 bit */
+#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
+#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
+#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
+#define R_MIPS_PC16 10 /* PC relative 16 bit */
+#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
+#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
+#define R_MIPS_64 18 /* Direct 64 bit */
+#define R_MIPS_GOT_DISP 19
+#define R_MIPS_GOT_PAGE 20
+#define R_MIPS_GOT_OFST 21
+#define R_MIPS_GOT_HI16 22 /* GOT HI 16 bit */
+#define R_MIPS_GOT_LO16 23 /* GOT LO 16 bit */
+#define R_MIPS_SUB 24
+#define R_MIPS_CALLHI16 30 /* upper 16 bit GOT entry for function */
+#define R_MIPS_CALLLO16 31 /* lower 16 bit GOT entry for function */
+#define R_MIPS_JALR 37
+#define R_MIPS_TLS_GD 42
+#define R_MIPS_COPY 126
+#define R_MIPS_JUMP_SLOT 127
+
+#define R_PPC_NONE 0 /* No relocation. */
+#define R_PPC_ADDR32 1
+#define R_PPC_ADDR24 2
+#define R_PPC_ADDR16 3
+#define R_PPC_ADDR16_LO 4
+#define R_PPC_ADDR16_HI 5
+#define R_PPC_ADDR16_HA 6
+#define R_PPC_ADDR14 7
+#define R_PPC_ADDR14_BRTAKEN 8
+#define R_PPC_ADDR14_BRNTAKEN 9
+#define R_PPC_REL24 10
+#define R_PPC_REL14 11
+#define R_PPC_REL14_BRTAKEN 12
+#define R_PPC_REL14_BRNTAKEN 13
+#define R_PPC_GOT16 14
+#define R_PPC_GOT16_LO 15
+#define R_PPC_GOT16_HI 16
+#define R_PPC_GOT16_HA 17
+#define R_PPC_PLTREL24 18
+#define R_PPC_COPY 19
+#define R_PPC_GLOB_DAT 20
+#define R_PPC_JMP_SLOT 21
+#define R_PPC_RELATIVE 22
+#define R_PPC_LOCAL24PC 23
+#define R_PPC_UADDR32 24
+#define R_PPC_UADDR16 25
+#define R_PPC_REL32 26
+#define R_PPC_PLT32 27
+#define R_PPC_PLTREL32 28
+#define R_PPC_PLT16_LO 29
+#define R_PPC_PLT16_HI 30
+#define R_PPC_PLT16_HA 31
+#define R_PPC_SDAREL16 32
+#define R_PPC_SECTOFF 33
+#define R_PPC_SECTOFF_LO 34
+#define R_PPC_SECTOFF_HI 35
+#define R_PPC_SECTOFF_HA 36
+#define R_PPC_IRELATIVE 248
+
+/*
+ * 64-bit relocations
+ */
+#define R_PPC64_ADDR64 38
+#define R_PPC64_ADDR16_HIGHER 39
+#define R_PPC64_ADDR16_HIGHERA 40
+#define R_PPC64_ADDR16_HIGHEST 41
+#define R_PPC64_ADDR16_HIGHESTA 42
+#define R_PPC64_UADDR64 43
+#define R_PPC64_REL64 44
+#define R_PPC64_PLT64 45
+#define R_PPC64_PLTREL64 46
+#define R_PPC64_TOC16 47
+#define R_PPC64_TOC16_LO 48
+#define R_PPC64_TOC16_HI 49
+#define R_PPC64_TOC16_HA 50
+#define R_PPC64_TOC 51
+#define R_PPC64_DTPMOD64 68
+#define R_PPC64_TPREL64 73
+#define R_PPC64_DTPREL64 78
+
+/*
+ * TLS relocations
+ */
+#define R_PPC_TLS 67
+#define R_PPC_DTPMOD32 68
+#define R_PPC_TPREL16 69
+#define R_PPC_TPREL16_LO 70
+#define R_PPC_TPREL16_HI 71
+#define R_PPC_TPREL16_HA 72
+#define R_PPC_TPREL32 73
+#define R_PPC_DTPREL16 74
+#define R_PPC_DTPREL16_LO 75
+#define R_PPC_DTPREL16_HI 76
+#define R_PPC_DTPREL16_HA 77
+#define R_PPC_DTPREL32 78
+#define R_PPC_GOT_TLSGD16 79
+#define R_PPC_GOT_TLSGD16_LO 80
+#define R_PPC_GOT_TLSGD16_HI 81
+#define R_PPC_GOT_TLSGD16_HA 82
+#define R_PPC_GOT_TLSLD16 83
+#define R_PPC_GOT_TLSLD16_LO 84
+#define R_PPC_GOT_TLSLD16_HI 85
+#define R_PPC_GOT_TLSLD16_HA 86
+#define R_PPC_GOT_TPREL16 87
+#define R_PPC_GOT_TPREL16_LO 88
+#define R_PPC_GOT_TPREL16_HI 89
+#define R_PPC_GOT_TPREL16_HA 90
+
+/*
+ * The remaining relocs are from the Embedded ELF ABI, and are not in the
+ * SVR4 ELF ABI.
+ */
+
+#define R_PPC_EMB_NADDR32 101
+#define R_PPC_EMB_NADDR16 102
+#define R_PPC_EMB_NADDR16_LO 103
+#define R_PPC_EMB_NADDR16_HI 104
+#define R_PPC_EMB_NADDR16_HA 105
+#define R_PPC_EMB_SDAI16 106
+#define R_PPC_EMB_SDA2I16 107
+#define R_PPC_EMB_SDA2REL 108
+#define R_PPC_EMB_SDA21 109
+#define R_PPC_EMB_MRKREF 110
+#define R_PPC_EMB_RELSEC16 111
+#define R_PPC_EMB_RELST_LO 112
+#define R_PPC_EMB_RELST_HI 113
+#define R_PPC_EMB_RELST_HA 114
+#define R_PPC_EMB_BIT_FLD 115
+#define R_PPC_EMB_RELSDA 116
+
+/*
+ * RISC-V relocation types.
+ */
+
+/* Relocation types used by the dynamic linker. */
+#define R_RISCV_NONE 0
+#define R_RISCV_32 1
+#define R_RISCV_64 2
+#define R_RISCV_RELATIVE 3
+#define R_RISCV_COPY 4
+#define R_RISCV_JUMP_SLOT 5
+#define R_RISCV_TLS_DTPMOD32 6
+#define R_RISCV_TLS_DTPMOD64 7
+#define R_RISCV_TLS_DTPREL32 8
+#define R_RISCV_TLS_DTPREL64 9
+#define R_RISCV_TLS_TPREL32 10
+#define R_RISCV_TLS_TPREL64 11
+
+/* Relocation types not used by the dynamic linker. */
+#define R_RISCV_BRANCH 16
+#define R_RISCV_JAL 17
+#define R_RISCV_CALL 18
+#define R_RISCV_CALL_PLT 19
+#define R_RISCV_GOT_HI20 20
+#define R_RISCV_TLS_GOT_HI20 21
+#define R_RISCV_TLS_GD_HI20 22
+#define R_RISCV_PCREL_HI20 23
+#define R_RISCV_PCREL_LO12_I 24
+#define R_RISCV_PCREL_LO12_S 25
+#define R_RISCV_HI20 26
+#define R_RISCV_LO12_I 27
+#define R_RISCV_LO12_S 28
+#define R_RISCV_TPREL_HI20 29
+#define R_RISCV_TPREL_LO12_I 30
+#define R_RISCV_TPREL_LO12_S 31
+#define R_RISCV_TPREL_ADD 32
+#define R_RISCV_ADD8 33
+#define R_RISCV_ADD16 34
+#define R_RISCV_ADD32 35
+#define R_RISCV_ADD64 36
+#define R_RISCV_SUB8 37
+#define R_RISCV_SUB16 38
+#define R_RISCV_SUB32 39
+#define R_RISCV_SUB64 40
+#define R_RISCV_GNU_VTINHERIT 41
+#define R_RISCV_GNU_VTENTRY 42
+#define R_RISCV_ALIGN 43
+#define R_RISCV_RVC_BRANCH 44
+#define R_RISCV_RVC_JUMP 45
+#define R_RISCV_RVC_LUI 46
+#define R_RISCV_RELAX 51
+#define R_RISCV_SUB6 52
+#define R_RISCV_SET6 53
+#define R_RISCV_SET8 54
+#define R_RISCV_SET16 55
+#define R_RISCV_SET32 56
+#define R_RISCV_32_PCREL 57
+#define R_RISCV_IRELATIVE 58
+
+#define R_SPARC_NONE 0
+#define R_SPARC_8 1
+#define R_SPARC_16 2
+#define R_SPARC_32 3
+#define R_SPARC_DISP8 4
+#define R_SPARC_DISP16 5
+#define R_SPARC_DISP32 6
+#define R_SPARC_WDISP30 7
+#define R_SPARC_WDISP22 8
+#define R_SPARC_HI22 9
+#define R_SPARC_22 10
+#define R_SPARC_13 11
+#define R_SPARC_LO10 12
+#define R_SPARC_GOT10 13
+#define R_SPARC_GOT13 14
+#define R_SPARC_GOT22 15
+#define R_SPARC_PC10 16
+#define R_SPARC_PC22 17
+#define R_SPARC_WPLT30 18
+#define R_SPARC_COPY 19
+#define R_SPARC_GLOB_DAT 20
+#define R_SPARC_JMP_SLOT 21
+#define R_SPARC_RELATIVE 22
+#define R_SPARC_UA32 23
+#define R_SPARC_PLT32 24
+#define R_SPARC_HIPLT22 25
+#define R_SPARC_LOPLT10 26
+#define R_SPARC_PCPLT32 27
+#define R_SPARC_PCPLT22 28
+#define R_SPARC_PCPLT10 29
+#define R_SPARC_10 30
+#define R_SPARC_11 31
+#define R_SPARC_64 32
+#define R_SPARC_OLO10 33
+#define R_SPARC_HH22 34
+#define R_SPARC_HM10 35
+#define R_SPARC_LM22 36
+#define R_SPARC_PC_HH22 37
+#define R_SPARC_PC_HM10 38
+#define R_SPARC_PC_LM22 39
+#define R_SPARC_WDISP16 40
+#define R_SPARC_WDISP19 41
+#define R_SPARC_GLOB_JMP 42
+#define R_SPARC_7 43
+#define R_SPARC_5 44
+#define R_SPARC_6 45
+#define R_SPARC_DISP64 46
+#define R_SPARC_PLT64 47
+#define R_SPARC_HIX22 48
+#define R_SPARC_LOX10 49
+#define R_SPARC_H44 50
+#define R_SPARC_M44 51
+#define R_SPARC_L44 52
+#define R_SPARC_REGISTER 53
+#define R_SPARC_UA64 54
+#define R_SPARC_UA16 55
+#define R_SPARC_TLS_GD_HI22 56
+#define R_SPARC_TLS_GD_LO10 57
+#define R_SPARC_TLS_GD_ADD 58
+#define R_SPARC_TLS_GD_CALL 59
+#define R_SPARC_TLS_LDM_HI22 60
+#define R_SPARC_TLS_LDM_LO10 61
+#define R_SPARC_TLS_LDM_ADD 62
+#define R_SPARC_TLS_LDM_CALL 63
+#define R_SPARC_TLS_LDO_HIX22 64
+#define R_SPARC_TLS_LDO_LOX10 65
+#define R_SPARC_TLS_LDO_ADD 66
+#define R_SPARC_TLS_IE_HI22 67
+#define R_SPARC_TLS_IE_LO10 68
+#define R_SPARC_TLS_IE_LD 69
+#define R_SPARC_TLS_IE_LDX 70
+#define R_SPARC_TLS_IE_ADD 71
+#define R_SPARC_TLS_LE_HIX22 72
+#define R_SPARC_TLS_LE_LOX10 73
+#define R_SPARC_TLS_DTPMOD32 74
+#define R_SPARC_TLS_DTPMOD64 75
+#define R_SPARC_TLS_DTPOFF32 76
+#define R_SPARC_TLS_DTPOFF64 77
+#define R_SPARC_TLS_TPOFF32 78
+#define R_SPARC_TLS_TPOFF64 79
+
+#define R_X86_64_NONE 0 /* No relocation. */
+#define R_X86_64_64 1 /* Add 64 bit symbol value. */
+#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */
+#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */
+#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */
+#define R_X86_64_COPY 5 /* Copy data from shared object. */
+#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */
+#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */
+#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */
+#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */
+#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */
+#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */
+#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */
+#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */
+#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */
+#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */
+#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
+#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */
+#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */
+#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */
+#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */
+#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
+#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */
+#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */
+#define R_X86_64_PC64 24 /* PC-relative 64 bit signed sym value. */
+#define R_X86_64_GOTOFF64 25
+#define R_X86_64_GOTPC32 26
+#define R_X86_64_GOT64 27
+#define R_X86_64_GOTPCREL64 28
+#define R_X86_64_GOTPC64 29
+#define R_X86_64_GOTPLT64 30
+#define R_X86_64_PLTOFF64 31
+#define R_X86_64_SIZE32 32
+#define R_X86_64_SIZE64 33
+#define R_X86_64_GOTPC32_TLSDESC 34
+#define R_X86_64_TLSDESC_CALL 35
+#define R_X86_64_TLSDESC 36
+#define R_X86_64_IRELATIVE 37
+#define R_X86_64_RELATIVE64 38
+/* 39 and 40 were BND-related, already decomissioned */
+#define R_X86_64_GOTPCRELX 41
+#define R_X86_64_REX_GOTPCRELX 42
+
+#define ELF_BSDF_SIGFASTBLK 0x0001 /* Kernel supports fast sigblock */
+#define ELF_BSDF_VMNOOVERCOMMIT 0x0002
+
+#endif /* !_SYS_ELF_COMMON_H_ */
diff --git a/libc/include/bits/elf_x86.h b/libc/include/bits/elf_x86.h
deleted file mode 100644
index dfbaba0..0000000
--- a/libc/include/bits/elf_x86.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $NetBSD: elf_machdep.h,v 1.12 2016/02/02 20:16:59 christos Exp $ */
-
-#ifndef _X86_ELF_MACHDEP_H_
-#define _X86_ELF_MACHDEP_H_
-
-/* i386 relocations */
-#define R_386_NONE 0
-#define R_386_32 1
-#define R_386_PC32 2
-#define R_386_GOT32 3
-#define R_386_PLT32 4
-#define R_386_COPY 5
-#define R_386_GLOB_DAT 6
-#define R_386_JMP_SLOT 7
-#define R_386_RELATIVE 8
-#define R_386_GOTOFF 9
-#define R_386_GOTPC 10
-#define R_386_32PLT 11
-
-/* TLS relocations */
-#define R_386_TLS_TPOFF 14
-#define R_386_TLS_IE 15
-#define R_386_TLS_GOTIE 16
-#define R_386_TLS_LE 17
-#define R_386_TLS_GD 18
-#define R_386_TLS_LDM 19
-
-/* The following relocations are GNU extensions. */
-#define R_386_16 20
-#define R_386_PC16 21
-#define R_386_8 22
-#define R_386_PC8 23
-
-/* More TLS relocations */
-#define R_386_TLS_GD_32 24
-#define R_386_TLS_GD_PUSH 25
-#define R_386_TLS_GD_CALL 26
-#define R_386_TLS_GD_POP 27
-#define R_386_TLS_LDM_32 28
-#define R_386_TLS_LDM_PUSH 29
-#define R_386_TLS_LDM_CALL 30
-#define R_386_TLS_LDM_POP 31
-#define R_386_TLS_LDO_32 32
-#define R_386_TLS_IE_32 33
-#define R_386_TLS_LE_32 34
-#define R_386_TLS_DTPMOD32 35
-#define R_386_TLS_DTPOFF32 36
-#define R_386_TLS_TPOFF32 37
-
-#define R_386_SIZE32 38
-
-/* More TLS relocations */
-#define R_386_TLS_GOTDESC 39
-#define R_386_TLS_DESC_CALL 40
-#define R_386_TLS_DESC 41
-
-#define R_386_IRELATIVE 42
-#define R_386_GOT32X 43
-
-#endif
diff --git a/libc/include/bits/elf_x86_64.h b/libc/include/bits/elf_x86_64.h
deleted file mode 100644
index 30062af..0000000
--- a/libc/include/bits/elf_x86_64.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $NetBSD: elf_machdep.h,v 1.5 2016/02/02 20:13:59 christos Exp $ */
-
-#ifndef _X86_64_ELF_MACHDEP_H_
-#define _X86_64_ELF_MACHDEP_H_
-
-/* x86-64 relocations */
-
-#define R_X86_64_NONE 0
-#define R_X86_64_64 1
-#define R_X86_64_PC32 2
-#define R_X86_64_GOT32 3
-#define R_X86_64_PLT32 4
-#define R_X86_64_COPY 5
-#define R_X86_64_GLOB_DAT 6
-#define R_X86_64_JUMP_SLOT 7
-#define R_X86_64_RELATIVE 8
-#define R_X86_64_GOTPCREL 9
-#define R_X86_64_32 10
-#define R_X86_64_32S 11
-#define R_X86_64_16 12
-#define R_X86_64_PC16 13
-#define R_X86_64_8 14
-#define R_X86_64_PC8 15
-
-/* TLS relocations */
-#define R_X86_64_DTPMOD64 16
-#define R_X86_64_DTPOFF64 17
-#define R_X86_64_TPOFF64 18
-#define R_X86_64_TLSGD 19
-#define R_X86_64_TLSLD 20
-#define R_X86_64_DTPOFF32 21
-#define R_X86_64_GOTTPOFF 22
-#define R_X86_64_TPOFF32 23
-
-#define R_X86_64_PC64 24
-#define R_X86_64_GOTOFF64 25
-#define R_X86_64_GOTPC32 26
-#define R_X86_64_GOT64 27
-#define R_X86_64_GOTPCREL64 28
-#define R_X86_64_GOTPC64 29
-#define R_X86_64_GOTPLT64 30
-#define R_X86_64_PLTOFF64 31
-#define R_X86_64_SIZE32 32
-#define R_X86_64_SIZE64 33
-#define R_X86_64_GOTPC32_TLSDESC 34
-#define R_X86_64_TLSDESC_CALL 35
-#define R_X86_64_TLSDESC 36
-#define R_X86_64_IRELATIVE 37
-#define R_X86_64_RELATIVE64 38
-#define R_X86_64_PC32_BND 39
-#define R_X86_64_PLT32_BND 40
-#define R_X86_64_GOTPCRELX 41
-#define R_X86_64_REX_GOTPCRELX 42
-
-#endif
diff --git a/libc/include/bits/fenv_inlines_arm.h b/libc/include/bits/fenv_inlines_arm.h
deleted file mode 100644
index e8b89ea..0000000
--- a/libc/include/bits/fenv_inlines_arm.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*-
- * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/msun/arm/fenv.c,v 1.1 2004/06/06 10:03:59 das Exp $
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#if defined(__arm__)
-
-#if !defined(__BIONIC_FENV_INLINE)
-#define __BIONIC_FENV_INLINE static __inline
-#endif
-
-#include <bits/fenv_arm.h>
-
-__BEGIN_DECLS
-
-#define FPSCR_RMODE_SHIFT 22
-
-__BIONIC_FENV_INLINE int fegetenv(fenv_t* __envp) {
- fenv_t _fpscr;
- __asm__ __volatile__("vmrs %0,fpscr" : "=r" (_fpscr));
- *__envp = _fpscr;
- return 0;
-}
-
-__BIONIC_FENV_INLINE int fesetenv(const fenv_t* __envp) {
- fenv_t _fpscr = *__envp;
- __asm__ __volatile__("vmsr fpscr,%0" : :"ri" (_fpscr));
- return 0;
-}
-
-__BIONIC_FENV_INLINE int feclearexcept(int __excepts) {
- fexcept_t __fpscr;
- fegetenv(&__fpscr);
- __fpscr &= ~__excepts;
- fesetenv(&__fpscr);
- return 0;
-}
-
-__BIONIC_FENV_INLINE int fegetexceptflag(fexcept_t* __flagp, int __excepts) {
- fexcept_t __fpscr;
- fegetenv(&__fpscr);
- *__flagp = __fpscr & __excepts;
- return 0;
-}
-
-__BIONIC_FENV_INLINE int fesetexceptflag(const fexcept_t* __flagp, int __excepts) {
- fexcept_t __fpscr;
- fegetenv(&__fpscr);
- __fpscr &= ~__excepts;
- __fpscr |= *__flagp & __excepts;
- fesetenv(&__fpscr);
- return 0;
-}
-
-__BIONIC_FENV_INLINE int feraiseexcept(int __excepts) {
- fexcept_t __ex = __excepts;
- fesetexceptflag(&__ex, __excepts);
- return 0;
-}
-
-__BIONIC_FENV_INLINE int fetestexcept(int __excepts) {
- fexcept_t __fpscr;
- fegetenv(&__fpscr);
- return (__fpscr & __excepts);
-}
-
-__BIONIC_FENV_INLINE int fegetround(void) {
- fenv_t _fpscr;
- fegetenv(&_fpscr);
- return ((_fpscr >> FPSCR_RMODE_SHIFT) & 0x3);
-}
-
-__BIONIC_FENV_INLINE int fesetround(int __round) {
- fenv_t _fpscr;
- fegetenv(&_fpscr);
- _fpscr &= ~(0x3 << FPSCR_RMODE_SHIFT);
- _fpscr |= (__round << FPSCR_RMODE_SHIFT);
- fesetenv(&_fpscr);
- return 0;
-}
-
-__BIONIC_FENV_INLINE int feholdexcept(fenv_t* __envp) {
- fenv_t __env;
- fegetenv(&__env);
- *__envp = __env;
- __env &= ~FE_ALL_EXCEPT;
- fesetenv(&__env);
- return 0;
-}
-
-__BIONIC_FENV_INLINE int feupdateenv(const fenv_t* __envp) {
- fexcept_t __fpscr;
- fegetenv(&__fpscr);
- fesetenv(__envp);
- feraiseexcept(__fpscr & FE_ALL_EXCEPT);
- return 0;
-}
-
-__BIONIC_FENV_INLINE int feenableexcept(int __mask __unused) {
- return -1;
-}
-
-__BIONIC_FENV_INLINE int fedisableexcept(int __mask __unused) {
- return 0;
-}
-
-__BIONIC_FENV_INLINE int fegetexcept(void) {
- return 0;
-}
-
-#undef FPSCR_RMODE_SHIFT
-
-__END_DECLS
-
-#endif
diff --git a/libc/include/android/legacy_sys_stat_inlines.h b/libc/include/bits/fenv_riscv64.h
similarity index 71%
copy from libc/include/android/legacy_sys_stat_inlines.h
copy to libc/include/bits/fenv_riscv64.h
index d42ac01..e1e43b6 100644
--- a/libc/include/android/legacy_sys_stat_inlines.h
+++ b/libc/include/bits/fenv_riscv64.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,18 +28,25 @@
#pragma once
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 21
-
-#include <sys/stat.h>
+#include <sys/types.h>
__BEGIN_DECLS
-static __inline int mkfifo(const char* __path, mode_t __mode) {
- return mknod(__path, (__mode & ~S_IFMT) | S_IFIFO, (dev_t)0);
-}
+typedef __uint32_t fenv_t;
+typedef __uint32_t fexcept_t;
+
+/* Exception flags. No FE_DENORMAL for riscv64. */
+#define FE_INEXACT 0x01
+#define FE_UNDERFLOW 0x02
+#define FE_OVERFLOW 0x04
+#define FE_DIVBYZERO 0x08
+#define FE_INVALID 0x10
+#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+
+/* Rounding modes. */
+#define FE_TONEAREST 0x0
+#define FE_TOWARDZERO 0x1
+#define FE_DOWNWARD 0x2
+#define FE_UPWARD 0x3
__END_DECLS
-
-#endif
diff --git a/libc/include/bits/fortify/fcntl.h b/libc/include/bits/fortify/fcntl.h
index 7063541..1f6ebad 100644
--- a/libc/include/bits/fortify/fcntl.h
+++ b/libc/include/bits/fortify/fcntl.h
@@ -41,7 +41,7 @@
#if defined(__BIONIC_FORTIFY)
#define __open_too_many_args_error "too many arguments"
#define __open_too_few_args_error "called with O_CREAT or O_TMPFILE, but missing mode"
-#define __open_useless_modes_warning "has superfluous mode bits; missing O_CREAT?"
+#define __open_useless_modes_warning "has superfluous mode bits; missing O_CREAT or O_TMPFILE?"
/* O_TMPFILE shares bits with O_DIRECTORY. */
#define __open_modes_useful(flags) (((flags) & O_CREAT) || ((flags) & O_TMPFILE) == O_TMPFILE)
@@ -59,7 +59,7 @@
int open(const char* const __pass_object_size pathname, int flags)
__overloadable
__clang_error_if(__open_modes_useful(flags), "'open' " __open_too_few_args_error) {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __open_2(pathname, flags);
#else
return __open_real(pathname, flags);
@@ -83,7 +83,7 @@
int openat(int dirfd, const char* const __pass_object_size pathname, int flags)
__overloadable
__clang_error_if(__open_modes_useful(flags), "'openat' " __open_too_few_args_error) {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __openat_2(dirfd, pathname, flags);
#else
return __openat_real(dirfd, pathname, flags);
@@ -98,7 +98,6 @@
return __openat_real(dirfd, pathname, flags, modes);
}
-#if __ANDROID_API__ >= 21
/* Note that open == open64, so we reuse those bits in the open64 variants below. */
__BIONIC_ERROR_FUNCTION_VISIBILITY
@@ -139,7 +138,6 @@
"'openat64' " __open_useless_modes_warning) {
return openat(dirfd, pathname, flags, modes);
}
-#endif /* __ANDROID_API__ >= 21 */
#undef __open_too_many_args_error
#undef __open_too_few_args_error
diff --git a/libc/include/bits/fortify/poll.h b/libc/include/bits/fortify/poll.h
index 143153c..0b5cd4b 100644
--- a/libc/include/bits/fortify/poll.h
+++ b/libc/include/bits/fortify/poll.h
@@ -54,7 +54,6 @@
return __call_bypassing_fortify(poll)(fds, fd_count, timeout);
}
-#if __ANDROID_API__ >= 21
__BIONIC_FORTIFY_INLINE
int ppoll(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const struct timespec* timeout, const sigset_t* mask)
__overloadable
@@ -69,7 +68,6 @@
#endif
return __call_bypassing_fortify(ppoll)(fds, fd_count, timeout, mask);
}
-#endif /* __ANDROID_API__ >= 21 */
#if __ANDROID_API__ >= 28
__BIONIC_FORTIFY_INLINE
diff --git a/libc/include/bits/fortify/stat.h b/libc/include/bits/fortify/stat.h
index 2d42a51..9b4ade2 100644
--- a/libc/include/bits/fortify/stat.h
+++ b/libc/include/bits/fortify/stat.h
@@ -39,7 +39,7 @@
__overloadable
__enable_if(1, "")
__clang_error_if(mode & ~0777, "'umask' called with invalid mode") {
-#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __umask_chk(mode);
#else
return __umask_real(mode);
diff --git a/libc/include/bits/fortify/stdio.h b/libc/include/bits/fortify/stdio.h
index 77bdbb4..95db017 100644
--- a/libc/include/bits/fortify/stdio.h
+++ b/libc/include/bits/fortify/stdio.h
@@ -36,7 +36,7 @@
#if defined(__BIONIC_FORTIFY) && !defined(__BIONIC_NO_STDIO_FORTIFY)
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE __printflike(3, 0)
int vsnprintf(char* const __pass_object_size dest, size_t size, const char* format, va_list ap)
@@ -58,7 +58,7 @@
"format string will always overflow destination buffer")
__errorattr("format string will always overflow destination buffer");
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
__BIONIC_FORTIFY_VARIADIC __printflike(2, 3)
int sprintf(char* const __pass_object_size dest, const char* format, ...) __overloadable {
va_list va;
@@ -126,7 +126,7 @@
__clang_error_if(size < 0, "in call to 'fgets', size should not be negative")
__clang_error_if(__bos_unevaluated_lt(__bos(dest), size),
"in call to 'fgets', size is larger than the destination buffer") {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(dest);
if (!__bos_dynamic_check_impl_and(bos, >=, (size_t)size, size >= 0)) {
diff --git a/libc/include/bits/fortify/string.h b/libc/include/bits/fortify/string.h
index 08bce2d..f668b9f 100644
--- a/libc/include/bits/fortify/string.h
+++ b/libc/include/bits/fortify/string.h
@@ -40,7 +40,7 @@
#if defined(__BIONIC_FORTIFY)
extern void* __memrchr_real(const void*, int, size_t) __RENAME(memrchr);
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE
void* memcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
@@ -82,7 +82,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'stpcpy' called with string bigger than buffer") {
-#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __builtin___stpcpy_chk(dst, src, __bos(dst));
#else
return __builtin_stpcpy(dst, src);
@@ -95,7 +95,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'strcpy' called with string bigger than buffer") {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __builtin___strcpy_chk(dst, src, __bos(dst));
#else
return __builtin_strcpy(dst, src);
@@ -107,14 +107,14 @@
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'strcat' called with string bigger than buffer") {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __builtin___strcat_chk(dst, src, __bos(dst));
#else
return __builtin_strcat(dst, src);
#endif
}
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE
char* strncat(char* const dst __pass_object_size, const char* src, size_t n)
@@ -130,7 +130,7 @@
__diagnose_as_builtin(__builtin_memset, 1, 2, 3)
/* If you're a user who wants this warning to go away: use `(&memset)(foo, bar, baz)`. */
__clang_warning_if(c && !n, "'memset' will set 0 bytes; maybe the arguments got flipped?") {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __builtin___memset_chk(s, c, n, __bos0(s));
#else
return __builtin_memset(s, c, n);
@@ -161,7 +161,7 @@
}
#endif
-#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE
char* stpncpy(char* const dst __pass_object_size, const char* const src __pass_object_size, size_t n)
@@ -200,7 +200,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
"'strlcpy' called with size bigger than buffer") {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __strlcpy_chk(dst, src, size, __bos(dst));
#else
return __call_bypassing_fortify(strlcpy)(dst, src, size);
@@ -212,14 +212,14 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
"'strlcat' called with size bigger than buffer") {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
return __strlcat_chk(dst, src, size, __bos(dst));
#else
return __call_bypassing_fortify(strlcat)(dst, src, size);
#endif
}
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
__BIONIC_FORTIFY_INLINE
size_t strlen(const char* const s __pass_object_size0) __overloadable {
return __strlen_chk(s, __bos0(s));
@@ -228,7 +228,7 @@
__BIONIC_FORTIFY_INLINE
char* strchr(const char* const s __pass_object_size, int c) __overloadable {
-#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(s);
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
@@ -240,7 +240,7 @@
__BIONIC_FORTIFY_INLINE
char* strrchr(const char* const s __pass_object_size, int c) __overloadable {
-#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos(s);
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
diff --git a/libc/include/bits/fortify/strings.h b/libc/include/bits/fortify/strings.h
index 65fc5f1..5515ef9 100644
--- a/libc/include/bits/fortify/strings.h
+++ b/libc/include/bits/fortify/strings.h
@@ -33,7 +33,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(dst), len),
"'bcopy' called with size bigger than buffer") {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(dst);
if (!__bos_trivially_ge(bos, len)) {
__builtin___memmove_chk(dst, src, len, bos);
@@ -48,7 +48,7 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(b), len),
"'bzero' called with size bigger than buffer") {
-#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(b);
if (!__bos_trivially_ge(bos, len)) {
__builtin___memset_chk(b, 0, len, bos);
diff --git a/libc/include/bits/fortify/unistd.h b/libc/include/bits/fortify/unistd.h
index 49a3946..335d0b5 100644
--- a/libc/include/bits/fortify/unistd.h
+++ b/libc/include/bits/fortify/unistd.h
@@ -152,7 +152,7 @@
__overloadable
__error_if_overflows_ssizet(count, read)
__error_if_overflows_objectsize(count, __bos0(buf), read) {
-#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
+#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
size_t bos = __bos0(buf);
if (!__bos_trivially_ge_no_overflow(bos, count)) {
@@ -192,7 +192,6 @@
return __call_bypassing_fortify(readlink)(path, buf, size);
}
-#if __ANDROID_API__ >= 21
__BIONIC_FORTIFY_INLINE
ssize_t readlinkat(int dirfd, const char* path, char* const __pass_object_size buf, size_t size)
__overloadable
@@ -207,7 +206,6 @@
#endif
return __call_bypassing_fortify(readlinkat)(dirfd, path, buf, size);
}
-#endif /* __ANDROID_API__ >= 21 */
#undef __bos_trivially_ge_no_overflow
#undef __enable_if_no_overflow_ssizet
diff --git a/libc/include/bits/sys_statvfs_inlines.h b/libc/include/bits/sys_statvfs_inlines.h
deleted file mode 100644
index 991fac7..0000000
--- a/libc/include/bits/sys_statvfs_inlines.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-#include <sys/statfs.h>
-#include <sys/statvfs.h>
-
-#if defined(__BIONIC_SYS_STATVFS_INLINE)
-
-__BEGIN_DECLS
-
-#if defined(__BIONIC_NEED_STATVFS_INLINES)
-
-static __inline void __bionic_statfs_to_statvfs(const struct statfs* __src,
- struct statvfs* __dst) {
- __dst->f_bsize = __src->f_bsize;
- __dst->f_frsize = __src->f_frsize;
- __dst->f_blocks = __src->f_blocks;
- __dst->f_bfree = __src->f_bfree;
- __dst->f_bavail = __src->f_bavail;
- __dst->f_files = __src->f_files;
- __dst->f_ffree = __src->f_ffree;
- __dst->f_favail = __src->f_ffree;
- __dst->f_fsid = __src->f_fsid.__val[0] |
- __BIONIC_CAST(static_cast, uint64_t, __src->f_fsid.__val[1]) << 32;
- __dst->f_flag = __src->f_flags;
- __dst->f_namemax = __src->f_namelen;
-}
-
-__BIONIC_SYS_STATVFS_INLINE int statvfs(const char* __path,
- struct statvfs* __result) {
- struct statfs __tmp;
- int __rc = statfs(__path, &__tmp);
- if (__rc != 0) return __rc;
- __bionic_statfs_to_statvfs(&__tmp, __result);
- return 0;
-}
-
-__BIONIC_SYS_STATVFS_INLINE int fstatvfs(int __fd,
- struct statvfs* __result) {
- struct statfs __tmp;
- int __rc = fstatfs(__fd, &__tmp);
- if (__rc != 0) return __rc;
- __bionic_statfs_to_statvfs(&__tmp, __result);
- return 0;
-}
-
-#endif
-
-#if defined(__BIONIC_NEED_STATVFS64_INLINES)
-
-__BIONIC_SYS_STATVFS_INLINE int statvfs64(const char* __path,
- struct statvfs64* __result) {
- return statvfs(__path, __BIONIC_CAST(reinterpret_cast, struct statvfs*,
- __result));
-}
-
-__BIONIC_SYS_STATVFS_INLINE int fstatvfs64(int __fd,
- struct statvfs64* __result) {
- return fstatvfs(__fd, __BIONIC_CAST(reinterpret_cast, struct statvfs*,
- __result));
-}
-
-#endif
-
-__END_DECLS
-
-#endif
diff --git a/libc/include/bits/threads_inlines.h b/libc/include/bits/threads_inlines.h
index afaed64..17de4a1 100644
--- a/libc/include/bits/threads_inlines.h
+++ b/libc/include/bits/threads_inlines.h
@@ -103,12 +103,10 @@
return __bionic_thrd_error(pthread_mutex_lock(__mtx));
}
-#if __ANDROID_API__ >= 21
__BIONIC_THREADS_INLINE int mtx_timedlock(mtx_t* __mtx,
const struct timespec* __timeout) {
return __bionic_thrd_error(pthread_mutex_timedlock(__mtx, __timeout));
}
-#endif
__BIONIC_THREADS_INLINE int mtx_trylock(mtx_t* __mtx) {
return __bionic_thrd_error(pthread_mutex_trylock(__mtx));
diff --git a/libc/include/dirent.h b/libc/include/dirent.h
index 2328b1a..2751b9e 100644
--- a/libc/include/dirent.h
+++ b/libc/include/dirent.h
@@ -95,7 +95,7 @@
*
* Returns null and sets `errno` on failure.
*/
-DIR* opendir(const char* __path);
+DIR* _Nullable opendir(const char* _Nonnull __path);
/**
* [fopendir(3)](http://man7.org/linux/man-pages/man3/opendir.3.html)
@@ -103,7 +103,7 @@
*
* Returns null and sets `errno` on failure.
*/
-DIR* fdopendir(int __dir_fd);
+DIR* _Nullable fdopendir(int __dir_fd);
/**
* [readdir(3)](http://man7.org/linux/man-pages/man3/readdir.3.html)
@@ -113,7 +113,7 @@
* or returns null and leaves `errno` unchanged at the end of the directory,
* or returns null and sets `errno` on failure.
*/
-struct dirent* readdir(DIR* __dir);
+struct dirent* _Nullable readdir(DIR* _Nonnull __dir);
/**
* [readdir64(3)](http://man7.org/linux/man-pages/man3/readdir.3.html)
@@ -123,10 +123,10 @@
* or returns null and leaves `errno` unchanged at the end of the directory,
* or returns null and sets `errno` on failure.
*/
-struct dirent64* readdir64(DIR* __dir) __INTRODUCED_IN(21);
+struct dirent64* _Nullable readdir64(DIR* _Nonnull __dir) __INTRODUCED_IN(21);
-int readdir_r(DIR* __dir, struct dirent* __entry, struct dirent** __buffer) __attribute__((__deprecated__("readdir_r is deprecated; use readdir instead")));
-int readdir64_r(DIR* __dir, struct dirent64* __entry, struct dirent64** __buffer) __INTRODUCED_IN(21) __attribute__((__deprecated__("readdir64_r is deprecated; use readdir64 instead")));
+int readdir_r(DIR* _Nonnull __dir, struct dirent* _Nonnull __entry, struct dirent* _Nullable * _Nonnull __buffer) __attribute__((__deprecated__("readdir_r is deprecated; use readdir instead")));
+int readdir64_r(DIR* _Nonnull __dir, struct dirent64* _Nonnull __entry, struct dirent64* _Nullable * _Nonnull __buffer) __INTRODUCED_IN(21) __attribute__((__deprecated__("readdir64_r is deprecated; use readdir64 instead")));
/**
* [closedir(3)](http://man7.org/linux/man-pages/man3/closedir.3.html)
@@ -134,13 +134,13 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int closedir(DIR* __dir);
+int closedir(DIR* _Nonnull __dir);
/**
* [rewinddir(3)](http://man7.org/linux/man-pages/man3/rewinddir.3.html)
* rewinds a directory stream to the first entry.
*/
-void rewinddir(DIR* __dir);
+void rewinddir(DIR* _Nonnull __dir);
/**
* [seekdir(3)](http://man7.org/linux/man-pages/man3/seekdir.3.html)
@@ -149,7 +149,7 @@
*
* Available since API level 23.
*/
-void seekdir(DIR* __dir, long __location) __INTRODUCED_IN(23);
+void seekdir(DIR* _Nonnull __dir, long __location) __INTRODUCED_IN(23);
/**
* [telldir(3)](http://man7.org/linux/man-pages/man3/telldir.3.html)
@@ -160,7 +160,7 @@
*
* Available since API level 23.
*/
-long telldir(DIR* __dir) __INTRODUCED_IN(23);
+long telldir(DIR* _Nonnull __dir) __INTRODUCED_IN(23);
/**
* [dirfd(3)](http://man7.org/linux/man-pages/man3/dirfd.3.html)
@@ -168,13 +168,13 @@
*
* Returns a file descriptor on success and returns -1 and sets `errno` on failure.
*/
-int dirfd(DIR* __dir);
+int dirfd(DIR* _Nonnull __dir);
/**
* [alphasort](http://man7.org/linux/man-pages/man3/alphasort.3.html) is a
* comparator for use with scandir() that uses strcoll().
*/
-int alphasort(const struct dirent** __lhs, const struct dirent** __rhs);
+int alphasort(const struct dirent* _Nonnull * _Nonnull __lhs, const struct dirent* _Nonnull * _Nonnull __rhs);
/**
* [alphasort64](http://man7.org/linux/man-pages/man3/alphasort.3.html) is a
@@ -182,31 +182,33 @@
*
* Available since API level 21.
*/
-int alphasort64(const struct dirent64** __lhs, const struct dirent64** __rhs) __INTRODUCED_IN(21);
+int alphasort64(const struct dirent64* _Nonnull * _Nonnull __lhs, const struct dirent64* _Nonnull * _Nonnull __rhs) __INTRODUCED_IN(21);
/**
* [scandir(3)](http://man7.org/linux/man-pages/man3/scandir.3.html)
* scans all the directory `__path`, filtering entries with `__filter` and
* sorting them with qsort() using the given `__comparator`, and storing them
* into `__name_list`. Passing NULL as the filter accepts all entries.
+ * Passing NULL as the comparator skips sorting.
*
* Returns the number of entries returned in the list on success,
* and returns -1 and sets `errno` on failure.
*/
-int scandir(const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**));
+int scandir(const char* _Nonnull __path, struct dirent* _Nonnull * _Nonnull * _Nonnull __name_list, int (* _Nullable __filter)(const struct dirent* _Nonnull), int (* _Nullable __comparator)(const struct dirent* _Nonnull * _Nonnull, const struct dirent* _Nonnull * _Nonnull));
/**
* [scandir64(3)](http://man7.org/linux/man-pages/man3/scandir.3.html)
* scans all the directory `__path`, filtering entries with `__filter` and
* sorting them with qsort() using the given `__comparator`, and storing them
* into `__name_list`. Passing NULL as the filter accepts all entries.
+ * Passing NULL as the comparator skips sorting.
*
* Returns the number of entries returned in the list on success,
* and returns -1 and sets `errno` on failure.
*
* Available since API level 21.
*/
-int scandir64(const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(21);
+int scandir64(const char* _Nonnull __path, struct dirent64* _Nonnull * _Nonnull * _Nonnull __name_list, int (* _Nullable __filter)(const struct dirent64* _Nonnull), int (* _Nullable __comparator)(const struct dirent64* _Nonnull * _Nonnull, const struct dirent64* _Nonnull * _Nonnull)) __INTRODUCED_IN(21);
#if defined(__USE_GNU)
@@ -216,13 +218,14 @@
* filtering entries with `__filter` and sorting them with qsort() using the
* given `__comparator`, and storing them into `__name_list`. Passing NULL as
* the filter accepts all entries.
+ * Passing NULL as the comparator skips sorting.
*
* Returns the number of entries returned in the list on success,
* and returns -1 and sets `errno` on failure.
*
* Available since API level 24.
*/
-int scandirat64(int __dir_fd, const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(24);
+int scandirat64(int __dir_fd, const char* _Nonnull __path, struct dirent64* _Nonnull * _Nonnull * _Nonnull __name_list, int (* _Nullable __filter)(const struct dirent64* _Nonnull), int (* _Nullable __comparator)(const struct dirent64* _Nonnull * _Nonnull, const struct dirent64* _Nonnull * _Nonnull)) __INTRODUCED_IN(24);
/**
* [scandirat(3)](http://man7.org/linux/man-pages/man3/scandirat.3.html)
@@ -230,13 +233,14 @@
* filtering entries with `__filter` and sorting them with qsort() using the
* given `__comparator`, and storing them into `__name_list`. Passing NULL as
* the filter accepts all entries.
+ * Passing NULL as the comparator skips sorting.
*
* Returns the number of entries returned in the list on success,
* and returns -1 and sets `errno` on failure.
*
* Available since API level 24.
*/
-int scandirat(int __dir_fd, const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**)) __INTRODUCED_IN(24);
+int scandirat(int __dir_fd, const char* _Nonnull __path, struct dirent* _Nonnull * _Nonnull * _Nonnull __name_list, int (* _Nullable __filter)(const struct dirent* _Nonnull), int (* _Nullable __comparator)(const struct dirent* _Nonnull * _Nonnull, const struct dirent* _Nonnull * _Nonnull)) __INTRODUCED_IN(24);
#endif
diff --git a/libc/include/dlfcn.h b/libc/include/dlfcn.h
index 68d8bc9..a8066a9 100644
--- a/libc/include/dlfcn.h
+++ b/libc/include/dlfcn.h
@@ -36,21 +36,23 @@
typedef struct {
/* Pathname of shared object that contains address. */
- const char* dli_fname;
+ const char* _Nullable dli_fname;
/* Address at which shared object is loaded. */
- void* dli_fbase;
+ void* _Nullable dli_fbase;
/* Name of nearest symbol with address lower than addr. */
- const char* dli_sname;
+ const char* _Nullable dli_sname;
/* Exact address of symbol named in dli_sname. */
- void* dli_saddr;
+ void* _Nullable dli_saddr;
} Dl_info;
-void* dlopen(const char* __filename, int __flag);
-int dlclose(void* __handle);
-char* dlerror(void);
-void* dlsym(void* __handle, const char* __symbol);
-void* dlvsym(void* __handle, const char* __symbol, const char* __version) __INTRODUCED_IN(24);
-int dladdr(const void* __addr, Dl_info* __info);
+void* _Nullable dlopen(const char* _Nullable __filename, int __flag);
+int dlclose(void* _Nonnull __handle);
+char* _Nullable dlerror(void);
+/* (RTLD_DEFAULT is null for LP64, but -1 for LP32) */
+void* _Nullable dlsym(void* __BIONIC_COMPLICATED_NULLNESS __handle, const char* _Nullable __symbol);
+/* (RTLD_DEFAULT is null for LP64, but -1 for LP32) */
+void* _Nullable dlvsym(void* __BIONIC_COMPLICATED_NULLNESS __handle, const char* _Nullable __symbol, const char* _Nullable __version) __INTRODUCED_IN(24);
+int dladdr(const void* _Nonnull __addr, Dl_info* _Nonnull __info);
#define RTLD_LOCAL 0
#define RTLD_LAZY 0x00001
diff --git a/libc/include/elf.h b/libc/include/elf.h
index 4739bbd..1dfc008 100644
--- a/libc/include/elf.h
+++ b/libc/include/elf.h
@@ -30,13 +30,12 @@
#include <sys/cdefs.h>
-#include <bits/auxvec.h>
-#include <bits/elf_arm.h>
-#include <bits/elf_arm64.h>
-#include <bits/elf_x86.h>
-#include <bits/elf_x86_64.h>
#include <linux/elf.h>
#include <linux/elf-em.h>
+#undef EI_PAD
+
+#include <bits/auxvec.h>
+#include <bits/elf_common.h>
/* http://www.sco.com/developers/gabi/latest/ch4.intro.html */
typedef __u64 Elf32_Xword;
@@ -83,14 +82,6 @@
Elf64_Word l_version;
Elf64_Word l_flags;
} Elf64_Lib;
-/* ElfW(Lib)::l_flags values. */
-#define LL_NONE 0x0
-#define LL_EXACT_MATCH 0x1
-#define LL_IGNORE_INT_VER 0x2
-#define LL_REQUIRE_MINOR 0x4
-#define LL_EXPORTS 0x8
-#define LL_DELAY_LOAD 0x10
-#define LL_DELTA 0x20
typedef struct {
Elf32_Xword m_value;
@@ -118,14 +109,6 @@
Elf64_Half si_boundto;
Elf64_Half si_flags;
} Elf64_Syminfo;
-/* ElfW(Syminfo)::si_boundto values. */
-#define SYMINFO_BT_SELF 0xffff
-#define SYMINFO_BT_PARENT 0xfffe
-/* ElfW(Syminfo)::si_flags values. */
-#define SYMINFO_FLG_DIRECT 0x1
-#define SYMINFO_FLG_PASSTHRU 0x2
-#define SYMINFO_FLG_COPY 0x4
-#define SYMINFO_FLG_LAZYLOAD 0x8
typedef Elf32_Half Elf32_Versym;
typedef Elf64_Half Elf64_Versym;
@@ -197,24 +180,12 @@
typedef Elf64_Xword Elf64_Relr;
/* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html */
-#define DF_ORIGIN 0x00000001
-#define DF_SYMBOLIC 0x00000002
-#define DF_TEXTREL 0x00000004
-#define DF_BIND_NOW 0x00000008
-#define DF_STATIC_TLS 0x00000010
#define DF_1_NOW 0x00000001 /* Perform complete relocation processing. */
-#define DF_1_GLOBAL 0x00000002 /* implies RTLD_GLOBAL */
#define DF_1_GROUP 0x00000004
-#define DF_1_NODELETE 0x00000008 /* implies RTLD_NODELETE */
-#define DF_1_LOADFLTR 0x00000010
#define DF_1_INITFIRST 0x00000020
-#define DF_1_NOOPEN 0x00000040 /* Object can not be used with dlopen(3) */
-#define DF_1_ORIGIN 0x00000080
#define DF_1_DIRECT 0x00000100
#define DF_1_TRANS 0x00000200
-#define DF_1_INTERPOSE 0x00000400
-#define DF_1_NODEFLIB 0x00000800
#define DF_1_NODUMP 0x00001000 /* Object cannot be dumped with dldump(3) */
#define DF_1_CONFALT 0x00002000
#define DF_1_ENDFILTEE 0x00004000
@@ -230,58 +201,10 @@
#define DF_1_GLOBAUDIT 0x01000000
#define DF_1_SINGLETON 0x02000000
#define DF_1_STUB 0x04000000
-#define DF_1_PIE 0x08000000
-
-/* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html */
-#define DT_BIND_NOW 24
-#define DT_INIT_ARRAY 25
-#define DT_FINI_ARRAY 26
-#define DT_INIT_ARRAYSZ 27
-#define DT_FINI_ARRAYSZ 28
-#define DT_RUNPATH 29
-#define DT_FLAGS 30
-/* glibc and BSD disagree for DT_ENCODING; glibc looks wrong. */
-#define DT_PREINIT_ARRAY 32
-#define DT_PREINIT_ARRAYSZ 33
-#define DT_RELRSZ 35
-#define DT_RELR 36
-#define DT_RELRENT 37
-
-#define DT_GNU_HASH 0x6ffffef5
-#define DT_TLSDESC_PLT 0x6ffffef6
-#define DT_TLSDESC_GOT 0x6ffffef7
-
-/* http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
-#define EI_ABIVERSION 8
-#undef EI_PAD
-#define EI_PAD 9
-
-/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
-#define ELFCOMPRESS_ZLIB 1
-#define ELFCOMPRESS_LOOS 0x60000000
-#define ELFCOMPRESS_HIOS 0x6fffffff
-#define ELFCOMPRESS_LOPROC 0x70000000
-#define ELFCOMPRESS_HIPROC 0x7fffffff
/* http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
#define ELFOSABI_SYSV 0 /* Synonym for ELFOSABI_NONE used by valgrind. */
-#define ELFOSABI_HPUX 1
-#define ELFOSABI_NETBSD 2
#define ELFOSABI_GNU 3 /* Synonym for ELFOSABI_LINUX. */
-#define ELFOSABI_SOLARIS 6
-#define ELFOSABI_AIX 7
-#define ELFOSABI_IRIX 8
-#define ELFOSABI_FREEBSD 9
-#define ELFOSABI_TRU64 10
-#define ELFOSABI_MODESTO 11
-#define ELFOSABI_OPENBSD 12
-#define ELFOSABI_OPENVMS 13
-#define ELFOSABI_NSK 14
-#define ELFOSABI_AROS 15
-#define ELFOSABI_FENIXOS 16
-#define ELFOSABI_CLOUDABI 17
-#define ELFOSABI_OPENVOS 18
-#define ELFOSABI_ARM_AEABI 64
/* http://www.sco.com/developers/gabi/latest/ch4.reloc.html */
#define ELF32_R_INFO(sym, type) ((((Elf32_Word)sym) << 8) | ((type) & 0xff))
@@ -294,236 +217,17 @@
#define ELF32_ST_INFO(b,t) ELF_ST_INFO(b,t)
#define ELF64_ST_INFO(b,t) ELF_ST_INFO(b,t)
-/* http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
-#define EM_S370 9
-#define EM_VPP500 17
-#define EM_960 19
-#define EM_V800 36
-#define EM_FR20 37
-#define EM_RH32 38
-#define EM_RCE 39
-#define EM_FAKE_ALPHA 41
-#define EM_TRICORE 44
-#define EM_ARC 45
-#define EM_H8_300H 47
-#define EM_H8S 48
-#define EM_H8_500 49
-#define EM_MIPS_X 51
-#define EM_COLDFIRE 52
-#define EM_68HC12 53
-#define EM_MMA 54
-#define EM_PCP 55
-#define EM_NCPU 56
-#define EM_NDR1 57
-#define EM_STARCORE 58
-#define EM_ME16 59
-#define EM_ST100 60
-#define EM_TINYJ 61
-#define EM_PDSP 63
-#define EM_PDP10 64
-#define EM_PDP11 65
-#define EM_FX66 66
-#define EM_ST9PLUS 67
-#define EM_ST7 68
-#define EM_68HC16 69
-#define EM_68HC11 70
-#define EM_68HC08 71
-#define EM_68HC05 72
-#define EM_SVX 73
-#define EM_ST19 74
-#define EM_VAX 75
-#define EM_JAVELIN 77
-#define EM_FIREPATH 78
-#define EM_ZSP 79
-#define EM_MMIX 80
-#define EM_HUANY 81
-#define EM_PRISM 82
-#define EM_AVR 83
-#define EM_FR30 84
-#define EM_D10V 85
-#define EM_D30V 86
-#define EM_V850 87
-#define EM_MN10200 90
-#define EM_PJ 91
-#define EM_ARC_COMPACT 93
-#define EM_XTENSA 94
-#define EM_VIDEOCORE 95
-#define EM_TMM_GPP 96
-#define EM_NS32K 97
-#define EM_TPC 98
-#define EM_SNP1K 99
-#define EM_ST200 100
-#define EM_IP2K 101
-#define EM_MAX 102
-#define EM_CR 103
-#define EM_F2MC16 104
-#define EM_MSP430 105
-#define EM_SE_C33 107
-#define EM_SEP 108
-#define EM_ARCA 109
-#define EM_UNICORE 110
-#define EM_EXCESS 111
-#define EM_DXP 112
-#define EM_CRX 114
-#define EM_XGATE 115
-#define EM_C166 116
-#define EM_M16C 117
-#define EM_DSPIC30F 118
-#define EM_CE 119
-#define EM_M32C 120
-#define EM_TSK3000 131
-#define EM_RS08 132
-#define EM_SHARC 133
-#define EM_ECOG2 134
-#define EM_SCORE7 135
-#define EM_DSP24 136
-#define EM_VIDEOCORE3 137
-#define EM_LATTICEMICO32 138
-#define EM_SE_C17 139
-#define EM_TI_C2000 141
-#define EM_TI_C5500 142
-#define EM_MMDSP_PLUS 160
-#define EM_CYPRESS_M8C 161
-#define EM_R32C 162
-#define EM_TRIMEDIA 163
-#define EM_QDSP6 164
-#define EM_8051 165
-#define EM_STXP7X 166
-#define EM_NDS32 167
-#define EM_ECOG1 168
-#define EM_ECOG1X 168
-#define EM_MAXQ30 169
-#define EM_XIMO16 170
-#define EM_MANIK 171
-#define EM_CRAYNV2 172
-#define EM_RX 173
-#define EM_METAG 174
-#define EM_MCST_ELBRUS 175
-#define EM_ECOG16 176
-#define EM_CR16 177
-#define EM_ETPU 178
-#define EM_SLE9X 179
-#define EM_L10M 180
-#define EM_K10M 181
-#define EM_AVR32 185
-#define EM_STM8 186
-#define EM_TILE64 187
-#define EM_CUDA 190
-#define EM_CLOUDSHIELD 192
-#define EM_COREA_1ST 193
-#define EM_COREA_2ND 194
-#define EM_ARC_COMPACT2 195
-#define EM_OPEN8 196
-#define EM_RL78 197
-#define EM_VIDEOCORE5 198
-#define EM_78KOR 199
-#define EM_56800EX 200
-#define EM_BA1 201
-#define EM_BA2 202
-#define EM_XCORE 203
-#define EM_MCHP_PIC 204
-#define EM_INTEL205 205
-#define EM_INTEL206 206
-#define EM_INTEL207 207
-#define EM_INTEL208 208
-#define EM_INTEL209 209
-#define EM_KM32 210
-#define EM_KMX32 211
-#define EM_KMX16 212
-#define EM_KMX8 213
-#define EM_KVARC 214
-#define EM_CDP 215
-#define EM_COGE 216
-#define EM_COOL 217
-#define EM_NORC 218
-#define EM_CSR_KALIMBA 219
-#define EM_Z80 220
-#define EM_VISIUM 221
-#define EM_FT32 222
-#define EM_MOXIE 223
-#define EM_AMDGPU 224
-#define EM_RISCV 243
-
-/* http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
-#define ET_LOOS 0xfe00
-#define ET_HIOS 0xfeff
-
/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
-#define GRP_COMDAT 0x1
#define GRP_MASKOS 0x0ff00000
#define GRP_MASKPROC 0xf0000000
-/* http://www.sco.com/developers/gabi/latest/ch5.pheader.html */
-#define PF_X 0x1
-#define PF_W 0x2
-#define PF_R 0x4
-#define PF_MASKOS 0x0ff00000
-#define PF_MASKPROC 0xf0000000
-
-#define PT_GNU_RELRO 0x6474e552
-
-#define STB_LOOS 10
-#define STB_HIOS 12
-#define STB_LOPROC 13
-#define STB_HIPROC 15
-
/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
-#define SHF_MERGE 0x10
-#define SHF_STRINGS 0x20
-#define SHF_INFO_LINK 0x40
-#define SHF_LINK_ORDER 0x80
-#define SHF_OS_NONCONFORMING 0x100
-#define SHF_GROUP 0x200
-#define SHF_TLS 0x400
-#define SHF_COMPRESSED 0x800
-#define SHF_MASKOS 0x0ff00000
-#define SHF_MASKPROC 0xf0000000
-
-/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
-#define SHN_LOOS 0xff20
-#define SHN_HIOS 0xff3f
-#define SHN_XINDEX 0xffff
-
-/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
-#define SHT_INIT_ARRAY 14
-#define SHT_FINI_ARRAY 15
-#define SHT_PREINIT_ARRAY 16
-#define SHT_GROUP 17
-#define SHT_SYMTAB_SHNDX 18
+/*
+ * Standard replacement for SHT_ANDROID_RELR.
+ */
#define SHT_RELR 19
#undef SHT_NUM
#define SHT_NUM 20
-#define SHT_LOOS 0x60000000
-#define SHT_HIOS 0x6fffffff
-
-/* http://www.sco.com/developers/gabi/latest/ch4.symtab.html */
-#define STN_UNDEF 0
-
-/* http://www.sco.com/developers/gabi/latest/ch4.symtab.html */
-#define STT_GNU_IFUNC 10
-#define STT_LOOS 10
-#define STT_HIOS 12
-#define STT_LOPROC 13
-#define STT_HIPROC 15
-
-/* http://www.sco.com/developers/gabi/latest/ch4.symtab.html */
-#define STV_DEFAULT 0
-#define STV_INTERNAL 1
-#define STV_HIDDEN 2
-#define STV_PROTECTED 3
-
-/* The kernel uses NT_PRFPREG but glibc also offers NT_FPREGSET */
-#define NT_FPREGSET NT_PRFPREG
-
-#define ELF_NOTE_GNU "GNU"
-
-#define NT_GNU_BUILD_ID 3
-
-#define VER_FLG_BASE 0x1
-#define VER_FLG_WEAK 0x2
-
-#define VER_NDX_LOCAL 0
-#define VER_NDX_GLOBAL 1
/*
* Experimental support for SHT_RELR sections. For details, see proposal
@@ -553,3 +257,13 @@
#define DT_ANDROID_RELSZ 0x60000010 // DT_LOOS + 3
#define DT_ANDROID_RELA 0x60000011 // DT_LOOS + 4
#define DT_ANDROID_RELASZ 0x60000012 // DT_LOOS + 5
+
+/* Linux traditionally doesn't have the trailing 64 that BSD has on these. */
+#define R_AARCH64_TLS_DTPREL R_AARCH64_TLS_DTPREL64
+#define R_AARCH64_TLS_DTPMOD R_AARCH64_TLS_DTPMOD64
+#define R_AARCH64_TLS_TPREL R_AARCH64_TLS_TPREL64
+
+/* TODO: upstream these to FreeBSD? */
+#define R_ARM_TLS_DESC 13
+#define R_ARM_IRELATIVE 160
+#define R_X86_64_JUMP_SLOT 7
diff --git a/libc/include/err.h b/libc/include/err.h
index e91dac9..af44514 100644
--- a/libc/include/err.h
+++ b/libc/include/err.h
@@ -50,7 +50,7 @@
*
* New code should consider error() in `<error.h>`.
*/
-__noreturn void err(int __status, const char* __fmt, ...) __printflike(2, 3);
+__noreturn void err(int __status, const char* _Nullable __fmt, ...) __printflike(2, 3);
/**
* [verr(3)](http://man7.org/linux/man-pages/man3/verr.3.html) outputs the program name,
@@ -60,7 +60,7 @@
*
* New code should consider error() in `<error.h>`.
*/
-__noreturn void verr(int __status, const char* __fmt, va_list __args) __printflike(2, 0);
+__noreturn void verr(int __status, const char* _Nullable __fmt, va_list __args) __printflike(2, 0);
/**
* [errx(3)](http://man7.org/linux/man-pages/man3/errx.3.html) outputs the program name, and
@@ -70,7 +70,7 @@
*
* New code should consider error() in `<error.h>`.
*/
-__noreturn void errx(int __status, const char* __fmt, ...) __printflike(2, 3);
+__noreturn void errx(int __status, const char* _Nullable __fmt, ...) __printflike(2, 3);
/**
* [verrx(3)](http://man7.org/linux/man-pages/man3/err.3.html) outputs the program name, and
@@ -80,7 +80,7 @@
*
* New code should consider error() in `<error.h>`.
*/
-__noreturn void verrx(int __status, const char* __fmt, va_list __args) __printflike(2, 0);
+__noreturn void verrx(int __status, const char* _Nullable __fmt, va_list __args) __printflike(2, 0);
/**
* [warn(3)](http://man7.org/linux/man-pages/man3/warn.3.html) outputs the program name,
@@ -88,7 +88,7 @@
*
* New code should consider error() in `<error.h>`.
*/
-void warn(const char* __fmt, ...) __printflike(1, 2);
+void warn(const char* _Nullable __fmt, ...) __printflike(1, 2);
/**
* [vwarn(3)](http://man7.org/linux/man-pages/man3/vwarn.3.html) outputs the program name,
@@ -96,7 +96,7 @@
*
* New code should consider error() in `<error.h>`.
*/
-void vwarn(const char* __fmt, va_list __args) __printflike(1, 0);
+void vwarn(const char* _Nullable __fmt, va_list __args) __printflike(1, 0);
/**
* [warnx(3)](http://man7.org/linux/man-pages/man3/warnx.3.html) outputs the program name, and
@@ -104,7 +104,7 @@
*
* New code should consider error() in `<error.h>`.
*/
-void warnx(const char* __fmt, ...) __printflike(1, 2);
+void warnx(const char* _Nullable __fmt, ...) __printflike(1, 2);
/**
* [vwarnx(3)](http://man7.org/linux/man-pages/man3/warn.3.html) outputs the program name, and
@@ -112,6 +112,6 @@
*
* New code should consider error() in `<error.h>`.
*/
-void vwarnx(const char* __fmt, va_list __args) __printflike(1, 0);
+void vwarnx(const char* _Nullable __fmt, va_list __args) __printflike(1, 0);
__END_DECLS
diff --git a/libc/include/errno.h b/libc/include/errno.h
index b6a4c7e..12ebdf7 100644
--- a/libc/include/errno.h
+++ b/libc/include/errno.h
@@ -49,7 +49,7 @@
*
* @private
*/
-int* __errno(void) __attribute_const__;
+int* _Nonnull __errno(void) __attribute_const__;
/**
* [errno(3)](http://man7.org/linux/man-pages/man3/errno.3.html) is the last error on the calling
@@ -58,5 +58,3 @@
#define errno (*__errno())
__END_DECLS
-
-#include <android/legacy_errno_inlines.h>
diff --git a/libc/include/error.h b/libc/include/error.h
index 036a831..187ee17 100644
--- a/libc/include/error.h
+++ b/libc/include/error.h
@@ -44,7 +44,7 @@
*
* Available since API level 23.
*/
-extern void (*error_print_progname)(void) __INTRODUCED_IN(23);
+extern void (* _Nullable error_print_progname)(void) __INTRODUCED_IN(23);
/**
* [error_message_count(3)](http://man7.org/linux/man-pages/man3/error_message_count.3.html) is
@@ -70,7 +70,7 @@
*
* Available since API level 23.
*/
-void error(int __status, int __errno, const char* __fmt, ...) __printflike(3, 4) __INTRODUCED_IN(23);
+void error(int __status, int __errno, const char* _Nonnull __fmt, ...) __printflike(3, 4) __INTRODUCED_IN(23);
/**
* [error_at_line(3)](http://man7.org/linux/man-pages/man3/error_at_line.3.html) formats the given
@@ -80,6 +80,6 @@
*
* Available since API level 23.
*/
-void error_at_line(int __status, int __errno, const char* __filename, unsigned int __line_number, const char* __fmt, ...) __printflike(5, 6) __INTRODUCED_IN(23);
+void error_at_line(int __status, int __errno, const char* _Nonnull __filename, unsigned int __line_number, const char* _Nonnull __fmt, ...) __printflike(5, 6) __INTRODUCED_IN(23);
__END_DECLS
diff --git a/libc/include/execinfo.h b/libc/include/execinfo.h
index 347ae92..88f4ae7 100644
--- a/libc/include/execinfo.h
+++ b/libc/include/execinfo.h
@@ -47,7 +47,7 @@
*
* Available since API level 33.
*/
-int backtrace(void** buffer, int size) __INTRODUCED_IN(33);
+int backtrace(void* _Nonnull * _Nonnull buffer, int size) __INTRODUCED_IN(33);
/**
* [backtrace_symbols(3)](https://man7.org/linux/man-pages/man3/backtrace_symbols.3.html)
@@ -59,7 +59,7 @@
*
* Available since API level 33.
*/
-char** backtrace_symbols(void* const* buffer, int size) __INTRODUCED_IN(33);
+char* _Nullable * _Nullable backtrace_symbols(void* _Nonnull const* _Nonnull buffer, int size) __INTRODUCED_IN(33);
/**
* [backtrace_symbols_fd(3)](https://man7.org/linux/man-pages/man3/backtrace_symbols_fd.3.html)
@@ -69,6 +69,6 @@
*
* Available since API level 33.
*/
-void backtrace_symbols_fd(void* const* buffer, int size, int fd) __INTRODUCED_IN(33);
+void backtrace_symbols_fd(void* _Nonnull const* _Nonnull buffer, int size, int fd) __INTRODUCED_IN(33);
__END_DECLS
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index 1ea94e6..a8db387 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -84,7 +84,6 @@
/** Flag for open(). */
#define O_RSYNC O_SYNC
-#if __ANDROID_API__ >= 21
/** Flag for splice(). */
#define SPLICE_F_MOVE 1
/** Flag for splice(). */
@@ -93,7 +92,6 @@
#define SPLICE_F_MORE 4
/** Flag for splice(). */
#define SPLICE_F_GIFT 8
-#endif
#if __ANDROID_API__ >= 26
/** Flag for sync_file_range(). */
@@ -111,9 +109,9 @@
* Returns a new file descriptor on success and returns -1 and sets `errno` on
* failure.
*/
-int creat(const char* __path, mode_t __mode);
+int creat(const char* _Nonnull __path, mode_t __mode);
/** See creat(). */
-int creat64(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
+int creat64(const char* _Nonnull __path, mode_t __mode) __INTRODUCED_IN(21);
/**
* [openat(2)](http://man7.org/linux/man-pages/man2/openat.2.html)
@@ -122,9 +120,9 @@
* Returns a new file descriptor on success and returns -1 and sets `errno` on
* failure.
*/
-int openat(int __dir_fd, const char* __path, int __flags, ...);
+int openat(int __dir_fd, const char* _Nonnull __path, int __flags, ...);
/** See openat(). */
-int openat64(int __dir_fd, const char* __path, int __flags, ...) __INTRODUCED_IN(21);
+int openat64(int __dir_fd, const char* _Nonnull __path, int __flags, ...) __INTRODUCED_IN(21);
/**
* [open(2)](http://man7.org/linux/man-pages/man2/open.2.html)
@@ -133,9 +131,9 @@
* Returns a new file descriptor on success and returns -1 and sets `errno` on
* failure.
*/
-int open(const char* __path, int __flags, ...);
+int open(const char* _Nonnull __path, int __flags, ...);
/** See open(). */
-int open64(const char* __path, int __flags, ...) __INTRODUCED_IN(21);
+int open64(const char* _Nonnull __path, int __flags, ...) __INTRODUCED_IN(21);
/**
* [splice(2)](http://man7.org/linux/man-pages/man2/splice.2.html)
@@ -149,7 +147,7 @@
*
* Available since API level 21.
*/
-ssize_t splice(int __in_fd, off64_t* __in_offset, int __out_fd, off64_t* __out_offset, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
+ssize_t splice(int __in_fd, off64_t* __BIONIC_COMPLICATED_NULLNESS __in_offset, int __out_fd, off64_t* __BIONIC_COMPLICATED_NULLNESS __out_offset, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
/**
* [tee(2)](http://man7.org/linux/man-pages/man2/tee.2.html)
@@ -177,7 +175,7 @@
*
* Available since API level 21.
*/
-ssize_t vmsplice(int __fd, const struct iovec* __iov, size_t __count, unsigned int __flags) __INTRODUCED_IN(21);
+ssize_t vmsplice(int __fd, const struct iovec* _Nonnull __iov, size_t __count, unsigned int __flags) __INTRODUCED_IN(21);
/**
* [fallocate(2)](http://man7.org/linux/man-pages/man2/fallocate.2.html)
diff --git a/libc/include/fenv.h b/libc/include/fenv.h
index 7b775b6..6e8ea57 100644
--- a/libc/include/fenv.h
+++ b/libc/include/fenv.h
@@ -35,34 +35,31 @@
#include <bits/fenv_arm.h>
#elif defined(__i386__)
#include <bits/fenv_x86.h>
+#elif defined(__riscv)
+#include <bits/fenv_riscv64.h>
#elif defined(__x86_64__)
#include <bits/fenv_x86_64.h>
#endif
__BEGIN_DECLS
-// fenv was always available on x86.
-#if __ANDROID_API__ >= 21 || defined(__i386__)
int feclearexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
-int fegetexceptflag(fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
+int fegetexceptflag(fexcept_t* _Nonnull __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
int feraiseexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
-int fesetexceptflag(const fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
+int fesetexceptflag(const fexcept_t* _Nonnull __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
int fetestexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
int fegetround(void) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
int fesetround(int __rounding_mode) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
-int fegetenv(fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
-int feholdexcept(fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
-int fesetenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
-int feupdateenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
+int fegetenv(fenv_t* _Nonnull __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
+int feholdexcept(fenv_t* _Nonnull __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
+int fesetenv(const fenv_t* _Nonnull __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
+int feupdateenv(const fenv_t* _Nonnull __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
int feenableexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
int fedisableexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
int fegetexcept(void) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_X86(9);
-#else
-/* Defined as inlines for pre-21 ARM. */
-#endif
/*
* The following constant represents the default floating-point environment
@@ -76,7 +73,3 @@
#define FE_DFL_ENV (&__fe_dfl_env)
__END_DECLS
-
-#if defined(__arm__)
-#include <android/legacy_fenv_inlines_arm.h>
-#endif
diff --git a/libc/include/fts.h b/libc/include/fts.h
index 7e63111..bae2615 100644
--- a/libc/include/fts.h
+++ b/libc/include/fts.h
@@ -39,15 +39,15 @@
#include <sys/types.h>
typedef struct {
- struct _ftsent *fts_cur; /* current node */
- struct _ftsent *fts_child; /* linked list of children */
- struct _ftsent **fts_array; /* sort array */
+ struct _ftsent * _Nullable fts_cur; /* current node */
+ struct _ftsent * _Nullable fts_child; /* linked list of children */
+ struct _ftsent * _Nullable * _Nullable fts_array; /* sort array */
dev_t fts_dev; /* starting device # */
- char *fts_path; /* path for this descent */
+ char * _Nullable fts_path; /* path for this descent */
int fts_rfd; /* fd for root */
size_t fts_pathlen; /* sizeof(path) */
int fts_nitems; /* elements in the sort array */
- int (*fts_compar)(); /* compare function */
+ int (* _Nullable fts_compar)(); /* compare function */
#define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */
#define FTS_LOGICAL 0x0002 /* logical walk */
@@ -65,13 +65,13 @@
} FTS;
typedef struct _ftsent {
- struct _ftsent *fts_cycle; /* cycle node */
- struct _ftsent *fts_parent; /* parent directory */
- struct _ftsent *fts_link; /* next file in directory */
+ struct _ftsent * _Nullable fts_cycle; /* cycle node */
+ struct _ftsent * _Nullable fts_parent; /* parent directory */
+ struct _ftsent * _Nullable fts_link; /* next file in directory */
long fts_number; /* local numeric value */
- void *fts_pointer; /* local address value */
- char *fts_accpath; /* access path */
- char *fts_path; /* root path */
+ void * _Nullable fts_pointer; /* local address value */
+ char * _Nullable fts_accpath; /* access path */
+ char * _Nullable fts_path; /* root path */
int fts_errno; /* errno for this node */
int fts_symfd; /* fd for symlink */
size_t fts_pathlen; /* strlen(fts_path) */
@@ -111,7 +111,7 @@
#define FTS_SKIP 4 /* discard node */
unsigned short fts_instr; /* fts_set() instructions */
- struct stat *fts_statp; /* stat(2) information */
+ struct stat * _Nullable fts_statp; /* stat(2) information */
char fts_name[1]; /* file name */
} FTSENT;
@@ -122,11 +122,11 @@
* breakage in 21 that means you can't write code that runs on current devices and pre-21 devices,
* so we break the tie in favor of current and future devices.
*/
-FTSENT* fts_children(FTS* __fts, int __options) __INTRODUCED_IN(21);
-int fts_close(FTS* __fts) __INTRODUCED_IN(21);
-FTS* fts_open(char* const* __path, int __options, int (*__comparator)(const FTSENT** __lhs, const FTSENT** __rhs)) __INTRODUCED_IN(21);
-FTSENT* fts_read(FTS* __fts) __INTRODUCED_IN(21);
-int fts_set(FTS* __fts, FTSENT* __entry, int __options) __INTRODUCED_IN(21);
+FTSENT* _Nullable fts_children(FTS* _Nonnull __fts, int __options) __INTRODUCED_IN(21);
+int fts_close(FTS* _Nonnull __fts) __INTRODUCED_IN(21);
+FTS* _Nullable fts_open(char* _Nonnull const* _Nonnull __path, int __options, int (* _Nullable __comparator)(const FTSENT* _Nonnull * _Nonnull __lhs, const FTSENT* _Nonnull * _Nonnull __rhs)) __INTRODUCED_IN(21);
+FTSENT* _Nullable fts_read(FTS* _Nonnull __fts) __INTRODUCED_IN(21);
+int fts_set(FTS* _Nonnull __fts, FTSENT* _Nonnull __entry, int __options) __INTRODUCED_IN(21);
__END_DECLS
diff --git a/libc/include/ftw.h b/libc/include/ftw.h
index a289643..c5fa4de 100644
--- a/libc/include/ftw.h
+++ b/libc/include/ftw.h
@@ -55,10 +55,10 @@
};
__BEGIN_DECLS
-int ftw(const char* __dir_path, int (*__callback)(const char*, const struct stat*, int), int __max_fd_count) __INTRODUCED_IN(17);
-int nftw(const char* __dir_path, int (*__callback)(const char*, const struct stat*, int, struct FTW*), int __max_fd_count, int __flags) __INTRODUCED_IN(17);
-int ftw64(const char* __dir_path, int (*__callback)(const char*, const struct stat64*, int), int __max_fd_count) __RENAME_STAT64(ftw, 17, 21);
-int nftw64(const char* __dir_path, int (*__callback)(const char*, const struct stat64*, int, struct FTW*), int __max_fd_count, int __flags) __RENAME_STAT64(nftw, 17, 21);
+int ftw(const char* _Nonnull __dir_path, int (* _Nonnull __callback)(const char* _Nonnull, const struct stat* _Nonnull, int), int __max_fd_count) __INTRODUCED_IN(17);
+int nftw(const char* _Nonnull __dir_path, int (* _Nonnull __callback)(const char* _Nonnull, const struct stat* _Nonnull, int, struct FTW* _Nonnull), int __max_fd_count, int __flags) __INTRODUCED_IN(17);
+int ftw64(const char* _Nonnull __dir_path, int (* _Nonnull __callback)(const char* _Nonnull, const struct stat64* _Nonnull, int), int __max_fd_count) __RENAME_STAT64(ftw, 17, 21);
+int nftw64(const char* _Nonnull __dir_path, int (* _Nonnull __callback)(const char* _Nonnull, const struct stat64* _Nonnull, int, struct FTW* _Nonnull), int __max_fd_count, int __flags) __RENAME_STAT64(nftw, 17, 21);
__END_DECLS
#endif
diff --git a/libc/include/getopt.h b/libc/include/getopt.h
index 014226a..c1c0442 100644
--- a/libc/include/getopt.h
+++ b/libc/include/getopt.h
@@ -49,8 +49,11 @@
#define optional_argument 2
struct option {
- /** Name of long option. */
- const char *name;
+ /**
+ * Name of long option. Options must have a non-NULL name.
+ * A NULL name signals the end of the options array.
+ */
+ const char * _Nullable name;
/**
* One of `no_argument`, `required_argument`, or `optional_argument`.
@@ -58,7 +61,7 @@
int has_arg;
/** If not NULL, set `*flag` to val when option found. */
- int* flag;
+ int* _Nullable flag;
/** If `flag` not NULL, the value to assign to `*flag`; otherwise the return value. */
int val;
@@ -69,12 +72,12 @@
/**
* [getopt_long(3)](http://man7.org/linux/man-pages/man3/getopt.3.html) parses command-line options.
*/
-int getopt_long(int __argc, char* const* __argv, const char* __options, const struct option* __long_options, int* __long_index);
+int getopt_long(int __argc, char* _Nonnull const* _Nonnull __argv, const char* _Nonnull __options, const struct option* _Nonnull __long_options, int* _Nullable __long_index);
/**
* [getopt_long_only(3)](http://man7.org/linux/man-pages/man3/getopt.3.html) parses command-line options.
*/
-int getopt_long_only(int __argc, char* const* __argv, const char* __options, const struct option* __long_options, int* __long_index);
+int getopt_long_only(int __argc, char* _Nonnull const* _Nonnull __argv, const char* _Nonnull __options, const struct option* _Nonnull __long_options, int* _Nullable __long_index);
#ifndef _OPTRESET_DECLARED
#define _OPTRESET_DECLARED
diff --git a/libc/include/glob.h b/libc/include/glob.h
index 0ba2848..2c2b8d1 100644
--- a/libc/include/glob.h
+++ b/libc/include/glob.h
@@ -47,21 +47,23 @@
size_t gl_matchc; /* Count of paths matching pattern. */
size_t gl_offs; /* Reserved at beginning of gl_pathv. */
int gl_flags; /* Copy of flags parameter to glob. */
- char** gl_pathv; /* List of paths matching pattern. */
- /* Copy of `__error_callback` parameter to glob. */
- int (*gl_errfunc)(const char* __failure_path, int __failure_errno);
+ /** List of paths matching pattern. */
+ char* _Nullable * _Nullable gl_pathv;
- /*
- * Alternate filesystem access methods for glob; replacement
- * versions of closedir(3), readdir(3), opendir(3), stat(2)
- * and lstat(2).
- */
- void (*gl_closedir)(void*);
- struct dirent* (*gl_readdir)(void*);
- void* (*gl_opendir)(const char*);
- int (*gl_lstat)(const char*, struct stat*);
- int (*gl_stat)(const char*, struct stat*);
+ /** Copy of `__error_callback` parameter to glob. */
+ int (* _Nullable gl_errfunc)(const char* _Nonnull __failure_path, int __failure_errno);
+
+ /** Called instead of closedir() when GLOB_ALTDIRFUNC flag is specified. */
+ void (* _Nullable gl_closedir)(void* _Nonnull);
+ /** Called instead of readdir() when GLOB_ALTDIRFUNC flag is specified. */
+ struct dirent* _Nullable (* _Nonnull gl_readdir)(void* _Nonnull);
+ /** Called instead of opendir() when GLOB_ALTDIRFUNC flag is specified. */
+ void* _Nullable (* _Nonnull gl_opendir)(const char* _Nonnull);
+ /** Called instead of lstat() when GLOB_ALTDIRFUNC flag is specified. */
+ int (* _Nullable gl_lstat)(const char* _Nonnull, struct stat* _Nonnull);
+ /** Called instead of stat() when GLOB_ALTDIRFUNC flag is specified. */
+ int (* _Nullable gl_stat)(const char* _Nonnull, struct stat* _Nonnull);
} glob_t;
/* Believed to have been introduced in 1003.2-1992 */
@@ -90,8 +92,8 @@
__BEGIN_DECLS
-int glob(const char* __pattern, int __flags, int (*__error_callback)(const char* __failure_path, int __failure_errno), glob_t* __result_ptr) __INTRODUCED_IN(28);
-void globfree(glob_t* __result_ptr) __INTRODUCED_IN(28);
+int glob(const char* _Nonnull __pattern, int __flags, int (* _Nullable __error_callback)(const char* _Nonnull __failure_path, int __failure_errno), glob_t* _Nonnull __result_ptr) __INTRODUCED_IN(28);
+void globfree(glob_t* _Nonnull __result_ptr) __INTRODUCED_IN(28);
__END_DECLS
diff --git a/libc/include/grp.h b/libc/include/grp.h
index 9d67adf..2451db5 100644
--- a/libc/include/grp.h
+++ b/libc/include/grp.h
@@ -39,26 +39,26 @@
#include <sys/types.h>
struct group {
- char* gr_name; /* group name */
- char* gr_passwd; /* group password */
+ char* _Nullable gr_name; /* group name */
+ char* _Nullable gr_passwd; /* group password */
gid_t gr_gid; /* group id */
- char** gr_mem; /* group members */
+ char* _Nullable * _Nullable gr_mem; /* group members */
};
__BEGIN_DECLS
-struct group* getgrgid(gid_t __gid);
-struct group* getgrnam(const char* __name);
+struct group* _Nullable getgrgid(gid_t __gid);
+struct group* _Nullable getgrnam(const char* _Nonnull __name);
/* Note: Android has thousands and thousands of ids to iterate through. */
-struct group* getgrent(void) __INTRODUCED_IN(26);
+struct group* _Nullable getgrent(void) __INTRODUCED_IN(26);
void setgrent(void) __INTRODUCED_IN(26);
void endgrent(void) __INTRODUCED_IN(26);
-int getgrgid_r(gid_t __gid, struct group* __group, char* __buf, size_t __n, struct group** __result) __INTRODUCED_IN(24);
-int getgrnam_r(const char* __name, struct group* __group, char* __buf, size_t __n, struct group** __result) __INTRODUCED_IN(24);
-int getgrouplist(const char* __user, gid_t __group, gid_t* __groups, int* __group_count);
-int initgroups(const char* __user, gid_t __group);
+int getgrgid_r(gid_t __gid, struct group* __BIONIC_COMPLICATED_NULLNESS __group, char* _Nonnull __buf, size_t __n, struct group* _Nullable * _Nonnull __result) __INTRODUCED_IN(24);
+int getgrnam_r(const char* _Nonnull __name, struct group* __BIONIC_COMPLICATED_NULLNESS __group, char* _Nonnull __buf, size_t __n, struct group* _Nullable *_Nonnull __result) __INTRODUCED_IN(24);
+int getgrouplist(const char* _Nonnull __user, gid_t __group, gid_t* __BIONIC_COMPLICATED_NULLNESS __groups, int* _Nonnull __group_count);
+int initgroups(const char* _Nonnull __user, gid_t __group);
__END_DECLS
diff --git a/libc/include/iconv.h b/libc/include/iconv.h
index ec4bdea..7cf36dc 100644
--- a/libc/include/iconv.h
+++ b/libc/include/iconv.h
@@ -54,7 +54,7 @@
*
* Available since API level 28.
*/
-iconv_t iconv_open(const char* __src_encoding, const char* __dst_encoding) __INTRODUCED_IN(28);
+iconv_t _Nonnull iconv_open(const char* _Nonnull __src_encoding, const char* _Nonnull __dst_encoding) __INTRODUCED_IN(28);
/**
* [iconv(3)](http://man7.org/linux/man-pages/man3/iconv.3.html) converts characters from one
@@ -68,7 +68,7 @@
*
* Available since API level 28.
*/
-size_t iconv(iconv_t __converter, char** __src_buf, size_t* __src_bytes_left, char** __dst_buf, size_t* __dst_bytes_left) __INTRODUCED_IN(28);
+size_t iconv(iconv_t _Nonnull __converter, char* _Nullable * _Nullable __src_buf, size_t* __BIONIC_COMPLICATED_NULLNESS __src_bytes_left, char* _Nullable * _Nullable __dst_buf, size_t* __BIONIC_COMPLICATED_NULLNESS __dst_bytes_left) __INTRODUCED_IN(28);
/**
* [iconv_close(3)](http://man7.org/linux/man-pages/man3/iconv_close.3.html) deallocates a converter
@@ -78,6 +78,6 @@
*
* Available since API level 28.
*/
-int iconv_close(iconv_t __converter) __INTRODUCED_IN(28);
+int iconv_close(iconv_t _Nonnull __converter) __INTRODUCED_IN(28);
__END_DECLS
diff --git a/libc/include/ifaddrs.h b/libc/include/ifaddrs.h
index 9eaabbd..7c0dcbf 100644
--- a/libc/include/ifaddrs.h
+++ b/libc/include/ifaddrs.h
@@ -44,26 +44,26 @@
*/
struct ifaddrs {
/** Pointer to the next element in the linked list. */
- struct ifaddrs* ifa_next;
+ struct ifaddrs* _Nullable ifa_next;
/** Interface name. */
- char* ifa_name;
+ char* _Nullable ifa_name;
/** Interface flags (like `SIOCGIFFLAGS`). */
unsigned int ifa_flags;
/** Interface address. */
- struct sockaddr* ifa_addr;
+ struct sockaddr* _Nullable ifa_addr;
/** Interface netmask. */
- struct sockaddr* ifa_netmask;
+ struct sockaddr* _Nullable ifa_netmask;
union {
/** Interface broadcast address (if IFF_BROADCAST is set). */
- struct sockaddr* ifu_broadaddr;
+ struct sockaddr* _Nullable ifu_broadaddr;
/** Interface destination address (if IFF_POINTOPOINT is set). */
- struct sockaddr* ifu_dstaddr;
+ struct sockaddr* _Nullable ifu_dstaddr;
} ifa_ifu;
/** Unused. */
- void* ifa_data;
+ void* _Nullable ifa_data;
};
/** Synonym for `ifa_ifu.ifu_broadaddr` in `struct ifaddrs`. */
@@ -80,7 +80,7 @@
*
* Available since API level 24.
*/
-int getifaddrs(struct ifaddrs** __list_ptr) __INTRODUCED_IN(24);
+int getifaddrs(struct ifaddrs* _Nullable * _Nonnull __list_ptr) __INTRODUCED_IN(24);
/**
* [freeifaddrs(3)](http://man7.org/linux/man-pages/man3/freeifaddrs.3.html) frees a linked list
@@ -88,6 +88,6 @@
*
* Available since API level 24.
*/
-void freeifaddrs(struct ifaddrs* __ptr) __INTRODUCED_IN(24);
+void freeifaddrs(struct ifaddrs* _Nullable __ptr) __INTRODUCED_IN(24);
__END_DECLS
diff --git a/libc/include/inttypes.h b/libc/include/inttypes.h
index 7a409d8..76aee38 100644
--- a/libc/include/inttypes.h
+++ b/libc/include/inttypes.h
@@ -85,6 +85,42 @@
#define PRIiPTR __PRI_PTR_prefix"i" /* intptr_t */
/* fprintf macros for unsigned integers */
+#define PRIb8 "b" /* int8_t */
+#define PRIb16 "b" /* int16_t */
+#define PRIb32 "b" /* int32_t */
+#define PRIb64 __PRI_64_prefix"b" /* int64_t */
+
+#define PRIbLEAST8 "b" /* int_least8_t */
+#define PRIbLEAST16 "b" /* int_least16_t */
+#define PRIbLEAST32 "b" /* int_least32_t */
+#define PRIbLEAST64 __PRI_64_prefix"b" /* int_least64_t */
+
+#define PRIbFAST8 "b" /* int_fast8_t */
+#define PRIbFAST16 __PRI_FAST_prefix"b" /* int_fast16_t */
+#define PRIbFAST32 __PRI_FAST_prefix"b" /* int_fast32_t */
+#define PRIbFAST64 __PRI_64_prefix"b" /* int_fast64_t */
+
+#define PRIbMAX "jb" /* intmax_t */
+#define PRIbPTR __PRI_PTR_prefix"b" /* intptr_t */
+
+#define PRIB8 "B" /* int8_t */
+#define PRIB16 "B" /* int16_t */
+#define PRIB32 "B" /* int32_t */
+#define PRIB64 __PRI_64_prefix"B" /* int64_t */
+
+#define PRIBLEAST8 "B" /* int_least8_t */
+#define PRIBLEAST16 "B" /* int_least16_t */
+#define PRIBLEAST32 "B" /* int_least32_t */
+#define PRIBLEAST64 __PRI_64_prefix"B" /* int_least64_t */
+
+#define PRIBFAST8 "B" /* int_fast8_t */
+#define PRIBFAST16 __PRI_FAST_prefix"B" /* int_fast16_t */
+#define PRIBFAST32 __PRI_FAST_prefix"B" /* int_fast32_t */
+#define PRIBFAST64 __PRI_64_prefix"B" /* int_fast64_t */
+
+#define PRIBMAX "jB" /* intmax_t */
+#define PRIBPTR __PRI_PTR_prefix"B" /* intptr_t */
+
#define PRIo8 "o" /* int8_t */
#define PRIo16 "o" /* int16_t */
#define PRIo32 "o" /* int32_t */
@@ -195,6 +231,42 @@
#define SCNiPTR __PRI_PTR_prefix"i" /* intptr_t */
/* fscanf macros for unsigned integers */
+#define SCNb8 "hhb" /* uint8_t */
+#define SCNb16 "hb" /* uint16_t */
+#define SCNb32 "b" /* uint32_t */
+#define SCNb64 __PRI_64_prefix"b" /* uint64_t */
+
+#define SCNbLEAST8 "hhb" /* uint_least8_t */
+#define SCNbLEAST16 "hb" /* uint_least16_t */
+#define SCNbLEAST32 "b" /* uint_least32_t */
+#define SCNbLEAST64 __PRI_64_prefix"b" /* uint_least64_t */
+
+#define SCNbFAST8 "hhb" /* uint_fast8_t */
+#define SCNbFAST16 __PRI_FAST_prefix"b" /* uint_fast16_t */
+#define SCNbFAST32 __PRI_FAST_prefix"b" /* uint_fast32_t */
+#define SCNbFAST64 __PRI_64_prefix"b" /* uint_fast64_t */
+
+#define SCNbMAX "jb" /* uintmax_t */
+#define SCNbPTR __PRI_PTR_prefix"b" /* uintptr_t */
+
+#define SCNB8 "hhB" /* uint8_t */
+#define SCNB16 "hB" /* uint16_t */
+#define SCNB32 "B" /* uint32_t */
+#define SCNB64 __PRI_64_prefix"B" /* uint64_t */
+
+#define SCNBLEAST8 "hhB" /* uint_least8_t */
+#define SCNBLEAST16 "hB" /* uint_least16_t */
+#define SCNBLEAST32 "B" /* uint_least32_t */
+#define SCNBLEAST64 __PRI_64_prefix"B" /* uint_least64_t */
+
+#define SCNBFAST8 "hhB" /* uint_fast8_t */
+#define SCNBFAST16 __PRI_FAST_prefix"B" /* uint_fast16_t */
+#define SCNBFAST32 __PRI_FAST_prefix"B" /* uint_fast32_t */
+#define SCNBFAST64 __PRI_64_prefix"B" /* uint_fast64_t */
+
+#define SCNBMAX "jB" /* uintmax_t */
+#define SCNBPTR __PRI_PTR_prefix"B" /* uintptr_t */
+
#define SCNo8 "hho" /* uint8_t */
#define SCNo16 "ho" /* uint16_t */
#define SCNo32 "o" /* uint32_t */
@@ -257,10 +329,10 @@
__BEGIN_DECLS
intmax_t imaxabs(intmax_t __i) __attribute_const__ __INTRODUCED_IN(19);
imaxdiv_t imaxdiv(intmax_t __numerator, intmax_t __denominator) __attribute_const__ __INTRODUCED_IN(19);
-intmax_t strtoimax(const char* __s, char** __end_ptr, int __base);
-uintmax_t strtoumax(const char* __s, char** __end_ptr, int __base);
-intmax_t wcstoimax(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
-uintmax_t wcstoumax(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
+intmax_t strtoimax(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base);
+uintmax_t strtoumax(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base);
+intmax_t wcstoimax(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, int __base) __INTRODUCED_IN(21);
+uintmax_t wcstoumax(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, int __base) __INTRODUCED_IN(21);
__END_DECLS
#endif
diff --git a/libc/include/langinfo.h b/libc/include/langinfo.h
index d9d8c15..2b43892 100644
--- a/libc/include/langinfo.h
+++ b/libc/include/langinfo.h
@@ -92,8 +92,8 @@
#define NOEXPR 54
#define CRNCYSTR 55
-char* nl_langinfo(nl_item __item) __INTRODUCED_IN(26);
-char* nl_langinfo_l(nl_item __item, locale_t __l) __INTRODUCED_IN(26);
+char* _Nonnull nl_langinfo(nl_item __item) __INTRODUCED_IN(26);
+char* _Nonnull nl_langinfo_l(nl_item __item, locale_t _Nonnull __l) __INTRODUCED_IN(26);
__END_DECLS
diff --git a/libc/include/libgen.h b/libc/include/libgen.h
index b910790..474f066 100644
--- a/libc/include/libgen.h
+++ b/libc/include/libgen.h
@@ -50,7 +50,7 @@
* Note that Android's cv-qualifiers differ from POSIX; Android's implementation doesn't
* modify its input and uses thread-local storage for the result if necessary.
*/
-char* __posix_basename(const char* __path) __RENAME(basename);
+char* _Nullable __posix_basename(const char* _Nullable __path) __RENAME(basename);
/**
* This macro ensures that callers get the POSIX basename() if they include this header,
@@ -65,13 +65,13 @@
* Note that Android's cv-qualifiers differ from POSIX; Android's implementation doesn't
* modify its input and uses thread-local storage for the result if necessary.
*/
-char* dirname(const char* __path);
+char* _Nullable dirname(const char* _Nullable __path);
#if !defined(__LP64__)
/** Deprecated. Use dirname() instead. */
-int dirname_r(const char* __path, char* __buf, size_t __n);
+int dirname_r(const char* _Nullable __path, char* _Nullable __buf, size_t __n);
/** Deprecated. Use basename() instead. */
-int basename_r(const char* __path, char* __buf, size_t __n);
+int basename_r(const char* _Nullable __path, char* _Nullable __buf, size_t __n);
#endif
__END_DECLS
diff --git a/libc/include/link.h b/libc/include/link.h
index bd430f5..a0a3d60 100644
--- a/libc/include/link.h
+++ b/libc/include/link.h
@@ -44,41 +44,41 @@
struct dl_phdr_info {
ElfW(Addr) dlpi_addr;
- const char* dlpi_name;
- const ElfW(Phdr)* dlpi_phdr;
+ const char* _Nullable dlpi_name;
+ const ElfW(Phdr)* _Nullable dlpi_phdr;
ElfW(Half) dlpi_phnum;
// These fields were added in Android R.
unsigned long long dlpi_adds;
unsigned long long dlpi_subs;
size_t dlpi_tls_modid;
- void* dlpi_tls_data;
+ void* _Nullable dlpi_tls_data;
};
#if defined(__arm__)
-int dl_iterate_phdr(int (*__callback)(struct dl_phdr_info*, size_t, void*), void* __data) __INTRODUCED_IN(21);
+int dl_iterate_phdr(int (* _Nonnull __callback)(struct dl_phdr_info* _Nonnull, size_t, void* _Nullable), void* _Nullable __data) __INTRODUCED_IN(21);
#else
-int dl_iterate_phdr(int (*__callback)(struct dl_phdr_info*, size_t, void*), void* __data);
+int dl_iterate_phdr(int (* _Nonnull __callback)(struct dl_phdr_info* _Nonnull, size_t, void*_Nullable ), void* _Nullable __data);
#endif
#ifdef __arm__
typedef uintptr_t _Unwind_Ptr;
-_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr, int*);
+_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr, int* _Nonnull);
#endif
/* Used by the dynamic linker to communicate with the debugger. */
struct link_map {
ElfW(Addr) l_addr;
- char* l_name;
- ElfW(Dyn)* l_ld;
- struct link_map* l_next;
- struct link_map* l_prev;
+ char* _Nullable l_name;
+ ElfW(Dyn)* _Nullable l_ld;
+ struct link_map* _Nullable l_next;
+ struct link_map* _Nullable l_prev;
};
/* Used by the dynamic linker to communicate with the debugger. */
struct r_debug {
int32_t r_version;
- struct link_map* r_map;
+ struct link_map* _Nullable r_map;
ElfW(Addr) r_brk;
enum {
RT_CONSISTENT,
diff --git a/libc/include/locale.h b/libc/include/locale.h
index 8785b24..27f2a3f 100644
--- a/libc/include/locale.h
+++ b/libc/include/locale.h
@@ -70,16 +70,16 @@
LC_IDENTIFICATION_MASK)
struct lconv {
- char* decimal_point;
- char* thousands_sep;
- char* grouping;
- char* int_curr_symbol;
- char* currency_symbol;
- char* mon_decimal_point;
- char* mon_thousands_sep;
- char* mon_grouping;
- char* positive_sign;
- char* negative_sign;
+ char* _Nonnull decimal_point;
+ char* _Nonnull thousands_sep;
+ char* _Nonnull grouping;
+ char* _Nonnull int_curr_symbol;
+ char* _Nonnull currency_symbol;
+ char* _Nonnull mon_decimal_point;
+ char* _Nonnull mon_thousands_sep;
+ char* _Nonnull mon_grouping;
+ char* _Nonnull positive_sign;
+ char* _Nonnull negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
@@ -96,13 +96,13 @@
char int_n_sign_posn;
};
-struct lconv* localeconv(void) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
+struct lconv* _Nonnull localeconv(void) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
-locale_t duplocale(locale_t __l) __INTRODUCED_IN(21);
-void freelocale(locale_t __l) __INTRODUCED_IN(21);
-locale_t newlocale(int __category_mask, const char* __locale_name, locale_t __base) __INTRODUCED_IN(21);
-char* setlocale(int __category, const char* __locale_name);
-locale_t uselocale(locale_t __l) __INTRODUCED_IN(21);
+locale_t _Nullable duplocale(locale_t _Nonnull __l) __INTRODUCED_IN(21);
+void freelocale(locale_t _Nonnull __l) __INTRODUCED_IN(21);
+locale_t _Nullable newlocale(int __category_mask, const char* _Nonnull __locale_name, locale_t _Nullable __base) __INTRODUCED_IN(21);
+char* _Nullable setlocale(int __category, const char* _Nullable __locale_name);
+locale_t _Nullable uselocale(locale_t _Nullable __l) __INTRODUCED_IN(21);
#define LC_GLOBAL_LOCALE __BIONIC_CAST(reinterpret_cast, locale_t, -1L)
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index 40786fa..6a2d380 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -40,7 +40,7 @@
* Returns a pointer to the allocated memory on success and returns a null
* pointer and sets `errno` on failure.
*/
-void* malloc(size_t __byte_count) __mallocfunc __BIONIC_ALLOC_SIZE(1) __wur;
+void* _Nullable malloc(size_t __byte_count) __mallocfunc __BIONIC_ALLOC_SIZE(1) __wur;
/**
* [calloc(3)](http://man7.org/linux/man-pages/man3/calloc.3.html) allocates
@@ -49,7 +49,7 @@
* Returns a pointer to the allocated memory on success and returns a null
* pointer and sets `errno` on failure.
*/
-void* calloc(size_t __item_count, size_t __item_size) __mallocfunc __BIONIC_ALLOC_SIZE(1,2) __wur;
+void* _Nullable calloc(size_t __item_count, size_t __item_size) __mallocfunc __BIONIC_ALLOC_SIZE(1,2) __wur;
/**
* [realloc(3)](http://man7.org/linux/man-pages/man3/realloc.3.html) resizes
@@ -58,7 +58,7 @@
* Returns a pointer (which may be different from `__ptr`) to the resized
* memory on success and returns a null pointer and sets `errno` on failure.
*/
-void* realloc(void* __ptr, size_t __byte_count) __BIONIC_ALLOC_SIZE(2) __wur;
+void* _Nullable realloc(void* _Nullable __ptr, size_t __byte_count) __BIONIC_ALLOC_SIZE(2) __wur;
/**
* [reallocarray(3)](http://man7.org/linux/man-pages/man3/realloc.3.html) resizes
@@ -70,13 +70,13 @@
* Returns a pointer (which may be different from `__ptr`) to the resized
* memory on success and returns a null pointer and sets `errno` on failure.
*/
-void* reallocarray(void* __ptr, size_t __item_count, size_t __item_size) __BIONIC_ALLOC_SIZE(2, 3) __wur __INTRODUCED_IN(29);
+void* _Nullable reallocarray(void* _Nullable __ptr, size_t __item_count, size_t __item_size) __BIONIC_ALLOC_SIZE(2, 3) __wur __INTRODUCED_IN(29);
/**
* [free(3)](http://man7.org/linux/man-pages/man3/free.3.html) deallocates
* memory on the heap.
*/
-void free(void* __ptr);
+void free(void* _Nullable __ptr);
/**
* [memalign(3)](http://man7.org/linux/man-pages/man3/memalign.3.html) allocates
@@ -87,7 +87,7 @@
*
* See also posix_memalign().
*/
-void* memalign(size_t __alignment, size_t __byte_count) __mallocfunc __BIONIC_ALLOC_SIZE(2) __wur;
+void* _Nullable memalign(size_t __alignment, size_t __byte_count) __mallocfunc __BIONIC_ALLOC_SIZE(2) __wur;
/**
* [malloc_usable_size(3)](http://man7.org/linux/man-pages/man3/malloc_usable_size.3.html)
@@ -95,7 +95,7 @@
*
* Available since API level 17.
*/
-size_t malloc_usable_size(const void* __ptr) __INTRODUCED_IN(17);
+size_t malloc_usable_size(const void* _Nullable __ptr) __INTRODUCED_IN(17);
#define __MALLINFO_BODY \
/** Total number of non-mmapped bytes currently allocated from OS. */ \
@@ -168,7 +168,7 @@
*
* Available since API level 23.
*/
-int malloc_info(int __must_be_zero, FILE* __fp) __INTRODUCED_IN(23);
+int malloc_info(int __must_be_zero, FILE* _Nonnull __fp) __INTRODUCED_IN(23);
/**
* mallopt() option to set the decay time. Valid values are 0 and 1.
@@ -183,7 +183,15 @@
* Available since API level 28.
*/
#define M_PURGE (-101)
-
+/**
+ * mallopt() option to immediately purge all possible memory back to
+ * the kernel. This call can take longer than a normal purge since it
+ * examines everything. In some cases, it can take more than twice the
+ * time of a M_PURGE call. The value is ignored.
+ *
+ * Available since API level 34.
+ */
+#define M_PURGE_ALL (-104)
/**
* mallopt() option to tune the allocator's choice of memory tags to
@@ -329,7 +337,7 @@
*
* See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_hooks/README.md)
*/
-extern void* (*volatile __malloc_hook)(size_t __byte_count, const void* __caller) __INTRODUCED_IN(28);
+extern void* _Nonnull (*volatile _Nonnull __malloc_hook)(size_t __byte_count, const void* _Nonnull __caller) __INTRODUCED_IN(28);
/**
* [__realloc_hook(3)](http://man7.org/linux/man-pages/man3/__realloc_hook.3.html)
@@ -340,7 +348,7 @@
*
* See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_hooks/README.md)
*/
-extern void* (*volatile __realloc_hook)(void* __ptr, size_t __byte_count, const void* __caller) __INTRODUCED_IN(28);
+extern void* _Nonnull (*volatile _Nonnull __realloc_hook)(void* _Nullable __ptr, size_t __byte_count, const void* _Nonnull __caller) __INTRODUCED_IN(28);
/**
* [__free_hook(3)](http://man7.org/linux/man-pages/man3/__free_hook.3.html)
@@ -351,7 +359,7 @@
*
* See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_hooks/README.md)
*/
-extern void (*volatile __free_hook)(void* __ptr, const void* __caller) __INTRODUCED_IN(28);
+extern void (*volatile _Nonnull __free_hook)(void* _Nullable __ptr, const void* _Nonnull __caller) __INTRODUCED_IN(28);
/**
* [__memalign_hook(3)](http://man7.org/linux/man-pages/man3/__memalign_hook.3.html)
@@ -362,6 +370,6 @@
*
* See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_hooks/README.md)
*/
-extern void* (*volatile __memalign_hook)(size_t __alignment, size_t __byte_count, const void* __caller) __INTRODUCED_IN(28);
+extern void* _Nonnull (*volatile _Nonnull __memalign_hook)(size_t __alignment, size_t __byte_count, const void* _Nonnull __caller) __INTRODUCED_IN(28);
__END_DECLS
diff --git a/libc/include/math.h b/libc/include/math.h
index 040dc96..a5fa7c3 100644
--- a/libc/include/math.h
+++ b/libc/include/math.h
@@ -137,9 +137,9 @@
float expm1f(float __x);
long double expm1l(long double __x) __RENAME_LDBL(expm1, 3, 21);
-double frexp(double __x, int* __exponent);
-float frexpf(float __x, int* __exponent);
-long double frexpl(long double __x, int* __exponent) __RENAME_LDBL(frexp, 3, 21);
+double frexp(double __x, int* _Nonnull __exponent);
+float frexpf(float __x, int* _Nonnull __exponent);
+long double frexpl(long double __x, int* _Nonnull __exponent) __RENAME_LDBL(frexp, 3, 21);
int ilogb(double __x) __attribute_const__;
int ilogbf(float __x) __attribute_const__;
@@ -169,9 +169,9 @@
float logbf(float __x);
long double logbl(long double __x) __RENAME_LDBL(logb, 3, 18);
-double modf(double __x, double* __integral_part);
-float modff(float __x, float* __integral_part);
-long double modfl(long double __x, long double* __integral_part) __RENAME_LDBL(modf, 3, 21);
+double modf(double __x, double* _Nonnull __integral_part);
+float modff(float __x, float* _Nonnull __integral_part);
+long double modfl(long double __x, long double* _Nonnull __integral_part) __RENAME_LDBL(modf, 3, 21);
double scalbn(double __x, int __exponent);
float scalbnf(float __x, int __exponent);
@@ -266,17 +266,17 @@
float remainderf(float __x, float __y);
long double remainderl(long double __x, long double __y) __RENAME_LDBL(remainder, 3, 21);
-double remquo(double __x, double __y, int* __quotient_bits);
-float remquof(float __x, float __y, int* __quotient_bits);
-long double remquol(long double __x, long double __y, int* __quotient_bits) __RENAME_LDBL(remquo, 3, 21);
+double remquo(double __x, double __y, int* _Nonnull __quotient_bits);
+float remquof(float __x, float __y, int* _Nonnull __quotient_bits);
+long double remquol(long double __x, long double __y, int* _Nonnull __quotient_bits) __RENAME_LDBL(remquo, 3, 21);
double copysign(double __value, double __sign) __attribute_const__;
float copysignf(float __value, float __sign) __attribute_const__;
long double copysignl(long double __value, long double __sign) __RENAME_LDBL(copysign, 3, 3) __attribute_const__;
-double nan(const char* __kind) __attribute_const__;
-float nanf(const char* __kind) __attribute_const__;
-long double nanl(const char* __kind) __RENAME_LDBL(nan, 13, 13) __attribute_const__;
+double nan(const char* _Nonnull __kind) __attribute_const__;
+float nanf(const char* _Nonnull __kind) __attribute_const__;
+long double nanl(const char* _Nonnull __kind) __RENAME_LDBL(nan, 13, 13) __attribute_const__;
double nextafter(double __x, double __y);
float nextafterf(float __x, float __y);
@@ -364,10 +364,10 @@
double drem(double __x, double __y);
int finite(double __x) __attribute_const__;
int isnanf(float __x) __attribute_const__;
-double gamma_r(double __x, int* __sign);
-double lgamma_r(double __x, int* __sign);
+double gamma_r(double __x, int* _Nonnull __sign);
+double lgamma_r(double __x, int* _Nonnull __sign);
double significand(double __x);
-long double lgammal_r(long double __x, int* __sign) __INTRODUCED_IN(23);
+long double lgammal_r(long double __x, int* _Nonnull __sign) __INTRODUCED_IN(23);
long double significandl(long double __x) __INTRODUCED_IN(21);
float dremf(float __x, float __y);
int finitef(float __x) __attribute_const__;
@@ -379,12 +379,12 @@
float y0f(float __x);
float y1f(float __x);
float ynf(int __n, float __x);
-float gammaf_r(float __x, int* __sign);
-float lgammaf_r(float __x, int* __sign);
+float gammaf_r(float __x, int* _Nonnull __sign);
+float lgammaf_r(float __x, int* _Nonnull __sign);
float significandf(float __x);
-void sincos(double __x, double* __sin, double* __cos);
-void sincosf(float __x, float* __sin, float* __cos);
-void sincosl(long double __x, long double* __sin, long double* __cos);
+void sincos(double __x, double* _Nonnull __sin, double* _Nonnull __cos);
+void sincosf(float __x, float* _Nonnull __sin, float* _Nonnull __cos);
+void sincosl(long double __x, long double* _Nonnull __sin, long double* _Nonnull __cos);
#endif
/* GNU extensions. */
diff --git a/libc/include/mntent.h b/libc/include/mntent.h
index d5987dc..43cab1f 100644
--- a/libc/include/mntent.h
+++ b/libc/include/mntent.h
@@ -47,21 +47,21 @@
#define MNTOPT_SUID "suid"
struct mntent {
- char* mnt_fsname;
- char* mnt_dir;
- char* mnt_type;
- char* mnt_opts;
+ char* _Nullable mnt_fsname;
+ char* _Nullable mnt_dir;
+ char* _Nullable mnt_type;
+ char* _Nullable mnt_opts;
int mnt_freq;
int mnt_passno;
};
__BEGIN_DECLS
-int endmntent(FILE* __fp) __INTRODUCED_IN(21);
-struct mntent* getmntent(FILE* __fp);
-struct mntent* getmntent_r(FILE* __fp, struct mntent* __entry, char* __buf, int __size) __INTRODUCED_IN(21);
-FILE* setmntent(const char* __filename, const char* __type) __INTRODUCED_IN(21);
-char* hasmntopt(const struct mntent* __entry, const char* __option) __INTRODUCED_IN(26);
+int endmntent(FILE* _Nullable __fp) __INTRODUCED_IN(21);
+struct mntent* _Nullable getmntent(FILE* _Nonnull __fp);
+struct mntent* _Nullable getmntent_r(FILE* _Nonnull __fp, struct mntent* _Nonnull __entry, char* _Nonnull __buf, int __size) __INTRODUCED_IN(21);
+FILE* _Nullable setmntent(const char* _Nonnull __filename, const char* _Nonnull __type) __INTRODUCED_IN(21);
+char* _Nullable hasmntopt(const struct mntent* _Nonnull __entry, const char* _Nonnull __option) __INTRODUCED_IN(26);
__END_DECLS
diff --git a/libc/include/nl_types.h b/libc/include/nl_types.h
index 1c80e4e..f4d7f43 100644
--- a/libc/include/nl_types.h
+++ b/libc/include/nl_types.h
@@ -62,7 +62,7 @@
*
* Available since API level 28.
*/
-nl_catd catopen(const char* __name, int __flag) __INTRODUCED_IN(26);
+nl_catd _Nonnull catopen(const char* _Nonnull __name, int __flag) __INTRODUCED_IN(26);
/**
* [catgets(3)](http://man7.org/linux/man-pages/man3/catgets.3.html) translates the given message
@@ -72,13 +72,13 @@
*
* Available since API level 28.
*/
-char* catgets(nl_catd __catalog, int __set_number, int __msg_number, const char* __msg) __INTRODUCED_IN(26);
+char* _Nonnull catgets(nl_catd _Nonnull __catalog, int __set_number, int __msg_number, const char* _Nonnull __msg) __INTRODUCED_IN(26);
/**
* [catclose(3)](http://man7.org/linux/man-pages/man3/catclose.3.html) closes a message catalog.
*
* On Android, this always returns -1 with `errno` set to `EBADF`.
*/
-int catclose(nl_catd __catalog) __INTRODUCED_IN(26);
+int catclose(nl_catd _Nonnull __catalog) __INTRODUCED_IN(26);
__END_DECLS
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 8bc897a..98695eb 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -26,8 +26,12 @@
* SUCH DAMAGE.
*/
-#ifndef _PTHREAD_H_
-#define _PTHREAD_H_
+#pragma once
+
+/**
+ * @file pthread.h
+ * @brief POSIX threads.
+ */
#include <limits.h>
#include <bits/pthread_types.h>
@@ -54,9 +58,7 @@
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP { { ((PTHREAD_MUTEX_ERRORCHECK & 3) << 14) } }
#define PTHREAD_COND_INITIALIZER { { 0 } }
-#if __ANDROID_API__ >= 21
#define PTHREAD_COND_INITIALIZER_MONOTONIC_NP { { 1 << 1 } }
-#endif
#define PTHREAD_RWLOCK_INITIALIZER { { 0 } }
@@ -92,41 +94,41 @@
#define PTHREAD_SCOPE_SYSTEM 0
#define PTHREAD_SCOPE_PROCESS 1
-int pthread_atfork(void (*__prepare)(void), void (*__parent)(void), void (*__child)(void));
+int pthread_atfork(void (* _Nullable __prepare)(void), void (* _Nullable __parent)(void), void (* _Nullable __child)(void));
-int pthread_attr_destroy(pthread_attr_t* __attr);
-int pthread_attr_getdetachstate(const pthread_attr_t* __attr, int* __state);
-int pthread_attr_getguardsize(const pthread_attr_t* __attr, size_t* __size);
-int pthread_attr_getinheritsched(const pthread_attr_t* __attr, int* __flag) __INTRODUCED_IN(28);
-int pthread_attr_getschedparam(const pthread_attr_t* __attr, struct sched_param* __param);
-int pthread_attr_getschedpolicy(const pthread_attr_t* __attr, int* __policy);
-int pthread_attr_getscope(const pthread_attr_t* __attr, int* __scope);
-int pthread_attr_getstack(const pthread_attr_t* __attr, void** __addr, size_t* __size);
-int pthread_attr_getstacksize(const pthread_attr_t* __attr, size_t* __size);
-int pthread_attr_init(pthread_attr_t* __attr);
-int pthread_attr_setdetachstate(pthread_attr_t* __attr, int __state);
-int pthread_attr_setguardsize(pthread_attr_t* __attr, size_t __size);
-int pthread_attr_setinheritsched(pthread_attr_t* __attr, int __flag) __INTRODUCED_IN(28);
-int pthread_attr_setschedparam(pthread_attr_t* __attr, const struct sched_param* __param);
-int pthread_attr_setschedpolicy(pthread_attr_t* __attr, int __policy);
-int pthread_attr_setscope(pthread_attr_t* __attr, int __scope);
-int pthread_attr_setstack(pthread_attr_t* __attr, void* __addr, size_t __size);
-int pthread_attr_setstacksize(pthread_attr_t* __addr, size_t __size);
+int pthread_attr_destroy(pthread_attr_t* _Nonnull __attr);
+int pthread_attr_getdetachstate(const pthread_attr_t* _Nonnull __attr, int* _Nonnull __state);
+int pthread_attr_getguardsize(const pthread_attr_t* _Nonnull __attr, size_t* _Nonnull __size);
+int pthread_attr_getinheritsched(const pthread_attr_t* _Nonnull __attr, int* _Nonnull __flag) __INTRODUCED_IN(28);
+int pthread_attr_getschedparam(const pthread_attr_t* _Nonnull __attr, struct sched_param* _Nonnull __param);
+int pthread_attr_getschedpolicy(const pthread_attr_t* _Nonnull __attr, int* _Nonnull __policy);
+int pthread_attr_getscope(const pthread_attr_t* _Nonnull __attr, int* _Nonnull __scope);
+int pthread_attr_getstack(const pthread_attr_t* _Nonnull __attr, void* _Nullable * _Nonnull __addr, size_t* _Nonnull __size);
+int pthread_attr_getstacksize(const pthread_attr_t* _Nonnull __attr, size_t* _Nonnull __size);
+int pthread_attr_init(pthread_attr_t* _Nonnull __attr);
+int pthread_attr_setdetachstate(pthread_attr_t* _Nonnull __attr, int __state);
+int pthread_attr_setguardsize(pthread_attr_t* _Nonnull __attr, size_t __size);
+int pthread_attr_setinheritsched(pthread_attr_t* _Nonnull __attr, int __flag) __INTRODUCED_IN(28);
+int pthread_attr_setschedparam(pthread_attr_t* _Nonnull __attr, const struct sched_param* _Nonnull __param);
+int pthread_attr_setschedpolicy(pthread_attr_t* _Nonnull __attr, int __policy);
+int pthread_attr_setscope(pthread_attr_t* _Nonnull __attr, int __scope);
+int pthread_attr_setstack(pthread_attr_t* _Nonnull __attr, void* _Nonnull __addr, size_t __size);
+int pthread_attr_setstacksize(pthread_attr_t* _Nonnull __addr, size_t __size);
-int pthread_condattr_destroy(pthread_condattr_t* __attr);
-int pthread_condattr_getclock(const pthread_condattr_t* __attr, clockid_t* __clock) __INTRODUCED_IN(21);
-int pthread_condattr_getpshared(const pthread_condattr_t* __attr, int* __shared);
-int pthread_condattr_init(pthread_condattr_t* __attr);
-int pthread_condattr_setclock(pthread_condattr_t* __attr, clockid_t __clock) __INTRODUCED_IN(21);
-int pthread_condattr_setpshared(pthread_condattr_t* __attr, int __shared);
+int pthread_condattr_destroy(pthread_condattr_t* _Nonnull __attr);
+int pthread_condattr_getclock(const pthread_condattr_t* _Nonnull __attr, clockid_t* _Nonnull __clock) __INTRODUCED_IN(21);
+int pthread_condattr_getpshared(const pthread_condattr_t* _Nonnull __attr, int* _Nonnull __shared);
+int pthread_condattr_init(pthread_condattr_t* _Nonnull __attr);
+int pthread_condattr_setclock(pthread_condattr_t* _Nonnull __attr, clockid_t __clock) __INTRODUCED_IN(21);
+int pthread_condattr_setpshared(pthread_condattr_t* _Nonnull __attr, int __shared);
-int pthread_cond_broadcast(pthread_cond_t* __cond);
-int pthread_cond_clockwait(pthread_cond_t* __cond, pthread_mutex_t* __mutex, clockid_t __clock,
- const struct timespec* __timeout) __INTRODUCED_IN(30);
-int pthread_cond_destroy(pthread_cond_t* __cond);
-int pthread_cond_init(pthread_cond_t* __cond, const pthread_condattr_t* __attr);
-int pthread_cond_signal(pthread_cond_t* __cond);
-int pthread_cond_timedwait(pthread_cond_t* __cond, pthread_mutex_t* __mutex, const struct timespec* __timeout);
+int pthread_cond_broadcast(pthread_cond_t* _Nonnull __cond);
+int pthread_cond_clockwait(pthread_cond_t* _Nonnull __cond, pthread_mutex_t* _Nonnull __mutex, clockid_t __clock,
+ const struct timespec* _Nullable __timeout) __INTRODUCED_IN(30);
+int pthread_cond_destroy(pthread_cond_t* _Nonnull __cond);
+int pthread_cond_init(pthread_cond_t* _Nonnull __cond, const pthread_condattr_t* _Nullable __attr);
+int pthread_cond_signal(pthread_cond_t* _Nonnull __cond);
+int pthread_cond_timedwait(pthread_cond_t* _Nonnull __cond, pthread_mutex_t* _Nonnull __mutex, const struct timespec* _Nullable __timeout);
/*
* Condition variables use CLOCK_REALTIME by default for their timeouts, however that is
* typically inappropriate, since that clock can change dramatically, causing the timeout to
@@ -137,9 +139,9 @@
* Note that pthread_cond_clockwait() allows specifying an arbitrary clock and has superseded this
* function.
*/
-int pthread_cond_timedwait_monotonic_np(pthread_cond_t* __cond, pthread_mutex_t* __mutex,
- const struct timespec* __timeout) __INTRODUCED_IN_64(28);
-int pthread_cond_wait(pthread_cond_t* __cond, pthread_mutex_t* __mutex);
+int pthread_cond_timedwait_monotonic_np(pthread_cond_t* _Nonnull __cond, pthread_mutex_t* _Nonnull __mutex,
+ const struct timespec* _Nullable __timeout) __INTRODUCED_IN_64(28);
+int pthread_cond_wait(pthread_cond_t* _Nonnull __cond, pthread_mutex_t* _Nonnull __mutex);
#if defined(__clang__)
/*
@@ -151,46 +153,44 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbuiltin-requires-header"
#endif
-int pthread_create(pthread_t* __pthread_ptr, pthread_attr_t const* __attr, void* (*__start_routine)(void*), void*);
+int pthread_create(pthread_t* _Nonnull __pthread_ptr, pthread_attr_t const* _Nullable __attr, void* _Nonnull (* _Nonnull __start_routine)(void* _Nonnull), void* _Nullable);
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
int pthread_detach(pthread_t __pthread);
-void pthread_exit(void* __return_value) __noreturn;
+void pthread_exit(void* _Nullable __return_value) __noreturn;
int pthread_equal(pthread_t __lhs, pthread_t __rhs);
-int pthread_getattr_np(pthread_t __pthread, pthread_attr_t* __attr);
+int pthread_getattr_np(pthread_t __pthread, pthread_attr_t* _Nonnull __attr);
-int pthread_getcpuclockid(pthread_t __pthread, clockid_t* __clock);
+int pthread_getcpuclockid(pthread_t __pthread, clockid_t* _Nonnull __clock);
-int pthread_getschedparam(pthread_t __pthread, int* __policy, struct sched_param* __param);
-
-void* pthread_getspecific(pthread_key_t __key);
+void* _Nullable pthread_getspecific(pthread_key_t __key);
pid_t pthread_gettid_np(pthread_t __pthread) __INTRODUCED_IN(21);
-int pthread_join(pthread_t __pthread, void** __return_value_ptr);
+int pthread_join(pthread_t __pthread, void* _Nullable * _Nullable __return_value_ptr);
-int pthread_key_create(pthread_key_t* __key_ptr, void (*__key_destructor)(void*));
+int pthread_key_create(pthread_key_t* _Nonnull __key_ptr, void (* _Nullable __key_destructor)(void* _Nullable));
int pthread_key_delete(pthread_key_t __key);
-int pthread_mutexattr_destroy(pthread_mutexattr_t* __attr);
-int pthread_mutexattr_getpshared(const pthread_mutexattr_t* __attr, int* __shared);
-int pthread_mutexattr_gettype(const pthread_mutexattr_t* __attr, int* __type);
-int pthread_mutexattr_getprotocol(const pthread_mutexattr_t* __attr, int* __protocol) __INTRODUCED_IN(28);
-int pthread_mutexattr_init(pthread_mutexattr_t* __attr);
-int pthread_mutexattr_setpshared(pthread_mutexattr_t* __attr, int __shared);
-int pthread_mutexattr_settype(pthread_mutexattr_t* __attr, int __type);
-int pthread_mutexattr_setprotocol(pthread_mutexattr_t* __attr, int __protocol) __INTRODUCED_IN(28);
+int pthread_mutexattr_destroy(pthread_mutexattr_t* _Nonnull __attr);
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t* _Nonnull __attr, int* _Nonnull __shared);
+int pthread_mutexattr_gettype(const pthread_mutexattr_t* _Nonnull __attr, int* _Nonnull __type);
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t* _Nonnull __attr, int* _Nonnull __protocol) __INTRODUCED_IN(28);
+int pthread_mutexattr_init(pthread_mutexattr_t* _Nonnull __attr);
+int pthread_mutexattr_setpshared(pthread_mutexattr_t* _Nonnull __attr, int __shared);
+int pthread_mutexattr_settype(pthread_mutexattr_t* _Nonnull __attr, int __type);
+int pthread_mutexattr_setprotocol(pthread_mutexattr_t* _Nonnull __attr, int __protocol) __INTRODUCED_IN(28);
-int pthread_mutex_clocklock(pthread_mutex_t* __mutex, clockid_t __clock,
- const struct timespec* __abstime) __INTRODUCED_IN(30);
-int pthread_mutex_destroy(pthread_mutex_t* __mutex);
-int pthread_mutex_init(pthread_mutex_t* __mutex, const pthread_mutexattr_t* __attr);
-int pthread_mutex_lock(pthread_mutex_t* __mutex);
-int pthread_mutex_timedlock(pthread_mutex_t* __mutex, const struct timespec* __timeout)
+int pthread_mutex_clocklock(pthread_mutex_t* _Nonnull __mutex, clockid_t __clock,
+ const struct timespec* _Nullable __abstime) __INTRODUCED_IN(30);
+int pthread_mutex_destroy(pthread_mutex_t* _Nonnull __mutex);
+int pthread_mutex_init(pthread_mutex_t* _Nonnull __mutex, const pthread_mutexattr_t* _Nullable __attr);
+int pthread_mutex_lock(pthread_mutex_t* _Nonnull __mutex);
+int pthread_mutex_timedlock(pthread_mutex_t* _Nonnull __mutex, const struct timespec* _Nullable __timeout)
__INTRODUCED_IN(21);
/*
@@ -202,102 +202,118 @@
* Note that pthread_mutex_clocklock() allows specifying an arbitrary clock and has superseded this
* function.
*/
-int pthread_mutex_timedlock_monotonic_np(pthread_mutex_t* __mutex, const struct timespec* __timeout)
+int pthread_mutex_timedlock_monotonic_np(pthread_mutex_t* _Nonnull __mutex, const struct timespec* _Nullable __timeout)
__INTRODUCED_IN(28);
-int pthread_mutex_trylock(pthread_mutex_t* __mutex);
-int pthread_mutex_unlock(pthread_mutex_t* __mutex);
+int pthread_mutex_trylock(pthread_mutex_t* _Nonnull __mutex);
+int pthread_mutex_unlock(pthread_mutex_t* _Nonnull __mutex);
-#if __ANDROID_API__ < 21
-/*
- * Cruft for supporting old API levels. Pre-L we didn't have the proper POSIX
- * APIs for things, but instead had some locally grown, artisan equivalents.
- * Keep exposing the old prototypes on old API levels so we don't regress
- * functionality.
- *
- * See the following bugs:
- * * https://github.com/android-ndk/ndk/issues/420
- * * https://github.com/android-ndk/ndk/issues/423
- * * https://stackoverflow.com/q/44580542/632035
- */
-int pthread_mutex_lock_timeout_np(pthread_mutex_t* __mutex, unsigned __timeout_ms);
-int pthread_cond_timeout_np(pthread_cond_t* __cond, pthread_mutex_t* __mutex, unsigned __timeout_ms);
-int pthread_cond_timedwait_relative_np(pthread_cond_t* __cond, pthread_mutex_t* __mutex, const struct timespec* __relative_timeout);
-#endif
+int pthread_once(pthread_once_t* _Nonnull __once, void (* _Nonnull __init_routine)(void));
-int pthread_once(pthread_once_t* __once, void (*__init_routine)(void));
-
-int pthread_rwlockattr_init(pthread_rwlockattr_t* __attr);
-int pthread_rwlockattr_destroy(pthread_rwlockattr_t* __attr);
-int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __attr, int* __shared);
-int pthread_rwlockattr_setpshared(pthread_rwlockattr_t* __attr, int __shared);
-int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t* __attr, int* __kind)
+int pthread_rwlockattr_init(pthread_rwlockattr_t* _Nonnull __attr);
+int pthread_rwlockattr_destroy(pthread_rwlockattr_t* _Nonnull __attr);
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* _Nonnull __attr, int* _Nonnull __shared);
+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t* _Nonnull __attr, int __shared);
+int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t* _Nonnull __attr, int* _Nonnull __kind)
__INTRODUCED_IN(23);
-int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t* __attr, int __kind) __INTRODUCED_IN(23);
+int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t* _Nonnull __attr, int __kind) __INTRODUCED_IN(23);
-int pthread_rwlock_clockrdlock(pthread_rwlock_t* __rwlock, clockid_t __clock,
- const struct timespec* __timeout) __INTRODUCED_IN(30);
-int pthread_rwlock_clockwrlock(pthread_rwlock_t* __rwlock, clockid_t __clock,
- const struct timespec* __timeout) __INTRODUCED_IN(30);
-int pthread_rwlock_destroy(pthread_rwlock_t* __rwlock);
-int pthread_rwlock_init(pthread_rwlock_t* __rwlock, const pthread_rwlockattr_t* __attr);
-int pthread_rwlock_rdlock(pthread_rwlock_t* __rwlock);
-int pthread_rwlock_timedrdlock(pthread_rwlock_t* __rwlock, const struct timespec* __timeout);
+int pthread_rwlock_clockrdlock(pthread_rwlock_t* _Nonnull __rwlock, clockid_t __clock,
+ const struct timespec* _Nullable __timeout) __INTRODUCED_IN(30);
+int pthread_rwlock_clockwrlock(pthread_rwlock_t* _Nonnull __rwlock, clockid_t __clock,
+ const struct timespec* _Nullable __timeout) __INTRODUCED_IN(30);
+int pthread_rwlock_destroy(pthread_rwlock_t* _Nonnull __rwlock);
+int pthread_rwlock_init(pthread_rwlock_t* _Nonnull __rwlock, const pthread_rwlockattr_t* _Nullable __attr);
+int pthread_rwlock_rdlock(pthread_rwlock_t* _Nonnull __rwlock);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t* _Nonnull __rwlock, const struct timespec* _Nullable __timeout);
/* See the comment on pthread_mutex_timedlock_monotonic_np for usage of this function. */
-int pthread_rwlock_timedrdlock_monotonic_np(pthread_rwlock_t* __rwlock,
- const struct timespec* __timeout) __INTRODUCED_IN(28);
-int pthread_rwlock_timedwrlock(pthread_rwlock_t* __rwlock, const struct timespec* __timeout);
+int pthread_rwlock_timedrdlock_monotonic_np(pthread_rwlock_t* _Nonnull __rwlock,
+ const struct timespec* _Nullable __timeout) __INTRODUCED_IN(28);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t* _Nonnull __rwlock, const struct timespec* _Nullable __timeout);
/* See the comment on pthread_mutex_timedlock_monotonic_np for usage of this function. */
-int pthread_rwlock_timedwrlock_monotonic_np(pthread_rwlock_t* __rwlock,
- const struct timespec* __timeout) __INTRODUCED_IN(28);
-int pthread_rwlock_tryrdlock(pthread_rwlock_t* __rwlock);
-int pthread_rwlock_trywrlock(pthread_rwlock_t* __rwlock);
-int pthread_rwlock_unlock(pthread_rwlock_t* __rwlock);
-int pthread_rwlock_wrlock(pthread_rwlock_t* __rwlock);
+int pthread_rwlock_timedwrlock_monotonic_np(pthread_rwlock_t* _Nonnull __rwlock,
+ const struct timespec* _Nullable __timeout) __INTRODUCED_IN(28);
+int pthread_rwlock_tryrdlock(pthread_rwlock_t* _Nonnull __rwlock);
+int pthread_rwlock_trywrlock(pthread_rwlock_t* _Nonnull __rwlock);
+int pthread_rwlock_unlock(pthread_rwlock_t* _Nonnull __rwlock);
+int pthread_rwlock_wrlock(pthread_rwlock_t* _Nonnull __rwlock);
#if __ANDROID_API__ >= 24
-int pthread_barrierattr_init(pthread_barrierattr_t* __attr) __INTRODUCED_IN(24);
-int pthread_barrierattr_destroy(pthread_barrierattr_t* __attr) __INTRODUCED_IN(24);
-int pthread_barrierattr_getpshared(const pthread_barrierattr_t* __attr, int* __shared) __INTRODUCED_IN(24);
-int pthread_barrierattr_setpshared(pthread_barrierattr_t* __attr, int __shared) __INTRODUCED_IN(24);
+int pthread_barrierattr_init(pthread_barrierattr_t* _Nonnull __attr) __INTRODUCED_IN(24);
+int pthread_barrierattr_destroy(pthread_barrierattr_t* _Nonnull __attr) __INTRODUCED_IN(24);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t* _Nonnull __attr, int* _Nonnull __shared) __INTRODUCED_IN(24);
+int pthread_barrierattr_setpshared(pthread_barrierattr_t* _Nonnull __attr, int __shared) __INTRODUCED_IN(24);
#endif
#if __ANDROID_API__ >= 24
-int pthread_barrier_init(pthread_barrier_t* __barrier, const pthread_barrierattr_t* __attr, unsigned __count) __INTRODUCED_IN(24);
-int pthread_barrier_destroy(pthread_barrier_t* __barrier) __INTRODUCED_IN(24);
-int pthread_barrier_wait(pthread_barrier_t* __barrier) __INTRODUCED_IN(24);
+int pthread_barrier_init(pthread_barrier_t* _Nonnull __barrier, const pthread_barrierattr_t* _Nullable __attr, unsigned __count) __INTRODUCED_IN(24);
+int pthread_barrier_destroy(pthread_barrier_t* _Nonnull __barrier) __INTRODUCED_IN(24);
+int pthread_barrier_wait(pthread_barrier_t* _Nonnull __barrier) __INTRODUCED_IN(24);
#endif
#if __ANDROID_API__ >= 24
-int pthread_spin_destroy(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
-int pthread_spin_init(pthread_spinlock_t* __spinlock, int __shared) __INTRODUCED_IN(24);
-int pthread_spin_lock(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
-int pthread_spin_trylock(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
-int pthread_spin_unlock(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
+int pthread_spin_destroy(pthread_spinlock_t* _Nonnull __spinlock) __INTRODUCED_IN(24);
+int pthread_spin_init(pthread_spinlock_t* _Nonnull __spinlock, int __shared) __INTRODUCED_IN(24);
+int pthread_spin_lock(pthread_spinlock_t* _Nonnull __spinlock) __INTRODUCED_IN(24);
+int pthread_spin_trylock(pthread_spinlock_t* _Nonnull __spinlock) __INTRODUCED_IN(24);
+int pthread_spin_unlock(pthread_spinlock_t* _Nonnull __spinlock) __INTRODUCED_IN(24);
#endif
pthread_t pthread_self(void) __attribute_const__;
#if defined(__USE_GNU)
-int pthread_getname_np(pthread_t __pthread, char* __buf, size_t __n) __INTRODUCED_IN(26);
+int pthread_getname_np(pthread_t __pthread, char* _Nonnull __buf, size_t __n) __INTRODUCED_IN(26);
#endif
/* TODO: this should be __USE_GNU too. */
-int pthread_setname_np(pthread_t __pthread, const char* __name);
+int pthread_setname_np(pthread_t __pthread, const char* _Nonnull __name);
-int pthread_setschedparam(pthread_t __pthread, int __policy, const struct sched_param* __param);
+/**
+ * [pthread_setschedparam(3)](https://man7.org/linux/man-pages/man3/pthread_setschedparam.3.html)
+ * sets the scheduler policy and parameters of the given thread.
+ *
+ * This call is not useful to applications on Android, because they don't
+ * have permission to set their scheduling policy, and the only priority
+ * for their policy is 0 anyway. If you only need to set your scheduling
+ * priority, see setpriority() instead.
+ *
+ * Returns 0 on success and returns an error number on failure.
+ */
+int pthread_setschedparam(pthread_t __pthread, int __policy, const struct sched_param* _Nonnull __param);
+
+/**
+ * [pthread_getschedparam(3)](https://man7.org/linux/man-pages/man3/pthread_getschedparam.3.html)
+ * gets the scheduler policy and parameters of the given thread.
+ *
+ * Returns 0 on success and returns an error number on failure.
+ */
+int pthread_getschedparam(pthread_t __pthread, int* _Nonnull __policy, struct sched_param* _Nonnull __param);
+
+/**
+ * [pthread_setschedprio(3)](https://man7.org/linux/man-pages/man3/pthread_setschedprio.3.html)
+ * sets the scheduler priority of the given thread.
+ *
+ * This call is not useful to applications on Android, because they don't
+ * have permission to set their scheduling policy, and the only priority
+ * for their policy is 0 anyway. If you only need to set your scheduling
+ * priority, see setpriority() instead.
+ *
+ * Returns 0 on success and returns an error number on failure.
+ *
+ * Available since API level 28.
+ */
int pthread_setschedprio(pthread_t __pthread, int __priority) __INTRODUCED_IN(28);
-int pthread_setspecific(pthread_key_t __key, const void* __value);
+int pthread_setspecific(pthread_key_t __key, const void* _Nullable __value);
-typedef void (*__pthread_cleanup_func_t)(void*);
+typedef void (* _Nullable __pthread_cleanup_func_t)(void* _Nullable);
typedef struct __pthread_cleanup_t {
- struct __pthread_cleanup_t* __cleanup_prev;
- __pthread_cleanup_func_t __cleanup_routine;
- void* __cleanup_arg;
+ struct __pthread_cleanup_t* _Nullable __cleanup_prev;
+ __pthread_cleanup_func_t _Nullable __cleanup_routine;
+ void* _Nullable __cleanup_arg;
} __pthread_cleanup_t;
-void __pthread_cleanup_push(__pthread_cleanup_t* c, __pthread_cleanup_func_t, void*);
-void __pthread_cleanup_pop(__pthread_cleanup_t*, int);
+void __pthread_cleanup_push(__pthread_cleanup_t* _Nonnull c, __pthread_cleanup_func_t _Nullable, void* _Nullable);
+void __pthread_cleanup_pop(__pthread_cleanup_t* _Nonnull, int);
/* Believe or not, the definitions of pthread_cleanup_push and
* pthread_cleanup_pop below are correct. Posix states that these
@@ -315,5 +331,3 @@
} while (0); \
__END_DECLS
-
-#endif
diff --git a/libc/include/pwd.h b/libc/include/pwd.h
index d481aac..2b17fbf 100644
--- a/libc/include/pwd.h
+++ b/libc/include/pwd.h
@@ -66,31 +66,31 @@
__BEGIN_DECLS
struct passwd {
- char* pw_name;
- char* pw_passwd;
+ char* _Nullable pw_name;
+ char* _Nullable pw_passwd;
uid_t pw_uid;
gid_t pw_gid;
#ifdef __LP64__
- char* pw_gecos;
+ char* _Nullable pw_gecos;
#else
/* Note: On LP32, we define pw_gecos to pw_passwd since they're both NULL. */
# define pw_gecos pw_passwd
#endif
- char* pw_dir;
- char* pw_shell;
+ char* _Nullable pw_dir;
+ char* _Nullable pw_shell;
};
-struct passwd* getpwnam(const char* __name);
-struct passwd* getpwuid(uid_t __uid);
+struct passwd* _Nullable getpwnam(const char* _Nonnull __name);
+struct passwd* _Nullable getpwuid(uid_t __uid);
/* Note: Android has thousands and thousands of ids to iterate through */
-struct passwd* getpwent(void) __INTRODUCED_IN(26);
+struct passwd* _Nullable getpwent(void) __INTRODUCED_IN(26);
void setpwent(void) __INTRODUCED_IN(26);
void endpwent(void) __INTRODUCED_IN(26);
-int getpwnam_r(const char* __name, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result);
-int getpwuid_r(uid_t __uid, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result);
+int getpwnam_r(const char* _Nonnull __name, struct passwd* _Nonnull __pwd, char* _Nonnull __buf, size_t __n, struct passwd* _Nullable * _Nonnull __result);
+int getpwuid_r(uid_t __uid, struct passwd* _Nonnull __pwd, char* _Nonnull __buf, size_t __n, struct passwd* _Nullable * _Nonnull __result);
__END_DECLS
diff --git a/libc/include/regex.h b/libc/include/regex.h
index c4cc39c..be33819 100644
--- a/libc/include/regex.h
+++ b/libc/include/regex.h
@@ -49,8 +49,8 @@
typedef struct {
int re_magic;
size_t re_nsub; /* number of parenthesized subexpressions */
- const char *re_endp; /* end pointer for REG_PEND */
- struct re_guts *re_g; /* none of your business :-) */
+ const char * __BIONIC_COMPLICATED_NULLNESS re_endp; /* end pointer for REG_PEND */
+ struct re_guts * __BIONIC_COMPLICATED_NULLNESS re_g; /* none of your business :-) */
} regex_t;
typedef struct {
@@ -67,6 +67,7 @@
#define REG_NOSPEC 0020
#define REG_PEND 0040
#define REG_DUMP 0200
+#define REG_GNU 0400
/* regerror() flags */
#define REG_NOMATCH 1
@@ -85,6 +86,7 @@
#define REG_EMPTY 14
#define REG_ASSERT 15
#define REG_INVARG 16
+#define REG_ILLSEQ 17
#define REG_ATOI 255 /* convert name to number (!) */
#define REG_ITOA 0400 /* convert number to name (!) */
@@ -97,10 +99,10 @@
#define REG_BACKR 02000 /* force use of backref code */
__BEGIN_DECLS
-int regcomp(regex_t* __re, const char* __regex, int __flags);
-size_t regerror(int __error_code, const regex_t* __re, char* __buf, size_t __n);
-int regexec(const regex_t* __re, const char* __s, size_t __match_count, regmatch_t __matches[], int __flags);
-void regfree(regex_t* __re);
+int regcomp(regex_t* _Nonnull __re, const char* _Nonnull __regex, int __flags);
+size_t regerror(int __error_code, const regex_t* _Nullable __re, char* _Nullable __buf, size_t __n);
+int regexec(const regex_t* _Nonnull __re, const char* _Nonnull __s, size_t __match_count, regmatch_t __matches[_Nullable], int __flags);
+void regfree(regex_t* _Nonnull __re);
__END_DECLS
#endif
diff --git a/libc/include/resolv.h b/libc/include/resolv.h
index 6318d00..f25484a 100644
--- a/libc/include/resolv.h
+++ b/libc/include/resolv.h
@@ -40,24 +40,24 @@
__BEGIN_DECLS
#define b64_ntop __b64_ntop
-int b64_ntop(u_char const* __src, size_t __src_size, char* __dst, size_t __dst_size);
+int b64_ntop(u_char const* _Nonnull __src, size_t __src_size, char* _Nonnull __dst, size_t __dst_size);
#define b64_pton __b64_pton
-int b64_pton(char const* __src, u_char* __dst, size_t __dst_size);
+int b64_pton(char const* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size);
#define dn_comp __dn_comp
-int dn_comp(const char* __src, u_char* __dst, int __dst_size, u_char** __dn_ptrs , u_char** __last_dn_ptr);
+int dn_comp(const char* _Nonnull __src, u_char* _Nonnull __dst, int __dst_size, u_char* _Nullable * _Nullable __dn_ptrs , u_char* _Nullable * _Nullable __last_dn_ptr);
-int dn_expand(const u_char* __msg, const u_char* __eom, const u_char* __src, char* __dst, int __dst_size);
+int dn_expand(const u_char* _Nonnull __msg, const u_char* _Nonnull __eom, const u_char* _Nonnull __src, char* _Nonnull __dst, int __dst_size);
#define p_class __p_class
-const char* p_class(int __class);
+const char* _Nonnull p_class(int __class);
#define p_type __p_type
-const char* p_type(int __type);
+const char* _Nonnull p_type(int __type);
int res_init(void);
-int res_mkquery(int __opcode, const char* __domain_name, int __class, int __type, const u_char* __data, int __data_size, const u_char* __new_rr_in, u_char* __buf, int __buf_size);
-int res_query(const char* __name, int __class, int __type, u_char* __answer, int __answer_size);
-int res_search(const char* __name, int __class, int __type, u_char* __answer, int __answer_size);
+int res_mkquery(int __opcode, const char* _Nonnull __domain_name, int __class, int __type, const u_char* _Nullable __data, int __data_size, const u_char* _Nullable __new_rr_in, u_char* _Nonnull __buf, int __buf_size);
+int res_query(const char* _Nonnull __name, int __class, int __type, u_char* _Nonnull __answer, int __answer_size);
+int res_search(const char* _Nonnull __name, int __class, int __type, u_char* _Nonnull __answer, int __answer_size);
#define res_randomid __res_randomid
u_int __res_randomid(void) __INTRODUCED_IN(29);
diff --git a/libc/include/sched.h b/libc/include/sched.h
index 364ca10..26bc742 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -104,7 +104,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int sched_setscheduler(pid_t __pid, int __policy, const struct sched_param* __param);
+int sched_setscheduler(pid_t __pid, int __policy, const struct sched_param* _Nonnull __param);
/**
* [sched_getscheduler(2)](http://man7.org/linux/man-pages/man2/sched_getcpu.2.html)
@@ -145,7 +145,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int sched_setparam(pid_t __pid, const struct sched_param* __param);
+int sched_setparam(pid_t __pid, const struct sched_param* _Nonnull __param);
/**
* [sched_getparam(2)](http://man7.org/linux/man-pages/man2/sched_getparam.2.html)
@@ -153,7 +153,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int sched_getparam(pid_t __pid, struct sched_param* __param);
+int sched_getparam(pid_t __pid, struct sched_param* _Nonnull __param);
/**
* [sched_rr_get_interval(2)](http://man7.org/linux/man-pages/man2/sched_rr_get_interval.2.html)
@@ -161,7 +161,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int sched_rr_get_interval(pid_t __pid, struct timespec* __quantum);
+int sched_rr_get_interval(pid_t __pid, struct timespec* _Nonnull __quantum);
#if defined(__USE_GNU)
@@ -172,7 +172,7 @@
* Returns the pid of the child to the caller on success and
* returns -1 and sets `errno` on failure.
*/
-int clone(int (*__fn)(void*), void* __child_stack, int __flags, void* __arg, ...) __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_X86(17);
+int clone(int (* __BIONIC_COMPLICATED_NULLNESS __fn)(void* __BIONIC_COMPLICATED_NULLNESS ), void* __BIONIC_COMPLICATED_NULLNESS __child_stack, int __flags, void* _Nullable __arg, ...) __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_X86(17);
/**
* [unshare(2)](http://man7.org/linux/man-pages/man2/unshare.2.html)
@@ -228,7 +228,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int sched_setaffinity(pid_t __pid, size_t __set_size, const cpu_set_t* __set);
+int sched_setaffinity(pid_t __pid, size_t __set_size, const cpu_set_t* _Nonnull __set);
/**
* [sched_getaffinity(2)](http://man7.org/linux/man-pages/man2/sched_getaffinity.2.html)
@@ -236,7 +236,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int sched_getaffinity(pid_t __pid, size_t __set_size, cpu_set_t* __set);
+int sched_getaffinity(pid_t __pid, size_t __set_size, cpu_set_t* _Nonnull __set);
/**
* [CPU_ZERO](https://man7.org/linux/man-pages/man3/CPU_SET.3.html) clears all
@@ -308,7 +308,7 @@
* how many bits are set in a dynamic CPU set allocated by `CPU_ALLOC`.
*/
#define CPU_COUNT_S(setsize, set) __sched_cpucount((setsize), (set))
-int __sched_cpucount(size_t __set_size, const cpu_set_t* __set);
+int __sched_cpucount(size_t __set_size, const cpu_set_t* _Nonnull __set);
/**
* [CPU_EQUAL](https://man7.org/linux/man-pages/man3/CPU_SET.3.html) tests
@@ -379,14 +379,14 @@
* allocates a CPU set large enough for CPUs in the range 0..count-1.
*/
#define CPU_ALLOC(count) __sched_cpualloc((count))
-cpu_set_t* __sched_cpualloc(size_t __count);
+cpu_set_t* _Nullable __sched_cpualloc(size_t __count);
/**
* [CPU_FREE](https://man7.org/linux/man-pages/man3/CPU_SET.3.html)
* deallocates a CPU set allocated by `CPU_ALLOC`.
*/
#define CPU_FREE(set) __sched_cpufree((set))
-void __sched_cpufree(cpu_set_t* __set);
+void __sched_cpufree(cpu_set_t* _Nonnull __set);
#endif /* __USE_GNU */
diff --git a/libc/include/search.h b/libc/include/search.h
index 7c4989a..00deef1 100644
--- a/libc/include/search.h
+++ b/libc/include/search.h
@@ -25,9 +25,9 @@
/** See hsearch()/hsearch_r(). */
typedef struct entry {
/** The string key. */
- char* key;
+ char* _Nullable key;
/** The associated data. */
- void* data;
+ void* _Nullable data;
} ENTRY;
/**
@@ -57,7 +57,7 @@
#if defined(__USE_BSD) || defined(__USE_GNU)
/** The hash table type for hcreate_r()/hdestroy_r()/hsearch_r(). */
struct hsearch_data {
- struct __hsearch* __hsearch;
+ struct __hsearch* _Nullable __hsearch;
};
#endif
@@ -69,7 +69,7 @@
*
* Available since API level 21.
*/
-void insque(void* __element, void* __previous) __INTRODUCED_IN(21);
+void insque(void* _Nonnull __element, void* _Nullable __previous) __INTRODUCED_IN(21);
/**
* [remque(3)](http://man7.org/linux/man-pages/man3/remque.3.html) removes
@@ -77,7 +77,7 @@
*
* Available since API level 21.
*/
-void remque(void* __element) __INTRODUCED_IN(21);
+void remque(void* _Nonnull __element) __INTRODUCED_IN(21);
/**
* [hcreate(3)](http://man7.org/linux/man-pages/man3/hcreate.3.html)
@@ -112,7 +112,7 @@
*
* Available since API level 28.
*/
-ENTRY* hsearch(ENTRY __entry, ACTION __action) __INTRODUCED_IN(28);
+ENTRY* _Nullable hsearch(ENTRY __entry, ACTION __action) __INTRODUCED_IN(28);
#if defined(__USE_BSD) || defined(__USE_GNU)
@@ -124,7 +124,7 @@
*
* Available since API level 28.
*/
-int hcreate_r(size_t __n, struct hsearch_data* __table) __INTRODUCED_IN(28);
+int hcreate_r(size_t __n, struct hsearch_data* _Nonnull __table) __INTRODUCED_IN(28);
/**
* [hdestroy_r(3)](http://man7.org/linux/man-pages/man3/hdestroy_r.3.html) destroys
@@ -132,7 +132,7 @@
*
* Available since API level 28.
*/
-void hdestroy_r(struct hsearch_data* __table) __INTRODUCED_IN(28);
+void hdestroy_r(struct hsearch_data* _Nonnull __table) __INTRODUCED_IN(28);
/**
* [hsearch_r(3)](http://man7.org/linux/man-pages/man3/hsearch_r.3.html) finds or
@@ -143,7 +143,7 @@
*
* Available since API level 28.
*/
-int hsearch_r(ENTRY __entry, ACTION __action, ENTRY** __result, struct hsearch_data* __table) __INTRODUCED_IN(28);
+int hsearch_r(ENTRY __entry, ACTION __action, ENTRY* _Nullable * _Nonnull __result, struct hsearch_data* _Nonnull __table) __INTRODUCED_IN(28);
#endif
@@ -158,7 +158,7 @@
*
* Available since API level 21.
*/
-void* lfind(const void* __key, const void* __array, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(21);
+void* _Nullable lfind(const void* _Nonnull __key, const void* _Nonnull __array, size_t* _Nonnull __count, size_t __size, int (* _Nonnull __comparator)(const void* _Nonnull, const void* _Nonnull)) __INTRODUCED_IN(21);
/**
* [lsearch(3)](http://man7.org/linux/man-pages/man3/lsearch.3.html) brute-force
@@ -173,7 +173,7 @@
*
* Available since API level 21.
*/
-void* lsearch(const void* __key, void* __array, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(21);
+void* _Nonnull lsearch(const void* _Nonnull __key, void* _Nonnull __array, size_t* _Nonnull __count, size_t __size, int (* _Nonnull __comparator)(const void* _Nonnull, const void* _Nonnull)) __INTRODUCED_IN(21);
/**
* [tdelete(3)](http://man7.org/linux/man-pages/man3/tdelete.3.html) searches
@@ -182,13 +182,13 @@
*
* Returns a pointer to the parent of the deleted node, or NULL on failure.
*/
-void* tdelete(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*));
+void* _Nullable tdelete(const void* _Nonnull __key, void* _Nullable * _Nullable __root_ptr, int (* _Nonnull __comparator)(const void* _Nonnull, const void* _Nonnull));
/**
* [tdestroy(3)](http://man7.org/linux/man-pages/man3/tdestroy.3.html) destroys
* the hash table `__root` using `__free_fn` on each node.
*/
-void tdestroy(void* __root, void (*__free_fn)(void*));
+void tdestroy(void* _Nullable __root, void (* _Nullable __free_fn)(void* _Nullable));
/**
* [tfind(3)](http://man7.org/linux/man-pages/man3/tfind.3.html) searches
@@ -197,7 +197,7 @@
*
* Returns a pointer to the matching node, or NULL on failure.
*/
-void* tfind(const void* __key, void* const* __root_ptr, int (*__comparator)(const void*, const void*));
+void* _Nullable tfind(const void* _Nonnull __key, void* _Nullable const* _Nullable __root_ptr, int (* _Nonnull __comparator)(const void* _Nonnull, const void* _Nonnull));
/**
* [tsearch(3)](http://man7.org/linux/man-pages/man3/tsearch.3.html) searches
@@ -208,12 +208,12 @@
*
* Returns a pointer to the matching node, or to the newly-added node.
*/
-void* tsearch(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*));
+void* _Nullable tsearch(const void* _Nonnull __key, void* _Nullable * _Nullable __root_ptr, int (* _Nonnull __comparator)(const void* _Nonnull, const void* _Nonnull));
/**
* [twalk(3)](http://man7.org/linux/man-pages/man3/twalk.3.html) calls
* `__visitor` on every node in the tree.
*/
-void twalk(const void* __root, void (*__visitor)(const void*, VISIT, int)) __INTRODUCED_IN(21);
+void twalk(const void* _Nullable __root, void (* _Nullable __visitor)(const void* _Nullable, VISIT, int)) __INTRODUCED_IN(21);
__END_DECLS
diff --git a/libc/include/semaphore.h b/libc/include/semaphore.h
index 5d66f7e..6ad9ea3 100644
--- a/libc/include/semaphore.h
+++ b/libc/include/semaphore.h
@@ -45,12 +45,12 @@
#define SEM_FAILED __BIONIC_CAST(reinterpret_cast, sem_t*, 0)
-int sem_clockwait(sem_t* __sem, clockid_t __clock, const struct timespec* __ts) __INTRODUCED_IN(30);
-int sem_destroy(sem_t* __sem);
-int sem_getvalue(sem_t* __sem, int* __value);
-int sem_init(sem_t* __sem, int __shared, unsigned int __value);
-int sem_post(sem_t* __sem);
-int sem_timedwait(sem_t* __sem, const struct timespec* __ts);
+int sem_clockwait(sem_t* _Nonnull __sem, clockid_t __clock, const struct timespec* _Nonnull __ts) __INTRODUCED_IN(30);
+int sem_destroy(sem_t* _Nonnull __sem);
+int sem_getvalue(sem_t* _Nonnull __sem, int* _Nonnull __value);
+int sem_init(sem_t* _Nonnull __sem, int __shared, unsigned int __value);
+int sem_post(sem_t* _Nonnull __sem);
+int sem_timedwait(sem_t* _Nonnull __sem, const struct timespec* _Nonnull __ts);
/*
* POSIX historically only supported using sem_timedwait() with CLOCK_REALTIME, however that is
* typically inappropriate, since that clock can change dramatically, causing the timeout to either
@@ -59,14 +59,14 @@
* Note that sem_clockwait() allows specifying an arbitrary clock and has superseded this
* function.
*/
-int sem_timedwait_monotonic_np(sem_t* __sem, const struct timespec* __ts) __INTRODUCED_IN(28);
-int sem_trywait(sem_t* __sem);
-int sem_wait(sem_t* __sem);
+int sem_timedwait_monotonic_np(sem_t* _Nonnull __sem, const struct timespec* _Nonnull __ts) __INTRODUCED_IN(28);
+int sem_trywait(sem_t* _Nonnull __sem);
+int sem_wait(sem_t* _Nonnull __sem);
/* These aren't actually implemented. */
-sem_t* sem_open(const char* __name, int _flags, ...);
-int sem_close(sem_t* __sem);
-int sem_unlink(const char* __name);
+sem_t* _Nullable sem_open(const char* _Nonnull __name, int _flags, ...);
+int sem_close(sem_t* _Nonnull __sem);
+int sem_unlink(const char* _Nonnull __name);
__END_DECLS
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index 3a64b33..6d047ae 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -37,39 +37,94 @@
* @(#)setjmp.h 8.2 (Berkeley) 1/21/94
*/
-#ifndef _SETJMP_H_
-#define _SETJMP_H_
+#pragma once
+
+/**
+ * @file setjmp.h
+ * @brief Non-local jumps.
+ */
#include <sys/cdefs.h>
#if defined(__aarch64__)
+/**
+ * The size in words of an arm64 jmp_buf. Room for callee-saved registers,
+ * including floating point, stack pointer and program counter, various
+ * internal implementation details, and leaving some free space.
+ *
+ * Coincidentally matches OpenBSD, though they also save/restore the
+ * floating point status register too.
+ */
#define _JBLEN 32
#elif defined(__arm__)
+/** The size in words of an arm32 jmp_buf. Inherited from OpenBSD. */
#define _JBLEN 64
#elif defined(__i386__)
+/** The size in words of an x86 jmp_buf. Inherited from OpenBSD. */
#define _JBLEN 10
+#elif defined(__riscv)
+/**
+ * The size in words of a riscv64 jmp_buf. Room for callee-saved registers,
+ * including floating point, stack pointer and program counter, various
+ * internal implementation details, and leaving some free space.
+ *
+ * Coincidentally matches OpenBSD, though they also save/restore the
+ * floating point status register too.
+ */
+#define _JBLEN 32
#elif defined(__x86_64__)
+/** The size in words of an x86-64 jmp_buf. Inherited from OpenBSD. */
#define _JBLEN 11
#endif
+/** The type of the buffer used by sigsetjmp()/siglongjmp(). */
typedef long sigjmp_buf[_JBLEN + 1];
+
+/** The type of the buffer used by setjmp()/longjmp(). */
typedef long jmp_buf[_JBLEN];
#undef _JBLEN
__BEGIN_DECLS
+/**
+ * Equivalent to sigsetjmp() with the second argument 0, so that the signal
+ * mask is not saved.
+ */
int _setjmp(jmp_buf __env) __returns_twice;
+
+/** Equivalent to siglongjmp(). */
__noreturn void _longjmp(jmp_buf __env, int __value);
+/**
+ * Equivalent to sigsetjmp() with the second argument 1, so that the signal
+ * mask is saved.
+ */
int setjmp(jmp_buf __env) __returns_twice;
-__noreturn void longjmp(jmp_buf __env, int __value);
+/** C11 says setjmp() must be a macro, but Android already had a function. */
#define setjmp(__env) setjmp(__env)
-int sigsetjmp(sigjmp_buf __env, int __save_signal_mask);
+/** Equivalent to siglongjmp(). */
+__noreturn void longjmp(jmp_buf __env, int __value);
+
+/**
+ * [sigsetjmp(3)](http://man7.org/linux/man-pages/man3/sigsetjmp.3.html)
+ * sets the target of a future siglongjmp() call, saving or not saving the
+ * current signal mask based on the second argument.
+ *
+ * Returns 0 when first called, and returns the value passed to siglongjmp()
+ * when returning here as a result of a siglongjmp() call.
+ */
+int sigsetjmp(sigjmp_buf __env, int __save_signal_mask) __returns_twice;
+
+/**
+ * [siglongjmp(3)](http://man7.org/linux/man-pages/man3/siglongjmp.3.html)
+ * transfers control back to the site of the sigsetjmp() call that initialized
+ * the given jump buffer, returning the given value.
+ *
+ * Does not return.
+ */
__noreturn void siglongjmp(sigjmp_buf __env, int __value);
__END_DECLS
-
-#endif
diff --git a/libc/include/signal.h b/libc/include/signal.h
index 532e4a5..b9aeaab 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -54,40 +54,36 @@
int __libc_current_sigrtmin(void) __INTRODUCED_IN(21);
int __libc_current_sigrtmax(void) __INTRODUCED_IN(21);
-extern const char* const sys_siglist[_NSIG];
-extern const char* const sys_signame[_NSIG]; /* BSD compatibility. */
+extern const char* _Nonnull const sys_siglist[_NSIG];
+extern const char* _Nonnull const sys_signame[_NSIG]; /* BSD compatibility. */
#define si_timerid si_tid /* glibc compatibility. */
-int sigaction(int __signal, const struct sigaction* __new_action, struct sigaction* __old_action);
-int sigaction64(int __signal, const struct sigaction64* __new_action, struct sigaction64* __old_action) __INTRODUCED_IN(28);
+int sigaction(int __signal, const struct sigaction* _Nullable __new_action, struct sigaction* _Nullable __old_action);
+int sigaction64(int __signal, const struct sigaction64* _Nullable __new_action, struct sigaction64* _Nullable __old_action) __INTRODUCED_IN(28);
int siginterrupt(int __signal, int __flag);
-#if __ANDROID_API__ >= 21
-sighandler_t signal(int __signal, sighandler_t __handler) __INTRODUCED_IN(21);
-int sigaddset(sigset_t* __set, int __signal) __INTRODUCED_IN(21);
-int sigaddset64(sigset64_t* __set, int __signal) __INTRODUCED_IN(28);
-int sigdelset(sigset_t* __set, int __signal) __INTRODUCED_IN(21);
-int sigdelset64(sigset64_t* __set, int __signal) __INTRODUCED_IN(28);
-int sigemptyset(sigset_t* __set) __INTRODUCED_IN(21);
-int sigemptyset64(sigset64_t* __set) __INTRODUCED_IN(28);
-int sigfillset(sigset_t* __set) __INTRODUCED_IN(21);
-int sigfillset64(sigset64_t* __set) __INTRODUCED_IN(28);
-int sigismember(const sigset_t* __set, int __signal) __INTRODUCED_IN(21);
-int sigismember64(const sigset64_t* __set, int __signal) __INTRODUCED_IN(28);
-#else
-// Implemented as static inlines before 21.
-#endif
+sighandler_t _Nonnull signal(int __signal, sighandler_t _Nullable __handler) __INTRODUCED_IN(21);
+int sigaddset(sigset_t* _Nonnull __set, int __signal) __INTRODUCED_IN(21);
+int sigaddset64(sigset64_t* _Nonnull __set, int __signal) __INTRODUCED_IN(28);
+int sigdelset(sigset_t* _Nonnull __set, int __signal) __INTRODUCED_IN(21);
+int sigdelset64(sigset64_t* _Nonnull __set, int __signal) __INTRODUCED_IN(28);
+int sigemptyset(sigset_t* _Nonnull __set) __INTRODUCED_IN(21);
+int sigemptyset64(sigset64_t* _Nonnull __set) __INTRODUCED_IN(28);
+int sigfillset(sigset_t* _Nonnull __set) __INTRODUCED_IN(21);
+int sigfillset64(sigset64_t* _Nonnull __set) __INTRODUCED_IN(28);
+int sigismember(const sigset_t* _Nonnull __set, int __signal) __INTRODUCED_IN(21);
+int sigismember64(const sigset64_t* _Nonnull __set, int __signal) __INTRODUCED_IN(28);
-int sigpending(sigset_t* __set);
-int sigpending64(sigset64_t* __set) __INTRODUCED_IN(28);
-int sigprocmask(int __how, const sigset_t* __new_set, sigset_t* __old_set);
-int sigprocmask64(int __how, const sigset64_t* __new_set, sigset64_t* __old_set) __INTRODUCED_IN(28);
-int sigsuspend(const sigset_t* __mask);
-int sigsuspend64(const sigset64_t* __mask) __INTRODUCED_IN(28);
-int sigwait(const sigset_t* __set, int* __signal);
-int sigwait64(const sigset64_t* __set, int* __signal) __INTRODUCED_IN(28);
+int sigpending(sigset_t* _Nonnull __set);
+int sigpending64(sigset64_t* _Nonnull __set) __INTRODUCED_IN(28);
+int sigprocmask(int __how, const sigset_t* _Nullable __new_set, sigset_t* _Nullable __old_set);
+int sigprocmask64(int __how, const sigset64_t* _Nullable __new_set, sigset64_t* _Nullable __old_set) __INTRODUCED_IN(28);
+int sigsuspend(const sigset_t* _Nonnull __mask);
+int sigsuspend64(const sigset64_t* _Nonnull __mask) __INTRODUCED_IN(28);
+int sigwait(const sigset_t* _Nonnull __set, int* _Nonnull __signal);
+int sigwait64(const sigset64_t* _Nonnull __set, int* _Nonnull __signal) __INTRODUCED_IN(28);
int sighold(int __signal)
__attribute__((deprecated("use sigprocmask() or pthread_sigmask() instead")))
@@ -99,7 +95,7 @@
int sigrelse(int __signal)
__attribute__((deprecated("use sigprocmask() or pthread_sigmask() instead")))
__INTRODUCED_IN(26);
-sighandler_t sigset(int __signal, sighandler_t __handler)
+sighandler_t _Nonnull sigset(int __signal, sighandler_t _Nullable __handler)
__attribute__((deprecated("use sigaction() instead"))) __INTRODUCED_IN(26);
int raise(int __signal);
@@ -107,27 +103,25 @@
int killpg(int __pgrp, int __signal);
int tgkill(int __tgid, int __tid, int __signal);
-int sigaltstack(const stack_t* __new_signal_stack, stack_t* __old_signal_stack);
+int sigaltstack(const stack_t* _Nullable __new_signal_stack, stack_t* _Nullable __old_signal_stack);
-void psiginfo(const siginfo_t* __info, const char* __msg) __INTRODUCED_IN(17);
-void psignal(int __signal, const char* __msg) __INTRODUCED_IN(17);
+void psiginfo(const siginfo_t* _Nonnull __info, const char* _Nullable __msg) __INTRODUCED_IN(17);
+void psignal(int __signal, const char* _Nullable __msg) __INTRODUCED_IN(17);
int pthread_kill(pthread_t __pthread, int __signal);
#if defined(__USE_GNU)
int pthread_sigqueue(pthread_t __pthread, int __signal, const union sigval __value) __INTRODUCED_IN(29);
#endif
-int pthread_sigmask(int __how, const sigset_t* __new_set, sigset_t* __old_set);
-int pthread_sigmask64(int __how, const sigset64_t* __new_set, sigset64_t* __old_set) __INTRODUCED_IN(28);
+int pthread_sigmask(int __how, const sigset_t* _Nullable __new_set, sigset_t* _Nullable __old_set);
+int pthread_sigmask64(int __how, const sigset64_t* _Nullable __new_set, sigset64_t* _Nullable __old_set) __INTRODUCED_IN(28);
int sigqueue(pid_t __pid, int __signal, const union sigval __value) __INTRODUCED_IN(23);
-int sigtimedwait(const sigset_t* __set, siginfo_t* __info, const struct timespec* __timeout) __INTRODUCED_IN(23);
-int sigtimedwait64(const sigset64_t* __set, siginfo_t* __info, const struct timespec* __timeout) __INTRODUCED_IN(28);
-int sigwaitinfo(const sigset_t* __set, siginfo_t* __info) __INTRODUCED_IN(23);
-int sigwaitinfo64(const sigset64_t* __set, siginfo_t* __info) __INTRODUCED_IN(28);
+int sigtimedwait(const sigset_t* _Nonnull __set, siginfo_t* _Nullable __info, const struct timespec* _Nullable __timeout) __INTRODUCED_IN(23);
+int sigtimedwait64(const sigset64_t* _Nonnull __set, siginfo_t* _Nullable __info, const struct timespec* _Nullable __timeout) __INTRODUCED_IN(28);
+int sigwaitinfo(const sigset_t* _Nonnull __set, siginfo_t* _Nullable __info) __INTRODUCED_IN(23);
+int sigwaitinfo64(const sigset64_t* _Nonnull __set, siginfo_t* _Nullable __info) __INTRODUCED_IN(28);
__END_DECLS
-#include <android/legacy_signal_inlines.h>
-
#endif
diff --git a/libc/include/spawn.h b/libc/include/spawn.h
index e445453..6c34b98 100644
--- a/libc/include/spawn.h
+++ b/libc/include/spawn.h
@@ -52,40 +52,43 @@
typedef struct __posix_spawnattr* posix_spawnattr_t;
typedef struct __posix_spawn_file_actions* posix_spawn_file_actions_t;
-int posix_spawn(pid_t* __pid, const char* __path, const posix_spawn_file_actions_t* __actions, const posix_spawnattr_t* __attr, char* const __argv[], char* const __env[]) __INTRODUCED_IN(28);
-int posix_spawnp(pid_t* __pid, const char* __file, const posix_spawn_file_actions_t* __actions, const posix_spawnattr_t* __attr, char* const __argv[], char* const __env[]) __INTRODUCED_IN(28);
+int posix_spawn(pid_t* _Nullable __pid, const char* _Nonnull __path, const posix_spawn_file_actions_t _Nullable * _Nullable __actions, const posix_spawnattr_t _Nullable * _Nullable __attr, char* const _Nonnull __argv[_Nonnull], char* const _Nullable __env[_Nullable]) __INTRODUCED_IN(28);
+int posix_spawnp(pid_t* _Nullable __pid, const char* _Nonnull __file, const posix_spawn_file_actions_t _Nullable * _Nullable __actions, const posix_spawnattr_t _Nullable * _Nullable __attr, char* const _Nonnull __argv[_Nonnull], char* const _Nullable __env[_Nullable]) __INTRODUCED_IN(28);
-int posix_spawnattr_init(posix_spawnattr_t* __attr) __INTRODUCED_IN(28);
-int posix_spawnattr_destroy(posix_spawnattr_t* __attr) __INTRODUCED_IN(28);
+int posix_spawnattr_init(posix_spawnattr_t _Nonnull * _Nonnull __attr) __INTRODUCED_IN(28);
+int posix_spawnattr_destroy(posix_spawnattr_t _Nonnull * _Nonnull __attr) __INTRODUCED_IN(28);
-int posix_spawnattr_setflags(posix_spawnattr_t* __attr, short __flags) __INTRODUCED_IN(28);
-int posix_spawnattr_getflags(const posix_spawnattr_t* __attr, short* __flags) __INTRODUCED_IN(28);
+int posix_spawnattr_setflags(posix_spawnattr_t _Nonnull * _Nonnull __attr, short __flags) __INTRODUCED_IN(28);
+int posix_spawnattr_getflags(const posix_spawnattr_t _Nonnull * _Nonnull __attr, short* _Nonnull __flags) __INTRODUCED_IN(28);
-int posix_spawnattr_setpgroup(posix_spawnattr_t* __attr, pid_t __pgroup) __INTRODUCED_IN(28);
-int posix_spawnattr_getpgroup(const posix_spawnattr_t* __attr, pid_t* __pgroup) __INTRODUCED_IN(28);
+int posix_spawnattr_setpgroup(posix_spawnattr_t _Nonnull * _Nonnull __attr, pid_t __pgroup) __INTRODUCED_IN(28);
+int posix_spawnattr_getpgroup(const posix_spawnattr_t _Nonnull * _Nonnull __attr, pid_t* _Nonnull __pgroup) __INTRODUCED_IN(28);
-int posix_spawnattr_setsigmask(posix_spawnattr_t* __attr, const sigset_t* __mask) __INTRODUCED_IN(28);
-int posix_spawnattr_setsigmask64(posix_spawnattr_t* __attr, const sigset64_t* __mask) __INTRODUCED_IN(28);
-int posix_spawnattr_getsigmask(const posix_spawnattr_t* __attr, sigset_t* __mask) __INTRODUCED_IN(28);
-int posix_spawnattr_getsigmask64(const posix_spawnattr_t* __attr, sigset64_t* __mask) __INTRODUCED_IN(28);
+int posix_spawnattr_setsigmask(posix_spawnattr_t _Nonnull * _Nonnull __attr, const sigset_t* _Nonnull __mask) __INTRODUCED_IN(28);
+int posix_spawnattr_setsigmask64(posix_spawnattr_t _Nonnull * _Nonnull __attr, const sigset64_t* _Nonnull __mask) __INTRODUCED_IN(28);
+int posix_spawnattr_getsigmask(const posix_spawnattr_t _Nonnull * _Nonnull __attr, sigset_t* _Nonnull __mask) __INTRODUCED_IN(28);
+int posix_spawnattr_getsigmask64(const posix_spawnattr_t _Nonnull * _Nonnull __attr, sigset64_t* _Nonnull __mask) __INTRODUCED_IN(28);
-int posix_spawnattr_setsigdefault(posix_spawnattr_t* __attr, const sigset_t* __mask) __INTRODUCED_IN(28);
-int posix_spawnattr_setsigdefault64(posix_spawnattr_t* __attr, const sigset64_t* __mask) __INTRODUCED_IN(28);
-int posix_spawnattr_getsigdefault(const posix_spawnattr_t* __attr, sigset_t* __mask) __INTRODUCED_IN(28);
-int posix_spawnattr_getsigdefault64(const posix_spawnattr_t* __attr, sigset64_t* __mask) __INTRODUCED_IN(28);
+int posix_spawnattr_setsigdefault(posix_spawnattr_t _Nonnull * _Nonnull __attr, const sigset_t* _Nonnull __mask) __INTRODUCED_IN(28);
+int posix_spawnattr_setsigdefault64(posix_spawnattr_t _Nonnull * _Nonnull __attr, const sigset64_t* _Nonnull __mask) __INTRODUCED_IN(28);
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t _Nonnull * _Nonnull __attr, sigset_t* _Nonnull __mask) __INTRODUCED_IN(28);
+int posix_spawnattr_getsigdefault64(const posix_spawnattr_t _Nonnull * _Nonnull __attr, sigset64_t* _Nonnull __mask) __INTRODUCED_IN(28);
-int posix_spawnattr_setschedparam(posix_spawnattr_t* __attr, const struct sched_param* __param) __INTRODUCED_IN(28);
-int posix_spawnattr_getschedparam(const posix_spawnattr_t* __attr, struct sched_param* __param) __INTRODUCED_IN(28);
+int posix_spawnattr_setschedparam(posix_spawnattr_t _Nonnull * _Nonnull __attr, const struct sched_param* _Nonnull __param) __INTRODUCED_IN(28);
+int posix_spawnattr_getschedparam(const posix_spawnattr_t _Nonnull * _Nonnull __attr, struct sched_param* _Nonnull __param) __INTRODUCED_IN(28);
-int posix_spawnattr_setschedpolicy(posix_spawnattr_t* __attr, int __policy) __INTRODUCED_IN(28);
-int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* __attr, int* __policy) __INTRODUCED_IN(28);
+int posix_spawnattr_setschedpolicy(posix_spawnattr_t _Nonnull * _Nonnull __attr, int __policy) __INTRODUCED_IN(28);
+int posix_spawnattr_getschedpolicy(const posix_spawnattr_t _Nonnull * _Nonnull __attr, int* _Nonnull __policy) __INTRODUCED_IN(28);
-int posix_spawn_file_actions_init(posix_spawn_file_actions_t* __actions) __INTRODUCED_IN(28);
-int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t* __actions) __INTRODUCED_IN(28);
+int posix_spawn_file_actions_init(posix_spawn_file_actions_t _Nonnull * _Nonnull __actions) __INTRODUCED_IN(28);
+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t _Nonnull * _Nonnull __actions) __INTRODUCED_IN(28);
-int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* __actions, int __fd, const char* __path, int __flags, mode_t __mode) __INTRODUCED_IN(28);
-int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t* __actions, int __fd) __INTRODUCED_IN(28);
-int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t* __actions, int __fd, int __new_fd) __INTRODUCED_IN(28);
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t _Nonnull * _Nonnull __actions, int __fd, const char* _Nonnull __path, int __flags, mode_t __mode) __INTRODUCED_IN(28);
+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t _Nonnull * _Nonnull __actions, int __fd) __INTRODUCED_IN(28);
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t _Nonnull * _Nonnull __actions, int __fd, int __new_fd) __INTRODUCED_IN(28);
+
+int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t _Nonnull * _Nonnull __actions, const char* _Nonnull __path) __INTRODUCED_IN(34);
+int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t _Nonnull * _Nonnull __actions, int __fd) __INTRODUCED_IN(34);
__END_DECLS
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 9de12a4..e748faa 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -59,9 +59,9 @@
typedef struct __sFILE FILE;
#if __ANDROID_API__ >= 23
-extern FILE* stdin __INTRODUCED_IN(23);
-extern FILE* stdout __INTRODUCED_IN(23);
-extern FILE* stderr __INTRODUCED_IN(23);
+extern FILE* _Nonnull stdin __INTRODUCED_IN(23);
+extern FILE* _Nonnull stdout __INTRODUCED_IN(23);
+extern FILE* _Nonnull stderr __INTRODUCED_IN(23);
/* C99 and earlier plus current C++ standards say these must be macros. */
#define stdin stdin
@@ -103,66 +103,54 @@
#define L_tmpnam 4096
#define TMP_MAX 308915776
-void clearerr(FILE* __fp);
-int fclose(FILE* __fp);
-int feof(FILE* __fp);
-int ferror(FILE* __fp);
-int fflush(FILE* __fp);
-int fgetc(FILE* __fp);
-char* fgets(char* __buf, int __size, FILE* __fp);
-int fprintf(FILE* __fp , const char* __fmt, ...) __printflike(2, 3);
-int fputc(int __ch, FILE* __fp);
-int fputs(const char* __s, FILE* __fp);
-size_t fread(void* __buf, size_t __size, size_t __count, FILE* __fp);
-int fscanf(FILE* __fp, const char* __fmt, ...) __scanflike(2, 3);
-size_t fwrite(const void* __buf, size_t __size, size_t __count, FILE* __fp);
-int getc(FILE* __fp);
+void clearerr(FILE* _Nonnull __fp);
+int fclose(FILE* _Nonnull __fp);
+int feof(FILE* _Nonnull __fp);
+int ferror(FILE* _Nonnull __fp);
+int fflush(FILE* _Nullable __fp);
+int fgetc(FILE* _Nonnull __fp);
+char* _Nullable fgets(char* _Nonnull __buf, int __size, FILE* _Nonnull __fp);
+int fprintf(FILE* _Nonnull __fp , const char* _Nonnull __fmt, ...) __printflike(2, 3);
+int fputc(int __ch, FILE* _Nonnull __fp);
+int fputs(const char* _Nonnull __s, FILE* _Nonnull __fp);
+size_t fread(void* _Nonnull __buf, size_t __size, size_t __count, FILE* _Nonnull __fp);
+int fscanf(FILE* _Nonnull __fp, const char* _Nonnull __fmt, ...) __scanflike(2, 3);
+size_t fwrite(const void* _Nonnull __buf, size_t __size, size_t __count, FILE* _Nonnull __fp);
+int getc(FILE* _Nonnull __fp);
int getchar(void);
-ssize_t getdelim(char** __line_ptr, size_t* __line_length_ptr, int __delimiter, FILE* __fp) __INTRODUCED_IN(18);
-ssize_t getline(char** __line_ptr, size_t* __line_length_ptr, FILE* __fp) __INTRODUCED_IN(18);
+ssize_t getdelim(char* _Nullable * _Nonnull __line_ptr, size_t* _Nonnull __line_length_ptr, int __delimiter, FILE* _Nonnull __fp) __INTRODUCED_IN(18);
+ssize_t getline(char* _Nullable * _Nonnull __line_ptr, size_t* _Nonnull __line_length_ptr, FILE* _Nonnull __fp) __INTRODUCED_IN(18);
-void perror(const char* __msg);
-int printf(const char* __fmt, ...) __printflike(1, 2);
-int putc(int __ch, FILE* __fp);
+void perror(const char* _Nullable __msg);
+int printf(const char* _Nonnull __fmt, ...) __printflike(1, 2);
+int putc(int __ch, FILE* _Nonnull __fp);
int putchar(int __ch);
-int puts(const char* __s);
-int remove(const char* __path);
-void rewind(FILE* __fp);
-int scanf(const char* __fmt, ...) __scanflike(1, 2);
-void setbuf(FILE* __fp, char* __buf);
-int setvbuf(FILE* __fp, char* __buf, int __mode, size_t __size);
-int sscanf(const char* __s, const char* __fmt, ...) __scanflike(2, 3);
-int ungetc(int __ch, FILE* __fp);
-int vfprintf(FILE* __fp, const char* __fmt, va_list __args) __printflike(2, 0);
-int vprintf(const char* __fp, va_list __args) __printflike(1, 0);
+int puts(const char* _Nonnull __s);
+int remove(const char* _Nonnull __path);
+void rewind(FILE* _Nonnull __fp);
+int scanf(const char* _Nonnull __fmt, ...) __scanflike(1, 2);
+void setbuf(FILE* _Nonnull __fp, char* _Nullable __buf);
+int setvbuf(FILE* _Nonnull __fp, char* _Nullable __buf, int __mode, size_t __size);
+int sscanf(const char* _Nonnull __s, const char* _Nonnull __fmt, ...) __scanflike(2, 3);
+int ungetc(int __ch, FILE* _Nonnull __fp);
+int vfprintf(FILE* _Nonnull __fp, const char* _Nonnull __fmt, va_list __args) __printflike(2, 0);
+int vprintf(const char* _Nonnull __fp, va_list __args) __printflike(1, 0);
-#if __ANDROID_API__ >= 21
-int dprintf(int __fd, const char* __fmt, ...) __printflike(2, 3) __INTRODUCED_IN(21);
-int vdprintf(int __fd, const char* __fmt, va_list __args) __printflike(2, 0) __INTRODUCED_IN(21);
-#else
-/*
- * Old versions of Android called these fdprintf and vfdprintf out of fears that the glibc names
- * would collide with user debug printfs.
- *
- * Allow users to just use dprintf and vfdprintf on any version by renaming those calls to their
- * legacy equivalents if needed.
- */
-int dprintf(int __fd, const char* __fmt, ...) __RENAME(fdprintf) __printflike(2, 3);
-int vdprintf(int __fd, const char* __fmt, va_list __args) __RENAME(vfdprintf) __printflike(2, 0);
-#endif
+int dprintf(int __fd, const char* _Nonnull __fmt, ...) __printflike(2, 3) __INTRODUCED_IN(21);
+int vdprintf(int __fd, const char* _Nonnull __fmt, va_list __args) __printflike(2, 0) __INTRODUCED_IN(21);
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 201112L) || \
(defined(__cplusplus) && __cplusplus <= 201103L)
-char* gets(char* __buf) __attribute__((deprecated("gets is unsafe, use fgets instead")));
+char* _Nullable gets(char* _Nonnull __buf) __attribute__((deprecated("gets is unsafe, use fgets instead")));
#endif
-int sprintf(char* __s, const char* __fmt, ...)
+int sprintf(char* _Nonnull __s, const char* _Nonnull __fmt, ...)
__printflike(2, 3) __warnattr_strict("sprintf is often misused; please use snprintf");
-int vsprintf(char* __s, const char* __fmt, va_list __args)
+int vsprintf(char* _Nonnull __s, const char* _Nonnull __fmt, va_list __args)
__printflike(2, 0) __warnattr_strict("vsprintf is often misused; please use vsnprintf");
-char* tmpnam(char* __s)
+char* _Nullable tmpnam(char* _Nullable __s)
__warnattr("tmpnam is unsafe, use mkstemp or tmpfile instead");
#define P_tmpdir "/tmp/" /* deprecated */
-char* tempnam(const char* __dir, const char* __prefix)
+char* _Nullable tempnam(const char* _Nullable __dir, const char* _Nullable __prefix)
__warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
/**
@@ -171,7 +159,7 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int rename(const char* __old_path, const char* __new_path);
+int rename(const char* _Nonnull __old_path, const char* _Nonnull __new_path);
/**
* [renameat(2)](http://man7.org/linux/man-pages/man2/renameat.2.html) changes
@@ -179,7 +167,7 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int renameat(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path);
+int renameat(int __old_dir_fd, const char* _Nonnull __old_path, int __new_dir_fd, const char* _Nonnull __new_path);
#if defined(__USE_GNU)
@@ -208,108 +196,111 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int renameat2(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path, unsigned __flags) __INTRODUCED_IN(30);
+int renameat2(int __old_dir_fd, const char* _Nonnull __old_path, int __new_dir_fd, const char* _Nonnull __new_path, unsigned __flags) __INTRODUCED_IN(30);
#endif
-int fseek(FILE* __fp, long __offset, int __whence);
-long ftell(FILE* __fp);
+int fseek(FILE* _Nonnull __fp, long __offset, int __whence);
+long ftell(FILE* _Nonnull __fp);
/* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
#if defined(__USE_FILE_OFFSET64)
-int fgetpos(FILE* __fp, fpos_t* __pos) __RENAME(fgetpos64) __INTRODUCED_IN(24);
-int fsetpos(FILE* __fp, const fpos_t* __pos) __RENAME(fsetpos64) __INTRODUCED_IN(24);
-int fseeko(FILE* __fp, off_t __offset, int __whence) __RENAME(fseeko64) __INTRODUCED_IN(24);
-off_t ftello(FILE* __fp) __RENAME(ftello64) __INTRODUCED_IN(24);
+int fgetpos(FILE* _Nonnull __fp, fpos_t* _Nonnull __pos) __RENAME(fgetpos64) __INTRODUCED_IN(24);
+int fsetpos(FILE* _Nonnull __fp, const fpos_t* _Nonnull __pos) __RENAME(fsetpos64) __INTRODUCED_IN(24);
+int fseeko(FILE* _Nonnull __fp, off_t __offset, int __whence) __RENAME(fseeko64) __INTRODUCED_IN(24);
+off_t ftello(FILE* _Nonnull __fp) __RENAME(ftello64) __INTRODUCED_IN(24);
# if defined(__USE_BSD)
-FILE* funopen(const void* __cookie,
- int (*__read_fn)(void*, char*, int),
- int (*__write_fn)(void*, const char*, int),
- fpos_t (*__seek_fn)(void*, fpos_t, int),
- int (*__close_fn)(void*)) __RENAME(funopen64) __INTRODUCED_IN(24);
+/* If __read_fn and __write_fn are both nullptr, it will cause EINVAL */
+FILE* _Nullable funopen(const void* _Nullable __cookie,
+ int (* __BIONIC_COMPLICATED_NULLNESS __read_fn)(void* _Nonnull, char* _Nonnull, int),
+ int (* __BIONIC_COMPLICATED_NULLNESS __write_fn)(void* _Nonnull, const char* _Nonnull, int),
+ fpos_t (* _Nullable __seek_fn)(void* _Nonnull, fpos_t, int),
+ int (* _Nullable __close_fn)(void* _Nonnull)) __RENAME(funopen64) __INTRODUCED_IN(24);
# endif
#else
-int fgetpos(FILE* __fp, fpos_t* __pos);
-int fsetpos(FILE* __fp, const fpos_t* __pos);
-int fseeko(FILE* __fp, off_t __offset, int __whence);
-off_t ftello(FILE* __fp);
+int fgetpos(FILE* _Nonnull __fp, fpos_t* _Nonnull __pos);
+int fsetpos(FILE* _Nonnull __fp, const fpos_t* _Nonnull __pos);
+int fseeko(FILE* _Nonnull __fp, off_t __offset, int __whence);
+off_t ftello(FILE* _Nonnull __fp);
# if defined(__USE_BSD)
-FILE* funopen(const void* __cookie,
- int (*__read_fn)(void*, char*, int),
- int (*__write_fn)(void*, const char*, int),
- fpos_t (*__seek_fn)(void*, fpos_t, int),
- int (*__close_fn)(void*));
+/* If __read_fn and __write_fn are both nullptr, it will cause EINVAL */
+FILE* _Nullable funopen(const void* _Nullable __cookie,
+ int (* __BIONIC_COMPLICATED_NULLNESS __read_fn)(void* _Nonnull, char* _Nonnull, int),
+ int (* __BIONIC_COMPLICATED_NULLNESS __write_fn)(void* _Nonnull, const char* _Nonnull, int),
+ fpos_t (* _Nullable __seek_fn)(void* _Nonnull, fpos_t, int),
+ int (* _Nullable __close_fn)(void* _Nonnull));
# endif
#endif
-int fgetpos64(FILE* __fp, fpos64_t* __pos) __INTRODUCED_IN(24);
-int fsetpos64(FILE* __fp, const fpos64_t* __pos) __INTRODUCED_IN(24);
-int fseeko64(FILE* __fp, off64_t __offset, int __whence) __INTRODUCED_IN(24);
-off64_t ftello64(FILE* __fp) __INTRODUCED_IN(24);
+int fgetpos64(FILE* _Nonnull __fp, fpos64_t* _Nonnull __pos) __INTRODUCED_IN(24);
+int fsetpos64(FILE* _Nonnull __fp, const fpos64_t* _Nonnull __pos) __INTRODUCED_IN(24);
+int fseeko64(FILE* _Nonnull __fp, off64_t __offset, int __whence) __INTRODUCED_IN(24);
+off64_t ftello64(FILE* _Nonnull __fp) __INTRODUCED_IN(24);
#if defined(__USE_BSD)
-FILE* funopen64(const void* __cookie,
- int (*__read_fn)(void*, char*, int),
- int (*__write_fn)(void*, const char*, int),
- fpos64_t (*__seek_fn)(void*, fpos64_t, int),
- int (*__close_fn)(void*)) __INTRODUCED_IN(24);
+/* If __read_fn and __write_fn are both nullptr, it will cause EINVAL */
+FILE* _Nullable funopen64(const void* _Nullable __cookie,
+ int (* __BIONIC_COMPLICATED_NULLNESS __read_fn)(void* _Nonnull, char* _Nonnull, int),
+ int (* __BIONIC_COMPLICATED_NULLNESS __write_fn)(void* _Nonnull, const char* _Nonnull, int),
+ fpos64_t (* _Nullable __seek_fn)(void* _Nonnull, fpos64_t, int),
+ int (* _Nullable __close_fn)(void* _Nonnull)) __INTRODUCED_IN(24);
#endif
-FILE* fopen(const char* __path, const char* __mode);
-FILE* fopen64(const char* __path, const char* __mode) __INTRODUCED_IN(24);
-FILE* freopen(const char* __path, const char* __mode, FILE* __fp);
-FILE* freopen64(const char* __path, const char* __mode, FILE* __fp) __INTRODUCED_IN(24);
-FILE* tmpfile(void);
-FILE* tmpfile64(void) __INTRODUCED_IN(24);
+FILE* _Nullable fopen(const char* _Nonnull __path, const char* _Nonnull __mode);
+FILE* _Nullable fopen64(const char* _Nonnull __path, const char* _Nonnull __mode) __INTRODUCED_IN(24);
+FILE* _Nullable freopen(const char* _Nullable __path, const char* _Nonnull __mode, FILE* _Nonnull __fp);
+FILE* _Nullable freopen64(const char* _Nullable __path, const char* _Nonnull __mode, FILE* _Nonnull __fp) __INTRODUCED_IN(24);
+FILE* _Nullable tmpfile(void);
+FILE* _Nullable tmpfile64(void) __INTRODUCED_IN(24);
-int snprintf(char* __buf, size_t __size, const char* __fmt, ...) __printflike(3, 4);
-int vfscanf(FILE* __fp, const char* __fmt, va_list __args) __scanflike(2, 0);
-int vscanf(const char* __fmt , va_list __args) __scanflike(1, 0);
-int vsnprintf(char* __buf, size_t __size, const char* __fmt, va_list __args) __printflike(3, 0);
-int vsscanf(const char* __s, const char* __fmt, va_list __args) __scanflike(2, 0);
+int snprintf(char* _Nullable __buf, size_t __size, const char* _Nonnull __fmt, ...) __printflike(3, 4);
+int vfscanf(FILE* _Nonnull __fp, const char* _Nonnull __fmt, va_list __args) __scanflike(2, 0);
+int vscanf(const char* _Nonnull __fmt , va_list __args) __scanflike(1, 0);
+int vsnprintf(char* _Nullable __buf, size_t __size, const char* _Nonnull __fmt, va_list __args) __printflike(3, 0);
+int vsscanf(const char* _Nonnull __s, const char* _Nonnull __fmt, va_list __args) __scanflike(2, 0);
#define L_ctermid 1024 /* size for ctermid() */
-char* ctermid(char* __buf) __INTRODUCED_IN(26);
+char* _Nonnull ctermid(char* _Nullable __buf) __INTRODUCED_IN(26);
-FILE* fdopen(int __fd, const char* __mode);
-int fileno(FILE* __fp);
-int pclose(FILE* __fp);
-FILE* popen(const char* __command, const char* __mode);
-void flockfile(FILE* __fp);
-int ftrylockfile(FILE* __fp);
-void funlockfile(FILE* __fp);
-int getc_unlocked(FILE* __fp);
+FILE* _Nullable fdopen(int __fd, const char* _Nonnull __mode);
+int fileno(FILE* _Nonnull __fp);
+int pclose(FILE* _Nonnull __fp);
+FILE* _Nullable popen(const char* _Nonnull __command, const char* _Nonnull __mode);
+void flockfile(FILE* _Nonnull __fp);
+int ftrylockfile(FILE* _Nonnull __fp);
+void funlockfile(FILE* _Nonnull __fp);
+int getc_unlocked(FILE* _Nonnull __fp);
int getchar_unlocked(void);
-int putc_unlocked(int __ch, FILE* __fp);
+int putc_unlocked(int __ch, FILE* _Nonnull __fp);
int putchar_unlocked(int __ch);
-FILE* fmemopen(void* __buf, size_t __size, const char* __mode) __INTRODUCED_IN(23);
-FILE* open_memstream(char** __ptr, size_t* __size_ptr) __INTRODUCED_IN(23);
+FILE* _Nullable fmemopen(void* _Nullable __buf, size_t __size, const char* _Nonnull __mode) __INTRODUCED_IN(23);
+FILE* _Nullable open_memstream(char* _Nonnull * _Nonnull __ptr, size_t* _Nonnull __size_ptr) __INTRODUCED_IN(23);
#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
-int asprintf(char** __s_ptr, const char* __fmt, ...) __printflike(2, 3);
-char* fgetln(FILE* __fp, size_t* __length_ptr);
-int fpurge(FILE* __fp);
-void setbuffer(FILE* __fp, char* __buf, int __size);
-int setlinebuf(FILE* __fp);
-int vasprintf(char** __s_ptr, const char* __fmt, va_list __args) __printflike(2, 0);
-void clearerr_unlocked(FILE* __fp) __INTRODUCED_IN(23);
-int feof_unlocked(FILE* __fp) __INTRODUCED_IN(23);
-int ferror_unlocked(FILE* __fp) __INTRODUCED_IN(23);
-int fileno_unlocked(FILE* __fp) __INTRODUCED_IN(24);
+int asprintf(char* _Nullable * _Nonnull __s_ptr, const char* _Nonnull __fmt, ...) __printflike(2, 3);
+char* _Nullable fgetln(FILE* _Nonnull __fp, size_t* _Nonnull __length_ptr);
+int fpurge(FILE* _Nonnull __fp);
+void setbuffer(FILE* _Nonnull __fp, char* _Nullable __buf, int __size);
+int setlinebuf(FILE* _Nonnull __fp);
+int vasprintf(char* _Nullable * _Nonnull __s_ptr, const char* _Nonnull __fmt, va_list __args) __printflike(2, 0);
+void clearerr_unlocked(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
+int feof_unlocked(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
+int ferror_unlocked(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
+int fileno_unlocked(FILE* _Nonnull __fp) __INTRODUCED_IN(24);
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
#endif
#if defined(__USE_BSD)
-int fflush_unlocked(FILE* __fp) __INTRODUCED_IN(28);
-int fgetc_unlocked(FILE* __fp) __INTRODUCED_IN(28);
-int fputc_unlocked(int __ch, FILE* __fp) __INTRODUCED_IN(28);
-size_t fread_unlocked(void* __buf, size_t __size, size_t __count, FILE* __fp) __INTRODUCED_IN(28);
-size_t fwrite_unlocked(const void* __buf, size_t __size, size_t __count, FILE* __fp) __INTRODUCED_IN(28);
+int fflush_unlocked(FILE* _Nullable __fp) __INTRODUCED_IN(28);
+int fgetc_unlocked(FILE* _Nonnull __fp) __INTRODUCED_IN(28);
+int fputc_unlocked(int __ch, FILE* _Nonnull __fp) __INTRODUCED_IN(28);
+size_t fread_unlocked(void* _Nonnull __buf, size_t __size, size_t __count, FILE* _Nonnull __fp) __INTRODUCED_IN(28);
+size_t fwrite_unlocked(const void* _Nonnull __buf, size_t __size, size_t __count, FILE* _Nonnull __fp) __INTRODUCED_IN(28);
#endif
#if defined(__USE_GNU)
-int fputs_unlocked(const char* __s, FILE* __fp) __INTRODUCED_IN(28);
-char* fgets_unlocked(char* __buf, int __size, FILE* __fp) __INTRODUCED_IN(28);
+int fputs_unlocked(const char* _Nonnull __s, FILE* _Nonnull __fp) __INTRODUCED_IN(28);
+char* _Nullable fgets_unlocked(char* _Nonnull __buf, int __size, FILE* _Nonnull __fp) __INTRODUCED_IN(28);
#endif
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
diff --git a/libc/include/stdio_ext.h b/libc/include/stdio_ext.h
index 3aa183d..8b106a6 100644
--- a/libc/include/stdio_ext.h
+++ b/libc/include/stdio_ext.h
@@ -44,7 +44,7 @@
*
* Available since API level 23.
*/
-size_t __fbufsize(FILE* __fp) __INTRODUCED_IN(23);
+size_t __fbufsize(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
/**
* [__freadable(3)](http://man7.org/linux/man-pages/man3/__freadable.3.html) returns non-zero if
@@ -52,7 +52,7 @@
*
* Available since API level 23.
*/
-int __freadable(FILE* __fp) __INTRODUCED_IN(23);
+int __freadable(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
/**
* [__freading(3)](http://man7.org/linux/man-pages/man3/__freading.3.html) returns non-zero if
@@ -60,7 +60,7 @@
*
* Available since API level 28.
*/
-int __freading(FILE* __fp) __INTRODUCED_IN(28);
+int __freading(FILE* _Nonnull __fp) __INTRODUCED_IN(28);
/**
* [__fwritable(3)](http://man7.org/linux/man-pages/man3/__fwritable.3.html) returns non-zero if
@@ -68,7 +68,7 @@
*
* Available since API level 23.
*/
-int __fwritable(FILE* __fp) __INTRODUCED_IN(23);
+int __fwritable(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
/**
* [__fwriting(3)](http://man7.org/linux/man-pages/man3/__fwriting.3.html) returns non-zero if
@@ -76,7 +76,7 @@
*
* Available since API level 28.
*/
-int __fwriting(FILE* __fp) __INTRODUCED_IN(28);
+int __fwriting(FILE* _Nonnull __fp) __INTRODUCED_IN(28);
/**
* [__flbf(3)](http://man7.org/linux/man-pages/man3/__flbf.3.html) returns non-zero if
@@ -84,7 +84,7 @@
*
* Available since API level 23.
*/
-int __flbf(FILE* __fp) __INTRODUCED_IN(23);
+int __flbf(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
/**
* [__fpurge(3)](http://man7.org/linux/man-pages/man3/__fpurge.3.html) discards the contents of
@@ -92,15 +92,23 @@
*
* Available since API level 23.
*/
-void __fpurge(FILE* __fp) __INTRODUCED_IN(23);
+void __fpurge(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
/**
* [__fpending(3)](http://man7.org/linux/man-pages/man3/__fpending.3.html) returns the number of
- * bytes in the output buffer.
+ * bytes in the output buffer. See __freadahead() for the input buffer.
*
* Available since API level 23.
*/
-size_t __fpending(FILE* __fp) __INTRODUCED_IN(23);
+size_t __fpending(FILE* _Nonnull __fp) __INTRODUCED_IN(23);
+
+/**
+ * __freadahead(3) returns the number of bytes in the input buffer.
+ * See __fpending() for the output buffer.
+ *
+ * Available since API level 34.
+ */
+size_t __freadahead(FILE* _Nonnull __fp) __INTRODUCED_IN(34);
/**
* [_flushlbf(3)](http://man7.org/linux/man-pages/man3/_flushlbf.3.html) flushes all
@@ -116,7 +124,7 @@
*
* Available since API level 28.
*/
-void __fseterr(FILE* __fp) __INTRODUCED_IN(28);
+void __fseterr(FILE* _Nonnull __fp) __INTRODUCED_IN(28);
/** __fsetlocking() constant to query locking type. */
#define FSETLOCKING_QUERY 0
@@ -133,6 +141,6 @@
*
* Available since API level 23.
*/
-int __fsetlocking(FILE* __fp, int __type) __INTRODUCED_IN(23);
+int __fsetlocking(FILE* _Nonnull __fp, int __type) __INTRODUCED_IN(23);
__END_DECLS
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index 4aa27f9..2bcb870 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -43,88 +43,84 @@
__noreturn void abort(void) __attribute__((__nomerge__));
__noreturn void exit(int __status);
-#if __ANDROID_API__ >= 21
__noreturn void _Exit(int __status) __INTRODUCED_IN(21);
-#else
-__noreturn void _Exit(int) __RENAME(_exit);
-#endif
-int atexit(void (*__fn)(void));
+int atexit(void (* _Nonnull __fn)(void));
-int at_quick_exit(void (*__fn)(void)) __INTRODUCED_IN(21);
+int at_quick_exit(void (* _Nonnull __fn)(void)) __INTRODUCED_IN(21);
void quick_exit(int __status) __noreturn __INTRODUCED_IN(21);
-char* getenv(const char* __name);
-int putenv(char* __assignment);
-int setenv(const char* __name, const char* __value, int __overwrite);
-int unsetenv(const char* __name);
+char* _Nullable getenv(const char* _Nonnull __name);
+int putenv(char* _Nonnull __assignment);
+int setenv(const char* _Nonnull __name, const char* _Nonnull __value, int __overwrite);
+int unsetenv(const char* _Nonnull __name);
int clearenv(void);
-char* mkdtemp(char* __template);
-char* mktemp(char* __template) __attribute__((deprecated("mktemp is unsafe, use mkstemp or tmpfile instead")));
+char* _Nullable mkdtemp(char* _Nonnull __template);
+char* _Nullable mktemp(char* _Nonnull __template) __attribute__((deprecated("mktemp is unsafe, use mkstemp or tmpfile instead")));
-int mkostemp64(char* __template, int __flags) __INTRODUCED_IN(23);
-int mkostemp(char* __template, int __flags) __INTRODUCED_IN(23);
-int mkostemps64(char* __template, int __suffix_length, int __flags) __INTRODUCED_IN(23);
-int mkostemps(char* __template, int __suffix_length, int __flags) __INTRODUCED_IN(23);
-int mkstemp64(char* __template) __INTRODUCED_IN(21);
-int mkstemp(char* __template);
-int mkstemps64(char* __template, int __flags) __INTRODUCED_IN(23);
-int mkstemps(char* __template, int __flags);
+int mkostemp64(char* _Nonnull __template, int __flags) __INTRODUCED_IN(23);
+int mkostemp(char* _Nonnull __template, int __flags) __INTRODUCED_IN(23);
+int mkostemps64(char* _Nonnull __template, int __suffix_length, int __flags) __INTRODUCED_IN(23);
+int mkostemps(char* _Nonnull __template, int __suffix_length, int __flags) __INTRODUCED_IN(23);
+int mkstemp64(char* _Nonnull __template) __INTRODUCED_IN(21);
+int mkstemp(char* _Nonnull __template);
+int mkstemps64(char* _Nonnull __template, int __flags) __INTRODUCED_IN(23);
+int mkstemps(char* _Nonnull __template, int __flags);
-long strtol(const char* __s, char** __end_ptr, int __base);
-long long strtoll(const char* __s, char** __end_ptr, int __base);
-unsigned long strtoul(const char* __s, char** __end_ptr, int __base);
-unsigned long long strtoull(const char* __s, char** __end_ptr, int __base);
+long strtol(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base);
+long long strtoll(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base);
+unsigned long strtoul(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base);
+unsigned long long strtoull(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base);
-int posix_memalign(void** __memptr, size_t __alignment, size_t __size) __INTRODUCED_IN(17);
+int posix_memalign(void* _Nullable * _Nullable __memptr, size_t __alignment, size_t __size) __INTRODUCED_IN(17);
-void* aligned_alloc(size_t __alignment, size_t __size) __INTRODUCED_IN(28);
+void* _Nullable aligned_alloc(size_t __alignment, size_t __size) __INTRODUCED_IN(28);
-double strtod(const char* __s, char** __end_ptr);
-long double strtold(const char* __s, char** __end_ptr) __RENAME_LDBL(strtod, 3, 21);
+double strtod(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr);
+long double strtold(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr) __RENAME_LDBL(strtod, 3, 21);
-unsigned long strtoul_l(const char* __s, char** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(26);
+unsigned long strtoul_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __INTRODUCED_IN(26);
-int atoi(const char* __s) __attribute_pure__;
-long atol(const char* __s) __attribute_pure__;
-long long atoll(const char* __s) __attribute_pure__;
+int atoi(const char* _Nonnull __s) __attribute_pure__;
+long atol(const char* _Nonnull __s) __attribute_pure__;
+long long atoll(const char* _Nonnull __s) __attribute_pure__;
-__wur char* realpath(const char* __path, char* __resolved);
-int system(const char* __command);
+__wur char* _Nullable realpath(const char* _Nonnull __path, char* _Nullable __resolved);
+int system(const char* _Nonnull __command);
-void* bsearch(const void* __key, const void* __base, size_t __nmemb, size_t __size, int (*__comparator)(const void* __lhs, const void* __rhs));
+void* _Nullable bsearch(const void* _Nonnull __key, const void* _Nullable __base, size_t __nmemb, size_t __size, int (* _Nonnull __comparator)(const void* _Nonnull __lhs, const void* _Nonnull __rhs));
-void qsort(void* __base, size_t __nmemb, size_t __size, int (*__comparator)(const void* __lhs, const void* __rhs));
+void qsort(void* _Nullable __base, size_t __nmemb, size_t __size, int (* _Nonnull __comparator)(const void* _Nullable __lhs, const void* _Nullable __rhs));
uint32_t arc4random(void);
uint32_t arc4random_uniform(uint32_t __upper_bound);
-void arc4random_buf(void* __buf, size_t __n);
+void arc4random_buf(void* _Nonnull __buf, size_t __n);
#define RAND_MAX 0x7fffffff
-int rand_r(unsigned int* __seed_ptr) __INTRODUCED_IN(21);
+int rand_r(unsigned int* _Nonnull __seed_ptr) __INTRODUCED_IN(21);
double drand48(void);
-double erand48(unsigned short __xsubi[3]);
-long jrand48(unsigned short __xsubi[3]);
-void lcong48(unsigned short __param[7]) __INTRODUCED_IN(23);
+double erand48(unsigned short __xsubi[_Nonnull 3]);
+long jrand48(unsigned short __xsubi[_Nonnull 3]);
+void lcong48(unsigned short __param[_Nonnull 7]) __INTRODUCED_IN(23);
long lrand48(void);
long mrand48(void);
-long nrand48(unsigned short __xsubi[3]);
-unsigned short* seed48(unsigned short __seed16v[3]);
+long nrand48(unsigned short __xsubi[_Nonnull 3]);
+unsigned short* _Nonnull seed48(unsigned short __seed16v[_Nonnull 3]);
void srand48(long __seed);
-char* initstate(unsigned int __seed, char* __state, size_t __n) __INTRODUCED_IN(21);
-char* setstate(char* __state) __INTRODUCED_IN(21);
+char* _Nullable initstate(unsigned int __seed, char* _Nonnull __state, size_t __n) __INTRODUCED_IN(21);
+char* _Nullable setstate(char* _Nonnull __state) __INTRODUCED_IN(21);
int getpt(void);
int posix_openpt(int __flags) __INTRODUCED_IN(21);
-char* ptsname(int __fd);
-int ptsname_r(int __fd, char* __buf, size_t __n);
+char* _Nullable ptsname(int __fd);
+int ptsname_r(int __fd, char* _Nonnull __buf, size_t __n);
int unlockpt(int __fd);
-int getsubopt(char** __option, char* const* __tokens, char** __value_ptr) __INTRODUCED_IN(26);
+int getsubopt(char* _Nonnull * _Nonnull __option, char* _Nonnull const* _Nonnull __tokens, char* _Nullable * _Nonnull __value_ptr) __INTRODUCED_IN(26);
typedef struct {
int quot;
@@ -154,63 +150,46 @@
*
* Returns the number of samples written to `__averages` (at most 3), and returns -1 on failure.
*/
-int getloadavg(double __averages[], int __n) __INTRODUCED_IN(29);
+int getloadavg(double __averages[_Nonnull], int __n) __INTRODUCED_IN(29);
/* BSD compatibility. */
-const char* getprogname(void) __INTRODUCED_IN(21);
-void setprogname(const char* __name) __INTRODUCED_IN(21);
+const char* _Nullable getprogname(void) __INTRODUCED_IN(21);
+void setprogname(const char* _Nonnull __name) __INTRODUCED_IN(21);
-int mblen(const char* __s, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(26);
-size_t mbstowcs(wchar_t* __dst, const char* __src, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
-int mbtowc(wchar_t* __wc_ptr, const char* __s, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
-int wctomb(char* __dst, wchar_t __wc) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
+int mblen(const char* _Nullable __s, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(26);
+size_t mbstowcs(wchar_t* _Nullable __dst, const char* _Nullable __src, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
+int mbtowc(wchar_t* _Nullable __wc_ptr, const char* _Nullable __s, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
+int wctomb(char* _Nullable __dst, wchar_t __wc) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
-size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
+size_t wcstombs(char* _Nullable __dst, const wchar_t* _Nullable __src, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
-#if __ANDROID_API__ >= 21
size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21);
#define MB_CUR_MAX __ctype_get_mb_cur_max()
-#else
-/*
- * Pre-L we didn't have any locale support and so we were always the POSIX
- * locale. POSIX specifies that MB_CUR_MAX for the POSIX locale is 1:
- * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html
- */
-#define MB_CUR_MAX 1
-#endif
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
#include <bits/fortify/stdlib.h>
#endif
-#if __ANDROID_API__ >= 19
int abs(int __x) __attribute_const__ __INTRODUCED_IN(19);
long labs(long __x) __attribute_const__ __INTRODUCED_IN(19);
long long llabs(long long __x) __attribute_const__ __INTRODUCED_IN(19);
-#else
-// Implemented as static inlines before 19.
-#endif
-#if __ANDROID_API__ >= 21
-float strtof(const char* __s, char** __end_ptr) __INTRODUCED_IN(21);
-double atof(const char* __s) __attribute_pure__ __INTRODUCED_IN(21);
+float strtof(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr) __INTRODUCED_IN(21);
+double atof(const char* _Nonnull __s) __attribute_pure__ __INTRODUCED_IN(21);
int rand(void) __INTRODUCED_IN(21);
void srand(unsigned int __seed) __INTRODUCED_IN(21);
long random(void) __INTRODUCED_IN(21);
void srandom(unsigned int __seed) __INTRODUCED_IN(21);
int grantpt(int __fd) __INTRODUCED_IN(21);
-long long strtoll_l(const char* __s, char** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
-unsigned long long strtoull_l(const char* __s, char** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
-long double strtold_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODUCED_IN(21);
-#else
-// Implemented as static inlines before 21.
-#endif
+long long strtoll_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+unsigned long long strtoull_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+long double strtold_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) __INTRODUCED_IN(21);
#if __ANDROID_API__ >= 26
-double strtod_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODUCED_IN(26);
-float strtof_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODUCED_IN(26);
-long strtol_l(const char* __s, char** __end_ptr, int, locale_t __l) __INTRODUCED_IN(26);
+double strtod_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) __INTRODUCED_IN(26);
+float strtof_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) __INTRODUCED_IN(26);
+long strtol_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int, locale_t _Nonnull __l) __INTRODUCED_IN(26);
#else
// Implemented as static inlines before 26.
#endif
diff --git a/libc/include/string.h b/libc/include/string.h
index 0cc5611..d6b2967 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -41,90 +41,103 @@
#include <strings.h>
#endif
-void* memccpy(void* __dst, const void* __src, int __stop_char, size_t __n);
-void* memchr(const void* __s, int __ch, size_t __n) __attribute_pure__;
+void* _Nullable memccpy(void* _Nonnull __dst, const void* _Nonnull __src, int __stop_char, size_t __n);
+void* _Nullable memchr(const void* _Nonnull __s, int __ch, size_t __n) __attribute_pure__;
#if defined(__cplusplus)
-extern "C++" void* memrchr(void* __s, int __ch, size_t __n) __RENAME(memrchr) __attribute_pure__;
-extern "C++" const void* memrchr(const void* __s, int __ch, size_t __n) __RENAME(memrchr) __attribute_pure__;
+extern "C++" void* _Nullable memrchr(void* _Nonnull __s, int __ch, size_t __n) __RENAME(memrchr) __attribute_pure__;
+extern "C++" const void* _Nullable memrchr(const void* _Nonnull __s, int __ch, size_t __n) __RENAME(memrchr) __attribute_pure__;
#else
-void* memrchr(const void* __s, int __ch, size_t __n) __attribute_pure__;
+void* _Nullable memrchr(const void* _Nonnull __s, int __ch, size_t __n) __attribute_pure__;
#endif
-int memcmp(const void* __lhs, const void* __rhs, size_t __n) __attribute_pure__;
-void* memcpy(void*, const void*, size_t);
+int memcmp(const void* _Nonnull __lhs, const void* _Nonnull __rhs, size_t __n) __attribute_pure__;
+void* _Nonnull memcpy(void* _Nonnull, const void* _Nonnull, size_t);
#if defined(__USE_GNU)
-void* mempcpy(void* __dst, const void* __src, size_t __n) __INTRODUCED_IN(23);
+void* _Nonnull mempcpy(void* _Nonnull __dst, const void* _Nonnull __src, size_t __n) __INTRODUCED_IN(23);
#endif
-void* memmove(void* __dst, const void* __src, size_t __n);
-void* memset(void* __dst, int __ch, size_t __n);
-void* memmem(const void* __haystack, size_t __haystack_size, const void* __needle, size_t __needle_size) __attribute_pure__;
+void* _Nonnull memmove(void* _Nonnull __dst, const void* _Nonnull __src, size_t __n);
-char* strchr(const char* __s, int __ch) __attribute_pure__;
-char* __strchr_chk(const char* __s, int __ch, size_t __n) __INTRODUCED_IN(18);
+/**
+ * [memset(3)](http://man7.org/linux/man-pages/man3/memset.3.html) writes the
+ * bottom 8 bits of the given int to the next `n` bytes of `dst`.
+ *
+ * Returns `dst`.
+ */
+void* _Nonnull memset(void* _Nonnull __dst, int __ch, size_t __n);
+
+/**
+ * [memset_explicit(3)](http://man7.org/linux/man-pages/man3/memset_explicit.3.html)
+ * writes the bottom 8 bits of the given int to the next `n` bytes of `dst`,
+ * but won't be optimized out by the compiler.
+ *
+ * Returns `dst`.
+ */
+void* _Nonnull memset_explicit(void* _Nonnull __dst, int __ch, size_t __n) __INTRODUCED_IN(34);
+
+void* _Nullable memmem(const void* _Nonnull __haystack, size_t __haystack_size, const void* _Nonnull __needle, size_t __needle_size) __attribute_pure__;
+
+char* _Nullable strchr(const char* _Nonnull __s, int __ch) __attribute_pure__;
+char* _Nullable __strchr_chk(const char* _Nonnull __s, int __ch, size_t __n) __INTRODUCED_IN(18);
#if defined(__USE_GNU)
#if defined(__cplusplus)
-extern "C++" char* strchrnul(char* __s, int __ch) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
-extern "C++" const char* strchrnul(const char* __s, int __ch) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
+extern "C++" char* _Nonnull strchrnul(char* _Nonnull __s, int __ch) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
+extern "C++" const char* _Nonnull strchrnul(const char* _Nonnull __s, int __ch) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
#else
-char* strchrnul(const char* __s, int __ch) __attribute_pure__ __INTRODUCED_IN(24);
+char* _Nonnull strchrnul(const char* _Nonnull __s, int __ch) __attribute_pure__ __INTRODUCED_IN(24);
#endif
#endif
-char* strrchr(const char* __s, int __ch) __attribute_pure__;
-char* __strrchr_chk(const char* __s, int __ch, size_t __n) __INTRODUCED_IN(18);
+char* _Nullable strrchr(const char* _Nonnull __s, int __ch) __attribute_pure__;
+char* _Nullable __strrchr_chk(const char* _Nonnull __s, int __ch, size_t __n) __INTRODUCED_IN(18);
-size_t strlen(const char* __s) __attribute_pure__;
-size_t __strlen_chk(const char* __s, size_t __n) __INTRODUCED_IN(17);
+size_t strlen(const char* _Nonnull __s) __attribute_pure__;
+size_t __strlen_chk(const char* _Nonnull __s, size_t __n) __INTRODUCED_IN(17);
-int strcmp(const char* __lhs, const char* __rhs) __attribute_pure__;
-char* stpcpy(char* __dst, const char* __src) __INTRODUCED_IN(21);
-char* strcpy(char* __dst, const char* __src);
-char* strcat(char* __dst, const char* __src);
-char* strdup(const char* __s);
+int strcmp(const char* _Nonnull __lhs, const char* _Nonnull __rhs) __attribute_pure__;
+char* _Nonnull stpcpy(char* _Nonnull __dst, const char* _Nonnull __src) __INTRODUCED_IN(21);
+char* _Nonnull strcpy(char* _Nonnull __dst, const char* _Nonnull __src);
+char* _Nonnull strcat(char* _Nonnull __dst, const char* _Nonnull __src);
+char* _Nullable strdup(const char* _Nonnull __s);
-char* strstr(const char* __haystack, const char* __needle) __attribute_pure__;
+char* _Nullable strstr(const char* _Nonnull __haystack, const char* _Nonnull __needle) __attribute_pure__;
#if defined(__cplusplus)
-extern "C++" char* strcasestr(char*, const char*) __RENAME(strcasestr) __attribute_pure__;
-extern "C++" const char* strcasestr(const char*, const char*) __RENAME(strcasestr) __attribute_pure__;
+extern "C++" char* _Nullable strcasestr(char* _Nonnull, const char* _Nonnull) __RENAME(strcasestr) __attribute_pure__;
+extern "C++" const char* _Nullable strcasestr(const char* _Nonnull, const char* _Nonnull) __RENAME(strcasestr) __attribute_pure__;
#else
-char* strcasestr(const char* __haystack, const char* __needle) __attribute_pure__;
+char* _Nullable strcasestr(const char* _Nonnull __haystack, const char* _Nonnull __needle) __attribute_pure__;
#endif
-char* strtok(char* __s, const char* __delimiter);
-char* strtok_r(char* __s, const char* __delimiter, char** __pos_ptr);
+char* _Nullable strtok(char* _Nullable __s, const char* _Nonnull __delimiter);
+char* _Nullable strtok_r(char* _Nullable __s, const char* _Nonnull __delimiter, char* _Nonnull * _Nonnull __pos_ptr);
-char* strerror(int __errno_value);
-char* strerror_l(int __errno_value, locale_t __l) __INTRODUCED_IN(23);
+char* _Nonnull strerror(int __errno_value);
+char* _Nonnull strerror_l(int __errno_value, locale_t _Nonnull __l) __INTRODUCED_IN(23);
#if defined(__USE_GNU) && __ANDROID_API__ >= 23
-char* strerror_r(int __errno_value, char* __buf, size_t __n) __RENAME(__gnu_strerror_r) __INTRODUCED_IN(23);
+char* _Nonnull strerror_r(int __errno_value, char* _Nullable __buf, size_t __n) __RENAME(__gnu_strerror_r) __INTRODUCED_IN(23);
#else /* POSIX */
-int strerror_r(int __errno_value, char* __buf, size_t __n);
+int strerror_r(int __errno_value, char* _Nonnull __buf, size_t __n);
#endif
-size_t strnlen(const char* __s, size_t __n) __attribute_pure__;
-char* strncat(char* __dst, const char* __src, size_t __n);
-char* strndup(const char* __s, size_t __n);
-int strncmp(const char* __lhs, const char* __rhs, size_t __n) __attribute_pure__;
-char* stpncpy(char* __dst, const char* __src, size_t __n) __INTRODUCED_IN(21);
-char* strncpy(char* __dst, const char* __src, size_t __n);
+size_t strnlen(const char* _Nonnull __s, size_t __n) __attribute_pure__;
+char* _Nonnull strncat(char* _Nonnull __dst, const char* _Nonnull __src, size_t __n);
+char* _Nullable strndup(const char* _Nonnull __s, size_t __n);
+int strncmp(const char* _Nonnull __lhs, const char* _Nonnull __rhs, size_t __n) __attribute_pure__;
+char* _Nonnull stpncpy(char* _Nonnull __dst, const char* _Nonnull __src, size_t __n) __INTRODUCED_IN(21);
+char* _Nonnull strncpy(char* _Nonnull __dst, const char* _Nonnull __src, size_t __n);
-size_t strlcat(char* __dst, const char* __src, size_t __n);
-size_t strlcpy(char* __dst, const char* __src, size_t __n);
+size_t strlcat(char* _Nonnull __dst, const char* _Nonnull __src, size_t __n);
+size_t strlcpy(char* _Nonnull __dst, const char* _Nonnull __src, size_t __n);
-size_t strcspn(const char* __s, const char* __reject) __attribute_pure__;
-char* strpbrk(const char* __s, const char* __accept) __attribute_pure__;
-char* strsep(char** __s_ptr, const char* __delimiter);
-size_t strspn(const char* __s, const char* __accept);
+size_t strcspn(const char* _Nonnull __s, const char* _Nonnull __reject) __attribute_pure__;
+char* _Nullable strpbrk(const char* _Nonnull __s, const char* _Nonnull __accept) __attribute_pure__;
+char* _Nullable strsep(char* _Nullable * _Nonnull __s_ptr, const char* _Nonnull __delimiter);
+size_t strspn(const char* _Nonnull __s, const char* _Nonnull __accept);
-char* strsignal(int __signal);
+char* _Nonnull strsignal(int __signal);
-int strcoll(const char* __lhs, const char* __rhs) __attribute_pure__;
-size_t strxfrm(char* __dst, const char* __src, size_t __n);
+int strcoll(const char* _Nonnull __lhs, const char* _Nonnull __rhs) __attribute_pure__;
+size_t strxfrm(char* __BIONIC_COMPLICATED_NULLNESS __dst, const char* _Nonnull __src, size_t __n);
-#if __ANDROID_API__ >= 21
-int strcoll_l(const char* __lhs, const char* __rhs, locale_t __l) __attribute_pure__ __INTRODUCED_IN(21);
-size_t strxfrm_l(char* __dst, const char* __src, size_t __n, locale_t __l) __INTRODUCED_IN(21);
-#else
-// Implemented as static inlines before 21.
-#endif
+int strcoll_l(const char* _Nonnull __lhs, const char* _Nonnull __rhs, locale_t _Nonnull __l) __attribute_pure__ __INTRODUCED_IN(21);
+size_t strxfrm_l(char* __BIONIC_COMPLICATED_NULLNESS __dst, const char* _Nonnull __src, size_t __n, locale_t _Nonnull __l) __INTRODUCED_IN(21);
#if defined(__USE_GNU) && !defined(basename)
/*
@@ -132,10 +145,10 @@
* It doesn't modify its argument, and in C++ it's const-correct.
*/
#if defined(__cplusplus)
-extern "C++" char* basename(char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
-extern "C++" const char* basename(const char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
+extern "C++" char* _Nonnull basename(char* _Nullable __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
+extern "C++" const char* _Nonnull basename(const char* _Nonnull __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
#else
-char* basename(const char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
+char* _Nonnull basename(const char* _Nonnull __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
#endif
#endif
@@ -152,77 +165,77 @@
#define __prefer_this_overload __enable_if(true, "preferred overload") __enable_if(true, "")
extern "C++" {
inline __always_inline
-void* __bionic_memchr(const void* const s __pass_object_size, int c, size_t n) {
+void* _Nullable __bionic_memchr(const void* _Nonnull const s __pass_object_size, int c, size_t n) {
return memchr(s, c, n);
}
inline __always_inline
-const void* memchr(const void* const s __pass_object_size, int c, size_t n)
+const void* _Nullable memchr(const void* _Nonnull const s __pass_object_size, int c, size_t n)
__prefer_this_overload {
return __bionic_memchr(s, c, n);
}
inline __always_inline
-void* memchr(void* const s __pass_object_size, int c, size_t n) __prefer_this_overload {
+void* _Nullable memchr(void* _Nonnull const s __pass_object_size, int c, size_t n) __prefer_this_overload {
return __bionic_memchr(s, c, n);
}
inline __always_inline
-char* __bionic_strchr(const char* const s __pass_object_size, int c) {
+char* _Nullable __bionic_strchr(const char* _Nonnull const s __pass_object_size, int c) {
return strchr(s, c);
}
inline __always_inline
-const char* strchr(const char* const s __pass_object_size, int c)
+const char* _Nullable strchr(const char* _Nonnull const s __pass_object_size, int c)
__prefer_this_overload {
return __bionic_strchr(s, c);
}
inline __always_inline
-char* strchr(char* const s __pass_object_size, int c)
+char* _Nullable strchr(char* _Nonnull const s __pass_object_size, int c)
__prefer_this_overload {
return __bionic_strchr(s, c);
}
inline __always_inline
-char* __bionic_strrchr(const char* const s __pass_object_size, int c) {
+char* _Nullable __bionic_strrchr(const char* _Nonnull const s __pass_object_size, int c) {
return strrchr(s, c);
}
inline __always_inline
-const char* strrchr(const char* const s __pass_object_size, int c) __prefer_this_overload {
+const char* _Nullable strrchr(const char* _Nonnull const s __pass_object_size, int c) __prefer_this_overload {
return __bionic_strrchr(s, c);
}
inline __always_inline
-char* strrchr(char* const s __pass_object_size, int c) __prefer_this_overload {
+char* _Nullable strrchr(char* _Nonnull const s __pass_object_size, int c) __prefer_this_overload {
return __bionic_strrchr(s, c);
}
/* Functions with no FORTIFY counterpart. */
inline __always_inline
-char* __bionic_strstr(const char* h, const char* n) { return strstr(h, n); }
+char* _Nullable __bionic_strstr(const char* _Nonnull h, const char* _Nonnull n) { return strstr(h, n); }
inline __always_inline
-const char* strstr(const char* h, const char* n) __prefer_this_overload {
+const char* _Nullable strstr(const char* _Nonnull h, const char* _Nonnull n) __prefer_this_overload {
return __bionic_strstr(h, n);
}
inline __always_inline
-char* strstr(char* h, const char* n) __prefer_this_overload {
+char* _Nullable strstr(char* _Nonnull h, const char* _Nonnull n) __prefer_this_overload {
return __bionic_strstr(h, n);
}
inline __always_inline
-char* __bionic_strpbrk(const char* h, const char* n) { return strpbrk(h, n); }
+char* _Nullable __bionic_strpbrk(const char* _Nonnull h, const char* _Nonnull n) { return strpbrk(h, n); }
inline __always_inline
-char* strpbrk(char* h, const char* n) __prefer_this_overload {
+char* _Nullable strpbrk(char* _Nonnull h, const char* _Nonnull n) __prefer_this_overload {
return __bionic_strpbrk(h, n);
}
inline __always_inline
-const char* strpbrk(const char* h, const char* n) __prefer_this_overload {
+const char* _Nullable strpbrk(const char* _Nonnull h, const char* _Nonnull n) __prefer_this_overload {
return __bionic_strpbrk(h, n);
}
}
diff --git a/libc/include/strings.h b/libc/include/strings.h
index ff6b925..2f4f764 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -61,13 +61,13 @@
/** Deprecated. Use memmove() instead. */
#define bcopy(b1, b2, len) __bionic_bcopy((b1), (b2), (len))
-static __inline__ __always_inline void __bionic_bcopy(const void* b1, void* b2, size_t len) {
+static __inline__ __always_inline void __bionic_bcopy(const void* _Nonnull b1, void* _Nonnull b2, size_t len) {
__builtin_memmove(b2, b1, len);
}
/** Deprecated. Use memset() instead. */
#define bzero(b, len) __bionic_bzero((b), (len))
-static __inline__ __always_inline void __bionic_bzero(void* b, size_t len) {
+static __inline__ __always_inline void __bionic_bzero(void* _Nonnull b, size_t len) {
__builtin_memset(b, 0, len);
}
diff --git a/libc/include/sys/_system_properties.h b/libc/include/sys/_system_properties.h
index 744a45b..c7a30eb 100644
--- a/libc/include/sys/_system_properties.h
+++ b/libc/include/sys/_system_properties.h
@@ -41,6 +41,7 @@
__BEGIN_DECLS
#define PROP_SERVICE_NAME "property_service"
+#define PROP_SERVICE_FOR_SYSTEM_NAME "property_service_for_system"
#define PROP_FILENAME "/dev/__properties__"
#define PROP_MSG_SETPROP 1
diff --git a/libc/include/sys/capability.h b/libc/include/sys/capability.h
index 4cb698f..b43bbf0 100644
--- a/libc/include/sys/capability.h
+++ b/libc/include/sys/capability.h
@@ -44,7 +44,7 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int capget(cap_user_header_t __hdr_ptr, cap_user_data_t __data_ptr);
+int capget(cap_user_header_t _Nonnull __hdr_ptr, cap_user_data_t _Nullable __data_ptr);
/**
* [capset(2)](http://man7.org/linux/man-pages/man2/capset.2.html) sets the calling
@@ -52,6 +52,6 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int capset(cap_user_header_t __hdr_ptr, const cap_user_data_t __data_ptr);
+int capset(cap_user_header_t _Nonnull __hdr_ptr, const cap_user_data_t _Nullable __data_ptr);
__END_DECLS
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 5b9d99b..484757e 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -63,6 +63,14 @@
#define __BIONIC_ALIGN(__value, __alignment) (((__value) + (__alignment)-1) & ~((__alignment)-1))
/*
+ * The nullness constraints of this parameter or return value are
+ * quite complex. This is used to highlight spots where developers
+ * are encouraged to read relevant manuals or code to understand
+ * the full picture of nullness for this pointer.
+ */
+#define __BIONIC_COMPLICATED_NULLNESS _Null_unspecified
+
+/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
diff --git a/libc/include/sys/epoll.h b/libc/include/sys/epoll.h
index 3745737..9e09408 100644
--- a/libc/include/sys/epoll.h
+++ b/libc/include/sys/epoll.h
@@ -40,25 +40,10 @@
int epoll_create(int __size);
int epoll_create1(int __flags) __INTRODUCED_IN(21);
-/*
- * Some third-party code uses the existence of EPOLL_CLOEXEC to detect the
- * availability of epoll_create1. This is not correct, since having up-to-date
- * UAPI headers says nothing about the C library, but for the time being we
- * don't want to harm adoption to the unified headers. We'll undef EPOLL_CLOEXEC
- * if we don't have epoll_create1 for the time being, and maybe revisit this
- * later.
- *
- * https://github.com/android-ndk/ndk/issues/302
- * https://github.com/android-ndk/ndk/issues/394
- */
-#if __ANDROID_API__ < 21 && defined(EPOLL_CLOEXEC)
-#undef EPOLL_CLOEXEC
-#endif
-
-int epoll_ctl(int __epoll_fd, int __op, int __fd, struct epoll_event* __event);
-int epoll_wait(int __epoll_fd, struct epoll_event* __events, int __event_count, int __timeout_ms);
-int epoll_pwait(int __epoll_fd, struct epoll_event* __events, int __event_count, int __timeout_ms, const sigset_t* __mask) __INTRODUCED_IN(21);
-int epoll_pwait64(int __epoll_fd, struct epoll_event* __events, int __event_count, int __timeout_ms, const sigset64_t* __mask) __INTRODUCED_IN(28);
+int epoll_ctl(int __epoll_fd, int __op, int __fd, struct epoll_event* __BIONIC_COMPLICATED_NULLNESS __event);
+int epoll_wait(int __epoll_fd, struct epoll_event* _Nonnull __events, int __event_count, int __timeout_ms);
+int epoll_pwait(int __epoll_fd, struct epoll_event* _Nonnull __events, int __event_count, int __timeout_ms, const sigset_t* _Nullable __mask) __INTRODUCED_IN(21);
+int epoll_pwait64(int __epoll_fd, struct epoll_event* _Nonnull __events, int __event_count, int __timeout_ms, const sigset64_t* _Nullable __mask) __INTRODUCED_IN(28);
__END_DECLS
diff --git a/libc/include/sys/eventfd.h b/libc/include/sys/eventfd.h
index 1b6ad29..1ad11e3 100644
--- a/libc/include/sys/eventfd.h
+++ b/libc/include/sys/eventfd.h
@@ -62,7 +62,7 @@
*
* Returns 0 on success, or returns -1 otherwise.
*/
-int eventfd_read(int __fd, eventfd_t* __value);
+int eventfd_read(int __fd, eventfd_t* _Nonnull __value);
/**
* [eventfd_write(3)](http://man7.org/linux/man-pages/man2/eventfd.2.html) is a convenience
diff --git a/libc/include/sys/inotify.h b/libc/include/sys/inotify.h
index 37fbf99..e834d07 100644
--- a/libc/include/sys/inotify.h
+++ b/libc/include/sys/inotify.h
@@ -37,25 +37,12 @@
__BEGIN_DECLS
-/*
- * Some third-party code uses the existence of IN_CLOEXEC/IN_NONBLOCK to detect
- * the availability of inotify_init1. This is not correct, since
- * `syscall(__NR_inotify_init1, IN_CLOEXEC)` is still valid even if the C
- * library doesn't have that function, but for the time being we don't want to
- * harm adoption to the unified headers. We'll avoid defining IN_CLOEXEC and
- * IN_NONBLOCK if we don't have inotify_init1 for the time being, and maybe
- * revisit this later.
- *
- * https://github.com/android-ndk/ndk/issues/394
- */
-#if __ANDROID_API__ >= 21
#define IN_CLOEXEC O_CLOEXEC
#define IN_NONBLOCK O_NONBLOCK
-#endif
int inotify_init(void);
int inotify_init1(int __flags) __INTRODUCED_IN(21);
-int inotify_add_watch(int __fd, const char* __path, uint32_t __mask);
+int inotify_add_watch(int __fd, const char* _Nonnull __path, uint32_t __mask);
int inotify_rm_watch(int __fd, uint32_t __watch_descriptor);
__END_DECLS
diff --git a/libc/include/sys/ipc.h b/libc/include/sys/ipc.h
index c81ec1a..2e2b8cf 100644
--- a/libc/include/sys/ipc.h
+++ b/libc/include/sys/ipc.h
@@ -52,6 +52,6 @@
*
* Returns a key on success, and returns -1 and sets `errno` on failure.
*/
-key_t ftok(const char* __path, int __id);
+key_t ftok(const char* _Nonnull __path, int __id);
__END_DECLS
diff --git a/libc/include/sys/klog.h b/libc/include/sys/klog.h
index b33d11b..b60c2c4 100644
--- a/libc/include/sys/klog.h
+++ b/libc/include/sys/klog.h
@@ -66,6 +66,6 @@
* This system call is not available to applications.
* Use syslog() or `<android/log.h>` instead.
*/
-int klogctl(int __type, char* __buf, int __buf_size);
+int klogctl(int __type, char* __BIONIC_COMPLICATED_NULLNESS __buf, int __buf_size);
__END_DECLS
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index 6ef0c12..bcf856d 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -55,17 +55,14 @@
void* mmap(void* __addr, size_t __size, int __prot, int __flags, int __fd, off_t __offset);
#endif
-#if __ANDROID_API__ >= 21
/**
* mmap64() is a variant of mmap() that takes a 64-bit offset even on LP32.
*
* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
*
- * mmap64 wasn't really around until L, but we added an inline for it since it
- * allows a lot more code to compile with _FILE_OFFSET_BITS=64.
+ * Available since API level 21.
*/
void* mmap64(void* __addr, size_t __size, int __prot, int __flags, int __fd, off64_t __offset) __INTRODUCED_IN(21);
-#endif
/**
* [munmap(2)](http://man7.org/linux/man-pages/man2/munmap.2.html)
@@ -110,6 +107,8 @@
* [mlockall(2)](http://man7.org/linux/man-pages/man2/mlockall.2.html)
* locks pages (preventing swapping).
*
+ * Available since API level 17.
+ *
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
int mlockall(int __flags) __INTRODUCED_IN(17);
@@ -118,6 +117,8 @@
* [munlockall(2)](http://man7.org/linux/man-pages/man2/munlockall.2.html)
* unlocks pages (allowing swapping).
*
+ * Available since API level 17.
+ *
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
int munlockall(void) __INTRODUCED_IN(17);
@@ -134,6 +135,8 @@
* [mlock2(2)](http://man7.org/linux/man-pages/man2/mlock.2.html)
* locks pages (preventing swapping), with optional flags.
*
+ * Available since API level 30.
+ *
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
int mlock2(const void* __addr, size_t __size, int __flags) __INTRODUCED_IN(30);
@@ -167,9 +170,14 @@
* works just like madvise(2) but applies to the process specified by the given
* PID file descriptor.
*
+ * Available since API level 31. Its sibling process_mrelease() does not have a
+ * libc wrapper and should be called using syscall() instead. Given the lack of
+ * widespread applicability of this system call and the absence of wrappers in
+ * other libcs, it was probably a mistake to have added this wrapper to bionic.
+ *
* Returns the number of bytes advised on success, and returns -1 and sets `errno` on failure.
*/
-ssize_t process_madvise(int __pid_fd, const struct iovec* __iov, size_t __count, int __advice, unsigned __flags);
+ssize_t process_madvise(int __pid_fd, const struct iovec* __iov, size_t __count, int __advice, unsigned __flags) __INTRODUCED_IN(31);
#if defined(__USE_GNU)
@@ -177,6 +185,8 @@
* [memfd_create(2)](http://man7.org/linux/man-pages/man2/memfd_create.2.html)
* creates an anonymous file.
*
+ * Available since API level 30.
+ *
* Returns an fd on success, and returns -1 and sets `errno` on failure.
*/
int memfd_create(const char* __name, unsigned __flags) __INTRODUCED_IN(30);
@@ -211,12 +221,11 @@
* [posix_madvise(3)](http://man7.org/linux/man-pages/man3/posix_madvise.3.html)
* gives the kernel advice about future usage patterns.
*
- * Returns 0 on success, and returns a positive error number on failure.
+ * Available since API level 23.
+ * See also madvise() which is available at all API levels.
*
- * See also madvise() which has been available much longer.
+ * Returns 0 on success, and returns a positive error number on failure.
*/
int posix_madvise(void* __addr, size_t __size, int __advice) __INTRODUCED_IN(23);
__END_DECLS
-
-#include <android/legacy_sys_mman_inlines.h>
diff --git a/libc/include/sys/mount.h b/libc/include/sys/mount.h
index 4db1ac1..aace205 100644
--- a/libc/include/sys/mount.h
+++ b/libc/include/sys/mount.h
@@ -55,7 +55,7 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int mount(const char* __source, const char* __target, const char* __fs_type, unsigned long __flags, const void* __data);
+int mount(const char* __BIONIC_COMPLICATED_NULLNESS __source, const char* _Nonnull __target, const char* __BIONIC_COMPLICATED_NULLNESS __fs_type, unsigned long __flags, const void* _Nullable __data);
/**
* [umount(2)](http://man7.org/linux/man-pages/man2/umount.2.html) unmounts the filesystem at
@@ -63,7 +63,7 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int umount(const char* __target);
+int umount(const char* _Nonnull __target);
/**
* [umount2(2)](http://man7.org/linux/man-pages/man2/umount2.2.html) unmounts the filesystem at
@@ -71,6 +71,6 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int umount2(const char* __target, int __flags);
+int umount2(const char* _Nonnull __target, int __flags);
__END_DECLS
diff --git a/libc/include/sys/msg.h b/libc/include/sys/msg.h
index e19452c..ad481a0 100644
--- a/libc/include/sys/msg.h
+++ b/libc/include/sys/msg.h
@@ -46,12 +46,12 @@
typedef __kernel_ulong_t msglen_t;
/** Not useful on Android; disallowed by SELinux. */
-int msgctl(int __msg_id, int __cmd, struct msqid_ds* __buf) __INTRODUCED_IN(26);
+int msgctl(int __msg_id, int __cmd, struct msqid_ds* _Nullable __buf) __INTRODUCED_IN(26);
/** Not useful on Android; disallowed by SELinux. */
int msgget(key_t __key, int __flags) __INTRODUCED_IN(26);
/** Not useful on Android; disallowed by SELinux. */
-ssize_t msgrcv(int __msg_id, void* __msgbuf_ptr, size_t __size, long __type, int __flags) __INTRODUCED_IN(26);
+ssize_t msgrcv(int __msg_id, void* _Nonnull __msgbuf_ptr, size_t __size, long __type, int __flags) __INTRODUCED_IN(26);
/** Not useful on Android; disallowed by SELinux. */
-int msgsnd(int __msg_id, const void* __msgbuf_ptr, size_t __size, int __flags) __INTRODUCED_IN(26);
+int msgsnd(int __msg_id, const void* _Nonnull __msgbuf_ptr, size_t __size, int __flags) __INTRODUCED_IN(26);
__END_DECLS
diff --git a/libc/include/sys/pidfd.h b/libc/include/sys/pidfd.h
index 6d0e809..30455bb 100644
--- a/libc/include/sys/pidfd.h
+++ b/libc/include/sys/pidfd.h
@@ -71,6 +71,6 @@
*
* Available since API level 31.
*/
-int pidfd_send_signal(int __pidfd, int __sig, siginfo_t *__info, unsigned int __flags) __INTRODUCED_IN(31);
+int pidfd_send_signal(int __pidfd, int __sig, siginfo_t * _Nullable __info, unsigned int __flags) __INTRODUCED_IN(31);
__END_DECLS
diff --git a/libc/include/sys/quota.h b/libc/include/sys/quota.h
index f8faee7..79c653d 100644
--- a/libc/include/sys/quota.h
+++ b/libc/include/sys/quota.h
@@ -51,6 +51,6 @@
*
* Available since API level 26.
*/
-int quotactl(int __cmd, const char* __special, int __id, char* __addr) __INTRODUCED_IN(26);
+int quotactl(int __cmd, const char* _Nullable __special, int __id, char* __BIONIC_COMPLICATED_NULLNESS __addr) __INTRODUCED_IN(26);
__END_DECLS
diff --git a/libc/include/sys/random.h b/libc/include/sys/random.h
index be52bd9..0251176 100644
--- a/libc/include/sys/random.h
+++ b/libc/include/sys/random.h
@@ -50,7 +50,7 @@
*
* See also arc4random_buf() which is available in all API levels.
*/
-int getentropy(void* __buffer, size_t __buffer_size) __wur __INTRODUCED_IN(28);
+int getentropy(void* _Nonnull __buffer, size_t __buffer_size) __wur __INTRODUCED_IN(28);
/**
* [getrandom(2)](http://man7.org/linux/man-pages/man2/getrandom.2.html) fills the given buffer
@@ -62,6 +62,6 @@
*
* See also arc4random_buf() which is available in all API levels.
*/
-ssize_t getrandom(void* __buffer, size_t __buffer_size, unsigned int __flags) __wur __INTRODUCED_IN(28);
+ssize_t getrandom(void* _Nonnull __buffer, size_t __buffer_size, unsigned int __flags) __wur __INTRODUCED_IN(28);
__END_DECLS
diff --git a/libc/include/sys/resource.h b/libc/include/sys/resource.h
index 9181125..ccb267d 100644
--- a/libc/include/sys/resource.h
+++ b/libc/include/sys/resource.h
@@ -41,6 +41,7 @@
#define RLIM_SAVED_MAX RLIM_INFINITY
typedef unsigned long rlim_t;
+typedef unsigned long long rlim64_t;
int getrlimit(int __resource, struct rlimit* __limit);
int setrlimit(int __resource, const struct rlimit* __limit);
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index 65571eb..8c6c2ff 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -71,16 +71,14 @@
} \
} while (0)
-void __FD_CLR_chk(int, fd_set*, size_t) __INTRODUCED_IN(21);
-void __FD_SET_chk(int, fd_set*, size_t) __INTRODUCED_IN(21);
-int __FD_ISSET_chk(int, const fd_set*, size_t) __INTRODUCED_IN(21);
+void __FD_CLR_chk(int, fd_set* _Nonnull , size_t) __INTRODUCED_IN(21);
+void __FD_SET_chk(int, fd_set* _Nonnull, size_t) __INTRODUCED_IN(21);
+int __FD_ISSET_chk(int, const fd_set* _Nonnull, size_t) __INTRODUCED_IN(21);
#define __FD_CLR(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] &= ~__FDMASK(fd))
#define __FD_SET(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] |= __FDMASK(fd))
#define __FD_ISSET(fd, set) ((__FDS_BITS(const fd_set*,set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
-#if __ANDROID_API__ >= 21
-
/** Removes `fd` from the given set. Use <poll.h> instead. */
#define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
/** Adds `fd` to the given set. Use <poll.h> instead. */
@@ -88,17 +86,6 @@
/** Tests whether `fd` is in the given set. Use <poll.h> instead. */
#define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
-#else
-
-/** Removes `fd` from the given set. Use <poll.h> instead. */
-#define FD_CLR(fd, set) __FD_CLR(fd, set)
-/** Adds `fd` to the given set. Use <poll.h> instead. */
-#define FD_SET(fd, set) __FD_SET(fd, set)
-/** Tests whether `fd` is in the given set. Use <poll.h> instead. */
-#define FD_ISSET(fd, set) __FD_ISSET(fd, set)
-
-#endif /* __ANDROID_API >= 21 */
-
/**
* [select(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
* set of file descriptors.
@@ -108,7 +95,7 @@
* Returns the number of ready file descriptors on success, 0 for timeout,
* and returns -1 and sets `errno` on failure.
*/
-int select(int __max_fd_plus_one, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, struct timeval* __timeout);
+int select(int __max_fd_plus_one, fd_set* _Nullable __read_fds, fd_set* _Nullable __write_fds, fd_set* _Nullable __exception_fds, struct timeval* _Nullable __timeout);
/**
* [pselect(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
@@ -119,7 +106,7 @@
* Returns the number of ready file descriptors on success, 0 for timeout,
* and returns -1 and sets `errno` on failure.
*/
-int pselect(int __max_fd_plus_one, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, const struct timespec* __timeout, const sigset_t* __mask);
+int pselect(int __max_fd_plus_one, fd_set* _Nullable __read_fds, fd_set* _Nullable __write_fds, fd_set* _Nullable __exception_fds, const struct timespec* _Nullable __timeout, const sigset_t* _Nullable __mask);
/**
* [pselect64(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
@@ -132,6 +119,6 @@
*
* Available since API level 28.
*/
-int pselect64(int __max_fd_plus_one, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, const struct timespec* __timeout, const sigset64_t* __mask) __INTRODUCED_IN(28);
+int pselect64(int __max_fd_plus_one, fd_set* _Nullable __read_fds, fd_set* _Nullable __write_fds, fd_set* _Nullable __exception_fds, const struct timespec* _Nullable __timeout, const sigset64_t* _Nullable __mask) __INTRODUCED_IN(28);
__END_DECLS
diff --git a/libc/include/sys/sendfile.h b/libc/include/sys/sendfile.h
index 60bbde8..4b00d5d 100644
--- a/libc/include/sys/sendfile.h
+++ b/libc/include/sys/sendfile.h
@@ -40,7 +40,7 @@
/* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
#if defined(__USE_FILE_OFFSET64)
-ssize_t sendfile(int __out_fd, int __in_fd, off_t* __offset, size_t __count) __RENAME(sendfile64) __INTRODUCED_IN(21);
+ssize_t sendfile(int __out_fd, int __in_fd, off_t* _Nullable __offset, size_t __count) __RENAME(sendfile64) __INTRODUCED_IN(21);
#else
/**
* [sendfile(2)](http://man7.org/linux/man-pages/man2/sendfile.2.html) copies data directly
@@ -50,13 +50,13 @@
*
* Available since API level 21.
*/
-ssize_t sendfile(int __out_fd, int __in_fd, off_t* __offset, size_t __count);
+ssize_t sendfile(int __out_fd, int __in_fd, off_t* _Nullable __offset, size_t __count);
#endif
/**
* Like sendfile() but allows using a 64-bit offset
* even from a 32-bit process without `__FILE_OFFSET_BITS=64`.
*/
-ssize_t sendfile64(int __out_fd, int __in_fd, off64_t* __offset, size_t __count) __INTRODUCED_IN(21);
+ssize_t sendfile64(int __out_fd, int __in_fd, off64_t* _Nullable __offset, size_t __count) __INTRODUCED_IN(21);
__END_DECLS
diff --git a/libc/include/sys/signalfd.h b/libc/include/sys/signalfd.h
index bd911f7..f669cc8 100644
--- a/libc/include/sys/signalfd.h
+++ b/libc/include/sys/signalfd.h
@@ -48,11 +48,11 @@
*
* Available since API level 18.
*/
-int signalfd(int __fd, const sigset_t* __mask, int __flags) __INTRODUCED_IN(18);
+int signalfd(int __fd, const sigset_t* _Nonnull __mask, int __flags) __INTRODUCED_IN(18);
/**
* Like signalfd() but allows setting a signal mask with RT signals even from a 32-bit process.
*/
-int signalfd64(int __fd, const sigset64_t* __mask, int __flags) __INTRODUCED_IN(28);
+int signalfd64(int __fd, const sigset64_t* _Nonnull __mask, int __flags) __INTRODUCED_IN(28);
__END_DECLS
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index f33f112..41c5a9a 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -116,22 +116,7 @@
? (struct cmsghdr*) (msg)->msg_control : (struct cmsghdr*) NULL)
#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && (cmsg)->cmsg_len <= (unsigned long) ((mhdr)->msg_controllen - ((char*)(cmsg) - (char*)(mhdr)->msg_control)))
-#if __ANDROID_API__ >= 21
struct cmsghdr* __cmsg_nxthdr(struct msghdr* __msg, struct cmsghdr* __cmsg) __INTRODUCED_IN(21);
-#else
-/* TODO(danalbert): Move this into libandroid_support. */
-static inline struct cmsghdr* __cmsg_nxthdr(struct msghdr* msg, struct cmsghdr* cmsg) {
- struct cmsghdr* ptr =
- __BIONIC_CAST(reinterpret_cast, struct cmsghdr*,
- (__BIONIC_CAST(reinterpret_cast, char*, cmsg) + CMSG_ALIGN(cmsg->cmsg_len)));
- size_t len = __BIONIC_CAST(reinterpret_cast, char*, ptr + 1) -
- __BIONIC_CAST(reinterpret_cast, char*, msg->msg_control);
- if (len > msg->msg_controllen) {
- return NULL;
- }
- return ptr;
-}
-#endif
#define SCM_RIGHTS 0x01
#define SCM_CREDENTIALS 0x02
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 4184f6c..54621b7 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -40,7 +40,7 @@
__BEGIN_DECLS
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(__riscv)
#define __STAT64_BODY \
dev_t st_dev; \
ino_t st_ino; \
@@ -136,42 +136,74 @@
#define S_TYPEISSHM(__sb) 0
#define S_TYPEISTMO(__sb) 0
-int chmod(const char* __path, mode_t __mode);
+int chmod(const char* _Nonnull __path, mode_t __mode);
int fchmod(int __fd, mode_t __mode);
-int mkdir(const char* __path, mode_t __mode);
+int mkdir(const char* _Nonnull __path, mode_t __mode);
-int fstat(int __fd, struct stat* __buf);
-int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
-int fstatat(int __dir_fd, const char* __path, struct stat* __buf, int __flags);
-int fstatat64(int __dir_fd, const char* __path, struct stat64* __buf, int __flags) __RENAME_STAT64(fstatat, 3, 21);
-int lstat(const char* __path, struct stat* __buf);
-int lstat64(const char* __path, struct stat64* __buf) __RENAME_STAT64(lstat, 3, 21);
-int stat(const char* __path, struct stat* __buf);
-int stat64(const char* __path, struct stat64* __buf) __RENAME_STAT64(stat, 3, 21);
+int fstat(int __fd, struct stat* _Nonnull __buf);
+int fstat64(int __fd, struct stat64* _Nonnull __buf) __RENAME_STAT64(fstat, 3, 21);
+int fstatat(int __dir_fd, const char* _Nonnull __path, struct stat* _Nonnull __buf, int __flags);
+int fstatat64(int __dir_fd, const char* _Nonnull __path, struct stat64* _Nonnull __buf, int __flags) __RENAME_STAT64(fstatat, 3, 21);
+int lstat(const char* _Nonnull __path, struct stat* _Nonnull __buf);
+int lstat64(const char* _Nonnull __path, struct stat64* _Nonnull __buf) __RENAME_STAT64(lstat, 3, 21);
+int stat(const char* _Nonnull __path, struct stat* _Nonnull __buf);
+int stat64(const char* _Nonnull __path, struct stat64* _Nonnull __buf) __RENAME_STAT64(stat, 3, 21);
-int mknod(const char* __path, mode_t __mode, dev_t __dev);
+int mknod(const char* _Nonnull __path, mode_t __mode, dev_t __dev);
mode_t umask(mode_t __mask);
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
#include <bits/fortify/stat.h>
#endif
-#if __ANDROID_API__ >= 21
-int mkfifo(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
-#else
-// Implemented as a static inline before 21.
-#endif
+int mkfifo(const char* _Nonnull __path, mode_t __mode) __INTRODUCED_IN(21);
+int mkfifoat(int __dir_fd, const char* _Nonnull __path, mode_t __mode) __INTRODUCED_IN(23);
-int mkfifoat(int __dir_fd, const char* __path, mode_t __mode) __INTRODUCED_IN(23);
+int fchmodat(int __dir_fd, const char* _Nonnull __path, mode_t __mode, int __flags);
+int mkdirat(int __dir_fd, const char* _Nonnull __path, mode_t __mode);
+int mknodat(int __dir_fd, const char* _Nonnull __path, mode_t __mode, dev_t __dev) __INTRODUCED_IN(21);
-int fchmodat(int __dir_fd, const char* __path, mode_t __mode, int __flags);
-int mkdirat(int __dir_fd, const char* __path, mode_t __mode);
-int mknodat(int __dir_fd, const char* __path, mode_t __mode, dev_t __dev) __INTRODUCED_IN(21);
-
+/**
+ * Used in the tv_nsec field of an argument to utimensat()/futimens()
+ * to set that time to the current time.
+ */
#define UTIME_NOW ((1L << 30) - 1L)
+
+/**
+ * Used in the tv_nsec field of an argument to utimensat()/futimens()
+ * to _not_ set that time.
+ */
#define UTIME_OMIT ((1L << 30) - 2L)
-int utimensat(int __dir_fd, const char* __path, const struct timespec __times[2], int __flags);
-int futimens(int __dir_fd, const struct timespec __times[2]) __INTRODUCED_IN(19);
+
+/**
+ * [utimensat(2)](https://man7.org/linux/man-pages/man2/utimensat.2.html) sets
+ * file timestamps.
+ *
+ * Note: Linux supports `__path` being NULL (in which case `__dir_fd` need not
+ * be a directory), allowing futimens() to be implemented with utimensat().
+ * For normal use of utimensat(), though, `__path` should be non-null.
+ *
+ * `__times[0]` is the access time (atime), and `__times[1]` the last modification time (mtime).
+ * If `__times` is NULL, both times are set to the current time.
+ * See also UTIME_NOW and UTIME_OMIT.
+ *
+ * Returns 0 on success and returns -1 and sets `errno` on failure.
+ */
+int utimensat(int __dir_fd, const char* __BIONIC_COMPLICATED_NULLNESS __path, const struct timespec __times[_Nullable 2], int __flags);
+
+/**
+ * [futimens(2)](https://man7.org/linux/man-pages/man2/utimensat.2.html) sets
+ * the given file descriptor's timestamp.
+ *
+ * `__times[0]` is the access time (atime), and `__times[1]` the last modification time (mtime).
+ * If `__times` is NULL, both times are set to the current time.
+ * See also UTIME_NOW and UTIME_OMIT.
+ *
+ * Returns 0 on success and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 19.
+ */
+int futimens(int __fd, const struct timespec __times[_Nullable 2]) __INTRODUCED_IN(19);
#if defined(__USE_GNU)
/**
@@ -179,10 +211,10 @@
* extended file status information.
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 30.
*/
-int statx(int __dir_fd, const char* __path, int __flags, unsigned __mask, struct statx* __buf) __INTRODUCED_IN(30);
+int statx(int __dir_fd, const char* _Nonnull __path, int __flags, unsigned __mask, struct statx* _Nonnull __buf) __INTRODUCED_IN(30);
#endif
__END_DECLS
-
-#include <android/legacy_sys_stat_inlines.h>
diff --git a/libc/include/sys/statvfs.h b/libc/include/sys/statvfs.h
index 93fa3d7..793ee13 100644
--- a/libc/include/sys/statvfs.h
+++ b/libc/include/sys/statvfs.h
@@ -27,63 +27,39 @@
__BEGIN_DECLS
-struct statvfs {
- /** Block size. */
- unsigned long f_bsize;
- /** Fragment size. */
- unsigned long f_frsize;
- /** Total size of filesystem in `f_frsize` blocks. */
- fsblkcnt_t f_blocks;
- /** Number of free blocks. */
- fsblkcnt_t f_bfree;
- /** Number of free blocks for non-root. */
- fsblkcnt_t f_bavail;
- /** Number of inodes. */
- fsfilcnt_t f_files;
- /** Number of free inodes. */
- fsfilcnt_t f_ffree;
- /** Number of free inodes for non-root. */
- fsfilcnt_t f_favail;
- /** Filesystem id. */
- unsigned long f_fsid;
- /** Mount flags. (See `ST_` constants.) */
- unsigned long f_flag;
- /** Maximum filename length. */
- unsigned long f_namemax;
+#define __STATVFS64_BODY \
+ /** Block size. */ \
+ unsigned long f_bsize; \
+ /** Fragment size. */ \
+ unsigned long f_frsize; \
+ /** Total size of filesystem in `f_frsize` blocks. */ \
+ fsblkcnt_t f_blocks; \
+ /** Number of free blocks. */ \
+ fsblkcnt_t f_bfree; \
+ /** Number of free blocks for non-root. */ \
+ fsblkcnt_t f_bavail; \
+ /** Number of inodes. */ \
+ fsfilcnt_t f_files; \
+ /** Number of free inodes. */ \
+ fsfilcnt_t f_ffree; \
+ /** Number of free inodes for non-root. */ \
+ fsfilcnt_t f_favail; \
+ /** Filesystem id. */ \
+ unsigned long f_fsid; \
+ /** Mount flags. (See `ST_` constants.) */ \
+ unsigned long f_flag; \
+ /** Maximum filename length. */ \
+ unsigned long f_namemax; \
#if defined(__LP64__)
- uint32_t __f_reserved[6];
+#define __STATVFS64_CODA uint32_t __f_reserved[6];
+#else
+#define __STATVFS64_CODA
#endif
-};
-struct statvfs64 {
- /** Block size. */
- unsigned long f_bsize;
- /** Fragment size. */
- unsigned long f_frsize;
- /** Total size of filesystem in `f_frsize` blocks. */
- fsblkcnt_t f_blocks;
- /** Number of free blocks. */
- fsblkcnt_t f_bfree;
- /** Number of free blocks for non-root. */
- fsblkcnt_t f_bavail;
- /** Number of inodes. */
- fsfilcnt_t f_files;
- /** Number of free inodes. */
- fsfilcnt_t f_ffree;
- /** Number of free inodes for non-root. */
- fsfilcnt_t f_favail;
- /** Filesystem id. */
- unsigned long f_fsid;
- /** Mount flags. (See `ST_` constants.) */
- unsigned long f_flag;
- /** Maximum filename length. */
- unsigned long f_namemax;
+struct statvfs { __STATVFS64_BODY __STATVFS64_CODA };
-#if defined(__LP64__)
- uint32_t __f_reserved[6];
-#endif
-};
+struct statvfs64 { __STATVFS64_BODY __STATVFS64_CODA };
/** Flag for `f_flag` in `struct statvfs`: mounted read-only. */
#define ST_RDONLY 0x0001
@@ -112,14 +88,13 @@
/** Flag for `f_flag` in `struct statvfs`: see `MS_RELATIME`. */
#define ST_RELATIME 0x1000
-#if __ANDROID_API__ >= 19
-// These functions are implemented as static inlines before API level 19.
-
/**
* [statvfs(3)](http://man7.org/linux/man-pages/man3/statvfs.3.html)
* queries filesystem statistics for the given path.
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 19.
*/
int statvfs(const char* __path, struct statvfs* __buf) __INTRODUCED_IN(19);
@@ -128,22 +103,15 @@
* queries filesystem statistics for the given file descriptor.
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 19.
*/
int fstatvfs(int __fd, struct statvfs* __buf) __INTRODUCED_IN(19);
-#endif
-
-#if __ANDROID_API__ >= 21
-// These functions are implemented as static inlines before API level 21.
-
-/** Equivalent to statvfs(). */
+/** Equivalent to statvfs() . */
int statvfs64(const char* __path, struct statvfs64* __buf) __INTRODUCED_IN(21);
/** Equivalent to fstatvfs(). */
int fstatvfs64(int __fd, struct statvfs64* __buf) __INTRODUCED_IN(21);
-#endif
-
__END_DECLS
-
-#include <android/legacy_sys_statvfs_inlines.h>
diff --git a/libc/include/sys/swap.h b/libc/include/sys/swap.h
index 467b98c..9d016d4 100644
--- a/libc/include/sys/swap.h
+++ b/libc/include/sys/swap.h
@@ -58,7 +58,7 @@
*
* Available since API level 19.
*/
-int swapon(const char* __path, int __flags) __INTRODUCED_IN(19);
+int swapon(const char* _Nonnull __path, int __flags) __INTRODUCED_IN(19);
/**
* [swapoff(2)](http://man7.org/linux/man-pages/man2/swapoff.2.html) disables swapping.
@@ -67,6 +67,6 @@
*
* Available since API level 19.
*/
-int swapoff(const char* __path) __INTRODUCED_IN(19);
+int swapoff(const char* _Nonnull __path) __INTRODUCED_IN(19);
__END_DECLS
diff --git a/libc/include/sys/sysinfo.h b/libc/include/sys/sysinfo.h
index 4ecf986..cae5c49 100644
--- a/libc/include/sys/sysinfo.h
+++ b/libc/include/sys/sysinfo.h
@@ -43,7 +43,7 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int sysinfo(struct sysinfo* __info);
+int sysinfo(struct sysinfo* _Nonnull __info);
/**
* [get_nprocs_conf(3)](http://man7.org/linux/man-pages/man3/get_nprocs_conf.3.html) returns
diff --git a/libc/include/sys/ucontext.h b/libc/include/sys/ucontext.h
index 9c5801f..bb6443b 100644
--- a/libc/include/sys/ucontext.h
+++ b/libc/include/sys/ucontext.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _SYS_UCONTEXT_H_
-#define _SYS_UCONTEXT_H_
+#pragma once
#include <sys/cdefs.h>
@@ -313,8 +312,73 @@
struct _libc_fpstate __fpregs_mem;
} ucontext_t;
+#elif defined(__riscv)
+
+#define NGREG 32
+
+#if defined(__USE_GNU)
+
+#define REG_PC 0
+#define REG_RA 1
+#define REG_SP 2
+#define REG_TP 4
+#define REG_S0 8
+#define REG_A0 10
+
+#endif // defined(__USE_GNU)
+
+typedef unsigned long __riscv_mc_gp_state[NGREG];
+
+typedef unsigned long greg_t;
+typedef unsigned long gregset_t[NGREG];
+typedef union __riscv_mc_fp_state fpregset_t;
+
+/* These match the kernel <asm/ptrace.h> types but with different names. */
+
+struct __riscv_mc_f_ext_state {
+ uint32_t __f[32];
+ uint32_t __fcsr;
+};
+
+struct __riscv_mc_d_ext_state {
+ uint64_t __f[32];
+ uint32_t __fcsr;
+};
+
+struct __riscv_mc_q_ext_state {
+ uint64_t __f[64] __attribute__((__aligned__(16)));
+ uint32_t __fcsr;
+ uint32_t __reserved[3];
+};
+
+union __riscv_mc_fp_state {
+ struct __riscv_mc_f_ext_state __f;
+ struct __riscv_mc_d_ext_state __d;
+ struct __riscv_mc_q_ext_state __q;
+};
+
+/* This matches the kernel <asm/sigcontext.h> but with different names. */
+
+typedef struct mcontext_t {
+ __riscv_mc_gp_state __gregs;
+ union __riscv_mc_fp_state __fpregs;
+} mcontext_t;
+
+/* This matches the kernel <asm/ucontext.h> but using mcontext_t. */
+
+typedef struct ucontext {
+ unsigned long uc_flags;
+ struct ucontext* uc_link;
+ stack_t uc_stack;
+ union {
+ sigset_t uc_sigmask;
+ sigset64_t uc_sigmask64;
+ };
+ /* The kernel adds extra padding here to allow sigset_t to grow. */
+ char __padding[128 - sizeof(sigset_t)];
+ mcontext_t uc_mcontext;
+} ucontext_t;
+
#endif
__END_DECLS
-
-#endif /* _SYS_UCONTEXT_H_ */
diff --git a/libc/include/sys/user.h b/libc/include/sys/user.h
index 2392edd..432c7cb 100644
--- a/libc/include/sys/user.h
+++ b/libc/include/sys/user.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _SYS_USER_H_
-#define _SYS_USER_H_
+#pragma once
#include <sys/cdefs.h>
#include <stddef.h> /* For size_t. */
@@ -233,6 +232,11 @@
uint32_t fpcr;
};
+#elif defined(__riscv)
+
+// This space deliberately left blank for now.
+// No other libcs have any riscv64-specific structs.
+
#else
#error "Unsupported architecture."
@@ -240,5 +244,3 @@
#endif
__END_DECLS
-
-#endif /* _SYS_USER_H_ */
diff --git a/libc/include/sys/utsname.h b/libc/include/sys/utsname.h
index 1fa3187..aa8c1a0 100644
--- a/libc/include/sys/utsname.h
+++ b/libc/include/sys/utsname.h
@@ -62,6 +62,6 @@
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
*/
-int uname(struct utsname* __buf);
+int uname(struct utsname* _Nonnull __buf);
__END_DECLS
diff --git a/libc/include/sys/vfs.h b/libc/include/sys/vfs.h
index ad859f0..18ae428 100644
--- a/libc/include/sys/vfs.h
+++ b/libc/include/sys/vfs.h
@@ -104,10 +104,10 @@
#define XENIX_SUPER_MAGIC 0x012FF7B4
#define XFS_SUPER_MAGIC 0x58465342
-int statfs(const char* __path, struct statfs* __buf);
-int statfs64(const char* __path, struct statfs64* __buf) __INTRODUCED_IN(21);
-int fstatfs(int __fd, struct statfs* __buf);
-int fstatfs64(int __fd, struct statfs64* __buf) __INTRODUCED_IN(21);
+int statfs(const char* _Nonnull __path, struct statfs* _Nonnull __buf);
+int statfs64(const char* _Nonnull __path, struct statfs64* _Nonnull __buf) __INTRODUCED_IN(21);
+int fstatfs(int __fd, struct statfs* _Nonnull __buf);
+int fstatfs64(int __fd, struct statfs64* _Nonnull __buf) __INTRODUCED_IN(21);
__END_DECLS
diff --git a/libc/include/sys/wait.h b/libc/include/sys/wait.h
index 8c0655f..e6fb855 100644
--- a/libc/include/sys/wait.h
+++ b/libc/include/sys/wait.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _SYS_WAIT_H_
-#define _SYS_WAIT_H_
+#pragma once
#include <bits/wait.h>
#include <sys/cdefs.h>
@@ -38,13 +37,9 @@
__BEGIN_DECLS
-pid_t wait(int* __status);
-pid_t waitpid(pid_t __pid, int* __status, int __options);
-#if __ANDROID_API__ >= 18
-pid_t wait4(pid_t __pid, int* __status, int __options, struct rusage* __rusage) __INTRODUCED_IN(18);
-#else
-// Implemented as a static inline before 18.
-#endif
+pid_t wait(int* _Nullable __status);
+pid_t waitpid(pid_t __pid, int* _Nullable __status, int __options);
+pid_t wait4(pid_t __pid, int* _Nullable __status, int __options, struct rusage* _Nullable __rusage) __INTRODUCED_IN(18);
/* Posix states that idtype_t should be an enumeration type, but
* the kernel headers define P_ALL, P_PID and P_PGID as constant macros
@@ -52,10 +47,6 @@
*/
typedef int idtype_t;
-int waitid(idtype_t __type, id_t __id, siginfo_t* __info, int __options);
+int waitid(idtype_t __type, id_t __id, siginfo_t* _Nullable __info, int __options);
__END_DECLS
-
-#include <android/legacy_sys_wait_inlines.h>
-
-#endif
diff --git a/libc/include/syslog.h b/libc/include/syslog.h
index 45de253..d89d769 100644
--- a/libc/include/syslog.h
+++ b/libc/include/syslog.h
@@ -133,9 +133,10 @@
/**
* [openlog(3)](http://man7.org/linux/man-pages/man3/openlog.3.html) sets
- * the log tag to `__prefix`. On Android, the other two arguments are ignored.
+ * the log tag to `__prefix`, which can be NULL to return to the default of
+ * getprogname(). On Android, the other two arguments are ignored.
*/
-void openlog(const char* __prefix, int __option, int __facility);
+void openlog(const char* _Nullable __prefix, int __option, int __facility);
/**
* [setlogmask(3)](http://man7.org/linux/man-pages/man3/setlogmask.3.html)
@@ -149,13 +150,13 @@
* the printf()-like message and logs it with the given priority, unless
* suppressed by setlogmask(). On Android, the output goes to logcat.
*/
-void syslog(int __priority, const char* __fmt, ...) __printflike(2, 3);
+void syslog(int __priority, const char* _Nonnull __fmt, ...) __printflike(2, 3);
/**
* [vsyslog(3)](http://man7.org/linux/man-pages/man3/vsyslog.3.html) formats
* the vprintf()-like message and logs it with the given priority, unless
* suppressed by setlogmask(). On Android, the output goes to logcat.
*/
-void vsyslog(int __priority, const char* __fmt, va_list __args) __printflike(2, 0);
+void vsyslog(int __priority, const char* _Nonnull __fmt, va_list __args) __printflike(2, 0);
__END_DECLS
diff --git a/libc/include/termios.h b/libc/include/termios.h
index e3f388c..92ac24b 100644
--- a/libc/include/termios.h
+++ b/libc/include/termios.h
@@ -49,19 +49,19 @@
* [cfgetispeed(3)](http://man7.org/linux/man-pages/man3/cfgetispeed.3.html)
* returns the terminal input baud rate.
*/
-speed_t cfgetispeed(const struct termios* __t) __INTRODUCED_IN(21);
+speed_t cfgetispeed(const struct termios* _Nonnull __t) __INTRODUCED_IN(21);
/**
* [cfgetospeed(3)](http://man7.org/linux/man-pages/man3/cfgetospeed.3.html)
* returns the terminal output baud rate.
*/
-speed_t cfgetospeed(const struct termios* __t) __INTRODUCED_IN(21);
+speed_t cfgetospeed(const struct termios* _Nonnull __t) __INTRODUCED_IN(21);
/**
* [cfmakeraw(3)](http://man7.org/linux/man-pages/man3/cfmakeraw.3.html)
* configures the terminal for "raw" mode.
*/
-void cfmakeraw(struct termios* __t) __INTRODUCED_IN(21);
+void cfmakeraw(struct termios* _Nonnull __t) __INTRODUCED_IN(21);
/**
* [cfsetspeed(3)](http://man7.org/linux/man-pages/man3/cfsetspeed.3.html)
@@ -69,7 +69,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int cfsetspeed(struct termios* __t, speed_t __speed) __INTRODUCED_IN(21);
+int cfsetspeed(struct termios* _Nonnull __t, speed_t __speed) __INTRODUCED_IN(21);
/**
* [cfsetispeed(3)](http://man7.org/linux/man-pages/man3/cfsetispeed.3.html)
@@ -77,7 +77,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int cfsetispeed(struct termios* __t, speed_t __speed) __INTRODUCED_IN(21);
+int cfsetispeed(struct termios* _Nonnull _t, speed_t __speed) __INTRODUCED_IN(21);
/**
* [cfsetospeed(3)](http://man7.org/linux/man-pages/man3/cfsetospeed.3.html)
@@ -85,7 +85,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int cfsetospeed(struct termios* __t, speed_t __speed) __INTRODUCED_IN(21);
+int cfsetospeed(struct termios* _Nonnull __t, speed_t __speed) __INTRODUCED_IN(21);
/**
* [tcdrain(3)](http://man7.org/linux/man-pages/man3/tcdrain.3.html)
@@ -120,7 +120,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int tcgetattr(int __fd, struct termios* __t) __INTRODUCED_IN(21);
+int tcgetattr(int __fd, struct termios* _Nonnull __t) __INTRODUCED_IN(21);
/**
* [tcgetsid(3)](http://man7.org/linux/man-pages/man3/tcgetsid.3.html)
@@ -145,7 +145,7 @@
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
*/
-int tcsetattr(int __fd, int __optional_actions, const struct termios* __t) __INTRODUCED_IN(21);
+int tcsetattr(int __fd, int __optional_actions, const struct termios* _Nonnull __t) __INTRODUCED_IN(21);
#endif
diff --git a/libc/include/threads.h b/libc/include/threads.h
index 1b00b8f..b1008de 100644
--- a/libc/include/threads.h
+++ b/libc/include/threads.h
@@ -51,9 +51,9 @@
typedef pthread_mutex_t mtx_t;
/** The type for a thread-specific storage destructor. */
-typedef void (*tss_dtor_t)(void*);
+typedef void (*tss_dtor_t)(void* _Nullable);
/** The type of the function passed to thrd_create() to create a new thread. */
-typedef int (*thrd_start_t)(void*);
+typedef int (*thrd_start_t)(void* _Nullable);
/** The type used by call_once(). */
typedef pthread_once_t once_flag;
@@ -82,72 +82,72 @@
// This file is implemented as static inlines before API level 30.
/** Uses `__flag` to ensure that `__function` is called exactly once. */
-void call_once(once_flag* __flag, void (*__function)(void)) __INTRODUCED_IN(30);
+void call_once(once_flag* _Nonnull __flag, void (* _Nonnull __function)(void)) __INTRODUCED_IN(30);
/**
* Unblocks all threads blocked on `__cond`.
*/
-int cnd_broadcast(cnd_t* __cond) __INTRODUCED_IN(30);
+int cnd_broadcast(cnd_t* _Nonnull __cond) __INTRODUCED_IN(30);
/**
* Destroys a condition variable.
*/
-void cnd_destroy(cnd_t* __cond) __INTRODUCED_IN(30);
+void cnd_destroy(cnd_t* _Nonnull __cond) __INTRODUCED_IN(30);
/**
* Creates a condition variable.
*/
-int cnd_init(cnd_t* __cond) __INTRODUCED_IN(30);
+int cnd_init(cnd_t* _Nonnull __cond) __INTRODUCED_IN(30);
/**
* Unblocks one thread blocked on `__cond`.
*/
-int cnd_signal(cnd_t* __cond) __INTRODUCED_IN(30);
+int cnd_signal(cnd_t* _Nonnull __cond) __INTRODUCED_IN(30);
/**
* Unlocks `__mutex` and blocks until `__cond` is signaled or `__timeout` occurs.
*/
-int cnd_timedwait(cnd_t* __cond, mtx_t* __mutex, const struct timespec* __timeout)
+int cnd_timedwait(cnd_t* _Nonnull __cond, mtx_t* _Nonnull __mutex, const struct timespec* _Nonnull __timeout)
__INTRODUCED_IN(30);
/**
* Unlocks `__mutex` and blocks until `__cond` is signaled.
*/
-int cnd_wait(cnd_t* __cond, mtx_t* __mutex) __INTRODUCED_IN(30);
+int cnd_wait(cnd_t* _Nonnull __cond, mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
/**
* Destroys a mutex.
*/
-void mtx_destroy(mtx_t* __mutex) __INTRODUCED_IN(30);
+void mtx_destroy(mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
/**
* Creates a mutex.
*/
-int mtx_init(mtx_t* __mutex, int __type) __INTRODUCED_IN(30);
+int mtx_init(mtx_t* _Nonnull __mutex, int __type) __INTRODUCED_IN(30);
/**
* Blocks until `__mutex` is acquired.
*/
-int mtx_lock(mtx_t* __mutex) __INTRODUCED_IN(30);
+int mtx_lock(mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
/**
* Blocks until `__mutex` is acquired or `__timeout` expires.
*/
-int mtx_timedlock(mtx_t* __mutex, const struct timespec* __timeout) __INTRODUCED_IN(30);
+int mtx_timedlock(mtx_t* _Nonnull __mutex, const struct timespec* _Nonnull __timeout) __INTRODUCED_IN(30);
/**
* Acquires `__mutex` or returns `thrd_busy`.
*/
-int mtx_trylock(mtx_t* __mutex) __INTRODUCED_IN(30);
+int mtx_trylock(mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
/**
* Unlocks `__mutex`.
*/
-int mtx_unlock(mtx_t* __mutex) __INTRODUCED_IN(30);
+int mtx_unlock(mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
@@ -155,7 +155,7 @@
* Creates a new thread running `__function(__arg)`, and sets `*__thrd` to
* the new thread.
*/
-int thrd_create(thrd_t* __thrd, thrd_start_t __function, void* __arg) __INTRODUCED_IN(30);
+int thrd_create(thrd_t* _Nonnull __thrd, thrd_start_t _Nonnull __function, void* _Nullable __arg) __INTRODUCED_IN(30);
/**
* Returns the `thrd_t` corresponding to the caller.
@@ -181,7 +181,7 @@
* Blocks until `__thrd` terminates. If `__result` is not null, `*__result`
* is set to the exiting thread's result.
*/
-int thrd_join(thrd_t __thrd, int* __result) __INTRODUCED_IN(30);
+int thrd_join(thrd_t __thrd, int* _Nullable __result) __INTRODUCED_IN(30);
/**
* Blocks the caller for at least `__duration` unless a signal is delivered.
@@ -190,7 +190,7 @@
*
* Returns 0 on success, or -1 if a signal was delivered.
*/
-int thrd_sleep(const struct timespec* __duration, struct timespec* __remaining) __INTRODUCED_IN(30);
+int thrd_sleep(const struct timespec* _Nonnull __duration, struct timespec* _Nullable __remaining) __INTRODUCED_IN(30);
/**
* Request that other threads should be scheduled.
@@ -203,7 +203,7 @@
* Creates a thread-specific storage key with the associated destructor (which
* may be null).
*/
-int tss_create(tss_t* __key, tss_dtor_t __dtor) __INTRODUCED_IN(30);
+int tss_create(tss_t* _Nonnull __key, tss_dtor_t _Nullable __dtor) __INTRODUCED_IN(30);
/**
* Destroys a thread-specific storage key.
@@ -214,13 +214,13 @@
* Returns the value for the current thread held in the thread-specific storage
* identified by `__key`.
*/
-void* tss_get(tss_t __key) __INTRODUCED_IN(30);
+void* _Nullable tss_get(tss_t __key) __INTRODUCED_IN(30);
/**
* Sets the current thread's value for the thread-specific storage identified
* by `__key` to `__value`.
*/
-int tss_set(tss_t __key, void* __value) __INTRODUCED_IN(30);
+int tss_set(tss_t __key, void* _Nonnull __value) __INTRODUCED_IN(30);
#endif
diff --git a/libc/include/time.h b/libc/include/time.h
index 0db14ff..5339540 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -37,7 +37,7 @@
#define CLOCKS_PER_SEC 1000000
-extern char* tzname[];
+extern char* _Nonnull tzname[];
extern int daylight;
extern long int timezone;
@@ -54,62 +54,59 @@
int tm_yday;
int tm_isdst;
long int tm_gmtoff;
- const char* tm_zone;
+ const char* _Nullable tm_zone;
};
#define TM_ZONE tm_zone
-time_t time(time_t* __t);
-int nanosleep(const struct timespec* __request, struct timespec* __remainder);
+time_t time(time_t* _Nullable __t);
+int nanosleep(const struct timespec* _Nonnull __request, struct timespec* _Nullable __remainder);
-char* asctime(const struct tm* __tm);
-char* asctime_r(const struct tm* __tm, char* __buf);
+char* _Nullable asctime(const struct tm* _Nonnull __tm);
+char* _Nullable asctime_r(const struct tm* _Nonnull __tm, char* _Nonnull __buf);
double difftime(time_t __lhs, time_t __rhs);
-time_t mktime(struct tm* __tm);
+time_t mktime(struct tm* _Nonnull __tm);
-struct tm* localtime(const time_t* __t);
-struct tm* localtime_r(const time_t* __t, struct tm* __tm);
+struct tm* _Nullable localtime(const time_t* _Nonnull __t);
+struct tm* _Nullable localtime_r(const time_t* _Nonnull __t, struct tm* _Nonnull __tm);
-struct tm* gmtime(const time_t* __t);
-struct tm* gmtime_r(const time_t* __t, struct tm* __tm);
+struct tm* _Nullable gmtime(const time_t* _Nonnull __t);
+struct tm* _Nullable gmtime_r(const time_t* _Nonnull __t, struct tm* _Nonnull __tm);
-char* strptime(const char* __s, const char* __fmt, struct tm* __tm) __strftimelike(2);
-char* strptime_l(const char* __s, const char* __fmt, struct tm* __tm, locale_t __l) __strftimelike(2) __INTRODUCED_IN(28);
+char* _Nullable strptime(const char* _Nonnull __s, const char* _Nonnull __fmt, struct tm* _Nonnull __tm) __strftimelike(2);
+char* _Nullable strptime_l(const char* _Nonnull __s, const char* _Nonnull __fmt, struct tm* _Nonnull __tm, locale_t _Nonnull __l) __strftimelike(2) __INTRODUCED_IN(28);
-size_t strftime(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm) __strftimelike(3);
-#if __ANDROID_API__ >= 21
-size_t strftime_l(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm, locale_t __l) __strftimelike(3) __INTRODUCED_IN(21);
-#else
-// Implemented as static inline before 21.
-#endif
+size_t strftime(char* _Nonnull __buf, size_t __n, const char* _Nonnull __fmt, const struct tm* _Nullable __tm) __strftimelike(3);
+size_t strftime_l(char* _Nonnull __buf, size_t __n, const char* _Nonnull __fmt, const struct tm* _Nullable __tm, locale_t _Nonnull __l) __strftimelike(3) __INTRODUCED_IN(21);
-char* ctime(const time_t* __t);
-char* ctime_r(const time_t* __t, char* __buf);
+char* _Nullable ctime(const time_t* _Nonnull __t);
+char* _Nullable ctime_r(const time_t* _Nonnull __t, char* _Nonnull __buf);
void tzset(void);
clock_t clock(void);
-int clock_getcpuclockid(pid_t __pid, clockid_t* __clock) __INTRODUCED_IN(23);
+int clock_getcpuclockid(pid_t __pid, clockid_t* _Nonnull __clock) __INTRODUCED_IN(23);
-int clock_getres(clockid_t __clock, struct timespec* __resolution);
-int clock_gettime(clockid_t __clock, struct timespec* __ts);
-int clock_nanosleep(clockid_t __clock, int __flags, const struct timespec* __request, struct timespec* __remainder);
-int clock_settime(clockid_t __clock, const struct timespec* __ts);
-int timer_create(clockid_t __clock, struct sigevent* __event, timer_t* __timer_ptr);
-int timer_delete(timer_t __timer);
-int timer_settime(timer_t __timer, int __flags, const struct itimerspec* __new_value, struct itimerspec* __old_value);
-int timer_gettime(timer_t __timer, struct itimerspec* __ts);
-int timer_getoverrun(timer_t __timer);
+int clock_getres(clockid_t __clock, struct timespec* _Nullable __resolution);
+int clock_gettime(clockid_t __clock, struct timespec* _Nonnull __ts);
+int clock_nanosleep(clockid_t __clock, int __flags, const struct timespec* _Nonnull __request, struct timespec* _Nullable __remainder);
+int clock_settime(clockid_t __clock, const struct timespec* _Nonnull __ts);
+
+int timer_create(clockid_t __clock, struct sigevent* _Nullable __event, timer_t _Nonnull * _Nonnull __timer_ptr);
+int timer_delete(timer_t _Nonnull __timer);
+int timer_settime(timer_t _Nonnull __timer, int __flags, const struct itimerspec* _Nonnull __new_value, struct itimerspec* _Nullable __old_value);
+int timer_gettime(timer_t _Nonnull _timer, struct itimerspec* _Nonnull __ts);
+int timer_getoverrun(timer_t _Nonnull __timer);
/* Non-standard extensions that are in the BSDs and glibc. */
-time_t timelocal(struct tm* __tm);
-time_t timegm(struct tm* __tm);
+time_t timelocal(struct tm* _Nonnull __tm);
+time_t timegm(struct tm* _Nonnull __tm);
#define TIME_UTC 1
-int timespec_get(struct timespec* __ts, int __base) __INTRODUCED_IN(29);
+int timespec_get(struct timespec* _Nonnull __ts, int __base) __INTRODUCED_IN(29);
__END_DECLS
diff --git a/libc/include/time64.h b/libc/include/time64.h
index 905669d..7d70030 100644
--- a/libc/include/time64.h
+++ b/libc/include/time64.h
@@ -47,17 +47,17 @@
typedef int64_t time64_t;
-char* asctime64(const struct tm*);
-char* asctime64_r(const struct tm*, char*);
-char* ctime64(const time64_t*);
-char* ctime64_r(const time64_t*, char*);
-struct tm* gmtime64(const time64_t*);
-struct tm* gmtime64_r(const time64_t*, struct tm*);
-struct tm* localtime64(const time64_t*);
-struct tm* localtime64_r(const time64_t*, struct tm*);
-time64_t mktime64(const struct tm*);
-time64_t timegm64(const struct tm*);
-time64_t timelocal64(const struct tm*);
+char* _Nullable asctime64(const struct tm* _Nonnull);
+char* _Nullable asctime64_r(const struct tm* _Nonnull, char* _Nonnull);
+char* _Nullable ctime64(const time64_t* _Nonnull);
+char* _Nullable ctime64_r(const time64_t* _Nonnull, char* _Nonnull);
+struct tm* _Nullable gmtime64(const time64_t* _Nonnull);
+struct tm* _Nullable gmtime64_r(const time64_t* _Nonnull, struct tm* _Nonnull);
+struct tm* _Nullable localtime64(const time64_t* _Nonnull);
+struct tm* _Nullable localtime64_r(const time64_t* _Nonnull, struct tm* _Nonnull);
+time64_t mktime64(const struct tm* _Nonnull);
+time64_t timegm64(const struct tm* _Nonnull);
+time64_t timelocal64(const struct tm* _Nonnull);
__END_DECLS
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index e360421..7ad94e1 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -73,7 +73,7 @@
#define _PC_PRIO_IO 18
#define _PC_SYNC_IO 19
-extern char** environ;
+extern char* _Nullable * _Nullable environ;
__noreturn void _exit(int __status);
@@ -89,15 +89,15 @@
pid_t getsid(pid_t __pid) __INTRODUCED_IN(17);
pid_t setsid(void);
-int execv(const char* __path, char* const* __argv);
-int execvp(const char* __file, char* const* __argv);
-int execvpe(const char* __file, char* const* __argv, char* const* __envp) __INTRODUCED_IN(21);
-int execve(const char* __file, char* const* __argv, char* const* __envp);
-int execl(const char* __path, const char* __arg0, ...) __attribute__((__sentinel__));
-int execlp(const char* __file, const char* __arg0, ...) __attribute__((__sentinel__));
-int execle(const char* __path, const char* __arg0, ... /*, char* const* __envp */)
+int execv(const char* _Nonnull __path, char* _Nullable const* _Nullable __argv);
+int execvp(const char* _Nonnull __file, char* _Nullable const* _Nullable __argv);
+int execvpe(const char* _Nonnull __file, char* _Nullable const* _Nullable __argv, char* _Nullable const* _Nullable __envp) __INTRODUCED_IN(21);
+int execve(const char* _Nonnull __file, char* _Nullable const* _Nullable __argv, char* _Nullable const* _Nullable __envp);
+int execl(const char* _Nonnull __path, const char* _Nullable __arg0, ...) __attribute__((__sentinel__));
+int execlp(const char* _Nonnull __file, const char* _Nullable __arg0, ...) __attribute__((__sentinel__));
+int execle(const char* _Nonnull __path, const char* _Nullable __arg0, ... /*, char* const* __envp */)
__attribute__((__sentinel__(1)));
-int fexecve(int __fd, char* const* __argv, char* const* __envp) __INTRODUCED_IN(28);
+int fexecve(int __fd, char* _Nullable const* _Nullable __argv, char* _Nullable const* _Nullable __envp) __INTRODUCED_IN(28);
int nice(int __incr);
@@ -193,40 +193,40 @@
uid_t geteuid(void);
gid_t getgid(void);
gid_t getegid(void);
-int getgroups(int __size, gid_t* __list);
-int setgroups(size_t __size, const gid_t* __list);
-int getresuid(uid_t* __ruid, uid_t* __euid, uid_t* __suid);
-int getresgid(gid_t* __rgid, gid_t* __egid, gid_t* __sgid);
-char* getlogin(void);
-int getlogin_r(char* __buffer, size_t __buffer_size) __INTRODUCED_IN(28);
+int getgroups(int __size, gid_t* _Nullable __list);
+int setgroups(size_t __size, const gid_t* _Nullable __list);
+int getresuid(uid_t* _Nonnull __ruid, uid_t* _Nonnull __euid, uid_t* _Nonnull __suid);
+int getresgid(gid_t* _Nonnull __rgid, gid_t* _Nonnull __egid, gid_t* _Nonnull __sgid);
+char* _Nullable getlogin(void);
+int getlogin_r(char* _Nonnull __buffer, size_t __buffer_size) __INTRODUCED_IN(28);
long fpathconf(int __fd, int __name);
-long pathconf(const char* __path, int __name);
+long pathconf(const char* _Nonnull __path, int __name);
-int access(const char* __path, int __mode);
-int faccessat(int __dirfd, const char* __path, int __mode, int __flags);
-int link(const char* __old_path, const char* __new_path);
-int linkat(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path, int __flags) __INTRODUCED_IN(21);
-int unlink(const char* __path);
-int unlinkat(int __dirfd, const char* __path, int __flags);
-int chdir(const char* __path);
+int access(const char* _Nonnull __path, int __mode);
+int faccessat(int __dirfd, const char* _Nonnull __path, int __mode, int __flags);
+int link(const char* _Nonnull __old_path, const char* _Nonnull __new_path);
+int linkat(int __old_dir_fd, const char* _Nonnull __old_path, int __new_dir_fd, const char* _Nonnull __new_path, int __flags) __INTRODUCED_IN(21);
+int unlink(const char* _Nonnull __path);
+int unlinkat(int __dirfd, const char* _Nonnull __path, int __flags);
+int chdir(const char* _Nonnull __path);
int fchdir(int __fd);
-int rmdir(const char* __path);
-int pipe(int __fds[2]);
+int rmdir(const char* _Nonnull __path);
+int pipe(int __fds[_Nonnull 2]);
#if defined(__USE_GNU)
-int pipe2(int __fds[2], int __flags);
+int pipe2(int __fds[_Nonnull 2], int __flags);
#endif
-int chroot(const char* __path);
-int symlink(const char* __old_path, const char* __new_path);
-int symlinkat(const char* __old_path, int __new_dir_fd, const char* __new_path) __INTRODUCED_IN(21);
-ssize_t readlink(const char* __path, char* __buf, size_t __buf_size);
-ssize_t readlinkat(int __dir_fd, const char* __path, char* __buf, size_t __buf_size)
+int chroot(const char* _Nonnull __path);
+int symlink(const char* _Nonnull __old_path, const char* _Nonnull __new_path);
+int symlinkat(const char* _Nonnull __old_path, int __new_dir_fd, const char* _Nonnull __new_path) __INTRODUCED_IN(21);
+ssize_t readlink(const char* _Nonnull __path, char* _Nonnull __buf, size_t __buf_size);
+ssize_t readlinkat(int __dir_fd, const char* _Nonnull __path, char* _Nonnull __buf, size_t __buf_size)
__INTRODUCED_IN(21);
-int chown(const char* __path, uid_t __owner, gid_t __group);
+int chown(const char* _Nonnull __path, uid_t __owner, gid_t __group);
int fchown(int __fd, uid_t __owner, gid_t __group);
-int fchownat(int __dir_fd, const char* __path, uid_t __owner, gid_t __group, int __flags);
-int lchown(const char* __path, uid_t __owner, gid_t __group);
-char* getcwd(char* __buf, size_t __size);
+int fchownat(int __dir_fd, const char* _Nonnull __path, uid_t __owner, gid_t __group, int __flags);
+int lchown(const char* _Nonnull __path, uid_t __owner, gid_t __group);
+char* _Nullable getcwd(char* _Nullable __buf, size_t __size);
void sync(void);
#if defined(__USE_GNU)
@@ -235,8 +235,29 @@
int close(int __fd);
-ssize_t read(int __fd, void* __buf, size_t __count);
-ssize_t write(int __fd, const void* __buf, size_t __count);
+/**
+ * [read(2)](https://man7.org/linux/man-pages/man2/read.2.html) reads
+ * up to `__count` bytes from file descriptor `__fd` into `__buf`.
+ *
+ * Note: `__buf` is not normally nullable, but may be null in the
+ * special case of a zero-length read(), which while not generally
+ * useful may be meaningful to some device drivers.
+ *
+ * Returns the number of bytes read on success, and returns -1 and sets `errno` on failure.
+ */
+ssize_t read(int __fd, void* __BIONIC_COMPLICATED_NULLNESS __buf, size_t __count);
+
+/**
+ * [write(2)](https://man7.org/linux/man-pages/man2/write.2.html) writes
+ * up to `__count` bytes to file descriptor `__fd` from `__buf`.
+ *
+ * Note: `__buf` is not normally nullable, but may be null in the
+ * special case of a zero-length write(), which while not generally
+ * useful may be meaningful to some device drivers.
+ *
+ * Returns the number of bytes written on success, and returns -1 and sets `errno` on failure.
+ */
+ssize_t write(int __fd, const void* __BIONIC_COMPLICATED_NULLNESS __buf, size_t __count);
int dup(int __old_fd);
int dup2(int __old_fd, int __new_fd);
@@ -246,23 +267,23 @@
/* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
#if defined(__USE_FILE_OFFSET64)
-int truncate(const char* __path, off_t __length) __RENAME(truncate64) __INTRODUCED_IN(21);
+int truncate(const char* _Nonnull __path, off_t __length) __RENAME(truncate64) __INTRODUCED_IN(21);
off_t lseek(int __fd, off_t __offset, int __whence) __RENAME(lseek64);
-ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset) __RENAME(pread64);
-ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset) __RENAME(pwrite64);
+ssize_t pread(int __fd, void* _Nonnull __buf, size_t __count, off_t __offset) __RENAME(pread64);
+ssize_t pwrite(int __fd, const void* _Nonnull __buf, size_t __count, off_t __offset) __RENAME(pwrite64);
int ftruncate(int __fd, off_t __length) __RENAME(ftruncate64);
#else
-int truncate(const char* __path, off_t __length);
+int truncate(const char* _Nonnull __path, off_t __length);
off_t lseek(int __fd, off_t __offset, int __whence);
-ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset);
-ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset);
+ssize_t pread(int __fd, void* _Nonnull __buf, size_t __count, off_t __offset);
+ssize_t pwrite(int __fd, const void* _Nonnull __buf, size_t __count, off_t __offset);
int ftruncate(int __fd, off_t __length);
#endif
-int truncate64(const char* __path, off64_t __length) __INTRODUCED_IN(21);
+int truncate64(const char* _Nonnull __path, off64_t __length) __INTRODUCED_IN(21);
off64_t lseek64(int __fd, off64_t __offset, int __whence);
-ssize_t pread64(int __fd, void* __buf, size_t __count, off64_t __offset);
-ssize_t pwrite64(int __fd, const void* __buf, size_t __count, off64_t __offset);
+ssize_t pread64(int __fd, void* _Nonnull __buf, size_t __count, off64_t __offset);
+ssize_t pwrite64(int __fd, const void* _Nonnull __buf, size_t __count, off64_t __offset);
int ftruncate64(int __fd, off64_t __length);
int pause(void);
@@ -270,25 +291,19 @@
unsigned int sleep(unsigned int __seconds);
int usleep(useconds_t __microseconds);
-int gethostname(char* __buf, size_t __buf_size);
-int sethostname(const char* __name, size_t __n) __INTRODUCED_IN(23);
+int gethostname(char* _Nonnull _buf, size_t __buf_size);
+int sethostname(const char* _Nonnull __name, size_t __n) __INTRODUCED_IN(23);
-int brk(void* __addr);
-void* sbrk(ptrdiff_t __increment);
+int brk(void* _Nonnull __addr);
+void* _Nullable sbrk(ptrdiff_t __increment);
int isatty(int __fd);
-char* ttyname(int __fd);
-int ttyname_r(int __fd, char* __buf, size_t __buf_size);
+char* _Nullable ttyname(int __fd);
+int ttyname_r(int __fd, char* _Nonnull __buf, size_t __buf_size);
-int acct(const char* __path);
+int acct(const char* _Nullable __path);
-#if __ANDROID_API__ >= 21
int getpagesize(void) __INTRODUCED_IN(21);
-#else
-static __inline__ int getpagesize(void) {
- return sysconf(_SC_PAGESIZE);
-}
-#endif
long syscall(long __number, ...);
@@ -310,13 +325,40 @@
} while (_rc == -1 && errno == EINTR); \
_rc; })
-int getdomainname(char* __buf, size_t __buf_size) __INTRODUCED_IN(26);
-int setdomainname(const char* __name, size_t __n) __INTRODUCED_IN(26);
+int getdomainname(char* _Nonnull __buf, size_t __buf_size) __INTRODUCED_IN(26);
+int setdomainname(const char* _Nonnull __name, size_t __n) __INTRODUCED_IN(26);
+
+/**
+ * [copy_file_range(2)](https://man7.org/linux/man-pages/man2/copy_file_range.2.html) copies
+ * a range of data from one file descriptor to another.
+ *
+ * Available since API level 34.
+ *
+ * Returns the number of bytes copied on success, and returns -1 and sets
+ * `errno` on failure.
+ */
+ssize_t copy_file_range(int __fd_in, off64_t* _Nullable __off_in, int __fd_out, off64_t* _Nullable __off_out, size_t __length, unsigned int __flags) __INTRODUCED_IN(34);
#if __ANDROID_API__ >= 28
-void swab(const void* __src, void* __dst, ssize_t __byte_count) __INTRODUCED_IN(28);
+void swab(const void* _Nonnull __src, void* _Nonnull __dst, ssize_t __byte_count) __INTRODUCED_IN(28);
#endif
+/**
+ * [close_range(2)](https://man7.org/linux/man-pages/man2/close_range.2.html)
+ * performs an action (which depends on value of flags) on an inclusive range
+ * of file descriptors.
+ *
+ * Available since API level 34.
+ *
+ * Note: there is no emulation on too old kernels, hence this will fail with
+ * -1/ENOSYS on pre-5.9 kernels, -1/EINVAL for unsupported flags. In particular
+ * CLOSE_RANGE_CLOEXEC requires 5.11, though support was backported to Android
+ * Common Kernel 5.10-T.
+ *
+ * Returns 0 on success, and returns -1 and sets `errno` on failure.
+ */
+int close_range(unsigned int __min_fd, unsigned int __max_fd, int __flags) __INTRODUCED_IN(34);
+
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
#define _UNISTD_H_
#include <bits/fortify/unistd.h>
diff --git a/libc/include/utmp.h b/libc/include/utmp.h
index cb72ce2..d249f8a 100644
--- a/libc/include/utmp.h
+++ b/libc/include/utmp.h
@@ -30,7 +30,7 @@
/**
* @file utmp.h
- * @brief POSIX login records.
+ * @brief No-op implementation of non-POSIX login records. See <utmpx.h> for the POSIX equivalents.
*/
#include <sys/cdefs.h>
@@ -69,12 +69,12 @@
};
struct exit_status {
- short int e_termination;
- short int e_exit;
+ short e_termination;
+ short e_exit;
};
struct utmp {
- short int ut_type;
+ short ut_type;
pid_t ut_pid;
char ut_line[UT_LINESIZE];
char ut_id[4];
@@ -83,7 +83,7 @@
struct exit_status ut_exit;
- long int ut_session;
+ long ut_session;
struct timeval ut_tv;
int32_t ut_addr_v6[4];
@@ -97,21 +97,25 @@
__BEGIN_DECLS
/**
- * Does nothing.
+ * Returns -1 and sets errno to ENOTSUP.
*/
-int utmpname(const char* __path);
+int utmpname(const char* _Nonnull __path);
+
/**
* Does nothing.
*/
void setutent(void);
+
/**
- * Does nothing.
+ * Does nothing and returns null.
*/
-struct utmp* getutent(void);
+struct utmp* _Nullable getutent(void);
+
/**
- * Does nothing.
+ * Does nothing and returns null.
*/
-struct utmp* pututline(const struct utmp* __entry);
+struct utmp* _Nullable pututline(const struct utmp* _Nonnull __entry);
+
/**
* Does nothing.
*/
diff --git a/libc/include/utmpx.h b/libc/include/utmpx.h
new file mode 100644
index 0000000..5ed8e1a
--- /dev/null
+++ b/libc/include/utmpx.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#pragma once
+
+/**
+ * @file utmpx.h
+ * @brief No-op implementation of POSIX login records.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <time.h>
+
+#define EMPTY 0
+#define RUN_LVL 1
+#define BOOT_TIME 2
+#define NEW_TIME 3
+#define OLD_TIME 4
+#define INIT_PROCESS 5
+#define LOGIN_PROCESS 6
+#define USER_PROCESS 7
+#define DEAD_PROCESS 8
+#define ACCOUNTING 9
+
+struct utmpx {
+ short ut_type;
+ pid_t ut_pid;
+ char ut_line[32];
+ char ut_id[4];
+ char ut_user[32];
+ char ut_host[256];
+
+ struct {
+ short e_termination;
+ short e_exit;
+ } ut_exit;
+
+ long ut_session;
+ struct timeval ut_tv;
+
+ int32_t ut_addr_v6[4];
+ char unused[20];
+};
+
+__BEGIN_DECLS
+
+/**
+ * Does nothing.
+ */
+void setutxent(void) __RENAME(setutent);
+
+/**
+ * Does nothing and returns null.
+ */
+struct utmpx* _Nullable getutxent(void) __RENAME(getutent);
+
+/**
+ * Does nothing and returns null.
+ */
+struct utmpx* _Nullable getutxid(const struct utmpx* _Nonnull __entry) __RENAME(getutent);
+
+/**
+ * Does nothing and returns null.
+ */
+struct utmpx* _Nullable getutxline(const struct utmpx* _Nonnull __entry) __RENAME(getutent);
+
+/**
+ * Does nothing and returns null.
+ */
+struct utmpx* _Nullable pututxline(const struct utmpx* _Nonnull __entry) __RENAME(pututline);
+
+/**
+ * Does nothing.
+ */
+void endutxent(void) __RENAME(endutent);
+
+__END_DECLS
diff --git a/libc/include/wchar.h b/libc/include/wchar.h
index f0966de..39f9374 100644
--- a/libc/include/wchar.h
+++ b/libc/include/wchar.h
@@ -44,101 +44,96 @@
__BEGIN_DECLS
wint_t btowc(int __ch);
-int fwprintf(FILE* __fp, const wchar_t* __fmt, ...);
-int fwscanf(FILE* __fp, const wchar_t* __fmt, ...);
-wint_t fgetwc(FILE* __fp);
-wchar_t* fgetws(wchar_t* __buf, int __size, FILE* __fp);
-wint_t fputwc(wchar_t __wc, FILE* __fp);
-int fputws(const wchar_t* __s, FILE* __fp);
-int fwide(FILE* __fp, int __mode);
-wint_t getwc(FILE* __fp);
+int fwprintf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, ...);
+int fwscanf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, ...);
+wint_t fgetwc(FILE* _Nonnull __fp);
+wchar_t* _Nullable fgetws(wchar_t* _Nonnull __buf, int __size, FILE* _Nonnull __fp);
+wint_t fputwc(wchar_t __wc, FILE* _Nonnull __fp);
+int fputws(const wchar_t* _Nonnull __s, FILE* _Nonnull __fp);
+int fwide(FILE* _Nonnull __fp, int __mode);
+wint_t getwc(FILE* _Nonnull __fp);
wint_t getwchar(void);
-int mbsinit(const mbstate_t* __ps);
-size_t mbrlen(const char* __s, size_t __n, mbstate_t* __ps);
-size_t mbrtowc(wchar_t* __buf, const char* __s, size_t __n, mbstate_t* __ps);
-size_t mbsrtowcs(wchar_t* __dst, const char** __src, size_t __dst_n, mbstate_t* __ps);
-size_t mbsnrtowcs(wchar_t* __dst, const char** __src, size_t __src_n, size_t __dst_n, mbstate_t* __ps) __INTRODUCED_IN(21);
-wint_t putwc(wchar_t __wc, FILE* __fp);
+int mbsinit(const mbstate_t* _Nullable __ps);
+size_t mbrlen(const char* _Nullable __s, size_t __n, mbstate_t* _Nullable __ps);
+size_t mbrtowc(wchar_t* _Nullable __buf, const char* _Nullable __s, size_t __n, mbstate_t* _Nullable __ps);
+size_t mbsrtowcs(wchar_t* _Nullable __dst, const char* _Nullable * _Nonnull __src, size_t __dst_n, mbstate_t* _Nullable __ps);
+size_t mbsnrtowcs(wchar_t* _Nullable __dst, const char* _Nullable * _Nullable __src, size_t __src_n, size_t __dst_n, mbstate_t* _Nullable __ps) __INTRODUCED_IN(21);
+wint_t putwc(wchar_t __wc, FILE* _Nonnull __fp);
wint_t putwchar(wchar_t __wc);
-int swprintf(wchar_t* __buf, size_t __n, const wchar_t* __fmt, ...);
-int swscanf(const wchar_t* __s, const wchar_t* __fmt, ...);
-wint_t ungetwc(wint_t __wc, FILE* __fp);
-int vfwprintf(FILE* __fp, const wchar_t* __fmt, va_list __args);
-int vfwscanf(FILE* __fp, const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
-int vswprintf(wchar_t* __buf, size_t __n, const wchar_t* __fmt, va_list __args);
-int vswscanf(const wchar_t* __s, const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
-int vwprintf(const wchar_t* __fmt, va_list __args);
-int vwscanf(const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
-wchar_t* wcpcpy(wchar_t* __dst, const wchar_t* __src);
-wchar_t* wcpncpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
-size_t wcrtomb(char* __buf, wchar_t __wc, mbstate_t* __ps);
-int wcscasecmp(const wchar_t* __lhs, const wchar_t* __rhs);
-int wcscasecmp_l(const wchar_t* __lhs, const wchar_t* __rhs, locale_t __l) __INTRODUCED_IN(23);
-wchar_t* wcscat(wchar_t* __dst, const wchar_t* __src);
-wchar_t* wcschr(const wchar_t* __s, wchar_t __wc);
-int wcscmp(const wchar_t* __lhs, const wchar_t* __rhs);
-int wcscoll(const wchar_t* __lhs, const wchar_t* __rhs);
-wchar_t* wcscpy(wchar_t* __dst, const wchar_t* __src);
-size_t wcscspn(const wchar_t* __s, const wchar_t* __accept);
-size_t wcsftime(wchar_t* __buf, size_t __n, const wchar_t* __fmt, const struct tm* __tm);
-size_t wcsftime_l(wchar_t* __buf, size_t __n, const wchar_t* __fmt, const struct tm* __tm, locale_t __l) __INTRODUCED_IN(28);
-size_t wcslen(const wchar_t* __s);
-int wcsncasecmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
-int wcsncasecmp_l(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n, locale_t __l) __INTRODUCED_IN(23);
-wchar_t* wcsncat(wchar_t* __dst, const wchar_t* __src, size_t __n);
-int wcsncmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
-wchar_t* wcsncpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
-size_t wcsnrtombs(char* __dst, const wchar_t** __src, size_t __src_n, size_t __dst_n, mbstate_t* __ps) __INTRODUCED_IN(21);
-wchar_t* wcspbrk(const wchar_t* __s, const wchar_t* __accept);
-wchar_t* wcsrchr(const wchar_t* __s, wchar_t __wc);
-size_t wcsrtombs(char* __dst, const wchar_t** __src, size_t __dst_n, mbstate_t* __ps);
-size_t wcsspn(const wchar_t* __s, const wchar_t* __accept);
-wchar_t* wcsstr(const wchar_t* __haystack, const wchar_t* __needle);
-double wcstod(const wchar_t* __s, wchar_t** __end_ptr);
-double wcstod_l(const wchar_t* __s, wchar_t** __end_ptr, locale_t __l) __INTRODUCED_IN(28);
-float wcstof(const wchar_t* __s, wchar_t** __end_ptr) __INTRODUCED_IN(21);
-float wcstof_l(const wchar_t* __s, wchar_t** __end_ptr, locale_t __l) __INTRODUCED_IN(28);
-wchar_t* wcstok(wchar_t* __s, const wchar_t* __delimiter, wchar_t** __ptr);
-long wcstol(const wchar_t* __s, wchar_t** __end_ptr, int __base);
-long wcstol_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(28);
-long long wcstoll(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
-long double wcstold(const wchar_t* __s, wchar_t** __end_ptr) __RENAME_LDBL(wcstod, 3, 21);
-unsigned long wcstoul(const wchar_t* __s, wchar_t** __end_ptr, int __base);
-unsigned long wcstoul_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(28);
-unsigned long long wcstoull(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
-int wcswidth(const wchar_t* __s, size_t __n);
-size_t wcsxfrm(wchar_t* __dst, const wchar_t* __src, size_t __n);
+int swprintf(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nonnull __fmt, ...);
+int swscanf(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __fmt, ...);
+wint_t ungetwc(wint_t __wc, FILE* _Nonnull __fp);
+int vfwprintf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, va_list __args);
+int vfwscanf(FILE* _Nonnull __fp, const wchar_t* _Nonnull __fmt, va_list __args) __INTRODUCED_IN(21);
+int vswprintf(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nonnull __fmt, va_list __args);
+int vswscanf(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __fmt, va_list __args) __INTRODUCED_IN(21);
+int vwprintf(const wchar_t* _Nonnull __fmt, va_list __args);
+int vwscanf(const wchar_t* _Nonnull __fmt, va_list __args) __INTRODUCED_IN(21);
+wchar_t* _Nonnull wcpcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src);
+wchar_t* _Nonnull wcpncpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
+size_t wcrtomb(char* _Nullable __buf, wchar_t __wc, mbstate_t* _Nullable __ps);
+int wcscasecmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs);
+int wcscasecmp_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, locale_t _Nonnull __l) __INTRODUCED_IN(23);
+wchar_t* _Nonnull wcscat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src);
+wchar_t* _Nullable wcschr(const wchar_t * _Nonnull __s, wchar_t __wc);
+int wcscmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs);
+int wcscoll(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs);
+wchar_t* _Nonnull wcscpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src);
+size_t wcscspn(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept);
+size_t wcsftime(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nullable __fmt, const struct tm* _Nonnull __tm);
+size_t wcsftime_l(wchar_t* _Nonnull __buf, size_t __n, const wchar_t* _Nullable __fmt, const struct tm* _Nonnull __tm, locale_t _Nonnull __l) __INTRODUCED_IN(28);
+size_t wcslen(const wchar_t* _Nonnull __s);
+int wcsncasecmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n);
+int wcsncasecmp_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n, locale_t _Nonnull __l) __INTRODUCED_IN(23);
+wchar_t* _Nonnull wcsncat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
+int wcsncmp(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, size_t __n);
+wchar_t* _Nonnull wcsncpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
+size_t wcsnrtombs(char* _Nullable __dst, const wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __src, size_t __src_n, size_t __dst_n, mbstate_t* _Nullable __ps) __INTRODUCED_IN(21);
+wchar_t* _Nullable wcspbrk(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept);
+wchar_t* _Nullable wcsrchr(const wchar_t* _Nonnull __s, wchar_t __wc);
+size_t wcsrtombs(char* _Nullable __dst, const wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __src, size_t __dst_n, mbstate_t* _Nullable __ps);
+size_t wcsspn(const wchar_t* _Nonnull __s, const wchar_t* _Nonnull __accept);
+wchar_t* _Nullable wcsstr(const wchar_t* _Nonnull __haystack, const wchar_t* _Nonnull __needle);
+double wcstod(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr);
+double wcstod_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, locale_t _Nonnull __l) __INTRODUCED_IN(28);
+float wcstof(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr) __INTRODUCED_IN(21);
+float wcstof_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, locale_t _Nonnull __l) __INTRODUCED_IN(28);
+wchar_t* _Nullable wcstok(wchar_t* _Nullable __s, const wchar_t* _Nonnull __delimiter, wchar_t* _Nonnull * _Nonnull __ptr);
+long wcstol(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base);
+long wcstol_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __INTRODUCED_IN(28);
+long long wcstoll(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base) __INTRODUCED_IN(21);
+long double wcstold(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr) __RENAME_LDBL(wcstod, 3, 21);
+unsigned long wcstoul(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base);
+unsigned long wcstoul_l(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __INTRODUCED_IN(28);
+unsigned long long wcstoull(const wchar_t* _Nonnull __s, wchar_t* __BIONIC_COMPLICATED_NULLNESS * _Nullable __end_ptr, int __base) __INTRODUCED_IN(21);
+int wcswidth(const wchar_t* _Nonnull __s, size_t __n);
+size_t wcsxfrm(wchar_t* __BIONIC_COMPLICATED_NULLNESS __dst, const wchar_t* _Nonnull __src, size_t __n);
int wctob(wint_t __wc);
int wcwidth(wchar_t __wc);
-wchar_t* wmemchr(const wchar_t* __src, wchar_t __wc, size_t __n);
-int wmemcmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
-wchar_t* wmemcpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
+wchar_t* _Nullable wmemchr(const wchar_t* _Nonnull __src, wchar_t __wc, size_t __n);
+int wmemcmp(const wchar_t* _Nullable __lhs, const wchar_t* _Nullable __rhs, size_t __n);
+wchar_t* _Nonnull wmemcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
#if defined(__USE_GNU)
-wchar_t* wmempcpy(wchar_t* __dst, const wchar_t* __src, size_t __n) __INTRODUCED_IN(23);
+wchar_t* _Nonnull wmempcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n) __INTRODUCED_IN(23);
#endif
-wchar_t* wmemmove(wchar_t* __dst, const wchar_t* __src, size_t __n);
-wchar_t* wmemset(wchar_t* __dst, wchar_t __wc, size_t __n);
-int wprintf(const wchar_t* __fmt, ...);
-int wscanf(const wchar_t* __fmt, ...);
+wchar_t* _Nonnull wmemmove(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
+wchar_t* _Nonnull wmemset(wchar_t* _Nonnull __dst, wchar_t __wc, size_t __n);
+int wprintf(const wchar_t* _Nonnull __fmt, ...);
+int wscanf(const wchar_t* _Nonnull __fmt, ...);
-#if __ANDROID_API__ >= 21
-long long wcstoll_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
-unsigned long long wcstoull_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
-long double wcstold_l(const wchar_t* __s, wchar_t** __end_ptr, locale_t __l) __INTRODUCED_IN(21);
+long long wcstoll_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+unsigned long long wcstoull_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+long double wcstold_l(const wchar_t* _Nonnull __s, wchar_t* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) __INTRODUCED_IN(21);
-int wcscoll_l(const wchar_t* __lhs, const wchar_t* __rhs, locale_t __l) __attribute_pure__
+int wcscoll_l(const wchar_t* _Nonnull __lhs, const wchar_t* _Nonnull __rhs, locale_t _Nonnull __l) __attribute_pure__
__INTRODUCED_IN(21);
-size_t wcsxfrm_l(wchar_t* __dst, const wchar_t* __src, size_t __n, locale_t __l) __INTRODUCED_IN(21);
-#else
-// Implemented as static inlines before 21.
-#endif
+size_t wcsxfrm_l(wchar_t* __BIONIC_COMPLICATED_NULLNESS __dst, const wchar_t* _Nonnull __src, size_t __n, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+size_t wcslcat(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
+size_t wcslcpy(wchar_t* _Nonnull __dst, const wchar_t* _Nonnull __src, size_t __n);
-size_t wcslcat(wchar_t* __dst, const wchar_t* __src, size_t __n);
-size_t wcslcpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
-
-FILE* open_wmemstream(wchar_t** __ptr, size_t* __size_ptr) __INTRODUCED_IN(23);
-wchar_t* wcsdup(const wchar_t* __s);
-size_t wcsnlen(const wchar_t* __s, size_t __n);
+FILE* _Nullable open_wmemstream(wchar_t* _Nonnull * _Nonnull __ptr, size_t* _Nonnull __size_ptr) __INTRODUCED_IN(23);
+wchar_t* _Nullable wcsdup(const wchar_t* _Nonnull __s);
+size_t wcsnlen(const wchar_t* _Nonnull __s, size_t __n);
__END_DECLS
diff --git a/libc/include/wctype.h b/libc/include/wctype.h
index 58510ae..344343f 100644
--- a/libc/include/wctype.h
+++ b/libc/include/wctype.h
@@ -35,31 +35,27 @@
__BEGIN_DECLS
-#if __ANDROID_API__ >= 21
-int iswalnum_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswalpha_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswblank_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswcntrl_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswdigit_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswgraph_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswlower_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswprint_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswpunct_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswspace_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswupper_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-int iswxdigit_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswalnum_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswalpha_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswblank_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswcntrl_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswdigit_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswgraph_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswlower_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswprint_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswpunct_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswspace_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswupper_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswxdigit_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
-wint_t towlower_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-wint_t towupper_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
-#else
-// Implemented as static inlines before 21.
-#endif
+wint_t towlower_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+wint_t towupper_l(wint_t __wc, locale_t _Nonnull __l) __INTRODUCED_IN(21);
-wint_t towctrans_l(wint_t __wc, wctrans_t __transform, locale_t __l) __INTRODUCED_IN(26);
-wctrans_t wctrans_l(const char* __name, locale_t __l) __INTRODUCED_IN(26);
+wint_t towctrans_l(wint_t __wc, wctrans_t _Nonnull __transform, locale_t _Nonnull __l) __INTRODUCED_IN(26);
+wctrans_t _Nonnull wctrans_l(const char* _Nonnull __name, locale_t _Nonnull __l) __INTRODUCED_IN(26);
-wctype_t wctype_l(const char* __name, locale_t __l) __INTRODUCED_IN(21);
-int iswctype_l(wint_t __wc, wctype_t __transform, locale_t __l) __INTRODUCED_IN(21);
+wctype_t wctype_l(const char* _Nonnull __name, locale_t _Nonnull __l) __INTRODUCED_IN(21);
+int iswctype_l(wint_t __wc, wctype_t __transform, locale_t _Nonnull __l) __INTRODUCED_IN(21);
__END_DECLS
diff --git a/libc/kernel/README.md b/libc/kernel/README.md
index 5f1c81d..3846a4f 100644
--- a/libc/kernel/README.md
+++ b/libc/kernel/README.md
@@ -99,6 +99,7 @@
Run this command to automatically download the latest version of the headers
and import them if there is no checked out kernel source tree:
```
+ # For testing only, not for use in production!
bionic/libc/kernel/tools/generate_uapi_headers.sh --download-kernel
```
diff --git a/libc/kernel/android/BUILD b/libc/kernel/android/BUILD
new file mode 100644
index 0000000..b862a6d
--- /dev/null
+++ b/libc/kernel/android/BUILD
@@ -0,0 +1,43 @@
+# Copyright (C) 2022 The Android Open Source Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load("//build/bazel/rules/apis:cc_api_contribution.bzl", "cc_api_headers")
+
+package(default_visibility = ["//bionic/libc:__pkg__"])
+
+cc_api_headers(
+ name="libc_kernel_android_uapi_headers",
+ include_dir="uapi",
+ hdrs=glob(["uapi/**/*.h"]),
+ system=True,
+)
+
+cc_api_headers(
+ name="libc_kernel_android_scsi_headers",
+ include_dir="scsi",
+ hdrs=glob(["scsi/**/*.h"]),
+ system=True,
+)
diff --git a/libc/kernel/android/scsi/scsi/scsi_proto.h b/libc/kernel/android/scsi/scsi/scsi_proto.h
index eea87a0..24df458 100644
--- a/libc/kernel/android/scsi/scsi/scsi_proto.h
+++ b/libc/kernel/android/scsi/scsi/scsi_proto.h
@@ -139,6 +139,7 @@
#define ABORTED_COMMAND 0x0b
#define VOLUME_OVERFLOW 0x0d
#define MISCOMPARE 0x0e
+#define COMPLETED 0x0f
#define TYPE_DISK 0x00
#define TYPE_TAPE 0x01
#define TYPE_PRINTER 0x02
@@ -183,6 +184,8 @@
ZBC_ZONE_TYPE_CONV = 0x1,
ZBC_ZONE_TYPE_SEQWRITE_REQ = 0x2,
ZBC_ZONE_TYPE_SEQWRITE_PREF = 0x3,
+ ZBC_ZONE_TYPE_SEQ_OR_BEFORE_REQ = 0x4,
+ ZBC_ZONE_TYPE_GAP = 0x5,
};
enum zbc_zone_cond {
ZBC_ZONE_COND_NO_WP = 0x0,
@@ -194,6 +197,10 @@
ZBC_ZONE_COND_FULL = 0xe,
ZBC_ZONE_COND_OFFLINE = 0xf,
};
+enum zbc_zone_alignment_method {
+ ZBC_CONSTANT_ZONE_LENGTH = 0x1,
+ ZBC_CONSTANT_ZONE_START_OFFSET = 0x8,
+};
enum scsi_version_descriptor {
SCSI_VERSION_DESCRIPTOR_FCP4 = 0x0a40,
SCSI_VERSION_DESCRIPTOR_ISCSI = 0x0960,
@@ -204,4 +211,12 @@
SCSI_VERSION_DESCRIPTOR_SPC4 = 0x0460,
SCSI_VERSION_DESCRIPTOR_SRP = 0x0940
};
+enum scsi_support_opcode {
+ SCSI_SUPPORT_NO_INFO = 0,
+ SCSI_SUPPORT_NOT_SUPPORTED = 1,
+ SCSI_SUPPORT_FULL = 3,
+ SCSI_SUPPORT_VENDOR = 5,
+};
+#define SCSI_CONTROL_MASK 0
+#define SCSI_GROUP_NUMBER_MASK 0
#endif
diff --git a/libc/kernel/android/scsi/scsi/sg.h b/libc/kernel/android/scsi/scsi/sg.h
index a7a1944..9ba6cd6 100644
--- a/libc/kernel/android/scsi/scsi/sg.h
+++ b/libc/kernel/android/scsi/scsi/sg.h
@@ -20,7 +20,7 @@
#define _SCSI_GENERIC_H
#include <linux/compiler.h>
typedef struct sg_iovec {
- void __user * iov_base;
+ void * iov_base;
size_t iov_len;
} sg_iovec_t;
typedef struct sg_io_hdr {
@@ -30,13 +30,13 @@
unsigned char mx_sb_len;
unsigned short iovec_count;
unsigned int dxfer_len;
- void __user * dxferp;
- unsigned char __user * cmdp;
- void __user * sbp;
+ void * dxferp;
+ unsigned char * cmdp;
+ void * sbp;
unsigned int timeout;
unsigned int flags;
int pack_id;
- void __user * usr_ptr;
+ void * usr_ptr;
unsigned char status;
unsigned char masked_status;
unsigned char msg_status;
@@ -79,7 +79,7 @@
#define QUEUE_FULL 0x14
#define ACA_ACTIVE 0x18
#define TASK_ABORTED 0x20
-#define status_byte(result) (((result) >> 1) & 0x7f)
+#define sg_status_byte(result) (((result) >> 1) & 0x7f)
typedef struct sg_scsi_id {
int host_no;
int channel;
@@ -96,7 +96,7 @@
char sg_io_owned;
char problem;
int pack_id;
- void __user * usr_ptr;
+ void * usr_ptr;
unsigned int duration;
int unused;
} sg_req_info_t;
diff --git a/libc/kernel/android/uapi/linux/compiler.h b/libc/kernel/android/uapi/linux/compiler.h
index 8e89655..42d59aa 100644
--- a/libc/kernel/android/uapi/linux/compiler.h
+++ b/libc/kernel/android/uapi/linux/compiler.h
@@ -1,18 +1,11 @@
-#ifndef _UAPI_LINUX_COMPILER_H
-#define _UAPI_LINUX_COMPILER_H
+#pragma once
/*
- * This file is not currently in the Linux kernel tree.
- * Upstream uapi headers refer to <linux/compiler.h> but there is
- * no such uapi file. We've sent this upstream, and are optimistically
- * adding it to bionic in the meantime. This should be replaced by
- * a scrubbed header from external/kernel-headers when possible.
+ * There is no `include/uapi/linux/compiler.h`, just `include/linux/compiler.h`.
*
- * An alternative to this file is to check in a symbolic link to the
- * non-uapi <linux/compiler.h>. That's fine for building bionic too.
+ * We don't need anything _in_ this file, but we do need this file.
+ * The two #defines are for backwards compatibility.
*/
-#define __user
#define __force
-
-#endif /* _UAPI_LINUX_COMPILER_H */
+#define __user
diff --git a/libc/kernel/android/uapi/linux/compiler_types.h b/libc/kernel/android/uapi/linux/compiler_types.h
index 94f4fbe..859ae05 100644
--- a/libc/kernel/android/uapi/linux/compiler_types.h
+++ b/libc/kernel/android/uapi/linux/compiler_types.h
@@ -1,5 +1,11 @@
+#pragma once
+
/*
- * The compiler.h file has been split into compiler.h and compiler_types.h.
- * However, to compile bionic we only need the compiler.h.
+ * There is no `include/uapi/linux/compiler_types.h`, just
+ * `include/linux/compiler_types.h`.
+ *
+ * We don't need anything _in_ this file, but we do need this file.
+ * The #include is for backwards compatibility.
*/
+
#include <linux/compiler.h>
diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py
index cfd301a..f15fab4 100755
--- a/libc/kernel/tools/clean_header.py
+++ b/libc/kernel/tools/clean_header.py
@@ -109,9 +109,6 @@
if arch and arch in kernel_default_arch_macros:
macros.update(kernel_default_arch_macros[arch])
- if arch and arch in kernel_arch_token_replacements:
- blocks.replaceTokens(kernel_arch_token_replacements[arch])
-
blocks.removeStructs(kernel_structs_to_remove)
blocks.optimizeMacros(macros)
blocks.optimizeIf01()
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index 26121ca..40e1f26 100755
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -14,7 +14,7 @@
utils.panic('ANDROID_BUILD_TOP not set.\n')
# Set up the env vars for libclang.
-site.addsitedir(os.path.join(top, 'prebuilts/clang/host/linux-x86/clang-stable/lib64/python3/site-packages/'))
+site.addsitedir(os.path.join(top, 'prebuilts/clang/host/linux-x86/clang-stable/lib/python3/site-packages/'))
import clang.cindex
from clang.cindex import conf
@@ -28,7 +28,7 @@
# Set up LD_LIBRARY_PATH to include libclang.so, libLLVM.so, and etc.
# Note that setting LD_LIBRARY_PATH with os.putenv() sometimes doesn't help.
-clang.cindex.Config.set_library_file(os.path.join(top, 'prebuilts/clang/host/linux-x86/clang-stable/lib64/libclang.so'))
+clang.cindex.Config.set_library_file(os.path.join(top, 'prebuilts/clang/host/linux-x86/clang-stable/lib/libclang.so'))
from defaults import *
@@ -155,6 +155,11 @@
pass
+class UnparseableStruct(Exception):
+ """An exception that will be raised for structs that cannot be parsed."""
+ pass
+
+
# The __contains__ function in libclang SourceRange class contains a bug. It
# gives wrong result when dealing with single line range.
# Bug filed with upstream:
@@ -1197,22 +1202,38 @@
def removeStructs(self, structs):
"""Remove structs."""
- for b in self.blocks:
+ extra_includes = []
+ block_num = 0
+ num_blocks = len(self.blocks)
+ while block_num < num_blocks:
+ b = self.blocks[block_num]
+ block_num += 1
# Have to look in each block for a top-level struct definition.
if b.directive:
continue
num_tokens = len(b.tokens)
- # A struct definition has at least 5 tokens:
+ # A struct definition usually looks like:
# struct
# ident
# {
# }
# ;
- if num_tokens < 5:
+ # However, the structure might be spread across multiple blocks
+ # if the structure looks like this:
+ # struct ident
+ # {
+ # #ifdef VARIABLE
+ # pid_t pid;
+ # #endif
+ # }:
+ # So the total number of tokens in the block might be less than
+ # five but assume at least three.
+ if num_tokens < 3:
continue
+
# This is a simple struct finder, it might fail if a top-level
# structure has an #if type directives that confuses the algorithm
- # for finding th end of the structure. Or if there is another
+ # for finding the end of the structure. Or if there is another
# structure definition embedded in the structure.
i = 0
while i < num_tokens - 2:
@@ -1223,24 +1244,58 @@
if (b.tokens[i + 1].kind == TokenKind.IDENTIFIER and
b.tokens[i + 2].kind == TokenKind.PUNCTUATION and
b.tokens[i + 2].id == "{" and b.tokens[i + 1].id in structs):
+ # Add an include for the structure to be removed of the form:
+ # #include <bits/STRUCT_NAME.h>
+ struct_token = b.tokens[i + 1]
+ if not structs[struct_token.id]:
+ extra_includes.append("<bits/%s.h>" % struct_token.id)
+
# Search forward for the end of the structure.
- # Very simple search, look for } and ; tokens. If something
- # more complicated is needed we can add it later.
+ # Very simple search, look for } and ; tokens.
+ # If we hit the end of the block, we'll need to start
+ # looking at the next block.
j = i + 3
- while j < num_tokens - 1:
- if (b.tokens[j].kind == TokenKind.PUNCTUATION and
- b.tokens[j].id == "}" and
- b.tokens[j + 1].kind == TokenKind.PUNCTUATION and
- b.tokens[j + 1].id == ";"):
- b.tokens = b.tokens[0:i] + b.tokens[j + 2:num_tokens]
+ depth = 1
+ struct_removed = False
+ while not struct_removed:
+ while j < num_tokens:
+ if b.tokens[j].kind == TokenKind.PUNCTUATION:
+ if b.tokens[j].id == '{':
+ depth += 1
+ elif b.tokens[j].id == '}':
+ depth -= 1
+ elif b.tokens[j].id == ';' and depth == 0:
+ b.tokens = b.tokens[0:i] + b.tokens[j + 1:num_tokens]
+ num_tokens = len(b.tokens)
+ struct_removed = True
+ break
+ j += 1
+ if not struct_removed:
+ b.tokens = b.tokens[0:i]
+
+ # Skip directive blocks.
+ start_block = block_num
+ while block_num < num_blocks:
+ if not self.blocks[block_num].directive:
+ break
+ block_num += 1
+ if block_num >= num_blocks:
+ # Unparsable struct, error out.
+ raise UnparseableStruct("Cannot remove struct %s: %s" % (struct_token.id, struct_token.location))
+ self.blocks = self.blocks[0:start_block] + self.blocks[block_num:num_blocks]
+ num_blocks = len(self.blocks)
+ b = self.blocks[start_block]
+ block_num = start_block + 1
num_tokens = len(b.tokens)
- j = i
- break
- j += 1
- i = j
+ i = 0
+ j = 0
continue
i += 1
+ for extra_include in extra_includes:
+ replacement = CppStringTokenizer(extra_include)
+ self.blocks.insert(2, Block(replacement.tokens, directive='include'))
+
def optimizeAll(self, macros):
self.optimizeMacros(macros)
self.optimizeIf01()
@@ -1404,35 +1459,12 @@
def replaceTokens(self, replacements):
"""Replace tokens according to the given dict."""
- extra_includes = []
for b in self.blocks:
made_change = False
if b.isInclude() is None:
i = 0
while i < len(b.tokens):
tok = b.tokens[i]
- if (tok.kind == TokenKind.KEYWORD and tok.id == 'struct'
- and (i + 2) < len(b.tokens) and b.tokens[i + 2].id == '{'):
- struct_name = b.tokens[i + 1].id
- if struct_name in kernel_struct_replacements:
- extra_includes.append("<bits/%s.h>" % struct_name)
- end = i + 2
- depth = 1
- while end < len(b.tokens) and depth > 0:
- if b.tokens[end].id == '}':
- depth -= 1
- elif b.tokens[end].id == '{':
- depth += 1
- end += 1
- end += 1 # Swallow last '}'
- while end < len(b.tokens) and b.tokens[end].id != ';':
- end += 1
- end += 1 # Swallow ';'
- # Remove these tokens. We'll replace them later with a #include block.
- b.tokens[i:end] = []
- made_change = True
- # We've just modified b.tokens, so revisit the current offset.
- continue
if tok.kind == TokenKind.IDENTIFIER:
if tok.id in replacements:
tok.id = replacements[tok.id]
@@ -1447,10 +1479,6 @@
# Keep 'expr' in sync with 'tokens'.
b.expr = CppExpr(b.tokens)
- for extra_include in extra_includes:
- replacement = CppStringTokenizer(extra_include)
- self.blocks.insert(2, Block(replacement.tokens, directive='include'))
-
def strip_space(s):
@@ -1647,7 +1675,7 @@
def get_blocks(self, lines):
blocks = BlockParser().parse(CppStringTokenizer('\n'.join(lines)))
- return map(lambda a: str(a), blocks)
+ return list(map(lambda a: str(a), blocks))
def test_hash(self):
self.assertEqual(self.get_blocks(["#error hello"]), ["#error hello"])
@@ -2020,7 +2048,7 @@
struct timeval val2;
};
"""
- self.assertEqual(self.parse(text, set(["remove"])), expected)
+ self.assertEqual(self.parse(text, {"remove": True}), expected)
def test_remove_struct_from_end(self):
text = """\
@@ -2039,7 +2067,7 @@
struct timeval val2;
};
"""
- self.assertEqual(self.parse(text, set(["remove"])), expected)
+ self.assertEqual(self.parse(text, {"remove": True}), expected)
def test_remove_minimal_struct(self):
text = """\
@@ -2047,7 +2075,7 @@
};
"""
expected = "";
- self.assertEqual(self.parse(text, set(["remove"])), expected)
+ self.assertEqual(self.parse(text, {"remove": True}), expected)
def test_remove_struct_with_struct_fields(self):
text = """\
@@ -2067,7 +2095,7 @@
struct remove val2;
};
"""
- self.assertEqual(self.parse(text, set(["remove"])), expected)
+ self.assertEqual(self.parse(text, {"remove": True}), expected)
def test_remove_consecutive_structs(self):
text = """\
@@ -2099,7 +2127,7 @@
struct timeval val2;
};
"""
- self.assertEqual(self.parse(text, set(["remove1", "remove2"])), expected)
+ self.assertEqual(self.parse(text, {"remove1": True, "remove2": True}), expected)
def test_remove_multiple_structs(self):
text = """\
@@ -2132,7 +2160,101 @@
int val;
};
"""
- self.assertEqual(self.parse(text, set(["remove1", "remove2"])), expected)
+ self.assertEqual(self.parse(text, {"remove1": True, "remove2": True}), expected)
+
+ def test_remove_struct_with_inline_structs(self):
+ text = """\
+struct remove {
+ int val1;
+ int val2;
+ struct {
+ int val1;
+ struct {
+ int val1;
+ } level2;
+ } level1;
+};
+struct something {
+ struct timeval val1;
+ struct timeval val2;
+};
+"""
+ expected = """\
+struct something {
+ struct timeval val1;
+ struct timeval val2;
+};
+"""
+ self.assertEqual(self.parse(text, {"remove": True}), expected)
+
+ def test_remove_struct_across_blocks(self):
+ text = """\
+struct remove {
+ int val1;
+ int val2;
+#ifdef PARAMETER1
+ PARAMETER1
+#endif
+#ifdef PARAMETER2
+ PARAMETER2
+#endif
+};
+struct something {
+ struct timeval val1;
+ struct timeval val2;
+};
+"""
+ expected = """\
+struct something {
+ struct timeval val1;
+ struct timeval val2;
+};
+"""
+ self.assertEqual(self.parse(text, {"remove": True}), expected)
+
+ def test_remove_struct_across_blocks_multiple_structs(self):
+ text = """\
+struct remove1 {
+ int val1;
+ int val2;
+#ifdef PARAMETER1
+ PARAMETER1
+#endif
+#ifdef PARAMETER2
+ PARAMETER2
+#endif
+};
+struct remove2 {
+};
+struct something {
+ struct timeval val1;
+ struct timeval val2;
+};
+"""
+ expected = """\
+struct something {
+ struct timeval val1;
+ struct timeval val2;
+};
+"""
+ self.assertEqual(self.parse(text, {"remove1": True, "remove2": True}), expected)
+
+ def test_remove_multiple_struct_and_add_includes(self):
+ text = """\
+struct remove1 {
+ int val1;
+ int val2;
+};
+struct remove2 {
+ struct timeval val1;
+ struct timeval val2;
+};
+"""
+ expected = """\
+#include <bits/remove1.h>
+#include <bits/remove2.h>
+"""
+ self.assertEqual(self.parse(text, {"remove1": False, "remove2": False}), expected)
class FullPathTest(unittest.TestCase):
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 2089285..91d26ce 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -1,12 +1,4 @@
-# this module contains all the defaults used by the generation of cleaned-up headers
-# for the Bionic C library
-#
-
-import time, os, sys
-from utils import *
-
-# the list of supported architectures
-kernel_archs = [ 'arm', 'arm64', 'x86' ]
+# All the defaults used to generate the cleaned-up uapi headers for bionic.
# the list of include directories that belong to the kernel
# tree. used when looking for sources...
@@ -35,34 +27,35 @@
"__kernel_old_timeval": "1",
}
-# this is the set of known kernel data structures we want to remove from
-# the final headers
-kernel_structs_to_remove = set(
- [
- # Remove the structures since they are still the same as
- # timeval, itimerval.
- "__kernel_old_timeval",
- "__kernel_old_itimerval",
- ]
- )
+# This is the set of known kernel data structures we want to remove from
+# the final headers. If the map value is False, that means that in
+# addition to removing the structure, add an #include <bits/STRUCT.h>
+# to the file.
+kernel_structs_to_remove = {
+ # Remove the structures since they are still the same as
+ # timeval, itimerval.
+ "__kernel_old_timeval": True,
+ "__kernel_old_itimerval": True,
+ # Replace all of the below structures with #include <bits/STRUCT.h>
+ "epoll_event": False,
+ "flock": False,
+ "flock64": False,
+ "in_addr": False,
+ "ip_mreq_source": False,
+ "ip_msfilter": False,
+ "timespec": False,
+ }
# define to true if you want to remove all defined(CONFIG_FOO) tests
# from the clean headers. testing shows that this is not strictly necessary
# but just generates cleaner results
kernel_remove_config_macros = True
-# maps an architecture to a set of default macros that would be provided by
-# toolchain preprocessor
+# Maps an architecture to a set of default macros that would be provided by
+# the toolchain's preprocessor. Currently only used to remove confusing
+# big-endian junk from the 32-bit arm headers.
kernel_default_arch_macros = {
"arm": {"__ARMEB__": kCppUndefinedMacro, "__ARM_EABI__": "1"},
- "arm64": {},
- "x86": {},
- }
-
-kernel_arch_token_replacements = {
- "arm": {},
- "arm64": {},
- "x86": {},
}
# Replace tokens in the output according to this mapping.
@@ -97,23 +90,15 @@
"__kernel_old_timeval": "timeval",
# Do the same for __kernel_old_itimerval as for timeval.
"__kernel_old_itimerval": "itimerval",
+ # Replace __packed with __attribute__((__packed__)) to avoid depending
+ # on sys/cdefs.h
+ "__packed": "__attribute__((__packed__))",
+ # Remove unused macros (http://b/262917450).
+ "__force": "",
+ "__user": "",
}
-# This is the set of struct definitions that we want to replace with
-# a #include of <bits/struct.h> instead.
-kernel_struct_replacements = set(
- [
- "epoll_event",
- "flock",
- "flock64",
- "in_addr",
- "ip_mreq_source",
- "ip_msfilter",
- ]
- )
-
-
# This is the set of known static inline functions that we want to keep
# in the final kernel headers.
kernel_known_generic_statics = set(
diff --git a/libc/kernel/tools/generate_uapi_headers.sh b/libc/kernel/tools/generate_uapi_headers.sh
index 7e49cde..12f60e5 100755
--- a/libc/kernel/tools/generate_uapi_headers.sh
+++ b/libc/kernel/tools/generate_uapi_headers.sh
@@ -43,7 +43,7 @@
ANDROID_KERNEL_BRANCH="android-mainline"
KERNEL_DIR=""
KERNEL_DOWNLOAD=0
-ARCH_LIST=("arm" "arm64" "x86")
+ARCH_LIST=("arm" "arm64" "riscv" "x86")
ANDROID_KERNEL_DIR="external/kernel-headers/original"
SKIP_GENERATION=0
VERIFY_HEADERS_ONLY=0
diff --git a/libc/kernel/tools/update_all.py b/libc/kernel/tools/update_all.py
index f2e78da..abc72a4 100755
--- a/libc/kernel/tools/update_all.py
+++ b/libc/kernel/tools/update_all.py
@@ -27,8 +27,14 @@
def ProcessFiles(updater, original_dir, modified_dir, src_rel_dir, update_rel_dir):
# Delete the old headers before updating to the new headers.
update_dir = os.path.join(get_kernel_dir(), update_rel_dir)
- shutil.rmtree(update_dir)
- os.mkdir(update_dir, 0o755)
+ for root, dirs, files in os.walk(update_dir, topdown=True):
+ for entry in files:
+ # BUILD is a special file that needs to be preserved.
+ if entry == "BUILD":
+ continue
+ os.remove(os.path.join(root, entry))
+ for entry in dirs:
+ shutil.rmtree(os.path.join(root, entry))
src_dir = os.path.normpath(os.path.join(original_dir, src_rel_dir))
src_dir_len = len(src_dir) + 1
diff --git a/libc/kernel/uapi/BUILD b/libc/kernel/uapi/BUILD
new file mode 100644
index 0000000..3c9bb69
--- /dev/null
+++ b/libc/kernel/uapi/BUILD
@@ -0,0 +1,67 @@
+# Copyright (C) 2022 The Android Open Source Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load("//build/bazel/rules/apis:cc_api_contribution.bzl", "cc_api_headers")
+
+package(default_visibility = ["//bionic/libc:__pkg__"])
+
+cc_api_headers(
+ name = "libc_kernel_uapi_headers",
+ hdrs = glob(["**/*.h"]),
+ system = True,
+)
+
+cc_api_headers(
+ name = "libc_kernel_uapi_asm_arm_headers",
+ hdrs = glob(["asm-arm/**/*.h"]),
+ arch = "arm",
+ include_dir = "asm-arm",
+ system = True,
+)
+
+cc_api_headers(
+ name = "libc_kernel_uapi_asm_arm64_headers",
+ hdrs = glob(["asm-arm64/**/*.h"]),
+ arch = "arm64",
+ include_dir = "asm-arm64",
+ system = True,
+)
+
+cc_api_headers(
+ name = "libc_kernel_uapi_asm_x86_headers",
+ hdrs = glob(["asm-x86/**/*.h"]),
+ arch = "x86",
+ include_dir = "asm-x86",
+ system = True,
+)
+
+cc_api_headers(
+ name = "libc_kernel_uapi_asm_x86_64_headers",
+ hdrs = glob(["asm-x86_64/**/*.h"]),
+ arch = "x86_64",
+ include_dir = "asm-x86_64",
+ system = True,
+)
diff --git a/libc/kernel/uapi/asm-arm/asm/hwcap.h b/libc/kernel/uapi/asm-arm/asm/hwcap.h
index fdc5405..2a3c809 100644
--- a/libc/kernel/uapi/asm-arm/asm/hwcap.h
+++ b/libc/kernel/uapi/asm-arm/asm/hwcap.h
@@ -41,9 +41,17 @@
#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
#define HWCAP_LPAE (1 << 20)
#define HWCAP_EVTSTRM (1 << 21)
+#define HWCAP_FPHP (1 << 22)
+#define HWCAP_ASIMDHP (1 << 23)
+#define HWCAP_ASIMDDP (1 << 24)
+#define HWCAP_ASIMDFHM (1 << 25)
+#define HWCAP_ASIMDBF16 (1 << 26)
+#define HWCAP_I8MM (1 << 27)
#define HWCAP2_AES (1 << 0)
#define HWCAP2_PMULL (1 << 1)
#define HWCAP2_SHA1 (1 << 2)
#define HWCAP2_SHA2 (1 << 3)
#define HWCAP2_CRC32 (1 << 4)
+#define HWCAP2_SB (1 << 5)
+#define HWCAP2_SSBS (1 << 6)
#endif
diff --git a/libc/kernel/uapi/asm-arm/asm/signal.h b/libc/kernel/uapi/asm-arm/asm/signal.h
index 5f7e0c5..90cb8d6 100644
--- a/libc/kernel/uapi/asm-arm/asm/signal.h
+++ b/libc/kernel/uapi/asm-arm/asm/signal.h
@@ -76,8 +76,8 @@
#define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction
typedef struct sigaltstack {
- void __user * ss_sp;
+ void * ss_sp;
int ss_flags;
- size_t ss_size;
+ __kernel_size_t ss_size;
} stack_t;
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/hwcap.h b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
index 4316724..bb592e4 100644
--- a/libc/kernel/uapi/asm-arm64/asm/hwcap.h
+++ b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
@@ -72,4 +72,19 @@
#define HWCAP2_ECV (1 << 19)
#define HWCAP2_AFP (1 << 20)
#define HWCAP2_RPRES (1 << 21)
+#define HWCAP2_MTE3 (1 << 22)
+#define HWCAP2_SME (1 << 23)
+#define HWCAP2_SME_I16I64 (1 << 24)
+#define HWCAP2_SME_F64F64 (1 << 25)
+#define HWCAP2_SME_I8I32 (1 << 26)
+#define HWCAP2_SME_F16F32 (1 << 27)
+#define HWCAP2_SME_B16F32 (1 << 28)
+#define HWCAP2_SME_F32F32 (1 << 29)
+#define HWCAP2_SME_FA64 (1 << 30)
+#define HWCAP2_WFXT (1UL << 31)
+#define HWCAP2_EBF16 (1UL << 32)
+#define HWCAP2_SVE_EBF16 (1UL << 33)
+#define HWCAP2_CSSC (1UL << 34)
+#define HWCAP2_RPRFM (1UL << 35)
+#define HWCAP2_SVE2P1 (1UL << 36)
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/kvm.h b/libc/kernel/uapi/asm-arm64/asm/kvm.h
index c53ee87..ce0c318 100644
--- a/libc/kernel/uapi/asm-arm64/asm/kvm.h
+++ b/libc/kernel/uapi/asm-arm64/asm/kvm.h
@@ -35,6 +35,7 @@
#define __KVM_HAVE_READONLY_MEM
#define __KVM_HAVE_VCPU_EVENTS
#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
+#define KVM_DIRTY_LOG_PAGE_OFFSET 64
#define KVM_REG_SIZE(id) (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
struct kvm_regs {
struct user_pt_regs regs;
@@ -51,9 +52,9 @@
#define KVM_ARM_TARGET_GENERIC_V8 5
#define KVM_ARM_NUM_TARGETS 6
#define KVM_ARM_DEVICE_TYPE_SHIFT 0
-#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT)
+#define KVM_ARM_DEVICE_TYPE_MASK GENMASK(KVM_ARM_DEVICE_TYPE_SHIFT + 15, KVM_ARM_DEVICE_TYPE_SHIFT)
#define KVM_ARM_DEVICE_ID_SHIFT 16
-#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT)
+#define KVM_ARM_DEVICE_ID_MASK GENMASK(KVM_ARM_DEVICE_ID_SHIFT + 15, KVM_ARM_DEVICE_ID_SHIFT)
#define KVM_ARM_DEVICE_VGIC_V2 0
#define KVM_VGIC_V2_ADDR_TYPE_DIST 0
#define KVM_VGIC_V2_ADDR_TYPE_CPU 1
@@ -88,8 +89,10 @@
__u64 dbg_wcr[KVM_ARM_MAX_DBG_REGS];
__u64 dbg_wvr[KVM_ARM_MAX_DBG_REGS];
};
+#define KVM_DEBUG_ARCH_HSR_HIGH_VALID (1 << 0)
struct kvm_debug_exit_arch {
__u32 hsr;
+ __u32 hsr_high;
__u64 far;
};
#define KVM_GUESTDBG_USE_SW_BP (1 << 16)
@@ -118,7 +121,7 @@
struct kvm_arm_copy_mte_tags {
__u64 guest_ipa;
__u64 length;
- void __user * addr;
+ void * addr;
__u64 flags;
__u64 reserved[2];
};
@@ -185,6 +188,21 @@
#define KVM_ARM64_SVE_VQ_MAX __SVE_VQ_MAX
#define KVM_REG_ARM64_SVE_VLS (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_SIZE_U512 | 0xffff)
#define KVM_ARM64_SVE_VLS_WORDS ((KVM_ARM64_SVE_VQ_MAX - KVM_ARM64_SVE_VQ_MIN) / 64 + 1)
+#define KVM_REG_ARM_FW_FEAT_BMAP (0x0016 << KVM_REG_ARM_COPROC_SHIFT)
+#define KVM_REG_ARM_FW_FEAT_BMAP_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW_FEAT_BMAP | ((r) & 0xffff))
+#define KVM_REG_ARM_STD_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(0)
+enum {
+ KVM_REG_ARM_STD_BIT_TRNG_V1_0 = 0,
+};
+#define KVM_REG_ARM_STD_HYP_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(1)
+enum {
+ KVM_REG_ARM_STD_HYP_BIT_PV_TIME = 0,
+};
+#define KVM_REG_ARM_VENDOR_HYP_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(2)
+enum {
+ KVM_REG_ARM_VENDOR_HYP_BIT_FUNC_FEAT = 0,
+ KVM_REG_ARM_VENDOR_HYP_BIT_PTP = 1,
+};
#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
@@ -214,6 +232,7 @@
#define KVM_ARM_VCPU_PMU_V3_IRQ 0
#define KVM_ARM_VCPU_PMU_V3_INIT 1
#define KVM_ARM_VCPU_PMU_V3_FILTER 2
+#define KVM_ARM_VCPU_PMU_V3_SET_PMU 3
#define KVM_ARM_VCPU_TIMER_CTRL 1
#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
@@ -244,5 +263,7 @@
#define KVM_PSCI_RET_NI PSCI_RET_NOT_SUPPORTED
#define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS
#define KVM_PSCI_RET_DENIED PSCI_RET_DENIED
+#define KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 (1ULL << 0)
+#define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED (1ULL << 0)
#endif
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/perf_regs.h b/libc/kernel/uapi/asm-arm64/asm/perf_regs.h
index 71d496f..e18fd05 100644
--- a/libc/kernel/uapi/asm-arm64/asm/perf_regs.h
+++ b/libc/kernel/uapi/asm-arm64/asm/perf_regs.h
@@ -53,5 +53,8 @@
PERF_REG_ARM64_SP,
PERF_REG_ARM64_PC,
PERF_REG_ARM64_MAX,
+ PERF_REG_ARM64_VG = 46,
+ PERF_REG_ARM64_EXTENDED_MAX
};
+#define PERF_REG_EXTENDED_MASK (1ULL << PERF_REG_ARM64_VG)
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/ptrace.h b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
index 480efcf..9540c3e 100644
--- a/libc/kernel/uapi/asm-arm64/asm/ptrace.h
+++ b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
@@ -111,7 +111,7 @@
#define SVE_PT_SVE_FPSR_OFFSET(vq) ((SVE_PT_SVE_FFR_OFFSET(vq) + SVE_PT_SVE_FFR_SIZE(vq) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
#define SVE_PT_SVE_FPCR_OFFSET(vq) (SVE_PT_SVE_FPSR_OFFSET(vq) + SVE_PT_SVE_FPSR_SIZE)
#define SVE_PT_SVE_SIZE(vq,flags) ((SVE_PT_SVE_FPCR_OFFSET(vq) + SVE_PT_SVE_FPCR_SIZE - SVE_PT_SVE_OFFSET + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
-#define SVE_PT_SIZE(vq,flags) (((flags) & SVE_PT_REGS_MASK) == SVE_PT_REGS_SVE ? SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq, flags) : SVE_PT_FPSIMD_OFFSET + SVE_PT_FPSIMD_SIZE(vq, flags))
+#define SVE_PT_SIZE(vq,flags) (((flags) & SVE_PT_REGS_MASK) == SVE_PT_REGS_SVE ? SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq, flags) : ((((flags) & SVE_PT_REGS_MASK) == SVE_PT_REGS_FPSIMD ? SVE_PT_FPSIMD_OFFSET + SVE_PT_FPSIMD_SIZE(vq, flags) : SVE_PT_REGS_OFFSET)))
struct user_pac_mask {
__u64 data_mask;
__u64 insn_mask;
@@ -125,5 +125,19 @@
struct user_pac_generic_keys {
__uint128_t apgakey;
};
+struct user_za_header {
+ __u32 size;
+ __u32 max_size;
+ __u16 vl;
+ __u16 max_vl;
+ __u16 flags;
+ __u16 __reserved;
+};
+#define ZA_PT_VL_INHERIT ((1 << 17) >> 16)
+#define ZA_PT_VL_ONEXEC ((1 << 18) >> 16)
+#define ZA_PT_ZA_OFFSET ((sizeof(struct user_za_header) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
+#define ZA_PT_ZAV_OFFSET(vq,n) (ZA_PT_ZA_OFFSET + ((vq * __SVE_VQ_BYTES) * n))
+#define ZA_PT_ZA_SIZE(vq) ((vq * __SVE_VQ_BYTES) * (vq * __SVE_VQ_BYTES))
+#define ZA_PT_SIZE(vq) (ZA_PT_ZA_OFFSET + ZA_PT_ZA_SIZE(vq))
#endif
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/sigcontext.h b/libc/kernel/uapi/asm-arm64/asm/sigcontext.h
index 518079d..04aa593 100644
--- a/libc/kernel/uapi/asm-arm64/asm/sigcontext.h
+++ b/libc/kernel/uapi/asm-arm64/asm/sigcontext.h
@@ -55,6 +55,14 @@
struct sve_context {
struct _aarch64_ctx head;
__u16 vl;
+ __u16 flags;
+ __u16 __reserved[2];
+};
+#define SVE_SIG_FLAG_SM 0x1
+#define ZA_MAGIC 0x54366345
+struct za_context {
+ struct _aarch64_ctx head;
+ __u16 vl;
__u16 __reserved[3];
};
#endif
@@ -82,4 +90,8 @@
#define SVE_SIG_FFR_OFFSET(vq) (SVE_SIG_REGS_OFFSET + __SVE_FFR_OFFSET(vq))
#define SVE_SIG_REGS_SIZE(vq) (__SVE_FFR_OFFSET(vq) + __SVE_FFR_SIZE(vq))
#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
+#define ZA_SIG_REGS_OFFSET ((sizeof(struct za_context) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
+#define ZA_SIG_REGS_SIZE(vq) ((vq * __SVE_VQ_BYTES) * (vq * __SVE_VQ_BYTES))
+#define ZA_SIG_ZAV_OFFSET(vq,n) (ZA_SIG_REGS_OFFSET + (SVE_SIG_ZREG_SIZE(vq) * n))
+#define ZA_SIG_CONTEXT_SIZE(vq) (ZA_SIG_REGS_OFFSET + ZA_SIG_REGS_SIZE(vq))
#endif
diff --git a/libc/kernel/uapi/asm-generic/fcntl.h b/libc/kernel/uapi/asm-generic/fcntl.h
index a2cb5f4..ea8c108 100644
--- a/libc/kernel/uapi/asm-generic/fcntl.h
+++ b/libc/kernel/uapi/asm-generic/fcntl.h
@@ -100,7 +100,7 @@
#define F_SETSIG 10
#define F_GETSIG 11
#endif
-#ifndef __LP64__
+#if __BITS_PER_LONG == 32
#ifndef F_GETLK64
#define F_GETLK64 12
#define F_SETLK64 13
@@ -144,13 +144,5 @@
#define LOCK_RW 192
#define F_LINUX_SPECIFIC_BASE 1024
#ifndef HAVE_ARCH_STRUCT_FLOCK
-#ifndef __ARCH_FLOCK_PAD
-#define __ARCH_FLOCK_PAD
-#endif
-#endif
-#ifndef HAVE_ARCH_STRUCT_FLOCK64
-#ifndef __ARCH_FLOCK64_PAD
-#define __ARCH_FLOCK64_PAD
-#endif
#endif
#endif
diff --git a/libc/kernel/uapi/asm-generic/hugetlb_encode.h b/libc/kernel/uapi/asm-generic/hugetlb_encode.h
index 73d8180..059991c 100644
--- a/libc/kernel/uapi/asm-generic/hugetlb_encode.h
+++ b/libc/kernel/uapi/asm-generic/hugetlb_encode.h
@@ -20,17 +20,17 @@
#define _ASM_GENERIC_HUGETLB_ENCODE_H_
#define HUGETLB_FLAG_ENCODE_SHIFT 26
#define HUGETLB_FLAG_ENCODE_MASK 0x3f
-#define HUGETLB_FLAG_ENCODE_16KB (14 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT)
-#define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_16KB (14U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_64KB (16U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_512KB (19U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_1MB (20U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_2MB (21U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_8MB (23U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_16MB (24U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_32MB (25U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_256MB (28U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_512MB (29U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_1GB (30U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_2GB (31U << HUGETLB_FLAG_ENCODE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_16GB (34U << HUGETLB_FLAG_ENCODE_SHIFT)
#endif
diff --git a/libc/kernel/uapi/asm-generic/mman-common.h b/libc/kernel/uapi/asm-generic/mman-common.h
index 9440576..966d05b 100644
--- a/libc/kernel/uapi/asm-generic/mman-common.h
+++ b/libc/kernel/uapi/asm-generic/mman-common.h
@@ -62,6 +62,8 @@
#define MADV_PAGEOUT 21
#define MADV_POPULATE_READ 22
#define MADV_POPULATE_WRITE 23
+#define MADV_DONTNEED_LOCKED 24
+#define MADV_COLLAPSE 25
#define MAP_FILE 0
#define PKEY_DISABLE_ACCESS 0x1
#define PKEY_DISABLE_WRITE 0x2
diff --git a/libc/kernel/uapi/asm-generic/poll.h b/libc/kernel/uapi/asm-generic/poll.h
index 372bc77..ba6f2e9 100644
--- a/libc/kernel/uapi/asm-generic/poll.h
+++ b/libc/kernel/uapi/asm-generic/poll.h
@@ -41,8 +41,8 @@
#ifndef POLLRDHUP
#define POLLRDHUP 0x2000
#endif
-#define POLLFREE (__force __poll_t) 0x4000
-#define POLL_BUSY_LOOP (__force __poll_t) 0x8000
+#define POLLFREE ( __poll_t) 0x4000
+#define POLL_BUSY_LOOP ( __poll_t) 0x8000
struct pollfd {
int fd;
short events;
diff --git a/libc/kernel/uapi/asm-generic/shmbuf.h b/libc/kernel/uapi/asm-generic/shmbuf.h
index 067ffbc..11487f4 100644
--- a/libc/kernel/uapi/asm-generic/shmbuf.h
+++ b/libc/kernel/uapi/asm-generic/shmbuf.h
@@ -19,9 +19,11 @@
#ifndef __ASM_GENERIC_SHMBUF_H
#define __ASM_GENERIC_SHMBUF_H
#include <asm/bitsperlong.h>
+#include <asm/ipcbuf.h>
+#include <asm/posix_types.h>
struct shmid64_ds {
struct ipc64_perm shm_perm;
- size_t shm_segsz;
+ __kernel_size_t shm_segsz;
#if __BITS_PER_LONG == 64
long shm_atime;
long shm_dtime;
diff --git a/libc/kernel/uapi/asm-generic/siginfo.h b/libc/kernel/uapi/asm-generic/siginfo.h
index f9199e5..90393ba 100644
--- a/libc/kernel/uapi/asm-generic/siginfo.h
+++ b/libc/kernel/uapi/asm-generic/siginfo.h
@@ -22,7 +22,7 @@
#include <linux/types.h>
typedef union sigval {
int sival_int;
- void __user * sival_ptr;
+ void * sival_ptr;
} sigval_t;
#define SI_MAX_SIZE 128
#ifndef __ARCH_SI_BAND_T
@@ -58,7 +58,7 @@
__ARCH_SI_CLOCK_T _stime;
} _sigchld;
struct {
- void __user * _addr;
+ void * _addr;
#ifdef __ia64__
int _imm;
unsigned int _flags;
@@ -70,8 +70,8 @@
short _addr_lsb;
struct {
char _dummy_bnd[__ADDR_BND_PKEY_PAD];
- void __user * _lower;
- void __user * _upper;
+ void * _lower;
+ void * _upper;
} _addr_bnd;
struct {
char _dummy_pkey[__ADDR_BND_PKEY_PAD];
@@ -80,6 +80,7 @@
struct {
unsigned long _data;
__u32 _type;
+ __u32 _flags;
} _perf;
};
} _sigfault;
@@ -88,7 +89,7 @@
int _fd;
} _sigpoll;
struct {
- void __user * _call_addr;
+ void * _call_addr;
int _syscall;
unsigned int _arch;
} _sigsys;
@@ -125,6 +126,7 @@
#define si_pkey _sifields._sigfault._addr_pkey._pkey
#define si_perf_data _sifields._sigfault._perf._data
#define si_perf_type _sifields._sigfault._perf._type
+#define si_perf_flags _sifields._sigfault._perf._flags
#define si_band _sifields._sigpoll._band
#define si_fd _sifields._sigpoll._fd
#define si_call_addr _sifields._sigsys._call_addr
@@ -197,6 +199,7 @@
#define TRAP_UNK 5
#define TRAP_PERF 6
#define NSIGTRAP 6
+#define TRAP_PERF_FLAG_ASYNC (1u << 0)
#define CLD_EXITED 1
#define CLD_KILLED 2
#define CLD_DUMPED 3
diff --git a/libc/kernel/uapi/asm-generic/signal-defs.h b/libc/kernel/uapi/asm-generic/signal-defs.h
index c7e9504..dea8fbc 100644
--- a/libc/kernel/uapi/asm-generic/signal-defs.h
+++ b/libc/kernel/uapi/asm-generic/signal-defs.h
@@ -55,11 +55,11 @@
#endif
#ifndef __ASSEMBLY__
typedef void __signalfn_t(int);
-typedef __signalfn_t __user * __sighandler_t;
+typedef __signalfn_t * __sighandler_t;
typedef void __restorefn_t(void);
-typedef __restorefn_t __user * __sigrestore_t;
-#define SIG_DFL ((__force __sighandler_t) 0)
-#define SIG_IGN ((__force __sighandler_t) 1)
-#define SIG_ERR ((__force __sighandler_t) - 1)
+typedef __restorefn_t * __sigrestore_t;
+#define SIG_DFL (( __sighandler_t) 0)
+#define SIG_IGN (( __sighandler_t) 1)
+#define SIG_ERR (( __sighandler_t) - 1)
#endif
#endif
diff --git a/libc/kernel/uapi/asm-generic/signal.h b/libc/kernel/uapi/asm-generic/signal.h
index 874fece..9cf393f 100644
--- a/libc/kernel/uapi/asm-generic/signal.h
+++ b/libc/kernel/uapi/asm-generic/signal.h
@@ -82,9 +82,9 @@
sigset_t sa_mask;
};
typedef struct sigaltstack {
- void __user * ss_sp;
+ void * ss_sp;
int ss_flags;
- size_t ss_size;
+ __kernel_size_t ss_size;
} stack_t;
#endif
#endif
diff --git a/libc/kernel/uapi/asm-generic/socket.h b/libc/kernel/uapi/asm-generic/socket.h
index 6767993..1a321bf 100644
--- a/libc/kernel/uapi/asm-generic/socket.h
+++ b/libc/kernel/uapi/asm-generic/socket.h
@@ -100,6 +100,8 @@
#define SO_NETNS_COOKIE 71
#define SO_BUF_LOCK 72
#define SO_RESERVE_MEM 73
+#define SO_TXREHASH 74
+#define SO_RCVMARK 75
#if __BITS_PER_LONG == 64 || defined(__x86_64__) && defined(__ILP32__)
#define SO_TIMESTAMP SO_TIMESTAMP_OLD
#define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
diff --git a/libc/kernel/uapi/asm-generic/termbits-common.h b/libc/kernel/uapi/asm-generic/termbits-common.h
new file mode 100644
index 0000000..281eee8
--- /dev/null
+++ b/libc/kernel/uapi/asm-generic/termbits-common.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_GENERIC_TERMBITS_COMMON_H
+#define __ASM_GENERIC_TERMBITS_COMMON_H
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+#define IGNBRK 0x001
+#define BRKINT 0x002
+#define IGNPAR 0x004
+#define PARMRK 0x008
+#define INPCK 0x010
+#define ISTRIP 0x020
+#define INLCR 0x040
+#define IGNCR 0x080
+#define ICRNL 0x100
+#define IXANY 0x800
+#define OPOST 0x01
+#define OCRNL 0x08
+#define ONOCR 0x10
+#define ONLRET 0x20
+#define OFILL 0x40
+#define OFDEL 0x80
+#define B0 0x00000000
+#define B50 0x00000001
+#define B75 0x00000002
+#define B110 0x00000003
+#define B134 0x00000004
+#define B150 0x00000005
+#define B200 0x00000006
+#define B300 0x00000007
+#define B600 0x00000008
+#define B1200 0x00000009
+#define B1800 0x0000000a
+#define B2400 0x0000000b
+#define B4800 0x0000000c
+#define B9600 0x0000000d
+#define B19200 0x0000000e
+#define B38400 0x0000000f
+#define EXTA B19200
+#define EXTB B38400
+#define ADDRB 0x20000000
+#define CMSPAR 0x40000000
+#define CRTSCTS 0x80000000
+#define IBSHIFT 16
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+#endif
diff --git a/libc/kernel/uapi/asm-generic/termbits.h b/libc/kernel/uapi/asm-generic/termbits.h
index b592964..87d6c82 100644
--- a/libc/kernel/uapi/asm-generic/termbits.h
+++ b/libc/kernel/uapi/asm-generic/termbits.h
@@ -18,9 +18,7 @@
****************************************************************************/
#ifndef __ASM_GENERIC_TERMBITS_H
#define __ASM_GENERIC_TERMBITS_H
-#include <linux/posix_types.h>
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
+#include <asm-generic/termbits-common.h>
typedef unsigned int tcflag_t;
#define NCCS 19
struct termios {
@@ -68,126 +66,82 @@
#define VWERASE 14
#define VLNEXT 15
#define VEOL2 16
-#define IGNBRK 0000001
-#define BRKINT 0000002
-#define IGNPAR 0000004
-#define PARMRK 0000010
-#define INPCK 0000020
-#define ISTRIP 0000040
-#define INLCR 0000100
-#define IGNCR 0000200
-#define ICRNL 0000400
-#define IUCLC 0001000
-#define IXON 0002000
-#define IXANY 0004000
-#define IXOFF 0010000
-#define IMAXBEL 0020000
-#define IUTF8 0040000
-#define OPOST 0000001
-#define OLCUC 0000002
-#define ONLCR 0000004
-#define OCRNL 0000010
-#define ONOCR 0000020
-#define ONLRET 0000040
-#define OFILL 0000100
-#define OFDEL 0000200
-#define NLDLY 0000400
-#define NL0 0000000
-#define NL1 0000400
-#define CRDLY 0003000
-#define CR0 0000000
-#define CR1 0001000
-#define CR2 0002000
-#define CR3 0003000
-#define TABDLY 0014000
-#define TAB0 0000000
-#define TAB1 0004000
-#define TAB2 0010000
-#define TAB3 0014000
-#define XTABS 0014000
-#define BSDLY 0020000
-#define BS0 0000000
-#define BS1 0020000
-#define VTDLY 0040000
-#define VT0 0000000
-#define VT1 0040000
-#define FFDLY 0100000
-#define FF0 0000000
-#define FF1 0100000
-#define CBAUD 0010017
-#define B0 0000000
-#define B50 0000001
-#define B75 0000002
-#define B110 0000003
-#define B134 0000004
-#define B150 0000005
-#define B200 0000006
-#define B300 0000007
-#define B600 0000010
-#define B1200 0000011
-#define B1800 0000012
-#define B2400 0000013
-#define B4800 0000014
-#define B9600 0000015
-#define B19200 0000016
-#define B38400 0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CSIZE 0000060
-#define CS5 0000000
-#define CS6 0000020
-#define CS7 0000040
-#define CS8 0000060
-#define CSTOPB 0000100
-#define CREAD 0000200
-#define PARENB 0000400
-#define PARODD 0001000
-#define HUPCL 0002000
-#define CLOCAL 0004000
-#define CBAUDEX 0010000
-#define BOTHER 0010000
-#define B57600 0010001
-#define B115200 0010002
-#define B230400 0010003
-#define B460800 0010004
-#define B500000 0010005
-#define B576000 0010006
-#define B921600 0010007
-#define B1000000 0010010
-#define B1152000 0010011
-#define B1500000 0010012
-#define B2000000 0010013
-#define B2500000 0010014
-#define B3000000 0010015
-#define B3500000 0010016
-#define B4000000 0010017
-#define CIBAUD 002003600000
-#define CMSPAR 010000000000
-#define CRTSCTS 020000000000
-#define IBSHIFT 16
-#define ISIG 0000001
-#define ICANON 0000002
-#define XCASE 0000004
-#define ECHO 0000010
-#define ECHOE 0000020
-#define ECHOK 0000040
-#define ECHONL 0000100
-#define NOFLSH 0000200
-#define TOSTOP 0000400
-#define ECHOCTL 0001000
-#define ECHOPRT 0002000
-#define ECHOKE 0004000
-#define FLUSHO 0010000
-#define PENDIN 0040000
-#define IEXTEN 0100000
-#define EXTPROC 0200000
-#define TCOOFF 0
-#define TCOON 1
-#define TCIOFF 2
-#define TCION 3
-#define TCIFLUSH 0
-#define TCOFLUSH 1
-#define TCIOFLUSH 2
+#define IUCLC 0x0200
+#define IXON 0x0400
+#define IXOFF 0x1000
+#define IMAXBEL 0x2000
+#define IUTF8 0x4000
+#define OLCUC 0x00002
+#define ONLCR 0x00004
+#define NLDLY 0x00100
+#define NL0 0x00000
+#define NL1 0x00100
+#define CRDLY 0x00600
+#define CR0 0x00000
+#define CR1 0x00200
+#define CR2 0x00400
+#define CR3 0x00600
+#define TABDLY 0x01800
+#define TAB0 0x00000
+#define TAB1 0x00800
+#define TAB2 0x01000
+#define TAB3 0x01800
+#define XTABS 0x01800
+#define BSDLY 0x02000
+#define BS0 0x00000
+#define BS1 0x02000
+#define VTDLY 0x04000
+#define VT0 0x00000
+#define VT1 0x04000
+#define FFDLY 0x08000
+#define FF0 0x00000
+#define FF1 0x08000
+#define CBAUD 0x0000100f
+#define CSIZE 0x00000030
+#define CS5 0x00000000
+#define CS6 0x00000010
+#define CS7 0x00000020
+#define CS8 0x00000030
+#define CSTOPB 0x00000040
+#define CREAD 0x00000080
+#define PARENB 0x00000100
+#define PARODD 0x00000200
+#define HUPCL 0x00000400
+#define CLOCAL 0x00000800
+#define CBAUDEX 0x00001000
+#define BOTHER 0x00001000
+#define B57600 0x00001001
+#define B115200 0x00001002
+#define B230400 0x00001003
+#define B460800 0x00001004
+#define B500000 0x00001005
+#define B576000 0x00001006
+#define B921600 0x00001007
+#define B1000000 0x00001008
+#define B1152000 0x00001009
+#define B1500000 0x0000100a
+#define B2000000 0x0000100b
+#define B2500000 0x0000100c
+#define B3000000 0x0000100d
+#define B3500000 0x0000100e
+#define B4000000 0x0000100f
+#define CIBAUD 0x100f0000
+#define ISIG 0x00001
+#define ICANON 0x00002
+#define XCASE 0x00004
+#define ECHO 0x00008
+#define ECHOE 0x00010
+#define ECHOK 0x00020
+#define ECHONL 0x00040
+#define NOFLSH 0x00080
+#define TOSTOP 0x00100
+#define ECHOCTL 0x00200
+#define ECHOPRT 0x00400
+#define ECHOKE 0x00800
+#define FLUSHO 0x01000
+#define PENDIN 0x04000
+#define IEXTEN 0x08000
+#define EXTPROC 0x10000
#define TCSANOW 0
#define TCSADRAIN 1
#define TCSAFLUSH 2
diff --git a/libc/kernel/uapi/asm-generic/types.h b/libc/kernel/uapi/asm-generic/types.h
index ea6e7df..bac728e 100644
--- a/libc/kernel/uapi/asm-generic/types.h
+++ b/libc/kernel/uapi/asm-generic/types.h
@@ -16,7 +16,7 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _ASM_GENERIC_TYPES_H
-#define _ASM_GENERIC_TYPES_H
+#ifndef _UAPI_ASM_GENERIC_TYPES_H
+#define _UAPI_ASM_GENERIC_TYPES_H
#include <asm-generic/int-ll64.h>
#endif
diff --git a/libc/kernel/uapi/asm-generic/unistd.h b/libc/kernel/uapi/asm-generic/unistd.h
index 4b9f174..d23958b 100644
--- a/libc/kernel/uapi/asm-generic/unistd.h
+++ b/libc/kernel/uapi/asm-generic/unistd.h
@@ -360,7 +360,7 @@
#endif
#define __NR_rseq 293
#define __NR_kexec_file_load 294
-#if __BITS_PER_LONG == 32
+#if defined(__SYSCALL_COMPAT) || __BITS_PER_LONG == 32
#define __NR_clock_gettime64 403
#define __NR_clock_settime64 404
#define __NR_clock_adjtime64 405
diff --git a/libc/kernel/uapi/asm-riscv/asm/auxvec.h b/libc/kernel/uapi/asm-riscv/asm/auxvec.h
new file mode 100644
index 0000000..c70be17
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/auxvec.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_RISCV_AUXVEC_H
+#define _UAPI_ASM_RISCV_AUXVEC_H
+#define AT_SYSINFO_EHDR 33
+#define AT_L1I_CACHESIZE 40
+#define AT_L1I_CACHEGEOMETRY 41
+#define AT_L1D_CACHESIZE 42
+#define AT_L1D_CACHEGEOMETRY 43
+#define AT_L2_CACHESIZE 44
+#define AT_L2_CACHEGEOMETRY 45
+#define AT_L3_CACHESIZE 46
+#define AT_L3_CACHEGEOMETRY 47
+#define AT_VECTOR_SIZE_ARCH 9
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/bitsperlong.h b/libc/kernel/uapi/asm-riscv/asm/bitsperlong.h
new file mode 100644
index 0000000..098b610
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/bitsperlong.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
+#define _UAPI_ASM_RISCV_BITSPERLONG_H
+#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
+#include <asm-generic/bitsperlong.h>
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/bpf_perf_event.h b/libc/kernel/uapi/asm-riscv/asm/bpf_perf_event.h
new file mode 100644
index 0000000..47c09fd
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/bpf_perf_event.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
+#define _UAPI__ASM_BPF_PERF_EVENT_H__
+#include <asm/ptrace.h>
+typedef struct user_regs_struct bpf_user_pt_regs_t;
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/byteorder.h b/libc/kernel/uapi/asm-riscv/asm/byteorder.h
new file mode 100644
index 0000000..42afc14
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/byteorder.h
@@ -0,0 +1,22 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_RISCV_BYTEORDER_H
+#define _UAPI_ASM_RISCV_BYTEORDER_H
+#include <linux/byteorder/little_endian.h>
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/elf.h b/libc/kernel/uapi/asm-riscv/asm/elf.h
new file mode 100644
index 0000000..07593d9
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/elf.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_RISCV_ELF_H
+#define _UAPI_ASM_RISCV_ELF_H
+#include <asm/ptrace.h>
+typedef unsigned long elf_greg_t;
+typedef struct user_regs_struct elf_gregset_t;
+#define ELF_NGREG (sizeof(elf_gregset_t) / sizeof(elf_greg_t))
+typedef __u64 elf_fpreg_t;
+typedef union __riscv_fp_state elf_fpregset_t;
+#define ELF_NFPREG (sizeof(struct __riscv_d_ext_state) / sizeof(elf_fpreg_t))
+#if __riscv_xlen == 64
+#define ELF_RISCV_R_SYM(r_info) ELF64_R_SYM(r_info)
+#define ELF_RISCV_R_TYPE(r_info) ELF64_R_TYPE(r_info)
+#else
+#define ELF_RISCV_R_SYM(r_info) ELF32_R_SYM(r_info)
+#define ELF_RISCV_R_TYPE(r_info) ELF32_R_TYPE(r_info)
+#endif
+#define R_RISCV_NONE 0
+#define R_RISCV_32 1
+#define R_RISCV_64 2
+#define R_RISCV_RELATIVE 3
+#define R_RISCV_COPY 4
+#define R_RISCV_JUMP_SLOT 5
+#define R_RISCV_TLS_DTPMOD32 6
+#define R_RISCV_TLS_DTPMOD64 7
+#define R_RISCV_TLS_DTPREL32 8
+#define R_RISCV_TLS_DTPREL64 9
+#define R_RISCV_TLS_TPREL32 10
+#define R_RISCV_TLS_TPREL64 11
+#define R_RISCV_BRANCH 16
+#define R_RISCV_JAL 17
+#define R_RISCV_CALL 18
+#define R_RISCV_CALL_PLT 19
+#define R_RISCV_GOT_HI20 20
+#define R_RISCV_TLS_GOT_HI20 21
+#define R_RISCV_TLS_GD_HI20 22
+#define R_RISCV_PCREL_HI20 23
+#define R_RISCV_PCREL_LO12_I 24
+#define R_RISCV_PCREL_LO12_S 25
+#define R_RISCV_HI20 26
+#define R_RISCV_LO12_I 27
+#define R_RISCV_LO12_S 28
+#define R_RISCV_TPREL_HI20 29
+#define R_RISCV_TPREL_LO12_I 30
+#define R_RISCV_TPREL_LO12_S 31
+#define R_RISCV_TPREL_ADD 32
+#define R_RISCV_ADD8 33
+#define R_RISCV_ADD16 34
+#define R_RISCV_ADD32 35
+#define R_RISCV_ADD64 36
+#define R_RISCV_SUB8 37
+#define R_RISCV_SUB16 38
+#define R_RISCV_SUB32 39
+#define R_RISCV_SUB64 40
+#define R_RISCV_GNU_VTINHERIT 41
+#define R_RISCV_GNU_VTENTRY 42
+#define R_RISCV_ALIGN 43
+#define R_RISCV_RVC_BRANCH 44
+#define R_RISCV_RVC_JUMP 45
+#define R_RISCV_LUI 46
+#define R_RISCV_GPREL_I 47
+#define R_RISCV_GPREL_S 48
+#define R_RISCV_TPREL_I 49
+#define R_RISCV_TPREL_S 50
+#define R_RISCV_RELAX 51
+#define R_RISCV_SUB6 52
+#define R_RISCV_SET6 53
+#define R_RISCV_SET8 54
+#define R_RISCV_SET16 55
+#define R_RISCV_SET32 56
+#define R_RISCV_32_PCREL 57
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/errno.h b/libc/kernel/uapi/asm-riscv/asm/errno.h
new file mode 100644
index 0000000..392cd94
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/errno.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/errno.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/fcntl.h b/libc/kernel/uapi/asm-riscv/asm/fcntl.h
new file mode 100644
index 0000000..518d3a7
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/fcntl.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/fcntl.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/hwcap.h b/libc/kernel/uapi/asm-riscv/asm/hwcap.h
new file mode 100644
index 0000000..d130cf7
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/hwcap.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_RISCV_HWCAP_H
+#define _UAPI_ASM_RISCV_HWCAP_H
+#define COMPAT_HWCAP_ISA_I (1 << ('I' - 'A'))
+#define COMPAT_HWCAP_ISA_M (1 << ('M' - 'A'))
+#define COMPAT_HWCAP_ISA_A (1 << ('A' - 'A'))
+#define COMPAT_HWCAP_ISA_F (1 << ('F' - 'A'))
+#define COMPAT_HWCAP_ISA_D (1 << ('D' - 'A'))
+#define COMPAT_HWCAP_ISA_C (1 << ('C' - 'A'))
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/ioctl.h b/libc/kernel/uapi/asm-riscv/asm/ioctl.h
new file mode 100644
index 0000000..7b7bd37
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/ioctl.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/ioctl.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/ioctls.h b/libc/kernel/uapi/asm-riscv/asm/ioctls.h
new file mode 100644
index 0000000..0c66935
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/ioctls.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/ioctls.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/ipcbuf.h b/libc/kernel/uapi/asm-riscv/asm/ipcbuf.h
new file mode 100644
index 0000000..0021f14
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/ipcbuf.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/ipcbuf.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/kvm.h b/libc/kernel/uapi/asm-riscv/asm/kvm.h
new file mode 100644
index 0000000..b49e3a0
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/kvm.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_KVM_RISCV_H
+#define __LINUX_KVM_RISCV_H
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+#include <asm/ptrace.h>
+#define __KVM_HAVE_READONLY_MEM
+#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
+#define KVM_INTERRUPT_SET - 1U
+#define KVM_INTERRUPT_UNSET - 2U
+struct kvm_regs {
+};
+struct kvm_fpu {
+};
+struct kvm_debug_exit_arch {
+};
+struct kvm_guest_debug_arch {
+};
+struct kvm_sync_regs {
+};
+struct kvm_sregs {
+};
+struct kvm_riscv_config {
+ unsigned long isa;
+ unsigned long zicbom_block_size;
+ unsigned long mvendorid;
+ unsigned long marchid;
+ unsigned long mimpid;
+};
+struct kvm_riscv_core {
+ struct user_regs_struct regs;
+ unsigned long mode;
+};
+#define KVM_RISCV_MODE_S 1
+#define KVM_RISCV_MODE_U 0
+struct kvm_riscv_csr {
+ unsigned long sstatus;
+ unsigned long sie;
+ unsigned long stvec;
+ unsigned long sscratch;
+ unsigned long sepc;
+ unsigned long scause;
+ unsigned long stval;
+ unsigned long sip;
+ unsigned long satp;
+ unsigned long scounteren;
+};
+struct kvm_riscv_timer {
+ __u64 frequency;
+ __u64 time;
+ __u64 compare;
+ __u64 state;
+};
+enum KVM_RISCV_ISA_EXT_ID {
+ KVM_RISCV_ISA_EXT_A = 0,
+ KVM_RISCV_ISA_EXT_C,
+ KVM_RISCV_ISA_EXT_D,
+ KVM_RISCV_ISA_EXT_F,
+ KVM_RISCV_ISA_EXT_H,
+ KVM_RISCV_ISA_EXT_I,
+ KVM_RISCV_ISA_EXT_M,
+ KVM_RISCV_ISA_EXT_SVPBMT,
+ KVM_RISCV_ISA_EXT_SSTC,
+ KVM_RISCV_ISA_EXT_SVINVAL,
+ KVM_RISCV_ISA_EXT_ZIHINTPAUSE,
+ KVM_RISCV_ISA_EXT_ZICBOM,
+ KVM_RISCV_ISA_EXT_MAX,
+};
+#define KVM_RISCV_TIMER_STATE_OFF 0
+#define KVM_RISCV_TIMER_STATE_ON 1
+#define KVM_REG_SIZE(id) (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
+#define KVM_REG_RISCV_TYPE_MASK 0x00000000FF000000
+#define KVM_REG_RISCV_TYPE_SHIFT 24
+#define KVM_REG_RISCV_CONFIG (0x01 << KVM_REG_RISCV_TYPE_SHIFT)
+#define KVM_REG_RISCV_CONFIG_REG(name) (offsetof(struct kvm_riscv_config, name) / sizeof(unsigned long))
+#define KVM_REG_RISCV_CORE (0x02 << KVM_REG_RISCV_TYPE_SHIFT)
+#define KVM_REG_RISCV_CORE_REG(name) (offsetof(struct kvm_riscv_core, name) / sizeof(unsigned long))
+#define KVM_REG_RISCV_CSR (0x03 << KVM_REG_RISCV_TYPE_SHIFT)
+#define KVM_REG_RISCV_CSR_REG(name) (offsetof(struct kvm_riscv_csr, name) / sizeof(unsigned long))
+#define KVM_REG_RISCV_TIMER (0x04 << KVM_REG_RISCV_TYPE_SHIFT)
+#define KVM_REG_RISCV_TIMER_REG(name) (offsetof(struct kvm_riscv_timer, name) / sizeof(__u64))
+#define KVM_REG_RISCV_FP_F (0x05 << KVM_REG_RISCV_TYPE_SHIFT)
+#define KVM_REG_RISCV_FP_F_REG(name) (offsetof(struct __riscv_f_ext_state, name) / sizeof(__u32))
+#define KVM_REG_RISCV_FP_D (0x06 << KVM_REG_RISCV_TYPE_SHIFT)
+#define KVM_REG_RISCV_FP_D_REG(name) (offsetof(struct __riscv_d_ext_state, name) / sizeof(__u64))
+#define KVM_REG_RISCV_ISA_EXT (0x07 << KVM_REG_RISCV_TYPE_SHIFT)
+#endif
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/mman.h b/libc/kernel/uapi/asm-riscv/asm/mman.h
new file mode 100644
index 0000000..6c23fb6
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/mman.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/mman.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/msgbuf.h b/libc/kernel/uapi/asm-riscv/asm/msgbuf.h
new file mode 100644
index 0000000..7809e3c
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/msgbuf.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/msgbuf.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/param.h b/libc/kernel/uapi/asm-riscv/asm/param.h
new file mode 100644
index 0000000..5ccf935
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/param.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/param.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/perf_regs.h b/libc/kernel/uapi/asm-riscv/asm/perf_regs.h
new file mode 100644
index 0000000..ceb0bbe
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/perf_regs.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_RISCV_PERF_REGS_H
+#define _ASM_RISCV_PERF_REGS_H
+enum perf_event_riscv_regs {
+ PERF_REG_RISCV_PC,
+ PERF_REG_RISCV_RA,
+ PERF_REG_RISCV_SP,
+ PERF_REG_RISCV_GP,
+ PERF_REG_RISCV_TP,
+ PERF_REG_RISCV_T0,
+ PERF_REG_RISCV_T1,
+ PERF_REG_RISCV_T2,
+ PERF_REG_RISCV_S0,
+ PERF_REG_RISCV_S1,
+ PERF_REG_RISCV_A0,
+ PERF_REG_RISCV_A1,
+ PERF_REG_RISCV_A2,
+ PERF_REG_RISCV_A3,
+ PERF_REG_RISCV_A4,
+ PERF_REG_RISCV_A5,
+ PERF_REG_RISCV_A6,
+ PERF_REG_RISCV_A7,
+ PERF_REG_RISCV_S2,
+ PERF_REG_RISCV_S3,
+ PERF_REG_RISCV_S4,
+ PERF_REG_RISCV_S5,
+ PERF_REG_RISCV_S6,
+ PERF_REG_RISCV_S7,
+ PERF_REG_RISCV_S8,
+ PERF_REG_RISCV_S9,
+ PERF_REG_RISCV_S10,
+ PERF_REG_RISCV_S11,
+ PERF_REG_RISCV_T3,
+ PERF_REG_RISCV_T4,
+ PERF_REG_RISCV_T5,
+ PERF_REG_RISCV_T6,
+ PERF_REG_RISCV_MAX,
+};
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/poll.h b/libc/kernel/uapi/asm-riscv/asm/poll.h
new file mode 100644
index 0000000..d7e8adc
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/poll.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/poll.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/posix_types.h b/libc/kernel/uapi/asm-riscv/asm/posix_types.h
new file mode 100644
index 0000000..1b89253
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/posix_types.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/posix_types.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/ptrace.h b/libc/kernel/uapi/asm-riscv/asm/ptrace.h
new file mode 100644
index 0000000..94e4ac9
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/ptrace.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_RISCV_PTRACE_H
+#define _UAPI_ASM_RISCV_PTRACE_H
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+struct user_regs_struct {
+ unsigned long pc;
+ unsigned long ra;
+ unsigned long sp;
+ unsigned long gp;
+ unsigned long tp;
+ unsigned long t0;
+ unsigned long t1;
+ unsigned long t2;
+ unsigned long s0;
+ unsigned long s1;
+ unsigned long a0;
+ unsigned long a1;
+ unsigned long a2;
+ unsigned long a3;
+ unsigned long a4;
+ unsigned long a5;
+ unsigned long a6;
+ unsigned long a7;
+ unsigned long s2;
+ unsigned long s3;
+ unsigned long s4;
+ unsigned long s5;
+ unsigned long s6;
+ unsigned long s7;
+ unsigned long s8;
+ unsigned long s9;
+ unsigned long s10;
+ unsigned long s11;
+ unsigned long t3;
+ unsigned long t4;
+ unsigned long t5;
+ unsigned long t6;
+};
+struct __riscv_f_ext_state {
+ __u32 f[32];
+ __u32 fcsr;
+};
+struct __riscv_d_ext_state {
+ __u64 f[32];
+ __u32 fcsr;
+};
+struct __riscv_q_ext_state {
+ __u64 f[64] __attribute__((aligned(16)));
+ __u32 fcsr;
+ __u32 reserved[3];
+};
+union __riscv_fp_state {
+ struct __riscv_f_ext_state f;
+ struct __riscv_d_ext_state d;
+ struct __riscv_q_ext_state q;
+};
+#endif
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/resource.h b/libc/kernel/uapi/asm-riscv/asm/resource.h
new file mode 100644
index 0000000..371adb5
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/resource.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/resource.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/sembuf.h b/libc/kernel/uapi/asm-riscv/asm/sembuf.h
new file mode 100644
index 0000000..6ce6549
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/sembuf.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/sembuf.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/setup.h b/libc/kernel/uapi/asm-riscv/asm/setup.h
new file mode 100644
index 0000000..940c4db
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/setup.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/setup.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/shmbuf.h b/libc/kernel/uapi/asm-riscv/asm/shmbuf.h
new file mode 100644
index 0000000..fe8b1be
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/shmbuf.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/shmbuf.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/sigcontext.h b/libc/kernel/uapi/asm-riscv/asm/sigcontext.h
new file mode 100644
index 0000000..0553b94
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/sigcontext.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_RISCV_SIGCONTEXT_H
+#define _UAPI_ASM_RISCV_SIGCONTEXT_H
+#include <asm/ptrace.h>
+struct sigcontext {
+ struct user_regs_struct sc_regs;
+ union __riscv_fp_state sc_fpregs;
+};
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/siginfo.h b/libc/kernel/uapi/asm-riscv/asm/siginfo.h
new file mode 100644
index 0000000..a31ebb2
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/siginfo.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/siginfo.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/signal.h b/libc/kernel/uapi/asm-riscv/asm/signal.h
new file mode 100644
index 0000000..64373fe
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/signal.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/signal.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/socket.h b/libc/kernel/uapi/asm-riscv/asm/socket.h
new file mode 100644
index 0000000..50a9874
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/socket.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/socket.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/sockios.h b/libc/kernel/uapi/asm-riscv/asm/sockios.h
new file mode 100644
index 0000000..710db92
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/sockios.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/sockios.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/stat.h b/libc/kernel/uapi/asm-riscv/asm/stat.h
new file mode 100644
index 0000000..af7ebfc
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/stat.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/stat.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/statfs.h b/libc/kernel/uapi/asm-riscv/asm/statfs.h
new file mode 100644
index 0000000..93de275
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/statfs.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/statfs.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/swab.h b/libc/kernel/uapi/asm-riscv/asm/swab.h
new file mode 100644
index 0000000..0049f53
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/swab.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/swab.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/termbits.h b/libc/kernel/uapi/asm-riscv/asm/termbits.h
new file mode 100644
index 0000000..42af6fe
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/termbits.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/termbits.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/termios.h b/libc/kernel/uapi/asm-riscv/asm/termios.h
new file mode 100644
index 0000000..feca4c6
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/termios.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/termios.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/types.h b/libc/kernel/uapi/asm-riscv/asm/types.h
new file mode 100644
index 0000000..8250f43
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/types.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/types.h>
diff --git a/libc/kernel/uapi/asm-riscv/asm/ucontext.h b/libc/kernel/uapi/asm-riscv/asm/ucontext.h
new file mode 100644
index 0000000..8b72cc1
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/ucontext.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_RISCV_UCONTEXT_H
+#define _UAPI_ASM_RISCV_UCONTEXT_H
+#include <linux/types.h>
+struct ucontext {
+ unsigned long uc_flags;
+ struct ucontext * uc_link;
+ stack_t uc_stack;
+ sigset_t uc_sigmask;
+ __u8 __linux_unused[1024 / 8 - sizeof(sigset_t)];
+ struct sigcontext uc_mcontext;
+};
+#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/unistd.h b/libc/kernel/uapi/asm-riscv/asm/unistd.h
new file mode 100644
index 0000000..665b820
--- /dev/null
+++ b/libc/kernel/uapi/asm-riscv/asm/unistd.h
@@ -0,0 +1,29 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#if defined(__LP64__) && !defined(__SYSCALL_COMPAT)
+#define __ARCH_WANT_NEW_STAT
+#define __ARCH_WANT_SET_GET_RLIMIT
+#endif
+#define __ARCH_WANT_SYS_CLONE3
+#define __ARCH_WANT_MEMFD_SECRET
+#include <asm-generic/unistd.h>
+#ifndef __NR_riscv_flush_icache
+#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)
+#endif
+__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache)
diff --git a/libc/kernel/uapi/asm-x86/asm/amd_hsmp.h b/libc/kernel/uapi/asm-x86/asm/amd_hsmp.h
new file mode 100644
index 0000000..c026aac
--- /dev/null
+++ b/libc/kernel/uapi/asm-x86/asm/amd_hsmp.h
@@ -0,0 +1,189 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_ASM_X86_AMD_HSMP_H_
+#define _UAPI_ASM_X86_AMD_HSMP_H_
+#include <linux/types.h>
+#pragma pack(4)
+#define HSMP_MAX_MSG_LEN 8
+enum hsmp_message_ids {
+ HSMP_TEST = 1,
+ HSMP_GET_SMU_VER,
+ HSMP_GET_PROTO_VER,
+ HSMP_GET_SOCKET_POWER,
+ HSMP_SET_SOCKET_POWER_LIMIT,
+ HSMP_GET_SOCKET_POWER_LIMIT,
+ HSMP_GET_SOCKET_POWER_LIMIT_MAX,
+ HSMP_SET_BOOST_LIMIT,
+ HSMP_SET_BOOST_LIMIT_SOCKET,
+ HSMP_GET_BOOST_LIMIT,
+ HSMP_GET_PROC_HOT,
+ HSMP_SET_XGMI_LINK_WIDTH,
+ HSMP_SET_DF_PSTATE,
+ HSMP_SET_AUTO_DF_PSTATE,
+ HSMP_GET_FCLK_MCLK,
+ HSMP_GET_CCLK_THROTTLE_LIMIT,
+ HSMP_GET_C0_PERCENT,
+ HSMP_SET_NBIO_DPM_LEVEL,
+ HSMP_GET_NBIO_DPM_LEVEL,
+ HSMP_GET_DDR_BANDWIDTH,
+ HSMP_GET_TEMP_MONITOR,
+ HSMP_GET_DIMM_TEMP_RANGE,
+ HSMP_GET_DIMM_POWER,
+ HSMP_GET_DIMM_THERMAL,
+ HSMP_GET_SOCKET_FREQ_LIMIT,
+ HSMP_GET_CCLK_CORE_LIMIT,
+ HSMP_GET_RAILS_SVI,
+ HSMP_GET_SOCKET_FMAX_FMIN,
+ HSMP_GET_IOLINK_BANDWITH,
+ HSMP_GET_XGMI_BANDWITH,
+ HSMP_SET_GMI3_WIDTH,
+ HSMP_SET_PCI_RATE,
+ HSMP_SET_POWER_MODE,
+ HSMP_SET_PSTATE_MAX_MIN,
+ HSMP_MSG_ID_MAX,
+};
+struct hsmp_message {
+ __u32 msg_id;
+ __u16 num_args;
+ __u16 response_sz;
+ __u32 args[HSMP_MAX_MSG_LEN];
+ __u16 sock_ind;
+};
+enum hsmp_msg_type {
+ HSMP_RSVD = - 1,
+ HSMP_SET = 0,
+ HSMP_GET = 1,
+};
+struct hsmp_msg_desc {
+ int num_args;
+ int response_sz;
+ enum hsmp_msg_type type;
+};
+static const struct hsmp_msg_desc hsmp_msg_desc_table[] = {
+ {
+ 0, 0, HSMP_RSVD
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ , {
+ 0, 0, HSMP_SET
+ }
+ , {
+ 0, 2, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 0, 1, HSMP_GET
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 1, 1, HSMP_GET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ , {
+ 1, 1, HSMP_SET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ , {
+ 1, 0, HSMP_SET
+ }
+ ,
+};
+#pragma pack()
+#define HSMP_BASE_IOCTL_NR 0xF8
+#define HSMP_IOCTL_CMD _IOWR(HSMP_BASE_IOCTL_NR, 0, struct hsmp_message)
+#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/bootparam.h b/libc/kernel/uapi/asm-x86/asm/bootparam.h
index 7401135..ab9d7f3 100644
--- a/libc/kernel/uapi/asm-x86/asm/bootparam.h
+++ b/libc/kernel/uapi/asm-x86/asm/bootparam.h
@@ -25,8 +25,12 @@
#define SETUP_EFI 4
#define SETUP_APPLE_PROPERTIES 5
#define SETUP_JAILHOUSE 6
+#define SETUP_CC_BLOB 7
+#define SETUP_IMA 8
+#define SETUP_RNG_SEED 9
+#define SETUP_ENUM_MAX SETUP_RNG_SEED
#define SETUP_INDIRECT (1 << 31)
-#define SETUP_TYPE_MAX (SETUP_INDIRECT | SETUP_JAILHOUSE)
+#define SETUP_TYPE_MAX (SETUP_ENUM_MAX | SETUP_INDIRECT)
#define RAMDISK_IMAGE_START_MASK 0x07FF
#define RAMDISK_PROMPT_FLAG 0x8000
#define RAMDISK_LOAD_FLAG 0x4000
@@ -53,7 +57,7 @@
__u64 next;
__u32 type;
__u32 len;
- __u8 data[0];
+ __u8 data[];
};
struct setup_indirect {
__u32 type;
@@ -147,6 +151,10 @@
__u32 flags;
} __attribute__((packed)) v2;
} __attribute__((packed));
+struct ima_setup_data {
+ __u64 addr;
+ __u64 size;
+} __attribute__((packed));
struct boot_params {
struct screen_info screen_info;
struct apm_bios_info apm_bios_info;
@@ -162,7 +170,8 @@
__u32 ext_ramdisk_image;
__u32 ext_ramdisk_size;
__u32 ext_cmd_line_ptr;
- __u8 _pad4[116];
+ __u8 _pad4[112];
+ __u32 cc_blob_address;
struct edid_info edid_info;
struct efi_info efi_info;
__u32 alt_mem_k;
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm.h b/libc/kernel/uapi/asm-x86/asm/kvm.h
index caf8fc0..77d35fc 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm.h
@@ -57,13 +57,6 @@
#define __KVM_HAVE_XCRS
#define __KVM_HAVE_READONLY_MEM
#define KVM_NR_INTERRUPTS 256
-struct kvm_memory_alias {
- __u32 slot;
- __u32 flags;
- __u64 guest_phys_addr;
- __u64 memory_size;
- __u64 target_phys_addr;
-};
struct kvm_pic_state {
__u8 last_irr;
__u8 irr;
@@ -178,16 +171,17 @@
struct kvm_msrs {
__u32 nmsrs;
__u32 pad;
- struct kvm_msr_entry entries[0];
+ struct kvm_msr_entry entries[];
};
struct kvm_msr_list {
__u32 nmsrs;
- __u32 indices[0];
+ __u32 indices[];
};
#define KVM_MSR_FILTER_MAX_BITMAP_SIZE 0x600
struct kvm_msr_filter_range {
#define KVM_MSR_FILTER_READ (1 << 0)
#define KVM_MSR_FILTER_WRITE (1 << 1)
+#define KVM_MSR_FILTER_RANGE_VALID_MASK (KVM_MSR_FILTER_READ | KVM_MSR_FILTER_WRITE)
__u32 flags;
__u32 nmsrs;
__u32 base;
@@ -197,6 +191,7 @@
struct kvm_msr_filter {
#define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
#define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0)
+#define KVM_MSR_FILTER_VALID_MASK (KVM_MSR_FILTER_DEFAULT_DENY)
__u32 flags;
struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
};
@@ -211,7 +206,7 @@
struct kvm_cpuid {
__u32 nent;
__u32 padding;
- struct kvm_cpuid_entry entries[0];
+ struct kvm_cpuid_entry entries[];
};
struct kvm_cpuid_entry2 {
__u32 function;
@@ -229,7 +224,7 @@
struct kvm_cpuid2 {
__u32 nent;
__u32 padding;
- struct kvm_cpuid_entry2 entries[0];
+ struct kvm_cpuid_entry2 entries[];
};
struct kvm_pit_channel_state {
__u32 count;
@@ -265,6 +260,7 @@
struct kvm_pit_channel_state channels[3];
};
#define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
+#define KVM_PIT_FLAGS_SPEAKER_DATA_ON 0x00000002
struct kvm_pit_state2 {
struct kvm_pit_channel_state channels[3];
__u32 flags;
@@ -279,6 +275,7 @@
#define KVM_VCPUEVENT_VALID_SHADOW 0x00000004
#define KVM_VCPUEVENT_VALID_SMM 0x00000008
#define KVM_VCPUEVENT_VALID_PAYLOAD 0x00000010
+#define KVM_VCPUEVENT_VALID_TRIPLE_FAULT 0x00000020
#define KVM_X86_SHADOW_INT_MOV_SS 0x01
#define KVM_X86_SHADOW_INT_STI 0x02
struct kvm_vcpu_events {
@@ -309,7 +306,10 @@
__u8 smm_inside_nmi;
__u8 latched_init;
} smi;
- __u8 reserved[27];
+ struct {
+ __u8 pending;
+ } triple_fault;
+ __u8 reserved[26];
__u8 exception_has_payload;
__u64 exception_payload;
};
@@ -322,7 +322,7 @@
};
struct kvm_xsave {
__u32 region[1024];
- __u32 extra[0];
+ __u32 extra[];
};
#define KVM_MAX_XCRS 16
struct kvm_xcr {
@@ -350,6 +350,8 @@
#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
#define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3)
#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
+#define KVM_X86_QUIRK_FIX_HYPERCALL_INSN (1 << 5)
+#define KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS (1 << 6)
#define KVM_STATE_NESTED_FORMAT_VMX 0
#define KVM_STATE_NESTED_FORMAT_SVM 1
#define KVM_STATE_NESTED_GUEST_MODE 0x00000001
@@ -403,7 +405,7 @@
__u32 fixed_counter_bitmap;
__u32 flags;
__u32 pad[4];
- __u64 events[0];
+ __u64 events[];
};
#define KVM_PMU_EVENT_ALLOW 0
#define KVM_PMU_EVENT_DENY 1
diff --git a/libc/kernel/uapi/asm-x86/asm/processor-flags.h b/libc/kernel/uapi/asm-x86/asm/processor-flags.h
index 85f9d7e..0a95afd 100644
--- a/libc/kernel/uapi/asm-x86/asm/processor-flags.h
+++ b/libc/kernel/uapi/asm-x86/asm/processor-flags.h
@@ -127,6 +127,8 @@
#define X86_CR4_SMAP _BITUL(X86_CR4_SMAP_BIT)
#define X86_CR4_PKE_BIT 22
#define X86_CR4_PKE _BITUL(X86_CR4_PKE_BIT)
+#define X86_CR4_CET_BIT 23
+#define X86_CR4_CET _BITUL(X86_CR4_CET_BIT)
#define X86_CR8_TPR _AC(0x0000000f, UL)
#define CX86_PCR0 0x20
#define CX86_GCR 0xb8
diff --git a/libc/kernel/uapi/asm-x86/asm/sgx.h b/libc/kernel/uapi/asm-x86/asm/sgx.h
index 1874b78..fdc2700 100644
--- a/libc/kernel/uapi/asm-x86/asm/sgx.h
+++ b/libc/kernel/uapi/asm-x86/asm/sgx.h
@@ -29,6 +29,9 @@
#define SGX_IOC_ENCLAVE_INIT _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init)
#define SGX_IOC_ENCLAVE_PROVISION _IOW(SGX_MAGIC, 0x03, struct sgx_enclave_provision)
#define SGX_IOC_VEPC_REMOVE_ALL _IO(SGX_MAGIC, 0x04)
+#define SGX_IOC_ENCLAVE_RESTRICT_PERMISSIONS _IOWR(SGX_MAGIC, 0x05, struct sgx_enclave_restrict_permissions)
+#define SGX_IOC_ENCLAVE_MODIFY_TYPES _IOWR(SGX_MAGIC, 0x06, struct sgx_enclave_modify_types)
+#define SGX_IOC_ENCLAVE_REMOVE_PAGES _IOWR(SGX_MAGIC, 0x07, struct sgx_enclave_remove_pages)
struct sgx_enclave_create {
__u64 src;
};
@@ -46,6 +49,25 @@
struct sgx_enclave_provision {
__u64 fd;
};
+struct sgx_enclave_restrict_permissions {
+ __u64 offset;
+ __u64 length;
+ __u64 permissions;
+ __u64 result;
+ __u64 count;
+};
+struct sgx_enclave_modify_types {
+ __u64 offset;
+ __u64 length;
+ __u64 page_type;
+ __u64 result;
+ __u64 count;
+};
+struct sgx_enclave_remove_pages {
+ __u64 offset;
+ __u64 length;
+ __u64 count;
+};
struct sgx_enclave_run;
typedef int(* sgx_enclave_user_handler_t) (long rdi, long rsi, long rdx, long rsp, long r8, long r9, struct sgx_enclave_run * run);
struct sgx_enclave_run {
diff --git a/libc/kernel/uapi/asm-x86/asm/shmbuf.h b/libc/kernel/uapi/asm-x86/asm/shmbuf.h
index 03e195e..2a0dcb5 100644
--- a/libc/kernel/uapi/asm-x86/asm/shmbuf.h
+++ b/libc/kernel/uapi/asm-x86/asm/shmbuf.h
@@ -21,9 +21,11 @@
#if !defined(__x86_64__) || !defined(__ILP32__)
#include <asm-generic/shmbuf.h>
#else
+#include <asm/ipcbuf.h>
+#include <asm/posix_types.h>
struct shmid64_ds {
struct ipc64_perm shm_perm;
- size_t shm_segsz;
+ __kernel_size_t shm_segsz;
__kernel_long_t shm_atime;
__kernel_long_t shm_dtime;
__kernel_long_t shm_ctime;
diff --git a/libc/kernel/uapi/asm-x86/asm/sigcontext.h b/libc/kernel/uapi/asm-x86/asm/sigcontext.h
index 7d5b4d4..c790950 100644
--- a/libc/kernel/uapi/asm-x86/asm/sigcontext.h
+++ b/libc/kernel/uapi/asm-x86/asm/sigcontext.h
@@ -180,7 +180,7 @@
__u32 eflags;
__u32 esp_at_signal;
__u16 ss, __ssh;
- struct _fpstate __user * fpstate;
+ struct _fpstate * fpstate;
__u32 oldmask;
__u32 cr2;
};
@@ -215,7 +215,7 @@
__u64 trapno;
__u64 oldmask;
__u64 cr2;
- struct _fpstate __user * fpstate;
+ struct _fpstate * fpstate;
#ifdef __ILP32__
__u32 __fpstate_pad;
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/signal.h b/libc/kernel/uapi/asm-x86/asm/signal.h
index 8226da8..37dce50 100644
--- a/libc/kernel/uapi/asm-x86/asm/signal.h
+++ b/libc/kernel/uapi/asm-x86/asm/signal.h
@@ -88,9 +88,9 @@
};
#endif
typedef struct sigaltstack {
- void __user * ss_sp;
+ void * ss_sp;
int ss_flags;
- size_t ss_size;
+ __kernel_size_t ss_size;
} stack_t;
#endif
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/svm.h b/libc/kernel/uapi/asm-x86/asm/svm.h
index d051481..0d95101 100644
--- a/libc/kernel/uapi/asm-x86/asm/svm.h
+++ b/libc/kernel/uapi/asm-x86/asm/svm.h
@@ -122,8 +122,18 @@
#define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005
#define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0
#define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1
+#define SVM_VMGEXIT_PSC 0x80000010
+#define SVM_VMGEXIT_GUEST_REQUEST 0x80000011
+#define SVM_VMGEXIT_EXT_GUEST_REQUEST 0x80000012
+#define SVM_VMGEXIT_AP_CREATION 0x80000013
+#define SVM_VMGEXIT_AP_CREATE_ON_INIT 0
+#define SVM_VMGEXIT_AP_CREATE 1
+#define SVM_VMGEXIT_AP_DESTROY 2
+#define SVM_VMGEXIT_HV_FEATURES 0x8000fffd
+#define SVM_VMGEXIT_TERM_REQUEST 0x8000fffe
+#define SVM_VMGEXIT_TERM_REASON(reason_set,reason_code) (((((u64) reason_set) & 0xf)) | ((((u64) reason_code) & 0xff) << 4))
#define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff
#define SVM_EXIT_SW 0xf0000000
#define SVM_EXIT_ERR - 1
-#define SVM_EXIT_REASONS { SVM_EXIT_READ_CR0, "read_cr0" }, { SVM_EXIT_READ_CR2, "read_cr2" }, { SVM_EXIT_READ_CR3, "read_cr3" }, { SVM_EXIT_READ_CR4, "read_cr4" }, { SVM_EXIT_READ_CR8, "read_cr8" }, { SVM_EXIT_WRITE_CR0, "write_cr0" }, { SVM_EXIT_WRITE_CR2, "write_cr2" }, { SVM_EXIT_WRITE_CR3, "write_cr3" }, { SVM_EXIT_WRITE_CR4, "write_cr4" }, { SVM_EXIT_WRITE_CR8, "write_cr8" }, { SVM_EXIT_READ_DR0, "read_dr0" }, { SVM_EXIT_READ_DR1, "read_dr1" }, { SVM_EXIT_READ_DR2, "read_dr2" }, { SVM_EXIT_READ_DR3, "read_dr3" }, { SVM_EXIT_READ_DR4, "read_dr4" }, { SVM_EXIT_READ_DR5, "read_dr5" }, { SVM_EXIT_READ_DR6, "read_dr6" }, { SVM_EXIT_READ_DR7, "read_dr7" }, { SVM_EXIT_WRITE_DR0, "write_dr0" }, { SVM_EXIT_WRITE_DR1, "write_dr1" }, { SVM_EXIT_WRITE_DR2, "write_dr2" }, { SVM_EXIT_WRITE_DR3, "write_dr3" }, { SVM_EXIT_WRITE_DR4, "write_dr4" }, { SVM_EXIT_WRITE_DR5, "write_dr5" }, { SVM_EXIT_WRITE_DR6, "write_dr6" }, { SVM_EXIT_WRITE_DR7, "write_dr7" }, { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, { SVM_EXIT_INTR, "interrupt" }, { SVM_EXIT_NMI, "nmi" }, { SVM_EXIT_SMI, "smi" }, { SVM_EXIT_INIT, "init" }, { SVM_EXIT_VINTR, "vintr" }, { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, { SVM_EXIT_IDTR_READ, "read_idtr" }, { SVM_EXIT_GDTR_READ, "read_gdtr" }, { SVM_EXIT_LDTR_READ, "read_ldtr" }, { SVM_EXIT_TR_READ, "read_rt" }, { SVM_EXIT_IDTR_WRITE, "write_idtr" }, { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, { SVM_EXIT_TR_WRITE, "write_rt" }, { SVM_EXIT_RDTSC, "rdtsc" }, { SVM_EXIT_RDPMC, "rdpmc" }, { SVM_EXIT_PUSHF, "pushf" }, { SVM_EXIT_POPF, "popf" }, { SVM_EXIT_CPUID, "cpuid" }, { SVM_EXIT_RSM, "rsm" }, { SVM_EXIT_IRET, "iret" }, { SVM_EXIT_SWINT, "swint" }, { SVM_EXIT_INVD, "invd" }, { SVM_EXIT_PAUSE, "pause" }, { SVM_EXIT_HLT, "hlt" }, { SVM_EXIT_INVLPG, "invlpg" }, { SVM_EXIT_INVLPGA, "invlpga" }, { SVM_EXIT_IOIO, "io" }, { SVM_EXIT_MSR, "msr" }, { SVM_EXIT_TASK_SWITCH, "task_switch" }, { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, { SVM_EXIT_SHUTDOWN, "shutdown" }, { SVM_EXIT_VMRUN, "vmrun" }, { SVM_EXIT_VMMCALL, "hypercall" }, { SVM_EXIT_VMLOAD, "vmload" }, { SVM_EXIT_VMSAVE, "vmsave" }, { SVM_EXIT_STGI, "stgi" }, { SVM_EXIT_CLGI, "clgi" }, { SVM_EXIT_SKINIT, "skinit" }, { SVM_EXIT_RDTSCP, "rdtscp" }, { SVM_EXIT_ICEBP, "icebp" }, { SVM_EXIT_WBINVD, "wbinvd" }, { SVM_EXIT_MONITOR, "monitor" }, { SVM_EXIT_MWAIT, "mwait" }, { SVM_EXIT_XSETBV, "xsetbv" }, { SVM_EXIT_EFER_WRITE_TRAP, "write_efer_trap" }, { SVM_EXIT_CR0_WRITE_TRAP, "write_cr0_trap" }, { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, { SVM_EXIT_INVPCID, "invpcid" }, { SVM_EXIT_NPF, "npf" }, { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, { SVM_EXIT_VMGEXIT, "vmgexit" }, { SVM_VMGEXIT_MMIO_READ, "vmgexit_mmio_read" }, { SVM_VMGEXIT_MMIO_WRITE, "vmgexit_mmio_write" }, { SVM_VMGEXIT_NMI_COMPLETE, "vmgexit_nmi_complete" }, { SVM_VMGEXIT_AP_HLT_LOOP, "vmgexit_ap_hlt_loop" }, { SVM_VMGEXIT_AP_JUMP_TABLE, "vmgexit_ap_jump_table" }, { SVM_EXIT_ERR, "invalid_guest_state" }
+#define SVM_EXIT_REASONS { SVM_EXIT_READ_CR0, "read_cr0" }, { SVM_EXIT_READ_CR2, "read_cr2" }, { SVM_EXIT_READ_CR3, "read_cr3" }, { SVM_EXIT_READ_CR4, "read_cr4" }, { SVM_EXIT_READ_CR8, "read_cr8" }, { SVM_EXIT_WRITE_CR0, "write_cr0" }, { SVM_EXIT_WRITE_CR2, "write_cr2" }, { SVM_EXIT_WRITE_CR3, "write_cr3" }, { SVM_EXIT_WRITE_CR4, "write_cr4" }, { SVM_EXIT_WRITE_CR8, "write_cr8" }, { SVM_EXIT_READ_DR0, "read_dr0" }, { SVM_EXIT_READ_DR1, "read_dr1" }, { SVM_EXIT_READ_DR2, "read_dr2" }, { SVM_EXIT_READ_DR3, "read_dr3" }, { SVM_EXIT_READ_DR4, "read_dr4" }, { SVM_EXIT_READ_DR5, "read_dr5" }, { SVM_EXIT_READ_DR6, "read_dr6" }, { SVM_EXIT_READ_DR7, "read_dr7" }, { SVM_EXIT_WRITE_DR0, "write_dr0" }, { SVM_EXIT_WRITE_DR1, "write_dr1" }, { SVM_EXIT_WRITE_DR2, "write_dr2" }, { SVM_EXIT_WRITE_DR3, "write_dr3" }, { SVM_EXIT_WRITE_DR4, "write_dr4" }, { SVM_EXIT_WRITE_DR5, "write_dr5" }, { SVM_EXIT_WRITE_DR6, "write_dr6" }, { SVM_EXIT_WRITE_DR7, "write_dr7" }, { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, { SVM_EXIT_INTR, "interrupt" }, { SVM_EXIT_NMI, "nmi" }, { SVM_EXIT_SMI, "smi" }, { SVM_EXIT_INIT, "init" }, { SVM_EXIT_VINTR, "vintr" }, { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, { SVM_EXIT_IDTR_READ, "read_idtr" }, { SVM_EXIT_GDTR_READ, "read_gdtr" }, { SVM_EXIT_LDTR_READ, "read_ldtr" }, { SVM_EXIT_TR_READ, "read_rt" }, { SVM_EXIT_IDTR_WRITE, "write_idtr" }, { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, { SVM_EXIT_TR_WRITE, "write_rt" }, { SVM_EXIT_RDTSC, "rdtsc" }, { SVM_EXIT_RDPMC, "rdpmc" }, { SVM_EXIT_PUSHF, "pushf" }, { SVM_EXIT_POPF, "popf" }, { SVM_EXIT_CPUID, "cpuid" }, { SVM_EXIT_RSM, "rsm" }, { SVM_EXIT_IRET, "iret" }, { SVM_EXIT_SWINT, "swint" }, { SVM_EXIT_INVD, "invd" }, { SVM_EXIT_PAUSE, "pause" }, { SVM_EXIT_HLT, "hlt" }, { SVM_EXIT_INVLPG, "invlpg" }, { SVM_EXIT_INVLPGA, "invlpga" }, { SVM_EXIT_IOIO, "io" }, { SVM_EXIT_MSR, "msr" }, { SVM_EXIT_TASK_SWITCH, "task_switch" }, { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, { SVM_EXIT_SHUTDOWN, "shutdown" }, { SVM_EXIT_VMRUN, "vmrun" }, { SVM_EXIT_VMMCALL, "hypercall" }, { SVM_EXIT_VMLOAD, "vmload" }, { SVM_EXIT_VMSAVE, "vmsave" }, { SVM_EXIT_STGI, "stgi" }, { SVM_EXIT_CLGI, "clgi" }, { SVM_EXIT_SKINIT, "skinit" }, { SVM_EXIT_RDTSCP, "rdtscp" }, { SVM_EXIT_ICEBP, "icebp" }, { SVM_EXIT_WBINVD, "wbinvd" }, { SVM_EXIT_MONITOR, "monitor" }, { SVM_EXIT_MWAIT, "mwait" }, { SVM_EXIT_XSETBV, "xsetbv" }, { SVM_EXIT_EFER_WRITE_TRAP, "write_efer_trap" }, { SVM_EXIT_CR0_WRITE_TRAP, "write_cr0_trap" }, { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, { SVM_EXIT_INVPCID, "invpcid" }, { SVM_EXIT_NPF, "npf" }, { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, { SVM_EXIT_VMGEXIT, "vmgexit" }, { SVM_VMGEXIT_MMIO_READ, "vmgexit_mmio_read" }, { SVM_VMGEXIT_MMIO_WRITE, "vmgexit_mmio_write" }, { SVM_VMGEXIT_NMI_COMPLETE, "vmgexit_nmi_complete" }, { SVM_VMGEXIT_AP_HLT_LOOP, "vmgexit_ap_hlt_loop" }, { SVM_VMGEXIT_AP_JUMP_TABLE, "vmgexit_ap_jump_table" }, { SVM_VMGEXIT_PSC, "vmgexit_page_state_change" }, { SVM_VMGEXIT_GUEST_REQUEST, "vmgexit_guest_request" }, { SVM_VMGEXIT_EXT_GUEST_REQUEST, "vmgexit_ext_guest_request" }, { SVM_VMGEXIT_AP_CREATION, "vmgexit_ap_creation" }, { SVM_VMGEXIT_HV_FEATURES, "vmgexit_hypervisor_feature" }, { SVM_EXIT_ERR, "invalid_guest_state" }
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/vmx.h b/libc/kernel/uapi/asm-x86/asm/vmx.h
index 6c07d4c..fdea539 100644
--- a/libc/kernel/uapi/asm-x86/asm/vmx.h
+++ b/libc/kernel/uapi/asm-x86/asm/vmx.h
@@ -81,7 +81,8 @@
#define EXIT_REASON_UMWAIT 67
#define EXIT_REASON_TPAUSE 68
#define EXIT_REASON_BUS_LOCK 74
-#define VMX_EXIT_REASONS { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, { EXIT_REASON_SIPI_SIGNAL, "SIPI_SIGNAL" }, { EXIT_REASON_INTERRUPT_WINDOW, "INTERRUPT_WINDOW" }, { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, { EXIT_REASON_CPUID, "CPUID" }, { EXIT_REASON_HLT, "HLT" }, { EXIT_REASON_INVD, "INVD" }, { EXIT_REASON_INVLPG, "INVLPG" }, { EXIT_REASON_RDPMC, "RDPMC" }, { EXIT_REASON_RDTSC, "RDTSC" }, { EXIT_REASON_VMCALL, "VMCALL" }, { EXIT_REASON_VMCLEAR, "VMCLEAR" }, { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, { EXIT_REASON_VMPTRLD, "VMPTRLD" }, { EXIT_REASON_VMPTRST, "VMPTRST" }, { EXIT_REASON_VMREAD, "VMREAD" }, { EXIT_REASON_VMRESUME, "VMRESUME" }, { EXIT_REASON_VMWRITE, "VMWRITE" }, { EXIT_REASON_VMOFF, "VMOFF" }, { EXIT_REASON_VMON, "VMON" }, { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, { EXIT_REASON_MSR_READ, "MSR_READ" }, { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, { EXIT_REASON_LDTR_TR, "LDTR_TR" }, { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, { EXIT_REASON_INVEPT, "INVEPT" }, { EXIT_REASON_RDTSCP, "RDTSCP" }, { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, { EXIT_REASON_INVVPID, "INVVPID" }, { EXIT_REASON_WBINVD, "WBINVD" }, { EXIT_REASON_XSETBV, "XSETBV" }, { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, { EXIT_REASON_RDRAND, "RDRAND" }, { EXIT_REASON_INVPCID, "INVPCID" }, { EXIT_REASON_VMFUNC, "VMFUNC" }, { EXIT_REASON_ENCLS, "ENCLS" }, { EXIT_REASON_RDSEED, "RDSEED" }, { EXIT_REASON_PML_FULL, "PML_FULL" }, { EXIT_REASON_XSAVES, "XSAVES" }, { EXIT_REASON_XRSTORS, "XRSTORS" }, { EXIT_REASON_UMWAIT, "UMWAIT" }, { EXIT_REASON_TPAUSE, "TPAUSE" }, { EXIT_REASON_BUS_LOCK, "BUS_LOCK" }
+#define EXIT_REASON_NOTIFY 75
+#define VMX_EXIT_REASONS { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, { EXIT_REASON_SIPI_SIGNAL, "SIPI_SIGNAL" }, { EXIT_REASON_INTERRUPT_WINDOW, "INTERRUPT_WINDOW" }, { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, { EXIT_REASON_CPUID, "CPUID" }, { EXIT_REASON_HLT, "HLT" }, { EXIT_REASON_INVD, "INVD" }, { EXIT_REASON_INVLPG, "INVLPG" }, { EXIT_REASON_RDPMC, "RDPMC" }, { EXIT_REASON_RDTSC, "RDTSC" }, { EXIT_REASON_VMCALL, "VMCALL" }, { EXIT_REASON_VMCLEAR, "VMCLEAR" }, { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, { EXIT_REASON_VMPTRLD, "VMPTRLD" }, { EXIT_REASON_VMPTRST, "VMPTRST" }, { EXIT_REASON_VMREAD, "VMREAD" }, { EXIT_REASON_VMRESUME, "VMRESUME" }, { EXIT_REASON_VMWRITE, "VMWRITE" }, { EXIT_REASON_VMOFF, "VMOFF" }, { EXIT_REASON_VMON, "VMON" }, { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, { EXIT_REASON_MSR_READ, "MSR_READ" }, { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, { EXIT_REASON_LDTR_TR, "LDTR_TR" }, { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, { EXIT_REASON_INVEPT, "INVEPT" }, { EXIT_REASON_RDTSCP, "RDTSCP" }, { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, { EXIT_REASON_INVVPID, "INVVPID" }, { EXIT_REASON_WBINVD, "WBINVD" }, { EXIT_REASON_XSETBV, "XSETBV" }, { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, { EXIT_REASON_RDRAND, "RDRAND" }, { EXIT_REASON_INVPCID, "INVPCID" }, { EXIT_REASON_VMFUNC, "VMFUNC" }, { EXIT_REASON_ENCLS, "ENCLS" }, { EXIT_REASON_RDSEED, "RDSEED" }, { EXIT_REASON_PML_FULL, "PML_FULL" }, { EXIT_REASON_XSAVES, "XSAVES" }, { EXIT_REASON_XRSTORS, "XRSTORS" }, { EXIT_REASON_UMWAIT, "UMWAIT" }, { EXIT_REASON_TPAUSE, "TPAUSE" }, { EXIT_REASON_BUS_LOCK, "BUS_LOCK" }, { EXIT_REASON_NOTIFY, "NOTIFY" }
#define VMX_EXIT_REASON_FLAGS { VMX_EXIT_REASONS_FAILED_VMENTRY, "FAILED_VMENTRY" }
#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
diff --git a/libc/kernel/uapi/drm/amdgpu_drm.h b/libc/kernel/uapi/drm/amdgpu_drm.h
index 3764d51..fcd5ab8 100644
--- a/libc/kernel/uapi/drm/amdgpu_drm.h
+++ b/libc/kernel/uapi/drm/amdgpu_drm.h
@@ -72,6 +72,9 @@
#define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9)
#define AMDGPU_GEM_CREATE_ENCRYPTED (1 << 10)
#define AMDGPU_GEM_CREATE_PREEMPTIBLE (1 << 11)
+#define AMDGPU_GEM_CREATE_DISCARDABLE (1 << 12)
+#define AMDGPU_GEM_CREATE_COHERENT (1 << 13)
+#define AMDGPU_GEM_CREATE_UNCACHED (1 << 14)
struct drm_amdgpu_gem_create_in {
__u64 bo_size;
__u64 alignment;
@@ -112,6 +115,8 @@
#define AMDGPU_CTX_OP_FREE_CTX 2
#define AMDGPU_CTX_OP_QUERY_STATE 3
#define AMDGPU_CTX_OP_QUERY_STATE2 4
+#define AMDGPU_CTX_OP_GET_STABLE_PSTATE 5
+#define AMDGPU_CTX_OP_SET_STABLE_PSTATE 6
#define AMDGPU_CTX_NO_RESET 0
#define AMDGPU_CTX_GUILTY_RESET 1
#define AMDGPU_CTX_INNOCENT_RESET 2
@@ -127,6 +132,12 @@
#define AMDGPU_CTX_PRIORITY_NORMAL 0
#define AMDGPU_CTX_PRIORITY_HIGH 512
#define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023
+#define AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK 0xf
+#define AMDGPU_CTX_STABLE_PSTATE_NONE 0
+#define AMDGPU_CTX_STABLE_PSTATE_STANDARD 1
+#define AMDGPU_CTX_STABLE_PSTATE_MIN_SCLK 2
+#define AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK 3
+#define AMDGPU_CTX_STABLE_PSTATE_PEAK 4
struct drm_amdgpu_ctx_in {
__u32 op;
__u32 flags;
@@ -143,6 +154,10 @@
__u32 hangs;
__u32 reset_status;
} state;
+ struct {
+ __u32 flags;
+ __u32 _pad;
+ } pstate;
};
union drm_amdgpu_ctx {
struct drm_amdgpu_ctx_in in;
@@ -307,6 +322,7 @@
#define AMDGPU_VM_MTYPE_CC (3 << 5)
#define AMDGPU_VM_MTYPE_UC (4 << 5)
#define AMDGPU_VM_MTYPE_RW (5 << 5)
+#define AMDGPU_VM_PAGE_NOALLOC (1 << 9)
struct drm_amdgpu_gem_va {
__u32 handle;
__u32 _pad;
@@ -438,6 +454,12 @@
#define AMDGPU_INFO_FW_TA 0x13
#define AMDGPU_INFO_FW_DMCUB 0x14
#define AMDGPU_INFO_FW_TOC 0x15
+#define AMDGPU_INFO_FW_CAP 0x16
+#define AMDGPU_INFO_FW_GFX_RLCP 0x17
+#define AMDGPU_INFO_FW_GFX_RLCV 0x18
+#define AMDGPU_INFO_FW_MES_KIQ 0x19
+#define AMDGPU_INFO_FW_MES 0x1a
+#define AMDGPU_INFO_FW_IMU 0x1b
#define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
#define AMDGPU_INFO_VRAM_USAGE 0x10
#define AMDGPU_INFO_GTT_USAGE 0x11
@@ -575,6 +597,8 @@
#define AMDGPU_VRAM_TYPE_DDR4 8
#define AMDGPU_VRAM_TYPE_GDDR6 9
#define AMDGPU_VRAM_TYPE_DDR5 10
+#define AMDGPU_VRAM_TYPE_LPDDR4 11
+#define AMDGPU_VRAM_TYPE_LPDDR5 12
struct drm_amdgpu_info_device {
__u32 device_id;
__u32 chip_rev;
@@ -633,7 +657,7 @@
__u32 ib_start_alignment;
__u32 ib_size_alignment;
__u32 available_rings;
- __u32 _pad;
+ __u32 ip_discovery_version;
};
struct drm_amdgpu_info_num_handles {
__u32 uvd_max_handles;
@@ -681,7 +705,11 @@
#define AMDGPU_FAMILY_RV 142
#define AMDGPU_FAMILY_NV 143
#define AMDGPU_FAMILY_VGH 144
+#define AMDGPU_FAMILY_GC_11_0_0 145
#define AMDGPU_FAMILY_YC 146
+#define AMDGPU_FAMILY_GC_11_0_1 148
+#define AMDGPU_FAMILY_GC_10_3_6 149
+#define AMDGPU_FAMILY_GC_10_3_7 151
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/drm.h b/libc/kernel/uapi/drm/drm.h
index 878e899..1954452 100644
--- a/libc/kernel/uapi/drm/drm.h
+++ b/libc/kernel/uapi/drm/drm.h
@@ -78,19 +78,19 @@
int version_minor;
int version_patchlevel;
__kernel_size_t name_len;
- char __user * name;
+ char * name;
__kernel_size_t date_len;
- char __user * date;
+ char * date;
__kernel_size_t desc_len;
- char __user * desc;
+ char * desc;
};
struct drm_unique {
__kernel_size_t unique_len;
- char __user * unique;
+ char * unique;
};
struct drm_list {
int count;
- struct drm_version __user * version;
+ struct drm_version * version;
};
struct drm_block {
int unused;
@@ -202,37 +202,37 @@
};
struct drm_buf_info {
int count;
- struct drm_buf_desc __user * list;
+ struct drm_buf_desc * list;
};
struct drm_buf_free {
int count;
- int __user * list;
+ int * list;
};
struct drm_buf_pub {
int idx;
int total;
int used;
- void __user * address;
+ void * address;
};
struct drm_buf_map {
int count;
#ifdef __cplusplus
- void __user * virt;
+ void * virt;
#else
- void __user * __linux_virtual;
+ void * __linux_virtual;
#endif
- struct drm_buf_pub __user * list;
+ struct drm_buf_pub * list;
};
struct drm_dma {
int context;
int send_count;
- int __user * send_indices;
- int __user * send_sizes;
+ int * send_indices;
+ int * send_sizes;
enum drm_dma_flags flags;
int request_count;
int request_size;
- int __user * request_indices;
- int __user * request_sizes;
+ int * request_indices;
+ int * request_sizes;
int granted_count;
};
enum drm_ctx_flags {
@@ -245,7 +245,7 @@
};
struct drm_ctx_res {
int count;
- struct drm_ctx __user * contexts;
+ struct drm_ctx * contexts;
};
struct drm_draw {
drm_drawable_t handle;
diff --git a/libc/kernel/uapi/drm/drm_fourcc.h b/libc/kernel/uapi/drm/drm_fourcc.h
index e845c8c..ea9525d 100644
--- a/libc/kernel/uapi/drm/drm_fourcc.h
+++ b/libc/kernel/uapi/drm/drm_fourcc.h
@@ -25,7 +25,17 @@
#define fourcc_code(a,b,c,d) ((__u32) (a) | ((__u32) (b) << 8) | ((__u32) (c) << 16) | ((__u32) (d) << 24))
#define DRM_FORMAT_BIG_ENDIAN (1U << 31)
#define DRM_FORMAT_INVALID 0
+#define DRM_FORMAT_C1 fourcc_code('C', '1', ' ', ' ')
+#define DRM_FORMAT_C2 fourcc_code('C', '2', ' ', ' ')
+#define DRM_FORMAT_C4 fourcc_code('C', '4', ' ', ' ')
#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ')
+#define DRM_FORMAT_D1 fourcc_code('D', '1', ' ', ' ')
+#define DRM_FORMAT_D2 fourcc_code('D', '2', ' ', ' ')
+#define DRM_FORMAT_D4 fourcc_code('D', '4', ' ', ' ')
+#define DRM_FORMAT_D8 fourcc_code('D', '8', ' ', ' ')
+#define DRM_FORMAT_R1 fourcc_code('R', '1', ' ', ' ')
+#define DRM_FORMAT_R2 fourcc_code('R', '2', ' ', ' ')
+#define DRM_FORMAT_R4 fourcc_code('R', '4', ' ', ' ')
#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ')
#define DRM_FORMAT_R10 fourcc_code('R', '1', '0', ' ')
#define DRM_FORMAT_R12 fourcc_code('R', '1', '2', ' ')
@@ -86,7 +96,9 @@
#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y')
#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y')
#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V')
+#define DRM_FORMAT_AVUY8888 fourcc_code('A', 'V', 'U', 'Y')
#define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V')
+#define DRM_FORMAT_XVUY8888 fourcc_code('X', 'V', 'U', 'Y')
#define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4')
#define DRM_FORMAT_VUY101010 fourcc_code('V', 'U', '3', '0')
#define DRM_FORMAT_Y210 fourcc_code('Y', '2', '1', '0')
@@ -163,13 +175,27 @@
#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS fourcc_mod_code(INTEL, 6)
#define I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS fourcc_mod_code(INTEL, 7)
#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC fourcc_mod_code(INTEL, 8)
+#define I915_FORMAT_MOD_4_TILED fourcc_mod_code(INTEL, 9)
+#define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS fourcc_mod_code(INTEL, 10)
+#define I915_FORMAT_MOD_4_TILED_DG2_MC_CCS fourcc_mod_code(INTEL, 11)
+#define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC fourcc_mod_code(INTEL, 12)
#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
#define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2)
#define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1)
+#define DRM_FORMAT_MOD_QCOM_TILED3 fourcc_mod_code(QCOM, 3)
+#define DRM_FORMAT_MOD_QCOM_TILED2 fourcc_mod_code(QCOM, 2)
#define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1)
#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2)
#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3)
#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4)
+#define VIVANTE_MOD_TS_64_4 (1ULL << 48)
+#define VIVANTE_MOD_TS_64_2 (2ULL << 48)
+#define VIVANTE_MOD_TS_128_4 (3ULL << 48)
+#define VIVANTE_MOD_TS_256_4 (4ULL << 48)
+#define VIVANTE_MOD_TS_MASK (0xfULL << 48)
+#define VIVANTE_MOD_COMP_DEC400 (1ULL << 52)
+#define VIVANTE_MOD_COMP_MASK (0xfULL << 52)
+#define VIVANTE_MOD_EXT_MASK (VIVANTE_MOD_TS_MASK | VIVANTE_MOD_COMP_MASK)
#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1)
#define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c,s,g,k,h) fourcc_mod_code(NVIDIA, (0x10 | ((h) & 0xf) | (((k) & 0xff) << 12) | (((g) & 0x3) << 20) | (((s) & 0x1) << 22) | (((c) & 0x7) << 23)))
#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(0, 0, 0, 0, (v))
@@ -235,11 +261,13 @@
#define AMD_FMT_MOD_TILE_VER_GFX9 1
#define AMD_FMT_MOD_TILE_VER_GFX10 2
#define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3
+#define AMD_FMT_MOD_TILE_VER_GFX11 4
#define AMD_FMT_MOD_TILE_GFX9_64K_S 9
#define AMD_FMT_MOD_TILE_GFX9_64K_D 10
#define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25
#define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26
#define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27
+#define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31
#define AMD_FMT_MOD_DCC_BLOCK_64B 0
#define AMD_FMT_MOD_DCC_BLOCK_128B 1
#define AMD_FMT_MOD_DCC_BLOCK_256B 2
@@ -271,9 +299,9 @@
#define AMD_FMT_MOD_RB_MASK 0x7
#define AMD_FMT_MOD_PIPE_SHIFT 33
#define AMD_FMT_MOD_PIPE_MASK 0x7
-#define AMD_FMT_MOD_SET(field,value) ((uint64_t) (value) << AMD_FMT_MOD_ ##field ##_SHIFT)
+#define AMD_FMT_MOD_SET(field,value) ((__u64) (value) << AMD_FMT_MOD_ ##field ##_SHIFT)
#define AMD_FMT_MOD_GET(field,value) (((value) >> AMD_FMT_MOD_ ##field ##_SHIFT) & AMD_FMT_MOD_ ##field ##_MASK)
-#define AMD_FMT_MOD_CLEAR(field) (~((uint64_t) AMD_FMT_MOD_ ##field ##_MASK << AMD_FMT_MOD_ ##field ##_SHIFT))
+#define AMD_FMT_MOD_CLEAR(field) (~((__u64) AMD_FMT_MOD_ ##field ##_MASK << AMD_FMT_MOD_ ##field ##_SHIFT))
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/i915_drm.h b/libc/kernel/uapi/drm/i915_drm.h
index 52bfad2..794e784 100644
--- a/libc/kernel/uapi/drm/i915_drm.h
+++ b/libc/kernel/uapi/drm/i915_drm.h
@@ -41,13 +41,14 @@
I915_ENGINE_CLASS_COPY = 1,
I915_ENGINE_CLASS_VIDEO = 2,
I915_ENGINE_CLASS_VIDEO_ENHANCE = 3,
+ I915_ENGINE_CLASS_COMPUTE = 4,
I915_ENGINE_CLASS_INVALID = - 1
};
struct i915_engine_class_instance {
__u16 engine_class;
- __u16 engine_instance;
#define I915_ENGINE_CLASS_INVALID_NONE - 1
#define I915_ENGINE_CLASS_INVALID_VIRTUAL - 2
+ __u16 engine_instance;
};
enum drm_i915_pmu_engine_sample {
I915_SAMPLE_BUSY = 0,
@@ -286,18 +287,18 @@
int DR1;
int DR4;
int num_cliprects;
- struct drm_clip_rect __user * cliprects;
+ struct drm_clip_rect * cliprects;
} drm_i915_batchbuffer_t;
typedef struct _drm_i915_cmdbuffer {
- char __user * buf;
+ char * buf;
int sz;
int DR1;
int DR4;
int num_cliprects;
- struct drm_clip_rect __user * cliprects;
+ struct drm_clip_rect * cliprects;
} drm_i915_cmdbuffer_t;
typedef struct drm_i915_irq_emit {
- int __user * irq_seq;
+ int * irq_seq;
} drm_i915_irq_emit_t;
typedef struct drm_i915_irq_wait {
int irq_seq;
@@ -367,10 +368,12 @@
#define I915_PARAM_PERF_REVISION 54
#define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55
#define I915_PARAM_HAS_USERPTR_PROBE 56
-typedef struct drm_i915_getparam {
+#define I915_PARAM_OA_TIMESTAMP_FREQUENCY 57
+struct drm_i915_getparam {
__s32 param;
- int __user * value;
-} drm_i915_getparam_t;
+ int * value;
+};
+typedef struct drm_i915_getparam drm_i915_getparam_t;
#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
#define I915_SETPARAM_ALLOW_BATCHBUFFER 3
@@ -384,7 +387,7 @@
int region;
int alignment;
int size;
- int __user * region_offset;
+ int * region_offset;
} drm_i915_mem_alloc_t;
typedef struct drm_i915_mem_free {
int region;
@@ -525,13 +528,13 @@
};
struct drm_i915_gem_exec_fence {
__u32 handle;
+ __u32 flags;
#define I915_EXEC_FENCE_WAIT (1 << 0)
#define I915_EXEC_FENCE_SIGNAL (1 << 1)
#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (- (I915_EXEC_FENCE_SIGNAL << 1))
- __u32 flags;
};
-#define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0
struct drm_i915_gem_execbuffer_ext_timeline_fences {
+#define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0
struct i915_user_extension base;
__u64 fence_count;
__u64 handles_ptr;
@@ -546,6 +549,7 @@
__u32 DR4;
__u32 num_cliprects;
__u64 cliprects_ptr;
+ __u64 flags;
#define I915_EXEC_RING_MASK (0x3f)
#define I915_EXEC_DEFAULT (0 << 0)
#define I915_EXEC_RENDER (1 << 0)
@@ -556,10 +560,6 @@
#define I915_EXEC_CONSTANTS_REL_GENERAL (0 << 6)
#define I915_EXEC_CONSTANTS_ABSOLUTE (1 << 6)
#define I915_EXEC_CONSTANTS_REL_SURFACE (2 << 6)
- __u64 flags;
- __u64 rsvd1;
- __u64 rsvd2;
-};
#define I915_EXEC_GEN7_SOL_RESET (1 << 8)
#define I915_EXEC_SECURE (1 << 9)
#define I915_EXEC_IS_PINNED (1 << 10)
@@ -578,6 +578,9 @@
#define I915_EXEC_FENCE_SUBMIT (1 << 20)
#define I915_EXEC_USE_EXTENSIONS (1 << 21)
#define __I915_EXEC_UNKNOWN_FLAGS (- (I915_EXEC_USE_EXTENSIONS << 1))
+ __u64 rsvd1;
+ __u64 rsvd2;
+};
#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
#define i915_execbuffer2_set_context_id(eb2,context) (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
#define i915_execbuffer2_get_context_id(eb2) ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
@@ -721,6 +724,8 @@
#define I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE (1u << 1)
#define I915_CONTEXT_CREATE_FLAGS_UNKNOWN (- (I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE << 1))
__u64 extensions;
+#define I915_CONTEXT_CREATE_EXT_SETPARAM 0
+#define I915_CONTEXT_CREATE_EXT_CLONE 1
};
struct drm_i915_gem_context_param {
__u32 ctx_id;
@@ -760,7 +765,7 @@
__u16 num_siblings;
__u32 flags;
__u64 mbz64;
- struct i915_engine_class_instance engines[0];
+ struct i915_engine_class_instance engines[];
} __attribute__((packed));
#define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__,N__) struct { struct i915_user_extension base; __u16 engine_index; __u16 num_siblings; __u32 flags; __u64 mbz64; struct i915_engine_class_instance engines[N__]; \
} __attribute__((packed)) name__
@@ -771,7 +776,7 @@
__u16 num_bonds;
__u64 flags;
__u64 mbz64[4];
- struct i915_engine_class_instance engines[0];
+ struct i915_engine_class_instance engines[];
} __attribute__((packed));
#define I915_DEFINE_CONTEXT_ENGINES_BOND(name__,N__) struct { struct i915_user_extension base; struct i915_engine_class_instance master; __u16 virtual_index; __u16 num_bonds; __u64 flags; __u64 mbz64[4]; struct i915_engine_class_instance engines[N__]; \
} __attribute__((packed)) name__
@@ -783,8 +788,8 @@
__u16 mbz16;
__u64 flags;
__u64 mbz64[3];
- struct i915_engine_class_instance engines[0];
-} __packed;
+ struct i915_engine_class_instance engines[];
+} __attribute__((__packed__));
#define I915_DEFINE_CONTEXT_ENGINES_PARALLEL_SUBMIT(name__,N__) struct { struct i915_user_extension base; __u16 engine_index; __u16 width; __u16 num_siblings; __u16 mbz16; __u64 flags; __u64 mbz64[3]; struct i915_engine_class_instance engines[N__]; \
} __attribute__((packed)) name__
struct i915_context_param_engines {
@@ -797,11 +802,9 @@
#define I915_DEFINE_CONTEXT_PARAM_ENGINES(name__,N__) struct { __u64 extensions; struct i915_engine_class_instance engines[N__]; \
} __attribute__((packed)) name__
struct drm_i915_gem_context_create_ext_setparam {
-#define I915_CONTEXT_CREATE_EXT_SETPARAM 0
struct i915_user_extension base;
struct drm_i915_gem_context_param param;
};
-#define I915_CONTEXT_CREATE_EXT_CLONE 1
struct drm_i915_gem_context_destroy {
__u32 ctx_id;
__u32 pad;
@@ -844,6 +847,8 @@
I915_OA_FORMAT_A12,
I915_OA_FORMAT_A12_B8_C8,
I915_OA_FORMAT_A32u40_A4u32_B8_C8,
+ I915_OAR_FORMAT_A32u40_A4u32_B8_C8,
+ I915_OA_FORMAT_A24u40_A14u32_B8_C8,
I915_OA_FORMAT_MAX
};
enum drm_i915_perf_property_id {
@@ -894,6 +899,8 @@
#define DRM_I915_QUERY_ENGINE_INFO 2
#define DRM_I915_QUERY_PERF_CONFIG 3
#define DRM_I915_QUERY_MEMORY_REGIONS 4
+#define DRM_I915_QUERY_HWCONFIG_BLOB 5
+#define DRM_I915_QUERY_GEOMETRY_SUBSLICES 6
__s32 length;
__u32 flags;
#define DRM_I915_QUERY_PERF_CONFIG_LIST 1
@@ -956,7 +963,13 @@
__u32 rsvd0;
__u64 probed_size;
__u64 unallocated_size;
- __u64 rsvd1[8];
+ union {
+ __u64 rsvd1[8];
+ struct {
+ __u64 probed_cpu_visible_size;
+ __u64 unallocated_cpu_visible_size;
+ };
+ };
};
struct drm_i915_query_memory_regions {
__u32 num_regions;
@@ -966,6 +979,7 @@
struct drm_i915_gem_create_ext {
__u64 size;
__u32 handle;
+#define I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS (1 << 0)
__u32 flags;
#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1
diff --git a/libc/kernel/uapi/drm/mga_drm.h b/libc/kernel/uapi/drm/mga_drm.h
index dc62961..eb55fa7 100644
--- a/libc/kernel/uapi/drm/mga_drm.h
+++ b/libc/kernel/uapi/drm/mga_drm.h
@@ -239,7 +239,7 @@
#define MGA_PARAM_CARD_TYPE 2
typedef struct drm_mga_getparam {
int param;
- void __user * value;
+ void * value;
} drm_mga_getparam_t;
#ifdef __cplusplus
}
diff --git a/libc/kernel/uapi/drm/msm_drm.h b/libc/kernel/uapi/drm/msm_drm.h
index b4ba1d0..ad3a971 100644
--- a/libc/kernel/uapi/drm/msm_drm.h
+++ b/libc/kernel/uapi/drm/msm_drm.h
@@ -43,11 +43,18 @@
#define MSM_PARAM_PP_PGTABLE 0x08
#define MSM_PARAM_FAULTS 0x09
#define MSM_PARAM_SUSPENDS 0x0a
+#define MSM_PARAM_SYSPROF 0x0b
+#define MSM_PARAM_COMM 0x0c
+#define MSM_PARAM_CMDLINE 0x0d
+#define MSM_PARAM_VA_START 0x0e
+#define MSM_PARAM_VA_SIZE 0x0f
#define MSM_PARAM_NR_RINGS MSM_PARAM_PRIORITIES
struct drm_msm_param {
__u32 pipe;
__u32 param;
__u64 value;
+ __u32 len;
+ __u32 pad;
};
#define MSM_BO_SCANOUT 0x00000001
#define MSM_BO_GPU_READONLY 0x00000002
@@ -66,6 +73,8 @@
#define MSM_INFO_GET_IOVA 0x01
#define MSM_INFO_SET_NAME 0x02
#define MSM_INFO_GET_NAME 0x03
+#define MSM_INFO_SET_IOVA 0x04
+#define MSM_INFO_GET_FLAGS 0x05
struct drm_msm_gem_info {
__u32 handle;
__u32 info;
@@ -119,7 +128,8 @@
#define MSM_SUBMIT_SUDO 0x10000000
#define MSM_SUBMIT_SYNCOBJ_IN 0x08000000
#define MSM_SUBMIT_SYNCOBJ_OUT 0x04000000
-#define MSM_SUBMIT_FLAGS (MSM_SUBMIT_NO_IMPLICIT | MSM_SUBMIT_FENCE_FD_IN | MSM_SUBMIT_FENCE_FD_OUT | MSM_SUBMIT_SUDO | MSM_SUBMIT_SYNCOBJ_IN | MSM_SUBMIT_SYNCOBJ_OUT | 0)
+#define MSM_SUBMIT_FENCE_SN_IN 0x02000000
+#define MSM_SUBMIT_FLAGS (MSM_SUBMIT_NO_IMPLICIT | MSM_SUBMIT_FENCE_FD_IN | MSM_SUBMIT_FENCE_FD_OUT | MSM_SUBMIT_SUDO | MSM_SUBMIT_SYNCOBJ_IN | MSM_SUBMIT_SYNCOBJ_OUT | MSM_SUBMIT_FENCE_SN_IN | 0)
#define MSM_SUBMIT_SYNCOBJ_RESET 0x00000001
#define MSM_SUBMIT_SYNCOBJ_FLAGS (MSM_SUBMIT_SYNCOBJ_RESET | 0)
struct drm_msm_gem_submit_syncobj {
@@ -172,6 +182,7 @@
__u32 pad;
};
#define DRM_MSM_GET_PARAM 0x00
+#define DRM_MSM_SET_PARAM 0x01
#define DRM_MSM_GEM_NEW 0x02
#define DRM_MSM_GEM_INFO 0x03
#define DRM_MSM_GEM_CPU_PREP 0x04
@@ -183,6 +194,7 @@
#define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B
#define DRM_MSM_SUBMITQUEUE_QUERY 0x0C
#define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param)
+#define DRM_IOCTL_MSM_SET_PARAM DRM_IOW(DRM_COMMAND_BASE + DRM_MSM_SET_PARAM, struct drm_msm_param)
#define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new)
#define DRM_IOCTL_MSM_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_INFO, struct drm_msm_gem_info)
#define DRM_IOCTL_MSM_GEM_CPU_PREP DRM_IOW(DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_PREP, struct drm_msm_gem_cpu_prep)
diff --git a/libc/kernel/uapi/drm/panfrost_drm.h b/libc/kernel/uapi/drm/panfrost_drm.h
index 1f4473d..04a85df 100644
--- a/libc/kernel/uapi/drm/panfrost_drm.h
+++ b/libc/kernel/uapi/drm/panfrost_drm.h
@@ -136,6 +136,38 @@
__u32 madv;
__u32 retained;
};
+#define PANFROSTDUMP_MAJOR 1
+#define PANFROSTDUMP_MINOR 0
+#define PANFROSTDUMP_MAGIC 0x464E4150
+#define PANFROSTDUMP_BUF_REG 0
+#define PANFROSTDUMP_BUF_BOMAP (PANFROSTDUMP_BUF_REG + 1)
+#define PANFROSTDUMP_BUF_BO (PANFROSTDUMP_BUF_BOMAP + 1)
+#define PANFROSTDUMP_BUF_TRAILER (PANFROSTDUMP_BUF_BO + 1)
+struct panfrost_dump_object_header {
+ __u32 magic;
+ __u32 type;
+ __u32 file_size;
+ __u32 file_offset;
+ union {
+ struct {
+ __u64 jc;
+ __u32 gpu_id;
+ __u32 major;
+ __u32 minor;
+ __u64 nbos;
+ } reghdr;
+ struct {
+ __u32 valid;
+ __u64 iova;
+ __u32 data[2];
+ } bomap;
+ __u32 sizer[496];
+ };
+};
+struct panfrost_dump_registers {
+ __u32 reg;
+ __u32 value;
+};
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/r128_drm.h b/libc/kernel/uapi/drm/r128_drm.h
index 618b6dc..3e013b1 100644
--- a/libc/kernel/uapi/drm/r128_drm.h
+++ b/libc/kernel/uapi/drm/r128_drm.h
@@ -204,13 +204,13 @@
R128_READ_PIXELS = 0x04
} func;
int n;
- int __user * x;
- int __user * y;
- unsigned int __user * buffer;
- unsigned char __user * mask;
+ int * x;
+ int * y;
+ unsigned int * buffer;
+ unsigned char * mask;
} drm_r128_depth_t;
typedef struct drm_r128_stipple {
- unsigned int __user * mask;
+ unsigned int * mask;
} drm_r128_stipple_t;
typedef struct drm_r128_indirect {
int idx;
@@ -227,7 +227,7 @@
#define R128_PARAM_IRQ_NR 1
typedef struct drm_r128_getparam {
int param;
- void __user * value;
+ void * value;
} drm_r128_getparam_t;
#ifdef __cplusplus
}
diff --git a/libc/kernel/uapi/drm/radeon_drm.h b/libc/kernel/uapi/drm/radeon_drm.h
index 9dc69ad..3ec6bb3 100644
--- a/libc/kernel/uapi/drm/radeon_drm.h
+++ b/libc/kernel/uapi/drm/radeon_drm.h
@@ -479,7 +479,7 @@
unsigned int clear_depth;
unsigned int color_mask;
unsigned int depth_mask;
- drm_radeon_clear_rect_t __user * depth_boxes;
+ drm_radeon_clear_rect_t * depth_boxes;
} drm_radeon_clear_t;
typedef struct drm_radeon_vertex {
int prim;
@@ -498,20 +498,20 @@
int idx;
int discard;
int nr_states;
- drm_radeon_state_t __user * state;
+ drm_radeon_state_t * state;
int nr_prims;
- drm_radeon_prim_t __user * prim;
+ drm_radeon_prim_t * prim;
} drm_radeon_vertex2_t;
typedef struct drm_radeon_cmd_buffer {
int bufsz;
- char __user * buf;
+ char * buf;
int nbox;
- struct drm_clip_rect __user * boxes;
+ struct drm_clip_rect * boxes;
} drm_radeon_cmd_buffer_t;
typedef struct drm_radeon_tex_image {
unsigned int x, y;
unsigned int width, height;
- const void __user * data;
+ const void * data;
} drm_radeon_tex_image_t;
typedef struct drm_radeon_texture {
unsigned int offset;
@@ -519,10 +519,10 @@
int format;
int width;
int height;
- drm_radeon_tex_image_t __user * image;
+ drm_radeon_tex_image_t * image;
} drm_radeon_texture_t;
typedef struct drm_radeon_stipple {
- unsigned int __user * mask;
+ unsigned int * mask;
} drm_radeon_stipple_t;
typedef struct drm_radeon_indirect {
int idx;
@@ -552,7 +552,7 @@
#define RADEON_PARAM_NUM_Z_PIPES 17
typedef struct drm_radeon_getparam {
int param;
- void __user * value;
+ void * value;
} drm_radeon_getparam_t;
#define RADEON_MEM_REGION_GART 1
#define RADEON_MEM_REGION_FB 2
@@ -560,7 +560,7 @@
int region;
int alignment;
int size;
- int __user * region_offset;
+ int * region_offset;
} drm_radeon_mem_alloc_t;
typedef struct drm_radeon_mem_free {
int region;
@@ -572,7 +572,7 @@
int start;
} drm_radeon_mem_init_heap_t;
typedef struct drm_radeon_irq_emit {
- int __user * irq_seq;
+ int * irq_seq;
} drm_radeon_irq_emit_t;
typedef struct drm_radeon_irq_wait {
int irq_seq;
diff --git a/libc/kernel/uapi/drm/savage_drm.h b/libc/kernel/uapi/drm/savage_drm.h
index ae87d21..efc0ae6 100644
--- a/libc/kernel/uapi/drm/savage_drm.h
+++ b/libc/kernel/uapi/drm/savage_drm.h
@@ -68,14 +68,14 @@
} drm_savage_init_t;
typedef union drm_savage_cmd_header drm_savage_cmd_header_t;
typedef struct drm_savage_cmdbuf {
- drm_savage_cmd_header_t __user * cmd_addr;
+ drm_savage_cmd_header_t * cmd_addr;
unsigned int size;
unsigned int dma_idx;
int discard;
- unsigned int __user * vb_addr;
+ unsigned int * vb_addr;
unsigned int vb_size;
unsigned int vb_stride;
- struct drm_clip_rect __user * box_addr;
+ struct drm_clip_rect * box_addr;
unsigned int nbox;
} drm_savage_cmdbuf_t;
#define SAVAGE_WAIT_2D 0x1
diff --git a/libc/kernel/uapi/drm/via_drm.h b/libc/kernel/uapi/drm/via_drm.h
index 9ef645a..95a149b 100644
--- a/libc/kernel/uapi/drm/via_drm.h
+++ b/libc/kernel/uapi/drm/via_drm.h
@@ -125,7 +125,7 @@
unsigned long reg_pause_addr;
} drm_via_dma_init_t;
typedef struct _drm_via_cmdbuffer {
- char __user * buf;
+ char * buf;
unsigned long size;
} drm_via_cmdbuffer_t;
typedef struct _drm_via_tex_region {
diff --git a/libc/kernel/uapi/drm/vmwgfx_drm.h b/libc/kernel/uapi/drm/vmwgfx_drm.h
index 395743b..2f75589 100644
--- a/libc/kernel/uapi/drm/vmwgfx_drm.h
+++ b/libc/kernel/uapi/drm/vmwgfx_drm.h
@@ -76,6 +76,7 @@
#define DRM_VMW_PARAM_SM4_1 14
#define DRM_VMW_PARAM_SM5 15
#define DRM_VMW_PARAM_GL43 16
+#define DRM_VMW_PARAM_DEVICE_ID 17
enum drm_vmw_handle_type {
DRM_VMW_HANDLE_LEGACY = 0,
DRM_VMW_HANDLE_PRIME = 1
diff --git a/libc/kernel/uapi/linux/acct.h b/libc/kernel/uapi/linux/acct.h
index aecc9f6..ba9d25f 100644
--- a/libc/kernel/uapi/linux/acct.h
+++ b/libc/kernel/uapi/linux/acct.h
@@ -74,6 +74,7 @@
#define ACOMPAT 0x04
#define ACORE 0x08
#define AXSIG 0x10
+#define AGROUP 0x20
#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
#define ACCT_BYTEORDER 0x80
#elif defined(__BYTE_ORDER)?__BYTE_ORDER==__LITTLE_ENDIAN:defined(__LITTLE_ENDIAN)
diff --git a/libc/kernel/uapi/linux/acrn.h b/libc/kernel/uapi/linux/acrn.h
index c991ac0..aa408d8 100644
--- a/libc/kernel/uapi/linux/acrn.h
+++ b/libc/kernel/uapi/linux/acrn.h
@@ -19,7 +19,6 @@
#ifndef _UAPI_ACRN_H
#define _UAPI_ACRN_H
#include <linux/types.h>
-#include <linux/uuid.h>
#define ACRN_IO_REQUEST_MAX 16
#define ACRN_IOREQ_STATE_PENDING 0
#define ACRN_IOREQ_STATE_COMPLETE 1
@@ -84,7 +83,7 @@
__u16 reserved0;
__u16 vcpu_num;
__u16 reserved1;
- guid_t uuid;
+ __u8 uuid[16];
__u64 vm_flag;
__u64 ioreq_buf;
__u64 cpu_affinity;
diff --git a/libc/kernel/uapi/linux/agpgart.h b/libc/kernel/uapi/linux/agpgart.h
index 3b126f1..9dda7bf 100644
--- a/libc/kernel/uapi/linux/agpgart.h
+++ b/libc/kernel/uapi/linux/agpgart.h
@@ -38,7 +38,6 @@
#define FALSE 0
#endif
#include <linux/types.h>
-#include <stdlib.h>
struct agp_version {
__u16 major;
__u16 minor;
@@ -48,10 +47,10 @@
__u32 bridge_id;
__u32 agp_mode;
unsigned long aper_base;
- size_t aper_size;
- size_t pg_total;
- size_t pg_system;
- size_t pg_used;
+ __kernel_size_t aper_size;
+ __kernel_size_t pg_total;
+ __kernel_size_t pg_system;
+ __kernel_size_t pg_used;
} agp_info;
typedef struct _agp_setup {
__u32 agp_mode;
diff --git a/libc/kernel/uapi/linux/android/binder.h b/libc/kernel/uapi/linux/android/binder.h
index ded1756..52f4c6b 100644
--- a/libc/kernel/uapi/linux/android/binder.h
+++ b/libc/kernel/uapi/linux/android/binder.h
@@ -127,6 +127,11 @@
__u32 sync_recv;
__u32 async_recv;
};
+struct binder_extended_error {
+ __u32 id;
+ __u32 command;
+ __s32 param;
+};
#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
@@ -140,12 +145,14 @@
#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info)
#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info)
#define BINDER_ENABLE_ONEWAY_SPAM_DETECTION _IOW('b', 16, __u32)
+#define BINDER_GET_EXTENDED_ERROR _IOWR('b', 17, struct binder_extended_error)
enum transaction_flags {
TF_ONE_WAY = 0x01,
TF_ROOT_OBJECT = 0x04,
TF_STATUS_CODE = 0x08,
TF_ACCEPT_FDS = 0x10,
TF_CLEAR_BUF = 0x20,
+ TF_UPDATE_TXN = 0x40,
};
struct binder_transaction_data {
union {
@@ -155,8 +162,8 @@
binder_uintptr_t cookie;
__u32 code;
__u32 flags;
- pid_t sender_pid;
- uid_t sender_euid;
+ __kernel_pid_t sender_pid;
+ __kernel_uid32_t sender_euid;
binder_size_t data_size;
binder_size_t offsets_size;
union {
@@ -182,7 +189,7 @@
struct binder_handle_cookie {
__u32 handle;
binder_uintptr_t cookie;
-} __packed;
+} __attribute__((__packed__));
struct binder_pri_desc {
__s32 priority;
__u32 desc;
diff --git a/libc/kernel/uapi/linux/ashmem.h b/libc/kernel/uapi/linux/ashmem.h
index 174667f..88f0e81 100644
--- a/libc/kernel/uapi/linux/ashmem.h
+++ b/libc/kernel/uapi/linux/ashmem.h
@@ -41,4 +41,5 @@
#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
+#define ASHMEM_GET_FILE_ID _IOR(__ASHMEMIOC, 11, unsigned long)
#endif
diff --git a/libc/kernel/uapi/linux/aspeed-video.h b/libc/kernel/uapi/linux/aspeed-video.h
new file mode 100644
index 0000000..d5109c1
--- /dev/null
+++ b/libc/kernel/uapi/linux/aspeed-video.h
@@ -0,0 +1,24 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_ASPEED_VIDEO_H
+#define _UAPI_LINUX_ASPEED_VIDEO_H
+#include <linux/v4l2-controls.h>
+#define V4L2_CID_ASPEED_HQ_MODE (V4L2_CID_USER_ASPEED_BASE + 1)
+#define V4L2_CID_ASPEED_HQ_JPEG_QUALITY (V4L2_CID_USER_ASPEED_BASE + 2)
+#endif
diff --git a/libc/kernel/uapi/linux/atm.h b/libc/kernel/uapi/linux/atm.h
index 488fa05..72d329d 100644
--- a/libc/kernel/uapi/linux/atm.h
+++ b/libc/kernel/uapi/linux/atm.h
@@ -140,7 +140,7 @@
struct atmif_sioc {
int number;
int length;
- void __user * arg;
+ void * arg;
};
typedef unsigned short atm_backend_t;
#endif
diff --git a/libc/kernel/uapi/linux/atmdev.h b/libc/kernel/uapi/linux/atmdev.h
index 69eb240..74cdfc1 100644
--- a/libc/kernel/uapi/linux/atmdev.h
+++ b/libc/kernel/uapi/linux/atmdev.h
@@ -86,7 +86,7 @@
#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
struct atm_iobuf {
int length;
- void __user * buffer;
+ void * buffer;
};
#define ATM_CI_MAX - 1
struct atm_cirange {
diff --git a/libc/kernel/uapi/linux/audit.h b/libc/kernel/uapi/linux/audit.h
index 30a94af..f7c969b 100644
--- a/libc/kernel/uapi/linux/audit.h
+++ b/libc/kernel/uapi/linux/audit.h
@@ -140,7 +140,7 @@
#define AUDIT_MAX_KEY_LEN 256
#define AUDIT_BITMASK_SIZE 64
#define AUDIT_WORD(nr) ((__u32) ((nr) / 32))
-#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr) * 32))
+#define AUDIT_BIT(nr) (1U << ((nr) - AUDIT_WORD(nr) * 32))
#define AUDIT_SYSCALL_CLASSES 16
#define AUDIT_CLASS_DIR_WRITE 0
#define AUDIT_CLASS_DIR_WRITE_32 1
@@ -323,6 +323,8 @@
#define AUDIT_ARCH_UNICORE (EM_UNICORE | __AUDIT_ARCH_LE)
#define AUDIT_ARCH_X86_64 (EM_X86_64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
#define AUDIT_ARCH_XTENSA (EM_XTENSA)
+#define AUDIT_ARCH_LOONGARCH32 (EM_LOONGARCH | __AUDIT_ARCH_LE)
+#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
#define AUDIT_PERM_EXEC 1
#define AUDIT_PERM_WRITE 2
#define AUDIT_PERM_READ 4
diff --git a/libc/kernel/uapi/linux/blkpg.h b/libc/kernel/uapi/linux/blkpg.h
index fdde696..bfe504f 100644
--- a/libc/kernel/uapi/linux/blkpg.h
+++ b/libc/kernel/uapi/linux/blkpg.h
@@ -25,7 +25,7 @@
int op;
int flags;
int datalen;
- void __user * data;
+ void * data;
};
#define BLKPG_ADD_PARTITION 1
#define BLKPG_DEL_PARTITION 2
diff --git a/libc/kernel/uapi/linux/blkzoned.h b/libc/kernel/uapi/linux/blkzoned.h
index b551e8b..e41ac9f 100644
--- a/libc/kernel/uapi/linux/blkzoned.h
+++ b/libc/kernel/uapi/linux/blkzoned.h
@@ -54,7 +54,7 @@
__u64 sector;
__u32 nr_zones;
__u32 flags;
- struct blk_zone zones[0];
+ struct blk_zone zones[];
};
struct blk_zone_range {
__u64 sector;
diff --git a/libc/kernel/uapi/linux/bpf.h b/libc/kernel/uapi/linux/bpf.h
index d363e81..163dd1e 100644
--- a/libc/kernel/uapi/linux/bpf.h
+++ b/libc/kernel/uapi/linux/bpf.h
@@ -74,10 +74,27 @@
__u64 cgroup_inode_id;
__u32 attach_type;
};
+enum bpf_cgroup_iter_order {
+ BPF_CGROUP_ITER_ORDER_UNSPEC = 0,
+ BPF_CGROUP_ITER_SELF_ONLY,
+ BPF_CGROUP_ITER_DESCENDANTS_PRE,
+ BPF_CGROUP_ITER_DESCENDANTS_POST,
+ BPF_CGROUP_ITER_ANCESTORS_UP,
+};
union bpf_iter_link_info {
struct {
__u32 map_fd;
} map;
+ struct {
+ enum bpf_cgroup_iter_order order;
+ __u32 cgroup_fd;
+ __u64 cgroup_id;
+ } cgroup;
+ struct {
+ __u32 tid;
+ __u32 pid;
+ __u32 pid_fd;
+ } task;
};
enum bpf_cmd {
BPF_MAP_CREATE,
@@ -138,7 +155,8 @@
BPF_MAP_TYPE_CPUMAP,
BPF_MAP_TYPE_XSKMAP,
BPF_MAP_TYPE_SOCKHASH,
- BPF_MAP_TYPE_CGROUP_STORAGE,
+ BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED,
+ BPF_MAP_TYPE_CGROUP_STORAGE = BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED,
BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE,
BPF_MAP_TYPE_QUEUE,
@@ -150,6 +168,8 @@
BPF_MAP_TYPE_INODE_STORAGE,
BPF_MAP_TYPE_TASK_STORAGE,
BPF_MAP_TYPE_BLOOM_FILTER,
+ BPF_MAP_TYPE_USER_RINGBUF,
+ BPF_MAP_TYPE_CGRP_STORAGE,
};
enum bpf_prog_type {
BPF_PROG_TYPE_UNSPEC,
@@ -228,6 +248,8 @@
BPF_SK_REUSEPORT_SELECT,
BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
BPF_PERF_EVENT,
+ BPF_TRACE_KPROBE_MULTI,
+ BPF_LSM_CGROUP,
__MAX_BPF_ATTACH_TYPE
};
#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
@@ -240,6 +262,8 @@
BPF_LINK_TYPE_NETNS = 5,
BPF_LINK_TYPE_XDP = 6,
BPF_LINK_TYPE_PERF_EVENT = 7,
+ BPF_LINK_TYPE_KPROBE_MULTI = 8,
+ BPF_LINK_TYPE_STRUCT_OPS = 9,
MAX_BPF_LINK_TYPE,
};
#define BPF_F_ALLOW_OVERRIDE (1U << 0)
@@ -250,6 +274,8 @@
#define BPF_F_TEST_RND_HI32 (1U << 2)
#define BPF_F_TEST_STATE_FREQ (1U << 3)
#define BPF_F_SLEEPABLE (1U << 4)
+#define BPF_F_XDP_HAS_FRAGS (1U << 5)
+#define BPF_F_KPROBE_MULTI_RETURN (1U << 0)
#define BPF_PSEUDO_MAP_FD 1
#define BPF_PSEUDO_MAP_IDX 5
#define BPF_PSEUDO_MAP_VALUE 2
@@ -281,6 +307,7 @@
};
#define BPF_F_QUERY_EFFECTIVE (1U << 0)
#define BPF_F_TEST_RUN_ON_CPU (1U << 0)
+#define BPF_F_TEST_XDP_LIVE_FRAMES (1U << 1)
enum bpf_stats_type {
BPF_STATS_RUN_TIME = 0,
};
@@ -392,6 +419,7 @@
__aligned_u64 ctx_out;
__u32 flags;
__u32 cpu;
+ __u32 batch_size;
} test;
struct {
union {
@@ -416,6 +444,7 @@
__u32 attach_flags;
__aligned_u64 prog_ids;
__u32 prog_cnt;
+ __aligned_u64 prog_attach_flags;
} query;
struct {
__u64 name;
@@ -456,6 +485,17 @@
struct {
__u64 bpf_cookie;
} perf_event;
+ struct {
+ __u32 flags;
+ __u32 cnt;
+ __aligned_u64 syms;
+ __aligned_u64 addrs;
+ __aligned_u64 cookies;
+ } kprobe_multi;
+ struct {
+ __u32 target_btf_id;
+ __u64 cookie;
+ } tracing;
};
} link_create;
struct {
@@ -480,10 +520,12 @@
__u32 flags;
} prog_bind_map;
} __attribute__((aligned(8)));
-#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete), FN(send_signal), FN(tcp_gen_syncookie), FN(skb_output), FN(probe_read_user), FN(probe_read_kernel), FN(probe_read_user_str), FN(probe_read_kernel_str), FN(tcp_send_ack), FN(send_signal_thread), FN(jiffies64), FN(read_branch_records), FN(get_ns_current_pid_tgid), FN(xdp_output), FN(get_netns_cookie), FN(get_current_ancestor_cgroup_id), FN(sk_assign), FN(ktime_get_boot_ns), FN(seq_printf), FN(seq_write), FN(sk_cgroup_id), FN(sk_ancestor_cgroup_id), FN(ringbuf_output), FN(ringbuf_reserve), FN(ringbuf_submit), FN(ringbuf_discard), FN(ringbuf_query), FN(csum_level), FN(skc_to_tcp6_sock), FN(skc_to_tcp_sock), FN(skc_to_tcp_timewait_sock), FN(skc_to_tcp_request_sock), FN(skc_to_udp6_sock), FN(get_task_stack), FN(load_hdr_opt), FN(store_hdr_opt), FN(reserve_hdr_opt), FN(inode_storage_get), FN(inode_storage_delete), FN(d_path), FN(copy_from_user), FN(snprintf_btf), FN(seq_printf_btf), FN(skb_cgroup_classid), FN(redirect_neigh), FN(per_cpu_ptr), FN(this_cpu_ptr), FN(redirect_peer), FN(task_storage_get), FN(task_storage_delete), FN(get_current_task_btf), FN(bprm_opts_set), FN(ktime_get_coarse_ns), FN(ima_inode_hash), FN(sock_from_file), FN(check_mtu), FN(for_each_map_elem), FN(snprintf), FN(sys_bpf), FN(btf_find_by_name_kind), FN(sys_close), FN(timer_init), FN(timer_set_callback), FN(timer_start), FN(timer_cancel), FN(get_func_ip), FN(get_attach_cookie), FN(task_pt_regs), FN(get_branch_snapshot), FN(trace_vprintk), FN(skc_to_unix_sock), FN(kallsyms_lookup_name), FN(find_vma), FN(loop), FN(strncmp), FN(get_func_arg), FN(get_func_ret), FN(get_func_arg_cnt),
-#define __BPF_ENUM_FN(x) BPF_FUNC_ ##x
+#define ___BPF_FUNC_MAPPER(FN,ctx...) FN(unspec, 0, ##ctx) FN(map_lookup_elem, 1, ##ctx) FN(map_update_elem, 2, ##ctx) FN(map_delete_elem, 3, ##ctx) FN(probe_read, 4, ##ctx) FN(ktime_get_ns, 5, ##ctx) FN(trace_printk, 6, ##ctx) FN(get_prandom_u32, 7, ##ctx) FN(get_smp_processor_id, 8, ##ctx) FN(skb_store_bytes, 9, ##ctx) FN(l3_csum_replace, 10, ##ctx) FN(l4_csum_replace, 11, ##ctx) FN(tail_call, 12, ##ctx) FN(clone_redirect, 13, ##ctx) FN(get_current_pid_tgid, 14, ##ctx) FN(get_current_uid_gid, 15, ##ctx) FN(get_current_comm, 16, ##ctx) FN(get_cgroup_classid, 17, ##ctx) FN(skb_vlan_push, 18, ##ctx) FN(skb_vlan_pop, 19, ##ctx) FN(skb_get_tunnel_key, 20, ##ctx) FN(skb_set_tunnel_key, 21, ##ctx) FN(perf_event_read, 22, ##ctx) FN(redirect, 23, ##ctx) FN(get_route_realm, 24, ##ctx) FN(perf_event_output, 25, ##ctx) FN(skb_load_bytes, 26, ##ctx) FN(get_stackid, 27, ##ctx) FN(csum_diff, 28, ##ctx) FN(skb_get_tunnel_opt, 29, ##ctx) FN(skb_set_tunnel_opt, 30, ##ctx) FN(skb_change_proto, 31, ##ctx) FN(skb_change_type, 32, ##ctx) FN(skb_under_cgroup, 33, ##ctx) FN(get_hash_recalc, 34, ##ctx) FN(get_current_task, 35, ##ctx) FN(probe_write_user, 36, ##ctx) FN(current_task_under_cgroup, 37, ##ctx) FN(skb_change_tail, 38, ##ctx) FN(skb_pull_data, 39, ##ctx) FN(csum_update, 40, ##ctx) FN(set_hash_invalid, 41, ##ctx) FN(get_numa_node_id, 42, ##ctx) FN(skb_change_head, 43, ##ctx) FN(xdp_adjust_head, 44, ##ctx) FN(probe_read_str, 45, ##ctx) FN(get_socket_cookie, 46, ##ctx) FN(get_socket_uid, 47, ##ctx) FN(set_hash, 48, ##ctx) FN(setsockopt, 49, ##ctx) FN(skb_adjust_room, 50, ##ctx) FN(redirect_map, 51, ##ctx) FN(sk_redirect_map, 52, ##ctx) FN(sock_map_update, 53, ##ctx) FN(xdp_adjust_meta, 54, ##ctx) FN(perf_event_read_value, 55, ##ctx) FN(perf_prog_read_value, 56, ##ctx) FN(getsockopt, 57, ##ctx) FN(override_return, 58, ##ctx) FN(sock_ops_cb_flags_set, 59, ##ctx) FN(msg_redirect_map, 60, ##ctx) FN(msg_apply_bytes, 61, ##ctx) FN(msg_cork_bytes, 62, ##ctx) FN(msg_pull_data, 63, ##ctx) FN(bind, 64, ##ctx) FN(xdp_adjust_tail, 65, ##ctx) FN(skb_get_xfrm_state, 66, ##ctx) FN(get_stack, 67, ##ctx) FN(skb_load_bytes_relative, 68, ##ctx) FN(fib_lookup, 69, ##ctx) FN(sock_hash_update, 70, ##ctx) FN(msg_redirect_hash, 71, ##ctx) FN(sk_redirect_hash, 72, ##ctx) FN(lwt_push_encap, 73, ##ctx) FN(lwt_seg6_store_bytes, 74, ##ctx) FN(lwt_seg6_adjust_srh, 75, ##ctx) FN(lwt_seg6_action, 76, ##ctx) FN(rc_repeat, 77, ##ctx) FN(rc_keydown, 78, ##ctx) FN(skb_cgroup_id, 79, ##ctx) FN(get_current_cgroup_id, 80, ##ctx) FN(get_local_storage, 81, ##ctx) FN(sk_select_reuseport, 82, ##ctx) FN(skb_ancestor_cgroup_id, 83, ##ctx) FN(sk_lookup_tcp, 84, ##ctx) FN(sk_lookup_udp, 85, ##ctx) FN(sk_release, 86, ##ctx) FN(map_push_elem, 87, ##ctx) FN(map_pop_elem, 88, ##ctx) FN(map_peek_elem, 89, ##ctx) FN(msg_push_data, 90, ##ctx) FN(msg_pop_data, 91, ##ctx) FN(rc_pointer_rel, 92, ##ctx) FN(spin_lock, 93, ##ctx) FN(spin_unlock, 94, ##ctx) FN(sk_fullsock, 95, ##ctx) FN(tcp_sock, 96, ##ctx) FN(skb_ecn_set_ce, 97, ##ctx) FN(get_listener_sock, 98, ##ctx) FN(skc_lookup_tcp, 99, ##ctx) FN(tcp_check_syncookie, 100, ##ctx) FN(sysctl_get_name, 101, ##ctx) FN(sysctl_get_current_value, 102, ##ctx) FN(sysctl_get_new_value, 103, ##ctx) FN(sysctl_set_new_value, 104, ##ctx) FN(strtol, 105, ##ctx) FN(strtoul, 106, ##ctx) FN(sk_storage_get, 107, ##ctx) FN(sk_storage_delete, 108, ##ctx) FN(send_signal, 109, ##ctx) FN(tcp_gen_syncookie, 110, ##ctx) FN(skb_output, 111, ##ctx) FN(probe_read_user, 112, ##ctx) FN(probe_read_kernel, 113, ##ctx) FN(probe_read_user_str, 114, ##ctx) FN(probe_read_kernel_str, 115, ##ctx) FN(tcp_send_ack, 116, ##ctx) FN(send_signal_thread, 117, ##ctx) FN(jiffies64, 118, ##ctx) FN(read_branch_records, 119, ##ctx) FN(get_ns_current_pid_tgid, 120, ##ctx) FN(xdp_output, 121, ##ctx) FN(get_netns_cookie, 122, ##ctx) FN(get_current_ancestor_cgroup_id, 123, ##ctx) FN(sk_assign, 124, ##ctx) FN(ktime_get_boot_ns, 125, ##ctx) FN(seq_printf, 126, ##ctx) FN(seq_write, 127, ##ctx) FN(sk_cgroup_id, 128, ##ctx) FN(sk_ancestor_cgroup_id, 129, ##ctx) FN(ringbuf_output, 130, ##ctx) FN(ringbuf_reserve, 131, ##ctx) FN(ringbuf_submit, 132, ##ctx) FN(ringbuf_discard, 133, ##ctx) FN(ringbuf_query, 134, ##ctx) FN(csum_level, 135, ##ctx) FN(skc_to_tcp6_sock, 136, ##ctx) FN(skc_to_tcp_sock, 137, ##ctx) FN(skc_to_tcp_timewait_sock, 138, ##ctx) FN(skc_to_tcp_request_sock, 139, ##ctx) FN(skc_to_udp6_sock, 140, ##ctx) FN(get_task_stack, 141, ##ctx) FN(load_hdr_opt, 142, ##ctx) FN(store_hdr_opt, 143, ##ctx) FN(reserve_hdr_opt, 144, ##ctx) FN(inode_storage_get, 145, ##ctx) FN(inode_storage_delete, 146, ##ctx) FN(d_path, 147, ##ctx) FN(copy_from_user, 148, ##ctx) FN(snprintf_btf, 149, ##ctx) FN(seq_printf_btf, 150, ##ctx) FN(skb_cgroup_classid, 151, ##ctx) FN(redirect_neigh, 152, ##ctx) FN(per_cpu_ptr, 153, ##ctx) FN(this_cpu_ptr, 154, ##ctx) FN(redirect_peer, 155, ##ctx) FN(task_storage_get, 156, ##ctx) FN(task_storage_delete, 157, ##ctx) FN(get_current_task_btf, 158, ##ctx) FN(bprm_opts_set, 159, ##ctx) FN(ktime_get_coarse_ns, 160, ##ctx) FN(ima_inode_hash, 161, ##ctx) FN(sock_from_file, 162, ##ctx) FN(check_mtu, 163, ##ctx) FN(for_each_map_elem, 164, ##ctx) FN(snprintf, 165, ##ctx) FN(sys_bpf, 166, ##ctx) FN(btf_find_by_name_kind, 167, ##ctx) FN(sys_close, 168, ##ctx) FN(timer_init, 169, ##ctx) FN(timer_set_callback, 170, ##ctx) FN(timer_start, 171, ##ctx) FN(timer_cancel, 172, ##ctx) FN(get_func_ip, 173, ##ctx) FN(get_attach_cookie, 174, ##ctx) FN(task_pt_regs, 175, ##ctx) FN(get_branch_snapshot, 176, ##ctx) FN(trace_vprintk, 177, ##ctx) FN(skc_to_unix_sock, 178, ##ctx) FN(kallsyms_lookup_name, 179, ##ctx) FN(find_vma, 180, ##ctx) FN(loop, 181, ##ctx) FN(strncmp, 182, ##ctx) FN(get_func_arg, 183, ##ctx) FN(get_func_ret, 184, ##ctx) FN(get_func_arg_cnt, 185, ##ctx) FN(get_retval, 186, ##ctx) FN(set_retval, 187, ##ctx) FN(xdp_get_buff_len, 188, ##ctx) FN(xdp_load_bytes, 189, ##ctx) FN(xdp_store_bytes, 190, ##ctx) FN(copy_from_user_task, 191, ##ctx) FN(skb_set_tstamp, 192, ##ctx) FN(ima_file_hash, 193, ##ctx) FN(kptr_xchg, 194, ##ctx) FN(map_lookup_percpu_elem, 195, ##ctx) FN(skc_to_mptcp_sock, 196, ##ctx) FN(dynptr_from_mem, 197, ##ctx) FN(ringbuf_reserve_dynptr, 198, ##ctx) FN(ringbuf_submit_dynptr, 199, ##ctx) FN(ringbuf_discard_dynptr, 200, ##ctx) FN(dynptr_read, 201, ##ctx) FN(dynptr_write, 202, ##ctx) FN(dynptr_data, 203, ##ctx) FN(tcp_raw_gen_syncookie_ipv4, 204, ##ctx) FN(tcp_raw_gen_syncookie_ipv6, 205, ##ctx) FN(tcp_raw_check_syncookie_ipv4, 206, ##ctx) FN(tcp_raw_check_syncookie_ipv6, 207, ##ctx) FN(ktime_get_tai_ns, 208, ##ctx) FN(user_ringbuf_drain, 209, ##ctx) FN(cgrp_storage_get, 210, ##ctx) FN(cgrp_storage_delete, 211, ##ctx)
+#define __BPF_FUNC_MAPPER_APPLY(name,value,FN) FN(name),
+#define __BPF_FUNC_MAPPER(FN) ___BPF_FUNC_MAPPER(__BPF_FUNC_MAPPER_APPLY, FN)
+#define __BPF_ENUM_FN(x,y) BPF_FUNC_ ##x = y,
enum bpf_func_id {
- __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
+ ___BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
};
#undef __BPF_ENUM_FN
enum {
@@ -517,6 +559,9 @@
BPF_F_SEQ_NUMBER = (1ULL << 3),
};
enum {
+ BPF_F_TUNINFO_FLAGS = (1ULL << 4),
+};
+enum {
BPF_F_INDEX_MASK = 0xffffffffULL,
BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK,
BPF_F_CTXLEN_MASK = (0xfffffULL << 32),
@@ -595,6 +640,10 @@
};
#define __bpf_md_ptr(type,name) union { type name; __u64 : 64; \
} __attribute__((aligned(8)))
+enum {
+ BPF_SKB_TSTAMP_UNSPEC,
+ BPF_SKB_TSTAMP_DELIVERY_MONO,
+};
struct __sk_buff {
__u32 len;
__u32 pkt_type;
@@ -628,7 +677,8 @@
__u32 gso_segs;
__bpf_md_ptr(struct bpf_sock *, sk);
__u32 gso_size;
- __u32 : 32;
+ __u8 tstamp_type;
+ __u32 : 24;
__u64 hwtstamp;
};
struct bpf_tunnel_key {
@@ -639,8 +689,15 @@
};
__u8 tunnel_tos;
__u8 tunnel_ttl;
- __u16 tunnel_ext;
+ union {
+ __u16 tunnel_ext;
+ __be16 tunnel_flags;
+ };
__u32 tunnel_label;
+ union {
+ __u32 local_ipv4;
+ __u32 local_ipv6[4];
+ };
};
struct bpf_xfrm_state {
__u32 reqid;
@@ -657,6 +714,7 @@
BPF_DROP = 2,
BPF_REDIRECT = 7,
BPF_LWT_REROUTE = 128,
+ BPF_FLOW_DISSECTOR_CONTINUE = 129,
};
struct bpf_sock {
__u32 bound_dev_if;
@@ -668,7 +726,8 @@
__u32 src_ip4;
__u32 src_ip6[4];
__u32 src_port;
- __u32 dst_port;
+ __be16 dst_port;
+ __u16 : 16;
__u32 dst_ip4;
__u32 dst_ip6[4];
__u32 state;
@@ -818,6 +877,8 @@
__u64 run_cnt;
__u64 recursion_misses;
__u32 verified_insns;
+ __u32 attach_btf_obj_id;
+ __u32 attach_btf_id;
} __attribute__((aligned(8)));
struct bpf_map_info {
__u32 type;
@@ -871,6 +932,16 @@
__u32 map_id;
} map;
};
+ union {
+ struct {
+ __u64 cgroup_id;
+ __u32 order;
+ } cgroup;
+ struct {
+ __u32 tid;
+ __u32 pid;
+ } task;
+ };
} iter;
struct {
__u32 netns_ino;
@@ -938,6 +1009,7 @@
__bpf_md_ptr(void *, skb_data_end);
__u32 skb_len;
__u32 skb_tcp_flags;
+ __u64 skb_hwtstamp;
};
enum {
BPF_SOCK_OPS_RTO_CB_FLAG = (1 << 0),
@@ -1134,6 +1206,18 @@
__u64 : 64;
__u64 : 64;
} __attribute__((aligned(8)));
+struct bpf_dynptr {
+ __u64 : 64;
+ __u64 : 64;
+} __attribute__((aligned(8)));
+struct bpf_list_head {
+ __u64 : 64;
+ __u64 : 64;
+} __attribute__((aligned(8)));
+struct bpf_list_node {
+ __u64 : 64;
+ __u64 : 64;
+} __attribute__((aligned(8)));
struct bpf_sysctl {
__u32 write;
__u32 file_pos;
@@ -1160,7 +1244,8 @@
__u32 protocol;
__u32 remote_ip4;
__u32 remote_ip6[4];
- __u32 remote_port;
+ __be16 remote_port;
+ __u16 : 16;
__u32 local_ip4;
__u32 local_ip6[4];
__u32 local_port;
@@ -1190,6 +1275,7 @@
BPF_CORE_TYPE_SIZE = 9,
BPF_CORE_ENUMVAL_EXISTS = 10,
BPF_CORE_ENUMVAL_VALUE = 11,
+ BPF_CORE_TYPE_MATCHES = 12,
};
struct bpf_core_relo {
__u32 insn_off;
diff --git a/libc/kernel/uapi/linux/btf.h b/libc/kernel/uapi/linux/btf.h
index fc57d3c..a1f68bf 100644
--- a/libc/kernel/uapi/linux/btf.h
+++ b/libc/kernel/uapi/linux/btf.h
@@ -65,6 +65,7 @@
BTF_KIND_FLOAT = 16,
BTF_KIND_DECL_TAG = 17,
BTF_KIND_TYPE_TAG = 18,
+ BTF_KIND_ENUM64 = 19,
NR_BTF_KINDS,
BTF_KIND_MAX = NR_BTF_KINDS - 1,
};
@@ -115,4 +116,9 @@
struct btf_decl_tag {
__s32 component_idx;
};
+struct btf_enum64 {
+ __u32 name_off;
+ __u32 val_lo32;
+ __u32 val_hi32;
+};
#endif
diff --git a/libc/kernel/uapi/linux/btrfs.h b/libc/kernel/uapi/linux/btrfs.h
index 08b96a3..0fdac66 100644
--- a/libc/kernel/uapi/linux/btrfs.h
+++ b/libc/kernel/uapi/linux/btrfs.h
@@ -18,8 +18,12 @@
****************************************************************************/
#ifndef _UAPI_LINUX_BTRFS_H
#define _UAPI_LINUX_BTRFS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <linux/types.h>
#include <linux/ioctl.h>
+#include <linux/fs.h>
#define BTRFS_IOCTL_MAGIC 0x94
#define BTRFS_VOL_NAME_MAX 255
#define BTRFS_LABEL_SIZE 256
@@ -59,7 +63,7 @@
__u64 num_ref_copies;
__u64 num_excl_copies;
struct btrfs_qgroup_limit lim;
- __u64 qgroups[0];
+ __u64 qgroups[];
};
struct btrfs_ioctl_qgroup_limit_args {
__u64 qgroupid;
@@ -75,7 +79,7 @@
union {
struct {
__u64 size;
- struct btrfs_qgroup_inherit __user * qgroup_inherit;
+ struct btrfs_qgroup_inherit * qgroup_inherit;
};
__u64 unused[4];
};
@@ -176,6 +180,7 @@
#define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
#define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1)
#define BTRFS_FEATURE_COMPAT_RO_VERITY (1ULL << 2)
+#define BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE (1ULL << 3)
#define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)
#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
#define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
@@ -189,6 +194,7 @@
#define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10)
#define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11)
#define BTRFS_FEATURE_INCOMPAT_ZONED (1ULL << 12)
+#define BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2 (1ULL << 13)
struct btrfs_ioctl_feature_flags {
__u64 compat_flags;
__u64 compat_ro_flags;
@@ -294,7 +300,7 @@
__u64 offset;
__u32 type;
__u32 len;
-};
+} __attribute__((__may_alias__));
#define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
struct btrfs_ioctl_search_args {
struct btrfs_ioctl_search_key key;
@@ -303,7 +309,7 @@
struct btrfs_ioctl_search_args_v2 {
struct btrfs_ioctl_search_key key;
__u64 buf_size;
- __u64 buf[0];
+ __u64 buf[];
};
struct btrfs_ioctl_clone_range_args {
__s64 src_fd;
@@ -334,7 +340,7 @@
__u16 dest_count;
__u16 reserved1;
__u32 reserved2;
- struct btrfs_ioctl_same_extent_info info[0];
+ struct btrfs_ioctl_same_extent_info info[];
};
struct btrfs_ioctl_space_info {
__u64 flags;
@@ -344,14 +350,14 @@
struct btrfs_ioctl_space_args {
__u64 space_slots;
__u64 total_spaces;
- struct btrfs_ioctl_space_info spaces[0];
+ struct btrfs_ioctl_space_info spaces[];
};
struct btrfs_data_container {
__u32 bytes_left;
__u32 bytes_missing;
__u32 elem_cnt;
__u32 elem_missed;
- __u64 val[0];
+ __u64 val[];
};
struct btrfs_ioctl_ino_path_args {
__u64 inum;
@@ -421,11 +427,12 @@
#define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
#define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
#define BTRFS_SEND_FLAG_VERSION 0x8
-#define BTRFS_SEND_FLAG_MASK (BTRFS_SEND_FLAG_NO_FILE_DATA | BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | BTRFS_SEND_FLAG_OMIT_END_CMD | BTRFS_SEND_FLAG_VERSION)
+#define BTRFS_SEND_FLAG_COMPRESSED 0x10
+#define BTRFS_SEND_FLAG_MASK (BTRFS_SEND_FLAG_NO_FILE_DATA | BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | BTRFS_SEND_FLAG_OMIT_END_CMD | BTRFS_SEND_FLAG_VERSION | BTRFS_SEND_FLAG_COMPRESSED)
struct btrfs_ioctl_send_args {
__s64 send_fd;
__u64 clone_sources_count;
- __u64 __user * clone_sources;
+ __u64 * clone_sources;
__u64 parent_root;
__u64 flags;
__u32 version;
@@ -461,6 +468,29 @@
__u8 num_items;
__u8 align[7];
};
+struct btrfs_ioctl_encoded_io_args {
+ const struct iovec * iov;
+ unsigned long iovcnt;
+ __s64 offset;
+ __u64 flags;
+ __u64 len;
+ __u64 unencoded_len;
+ __u64 unencoded_offset;
+ __u32 compression;
+ __u32 encryption;
+ __u8 reserved[64];
+};
+#define BTRFS_ENCODED_IO_COMPRESSION_NONE 0
+#define BTRFS_ENCODED_IO_COMPRESSION_ZLIB 1
+#define BTRFS_ENCODED_IO_COMPRESSION_ZSTD 2
+#define BTRFS_ENCODED_IO_COMPRESSION_LZO_4K 3
+#define BTRFS_ENCODED_IO_COMPRESSION_LZO_8K 4
+#define BTRFS_ENCODED_IO_COMPRESSION_LZO_16K 5
+#define BTRFS_ENCODED_IO_COMPRESSION_LZO_32K 6
+#define BTRFS_ENCODED_IO_COMPRESSION_LZO_64K 7
+#define BTRFS_ENCODED_IO_COMPRESSION_TYPES 8
+#define BTRFS_ENCODED_IO_ENCRYPTION_NONE 0
+#define BTRFS_ENCODED_IO_ENCRYPTION_TYPES 1
enum btrfs_err_code {
BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1,
BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
@@ -534,4 +564,9 @@
#define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, struct btrfs_ioctl_get_subvol_rootref_args)
#define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, struct btrfs_ioctl_ino_lookup_user_args)
#define BTRFS_IOC_SNAP_DESTROY_V2 _IOW(BTRFS_IOCTL_MAGIC, 63, struct btrfs_ioctl_vol_args_v2)
+#define BTRFS_IOC_ENCODED_READ _IOR(BTRFS_IOCTL_MAGIC, 64, struct btrfs_ioctl_encoded_io_args)
+#define BTRFS_IOC_ENCODED_WRITE _IOW(BTRFS_IOCTL_MAGIC, 64, struct btrfs_ioctl_encoded_io_args)
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/libc/kernel/uapi/linux/btrfs_tree.h b/libc/kernel/uapi/linux/btrfs_tree.h
index 0476733..02422c0 100644
--- a/libc/kernel/uapi/linux/btrfs_tree.h
+++ b/libc/kernel/uapi/linux/btrfs_tree.h
@@ -21,6 +21,10 @@
#include <linux/btrfs.h>
#include <linux/types.h>
#include <stddef.h>
+#define BTRFS_MAGIC 0x4D5F53665248425FULL
+#define BTRFS_MAX_LEVEL 8
+#define BTRFS_NAME_LEN 255
+#define BTRFS_LINK_MAX 65535U
#define BTRFS_ROOT_TREE_OBJECTID 1ULL
#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
#define BTRFS_CHUNK_TREE_OBJECTID 3ULL
@@ -31,6 +35,7 @@
#define BTRFS_QUOTA_TREE_OBJECTID 8ULL
#define BTRFS_UUID_TREE_OBJECTID 9ULL
#define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL
+#define BTRFS_BLOCK_GROUP_TREE_OBJECTID 11ULL
#define BTRFS_DEV_STATS_OBJECTID 0ULL
#define BTRFS_BALANCE_OBJECTID - 4ULL
#define BTRFS_ORPHAN_OBJECTID - 5ULL
@@ -112,6 +117,23 @@
#define BTRFS_FT_SYMLINK 7
#define BTRFS_FT_XATTR 8
#define BTRFS_FT_MAX 9
+#define BTRFS_FT_ENCRYPTED 0x80
+#define BTRFS_INODE_NODATASUM (1U << 0)
+#define BTRFS_INODE_NODATACOW (1U << 1)
+#define BTRFS_INODE_READONLY (1U << 2)
+#define BTRFS_INODE_NOCOMPRESS (1U << 3)
+#define BTRFS_INODE_PREALLOC (1U << 4)
+#define BTRFS_INODE_SYNC (1U << 5)
+#define BTRFS_INODE_IMMUTABLE (1U << 6)
+#define BTRFS_INODE_APPEND (1U << 7)
+#define BTRFS_INODE_NODUMP (1U << 8)
+#define BTRFS_INODE_NOATIME (1U << 9)
+#define BTRFS_INODE_DIRSYNC (1U << 10)
+#define BTRFS_INODE_COMPRESS (1U << 11)
+#define BTRFS_INODE_ROOT_ITEM_INIT (1U << 31)
+#define BTRFS_INODE_FLAG_MASK (BTRFS_INODE_NODATASUM | BTRFS_INODE_NODATACOW | BTRFS_INODE_READONLY | BTRFS_INODE_NOCOMPRESS | BTRFS_INODE_PREALLOC | BTRFS_INODE_SYNC | BTRFS_INODE_IMMUTABLE | BTRFS_INODE_APPEND | BTRFS_INODE_NODUMP | BTRFS_INODE_NOATIME | BTRFS_INODE_DIRSYNC | BTRFS_INODE_COMPRESS | BTRFS_INODE_ROOT_ITEM_INIT)
+#define BTRFS_INODE_RO_VERITY (1U << 0)
+#define BTRFS_INODE_RO_FLAG_MASK (BTRFS_INODE_RO_VERITY)
struct btrfs_disk_key {
__le64 objectid;
__u8 type;
@@ -122,6 +144,62 @@
__u8 type;
__u64 offset;
} __attribute__((__packed__));
+struct btrfs_header {
+ __u8 csum[BTRFS_CSUM_SIZE];
+ __u8 fsid[BTRFS_FSID_SIZE];
+ __le64 bytenr;
+ __le64 flags;
+ __u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
+ __le64 generation;
+ __le64 owner;
+ __le32 nritems;
+ __u8 level;
+} __attribute__((__packed__));
+#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
+#define BTRFS_NUM_BACKUP_ROOTS 4
+struct btrfs_root_backup {
+ __le64 tree_root;
+ __le64 tree_root_gen;
+ __le64 chunk_root;
+ __le64 chunk_root_gen;
+ __le64 extent_root;
+ __le64 extent_root_gen;
+ __le64 fs_root;
+ __le64 fs_root_gen;
+ __le64 dev_root;
+ __le64 dev_root_gen;
+ __le64 csum_root;
+ __le64 csum_root_gen;
+ __le64 total_bytes;
+ __le64 bytes_used;
+ __le64 num_devices;
+ __le64 unused_64[4];
+ __u8 tree_root_level;
+ __u8 chunk_root_level;
+ __u8 extent_root_level;
+ __u8 fs_root_level;
+ __u8 dev_root_level;
+ __u8 csum_root_level;
+ __u8 unused_8[10];
+} __attribute__((__packed__));
+struct btrfs_item {
+ struct btrfs_disk_key key;
+ __le32 offset;
+ __le32 size;
+} __attribute__((__packed__));
+struct btrfs_leaf {
+ struct btrfs_header header;
+ struct btrfs_item items[];
+} __attribute__((__packed__));
+struct btrfs_key_ptr {
+ struct btrfs_disk_key key;
+ __le64 blockptr;
+ __le64 generation;
+} __attribute__((__packed__));
+struct btrfs_node {
+ struct btrfs_header header;
+ struct btrfs_key_ptr ptrs[];
+} __attribute__((__packed__));
struct btrfs_dev_item {
__le64 devid;
__le64 total_bytes;
@@ -155,6 +233,45 @@
__le16 sub_stripes;
struct btrfs_stripe stripe;
} __attribute__((__packed__));
+struct btrfs_super_block {
+ __u8 csum[BTRFS_CSUM_SIZE];
+ __u8 fsid[BTRFS_FSID_SIZE];
+ __le64 bytenr;
+ __le64 flags;
+ __le64 magic;
+ __le64 generation;
+ __le64 root;
+ __le64 chunk_root;
+ __le64 log_root;
+ __le64 __unused_log_root_transid;
+ __le64 total_bytes;
+ __le64 bytes_used;
+ __le64 root_dir_objectid;
+ __le64 num_devices;
+ __le32 sectorsize;
+ __le32 nodesize;
+ __le32 __unused_leafsize;
+ __le32 stripesize;
+ __le32 sys_chunk_array_size;
+ __le64 chunk_root_generation;
+ __le64 compat_flags;
+ __le64 compat_ro_flags;
+ __le64 incompat_flags;
+ __le16 csum_type;
+ __u8 root_level;
+ __u8 chunk_root_level;
+ __u8 log_root_level;
+ struct btrfs_dev_item dev_item;
+ char label[BTRFS_LABEL_SIZE];
+ __le64 cache_generation;
+ __le64 uuid_tree_generation;
+ __u8 metadata_uuid[BTRFS_FSID_SIZE];
+ __u64 nr_global_roots;
+ __le64 reserved[27];
+ __u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
+ struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS];
+ __u8 padding[565];
+} __attribute__((__packed__));
#define BTRFS_FREE_SPACE_EXTENT 1
#define BTRFS_FREE_SPACE_BITMAP 2
struct btrfs_free_space_entry {
@@ -187,6 +304,11 @@
#define BTRFS_EXTENT_FLAG_DATA (1ULL << 0)
#define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1)
#define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8)
+#define BTRFS_BACKREF_REV_MAX 256
+#define BTRFS_BACKREF_REV_SHIFT 56
+#define BTRFS_BACKREF_REV_MASK (((u64) BTRFS_BACKREF_REV_MAX - 1) << BTRFS_BACKREF_REV_SHIFT)
+#define BTRFS_OLD_BACKREF_REV 0
+#define BTRFS_MIXED_BACKREF_REV 1
#define BTRFS_EXTENT_FLAG_SUPER (1ULL << 48)
struct btrfs_tree_block_info {
struct btrfs_disk_key key;
@@ -220,7 +342,7 @@
__le64 parent_objectid;
__le64 index;
__le16 name_len;
- __u8 name[0];
+ __u8 name[];
} __attribute__((__packed__));
struct btrfs_timespec {
__le64 sec;
@@ -372,18 +494,6 @@
#define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
#define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
#define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | BTRFS_SPACE_INFO_GLOBAL_RSV)
-enum btrfs_raid_types {
- BTRFS_RAID_RAID10,
- BTRFS_RAID_RAID1,
- BTRFS_RAID_DUP,
- BTRFS_RAID_RAID0,
- BTRFS_RAID_SINGLE,
- BTRFS_RAID_RAID5,
- BTRFS_RAID_RAID6,
- BTRFS_RAID_RAID1C3,
- BTRFS_RAID_RAID1C4,
- BTRFS_NR_RAID_TYPES
-};
#define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_SYSTEM | BTRFS_BLOCK_GROUP_METADATA)
#define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4 | BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 | BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID10)
#define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)
@@ -405,6 +515,7 @@
#define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0)
#define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1)
#define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2)
+#define BTRFS_QGROUP_STATUS_FLAGS_MASK (BTRFS_QGROUP_STATUS_FLAG_ON | BTRFS_QGROUP_STATUS_FLAG_RESCAN | BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT)
#define BTRFS_QGROUP_STATUS_VERSION 1
struct btrfs_qgroup_status_item {
__le64 version;
diff --git a/libc/kernel/uapi/linux/byteorder/big_endian.h b/libc/kernel/uapi/linux/byteorder/big_endian.h
index b6c978b..82c5a4c 100644
--- a/libc/kernel/uapi/linux/byteorder/big_endian.h
+++ b/libc/kernel/uapi/linux/byteorder/big_endian.h
@@ -27,34 +27,34 @@
#include <linux/stddef.h>
#include <linux/types.h>
#include <linux/swab.h>
-#define __constant_htonl(x) ((__force __be32) (__u32) (x))
-#define __constant_ntohl(x) ((__force __u32) (__be32) (x))
-#define __constant_htons(x) ((__force __be16) (__u16) (x))
-#define __constant_ntohs(x) ((__force __u16) (__be16) (x))
-#define __constant_cpu_to_le64(x) ((__force __le64) ___constant_swab64((x)))
-#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64) (__le64) (x))
-#define __constant_cpu_to_le32(x) ((__force __le32) ___constant_swab32((x)))
-#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32) (__le32) (x))
-#define __constant_cpu_to_le16(x) ((__force __le16) ___constant_swab16((x)))
-#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16) (__le16) (x))
-#define __constant_cpu_to_be64(x) ((__force __be64) (__u64) (x))
-#define __constant_be64_to_cpu(x) ((__force __u64) (__be64) (x))
-#define __constant_cpu_to_be32(x) ((__force __be32) (__u32) (x))
-#define __constant_be32_to_cpu(x) ((__force __u32) (__be32) (x))
-#define __constant_cpu_to_be16(x) ((__force __be16) (__u16) (x))
-#define __constant_be16_to_cpu(x) ((__force __u16) (__be16) (x))
-#define __cpu_to_le64(x) ((__force __le64) __swab64((x)))
-#define __le64_to_cpu(x) __swab64((__force __u64) (__le64) (x))
-#define __cpu_to_le32(x) ((__force __le32) __swab32((x)))
-#define __le32_to_cpu(x) __swab32((__force __u32) (__le32) (x))
-#define __cpu_to_le16(x) ((__force __le16) __swab16((x)))
-#define __le16_to_cpu(x) __swab16((__force __u16) (__le16) (x))
-#define __cpu_to_be64(x) ((__force __be64) (__u64) (x))
-#define __be64_to_cpu(x) ((__force __u64) (__be64) (x))
-#define __cpu_to_be32(x) ((__force __be32) (__u32) (x))
-#define __be32_to_cpu(x) ((__force __u32) (__be32) (x))
-#define __cpu_to_be16(x) ((__force __be16) (__u16) (x))
-#define __be16_to_cpu(x) ((__force __u16) (__be16) (x))
+#define __constant_htonl(x) (( __be32) (__u32) (x))
+#define __constant_ntohl(x) (( __u32) (__be32) (x))
+#define __constant_htons(x) (( __be16) (__u16) (x))
+#define __constant_ntohs(x) (( __u16) (__be16) (x))
+#define __constant_cpu_to_le64(x) (( __le64) ___constant_swab64((x)))
+#define __constant_le64_to_cpu(x) ___constant_swab64(( __u64) (__le64) (x))
+#define __constant_cpu_to_le32(x) (( __le32) ___constant_swab32((x)))
+#define __constant_le32_to_cpu(x) ___constant_swab32(( __u32) (__le32) (x))
+#define __constant_cpu_to_le16(x) (( __le16) ___constant_swab16((x)))
+#define __constant_le16_to_cpu(x) ___constant_swab16(( __u16) (__le16) (x))
+#define __constant_cpu_to_be64(x) (( __be64) (__u64) (x))
+#define __constant_be64_to_cpu(x) (( __u64) (__be64) (x))
+#define __constant_cpu_to_be32(x) (( __be32) (__u32) (x))
+#define __constant_be32_to_cpu(x) (( __u32) (__be32) (x))
+#define __constant_cpu_to_be16(x) (( __be16) (__u16) (x))
+#define __constant_be16_to_cpu(x) (( __u16) (__be16) (x))
+#define __cpu_to_le64(x) (( __le64) __swab64((x)))
+#define __le64_to_cpu(x) __swab64(( __u64) (__le64) (x))
+#define __cpu_to_le32(x) (( __le32) __swab32((x)))
+#define __le32_to_cpu(x) __swab32(( __u32) (__le32) (x))
+#define __cpu_to_le16(x) (( __le16) __swab16((x)))
+#define __le16_to_cpu(x) __swab16(( __u16) (__le16) (x))
+#define __cpu_to_be64(x) (( __be64) (__u64) (x))
+#define __be64_to_cpu(x) (( __u64) (__be64) (x))
+#define __cpu_to_be32(x) (( __be32) (__u32) (x))
+#define __be32_to_cpu(x) (( __u32) (__be32) (x))
+#define __cpu_to_be16(x) (( __be16) (__u16) (x))
+#define __be16_to_cpu(x) (( __u16) (__be16) (x))
#define __cpu_to_le64s(x) __swab64s((x))
#define __le64_to_cpus(x) __swab64s((x))
#define __cpu_to_le32s(x) __swab32s((x))
diff --git a/libc/kernel/uapi/linux/byteorder/little_endian.h b/libc/kernel/uapi/linux/byteorder/little_endian.h
index a272d4d..28155b5 100644
--- a/libc/kernel/uapi/linux/byteorder/little_endian.h
+++ b/libc/kernel/uapi/linux/byteorder/little_endian.h
@@ -27,34 +27,34 @@
#include <linux/stddef.h>
#include <linux/types.h>
#include <linux/swab.h>
-#define __constant_htonl(x) ((__force __be32) ___constant_swab32((x)))
-#define __constant_ntohl(x) ___constant_swab32((__force __be32) (x))
-#define __constant_htons(x) ((__force __be16) ___constant_swab16((x)))
-#define __constant_ntohs(x) ___constant_swab16((__force __be16) (x))
-#define __constant_cpu_to_le64(x) ((__force __le64) (__u64) (x))
-#define __constant_le64_to_cpu(x) ((__force __u64) (__le64) (x))
-#define __constant_cpu_to_le32(x) ((__force __le32) (__u32) (x))
-#define __constant_le32_to_cpu(x) ((__force __u32) (__le32) (x))
-#define __constant_cpu_to_le16(x) ((__force __le16) (__u16) (x))
-#define __constant_le16_to_cpu(x) ((__force __u16) (__le16) (x))
-#define __constant_cpu_to_be64(x) ((__force __be64) ___constant_swab64((x)))
-#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64) (__be64) (x))
-#define __constant_cpu_to_be32(x) ((__force __be32) ___constant_swab32((x)))
-#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32) (__be32) (x))
-#define __constant_cpu_to_be16(x) ((__force __be16) ___constant_swab16((x)))
-#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16) (__be16) (x))
-#define __cpu_to_le64(x) ((__force __le64) (__u64) (x))
-#define __le64_to_cpu(x) ((__force __u64) (__le64) (x))
-#define __cpu_to_le32(x) ((__force __le32) (__u32) (x))
-#define __le32_to_cpu(x) ((__force __u32) (__le32) (x))
-#define __cpu_to_le16(x) ((__force __le16) (__u16) (x))
-#define __le16_to_cpu(x) ((__force __u16) (__le16) (x))
-#define __cpu_to_be64(x) ((__force __be64) __swab64((x)))
-#define __be64_to_cpu(x) __swab64((__force __u64) (__be64) (x))
-#define __cpu_to_be32(x) ((__force __be32) __swab32((x)))
-#define __be32_to_cpu(x) __swab32((__force __u32) (__be32) (x))
-#define __cpu_to_be16(x) ((__force __be16) __swab16((x)))
-#define __be16_to_cpu(x) __swab16((__force __u16) (__be16) (x))
+#define __constant_htonl(x) (( __be32) ___constant_swab32((x)))
+#define __constant_ntohl(x) ___constant_swab32(( __be32) (x))
+#define __constant_htons(x) (( __be16) ___constant_swab16((x)))
+#define __constant_ntohs(x) ___constant_swab16(( __be16) (x))
+#define __constant_cpu_to_le64(x) (( __le64) (__u64) (x))
+#define __constant_le64_to_cpu(x) (( __u64) (__le64) (x))
+#define __constant_cpu_to_le32(x) (( __le32) (__u32) (x))
+#define __constant_le32_to_cpu(x) (( __u32) (__le32) (x))
+#define __constant_cpu_to_le16(x) (( __le16) (__u16) (x))
+#define __constant_le16_to_cpu(x) (( __u16) (__le16) (x))
+#define __constant_cpu_to_be64(x) (( __be64) ___constant_swab64((x)))
+#define __constant_be64_to_cpu(x) ___constant_swab64(( __u64) (__be64) (x))
+#define __constant_cpu_to_be32(x) (( __be32) ___constant_swab32((x)))
+#define __constant_be32_to_cpu(x) ___constant_swab32(( __u32) (__be32) (x))
+#define __constant_cpu_to_be16(x) (( __be16) ___constant_swab16((x)))
+#define __constant_be16_to_cpu(x) ___constant_swab16(( __u16) (__be16) (x))
+#define __cpu_to_le64(x) (( __le64) (__u64) (x))
+#define __le64_to_cpu(x) (( __u64) (__le64) (x))
+#define __cpu_to_le32(x) (( __le32) (__u32) (x))
+#define __le32_to_cpu(x) (( __u32) (__le32) (x))
+#define __cpu_to_le16(x) (( __le16) (__u16) (x))
+#define __le16_to_cpu(x) (( __u16) (__le16) (x))
+#define __cpu_to_be64(x) (( __be64) __swab64((x)))
+#define __be64_to_cpu(x) __swab64(( __u64) (__be64) (x))
+#define __cpu_to_be32(x) (( __be32) __swab32((x)))
+#define __be32_to_cpu(x) __swab32(( __u32) (__be32) (x))
+#define __cpu_to_be16(x) (( __be16) __swab16((x)))
+#define __be16_to_cpu(x) __swab16(( __u16) (__be16) (x))
#define __cpu_to_le64s(x) do { (void) (x); } while(0)
#define __le64_to_cpus(x) do { (void) (x); } while(0)
#define __cpu_to_le32s(x) do { (void) (x); } while(0)
diff --git a/libc/kernel/uapi/linux/cachefiles.h b/libc/kernel/uapi/linux/cachefiles.h
new file mode 100644
index 0000000..f5a58a5
--- /dev/null
+++ b/libc/kernel/uapi/linux/cachefiles.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LINUX_CACHEFILES_H
+#define _LINUX_CACHEFILES_H
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#define CACHEFILES_MSG_MAX_SIZE 1024
+enum cachefiles_opcode {
+ CACHEFILES_OP_OPEN,
+ CACHEFILES_OP_CLOSE,
+ CACHEFILES_OP_READ,
+};
+struct cachefiles_msg {
+ __u32 msg_id;
+ __u32 opcode;
+ __u32 len;
+ __u32 object_id;
+ __u8 data[];
+};
+struct cachefiles_open {
+ __u32 volume_key_size;
+ __u32 cookie_key_size;
+ __u32 fd;
+ __u32 flags;
+ __u8 data[];
+};
+struct cachefiles_read {
+ __u64 off;
+ __u64 len;
+};
+#define CACHEFILES_IOC_READ_COMPLETE _IOW(0x98, 1, int)
+#endif
diff --git a/libc/kernel/uapi/linux/can.h b/libc/kernel/uapi/linux/can.h
index 30eeca2..1365dba 100644
--- a/libc/kernel/uapi/linux/can.h
+++ b/libc/kernel/uapi/linux/can.h
@@ -20,21 +20,29 @@
#define _UAPI_CAN_H
#include <linux/types.h>
#include <linux/socket.h>
+#include <linux/stddef.h>
#define CAN_EFF_FLAG 0x80000000U
#define CAN_RTR_FLAG 0x40000000U
#define CAN_ERR_FLAG 0x20000000U
#define CAN_SFF_MASK 0x000007FFU
#define CAN_EFF_MASK 0x1FFFFFFFU
#define CAN_ERR_MASK 0x1FFFFFFFU
+#define CANXL_PRIO_MASK CAN_SFF_MASK
typedef __u32 canid_t;
#define CAN_SFF_ID_BITS 11
#define CAN_EFF_ID_BITS 29
+#define CANXL_PRIO_BITS CAN_SFF_ID_BITS
typedef __u32 can_err_mask_t;
#define CAN_MAX_DLC 8
#define CAN_MAX_RAW_DLC 15
#define CAN_MAX_DLEN 8
#define CANFD_MAX_DLC 15
#define CANFD_MAX_DLEN 64
+#define CANXL_MIN_DLC 0
+#define CANXL_MAX_DLC 2047
+#define CANXL_MAX_DLC_MASK 0x07FF
+#define CANXL_MIN_DLEN 1
+#define CANXL_MAX_DLEN 2048
struct can_frame {
canid_t can_id;
union {
@@ -57,8 +65,22 @@
__u8 __res1;
__u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8)));
};
+#define CANXL_XLF 0x80
+#define CANXL_SEC 0x01
+struct canxl_frame {
+ canid_t prio;
+ __u8 flags;
+ __u8 sdt;
+ __u16 len;
+ __u32 af;
+ __u8 data[CANXL_MAX_DLEN];
+};
#define CAN_MTU (sizeof(struct can_frame))
#define CANFD_MTU (sizeof(struct canfd_frame))
+#define CANXL_MTU (sizeof(struct canxl_frame))
+#define CANXL_HDR_SIZE (offsetof(struct canxl_frame, data))
+#define CANXL_MIN_MTU (CANXL_HDR_SIZE + 64)
+#define CANXL_MAX_MTU CANXL_MTU
#define CAN_RAW 1
#define CAN_BCM 2
#define CAN_TP16 3
diff --git a/libc/kernel/uapi/linux/can/bcm.h b/libc/kernel/uapi/linux/can/bcm.h
index 42e0782..f5ab2c2 100644
--- a/libc/kernel/uapi/linux/can/bcm.h
+++ b/libc/kernel/uapi/linux/can/bcm.h
@@ -31,7 +31,7 @@
struct bcm_timeval ival1, ival2;
canid_t can_id;
__u32 nframes;
- struct can_frame frames[0];
+ struct can_frame frames[];
};
enum {
TX_SETUP = 1,
diff --git a/libc/kernel/uapi/linux/can/error.h b/libc/kernel/uapi/linux/can/error.h
index 645373b..f585d2c 100644
--- a/libc/kernel/uapi/linux/can/error.h
+++ b/libc/kernel/uapi/linux/can/error.h
@@ -28,6 +28,7 @@
#define CAN_ERR_BUSOFF 0x00000040U
#define CAN_ERR_BUSERROR 0x00000080U
#define CAN_ERR_RESTARTED 0x00000100U
+#define CAN_ERR_CNT 0x00000200U
#define CAN_ERR_LOSTARB_UNSPEC 0x00
#define CAN_ERR_CRTL_UNSPEC 0x00
#define CAN_ERR_CRTL_RX_OVERFLOW 0x01
@@ -76,4 +77,7 @@
#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60
#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70
#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80
+#define CAN_ERROR_WARNING_THRESHOLD 96
+#define CAN_ERROR_PASSIVE_THRESHOLD 128
+#define CAN_BUS_OFF_THRESHOLD 256
#endif
diff --git a/libc/kernel/uapi/linux/can/isotp.h b/libc/kernel/uapi/linux/can/isotp.h
index dd5e4f5..f51aa59 100644
--- a/libc/kernel/uapi/linux/can/isotp.h
+++ b/libc/kernel/uapi/linux/can/isotp.h
@@ -44,26 +44,28 @@
__u8 tx_dl;
__u8 tx_flags;
};
-#define CAN_ISOTP_LISTEN_MODE 0x001
-#define CAN_ISOTP_EXTEND_ADDR 0x002
-#define CAN_ISOTP_TX_PADDING 0x004
-#define CAN_ISOTP_RX_PADDING 0x008
-#define CAN_ISOTP_CHK_PAD_LEN 0x010
-#define CAN_ISOTP_CHK_PAD_DATA 0x020
-#define CAN_ISOTP_HALF_DUPLEX 0x040
-#define CAN_ISOTP_FORCE_TXSTMIN 0x080
-#define CAN_ISOTP_FORCE_RXSTMIN 0x100
-#define CAN_ISOTP_RX_EXT_ADDR 0x200
-#define CAN_ISOTP_WAIT_TX_DONE 0x400
-#define CAN_ISOTP_SF_BROADCAST 0x800
+#define CAN_ISOTP_LISTEN_MODE 0x0001
+#define CAN_ISOTP_EXTEND_ADDR 0x0002
+#define CAN_ISOTP_TX_PADDING 0x0004
+#define CAN_ISOTP_RX_PADDING 0x0008
+#define CAN_ISOTP_CHK_PAD_LEN 0x0010
+#define CAN_ISOTP_CHK_PAD_DATA 0x0020
+#define CAN_ISOTP_HALF_DUPLEX 0x0040
+#define CAN_ISOTP_FORCE_TXSTMIN 0x0080
+#define CAN_ISOTP_FORCE_RXSTMIN 0x0100
+#define CAN_ISOTP_RX_EXT_ADDR 0x0200
+#define CAN_ISOTP_WAIT_TX_DONE 0x0400
+#define CAN_ISOTP_SF_BROADCAST 0x0800
+#define CAN_ISOTP_CF_BROADCAST 0x1000
#define CAN_ISOTP_DEFAULT_FLAGS 0
#define CAN_ISOTP_DEFAULT_EXT_ADDRESS 0x00
#define CAN_ISOTP_DEFAULT_PAD_CONTENT 0xCC
-#define CAN_ISOTP_DEFAULT_FRAME_TXTIME 0
+#define CAN_ISOTP_DEFAULT_FRAME_TXTIME 50000
#define CAN_ISOTP_DEFAULT_RECV_BS 0
#define CAN_ISOTP_DEFAULT_RECV_STMIN 0x00
#define CAN_ISOTP_DEFAULT_RECV_WFTMAX 0
#define CAN_ISOTP_DEFAULT_LL_MTU CAN_MTU
#define CAN_ISOTP_DEFAULT_LL_TX_DL CAN_MAX_DLEN
#define CAN_ISOTP_DEFAULT_LL_TX_FLAGS 0
+#define CAN_ISOTP_FRAME_TXTIME_ZERO 0xFFFFFFFF
#endif
diff --git a/libc/kernel/uapi/linux/can/raw.h b/libc/kernel/uapi/linux/can/raw.h
index a3bddb7..f8de179 100644
--- a/libc/kernel/uapi/linux/can/raw.h
+++ b/libc/kernel/uapi/linux/can/raw.h
@@ -30,5 +30,6 @@
CAN_RAW_RECV_OWN_MSGS,
CAN_RAW_FD_FRAMES,
CAN_RAW_JOIN_FILTERS,
+ CAN_RAW_XL_FRAMES,
};
#endif
diff --git a/libc/kernel/uapi/linux/capability.h b/libc/kernel/uapi/linux/capability.h
index 958e6ab..8f3281e 100644
--- a/libc/kernel/uapi/linux/capability.h
+++ b/libc/kernel/uapi/linux/capability.h
@@ -28,12 +28,12 @@
typedef struct __user_cap_header_struct {
__u32 version;
int pid;
-} __user * cap_user_header_t;
+} * cap_user_header_t;
typedef struct __user_cap_data_struct {
__u32 effective;
__u32 permitted;
__u32 inheritable;
-} __user * cap_user_data_t;
+} * cap_user_data_t;
#define VFS_CAP_REVISION_MASK 0xFF000000
#define VFS_CAP_REVISION_SHIFT 24
#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
@@ -111,5 +111,5 @@
#define CAP_LAST_CAP CAP_CHECKPOINT_RESTORE
#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
#define CAP_TO_INDEX(x) ((x) >> 5)
-#define CAP_TO_MASK(x) (1 << ((x) & 31))
+#define CAP_TO_MASK(x) (1U << ((x) & 31))
#endif
diff --git a/libc/kernel/uapi/linux/capi.h b/libc/kernel/uapi/linux/capi.h
index de2a839..a09f9bc 100644
--- a/libc/kernel/uapi/linux/capi.h
+++ b/libc/kernel/uapi/linux/capi.h
@@ -51,7 +51,7 @@
#define CAPI_GET_PROFILE _IOWR('C', 0x09, struct capi_profile)
typedef struct capi_manufacturer_cmd {
unsigned long cmd;
- void __user * data;
+ void * data;
} capi_manufacturer_cmd;
#define CAPI_MANUFACTURER_CMD _IOWR('C', 0x20, struct capi_manufacturer_cmd)
#define CAPI_GET_ERRCODE _IOR('C', 0x21, __u16)
diff --git a/libc/kernel/uapi/linux/cciss_ioctl.h b/libc/kernel/uapi/linux/cciss_ioctl.h
index 3e9bb3b..827e6a0 100644
--- a/libc/kernel/uapi/linux/cciss_ioctl.h
+++ b/libc/kernel/uapi/linux/cciss_ioctl.h
@@ -47,7 +47,7 @@
RequestBlock_struct Request;
ErrorInfo_struct error_info;
WORD buf_size;
- BYTE __user * buf;
+ BYTE * buf;
} IOCTL_Command_struct;
typedef struct _BIG_IOCTL_Command_struct {
LUNAddr_struct LUN_info;
@@ -55,7 +55,7 @@
ErrorInfo_struct error_info;
DWORD malloc_size;
DWORD buf_size;
- BYTE __user * buf;
+ BYTE * buf;
} BIG_IOCTL_Command_struct;
typedef struct _LogvolInfo_struct {
__u32 LunID;
diff --git a/libc/kernel/uapi/linux/cdrom.h b/libc/kernel/uapi/linux/cdrom.h
index 0fe0727..bd1d7df 100644
--- a/libc/kernel/uapi/linux/cdrom.h
+++ b/libc/kernel/uapi/linux/cdrom.h
@@ -128,7 +128,7 @@
union cdrom_addr addr;
__u8 addr_format;
int nframes;
- __u8 __user * buf;
+ __u8 * buf;
};
struct cdrom_multisession {
union cdrom_addr addr;
@@ -149,16 +149,16 @@
#define CGC_DATA_NONE 3
struct cdrom_generic_command {
unsigned char cmd[CDROM_PACKET_SIZE];
- unsigned char __user * buffer;
+ unsigned char * buffer;
unsigned int buflen;
int stat;
- struct request_sense __user * sense;
+ struct request_sense * sense;
unsigned char data_direction;
int quiet;
int timeout;
union {
- void __user * reserved[1];
- void __user * unused;
+ void * reserved[1];
+ void * unused;
};
};
struct cdrom_timed_media_change_info {
diff --git a/libc/kernel/uapi/linux/cec.h b/libc/kernel/uapi/linux/cec.h
index b90dc49..3953fe3 100644
--- a/libc/kernel/uapi/linux/cec.h
+++ b/libc/kernel/uapi/linux/cec.h
@@ -340,6 +340,7 @@
#define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_RATE 0x08
#define CEC_OP_FEAT_DEV_SINK_HAS_ARC_TX 0x04
#define CEC_OP_FEAT_DEV_SOURCE_HAS_ARC_RX 0x02
+#define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_VOLUME_LEVEL 0x01
#define CEC_MSG_GIVE_FEATURES 0xa5
#define CEC_MSG_DECK_CONTROL 0x42
#define CEC_OP_DECK_CTL_MODE_SKIP_FWD 1
@@ -554,6 +555,7 @@
#define CEC_MSG_SYSTEM_AUDIO_MODE_STATUS 0x7e
#define CEC_OP_AUD_FMT_ID_CEA861 0
#define CEC_OP_AUD_FMT_ID_CEA861_CXT 1
+#define CEC_MSG_SET_AUDIO_VOLUME_LEVEL 0x73
#define CEC_MSG_SET_AUDIO_RATE 0x9a
#define CEC_OP_AUD_RATE_OFF 0
#define CEC_OP_AUD_RATE_WIDE_STD 1
diff --git a/libc/kernel/uapi/linux/chio.h b/libc/kernel/uapi/linux/chio.h
index 725e760..74f286f 100644
--- a/libc/kernel/uapi/linux/chio.h
+++ b/libc/kernel/uapi/linux/chio.h
@@ -71,7 +71,7 @@
#define CP_INVERT 1
struct changer_element_status {
int ces_type;
- unsigned char __user * ces_data;
+ unsigned char * ces_data;
};
#define CESTATUS_FULL 0x01
#define CESTATUS_IMPEXP 0x02
diff --git a/libc/kernel/uapi/linux/coda.h b/libc/kernel/uapi/linux/coda.h
index aad1b97..5795cdf 100644
--- a/libc/kernel/uapi/linux/coda.h
+++ b/libc/kernel/uapi/linux/coda.h
@@ -505,13 +505,13 @@
};
#define PIOCPARM_MASK 0x0000ffff
struct ViceIoctl {
- void __user * in;
- void __user * out;
+ void * in;
+ void * out;
u_short in_size;
u_short out_size;
};
struct PioctlData {
- const char __user * path;
+ const char * path;
int follow;
struct ViceIoctl vi;
};
diff --git a/libc/kernel/uapi/linux/comedi.h b/libc/kernel/uapi/linux/comedi.h
index e0d015a..465d1bf 100644
--- a/libc/kernel/uapi/linux/comedi.h
+++ b/libc/kernel/uapi/linux/comedi.h
@@ -244,14 +244,14 @@
struct comedi_insn {
unsigned int insn;
unsigned int n;
- unsigned int __user * data;
+ unsigned int * data;
unsigned int subdev;
unsigned int chanspec;
unsigned int unused[3];
};
struct comedi_insnlist {
unsigned int n_insns;
- struct comedi_insn __user * insns;
+ struct comedi_insn * insns;
};
struct comedi_cmd {
unsigned int subdev;
@@ -268,19 +268,19 @@
unsigned int stop_arg;
unsigned int * chanlist;
unsigned int chanlist_len;
- short __user * data;
+ short * data;
unsigned int data_len;
};
struct comedi_chaninfo {
unsigned int subdev;
- unsigned int __user * maxdata_list;
- unsigned int __user * flaglist;
- unsigned int __user * rangelist;
+ unsigned int * maxdata_list;
+ unsigned int * flaglist;
+ unsigned int * rangelist;
unsigned int unused[4];
};
struct comedi_rangeinfo {
unsigned int range_type;
- void __user * range_ptr;
+ void * range_ptr;
};
struct comedi_krange {
int min;
diff --git a/libc/kernel/uapi/linux/connector.h b/libc/kernel/uapi/linux/connector.h
index adf3a7f..e3891e3 100644
--- a/libc/kernel/uapi/linux/connector.h
+++ b/libc/kernel/uapi/linux/connector.h
@@ -50,6 +50,6 @@
__u32 ack;
__u16 len;
__u16 flags;
- __u8 data[0];
+ __u8 data[];
};
#endif
diff --git a/libc/kernel/uapi/linux/counter.h b/libc/kernel/uapi/linux/counter.h
index 091e33d..f986365 100644
--- a/libc/kernel/uapi/linux/counter.h
+++ b/libc/kernel/uapi/linux/counter.h
@@ -45,6 +45,8 @@
COUNTER_EVENT_OVERFLOW_UNDERFLOW,
COUNTER_EVENT_THRESHOLD,
COUNTER_EVENT_INDEX,
+ COUNTER_EVENT_CHANGE_OF_STATE,
+ COUNTER_EVENT_CAPTURE,
};
struct counter_watch {
struct counter_component component;
@@ -90,4 +92,8 @@
COUNTER_SYNAPSE_ACTION_FALLING_EDGE,
COUNTER_SYNAPSE_ACTION_BOTH_EDGES,
};
+enum counter_signal_polarity {
+ COUNTER_SIGNAL_POLARITY_POSITIVE,
+ COUNTER_SIGNAL_POLARITY_NEGATIVE,
+};
#endif
diff --git a/libc/kernel/uapi/linux/cxl_mem.h b/libc/kernel/uapi/linux/cxl_mem.h
index 15e9e29..c94af87 100644
--- a/libc/kernel/uapi/linux/cxl_mem.h
+++ b/libc/kernel/uapi/linux/cxl_mem.h
@@ -38,13 +38,13 @@
__u32 id;
__u32 flags;
#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(0, 0)
- __s32 size_in;
- __s32 size_out;
+ __u32 size_in;
+ __u32 size_out;
};
struct cxl_mem_query_commands {
__u32 n_commands;
__u32 rsvd;
- struct cxl_command_info __user commands[];
+ struct cxl_command_info commands[];
};
struct cxl_send_command {
__u32 id;
@@ -58,12 +58,12 @@
};
__u32 retval;
struct {
- __s32 size;
+ __u32 size;
__u32 rsvd;
__u64 payload;
} in;
struct {
- __s32 size;
+ __u32 size;
__u32 rsvd;
__u64 payload;
} out;
diff --git a/libc/kernel/uapi/linux/cycx_cfm.h b/libc/kernel/uapi/linux/cycx_cfm.h
index 052de53..230b58d 100644
--- a/libc/kernel/uapi/linux/cycx_cfm.h
+++ b/libc/kernel/uapi/linux/cycx_cfm.h
@@ -53,7 +53,7 @@
unsigned short reserved[6];
char descr[CFM_DESCR_LEN];
struct cycx_fw_info info;
- unsigned char image[0];
+ unsigned char image[];
};
struct cycx_fw_header {
unsigned long reset_size;
diff --git a/libc/kernel/uapi/linux/dcbnl.h b/libc/kernel/uapi/linux/dcbnl.h
index d1f2eba..bc88387 100644
--- a/libc/kernel/uapi/linux/dcbnl.h
+++ b/libc/kernel/uapi/linux/dcbnl.h
@@ -99,11 +99,13 @@
#define IEEE_8021QAZ_APP_SEL_DGRAM 3
#define IEEE_8021QAZ_APP_SEL_ANY 4
#define IEEE_8021QAZ_APP_SEL_DSCP 5
+#define DCB_APP_SEL_PCP 255
struct dcb_app {
__u8 selector;
__u8 priority;
__u16 protocol;
};
+#define IEEE_8021QAZ_APP_SEL_MAX 255
struct dcb_peer_app_info {
__u8 willing;
__u8 error;
@@ -178,12 +180,14 @@
DCB_ATTR_IEEE_QCN,
DCB_ATTR_IEEE_QCN_STATS,
DCB_ATTR_DCB_BUFFER,
+ DCB_ATTR_DCB_APP_TRUST_TABLE,
__DCB_ATTR_IEEE_MAX
};
#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
enum ieee_attrs_app {
DCB_ATTR_IEEE_APP_UNSPEC,
DCB_ATTR_IEEE_APP,
+ DCB_ATTR_DCB_APP,
__DCB_ATTR_IEEE_APP_MAX
};
#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/devlink.h b/libc/kernel/uapi/linux/devlink.h
index a809306..b7705c3 100644
--- a/libc/kernel/uapi/linux/devlink.h
+++ b/libc/kernel/uapi/linux/devlink.h
@@ -103,6 +103,12 @@
DEVLINK_CMD_RATE_SET,
DEVLINK_CMD_RATE_NEW,
DEVLINK_CMD_RATE_DEL,
+ DEVLINK_CMD_LINECARD_GET,
+ DEVLINK_CMD_LINECARD_SET,
+ DEVLINK_CMD_LINECARD_NEW,
+ DEVLINK_CMD_LINECARD_DEL,
+ DEVLINK_CMD_SELFTESTS_GET,
+ DEVLINK_CMD_SELFTESTS_RUN,
__DEVLINK_CMD_MAX,
DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
};
@@ -184,6 +190,25 @@
#define DEVLINK_FLASH_OVERWRITE_SETTINGS _BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT)
#define DEVLINK_FLASH_OVERWRITE_IDENTIFIERS _BITUL(DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT)
#define DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS (_BITUL(__DEVLINK_FLASH_OVERWRITE_MAX_BIT) - 1)
+enum devlink_attr_selftest_id {
+ DEVLINK_ATTR_SELFTEST_ID_UNSPEC,
+ DEVLINK_ATTR_SELFTEST_ID_FLASH,
+ __DEVLINK_ATTR_SELFTEST_ID_MAX,
+ DEVLINK_ATTR_SELFTEST_ID_MAX = __DEVLINK_ATTR_SELFTEST_ID_MAX - 1
+};
+enum devlink_selftest_status {
+ DEVLINK_SELFTEST_STATUS_SKIP,
+ DEVLINK_SELFTEST_STATUS_PASS,
+ DEVLINK_SELFTEST_STATUS_FAIL
+};
+enum devlink_attr_selftest_result {
+ DEVLINK_ATTR_SELFTEST_RESULT_UNSPEC,
+ DEVLINK_ATTR_SELFTEST_RESULT,
+ DEVLINK_ATTR_SELFTEST_RESULT_ID,
+ DEVLINK_ATTR_SELFTEST_RESULT_STATUS,
+ __DEVLINK_ATTR_SELFTEST_RESULT_MAX,
+ DEVLINK_ATTR_SELFTEST_RESULT_MAX = __DEVLINK_ATTR_SELFTEST_RESULT_MAX - 1
+};
enum devlink_trap_action {
DEVLINK_TRAP_ACTION_DROP,
DEVLINK_TRAP_ACTION_TRAP,
@@ -212,6 +237,17 @@
DEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1
};
#define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1)
+enum devlink_linecard_state {
+ DEVLINK_LINECARD_STATE_UNSPEC,
+ DEVLINK_LINECARD_STATE_UNPROVISIONED,
+ DEVLINK_LINECARD_STATE_UNPROVISIONING,
+ DEVLINK_LINECARD_STATE_PROVISIONING,
+ DEVLINK_LINECARD_STATE_PROVISIONING_FAILED,
+ DEVLINK_LINECARD_STATE_PROVISIONED,
+ DEVLINK_LINECARD_STATE_ACTIVE,
+ __DEVLINK_LINECARD_STATE_MAX,
+ DEVLINK_LINECARD_STATE_MAX = __DEVLINK_LINECARD_STATE_MAX - 1
+};
enum devlink_attr {
DEVLINK_ATTR_UNSPEC,
DEVLINK_ATTR_BUS_NAME,
@@ -384,6 +420,15 @@
DEVLINK_ATTR_RATE_NODE_NAME,
DEVLINK_ATTR_RATE_PARENT_NODE_NAME,
DEVLINK_ATTR_REGION_MAX_SNAPSHOTS,
+ DEVLINK_ATTR_LINECARD_INDEX,
+ DEVLINK_ATTR_LINECARD_STATE,
+ DEVLINK_ATTR_LINECARD_TYPE,
+ DEVLINK_ATTR_LINECARD_SUPPORTED_TYPES,
+ DEVLINK_ATTR_NESTED_DEVLINK,
+ DEVLINK_ATTR_SELFTESTS,
+ DEVLINK_ATTR_RATE_TX_PRIORITY,
+ DEVLINK_ATTR_RATE_TX_WEIGHT,
+ DEVLINK_ATTR_REGION_DIRECT,
__DEVLINK_ATTR_MAX,
DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
};
@@ -414,11 +459,19 @@
enum devlink_resource_unit {
DEVLINK_RESOURCE_UNIT_ENTRY,
};
+enum devlink_port_fn_attr_cap {
+ DEVLINK_PORT_FN_ATTR_CAP_ROCE_BIT,
+ DEVLINK_PORT_FN_ATTR_CAP_MIGRATABLE_BIT,
+ __DEVLINK_PORT_FN_ATTR_CAPS_MAX,
+};
+#define DEVLINK_PORT_FN_CAP_ROCE _BITUL(DEVLINK_PORT_FN_ATTR_CAP_ROCE_BIT)
+#define DEVLINK_PORT_FN_CAP_MIGRATABLE _BITUL(DEVLINK_PORT_FN_ATTR_CAP_MIGRATABLE_BIT)
enum devlink_port_function_attr {
DEVLINK_PORT_FUNCTION_ATTR_UNSPEC,
DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR,
DEVLINK_PORT_FN_ATTR_STATE,
DEVLINK_PORT_FN_ATTR_OPSTATE,
+ DEVLINK_PORT_FN_ATTR_CAPS,
__DEVLINK_PORT_FUNCTION_ATTR_MAX,
DEVLINK_PORT_FUNCTION_ATTR_MAX = __DEVLINK_PORT_FUNCTION_ATTR_MAX - 1
};
diff --git a/libc/kernel/uapi/linux/dlm.h b/libc/kernel/uapi/linux/dlm.h
index c75918f..499baad 100644
--- a/libc/kernel/uapi/linux/dlm.h
+++ b/libc/kernel/uapi/linux/dlm.h
@@ -31,6 +31,5 @@
char * sb_lvbptr;
};
#define DLM_LSFL_TIMEWARN 0x00000002
-#define DLM_LSFL_FS 0x00000004
#define DLM_LSFL_NEWEXCL 0x00000008
#endif
diff --git a/libc/kernel/uapi/linux/dlm_device.h b/libc/kernel/uapi/linux/dlm_device.h
index 5e54d2e..e1b0c6d 100644
--- a/libc/kernel/uapi/linux/dlm_device.h
+++ b/libc/kernel/uapi/linux/dlm_device.h
@@ -33,11 +33,11 @@
__u32 parent;
__u64 xid;
__u64 timeout;
- void __user * castparam;
- void __user * castaddr;
- void __user * bastparam;
- void __user * bastaddr;
- struct dlm_lksb __user * lksb;
+ void * castparam;
+ void * castaddr;
+ void * bastparam;
+ void * bastaddr;
+ struct dlm_lksb * lksb;
char lvb[DLM_USER_LVB_LEN];
char name[];
};
@@ -67,9 +67,9 @@
struct dlm_lock_result {
__u32 version[3];
__u32 length;
- void __user * user_astaddr;
- void __user * user_astparam;
- struct dlm_lksb __user * user_lksb;
+ void * user_astaddr;
+ void * user_astparam;
+ struct dlm_lksb * user_lksb;
struct dlm_lksb lksb;
__u8 bast_mode;
__u8 unused[3];
diff --git a/libc/kernel/uapi/linux/dm-ioctl.h b/libc/kernel/uapi/linux/dm-ioctl.h
index 09f8a98..f0ff78c 100644
--- a/libc/kernel/uapi/linux/dm-ioctl.h
+++ b/libc/kernel/uapi/linux/dm-ioctl.h
@@ -48,23 +48,23 @@
struct dm_target_deps {
__u32 count;
__u32 padding;
- __u64 dev[0];
+ __u64 dev[];
};
struct dm_name_list {
__u64 dev;
__u32 next;
- char name[0];
+ char name[];
};
#define DM_NAME_LIST_FLAG_HAS_UUID 1
#define DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID 2
struct dm_target_versions {
__u32 next;
__u32 version[3];
- char name[0];
+ char name[];
};
struct dm_target_msg {
__u64 sector;
- char message[0];
+ char message[];
};
enum {
DM_VERSION_CMD = 0,
@@ -106,9 +106,9 @@
#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 45
+#define DM_VERSION_MINOR 47
#define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl(2021-03-22)"
+#define DM_VERSION_EXTRA "-ioctl(2022-07-28)"
#define DM_READONLY_FLAG (1 << 0)
#define DM_SUSPEND_FLAG (1 << 1)
#define DM_PERSISTENT_DEV_FLAG (1 << 3)
diff --git a/libc/kernel/uapi/linux/dm-log-userspace.h b/libc/kernel/uapi/linux/dm-log-userspace.h
index 4f0671b..37feee6 100644
--- a/libc/kernel/uapi/linux/dm-log-userspace.h
+++ b/libc/kernel/uapi/linux/dm-log-userspace.h
@@ -49,6 +49,6 @@
__u32 seq;
__u32 request_type;
__u32 data_size;
- char data[0];
+ char data[];
};
#endif
diff --git a/libc/kernel/uapi/linux/dma-buf.h b/libc/kernel/uapi/linux/dma-buf.h
index 221c20f..7462c15 100644
--- a/libc/kernel/uapi/linux/dma-buf.h
+++ b/libc/kernel/uapi/linux/dma-buf.h
@@ -29,9 +29,19 @@
#define DMA_BUF_SYNC_END (1 << 2)
#define DMA_BUF_SYNC_VALID_FLAGS_MASK (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)
#define DMA_BUF_NAME_LEN 32
+struct dma_buf_export_sync_file {
+ __u32 flags;
+ __s32 fd;
+};
+struct dma_buf_import_sync_file {
+ __u32 flags;
+ __s32 fd;
+};
#define DMA_BUF_BASE 'b'
#define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
#define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
-#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
-#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
+#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, __u32)
+#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, __u64)
+#define DMA_BUF_IOCTL_EXPORT_SYNC_FILE _IOWR(DMA_BUF_BASE, 2, struct dma_buf_export_sync_file)
+#define DMA_BUF_IOCTL_IMPORT_SYNC_FILE _IOW(DMA_BUF_BASE, 3, struct dma_buf_import_sync_file)
#endif
diff --git a/libc/kernel/uapi/linux/dn.h b/libc/kernel/uapi/linux/dn.h
deleted file mode 100644
index 621f60f..0000000
--- a/libc/kernel/uapi/linux/dn.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _LINUX_DN_H
-#define _LINUX_DN_H
-#include <linux/ioctl.h>
-#include <linux/types.h>
-#include <linux/if_ether.h>
-#define DNPROTO_NSP 2
-#define DNPROTO_ROU 3
-#define DNPROTO_NML 4
-#define DNPROTO_EVL 5
-#define DNPROTO_EVR 6
-#define DNPROTO_NSPT 7
-#define DN_ADDL 2
-#define DN_MAXADDL 2
-#define DN_MAXOPTL 16
-#define DN_MAXOBJL 16
-#define DN_MAXACCL 40
-#define DN_MAXALIASL 128
-#define DN_MAXNODEL 256
-#define DNBUFSIZE 65023
-#define SO_CONDATA 1
-#define SO_CONACCESS 2
-#define SO_PROXYUSR 3
-#define SO_LINKINFO 7
-#define DSO_CONDATA 1
-#define DSO_DISDATA 10
-#define DSO_CONACCESS 2
-#define DSO_ACCEPTMODE 4
-#define DSO_CONACCEPT 5
-#define DSO_CONREJECT 6
-#define DSO_LINKINFO 7
-#define DSO_STREAM 8
-#define DSO_SEQPACKET 9
-#define DSO_MAXWINDOW 11
-#define DSO_NODELAY 12
-#define DSO_CORK 13
-#define DSO_SERVICES 14
-#define DSO_INFO 15
-#define DSO_MAX 15
-#define LL_INACTIVE 0
-#define LL_CONNECTING 1
-#define LL_RUNNING 2
-#define LL_DISCONNECTING 3
-#define ACC_IMMED 0
-#define ACC_DEFER 1
-#define SDF_WILD 1
-#define SDF_PROXY 2
-#define SDF_UICPROXY 4
-struct dn_naddr {
- __le16 a_len;
- __u8 a_addr[DN_MAXADDL];
-};
-struct sockaddr_dn {
- __u16 sdn_family;
- __u8 sdn_flags;
- __u8 sdn_objnum;
- __le16 sdn_objnamel;
- __u8 sdn_objname[DN_MAXOBJL];
- struct dn_naddr sdn_add;
-};
-#define sdn_nodeaddrl sdn_add.a_len
-#define sdn_nodeaddr sdn_add.a_addr
-struct optdata_dn {
- __le16 opt_status;
-#define opt_sts opt_status
- __le16 opt_optl;
- __u8 opt_data[16];
-};
-struct accessdata_dn {
- __u8 acc_accl;
- __u8 acc_acc[DN_MAXACCL];
- __u8 acc_passl;
- __u8 acc_pass[DN_MAXACCL];
- __u8 acc_userl;
- __u8 acc_user[DN_MAXACCL];
-};
-struct linkinfo_dn {
- __u16 idn_segsize;
- __u8 idn_linkstate;
-};
-union etheraddress {
- __u8 dne_addr[ETH_ALEN];
- struct {
- __u8 dne_hiord[4];
- __u8 dne_nodeaddr[2];
- } dne_remote;
-};
-struct dn_addr {
- __le16 dna_family;
- union etheraddress dna_netaddr;
-};
-#define DECNET_IOCTL_BASE 0x89
-#define SIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, struct dn_naddr)
-#define SIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, struct dn_naddr)
-#define OSIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, int)
-#define OSIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, int)
-#endif
diff --git a/libc/kernel/uapi/linux/dns_resolver.h b/libc/kernel/uapi/linux/dns_resolver.h
index 21cb5c0..e7113d0 100644
--- a/libc/kernel/uapi/linux/dns_resolver.h
+++ b/libc/kernel/uapi/linux/dns_resolver.h
@@ -55,13 +55,13 @@
__u8 zero;
__u8 content;
__u8 version;
-} __packed;
+} __attribute__((__packed__));
struct dns_server_list_v1_header {
struct dns_payload_header hdr;
__u8 source;
__u8 status;
__u8 nr_servers;
-} __packed;
+} __attribute__((__packed__));
struct dns_server_list_v1_server {
__u16 name_len;
__u16 priority;
@@ -71,8 +71,8 @@
__u8 status;
__u8 protocol;
__u8 nr_addrs;
-} __packed;
+} __attribute__((__packed__));
struct dns_server_list_v1_address {
__u8 address_type;
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/linux/dvb/frontend.h b/libc/kernel/uapi/linux/dvb/frontend.h
index d060138..2ea7d9d 100644
--- a/libc/kernel/uapi/linux/dvb/frontend.h
+++ b/libc/kernel/uapi/linux/dvb/frontend.h
@@ -122,6 +122,22 @@
FEC_3_5,
FEC_9_10,
FEC_2_5,
+ FEC_1_3,
+ FEC_1_4,
+ FEC_5_9,
+ FEC_7_9,
+ FEC_8_15,
+ FEC_11_15,
+ FEC_13_18,
+ FEC_9_20,
+ FEC_11_20,
+ FEC_23_36,
+ FEC_25_36,
+ FEC_13_45,
+ FEC_26_45,
+ FEC_28_45,
+ FEC_32_45,
+ FEC_77_90,
};
enum fe_modulation {
QPSK,
@@ -138,6 +154,13 @@
APSK_32,
DQPSK,
QAM_4_NR,
+ QAM_1024,
+ QAM_4096,
+ APSK_8_L,
+ APSK_16_L,
+ APSK_32_L,
+ APSK_64,
+ APSK_64_L,
};
enum fe_transmit_mode {
TRANSMISSION_MODE_2K,
@@ -162,6 +185,7 @@
GUARD_INTERVAL_PN420,
GUARD_INTERVAL_PN595,
GUARD_INTERVAL_PN945,
+ GUARD_INTERVAL_1_64,
};
enum fe_hierarchy {
HIERARCHY_NONE,
@@ -259,6 +283,9 @@
ROLLOFF_20,
ROLLOFF_25,
ROLLOFF_AUTO,
+ ROLLOFF_15,
+ ROLLOFF_10,
+ ROLLOFF_5,
};
enum fe_delivery_system {
SYS_UNDEFINED,
@@ -280,6 +307,7 @@
SYS_DVBT2,
SYS_TURBO,
SYS_DVBC_ANNEX_C,
+ SYS_DVBC2,
};
#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A
#define SYS_DMBTH SYS_DTMB
diff --git a/libc/kernel/uapi/linux/dvb/osd.h b/libc/kernel/uapi/linux/dvb/osd.h
index 84b268b..379294e 100644
--- a/libc/kernel/uapi/linux/dvb/osd.h
+++ b/libc/kernel/uapi/linux/dvb/osd.h
@@ -50,7 +50,7 @@
int x1;
int y1;
int color;
- void __user * data;
+ void * data;
} osd_cmd_t;
typedef enum {
OSD_BITMAP1,
diff --git a/libc/kernel/uapi/linux/dvb/video.h b/libc/kernel/uapi/linux/dvb/video.h
index 6577e1f..2458766 100644
--- a/libc/kernel/uapi/linux/dvb/video.h
+++ b/libc/kernel/uapi/linux/dvb/video.h
@@ -94,7 +94,7 @@
video_displayformat_t display_format;
};
struct video_still_picture {
- char __user * iFrame;
+ char * iFrame;
__s32 size;
};
typedef __u16 video_attributes_t;
diff --git a/libc/kernel/uapi/linux/dw100.h b/libc/kernel/uapi/linux/dw100.h
new file mode 100644
index 0000000..13d8487
--- /dev/null
+++ b/libc/kernel/uapi/linux/dw100.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __UAPI_DW100_H__
+#define __UAPI_DW100_H__
+#include <linux/v4l2-controls.h>
+#define V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP (V4L2_CID_USER_DW100_BASE + 1)
+#endif
diff --git a/libc/kernel/uapi/linux/elf-em.h b/libc/kernel/uapi/linux/elf-em.h
index d1ed1f6..92da93d 100644
--- a/libc/kernel/uapi/linux/elf-em.h
+++ b/libc/kernel/uapi/linux/elf-em.h
@@ -61,6 +61,7 @@
#define EM_RISCV 243
#define EM_BPF 247
#define EM_CSKY 252
+#define EM_LOONGARCH 258
#define EM_FRV 0x5441
#define EM_ALPHA 0x9026
#define EM_CYGNUS_M32R 0x9041
diff --git a/libc/kernel/uapi/linux/elf.h b/libc/kernel/uapi/linux/elf.h
index 7655f12..28c8426 100644
--- a/libc/kernel/uapi/linux/elf.h
+++ b/libc/kernel/uapi/linux/elf.h
@@ -45,9 +45,11 @@
#define PT_HIOS 0x6fffffff
#define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff
-#define PT_GNU_EH_FRAME 0x6474e550
-#define PT_GNU_PROPERTY 0x6474e553
+#define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550)
#define PT_GNU_STACK (PT_LOOS + 0x474e551)
+#define PT_GNU_RELRO (PT_LOOS + 0x474e552)
+#define PT_GNU_PROPERTY (PT_LOOS + 0x474e553)
+#define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 0x2)
#define PN_XNUM 0xffff
#define ET_NONE 0
#define ET_REL 1
@@ -110,7 +112,7 @@
#define STT_COMMON 5
#define STT_TLS 6
#define ELF_ST_BIND(x) ((x) >> 4)
-#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
+#define ELF_ST_TYPE(x) ((x) & 0xf)
#define ELF32_ST_BIND(x) ELF_ST_BIND(x)
#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
@@ -350,6 +352,7 @@
#define NT_S390_GS_CB 0x30b
#define NT_S390_GS_BC 0x30c
#define NT_S390_RI_CB 0x30d
+#define NT_S390_PV_CPU_DATA 0x30e
#define NT_ARM_VFP 0x400
#define NT_ARM_TLS 0x401
#define NT_ARM_HW_BREAK 0x402
@@ -361,11 +364,18 @@
#define NT_ARM_PACG_KEYS 0x408
#define NT_ARM_TAGGED_ADDR_CTRL 0x409
#define NT_ARM_PAC_ENABLED_KEYS 0x40a
+#define NT_ARM_SSVE 0x40b
+#define NT_ARM_ZA 0x40c
#define NT_ARC_V2 0x600
#define NT_VMCOREDD 0x700
#define NT_MIPS_DSP 0x800
#define NT_MIPS_FP_MODE 0x801
#define NT_MIPS_MSA 0x802
+#define NT_LOONGARCH_CPUCFG 0xa00
+#define NT_LOONGARCH_CSR 0xa01
+#define NT_LOONGARCH_LSX 0xa02
+#define NT_LOONGARCH_LASX 0xa03
+#define NT_LOONGARCH_LBT 0xa04
#define NT_GNU_PROPERTY_TYPE_0 5
typedef struct elf32_note {
Elf32_Word n_namesz;
diff --git a/libc/kernel/uapi/linux/ethtool.h b/libc/kernel/uapi/linux/ethtool.h
index 741ea2a..a58be6f 100644
--- a/libc/kernel/uapi/linux/ethtool.h
+++ b/libc/kernel/uapi/linux/ethtool.h
@@ -98,7 +98,7 @@
__u32 id;
__u32 type_id;
__u32 len;
- void * data[0];
+ void * data[];
};
#define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff
#define DOWNSHIFT_DEV_DISABLE 0
@@ -118,14 +118,14 @@
__u32 cmd;
__u32 version;
__u32 len;
- __u8 data[0];
+ __u8 data[];
};
struct ethtool_eeprom {
__u32 cmd;
__u32 magic;
__u32 offset;
__u32 len;
- __u8 data[0];
+ __u8 data[];
};
struct ethtool_eee {
__u32 cmd;
@@ -277,17 +277,31 @@
ETHTOOL_MODULE_POWER_MODE_LOW = 1,
ETHTOOL_MODULE_POWER_MODE_HIGH,
};
+enum ethtool_podl_pse_admin_state {
+ ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN = 1,
+ ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED,
+ ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED,
+};
+enum ethtool_podl_pse_pw_d_status {
+ ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN = 1,
+ ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED,
+ ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING,
+ ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING,
+ ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP,
+ ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE,
+ ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR,
+};
struct ethtool_gstrings {
__u32 cmd;
__u32 string_set;
__u32 len;
- __u8 data[0];
+ __u8 data[];
};
struct ethtool_sset_info {
__u32 cmd;
__u32 reserved;
__u64 sset_mask;
- __u32 data[0];
+ __u32 data[];
};
enum ethtool_test_flags {
ETH_TEST_FL_OFFLINE = (1 << 0),
@@ -300,17 +314,17 @@
__u32 flags;
__u32 reserved;
__u32 len;
- __u64 data[0];
+ __u64 data[];
};
struct ethtool_stats {
__u32 cmd;
__u32 n_stats;
- __u64 data[0];
+ __u64 data[];
};
struct ethtool_perm_addr {
__u32 cmd;
__u32 size;
- __u8 data[0];
+ __u8 data[];
};
enum ethtool_flags {
ETH_FLAG_TXVLAN = (1 << 7),
@@ -410,7 +424,7 @@
struct ethtool_rxfh_indir {
__u32 cmd;
__u32 size;
- __u32 ring_index[0];
+ __u32 ring_index[];
};
struct ethtool_rxfh {
__u32 cmd;
@@ -420,7 +434,7 @@
__u8 hfunc;
__u8 rsvd8[3];
__u32 rsvd32;
- __u32 rss_config[0];
+ __u32 rss_config[];
};
#define ETH_RXFH_CONTEXT_ALLOC 0xffffffff
#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
@@ -462,7 +476,7 @@
__u32 version;
__u32 flag;
__u32 len;
- __u8 data[0];
+ __u8 data[];
};
#define ETH_FW_DUMP_DISABLE 0
struct ethtool_get_features_block {
@@ -474,7 +488,7 @@
struct ethtool_gfeatures {
__u32 cmd;
__u32 size;
- struct ethtool_get_features_block features[0];
+ struct ethtool_get_features_block features[];
};
struct ethtool_set_features_block {
__u32 valid;
@@ -483,7 +497,7 @@
struct ethtool_sfeatures {
__u32 cmd;
__u32 size;
- struct ethtool_set_features_block features[0];
+ struct ethtool_set_features_block features[];
};
struct ethtool_ts_info {
__u32 cmd;
@@ -704,6 +718,13 @@
ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89,
ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90,
ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91,
+ ETHTOOL_LINK_MODE_10baseT1L_Full_BIT = 92,
+ ETHTOOL_LINK_MODE_800000baseCR8_Full_BIT = 93,
+ ETHTOOL_LINK_MODE_800000baseKR8_Full_BIT = 94,
+ ETHTOOL_LINK_MODE_800000baseDR8_Full_BIT = 95,
+ ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT = 96,
+ ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT = 97,
+ ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT = 98,
__ETHTOOL_LINK_MODE_MASK_NBITS
};
#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) (1UL << (ETHTOOL_LINK_MODE_ ##base_name ##_BIT))
@@ -784,6 +805,7 @@
#define SPEED_100000 100000
#define SPEED_200000 200000
#define SPEED_400000 400000
+#define SPEED_800000 800000
#define SPEED_UNKNOWN - 1
#define DUPLEX_HALF 0x00
#define DUPLEX_FULL 0x01
@@ -799,6 +821,10 @@
#define MASTER_SLAVE_STATE_MASTER 2
#define MASTER_SLAVE_STATE_SLAVE 3
#define MASTER_SLAVE_STATE_ERR 4
+#define RATE_MATCH_NONE 0
+#define RATE_MATCH_PAUSE 1
+#define RATE_MATCH_CRS 2
+#define RATE_MATCH_OPEN_LOOP 3
#define PORT_TP 0x00
#define PORT_AUI 0x01
#define PORT_MII 0x02
@@ -900,8 +926,8 @@
__u8 transceiver;
__u8 master_slave_cfg;
__u8 master_slave_state;
- __u8 reserved1[1];
+ __u8 rate_matching;
__u32 reserved[7];
- __u32 link_mode_masks[0];
+ __u32 link_mode_masks[];
};
#endif
diff --git a/libc/kernel/uapi/linux/ethtool_netlink.h b/libc/kernel/uapi/linux/ethtool_netlink.h
index 7dcae22..cc9c53c 100644
--- a/libc/kernel/uapi/linux/ethtool_netlink.h
+++ b/libc/kernel/uapi/linux/ethtool_netlink.h
@@ -56,6 +56,9 @@
ETHTOOL_MSG_PHC_VCLOCKS_GET,
ETHTOOL_MSG_MODULE_GET,
ETHTOOL_MSG_MODULE_SET,
+ ETHTOOL_MSG_PSE_GET,
+ ETHTOOL_MSG_PSE_SET,
+ ETHTOOL_MSG_RSS_GET,
__ETHTOOL_MSG_USER_CNT,
ETHTOOL_MSG_USER_MAX = __ETHTOOL_MSG_USER_CNT - 1
};
@@ -97,6 +100,8 @@
ETHTOOL_MSG_PHC_VCLOCKS_GET_REPLY,
ETHTOOL_MSG_MODULE_GET_REPLY,
ETHTOOL_MSG_MODULE_NTF,
+ ETHTOOL_MSG_PSE_GET_REPLY,
+ ETHTOOL_MSG_RSS_GET_REPLY,
__ETHTOOL_MSG_KERNEL_CNT,
ETHTOOL_MSG_KERNEL_MAX = __ETHTOOL_MSG_KERNEL_CNT - 1
};
@@ -193,6 +198,7 @@
ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG,
ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE,
ETHTOOL_A_LINKMODES_LANES,
+ ETHTOOL_A_LINKMODES_RATE_MATCHING,
__ETHTOOL_A_LINKMODES_CNT,
ETHTOOL_A_LINKMODES_MAX = __ETHTOOL_A_LINKMODES_CNT - 1
};
@@ -204,6 +210,7 @@
ETHTOOL_A_LINKSTATE_SQI_MAX,
ETHTOOL_A_LINKSTATE_EXT_STATE,
ETHTOOL_A_LINKSTATE_EXT_SUBSTATE,
+ ETHTOOL_A_LINKSTATE_EXT_DOWN_CNT,
__ETHTOOL_A_LINKSTATE_CNT,
ETHTOOL_A_LINKSTATE_MAX = __ETHTOOL_A_LINKSTATE_CNT - 1
};
@@ -240,6 +247,11 @@
ETHTOOL_A_PRIVFLAGS_MAX = __ETHTOOL_A_PRIVFLAGS_CNT - 1
};
enum {
+ ETHTOOL_TCP_DATA_SPLIT_UNKNOWN = 0,
+ ETHTOOL_TCP_DATA_SPLIT_DISABLED,
+ ETHTOOL_TCP_DATA_SPLIT_ENABLED,
+};
+enum {
ETHTOOL_A_RINGS_UNSPEC,
ETHTOOL_A_RINGS_HEADER,
ETHTOOL_A_RINGS_RX_MAX,
@@ -251,6 +263,9 @@
ETHTOOL_A_RINGS_RX_JUMBO,
ETHTOOL_A_RINGS_TX,
ETHTOOL_A_RINGS_RX_BUF_LEN,
+ ETHTOOL_A_RINGS_TCP_DATA_SPLIT,
+ ETHTOOL_A_RINGS_CQE_SIZE,
+ ETHTOOL_A_RINGS_TX_PUSH,
__ETHTOOL_A_RINGS_CNT,
ETHTOOL_A_RINGS_MAX = (__ETHTOOL_A_RINGS_CNT - 1)
};
@@ -601,6 +616,25 @@
__ETHTOOL_A_MODULE_CNT,
ETHTOOL_A_MODULE_MAX = (__ETHTOOL_A_MODULE_CNT - 1)
};
+enum {
+ ETHTOOL_A_PSE_UNSPEC,
+ ETHTOOL_A_PSE_HEADER,
+ ETHTOOL_A_PODL_PSE_ADMIN_STATE,
+ ETHTOOL_A_PODL_PSE_ADMIN_CONTROL,
+ ETHTOOL_A_PODL_PSE_PW_D_STATUS,
+ __ETHTOOL_A_PSE_CNT,
+ ETHTOOL_A_PSE_MAX = (__ETHTOOL_A_PSE_CNT - 1)
+};
+enum {
+ ETHTOOL_A_RSS_UNSPEC,
+ ETHTOOL_A_RSS_HEADER,
+ ETHTOOL_A_RSS_CONTEXT,
+ ETHTOOL_A_RSS_HFUNC,
+ ETHTOOL_A_RSS_INDIR,
+ ETHTOOL_A_RSS_HKEY,
+ __ETHTOOL_A_RSS_CNT,
+ ETHTOOL_A_RSS_MAX = (__ETHTOOL_A_RSS_CNT - 1),
+};
#define ETHTOOL_GENL_NAME "ethtool"
#define ETHTOOL_GENL_VERSION 1
#define ETHTOOL_MCGRP_MONITOR_NAME "monitor"
diff --git a/libc/kernel/uapi/linux/eventpoll.h b/libc/kernel/uapi/linux/eventpoll.h
index d2601e5..de4c1f1 100644
--- a/libc/kernel/uapi/linux/eventpoll.h
+++ b/libc/kernel/uapi/linux/eventpoll.h
@@ -25,22 +25,23 @@
#define EPOLL_CTL_ADD 1
#define EPOLL_CTL_DEL 2
#define EPOLL_CTL_MOD 3
-#define EPOLLIN (__force __poll_t) 0x00000001
-#define EPOLLPRI (__force __poll_t) 0x00000002
-#define EPOLLOUT (__force __poll_t) 0x00000004
-#define EPOLLERR (__force __poll_t) 0x00000008
-#define EPOLLHUP (__force __poll_t) 0x00000010
-#define EPOLLNVAL (__force __poll_t) 0x00000020
-#define EPOLLRDNORM (__force __poll_t) 0x00000040
-#define EPOLLRDBAND (__force __poll_t) 0x00000080
-#define EPOLLWRNORM (__force __poll_t) 0x00000100
-#define EPOLLWRBAND (__force __poll_t) 0x00000200
-#define EPOLLMSG (__force __poll_t) 0x00000400
-#define EPOLLRDHUP (__force __poll_t) 0x00002000
-#define EPOLLEXCLUSIVE ((__force __poll_t) (1U << 28))
-#define EPOLLWAKEUP ((__force __poll_t) (1U << 29))
-#define EPOLLONESHOT ((__force __poll_t) (1U << 30))
-#define EPOLLET ((__force __poll_t) (1U << 31))
+#define EPOLLIN ( __poll_t) 0x00000001
+#define EPOLLPRI ( __poll_t) 0x00000002
+#define EPOLLOUT ( __poll_t) 0x00000004
+#define EPOLLERR ( __poll_t) 0x00000008
+#define EPOLLHUP ( __poll_t) 0x00000010
+#define EPOLLNVAL ( __poll_t) 0x00000020
+#define EPOLLRDNORM ( __poll_t) 0x00000040
+#define EPOLLRDBAND ( __poll_t) 0x00000080
+#define EPOLLWRNORM ( __poll_t) 0x00000100
+#define EPOLLWRBAND ( __poll_t) 0x00000200
+#define EPOLLMSG ( __poll_t) 0x00000400
+#define EPOLLRDHUP ( __poll_t) 0x00002000
+#define EPOLL_URING_WAKE (( __poll_t) (1U << 27))
+#define EPOLLEXCLUSIVE (( __poll_t) (1U << 28))
+#define EPOLLWAKEUP (( __poll_t) (1U << 29))
+#define EPOLLONESHOT (( __poll_t) (1U << 30))
+#define EPOLLET (( __poll_t) (1U << 31))
#ifdef __x86_64__
#define EPOLL_PACKED __attribute__((packed))
#else
diff --git a/libc/kernel/uapi/linux/f2fs.h b/libc/kernel/uapi/linux/f2fs.h
index 76da8f6..7c9629a 100644
--- a/libc/kernel/uapi/linux/f2fs.h
+++ b/libc/kernel/uapi/linux/f2fs.h
@@ -25,7 +25,7 @@
#define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2)
#define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3)
#define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4)
-#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5)
+#define F2FS_IOC_ABORT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 5)
#define F2FS_IOC_GARBAGE_COLLECT _IOW(F2FS_IOCTL_MAGIC, 6, __u32)
#define F2FS_IOC_WRITE_CHECKPOINT _IO(F2FS_IOCTL_MAGIC, 7)
#define F2FS_IOC_DEFRAGMENT _IOWR(F2FS_IOCTL_MAGIC, 8, struct f2fs_defragment)
@@ -45,6 +45,7 @@
#define F2FS_IOC_SET_COMPRESS_OPTION _IOW(F2FS_IOCTL_MAGIC, 22, struct f2fs_comp_option)
#define F2FS_IOC_DECOMPRESS_FILE _IO(F2FS_IOCTL_MAGIC, 23)
#define F2FS_IOC_COMPRESS_FILE _IO(F2FS_IOCTL_MAGIC, 24)
+#define F2FS_IOC_START_ATOMIC_REPLACE _IO(F2FS_IOCTL_MAGIC, 25)
#define F2FS_IOC_SHUTDOWN _IOR('X', 125, __u32)
#define F2FS_GOING_DOWN_FULLSYNC 0x0
#define F2FS_GOING_DOWN_METASYNC 0x1
diff --git a/libc/kernel/uapi/linux/fanotify.h b/libc/kernel/uapi/linux/fanotify.h
index 6249292..9815a64 100644
--- a/libc/kernel/uapi/linux/fanotify.h
+++ b/libc/kernel/uapi/linux/fanotify.h
@@ -67,9 +67,12 @@
#define FAN_MARK_IGNORED_MASK 0x00000020
#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
#define FAN_MARK_FLUSH 0x00000080
+#define FAN_MARK_EVICTABLE 0x00000200
+#define FAN_MARK_IGNORE 0x00000400
#define FAN_MARK_INODE 0x00000000
#define FAN_MARK_MOUNT 0x00000010
#define FAN_MARK_FILESYSTEM 0x00000100
+#define FAN_MARK_IGNORE_SURV (FAN_MARK_IGNORE | FAN_MARK_IGNORED_SURV_MODIFY)
#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH)
#define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN)
#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
@@ -99,7 +102,7 @@
struct fanotify_event_info_fid {
struct fanotify_event_info_header hdr;
__kernel_fsid_t fsid;
- unsigned char handle[0];
+ unsigned char handle[];
};
struct fanotify_event_info_pidfd {
struct fanotify_event_info_header hdr;
diff --git a/libc/kernel/uapi/linux/fd.h b/libc/kernel/uapi/linux/fd.h
index 4d72d69..dc1d444 100644
--- a/libc/kernel/uapi/linux/fd.h
+++ b/libc/kernel/uapi/linux/fd.h
@@ -175,7 +175,7 @@
#define FD_RAW_SOFTFAILURE 0x800
#define FD_RAW_FAILURE 0x10000
#define FD_RAW_HARDFAILURE 0x20000
- void __user * data;
+ void * data;
char * kernel_data;
struct floppy_raw_cmd * next;
long length;
diff --git a/libc/kernel/uapi/linux/fiemap.h b/libc/kernel/uapi/linux/fiemap.h
index 4310786..a67a5fe 100644
--- a/libc/kernel/uapi/linux/fiemap.h
+++ b/libc/kernel/uapi/linux/fiemap.h
@@ -34,7 +34,7 @@
__u32 fm_mapped_extents;
__u32 fm_extent_count;
__u32 fm_reserved;
- struct fiemap_extent fm_extents[0];
+ struct fiemap_extent fm_extents[];
};
#define FIEMAP_MAX_OFFSET (~0ULL)
#define FIEMAP_FLAG_SYNC 0x00000001
diff --git a/libc/kernel/uapi/linux/filter.h b/libc/kernel/uapi/linux/filter.h
index d13c59d..57fe2fb 100644
--- a/libc/kernel/uapi/linux/filter.h
+++ b/libc/kernel/uapi/linux/filter.h
@@ -31,7 +31,7 @@
};
struct sock_fprog {
unsigned short len;
- struct sock_filter __user * filter;
+ struct sock_filter * filter;
};
#define BPF_RVAL(code) ((code) & 0x18)
#define BPF_A 0x10
diff --git a/libc/kernel/uapi/linux/firewire-cdev.h b/libc/kernel/uapi/linux/firewire-cdev.h
index 92957bc..a54191c 100644
--- a/libc/kernel/uapi/linux/firewire-cdev.h
+++ b/libc/kernel/uapi/linux/firewire-cdev.h
@@ -50,7 +50,7 @@
__u32 type;
__u32 rcode;
__u32 length;
- __u32 data[0];
+ __u32 data[];
};
struct fw_cdev_event_request {
__u64 closure;
@@ -59,7 +59,7 @@
__u64 offset;
__u32 handle;
__u32 length;
- __u32 data[0];
+ __u32 data[];
};
struct fw_cdev_event_request2 {
__u64 closure;
@@ -72,14 +72,14 @@
__u32 generation;
__u32 handle;
__u32 length;
- __u32 data[0];
+ __u32 data[];
};
struct fw_cdev_event_iso_interrupt {
__u64 closure;
__u32 type;
__u32 cycle;
__u32 header_length;
- __u32 header[0];
+ __u32 header[];
};
struct fw_cdev_event_iso_interrupt_mc {
__u64 closure;
@@ -98,7 +98,7 @@
__u32 type;
__u32 rcode;
__u32 length;
- __u32 data[0];
+ __u32 data[];
};
union fw_cdev_event {
struct fw_cdev_event_common common;
@@ -207,7 +207,7 @@
#define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24)
struct fw_cdev_iso_packet {
__u32 control;
- __u32 header[0];
+ __u32 header[];
};
struct fw_cdev_queue_iso {
__u64 packets;
diff --git a/libc/kernel/uapi/linux/fs.h b/libc/kernel/uapi/linux/fs.h
index 3bb4183..b8bfaac 100644
--- a/libc/kernel/uapi/linux/fs.h
+++ b/libc/kernel/uapi/linux/fs.h
@@ -63,7 +63,7 @@
__u16 dest_count;
__u16 reserved1;
__u32 reserved2;
- struct file_dedupe_range_info info[0];
+ struct file_dedupe_range_info info[];
};
struct files_stat_struct {
unsigned long nr_files;
@@ -190,10 +190,10 @@
#define SYNC_FILE_RANGE_WAIT_AFTER 4
#define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WAIT_AFTER)
typedef int __bitwise __kernel_rwf_t;
-#define RWF_HIPRI ((__force __kernel_rwf_t) 0x00000001)
-#define RWF_DSYNC ((__force __kernel_rwf_t) 0x00000002)
-#define RWF_SYNC ((__force __kernel_rwf_t) 0x00000004)
-#define RWF_NOWAIT ((__force __kernel_rwf_t) 0x00000008)
-#define RWF_APPEND ((__force __kernel_rwf_t) 0x00000010)
+#define RWF_HIPRI (( __kernel_rwf_t) 0x00000001)
+#define RWF_DSYNC (( __kernel_rwf_t) 0x00000002)
+#define RWF_SYNC (( __kernel_rwf_t) 0x00000004)
+#define RWF_NOWAIT (( __kernel_rwf_t) 0x00000008)
+#define RWF_APPEND (( __kernel_rwf_t) 0x00000010)
#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT | RWF_APPEND)
#endif
diff --git a/libc/kernel/uapi/linux/fscrypt.h b/libc/kernel/uapi/linux/fscrypt.h
index ca42eb3..9efafae 100644
--- a/libc/kernel/uapi/linux/fscrypt.h
+++ b/libc/kernel/uapi/linux/fscrypt.h
@@ -32,7 +32,10 @@
#define FSCRYPT_MODE_AES_256_CTS 4
#define FSCRYPT_MODE_AES_128_CBC 5
#define FSCRYPT_MODE_AES_128_CTS 6
+#define FSCRYPT_MODE_SM4_XTS 7
+#define FSCRYPT_MODE_SM4_CTS 8
#define FSCRYPT_MODE_ADIANTUM 9
+#define FSCRYPT_MODE_AES_256_HCTR2 10
#define FSCRYPT_POLICY_V1 0
#define FSCRYPT_KEY_DESCRIPTOR_SIZE 8
struct fscrypt_policy_v1 {
@@ -137,8 +140,6 @@
#define FS_ENCRYPTION_MODE_AES_256_CTS FSCRYPT_MODE_AES_256_CTS
#define FS_ENCRYPTION_MODE_AES_128_CBC FSCRYPT_MODE_AES_128_CBC
#define FS_ENCRYPTION_MODE_AES_128_CTS FSCRYPT_MODE_AES_128_CTS
-#define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7
-#define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8
#define FS_ENCRYPTION_MODE_ADIANTUM FSCRYPT_MODE_ADIANTUM
#define FS_KEY_DESC_PREFIX FSCRYPT_KEY_DESC_PREFIX
#define FS_KEY_DESC_PREFIX_SIZE FSCRYPT_KEY_DESC_PREFIX_SIZE
diff --git a/libc/kernel/uapi/linux/fsi.h b/libc/kernel/uapi/linux/fsi.h
index fc88464..b080c21 100644
--- a/libc/kernel/uapi/linux/fsi.h
+++ b/libc/kernel/uapi/linux/fsi.h
@@ -48,4 +48,5 @@
#define FSI_SCOM_READ _IOWR('s', 0x01, struct scom_access)
#define FSI_SCOM_WRITE _IOWR('s', 0x02, struct scom_access)
#define FSI_SCOM_RESET _IOW('s', 0x03, __u32)
+#define FSI_SBEFIFO_READ_TIMEOUT_SECONDS _IOW('s', 0x00, __u32)
#endif
diff --git a/libc/kernel/uapi/linux/fuse.h b/libc/kernel/uapi/linux/fuse.h
index 144e960..f1eec4d 100644
--- a/libc/kernel/uapi/linux/fuse.h
+++ b/libc/kernel/uapi/linux/fuse.h
@@ -20,7 +20,7 @@
#define _LINUX_FUSE_H
#include <stdint.h>
#define FUSE_KERNEL_VERSION 7
-#define FUSE_KERNEL_MINOR_VERSION 36
+#define FUSE_KERNEL_MINOR_VERSION 38
#define FUSE_ROOT_ID 1
struct fuse_attr {
uint64_t ino;
@@ -76,6 +76,7 @@
#define FOPEN_CACHE_DIR (1 << 3)
#define FOPEN_STREAM (1 << 4)
#define FOPEN_NOFLUSH (1 << 5)
+#define FOPEN_PARALLEL_DIRECT_WRITES (1 << 6)
#define FUSE_ASYNC_READ (1 << 0)
#define FUSE_POSIX_LOCKS (1 << 1)
#define FUSE_FILE_OPS (1 << 2)
@@ -138,6 +139,7 @@
#define FUSE_ATTR_DAX (1 << 1)
#define FUSE_OPEN_KILL_SUIDGID (1 << 0)
#define FUSE_SETXATTR_ACL_KILL_SGID (1 << 0)
+#define FUSE_EXPIRE_ONLY (1 << 0)
enum fuse_opcode {
FUSE_LOOKUP = 1,
FUSE_FORGET = 2,
@@ -187,6 +189,7 @@
FUSE_SETUPMAPPING = 48,
FUSE_REMOVEMAPPING = 49,
FUSE_SYNCFS = 50,
+ FUSE_TMPFILE = 51,
FUSE_CANONICAL_PATH = 2016,
CUSE_INIT = 4096,
CUSE_INIT_BSWAP_RESERVED = 1048576,
@@ -494,7 +497,7 @@
struct fuse_notify_inval_entry_out {
uint64_t parent;
uint32_t namelen;
- uint32_t padding;
+ uint32_t flags;
};
struct fuse_notify_delete_out {
uint64_t parent;
diff --git a/libc/kernel/uapi/linux/futex.h b/libc/kernel/uapi/linux/futex.h
index c80b90c..8d1a2a4 100644
--- a/libc/kernel/uapi/linux/futex.h
+++ b/libc/kernel/uapi/linux/futex.h
@@ -59,12 +59,12 @@
__u32 __reserved;
};
struct robust_list {
- struct robust_list __user * next;
+ struct robust_list * next;
};
struct robust_list_head {
struct robust_list list;
long futex_offset;
- struct robust_list __user * list_op_pending;
+ struct robust_list * list_op_pending;
};
#define FUTEX_WAITERS 0x80000000
#define FUTEX_OWNER_DIED 0x40000000
diff --git a/libc/kernel/uapi/linux/genetlink.h b/libc/kernel/uapi/linux/genetlink.h
index 2e2137d..0f86331 100644
--- a/libc/kernel/uapi/linux/genetlink.h
+++ b/libc/kernel/uapi/linux/genetlink.h
@@ -81,6 +81,7 @@
CTRL_ATTR_MCAST_GRP_ID,
__CTRL_ATTR_MCAST_GRP_MAX,
};
+#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
enum {
CTRL_ATTR_POLICY_UNSPEC,
CTRL_ATTR_POLICY_DO,
@@ -88,5 +89,5 @@
__CTRL_ATTR_POLICY_DUMP_MAX,
CTRL_ATTR_POLICY_DUMP_MAX = __CTRL_ATTR_POLICY_DUMP_MAX - 1
};
-#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
+#define CTRL_ATTR_POLICY_MAX (__CTRL_ATTR_POLICY_DUMP_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/gpio.h b/libc/kernel/uapi/linux/gpio.h
index 7e010d9..e760321 100644
--- a/libc/kernel/uapi/linux/gpio.h
+++ b/libc/kernel/uapi/linux/gpio.h
@@ -42,6 +42,7 @@
GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL(9),
GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL(10),
GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = _BITULL(11),
+ GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE = _BITULL(12),
};
struct gpio_v2_line_values {
__aligned_u64 bits;
diff --git a/libc/kernel/uapi/linux/gtp.h b/libc/kernel/uapi/linux/gtp.h
index 3b9416e..20bc3d6 100644
--- a/libc/kernel/uapi/linux/gtp.h
+++ b/libc/kernel/uapi/linux/gtp.h
@@ -23,6 +23,7 @@
GTP_CMD_NEWPDP,
GTP_CMD_DELPDP,
GTP_CMD_GETPDP,
+ GTP_CMD_ECHOREQ,
GTP_CMD_MAX,
};
enum gtp_version {
diff --git a/libc/kernel/uapi/linux/hid.h b/libc/kernel/uapi/linux/hid.h
index ce93cd7..37ab462 100644
--- a/libc/kernel/uapi/linux/hid.h
+++ b/libc/kernel/uapi/linux/hid.h
@@ -22,12 +22,20 @@
#define USB_INTERFACE_SUBCLASS_BOOT 1
#define USB_INTERFACE_PROTOCOL_KEYBOARD 1
#define USB_INTERFACE_PROTOCOL_MOUSE 2
-#define HID_REQ_GET_REPORT 0x01
-#define HID_REQ_GET_IDLE 0x02
-#define HID_REQ_GET_PROTOCOL 0x03
-#define HID_REQ_SET_REPORT 0x09
-#define HID_REQ_SET_IDLE 0x0A
-#define HID_REQ_SET_PROTOCOL 0x0B
+enum hid_report_type {
+ HID_INPUT_REPORT = 0,
+ HID_OUTPUT_REPORT = 1,
+ HID_FEATURE_REPORT = 2,
+ HID_REPORT_TYPES,
+};
+enum hid_class_request {
+ HID_REQ_GET_REPORT = 0x01,
+ HID_REQ_GET_IDLE = 0x02,
+ HID_REQ_GET_PROTOCOL = 0x03,
+ HID_REQ_SET_REPORT = 0x09,
+ HID_REQ_SET_IDLE = 0x0A,
+ HID_REQ_SET_PROTOCOL = 0x0B,
+};
#define HID_DT_HID (USB_TYPE_CLASS | 0x01)
#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02)
#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
diff --git a/libc/kernel/uapi/linux/i2c-dev.h b/libc/kernel/uapi/linux/i2c-dev.h
index 07fdda2..7a25e20 100644
--- a/libc/kernel/uapi/linux/i2c-dev.h
+++ b/libc/kernel/uapi/linux/i2c-dev.h
@@ -33,10 +33,10 @@
__u8 read_write;
__u8 command;
__u32 size;
- union i2c_smbus_data __user * data;
+ union i2c_smbus_data * data;
};
struct i2c_rdwr_ioctl_data {
- struct i2c_msg __user * msgs;
+ struct i2c_msg * msgs;
__u32 nmsgs;
};
#define I2C_RDWR_IOCTL_MAX_MSGS 42
diff --git a/libc/kernel/uapi/linux/i2o-dev.h b/libc/kernel/uapi/linux/i2o-dev.h
index fc8b26d..afaae74 100644
--- a/libc/kernel/uapi/linux/i2o-dev.h
+++ b/libc/kernel/uapi/linux/i2o-dev.h
@@ -42,38 +42,38 @@
};
struct i2o_cmd_passthru {
unsigned int iop;
- void __user * msg;
+ void * msg;
};
struct i2o_cmd_hrtlct {
unsigned int iop;
- void __user * resbuf;
- unsigned int __user * reslen;
+ void * resbuf;
+ unsigned int * reslen;
};
struct i2o_cmd_psetget {
unsigned int iop;
unsigned int tid;
- void __user * opbuf;
+ void * opbuf;
unsigned int oplen;
- void __user * resbuf;
- unsigned int __user * reslen;
+ void * resbuf;
+ unsigned int * reslen;
};
struct i2o_sw_xfer {
unsigned int iop;
unsigned char flags;
unsigned char sw_type;
unsigned int sw_id;
- void __user * buf;
- unsigned int __user * swlen;
- unsigned int __user * maxfrag;
- unsigned int __user * curfrag;
+ void * buf;
+ unsigned int * swlen;
+ unsigned int * maxfrag;
+ unsigned int * curfrag;
};
struct i2o_html {
unsigned int iop;
unsigned int tid;
unsigned int page;
- void __user * resbuf;
- unsigned int __user * reslen;
- void __user * qbuf;
+ void * resbuf;
+ unsigned int * reslen;
+ void * qbuf;
unsigned int qlen;
};
#define I2O_EVT_Q_LEN 32
diff --git a/libc/kernel/uapi/linux/icmp.h b/libc/kernel/uapi/linux/icmp.h
index 8847a48..77cb328 100644
--- a/libc/kernel/uapi/linux/icmp.h
+++ b/libc/kernel/uapi/linux/icmp.h
@@ -84,7 +84,11 @@
} echo;
__be32 gateway;
struct {
+#ifdef __BIONIC__
__be16 __linux_unused;
+#else
+ __be16 __linux_unused;
+#endif
__be16 mtu;
} frag;
__u8 reserved[4];
diff --git a/libc/kernel/uapi/linux/idxd.h b/libc/kernel/uapi/linux/idxd.h
index ad9ed48..01c62f2 100644
--- a/libc/kernel/uapi/linux/idxd.h
+++ b/libc/kernel/uapi/linux/idxd.h
@@ -38,6 +38,7 @@
IDXD_SCMD_WQ_NO_SIZE = 0x800e0000,
IDXD_SCMD_WQ_NO_PRIV = 0x800f0000,
IDXD_SCMD_WQ_IRQ_ERR = 0x80100000,
+ IDXD_SCMD_WQ_USER_NO_IOMMU = 0x80110000,
};
#define IDXD_SCMD_SOFTERR_MASK 0x80000000
#define IDXD_SCMD_SOFTERR_SHIFT 16
@@ -57,6 +58,11 @@
#define IDXD_OP_FLAG_DRDBK 0x4000
#define IDXD_OP_FLAG_DSTS 0x8000
#define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000
+#define IDXD_OP_FLAG_RD_SRC2_2ND 0x020000
+#define IDXD_OP_FLAG_WR_SRC2_AECS_COMP 0x040000
+#define IDXD_OP_FLAG_WR_SRC2_AECS_OVFL 0x080000
+#define IDXD_OP_FLAG_SRC2_STS 0x100000
+#define IDXD_OP_FLAG_CRC_RFC3720 0x200000
enum dsa_opcode {
DSA_OPCODE_NOOP = 0,
DSA_OPCODE_BATCH,
@@ -82,6 +88,18 @@
IAX_OPCODE_MEMMOVE,
IAX_OPCODE_DECOMPRESS = 0x42,
IAX_OPCODE_COMPRESS,
+ IAX_OPCODE_CRC64,
+ IAX_OPCODE_ZERO_DECOMP_32 = 0x48,
+ IAX_OPCODE_ZERO_DECOMP_16,
+ IAX_OPCODE_ZERO_COMP_32 = 0x4c,
+ IAX_OPCODE_ZERO_COMP_16,
+ IAX_OPCODE_SCAN = 0x50,
+ IAX_OPCODE_SET_MEMBER,
+ IAX_OPCODE_EXTRACT,
+ IAX_OPCODE_SELECT,
+ IAX_OPCODE_RLE_BURST,
+ IAX_OPCODE_FIND_UNIQUE,
+ IAX_OPCODE_EXPAND,
};
enum dsa_completion_status {
DSA_COMP_NONE = 0,
@@ -118,6 +136,7 @@
IAX_COMP_NONE = 0,
IAX_COMP_SUCCESS,
IAX_COMP_PAGE_FAULT_IR = 0x04,
+ IAX_COMP_ANALYTICS_ERROR = 0x0a,
IAX_COMP_OUTBUF_OVERFLOW,
IAX_COMP_BAD_OPCODE = 0x10,
IAX_COMP_INVALID_FLAGS,
@@ -138,7 +157,10 @@
IAX_COMP_WATCHDOG,
IAX_COMP_INVALID_COMP_FLAG = 0x30,
IAX_COMP_INVALID_FILTER_FLAG,
- IAX_COMP_INVALID_NUM_ELEMS = 0x33,
+ IAX_COMP_INVALID_INPUT_SIZE,
+ IAX_COMP_INVALID_NUM_ELEMS,
+ IAX_COMP_INVALID_SRC1_WIDTH,
+ IAX_COMP_INVALID_INVERT_OUT,
};
#define DSA_COMP_STATUS_MASK 0x7f
#define DSA_COMP_STATUS_WRITE 0x80
@@ -254,7 +276,7 @@
uint32_t rsvd2 : 8;
};
uint32_t delta_rec_size;
- uint32_t crc_val;
+ uint64_t crc_val;
struct {
uint32_t dif_chk_ref_tag;
uint16_t dif_chk_app_tag_mask;
@@ -291,8 +313,12 @@
uint32_t output_size;
uint8_t output_bits;
uint8_t rsvd3;
- uint16_t rsvd4;
- uint64_t rsvd5[4];
+ uint16_t xor_csum;
+ uint32_t crc;
+ uint32_t min;
+ uint32_t max;
+ uint32_t sum;
+ uint64_t rsvd4[2];
} __attribute__((packed));
struct iax_raw_completion_record {
uint64_t field[8];
diff --git a/libc/kernel/uapi/linux/if.h b/libc/kernel/uapi/linux/if.h
index 63c77eb..fc6d20d 100644
--- a/libc/kernel/uapi/linux/if.h
+++ b/libc/kernel/uapi/linux/if.h
@@ -130,14 +130,14 @@
unsigned int type;
unsigned int size;
union {
- raw_hdlc_proto __user * raw_hdlc;
- cisco_proto __user * cisco;
- fr_proto __user * fr;
- fr_proto_pvc __user * fr_pvc;
- fr_proto_pvc_info __user * fr_pvc_info;
- x25_hdlc_proto __user * x25;
- sync_serial_settings __user * sync;
- te1_settings __user * te1;
+ raw_hdlc_proto * raw_hdlc;
+ cisco_proto * cisco;
+ fr_proto * fr;
+ fr_proto_pvc * fr_pvc;
+ fr_proto_pvc_info * fr_pvc_info;
+ x25_hdlc_proto * x25;
+ sync_serial_settings * sync;
+ te1_settings * te1;
} ifs_ifsu;
};
#if __UAPI_DEF_IF_IFREQ
@@ -158,7 +158,7 @@
struct ifmap ifru_map;
char ifru_slave[IFNAMSIZ];
char ifru_newname[IFNAMSIZ];
- void __user * ifru_data;
+ void * ifru_data;
struct if_settings ifru_settings;
} ifr_ifru;
};
@@ -184,8 +184,8 @@
struct ifconf {
int ifc_len;
union {
- char __user * ifcu_buf;
- struct ifreq __user * ifcu_req;
+ char * ifcu_buf;
+ struct ifreq * ifcu_req;
} ifc_ifcu;
};
#endif
diff --git a/libc/kernel/uapi/linux/if_addr.h b/libc/kernel/uapi/linux/if_addr.h
index 6a6b640..a225e69 100644
--- a/libc/kernel/uapi/linux/if_addr.h
+++ b/libc/kernel/uapi/linux/if_addr.h
@@ -39,6 +39,7 @@
IFA_FLAGS,
IFA_RT_PRIORITY,
IFA_TARGET_NETNSID,
+ IFA_PROTO,
__IFA_MAX,
};
#define IFA_MAX (__IFA_MAX - 1)
@@ -63,4 +64,8 @@
};
#define IFA_RTA(r) ((struct rtattr *) (((char *) (r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct ifaddrmsg))
+#define IFAPROT_UNSPEC 0
+#define IFAPROT_KERNEL_LO 1
+#define IFAPROT_KERNEL_RA 2
+#define IFAPROT_KERNEL_LL 3
#endif
diff --git a/libc/kernel/uapi/linux/if_alg.h b/libc/kernel/uapi/linux/if_alg.h
index 6530a16..41ba868 100644
--- a/libc/kernel/uapi/linux/if_alg.h
+++ b/libc/kernel/uapi/linux/if_alg.h
@@ -35,7 +35,7 @@
};
struct af_alg_iv {
__u32 ivlen;
- __u8 iv[0];
+ __u8 iv[];
};
#define ALG_SET_KEY 1
#define ALG_SET_IV 2
@@ -43,6 +43,7 @@
#define ALG_SET_AEAD_ASSOCLEN 4
#define ALG_SET_AEAD_AUTHSIZE 5
#define ALG_SET_DRBG_ENTROPY 6
+#define ALG_SET_KEY_BY_KEY_SERIAL 7
#define ALG_OP_DECRYPT 0
#define ALG_OP_ENCRYPT 1
#endif
diff --git a/libc/kernel/uapi/linux/if_arcnet.h b/libc/kernel/uapi/linux/if_arcnet.h
index 6aece37..65b07e1 100644
--- a/libc/kernel/uapi/linux/if_arcnet.h
+++ b/libc/kernel/uapi/linux/if_arcnet.h
@@ -40,18 +40,18 @@
__u8 proto;
__u8 split_flag;
__be16 sequence;
- __u8 payload[0];
+ __u8 payload[];
};
#define RFC1201_HDR_SIZE 4
struct arc_rfc1051 {
__u8 proto;
- __u8 payload[0];
+ __u8 payload[];
};
#define RFC1051_HDR_SIZE 1
struct arc_eth_encap {
__u8 proto;
struct ethhdr eth;
- __u8 payload[0];
+ __u8 payload[];
};
#define ETH_ENCAP_HDR_SIZE 14
struct arc_cap {
diff --git a/libc/kernel/uapi/linux/if_bridge.h b/libc/kernel/uapi/linux/if_bridge.h
index 2054fb3..702363e 100644
--- a/libc/kernel/uapi/linux/if_bridge.h
+++ b/libc/kernel/uapi/linux/if_bridge.h
@@ -108,6 +108,7 @@
IFLA_BRIDGE_VLAN_TUNNEL_INFO,
IFLA_BRIDGE_MRP,
IFLA_BRIDGE_CFM,
+ IFLA_BRIDGE_MST,
__IFLA_BRIDGE_MAX,
};
#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
@@ -384,6 +385,19 @@
__IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX,
};
#define IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX (__IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX - 1)
+enum {
+ IFLA_BRIDGE_MST_UNSPEC,
+ IFLA_BRIDGE_MST_ENTRY,
+ __IFLA_BRIDGE_MST_MAX,
+};
+#define IFLA_BRIDGE_MST_MAX (__IFLA_BRIDGE_MST_MAX - 1)
+enum {
+ IFLA_BRIDGE_MST_ENTRY_UNSPEC,
+ IFLA_BRIDGE_MST_ENTRY_MSTI,
+ IFLA_BRIDGE_MST_ENTRY_STATE,
+ __IFLA_BRIDGE_MST_ENTRY_MAX,
+};
+#define IFLA_BRIDGE_MST_ENTRY_MAX (__IFLA_BRIDGE_MST_ENTRY_MAX - 1)
struct bridge_stp_xstats {
__u64 transition_blk;
__u64 transition_fwd;
@@ -460,6 +474,7 @@
BRIDGE_VLANDB_GOPTS_MCAST_QUERIER,
BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS,
BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE,
+ BRIDGE_VLANDB_GOPTS_MSTI,
__BRIDGE_VLANDB_GOPTS_MAX
};
#define BRIDGE_VLANDB_GOPTS_MAX (__BRIDGE_VLANDB_GOPTS_MAX - 1)
@@ -561,10 +576,25 @@
enum {
MDBE_ATTR_UNSPEC,
MDBE_ATTR_SOURCE,
+ MDBE_ATTR_SRC_LIST,
+ MDBE_ATTR_GROUP_MODE,
+ MDBE_ATTR_RTPROT,
__MDBE_ATTR_MAX,
};
#define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
enum {
+ MDBE_SRC_LIST_UNSPEC,
+ MDBE_SRC_LIST_ENTRY,
+ __MDBE_SRC_LIST_MAX,
+};
+#define MDBE_SRC_LIST_MAX (__MDBE_SRC_LIST_MAX - 1)
+enum {
+ MDBE_SRCATTR_UNSPEC,
+ MDBE_SRCATTR_ADDRESS,
+ __MDBE_SRCATTR_MAX,
+};
+#define MDBE_SRCATTR_MAX (__MDBE_SRCATTR_MAX - 1)
+enum {
BRIDGE_XSTATS_UNSPEC,
BRIDGE_XSTATS_VLAN,
BRIDGE_XSTATS_MCAST,
@@ -599,6 +629,7 @@
enum br_boolopt_id {
BR_BOOLOPT_NO_LL_LEARN,
BR_BOOLOPT_MCAST_VLAN_SNOOPING,
+ BR_BOOLOPT_MST_ENABLE,
BR_BOOLOPT_MAX
};
struct br_boolopt_multi {
diff --git a/libc/kernel/uapi/linux/if_ether.h b/libc/kernel/uapi/linux/if_ether.h
index 1f7f8f2..6043921 100644
--- a/libc/kernel/uapi/linux/if_ether.h
+++ b/libc/kernel/uapi/linux/if_ether.h
@@ -67,8 +67,10 @@
#define ETH_P_LINK_CTL 0x886c
#define ETH_P_ATMFATE 0x8884
#define ETH_P_PAE 0x888E
+#define ETH_P_PROFINET 0x8892
#define ETH_P_REALTEK 0x8899
#define ETH_P_AOE 0x88A2
+#define ETH_P_ETHERCAT 0x88A4
#define ETH_P_8021AD 0x88A8
#define ETH_P_802_EX1 0x88B5
#define ETH_P_PREAUTH 0x88C7
@@ -95,6 +97,7 @@
#define ETH_P_QINQ3 0x9300
#define ETH_P_EDSA 0xDADA
#define ETH_P_DSA_8021Q 0xDADB
+#define ETH_P_DSA_A5PSW 0xE001
#define ETH_P_IFE 0xED3E
#define ETH_P_AF_IUCV 0xFBFB
#define ETH_P_802_3_MIN 0x0600
@@ -109,6 +112,7 @@
#define ETH_P_LOCALTALK 0x0009
#define ETH_P_CAN 0x000C
#define ETH_P_CANFD 0x000D
+#define ETH_P_CANXL 0x000E
#define ETH_P_PPPTALK 0x0010
#define ETH_P_TR_802_2 0x0011
#define ETH_P_MOBITEX 0x0015
diff --git a/libc/kernel/uapi/linux/if_link.h b/libc/kernel/uapi/linux/if_link.h
index 7e413ae..19c6346 100644
--- a/libc/kernel/uapi/linux/if_link.h
+++ b/libc/kernel/uapi/linux/if_link.h
@@ -71,6 +71,18 @@
__u64 rx_compressed;
__u64 tx_compressed;
__u64 rx_nohandler;
+ __u64 rx_otherhost_dropped;
+};
+struct rtnl_hw_stats64 {
+ __u64 rx_packets;
+ __u64 tx_packets;
+ __u64 rx_bytes;
+ __u64 tx_bytes;
+ __u64 rx_errors;
+ __u64 tx_errors;
+ __u64 rx_dropped;
+ __u64 tx_dropped;
+ __u64 multicast;
};
struct rtnl_link_ifmap {
__u64 mem_start;
@@ -151,6 +163,10 @@
IFLA_PARENT_DEV_NAME,
IFLA_PARENT_DEV_BUS_NAME,
IFLA_GRO_MAX_SIZE,
+ IFLA_TSO_MAX_SIZE,
+ IFLA_TSO_MAX_SEGS,
+ IFLA_ALLMULTI,
+ IFLA_DEVLINK_PORT,
__IFLA_MAX
};
#define IFLA_MAX (__IFLA_MAX - 1)
@@ -289,6 +305,8 @@
IFLA_BRPORT_MRP_IN_OPEN,
IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT,
IFLA_BRPORT_MCAST_EHT_HOSTS_CNT,
+ IFLA_BRPORT_LOCKED,
+ IFLA_BRPORT_MAB,
__IFLA_BRPORT_MAX
};
#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -396,6 +414,7 @@
IFLA_XFRM_UNSPEC,
IFLA_XFRM_LINK,
IFLA_XFRM_IF_ID,
+ IFLA_XFRM_COLLECT_METADATA,
__IFLA_XFRM_MAX
};
#define IFLA_XFRM_MAX (__IFLA_XFRM_MAX - 1)
@@ -428,6 +447,44 @@
};
#define IPVLAN_F_PRIVATE 0x01
#define IPVLAN_F_VEPA 0x02
+struct tunnel_msg {
+ __u8 family;
+ __u8 flags;
+ __u16 reserved2;
+ __u32 ifindex;
+};
+#define TUNNEL_MSG_FLAG_STATS 0x01
+#define TUNNEL_MSG_VALID_USER_FLAGS TUNNEL_MSG_FLAG_STATS
+enum {
+ VNIFILTER_ENTRY_STATS_UNSPEC,
+ VNIFILTER_ENTRY_STATS_RX_BYTES,
+ VNIFILTER_ENTRY_STATS_RX_PKTS,
+ VNIFILTER_ENTRY_STATS_RX_DROPS,
+ VNIFILTER_ENTRY_STATS_RX_ERRORS,
+ VNIFILTER_ENTRY_STATS_TX_BYTES,
+ VNIFILTER_ENTRY_STATS_TX_PKTS,
+ VNIFILTER_ENTRY_STATS_TX_DROPS,
+ VNIFILTER_ENTRY_STATS_TX_ERRORS,
+ VNIFILTER_ENTRY_STATS_PAD,
+ __VNIFILTER_ENTRY_STATS_MAX
+};
+#define VNIFILTER_ENTRY_STATS_MAX (__VNIFILTER_ENTRY_STATS_MAX - 1)
+enum {
+ VXLAN_VNIFILTER_ENTRY_UNSPEC,
+ VXLAN_VNIFILTER_ENTRY_START,
+ VXLAN_VNIFILTER_ENTRY_END,
+ VXLAN_VNIFILTER_ENTRY_GROUP,
+ VXLAN_VNIFILTER_ENTRY_GROUP6,
+ VXLAN_VNIFILTER_ENTRY_STATS,
+ __VXLAN_VNIFILTER_ENTRY_MAX
+};
+#define VXLAN_VNIFILTER_ENTRY_MAX (__VXLAN_VNIFILTER_ENTRY_MAX - 1)
+enum {
+ VXLAN_VNIFILTER_UNSPEC,
+ VXLAN_VNIFILTER_ENTRY,
+ __VXLAN_VNIFILTER_MAX
+};
+#define VXLAN_VNIFILTER_MAX (__VXLAN_VNIFILTER_MAX - 1)
enum {
IFLA_VXLAN_UNSPEC,
IFLA_VXLAN_ID,
@@ -459,6 +516,7 @@
IFLA_VXLAN_GPE,
IFLA_VXLAN_TTL_INHERIT,
IFLA_VXLAN_DF,
+ IFLA_VXLAN_VNIFILTER,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
@@ -488,6 +546,7 @@
IFLA_GENEVE_LABEL,
IFLA_GENEVE_TTL_INHERIT,
IFLA_GENEVE_DF,
+ IFLA_GENEVE_INNER_PROTO_INHERIT,
__IFLA_GENEVE_MAX
};
#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
@@ -523,6 +582,8 @@
IFLA_GTP_FD1,
IFLA_GTP_PDP_HASHSIZE,
IFLA_GTP_ROLE,
+ IFLA_GTP_CREATE_SOCKETS,
+ IFLA_GTP_RESTART_COUNT,
__IFLA_GTP_MAX,
};
#define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1)
@@ -558,6 +619,7 @@
IFLA_BOND_PEER_NOTIF_DELAY,
IFLA_BOND_AD_LACP_ACTIVE,
IFLA_BOND_MISSED_MAX,
+ IFLA_BOND_NS_IP6_TARGET,
__IFLA_BOND_MAX,
};
#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
@@ -581,6 +643,7 @@
IFLA_BOND_SLAVE_AD_AGGREGATOR_ID,
IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE,
IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE,
+ IFLA_BOND_SLAVE_PRIO,
__IFLA_BOND_SLAVE_MAX,
};
#define IFLA_BOND_SLAVE_MAX (__IFLA_BOND_SLAVE_MAX - 1)
@@ -777,6 +840,13 @@
#define IFLA_STATS_MAX (__IFLA_STATS_MAX - 1)
#define IFLA_STATS_FILTER_BIT(ATTR) (1 << (ATTR - 1))
enum {
+ IFLA_STATS_GETSET_UNSPEC,
+ IFLA_STATS_GET_FILTERS,
+ IFLA_STATS_SET_OFFLOAD_XSTATS_L3_STATS,
+ __IFLA_STATS_GETSET_MAX,
+};
+#define IFLA_STATS_GETSET_MAX (__IFLA_STATS_GETSET_MAX - 1)
+enum {
LINK_XSTATS_TYPE_UNSPEC,
LINK_XSTATS_TYPE_BRIDGE,
LINK_XSTATS_TYPE_BOND,
@@ -786,9 +856,18 @@
enum {
IFLA_OFFLOAD_XSTATS_UNSPEC,
IFLA_OFFLOAD_XSTATS_CPU_HIT,
+ IFLA_OFFLOAD_XSTATS_HW_S_INFO,
+ IFLA_OFFLOAD_XSTATS_L3_STATS,
__IFLA_OFFLOAD_XSTATS_MAX
};
#define IFLA_OFFLOAD_XSTATS_MAX (__IFLA_OFFLOAD_XSTATS_MAX - 1)
+enum {
+ IFLA_OFFLOAD_XSTATS_HW_S_INFO_UNSPEC,
+ IFLA_OFFLOAD_XSTATS_HW_S_INFO_REQUEST,
+ IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED,
+ __IFLA_OFFLOAD_XSTATS_HW_S_INFO_MAX,
+};
+#define IFLA_OFFLOAD_XSTATS_HW_S_INFO_MAX (__IFLA_OFFLOAD_XSTATS_HW_S_INFO_MAX - 1)
#define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0)
#define XDP_FLAGS_SKB_MODE (1U << 1)
#define XDP_FLAGS_DRV_MODE (1U << 2)
@@ -862,4 +941,10 @@
__IFLA_MCTP_MAX,
};
#define IFLA_MCTP_MAX (__IFLA_MCTP_MAX - 1)
+enum {
+ IFLA_DSA_UNSPEC,
+ IFLA_DSA_MASTER,
+ __IFLA_DSA_MAX,
+};
+#define IFLA_DSA_MAX (__IFLA_DSA_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/if_macsec.h b/libc/kernel/uapi/linux/if_macsec.h
index e60d767..7b51f80 100644
--- a/libc/kernel/uapi/linux/if_macsec.h
+++ b/libc/kernel/uapi/linux/if_macsec.h
@@ -23,6 +23,7 @@
#define MACSEC_GENL_VERSION 1
#define MACSEC_MAX_KEY_LEN 128
#define MACSEC_KEYID_LEN 16
+#define MACSEC_SALT_LEN 12
#define MACSEC_CIPHER_ID_GCM_AES_128 0x0080C20001000001ULL
#define MACSEC_CIPHER_ID_GCM_AES_256 0x0080C20001000002ULL
#define MACSEC_CIPHER_ID_GCM_AES_XPN_128 0x0080C20001000003ULL
diff --git a/libc/kernel/uapi/linux/if_packet.h b/libc/kernel/uapi/linux/if_packet.h
index e7e7a33..340b2ee 100644
--- a/libc/kernel/uapi/linux/if_packet.h
+++ b/libc/kernel/uapi/linux/if_packet.h
@@ -75,6 +75,7 @@
#define PACKET_FANOUT_EBPF 7
#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
#define PACKET_FANOUT_FLAG_UNIQUEID 0x2000
+#define PACKET_FANOUT_FLAG_IGNORE_OUTGOING 0x4000
#define PACKET_FANOUT_FLAG_DEFRAG 0x8000
struct tpacket_stats {
unsigned int tp_packets;
diff --git a/libc/kernel/uapi/linux/if_pppox.h b/libc/kernel/uapi/linux/if_pppox.h
index 40d25e8..2acafdf 100644
--- a/libc/kernel/uapi/linux/if_pppox.h
+++ b/libc/kernel/uapi/linux/if_pppox.h
@@ -51,27 +51,27 @@
struct pppoe_addr pppoe;
struct pptp_addr pptp;
} sa_addr;
-} __packed;
+} __attribute__((__packed__));
struct sockaddr_pppol2tp {
__kernel_sa_family_t sa_family;
unsigned int sa_protocol;
struct pppol2tp_addr pppol2tp;
-} __packed;
+} __attribute__((__packed__));
struct sockaddr_pppol2tpin6 {
__kernel_sa_family_t sa_family;
unsigned int sa_protocol;
struct pppol2tpin6_addr pppol2tp;
-} __packed;
+} __attribute__((__packed__));
struct sockaddr_pppol2tpv3 {
__kernel_sa_family_t sa_family;
unsigned int sa_protocol;
struct pppol2tpv3_addr pppol2tp;
-} __packed;
+} __attribute__((__packed__));
struct sockaddr_pppol2tpv3in6 {
__kernel_sa_family_t sa_family;
unsigned int sa_protocol;
struct pppol2tpv3in6_addr pppol2tp;
-} __packed;
+} __attribute__((__packed__));
#define PPPOEIOCSFWD _IOW(0xB1, 0, size_t)
#define PPPOEIOCDFWD _IO(0xB1, 1)
#define PADI_CODE 0x09
@@ -82,7 +82,7 @@
struct pppoe_tag {
__be16 tag_type;
__be16 tag_len;
- char tag_data[0];
+ char tag_data[];
} __attribute__((packed));
#define PTT_EOL __cpu_to_be16(0x0000)
#define PTT_SRV_NAME __cpu_to_be16(0x0101)
@@ -107,7 +107,7 @@
__u8 code;
__be16 sid;
__be16 length;
- struct pppoe_tag tag[0];
-} __packed;
+ struct pppoe_tag tag[];
+} __attribute__((__packed__));
#define PPPOE_SES_HLEN 8
#endif
diff --git a/libc/kernel/uapi/linux/if_tun.h b/libc/kernel/uapi/linux/if_tun.h
index d1a8f9e..93bac9c 100644
--- a/libc/kernel/uapi/linux/if_tun.h
+++ b/libc/kernel/uapi/linux/if_tun.h
@@ -57,6 +57,7 @@
#define IFF_TAP 0x0002
#define IFF_NAPI 0x0010
#define IFF_NAPI_FRAGS 0x0020
+#define IFF_NO_CARRIER 0x0040
#define IFF_NO_PI 0x1000
#define IFF_ONE_QUEUE 0x2000
#define IFF_VNET_HDR 0x4000
@@ -72,6 +73,8 @@
#define TUN_F_TSO6 0x04
#define TUN_F_TSO_ECN 0x08
#define TUN_F_UFO 0x10
+#define TUN_F_USO4 0x20
+#define TUN_F_USO6 0x40
#define TUN_PKT_STRIP 0x0001
struct tun_pi {
__u16 flags;
@@ -81,6 +84,6 @@
struct tun_filter {
__u16 flags;
__u16 count;
- __u8 addr[0][ETH_ALEN];
+ __u8 addr[][ETH_ALEN];
};
#endif
diff --git a/libc/kernel/uapi/linux/if_tunnel.h b/libc/kernel/uapi/linux/if_tunnel.h
index 8e1847f..9b85568 100644
--- a/libc/kernel/uapi/linux/if_tunnel.h
+++ b/libc/kernel/uapi/linux/if_tunnel.h
@@ -142,7 +142,7 @@
__IFLA_GRE_MAX,
};
#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
-#define VTI_ISVTI ((__force __be16) 0x0001)
+#define VTI_ISVTI (( __be16) 0x0001)
enum {
IFLA_VTI_UNSPEC,
IFLA_VTI_LINK,
@@ -169,5 +169,6 @@
#define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000)
#define TUNNEL_NOCACHE __cpu_to_be16(0x2000)
#define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000)
-#define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT | TUNNEL_ERSPAN_OPT)
+#define TUNNEL_GTP_OPT __cpu_to_be16(0x8000)
+#define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT | TUNNEL_ERSPAN_OPT | TUNNEL_GTP_OPT)
#endif
diff --git a/libc/kernel/uapi/linux/igmp.h b/libc/kernel/uapi/linux/igmp.h
index 885b0f8..71c2c8d 100644
--- a/libc/kernel/uapi/linux/igmp.h
+++ b/libc/kernel/uapi/linux/igmp.h
@@ -37,7 +37,7 @@
__u8 grec_auxwords;
__be16 grec_nsrcs;
__be32 grec_mca;
- __be32 grec_src[0];
+ __be32 grec_src[];
};
struct igmpv3_report {
__u8 type;
@@ -45,7 +45,7 @@
__sum16 csum;
__be16 resv2;
__be16 ngrec;
- struct igmpv3_grec grec[0];
+ struct igmpv3_grec grec[];
};
struct igmpv3_query {
__u8 type;
@@ -61,7 +61,7 @@
#endif
__u8 qqic;
__be16 nsrcs;
- __be32 srcs[0];
+ __be32 srcs[];
};
#define IGMP_HOST_MEMBERSHIP_QUERY 0x11
#define IGMP_HOST_MEMBERSHIP_REPORT 0x12
diff --git a/libc/kernel/uapi/linux/iio/types.h b/libc/kernel/uapi/linux/iio/types.h
index 22409a7..af7bdda 100644
--- a/libc/kernel/uapi/linux/iio/types.h
+++ b/libc/kernel/uapi/linux/iio/types.h
@@ -101,6 +101,12 @@
IIO_MOD_ETHANOL,
IIO_MOD_H2,
IIO_MOD_O2,
+ IIO_MOD_LINEAR_X,
+ IIO_MOD_LINEAR_Y,
+ IIO_MOD_LINEAR_Z,
+ IIO_MOD_PITCH,
+ IIO_MOD_YAW,
+ IIO_MOD_ROLL,
};
enum iio_event_type {
IIO_EV_TYPE_THRESH,
@@ -109,11 +115,15 @@
IIO_EV_TYPE_THRESH_ADAPTIVE,
IIO_EV_TYPE_MAG_ADAPTIVE,
IIO_EV_TYPE_CHANGE,
+ IIO_EV_TYPE_MAG_REFERENCED,
+ IIO_EV_TYPE_GESTURE,
};
enum iio_event_direction {
IIO_EV_DIR_EITHER,
IIO_EV_DIR_RISING,
IIO_EV_DIR_FALLING,
IIO_EV_DIR_NONE,
+ IIO_EV_DIR_SINGLETAP,
+ IIO_EV_DIR_DOUBLETAP,
};
#endif
diff --git a/libc/kernel/uapi/linux/in.h b/libc/kernel/uapi/linux/in.h
index d4060e7..53d3074 100644
--- a/libc/kernel/uapi/linux/in.h
+++ b/libc/kernel/uapi/linux/in.h
@@ -22,6 +22,7 @@
#include <bits/ip_mreq_source.h>
#include <bits/in_addr.h>
#include <linux/types.h>
+#include <linux/stddef.h>
#include <linux/libc-compat.h>
#include <linux/socket.h>
#if __UAPI_DEF_IN_IPPROTO
@@ -68,6 +69,8 @@
#define IPPROTO_PIM IPPROTO_PIM
IPPROTO_COMP = 108,
#define IPPROTO_COMP IPPROTO_COMP
+ IPPROTO_L2TP = 115,
+#define IPPROTO_L2TP IPPROTO_L2TP
IPPROTO_SCTP = 132,
#define IPPROTO_SCTP IPPROTO_SCTP
IPPROTO_UDPLITE = 136,
diff --git a/libc/kernel/uapi/linux/inet_diag.h b/libc/kernel/uapi/linux/inet_diag.h
index 8656dd4..27f390b 100644
--- a/libc/kernel/uapi/linux/inet_diag.h
+++ b/libc/kernel/uapi/linux/inet_diag.h
@@ -89,7 +89,7 @@
__u8 family;
__u8 prefix_len;
int port;
- __be32 addr[0];
+ __be32 addr[];
};
struct inet_diag_markcond {
__u32 mark;
diff --git a/libc/kernel/uapi/linux/inotify.h b/libc/kernel/uapi/linux/inotify.h
index eb9ac3c..3b4b577 100644
--- a/libc/kernel/uapi/linux/inotify.h
+++ b/libc/kernel/uapi/linux/inotify.h
@@ -25,7 +25,7 @@
__u32 mask;
__u32 cookie;
__u32 len;
- char name[0];
+ char name[];
};
#define IN_ACCESS 0x00000001
#define IN_MODIFY 0x00000002
diff --git a/libc/kernel/uapi/linux/input-event-codes.h b/libc/kernel/uapi/linux/input-event-codes.h
index 34cd23c..712a9db 100644
--- a/libc/kernel/uapi/linux/input-event-codes.h
+++ b/libc/kernel/uapi/linux/input-event-codes.h
@@ -551,6 +551,9 @@
#define KEY_KBD_LAYOUT_NEXT 0x248
#define KEY_EMOJI_PICKER 0x249
#define KEY_DICTATE 0x24a
+#define KEY_CAMERA_ACCESS_ENABLE 0x24b
+#define KEY_CAMERA_ACCESS_DISABLE 0x24c
+#define KEY_CAMERA_ACCESS_TOGGLE 0x24d
#define KEY_BRIGHTNESS_MIN 0x250
#define KEY_BRIGHTNESS_MAX 0x251
#define KEY_KBDINPUTASSIST_PREV 0x260
@@ -580,6 +583,21 @@
#define KEY_ONSCREEN_KEYBOARD 0x278
#define KEY_PRIVACY_SCREEN_TOGGLE 0x279
#define KEY_SELECTIVE_SCREENSHOT 0x27a
+#define KEY_NEXT_ELEMENT 0x27b
+#define KEY_PREVIOUS_ELEMENT 0x27c
+#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
+#define KEY_MARK_WAYPOINT 0x27e
+#define KEY_SOS 0x27f
+#define KEY_NAV_CHART 0x280
+#define KEY_FISHING_CHART 0x281
+#define KEY_SINGLE_RANGE_RADAR 0x282
+#define KEY_DUAL_RANGE_RADAR 0x283
+#define KEY_RADAR_OVERLAY 0x284
+#define KEY_TRADITIONAL_SONAR 0x285
+#define KEY_CLEARVU_SONAR 0x286
+#define KEY_SIDEVU_SONAR 0x287
+#define KEY_NAV_INFO 0x288
+#define KEY_BRIGHTNESS_MENU 0x289
#define KEY_MACRO1 0x290
#define KEY_MACRO2 0x291
#define KEY_MACRO3 0x292
@@ -705,6 +723,7 @@
#define ABS_TILT_Y 0x1b
#define ABS_TOOL_WIDTH 0x1c
#define ABS_VOLUME 0x20
+#define ABS_PROFILE 0x21
#define ABS_MISC 0x28
#define ABS_RESERVED 0x2e
#define ABS_MT_SLOT 0x2f
diff --git a/libc/kernel/uapi/linux/input.h b/libc/kernel/uapi/linux/input.h
index fe17226..1df1398 100644
--- a/libc/kernel/uapi/linux/input.h
+++ b/libc/kernel/uapi/linux/input.h
@@ -125,6 +125,7 @@
#define BUS_RMI 0x1D
#define BUS_CEC 0x1E
#define BUS_INTEL_ISHTP 0x1F
+#define BUS_AMD_SFH 0x20
#define MT_TOOL_FINGER 0x00
#define MT_TOOL_PEN 0x01
#define MT_TOOL_PALM 0x02
@@ -172,7 +173,7 @@
__u16 phase;
struct ff_envelope envelope;
__u32 custom_len;
- __s16 __user * custom_data;
+ __s16 * custom_data;
};
struct ff_rumble_effect {
__u16 strong_magnitude;
diff --git a/libc/kernel/uapi/linux/io_uring.h b/libc/kernel/uapi/linux/io_uring.h
index 96944f8..5561448 100644
--- a/libc/kernel/uapi/linux/io_uring.h
+++ b/libc/kernel/uapi/linux/io_uring.h
@@ -20,6 +20,12 @@
#define LINUX_IO_URING_H
#include <linux/fs.h>
#include <linux/types.h>
+#ifndef UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H
+#include <linux/time_types.h>
+#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
struct io_uring_sqe {
__u8 opcode;
__u8 flags;
@@ -28,6 +34,10 @@
union {
__u64 off;
__u64 addr2;
+ struct {
+ __u32 cmd_op;
+ __u32 __pad1;
+ };
};
union {
__u64 addr;
@@ -51,6 +61,9 @@
__u32 rename_flags;
__u32 unlink_flags;
__u32 hardlink_flags;
+ __u32 xattr_flags;
+ __u32 msg_ring_flags;
+ __u32 uring_cmd_flags;
};
__u64 user_data;
union {
@@ -61,9 +74,20 @@
union {
__s32 splice_fd_in;
__u32 file_index;
+ struct {
+ __u16 addr_len;
+ __u16 __pad3[1];
+ };
};
- __u64 __pad2[2];
+ union {
+ struct {
+ __u64 addr3;
+ __u64 __pad2[1];
+ };
+ __u8 cmd[0];
+ };
};
+#define IORING_FILE_INDEX_ALLOC (~0U)
enum {
IOSQE_FIXED_FILE_BIT,
IOSQE_IO_DRAIN_BIT,
@@ -87,7 +111,14 @@
#define IORING_SETUP_CLAMP (1U << 4)
#define IORING_SETUP_ATTACH_WQ (1U << 5)
#define IORING_SETUP_R_DISABLED (1U << 6)
-enum {
+#define IORING_SETUP_SUBMIT_ALL (1U << 7)
+#define IORING_SETUP_COOP_TASKRUN (1U << 8)
+#define IORING_SETUP_TASKRUN_FLAG (1U << 9)
+#define IORING_SETUP_SQE128 (1U << 10)
+#define IORING_SETUP_CQE32 (1U << 11)
+#define IORING_SETUP_SINGLE_ISSUER (1U << 12)
+#define IORING_SETUP_DEFER_TASKRUN (1U << 13)
+enum io_uring_op {
IORING_OP_NOP,
IORING_OP_READV,
IORING_OP_WRITEV,
@@ -128,8 +159,18 @@
IORING_OP_MKDIRAT,
IORING_OP_SYMLINKAT,
IORING_OP_LINKAT,
+ IORING_OP_MSG_RING,
+ IORING_OP_FSETXATTR,
+ IORING_OP_SETXATTR,
+ IORING_OP_FGETXATTR,
+ IORING_OP_GETXATTR,
+ IORING_OP_SOCKET,
+ IORING_OP_URING_CMD,
+ IORING_OP_SEND_ZC,
+ IORING_OP_SENDMSG_ZC,
IORING_OP_LAST,
};
+#define IORING_URING_CMD_FIXED (1U << 0)
#define IORING_FSYNC_DATASYNC (1U << 0)
#define IORING_TIMEOUT_ABS (1U << 0)
#define IORING_TIMEOUT_UPDATE (1U << 1)
@@ -143,13 +184,32 @@
#define IORING_POLL_ADD_MULTI (1U << 0)
#define IORING_POLL_UPDATE_EVENTS (1U << 1)
#define IORING_POLL_UPDATE_USER_DATA (1U << 2)
+#define IORING_POLL_ADD_LEVEL (1U << 3)
+#define IORING_ASYNC_CANCEL_ALL (1U << 0)
+#define IORING_ASYNC_CANCEL_FD (1U << 1)
+#define IORING_ASYNC_CANCEL_ANY (1U << 2)
+#define IORING_ASYNC_CANCEL_FD_FIXED (1U << 3)
+#define IORING_RECVSEND_POLL_FIRST (1U << 0)
+#define IORING_RECV_MULTISHOT (1U << 1)
+#define IORING_RECVSEND_FIXED_BUF (1U << 2)
+#define IORING_SEND_ZC_REPORT_USAGE (1U << 3)
+#define IORING_NOTIF_USAGE_ZC_COPIED (1U << 31)
+#define IORING_ACCEPT_MULTISHOT (1U << 0)
+enum {
+ IORING_MSG_DATA,
+ IORING_MSG_SEND_FD,
+};
+#define IORING_MSG_RING_CQE_SKIP (1U << 0)
struct io_uring_cqe {
__u64 user_data;
__s32 res;
__u32 flags;
+ __u64 big_cqe[];
};
#define IORING_CQE_F_BUFFER (1U << 0)
#define IORING_CQE_F_MORE (1U << 1)
+#define IORING_CQE_F_SOCK_NONEMPTY (1U << 2)
+#define IORING_CQE_F_NOTIF (1U << 3)
enum {
IORING_CQE_BUFFER_SHIFT = 16,
};
@@ -169,6 +229,7 @@
};
#define IORING_SQ_NEED_WAKEUP (1U << 0)
#define IORING_SQ_CQ_OVERFLOW (1U << 1)
+#define IORING_SQ_TASKRUN (1U << 2)
struct io_cqring_offsets {
__u32 head;
__u32 tail;
@@ -185,6 +246,7 @@
#define IORING_ENTER_SQ_WAKEUP (1U << 1)
#define IORING_ENTER_SQ_WAIT (1U << 2)
#define IORING_ENTER_EXT_ARG (1U << 3)
+#define IORING_ENTER_REGISTERED_RING (1U << 4)
struct io_uring_params {
__u32 sq_entries;
__u32 cq_entries;
@@ -209,6 +271,7 @@
#define IORING_FEAT_NATIVE_WORKERS (1U << 9)
#define IORING_FEAT_RSRC_TAGS (1U << 10)
#define IORING_FEAT_CQE_SKIP (1U << 11)
+#define IORING_FEAT_LINKED_FILE (1U << 12)
enum {
IORING_REGISTER_BUFFERS = 0,
IORING_UNREGISTER_BUFFERS = 1,
@@ -230,6 +293,12 @@
IORING_REGISTER_IOWQ_AFF = 17,
IORING_UNREGISTER_IOWQ_AFF = 18,
IORING_REGISTER_IOWQ_MAX_WORKERS = 19,
+ IORING_REGISTER_RING_FDS = 20,
+ IORING_UNREGISTER_RING_FDS = 21,
+ IORING_REGISTER_PBUF_RING = 22,
+ IORING_UNREGISTER_PBUF_RING = 23,
+ IORING_REGISTER_SYNC_CANCEL = 24,
+ IORING_REGISTER_FILE_ALLOC_RANGE = 25,
IORING_REGISTER_LAST
};
enum {
@@ -241,9 +310,10 @@
__u32 resv;
__aligned_u64 fds;
};
+#define IORING_RSRC_REGISTER_SPARSE (1U << 0)
struct io_uring_rsrc_register {
__u32 nr;
- __u32 resv;
+ __u32 flags;
__u64 resv2;
__aligned_u64 data;
__aligned_u64 tags;
@@ -261,6 +331,17 @@
__u32 nr;
__u32 resv2;
};
+struct io_uring_notification_slot {
+ __u64 tag;
+ __u64 resv[3];
+};
+struct io_uring_notification_register {
+ __u32 nr_slots;
+ __u32 resv;
+ __u64 resv2;
+ __u64 data;
+ __u64 resv3;
+};
#define IORING_REGISTER_FILES_SKIP (- 2)
#define IO_URING_OP_SUPPORTED (1U << 0)
struct io_uring_probe_op {
@@ -274,7 +355,7 @@
__u8 ops_len;
__u16 resv;
__u32 resv2[3];
- struct io_uring_probe_op ops[0];
+ struct io_uring_probe_op ops[];
};
struct io_uring_restriction {
__u16 opcode;
@@ -286,6 +367,30 @@
__u8 resv;
__u32 resv2[3];
};
+struct io_uring_buf {
+ __u64 addr;
+ __u32 len;
+ __u16 bid;
+ __u16 resv;
+};
+struct io_uring_buf_ring {
+ union {
+ struct {
+ __u64 resv1;
+ __u32 resv2;
+ __u16 resv3;
+ __u16 tail;
+ };
+ struct io_uring_buf bufs[0];
+ };
+};
+struct io_uring_buf_reg {
+ __u64 ring_addr;
+ __u32 ring_entries;
+ __u16 bgid;
+ __u16 pad;
+ __u64 resv[3];
+};
enum {
IORING_RESTRICTION_REGISTER_OP = 0,
IORING_RESTRICTION_SQE_OP = 1,
@@ -299,4 +404,25 @@
__u32 pad;
__u64 ts;
};
+struct io_uring_sync_cancel_reg {
+ __u64 addr;
+ __s32 fd;
+ __u32 flags;
+ struct __kernel_timespec timeout;
+ __u64 pad[4];
+};
+struct io_uring_file_index_range {
+ __u32 off;
+ __u32 len;
+ __u64 resv;
+};
+struct io_uring_recvmsg_out {
+ __u32 namelen;
+ __u32 controllen;
+ __u32 payloadlen;
+ __u32 flags;
+};
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/libc/kernel/uapi/linux/ioam6_iptunnel.h b/libc/kernel/uapi/linux/ioam6_iptunnel.h
index 7426225..ec1a6a8 100644
--- a/libc/kernel/uapi/linux/ioam6_iptunnel.h
+++ b/libc/kernel/uapi/linux/ioam6_iptunnel.h
@@ -32,6 +32,10 @@
IOAM6_IPTUNNEL_MODE,
IOAM6_IPTUNNEL_DST,
IOAM6_IPTUNNEL_TRACE,
+#define IOAM6_IPTUNNEL_FREQ_MIN 1
+#define IOAM6_IPTUNNEL_FREQ_MAX 1000000
+ IOAM6_IPTUNNEL_FREQ_K,
+ IOAM6_IPTUNNEL_FREQ_N,
__IOAM6_IPTUNNEL_MAX,
};
#define IOAM6_IPTUNNEL_MAX (__IOAM6_IPTUNNEL_MAX - 1)
diff --git a/libc/kernel/uapi/linux/iommu.h b/libc/kernel/uapi/linux/iommu.h
index 0a0af92..0304a32 100644
--- a/libc/kernel/uapi/linux/iommu.h
+++ b/libc/kernel/uapi/linux/iommu.h
@@ -85,76 +85,4 @@
__u32 grpid;
__u32 code;
};
-enum iommu_inv_granularity {
- IOMMU_INV_GRANU_DOMAIN,
- IOMMU_INV_GRANU_PASID,
- IOMMU_INV_GRANU_ADDR,
- IOMMU_INV_GRANU_NR,
-};
-struct iommu_inv_addr_info {
-#define IOMMU_INV_ADDR_FLAGS_PASID (1 << 0)
-#define IOMMU_INV_ADDR_FLAGS_ARCHID (1 << 1)
-#define IOMMU_INV_ADDR_FLAGS_LEAF (1 << 2)
- __u32 flags;
- __u32 archid;
- __u64 pasid;
- __u64 addr;
- __u64 granule_size;
- __u64 nb_granules;
-};
-struct iommu_inv_pasid_info {
-#define IOMMU_INV_PASID_FLAGS_PASID (1 << 0)
-#define IOMMU_INV_PASID_FLAGS_ARCHID (1 << 1)
- __u32 flags;
- __u32 archid;
- __u64 pasid;
-};
-struct iommu_cache_invalidate_info {
- __u32 argsz;
-#define IOMMU_CACHE_INVALIDATE_INFO_VERSION_1 1
- __u32 version;
-#define IOMMU_CACHE_INV_TYPE_IOTLB (1 << 0)
-#define IOMMU_CACHE_INV_TYPE_DEV_IOTLB (1 << 1)
-#define IOMMU_CACHE_INV_TYPE_PASID (1 << 2)
-#define IOMMU_CACHE_INV_TYPE_NR (3)
- __u8 cache;
- __u8 granularity;
- __u8 padding[6];
- union {
- struct iommu_inv_pasid_info pasid_info;
- struct iommu_inv_addr_info addr_info;
- } granu;
-};
-struct iommu_gpasid_bind_data_vtd {
-#define IOMMU_SVA_VTD_GPASID_SRE (1 << 0)
-#define IOMMU_SVA_VTD_GPASID_EAFE (1 << 1)
-#define IOMMU_SVA_VTD_GPASID_PCD (1 << 2)
-#define IOMMU_SVA_VTD_GPASID_PWT (1 << 3)
-#define IOMMU_SVA_VTD_GPASID_EMTE (1 << 4)
-#define IOMMU_SVA_VTD_GPASID_CD (1 << 5)
-#define IOMMU_SVA_VTD_GPASID_WPE (1 << 6)
-#define IOMMU_SVA_VTD_GPASID_LAST (1 << 7)
- __u64 flags;
- __u32 pat;
- __u32 emt;
-};
-#define IOMMU_SVA_VTD_GPASID_MTS_MASK (IOMMU_SVA_VTD_GPASID_CD | IOMMU_SVA_VTD_GPASID_EMTE | IOMMU_SVA_VTD_GPASID_PCD | IOMMU_SVA_VTD_GPASID_PWT)
-struct iommu_gpasid_bind_data {
- __u32 argsz;
-#define IOMMU_GPASID_BIND_VERSION_1 1
- __u32 version;
-#define IOMMU_PASID_FORMAT_INTEL_VTD 1
-#define IOMMU_PASID_FORMAT_LAST 2
- __u32 format;
- __u32 addr_width;
-#define IOMMU_SVA_GPASID_VAL (1 << 0)
- __u64 flags;
- __u64 gpgd;
- __u64 hpasid;
- __u64 gpasid;
- __u8 padding[8];
- union {
- struct iommu_gpasid_bind_data_vtd vtd;
- } vendor;
-};
#endif
diff --git a/libc/kernel/uapi/linux/iommufd.h b/libc/kernel/uapi/linux/iommufd.h
new file mode 100644
index 0000000..b7f5815
--- /dev/null
+++ b/libc/kernel/uapi/linux/iommufd.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_IOMMUFD_H
+#define _UAPI_IOMMUFD_H
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#define IOMMUFD_TYPE (';')
+enum {
+ IOMMUFD_CMD_BASE = 0x80,
+ IOMMUFD_CMD_DESTROY = IOMMUFD_CMD_BASE,
+ IOMMUFD_CMD_IOAS_ALLOC,
+ IOMMUFD_CMD_IOAS_ALLOW_IOVAS,
+ IOMMUFD_CMD_IOAS_COPY,
+ IOMMUFD_CMD_IOAS_IOVA_RANGES,
+ IOMMUFD_CMD_IOAS_MAP,
+ IOMMUFD_CMD_IOAS_UNMAP,
+ IOMMUFD_CMD_OPTION,
+ IOMMUFD_CMD_VFIO_IOAS,
+};
+struct iommu_destroy {
+ __u32 size;
+ __u32 id;
+};
+#define IOMMU_DESTROY _IO(IOMMUFD_TYPE, IOMMUFD_CMD_DESTROY)
+struct iommu_ioas_alloc {
+ __u32 size;
+ __u32 flags;
+ __u32 out_ioas_id;
+};
+#define IOMMU_IOAS_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_ALLOC)
+struct iommu_iova_range {
+ __aligned_u64 start;
+ __aligned_u64 last;
+};
+struct iommu_ioas_iova_ranges {
+ __u32 size;
+ __u32 ioas_id;
+ __u32 num_iovas;
+ __u32 __reserved;
+ __aligned_u64 allowed_iovas;
+ __aligned_u64 out_iova_alignment;
+};
+#define IOMMU_IOAS_IOVA_RANGES _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_IOVA_RANGES)
+struct iommu_ioas_allow_iovas {
+ __u32 size;
+ __u32 ioas_id;
+ __u32 num_iovas;
+ __u32 __reserved;
+ __aligned_u64 allowed_iovas;
+};
+#define IOMMU_IOAS_ALLOW_IOVAS _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_ALLOW_IOVAS)
+enum iommufd_ioas_map_flags {
+ IOMMU_IOAS_MAP_FIXED_IOVA = 1 << 0,
+ IOMMU_IOAS_MAP_WRITEABLE = 1 << 1,
+ IOMMU_IOAS_MAP_READABLE = 1 << 2,
+};
+struct iommu_ioas_map {
+ __u32 size;
+ __u32 flags;
+ __u32 ioas_id;
+ __u32 __reserved;
+ __aligned_u64 user_va;
+ __aligned_u64 length;
+ __aligned_u64 iova;
+};
+#define IOMMU_IOAS_MAP _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_MAP)
+struct iommu_ioas_copy {
+ __u32 size;
+ __u32 flags;
+ __u32 dst_ioas_id;
+ __u32 src_ioas_id;
+ __aligned_u64 length;
+ __aligned_u64 dst_iova;
+ __aligned_u64 src_iova;
+};
+#define IOMMU_IOAS_COPY _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_COPY)
+struct iommu_ioas_unmap {
+ __u32 size;
+ __u32 ioas_id;
+ __aligned_u64 iova;
+ __aligned_u64 length;
+};
+#define IOMMU_IOAS_UNMAP _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_UNMAP)
+enum iommufd_option {
+ IOMMU_OPTION_RLIMIT_MODE = 0,
+ IOMMU_OPTION_HUGE_PAGES = 1,
+};
+enum iommufd_option_ops {
+ IOMMU_OPTION_OP_SET = 0,
+ IOMMU_OPTION_OP_GET = 1,
+};
+struct iommu_option {
+ __u32 size;
+ __u32 option_id;
+ __u16 op;
+ __u16 __reserved;
+ __u32 object_id;
+ __aligned_u64 val64;
+};
+#define IOMMU_OPTION _IO(IOMMUFD_TYPE, IOMMUFD_CMD_OPTION)
+enum iommufd_vfio_ioas_op {
+ IOMMU_VFIO_IOAS_GET = 0,
+ IOMMU_VFIO_IOAS_SET = 1,
+ IOMMU_VFIO_IOAS_CLEAR = 2,
+};
+struct iommu_vfio_ioas {
+ __u32 size;
+ __u32 ioas_id;
+ __u16 op;
+ __u16 __reserved;
+};
+#define IOMMU_VFIO_IOAS _IO(IOMMUFD_TYPE, IOMMUFD_CMD_VFIO_IOAS)
+#endif
diff --git a/libc/kernel/uapi/linux/ip.h b/libc/kernel/uapi/linux/ip.h
index 9571cac..9249f5c 100644
--- a/libc/kernel/uapi/linux/ip.h
+++ b/libc/kernel/uapi/linux/ip.h
@@ -19,6 +19,7 @@
#ifndef _UAPI_LINUX_IP_H
#define _UAPI_LINUX_IP_H
#include <linux/types.h>
+#include <linux/stddef.h>
#include <asm/byteorder.h>
#define IPTOS_TOS_MASK 0x1E
#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
@@ -86,8 +87,9 @@
__u8 ttl;
__u8 protocol;
__sum16 check;
- __be32 saddr;
+ __struct_group(, addrs,, __be32 saddr;
__be32 daddr;
+ );
};
struct ip_auth_hdr {
__u8 nexthdr;
@@ -95,12 +97,12 @@
__be16 reserved;
__be32 spi;
__be32 seq_no;
- __u8 auth_data[0];
+ __u8 auth_data[];
};
struct ip_esp_hdr {
__be32 spi;
__be32 seq_no;
- __u8 enc_data[0];
+ __u8 enc_data[];
};
struct ip_comp_hdr {
__u8 nexthdr;
diff --git a/libc/kernel/uapi/linux/ip_vs.h b/libc/kernel/uapi/linux/ip_vs.h
index 6e3defe..916fcf0 100644
--- a/libc/kernel/uapi/linux/ip_vs.h
+++ b/libc/kernel/uapi/linux/ip_vs.h
@@ -159,11 +159,11 @@
__be16 port;
__u32 fwmark;
unsigned int num_dests;
- struct ip_vs_dest_entry entrytable[0];
+ struct ip_vs_dest_entry entrytable[];
};
struct ip_vs_get_services {
unsigned int num_services;
- struct ip_vs_service_entry entrytable[0];
+ struct ip_vs_service_entry entrytable[];
};
struct ip_vs_timeout_user {
int tcp_timeout;
diff --git a/libc/kernel/uapi/linux/ipc.h b/libc/kernel/uapi/linux/ipc.h
index a0699cf..4ca9ee1 100644
--- a/libc/kernel/uapi/linux/ipc.h
+++ b/libc/kernel/uapi/linux/ipc.h
@@ -42,7 +42,7 @@
#define IPC_OLD 0
#define IPC_64 0x0100
struct ipc_kludge {
- struct msgbuf __user * msgp;
+ struct msgbuf * msgp;
long msgtyp;
};
#define SEMOP 1
diff --git a/libc/kernel/uapi/linux/ipmi.h b/libc/kernel/uapi/linux/ipmi.h
index dd88f2f..bd73b3c 100644
--- a/libc/kernel/uapi/linux/ipmi.h
+++ b/libc/kernel/uapi/linux/ipmi.h
@@ -65,7 +65,7 @@
unsigned char netfn;
unsigned char cmd;
unsigned short data_len;
- unsigned char __user * data;
+ unsigned char * data;
};
struct kernel_ipmi_msg {
unsigned char netfn;
@@ -86,7 +86,7 @@
#define IPMI_MAINTENANCE_MODE_ON 2
#define IPMI_IOC_MAGIC 'i'
struct ipmi_req {
- unsigned char __user * addr;
+ unsigned char * addr;
unsigned int addr_len;
long msgid;
struct ipmi_msg msg;
@@ -100,7 +100,7 @@
#define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, struct ipmi_req_settime)
struct ipmi_recv {
int recv_type;
- unsigned char __user * addr;
+ unsigned char * addr;
unsigned int addr_len;
long msgid;
struct ipmi_msg msg;
diff --git a/libc/kernel/uapi/linux/ipmi_ssif_bmc.h b/libc/kernel/uapi/linux/ipmi_ssif_bmc.h
new file mode 100644
index 0000000..866ed17
--- /dev/null
+++ b/libc/kernel/uapi/linux/ipmi_ssif_bmc.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_IPMI_SSIF_BMC_H
+#define _UAPI_LINUX_IPMI_SSIF_BMC_H
+#include <linux/types.h>
+#define IPMI_SSIF_PAYLOAD_MAX 254
+struct ipmi_ssif_msg {
+ unsigned int len;
+ __u8 payload[IPMI_SSIF_PAYLOAD_MAX];
+};
+#endif
diff --git a/libc/kernel/uapi/linux/ipv6.h b/libc/kernel/uapi/linux/ipv6.h
index b3db9ce..d62d269 100644
--- a/libc/kernel/uapi/linux/ipv6.h
+++ b/libc/kernel/uapi/linux/ipv6.h
@@ -20,6 +20,7 @@
#define _UAPI_IPV6_H
#include <linux/libc-compat.h>
#include <linux/types.h>
+#include <linux/stddef.h>
#include <linux/in6.h>
#include <asm/byteorder.h>
#define IPV6_MIN_MTU 1280
@@ -87,8 +88,9 @@
__be16 payload_len;
__u8 nexthdr;
__u8 hop_limit;
- struct in6_addr saddr;
+ __struct_group(, addrs,, struct in6_addr saddr;
struct in6_addr daddr;
+ );
};
enum {
DEVCONF_FORWARDING = 0,
@@ -148,6 +150,7 @@
DEVCONF_IOAM6_ID,
DEVCONF_IOAM6_ID_WIDE,
DEVCONF_NDISC_EVICT_NOCARRIER,
+ DEVCONF_ACCEPT_UNTRACKED_NA,
DEVCONF_MAX
};
#endif
diff --git a/libc/kernel/uapi/linux/iso_fs.h b/libc/kernel/uapi/linux/iso_fs.h
index 8227031..f9c4f48 100644
--- a/libc/kernel/uapi/linux/iso_fs.h
+++ b/libc/kernel/uapi/linux/iso_fs.h
@@ -132,7 +132,7 @@
__u8 name_len[2];
__u8 extent[4];
__u8 parent[2];
- char name[0];
+ char name[];
} __attribute__((packed));
struct iso_directory_record {
__u8 length[ISODCL(1, 1)];
@@ -145,7 +145,7 @@
__u8 interleave[ISODCL(28, 28)];
__u8 volume_sequence_number[ISODCL(29, 32)];
__u8 name_len[ISODCL(33, 33)];
- char name[0];
+ char name[];
} __attribute__((packed));
#define ISOFS_BLOCK_BITS 11
#define ISOFS_BLOCK_SIZE 2048
diff --git a/libc/kernel/uapi/linux/ivtv.h b/libc/kernel/uapi/linux/ivtv.h
index 549d6a8..bdd526e 100644
--- a/libc/kernel/uapi/linux/ivtv.h
+++ b/libc/kernel/uapi/linux/ivtv.h
@@ -24,8 +24,8 @@
struct ivtv_dma_frame {
enum v4l2_buf_type type;
__u32 pixelformat;
- void __user * y_source;
- void __user * uv_source;
+ void * y_source;
+ void * uv_source;
struct v4l2_rect src;
struct v4l2_rect dst;
__u32 src_width;
diff --git a/libc/kernel/uapi/linux/ivtvfb.h b/libc/kernel/uapi/linux/ivtvfb.h
index 9addcbf..171be74 100644
--- a/libc/kernel/uapi/linux/ivtvfb.h
+++ b/libc/kernel/uapi/linux/ivtvfb.h
@@ -21,7 +21,7 @@
#include <linux/compiler.h>
#include <linux/types.h>
struct ivtvfb_dma_frame {
- void __user * source;
+ void * source;
unsigned long dest_offset;
int count;
};
diff --git a/libc/kernel/uapi/linux/jffs2.h b/libc/kernel/uapi/linux/jffs2.h
index 698f953..643aa2e 100644
--- a/libc/kernel/uapi/linux/jffs2.h
+++ b/libc/kernel/uapi/linux/jffs2.h
@@ -86,7 +86,7 @@
__u8 unused[2];
jint32_t node_crc;
jint32_t name_crc;
- __u8 name[0];
+ __u8 name[];
};
struct jffs2_raw_inode {
jint16_t magic;
@@ -110,7 +110,7 @@
jint16_t flags;
jint32_t data_crc;
jint32_t node_crc;
- __u8 data[0];
+ __u8 data[];
};
struct jffs2_raw_xattr {
jint16_t magic;
@@ -124,7 +124,7 @@
jint16_t value_len;
jint32_t data_crc;
jint32_t node_crc;
- __u8 data[0];
+ __u8 data[];
} __attribute__((packed));
struct jffs2_raw_xref {
jint16_t magic;
@@ -146,7 +146,7 @@
jint32_t padded;
jint32_t sum_crc;
jint32_t node_crc;
- jint32_t sum[0];
+ jint32_t sum[];
};
union jffs2_node_union {
struct jffs2_raw_inode i;
diff --git a/libc/kernel/uapi/linux/kcov.h b/libc/kernel/uapi/linux/kcov.h
index cf2660b..5b6f6b1 100644
--- a/libc/kernel/uapi/linux/kcov.h
+++ b/libc/kernel/uapi/linux/kcov.h
@@ -24,7 +24,7 @@
__u32 area_size;
__u32 num_handles;
__aligned_u64 common_handle;
- __aligned_u64 handles[0];
+ __aligned_u64 handles[];
};
#define KCOV_REMOTE_MAX_HANDLES 0x100
#define KCOV_INIT_TRACE _IOR('c', 1, unsigned long)
diff --git a/libc/kernel/uapi/linux/kd.h b/libc/kernel/uapi/linux/kd.h
index 2385037..903681b 100644
--- a/libc/kernel/uapi/linux/kd.h
+++ b/libc/kernel/uapi/linux/kd.h
@@ -27,7 +27,7 @@
struct consolefontdesc {
unsigned short charcount;
unsigned short charheight;
- char __user * chardata;
+ char * chardata;
};
#define PIO_FONTRESET 0x4B6D
#define GIO_CMAP 0x4B70
@@ -68,7 +68,7 @@
};
struct unimapdesc {
unsigned short entry_ct;
- struct unipair __user * entries;
+ struct unipair * entries;
};
#define PIO_UNIMAP 0x4B67
#define PIO_UNIMAPCLR 0x4B68
@@ -147,7 +147,7 @@
unsigned int flags;
unsigned int width, height;
unsigned int charcount;
- unsigned char __user * data;
+ unsigned char * data;
};
struct console_font {
unsigned int width, height;
diff --git a/libc/kernel/uapi/linux/kexec.h b/libc/kernel/uapi/linux/kexec.h
index 2e3bd0c..438c07b 100644
--- a/libc/kernel/uapi/linux/kexec.h
+++ b/libc/kernel/uapi/linux/kexec.h
@@ -40,11 +40,12 @@
#define KEXEC_ARCH_MIPS (8 << 16)
#define KEXEC_ARCH_AARCH64 (183 << 16)
#define KEXEC_ARCH_RISCV (243 << 16)
+#define KEXEC_ARCH_LOONGARCH (258 << 16)
#define KEXEC_SEGMENT_MAX 16
struct kexec_segment {
const void * buf;
- size_t bufsz;
+ __kernel_size_t bufsz;
const void * mem;
- size_t memsz;
+ __kernel_size_t memsz;
};
#endif
diff --git a/libc/kernel/uapi/linux/keyctl.h b/libc/kernel/uapi/linux/keyctl.h
index 01ea576..b534f5e 100644
--- a/libc/kernel/uapi/linux/keyctl.h
+++ b/libc/kernel/uapi/linux/keyctl.h
@@ -80,8 +80,8 @@
__s32 base;
};
struct keyctl_kdf_params {
- char __user * hashname;
- char __user * otherinfo;
+ char * hashname;
+ char * otherinfo;
__u32 otherinfolen;
__u32 __spare[8];
};
diff --git a/libc/kernel/uapi/linux/kfd_ioctl.h b/libc/kernel/uapi/linux/kfd_ioctl.h
index c52ac64..d21e0fc 100644
--- a/libc/kernel/uapi/linux/kfd_ioctl.h
+++ b/libc/kernel/uapi/linux/kfd_ioctl.h
@@ -21,7 +21,7 @@
#include <drm/drm.h>
#include <linux/ioctl.h>
#define KFD_IOCTL_MAJOR_VERSION 1
-#define KFD_IOCTL_MINOR_VERSION 6
+#define KFD_IOCTL_MINOR_VERSION 11
struct kfd_ioctl_get_version_args {
__u32 major_version;
__u32 minor_version;
@@ -72,6 +72,11 @@
__u32 queue_id;
__u32 pad;
};
+struct kfd_ioctl_get_available_memory_args {
+ __u64 available;
+ __u32 gpu_id;
+ __u32 pad;
+};
#define KFD_IOC_CACHE_POLICY_COHERENT 0
#define KFD_IOC_CACHE_POLICY_NONCOHERENT 1
struct kfd_ioctl_set_memory_policy_args {
@@ -132,6 +137,7 @@
__u32 gpu_id;
__u32 buf_size_in_bytes;
};
+#define KFD_INVALID_FD 0xffffffff
#define KFD_IOC_EVENT_SIGNAL 0
#define KFD_IOC_EVENT_NODECHANGE 1
#define KFD_IOC_EVENT_DEVICESTATECHANGE 2
@@ -294,12 +300,74 @@
KFD_SMI_EVENT_THERMAL_THROTTLE = 2,
KFD_SMI_EVENT_GPU_PRE_RESET = 3,
KFD_SMI_EVENT_GPU_POST_RESET = 4,
+ KFD_SMI_EVENT_MIGRATE_START = 5,
+ KFD_SMI_EVENT_MIGRATE_END = 6,
+ KFD_SMI_EVENT_PAGE_FAULT_START = 7,
+ KFD_SMI_EVENT_PAGE_FAULT_END = 8,
+ KFD_SMI_EVENT_QUEUE_EVICTION = 9,
+ KFD_SMI_EVENT_QUEUE_RESTORE = 10,
+ KFD_SMI_EVENT_UNMAP_FROM_GPU = 11,
+ KFD_SMI_EVENT_ALL_PROCESS = 64
+};
+enum KFD_MIGRATE_TRIGGERS {
+ KFD_MIGRATE_TRIGGER_PREFETCH,
+ KFD_MIGRATE_TRIGGER_PAGEFAULT_GPU,
+ KFD_MIGRATE_TRIGGER_PAGEFAULT_CPU,
+ KFD_MIGRATE_TRIGGER_TTM_EVICTION
+};
+enum KFD_QUEUE_EVICTION_TRIGGERS {
+ KFD_QUEUE_EVICTION_TRIGGER_SVM,
+ KFD_QUEUE_EVICTION_TRIGGER_USERPTR,
+ KFD_QUEUE_EVICTION_TRIGGER_TTM,
+ KFD_QUEUE_EVICTION_TRIGGER_SUSPEND,
+ KFD_QUEUE_EVICTION_CRIU_CHECKPOINT,
+ KFD_QUEUE_EVICTION_CRIU_RESTORE
+};
+enum KFD_SVM_UNMAP_TRIGGERS {
+ KFD_SVM_UNMAP_TRIGGER_MMU_NOTIFY,
+ KFD_SVM_UNMAP_TRIGGER_MMU_NOTIFY_MIGRATE,
+ KFD_SVM_UNMAP_TRIGGER_UNMAP_FROM_CPU
};
#define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
+#define KFD_SMI_EVENT_MSG_SIZE 96
struct kfd_ioctl_smi_events_args {
__u32 gpuid;
__u32 anon_fd;
};
+enum kfd_criu_op {
+ KFD_CRIU_OP_PROCESS_INFO,
+ KFD_CRIU_OP_CHECKPOINT,
+ KFD_CRIU_OP_UNPAUSE,
+ KFD_CRIU_OP_RESTORE,
+ KFD_CRIU_OP_RESUME,
+};
+struct kfd_ioctl_criu_args {
+ __u64 devices;
+ __u64 bos;
+ __u64 priv_data;
+ __u64 priv_data_size;
+ __u32 num_devices;
+ __u32 num_bos;
+ __u32 num_objects;
+ __u32 pid;
+ __u32 op;
+};
+struct kfd_criu_device_bucket {
+ __u32 user_gpu_id;
+ __u32 actual_gpu_id;
+ __u32 drm_fd;
+ __u32 pad;
+};
+struct kfd_criu_bo_bucket {
+ __u64 addr;
+ __u64 size;
+ __u64 offset;
+ __u64 restored_offset;
+ __u32 gpu_id;
+ __u32 alloc_flags;
+ __u32 dmabuf_fd;
+ __u32 pad;
+};
enum kfd_mmio_remap {
KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL = 0,
KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL = 4,
@@ -310,6 +378,7 @@
#define KFD_IOCTL_SVM_FLAG_GPU_RO 0x00000008
#define KFD_IOCTL_SVM_FLAG_GPU_EXEC 0x00000010
#define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY 0x00000020
+#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED 0x00000040
enum kfd_ioctl_svm_op {
KFD_IOCTL_SVM_OP_SET_ATTR,
KFD_IOCTL_SVM_OP_GET_ATTR
@@ -337,7 +406,7 @@
__u64 size;
__u32 op;
__u32 nattr;
- struct kfd_ioctl_svm_attribute attrs[0];
+ struct kfd_ioctl_svm_attribute attrs[];
};
struct kfd_ioctl_set_xnack_mode_args {
__s32 xnack_enabled;
@@ -359,10 +428,10 @@
#define AMDKFD_IOC_SET_EVENT AMDKFD_IOW(0x0A, struct kfd_ioctl_set_event_args)
#define AMDKFD_IOC_RESET_EVENT AMDKFD_IOW(0x0B, struct kfd_ioctl_reset_event_args)
#define AMDKFD_IOC_WAIT_EVENTS AMDKFD_IOWR(0x0C, struct kfd_ioctl_wait_events_args)
-#define AMDKFD_IOC_DBG_REGISTER AMDKFD_IOW(0x0D, struct kfd_ioctl_dbg_register_args)
-#define AMDKFD_IOC_DBG_UNREGISTER AMDKFD_IOW(0x0E, struct kfd_ioctl_dbg_unregister_args)
-#define AMDKFD_IOC_DBG_ADDRESS_WATCH AMDKFD_IOW(0x0F, struct kfd_ioctl_dbg_address_watch_args)
-#define AMDKFD_IOC_DBG_WAVE_CONTROL AMDKFD_IOW(0x10, struct kfd_ioctl_dbg_wave_control_args)
+#define AMDKFD_IOC_DBG_REGISTER_DEPRECATED AMDKFD_IOW(0x0D, struct kfd_ioctl_dbg_register_args)
+#define AMDKFD_IOC_DBG_UNREGISTER_DEPRECATED AMDKFD_IOW(0x0E, struct kfd_ioctl_dbg_unregister_args)
+#define AMDKFD_IOC_DBG_ADDRESS_WATCH_DEPRECATED AMDKFD_IOW(0x0F, struct kfd_ioctl_dbg_address_watch_args)
+#define AMDKFD_IOC_DBG_WAVE_CONTROL_DEPRECATED AMDKFD_IOW(0x10, struct kfd_ioctl_dbg_wave_control_args)
#define AMDKFD_IOC_SET_SCRATCH_BACKING_VA AMDKFD_IOWR(0x11, struct kfd_ioctl_set_scratch_backing_va_args)
#define AMDKFD_IOC_GET_TILE_CONFIG AMDKFD_IOWR(0x12, struct kfd_ioctl_get_tile_config_args)
#define AMDKFD_IOC_SET_TRAP_HANDLER AMDKFD_IOW(0x13, struct kfd_ioctl_set_trap_handler_args)
@@ -380,6 +449,8 @@
#define AMDKFD_IOC_SMI_EVENTS AMDKFD_IOWR(0x1F, struct kfd_ioctl_smi_events_args)
#define AMDKFD_IOC_SVM AMDKFD_IOWR(0x20, struct kfd_ioctl_svm_args)
#define AMDKFD_IOC_SET_XNACK_MODE AMDKFD_IOWR(0x21, struct kfd_ioctl_set_xnack_mode_args)
+#define AMDKFD_IOC_CRIU_OP AMDKFD_IOWR(0x22, struct kfd_ioctl_criu_args)
+#define AMDKFD_IOC_AVAILABLE_MEMORY AMDKFD_IOWR(0x23, struct kfd_ioctl_get_available_memory_args)
#define AMDKFD_COMMAND_START 0x01
-#define AMDKFD_COMMAND_END 0x22
+#define AMDKFD_COMMAND_END 0x24
#endif
diff --git a/libc/kernel/uapi/linux/kvm.h b/libc/kernel/uapi/linux/kvm.h
index 1cf7182..9d33399 100644
--- a/libc/kernel/uapi/linux/kvm.h
+++ b/libc/kernel/uapi/linux/kvm.h
@@ -77,12 +77,6 @@
__u32 singlestep;
};
#define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest)
-struct kvm_memory_region {
- __u32 slot;
- __u32 flags;
- __u64 guest_phys_addr;
- __u64 memory_size;
-};
struct kvm_userspace_memory_region {
__u32 slot;
__u32 flags;
@@ -216,6 +210,8 @@
#define KVM_EXIT_X86_BUS_LOCK 33
#define KVM_EXIT_XEN 34
#define KVM_EXIT_RISCV_SBI 35
+#define KVM_EXIT_RISCV_CSR 36
+#define KVM_EXIT_NOTIFY 37
#define KVM_INTERNAL_ERROR_EMULATION 1
#define KVM_INTERNAL_ERROR_SIMUL_EX 2
#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
@@ -336,8 +332,15 @@
#define KVM_SYSTEM_EVENT_SHUTDOWN 1
#define KVM_SYSTEM_EVENT_RESET 2
#define KVM_SYSTEM_EVENT_CRASH 3
+#define KVM_SYSTEM_EVENT_WAKEUP 4
+#define KVM_SYSTEM_EVENT_SUSPEND 5
+#define KVM_SYSTEM_EVENT_SEV_TERM 6
__u32 type;
- __u64 flags;
+ __u32 ndata;
+ union {
+ __u64 flags;
+ __u64 data[16];
+ };
} system_event;
struct {
__u64 addr;
@@ -361,6 +364,7 @@
#define KVM_MSR_EXIT_REASON_INVAL (1 << 0)
#define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1)
#define KVM_MSR_EXIT_REASON_FILTER (1 << 2)
+#define KVM_MSR_EXIT_REASON_VALID_MASK (KVM_MSR_EXIT_REASON_INVAL | KVM_MSR_EXIT_REASON_UNKNOWN | KVM_MSR_EXIT_REASON_FILTER)
__u32 reason;
__u32 index;
__u64 data;
@@ -372,6 +376,16 @@
unsigned long args[6];
unsigned long ret[2];
} riscv_sbi;
+ struct {
+ unsigned long csr_num;
+ unsigned long new_value;
+ unsigned long write_mask;
+ unsigned long ret_value;
+ } riscv_csr;
+ struct {
+#define KVM_NOTIFY_CONTEXT_INVALID (1 << 0)
+ __u32 flags;
+ } notify;
char padding[256];
};
#define SYNC_REGS_SIZE_BYTES 2048
@@ -401,7 +415,7 @@
};
struct kvm_coalesced_mmio_ring {
__u32 first, last;
- struct kvm_coalesced_mmio coalesced_mmio[0];
+ struct kvm_coalesced_mmio coalesced_mmio[];
};
#define KVM_COALESCED_MMIO_MAX ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / sizeof(struct kvm_coalesced_mmio))
struct kvm_translation {
@@ -419,7 +433,10 @@
__u32 op;
__u64 buf;
union {
- __u8 ar;
+ struct {
+ __u8 ar;
+ __u8 key;
+ };
__u32 sida_offset;
__u8 reserved[32];
};
@@ -428,8 +445,11 @@
#define KVM_S390_MEMOP_LOGICAL_WRITE 1
#define KVM_S390_MEMOP_SIDA_READ 2
#define KVM_S390_MEMOP_SIDA_WRITE 3
+#define KVM_S390_MEMOP_ABSOLUTE_READ 4
+#define KVM_S390_MEMOP_ABSOLUTE_WRITE 5
#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
+#define KVM_S390_MEMOP_F_SKEY_PROTECTION (1ULL << 2)
struct kvm_interrupt {
__u32 irq;
};
@@ -437,7 +457,7 @@
__u32 slot;
__u32 padding1;
union {
- void __user * dirty_bitmap;
+ void * dirty_bitmap;
__u64 padding2;
};
};
@@ -446,13 +466,13 @@
__u32 num_pages;
__u64 first_page;
union {
- void __user * dirty_bitmap;
+ void * dirty_bitmap;
__u64 padding2;
};
};
struct kvm_signal_mask {
__u32 len;
- __u8 sigset[0];
+ __u8 sigset[];
};
struct kvm_tpr_access_ctl {
__u32 enabled;
@@ -472,6 +492,7 @@
#define KVM_MP_STATE_OPERATING 7
#define KVM_MP_STATE_LOAD 8
#define KVM_MP_STATE_AP_RESET_HOLD 9
+#define KVM_MP_STATE_SUSPENDED 10
struct kvm_mp_state {
__u32 mp_state;
};
@@ -890,6 +911,21 @@
#define KVM_CAP_XSAVE2 208
#define KVM_CAP_SYS_ATTRIBUTES 209
#define KVM_CAP_PPC_AIL_MODE_3 210
+#define KVM_CAP_S390_MEM_OP_EXTENSION 211
+#define KVM_CAP_PMU_CAPABILITY 212
+#define KVM_CAP_DISABLE_QUIRKS2 213
+#define KVM_CAP_VM_TSC_CONTROL 214
+#define KVM_CAP_SYSTEM_EVENT_DATA 215
+#define KVM_CAP_ARM_SYSTEM_SUSPEND 216
+#define KVM_CAP_S390_PROTECTED_DUMP 217
+#define KVM_CAP_X86_TRIPLE_FAULT_EVENT 218
+#define KVM_CAP_X86_NOTIFY_VMEXIT 219
+#define KVM_CAP_VM_DISABLE_NX_HUGE_PAGES 220
+#define KVM_CAP_S390_ZPCI_OP 221
+#define KVM_CAP_S390_CPU_TOPOLOGY 222
+#define KVM_CAP_DIRTY_LOG_RING_ACQ_REL 223
+#define KVM_CAP_S390_PROTECTED_ASYNC_DISABLE 224
+#define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP 225
#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_irqchip {
__u32 irqchip;
@@ -943,7 +979,7 @@
struct kvm_irq_routing {
__u32 nr;
__u32 flags;
- struct kvm_irq_routing_entry entries[0];
+ struct kvm_irq_routing_entry entries[];
};
#endif
#ifdef KVM_CAP_MCE
@@ -963,6 +999,8 @@
#define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2)
#define KVM_XEN_HVM_CONFIG_RUNSTATE (1 << 3)
#define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4)
+#define KVM_XEN_HVM_CONFIG_EVTCHN_SEND (1 << 5)
+#define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG (1 << 6)
struct kvm_xen_hvm_config {
__u32 flags;
__u32 msr;
@@ -1028,7 +1066,7 @@
#define KVM_REG_SIZE_U2048 0x0080000000000000ULL
struct kvm_reg_list {
__u64 n;
- __u64 reg[0];
+ __u64 reg[];
};
struct kvm_one_reg {
__u64 id;
@@ -1090,10 +1128,8 @@
__s32 groupfd;
__s32 tablefd;
};
-#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
-#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, struct kvm_userspace_memory_region)
@@ -1242,6 +1278,48 @@
__u64 size;
__u64 tweak;
};
+enum pv_cmd_dmp_id {
+ KVM_PV_DUMP_INIT,
+ KVM_PV_DUMP_CONFIG_STOR_STATE,
+ KVM_PV_DUMP_COMPLETE,
+ KVM_PV_DUMP_CPU,
+};
+struct kvm_s390_pv_dmp {
+ __u64 subcmd;
+ __u64 buff_addr;
+ __u64 buff_len;
+ __u64 gaddr;
+ __u64 reserved[4];
+};
+enum pv_cmd_info_id {
+ KVM_PV_INFO_VM,
+ KVM_PV_INFO_DUMP,
+};
+struct kvm_s390_pv_info_dump {
+ __u64 dump_cpu_buffer_len;
+ __u64 dump_config_mem_buffer_per_1m;
+ __u64 dump_config_finalize_len;
+};
+struct kvm_s390_pv_info_vm {
+ __u64 inst_calls_list[4];
+ __u64 max_cpus;
+ __u64 max_guests;
+ __u64 max_guest_addr;
+ __u64 feature_indication;
+};
+struct kvm_s390_pv_info_header {
+ __u32 id;
+ __u32 len_max;
+ __u32 len_written;
+ __u32 reserved;
+};
+struct kvm_s390_pv_info {
+ struct kvm_s390_pv_info_header header;
+ union {
+ struct kvm_s390_pv_info_dump dump;
+ struct kvm_s390_pv_info_vm vm;
+ };
+};
enum pv_cmd_id {
KVM_PV_ENABLE,
KVM_PV_DISABLE,
@@ -1250,6 +1328,10 @@
KVM_PV_VERIFY,
KVM_PV_PREP_RESET,
KVM_PV_UNSHARE_ALL,
+ KVM_PV_INFO,
+ KVM_PV_DUMP,
+ KVM_PV_ASYNC_CLEANUP_PREPARE,
+ KVM_PV_ASYNC_CLEANUP_PERFORM,
};
struct kvm_pv_cmd {
__u32 cmd;
@@ -1270,17 +1352,44 @@
union {
__u8 long_mode;
__u8 vector;
+ __u8 runstate_update_flag;
struct {
__u64 gfn;
+#define KVM_XEN_INVALID_GFN ((__u64) - 1)
} shared_info;
+ struct {
+ __u32 send_port;
+ __u32 type;
+ __u32 flags;
+#define KVM_XEN_EVTCHN_DEASSIGN (1 << 0)
+#define KVM_XEN_EVTCHN_UPDATE (1 << 1)
+#define KVM_XEN_EVTCHN_RESET (1 << 2)
+ union {
+ struct {
+ __u32 port;
+ __u32 vcpu;
+ __u32 priority;
+ } port;
+ struct {
+ __u32 port;
+ __s32 fd;
+ } eventfd;
+ __u32 padding[4];
+ } deliver;
+ } evtchn;
+ __u32 xen_version;
__u64 pad[8];
} u;
};
#define KVM_XEN_ATTR_TYPE_LONG_MODE 0x0
#define KVM_XEN_ATTR_TYPE_SHARED_INFO 0x1
#define KVM_XEN_ATTR_TYPE_UPCALL_VECTOR 0x2
+#define KVM_XEN_ATTR_TYPE_EVTCHN 0x3
+#define KVM_XEN_ATTR_TYPE_XEN_VERSION 0x4
+#define KVM_XEN_ATTR_TYPE_RUNSTATE_UPDATE_FLAG 0x5
#define KVM_XEN_VCPU_GET_ATTR _IOWR(KVMIO, 0xca, struct kvm_xen_vcpu_attr)
#define KVM_XEN_VCPU_SET_ATTR _IOW(KVMIO, 0xcb, struct kvm_xen_vcpu_attr)
+#define KVM_XEN_HVM_EVTCHN_SEND _IOW(KVMIO, 0xd0, struct kvm_irq_routing_xen_evtchn)
#define KVM_GET_SREGS2 _IOR(KVMIO, 0xcc, struct kvm_sregs2)
#define KVM_SET_SREGS2 _IOW(KVMIO, 0xcd, struct kvm_sregs2)
struct kvm_xen_vcpu_attr {
@@ -1288,6 +1397,7 @@
__u16 pad[3];
union {
__u64 gpa;
+#define KVM_XEN_INVALID_GPA ((__u64) - 1)
__u64 pad[8];
struct {
__u64 state;
@@ -1297,6 +1407,13 @@
__u64 time_blocked;
__u64 time_offline;
} runstate;
+ __u32 vcpu_id;
+ struct {
+ __u32 port;
+ __u32 priority;
+ __u64 expires_ns;
+ } timer;
+ __u8 vector;
} u;
};
#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO 0x0
@@ -1305,6 +1422,9 @@
#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT 0x3
#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA 0x4
#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST 0x5
+#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID 0x6
+#define KVM_XEN_VCPU_ATTR_TYPE_TIMER 0x7
+#define KVM_XEN_VCPU_ATTR_TYPE_UPCALL_VECTOR 0x8
enum sev_cmd_id {
KVM_SEV_INIT = 0,
KVM_SEV_ES_INIT,
@@ -1480,6 +1600,7 @@
};
#define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)
#define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)
+#define KVM_PMU_CAP_DISABLE (1 << 0)
struct kvm_stats_header {
__u32 flags;
__u32 name_size;
@@ -1502,7 +1623,8 @@
#define KVM_STATS_UNIT_BYTES (0x1 << KVM_STATS_UNIT_SHIFT)
#define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT)
#define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT)
-#define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_CYCLES
+#define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT)
+#define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_BOOLEAN
#define KVM_STATS_BASE_SHIFT 8
#define KVM_STATS_BASE_MASK (0xF << KVM_STATS_BASE_SHIFT)
#define KVM_STATS_BASE_POW10 (0x0 << KVM_STATS_BASE_SHIFT)
@@ -1518,4 +1640,28 @@
};
#define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
+#define KVM_S390_PV_CPU_COMMAND _IOWR(KVMIO, 0xd0, struct kvm_pv_cmd)
+#define KVM_X86_NOTIFY_VMEXIT_ENABLED (1ULL << 0)
+#define KVM_X86_NOTIFY_VMEXIT_USER (1ULL << 1)
+#define KVM_S390_ZPCI_OP _IOW(KVMIO, 0xd1, struct kvm_s390_zpci_op)
+struct kvm_s390_zpci_op {
+ __u32 fh;
+ __u8 op;
+ __u8 pad[3];
+ union {
+ struct {
+ __u64 ibv;
+ __u64 sb;
+ __u32 flags;
+ __u32 noi;
+ __u8 isc;
+ __u8 sbo;
+ __u16 pad;
+ } reg_aen;
+ __u64 reserved[8];
+ } u;
+};
+#define KVM_S390_ZPCIOP_REG_AEN 0
+#define KVM_S390_ZPCIOP_DEREG_AEN 1
+#define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0)
#endif
diff --git a/libc/kernel/uapi/linux/l2tp.h b/libc/kernel/uapi/linux/l2tp.h
index a054819..dee634e 100644
--- a/libc/kernel/uapi/linux/l2tp.h
+++ b/libc/kernel/uapi/linux/l2tp.h
@@ -22,7 +22,6 @@
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/in6.h>
-#define IPPROTO_L2TP 115
#define __SOCK_SIZE__ 16
struct sockaddr_l2tpip {
__kernel_sa_family_t l2tp_family;
diff --git a/libc/kernel/uapi/linux/landlock.h b/libc/kernel/uapi/linux/landlock.h
index 50d79d8..c284ea4 100644
--- a/libc/kernel/uapi/linux/landlock.h
+++ b/libc/kernel/uapi/linux/landlock.h
@@ -43,4 +43,6 @@
#define LANDLOCK_ACCESS_FS_MAKE_FIFO (1ULL << 10)
#define LANDLOCK_ACCESS_FS_MAKE_BLOCK (1ULL << 11)
#define LANDLOCK_ACCESS_FS_MAKE_SYM (1ULL << 12)
+#define LANDLOCK_ACCESS_FS_REFER (1ULL << 13)
+#define LANDLOCK_ACCESS_FS_TRUNCATE (1ULL << 14)
#endif
diff --git a/libc/kernel/uapi/linux/lirc.h b/libc/kernel/uapi/linux/lirc.h
index a0ac24a..dff0b63 100644
--- a/libc/kernel/uapi/linux/lirc.h
+++ b/libc/kernel/uapi/linux/lirc.h
@@ -26,18 +26,21 @@
#define LIRC_MODE2_PULSE 0x01000000
#define LIRC_MODE2_FREQUENCY 0x02000000
#define LIRC_MODE2_TIMEOUT 0x03000000
+#define LIRC_MODE2_OVERFLOW 0x04000000
#define LIRC_VALUE_MASK 0x00FFFFFF
#define LIRC_MODE2_MASK 0xFF000000
#define LIRC_SPACE(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_SPACE)
#define LIRC_PULSE(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_PULSE)
#define LIRC_FREQUENCY(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY)
#define LIRC_TIMEOUT(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT)
+#define LIRC_OVERFLOW(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_OVERFLOW)
#define LIRC_VALUE(val) ((val) & LIRC_VALUE_MASK)
#define LIRC_MODE2(val) ((val) & LIRC_MODE2_MASK)
#define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE)
#define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE)
#define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY)
#define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT)
+#define LIRC_IS_OVERFLOW(val) (LIRC_MODE2(val) == LIRC_MODE2_OVERFLOW)
#define lirc_t int
#define LIRC_MODE2SEND(x) (x)
#define LIRC_SEND2MODE(x) (x)
@@ -63,17 +66,15 @@
#define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE)
#define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK)
#define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16)
-#define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16)
-#define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000
#define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000
#define LIRC_CAN_GET_REC_RESOLUTION 0x20000000
#define LIRC_CAN_SET_REC_TIMEOUT 0x10000000
-#define LIRC_CAN_SET_REC_FILTER 0x08000000
#define LIRC_CAN_MEASURE_CARRIER 0x02000000
#define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000
#define LIRC_CAN_SEND(x) ((x) & LIRC_CAN_SEND_MASK)
#define LIRC_CAN_REC(x) ((x) & LIRC_CAN_REC_MASK)
-#define LIRC_CAN_NOTIFY_DECODE 0x01000000
+#define LIRC_CAN_SET_REC_FILTER 0
+#define LIRC_CAN_NOTIFY_DECODE 0
#define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32)
#define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32)
#define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32)
diff --git a/libc/kernel/uapi/linux/loadpin.h b/libc/kernel/uapi/linux/loadpin.h
new file mode 100644
index 0000000..2641939
--- /dev/null
+++ b/libc/kernel/uapi/linux/loadpin.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_LOOP_LOADPIN_H
+#define _UAPI_LINUX_LOOP_LOADPIN_H
+#define LOADPIN_IOC_MAGIC 'L'
+#define LOADPIN_IOC_SET_TRUSTED_VERITY_DIGESTS _IOW(LOADPIN_IOC_MAGIC, 0x00, unsigned int)
+#endif
diff --git a/libc/kernel/uapi/linux/lwtunnel.h b/libc/kernel/uapi/linux/lwtunnel.h
index e6fb536..94011dd 100644
--- a/libc/kernel/uapi/linux/lwtunnel.h
+++ b/libc/kernel/uapi/linux/lwtunnel.h
@@ -30,6 +30,7 @@
LWTUNNEL_ENCAP_SEG6_LOCAL,
LWTUNNEL_ENCAP_RPL,
LWTUNNEL_ENCAP_IOAM6,
+ LWTUNNEL_ENCAP_XFRM,
__LWTUNNEL_ENCAP_MAX,
};
#define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1)
@@ -107,4 +108,11 @@
};
#define LWT_BPF_MAX (__LWT_BPF_MAX - 1)
#define LWT_BPF_MAX_HEADROOM 256
+enum {
+ LWT_XFRM_UNSPEC,
+ LWT_XFRM_IF_ID,
+ LWT_XFRM_LINK,
+ __LWT_XFRM_MAX,
+};
+#define LWT_XFRM_MAX (__LWT_XFRM_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/magic.h b/libc/kernel/uapi/linux/magic.h
index 6563411..ac2a0f3 100644
--- a/libc/kernel/uapi/linux/magic.h
+++ b/libc/kernel/uapi/linux/magic.h
@@ -99,11 +99,7 @@
#define AAFS_MAGIC 0x5a3c69f0
#define ZONEFS_MAGIC 0x5a4f4653
#define UDF_SUPER_MAGIC 0x15013346
-#define BALLOON_KVM_MAGIC 0x13661366
-#define ZSMALLOC_MAGIC 0x58295829
#define DMA_BUF_MAGIC 0x444d4142
#define DEVMEM_MAGIC 0x454d444d
-#define Z3FOLD_MAGIC 0x33
-#define PPC_CMM_MAGIC 0xc7571590
#define SECRETMEM_MAGIC 0x5345434d
#endif
diff --git a/libc/kernel/uapi/linux/mctp.h b/libc/kernel/uapi/linux/mctp.h
index 21a9a14..f02c12f 100644
--- a/libc/kernel/uapi/linux/mctp.h
+++ b/libc/kernel/uapi/linux/mctp.h
@@ -46,5 +46,13 @@
#define MCTP_ADDR_ANY 0xff
#define MCTP_TAG_MASK 0x07
#define MCTP_TAG_OWNER 0x08
+#define MCTP_TAG_PREALLOC 0x10
#define MCTP_OPT_ADDR_EXT 1
+#define SIOCMCTPALLOCTAG (SIOCPROTOPRIVATE + 0)
+#define SIOCMCTPDROPTAG (SIOCPROTOPRIVATE + 1)
+struct mctp_ioc_tag_ctl {
+ mctp_eid_t peer_addr;
+ __u8 tag;
+ __u16 flags;
+};
#endif
diff --git a/libc/kernel/uapi/linux/mdio.h b/libc/kernel/uapi/linux/mdio.h
index d5c9da8..7a2c9af 100644
--- a/libc/kernel/uapi/linux/mdio.h
+++ b/libc/kernel/uapi/linux/mdio.h
@@ -66,6 +66,19 @@
#define MDIO_PCS_10GBRT_STAT2 33
#define MDIO_AN_10GBT_CTRL 32
#define MDIO_AN_10GBT_STAT 33
+#define MDIO_B10L_PMA_CTRL 2294
+#define MDIO_PMA_10T1L_STAT 2295
+#define MDIO_PCS_10T1L_CTRL 2278
+#define MDIO_PMA_PMD_BT1 18
+#define MDIO_AN_T1_CTRL 512
+#define MDIO_AN_T1_STAT 513
+#define MDIO_AN_T1_ADV_L 514
+#define MDIO_AN_T1_ADV_M 515
+#define MDIO_AN_T1_ADV_H 516
+#define MDIO_AN_T1_LP_L 517
+#define MDIO_AN_T1_LP_M 518
+#define MDIO_AN_T1_LP_H 519
+#define MDIO_PMA_PMD_BT1_CTRL 2100
#define MDIO_PMA_LASI_RXCTRL 0x9000
#define MDIO_PMA_LASI_TXCTRL 0x9001
#define MDIO_PMA_LASI_CTRL 0x9002
@@ -139,6 +152,7 @@
#define MDIO_PMA_CTRL2_10BT 0x000f
#define MDIO_PMA_CTRL2_2_5GBT 0x0030
#define MDIO_PMA_CTRL2_5GBT 0x0031
+#define MDIO_PMA_CTRL2_BASET1 0x003D
#define MDIO_PCS_CTRL2_TYPE 0x0003
#define MDIO_PCS_CTRL2_10GBR 0x0000
#define MDIO_PCS_CTRL2_10GBX 0x0001
@@ -184,6 +198,7 @@
#define MDIO_PMA_EXTABLE_1000BKX 0x0040
#define MDIO_PMA_EXTABLE_100BTX 0x0080
#define MDIO_PMA_EXTABLE_10BT 0x0100
+#define MDIO_PMA_EXTABLE_BT1 0x0800
#define MDIO_PMA_EXTABLE_NBT 0x4000
#define MDIO_PHYXS_LNSTAT_SYNC0 0x0001
#define MDIO_PHYXS_LNSTAT_SYNC1 0x0002
@@ -218,6 +233,44 @@
#define MDIO_AN_10GBT_STAT_LOCOK 0x2000
#define MDIO_AN_10GBT_STAT_MS 0x4000
#define MDIO_AN_10GBT_STAT_MSFLT 0x8000
+#define MDIO_PMA_10T1L_CTRL_LB_EN 0x0001
+#define MDIO_PMA_10T1L_CTRL_EEE_EN 0x0400
+#define MDIO_PMA_10T1L_CTRL_LOW_POWER 0x0800
+#define MDIO_PMA_10T1L_CTRL_2V4_EN 0x1000
+#define MDIO_PMA_10T1L_CTRL_TX_DIS 0x4000
+#define MDIO_PMA_10T1L_CTRL_PMA_RST 0x8000
+#define MDIO_PMA_10T1L_STAT_LINK 0x0001
+#define MDIO_PMA_10T1L_STAT_FAULT 0x0002
+#define MDIO_PMA_10T1L_STAT_POLARITY 0x0004
+#define MDIO_PMA_10T1L_STAT_RECV_FAULT 0x0200
+#define MDIO_PMA_10T1L_STAT_EEE 0x0400
+#define MDIO_PMA_10T1L_STAT_LOW_POWER 0x0800
+#define MDIO_PMA_10T1L_STAT_2V4_ABLE 0x1000
+#define MDIO_PMA_10T1L_STAT_LB_ABLE 0x2000
+#define MDIO_PCS_10T1L_CTRL_LB 0x4000
+#define MDIO_PCS_10T1L_CTRL_RESET 0x8000
+#define MDIO_PMA_PMD_BT1_B10L_ABLE 0x0004
+#define MDIO_AN_T1_ADV_L_PAUSE_CAP ADVERTISE_PAUSE_CAP
+#define MDIO_AN_T1_ADV_L_PAUSE_ASYM ADVERTISE_PAUSE_ASYM
+#define MDIO_AN_T1_ADV_L_FORCE_MS 0x1000
+#define MDIO_AN_T1_ADV_L_REMOTE_FAULT ADVERTISE_RFAULT
+#define MDIO_AN_T1_ADV_L_ACK ADVERTISE_LPACK
+#define MDIO_AN_T1_ADV_L_NEXT_PAGE_REQ ADVERTISE_NPAGE
+#define MDIO_AN_T1_ADV_M_B10L 0x4000
+#define MDIO_AN_T1_ADV_M_MST 0x0010
+#define MDIO_AN_T1_ADV_H_10L_TX_HI_REQ 0x1000
+#define MDIO_AN_T1_ADV_H_10L_TX_HI 0x2000
+#define MDIO_AN_T1_LP_L_PAUSE_CAP LPA_PAUSE_CAP
+#define MDIO_AN_T1_LP_L_PAUSE_ASYM LPA_PAUSE_ASYM
+#define MDIO_AN_T1_LP_L_FORCE_MS 0x1000
+#define MDIO_AN_T1_LP_L_REMOTE_FAULT LPA_RFAULT
+#define MDIO_AN_T1_LP_L_ACK LPA_LPACK
+#define MDIO_AN_T1_LP_L_NEXT_PAGE_REQ LPA_NPAGE
+#define MDIO_AN_T1_LP_M_MST 0x0010
+#define MDIO_AN_T1_LP_M_B10L 0x4000
+#define MDIO_AN_T1_LP_H_10L_TX_HI_REQ 0x1000
+#define MDIO_AN_T1_LP_H_10L_TX_HI 0x2000
+#define MDIO_PMA_PMD_BT1_CTRL_CFG_MST 0x4000
#define MDIO_AN_EEE_ADV_100TX 0x0002
#define MDIO_AN_EEE_ADV_1000T 0x0004
#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX
diff --git a/libc/kernel/uapi/linux/media-bus-format.h b/libc/kernel/uapi/linux/media-bus-format.h
index 2542a32..87614cf 100644
--- a/libc/kernel/uapi/linux/media-bus-format.h
+++ b/libc/kernel/uapi/linux/media-bus-format.h
@@ -43,9 +43,13 @@
#define MEDIA_BUS_FMT_RGB888_3X8_DELTA 0x101d
#define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG 0x1011
#define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA 0x1012
+#define MEDIA_BUS_FMT_RGB666_1X30_CPADLO 0x101e
+#define MEDIA_BUS_FMT_RGB888_1X30_CPADLO 0x101f
#define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d
#define MEDIA_BUS_FMT_RGB888_1X32_PADHI 0x100f
#define MEDIA_BUS_FMT_RGB101010_1X30 0x1018
+#define MEDIA_BUS_FMT_RGB666_1X36_CPADLO 0x1020
+#define MEDIA_BUS_FMT_RGB888_1X36_CPADLO 0x1021
#define MEDIA_BUS_FMT_RGB121212_1X36 0x1019
#define MEDIA_BUS_FMT_RGB161616_1X48 0x101a
#define MEDIA_BUS_FMT_Y8_1X8 0x2001
@@ -70,6 +74,7 @@
#define MEDIA_BUS_FMT_YUYV12_2X12 0x201e
#define MEDIA_BUS_FMT_YVYU12_2X12 0x201f
#define MEDIA_BUS_FMT_Y14_1X14 0x202d
+#define MEDIA_BUS_FMT_Y16_1X16 0x202e
#define MEDIA_BUS_FMT_UYVY8_1X16 0x200f
#define MEDIA_BUS_FMT_VYUY8_1X16 0x2010
#define MEDIA_BUS_FMT_YUYV8_1X16 0x2011
diff --git a/libc/kernel/uapi/linux/media.h b/libc/kernel/uapi/linux/media.h
index 5c8efcd..fe97e90 100644
--- a/libc/kernel/uapi/linux/media.h
+++ b/libc/kernel/uapi/linux/media.h
@@ -18,7 +18,6 @@
****************************************************************************/
#ifndef __LINUX_MEDIA_H
#define __LINUX_MEDIA_H
-#include <stdint.h>
#include <linux/ioctl.h>
#include <linux/types.h>
struct media_device_info {
@@ -117,6 +116,7 @@
#define MEDIA_LNK_FL_LINK_TYPE (0xf << 28)
#define MEDIA_LNK_FL_DATA_LINK (0 << 28)
#define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28)
+#define MEDIA_LNK_FL_ANCILLARY_LINK (2 << 28)
struct media_link_desc {
struct media_pad_desc source;
struct media_pad_desc sink;
@@ -125,8 +125,8 @@
};
struct media_links_enum {
__u32 entity;
- struct media_pad_desc __user * pads;
- struct media_link_desc __user * links;
+ struct media_pad_desc * pads;
+ struct media_link_desc * links;
__u32 reserved[4];
};
#define MEDIA_INTF_T_DVB_BASE 0x00000100
diff --git a/libc/kernel/uapi/linux/minix_fs.h b/libc/kernel/uapi/linux/minix_fs.h
index b6f1c69..0878efe 100644
--- a/libc/kernel/uapi/linux/minix_fs.h
+++ b/libc/kernel/uapi/linux/minix_fs.h
@@ -77,10 +77,10 @@
};
struct minix_dir_entry {
__u16 inode;
- char name[0];
+ char name[];
};
struct minix3_dir_entry {
__u32 inode;
- char name[0];
+ char name[];
};
#endif
diff --git a/libc/kernel/uapi/linux/mmc/ioctl.h b/libc/kernel/uapi/linux/mmc/ioctl.h
index afea6a5..451134b 100644
--- a/libc/kernel/uapi/linux/mmc/ioctl.h
+++ b/libc/kernel/uapi/linux/mmc/ioctl.h
@@ -39,7 +39,7 @@
#define mmc_ioc_cmd_set_data(ic,ptr) ic.data_ptr = (__u64) (unsigned long) ptr
struct mmc_ioc_multi_cmd {
__u64 num_of_cmds;
- struct mmc_ioc_cmd cmds[0];
+ struct mmc_ioc_cmd cmds[];
};
#define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd)
#define MMC_IOC_MULTI_CMD _IOWR(MMC_BLOCK_MAJOR, 1, struct mmc_ioc_multi_cmd)
diff --git a/libc/kernel/uapi/linux/mptcp.h b/libc/kernel/uapi/linux/mptcp.h
index 67b0ce3..9f7215c 100644
--- a/libc/kernel/uapi/linux/mptcp.h
+++ b/libc/kernel/uapi/linux/mptcp.h
@@ -18,12 +18,13 @@
****************************************************************************/
#ifndef _UAPI_MPTCP_H
#define _UAPI_MPTCP_H
+#include <netinet/in.h>
+#include <sys/socket.h>
#include <linux/const.h>
#include <linux/types.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/socket.h>
-#include <sys/socket.h>
#define MPTCP_SUBFLOW_FLAG_MCAP_REM _BITUL(0)
#define MPTCP_SUBFLOW_FLAG_MCAP_LOC _BITUL(1)
#define MPTCP_SUBFLOW_FLAG_JOIN_REM _BITUL(2)
@@ -58,6 +59,9 @@
MPTCP_PM_ATTR_ADDR,
MPTCP_PM_ATTR_RCV_ADD_ADDRS,
MPTCP_PM_ATTR_SUBFLOWS,
+ MPTCP_PM_ATTR_TOKEN,
+ MPTCP_PM_ATTR_LOC_ID,
+ MPTCP_PM_ATTR_ADDR_REMOTE,
__MPTCP_PM_ATTR_MAX
};
#define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1)
@@ -77,6 +81,7 @@
#define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1)
#define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2)
#define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3)
+#define MPTCP_PM_ADDR_FLAG_IMPLICIT (1 << 4)
enum {
MPTCP_PM_CMD_UNSPEC,
MPTCP_PM_CMD_ADD_ADDR,
@@ -86,6 +91,10 @@
MPTCP_PM_CMD_SET_LIMITS,
MPTCP_PM_CMD_GET_LIMITS,
MPTCP_PM_CMD_SET_FLAGS,
+ MPTCP_PM_CMD_ANNOUNCE,
+ MPTCP_PM_CMD_REMOVE,
+ MPTCP_PM_CMD_SUBFLOW_CREATE,
+ MPTCP_PM_CMD_SUBFLOW_DESTROY,
__MPTCP_PM_CMD_AFTER_LAST
};
#define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
@@ -116,6 +125,8 @@
MPTCP_EVENT_SUB_ESTABLISHED = 10,
MPTCP_EVENT_SUB_CLOSED = 11,
MPTCP_EVENT_SUB_PRIORITY = 13,
+ MPTCP_EVENT_LISTENER_CREATED = 15,
+ MPTCP_EVENT_LISTENER_CLOSED = 16,
};
enum mptcp_event_attr {
MPTCP_ATTR_UNSPEC = 0,
@@ -136,6 +147,7 @@
MPTCP_ATTR_IF_IDX,
MPTCP_ATTR_RESET_REASON,
MPTCP_ATTR_RESET_FLAGS,
+ MPTCP_ATTR_SERVER_SIDE,
__MPTCP_ATTR_AFTER_LAST
};
#define MPTCP_ATTR_MAX (__MPTCP_ATTR_AFTER_LAST - 1)
diff --git a/libc/kernel/uapi/linux/mroute6.h b/libc/kernel/uapi/linux/mroute6.h
index c73765c..68480de 100644
--- a/libc/kernel/uapi/linux/mroute6.h
+++ b/libc/kernel/uapi/linux/mroute6.h
@@ -93,6 +93,7 @@
#define MRT6MSG_NOCACHE 1
#define MRT6MSG_WRONGMIF 2
#define MRT6MSG_WHOLEPKT 3
+#define MRT6MSG_WRMIFWHOLE 4
__u8 im6_mbz;
__u8 im6_msgtype;
__u16 im6_mif;
diff --git a/libc/kernel/uapi/linux/ndctl.h b/libc/kernel/uapi/linux/ndctl.h
index 53f8ba4..7e0d560 100644
--- a/libc/kernel/uapi/linux/ndctl.h
+++ b/libc/kernel/uapi/linux/ndctl.h
@@ -22,33 +22,33 @@
struct nd_cmd_dimm_flags {
__u32 status;
__u32 flags;
-} __packed;
+} __attribute__((__packed__));
struct nd_cmd_get_config_size {
__u32 status;
__u32 config_size;
__u32 max_xfer;
-} __packed;
+} __attribute__((__packed__));
struct nd_cmd_get_config_data_hdr {
__u32 in_offset;
__u32 in_length;
__u32 status;
- __u8 out_buf[0];
-} __packed;
+ __u8 out_buf[];
+} __attribute__((__packed__));
struct nd_cmd_set_config_hdr {
__u32 in_offset;
__u32 in_length;
- __u8 in_buf[0];
-} __packed;
+ __u8 in_buf[];
+} __attribute__((__packed__));
struct nd_cmd_vendor_hdr {
__u32 opcode;
__u32 in_length;
- __u8 in_buf[0];
-} __packed;
+ __u8 in_buf[];
+} __attribute__((__packed__));
struct nd_cmd_vendor_tail {
__u32 status;
__u32 out_length;
- __u8 out_buf[0];
-} __packed;
+ __u8 out_buf[];
+} __attribute__((__packed__));
struct nd_cmd_ars_cap {
__u64 address;
__u64 length;
@@ -57,7 +57,7 @@
__u32 clear_err_unit;
__u16 flags;
__u16 reserved;
-} __packed;
+} __attribute__((__packed__));
struct nd_cmd_ars_start {
__u64 address;
__u64 length;
@@ -66,7 +66,7 @@
__u8 reserved[5];
__u32 status;
__u32 scrub_time;
-} __packed;
+} __attribute__((__packed__));
struct nd_cmd_ars_status {
__u32 status;
__u32 out_length;
@@ -82,15 +82,15 @@
__u32 reserved;
__u64 err_address;
__u64 length;
- } __packed records[0];
-} __packed;
+ } __attribute__((__packed__)) records[];
+} __attribute__((__packed__));
struct nd_cmd_clear_error {
__u64 address;
__u64 length;
__u32 status;
__u8 reserved[4];
__u64 cleared;
-} __packed;
+} __attribute__((__packed__));
enum {
ND_CMD_IMPLEMENTED = 0,
ND_CMD_ARS_CAP = 1,
@@ -129,7 +129,6 @@
#define ND_DEVICE_REGION_BLK 3
#define ND_DEVICE_NAMESPACE_IO 4
#define ND_DEVICE_NAMESPACE_PMEM 5
-#define ND_DEVICE_NAMESPACE_BLK 6
#define ND_DEVICE_DAX_PMEM 7
enum nd_driver_flags {
ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM,
@@ -137,7 +136,6 @@
ND_DRIVER_REGION_BLK = 1 << ND_DEVICE_REGION_BLK,
ND_DRIVER_NAMESPACE_IO = 1 << ND_DEVICE_NAMESPACE_IO,
ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM,
- ND_DRIVER_NAMESPACE_BLK = 1 << ND_DEVICE_NAMESPACE_BLK,
ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM,
};
enum ars_masks {
diff --git a/libc/kernel/uapi/linux/neighbour.h b/libc/kernel/uapi/linux/neighbour.h
index 278f7d1..4b479a1 100644
--- a/libc/kernel/uapi/linux/neighbour.h
+++ b/libc/kernel/uapi/linux/neighbour.h
@@ -46,6 +46,8 @@
NDA_NH_ID,
NDA_FDB_EXT_ATTRS,
NDA_FLAGS_EXT,
+ NDA_NDM_STATE_MASK,
+ NDA_NDM_FLAGS_MASK,
__NDA_MAX
};
#define NDA_MAX (__NDA_MAX - 1)
@@ -58,6 +60,7 @@
#define NTF_STICKY (1 << 6)
#define NTF_ROUTER (1 << 7)
#define NTF_EXT_MANAGED (1 << 0)
+#define NTF_EXT_LOCKED (1 << 1)
#define NUD_INCOMPLETE 0x01
#define NUD_REACHABLE 0x02
#define NUD_STALE 0x04
@@ -106,6 +109,7 @@
NDTPA_QUEUE_LENBYTES,
NDTPA_MCAST_REPROBES,
NDTPA_PAD,
+ NDTPA_INTERVAL_PROBE_TIME_MS,
__NDTPA_MAX
};
#define NDTPA_MAX (__NDTPA_MAX - 1)
diff --git a/libc/kernel/uapi/linux/net_dropmon.h b/libc/kernel/uapi/linux/net_dropmon.h
index 01b76cb..4d2c336 100644
--- a/libc/kernel/uapi/linux/net_dropmon.h
+++ b/libc/kernel/uapi/linux/net_dropmon.h
@@ -36,11 +36,11 @@
};
struct net_dm_config_msg {
__u32 entries;
- struct net_dm_config_entry options[0];
+ struct net_dm_config_entry options[];
};
struct net_dm_alert_msg {
__u32 entries;
- struct net_dm_drop_point points[0];
+ struct net_dm_drop_point points[];
};
struct net_dm_user_msg {
union {
@@ -87,6 +87,7 @@
NET_DM_ATTR_SW_DROPS,
NET_DM_ATTR_HW_DROPS,
NET_DM_ATTR_FLOW_ACTION_COOKIE,
+ NET_DM_ATTR_REASON,
__NET_DM_ATTR_MAX,
NET_DM_ATTR_MAX = __NET_DM_ATTR_MAX - 1
};
diff --git a/libc/kernel/uapi/linux/net_tstamp.h b/libc/kernel/uapi/linux/net_tstamp.h
index 510c0da..d79d98a 100644
--- a/libc/kernel/uapi/linux/net_tstamp.h
+++ b/libc/kernel/uapi/linux/net_tstamp.h
@@ -37,7 +37,8 @@
SOF_TIMESTAMPING_OPT_PKTINFO = (1 << 13),
SOF_TIMESTAMPING_OPT_TX_SWHW = (1 << 14),
SOF_TIMESTAMPING_BIND_PHC = (1 << 15),
- SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_BIND_PHC,
+ SOF_TIMESTAMPING_OPT_ID_TCP = (1 << 16),
+ SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_ID_TCP,
SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | SOF_TIMESTAMPING_LAST
};
#define SOF_TIMESTAMPING_TX_RECORD_MASK (SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_TX_SCHED | SOF_TIMESTAMPING_TX_ACK)
diff --git a/libc/kernel/uapi/linux/netfilter/ipset/ip_set.h b/libc/kernel/uapi/linux/netfilter/ipset/ip_set.h
index 4252530..a5aa6bc 100644
--- a/libc/kernel/uapi/linux/netfilter/ipset/ip_set.h
+++ b/libc/kernel/uapi/linux/netfilter/ipset/ip_set.h
@@ -80,6 +80,7 @@
IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO,
IPSET_ATTR_MARK,
IPSET_ATTR_MARKMASK,
+ IPSET_ATTR_BITMASK,
IPSET_ATTR_CADT_MAX = 16,
IPSET_ATTR_INITVAL,
IPSET_ATTR_HASHSIZE,
@@ -138,6 +139,7 @@
IPSET_ERR_COMMENT,
IPSET_ERR_INVALID_MARKMASK,
IPSET_ERR_SKBINFO,
+ IPSET_ERR_BITMASK_NETMASK_EXCL,
IPSET_ERR_TYPE_SPECIFIC = 4352,
};
enum ipset_cmd_flags {
diff --git a/libc/kernel/uapi/linux/netfilter/nf_tables.h b/libc/kernel/uapi/linux/netfilter/nf_tables.h
index 441cd60..f07d7c7 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_tables.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_tables.h
@@ -86,6 +86,7 @@
NFT_MSG_NEWFLOWTABLE,
NFT_MSG_GETFLOWTABLE,
NFT_MSG_DELFLOWTABLE,
+ NFT_MSG_GETRULE_RESET,
NFT_MSG_MAX,
};
enum nft_list_attributes {
@@ -387,6 +388,7 @@
NFT_PAYLOAD_NETWORK_HEADER,
NFT_PAYLOAD_TRANSPORT_HEADER,
NFT_PAYLOAD_INNER_HEADER,
+ NFT_PAYLOAD_TUN_HEADER,
};
enum nft_payload_csum_types {
NFT_PAYLOAD_CSUM_NONE,
@@ -396,6 +398,28 @@
enum nft_payload_csum_flags {
NFT_PAYLOAD_L4CSUM_PSEUDOHDR = (1 << 0),
};
+enum nft_inner_type {
+ NFT_INNER_UNSPEC = 0,
+ NFT_INNER_VXLAN,
+ NFT_INNER_GENEVE,
+};
+enum nft_inner_flags {
+ NFT_INNER_HDRSIZE = (1 << 0),
+ NFT_INNER_LL = (1 << 1),
+ NFT_INNER_NH = (1 << 2),
+ NFT_INNER_TH = (1 << 3),
+};
+#define NFT_INNER_MASK (NFT_INNER_HDRSIZE | NFT_INNER_LL | NFT_INNER_NH | NFT_INNER_TH)
+enum nft_inner_attributes {
+ NFTA_INNER_UNSPEC,
+ NFTA_INNER_NUM,
+ NFTA_INNER_TYPE,
+ NFTA_INNER_FLAGS,
+ NFTA_INNER_HDRSIZE,
+ NFTA_INNER_EXPR,
+ __NFTA_INNER_MAX
+};
+#define NFTA_INNER_MAX (__NFTA_INNER_MAX - 1)
enum nft_payload_attributes {
NFTA_PAYLOAD_UNSPEC,
NFTA_PAYLOAD_DREG,
diff --git a/libc/kernel/uapi/linux/netfilter/nfnetlink_queue.h b/libc/kernel/uapi/linux/netfilter/nfnetlink_queue.h
index 75fa359..d100dec 100644
--- a/libc/kernel/uapi/linux/netfilter/nfnetlink_queue.h
+++ b/libc/kernel/uapi/linux/netfilter/nfnetlink_queue.h
@@ -70,6 +70,7 @@
NFQA_SECCTX,
NFQA_VLAN,
NFQA_L2HDR,
+ NFQA_PRIORITY,
__NFQA_MAX
};
#define NFQA_MAX (__NFQA_MAX - 1)
diff --git a/libc/kernel/uapi/linux/netfilter/x_tables.h b/libc/kernel/uapi/linux/netfilter/x_tables.h
index 46bde57..0993265 100644
--- a/libc/kernel/uapi/linux/netfilter/x_tables.h
+++ b/libc/kernel/uapi/linux/netfilter/x_tables.h
@@ -36,7 +36,7 @@
} kernel;
__u16 match_size;
} u;
- unsigned char data[0];
+ unsigned char data[];
};
struct xt_entry_target {
union {
@@ -87,7 +87,7 @@
struct xt_counters_info {
char name[XT_TABLE_MAXNAMELEN];
unsigned int num_counters;
- struct xt_counters counters[0];
+ struct xt_counters counters[];
};
#define XT_INV_PROTO 0x40
#define XT_MATCH_ITERATE(type,e,fn,args...) \
diff --git a/libc/kernel/uapi/linux/netfilter_arp/arp_tables.h b/libc/kernel/uapi/linux/netfilter_arp/arp_tables.h
index 340625f..b1fb537 100644
--- a/libc/kernel/uapi/linux/netfilter_arp/arp_tables.h
+++ b/libc/kernel/uapi/linux/netfilter_arp/arp_tables.h
@@ -72,7 +72,7 @@
__u16 next_offset;
unsigned int comefrom;
struct xt_counters counters;
- unsigned char elems[0];
+ unsigned char elems[];
};
#define ARPT_BASE_CTL 96
#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL)
@@ -98,12 +98,12 @@
unsigned int hook_entry[NF_ARP_NUMHOOKS];
unsigned int underflow[NF_ARP_NUMHOOKS];
unsigned int num_counters;
- struct xt_counters __user * counters;
- struct arpt_entry entries[0];
+ struct xt_counters * counters;
+ struct arpt_entry entries[];
};
struct arpt_get_entries {
char name[XT_TABLE_MAXNAMELEN];
unsigned int size;
- struct arpt_entry entrytable[0];
+ struct arpt_entry entrytable[];
};
#endif
diff --git a/libc/kernel/uapi/linux/netfilter_bridge/ebt_among.h b/libc/kernel/uapi/linux/netfilter_bridge/ebt_among.h
index 74cd550..aa39c5b 100644
--- a/libc/kernel/uapi/linux/netfilter_bridge/ebt_among.h
+++ b/libc/kernel/uapi/linux/netfilter_bridge/ebt_among.h
@@ -28,7 +28,7 @@
struct ebt_mac_wormhash {
int table[257];
int poolsize;
- struct ebt_mac_wormhash_tuple pool[0];
+ struct ebt_mac_wormhash_tuple pool[];
};
#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0)
struct ebt_among_info {
diff --git a/libc/kernel/uapi/linux/netfilter_bridge/ebtables.h b/libc/kernel/uapi/linux/netfilter_bridge/ebtables.h
index 7c8f435..d87d65e 100644
--- a/libc/kernel/uapi/linux/netfilter_bridge/ebtables.h
+++ b/libc/kernel/uapi/linux/netfilter_bridge/ebtables.h
@@ -42,10 +42,10 @@
unsigned int valid_hooks;
unsigned int nentries;
unsigned int entries_size;
- struct ebt_entries __user * hook_entry[NF_BR_NUMHOOKS];
+ struct ebt_entries * hook_entry[NF_BR_NUMHOOKS];
unsigned int num_counters;
- struct ebt_counter __user * counters;
- char __user * entries;
+ struct ebt_counter * counters;
+ char * entries;
};
struct ebt_replace_kernel {
char name[EBT_TABLE_MAXNAMELEN];
diff --git a/libc/kernel/uapi/linux/netfilter_decnet.h b/libc/kernel/uapi/linux/netfilter_decnet.h
deleted file mode 100644
index c9c16ca..0000000
--- a/libc/kernel/uapi/linux/netfilter_decnet.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __LINUX_DECNET_NETFILTER_H
-#define __LINUX_DECNET_NETFILTER_H
-#include <linux/netfilter.h>
-#include <limits.h>
-#define NF_DN_NUMHOOKS 7
-#define NF_DN_PRE_ROUTING 0
-#define NF_DN_LOCAL_IN 1
-#define NF_DN_FORWARD 2
-#define NF_DN_LOCAL_OUT 3
-#define NF_DN_POST_ROUTING 4
-#define NF_DN_HELLO 5
-#define NF_DN_ROUTE 6
-enum nf_dn_hook_priorities {
- NF_DN_PRI_FIRST = INT_MIN,
- NF_DN_PRI_CONNTRACK = - 200,
- NF_DN_PRI_MANGLE = - 150,
- NF_DN_PRI_NAT_DST = - 100,
- NF_DN_PRI_FILTER = 0,
- NF_DN_PRI_NAT_SRC = 100,
- NF_DN_PRI_DNRTMSG = 200,
- NF_DN_PRI_LAST = INT_MAX,
-};
-struct nf_dn_rtmsg {
- int nfdn_ifindex;
-};
-#define NFDN_RTMSG(r) ((unsigned char *) (r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg)))
-#define DNRMG_L1_GROUP 0x01
-#define DNRMG_L2_GROUP 0x02
-enum {
- DNRNG_NLGRP_NONE,
-#define DNRNG_NLGRP_NONE DNRNG_NLGRP_NONE
- DNRNG_NLGRP_L1,
-#define DNRNG_NLGRP_L1 DNRNG_NLGRP_L1
- DNRNG_NLGRP_L2,
-#define DNRNG_NLGRP_L2 DNRNG_NLGRP_L2
- __DNRNG_NLGRP_MAX
-};
-#define DNRNG_NLGRP_MAX (__DNRNG_NLGRP_MAX - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/netfilter_ipv4/ip_tables.h b/libc/kernel/uapi/linux/netfilter_ipv4/ip_tables.h
index 033c519..5179be4 100644
--- a/libc/kernel/uapi/linux/netfilter_ipv4/ip_tables.h
+++ b/libc/kernel/uapi/linux/netfilter_ipv4/ip_tables.h
@@ -79,7 +79,7 @@
__u16 next_offset;
unsigned int comefrom;
struct xt_counters counters;
- unsigned char elems[0];
+ unsigned char elems[];
};
#define IPT_BASE_CTL 64
#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
@@ -112,13 +112,13 @@
unsigned int hook_entry[NF_INET_NUMHOOKS];
unsigned int underflow[NF_INET_NUMHOOKS];
unsigned int num_counters;
- struct xt_counters __user * counters;
- struct ipt_entry entries[0];
+ struct xt_counters * counters;
+ struct ipt_entry entries[];
};
struct ipt_get_entries {
char name[XT_TABLE_MAXNAMELEN];
unsigned int size;
- struct ipt_entry entrytable[0];
+ struct ipt_entry entrytable[];
};
static __inline__ struct xt_entry_target * ipt_get_target(struct ipt_entry * e) {
return(struct xt_entry_target *) ((char *) e + e->target_offset);
diff --git a/libc/kernel/uapi/linux/netfilter_ipv6/ip6_tables.h b/libc/kernel/uapi/linux/netfilter_ipv6/ip6_tables.h
index b3f426d..8c4ec88 100644
--- a/libc/kernel/uapi/linux/netfilter_ipv6/ip6_tables.h
+++ b/libc/kernel/uapi/linux/netfilter_ipv6/ip6_tables.h
@@ -132,13 +132,13 @@
unsigned int hook_entry[NF_INET_NUMHOOKS];
unsigned int underflow[NF_INET_NUMHOOKS];
unsigned int num_counters;
- struct xt_counters __user * counters;
- struct ip6t_entry entries[0];
+ struct xt_counters * counters;
+ struct ip6t_entry entries[];
};
struct ip6t_get_entries {
char name[XT_TABLE_MAXNAMELEN];
unsigned int size;
- struct ip6t_entry entrytable[0];
+ struct ip6t_entry entrytable[];
};
static __inline__ struct xt_entry_target * ip6t_get_target(struct ip6t_entry * e) {
return(struct xt_entry_target *) ((char *) e + e->target_offset);
diff --git a/libc/kernel/uapi/linux/netlink.h b/libc/kernel/uapi/linux/netlink.h
index 77825cc..17d5291 100644
--- a/libc/kernel/uapi/linux/netlink.h
+++ b/libc/kernel/uapi/linux/netlink.h
@@ -73,6 +73,7 @@
#define NLM_F_CREATE 0x400
#define NLM_F_APPEND 0x800
#define NLM_F_NONREC 0x100
+#define NLM_F_BULK 0x200
#define NLM_F_CAPPED 0x100
#define NLM_F_ACK_TLVS 0x200
#define NLMSG_ALIGNTO 4U
@@ -99,6 +100,8 @@
NLMSGERR_ATTR_OFFS,
NLMSGERR_ATTR_COOKIE,
NLMSGERR_ATTR_POLICY,
+ NLMSGERR_ATTR_MISS_TYPE,
+ NLMSGERR_ATTR_MISS_NEST,
__NLMSGERR_ATTR_MAX,
NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
};
diff --git a/libc/kernel/uapi/linux/nfs4.h b/libc/kernel/uapi/linux/nfs4.h
index 9d614ce..ef860e2 100644
--- a/libc/kernel/uapi/linux/nfs4.h
+++ b/libc/kernel/uapi/linux/nfs4.h
@@ -45,6 +45,7 @@
#define NFS4_FH_VOL_RENAME 0x0008
#define NFS4_OPEN_RESULT_CONFIRM 0x0002
#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004
+#define NFS4_OPEN_RESULT_PRESERVE_UNLINKED 0x0008
#define NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK 0x0020
#define NFS4_SHARE_ACCESS_MASK 0x000F
#define NFS4_SHARE_ACCESS_READ 0x0001
diff --git a/libc/kernel/uapi/linux/nfs4_mount.h b/libc/kernel/uapi/linux/nfs4_mount.h
index 0f794dd..9b9c9f8 100644
--- a/libc/kernel/uapi/linux/nfs4_mount.h
+++ b/libc/kernel/uapi/linux/nfs4_mount.h
@@ -21,7 +21,7 @@
#define NFS4_MOUNT_VERSION 1
struct nfs_string {
unsigned int len;
- const char __user * data;
+ const char * data;
};
struct nfs4_mount_data {
int version;
@@ -38,10 +38,10 @@
struct nfs_string mnt_path;
struct nfs_string hostname;
unsigned int host_addrlen;
- struct sockaddr __user * host_addr;
+ struct sockaddr * host_addr;
int proto;
int auth_flavourlen;
- int __user * auth_flavours;
+ int * auth_flavours;
};
#define NFS4_MOUNT_SOFT 0x0001
#define NFS4_MOUNT_INTR 0x0002
diff --git a/libc/kernel/uapi/linux/nl80211.h b/libc/kernel/uapi/linux/nl80211.h
index e902178..83fe597 100644
--- a/libc/kernel/uapi/linux/nl80211.h
+++ b/libc/kernel/uapi/linux/nl80211.h
@@ -185,6 +185,11 @@
NL80211_CMD_COLOR_CHANGE_COMPLETED,
NL80211_CMD_SET_FILS_AAD,
NL80211_CMD_ASSOC_COMEBACK,
+ NL80211_CMD_ADD_LINK,
+ NL80211_CMD_REMOVE_LINK,
+ NL80211_CMD_ADD_LINK_STA,
+ NL80211_CMD_MODIFY_LINK_STA,
+ NL80211_CMD_REMOVE_LINK_STA,
__NL80211_CMD_AFTER_LAST,
NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
};
@@ -511,6 +516,18 @@
NL80211_ATTR_MBSSID_ELEMS,
NL80211_ATTR_RADAR_BACKGROUND,
NL80211_ATTR_AP_SETTINGS_FLAGS,
+ NL80211_ATTR_EHT_CAPABILITY,
+ NL80211_ATTR_DISABLE_EHT,
+ NL80211_ATTR_MLO_LINKS,
+ NL80211_ATTR_MLO_LINK_ID,
+ NL80211_ATTR_MLD_ADDR,
+ NL80211_ATTR_MLO_SUPPORT,
+ NL80211_ATTR_MAX_NUM_AKM_SUITES,
+ NL80211_ATTR_EML_CAPABILITY,
+ NL80211_ATTR_MLD_CAPA_AND_OPS,
+ NL80211_ATTR_TX_HW_TIMESTAMP,
+ NL80211_ATTR_RX_HW_TIMESTAMP,
+ NL80211_ATTR_TD_BITMAP,
__NL80211_ATTR_AFTER_LAST,
NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
@@ -555,6 +572,8 @@
#define NL80211_HE_MAX_CAPABILITY_LEN 54
#define NL80211_MAX_NR_CIPHER_SUITES 5
#define NL80211_MAX_NR_AKM_SUITES 2
+#define NL80211_EHT_MIN_CAPABILITY_LEN 13
+#define NL80211_EHT_MAX_CAPABILITY_LEN 51
#define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10
#define NL80211_SCAN_RSSI_THOLD_OFF - 300
#define NL80211_CQM_TXE_MAX_INTVL 1800
@@ -616,6 +635,29 @@
NL80211_RATE_INFO_HE_RU_ALLOC_996,
NL80211_RATE_INFO_HE_RU_ALLOC_2x996,
};
+enum nl80211_eht_gi {
+ NL80211_RATE_INFO_EHT_GI_0_8,
+ NL80211_RATE_INFO_EHT_GI_1_6,
+ NL80211_RATE_INFO_EHT_GI_3_2,
+};
+enum nl80211_eht_ru_alloc {
+ NL80211_RATE_INFO_EHT_RU_ALLOC_26,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_52,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_52P26,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_106,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_106P26,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_242,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_484,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_484P242,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_996,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_996P484,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_996P484P242,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_2x996,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_2x996P484,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_3x996,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_3x996P484,
+ NL80211_RATE_INFO_EHT_RU_ALLOC_4x996,
+};
enum nl80211_rate_info {
__NL80211_RATE_INFO_INVALID,
NL80211_RATE_INFO_BITRATE,
@@ -635,6 +677,11 @@
NL80211_RATE_INFO_HE_GI,
NL80211_RATE_INFO_HE_DCM,
NL80211_RATE_INFO_HE_RU_ALLOC,
+ NL80211_RATE_INFO_320_MHZ_WIDTH,
+ NL80211_RATE_INFO_EHT_MCS,
+ NL80211_RATE_INFO_EHT_NSS,
+ NL80211_RATE_INFO_EHT_GI,
+ NL80211_RATE_INFO_EHT_RU_ALLOC,
__NL80211_RATE_INFO_AFTER_LAST,
NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1
};
@@ -754,6 +801,10 @@
NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA,
NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS,
+ NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC,
+ NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY,
+ NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET,
+ NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE,
__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
NL80211_BAND_IFTYPE_ATTR_MAX = __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST - 1
};
@@ -810,6 +861,8 @@
NL80211_FREQUENCY_ATTR_4MHZ,
NL80211_FREQUENCY_ATTR_8MHZ,
NL80211_FREQUENCY_ATTR_16MHZ,
+ NL80211_FREQUENCY_ATTR_NO_320MHZ,
+ NL80211_FREQUENCY_ATTR_NO_EHT,
__NL80211_FREQUENCY_ATTR_AFTER_LAST,
NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
};
@@ -878,6 +931,7 @@
NL80211_RRF_NO_80MHZ = 1 << 15,
NL80211_RRF_NO_160MHZ = 1 << 16,
NL80211_RRF_NO_HE = 1 << 17,
+ NL80211_RRF_NO_320MHZ = 1 << 18,
};
#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
#define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR
@@ -1033,6 +1087,7 @@
NL80211_CHAN_WIDTH_4,
NL80211_CHAN_WIDTH_8,
NL80211_CHAN_WIDTH_16,
+ NL80211_CHAN_WIDTH_320,
};
enum nl80211_bss_scan_width {
NL80211_BSS_CHAN_WIDTH_20,
@@ -1063,6 +1118,8 @@
NL80211_BSS_PARENT_BSSID,
NL80211_BSS_CHAIN_SIGNAL,
NL80211_BSS_FREQUENCY_OFFSET,
+ NL80211_BSS_MLO_LINK_ID,
+ NL80211_BSS_MLD_ADDR,
__NL80211_BSS_AFTER_LAST,
NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
};
@@ -1475,6 +1532,7 @@
NL80211_EXT_FEATURE_BSS_COLOR,
NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD,
NL80211_EXT_FEATURE_RADAR_BACKGROUND,
+ NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE,
NUM_NL80211_EXT_FEATURES,
MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
};
diff --git a/libc/kernel/uapi/linux/nvme_ioctl.h b/libc/kernel/uapi/linux/nvme_ioctl.h
index f2a328e..388e83f 100644
--- a/libc/kernel/uapi/linux/nvme_ioctl.h
+++ b/libc/kernel/uapi/linux/nvme_ioctl.h
@@ -63,7 +63,10 @@
__u64 metadata;
__u64 addr;
__u32 metadata_len;
- __u32 data_len;
+ union {
+ __u32 data_len;
+ __u32 vec_cnt;
+ };
__u32 cdw10;
__u32 cdw11;
__u32 cdw12;
@@ -74,6 +77,26 @@
__u32 rsvd2;
__u64 result;
};
+struct nvme_uring_cmd {
+ __u8 opcode;
+ __u8 flags;
+ __u16 rsvd1;
+ __u32 nsid;
+ __u32 cdw2;
+ __u32 cdw3;
+ __u64 metadata;
+ __u64 addr;
+ __u32 metadata_len;
+ __u32 data_len;
+ __u32 cdw10;
+ __u32 cdw11;
+ __u32 cdw12;
+ __u32 cdw13;
+ __u32 cdw14;
+ __u32 cdw15;
+ __u32 timeout_ms;
+ __u32 rsvd2;
+};
#define nvme_admin_cmd nvme_passthru_cmd
#define NVME_IOCTL_ID _IO('N', 0x40)
#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
@@ -84,4 +107,9 @@
#define NVME_IOCTL_RESCAN _IO('N', 0x46)
#define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64)
#define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64)
+#define NVME_IOCTL_IO64_CMD_VEC _IOWR('N', 0x49, struct nvme_passthru_cmd64)
+#define NVME_URING_CMD_IO _IOWR('N', 0x80, struct nvme_uring_cmd)
+#define NVME_URING_CMD_IO_VEC _IOWR('N', 0x81, struct nvme_uring_cmd)
+#define NVME_URING_CMD_ADMIN _IOWR('N', 0x82, struct nvme_uring_cmd)
+#define NVME_URING_CMD_ADMIN_VEC _IOWR('N', 0x83, struct nvme_uring_cmd)
#endif
diff --git a/libc/kernel/uapi/linux/omap3isp.h b/libc/kernel/uapi/linux/omap3isp.h
index d2eceb7..1834658 100644
--- a/libc/kernel/uapi/linux/omap3isp.h
+++ b/libc/kernel/uapi/linux/omap3isp.h
@@ -88,11 +88,12 @@
};
struct omap3isp_stat_data {
struct timeval ts;
- void __user * buf;
- __u32 buf_size;
+ void * buf;
+ __struct_group(, frame,, __u32 buf_size;
__u16 frame_number;
__u16 cur_frame;
__u16 config_counter;
+ );
};
#define OMAP3ISP_HIST_BINS_32 0
#define OMAP3ISP_HIST_BINS_64 1
@@ -223,12 +224,12 @@
__u16 update;
__u16 flag;
enum omap3isp_alaw_ipwidth alawip;
- struct omap3isp_ccdc_bclamp __user * bclamp;
- struct omap3isp_ccdc_blcomp __user * blcomp;
- struct omap3isp_ccdc_fpc __user * fpc;
- struct omap3isp_ccdc_lsc_config __user * lsc_cfg;
- struct omap3isp_ccdc_culling __user * cull;
- __u8 __user * lsc;
+ struct omap3isp_ccdc_bclamp * bclamp;
+ struct omap3isp_ccdc_blcomp * blcomp;
+ struct omap3isp_ccdc_fpc * fpc;
+ struct omap3isp_ccdc_lsc_config * lsc_cfg;
+ struct omap3isp_ccdc_culling * cull;
+ __u8 * lsc;
};
#define OMAP3ISP_PREV_LUMAENH (1 << 0)
#define OMAP3ISP_PREV_INVALAW (1 << 1)
@@ -322,17 +323,17 @@
__u32 update;
__u32 flag;
__u32 shading_shift;
- struct omap3isp_prev_luma __user * luma;
- struct omap3isp_prev_hmed __user * hmed;
- struct omap3isp_prev_cfa __user * cfa;
- struct omap3isp_prev_csup __user * csup;
- struct omap3isp_prev_wbal __user * wbal;
- struct omap3isp_prev_blkadj __user * blkadj;
- struct omap3isp_prev_rgbtorgb __user * rgb2rgb;
- struct omap3isp_prev_csc __user * csc;
- struct omap3isp_prev_yclimit __user * yclimit;
- struct omap3isp_prev_dcor __user * dcor;
- struct omap3isp_prev_nf __user * nf;
- struct omap3isp_prev_gtables __user * gamma;
+ struct omap3isp_prev_luma * luma;
+ struct omap3isp_prev_hmed * hmed;
+ struct omap3isp_prev_cfa * cfa;
+ struct omap3isp_prev_csup * csup;
+ struct omap3isp_prev_wbal * wbal;
+ struct omap3isp_prev_blkadj * blkadj;
+ struct omap3isp_prev_rgbtorgb * rgb2rgb;
+ struct omap3isp_prev_csc * csc;
+ struct omap3isp_prev_yclimit * yclimit;
+ struct omap3isp_prev_dcor * dcor;
+ struct omap3isp_prev_nf * nf;
+ struct omap3isp_prev_gtables * gamma;
};
#endif
diff --git a/libc/kernel/uapi/linux/omapfb.h b/libc/kernel/uapi/linux/omapfb.h
index 6ebec08..632e468 100644
--- a/libc/kernel/uapi/linux/omapfb.h
+++ b/libc/kernel/uapi/linux/omapfb.h
@@ -153,7 +153,7 @@
__u16 w;
__u16 h;
size_t buffer_size;
- void __user * buffer;
+ void * buffer;
};
struct omapfb_ovl_colormode {
__u8 overlay_idx;
diff --git a/libc/kernel/uapi/linux/openvswitch.h b/libc/kernel/uapi/linux/openvswitch.h
index 1f8ae17..0226e93 100644
--- a/libc/kernel/uapi/linux/openvswitch.h
+++ b/libc/kernel/uapi/linux/openvswitch.h
@@ -44,6 +44,7 @@
OVS_DP_ATTR_PAD,
OVS_DP_ATTR_MASKS_CACHE_SIZE,
OVS_DP_ATTR_PER_CPU_PIDS,
+ OVS_DP_ATTR_IFINDEX,
__OVS_DP_ATTR_MAX
};
#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
@@ -130,9 +131,16 @@
OVS_VPORT_ATTR_PAD,
OVS_VPORT_ATTR_IFINDEX,
OVS_VPORT_ATTR_NETNSID,
+ OVS_VPORT_ATTR_UPCALL_STATS,
__OVS_VPORT_ATTR_MAX
};
#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
+enum ovs_vport_upcall_attr {
+ OVS_VPORT_UPCALL_ATTR_SUCCESS,
+ OVS_VPORT_UPCALL_ATTR_FAIL,
+ __OVS_VPORT_UPCALL_ATTR_MAX
+};
+#define OVS_VPORT_UPCALL_ATTR_MAX (__OVS_VPORT_UPCALL_ATTR_MAX - 1)
enum {
OVS_VXLAN_EXT_UNSPEC,
OVS_VXLAN_EXT_GBP,
@@ -190,6 +198,10 @@
OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4,
OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6,
OVS_KEY_ATTR_NSH,
+ OVS_KEY_ATTR_PACKET_TYPE,
+ OVS_KEY_ATTR_ND_EXTENSIONS,
+ OVS_KEY_ATTR_TUNNEL_INFO,
+ OVS_KEY_ATTR_IPV6_EXTHDRS,
__OVS_KEY_ATTR_MAX
};
#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
@@ -245,6 +257,9 @@
__u8 ipv6_hlimit;
__u8 ipv6_frag;
};
+struct ovs_key_ipv6_exthdrs {
+ __u16 hdrs;
+};
struct ovs_key_tcp {
__be16 tcp_src;
__be16 tcp_dst;
diff --git a/libc/kernel/uapi/linux/pci_regs.h b/libc/kernel/uapi/linux/pci_regs.h
index 46612da..f932c18 100644
--- a/libc/kernel/uapi/linux/pci_regs.h
+++ b/libc/kernel/uapi/linux/pci_regs.h
@@ -525,6 +525,7 @@
#define PCI_EXP_SLTCTL_PWR_OFF 0x0400
#define PCI_EXP_SLTCTL_EIC 0x0800
#define PCI_EXP_SLTCTL_DLLSCE 0x1000
+#define PCI_EXP_SLTCTL_ASPL_DISABLE 0x2000
#define PCI_EXP_SLTCTL_IBPD_DISABLE 0x4000
#define PCI_EXP_SLTSTA 0x1a
#define PCI_EXP_SLTSTA_ABP 0x0001
@@ -634,7 +635,8 @@
#define PCI_EXT_CAP_ID_DVSEC 0x23
#define PCI_EXT_CAP_ID_DLF 0x25
#define PCI_EXT_CAP_ID_PL_16GT 0x26
-#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
+#define PCI_EXT_CAP_ID_DOE 0x2E
+#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_DOE
#define PCI_EXT_CAP_DSN_SIZEOF 12
#define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40
#define PCI_ERR_UNCOR_STATUS 0x04
@@ -900,6 +902,7 @@
#define PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG 0x34
#define PCI_PTM_CAP 0x04
#define PCI_PTM_CAP_REQ 0x00000001
+#define PCI_PTM_CAP_RES 0x00000002
#define PCI_PTM_CAP_ROOT 0x00000004
#define PCI_PTM_GRANULARITY_MASK 0x0000FF00
#define PCI_PTM_CTRL 0x08
@@ -937,4 +940,26 @@
#define PCI_PL_16GT_LE_CTRL_DSP_TX_PRESET_MASK 0x0000000F
#define PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_MASK 0x000000F0
#define PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_SHIFT 4
+#define PCI_DOE_CAP 0x04
+#define PCI_DOE_CAP_INT_SUP 0x00000001
+#define PCI_DOE_CAP_INT_MSG_NUM 0x00000ffe
+#define PCI_DOE_CTRL 0x08
+#define PCI_DOE_CTRL_ABORT 0x00000001
+#define PCI_DOE_CTRL_INT_EN 0x00000002
+#define PCI_DOE_CTRL_GO 0x80000000
+#define PCI_DOE_STATUS 0x0c
+#define PCI_DOE_STATUS_BUSY 0x00000001
+#define PCI_DOE_STATUS_INT_STATUS 0x00000002
+#define PCI_DOE_STATUS_ERROR 0x00000004
+#define PCI_DOE_STATUS_DATA_OBJECT_READY 0x80000000
+#define PCI_DOE_WRITE 0x10
+#define PCI_DOE_READ 0x14
+#define PCI_DOE_CAP_SIZEOF 0x18
+#define PCI_DOE_DATA_OBJECT_HEADER_1_VID 0x0000ffff
+#define PCI_DOE_DATA_OBJECT_HEADER_1_TYPE 0x00ff0000
+#define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH 0x0003ffff
+#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX 0x000000ff
+#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID 0x0000ffff
+#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL 0x00ff0000
+#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX 0xff000000
#endif
diff --git a/libc/kernel/uapi/linux/perf_event.h b/libc/kernel/uapi/linux/perf_event.h
index b022586..8f081ed 100644
--- a/libc/kernel/uapi/linux/perf_event.h
+++ b/libc/kernel/uapi/linux/perf_event.h
@@ -108,7 +108,6 @@
PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23,
PERF_SAMPLE_WEIGHT_STRUCT = 1U << 24,
PERF_SAMPLE_MAX = 1U << 25,
- __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63,
};
#define PERF_SAMPLE_WEIGHT_TYPE (PERF_SAMPLE_WEIGHT | PERF_SAMPLE_WEIGHT_STRUCT)
enum perf_branch_sample_type_shift {
@@ -130,6 +129,7 @@
PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15,
PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16,
PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17,
+ PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT = 18,
PERF_SAMPLE_BRANCH_MAX_SHIFT
};
enum perf_branch_sample_type {
@@ -151,6 +151,7 @@
PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT,
PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT,
PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT,
+ PERF_SAMPLE_BRANCH_PRIV_SAVE = 1U << PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT,
PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
};
enum {
@@ -165,8 +166,42 @@
PERF_BR_SYSRET = 8,
PERF_BR_COND_CALL = 9,
PERF_BR_COND_RET = 10,
+ PERF_BR_ERET = 11,
+ PERF_BR_IRQ = 12,
+ PERF_BR_SERROR = 13,
+ PERF_BR_NO_TX = 14,
+ PERF_BR_EXTEND_ABI = 15,
PERF_BR_MAX,
};
+enum {
+ PERF_BR_SPEC_NA = 0,
+ PERF_BR_SPEC_WRONG_PATH = 1,
+ PERF_BR_NON_SPEC_CORRECT_PATH = 2,
+ PERF_BR_SPEC_CORRECT_PATH = 3,
+ PERF_BR_SPEC_MAX,
+};
+enum {
+ PERF_BR_NEW_FAULT_ALGN = 0,
+ PERF_BR_NEW_FAULT_DATA = 1,
+ PERF_BR_NEW_FAULT_INST = 2,
+ PERF_BR_NEW_ARCH_1 = 3,
+ PERF_BR_NEW_ARCH_2 = 4,
+ PERF_BR_NEW_ARCH_3 = 5,
+ PERF_BR_NEW_ARCH_4 = 6,
+ PERF_BR_NEW_ARCH_5 = 7,
+ PERF_BR_NEW_MAX,
+};
+enum {
+ PERF_BR_PRIV_UNKNOWN = 0,
+ PERF_BR_PRIV_USER = 1,
+ PERF_BR_PRIV_KERNEL = 2,
+ PERF_BR_PRIV_HV = 3,
+};
+#define PERF_BR_ARM64_FIQ PERF_BR_NEW_ARCH_1
+#define PERF_BR_ARM64_DEBUG_HALT PERF_BR_NEW_ARCH_2
+#define PERF_BR_ARM64_DEBUG_EXIT PERF_BR_NEW_ARCH_3
+#define PERF_BR_ARM64_DEBUG_INST PERF_BR_NEW_ARCH_4
+#define PERF_BR_ARM64_DEBUG_DATA PERF_BR_NEW_ARCH_5
#define PERF_SAMPLE_BRANCH_PLM_ALL (PERF_SAMPLE_BRANCH_USER | PERF_SAMPLE_BRANCH_KERNEL | PERF_SAMPLE_BRANCH_HV)
enum perf_sample_regs_abi {
PERF_SAMPLE_REGS_ABI_NONE = 0,
@@ -191,7 +226,8 @@
PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
PERF_FORMAT_ID = 1U << 2,
PERF_FORMAT_GROUP = 1U << 3,
- PERF_FORMAT_MAX = 1U << 4,
+ PERF_FORMAT_LOST = 1U << 4,
+ PERF_FORMAT_MAX = 1U << 5,
};
#define PERF_ATTR_SIZE_VER0 64
#define PERF_ATTR_SIZE_VER1 72
@@ -244,7 +280,7 @@
struct perf_event_query_bpf {
__u32 ids_len;
__u32 prog_cnt;
- __u32 ids[0];
+ __u32 ids[];
};
#define PERF_EVENT_IOC_ENABLE _IO('$', 0)
#define PERF_EVENT_IOC_DISABLE _IO('$', 1)
@@ -432,6 +468,8 @@
#define PERF_MEM_LVLNUM_L2 0x02
#define PERF_MEM_LVLNUM_L3 0x03
#define PERF_MEM_LVLNUM_L4 0x04
+#define PERF_MEM_LVLNUM_CXL 0x09
+#define PERF_MEM_LVLNUM_IO 0x0a
#define PERF_MEM_LVLNUM_ANY_CACHE 0x0b
#define PERF_MEM_LVLNUM_LFB 0x0c
#define PERF_MEM_LVLNUM_RAM 0x0d
@@ -445,6 +483,7 @@
#define PERF_MEM_SNOOP_HITM 0x10
#define PERF_MEM_SNOOP_SHIFT 19
#define PERF_MEM_SNOOPX_FWD 0x01
+#define PERF_MEM_SNOOPX_PEER 0x02
#define PERF_MEM_SNOOPX_SHIFT 38
#define PERF_MEM_LOCK_NA 0x01
#define PERF_MEM_LOCK_LOCKED 0x02
@@ -470,7 +509,7 @@
struct perf_branch_entry {
__u64 from;
__u64 to;
- __u64 mispred : 1, predicted : 1, in_tx : 1, abort : 1, cycles : 16, type : 4, reserved : 40;
+ __u64 mispred : 1, predicted : 1, in_tx : 1, abort : 1, cycles : 16, type : 4, spec : 2, new_type : 4, priv : 3, reserved : 31;
};
union perf_sample_weight {
__u64 full;
diff --git a/libc/kernel/uapi/linux/pkt_cls.h b/libc/kernel/uapi/linux/pkt_cls.h
index 9fd89e0..876cb73 100644
--- a/libc/kernel/uapi/linux/pkt_cls.h
+++ b/libc/kernel/uapi/linux/pkt_cls.h
@@ -199,7 +199,7 @@
short offoff;
short hoff;
__be32 hmask;
- struct tc_u32_key keys[0];
+ struct tc_u32_key keys[];
};
struct tc_u32_mark {
__u32 val;
@@ -209,7 +209,7 @@
struct tc_u32_pcnt {
__u64 rcnt;
__u64 rhit;
- __u64 kcnts[0];
+ __u64 kcnts[];
};
#define TC_U32_TERMINAL 1
#define TC_U32_OFFSET 2
@@ -459,6 +459,10 @@
TCA_FLOWER_KEY_MPLS_OPTS,
TCA_FLOWER_KEY_HASH,
TCA_FLOWER_KEY_HASH_MASK,
+ TCA_FLOWER_KEY_NUM_OF_VLANS,
+ TCA_FLOWER_KEY_PPPOE_SID,
+ TCA_FLOWER_KEY_PPP_PROTO,
+ TCA_FLOWER_KEY_L2TPV3_SID,
__TCA_FLOWER_MAX,
};
#define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1)
@@ -476,6 +480,7 @@
TCA_FLOWER_KEY_ENC_OPTS_GENEVE,
TCA_FLOWER_KEY_ENC_OPTS_VXLAN,
TCA_FLOWER_KEY_ENC_OPTS_ERSPAN,
+ TCA_FLOWER_KEY_ENC_OPTS_GTP,
__TCA_FLOWER_KEY_ENC_OPTS_MAX,
};
#define TCA_FLOWER_KEY_ENC_OPTS_MAX (__TCA_FLOWER_KEY_ENC_OPTS_MAX - 1)
@@ -503,6 +508,13 @@
};
#define TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX (__TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX - 1)
enum {
+ TCA_FLOWER_KEY_ENC_OPT_GTP_UNSPEC,
+ TCA_FLOWER_KEY_ENC_OPT_GTP_PDU_TYPE,
+ TCA_FLOWER_KEY_ENC_OPT_GTP_QFI,
+ __TCA_FLOWER_KEY_ENC_OPT_GTP_MAX,
+};
+#define TCA_FLOWER_KEY_ENC_OPT_GTP_MAX (__TCA_FLOWER_KEY_ENC_OPT_GTP_MAX - 1)
+enum {
TCA_FLOWER_KEY_MPLS_OPTS_UNSPEC,
TCA_FLOWER_KEY_MPLS_OPTS_LSE,
__TCA_FLOWER_KEY_MPLS_OPTS_MAX,
diff --git a/libc/kernel/uapi/linux/pkt_sched.h b/libc/kernel/uapi/linux/pkt_sched.h
index e298b74..c31b8bb 100644
--- a/libc/kernel/uapi/linux/pkt_sched.h
+++ b/libc/kernel/uapi/linux/pkt_sched.h
@@ -924,6 +924,13 @@
#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST _BITUL(0)
#define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD _BITUL(1)
enum {
+ TCA_TAPRIO_TC_ENTRY_UNSPEC,
+ TCA_TAPRIO_TC_ENTRY_INDEX,
+ TCA_TAPRIO_TC_ENTRY_MAX_SDU,
+ __TCA_TAPRIO_TC_ENTRY_CNT,
+ TCA_TAPRIO_TC_ENTRY_MAX = (__TCA_TAPRIO_TC_ENTRY_CNT - 1)
+};
+enum {
TCA_TAPRIO_ATTR_UNSPEC,
TCA_TAPRIO_ATTR_PRIOMAP,
TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST,
@@ -936,6 +943,7 @@
TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION,
TCA_TAPRIO_ATTR_FLAGS,
TCA_TAPRIO_ATTR_TXTIME_DELAY,
+ TCA_TAPRIO_ATTR_TC_ENTRY,
__TCA_TAPRIO_ATTR_MAX,
};
#define TCA_TAPRIO_ATTR_MAX (__TCA_TAPRIO_ATTR_MAX - 1)
diff --git a/libc/kernel/uapi/linux/ppp-ioctl.h b/libc/kernel/uapi/linux/ppp-ioctl.h
index 69c6e6d..165d447 100644
--- a/libc/kernel/uapi/linux/ppp-ioctl.h
+++ b/libc/kernel/uapi/linux/ppp-ioctl.h
@@ -56,7 +56,7 @@
enum NPmode mode;
};
struct ppp_option_data {
- __u8 __user * ptr;
+ __u8 * ptr;
__u32 length;
int transmit;
};
diff --git a/libc/kernel/uapi/linux/pr.h b/libc/kernel/uapi/linux/pr.h
index 7a7b8b1..b3128ee 100644
--- a/libc/kernel/uapi/linux/pr.h
+++ b/libc/kernel/uapi/linux/pr.h
@@ -19,6 +19,14 @@
#ifndef _UAPI_PR_H
#define _UAPI_PR_H
#include <linux/types.h>
+enum pr_status {
+ PR_STS_SUCCESS = 0x0,
+ PR_STS_IOERR = 0x2,
+ PR_STS_RESERVATION_CONFLICT = 0x18,
+ PR_STS_RETRY_PATH_FAILURE = 0xe0000,
+ PR_STS_PATH_FAST_FAILED = 0xf0000,
+ PR_STS_PATH_FAILED = 0x10000,
+};
enum pr_type {
PR_WRITE_EXCLUSIVE = 1,
PR_EXCLUSIVE_ACCESS = 2,
diff --git a/libc/kernel/uapi/linux/prctl.h b/libc/kernel/uapi/linux/prctl.h
index 9b4c695..1dac726 100644
--- a/libc/kernel/uapi/linux/prctl.h
+++ b/libc/kernel/uapi/linux/prctl.h
@@ -179,6 +179,11 @@
#define PR_SCHED_CORE_SCOPE_THREAD 0
#define PR_SCHED_CORE_SCOPE_THREAD_GROUP 1
#define PR_SCHED_CORE_SCOPE_PROCESS_GROUP 2
+#define PR_SME_SET_VL 63
+#define PR_SME_SET_VL_ONEXEC (1 << 18)
+#define PR_SME_GET_VL 64
+#define PR_SME_VL_LEN_MASK 0xffff
+#define PR_SME_VL_INHERIT (1 << 17)
#define PR_SET_VMA 0x53564d41
#define PR_SET_VMA_ANON_NAME 0
#endif
diff --git a/libc/kernel/uapi/linux/psci.h b/libc/kernel/uapi/linux/psci.h
index bc522e7..ea8ce59 100644
--- a/libc/kernel/uapi/linux/psci.h
+++ b/libc/kernel/uapi/linux/psci.h
@@ -39,11 +39,23 @@
#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5)
#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7)
#define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10)
+#define PSCI_1_0_FN_CPU_FREEZE PSCI_0_2_FN(11)
+#define PSCI_1_0_FN_CPU_DEFAULT_SUSPEND PSCI_0_2_FN(12)
+#define PSCI_1_0_FN_NODE_HW_STATE PSCI_0_2_FN(13)
#define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14)
#define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15)
+#define PSCI_1_0_FN_STAT_RESIDENCY PSCI_0_2_FN(16)
+#define PSCI_1_0_FN_STAT_COUNT PSCI_0_2_FN(17)
#define PSCI_1_1_FN_SYSTEM_RESET2 PSCI_0_2_FN(18)
+#define PSCI_1_1_FN_MEM_PROTECT PSCI_0_2_FN(19)
+#define PSCI_1_1_FN_MEM_PROTECT_CHECK_RANGE PSCI_0_2_FN(20)
+#define PSCI_1_0_FN64_CPU_DEFAULT_SUSPEND PSCI_0_2_FN64(12)
+#define PSCI_1_0_FN64_NODE_HW_STATE PSCI_0_2_FN64(13)
#define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14)
+#define PSCI_1_0_FN64_STAT_RESIDENCY PSCI_0_2_FN64(16)
+#define PSCI_1_0_FN64_STAT_COUNT PSCI_0_2_FN64(17)
#define PSCI_1_1_FN64_SYSTEM_RESET2 PSCI_0_2_FN64(18)
+#define PSCI_1_1_FN64_MEM_PROTECT_CHECK_RANGE PSCI_0_2_FN64(20)
#define PSCI_0_2_POWER_STATE_ID_MASK 0xffff
#define PSCI_0_2_POWER_STATE_ID_SHIFT 0
#define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16
@@ -60,6 +72,8 @@
#define PSCI_0_2_TOS_UP_MIGRATE 0
#define PSCI_0_2_TOS_UP_NO_MIGRATE 1
#define PSCI_0_2_TOS_MP 2
+#define PSCI_1_1_RESET_TYPE_SYSTEM_WARM_RESET 0
+#define PSCI_1_1_RESET_TYPE_VENDOR_START 0x80000000U
#define PSCI_VERSION_MAJOR_SHIFT 16
#define PSCI_VERSION_MINOR_MASK ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1)
#define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK
diff --git a/libc/kernel/uapi/linux/psp-sev.h b/libc/kernel/uapi/linux/psp-sev.h
index 6c4f73d..8c9ec80 100644
--- a/libc/kernel/uapi/linux/psp-sev.h
+++ b/libc/kernel/uapi/linux/psp-sev.h
@@ -66,37 +66,37 @@
__u32 flags;
__u8 build;
__u32 guest_count;
-} __packed;
+} __attribute__((__packed__));
#define SEV_STATUS_FLAGS_CONFIG_ES 0x0100
struct sev_user_data_pek_csr {
__u64 address;
__u32 length;
-} __packed;
+} __attribute__((__packed__));
struct sev_user_data_pek_cert_import {
__u64 pek_cert_address;
__u32 pek_cert_len;
__u64 oca_cert_address;
__u32 oca_cert_len;
-} __packed;
+} __attribute__((__packed__));
struct sev_user_data_pdh_cert_export {
__u64 pdh_cert_address;
__u32 pdh_cert_len;
__u64 cert_chain_address;
__u32 cert_chain_len;
-} __packed;
+} __attribute__((__packed__));
struct sev_user_data_get_id {
__u8 socket1[64];
__u8 socket2[64];
-} __packed;
+} __attribute__((__packed__));
struct sev_user_data_get_id2 {
__u64 address;
__u32 length;
-} __packed;
+} __attribute__((__packed__));
struct sev_issue_cmd {
__u32 cmd;
__u64 data;
__u32 error;
-} __packed;
+} __attribute__((__packed__));
#define SEV_IOC_TYPE 'S'
#define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd)
#endif
diff --git a/libc/kernel/uapi/linux/qrtr.h b/libc/kernel/uapi/linux/qrtr.h
index c0a4c72..ee56aca 100644
--- a/libc/kernel/uapi/linux/qrtr.h
+++ b/libc/kernel/uapi/linux/qrtr.h
@@ -54,5 +54,5 @@
__le32 port;
} client;
};
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/linux/raid/md_p.h b/libc/kernel/uapi/linux/raid/md_p.h
index 4ad444a..dc3084a 100644
--- a/libc/kernel/uapi/linux/raid/md_p.h
+++ b/libc/kernel/uapi/linux/raid/md_p.h
@@ -168,7 +168,7 @@
__le32 sb_csum;
__le32 max_dev;
__u8 pad3[64 - 32];
- __le16 dev_roles[0];
+ __le16 dev_roles[];
};
#define MD_FEATURE_BITMAP_OFFSET 1
#define MD_FEATURE_RECOVERY_OFFSET 2
diff --git a/libc/kernel/uapi/linux/random.h b/libc/kernel/uapi/linux/random.h
index 2d3cfef..8df411b 100644
--- a/libc/kernel/uapi/linux/random.h
+++ b/libc/kernel/uapi/linux/random.h
@@ -31,7 +31,7 @@
struct rand_pool_info {
int entropy_count;
int buf_size;
- __u32 buf[0];
+ __u32 buf[];
};
#define GRND_NONBLOCK 0x0001
#define GRND_RANDOM 0x0002
diff --git a/libc/kernel/uapi/linux/reiserfs_xattr.h b/libc/kernel/uapi/linux/reiserfs_xattr.h
index 36d31f6..16a7a08 100644
--- a/libc/kernel/uapi/linux/reiserfs_xattr.h
+++ b/libc/kernel/uapi/linux/reiserfs_xattr.h
@@ -27,6 +27,6 @@
struct reiserfs_security_handle {
const char * name;
void * value;
- size_t length;
+ __kernel_size_t length;
};
#endif
diff --git a/libc/kernel/uapi/linux/rfkill.h b/libc/kernel/uapi/linux/rfkill.h
index 6020baf..b90e67c 100644
--- a/libc/kernel/uapi/linux/rfkill.h
+++ b/libc/kernel/uapi/linux/rfkill.h
@@ -63,4 +63,6 @@
#define RFKILL_IOC_MAGIC 'R'
#define RFKILL_IOC_NOINPUT 1
#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
+#define RFKILL_IOC_MAX_SIZE 2
+#define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_MAX_SIZE, __u32)
#endif
diff --git a/libc/kernel/uapi/linux/rkisp1-config.h b/libc/kernel/uapi/linux/rkisp1-config.h
index cea14cd..7175c23 100644
--- a/libc/kernel/uapi/linux/rkisp1-config.h
+++ b/libc/kernel/uapi/linux/rkisp1-config.h
@@ -67,6 +67,37 @@
#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12 81
#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12
#define RKISP1_CIF_ISP_DPCC_METHODS_MAX 3
+#define RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE (1U << 2)
+#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER (1U << 0)
+#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_RB_CENTER (1U << 1)
+#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_G_3X3 (1U << 2)
+#define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_RB_3X3 (1U << 3)
+#define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_SET(n) ((n) << 0)
+#define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET (1U << 3)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_GREEN_ENABLE (1U << 0)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE (1U << 1)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_GREEN_ENABLE (1U << 2)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE (1U << 3)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_GREEN_ENABLE (1U << 4)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_RED_BLUE_ENABLE (1U << 8)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE (1U << 9)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_RED_BLUE_ENABLE (1U << 10)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE (1U << 11)
+#define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_RED_BLUE_ENABLE (1U << 12)
+#define RKISP1_CIF_ISP_DPCC_LINE_THRESH_G(v) ((v) << 0)
+#define RKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(v) ((v) << 8)
+#define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_G(v) ((v) << 0)
+#define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_RB(v) ((v) << 8)
+#define RKISP1_CIF_ISP_DPCC_PG_FAC_G(v) ((v) << 0)
+#define RKISP1_CIF_ISP_DPCC_PG_FAC_RB(v) ((v) << 8)
+#define RKISP1_CIF_ISP_DPCC_RND_THRESH_G(v) ((v) << 0)
+#define RKISP1_CIF_ISP_DPCC_RND_THRESH_RB(v) ((v) << 8)
+#define RKISP1_CIF_ISP_DPCC_RG_FAC_G(v) ((v) << 0)
+#define RKISP1_CIF_ISP_DPCC_RG_FAC_RB(v) ((v) << 8)
+#define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_G(n,v) ((v) << ((n) * 4))
+#define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_RB(n,v) ((v) << ((n) * 4 + 2))
+#define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_G(n,v) ((v) << ((n) * 4))
+#define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(n,v) ((v) << ((n) * 4 + 2))
#define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS 17
#define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6
#define RKISP1_CIF_ISP_STAT_AWB (1U << 0)
diff --git a/libc/kernel/uapi/linux/romfs_fs.h b/libc/kernel/uapi/linux/romfs_fs.h
index 8e98714..bffbaf9 100644
--- a/libc/kernel/uapi/linux/romfs_fs.h
+++ b/libc/kernel/uapi/linux/romfs_fs.h
@@ -35,14 +35,14 @@
__be32 word1;
__be32 size;
__be32 checksum;
- char name[0];
+ char name[];
};
struct romfs_inode {
__be32 next;
__be32 spec;
__be32 size;
__be32 checksum;
- char name[0];
+ char name[];
};
#define ROMFH_TYPE 7
#define ROMFH_HRD 0
diff --git a/libc/kernel/uapi/linux/route.h b/libc/kernel/uapi/linux/route.h
index 4ba6023..f33327c 100644
--- a/libc/kernel/uapi/linux/route.h
+++ b/libc/kernel/uapi/linux/route.h
@@ -30,7 +30,7 @@
unsigned long rt_pad3;
void * rt_pad4;
short rt_metric;
- char __user * rt_dev;
+ char * rt_dev;
unsigned long rt_mtu;
#define rt_mss rt_mtu
unsigned long rt_window;
diff --git a/libc/kernel/uapi/linux/rpmsg.h b/libc/kernel/uapi/linux/rpmsg.h
index c5b5a76..9ceccdd 100644
--- a/libc/kernel/uapi/linux/rpmsg.h
+++ b/libc/kernel/uapi/linux/rpmsg.h
@@ -28,4 +28,6 @@
};
#define RPMSG_CREATE_EPT_IOCTL _IOW(0xb5, 0x1, struct rpmsg_endpoint_info)
#define RPMSG_DESTROY_EPT_IOCTL _IO(0xb5, 0x2)
+#define RPMSG_CREATE_DEV_IOCTL _IOW(0xb5, 0x3, struct rpmsg_endpoint_info)
+#define RPMSG_RELEASE_DEV_IOCTL _IOW(0xb5, 0x4, struct rpmsg_endpoint_info)
#endif
diff --git a/libc/kernel/uapi/linux/rseq.h b/libc/kernel/uapi/linux/rseq.h
index ba0ceb1..29a9457 100644
--- a/libc/kernel/uapi/linux/rseq.h
+++ b/libc/kernel/uapi/linux/rseq.h
@@ -47,22 +47,7 @@
struct rseq {
__u32 cpu_id_start;
__u32 cpu_id;
- union {
- __u64 ptr64;
-#ifdef __LP64__
- __u64 ptr;
-#else
- struct {
-#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN)
- __u32 padding;
- __u32 ptr32;
-#else
- __u32 ptr32;
- __u32 padding;
-#endif
- } ptr;
-#endif
- } rseq_cs;
+ __u64 rseq_cs;
__u32 flags;
} __attribute__((aligned(4 * sizeof(__u64))));
#endif
diff --git a/libc/kernel/uapi/linux/rtc.h b/libc/kernel/uapi/linux/rtc.h
index cf5f22a..d75bc45 100644
--- a/libc/kernel/uapi/linux/rtc.h
+++ b/libc/kernel/uapi/linux/rtc.h
@@ -96,7 +96,8 @@
#define RTC_FEATURE_UPDATE_INTERRUPT 4
#define RTC_FEATURE_CORRECTION 5
#define RTC_FEATURE_BACKUP_SWITCH_MODE 6
-#define RTC_FEATURE_CNT 7
+#define RTC_FEATURE_ALARM_WAKEUP_ONLY 7
+#define RTC_FEATURE_CNT 8
#define RTC_PARAM_FEATURES 0
#define RTC_PARAM_CORRECTION 1
#define RTC_PARAM_BACKUP_SWITCH_MODE 2
diff --git a/libc/kernel/uapi/linux/rtnetlink.h b/libc/kernel/uapi/linux/rtnetlink.h
index 91c3ee4..7201827 100644
--- a/libc/kernel/uapi/linux/rtnetlink.h
+++ b/libc/kernel/uapi/linux/rtnetlink.h
@@ -131,6 +131,8 @@
#define RTM_NEWSTATS RTM_NEWSTATS
RTM_GETSTATS = 94,
#define RTM_GETSTATS RTM_GETSTATS
+ RTM_SETSTATS,
+#define RTM_SETSTATS RTM_SETSTATS
RTM_NEWCACHEREPORT = 96,
#define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT
RTM_NEWCHAIN = 100,
@@ -163,6 +165,12 @@
#define RTM_DELNEXTHOPBUCKET RTM_DELNEXTHOPBUCKET
RTM_GETNEXTHOPBUCKET,
#define RTM_GETNEXTHOPBUCKET RTM_GETNEXTHOPBUCKET
+ RTM_NEWTUNNEL = 120,
+#define RTM_NEWTUNNEL RTM_NEWTUNNEL
+ RTM_DELTUNNEL,
+#define RTM_DELTUNNEL RTM_DELTUNNEL
+ RTM_GETTUNNEL,
+#define RTM_GETTUNNEL RTM_GETTUNNEL
__RTM_MAX,
#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
};
@@ -315,7 +323,7 @@
#define RTNH_DATA(rtnh) ((struct rtattr *) (((char *) (rtnh)) + RTNH_LENGTH(0)))
struct rtvia {
__kernel_sa_family_t rtvia_family;
- __u8 rtvia_addr[0];
+ __u8 rtvia_addr[];
};
struct rta_cacheinfo {
__u32 rta_clntref;
@@ -561,6 +569,10 @@
#define RTNLGRP_BRVLAN RTNLGRP_BRVLAN
RTNLGRP_MCTP_IFADDR,
#define RTNLGRP_MCTP_IFADDR RTNLGRP_MCTP_IFADDR
+ RTNLGRP_TUNNEL,
+#define RTNLGRP_TUNNEL RTNLGRP_TUNNEL
+ RTNLGRP_STATS,
+#define RTNLGRP_STATS RTNLGRP_STATS
__RTNLGRP_MAX
};
#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
@@ -592,4 +604,5 @@
#define RTEXT_FILTER_MRP (1 << 4)
#define RTEXT_FILTER_CFM_CONFIG (1 << 5)
#define RTEXT_FILTER_CFM_STATUS (1 << 6)
+#define RTEXT_FILTER_MST (1 << 7)
#endif
diff --git a/libc/kernel/uapi/linux/sctp.h b/libc/kernel/uapi/linux/sctp.h
index 765d6c9..4bf2412 100644
--- a/libc/kernel/uapi/linux/sctp.h
+++ b/libc/kernel/uapi/linux/sctp.h
@@ -210,7 +210,7 @@
__u16 sac_outbound_streams;
__u16 sac_inbound_streams;
sctp_assoc_t sac_assoc_id;
- __u8 sac_info[0];
+ __u8 sac_info[];
};
enum sctp_sac_state {
SCTP_COMM_UP,
@@ -244,7 +244,7 @@
__u32 sre_length;
__be16 sre_error;
sctp_assoc_t sre_assoc_id;
- __u8 sre_data[0];
+ __u8 sre_data[];
};
struct sctp_send_failed {
__u16 ssf_type;
@@ -253,7 +253,7 @@
__u32 ssf_error;
struct sctp_sndrcvinfo ssf_info;
sctp_assoc_t ssf_assoc_id;
- __u8 ssf_data[0];
+ __u8 ssf_data[];
};
struct sctp_send_failed_event {
__u16 ssf_type;
@@ -262,7 +262,7 @@
__u32 ssf_error;
struct sctp_sndinfo ssfe_info;
sctp_assoc_t ssf_assoc_id;
- __u8 ssf_data[0];
+ __u8 ssf_data[];
};
enum sctp_ssf_flags {
SCTP_DATA_UNSENT,
@@ -570,7 +570,7 @@
struct sctp_getaddrs {
sctp_assoc_t assoc_id;
__u32 addr_num;
- __u8 addrs[0];
+ __u8 addrs[];
};
struct sctp_assoc_stats {
sctp_assoc_t sas_assoc_id;
diff --git a/libc/kernel/uapi/linux/seccomp.h b/libc/kernel/uapi/linux/seccomp.h
index e58b421..cc506ae 100644
--- a/libc/kernel/uapi/linux/seccomp.h
+++ b/libc/kernel/uapi/linux/seccomp.h
@@ -32,6 +32,7 @@
#define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
#define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
#define SECCOMP_FILTER_FLAG_TSYNC_ESRCH (1UL << 4)
+#define SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV (1UL << 5)
#define SECCOMP_RET_KILL_PROCESS 0x80000000U
#define SECCOMP_RET_KILL_THREAD 0x00000000U
#define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD
diff --git a/libc/kernel/uapi/linux/sed-opal.h b/libc/kernel/uapi/linux/sed-opal.h
index a20197a..4c66231 100644
--- a/libc/kernel/uapi/linux/sed-opal.h
+++ b/libc/kernel/uapi/linux/sed-opal.h
@@ -46,6 +46,9 @@
OPAL_RW = 0x02,
OPAL_LK = 0x04,
};
+enum opal_lock_flags {
+ OPAL_SAVE_FOR_LOCK = 0x01,
+};
struct opal_key {
__u8 lr;
__u8 key_len;
@@ -74,7 +77,8 @@
struct opal_lock_unlock {
struct opal_session_info session;
__u32 l_state;
- __u8 __align[4];
+ __u16 flags;
+ __u8 __align[2];
};
struct opal_new_pw {
struct opal_session_info session;
@@ -112,6 +116,16 @@
__u64 flags;
__u64 priv;
};
+#define OPAL_FL_SUPPORTED 0x00000001
+#define OPAL_FL_LOCKING_SUPPORTED 0x00000002
+#define OPAL_FL_LOCKING_ENABLED 0x00000004
+#define OPAL_FL_LOCKED 0x00000008
+#define OPAL_FL_MBR_ENABLED 0x00000010
+#define OPAL_FL_MBR_DONE 0x00000020
+struct opal_status {
+ __u32 flags;
+ __u32 reserved;
+};
#define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
#define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
#define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
@@ -128,4 +142,5 @@
#define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done)
#define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr)
#define IOC_OPAL_GENERIC_TABLE_RW _IOW('p', 235, struct opal_read_write_table)
+#define IOC_OPAL_GET_STATUS _IOR('p', 236, struct opal_status)
#endif
diff --git a/libc/kernel/uapi/linux/seg6.h b/libc/kernel/uapi/linux/seg6.h
index f180485..b8206cc 100644
--- a/libc/kernel/uapi/linux/seg6.h
+++ b/libc/kernel/uapi/linux/seg6.h
@@ -28,7 +28,7 @@
__u8 first_segment;
__u8 flags;
__u16 tag;
- struct in6_addr segments[0];
+ struct in6_addr segments[];
};
#define SR6_FLAG1_PROTECTED (1 << 6)
#define SR6_FLAG1_OAM (1 << 5)
diff --git a/libc/kernel/uapi/linux/seg6_iptunnel.h b/libc/kernel/uapi/linux/seg6_iptunnel.h
index 1c1ad83..19d8ba4 100644
--- a/libc/kernel/uapi/linux/seg6_iptunnel.h
+++ b/libc/kernel/uapi/linux/seg6_iptunnel.h
@@ -27,12 +27,14 @@
#define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1)
struct seg6_iptunnel_encap {
int mode;
- struct ipv6_sr_hdr srh[0];
+ struct ipv6_sr_hdr srh[];
};
#define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(* x)) + (((x)->srh->hdrlen + 1) << 3))
enum {
SEG6_IPTUN_MODE_INLINE,
SEG6_IPTUN_MODE_ENCAP,
SEG6_IPTUN_MODE_L2ENCAP,
+ SEG6_IPTUN_MODE_ENCAP_RED,
+ SEG6_IPTUN_MODE_L2ENCAP_RED,
};
#endif
diff --git a/libc/kernel/uapi/linux/seg6_local.h b/libc/kernel/uapi/linux/seg6_local.h
index 61a8d97..4d062e8 100644
--- a/libc/kernel/uapi/linux/seg6_local.h
+++ b/libc/kernel/uapi/linux/seg6_local.h
@@ -31,6 +31,7 @@
SEG6_LOCAL_BPF,
SEG6_LOCAL_VRFTABLE,
SEG6_LOCAL_COUNTERS,
+ SEG6_LOCAL_FLAVORS,
__SEG6_LOCAL_MAX,
};
#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1)
@@ -71,4 +72,21 @@
__SEG6_LOCAL_CNT_MAX,
};
#define SEG6_LOCAL_CNT_MAX (__SEG6_LOCAL_CNT_MAX - 1)
+enum {
+ SEG6_LOCAL_FLV_UNSPEC,
+ SEG6_LOCAL_FLV_OPERATION,
+ SEG6_LOCAL_FLV_LCBLOCK_BITS,
+ SEG6_LOCAL_FLV_LCNODE_FN_BITS,
+ __SEG6_LOCAL_FLV_MAX,
+};
+#define SEG6_LOCAL_FLV_MAX (__SEG6_LOCAL_FLV_MAX - 1)
+enum {
+ SEG6_LOCAL_FLV_OP_UNSPEC,
+ SEG6_LOCAL_FLV_OP_PSP,
+ SEG6_LOCAL_FLV_OP_USP,
+ SEG6_LOCAL_FLV_OP_USD,
+ SEG6_LOCAL_FLV_OP_NEXT_CSID,
+ __SEG6_LOCAL_FLV_OP_MAX
+};
+#define SEG6_LOCAL_FLV_OP_MAX (__SEG6_LOCAL_FLV_OP_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/sem.h b/libc/kernel/uapi/linux/sem.h
index 98ed1bf..c2f25e7 100644
--- a/libc/kernel/uapi/linux/sem.h
+++ b/libc/kernel/uapi/linux/sem.h
@@ -48,10 +48,10 @@
};
union __kernel_legacy_semun {
int val;
- struct __kernel_legacy_semid_ds __user * buf;
- unsigned short __user * array;
- struct seminfo __user * __buf;
- void __user * __pad;
+ struct __kernel_legacy_semid_ds * buf;
+ unsigned short * array;
+ struct seminfo * __buf;
+ void * __pad;
};
struct seminfo {
int semmap;
diff --git a/libc/kernel/uapi/linux/serial.h b/libc/kernel/uapi/linux/serial.h
index e4e903d..5a83c62 100644
--- a/libc/kernel/uapi/linux/serial.h
+++ b/libc/kernel/uapi/linux/serial.h
@@ -96,9 +96,20 @@
#define SER_RS485_RTS_AFTER_SEND (1 << 2)
#define SER_RS485_RX_DURING_TX (1 << 4)
#define SER_RS485_TERMINATE_BUS (1 << 5)
+#define SER_RS485_ADDRB (1 << 6)
+#define SER_RS485_ADDR_RECV (1 << 7)
+#define SER_RS485_ADDR_DEST (1 << 8)
__u32 delay_rts_before_send;
__u32 delay_rts_after_send;
- __u32 padding[5];
+ union {
+ __u32 padding[5];
+ struct {
+ __u8 addr_recv;
+ __u8 addr_dest;
+ __u8 padding0[2];
+ __u32 padding1[4];
+ };
+ };
};
struct serial_iso7816 {
__u32 flags;
diff --git a/libc/kernel/uapi/linux/serial_core.h b/libc/kernel/uapi/linux/serial_core.h
index 0caf698..1e04429 100644
--- a/libc/kernel/uapi/linux/serial_core.h
+++ b/libc/kernel/uapi/linux/serial_core.h
@@ -47,6 +47,7 @@
#define PORT_SUNSAB 39
#define PORT_NPCM 40
#define PORT_TEGRA_TCU 41
+#define PORT_ASPEED_VUART 42
#define PORT_PCH_8LINE 44
#define PORT_PCH_2LINE 45
#define PORT_DZ 46
@@ -68,8 +69,6 @@
#define PORT_IMX 62
#define PORT_MPSC 63
#define PORT_TXX9 64
-#define PORT_VR41XX_SIU 65
-#define PORT_VR41XX_DSIU 66
#define PORT_S3C2400 67
#define PORT_M32R_SIO 68
#define PORT_JSM 69
@@ -122,4 +121,5 @@
#define PORT_SIFIVE_V0 120
#define PORT_SUNIX 121
#define PORT_LINFLEXUART 122
+#define PORT_SUNPLUS 123
#endif
diff --git a/libc/kernel/uapi/linux/serial_reg.h b/libc/kernel/uapi/linux/serial_reg.h
index b6648f8..e41e649 100644
--- a/libc/kernel/uapi/linux/serial_reg.h
+++ b/libc/kernel/uapi/linux/serial_reg.h
@@ -99,7 +99,7 @@
#define UART_LSR_PE 0x04
#define UART_LSR_OE 0x02
#define UART_LSR_DR 0x01
-#define UART_LSR_BRK_ERROR_BITS 0x1E
+#define UART_LSR_BRK_ERROR_BITS (UART_LSR_BI | UART_LSR_FE | UART_LSR_PE | UART_LSR_OE)
#define UART_MSR 6
#define UART_MSR_DCD 0x80
#define UART_MSR_RI 0x40
@@ -109,7 +109,7 @@
#define UART_MSR_TERI 0x04
#define UART_MSR_DDSR 0x02
#define UART_MSR_DCTS 0x01
-#define UART_MSR_ANY_DELTA 0x0F
+#define UART_MSR_ANY_DELTA (UART_MSR_DDCD | UART_MSR_TERI | UART_MSR_DDSR | UART_MSR_DCTS)
#define UART_SCR 7
#define UART_DLL 0
#define UART_DLM 1
diff --git a/libc/kernel/uapi/linux/sev-guest.h b/libc/kernel/uapi/linux/sev-guest.h
new file mode 100644
index 0000000..796479a
--- /dev/null
+++ b/libc/kernel/uapi/linux/sev-guest.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __UAPI_LINUX_SEV_GUEST_H_
+#define __UAPI_LINUX_SEV_GUEST_H_
+#include <linux/types.h>
+struct snp_report_req {
+ __u8 user_data[64];
+ __u32 vmpl;
+ __u8 rsvd[28];
+};
+struct snp_report_resp {
+ __u8 data[4000];
+};
+struct snp_derived_key_req {
+ __u32 root_key_select;
+ __u32 rsvd;
+ __u64 guest_field_select;
+ __u32 vmpl;
+ __u32 guest_svn;
+ __u64 tcb_version;
+};
+struct snp_derived_key_resp {
+ __u8 data[64];
+};
+struct snp_guest_request_ioctl {
+ __u8 msg_version;
+ __u64 req_data;
+ __u64 resp_data;
+ __u64 fw_err;
+};
+struct snp_ext_report_req {
+ struct snp_report_req data;
+ __u64 certs_address;
+ __u32 certs_len;
+};
+#define SNP_GUEST_REQ_IOC_TYPE 'S'
+#define SNP_GET_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x0, struct snp_guest_request_ioctl)
+#define SNP_GET_DERIVED_KEY _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x1, struct snp_guest_request_ioctl)
+#define SNP_GET_EXT_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x2, struct snp_guest_request_ioctl)
+#endif
diff --git a/libc/kernel/uapi/linux/smc.h b/libc/kernel/uapi/linux/smc.h
index 01494da..200c9b6 100644
--- a/libc/kernel/uapi/linux/smc.h
+++ b/libc/kernel/uapi/linux/smc.h
@@ -57,6 +57,9 @@
SMC_NETLINK_DUMP_SEID,
SMC_NETLINK_ENABLE_SEID,
SMC_NETLINK_DISABLE_SEID,
+ SMC_NETLINK_DUMP_HS_LIMITATION,
+ SMC_NETLINK_ENABLE_HS_LIMITATION,
+ SMC_NETLINK_DISABLE_HS_LIMITATION,
};
enum {
SMC_GEN_UNSPEC,
@@ -109,6 +112,7 @@
SMC_NLA_LGR_R_V2,
SMC_NLA_LGR_R_NET_COOKIE,
SMC_NLA_LGR_R_PAD,
+ SMC_NLA_LGR_R_BUF_TYPE,
__SMC_NLA_LGR_R_MAX,
SMC_NLA_LGR_R_MAX = __SMC_NLA_LGR_R_MAX - 1
};
@@ -249,4 +253,11 @@
__SMC_NLA_SEID_TABLE_MAX,
SMC_NLA_SEID_TABLE_MAX = __SMC_NLA_SEID_TABLE_MAX - 1
};
+enum {
+ SMC_NLA_HS_LIMITATION_UNSPEC,
+ SMC_NLA_HS_LIMITATION_ENABLED,
+ __SMC_NLA_HS_LIMITATION_MAX,
+ SMC_NLA_HS_LIMITATION_MAX = __SMC_NLA_HS_LIMITATION_MAX - 1
+};
+#define SMC_LIMIT_HS 1
#endif
diff --git a/libc/kernel/uapi/linux/snmp.h b/libc/kernel/uapi/linux/snmp.h
index a503a7e..e3d6ee3 100644
--- a/libc/kernel/uapi/linux/snmp.h
+++ b/libc/kernel/uapi/linux/snmp.h
@@ -259,6 +259,7 @@
LINUX_MIB_TCPDSACKIGNOREDDUBIOUS,
LINUX_MIB_TCPMIGRATEREQSUCCESS,
LINUX_MIB_TCPMIGRATEREQFAILURE,
+ LINUX_MIB_TCPPLBREHASH,
__LINUX_MIB_MAX
};
enum {
@@ -305,6 +306,8 @@
LINUX_MIB_TLSRXDEVICE,
LINUX_MIB_TLSDECRYPTERROR,
LINUX_MIB_TLSRXDEVICERESYNC,
+ LINUX_MIB_TLSDECRYPTRETRY,
+ LINUX_MIB_TLSRXNOPADVIOL,
__LINUX_MIB_TLSMAX
};
#endif
diff --git a/libc/kernel/uapi/linux/socket.h b/libc/kernel/uapi/linux/socket.h
index be16548..4a530a8 100644
--- a/libc/kernel/uapi/linux/socket.h
+++ b/libc/kernel/uapi/linux/socket.h
@@ -32,4 +32,7 @@
#define SOCK_SNDBUF_LOCK 1
#define SOCK_RCVBUF_LOCK 2
#define SOCK_BUF_LOCK_MASK (SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK)
+#define SOCK_TXREHASH_DEFAULT 255
+#define SOCK_TXREHASH_DISABLED 0
+#define SOCK_TXREHASH_ENABLED 1
#endif
diff --git a/libc/kernel/uapi/linux/spi/spi.h b/libc/kernel/uapi/linux/spi/spi.h
index 39267a2..693e752 100644
--- a/libc/kernel/uapi/linux/spi/spi.h
+++ b/libc/kernel/uapi/linux/spi/spi.h
@@ -40,5 +40,6 @@
#define SPI_TX_OCTAL _BITUL(13)
#define SPI_RX_OCTAL _BITUL(14)
#define SPI_3WIRE_HIZ _BITUL(15)
-#define SPI_MODE_USER_MASK (_BITUL(16) - 1)
+#define SPI_RX_CPHA_FLIP _BITUL(16)
+#define SPI_MODE_USER_MASK (_BITUL(17) - 1)
#endif
diff --git a/libc/kernel/uapi/linux/stat.h b/libc/kernel/uapi/linux/stat.h
index a15b9b5..89304ce 100644
--- a/libc/kernel/uapi/linux/stat.h
+++ b/libc/kernel/uapi/linux/stat.h
@@ -78,7 +78,8 @@
__u32 stx_dev_major;
__u32 stx_dev_minor;
__u64 stx_mnt_id;
- __u64 __spare2;
+ __u32 stx_dio_mem_align;
+ __u32 stx_dio_offset_align;
__u64 __spare3[12];
};
#define STATX_TYPE 0x00000001U
@@ -95,6 +96,7 @@
#define STATX_BASIC_STATS 0x000007ffU
#define STATX_BTIME 0x00000800U
#define STATX_MNT_ID 0x00001000U
+#define STATX_DIOALIGN 0x00002000U
#define STATX__RESERVED 0x80000000U
#define STATX_ALL 0x00000fffU
#define STATX_ATTR_COMPRESSED 0x00000004
diff --git a/libc/kernel/uapi/linux/stddef.h b/libc/kernel/uapi/linux/stddef.h
index d5cdf80..6bc6925 100644
--- a/libc/kernel/uapi/linux/stddef.h
+++ b/libc/kernel/uapi/linux/stddef.h
@@ -16,9 +16,12 @@
***
****************************************************************************
****************************************************************************/
+#ifndef _UAPI_LINUX_STDDEF_H
+#define _UAPI_LINUX_STDDEF_H
#include <linux/compiler_types.h>
#ifndef __always_inline
#define __always_inline inline
#endif
#define __struct_group(TAG,NAME,ATTRS,MEMBERS...) union { struct { MEMBERS } ATTRS; struct TAG { MEMBERS } ATTRS NAME; }
#define __DECLARE_FLEX_ARRAY(TYPE,NAME) struct { struct { } __empty_ ##NAME; TYPE NAME[]; }
+#endif
diff --git a/libc/kernel/uapi/linux/stm.h b/libc/kernel/uapi/linux/stm.h
index 1c7f7f3..b1453f7 100644
--- a/libc/kernel/uapi/linux/stm.h
+++ b/libc/kernel/uapi/linux/stm.h
@@ -28,7 +28,7 @@
__u16 width;
__u16 __reserved_0;
__u32 __reserved_1;
- char id[0];
+ char id[];
};
#define STP_POLICY_ID_SET _IOWR('%', 0, struct stp_policy_id)
#define STP_POLICY_ID_GET _IOR('%', 1, struct stp_policy_id)
diff --git a/libc/kernel/uapi/linux/swab.h b/libc/kernel/uapi/linux/swab.h
index e96085e..332023a 100644
--- a/libc/kernel/uapi/linux/swab.h
+++ b/libc/kernel/uapi/linux/swab.h
@@ -19,7 +19,7 @@
#ifndef _UAPI_LINUX_SWAB_H
#define _UAPI_LINUX_SWAB_H
#include <linux/types.h>
-#include <linux/compiler.h>
+#include <linux/stddef.h>
#include <asm/bitsperlong.h>
#include <asm/swab.h>
#define ___constant_swab16(x) ((__u16) ((((__u16) (x) & (__u16) 0x00ffU) << 8) | (((__u16) (x) & (__u16) 0xff00U) >> 8)))
diff --git a/libc/kernel/uapi/linux/sysctl.h b/libc/kernel/uapi/linux/sysctl.h
index ae9c2ba..5714323 100644
--- a/libc/kernel/uapi/linux/sysctl.h
+++ b/libc/kernel/uapi/linux/sysctl.h
@@ -23,11 +23,11 @@
#include <linux/compiler.h>
#define CTL_MAXNAME 10
struct __sysctl_args {
- int __user * name;
+ int * name;
int nlen;
- void __user * oldval;
- size_t __user * oldlenp;
- void __user * newval;
+ void * oldval;
+ size_t * oldlenp;
+ void * newval;
size_t newlen;
unsigned long __linux_unused[4];
};
@@ -516,6 +516,7 @@
NET_NEIGH_GC_THRESH3 = 16,
NET_NEIGH_RETRANS_TIME_MS = 17,
NET_NEIGH_REACHABLE_TIME_MS = 18,
+ NET_NEIGH_INTERVAL_PROBE_TIME_MS = 19,
};
enum {
NET_DCCP_DEFAULT = 1,
diff --git a/libc/kernel/uapi/linux/target_core_user.h b/libc/kernel/uapi/linux/target_core_user.h
index dcba00e..83e155e 100644
--- a/libc/kernel/uapi/linux/target_core_user.h
+++ b/libc/kernel/uapi/linux/target_core_user.h
@@ -34,7 +34,7 @@
__u32 cmdr_size;
__u32 cmd_head;
__u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE)));
-} __packed;
+} __attribute__((__packed__));
enum tcmu_opcode {
TCMU_OP_PAD = 0,
TCMU_OP_CMD,
@@ -48,7 +48,7 @@
#define TCMU_UFLAG_READ_LEN 0x2
#define TCMU_UFLAG_KEEP_BUF 0x4
__u8 uflags;
-} __packed;
+} __attribute__((__packed__));
#define TCMU_OP_MASK 0x7
#define TCMU_SENSE_BUFFERSIZE 96
struct tcmu_cmd_entry {
@@ -71,7 +71,7 @@
char sense_buffer[TCMU_SENSE_BUFFERSIZE];
} rsp;
};
-} __packed;
+} __attribute__((__packed__));
struct tcmu_tmr_entry {
struct tcmu_cmd_entry_hdr hdr;
#define TCMU_TMR_UNKNOWN 0
@@ -89,8 +89,8 @@
__u32 cmd_cnt;
__u64 __pad3;
__u64 __pad4;
- __u16 cmd_ids[0];
-} __packed;
+ __u16 cmd_ids[];
+} __attribute__((__packed__));
#define TCMU_OP_ALIGN_SIZE sizeof(__u64)
enum tcmu_genl_cmd {
TCMU_CMD_UNSPEC,
diff --git a/libc/kernel/uapi/linux/taskstats.h b/libc/kernel/uapi/linux/taskstats.h
index efa5b4a..c1cda52 100644
--- a/libc/kernel/uapi/linux/taskstats.h
+++ b/libc/kernel/uapi/linux/taskstats.h
@@ -19,7 +19,7 @@
#ifndef _LINUX_TASKSTATS_H
#define _LINUX_TASKSTATS_H
#include <linux/types.h>
-#define TASKSTATS_VERSION 11
+#define TASKSTATS_VERSION 13
#define TS_COMM_LEN 32
struct taskstats {
__u16 version;
@@ -71,6 +71,12 @@
__u64 ac_btime64;
__u64 compact_count;
__u64 compact_delay_total;
+ __u32 ac_tgid;
+ __u64 ac_tgetime __attribute__((aligned(8)));
+ __u64 ac_exe_dev;
+ __u64 ac_exe_inode;
+ __u64 wpcopy_count;
+ __u64 wpcopy_delay_total;
};
enum {
TASKSTATS_CMD_UNSPEC = 0,
diff --git a/libc/kernel/uapi/linux/tc_act/tc_ct.h b/libc/kernel/uapi/linux/tc_act/tc_ct.h
index 0443b95..be83c60 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_ct.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_ct.h
@@ -37,6 +37,9 @@
TCA_CT_NAT_PORT_MIN,
TCA_CT_NAT_PORT_MAX,
TCA_CT_PAD,
+ TCA_CT_HELPER_NAME,
+ TCA_CT_HELPER_FAMILY,
+ TCA_CT_HELPER_PROTO,
__TCA_CT_MAX
};
#define TCA_CT_MAX (__TCA_CT_MAX - 1)
diff --git a/libc/kernel/uapi/linux/tc_act/tc_skbedit.h b/libc/kernel/uapi/linux/tc_act/tc_skbedit.h
index 5706d4d..b041a6a 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_skbedit.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_skbedit.h
@@ -25,6 +25,7 @@
#define SKBEDIT_F_PTYPE 0x8
#define SKBEDIT_F_MASK 0x10
#define SKBEDIT_F_INHERITDSFIELD 0x20
+#define SKBEDIT_F_TXQ_SKBHASH 0x40
struct tc_skbedit {
tc_gen;
};
@@ -39,6 +40,7 @@
TCA_SKBEDIT_PTYPE,
TCA_SKBEDIT_MASK,
TCA_SKBEDIT_FLAGS,
+ TCA_SKBEDIT_QUEUE_MAPPING_MAX,
__TCA_SKBEDIT_MAX
};
#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1)
diff --git a/libc/kernel/uapi/linux/tcp.h b/libc/kernel/uapi/linux/tcp.h
index c96d695..7a93208 100644
--- a/libc/kernel/uapi/linux/tcp.h
+++ b/libc/kernel/uapi/linux/tcp.h
@@ -192,6 +192,8 @@
__u32 tcpi_reord_seen;
__u32 tcpi_rcv_ooopack;
__u32 tcpi_snd_wnd;
+ __u32 tcpi_rcv_wnd;
+ __u32 tcpi_rehash;
};
enum {
TCP_NLA_PAD,
@@ -221,6 +223,7 @@
TCP_NLA_BYTES_NOTSENT,
TCP_NLA_EDT,
TCP_NLA_TTL,
+ TCP_NLA_REHASH,
};
#define TCP_MD5SIG_MAXKEYLEN 80
#define TCP_MD5SIG_FLAG_PREFIX 0x1
diff --git a/libc/kernel/uapi/linux/tdx-guest.h b/libc/kernel/uapi/linux/tdx-guest.h
new file mode 100644
index 0000000..50f9c62
--- /dev/null
+++ b/libc/kernel/uapi/linux/tdx-guest.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_TDX_GUEST_H_
+#define _UAPI_LINUX_TDX_GUEST_H_
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#define TDX_REPORTDATA_LEN 64
+#define TDX_REPORT_LEN 1024
+struct tdx_report_req {
+ __u8 reportdata[TDX_REPORTDATA_LEN];
+ __u8 tdreport[TDX_REPORT_LEN];
+};
+#define TDX_CMD_GET_REPORT0 _IOWR('T', 1, struct tdx_report_req)
+#endif
diff --git a/libc/kernel/uapi/linux/tee.h b/libc/kernel/uapi/linux/tee.h
index 5cfe713..404b7b2 100644
--- a/libc/kernel/uapi/linux/tee.h
+++ b/libc/kernel/uapi/linux/tee.h
@@ -22,8 +22,6 @@
#include <linux/types.h>
#define TEE_IOC_MAGIC 0xa4
#define TEE_IOC_BASE 0
-#define TEE_IOCTL_SHM_MAPPED 0x1
-#define TEE_IOCTL_SHM_DMA_BUF 0x2
#define TEE_MAX_ARG_SIZE 1024
#define TEE_GEN_CAP_GP (1 << 0)
#define TEE_GEN_CAP_PRIVILEGED (1 << 1)
diff --git a/libc/kernel/uapi/linux/thermal.h b/libc/kernel/uapi/linux/thermal.h
index 72ea378..2f9dccb 100644
--- a/libc/kernel/uapi/linux/thermal.h
+++ b/libc/kernel/uapi/linux/thermal.h
@@ -54,6 +54,10 @@
THERMAL_GENL_ATTR_CDEV_MAX_STATE,
THERMAL_GENL_ATTR_CDEV_NAME,
THERMAL_GENL_ATTR_GOV_NAME,
+ THERMAL_GENL_ATTR_CPU_CAPABILITY,
+ THERMAL_GENL_ATTR_CPU_CAPABILITY_ID,
+ THERMAL_GENL_ATTR_CPU_CAPABILITY_PERFORMANCE,
+ THERMAL_GENL_ATTR_CPU_CAPABILITY_EFFICIENCY,
__THERMAL_GENL_ATTR_MAX,
};
#define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
@@ -77,6 +81,7 @@
THERMAL_GENL_EVENT_CDEV_DELETE,
THERMAL_GENL_EVENT_CDEV_STATE_UPDATE,
THERMAL_GENL_EVENT_TZ_GOV_CHANGE,
+ THERMAL_GENL_EVENT_CPU_CAPABILITY_CHANGE,
__THERMAL_GENL_EVENT_MAX,
};
#define THERMAL_GENL_EVENT_MAX (__THERMAL_GENL_EVENT_MAX - 1)
diff --git a/libc/kernel/uapi/linux/time.h b/libc/kernel/uapi/linux/time.h
index df52295..55d0e6e 100644
--- a/libc/kernel/uapi/linux/time.h
+++ b/libc/kernel/uapi/linux/time.h
@@ -18,14 +18,11 @@
****************************************************************************/
#ifndef _UAPI_LINUX_TIME_H
#define _UAPI_LINUX_TIME_H
+#include <bits/timespec.h>
#include <linux/types.h>
#include <linux/time_types.h>
#ifndef _STRUCT_TIMESPEC
#define _STRUCT_TIMESPEC
-struct timespec {
- __kernel_old_time_t tv_sec;
- long tv_nsec;
-};
#endif
struct timeval {
__kernel_old_time_t tv_sec;
diff --git a/libc/kernel/uapi/linux/tipc_config.h b/libc/kernel/uapi/linux/tipc_config.h
index a371e37..c6ee1d1 100644
--- a/libc/kernel/uapi/linux/tipc_config.h
+++ b/libc/kernel/uapi/linux/tipc_config.h
@@ -22,7 +22,6 @@
#include <linux/string.h>
#include <linux/tipc.h>
#include <asm/byteorder.h>
-#include <arpa/inet.h>
#define TIPC_CMD_NOOP 0x0000
#define TIPC_CMD_GET_NODES 0x0001
#define TIPC_CMD_GET_MEDIA_NAMES 0x0002
diff --git a/libc/kernel/uapi/linux/tls.h b/libc/kernel/uapi/linux/tls.h
index c98ea0b..fcab74b 100644
--- a/libc/kernel/uapi/linux/tls.h
+++ b/libc/kernel/uapi/linux/tls.h
@@ -21,6 +21,8 @@
#include <linux/types.h>
#define TLS_TX 1
#define TLS_RX 2
+#define TLS_TX_ZEROCOPY_RO 3
+#define TLS_RX_EXPECT_NO_PAD 4
#define TLS_VERSION_MINOR(ver) ((ver) & 0xFF)
#define TLS_VERSION_MAJOR(ver) (((ver) >> 8) & 0xFF)
#define TLS_VERSION_NUMBER(id) ((((id ##_VERSION_MAJOR) & 0xFF) << 8) | ((id ##_VERSION_MINOR) & 0xFF))
@@ -66,6 +68,18 @@
#define TLS_CIPHER_SM4_CCM_SALT_SIZE 4
#define TLS_CIPHER_SM4_CCM_TAG_SIZE 16
#define TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE 8
+#define TLS_CIPHER_ARIA_GCM_128 57
+#define TLS_CIPHER_ARIA_GCM_128_IV_SIZE 8
+#define TLS_CIPHER_ARIA_GCM_128_KEY_SIZE 16
+#define TLS_CIPHER_ARIA_GCM_128_SALT_SIZE 4
+#define TLS_CIPHER_ARIA_GCM_128_TAG_SIZE 16
+#define TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE 8
+#define TLS_CIPHER_ARIA_GCM_256 58
+#define TLS_CIPHER_ARIA_GCM_256_IV_SIZE 8
+#define TLS_CIPHER_ARIA_GCM_256_KEY_SIZE 32
+#define TLS_CIPHER_ARIA_GCM_256_SALT_SIZE 4
+#define TLS_CIPHER_ARIA_GCM_256_TAG_SIZE 16
+#define TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE 8
#define TLS_SET_RECORD_TYPE 1
#define TLS_GET_RECORD_TYPE 2
struct tls_crypto_info {
@@ -114,12 +128,28 @@
unsigned char salt[TLS_CIPHER_SM4_CCM_SALT_SIZE];
unsigned char rec_seq[TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE];
};
+struct tls12_crypto_info_aria_gcm_128 {
+ struct tls_crypto_info info;
+ unsigned char iv[TLS_CIPHER_ARIA_GCM_128_IV_SIZE];
+ unsigned char key[TLS_CIPHER_ARIA_GCM_128_KEY_SIZE];
+ unsigned char salt[TLS_CIPHER_ARIA_GCM_128_SALT_SIZE];
+ unsigned char rec_seq[TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE];
+};
+struct tls12_crypto_info_aria_gcm_256 {
+ struct tls_crypto_info info;
+ unsigned char iv[TLS_CIPHER_ARIA_GCM_256_IV_SIZE];
+ unsigned char key[TLS_CIPHER_ARIA_GCM_256_KEY_SIZE];
+ unsigned char salt[TLS_CIPHER_ARIA_GCM_256_SALT_SIZE];
+ unsigned char rec_seq[TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE];
+};
enum {
TLS_INFO_UNSPEC,
TLS_INFO_VERSION,
TLS_INFO_CIPHER,
TLS_INFO_TXCONF,
TLS_INFO_RXCONF,
+ TLS_INFO_ZC_RO_TX,
+ TLS_INFO_RX_NO_PAD,
__TLS_INFO_MAX,
};
#define TLS_INFO_MAX (__TLS_INFO_MAX - 1)
diff --git a/libc/kernel/uapi/linux/tty.h b/libc/kernel/uapi/linux/tty.h
index dcce572..a94e6e6 100644
--- a/libc/kernel/uapi/linux/tty.h
+++ b/libc/kernel/uapi/linux/tty.h
@@ -18,7 +18,6 @@
****************************************************************************/
#ifndef _UAPI_LINUX_TTY_H
#define _UAPI_LINUX_TTY_H
-#define NR_LDISCS 30
#define N_TTY 0
#define N_SLIP 1
#define N_MOUSE 2
@@ -48,4 +47,7 @@
#define N_SPEAKUP 26
#define N_NULL 27
#define N_MCTP 28
+#define N_DEVELOPMENT 29
+#define N_CAN327 30
+#define NR_LDISCS 31
#endif
diff --git a/libc/kernel/uapi/linux/types.h b/libc/kernel/uapi/linux/types.h
index 9145e66..f41d676 100644
--- a/libc/kernel/uapi/linux/types.h
+++ b/libc/kernel/uapi/linux/types.h
@@ -21,8 +21,8 @@
#include <asm/types.h>
#ifndef __ASSEMBLY__
#include <linux/posix_types.h>
-#define __bitwise__
-#define __bitwise __bitwise__
+#define __bitwise
+#define __bitwise__ __bitwise
typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __le32;
diff --git a/libc/kernel/uapi/linux/ublk_cmd.h b/libc/kernel/uapi/linux/ublk_cmd.h
new file mode 100644
index 0000000..8c9cbeb
--- /dev/null
+++ b/libc/kernel/uapi/linux/ublk_cmd.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef USER_BLK_DRV_CMD_INC_H
+#define USER_BLK_DRV_CMD_INC_H
+#include <linux/types.h>
+#define UBLK_CMD_GET_QUEUE_AFFINITY 0x01
+#define UBLK_CMD_GET_DEV_INFO 0x02
+#define UBLK_CMD_ADD_DEV 0x04
+#define UBLK_CMD_DEL_DEV 0x05
+#define UBLK_CMD_START_DEV 0x06
+#define UBLK_CMD_STOP_DEV 0x07
+#define UBLK_CMD_SET_PARAMS 0x08
+#define UBLK_CMD_GET_PARAMS 0x09
+#define UBLK_CMD_START_USER_RECOVERY 0x10
+#define UBLK_CMD_END_USER_RECOVERY 0x11
+#define UBLK_IO_FETCH_REQ 0x20
+#define UBLK_IO_COMMIT_AND_FETCH_REQ 0x21
+#define UBLK_IO_NEED_GET_DATA 0x22
+#define UBLK_IO_RES_OK 0
+#define UBLK_IO_RES_NEED_GET_DATA 1
+#define UBLK_IO_RES_ABORT (- ENODEV)
+#define UBLKSRV_CMD_BUF_OFFSET 0
+#define UBLKSRV_IO_BUF_OFFSET 0x80000000
+#define UBLK_MAX_QUEUE_DEPTH 4096
+#define UBLK_F_SUPPORT_ZERO_COPY (1ULL << 0)
+#define UBLK_F_URING_CMD_COMP_IN_TASK (1ULL << 1)
+#define UBLK_F_NEED_GET_DATA (1UL << 2)
+#define UBLK_F_USER_RECOVERY (1UL << 3)
+#define UBLK_F_USER_RECOVERY_REISSUE (1UL << 4)
+#define UBLK_S_DEV_DEAD 0
+#define UBLK_S_DEV_LIVE 1
+#define UBLK_S_DEV_QUIESCED 2
+struct ublksrv_ctrl_cmd {
+ __u32 dev_id;
+ __u16 queue_id;
+ __u16 len;
+ __u64 addr;
+ __u64 data[2];
+};
+struct ublksrv_ctrl_dev_info {
+ __u16 nr_hw_queues;
+ __u16 queue_depth;
+ __u16 state;
+ __u16 pad0;
+ __u32 max_io_buf_bytes;
+ __u32 dev_id;
+ __s32 ublksrv_pid;
+ __u32 pad1;
+ __u64 flags;
+ __u64 ublksrv_flags;
+ __u64 reserved0;
+ __u64 reserved1;
+ __u64 reserved2;
+};
+#define UBLK_IO_OP_READ 0
+#define UBLK_IO_OP_WRITE 1
+#define UBLK_IO_OP_FLUSH 2
+#define UBLK_IO_OP_DISCARD 3
+#define UBLK_IO_OP_WRITE_SAME 4
+#define UBLK_IO_OP_WRITE_ZEROES 5
+#define UBLK_IO_F_FAILFAST_DEV (1U << 8)
+#define UBLK_IO_F_FAILFAST_TRANSPORT (1U << 9)
+#define UBLK_IO_F_FAILFAST_DRIVER (1U << 10)
+#define UBLK_IO_F_META (1U << 11)
+#define UBLK_IO_F_FUA (1U << 13)
+#define UBLK_IO_F_NOUNMAP (1U << 15)
+#define UBLK_IO_F_SWAP (1U << 16)
+struct ublksrv_io_desc {
+ __u32 op_flags;
+ __u32 nr_sectors;
+ __u64 start_sector;
+ __u64 addr;
+};
+struct ublksrv_io_cmd {
+ __u16 q_id;
+ __u16 tag;
+ __s32 result;
+ __u64 addr;
+};
+struct ublk_param_basic {
+#define UBLK_ATTR_READ_ONLY (1 << 0)
+#define UBLK_ATTR_ROTATIONAL (1 << 1)
+#define UBLK_ATTR_VOLATILE_CACHE (1 << 2)
+#define UBLK_ATTR_FUA (1 << 3)
+ __u32 attrs;
+ __u8 logical_bs_shift;
+ __u8 physical_bs_shift;
+ __u8 io_opt_shift;
+ __u8 io_min_shift;
+ __u32 max_sectors;
+ __u32 chunk_sectors;
+ __u64 dev_sectors;
+ __u64 virt_boundary_mask;
+};
+struct ublk_param_discard {
+ __u32 discard_alignment;
+ __u32 discard_granularity;
+ __u32 max_discard_sectors;
+ __u32 max_write_zeroes_sectors;
+ __u16 max_discard_segments;
+ __u16 reserved0;
+};
+struct ublk_params {
+ __u32 len;
+#define UBLK_PARAM_TYPE_BASIC (1 << 0)
+#define UBLK_PARAM_TYPE_DISCARD (1 << 1)
+ __u32 types;
+ struct ublk_param_basic basic;
+ struct ublk_param_discard discard;
+};
+#endif
diff --git a/libc/kernel/uapi/linux/uhid.h b/libc/kernel/uapi/linux/uhid.h
index 228ee50..1d471f8 100644
--- a/libc/kernel/uapi/linux/uhid.h
+++ b/libc/kernel/uapi/linux/uhid.h
@@ -106,7 +106,7 @@
__u8 name[128];
__u8 phys[64];
__u8 uniq[64];
- __u8 __user * rd_data;
+ __u8 * rd_data;
__u16 rd_size;
__u16 bus;
__u32 vendor;
diff --git a/libc/kernel/uapi/linux/uio.h b/libc/kernel/uapi/linux/uio.h
index fa955cd..04814c7 100644
--- a/libc/kernel/uapi/linux/uio.h
+++ b/libc/kernel/uapi/linux/uio.h
@@ -21,7 +21,7 @@
#include <linux/compiler.h>
#include <linux/types.h>
struct iovec {
- void __user * iov_base;
+ void * iov_base;
__kernel_size_t iov_len;
};
#define UIO_FASTIOV 8
diff --git a/libc/kernel/uapi/linux/usb/audio.h b/libc/kernel/uapi/linux/usb/audio.h
index 7d36157..bfda540 100644
--- a/libc/kernel/uapi/linux/usb/audio.h
+++ b/libc/kernel/uapi/linux/usb/audio.h
@@ -186,7 +186,7 @@
__u8 bUnitID;
__u8 bSourceID;
__u8 bControlSize;
- __u8 bmaControls[0];
+ __u8 bmaControls[];
} __attribute__((packed));
struct uac_processing_unit_descriptor {
__u8 bLength;
diff --git a/libc/kernel/uapi/linux/usb/cdc.h b/libc/kernel/uapi/linux/usb/cdc.h
index 59c9488..bbfc4db 100644
--- a/libc/kernel/uapi/linux/usb/cdc.h
+++ b/libc/kernel/uapi/linux/usb/cdc.h
@@ -131,7 +131,7 @@
__u8 bDescriptorType;
__u8 bDescriptorSubType;
__u8 bGuidDescriptorType;
- __u8 bDetailData[0];
+ __u8 bDetailData[];
} __attribute__((packed));
struct usb_cdc_obex_desc {
__u8 bLength;
@@ -201,6 +201,8 @@
#define USB_CDC_SPACE_PARITY 4
__u8 bDataBits;
} __attribute__((packed));
+#define USB_CDC_CTRL_DTR (1 << 0)
+#define USB_CDC_CTRL_RTS (1 << 1)
#define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0)
#define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1)
#define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2)
@@ -217,6 +219,13 @@
__le16 wIndex;
__le16 wLength;
} __attribute__((packed));
+#define USB_CDC_SERIAL_STATE_DCD (1 << 0)
+#define USB_CDC_SERIAL_STATE_DSR (1 << 1)
+#define USB_CDC_SERIAL_STATE_BREAK (1 << 2)
+#define USB_CDC_SERIAL_STATE_RING_SIGNAL (1 << 3)
+#define USB_CDC_SERIAL_STATE_FRAMING (1 << 4)
+#define USB_CDC_SERIAL_STATE_PARITY (1 << 5)
+#define USB_CDC_SERIAL_STATE_OVERRUN (1 << 6)
struct usb_cdc_speed_change {
__le32 DLBitRRate;
__le32 ULBitRate;
@@ -267,7 +276,7 @@
__le32 dwSignature;
__le16 wLength;
__le16 wNextNdpIndex;
- struct usb_cdc_ncm_dpe16 dpe16[0];
+ struct usb_cdc_ncm_dpe16 dpe16[];
} __attribute__((packed));
struct usb_cdc_ncm_dpe32 {
__le32 dwDatagramIndex;
@@ -279,7 +288,7 @@
__le16 wReserved6;
__le32 dwNextNdpIndex;
__le32 dwReserved12;
- struct usb_cdc_ncm_dpe32 dpe32[0];
+ struct usb_cdc_ncm_dpe32 dpe32[];
} __attribute__((packed));
#define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C
#define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010
diff --git a/libc/kernel/uapi/linux/usb/ch9.h b/libc/kernel/uapi/linux/usb/ch9.h
index f1dade9..49eb5fa 100644
--- a/libc/kernel/uapi/linux/usb/ch9.h
+++ b/libc/kernel/uapi/linux/usb/ch9.h
@@ -324,7 +324,7 @@
__u8 bDescriptorType;
__u8 tTKID[3];
__u8 bReserved;
- __u8 bKeyData[0];
+ __u8 bKeyData[];
} __attribute__((packed));
struct usb_encryption_descriptor {
__u8 bLength;
diff --git a/libc/kernel/uapi/linux/usb/g_uvc.h b/libc/kernel/uapi/linux/usb/g_uvc.h
index 0aeba3d..40fad1d 100644
--- a/libc/kernel/uapi/linux/usb/g_uvc.h
+++ b/libc/kernel/uapi/linux/usb/g_uvc.h
@@ -29,6 +29,8 @@
#define UVC_EVENT_SETUP (V4L2_EVENT_PRIVATE_START + 4)
#define UVC_EVENT_DATA (V4L2_EVENT_PRIVATE_START + 5)
#define UVC_EVENT_LAST (V4L2_EVENT_PRIVATE_START + 5)
+#define UVC_STRING_CONTROL_IDX 0
+#define UVC_STRING_STREAMING_IDX 1
struct uvc_request_data {
__s32 length;
__u8 data[60];
diff --git a/libc/kernel/uapi/linux/usb/raw_gadget.h b/libc/kernel/uapi/linux/usb/raw_gadget.h
index 70d5a26..8b60c8d 100644
--- a/libc/kernel/uapi/linux/usb/raw_gadget.h
+++ b/libc/kernel/uapi/linux/usb/raw_gadget.h
@@ -35,7 +35,7 @@
struct usb_raw_event {
__u32 type;
__u32 length;
- __u8 data[0];
+ __u8 data[];
};
#define USB_RAW_IO_FLAGS_ZERO 0x0001
#define USB_RAW_IO_FLAGS_MASK 0x0001
@@ -43,7 +43,7 @@
__u16 ep;
__u16 flags;
__u32 length;
- __u8 data[0];
+ __u8 data[];
};
#define USB_RAW_EPS_NUM_MAX 30
#define USB_RAW_EP_NAME_MAX 16
diff --git a/libc/kernel/uapi/linux/usb/tmc.h b/libc/kernel/uapi/linux/usb/tmc.h
index 6d0add1..b267290 100644
--- a/libc/kernel/uapi/linux/usb/tmc.h
+++ b/libc/kernel/uapi/linux/usb/tmc.h
@@ -46,7 +46,7 @@
} __attribute__((packed));
struct usbtmc_ctrlrequest {
struct usbtmc_request req;
- void __user * data;
+ void * data;
} __attribute__((packed));
struct usbtmc_termchar {
__u8 term_char;
@@ -59,7 +59,7 @@
__u32 transfer_size;
__u32 transferred;
__u32 flags;
- void __user * message;
+ void * message;
} __attribute__((packed));
#define USBTMC_IOC_NR 91
#define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1)
diff --git a/libc/kernel/uapi/linux/usb/video.h b/libc/kernel/uapi/linux/usb/video.h
index b45bada..c3d360a 100644
--- a/libc/kernel/uapi/linux/usb/video.h
+++ b/libc/kernel/uapi/linux/usb/video.h
@@ -316,7 +316,7 @@
__u8 bDefaultFrameIndex;
__u8 bAspectRatioX;
__u8 bAspectRatioY;
- __u8 bmInterfaceFlags;
+ __u8 bmInterlaceFlags;
__u8 bCopyProtect;
} __attribute__((__packed__));
#define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27
@@ -349,7 +349,7 @@
__u8 bDefaultFrameIndex;
__u8 bAspectRatioX;
__u8 bAspectRatioY;
- __u8 bmInterfaceFlags;
+ __u8 bmInterlaceFlags;
__u8 bCopyProtect;
} __attribute__((__packed__));
#define UVC_DT_FORMAT_MJPEG_SIZE 11
diff --git a/libc/kernel/uapi/linux/usbdevice_fs.h b/libc/kernel/uapi/linux/usbdevice_fs.h
index 7936ad9..af8681b 100644
--- a/libc/kernel/uapi/linux/usbdevice_fs.h
+++ b/libc/kernel/uapi/linux/usbdevice_fs.h
@@ -27,13 +27,13 @@
__u16 wIndex;
__u16 wLength;
__u32 timeout;
- void __user * data;
+ void * data;
};
struct usbdevfs_bulktransfer {
unsigned int ep;
unsigned int len;
unsigned int timeout;
- void __user * data;
+ void * data;
};
struct usbdevfs_setinterface {
unsigned int interface;
@@ -41,7 +41,7 @@
};
struct usbdevfs_disconnectsignal {
unsigned int signr;
- void __user * context;
+ void * context;
};
#define USBDEVFS_MAXDRIVERNAME 255
struct usbdevfs_getdriver {
@@ -80,7 +80,7 @@
unsigned char endpoint;
int status;
unsigned int flags;
- void __user * buffer;
+ void * buffer;
int buffer_length;
int actual_length;
int start_frame;
@@ -90,13 +90,13 @@
};
int error_count;
unsigned int signr;
- void __user * usercontext;
- struct usbdevfs_iso_packet_desc iso_frame_desc[0];
+ void * usercontext;
+ struct usbdevfs_iso_packet_desc iso_frame_desc[];
};
struct usbdevfs_ioctl {
int ifno;
int ioctl_code;
- void __user * data;
+ void * data;
};
struct usbdevfs_hub_portinfo {
char nports;
@@ -121,7 +121,7 @@
struct usbdevfs_streams {
unsigned int num_streams;
unsigned int num_eps;
- unsigned char eps[0];
+ unsigned char eps[];
};
#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
#define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
diff --git a/libc/kernel/uapi/linux/usbip.h b/libc/kernel/uapi/linux/usbip.h
index ae18347..b0c1067 100644
--- a/libc/kernel/uapi/linux/usbip.h
+++ b/libc/kernel/uapi/linux/usbip.h
@@ -27,4 +27,21 @@
VDEV_ST_USED,
VDEV_ST_ERROR
};
+#define USBIP_URB_SHORT_NOT_OK 0x0001
+#define USBIP_URB_ISO_ASAP 0x0002
+#define USBIP_URB_NO_TRANSFER_DMA_MAP 0x0004
+#define USBIP_URB_ZERO_PACKET 0x0040
+#define USBIP_URB_NO_INTERRUPT 0x0080
+#define USBIP_URB_FREE_BUFFER 0x0100
+#define USBIP_URB_DIR_IN 0x0200
+#define USBIP_URB_DIR_OUT 0
+#define USBIP_URB_DIR_MASK USBIP_URB_DIR_IN
+#define USBIP_URB_DMA_MAP_SINGLE 0x00010000
+#define USBIP_URB_DMA_MAP_PAGE 0x00020000
+#define USBIP_URB_DMA_MAP_SG 0x00040000
+#define USBIP_URB_MAP_LOCAL 0x00080000
+#define USBIP_URB_SETUP_MAP_SINGLE 0x00100000
+#define USBIP_URB_SETUP_MAP_LOCAL 0x00200000
+#define USBIP_URB_DMA_SG_COMBINED 0x00400000
+#define USBIP_URB_ALIGNED_TEMP_BUFFER 0x00800000
#endif
diff --git a/libc/kernel/uapi/linux/userfaultfd.h b/libc/kernel/uapi/linux/userfaultfd.h
index ca7b7a5..09e0d80 100644
--- a/libc/kernel/uapi/linux/userfaultfd.h
+++ b/libc/kernel/uapi/linux/userfaultfd.h
@@ -19,12 +19,14 @@
#ifndef _LINUX_USERFAULTFD_H
#define _LINUX_USERFAULTFD_H
#include <linux/types.h>
+#define USERFAULTFD_IOC 0xAA
+#define USERFAULTFD_IOC_NEW _IO(USERFAULTFD_IOC, 0x00)
#define UFFD_API ((__u64) 0xAA)
#define UFFD_API_REGISTER_MODES (UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP | UFFDIO_REGISTER_MODE_MINOR)
-#define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID | UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM)
+#define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID | UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM | UFFD_FEATURE_EXACT_ADDRESS | UFFD_FEATURE_WP_HUGETLBFS_SHMEM)
#define UFFD_API_IOCTLS ((__u64) 1 << _UFFDIO_REGISTER | (__u64) 1 << _UFFDIO_UNREGISTER | (__u64) 1 << _UFFDIO_API)
#define UFFD_API_RANGE_IOCTLS ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_ZEROPAGE | (__u64) 1 << _UFFDIO_WRITEPROTECT | (__u64) 1 << _UFFDIO_CONTINUE)
-#define UFFD_API_RANGE_IOCTLS_BASIC ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_CONTINUE)
+#define UFFD_API_RANGE_IOCTLS_BASIC ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_CONTINUE | (__u64) 1 << _UFFDIO_WRITEPROTECT)
#define _UFFDIO_REGISTER (0x00)
#define _UFFDIO_UNREGISTER (0x01)
#define _UFFDIO_WAKE (0x02)
@@ -73,7 +75,7 @@
__u64 reserved3;
} reserved;
} arg;
-} __packed;
+} __attribute__((__packed__));
#define UFFD_EVENT_PAGEFAULT 0x12
#define UFFD_EVENT_FORK 0x13
#define UFFD_EVENT_REMAP 0x14
@@ -95,6 +97,8 @@
#define UFFD_FEATURE_THREAD_ID (1 << 8)
#define UFFD_FEATURE_MINOR_HUGETLBFS (1 << 9)
#define UFFD_FEATURE_MINOR_SHMEM (1 << 10)
+#define UFFD_FEATURE_EXACT_ADDRESS (1 << 11)
+#define UFFD_FEATURE_WP_HUGETLBFS_SHMEM (1 << 12)
__u64 features;
__u64 ioctls;
};
diff --git a/libc/kernel/uapi/linux/uvcvideo.h b/libc/kernel/uapi/linux/uvcvideo.h
index 719147a..f15ed78 100644
--- a/libc/kernel/uapi/linux/uvcvideo.h
+++ b/libc/kernel/uapi/linux/uvcvideo.h
@@ -49,7 +49,7 @@
__u8 offset;
__u32 v4l2_type;
__u32 data_type;
- struct uvc_menu_info __user * menu_info;
+ struct uvc_menu_info * menu_info;
__u32 menu_count;
__u32 reserved[4];
};
@@ -58,7 +58,7 @@
__u8 selector;
__u8 query;
__u16 size;
- __u8 __user * data;
+ __u8 * data;
};
#define UVCIOC_CTRL_MAP _IOWR('u', 0x20, struct uvc_xu_control_mapping)
#define UVCIOC_CTRL_QUERY _IOWR('u', 0x21, struct uvc_xu_control_query)
@@ -68,5 +68,5 @@
__u8 length;
__u8 flags;
__u8 buf[];
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/linux/v4l2-controls.h b/libc/kernel/uapi/linux/v4l2-controls.h
index 1a11355..a6e70c0 100644
--- a/libc/kernel/uapi/linux/v4l2-controls.h
+++ b/libc/kernel/uapi/linux/v4l2-controls.h
@@ -119,6 +119,9 @@
#define V4L2_CID_USER_CODA_BASE (V4L2_CID_USER_BASE + 0x10e0)
#define V4L2_CID_USER_CCS_BASE (V4L2_CID_USER_BASE + 0x10f0)
#define V4L2_CID_USER_ALLEGRO_BASE (V4L2_CID_USER_BASE + 0x1170)
+#define V4L2_CID_USER_ISL7998X_BASE (V4L2_CID_USER_BASE + 0x1180)
+#define V4L2_CID_USER_DW100_BASE (V4L2_CID_USER_BASE + 0x1190)
+#define V4L2_CID_USER_ASPEED_BASE (V4L2_CID_USER_BASE + 0x11a0)
#define V4L2_CID_CODEC_BASE (V4L2_CTRL_CLASS_CODEC | 0x900)
#define V4L2_CID_CODEC_CLASS (V4L2_CTRL_CLASS_CODEC | 1)
#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_CODEC_BASE + 0)
@@ -329,6 +332,11 @@
#define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (V4L2_CID_CODEC_BASE + 234)
#define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (V4L2_CID_CODEC_BASE + 235)
#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (V4L2_CID_CODEC_BASE + 236)
+#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE (V4L2_CID_CODEC_BASE + 237)
+enum v4l2_mpeg_video_intra_refresh_period_type {
+ V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM = 0,
+ V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1,
+};
#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE + 270)
enum v4l2_mpeg_video_mpeg2_level {
V4L2_MPEG_VIDEO_MPEG2_LEVEL_LOW = 0,
@@ -843,6 +851,7 @@
#define V4L2_CAMERA_ORIENTATION_BACK 1
#define V4L2_CAMERA_ORIENTATION_EXTERNAL 2
#define V4L2_CID_CAMERA_SENSOR_ROTATION (V4L2_CID_CAMERA_CLASS_BASE + 35)
+#define V4L2_CID_HDR_SENSOR_MODE (V4L2_CID_CAMERA_CLASS_BASE + 36)
#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
@@ -1153,6 +1162,8 @@
#define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC 0x01
#define V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC 0x02
#define V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD 0x04
+#define V4L2_H264_DECODE_PARAM_FLAG_PFRAME 0x08
+#define V4L2_H264_DECODE_PARAM_FLAG_BFRAME 0x10
#define V4L2_CID_STATELESS_H264_DECODE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 7)
struct v4l2_ctrl_h264_decode_params {
struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES];
@@ -1323,6 +1334,204 @@
__u8 chroma_intra_quantiser_matrix[64];
__u8 chroma_non_intra_quantiser_matrix[64];
};
+#define V4L2_CID_STATELESS_HEVC_SPS (V4L2_CID_CODEC_STATELESS_BASE + 400)
+#define V4L2_CID_STATELESS_HEVC_PPS (V4L2_CID_CODEC_STATELESS_BASE + 401)
+#define V4L2_CID_STATELESS_HEVC_SLICE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 402)
+#define V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (V4L2_CID_CODEC_STATELESS_BASE + 403)
+#define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 404)
+#define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_STATELESS_BASE + 405)
+#define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_STATELESS_BASE + 406)
+#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_STATELESS_BASE + 407)
+enum v4l2_stateless_hevc_decode_mode {
+ V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED,
+ V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED,
+};
+enum v4l2_stateless_hevc_start_code {
+ V4L2_STATELESS_HEVC_START_CODE_NONE,
+ V4L2_STATELESS_HEVC_START_CODE_ANNEX_B,
+};
+#define V4L2_HEVC_SLICE_TYPE_B 0
+#define V4L2_HEVC_SLICE_TYPE_P 1
+#define V4L2_HEVC_SLICE_TYPE_I 2
+#define V4L2_HEVC_SPS_FLAG_SEPARATE_COLOUR_PLANE (1ULL << 0)
+#define V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED (1ULL << 1)
+#define V4L2_HEVC_SPS_FLAG_AMP_ENABLED (1ULL << 2)
+#define V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET (1ULL << 3)
+#define V4L2_HEVC_SPS_FLAG_PCM_ENABLED (1ULL << 4)
+#define V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED (1ULL << 5)
+#define V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT (1ULL << 6)
+#define V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED (1ULL << 7)
+#define V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED (1ULL << 8)
+struct v4l2_ctrl_hevc_sps {
+ __u8 video_parameter_set_id;
+ __u8 seq_parameter_set_id;
+ __u16 pic_width_in_luma_samples;
+ __u16 pic_height_in_luma_samples;
+ __u8 bit_depth_luma_minus8;
+ __u8 bit_depth_chroma_minus8;
+ __u8 log2_max_pic_order_cnt_lsb_minus4;
+ __u8 sps_max_dec_pic_buffering_minus1;
+ __u8 sps_max_num_reorder_pics;
+ __u8 sps_max_latency_increase_plus1;
+ __u8 log2_min_luma_coding_block_size_minus3;
+ __u8 log2_diff_max_min_luma_coding_block_size;
+ __u8 log2_min_luma_transform_block_size_minus2;
+ __u8 log2_diff_max_min_luma_transform_block_size;
+ __u8 max_transform_hierarchy_depth_inter;
+ __u8 max_transform_hierarchy_depth_intra;
+ __u8 pcm_sample_bit_depth_luma_minus1;
+ __u8 pcm_sample_bit_depth_chroma_minus1;
+ __u8 log2_min_pcm_luma_coding_block_size_minus3;
+ __u8 log2_diff_max_min_pcm_luma_coding_block_size;
+ __u8 num_short_term_ref_pic_sets;
+ __u8 num_long_term_ref_pics_sps;
+ __u8 chroma_format_idc;
+ __u8 sps_max_sub_layers_minus1;
+ __u8 reserved[6];
+ __u64 flags;
+};
+#define V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED (1ULL << 0)
+#define V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT (1ULL << 1)
+#define V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED (1ULL << 2)
+#define V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT (1ULL << 3)
+#define V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED (1ULL << 4)
+#define V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED (1ULL << 5)
+#define V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED (1ULL << 6)
+#define V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT (1ULL << 7)
+#define V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED (1ULL << 8)
+#define V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED (1ULL << 9)
+#define V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED (1ULL << 10)
+#define V4L2_HEVC_PPS_FLAG_TILES_ENABLED (1ULL << 11)
+#define V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED (1ULL << 12)
+#define V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED (1ULL << 13)
+#define V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 14)
+#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED (1ULL << 15)
+#define V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER (1ULL << 16)
+#define V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT (1ULL << 17)
+#define V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT (1ULL << 18)
+#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT (1ULL << 19)
+#define V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING (1ULL << 20)
+struct v4l2_ctrl_hevc_pps {
+ __u8 pic_parameter_set_id;
+ __u8 num_extra_slice_header_bits;
+ __u8 num_ref_idx_l0_default_active_minus1;
+ __u8 num_ref_idx_l1_default_active_minus1;
+ __s8 init_qp_minus26;
+ __u8 diff_cu_qp_delta_depth;
+ __s8 pps_cb_qp_offset;
+ __s8 pps_cr_qp_offset;
+ __u8 num_tile_columns_minus1;
+ __u8 num_tile_rows_minus1;
+ __u8 column_width_minus1[20];
+ __u8 row_height_minus1[22];
+ __s8 pps_beta_offset_div2;
+ __s8 pps_tc_offset_div2;
+ __u8 log2_parallel_merge_level_minus2;
+ __u8 reserved;
+ __u64 flags;
+};
+#define V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE 0x01
+#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME 0
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_FIELD 1
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_FIELD 2
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM 3
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP 4
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM_TOP 5
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM 6
+#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING 7
+#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING 8
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM 9
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP 10
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM 11
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP 12
+#define V4L2_HEVC_DPB_ENTRIES_NUM_MAX 16
+struct v4l2_hevc_dpb_entry {
+ __u64 timestamp;
+ __u8 flags;
+ __u8 field_pic;
+ __u16 reserved;
+ __s32 pic_order_cnt_val;
+};
+struct v4l2_hevc_pred_weight_table {
+ __s8 delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __s8 luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __s8 delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2];
+ __s8 chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2];
+ __s8 delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __s8 luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __s8 delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2];
+ __s8 chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2];
+ __u8 luma_log2_weight_denom;
+ __s8 delta_chroma_log2_weight_denom;
+};
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_LUMA (1ULL << 0)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_CHROMA (1ULL << 1)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_TEMPORAL_MVP_ENABLED (1ULL << 2)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_MVD_L1_ZERO (1ULL << 3)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_CABAC_INIT (1ULL << 4)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_COLLOCATED_FROM_L0 (1ULL << 5)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_USE_INTEGER_MV (1ULL << 6)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED (1ULL << 7)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9)
+struct v4l2_ctrl_hevc_slice_params {
+ __u32 bit_size;
+ __u32 data_byte_offset;
+ __u32 num_entry_point_offsets;
+ __u8 nal_unit_type;
+ __u8 nuh_temporal_id_plus1;
+ __u8 slice_type;
+ __u8 colour_plane_id;
+ __s32 slice_pic_order_cnt;
+ __u8 num_ref_idx_l0_active_minus1;
+ __u8 num_ref_idx_l1_active_minus1;
+ __u8 collocated_ref_idx;
+ __u8 five_minus_max_num_merge_cand;
+ __s8 slice_qp_delta;
+ __s8 slice_cb_qp_offset;
+ __s8 slice_cr_qp_offset;
+ __s8 slice_act_y_qp_offset;
+ __s8 slice_act_cb_qp_offset;
+ __s8 slice_act_cr_qp_offset;
+ __s8 slice_beta_offset_div2;
+ __s8 slice_tc_offset_div2;
+ __u8 pic_struct;
+ __u8 reserved0[3];
+ __u32 slice_segment_addr;
+ __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __u16 short_term_ref_pic_set_size;
+ __u16 long_term_ref_pic_set_size;
+ struct v4l2_hevc_pred_weight_table pred_weight_table;
+ __u8 reserved1[2];
+ __u64 flags;
+};
+#define V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC 0x1
+#define V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC 0x2
+#define V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR 0x4
+struct v4l2_ctrl_hevc_decode_params {
+ __s32 pic_order_cnt_val;
+ __u16 short_term_ref_pic_set_size;
+ __u16 long_term_ref_pic_set_size;
+ __u8 num_active_dpb_entries;
+ __u8 num_poc_st_curr_before;
+ __u8 num_poc_st_curr_after;
+ __u8 num_poc_lt_curr;
+ __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __u8 reserved[4];
+ struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
+ __u64 flags;
+};
+struct v4l2_ctrl_hevc_scaling_matrix {
+ __u8 scaling_list_4x4[6][16];
+ __u8 scaling_list_8x8[6][64];
+ __u8 scaling_list_16x16[6][64];
+ __u8 scaling_list_32x32[2][64];
+ __u8 scaling_list_dc_coef_16x16[6];
+ __u8 scaling_list_dc_coef_32x32[2];
+};
#define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY | 0x900)
#define V4L2_CID_COLORIMETRY_CLASS (V4L2_CTRL_CLASS_COLORIMETRY | 1)
#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO (V4L2_CID_COLORIMETRY_CLASS_BASE + 0)
diff --git a/libc/kernel/uapi/linux/vbox_vmmdev_types.h b/libc/kernel/uapi/linux/vbox_vmmdev_types.h
index 009f9a6..777a2bb 100644
--- a/libc/kernel/uapi/linux/vbox_vmmdev_types.h
+++ b/libc/kernel/uapi/linux/vbox_vmmdev_types.h
@@ -157,7 +157,7 @@
__u32 offset;
} page_list;
} u;
-} __packed;
+} __attribute__((__packed__));
struct vmmdev_hgcm_function_parameter64 {
enum vmmdev_hgcm_function_parameter_type type;
union {
@@ -169,13 +169,13 @@
__u64 phys_addr;
__u64 linear_addr;
} u;
- } __packed pointer;
+ } __attribute__((__packed__)) pointer;
struct {
__u32 size;
__u32 offset;
} page_list;
- } __packed u;
-} __packed;
+ } __attribute__((__packed__)) u;
+} __attribute__((__packed__));
#if __BITS_PER_LONG == 64
#define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter64
#else
diff --git a/libc/kernel/uapi/linux/vdpa.h b/libc/kernel/uapi/linux/vdpa.h
index b3e5d39..989a61b 100644
--- a/libc/kernel/uapi/linux/vdpa.h
+++ b/libc/kernel/uapi/linux/vdpa.h
@@ -28,6 +28,7 @@
VDPA_CMD_DEV_DEL,
VDPA_CMD_DEV_GET,
VDPA_CMD_DEV_CONFIG_GET,
+ VDPA_CMD_DEV_VSTATS_GET,
};
enum vdpa_attr {
VDPA_ATTR_UNSPEC,
@@ -48,6 +49,10 @@
VDPA_ATTR_DEV_NEGOTIATED_FEATURES,
VDPA_ATTR_DEV_MGMTDEV_MAX_VQS,
VDPA_ATTR_DEV_SUPPORTED_FEATURES,
+ VDPA_ATTR_DEV_QUEUE_INDEX,
+ VDPA_ATTR_DEV_VENDOR_ATTR_NAME,
+ VDPA_ATTR_DEV_VENDOR_ATTR_VALUE,
+ VDPA_ATTR_DEV_FEATURES,
VDPA_ATTR_MAX,
};
#endif
diff --git a/libc/kernel/uapi/linux/vduse.h b/libc/kernel/uapi/linux/vduse.h
index 2dc8c82..f0b6d6b 100644
--- a/libc/kernel/uapi/linux/vduse.h
+++ b/libc/kernel/uapi/linux/vduse.h
@@ -90,6 +90,22 @@
};
#define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x16, struct vduse_vq_eventfd)
#define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
+struct vduse_iova_umem {
+ __u64 uaddr;
+ __u64 iova;
+ __u64 size;
+ __u64 reserved[3];
+};
+#define VDUSE_IOTLB_REG_UMEM _IOW(VDUSE_BASE, 0x18, struct vduse_iova_umem)
+#define VDUSE_IOTLB_DEREG_UMEM _IOW(VDUSE_BASE, 0x19, struct vduse_iova_umem)
+struct vduse_iova_info {
+ __u64 start;
+ __u64 last;
+#define VDUSE_IOVA_CAP_UMEM (1 << 0)
+ __u64 capability;
+ __u64 reserved[3];
+};
+#define VDUSE_IOTLB_GET_INFO _IOWR(VDUSE_BASE, 0x1a, struct vduse_iova_info)
enum vduse_req_type {
VDUSE_GET_VQ_STATE,
VDUSE_SET_STATUS,
diff --git a/libc/kernel/uapi/linux/version.h b/libc/kernel/uapi/linux/version.h
index 2dfd696..0d50613 100644
--- a/libc/kernel/uapi/linux/version.h
+++ b/libc/kernel/uapi/linux/version.h
@@ -16,8 +16,8 @@
***
****************************************************************************
****************************************************************************/
-#define LINUX_VERSION_CODE 332032
+#define LINUX_VERSION_CODE 393728
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
-#define LINUX_VERSION_MAJOR 5
-#define LINUX_VERSION_PATCHLEVEL 17
+#define LINUX_VERSION_MAJOR 6
+#define LINUX_VERSION_PATCHLEVEL 2
#define LINUX_VERSION_SUBLEVEL 0
diff --git a/libc/kernel/uapi/linux/vfio.h b/libc/kernel/uapi/linux/vfio.h
index e0f322b..3c1821c 100644
--- a/libc/kernel/uapi/linux/vfio.h
+++ b/libc/kernel/uapi/linux/vfio.h
@@ -110,7 +110,7 @@
#define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff)
#define VFIO_REGION_TYPE_GFX (1)
#define VFIO_REGION_TYPE_CCW (2)
-#define VFIO_REGION_TYPE_MIGRATION (3)
+#define VFIO_REGION_TYPE_MIGRATION_DEPRECATED (3)
#define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1)
#define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2)
#define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3)
@@ -130,17 +130,17 @@
#define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1)
#define VFIO_REGION_SUBTYPE_CCW_SCHIB (2)
#define VFIO_REGION_SUBTYPE_CCW_CRW (3)
-#define VFIO_REGION_SUBTYPE_MIGRATION (1)
+#define VFIO_REGION_SUBTYPE_MIGRATION_DEPRECATED (1)
struct vfio_device_migration_info {
__u32 device_state;
-#define VFIO_DEVICE_STATE_STOP (0)
-#define VFIO_DEVICE_STATE_RUNNING (1 << 0)
-#define VFIO_DEVICE_STATE_SAVING (1 << 1)
-#define VFIO_DEVICE_STATE_RESUMING (1 << 2)
-#define VFIO_DEVICE_STATE_MASK (VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING)
-#define VFIO_DEVICE_STATE_VALID(state) (state & VFIO_DEVICE_STATE_RESUMING ? (state & VFIO_DEVICE_STATE_MASK) == VFIO_DEVICE_STATE_RESUMING : 1)
-#define VFIO_DEVICE_STATE_IS_ERROR(state) ((state & VFIO_DEVICE_STATE_MASK) == (VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING))
-#define VFIO_DEVICE_STATE_SET_ERROR(state) ((state & ~VFIO_DEVICE_STATE_MASK) | VFIO_DEVICE_SATE_SAVING | VFIO_DEVICE_STATE_RESUMING)
+#define VFIO_DEVICE_STATE_V1_STOP (0)
+#define VFIO_DEVICE_STATE_V1_RUNNING (1 << 0)
+#define VFIO_DEVICE_STATE_V1_SAVING (1 << 1)
+#define VFIO_DEVICE_STATE_V1_RESUMING (1 << 2)
+#define VFIO_DEVICE_STATE_MASK (VFIO_DEVICE_STATE_V1_RUNNING | VFIO_DEVICE_STATE_V1_SAVING | VFIO_DEVICE_STATE_V1_RESUMING)
+#define VFIO_DEVICE_STATE_VALID(state) (state & VFIO_DEVICE_STATE_V1_RESUMING ? (state & VFIO_DEVICE_STATE_MASK) == VFIO_DEVICE_STATE_V1_RESUMING : 1)
+#define VFIO_DEVICE_STATE_IS_ERROR(state) ((state & VFIO_DEVICE_STATE_MASK) == (VFIO_DEVICE_STATE_V1_SAVING | VFIO_DEVICE_STATE_V1_RESUMING))
+#define VFIO_DEVICE_STATE_SET_ERROR(state) ((state & ~VFIO_DEVICE_STATE_MASK) | VFIO_DEVICE_STATE_V1_SAVING | VFIO_DEVICE_STATE_V1_RESUMING)
__u32 reserved;
__u64 pending_bytes;
__u64 data_offset;
@@ -285,6 +285,65 @@
};
#define VFIO_DEVICE_FEATURE _IO(VFIO_TYPE, VFIO_BASE + 17)
#define VFIO_DEVICE_FEATURE_PCI_VF_TOKEN (0)
+struct vfio_device_feature_migration {
+ __aligned_u64 flags;
+#define VFIO_MIGRATION_STOP_COPY (1 << 0)
+#define VFIO_MIGRATION_P2P (1 << 1)
+#define VFIO_MIGRATION_PRE_COPY (1 << 2)
+};
+#define VFIO_DEVICE_FEATURE_MIGRATION 1
+struct vfio_device_feature_mig_state {
+ __u32 device_state;
+ __s32 data_fd;
+};
+#define VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE 2
+enum vfio_device_mig_state {
+ VFIO_DEVICE_STATE_ERROR = 0,
+ VFIO_DEVICE_STATE_STOP = 1,
+ VFIO_DEVICE_STATE_RUNNING = 2,
+ VFIO_DEVICE_STATE_STOP_COPY = 3,
+ VFIO_DEVICE_STATE_RESUMING = 4,
+ VFIO_DEVICE_STATE_RUNNING_P2P = 5,
+ VFIO_DEVICE_STATE_PRE_COPY = 6,
+ VFIO_DEVICE_STATE_PRE_COPY_P2P = 7,
+};
+struct vfio_precopy_info {
+ __u32 argsz;
+ __u32 flags;
+ __aligned_u64 initial_bytes;
+ __aligned_u64 dirty_bytes;
+};
+#define VFIO_MIG_GET_PRECOPY_INFO _IO(VFIO_TYPE, VFIO_BASE + 21)
+#define VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY 3
+struct vfio_device_low_power_entry_with_wakeup {
+ __s32 wakeup_eventfd;
+ __u32 reserved;
+};
+#define VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY_WITH_WAKEUP 4
+#define VFIO_DEVICE_FEATURE_LOW_POWER_EXIT 5
+struct vfio_device_feature_dma_logging_control {
+ __aligned_u64 page_size;
+ __u32 num_ranges;
+ __u32 __reserved;
+ __aligned_u64 ranges;
+};
+struct vfio_device_feature_dma_logging_range {
+ __aligned_u64 iova;
+ __aligned_u64 length;
+};
+#define VFIO_DEVICE_FEATURE_DMA_LOGGING_START 6
+#define VFIO_DEVICE_FEATURE_DMA_LOGGING_STOP 7
+struct vfio_device_feature_dma_logging_report {
+ __aligned_u64 iova;
+ __aligned_u64 length;
+ __aligned_u64 page_size;
+ __aligned_u64 bitmap;
+};
+#define VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT 8
+struct vfio_device_feature_mig_data_size {
+ __aligned_u64 stop_copy_length;
+};
+#define VFIO_DEVICE_FEATURE_MIG_DATA_SIZE 9
struct vfio_iommu_type1_info {
__u32 argsz;
__u32 flags;
@@ -331,7 +390,7 @@
struct vfio_bitmap {
__u64 pgsize;
__u64 size;
- __u64 __user * data;
+ __u64 * data;
};
struct vfio_iommu_type1_dma_unmap {
__u32 argsz;
diff --git a/libc/kernel/uapi/linux/vfio_ccw.h b/libc/kernel/uapi/linux/vfio_ccw.h
index a6defc5..7bf08f5 100644
--- a/libc/kernel/uapi/linux/vfio_ccw.h
+++ b/libc/kernel/uapi/linux/vfio_ccw.h
@@ -27,19 +27,19 @@
#define IRB_AREA_SIZE 96
__u8 irb_area[IRB_AREA_SIZE];
__u32 ret_code;
-} __packed;
+} __attribute__((__packed__));
#define VFIO_CCW_ASYNC_CMD_HSCH (1 << 0)
#define VFIO_CCW_ASYNC_CMD_CSCH (1 << 1)
struct ccw_cmd_region {
__u32 command;
__u32 ret_code;
-} __packed;
+} __attribute__((__packed__));
struct ccw_schib_region {
#define SCHIB_AREA_SIZE 52
__u8 schib_area[SCHIB_AREA_SIZE];
-} __packed;
+} __attribute__((__packed__));
struct ccw_crw_region {
__u32 crw;
__u32 pad;
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/linux/vfio_zdev.h b/libc/kernel/uapi/linux/vfio_zdev.h
index c678e9a..1c3a943 100644
--- a/libc/kernel/uapi/linux/vfio_zdev.h
+++ b/libc/kernel/uapi/linux/vfio_zdev.h
@@ -29,6 +29,7 @@
__u16 fmb_length;
__u8 pft;
__u8 gid;
+ __u32 fh;
};
struct vfio_device_info_cap_zpci_group {
struct vfio_info_cap_header header;
@@ -40,6 +41,8 @@
__u16 noi;
__u16 maxstbl;
__u8 version;
+ __u8 reserved;
+ __u16 imaxstbl;
};
struct vfio_device_info_cap_zpci_util {
struct vfio_info_cap_header header;
diff --git a/libc/kernel/uapi/linux/vhost.h b/libc/kernel/uapi/linux/vhost.h
index 53b01c4..e5b1327 100644
--- a/libc/kernel/uapi/linux/vhost.h
+++ b/libc/kernel/uapi/linux/vhost.h
@@ -43,8 +43,6 @@
#define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file)
#define VHOST_SET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x23, struct vhost_vring_state)
#define VHOST_GET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x24, struct vhost_vring_state)
-#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
-#define VHOST_BACKEND_F_IOTLB_BATCH 0x2
#define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
#define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
@@ -64,4 +62,11 @@
#define VHOST_VDPA_GET_VRING_NUM _IOR(VHOST_VIRTIO, 0x76, __u16)
#define VHOST_VDPA_SET_CONFIG_CALL _IOW(VHOST_VIRTIO, 0x77, int)
#define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, struct vhost_vdpa_iova_range)
+#define VHOST_VDPA_GET_CONFIG_SIZE _IOR(VHOST_VIRTIO, 0x79, __u32)
+#define VHOST_VDPA_GET_VQS_COUNT _IOR(VHOST_VIRTIO, 0x80, __u32)
+#define VHOST_VDPA_GET_GROUP_NUM _IOR(VHOST_VIRTIO, 0x81, __u32)
+#define VHOST_VDPA_GET_AS_NUM _IOR(VHOST_VIRTIO, 0x7A, unsigned int)
+#define VHOST_VDPA_GET_VRING_GROUP _IOWR(VHOST_VIRTIO, 0x7B, struct vhost_vring_state)
+#define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7C, struct vhost_vring_state)
+#define VHOST_VDPA_SUSPEND _IO(VHOST_VIRTIO, 0x7D)
#endif
diff --git a/libc/kernel/uapi/linux/vhost_types.h b/libc/kernel/uapi/linux/vhost_types.h
index 6b4cc77..32efa85 100644
--- a/libc/kernel/uapi/linux/vhost_types.h
+++ b/libc/kernel/uapi/linux/vhost_types.h
@@ -66,7 +66,7 @@
};
struct vhost_msg_v2 {
__u32 type;
- __u32 reserved;
+ __u32 asid;
union {
struct vhost_iotlb_msg iotlb;
__u8 padding[64];
@@ -82,7 +82,7 @@
struct vhost_memory {
__u32 nregions;
__u32 padding;
- struct vhost_memory_region regions[0];
+ struct vhost_memory_region regions[];
};
#define VHOST_SCSI_ABI_VERSION 1
struct vhost_scsi_target {
@@ -94,7 +94,7 @@
struct vhost_vdpa_config {
__u32 off;
__u32 len;
- __u8 buf[0];
+ __u8 buf[];
};
struct vhost_vdpa_iova_range {
__u64 first;
@@ -102,4 +102,8 @@
};
#define VHOST_F_LOG_ALL 26
#define VHOST_NET_F_VIRTIO_NET_HDR 27
+#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
+#define VHOST_BACKEND_F_IOTLB_BATCH 0x2
+#define VHOST_BACKEND_F_IOTLB_ASID 0x3
+#define VHOST_BACKEND_F_SUSPEND 0x4
#endif
diff --git a/libc/kernel/uapi/linux/videodev2.h b/libc/kernel/uapi/linux/videodev2.h
index 74bd328..4fb0a25 100644
--- a/libc/kernel/uapi/linux/videodev2.h
+++ b/libc/kernel/uapi/linux/videodev2.h
@@ -24,12 +24,7 @@
#include <linux/types.h>
#include <linux/v4l2-common.h>
#include <linux/v4l2-controls.h>
-/* ---------------------------------------------------
- * This value manually changed due to b/228783882.
- * Next kernel update should keep this value as is.
- */
#define VIDEO_MAX_FRAME 64
-/* --------------------------------------------------- */
#define VIDEO_MAX_PLANES 8
#define v4l2_fourcc(a,b,c,d) ((__u32) (a) | ((__u32) (b) << 8) | ((__u32) (c) << 16) | ((__u32) (d) << 24))
#define v4l2_fourcc_be(a,b,c,d) (v4l2_fourcc(a, b, c, d) | (1U << 31))
@@ -190,7 +185,6 @@
#define V4L2_CAP_SDR_OUTPUT 0x00400000
#define V4L2_CAP_META_CAPTURE 0x00800000
#define V4L2_CAP_READWRITE 0x01000000
-#define V4L2_CAP_ASYNCIO 0x02000000
#define V4L2_CAP_STREAMING 0x04000000
#define V4L2_CAP_META_OUTPUT 0x08000000
#define V4L2_CAP_TOUCH 0x10000000
@@ -260,6 +254,7 @@
#define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ')
#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B')
#define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P')
+#define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y')
#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8')
#define V4L2_PIX_FMT_UV8 v4l2_fourcc('U', 'V', '8', ' ')
#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V')
@@ -277,6 +272,8 @@
#define V4L2_PIX_FMT_XYUV32 v4l2_fourcc('X', 'Y', 'U', 'V')
#define V4L2_PIX_FMT_VUYA32 v4l2_fourcc('V', 'U', 'Y', 'A')
#define V4L2_PIX_FMT_VUYX32 v4l2_fourcc('V', 'U', 'Y', 'X')
+#define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A')
+#define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X')
#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')
#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2')
#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1')
@@ -284,6 +281,7 @@
#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1')
#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4')
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2')
+#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0')
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2')
#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1')
#define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6')
@@ -303,8 +301,13 @@
#define V4L2_PIX_FMT_NV12_4L4 v4l2_fourcc('V', 'T', '1', '2')
#define V4L2_PIX_FMT_NV12_16L16 v4l2_fourcc('H', 'M', '1', '2')
#define V4L2_PIX_FMT_NV12_32L32 v4l2_fourcc('S', 'T', '1', '2')
+#define V4L2_PIX_FMT_P010_4L4 v4l2_fourcc('T', '0', '1', '0')
+#define V4L2_PIX_FMT_NV12_8L128 v4l2_fourcc('A', 'T', '1', '2')
+#define V4L2_PIX_FMT_NV12_10BE_8L128 v4l2_fourcc_be('A', 'X', '1', '2')
#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2')
#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2')
+#define V4L2_PIX_FMT_NV12M_8L128 v4l2_fourcc('N', 'A', '1', '2')
+#define V4L2_PIX_FMT_NV12M_10BE_8L128 v4l2_fourcc_be('N', 'T', '1', '2')
#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1')
#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G')
#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G')
@@ -370,6 +373,7 @@
#define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T')
#define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H')
#define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4')
+#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5')
#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A')
#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A')
#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0')
@@ -404,6 +408,9 @@
#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I')
#define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4')
#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4')
+#define V4L2_PIX_FMT_QC08C v4l2_fourcc('Q', '0', '8', 'C')
+#define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C')
+#define V4L2_PIX_FMT_AJPG v4l2_fourcc('A', 'J', 'P', 'G')
#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b')
#define V4L2_PIX_FMT_IPU3_SGBRG10 v4l2_fourcc('i', 'p', '3', 'g')
#define V4L2_PIX_FMT_IPU3_SGRBG10 v4l2_fourcc('i', 'p', '3', 'G')
@@ -643,7 +650,7 @@
#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040
struct v4l2_clip {
struct v4l2_rect c;
- struct v4l2_clip __user * next;
+ struct v4l2_clip * next;
};
struct v4l2_window {
struct v4l2_rect w;
@@ -651,7 +658,7 @@
__u32 chromakey;
struct v4l2_clip * clips;
__u32 clipcount;
- void __user * bitmap;
+ void * bitmap;
__u8 global_alpha;
};
struct v4l2_captureparm {
@@ -787,7 +794,7 @@
#define V4L2_DV_FL_CAN_DETECT_REDUCED_FPS (1 << 9)
#define V4L2_DV_BT_BLANKING_WIDTH(bt) ((bt)->hfrontporch + (bt)->hsync + (bt)->hbackporch)
#define V4L2_DV_BT_FRAME_WIDTH(bt) ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt))
-#define V4L2_DV_BT_BLANKING_HEIGHT(bt) ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch)
+#define V4L2_DV_BT_BLANKING_HEIGHT(bt) ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + ((bt)->interlaced ? ((bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) : 0))
#define V4L2_DV_BT_FRAME_HEIGHT(bt) ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
struct v4l2_dv_timings {
__u32 type;
@@ -888,25 +895,32 @@
union {
__s32 value;
__s64 value64;
- char __user * string;
- __u8 __user * p_u8;
- __u16 __user * p_u16;
- __u32 __user * p_u32;
- struct v4l2_area __user * p_area;
- struct v4l2_ctrl_h264_sps __user * p_h264_sps;
+ char * string;
+ __u8 * p_u8;
+ __u16 * p_u16;
+ __u32 * p_u32;
+ __u32 * p_s32;
+ __u32 * p_s64;
+ struct v4l2_area * p_area;
+ struct v4l2_ctrl_h264_sps * p_h264_sps;
struct v4l2_ctrl_h264_pps * p_h264_pps;
- struct v4l2_ctrl_h264_scaling_matrix __user * p_h264_scaling_matrix;
- struct v4l2_ctrl_h264_pred_weights __user * p_h264_pred_weights;
- struct v4l2_ctrl_h264_slice_params __user * p_h264_slice_params;
- struct v4l2_ctrl_h264_decode_params __user * p_h264_decode_params;
- struct v4l2_ctrl_fwht_params __user * p_fwht_params;
- struct v4l2_ctrl_vp8_frame __user * p_vp8_frame;
- struct v4l2_ctrl_mpeg2_sequence __user * p_mpeg2_sequence;
- struct v4l2_ctrl_mpeg2_picture __user * p_mpeg2_picture;
- struct v4l2_ctrl_mpeg2_quantisation __user * p_mpeg2_quantisation;
- struct v4l2_ctrl_vp9_compressed_hdr __user * p_vp9_compressed_hdr_probs;
- struct v4l2_ctrl_vp9_frame __user * p_vp9_frame;
- void __user * ptr;
+ struct v4l2_ctrl_h264_scaling_matrix * p_h264_scaling_matrix;
+ struct v4l2_ctrl_h264_pred_weights * p_h264_pred_weights;
+ struct v4l2_ctrl_h264_slice_params * p_h264_slice_params;
+ struct v4l2_ctrl_h264_decode_params * p_h264_decode_params;
+ struct v4l2_ctrl_fwht_params * p_fwht_params;
+ struct v4l2_ctrl_vp8_frame * p_vp8_frame;
+ struct v4l2_ctrl_mpeg2_sequence * p_mpeg2_sequence;
+ struct v4l2_ctrl_mpeg2_picture * p_mpeg2_picture;
+ struct v4l2_ctrl_mpeg2_quantisation * p_mpeg2_quantisation;
+ struct v4l2_ctrl_vp9_compressed_hdr * p_vp9_compressed_hdr_probs;
+ struct v4l2_ctrl_vp9_frame * p_vp9_frame;
+ struct v4l2_ctrl_hevc_sps * p_hevc_sps;
+ struct v4l2_ctrl_hevc_pps * p_hevc_pps;
+ struct v4l2_ctrl_hevc_slice_params * p_hevc_slice_params;
+ struct v4l2_ctrl_hevc_scaling_matrix * p_hevc_scaling_matrix;
+ struct v4l2_ctrl_hevc_decode_params * p_hevc_decode_params;
+ void * ptr;
};
} __attribute__((packed));
struct v4l2_ext_controls {
@@ -958,6 +972,11 @@
V4L2_CTRL_TYPE_MPEG2_PICTURE = 0x0252,
V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR = 0x0260,
V4L2_CTRL_TYPE_VP9_FRAME = 0x0261,
+ V4L2_CTRL_TYPE_HEVC_SPS = 0x0270,
+ V4L2_CTRL_TYPE_HEVC_PPS = 0x0271,
+ V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS = 0x0272,
+ V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX = 0x0273,
+ V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS = 0x0274,
};
struct v4l2_queryctrl {
__u32 id;
@@ -1005,6 +1024,7 @@
#define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100
#define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200
#define V4L2_CTRL_FLAG_MODIFY_LAYOUT 0x0400
+#define V4L2_CTRL_FLAG_DYNAMIC_ARRAY 0x0800
#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
#define V4L2_CTRL_FLAG_NEXT_COMPOUND 0x40000000
#define V4L2_CID_MAX_CTRLS 1024
@@ -1308,6 +1328,7 @@
#define V4L2_EVENT_CTRL_CH_VALUE (1 << 0)
#define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1)
#define V4L2_EVENT_CTRL_CH_RANGE (1 << 2)
+#define V4L2_EVENT_CTRL_CH_DIMENSIONS (1 << 3)
struct v4l2_event_ctrl {
__u32 changes;
__u32 type;
@@ -1479,4 +1500,5 @@
#define BASE_VIDIOC_PRIVATE 192
#define V4L2_PIX_FMT_HM12 V4L2_PIX_FMT_NV12_16L16
#define V4L2_PIX_FMT_SUNXI_TILED_NV12 V4L2_PIX_FMT_NV12_32L32
+#define V4L2_CAP_ASYNCIO 0x02000000
#endif
diff --git a/libc/kernel/uapi/linux/virtio_9p.h b/libc/kernel/uapi/linux/virtio_9p.h
index 1d9dfb1..2e05786 100644
--- a/libc/kernel/uapi/linux/virtio_9p.h
+++ b/libc/kernel/uapi/linux/virtio_9p.h
@@ -24,6 +24,6 @@
#define VIRTIO_9P_MOUNT_TAG 0
struct virtio_9p_config {
__virtio16 tag_len;
- __u8 tag[0];
+ __u8 tag[];
} __attribute__((packed));
#endif
diff --git a/libc/kernel/uapi/linux/virtio_blk.h b/libc/kernel/uapi/linux/virtio_blk.h
index f2f0381..0dd08c5 100644
--- a/libc/kernel/uapi/linux/virtio_blk.h
+++ b/libc/kernel/uapi/linux/virtio_blk.h
@@ -31,6 +31,7 @@
#define VIRTIO_BLK_F_MQ 12
#define VIRTIO_BLK_F_DISCARD 13
#define VIRTIO_BLK_F_WRITE_ZEROES 14
+#define VIRTIO_BLK_F_SECURE_ERASE 16
#ifndef VIRTIO_BLK_NO_LEGACY
#define VIRTIO_BLK_F_BARRIER 0
#define VIRTIO_BLK_F_SCSI 7
@@ -63,6 +64,9 @@
__virtio32 max_write_zeroes_seg;
__u8 write_zeroes_may_unmap;
__u8 unused1[3];
+ __virtio32 max_secure_erase_sectors;
+ __virtio32 max_secure_erase_seg;
+ __virtio32 secure_erase_sector_alignment;
} __attribute__((packed));
#define VIRTIO_BLK_T_IN 0
#define VIRTIO_BLK_T_OUT 1
@@ -73,6 +77,7 @@
#define VIRTIO_BLK_T_GET_ID 8
#define VIRTIO_BLK_T_DISCARD 11
#define VIRTIO_BLK_T_WRITE_ZEROES 13
+#define VIRTIO_BLK_T_SECURE_ERASE 14
#ifndef VIRTIO_BLK_NO_LEGACY
#define VIRTIO_BLK_T_BARRIER 0x80000000
#endif
diff --git a/libc/kernel/uapi/linux/virtio_bt.h b/libc/kernel/uapi/linux/virtio_bt.h
index 7e29eaa..9049adc 100644
--- a/libc/kernel/uapi/linux/virtio_bt.h
+++ b/libc/kernel/uapi/linux/virtio_bt.h
@@ -22,6 +22,7 @@
#define VIRTIO_BT_F_VND_HCI 0
#define VIRTIO_BT_F_MSFT_EXT 1
#define VIRTIO_BT_F_AOSP_EXT 2
+#define VIRTIO_BT_F_CONFIG_V2 3
enum virtio_bt_config_type {
VIRTIO_BT_CONFIG_TYPE_PRIMARY = 0,
VIRTIO_BT_CONFIG_TYPE_AMP = 1,
@@ -37,4 +38,10 @@
__u16 vendor;
__u16 msft_opcode;
} __attribute__((packed));
+struct virtio_bt_config_v2 {
+ __u8 type;
+ __u8 alignment;
+ __u16 vendor;
+ __u16 msft_opcode;
+};
#endif
diff --git a/libc/kernel/uapi/linux/virtio_config.h b/libc/kernel/uapi/linux/virtio_config.h
index 6198fd1..bdd2e73 100644
--- a/libc/kernel/uapi/linux/virtio_config.h
+++ b/libc/kernel/uapi/linux/virtio_config.h
@@ -26,7 +26,7 @@
#define VIRTIO_CONFIG_S_NEEDS_RESET 0x40
#define VIRTIO_CONFIG_S_FAILED 0x80
#define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END 38
+#define VIRTIO_TRANSPORT_F_END 41
#ifndef VIRTIO_CONFIG_NO_LEGACY
#define VIRTIO_F_NOTIFY_ON_EMPTY 24
#define VIRTIO_F_ANY_LAYOUT 27
@@ -35,6 +35,8 @@
#define VIRTIO_F_ACCESS_PLATFORM 33
#define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM
#define VIRTIO_F_RING_PACKED 34
+#define VIRTIO_F_IN_ORDER 35
#define VIRTIO_F_ORDER_PLATFORM 36
#define VIRTIO_F_SR_IOV 37
+#define VIRTIO_F_RING_RESET 40
#endif
diff --git a/libc/kernel/uapi/linux/virtio_crypto.h b/libc/kernel/uapi/linux/virtio_crypto.h
index 2ce760f..7d7561d 100644
--- a/libc/kernel/uapi/linux/virtio_crypto.h
+++ b/libc/kernel/uapi/linux/virtio_crypto.h
@@ -26,6 +26,7 @@
#define VIRTIO_CRYPTO_SERVICE_HASH 1
#define VIRTIO_CRYPTO_SERVICE_MAC 2
#define VIRTIO_CRYPTO_SERVICE_AEAD 3
+#define VIRTIO_CRYPTO_SERVICE_AKCIPHER 4
#define VIRTIO_CRYPTO_OPCODE(service,op) (((service) << 8) | (op))
struct virtio_crypto_ctrl_header {
#define VIRTIO_CRYPTO_CIPHER_CREATE_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x02)
@@ -36,6 +37,8 @@
#define VIRTIO_CRYPTO_MAC_DESTROY_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x03)
#define VIRTIO_CRYPTO_AEAD_CREATE_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x02)
#define VIRTIO_CRYPTO_AEAD_DESTROY_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x03)
+#define VIRTIO_CRYPTO_AKCIPHER_CREATE_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x04)
+#define VIRTIO_CRYPTO_AKCIPHER_DESTROY_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x05)
__le32 opcode;
__le32 algo;
__le32 flag;
@@ -137,6 +140,51 @@
struct virtio_crypto_aead_session_para para;
__u8 padding[32];
};
+struct virtio_crypto_rsa_session_para {
+#define VIRTIO_CRYPTO_RSA_RAW_PADDING 0
+#define VIRTIO_CRYPTO_RSA_PKCS1_PADDING 1
+ __le32 padding_algo;
+#define VIRTIO_CRYPTO_RSA_NO_HASH 0
+#define VIRTIO_CRYPTO_RSA_MD2 1
+#define VIRTIO_CRYPTO_RSA_MD3 2
+#define VIRTIO_CRYPTO_RSA_MD4 3
+#define VIRTIO_CRYPTO_RSA_MD5 4
+#define VIRTIO_CRYPTO_RSA_SHA1 5
+#define VIRTIO_CRYPTO_RSA_SHA256 6
+#define VIRTIO_CRYPTO_RSA_SHA384 7
+#define VIRTIO_CRYPTO_RSA_SHA512 8
+#define VIRTIO_CRYPTO_RSA_SHA224 9
+ __le32 hash_algo;
+};
+struct virtio_crypto_ecdsa_session_para {
+#define VIRTIO_CRYPTO_CURVE_UNKNOWN 0
+#define VIRTIO_CRYPTO_CURVE_NIST_P192 1
+#define VIRTIO_CRYPTO_CURVE_NIST_P224 2
+#define VIRTIO_CRYPTO_CURVE_NIST_P256 3
+#define VIRTIO_CRYPTO_CURVE_NIST_P384 4
+#define VIRTIO_CRYPTO_CURVE_NIST_P521 5
+ __le32 curve_id;
+ __le32 padding;
+};
+struct virtio_crypto_akcipher_session_para {
+#define VIRTIO_CRYPTO_NO_AKCIPHER 0
+#define VIRTIO_CRYPTO_AKCIPHER_RSA 1
+#define VIRTIO_CRYPTO_AKCIPHER_DSA 2
+#define VIRTIO_CRYPTO_AKCIPHER_ECDSA 3
+ __le32 algo;
+#define VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PUBLIC 1
+#define VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PRIVATE 2
+ __le32 keytype;
+ __le32 keylen;
+ union {
+ struct virtio_crypto_rsa_session_para rsa;
+ struct virtio_crypto_ecdsa_session_para ecdsa;
+ } u;
+};
+struct virtio_crypto_akcipher_create_session_req {
+ struct virtio_crypto_akcipher_session_para para;
+ __u8 padding[36];
+};
struct virtio_crypto_alg_chain_session_para {
#define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER 1
#define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH 2
@@ -180,6 +228,7 @@
struct virtio_crypto_hash_create_session_req hash_create_session;
struct virtio_crypto_mac_create_session_req mac_create_session;
struct virtio_crypto_aead_create_session_req aead_create_session;
+ struct virtio_crypto_akcipher_create_session_req akcipher_create_session;
struct virtio_crypto_destroy_session_req destroy_session;
__u8 padding[56];
} u;
@@ -191,6 +240,10 @@
#define VIRTIO_CRYPTO_MAC VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x00)
#define VIRTIO_CRYPTO_AEAD_ENCRYPT VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x00)
#define VIRTIO_CRYPTO_AEAD_DECRYPT VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x01)
+#define VIRTIO_CRYPTO_AKCIPHER_ENCRYPT VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x00)
+#define VIRTIO_CRYPTO_AKCIPHER_DECRYPT VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x01)
+#define VIRTIO_CRYPTO_AKCIPHER_SIGN VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x02)
+#define VIRTIO_CRYPTO_AKCIPHER_VERIFY VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x03)
__le32 opcode;
__le32 algo;
__le64 session_id;
@@ -256,6 +309,14 @@
struct virtio_crypto_aead_para para;
__u8 padding[32];
};
+struct virtio_crypto_akcipher_para {
+ __le32 src_data_len;
+ __le32 dst_data_len;
+};
+struct virtio_crypto_akcipher_data_req {
+ struct virtio_crypto_akcipher_para para;
+ __u8 padding[40];
+};
struct virtio_crypto_op_data_req {
struct virtio_crypto_op_header header;
union {
@@ -263,6 +324,7 @@
struct virtio_crypto_hash_data_req hash_req;
struct virtio_crypto_mac_data_req mac_req;
struct virtio_crypto_aead_data_req aead_req;
+ struct virtio_crypto_akcipher_data_req akcipher_req;
__u8 padding[48];
} u;
};
@@ -271,6 +333,8 @@
#define VIRTIO_CRYPTO_BADMSG 2
#define VIRTIO_CRYPTO_NOTSUPP 3
#define VIRTIO_CRYPTO_INVSESS 4
+#define VIRTIO_CRYPTO_NOSPC 5
+#define VIRTIO_CRYPTO_KEY_REJECTED 6
#define VIRTIO_CRYPTO_S_HW_READY (1 << 0)
struct virtio_crypto_config {
__le32 status;
@@ -284,7 +348,7 @@
__le32 aead_algo;
__le32 max_cipher_key_len;
__le32 max_auth_key_len;
- __le32 reserve;
+ __le32 akcipher_algo;
__le64 max_size;
};
struct virtio_crypto_inhdr {
diff --git a/libc/kernel/uapi/linux/virtio_ids.h b/libc/kernel/uapi/linux/virtio_ids.h
index 2894700..b31ed93 100644
--- a/libc/kernel/uapi/linux/virtio_ids.h
+++ b/libc/kernel/uapi/linux/virtio_ids.h
@@ -57,11 +57,11 @@
#define VIRTIO_ID_AUDIO_POLICY 39
#define VIRTIO_ID_BT 40
#define VIRTIO_ID_GPIO 41
-#define VIRTIO_TRANS_ID_NET 1000
-#define VIRTIO_TRANS_ID_BLOCK 1001
-#define VIRTIO_TRANS_ID_BALLOON 1002
-#define VIRTIO_TRANS_ID_CONSOLE 1003
-#define VIRTIO_TRANS_ID_SCSI 1004
-#define VIRTIO_TRANS_ID_RNG 1005
-#define VIRTIO_TRANS_ID_9P 1009
+#define VIRTIO_TRANS_ID_NET 0x1000
+#define VIRTIO_TRANS_ID_BLOCK 0x1001
+#define VIRTIO_TRANS_ID_BALLOON 0x1002
+#define VIRTIO_TRANS_ID_CONSOLE 0x1003
+#define VIRTIO_TRANS_ID_SCSI 0x1004
+#define VIRTIO_TRANS_ID_RNG 0x1005
+#define VIRTIO_TRANS_ID_9P 0x1009
#endif
diff --git a/libc/kernel/uapi/linux/virtio_net.h b/libc/kernel/uapi/linux/virtio_net.h
index 2d92904..da7285e 100644
--- a/libc/kernel/uapi/linux/virtio_net.h
+++ b/libc/kernel/uapi/linux/virtio_net.h
@@ -45,6 +45,10 @@
#define VIRTIO_NET_F_GUEST_ANNOUNCE 21
#define VIRTIO_NET_F_MQ 22
#define VIRTIO_NET_F_CTRL_MAC_ADDR 23
+#define VIRTIO_NET_F_NOTF_COAL 53
+#define VIRTIO_NET_F_GUEST_USO4 54
+#define VIRTIO_NET_F_GUEST_USO6 55
+#define VIRTIO_NET_F_HOST_USO 56
#define VIRTIO_NET_F_HASH_REPORT 57
#define VIRTIO_NET_F_RSS 60
#define VIRTIO_NET_F_RSC_EXT 61
@@ -84,6 +88,7 @@
#define VIRTIO_NET_HDR_GSO_TCPV4 1
#define VIRTIO_NET_HDR_GSO_UDP 3
#define VIRTIO_NET_HDR_GSO_TCPV6 4
+#define VIRTIO_NET_HDR_GSO_UDP_L4 5
#define VIRTIO_NET_HDR_GSO_ECN 0x80
__u8 gso_type;
__virtio16 hdr_len;
@@ -186,4 +191,15 @@
#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2
#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
+#define VIRTIO_NET_CTRL_NOTF_COAL 6
+struct virtio_net_ctrl_coal_tx {
+ __le32 tx_max_packets;
+ __le32 tx_usecs;
+};
+#define VIRTIO_NET_CTRL_NOTF_COAL_TX_SET 0
+struct virtio_net_ctrl_coal_rx {
+ __le32 rx_max_packets;
+ __le32 rx_usecs;
+};
+#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1
#endif
diff --git a/libc/kernel/uapi/linux/virtio_pci.h b/libc/kernel/uapi/linux/virtio_pci.h
index e6d2731..94ca0a2 100644
--- a/libc/kernel/uapi/linux/virtio_pci.h
+++ b/libc/kernel/uapi/linux/virtio_pci.h
@@ -117,5 +117,7 @@
#define VIRTIO_PCI_COMMON_Q_AVAILHI 44
#define VIRTIO_PCI_COMMON_Q_USEDLO 48
#define VIRTIO_PCI_COMMON_Q_USEDHI 52
+#define VIRTIO_PCI_COMMON_Q_NDATA 56
+#define VIRTIO_PCI_COMMON_Q_RESET 58
#endif
#endif
diff --git a/libc/kernel/uapi/linux/wireless.h b/libc/kernel/uapi/linux/wireless.h
index ca31dd2..eb57fff 100644
--- a/libc/kernel/uapi/linux/wireless.h
+++ b/libc/kernel/uapi/linux/wireless.h
@@ -264,7 +264,7 @@
__u16 flags;
};
struct iw_point {
- void __user * pointer;
+ void * pointer;
__u16 length;
__u16 flags;
};
diff --git a/libc/kernel/uapi/linux/wmi.h b/libc/kernel/uapi/linux/wmi.h
index 26f54d9..7b72056 100644
--- a/libc/kernel/uapi/linux/wmi.h
+++ b/libc/kernel/uapi/linux/wmi.h
@@ -30,17 +30,17 @@
__u16 cmd_select;
volatile __u32 input[4];
volatile __u32 output[4];
-} __packed;
+} __attribute__((__packed__));
struct dell_wmi_extensions {
__u32 argattrib;
__u32 blength;
__u8 data[];
-} __packed;
+} __attribute__((__packed__));
struct dell_wmi_smbios_buffer {
__u64 length;
struct calling_interface_buffer std;
struct dell_wmi_extensions ext;
-} __packed;
+} __attribute__((__packed__));
#define CLASS_TOKEN_READ 0
#define CLASS_TOKEN_WRITE 1
#define SELECT_TOKEN_STD 0
diff --git a/libc/kernel/uapi/linux/xfrm.h b/libc/kernel/uapi/linux/xfrm.h
index f4df95f..b8a2efc 100644
--- a/libc/kernel/uapi/linux/xfrm.h
+++ b/libc/kernel/uapi/linux/xfrm.h
@@ -35,7 +35,7 @@
__u8 ctx_alg;
__u16 ctx_len;
__u32 ctx_sid;
- char ctx_str[0];
+ char ctx_str[];
};
#define XFRM_SC_DOI_RESERVED 0
#define XFRM_SC_DOI_LSM 1
@@ -85,24 +85,24 @@
__u32 oseq_hi;
__u32 seq_hi;
__u32 replay_window;
- __u32 bmp[0];
+ __u32 bmp[];
};
struct xfrm_algo {
char alg_name[64];
unsigned int alg_key_len;
- char alg_key[0];
+ char alg_key[];
};
struct xfrm_algo_auth {
char alg_name[64];
unsigned int alg_key_len;
unsigned int alg_trunc_len;
- char alg_key[0];
+ char alg_key[];
};
struct xfrm_algo_aead {
char alg_name[64];
unsigned int alg_key_len;
unsigned int alg_icv_len;
- char alg_key[0];
+ char alg_key[];
};
struct xfrm_stats {
__u32 replay_window;
@@ -435,6 +435,7 @@
};
#define XFRM_OFFLOAD_IPV6 1
#define XFRM_OFFLOAD_INBOUND 2
+#define XFRM_OFFLOAD_PACKET 4
struct xfrm_userpolicy_default {
#define XFRM_USERPOLICY_UNSPEC 0
#define XFRM_USERPOLICY_BLOCK 1
diff --git a/libc/kernel/uapi/linux/zorro.h b/libc/kernel/uapi/linux/zorro.h
index f8e47a1..86320aa 100644
--- a/libc/kernel/uapi/linux/zorro.h
+++ b/libc/kernel/uapi/linux/zorro.h
@@ -42,7 +42,7 @@
__u8 ln_Type;
__s8 ln_Pri;
__be32 ln_Name;
-} __packed;
+} __attribute__((__packed__));
struct ExpansionRom {
__u8 er_Type;
__u8 er_Product;
@@ -55,7 +55,7 @@
__u8 er_Reserved0d;
__u8 er_Reserved0e;
__u8 er_Reserved0f;
-} __packed;
+} __attribute__((__packed__));
#define ERT_TYPEMASK 0xc0
#define ERT_ZORROII 0xc0
#define ERT_ZORROIII 0x80
@@ -73,6 +73,6 @@
__be32 cd_Driver;
__be32 cd_NextCD;
__be32 cd_Unused[4];
-} __packed;
+} __attribute__((__packed__));
#define ZORRO_NUM_AUTO 16
#endif
diff --git a/libc/kernel/uapi/misc/fastrpc.h b/libc/kernel/uapi/misc/fastrpc.h
index 62955ec..336ecf2 100644
--- a/libc/kernel/uapi/misc/fastrpc.h
+++ b/libc/kernel/uapi/misc/fastrpc.h
@@ -27,11 +27,33 @@
#define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap)
#define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap)
#define FASTRPC_IOCTL_INIT_ATTACH_SNS _IO('R', 8)
+#define FASTRPC_IOCTL_INIT_CREATE_STATIC _IOWR('R', 9, struct fastrpc_init_create_static)
+#define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 10, struct fastrpc_mem_map)
+#define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 11, struct fastrpc_mem_unmap)
+#define FASTRPC_IOCTL_GET_DSP_INFO _IOWR('R', 13, struct fastrpc_ioctl_capability)
+enum fastrpc_map_flags {
+ FASTRPC_MAP_STATIC = 0,
+ FASTRPC_MAP_RESERVED,
+ FASTRPC_MAP_FD = 2,
+ FASTRPC_MAP_FD_DELAYED,
+ FASTRPC_MAP_FD_NOMAP = 16,
+ FASTRPC_MAP_MAX,
+};
+enum fastrpc_proc_attr {
+ FASTRPC_MODE_DEBUG = (1 << 0),
+ FASTRPC_MODE_PTRACE = (1 << 1),
+ FASTRPC_MODE_CRC = (1 << 2),
+ FASTRPC_MODE_UNSIGNED_MODULE = (1 << 3),
+ FASTRPC_MODE_ADAPTIVE_QOS = (1 << 4),
+ FASTRPC_MODE_SYSTEM_PROCESS = (1 << 5),
+ FASTRPC_MODE_PRIVILEGED = (1 << 6),
+};
+#define FASTRPC_ATTR_SECUREMAP (1)
struct fastrpc_invoke_args {
__u64 ptr;
__u64 length;
__s32 fd;
- __u32 reserved;
+ __u32 attr;
};
struct fastrpc_invoke {
__u32 handle;
@@ -45,6 +67,11 @@
__u32 siglen;
__u64 file;
};
+struct fastrpc_init_create_static {
+ __u32 namelen;
+ __u32 memlen;
+ __u64 name;
+};
struct fastrpc_alloc_dma_buf {
__s32 fd;
__u32 flags;
@@ -57,8 +84,32 @@
__u64 size;
__u64 vaddrout;
};
+struct fastrpc_mem_map {
+ __s32 version;
+ __s32 fd;
+ __s32 offset;
+ __u32 flags;
+ __u64 vaddrin;
+ __u64 length;
+ __u64 vaddrout;
+ __s32 attrs;
+ __s32 reserved[4];
+};
struct fastrpc_req_munmap {
__u64 vaddrout;
__u64 size;
};
+struct fastrpc_mem_unmap {
+ __s32 vesion;
+ __s32 fd;
+ __u64 vaddr;
+ __u64 length;
+ __s32 reserved[5];
+};
+struct fastrpc_ioctl_capability {
+ __u32 domain;
+ __u32 attribute_id;
+ __u32 capability;
+ __u32 reserved[4];
+};
#endif
diff --git a/libc/kernel/uapi/misc/habanalabs.h b/libc/kernel/uapi/misc/habanalabs.h
index 6e3439a..b25c833 100644
--- a/libc/kernel/uapi/misc/habanalabs.h
+++ b/libc/kernel/uapi/misc/habanalabs.h
@@ -24,6 +24,7 @@
#define GAUDI_DRIVER_SRAM_RESERVED_SIZE_FROM_START 0x80
#define GAUDI_FIRST_AVAILABLE_W_S_SYNC_OBJECT 144
#define GAUDI_FIRST_AVAILABLE_W_S_MONITOR 72
+#define TS_MAX_ELEMENTS_NUM (1 << 20)
enum goya_queue_id {
GOYA_QUEUE_ID_DMA_0 = 0,
GOYA_QUEUE_ID_DMA_1 = 1,
@@ -158,6 +159,270 @@
GAUDI_QUEUE_ID_NIC_9_3 = 112,
GAUDI_QUEUE_ID_SIZE
};
+enum gaudi2_queue_id {
+ GAUDI2_QUEUE_ID_PDMA_0_0 = 0,
+ GAUDI2_QUEUE_ID_PDMA_0_1 = 1,
+ GAUDI2_QUEUE_ID_PDMA_0_2 = 2,
+ GAUDI2_QUEUE_ID_PDMA_0_3 = 3,
+ GAUDI2_QUEUE_ID_PDMA_1_0 = 4,
+ GAUDI2_QUEUE_ID_PDMA_1_1 = 5,
+ GAUDI2_QUEUE_ID_PDMA_1_2 = 6,
+ GAUDI2_QUEUE_ID_PDMA_1_3 = 7,
+ GAUDI2_QUEUE_ID_DCORE0_EDMA_0_0 = 8,
+ GAUDI2_QUEUE_ID_DCORE0_EDMA_0_1 = 9,
+ GAUDI2_QUEUE_ID_DCORE0_EDMA_0_2 = 10,
+ GAUDI2_QUEUE_ID_DCORE0_EDMA_0_3 = 11,
+ GAUDI2_QUEUE_ID_DCORE0_EDMA_1_0 = 12,
+ GAUDI2_QUEUE_ID_DCORE0_EDMA_1_1 = 13,
+ GAUDI2_QUEUE_ID_DCORE0_EDMA_1_2 = 14,
+ GAUDI2_QUEUE_ID_DCORE0_EDMA_1_3 = 15,
+ GAUDI2_QUEUE_ID_DCORE0_MME_0_0 = 16,
+ GAUDI2_QUEUE_ID_DCORE0_MME_0_1 = 17,
+ GAUDI2_QUEUE_ID_DCORE0_MME_0_2 = 18,
+ GAUDI2_QUEUE_ID_DCORE0_MME_0_3 = 19,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_0_0 = 20,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_0_1 = 21,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_0_2 = 22,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_0_3 = 23,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_1_0 = 24,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_1_1 = 25,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_1_2 = 26,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_1_3 = 27,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_2_0 = 28,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_2_1 = 29,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_2_2 = 30,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_2_3 = 31,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_3_0 = 32,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_3_1 = 33,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_3_2 = 34,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_3_3 = 35,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_4_0 = 36,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_4_1 = 37,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_4_2 = 38,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_4_3 = 39,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_5_0 = 40,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_5_1 = 41,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_5_2 = 42,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_5_3 = 43,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_6_0 = 44,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_6_1 = 45,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_6_2 = 46,
+ GAUDI2_QUEUE_ID_DCORE0_TPC_6_3 = 47,
+ GAUDI2_QUEUE_ID_DCORE1_EDMA_0_0 = 48,
+ GAUDI2_QUEUE_ID_DCORE1_EDMA_0_1 = 49,
+ GAUDI2_QUEUE_ID_DCORE1_EDMA_0_2 = 50,
+ GAUDI2_QUEUE_ID_DCORE1_EDMA_0_3 = 51,
+ GAUDI2_QUEUE_ID_DCORE1_EDMA_1_0 = 52,
+ GAUDI2_QUEUE_ID_DCORE1_EDMA_1_1 = 53,
+ GAUDI2_QUEUE_ID_DCORE1_EDMA_1_2 = 54,
+ GAUDI2_QUEUE_ID_DCORE1_EDMA_1_3 = 55,
+ GAUDI2_QUEUE_ID_DCORE1_MME_0_0 = 56,
+ GAUDI2_QUEUE_ID_DCORE1_MME_0_1 = 57,
+ GAUDI2_QUEUE_ID_DCORE1_MME_0_2 = 58,
+ GAUDI2_QUEUE_ID_DCORE1_MME_0_3 = 59,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_0_0 = 60,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_0_1 = 61,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_0_2 = 62,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_0_3 = 63,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_1_0 = 64,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_1_1 = 65,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_1_2 = 66,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_1_3 = 67,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_2_0 = 68,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_2_1 = 69,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_2_2 = 70,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_2_3 = 71,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_3_0 = 72,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_3_1 = 73,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_3_2 = 74,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_3_3 = 75,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_4_0 = 76,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_4_1 = 77,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_4_2 = 78,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_4_3 = 79,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_5_0 = 80,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_5_1 = 81,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_5_2 = 82,
+ GAUDI2_QUEUE_ID_DCORE1_TPC_5_3 = 83,
+ GAUDI2_QUEUE_ID_DCORE2_EDMA_0_0 = 84,
+ GAUDI2_QUEUE_ID_DCORE2_EDMA_0_1 = 85,
+ GAUDI2_QUEUE_ID_DCORE2_EDMA_0_2 = 86,
+ GAUDI2_QUEUE_ID_DCORE2_EDMA_0_3 = 87,
+ GAUDI2_QUEUE_ID_DCORE2_EDMA_1_0 = 88,
+ GAUDI2_QUEUE_ID_DCORE2_EDMA_1_1 = 89,
+ GAUDI2_QUEUE_ID_DCORE2_EDMA_1_2 = 90,
+ GAUDI2_QUEUE_ID_DCORE2_EDMA_1_3 = 91,
+ GAUDI2_QUEUE_ID_DCORE2_MME_0_0 = 92,
+ GAUDI2_QUEUE_ID_DCORE2_MME_0_1 = 93,
+ GAUDI2_QUEUE_ID_DCORE2_MME_0_2 = 94,
+ GAUDI2_QUEUE_ID_DCORE2_MME_0_3 = 95,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_0_0 = 96,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_0_1 = 97,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_0_2 = 98,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_0_3 = 99,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_1_0 = 100,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_1_1 = 101,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_1_2 = 102,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_1_3 = 103,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_2_0 = 104,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_2_1 = 105,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_2_2 = 106,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_2_3 = 107,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_3_0 = 108,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_3_1 = 109,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_3_2 = 110,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_3_3 = 111,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_4_0 = 112,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_4_1 = 113,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_4_2 = 114,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_4_3 = 115,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_5_0 = 116,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_5_1 = 117,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_5_2 = 118,
+ GAUDI2_QUEUE_ID_DCORE2_TPC_5_3 = 119,
+ GAUDI2_QUEUE_ID_DCORE3_EDMA_0_0 = 120,
+ GAUDI2_QUEUE_ID_DCORE3_EDMA_0_1 = 121,
+ GAUDI2_QUEUE_ID_DCORE3_EDMA_0_2 = 122,
+ GAUDI2_QUEUE_ID_DCORE3_EDMA_0_3 = 123,
+ GAUDI2_QUEUE_ID_DCORE3_EDMA_1_0 = 124,
+ GAUDI2_QUEUE_ID_DCORE3_EDMA_1_1 = 125,
+ GAUDI2_QUEUE_ID_DCORE3_EDMA_1_2 = 126,
+ GAUDI2_QUEUE_ID_DCORE3_EDMA_1_3 = 127,
+ GAUDI2_QUEUE_ID_DCORE3_MME_0_0 = 128,
+ GAUDI2_QUEUE_ID_DCORE3_MME_0_1 = 129,
+ GAUDI2_QUEUE_ID_DCORE3_MME_0_2 = 130,
+ GAUDI2_QUEUE_ID_DCORE3_MME_0_3 = 131,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_0_0 = 132,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_0_1 = 133,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_0_2 = 134,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_0_3 = 135,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_1_0 = 136,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_1_1 = 137,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_1_2 = 138,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_1_3 = 139,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_2_0 = 140,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_2_1 = 141,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_2_2 = 142,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_2_3 = 143,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_3_0 = 144,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_3_1 = 145,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_3_2 = 146,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_3_3 = 147,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_4_0 = 148,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_4_1 = 149,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_4_2 = 150,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_4_3 = 151,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_5_0 = 152,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_5_1 = 153,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_5_2 = 154,
+ GAUDI2_QUEUE_ID_DCORE3_TPC_5_3 = 155,
+ GAUDI2_QUEUE_ID_NIC_0_0 = 156,
+ GAUDI2_QUEUE_ID_NIC_0_1 = 157,
+ GAUDI2_QUEUE_ID_NIC_0_2 = 158,
+ GAUDI2_QUEUE_ID_NIC_0_3 = 159,
+ GAUDI2_QUEUE_ID_NIC_1_0 = 160,
+ GAUDI2_QUEUE_ID_NIC_1_1 = 161,
+ GAUDI2_QUEUE_ID_NIC_1_2 = 162,
+ GAUDI2_QUEUE_ID_NIC_1_3 = 163,
+ GAUDI2_QUEUE_ID_NIC_2_0 = 164,
+ GAUDI2_QUEUE_ID_NIC_2_1 = 165,
+ GAUDI2_QUEUE_ID_NIC_2_2 = 166,
+ GAUDI2_QUEUE_ID_NIC_2_3 = 167,
+ GAUDI2_QUEUE_ID_NIC_3_0 = 168,
+ GAUDI2_QUEUE_ID_NIC_3_1 = 169,
+ GAUDI2_QUEUE_ID_NIC_3_2 = 170,
+ GAUDI2_QUEUE_ID_NIC_3_3 = 171,
+ GAUDI2_QUEUE_ID_NIC_4_0 = 172,
+ GAUDI2_QUEUE_ID_NIC_4_1 = 173,
+ GAUDI2_QUEUE_ID_NIC_4_2 = 174,
+ GAUDI2_QUEUE_ID_NIC_4_3 = 175,
+ GAUDI2_QUEUE_ID_NIC_5_0 = 176,
+ GAUDI2_QUEUE_ID_NIC_5_1 = 177,
+ GAUDI2_QUEUE_ID_NIC_5_2 = 178,
+ GAUDI2_QUEUE_ID_NIC_5_3 = 179,
+ GAUDI2_QUEUE_ID_NIC_6_0 = 180,
+ GAUDI2_QUEUE_ID_NIC_6_1 = 181,
+ GAUDI2_QUEUE_ID_NIC_6_2 = 182,
+ GAUDI2_QUEUE_ID_NIC_6_3 = 183,
+ GAUDI2_QUEUE_ID_NIC_7_0 = 184,
+ GAUDI2_QUEUE_ID_NIC_7_1 = 185,
+ GAUDI2_QUEUE_ID_NIC_7_2 = 186,
+ GAUDI2_QUEUE_ID_NIC_7_3 = 187,
+ GAUDI2_QUEUE_ID_NIC_8_0 = 188,
+ GAUDI2_QUEUE_ID_NIC_8_1 = 189,
+ GAUDI2_QUEUE_ID_NIC_8_2 = 190,
+ GAUDI2_QUEUE_ID_NIC_8_3 = 191,
+ GAUDI2_QUEUE_ID_NIC_9_0 = 192,
+ GAUDI2_QUEUE_ID_NIC_9_1 = 193,
+ GAUDI2_QUEUE_ID_NIC_9_2 = 194,
+ GAUDI2_QUEUE_ID_NIC_9_3 = 195,
+ GAUDI2_QUEUE_ID_NIC_10_0 = 196,
+ GAUDI2_QUEUE_ID_NIC_10_1 = 197,
+ GAUDI2_QUEUE_ID_NIC_10_2 = 198,
+ GAUDI2_QUEUE_ID_NIC_10_3 = 199,
+ GAUDI2_QUEUE_ID_NIC_11_0 = 200,
+ GAUDI2_QUEUE_ID_NIC_11_1 = 201,
+ GAUDI2_QUEUE_ID_NIC_11_2 = 202,
+ GAUDI2_QUEUE_ID_NIC_11_3 = 203,
+ GAUDI2_QUEUE_ID_NIC_12_0 = 204,
+ GAUDI2_QUEUE_ID_NIC_12_1 = 205,
+ GAUDI2_QUEUE_ID_NIC_12_2 = 206,
+ GAUDI2_QUEUE_ID_NIC_12_3 = 207,
+ GAUDI2_QUEUE_ID_NIC_13_0 = 208,
+ GAUDI2_QUEUE_ID_NIC_13_1 = 209,
+ GAUDI2_QUEUE_ID_NIC_13_2 = 210,
+ GAUDI2_QUEUE_ID_NIC_13_3 = 211,
+ GAUDI2_QUEUE_ID_NIC_14_0 = 212,
+ GAUDI2_QUEUE_ID_NIC_14_1 = 213,
+ GAUDI2_QUEUE_ID_NIC_14_2 = 214,
+ GAUDI2_QUEUE_ID_NIC_14_3 = 215,
+ GAUDI2_QUEUE_ID_NIC_15_0 = 216,
+ GAUDI2_QUEUE_ID_NIC_15_1 = 217,
+ GAUDI2_QUEUE_ID_NIC_15_2 = 218,
+ GAUDI2_QUEUE_ID_NIC_15_3 = 219,
+ GAUDI2_QUEUE_ID_NIC_16_0 = 220,
+ GAUDI2_QUEUE_ID_NIC_16_1 = 221,
+ GAUDI2_QUEUE_ID_NIC_16_2 = 222,
+ GAUDI2_QUEUE_ID_NIC_16_3 = 223,
+ GAUDI2_QUEUE_ID_NIC_17_0 = 224,
+ GAUDI2_QUEUE_ID_NIC_17_1 = 225,
+ GAUDI2_QUEUE_ID_NIC_17_2 = 226,
+ GAUDI2_QUEUE_ID_NIC_17_3 = 227,
+ GAUDI2_QUEUE_ID_NIC_18_0 = 228,
+ GAUDI2_QUEUE_ID_NIC_18_1 = 229,
+ GAUDI2_QUEUE_ID_NIC_18_2 = 230,
+ GAUDI2_QUEUE_ID_NIC_18_3 = 231,
+ GAUDI2_QUEUE_ID_NIC_19_0 = 232,
+ GAUDI2_QUEUE_ID_NIC_19_1 = 233,
+ GAUDI2_QUEUE_ID_NIC_19_2 = 234,
+ GAUDI2_QUEUE_ID_NIC_19_3 = 235,
+ GAUDI2_QUEUE_ID_NIC_20_0 = 236,
+ GAUDI2_QUEUE_ID_NIC_20_1 = 237,
+ GAUDI2_QUEUE_ID_NIC_20_2 = 238,
+ GAUDI2_QUEUE_ID_NIC_20_3 = 239,
+ GAUDI2_QUEUE_ID_NIC_21_0 = 240,
+ GAUDI2_QUEUE_ID_NIC_21_1 = 241,
+ GAUDI2_QUEUE_ID_NIC_21_2 = 242,
+ GAUDI2_QUEUE_ID_NIC_21_3 = 243,
+ GAUDI2_QUEUE_ID_NIC_22_0 = 244,
+ GAUDI2_QUEUE_ID_NIC_22_1 = 245,
+ GAUDI2_QUEUE_ID_NIC_22_2 = 246,
+ GAUDI2_QUEUE_ID_NIC_22_3 = 247,
+ GAUDI2_QUEUE_ID_NIC_23_0 = 248,
+ GAUDI2_QUEUE_ID_NIC_23_1 = 249,
+ GAUDI2_QUEUE_ID_NIC_23_2 = 250,
+ GAUDI2_QUEUE_ID_NIC_23_3 = 251,
+ GAUDI2_QUEUE_ID_ROT_0_0 = 252,
+ GAUDI2_QUEUE_ID_ROT_0_1 = 253,
+ GAUDI2_QUEUE_ID_ROT_0_2 = 254,
+ GAUDI2_QUEUE_ID_ROT_0_3 = 255,
+ GAUDI2_QUEUE_ID_ROT_1_0 = 256,
+ GAUDI2_QUEUE_ID_ROT_1_1 = 257,
+ GAUDI2_QUEUE_ID_ROT_1_2 = 258,
+ GAUDI2_QUEUE_ID_ROT_1_3 = 259,
+ GAUDI2_QUEUE_ID_CPU_PQ = 260,
+ GAUDI2_QUEUE_ID_SIZE
+};
enum goya_engine_id {
GOYA_ENGINE_ID_DMA_0 = 0,
GOYA_ENGINE_ID_DMA_1,
@@ -208,6 +473,88 @@
GAUDI_ENGINE_ID_NIC_9,
GAUDI_ENGINE_ID_SIZE
};
+enum gaudi2_engine_id {
+ GAUDI2_DCORE0_ENGINE_ID_EDMA_0 = 0,
+ GAUDI2_DCORE0_ENGINE_ID_EDMA_1,
+ GAUDI2_DCORE0_ENGINE_ID_MME,
+ GAUDI2_DCORE0_ENGINE_ID_TPC_0,
+ GAUDI2_DCORE0_ENGINE_ID_TPC_1,
+ GAUDI2_DCORE0_ENGINE_ID_TPC_2,
+ GAUDI2_DCORE0_ENGINE_ID_TPC_3,
+ GAUDI2_DCORE0_ENGINE_ID_TPC_4,
+ GAUDI2_DCORE0_ENGINE_ID_TPC_5,
+ GAUDI2_DCORE0_ENGINE_ID_DEC_0,
+ GAUDI2_DCORE0_ENGINE_ID_DEC_1,
+ GAUDI2_DCORE1_ENGINE_ID_EDMA_0,
+ GAUDI2_DCORE1_ENGINE_ID_EDMA_1,
+ GAUDI2_DCORE1_ENGINE_ID_MME,
+ GAUDI2_DCORE1_ENGINE_ID_TPC_0,
+ GAUDI2_DCORE1_ENGINE_ID_TPC_1,
+ GAUDI2_DCORE1_ENGINE_ID_TPC_2,
+ GAUDI2_DCORE1_ENGINE_ID_TPC_3,
+ GAUDI2_DCORE1_ENGINE_ID_TPC_4,
+ GAUDI2_DCORE1_ENGINE_ID_TPC_5,
+ GAUDI2_DCORE1_ENGINE_ID_DEC_0,
+ GAUDI2_DCORE1_ENGINE_ID_DEC_1,
+ GAUDI2_DCORE2_ENGINE_ID_EDMA_0,
+ GAUDI2_DCORE2_ENGINE_ID_EDMA_1,
+ GAUDI2_DCORE2_ENGINE_ID_MME,
+ GAUDI2_DCORE2_ENGINE_ID_TPC_0,
+ GAUDI2_DCORE2_ENGINE_ID_TPC_1,
+ GAUDI2_DCORE2_ENGINE_ID_TPC_2,
+ GAUDI2_DCORE2_ENGINE_ID_TPC_3,
+ GAUDI2_DCORE2_ENGINE_ID_TPC_4,
+ GAUDI2_DCORE2_ENGINE_ID_TPC_5,
+ GAUDI2_DCORE2_ENGINE_ID_DEC_0,
+ GAUDI2_DCORE2_ENGINE_ID_DEC_1,
+ GAUDI2_DCORE3_ENGINE_ID_EDMA_0,
+ GAUDI2_DCORE3_ENGINE_ID_EDMA_1,
+ GAUDI2_DCORE3_ENGINE_ID_MME,
+ GAUDI2_DCORE3_ENGINE_ID_TPC_0,
+ GAUDI2_DCORE3_ENGINE_ID_TPC_1,
+ GAUDI2_DCORE3_ENGINE_ID_TPC_2,
+ GAUDI2_DCORE3_ENGINE_ID_TPC_3,
+ GAUDI2_DCORE3_ENGINE_ID_TPC_4,
+ GAUDI2_DCORE3_ENGINE_ID_TPC_5,
+ GAUDI2_DCORE3_ENGINE_ID_DEC_0,
+ GAUDI2_DCORE3_ENGINE_ID_DEC_1,
+ GAUDI2_DCORE0_ENGINE_ID_TPC_6,
+ GAUDI2_ENGINE_ID_PDMA_0,
+ GAUDI2_ENGINE_ID_PDMA_1,
+ GAUDI2_ENGINE_ID_ROT_0,
+ GAUDI2_ENGINE_ID_ROT_1,
+ GAUDI2_PCIE_ENGINE_ID_DEC_0,
+ GAUDI2_PCIE_ENGINE_ID_DEC_1,
+ GAUDI2_ENGINE_ID_NIC0_0,
+ GAUDI2_ENGINE_ID_NIC0_1,
+ GAUDI2_ENGINE_ID_NIC1_0,
+ GAUDI2_ENGINE_ID_NIC1_1,
+ GAUDI2_ENGINE_ID_NIC2_0,
+ GAUDI2_ENGINE_ID_NIC2_1,
+ GAUDI2_ENGINE_ID_NIC3_0,
+ GAUDI2_ENGINE_ID_NIC3_1,
+ GAUDI2_ENGINE_ID_NIC4_0,
+ GAUDI2_ENGINE_ID_NIC4_1,
+ GAUDI2_ENGINE_ID_NIC5_0,
+ GAUDI2_ENGINE_ID_NIC5_1,
+ GAUDI2_ENGINE_ID_NIC6_0,
+ GAUDI2_ENGINE_ID_NIC6_1,
+ GAUDI2_ENGINE_ID_NIC7_0,
+ GAUDI2_ENGINE_ID_NIC7_1,
+ GAUDI2_ENGINE_ID_NIC8_0,
+ GAUDI2_ENGINE_ID_NIC8_1,
+ GAUDI2_ENGINE_ID_NIC9_0,
+ GAUDI2_ENGINE_ID_NIC9_1,
+ GAUDI2_ENGINE_ID_NIC10_0,
+ GAUDI2_ENGINE_ID_NIC10_1,
+ GAUDI2_ENGINE_ID_NIC11_0,
+ GAUDI2_ENGINE_ID_NIC11_1,
+ GAUDI2_ENGINE_ID_PCIE,
+ GAUDI2_ENGINE_ID_PSOC,
+ GAUDI2_ENGINE_ID_ARC_FARM,
+ GAUDI2_ENGINE_ID_KDMA,
+ GAUDI2_ENGINE_ID_SIZE
+};
enum hl_goya_pll_index {
HL_GOYA_CPU_PLL = 0,
HL_GOYA_IC_PLL,
@@ -231,21 +578,58 @@
HL_GAUDI_IF_PLL,
HL_GAUDI_PLL_MAX
};
+enum hl_gaudi2_pll_index {
+ HL_GAUDI2_CPU_PLL = 0,
+ HL_GAUDI2_PCI_PLL,
+ HL_GAUDI2_SRAM_PLL,
+ HL_GAUDI2_HBM_PLL,
+ HL_GAUDI2_NIC_PLL,
+ HL_GAUDI2_DMA_PLL,
+ HL_GAUDI2_MESH_PLL,
+ HL_GAUDI2_MME_PLL,
+ HL_GAUDI2_TPC_PLL,
+ HL_GAUDI2_IF_PLL,
+ HL_GAUDI2_VID_PLL,
+ HL_GAUDI2_MSS_PLL,
+ HL_GAUDI2_PLL_MAX
+};
+enum hl_goya_dma_direction {
+ HL_DMA_HOST_TO_DRAM,
+ HL_DMA_HOST_TO_SRAM,
+ HL_DMA_DRAM_TO_SRAM,
+ HL_DMA_SRAM_TO_DRAM,
+ HL_DMA_SRAM_TO_HOST,
+ HL_DMA_DRAM_TO_HOST,
+ HL_DMA_DRAM_TO_DRAM,
+ HL_DMA_SRAM_TO_SRAM,
+ HL_DMA_ENUM_MAX
+};
enum hl_device_status {
HL_DEVICE_STATUS_OPERATIONAL,
HL_DEVICE_STATUS_IN_RESET,
HL_DEVICE_STATUS_MALFUNCTION,
HL_DEVICE_STATUS_NEEDS_RESET,
HL_DEVICE_STATUS_IN_DEVICE_CREATION,
- HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_DEVICE_CREATION
+ HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE,
+ HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE
};
enum hl_server_type {
HL_SERVER_TYPE_UNKNOWN = 0,
HL_SERVER_GAUDI_HLS1 = 1,
HL_SERVER_GAUDI_HLS1H = 2,
HL_SERVER_GAUDI_TYPE1 = 3,
- HL_SERVER_GAUDI_TYPE2 = 4
+ HL_SERVER_GAUDI_TYPE2 = 4,
+ HL_SERVER_GAUDI2_HLS2 = 5
};
+#define HL_NOTIFIER_EVENT_TPC_ASSERT (1ULL << 0)
+#define HL_NOTIFIER_EVENT_UNDEFINED_OPCODE (1ULL << 1)
+#define HL_NOTIFIER_EVENT_DEVICE_RESET (1ULL << 2)
+#define HL_NOTIFIER_EVENT_CS_TIMEOUT (1ULL << 3)
+#define HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE (1ULL << 4)
+#define HL_NOTIFIER_EVENT_USER_ENGINE_ERR (1ULL << 5)
+#define HL_NOTIFIER_EVENT_GENERAL_HW_ERR (1ULL << 6)
+#define HL_NOTIFIER_EVENT_RAZWI (1ULL << 7)
+#define HL_NOTIFIER_EVENT_PAGE_FAULT (1ULL << 8)
#define HL_INFO_HW_IP_INFO 0
#define HL_INFO_HW_EVENTS 1
#define HL_INFO_DRAM_USAGE 2
@@ -269,8 +653,18 @@
#define HL_INFO_LAST_ERR_OPEN_DEV_TIME 23
#define HL_INFO_CS_TIMEOUT_EVENT 24
#define HL_INFO_RAZWI_EVENT 25
+#define HL_INFO_DEV_MEM_ALLOC_PAGE_SIZES 26
+#define HL_INFO_SECURED_ATTESTATION 27
+#define HL_INFO_REGISTER_EVENTFD 28
+#define HL_INFO_UNREGISTER_EVENTFD 29
+#define HL_INFO_GET_EVENTS 30
+#define HL_INFO_UNDEFINED_OPCODE_EVENT 31
+#define HL_INFO_ENGINE_STATUS 32
+#define HL_INFO_PAGE_FAULT_EVENT 33
+#define HL_INFO_USER_MAPPINGS 34
#define HL_INFO_VERSION_MAX_LEN 128
#define HL_INFO_CARD_NAME_MAX_LEN 16
+#define HL_ENGINES_DATA_MAX_SIZE SZ_1M
struct hl_info_hw_ip_info {
__u64 sram_base_address;
__u64 dram_base_address;
@@ -279,7 +673,7 @@
__u32 num_of_events;
__u32 device_id;
__u32 module_id;
- __u32 reserved;
+ __u32 decoder_enabled_mask;
__u16 first_available_interrupt_id;
__u16 server_type;
__u32 cpld_version;
@@ -289,17 +683,29 @@
__u32 psoc_pci_pll_div_factor;
__u8 tpc_enabled_mask;
__u8 dram_enabled;
- __u8 pad[2];
+ __u8 security_enabled;
+ __u8 mme_master_slave_mode;
__u8 cpucp_version[HL_INFO_VERSION_MAX_LEN];
__u8 card_name[HL_INFO_CARD_NAME_MAX_LEN];
- __u64 reserved2;
+ __u64 tpc_enabled_mask_ext;
__u64 dram_page_size;
+ __u32 edma_enabled_mask;
+ __u16 number_of_user_interrupts;
+ __u16 pad2;
+ __u64 reserved4;
+ __u64 device_mem_alloc_default_page_size;
+ __u64 reserved5;
+ __u64 reserved6;
+ __u32 reserved7;
+ __u8 reserved8;
+ __u8 revision_id;
+ __u8 pad[2];
};
struct hl_info_dram_usage {
__u64 dram_free_mem;
__u64 ctx_dram_mem;
};
-#define HL_BUSY_ENGINES_MASK_EXT_SIZE 2
+#define HL_BUSY_ENGINES_MASK_EXT_SIZE 4
struct hl_info_hw_idle {
__u32 is_idle;
__u32 busy_engines_mask;
@@ -353,6 +759,9 @@
struct hl_open_stats_info {
__u64 open_counter;
__u64 last_open_period_ms;
+ __u8 is_compute_ctx_active;
+ __u8 compute_ctx_in_release;
+ __u8 pad[6];
};
struct hl_power_info {
__u64 power;
@@ -384,16 +793,65 @@
__s64 timestamp;
__u64 seq;
};
-#define HL_RAZWI_PAGE_FAULT 0
-#define HL_RAZWI_MMU_ACCESS_ERROR 1
+#define HL_RAZWI_NA_ENG_ID U16_MAX
+#define HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR 128
+#define HL_RAZWI_READ BIT(0)
+#define HL_RAZWI_WRITE BIT(1)
+#define HL_RAZWI_LBW BIT(2)
+#define HL_RAZWI_HBW BIT(3)
+#define HL_RAZWI_RR BIT(4)
+#define HL_RAZWI_ADDR_DEC BIT(5)
struct hl_info_razwi_event {
__s64 timestamp;
__u64 addr;
- __u16 engine_id_1;
- __u16 engine_id_2;
- __u8 no_engine_id;
- __u8 error_type;
- __u8 pad[2];
+ __u16 engine_id[HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR];
+ __u16 num_of_possible_engines;
+ __u8 flags;
+ __u8 pad[5];
+};
+#define MAX_QMAN_STREAMS_INFO 4
+#define OPCODE_INFO_MAX_ADDR_SIZE 8
+struct hl_info_undefined_opcode_event {
+ __s64 timestamp;
+ __u64 cb_addr_streams[MAX_QMAN_STREAMS_INFO][OPCODE_INFO_MAX_ADDR_SIZE];
+ __u64 cq_addr;
+ __u32 cq_size;
+ __u32 cb_addr_streams_len;
+ __u32 engine_id;
+ __u32 stream_id;
+};
+struct hl_info_dev_memalloc_page_sizes {
+ __u64 page_order_bitmask;
+};
+#define SEC_PCR_DATA_BUF_SZ 256
+#define SEC_PCR_QUOTE_BUF_SZ 510
+#define SEC_SIGNATURE_BUF_SZ 255
+#define SEC_PUB_DATA_BUF_SZ 510
+#define SEC_CERTIFICATE_BUF_SZ 2046
+struct hl_info_sec_attest {
+ __u32 nonce;
+ __u16 pcr_quote_len;
+ __u16 pub_data_len;
+ __u16 certificate_len;
+ __u8 pcr_num_reg;
+ __u8 pcr_reg_len;
+ __u8 quote_sig_len;
+ __u8 pcr_data[SEC_PCR_DATA_BUF_SZ];
+ __u8 pcr_quote[SEC_PCR_QUOTE_BUF_SZ];
+ __u8 quote_sig[SEC_SIGNATURE_BUF_SZ];
+ __u8 public_data[SEC_PUB_DATA_BUF_SZ];
+ __u8 certificate[SEC_CERTIFICATE_BUF_SZ];
+ __u8 pad0[2];
+};
+struct hl_page_fault_info {
+ __s64 timestamp;
+ __u64 addr;
+ __u16 engine_id;
+ __u8 pad[6];
+};
+struct hl_user_mapping {
+ __u64 dev_va;
+ __u64 size;
};
enum gaudi_dcores {
HL_GAUDI_WS_DCORE,
@@ -410,6 +868,10 @@
__u32 ctx_id;
__u32 period_ms;
__u32 pll_index;
+ __u32 eventfd;
+ __u32 user_buffer_actual_size;
+ __u32 sec_attest_nonce;
+ __u32 array_size;
};
__u32 pad;
};
@@ -472,11 +934,23 @@
#define HL_CS_FLAGS_ENCAP_SIGNALS 0x800
#define HL_CS_FLAGS_RESERVE_SIGNALS_ONLY 0x1000
#define HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY 0x2000
+#define HL_CS_FLAGS_ENGINE_CORE_COMMAND 0x4000
#define HL_CS_STATUS_SUCCESS 0
#define HL_MAX_JOBS_PER_CS 512
+#define HL_ENGINE_CORE_HALT (1 << 0)
+#define HL_ENGINE_CORE_RUN (1 << 1)
struct hl_cs_in {
- __u64 chunks_restore;
- __u64 chunks_execute;
+ union {
+ struct {
+ __u64 chunks_restore;
+ __u64 chunks_execute;
+ };
+ struct {
+ __u64 engine_cores;
+ __u32 num_engine_cores;
+ __u32 core_command;
+ };
+ };
union {
__u64 seq;
__u32 encaps_sig_handle_id;
@@ -490,6 +964,7 @@
__u32 timeout;
__u32 cs_flags;
__u32 ctx_id;
+ __u8 pad[4];
};
struct hl_cs_out {
union {
@@ -510,8 +985,11 @@
};
#define HL_WAIT_CS_FLAGS_INTERRUPT 0x2
#define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000
+#define HL_WAIT_CS_FLAGS_ANY_CQ_INTERRUPT 0xFFF00000
+#define HL_WAIT_CS_FLAGS_ANY_DEC_INTERRUPT 0xFFE00000
#define HL_WAIT_CS_FLAGS_MULTI_CS 0x4
#define HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ 0x10
+#define HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT 0x20
#define HL_WAIT_MULTI_CS_LIST_MAX_LEN 32
struct hl_wait_cs_in {
union {
@@ -537,6 +1015,8 @@
__u64 interrupt_timeout_us;
};
__u64 cq_counters_offset;
+ __u64 timestamp_handle;
+ __u64 timestamp_offset;
};
#define HL_WAIT_CS_STATUS_COMPLETED 0
#define HL_WAIT_CS_STATUS_BUSY 1
@@ -561,14 +1041,17 @@
#define HL_MEM_OP_UNMAP 3
#define HL_MEM_OP_MAP_BLOCK 4
#define HL_MEM_OP_EXPORT_DMABUF_FD 5
+#define HL_MEM_OP_TS_ALLOC 6
#define HL_MEM_CONTIGUOUS 0x1
#define HL_MEM_SHARED 0x2
#define HL_MEM_USERPTR 0x4
#define HL_MEM_FORCE_HINT 0x8
+#define HL_MEM_PREFETCH 0x40
struct hl_mem_in {
union {
struct {
__u64 mem_size;
+ __u64 page_size;
} alloc;
struct {
__u64 handle;
@@ -596,7 +1079,7 @@
__u32 op;
__u32 flags;
__u32 ctx_id;
- __u32 pad;
+ __u32 num_of_elements;
};
struct hl_mem_out {
union {
@@ -641,12 +1124,18 @@
__u32 bw_win;
__u32 win_capture;
__u32 id;
- __u32 pad;
+ __u32 control;
+ __u64 start_addr2;
+ __u64 end_addr2;
+ __u64 start_addr3;
+ __u64 end_addr3;
};
struct hl_debug_params_spmu {
__u64 event_types[HL_DEBUG_MAX_AUX_VALUES];
__u32 event_types_num;
- __u32 pad;
+ __u32 pmtrc_val;
+ __u32 trc_ctrl_host_val;
+ __u32 trc_en_host_val;
};
#define HL_DEBUG_OP_ETR 0
#define HL_DEBUG_OP_ETF 1
diff --git a/libc/kernel/uapi/misc/uacce/hisi_qm.h b/libc/kernel/uapi/misc/uacce/hisi_qm.h
index 87757a9..d2509d0 100644
--- a/libc/kernel/uapi/misc/uacce/hisi_qm.h
+++ b/libc/kernel/uapi/misc/uacce/hisi_qm.h
@@ -23,8 +23,15 @@
__u16 id;
__u16 qc_type;
};
+struct hisi_qp_info {
+ __u32 sqe_size;
+ __u16 sq_depth;
+ __u16 cq_depth;
+ __u64 reserved;
+};
#define HISI_QM_API_VER_BASE "hisi_qm_v1"
#define HISI_QM_API_VER2_BASE "hisi_qm_v2"
#define HISI_QM_API_VER3_BASE "hisi_qm_v3"
#define UACCE_CMD_QM_SET_QP_CTX _IOWR('H', 10, struct hisi_qp_ctx)
+#define UACCE_CMD_QM_SET_QP_INFO _IOWR('H', 11, struct hisi_qp_info)
#endif
diff --git a/libc/kernel/uapi/mtd/mtd-abi.h b/libc/kernel/uapi/mtd/mtd-abi.h
index 50ae565..aed2acc 100644
--- a/libc/kernel/uapi/mtd/mtd-abi.h
+++ b/libc/kernel/uapi/mtd/mtd-abi.h
@@ -30,7 +30,7 @@
struct mtd_oob_buf {
__u32 start;
__u32 length;
- unsigned char __user * ptr;
+ unsigned char * ptr;
};
struct mtd_oob_buf64 {
__u64 start;
@@ -52,6 +52,21 @@
__u8 mode;
__u8 padding[7];
};
+struct mtd_read_req_ecc_stats {
+ __u32 uncorrectable_errors;
+ __u32 corrected_bitflips;
+ __u32 max_bitflips;
+};
+struct mtd_read_req {
+ __u64 start;
+ __u64 len;
+ __u64 ooblen;
+ __u64 usr_data;
+ __u64 usr_oob;
+ __u8 mode;
+ __u8 padding[7];
+ struct mtd_read_req_ecc_stats ecc_stats;
+};
#define MTD_ABSENT 0
#define MTD_RAM 1
#define MTD_ROM 2
@@ -122,6 +137,7 @@
#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
#define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
#define OTPERASE _IOW('M', 25, struct otp_info)
+#define MEMREAD _IOWR('M', 26, struct mtd_read_req)
struct nand_oobinfo {
__u32 useecc;
__u32 eccbytes;
diff --git a/libc/kernel/uapi/mtd/ubi-user.h b/libc/kernel/uapi/mtd/ubi-user.h
index 866fbd2..db203d5 100644
--- a/libc/kernel/uapi/mtd/ubi-user.h
+++ b/libc/kernel/uapi/mtd/ubi-user.h
@@ -56,7 +56,8 @@
__s32 mtd_num;
__s32 vid_hdr_offset;
__s16 max_beb_per1024;
- __s8 padding[10];
+ __s8 disable_fm;
+ __s8 padding[9];
};
enum {
UBI_VOL_SKIP_CRC_CHECK_FLG = 0x1,
@@ -71,11 +72,11 @@
__s16 name_len;
__s8 padding2[4];
char name[UBI_MAX_VOLUME_NAME + 1];
-} __packed;
+} __attribute__((__packed__));
struct ubi_rsvol_req {
__s64 bytes;
__s32 vol_id;
-} __packed;
+} __attribute__((__packed__));
struct ubi_rnvol_req {
__s32 count;
__s8 padding1[12];
@@ -85,24 +86,24 @@
__s8 padding2[2];
char name[UBI_MAX_VOLUME_NAME + 1];
} ents[UBI_MAX_RNVOL];
-} __packed;
+} __attribute__((__packed__));
struct ubi_leb_change_req {
__s32 lnum;
__s32 bytes;
__s8 dtype;
__s8 padding[7];
-} __packed;
+} __attribute__((__packed__));
struct ubi_map_req {
__s32 lnum;
__s8 dtype;
__s8 padding[3];
-} __packed;
+} __attribute__((__packed__));
struct ubi_set_vol_prop_req {
__u8 property;
__u8 padding[7];
__u64 value;
-} __packed;
+} __attribute__((__packed__));
struct ubi_blkcreate_req {
__s8 padding[128];
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/rdma/efa-abi.h b/libc/kernel/uapi/rdma/efa-abi.h
index 4b6842b..bfb3f18 100644
--- a/libc/kernel/uapi/rdma/efa-abi.h
+++ b/libc/kernel/uapi/rdma/efa-abi.h
@@ -49,6 +49,7 @@
};
enum {
EFA_CREATE_CQ_WITH_COMPLETION_CHANNEL = 1 << 0,
+ EFA_CREATE_CQ_WITH_SGID = 1 << 1,
};
struct efa_ibv_create_cq {
__u32 comp_mask;
@@ -102,6 +103,7 @@
EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1,
EFA_QUERY_DEVICE_CAPS_CQ_NOTIFICATIONS = 1 << 2,
+ EFA_QUERY_DEVICE_CAPS_CQ_WITH_SGID = 1 << 3,
};
struct efa_ibv_ex_query_device_resp {
__u32 comp_mask;
diff --git a/libc/kernel/uapi/rdma/erdma-abi.h b/libc/kernel/uapi/rdma/erdma-abi.h
new file mode 100644
index 0000000..4df1757
--- /dev/null
+++ b/libc/kernel/uapi/rdma/erdma-abi.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ERDMA_USER_H__
+#define __ERDMA_USER_H__
+#include <linux/types.h>
+#define ERDMA_ABI_VERSION 1
+struct erdma_ureq_create_cq {
+ __aligned_u64 db_record_va;
+ __aligned_u64 qbuf_va;
+ __u32 qbuf_len;
+ __u32 rsvd0;
+};
+struct erdma_uresp_create_cq {
+ __u32 cq_id;
+ __u32 num_cqe;
+};
+struct erdma_ureq_create_qp {
+ __aligned_u64 db_record_va;
+ __aligned_u64 qbuf_va;
+ __u32 qbuf_len;
+ __u32 rsvd0;
+};
+struct erdma_uresp_create_qp {
+ __u32 qp_id;
+ __u32 num_sqe;
+ __u32 num_rqe;
+ __u32 rq_offset;
+};
+struct erdma_uresp_alloc_ctx {
+ __u32 dev_id;
+ __u32 pad;
+ __u32 sdb_type;
+ __u32 sdb_offset;
+ __aligned_u64 sdb;
+ __aligned_u64 rdb;
+ __aligned_u64 cdb;
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/hfi/hfi1_user.h b/libc/kernel/uapi/rdma/hfi/hfi1_user.h
index 3352907..6d58600 100644
--- a/libc/kernel/uapi/rdma/hfi/hfi1_user.h
+++ b/libc/kernel/uapi/rdma/hfi/hfi1_user.h
@@ -80,7 +80,7 @@
struct hfi1_status {
__aligned_u64 dev;
__aligned_u64 port;
- char freezemsg[0];
+ char freezemsg[];
};
enum sdma_req_opcode {
EXPECTED = 0,
diff --git a/libc/kernel/uapi/rdma/hns-abi.h b/libc/kernel/uapi/rdma/hns-abi.h
index 9c8d028..0407571 100644
--- a/libc/kernel/uapi/rdma/hns-abi.h
+++ b/libc/kernel/uapi/rdma/hns-abi.h
@@ -60,11 +60,23 @@
__aligned_u64 cap_flags;
__aligned_u64 dwqe_mmap_key;
};
+enum {
+ HNS_ROCE_EXSGE_FLAGS = 1 << 0,
+};
+enum {
+ HNS_ROCE_RSP_EXSGE_FLAGS = 1 << 0,
+};
struct hns_roce_ib_alloc_ucontext_resp {
__u32 qp_tab_size;
__u32 cqe_size;
__u32 srq_tab_size;
__u32 reserved;
+ __u32 config;
+ __u32 max_inline_data;
+};
+struct hns_roce_ib_alloc_ucontext {
+ __u32 config;
+ __u32 reserved;
};
struct hns_roce_ib_alloc_pd_resp {
__u32 pdn;
diff --git a/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
index 3b94907..6b9a436 100644
--- a/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
@@ -37,6 +37,8 @@
IB_UVERBS_ACCESS_ZERO_BASED = 1 << 5,
IB_UVERBS_ACCESS_ON_DEMAND = 1 << 6,
IB_UVERBS_ACCESS_HUGETLB = 1 << 7,
+ IB_UVERBS_ACCESS_FLUSH_GLOBAL = 1 << 8,
+ IB_UVERBS_ACCESS_FLUSH_PERSISTENT = 1 << 9,
IB_UVERBS_ACCESS_RELAXED_ORDERING = IB_UVERBS_ACCESS_OPTIONAL_FIRST,
IB_UVERBS_ACCESS_OPTIONAL_RANGE = ((IB_UVERBS_ACCESS_OPTIONAL_LAST << 1) - 1) & ~(IB_UVERBS_ACCESS_OPTIONAL_FIRST - 1)
};
@@ -191,6 +193,8 @@
RDMA_DRIVER_QIB,
RDMA_DRIVER_EFA,
RDMA_DRIVER_SIW,
+ RDMA_DRIVER_ERDMA,
+ RDMA_DRIVER_MANA,
};
enum ib_uverbs_gid_type {
IB_UVERBS_GID_TYPE_IB,
diff --git a/libc/kernel/uapi/rdma/ib_user_verbs.h b/libc/kernel/uapi/rdma/ib_user_verbs.h
index d9ac9e0..6894bf1 100644
--- a/libc/kernel/uapi/rdma/ib_user_verbs.h
+++ b/libc/kernel/uapi/rdma/ib_user_verbs.h
@@ -78,6 +78,14 @@
IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL,
IB_USER_VERBS_EX_CMD_MODIFY_CQ
};
+enum ib_placement_type {
+ IB_FLUSH_GLOBAL = 1U << 0,
+ IB_FLUSH_PERSISTENT = 1U << 1,
+};
+enum ib_selectivity_level {
+ IB_FLUSH_RANGE = 0,
+ IB_FLUSH_MR,
+};
struct ib_uverbs_async_event_desc {
__aligned_u64 element;
__u32 event_type;
@@ -106,16 +114,16 @@
};
struct ib_uverbs_get_context {
__aligned_u64 response;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_get_context_resp {
__u32 async_fd;
__u32 num_comp_vectors;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_query_device {
__aligned_u64 response;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_query_device_resp {
__aligned_u64 fw_ver;
@@ -208,7 +216,7 @@
__aligned_u64 response;
__u8 port_num;
__u8 reserved[7];
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_query_port_resp {
__u32 port_cap_flags;
@@ -236,11 +244,11 @@
};
struct ib_uverbs_alloc_pd {
__aligned_u64 response;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_alloc_pd_resp {
__u32 pd_handle;
- __u32 driver_data[0];
+ __u32 driver_data[];
};
struct ib_uverbs_dealloc_pd {
__u32 pd_handle;
@@ -249,11 +257,11 @@
__aligned_u64 response;
__u32 fd;
__u32 oflags;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_open_xrcd_resp {
__u32 xrcd_handle;
- __u32 driver_data[0];
+ __u32 driver_data[];
};
struct ib_uverbs_close_xrcd {
__u32 xrcd_handle;
@@ -265,13 +273,13 @@
__aligned_u64 hca_va;
__u32 pd_handle;
__u32 access_flags;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_reg_mr_resp {
__u32 mr_handle;
__u32 lkey;
__u32 rkey;
- __u32 driver_data[0];
+ __u32 driver_data[];
};
struct ib_uverbs_rereg_mr {
__aligned_u64 response;
@@ -282,12 +290,12 @@
__aligned_u64 hca_va;
__u32 pd_handle;
__u32 access_flags;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_rereg_mr_resp {
__u32 lkey;
__u32 rkey;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_dereg_mr {
__u32 mr_handle;
@@ -297,12 +305,12 @@
__u32 pd_handle;
__u8 mw_type;
__u8 reserved[3];
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_alloc_mw_resp {
__u32 mw_handle;
__u32 rkey;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_dealloc_mw {
__u32 mw_handle;
@@ -320,7 +328,7 @@
__u32 comp_vector;
__s32 comp_channel;
__u32 reserved;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
enum ib_uverbs_ex_create_cq_flags {
IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0,
@@ -349,12 +357,12 @@
__aligned_u64 response;
__u32 cq_handle;
__u32 cqe;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_resize_cq_resp {
__u32 cqe;
__u32 reserved;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_poll_cq {
__aligned_u64 response;
@@ -370,6 +378,8 @@
IB_UVERBS_WC_BIND_MW = 5,
IB_UVERBS_WC_LOCAL_INV = 6,
IB_UVERBS_WC_TSO = 7,
+ IB_UVERBS_WC_FLUSH = 8,
+ IB_UVERBS_WC_ATOMIC_WRITE = 9,
};
struct ib_uverbs_wc {
__aligned_u64 wr_id;
@@ -394,7 +404,7 @@
struct ib_uverbs_poll_cq_resp {
__u32 count;
__u32 reserved;
- struct ib_uverbs_wc wc[0];
+ struct ib_uverbs_wc wc[];
};
struct ib_uverbs_req_notify_cq {
__u32 cq_handle;
@@ -476,7 +486,7 @@
__u8 qp_type;
__u8 is_srq;
__u8 reserved;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
enum ib_uverbs_create_qp_mask {
IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
@@ -511,7 +521,7 @@
__u32 qpn;
__u8 qp_type;
__u8 reserved[7];
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_create_qp_resp {
__u32 qp_handle;
@@ -547,7 +557,7 @@
__aligned_u64 response;
__u32 qp_handle;
__u32 attr_mask;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_query_qp_resp {
struct ib_uverbs_qp_dest dest;
@@ -580,7 +590,7 @@
__u8 alt_timeout;
__u8 sq_sig_all;
__u8 reserved[5];
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_modify_qp {
struct ib_uverbs_qp_dest dest;
@@ -648,6 +658,8 @@
IB_UVERBS_WR_RDMA_READ_WITH_INV = 11,
IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12,
IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13,
+ IB_UVERBS_WR_FLUSH = 14,
+ IB_UVERBS_WR_ATOMIC_WRITE = 15,
};
struct ib_uverbs_send_wr {
__aligned_u64 wr_id;
@@ -685,7 +697,7 @@
__u32 wr_count;
__u32 sge_count;
__u32 wqe_size;
- struct ib_uverbs_send_wr send_wr[0];
+ struct ib_uverbs_send_wr send_wr[];
};
struct ib_uverbs_post_send_resp {
__u32 bad_wr;
@@ -701,7 +713,7 @@
__u32 wr_count;
__u32 sge_count;
__u32 wqe_size;
- struct ib_uverbs_recv_wr recv_wr[0];
+ struct ib_uverbs_recv_wr recv_wr[];
};
struct ib_uverbs_post_recv_resp {
__u32 bad_wr;
@@ -712,7 +724,7 @@
__u32 wr_count;
__u32 sge_count;
__u32 wqe_size;
- struct ib_uverbs_recv_wr recv[0];
+ struct ib_uverbs_recv_wr recv[];
};
struct ib_uverbs_post_srq_recv_resp {
__u32 bad_wr;
@@ -723,11 +735,11 @@
__u32 pd_handle;
__u32 reserved;
struct ib_uverbs_ah_attr attr;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_create_ah_resp {
__u32 ah_handle;
- __u32 driver_data[0];
+ __u32 driver_data[];
};
struct ib_uverbs_destroy_ah {
__u32 ah_handle;
@@ -737,14 +749,14 @@
__u32 qp_handle;
__u16 mlid;
__u16 reserved;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_detach_mcast {
__u8 gid[16];
__u32 qp_handle;
__u16 mlid;
__u16 reserved;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_flow_spec_hdr {
__u32 type;
@@ -944,7 +956,7 @@
__u8 reserved[2];
__u8 port;
__u32 flags;
- struct ib_uverbs_flow_spec_hdr flow_specs[0];
+ struct ib_uverbs_flow_spec_hdr flow_specs[];
};
struct ib_uverbs_create_flow {
__u32 comp_mask;
@@ -966,7 +978,7 @@
__u32 max_wr;
__u32 max_sge;
__u32 srq_limit;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_create_xsrq {
__aligned_u64 response;
@@ -979,27 +991,27 @@
__u32 max_num_tags;
__u32 xrcd_handle;
__u32 cq_handle;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_create_srq_resp {
__u32 srq_handle;
__u32 max_wr;
__u32 max_sge;
__u32 srqn;
- __u32 driver_data[0];
+ __u32 driver_data[];
};
struct ib_uverbs_modify_srq {
__u32 srq_handle;
__u32 attr_mask;
__u32 max_wr;
__u32 srq_limit;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_query_srq {
__aligned_u64 response;
__u32 srq_handle;
__u32 reserved;
- __aligned_u64 driver_data[0];
+ __aligned_u64 driver_data[];
};
struct ib_uverbs_query_srq_resp {
__u32 max_wr;
@@ -1056,7 +1068,7 @@
struct ib_uverbs_ex_create_rwq_ind_table {
__u32 comp_mask;
__u32 log_ind_tbl_size;
- __u32 wq_handles[0];
+ __u32 wq_handles[];
};
struct ib_uverbs_ex_create_rwq_ind_table_resp {
__u32 comp_mask;
@@ -1079,4 +1091,40 @@
__u32 reserved;
};
#define IB_DEVICE_NAME_MAX 64
+enum ib_uverbs_device_cap_flags {
+ IB_UVERBS_DEVICE_RESIZE_MAX_WR = 1 << 0,
+ IB_UVERBS_DEVICE_BAD_PKEY_CNTR = 1 << 1,
+ IB_UVERBS_DEVICE_BAD_QKEY_CNTR = 1 << 2,
+ IB_UVERBS_DEVICE_RAW_MULTI = 1 << 3,
+ IB_UVERBS_DEVICE_AUTO_PATH_MIG = 1 << 4,
+ IB_UVERBS_DEVICE_CHANGE_PHY_PORT = 1 << 5,
+ IB_UVERBS_DEVICE_UD_AV_PORT_ENFORCE = 1 << 6,
+ IB_UVERBS_DEVICE_CURR_QP_STATE_MOD = 1 << 7,
+ IB_UVERBS_DEVICE_SHUTDOWN_PORT = 1 << 8,
+ IB_UVERBS_DEVICE_PORT_ACTIVE_EVENT = 1 << 10,
+ IB_UVERBS_DEVICE_SYS_IMAGE_GUID = 1 << 11,
+ IB_UVERBS_DEVICE_RC_RNR_NAK_GEN = 1 << 12,
+ IB_UVERBS_DEVICE_SRQ_RESIZE = 1 << 13,
+ IB_UVERBS_DEVICE_N_NOTIFY_CQ = 1 << 14,
+ IB_UVERBS_DEVICE_MEM_WINDOW = 1 << 17,
+ IB_UVERBS_DEVICE_UD_IP_CSUM = 1 << 18,
+ IB_UVERBS_DEVICE_XRC = 1 << 20,
+ IB_UVERBS_DEVICE_MEM_MGT_EXTENSIONS = 1 << 21,
+ IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2A = 1 << 23,
+ IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2B = 1 << 24,
+ IB_UVERBS_DEVICE_RC_IP_CSUM = 1 << 25,
+ IB_UVERBS_DEVICE_RAW_IP_CSUM = 1 << 26,
+ IB_UVERBS_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
+ IB_UVERBS_DEVICE_RAW_SCATTER_FCS = 1ULL << 34,
+ IB_UVERBS_DEVICE_PCI_WRITE_END_PADDING = 1ULL << 36,
+ IB_UVERBS_DEVICE_FLUSH_GLOBAL = 1ULL << 38,
+ IB_UVERBS_DEVICE_FLUSH_PERSISTENT = 1ULL << 39,
+ IB_UVERBS_DEVICE_ATOMIC_WRITE = 1ULL << 40,
+};
+enum ib_uverbs_raw_packet_caps {
+ IB_UVERBS_RAW_PACKET_CAP_CVLAN_STRIPPING = 1 << 0,
+ IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS = 1 << 1,
+ IB_UVERBS_RAW_PACKET_CAP_IP_CSUM = 1 << 2,
+ IB_UVERBS_RAW_PACKET_CAP_DELAY_DROP = 1 << 3,
+};
#endif
diff --git a/libc/kernel/uapi/rdma/mana-abi.h b/libc/kernel/uapi/rdma/mana-abi.h
new file mode 100644
index 0000000..4f1a73f
--- /dev/null
+++ b/libc/kernel/uapi/rdma/mana-abi.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef MANA_ABI_USER_H
+#define MANA_ABI_USER_H
+#include <linux/types.h>
+#include <rdma/ib_user_ioctl_verbs.h>
+#define MANA_IB_UVERBS_ABI_VERSION 1
+struct mana_ib_create_cq {
+ __aligned_u64 buf_addr;
+};
+struct mana_ib_create_qp {
+ __aligned_u64 sq_buf_addr;
+ __u32 sq_buf_size;
+ __u32 port;
+};
+struct mana_ib_create_qp_resp {
+ __u32 sqid;
+ __u32 cqid;
+ __u32 tx_vp_offset;
+ __u32 reserved;
+};
+struct mana_ib_create_wq {
+ __aligned_u64 wq_buf_addr;
+ __u32 wq_buf_size;
+ __u32 reserved;
+};
+enum mana_ib_rx_hash_function_flags {
+ MANA_IB_RX_HASH_FUNC_TOEPLITZ = 1 << 0,
+};
+struct mana_ib_create_qp_rss {
+ __aligned_u64 rx_hash_fields_mask;
+ __u8 rx_hash_function;
+ __u8 reserved[7];
+ __u32 rx_hash_key_len;
+ __u8 rx_hash_key[40];
+ __u32 port;
+};
+struct rss_resp_entry {
+ __u32 cqid;
+ __u32 wqid;
+};
+struct mana_ib_create_qp_rss_resp {
+ __aligned_u64 num_entries;
+ struct rss_resp_entry entries[64];
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/mlx5-abi.h b/libc/kernel/uapi/rdma/mlx5-abi.h
index aadb20e..f41c887 100644
--- a/libc/kernel/uapi/rdma/mlx5-abi.h
+++ b/libc/kernel/uapi/rdma/mlx5-abi.h
@@ -70,6 +70,7 @@
MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE = 1UL << 2,
MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS = 1UL << 3,
MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_REAL_TIME_TS = 1UL << 4,
+ MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG = 1UL << 5,
};
enum mlx5_user_cmds_supp_uhw {
MLX5_USER_CMDS_SUPP_UHW_QUERY_DEVICE = 1 << 0,
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
index 862abcb..c060482 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
@@ -135,6 +135,7 @@
MLX5_IB_ATTR_DEVX_UMEM_REG_ACCESS,
MLX5_IB_ATTR_DEVX_UMEM_REG_OUT_ID,
MLX5_IB_ATTR_DEVX_UMEM_REG_PGSZ_BITMAP,
+ MLX5_IB_ATTR_DEVX_UMEM_REG_DMABUF_FD,
};
enum mlx5_ib_devx_umem_dereg_attrs {
MLX5_IB_ATTR_DEVX_UMEM_DEREG_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
@@ -179,6 +180,7 @@
MLX5_IB_OBJECT_VAR,
MLX5_IB_OBJECT_PP,
MLX5_IB_OBJECT_UAR,
+ MLX5_IB_OBJECT_STEERING_ANCHOR,
};
enum mlx5_ib_flow_matcher_create_attrs {
MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
@@ -195,6 +197,19 @@
MLX5_IB_METHOD_FLOW_MATCHER_CREATE = (1U << UVERBS_ID_NS_SHIFT),
MLX5_IB_METHOD_FLOW_MATCHER_DESTROY,
};
+enum mlx5_ib_flow_steering_anchor_create_attrs {
+ MLX5_IB_ATTR_STEERING_ANCHOR_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+ MLX5_IB_ATTR_STEERING_ANCHOR_FT_TYPE,
+ MLX5_IB_ATTR_STEERING_ANCHOR_PRIORITY,
+ MLX5_IB_ATTR_STEERING_ANCHOR_FT_ID,
+};
+enum mlx5_ib_flow_steering_anchor_destroy_attrs {
+ MLX5_IB_ATTR_STEERING_ANCHOR_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+};
+enum mlx5_ib_steering_anchor_methods {
+ MLX5_IB_METHOD_STEERING_ANCHOR_CREATE = (1U << UVERBS_ID_NS_SHIFT),
+ MLX5_IB_METHOD_STEERING_ANCHOR_DESTROY,
+};
enum mlx5_ib_device_query_context_attrs {
MLX5_IB_ATTR_QUERY_CONTEXT_RESP_UCTX = (1U << UVERBS_ID_NS_SHIFT),
};
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
index c3c3f89..f68c0b3 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
@@ -43,6 +43,7 @@
MLX5_IB_UAPI_DM_TYPE_MEMIC,
MLX5_IB_UAPI_DM_TYPE_STEERING_SW_ICM,
MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM,
+ MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_PATTERN_SW_ICM,
};
enum mlx5_ib_uapi_devx_create_event_channel_flags {
MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0,
diff --git a/libc/kernel/uapi/rdma/rdma_user_cm.h b/libc/kernel/uapi/rdma/rdma_user_cm.h
index 7b1f7ee..37927f8 100644
--- a/libc/kernel/uapi/rdma/rdma_user_cm.h
+++ b/libc/kernel/uapi/rdma/rdma_user_cm.h
@@ -145,7 +145,7 @@
struct rdma_ucm_query_path_resp {
__u32 num_paths;
__u32 reserved;
- struct ib_path_rec_data path_data[0];
+ struct ib_path_rec_data path_data[];
};
struct rdma_ucm_conn_param {
__u32 qp_num;
diff --git a/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
index 22adfaa..dbaf9ed 100644
--- a/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
@@ -50,6 +50,6 @@
__aligned_u64 reserved1;
__u32 driver_id;
__u32 reserved2;
- struct ib_uverbs_attr attrs[0];
+ struct ib_uverbs_attr attrs[];
};
#endif
diff --git a/libc/kernel/uapi/rdma/rdma_user_rxe.h b/libc/kernel/uapi/rdma/rdma_user_rxe.h
index cdb00c7..e7619d8 100644
--- a/libc/kernel/uapi/rdma/rdma_user_rxe.h
+++ b/libc/kernel/uapi/rdma/rdma_user_rxe.h
@@ -52,7 +52,7 @@
};
struct rxe_send_wr {
__aligned_u64 wr_id;
- __u32 num_sge;
+ __u32 reserved;
__u32 opcode;
__u32 send_flags;
union {
@@ -62,6 +62,13 @@
union {
struct {
__aligned_u64 remote_addr;
+ __u32 length;
+ __u32 rkey;
+ __u8 type;
+ __u8 level;
+ } flush;
+ struct {
+ __aligned_u64 remote_addr;
__u32 rkey;
__u32 reserved;
} rdma;
@@ -110,6 +117,7 @@
__u32 reserved;
union {
__DECLARE_FLEX_ARRAY(__u8, inline_data);
+ __DECLARE_FLEX_ARRAY(__u8, atomic_wr);
__DECLARE_FLEX_ARRAY(struct rxe_sge, sge);
};
};
@@ -128,7 +136,7 @@
};
struct rxe_recv_wqe {
__aligned_u64 wr_id;
- __u32 num_sge;
+ __u32 reserved;
__u32 padding;
struct rxe_dma_info dma;
};
diff --git a/libc/kernel/uapi/scsi/fc/fc_els.h b/libc/kernel/uapi/scsi/fc/fc_els.h
index 04ae5b8..d29287d 100644
--- a/libc/kernel/uapi/scsi/fc/fc_els.h
+++ b/libc/kernel/uapi/scsi/fc/fc_els.h
@@ -142,7 +142,7 @@
struct fc_tlv_desc {
__be32 desc_tag;
__be32 desc_len;
- __u8 desc_value[0];
+ __u8 desc_value[];
};
#define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc)
#define FC_TLV_DESC_LENGTH_FROM_SZ(desc) (sizeof(desc) - FC_TLV_DESC_HDR_SZ)
@@ -618,7 +618,7 @@
__be32 event_threshold;
__be32 event_count;
__be32 pname_count;
- __be64 pname_list[0];
+ __be64 pname_list[];
};
struct fc_fn_deli_desc {
__be32 desc_tag;
@@ -636,7 +636,7 @@
__be16 event_modifier;
__be32 event_period;
__be32 pname_count;
- __be64 pname_list[0];
+ __be64 pname_list[];
};
struct fc_fn_congn_desc {
__be32 desc_tag;
@@ -651,25 +651,25 @@
__u8 fpin_cmd;
__u8 fpin_zero[3];
__be32 desc_len;
- struct fc_tlv_desc fpin_desc[0];
+ struct fc_tlv_desc fpin_desc[];
};
struct fc_df_desc_fpin_reg {
__be32 desc_tag;
__be32 desc_len;
__be32 count;
- __be32 desc_tags[0];
+ __be32 desc_tags[];
};
struct fc_els_rdf {
__u8 fpin_cmd;
__u8 fpin_zero[3];
__be32 desc_len;
- struct fc_tlv_desc desc[0];
+ struct fc_tlv_desc desc[];
};
struct fc_els_rdf_resp {
struct fc_els_ls_acc acc_hdr;
__be32 desc_list_len;
struct fc_els_lsri_desc lsri;
- struct fc_tlv_desc desc[0];
+ struct fc_tlv_desc desc[];
};
struct fc_diag_lnkflt_desc {
__be32 desc_tag;
@@ -707,12 +707,12 @@
__u8 edc_cmd;
__u8 edc_zero[3];
__be32 desc_len;
- struct fc_tlv_desc desc[0];
+ struct fc_tlv_desc desc[];
};
struct fc_els_edc_resp {
struct fc_els_ls_acc acc_hdr;
__be32 desc_list_len;
struct fc_els_lsri_desc lsri;
- struct fc_tlv_desc desc[0];
+ struct fc_tlv_desc desc[];
};
#endif
diff --git a/libc/kernel/uapi/scsi/scsi_bsg_fc.h b/libc/kernel/uapi/scsi/scsi_bsg_fc.h
index 8966f61..2647249 100644
--- a/libc/kernel/uapi/scsi/scsi_bsg_fc.h
+++ b/libc/kernel/uapi/scsi/scsi_bsg_fc.h
@@ -66,7 +66,7 @@
};
struct fc_bsg_host_vendor {
__u64 vendor_id;
- __u32 vendor_cmd[0];
+ __u32 vendor_cmd[];
};
struct fc_bsg_host_vendor_reply {
__u32 vendor_rsp[0];
diff --git a/libc/kernel/uapi/scsi/scsi_bsg_mpi3mr.h b/libc/kernel/uapi/scsi/scsi_bsg_mpi3mr.h
new file mode 100644
index 0000000..fcba8cd
--- /dev/null
+++ b/libc/kernel/uapi/scsi/scsi_bsg_mpi3mr.h
@@ -0,0 +1,333 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef SCSI_BSG_MPI3MR_H_INCLUDED
+#define SCSI_BSG_MPI3MR_H_INCLUDED
+#include <linux/types.h>
+#define MPI3MR_IOCTL_VERSION 0x06
+#define MPI3MR_APP_DEFAULT_TIMEOUT (60)
+#define MPI3MR_BSG_ADPTYPE_UNKNOWN 0
+#define MPI3MR_BSG_ADPTYPE_AVGFAMILY 1
+#define MPI3MR_BSG_ADPSTATE_UNKNOWN 0
+#define MPI3MR_BSG_ADPSTATE_OPERATIONAL 1
+#define MPI3MR_BSG_ADPSTATE_FAULT 2
+#define MPI3MR_BSG_ADPSTATE_IN_RESET 3
+#define MPI3MR_BSG_ADPSTATE_UNRECOVERABLE 4
+#define MPI3MR_BSG_ADPRESET_UNKNOWN 0
+#define MPI3MR_BSG_ADPRESET_SOFT 1
+#define MPI3MR_BSG_ADPRESET_DIAG_FAULT 2
+#define MPI3MR_BSG_LOGDATA_MAX_ENTRIES 400
+#define MPI3MR_BSG_LOGDATA_ENTRY_HEADER_SZ 4
+#define MPI3MR_DRVBSG_OPCODE_UNKNOWN 0
+#define MPI3MR_DRVBSG_OPCODE_ADPINFO 1
+#define MPI3MR_DRVBSG_OPCODE_ADPRESET 2
+#define MPI3MR_DRVBSG_OPCODE_ALLTGTDEVINFO 4
+#define MPI3MR_DRVBSG_OPCODE_GETCHGCNT 5
+#define MPI3MR_DRVBSG_OPCODE_LOGDATAENABLE 6
+#define MPI3MR_DRVBSG_OPCODE_PELENABLE 7
+#define MPI3MR_DRVBSG_OPCODE_GETLOGDATA 8
+#define MPI3MR_DRVBSG_OPCODE_QUERY_HDB 9
+#define MPI3MR_DRVBSG_OPCODE_REPOST_HDB 10
+#define MPI3MR_DRVBSG_OPCODE_UPLOAD_HDB 11
+#define MPI3MR_DRVBSG_OPCODE_REFRESH_HDB_TRIGGERS 12
+#define MPI3MR_BSG_BUFTYPE_UNKNOWN 0
+#define MPI3MR_BSG_BUFTYPE_RAIDMGMT_CMD 1
+#define MPI3MR_BSG_BUFTYPE_RAIDMGMT_RESP 2
+#define MPI3MR_BSG_BUFTYPE_DATA_IN 3
+#define MPI3MR_BSG_BUFTYPE_DATA_OUT 4
+#define MPI3MR_BSG_BUFTYPE_MPI_REPLY 5
+#define MPI3MR_BSG_BUFTYPE_ERR_RESPONSE 6
+#define MPI3MR_BSG_BUFTYPE_MPI_REQUEST 0xFE
+#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_UNKNOWN 0
+#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_STATUS 1
+#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_ADDRESS 2
+#define MPI3MR_HDB_BUFTYPE_UNKNOWN 0
+#define MPI3MR_HDB_BUFTYPE_TRACE 1
+#define MPI3MR_HDB_BUFTYPE_FIRMWARE 2
+#define MPI3MR_HDB_BUFTYPE_RESERVED 3
+#define MPI3MR_HDB_BUFSTATUS_UNKNOWN 0
+#define MPI3MR_HDB_BUFSTATUS_NOT_ALLOCATED 1
+#define MPI3MR_HDB_BUFSTATUS_POSTED_UNPAUSED 2
+#define MPI3MR_HDB_BUFSTATUS_POSTED_PAUSED 3
+#define MPI3MR_HDB_BUFSTATUS_RELEASED 4
+#define MPI3MR_HDB_TRIGGER_TYPE_UNKNOWN 0
+#define MPI3MR_HDB_TRIGGER_TYPE_DIAGFAULT 1
+#define MPI3MR_HDB_TRIGGER_TYPE_ELEMENT 2
+#define MPI3MR_HDB_TRIGGER_TYPE_MASTER 3
+enum command {
+ MPI3MR_DRV_CMD = 1,
+ MPI3MR_MPT_CMD = 2,
+};
+struct mpi3_driver_info_layout {
+ __le32 information_length;
+ __u8 driver_signature[12];
+ __u8 os_name[16];
+ __u8 os_version[12];
+ __u8 driver_name[20];
+ __u8 driver_version[32];
+ __u8 driver_release_date[20];
+ __le32 driver_capabilities;
+};
+struct mpi3mr_bsg_in_adpinfo {
+ __u32 adp_type;
+ __u32 rsvd1;
+ __u32 pci_dev_id;
+ __u32 pci_dev_hw_rev;
+ __u32 pci_subsys_dev_id;
+ __u32 pci_subsys_ven_id;
+ __u32 pci_dev : 5;
+ __u32 pci_func : 3;
+ __u32 pci_bus : 8;
+ __u16 rsvd2;
+ __u32 pci_seg_id;
+ __u32 app_intfc_ver;
+ __u8 adp_state;
+ __u8 rsvd3;
+ __u16 rsvd4;
+ __u32 rsvd5[2];
+ struct mpi3_driver_info_layout driver_info;
+};
+struct mpi3mr_bsg_adp_reset {
+ __u8 reset_type;
+ __u8 rsvd1;
+ __u16 rsvd2;
+};
+struct mpi3mr_change_count {
+ __u16 change_count;
+ __u16 rsvd;
+};
+struct mpi3mr_device_map_info {
+ __u16 handle;
+ __u16 perst_id;
+ __u32 target_id;
+ __u8 bus_id;
+ __u8 rsvd1;
+ __u16 rsvd2;
+};
+struct mpi3mr_all_tgt_info {
+ __u16 num_devices;
+ __u16 rsvd1;
+ __u32 rsvd2;
+ struct mpi3mr_device_map_info dmi[1];
+};
+struct mpi3mr_logdata_enable {
+ __u16 max_entries;
+ __u16 rsvd;
+};
+struct mpi3mr_bsg_out_pel_enable {
+ __u16 pel_locale;
+ __u8 pel_class;
+ __u8 rsvd;
+};
+struct mpi3mr_logdata_entry {
+ __u8 valid_entry;
+ __u8 rsvd1;
+ __u16 rsvd2;
+ __u8 data[1];
+};
+struct mpi3mr_bsg_in_log_data {
+ struct mpi3mr_logdata_entry entry[1];
+};
+struct mpi3mr_hdb_entry {
+ __u8 buf_type;
+ __u8 status;
+ __u8 trigger_type;
+ __u8 rsvd1;
+ __u16 size;
+ __u16 rsvd2;
+ __u64 trigger_data;
+ __u32 rsvd3;
+ __u32 rsvd4;
+};
+struct mpi3mr_bsg_in_hdb_status {
+ __u8 num_hdb_types;
+ __u8 rsvd1;
+ __u16 rsvd2;
+ __u32 rsvd3;
+ struct mpi3mr_hdb_entry entry[1];
+};
+struct mpi3mr_bsg_out_repost_hdb {
+ __u8 buf_type;
+ __u8 rsvd1;
+ __u16 rsvd2;
+};
+struct mpi3mr_bsg_out_upload_hdb {
+ __u8 buf_type;
+ __u8 rsvd1;
+ __u16 rsvd2;
+ __u32 start_offset;
+ __u32 length;
+};
+struct mpi3mr_bsg_out_refresh_hdb_triggers {
+ __u8 page_type;
+ __u8 rsvd1;
+ __u16 rsvd2;
+};
+struct mpi3mr_bsg_drv_cmd {
+ __u8 mrioc_id;
+ __u8 opcode;
+ __u16 rsvd1;
+ __u32 rsvd2[4];
+};
+struct mpi3mr_bsg_in_reply_buf {
+ __u8 mpi_reply_type;
+ __u8 rsvd1;
+ __u16 rsvd2;
+ __u8 reply_buf[1];
+};
+struct mpi3mr_buf_entry {
+ __u8 buf_type;
+ __u8 rsvd1;
+ __u16 rsvd2;
+ __u32 buf_len;
+};
+struct mpi3mr_buf_entry_list {
+ __u8 num_of_entries;
+ __u8 rsvd1;
+ __u16 rsvd2;
+ __u32 rsvd3;
+ struct mpi3mr_buf_entry buf_entry[1];
+};
+struct mpi3mr_bsg_mptcmd {
+ __u8 mrioc_id;
+ __u8 rsvd1;
+ __u16 timeout;
+ __u32 rsvd2;
+ struct mpi3mr_buf_entry_list buf_entry_list;
+};
+struct mpi3mr_bsg_packet {
+ __u8 cmd_type;
+ __u8 rsvd1;
+ __u16 rsvd2;
+ __u32 rsvd3;
+ union {
+ struct mpi3mr_bsg_drv_cmd drvrcmd;
+ struct mpi3mr_bsg_mptcmd mptcmd;
+ } cmd;
+};
+#ifndef MPI3_NVME_ENCAP_CMD_MAX
+#define MPI3_NVME_ENCAP_CMD_MAX (1)
+#endif
+struct mpi3_nvme_encapsulated_request {
+ __le16 host_tag;
+ __u8 ioc_use_only02;
+ __u8 function;
+ __le16 ioc_use_only04;
+ __u8 ioc_use_only06;
+ __u8 msg_flags;
+ __le16 change_count;
+ __le16 dev_handle;
+ __le16 encapsulated_command_length;
+ __le16 flags;
+ __le32 data_length;
+ __le32 reserved14[3];
+ __le32 command[MPI3_NVME_ENCAP_CMD_MAX];
+};
+struct mpi3_nvme_encapsulated_error_reply {
+ __le16 host_tag;
+ __u8 ioc_use_only02;
+ __u8 function;
+ __le16 ioc_use_only04;
+ __u8 ioc_use_only06;
+ __u8 msg_flags;
+ __le16 ioc_use_only08;
+ __le16 ioc_status;
+ __le32 ioc_log_info;
+ __le32 nvme_completion_entry[4];
+};
+#define MPI3MR_NVME_PRP_SIZE 8
+#define MPI3MR_NVME_CMD_PRP1_OFFSET 24
+#define MPI3MR_NVME_CMD_PRP2_OFFSET 32
+#define MPI3MR_NVME_CMD_SGL_OFFSET 24
+#define MPI3MR_NVME_DATA_FORMAT_PRP 0
+#define MPI3MR_NVME_DATA_FORMAT_SGL1 1
+#define MPI3MR_NVME_DATA_FORMAT_SGL2 2
+struct mpi3_scsi_task_mgmt_request {
+ __le16 host_tag;
+ __u8 ioc_use_only02;
+ __u8 function;
+ __le16 ioc_use_only04;
+ __u8 ioc_use_only06;
+ __u8 msg_flags;
+ __le16 change_count;
+ __le16 dev_handle;
+ __le16 task_host_tag;
+ __u8 task_type;
+ __u8 reserved0f;
+ __le16 task_request_queue_id;
+ __le16 reserved12;
+ __le32 reserved14;
+ __u8 lun[8];
+};
+#define MPI3_SCSITASKMGMT_MSGFLAGS_DO_NOT_SEND_TASK_IU (0x08)
+#define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK (0x01)
+#define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK_SET (0x02)
+#define MPI3_SCSITASKMGMT_TASKTYPE_TARGET_RESET (0x03)
+#define MPI3_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05)
+#define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET (0x06)
+#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK (0x07)
+#define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_ACA (0x08)
+#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK_SET (0x09)
+#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_ASYNC_EVENT (0x0a)
+#define MPI3_SCSITASKMGMT_TASKTYPE_I_T_NEXUS_RESET (0x0b)
+struct mpi3_scsi_task_mgmt_reply {
+ __le16 host_tag;
+ __u8 ioc_use_only02;
+ __u8 function;
+ __le16 ioc_use_only04;
+ __u8 ioc_use_only06;
+ __u8 msg_flags;
+ __le16 ioc_use_only08;
+ __le16 ioc_status;
+ __le32 ioc_log_info;
+ __le32 termination_count;
+ __le32 response_data;
+ __le32 reserved18;
+};
+#define MPI3_SCSITASKMGMT_RSPCODE_TM_COMPLETE (0x00)
+#define MPI3_SCSITASKMGMT_RSPCODE_INVALID_FRAME (0x02)
+#define MPI3_SCSITASKMGMT_RSPCODE_TM_FUNCTION_NOT_SUPPORTED (0x04)
+#define MPI3_SCSITASKMGMT_RSPCODE_TM_FAILED (0x05)
+#define MPI3_SCSITASKMGMT_RSPCODE_TM_SUCCEEDED (0x08)
+#define MPI3_SCSITASKMGMT_RSPCODE_TM_INVALID_LUN (0x09)
+#define MPI3_SCSITASKMGMT_RSPCODE_TM_OVERLAPPED_TAG (0x0a)
+#define MPI3_SCSITASKMGMT_RSPCODE_IO_QUEUED_ON_IOC (0x80)
+#define MPI3_SCSITASKMGMT_RSPCODE_TM_NVME_DENIED (0x81)
+#define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT (0x0200)
+#define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT (0x0100)
+#define MPI3_PEL_LOCALE_FLAGS_PCIE (0x0080)
+#define MPI3_PEL_LOCALE_FLAGS_CONFIGURATION (0x0040)
+#define MPI3_PEL_LOCALE_FLAGS_CONTROLER (0x0020)
+#define MPI3_PEL_LOCALE_FLAGS_SAS (0x0010)
+#define MPI3_PEL_LOCALE_FLAGS_EPACK (0x0008)
+#define MPI3_PEL_LOCALE_FLAGS_ENCLOSURE (0x0004)
+#define MPI3_PEL_LOCALE_FLAGS_PD (0x0002)
+#define MPI3_PEL_LOCALE_FLAGS_VD (0x0001)
+#define MPI3_PEL_CLASS_DEBUG (0x00)
+#define MPI3_PEL_CLASS_PROGRESS (0x01)
+#define MPI3_PEL_CLASS_INFORMATIONAL (0x02)
+#define MPI3_PEL_CLASS_WARNING (0x03)
+#define MPI3_PEL_CLASS_CRITICAL (0x04)
+#define MPI3_PEL_CLASS_FATAL (0x05)
+#define MPI3_PEL_CLASS_FAULT (0x06)
+#define MPI3_BSG_FUNCTION_MGMT_PASSTHROUGH (0x0a)
+#define MPI3_BSG_FUNCTION_SCSI_IO (0x20)
+#define MPI3_BSG_FUNCTION_SCSI_TASK_MGMT (0x21)
+#define MPI3_BSG_FUNCTION_SMP_PASSTHROUGH (0x22)
+#define MPI3_BSG_FUNCTION_NVME_ENCAPSULATED (0x24)
+#endif
diff --git a/libc/kernel/uapi/scsi/scsi_netlink_fc.h b/libc/kernel/uapi/scsi/scsi_netlink_fc.h
index ff92877..6eeb866 100644
--- a/libc/kernel/uapi/scsi/scsi_netlink_fc.h
+++ b/libc/kernel/uapi/scsi/scsi_netlink_fc.h
@@ -30,6 +30,9 @@
__u16 event_datalen;
__u32 event_num;
__u32 event_code;
- __u32 event_data;
+ union {
+ __u32 event_data;
+ __DECLARE_FLEX_ARRAY(__u8, event_data_flex);
+ };
} __attribute__((aligned(sizeof(__u64))));
#endif
diff --git a/libc/kernel/uapi/sound/asequencer.h b/libc/kernel/uapi/sound/asequencer.h
index ac72736..01a5058 100644
--- a/libc/kernel/uapi/sound/asequencer.h
+++ b/libc/kernel/uapi/sound/asequencer.h
@@ -209,13 +209,13 @@
#define SNDRV_SEQ_CLIENT_DUMMY 14
#define SNDRV_SEQ_CLIENT_OSS 15
typedef int __bitwise snd_seq_client_type_t;
-#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
-#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
-#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
-#define SNDRV_SEQ_FILTER_BROADCAST (1 << 0)
-#define SNDRV_SEQ_FILTER_MULTICAST (1 << 1)
-#define SNDRV_SEQ_FILTER_BOUNCE (1 << 2)
-#define SNDRV_SEQ_FILTER_USE_EVENT (1 << 31)
+#define NO_CLIENT (( snd_seq_client_type_t) 0)
+#define USER_CLIENT (( snd_seq_client_type_t) 1)
+#define KERNEL_CLIENT (( snd_seq_client_type_t) 2)
+#define SNDRV_SEQ_FILTER_BROADCAST (1U << 0)
+#define SNDRV_SEQ_FILTER_MULTICAST (1U << 1)
+#define SNDRV_SEQ_FILTER_BOUNCE (1U << 2)
+#define SNDRV_SEQ_FILTER_USE_EVENT (1U << 31)
struct snd_seq_client_info {
int client;
snd_seq_client_type_t type;
diff --git a/libc/kernel/uapi/sound/asoc.h b/libc/kernel/uapi/sound/asoc.h
index eeb12b0..1940e5d 100644
--- a/libc/kernel/uapi/sound/asoc.h
+++ b/libc/kernel/uapi/sound/asoc.h
@@ -356,7 +356,7 @@
__le32 pcm_elems;
__le32 dai_link_elems;
struct snd_soc_tplg_private priv;
-} __packed;
+} __attribute__((__packed__));
struct snd_soc_tplg_stream_caps_v4 {
__le32 size;
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
@@ -372,7 +372,7 @@
__le32 period_size_max;
__le32 buffer_size_min;
__le32 buffer_size_max;
-} __packed;
+} __attribute__((__packed__));
struct snd_soc_tplg_pcm_v4 {
__le32 size;
char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
@@ -385,11 +385,11 @@
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
__le32 num_streams;
struct snd_soc_tplg_stream_caps_v4 caps[2];
-} __packed;
+} __attribute__((__packed__));
struct snd_soc_tplg_link_config_v4 {
__le32 size;
__le32 id;
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
__le32 num_streams;
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/sound/asound.h b/libc/kernel/uapi/sound/asound.h
index b0e47c1..9c1a3ae 100644
--- a/libc/kernel/uapi/sound/asound.h
+++ b/libc/kernel/uapi/sound/asound.h
@@ -96,7 +96,7 @@
struct snd_hwdep_dsp_image {
unsigned int index;
unsigned char name[64];
- unsigned char __user * image;
+ unsigned char * image;
size_t length;
unsigned long driver_data;
};
@@ -125,64 +125,64 @@
SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
};
typedef int __bitwise snd_pcm_access_t;
-#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0)
-#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1)
-#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2)
-#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3)
-#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4)
+#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED (( snd_pcm_access_t) 0)
+#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED (( snd_pcm_access_t) 1)
+#define SNDRV_PCM_ACCESS_MMAP_COMPLEX (( snd_pcm_access_t) 2)
+#define SNDRV_PCM_ACCESS_RW_INTERLEAVED (( snd_pcm_access_t) 3)
+#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED (( snd_pcm_access_t) 4)
#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
typedef int __bitwise snd_pcm_format_t;
-#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
-#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
-#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
-#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
-#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
-#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
-#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6)
-#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7)
-#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8)
-#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9)
-#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
-#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
-#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
-#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
-#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14)
-#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15)
-#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16)
-#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17)
-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18)
-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19)
-#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
-#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
-#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
-#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
-#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
-#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25)
-#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26)
-#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27)
-#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28)
-#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
-#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32)
-#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33)
-#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34)
-#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35)
-#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36)
-#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37)
-#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38)
-#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39)
-#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40)
-#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41)
-#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42)
-#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43)
-#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44)
-#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45)
-#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46)
-#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47)
-#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48)
-#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49)
-#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50)
-#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51)
-#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52)
+#define SNDRV_PCM_FORMAT_S8 (( snd_pcm_format_t) 0)
+#define SNDRV_PCM_FORMAT_U8 (( snd_pcm_format_t) 1)
+#define SNDRV_PCM_FORMAT_S16_LE (( snd_pcm_format_t) 2)
+#define SNDRV_PCM_FORMAT_S16_BE (( snd_pcm_format_t) 3)
+#define SNDRV_PCM_FORMAT_U16_LE (( snd_pcm_format_t) 4)
+#define SNDRV_PCM_FORMAT_U16_BE (( snd_pcm_format_t) 5)
+#define SNDRV_PCM_FORMAT_S24_LE (( snd_pcm_format_t) 6)
+#define SNDRV_PCM_FORMAT_S24_BE (( snd_pcm_format_t) 7)
+#define SNDRV_PCM_FORMAT_U24_LE (( snd_pcm_format_t) 8)
+#define SNDRV_PCM_FORMAT_U24_BE (( snd_pcm_format_t) 9)
+#define SNDRV_PCM_FORMAT_S32_LE (( snd_pcm_format_t) 10)
+#define SNDRV_PCM_FORMAT_S32_BE (( snd_pcm_format_t) 11)
+#define SNDRV_PCM_FORMAT_U32_LE (( snd_pcm_format_t) 12)
+#define SNDRV_PCM_FORMAT_U32_BE (( snd_pcm_format_t) 13)
+#define SNDRV_PCM_FORMAT_FLOAT_LE (( snd_pcm_format_t) 14)
+#define SNDRV_PCM_FORMAT_FLOAT_BE (( snd_pcm_format_t) 15)
+#define SNDRV_PCM_FORMAT_FLOAT64_LE (( snd_pcm_format_t) 16)
+#define SNDRV_PCM_FORMAT_FLOAT64_BE (( snd_pcm_format_t) 17)
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE (( snd_pcm_format_t) 18)
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE (( snd_pcm_format_t) 19)
+#define SNDRV_PCM_FORMAT_MU_LAW (( snd_pcm_format_t) 20)
+#define SNDRV_PCM_FORMAT_A_LAW (( snd_pcm_format_t) 21)
+#define SNDRV_PCM_FORMAT_IMA_ADPCM (( snd_pcm_format_t) 22)
+#define SNDRV_PCM_FORMAT_MPEG (( snd_pcm_format_t) 23)
+#define SNDRV_PCM_FORMAT_GSM (( snd_pcm_format_t) 24)
+#define SNDRV_PCM_FORMAT_S20_LE (( snd_pcm_format_t) 25)
+#define SNDRV_PCM_FORMAT_S20_BE (( snd_pcm_format_t) 26)
+#define SNDRV_PCM_FORMAT_U20_LE (( snd_pcm_format_t) 27)
+#define SNDRV_PCM_FORMAT_U20_BE (( snd_pcm_format_t) 28)
+#define SNDRV_PCM_FORMAT_SPECIAL (( snd_pcm_format_t) 31)
+#define SNDRV_PCM_FORMAT_S24_3LE (( snd_pcm_format_t) 32)
+#define SNDRV_PCM_FORMAT_S24_3BE (( snd_pcm_format_t) 33)
+#define SNDRV_PCM_FORMAT_U24_3LE (( snd_pcm_format_t) 34)
+#define SNDRV_PCM_FORMAT_U24_3BE (( snd_pcm_format_t) 35)
+#define SNDRV_PCM_FORMAT_S20_3LE (( snd_pcm_format_t) 36)
+#define SNDRV_PCM_FORMAT_S20_3BE (( snd_pcm_format_t) 37)
+#define SNDRV_PCM_FORMAT_U20_3LE (( snd_pcm_format_t) 38)
+#define SNDRV_PCM_FORMAT_U20_3BE (( snd_pcm_format_t) 39)
+#define SNDRV_PCM_FORMAT_S18_3LE (( snd_pcm_format_t) 40)
+#define SNDRV_PCM_FORMAT_S18_3BE (( snd_pcm_format_t) 41)
+#define SNDRV_PCM_FORMAT_U18_3LE (( snd_pcm_format_t) 42)
+#define SNDRV_PCM_FORMAT_U18_3BE (( snd_pcm_format_t) 43)
+#define SNDRV_PCM_FORMAT_G723_24 (( snd_pcm_format_t) 44)
+#define SNDRV_PCM_FORMAT_G723_24_1B (( snd_pcm_format_t) 45)
+#define SNDRV_PCM_FORMAT_G723_40 (( snd_pcm_format_t) 46)
+#define SNDRV_PCM_FORMAT_G723_40_1B (( snd_pcm_format_t) 47)
+#define SNDRV_PCM_FORMAT_DSD_U8 (( snd_pcm_format_t) 48)
+#define SNDRV_PCM_FORMAT_DSD_U16_LE (( snd_pcm_format_t) 49)
+#define SNDRV_PCM_FORMAT_DSD_U32_LE (( snd_pcm_format_t) 50)
+#define SNDRV_PCM_FORMAT_DSD_U16_BE (( snd_pcm_format_t) 51)
+#define SNDRV_PCM_FORMAT_DSD_U32_BE (( snd_pcm_format_t) 52)
#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8
#ifdef SNDRV_LITTLE_ENDIAN
@@ -212,7 +212,7 @@
#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE
#endif
typedef int __bitwise snd_pcm_subformat_t;
-#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
+#define SNDRV_PCM_SUBFORMAT_STD (( snd_pcm_subformat_t) 0)
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
#define SNDRV_PCM_INFO_MMAP 0x00000001
#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002
@@ -243,15 +243,15 @@
#define __SND_STRUCT_TIME64
#endif
typedef int __bitwise snd_pcm_state_t;
-#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0)
-#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1)
-#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2)
-#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3)
-#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4)
-#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5)
-#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6)
-#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7)
-#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8)
+#define SNDRV_PCM_STATE_OPEN (( snd_pcm_state_t) 0)
+#define SNDRV_PCM_STATE_SETUP (( snd_pcm_state_t) 1)
+#define SNDRV_PCM_STATE_PREPARED (( snd_pcm_state_t) 2)
+#define SNDRV_PCM_STATE_RUNNING (( snd_pcm_state_t) 3)
+#define SNDRV_PCM_STATE_XRUN (( snd_pcm_state_t) 4)
+#define SNDRV_PCM_STATE_DRAINING (( snd_pcm_state_t) 5)
+#define SNDRV_PCM_STATE_PAUSED (( snd_pcm_state_t) 6)
+#define SNDRV_PCM_STATE_SUSPENDED (( snd_pcm_state_t) 7)
+#define SNDRV_PCM_STATE_DISCONNECTED (( snd_pcm_state_t) 8)
#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
enum {
SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
@@ -475,12 +475,12 @@
};
struct snd_xferi {
snd_pcm_sframes_t result;
- void __user * buf;
+ void * buf;
snd_pcm_uframes_t frames;
};
struct snd_xfern {
snd_pcm_sframes_t result;
- void __user * __user * bufs;
+ void * * bufs;
snd_pcm_uframes_t frames;
};
enum {
@@ -605,7 +605,7 @@
__u32 tv_nsec;
__u64 tv_sec;
__u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH];
-} __packed;
+} __attribute__((__packed__));
struct snd_rawmidi_params {
int stream;
size_t buffer_size;
@@ -776,22 +776,22 @@
unsigned char components[128];
};
typedef int __bitwise snd_ctl_elem_type_t;
-#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0)
-#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1)
-#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2)
-#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3)
-#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4)
-#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5)
-#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6)
+#define SNDRV_CTL_ELEM_TYPE_NONE (( snd_ctl_elem_type_t) 0)
+#define SNDRV_CTL_ELEM_TYPE_BOOLEAN (( snd_ctl_elem_type_t) 1)
+#define SNDRV_CTL_ELEM_TYPE_INTEGER (( snd_ctl_elem_type_t) 2)
+#define SNDRV_CTL_ELEM_TYPE_ENUMERATED (( snd_ctl_elem_type_t) 3)
+#define SNDRV_CTL_ELEM_TYPE_BYTES (( snd_ctl_elem_type_t) 4)
+#define SNDRV_CTL_ELEM_TYPE_IEC958 (( snd_ctl_elem_type_t) 5)
+#define SNDRV_CTL_ELEM_TYPE_INTEGER64 (( snd_ctl_elem_type_t) 6)
#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
typedef int __bitwise snd_ctl_elem_iface_t;
-#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0)
-#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1)
-#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2)
-#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3)
-#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4)
-#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5)
-#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6)
+#define SNDRV_CTL_ELEM_IFACE_CARD (( snd_ctl_elem_iface_t) 0)
+#define SNDRV_CTL_ELEM_IFACE_HWDEP (( snd_ctl_elem_iface_t) 1)
+#define SNDRV_CTL_ELEM_IFACE_MIXER (( snd_ctl_elem_iface_t) 2)
+#define SNDRV_CTL_ELEM_IFACE_PCM (( snd_ctl_elem_iface_t) 3)
+#define SNDRV_CTL_ELEM_IFACE_RAWMIDI (( snd_ctl_elem_iface_t) 4)
+#define SNDRV_CTL_ELEM_IFACE_TIMER (( snd_ctl_elem_iface_t) 5)
+#define SNDRV_CTL_ELEM_IFACE_SEQUENCER (( snd_ctl_elem_iface_t) 6)
#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
#define SNDRV_CTL_ELEM_ACCESS_READ (1 << 0)
#define SNDRV_CTL_ELEM_ACCESS_WRITE (1 << 1)
@@ -826,7 +826,7 @@
unsigned int space;
unsigned int used;
unsigned int count;
- struct snd_ctl_elem_id __user * pids;
+ struct snd_ctl_elem_id * pids;
unsigned char reserved[50];
};
struct snd_ctl_elem_info {
@@ -884,7 +884,7 @@
struct snd_ctl_tlv {
unsigned int numid;
unsigned int length;
- unsigned int tlv[0];
+ unsigned int tlv[];
};
#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
diff --git a/libc/kernel/uapi/sound/firewire.h b/libc/kernel/uapi/sound/firewire.h
index 198a8f4..d26d722 100644
--- a/libc/kernel/uapi/sound/firewire.h
+++ b/libc/kernel/uapi/sound/firewire.h
@@ -46,11 +46,11 @@
__be32 category;
__be32 command;
__be32 status;
- __be32 params[0];
+ __be32 params[];
};
struct snd_firewire_event_efw_response {
unsigned int type;
- __be32 response[0];
+ __be32 response[];
};
struct snd_firewire_event_digi00x_message {
unsigned int type;
@@ -67,7 +67,7 @@
};
struct snd_firewire_event_tascam_control {
unsigned int type;
- struct snd_firewire_tascam_change changes[0];
+ struct snd_firewire_tascam_change changes[];
};
struct snd_firewire_event_motu_register_dsp_change {
unsigned int type;
diff --git a/libc/kernel/uapi/sound/intel/avs/tokens.h b/libc/kernel/uapi/sound/intel/avs/tokens.h
new file mode 100644
index 0000000..b6b3002
--- /dev/null
+++ b/libc/kernel/uapi/sound/intel/avs/tokens.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __UAPI_SOUND_INTEL_AVS_TOKENS_H
+#define __UAPI_SOUND_INTEL_AVS_TOKENS_H
+enum avs_tplg_token {
+ AVS_TKN_MANIFEST_NAME_STRING = 1,
+ AVS_TKN_MANIFEST_VERSION_U32 = 2,
+ AVS_TKN_MANIFEST_NUM_LIBRARIES_U32 = 3,
+ AVS_TKN_MANIFEST_NUM_AFMTS_U32 = 4,
+ AVS_TKN_MANIFEST_NUM_MODCFGS_BASE_U32 = 5,
+ AVS_TKN_MANIFEST_NUM_MODCFGS_EXT_U32 = 6,
+ AVS_TKN_MANIFEST_NUM_PPLCFGS_U32 = 7,
+ AVS_TKN_MANIFEST_NUM_BINDINGS_U32 = 8,
+ AVS_TKN_LIBRARY_ID_U32 = 101,
+ AVS_TKN_LIBRARY_NAME_STRING = 102,
+ AVS_TKN_AFMT_ID_U32 = 201,
+ AVS_TKN_AFMT_SAMPLE_RATE_U32 = 202,
+ AVS_TKN_AFMT_BIT_DEPTH_U32 = 203,
+ AVS_TKN_AFMT_CHANNEL_MAP_U32 = 204,
+ AVS_TKN_AFMT_CHANNEL_CFG_U32 = 205,
+ AVS_TKN_AFMT_INTERLEAVING_U32 = 206,
+ AVS_TKN_AFMT_NUM_CHANNELS_U32 = 207,
+ AVS_TKN_AFMT_VALID_BIT_DEPTH_U32 = 208,
+ AVS_TKN_AFMT_SAMPLE_TYPE_U32 = 209,
+ AVS_TKN_MODCFG_BASE_ID_U32 = 301,
+ AVS_TKN_MODCFG_BASE_CPC_U32 = 302,
+ AVS_TKN_MODCFG_BASE_IBS_U32 = 303,
+ AVS_TKN_MODCFG_BASE_OBS_U32 = 304,
+ AVS_TKN_MODCFG_BASE_PAGES_U32 = 305,
+ AVS_TKN_MODCFG_EXT_ID_U32 = 401,
+ AVS_TKN_MODCFG_EXT_TYPE_UUID = 402,
+ AVS_TKN_MODCFG_CPR_OUT_AFMT_ID_U32 = 403,
+ AVS_TKN_MODCFG_CPR_FEATURE_MASK_U32 = 404,
+ AVS_TKN_MODCFG_CPR_DMA_TYPE_U32 = 405,
+ AVS_TKN_MODCFG_CPR_DMABUFF_SIZE_U32 = 406,
+ AVS_TKN_MODCFG_CPR_VINDEX_U8 = 407,
+ AVS_TKN_MODCFG_CPR_BLOB_FMT_ID_U32 = 408,
+ AVS_TKN_MODCFG_MICSEL_OUT_AFMT_ID_U32 = 409,
+ AVS_TKN_MODCFG_INTELWOV_CPC_LP_MODE_U32 = 410,
+ AVS_TKN_MODCFG_SRC_OUT_FREQ_U32 = 411,
+ AVS_TKN_MODCFG_MUX_REF_AFMT_ID_U32 = 412,
+ AVS_TKN_MODCFG_MUX_OUT_AFMT_ID_U32 = 413,
+ AVS_TKN_MODCFG_AEC_REF_AFMT_ID_U32 = 414,
+ AVS_TKN_MODCFG_AEC_OUT_AFMT_ID_U32 = 415,
+ AVS_TKN_MODCFG_AEC_CPC_LP_MODE_U32 = 416,
+ AVS_TKN_MODCFG_ASRC_OUT_FREQ_U32 = 417,
+ AVS_TKN_MODCFG_ASRC_MODE_U8 = 418,
+ AVS_TKN_MODCFG_ASRC_DISABLE_JITTER_U8 = 419,
+ AVS_TKN_MODCFG_UPDOWN_MIX_OUT_CHAN_CFG_U32 = 420,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_SELECT_U32 = 421,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_0_S32 = 422,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_1_S32 = 423,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_2_S32 = 424,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_3_S32 = 425,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_4_S32 = 426,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_5_S32 = 427,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_6_S32 = 428,
+ AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_7_S32 = 429,
+ AVS_TKN_MODCFG_UPDOWN_MIX_CHAN_MAP_U32 = 430,
+ AVS_TKN_MODCFG_EXT_NUM_INPUT_PINS_U16 = 431,
+ AVS_TKN_MODCFG_EXT_NUM_OUTPUT_PINS_U16 = 432,
+ AVS_TKN_PPLCFG_ID_U32 = 1401,
+ AVS_TKN_PPLCFG_REQ_SIZE_U16 = 1402,
+ AVS_TKN_PPLCFG_PRIORITY_U8 = 1403,
+ AVS_TKN_PPLCFG_LOW_POWER_BOOL = 1404,
+ AVS_TKN_PPLCFG_ATTRIBUTES_U16 = 1405,
+ AVS_TKN_PPLCFG_TRIGGER_U32 = 1406,
+ AVS_TKN_BINDING_ID_U32 = 1501,
+ AVS_TKN_BINDING_TARGET_TPLG_NAME_STRING = 1502,
+ AVS_TKN_BINDING_TARGET_PATH_TMPL_ID_U32 = 1503,
+ AVS_TKN_BINDING_TARGET_PPL_ID_U32 = 1504,
+ AVS_TKN_BINDING_TARGET_MOD_ID_U32 = 1505,
+ AVS_TKN_BINDING_TARGET_MOD_PIN_U8 = 1506,
+ AVS_TKN_BINDING_MOD_ID_U32 = 1507,
+ AVS_TKN_BINDING_MOD_PIN_U8 = 1508,
+ AVS_TKN_BINDING_IS_SINK_U8 = 1509,
+ AVS_TKN_PPL_ID_U32 = 1601,
+ AVS_TKN_PPL_PPLCFG_ID_U32 = 1602,
+ AVS_TKN_PPL_NUM_BINDING_IDS_U32 = 1603,
+ AVS_TKN_PPL_BINDING_ID_U32 = 1604,
+ AVS_TKN_MOD_ID_U32 = 1701,
+ AVS_TKN_MOD_MODCFG_BASE_ID_U32 = 1702,
+ AVS_TKN_MOD_IN_AFMT_ID_U32 = 1703,
+ AVS_TKN_MOD_CORE_ID_U8 = 1704,
+ AVS_TKN_MOD_PROC_DOMAIN_U8 = 1705,
+ AVS_TKN_MOD_MODCFG_EXT_ID_U32 = 1706,
+ AVS_TKN_PATH_TMPL_ID_U32 = 1801,
+ AVS_TKN_PATH_ID_U32 = 1901,
+ AVS_TKN_PATH_FE_FMT_ID_U32 = 1902,
+ AVS_TKN_PATH_BE_FMT_ID_U32 = 1903,
+ AVS_TKN_PIN_FMT_INDEX_U32 = 2201,
+ AVS_TKN_PIN_FMT_IOBS_U32 = 2202,
+ AVS_TKN_PIN_FMT_AFMT_ID_U32 = 2203,
+};
+#endif
diff --git a/libc/kernel/uapi/sound/skl-tplg-interface.h b/libc/kernel/uapi/sound/skl-tplg-interface.h
index b516a08..6dd9655 100644
--- a/libc/kernel/uapi/sound/skl-tplg-interface.h
+++ b/libc/kernel/uapi/sound/skl-tplg-interface.h
@@ -110,8 +110,8 @@
__u32 rsvd : 30;
__u32 param_id;
__u32 max;
- char params[0];
-} __packed;
+ char params[];
+} __attribute__((__packed__));
enum skl_tkn_dir {
SKL_DIR_IN,
SKL_DIR_OUT
@@ -123,7 +123,7 @@
struct skl_dfw_v4_module_pin {
__u16 module_id;
__u16 instance_id;
-} __packed;
+} __attribute__((__packed__));
struct skl_dfw_v4_module_fmt {
__u32 channels;
__u32 freq;
@@ -133,21 +133,21 @@
__u32 interleaving_style;
__u32 sample_type;
__u32 ch_map;
-} __packed;
+} __attribute__((__packed__));
struct skl_dfw_v4_module_caps {
__u32 set_params : 2;
__u32 rsvd : 30;
__u32 param_id;
__u32 caps_size;
__u32 caps[HDA_SST_CFG_MAX];
-} __packed;
+} __attribute__((__packed__));
struct skl_dfw_v4_pipe {
__u8 pipe_id;
__u8 pipe_priority;
__u16 conn_type : 4;
__u16 rsvd : 4;
__u16 memory_pages : 8;
-} __packed;
+} __attribute__((__packed__));
struct skl_dfw_v4_module {
char uuid[SKL_UUID_STR_SZ];
__u16 module_id;
@@ -181,5 +181,5 @@
struct skl_dfw_v4_module_pin in_pin[MAX_IN_QUEUE];
struct skl_dfw_v4_module_pin out_pin[MAX_OUT_QUEUE];
struct skl_dfw_v4_module_caps caps;
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/sound/snd_ar_tokens.h b/libc/kernel/uapi/sound/snd_ar_tokens.h
index 39c0684..7b87caa 100644
--- a/libc/kernel/uapi/sound/snd_ar_tokens.h
+++ b/libc/kernel/uapi/sound/snd_ar_tokens.h
@@ -68,6 +68,27 @@
#define AR_TKN_U32_MODULE_DST_IN_PORT_ID 207
#define AR_TKN_U32_MODULE_SRC_INSTANCE_ID 208
#define AR_TKN_U32_MODULE_DST_INSTANCE_ID 209
+#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID1 210
+#define AR_TKN_U32_MODULE_DST_IN_PORT_ID1 211
+#define AR_TKN_U32_MODULE_DST_INSTANCE_ID1 212
+#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID2 213
+#define AR_TKN_U32_MODULE_DST_IN_PORT_ID2 214
+#define AR_TKN_U32_MODULE_DST_INSTANCE_ID2 215
+#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID3 216
+#define AR_TKN_U32_MODULE_DST_IN_PORT_ID3 217
+#define AR_TKN_U32_MODULE_DST_INSTANCE_ID3 218
+#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID4 219
+#define AR_TKN_U32_MODULE_DST_IN_PORT_ID4 220
+#define AR_TKN_U32_MODULE_DST_INSTANCE_ID4 221
+#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID5 222
+#define AR_TKN_U32_MODULE_DST_IN_PORT_ID5 223
+#define AR_TKN_U32_MODULE_DST_INSTANCE_ID5 224
+#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID6 225
+#define AR_TKN_U32_MODULE_DST_IN_PORT_ID6 226
+#define AR_TKN_U32_MODULE_DST_INSTANCE_ID6 227
+#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID7 228
+#define AR_TKN_U32_MODULE_DST_IN_PORT_ID7 229
+#define AR_TKN_U32_MODULE_DST_INSTANCE_ID7 230
#define AR_TKN_U32_MODULE_HW_IF_IDX 250
#define AR_TKN_U32_MODULE_HW_IF_TYPE 251
#define AR_TKN_U32_MODULE_FMT_INTERLEAVE 252
diff --git a/libc/kernel/uapi/sound/sof/abi.h b/libc/kernel/uapi/sound/sof/abi.h
index 3af3c9d..dc4e525 100644
--- a/libc/kernel/uapi/sound/sof/abi.h
+++ b/libc/kernel/uapi/sound/sof/abi.h
@@ -18,8 +18,9 @@
****************************************************************************/
#ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__
#define __INCLUDE_UAPI_SOUND_SOF_ABI_H__
+#include <linux/types.h>
#define SOF_ABI_MAJOR 3
-#define SOF_ABI_MINOR 18
+#define SOF_ABI_MINOR 23
#define SOF_ABI_PATCH 0
#define SOF_ABI_MAJOR_SHIFT 24
#define SOF_ABI_MAJOR_MASK 0xff
diff --git a/libc/kernel/uapi/sound/sof/fw.h b/libc/kernel/uapi/sound/sof/fw.h
index c36c2b9..97b7de3 100644
--- a/libc/kernel/uapi/sound/sof/fw.h
+++ b/libc/kernel/uapi/sound/sof/fw.h
@@ -46,7 +46,7 @@
enum snd_sof_fw_blk_type type;
__u32 size;
__u32 offset;
-} __packed;
+} __attribute__((__packed__));
enum snd_sof_fw_mod_type {
SOF_FW_BASE = 0,
SOF_FW_MODULE = 1,
@@ -55,11 +55,11 @@
enum snd_sof_fw_mod_type type;
__u32 size;
__u32 num_blocks;
-} __packed;
+} __attribute__((__packed__));
struct snd_sof_fw_header {
unsigned char sig[SND_SOF_FW_SIG_SIZE];
__u32 file_size;
__u32 num_modules;
__u32 abi;
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/sound/sof/header.h b/libc/kernel/uapi/sound/sof/header.h
index 3fbd4a4..7514550 100644
--- a/libc/kernel/uapi/sound/sof/header.h
+++ b/libc/kernel/uapi/sound/sof/header.h
@@ -25,6 +25,19 @@
__u32 size;
__u32 abi;
__u32 reserved[4];
- __u32 data[0];
-} __packed;
+ __u32 data[];
+} __attribute__((__packed__));
+#define SOF_MANIFEST_DATA_TYPE_NHLT 1
+struct sof_manifest_tlv {
+ __le32 type;
+ __le32 size;
+ __u8 data[];
+};
+struct sof_manifest {
+ __le16 abi_major;
+ __le16 abi_minor;
+ __le16 abi_patch;
+ __le16 count;
+ struct sof_manifest_tlv items[];
+};
#endif
diff --git a/libc/kernel/uapi/sound/sof/tokens.h b/libc/kernel/uapi/sound/sof/tokens.h
index 856281a..3726546 100644
--- a/libc/kernel/uapi/sound/sof/tokens.h
+++ b/libc/kernel/uapi/sound/sof/tokens.h
@@ -37,8 +37,13 @@
#define SOF_TKN_SCHED_FRAMES 204
#define SOF_TKN_SCHED_TIME_DOMAIN 205
#define SOF_TKN_SCHED_DYNAMIC_PIPELINE 206
+#define SOF_TKN_SCHED_LP_MODE 207
+#define SOF_TKN_SCHED_MEM_USAGE 208
#define SOF_TKN_VOLUME_RAMP_STEP_TYPE 250
#define SOF_TKN_VOLUME_RAMP_STEP_MS 251
+#define SOF_TKN_GAIN_RAMP_TYPE 260
+#define SOF_TKN_GAIN_RAMP_DURATION 261
+#define SOF_TKN_GAIN_VAL 262
#define SOF_TKN_SRC_RATE_IN 300
#define SOF_TKN_SRC_RATE_OUT 301
#define SOF_TKN_ASRC_RATE_IN 320
@@ -51,6 +56,13 @@
#define SOF_TKN_COMP_FORMAT 402
#define SOF_TKN_COMP_CORE_ID 404
#define SOF_TKN_COMP_UUID 405
+#define SOF_TKN_COMP_CPC 406
+#define SOF_TKN_COMP_IS_PAGES 409
+#define SOF_TKN_COMP_NUM_AUDIO_FORMATS 410
+#define SOF_TKN_COMP_NUM_SINK_PINS 411
+#define SOF_TKN_COMP_NUM_SOURCE_PINS 412
+#define SOF_TKN_COMP_SINK_PIN_BINDING_WNAME 413
+#define SOF_TKN_COMP_SRC_PIN_BINDING_WNAME 414
#define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500
#define SOF_TKN_INTEL_SSP_MCLK_ID 501
#define SOF_TKN_INTEL_SSP_SAMPLE_BITS 502
@@ -90,4 +102,32 @@
#define SOF_TKN_MEDIATEK_AFE_RATE 1600
#define SOF_TKN_MEDIATEK_AFE_CH 1601
#define SOF_TKN_MEDIATEK_AFE_FORMAT 1602
+#define SOF_TKN_MIXER_TYPE 1700
+#define SOF_TKN_AMD_ACPDMIC_RATE 1800
+#define SOF_TKN_AMD_ACPDMIC_CH 1801
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_RATE 1900
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_BIT_DEPTH 1901
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_VALID_BIT 1902
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CHANNELS 1903
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CH_MAP 1904
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CH_CFG 1905
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_INTERLEAVING_STYLE 1906
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_FMT_CFG 1907
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_SAMPLE_TYPE 1908
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_RATE 1930
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_BIT_DEPTH 1931
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_VALID_BIT 1932
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CHANNELS 1933
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CH_MAP 1934
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CH_CFG 1935
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_INTERLEAVING_STYLE 1936
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_FMT_CFG 1937
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_SAMPLE_TYPE 1938
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IBS 1970
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OBS 1971
+#define SOF_TKN_CAVS_AUDIO_FORMAT_DMA_BUFFER_SIZE 1972
+#define SOF_TKN_INTEL_COPIER_NODE_TYPE 1980
+#define SOF_TKN_AMD_ACPI2S_RATE 1700
+#define SOF_TKN_AMD_ACPI2S_CH 1701
+#define SOF_TKN_AMD_ACPI2S_TDM_MODE 1702
#endif
diff --git a/libc/kernel/uapi/sound/usb_stream.h b/libc/kernel/uapi/sound/usb_stream.h
index bb7fe80..ac87c31 100644
--- a/libc/kernel/uapi/sound/usb_stream.h
+++ b/libc/kernel/uapi/sound/usb_stream.h
@@ -49,7 +49,7 @@
unsigned inpacket_split_at;
unsigned next_inpacket_split;
unsigned next_inpacket_split_at;
- struct usb_stream_packet inpacket[0];
+ struct usb_stream_packet inpacket[];
};
enum usb_stream_state {
usb_stream_invalid,
diff --git a/libc/kernel/uapi/xen/gntdev.h b/libc/kernel/uapi/xen/gntdev.h
index 1e78ac3..eada73c 100644
--- a/libc/kernel/uapi/xen/gntdev.h
+++ b/libc/kernel/uapi/xen/gntdev.h
@@ -55,7 +55,7 @@
};
struct gntdev_grant_copy_segment {
union {
- void __user * virt;
+ void * virt;
struct {
grant_ref_t ref;
__u16 offset;
@@ -69,7 +69,7 @@
#define IOCTL_GNTDEV_GRANT_COPY _IOC(_IOC_NONE, 'G', 8, sizeof(struct ioctl_gntdev_grant_copy))
struct ioctl_gntdev_grant_copy {
unsigned int count;
- struct gntdev_grant_copy_segment __user * segments;
+ struct gntdev_grant_copy_segment * segments;
};
#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
#define UNMAP_NOTIFY_SEND_EVENT 0x2
diff --git a/libc/kernel/uapi/xen/privcmd.h b/libc/kernel/uapi/xen/privcmd.h
index 145446b..21d9f84 100644
--- a/libc/kernel/uapi/xen/privcmd.h
+++ b/libc/kernel/uapi/xen/privcmd.h
@@ -33,13 +33,13 @@
struct privcmd_mmap {
int num;
domid_t dom;
- struct privcmd_mmap_entry __user * entry;
+ struct privcmd_mmap_entry * entry;
};
struct privcmd_mmapbatch {
int num;
domid_t dom;
__u64 addr;
- xen_pfn_t __user * arr;
+ xen_pfn_t * arr;
};
#define PRIVCMD_MMAPBATCH_MFN_ERROR 0xf0000000U
#define PRIVCMD_MMAPBATCH_PAGED_ERROR 0x80000000U
@@ -47,17 +47,17 @@
unsigned int num;
domid_t dom;
__u64 addr;
- const xen_pfn_t __user * arr;
- int __user * err;
+ const xen_pfn_t * arr;
+ int * err;
};
struct privcmd_dm_op_buf {
- void __user * uptr;
+ void * uptr;
size_t size;
};
struct privcmd_dm_op {
domid_t dom;
__u16 num;
- const struct privcmd_dm_op_buf __user * ubufs;
+ const struct privcmd_dm_op_buf * ubufs;
};
struct privcmd_mmap_resource {
domid_t dom;
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 7397b68..c75b13a 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -680,28 +680,28 @@
nftw64; # introduced=21
nice;
nrand48;
- ns_format_ttl; # arm64 x86_64 introduced=22
- ns_get16; # arm64 x86_64 introduced=22
- ns_get32; # arm64 x86_64 introduced=22
- ns_initparse; # arm64 x86_64 introduced=22
- ns_makecanon; # arm64 x86_64 introduced=22
- ns_msg_getflag; # arm64 x86_64 introduced=22
- ns_name_compress; # arm64 x86_64 introduced=22
- ns_name_ntol; # arm64 x86_64 introduced=22
- ns_name_ntop; # arm64 x86_64 introduced=22
- ns_name_pack; # arm64 x86_64 introduced=22
- ns_name_pton; # arm64 x86_64 introduced=22
- ns_name_rollback; # arm64 x86_64 introduced=22
- ns_name_skip; # arm64 x86_64 introduced=22
- ns_name_uncompress; # arm64 x86_64 introduced=22
- ns_name_unpack; # arm64 x86_64 introduced=22
- ns_parserr; # arm64 x86_64 introduced=22
- ns_put16; # arm64 x86_64 introduced=22
- ns_put32; # arm64 x86_64 introduced=22
- ns_samename; # arm64 x86_64 introduced=22
- ns_skiprr; # arm64 x86_64 introduced=22
- ns_sprintrr; # arm64 x86_64 introduced=22
- ns_sprintrrf; # arm64 x86_64 introduced=22
+ ns_format_ttl; # arm64 x86_64 riscv64 introduced=22
+ ns_get16; # arm64 x86_64 riscv64 introduced=22
+ ns_get32; # arm64 x86_64 riscv64 introduced=22
+ ns_initparse; # arm64 x86_64 riscv64 introduced=22
+ ns_makecanon; # arm64 x86_64 riscv64 introduced=22
+ ns_msg_getflag; # arm64 x86_64 riscv64 introduced=22
+ ns_name_compress; # arm64 x86_64 riscv64 introduced=22
+ ns_name_ntol; # arm64 x86_64 riscv64 introduced=22
+ ns_name_ntop; # arm64 x86_64 riscv64 introduced=22
+ ns_name_pack; # arm64 x86_64 riscv64 introduced=22
+ ns_name_pton; # arm64 x86_64 riscv64 introduced=22
+ ns_name_rollback; # arm64 x86_64 riscv64 introduced=22
+ ns_name_skip; # arm64 x86_64 riscv64 introduced=22
+ ns_name_uncompress; # arm64 x86_64 riscv64 introduced=22
+ ns_name_unpack; # arm64 x86_64 riscv64 introduced=22
+ ns_parserr; # arm64 x86_64 riscv64 introduced=22
+ ns_put16; # arm64 x86_64 riscv64 introduced=22
+ ns_put32; # arm64 x86_64 riscv64 introduced=22
+ ns_samename; # arm64 x86_64 riscv64 introduced=22
+ ns_skiprr; # arm64 x86_64 riscv64 introduced=22
+ ns_sprintrr; # arm64 x86_64 riscv64 introduced=22
+ ns_sprintrrf; # arm64 x86_64 riscv64 introduced=22
nsdispatch;
ntohl; # introduced=21
ntohs; # introduced=21
@@ -740,7 +740,7 @@
pread;
pread64; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21
printf;
- prlimit; # arm64 x86_64
+ prlimit; # arm64 x86_64 riscv64
prlimit64; # introduced=21
process_vm_readv; # introduced=23
process_vm_writev; # introduced=23
@@ -1037,12 +1037,10 @@
strtold_l; # introduced=21
strtoll;
strtoll_l; # introduced=21
- strtoq; # introduced=21
strtoul;
strtoull;
strtoull_l; # introduced=21
strtoumax;
- strtouq; # introduced=21
strxfrm;
strxfrm_l; # introduced=21
swapoff; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
@@ -1449,7 +1447,7 @@
___tls_get_addr; # x86
__aeabi_read_tp; # arm
__res_randomid;
- __tls_get_addr; # arm x86_64
+ __tls_get_addr; # arm riscv64 x86_64
android_fdsan_close_with_tag;
android_fdsan_create_owner_tag;
android_fdsan_exchange_owner_tag;
@@ -1520,34 +1518,34 @@
tss_set;
# Unwinder implementation
- __aeabi_unwind_cpp_pr0; # apex llndk arm
- __aeabi_unwind_cpp_pr1; # apex llndk arm
- __aeabi_unwind_cpp_pr2; # apex llndk arm
- __deregister_frame; # apex llndk arm64 x86 x86_64
- __gnu_unwind_frame; # apex llndk arm
- __register_frame; # apex llndk arm64 x86 x86_64
- _Unwind_Backtrace; # apex llndk
- _Unwind_Complete; # apex llndk arm
- _Unwind_DeleteException; # apex llndk
- _Unwind_Find_FDE; # apex llndk
- _Unwind_FindEnclosingFunction; # apex llndk
- _Unwind_ForcedUnwind; # apex llndk arm64 x86 x86_64
- _Unwind_GetCFA; # apex llndk
- _Unwind_GetDataRelBase; # apex llndk
- _Unwind_GetGR; # apex llndk
- _Unwind_GetIP; # apex llndk
- _Unwind_GetIPInfo; # apex llndk
- _Unwind_GetLanguageSpecificData; # apex llndk
- _Unwind_GetRegionStart; # apex llndk
- _Unwind_GetTextRelBase; # apex llndk
- _Unwind_RaiseException; # apex llndk
- _Unwind_Resume; # apex llndk
- _Unwind_Resume_or_Rethrow; # apex llndk
- _Unwind_SetGR; # apex llndk
- _Unwind_SetIP; # apex llndk
- _Unwind_VRS_Get; # apex llndk arm
- _Unwind_VRS_Pop; # apex llndk arm
- _Unwind_VRS_Set; # apex llndk arm
+ __aeabi_unwind_cpp_pr0; # arm
+ __aeabi_unwind_cpp_pr1; # arm
+ __aeabi_unwind_cpp_pr2; # arm
+ __deregister_frame; # arm64 x86 x86_64
+ __gnu_unwind_frame; # arm
+ __register_frame; # arm64 x86 x86_64
+ _Unwind_Backtrace;
+ _Unwind_Complete; # arm
+ _Unwind_DeleteException;
+ _Unwind_Find_FDE;
+ _Unwind_FindEnclosingFunction;
+ _Unwind_ForcedUnwind; # arm64 x86 x86_64
+ _Unwind_GetCFA;
+ _Unwind_GetDataRelBase;
+ _Unwind_GetGR;
+ _Unwind_GetIP;
+ _Unwind_GetIPInfo;
+ _Unwind_GetLanguageSpecificData;
+ _Unwind_GetRegionStart;
+ _Unwind_GetTextRelBase;
+ _Unwind_RaiseException;
+ _Unwind_Resume;
+ _Unwind_Resume_or_Rethrow;
+ _Unwind_SetGR;
+ _Unwind_SetIP;
+ _Unwind_VRS_Get; # arm
+ _Unwind_VRS_Pop; # arm
+ _Unwind_VRS_Set; # arm
} LIBC_Q;
LIBC_S { # introduced=S
@@ -1576,6 +1574,16 @@
pwritev64v2;
} LIBC_S;
+LIBC_U { # introduced=UpsideDownCake
+ global:
+ __freadahead;
+ close_range;
+ copy_file_range;
+ memset_explicit;
+ posix_spawn_file_actions_addchdir_np;
+ posix_spawn_file_actions_addfchdir_np;
+} LIBC_T;
+
LIBC_PRIVATE {
global:
__accept4; # arm x86
diff --git a/libc/libstdc++.map.txt b/libc/libstdc++.map.txt
index bb7040f..8af3b91 100644
--- a/libc/libstdc++.map.txt
+++ b/libc/libstdc++.map.txt
@@ -7,12 +7,12 @@
_ZdlPvRKSt9nothrow_t; # weak
_Znaj; # arm x86 weak
_ZnajRKSt9nothrow_t; # arm x86 weak
- _Znam; # arm64 x86_64 weak
- _ZnamRKSt9nothrow_t; # arm64 x86_64 weak
+ _Znam; # arm64 x86_64 riscv64 weak
+ _ZnamRKSt9nothrow_t; # arm64 x86_64 riscv64 weak
_Znwj; # arm x86 weak
_ZnwjRKSt9nothrow_t; # arm x86 weak
- _Znwm; # arm64 x86_64 weak
- _ZnwmRKSt9nothrow_t; # arm64 x86_64 weak
+ _Znwm; # arm64 x86_64 riscv64 weak
+ _ZnwmRKSt9nothrow_t; # arm64 x86_64 riscv64 weak
__cxa_guard_abort;
__cxa_guard_acquire;
__cxa_guard_release;
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
index 7ff3db2..373d497 100644
--- a/libc/malloc_debug/Android.bp
+++ b/libc/malloc_debug/Android.bp
@@ -64,6 +64,7 @@
"malloc_debug.cpp",
"PointerData.cpp",
"RecordData.cpp",
+ "Unreachable.cpp",
"UnwindBacktrace.cpp",
],
@@ -73,6 +74,7 @@
"libasync_safe",
"libbase",
"libc_malloc_debug_backtrace",
+ "libmemunreachable",
],
shared_libs: [
@@ -120,6 +122,7 @@
cc_test {
name: "malloc_debug_unit_tests",
test_suites: ["device-tests"],
+ isolated: true,
srcs: [
"tests/backtrace_fake.cpp",
@@ -173,13 +176,17 @@
"bionic_libc_platform_headers",
],
+ // The clang-analyzer-unix.Malloc and other warnings in these
+ // unit tests are either false positive or in
+ // negative tests that can be ignored.
+ tidy: false,
+
srcs: [
"tests/malloc_debug_system_tests.cpp",
],
shared_libs: [
"libbase",
- "libbacktrace",
"liblog",
"libunwindstack",
],
diff --git a/libc/malloc_debug/Config.cpp b/libc/malloc_debug/Config.cpp
index 11887e2..be577bc 100644
--- a/libc/malloc_debug/Config.cpp
+++ b/libc/malloc_debug/Config.cpp
@@ -70,73 +70,139 @@
const std::unordered_map<std::string, Config::OptionInfo> Config::kOptions = {
{
- "guard", {FRONT_GUARD | REAR_GUARD | TRACK_ALLOCS, &Config::SetGuard},
+ "guard",
+ {FRONT_GUARD | REAR_GUARD | TRACK_ALLOCS, &Config::SetGuard},
},
{
- "front_guard", {FRONT_GUARD | TRACK_ALLOCS, &Config::SetFrontGuard},
+ "front_guard",
+ {FRONT_GUARD | TRACK_ALLOCS, &Config::SetFrontGuard},
},
{
- "rear_guard", {REAR_GUARD | TRACK_ALLOCS, &Config::SetRearGuard},
+ "rear_guard",
+ {REAR_GUARD | TRACK_ALLOCS, &Config::SetRearGuard},
},
{
- "backtrace", {BACKTRACE | TRACK_ALLOCS, &Config::SetBacktrace},
+ "backtrace_size",
+ {BACKTRACE_SPECIFIC_SIZES, &Config::SetBacktraceSize},
+ },
+ {
+ "bt_sz",
+ {BACKTRACE_SPECIFIC_SIZES, &Config::SetBacktraceSize},
+ },
+ {
+ "backtrace_min_size",
+ {BACKTRACE_SPECIFIC_SIZES, &Config::SetBacktraceMinSize},
+ },
+ {
+ "bt_min_sz",
+ {BACKTRACE_SPECIFIC_SIZES, &Config::SetBacktraceMinSize},
+ },
+ {
+ "backtrace_max_size",
+ {BACKTRACE_SPECIFIC_SIZES, &Config::SetBacktraceMaxSize},
+ },
+ {
+ "bt_max_sz",
+ {BACKTRACE_SPECIFIC_SIZES, &Config::SetBacktraceMaxSize},
+ },
+ {
+ "backtrace",
+ {BACKTRACE | TRACK_ALLOCS, &Config::SetBacktrace},
+ },
+ {
+ "bt",
+ {BACKTRACE | TRACK_ALLOCS, &Config::SetBacktrace},
},
{
"backtrace_enable_on_signal",
{BACKTRACE | TRACK_ALLOCS, &Config::SetBacktraceEnableOnSignal},
},
-
{
- "backtrace_dump_on_exit", {0, &Config::SetBacktraceDumpOnExit},
+ "bt_en_on_sig",
+ {BACKTRACE | TRACK_ALLOCS, &Config::SetBacktraceEnableOnSignal},
},
{
- "backtrace_dump_prefix", {0, &Config::SetBacktraceDumpPrefix},
+ "backtrace_dump_on_exit",
+ {0, &Config::SetBacktraceDumpOnExit},
},
{
- "backtrace_full", {BACKTRACE_FULL, &Config::VerifyValueEmpty},
+ "bt_dmp_on_ex",
+ {0, &Config::SetBacktraceDumpOnExit},
+ },
+ {
+ "backtrace_dump_prefix",
+ {0, &Config::SetBacktraceDumpPrefix},
+ },
+ {
+ "bt_dmp_pre",
+ {0, &Config::SetBacktraceDumpPrefix},
+ },
+ {
+ "backtrace_full",
+ {BACKTRACE_FULL, &Config::VerifyValueEmpty},
+ },
+ {
+ "bt_full",
+ {BACKTRACE_FULL, &Config::VerifyValueEmpty},
},
{
- "fill", {FILL_ON_ALLOC | FILL_ON_FREE, &Config::SetFill},
+ "fill",
+ {FILL_ON_ALLOC | FILL_ON_FREE, &Config::SetFill},
},
{
- "fill_on_alloc", {FILL_ON_ALLOC, &Config::SetFillOnAlloc},
+ "fill_on_alloc",
+ {FILL_ON_ALLOC, &Config::SetFillOnAlloc},
},
{
- "fill_on_free", {FILL_ON_FREE, &Config::SetFillOnFree},
+ "fill_on_free",
+ {FILL_ON_FREE, &Config::SetFillOnFree},
},
{
- "expand_alloc", {EXPAND_ALLOC, &Config::SetExpandAlloc},
+ "expand_alloc",
+ {EXPAND_ALLOC, &Config::SetExpandAlloc},
},
{
- "free_track", {FREE_TRACK | FILL_ON_FREE | TRACK_ALLOCS, &Config::SetFreeTrack},
+ "free_track",
+ {FREE_TRACK | FILL_ON_FREE | TRACK_ALLOCS, &Config::SetFreeTrack},
},
{
- "free_track_backtrace_num_frames", {0, &Config::SetFreeTrackBacktraceNumFrames},
+ "free_track_backtrace_num_frames",
+ {0, &Config::SetFreeTrackBacktraceNumFrames},
},
{
- "leak_track", {LEAK_TRACK | TRACK_ALLOCS, &Config::VerifyValueEmpty},
+ "leak_track",
+ {LEAK_TRACK | TRACK_ALLOCS, &Config::VerifyValueEmpty},
},
{
- "record_allocs", {RECORD_ALLOCS, &Config::SetRecordAllocs},
+ "record_allocs",
+ {RECORD_ALLOCS, &Config::SetRecordAllocs},
},
{
- "record_allocs_file", {0, &Config::SetRecordAllocsFile},
+ "record_allocs_file",
+ {0, &Config::SetRecordAllocsFile},
},
{
- "verify_pointers", {TRACK_ALLOCS, &Config::VerifyValueEmpty},
+ "verify_pointers",
+ {TRACK_ALLOCS, &Config::VerifyValueEmpty},
},
{
- "abort_on_error", {ABORT_ON_ERROR, &Config::VerifyValueEmpty},
+ "abort_on_error",
+ {ABORT_ON_ERROR, &Config::VerifyValueEmpty},
},
{
- "verbose", {VERBOSE, &Config::VerifyValueEmpty},
+ "verbose",
+ {VERBOSE, &Config::VerifyValueEmpty},
+ },
+ {
+ "check_unreachable_on_signal",
+ {CHECK_UNREACHABLE_ON_SIGNAL, &Config::VerifyValueEmpty},
},
};
@@ -274,6 +340,23 @@
return true;
}
+bool Config::SetBacktraceSize(const std::string& option, const std::string& value) {
+ if (!ParseValue(option, value, 1, SIZE_MAX, &backtrace_min_size_bytes_)) {
+ return false;
+ }
+ backtrace_max_size_bytes_ = backtrace_min_size_bytes_;
+
+ return true;
+}
+
+bool Config::SetBacktraceMinSize(const std::string& option, const std::string& value) {
+ return ParseValue(option, value, 1, SIZE_MAX, &backtrace_min_size_bytes_);
+}
+
+bool Config::SetBacktraceMaxSize(const std::string& option, const std::string& value) {
+ return ParseValue(option, value, 1, SIZE_MAX, &backtrace_max_size_bytes_);
+}
+
bool Config::SetExpandAlloc(const std::string& option, const std::string& value) {
return ParseValue(option, value, DEFAULT_EXPAND_BYTES, 1, MAX_EXPAND_BYTES, &expand_alloc_bytes_);
}
@@ -380,6 +463,9 @@
backtrace_enabled_ = false;
backtrace_dump_on_exit_ = false;
backtrace_dump_prefix_ = DEFAULT_BACKTRACE_DUMP_PREFIX;
+ backtrace_min_size_bytes_ = 0;
+ backtrace_max_size_bytes_ = SIZE_MAX;
+ check_unreachable_signal_ = SIGRTMAX - 16;
// Process each option name we can find.
std::string option;
diff --git a/libc/malloc_debug/Config.h b/libc/malloc_debug/Config.h
index 1b5c748..ef1d2a9 100644
--- a/libc/malloc_debug/Config.h
+++ b/libc/malloc_debug/Config.h
@@ -46,6 +46,8 @@
constexpr uint64_t BACKTRACE_FULL = 0x400;
constexpr uint64_t ABORT_ON_ERROR = 0x800;
constexpr uint64_t VERBOSE = 0x1000;
+constexpr uint64_t CHECK_UNREACHABLE_ON_SIGNAL = 0x2000;
+constexpr uint64_t BACKTRACE_SPECIFIC_SIZES = 0x4000;
// In order to guarantee posix compliance, set the minimum alignment
// to 8 bytes for 32 bit systems and 16 bytes for 64 bit systems.
@@ -89,10 +91,15 @@
uint8_t fill_alloc_value() const { return fill_alloc_value_; }
uint8_t fill_free_value() const { return fill_free_value_; }
+ size_t backtrace_min_size_bytes() const { return backtrace_min_size_bytes_; }
+ size_t backtrace_max_size_bytes() const { return backtrace_max_size_bytes_; }
+
int record_allocs_signal() const { return record_allocs_signal_; }
size_t record_allocs_num_entries() const { return record_allocs_num_entries_; }
const std::string& record_allocs_file() const { return record_allocs_file_; }
+ int check_unreachable_signal() const { return check_unreachable_signal_; }
+
private:
struct OptionInfo {
uint64_t option;
@@ -118,6 +125,10 @@
bool SetBacktraceDumpOnExit(const std::string& option, const std::string& value);
bool SetBacktraceDumpPrefix(const std::string& option, const std::string& value);
+ bool SetBacktraceSize(const std::string& option, const std::string& value);
+ bool SetBacktraceMinSize(const std::string& option, const std::string& value);
+ bool SetBacktraceMaxSize(const std::string& option, const std::string& value);
+
bool SetExpandAlloc(const std::string& option, const std::string& value);
bool SetFreeTrack(const std::string& option, const std::string& value);
@@ -142,6 +153,8 @@
size_t backtrace_frames_ = 0;
bool backtrace_dump_on_exit_ = false;
std::string backtrace_dump_prefix_;
+ size_t backtrace_min_size_bytes_ = 0;
+ size_t backtrace_max_size_bytes_ = 0;
size_t fill_on_alloc_bytes_ = 0;
size_t fill_on_free_bytes_ = 0;
@@ -160,4 +173,6 @@
uint8_t fill_free_value_;
uint8_t front_guard_value_;
uint8_t rear_guard_value_;
+
+ int check_unreachable_signal_ = 0;
};
diff --git a/libc/malloc_debug/MapData.cpp b/libc/malloc_debug/MapData.cpp
index ded81a2..b22c109 100644
--- a/libc/malloc_debug/MapData.cpp
+++ b/libc/malloc_debug/MapData.cpp
@@ -210,7 +210,7 @@
}
}
}
- *rel_pc = pc - entry->start + entry->load_bias;
+ *rel_pc = pc - entry->start + entry->offset + entry->load_bias;
}
return entry;
}
diff --git a/libc/malloc_debug/PointerData.cpp b/libc/malloc_debug/PointerData.cpp
index b982c0a..e3a35a6 100644
--- a/libc/malloc_debug/PointerData.cpp
+++ b/libc/malloc_debug/PointerData.cpp
@@ -26,6 +26,7 @@
* SUCH DAMAGE.
*/
+#include <cxxabi.h>
#include <errno.h>
#include <inttypes.h>
#include <signal.h>
@@ -35,6 +36,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <functional>
#include <mutex>
#include <string>
#include <unordered_map>
@@ -53,8 +55,6 @@
#include "malloc_debug.h"
#include "UnwindBacktrace.h"
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
std::atomic_uint8_t PointerData::backtrace_enabled_;
std::atomic_bool PointerData::backtrace_dump_;
@@ -135,7 +135,22 @@
return true;
}
-size_t PointerData::AddBacktrace(size_t num_frames) {
+static inline bool ShouldBacktraceAllocSize(size_t size_bytes) {
+ static bool only_backtrace_specific_sizes =
+ g_debug->config().options() & BACKTRACE_SPECIFIC_SIZES;
+ if (!only_backtrace_specific_sizes) {
+ return true;
+ }
+ static size_t min_size_bytes = g_debug->config().backtrace_min_size_bytes();
+ static size_t max_size_bytes = g_debug->config().backtrace_max_size_bytes();
+ return size_bytes >= min_size_bytes && size_bytes <= max_size_bytes;
+}
+
+size_t PointerData::AddBacktrace(size_t num_frames, size_t size_bytes) {
+ if (!ShouldBacktraceAllocSize(size_bytes)) {
+ return kBacktraceEmptyIndex;
+ }
+
std::vector<uintptr_t> frames;
std::vector<unwindstack::FrameData> frames_info;
if (g_debug->config().options() & BACKTRACE_FULL) {
@@ -148,14 +163,14 @@
if (num_frames == 0) {
return kBacktraceEmptyIndex;
}
+ frames.resize(num_frames);
}
- FrameKeyType key{.num_frames = num_frames, .frames = frames.data()};
+ FrameKeyType key{.num_frames = frames.size(), .frames = frames.data()};
size_t hash_index;
std::lock_guard<std::mutex> frame_guard(frame_mutex_);
auto entry = key_to_index_.find(key);
if (entry == key_to_index_.end()) {
- frames.resize(num_frames);
hash_index = cur_hash_index_++;
key.frames = frames.data();
key_to_index_.emplace(key, hash_index);
@@ -195,40 +210,41 @@
}
void PointerData::Add(const void* ptr, size_t pointer_size) {
- uintptr_t pointer = reinterpret_cast<uintptr_t>(ptr);
size_t hash_index = 0;
if (backtrace_enabled_) {
- hash_index = AddBacktrace(g_debug->config().backtrace_frames());
+ hash_index = AddBacktrace(g_debug->config().backtrace_frames(), pointer_size);
}
std::lock_guard<std::mutex> pointer_guard(pointer_mutex_);
- pointers_[pointer] = PointerInfoType{PointerInfoType::GetEncodedSize(pointer_size), hash_index};
+ uintptr_t mangled_ptr = ManglePointer(reinterpret_cast<uintptr_t>(ptr));
+ pointers_[mangled_ptr] =
+ PointerInfoType{PointerInfoType::GetEncodedSize(pointer_size), hash_index};
}
void PointerData::Remove(const void* ptr) {
- uintptr_t pointer = reinterpret_cast<uintptr_t>(ptr);
size_t hash_index;
{
std::lock_guard<std::mutex> pointer_guard(pointer_mutex_);
- auto entry = pointers_.find(pointer);
+ uintptr_t mangled_ptr = ManglePointer(reinterpret_cast<uintptr_t>(ptr));
+ auto entry = pointers_.find(mangled_ptr);
if (entry == pointers_.end()) {
// Attempt to remove unknown pointer.
- error_log("No tracked pointer found for 0x%" PRIxPTR, pointer);
+ error_log("No tracked pointer found for 0x%" PRIxPTR, DemanglePointer(mangled_ptr));
return;
}
hash_index = entry->second.hash_index;
- pointers_.erase(pointer);
+ pointers_.erase(mangled_ptr);
}
RemoveBacktrace(hash_index);
}
size_t PointerData::GetFrames(const void* ptr, uintptr_t* frames, size_t max_frames) {
- uintptr_t pointer = reinterpret_cast<uintptr_t>(ptr);
size_t hash_index;
{
std::lock_guard<std::mutex> pointer_guard(pointer_mutex_);
- auto entry = pointers_.find(pointer);
+ uintptr_t mangled_ptr = ManglePointer(reinterpret_cast<uintptr_t>(ptr));
+ auto entry = pointers_.find(mangled_ptr);
if (entry == pointers_.end()) {
return 0;
}
@@ -274,7 +290,8 @@
void PointerData::LogFreeError(const FreePointerInfoType& info, size_t max_cmp_bytes) {
error_log(LOG_DIVIDER);
- uint8_t* memory = reinterpret_cast<uint8_t*>(info.pointer);
+ uintptr_t pointer = DemanglePointer(info.mangled_ptr);
+ uint8_t* memory = reinterpret_cast<uint8_t*>(pointer);
error_log("+++ ALLOCATION %p USED AFTER FREE", memory);
uint8_t fill_free_value = g_debug->config().fill_free_value();
for (size_t i = 0; i < max_cmp_bytes; i++) {
@@ -296,13 +313,14 @@
void PointerData::VerifyFreedPointer(const FreePointerInfoType& info) {
size_t usable_size;
+ uintptr_t pointer = DemanglePointer(info.mangled_ptr);
if (g_debug->HeaderEnabled()) {
// Check to see if the tag data has been damaged.
- Header* header = g_debug->GetHeader(reinterpret_cast<const void*>(info.pointer));
+ Header* header = g_debug->GetHeader(reinterpret_cast<const void*>(pointer));
if (header->tag != DEBUG_FREE_TAG) {
error_log(LOG_DIVIDER);
- error_log("+++ ALLOCATION 0x%" PRIxPTR " HAS CORRUPTED HEADER TAG 0x%x AFTER FREE",
- info.pointer, header->tag);
+ error_log("+++ ALLOCATION 0x%" PRIxPTR " HAS CORRUPTED HEADER TAG 0x%x AFTER FREE", pointer,
+ header->tag);
error_log(LOG_DIVIDER);
if (g_debug->config().options() & ABORT_ON_ERROR) {
abort();
@@ -314,14 +332,14 @@
}
usable_size = header->usable_size;
} else {
- usable_size = g_dispatch->malloc_usable_size(reinterpret_cast<const void*>(info.pointer));
+ usable_size = g_dispatch->malloc_usable_size(reinterpret_cast<const void*>(pointer));
}
size_t bytes = (usable_size < g_debug->config().fill_on_free_bytes())
? usable_size
: g_debug->config().fill_on_free_bytes();
size_t max_cmp_bytes = bytes;
- const uint8_t* memory = reinterpret_cast<const uint8_t*>(info.pointer);
+ const uint8_t* memory = reinterpret_cast<const uint8_t*>(pointer);
while (bytes > 0) {
size_t bytes_to_cmp = (bytes < g_cmp_mem.size()) ? bytes : g_cmp_mem.size();
if (memcmp(memory, g_cmp_mem.data(), bytes_to_cmp) != 0) {
@@ -332,13 +350,11 @@
}
}
-void* PointerData::AddFreed(const void* ptr) {
- uintptr_t pointer = reinterpret_cast<uintptr_t>(ptr);
-
+void* PointerData::AddFreed(const void* ptr, size_t size_bytes) {
size_t hash_index = 0;
size_t num_frames = g_debug->config().free_track_backtrace_num_frames();
if (num_frames) {
- hash_index = AddBacktrace(num_frames);
+ hash_index = AddBacktrace(num_frames, size_bytes);
}
void* last = nullptr;
@@ -348,10 +364,11 @@
free_pointers_.pop_front();
VerifyFreedPointer(info);
RemoveBacktrace(info.hash_index);
- last = reinterpret_cast<void*>(info.pointer);
+ last = reinterpret_cast<void*>(DemanglePointer(info.mangled_ptr));
}
- free_pointers_.emplace_back(FreePointerInfoType{pointer, hash_index});
+ uintptr_t mangled_ptr = ManglePointer(reinterpret_cast<uintptr_t>(ptr));
+ free_pointers_.emplace_back(FreePointerInfoType{mangled_ptr, hash_index});
return last;
}
@@ -361,7 +378,7 @@
uintptr_t pointer = reinterpret_cast<uintptr_t>(ptr);
std::lock_guard<std::mutex> freed_guard(free_pointer_mutex_);
for (const auto& info : free_pointers_) {
- if (info.pointer == pointer) {
+ if (DemanglePointer(info.mangled_ptr) == pointer) {
hash_index = info.hash_index;
break;
}
@@ -388,6 +405,7 @@
for (const auto& entry : pointers_) {
FrameInfoType* frame_info = nullptr;
std::vector<unwindstack::FrameData>* backtrace_info = nullptr;
+ uintptr_t pointer = DemanglePointer(entry.first);
size_t hash_index = entry.second.hash_index;
if (hash_index > kBacktraceEmptyIndex) {
auto frame_entry = frames_.find(hash_index);
@@ -397,7 +415,7 @@
// occurs after the hash_index and frame data have been added.
// When removing a pointer, the pointer is deleted before the frame
// data.
- error_log("Pointer 0x%" PRIxPTR " hash_index %zu does not exist.", entry.first, hash_index);
+ error_log("Pointer 0x%" PRIxPTR " hash_index %zu does not exist.", pointer, hash_index);
} else {
frame_info = &frame_entry->second;
}
@@ -405,7 +423,7 @@
if (g_debug->config().options() & BACKTRACE_FULL) {
auto backtrace_entry = backtraces_info_.find(hash_index);
if (backtrace_entry == backtraces_info_.end()) {
- error_log("Pointer 0x%" PRIxPTR " hash_index %zu does not exist.", entry.first, hash_index);
+ error_log("Pointer 0x%" PRIxPTR " hash_index %zu does not exist.", pointer, hash_index);
} else {
backtrace_info = &backtrace_entry->second;
}
@@ -415,7 +433,7 @@
continue;
}
- list->emplace_back(ListInfoType{entry.first, 1, entry.second.RealSize(),
+ list->emplace_back(ListInfoType{pointer, 1, entry.second.RealSize(),
entry.second.ZygoteChildAlloc(), frame_info, backtrace_info});
}
@@ -550,9 +568,9 @@
}
bool PointerData::Exists(const void* ptr) {
- uintptr_t pointer = reinterpret_cast<uintptr_t>(ptr);
std::lock_guard<std::mutex> pointer_guard(pointer_mutex_);
- return pointers_.count(pointer) != 0;
+ uintptr_t mangled_ptr = ManglePointer(reinterpret_cast<uintptr_t>(ptr));
+ return pointers_.count(mangled_ptr) != 0;
}
void PointerData::DumpLiveToFile(int fd) {
@@ -598,8 +616,8 @@
if (frame.function_name.empty()) {
dprintf(fd, " \"\" 0}");
} else {
- char* demangled_name = __cxa_demangle(frame.function_name.c_str(), nullptr, nullptr,
- nullptr);
+ char* demangled_name =
+ abi::__cxa_demangle(frame.function_name.c_str(), nullptr, nullptr, nullptr);
const char* name;
if (demangled_name != nullptr) {
name = demangled_name;
@@ -637,3 +655,10 @@
free_pointer_mutex_.try_lock();
free_pointer_mutex_.unlock();
}
+
+void PointerData::IteratePointers(std::function<void(uintptr_t pointer)> fn) {
+ std::lock_guard<std::mutex> pointer_guard(pointer_mutex_);
+ for (const auto entry : pointers_) {
+ fn(DemanglePointer(entry.first));
+ }
+}
diff --git a/libc/malloc_debug/PointerData.h b/libc/malloc_debug/PointerData.h
index 92d2653..3194bab 100644
--- a/libc/malloc_debug/PointerData.h
+++ b/libc/malloc_debug/PointerData.h
@@ -33,6 +33,7 @@
#include <atomic>
#include <deque>
+#include <functional>
#include <mutex>
#include <string>
#include <unordered_map>
@@ -99,7 +100,7 @@
};
struct FreePointerInfoType {
- uintptr_t pointer;
+ uintptr_t mangled_ptr;
size_t hash_index;
};
@@ -134,17 +135,15 @@
void PostForkParent();
void PostForkChild();
- static size_t AddBacktrace(size_t num_frames);
+ static void IteratePointers(std::function<void(uintptr_t pointer)> fn);
+
+ static size_t AddBacktrace(size_t num_frames, size_t size_bytes);
static void RemoveBacktrace(size_t hash_index);
static void Add(const void* pointer, size_t size);
static void Remove(const void* pointer);
- typedef std::unordered_map<uintptr_t, PointerInfoType>::iterator iterator;
- static iterator begin() { return pointers_.begin(); }
- static iterator end() { return pointers_.end(); }
-
- static void* AddFreed(const void* pointer);
+ static void* AddFreed(const void* pointer, size_t size_bytes);
static void LogFreeError(const FreePointerInfoType& info, size_t usable_size);
static void LogFreeBacktrace(const void* ptr);
static void VerifyFreedPointer(const FreePointerInfoType& info);
@@ -162,6 +161,12 @@
static bool Exists(const void* pointer);
private:
+ // Only keep mangled pointers in internal data structures. This avoids
+ // problems where libmemunreachable finds these pointers and thinks they
+ // are not unreachable.
+ static inline uintptr_t ManglePointer(uintptr_t pointer) { return pointer ^ UINTPTR_MAX; }
+ static inline uintptr_t DemanglePointer(uintptr_t pointer) { return pointer ^ UINTPTR_MAX; }
+
static std::string GetHashString(uintptr_t* frames, size_t num_frames);
static void LogBacktrace(size_t hash_index);
diff --git a/libc/malloc_debug/README.md b/libc/malloc_debug/README.md
index 662f5f8..fddc4a3 100644
--- a/libc/malloc_debug/README.md
+++ b/libc/malloc_debug/README.md
@@ -114,7 +114,7 @@
option will not add a special header.
As of P, this option will also enable dumping backtrace heap data to a
-file when the process receives the signal SIGRTMAX - 17 ( which is 47 on most
+file when the process receives the signal SIGRTMAX - 17 ( which is 47 on
Android devices). The format of this dumped data is the same format as
that dumped when running am dumpheap -n. The default is to dump this data
to the file /data/local/tmp/backtrace\_heap.**PID**.txt. This is useful when
@@ -127,7 +127,7 @@
### backtrace\_enable\_on\_signal[=MAX\_FRAMES]
Enable capturing the backtrace of each allocation site. If the
backtrace capture is toggled when the process receives the signal
-SIGRTMAX - 19 (which is 45 on most Android devices). When this
+SIGRTMAX - 19 (which is 45 on Android devices). When this
option is used alone, backtrace capture starts out disabled until the signal
is received. If both this option and the backtrace option are set, then
backtrace capture is enabled until the signal is received.
@@ -160,11 +160,83 @@
on the signal will be backtrace\_dump\_prefix.**PID**.txt. The filename chosen
when the program exits will be backtrace\_dump\_prefix.**PID**.exit.txt.
+### backtrace\_min\_size=ALLOCATION\_SIZE\_BYTES
+As of U, setting this in combination with the backtrace option means
+that only allocations of a size greater than or equal to
+**ALLOCATION\_SIZE\_BYTES** will be backtraced. When used in combination
+with the backtrace\_max\_size option, then allocations greater than or
+equal to backtrace\_min\_size and less than or equal to
+backtrace\_max\_size will be backtraced. The backtrace\_size option
+overrides this option, and should not be used at the same time.
+
+This option can also be used in combination with other tools such
+as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/master/README.md)
+to only get backtraces for sizes of allocations listed as being leaked.
+
+### backtrace\_max\_size=ALLOCATION\_SIZE\_BYTES
+As of U, setting this in combination with the backtrace option means
+that only allocations of a size less than or equal to
+**ALLOCATION\_SIZE\_BYTES** will be backtraced. When used in combination
+with the backtrace\_min\_size option, then allocations greater than or
+equal to backtrace\_min\_size and less than or equal to
+backtrace\_max\_size will be backtraced. The backtrace\_size option
+overrides this option, and should not be used at the same time.
+
+This option can also be used in combination with other tools such
+as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/master/README.md)
+to only get backtraces for sizes of allocations listed as being leaked.
+
+### backtrace\_size=ALLOCATION\_SIZE\_BYTES
+As of U, setting this in combination with the backtrace option means
+that only allocations of size **ALLOCATION\_SIZE\_BYTES** will be backtraced.
+This option overrides the backtrace\_min\_size and the backtrace\_max\_size.
+
+This option can also be used in combination with other tools such
+as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/master/README.md)
+to only get backtraces for sizes of allocations listed as being leaked.
+
### backtrace\_full
As of Q, any time that a backtrace is gathered, a different algorithm is used
that is extra thorough and can unwind through Java frames. This will run
slower than the normal backtracing function.
+### bt, bt\_dmp\_on\_ex, bt\_dmp\_pre, bt\_en\_on\_sig, bt\_full, bt\_max\_sz, bt\_min\_sz, bt\_sz
+As of U, add shorter aliases for backtrace related options to avoid property length restrictions.
+
+| Alias | Option |
+|:----------------|:------------------------------|
+| bt | backtrace |
+| bt\_dmp\_on\_ex | backtrace\_dump\_on\_exit |
+| bt\_dmp\_pre | backtrace\_dump\_prefix |
+| bt\_en\_on\_sig | backtrace\_enable\_on\_signal |
+| bt\_full | backtrace\_full |
+| bt\_max\_sz | backtrace\_max\_size |
+| bt\_min\_sz | backtrace\_min\_size |
+| bt\_sz | backtrace\_size |
+
+### check\_unreachable\_on\_signal
+As of Android U, this option will trigger a check for unreachable memory
+in a process. Specifically, if the signal SIGRTMAX - 16 (which is 48 on
+Android devices). The best way to see the exact signal being used is to
+enable the verbose option then look at the log for the message:
+
+ Run: 'kill -48 <PID>' to check for unreachable memory.
+
+When the signal is received, the actual unreachable check only triggers
+on the next allocation that happens in the process (malloc/free, etc).
+
+If a process is not doing any allocations, it can be forced to trigger when
+running:
+
+ debuggerd -b <PID>
+
+**NOTE**: The unreachable check can fail for protected processes, so it
+might be necessary to run:
+
+ setenforce 0
+
+To get the unreachable data.
+
### fill\_on\_alloc[=MAX\_FILLED\_BYTES]
Any allocation routine, other than calloc, will result in the allocation being
filled with the value 0xeb. When doing a realloc to a larger size, the bytes
@@ -270,7 +342,7 @@
### record\_allocs[=TOTAL\_ENTRIES]
Keep track of every allocation/free made on every thread and dump them
-to a file when the signal SIGRTMAX - 18 (which is 46 on most Android devices)
+to a file when the signal SIGRTMAX - 18 (which is 46 on Android devices)
is received.
If TOTAL\_ENTRIES is set, then it indicates the total number of
diff --git a/libc/malloc_debug/RecordData.cpp b/libc/malloc_debug/RecordData.cpp
index 5c550c0..8a77170 100644
--- a/libc/malloc_debug/RecordData.cpp
+++ b/libc/malloc_debug/RecordData.cpp
@@ -28,6 +28,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <pthread.h>
#include <stdatomic.h>
#include <stdint.h>
@@ -48,44 +49,55 @@
RecordEntry::RecordEntry() : tid_(gettid()) {
}
-std::string ThreadCompleteEntry::GetString() const {
- return android::base::StringPrintf("%d: thread_done 0x0\n", tid_);
+bool ThreadCompleteEntry::Write(int fd) const {
+ return dprintf(fd, "%d: thread_done 0x0\n", tid_) > 0;
}
-AllocEntry::AllocEntry(void* pointer) : pointer_(pointer) {}
+AllocEntry::AllocEntry(void* pointer, uint64_t start_ns, uint64_t end_ns)
+ : pointer_(pointer), start_ns_(start_ns), end_ns_(end_ns) {}
-MallocEntry::MallocEntry(void* pointer, size_t size) : AllocEntry(pointer), size_(size) {}
+MallocEntry::MallocEntry(void* pointer, size_t size, uint64_t start_ns, uint64_t end_ns)
+ : AllocEntry(pointer, start_ns, end_ns), size_(size) {}
-std::string MallocEntry::GetString() const {
- return android::base::StringPrintf("%d: malloc %p %zu\n", tid_, pointer_, size_);
+bool MallocEntry::Write(int fd) const {
+ return dprintf(fd, "%d: malloc %p %zu %" PRIu64 " %" PRIu64 "\n", tid_, pointer_, size_,
+ start_ns_, end_ns_) > 0;
}
-FreeEntry::FreeEntry(void* pointer) : AllocEntry(pointer) {}
+FreeEntry::FreeEntry(void* pointer, uint64_t start_ns, uint64_t end_ns)
+ : AllocEntry(pointer, start_ns, end_ns) {}
-std::string FreeEntry::GetString() const {
- return android::base::StringPrintf("%d: free %p\n", tid_, pointer_);
+bool FreeEntry::Write(int fd) const {
+ return dprintf(fd, "%d: free %p %" PRIu64 " %" PRIu64 "\n", tid_, pointer_, start_ns_, end_ns_) >
+ 0;
}
-CallocEntry::CallocEntry(void* pointer, size_t nmemb, size_t size)
- : MallocEntry(pointer, size), nmemb_(nmemb) {}
+CallocEntry::CallocEntry(void* pointer, size_t nmemb, size_t size, uint64_t start_ns,
+ uint64_t end_ns)
+ : MallocEntry(pointer, size, start_ns, end_ns), nmemb_(nmemb) {}
-std::string CallocEntry::GetString() const {
- return android::base::StringPrintf("%d: calloc %p %zu %zu\n", tid_, pointer_, nmemb_, size_);
+bool CallocEntry::Write(int fd) const {
+ return dprintf(fd, "%d: calloc %p %zu %zu %" PRIu64 " %" PRIu64 "\n", tid_, pointer_, nmemb_,
+ size_, start_ns_, end_ns_) > 0;
}
-ReallocEntry::ReallocEntry(void* pointer, size_t size, void* old_pointer)
- : MallocEntry(pointer, size), old_pointer_(old_pointer) {}
+ReallocEntry::ReallocEntry(void* pointer, size_t size, void* old_pointer, uint64_t start_ns,
+ uint64_t end_ns)
+ : MallocEntry(pointer, size, start_ns, end_ns), old_pointer_(old_pointer) {}
-std::string ReallocEntry::GetString() const {
- return android::base::StringPrintf("%d: realloc %p %p %zu\n", tid_, pointer_, old_pointer_, size_);
+bool ReallocEntry::Write(int fd) const {
+ return dprintf(fd, "%d: realloc %p %p %zu %" PRIu64 " %" PRIu64 "\n", tid_, pointer_,
+ old_pointer_, size_, start_ns_, end_ns_) > 0;
}
// aligned_alloc, posix_memalign, memalign, pvalloc, valloc all recorded with this class.
-MemalignEntry::MemalignEntry(void* pointer, size_t size, size_t alignment)
- : MallocEntry(pointer, size), alignment_(alignment) {}
+MemalignEntry::MemalignEntry(void* pointer, size_t size, size_t alignment, uint64_t start_ns,
+ uint64_t end_ns)
+ : MallocEntry(pointer, size, start_ns, end_ns), alignment_(alignment) {}
-std::string MemalignEntry::GetString() const {
- return android::base::StringPrintf("%d: memalign %p %zu %zu\n", tid_, pointer_, alignment_, size_);
+bool MemalignEntry::Write(int fd) const {
+ return dprintf(fd, "%d: memalign %p %zu %zu %" PRIu64 " %" PRIu64 "\n", tid_, pointer_,
+ alignment_, size_, start_ns_, end_ns_) > 0;
}
struct ThreadData {
@@ -112,59 +124,37 @@
}
}
-static void RecordDump(int, siginfo_t*, void*) {
- // It's not necessarily safe to do the dump here, instead wait for the
- // next allocation call to do the dump.
- g_debug->record->SetToDump();
+RecordData* RecordData::record_obj_ = nullptr;
+
+void RecordData::WriteData(int, siginfo_t*, void*) {
+ // Dump from here, the function must not allocate so this is safe.
+ record_obj_->WriteEntries();
}
-void RecordData::Dump() {
- std::lock_guard<std::mutex> lock(dump_lock_);
-
- // Make it so that no more entries can be added while dumping.
- unsigned int last_entry_index = cur_index_.exchange(static_cast<unsigned int>(num_entries_));
- if (dump_ == false) {
- // Multiple Dump() calls from different threads, and we lost. Do nothing.
+void RecordData::WriteEntries() {
+ std::lock_guard<std::mutex> entries_lock(entries_lock_);
+ if (cur_index_ == 0) {
+ info_log("No alloc entries to write.");
return;
}
- // cur_index_ keeps getting incremented even if we hit the num_entries_.
- // If that happens, cap the entries to dump by num_entries_.
- if (last_entry_index > num_entries_) {
- last_entry_index = num_entries_;
- }
-
int dump_fd =
open(dump_file_.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW, 0755);
- if (dump_fd != -1) {
- for (size_t i = 0; i < last_entry_index; i++) {
- std::string line = entries_[i]->GetString();
- ssize_t bytes = write(dump_fd, line.c_str(), line.length());
- if (bytes == -1 || static_cast<size_t>(bytes) != line.length()) {
- error_log("Failed to write record alloc information: %s", strerror(errno));
- // Free all of the rest of the errors, we don't have any way
- // to dump a partial list of the entries.
- for (i++; i < last_entry_index; i++) {
- delete entries_[i];
- entries_[i] = nullptr;
- }
- break;
- }
- delete entries_[i];
- entries_[i] = nullptr;
- }
- close(dump_fd);
-
- // Mark the entries dumped.
- cur_index_ = 0U;
- } else {
+ if (dump_fd == -1) {
error_log("Cannot create record alloc file %s: %s", dump_file_.c_str(), strerror(errno));
- // Since we couldn't create the file, reset the entries dumped back
- // to the original value.
- cur_index_ = last_entry_index;
+ return;
}
- dump_ = false;
+ for (size_t i = 0; i < cur_index_; i++) {
+ if (!entries_[i]->Write(dump_fd)) {
+ error_log("Failed to write record alloc information: %s", strerror(errno));
+ break;
+ }
+ }
+ close(dump_fd);
+
+ // Mark the entries dumped.
+ cur_index_ = 0U;
}
RecordData::RecordData() {
@@ -172,8 +162,9 @@
}
bool RecordData::Initialize(const Config& config) {
+ record_obj_ = this;
struct sigaction64 dump_act = {};
- dump_act.sa_sigaction = RecordDump;
+ dump_act.sa_sigaction = RecordData::WriteData;
dump_act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
if (sigaction64(config.record_allocs_signal(), &dump_act, nullptr) != 0) {
error_log("Unable to set up record dump signal function: %s", strerror(errno));
@@ -186,24 +177,27 @@
config.record_allocs_signal(), getpid());
}
- num_entries_ = config.record_allocs_num_entries();
- entries_ = new const RecordEntry*[num_entries_];
- cur_index_ = 0;
- dump_ = false;
+ entries_.resize(config.record_allocs_num_entries());
+ cur_index_ = 0U;
dump_file_ = config.record_allocs_file();
return true;
}
RecordData::~RecordData() {
- delete[] entries_;
pthread_key_delete(key_);
}
void RecordData::AddEntryOnly(const RecordEntry* entry) {
- unsigned int entry_index = cur_index_.fetch_add(1);
- if (entry_index < num_entries_) {
- entries_[entry_index] = entry;
+ std::lock_guard<std::mutex> entries_lock(entries_lock_);
+ if (cur_index_ == entries_.size()) {
+ // Maxed out, throw the entry away.
+ return;
+ }
+
+ entries_[cur_index_++].reset(entry);
+ if (cur_index_ == entries_.size()) {
+ info_log("Maximum number of records added, all new operations will be dropped.");
}
}
@@ -215,9 +209,4 @@
}
AddEntryOnly(entry);
-
- // Check to see if it's time to dump the entries.
- if (dump_) {
- Dump();
- }
}
diff --git a/libc/malloc_debug/RecordData.h b/libc/malloc_debug/RecordData.h
index 3d37529..a02c956 100644
--- a/libc/malloc_debug/RecordData.h
+++ b/libc/malloc_debug/RecordData.h
@@ -29,12 +29,15 @@
#pragma once
#include <pthread.h>
+#include <signal.h>
#include <stdint.h>
#include <unistd.h>
#include <atomic>
+#include <memory>
#include <mutex>
#include <string>
+#include <vector>
#include <platform/bionic/macros.h>
@@ -43,7 +46,7 @@
RecordEntry();
virtual ~RecordEntry() = default;
- virtual std::string GetString() const = 0;
+ virtual bool Write(int fd) const = 0;
protected:
pid_t tid_;
@@ -57,7 +60,7 @@
ThreadCompleteEntry() = default;
virtual ~ThreadCompleteEntry() = default;
- std::string GetString() const override;
+ bool Write(int fd) const override;
private:
BIONIC_DISALLOW_COPY_AND_ASSIGN(ThreadCompleteEntry);
@@ -65,22 +68,26 @@
class AllocEntry : public RecordEntry {
public:
- explicit AllocEntry(void* pointer);
+ explicit AllocEntry(void* pointer, uint64_t st, uint64_t et);
virtual ~AllocEntry() = default;
protected:
void* pointer_;
+ // The start/end time of this operation.
+ uint64_t start_ns_;
+ uint64_t end_ns_;
+
private:
BIONIC_DISALLOW_COPY_AND_ASSIGN(AllocEntry);
};
class MallocEntry : public AllocEntry {
public:
- MallocEntry(void* pointer, size_t size);
+ MallocEntry(void* pointer, size_t size, uint64_t st, uint64_t et);
virtual ~MallocEntry() = default;
- std::string GetString() const override;
+ bool Write(int fd) const override;
protected:
size_t size_;
@@ -91,10 +98,10 @@
class FreeEntry : public AllocEntry {
public:
- explicit FreeEntry(void* pointer);
+ explicit FreeEntry(void* pointer, uint64_t st, uint64_t et);
virtual ~FreeEntry() = default;
- std::string GetString() const override;
+ bool Write(int fd) const override;
private:
BIONIC_DISALLOW_COPY_AND_ASSIGN(FreeEntry);
@@ -102,10 +109,10 @@
class CallocEntry : public MallocEntry {
public:
- CallocEntry(void* pointer, size_t size, size_t nmemb);
+ CallocEntry(void* pointer, size_t nmemb, size_t size, uint64_t st, uint64_t et);
virtual ~CallocEntry() = default;
- std::string GetString() const override;
+ bool Write(int fd) const override;
protected:
size_t nmemb_;
@@ -116,10 +123,10 @@
class ReallocEntry : public MallocEntry {
public:
- ReallocEntry(void* pointer, size_t size, void* old_pointer);
+ ReallocEntry(void* pointer, size_t size, void* old_pointer, uint64_t st, uint64_t et);
virtual ~ReallocEntry() = default;
- std::string GetString() const override;
+ bool Write(int fd) const override;
protected:
void* old_pointer_;
@@ -131,10 +138,10 @@
// aligned_alloc, posix_memalign, memalign, pvalloc, valloc all recorded with this class.
class MemalignEntry : public MallocEntry {
public:
- MemalignEntry(void* pointer, size_t size, size_t alignment);
+ MemalignEntry(void* pointer, size_t size, size_t alignment, uint64_t st, uint64_t et);
virtual ~MemalignEntry() = default;
- std::string GetString() const override;
+ bool Write(int fd) const override;
protected:
size_t alignment_;
@@ -155,19 +162,18 @@
void AddEntry(const RecordEntry* entry);
void AddEntryOnly(const RecordEntry* entry);
- void SetToDump() { dump_ = true; }
-
pthread_key_t key() { return key_; }
private:
- void Dump();
+ static void WriteData(int, siginfo_t*, void*);
+ static RecordData* record_obj_;
- std::mutex dump_lock_;
+ void WriteEntries();
+
+ std::mutex entries_lock_;
pthread_key_t key_;
- const RecordEntry** entries_ = nullptr;
- size_t num_entries_ = 0;
- std::atomic_uint cur_index_;
- std::atomic_bool dump_;
+ std::vector<std::unique_ptr<const RecordEntry>> entries_;
+ size_t cur_index_;
std::string dump_file_;
BIONIC_DISALLOW_COPY_AND_ASSIGN(RecordData);
diff --git a/libc/malloc_debug/Unreachable.cpp b/libc/malloc_debug/Unreachable.cpp
new file mode 100644
index 0000000..af47257
--- /dev/null
+++ b/libc/malloc_debug/Unreachable.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <signal.h>
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <atomic>
+#include <string>
+
+#include <memunreachable/memunreachable.h>
+#include <platform/bionic/macros.h>
+
+#include "Config.h"
+#include "Unreachable.h"
+#include "debug_log.h"
+
+std::atomic_bool Unreachable::do_check_;
+
+static void EnableUnreachableCheck(int, struct siginfo*, void*) {
+ Unreachable::EnableCheck();
+}
+
+void Unreachable::CheckIfRequested(const Config& config) {
+ if ((config.options() & CHECK_UNREACHABLE_ON_SIGNAL) && do_check_.exchange(false)) {
+ info_log("Starting to check for unreachable memory.");
+ if (!LogUnreachableMemory(false, 100)) {
+ error_log("Unreachable check failed, run setenforce 0 and try again.");
+ }
+ }
+}
+
+bool Unreachable::Initialize(const Config& config) {
+ if (!(config.options() & CHECK_UNREACHABLE_ON_SIGNAL)) {
+ return true;
+ }
+
+ struct sigaction64 unreachable_act = {};
+ unreachable_act.sa_sigaction = EnableUnreachableCheck;
+ unreachable_act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
+ if (sigaction64(config.check_unreachable_signal(), &unreachable_act, nullptr) != 0) {
+ error_log("Unable to set up check unreachable signal function: %s", strerror(errno));
+ return false;
+ }
+
+ if (config.options() & VERBOSE) {
+ info_log("%s: Run: 'kill -%d %d' to check for unreachable memory.", getprogname(),
+ config.check_unreachable_signal(), getpid());
+ }
+
+ return true;
+}
diff --git a/libc/include/android/legacy_sys_stat_inlines.h b/libc/malloc_debug/Unreachable.h
similarity index 75%
copy from libc/include/android/legacy_sys_stat_inlines.h
copy to libc/malloc_debug/Unreachable.h
index d42ac01..36c0bdb 100644
--- a/libc/include/android/legacy_sys_stat_inlines.h
+++ b/libc/malloc_debug/Unreachable.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,18 +28,22 @@
#pragma once
-#include <sys/cdefs.h>
+#include <stdint.h>
-#if __ANDROID_API__ < 21
+#include <atomic>
-#include <sys/stat.h>
+// Forward declarations
+class ConfigData;
-__BEGIN_DECLS
+class Unreachable {
+ public:
+ static bool Initialize(const Config& config);
+ static void CheckIfRequested(const Config& config);
-static __inline int mkfifo(const char* __path, mode_t __mode) {
- return mknod(__path, (__mode & ~S_IFMT) | S_IFIFO, (dev_t)0);
-}
+ static void EnableCheck() { do_check_ = true; }
-__END_DECLS
+ private:
+ static std::atomic_bool do_check_;
-#endif
+ BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(Unreachable);
+};
diff --git a/libc/malloc_debug/UnwindBacktrace.cpp b/libc/malloc_debug/UnwindBacktrace.cpp
index f6c3e69..8a6ff7b 100644
--- a/libc/malloc_debug/UnwindBacktrace.cpp
+++ b/libc/malloc_debug/UnwindBacktrace.cpp
@@ -26,6 +26,7 @@
* SUCH DAMAGE.
*/
+#include <cxxabi.h>
#include <inttypes.h>
#include <pthread.h>
#include <stdint.h>
@@ -36,11 +37,7 @@
#include <vector>
#include <android-base/stringprintf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsGetLocal.h>
+#include <unwindstack/AndroidUnwinder.h>
#include <unwindstack/Unwinder.h>
#include "UnwindBacktrace.h"
@@ -52,53 +49,22 @@
#define PAD_PTR "08" PRIx64
#endif
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
-static pthread_once_t g_setup_once = PTHREAD_ONCE_INIT;
-
-static unwindstack::LocalUpdatableMaps* g_maps;
-static std::shared_ptr<unwindstack::Memory> g_process_memory;
-#if defined(__LP64__)
-static std::vector<std::string> g_skip_libraries{"/system/lib64/libunwindstack.so",
- "/system/lib64/libc_malloc_debug.so"};
-#else
-static std::vector<std::string> g_skip_libraries{"/system/lib/libunwindstack.so",
- "/system/lib/libc_malloc_debug.so"};
-#endif
-
-static void Setup() {
- g_maps = new unwindstack::LocalUpdatableMaps;
- if (!g_maps->Parse()) {
- delete g_maps;
- g_maps = nullptr;
- }
-
- g_process_memory = unwindstack::Memory::CreateProcessMemoryThreadCached(getpid());
-}
-
bool Unwind(std::vector<uintptr_t>* frames, std::vector<unwindstack::FrameData>* frame_info,
size_t max_frames) {
- pthread_once(&g_setup_once, Setup);
-
- if (g_maps == nullptr) {
- return false;
- }
-
- std::unique_ptr<unwindstack::Regs> regs(unwindstack::Regs::CreateFromLocal());
- unwindstack::RegsGetLocal(regs.get());
- unwindstack::Unwinder unwinder(max_frames, g_maps, regs.get(), g_process_memory);
- unwinder.Unwind(&g_skip_libraries);
- if (unwinder.NumFrames() == 0) {
+ [[clang::no_destroy]] static unwindstack::AndroidLocalUnwinder unwinder(
+ std::vector<std::string>{"libc_malloc_debug.so"});
+ unwindstack::AndroidUnwinderData data(max_frames);
+ if (!unwinder.Unwind(data)) {
frames->clear();
frame_info->clear();
return false;
}
- *frame_info = unwinder.ConsumeFrames();
- frames->resize(frame_info->size());
- for (size_t i = 0; i < frame_info->size(); i++) {
- frames->at(i) = frame_info->at(i).pc;
+ frames->resize(data.frames.size());
+ for (const auto& frame : data.frames) {
+ frames->at(frame.num) = frame.pc;
}
+ *frame_info = std::move(data.frames);
return true;
}
@@ -122,7 +88,8 @@
if (!info->function_name.empty()) {
line += " (";
- char* demangled_name = __cxa_demangle(info->function_name.c_str(), nullptr, nullptr, nullptr);
+ char* demangled_name =
+ abi::__cxa_demangle(info->function_name.c_str(), nullptr, nullptr, nullptr);
if (demangled_name != nullptr) {
line += demangled_name;
free(demangled_name);
diff --git a/libc/malloc_debug/UnwindBacktrace.h b/libc/malloc_debug/UnwindBacktrace.h
index 7f89907..091865e 100644
--- a/libc/malloc_debug/UnwindBacktrace.h
+++ b/libc/malloc_debug/UnwindBacktrace.h
@@ -30,10 +30,8 @@
#include <stdint.h>
-#include <string>
#include <vector>
-#include <unwindstack/MapInfo.h>
#include <unwindstack/Unwinder.h>
bool Unwind(std::vector<uintptr_t>* frames, std::vector<unwindstack::FrameData>* info,
diff --git a/libc/malloc_debug/backtrace.cpp b/libc/malloc_debug/backtrace.cpp
index ab5c505..ecb3a80 100644
--- a/libc/malloc_debug/backtrace.cpp
+++ b/libc/malloc_debug/backtrace.cpp
@@ -26,6 +26,7 @@
* SUCH DAMAGE.
*/
+#include <cxxabi.h>
#include <dlfcn.h>
#include <errno.h>
#include <inttypes.h>
@@ -48,8 +49,6 @@
typedef struct _Unwind_Context __unwind_context;
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
static MapData g_map_data;
static const MapEntry* g_current_code_map = nullptr;
@@ -83,41 +82,24 @@
uintptr_t ip = _Unwind_GetIP(context);
- // The instruction pointer is pointing at the instruction after the return
- // call on all architectures.
- // Modify the pc to point at the real function.
- if (ip != 0) {
-#if defined(__arm__)
- // If the ip is suspiciously low, do nothing to avoid a segfault trying
- // to access this memory.
- if (ip >= 4096) {
- // Check bits [15:11] of the first halfword assuming the instruction
- // is 32 bits long. If the bits are any of these values, then our
- // assumption was correct:
- // b11101
- // b11110
- // b11111
- // Otherwise, this is a 16 bit instruction.
- uint16_t value = (*reinterpret_cast<uint16_t*>(ip - 2)) >> 11;
- if (value == 0x1f || value == 0x1e || value == 0x1d) {
- ip -= 4;
- } else {
- ip -= 2;
- }
- }
-#elif defined(__aarch64__)
- // All instructions are 4 bytes long, skip back one instruction.
- ip -= 4;
+ // `ip` is the address of the instruction *after* the call site in
+ // `context`, so we want to back up by one instruction. This is hard for
+ // every architecture except arm64, so we just make sure we're *inside*
+ // that instruction, not necessarily at the start of it. (If the value
+ // is too low to be valid, we just leave it alone.)
+ if (ip >= 4096) {
+#if defined(__aarch64__)
+ ip -= 4; // Exactly.
+#elif defined(__arm__) || defined(__riscv)
+ ip -= 2; // At least.
#elif defined(__i386__) || defined(__x86_64__)
- // It's difficult to decode exactly where the previous instruction is,
- // so subtract 1 to estimate where the instruction lives.
- ip--;
+ ip -= 1; // At least.
#endif
+ }
- // Do not record the frames that fall in our own shared library.
- if (g_current_code_map && (ip >= g_current_code_map->start) && ip < g_current_code_map->end) {
- return _URC_NO_REASON;
- }
+ // Do not record the frames that fall in our own shared library.
+ if (g_current_code_map && (ip >= g_current_code_map->start) && ip < g_current_code_map->end) {
+ return _URC_NO_REASON;
}
state->frames[state->cur_frame++] = ip;
@@ -162,7 +144,7 @@
char buf[1024];
if (symbol != nullptr) {
- char* demangled_name = __cxa_demangle(symbol, nullptr, nullptr, nullptr);
+ char* demangled_name = abi::__cxa_demangle(symbol, nullptr, nullptr, nullptr);
const char* name;
if (demangled_name != nullptr) {
name = demangled_name;
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index 9f38946..b06ec9e 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -53,11 +53,12 @@
#include "Config.h"
#include "DebugData.h"
+#include "Unreachable.h"
+#include "UnwindBacktrace.h"
#include "backtrace.h"
#include "debug_disable.h"
#include "debug_log.h"
#include "malloc_debug.h"
-#include "UnwindBacktrace.h"
// ------------------------------------------------------------------------
// Global Data
@@ -67,6 +68,100 @@
bool* g_zygote_child;
const MallocDispatch* g_dispatch;
+
+static __always_inline uint64_t Nanotime() {
+ struct timespec t = {};
+ clock_gettime(CLOCK_MONOTONIC, &t);
+ return static_cast<uint64_t>(t.tv_sec) * 1000000000LL + t.tv_nsec;
+}
+
+namespace {
+// A TimedResult contains the result of from malloc end_ns al. functions and the
+// start/end timestamps.
+struct TimedResult {
+ uint64_t start_ns = 0;
+ uint64_t end_ns = 0;
+ union {
+ size_t s;
+ int i;
+ void* p;
+ } v;
+
+ uint64_t GetStartTimeNS() const { return start_ns; }
+ uint64_t GetEndTimeNS() const { return end_ns; }
+ void SetStartTimeNS(uint64_t t) { start_ns = t; }
+ void SetEndTimeNS(uint64_t t) { end_ns = t; }
+
+ template <typename T>
+ void setValue(T);
+ template <>
+ void setValue(size_t s) {
+ v.s = s;
+ }
+ template <>
+ void setValue(int i) {
+ v.i = i;
+ }
+ template <>
+ void setValue(void* p) {
+ v.p = p;
+ }
+
+ template <typename T>
+ T getValue() const;
+ template <>
+ size_t getValue<size_t>() const {
+ return v.s;
+ }
+ template <>
+ int getValue<int>() const {
+ return v.i;
+ }
+ template <>
+ void* getValue<void*>() const {
+ return v.p;
+ }
+};
+
+class ScopedTimer {
+ public:
+ ScopedTimer(TimedResult& res) : res_(res) { res_.start_ns = Nanotime(); }
+
+ ~ScopedTimer() { res_.end_ns = Nanotime(); }
+
+ private:
+ TimedResult& res_;
+};
+
+} // namespace
+
+template <typename MallocFn, typename... Args>
+static TimedResult TimerCall(MallocFn fn, Args... args) {
+ TimedResult ret;
+ decltype((g_dispatch->*fn)(args...)) r;
+ if (g_debug->config().options() & RECORD_ALLOCS) {
+ ScopedTimer t(ret);
+ r = (g_dispatch->*fn)(args...);
+ } else {
+ r = (g_dispatch->*fn)(args...);
+ }
+ ret.setValue<decltype(r)>(r);
+ return ret;
+}
+
+template <typename MallocFn, typename... Args>
+static TimedResult TimerCallVoid(MallocFn fn, Args... args) {
+ TimedResult ret;
+ {
+ ScopedTimer t(ret);
+ (g_dispatch->*fn)(args...);
+ }
+ return ret;
+}
+
+#define TCALL(FUNC, ...) TimerCall(&MallocDispatch::FUNC, __VA_ARGS__);
+#define TCALLVOID(FUNC, ...) TimerCallVoid(&MallocDispatch::FUNC, __VA_ARGS__);
+
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
@@ -315,7 +410,7 @@
}
DebugData* debug = new DebugData();
- if (!debug->Initialize(options)) {
+ if (!debug->Initialize(options) || !Unreachable::Initialize(debug->config())) {
delete debug;
DebugDisableFinalize();
return false;
@@ -399,9 +494,14 @@
void debug_free_malloc_leak_info(uint8_t* info) {
g_dispatch->free(info);
+ // Purge the memory that was freed since a significant amount of
+ // memory could have been allocated and freed.
+ g_dispatch->mallopt(M_PURGE_ALL, 0);
}
size_t debug_malloc_usable_size(void* pointer) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled() || pointer == nullptr) {
return g_dispatch->malloc_usable_size(pointer);
}
@@ -416,7 +516,7 @@
return InternalMallocUsableSize(pointer);
}
-static void* InternalMalloc(size_t size) {
+static TimedResult InternalMalloc(size_t size) {
if ((g_debug->config().options() & BACKTRACE) && g_debug->pointer->ShouldDumpAndReset()) {
debug_dump_heap(android::base::StringPrintf(
"%s.%d.txt", g_debug->config().backtrace_dump_prefix().c_str(), getpid())
@@ -427,30 +527,35 @@
size = 1;
}
+ TimedResult result;
+
size_t real_size = size + g_debug->extra_bytes();
if (real_size < size) {
// Overflow.
errno = ENOMEM;
- return nullptr;
+ result.setValue<void*>(nullptr);
+ return result;
}
if (size > PointerInfoType::MaxSize()) {
errno = ENOMEM;
- return nullptr;
+ result.setValue<void*>(nullptr);
+ return result;
}
- void* pointer;
if (g_debug->HeaderEnabled()) {
- Header* header =
- reinterpret_cast<Header*>(g_dispatch->memalign(MINIMUM_ALIGNMENT_BYTES, real_size));
+ result = TCALL(memalign, MINIMUM_ALIGNMENT_BYTES, real_size);
+ Header* header = reinterpret_cast<Header*>(result.getValue<void*>());
if (header == nullptr) {
- return nullptr;
+ return result;
}
- pointer = InitHeader(header, header, size);
+ result.setValue<void*>(InitHeader(header, header, size));
} else {
- pointer = g_dispatch->malloc(real_size);
+ result = TCALL(malloc, real_size);
}
+ void* pointer = result.getValue<void*>();
+
if (pointer != nullptr) {
if (g_debug->TrackPointers()) {
PointerData::Add(pointer, size);
@@ -463,10 +568,13 @@
memset(pointer, g_debug->config().fill_alloc_value(), bytes);
}
}
- return pointer;
+
+ return result;
}
void* debug_malloc(size_t size) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled()) {
return g_dispatch->malloc(size);
}
@@ -474,16 +582,17 @@
ScopedDisableDebugCalls disable;
ScopedBacktraceSignalBlocker blocked;
- void* pointer = InternalMalloc(size);
+ TimedResult result = InternalMalloc(size);
if (g_debug->config().options() & RECORD_ALLOCS) {
- g_debug->record->AddEntry(new MallocEntry(pointer, size));
+ g_debug->record->AddEntry(new MallocEntry(result.getValue<void*>(), size,
+ result.GetStartTimeNS(), result.GetEndTimeNS()));
}
- return pointer;
+ return result.getValue<void*>();
}
-static void InternalFree(void* pointer) {
+static TimedResult InternalFree(void* pointer) {
if ((g_debug->config().options() & BACKTRACE) && g_debug->pointer->ShouldDumpAndReset()) {
debug_dump_heap(android::base::StringPrintf(
"%s.%d.txt", g_debug->config().backtrace_dump_prefix().c_str(), getpid())
@@ -517,33 +626,36 @@
if (g_debug->config().options() & FILL_ON_FREE) {
size_t fill_bytes = g_debug->config().fill_on_free_bytes();
- bytes = (bytes < fill_bytes) ? bytes : fill_bytes;
- memset(pointer, g_debug->config().fill_free_value(), bytes);
+ fill_bytes = (bytes < fill_bytes) ? bytes : fill_bytes;
+ memset(pointer, g_debug->config().fill_free_value(), fill_bytes);
}
if (g_debug->TrackPointers()) {
PointerData::Remove(pointer);
}
+ TimedResult result;
if (g_debug->config().options() & FREE_TRACK) {
// Do not add the allocation until we are done modifying the pointer
// itself. This avoids a race if a lot of threads are all doing
// frees at the same time and we wind up trying to really free this
// pointer from another thread, while still trying to free it in
// this function.
- pointer = PointerData::AddFreed(pointer);
- if (pointer != nullptr) {
- if (g_debug->HeaderEnabled()) {
- pointer = g_debug->GetHeader(pointer)->orig_pointer;
- }
- g_dispatch->free(pointer);
+ pointer = PointerData::AddFreed(pointer, bytes);
+ if (pointer != nullptr && g_debug->HeaderEnabled()) {
+ pointer = g_debug->GetHeader(pointer)->orig_pointer;
}
+ result = TCALLVOID(free, pointer);
} else {
- g_dispatch->free(free_pointer);
+ result = TCALLVOID(free, free_pointer);
}
+
+ return result;
}
void debug_free(void* pointer) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled() || pointer == nullptr) {
return g_dispatch->free(pointer);
}
@@ -551,18 +663,21 @@
ScopedDisableDebugCalls disable;
ScopedBacktraceSignalBlocker blocked;
- if (g_debug->config().options() & RECORD_ALLOCS) {
- g_debug->record->AddEntry(new FreeEntry(pointer));
- }
-
if (!VerifyPointer(pointer, "free")) {
return;
}
- InternalFree(pointer);
+ TimedResult result = InternalFree(pointer);
+
+ if (g_debug->config().options() & RECORD_ALLOCS) {
+ g_debug->record->AddEntry(
+ new FreeEntry(pointer, result.GetStartTimeNS(), result.GetEndTimeNS()));
+ }
}
void* debug_memalign(size_t alignment, size_t bytes) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled()) {
return g_dispatch->memalign(alignment, bytes);
}
@@ -579,6 +694,7 @@
return nullptr;
}
+ TimedResult result;
void* pointer;
if (g_debug->HeaderEnabled()) {
// Make the alignment a power of two.
@@ -601,7 +717,8 @@
return nullptr;
}
- pointer = g_dispatch->malloc(real_size);
+ result = TCALL(malloc, real_size);
+ pointer = result.getValue<void*>();
if (pointer == nullptr) {
return nullptr;
}
@@ -611,6 +728,7 @@
value += (-value % alignment);
Header* header = g_debug->GetHeader(reinterpret_cast<void*>(value));
+ // Don't need to update `result` here because we only need the timestamps.
pointer = InitHeader(header, pointer, bytes);
} else {
size_t real_size = bytes + g_debug->extra_bytes();
@@ -619,7 +737,8 @@
errno = ENOMEM;
return nullptr;
}
- pointer = g_dispatch->memalign(alignment, real_size);
+ result = TCALL(memalign, alignment, real_size);
+ pointer = result.getValue<void*>();
}
if (pointer != nullptr) {
@@ -635,7 +754,8 @@
}
if (g_debug->config().options() & RECORD_ALLOCS) {
- g_debug->record->AddEntry(new MemalignEntry(pointer, bytes, alignment));
+ g_debug->record->AddEntry(new MemalignEntry(pointer, bytes, alignment,
+ result.GetStartTimeNS(), result.GetEndTimeNS()));
}
}
@@ -643,6 +763,8 @@
}
void* debug_realloc(void* pointer, size_t bytes) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled()) {
return g_dispatch->realloc(pointer, bytes);
}
@@ -651,10 +773,12 @@
ScopedBacktraceSignalBlocker blocked;
if (pointer == nullptr) {
- pointer = InternalMalloc(bytes);
+ TimedResult result = InternalMalloc(bytes);
if (g_debug->config().options() & RECORD_ALLOCS) {
- g_debug->record->AddEntry(new ReallocEntry(pointer, bytes, nullptr));
+ g_debug->record->AddEntry(new ReallocEntry(result.getValue<void*>(), bytes, nullptr,
+ result.GetStartTimeNS(), result.GetEndTimeNS()));
}
+ pointer = result.getValue<void*>();
return pointer;
}
@@ -663,11 +787,13 @@
}
if (bytes == 0) {
+ TimedResult result = InternalFree(pointer);
+
if (g_debug->config().options() & RECORD_ALLOCS) {
- g_debug->record->AddEntry(new ReallocEntry(nullptr, bytes, pointer));
+ g_debug->record->AddEntry(new ReallocEntry(nullptr, bytes, pointer, result.GetStartTimeNS(),
+ result.GetEndTimeNS()));
}
- InternalFree(pointer);
return nullptr;
}
@@ -686,6 +812,7 @@
return nullptr;
}
+ TimedResult result;
void* new_pointer;
size_t prev_size;
if (g_debug->HeaderEnabled()) {
@@ -719,7 +846,8 @@
}
// Allocate the new size.
- new_pointer = InternalMalloc(bytes);
+ result = InternalMalloc(bytes);
+ new_pointer = result.getValue<void*>();
if (new_pointer == nullptr) {
errno = ENOMEM;
return nullptr;
@@ -727,14 +855,18 @@
prev_size = header->usable_size;
memcpy(new_pointer, pointer, prev_size);
- InternalFree(pointer);
+ TimedResult free_time = InternalFree(pointer);
+ // `realloc` is split into two steps, update the end time to the finish time
+ // of the second operation.
+ result.SetEndTimeNS(free_time.GetEndTimeNS());
} else {
if (g_debug->TrackPointers()) {
PointerData::Remove(pointer);
}
prev_size = g_dispatch->malloc_usable_size(pointer);
- new_pointer = g_dispatch->realloc(pointer, real_size);
+ result = TCALL(realloc, pointer, real_size);
+ new_pointer = result.getValue<void*>();
if (new_pointer == nullptr) {
return nullptr;
}
@@ -756,13 +888,16 @@
}
if (g_debug->config().options() & RECORD_ALLOCS) {
- g_debug->record->AddEntry(new ReallocEntry(new_pointer, bytes, pointer));
+ g_debug->record->AddEntry(new ReallocEntry(new_pointer, bytes, pointer, result.GetStartTimeNS(),
+ result.GetEndTimeNS()));
}
return new_pointer;
}
void* debug_calloc(size_t nmemb, size_t bytes) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled()) {
return g_dispatch->calloc(nmemb, bytes);
}
@@ -794,21 +929,24 @@
}
void* pointer;
+ TimedResult result;
if (g_debug->HeaderEnabled()) {
// Need to guarantee the alignment of the header.
- Header* header =
- reinterpret_cast<Header*>(g_dispatch->memalign(MINIMUM_ALIGNMENT_BYTES, real_size));
+ result = TCALL(memalign, MINIMUM_ALIGNMENT_BYTES, real_size);
+ Header* header = reinterpret_cast<Header*>(result.getValue<void*>());
if (header == nullptr) {
return nullptr;
}
memset(header, 0, g_dispatch->malloc_usable_size(header));
pointer = InitHeader(header, header, size);
} else {
- pointer = g_dispatch->calloc(1, real_size);
+ result = TCALL(calloc, 1, real_size);
+ pointer = result.getValue<void*>();
}
if (g_debug->config().options() & RECORD_ALLOCS) {
- g_debug->record->AddEntry(new CallocEntry(pointer, bytes, nmemb));
+ g_debug->record->AddEntry(
+ new CallocEntry(pointer, nmemb, bytes, result.GetStartTimeNS(), result.GetEndTimeNS()));
}
if (pointer != nullptr && g_debug->TrackPointers()) {
@@ -862,6 +1000,8 @@
}
void* debug_aligned_alloc(size_t alignment, size_t size) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled()) {
return g_dispatch->aligned_alloc(alignment, size);
}
@@ -873,6 +1013,8 @@
}
int debug_posix_memalign(void** memptr, size_t alignment, size_t size) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled()) {
return g_dispatch->posix_memalign(memptr, alignment, size);
}
@@ -890,10 +1032,9 @@
void* arg) {
ScopedConcurrentLock lock;
if (g_debug->TrackPointers()) {
- // Since malloc is disabled, don't bother acquiring any locks.
- for (auto it = PointerData::begin(); it != PointerData::end(); ++it) {
- callback(it->first, InternalMallocUsableSize(reinterpret_cast<void*>(it->first)), arg);
- }
+ PointerData::IteratePointers([&callback, &arg](uintptr_t pointer) {
+ callback(pointer, InternalMallocUsableSize(reinterpret_cast<void*>(pointer)), arg);
+ });
return 0;
}
@@ -935,6 +1076,8 @@
#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
void* debug_pvalloc(size_t bytes) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled()) {
return g_dispatch->pvalloc(bytes);
}
@@ -950,6 +1093,8 @@
}
void* debug_valloc(size_t size) {
+ Unreachable::CheckIfRequested(g_debug->config());
+
if (DebugCallsDisabled()) {
return g_dispatch->valloc(size);
}
@@ -975,6 +1120,10 @@
dprintf(fd, "%s", content.c_str());
}
dprintf(fd, "END\n");
+
+ // Purge the memory that was allocated and freed during this operation
+ // since it can be large enough to expand the RSS significantly.
+ g_dispatch->mallopt(M_PURGE_ALL, 0);
}
bool debug_write_malloc_leak_info(FILE* fp) {
diff --git a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
index 42d1415..bc7af6d 100644
--- a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
@@ -215,6 +215,13 @@
ASSERT_FALSE(config->backtrace_enable_on_signal());
ASSERT_FALSE(config->backtrace_dump_on_exit());
+ ASSERT_TRUE(InitConfig("bt=23")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options());
+ ASSERT_EQ(23U, config->backtrace_frames());
+ ASSERT_TRUE(config->backtrace_enabled());
+ ASSERT_FALSE(config->backtrace_enable_on_signal());
+ ASSERT_FALSE(config->backtrace_dump_on_exit());
+
ASSERT_TRUE(InitConfig("backtrace")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options());
ASSERT_EQ(16U, config->backtrace_frames());
@@ -222,6 +229,13 @@
ASSERT_FALSE(config->backtrace_enable_on_signal());
ASSERT_FALSE(config->backtrace_dump_on_exit());
+ ASSERT_TRUE(InitConfig("bt")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options());
+ ASSERT_EQ(16U, config->backtrace_frames());
+ ASSERT_TRUE(config->backtrace_enabled());
+ ASSERT_FALSE(config->backtrace_enable_on_signal());
+ ASSERT_FALSE(config->backtrace_dump_on_exit());
+
ASSERT_STREQ("", getFakeLogBuf().c_str());
ASSERT_STREQ("", getFakeLogPrint().c_str());
}
@@ -234,6 +248,13 @@
ASSERT_TRUE(config->backtrace_enable_on_signal());
ASSERT_FALSE(config->backtrace_dump_on_exit());
+ ASSERT_TRUE(InitConfig("bt_en_on_sig=64")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options());
+ ASSERT_EQ(64U, config->backtrace_frames());
+ ASSERT_FALSE(config->backtrace_enabled());
+ ASSERT_TRUE(config->backtrace_enable_on_signal());
+ ASSERT_FALSE(config->backtrace_dump_on_exit());
+
ASSERT_TRUE(InitConfig("backtrace_enable_on_signal")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options());
ASSERT_EQ(16U, config->backtrace_frames());
@@ -241,6 +262,13 @@
ASSERT_TRUE(config->backtrace_enable_on_signal());
ASSERT_FALSE(config->backtrace_dump_on_exit());
+ ASSERT_TRUE(InitConfig("bt_en_on_sig")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options());
+ ASSERT_EQ(16U, config->backtrace_frames());
+ ASSERT_FALSE(config->backtrace_enabled());
+ ASSERT_TRUE(config->backtrace_enable_on_signal());
+ ASSERT_FALSE(config->backtrace_dump_on_exit());
+
ASSERT_STREQ("", getFakeLogBuf().c_str());
ASSERT_STREQ("", getFakeLogPrint().c_str());
}
@@ -288,6 +316,10 @@
ASSERT_EQ(0U, config->options());
ASSERT_TRUE(config->backtrace_dump_on_exit());
+ ASSERT_TRUE(InitConfig("bt_dmp_on_ex")) << getFakeLogPrint();
+ ASSERT_EQ(0U, config->options());
+ ASSERT_TRUE(config->backtrace_dump_on_exit());
+
ASSERT_STREQ("", getFakeLogBuf().c_str());
ASSERT_STREQ("", getFakeLogPrint().c_str());
}
@@ -307,10 +339,18 @@
ASSERT_EQ(0U, config->options());
ASSERT_EQ("/data/local/tmp/backtrace_heap", config->backtrace_dump_prefix());
+ ASSERT_TRUE(InitConfig("bt_dmp_pre")) << getFakeLogPrint();
+ ASSERT_EQ(0U, config->options());
+ ASSERT_EQ("/data/local/tmp/backtrace_heap", config->backtrace_dump_prefix());
+
ASSERT_TRUE(InitConfig("backtrace_dump_prefix=/fake/location")) << getFakeLogPrint();
ASSERT_EQ(0U, config->options());
ASSERT_EQ("/fake/location", config->backtrace_dump_prefix());
+ ASSERT_TRUE(InitConfig("bt_dmp_pre=/fake/location")) << getFakeLogPrint();
+ ASSERT_EQ(0U, config->options());
+ ASSERT_EQ("/fake/location", config->backtrace_dump_prefix());
+
ASSERT_STREQ("", getFakeLogBuf().c_str());
ASSERT_STREQ("", getFakeLogPrint().c_str());
}
@@ -319,6 +359,9 @@
ASSERT_TRUE(InitConfig("backtrace_full")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE_FULL, config->options());
+ ASSERT_TRUE(InitConfig("bt_full")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE_FULL, config->options());
+
ASSERT_STREQ("", getFakeLogBuf().c_str());
ASSERT_STREQ("", getFakeLogPrint().c_str());
}
@@ -761,3 +804,102 @@
"which does not take a value\n");
ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
+
+TEST_F(MallocDebugConfigTest, check_unreachable_on_signal) {
+ ASSERT_TRUE(InitConfig("check_unreachable_on_signal")) << getFakeLogPrint();
+ ASSERT_EQ(CHECK_UNREACHABLE_ON_SIGNAL, config->options());
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ ASSERT_STREQ("", getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugConfigTest, trigger_check_unreachable_on_signal_fail) {
+ ASSERT_FALSE(InitConfig("check_unreachable_on_signal=200")) << getFakeLogPrint();
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string log_msg(
+ "6 malloc_debug malloc_testing: value set for option 'check_unreachable_on_signal' "
+ "which does not take a value\n");
+ ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugConfigTest, size) {
+ ASSERT_TRUE(InitConfig("backtrace_size=37")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE_SPECIFIC_SIZES, config->options());
+ ASSERT_EQ(37U, config->backtrace_min_size_bytes());
+ ASSERT_EQ(37U, config->backtrace_max_size_bytes());
+
+ ASSERT_TRUE(InitConfig("bt_sz=39")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE_SPECIFIC_SIZES, config->options());
+ ASSERT_EQ(39U, config->backtrace_min_size_bytes());
+ ASSERT_EQ(39U, config->backtrace_max_size_bytes());
+
+ ASSERT_FALSE(InitConfig("backtrace_size")) << getFakeLogPrint();
+ ASSERT_FALSE(InitConfig("backtrace_size=0")) << getFakeLogPrint();
+ ASSERT_FALSE(InitConfig("backtrace_size=-1")) << getFakeLogPrint();
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string log_msg("6 malloc_debug malloc_testing: bad value for option 'backtrace_size'\n" +
+ usage_string +
+ "6 malloc_debug malloc_testing: bad value for option 'backtrace_size', value "
+ "must be >= 1: 0\n" +
+ usage_string +
+ "6 malloc_debug malloc_testing: bad value for option 'backtrace_size', value "
+ "cannot be negative: -1\n" +
+ usage_string);
+ ASSERT_STREQ(log_msg.c_str(), getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugConfigTest, min_size) {
+ ASSERT_TRUE(InitConfig("backtrace_min_size=9")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE_SPECIFIC_SIZES, config->options());
+ ASSERT_EQ(9U, config->backtrace_min_size_bytes());
+ ASSERT_EQ(SIZE_MAX, config->backtrace_max_size_bytes());
+
+ ASSERT_TRUE(InitConfig("bt_min_sz=11")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE_SPECIFIC_SIZES, config->options());
+ ASSERT_EQ(11U, config->backtrace_min_size_bytes());
+ ASSERT_EQ(SIZE_MAX, config->backtrace_max_size_bytes());
+
+ ASSERT_FALSE(InitConfig("backtrace_min_size")) << getFakeLogPrint();
+ ASSERT_FALSE(InitConfig("backtrace_min_size=0")) << getFakeLogPrint();
+ ASSERT_FALSE(InitConfig("backtrace_min_size=-1")) << getFakeLogPrint();
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string log_msg("6 malloc_debug malloc_testing: bad value for option 'backtrace_min_size'\n" +
+ usage_string +
+ "6 malloc_debug malloc_testing: bad value for option 'backtrace_min_size', "
+ "value must be >= 1: 0\n" +
+ usage_string +
+ "6 malloc_debug malloc_testing: bad value for option 'backtrace_min_size', "
+ "value cannot be negative: -1\n" +
+ usage_string);
+ ASSERT_STREQ(log_msg.c_str(), getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugConfigTest, max_size) {
+ ASSERT_TRUE(InitConfig("backtrace_max_size=13")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE_SPECIFIC_SIZES, config->options());
+ ASSERT_EQ(0U, config->backtrace_min_size_bytes());
+ ASSERT_EQ(13U, config->backtrace_max_size_bytes());
+
+ ASSERT_TRUE(InitConfig("bt_max_sz=15")) << getFakeLogPrint();
+ ASSERT_EQ(BACKTRACE_SPECIFIC_SIZES, config->options());
+ ASSERT_EQ(0U, config->backtrace_min_size_bytes());
+ ASSERT_EQ(15U, config->backtrace_max_size_bytes());
+
+ ASSERT_FALSE(InitConfig("backtrace_max_size")) << getFakeLogPrint();
+ ASSERT_FALSE(InitConfig("backtrace_max_size=0")) << getFakeLogPrint();
+ ASSERT_FALSE(InitConfig("backtrace_max_size=-1")) << getFakeLogPrint();
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string log_msg("6 malloc_debug malloc_testing: bad value for option 'backtrace_max_size'\n" +
+ usage_string +
+ "6 malloc_debug malloc_testing: bad value for option 'backtrace_max_size', "
+ "value must be >= 1: 0\n" +
+ usage_string +
+ "6 malloc_debug malloc_testing: bad value for option 'backtrace_max_size', "
+ "value cannot be negative: -1\n" +
+ usage_string);
+ ASSERT_STREQ(log_msg.c_str(), getFakeLogPrint().c_str());
+}
diff --git a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
index 92679e4..aee2572 100644
--- a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
@@ -52,8 +52,7 @@
#include <thread>
#include <vector>
-#include <backtrace/Backtrace.h>
-#include <backtrace/BacktraceMap.h>
+#include <unwindstack/AndroidUnwinder.h>
#include <bionic/malloc.h>
#include <tests/utils.h>
@@ -452,12 +451,19 @@
static constexpr size_t kMaxRetries = 3;
};
-TEST(MallocTests, DISABLED_smoke) {}
+TEST(MallocTests, DISABLED_smoke) {
+ void* ptr = malloc(128);
+ free(ptr);
+}
TEST_F(MallocDebugSystemTest, smoke) {
Exec("MallocTests.DISABLED_smoke", "verbose backtrace");
}
+TEST_F(MallocDebugSystemTest, backtrace_full_smoke) {
+ Exec("MallocTests.DISABLED_smoke", "verbose backtrace backtrace_full");
+}
+
static void SetAllocationLimit() {
// Set to a large value, this is only to enable the limit code and
// verify that malloc debug is still called properly.
@@ -763,13 +769,14 @@
}
static constexpr size_t kNumUnwinds = 1000;
+ unwindstack::AndroidLocalUnwinder unwinder;
for (size_t i = 0; i < kNumUnwinds; i++) {
- std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), tid));
// Only verify that there is at least one frame in the unwind.
// This is not a test of the unwinder and clang for arm seems to
// produces an increasing number of code that does not have unwind
// information.
- ASSERT_TRUE(backtrace->Unwind(0)) << "Failed on unwind " << i;
+ unwindstack::AndroidUnwinderData data;
+ ASSERT_TRUE(unwinder.Unwind(data)) << "Failed on unwind " << i;
}
running = false;
thread.join();
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index ea2dc78..bf3ed14 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -81,8 +81,19 @@
bool debug_write_malloc_leak_info(FILE*);
void debug_dump_heap(const char*);
+void malloc_enable();
+void malloc_disable();
+
__END_DECLS
+// Change the slow threshold since some tests take more than 2 seconds.
+extern "C" bool GetInitialArgs(const char*** args, size_t* num_args) {
+ static const char* initial_args[] = {"--slow_threshold_ms=5000"};
+ *args = initial_args;
+ *num_args = 1;
+ return true;
+}
+
constexpr char DIVIDER[] =
"6 malloc_debug *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n";
@@ -90,7 +101,7 @@
return __BIONIC_ALIGN(sizeof(Header), MINIMUM_ALIGNMENT_BYTES);
}
-static constexpr const char RECORD_ALLOCS_FILE[] = "/data/local/tmp/record_allocs.txt";
+static constexpr const char RECORD_ALLOCS_FILE[] = "/data/local/tmp/record_allocs";
static constexpr const char BACKTRACE_DUMP_PREFIX[] = "/data/local/tmp/backtrace_heap";
@@ -100,14 +111,16 @@
initialized = false;
resetLogs();
backtrace_fake_clear_all();
- // Delete the record data file if it exists.
- unlink(RECORD_ALLOCS_FILE);
}
void TearDown() override {
if (initialized) {
debug_finalize();
}
+ if (!record_filename.empty()) {
+ // Try to delete the record data file even it doesn't exist.
+ unlink(record_filename.c_str());
+ }
}
void Init(const char* options) {
@@ -116,6 +129,13 @@
initialized = true;
}
+ void InitRecordAllocs(const char* options) {
+ record_filename = android::base::StringPrintf("%s.%d.txt", RECORD_ALLOCS_FILE, getpid());
+ std::string init(options);
+ init += android::base::StringPrintf(" record_allocs_file=%s", record_filename.c_str());
+ Init(init.c_str());
+ }
+
void BacktraceDumpOnSignal(bool trigger_with_alloc);
static size_t GetInfoEntrySize(size_t max_frames) {
@@ -126,6 +146,8 @@
bool zygote_child;
+ std::string record_filename;
+
static MallocDispatch dispatch;
};
@@ -162,6 +184,23 @@
return diff;
}
+static void VerifyRecords(std::vector<std::string>& expected, std::string& actual) {
+ size_t offset = 0;
+ for (std::string& str : expected) {
+ ASSERT_STREQ(str.c_str(), actual.substr(offset, str.size()).c_str());
+ if (str.find("thread_done") != std::string::npos) {
+ offset = actual.find_first_of("\n", offset) + 1;
+ continue;
+ }
+ offset += str.size() + 1;
+ uint64_t st = strtoull(&actual[offset], nullptr, 10);
+ offset = actual.find_first_of(" ", offset) + 1;
+ uint64_t et = strtoull(&actual[offset], nullptr, 10);
+ ASSERT_GT(et, st);
+ offset = actual.find_first_of("\n", offset) + 1;
+ }
+}
+
void VerifyAllocCalls(bool all_options) {
size_t alloc_size = 1024;
@@ -227,6 +266,9 @@
expected_log += android::base::StringPrintf(
"4 malloc_debug malloc_testing: Run: 'kill -%d %d' to dump the allocation records.\n",
SIGRTMAX - 18, getpid());
+ expected_log += android::base::StringPrintf(
+ "4 malloc_debug malloc_testing: Run: 'kill -%d %d' to check for unreachable memory.\n",
+ SIGRTMAX - 16, getpid());
}
expected_log += "4 malloc_debug malloc_testing: malloc debug enabled\n";
ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
@@ -296,6 +338,16 @@
ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
}
+TEST_F(MallocDebugTest, verbose_check_unreachable_on_signal) {
+ Init("verbose check_unreachable_on_signal");
+
+ std::string expected_log = android::base::StringPrintf(
+ "4 malloc_debug malloc_testing: Run: 'kill -%d %d' to check for unreachable memory.\n",
+ SIGRTMAX - 16, getpid());
+ expected_log += "4 malloc_debug malloc_testing: malloc debug enabled\n";
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+}
+
TEST_F(MallocDebugTest, fill_on_free) {
Init("fill_on_free free_track free_track_backtrace_num_frames=0");
@@ -359,7 +411,7 @@
TEST_F(MallocDebugTest, all_options) {
Init(
"guard backtrace backtrace_enable_on_signal fill expand_alloc free_track leak_track "
- "record_allocs verify_pointers abort_on_error verbose");
+ "record_allocs verify_pointers abort_on_error verbose check_unreachable_on_signal");
VerifyAllocCalls(true);
}
@@ -2135,143 +2187,128 @@
}
#endif
-void VerifyRecordAllocs() {
- std::string expected;
+void VerifyRecordAllocs(const std::string& record_filename) {
+ std::vector<std::string> expected;
void* pointer = debug_malloc(10);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: malloc %p 10\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: malloc %p 10", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
- pointer = debug_calloc(1, 20);
+ pointer = debug_calloc(20, 1);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: calloc %p 20 1\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: calloc %p 20 1", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
pointer = debug_realloc(nullptr, 30);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: realloc %p 0x0 30\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: realloc %p 0x0 30", getpid(), pointer));
void* old_pointer = pointer;
pointer = debug_realloc(pointer, 2048);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: realloc %p %p 2048\n", getpid(),
- pointer, old_pointer);
+ expected.push_back(
+ android::base::StringPrintf("%d: realloc %p %p 2048", getpid(), pointer, old_pointer));
debug_realloc(pointer, 0);
- expected += android::base::StringPrintf("%d: realloc 0x0 %p 0\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: realloc 0x0 %p 0", getpid(), pointer));
pointer = debug_memalign(16, 40);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: memalign %p 16 40\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: memalign %p 16 40", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
pointer = debug_aligned_alloc(32, 64);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: memalign %p 32 64\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: memalign %p 32 64", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
ASSERT_EQ(0, debug_posix_memalign(&pointer, 32, 50));
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: memalign %p 32 50\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: memalign %p 32 50", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
pointer = debug_pvalloc(60);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: memalign %p 4096 4096\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: memalign %p 4096 4096", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
pointer = debug_valloc(70);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: memalign %p 4096 70\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: memalign %p 4096 70", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
#endif
// Dump all of the data accumulated so far.
ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
- sleep(1);
-
- // This triggers the dumping.
- pointer = debug_malloc(110);
- ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: malloc %p 110\n", getpid(), pointer);
// Read all of the contents.
std::string actual;
- ASSERT_TRUE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
- ASSERT_EQ(0, unlink(RECORD_ALLOCS_FILE));
+ ASSERT_TRUE(android::base::ReadFileToString(record_filename, &actual));
- ASSERT_STREQ(expected.c_str(), actual.c_str());
+ VerifyRecords(expected, actual);
ASSERT_STREQ("", getFakeLogBuf().c_str());
ASSERT_STREQ("", getFakeLogPrint().c_str());
-
- debug_free(pointer);
}
TEST_F(MallocDebugTest, record_allocs_no_header) {
- Init("record_allocs");
+ InitRecordAllocs("record_allocs");
- VerifyRecordAllocs();
+ VerifyRecordAllocs(record_filename);
}
TEST_F(MallocDebugTest, record_allocs_with_header) {
- Init("record_allocs front_guard");
+ InitRecordAllocs("record_allocs front_guard");
- VerifyRecordAllocs();
+ VerifyRecordAllocs(record_filename);
}
TEST_F(MallocDebugTest, record_allocs_max) {
- Init("record_allocs=5");
+ InitRecordAllocs("record_allocs=5");
- std::string expected;
+ std::vector<std::string> expected;
void* pointer = debug_malloc(10);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: malloc %p 10\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: malloc %p 10", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
pointer = debug_malloc(20);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: malloc %p 20\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: malloc %p 20", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
pointer = debug_malloc(1024);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: malloc %p 1024\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: malloc %p 1024", getpid(), pointer));
debug_free(pointer);
// Dump all of the data accumulated so far.
ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
- sleep(1);
-
- // This triggers the dumping.
- pointer = debug_malloc(110);
- ASSERT_TRUE(pointer != nullptr);
// Read all of the contents.
std::string actual;
- ASSERT_TRUE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
- ASSERT_EQ(0, unlink(RECORD_ALLOCS_FILE));
+ ASSERT_TRUE(android::base::ReadFileToString(record_filename, &actual));
- ASSERT_STREQ(expected.c_str(), actual.c_str());
+ VerifyRecords(expected, actual);
ASSERT_STREQ("", getFakeLogBuf().c_str());
- ASSERT_STREQ("", getFakeLogPrint().c_str());
-
- debug_free(pointer);
+ ASSERT_STREQ(
+ "4 malloc_debug Maximum number of records added, all new operations will be dropped.\n",
+ getFakeLogPrint().c_str());
}
TEST_F(MallocDebugTest, record_allocs_thread_done) {
- Init("record_allocs=5");
+ InitRecordAllocs("record_allocs=5");
static pid_t tid = 0;
static void* pointer = nullptr;
@@ -2283,84 +2320,101 @@
});
thread.join();
- std::string expected = android::base::StringPrintf("%d: malloc %p 100\n", tid, pointer);
- expected += android::base::StringPrintf("%d: free %p\n", tid, pointer);
- expected += android::base::StringPrintf("%d: thread_done 0x0\n", tid);
+ std::vector<std::string> expected;
+ expected.push_back(android::base::StringPrintf("%d: malloc %p 100", tid, pointer));
+ expected.push_back(android::base::StringPrintf("%d: free %p", tid, pointer));
+ expected.push_back(android::base::StringPrintf("%d: thread_done 0x0", tid));
// Dump all of the data accumulated so far.
ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
- sleep(1);
-
- // This triggers the dumping.
- pointer = debug_malloc(23);
- ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: malloc %p 23\n", getpid(), pointer);
// Read all of the contents.
std::string actual;
- ASSERT_TRUE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
- ASSERT_EQ(0, unlink(RECORD_ALLOCS_FILE));
+ ASSERT_TRUE(android::base::ReadFileToString(record_filename, &actual));
- ASSERT_STREQ(expected.c_str(), actual.c_str());
+ VerifyRecords(expected, actual);
ASSERT_STREQ("", getFakeLogBuf().c_str());
ASSERT_STREQ("", getFakeLogPrint().c_str());
-
- debug_free(pointer);
}
TEST_F(MallocDebugTest, record_allocs_file_name_fail) {
- Init("record_allocs=5");
+ InitRecordAllocs("record_allocs=5");
- // Delete the special.txt file and create a symbolic link there to
+ // Delete the records file and create a symbolic link there to
// make sure the create file will fail.
- unlink(RECORD_ALLOCS_FILE);
+ unlink(record_filename.c_str());
- ASSERT_EQ(0, symlink("/data/local/tmp/does_not_exist", RECORD_ALLOCS_FILE));
+ ASSERT_EQ(0, symlink("/data/local/tmp/does_not_exist", record_filename.c_str()));
- std::string expected;
+ std::vector<std::string> expected;
void* pointer = debug_malloc(10);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: malloc %p 10\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: malloc %p 10", getpid(), pointer));
debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
// Dump all of the data accumulated so far.
ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
- sleep(1);
-
- // This triggers the dumping.
- pointer = debug_malloc(110);
- ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: malloc %p 110\n", getpid(), pointer);
// Read all of the contents.
std::string actual;
- ASSERT_FALSE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
+ ASSERT_FALSE(android::base::ReadFileToString(record_filename, &actual));
// Unlink the file so the next dump passes.
- ASSERT_EQ(0, unlink(RECORD_ALLOCS_FILE));
+ ASSERT_EQ(0, unlink(record_filename.c_str()));
// Dump all of the data accumulated so far.
ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
- sleep(1);
- // This triggers the dumping.
- debug_free(pointer);
- expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+ ASSERT_TRUE(android::base::ReadFileToString(record_filename, &actual));
- ASSERT_TRUE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
- ASSERT_EQ(0, unlink(RECORD_ALLOCS_FILE));
- ASSERT_STREQ(expected.c_str(), actual.c_str());
+ VerifyRecords(expected, actual);
ASSERT_STREQ("", getFakeLogBuf().c_str());
std::string expected_log = android::base::StringPrintf(
"6 malloc_debug Cannot create record alloc file %s: Too many symbolic links encountered\n",
- RECORD_ALLOCS_FILE);
+ record_filename.c_str());
ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
}
+TEST_F(MallocDebugTest, record_allocs_no_entries_to_write) {
+ InitRecordAllocs("record_allocs=5");
+
+ kill(getpid(), SIGRTMAX - 18);
+
+ std::string actual;
+ ASSERT_FALSE(android::base::ReadFileToString(record_filename, &actual));
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ ASSERT_STREQ("4 malloc_debug No alloc entries to write.\n", getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugTest, record_allocs_write_entries_does_not_allocate) {
+ InitRecordAllocs("record_allocs=5");
+
+ std::vector<std::string> expected;
+
+ void* pointer = debug_malloc(10);
+ ASSERT_TRUE(pointer != nullptr);
+ expected.push_back(android::base::StringPrintf("%d: malloc %p 10", getpid(), pointer));
+ debug_free(pointer);
+ expected.push_back(android::base::StringPrintf("%d: free %p", getpid(), pointer));
+
+ malloc_disable();
+ kill(getpid(), SIGRTMAX - 18);
+ malloc_enable();
+
+ std::string actual;
+ ASSERT_TRUE(android::base::ReadFileToString(record_filename, &actual));
+
+ VerifyRecords(expected, actual);
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ ASSERT_STREQ("", getFakeLogPrint().c_str());
+}
+
TEST_F(MallocDebugTest, verify_pointers) {
Init("verify_pointers");
@@ -2695,3 +2749,209 @@
std::string expected_log = std::string("6 malloc_debug Dumping to file: ") + tf.path + "\n\n";
ASSERT_EQ(expected_log, getFakeLogPrint());
}
+
+extern "C" bool LogUnreachableMemory(bool, size_t) {
+ static bool return_value = false;
+ return_value = !return_value;
+ return return_value;
+}
+
+TEST_F(MallocDebugTest, check_unreachable_on_signal) {
+ Init("check_unreachable_on_signal");
+
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 16) == 0);
+ sleep(1);
+
+ // The first unreachable check will pass.
+ void* pointer = debug_malloc(110);
+ ASSERT_TRUE(pointer != nullptr);
+
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 16) == 0);
+ sleep(1);
+
+ // The second unreachable check will fail.
+ debug_free(pointer);
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = "4 malloc_debug Starting to check for unreachable memory.\n";
+ ASSERT_STREQ(
+ "4 malloc_debug Starting to check for unreachable memory.\n"
+ "4 malloc_debug Starting to check for unreachable memory.\n"
+ "6 malloc_debug Unreachable check failed, run setenforce 0 and try again.\n",
+ getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugTest, backtrace_only_some_sizes_with_backtrace_size) {
+ Init("leak_track backtrace backtrace_size=120");
+
+ backtrace_fake_add(std::vector<uintptr_t>{0x1000, 0x2000, 0x3000});
+
+ void* pointer1 = debug_malloc(119);
+ ASSERT_TRUE(pointer1 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0xa000, 0xb000, 0xc000, 0xd000});
+
+ void* pointer2 = debug_malloc(120);
+ ASSERT_TRUE(pointer2 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0xfe000, 0xde000, 0xce000, 0xbe000, 0xae000});
+
+ void* pointer3 = debug_malloc(121);
+ ASSERT_TRUE(pointer3 != nullptr);
+
+ debug_finalize();
+ initialized = false;
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 121 at %p (leak 1 of 3)\n", pointer3);
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 120 at %p (leak 2 of 3)\n", pointer2);
+ expected_log += "6 malloc_debug Backtrace at time of allocation:\n";
+ expected_log += "6 malloc_debug #00 pc 0x1000\n";
+ expected_log += "6 malloc_debug #01 pc 0x2000\n";
+ expected_log += "6 malloc_debug #02 pc 0x3000\n";
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 119 at %p (leak 3 of 3)\n", pointer1);
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugTest, backtrace_only_some_sizes_with_backtrace_min_size) {
+ Init("leak_track backtrace backtrace_min_size=1000");
+
+ backtrace_fake_add(std::vector<uintptr_t>{0x1000, 0x2000, 0x3000});
+
+ void* pointer1 = debug_malloc(500);
+ ASSERT_TRUE(pointer1 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0xa000, 0xb000, 0xc000, 0xd000});
+
+ void* pointer2 = debug_malloc(1000);
+ ASSERT_TRUE(pointer2 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0xfe000, 0xde000, 0xce000, 0xbe000, 0xae000});
+
+ void* pointer3 = debug_malloc(1001);
+ ASSERT_TRUE(pointer3 != nullptr);
+
+ debug_finalize();
+ initialized = false;
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 1001 at %p (leak 1 of 3)\n",
+ pointer3);
+ expected_log += "6 malloc_debug Backtrace at time of allocation:\n";
+ expected_log += "6 malloc_debug #00 pc 0xa000\n";
+ expected_log += "6 malloc_debug #01 pc 0xb000\n";
+ expected_log += "6 malloc_debug #02 pc 0xc000\n";
+ expected_log += "6 malloc_debug #03 pc 0xd000\n";
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 1000 at %p (leak 2 of 3)\n",
+ pointer2);
+ expected_log += "6 malloc_debug Backtrace at time of allocation:\n";
+ expected_log += "6 malloc_debug #00 pc 0x1000\n";
+ expected_log += "6 malloc_debug #01 pc 0x2000\n";
+ expected_log += "6 malloc_debug #02 pc 0x3000\n";
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 500 at %p (leak 3 of 3)\n", pointer1);
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugTest, backtrace_only_some_sizes_with_backtrace_max_size) {
+ Init("leak_track backtrace backtrace_max_size=1000");
+
+ backtrace_fake_add(std::vector<uintptr_t>{0x1000, 0x2000, 0x3000});
+
+ void* pointer1 = debug_malloc(1000);
+ ASSERT_TRUE(pointer1 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0xa000, 0xb000, 0xc000, 0xd000});
+
+ void* pointer2 = debug_malloc(1001);
+ ASSERT_TRUE(pointer2 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0xfe000, 0xde000, 0xce000, 0xbe000, 0xae000});
+
+ void* pointer3 = debug_malloc(5000);
+ ASSERT_TRUE(pointer3 != nullptr);
+
+ debug_finalize();
+ initialized = false;
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 5000 at %p (leak 1 of 3)\n",
+ pointer3);
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 1001 at %p (leak 2 of 3)\n",
+ pointer2);
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 1000 at %p (leak 3 of 3)\n",
+ pointer1);
+ expected_log += "6 malloc_debug Backtrace at time of allocation:\n";
+ expected_log += "6 malloc_debug #00 pc 0x1000\n";
+ expected_log += "6 malloc_debug #01 pc 0x2000\n";
+ expected_log += "6 malloc_debug #02 pc 0x3000\n";
+
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugTest, backtrace_only_some_sizes_with_backtrace_min_max_size) {
+ Init("leak_track backtrace backtrace_min_size=50 backtrace_max_size=1000");
+
+ backtrace_fake_add(std::vector<uintptr_t>{0x1000, 0x2000, 0x3000});
+
+ void* pointer1 = debug_malloc(49);
+ ASSERT_TRUE(pointer1 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0xa000, 0xb000, 0xc000, 0xd000});
+
+ void* pointer2 = debug_malloc(50);
+ ASSERT_TRUE(pointer2 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0xfe000, 0xde000, 0xce000, 0xbe000, 0xae000});
+
+ void* pointer3 = debug_malloc(1000);
+ ASSERT_TRUE(pointer3 != nullptr);
+
+ backtrace_fake_add(std::vector<uintptr_t>{0x1a000, 0x1b000, 0x1c000, 0x1d000, 0x1e000});
+
+ void* pointer4 = debug_malloc(1001);
+ ASSERT_TRUE(pointer4 != nullptr);
+
+ debug_finalize();
+ initialized = false;
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 1001 at %p (leak 1 of 4)\n",
+ pointer4);
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 1000 at %p (leak 2 of 4)\n",
+ pointer3);
+ expected_log += "6 malloc_debug Backtrace at time of allocation:\n";
+ expected_log += "6 malloc_debug #00 pc 0xa000\n";
+ expected_log += "6 malloc_debug #01 pc 0xb000\n";
+ expected_log += "6 malloc_debug #02 pc 0xc000\n";
+ expected_log += "6 malloc_debug #03 pc 0xd000\n";
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 50 at %p (leak 3 of 4)\n", pointer2);
+ expected_log += "6 malloc_debug Backtrace at time of allocation:\n";
+ expected_log += "6 malloc_debug #00 pc 0x1000\n";
+ expected_log += "6 malloc_debug #01 pc 0x2000\n";
+ expected_log += "6 malloc_debug #02 pc 0x3000\n";
+
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug +++ malloc_testing leaked block of size 49 at %p (leak 4 of 4)\n", pointer1);
+
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+}
diff --git a/libc/malloc_hooks/Android.bp b/libc/malloc_hooks/Android.bp
index 01394da..6b4e606 100644
--- a/libc/malloc_hooks/Android.bp
+++ b/libc/malloc_hooks/Android.bp
@@ -59,6 +59,11 @@
name: "malloc_hooks_system_tests",
isolated: true,
+ // The clang-analyzer-unix.Malloc and other warnings in these
+ // unit tests are either false positive or in
+ // negative tests that can be ignored.
+ tidy: false,
+
srcs: [
"tests/malloc_hooks_tests.cpp",
],
diff --git a/libc/platform/bionic/macros.h b/libc/platform/bionic/macros.h
index 076cff1..9e13e0d 100644
--- a/libc/platform/bionic/macros.h
+++ b/libc/platform/bionic/macros.h
@@ -55,6 +55,8 @@
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined x30")
#elif defined(__i386__)
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined \%eip")
+#elif defined(__riscv)
+#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined ra")
#elif defined(__x86_64__)
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined \%rip")
#endif
diff --git a/libc/platform/bionic/malloc.h b/libc/platform/bionic/malloc.h
index f0f13d0..3c290fc 100644
--- a/libc/platform/bionic/malloc.h
+++ b/libc/platform/bionic/malloc.h
@@ -100,6 +100,9 @@
// arg_size = sizeof(android_mallopt_gwp_asan_options_t)
M_INITIALIZE_GWP_ASAN = 10,
#define M_INITIALIZE_GWP_ASAN M_INITIALIZE_GWP_ASAN
+ // Query whether memtag stack is enabled for this process.
+ M_MEMTAG_STACK_IS_ON = 11,
+#define M_MEMTAG_STACK_IS_ON M_MEMTAG_STACK_IS_ON
};
typedef struct {
@@ -118,22 +121,35 @@
// apply to system apps. They use the "libc.debug.gwp_asan.*.system_default"
// sysprops.
enum Action {
- // The app has opted-in to GWP-ASan, and should always have it enabled. This
- // should only be used by apps.
+ // Enable GWP-ASan. This is used by apps that have `gwpAsanMode=always` in
+ // the manifest.
TURN_ON_FOR_APP,
- // System processes apps have GWP-ASan enabled by default, but use the
- // process sampling method.
+ // Enable GWP-ASan, but only a small percentage of the time. This is used by
+ // system processes and system apps, and we use a lottery to determine which
+ // processes have GWP-ASan enabled. This allows us to mitigate system-wide
+ // memory overhead concerns, as each GWP-ASan enabled process uses ~70KiB of
+ // extra memory.
TURN_ON_WITH_SAMPLING,
- // Non-system apps don't have GWP-ASan by default.
+ // Don't enable GWP-ASan, unless overwritten by a system property or
+ // environment variable. This is used by apps that have `gwpAsanMode=never`
+ // in the manifest. Prior to Android 14, this also was used by non-system
+ // apps that didn't specify a `gwpAsanMode` in their manifest.
DONT_TURN_ON_UNLESS_OVERRIDDEN,
- // Note: GWP-ASan cannot be disabled once it's been enabled.
+ // Enable GWP-ASan, but only a small percentage of the time, and enable it
+ // in the non-crashing ("recoverable") mode. In Android 14, this is used by
+ // apps that don't specify `gwpAsanMode` (or use `gwpAsanMode=default`) in
+ // their manifest. GWP-ASan will detect heap memory safety bugs in this
+ // mode, and bug reports will be created by debuggerd, however the process
+ // will recover and continue to function as if the memory safety bug wasn't
+ // detected.
+ TURN_ON_FOR_APP_SAMPLED_NON_CRASHING,
};
Action desire = DONT_TURN_ON_UNLESS_OVERRIDDEN;
} android_mallopt_gwp_asan_options_t;
// Manipulates bionic-specific handling of memory allocation APIs such as
-// malloc. Only for use by the Android platform itself.
+// malloc. Only for use by the Android platform and APEXes.
//
// On success, returns true. On failure, returns false and sets errno.
extern "C" bool android_mallopt(int opcode, void* arg, size_t arg_size);
diff --git a/libc/platform/bionic/tls.h b/libc/platform/bionic/tls.h
index bf9e65b..e01eccd 100644
--- a/libc/platform/bionic/tls.h
+++ b/libc/platform/bionic/tls.h
@@ -34,6 +34,8 @@
# define __get_tls() ({ void** __val; __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r"(__val)); __val; })
#elif defined(__i386__)
# define __get_tls() ({ void** __val; __asm__("movl %%gs:0, %0" : "=r"(__val)); __val; })
+#elif defined(__riscv)
+# define __get_tls() ({ void** __val; __asm__("mv %0, tp" : "=r"(__val)); __val; })
#elif defined(__x86_64__)
# define __get_tls() ({ void** __val; __asm__("mov %%fs:0, %0" : "=r"(__val)); __val; })
#else
diff --git a/libc/platform/bionic/tls_defines.h b/libc/platform/bionic/tls_defines.h
index 78099b3..3e2efa3 100644
--- a/libc/platform/bionic/tls_defines.h
+++ b/libc/platform/bionic/tls_defines.h
@@ -114,6 +114,28 @@
#define TLS_SLOT_BIONIC_TLS 9
#define MAX_TLS_SLOT 9 // update this value when reserving a slot
+#elif defined(__riscv)
+
+// RISC-V ELF Specification[1] specifies that RISC-V uses Variant I as described
+// by the ELF TLS specification, with tp containing the address one past the end
+// of the TCB.
+//
+// [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 TLS_SLOT_BIONIC_TLS (-9)
+#define TLS_SLOT_DTV (-8)
+#define TLS_SLOT_THREAD_ID (-7)
+#define TLS_SLOT_APP (-6)
+#define TLS_SLOT_OPENGL (-5)
+#define TLS_SLOT_OPENGL_API (-4)
+#define TLS_SLOT_STACK_GUARD (-3)
+#define TLS_SLOT_SANITIZER (-2)
+#define TLS_SLOT_ART_THREAD_SELF (-1)
+#define MAX_TLS_SLOT (-1)
+
#endif
#define BIONIC_TLS_SLOTS (MAX_TLS_SLOT - MIN_TLS_SLOT + 1)
diff --git a/libc/private/bionic_asm.h b/libc/private/bionic_asm.h
index d68a2d6..78e5046 100644
--- a/libc/private/bionic_asm.h
+++ b/libc/private/bionic_asm.h
@@ -45,6 +45,8 @@
#include <private/bionic_asm_arm.h>
#elif defined(__i386__)
#include <private/bionic_asm_x86.h>
+#elif defined(__riscv)
+#include <private/bionic_asm_riscv64.h>
#elif defined(__x86_64__)
#include <private/bionic_asm_x86_64.h>
#endif
diff --git a/libc/private/bionic_asm_arm64.h b/libc/private/bionic_asm_arm64.h
index 5d83d9b..ffc7181 100644
--- a/libc/private/bionic_asm_arm64.h
+++ b/libc/private/bionic_asm_arm64.h
@@ -76,3 +76,4 @@
#define NT_MEMTAG_LEVEL_ASYNC 1
#define NT_MEMTAG_LEVEL_SYNC 2
#define NT_MEMTAG_HEAP 4
+#define NT_MEMTAG_STACK 8
diff --git a/libc/private/bionic_asm_riscv64.h b/libc/private/bionic_asm_riscv64.h
new file mode 100644
index 0000000..463ca31
--- /dev/null
+++ b/libc/private/bionic_asm_riscv64.h
@@ -0,0 +1,43 @@
+/* $OpenBSD: asm.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */
+/* $NetBSD: asm.h,v 1.4 2001/07/16 05:43:32 matt Exp $ */
+
+/*
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: @(#)asm.h 5.5 (Berkeley) 5/7/91
+ */
+
+#pragma once
+
+#define __bionic_asm_align 16
+
+#undef __bionic_asm_function_type
+#define __bionic_asm_function_type %function
diff --git a/libc/private/bionic_constants.h b/libc/private/bionic_constants.h
index 09294b6..d7f4474 100644
--- a/libc/private/bionic_constants.h
+++ b/libc/private/bionic_constants.h
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-#ifndef _BIONIC_CONSTANTS_H_
-#define _BIONIC_CONSTANTS_H_
+#pragma once
#define NS_PER_S 1000000000
-// Size of the shadow call stack. This must be a power of 2.
+// Size of the shadow call stack. This can be small because these stacks only
+// contain return addresses. This must be a power of 2 so the mask trick works.
+// See the SCS commentary in pthread_internal.h for more detail.
#define SCS_SIZE (8 * 1024)
+#define SCS_MASK (SCS_SIZE - 1)
// The shadow call stack is allocated at an aligned address within a guard region of this size. The
// guard region must be large enough that we can allocate an SCS_SIZE-aligned SCS while ensuring
// that there is at least one guard page after the SCS so that a stack overflow results in a SIGSEGV
// instead of corrupting the allocation that comes after it.
#define SCS_GUARD_REGION_SIZE (16 * 1024 * 1024)
-
-#endif // _BIONIC_CONSTANTS_H_
diff --git a/libc/private/bionic_elf_tls.h b/libc/private/bionic_elf_tls.h
index e0ec7b5..79ffcc4 100644
--- a/libc/private/bionic_elf_tls.h
+++ b/libc/private/bionic_elf_tls.h
@@ -201,3 +201,18 @@
struct bionic_tcb;
void __free_dynamic_tls(bionic_tcb* tcb);
void __notify_thread_exit_callbacks();
+
+#if defined(__riscv)
+// TLS_DTV_OFFSET is a constant used in relocation fields, defined in RISC-V ELF Specification[1]
+// The front of the TCB contains a pointer to the DTV, and each pointer in DTV
+// points to 0x800 past the start of a TLS block to make full use of the range
+// of load/store instructions, refer to [2].
+//
+// [1]: RISC-V ELF Specification.
+// https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#constants
+// [2]: Documentation of TLS data structures
+// https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/53
+#define TLS_DTV_OFFSET 0x800
+#else
+#define TLS_DTV_OFFSET 0
+#endif
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
index e105c18..c375cc4 100644
--- a/libc/private/bionic_globals.h
+++ b/libc/private/bionic_globals.h
@@ -29,24 +29,25 @@
#ifndef _PRIVATE_BIONIC_GLOBALS_H
#define _PRIVATE_BIONIC_GLOBALS_H
+#include <inttypes.h>
+#include <link.h>
+#include <platform/bionic/malloc.h>
+#include <pthread.h>
#include <stdatomic.h>
#include <sys/cdefs.h>
-#include <link.h>
-#include <pthread.h>
+#include "private/WriteProtected.h"
#include "private/bionic_allocator.h"
#include "private/bionic_elf_tls.h"
#include "private/bionic_fdsan.h"
#include "private/bionic_malloc_dispatch.h"
#include "private/bionic_vdso.h"
-#include "private/WriteProtected.h"
-
-#include <platform/bionic/malloc.h>
struct libc_globals {
vdso_entry vdso[VDSO_END];
long setjmp_cookie;
uintptr_t heap_pointer_tag;
+ _Atomic(bool) memtag_stack;
// In order to allow a complete switch between dispatch tables without
// the need for copying each function by function in the structure,
@@ -106,12 +107,18 @@
const gwp_asan::AllocatorState* gwp_asan_state = nullptr;
const gwp_asan::AllocationMetadata* gwp_asan_metadata = nullptr;
+ bool (*debuggerd_needs_gwp_asan_recovery)(void* fault_addr) = nullptr;
+ void (*debuggerd_gwp_asan_pre_crash_report)(void* fault_addr) = nullptr;
+ void (*debuggerd_gwp_asan_post_crash_report)(void* fault_addr) = nullptr;
const char* scudo_stack_depot = nullptr;
const char* scudo_region_info = nullptr;
const char* scudo_ring_buffer = nullptr;
+ size_t scudo_ring_buffer_size = 0;
HeapTaggingLevel initial_heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE;
+ bool initial_memtag_stack = false;
+ int64_t heap_tagging_upgrade_timer_sec = 0;
};
__LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals();
diff --git a/libc/seccomp/seccomp_bpfs.h b/libc/seccomp/seccomp_bpfs.h
index 3bdffa9..34219e2 100644
--- a/libc/seccomp/seccomp_bpfs.h
+++ b/libc/seccomp/seccomp_bpfs.h
@@ -33,6 +33,13 @@
extern const struct sock_filter arm64_system_filter[];
extern const size_t arm64_system_filter_size;
+extern const struct sock_filter riscv64_app_filter[];
+extern const size_t riscv64_app_filter_size;
+extern const struct sock_filter riscv64_app_zygote_filter[];
+extern const size_t riscv64_app_zygote_filter_size;
+extern const struct sock_filter riscv64_system_filter[];
+extern const size_t riscv64_system_filter_size;
+
extern const struct sock_filter x86_app_filter[];
extern const size_t x86_app_filter_size;
extern const struct sock_filter x86_app_zygote_filter[];
diff --git a/libc/seccomp/seccomp_policy.cpp b/libc/seccomp/seccomp_policy.cpp
index a42816e..1ca4eec 100644
--- a/libc/seccomp/seccomp_policy.cpp
+++ b/libc/seccomp/seccomp_policy.cpp
@@ -25,13 +25,13 @@
#include <vector>
#include <android-base/logging.h>
+#include <android-base/macros.h>
#include "func_to_syscall_nrs.h"
#include "seccomp_bpfs.h"
#if defined __arm__ || defined __aarch64__
-#define DUAL_ARCH
#define PRIMARY_ARCH AUDIT_ARCH_AARCH64
static const struct sock_filter* primary_app_filter = arm64_app_filter;
static const size_t primary_app_filter_size = arm64_app_filter_size;
@@ -52,9 +52,9 @@
static const long secondary_setresgid = __arm_setresgid;
static const long secondary_setresuid = __arm_setresuid;
+
#elif defined __i386__ || defined __x86_64__
-#define DUAL_ARCH
#define PRIMARY_ARCH AUDIT_ARCH_X86_64
static const struct sock_filter* primary_app_filter = x86_64_app_filter;
static const size_t primary_app_filter_size = x86_64_app_filter_size;
@@ -75,6 +75,20 @@
static const long secondary_setresgid = __x86_setresgid;
static const long secondary_setresuid = __x86_setresuid;
+
+#elif defined(__riscv)
+
+#define PRIMARY_ARCH AUDIT_ARCH_RISCV64
+static const struct sock_filter* primary_app_filter = riscv64_app_filter;
+static const size_t primary_app_filter_size = riscv64_app_filter_size;
+static const struct sock_filter* primary_app_zygote_filter = riscv64_app_zygote_filter;
+static const size_t primary_app_zygote_filter_size = riscv64_app_zygote_filter_size;
+static const struct sock_filter* primary_system_filter = riscv64_system_filter;
+static const size_t primary_system_filter_size = riscv64_system_filter_size;
+
+static const long primary_setresgid = __riscv64_setresgid;
+static const long primary_setresuid = __riscv64_setresuid;
+
#else
#error No architecture was defined!
#endif
@@ -98,7 +112,7 @@
f.push_back(BPF_STMT(BPF_LD|BPF_W|BPF_ABS, syscall_nr));
}
-#ifdef DUAL_ARCH
+#if defined(SECONDARY_ARCH)
static bool SetValidateArchitectureJumpTarget(size_t offset, filter& f) {
size_t jump_length = f.size() - offset - 1;
auto u8_jump_length = (__u8) jump_length;
@@ -149,9 +163,17 @@
// that's the only system call we need to check here. A CTS test ensures the other
// calls will remain blocked.
static void ValidateSetUidGid(filter& f, uint32_t uid_gid_min, uint32_t uid_gid_max, bool primary) {
+#if defined(SECONDARY_ARCH)
+ __u32 setresuid_nr = primary ? primary_setresuid : secondary_setresuid;
+ __u32 setresgid_nr = primary ? primary_setresgid : secondary_setresgid;
+#else
+ __u32 setresuid_nr = primary_setresuid;
+ __u32 setresgid_nr = primary_setresgid;
+ UNUSED(primary);
+#endif
+
// Check setresuid(ruid, euid, sguid) fall within range
ExamineSyscall(f);
- __u32 setresuid_nr = primary ? primary_setresuid : secondary_setresuid;
f.push_back(BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, setresuid_nr, 0, 12));
for (int arg = 0; arg < 3; arg++) {
ValidateSyscallArgInRange(f, arg, uid_gid_min, uid_gid_max);
@@ -159,7 +181,6 @@
// Check setresgid(rgid, egid, sgid) fall within range
ExamineSyscall(f);
- __u32 setresgid_nr = primary ? primary_setresgid : secondary_setresgid;
f.push_back(BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, setresgid_nr, 0, 12));
for (int arg = 0; arg < 3; arg++) {
ValidateSyscallArgInRange(f, arg, uid_gid_min, uid_gid_max);
@@ -184,7 +205,7 @@
bool _install_setuidgid_filter(uint32_t uid_gid_min, uint32_t uid_gid_max) {
filter f;
-#ifdef DUAL_ARCH
+#if defined(SECONDARY_ARCH)
// Note that for mixed 64/32 bit architectures, ValidateArchitecture inserts a
// jump that must be changed to point to the start of the 32-bit policy
// 32 bit syscalls will not hit the policy between here and the call to SetJump
@@ -195,7 +216,7 @@
ValidateSetUidGid(f, uid_gid_min, uid_gid_max, true /* primary */);
-#ifdef DUAL_ARCH
+#if defined(SECONDARY_ARCH)
if (!SetValidateArchitectureJumpTarget(offset_to_secondary_filter, f)) {
return false;
}
@@ -213,32 +234,43 @@
};
bool _set_seccomp_filter(FilterType type) {
- const sock_filter *p, *s;
- size_t p_size, s_size;
filter f;
+ const sock_filter* p;
+ size_t p_size;
+#if defined(SECONDARY_ARCH)
+ const sock_filter* s;
+ size_t s_size;
+#endif
+
switch (type) {
case APP:
p = primary_app_filter;
p_size = primary_app_filter_size;
+#if defined(SECONDARY_ARCH)
s = secondary_app_filter;
s_size = secondary_app_filter_size;
+#endif
break;
case APP_ZYGOTE:
p = primary_app_zygote_filter;
p_size = primary_app_zygote_filter_size;
+#if defined(SECONDARY_ARCH)
s = secondary_app_zygote_filter;
s_size = secondary_app_zygote_filter_size;
+#endif
break;
case SYSTEM:
p = primary_system_filter;
p_size = primary_system_filter_size;
+#if defined(SECONDARY_ARCH)
s = secondary_system_filter;
s_size = secondary_system_filter_size;
+#endif
break;
}
-#ifdef DUAL_ARCH
+#if defined(SECONDARY_ARCH)
// Note that for mixed 64/32 bit architectures, ValidateArchitecture inserts a
// jump that must be changed to point to the start of the 32-bit policy
// 32 bit syscalls will not hit the policy between here and the call to SetJump
@@ -254,7 +286,7 @@
}
Disallow(f);
-#ifdef DUAL_ARCH
+#if defined(SECONDARY_ARCH)
if (!SetValidateArchitectureJumpTarget(offset_to_secondary_filter, f)) {
return false;
}
diff --git a/libc/stdio/local.h b/libc/stdio/local.h
index 6ffda49..2fc12a0 100644
--- a/libc/stdio/local.h
+++ b/libc/stdio/local.h
@@ -170,7 +170,6 @@
#define _EXT(fp) __BIONIC_CAST(reinterpret_cast, struct __sfileext*, (fp)->_ext._base)
#define _UB(fp) _EXT(fp)->_ub
-#define _FLOCK(fp) _EXT(fp)->_lock
#define _FILEEXT_SETUP(fp, fext) \
do { \
diff --git a/libc/stdio/printf_common.h b/libc/stdio/printf_common.h
index 4dc5ca1..b0055f0 100644
--- a/libc/stdio/printf_common.h
+++ b/libc/stdio/printf_common.h
@@ -524,8 +524,21 @@
case 'u':
case 'X':
case 'x':
+ case 'B':
+ case 'b':
ADDUARG();
break;
+ case 'w':
+ n = 0;
+ ch = *fmt++;
+ while (is_digit(ch)) {
+ APPEND_DIGIT(n, ch);
+ ch = *fmt++;
+ }
+ if (n == 64) {
+ flags |= LLONGINT;
+ }
+ goto reswitch;
default: /* "%?" prints ?, unless ? is NUL */
if (ch == '\0') goto done;
break;
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index 08df2eb..645aefa 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -197,7 +197,7 @@
fp->_lb._size = 0;
memset(_EXT(fp), 0, sizeof(struct __sfileext));
- _FLOCK(fp) = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+ _EXT(fp)->_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
_EXT(fp)->_caller_handles_locking = false;
// Caller sets cookie, _read/_write etc.
@@ -884,7 +884,7 @@
void perror(const char* msg) {
if (msg == nullptr) msg = "";
- fprintf(stderr, "%s%s%s\n", msg, (*msg == '\0') ? "" : ": ", strerror(errno));
+ fprintf(stderr, "%s%s%m\n", msg, (*msg == '\0') ? "" : ": ");
}
int printf(const char* fmt, ...) {
@@ -1129,7 +1129,9 @@
// Read directly into the caller's buffer.
while (total > 0) {
- ssize_t bytes_read = (*fp->_read)(fp->_cookie, dst, total);
+ // The _read function pointer takes an int instead of a size_t.
+ int chunk_size = MIN(total, INT_MAX);
+ ssize_t bytes_read = (*fp->_read)(fp->_cookie, dst, chunk_size);
if (bytes_read <= 0) {
fp->_flags |= (bytes_read == 0) ? __SEOF : __SERR;
break;
@@ -1237,6 +1239,23 @@
return __FILE_close(fp);
}
+void flockfile(FILE* fp) {
+ CHECK_FP(fp);
+ pthread_mutex_lock(&_EXT(fp)->_lock);
+}
+
+int ftrylockfile(FILE* fp) {
+ CHECK_FP(fp);
+ // The specification for ftrylockfile() says it returns 0 on success,
+ // or non-zero on error. We don't bother canonicalizing to 0/-1...
+ return pthread_mutex_trylock(&_EXT(fp)->_lock);
+}
+
+void funlockfile(FILE* fp) {
+ CHECK_FP(fp);
+ pthread_mutex_unlock(&_EXT(fp)->_lock);
+}
+
namespace {
namespace phony {
diff --git a/libc/stdio/stdio_ext.cpp b/libc/stdio/stdio_ext.cpp
index 945813e..99a8af7 100644
--- a/libc/stdio/stdio_ext.cpp
+++ b/libc/stdio/stdio_ext.cpp
@@ -67,6 +67,12 @@
return fp->_p - fp->_bf._base;
}
+size_t __freadahead(FILE* fp) {
+ // Normally _r is the amount of input already available.
+ // When there's ungetc() data, _r counts that and _ur is the previous _r.
+ return fp->_r + (HASUB(fp) ? fp->_ur : 0);
+}
+
void _flushlbf() {
// If we flush all streams, we know we've flushed all the line-buffered streams.
fflush(nullptr);
diff --git a/libc/stdio/vfprintf.cpp b/libc/stdio/vfprintf.cpp
index d99d09c..b7c68dd 100644
--- a/libc/stdio/vfprintf.cpp
+++ b/libc/stdio/vfprintf.cpp
@@ -81,8 +81,8 @@
char* dtoaresult = nullptr;
uintmax_t _umax; /* integer arguments %[diouxX] */
- enum { OCT, DEC, HEX } base; /* base for %[diouxX] conversion */
- int dprec; /* a copy of prec if %[diouxX], 0 otherwise */
+ enum { BIN, OCT, DEC, HEX } base; /* base for %[bBdiouxX] conversion */
+ int dprec; /* a copy of prec if %[bBdiouxX], 0 otherwise */
int realsz; /* field size expanded by dprec */
int size; /* size of converted field or string */
const char* xdigs; /* digits for %[xX] conversion */
@@ -304,6 +304,12 @@
case 'z':
flags |= SIZEINT;
goto rflag;
+ case 'B':
+ case 'b':
+ _umax = UARG();
+ base = BIN;
+ if (flags & ALT && _umax != 0) ox[1] = ch;
+ goto nosign;
case 'C':
flags |= LONGINT;
__BIONIC_FALLTHROUGH;
@@ -515,6 +521,34 @@
_umax = UARG();
base = DEC;
goto nosign;
+ case 'w':
+ n = 0;
+ ch = *fmt++;
+ while (is_digit(ch)) {
+ APPEND_DIGIT(n, ch);
+ ch = *fmt++;
+ }
+ switch (n) {
+ case 8: {
+ flags |= CHARINT;
+ goto reswitch;
+ }
+ case 16: {
+ flags |= SHORTINT;
+ goto reswitch;
+ }
+ case 32: {
+ goto reswitch;
+ }
+ case 64: {
+ flags |= LLONGINT;
+ goto reswitch;
+ }
+ default: {
+ __fortify_fatal("%%w%d is unsupported", n);
+ break;
+ }
+ }
case 'X':
xdigs = xdigs_upper;
goto hex;
@@ -550,6 +584,13 @@
* a variable; hence this switch.
*/
switch (base) {
+ case BIN:
+ do {
+ *--cp = to_char(_umax & 1);
+ _umax >>= 1;
+ } while (_umax);
+ break;
+
case OCT:
do {
*--cp = to_char(_umax & 7);
@@ -599,7 +640,7 @@
* first be prefixed by any sign or other prefix; otherwise,
* it should be blank padded before the prefix is emitted.
* After any left-hand padding and prefixing, emit zeroes
- * required by a decimal %[diouxX] precision, then print the
+ * required by a decimal %[bBdiouxX] precision, then print the
* string proper, then emit zeroes required by any leftover
* floating precision; finally, if LADJUST, pad with blanks.
*
diff --git a/libc/stdio/vfscanf.cpp b/libc/stdio/vfscanf.cpp
index 424c4ef..d05a3a6 100644
--- a/libc/stdio/vfscanf.cpp
+++ b/libc/stdio/vfscanf.cpp
@@ -69,7 +69,8 @@
#define HAVESIGN 0x04000 // Sign detected
#define NDIGITS 0x08000 // No digits detected
#define PFXOK 0x10000 // "0x" prefix is (still) legal
-#define NZDIGITS 0x20000 // No zero digits detected
+#define PFBOK 0x20000 // "0b" prefix is (still) legal
+#define NZDIGITS 0x40000 // No zero digits detected
// Conversion types.
#define CT_CHAR 0 // %c conversion
@@ -101,9 +102,6 @@
void* allocation = nullptr; // Allocated but unassigned result for %mc/%ms/%m[.
size_t capacity = 0; // Number of char/wchar_t units allocated in `allocation`.
- /* `basefix' is used to avoid `if' tests in the integer scanner */
- static short basefix[17] = { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-
_SET_ORIENTATION(fp, -1);
nassigned = 0;
@@ -188,6 +186,12 @@
* Conversions.
* Those marked `compat' are for 4.[123]BSD compatibility.
*/
+ case 'b':
+ c = CT_INT;
+ base = 2;
+ flags |= PFBOK; /* enable 0b prefixing */
+ break;
+
case 'D': /* compat */
flags |= LONG;
__BIONIC_FALLTHROUGH;
@@ -558,7 +562,7 @@
* digits (zero or nonzero) have been
* scanned (only signs), we will have
* base==0. In that case, we should set
- * it to 8 and enable 0x prefixing.
+ * it to 8 and enable 0b/0x prefixing.
* Also, if we have not scanned zero digits
* before this, do not turn off prefixing
* (someone else will turn it off if we
@@ -567,15 +571,24 @@
case '0':
if (base == 0) {
base = 8;
- flags |= PFXOK;
+ flags |= PFBOK | PFXOK;
}
- if (flags & NZDIGITS)
+ if (flags & NZDIGITS) {
flags &= ~(SIGNOK | NZDIGITS | NDIGITS);
- else
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
+ } else {
+ flags &= ~(SIGNOK | PFBOK | PFXOK | NDIGITS);
+ }
goto ok;
-
- /* 1 through 7 always legal */
+ case 'B':
+ case 'b':
+ // Is this 'b' or 'B' potentially part of an "0b" prefix?
+ if ((flags & PFBOK) && p == buf + 1 + !!(flags & HAVESIGN)) {
+ base = 2;
+ flags &= ~PFBOK;
+ goto ok;
+ }
+ // No? Fall through and see if it's a hex digit instead then...
+ __BIONIC_FALLTHROUGH;
case '1':
case '2':
case '3':
@@ -583,34 +596,21 @@
case '5':
case '6':
case '7':
- base = basefix[base];
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* digits 8 and 9 ok iff decimal or hex */
case '8':
case '9':
- base = basefix[base];
- if (base <= 8) break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* letters ok iff hex */
case 'A':
- case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'a':
- case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
- /* no need to fix base here */
- if (base <= 10) break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
+ if (base == 0) base = 10;
+ if (base != 16 && (c - '0') >= base) break; /* not legal here */
+ flags &= ~(SIGNOK | PFBOK | PFXOK | NDIGITS);
goto ok;
/* sign ok only as first character */
@@ -653,17 +653,16 @@
break; /* EOF */
}
/*
- * If we had only a sign, it is no good; push
- * back the sign. If the number ends in `x',
- * it was [sign] '0' 'x', so push back the x
- * and treat it as [sign] '0'.
+ * If we had only a sign, it is no good; push back the sign.
+ * If the number was `[-+]0[BbXx]`, push back and treat it
+ * as `[-+]0`.
*/
if (flags & NDIGITS) {
if (p > buf) (void)ungetc(*(u_char*)--p, fp);
goto match_failure;
}
c = ((u_char*)p)[-1];
- if (c == 'x' || c == 'X') {
+ if ((base == 2 && (c == 'b' || c == 'B')) || c == 'x' || c == 'X') {
--p;
(void)ungetc(c, fp);
}
diff --git a/libc/stdio/vfwprintf.cpp b/libc/stdio/vfwprintf.cpp
index dd51eec..52ae64b 100644
--- a/libc/stdio/vfwprintf.cpp
+++ b/libc/stdio/vfwprintf.cpp
@@ -81,8 +81,8 @@
char* dtoaresult = nullptr;
uintmax_t _umax; /* integer arguments %[diouxX] */
- enum { OCT, DEC, HEX } base; /* base for %[diouxX] conversion */
- int dprec; /* a copy of prec if %[diouxX], 0 otherwise */
+ enum { BIN, OCT, DEC, HEX } base; /* base for %[bBdiouxX] conversion */
+ int dprec; /* a copy of prec if %[bBdiouxX], 0 otherwise */
int realsz; /* field size expanded by dprec */
int size; /* size of converted field or string */
const char* xdigs; /* digits for %[xX] conversion */
@@ -293,6 +293,12 @@
case 'z':
flags |= SIZEINT;
goto rflag;
+ case 'B':
+ case 'b':
+ _umax = UARG();
+ base = BIN;
+ if (flags & ALT && _umax != 0) ox[1] = ch;
+ goto nosign;
case 'C':
flags |= LONGINT;
__BIONIC_FALLTHROUGH;
@@ -504,6 +510,34 @@
_umax = UARG();
base = DEC;
goto nosign;
+ case 'w':
+ n = 0;
+ ch = *fmt++;
+ while (is_digit(ch)) {
+ APPEND_DIGIT(n, ch);
+ ch = *fmt++;
+ }
+ switch (n) {
+ case 8: {
+ flags |= CHARINT;
+ goto reswitch;
+ }
+ case 16: {
+ flags |= SHORTINT;
+ goto reswitch;
+ }
+ case 32: {
+ goto reswitch;
+ }
+ case 64: {
+ flags |= LLONGINT;
+ goto reswitch;
+ }
+ default: {
+ __fortify_fatal("%%w%d is unsupported", n);
+ break;
+ }
+ }
case 'X':
xdigs = xdigs_upper;
goto hex;
@@ -539,6 +573,13 @@
* a variable; hence this switch.
*/
switch (base) {
+ case BIN:
+ do {
+ *--cp = to_char(_umax & 1);
+ _umax >>= 1;
+ } while (_umax);
+ break;
+
case OCT:
do {
*--cp = to_char(_umax & 7);
@@ -588,7 +629,7 @@
* first be prefixed by any sign or other prefix; otherwise,
* it should be blank padded before the prefix is emitted.
* After any left-hand padding and prefixing, emit zeroes
- * required by a decimal %[diouxX] precision, then print the
+ * required by a decimal %[bBdiouxX] precision, then print the
* string proper, then emit zeroes required by any leftover
* floating precision; finally, if LADJUST, pad with blanks.
*
diff --git a/libc/stdio/vfwscanf.c b/libc/stdio/vfwscanf.cpp
similarity index 91%
rename from libc/stdio/vfwscanf.c
rename to libc/stdio/vfwscanf.cpp
index 71cd49b..06f706a 100644
--- a/libc/stdio/vfwscanf.c
+++ b/libc/stdio/vfwscanf.cpp
@@ -42,6 +42,8 @@
#include <wctype.h>
#include "local.h"
+#include <platform/bionic/macros.h>
+
#define BUF 513 /* Maximum length of numeric string. */
/*
@@ -65,15 +67,16 @@
* SIGNOK, HAVESIGN, NDIGITS, DPTOK, and EXPOK are for floating point;
* SIGNOK, HAVESIGN, NDIGITS, PFXOK, and NZDIGITS are for integral.
*/
-#define SIGNOK 0x01000 /* +/- is (still) legal */
+#define SIGNOK 0x01000 /* +/- is (still) legal */
#define HAVESIGN 0x02000 /* sign detected */
-#define NDIGITS 0x04000 /* no digits detected */
+#define NDIGITS 0x04000 /* no digits detected */
-#define DPTOK 0x08000 /* (float) decimal point is still legal */
-#define EXPOK 0x10000 /* (float) exponent (e+3, etc) still legal */
+#define DPTOK 0x08000 /* (float) decimal point is still legal */
+#define EXPOK 0x10000 /* (float) exponent (e+3, etc) still legal */
-#define PFXOK 0x08000 /* 0x prefix is (still) legal */
-#define NZDIGITS 0x10000 /* no zero digits detected */
+#define PFBOK 0x20000 /* 0x prefix is (still) legal */
+#define PFXOK 0x40000 /* 0x prefix is (still) legal */
+#define NZDIGITS 0x80000 /* no zero digits detected */
/*
* Conversion types.
@@ -147,9 +150,6 @@
char mbbuf[MB_LEN_MAX]; /* temporary mb. character buffer */
mbstate_t mbs;
- /* `basefix' is used to avoid `if' tests in the integer scanner */
- static short basefix[17] = { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-
_SET_ORIENTATION(fp, 1);
nassigned = 0;
@@ -239,9 +239,15 @@
* Conversions.
* Those marked `compat' are for 4.[123]BSD compatibility.
*/
+ case 'b':
+ c = CT_INT;
+ base = 2;
+ flags |= PFBOK; /* enable 0b prefixing */
+ break;
+
case 'D': /* compat */
flags |= LONG;
- /* FALLTHROUGH */
+ __BIONIC_FALLTHROUGH;
case 'd':
c = CT_INT;
base = 10;
@@ -254,7 +260,7 @@
case 'O': /* compat */
flags |= LONG;
- /* FALLTHROUGH */
+ __BIONIC_FALLTHROUGH;
case 'o':
c = CT_INT;
flags |= UNSIGNED;
@@ -468,7 +474,7 @@
* digits (zero or nonzero) have been
* scanned (only signs), we will have
* base==0. In that case, we should set
- * it to 8 and enable 0x prefixing.
+ * it to 8 and enable 0b/0x prefixing.
* Also, if we have not scanned zero digits
* before this, do not turn off prefixing
* (someone else will turn it off if we
@@ -477,15 +483,26 @@
case '0':
if (base == 0) {
base = 8;
- flags |= PFXOK;
+ flags |= PFBOK | PFXOK;
}
- if (flags & NZDIGITS)
+ if (flags & NZDIGITS) {
flags &= ~(SIGNOK | NZDIGITS | NDIGITS);
- else
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
+ } else {
+ flags &= ~(SIGNOK | PFBOK | PFXOK | NDIGITS);
+ }
goto ok;
/* 1 through 7 always legal */
+ case 'B':
+ case 'b':
+ // Is this 'b' potentially part of an "0b" prefix?
+ if ((flags & PFBOK) && p == buf + 1 + !!(flags & HAVESIGN)) {
+ base = 2;
+ flags &= ~PFBOK;
+ goto ok;
+ }
+ // No? Fall through and see if it's a hex digit instead then...
+ __BIONIC_FALLTHROUGH;
case '1':
case '2':
case '3':
@@ -493,34 +510,21 @@
case '5':
case '6':
case '7':
- base = basefix[base];
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* digits 8 and 9 ok iff decimal or hex */
case '8':
case '9':
- base = basefix[base];
- if (base <= 8) break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* letters ok iff hex */
case 'A':
- case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'a':
- case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
- /* no need to fix base here */
- if (base <= 10) break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
+ if (base == 0) base = 10;
+ if (base != 16 && (int)(c - '0') >= base) break; /* not legal here */
+ flags &= ~(SIGNOK | PFBOK | PFXOK | NDIGITS);
goto ok;
/* sign ok only as first character */
@@ -560,17 +564,16 @@
*p++ = (wchar_t)c;
}
/*
- * If we had only a sign, it is no good; push
- * back the sign. If the number ends in `x',
- * it was [sign] '0' 'x', so push back the x
- * and treat it as [sign] '0'.
+ * If we had only a sign, it is no good; push back the sign.
+ * If the number was `[-+]0[BbXx]`, push back and treat it
+ * as `[-+]0`.
*/
if (flags & NDIGITS) {
if (p > buf) __ungetwc(*--p, fp);
goto match_failure;
}
c = p[-1];
- if (c == 'x' || c == 'X') {
+ if ((base == 2 && (c == 'b' || c == 'B')) || c == 'x' || c == 'X') {
--p;
__ungetwc(c, fp);
}
diff --git a/libc/tools/Android.bp b/libc/tools/Android.bp
index 116b853..c7fce64 100644
--- a/libc/tools/Android.bp
+++ b/libc/tools/Android.bp
@@ -8,8 +8,8 @@
default_applicable_licenses: ["bionic_libc_license"],
}
-filegroup {
- name: "bionic-gensyscalls",
+python_binary_host {
+ name: "gensyscalls",
srcs: ["gensyscalls.py"],
}
diff --git a/libc/tools/genfunctosyscallnrs.py b/libc/tools/genfunctosyscallnrs.py
index fa48844..9b8f7ee 100755
--- a/libc/tools/genfunctosyscallnrs.py
+++ b/libc/tools/genfunctosyscallnrs.py
@@ -21,12 +21,12 @@
def gen_syscall_nrs(out_file, base_syscall_file, syscall_NRs):
- for arch in SupportedArchitectures:
+ for arch in syscall_NRs.keys():
base_names = load_syscall_names_from_file(base_syscall_file, arch)
for func, syscall in base_names.items():
out_file.write("#define __" + arch + "_" + func + " " +
- str(syscall_NRs[arch][syscall]) + ";\n")
+ str(syscall_NRs[arch][syscall]) + "\n")
def main():
diff --git a/libc/tools/genseccomp.py b/libc/tools/genseccomp.py
index 33bf470..8a07caf 100755
--- a/libc/tools/genseccomp.py
+++ b/libc/tools/genseccomp.py
@@ -5,9 +5,10 @@
import operator
import os
import re
+import sys
import textwrap
-from gensyscalls import SupportedArchitectures, SysCallsTxtParser
+from gensyscalls import SysCallsTxtParser
BPF_JGE = "BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, {0}, {1}, {2})"
@@ -84,42 +85,46 @@
# #define __(ARM_)?NR_${NAME} ${VALUE}
#
# Where ${VALUE} is a preprocessor expression.
+ #
+ # Newer architectures have things like this though:
+ #
+ # #define __NR3264_fcntl 25
+ # #define __NR_fcntl __NR3264_fcntl
+ #
+ # So we need to keep track of the __NR3264_* constants and substitute them.
- constant_re = re.compile(
- r'^\s*#define\s+([A-Za-z_][A-Za-z0-9_]+)\s+(.+)\s*$')
+ line_re = re.compile(r'^# \d+ ".*".*')
+ undef_re = re.compile(r'^#undef\s.*')
+ define_re = re.compile(r'^\s*#define\s+([A-Za-z0-9_(,)]+)(?:\s+(.+))?\s*$')
token_re = re.compile(r'\b[A-Za-z_][A-Za-z0-9_]+\b')
constants = {}
+ nr3264s = {}
with open(names_path) as f:
for line in f:
- m = constant_re.match(line)
- if m is None:
- continue
- try:
+ line = line.strip()
+ m = define_re.match(line)
+ if m:
name = m.group(1)
- # eval() takes care of any arithmetic that may be done
- value = eval(token_re.sub(lambda x: str(constants[x.group(0)]),
- m.group(2)))
+ value = m.group(2)
+ if name.startswith('__NR3264'):
+ nr3264s[name] = value
+ elif name.startswith('__NR_') or name.startswith('__ARM_NR_'):
+ if value in nr3264s:
+ value = nr3264s[value]
+ # eval() takes care of any arithmetic that may be done
+ value = eval(token_re.sub(lambda x: str(constants[x.group(0)]), value))
- constants[name] = value
- except: # pylint: disable=bare-except
- # TODO: This seems wrong.
- # Key error doesn't seem like the error the original author was trying
- # to catch. It looks like the intent was to catch IndexError from
- # match.group() for non-matching lines, but that's impossible because
- # the match object is checked and continued if not matched. What
- # actually happens is that KeyError is thrown by constants[x.group(0)]
- # on at least the first run because the dict is empty.
- #
- # It's also matching syntax errors because not all C integer literals
- # are valid Python integer literals, e.g. 10L.
- logging.debug('Failed to parse %s', line)
+ constants[name] = value
+ else:
+ if not line_re.match(line) and not undef_re.match(line) and line:
+ print('%s: failed to parse line `%s`' % (names_path, line))
+ sys.exit(1)
syscalls = {}
for name, value in constants.items():
- if not name.startswith("__NR_") and not name.startswith("__ARM_NR"):
- continue
+ # Remove the __NR_ prefix.
+ # TODO: why not __ARM_NR too?
if name.startswith("__NR_"):
- # Remote the __NR_ prefix
name = name[len("__NR_"):]
syscalls[name] = value
@@ -237,7 +242,7 @@
def gen_policy(name_modifier, out_dir, base_syscall_file, syscall_files,
syscall_NRs, priority_file):
- for arch in SupportedArchitectures:
+ for arch in syscall_NRs.keys():
base_names = load_syscall_names_from_file(base_syscall_file, arch)
allowlist_names = set()
blocklist_names = set()
@@ -251,11 +256,11 @@
priorities = load_syscall_priorities_from_file(priority_file)
allowed_syscalls = []
- for name in merge_names(base_names, allowlist_names, blocklist_names):
+ for name in sorted(merge_names(base_names, allowlist_names, blocklist_names)):
try:
allowed_syscalls.append((name, syscall_NRs[arch][name]))
except:
- logging.exception("Failed to find %s in %s", name, arch)
+ logging.exception("Failed to find %s in %s (%s)", name, arch, syscall_NRs[arch])
raise
output = construct_bpf(allowed_syscalls, arch, name_modifier, priorities)
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index baaa52d..558b004 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -15,7 +15,7 @@
import tempfile
-SupportedArchitectures = [ "arm", "arm64", "x86", "x86_64" ]
+SupportedArchitectures = [ "arm", "arm64", "riscv64", "x86", "x86_64" ]
syscall_stub_header = \
"""
@@ -80,6 +80,24 @@
#
+# RISC-V64 assembler templates for each syscall stub
+#
+
+riscv64_call = syscall_stub_header + """\
+ li a7, %(__NR_name)s
+ ecall
+
+ li a7, -MAX_ERRNO
+ bgtu a0, a7, 1f
+
+ ret
+1:
+ neg a0, a0
+ tail __set_errno_internal
+END(%(func)s)
+"""
+
+#
# x86 assembler templates for each syscall stub
#
@@ -228,6 +246,10 @@
return arm64_call % syscall
+def riscv64_genstub(syscall):
+ return riscv64_call % syscall
+
+
def x86_genstub(syscall):
result = syscall_stub_header % syscall
@@ -311,10 +333,12 @@
class SysCallsTxtParser:
def __init__(self):
self.syscalls = []
- self.lineno = 0
+ self.lineno = 0
+ self.errors = False
def E(self, msg):
print("%d: %s" % (self.lineno, msg))
+ self.errors = True
def parse_line(self, line):
""" parse a syscall spec line.
@@ -421,6 +445,8 @@
if not line: continue
if line[0] == '#': continue
self.parse_line(line)
+ if self.errors:
+ sys.exit(1)
def parse_file(self, file_path):
with open(file_path) as fp:
@@ -440,6 +466,9 @@
if "arm64" in syscall:
syscall["asm-arm64"] = add_footer(64, arm64_genstub(syscall), syscall)
+ if "riscv64" in syscall:
+ syscall["asm-riscv64"] = add_footer(64, riscv64_genstub(syscall), syscall)
+
if "x86" in syscall:
if syscall["socketcall_id"] >= 0:
syscall["asm-x86"] = add_footer(32, x86_genstub_socketcall(syscall), syscall)
diff --git a/libc/tzcode/asctime.c b/libc/tzcode/asctime.c
index 337a313..ce5d4be 100644
--- a/libc/tzcode/asctime.c
+++ b/libc/tzcode/asctime.c
@@ -1,3 +1,5 @@
+/* asctime and asctime_r a la POSIX and ISO C, except pad years before 1000. */
+
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
@@ -12,7 +14,7 @@
/*LINTLIBRARY*/
#include "private.h"
-#include "tzfile.h"
+#include <stdio.h>
/*
** Some systems only handle "%.2d"; others only handle "%02d";
@@ -29,13 +31,13 @@
** leading zeroes to get the newline in the traditional place.
** The -4 ensures that we get four characters of output even if
** we call a strftime variant that produces fewer characters for some years.
-** The ISO C 1999 and POSIX 1003.1-2004 standards prohibit padding the year,
+** The ISO C and POSIX standards prohibit padding the year,
** but many implementations pad anyway; most likely the standards are buggy.
*/
#ifdef __GNUC__
-#define ASCTIME_FMT "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %-4s\n"
+#define ASCTIME_FMT "%s %s%3d %2.2d:%2.2d:%2.2d %-4s\n"
#else /* !defined __GNUC__ */
-#define ASCTIME_FMT "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n"
+#define ASCTIME_FMT "%s %s%3d %02.2d:%02.2d:%02.2d %-4s\n"
#endif /* !defined __GNUC__ */
/*
** For years that are more than four digits we put extra spaces before the year
@@ -44,9 +46,9 @@
** that no output is better than wrong output).
*/
#ifdef __GNUC__
-#define ASCTIME_FMT_B "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %s\n"
+#define ASCTIME_FMT_B "%s %s%3d %2.2d:%2.2d:%2.2d %s\n"
#else /* !defined __GNUC__ */
-#define ASCTIME_FMT_B "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %s\n"
+#define ASCTIME_FMT_B "%s %s%3d %02.2d:%02.2d:%02.2d %s\n"
#endif /* !defined __GNUC__ */
#define STD_ASCTIME_BUF_SIZE 26
@@ -64,17 +66,13 @@
static char buf_asctime[MAX_ASCTIME_BUF_SIZE];
-/*
-** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition.
-*/
-
char *
asctime_r(register const struct tm *timeptr, char *buf)
{
- static const char wday_name[][3] = {
+ static const char wday_name[][4] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
- static const char mon_name[][3] = {
+ static const char mon_name[][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
@@ -117,10 +115,6 @@
}
}
-/*
-** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition.
-*/
-
char *
asctime(register const struct tm *timeptr)
{
diff --git a/libc/tzcode/bionic.cpp b/libc/tzcode/bionic.cpp
index e134aaa..d2b5d80 100644
--- a/libc/tzcode/bionic.cpp
+++ b/libc/tzcode/bionic.cpp
@@ -190,6 +190,18 @@
// Give up now, and don't try fallback tzdata files. We don't log here
// because for all we know the given olson id was nonsense.
close(fd);
+ // This file descriptor (-1) is passed to localtime.c. In invalid fd case
+ // upstream passes errno value around methods and having 0 there will
+ // indicate that time zone was found and read successfully and localtime's
+ // internal state was properly initialized (which wasn't as we couldn't find
+ // requested time zone in the tzdata file).
+ // If we reached this point errno is unlikely to be touched. It is only
+ // close(fd) which can do it, but that is very unlikely to happen. And
+ // even if it happens we can't extract any useful insights from it.
+ // We are overriding it to ENOENT as it matches upstream expectations -
+ // time zone is absent in the tzdata file == there is no TZif file in
+ // /usr/share/zoneinfo.
+ errno = ENOENT;
return -1;
}
@@ -206,24 +218,14 @@
int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
int fd;
- // Try the three locations for the tzdata file in a strict order:
- // 1: The O-MR1 time zone updates via APK update mechanism. This is
- // tried first because it allows us to test that the time zone updates
- // via APK mechanism still works even on devices with the time zone
- // module.
- // TODO: remove this when those devices are no longer supported.
- // 2: The time zone data module which contains the main copy. This is the
+ // Try the two locations for the tzdata file in a strict order:
+ // 1: The time zone data module which contains the main copy. This is the
// common case for current devices.
- // 3: The ultimate fallback: the non-updatable copy in /system.
+ // 2: The ultimate fallback: the non-updatable copy in /system.
#if defined(__ANDROID__)
// On Android devices, bionic has to work even if exec takes place without
// environment variables set. So, all paths are hardcoded here.
-
- fd = __bionic_open_tzdata_path("/data/misc/zoneinfo/current/tzdata",
- olson_id, entry_length);
- if (fd >= -1) return fd;
-
fd = __bionic_open_tzdata_path("/apex/com.android.tzdata/etc/tz/tzdata",
olson_id, entry_length);
if (fd >= -1) return fd;
@@ -233,16 +235,10 @@
if (fd >= -1) return fd;
#else
// On the host, we don't expect the hard-coded locations above to exist, and
- // we're not worried about security so we trust $ANDROID_DATA,
- // $ANDROID_TZDATA_ROOT, and $ANDROID_ROOT to point us in the right direction
- // instead.
+ // we're not worried about security so we trust $ANDROID_TZDATA_ROOT, and
+ // $ANDROID_ROOT to point us in the right direction instead.
- char* path = make_path("ANDROID_DATA", "/misc/zoneinfo/current/tzdata");
- fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
- free(path);
- if (fd >= -1) return fd;
-
- path = make_path("ANDROID_TZDATA_ROOT", "/etc/tz/tzdata");
+ char* path = make_path("ANDROID_TZDATA_ROOT", "/etc/tz/tzdata");
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
free(path);
if (fd >= -1) return fd;
diff --git a/libc/tzcode/difftime.c b/libc/tzcode/difftime.c
index ba2fd03..ff78f03 100644
--- a/libc/tzcode/difftime.c
+++ b/libc/tzcode/difftime.c
@@ -1,3 +1,5 @@
+/* Return the difference between two timestamps. */
+
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
@@ -14,14 +16,14 @@
return -x;
}
-double ATTRIBUTE_CONST
+double
difftime(time_t time1, time_t time0)
{
/*
** If double is large enough, simply convert and subtract
** (assuming that the larger type has more precision).
*/
- if (sizeof (time_t) < sizeof (double)) {
+ if (sizeof(time_t) < sizeof(double)) {
double t1 = time1, t0 = time0;
return t1 - t0;
}
@@ -34,7 +36,7 @@
return time0 <= time1 ? time1 - time0 : dminus(time0 - time1);
/* Use uintmax_t if wide enough. */
- if (sizeof (time_t) <= sizeof (uintmax_t)) {
+ if (sizeof(time_t) <= sizeof(uintmax_t)) {
uintmax_t t1 = time1, t0 = time0;
return time0 <= time1 ? t1 - t0 : dminus(t0 - t1);
}
diff --git a/libc/tzcode/localedef.h b/libc/tzcode/localedef.h
new file mode 100644
index 0000000..19d4df9
--- /dev/null
+++ b/libc/tzcode/localedef.h
@@ -0,0 +1,106 @@
+/* $OpenBSD: localedef.h,v 1.1 2016/05/23 00:05:15 guenther Exp $ */
+/* $NetBSD: localedef.h,v 1.4 1996/04/09 20:55:31 cgd Exp $ */
+
+/*
+ * Copyright (c) 1994 Winning Strategies, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Winning Strategies, Inc.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LOCALEDEF_H_
+#define _LOCALEDEF_H_
+
+#include <sys/types.h>
+
+typedef struct
+{
+ char *yesexpr;
+ char *noexpr;
+ char *yesstr;
+ char *nostr;
+} _MessagesLocale;
+
+
+typedef struct
+{
+ char *int_curr_symbol;
+ char *currency_symbol;
+ char *mon_decimal_point;
+ char *mon_thousands_sep;
+ char *mon_grouping;
+ char *positive_sign;
+ char *negative_sign;
+ char int_frac_digits;
+ char frac_digits;
+ char p_cs_precedes;
+ char p_sep_by_space;
+ char n_cs_precedes;
+ char n_sep_by_space;
+ char p_sign_posn;
+ char n_sign_posn;
+ char int_p_cs_precedes;
+ char int_p_sep_by_space;
+ char int_n_cs_precedes;
+ char int_n_sep_by_space;
+ char int_p_sign_posn;
+ char int_n_sign_posn;
+} _MonetaryLocale;
+
+
+typedef struct
+{
+ const char *decimal_point;
+ const char *thousands_sep;
+ const char *grouping;
+} _NumericLocale;
+
+
+typedef struct {
+ const char *abday[7];
+ const char *day[7];
+ const char *abmon[12];
+ const char *mon[12];
+ const char *am_pm[2];
+ const char *d_t_fmt;
+ const char *d_fmt;
+ const char *t_fmt;
+ const char *t_fmt_ampm;
+} _TimeLocale;
+
+
+//__BEGIN_HIDDEN_DECLS
+extern const _MessagesLocale *_CurrentMessagesLocale;
+extern const _MessagesLocale _DefaultMessagesLocale;
+extern const _MonetaryLocale *_CurrentMonetaryLocale;
+extern const _MonetaryLocale _DefaultMonetaryLocale;
+extern const _NumericLocale *_CurrentNumericLocale;
+extern const _NumericLocale _DefaultNumericLocale;
+extern const _TimeLocale *_CurrentTimeLocale;
+extern const _TimeLocale _DefaultTimeLocale;
+//__END_HIDDEN_DECLS
+
+#endif /* !_LOCALEDEF_H_ */
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c
index 091bab0..8ff5cee 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -1,3 +1,5 @@
+/* Convert timestamp from time_t to struct tm. */
+
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
@@ -14,9 +16,9 @@
#include "private.h"
#include "tzfile.h"
-#include "fcntl.h"
+#include <fcntl.h>
-#if THREAD_SAFE
+#if defined THREAD_SAFE && THREAD_SAFE
# include <pthread.h>
static pthread_mutex_t locallock = PTHREAD_MUTEX_INITIALIZER;
static int lock(void) { return pthread_mutex_lock(&locallock); }
@@ -26,14 +28,6 @@
static void unlock(void) { }
#endif
-/* NETBSD_INSPIRED_EXTERN functions are exported to callers if
- NETBSD_INSPIRED is defined, and are private otherwise. */
-#if NETBSD_INSPIRED
-# define NETBSD_INSPIRED_EXTERN
-#else
-# define NETBSD_INSPIRED_EXTERN static
-#endif
-
#ifndef TZ_ABBR_MAX_LEN
#define TZ_ABBR_MAX_LEN 16
#endif /* !defined TZ_ABBR_MAX_LEN */
@@ -87,31 +81,39 @@
/*
** The DST rules to use if TZ has no rules and we can't load TZDEFRULES.
-** We default to US rules as of 1999-08-17.
-** POSIX 1003.1 section 8.1.1 says that the default DST rules are
-** implementation dependent; for historical reasons, US rules are a
-** common default.
+** Default to US rules as of 2017-05-07.
+** POSIX does not specify the default DST rules;
+** for historical reasons, US rules are a common default.
*/
#ifndef TZDEFRULESTRING
-#define TZDEFRULESTRING ",M4.1.0,M10.5.0"
-#endif /* !defined TZDEFDST */
+#define TZDEFRULESTRING ",M3.2.0,M11.1.0"
+#endif
struct ttinfo { /* time type information */
- int_fast32_t tt_gmtoff; /* UT offset in seconds */
+ int_fast32_t tt_utoff; /* UT offset in seconds */
bool tt_isdst; /* used to set tm_isdst */
- int tt_abbrind; /* abbreviation list index */
+ int tt_desigidx; /* abbreviation list index */
bool tt_ttisstd; /* transition is std time */
- bool tt_ttisgmt; /* transition is UT */
+ bool tt_ttisut; /* transition is UT */
};
struct lsinfo { /* leap second information */
time_t ls_trans; /* transition time */
- int_fast64_t ls_corr; /* correction to apply */
+ int_fast32_t ls_corr; /* correction to apply */
};
#define SMALLEST(a, b) (((a) < (b)) ? (a) : (b))
#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
+/* This abbreviation means local time is unspecified. */
+static char const UNSPEC[] = "-00";
+
+/* How many extra bytes are needed at the end of struct state's chars array.
+ This needs to be at least 1 for null termination in case the input
+ data isn't properly terminated, and it also needs to be big enough
+ for ttunspecified to work without crashing. */
+enum { CHARS_EXTRA = BIGGEST(sizeof UNSPEC, 2) - 1 };
+
#ifdef TZNAME_MAX
#define MY_TZNAME_MAX TZNAME_MAX
#endif /* defined TZNAME_MAX */
@@ -129,10 +131,14 @@
time_t ats[TZ_MAX_TIMES];
unsigned char types[TZ_MAX_TIMES];
struct ttinfo ttis[TZ_MAX_TYPES];
- char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
+ char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + CHARS_EXTRA,
+ sizeof gmt),
(2 * (MY_TZNAME_MAX + 1)))];
struct lsinfo lsis[TZ_MAX_LEAPS];
- int defaulttype; /* for early times or if no transitions */
+ /* The time type to use for early times or if no transitions.
+ It is always zero for recent tzdb releases.
+ It might be nonzero for data from tzdb 2018e or earlier. */
+ int defaulttype;
};
enum r_type {
@@ -153,11 +159,12 @@
struct tm *);
static bool increment_overflow(int *, int);
static bool increment_overflow_time(time_t *, int_fast32_t);
+static int_fast32_t leapcorr(struct state const *, time_t);
static bool normalize_overflow32(int_fast32_t *, int *, int);
static struct tm *timesub(time_t const *, int_fast32_t, struct state const *,
struct tm *);
static bool typesequiv(struct state const *, int, int);
-static bool tzparse(char const *, struct state *, bool);
+static bool tzparse(char const *, struct state *, struct state *);
#ifdef ALL_STATE
static struct state * lclptr;
@@ -188,30 +195,39 @@
static struct tm tm;
-#if !HAVE_POSIX_DECLS
+#if 2 <= HAVE_TZNAME + TZ_TIME_T
char * tzname[2] = {
(char *) wildabbr,
(char *) wildabbr
};
-#ifdef USG_COMPAT
+#endif
+#if 2 <= USG_COMPAT + TZ_TIME_T
long timezone;
int daylight;
-# endif
#endif
-#ifdef ALTZONE
+#if 2 <= ALTZONE + TZ_TIME_T
long altzone;
-#endif /* defined ALTZONE */
+#endif
-/* Initialize *S to a value based on GMTOFF, ISDST, and ABBRIND. */
+/* Initialize *S to a value based on UTOFF, ISDST, and DESIGIDX. */
static void
-init_ttinfo(struct ttinfo *s, int_fast32_t gmtoff, bool isdst, int abbrind)
+init_ttinfo(struct ttinfo *s, int_fast32_t utoff, bool isdst, int desigidx)
{
- s->tt_gmtoff = gmtoff;
+ s->tt_utoff = utoff;
s->tt_isdst = isdst;
- s->tt_abbrind = abbrind;
+ s->tt_desigidx = desigidx;
s->tt_ttisstd = false;
- s->tt_ttisgmt = false;
+ s->tt_ttisut = false;
+}
+
+/* Return true if SP's time type I does not specify local time. */
+static bool
+ttunspecified(struct state const *sp, int i)
+{
+ char const *abbr = &sp->chars[sp->ttis[i].tt_desigidx];
+ /* memcmp is likely faster than strcmp, and is safe due to CHARS_EXTRA. */
+ return memcmp(abbr, UNSPEC, sizeof UNSPEC) == 0;
}
static int_fast32_t
@@ -240,7 +256,7 @@
static int_fast64_t
detzcode64(const char *const codep)
{
- register uint_fast64_t result;
+ register int_fast64_t result;
register int i;
int_fast64_t one = 1;
int_fast64_t halfmaxval = one << (64 - 2);
@@ -263,52 +279,71 @@
static void
update_tzname_etc(struct state const *sp, struct ttinfo const *ttisp)
{
- tzname[ttisp->tt_isdst] = (char *) &sp->chars[ttisp->tt_abbrind];
-#ifdef USG_COMPAT
+#if HAVE_TZNAME
+ tzname[ttisp->tt_isdst] = (char *) &sp->chars[ttisp->tt_desigidx];
+#endif
+#if USG_COMPAT
if (!ttisp->tt_isdst)
- timezone = - ttisp->tt_gmtoff;
+ timezone = - ttisp->tt_utoff;
#endif
-#ifdef ALTZONE
+#if ALTZONE
if (ttisp->tt_isdst)
- altzone = - ttisp->tt_gmtoff;
+ altzone = - ttisp->tt_utoff;
#endif
}
+/* If STDDST_MASK indicates that SP's TYPE provides useful info,
+ update tzname, timezone, and/or altzone and return STDDST_MASK,
+ diminished by the provided info if it is a specified local time.
+ Otherwise, return STDDST_MASK. See settzname for STDDST_MASK. */
+static int
+may_update_tzname_etc(int stddst_mask, struct state *sp, int type)
+{
+ struct ttinfo *ttisp = &sp->ttis[type];
+ int this_bit = 1 << ttisp->tt_isdst;
+ if (stddst_mask & this_bit) {
+ update_tzname_etc(sp, ttisp);
+ if (!ttunspecified(sp, type))
+ return stddst_mask & ~this_bit;
+ }
+ return stddst_mask;
+}
+
static void
settzname(void)
{
register struct state * const sp = lclptr;
register int i;
- tzname[0] = tzname[1] = (char *) wildabbr;
-#ifdef USG_COMPAT
- daylight = 0;
+ /* If STDDST_MASK & 1 we need info about a standard time.
+ If STDDST_MASK & 2 we need info about a daylight saving time.
+ When STDDST_MASK becomes zero we can stop looking. */
+ int stddst_mask = 0;
+
+#if HAVE_TZNAME
+ tzname[0] = tzname[1] = (char *) (sp ? wildabbr : gmt);
+ stddst_mask = 3;
+#endif
+#if USG_COMPAT
timezone = 0;
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
+ stddst_mask = 3;
+#endif
+#if ALTZONE
altzone = 0;
-#endif /* defined ALTZONE */
- if (sp == NULL) {
- tzname[0] = tzname[1] = (char *) gmt;
- return;
- }
+ stddst_mask |= 2;
+#endif
/*
- ** And to get the latest zone names into tzname. . .
+ ** And to get the latest time zone abbreviations into tzname. . .
*/
- for (i = 0; i < sp->typecnt; ++i) {
- register const struct ttinfo * const ttisp = &sp->ttis[i];
- update_tzname_etc(sp, ttisp);
+ if (sp) {
+ for (i = sp->timecnt - 1; stddst_mask && 0 <= i; i--)
+ stddst_mask = may_update_tzname_etc(stddst_mask, sp, sp->types[i]);
+ for (i = sp->typecnt - 1; stddst_mask && 0 <= i; i--)
+ stddst_mask = may_update_tzname_etc(stddst_mask, sp, i);
}
- for (i = 0; i < sp->timecnt; ++i) {
- register const struct ttinfo * const ttisp =
- &sp->ttis[
- sp->types[i]];
- update_tzname_etc(sp, ttisp);
-#ifdef USG_COMPAT
- if (ttisp->tt_isdst)
- daylight = 1;
-#endif /* defined USG_COMPAT */
- }
+#if USG_COMPAT
+ daylight = stddst_mask >> 1 ^ 1;
+#endif
}
static void
@@ -326,7 +361,7 @@
*/
for (i = 0; i < sp->typecnt; ++i) {
register const struct ttinfo * const ttisp = &sp->ttis[i];
- register char * cp = &sp->chars[ttisp->tt_abbrind];
+ char *cp = &sp->chars[ttisp->tt_desigidx];
if (strlen(cp) > TZ_ABBR_MAX_LEN &&
strcmp(cp, GRANDPARENTED) != 0)
@@ -334,39 +369,39 @@
}
}
-static bool
-differ_by_repeat(const time_t t1, const time_t t0)
-{
- if (TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS)
- return 0;
-#if defined(__LP64__) // 32-bit Android/glibc has a signed 32-bit time_t; 64-bit doesn't.
- return t1 - t0 == SECSPERREPEAT;
-#endif
-}
-
/* Input buffer for data read from a compiled tz file. */
union input_buffer {
/* The first part of the buffer, interpreted as a header. */
struct tzhead tzhead;
/* The entire buffer. */
- char buf[2 * sizeof(struct tzhead) + 2 * sizeof (struct state)
- + 4 * TZ_MAX_TIMES];
+ char buf[2 * sizeof(struct tzhead) + 2 * sizeof(struct state)
+ + 4 * TZ_MAX_TIMES];
};
+// Android-removed: There is no directory with file-per-time zone on Android.
+#ifndef __BIONIC__
+/* TZDIR with a trailing '/' rather than a trailing '\0'. */
+static char const tzdirslash[sizeof TZDIR] = TZDIR "/";
+#endif
+
/* Local storage needed for 'tzloadbody'. */
union local_storage {
- /* The file name to be opened. */
- char fullname[FILENAME_MAX + 1];
-
/* The results of analyzing the file's contents after it is opened. */
- struct {
+ struct file_analysis {
/* The input buffer. */
union input_buffer u;
/* A temporary state used for parsing a TZ string in the file. */
struct state st;
} u;
+
+ // Android-removed: There is no directory with file-per-time zone on Android.
+ #ifndef __BIONIC__
+ /* The file name to be opened. */
+ char fullname[BIGGEST(sizeof(struct file_analysis),
+ sizeof tzdirslash + 1024)];
+ #endif
};
/* Load tz data from the file named NAME into *SP. Read extended
@@ -385,7 +420,7 @@
register char *fullname = lsp->fullname;
#endif
register union input_buffer *up = &lsp->u.u;
- register int tzheadsize = sizeof (struct tzhead);
+ register int tzheadsize = sizeof(struct tzhead);
sp->goback = sp->goahead = false;
@@ -402,20 +437,36 @@
#else
if (name[0] == ':')
++name;
+#ifdef SUPPRESS_TZDIR
+ /* Do not prepend TZDIR. This is intended for specialized
+ applications only, due to its security implications. */
+ doaccess = true;
+#else
doaccess = name[0] == '/';
+#endif
if (!doaccess) {
- char const *p = TZDIR;
- if (! p)
- return EINVAL;
- if (sizeof lsp->fullname - 1 <= strlen(p) + strlen(name))
+ char const *dot;
+ size_t namelen = strlen(name);
+ if (sizeof lsp->fullname - sizeof tzdirslash <= namelen)
return ENAMETOOLONG;
- strcpy(fullname, p);
- strcat(fullname, "/");
- strcat(fullname, name);
- /* Set doaccess if '.' (as in "../") shows up in name. */
- if (strchr(name, '.'))
- doaccess = true;
- name = fullname;
+
+ /* Create a string "TZDIR/NAME". Using sprintf here
+ would pull in stdio (and would fail if the
+ resulting string length exceeded INT_MAX!). */
+ memcpy(lsp->fullname, tzdirslash, sizeof tzdirslash);
+ strcpy(lsp->fullname + sizeof tzdirslash, name);
+
+ /* Set doaccess if NAME contains a ".." file name
+ component, as such a name could read a file outside
+ the TZDIR virtual subtree. */
+ for (dot = name; (dot = strchr(dot, '.')); dot++)
+ if ((dot == name || dot[-1] == '/') && dot[1] == '.'
+ && (dot[2] == '/' || !dot[2])) {
+ doaccess = true;
+ break;
+ }
+
+ name = lsp->fullname;
}
if (doaccess && access(name, R_OK) != 0)
return errno;
@@ -437,47 +488,62 @@
if (close(fid) < 0)
return errno;
for (stored = 4; stored <= 8; stored *= 2) {
- int_fast32_t ttisstdcnt = detzcode(up->tzhead.tzh_ttisstdcnt);
- int_fast32_t ttisgmtcnt = detzcode(up->tzhead.tzh_ttisgmtcnt);
- int_fast32_t leapcnt = detzcode(up->tzhead.tzh_leapcnt);
- int_fast32_t timecnt = detzcode(up->tzhead.tzh_timecnt);
- int_fast32_t typecnt = detzcode(up->tzhead.tzh_typecnt);
- int_fast32_t charcnt = detzcode(up->tzhead.tzh_charcnt);
- char const *p = up->buf + tzheadsize;
- if (! (0 <= leapcnt && leapcnt < TZ_MAX_LEAPS
- && 0 < typecnt && typecnt < TZ_MAX_TYPES
- && 0 <= timecnt && timecnt < TZ_MAX_TIMES
- && 0 <= charcnt && charcnt < TZ_MAX_CHARS
- && (ttisstdcnt == typecnt || ttisstdcnt == 0)
- && (ttisgmtcnt == typecnt || ttisgmtcnt == 0)))
- return EINVAL;
- if (nread
- < (tzheadsize /* struct tzhead */
- + timecnt * stored /* ats */
+ char version = up->tzhead.tzh_version[0];
+ bool skip_datablock = stored == 4 && version;
+ int_fast32_t datablock_size;
+ int_fast32_t ttisstdcnt = detzcode(up->tzhead.tzh_ttisstdcnt);
+ int_fast32_t ttisutcnt = detzcode(up->tzhead.tzh_ttisutcnt);
+ int_fast64_t prevtr = -1;
+ int_fast32_t prevcorr;
+ int_fast32_t leapcnt = detzcode(up->tzhead.tzh_leapcnt);
+ int_fast32_t timecnt = detzcode(up->tzhead.tzh_timecnt);
+ int_fast32_t typecnt = detzcode(up->tzhead.tzh_typecnt);
+ int_fast32_t charcnt = detzcode(up->tzhead.tzh_charcnt);
+ char const *p = up->buf + tzheadsize;
+ /* Although tzfile(5) currently requires typecnt to be nonzero,
+ support future formats that may allow zero typecnt
+ in files that have a TZ string and no transitions. */
+ if (! (0 <= leapcnt && leapcnt < TZ_MAX_LEAPS
+ && 0 <= typecnt && typecnt < TZ_MAX_TYPES
+ && 0 <= timecnt && timecnt < TZ_MAX_TIMES
+ && 0 <= charcnt && charcnt < TZ_MAX_CHARS
+ && 0 <= ttisstdcnt && ttisstdcnt < TZ_MAX_TYPES
+ && 0 <= ttisutcnt && ttisutcnt < TZ_MAX_TYPES))
+ return EINVAL;
+ datablock_size
+ = (timecnt * stored /* ats */
+ timecnt /* types */
+ typecnt * 6 /* ttinfos */
+ charcnt /* chars */
+ leapcnt * (stored + 4) /* lsinfos */
+ ttisstdcnt /* ttisstds */
- + ttisgmtcnt)) /* ttisgmts */
+ + ttisutcnt); /* ttisuts */
+ if (nread < tzheadsize + datablock_size)
+ return EINVAL;
+ if (skip_datablock)
+ p += datablock_size;
+ else {
+ if (! ((ttisstdcnt == typecnt || ttisstdcnt == 0)
+ && (ttisutcnt == typecnt || ttisutcnt == 0)))
return EINVAL;
+
sp->leapcnt = leapcnt;
sp->timecnt = timecnt;
sp->typecnt = typecnt;
sp->charcnt = charcnt;
/* Read transitions, discarding those out of time_t range.
- But pretend the last transition before time_t_min
- occurred at time_t_min. */
+ But pretend the last transition before TIME_T_MIN
+ occurred at TIME_T_MIN. */
timecnt = 0;
for (i = 0; i < sp->timecnt; ++i) {
int_fast64_t at
= stored == 4 ? detzcode(p) : detzcode64(p);
- sp->types[i] = at <= time_t_max;
+ sp->types[i] = at <= TIME_T_MAX;
if (sp->types[i]) {
time_t attime
- = ((TYPE_SIGNED(time_t) ? at < time_t_min : at < 0)
- ? time_t_min : at);
+ = ((TYPE_SIGNED(time_t) ? at < TIME_T_MIN : at < 0)
+ ? TIME_T_MIN : at);
if (timecnt && attime <= sp->ats[timecnt - 1]) {
if (attime < sp->ats[timecnt - 1])
return EINVAL;
@@ -500,23 +566,25 @@
sp->timecnt = timecnt;
for (i = 0; i < sp->typecnt; ++i) {
register struct ttinfo * ttisp;
- unsigned char isdst, abbrind;
+ unsigned char isdst, desigidx;
ttisp = &sp->ttis[i];
- ttisp->tt_gmtoff = detzcode(p);
+ ttisp->tt_utoff = detzcode(p);
p += 4;
isdst = *p++;
if (! (isdst < 2))
return EINVAL;
ttisp->tt_isdst = isdst;
- abbrind = *p++;
- if (! (abbrind < sp->charcnt))
+ desigidx = *p++;
+ if (! (desigidx < sp->charcnt))
return EINVAL;
- ttisp->tt_abbrind = abbrind;
+ ttisp->tt_desigidx = desigidx;
}
for (i = 0; i < sp->charcnt; ++i)
sp->chars[i] = *p++;
- sp->chars[i] = '\0'; /* ensure '\0' at end */
+ /* Ensure '\0'-terminated, and make it safe to call
+ ttunspecified later. */
+ memset(&sp->chars[i], 0, CHARS_EXTRA);
/* Read leap seconds, discarding those out of time_t range. */
leapcnt = 0;
@@ -524,16 +592,28 @@
int_fast64_t tr = stored == 4 ? detzcode(p) : detzcode64(p);
int_fast32_t corr = detzcode(p + stored);
p += stored + 4;
- if (tr <= time_t_max) {
- time_t trans
- = ((TYPE_SIGNED(time_t) ? tr < time_t_min : tr < 0)
- ? time_t_min : tr);
- if (leapcnt && trans <= sp->lsis[leapcnt - 1].ls_trans) {
- if (trans < sp->lsis[leapcnt - 1].ls_trans)
- return EINVAL;
- leapcnt--;
- }
- sp->lsis[leapcnt].ls_trans = trans;
+
+ /* Leap seconds cannot occur before the Epoch,
+ or out of order. */
+ if (tr <= prevtr)
+ return EINVAL;
+
+ /* To avoid other botches in this code, each leap second's
+ correction must differ from the previous one's by 1
+ second or less, except that the first correction can be
+ any value; these requirements are more generous than
+ RFC 8536, to allow future RFC extensions. */
+ if (! (i == 0
+ || (prevcorr < corr
+ ? corr == prevcorr + 1
+ : (corr == prevcorr
+ || corr == prevcorr - 1))))
+ return EINVAL;
+ prevtr = tr;
+ prevcorr = corr;
+
+ if (tr <= TIME_T_MAX) {
+ sp->lsis[leapcnt].ls_trans = tr;
sp->lsis[leapcnt].ls_corr = corr;
leapcnt++;
}
@@ -556,21 +636,22 @@
register struct ttinfo * ttisp;
ttisp = &sp->ttis[i];
- if (ttisgmtcnt == 0)
- ttisp->tt_ttisgmt = false;
+ if (ttisutcnt == 0)
+ ttisp->tt_ttisut = false;
else {
if (*p != true && *p != false)
return EINVAL;
- ttisp->tt_ttisgmt = *p++;
+ ttisp->tt_ttisut = *p++;
}
}
- /*
- ** If this is an old file, we're done.
- */
- if (up->tzhead.tzh_version[0] == '\0')
- break;
- nread -= p - up->buf;
- memmove(up->buf, p, nread);
+ }
+
+ nread -= p - up->buf;
+ memmove(up->buf, p, nread);
+
+ /* If this is an old file, we're done. */
+ if (!version)
+ break;
}
if (doextend && nread > 2 &&
up->buf[0] == '\n' && up->buf[nread - 1] == '\n' &&
@@ -578,24 +659,23 @@
struct state *ts = &lsp->u.st;
up->buf[nread - 1] = '\0';
- if (tzparse(&up->buf[1], ts, false)
- && ts->typecnt == 2) {
+ if (tzparse(&up->buf[1], ts, sp)) {
/* Attempt to reuse existing abbreviations.
- Without this, America/Anchorage would stop
- working after 2037 when TZ_MAX_CHARS is 50, as
- sp->charcnt equals 42 (for LMT CAT CAWT CAPT AHST
+ Without this, America/Anchorage would be right on
+ the edge after 2037 when TZ_MAX_CHARS is 50, as
+ sp->charcnt equals 40 (for LMT AST AWT APT AHST
AHDT YST AKDT AKST) and ts->charcnt equals 10
(for AKST AKDT). Reusing means sp->charcnt can
- stay 42 in this example. */
+ stay 40 in this example. */
int gotabbr = 0;
int charcnt = sp->charcnt;
- for (i = 0; i < 2; i++) {
- char *tsabbr = ts->chars + ts->ttis[i].tt_abbrind;
+ for (i = 0; i < ts->typecnt; i++) {
+ char *tsabbr = ts->chars + ts->ttis[i].tt_desigidx;
int j;
for (j = 0; j < charcnt; j++)
if (strcmp(sp->chars + j, tsabbr) == 0) {
- ts->ttis[i].tt_abbrind = j;
+ ts->ttis[i].tt_desigidx = j;
gotabbr++;
break;
}
@@ -604,53 +684,83 @@
if (j + tsabbrlen < TZ_MAX_CHARS) {
strcpy(sp->chars + j, tsabbr);
charcnt = j + tsabbrlen + 1;
- ts->ttis[i].tt_abbrind = j;
+ ts->ttis[i].tt_desigidx = j;
gotabbr++;
}
}
}
- if (gotabbr == 2) {
+ if (gotabbr == ts->typecnt) {
sp->charcnt = charcnt;
- for (i = 0; i < ts->timecnt; i++)
- if (sp->ats[sp->timecnt - 1] < ts->ats[i])
- break;
- while (i < ts->timecnt
- && sp->timecnt < TZ_MAX_TIMES) {
- sp->ats[sp->timecnt] = ts->ats[i];
+
+ /* Ignore any trailing, no-op transitions generated
+ by zic as they don't help here and can run afoul
+ of bugs in zic 2016j or earlier. */
+ while (1 < sp->timecnt
+ && (sp->types[sp->timecnt - 1]
+ == sp->types[sp->timecnt - 2]))
+ sp->timecnt--;
+
+ for (i = 0;
+ i < ts->timecnt && sp->timecnt < TZ_MAX_TIMES;
+ i++) {
+ time_t t = ts->ats[i];
+ if (increment_overflow_time(&t, leapcorr(sp, t))
+ || (0 < sp->timecnt
+ && t <= sp->ats[sp->timecnt - 1]))
+ continue;
+ sp->ats[sp->timecnt] = t;
sp->types[sp->timecnt] = (sp->typecnt
+ ts->types[i]);
sp->timecnt++;
- i++;
}
- sp->ttis[sp->typecnt++] = ts->ttis[0];
- sp->ttis[sp->typecnt++] = ts->ttis[1];
+ for (i = 0; i < ts->typecnt; i++)
+ sp->ttis[sp->typecnt++] = ts->ttis[i];
}
}
}
+ if (sp->typecnt == 0)
+ return EINVAL;
if (sp->timecnt > 1) {
+ if (sp->ats[0] <= TIME_T_MAX - SECSPERREPEAT) {
+ time_t repeatat = sp->ats[0] + SECSPERREPEAT;
+ int repeattype = sp->types[0];
for (i = 1; i < sp->timecnt; ++i)
- if (typesequiv(sp, sp->types[i], sp->types[0]) &&
- differ_by_repeat(sp->ats[i], sp->ats[0])) {
+ if (sp->ats[i] == repeatat
+ && typesequiv(sp, sp->types[i], repeattype)) {
sp->goback = true;
break;
- }
+ }
+ }
+ if (TIME_T_MIN + SECSPERREPEAT <= sp->ats[sp->timecnt - 1]) {
+ time_t repeatat = sp->ats[sp->timecnt - 1] - SECSPERREPEAT;
+ int repeattype = sp->types[sp->timecnt - 1];
for (i = sp->timecnt - 2; i >= 0; --i)
- if (typesequiv(sp, sp->types[sp->timecnt - 1],
- sp->types[i]) &&
- differ_by_repeat(sp->ats[sp->timecnt - 1],
- sp->ats[i])) {
+ if (sp->ats[i] == repeatat
+ && typesequiv(sp, sp->types[i], repeattype)) {
sp->goahead = true;
break;
- }
+ }
+ }
}
+
+ /* Infer sp->defaulttype from the data. Although this default
+ type is always zero for data from recent tzdb releases,
+ things are trickier for data from tzdb 2018e or earlier.
+
+ The first set of heuristics work around bugs in 32-bit data
+ generated by tzdb 2013c or earlier. The workaround is for
+ zones like Australia/Macquarie where timestamps before the
+ first transition have a time type that is not the earliest
+ standard-time type. See:
+ https://mm.icann.org/pipermail/tz/2013-May/019368.html */
/*
- ** If type 0 is is unused in transitions,
+ ** If type 0 does not specify local time, or is unused in transitions,
** it's the type to use for early times.
*/
for (i = 0; i < sp->timecnt; ++i)
if (sp->types[i] == 0)
break;
- i = i < sp->timecnt ? -1 : 0;
+ i = i < sp->timecnt && ! ttunspecified(sp, 0) ? -1 : 0;
/*
** Absent the above,
** if there are transition times
@@ -664,6 +774,9 @@
if (!sp->ttis[i].tt_isdst)
break;
}
+ /* The next heuristics are for data generated by tzdb 2018e or
+ earlier, for zones like EST5EDT where the first transition
+ is to DST. */
/*
** If no result yet, find the first standard type.
** If there is none, punt to type zero.
@@ -676,7 +789,12 @@
break;
}
}
+ /* A simple 'sp->defaulttype = 0;' would suffice here if we
+ didn't have to worry about 2018e-or-earlier data. Even
+ simpler would be to remove the defaulttype member and just
+ use 0 in its place. */
sp->defaulttype = i;
+
return 0;
}
@@ -687,9 +805,9 @@
{
#ifdef ALL_STATE
union local_storage *lsp = malloc(sizeof *lsp);
- if (!lsp)
- return errno;
- else {
+ if (!lsp) {
+ return HAVE_MALLOC_ERRNO ? errno : ENOMEM;
+ } else {
int err = tzloadbody(name, sp, doextend, lsp);
free(lsp);
return err;
@@ -712,12 +830,13 @@
else {
register const struct ttinfo * ap = &sp->ttis[a];
register const struct ttinfo * bp = &sp->ttis[b];
- result = ap->tt_gmtoff == bp->tt_gmtoff &&
- ap->tt_isdst == bp->tt_isdst &&
- ap->tt_ttisstd == bp->tt_ttisstd &&
- ap->tt_ttisgmt == bp->tt_ttisgmt &&
- strcmp(&sp->chars[ap->tt_abbrind],
- &sp->chars[bp->tt_abbrind]) == 0;
+ result = (ap->tt_utoff == bp->tt_utoff
+ && ap->tt_isdst == bp->tt_isdst
+ && ap->tt_ttisstd == bp->tt_ttisstd
+ && ap->tt_ttisut == bp->tt_ttisut
+ && (strcmp(&sp->chars[ap->tt_desigidx],
+ &sp->chars[bp->tt_desigidx])
+ == 0));
}
return result;
}
@@ -731,13 +850,20 @@
DAYSPERNYEAR, DAYSPERLYEAR
};
+/* Is C an ASCII digit? */
+static bool
+is_digit(char c)
+{
+ return '0' <= c && c <= '9';
+}
+
/*
-** Given a pointer into a time zone string, scan until a character that is not
-** a valid character in a zone name is found. Return a pointer to that
-** character.
+** Given a pointer into a timezone string, scan until a character that is not
+** a valid character in a time zone abbreviation is found.
+** Return a pointer to that character.
*/
-static const char * ATTRIBUTE_PURE
+static ATTRIBUTE_PURE const char *
getzname(register const char *strp)
{
register char c;
@@ -749,15 +875,16 @@
}
/*
-** Given a pointer into an extended time zone string, scan until the ending
-** delimiter of the zone name is located. Return a pointer to the delimiter.
+** Given a pointer into an extended timezone string, scan until the ending
+** delimiter of the time zone abbreviation is located.
+** Return a pointer to the delimiter.
**
** As with getzname above, the legal character set is actually quite
** restricted, with other characters producing undefined results.
** We don't do any checking here; checking is done later in common-case code.
*/
-static const char * ATTRIBUTE_PURE
+static ATTRIBUTE_PURE const char *
getqzname(register const char *strp, const int delim)
{
register int c;
@@ -768,7 +895,7 @@
}
/*
-** Given a pointer into a time zone string, extract a number from that string.
+** Given a pointer into a timezone string, extract a number from that string.
** Check that the number is within a specified range; if it is not, return
** NULL.
** Otherwise, return a pointer to the first character not part of the number.
@@ -796,7 +923,7 @@
}
/*
-** Given a pointer into a time zone string, extract a number of seconds,
+** Given a pointer into a timezone string, extract a number of seconds,
** in hh[:mm[:ss]] form, from the string.
** If any error occurs, return NULL.
** Otherwise, return a pointer to the first character not part of the number
@@ -807,6 +934,7 @@
getsecs(register const char *strp, int_fast32_t *const secsp)
{
int num;
+ int_fast32_t secsperhour = SECSPERHOUR;
/*
** 'HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
@@ -817,7 +945,7 @@
strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
if (strp == NULL)
return NULL;
- *secsp = num * (int_fast32_t) SECSPERHOUR;
+ *secsp = num * secsperhour;
if (*strp == ':') {
++strp;
strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
@@ -837,7 +965,7 @@
}
/*
-** Given a pointer into a time zone string, extract an offset, in
+** Given a pointer into a timezone string, extract an offset, in
** [+-]hh[:mm[:ss]] form, from the string.
** If any error occurs, return NULL.
** Otherwise, return a pointer to the first character not part of the time.
@@ -862,7 +990,7 @@
}
/*
-** Given a pointer into a time zone string, extract a rule in the form
+** Given a pointer into a timezone string, extract a rule in the form
** date[/time]. See POSIX section 8 for the format of "date" and "time".
** If a valid rule is not found, return NULL.
** Otherwise, return a pointer to the first character not part of the rule.
@@ -919,7 +1047,7 @@
** effect, calculate the year-relative time that rule takes effect.
*/
-static int_fast32_t ATTRIBUTE_PURE
+static int_fast32_t
transtime(const int year, register const struct rule *const rulep,
const int_fast32_t offset)
{
@@ -928,7 +1056,6 @@
register int i;
int d, m1, yy0, yy1, yy2, dow;
- INITIALIZE(value);
leapyear = isleap(year);
switch (rulep->r_type) {
@@ -994,6 +1121,8 @@
for (i = 0; i < rulep->r_mon - 1; ++i)
value += mon_lengths[leapyear][i] * SECSPERDAY;
break;
+
+ default: UNREACHABLE();
}
/*
@@ -1011,7 +1140,7 @@
*/
static bool
-tzparse(const char *name, struct state *sp, bool lastditch)
+tzparse(const char *name, struct state *sp, struct state *basep)
{
const char * stdname;
const char * dstname;
@@ -1022,37 +1151,42 @@
int_fast32_t dstoffset;
register char * cp;
register bool load_ok;
+ time_t atlo = TIME_T_MIN, leaplo = TIME_T_MIN;
stdname = name;
- if (lastditch) {
- stdlen = sizeof gmt - 1;
- name += stdlen;
- stdoffset = 0;
+ if (*name == '<') {
+ name++;
+ stdname = name;
+ name = getqzname(name, '>');
+ if (*name != '>')
+ return false;
+ stdlen = name - stdname;
+ name++;
} else {
- if (*name == '<') {
- name++;
- stdname = name;
- name = getqzname(name, '>');
- if (*name != '>')
- return false;
- stdlen = name - stdname;
- name++;
- } else {
- name = getzname(name);
- stdlen = name - stdname;
- }
- if (!stdlen)
- return false;
- name = getoffset(name, &stdoffset);
- if (name == NULL)
- return false;
+ name = getzname(name);
+ stdlen = name - stdname;
}
+ if (!stdlen)
+ return false;
+ name = getoffset(name, &stdoffset);
+ if (name == NULL)
+ return false;
charcnt = stdlen + 1;
if (sizeof sp->chars < charcnt)
return false;
- load_ok = tzload(TZDEFRULES, sp, false) == 0;
- if (!load_ok)
- sp->leapcnt = 0; /* so, we're off a little */
+ if (basep) {
+ if (0 < basep->timecnt)
+ atlo = basep->ats[basep->timecnt - 1];
+ load_ok = false;
+ sp->leapcnt = basep->leapcnt;
+ memcpy(sp->lsis, basep->lsis, sp->leapcnt * sizeof *sp->lsis);
+ } else {
+ load_ok = tzload(TZDEFRULES, sp, false) == 0;
+ if (!load_ok)
+ sp->leapcnt = 0; /* So, we're off a little. */
+ }
+ if (0 < sp->leapcnt)
+ leaplo = sp->lsis[sp->leapcnt - 1].ls_trans;
if (*name != '\0') {
if (*name == '<') {
dstname = ++name;
@@ -1064,7 +1198,7 @@
} else {
dstname = name;
name = getzname(name);
- dstlen = name - dstname; /* length of DST zone name */
+ dstlen = name - dstname; /* length of DST abbr. */
}
if (!dstlen)
return false;
@@ -1082,9 +1216,10 @@
struct rule start;
struct rule end;
register int year;
- register int yearlim;
register int timecnt;
time_t janfirst;
+ int_fast32_t janoffset = 0;
+ int yearbeg, yearlim;
++name;
if ((name = getrule(name, &start)) == NULL)
@@ -1099,13 +1234,41 @@
/*
** Two transitions per year, from EPOCH_YEAR forward.
*/
- init_ttinfo(&sp->ttis[0], -dstoffset, true, stdlen + 1);
- init_ttinfo(&sp->ttis[1], -stdoffset, false, 0);
+ init_ttinfo(&sp->ttis[0], -stdoffset, false, 0);
+ init_ttinfo(&sp->ttis[1], -dstoffset, true, stdlen + 1);
sp->defaulttype = 0;
timecnt = 0;
janfirst = 0;
- yearlim = EPOCH_YEAR + YEARSPERREPEAT;
- for (year = EPOCH_YEAR; year < yearlim; year++) {
+ yearbeg = EPOCH_YEAR;
+
+ do {
+ int_fast32_t yearsecs
+ = year_lengths[isleap(yearbeg - 1)] * SECSPERDAY;
+ yearbeg--;
+ if (increment_overflow_time(&janfirst, -yearsecs)) {
+ janoffset = -yearsecs;
+ break;
+ }
+ } while (atlo < janfirst
+ && EPOCH_YEAR - YEARSPERREPEAT / 2 < yearbeg);
+
+ while (true) {
+ int_fast32_t yearsecs
+ = year_lengths[isleap(yearbeg)] * SECSPERDAY;
+ int yearbeg1 = yearbeg;
+ time_t janfirst1 = janfirst;
+ if (increment_overflow_time(&janfirst1, yearsecs)
+ || increment_overflow(&yearbeg1, 1)
+ || atlo <= janfirst1)
+ break;
+ yearbeg = yearbeg1;
+ janfirst = janfirst1;
+ }
+
+ yearlim = yearbeg;
+ if (increment_overflow(&yearlim, YEARSPERREPEAT + 1))
+ yearlim = INT_MAX;
+ for (year = yearbeg; year < yearlim; year++) {
int_fast32_t
starttime = transtime(year, &start, stdoffset),
endtime = transtime(year, &end, dstoffset);
@@ -1120,29 +1283,40 @@
}
if (reversed
|| (starttime < endtime
- && (endtime - starttime
- < (yearsecs
- + (stdoffset - dstoffset))))) {
+ && endtime - starttime < yearsecs)) {
if (TZ_MAX_TIMES - 2 < timecnt)
break;
- yearlim = year + YEARSPERREPEAT + 1;
sp->ats[timecnt] = janfirst;
- if (increment_overflow_time
- (&sp->ats[timecnt], starttime))
- break;
- sp->types[timecnt++] = reversed;
+ if (! increment_overflow_time
+ (&sp->ats[timecnt],
+ janoffset + starttime)
+ && atlo <= sp->ats[timecnt])
+ sp->types[timecnt++] = !reversed;
sp->ats[timecnt] = janfirst;
- if (increment_overflow_time
- (&sp->ats[timecnt], endtime))
- break;
- sp->types[timecnt++] = !reversed;
+ if (! increment_overflow_time
+ (&sp->ats[timecnt],
+ janoffset + endtime)
+ && atlo <= sp->ats[timecnt]) {
+ sp->types[timecnt++] = reversed;
+ }
}
- if (increment_overflow_time(&janfirst, yearsecs))
+ if (endtime < leaplo) {
+ yearlim = year;
+ if (increment_overflow(&yearlim,
+ YEARSPERREPEAT + 1))
+ yearlim = INT_MAX;
+ }
+ if (increment_overflow_time
+ (&janfirst, janoffset + yearsecs))
break;
+ janoffset = 0;
}
sp->timecnt = timecnt;
- if (!timecnt)
+ if (! timecnt) {
+ sp->ttis[0] = sp->ttis[1];
sp->typecnt = 1; /* Perpetual DST. */
+ } else if (YEARSPERREPEAT < year - yearbeg)
+ sp->goback = sp->goahead = true;
} else {
register int_fast32_t theirstdoffset;
register int_fast32_t theirdstoffset;
@@ -1161,7 +1335,7 @@
j = sp->types[i];
if (!sp->ttis[j].tt_isdst) {
theirstdoffset =
- -sp->ttis[j].tt_gmtoff;
+ - sp->ttis[j].tt_utoff;
break;
}
}
@@ -1170,7 +1344,7 @@
j = sp->types[i];
if (sp->ttis[j].tt_isdst) {
theirdstoffset =
- -sp->ttis[j].tt_gmtoff;
+ - sp->ttis[j].tt_utoff;
break;
}
}
@@ -1178,7 +1352,6 @@
** Initially we're assumed to be in standard time.
*/
isdst = false;
- theiroffset = theirstdoffset;
/*
** Now juggle transition times and types
** tracking offsets as you do.
@@ -1186,16 +1359,17 @@
for (i = 0; i < sp->timecnt; ++i) {
j = sp->types[i];
sp->types[i] = sp->ttis[j].tt_isdst;
- if (sp->ttis[j].tt_ttisgmt) {
+ if (sp->ttis[j].tt_ttisut) {
/* No adjustment to transition time */
} else {
/*
- ** If summer time is in effect, and the
- ** transition time was not specified as
- ** standard time, add the summer time
- ** offset to the transition time;
- ** otherwise, add the standard time
- ** offset to the transition time.
+ ** If daylight saving time is in
+ ** effect, and the transition time was
+ ** not specified as standard time, add
+ ** the daylight saving time offset to
+ ** the transition time; otherwise, add
+ ** the standard time offset to the
+ ** transition time.
*/
/*
** Transitions from DST to DDST
@@ -1211,7 +1385,7 @@
theirstdoffset;
}
}
- theiroffset = -sp->ttis[j].tt_gmtoff;
+ theiroffset = -sp->ttis[j].tt_utoff;
if (sp->ttis[j].tt_isdst)
theirdstoffset = theiroffset;
else theirstdoffset = theiroffset;
@@ -1247,7 +1421,7 @@
gmtload(struct state *const sp)
{
if (tzload(gmt, sp, true) != 0)
- tzparse(gmt, sp, true);
+ tzparse("GMT0", sp, NULL);
}
/* Initialize *SP to a value appropriate for the TZ setting NAME.
@@ -1270,7 +1444,7 @@
return 0;
} else {
int err = tzload(name, sp, true);
- if (err != 0 && name && name[0] != ':' && tzparse(name, sp, false))
+ if (err != 0 && name && name[0] != ':' && tzparse(name, sp, NULL))
err = 0;
if (err == 0)
scrub_abbrs(sp);
@@ -1301,17 +1475,6 @@
lcl_is_set = lcl;
}
-#ifdef STD_INSPIRED
-void
-tzsetwall(void)
-{
- if (lock() != 0)
- return;
- tzsetlcl(NULL);
- unlock();
-}
-#endif
-
#if defined(__BIONIC__)
extern void tzset_unlocked(void);
#else
@@ -1361,7 +1524,8 @@
errno = err;
return NULL;
}
- }
+ } else if (!HAVE_MALLOC_ERRNO)
+ errno = ENOMEM;
return sp;
}
@@ -1391,7 +1555,7 @@
**
** If successful and SETNAME is nonzero,
** set the applicable parts of tzname, timezone and altzone;
-** however, it's OK to omit this step if the time zone is POSIX-compatible,
+** however, it's OK to omit this step if the timezone is POSIX-compatible,
** since in that case tzset should have already done this step correctly.
** SETNAME's type is intfast32_t for compatibility with gmtsub,
** but it is actually a boolean and its value should be 0 or 1.
@@ -1413,7 +1577,7 @@
}
if ((sp->goback && t < sp->ats[0]) ||
(sp->goahead && t > sp->ats[sp->timecnt - 1])) {
- time_t newt = t;
+ time_t newt;
register time_t seconds;
register time_t years;
@@ -1421,11 +1585,17 @@
seconds = sp->ats[0] - t;
else seconds = t - sp->ats[sp->timecnt - 1];
--seconds;
- years = (seconds / SECSPERREPEAT + 1) * YEARSPERREPEAT;
+
+ /* Beware integer overflow, as SECONDS might
+ be close to the maximum time_t. */
+ years = seconds / SECSPERREPEAT * YEARSPERREPEAT;
seconds = years * AVGSECSPERYEAR;
+ years += YEARSPERREPEAT;
if (t < sp->ats[0])
- newt += seconds;
- else newt -= seconds;
+ newt = t + seconds + SECSPERREPEAT;
+ else
+ newt = t - seconds - SECSPERREPEAT;
+
if (newt < sp->ats[0] ||
newt > sp->ats[sp->timecnt - 1])
return NULL; /* "cannot happen" */
@@ -1456,20 +1626,20 @@
hi = mid;
else lo = mid + 1;
}
- i = (int) sp->types[lo - 1];
+ i = sp->types[lo - 1];
}
ttisp = &sp->ttis[i];
/*
** To get (wrong) behavior that's compatible with System V Release 2.0
** you'd replace the statement below with
- ** t += ttisp->tt_gmtoff;
+ ** t += ttisp->tt_utoff;
** timesub(&t, 0L, sp, tmp);
*/
- result = timesub(&t, ttisp->tt_gmtoff, sp, tmp);
+ result = timesub(&t, ttisp->tt_utoff, sp, tmp);
if (result) {
result->tm_isdst = ttisp->tt_isdst;
#ifdef TM_ZONE
- result->TM_ZONE = (char *) &sp->chars[ttisp->tt_abbrind];
+ result->TM_ZONE = (char *) &sp->chars[ttisp->tt_desigidx];
#endif /* defined TM_ZONE */
if (setname)
update_tzname_etc(sp, ttisp);
@@ -1534,7 +1704,7 @@
#ifdef TM_ZONE
/*
** Could get fancy here and deliver something such as
- ** "UT+xxxx" or "UT-xxxx" if offset is non-zero,
+ ** "+xx" or "-xx" if offset is non-zero,
** but this is no time for a treasure hunt.
*/
tmp->TM_ZONE = ((char *)
@@ -1576,11 +1746,18 @@
** where, to make the math easy, the answer for year zero is defined as zero.
*/
-static int ATTRIBUTE_PURE
-leaps_thru_end_of(register const int y)
+static time_t
+leaps_thru_end_of_nonneg(time_t y)
{
- return (y >= 0) ? (y / 4 - y / 100 + y / 400) :
- -(leaps_thru_end_of(-(y + 1)) + 1);
+ return y / 4 - y / 100 + y / 400;
+}
+
+static time_t
+leaps_thru_end_of(time_t y)
+{
+ return (y < 0
+ ? -1 - leaps_thru_end_of_nonneg(-1 - y)
+ : leaps_thru_end_of_nonneg(y));
}
static struct tm *
@@ -1589,122 +1766,106 @@
{
register const struct lsinfo * lp;
register time_t tdays;
- register int idays; /* unsigned would be so 2003 */
- register int_fast64_t rem;
- int y;
register const int * ip;
- register int_fast64_t corr;
- register bool hit;
+ register int_fast32_t corr;
register int i;
+ int_fast32_t idays, rem, dayoff, dayrem;
+ time_t y;
+
+ /* If less than SECSPERMIN, the number of seconds since the
+ most recent positive leap second; otherwise, do not add 1
+ to localtime tm_sec because of leap seconds. */
+ time_t secs_since_posleap = SECSPERMIN;
corr = 0;
- hit = false;
i = (sp == NULL) ? 0 : sp->leapcnt;
while (--i >= 0) {
lp = &sp->lsis[i];
if (*timep >= lp->ls_trans) {
- if (*timep == lp->ls_trans) {
- hit = ((i == 0 && lp->ls_corr > 0) ||
- lp->ls_corr > sp->lsis[i - 1].ls_corr);
- if (hit)
- while (i > 0 &&
- sp->lsis[i].ls_trans ==
- sp->lsis[i - 1].ls_trans + 1 &&
- sp->lsis[i].ls_corr ==
- sp->lsis[i - 1].ls_corr + 1) {
- ++hit;
- --i;
- }
- }
corr = lp->ls_corr;
+ if ((i == 0 ? 0 : lp[-1].ls_corr) < corr)
+ secs_since_posleap = *timep - lp->ls_trans;
break;
}
}
- y = EPOCH_YEAR;
+
+ /* Calculate the year, avoiding integer overflow even if
+ time_t is unsigned. */
tdays = *timep / SECSPERDAY;
rem = *timep % SECSPERDAY;
- while (tdays < 0 || tdays >= year_lengths[isleap(y)]) {
- int newy;
- register time_t tdelta;
- register int idelta;
+ rem += offset % SECSPERDAY - corr % SECSPERDAY + 3 * SECSPERDAY;
+ dayoff = offset / SECSPERDAY - corr / SECSPERDAY + rem / SECSPERDAY - 3;
+ rem %= SECSPERDAY;
+ /* y = (EPOCH_YEAR
+ + floor((tdays + dayoff) / DAYSPERREPEAT) * YEARSPERREPEAT),
+ sans overflow. But calculate against 1570 (EPOCH_YEAR -
+ YEARSPERREPEAT) instead of against 1970 so that things work
+ for localtime values before 1970 when time_t is unsigned. */
+ dayrem = tdays % DAYSPERREPEAT;
+ dayrem += dayoff % DAYSPERREPEAT;
+ y = (EPOCH_YEAR - YEARSPERREPEAT
+ + ((1 + dayoff / DAYSPERREPEAT + dayrem / DAYSPERREPEAT
+ - ((dayrem % DAYSPERREPEAT) < 0)
+ + tdays / DAYSPERREPEAT)
+ * YEARSPERREPEAT));
+ /* idays = (tdays + dayoff) mod DAYSPERREPEAT, sans overflow. */
+ idays = tdays % DAYSPERREPEAT;
+ idays += dayoff % DAYSPERREPEAT + 2 * DAYSPERREPEAT;
+ idays %= DAYSPERREPEAT;
+ /* Increase Y and decrease IDAYS until IDAYS is in range for Y. */
+ while (year_lengths[isleap(y)] <= idays) {
+ int tdelta = idays / DAYSPERLYEAR;
+ int_fast32_t ydelta = tdelta + !tdelta;
+ time_t newy = y + ydelta;
register int leapdays;
-
- tdelta = tdays / DAYSPERLYEAR;
- if (! ((! TYPE_SIGNED(time_t) || INT_MIN <= tdelta)
- && tdelta <= INT_MAX))
- goto out_of_range;
- idelta = tdelta;
- if (idelta == 0)
- idelta = (tdays < 0) ? -1 : 1;
- newy = y;
- if (increment_overflow(&newy, idelta))
- goto out_of_range;
leapdays = leaps_thru_end_of(newy - 1) -
leaps_thru_end_of(y - 1);
- tdays -= ((time_t) newy - y) * DAYSPERNYEAR;
- tdays -= leapdays;
+ idays -= ydelta * DAYSPERNYEAR;
+ idays -= leapdays;
y = newy;
}
- /*
- ** Given the range, we can now fearlessly cast...
- */
- idays = tdays;
- rem += offset - corr;
- while (rem < 0) {
- rem += SECSPERDAY;
- --idays;
+
+ if (!TYPE_SIGNED(time_t) && y < TM_YEAR_BASE) {
+ int signed_y = y;
+ tmp->tm_year = signed_y - TM_YEAR_BASE;
+ } else if ((!TYPE_SIGNED(time_t) || INT_MIN + TM_YEAR_BASE <= y)
+ && y - TM_YEAR_BASE <= INT_MAX)
+ tmp->tm_year = y - TM_YEAR_BASE;
+ else {
+ errno = EOVERFLOW;
+ return NULL;
}
- while (rem >= SECSPERDAY) {
- rem -= SECSPERDAY;
- ++idays;
- }
- while (idays < 0) {
- if (increment_overflow(&y, -1))
- goto out_of_range;
- idays += year_lengths[isleap(y)];
- }
- while (idays >= year_lengths[isleap(y)]) {
- idays -= year_lengths[isleap(y)];
- if (increment_overflow(&y, 1))
- goto out_of_range;
- }
- tmp->tm_year = y;
- if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE))
- goto out_of_range;
tmp->tm_yday = idays;
/*
** The "extra" mods below avoid overflow problems.
*/
- tmp->tm_wday = EPOCH_WDAY +
- ((y - EPOCH_YEAR) % DAYSPERWEEK) *
- (DAYSPERNYEAR % DAYSPERWEEK) +
- leaps_thru_end_of(y - 1) -
- leaps_thru_end_of(EPOCH_YEAR - 1) +
- idays;
+ tmp->tm_wday = (TM_WDAY_BASE
+ + ((tmp->tm_year % DAYSPERWEEK)
+ * (DAYSPERNYEAR % DAYSPERWEEK))
+ + leaps_thru_end_of(y - 1)
+ - leaps_thru_end_of(TM_YEAR_BASE - 1)
+ + idays);
tmp->tm_wday %= DAYSPERWEEK;
if (tmp->tm_wday < 0)
tmp->tm_wday += DAYSPERWEEK;
- tmp->tm_hour = (int) (rem / SECSPERHOUR);
+ tmp->tm_hour = rem / SECSPERHOUR;
rem %= SECSPERHOUR;
- tmp->tm_min = (int) (rem / SECSPERMIN);
- /*
- ** A positive leap second requires a special
- ** representation. This uses "... ??:59:60" et seq.
- */
- tmp->tm_sec = (int) (rem % SECSPERMIN) + hit;
+ tmp->tm_min = rem / SECSPERMIN;
+ tmp->tm_sec = rem % SECSPERMIN;
+
+ /* Use "... ??:??:60" at the end of the localtime minute containing
+ the second just before the positive leap second. */
+ tmp->tm_sec += secs_since_posleap <= tmp->tm_sec;
+
ip = mon_lengths[isleap(y)];
for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon))
idays -= ip[tmp->tm_mon];
- tmp->tm_mday = (int) (idays + 1);
+ tmp->tm_mday = idays + 1;
tmp->tm_isdst = 0;
#ifdef TM_GMTOFF
tmp->TM_GMTOFF = offset;
#endif /* defined TM_GMTOFF */
return tmp;
-
- out_of_range:
- errno = EOVERFLOW;
- return NULL;
}
char *
@@ -1778,12 +1939,12 @@
{
/*
** This is like
- ** 'if (! (time_t_min <= *tp + j && *tp + j <= time_t_max)) ...',
+ ** 'if (! (TIME_T_MIN <= *tp + j && *tp + j <= TIME_T_MAX)) ...',
** except that it does the right thing even if *tp + j would overflow.
*/
if (! (j < 0
- ? (TYPE_SIGNED(time_t) ? time_t_min - j <= *tp : -1 - j < *tp)
- : *tp <= time_t_max - j))
+ ? (TYPE_SIGNED(time_t) ? TIME_T_MIN - j <= *tp : -1 - j < *tp)
+ : *tp <= TIME_T_MAX - j))
return true;
*tp += j;
return false;
@@ -1919,8 +2080,8 @@
/*
** Do a binary search (this works whatever time_t's type is).
*/
- lo = time_t_min;
- hi = time_t_max;
+ lo = TIME_T_MIN;
+ hi = TIME_T_MAX;
for ( ; ; ) {
t = lo / 2 + hi / 2;
if (t < lo)
@@ -1937,12 +2098,12 @@
} else dir = tmcomp(&mytm, &yourtm);
if (dir != 0) {
if (t == lo) {
- if (t == time_t_max)
+ if (t == TIME_T_MAX)
return WRONG;
++t;
++lo;
} else if (t == hi) {
- if (t == time_t_min)
+ if (t == TIME_T_MIN)
return WRONG;
--t;
--hi;
@@ -1959,13 +2120,13 @@
&& (yourtm.TM_GMTOFF < 0
? (-SECSPERDAY <= yourtm.TM_GMTOFF
&& (mytm.TM_GMTOFF <=
- (SMALLEST (INT_FAST32_MAX, LONG_MAX)
+ (SMALLEST(INT_FAST32_MAX, LONG_MAX)
+ yourtm.TM_GMTOFF)))
: (yourtm.TM_GMTOFF <= SECSPERDAY
- && ((BIGGEST (INT_FAST32_MIN, LONG_MIN)
+ && ((BIGGEST(INT_FAST32_MIN, LONG_MIN)
+ yourtm.TM_GMTOFF)
<= mytm.TM_GMTOFF)))) {
- /* MYTM matches YOURTM except with the wrong UTC offset.
+ /* MYTM matches YOURTM except with the wrong UT offset.
YOURTM.TM_GMTOFF is plausible, so try it instead.
It's OK if YOURTM.TM_GMTOFF contains uninitialized data,
since the guess gets checked. */
@@ -1999,8 +2160,10 @@
for (j = sp->typecnt - 1; j >= 0; --j) {
if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
continue;
- newt = t + sp->ttis[j].tt_gmtoff -
- sp->ttis[i].tt_gmtoff;
+ if (ttunspecified(sp, j))
+ continue;
+ newt = (t + sp->ttis[j].tt_utoff
+ - sp->ttis[i].tt_utoff);
if (! funcp(sp, &newt, offset, &mytm))
continue;
if (tmcomp(&mytm, &yourtm) != 0)
@@ -2047,8 +2210,8 @@
static time_t
time1(struct tm *const tmp,
- struct tm *(*funcp) (struct state const *, time_t const *,
- int_fast32_t, struct tm *),
+ struct tm *(*funcp)(struct state const *, time_t const *,
+ int_fast32_t, struct tm *),
struct state const *sp,
const int_fast32_t offset)
{
@@ -2091,7 +2254,7 @@
seen[i] = false;
nseen = 0;
for (i = sp->timecnt - 1; i >= 0; --i)
- if (!seen[sp->types[i]]) {
+ if (!seen[sp->types[i]] && !ttunspecified(sp, sp->types[i])) {
seen[sp->types[i]] = true;
types[nseen++] = sp->types[i];
}
@@ -2103,14 +2266,14 @@
otheri = types[otherind];
if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
continue;
- tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
- sp->ttis[samei].tt_gmtoff;
+ tmp->tm_sec += (sp->ttis[otheri].tt_utoff
+ - sp->ttis[samei].tt_utoff);
tmp->tm_isdst = !tmp->tm_isdst;
t = time2(tmp, funcp, sp, offset, &okay);
if (okay)
return t;
- tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
- sp->ttis[samei].tt_gmtoff;
+ tmp->tm_sec -= (sp->ttis[otheri].tt_utoff
+ - sp->ttis[samei].tt_utoff);
tmp->tm_isdst = !tmp->tm_isdst;
}
}
@@ -2188,21 +2351,7 @@
#endif /* defined STD_INSPIRED */
-/*
-** XXX--is the below the right way to conditionalize??
-*/
-
-#ifdef STD_INSPIRED
-
-/*
-** IEEE Std 1003.1-1988 (POSIX) legislates that 536457599
-** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
-** is not the case if we are accounting for leap seconds.
-** So, we provide the following conversion routines for use
-** when exchanging timestamps with POSIX conforming systems.
-*/
-
-static int_fast64_t
+static int_fast32_t
leapcorr(struct state const *sp, time_t t)
{
register struct lsinfo const * lp;
@@ -2217,7 +2366,29 @@
return 0;
}
-NETBSD_INSPIRED_EXTERN time_t ATTRIBUTE_PURE
+/*
+** XXX--is the below the right way to conditionalize??
+*/
+
+#ifdef STD_INSPIRED
+
+/* NETBSD_INSPIRED_EXTERN functions are exported to callers if
+ NETBSD_INSPIRED is defined, and are private otherwise. */
+# if NETBSD_INSPIRED
+# define NETBSD_INSPIRED_EXTERN
+# else
+# define NETBSD_INSPIRED_EXTERN static
+# endif
+
+/*
+** IEEE Std 1003.1 (POSIX) says that 536457599
+** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
+** is not the case if we are accounting for leap seconds.
+** So, we provide the following conversion routines for use
+** when exchanging timestamps with POSIX conforming systems.
+*/
+
+NETBSD_INSPIRED_EXTERN time_t
time2posix_z(struct state *sp, time_t t)
{
return t - leapcorr(sp, t);
@@ -2239,7 +2410,7 @@
return t;
}
-NETBSD_INSPIRED_EXTERN time_t ATTRIBUTE_PURE
+NETBSD_INSPIRED_EXTERN time_t
posix2time_z(struct state *sp, time_t t)
{
time_t x;
@@ -2286,15 +2457,39 @@
#endif /* defined STD_INSPIRED */
-#ifdef time_tz
+#if TZ_TIME_T
+
+# if !USG_COMPAT
+# define daylight 0
+# define timezone 0
+# endif
+# if !ALTZONE
+# define altzone 0
+# endif
/* Convert from the underlying system's time_t to the ersatz time_tz,
- which is called 'time_t' in this file. */
+ which is called 'time_t' in this file. Typically, this merely
+ converts the time's integer width. On some platforms, the system
+ time is local time not UT, or uses some epoch other than the POSIX
+ epoch.
+
+ Although this code appears to define a function named 'time' that
+ returns time_t, the macros in private.h cause this code to actually
+ define a function named 'tz_time' that returns tz_time_t. The call
+ to sys_time invokes the underlying system's 'time' function. */
time_t
time(time_t *p)
{
time_t r = sys_time(0);
+ if (r != (time_t) -1) {
+ int_fast32_t offset = EPOCH_LOCAL ? (daylight ? timezone : altzone) : 0;
+ if (increment_overflow32(&offset, -EPOCH_OFFSET)
+ || increment_overflow_time(&r, offset)) {
+ errno = EOVERFLOW;
+ r = -1;
+ }
+ }
if (p)
*p = r;
return r;
diff --git a/libc/tzcode/private.h b/libc/tzcode/private.h
index 941e91b..4c03324 100644
--- a/libc/tzcode/private.h
+++ b/libc/tzcode/private.h
@@ -1,3 +1,5 @@
+/* Private header for tzdb code. */
+
#ifndef PRIVATE_H
#define PRIVATE_H
@@ -15,6 +17,17 @@
** Thank you!
*/
+/*
+** zdump has been made independent of the rest of the time
+** conversion package to increase confidence in the verification it provides.
+** You can use zdump to help in verifying other implementations.
+** To do this, compile with -DUSE_LTZ=0 and link without the tz library.
+*/
+#ifndef USE_LTZ
+# define USE_LTZ 1
+#endif
+
+/* This string was in the Factory zone through version 2016f. */
#define GRANDPARENTED "Local time zone must be set--see zic manual page"
/*
@@ -26,26 +39,53 @@
#define HAVE_DECL_ASCTIME_R 1
#endif
+#if !defined HAVE_GENERIC && defined __has_extension
+# if __has_extension(c_generic_selections)
+# define HAVE_GENERIC 1
+# else
+# define HAVE_GENERIC 0
+# endif
+#endif
+/* _Generic is buggy in pre-4.9 GCC. */
+#if !defined HAVE_GENERIC && defined __GNUC__
+# define HAVE_GENERIC (4 < __GNUC__ + (9 <= __GNUC_MINOR__))
+#endif
+#ifndef HAVE_GENERIC
+# define HAVE_GENERIC (201112 <= __STDC_VERSION__)
+#endif
+
#ifndef HAVE_GETTEXT
#define HAVE_GETTEXT 0
#endif /* !defined HAVE_GETTEXT */
#ifndef HAVE_INCOMPATIBLE_CTIME_R
#define HAVE_INCOMPATIBLE_CTIME_R 0
-#endif /* !defined INCOMPATIBLE_CTIME_R */
+#endif
#ifndef HAVE_LINK
#define HAVE_LINK 1
#endif /* !defined HAVE_LINK */
+#ifndef HAVE_MALLOC_ERRNO
+#define HAVE_MALLOC_ERRNO 1
+#endif
+
#ifndef HAVE_POSIX_DECLS
#define HAVE_POSIX_DECLS 1
#endif
+#ifndef HAVE_STDBOOL_H
+#define HAVE_STDBOOL_H (199901 <= __STDC_VERSION__)
+#endif
+
#ifndef HAVE_STRDUP
#define HAVE_STRDUP 1
#endif
+#ifndef HAVE_STRTOLL
+#define HAVE_STRTOLL 1
+#endif
+
#ifndef HAVE_SYMLINK
#define HAVE_SYMLINK 1
#endif /* !defined HAVE_SYMLINK */
@@ -54,10 +94,6 @@
#define HAVE_SYS_STAT_H 1
#endif /* !defined HAVE_SYS_STAT_H */
-#ifndef HAVE_SYS_WAIT_H
-#define HAVE_SYS_WAIT_H 1
-#endif /* !defined HAVE_SYS_WAIT_H */
-
#ifndef HAVE_UNISTD_H
#define HAVE_UNISTD_H 1
#endif /* !defined HAVE_UNISTD_H */
@@ -75,22 +111,37 @@
#define ctime_r _incompatible_ctime_r
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
-/* Enable tm_gmtoff and tm_zone on GNUish systems. */
+/* Enable tm_gmtoff, tm_zone, and environ on GNUish systems. */
#define _GNU_SOURCE 1
-/* Fix asctime_r on Solaris 10. */
+/* Fix asctime_r on Solaris 11. */
#define _POSIX_PTHREAD_SEMANTICS 1
-/* Enable strtoimax on Solaris 10. */
+/* Enable strtoimax on pre-C99 Solaris 11. */
#define __EXTENSIONS__ 1
+/* To avoid having 'stat' fail unnecessarily with errno == EOVERFLOW,
+ enable large files on GNUish systems ... */
+#ifndef _FILE_OFFSET_BITS
+# define _FILE_OFFSET_BITS 64
+#endif
+/* ... and on AIX ... */
+#define _LARGE_FILES 1
+/* ... and enable large inode numbers on Mac OS X 10.5 and later. */
+#define _DARWIN_USE_64_BIT_INODE 1
+
/*
** Nested includes
*/
-/* Avoid clashes with NetBSD by renaming NetBSD's declarations. */
+/* Avoid clashes with NetBSD by renaming NetBSD's declarations.
+ If defining the 'timezone' variable, avoid a clash with FreeBSD's
+ 'timezone' function by renaming its declaration. */
#define localtime_rz sys_localtime_rz
#define mktime_z sys_mktime_z
#define posix2time_z sys_posix2time_z
#define time2posix_z sys_time2posix_z
+#if defined USG_COMPAT && USG_COMPAT == 2
+# define timezone sys_timezone
+#endif
#define timezone_t sys_timezone_t
#define tzalloc sys_tzalloc
#define tzfree sys_tzfree
@@ -99,21 +150,30 @@
#undef mktime_z
#undef posix2time_z
#undef time2posix_z
+#if defined USG_COMPAT && USG_COMPAT == 2
+# undef timezone
+#endif
#undef timezone_t
#undef tzalloc
#undef tzfree
-#include "sys/types.h" /* for time_t */
-#include "stdio.h"
-#include "string.h"
-#include "limits.h" /* for CHAR_BIT et al. */
-#include "stdlib.h"
+#include <sys/types.h> /* for time_t */
+#include <string.h>
+#include <limits.h> /* for CHAR_BIT et al. */
+#include <stdlib.h>
-#include "errno.h"
+#include <errno.h>
+
+#ifndef EINVAL
+# define EINVAL ERANGE
+#endif
#ifndef ENAMETOOLONG
# define ENAMETOOLONG EINVAL
#endif
+#ifndef ENOMEM
+# define ENOMEM EINVAL
+#endif
#ifndef ENOTSUP
# define ENOTSUP EINVAL
#endif
@@ -122,22 +182,11 @@
#endif
#if HAVE_GETTEXT
-#include "libintl.h"
+#include <libintl.h>
#endif /* HAVE_GETTEXT */
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
-#endif /* HAVE_SYS_WAIT_H */
-
-#ifndef WIFEXITED
-#define WIFEXITED(status) (((status) & 0xff) == 0)
-#endif /* !defined WIFEXITED */
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
-#endif /* !defined WEXITSTATUS */
-
#if HAVE_UNISTD_H
-#include "unistd.h" /* for F_OK, R_OK, and other POSIX goodness */
+#include <unistd.h> /* for R_OK, and other POSIX goodness */
#endif /* HAVE_UNISTD_H */
#ifndef HAVE_STRFTIME_L
@@ -148,31 +197,49 @@
# endif
#endif
-#ifndef F_OK
-#define F_OK 0
-#endif /* !defined F_OK */
+#ifndef USG_COMPAT
+# ifndef _XOPEN_VERSION
+# define USG_COMPAT 0
+# else
+# define USG_COMPAT 1
+# endif
+#endif
+
+#ifndef HAVE_TZNAME
+# if _POSIX_VERSION < 198808 && !USG_COMPAT
+# define HAVE_TZNAME 0
+# else
+# define HAVE_TZNAME 1
+# endif
+#endif
+
+#ifndef ALTZONE
+# if defined __sun || defined _M_XENIX
+# define ALTZONE 1
+# else
+# define ALTZONE 0
+# endif
+#endif
+
#ifndef R_OK
#define R_OK 4
#endif /* !defined R_OK */
-/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
-#define is_digit(c) ((unsigned)(c) - '0' <= 9)
-
/*
** Define HAVE_STDINT_H's default value here, rather than at the
-** start, since __GLIBC__'s value depends on previously-included
-** files.
-** (glibc 2.1 and later have stdint.h, even with pre-C99 compilers.)
+** start, since __GLIBC__ and INTMAX_MAX's values depend on
+** previously-included files. glibc 2.1 and Solaris 10 and later have
+** stdint.h, even with pre-C99 compilers.
*/
#ifndef HAVE_STDINT_H
#define HAVE_STDINT_H \
(199901 <= __STDC_VERSION__ \
|| 2 < __GLIBC__ + (1 <= __GLIBC_MINOR__) \
- || __CYGWIN__)
+ || __CYGWIN__ || INTMAX_MAX)
#endif /* !defined HAVE_STDINT_H */
#if HAVE_STDINT_H
-#include "stdint.h"
+#include <stdint.h>
#endif /* !HAVE_STDINT_H */
#ifndef HAVE_INTTYPES_H
@@ -208,14 +275,18 @@
# endif
#endif
-#ifndef SCNdFAST64
+#ifndef PRIdFAST64
# if INT_FAST64_MAX == LLONG_MAX
-# define SCNdFAST64 "lld"
+# define PRIdFAST64 "lld"
# else
-# define SCNdFAST64 "ld"
+# define PRIdFAST64 "ld"
# endif
#endif
+#ifndef SCNdFAST64
+# define SCNdFAST64 PRIdFAST64
+#endif
+
#ifndef INT_FAST32_MAX
# if INT_MAX >> 31 == 0
typedef long int_fast32_t;
@@ -231,15 +302,19 @@
#ifndef INTMAX_MAX
# ifdef LLONG_MAX
typedef long long intmax_t;
-# define strtoimax strtoll
+# if HAVE_STRTOLL
+# define strtoimax strtoll
+# endif
# define INTMAX_MAX LLONG_MAX
# define INTMAX_MIN LLONG_MIN
# else
typedef long intmax_t;
-# define strtoimax strtol
# define INTMAX_MAX LONG_MAX
# define INTMAX_MIN LONG_MIN
# endif
+# ifndef strtoimax
+# define strtoimax strtol
+# endif
#endif
#ifndef PRIdMAX
@@ -250,6 +325,10 @@
# endif
#endif
+#ifndef UINT_FAST32_MAX
+typedef unsigned long uint_fast32_t;
+#endif
+
#ifndef UINT_FAST64_MAX
# if defined ULLONG_MAX || defined __LONG_LONG_MAX__
typedef unsigned long long uint_fast64_t;
@@ -289,19 +368,21 @@
#define SIZE_MAX ((size_t) -1)
#endif
-#if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
-# define ATTRIBUTE_CONST __attribute__ ((const))
-# define ATTRIBUTE_PURE __attribute__ ((__pure__))
-# define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#if 3 <= __GNUC__
+# define ATTRIBUTE_CONST __attribute__((const))
+# define ATTRIBUTE_MALLOC __attribute__((__malloc__))
+# define ATTRIBUTE_PURE __attribute__((__pure__))
+# define ATTRIBUTE_FORMAT(spec) __attribute__((__format__ spec))
#else
# define ATTRIBUTE_CONST /* empty */
+# define ATTRIBUTE_MALLOC /* empty */
# define ATTRIBUTE_PURE /* empty */
# define ATTRIBUTE_FORMAT(spec) /* empty */
#endif
#if !defined _Noreturn && __STDC_VERSION__ < 201112
# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__)
-# define _Noreturn __attribute__ ((__noreturn__))
+# define _Noreturn __attribute__((__noreturn__))
# else
# define _Noreturn
# endif
@@ -315,6 +396,23 @@
** Workarounds for compilers/systems.
*/
+#ifndef EPOCH_LOCAL
+# define EPOCH_LOCAL 0
+#endif
+#ifndef EPOCH_OFFSET
+# define EPOCH_OFFSET 0
+#endif
+#ifndef RESERVE_STD_EXT_IDS
+# define RESERVE_STD_EXT_IDS 0
+#endif
+
+/* If standard C identifiers with external linkage (e.g., localtime)
+ are reserved and are not already being renamed anyway, rename them
+ as if compiling with '-Dtime_tz=time_t'. */
+#if !defined time_tz && RESERVE_STD_EXT_IDS && USE_LTZ
+# define time_tz time_t
+#endif
+
/*
** Compile with -Dtime_tz=T to build the tz package with a private
** time_t type equivalent to T rather than the system-supplied time_t.
@@ -322,13 +420,24 @@
** (e.g., time_t wider than 'long', or unsigned time_t) even on
** typical platforms.
*/
-#ifdef time_tz
-# ifdef LOCALTIME_IMPLEMENTATION
+#if defined time_tz || EPOCH_LOCAL || EPOCH_OFFSET != 0
+# define TZ_TIME_T 1
+#else
+# define TZ_TIME_T 0
+#endif
+
+#if defined LOCALTIME_IMPLEMENTATION && TZ_TIME_T
static time_t sys_time(time_t *x) { return time(x); }
-# endif
+#endif
+
+#if TZ_TIME_T
typedef time_tz tz_time_t;
+# undef asctime
+# define asctime tz_asctime
+# undef asctime_r
+# define asctime_r tz_asctime_r
# undef ctime
# define ctime tz_ctime
# undef ctime_r
@@ -355,6 +464,8 @@
# define posix2time tz_posix2time
# undef posix2time_z
# define posix2time_z tz_posix2time_z
+# undef strftime
+# define strftime tz_strftime
# undef time
# define time tz_time
# undef time2posix
@@ -375,12 +486,36 @@
# define tzfree tz_tzfree
# undef tzset
# define tzset tz_tzset
-# undef tzsetwall
-# define tzsetwall tz_tzsetwall
+# if HAVE_STRFTIME_L
+# undef strftime_l
+# define strftime_l tz_strftime_l
+# endif
+# if HAVE_TZNAME
+# undef tzname
+# define tzname tz_tzname
+# endif
+# if USG_COMPAT
+# undef daylight
+# define daylight tz_daylight
+# undef timezone
+# define timezone tz_timezone
+# endif
+# if ALTZONE
+# undef altzone
+# define altzone tz_altzone
+# endif
+char *asctime(struct tm const *);
+char *asctime_r(struct tm const *restrict, char *restrict);
char *ctime(time_t const *);
char *ctime_r(time_t const *, char *);
-double difftime(time_t, time_t);
+double difftime(time_t, time_t) ATTRIBUTE_CONST;
+size_t strftime(char *restrict, size_t, char const *restrict,
+ struct tm const *restrict);
+# if HAVE_STRFTIME_L
+size_t strftime_l(char *restrict, size_t, char const *restrict,
+ struct tm const *restrict, locale_t);
+# endif
struct tm *gmtime(time_t const *);
struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
struct tm *localtime(time_t const *);
@@ -394,18 +529,26 @@
extern char *asctime_r(struct tm const *restrict, char *restrict);
#endif
-#if !HAVE_POSIX_DECLS
-# ifdef USG_COMPAT
-# ifndef timezone
-extern long timezone;
-# endif
-# ifndef daylight
-extern int daylight;
-# endif
+#ifndef HAVE_DECL_ENVIRON
+# if defined environ || defined __USE_GNU
+# define HAVE_DECL_ENVIRON 1
+# else
+# define HAVE_DECL_ENVIRON 0
# endif
#endif
-#if defined ALTZONE && !defined altzone
+#if !HAVE_DECL_ENVIRON
+extern char **environ;
+#endif
+
+#if 2 <= HAVE_TZNAME + (TZ_TIME_T || !HAVE_POSIX_DECLS)
+extern char *tzname[];
+#endif
+#if 2 <= USG_COMPAT + (TZ_TIME_T || !HAVE_POSIX_DECLS)
+extern long timezone;
+extern int daylight;
+#endif
+#if 2 <= ALTZONE + (TZ_TIME_T || !HAVE_POSIX_DECLS)
extern long altzone;
#endif
@@ -415,25 +558,22 @@
*/
#ifdef STD_INSPIRED
-# if !defined tzsetwall || defined time_tz
-void tzsetwall(void);
-# endif
-# if !defined offtime || defined time_tz
+# if TZ_TIME_T || !defined offtime
struct tm *offtime(time_t const *, long);
# endif
-# if !defined timegm || defined time_tz
+# if TZ_TIME_T || !defined timegm
time_t timegm(struct tm *);
# endif
-# if !defined timelocal || defined time_tz
+# if TZ_TIME_T || !defined timelocal
time_t timelocal(struct tm *);
# endif
-# if !defined timeoff || defined time_tz
+# if TZ_TIME_T || !defined timeoff
time_t timeoff(struct tm *, long);
# endif
-# if !defined time2posix || defined time_tz
+# if TZ_TIME_T || !defined time2posix
time_t time2posix(time_t);
# endif
-# if !defined posix2time || defined time_tz
+# if TZ_TIME_T || !defined posix2time
time_t posix2time(time_t);
# endif
#endif
@@ -467,10 +607,10 @@
timezone_t tzalloc(char const *);
void tzfree(timezone_t);
# ifdef STD_INSPIRED
-# if !defined posix2time_z || defined time_tz
+# if TZ_TIME_T || !defined posix2time_z
time_t posix2time_z(timezone_t, time_t) ATTRIBUTE_PURE;
# endif
-# if !defined time2posix_z || defined time_tz
+# if TZ_TIME_T || !defined time2posix_z
time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_PURE;
# endif
# endif
@@ -480,22 +620,16 @@
** Finally, some convenience items.
*/
-#if __STDC_VERSION__ < 199901
+#if HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
# define true 1
# define false 0
# define bool int
-#else
-# include <stdbool.h>
#endif
-#ifndef TYPE_BIT
-#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
-#endif /* !defined TYPE_BIT */
-
-#ifndef TYPE_SIGNED
+#define TYPE_BIT(type) (sizeof(type) * CHAR_BIT)
#define TYPE_SIGNED(type) (((type) -1) < 0)
-#endif /* !defined TYPE_SIGNED */
-
#define TWOS_COMPLEMENT(t) ((t) ~ (t) 0 < 0)
/* Max and min values of the integer type T, of which only the bottom
@@ -507,11 +641,34 @@
#define MINVAL(t, b) \
((t) (TYPE_SIGNED(t) ? - TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0))
-/* The minimum and maximum finite time values. This assumes no padding. */
-static time_t const time_t_min = MINVAL(time_t, TYPE_BIT(time_t));
-static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
+/* The extreme time values, assuming no padding. */
+#define TIME_T_MIN_NO_PADDING MINVAL(time_t, TYPE_BIT(time_t))
+#define TIME_T_MAX_NO_PADDING MAXVAL(time_t, TYPE_BIT(time_t))
-#ifndef INT_STRLEN_MAXIMUM
+/* The extreme time values. These are macros, not constants, so that
+ any portability problems occur only when compiling .c files that use
+ the macros, which is safer for applications that need only zdump and zic.
+ This implementation assumes no padding if time_t is signed and
+ either the compiler lacks support for _Generic or time_t is not one
+ of the standard signed integer types. */
+#if HAVE_GENERIC
+# define TIME_T_MIN \
+ _Generic((time_t) 0, \
+ signed char: SCHAR_MIN, short: SHRT_MIN, \
+ int: INT_MIN, long: LONG_MIN, long long: LLONG_MIN, \
+ default: TIME_T_MIN_NO_PADDING)
+# define TIME_T_MAX \
+ (TYPE_SIGNED(time_t) \
+ ? _Generic((time_t) 0, \
+ signed char: SCHAR_MAX, short: SHRT_MAX, \
+ int: INT_MAX, long: LONG_MAX, long long: LLONG_MAX, \
+ default: TIME_T_MAX_NO_PADDING) \
+ : (time_t) -1)
+#else
+# define TIME_T_MIN TIME_T_MIN_NO_PADDING
+# define TIME_T_MAX TIME_T_MAX_NO_PADDING
+#endif
+
/*
** 302 / 1000 is log10(2.0) rounded up.
** Subtract one for the sign bit if the type is signed;
@@ -521,13 +678,12 @@
#define INT_STRLEN_MAXIMUM(type) \
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
1 + TYPE_SIGNED(type))
-#endif /* !defined INT_STRLEN_MAXIMUM */
/*
** INITIALIZE(x)
*/
-#ifdef lint
+#ifdef GCC_LINT
# define INITIALIZE(x) ((x) = 0)
#else
# define INITIALIZE(x)
@@ -537,19 +693,30 @@
# define UNINIT_TRAP 0
#endif
+#ifdef DEBUG
+# define UNREACHABLE() abort()
+#elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__)
+# define UNREACHABLE() __builtin_unreachable()
+#elif defined __has_builtin
+# if __has_builtin(__builtin_unreachable)
+# define UNREACHABLE() __builtin_unreachable()
+# endif
+#endif
+#ifndef UNREACHABLE
+# define UNREACHABLE() ((void) 0)
+#endif
+
/*
** For the benefit of GNU folk...
** '_(MSGID)' uses the current locale's message library string for MSGID.
** The default is to use gettext if available, and use MSGID otherwise.
*/
-#ifndef _
#if HAVE_GETTEXT
#define _(msgid) gettext(msgid)
#else /* !HAVE_GETTEXT */
#define _(msgid) msgid
#endif /* !HAVE_GETTEXT */
-#endif /* !defined _ */
#if !defined TZ_DOMAIN && defined HAVE_GETTEXT
# define TZ_DOMAIN "tz"
@@ -562,24 +729,64 @@
char *ctime_r(time_t const *, char *);
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
-#ifndef YEARSPERREPEAT
+/* Handy macros that are independent of tzfile implementation. */
+
+#define SECSPERMIN 60
+#define MINSPERHOUR 60
+#define HOURSPERDAY 24
+#define DAYSPERWEEK 7
+#define DAYSPERNYEAR 365
+#define DAYSPERLYEAR 366
+#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
+#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
+#define MONSPERYEAR 12
+
#define YEARSPERREPEAT 400 /* years before a Gregorian repeat */
-#endif /* !defined YEARSPERREPEAT */
+#define DAYSPERREPEAT ((int_fast32_t) 400 * 365 + 100 - 4 + 1)
+#define SECSPERREPEAT ((int_fast64_t) DAYSPERREPEAT * SECSPERDAY)
+#define AVGSECSPERYEAR (SECSPERREPEAT / YEARSPERREPEAT)
+
+#define TM_SUNDAY 0
+#define TM_MONDAY 1
+#define TM_TUESDAY 2
+#define TM_WEDNESDAY 3
+#define TM_THURSDAY 4
+#define TM_FRIDAY 5
+#define TM_SATURDAY 6
+
+#define TM_JANUARY 0
+#define TM_FEBRUARY 1
+#define TM_MARCH 2
+#define TM_APRIL 3
+#define TM_MAY 4
+#define TM_JUNE 5
+#define TM_JULY 6
+#define TM_AUGUST 7
+#define TM_SEPTEMBER 8
+#define TM_OCTOBER 9
+#define TM_NOVEMBER 10
+#define TM_DECEMBER 11
+
+#define TM_YEAR_BASE 1900
+#define TM_WDAY_BASE TM_MONDAY
+
+#define EPOCH_YEAR 1970
+#define EPOCH_WDAY TM_THURSDAY
+
+#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
/*
-** The Gregorian year averages 365.2425 days, which is 31556952 seconds.
+** Since everything in isleap is modulo 400 (or a factor of 400), we know that
+** isleap(y) == isleap(y % 400)
+** and so
+** isleap(a + b) == isleap((a + b) % 400)
+** or
+** isleap(a + b) == isleap(a % 400 + b % 400)
+** This is true even if % means modulo rather than Fortran remainder
+** (which is allowed by C89 but not by C99 or later).
+** We use this to avoid addition overflow problems.
*/
-#ifndef AVGSECSPERYEAR
-#define AVGSECSPERYEAR 31556952L
-#endif /* !defined AVGSECSPERYEAR */
-
-#ifndef SECSPERREPEAT
-#define SECSPERREPEAT ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
-#endif /* !defined SECSPERREPEAT */
-
-#ifndef SECSPERREPEAT_BITS
-#define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */
-#endif /* !defined SECSPERREPEAT_BITS */
+#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
#endif /* !defined PRIVATE_H */
diff --git a/libc/tzcode/strftime.c b/libc/tzcode/strftime.c
index 7c4be49..d04c5ba 100644
--- a/libc/tzcode/strftime.c
+++ b/libc/tzcode/strftime.c
@@ -1,4 +1,4 @@
-/* Convert a broken-down time stamp to a string. */
+/* Convert a broken-down timestamp to a string. */
/* Copyright 1989 The Regents of the University of California.
All rights reserved.
@@ -35,9 +35,13 @@
#include "private.h"
-#include "tzfile.h"
-#include "fcntl.h"
-#include "locale.h"
+#include <fcntl.h>
+#include <locale.h>
+#include <stdio.h>
+
+#ifndef DEPRECATE_TWO_DIGIT_YEARS
+# define DEPRECATE_TWO_DIGIT_YEARS false
+#endif
#if defined(__BIONIC__)
@@ -45,6 +49,7 @@
#if defined(__LP64__)
#define time64_t time_t
#define mktime64 mktime
+#define localtime64_r localtime_r
#else
#include <time64.h>
#endif
@@ -88,7 +93,7 @@
/*
** x_fmt
- ** C99 requires this format.
+ ** C99 and later require this format.
** Using just numbers (as here) makes Quakers happier;
** it's also compatible with SVR4.
*/
@@ -96,7 +101,7 @@
/*
** c_fmt
- ** C99 requires this format.
+ ** C99 and later require this format.
** Previously this code used "%D %X", but we now conform to C99.
** Note that
** "%a %b %d %H:%M:%S %Y"
@@ -114,25 +119,18 @@
"%a %b %e %H:%M:%S %Z %Y"
};
+enum warn { IN_NONE, IN_SOME, IN_THIS, IN_ALL };
+
static char * _add(const char *, char *, const char *, int);
static char * _conv(int, const char *, char *, const char *);
static char * _fmt(const char *, const struct tm *, char *, const char *,
- int *);
+ enum warn *);
static char * _yconv(int, int, bool, bool, char *, const char *, int);
-#if !HAVE_POSIX_DECLS
-extern char * tzname[];
-#endif
-
#ifndef YEAR_2000_NAME
#define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
#endif /* !defined YEAR_2000_NAME */
-#define IN_NONE 0
-#define IN_SOME 1
-#define IN_THIS 2
-#define IN_ALL 3
-
#if HAVE_STRFTIME_L
size_t
strftime_l(char *s, size_t maxsize, char const *format, struct tm const *t,
@@ -149,18 +147,19 @@
strftime(char *s, size_t maxsize, const char *format, const struct tm *t)
{
char * p;
- int warn;
+ int saved_errno = errno;
+ enum warn warn = IN_NONE;
tzset();
- warn = IN_NONE;
- p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn);
-#ifndef NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
- if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
+ p = _fmt(format, t, s, s + maxsize, &warn);
+ if (!p) {
+ errno = EOVERFLOW;
+ return 0;
+ }
+ if (DEPRECATE_TWO_DIGIT_YEARS
+ && warn != IN_NONE && getenv(YEAR_2000_NAME)) {
fprintf(stderr, "\n");
- if (format == NULL)
- fprintf(stderr, "NULL strftime format ");
- else fprintf(stderr, "strftime format \"%s\" ",
- format);
+ fprintf(stderr, "strftime format \"%s\" ", format);
fprintf(stderr, "yields only two digits of years in ");
if (warn == IN_SOME)
fprintf(stderr, "some locales");
@@ -169,10 +168,12 @@
else fprintf(stderr, "all locales");
fprintf(stderr, "\n");
}
-#endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */
- if (p == s + maxsize)
+ if (p == s + maxsize) {
+ errno = ERANGE;
return 0;
+ }
*p = '\0';
+ errno = saved_errno;
return p - s;
}
@@ -189,9 +190,32 @@
return normal;
}
+// Android-added: fall back mechanism when TM_ZONE is not initialized.
+#ifdef TM_ZONE
+static const char* _safe_tm_zone(const struct tm* tm) {
+ const char* zone = tm->TM_ZONE;
+ if (!zone || !*zone) {
+ // "The value of tm_isdst shall be positive if Daylight Savings Time is
+ // in effect, 0 if Daylight Savings Time is not in effect, and negative
+ // if the information is not available."
+ if (tm->tm_isdst == 0) {
+ zone = tzname[0];
+ } else if (tm->tm_isdst > 0) {
+ zone = tzname[1];
+ }
+
+ // "Replaced by the timezone name or abbreviation, or by no bytes if no
+ // timezone information exists."
+ if (!zone || !*zone) zone = "";
+ }
+
+ return zone;
+}
+#endif
+
static char *
_fmt(const char *format, const struct tm *t, char *pt,
- const char *ptlim, int *warnp)
+ const char *ptlim, enum warn *warnp)
{
for ( ; *format; ++format) {
if (*format == '%') {
@@ -239,7 +263,7 @@
continue;
case 'c':
{
- int warn2 = IN_SOME;
+ enum warn warn2 = IN_SOME;
pt = _fmt(Locale->c_fmt, t, pt, ptlim, &warn2);
if (warn2 == IN_ALL)
@@ -257,12 +281,12 @@
case 'E':
case 'O':
/*
- ** C99 locale modifiers.
+ ** Locale modifiers of C99 and later.
** The sequences
** %Ec %EC %Ex %EX %Ey %EY
** %Od %oe %OH %OI %Om %OM
** %OS %Ou %OU %OV %Ow %OW %Oy
- ** are supposed to provide alternate
+ ** are supposed to provide alternative
** representations.
*/
goto label;
@@ -356,11 +380,17 @@
tm = *t;
mkt = mktime64(&tm);
- if (TYPE_SIGNED(time64_t))
- snprintf(buf, sizeof(buf), "%"PRIdMAX,
- (intmax_t) mkt);
- else snprintf(buf, sizeof(buf), "%"PRIuMAX,
- (uintmax_t) mkt);
+ /* There is no portable, definitive
+ test for whether whether mktime
+ succeeded, so treat (time_t) -1 as
+ the success that it might be. */
+ if (TYPE_SIGNED(time64_t)) {
+ intmax_t n = mkt;
+ sprintf(buf, "%"PRIdMAX, n);
+ } else {
+ uintmax_t n = mkt;
+ sprintf(buf, "%"PRIuMAX, n);
+ }
pt = _add(buf, pt, ptlim, modifier);
}
continue;
@@ -392,7 +422,7 @@
** (01-53)."
** (ado, 1993-05-24)
**
-** From <http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html> by Markus Kuhn:
+** From <https://www.cl.cam.ac.uk/~mgk25/iso-time.html> by Markus Kuhn:
** "Week 01 of a year is per definition the first week which has the
** Thursday in this year, which is equivalent to the week which contains
** the fourth day of January. In other words, the first week of a new year
@@ -494,7 +524,7 @@
continue;
case 'x':
{
- int warn2 = IN_SOME;
+ enum warn warn2 = IN_SOME;
pt = _fmt(Locale->x_fmt, t, pt, ptlim, &warn2);
if (warn2 == IN_ALL)
@@ -517,45 +547,32 @@
case 'Z':
#ifdef TM_ZONE
// BEGIN: Android-changed.
- {
- const char* zone = t->TM_ZONE;
- if (!zone || !*zone) {
- // "The value of tm_isdst shall be positive if Daylight Savings Time is
- // in effect, 0 if Daylight Savings Time is not in effect, and negative
- // if the information is not available."
- if (t->tm_isdst == 0) zone = tzname[0];
- else if (t->tm_isdst > 0) zone = tzname[1];
-
- // "Replaced by the timezone name or abbreviation, or by no bytes if no
- // timezone information exists."
- if (!zone || !*zone) zone = "";
- }
- pt = _add(zone, pt, ptlim, modifier);
- }
+ pt = _add(_safe_tm_zone(t), pt, ptlim, modifier);
// END: Android-changed.
-#else
+#elif HAVE_TZNAME
if (t->tm_isdst >= 0)
pt = _add(tzname[t->tm_isdst != 0],
pt, ptlim);
#endif
/*
- ** C99 says that %Z must be replaced by the
- ** empty string if the time zone is not
+ ** C99 and later say that %Z must be
+ ** replaced by the empty string if the
+ ** time zone abbreviation is not
** determinable.
*/
continue;
case 'z':
+#if defined TM_GMTOFF || USG_COMPAT || ALTZONE
{
long diff;
char const * sign;
+ bool negative;
- if (t->tm_isdst < 0)
- continue;
-#ifdef TM_GMTOFF
+# ifdef TM_GMTOFF
diff = t->TM_GMTOFF;
-#else /* !defined TM_GMTOFF */
+# else
/*
- ** C99 says that the UT offset must
+ ** C99 and later say that the UT offset must
** be computed by looking only at
** tm_isdst. This requirement is
** incorrect, since it means the code
@@ -563,30 +580,48 @@
** altzone and timezone), and the
** magic might not have the correct
** offset. Doing things correctly is
- ** tricky and requires disobeying C99;
+ ** tricky and requires disobeying the standard;
** see GNU C strftime for details.
** For now, punt and conform to the
** standard, even though it's incorrect.
**
- ** C99 says that %z must be replaced by the
- ** empty string if the time zone is not
+ ** C99 and later say that %z must be replaced by
+ ** the empty string if the time zone is not
** determinable, so output nothing if the
** appropriate variables are not available.
*/
+ if (t->tm_isdst < 0)
+ continue;
if (t->tm_isdst == 0)
-#ifdef USG_COMPAT
+# if USG_COMPAT
diff = -timezone;
-#else /* !defined USG_COMPAT */
+# else
continue;
-#endif /* !defined USG_COMPAT */
+# endif
else
-#ifdef ALTZONE
+# if ALTZONE
diff = -altzone;
-#else /* !defined ALTZONE */
+# else
continue;
-#endif /* !defined ALTZONE */
-#endif /* !defined TM_GMTOFF */
- if (diff < 0) {
+# endif
+# endif
+ negative = diff < 0;
+ if (diff == 0) {
+#ifdef TM_ZONE
+ // Android-changed: do not use TM_ZONE as it is as it may be null.
+ {
+ const char* zone = _safe_tm_zone(t);
+ negative = zone[0] == '-';
+ }
+#else
+ negative = t->tm_isdst < 0;
+# if HAVE_TZNAME
+ if (tzname[t->tm_isdst != 0][0] == '-')
+ negative = true;
+# endif
+#endif
+ }
+ if (negative) {
sign = "-";
diff = -diff;
} else sign = "+";
@@ -596,6 +631,7 @@
(diff % MINSPERHOUR);
pt = _conv(diff, getformat(modifier, "04", " 4", " ", "04"), pt, ptlim);
}
+#endif
continue;
case '+':
pt = _fmt(Locale->date_fmt, t, pt, ptlim,
diff --git a/libc/tzcode/strptime.c b/libc/tzcode/strptime.c
index 7e8e234..d31a501 100644
--- a/libc/tzcode/strptime.c
+++ b/libc/tzcode/strptime.c
@@ -1,8 +1,7 @@
-/* $OpenBSD: strptime.c,v 1.11 2005/08/08 08:05:38 espie Exp $ */
-/* $NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $ */
-
+/* $OpenBSD: strptime.c,v 1.31 2023/03/02 16:21:51 millert Exp $ */
+/* $NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $ */
/*-
- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code was contributed to The NetBSD Foundation by Klaus Klein.
@@ -15,13 +14,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -36,65 +28,44 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-//#include <sys/localedef.h>
#include <ctype.h>
#include <errno.h>
+#include <limits.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
+
+#include "localedef.h"
+#include "private.h"
#include "tzfile.h"
-static const struct {
- const char *abday[7];
- const char *day[7];
- const char *abmon[12];
- const char *mon[12];
- const char *am_pm[2];
- const char *d_t_fmt;
- const char *d_fmt;
- const char *t_fmt;
- const char *t_fmt_ampm;
-} _DefaultTimeLocale = {
- {
- "Sun","Mon","Tue","Wed","Thu","Fri","Sat",
- },
- {
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
- "Friday", "Saturday"
- },
- {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- },
- {
- "January", "February", "March", "April", "May", "June", "July",
- "August", "September", "October", "November", "December"
- },
- {
- "AM", "PM"
- },
- "%a %b %d %H:%M:%S %Y",
- "%m/%d/%y",
- "%H:%M:%S",
- "%I:%M:%S %p"
-};
+// Android: ignore OpenBSD's DEF_WEAK() stuff.
+#define DEF_WEAK(sym) /* */
+// Android: this code is not pointer-sign clean.
+#pragma clang diagnostic ignored "-Wpointer-sign"
+#pragma clang diagnostic ignored "-Wunused-function"
+// Android: clang thinks people don't know && has higher precedence than ||.
+#pragma clang diagnostic ignored "-Wlogical-op-parentheses"
-#define _ctloc(x) (_DefaultTimeLocale.x)
+#define _ctloc(x) (_CurrentTimeLocale->x)
/*
* We do not implement alternate representations. However, we always
* check whether a given modifier is allowed for a certain conversion.
*/
-#define _ALT_E 0x01
-#define _ALT_O 0x02
-#define _LEGAL_ALT(x) { if (alt_format & ~(x)) return (0); }
+#define _ALT_E 0x01
+#define _ALT_O 0x02
+#define _LEGAL_ALT(x) { if (alt_format & ~(x)) return (0); }
-
-struct century_relyear {
- int century;
- int relyear;
-};
+/*
+ * We keep track of some of the fields we set in order to compute missing ones.
+ */
+#define FIELD_TM_MON (1 << 0)
+#define FIELD_TM_MDAY (1 << 1)
+#define FIELD_TM_WDAY (1 << 2)
+#define FIELD_TM_YDAY (1 << 3)
+#define FIELD_TM_YEAR (1 << 4)
static char gmt[] = { "GMT" };
static char utc[] = { "UTC" };
@@ -106,9 +77,15 @@
"EDT", "CDT", "MDT", "PDT", "\0\0\0"
};
-static int _conv_num(const unsigned char **, int *, int, int);
-static unsigned char *_strptime(const unsigned char *, const char *, struct tm *,
- struct century_relyear *);
+static const int mon_lengths[2][MONSPERYEAR] = {
+ { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+ { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+};
+
+static int _conv_num(const unsigned char **, int *, int, int);
+static int epoch_to_tm(const unsigned char **, struct tm *);
+static int leaps_thru_end_of(const int y);
+static char *_strptime(const char *, const char *, struct tm *, int);
static const u_char *_find_string(const u_char *, int *, const char * const *,
const char * const *, int);
@@ -116,335 +93,336 @@
char *
strptime(const char *buf, const char *fmt, struct tm *tm)
{
- struct century_relyear cr;
- cr.century = TM_YEAR_BASE;
- cr.relyear = -1;
- return (char*)(_strptime((const unsigned char*)buf, fmt, tm, &cr));
+ return(_strptime(buf, fmt, tm, 1));
}
+DEF_WEAK(strptime);
-static unsigned char *
-_strptime(const unsigned char *buf, const char *fmt, struct tm *tm, struct century_relyear *cr)
+static char *
+_strptime(const char *buf, const char *fmt, struct tm *tm, int initialize)
{
- unsigned char c;
- const unsigned char *bp, *ep;
- size_t len = 0;
- int alt_format, i, offs;
- int neg = 0;
+ unsigned char c;
+ const unsigned char *bp, *ep;
+ size_t len;
+ int alt_format, i, offs;
+ int neg = 0;
+ static int century, relyear, fields;
- bp = (unsigned char *)buf;
- while ((c = *fmt) != '\0') {
- /* Clear `alternate' modifier prior to new conversion. */
- alt_format = 0;
+ if (initialize) {
+ century = TM_YEAR_BASE;
+ relyear = -1;
+ fields = 0;
+ }
- /* Eat up white-space. */
- if (isspace(c)) {
- while (isspace(*bp))
- bp++;
+ bp = (const unsigned char *)buf;
+ while ((c = *fmt) != '\0') {
+ /* Clear `alternate' modifier prior to new conversion. */
+ alt_format = 0;
- fmt++;
- continue;
- }
+ /* Eat up white-space. */
+ if (isspace(c)) {
+ while (isspace(*bp))
+ bp++;
- if ((c = *fmt++) != '%')
- goto literal;
+ fmt++;
+ continue;
+ }
+
+ if ((c = *fmt++) != '%')
+ goto literal;
-again: switch (c = *fmt++) {
- case '%': /* "%%" is converted to "%". */
+again: switch (c = *fmt++) {
+ case '%': /* "%%" is converted to "%". */
literal:
- if (c != *bp++)
- return (NULL);
+ if (c != *bp++)
+ return (NULL);
- break;
+ break;
- /*
- * "Alternative" modifiers. Just set the appropriate flag
- * and start over again.
- */
- case 'E': /* "%E?" alternative conversion modifier. */
- _LEGAL_ALT(0);
- alt_format |= _ALT_E;
- goto again;
+ /*
+ * "Alternative" modifiers. Just set the appropriate flag
+ * and start over again.
+ */
+ case 'E': /* "%E?" alternative conversion modifier. */
+ _LEGAL_ALT(0);
+ alt_format |= _ALT_E;
+ goto again;
- case 'O': /* "%O?" alternative conversion modifier. */
- _LEGAL_ALT(0);
- alt_format |= _ALT_O;
- goto again;
+ case 'O': /* "%O?" alternative conversion modifier. */
+ _LEGAL_ALT(0);
+ alt_format |= _ALT_O;
+ goto again;
- /*
- * "Complex" conversion rules, implemented through recursion.
- */
- case 'c': /* Date and time, using the locale's format. */
- _LEGAL_ALT(_ALT_E);
- if (!(bp = _strptime(bp, _ctloc(d_t_fmt), tm, cr)))
- return (NULL);
- break;
+ /*
+ * "Complex" conversion rules, implemented through recursion.
+ */
+ case 'c': /* Date and time, using the locale's format. */
+ _LEGAL_ALT(_ALT_E);
+ if (!(bp = _strptime(bp, _ctloc(d_t_fmt), tm, 0)))
+ return (NULL);
+ break;
- case 'D': /* The date as "%m/%d/%y". */
- _LEGAL_ALT(0);
- if (!(bp = _strptime(bp, "%m/%d/%y", tm, cr)))
- return (NULL);
- break;
+ case 'D': /* The date as "%m/%d/%y". */
+ _LEGAL_ALT(0);
+ if (!(bp = _strptime(bp, "%m/%d/%y", tm, 0)))
+ return (NULL);
+ break;
- case 'F': /* The date as "%Y-%m-%d". */
- _LEGAL_ALT(0);
- if (!(bp = _strptime(bp, "%Y-%m-%d", tm, cr)))
- return (NULL);
- continue;
+ case 'F': /* The date as "%Y-%m-%d". */
+ _LEGAL_ALT(0);
+ if (!(bp = _strptime(bp, "%Y-%m-%d", tm, 0)))
+ return (NULL);
+ continue;
- case 'R': /* The time as "%H:%M". */
- _LEGAL_ALT(0);
- if (!(bp = _strptime(bp, "%H:%M", tm, cr)))
- return (NULL);
- break;
+ case 'R': /* The time as "%H:%M". */
+ _LEGAL_ALT(0);
+ if (!(bp = _strptime(bp, "%H:%M", tm, 0)))
+ return (NULL);
+ break;
- case 'r': /* The time as "%I:%M:%S %p". */
- _LEGAL_ALT(0);
- if (!(bp = _strptime(bp, "%I:%M:%S %p", tm, cr)))
- return (NULL);
- break;
+ case 'r': /* The time as "%I:%M:%S %p". */
+ _LEGAL_ALT(0);
+ if (!(bp = _strptime(bp, "%I:%M:%S %p", tm, 0)))
+ return (NULL);
+ break;
- case 'T': /* The time as "%H:%M:%S". */
- _LEGAL_ALT(0);
- if (!(bp = _strptime(bp, "%H:%M:%S", tm, cr)))
- return (NULL);
- break;
+ case 'T': /* The time as "%H:%M:%S". */
+ _LEGAL_ALT(0);
+ if (!(bp = _strptime(bp, "%H:%M:%S", tm, 0)))
+ return (NULL);
+ break;
- case 'v': /* The date as "%e-%b-%Y". */
- _LEGAL_ALT(0);
- if (!(bp = _strptime(bp, "%e-%b-%Y", tm, cr)))
- return (NULL);
- break;
+ case 'v': /* Android: the date as "%e-%b-%Y" for strftime() compat; glibc does this too. */
+ _LEGAL_ALT(0);
+ if (!(bp = _strptime(bp, "%e-%b-%Y", tm, 0)))
+ return (NULL);
+ break;
- case 'X': /* The time, using the locale's format. */
- _LEGAL_ALT(_ALT_E);
- if (!(bp = _strptime(bp, _ctloc(t_fmt), tm, cr)))
- return (NULL);
- break;
+ case 'X': /* The time, using the locale's format. */
+ _LEGAL_ALT(_ALT_E);
+ if (!(bp = _strptime(bp, _ctloc(t_fmt), tm, 0)))
+ return (NULL);
+ break;
- case 'x': /* The date, using the locale's format. */
- _LEGAL_ALT(_ALT_E);
- if (!(bp = _strptime(bp, _ctloc(d_fmt), tm, cr)))
- return (NULL);
- break;
+ case 'x': /* The date, using the locale's format. */
+ _LEGAL_ALT(_ALT_E);
+ if (!(bp = _strptime(bp, _ctloc(d_fmt), tm, 0)))
+ return (NULL);
+ break;
- /*
- * "Elementary" conversion rules.
- */
- case 'A': /* The day of week, using the locale's form. */
- case 'a':
- _LEGAL_ALT(0);
- for (i = 0; i < 7; i++) {
- /* Full name. */
- len = strlen(_ctloc(day[i]));
- if (strncasecmp(_ctloc(day[i]), (const char*)bp, len) == 0)
- break;
+ /*
+ * "Elementary" conversion rules.
+ */
+ case 'A': /* The day of week, using the locale's form. */
+ case 'a':
+ _LEGAL_ALT(0);
+ for (i = 0; i < 7; i++) {
+ /* Full name. */
+ len = strlen(_ctloc(day[i]));
+ if (strncasecmp(_ctloc(day[i]), bp, len) == 0)
+ break;
- /* Abbreviated name. */
- len = strlen(_ctloc(abday[i]));
- if (strncasecmp(_ctloc(abday[i]), (const char*)bp, len) == 0)
- break;
- }
+ /* Abbreviated name. */
+ len = strlen(_ctloc(abday[i]));
+ if (strncasecmp(_ctloc(abday[i]), bp, len) == 0)
+ break;
+ }
- /* Nothing matched. */
- if (i == 7)
- return (NULL);
+ /* Nothing matched. */
+ if (i == 7)
+ return (NULL);
- tm->tm_wday = i;
- bp += len;
- break;
+ tm->tm_wday = i;
+ bp += len;
+ fields |= FIELD_TM_WDAY;
+ break;
- case 'B': /* The month, using the locale's form. */
- case 'b':
- case 'h':
- _LEGAL_ALT(0);
- for (i = 0; i < 12; i++) {
- /* Full name. */
- len = strlen(_ctloc(mon[i]));
- if (strncasecmp(_ctloc(mon[i]), (const char*)bp, len) == 0)
- break;
+ case 'B': /* The month, using the locale's form. */
+ case 'b':
+ case 'h':
+ _LEGAL_ALT(0);
+ for (i = 0; i < 12; i++) {
+ /* Full name. */
+ len = strlen(_ctloc(mon[i]));
+ if (strncasecmp(_ctloc(mon[i]), bp, len) == 0)
+ break;
- /* Abbreviated name. */
- len = strlen(_ctloc(abmon[i]));
- if (strncasecmp(_ctloc(abmon[i]), (const char*)bp, len) == 0)
- break;
- }
+ /* Abbreviated name. */
+ len = strlen(_ctloc(abmon[i]));
+ if (strncasecmp(_ctloc(abmon[i]), bp, len) == 0)
+ break;
+ }
- /* Nothing matched. */
- if (i == 12)
- return (NULL);
+ /* Nothing matched. */
+ if (i == 12)
+ return (NULL);
- tm->tm_mon = i;
- bp += len;
- break;
+ tm->tm_mon = i;
+ bp += len;
+ fields |= FIELD_TM_MON;
+ break;
- case 'C': /* The century number. */
- _LEGAL_ALT(_ALT_E);
- if (!(_conv_num(&bp, &i, 0, 99)))
- return (NULL);
+ case 'C': /* The century number. */
+ _LEGAL_ALT(_ALT_E);
+ if (!(_conv_num(&bp, &i, 0, 99)))
+ return (NULL);
- cr->century = i * 100;
- break;
+ century = i * 100;
+ break;
- case 'd': /* The day of month. */
- case 'e':
- _LEGAL_ALT(_ALT_O);
- if (!(_conv_num(&bp, &tm->tm_mday, 1, 31)))
- return (NULL);
- break;
+ case 'e': /* The day of month. */
+ if (isspace(*bp))
+ bp++;
+ /* FALLTHROUGH */
+ case 'd':
+ _LEGAL_ALT(_ALT_O);
+ if (!(_conv_num(&bp, &tm->tm_mday, 1, 31)))
+ return (NULL);
+ fields |= FIELD_TM_MDAY;
+ break;
- case 'k': /* The hour (24-hour clock representation). */
- _LEGAL_ALT(0);
- /* FALLTHROUGH */
- case 'H':
- _LEGAL_ALT(_ALT_O);
- if (!(_conv_num(&bp, &tm->tm_hour, 0, 23)))
- return (NULL);
- break;
+ case 'k': /* The hour (24-hour clock representation). */
+ _LEGAL_ALT(0);
+ /* FALLTHROUGH */
+ case 'H':
+ _LEGAL_ALT(_ALT_O);
+ if (!(_conv_num(&bp, &tm->tm_hour, 0, 23)))
+ return (NULL);
+ break;
- case 'l': /* The hour (12-hour clock representation). */
- _LEGAL_ALT(0);
- /* FALLTHROUGH */
- case 'I':
- _LEGAL_ALT(_ALT_O);
- if (!(_conv_num(&bp, &tm->tm_hour, 1, 12)))
- return (NULL);
- break;
+ case 'l': /* The hour (12-hour clock representation). */
+ _LEGAL_ALT(0);
+ /* FALLTHROUGH */
+ case 'I':
+ _LEGAL_ALT(_ALT_O);
+ if (!(_conv_num(&bp, &tm->tm_hour, 1, 12)))
+ return (NULL);
+ break;
- case 'j': /* The day of year. */
- _LEGAL_ALT(0);
- if (!(_conv_num(&bp, &tm->tm_yday, 1, 366)))
- return (NULL);
- tm->tm_yday--;
- break;
+ case 'j': /* The day of year. */
+ _LEGAL_ALT(0);
+ if (!(_conv_num(&bp, &tm->tm_yday, 1, 366)))
+ return (NULL);
+ tm->tm_yday--;
+ fields |= FIELD_TM_YDAY;
+ break;
- case 'M': /* The minute. */
- _LEGAL_ALT(_ALT_O);
- if (!(_conv_num(&bp, &tm->tm_min, 0, 59)))
- return (NULL);
- break;
+ case 'M': /* The minute. */
+ _LEGAL_ALT(_ALT_O);
+ if (!(_conv_num(&bp, &tm->tm_min, 0, 59)))
+ return (NULL);
+ break;
- case 'm': /* The month. */
- _LEGAL_ALT(_ALT_O);
- if (!(_conv_num(&bp, &tm->tm_mon, 1, 12)))
- return (NULL);
- tm->tm_mon--;
- break;
+ case 'm': /* The month. */
+ _LEGAL_ALT(_ALT_O);
+ if (!(_conv_num(&bp, &tm->tm_mon, 1, 12)))
+ return (NULL);
+ tm->tm_mon--;
+ fields |= FIELD_TM_MON;
+ break;
- case 'P':
- case 'p': /* The locale's equivalent of AM/PM. */
- _LEGAL_ALT(0);
- /* AM? */
- len = strlen(_ctloc(am_pm[0]));
- if (strncasecmp(_ctloc(am_pm[0]), (const char*)bp, len) == 0) {
- if (tm->tm_hour > 12) /* i.e., 13:00 AM ?! */
- return (NULL);
- else if (tm->tm_hour == 12)
- tm->tm_hour = 0;
+ case 'P': /* Android addition for strftime() compat; glibc does this too. */
+ case 'p': /* The locale's equivalent of AM/PM. */
+ _LEGAL_ALT(0);
+ /* AM? */
+ len = strlen(_ctloc(am_pm[0]));
+ if (strncasecmp(_ctloc(am_pm[0]), bp, len) == 0) {
+ if (tm->tm_hour > 12) /* i.e., 13:00 AM ?! */
+ return (NULL);
+ else if (tm->tm_hour == 12)
+ tm->tm_hour = 0;
- bp += len;
- break;
- }
- /* PM? */
- len = strlen(_ctloc(am_pm[1]));
- if (strncasecmp(_ctloc(am_pm[1]), (const char*)bp, len) == 0) {
- if (tm->tm_hour > 12) /* i.e., 13:00 PM ?! */
- return (NULL);
- else if (tm->tm_hour < 12)
- tm->tm_hour += 12;
+ bp += len;
+ break;
+ }
+ /* PM? */
+ len = strlen(_ctloc(am_pm[1]));
+ if (strncasecmp(_ctloc(am_pm[1]), bp, len) == 0) {
+ if (tm->tm_hour > 12) /* i.e., 13:00 PM ?! */
+ return (NULL);
+ else if (tm->tm_hour < 12)
+ tm->tm_hour += 12;
- bp += len;
- break;
- }
+ bp += len;
+ break;
+ }
- /* Nothing matched. */
- return (NULL);
+ /* Nothing matched. */
+ return (NULL);
- case 'S': /* The seconds. */
- _LEGAL_ALT(_ALT_O);
- if (!(_conv_num(&bp, &tm->tm_sec, 0, 61)))
- return (NULL);
- break;
+ case 'S': /* The seconds. */
+ _LEGAL_ALT(_ALT_O);
+ if (!(_conv_num(&bp, &tm->tm_sec, 0, 60)))
+ return (NULL);
+ break;
+ case 's': /* Seconds since epoch. */
+ if (!(epoch_to_tm(&bp, tm)))
+ return (NULL);
+ fields = 0xffff; /* everything */
+ break;
+ case 'U': /* The week of year, beginning on sunday. */
+ case 'W': /* The week of year, beginning on monday. */
+ _LEGAL_ALT(_ALT_O);
+ /*
+ * XXX This is bogus, as we can not assume any valid
+ * information present in the tm structure at this
+ * point to calculate a real value, so just check the
+ * range for now.
+ */
+ if (!(_conv_num(&bp, &i, 0, 53)))
+ return (NULL);
+ break;
- case 's':
- {
- // Android addition, based on FreeBSD's implementation.
- int saved_errno = errno;
- errno = 0;
- const unsigned char* old_bp = bp;
- long n = strtol((const char*) bp, (char**) &bp, 10);
- time_t t = n;
- if (bp == old_bp || errno == ERANGE || ((long) t) != n) {
- errno = saved_errno;
- return NULL;
- }
- errno = saved_errno;
+ case 'w': /* The day of week, beginning on sunday. */
+ _LEGAL_ALT(_ALT_O);
+ if (!(_conv_num(&bp, &tm->tm_wday, 0, 6)))
+ return (NULL);
+ fields |= FIELD_TM_WDAY;
+ break;
- if (localtime_r(&t, tm) == NULL) return NULL;
- }
- break;
+ case 'u': /* The day of week, monday = 1. */
+ _LEGAL_ALT(_ALT_O);
+ if (!(_conv_num(&bp, &i, 1, 7)))
+ return (NULL);
+ tm->tm_wday = i % 7;
+ fields |= FIELD_TM_WDAY;
+ continue;
+ case 'g': /* The year corresponding to the ISO week
+ * number but without the century.
+ */
+ if (!(_conv_num(&bp, &i, 0, 99)))
+ return (NULL);
+ continue;
- case 'U': /* The week of year, beginning on sunday. */
- case 'W': /* The week of year, beginning on monday. */
- _LEGAL_ALT(_ALT_O);
- /*
- * XXX This is bogus, as we can not assume any valid
- * information present in the tm structure at this
- * point to calculate a real value, so just check the
- * range for now.
- */
- if (!(_conv_num(&bp, &i, 0, 53)))
- return (NULL);
- break;
+ case 'G': /* The year corresponding to the ISO week
+ * number with century.
+ */
+ do
+ bp++;
+ while (isdigit(*bp));
+ continue;
- case 'w': /* The day of week, beginning on sunday. */
- _LEGAL_ALT(_ALT_O);
- if (!(_conv_num(&bp, &tm->tm_wday, 0, 6)))
- return (NULL);
- break;
+ case 'V': /* The ISO 8601:1988 week number as decimal */
+ if (!(_conv_num(&bp, &i, 0, 53)))
+ return (NULL);
+ continue;
- case 'u': /* The day of week, monday = 1. */
- _LEGAL_ALT(_ALT_O);
- if (!(_conv_num(&bp, &i, 1, 7)))
- return (NULL);
- tm->tm_wday = i % 7;
- continue;
+ case 'Y': /* The year. */
+ _LEGAL_ALT(_ALT_E);
+ if (!(_conv_num(&bp, &i, 0, 9999)))
+ return (NULL);
- case 'g': /* The year corresponding to the ISO week
- * number but without the century.
- */
- if (!(_conv_num(&bp, &i, 0, 99)))
- return (NULL);
- continue;
+ relyear = -1;
+ tm->tm_year = i - TM_YEAR_BASE;
+ fields |= FIELD_TM_YEAR;
+ break;
- case 'G': /* The year corresponding to the ISO week
- * number with century.
- */
- do
- bp++;
- while (isdigit(*bp));
- continue;
-
- case 'V': /* The ISO 8601:1988 week number as decimal */
- if (!(_conv_num(&bp, &i, 0, 53)))
- return (NULL);
- continue;
-
- case 'Y': /* The year. */
- _LEGAL_ALT(_ALT_E);
- if (!(_conv_num(&bp, &i, 0, 9999)))
- return (NULL);
-
- cr->relyear = -1;
- tm->tm_year = i - TM_YEAR_BASE;
- break;
-
- case 'y': /* The year within the century (2 digits). */
- _LEGAL_ALT(_ALT_E | _ALT_O);
- if (!(_conv_num(&bp, &cr->relyear, 0, 99)))
- return (NULL);
- break;
+ case 'y': /* The year within the century (2 digits). */
+ _LEGAL_ALT(_ALT_E | _ALT_O);
+ if (!(_conv_num(&bp, &relyear, 0, 99)))
+ return (NULL);
+ break;
case 'Z':
tzset();
@@ -548,42 +526,78 @@
tm->tm_zone = NULL; /* XXX */
continue;
- /*
- * Miscellaneous conversions.
- */
- case 'n': /* Any kind of white-space. */
- case 't':
- _LEGAL_ALT(0);
- while (isspace(*bp))
- bp++;
- break;
+ /*
+ * Miscellaneous conversions.
+ */
+ case 'n': /* Any kind of white-space. */
+ case 't':
+ _LEGAL_ALT(0);
+ while (isspace(*bp))
+ bp++;
+ break;
- default: /* Unknown/unsupported conversion. */
- return (NULL);
- }
+ default: /* Unknown/unsupported conversion. */
+ return (NULL);
+ }
- }
+ }
- /*
- * We need to evaluate the two digit year spec (%y)
- * last as we can get a century spec (%C) at any time.
- */
- if (cr->relyear != -1) {
- if (cr->century == TM_YEAR_BASE) {
- if (cr->relyear <= 68)
- tm->tm_year = cr->relyear + 2000 - TM_YEAR_BASE;
- else
- tm->tm_year = cr->relyear + 1900 - TM_YEAR_BASE;
- } else {
- tm->tm_year = cr->relyear + cr->century - TM_YEAR_BASE;
- }
- }
+ /*
+ * We need to evaluate the two digit year spec (%y)
+ * last as we can get a century spec (%C) at any time.
+ */
+ if (relyear != -1) {
+ if (century == TM_YEAR_BASE) {
+ if (relyear <= 68)
+ tm->tm_year = relyear + 2000 - TM_YEAR_BASE;
+ else
+ tm->tm_year = relyear + 1900 - TM_YEAR_BASE;
+ } else {
+ tm->tm_year = relyear + century - TM_YEAR_BASE;
+ }
+ fields |= FIELD_TM_YEAR;
+ }
- return (unsigned char*)bp;
+ /* Compute some missing values when possible. */
+ if (fields & FIELD_TM_YEAR) {
+ const int year = tm->tm_year + TM_YEAR_BASE;
+ const int *mon_lens = mon_lengths[isleap(year)];
+ if (!(fields & FIELD_TM_YDAY) &&
+ (fields & FIELD_TM_MON) && (fields & FIELD_TM_MDAY)) {
+ tm->tm_yday = tm->tm_mday - 1;
+ for (i = 0; i < tm->tm_mon; i++)
+ tm->tm_yday += mon_lens[i];
+ fields |= FIELD_TM_YDAY;
+ }
+ if (fields & FIELD_TM_YDAY) {
+ int days = tm->tm_yday;
+ if (!(fields & FIELD_TM_WDAY)) {
+ tm->tm_wday = EPOCH_WDAY +
+ ((year - EPOCH_YEAR) % DAYSPERWEEK) *
+ (DAYSPERNYEAR % DAYSPERWEEK) +
+ leaps_thru_end_of(year - 1) -
+ leaps_thru_end_of(EPOCH_YEAR - 1) +
+ tm->tm_yday;
+ tm->tm_wday %= DAYSPERWEEK;
+ if (tm->tm_wday < 0)
+ tm->tm_wday += DAYSPERWEEK;
+ }
+ if (!(fields & FIELD_TM_MON)) {
+ tm->tm_mon = 0;
+ while (tm->tm_mon < MONSPERYEAR && days >= mon_lens[tm->tm_mon])
+ days -= mon_lens[tm->tm_mon++];
+ }
+ if (!(fields & FIELD_TM_MDAY))
+ tm->tm_mday = days + 1;
+ }
+ }
+
+ return ((char *)bp);
}
+
static int
_conv_num(const unsigned char **buf, int *dest, int llim, int ulim)
{
@@ -607,6 +621,30 @@
return (1);
}
+static int
+epoch_to_tm(const unsigned char **buf, struct tm *tm)
+{
+ int saved_errno = errno;
+ int ret = 0;
+ time_t secs;
+ char *ep;
+
+ errno = 0;
+ secs = strtoll(*buf, &ep, 10);
+ if (*buf == (unsigned char *)ep)
+ goto done;
+ if (secs < 0 ||
+ secs == LLONG_MAX && errno == ERANGE)
+ goto done;
+ if (localtime_r(&secs, tm) == NULL)
+ goto done;
+ ret = 1;
+done:
+ *buf = ep;
+ errno = saved_errno;
+ return (ret);
+}
+
static const u_char *
_find_string(const u_char *bp, int *tgt, const char * const *n1,
const char * const *n2, int c)
@@ -629,6 +667,9 @@
return NULL;
}
-char* strptime_l(const char* buf, const char* fmt, struct tm* tm, locale_t l) {
- return strptime(buf, fmt, tm);
+static int
+leaps_thru_end_of(const int y)
+{
+ return (y >= 0) ? (y / 4 - y / 100 + y / 400) :
+ -(leaps_thru_end_of(-(y + 1)) + 1);
}
diff --git a/libc/tzcode/tzfile.h b/libc/tzcode/tzfile.h
index ebecd68..c5f9967 100644
--- a/libc/tzcode/tzfile.h
+++ b/libc/tzcode/tzfile.h
@@ -1,3 +1,5 @@
+/* Layout and location of TZif files. */
+
#ifndef TZFILE_H
#define TZFILE_H
@@ -20,17 +22,20 @@
*/
#ifndef TZDIR
-#define TZDIR "/usr/local/etc/zoneinfo" /* Time zone object file directory */
+#define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */
#endif /* !defined TZDIR */
#ifndef TZDEFAULT
-#define TZDEFAULT "localtime"
+#define TZDEFAULT "/etc/localtime"
#endif /* !defined TZDEFAULT */
#ifndef TZDEFRULES
#define TZDEFRULES "posixrules"
#endif /* !defined TZDEFRULES */
+
+/* See Internet RFC 8536 for more details about the following format. */
+
/*
** Each file begins with. . .
*/
@@ -39,9 +44,9 @@
struct tzhead {
char tzh_magic[4]; /* TZ_MAGIC */
- char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
+ char tzh_version[1]; /* '\0' or '2'-'4' as of 2021 */
char tzh_reserved[15]; /* reserved; must be zero */
- char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
+ char tzh_ttisutcnt[4]; /* coded number of trans. time flags */
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
char tzh_leapcnt[4]; /* coded number of leap seconds */
char tzh_timecnt[4]; /* coded number of transition times */
@@ -64,14 +69,15 @@
** one (char [4]) total correction after above
** tzh_ttisstdcnt (char)s indexed by type; if 1, transition
** time is standard time, if 0,
-** transition time is wall clock time
-** if absent, transition times are
-** assumed to be wall clock time
-** tzh_ttisgmtcnt (char)s indexed by type; if 1, transition
-** time is UT, if 0,
-** transition time is local time
-** if absent, transition times are
+** transition time is local (wall clock)
+** time; if absent, transition times are
** assumed to be local time
+** tzh_ttisutcnt (char)s indexed by type; if 1, transition
+** time is UT, if 0, transition time is
+** local time; if absent, transition
+** times are assumed to be local time.
+** When this is 1, the corresponding
+** std/wall indicator must also be 1.
*/
/*
diff --git a/libc/upstream-freebsd/lib/libc/string/bcopy.c b/libc/upstream-freebsd/lib/libc/string/bcopy.c
new file mode 100644
index 0000000..84715d0
--- /dev/null
+++ b/libc/upstream-freebsd/lib/libc/string/bcopy.c
@@ -0,0 +1,137 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+typedef intptr_t word; /* "word" used for optimal copy speed */
+
+#define wsize sizeof(word)
+#define wmask (wsize - 1)
+
+/*
+ * Copy a block of memory, handling overlap.
+ * This is the routine that actually implements
+ * (the portable versions of) bcopy, memcpy, and memmove.
+ */
+#if defined(MEMCOPY) || defined(MEMMOVE)
+#include <string.h>
+
+void *
+#ifdef MEMCOPY
+memcpy
+#else
+memmove
+#endif
+(void *dst0, const void *src0, size_t length)
+#else
+#include <strings.h>
+
+void
+bcopy(const void *src0, void *dst0, size_t length)
+#endif
+{
+ char *dst = dst0;
+ const char *src = src0;
+ size_t t;
+
+ if (length == 0 || dst == src) /* nothing to do */
+ goto done;
+
+ /*
+ * Macros: loop-t-times; and loop-t-times, t>0
+ */
+#define TLOOP(s) if (t) TLOOP1(s)
+#define TLOOP1(s) do { s; } while (--t)
+
+ if ((unsigned long)dst < (unsigned long)src) {
+ /*
+ * Copy forward.
+ */
+ t = (uintptr_t)src; /* only need low bits */
+ if ((t | (uintptr_t)dst) & wmask) {
+ /*
+ * Try to align operands. This cannot be done
+ * unless the low bits match.
+ */
+ if ((t ^ (uintptr_t)dst) & wmask || length < wsize)
+ t = length;
+ else
+ t = wsize - (t & wmask);
+ length -= t;
+ TLOOP1(*dst++ = *src++);
+ }
+ /*
+ * Copy whole words, then mop up any trailing bytes.
+ */
+ t = length / wsize;
+ TLOOP(*(word *)(void *)dst = *(const word *)(const void *)src;
+ src += wsize; dst += wsize);
+ t = length & wmask;
+ TLOOP(*dst++ = *src++);
+ } else {
+ /*
+ * Copy backwards. Otherwise essentially the same.
+ * Alignment works as before, except that it takes
+ * (t&wmask) bytes to align, not wsize-(t&wmask).
+ */
+ src += length;
+ dst += length;
+ t = (uintptr_t)src;
+ if ((t | (uintptr_t)dst) & wmask) {
+ if ((t ^ (uintptr_t)dst) & wmask || length <= wsize)
+ t = length;
+ else
+ t &= wmask;
+ length -= t;
+ TLOOP1(*--dst = *--src);
+ }
+ t = length / wsize;
+ TLOOP(src -= wsize; dst -= wsize;
+ *(word *)(void *)dst = *(const word *)(const void *)src);
+ t = length & wmask;
+ TLOOP(*--dst = *--src);
+ }
+done:
+#if defined(MEMCOPY) || defined(MEMMOVE)
+ return (dst0);
+#else
+ return;
+#endif
+}
diff --git a/libc/upstream-freebsd/lib/libc/string/memcmp.c b/libc/upstream-freebsd/lib/libc/string/memcmp.c
new file mode 100644
index 0000000..c8d5d92
--- /dev/null
+++ b/libc/upstream-freebsd/lib/libc/string/memcmp.c
@@ -0,0 +1,58 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)memcmp.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <string.h>
+
+/*
+ * Compare memory regions.
+ */
+int
+memcmp(const void *s1, const void *s2, size_t n)
+{
+ if (n != 0) {
+ const unsigned char *p1 = s1, *p2 = s2;
+
+ do {
+ if (*p1++ != *p2++)
+ return (*--p1 - *--p2);
+ } while (--n != 0);
+ }
+ return (0);
+}
diff --git a/libc/upstream-freebsd/lib/libc/string/memcpy.c b/libc/upstream-freebsd/lib/libc/string/memcpy.c
new file mode 100644
index 0000000..ed03856
--- /dev/null
+++ b/libc/upstream-freebsd/lib/libc/string/memcpy.c
@@ -0,0 +1,5 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define MEMCOPY
+#include "bcopy.c"
diff --git a/libc/upstream-freebsd/lib/libc/string/memmove.c b/libc/upstream-freebsd/lib/libc/string/memmove.c
new file mode 100644
index 0000000..05cf75a
--- /dev/null
+++ b/libc/upstream-freebsd/lib/libc/string/memmove.c
@@ -0,0 +1,5 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define MEMMOVE
+#include "bcopy.c"
diff --git a/libc/upstream-freebsd/lib/libc/string/memset.c b/libc/upstream-freebsd/lib/libc/string/memset.c
new file mode 100644
index 0000000..e2d4027
--- /dev/null
+++ b/libc/upstream-freebsd/lib/libc/string/memset.c
@@ -0,0 +1,133 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Mike Hibler and Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)memset.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <limits.h>
+
+#define wsize sizeof(u_long)
+#define wmask (wsize - 1)
+
+#ifdef BZERO
+#include <strings.h>
+
+#define RETURN return
+#define VAL 0
+#define WIDEVAL 0
+
+void
+bzero(void *dst0, size_t length)
+#else
+#include <string.h>
+
+#define RETURN return (dst0)
+#define VAL c0
+#define WIDEVAL c
+
+void *
+memset(void *dst0, int c0, size_t length)
+#endif
+{
+ size_t t;
+#ifndef BZERO
+ u_long c;
+#endif
+ u_char *dst;
+
+ dst = dst0;
+ /*
+ * If not enough words, just fill bytes. A length >= 2 words
+ * guarantees that at least one of them is `complete' after
+ * any necessary alignment. For instance:
+ *
+ * |-----------|-----------|-----------|
+ * |00|01|02|03|04|05|06|07|08|09|0A|00|
+ * ^---------------------^
+ * dst dst+length-1
+ *
+ * but we use a minimum of 3 here since the overhead of the code
+ * to do word writes is substantial.
+ *
+ * TODO: This threshold might not be sensible for 64-bit u_long.
+ * We should benchmark and revisit this decision.
+ */
+ if (length < 3 * wsize) {
+ while (length != 0) {
+ *dst++ = VAL;
+ --length;
+ }
+ RETURN;
+ }
+
+#ifndef BZERO
+ if ((c = (u_char)c0) != 0) { /* Fill the word. */
+ c = (c << 8) | c; /* u_long is 16 bits. */
+#if ULONG_MAX > 0xffff
+ c = (c << 16) | c; /* u_long is 32 bits. */
+#endif
+#if ULONG_MAX > 0xffffffff
+ c = (c << 32) | c; /* u_long is 64 bits. */
+#endif
+ }
+#endif
+ /* Align destination by filling in bytes. */
+ if ((t = (long)dst & wmask) != 0) {
+ t = wsize - t;
+ length -= t;
+ do {
+ *dst++ = VAL;
+ } while (--t != 0);
+ }
+
+ /* Fill words. Length was >= 2*words so we know t >= 1 here. */
+ t = length / wsize;
+ do {
+ *(u_long *)(void *)dst = WIDEVAL;
+ dst += wsize;
+ } while (--t != 0);
+
+ /* Mop up trailing bytes, if any. */
+ t = length & wmask;
+ if (t != 0)
+ do {
+ *dst++ = VAL;
+ } while (--t != 0);
+ RETURN;
+}
diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h
index 5dd086e..a625f06 100644
--- a/libc/upstream-netbsd/android/include/netbsd-compat.h
+++ b/libc/upstream-netbsd/android/include/netbsd-compat.h
@@ -43,6 +43,8 @@
#include <stddef.h>
int reallocarr(void*, size_t, size_t);
+#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
+
/* Use appropriate shell depending on process's executable. */
__LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
#define _PATH_BSHELL __bionic_get_shell_path()
diff --git a/libc/upstream-netbsd/lib/libc/include/isc/list.h b/libc/upstream-netbsd/lib/libc/include/isc/list.h
index 46f2e79..76dc097 100644
--- a/libc/upstream-netbsd/lib/libc/include/isc/list.h
+++ b/libc/upstream-netbsd/lib/libc/include/isc/list.h
@@ -1,4 +1,4 @@
-/* $NetBSD: list.h,v 1.5 2009/04/12 17:07:16 christos Exp $ */
+/* $NetBSD: list.h,v 1.6 2022/04/19 20:32:15 rillig Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -23,14 +23,14 @@
#define LIST(type) struct { type *head, *tail; }
#define INIT_LIST(list) \
- do { (list).head = NULL; (list).tail = NULL; } while (/*CONSTCOND*/0)
+ do { (list).head = NULL; (list).tail = NULL; } while (0)
#define LINK(type) struct { type *prev, *next; }
#define INIT_LINK_TYPE(elt, link, type) \
do { \
(elt)->link.prev = (type *)(-1); \
(elt)->link.next = (type *)(-1); \
- } while (/*CONSTCOND*/0)
+ } while (0)
#define INIT_LINK(elt, link) \
INIT_LINK_TYPE(elt, link, void)
#define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1) && \
@@ -50,7 +50,7 @@
(elt)->link.prev = NULL; \
(elt)->link.next = (list).head; \
(list).head = (elt); \
- } while (/*CONSTCOND*/0)
+ } while (0)
#define APPEND(list, elt, link) \
do { \
@@ -62,7 +62,7 @@
(elt)->link.prev = (list).tail; \
(elt)->link.next = NULL; \
(list).tail = (elt); \
- } while (/*CONSTCOND*/0)
+ } while (0)
#define UNLINK_TYPE(list, elt, link, type) \
do { \
@@ -80,7 +80,7 @@
(list).head = (elt)->link.next; \
} \
INIT_LINK_TYPE(elt, link, type); \
- } while (/*CONSTCOND*/0)
+ } while (0)
#define UNLINK(list, elt, link) \
UNLINK_TYPE(list, elt, link, void)
@@ -98,7 +98,7 @@
(elt)->link.prev->link.next = (elt); \
(elt)->link.next = (before); \
} \
- } while (/*CONSTCOND*/0)
+ } while (0)
#define INSERT_AFTER(list, after, elt, link) \
do { \
@@ -111,7 +111,7 @@
(elt)->link.next->link.prev = (elt); \
(elt)->link.prev = (after); \
} \
- } while (/*CONSTCOND*/0)
+ } while (0)
#define ENQUEUE(list, elt, link) APPEND(list, elt, link)
#define DEQUEUE(list, elt, link) UNLINK(list, elt, link)
diff --git a/libc/upstream-netbsd/lib/libc/regex/cclass.h b/libc/upstream-netbsd/lib/libc/regex/cclass.h
deleted file mode 100644
index 3ab2ccb..0000000
--- a/libc/upstream-netbsd/lib/libc/regex/cclass.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $NetBSD: cclass.h,v 1.7 2003/08/07 16:43:19 agc Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cclass.h 8.3 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cclass.h 8.3 (Berkeley) 3/20/94
- */
-
-/* character-class table */
-static const struct cclass {
- const char *name;
- const char *chars;
- const char *multis;
-} cclasses[] = {
- { "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789", "" },
- { "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- "" },
- { "blank", " \t", "" },
- { "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
-\25\26\27\30\31\32\33\34\35\36\37\177", "" },
- { "digit", "0123456789", "" },
- { "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- "" },
- { "lower", "abcdefghijklmnopqrstuvwxyz",
- "" },
- { "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
- "" },
- { "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- "" },
- { "space", "\t\n\v\f\r ", "" },
- { "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- "" },
- { "xdigit", "0123456789ABCDEFabcdef",
- "" },
- { NULL, 0, "" }
-};
diff --git a/libc/upstream-netbsd/lib/libc/regex/cname.h b/libc/upstream-netbsd/lib/libc/regex/cname.h
index 4b9ef39..47e57ac 100644
--- a/libc/upstream-netbsd/lib/libc/regex/cname.h
+++ b/libc/upstream-netbsd/lib/libc/regex/cname.h
@@ -1,6 +1,9 @@
-/* $NetBSD: cname.h,v 1.7 2003/08/07 16:43:19 agc Exp $ */
+/* $NetBSD: cname.h,v 1.8 2021/02/23 22:14:59 christos Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -32,144 +35,108 @@
* SUCH DAMAGE.
*
* @(#)cname.h 8.3 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cname.h 8.3 (Berkeley) 3/20/94
+ * $FreeBSD: head/lib/libc/regex/cname.h 326025 2017-11-20 19:49:47Z pfg $
*/
/* character-name table */
-static const struct cname {
+static struct cname {
const char *name;
char code;
} cnames[] = {
- { "NUL", '\0' },
- { "SOH", '\001' },
- { "STX", '\002' },
- { "ETX", '\003' },
- { "EOT", '\004' },
- { "ENQ", '\005' },
- { "ACK", '\006' },
- { "BEL", '\007' },
- { "alert", '\007' },
- { "BS", '\010' },
- { "backspace", '\b' },
- { "HT", '\011' },
- { "tab", '\t' },
- { "LF", '\012' },
- { "newline", '\n' },
- { "VT", '\013' },
- { "vertical-tab", '\v' },
- { "FF", '\014' },
- { "form-feed", '\f' },
- { "CR", '\015' },
- { "carriage-return", '\r' },
- { "SO", '\016' },
- { "SI", '\017' },
- { "DLE", '\020' },
- { "DC1", '\021' },
- { "DC2", '\022' },
- { "DC3", '\023' },
- { "DC4", '\024' },
- { "NAK", '\025' },
- { "SYN", '\026' },
- { "ETB", '\027' },
- { "CAN", '\030' },
- { "EM", '\031' },
- { "SUB", '\032' },
- { "ESC", '\033' },
- { "IS4", '\034' },
- { "FS", '\034' },
- { "IS3", '\035' },
- { "GS", '\035' },
- { "IS2", '\036' },
- { "RS", '\036' },
- { "IS1", '\037' },
- { "US", '\037' },
- { "space", ' ' },
- { "exclamation-mark", '!' },
- { "quotation-mark", '"' },
- { "number-sign", '#' },
- { "dollar-sign", '$' },
- { "percent-sign", '%' },
- { "ampersand", '&' },
- { "apostrophe", '\'' },
- { "left-parenthesis", '(' },
- { "right-parenthesis", ')' },
- { "asterisk", '*' },
- { "plus-sign", '+' },
- { "comma", ',' },
- { "hyphen", '-' },
- { "hyphen-minus", '-' },
- { "period", '.' },
- { "full-stop", '.' },
- { "slash", '/' },
- { "solidus", '/' },
- { "zero", '0' },
- { "one", '1' },
- { "two", '2' },
- { "three", '3' },
- { "four", '4' },
- { "five", '5' },
- { "six", '6' },
- { "seven", '7' },
- { "eight", '8' },
- { "nine", '9' },
- { "colon", ':' },
- { "semicolon", ';' },
- { "less-than-sign", '<' },
- { "equals-sign", '=' },
- { "greater-than-sign", '>' },
- { "question-mark", '?' },
- { "commercial-at", '@' },
- { "left-square-bracket", '[' },
- { "backslash", '\\' },
- { "reverse-solidus", '\\' },
- { "right-square-bracket", ']' },
- { "circumflex", '^' },
- { "circumflex-accent", '^' },
- { "underscore", '_' },
- { "low-line", '_' },
- { "grave-accent", '`' },
- { "left-brace", '{' },
- { "left-curly-bracket", '{' },
- { "vertical-line", '|' },
- { "right-brace", '}' },
- { "right-curly-bracket", '}' },
- { "tilde", '~' },
- { "DEL", '\177' },
- { NULL, 0 },
+ {"NUL", '\0'},
+ {"SOH", '\001'},
+ {"STX", '\002'},
+ {"ETX", '\003'},
+ {"EOT", '\004'},
+ {"ENQ", '\005'},
+ {"ACK", '\006'},
+ {"BEL", '\007'},
+ {"alert", '\007'},
+ {"BS", '\010'},
+ {"backspace", '\b'},
+ {"HT", '\011'},
+ {"tab", '\t'},
+ {"LF", '\012'},
+ {"newline", '\n'},
+ {"VT", '\013'},
+ {"vertical-tab", '\v'},
+ {"FF", '\014'},
+ {"form-feed", '\f'},
+ {"CR", '\015'},
+ {"carriage-return", '\r'},
+ {"SO", '\016'},
+ {"SI", '\017'},
+ {"DLE", '\020'},
+ {"DC1", '\021'},
+ {"DC2", '\022'},
+ {"DC3", '\023'},
+ {"DC4", '\024'},
+ {"NAK", '\025'},
+ {"SYN", '\026'},
+ {"ETB", '\027'},
+ {"CAN", '\030'},
+ {"EM", '\031'},
+ {"SUB", '\032'},
+ {"ESC", '\033'},
+ {"IS4", '\034'},
+ {"FS", '\034'},
+ {"IS3", '\035'},
+ {"GS", '\035'},
+ {"IS2", '\036'},
+ {"RS", '\036'},
+ {"IS1", '\037'},
+ {"US", '\037'},
+ {"space", ' '},
+ {"exclamation-mark", '!'},
+ {"quotation-mark", '"'},
+ {"number-sign", '#'},
+ {"dollar-sign", '$'},
+ {"percent-sign", '%'},
+ {"ampersand", '&'},
+ {"apostrophe", '\''},
+ {"left-parenthesis", '('},
+ {"right-parenthesis", ')'},
+ {"asterisk", '*'},
+ {"plus-sign", '+'},
+ {"comma", ','},
+ {"hyphen", '-'},
+ {"hyphen-minus", '-'},
+ {"period", '.'},
+ {"full-stop", '.'},
+ {"slash", '/'},
+ {"solidus", '/'},
+ {"zero", '0'},
+ {"one", '1'},
+ {"two", '2'},
+ {"three", '3'},
+ {"four", '4'},
+ {"five", '5'},
+ {"six", '6'},
+ {"seven", '7'},
+ {"eight", '8'},
+ {"nine", '9'},
+ {"colon", ':'},
+ {"semicolon", ';'},
+ {"less-than-sign", '<'},
+ {"equals-sign", '='},
+ {"greater-than-sign", '>'},
+ {"question-mark", '?'},
+ {"commercial-at", '@'},
+ {"left-square-bracket", '['},
+ {"backslash", '\\'},
+ {"reverse-solidus", '\\'},
+ {"right-square-bracket",']'},
+ {"circumflex", '^'},
+ {"circumflex-accent", '^'},
+ {"underscore", '_'},
+ {"low-line", '_'},
+ {"grave-accent", '`'},
+ {"left-brace", '{'},
+ {"left-curly-bracket", '{'},
+ {"vertical-line", '|'},
+ {"right-brace", '}'},
+ {"right-curly-bracket", '}'},
+ {"tilde", '~'},
+ {"DEL", '\177'},
+ {NULL, 0}
};
diff --git a/libc/upstream-netbsd/lib/libc/regex/engine.c b/libc/upstream-netbsd/lib/libc/regex/engine.c
index 2a800d4..ca8b24d 100644
--- a/libc/upstream-netbsd/lib/libc/regex/engine.c
+++ b/libc/upstream-netbsd/lib/libc/regex/engine.c
@@ -1,6 +1,9 @@
-/* $NetBSD: engine.c,v 1.24 2012/03/13 21:13:42 christos Exp $ */
+/* $NetBSD: engine.c,v 1.29 2021/02/25 21:47:46 christos Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -34,42 +37,13 @@
* @(#)engine.c 8.5 (Berkeley) 3/20/94
*/
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)engine.c 8.5 (Berkeley) 3/20/94
- */
+#include <sys/cdefs.h>
+#ifdef __FBSDID
+__FBSDID("$FreeBSD: head/lib/libc/regex/engine.c 368358 2020-12-05 03:16:05Z kevans $");
+#endif
+__RCSID("$NetBSD: engine.c,v 1.29 2021/02/25 21:47:46 christos Exp $");
+
+#include <stdbool.h>
/*
* The matching engine and friends. This file is #included by regexec.c
@@ -79,28 +53,37 @@
*/
#ifdef SNAMES
+#define stepback sstepback
#define matcher smatcher
-#define fast sfast
-#define slow sslow
+#define walk swalk
#define dissect sdissect
#define backref sbackref
#define step sstep
#define print sprint
#define at sat
#define match smat
-#define nope snope
#endif
#ifdef LNAMES
+#define stepback lstepback
#define matcher lmatcher
-#define fast lfast
-#define slow lslow
+#define walk lwalk
#define dissect ldissect
#define backref lbackref
#define step lstep
#define print lprint
#define at lat
#define match lmat
-#define nope lnope
+#endif
+#ifdef MNAMES
+#define stepback mstepback
+#define matcher mmatcher
+#define walk mwalk
+#define dissect mdissect
+#define backref mbackref
+#define step mstep
+#define print mprint
+#define at mat
+#define match mmat
#endif
/* another structure passed up and down to avoid zillions of parameters */
@@ -118,6 +101,7 @@
states fresh; /* states for a fresh start */
states tmp; /* temporary */
states empty; /* empty set of states */
+ mbstate_t mbs; /* multibyte conversion state */
};
/* ========= begin header generated by ./mkh ========= */
@@ -128,27 +112,31 @@
/* === engine.c === */
static int matcher(struct re_guts *g, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev);
-static const char *fast(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static const char *slow(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static states step(struct re_guts *g, sopno start, sopno stop, states bef, int ch, states aft);
-#define BOL (OUT+1)
-#define EOL (BOL+1)
-#define BOLEOL (BOL+2)
-#define NOTHING (BOL+3)
-#define BOW (BOL+4)
-#define EOW (BOL+5)
-#define CODEMAX (BOL+5) /* highest code used */
-#define NONCHAR(c) ((c) > CHAR_MAX)
-#define NNONCHAR (CODEMAX-CHAR_MAX)
+static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev, int);
+static const char *walk(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, bool fast);
+static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft, int sflags);
+#define MAX_RECURSION 100
+#define BOL (OUT-1)
+#define EOL (BOL-1)
+#define BOLEOL (BOL-2)
+#define NOTHING (BOL-3)
+#define BOW (BOL-4)
+#define EOW (BOL-5)
+#define BADCHAR (BOL-6)
+#define NWBND (BOL-7)
+#define NONCHAR(c) ((c) <= OUT)
+/* sflags */
+#define SBOS 0x0001
+#define SEOS 0x0002
+
#ifdef REDEBUG
-static void print(struct match *m, char *caption, states st, int ch, FILE *d);
+static void print(struct match *m, const char *caption, states st, int ch, FILE *d);
#endif
#ifdef REDEBUG
-static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
+static void at(struct match *m, const char *title, const char *start, const char *stop, sopno startst, sopno stopst);
#endif
#ifdef REDEBUG
-static char *pchar(int ch);
+static const char *pchar(int ch);
#endif
#ifdef __cplusplus
@@ -160,7 +148,6 @@
#define SP(t, s, c) print(m, t, s, c, stdout)
#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
#define NOTE(str) { if (m->eflags®_TRACE) printf("=%s\n", (str)); }
-static int nope = 0;
#else
#define SP(t, s, c) /* nothing */
#define AT(t, p1, p2, s1, s2) /* nothing */
@@ -168,27 +155,70 @@
#endif
/*
+ * Given a multibyte string pointed to by start, step back nchar characters
+ * from current position pointed to by cur.
+ */
+static const char *
+stepback(const char *start, const char *cur, int nchar)
+{
+#ifdef NLS
+ const char *ret;
+ size_t wc, mbc;
+ mbstate_t mbs;
+ size_t clen;
+
+ if (MB_CUR_MAX == 1)
+ goto out;
+
+ ret = cur;
+ for (wc = nchar; wc > 0; wc--) {
+ for (mbc = 1; mbc <= MB_CUR_MAX; mbc++) {
+ if ((ret - mbc) < start)
+ return (NULL);
+ memset(&mbs, 0, sizeof(mbs));
+ clen = mbrtowc(NULL, ret - mbc, mbc, &mbs);
+ if (clen != (size_t)-1 && clen != (size_t)-2)
+ break;
+ }
+ if (mbc > MB_CUR_MAX)
+ return (NULL);
+ ret -= mbc;
+ }
+
+ return (ret);
+out:
+#endif
+ return (cur - nchar) > start ? cur - nchar : NULL;
+}
+
+/*
- matcher - the actual matching engine
- == static int matcher(struct re_guts *g, char *string, \
+ == static int matcher(struct re_guts *g, const char *string, \
== size_t nmatch, regmatch_t pmatch[], int eflags);
*/
static int /* 0 success, REG_NOMATCH failure */
-matcher(
- struct re_guts *g,
- const char *string,
- size_t nmatch,
- regmatch_t pmatch[],
- int eflags)
+matcher(struct re_guts *g,
+ const char *string,
+ size_t nmatch,
+ regmatch_t pmatch[],
+ int eflags)
{
const char *endp;
size_t i;
struct match mv;
struct match *m = &mv;
- const char *dp;
+ const char *dp = NULL;
const sopno gf = g->firststate+1; /* +1 for OEND */
const sopno gl = g->laststate;
const char *start;
const char *stop;
+ /* Boyer-Moore algorithms variables */
+ const char *pp;
+ size_t cj, mj;
+ const char *mustfirst;
+ const char *mustlast;
+ size_t *matchjump;
+ size_t *charjump;
int error = 0;
_DIAGASSERT(g != NULL);
@@ -211,12 +241,46 @@
/* prescreening; this does wonders for this rather slow code */
if (g->must != NULL) {
- for (dp = start; dp < stop; dp++)
- if (*dp == g->must[0] && (size_t)(stop - dp) >= g->mlen &&
- memcmp(dp, g->must, g->mlen) == 0)
- break;
- if (dp == stop) /* we didn't find g->must */
- return(REG_NOMATCH);
+ if (g->charjump != NULL && g->matchjump != NULL) {
+ mustfirst = g->must;
+ mustlast = g->must + g->mlen - 1;
+ charjump = g->charjump;
+ matchjump = g->matchjump;
+ pp = mustlast;
+ for (dp = start+g->mlen-1; dp < stop;) {
+ /* Fast skip non-matches */
+ while (dp < stop && charjump[(int)*dp])
+ dp += charjump[(int)*dp];
+
+ if (dp >= stop)
+ break;
+
+ /* Greedy matcher */
+ /* We depend on not being used for
+ * for strings of length 1
+ */
+ while (*--dp == *--pp && pp != mustfirst);
+
+ if (*dp == *pp)
+ break;
+
+ /* Jump to next possible match */
+ mj = matchjump[pp - mustfirst];
+ cj = charjump[(int)*dp];
+ dp += (cj < mj ? mj : cj);
+ pp = mustlast;
+ }
+ if (pp != mustfirst)
+ return(REG_NOMATCH);
+ } else {
+ for (dp = start; dp < stop; dp++)
+ if (*dp == g->must[0] &&
+ (size_t)(stop - dp) >= g->mlen &&
+ memcmp(dp, g->must, (size_t)g->mlen) == 0)
+ break;
+ if (dp == stop) /* we didn't find g->must */
+ return(REG_NOMATCH);
+ }
}
/* match struct setup */
@@ -233,10 +297,22 @@
SETUP(m->tmp);
SETUP(m->empty);
CLEAR(m->empty);
+ ZAPSTATE(&m->mbs);
+
+ /* Adjust start according to moffset, to speed things up */
+ if (dp != NULL && g->moffset > -1) {
+ const char *nstart;
+
+ nstart = stepback(start, dp, g->moffset);
+ if (nstart != NULL)
+ start = nstart;
+ }
+
+ SP("mloop", m->st, *start);
/* this loop does only one repetition except for backrefs */
for (;;) {
- endp = fast(m, start, stop, gf, gl);
+ endp = walk(m, start, stop, gf, gl, true);
if (endp == NULL) { /* a miss */
error = REG_NOMATCH;
goto done;
@@ -248,11 +324,12 @@
assert(m->coldp != NULL);
for (;;) {
NOTE("finding start");
- endp = slow(m, m->coldp, stop, gf, gl);
+ endp = walk(m, m->coldp, stop, gf, gl, false);
if (endp != NULL)
break;
assert(m->coldp < m->endp);
- m->coldp++;
+ m->coldp += XMBRTOWC(NULL, m->coldp,
+ (size_t)(m->endp - m->coldp), &m->mbs, 0);
}
if (nmatch == 1 && !g->backrefs)
break; /* no further info needed */
@@ -266,20 +343,20 @@
goto done;
}
for (i = 1; i <= m->g->nsub; i++)
- m->pmatch[i].rm_so = m->pmatch[i].rm_eo = (regoff_t)-1;
+ m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
if (!g->backrefs && !(m->eflags®_BACKR)) {
NOTE("dissecting");
dp = dissect(m, m->coldp, endp, gf, gl);
} else {
if (g->nplus > 0 && m->lastpos == NULL)
m->lastpos = malloc((g->nplus+1) *
- sizeof(const char *));
+ sizeof(const char *));
if (g->nplus > 0 && m->lastpos == NULL) {
error = REG_ESPACE;
goto done;
}
NOTE("backref dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
+ dp = backref(m, m->coldp, endp, gf, gl, (sopno)0, 0);
}
if (dp != NULL)
break;
@@ -291,7 +368,7 @@
if (dp != NULL || endp <= m->coldp)
break; /* defeat */
NOTE("backoff");
- endp = slow(m, m->coldp, endp-1, gf, gl);
+ endp = walk(m, m->coldp, endp-1, gf, gl, false);
if (endp == NULL)
break; /* defeat */
/* try it on a shorter possibility */
@@ -302,7 +379,7 @@
}
#endif
NOTE("backoff dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
+ dp = backref(m, m->coldp, endp, gf, gl, (sopno)0, 0);
}
assert(dp == NULL || dp == endp);
if (dp != NULL) /* found a shorter one */
@@ -310,7 +387,9 @@
/* despite initial appearances, there is no match here */
NOTE("false alarm");
- start = m->coldp + 1; /* recycle starting later */
+ /* recycle starting later */
+ start = m->coldp + XMBRTOWC(NULL, m->coldp,
+ (size_t)(stop - m->coldp), &m->mbs, 0);
assert(start <= stop);
}
@@ -337,7 +416,7 @@
m->pmatch = NULL;
}
if (m->lastpos != NULL) {
- free(m->lastpos);
+ free(__UNCONST(m->lastpos));
m->lastpos = NULL;
}
STATETEARDOWN(m);
@@ -349,29 +428,27 @@
== static const char *dissect(struct match *m, const char *start, \
== const char *stop, sopno startst, sopno stopst);
*/
-static const char * /* == stop (success) always */
+static const char * /* == stop (success) always */
dissect(
- struct match *m,
- const char *start,
- const char *stop,
- sopno startst,
- sopno stopst)
+ struct match *m,
+ const char *start,
+ const char *stop,
+ sopno startst,
+ sopno stopst)
{
int i;
- sopno ss; /* start sop of current subRE */
- sopno es; /* end sop of current subRE */
- const char *sp; /* start of string matched by it */
- const char *stp; /* string matched by it cannot pass here */
- const char *rest; /* start of rest of string */
- const char *tail; /* string unmatched by rest of RE */
- sopno ssub; /* start sop of subsubRE */
- sopno esub; /* end sop of subsubRE */
- const char *ssp; /* start of string matched by subsubRE */
- const char *sep; /* end of string matched by subsubRE */
- const char *oldssp; /* previous ssp */
-#ifndef NDEBUG
- const char *dp;
-#endif
+ sopno ss; /* start sop of current subRE */
+ sopno es; /* end sop of current subRE */
+ const char *sp; /* start of string matched by it */
+ const char *stp; /* string matched by it cannot pass here */
+ const char *rest; /* start of rest of string */
+ const char *tail; /* string unmatched by rest of RE */
+ sopno ssub; /* start sop of subsubRE */
+ sopno esub; /* end sop of subsubRE */
+ const char *ssp; /* start of string matched by subsubRE */
+ const char *sep; /* end of string matched by subsubRE */
+ const char *oldssp; /* previous ssp */
+ const char *dp __unused;
_DIAGASSERT(m != NULL);
_DIAGASSERT(start != NULL);
@@ -400,16 +477,22 @@
assert(nope);
break;
case OCHAR:
- sp++;
+ sp += XMBRTOWC(NULL, sp, (size_t)(stop - start),
+ &m->mbs, 0);
break;
case OBOL:
case OEOL:
case OBOW:
case OEOW:
+ case OBOS:
+ case OEOS:
+ case OWBND:
+ case ONWBND:
break;
case OANY:
case OANYOF:
- sp++;
+ sp += XMBRTOWC(NULL, sp, (size_t)(stop - start),
+ &m->mbs, 0);
break;
case OBACK_:
case O_BACK:
@@ -420,10 +503,10 @@
stp = stop;
for (;;) {
/* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
+ rest = walk(m, sp, stp, ss, es, false);
assert(rest != NULL); /* it did match */
/* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
+ tail = walk(m, rest, stop, es, stopst, false);
if (tail == stop)
break; /* yes! */
/* no -- try a shorter match for this one */
@@ -433,13 +516,8 @@
ssub = ss + 1;
esub = es - 1;
/* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL) {
-#ifdef NDEBUG
- (void)
-#else
- dp =
-#endif
- dissect(m, sp, rest, ssub, esub);
+ if (walk(m, sp, rest, ssub, esub, false) != NULL) {
+ dp = dissect(m, sp, rest, ssub, esub);
assert(dp == rest);
} else /* no */
assert(sp == rest);
@@ -449,10 +527,10 @@
stp = stop;
for (;;) {
/* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
+ rest = walk(m, sp, stp, ss, es, false);
assert(rest != NULL); /* it did match */
/* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
+ tail = walk(m, rest, stop, es, stopst, false);
if (tail == stop)
break; /* yes! */
/* no -- try a shorter match for this one */
@@ -464,7 +542,7 @@
ssp = sp;
oldssp = ssp;
for (;;) { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
+ sep = walk(m, ssp, rest, ssub, esub, false);
if (sep == NULL || sep == ssp)
break; /* failed or matched null */
oldssp = ssp; /* on to next try */
@@ -476,13 +554,8 @@
ssp = oldssp;
}
assert(sep == rest); /* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
-#ifdef NDEBUG
- (void)
-#else
- dp =
-#endif
- dissect(m, ssp, sep, ssub, esub);
+ assert(walk(m, ssp, sep, ssub, esub, false) == rest);
+ dp = dissect(m, ssp, sep, ssub, esub);
assert(dp == sep);
sp = rest;
break;
@@ -490,10 +563,10 @@
stp = stop;
for (;;) {
/* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
+ rest = walk(m, sp, stp, ss, es, false);
assert(rest != NULL); /* it did match */
/* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
+ tail = walk(m, rest, stop, es, stopst, false);
if (tail == stop)
break; /* yes! */
/* no -- try a shorter match for this one */
@@ -504,7 +577,7 @@
esub = ss + OPND(m->g->strip[ss]) - 1;
assert(OP(m->g->strip[esub]) == OOR1);
for (;;) { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
+ if (walk(m, sp, rest, ssub, esub, false) == rest)
break; /* it matched all of it */
/* that one missed, try next one */
assert(OP(m->g->strip[esub]) == OOR1);
@@ -517,12 +590,7 @@
else
assert(OP(m->g->strip[esub]) == O_CH);
}
-#ifdef NDEBUG
- (void)
-#else
- dp =
-#endif
- dissect(m, sp, rest, ssub, esub);
+ dp = dissect(m, sp, rest, ssub, esub);
assert(dp == rest);
sp = rest;
break;
@@ -553,6 +621,17 @@
return(sp);
}
+#define ISBOW(m, sp) \
+ (sp < m->endp && ISWORD(*sp) && \
+ ((sp == m->beginp && !(m->eflags®_NOTBOL)) || \
+ (sp > m->offp && !ISWORD(*(sp-1)))))
+#define ISEOW(m, sp) \
+ (((sp == m->endp && !(m->eflags®_NOTEOL)) || \
+ (sp < m->endp && *sp == '\n' && \
+ (m->g->cflags®_NEWLINE)) || \
+ (sp < m->endp && !ISWORD(*sp)) ) && \
+ (sp > m->beginp && ISWORD(*(sp-1)))) \
+
/*
- backref - figure out what matched what, figuring in back references
== static const char *backref(struct match *m, const char *start, \
@@ -560,25 +639,27 @@
*/
static const char * /* == stop (success) or NULL (failure) */
backref(
- struct match *m,
- const char *start,
- const char *stop,
- sopno startst,
- sopno stopst,
- sopno lev) /* PLUS nesting level */
+ struct match *m,
+ const char *start,
+ const char *stop,
+ sopno startst,
+ sopno stopst,
+ sopno lev, /* PLUS nesting level */
+ int rec)
{
int i;
- sopno ss; /* start sop of current subRE */
- const char *sp; /* start of string matched by it */
- sopno ssub; /* start sop of subsubRE */
- sopno esub; /* end sop of subsubRE */
- const char *ssp; /* start of string matched by subsubRE */
+ sopno ss; /* start sop of current subRE */
+ const char *sp; /* start of string matched by it */
+ sopno ssub; /* start sop of subsubRE */
+ sopno esub; /* end sop of subsubRE */
+ const char *ssp; /* start of string matched by subsubRE */
const char *dp;
size_t len;
int hard;
sop s;
regoff_t offsave;
cset *cs;
+ wint_t wc;
_DIAGASSERT(m != NULL);
_DIAGASSERT(start != NULL);
@@ -592,23 +673,46 @@
for (ss = startst; !hard && ss < stopst; ss++)
switch (OP(s = m->g->strip[ss])) {
case OCHAR:
- if (sp == stop || *sp++ != (char)OPND(s))
+ if (sp == stop)
+ return(NULL);
+ sp += XMBRTOWC(&wc, sp, (size_t)(stop - sp),
+ &m->mbs, BADCHAR);
+ if (wc != (wint_t)OPND(s))
return(NULL);
break;
case OANY:
if (sp == stop)
return(NULL);
- sp++;
+ sp += XMBRTOWC(&wc, sp, (size_t)(stop - sp),
+ &m->mbs, BADCHAR);
+ if (wc == BADCHAR)
+ return (NULL);
break;
case OANYOF:
+ if (sp == stop)
+ return (NULL);
cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
+ sp += XMBRTOWC(&wc, sp, (size_t)(stop - sp),
+ &m->mbs, BADCHAR);
+ if (wc == BADCHAR || !CHIN(cs, wc))
+ return(NULL);
+ break;
+ case OBOS:
+ if (sp == m->beginp && (m->eflags & REG_NOTBOL) == 0)
+ { /* yes */ }
+ else
+ return(NULL);
+ break;
+ case OEOS:
+ if (sp == m->endp && (m->eflags & REG_NOTEOL) == 0)
+ { /* yes */ }
+ else
return(NULL);
break;
case OBOL:
- if ( (sp == m->beginp && !(m->eflags®_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags®_NEWLINE)) )
+ if ((sp == m->beginp && !(m->eflags®_NOTBOL)) ||
+ (sp > m->offp && sp < m->endp &&
+ *(sp-1) == '\n' && (m->g->cflags®_NEWLINE)))
{ /* yes */ }
else
return(NULL);
@@ -621,23 +725,29 @@
else
return(NULL);
break;
+ case OWBND:
+ if (ISBOW(m, sp) || ISEOW(m, sp))
+ { /* yes */ }
+ else
+ return(NULL);
+ break;
+ case ONWBND:
+ if (((sp == m->beginp) && !ISWORD(*sp)) ||
+ (sp == m->endp && !ISWORD(*(sp - 1))))
+ { /* yes, beginning/end of subject */ }
+ else if (ISWORD(*(sp - 1)) == ISWORD(*sp))
+ { /* yes, beginning/end of subject */ }
+ else
+ return(NULL);
+ break;
case OBOW:
- if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags®_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
+ if (ISBOW(m, sp))
{ /* yes */ }
else
return(NULL);
break;
case OEOW:
- if (( (sp == m->endp && !(m->eflags®_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags®_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp)) ) &&
- (sp > m->beginp && ISWORD(*(sp-1))) )
+ if (ISEOW(m, sp))
{ /* yes */ }
else
return(NULL);
@@ -671,50 +781,47 @@
case OBACK_: /* the vilest depths */
i = OPND(s);
assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == (regoff_t)-1)
+ if (m->pmatch[i].rm_eo == -1)
return(NULL);
- assert(m->pmatch[i].rm_so != (regoff_t)-1);
- len = (size_t)(m->pmatch[i].rm_eo - m->pmatch[i].rm_so);
- if (len == 0)
+ assert(m->pmatch[i].rm_so != -1);
+ len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
+ if (len == 0 && rec++ > MAX_RECURSION)
return(NULL);
assert(stop - m->beginp >= len);
if (sp > stop - len)
return(NULL); /* not enough left to match */
- ssp = m->offp + (size_t)m->pmatch[i].rm_so;
+ ssp = m->offp + m->pmatch[i].rm_so;
if (memcmp(sp, ssp, len) != 0)
return(NULL);
while (m->g->strip[ss] != SOP(O_BACK, i))
ss++;
- return(backref(m, sp+len, stop, ss+1, stopst, lev));
-
+ return(backref(m, sp+len, stop, ss+1, stopst, lev, rec));
case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss+1, stopst, lev);
+ dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
if (dp != NULL)
return(dp); /* not */
- return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
-
+ return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec));
case OPLUS_:
assert(m->lastpos != NULL);
assert(lev+1 <= m->g->nplus);
m->lastpos[lev+1] = sp;
- return(backref(m, sp, stop, ss+1, stopst, lev+1));
-
+ return(backref(m, sp, stop, ss+1, stopst, lev+1, rec));
case O_PLUS:
if (sp == m->lastpos[lev]) /* last pass matched null */
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
+ return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
/* try another pass */
m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
+ dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev, rec);
if (dp == NULL)
- dp = backref(m, sp, stop, ss+1, stopst, lev-1);
- return(dp);
-
+ return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
+ else
+ return(dp);
case OCH_: /* find the right one, if any */
ssub = ss + 1;
esub = ss + OPND(s) - 1;
assert(OP(m->g->strip[esub]) == OOR1);
for (;;) { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
+ dp = backref(m, sp, stop, ssub, esub, lev, rec);
if (dp != NULL)
return(dp);
/* that one missed, try next one */
@@ -729,29 +836,28 @@
else
assert(OP(m->g->strip[esub]) == O_CH);
}
-
+ /* NOTREACHED */
+ break;
case OLPAREN: /* must undo assignment if rest fails */
i = OPND(s);
assert(0 < i && i <= m->g->nsub);
offsave = m->pmatch[i].rm_so;
m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
+ dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
if (dp != NULL)
return(dp);
m->pmatch[i].rm_so = offsave;
return(NULL);
-
case ORPAREN: /* must undo assignment if rest fails */
i = OPND(s);
assert(0 < i && i <= m->g->nsub);
offsave = m->pmatch[i].rm_eo;
m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
+ dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
if (dp != NULL)
return(dp);
m->pmatch[i].rm_eo = offsave;
return(NULL);
-
default: /* uh oh */
assert(nope);
break;
@@ -760,141 +866,66 @@
/* "can't happen" */
assert(nope);
/* NOTREACHED */
- return NULL;
+ return "shut up gcc";
}
/*
- - fast - step through the string at top speed
- == static const char *fast(struct match *m, const char *start, \
- == const char *stop, sopno startst, sopno stopst);
+ - walk - step through the string either quickly or slowly
+ == static const char *walk(struct match *m, const char *start, \
+ == const char *stop, sopno startst, sopno stopst, bool fast);
*/
-static const char * /* where tentative match ended, or NULL */
-fast(
- struct match *m,
- const char *start,
- const char *stop,
- sopno startst,
- sopno stopst)
+static const char * /* where it ended, or NULL */
+walk(struct match *m, const char *start, const char *stop, sopno startst,
+ sopno stopst, bool fast)
{
states st = m->st;
states fresh = m->fresh;
- states tmp = m->tmp;
- const char *p = start;
- int c = (start == m->beginp) ? OUT : *(start-1);
- int lastc; /* previous c */
- int flagch;
- size_t i;
- const char *coldp; /* last p after which no match was underway */
-
- _DIAGASSERT(m != NULL);
- _DIAGASSERT(start != NULL);
- _DIAGASSERT(stop != NULL);
-
- CLEAR(st);
- SET1(st, startst);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- ASSIGN(fresh, st);
- SP("start", st, *p);
- coldp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
- if (EQ(st, fresh))
- coldp = p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags®_NEWLINE) ||
- (lastc == OUT && !(m->eflags®_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags®_NEWLINE) ||
- (c == OUT && !(m->eflags®_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, fresh);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("aft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- assert(coldp != NULL);
- m->coldp = coldp;
- if (ISSET(st, stopst))
- return(p+1);
- else
- return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static const char *slow(struct match *m, const char *start, \
- == const char *stop, sopno startst, sopno stopst);
- */
-static const char * /* where it ended */
-slow(
- struct match *m,
- const char *start,
- const char *stop,
- sopno startst,
- sopno stopst)
-{
- states st = m->st;
states empty = m->empty;
states tmp = m->tmp;
const char *p = start;
- int c = (start == m->beginp) ? OUT : *(start-1);
- int lastc; /* previous c */
- int flagch;
- size_t i;
+ wint_t c;
+ wint_t lastc; /* previous c */
+ wint_t flagch;
+ int sflags;
const char *matchp; /* last p at which a match ended */
+ size_t i, clen;
_DIAGASSERT(m != NULL);
_DIAGASSERT(start != NULL);
_DIAGASSERT(stop != NULL);
- AT("slow", start, stop, startst, stopst);
+ sflags = 0;
+ AT("walk", start, stop, startst, stopst);
CLEAR(st);
SET1(st, startst);
SP("sstart", st, *p);
- st = step(m->g, startst, stopst, st, NOTHING, st);
+ st = step(m->g, startst, stopst, st, NOTHING, st, sflags);
+ if (fast)
+ ASSIGN(fresh, st);
matchp = NULL;
+ if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL)))
+ c = OUT;
+ else {
+ /*
+ * XXX Wrong if the previous character was multi-byte.
+ * Newline never is (in encodings supported by FreeBSD),
+ * so this only breaks the ISWORD tests below.
+ */
+ c = (uch)*(start - 1);
+ }
for (;;) {
/* next character */
lastc = c;
- c = (p == m->endp) ? OUT : *p;
+ sflags = 0;
+ if (p == m->endp) {
+ c = OUT;
+ clen = 0;
+ } else
+ clen = XMBRTOWC(&c, p, (size_t)(m->endp - p),
+ &m->mbs, BADCHAR);
+
+ if (fast && EQ(st, fresh))
+ matchp = p;
/* is there an EOL and/or BOL between lastc and c? */
flagch = '\0';
@@ -909,9 +940,20 @@
flagch = (flagch == BOL) ? BOLEOL : EOL;
i += m->g->neol;
}
+ if (lastc == OUT && (m->eflags & REG_NOTBOL) == 0) {
+ sflags |= SBOS;
+ /* Step one more for BOS. */
+ i++;
+ }
+ if (c == OUT && (m->eflags & REG_NOTEOL) == 0) {
+ sflags |= SEOS;
+ /* Step one more for EOS. */
+ i++;
+ }
if (i != 0) {
for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
+ st = step(m->g, startst, stopst, st, flagch, st,
+ sflags);
SP("sboleol", st, c);
}
@@ -925,52 +967,78 @@
flagch = EOW;
}
if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
+ st = step(m->g, startst, stopst, st, flagch, st, sflags);
SP("sboweow", st, c);
}
+ if (lastc != OUT && c != OUT &&
+ ISWORD(lastc) == ISWORD(c)) {
+ flagch = NWBND;
+ } else if ((lastc == OUT && !ISWORD(c)) ||
+ (c == OUT && !ISWORD(lastc))) {
+ flagch = NWBND;
+ }
+ if (flagch == NWBND) {
+ st = step(m->g, startst, stopst, st, flagch, st, sflags);
+ SP("snwbnd", st, c);
+ }
/* are we done? */
- if (ISSET(st, stopst))
- matchp = p;
- if (EQ(st, empty) || p == stop)
+ if (ISSET(st, stopst)) {
+ if (fast)
+ break;
+ else
+ matchp = p;
+ }
+ if (EQ(st, empty) || p == stop || clen > (size_t)(stop - p))
break; /* NOTE BREAK OUT */
/* no, we must deal with this character */
ASSIGN(tmp, st);
- ASSIGN(st, empty);
+ if (fast)
+ ASSIGN(st, fresh);
+ else
+ ASSIGN(st, empty);
assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
+ st = step(m->g, startst, stopst, tmp, c, st, sflags);
SP("saft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
+ assert(EQ(step(m->g, startst, stopst, st, NOTHING, st, sflags),
+ st));
+ p += clen;
}
- return(matchp);
+ if (fast) {
+ assert(matchp != NULL);
+ m->coldp = matchp;
+ if (ISSET(st, stopst))
+ return (p + XMBRTOWC(NULL, p, (size_t)(stop - p),
+ &m->mbs, 0));
+ else
+ return (NULL);
+ } else
+ return (matchp);
}
-
/*
- step - map set of states reachable before char to set reachable after
== static states step(struct re_guts *g, sopno start, sopno stop, \
== states bef, int ch, states aft);
- == #define BOL (OUT+1)
- == #define EOL (BOL+1)
- == #define BOLEOL (BOL+2)
- == #define NOTHING (BOL+3)
- == #define BOW (BOL+4)
- == #define EOW (BOL+5)
- == #define CODEMAX (BOL+5) // highest code used
- == #define NONCHAR(c) ((c) > CHAR_MAX)
- == #define NNONCHAR (CODEMAX-CHAR_MAX)
+ == #define BOL (OUT-1)
+ == #define EOL (BOL-1)
+ == #define BOLEOL (BOL-2)
+ == #define NOTHING (BOL-3)
+ == #define BOW (BOL-4)
+ == #define EOW (BOL-5)
+ == #define BADCHAR (BOL-6)
+ == #define NONCHAR(c) ((c) <= OUT)
*/
static states
-step(
- struct re_guts *g,
- sopno start, /* start state within strip */
- sopno stop, /* state after stop state within strip */
- states bef, /* states reachable before */
- int ch, /* character or NONCHAR code */
- states aft) /* states already known reachable after */
+step(struct re_guts *g,
+ sopno start, /* start state within strip */
+ sopno stop, /* state after stop state within strip */
+ states bef, /* states reachable before */
+ wint_t ch, /* character or NONCHAR code */
+ states aft, /* states already known reachable after */
+ int sflags) /* state flags */
{
cset *cs;
sop s;
@@ -989,8 +1057,16 @@
break;
case OCHAR:
/* only characters can match */
- assert(!NONCHAR(ch) || ch != (char)OPND(s));
- if (ch == (char)OPND(s))
+ assert(!NONCHAR(ch) || ch != OPND(s));
+ if (ch == (wint_t)OPND(s))
+ FWD(aft, bef, 1);
+ break;
+ case OBOS:
+ if ((ch == BOL || ch == BOLEOL) && (sflags & SBOS) != 0)
+ FWD(aft, bef, 1);
+ break;
+ case OEOS:
+ if ((ch == EOL || ch == BOLEOL) && (sflags & SEOS) != 0)
FWD(aft, bef, 1);
break;
case OBOL:
@@ -1009,6 +1085,14 @@
if (ch == EOW)
FWD(aft, bef, 1);
break;
+ case OWBND:
+ if (ch == BOW || ch == EOW)
+ FWD(aft, bef, 1);
+ break;
+ case ONWBND:
+ if (ch == NWBND)
+ FWD(aft, aft, 1);
+ break;
case OANY:
if (!NONCHAR(ch))
FWD(aft, bef, 1);
@@ -1054,10 +1138,10 @@
case OOR1: /* done a branch, find the O_CH */
if (ISSTATEIN(aft, here)) {
for (look = 1;
- OP(s = g->strip[pc+look]) != O_CH;
- look += OPND(s))
+ OP(s = g->strip[pc+look]) != O_CH;
+ look += OPND(s))
assert(OP(s) == OOR2);
- FWD(aft, aft, look);
+ FWD(aft, aft, look + 1);
}
break;
case OOR2: /* propagate OCH_'s marking */
@@ -1083,20 +1167,19 @@
/*
- print - print a set of states
== #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
+ == static void print(struct match *m, const char *caption, states st, \
== int ch, FILE *d);
== #endif
*/
static void
-print(
- struct match *m,
- char *caption,
- states st,
- int ch,
- FILE *d)
+print(struct match *m,
+ const char *caption,
+ states st,
+ int ch,
+ FILE *d)
{
struct re_guts *g = m->g;
- int i;
+ sopno i;
int first = 1;
_DIAGASSERT(m != NULL);
@@ -1112,27 +1195,26 @@
fprintf(d, " %s", pchar(ch));
for (i = 0; i < g->nstates; i++)
if (ISSET(st, i)) {
- fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
+ fprintf(d, "%s%lu", (first) ? "\t" : ", ", i);
first = 0;
}
fprintf(d, "\n");
}
-/*
+/*
- at - print current situation
== #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- == sopno startst, sopno stopst);
+ == static void at(struct match *m, const char *title, const char *start, \
+ == const char *stop, sopno startst, sopno stopst);
== #endif
*/
static void
-at(
- struct match *m,
- char *title,
- char *start,
- char *stop,
- sopno startst,
- sopno stopst)
+at( struct match *m,
+ const char *title,
+ const char *start,
+ const char *stop,
+ sopno startst,
+ sopno stopst)
{
_DIAGASSERT(m != NULL);
@@ -1153,7 +1235,7 @@
/*
- pchar - make a character printable
== #ifdef REDEBUG
- == static char *pchar(int ch);
+ == static const char *pchar(int ch);
== #endif
*
* Is this identical to regchar() over in debug.c? Well, yes. But a
@@ -1161,28 +1243,26 @@
* a matching debug.o, and this is convenient. It all disappears in
* the non-debug compilation anyway, so it doesn't matter much.
*/
-static char * /* -> representation */
-pchar(
- int ch)
+static const char * /* -> representation */
+pchar(int ch)
{
static char pbuf[10];
- if (isprint(ch) || ch == ' ')
- (void)snprintf(pbuf, sizeof pbuf, "%c", ch);
+ if (isprint((uch)ch) || ch == ' ')
+ snprintf(pbuf, sizeof(pbuf), "%c", ch);
else
- (void)snprintf(pbuf, sizeof pbuf, "\\%o", ch);
+ snprintf(pbuf, sizeof(pbuf), "\\%o", ch);
return(pbuf);
}
#endif
#endif
+#undef stepback
#undef matcher
-#undef fast
-#undef slow
+#undef walk
#undef dissect
#undef backref
#undef step
#undef print
#undef at
#undef match
-#undef nope
diff --git a/libc/upstream-netbsd/lib/libc/regex/regcomp.c b/libc/upstream-netbsd/lib/libc/regex/regcomp.c
index 4a0d99a..957f8ac 100644
--- a/libc/upstream-netbsd/lib/libc/regex/regcomp.c
+++ b/libc/upstream-netbsd/lib/libc/regex/regcomp.c
@@ -1,9 +1,17 @@
-/* $NetBSD: regcomp.c,v 1.38 2019/02/07 22:22:31 christos Exp $ */
+/* $NetBSD: regcomp.c,v 1.46 2021/03/11 15:00:29 christos Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
* This code is derived from software contributed to Berkeley by
* Henry Spencer.
*
@@ -34,74 +42,65 @@
* @(#)regcomp.c 8.5 (Berkeley) 3/20/94
*/
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)regcomp.c 8.5 (Berkeley) 3/20/94
- */
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
-#else
-__RCSID("$NetBSD: regcomp.c,v 1.38 2019/02/07 22:22:31 christos Exp $");
+__FBSDID("$FreeBSD: head/lib/libc/regex/regcomp.c 368359 2020-12-05 03:18:48Z kevans $");
#endif
-#endif /* LIBC_SCCS and not lint */
+__RCSID("$NetBSD: regcomp.c,v 1.46 2021/03/11 15:00:29 christos Exp $");
+
+#define _OPENBSD_SOURCE
+
+#ifndef LIBHACK
+#define REGEX_GNU_EXTENSIONS
#include "namespace.h"
+#endif
#include <sys/types.h>
-
-#include <assert.h>
+#include <stdio.h>
+#include <string.h>
#include <ctype.h>
#include <limits.h>
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <regex.h>
+#include <stdbool.h>
-#ifdef __weak_alias
+#if defined(__weak_alias) && !defined(LIBHACK)
__weak_alias(regcomp,_regcomp)
#endif
+#ifdef REGEX_LIBC_COLLATE
+#include "collate.h"
+#endif
+
#include "utils.h"
#include "regex2.h"
-#include "cclass.h"
#include "cname.h"
/*
+ * Branching context, used to keep track of branch state for all of the branch-
+ * aware functions. In addition to keeping track of branch positions for the
+ * p_branch_* functions, we use this to simplify some clumsiness in BREs for
+ * detection of whether ^ is acting as an anchor or being used erroneously and
+ * also for whether we're in a sub-expression or not.
+ */
+struct branchc {
+ sopno start;
+ sopno back;
+ sopno fwd;
+
+ int nbranch;
+ int nchain;
+ bool outer;
+ bool terminate;
+};
+
+/*
* parse structure, passed up and down to avoid global variables and
* other clumsinesses
*/
@@ -109,6 +108,7 @@
const char *next; /* next character in RE */
const char *end; /* end of string (-> NUL normally) */
int error; /* has an error been seen? */
+ int gnuext;
sop *strip; /* malloced strip */
sopno ssize; /* malloced strip size (allocated) */
sopno slen; /* malloced strip length (used) */
@@ -117,56 +117,70 @@
# define NPAREN 10 /* we need to remember () 1-9 for back refs */
sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
sopno pend[NPAREN]; /* -> ) ([0] unused) */
+ bool allowbranch; /* can this expression branch? */
+ bool bre; /* convenience; is this a BRE? */
+ int pflags; /* other parsing flags -- legacy escapes? */
+ bool (*parse_expr)(struct parse *, struct branchc *);
+ void (*pre_parse)(struct parse *, struct branchc *);
+ void (*post_parse)(struct parse *, struct branchc *);
};
+#define PFLAG_LEGACY_ESC 0x00000001
+
/* ========= begin header generated by ./mkh ========= */
#ifdef __cplusplus
extern "C" {
#endif
/* === regcomp.c === */
-static void p_ere(struct parse *p, int stop, size_t reclimit);
-static void p_ere_exp(struct parse *p, size_t reclimit);
+static bool p_ere_exp(struct parse *p, struct branchc *bc);
static void p_str(struct parse *p);
-static void p_bre(struct parse *p, int end1, int end2, size_t reclimit);
-static int p_simp_re(struct parse *p, int starordinary, size_t reclimit);
+static int p_branch_eat_delim(struct parse *p, struct branchc *bc);
+static void p_branch_ins_offset(struct parse *p, struct branchc *bc);
+static void p_branch_fix_tail(struct parse *p, struct branchc *bc);
+static bool p_branch_empty(struct parse *p, struct branchc *bc);
+static bool p_branch_do(struct parse *p, struct branchc *bc);
+static void p_bre_pre_parse(struct parse *p, struct branchc *bc);
+static void p_bre_post_parse(struct parse *p, struct branchc *bc);
+static void p_re(struct parse *p, int end1, int end2);
+static bool p_simp_re(struct parse *p, struct branchc *bc);
static int p_count(struct parse *p);
static void p_bracket(struct parse *p);
+static int p_range_cmp(wchar_t c1, wchar_t c2);
static void p_b_term(struct parse *p, cset *cs);
+#ifdef REGEX_GNU_EXTENSIONS
+static int p_b_pseudoclass(struct parse *p, char c);
+#endif
static void p_b_cclass(struct parse *p, cset *cs);
+static void p_b_cclass_named(struct parse *p, cset *cs, const char[]);
static void p_b_eclass(struct parse *p, cset *cs);
-static char p_b_symbol(struct parse *p);
-static char p_b_coll_elem(struct parse *p, int endc);
-static int othercase(int ch);
-static void bothcases(struct parse *p, int ch);
-static void ordinary(struct parse *p, int ch);
+static wint_t p_b_symbol(struct parse *p);
+static wint_t p_b_coll_elem(struct parse *p, wint_t endc);
+static bool may_escape(struct parse *p, const wint_t ch);
+static wint_t othercase(wint_t ch);
+static void bothcases(struct parse *p, wint_t ch);
+static void ordinary(struct parse *p, wint_t ch);
static void nonnewline(struct parse *p);
-static void repeat(struct parse *p, sopno start, int from, int to, size_t reclimit);
+static void repeat(struct parse *p, sopno start, int from, int to);
static int seterr(struct parse *p, int e);
static cset *allocset(struct parse *p);
static void freeset(struct parse *p, cset *cs);
-static sopno freezeset(struct parse *p, cset *cs);
-static int firstch(struct parse *p, cset *cs);
-static int nch(struct parse *p, cset *cs);
-static void mcadd(struct parse *p, cset *cs, const char *cp);
-#if 0
-static void mcsub(cset *cs, char *cp);
-static int mcin(cset *cs, char *cp);
-static char *mcfind(cset *cs, char *cp);
-#endif
-static void mcinvert(struct parse *p, cset *cs);
-static void mccase(struct parse *p, cset *cs);
-static int isinsets(struct re_guts *g, int c);
-static int samesets(struct re_guts *g, int c1, int c2);
-static void categorize(struct parse *p, struct re_guts *g);
+static void CHadd(struct parse *p, cset *cs, wint_t ch);
+static void CHaddrange(struct parse *p, cset *cs, wint_t min, wint_t max);
+static void CHaddtype(struct parse *p, cset *cs, wctype_t wct);
+static wint_t singleton(cset *cs);
static sopno dupl(struct parse *p, sopno start, sopno finish);
-static void doemit(struct parse *p, sop op, sopno opnd);
-static void doinsert(struct parse *p, sop op, sopno opnd, sopno pos);
-static void dofwd(struct parse *p, sopno pos, sopno value);
+static void doemit(struct parse *p, sop op, size_t opnd);
+static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
+static void dofwd(struct parse *p, sopno pos, sop value);
static int enlarge(struct parse *p, sopno size);
static void stripsnug(struct parse *p, struct re_guts *g);
static void findmust(struct parse *p, struct re_guts *g);
+static int altoffset(sop *scan, int offset);
+static void computejumps(struct parse *p, struct re_guts *g);
+static void computematchjumps(struct parse *p, struct re_guts *g);
static sopno pluscount(struct parse *p, struct re_guts *g);
+static wint_t wgetnext(struct parse *p);
#ifdef __cplusplus
}
@@ -185,19 +199,22 @@
#define MORE2() (p->next+1 < p->end)
#define SEE(c) (MORE() && PEEK() == (c))
#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
+#define SEESPEC(a) (p->bre ? SEETWO('\\', a) : SEE(a))
#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0)
#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
+#define EATSPEC(a) (p->bre ? EATTWO('\\', a) : EAT(a))
#define NEXT() (p->next++)
#define NEXT2() (p->next += 2)
#define NEXTn(n) (p->next += (n))
#define GETNEXT() (*p->next++)
+#define WGETNEXT() wgetnext(p)
#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) (void) ((co) || SETERROR(e))
+#define REQUIRE(co, e) ((co) || SETERROR(e))
#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
-#define MUSTEAT(c, e) (void) (REQUIRE(MORE() && GETNEXT() == (c), e))
+#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
-#define EMIT(op, sopnd) doemit(p, (sop)(op), sopnd)
-#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
+#define EMIT(op, sopnd) doemit(p, (op), (sopnd))
+#define INSERT(op, pos) doinsert(p, (op), HERE()-(pos)+1, pos)
#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
#define HERE() (p->slen)
@@ -205,42 +222,62 @@
#define THERETHERE() (p->slen - 2)
#define DROP(n) (p->slen -= (n))
-#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
-#else
-#define never 0 /* some <assert.h>s have bugs too */
+/* Macro used by computejump()/computematchjump() */
+#ifndef MIN
+#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
-#define MEMLIMIT 0x8000000
-#define MEMSIZE(p) \
- ((p)->ncsalloc / CHAR_BIT * (p)->g->csetsize + \
- (p)->ncsalloc * sizeof(cset) + \
- (p)->ssize * sizeof(sop))
-#define RECLIMIT 256
+#ifndef NLS
+static const struct {
+ const char *name;
+ int (*func)(int);
+} wctypes[] = {
+#define ADD(x) { .name = # x, .func = is ## x }
+ ADD(alnum),
+ ADD(alpha),
+ ADD(blank),
+ ADD(cntrl),
+ ADD(digit),
+ ADD(graph),
+ ADD(lower),
+ ADD(print),
+ ADD(punct),
+ ADD(space),
+ ADD(upper),
+ ADD(xdigit),
+#undef ADD
+};
-/*
- - regcomp - interface for parser and compilation
- = extern int regcomp(regex_t *, const char *, int);
- = #define REG_BASIC 0000
- = #define REG_EXTENDED 0001
- = #define REG_ICASE 0002
- = #define REG_NOSUB 0004
- = #define REG_NEWLINE 0010
- = #define REG_NOSPEC 0020
- = #define REG_PEND 0040
- = #define REG_DUMP 0200
- */
-int /* 0 success, otherwise REG_something */
-regcomp(
- regex_t *preg,
- const char *pattern,
- int cflags)
+wctype_t
+__regex_wctype(const char *str)
+{
+ for (size_t i = 0; i < __arraycount(wctypes); i++) {
+ if (strcmp(wctypes[i].name, str) == 0)
+ return (wctype_t)(i + 1);
+ }
+ return (wctype_t)0;
+}
+
+int
+__regex_iswctype(wint_t c, wctype_t ct)
+{
+ if (ct == 0)
+ return 0;
+ return (*wctypes[ct - 1].func)(c);
+}
+#endif
+
+static int /* 0 success, otherwise REG_something */
+regcomp_internal(regex_t * __restrict preg,
+ const char * __restrict pattern,
+ int cflags, int pflags)
{
struct parse pa;
struct re_guts *g;
struct parse *p = &pa;
int i;
size_t len;
+ size_t maxlen;
#ifdef REDEBUG
# define GOODFLAGS(f) (f)
#else
@@ -262,11 +299,27 @@
len = strlen(pattern);
/* do the mallocs early so failure handling is easy */
- g = malloc(sizeof(struct re_guts) + (NC - 1) * sizeof(cat_t));
+ g = malloc(sizeof(*g));
if (g == NULL)
return(REG_ESPACE);
- p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
- p->strip = calloc(p->ssize, sizeof(sop));
+ /*
+ * Limit the pattern space to avoid a 32-bit overflow on buffer
+ * extension. Also avoid any signed overflow in case of conversion
+ * so make the real limit based on a 31-bit overflow.
+ *
+ * Likely not applicable on 64-bit systems but handle the case
+ * generically (who are we to stop people from using ~715MB+
+ * patterns?).
+ */
+ maxlen = ((size_t)-1 >> 1) / sizeof(*p->strip) * 2 / 3;
+ if (len >= maxlen) {
+ free(g);
+ return(REG_ESPACE);
+ }
+ p->ssize = (sopno)(len / 2 * 3 + 1); /* ugh */
+ assert(p->ssize >= len);
+
+ p->strip = calloc(p->ssize, sizeof(*p->strip));
p->slen = 0;
if (p->strip == NULL) {
free(g);
@@ -275,46 +328,74 @@
/* set things up */
p->g = g;
- p->next = pattern;
+ p->next = pattern; /* convenience; we do not modify it */
p->end = p->next + len;
p->error = 0;
p->ncsalloc = 0;
+ p->pflags = pflags;
for (i = 0; i < NPAREN; i++) {
p->pbegin[i] = 0;
p->pend[i] = 0;
}
- g->csetsize = NC;
+#ifdef REGEX_GNU_EXTENSIONS
+ if ((cflags & REG_GNU) == 0) {
+ p->gnuext = false;
+ p->allowbranch = (cflags & REG_EXTENDED) != 0;
+ } else
+ p->gnuext = p->allowbranch = true;
+#else
+ p->gnuext = false;
+ p->allowbranch = (cflags & REG_EXTENDED) != 0;
+#endif
+ if (cflags & REG_EXTENDED) {
+ p->bre = false;
+ p->parse_expr = p_ere_exp;
+ p->pre_parse = NULL;
+ p->post_parse = NULL;
+ } else {
+ p->bre = true;
+ p->parse_expr = p_simp_re;
+ p->pre_parse = p_bre_pre_parse;
+ p->post_parse = p_bre_post_parse;
+ }
g->sets = NULL;
- g->setbits = NULL;
g->ncsets = 0;
g->cflags = cflags;
g->iflags = 0;
g->nbol = 0;
g->neol = 0;
g->must = NULL;
+ g->moffset = -1;
+ g->charjump = NULL;
+ g->matchjump = NULL;
g->mlen = 0;
g->nsub = 0;
- g->ncategories = 1; /* category 0 is "everything else" */
- g->categories = &g->catspace[-(CHAR_MIN)];
- (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
g->backrefs = 0;
/* do it */
EMIT(OEND, 0);
g->firststate = THERE();
- if (cflags®_EXTENDED)
- p_ere(p, OUT, 0);
- else if (cflags®_NOSPEC)
+ if (cflags & REG_NOSPEC)
p_str(p);
else
- p_bre(p, OUT, OUT, 0);
+ p_re(p, OUT, OUT);
EMIT(OEND, 0);
g->laststate = THERE();
/* tidy up loose ends and fill things in */
- categorize(p, g);
stripsnug(p, g);
findmust(p, g);
+ /* only use Boyer-Moore algorithm if the pattern is bigger
+ * than three characters
+ */
+ if(g->mlen > 3) {
+ computejumps(p, g);
+ computematchjumps(p, g);
+ if(g->matchjump == NULL && g->charjump != NULL) {
+ free(g->charjump);
+ g->charjump = NULL;
+ }
+ }
g->nplus = pluscount(p, g);
g->magic = MAGIC2;
preg->re_nsub = g->nsub;
@@ -333,97 +414,72 @@
}
/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(struct parse *p, int stop, size_t reclimit);
+ - regcomp - interface for parser and compilation
+ = extern int regcomp(regex_t *, const char *, int);
+ = #define REG_BASIC 0000
+ = #define REG_EXTENDED 0001
+ = #define REG_ICASE 0002
+ = #define REG_NOSUB 0004
+ = #define REG_NEWLINE 0010
+ = #define REG_NOSPEC 0020
+ = #define REG_PEND 0040
+ = #define REG_DUMP 0200
*/
-static void
-p_ere(
- struct parse *p,
- int stop, /* character this ERE should end at */
- size_t reclimit)
+int /* 0 success, otherwise REG_something */
+regcomp(regex_t * __restrict preg,
+ const char * __restrict pattern,
+ int cflags)
{
- char c;
- sopno prevback = 0; /* pacify gcc */
- sopno prevfwd = 0; /* pacify gcc */
- sopno conc;
- int first = 1; /* is this the first alternative? */
- _DIAGASSERT(p != NULL);
-
- if (reclimit++ > RECLIMIT || p->error == REG_ESPACE) {
- p->error = REG_ESPACE;
- return;
- }
-
- for (;;) {
- /* do a bunch of concatenated expressions */
- conc = HERE();
- while (MORE() && (c = PEEK()) != '|' && c != stop)
- p_ere_exp(p, reclimit);
- REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
-
- if (!EAT('|'))
- break; /* NOTE BREAK OUT */
-
- if (first) {
- INSERT(OCH_, conc); /* offset is wrong */
- prevfwd = conc;
- prevback = conc;
- first = 0;
- }
- ASTERN(OOR1, prevback);
- prevback = THERE();
- AHEAD(prevfwd); /* fix previous offset */
- prevfwd = HERE();
- EMIT(OOR2, 0); /* offset is very wrong */
- }
-
- if (!first) { /* tail-end fixups */
- AHEAD(prevfwd);
- ASTERN(O_CH, prevback);
- }
-
- assert(!MORE() || SEE(stop));
+ return (regcomp_internal(preg, pattern, cflags, 0));
}
/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(struct parse *p, size_t reclimit);
+ - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op,
+ - return whether we should terminate or not
+ == static bool p_ere_exp(struct parse *p);
*/
-static void
-p_ere_exp(
- struct parse *p,
- size_t reclimit)
+static bool
+p_ere_exp(struct parse *p, struct branchc *bc)
{
char c;
+ wint_t wc;
sopno pos;
int count;
int count2;
+#ifdef REGEX_GNU_EXTENSIONS
+ size_t i;
+ int handled;
+#endif
sopno subno;
int wascaret = 0;
_DIAGASSERT(p != NULL);
+ (void)bc;
assert(MORE()); /* caller should have ensured this */
c = GETNEXT();
+#ifdef REGEX_GNU_EXTENSIONS
+ handled = 0;
+#endif
pos = HERE();
switch (c) {
case '(':
- REQUIRE(MORE(), REG_EPAREN);
+ (void)REQUIRE(MORE(), REG_EPAREN);
p->g->nsub++;
- subno = p->g->nsub;
+ subno = (sopno)p->g->nsub;
if (subno < NPAREN)
p->pbegin[subno] = HERE();
EMIT(OLPAREN, subno);
if (!SEE(')'))
- p_ere(p, ')', reclimit);
+ p_re(p, ')', IGN);
if (subno < NPAREN) {
p->pend[subno] = HERE();
assert(p->pend[subno] != 0);
}
EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
+ (void)MUSTEAT(')', REG_EPAREN);
break;
#ifndef POSIX_MISTAKE
case ')': /* happens only if no current unmatched ( */
@@ -454,6 +510,7 @@
case '*':
case '+':
case '?':
+ case '{':
SETERROR(REG_BADRPT);
break;
case '.':
@@ -466,30 +523,118 @@
p_bracket(p);
break;
case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
+ (void)REQUIRE(MORE(), REG_EESCAPE);
+ wc = WGETNEXT();
+#ifdef REGEX_GNU_EXTENSIONS
+ if (p->gnuext) {
+ handled = 1;
+ switch (wc) {
+ case '`':
+ EMIT(OBOS, 0);
+ break;
+ case '\'':
+ EMIT(OEOS, 0);
+ break;
+ case 'B':
+ EMIT(ONWBND, 0);
+ break;
+ case 'b':
+ EMIT(OWBND, 0);
+ break;
+ case 'W':
+ case 'w':
+ case 'S':
+ case 's':
+ p_b_pseudoclass(p, wc);
+ break;
+ case 'a':
+ ordinary(p, '\a');
+ break;
+ case 'e':
+ ordinary(p, '\e');
+ break;
+ case 'f':
+ ordinary(p, '\f');
+ break;
+ case 'n':
+ ordinary(p, '\n');
+ break;
+ case 'r':
+ ordinary(p, '\r');
+ break;
+ case 't':
+ ordinary(p, '\t');
+ break;
+ case 'v':
+ ordinary(p, '\v');
+ break;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ i = wc - '0';
+ assert(i < NPAREN);
+ if (p->pend[i] != 0) {
+ assert(i <= p->g->nsub);
+ EMIT(OBACK_, i);
+ assert(p->pbegin[i] != 0);
+ assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
+ assert(OP(p->strip[p->pend[i]]) == ORPAREN);
+ (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
+ EMIT(O_BACK, i);
+ } else
+ SETERROR(REG_ESUBREG);
+ p->g->backrefs = 1;
+ break;
+ default:
+ handled = 0;
+ }
+ /* Don't proceed to the POSIX bits if we've already handled it */
+ if (handled)
+ break;
+ }
+#endif
+ switch (wc) {
+ case '<':
+ EMIT(OBOW, 0);
+ break;
+ case '>':
+ EMIT(OEOW, 0);
+ break;
+ default:
+ if (may_escape(p, wc))
+ ordinary(p, wc);
+ else
+ SETERROR(REG_EESCAPE);
+ break;
+ }
break;
- case '{': /* okay as ordinary except if digit follows */
- REQUIRE(!MORE() || !isdigit((unsigned char)PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
default:
if (p->error != 0)
- return;
- ordinary(p, c);
+ return (false);
+ p->next--;
+ wc = WGETNEXT();
+ ordinary(p, wc);
break;
}
if (!MORE())
- return;
+ return (false);
c = PEEK();
/* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit((unsigned char)PEEK2())) ))
- return; /* no repetition, we're done */
+ if (!( c == '*' || c == '+' || c == '?' || c == '{'))
+ return (false); /* no repetition, we're done */
+ else if (c == '{')
+ (void)REQUIRE(MORE2() && \
+ (isdigit((uch)PEEK2()) || PEEK2() == ','), REG_BADRPT);
NEXT();
- REQUIRE(!wascaret, REG_BADRPT);
+ (void)REQUIRE(!wascaret, REG_BADRPT);
switch (c) {
case '*': /* implemented as +? */
/* this case does not require the (y|) trick, noKLUDGE */
@@ -514,30 +659,31 @@
case '{':
count = p_count(p);
if (EAT(',')) {
- if (isdigit((unsigned char)PEEK())) {
+ if (isdigit((uch)PEEK())) {
count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
+ (void)REQUIRE(count <= count2, REG_BADBR);
} else /* single number with comma */
count2 = INFINITY;
} else /* just a single number */
count2 = count;
- repeat(p, pos, count, count2, 0);
+ repeat(p, pos, count, count2);
if (!EAT('}')) { /* error heuristics */
while (MORE() && PEEK() != '}')
NEXT();
- REQUIRE(MORE(), REG_EBRACE);
+ (void)REQUIRE(MORE(), REG_EBRACE);
SETERROR(REG_BADBR);
}
break;
}
if (!MORE())
- return;
+ return (false);
c = PEEK();
if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit((unsigned char)PEEK2())) ) )
- return;
+ (c == '{' && MORE2() && isdigit((uch)PEEK2())) ) )
+ return (false);
SETERROR(REG_BADRPT);
+ return (false);
}
/*
@@ -545,159 +691,350 @@
== static void p_str(struct parse *p);
*/
static void
-p_str(
- struct parse *p)
+p_str(struct parse *p)
{
-
- _DIAGASSERT(p != NULL);
-
- REQUIRE(MORE(), REG_EMPTY);
+ (void)REQUIRE(MORE(), REG_EMPTY);
while (MORE())
- ordinary(p, GETNEXT());
+ ordinary(p, WGETNEXT());
}
/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(struct parse *p, int end1, \
- == int end2, size_t reclimit);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor. The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases. This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
+ * Eat consecutive branch delimiters for the kind of expression that we are
+ * parsing, return the number of delimiters that we ate.
+ */
+static int
+p_branch_eat_delim(struct parse *p, struct branchc *bc)
+{
+ int nskip;
+
+ (void)bc;
+ nskip = 0;
+ while (EATSPEC('|'))
+ ++nskip;
+ return (nskip);
+}
+
+/*
+ * Insert necessary branch book-keeping operations. This emits a
+ * bogus 'next' offset, since we still have more to parse
*/
static void
-p_bre(
- struct parse *p,
- int end1, /* first terminating character */
- int end2, /* second terminating character */
- size_t reclimit)
+p_branch_ins_offset(struct parse *p, struct branchc *bc)
{
- sopno start;
- int first = 1; /* first subexpression? */
- int wasdollar = 0;
- _DIAGASSERT(p != NULL);
-
- if (reclimit++ > RECLIMIT || p->error == REG_ESPACE) {
- p->error = REG_ESPACE;
- return;
+ if (bc->nbranch == 0) {
+ INSERT(OCH_, bc->start); /* offset is wrong */
+ bc->fwd = bc->start;
+ bc->back = bc->start;
}
- start = HERE();
+ ASTERN(OOR1, bc->back);
+ bc->back = THERE();
+ AHEAD(bc->fwd); /* fix previous offset */
+ bc->fwd = HERE();
+ EMIT(OOR2, 0); /* offset is very wrong */
+ ++bc->nbranch;
+}
+/*
+ * Fix the offset of the tail branch, if we actually had any branches.
+ * This is to correct the bogus placeholder offset that we use.
+ */
+static void
+p_branch_fix_tail(struct parse *p, struct branchc *bc)
+{
+
+ /* Fix bogus offset at the tail if we actually have branches */
+ if (bc->nbranch > 0) {
+ AHEAD(bc->fwd);
+ ASTERN(O_CH, bc->back);
+ }
+}
+
+/*
+ * Signal to the parser that an empty branch has been encountered; this will,
+ * in the future, be used to allow for more permissive behavior with empty
+ * branches. The return value should indicate whether parsing may continue
+ * or not.
+ */
+static bool
+p_branch_empty(struct parse *p, struct branchc *bc)
+{
+
+ (void)bc;
+ SETERROR(REG_EMPTY);
+ return (false);
+}
+
+/*
+ * Take care of any branching requirements. This includes inserting the
+ * appropriate branching instructions as well as eating all of the branch
+ * delimiters until we either run out of pattern or need to parse more pattern.
+ */
+static bool
+p_branch_do(struct parse *p, struct branchc *bc)
+{
+ int ate = 0;
+
+ ate = p_branch_eat_delim(p, bc);
+ if (ate == 0)
+ return (false);
+ else if ((ate > 1 || (bc->outer && !MORE())) && !p_branch_empty(p, bc))
+ /*
+ * Halt parsing only if we have an empty branch and p_branch_empty
+ * indicates that we must not continue. In the future, this will not
+ * necessarily be an error.
+ */
+ return (false);
+ p_branch_ins_offset(p, bc);
+
+ return (true);
+}
+
+static void
+p_bre_pre_parse(struct parse *p, struct branchc *bc)
+{
+
+ (void)bc;
+ /*
+ * Does not move cleanly into expression parser because of
+ * ordinary interpration of * at the beginning position of
+ * an expression.
+ */
if (EAT('^')) {
EMIT(OBOL, 0);
p->g->iflags |= USEBOL;
p->g->nbol++;
}
- while (MORE() && !SEETWO(end1, end2)) {
- wasdollar = p_simp_re(p, first, reclimit);
- first = 0;
- }
- if (wasdollar) { /* oops, that was a trailing anchor */
+}
+
+static void
+p_bre_post_parse(struct parse *p, struct branchc *bc)
+{
+
+ /* Expression is terminating due to EOL token */
+ if (bc->terminate) {
DROP(1);
EMIT(OEOL, 0);
p->g->iflags |= USEEOL;
p->g->neol++;
}
+}
- REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
+/*
+ - p_re - Top level parser, concatenation and BRE anchoring
+ == static void p_re(struct parse *p, int end1, int end2);
+ * Giving end1 as OUT essentially eliminates the end1/end2 check.
+ *
+ * This implementation is a bit of a kludge, in that a trailing $ is first
+ * taken as an ordinary character and then revised to be an anchor.
+ * The amount of lookahead needed to avoid this kludge is excessive.
+ */
+static void
+p_re(struct parse *p,
+ int end1, /* first terminating character */
+ int end2) /* second terminating character; ignored for EREs */
+{
+ struct branchc bc;
+
+ bc.nbranch = 0;
+ if (end1 == OUT && end2 == OUT)
+ bc.outer = true;
+ else
+ bc.outer = false;
+#define SEEEND() (!p->bre ? SEE(end1) : SEETWO(end1, end2))
+ for (;;) {
+ bc.start = HERE();
+ bc.nchain = 0;
+ bc.terminate = false;
+ if (p->pre_parse != NULL)
+ p->pre_parse(p, &bc);
+ while (MORE() && (!p->allowbranch || !SEESPEC('|')) && !SEEEND()) {
+ bc.terminate = p->parse_expr(p, &bc);
+ ++bc.nchain;
+ }
+ if (p->post_parse != NULL)
+ p->post_parse(p, &bc);
+ (void) REQUIRE(p->gnuext || HERE() != bc.start, REG_EMPTY);
+#ifdef REGEX_GNU_EXTENSIONS
+ if (p->gnuext && HERE() == bc.start && !p_branch_empty(p, &bc))
+ break;
+#endif
+ if (!p->allowbranch)
+ break;
+ /*
+ * p_branch_do's return value indicates whether we should
+ * continue parsing or not. This is both for correctness and
+ * a slight optimization, because it will check if we've
+ * encountered an empty branch or the end of the string
+ * immediately following a branch delimiter.
+ */
+ if (!p_branch_do(p, &bc))
+ break;
+ }
+#undef SEE_END
+ if (p->allowbranch)
+ p_branch_fix_tail(p, &bc);
+ assert(!MORE() || SEE(end1));
}
/*
- p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(struct parse *p, int starordinary, size_t reclimit);
+ == static bool p_simp_re(struct parse *p, struct branchc *bc);
*/
-static int /* was the simple RE an unbackslashed $? */
-p_simp_re(
- struct parse *p,
- int starordinary, /* is a leading * an ordinary character? */
- size_t reclimit)
+static bool /* was the simple RE an unbackslashed $? */
+p_simp_re(struct parse *p, struct branchc *bc)
{
int c;
+ int cc; /* convenient/control character */
int count;
int count2;
- sopno pos, i;
+ sopno pos;
+ bool handled;
+ size_t i;
+ wint_t wc;
sopno subno;
# define BACKSL (1<<CHAR_BIT)
- _DIAGASSERT(p != NULL);
-
- pos = HERE(); /* repetion op, if any, covers from here */
+ pos = HERE(); /* repetition op, if any, covers from here */
+ handled = false;
assert(MORE()); /* caller should have ensured this */
c = GETNEXT();
if (c == '\\') {
- REQUIRE(MORE(), REG_EESCAPE);
- c = BACKSL | (unsigned char)GETNEXT();
- }
- switch (c) {
- case '.':
- if (p->g->cflags®_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL|'{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL|'(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')', reclimit);
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
+ (void)REQUIRE(MORE(), REG_EESCAPE);
+ cc = GETNEXT();
+ c = BACKSL | cc;
+#ifdef REGEX_GNU_EXTENSIONS
+ if (p->gnuext) {
+ handled = true;
+ switch (c) {
+ case BACKSL|'`':
+ EMIT(OBOS, 0);
+ break;
+ case BACKSL|'\'':
+ EMIT(OEOS, 0);
+ break;
+ case BACKSL|'B':
+ EMIT(ONWBND, 0);
+ break;
+ case BACKSL|'b':
+ EMIT(OWBND, 0);
+ break;
+ case BACKSL|'W':
+ case BACKSL|'w':
+ case BACKSL|'S':
+ case BACKSL|'s':
+ p_b_pseudoclass(p, cc);
+ break;
+ case BACKSL|'a':
+ ordinary(p, '\a');
+ break;
+ case BACKSL|'e':
+ ordinary(p, '\e');
+ break;
+ case BACKSL|'f':
+ ordinary(p, '\f');
+ break;
+ case BACKSL|'n':
+ ordinary(p, '\n');
+ break;
+ case BACKSL|'r':
+ ordinary(p, '\r');
+ break;
+ case BACKSL|'t':
+ ordinary(p, '\t');
+ break;
+ case BACKSL|'v':
+ ordinary(p, '\v');
+ break;
+ default:
+ handled = false;
+ }
}
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL|'1':
- case BACKSL|'2':
- case BACKSL|'3':
- case BACKSL|'4':
- case BACKSL|'5':
- case BACKSL|'6':
- case BACKSL|'7':
- case BACKSL|'8':
- case BACKSL|'9':
- i = (c&~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0) {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
- EMIT(O_BACK, i);
- } else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- if (p->error != 0)
- return(0);
- ordinary(p, c &~ BACKSL);
- break;
+#endif
+ }
+ if (!handled) {
+ switch (c) {
+ case '.':
+ if (p->g->cflags®_NEWLINE)
+ nonnewline(p);
+ else
+ EMIT(OANY, 0);
+ break;
+ case '[':
+ p_bracket(p);
+ break;
+ case BACKSL|'<':
+ EMIT(OBOW, 0);
+ break;
+ case BACKSL|'>':
+ EMIT(OEOW, 0);
+ break;
+ case BACKSL|'{':
+ SETERROR(REG_BADRPT);
+ break;
+ case BACKSL|'(':
+ p->g->nsub++;
+ subno = (sopno)p->g->nsub;
+ if (subno < NPAREN)
+ p->pbegin[subno] = HERE();
+ EMIT(OLPAREN, subno);
+ /* the MORE here is an error heuristic */
+ if (MORE() && !SEETWO('\\', ')'))
+ p_re(p, '\\', ')');
+ if (subno < NPAREN) {
+ p->pend[subno] = HERE();
+ assert(p->pend[subno] != 0);
+ }
+ EMIT(ORPAREN, subno);
+ (void)REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
+ break;
+ case BACKSL|')': /* should not get here -- must be user */
+ SETERROR(REG_EPAREN);
+ break;
+ case BACKSL|'1':
+ case BACKSL|'2':
+ case BACKSL|'3':
+ case BACKSL|'4':
+ case BACKSL|'5':
+ case BACKSL|'6':
+ case BACKSL|'7':
+ case BACKSL|'8':
+ case BACKSL|'9':
+ i = (c&~BACKSL) - '0';
+ assert(i < NPAREN);
+ if (p->pend[i] != 0) {
+ assert(i <= p->g->nsub);
+ EMIT(OBACK_, i);
+ assert(p->pbegin[i] != 0);
+ assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
+ assert(OP(p->strip[p->pend[i]]) == ORPAREN);
+ (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
+ EMIT(O_BACK, i);
+ } else
+ SETERROR(REG_ESUBREG);
+ p->g->backrefs = 1;
+ break;
+ case '*':
+ /*
+ * Ordinary if used as the first character beyond BOL anchor of
+ * a (sub-)expression, counts as a bad repetition operator if it
+ * appears otherwise.
+ */
+ (void)REQUIRE(bc->nchain == 0, REG_BADRPT);
+ /* FALLTHROUGH */
+ default:
+ if (p->error != 0)
+ return (false); /* Definitely not $... */
+ p->next--;
+ wc = WGETNEXT();
+ if ((c & BACKSL) == 0 || may_escape(p, wc))
+ ordinary(p, wc);
+ else
+ SETERROR(REG_EESCAPE);
+ break;
+ }
}
if (EAT('*')) { /* implemented as +? */
@@ -706,27 +1043,35 @@
ASTERN(O_PLUS, pos);
INSERT(OQUEST_, pos);
ASTERN(O_QUEST, pos);
+#ifdef REGEX_GNU_EXTENSIONS
+ } else if (p->gnuext && EATTWO('\\', '?')) {
+ INSERT(OQUEST_, pos);
+ ASTERN(O_QUEST, pos);
+ } else if (p->gnuext && EATTWO('\\', '+')) {
+ INSERT(OPLUS_, pos);
+ ASTERN(O_PLUS, pos);
+#endif
} else if (EATTWO('\\', '{')) {
count = p_count(p);
if (EAT(',')) {
- if (MORE() && isdigit((unsigned char)PEEK())) {
+ if (MORE() && isdigit((uch)PEEK())) {
count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
+ (void)REQUIRE(count <= count2, REG_BADBR);
} else /* single number with comma */
count2 = INFINITY;
} else /* just a single number */
count2 = count;
- repeat(p, pos, count, count2, 0);
+ repeat(p, pos, count, count2);
if (!EATTWO('\\', '}')) { /* error heuristics */
while (MORE() && !SEETWO('\\', '}'))
NEXT();
- REQUIRE(MORE(), REG_EBRACE);
+ (void)REQUIRE(MORE(), REG_EBRACE);
SETERROR(REG_BADBR);
}
- } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
- return(1);
+ } else if (c == '$') /* $ (but not \$) ends it */
+ return (true);
- return(0);
+ return (false);
}
/*
@@ -734,105 +1079,95 @@
== static int p_count(struct parse *p);
*/
static int /* the value */
-p_count(
- struct parse *p)
+p_count(struct parse *p)
{
int count = 0;
int ndigits = 0;
- _DIAGASSERT(p != NULL);
-
- while (MORE() && isdigit((unsigned char)PEEK()) && count <= DUPMAX) {
+ while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) {
count = count*10 + (GETNEXT() - '0');
ndigits++;
}
- REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
+ (void)REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
return(count);
}
/*
- p_bracket - parse a bracketed character list
== static void p_bracket(struct parse *p);
- *
- * Note a significant property of this code: if the allocset() did SETERROR,
- * no set operations are done.
*/
static void
-p_bracket(
- struct parse *p)
+p_bracket(struct parse *p)
{
cset *cs;
- int invert = 0;
- _DIAGASSERT(p != NULL);
-
- cs = allocset(p);
- if (cs == NULL)
- return;
+ wint_t ch;
/* Dept of Truly Sickening Special-Case Kludges */
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]",
- (size_t)6) == 0) {
+ if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
EMIT(OBOW, 0);
NEXTn(6);
return;
}
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]",
- (size_t)6) == 0) {
+ if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
EMIT(OEOW, 0);
NEXTn(6);
return;
}
+ if ((cs = allocset(p)) == NULL)
+ return;
+
+ if (p->g->cflags®_ICASE)
+ cs->icase = 1;
if (EAT('^'))
- invert++; /* make note to invert set at end */
+ cs->invert = 1;
if (EAT(']'))
- CHadd(cs, ']');
+ CHadd(p, cs, ']');
else if (EAT('-'))
- CHadd(cs, '-');
+ CHadd(p, cs, '-');
while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
p_b_term(p, cs);
if (EAT('-'))
- CHadd(cs, '-');
- MUSTEAT(']', REG_EBRACK);
+ CHadd(p, cs, '-');
+ (void)MUSTEAT(']', REG_EBRACK);
if (p->error != 0) /* don't mess things up further */
return;
- if (p->g->cflags®_ICASE) {
- ssize_t i;
- int ci;
+ if (cs->invert && p->g->cflags®_NEWLINE)
+ cs->bmp['\n' >> 3] |= 1 << ('\n' & 7);
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i) && isalpha(i)) {
- ci = othercase((int)i);
- if (ci != i)
- CHadd(cs, ci);
- }
- if (cs->multis != NULL)
- mccase(p, cs);
- }
- if (invert) {
- ssize_t i;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i))
- CHsub(cs, (int)i);
- else
- CHadd(cs, (int)i);
- if (p->g->cflags®_NEWLINE)
- CHsub(cs, '\n');
- if (cs->multis != NULL)
- mcinvert(p, cs);
- }
-
- assert(cs->multis == NULL); /* xxx */
-
- if (nch(p, cs) == 1) { /* optimize singleton sets */
- ordinary(p, firstch(p, cs));
+ if ((ch = singleton(cs)) != OUT) { /* optimize singleton sets */
+ ordinary(p, ch);
freeset(p, cs);
} else
- EMIT(OANYOF, freezeset(p, cs));
+ EMIT(OANYOF, (size_t)(cs - p->g->sets));
+}
+
+static int
+p_range_cmp(wchar_t c1, wchar_t c2)
+{
+#ifdef REGEX_LIBC_COLLATE
+ return __wcollate_range_cmp(c1, c2);
+#elif defined(NLS)
+ /* Copied from libc/collate __wcollate_range_cmp */
+ wchar_t s1[2], s2[2];
+
+ s1[0] = c1;
+ s1[1] = L'\0';
+ s2[0] = c2;
+ s2[1] = L'\0';
+ return wcscoll(s1, s2);
+#else
+ char s1[2], s2[2];
+
+ s1[0] = (char)c1;
+ s1[1] = '\0';
+ s2[0] = (char)c2;
+ s2[1] = '\0';
+ return strcoll(s1, s2);
+#endif
}
/*
@@ -840,13 +1175,15 @@
== static void p_b_term(struct parse *p, cset *cs);
*/
static void
-p_b_term(
- struct parse *p,
- cset *cs)
+p_b_term(struct parse *p, cset *cs)
{
char c;
- char start, finish;
- int i;
+ wint_t start, finish;
+ wint_t i;
+#ifdef REGEX_LIBC_COLLATE
+ struct xlocale_collate *table =
+ (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE];
+#endif
_DIAGASSERT(p != NULL);
_DIAGASSERT(cs != NULL);
@@ -856,11 +1193,9 @@
case '[':
c = (MORE2()) ? PEEK2() : '\0';
break;
-
case '-':
SETERROR(REG_ERANGE);
return; /* NOTE RETURN */
-
default:
c = '\0';
break;
@@ -869,24 +1204,23 @@
switch (c) {
case ':': /* character class */
NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
+ (void)REQUIRE(MORE(), REG_EBRACK);
c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
+ (void)REQUIRE(c != '-' && c != ']', REG_ECTYPE);
p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
+ (void)REQUIRE(MORE(), REG_EBRACK);
+ (void)REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
break;
case '=': /* equivalence class */
NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
+ (void)REQUIRE(MORE(), REG_EBRACK);
c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
+ (void)REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
+ (void)REQUIRE(MORE(), REG_EBRACK);
+ (void)REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
break;
default: /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
start = p_b_symbol(p);
if (SEE('-') && MORE2() && PEEK2() != ']') {
/* range */
@@ -897,51 +1231,103 @@
finish = p_b_symbol(p);
} else
finish = start;
-/* xxx what about signed chars here... */
- REQUIRE(start <= finish, REG_ERANGE);
- for (i = start; i <= finish; i++)
- CHadd(cs, i);
+ if (start == finish)
+ CHadd(p, cs, start);
+ else {
+#ifdef REGEX_LIBC_COLLATE
+ if (table->__collate_load_error || MB_CUR_MAX > 1) {
+#else
+ if (MB_CUR_MAX > 1) {
+#endif
+ (void)REQUIRE(start <= finish, REG_ERANGE);
+ CHaddrange(p, cs, start, finish);
+ } else {
+ (void)REQUIRE(p_range_cmp(start, finish) <= 0, REG_ERANGE);
+ for (i = 0; i <= UCHAR_MAX; i++) {
+ if (p_range_cmp(start, i) <= 0 &&
+ p_range_cmp(i, finish) <= 0 )
+ CHadd(p, cs, i);
+ }
+ }
+ }
break;
}
}
+#ifdef REGEX_GNU_EXTENSIONS
+/*
+ - p_b_pseudoclass - parse a pseudo-class (\w, \W, \s, \S)
+ == static int p_b_pseudoclass(struct parse *p, char c)
+ */
+static int
+p_b_pseudoclass(struct parse *p, char c) {
+ cset *cs;
+
+ if ((cs = allocset(p)) == NULL)
+ return(0);
+
+ if (p->g->cflags®_ICASE)
+ cs->icase = 1;
+
+ switch (c) {
+ case 'W':
+ cs->invert = 1;
+ /* FALLTHROUGH */
+ case 'w':
+ p_b_cclass_named(p, cs, "alnum");
+ break;
+ case 'S':
+ cs->invert = 1;
+ /* FALLTHROUGH */
+ case 's':
+ p_b_cclass_named(p, cs, "space");
+ break;
+ default:
+ return(0);
+ }
+
+ EMIT(OANYOF, (size_t)(cs - p->g->sets));
+ return(1);
+}
+#endif
+
/*
- p_b_cclass - parse a character-class name and deal with it
== static void p_b_cclass(struct parse *p, cset *cs);
*/
static void
-p_b_cclass(
- struct parse *p,
- cset *cs)
+p_b_cclass(struct parse *p, cset *cs)
{
- const char *sp;
- const struct cclass *cp;
+ const char *sp = p->next;
size_t len;
- const char *u;
- char c;
+ char clname[16];
- _DIAGASSERT(p != NULL);
- _DIAGASSERT(cs != NULL);
-
- sp = p->next;
-
- while (MORE() && isalpha((unsigned char)PEEK()))
+ while (MORE() && isalpha((uch)PEEK()))
NEXT();
len = p->next - sp;
- for (cp = cclasses; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- break;
- if (cp->name == NULL) {
- /* oops, didn't find it */
+ if (len >= sizeof(clname) - 1) {
SETERROR(REG_ECTYPE);
return;
}
+ memcpy(clname, sp, len);
+ clname[len] = '\0';
- u = cp->chars;
- while ((c = *u++) != '\0')
- CHadd(cs, c);
- for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
- MCadd(p, cs, u);
+ p_b_cclass_named(p, cs, clname);
+}
+
+/*
+ - p_b_cclass_named - deal with a named character class
+ == static void p_b_cclass_named(struct parse *p, cset *cs, const char []);
+ */
+static void
+p_b_cclass_named(struct parse *p, cset *cs, const char clname[]) {
+ wctype_t wct;
+
+ if ((wct = wctype(clname)) == 0) {
+ SETERROR(REG_ECTYPE);
+ return;
+ }
+ CHaddtype(p, cs, wct);
}
/*
@@ -951,58 +1337,52 @@
* This implementation is incomplete. xxx
*/
static void
-p_b_eclass(
- struct parse *p,
- cset *cs)
+p_b_eclass(struct parse *p, cset *cs)
{
- char c;
+ wint_t c;
_DIAGASSERT(p != NULL);
_DIAGASSERT(cs != NULL);
c = p_b_coll_elem(p, '=');
- CHadd(cs, c);
+ CHadd(p, cs, c);
}
/*
- p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(struct parse *p);
+ == static wint_t p_b_symbol(struct parse *p);
*/
-static char /* value of symbol */
-p_b_symbol(
- struct parse *p)
+static wint_t /* value of symbol */
+p_b_symbol(struct parse *p)
{
- char value;
+ wint_t value;
_DIAGASSERT(p != NULL);
- REQUIRE(MORE(), REG_EBRACK);
+ (void)REQUIRE(MORE(), REG_EBRACK);
if (!EATTWO('[', '.'))
- return(GETNEXT());
+ return(WGETNEXT());
/* collating symbol */
value = p_b_coll_elem(p, '.');
- REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
+ (void)REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
return(value);
}
/*
- p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(struct parse *p, int endc);
+ == static wint_t p_b_coll_elem(struct parse *p, wint_t endc);
*/
-static char /* value of collating element */
-p_b_coll_elem(
- struct parse *p,
- int endc) /* name ended by endc,']' */
+static wint_t /* value of collating element */
+p_b_coll_elem(struct parse *p,
+ wint_t endc) /* name ended by endc,']' */
{
- const char *sp;
- const struct cname *cp;
+ const char *sp = p->next;
+ struct cname *cp;
size_t len;
_DIAGASSERT(p != NULL);
- sp = p->next;
-
while (MORE() && !SEETWO(endc, ']'))
NEXT();
if (!MORE()) {
@@ -1013,85 +1393,152 @@
for (cp = cnames; cp->name != NULL; cp++)
if (strncmp(cp->name, sp, len) == 0 && strlen(cp->name) == len)
return(cp->code); /* known name */
- if (len == 1)
- return(*sp); /* single character */
- SETERROR(REG_ECOLLATE); /* neither */
+#ifdef NLS
+ mbstate_t mbs;
+ wchar_t wc;
+ size_t clen;
+
+ memset(&mbs, 0, sizeof(mbs));
+ if ((clen = mbrtowc(&wc, sp, len, &mbs)) == len)
+ return (wc); /* single character */
+ else if (clen == (size_t)-1 || clen == (size_t)-2)
+ SETERROR(REG_ILLSEQ);
+ else
+ SETERROR(REG_ECOLLATE); /* neither */
return(0);
+#else
+ if (len == 1)
+ return *sp; /* single character */
+ SETERROR(REG_ECOLLATE); /* neither */
+ return 0;
+#endif
+}
+
+/*
+ - may_escape - determine whether 'ch' is escape-able in the current context
+ == static int may_escape(struct parse *p, const wint_t ch)
+ */
+static bool
+may_escape(struct parse *p, const wint_t ch)
+{
+
+ if ((p->pflags & PFLAG_LEGACY_ESC) != 0)
+ return (true);
+ if (isalpha(ch) || ch == '\'' || ch == '`')
+ return (false);
+ return (true);
+#ifdef NOTYET
+ /*
+ * Build a whitelist of characters that may be escaped to produce an
+ * ordinary in the current context. This assumes that these have not
+ * been otherwise interpreted as a special character. Escaping an
+ * ordinary character yields undefined results according to
+ * IEEE 1003.1-2008. Some extensions (notably, some GNU extensions) take
+ * advantage of this and use escaped ordinary characters to provide
+ * special meaning, e.g. \b, \B, \w, \W, \s, \S.
+ */
+ switch(ch) {
+ case '|':
+ case '+':
+ case '?':
+ /* The above characters may not be escaped in BREs */
+ if (!(p->g->cflags®_EXTENDED))
+ return (false);
+ /* Fallthrough */
+ case '(':
+ case ')':
+ case '{':
+ case '}':
+ case '.':
+ case '[':
+ case ']':
+ case '\\':
+ case '*':
+ case '^':
+ case '$':
+ return (true);
+ default:
+ return (false);
+ }
+#endif
}
/*
- othercase - return the case counterpart of an alphabetic
- == static int othercase(int ch);
+ == static wint_t othercase(wint_t ch);
*/
-static int /* if no counterpart, return ch */
-othercase(
- int ch)
+static wint_t /* if no counterpart, return ch */
+othercase(wint_t ch)
{
- assert(isalpha(ch));
- if (isupper(ch))
- return(tolower(ch));
- else if (islower(ch))
- return(toupper(ch));
+ assert(iswalpha(ch));
+ if (iswupper(ch))
+ return(towlower(ch));
+ else if (iswlower(ch))
+ return(towupper(ch));
else /* peculiar, but could happen */
return(ch);
}
/*
- bothcases - emit a dualcase version of a two-case character
- == static void bothcases(struct parse *p, int ch);
+ == static void bothcases(struct parse *p, wint_t ch);
*
* Boy, is this implementation ever a kludge...
*/
static void
-bothcases(
- struct parse *p,
- int ch)
+bothcases(struct parse *p, wint_t ch)
{
- const char *oldnext;
- const char *oldend;
- char bracket[3];
+ const char *oldnext = p->next;
+ const char *oldend = p->end;
+ char bracket[3 + MB_LEN_MAX];
+ size_t n;
_DIAGASSERT(p != NULL);
- oldnext = p->next;
- oldend = p->end;
-
assert(othercase(ch) != ch); /* p_bracket() would recurse */
p->next = bracket;
- p->end = bracket+2;
- bracket[0] = ch;
- bracket[1] = ']';
- bracket[2] = '\0';
+#ifdef NLS
+ mbstate_t mbs;
+ memset(&mbs, 0, sizeof(mbs));
+ n = wcrtomb(bracket, ch, &mbs);
+ assert(n != (size_t)-1);
+#else
+ n = 0;
+ bracket[n++] = ch;
+#endif
+ bracket[n] = ']';
+ bracket[n + 1] = '\0';
+ p->end = bracket+n+1;
p_bracket(p);
- assert(p->next == bracket+2);
+ assert(p->next == p->end);
p->next = oldnext;
p->end = oldend;
}
/*
- ordinary - emit an ordinary character
- == static void ordinary(struct parse *p, int ch);
+ == static void ordinary(struct parse *p, wint_t ch);
*/
static void
-ordinary(
- struct parse *p,
- int ch)
+ordinary(struct parse *p, wint_t ch)
{
- cat_t *cap;
- unsigned char uc = (unsigned char)ch;
+ cset *cs;
_DIAGASSERT(p != NULL);
- cap = p->g->categories;
- if ((p->g->cflags & REG_ICASE) && isalpha(uc) && othercase(uc) != uc)
- bothcases(p, uc);
+ if ((p->g->cflags®_ICASE) && iswalpha(ch) && othercase(ch) != ch)
+ bothcases(p, ch);
+ else if ((wint_t)(ch & OPDMASK) == ch)
+ EMIT(OCHAR, (size_t)ch);
else {
- EMIT(OCHAR, (sopno)uc);
- if (cap[uc] == 0) {
- _DIAGASSERT(__type_fit(unsigned char,
- p->g->ncategories + 1));
- cap[uc] = (unsigned char)p->g->ncategories++;
- }
+ /*
+ * Kludge: character is too big to fit into an OCHAR operand.
+ * Emit a singleton set.
+ */
+ if ((cs = allocset(p)) == NULL)
+ return;
+ CHadd(p, cs, ch);
+ EMIT(OANYOF, (size_t)(cs - p->g->sets));
}
}
@@ -1102,18 +1549,14 @@
* Boy, is this implementation ever a kludge...
*/
static void
-nonnewline(
- struct parse *p)
+nonnewline(struct parse *p)
{
- const char *oldnext;
- const char *oldend;
+ const char *oldnext = p->next;
+ const char *oldend = p->end;
char bracket[4];
_DIAGASSERT(p != NULL);
- oldnext = p->next;
- oldend = p->end;
-
p->next = bracket;
p->end = bracket+3;
bracket[0] = '^';
@@ -1128,18 +1571,15 @@
/*
- repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(struct parse *p, sopno start, int from, int to,
- == size_t reclimit);
+ == static void repeat(struct parse *p, sopno start, int from, int to);
*/
static void
-repeat(
- struct parse *p,
- sopno start, /* operand from here to end of strip */
- int from, /* repeated from this number */
- int to, /* to this number of times (maybe INFINITY) */
- size_t reclimit)
+repeat(struct parse *p,
+ sopno start, /* operand from here to end of strip */
+ int from, /* repeated from this number */
+ int to) /* to this number of times (maybe INFINITY) */
{
- sopno finish;
+ sopno finish = HERE();
# define N 2
# define INF 3
# define REP(f, t) ((f)*8 + (t))
@@ -1148,13 +1588,9 @@
_DIAGASSERT(p != NULL);
- if (reclimit++ > RECLIMIT)
- p->error = REG_ESPACE;
- if (p->error)
+ if (p->error != 0) /* head off possible runaway recursion */
return;
- finish = HERE();
-
assert(from <= to);
switch (REP(MAP(from), MAP(to))) {
@@ -1166,7 +1602,7 @@
case REP(0, INF): /* as x{1,}? */
/* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start+1, 1, to, reclimit);
+ repeat(p, start+1, 1, to);
ASTERN(OOR1, start);
AHEAD(start); /* ... fix it */
EMIT(OOR2, 0);
@@ -1186,7 +1622,7 @@
ASTERN(O_CH, THERETHERE());
copy = dupl(p, start+1, finish+1);
assert(copy == finish+4);
- repeat(p, copy, 1, to-1, reclimit);
+ repeat(p, copy, 1, to-1);
break;
case REP(1, INF): /* as x+ */
INSERT(OPLUS_, start);
@@ -1194,11 +1630,11 @@
break;
case REP(N, N): /* as xx{m-1,n-1} */
copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to-1, reclimit);
+ repeat(p, copy, from-1, to-1);
break;
case REP(N, INF): /* as xx{n-1,INF} */
copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to, reclimit);
+ repeat(p, copy, from-1, to);
break;
default: /* "can't happen" */
SETERROR(REG_ASSERT); /* just in case */
@@ -1207,13 +1643,39 @@
}
/*
+ - wgetnext - helper function for WGETNEXT() macro. Gets the next wide
+ - character from the parse struct, signals a REG_ILLSEQ error if the
+ - character can't be converted. Returns the number of bytes consumed.
+ */
+static wint_t
+wgetnext(struct parse *p)
+{
+#ifdef NLS
+ mbstate_t mbs;
+ wchar_t wc;
+ size_t n;
+
+ memset(&mbs, 0, sizeof(mbs));
+ n = mbrtowc(&wc, p->next, (size_t)(p->end - p->next), &mbs);
+ if (n == (size_t)-1 || n == (size_t)-2) {
+ SETERROR(REG_ILLSEQ);
+ return (0);
+ }
+ if (n == 0)
+ n = 1;
+ p->next += n;
+ return wc;
+#else
+ return *p->next++;
+#endif
+}
+
+/*
- seterr - set an error condition
== static int seterr(struct parse *p, int e);
*/
static int /* useless but makes type checking happy */
-seterr(
- struct parse *p,
- int e)
+seterr(struct parse *p, int e)
{
_DIAGASSERT(p != NULL);
@@ -1230,55 +1692,22 @@
== static cset *allocset(struct parse *p);
*/
static cset *
-allocset(
- struct parse *p)
+allocset(struct parse *p)
{
- size_t no;
- size_t nc;
- size_t nbytes;
- cset *cs;
- size_t css;
- size_t i;
- void *old_ptr;
+ cset *cs, *ncs;
_DIAGASSERT(p != NULL);
- no = p->g->ncsets++;
- css = (size_t)p->g->csetsize;
- if (no >= p->ncsalloc) { /* need another column of space */
- p->ncsalloc += CHAR_BIT;
- nc = p->ncsalloc;
- assert(nc % CHAR_BIT == 0);
- nbytes = nc / CHAR_BIT * css;
- if (MEMSIZE(p) > MEMLIMIT)
- goto oomem;
- if (reallocarr(&p->g->sets, nc, sizeof(cset)))
- goto oomem;
- old_ptr = p->g->setbits;
- if (reallocarr(&p->g->setbits, nc / CHAR_BIT, css)) {
- free(old_ptr);
- goto oomem;
- }
- if (old_ptr != p->g->setbits) {
- for (i = 0; i < no; i++)
- p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
- }
- (void) memset((char *)p->g->setbits + (nbytes - css), 0, css);
+ ncs = reallocarray(p->g->sets, p->g->ncsets + 1, sizeof(*ncs));
+ if (ncs == NULL) {
+ SETERROR(REG_ESPACE);
+ return (NULL);
}
-
- cs = &p->g->sets[no];
- cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
- cs->mask = 1 << (unsigned int)((no) % CHAR_BIT);
- cs->hash = 0;
- cs->smultis = 0;
- cs->multis = NULL;
+ p->g->sets = ncs;
+ cs = &p->g->sets[p->g->ncsets++];
+ memset(cs, 0, sizeof(*cs));
return(cs);
-
-oomem:
- SETERROR(REG_ESPACE);
- /* caller's responsibility not to do set ops */
- return NULL;
}
/*
@@ -1286,353 +1715,128 @@
== static void freeset(struct parse *p, cset *cs);
*/
static void
-freeset(
- struct parse *p,
- cset *cs)
+freeset(struct parse *p, cset *cs)
{
- size_t i;
cset *top;
- size_t css;
_DIAGASSERT(p != NULL);
_DIAGASSERT(cs != NULL);
top = &p->g->sets[p->g->ncsets];
- css = (size_t)p->g->csetsize;
- for (i = 0; i < css; i++)
- CHsub(cs, (int)i);
+ free(cs->wides);
+ free(cs->ranges);
+ free(cs->types);
+ memset(cs, 0, sizeof(*cs));
if (cs == top-1) /* recover only the easy case */
p->g->ncsets--;
}
/*
- - freezeset - final processing on a set of characters
- == static int freezeset(struct parse *p, cset *cs);
- *
- * The main task here is merging identical sets. This is usually a waste
- * of time (although the hash code minimizes the overhead), but can win
- * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash
- * is done using addition rather than xor -- all ASCII [aA] sets xor to
- * the same value!
+ - singleton - Determine whether a set contains only one character,
+ - returning it if so, otherwise returning OUT.
*/
-static sopno /* set number */
-freezeset(
- struct parse *p,
- cset *cs)
+static wint_t
+singleton(cset *cs)
{
- uch h;
- size_t i;
- cset *top;
- cset *cs2;
- size_t css;
+ wint_t i, s, n;
- _DIAGASSERT(p != NULL);
- _DIAGASSERT(cs != NULL);
-
- h = cs->hash;
- top = &p->g->sets[p->g->ncsets];
- css = (size_t)p->g->csetsize;
-
- /* look for an earlier one which is the same */
- for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
- if (cs2->hash == h && cs2 != cs) {
- /* maybe */
- for (i = 0; i < css; i++)
- if (!!CHIN(cs2, i) != !!CHIN(cs, i))
- break; /* no */
- if (i == css)
- break; /* yes */
- }
-
- if (cs2 < top) { /* found one */
- freeset(p, cs);
- cs = cs2;
- }
-
- return (sopno)(cs - p->g->sets);
-}
-
-/*
- - firstch - return first character in a set (which must have at least one)
- == static int firstch(struct parse *p, cset *cs);
- */
-static int /* character; there is no "none" value */
-firstch(
- struct parse *p,
- cset *cs)
-{
- size_t i;
- size_t css;
-
- _DIAGASSERT(p != NULL);
- _DIAGASSERT(cs != NULL);
-
- css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- return((char)i);
- assert(never);
- return(0); /* arbitrary */
-}
-
-/*
- - nch - number of characters in a set
- == static int nch(struct parse *p, cset *cs);
- */
-static int
-nch(
- struct parse *p,
- cset *cs)
-{
- size_t i;
- size_t css;
- int n = 0;
-
- _DIAGASSERT(p != NULL);
- _DIAGASSERT(cs != NULL);
-
- css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
+ for (i = n = 0; i < NC; i++)
+ if (CHIN(cs, i)) {
n++;
- return(n);
+ s = i;
+ }
+ if (n == 1)
+ return (s);
+ if (cs->nwides == 1 && cs->nranges == 0 && cs->ntypes == 0 &&
+ cs->icase == 0)
+ return (cs->wides[0]);
+ /* Don't bother handling the other cases. */
+ return (OUT);
}
/*
- - mcadd - add a collating element to a cset
- == static void mcadd(struct parse *p, cset *cs, \
- == char *cp);
+ - CHadd - add character to character set.
*/
static void
-mcadd(
- struct parse *p,
- cset *cs,
- const char *cp)
+CHadd(struct parse *p, cset *cs, wint_t ch)
{
- size_t oldend;
+ wint_t nch, *newwides;
_DIAGASSERT(p != NULL);
_DIAGASSERT(cs != NULL);
- _DIAGASSERT(cp != NULL);
- oldend = cs->smultis;
+ assert(ch >= 0);
+ if (ch < NC)
+ cs->bmp[(unsigned)ch >> 3] |= 1 << (ch & 7);
+ else {
+ newwides = reallocarray(cs->wides, cs->nwides + 1,
+ sizeof(*cs->wides));
+ if (newwides == NULL) {
+ SETERROR(REG_ESPACE);
+ return;
+ }
+ cs->wides = newwides;
+ cs->wides[cs->nwides++] = ch;
+ }
+ if (cs->icase) {
+ if ((nch = towlower(ch)) < NC)
+ cs->bmp[(unsigned)nch >> 3] |= 1 << (nch & 7);
+ if ((nch = towupper(ch)) < NC)
+ cs->bmp[(unsigned)nch >> 3] |= 1 << (nch & 7);
+ }
+}
- cs->smultis += strlen(cp) + 1;
- if (cs->multis == NULL)
- cs->multis = malloc(cs->smultis);
- else
- cs->multis = realloc(cs->multis, cs->smultis);
- if (cs->multis == NULL) {
+/*
+ - CHaddrange - add all characters in the range [min,max] to a character set.
+ */
+static void
+CHaddrange(struct parse *p, cset *cs, wint_t min, wint_t max)
+{
+ crange *newranges;
+
+ _DIAGASSERT(p != NULL);
+ _DIAGASSERT(cs != NULL);
+
+ for (; min < NC && min <= max; min++)
+ CHadd(p, cs, min);
+ if (min >= max)
+ return;
+ newranges = reallocarray(cs->ranges, cs->nranges + 1,
+ sizeof(*cs->ranges));
+ if (newranges == NULL) {
SETERROR(REG_ESPACE);
return;
}
-
- (void) strcpy(cs->multis + oldend - 1, cp);
- cs->multis[cs->smultis - 1] = '\0';
+ cs->ranges = newranges;
+ cs->ranges[cs->nranges].min = min;
+ cs->ranges[cs->nranges].max = max;
+ cs->nranges++;
}
-#if 0
/*
- - mcsub - subtract a collating element from a cset
- == static void mcsub(cset *cs, char *cp);
+ - CHaddtype - add all characters of a certain type to a character set.
*/
static void
-mcsub(
- cset *cs,
- char *cp)
+CHaddtype(struct parse *p, cset *cs, wctype_t wct)
{
- char *fp;
- size_t len;
+ wint_t i;
+ wctype_t *newtypes;
+ _DIAGASSERT(p != NULL);
_DIAGASSERT(cs != NULL);
- _DIAGASSERT(cp != NULL);
- fp = mcfind(cs, cp);
- len = strlen(fp);
-
- assert(fp != NULL);
- (void) memmove(fp, fp + len + 1,
- cs->smultis - (fp + len + 1 - cs->multis));
- cs->smultis -= len;
-
- if (cs->smultis == 0) {
- free(cs->multis);
- cs->multis = NULL;
+ for (i = 0; i < NC; i++)
+ if (iswctype(i, wct))
+ CHadd(p, cs, i);
+ newtypes = reallocarray(cs->types, cs->ntypes + 1,
+ sizeof(*cs->types));
+ if (newtypes == NULL) {
+ SETERROR(REG_ESPACE);
return;
}
-
- cs->multis = realloc(cs->multis, cs->smultis);
- assert(cs->multis != NULL);
-}
-
-/*
- - mcin - is a collating element in a cset?
- == static int mcin(cset *cs, char *cp);
- */
-static int
-mcin(
- cset *cs,
- char *cp)
-{
-
- _DIAGASSERT(cs != NULL);
- _DIAGASSERT(cp != NULL);
-
- return(mcfind(cs, cp) != NULL);
-}
-
-/*
- - mcfind - find a collating element in a cset
- == static char *mcfind(cset *cs, char *cp);
- */
-static char *
-mcfind(
- cset *cs,
- char *cp)
-{
- char *p;
-
- _DIAGASSERT(cs != NULL);
- _DIAGASSERT(cp != NULL);
-
- if (cs->multis == NULL)
- return(NULL);
- for (p = cs->multis; *p != '\0'; p += strlen(p) + 1)
- if (strcmp(cp, p) == 0)
- return(p);
- return(NULL);
-}
-#endif
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(struct parse *p, cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-/* ARGSUSED */
-static void
-mcinvert(
- struct parse *p,
- cset *cs)
-{
-
- _DIAGASSERT(p != NULL);
- _DIAGASSERT(cs != NULL);
-
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(struct parse *p, cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-/* ARGSUSED */
-static void
-mccase(
- struct parse *p,
- cset *cs)
-{
-
- _DIAGASSERT(p != NULL);
- _DIAGASSERT(cs != NULL);
-
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(struct re_guts *g, int c);
- */
-static int /* predicate */
-isinsets(
- struct re_guts *g,
- int c)
-{
- uch *col;
- size_t i;
- size_t ncols;
- unsigned uc = (unsigned char)c;
-
- _DIAGASSERT(g != NULL);
-
- if (g->setbits == NULL)
- return 0;
-
- ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc] != 0)
- return(1);
- return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(struct re_guts *g, int c1, int c2);
- */
-static int /* predicate */
-samesets(
- struct re_guts *g,
- int c1,
- int c2)
-{
- uch *col;
- size_t i;
- size_t ncols;
- unsigned uc1 = (unsigned char)c1;
- unsigned uc2 = (unsigned char)c2;
-
- _DIAGASSERT(g != NULL);
-
- ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc1] != col[uc2])
- return(0);
- return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, struct re_guts *g);
- */
-static void
-categorize(
- struct parse *p,
- struct re_guts *g)
-{
- cat_t *cats;
- int c;
- int c2;
- cat_t cat;
-
- _DIAGASSERT(p != NULL);
- _DIAGASSERT(g != NULL);
-
- cats = g->categories;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (cats[c] == 0 && isinsets(g, c)) {
- _DIAGASSERT(__type_fit(unsigned char,
- g->ncategories + 1));
- cat = g->ncategories++;
- cats[c] = cat;
- for (c2 = c+1; c2 <= CHAR_MAX; c2++)
- if (cats[c2] == 0 && samesets(g, c, c2))
- cats[c2] = cat;
- }
+ cs->types = newtypes;
+ cs->types[cs->ntypes++] = wct;
}
/*
@@ -1640,25 +1844,22 @@
== static sopno dupl(struct parse *p, sopno start, sopno finish);
*/
static sopno /* start of duplicate */
-dupl(
- struct parse *p,
- sopno start, /* from here */
- sopno finish) /* to this less one */
+dupl(struct parse *p,
+ sopno start, /* from here */
+ sopno finish) /* to this less one */
{
- sopno ret;
+ sopno ret = HERE();
sopno len = finish - start;
_DIAGASSERT(p != NULL);
- ret = HERE();
-
assert(finish >= start);
if (len == 0)
return(ret);
- if (!enlarge(p, p->ssize + len))/* this many unexpected additions */
- return ret;
- (void)memcpy(p->strip + p->slen, p->strip + start,
- (size_t)len * sizeof(sop));
+ if (!enlarge(p, p->ssize + len)) /* this many unexpected additions */
+ return(ret);
+ (void) memcpy(p->strip + p->slen,
+ p->strip + start, len * sizeof(*p->strip));
p->slen += len;
return(ret);
}
@@ -1672,17 +1873,14 @@
* some changes to the data structures. Maybe later.
*/
static void
-doemit(
- struct parse *p,
- sop op,
- sopno opnd)
+doemit(struct parse *p, sop op, size_t opnd)
{
- _DIAGASSERT(p != NULL);
-
/* avoid making error situations worse */
if (p->error != 0)
return;
+ _DIAGASSERT(p != NULL);
+
/* deal with oversize operands ("can't happen", more or less) */
assert(opnd < 1<<OPSHIFT);
@@ -1692,7 +1890,7 @@
return;
/* finally, it's all reduced to the easy case */
- p->strip[p->slen++] = (sop)SOP(op, opnd);
+ p->strip[p->slen++] = (sopno)SOP(op, opnd);
}
/*
@@ -1700,11 +1898,7 @@
== static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
*/
static void
-doinsert(
- struct parse *p,
- sop op,
- sopno opnd,
- sopno pos)
+doinsert(struct parse *p, sop op, size_t opnd, sopno pos)
{
sopno sn;
sop s;
@@ -1732,7 +1926,8 @@
}
}
- memmove(&p->strip[pos+1], &p->strip[pos], (HERE()-pos-1)*sizeof(sop));
+ memmove(&p->strip[pos+1], &p->strip[pos],
+ (HERE()-pos-1)*sizeof(*p->strip));
p->strip[pos] = s;
}
@@ -1741,10 +1936,7 @@
== static void dofwd(struct parse *p, sopno pos, sop value);
*/
static void
-dofwd(
- struct parse *p,
- sopno pos,
- sopno value)
+dofwd(struct parse *p, sopno pos, sop value)
{
_DIAGASSERT(p != NULL);
@@ -1754,25 +1946,29 @@
return;
assert(value < 1<<OPSHIFT);
- p->strip[pos] = (sop)(OP(p->strip[pos]) | value);
+ p->strip[pos] = OP(p->strip[pos]) | value;
}
/*
- enlarge - enlarge the strip
- == static void enlarge(struct parse *p, sopno size);
+ == static int enlarge(struct parse *p, sopno size);
*/
static int
enlarge(struct parse *p, sopno size)
{
+ sop *sp;
+
_DIAGASSERT(p != NULL);
if (p->ssize >= size)
return 1;
- if (MEMSIZE(p) > MEMLIMIT || reallocarr(&p->strip, size, sizeof(sop))) {
+ sp = reallocarray(p->strip, size, sizeof(*p->strip));
+ if (sp == NULL) {
SETERROR(REG_ESPACE);
return 0;
}
+ p->strip = sp;
p->ssize = size;
return 1;
}
@@ -1782,18 +1978,18 @@
== static void stripsnug(struct parse *p, struct re_guts *g);
*/
static void
-stripsnug(
- struct parse *p,
- struct re_guts *g)
+stripsnug(struct parse *p, struct re_guts *g)
{
_DIAGASSERT(p != NULL);
_DIAGASSERT(g != NULL);
g->nstates = p->slen;
- g->strip = p->strip;
- reallocarr(&g->strip, p->slen, sizeof(sop));
- /* Ignore error as tries to free memory only. */
+ g->strip = reallocarray(p->strip, p->slen, sizeof(*p->strip));
+ if (g->strip == NULL) {
+ SETERROR(REG_ESPACE);
+ g->strip = p->strip;
+ }
}
/*
@@ -1807,9 +2003,7 @@
* Note that must and mlen got initialized during setup.
*/
static void
-findmust(
- struct parse *p,
- struct re_guts *g)
+findmust(struct parse *p, struct re_guts *g)
{
sop *scan;
sop *start = NULL;
@@ -1817,7 +2011,8 @@
sopno newlen;
sop s;
char *cp;
- sopno i;
+ int offset;
+ mbstate_t mbs;
_DIAGASSERT(p != NULL);
_DIAGASSERT(g != NULL);
@@ -1826,16 +2021,39 @@
if (p->error != 0)
return;
+#ifdef notyet
+ /*
+ * It's not generally safe to do a ``char'' substring search on
+ * multibyte character strings, but it's safe for at least
+ * UTF-8 (see RFC 3629).
+ */
+ if (MB_CUR_MAX > 1 &&
+ strcmp(_CurrentRuneLocale->__encoding, "UTF-8") != 0)
+ return;
+#endif
+
/* find the longest OCHAR sequence in strip */
newlen = 0;
+ offset = 0;
+ g->moffset = 0;
scan = g->strip + 1;
do {
s = *scan++;
switch (OP(s)) {
case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
+ if (newlen == 0) { /* new sequence */
+ memset(&mbs, 0, sizeof(mbs));
newstart = scan - 1;
+ }
+#ifdef NLS
+ char buf[MB_LEN_MAX];
+ size_t clen = wcrtomb(buf, (int)OPND(s), &mbs);
+ if (clen == (size_t)-1)
+ goto toohard;
+ newlen += (sopno)clen;
+#else
newlen++;
+#endif
break;
case OPLUS_: /* things that don't break one */
case OLPAREN:
@@ -1843,60 +2061,346 @@
break;
case OQUEST_: /* things that must be skipped */
case OCH_:
+ offset = altoffset(scan, offset);
scan--;
do {
scan += OPND(s);
s = *scan;
/* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2) {
+ if (OP(s) != O_QUEST &&
+ OP(s) != O_CH && OP(s) != OOR2) {
g->iflags |= BAD;
return;
}
} while (OP(s) != O_QUEST && OP(s) != O_CH);
/* FALLTHROUGH */
- default: /* things that break a sequence */
- if (newlen > g->mlen) { /* ends one */
+ case OBOW: /* things that break a sequence */
+ case OEOW:
+ case OBOL:
+ case OEOL:
+ case OBOS:
+ case OEOS:
+ case OWBND:
+ case ONWBND:
+ case O_QUEST:
+ case O_CH:
+ case OEND:
+ if (newlen > (sopno)g->mlen) { /* ends one */
start = newstart;
g->mlen = newlen;
+ if (offset > -1) {
+ g->moffset += offset;
+ offset = newlen;
+ } else
+ g->moffset = offset;
+ } else {
+ if (offset > -1)
+ offset += newlen;
}
newlen = 0;
break;
+ case OANY:
+ if (newlen > (sopno)g->mlen) { /* ends one */
+ start = newstart;
+ g->mlen = newlen;
+ if (offset > -1) {
+ g->moffset += offset;
+ offset = newlen;
+ } else
+ g->moffset = offset;
+ } else {
+ if (offset > -1)
+ offset += newlen;
+ }
+ if (offset > -1)
+ offset++;
+ newlen = 0;
+ break;
+ case OANYOF: /* may or may not invalidate offset */
+ /* First, everything as OANY */
+ if (newlen > (sopno)g->mlen) { /* ends one */
+ start = newstart;
+ g->mlen = newlen;
+ if (offset > -1) {
+ g->moffset += offset;
+ offset = newlen;
+ } else
+ g->moffset = offset;
+ } else {
+ if (offset > -1)
+ offset += newlen;
+ }
+ if (offset > -1)
+ offset++;
+ newlen = 0;
+ break;
+#ifdef NLS
+ toohard:/*FALLTHROUGH*/
+#endif
+ default:
+ /* Anything here makes it impossible or too hard
+ * to calculate the offset -- so we give up;
+ * save the last known good offset, in case the
+ * must sequence doesn't occur later.
+ */
+ if (newlen > (sopno)g->mlen) { /* ends one */
+ start = newstart;
+ g->mlen = newlen;
+ if (offset > -1)
+ g->moffset += offset;
+ else
+ g->moffset = offset;
+ }
+ offset = -1;
+ newlen = 0;
+ break;
}
} while (OP(s) != OEND);
- if (start == NULL)
- g->mlen = 0;
-
- if (g->mlen == 0) /* there isn't one */
+ if (g->mlen == 0) { /* there isn't one */
+ g->moffset = -1;
return;
+ }
/* turn it into a character string */
g->must = malloc((size_t)g->mlen + 1);
if (g->must == NULL) { /* argh; just forget it */
g->mlen = 0;
+ g->moffset = -1;
return;
}
cp = g->must;
scan = start;
- for (i = g->mlen; i > 0; i--) {
+ memset(&mbs, 0, sizeof(mbs));
+ while (cp < g->must + g->mlen) {
while (OP(s = *scan++) != OCHAR)
continue;
- assert(cp < g->must + g->mlen);
- *cp++ = (char)OPND(s);
+#ifdef NLS
+ size_t clen = wcrtomb(cp, (int)OPND(s), &mbs);
+ assert(clen != (size_t)-1);
+ cp += clen;
+#else
+ *cp++ = OPND(s);
+#endif
}
assert(cp == g->must + g->mlen);
*cp++ = '\0'; /* just on general principles */
}
/*
+ - altoffset - choose biggest offset among multiple choices
+ == static int altoffset(sop *scan, int offset);
+ *
+ * Compute, recursively if necessary, the largest offset among multiple
+ * re paths.
+ */
+static int
+altoffset(sop *scan, int offset)
+{
+ int largest;
+ int try;
+ sop s;
+
+ _DIAGASSERT(scan != NULL);
+
+ /* If we gave up already on offsets, return */
+ if (offset == -1)
+ return -1;
+
+ largest = 0;
+ try = 0;
+ s = *scan++;
+ while (OP(s) != O_QUEST && OP(s) != O_CH) {
+ switch (OP(s)) {
+ case OOR1:
+ if (try > largest)
+ largest = try;
+ try = 0;
+ break;
+ case OQUEST_:
+ case OCH_:
+ try = altoffset(scan, try);
+ if (try == -1)
+ return -1;
+ scan--;
+ do {
+ scan += OPND(s);
+ s = *scan;
+ if (OP(s) != O_QUEST &&
+ OP(s) != O_CH && OP(s) != OOR2)
+ return -1;
+ } while (OP(s) != O_QUEST && OP(s) != O_CH);
+ /* We must skip to the next position, or we'll
+ * leave altoffset() too early.
+ */
+ scan++;
+ break;
+ case OANYOF:
+ case OCHAR:
+ case OANY:
+ try++;
+ /*FALLTHROUGH*/
+ case OBOW:
+ case OEOW:
+ case OWBND:
+ case ONWBND:
+ case OLPAREN:
+ case ORPAREN:
+ case OOR2:
+ break;
+ default:
+ try = -1;
+ break;
+ }
+ if (try == -1)
+ return -1;
+ s = *scan++;
+ }
+
+ if (try > largest)
+ largest = try;
+
+ return largest+offset;
+}
+
+/*
+ - computejumps - compute char jumps for BM scan
+ == static void computejumps(struct parse *p, struct re_guts *g);
+ *
+ * This algorithm assumes g->must exists and is has size greater than
+ * zero. It's based on the algorithm found on Computer Algorithms by
+ * Sara Baase.
+ *
+ * A char jump is the number of characters one needs to jump based on
+ * the value of the character from the text that was mismatched.
+ */
+static void
+computejumps(struct parse *p, struct re_guts *g)
+{
+ int ch;
+ size_t mindex;
+
+ _DIAGASSERT(p != NULL);
+ _DIAGASSERT(g != NULL);
+
+ /* Avoid making errors worse */
+ if (p->error != 0)
+ return;
+
+ g->charjump = calloc((NC_MAX + 1), sizeof(*g->charjump));
+ if (g->charjump == NULL) /* Not a fatal error */
+ return;
+ /* Adjust for signed chars, if necessary */
+ g->charjump = &g->charjump[-(CHAR_MIN)];
+
+ /* If the character does not exist in the pattern, the jump
+ * is equal to the number of characters in the pattern.
+ */
+ for (ch = CHAR_MIN; ch < (CHAR_MAX + 1); ch++)
+ g->charjump[ch] = g->mlen;
+
+ /* If the character does exist, compute the jump that would
+ * take us to the last character in the pattern equal to it
+ * (notice that we match right to left, so that last character
+ * is the first one that would be matched).
+ */
+ for (mindex = 0; mindex < g->mlen; mindex++)
+ g->charjump[(int)g->must[mindex]] = g->mlen - mindex - 1;
+}
+
+/*
+ - computematchjumps - compute match jumps for BM scan
+ == static void computematchjumps(struct parse *p, struct re_guts *g);
+ *
+ * This algorithm assumes g->must exists and is has size greater than
+ * zero. It's based on the algorithm found on Computer Algorithms by
+ * Sara Baase.
+ *
+ * A match jump is the number of characters one needs to advance based
+ * on the already-matched suffix.
+ * Notice that all values here are minus (g->mlen-1), because of the way
+ * the search algorithm works.
+ */
+static void
+computematchjumps(struct parse *p, struct re_guts *g)
+{
+ size_t mindex; /* General "must" iterator */
+ size_t suffix; /* Keeps track of matching suffix */
+ size_t ssuffix; /* Keeps track of suffixes' suffix */
+ size_t* pmatches; /* pmatches[k] points to the next i
+ * such that i+1...mlen is a substring
+ * of k+1...k+mlen-i-1
+ */
+
+ _DIAGASSERT(p != NULL);
+ _DIAGASSERT(g != NULL);
+
+ /* Avoid making errors worse */
+ if (p->error != 0)
+ return;
+
+ pmatches = calloc(g->mlen, sizeof(*pmatches));
+ if (pmatches == NULL) {
+ g->matchjump = NULL;
+ return;
+ }
+
+ g->matchjump = calloc(g->mlen, sizeof(*g->matchjump));
+ if (g->matchjump == NULL) { /* Not a fatal error */
+ free(pmatches);
+ return;
+ }
+
+ /* Set maximum possible jump for each character in the pattern */
+ for (mindex = 0; mindex < g->mlen; mindex++)
+ g->matchjump[mindex] = 2 * g->mlen - mindex - 1;
+
+ /* Compute pmatches[] */
+ for (suffix = mindex = g->mlen; mindex-- > 0; suffix--) {
+ pmatches[mindex] = suffix;
+
+ /* If a mismatch is found, interrupting the substring,
+ * compute the matchjump for that position. If no
+ * mismatch is found, then a text substring mismatched
+ * against the suffix will also mismatch against the
+ * substring.
+ */
+ while (suffix < g->mlen
+ && g->must[mindex] != g->must[suffix]) {
+ g->matchjump[suffix] = MIN(g->matchjump[suffix],
+ g->mlen - mindex - 1);
+ suffix = pmatches[suffix];
+ }
+ }
+
+ /* Compute the matchjump up to the last substring found to jump
+ * to the beginning of the largest must pattern prefix matching
+ * it's own suffix.
+ */
+ for (mindex = 0; mindex <= suffix; mindex++)
+ g->matchjump[mindex] = MIN(g->matchjump[mindex],
+ g->mlen + suffix - mindex);
+
+ ssuffix = pmatches[suffix];
+ while (suffix < g->mlen) {
+ while (suffix <= ssuffix && suffix < g->mlen) {
+ g->matchjump[suffix] = MIN(g->matchjump[suffix],
+ g->mlen + ssuffix - suffix);
+ suffix++;
+ }
+ if (suffix < g->mlen)
+ ssuffix = pmatches[ssuffix];
+ }
+
+ free(pmatches);
+}
+
+/*
- pluscount - count + nesting
== static sopno pluscount(struct parse *p, struct re_guts *g);
*/
static sopno /* nesting depth */
-pluscount(
- struct parse *p,
- struct re_guts *g)
+pluscount(struct parse *p, struct re_guts *g)
{
sop *scan;
sop s;
diff --git a/libc/upstream-netbsd/lib/libc/regex/regerror.c b/libc/upstream-netbsd/lib/libc/regex/regerror.c
index e00d7c0..cfd7704 100644
--- a/libc/upstream-netbsd/lib/libc/regex/regerror.c
+++ b/libc/upstream-netbsd/lib/libc/regex/regerror.c
@@ -1,6 +1,9 @@
-/* $NetBSD: regerror.c,v 1.23 2007/02/09 23:44:18 junyoung Exp $ */
+/* $NetBSD: regerror.c,v 1.26 2022/11/05 11:33:55 riastradh Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -34,76 +37,38 @@
* @(#)regerror.c 8.4 (Berkeley) 3/20/94
*/
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)regerror.c 8.4 (Berkeley) 3/20/94
- */
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
-#else
-__RCSID("$NetBSD: regerror.c,v 1.23 2007/02/09 23:44:18 junyoung Exp $");
+__FBSDID("$FreeBSD: head/lib/libc/regex/regerror.c 326025 2017-11-20 19:49:47Z pfg $");
#endif
-#endif /* LIBC_SCCS and not lint */
+__RCSID("$NetBSD: regerror.c,v 1.26 2022/11/05 11:33:55 riastradh Exp $");
#include "namespace.h"
#include <sys/types.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <limits.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
+#include <limits.h>
+#include <stdlib.h>
#include <regex.h>
+#include "utils.h"
+
#ifdef __weak_alias
__weak_alias(regerror,_regerror)
#endif
-#include "utils.h"
-
/* ========= begin header generated by ./mkh ========= */
#ifdef __cplusplus
extern "C" {
#endif
/* === regerror.c === */
-static const char *regatoi(const regex_t *preg, char *localbuf, size_t buflen);
+static const char *regatoi(const regex_t *preg, char *localbufm, size_t buflen);
#ifdef __cplusplus
}
@@ -126,6 +91,8 @@
= #define REG_EMPTY 14
= #define REG_ASSERT 15
= #define REG_INVARG 16
+ = #define REG_ENOSYS 17
+ = #define REG_ILLSEQ 18
= #define REG_ATOI 255 // convert name to number (!)
= #define REG_ITOA 0400 // convert number to name (!)
*/
@@ -134,36 +101,36 @@
const char *name;
const char *explain;
} rerrs[] = {
- { REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match" },
- { REG_BADPAT, "REG_BADPAT", "invalid regular expression" },
- { REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" },
- { REG_ECTYPE, "REG_ECTYPE", "invalid character class" },
- { REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)" },
- { REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" },
- { REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced" },
- { REG_EPAREN, "REG_EPAREN", "parentheses not balanced" },
- { REG_EBRACE, "REG_EBRACE", "braces not balanced" },
- { REG_BADBR, "REG_BADBR", "invalid repetition count(s)" },
- { REG_ERANGE, "REG_ERANGE", "invalid character range" },
- { REG_ESPACE, "REG_ESPACE", "out of memory" },
- { REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid" },
- { REG_EMPTY, "REG_EMPTY", "empty (sub)expression" },
- { REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug" },
- { REG_INVARG, "REG_INVARG", "invalid argument to regex routine" },
- { 0, "", "*** unknown regexp error code ***" }
+ {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
+ {REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
+ {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
+ {REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
+ {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
+ {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
+ {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
+ {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
+ {REG_EBRACE, "REG_EBRACE", "braces not balanced"},
+ {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
+ {REG_ERANGE, "REG_ERANGE", "invalid character range"},
+ {REG_ESPACE, "REG_ESPACE", "out of memory"},
+ {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
+ {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
+ {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
+ {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
+ {REG_ILLSEQ, "REG_ILLSEQ", "illegal byte sequence"},
+ {0, "", "*** unknown regexp error code ***"}
};
/*
- * regerror - the interface to error numbers
- * extern size_t regerror(int, const regex_t *, char *, size_t);
+ - regerror - the interface to error numbers
+ = extern size_t regerror(int, const regex_t *, char *, size_t);
*/
/* ARGSUSED */
size_t
-regerror(
- int errcode,
- const regex_t *preg,
- char *errbuf,
- size_t errbuf_size)
+regerror(int errcode,
+ const regex_t * __restrict preg,
+ char * __restrict errbuf,
+ size_t errbuf_size)
{
const struct rerr *r;
size_t len;
@@ -172,21 +139,20 @@
char convbuf[50];
_DIAGASSERT(errcode != REG_ATOI || preg != NULL);
- _DIAGASSERT(errbuf != NULL);
+ _DIAGASSERT(errbuf_size == 0 || errbuf != NULL);
- if (errcode == REG_ATOI)
+ if (errcode == REG_ATOI) {
s = regatoi(preg, convbuf, sizeof convbuf);
- else {
+ } else {
for (r = rerrs; r->code != 0; r++)
if (r->code == target)
break;
-
- if (errcode & REG_ITOA) {
- if (r->code != 0) {
- (void)strlcpy(convbuf, r->name, sizeof convbuf);
- } else
- (void)snprintf(convbuf, sizeof convbuf,
- "REG_0x%x", target);
+
+ if (errcode®_ITOA) {
+ if (r->code != 0)
+ (void) strlcpy(convbuf, r->name, sizeof(convbuf));
+ else
+ snprintf(convbuf, sizeof(convbuf), "REG_0x%x", target);
s = convbuf;
} else
s = r->explain;
@@ -194,21 +160,17 @@
len = strlen(s) + 1;
if (errbuf_size > 0)
- (void)strlcpy(errbuf, s, errbuf_size);
+ (void) strlcpy(errbuf, s, errbuf_size);
return(len);
}
/*
- * regatoi - internal routine to implement REG_ATOI
- * static const char *regatoi(const regex_t *preg, char *localbuf,
- * size_t buflen);
+ - regatoi - internal routine to implement REG_ATOI
+ == static char *regatoi(const regex_t *preg, char *localbuf);
*/
static const char *
-regatoi(
- const regex_t *preg,
- char *localbuf,
- size_t buflen)
+regatoi(const regex_t *preg, char *localbuf, size_t buflen)
{
const struct rerr *r;
@@ -218,6 +180,6 @@
if (r->code == 0)
return "0";
- (void)snprintf(localbuf, buflen, "%d", r->code);
+ snprintf(localbuf, buflen, "%d", r->code);
return localbuf;
}
diff --git a/libc/upstream-netbsd/lib/libc/regex/regex2.h b/libc/upstream-netbsd/lib/libc/regex/regex2.h
index 7c877ee..fbfff0d 100644
--- a/libc/upstream-netbsd/lib/libc/regex/regex2.h
+++ b/libc/upstream-netbsd/lib/libc/regex/regex2.h
@@ -1,6 +1,9 @@
-/* $NetBSD: regex2.h,v 1.13 2011/10/09 18:23:00 christos Exp $ */
+/* $NetBSD: regex2.h,v 1.15 2021/02/24 18:13:21 christos Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -32,43 +35,7 @@
* SUCH DAMAGE.
*
* @(#)regex2.h 8.4 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)regex2.h 8.4 (Berkeley) 3/20/94
+ * $FreeBSD: head/lib/libc/regex/regex2.h 368359 2020-12-05 03:18:48Z kevans $
*/
/*
@@ -109,68 +76,100 @@
* In state representations, an operator's bit is on to signify a state
* immediately *preceding* "execution" of that operator.
*/
-typedef u_int32_t sop; /* strip operator */
-typedef size_t sopno;
-#define OPRMASK ((u_int32_t)0xf8000000UL)
-#define OPDMASK ((u_int32_t)0x07ffffffUL)
-#define OPSHIFT ((unsigned)27)
+typedef uint32_t sop; /* strip operator */
+typedef uint32_t sopno;
+#define OPRMASK 0xf8000000U
+#define OPDMASK 0x07ffffffU
+#define OPSHIFT (27U)
#define OP(n) ((n)&OPRMASK)
-#define OPND(n) ((int)((n)&OPDMASK))
+#define OPND(n) ((n)&OPDMASK)
#define SOP(op, opnd) ((op)|(opnd))
-
-#define OPC(n) (((u_int32_t)(n))<<OPSHIFT)
-/* operators meaning operand */
-/* (back, fwd are offsets) */
-#define OEND OPC(1) /* endmarker - */
-#define OCHAR OPC(2) /* character unsigned char */
-#define OBOL OPC(3) /* left anchor - */
-#define OEOL OPC(4) /* right anchor - */
-#define OANY OPC(5) /* . - */
-#define OANYOF OPC(6) /* [...] set number */
-#define OBACK_ OPC(7) /* begin \d paren number */
-#define O_BACK OPC(8) /* end \d paren number */
-#define OPLUS_ OPC(9) /* + prefix fwd to suffix */
-#define O_PLUS OPC(10) /* + suffix back to prefix */
-#define OQUEST_ OPC(11) /* ? prefix fwd to suffix */
-#define O_QUEST OPC(12) /* ? suffix back to prefix */
-#define OLPAREN OPC(13) /* ( fwd to ) */
-#define ORPAREN OPC(14) /* ) back to ( */
-#define OCH_ OPC(15) /* begin choice fwd to OOR2 */
-#define OOR1 OPC(16) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 OPC(17) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH OPC(18) /* end choice back to OOR1 */
-#define OBOW OPC(19) /* begin word - */
-#define OEOW OPC(20) /* end word - */
+/* operators meaning operand */
+/* (back, fwd are offsets) */
+#define OEND (1U<<OPSHIFT) /* endmarker - */
+#define OCHAR (2U<<OPSHIFT) /* character wide character */
+#define OBOL (3U<<OPSHIFT) /* left anchor - */
+#define OEOL (4U<<OPSHIFT) /* right anchor - */
+#define OANY (5U<<OPSHIFT) /* . - */
+#define OANYOF (6U<<OPSHIFT) /* [...] set number */
+#define OBACK_ (7U<<OPSHIFT) /* begin \d paren number */
+#define O_BACK (8U<<OPSHIFT) /* end \d paren number */
+#define OPLUS_ (9U<<OPSHIFT) /* + prefix fwd to suffix */
+#define O_PLUS (10U<<OPSHIFT) /* + suffix back to prefix */
+#define OQUEST_ (11U<<OPSHIFT) /* ? prefix fwd to suffix */
+#define O_QUEST (12U<<OPSHIFT) /* ? suffix back to prefix */
+#define OLPAREN (13U<<OPSHIFT) /* ( fwd to ) */
+#define ORPAREN (14U<<OPSHIFT) /* ) back to ( */
+#define OCH_ (15U<<OPSHIFT) /* begin choice fwd to OOR2 */
+#define OOR1 (16U<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
+#define OOR2 (17U<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
+#define O_CH (18U<<OPSHIFT) /* end choice back to OOR1 */
+#define OBOW (19U<<OPSHIFT) /* begin word - */
+#define OEOW (20U<<OPSHIFT) /* end word - */
+#define OBOS (21U<<OPSHIFT) /* begin subj. - */
+#define OEOS (22U<<OPSHIFT) /* end subj. - */
+#define OWBND (23U<<OPSHIFT) /* word bound - */
+#define ONWBND (24U<<OPSHIFT) /* not bound - */
/*
- * Structure for [] character-set representation. Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte. A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements. As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
+ * Structures for [] character-set representation.
*/
typedef struct {
- uch *ptr; /* -> uch [csetsize] */
- uch mask; /* bit within array */
- uch hash; /* hash code */
- size_t smultis;
- char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
+ wint_t min;
+ wint_t max;
+} crange;
+typedef struct {
+ unsigned char bmp[NC_MAX / 8];
+ wctype_t *types;
+ unsigned int ntypes;
+ wint_t *wides;
+ unsigned int nwides;
+ crange *ranges;
+ unsigned int nranges;
+ int invert;
+ int icase;
} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
-#define MCsub(p, cs, cp) mcsub(p, cs, cp)
-#define MCin(p, cs, cp) mcin(p, cs, cp)
-/* stuff for character categories */
-typedef unsigned char cat_t;
+static int
+CHIN1(cset *cs, wint_t ch)
+{
+ unsigned int i;
+
+ assert(ch >= 0);
+ if (ch < NC)
+ return (((cs->bmp[(unsigned)ch >> 3] & (1 << (ch & 7))) != 0) ^
+ cs->invert);
+ for (i = 0; i < cs->nwides; i++) {
+ if (cs->icase) {
+ if (ch == towlower(cs->wides[i]) ||
+ ch == towupper(cs->wides[i]))
+ return (!cs->invert);
+ } else if (ch == cs->wides[i])
+ return (!cs->invert);
+ }
+ for (i = 0; i < cs->nranges; i++)
+ if (cs->ranges[i].min <= ch && ch <= cs->ranges[i].max)
+ return (!cs->invert);
+ for (i = 0; i < cs->ntypes; i++)
+ if (iswctype(ch, cs->types[i]))
+ return (!cs->invert);
+ return (cs->invert);
+}
+
+static __inline int
+CHIN(cset *cs, wint_t ch)
+{
+
+ assert(ch >= 0);
+ if (ch < NC)
+ return (((cs->bmp[(unsigned)ch >> 3] & (1 << (ch & 7))) != 0) ^
+ cs->invert);
+ else if (cs->icase)
+ return (CHIN1(cs, ch) || CHIN1(cs, towlower(ch)) ||
+ CHIN1(cs, towupper(ch)));
+ else
+ return (CHIN1(cs, ch));
+}
/*
* main compiled-expression structure
@@ -179,10 +178,8 @@
int magic;
# define MAGIC2 ((('R'^0200)<<8)|'E')
sop *strip; /* malloced area for strip */
- size_t csetsize; /* number of bits in a cset vector */
size_t ncsets; /* number of csets in use */
cset *sets; /* -> cset [ncsets] */
- uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
int cflags; /* copy of regcomp() cflags argument */
sopno nstates; /* = number of sops */
sopno firststate; /* the initial OEND (normally 0) */
@@ -193,17 +190,17 @@
# define BAD 04 /* something wrong */
size_t nbol; /* number of ^ used */
size_t neol; /* number of $ used */
- size_t ncategories; /* how many character categories */
- cat_t *categories; /* ->catspace[-CHAR_MIN] */
char *must; /* match must contain this string */
+ int moffset; /* latest point at which must may be located */
+ size_t *charjump; /* Boyer-Moore char jump table */
+ size_t *matchjump; /* Boyer-Moore match jump table */
size_t mlen; /* length of must */
size_t nsub; /* copy of re_nsub */
int backrefs; /* does it use back references? */
sopno nplus; /* how deep does it nest +s? */
- /* catspace must be last */
- cat_t catspace[1]; /* actually [NC] */
};
/* misc utilities */
-#define OUT (CHAR_MAX+1) /* a non-character value */
-#define ISWORD(c) (isalnum((unsigned char)c) || (c) == '_')
+#define OUT (CHAR_MIN - 1) /* a non-character value */
+#define IGN (CHAR_MIN - 2)
+#define ISWORD(c) (iswalnum((uch)(c)) || (c) == '_')
diff --git a/libc/upstream-netbsd/lib/libc/regex/regexec.c b/libc/upstream-netbsd/lib/libc/regex/regexec.c
index f16e0b6..213a90b 100644
--- a/libc/upstream-netbsd/lib/libc/regex/regexec.c
+++ b/libc/upstream-netbsd/lib/libc/regex/regexec.c
@@ -1,6 +1,9 @@
-/* $NetBSD: regexec.c,v 1.22 2012/03/13 21:13:43 christos Exp $ */
+/* $NetBSD: regexec.c,v 1.26 2021/02/26 19:24:47 christos Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -34,91 +37,96 @@
* @(#)regexec.c 8.3 (Berkeley) 3/20/94
*/
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)regexec.c 8.3 (Berkeley) 3/20/94
- */
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
-#else
-__RCSID("$NetBSD: regexec.c,v 1.22 2012/03/13 21:13:43 christos Exp $");
+__FBSDID("$FreeBSD: head/lib/libc/regex/regexec.c 326025 2017-11-20 19:49:47Z pfg $");
#endif
-#endif /* LIBC_SCCS and not lint */
+__RCSID("$NetBSD: regexec.c,v 1.26 2021/02/26 19:24:47 christos Exp $");
/*
* the outer shell of regexec()
*
- * This file includes engine.c *twice*, after muchos fiddling with the
+ * This file includes engine.c three times, after muchos fiddling with the
* macros that code uses. This lets the same code operate on two different
- * representations for state sets.
+ * representations for state sets and characters.
*/
-#include "namespace.h"
-#include <sys/types.h>
-#include <assert.h>
-#include <ctype.h>
-#include <limits.h>
+#ifndef LIBHACK
+#include "namespace.h"
+#endif
+#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
+#include <ctype.h>
#include <regex.h>
-#ifdef __weak_alias
+#if defined(__weak_alias) && !defined(LIBHACK)
__weak_alias(regexec,_regexec)
#endif
#include "utils.h"
#include "regex2.h"
+static __inline size_t
+xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy)
+{
+#ifdef NLS
+ size_t nr;
+ wchar_t wc;
+
+ nr = mbrtowc(&wc, s, n, mbs);
+ if (wi != NULL)
+ *wi = wc;
+ if (nr == 0)
+ return (1);
+ else if (nr == (size_t)-1 || nr == (size_t)-2) {
+ memset(mbs, 0, sizeof(*mbs));
+ if (wi != NULL)
+ *wi = dummy;
+ return (1);
+ } else
+ return (nr);
+#else
+ if (wi)
+ *wi = *s;
+ return 1;
+#endif
+}
+
+static __inline size_t
+xmbrtowc_dummy(wint_t *wi,
+ const char *s,
+ size_t n __unused,
+ mbstate_t *mbs __unused,
+ wint_t dummy __unused)
+{
+
+ if (wi != NULL)
+ *wi = (unsigned char)*s;
+ return (1);
+}
+
/* macros for manipulating states, small version */
-#define states unsigned long
-#define states1 unsigned long /* for later use in regexec() decision */
+#define states long
+#define states1 states /* for later use in regexec() decision */
#define CLEAR(v) ((v) = 0)
#define SET0(v, n) ((v) &= ~((unsigned long)1 << (n)))
#define SET1(v, n) ((v) |= (unsigned long)1 << (n))
#define ISSET(v, n) (((v) & ((unsigned long)1 << (n))) != 0)
#define ASSIGN(d, s) ((d) = (s))
#define EQ(a, b) ((a) == (b))
-#define STATEVARS int dummy /* dummy version */
+#define STATEVARS long dummy /* dummy version */
#define STATESETUP(m, n) /* nothing */
#define STATETEARDOWN(m) /* nothing */
#define SETUP(v) ((v) = 0)
-#define onestate unsigned long
+#define onestate long
#define INIT(o, n) ((o) = (unsigned long)1 << (n))
#define INC(o) ((o) <<= 1)
#define ISSTATEIN(v, o) (((v) & (o)) != 0)
@@ -127,6 +135,9 @@
#define FWD(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) << (n))
#define BACK(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) >> (n))
#define ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
+/* no multibyte support */
+#define XMBRTOWC xmbrtowc_dummy
+#define ZAPSTATE(mbs) ((void)(mbs))
/* function names */
#define SNAMES /* engine.c looks after details */
@@ -152,26 +163,25 @@
#undef BACK
#undef ISSETBACK
#undef SNAMES
+#undef XMBRTOWC
+#undef ZAPSTATE
/* macros for manipulating states, large version */
#define states char *
-#define CLEAR(v) memset(v, 0, (size_t)m->g->nstates)
+#define CLEAR(v) memset(v, 0, m->g->nstates)
#define SET0(v, n) ((v)[n] = 0)
#define SET1(v, n) ((v)[n] = 1)
#define ISSET(v, n) ((v)[n])
-#define ASSIGN(d, s) memcpy(d, s, (size_t)m->g->nstates)
-#define EQ(a, b) (memcmp(a, b, (size_t)m->g->nstates) == 0)
-#define STATEVARS int vn; char *space
-#define STATESETUP(m, nv) \
- if (((m)->space = malloc((size_t)((nv)*(m)->g->nstates))) == NULL) \
- return(REG_ESPACE); \
- else \
- (m)->vn = 0
-
-#define STATETEARDOWN(m) { free((m)->space); m->space = NULL; }
-#define SETUP(v) ((v) = &m->space[(size_t)(m->vn++ * m->g->nstates)])
-#define onestate int
-#define INIT(o, n) ((o) = (int)(n))
+#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
+#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
+#define STATEVARS long vn; char *space
+#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
+ if ((m)->space == NULL) return(REG_ESPACE); \
+ (m)->vn = 0; }
+#define STATETEARDOWN(m) { free((m)->space); }
+#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
+#define onestate long
+#define INIT(o, n) ((o) = (n))
#define INC(o) ((o)++)
#define ISSTATEIN(v, o) ((v)[o])
/* some abbreviations; note that some of these know variable names! */
@@ -179,11 +189,24 @@
#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
#define ISSETBACK(v, n) ((v)[here - (n)])
+/* no multibyte support */
+#define XMBRTOWC xmbrtowc_dummy
+#define ZAPSTATE(mbs) ((void)(mbs))
/* function names */
#define LNAMES /* flag */
#include "engine.c"
+/* multibyte character & large states version */
+#undef LNAMES
+#undef XMBRTOWC
+#undef ZAPSTATE
+#define XMBRTOWC xmbrtowc
+#define ZAPSTATE(mbs) memset((mbs), 0, sizeof(*(mbs)))
+#define MNAMES
+
+#include "engine.c"
+
/*
- regexec - interface for matching
= extern int regexec(const regex_t *, const char *, size_t, \
@@ -200,21 +223,18 @@
* have been prototyped.
*/
int /* 0 success, REG_NOMATCH failure */
-regexec(
- const regex_t *preg,
- const char *string,
- size_t nmatch,
- regmatch_t pmatch[],
- int eflags)
+regexec(const regex_t * __restrict preg,
+ const char * __restrict string,
+ size_t nmatch,
+ regmatch_t pmatch[__restrict],
+ int eflags)
{
struct re_guts *g = preg->re_g;
- char *s;
#ifdef REDEBUG
# define GOODFLAGS(f) (f)
#else
# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
#endif
-
_DIAGASSERT(preg != NULL);
_DIAGASSERT(string != NULL);
@@ -225,10 +245,10 @@
return(REG_BADPAT);
eflags = GOODFLAGS(eflags);
- s = __UNCONST(string);
-
- if (g->nstates <= (sopno)(CHAR_BIT*sizeof(states1)) && !(eflags®_LARGE))
- return(smatcher(g, s, nmatch, pmatch, eflags));
+ if (MB_CUR_MAX > 1)
+ return(mmatcher(g, string, nmatch, pmatch, eflags));
+ else if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE))
+ return(smatcher(g, string, nmatch, pmatch, eflags));
else
- return(lmatcher(g, s, nmatch, pmatch, eflags));
+ return(lmatcher(g, string, nmatch, pmatch, eflags));
}
diff --git a/libc/upstream-netbsd/lib/libc/regex/regfree.c b/libc/upstream-netbsd/lib/libc/regex/regfree.c
index ce011ea..7e388b1 100644
--- a/libc/upstream-netbsd/lib/libc/regex/regfree.c
+++ b/libc/upstream-netbsd/lib/libc/regex/regfree.c
@@ -1,6 +1,9 @@
-/* $NetBSD: regfree.c,v 1.15 2007/02/09 23:44:18 junyoung Exp $ */
+/* $NetBSD: regfree.c,v 1.19 2021/02/26 19:24:47 christos Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -34,58 +37,22 @@
* @(#)regfree.c 8.3 (Berkeley) 3/20/94
*/
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)regfree.c 8.3 (Berkeley) 3/20/94
- */
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
-#else
-__RCSID("$NetBSD: regfree.c,v 1.15 2007/02/09 23:44:18 junyoung Exp $");
+__FBSDID("$FreeBSD: head/lib/libc/regex/regfree.c 326025 2017-11-20 19:49:47Z pfg $");
#endif
-#endif /* LIBC_SCCS and not lint */
+__RCSID("$NetBSD: regfree.c,v 1.19 2021/02/26 19:24:47 christos Exp $");
#include "namespace.h"
#include <sys/types.h>
-
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <regex.h>
#ifdef __weak_alias
@@ -100,10 +67,10 @@
= extern void regfree(regex_t *);
*/
void
-regfree(
- regex_t *preg)
+regfree(regex_t *preg)
{
struct re_guts *g;
+ unsigned int i;
_DIAGASSERT(preg != NULL);
@@ -119,11 +86,19 @@
if (g->strip != NULL)
free(g->strip);
- if (g->sets != NULL)
+ if (g->sets != NULL) {
+ for (i = 0; i < g->ncsets; i++) {
+ free(g->sets[i].ranges);
+ free(g->sets[i].wides);
+ free(g->sets[i].types);
+ }
free(g->sets);
- if (g->setbits != NULL)
- free(g->setbits);
+ }
if (g->must != NULL)
free(g->must);
+ if (g->charjump != NULL)
+ free(&g->charjump[CHAR_MIN]);
+ if (g->matchjump != NULL)
+ free(g->matchjump);
free(g);
}
diff --git a/libc/upstream-netbsd/lib/libc/regex/utils.h b/libc/upstream-netbsd/lib/libc/regex/utils.h
index 762caee..972f555 100644
--- a/libc/upstream-netbsd/lib/libc/regex/utils.h
+++ b/libc/upstream-netbsd/lib/libc/regex/utils.h
@@ -1,6 +1,9 @@
-/* $NetBSD: utils.h,v 1.6 2003/08/07 16:43:21 agc Exp $ */
+/* $NetBSD: utils.h,v 1.9 2021/04/22 19:20:24 christos Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -32,49 +35,38 @@
* SUCH DAMAGE.
*
* @(#)utils.h 8.3 (Berkeley) 3/20/94
+ * $FreeBSD: head/lib/libc/regex/utils.h 341838 2018-12-12 04:23:00Z yuripv $
*/
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)utils.h 8.3 (Berkeley) 3/20/94
- */
+#ifdef NLS
+#include <wchar.h>
+#include <wctype.h>
+#else
+#include <ctype.h>
+#define wint_t regex_wint_t
+#define mbstate_t regex_mbstate_t
+#define wctype_t regex_wctype_t
+typedef short wint_t;
+typedef char mbstate_t;
+typedef short wctype_t;
+#define iswupper(a) isupper(a)
+#define iswlower(a) islower(a)
+#define iswalpha(a) isalpha(a)
+#define iswalnum(a) isalnum(a)
+#define towupper(a) toupper(a)
+#define towlower(a) tolower(a)
+extern wctype_t __regex_wctype(const char *);
+extern int __regex_iswctype(wint_t, wctype_t);
+#define wctype(s) __regex_wctype(s)
+#define iswctype(c, t) __regex_iswctype((c), (t))
+#endif
/* utility definitions */
#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */
#define INFINITY (DUPMAX + 1)
-#define NC (CHAR_MAX - CHAR_MIN + 1)
+
+#define NC_MAX (CHAR_MAX - CHAR_MIN + 1)
+#define NC ((MB_CUR_MAX) == 1 ? (NC_MAX) : (128))
typedef unsigned char uch;
/* switch off assertions (if not already off) if no REDEBUG */
diff --git a/libc/upstream-netbsd/lib/libc/stdlib/bsearch.c b/libc/upstream-netbsd/lib/libc/stdlib/bsearch.c
index 2b0e0d8..e48fe85 100644
--- a/libc/upstream-netbsd/lib/libc/stdlib/bsearch.c
+++ b/libc/upstream-netbsd/lib/libc/stdlib/bsearch.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bsearch.c,v 1.15 2012/03/04 20:01:45 christos Exp $ */
+/* $NetBSD: bsearch.c,v 1.16 2022/05/31 08:43:14 andvar Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)bsearch.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: bsearch.c,v 1.15 2012/03/04 20:01:45 christos Exp $");
+__RCSID("$NetBSD: bsearch.c,v 1.16 2022/05/31 08:43:14 andvar Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -50,7 +50,7 @@
* is odd, moving left simply involves halving lim: e.g., when lim
* is 5 we look at item 2, so we change lim to 2 so that we will
* look at items 0 & 1. If lim is even, the same applies. If lim
- * is odd, moving right again involes halving lim, this time moving
+ * is odd, moving right again involves halving lim, this time moving
* the base up one item past p: e.g., when lim is 5 we change base
* to item 3 and make lim 2 so that we will look at items 3 and 4.
* If lim is even, however, we have to shrink it by one before
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
index 823f2a9..f853045 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
@@ -26,7 +26,7 @@
****************************************************************/
-/* This is a variation on dtoa.c that converts arbitary binary
+/* This is a variation on dtoa.c that converts arbitrary binary
floating-point formats to and from decimal notation. It uses
double-precision arithmetic internally, so there are still
various #ifdefs that adapt the calculations to the native
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/misc.c b/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
index 79a3104..fef51a9 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
@@ -41,7 +41,7 @@
#endif
#ifdef MULTIPLE_THREADS
-extern void *__dtoa_locks[];
+static void *__dtoa_locks[] = { NULL, NULL };
#endif
Bigint *
diff --git a/libc/upstream-openbsd/lib/libc/gen/alarm.c b/libc/upstream-openbsd/lib/libc/gen/alarm.c
index f15dd15..ac17f9d 100644
--- a/libc/upstream-openbsd/lib/libc/gen/alarm.c
+++ b/libc/upstream-openbsd/lib/libc/gen/alarm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alarm.c,v 1.9 2019/06/28 13:32:41 deraadt Exp $ */
+/* $OpenBSD: alarm.c,v 1.10 2021/06/24 22:43:31 cheloha Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,13 +34,12 @@
unsigned int
alarm(unsigned int secs)
{
- struct itimerval it, oitv;
- struct itimerval *itp = ⁢
+ struct itimerval itv, oitv;
- timerclear(&itp->it_interval);
- itp->it_value.tv_sec = secs;
- itp->it_value.tv_usec = 0;
- if (setitimer(ITIMER_REAL, itp, &oitv) == -1)
+ timerclear(&itv.it_interval);
+ itv.it_value.tv_sec = secs;
+ itv.it_value.tv_usec = 0;
+ if (setitimer(ITIMER_REAL, &itv, &oitv) == -1)
return ((unsigned int) -1);
if (oitv.it_value.tv_usec)
oitv.it_value.tv_sec++;
diff --git a/libc/upstream-openbsd/lib/libc/gen/charclass.h b/libc/upstream-openbsd/lib/libc/gen/charclass.h
index 073baf6..1d1ec07 100644
--- a/libc/upstream-openbsd/lib/libc/gen/charclass.h
+++ b/libc/upstream-openbsd/lib/libc/gen/charclass.h
@@ -1,13 +1,13 @@
/*
* Public domain, 2008, Todd C. Miller <millert@openbsd.org>
*
- * $OpenBSD: charclass.h,v 1.2 2019/01/25 00:19:25 millert Exp $
+ * $OpenBSD: charclass.h,v 1.3 2020/10/13 04:42:28 guenther Exp $
*/
/*
* POSIX character class support for fnmatch() and glob().
*/
-static struct cclass {
+static const struct cclass {
const char *name;
int (*isctype)(int);
} cclasses[] = {
diff --git a/libc/upstream-openbsd/lib/libc/gen/daemon.c b/libc/upstream-openbsd/lib/libc/gen/daemon.c
index 79f4264..b84cb4f 100644
--- a/libc/upstream-openbsd/lib/libc/gen/daemon.c
+++ b/libc/upstream-openbsd/lib/libc/gen/daemon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: daemon.c,v 1.7 2010/07/27 22:29:09 marco Exp $ */
+/* $OpenBSD: daemon.c,v 1.8 2021/10/24 21:24:20 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -53,7 +53,7 @@
if (!nochdir)
(void)chdir("/");
- if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR)) != -1) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
diff --git a/libc/upstream-openbsd/lib/libc/gen/fnmatch.c b/libc/upstream-openbsd/lib/libc/gen/fnmatch.c
index d7afd5f..ff6b26e 100644
--- a/libc/upstream-openbsd/lib/libc/gen/fnmatch.c
+++ b/libc/upstream-openbsd/lib/libc/gen/fnmatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fnmatch.c,v 1.22 2020/03/13 03:25:45 djm Exp $ */
+/* $OpenBSD: fnmatch.c,v 1.23 2020/10/13 04:42:28 guenther Exp $ */
/* Copyright (c) 2011, VMware, Inc.
* All rights reserved.
@@ -100,7 +100,7 @@
{
const char * const mismatch = pattern;
const char *colon;
- struct cclass *cc;
+ const struct cclass *cc;
int rval = RANGE_NOMATCH;
size_t len;
diff --git a/libc/upstream-openbsd/lib/libc/gen/ftok.c b/libc/upstream-openbsd/lib/libc/gen/ftok.c
index ea1edf1..9edcd30 100644
--- a/libc/upstream-openbsd/lib/libc/gen/ftok.c
+++ b/libc/upstream-openbsd/lib/libc/gen/ftok.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftok.c,v 1.9 2019/06/28 13:32:41 deraadt Exp $ */
+/* $OpenBSD: ftok.c,v 1.10 2022/04/13 16:23:53 millert Exp $ */
/*
* Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
* All rights reserved.
@@ -32,11 +32,12 @@
key_t
ftok(const char *path, int id)
{
+ const unsigned int u_id = id;
struct stat st;
if (stat(path, &st) == -1)
return (key_t)-1;
return (key_t)
- ((id & 0xff) << 24 | (st.st_dev & 0xff) << 16 | (st.st_ino & 0xffff));
+ ((u_id & 0xff) << 24 | (st.st_dev & 0xff) << 16 | (st.st_ino & 0xffff));
}
diff --git a/libc/upstream-openbsd/lib/libc/locale/_def_time.c b/libc/upstream-openbsd/lib/libc/locale/_def_time.c
new file mode 100644
index 0000000..ba83fb8
--- /dev/null
+++ b/libc/upstream-openbsd/lib/libc/locale/_def_time.c
@@ -0,0 +1,36 @@
+/* $OpenBSD: _def_time.c,v 1.6 2016/05/23 00:05:15 guenther Exp $ */
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <locale.h>
+#include "localedef.h"
+
+const _TimeLocale _DefaultTimeLocale =
+{
+ {
+ "Sun","Mon","Tue","Wed","Thu","Fri","Sat",
+ },
+ {
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday"
+ },
+ {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ },
+ {
+ "January", "February", "March", "April", "May", "June", "July",
+ "August", "September", "October", "November", "December"
+ },
+ {
+ "AM", "PM"
+ },
+ "%a %b %e %H:%M:%S %Y",
+ "%m/%d/%y",
+ "%H:%M:%S",
+ "%I:%M:%S %p"
+};
+
+const _TimeLocale *_CurrentTimeLocale = &_DefaultTimeLocale;
diff --git a/libc/upstream-openbsd/lib/libc/locale/_wcstol.h b/libc/upstream-openbsd/lib/libc/locale/_wcstol.h
deleted file mode 100644
index 1b60a3a..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/_wcstol.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: _wcstol.h,v 1.3 2015/10/01 02:32:07 guenther Exp $ */
-/* $NetBSD: _wcstol.h,v 1.2 2003/08/07 16:43:03 agc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Original version ID:
- * @(#)strtol.c 8.1 (Berkeley) 6/4/93
- * NetBSD: wcstol.c,v 1.1 2001/09/27 16:30:36 yamt Exp
- * Citrus: xpg4dl/FreeBSD/lib/libc/locale/wcstol.c,v 1.2 2001/09/21 16:11:41 yamt Exp
- */
-
-/*
- * function template for wcstol, wcstoll and wcstoimax.
- *
- * parameters:
- * FUNCNAME : function name
- * int_type : return type
- * MIN_VALUE : lower limit of the return type
- * MAX_VALUE : upper limit of the return type
- */
-
-int_type
-FUNCNAME(const wchar_t *nptr, wchar_t **endptr, int base)
-{
- const wchar_t *s;
- int_type acc, cutoff;
- wint_t wc;
- int i;
- int neg, any, cutlim;
-
- /* check base value */
- if (base && (base < 2 || base > 36)) {
- errno = EINVAL;
- return 0;
- }
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- s = nptr;
- do {
- wc = (wchar_t) *s++;
- } while (iswspace(wc));
- if (wc == L'-') {
- neg = 1;
- wc = *s++;
- } else {
- neg = 0;
- if (wc == L'+')
- wc = *s++;
- }
- if ((base == 0 || base == 16) &&
- wc == L'0' && (*s == L'x' || *s == L'X')) {
- wc = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = wc == L'0' ? 8 : 10;
-
- /*
- * See strtol for comments as to the logic used.
- */
- cutoff = neg ? MIN_VALUE : MAX_VALUE;
- cutlim = (int)(cutoff % base);
- cutoff /= base;
- if (neg) {
- if (cutlim > 0) {
- cutlim -= base;
- cutoff += 1;
- }
- cutlim = -cutlim;
- }
- for (acc = 0, any = 0;; wc = (wchar_t) *s++) {
- i = wctoint(wc);
- if (i == -1)
- break;
- if (i >= base)
- break;
- if (any < 0)
- continue;
- if (neg) {
- if (acc < cutoff || (acc == cutoff && i > cutlim)) {
- any = -1;
- acc = MIN_VALUE;
- errno = ERANGE;
- } else {
- any = 1;
- acc *= base;
- acc -= i;
- }
- } else {
- if (acc > cutoff || (acc == cutoff && i > cutlim)) {
- any = -1;
- acc = MAX_VALUE;
- errno = ERANGE;
- } else {
- any = 1;
- acc *= base;
- acc += i;
- }
- }
- }
- if (endptr != 0)
- *endptr = (wchar_t *)(any ? s - 1 : nptr);
- return (acc);
-}
-DEF_STRONG(FUNCNAME);
diff --git a/libc/upstream-openbsd/lib/libc/locale/_wcstoul.h b/libc/upstream-openbsd/lib/libc/locale/_wcstoul.h
deleted file mode 100644
index 159b22b..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/_wcstoul.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $OpenBSD: _wcstoul.h,v 1.3 2015/10/01 02:32:07 guenther Exp $ */
-/* $NetBSD: _wcstoul.h,v 1.2 2003/08/07 16:43:03 agc Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Original version ID:
- * @(#)strtoul.c 8.1 (Berkeley) 6/4/93
- * Citrus: xpg4dl/FreeBSD/lib/libc/locale/wcstoul.c,v 1.2 2001/09/21 16:11:41 yamt Exp
- * NetBSD: wcstoul.c,v 1.1 2001/09/27 16:30:37 yamt Exp
- */
-
-/*
- * function template for wcstoul, wcstoull and wcstoumax.
- *
- * parameters:
- * FUNCNAME : function name
- * uint_type : return type
- * MAX_VALUE : upper limit of the return type
- */
-
-uint_type
-FUNCNAME(const wchar_t *nptr, wchar_t **endptr, int base)
-{
- const wchar_t *s;
- uint_type acc, cutoff;
- wint_t wc;
- int i;
- int neg, any, cutlim;
-
- if (base && (base < 2 || base > 36)) {
- errno = EINVAL;
- return 0;
- }
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- s = nptr;
- do {
- wc = (wchar_t) *s++;
- } while (iswspace(wc));
- if (wc == L'-') {
- neg = 1;
- wc = *s++;
- } else {
- neg = 0;
- if (wc == L'+')
- wc = *s++;
- }
- if ((base == 0 || base == 16) &&
- wc == L'0' && (*s == L'x' || *s == L'X')) {
- wc = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = wc == L'0' ? 8 : 10;
-
- /*
- * See strtoul for comments as to the logic used.
- */
- cutoff = MAX_VALUE / (uint_type)base;
- cutlim = (int)(MAX_VALUE % (uint_type)base);
- for (acc = 0, any = 0;; wc = (wchar_t) *s++) {
- i = wctoint(wc);
- if (i == (wint_t)-1)
- break;
- if (i >= base)
- break;
- if (any < 0)
- continue;
- if (acc > cutoff || (acc == cutoff && i > cutlim)) {
- any = -1;
- acc = MAX_VALUE;
- errno = ERANGE;
- } else {
- any = 1;
- acc *= (uint_type)base;
- acc += i;
- }
- }
- if (neg && any > 0)
- acc = -acc;
- if (endptr != 0)
- *endptr = (wchar_t *)(any ? s - 1 : nptr);
- return (acc);
-}
-DEF_STRONG(FUNCNAME);
diff --git a/libc/upstream-openbsd/lib/libc/locale/wcstoimax.c b/libc/upstream-openbsd/lib/libc/locale/wcstoimax.c
deleted file mode 100644
index d46a7c7..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/wcstoimax.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $OpenBSD: wcstoimax.c,v 1.1 2009/01/13 18:13:51 kettenis Exp $ */
-/* $NetBSD: wcstol.c,v 1.2 2003/03/11 09:21:23 tshiozak Exp $ */
-
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "wctoint.h"
-
-#define FUNCNAME wcstoimax
-typedef intmax_t int_type;
-#define MIN_VALUE INTMAX_MIN
-#define MAX_VALUE INTMAX_MAX
-
-#include "_wcstol.h"
diff --git a/libc/upstream-openbsd/lib/libc/locale/wcstol.c b/libc/upstream-openbsd/lib/libc/locale/wcstol.c
deleted file mode 100644
index 03395a0..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/wcstol.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $OpenBSD: wcstol.c,v 1.2 2005/08/08 08:05:35 espie Exp $ */
-/* $NetBSD: wcstol.c,v 1.2 2003/03/11 09:21:23 tshiozak Exp $ */
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "wctoint.h"
-
-#define FUNCNAME wcstol
-typedef long int_type;
-#define MIN_VALUE LONG_MIN
-#define MAX_VALUE LONG_MAX
-
-#include "_wcstol.h"
diff --git a/libc/upstream-openbsd/lib/libc/locale/wcstoll.c b/libc/upstream-openbsd/lib/libc/locale/wcstoll.c
deleted file mode 100644
index 926db70..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/wcstoll.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $OpenBSD: wcstoll.c,v 1.2 2005/08/08 08:05:35 espie Exp $ */
-/* $NetBSD: wcstoll.c,v 1.1 2003/03/11 09:21:23 tshiozak Exp $ */
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "wctoint.h"
-
-#define FUNCNAME wcstoll
-typedef long long int int_type;
-#define MIN_VALUE LLONG_MIN
-#define MAX_VALUE LLONG_MAX
-
-#include "_wcstol.h"
diff --git a/libc/upstream-openbsd/lib/libc/locale/wcstoul.c b/libc/upstream-openbsd/lib/libc/locale/wcstoul.c
deleted file mode 100644
index e863862..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/wcstoul.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* $OpenBSD: wcstoul.c,v 1.2 2005/08/08 08:05:35 espie Exp $ */
-/* $NetBSD: wcstoul.c,v 1.2 2003/03/11 09:21:24 tshiozak Exp $ */
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "wctoint.h"
-
-#define FUNCNAME wcstoul
-typedef unsigned long uint_type;
-#define MAX_VALUE ULONG_MAX
-
-#include "_wcstoul.h"
diff --git a/libc/upstream-openbsd/lib/libc/locale/wcstoull.c b/libc/upstream-openbsd/lib/libc/locale/wcstoull.c
deleted file mode 100644
index 6671c37..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/wcstoull.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* $OpenBSD: wcstoull.c,v 1.2 2005/08/08 08:05:35 espie Exp $ */
-/* $NetBSD: wcstoull.c,v 1.1 2003/03/11 09:21:24 tshiozak Exp $ */
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "wctoint.h"
-
-#define FUNCNAME wcstoull
-typedef unsigned long long int uint_type;
-#define MAX_VALUE ULLONG_MAX
-
-#include "_wcstoul.h"
diff --git a/libc/upstream-openbsd/lib/libc/locale/wcstoumax.c b/libc/upstream-openbsd/lib/libc/locale/wcstoumax.c
deleted file mode 100644
index ccd4713..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/wcstoumax.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $OpenBSD: wcstoumax.c,v 1.1 2009/01/13 18:13:51 kettenis Exp $ */
-/* $NetBSD: wcstoul.c,v 1.2 2003/03/11 09:21:24 tshiozak Exp $ */
-
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "wctoint.h"
-
-#define FUNCNAME wcstoumax
-typedef uintmax_t uint_type;
-#define MAX_VALUE UINTMAX_MAX
-
-#include "_wcstoul.h"
diff --git a/libc/upstream-openbsd/lib/libc/locale/wctoint.h b/libc/upstream-openbsd/lib/libc/locale/wctoint.h
deleted file mode 100644
index ea50c5a..0000000
--- a/libc/upstream-openbsd/lib/libc/locale/wctoint.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $OpenBSD: wctoint.h,v 1.2 2015/09/13 11:38:08 guenther Exp $ */
-/* $NetBSD: __wctoint.h,v 1.1 2001/09/28 11:25:37 yamt Exp $ */
-
-/*-
- * Copyright (c)2001 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Citrus: xpg4dl/FreeBSD/lib/libc/locale/__wctoint.h,v 1.1 2001/09/21 13:52:32 yamt Exp $
- */
-
-
-inline static int
-wctoint(wchar_t wc)
-{
- int n;
-
- switch (wc) {
- case L'0': n = 0; break;
- case L'1': n = 1; break;
- case L'2': n = 2; break;
- case L'3': n = 3; break;
- case L'4': n = 4; break;
- case L'5': n = 5; break;
- case L'6': n = 6; break;
- case L'7': n = 7; break;
- case L'8': n = 8; break;
- case L'9': n = 9; break;
- case L'A': case L'a': n = 10; break;
- case L'B': case L'b': n = 11; break;
- case L'C': case L'c': n = 12; break;
- case L'D': case L'd': n = 13; break;
- case L'E': case L'e': n = 14; break;
- case L'F': case L'f': n = 15; break;
- case L'G': case L'g': n = 16; break;
- case L'H': case L'h': n = 17; break;
- case L'I': case L'i': n = 18; break;
- case L'J': case L'j': n = 19; break;
- case L'K': case L'k': n = 20; break;
- case L'L': case L'l': n = 21; break;
- case L'M': case L'm': n = 22; break;
- case L'N': case L'n': n = 23; break;
- case L'O': case L'o': n = 24; break;
- case L'P': case L'p': n = 25; break;
- case L'Q': case L'q': n = 26; break;
- case L'R': case L'r': n = 27; break;
- case L'S': case L's': n = 28; break;
- case L'T': case L't': n = 29; break;
- case L'U': case L'u': n = 30; break;
- case L'V': case L'v': n = 31; break;
- case L'W': case L'w': n = 32; break;
- case L'X': case L'x': n = 33; break;
- case L'Y': case L'y': n = 34; break;
- case L'Z': case L'z': n = 35; break;
- default: n = -1; break; /* error */
- }
-
- return n;
-}
diff --git a/libc/upstream-openbsd/lib/libc/net/base64.c b/libc/upstream-openbsd/lib/libc/net/base64.c
index e90696d..f36c11a 100644
--- a/libc/upstream-openbsd/lib/libc/net/base64.c
+++ b/libc/upstream-openbsd/lib/libc/net/base64.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: base64.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: base64.c,v 1.15 2021/10/25 14:41:09 jca Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
@@ -46,11 +46,9 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <arpa/nameser.h>
#include <ctype.h>
#include <resolv.h>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -107,9 +105,9 @@
end of the data is performed using the '=' character.
Since all base64 input is an integral number of octets, only the
- -------------------------------------------------
+ -------------------------------------------------
following cases can arise:
-
+
(1) the final quantum of encoding input is an integral
multiple of 24 bits; here, the final unit of encoded
output will be an integral multiple of 4 characters
@@ -123,15 +121,12 @@
*/
int
-b64_ntop(src, srclength, target, targsize)
- u_char const *src;
- size_t srclength;
- char *target;
- size_t targsize;
+b64_ntop(unsigned char const *src, size_t srclength, char *target,
+ size_t targsize)
{
size_t datalength = 0;
- u_char input[3];
- u_char output[4];
+ unsigned char input[3];
+ unsigned char output[4];
int i;
while (2 < srclength) {
@@ -152,14 +147,14 @@
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
-
+
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
-
+
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
@@ -187,13 +182,10 @@
*/
int
-b64_pton(src, target, targsize)
- char const *src;
- u_char *target;
- size_t targsize;
+b64_pton(char const *src, unsigned char *target, size_t targsize)
{
int tarindex, state, ch;
- u_char nextbyte;
+ unsigned char nextbyte;
char *pos;
state = 0;
@@ -207,7 +199,7 @@
break;
pos = strchr(Base64, ch);
- if (pos == 0) /* A non-base64 character. */
+ if (pos == 0) /* A non-base64 character. */
return (-1);
switch (state) {
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fputws.c b/libc/upstream-openbsd/lib/libc/stdio/fputws.c
index 8961571..4f619b6 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/fputws.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/fputws.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fputws.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */
+/* $OpenBSD: fputws.c,v 1.9 2021/10/24 10:05:23 jsg Exp $ */
/* $NetBSD: fputws.c,v 1.1 2003/03/07 07:11:37 tshiozak Exp $ */
/*-
@@ -37,9 +37,7 @@
#include "fvwrite.h"
int
-fputws(ws, fp)
- const wchar_t * __restrict ws;
- FILE * __restrict fp;
+fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
{
FLOCKFILE(fp);
_SET_ORIENTATION(fp, 1);
diff --git a/libc/upstream-openbsd/lib/libc/stdio/setvbuf.c b/libc/upstream-openbsd/lib/libc/stdio/setvbuf.c
index da68b90..74a1695 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/setvbuf.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/setvbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setvbuf.c,v 1.14 2016/09/21 04:38:56 guenther Exp $ */
+/* $OpenBSD: setvbuf.c,v 1.15 2022/09/28 16:44:14 gnezdo Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,6 +31,7 @@
* SUCH DAMAGE.
*/
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "local.h"
@@ -52,7 +53,7 @@
* when setting _IONBF.
*/
if (mode != _IONBF)
- if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0)
+ if ((mode != _IOFBF && mode != _IOLBF) || size > INT_MAX)
return (EOF);
/*
@@ -131,7 +132,8 @@
flags |= __SNPT;
/*
- * Fix up the FILE fields.
+ * Fix up the FILE fields, and set __cleanup for output flush on
+ * exit (since we are buffered in some way).
*/
if (mode == _IOLBF)
flags |= __SLBF;
diff --git a/libc/upstream-openbsd/lib/libc/stdlib/div.c b/libc/upstream-openbsd/lib/libc/stdlib/div.c
index beaa428..5e6164f 100644
--- a/libc/upstream-openbsd/lib/libc/stdlib/div.c
+++ b/libc/upstream-openbsd/lib/libc/stdlib/div.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: div.c,v 1.6 2015/09/13 08:31:47 guenther Exp $ */
+/* $OpenBSD: div.c,v 1.7 2022/12/27 17:10:06 jmc Exp $ */
/*
* Copyright (c) 1990 Regents of the University of California.
* All rights reserved.
@@ -46,7 +46,7 @@
* words, we should always truncate the quotient towards
* 0, never -infinity.
*
- * Machine division and remainer may work either way when
+ * Machine division and remainder may work either way when
* one or both of n or d is negative. If only one is
* negative and r.quot has been truncated towards -inf,
* r.rem will have the same sign as denom and the opposite
diff --git a/libc/upstream-openbsd/lib/libc/stdlib/lsearch.c b/libc/upstream-openbsd/lib/libc/stdlib/lsearch.c
index 8cad05f..95ebf49 100644
--- a/libc/upstream-openbsd/lib/libc/stdlib/lsearch.c
+++ b/libc/upstream-openbsd/lib/libc/stdlib/lsearch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsearch.c,v 1.5 2014/07/18 04:16:09 matthew Exp $ */
+/* $OpenBSD: lsearch.c,v 1.7 2021/12/08 22:06:28 cheloha Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,48 +37,34 @@
#include <search.h>
typedef int (*cmp_fn_t)(const void *, const void *);
-static void *linear_base(const void *, const void *, size_t *, size_t,
- cmp_fn_t, int);
void *
lsearch(const void *key, void *base, size_t *nelp, size_t width,
cmp_fn_t compar)
{
+ void *element = lfind(key, base, nelp, width, compar);
- return(linear_base(key, base, nelp, width, compar, 1));
+ /*
+ * Use memmove(3) to ensure the key is copied cleanly into the
+ * array, even if the key overlaps with the end of the array.
+ */
+ if (element == NULL) {
+ element = memmove((char *)base + *nelp * width, key, width);
+ *nelp += 1;
+ }
+ return element;
}
void *
lfind(const void *key, const void *base, size_t *nelp, size_t width,
cmp_fn_t compar)
{
- return(linear_base(key, base, nelp, width, compar, 0));
-}
-
-static void *
-linear_base(const void *key, const void *base, size_t *nelp, size_t width,
- cmp_fn_t compar, int add_flag)
-{
const char *element, *end;
end = (const char *)base + *nelp * width;
for (element = base; element < end; element += width)
if (!compar(key, element)) /* key found */
return((void *)element);
-
- if (!add_flag) /* key not found */
- return(NULL);
-
- /*
- * The UNIX System User's Manual, 1986 edition claims that
- * a NULL pointer is returned by lsearch with errno set
- * appropriately, if there is not enough room in the table
- * to add a new item. This can't be done as none of these
- * routines have any method of determining the size of the
- * table. This comment isn't in the 1986-87 System V
- * manual.
- */
- ++*nelp;
- memcpy((void *)end, key, width);
- return((void *)end);
+ return NULL;
}
+DEF_WEAK(lfind);
diff --git a/libc/upstream-openbsd/lib/libc/stdlib/recallocarray.c b/libc/upstream-openbsd/lib/libc/stdlib/recallocarray.c
index a2f37fe..81059e6 100644
--- a/libc/upstream-openbsd/lib/libc/stdlib/recallocarray.c
+++ b/libc/upstream-openbsd/lib/libc/stdlib/recallocarray.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $ */
+/* $OpenBSD: recallocarray.c,v 1.2 2021/03/18 11:16:58 claudio Exp $ */
/*
* Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
*
@@ -57,7 +57,7 @@
if (newsize <= oldsize) {
size_t d = oldsize - newsize;
- if (d < oldsize / 2 && d < getpagesize()) {
+ if (d < oldsize / 2 && d < (size_t)getpagesize()) {
memset((char *)ptr + newsize, 0, d);
return ptr;
}
diff --git a/libc/upstream-openbsd/lib/libc/stdlib/setenv.c b/libc/upstream-openbsd/lib/libc/stdlib/setenv.c
index 15c550b..fc8e5b6 100644
--- a/libc/upstream-openbsd/lib/libc/stdlib/setenv.c
+++ b/libc/upstream-openbsd/lib/libc/stdlib/setenv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setenv.c,v 1.19 2016/09/21 04:38:56 guenther Exp $ */
+/* $OpenBSD: setenv.c,v 1.20 2022/08/08 22:40:03 millert Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved.
@@ -48,9 +48,10 @@
for (cp = str; *cp && *cp != '='; ++cp)
;
- if (*cp != '=') {
+ if (cp == str || *cp != '=') {
+ /* '=' is the first character of string or is missing. */
errno = EINVAL;
- return (-1); /* missing `=' in string */
+ return (-1);
}
if (__findenv(str, (int)(cp - str), &offset) != NULL) {
diff --git a/libc/versioner-dependencies/riscv64/kernel_uapi_asm-riscv64 b/libc/versioner-dependencies/riscv64/kernel_uapi_asm-riscv64
new file mode 120000
index 0000000..61353cb
--- /dev/null
+++ b/libc/versioner-dependencies/riscv64/kernel_uapi_asm-riscv64
@@ -0,0 +1 @@
+../../kernel/uapi/asm-riscv/
\ No newline at end of file
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 750a6e2..fde3dfc 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -74,6 +74,7 @@
"-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
+ "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
],
@@ -87,6 +88,9 @@
arm64: {
version_script: ":libdl.arm64.map",
},
+ riscv64: {
+ version_script: ":libdl.riscv64.map",
+ },
x86: {
pack_relocations: false,
ldflags: [
@@ -174,6 +178,7 @@
"-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
+ "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
],
@@ -239,32 +244,40 @@
genrule {
name: "libdl.arm.map",
- out: ["libdl.arm.map"],
+ out: ["libdl.arm.map.txt"],
srcs: ["libdl.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) arm $(in) $(out)",
}
genrule {
name: "libdl.arm64.map",
- out: ["libdl.arm64.map"],
+ out: ["libdl.arm64.map.txt"],
srcs: ["libdl.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) arm64 $(in) $(out)",
+}
+
+genrule {
+ name: "libdl.riscv64.map",
+ out: ["libdl.riscv64.map.txt"],
+ srcs: ["libdl.map.txt"],
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
}
genrule {
name: "libdl.x86.map",
- out: ["libdl.x86.map"],
+ out: ["libdl.x86.map.txt"],
srcs: ["libdl.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) x86 $(in) $(out)",
}
genrule {
name: "libdl.x86_64.map",
- out: ["libdl.x86_64.map"],
+ out: ["libdl.x86_64.map.txt"],
srcs: ["libdl.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
}
diff --git a/libdl/libdl.cpp b/libdl/libdl.cpp
index a56a5ab..20f08d9 100644
--- a/libdl/libdl.cpp
+++ b/libdl/libdl.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
+#include <android/dlext.h>
#include <dlfcn.h>
#include <link.h>
+#include <signal.h>
#include <stdlib.h>
-#include <android/dlext.h>
// These functions are exported by the loader
// TODO(dimitry): replace these with reference to libc.so
@@ -72,6 +73,9 @@
__attribute__((__weak__, visibility("default")))
int __loader_android_get_application_target_sdk_version();
+__attribute__((__weak__, visibility("default"))) bool __loader_android_handle_signal(
+ int signal_number, siginfo_t* info, void* context);
+
// Proxy calls to bionic loader
__attribute__((__weak__))
void android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size) {
@@ -138,4 +142,14 @@
return __loader_android_get_application_target_sdk_version();
}
+// Returns true if this function handled the signal, false if the caller should handle the signal
+// itself. This function returns true if the sigchain handler should immediately return, which
+// happens when the signal came from GWP-ASan, and we've dumped a debuggerd report and patched up
+// the GWP-ASan allocator to recover from the fault, and regular execution of the program can
+// continue.
+__attribute__((__weak__)) bool android_handle_signal(int signal_number, siginfo_t* info,
+ void* context) {
+ return __loader_android_handle_signal(signal_number, info, context);
+}
+
} // extern "C"
diff --git a/libdl/libdl.map.txt b/libdl/libdl.map.txt
index 473bdf2..043ec53 100644
--- a/libdl/libdl.map.txt
+++ b/libdl/libdl.map.txt
@@ -45,4 +45,5 @@
global:
android_get_LD_LIBRARY_PATH;
__cfi_init;
+ android_handle_signal;
} LIBC_OMR1;
diff --git a/libfdtrack/fdtrack.cpp b/libfdtrack/fdtrack.cpp
index 2d114f2..b064401 100644
--- a/libfdtrack/fdtrack.cpp
+++ b/libfdtrack/fdtrack.cpp
@@ -71,7 +71,11 @@
static constexpr size_t kStackDepth = 32;
// Skip any initial frames from libfdtrack.so.
-static std::vector<std::string> kSkipFdtrackLib [[clang::no_destroy]] = {"libfdtrack.so"};
+// Also ignore frames from ART (http://b/236197847) because we'd rather spend
+// our precious few frames on the actual Java calling code rather than the
+// implementation of JNI!
+static std::vector<std::string> kSkipFdtrackLib
+ [[clang::no_destroy]] = {"libfdtrack.so", "libart.so"};
static bool installed = false;
static std::array<FdEntry, kFdTableSize> stack_traces [[clang::no_destroy]];
diff --git a/libm/Android.bp b/libm/Android.bp
index 7469cde..13fbf9a 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -29,6 +29,7 @@
whole_static_libs: ["libarm-optimized-routines-math"],
+ tidy_disabled_srcs: ["upstream-*/**/*.c"],
srcs: [
"upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c",
"upstream-freebsd/lib/msun/src/catrig.c",
@@ -73,8 +74,6 @@
"upstream-freebsd/lib/msun/src/e_scalbf.c",
"upstream-freebsd/lib/msun/src/e_sinh.c",
"upstream-freebsd/lib/msun/src/e_sinhf.c",
- "upstream-freebsd/lib/msun/src/e_sqrt.c",
- "upstream-freebsd/lib/msun/src/e_sqrtf.c",
"upstream-freebsd/lib/msun/src/k_cos.c",
"upstream-freebsd/lib/msun/src/k_cosf.c",
"upstream-freebsd/lib/msun/src/k_exp.c",
@@ -95,8 +94,6 @@
"upstream-freebsd/lib/msun/src/s_cbrtf.c",
"upstream-freebsd/lib/msun/src/s_ccosh.c",
"upstream-freebsd/lib/msun/src/s_ccoshf.c",
- "upstream-freebsd/lib/msun/src/s_ceil.c",
- "upstream-freebsd/lib/msun/src/s_ceilf.c",
"upstream-freebsd/lib/msun/src/s_cexp.c",
"upstream-freebsd/lib/msun/src/s_cexpf.c",
"upstream-freebsd/lib/msun/src/s_cimag.c",
@@ -107,8 +104,6 @@
"upstream-freebsd/lib/msun/src/s_conj.c",
"upstream-freebsd/lib/msun/src/s_conjf.c",
"upstream-freebsd/lib/msun/src/s_conjl.c",
- "upstream-freebsd/lib/msun/src/s_copysign.c",
- "upstream-freebsd/lib/msun/src/s_copysignf.c",
"upstream-freebsd/lib/msun/src/s_cos.c",
"upstream-freebsd/lib/msun/src/s_cospi.c",
"upstream-freebsd/lib/msun/src/s_cpow.c",
@@ -133,8 +128,6 @@
"upstream-freebsd/lib/msun/src/s_fdim.c",
"upstream-freebsd/lib/msun/src/s_finite.c",
"upstream-freebsd/lib/msun/src/s_finitef.c",
- "upstream-freebsd/lib/msun/src/s_floor.c",
- "upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_fma.c",
"upstream-freebsd/lib/msun/src/s_fmaf.c",
"upstream-freebsd/lib/msun/src/s_fmax.c",
@@ -236,7 +229,6 @@
"upstream-freebsd/lib/msun/src/s_cbrtl.c",
"upstream-freebsd/lib/msun/src/s_ceill.c",
"upstream-freebsd/lib/msun/src/s_clogl.c",
- "upstream-freebsd/lib/msun/src/s_copysignl.c",
"upstream-freebsd/lib/msun/src/e_coshl.c",
"upstream-freebsd/lib/msun/src/s_cosl.c",
"upstream-freebsd/lib/msun/src/s_csqrtl.c",
@@ -282,24 +274,13 @@
},
},
- // arch-specific settings
arch: {
arm: {
srcs: [
"arm/fenv.c",
+ "upstream-freebsd/lib/msun/src/s_ceil.c",
+ "upstream-freebsd/lib/msun/src/s_ceilf.c",
],
- neon: {
- srcs: [
- "arm/sqrt.S",
- "arm/floor.S",
- ],
-
- exclude_srcs: [
- "upstream-freebsd/lib/msun/src/e_sqrt.c",
- "upstream-freebsd/lib/msun/src/e_sqrtf.c",
- "upstream-freebsd/lib/msun/src/s_floor.c",
- ],
- },
instruction_set: "arm",
pack_relocations: false,
ldflags: ["-Wl,--hash-style=both"],
@@ -314,16 +295,8 @@
arm64: {
srcs: [
"arm64/fenv.c",
- "arm64/lrint.S",
- "arm64/sqrt.S",
],
exclude_srcs: [
- "upstream-freebsd/lib/msun/src/e_sqrt.c",
- "upstream-freebsd/lib/msun/src/e_sqrtf.c",
- "upstream-freebsd/lib/msun/src/s_ceil.c",
- "upstream-freebsd/lib/msun/src/s_ceilf.c",
- "upstream-freebsd/lib/msun/src/s_floor.c",
- "upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_fma.c",
"upstream-freebsd/lib/msun/src/s_fmaf.c",
"upstream-freebsd/lib/msun/src/s_fmax.c",
@@ -332,8 +305,12 @@
"upstream-freebsd/lib/msun/src/s_fminf.c",
"upstream-freebsd/lib/msun/src/s_llrint.c",
"upstream-freebsd/lib/msun/src/s_llrintf.c",
+ "upstream-freebsd/lib/msun/src/s_llround.c",
+ "upstream-freebsd/lib/msun/src/s_llroundf.c",
"upstream-freebsd/lib/msun/src/s_lrint.c",
"upstream-freebsd/lib/msun/src/s_lrintf.c",
+ "upstream-freebsd/lib/msun/src/s_lround.c",
+ "upstream-freebsd/lib/msun/src/s_lroundf.c",
"upstream-freebsd/lib/msun/src/s_rint.c",
"upstream-freebsd/lib/msun/src/s_rintf.c",
"upstream-freebsd/lib/msun/src/s_round.c",
@@ -344,71 +321,55 @@
version_script: ":libm.arm64.map",
},
+ riscv64: {
+ srcs: [
+ "riscv64/fenv.c",
+ ],
+
+ exclude_srcs: [
+ "upstream-freebsd/lib/msun/src/s_fma.c",
+ "upstream-freebsd/lib/msun/src/s_fmaf.c",
+ "upstream-freebsd/lib/msun/src/s_fmax.c",
+ "upstream-freebsd/lib/msun/src/s_fmaxf.c",
+ "upstream-freebsd/lib/msun/src/s_fmin.c",
+ "upstream-freebsd/lib/msun/src/s_fminf.c",
+ "upstream-freebsd/lib/msun/src/s_llrint.c",
+ "upstream-freebsd/lib/msun/src/s_llrintf.c",
+ "upstream-freebsd/lib/msun/src/s_llround.c",
+ "upstream-freebsd/lib/msun/src/s_llroundf.c",
+ "upstream-freebsd/lib/msun/src/s_lrint.c",
+ "upstream-freebsd/lib/msun/src/s_lrintf.c",
+ "upstream-freebsd/lib/msun/src/s_lround.c",
+ "upstream-freebsd/lib/msun/src/s_lroundf.c",
+ "upstream-freebsd/lib/msun/src/s_rint.c",
+ "upstream-freebsd/lib/msun/src/s_rintf.c",
+ "upstream-freebsd/lib/msun/src/s_round.c",
+ "upstream-freebsd/lib/msun/src/s_roundf.c",
+ "upstream-freebsd/lib/msun/src/s_trunc.c",
+ "upstream-freebsd/lib/msun/src/s_truncf.c",
+ ],
+ version_script: ":libm.riscv64.map",
+ },
+
x86: {
srcs: [
"i387/fenv.c",
- "x86/ceil.S",
- "x86/ceilf.S",
- "x86/floor.S",
- "x86/floorf.S",
- "x86/rint.S",
- "x86/rintf.S",
- "x86/sqrt.S",
- "x86/sqrtf.S",
- "x86/trunc.S",
- "x86/truncf.S",
- "x86/e_acos.S",
- "x86/e_asin.S",
- "x86/e_atan2.S",
- "x86/e_cosh.S",
- "x86/e_hypot.S",
- "x86/e_log10.S",
- "x86/e_sinh.S",
- "x86/libm_reduce_pi04l.S",
- "x86/libm_sincos_huge.S",
- "x86/libm_tancot_huge.S",
"x86/lrint.S",
"x86/lrintf.S",
- "x86/s_atan.S",
- "x86/s_cbrt.S",
- "x86/s_cos.S",
- "x86/s_expm1.S",
- "x86/s_log1p.S",
- "x86/s_sin.S",
- "x86/s_tanh.S",
- "x86/s_tan.S",
],
exclude_srcs: [
- "upstream-freebsd/lib/msun/src/e_acos.c",
- "upstream-freebsd/lib/msun/src/e_asin.c",
- "upstream-freebsd/lib/msun/src/e_atan2.c",
- "upstream-freebsd/lib/msun/src/e_cosh.c",
- "upstream-freebsd/lib/msun/src/e_hypot.c",
- "upstream-freebsd/lib/msun/src/e_log10.c",
- "upstream-freebsd/lib/msun/src/e_sinh.c",
- "upstream-freebsd/lib/msun/src/e_sqrt.c",
- "upstream-freebsd/lib/msun/src/e_sqrtf.c",
- "upstream-freebsd/lib/msun/src/s_atan.c",
- "upstream-freebsd/lib/msun/src/s_cbrt.c",
- "upstream-freebsd/lib/msun/src/s_ceil.c",
- "upstream-freebsd/lib/msun/src/s_ceilf.c",
- "upstream-freebsd/lib/msun/src/s_cos.c",
- "upstream-freebsd/lib/msun/src/s_expm1.c",
- "upstream-freebsd/lib/msun/src/s_floor.c",
- "upstream-freebsd/lib/msun/src/s_floorf.c",
- "upstream-freebsd/lib/msun/src/s_log1p.c",
"upstream-freebsd/lib/msun/src/s_lrint.c",
"upstream-freebsd/lib/msun/src/s_lrintf.c",
"upstream-freebsd/lib/msun/src/s_rint.c",
"upstream-freebsd/lib/msun/src/s_rintf.c",
- "upstream-freebsd/lib/msun/src/s_sin.c",
- "upstream-freebsd/lib/msun/src/s_tan.c",
- "upstream-freebsd/lib/msun/src/s_tanh.c",
"upstream-freebsd/lib/msun/src/s_trunc.c",
"upstream-freebsd/lib/msun/src/s_truncf.c",
],
local_include_dirs: ["i387"],
pack_relocations: false,
+ // The x86 ABI doesn't include this, which is needed for the
+ // roundss/roundsd instructions that we've used since Android M.
+ cflags: ["-msse4.1"],
ldflags: ["-Wl,--hash-style=both"],
version_script: ":libm.x86.map",
},
@@ -416,62 +377,16 @@
x86_64: {
srcs: [
"amd64/fenv.c",
- "x86_64/ceil.S",
- "x86_64/ceilf.S",
- "x86_64/floor.S",
- "x86_64/floorf.S",
- "x86_64/rint.S",
- "x86_64/rintf.S",
- "x86_64/sqrt.S",
- "x86_64/sqrtf.S",
- "x86_64/trunc.S",
- "x86_64/truncf.S",
- "x86_64/e_acos.S",
- "x86_64/e_asin.S",
- "x86_64/e_atan2.S",
- "x86_64/e_cosh.S",
- "x86_64/e_hypot.S",
- "x86_64/e_log10.S",
- "x86_64/e_sinh.S",
"x86_64/lrint.S",
"x86_64/lrintf.S",
- "x86_64/s_atan.S",
- "x86_64/s_cbrt.S",
- "x86_64/s_cos.S",
- "x86_64/s_expm1.S",
- "x86_64/s_log1p.S",
- "x86_64/s_sin.S",
- "x86_64/s_tanh.S",
- "x86_64/s_tan.S",
],
exclude_srcs: [
- "upstream-freebsd/lib/msun/src/e_acos.c",
- "upstream-freebsd/lib/msun/src/e_asin.c",
- "upstream-freebsd/lib/msun/src/e_atan2.c",
- "upstream-freebsd/lib/msun/src/e_cosh.c",
- "upstream-freebsd/lib/msun/src/e_hypot.c",
- "upstream-freebsd/lib/msun/src/e_log10.c",
- "upstream-freebsd/lib/msun/src/e_sinh.c",
- "upstream-freebsd/lib/msun/src/e_sqrt.c",
- "upstream-freebsd/lib/msun/src/e_sqrtf.c",
- "upstream-freebsd/lib/msun/src/s_atan.c",
- "upstream-freebsd/lib/msun/src/s_cbrt.c",
- "upstream-freebsd/lib/msun/src/s_ceil.c",
- "upstream-freebsd/lib/msun/src/s_ceilf.c",
- "upstream-freebsd/lib/msun/src/s_cos.c",
- "upstream-freebsd/lib/msun/src/s_expm1.c",
- "upstream-freebsd/lib/msun/src/s_floor.c",
- "upstream-freebsd/lib/msun/src/s_floorf.c",
- "upstream-freebsd/lib/msun/src/s_log1p.c",
"upstream-freebsd/lib/msun/src/s_llrint.c",
"upstream-freebsd/lib/msun/src/s_llrintf.c",
"upstream-freebsd/lib/msun/src/s_lrint.c",
"upstream-freebsd/lib/msun/src/s_lrintf.c",
"upstream-freebsd/lib/msun/src/s_rint.c",
"upstream-freebsd/lib/msun/src/s_rintf.c",
- "upstream-freebsd/lib/msun/src/s_sin.c",
- "upstream-freebsd/lib/msun/src/s_tan.c",
- "upstream-freebsd/lib/msun/src/s_tanh.c",
"upstream-freebsd/lib/msun/src/s_trunc.c",
"upstream-freebsd/lib/msun/src/s_truncf.c",
],
@@ -558,32 +473,40 @@
genrule {
name: "libm.arm.map",
- out: ["libm.arm.map"],
+ out: ["libm.arm.map.txt"],
srcs: ["libm.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) arm $(in) $(out)",
}
genrule {
name: "libm.arm64.map",
- out: ["libm.arm64.map"],
+ out: ["libm.arm64.map.txt"],
srcs: ["libm.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) arm64 $(in) $(out)",
+}
+
+genrule {
+ name: "libm.riscv64.map",
+ out: ["libm.riscv64.map.txt"],
+ srcs: ["libm.map.txt"],
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
}
genrule {
name: "libm.x86.map",
- out: ["libm.x86.map"],
+ out: ["libm.x86.map.txt"],
srcs: ["libm.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) x86 $(in) $(out)",
}
genrule {
name: "libm.x86_64.map",
- out: ["libm.x86_64.map"],
+ out: ["libm.x86_64.map.txt"],
srcs: ["libm.map.txt"],
- tool_files: [":bionic-generate-version-script"],
- cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
+ tools: ["generate-version-script"],
+ cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
}
diff --git a/libm/NOTICE b/libm/NOTICE
index 64d253a..5e2f8ca 100644
--- a/libm/NOTICE
+++ b/libm/NOTICE
@@ -253,7 +253,7 @@
-------------------------------------------------------------------
-Copyright (C) 2018 The Android Open Source Project
+Copyright (C) 2021 The Android Open Source Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -281,7 +281,7 @@
-------------------------------------------------------------------
-Copyright (C) 2021 The Android Open Source Project
+Copyright (C) 2022 The Android Open Source Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -1120,37 +1120,6 @@
-------------------------------------------------------------------
-Copyright (c) 2013-2014, NVIDIA Corporation. All rights reserved.
-Johnny Qiu <joqiu@nvidia.com>
-Shu Zhang <chazhang@nvidia.com>
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2014, Intel Corporation
All rights reserved.
diff --git a/libm/arm/fenv.c b/libm/arm/fenv.c
index 67c6456..a7e2bfd 100644
--- a/libm/arm/fenv.c
+++ b/libm/arm/fenv.c
@@ -1,34 +1,126 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
+/*-
+ * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- * * Redistributions of source code must retain the above copyright
+ * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/msun/arm/fenv.c,v 1.1 2004/06/06 10:03:59 das Exp $
*/
#include <fenv.h>
-#define __BIONIC_FENV_INLINE /* Out of line. */
-#include <bits/fenv_inlines_arm.h>
+#define FPSCR_RMODE_SHIFT 22
const fenv_t __fe_dfl_env = 0;
+
+int fegetenv(fenv_t* __envp) {
+ fenv_t _fpscr;
+ __asm__ __volatile__("vmrs %0,fpscr" : "=r"(_fpscr));
+ *__envp = _fpscr;
+ return 0;
+}
+
+int fesetenv(const fenv_t* __envp) {
+ fenv_t _fpscr = *__envp;
+ __asm__ __volatile__("vmsr fpscr,%0" : : "ri"(_fpscr));
+ return 0;
+}
+
+int feclearexcept(int __excepts) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ __fpscr &= ~__excepts;
+ fesetenv(&__fpscr);
+ return 0;
+}
+
+int fegetexceptflag(fexcept_t* __flagp, int __excepts) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ *__flagp = __fpscr & __excepts;
+ return 0;
+}
+
+int fesetexceptflag(const fexcept_t* __flagp, int __excepts) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ __fpscr &= ~__excepts;
+ __fpscr |= *__flagp & __excepts;
+ fesetenv(&__fpscr);
+ return 0;
+}
+
+int feraiseexcept(int __excepts) {
+ fexcept_t __ex = __excepts;
+ fesetexceptflag(&__ex, __excepts);
+ return 0;
+}
+
+int fetestexcept(int __excepts) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ return (__fpscr & __excepts);
+}
+
+int fegetround(void) {
+ fenv_t _fpscr;
+ fegetenv(&_fpscr);
+ return ((_fpscr >> FPSCR_RMODE_SHIFT) & 0x3);
+}
+
+int fesetround(int __round) {
+ fenv_t _fpscr;
+ fegetenv(&_fpscr);
+ _fpscr &= ~(0x3 << FPSCR_RMODE_SHIFT);
+ _fpscr |= (__round << FPSCR_RMODE_SHIFT);
+ fesetenv(&_fpscr);
+ return 0;
+}
+
+int feholdexcept(fenv_t* __envp) {
+ fenv_t __env;
+ fegetenv(&__env);
+ *__envp = __env;
+ __env &= ~FE_ALL_EXCEPT;
+ fesetenv(&__env);
+ return 0;
+}
+
+int feupdateenv(const fenv_t* __envp) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ fesetenv(__envp);
+ feraiseexcept(__fpscr & FE_ALL_EXCEPT);
+ return 0;
+}
+
+int feenableexcept(int __mask __unused) {
+ return -1;
+}
+
+int fedisableexcept(int __mask __unused) {
+ return 0;
+}
+
+int fegetexcept(void) {
+ return 0;
+}
diff --git a/libm/arm/floor.S b/libm/arm/floor.S
deleted file mode 100644
index 3af8f76..0000000
--- a/libm/arm/floor.S
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2013-2014, NVIDIA Corporation. All rights reserved.
- * Johnny Qiu <joqiu@nvidia.com>
- * Shu Zhang <chazhang@nvidia.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <float.h>
-#include <private/bionic_asm.h>
-
-ENTRY(floor) /* x in r0, r1 */
-
- and r3, r1, #0x80000000 /* sign(x) */
- bic r1, r1, #0x80000000 /* x = abs(x) */
-
- /* extract exp of x */
- lsr r2, r1, #20
- sub r2, r2, #0x3fc
- subs r2, r2, #0x3 /* r2 <- exp */
-
- /* |x| < 1.0? */
- blt .Lx_lt_one
-
- /* x < 0? */
- cmp r3, #0
- bne .Lclr_frac_neg
-
- /* |x| <= 2^20? */
- cmp r2, #20
- ble .Lclr_frac_r1
-
- /* |x| < 2^52? */
- cmp r2, #52
- blt .Lclr_frac_r0
-
- /* return x */
- bx lr
-
-.Lclr_frac_r1:
- rsb r2, r2, #20
- lsr r1, r1, r2
- lsl r1, r1, r2
- mov r0, #0
- bx lr
-
-.Lclr_frac_r0:
- rsb r2, r2, #52
- lsr r0, r0, r2
- lsl r0, r0, r2
- bx lr
-
-.Lclr_frac_neg:
- /* |x| <= 2^20? */
- cmp r2, #20
- ble .Lclr_frac_r1_neg
-
- /* |x| < 2^52? */
- cmp r2, #52
- blt .Lclr_frac_r0_neg
-
- /* return x */
- orr r1, r1, #0x80000000
- bx lr
-
-.Lclr_frac_r1_neg:
- rsb r2, r2, #20
- mov r3, #1
- lsl r3, r3, r2
- sub r3, r3, #1
- and r3, r1, r3
- orr r3, r3, r0
- lsr r1, r1, r2
- lsl r1, r1, r2
- mov r0, #0
- b .Lreturn_x_neg
-
-.Lclr_frac_r0_neg:
- rsb r2, r2, #52
- mov r3, #1
- lsl r3, r3, r2
- sub r3, r3, #1
- and r3, r0, r3
- lsr r0, r0, r2
- lsl r0, r0, r2
- b .Lreturn_x_neg
-
-.Lx_lt_one:
- /* x == +-0? */
- cmp r0, #0
- cmpeq r1, #0
- orreq r1, r1, r3
- bxeq lr
-
- /* (x > 0) ? 0 : -1 */
- mov r1, #0x00100000
- mov r0, #0
- cmp r3, #0
- movne r1, #0xc0000000
- sub r1, r1, #0x00100000
- bx lr
-
-.Lreturn_x_neg:
- cmp r3, #0
- orr r1, r1, #0x80000000
- bxeq lr
-
- vmov d16, r0, r1
- vmov.f64 d18, #1.0
- vsub.f64 d16, d16, d18
- vmov r0, r1, d16
- bx lr
-
-END(floor)
-
-ALIAS_SYMBOL(floorl, floor);
diff --git a/libm/arm/sqrt.S b/libm/arm/sqrt.S
deleted file mode 100644
index f2981f4..0000000
--- a/libm/arm/sqrt.S
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2013-2014, NVIDIA Corporation. All rights reserved.
- * Johnny Qiu <joqiu@nvidia.com>
- * Shu Zhang <chazhang@nvidia.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <float.h>
-#include <private/bionic_asm.h>
-
-ENTRY(sqrt)
- vmov.f64 d0, r0, r1
- vsqrt.f64 d0, d0
- vmov.f64 r0, r1, d0
- bx lr
-END(sqrt)
-
-ENTRY(sqrtf)
- vmov.f32 s0, r0
- vsqrt.f32 s0, s0
- vmov.f32 r0, s0
- bx lr
-END(sqrtf)
-
-ALIAS_SYMBOL(sqrtl, sqrt);
diff --git a/libm/arm64/fenv.c b/libm/arm64/fenv.c
index a99288b..0f28d0c 100644
--- a/libm/arm64/fenv.c
+++ b/libm/arm64/fenv.c
@@ -59,7 +59,6 @@
int fesetenv(const fenv_t* envp) {
fpu_control_t fpcr;
-
__get_fpcr(fpcr);
if (envp->__control != fpcr) {
__set_fpcr(envp->__control);
@@ -70,27 +69,22 @@
int feclearexcept(int excepts) {
fpu_status_t fpsr;
-
- excepts &= FE_ALL_EXCEPT;
__get_fpsr(fpsr);
- fpsr &= ~excepts;
+ fpsr &= ~(excepts & FE_ALL_EXCEPT);
__set_fpsr(fpsr);
return 0;
}
int fegetexceptflag(fexcept_t* flagp, int excepts) {
fpu_status_t fpsr;
-
- excepts &= FE_ALL_EXCEPT;
__get_fpsr(fpsr);
- *flagp = fpsr & excepts;
+ *flagp = fpsr & (excepts & FE_ALL_EXCEPT);
return 0;
}
int fesetexceptflag(const fexcept_t* flagp, int excepts) {
- fpu_status_t fpsr;
-
excepts &= FE_ALL_EXCEPT;
+ fpu_status_t fpsr;
__get_fpsr(fpsr);
fpsr &= ~excepts;
fpsr |= *flagp & excepts;
@@ -100,32 +94,27 @@
int feraiseexcept(int excepts) {
fexcept_t ex = excepts;
-
fesetexceptflag(&ex, excepts);
return 0;
}
int fetestexcept(int excepts) {
fpu_status_t fpsr;
-
- excepts &= FE_ALL_EXCEPT;
__get_fpsr(fpsr);
- return (fpsr & excepts);
+ return (fpsr & (excepts & FE_ALL_EXCEPT));
}
int fegetround(void) {
fpu_control_t fpcr;
-
__get_fpcr(fpcr);
return ((fpcr >> FPCR_RMODE_SHIFT) & FE_TOWARDZERO);
}
int fesetround(int round) {
- fpu_control_t fpcr, new_fpcr;
-
- round &= FE_TOWARDZERO;
+ if (round < FE_TONEAREST || round > FE_TOWARDZERO) return -1;
+ fpu_control_t fpcr;
__get_fpcr(fpcr);
- new_fpcr = fpcr & ~(FE_TOWARDZERO << FPCR_RMODE_SHIFT);
+ fpu_control_t new_fpcr = fpcr & ~(FE_TOWARDZERO << FPCR_RMODE_SHIFT);
new_fpcr |= (round << FPCR_RMODE_SHIFT);
if (new_fpcr != fpcr) {
__set_fpcr(new_fpcr);
@@ -134,33 +123,15 @@
}
int feholdexcept(fenv_t* envp) {
- fpu_status_t fpsr;
- __get_fpsr(fpsr);
- fpu_control_t fpcr;
- __get_fpcr(fpcr);
- fenv_t env = { .__status = fpsr, .__control = fpcr };
- *envp = env;
-
- // Clear all exceptions.
- fpsr &= ~FE_ALL_EXCEPT;
- __set_fpsr(fpsr);
+ fegetenv(envp);
+ feclearexcept(FE_ALL_EXCEPT);
return 0;
}
int feupdateenv(const fenv_t* envp) {
- fpu_status_t fpsr;
- fpu_control_t fpcr;
-
- // Set FPU Control register.
- __get_fpcr(fpcr);
- if (envp->__control != fpcr) {
- __set_fpcr(envp->__control);
- }
-
- // Set FPU Status register to status | currently raised exceptions.
- __get_fpsr(fpsr);
- fpsr = envp->__status | (fpsr & FE_ALL_EXCEPT);
- __set_fpsr(fpsr);
+ int excepts = fetestexcept(FE_ALL_EXCEPT);
+ fesetenv(envp);
+ feraiseexcept(excepts);
return 0;
}
diff --git a/libm/arm64/lrint.S b/libm/arm64/lrint.S
deleted file mode 100644
index e835d08..0000000
--- a/libm/arm64/lrint.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <private/bionic_asm.h>
-
-ENTRY(lrint)
- frintX d0, d0
- fcvtzs x0, d0
- ret
-END(lrint)
-
-ENTRY(lrintf)
- frintX s0, s0
- fcvtzs x0, s0
- ret
-END(lrintf)
-
-// sizeof(long) and sizeof(long long) are the same for aarch64
-ALIAS_SYMBOL(llrint, lrint);
-
-ALIAS_SYMBOL(llrintf, lrintf);
-
-NOTE_GNU_PROPERTY()
diff --git a/libm/builtins.cpp b/libm/builtins.cpp
index 3b9228c..41e145b 100644
--- a/libm/builtins.cpp
+++ b/libm/builtins.cpp
@@ -18,40 +18,43 @@
#include "fpmath.h"
-double fabs(double x) {
-#if __arm__
- // Both Clang and GCC insist on moving r0/r1 into a double register
- // and using fabs where bit-twiddling would be a better choice.
- // They get fabsf right, but we need to be careful in fabsl too.
- IEEEd2bits u;
- u.d = x;
- u.bits.sign = 0;
- return u.d;
-#else
- return __builtin_fabs(x);
-#endif
-}
-
-float fabsf(float x) {
- return __builtin_fabsf(x);
-}
-
-#if defined(__LP64__)
+double fabs(double x) { return __builtin_fabs(x); }
+float fabsf(float x) { return __builtin_fabsf(x); }
long double fabsl(long double x) { return __builtin_fabsl(x); }
-#else
-long double fabsl(long double x) {
- // Don't use __builtin_fabs here because of ARM. (See fabs above.)
- return fabs(x);
-}
-#endif
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(__riscv) || defined(__i386__) || defined(__x86_64__)
float ceilf(float x) { return __builtin_ceilf(x); }
double ceil(double x) { return __builtin_ceil(x); }
+#if defined(__ILP32__)
+__weak_reference(ceil, ceill);
+#endif
+#endif
+double copysign(double x, double y) { return __builtin_copysign(x, y); }
+float copysignf(float x, float y) { return __builtin_copysignf(x, y); }
+long double copysignl(long double x, long double y) { return __builtin_copysignl(x, y); }
+
+#if defined(__arm__) && (__ARM_ARCH < 8)
+// armv8 arm32 has a single-instruction implementation for these, but
+// armv7 arm32 doesn't, so __builtin_ doesn't work for arm32.
+#include "math_private.h"
+namespace s_floor {
+#include "upstream-freebsd/lib/msun/src/s_floor.c"
+}
+namespace s_floorf {
+#include "upstream-freebsd/lib/msun/src/s_floorf.c"
+}
+float floorf(float x) { return s_floorf::floorf(x); }
+double floor(double x) { return s_floor::floor(x); }
+#else
float floorf(float x) { return __builtin_floorf(x); }
double floor(double x) { return __builtin_floor(x); }
+#if defined(__ILP32__)
+__weak_reference(floor, floorl);
+#endif
+#endif
+#if defined(__aarch64__) || defined(__riscv)
float fmaf(float x, float y, float z) { return __builtin_fmaf(x, y, z); }
double fma(double x, double y, double z) { return __builtin_fma(x, y, z); }
@@ -60,13 +63,45 @@
float fminf(float x, float y) { return __builtin_fminf(x, y); }
double fmin(double x, double y) { return __builtin_fmin(x, y); }
+#endif
+#if defined(__aarch64__) || defined(__riscv)
+long lrint(double x) { return __builtin_lrint(x); }
+long lrintf(float x) { return __builtin_lrintf(x); }
+long long llrint(double x) { return __builtin_llrint(x); }
+long long llrintf(float x) { return __builtin_llrintf(x); }
+#endif
+
+#if defined(__aarch64__) || defined(__riscv)
+long lround(double x) { return __builtin_lround(x); }
+long lroundf(float x) { return __builtin_lroundf(x); }
+long long llround(double x) { return __builtin_llround(x); }
+long long llroundf(float x) { return __builtin_llroundf(x); }
+#endif
+
+#if defined(__aarch64__) || defined(__riscv) || defined(__i386__) || defined(__x86_64__)
float rintf(float x) { return __builtin_rintf(x); }
double rint(double x) { return __builtin_rint(x); }
+#if defined(__ILP32__)
+__weak_reference(rint, rintl);
+#endif
+#endif
+#if defined(__aarch64__) || defined(__riscv)
float roundf(float x) { return __builtin_roundf(x); }
double round(double x) { return __builtin_round(x); }
+#endif
+float sqrtf(float x) { return __builtin_sqrtf(x); }
+double sqrt(double x) { return __builtin_sqrt(x); }
+#if defined(__ILP32__)
+__weak_reference(sqrt, sqrtl);
+#endif
+
+#if defined(__aarch64__) || defined(__riscv) || defined(__i386__) || defined(__x86_64__)
float truncf(float x) { return __builtin_truncf(x); }
double trunc(double x) { return __builtin_trunc(x); }
+#if defined(__ILP32__)
+__weak_reference(trunc, truncl);
+#endif
#endif
diff --git a/libm/fake_long_double.c b/libm/fake_long_double.c
index 26edfeb..5f9b980 100644
--- a/libm/fake_long_double.c
+++ b/libm/fake_long_double.c
@@ -24,7 +24,6 @@
// Android works around those cases by replacing the broken functions with our own trivial stubs
// that call the regular "double" function.
-long double copysignl(long double a1, long double a2) { return copysign(a1, a2); }
long double fmaxl(long double a1, long double a2) { return fmax(a1, a2); }
long double fmodl(long double a1, long double a2) { return fmod(a1, a2); }
long double fminl(long double a1, long double a2) { return fmin(a1, a2); }
diff --git a/libm/riscv64/fenv.c b/libm/riscv64/fenv.c
new file mode 100644
index 0000000..f16e5a9
--- /dev/null
+++ b/libm/riscv64/fenv.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fenv.h>
+#include <stdint.h>
+
+const fenv_t __fe_dfl_env = 0;
+
+int fegetenv(fenv_t* envp) {
+ __asm__ __volatile__("frcsr %0" : "=r"(*envp));
+ return 0;
+}
+
+int fesetenv(const fenv_t* envp) {
+ fenv_t env;
+ fegetenv(&env);
+ if (*envp != env) {
+ __asm__ __volatile__("fscsr %z0" : : "r"(*envp));
+ }
+ return 0;
+}
+
+int feclearexcept(int excepts) {
+ __asm__ __volatile__("csrc fflags, %0" : : "r"(excepts & FE_ALL_EXCEPT));
+ return 0;
+}
+
+int fegetexceptflag(fexcept_t* flagp, int excepts) {
+ *flagp = fetestexcept(excepts & FE_ALL_EXCEPT);
+ return 0;
+}
+
+int fesetexceptflag(const fexcept_t* flagp, int excepts) {
+ feclearexcept((~*flagp) & excepts);
+ feraiseexcept(*flagp & excepts);
+ return 0;
+}
+
+int feraiseexcept(int excepts) {
+ __asm__ __volatile__("csrs fflags, %0" : : "r"(excepts));
+ return 0;
+}
+
+int fetestexcept(int excepts) {
+ int flags;
+ __asm__ __volatile__("frflags %0" : "=r"(flags));
+ return flags & excepts;
+}
+
+int fegetround(void) {
+ int rm;
+ __asm__ __volatile__("frrm %0" : "=r"(rm));
+ return rm;
+}
+
+int fesetround(int round) {
+ if (round < FE_TONEAREST || round > FE_UPWARD) return -1;
+ __asm__ __volatile__("fsrm %z0" : : "r"(round));
+ return 0;
+}
+
+int feholdexcept(fenv_t* envp) {
+ fegetenv(envp);
+ feclearexcept(FE_ALL_EXCEPT);
+ return 0;
+}
+
+int feupdateenv(const fenv_t* envp) {
+ int excepts = fetestexcept(FE_ALL_EXCEPT);
+ fesetenv(envp);
+ feraiseexcept(excepts);
+ return 0;
+}
+
+int feenableexcept(int mask __unused) {
+ return -1;
+}
+
+int fedisableexcept(int mask __unused) {
+ return 0;
+}
+
+int fegetexcept(void) {
+ return 0;
+}
diff --git a/libm/upstream-freebsd/lib/msun/src/e_sqrt.c b/libm/upstream-freebsd/lib/msun/src/e_sqrt.c
deleted file mode 100644
index 37351a4..0000000
--- a/libm/upstream-freebsd/lib/msun/src/e_sqrt.c
+++ /dev/null
@@ -1,459 +0,0 @@
-
-/* @(#)e_sqrt.c 1.3 95/01/18 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <float.h>
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef USE_BUILTIN_SQRT
-double
-__ieee754_sqrt(double x)
-{
- return (__builtin_sqrt(x));
-}
-#else
-/* __ieee754_sqrt(x)
- * Return correctly rounded sqrt.
- * ------------------------------------------
- * | Use the hardware sqrt if you have one |
- * ------------------------------------------
- * Method:
- * Bit by bit method using integer arithmetic. (Slow, but portable)
- * 1. Normalization
- * Scale x to y in [1,4) with even powers of 2:
- * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then
- * sqrt(x) = 2^k * sqrt(y)
- * 2. Bit by bit computation
- * Let q = sqrt(y) truncated to i bit after binary point (q = 1),
- * i 0
- * i+1 2
- * s = 2*q , and y = 2 * ( y - q ). (1)
- * i i i i
- *
- * To compute q from q , one checks whether
- * i+1 i
- *
- * -(i+1) 2
- * (q + 2 ) <= y. (2)
- * i
- * -(i+1)
- * If (2) is false, then q = q ; otherwise q = q + 2 .
- * i+1 i i+1 i
- *
- * With some algebric manipulation, it is not difficult to see
- * that (2) is equivalent to
- * -(i+1)
- * s + 2 <= y (3)
- * i i
- *
- * The advantage of (3) is that s and y can be computed by
- * i i
- * the following recurrence formula:
- * if (3) is false
- *
- * s = s , y = y ; (4)
- * i+1 i i+1 i
- *
- * otherwise,
- * -i -(i+1)
- * s = s + 2 , y = y - s - 2 (5)
- * i+1 i i+1 i i
- *
- * One may easily use induction to prove (4) and (5).
- * Note. Since the left hand side of (3) contain only i+2 bits,
- * it does not necessary to do a full (53-bit) comparison
- * in (3).
- * 3. Final rounding
- * After generating the 53 bits result, we compute one more bit.
- * Together with the remainder, we can decide whether the
- * result is exact, bigger than 1/2ulp, or less than 1/2ulp
- * (it will never equal to 1/2ulp).
- * The rounding mode can be detected by checking whether
- * huge + tiny is equal to huge, and whether huge - tiny is
- * equal to huge for some floating point number "huge" and "tiny".
- *
- * Special cases:
- * sqrt(+-0) = +-0 ... exact
- * sqrt(inf) = inf
- * sqrt(-ve) = NaN ... with invalid signal
- * sqrt(NaN) = NaN ... with invalid signal for signaling NaN
- *
- * Other methods : see the appended file at the end of the program below.
- *---------------
- */
-
-static const double one = 1.0, tiny=1.0e-300;
-
-double
-__ieee754_sqrt(double x)
-{
- double z;
- int32_t sign = (int)0x80000000;
- int32_t ix0,s0,q,m,t,i;
- u_int32_t r,t1,s1,ix1,q1;
-
- EXTRACT_WORDS(ix0,ix1,x);
-
- /* take care of Inf and NaN */
- if((ix0&0x7ff00000)==0x7ff00000) {
- return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
- sqrt(-inf)=sNaN */
- }
- /* take care of zero */
- if(ix0<=0) {
- if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */
- else if(ix0<0)
- return (x-x)/(x-x); /* sqrt(-ve) = sNaN */
- }
- /* normalize x */
- m = (ix0>>20);
- if(m==0) { /* subnormal x */
- while(ix0==0) {
- m -= 21;
- ix0 |= (ix1>>11); ix1 <<= 21;
- }
- for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1;
- m -= i-1;
- ix0 |= (ix1>>(32-i));
- ix1 <<= i;
- }
- m -= 1023; /* unbias exponent */
- ix0 = (ix0&0x000fffff)|0x00100000;
- if(m&1){ /* odd m, double x to make it even */
- ix0 += ix0 + ((ix1&sign)>>31);
- ix1 += ix1;
- }
- m >>= 1; /* m = [m/2] */
-
- /* generate sqrt(x) bit by bit */
- ix0 += ix0 + ((ix1&sign)>>31);
- ix1 += ix1;
- q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */
- r = 0x00200000; /* r = moving bit from right to left */
-
- while(r!=0) {
- t = s0+r;
- if(t<=ix0) {
- s0 = t+r;
- ix0 -= t;
- q += r;
- }
- ix0 += ix0 + ((ix1&sign)>>31);
- ix1 += ix1;
- r>>=1;
- }
-
- r = sign;
- while(r!=0) {
- t1 = s1+r;
- t = s0;
- if((t<ix0)||((t==ix0)&&(t1<=ix1))) {
- s1 = t1+r;
- if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1;
- ix0 -= t;
- if (ix1 < t1) ix0 -= 1;
- ix1 -= t1;
- q1 += r;
- }
- ix0 += ix0 + ((ix1&sign)>>31);
- ix1 += ix1;
- r>>=1;
- }
-
- /* use floating add to find out rounding direction */
- if((ix0|ix1)!=0) {
- z = one-tiny; /* trigger inexact flag */
- if (z>=one) {
- z = one+tiny;
- if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;}
- else if (z>one) {
- if (q1==(u_int32_t)0xfffffffe) q+=1;
- q1+=2;
- } else
- q1 += (q1&1);
- }
- }
- ix0 = (q>>1)+0x3fe00000;
- ix1 = q1>>1;
- if ((q&1)==1) ix1 |= sign;
- ix0 += (m <<20);
- INSERT_WORDS(z,ix0,ix1);
- return z;
-}
-#endif
-
-#if (LDBL_MANT_DIG == 53)
-__weak_reference(sqrt, sqrtl);
-#endif
-
-/*
-Other methods (use floating-point arithmetic)
--------------
-(This is a copy of a drafted paper by Prof W. Kahan
-and K.C. Ng, written in May, 1986)
-
- Two algorithms are given here to implement sqrt(x)
- (IEEE double precision arithmetic) in software.
- Both supply sqrt(x) correctly rounded. The first algorithm (in
- Section A) uses newton iterations and involves four divisions.
- The second one uses reciproot iterations to avoid division, but
- requires more multiplications. Both algorithms need the ability
- to chop results of arithmetic operations instead of round them,
- and the INEXACT flag to indicate when an arithmetic operation
- is executed exactly with no roundoff error, all part of the
- standard (IEEE 754-1985). The ability to perform shift, add,
- subtract and logical AND operations upon 32-bit words is needed
- too, though not part of the standard.
-
-A. sqrt(x) by Newton Iteration
-
- (1) Initial approximation
-
- Let x0 and x1 be the leading and the trailing 32-bit words of
- a floating point number x (in IEEE double format) respectively
-
- 1 11 52 ...widths
- ------------------------------------------------------
- x: |s| e | f |
- ------------------------------------------------------
- msb lsb msb lsb ...order
-
-
- ------------------------ ------------------------
- x0: |s| e | f1 | x1: | f2 |
- ------------------------ ------------------------
-
- By performing shifts and subtracts on x0 and x1 (both regarded
- as integers), we obtain an 8-bit approximation of sqrt(x) as
- follows.
-
- k := (x0>>1) + 0x1ff80000;
- y0 := k - T1[31&(k>>15)]. ... y ~ sqrt(x) to 8 bits
- Here k is a 32-bit integer and T1[] is an integer array containing
- correction terms. Now magically the floating value of y (y's
- leading 32-bit word is y0, the value of its trailing word is 0)
- approximates sqrt(x) to almost 8-bit.
-
- Value of T1:
- static int T1[32]= {
- 0, 1024, 3062, 5746, 9193, 13348, 18162, 23592,
- 29598, 36145, 43202, 50740, 58733, 67158, 75992, 85215,
- 83599, 71378, 60428, 50647, 41945, 34246, 27478, 21581,
- 16499, 12183, 8588, 5674, 3403, 1742, 661, 130,};
-
- (2) Iterative refinement
-
- Apply Heron's rule three times to y, we have y approximates
- sqrt(x) to within 1 ulp (Unit in the Last Place):
-
- y := (y+x/y)/2 ... almost 17 sig. bits
- y := (y+x/y)/2 ... almost 35 sig. bits
- y := y-(y-x/y)/2 ... within 1 ulp
-
-
- Remark 1.
- Another way to improve y to within 1 ulp is:
-
- y := (y+x/y) ... almost 17 sig. bits to 2*sqrt(x)
- y := y - 0x00100006 ... almost 18 sig. bits to sqrt(x)
-
- 2
- (x-y )*y
- y := y + 2* ---------- ...within 1 ulp
- 2
- 3y + x
-
-
- This formula has one division fewer than the one above; however,
- it requires more multiplications and additions. Also x must be
- scaled in advance to avoid spurious overflow in evaluating the
- expression 3y*y+x. Hence it is not recommended uless division
- is slow. If division is very slow, then one should use the
- reciproot algorithm given in section B.
-
- (3) Final adjustment
-
- By twiddling y's last bit it is possible to force y to be
- correctly rounded according to the prevailing rounding mode
- as follows. Let r and i be copies of the rounding mode and
- inexact flag before entering the square root program. Also we
- use the expression y+-ulp for the next representable floating
- numbers (up and down) of y. Note that y+-ulp = either fixed
- point y+-1, or multiply y by nextafter(1,+-inf) in chopped
- mode.
-
- I := FALSE; ... reset INEXACT flag I
- R := RZ; ... set rounding mode to round-toward-zero
- z := x/y; ... chopped quotient, possibly inexact
- If(not I) then { ... if the quotient is exact
- if(z=y) {
- I := i; ... restore inexact flag
- R := r; ... restore rounded mode
- return sqrt(x):=y.
- } else {
- z := z - ulp; ... special rounding
- }
- }
- i := TRUE; ... sqrt(x) is inexact
- If (r=RN) then z=z+ulp ... rounded-to-nearest
- If (r=RP) then { ... round-toward-+inf
- y = y+ulp; z=z+ulp;
- }
- y := y+z; ... chopped sum
- y0:=y0-0x00100000; ... y := y/2 is correctly rounded.
- I := i; ... restore inexact flag
- R := r; ... restore rounded mode
- return sqrt(x):=y.
-
- (4) Special cases
-
- Square root of +inf, +-0, or NaN is itself;
- Square root of a negative number is NaN with invalid signal.
-
-
-B. sqrt(x) by Reciproot Iteration
-
- (1) Initial approximation
-
- Let x0 and x1 be the leading and the trailing 32-bit words of
- a floating point number x (in IEEE double format) respectively
- (see section A). By performing shifs and subtracts on x0 and y0,
- we obtain a 7.8-bit approximation of 1/sqrt(x) as follows.
-
- k := 0x5fe80000 - (x0>>1);
- y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits
-
- Here k is a 32-bit integer and T2[] is an integer array
- containing correction terms. Now magically the floating
- value of y (y's leading 32-bit word is y0, the value of
- its trailing word y1 is set to zero) approximates 1/sqrt(x)
- to almost 7.8-bit.
-
- Value of T2:
- static int T2[64]= {
- 0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866,
- 0xf14a, 0x1091b,0x11fcd,0x13552,0x14999,0x15c98,0x16e34,0x17e5f,
- 0x18d03,0x19a01,0x1a545,0x1ae8a,0x1b5c4,0x1bb01,0x1bfde,0x1c28d,
- 0x1c2de,0x1c0db,0x1ba73,0x1b11c,0x1a4b5,0x1953d,0x18266,0x16be0,
- 0x1683e,0x179d8,0x18a4d,0x19992,0x1a789,0x1b445,0x1bf61,0x1c989,
- 0x1d16d,0x1d77b,0x1dddf,0x1e2ad,0x1e5bf,0x1e6e8,0x1e654,0x1e3cd,
- 0x1df2a,0x1d635,0x1cb16,0x1be2c,0x1ae4e,0x19bde,0x1868e,0x16e2e,
- 0x1527f,0x1334a,0x11051,0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd,};
-
- (2) Iterative refinement
-
- Apply Reciproot iteration three times to y and multiply the
- result by x to get an approximation z that matches sqrt(x)
- to about 1 ulp. To be exact, we will have
- -1ulp < sqrt(x)-z<1.0625ulp.
-
- ... set rounding mode to Round-to-nearest
- y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x)
- y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x)
- ... special arrangement for better accuracy
- z := x*y ... 29 bits to sqrt(x), with z*y<1
- z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x)
-
- Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that
- (a) the term z*y in the final iteration is always less than 1;
- (b) the error in the final result is biased upward so that
- -1 ulp < sqrt(x) - z < 1.0625 ulp
- instead of |sqrt(x)-z|<1.03125ulp.
-
- (3) Final adjustment
-
- By twiddling y's last bit it is possible to force y to be
- correctly rounded according to the prevailing rounding mode
- as follows. Let r and i be copies of the rounding mode and
- inexact flag before entering the square root program. Also we
- use the expression y+-ulp for the next representable floating
- numbers (up and down) of y. Note that y+-ulp = either fixed
- point y+-1, or multiply y by nextafter(1,+-inf) in chopped
- mode.
-
- R := RZ; ... set rounding mode to round-toward-zero
- switch(r) {
- case RN: ... round-to-nearest
- if(x<= z*(z-ulp)...chopped) z = z - ulp; else
- if(x<= z*(z+ulp)...chopped) z = z; else z = z+ulp;
- break;
- case RZ:case RM: ... round-to-zero or round-to--inf
- R:=RP; ... reset rounding mod to round-to-+inf
- if(x<z*z ... rounded up) z = z - ulp; else
- if(x>=(z+ulp)*(z+ulp) ...rounded up) z = z+ulp;
- break;
- case RP: ... round-to-+inf
- if(x>(z+ulp)*(z+ulp)...chopped) z = z+2*ulp; else
- if(x>z*z ...chopped) z = z+ulp;
- break;
- }
-
- Remark 3. The above comparisons can be done in fixed point. For
- example, to compare x and w=z*z chopped, it suffices to compare
- x1 and w1 (the trailing parts of x and w), regarding them as
- two's complement integers.
-
- ...Is z an exact square root?
- To determine whether z is an exact square root of x, let z1 be the
- trailing part of z, and also let x0 and x1 be the leading and
- trailing parts of x.
-
- If ((z1&0x03ffffff)!=0) ... not exact if trailing 26 bits of z!=0
- I := 1; ... Raise Inexact flag: z is not exact
- else {
- j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2
- k := z1 >> 26; ... get z's 25-th and 26-th
- fraction bits
- I := i or (k&j) or ((k&(j+j+1))!=(x1&3));
- }
- R:= r ... restore rounded mode
- return sqrt(x):=z.
-
- If multiplication is cheaper then the foregoing red tape, the
- Inexact flag can be evaluated by
-
- I := i;
- I := (z*z!=x) or I.
-
- Note that z*z can overwrite I; this value must be sensed if it is
- True.
-
- Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be
- zero.
-
- --------------------
- z1: | f2 |
- --------------------
- bit 31 bit 0
-
- Further more, bit 27 and 26 of z1, bit 0 and 1 of x1, and the odd
- or even of logb(x) have the following relations:
-
- -------------------------------------------------
- bit 27,26 of z1 bit 1,0 of x1 logb(x)
- -------------------------------------------------
- 00 00 odd and even
- 01 01 even
- 10 10 odd
- 10 00 even
- 11 01 even
- -------------------------------------------------
-
- (4) Special cases (see (4) of Section A).
-
- */
-
diff --git a/libm/upstream-freebsd/lib/msun/src/e_sqrtf.c b/libm/upstream-freebsd/lib/msun/src/e_sqrtf.c
deleted file mode 100644
index 06e5d62..0000000
--- a/libm/upstream-freebsd/lib/msun/src/e_sqrtf.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* e_sqrtf.c -- float version of e_sqrt.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#ifndef lint
-static char rcsid[] = "$FreeBSD$";
-#endif
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef USE_BUILTIN_SQRTF
-float
-__ieee754_sqrtf(float x)
-{
- return (__builtin_sqrtf(x));
-}
-#else
-static const float one = 1.0, tiny=1.0e-30;
-
-float
-__ieee754_sqrtf(float x)
-{
- float z;
- int32_t sign = (int)0x80000000;
- int32_t ix,s,q,m,t,i;
- u_int32_t r;
-
- GET_FLOAT_WORD(ix,x);
-
- /* take care of Inf and NaN */
- if((ix&0x7f800000)==0x7f800000) {
- return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
- sqrt(-inf)=sNaN */
- }
- /* take care of zero */
- if(ix<=0) {
- if((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */
- else if(ix<0)
- return (x-x)/(x-x); /* sqrt(-ve) = sNaN */
- }
- /* normalize x */
- m = (ix>>23);
- if(m==0) { /* subnormal x */
- for(i=0;(ix&0x00800000)==0;i++) ix<<=1;
- m -= i-1;
- }
- m -= 127; /* unbias exponent */
- ix = (ix&0x007fffff)|0x00800000;
- if(m&1) /* odd m, double x to make it even */
- ix += ix;
- m >>= 1; /* m = [m/2] */
-
- /* generate sqrt(x) bit by bit */
- ix += ix;
- q = s = 0; /* q = sqrt(x) */
- r = 0x01000000; /* r = moving bit from right to left */
-
- while(r!=0) {
- t = s+r;
- if(t<=ix) {
- s = t+r;
- ix -= t;
- q += r;
- }
- ix += ix;
- r>>=1;
- }
-
- /* use floating add to find out rounding direction */
- if(ix!=0) {
- z = one-tiny; /* trigger inexact flag */
- if (z>=one) {
- z = one+tiny;
- if (z>one)
- q += 2;
- else
- q += (q&1);
- }
- }
- ix = (q>>1)+0x3f000000;
- ix += (m <<23);
- SET_FLOAT_WORD(z,ix);
- return z;
-}
-#endif
diff --git a/libm/upstream-freebsd/lib/msun/src/math_private.h b/libm/upstream-freebsd/lib/msun/src/math_private.h
index b91b54c..df526e7 100644
--- a/libm/upstream-freebsd/lib/msun/src/math_private.h
+++ b/libm/upstream-freebsd/lib/msun/src/math_private.h
@@ -460,7 +460,7 @@
* or by having |c| a few percent smaller than |a|. Pre-normalization of
* (a, b) may help.
*
- * This is is a variant of an algorithm of Kahan (see Knuth (1981) 4.2.2
+ * This is a variant of an algorithm of Kahan (see Knuth (1981) 4.2.2
* exercise 19). We gain considerable efficiency by requiring the terms to
* be sufficiently normalized and sufficiently increasing.
*/
@@ -644,7 +644,7 @@
* return type provided their arg is a floating point integer. They can
* sometimes be more efficient because no rounding is required.
*/
-#if (defined(amd64) || defined(__i386__)) && defined(__GNUCLIKE_ASM)
+#if defined(amd64) || defined(__i386__)
#define irint(x) \
(sizeof(x) == sizeof(float) && \
sizeof(__float_t) == sizeof(long double) ? irintf(x) : \
@@ -657,7 +657,7 @@
#define i64rint(x) ((int64_t)(x)) /* only needed for ld128 so not opt. */
-#if defined(__i386__) && defined(__GNUCLIKE_ASM)
+#if defined(__i386__)
static __inline int
irintf(float x)
{
@@ -677,7 +677,7 @@
}
#endif
-#if (defined(__amd64__) || defined(__i386__)) && defined(__GNUCLIKE_ASM)
+#if defined(__amd64__) || defined(__i386__)
static __inline int
irintl(long double x)
{
diff --git a/libm/upstream-freebsd/lib/msun/src/w_cabsf.c b/libm/upstream-freebsd/lib/msun/src/w_cabsf.c
index e7bfe22..b5065c8 100644
--- a/libm/upstream-freebsd/lib/msun/src/w_cabsf.c
+++ b/libm/upstream-freebsd/lib/msun/src/w_cabsf.c
@@ -15,8 +15,7 @@
#include "math_private.h"
float
-cabsf(z)
- float complex z;
+cabsf(float complex z)
{
return hypotf(crealf(z), cimagf(z));
diff --git a/libm/upstream-freebsd/lib/msun/src/w_drem.c b/libm/upstream-freebsd/lib/msun/src/w_drem.c
index 0f68409..74008a5 100644
--- a/libm/upstream-freebsd/lib/msun/src/w_drem.c
+++ b/libm/upstream-freebsd/lib/msun/src/w_drem.c
@@ -8,8 +8,7 @@
#include <math.h>
double
-drem(x, y)
- double x, y;
+drem(double x, double y)
{
return remainder(x, y);
}
diff --git a/libm/x86/ceil.S b/libm/x86/ceil.S
deleted file mode 100644
index 6302037..0000000
--- a/libm/x86/ceil.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(ceil)
- mov %esp,%eax
- and $0xfffffff8,%eax
- movsd 0x4(%esp),%xmm0
- roundsd $0x2,%xmm0,%xmm0
- movlpd %xmm0,-0x8(%eax)
- fldl -0x8(%eax)
- ret
-END(ceil)
-
-ALIAS_SYMBOL(ceill, ceil);
diff --git a/libm/x86/ceilf.S b/libm/x86/ceilf.S
deleted file mode 100644
index 51eb440..0000000
--- a/libm/x86/ceilf.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(ceilf)
- movss 0x4(%esp),%xmm0
- roundss $0x2,%xmm0,%xmm0
- movss %xmm0,-0x4(%esp)
- flds -0x4(%esp)
- ret
-END(ceilf)
diff --git a/libm/x86/e_acos.S b/libm/x86/e_acos.S
deleted file mode 100644
index 04b1787..0000000
--- a/libm/x86/e_acos.S
+++ /dev/null
@@ -1,1929 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// To compute acos(s), separate schemes are used when s is in different
-// intervals.
-//
-// |s| in [2^{-4}, sqrt(3)/2):
-// Let t=2^k*1.b1 b2..b6 1, where s=2^k*1.b1 b2 .. b52
-// acos(s)=pi/2-asin(t)-asin(r), where r=s*sqrt(1-t^2)-t*sqrt(1-s^2)
-// asin(r)-r evaluated as 7-degree polynomial (c3*r^3+c5*r^5+c7*r^7)
-// For the first degree term, r is evaluated as
-// R=(s^2-t^2)/(sqrt(1-t^2)*s+sqrt(1-s^2)*t)
-// (sqrt(1-t^2) read from table)
-// The main source of error is still R (may still be affected by up to 3 ulps
-// of rounding error). The table size must be sufficiently large, to minimize
-// this effect.
-//
-// |s| in [sqrt(3)/2, 255/256):
-// Let t=2^k*1.b1 b2..b6 1, where sqrt(1-s^2)=2^k*1.b1 b2 .. b52 (rounded)
-// acos(|s|)=asin(t)-asin(r), r=s*t-sqrt(1-s^2)*sqrt(1-t^2)
-// acos(-|s|)=pi-acos(|s|)
-// (The -PI constant, or 0, is added to the result. The sign is set at
-// the end)
-// asin(r) evaluated as a polynomial (same as above)
-// The first degree term is evaluated as
-// r=(s^2+t^2-1)/(s*t+sqrt(1-s^2)*sqrt(1-t^2))
-//
-// |s|<2^{-4}: acos(s)=pi/2-asin(s)
-// evaluate asin(s) as 13-degree polynomial
-//
-// |s| in [255/256,1): acos(|s|)=2*asin(q), where q=sqrt((1-|s|)/2)
-// asin(q) is evaluated as 13-degree polynomial
-// q^2=(1-|s|)/2 is obtained in advance
-// 2*q*eps ~ ((1-|s|)/2-q^2)/q used for first term
-// acos(-|s|)=pi-acos(|s|)
-// (The -PI constant, or 0, is added to the result. The sign is set at
-// the end)
-//
-// Special cases:
-// acos(NaN) = quiet NaN, and raise invalid exception
-// acos(INF) = QNaN and raise invalid exception
-// acos(x) = QNaN and raise invalid exception, for |x|>1.0
-// acos(1) = +0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin acos
-ENTRY(acos)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $104, %esp
- movl %ebx, 48(%esp)
- call static_func
- movl %eax, %ebx
- movsd 112(%esp), %xmm0
- movsd 6048(%ebx), %xmm4
- movsd 6080(%ebx), %xmm3
- xorpd %xmm5, %xmm5
- movsd 6064(%ebx), %xmm2
- movapd %xmm0, %xmm1
- movsd %xmm0, 8(%esp)
- psrlq $44, %xmm0
- movd %xmm0, %edx
- movapd %xmm1, %xmm7
- movl $8192, %ecx
- pinsrw $2, %ecx, %xmm5
- movapd %xmm1, %xmm0
- movl $524287, %eax
- andl %edx, %eax
- subl $260864, %eax
- cmpl $955, %eax
- jae .L_2TAG_PACKET_0.0.2
- mulsd %xmm1, %xmm1
- andl $65535, %edx
- subsd %xmm1, %xmm3
- sqrtsd %xmm3, %xmm3
- andpd %xmm7, %xmm2
- andl $-4, %edx
- subl $64256, %edx
- movsd 3840(%ebx,%edx,2), %xmm1
- orpd %xmm5, %xmm2
- movapd (%ebx,%edx,4), %xmm4
- movapd %xmm7, %xmm6
- addsd %xmm2, %xmm7
- subsd %xmm2, %xmm0
- mulsd %xmm0, %xmm7
- mulsd %xmm1, %xmm6
- mulsd %xmm2, %xmm3
- movapd %xmm6, %xmm1
- addsd %xmm3, %xmm6
- divsd %xmm6, %xmm7
- movsd 5976(%ebx), %xmm0
- movsd 5960(%ebx), %xmm5
- subsd %xmm3, %xmm1
- psrlq $63, %xmm2
- movapd %xmm1, %xmm3
- psllq $63, %xmm2
- mulsd %xmm1, %xmm1
- pshufd $68, %xmm2, %xmm2
- movsd 5968(%ebx), %xmm6
- mulsd %xmm1, %xmm3
- mulsd %xmm1, %xmm0
- xorpd %xmm2, %xmm4
- mulsd %xmm3, %xmm5
- subpd 5888(%ebx), %xmm4
- mulsd %xmm1, %xmm3
- addsd %xmm6, %xmm0
- mulsd %xmm3, %xmm0
- subsd %xmm4, %xmm5
- pshufd $238, %xmm4, %xmm4
- addsd %xmm5, %xmm0
- subsd %xmm7, %xmm0
- subsd %xmm4, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_0.0.2:
- subl $955, %eax
- cmpl $65, %eax
- jae .L_2TAG_PACKET_2.0.2
- psrlq $38, %xmm7
- psllq $38, %xmm7
- pmovmskb %xmm0, %eax
- andnpd %xmm0, %xmm4
- subsd %xmm7, %xmm1
- movapd %xmm7, %xmm6
- mulsd %xmm7, %xmm7
- addsd %xmm6, %xmm0
- orpd %xmm4, %xmm5
- subsd %xmm7, %xmm3
- mulsd %xmm1, %xmm0
- movapd %xmm3, %xmm4
- subsd %xmm0, %xmm3
- sqrtsd %xmm3, %xmm3
- andl $128, %eax
- shrl $7, %eax
- negl %eax
- movapd %xmm3, %xmm7
- andpd %xmm3, %xmm2
- psllq $2, %xmm3
- pextrw $3, %xmm3, %edx
- orpd %xmm5, %xmm2
- movd %eax, %xmm3
- pshufd $0, %xmm3, %xmm3
- subl $65216, %edx
- addl %edx, %edx
- mulsd 3840(%ebx,%edx,4), %xmm7
- mulsd %xmm2, %xmm6
- mulsd %xmm2, %xmm1
- mulsd %xmm2, %xmm2
- subsd %xmm7, %xmm6
- andpd 5904(%ebx), %xmm3
- addsd %xmm1, %xmm6
- subsd %xmm2, %xmm4
- addsd %xmm7, %xmm7
- movsd 5960(%ebx), %xmm5
- subsd %xmm0, %xmm4
- addsd %xmm6, %xmm7
- movsd 5976(%ebx), %xmm0
- divsd %xmm7, %xmm4
- movsd 5968(%ebx), %xmm2
- addpd (%ebx,%edx,8), %xmm3
- movapd %xmm6, %xmm1
- mulsd %xmm6, %xmm6
- mulsd %xmm6, %xmm0
- mulsd %xmm6, %xmm1
- mulsd %xmm1, %xmm5
- mulsd %xmm6, %xmm1
- addsd %xmm2, %xmm0
- pxor %xmm6, %xmm6
- mulsd %xmm1, %xmm0
- addsd %xmm3, %xmm5
- addsd %xmm5, %xmm0
- andl $32768, %eax
- pinsrw $3, %eax, %xmm6
- movapd %xmm4, %xmm5
- pshufd $238, %xmm3, %xmm3
- addsd %xmm3, %xmm4
- subsd %xmm4, %xmm3
- addsd %xmm3, %xmm5
- addsd %xmm5, %xmm0
- addsd %xmm4, %xmm0
- xorpd %xmm6, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- addl $15291, %eax
- cmpl $14336, %eax
- jae .L_2TAG_PACKET_3.0.2
- unpcklpd %xmm0, %xmm0
- movapd 5984(%ebx), %xmm6
- unpcklpd %xmm0, %xmm1
- movapd 6000(%ebx), %xmm2
- movapd 6016(%ebx), %xmm4
- mulpd %xmm0, %xmm0
- movapd 5888(%ebx), %xmm5
- mulpd %xmm0, %xmm1
- mulpd %xmm0, %xmm6
- mulpd %xmm0, %xmm0
- movapd %xmm1, %xmm3
- mulsd %xmm1, %xmm1
- addpd %xmm2, %xmm6
- mulpd %xmm0, %xmm4
- mulsd %xmm3, %xmm1
- addpd %xmm4, %xmm6
- pshufd $238, %xmm5, %xmm0
- mulpd %xmm6, %xmm1
- pshufd $238, %xmm5, %xmm6
- subsd %xmm7, %xmm0
- pshufd $238, %xmm1, %xmm2
- subsd %xmm1, %xmm5
- subsd %xmm0, %xmm6
- subsd %xmm2, %xmm5
- subsd %xmm6, %xmm7
- subsd %xmm7, %xmm5
- addsd %xmm5, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_3.0.2:
- subl $15356, %eax
- cmpl $4, %eax
- jae .L_2TAG_PACKET_4.0.2
- xorpd %xmm6, %xmm6
- andpd 6048(%ebx), %xmm7
- movsd 6096(%ebx), %xmm4
- movapd 5984(%ebx), %xmm1
- mulsd %xmm4, %xmm7
- movapd 6000(%ebx), %xmm2
- subsd %xmm7, %xmm4
- movapd 6016(%ebx), %xmm3
- pshufd $68, %xmm4, %xmm7
- sqrtsd %xmm4, %xmm4
- mulpd %xmm7, %xmm1
- pshufd $68, %xmm7, %xmm5
- pextrw $3, %xmm0, %eax
- mulpd %xmm7, %xmm7
- addpd %xmm1, %xmm2
- movsd 5936(%ebx), %xmm1
- mulpd %xmm7, %xmm3
- cmpsd $1, %xmm6, %xmm0
- mulsd %xmm5, %xmm7
- addpd %xmm3, %xmm2
- pshufd $68, %xmm0, %xmm0
- mulsd %xmm7, %xmm2
- andpd 5904(%ebx), %xmm0
- mulpd %xmm5, %xmm2
- andpd %xmm4, %xmm1
- pshufd $68, %xmm4, %xmm3
- subsd %xmm1, %xmm4
- addsd %xmm3, %xmm3
- mulsd %xmm1, %xmm1
- subsd %xmm4, %xmm3
- subsd %xmm1, %xmm5
- mulsd %xmm3, %xmm4
- pshufd $238, %xmm3, %xmm3
- subsd %xmm4, %xmm5
- divsd %xmm3, %xmm5
- addpd %xmm3, %xmm3
- mulpd %xmm3, %xmm2
- pshufd $238, %xmm2, %xmm4
- addsd %xmm0, %xmm2
- andl $32768, %eax
- pinsrw $3, %eax, %xmm6
- pshufd $238, %xmm0, %xmm0
- addsd %xmm4, %xmm2
- addsd %xmm5, %xmm2
- addsd %xmm3, %xmm2
- addsd %xmm2, %xmm0
- xorpd %xmm6, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_4.0.2:
- addl $261884, %eax
- cmpl $261888, %eax
- jb .L_2TAG_PACKET_5.0.2
- movd %xmm7, %ecx
- psrlq $32, %xmm7
- movd %xmm7, %edx
- andl $2147483647, %edx
- movl $1072693248, %eax
- subl %edx, %eax
- orl %ecx, %eax
- cmpl $0, %eax
- je .L_2TAG_PACKET_6.0.2
- movq 8(%esp), %xmm2
- movd %xmm2, %edx
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- andl $2147483647, %ecx
- subl $1, %edx
- sbbl $2146435072, %ecx
- cmpl $0, %ecx
- jge .L_2TAG_PACKET_7.0.2
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $32752, %edx
- pinsrw $3, %edx, %xmm1
- mulsd %xmm1, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_6.0.2:
- pextrw $1, %xmm7, %edx
- shrl $15, %edx
- negl %edx
- movd %edx, %xmm7
- pshufd $0, %xmm7, %xmm7
- movsd 5920(%ebx), %xmm2
- movsd 5928(%ebx), %xmm0
- andpd %xmm7, %xmm2
- andpd %xmm7, %xmm0
- addsd %xmm2, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_5.0.2:
- movsd 5888(%ebx), %xmm2
- movsd 5896(%ebx), %xmm0
- addsd %xmm2, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_7.0.2:
- xorpd %xmm6, %xmm6
- addsd %xmm6, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
-.L_2TAG_PACKET_1.0.2:
- movl 48(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(acos)
-# -- End acos
-
-# Start file scope ASM
-ALIAS_SYMBOL(acosl, acos);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 3822952792
- .long 1021639372
- .long 182792448
- .long 1068507836
- .long 2264213271
- .long 1019558908
- .long 649052928
- .long 1068524253
- .long 1797139609
- .long 1022295143
- .long 1243095296
- .long 1068540671
- .long 1415938756
- .long 1021439537
- .long 2033294592
- .long 1068557090
- .long 2356809978
- .long 1021777916
- .long 3088063744
- .long 1068573510
- .long 2669055318
- .long 1022124482
- .long 180888576
- .long 1068589932
- .long 3566445325
- .long 1021358712
- .long 1970196992
- .long 1068606354
- .long 896980323
- .long 1021319659
- .long 4229555456
- .long 1068622777
- .long 436049712
- .long 1021319758
- .long 2732572160
- .long 1068639202
- .long 583123209
- .long 1020797960
- .long 1842831872
- .long 1068655628
- .long 1370449804
- .long 1021429270
- .long 1628994560
- .long 1068672055
- .long 2411391464
- .long 1021057980
- .long 2159763712
- .long 1068688483
- .long 1208692749
- .long 1021943903
- .long 3503886336
- .long 1068704912
- .long 538793309
- .long 1019744063
- .long 1435187200
- .long 1068721343
- .long 4085087612
- .long 1020608419
- .long 317469952
- .long 1068737775
- .long 144386942
- .long 1021440732
- .long 219617280
- .long 1068754208
- .long 2940088361
- .long 1019981122
- .long 1210558208
- .long 1068770642
- .long 2176850347
- .long 1018373705
- .long 3359268352
- .long 1068787077
- .long 2395611454
- .long 1021889042
- .long 2439803648
- .long 1068803514
- .long 1650705253
- .long 1020227966
- .long 2816203520
- .long 1068819952
- .long 3702166386
- .long 1019379914
- .long 262620672
- .long 1068836392
- .long 1855649370
- .long 1020453124
- .long 3438159616
- .long 1068852832
- .long 923063860
- .long 1019273834
- .long 3822105856
- .long 1068869274
- .long 4289947947
- .long 1019434249
- .long 1483729920
- .long 1068885718
- .long 787455814
- .long 1020738379
- .long 787321088
- .long 1068902163
- .long 3321653337
- .long 1021842569
- .long 1802253312
- .long 1068918609
- .long 2653633526
- .long 1021821525
- .long 302985984
- .long 1068935057
- .long 161272028
- .long 1021655149
- .long 653966080
- .long 1068951506
- .long 2566098667
- .long 1020066219
- .long 2924727296
- .long 1068967956
- .long 3646493722
- .long 1014292285
- .long 2889890304
- .long 1068984408
- .long 1081009196
- .long 1022189620
- .long 619098112
- .long 1069000862
- .long 4011643355
- .long 1021773297
- .long 477017600
- .long 1069017317
- .long 4030305534
- .long 1021292252
- .long 2533403904
- .long 1069033773
- .long 2645187591
- .long 1019527099
- .long 2563102208
- .long 1069050231
- .long 3857293792
- .long 1022311697
- .long 635982336
- .long 1069066691
- .long 3625936637
- .long 1017511744
- .long 1116940800
- .long 1069083152
- .long 3653872993
- .long 1022016631
- .long 4075964160
- .long 1069099614
- .long 2468900271
- .long 1021769532
- .long 993165568
- .long 1069116079
- .long 1358104224
- .long 1021199776
- .long 528586752
- .long 1069132545
- .long 2200950332
- .long 1022024872
- .long 2752395776
- .long 1069149012
- .long 3197072454
- .long 1017751319
- .long 3439855616
- .long 1069165481
- .long 1651081806
- .long 1020809338
- .long 2661257728
- .long 1069181952
- .long 539032752
- .long 1021728805
- .long 486957312
- .long 1069198425
- .long 3136045149
- .long 1016888671
- .long 1282340352
- .long 1069214899
- .long 2593963259
- .long 1018956103
- .long 822921728
- .long 1069231375
- .long 2146032737
- .long 1022306465
- .long 3474216192
- .long 1069247852
- .long 3976811625
- .long 1021350207
- .long 716902656
- .long 1069264332
- .long 718267222
- .long 1018624727
- .long 1211594496
- .long 1069280813
- .long 1485641389
- .long 1018447451
- .long 734070272
- .long 1069297296
- .long 354455128
- .long 1021341291
- .long 3650110720
- .long 1069313780
- .long 682185947
- .long 1021651853
- .long 1440663040
- .long 1069330267
- .long 3558574550
- .long 1021615110
- .long 2766612224
- .long 1069346755
- .long 874607978
- .long 1017746872
- .long 3404011008
- .long 1069363245
- .long 4154988502
- .long 1021439906
- .long 3423949056
- .long 1069379737
- .long 2263202309
- .long 1021479615
- .long 2897587712
- .long 1069396231
- .long 2562065031
- .long 1022090363
- .long 1896159232
- .long 1069412727
- .long 3836237663
- .long 1019867288
- .long 490968576
- .long 1069429225
- .long 3322056743
- .long 1006752762
- .long 3048360192
- .long 1069445724
- .long 1152314833
- .long 1013122252
- .long 1049850624
- .long 1069462226
- .long 3601590727
- .long 1022214610
- .long 3156899584
- .long 1069478729
- .long 1855169970
- .long 1019487271
- .long 851173376
- .long 1069495235
- .long 312649594
- .long 1020868604
- .long 2794281728
- .long 1069511742
- .long 1093490181
- .long 1020777577
- .long 468042496
- .long 1069528252
- .long 1152540679
- .long 1021403732
- .long 2534219264
- .long 1069544763
- .long 2292126035
- .long 1021872430
- .long 1376146432
- .long 1069558527
- .long 3293753641
- .long 1020500454
- .long 4175442432
- .long 1069575044
- .long 3626347564
- .long 1021610969
- .long 3523113472
- .long 1069591566
- .long 339956500
- .long 1021119039
- .long 4003350528
- .long 1069608092
- .long 3429333082
- .long 1022813542
- .long 1611067392
- .long 1069624623
- .long 2298017544
- .long 1021977587
- .long 931782144
- .long 1069641158
- .long 2164684743
- .long 1021250988
- .long 2256725504
- .long 1069657697
- .long 1138762335
- .long 1021443776
- .long 1582853120
- .long 1069674241
- .long 1084010382
- .long 1022994693
- .long 3497758720
- .long 1069690789
- .long 406366244
- .long 1022713586
- .long 3999816960
- .long 1069707342
- .long 1488723042
- .long 1023381290
- .long 3383096064
- .long 1069723900
- .long 2541558953
- .long 1019137887
- .long 1942403584
- .long 1069740463
- .long 1879620343
- .long 1022653642
- .long 4268263680
- .long 1069757030
- .long 3039077047
- .long 1022252545
- .long 2067062272
- .long 1069773603
- .long 4190670677
- .long 1020725863
- .long 4225828096
- .long 1069790180
- .long 1998567321
- .long 1022014385
- .long 2452507136
- .long 1069806763
- .long 1511628873
- .long 1021900300
- .long 1340746240
- .long 1069823351
- .long 788367341
- .long 1022726208
- .long 1190035456
- .long 1069839944
- .long 3856337230
- .long 1021834118
- .long 2300688384
- .long 1069856542
- .long 3211396579
- .long 1022621365
- .long 678886400
- .long 1069873146
- .long 4001011887
- .long 1022042646
- .long 921594112
- .long 1069889755
- .long 557811968
- .long 1023065533
- .long 3331668992
- .long 1069906369
- .long 1877060679
- .long 1022419742
- .long 3917875200
- .long 1069922989
- .long 1181055171
- .long 1022752712
- .long 2984829696
- .long 1069939615
- .long 4294526932
- .long 1021499988
- .long 838049024
- .long 1069956247
- .long 3658081878
- .long 1022957952
- .long 2078928384
- .long 1069972884
- .long 820353701
- .long 1019391107
- .long 2719854336
- .long 1069989527
- .long 1644022489
- .long 1023378240
- .long 3069117696
- .long 1070006176
- .long 2771393702
- .long 1019319954
- .long 3435962368
- .long 1070022831
- .long 3876394145
- .long 1023024433
- .long 4130595328
- .long 1070039492
- .long 1630447748
- .long 1021465882
- .long 1169236224
- .long 1070056160
- .long 2828355997
- .long 1020458120
- .long 3453997312
- .long 1070072833
- .long 164091641
- .long 1020388279
- .long 2708127744
- .long 1070089513
- .long 3036550223
- .long 1023328684
- .long 3540797696
- .long 1070106199
- .long 3710949463
- .long 1022568805
- .long 1972276736
- .long 1070122892
- .long 3885277950
- .long 1019761674
- .long 2613815552
- .long 1070139591
- .long 2764165077
- .long 1022921023
- .long 1487791616
- .long 1070156297
- .long 1330644769
- .long 1023162679
- .long 3207593472
- .long 1070173009
- .long 3911007221
- .long 1022993496
- .long 3797764608
- .long 1070189728
- .long 979712598
- .long 1022554580
- .long 3578920448
- .long 1070206454
- .long 2825738223
- .long 1020223708
- .long 2872795648
- .long 1070223187
- .long 392451124
- .long 1022666279
- .long 2002258432
- .long 1070239927
- .long 3730407632
- .long 1023148291
- .long 1291326464
- .long 1070256674
- .long 3723802980
- .long 1022514089
- .long 1065180928
- .long 1070273428
- .long 2635617463
- .long 1022654470
- .long 1650181632
- .long 1070290189
- .long 2061982883
- .long 1022853411
- .long 3373882880
- .long 1070306957
- .long 319732785
- .long 1022017175
- .long 2270081280
- .long 1070323733
- .long 2237757411
- .long 1023064087
- .long 2963732736
- .long 1070340516
- .long 468839165
- .long 1023293774
- .long 1491099904
- .long 1070357307
- .long 1502657946
- .long 1021533479
- .long 2479636480
- .long 1070374105
- .long 482913562
- .long 1021986286
- .long 1968133632
- .long 1070390911
- .long 3281474337
- .long 1022646400
- .long 291639040
- .long 1070407725
- .long 2453320259
- .long 1022812423
- .long 2081472512
- .long 1070424546
- .long 2939989570
- .long 1023091888
- .long 3380340480
- .long 1070441375
- .long 2850707499
- .long 1021921109
- .long 232287488
- .long 1070458213
- .long 3674625342
- .long 1020725130
- .long 1567614208
- .long 1070475058
- .long 9347334
- .long 1022024009
- .long 3433091072
- .long 1070491911
- .long 282524999
- .long 1021433523
- .long 1876877312
- .long 1070508773
- .long 3470449440
- .long 1019309721
- .long 1538472192
- .long 1070525643
- .long 2089486825
- .long 1019698916
- .long 2763830784
- .long 1070542521
- .long 443498115
- .long 1020505194
- .long 1605381632
- .long 1070559408
- .long 3018871601
- .long 1022869913
- .long 2706946048
- .long 1070576303
- .long 3936260892
- .long 1023175875
- .long 2123887360
- .long 1070593207
- .long 2994220655
- .long 1022825948
- .long 104015104
- .long 1070603108
- .long 335054493
- .long 1023441853
- .long 2904568832
- .long 1070615800
- .long 1451215633
- .long 1023853857
- .long 3456197120
- .long 1070632739
- .long 436334733
- .long 1024026432
- .long 252452352
- .long 1070649697
- .long 34596167
- .long 1024031396
- .long 3328018432
- .long 1070666672
- .long 2644547073
- .long 1024296758
- .long 1255829248
- .long 1070683667
- .long 552832586
- .long 1023763122
- .long 4097058560
- .long 1070700680
- .long 1955640623
- .long 1021394654
- .long 451770112
- .long 1070717714
- .long 3428903777
- .long 1022941142
- .long 408920832
- .long 1070734767
- .long 165503263
- .long 1023894958
- .long 1186960640
- .long 1070751840
- .long 435826450
- .long 1024026134
- .long 19078656
- .long 1070768934
- .long 1834169749
- .long 1022899284
- .long 2743490304
- .long 1070786048
- .long 494581074
- .long 1018818479
- .long 2328961024
- .long 1070803184
- .long 2987908834
- .long 1022581110
- .long 350011392
- .long 1070820342
- .long 240771184
- .long 1024143083
- .long 2692326912
- .long 1070837521
- .long 666056837
- .long 1022394776
- .long 2373274368
- .long 1070854723
- .long 2484337770
- .long 1024228156
- .long 1017131520
- .long 1070871948
- .long 3285648279
- .long 1024025789
- .long 265558272
- .long 1070889196
- .long 392241896
- .long 1024252809
- .long 1778008064
- .long 1070906467
- .long 1536107943
- .long 1023949300
- .long 2937184768
- .long 1070923762
- .long 3541062251
- .long 1019448646
- .long 1144442880
- .long 1070941082
- .long 3691683781
- .long 1022123948
- .long 2410165504
- .long 1070958426
- .long 1804181960
- .long 1023945221
- .long 4174350848
- .long 1070975795
- .long 2016094861
- .long 1021716585
- .long 3897012480
- .long 1070993190
- .long 175294410
- .long 1023703404
- .long 3353623040
- .long 1071010611
- .long 167973242
- .long 1023240839
- .long 45671168
- .long 1071028059
- .long 2166856113
- .long 1021565413
- .long 86063872
- .long 1071045533
- .long 2676254727
- .long 1023985299
- .long 1019772672
- .long 1071063034
- .long 989043593
- .long 1021549587
- .long 414297344
- .long 1071080563
- .long 3960972046
- .long 1024307251
- .long 155173120
- .long 1071098120
- .long 1830919291
- .long 1021592251
- .long 2151562240
- .long 1071115705
- .long 405408666
- .long 1023423128
- .long 4041854720
- .long 1071133319
- .long 2043497827
- .long 1024411503
- .long 3489224192
- .long 1071150963
- .long 3072215864
- .long 1022698635
- .long 2477196288
- .long 1071168637
- .long 1812195139
- .long 1022689192
- .long 3015298816
- .long 1071186341
- .long 764841969
- .long 1021027331
- .long 2844731136
- .long 1071204076
- .long 2878117321
- .long 1019116513
- .long 4028950528
- .long 1071221842
- .long 698911452
- .long 1023265602
- .long 69441536
- .long 1071239641
- .long 3253467847
- .long 1020795075
- .long 1676209920
- .long 1071257471
- .long 4272431167
- .long 1022873982
- .long 2408752384
- .long 1071275334
- .long 648519100
- .long 1024385717
- .long 151623680
- .long 1071293231
- .long 345257017
- .long 1019561408
- .long 1410154240
- .long 1071311161
- .long 197863993
- .long 1023224207
- .long 4131351552
- .long 1071329125
- .long 2620801789
- .long 1024411169
- .long 1999664384
- .long 1071347125
- .long 3952692616
- .long 1024168086
- .long 1617668864
- .long 1071365160
- .long 3019889809
- .long 1021907692
- .long 1032074240
- .long 1071383231
- .long 59469899
- .long 1023656194
- .long 2619492096
- .long 1071401338
- .long 1417526820
- .long 1021457783
- .long 202429440
- .long 1071419483
- .long 2927667935
- .long 1019175447
- .long 525044224
- .long 1071437665
- .long 38166811
- .long 1023981879
- .long 1779258880
- .long 1071455885
- .long 481252500
- .long 1023310234
- .long 2195673600
- .long 1071474144
- .long 3962395981
- .long 1021339088
- .long 44573696
- .long 1071492443
- .long 3936281395
- .long 1023014829
- .long 2226905344
- .long 1071510781
- .long 1515320476
- .long 1024320623
- .long 2800512512
- .long 1071529160
- .long 1225403697
- .long 1021081846
- .long 161113600
- .long 1071547581
- .long 3064809733
- .long 1024173917
- .long 1338410240
- .long 1071566043
- .long 2027604973
- .long 1024362526
- .long 522433280
- .long 1071584548
- .long 2055171723
- .long 1023858825
- .long 539595776
- .long 1071603096
- .long 3868820135
- .long 1022936424
- .long 4264017664
- .long 1071621687
- .long 3228065145
- .long 1023479578
- .long 1733924096
- .long 1071640324
- .long 3511934475
- .long 1022496355
- .long 108880384
- .long 1071651839
- .long 615880967
- .long 1023519706
- .long 3517856512
- .long 1071661202
- .long 3113108559
- .long 1025190289
- .long 4043153152
- .long 1071670589
- .long 1571836218
- .long 1023106116
- .long 3251299072
- .long 1071680000
- .long 3444076102
- .long 1022187841
- .long 2736921600
- .long 1071689435
- .long 272771483
- .long 1025095280
- .long 3897698560
- .long 1071703633
- .long 2075390188
- .long 1022489022
- .long 3209485056
- .long 1071722652
- .long 1438094065
- .long 1021844944
- .long 3781432064
- .long 1071741774
- .long 1675017145
- .long 1024143828
- .long 2684184064
- .long 1071761003
- .long 2259963753
- .long 1024731393
- .long 1840489728
- .long 1071780342
- .long 3372883597
- .long 1023431408
- .long 3764087808
- .long 1071799794
- .long 3307523102
- .long 1024485788
- .long 3006232320
- .long 1071819364
- .long 3088971966
- .long 1025213251
- .long 3374881280
- .long 1071839055
- .long 834437749
- .long 1025236452
- .long 797284864
- .long 1071858872
- .long 3122663941
- .long 1025320473
- .long 545765120
- .long 1071878818
- .long 826539625
- .long 1022450955
- .long 107562240
- .long 1071898898
- .long 339584600
- .long 1022481255
- .long 2123649024
- .long 1071919116
- .long 3912959833
- .long 1024321009
- .long 1562385664
- .long 1071939478
- .long 2846067230
- .long 1023343981
- .long 2963085824
- .long 1071959988
- .long 954548627
- .long 1021475211
- .long 3325550592
- .long 1071980652
- .long 3459651155
- .long 1025305573
- .long 775752448
- .long 1072001476
- .long 3582746667
- .long 1023859460
- .long 3238590720
- .long 1072022464
- .long 634636162
- .long 1024472353
- .long 2758801920
- .long 1072043624
- .long 3078216319
- .long 1025304516
- .long 1370319104
- .long 1072064962
- .long 2570569078
- .long 1025099442
- .long 2615805184
- .long 1072086484
- .long 3729933412
- .long 1024605112
- .long 3077336576
- .long 1072108198
- .long 1948916066
- .long 1024781603
- .long 1099528192
- .long 1072130112
- .long 3139143157
- .long 1023729360
- .long 1231903232
- .long 1072152233
- .long 1349513477
- .long 1024737515
- .long 1507504128
- .long 1072174570
- .long 3484516322
- .long 1024000959
- .long 2214659840
- .long 1072197132
- .long 2563820917
- .long 1025225535
- .long 1804739840
- .long 1072219929
- .long 760038746
- .long 1024482855
- .long 1413746688
- .long 1072242971
- .long 3401734714
- .long 1025129838
- .long 821409536
- .long 1072266269
- .long 3729772551
- .long 1025484796
- .long 3031825664
- .long 1072289834
- .long 122256749
- .long 1024752594
- .long 1710784256
- .long 1072313680
- .long 1518205483
- .long 1024724809
- .long 3025265152
- .long 1072337819
- .long 409951989
- .long 1022835555
- .long 287769088
- .long 1072362267
- .long 800355594
- .long 1022484850
- .long 198179840
- .long 1072387038
- .long 3502926213
- .long 1024209373
- .long 1909130496
- .long 1072412149
- .long 3064694319
- .long 1025380823
- .long 1941732096
- .long 1072437619
- .long 4112930390
- .long 1024294679
- .long 3492010496
- .long 1072463467
- .long 2684918107
- .long 1023220233
- .long 81959680
- .long 1072489716
- .long 220021366
- .long 1020635131
- .long 2297837056
- .long 1072516387
- .long 4027683826
- .long 1021041185
- .long 270404096
- .long 1072543508
- .long 2012766065
- .long 1021780753
- .long 3667376896
- .long 1072571105
- .long 2727981522
- .long 1023009874
- .long 330400256
- .long 1072599212
- .long 2940017003
- .long 1025393439
- .long 1119293952
- .long 1072627861
- .long 1608550416
- .long 1022675612
- .long 3536155904
- .long 1072657091
- .long 349665778
- .long 1025156751
- .long 3078046720
- .long 1072686946
- .long 2016159996
- .long 1022193169
- .long 455228416
- .long 1072705361
- .long 1908539328
- .long 1026126332
- .long 1871505664
- .long 1072720988
- .long 2784700894
- .long 1025922277
- .long 1630994432
- .long 1072737010
- .long 361107678
- .long 1022887244
- .long 2084558336
- .long 1072753462
- .long 2642784509
- .long 1072689083
- .long 1514442531
- .long 1072688953
- .long 333108933
- .long 1072688821
- .long 3392112024
- .long 1072688686
- .long 2099852862
- .long 1072688550
- .long 749609004
- .long 1072688412
- .long 3634632596
- .long 1072688271
- .long 2163248461
- .long 1072688129
- .long 628657846
- .long 1072687985
- .long 3324036511
- .long 1072687838
- .long 1657632815
- .long 1072687690
- .long 4217538760
- .long 1072687539
- .long 2411951597
- .long 1072687387
- .long 533944872
- .long 1072687233
- .long 2876566508
- .long 1072687076
- .long 847936891
- .long 1072686918
- .long 3036019913
- .long 1072686757
- .long 848884575
- .long 1072686595
- .long 2874443326
- .long 1072686430
- .long 520713666
- .long 1072686264
- .long 2375556481
- .long 1072686095
- .long 4141904948
- .long 1072685924
- .long 1522666382
- .long 1072685752
- .long 3105624104
- .long 1072685577
- .long 298666327
- .long 1072685401
- .long 1689524500
- .long 1072685222
- .long 2981002200
- .long 1072685041
- .long 4170844284
- .long 1072684858
- .long 961802263
- .long 1072684674
- .long 1941503454
- .long 1072684487
- .long 2812647170
- .long 1072684298
- .long 3572873869
- .long 1072684107
- .long 4219797823
- .long 1072683914
- .long 456039788
- .long 1072683720
- .long 869096151
- .long 1072683523
- .long 1161535119
- .long 1072683324
- .long 1330865866
- .long 1072683123
- .long 1374571204
- .long 1072682920
- .long 1290107538
- .long 1072682715
- .long 1074904836
- .long 1072682508
- .long 726366587
- .long 1072682299
- .long 241869763
- .long 1072682088
- .long 3913732079
- .long 1072681874
- .long 3149342765
- .long 1072681659
- .long 2240966306
- .long 1072681442
- .long 1185873216
- .long 1072681223
- .long 4276274591
- .long 1072681001
- .long 2919452883
- .long 1072680778
- .long 1407565635
- .long 1072680553
- .long 4032743551
- .long 1072680325
- .long 2202188565
- .long 1072680096
- .long 207977577
- .long 1072679865
- .long 2342160518
- .long 1072679631
- .long 11858423
- .long 1072679396
- .long 1804034453
- .long 1072679158
- .long 3420722787
- .long 1072678918
- .long 563930456
- .long 1072678677
- .long 1820539192
- .long 1072678433
- .long 2892501606
- .long 1072678187
- .long 3776710320
- .long 1072677939
- .long 175063337
- .long 1072677690
- .long 674333171
- .long 1072677438
- .long 976363026
- .long 1072677184
- .long 1077935934
- .long 1072676928
- .long 1921075490
- .long 1072676540
- .long 881493302
- .long 1072676016
- .long 3275752439
- .long 1072675483
- .long 486855588
- .long 1072674943
- .long 1077229111
- .long 1072674394
- .long 723950308
- .long 1072673837
- .long 3693582199
- .long 1072673271
- .long 1367335316
- .long 1072672698
- .long 2305837020
- .long 1072672116
- .long 2184358641
- .long 1072671526
- .long 972682840
- .long 1072670928
- .long 2935101762
- .long 1072670321
- .long 3745513263
- .long 1072669706
- .long 3372320886
- .long 1072669083
- .long 1783464620
- .long 1072668452
- .long 3241386215
- .long 1072667812
- .long 3418125284
- .long 1072667164
- .long 2280219148
- .long 1072666508
- .long 4088700758
- .long 1072665843
- .long 219227400
- .long 1072665171
- .long 3521816918
- .long 1072664489
- .long 1076205279
- .long 1072663800
- .long 1436484616
- .long 1072663102
- .long 271362610
- .long 1072662396
- .long 1838996688
- .long 1072661681
- .long 1807122518
- .long 1072660958
- .long 137953542
- .long 1072660227
- .long 1088178584
- .long 1072659487
- .long 324057537
- .long 1072658739
- .long 2101288076
- .long 1072657982
- .long 2085133974
- .long 1072657217
- .long 235324451
- .long 1072656444
- .long 806051592
- .long 1072655662
- .long 3756033140
- .long 1072654871
- .long 453542543
- .long 1072654073
- .long 3741177327
- .long 1072653265
- .long 691216109
- .long 1072652450
- .long 4145223372
- .long 1072651625
- .long 1174439091
- .long 1072650793
- .long 324416139
- .long 1072649952
- .long 1550246310
- .long 1072649102
- .long 511524674
- .long 1072648244
- .long 1457248482
- .long 1072647377
- .long 45944955
- .long 1072646502
- .long 525537397
- .long 1072645618
- .long 2848440188
- .long 1072644725
- .long 2671555633
- .long 1072643824
- .long 4241172637
- .long 1072642914
- .long 3213094278
- .long 1072641996
- .long 3832503688
- .long 1072641069
- .long 1754091534
- .long 1072640134
- .long 1221921804
- .long 1072639190
- .long 2184526489
- .long 1072638237
- .long 294902089
- .long 1072637276
- .long 4090375270
- .long 1072636305
- .long 632860906
- .long 1072635327
- .long 2753498702
- .long 1072634339
- .long 1808009252
- .long 1072633343
- .long 2036428672
- .long 1072632338
- .long 3383235626
- .long 1072631324
- .long 1497347484
- .long 1072630302
- .long 617018317
- .long 1072629271
- .long 684933058
- .long 1072628231
- .long 1643170798
- .long 1072627182
- .long 3011066360
- .long 1072625592
- .long 957158713
- .long 1072623442
- .long 1390907941
- .long 1072621256
- .long 3819155270
- .long 1072619034
- .long 3443571196
- .long 1072616777
- .long 4045412458
- .long 1072614484
- .long 805503923
- .long 1072612156
- .long 1778922015
- .long 1072609791
- .long 2125033665
- .long 1072607390
- .long 1287203863
- .long 1072604953
- .long 2992629568
- .long 1072602479
- .long 2367267127
- .long 1072599969
- .long 3115526047
- .long 1072597422
- .long 340219539
- .long 1072594839
- .long 2017215719
- .long 1072592218
- .long 3225443424
- .long 1072589560
- .long 3326565673
- .long 1072586865
- .long 1669811211
- .long 1072584133
- .long 1886735022
- .long 1072581363
- .long 3301071171
- .long 1072578555
- .long 928514283
- .long 1072575710
- .long 2656364059
- .long 1072572826
- .long 3473490507
- .long 1072569904
- .long 2649965606
- .long 1072566944
- .long 3736819052
- .long 1072563945
- .long 1680885175
- .long 1072560908
- .long 4413771
- .long 1072557832
- .long 2214869753
- .long 1072554716
- .long 3214725184
- .long 1072551561
- .long 2186079903
- .long 1072548367
- .long 2590372131
- .long 1072545133
- .long 3578146079
- .long 1072541859
- .long 4283712755
- .long 1072538545
- .long 3824834510
- .long 1072535191
- .long 1302400298
- .long 1072531797
- .long 95058636
- .long 1072528362
- .long 3563906063
- .long 1072524885
- .long 2167230730
- .long 1072521368
- .long 3524918334
- .long 1072517809
- .long 2353304918
- .long 1072514209
- .long 1939625839
- .long 1072510567
- .long 1256714581
- .long 1072506883
- .long 3552525848
- .long 1072503156
- .long 3464809522
- .long 1072499387
- .long 4200542593
- .long 1072495575
- .long 355609124
- .long 1072491721
- .long 3684139099
- .long 1072487822
- .long 148355918
- .long 1072483881
- .long 1457689242
- .long 1072479895
- .long 2118591596
- .long 1072475865
- .long 908848089
- .long 1072471791
- .long 877032689
- .long 1072467672
- .long 752012304
- .long 1072463508
- .long 3532301749
- .long 1072459298
- .long 3600563221
- .long 1072455043
- .long 3902857084
- .long 1072450742
- .long 3063101036
- .long 1072446395
- .long 3972344374
- .long 1072442001
- .long 903183549
- .long 1072437561
- .long 983892938
- .long 1072433073
- .long 2722858568
- .long 1072428537
- .long 302790515
- .long 1072423954
- .long 759811057
- .long 1072419322
- .long 2507809922
- .long 1072414641
- .long 2388408813
- .long 1072407528
- .long 2084492942
- .long 1072397870
- .long 2435703301
- .long 1072388010
- .long 1935433360
- .long 1072377945
- .long 2742047290
- .long 1072367671
- .long 2053284205
- .long 1072357185
- .long 657783367
- .long 1072346483
- .long 2893664841
- .long 1072335560
- .long 3718906405
- .long 1072324413
- .long 1547896303
- .long 1072313038
- .long 2494058440
- .long 1072301429
- .long 3133238742
- .long 1072289582
- .long 3327000086
- .long 1072277492
- .long 1860667274
- .long 1072265154
- .long 665340747
- .long 1072252562
- .long 443347841
- .long 1072239710
- .long 581282618
- .long 1072226592
- .long 3349780465
- .long 1072213201
- .long 914217606
- .long 1072199532
- .long 989797661
- .long 1072185576
- .long 945436416
- .long 1072171326
- .long 549291300
- .long 1072156774
- .long 1814636389
- .long 1072141911
- .long 239092858
- .long 1072126729
- .long 1794680724
- .long 1072111217
- .long 1241534678
- .long 1072095366
- .long 3366566214
- .long 1072079164
- .long 1244090828
- .long 1072062601
- .long 1708448120
- .long 1072045663
- .long 3544260650
- .long 1072028337
- .long 1402741403
- .long 1072010610
- .long 2551936888
- .long 1071992465
- .long 617669739
- .long 1071973887
- .long 794002186
- .long 1071954857
- .long 2021237693
- .long 1071935356
- .long 540450384
- .long 1071915364
- .long 1920555537
- .long 1071894857
- .long 2879585206
- .long 1071873811
- .long 3000237455
- .long 1071852199
- .long 3352974346
- .long 1071829991
- .long 569629937
- .long 1071807155
- .long 2077237208
- .long 1071783653
- .long 2284891805
- .long 1071759446
- .long 1226651784
- .long 1071734489
- .long 1102047405
- .long 1071708731
- .long 2009896384
- .long 1071682115
- .long 927419082
- .long 1071654577
- .long 85010366
- .long 1071607413
- .long 696431025
- .long 1071548180
- .long 2611410541
- .long 1071486585
- .long 2612593658
- .long 1071422396
- .long 3548155306
- .long 1071355336
- .long 3887997484
- .long 1071285073
- .long 244854763
- .long 1071211202
- .long 4214445648
- .long 1071133216
- .long 2303966727
- .long 1071050478
- .long 3991040013
- .long 1070962152
- .long 3126952278
- .long 1070867118
- .long 1817448378
- .long 1070763804
- .long 1793814864
- .long 1070649884
- .long 3507224072
- .long 1070447193
- .long 4027609105
- .long 1070148772
- .long 577507993
- .long 1069779414
- .long 2310232419
- .long 1068931829
- .long 856972295
- .long 1016178214
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 3164710438
- .long 1413754136
- .long 3221823995
- .long 856972295
- .long 1017226790
- .long 1413754136
- .long 1074340347
- .long 4160749568
- .long 4294967295
- .long 4160749568
- .long 4294967295
- .long 0
- .long 0
- .long 1431655765
- .long 3217380693
- .long 858993459
- .long 3216192307
- .long 3067833783
- .long 3215383405
- .long 780903145
- .long 1066854586
- .long 858993459
- .long 1068708659
- .long 3340530119
- .long 1067392113
- .long 1431655765
- .long 1069897045
- .long 1321528399
- .long 1066517740
- .long 3067833783
- .long 1067899757
- .long 2021159460
- .long 1065855096
- .long 2576980378
- .long 1066178969
- .long 4294967295
- .long 2147483647
- .long 0
- .long 0
- .long 0
- .long 4294950912
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 1071644672
- .long 0
- .long 0
- .type static_const_table,@object
- .size static_const_table,6112
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/e_asin.S b/libm/x86/e_asin.S
deleted file mode 100644
index 6a3ff8e..0000000
--- a/libm/x86/e_asin.S
+++ /dev/null
@@ -1,2003 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// To compute asin(s), separate schemes are used when s is in different
-// intervals.
-//
-// |s| in [2^{-4}, sqrt(3)/2):
-// Let t=2^k*1.b1 b2..b6 1, where s=2^k*1.b1 b2 .. b52
-// asin(s)=asin(t)+asin(r), where r=s*sqrt(1-t^2)-t*sqrt(1-s^2)
-// asin(r)-r evaluated as 7-degree polynomial (c3*r^3+c5*r^5+c7*r^7)
-// For the first degree term, r is evaluated as
-// R=(s^2-t^2)/(sqrt(1-t^2)*s+sqrt(1-s^2)*t)
-// (sqrt(1-t^2) read from table)
-// The main source of error is still R (may still be affected by up to 3 ulps
-// of rounding error). The table size must be sufficiently large, to minimize
-// this effect.
-//
-// |s| in [sqrt(3)/2, 255/256):
-// Let t=2^k*1.b1 b2..b6 1, where sqrt(1-s^2)=2^k*1.b1 b2 .. b52 (rounded)
-// asin(|s|)=pi/2-asin(t)+asin(r), r=s*t-sqrt(1-s^2)*sqrt(1-t^2)
-// asin(r) evaluated as polynomial (same as above)
-// The first degree term is evaluated as
-// r=(s^2+t^2-1)/(s*t+sqrt(1-s^2)*sqrt(1-t^2))
-//
-// |s|<2^{-4}: evaluate as 13-degree polynomial
-//
-// |s| in [255/256,1): asin(|s|)=pi/2-asin(sqrt(1-s^2))
-// use 17-degree polynomial, get error term
-// Q*eps ~ (1-s^2-Q^2)/(2*Q) for first term
-// ( Q(1+eps)=sqrt(1-s^2) )
-//
-// Special cases:
-// asin(NaN) = quiet NaN, and raise invalid exception
-// asin(INF) = QNaN and raise invalid exception
-// asin(x) = QNaN and raise invalid exception, for |x|>1.0
-// asin(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin asin
-ENTRY(asin)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $120, %esp
- movl %ebx, 64(%esp)
- call static_func
- movl %eax, %ebx
- movsd 128(%esp), %xmm0
- stmxcsr 16(%esp)
- movl 16(%esp), %edx
- andl $-24577, %edx
- cmpl %edx, 16(%esp)
- jne .L_2TAG_PACKET_0.0.2
-.L_2TAG_PACKET_1.0.2:
- movsd 5984(%ebx), %xmm4
- movsd 6016(%ebx), %xmm3
- xorpd %xmm5, %xmm5
- movsd 6000(%ebx), %xmm2
- movl $8192, %ecx
- pinsrw $2, %ecx, %xmm5
- movapd %xmm0, %xmm1
- movsd %xmm0, 8(%esp)
- psrlq $44, %xmm0
- movd %xmm0, %edx
- movapd %xmm1, %xmm7
- movl $8192, %ecx
- pinsrw $2, %ecx, %xmm5
- movapd %xmm1, %xmm0
- movl $524287, %eax
- andl %edx, %eax
- subl $260864, %eax
- cmpl $955, %eax
- jae .L_2TAG_PACKET_2.0.2
- mulsd %xmm1, %xmm1
- andl $65535, %edx
- subsd %xmm1, %xmm3
- sqrtsd %xmm3, %xmm3
- andpd %xmm7, %xmm2
- andl $-4, %edx
- subl $64256, %edx
- movsd 3936(%ebx,%edx,2), %xmm1
- orpd %xmm5, %xmm2
- movapd 96(%ebx,%edx,4), %xmm4
- movapd %xmm7, %xmm6
- addsd %xmm2, %xmm7
- subsd %xmm2, %xmm0
- mulsd %xmm7, %xmm0
- mulsd %xmm1, %xmm6
- mulsd %xmm2, %xmm3
- movapd %xmm6, %xmm1
- addsd %xmm3, %xmm6
- divsd %xmm6, %xmm0
- movsd 80(%ebx), %xmm7
- movsd 64(%ebx), %xmm5
- subsd %xmm3, %xmm1
- andpd 6064(%ebx), %xmm2
- movapd %xmm1, %xmm3
- mulsd %xmm1, %xmm1
- movsd 72(%ebx), %xmm6
- mulsd %xmm1, %xmm3
- mulsd %xmm1, %xmm7
- mulsd %xmm3, %xmm5
- xorpd %xmm2, %xmm4
- mulsd %xmm1, %xmm3
- addsd %xmm7, %xmm6
- mulsd %xmm3, %xmm6
- addsd %xmm4, %xmm5
- pshufd $238, %xmm4, %xmm4
- addsd %xmm5, %xmm6
- orpd %xmm2, %xmm4
- addsd %xmm6, %xmm0
- movl 16(%esp), %eax
- andl $-24577, %eax
- cmpl 16(%esp), %eax
- je .L_2TAG_PACKET_3.0.2
- stmxcsr 24(%esp)
- movl 16(%esp), %eax
- andl $24576, %eax
- orl %eax, 24(%esp)
- ldmxcsr 24(%esp)
-.L_2TAG_PACKET_3.0.2:
- addsd %xmm4, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_2.0.2:
- subl $955, %eax
- cmpl $67, %eax
- jae .L_2TAG_PACKET_5.0.2
- mulsd %xmm1, %xmm1
- subsd %xmm1, %xmm3
- sqrtsd %xmm3, %xmm3
- movl %edx, %eax
- andpd 5984(%ebx), %xmm0
- andpd 6048(%ebx), %xmm7
- movapd %xmm0, %xmm1
- movsd 6016(%ebx), %xmm4
- movapd %xmm7, %xmm6
- subsd %xmm7, %xmm1
- mulsd %xmm7, %xmm7
- addsd %xmm6, %xmm0
- subsd %xmm7, %xmm4
- mulsd %xmm1, %xmm0
- movapd %xmm3, %xmm7
- andpd %xmm3, %xmm2
- psllq $2, %xmm3
- pextrw $3, %xmm3, %edx
- orpd %xmm5, %xmm2
- subl $65216, %edx
- addl %edx, %edx
- mulsd 3936(%ebx,%edx,4), %xmm7
- mulsd %xmm2, %xmm6
- movapd 6080(%ebx), %xmm3
- mulsd %xmm2, %xmm1
- mulsd %xmm2, %xmm2
- subsd %xmm7, %xmm6
- addsd %xmm1, %xmm6
- subsd %xmm2, %xmm4
- addsd %xmm7, %xmm7
- movsd 64(%ebx), %xmm5
- subsd %xmm0, %xmm4
- addsd %xmm6, %xmm7
- movsd 80(%ebx), %xmm0
- divsd %xmm7, %xmm4
- movsd 72(%ebx), %xmm2
- subpd 96(%ebx,%edx,8), %xmm3
- movapd %xmm6, %xmm1
- mulsd %xmm6, %xmm6
- andl $524288, %eax
- shrl $4, %eax
- mulsd %xmm6, %xmm0
- mulsd %xmm6, %xmm1
- mulsd %xmm1, %xmm5
- mulsd %xmm6, %xmm1
- addsd %xmm2, %xmm0
- pxor %xmm6, %xmm6
- mulsd %xmm1, %xmm0
- addsd %xmm3, %xmm5
- pinsrw $3, %eax, %xmm6
- addsd %xmm5, %xmm0
- movapd %xmm4, %xmm5
- pshufd $238, %xmm3, %xmm3
- subsd %xmm3, %xmm4
- addsd %xmm4, %xmm3
- subsd %xmm3, %xmm5
- subsd %xmm5, %xmm0
- movl 16(%esp), %eax
- andl $-24577, %eax
- cmpl 16(%esp), %eax
- je .L_2TAG_PACKET_6.0.2
- stmxcsr 24(%esp)
- movl 16(%esp), %eax
- andl $24576, %eax
- orl %eax, 24(%esp)
- ldmxcsr 24(%esp)
-.L_2TAG_PACKET_6.0.2:
- xorpd %xmm6, %xmm0
- xorpd %xmm6, %xmm4
- subsd %xmm4, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_5.0.2:
- addl $15291, %eax
- cmpl $14336, %eax
- jae .L_2TAG_PACKET_7.0.2
- unpcklpd %xmm7, %xmm7
- movapd (%ebx), %xmm1
- movapd %xmm7, %xmm6
- movapd 16(%ebx), %xmm2
- movapd 32(%ebx), %xmm4
- mulpd %xmm7, %xmm7
- mulpd %xmm7, %xmm6
- mulpd %xmm7, %xmm1
- mulpd %xmm7, %xmm7
- movapd %xmm6, %xmm3
- mulsd %xmm6, %xmm6
- addpd %xmm2, %xmm1
- mulpd %xmm7, %xmm4
- mulsd %xmm3, %xmm6
- addpd %xmm4, %xmm1
- mulpd %xmm6, %xmm1
- pshufd $238, %xmm1, %xmm2
- addsd %xmm2, %xmm1
- movl 16(%esp), %eax
- andl $-24577, %eax
- cmpl 16(%esp), %eax
- je .L_2TAG_PACKET_8.0.2
- stmxcsr 24(%esp)
- movl 16(%esp), %eax
- andl $24576, %eax
- orl %eax, 24(%esp)
- ldmxcsr 24(%esp)
-.L_2TAG_PACKET_8.0.2:
- addsd %xmm1, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_7.0.2:
- subl $15358, %eax
- cmpl $2, %eax
- jae .L_2TAG_PACKET_9.0.2
- mulsd %xmm1, %xmm1
- subsd %xmm1, %xmm3
- sqrtsd %xmm3, %xmm3
- movl %edx, %eax
- andpd 6032(%ebx), %xmm7
- pshufd $68, %xmm3, %xmm5
- andpd 6032(%ebx), %xmm3
- movapd %xmm7, %xmm1
- movsd 6016(%ebx), %xmm4
- movapd %xmm7, %xmm6
- subsd %xmm7, %xmm0
- mulsd %xmm7, %xmm7
- addsd %xmm1, %xmm1
- mulsd %xmm0, %xmm1
- subsd %xmm7, %xmm4
- movapd %xmm3, %xmm6
- mulsd %xmm3, %xmm3
- mulsd %xmm0, %xmm0
- subsd %xmm1, %xmm4
- subsd %xmm5, %xmm6
- addsd %xmm5, %xmm5
- subsd %xmm3, %xmm4
- movapd (%ebx), %xmm2
- pshufd $238, %xmm5, %xmm3
- subsd %xmm0, %xmm4
- addsd %xmm6, %xmm5
- pshufd $238, %xmm3, %xmm7
- addsd %xmm3, %xmm3
- mulsd %xmm6, %xmm5
- addsd %xmm5, %xmm4
- pshufd $238, %xmm7, %xmm6
- divsd %xmm3, %xmm4
- movapd 48(%ebx), %xmm1
- movapd 16(%ebx), %xmm5
- movapd 32(%ebx), %xmm0
- mulpd %xmm7, %xmm7
- movapd %xmm6, %xmm3
- mulpd %xmm7, %xmm2
- mulpd %xmm7, %xmm6
- shrl $4, %eax
- andl $32768, %eax
- mulsd %xmm7, %xmm1
- mulpd %xmm7, %xmm7
- addpd %xmm2, %xmm5
- movapd %xmm6, %xmm2
- mulsd %xmm6, %xmm6
- mulpd %xmm0, %xmm7
- movapd 6080(%ebx), %xmm0
- mulsd %xmm6, %xmm2
- addpd %xmm5, %xmm7
- pshufd $238, %xmm1, %xmm5
- mulsd %xmm2, %xmm6
- mulpd %xmm2, %xmm7
- addsd %xmm5, %xmm1
- xorpd %xmm5, %xmm5
- pshufd $238, %xmm7, %xmm2
- mulsd %xmm6, %xmm1
- pshufd $238, %xmm0, %xmm6
- addsd %xmm2, %xmm7
- movapd %xmm3, %xmm2
- pinsrw $3, %eax, %xmm5
- subsd %xmm6, %xmm3
- addsd %xmm1, %xmm0
- addsd %xmm3, %xmm6
- addsd %xmm4, %xmm7
- subsd %xmm6, %xmm2
- subsd %xmm7, %xmm0
- subsd %xmm2, %xmm0
- movl 16(%esp), %eax
- andl $-24577, %eax
- cmpl 16(%esp), %eax
- je .L_2TAG_PACKET_10.0.2
- stmxcsr 24(%esp)
- movl 16(%esp), %eax
- andl $24576, %eax
- orl %eax, 24(%esp)
- ldmxcsr 24(%esp)
-.L_2TAG_PACKET_10.0.2:
- xorpd %xmm5, %xmm0
- xorpd %xmm5, %xmm3
- subsd %xmm3, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_9.0.2:
- addl $261886, %eax
- cmpl $261888, %eax
- jb .L_2TAG_PACKET_11.0.2
- movd %xmm0, %ecx
- psrlq $32, %xmm0
- movd %xmm0, %edx
- andl $2147483647, %edx
- movl $1072693248, %eax
- subl %edx, %eax
- orl %ecx, %eax
- cmpl $0, %eax
- je .L_2TAG_PACKET_12.0.2
- movq 8(%esp), %xmm2
- movd %xmm2, %edx
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- andl $2147483647, %ecx
- subl $1, %edx
- sbbl $2146435072, %ecx
- cmpl $0, %ecx
- jge .L_2TAG_PACKET_11.0.2
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $32752, %edx
- pinsrw $3, %edx, %xmm1
- mulsd %xmm1, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_13.0.2
-.L_2TAG_PACKET_12.0.2:
- movsd 5984(%ebx), %xmm1
- movsd 6080(%ebx), %xmm2
- movsd 6088(%ebx), %xmm0
- movl 16(%esp), %eax
- andl $-24577, %eax
- cmpl 16(%esp), %eax
- je .L_2TAG_PACKET_14.0.2
- stmxcsr 24(%esp)
- movl 16(%esp), %eax
- andl $24576, %eax
- orl %eax, 24(%esp)
- ldmxcsr 24(%esp)
-.L_2TAG_PACKET_14.0.2:
- andnpd %xmm7, %xmm1
- orpd %xmm1, %xmm0
- orpd %xmm1, %xmm2
- addsd %xmm2, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_0.0.2:
- movl 16(%esp), %edx
- andl $-24577, %edx
- movl %edx, 24(%esp)
- ldmxcsr 24(%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_11.0.2:
- movsd 8(%esp), %xmm0
- xorpd %xmm6, %xmm6
- movapd %xmm0, %xmm7
- pextrw $3, %xmm0, %edx
- andl $32752, %edx
- subl $16, %edx
- cmpl $32736, %edx
- jb .L_2TAG_PACKET_15.0.2
- addsd %xmm0, %xmm6
- orpd %xmm6, %xmm0
- mulsd %xmm0, %xmm7
-.L_2TAG_PACKET_15.0.2:
- movsd %xmm0, (%esp)
- fldl (%esp)
-.L_2TAG_PACKET_13.0.2:
- movl 16(%esp), %edx
- andl $-24577, %edx
- cmpl 16(%esp), %edx
- je .L_2TAG_PACKET_4.0.2
- stmxcsr 24(%esp)
- movl 16(%esp), %edx
- andl $24576, %edx
- orl %edx, 24(%esp)
- ldmxcsr 24(%esp)
-.L_2TAG_PACKET_4.0.2:
- movl 64(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(asin)
-# -- End asin
-
-# Start file scope ASM
-ALIAS_SYMBOL(asinl, asin);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 780903145
- .long 1066854586
- .long 858993459
- .long 1068708659
- .long 3340530119
- .long 1067392113
- .long 1431655765
- .long 1069897045
- .long 1321528399
- .long 1066517740
- .long 3067833783
- .long 1067899757
- .long 2021159460
- .long 1065855096
- .long 2576980378
- .long 1066178969
- .long 1431655765
- .long 1069897045
- .long 858993459
- .long 1068708659
- .long 3067833783
- .long 1067899757
- .long 0
- .long 0
- .long 3822952792
- .long 1021639372
- .long 182792448
- .long 1068507836
- .long 2264213271
- .long 1019558908
- .long 649052928
- .long 1068524253
- .long 1797139609
- .long 1022295143
- .long 1243095296
- .long 1068540671
- .long 1415938756
- .long 1021439537
- .long 2033294592
- .long 1068557090
- .long 2356809978
- .long 1021777916
- .long 3088063744
- .long 1068573510
- .long 2669055318
- .long 1022124482
- .long 180888576
- .long 1068589932
- .long 3566445325
- .long 1021358712
- .long 1970196992
- .long 1068606354
- .long 896980323
- .long 1021319659
- .long 4229555456
- .long 1068622777
- .long 436049712
- .long 1021319758
- .long 2732572160
- .long 1068639202
- .long 583123209
- .long 1020797960
- .long 1842831872
- .long 1068655628
- .long 1370449804
- .long 1021429270
- .long 1628994560
- .long 1068672055
- .long 2411391464
- .long 1021057980
- .long 2159763712
- .long 1068688483
- .long 1208692749
- .long 1021943903
- .long 3503886336
- .long 1068704912
- .long 538793309
- .long 1019744063
- .long 1435187200
- .long 1068721343
- .long 4085087612
- .long 1020608419
- .long 317469952
- .long 1068737775
- .long 144386942
- .long 1021440732
- .long 219617280
- .long 1068754208
- .long 2940088361
- .long 1019981122
- .long 1210558208
- .long 1068770642
- .long 2176850347
- .long 1018373705
- .long 3359268352
- .long 1068787077
- .long 2395611454
- .long 1021889042
- .long 2439803648
- .long 1068803514
- .long 1650705253
- .long 1020227966
- .long 2816203520
- .long 1068819952
- .long 3702166386
- .long 1019379914
- .long 262620672
- .long 1068836392
- .long 1855649370
- .long 1020453124
- .long 3438159616
- .long 1068852832
- .long 923063860
- .long 1019273834
- .long 3822105856
- .long 1068869274
- .long 4289947947
- .long 1019434249
- .long 1483729920
- .long 1068885718
- .long 787455814
- .long 1020738379
- .long 787321088
- .long 1068902163
- .long 3321653337
- .long 1021842569
- .long 1802253312
- .long 1068918609
- .long 2653633526
- .long 1021821525
- .long 302985984
- .long 1068935057
- .long 161272028
- .long 1021655149
- .long 653966080
- .long 1068951506
- .long 2566098667
- .long 1020066219
- .long 2924727296
- .long 1068967956
- .long 3646493722
- .long 1014292285
- .long 2889890304
- .long 1068984408
- .long 1081009196
- .long 1022189620
- .long 619098112
- .long 1069000862
- .long 4011643355
- .long 1021773297
- .long 477017600
- .long 1069017317
- .long 4030305534
- .long 1021292252
- .long 2533403904
- .long 1069033773
- .long 2645187591
- .long 1019527099
- .long 2563102208
- .long 1069050231
- .long 3857293792
- .long 1022311697
- .long 635982336
- .long 1069066691
- .long 3625936637
- .long 1017511744
- .long 1116940800
- .long 1069083152
- .long 3653872993
- .long 1022016631
- .long 4075964160
- .long 1069099614
- .long 2468900271
- .long 1021769532
- .long 993165568
- .long 1069116079
- .long 1358104224
- .long 1021199776
- .long 528586752
- .long 1069132545
- .long 2200950332
- .long 1022024872
- .long 2752395776
- .long 1069149012
- .long 3197072454
- .long 1017751319
- .long 3439855616
- .long 1069165481
- .long 1651081806
- .long 1020809338
- .long 2661257728
- .long 1069181952
- .long 539032752
- .long 1021728805
- .long 486957312
- .long 1069198425
- .long 3136045149
- .long 1016888671
- .long 1282340352
- .long 1069214899
- .long 2593963259
- .long 1018956103
- .long 822921728
- .long 1069231375
- .long 2146032737
- .long 1022306465
- .long 3474216192
- .long 1069247852
- .long 3976811625
- .long 1021350207
- .long 716902656
- .long 1069264332
- .long 718267222
- .long 1018624727
- .long 1211594496
- .long 1069280813
- .long 1485641389
- .long 1018447451
- .long 734070272
- .long 1069297296
- .long 354455128
- .long 1021341291
- .long 3650110720
- .long 1069313780
- .long 682185947
- .long 1021651853
- .long 1440663040
- .long 1069330267
- .long 3558574550
- .long 1021615110
- .long 2766612224
- .long 1069346755
- .long 874607978
- .long 1017746872
- .long 3404011008
- .long 1069363245
- .long 4154988502
- .long 1021439906
- .long 3423949056
- .long 1069379737
- .long 2263202309
- .long 1021479615
- .long 2897587712
- .long 1069396231
- .long 2562065031
- .long 1022090363
- .long 1896159232
- .long 1069412727
- .long 3836237663
- .long 1019867288
- .long 490968576
- .long 1069429225
- .long 3322056743
- .long 1006752762
- .long 3048360192
- .long 1069445724
- .long 1152314833
- .long 1013122252
- .long 1049850624
- .long 1069462226
- .long 3601590727
- .long 1022214610
- .long 3156899584
- .long 1069478729
- .long 1855169970
- .long 1019487271
- .long 851173376
- .long 1069495235
- .long 312649594
- .long 1020868604
- .long 2794281728
- .long 1069511742
- .long 1093490181
- .long 1020777577
- .long 468042496
- .long 1069528252
- .long 1152540679
- .long 1021403732
- .long 2534219264
- .long 1069544763
- .long 2292126035
- .long 1021872430
- .long 1376146432
- .long 1069558527
- .long 3293753641
- .long 1020500454
- .long 4175442432
- .long 1069575044
- .long 3626347564
- .long 1021610969
- .long 3523113472
- .long 1069591566
- .long 339956500
- .long 1021119039
- .long 4003350528
- .long 1069608092
- .long 3429333082
- .long 1022813542
- .long 1611067392
- .long 1069624623
- .long 2298017544
- .long 1021977587
- .long 931782144
- .long 1069641158
- .long 2164684743
- .long 1021250988
- .long 2256725504
- .long 1069657697
- .long 1138762335
- .long 1021443776
- .long 1582853120
- .long 1069674241
- .long 1084010382
- .long 1022994693
- .long 3497758720
- .long 1069690789
- .long 406366244
- .long 1022713586
- .long 3999816960
- .long 1069707342
- .long 1488723042
- .long 1023381290
- .long 3383096064
- .long 1069723900
- .long 2541558953
- .long 1019137887
- .long 1942403584
- .long 1069740463
- .long 1879620343
- .long 1022653642
- .long 4268263680
- .long 1069757030
- .long 3039077047
- .long 1022252545
- .long 2067062272
- .long 1069773603
- .long 4190670677
- .long 1020725863
- .long 4225828096
- .long 1069790180
- .long 1998567321
- .long 1022014385
- .long 2452507136
- .long 1069806763
- .long 1511628873
- .long 1021900300
- .long 1340746240
- .long 1069823351
- .long 788367341
- .long 1022726208
- .long 1190035456
- .long 1069839944
- .long 3856337230
- .long 1021834118
- .long 2300688384
- .long 1069856542
- .long 3211396579
- .long 1022621365
- .long 678886400
- .long 1069873146
- .long 4001011887
- .long 1022042646
- .long 921594112
- .long 1069889755
- .long 557811968
- .long 1023065533
- .long 3331668992
- .long 1069906369
- .long 1877060679
- .long 1022419742
- .long 3917875200
- .long 1069922989
- .long 1181055171
- .long 1022752712
- .long 2984829696
- .long 1069939615
- .long 4294526932
- .long 1021499988
- .long 838049024
- .long 1069956247
- .long 3658081878
- .long 1022957952
- .long 2078928384
- .long 1069972884
- .long 820353701
- .long 1019391107
- .long 2719854336
- .long 1069989527
- .long 1644022489
- .long 1023378240
- .long 3069117696
- .long 1070006176
- .long 2771393702
- .long 1019319954
- .long 3435962368
- .long 1070022831
- .long 3876394145
- .long 1023024433
- .long 4130595328
- .long 1070039492
- .long 1630447748
- .long 1021465882
- .long 1169236224
- .long 1070056160
- .long 2828355997
- .long 1020458120
- .long 3453997312
- .long 1070072833
- .long 164091641
- .long 1020388279
- .long 2708127744
- .long 1070089513
- .long 3036550223
- .long 1023328684
- .long 3540797696
- .long 1070106199
- .long 3710949463
- .long 1022568805
- .long 1972276736
- .long 1070122892
- .long 3885277950
- .long 1019761674
- .long 2613815552
- .long 1070139591
- .long 2764165077
- .long 1022921023
- .long 1487791616
- .long 1070156297
- .long 1330644769
- .long 1023162679
- .long 3207593472
- .long 1070173009
- .long 3911007221
- .long 1022993496
- .long 3797764608
- .long 1070189728
- .long 979712598
- .long 1022554580
- .long 3578920448
- .long 1070206454
- .long 2825738223
- .long 1020223708
- .long 2872795648
- .long 1070223187
- .long 392451124
- .long 1022666279
- .long 2002258432
- .long 1070239927
- .long 3730407632
- .long 1023148291
- .long 1291326464
- .long 1070256674
- .long 3723802980
- .long 1022514089
- .long 1065180928
- .long 1070273428
- .long 2635617463
- .long 1022654470
- .long 1650181632
- .long 1070290189
- .long 2061982883
- .long 1022853411
- .long 3373882880
- .long 1070306957
- .long 319732785
- .long 1022017175
- .long 2270081280
- .long 1070323733
- .long 2237757411
- .long 1023064087
- .long 2963732736
- .long 1070340516
- .long 468839165
- .long 1023293774
- .long 1491099904
- .long 1070357307
- .long 1502657946
- .long 1021533479
- .long 2479636480
- .long 1070374105
- .long 482913562
- .long 1021986286
- .long 1968133632
- .long 1070390911
- .long 3281474337
- .long 1022646400
- .long 291639040
- .long 1070407725
- .long 2453320259
- .long 1022812423
- .long 2081472512
- .long 1070424546
- .long 2939989570
- .long 1023091888
- .long 3380340480
- .long 1070441375
- .long 2850707499
- .long 1021921109
- .long 232287488
- .long 1070458213
- .long 3674625342
- .long 1020725130
- .long 1567614208
- .long 1070475058
- .long 9347334
- .long 1022024009
- .long 3433091072
- .long 1070491911
- .long 282524999
- .long 1021433523
- .long 1876877312
- .long 1070508773
- .long 3470449440
- .long 1019309721
- .long 1538472192
- .long 1070525643
- .long 2089486825
- .long 1019698916
- .long 2763830784
- .long 1070542521
- .long 443498115
- .long 1020505194
- .long 1605381632
- .long 1070559408
- .long 3018871601
- .long 1022869913
- .long 2706946048
- .long 1070576303
- .long 3936260892
- .long 1023175875
- .long 2123887360
- .long 1070593207
- .long 2994220655
- .long 1022825948
- .long 104015104
- .long 1070603108
- .long 335054493
- .long 1023441853
- .long 2904568832
- .long 1070615800
- .long 1451215633
- .long 1023853857
- .long 3456197120
- .long 1070632739
- .long 436334733
- .long 1024026432
- .long 252452352
- .long 1070649697
- .long 34596167
- .long 1024031396
- .long 3328018432
- .long 1070666672
- .long 2644547073
- .long 1024296758
- .long 1255829248
- .long 1070683667
- .long 552832586
- .long 1023763122
- .long 4097058560
- .long 1070700680
- .long 1955640623
- .long 1021394654
- .long 451770112
- .long 1070717714
- .long 3428903777
- .long 1022941142
- .long 408920832
- .long 1070734767
- .long 165503263
- .long 1023894958
- .long 1186960640
- .long 1070751840
- .long 435826450
- .long 1024026134
- .long 19078656
- .long 1070768934
- .long 1834169749
- .long 1022899284
- .long 2743490304
- .long 1070786048
- .long 494581074
- .long 1018818479
- .long 2328961024
- .long 1070803184
- .long 2987908834
- .long 1022581110
- .long 350011392
- .long 1070820342
- .long 240771184
- .long 1024143083
- .long 2692326912
- .long 1070837521
- .long 666056837
- .long 1022394776
- .long 2373274368
- .long 1070854723
- .long 2484337770
- .long 1024228156
- .long 1017131520
- .long 1070871948
- .long 3285648279
- .long 1024025789
- .long 265558272
- .long 1070889196
- .long 392241896
- .long 1024252809
- .long 1778008064
- .long 1070906467
- .long 1536107943
- .long 1023949300
- .long 2937184768
- .long 1070923762
- .long 3541062251
- .long 1019448646
- .long 1144442880
- .long 1070941082
- .long 3691683781
- .long 1022123948
- .long 2410165504
- .long 1070958426
- .long 1804181960
- .long 1023945221
- .long 4174350848
- .long 1070975795
- .long 2016094861
- .long 1021716585
- .long 3897012480
- .long 1070993190
- .long 175294410
- .long 1023703404
- .long 3353623040
- .long 1071010611
- .long 167973242
- .long 1023240839
- .long 45671168
- .long 1071028059
- .long 2166856113
- .long 1021565413
- .long 86063872
- .long 1071045533
- .long 2676254727
- .long 1023985299
- .long 1019772672
- .long 1071063034
- .long 989043593
- .long 1021549587
- .long 414297344
- .long 1071080563
- .long 3960972046
- .long 1024307251
- .long 155173120
- .long 1071098120
- .long 1830919291
- .long 1021592251
- .long 2151562240
- .long 1071115705
- .long 405408666
- .long 1023423128
- .long 4041854720
- .long 1071133319
- .long 2043497827
- .long 1024411503
- .long 3489224192
- .long 1071150963
- .long 3072215864
- .long 1022698635
- .long 2477196288
- .long 1071168637
- .long 1812195139
- .long 1022689192
- .long 3015298816
- .long 1071186341
- .long 764841969
- .long 1021027331
- .long 2844731136
- .long 1071204076
- .long 2878117321
- .long 1019116513
- .long 4028950528
- .long 1071221842
- .long 698911452
- .long 1023265602
- .long 69441536
- .long 1071239641
- .long 3253467847
- .long 1020795075
- .long 1676209920
- .long 1071257471
- .long 4272431167
- .long 1022873982
- .long 2408752384
- .long 1071275334
- .long 648519100
- .long 1024385717
- .long 151623680
- .long 1071293231
- .long 345257017
- .long 1019561408
- .long 1410154240
- .long 1071311161
- .long 197863993
- .long 1023224207
- .long 4131351552
- .long 1071329125
- .long 2620801789
- .long 1024411169
- .long 1999664384
- .long 1071347125
- .long 3952692616
- .long 1024168086
- .long 1617668864
- .long 1071365160
- .long 3019889809
- .long 1021907692
- .long 1032074240
- .long 1071383231
- .long 59469899
- .long 1023656194
- .long 2619492096
- .long 1071401338
- .long 1417526820
- .long 1021457783
- .long 202429440
- .long 1071419483
- .long 2927667935
- .long 1019175447
- .long 525044224
- .long 1071437665
- .long 38166811
- .long 1023981879
- .long 1779258880
- .long 1071455885
- .long 481252500
- .long 1023310234
- .long 2195673600
- .long 1071474144
- .long 3962395981
- .long 1021339088
- .long 44573696
- .long 1071492443
- .long 3936281395
- .long 1023014829
- .long 2226905344
- .long 1071510781
- .long 1515320476
- .long 1024320623
- .long 2800512512
- .long 1071529160
- .long 1225403697
- .long 1021081846
- .long 161113600
- .long 1071547581
- .long 3064809733
- .long 1024173917
- .long 1338410240
- .long 1071566043
- .long 2027604973
- .long 1024362526
- .long 522433280
- .long 1071584548
- .long 2055171723
- .long 1023858825
- .long 539595776
- .long 1071603096
- .long 3868820135
- .long 1022936424
- .long 4264017664
- .long 1071621687
- .long 3228065145
- .long 1023479578
- .long 1733924096
- .long 1071640324
- .long 3511934475
- .long 1022496355
- .long 108880384
- .long 1071651839
- .long 615880967
- .long 1023519706
- .long 3517856512
- .long 1071661202
- .long 3113108559
- .long 1025190289
- .long 4043153152
- .long 1071670589
- .long 1571836218
- .long 1023106116
- .long 3251299072
- .long 1071680000
- .long 3444076102
- .long 1022187841
- .long 2736921600
- .long 1071689435
- .long 272771483
- .long 1025095280
- .long 3897698560
- .long 1071703633
- .long 2075390188
- .long 1022489022
- .long 3209485056
- .long 1071722652
- .long 1438094065
- .long 1021844944
- .long 3781432064
- .long 1071741774
- .long 1675017145
- .long 1024143828
- .long 2684184064
- .long 1071761003
- .long 2259963753
- .long 1024731393
- .long 1840489728
- .long 1071780342
- .long 3372883597
- .long 1023431408
- .long 3764087808
- .long 1071799794
- .long 3307523102
- .long 1024485788
- .long 3006232320
- .long 1071819364
- .long 3088971966
- .long 1025213251
- .long 3374881280
- .long 1071839055
- .long 834437749
- .long 1025236452
- .long 797284864
- .long 1071858872
- .long 3122663941
- .long 1025320473
- .long 545765120
- .long 1071878818
- .long 826539625
- .long 1022450955
- .long 107562240
- .long 1071898898
- .long 339584600
- .long 1022481255
- .long 2123649024
- .long 1071919116
- .long 3912959833
- .long 1024321009
- .long 1562385664
- .long 1071939478
- .long 2846067230
- .long 1023343981
- .long 2963085824
- .long 1071959988
- .long 954548627
- .long 1021475211
- .long 3325550592
- .long 1071980652
- .long 3459651155
- .long 1025305573
- .long 775752448
- .long 1072001476
- .long 3582746667
- .long 1023859460
- .long 3238590720
- .long 1072022464
- .long 634636162
- .long 1024472353
- .long 2758801920
- .long 1072043624
- .long 3078216319
- .long 1025304516
- .long 1370319104
- .long 1072064962
- .long 2570569078
- .long 1025099442
- .long 2615805184
- .long 1072086484
- .long 3729933412
- .long 1024605112
- .long 3077336576
- .long 1072108198
- .long 1948916066
- .long 1024781603
- .long 1099528192
- .long 1072130112
- .long 3139143157
- .long 1023729360
- .long 1231903232
- .long 1072152233
- .long 1349513477
- .long 1024737515
- .long 1507504128
- .long 1072174570
- .long 3484516322
- .long 1024000959
- .long 2214659840
- .long 1072197132
- .long 2563820917
- .long 1025225535
- .long 1804739840
- .long 1072219929
- .long 760038746
- .long 1024482855
- .long 1413746688
- .long 1072242971
- .long 3401734714
- .long 1025129838
- .long 821409536
- .long 1072266269
- .long 3729772551
- .long 1025484796
- .long 3031825664
- .long 1072289834
- .long 122256749
- .long 1024752594
- .long 1710784256
- .long 1072313680
- .long 1518205483
- .long 1024724809
- .long 3025265152
- .long 1072337819
- .long 409951989
- .long 1022835555
- .long 287769088
- .long 1072362267
- .long 800355594
- .long 1022484850
- .long 198179840
- .long 1072387038
- .long 3502926213
- .long 1024209373
- .long 1909130496
- .long 1072412149
- .long 3064694319
- .long 1025380823
- .long 1941732096
- .long 1072437619
- .long 4112930390
- .long 1024294679
- .long 3492010496
- .long 1072463467
- .long 2684918107
- .long 1023220233
- .long 81959680
- .long 1072489716
- .long 220021366
- .long 1020635131
- .long 2297837056
- .long 1072516387
- .long 4027683826
- .long 1021041185
- .long 270404096
- .long 1072543508
- .long 2012766065
- .long 1021780753
- .long 3667376896
- .long 1072571105
- .long 2727981522
- .long 1023009874
- .long 330400256
- .long 1072599212
- .long 2940017003
- .long 1025393439
- .long 1119293952
- .long 1072627861
- .long 1608550416
- .long 1022675612
- .long 3536155904
- .long 1072657091
- .long 349665778
- .long 1025156751
- .long 3078046720
- .long 1072686946
- .long 2016159996
- .long 1022193169
- .long 455228416
- .long 1072705361
- .long 1908539328
- .long 1026126332
- .long 1871505664
- .long 1072720988
- .long 2784700894
- .long 1025922277
- .long 1630994432
- .long 1072737010
- .long 361107678
- .long 1022887244
- .long 2084558336
- .long 1072753462
- .long 2642784509
- .long 1072689083
- .long 1514442531
- .long 1072688953
- .long 333108933
- .long 1072688821
- .long 3392112024
- .long 1072688686
- .long 2099852862
- .long 1072688550
- .long 749609004
- .long 1072688412
- .long 3634632596
- .long 1072688271
- .long 2163248461
- .long 1072688129
- .long 628657846
- .long 1072687985
- .long 3324036511
- .long 1072687838
- .long 1657632815
- .long 1072687690
- .long 4217538760
- .long 1072687539
- .long 2411951597
- .long 1072687387
- .long 533944872
- .long 1072687233
- .long 2876566508
- .long 1072687076
- .long 847936891
- .long 1072686918
- .long 3036019913
- .long 1072686757
- .long 848884575
- .long 1072686595
- .long 2874443326
- .long 1072686430
- .long 520713666
- .long 1072686264
- .long 2375556481
- .long 1072686095
- .long 4141904948
- .long 1072685924
- .long 1522666382
- .long 1072685752
- .long 3105624104
- .long 1072685577
- .long 298666327
- .long 1072685401
- .long 1689524500
- .long 1072685222
- .long 2981002200
- .long 1072685041
- .long 4170844284
- .long 1072684858
- .long 961802263
- .long 1072684674
- .long 1941503454
- .long 1072684487
- .long 2812647170
- .long 1072684298
- .long 3572873869
- .long 1072684107
- .long 4219797823
- .long 1072683914
- .long 456039788
- .long 1072683720
- .long 869096151
- .long 1072683523
- .long 1161535119
- .long 1072683324
- .long 1330865866
- .long 1072683123
- .long 1374571204
- .long 1072682920
- .long 1290107538
- .long 1072682715
- .long 1074904836
- .long 1072682508
- .long 726366587
- .long 1072682299
- .long 241869763
- .long 1072682088
- .long 3913732079
- .long 1072681874
- .long 3149342765
- .long 1072681659
- .long 2240966306
- .long 1072681442
- .long 1185873216
- .long 1072681223
- .long 4276274591
- .long 1072681001
- .long 2919452883
- .long 1072680778
- .long 1407565635
- .long 1072680553
- .long 4032743551
- .long 1072680325
- .long 2202188565
- .long 1072680096
- .long 207977577
- .long 1072679865
- .long 2342160518
- .long 1072679631
- .long 11858423
- .long 1072679396
- .long 1804034453
- .long 1072679158
- .long 3420722787
- .long 1072678918
- .long 563930456
- .long 1072678677
- .long 1820539192
- .long 1072678433
- .long 2892501606
- .long 1072678187
- .long 3776710320
- .long 1072677939
- .long 175063337
- .long 1072677690
- .long 674333171
- .long 1072677438
- .long 976363026
- .long 1072677184
- .long 1077935934
- .long 1072676928
- .long 1921075490
- .long 1072676540
- .long 881493302
- .long 1072676016
- .long 3275752439
- .long 1072675483
- .long 486855588
- .long 1072674943
- .long 1077229111
- .long 1072674394
- .long 723950308
- .long 1072673837
- .long 3693582199
- .long 1072673271
- .long 1367335316
- .long 1072672698
- .long 2305837020
- .long 1072672116
- .long 2184358641
- .long 1072671526
- .long 972682840
- .long 1072670928
- .long 2935101762
- .long 1072670321
- .long 3745513263
- .long 1072669706
- .long 3372320886
- .long 1072669083
- .long 1783464620
- .long 1072668452
- .long 3241386215
- .long 1072667812
- .long 3418125284
- .long 1072667164
- .long 2280219148
- .long 1072666508
- .long 4088700758
- .long 1072665843
- .long 219227400
- .long 1072665171
- .long 3521816918
- .long 1072664489
- .long 1076205279
- .long 1072663800
- .long 1436484616
- .long 1072663102
- .long 271362610
- .long 1072662396
- .long 1838996688
- .long 1072661681
- .long 1807122518
- .long 1072660958
- .long 137953542
- .long 1072660227
- .long 1088178584
- .long 1072659487
- .long 324057537
- .long 1072658739
- .long 2101288076
- .long 1072657982
- .long 2085133974
- .long 1072657217
- .long 235324451
- .long 1072656444
- .long 806051592
- .long 1072655662
- .long 3756033140
- .long 1072654871
- .long 453542543
- .long 1072654073
- .long 3741177327
- .long 1072653265
- .long 691216109
- .long 1072652450
- .long 4145223372
- .long 1072651625
- .long 1174439091
- .long 1072650793
- .long 324416139
- .long 1072649952
- .long 1550246310
- .long 1072649102
- .long 511524674
- .long 1072648244
- .long 1457248482
- .long 1072647377
- .long 45944955
- .long 1072646502
- .long 525537397
- .long 1072645618
- .long 2848440188
- .long 1072644725
- .long 2671555633
- .long 1072643824
- .long 4241172637
- .long 1072642914
- .long 3213094278
- .long 1072641996
- .long 3832503688
- .long 1072641069
- .long 1754091534
- .long 1072640134
- .long 1221921804
- .long 1072639190
- .long 2184526489
- .long 1072638237
- .long 294902089
- .long 1072637276
- .long 4090375270
- .long 1072636305
- .long 632860906
- .long 1072635327
- .long 2753498702
- .long 1072634339
- .long 1808009252
- .long 1072633343
- .long 2036428672
- .long 1072632338
- .long 3383235626
- .long 1072631324
- .long 1497347484
- .long 1072630302
- .long 617018317
- .long 1072629271
- .long 684933058
- .long 1072628231
- .long 1643170798
- .long 1072627182
- .long 3011066360
- .long 1072625592
- .long 957158713
- .long 1072623442
- .long 1390907941
- .long 1072621256
- .long 3819155270
- .long 1072619034
- .long 3443571196
- .long 1072616777
- .long 4045412458
- .long 1072614484
- .long 805503923
- .long 1072612156
- .long 1778922015
- .long 1072609791
- .long 2125033665
- .long 1072607390
- .long 1287203863
- .long 1072604953
- .long 2992629568
- .long 1072602479
- .long 2367267127
- .long 1072599969
- .long 3115526047
- .long 1072597422
- .long 340219539
- .long 1072594839
- .long 2017215719
- .long 1072592218
- .long 3225443424
- .long 1072589560
- .long 3326565673
- .long 1072586865
- .long 1669811211
- .long 1072584133
- .long 1886735022
- .long 1072581363
- .long 3301071171
- .long 1072578555
- .long 928514283
- .long 1072575710
- .long 2656364059
- .long 1072572826
- .long 3473490507
- .long 1072569904
- .long 2649965606
- .long 1072566944
- .long 3736819052
- .long 1072563945
- .long 1680885175
- .long 1072560908
- .long 4413771
- .long 1072557832
- .long 2214869753
- .long 1072554716
- .long 3214725184
- .long 1072551561
- .long 2186079903
- .long 1072548367
- .long 2590372131
- .long 1072545133
- .long 3578146079
- .long 1072541859
- .long 4283712755
- .long 1072538545
- .long 3824834510
- .long 1072535191
- .long 1302400298
- .long 1072531797
- .long 95058636
- .long 1072528362
- .long 3563906063
- .long 1072524885
- .long 2167230730
- .long 1072521368
- .long 3524918334
- .long 1072517809
- .long 2353304918
- .long 1072514209
- .long 1939625839
- .long 1072510567
- .long 1256714581
- .long 1072506883
- .long 3552525848
- .long 1072503156
- .long 3464809522
- .long 1072499387
- .long 4200542593
- .long 1072495575
- .long 355609124
- .long 1072491721
- .long 3684139099
- .long 1072487822
- .long 148355918
- .long 1072483881
- .long 1457689242
- .long 1072479895
- .long 2118591596
- .long 1072475865
- .long 908848089
- .long 1072471791
- .long 877032689
- .long 1072467672
- .long 752012304
- .long 1072463508
- .long 3532301749
- .long 1072459298
- .long 3600563221
- .long 1072455043
- .long 3902857084
- .long 1072450742
- .long 3063101036
- .long 1072446395
- .long 3972344374
- .long 1072442001
- .long 903183549
- .long 1072437561
- .long 983892938
- .long 1072433073
- .long 2722858568
- .long 1072428537
- .long 302790515
- .long 1072423954
- .long 759811057
- .long 1072419322
- .long 2507809922
- .long 1072414641
- .long 2388408813
- .long 1072407528
- .long 2084492942
- .long 1072397870
- .long 2435703301
- .long 1072388010
- .long 1935433360
- .long 1072377945
- .long 2742047290
- .long 1072367671
- .long 2053284205
- .long 1072357185
- .long 657783367
- .long 1072346483
- .long 2893664841
- .long 1072335560
- .long 3718906405
- .long 1072324413
- .long 1547896303
- .long 1072313038
- .long 2494058440
- .long 1072301429
- .long 3133238742
- .long 1072289582
- .long 3327000086
- .long 1072277492
- .long 1860667274
- .long 1072265154
- .long 665340747
- .long 1072252562
- .long 443347841
- .long 1072239710
- .long 581282618
- .long 1072226592
- .long 3349780465
- .long 1072213201
- .long 914217606
- .long 1072199532
- .long 989797661
- .long 1072185576
- .long 945436416
- .long 1072171326
- .long 549291300
- .long 1072156774
- .long 1814636389
- .long 1072141911
- .long 239092858
- .long 1072126729
- .long 1794680724
- .long 1072111217
- .long 1241534678
- .long 1072095366
- .long 3366566214
- .long 1072079164
- .long 1244090828
- .long 1072062601
- .long 1708448120
- .long 1072045663
- .long 3544260650
- .long 1072028337
- .long 1402741403
- .long 1072010610
- .long 2551936888
- .long 1071992465
- .long 617669739
- .long 1071973887
- .long 794002186
- .long 1071954857
- .long 2021237693
- .long 1071935356
- .long 540450384
- .long 1071915364
- .long 1920555537
- .long 1071894857
- .long 2879585206
- .long 1071873811
- .long 3000237455
- .long 1071852199
- .long 3352974346
- .long 1071829991
- .long 569629937
- .long 1071807155
- .long 2077237208
- .long 1071783653
- .long 2284891805
- .long 1071759446
- .long 1226651784
- .long 1071734489
- .long 1102047405
- .long 1071708731
- .long 2009896384
- .long 1071682115
- .long 927419082
- .long 1071654577
- .long 85010366
- .long 1071607413
- .long 696431025
- .long 1071548180
- .long 2611410541
- .long 1071486585
- .long 2612593658
- .long 1071422396
- .long 3548155306
- .long 1071355336
- .long 3887997484
- .long 1071285073
- .long 244854763
- .long 1071211202
- .long 4214445648
- .long 1071133216
- .long 2303966727
- .long 1071050478
- .long 3991040013
- .long 1070962152
- .long 3126952278
- .long 1070867118
- .long 1817448378
- .long 1070763804
- .long 1793814864
- .long 1070649884
- .long 3507224072
- .long 1070447193
- .long 4027609105
- .long 1070148772
- .long 577507993
- .long 1069779414
- .long 2310232419
- .long 1068931829
- .long 4294967295
- .long 2147483647
- .long 0
- .long 0
- .long 0
- .long 4294950912
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 4160749568
- .long 4294967295
- .long 4160749568
- .long 4294967295
- .long 0
- .long 2147483584
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .long 856972295
- .long 1016178214
- .long 1413754136
- .long 1073291771
- .type static_const_table,@object
- .size static_const_table,6096
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/e_atan2.S b/libm/x86/e_atan2.S
deleted file mode 100644
index e491396..0000000
--- a/libm/x86/e_atan2.S
+++ /dev/null
@@ -1,1221 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-//
-//1. The method is based on the relationship of atan2(Y,X) to atan(|Y/X|)
-// as follows.
-// / sign(Y) atan(|Y/X|) if X > 0
-// atan2(Y,X) =
-// \ sign(Y)*pi - sign(Y)*atan(|Y/X|) if X < 0
-//
-// Thus, atan2(Y,X) is of the form atan2(Y,X) = PI + sgn*atan(|Y/X|)
-// where PI and sgn can be determined by the four possible combinations of
-// of the pair (sign(X),sign(Y)). We concentrate on the numerical method
-// for atan(|Y/X|).
-//
-//2. For |Y/X| < 2^(-64), atan(|Y/X|) ~=~ |Y/X|. Hence, atan2(Y,X) is Y/X
-// if X > 0, and sign(Y)*pi otherwise.
-//3. For |Y/X| >= 2^(65), atan(|Y/X|) ~=~ pi/2. Hence atan2(Y,X) is sign(Y)pi/2.
-//4. For 2^(-64) <= |Y/X| < 2^(-5), atan(|Y/X|) is approximated by a polynomial
-// of the form Z + Z*E*polynomial(E), where Z = |Y/X| and E = Z*Z.
-//5. For |Y/X| > 2^(5), atan(|Y/X|) = pi/2 + atan(-|X/Y|), and atan(-|X/Y|) is
-// calculated using the polynomial in 4 above.
-//6. For 2^(-5) <= |Y/X| <= 2^(5), we employ a table lookup method. First,
-// we obtain B = 2^k * 1.b1 b2 b3 b4 = 2^k * (1+k/16) that approximate
-// |Y/X| to approximately 5 significant bits. Hence, atan(|Y/X|) is
-//
-// atan(|Y/X|) = atan(B) + atan(Z), where Z = (|Y|-B|X|)/(|X|+B|Y|).
-// ~=~ tau + Z + Z*E*polynomial(E), where E = Z*Z.
-//
-// B has the range from 2^(-6)*(1+14/16) to 2^5 = 2^(5)*(1+0/16), totally
-// 163 possible values. These values are calculated beforehand and stored
-// in a table. The polynomial is the one used in 4.
-//
-// Special cases:
-// atan2(+-0, +0) = +-0
-// atan2(+-0, -0) = +-pi
-// atan2(+-0, x) = +-0, for x > 0, and +-pi, for x < 0
-// atan2(y, +-0) = +pi/2 for y > 0, and -pi/2 for y < 0
-// atan2(+-y, +INF) = +-0, for finite y > 0
-// atan2(+-y, -INF) = +-pi, for finite y > 0
-// atan2(+-INF, x) = +-pi/2, for finite x
-// atan2(+-INF, +INF) = +-pi/4
-// atan2(+-INF, -INF) = +-3*pi/4
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin atan2
-ENTRY(atan2)
-# parameter 1: 8 + %ebp
-# parameter 2: 16 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $120, %esp
- movl %ebx, 64(%esp)
- call static_func
- movl %eax, %ebx
- movsd 136(%esp), %xmm1
- movsd 128(%esp), %xmm0
- pextrw $3, %xmm0, %eax
- movq %xmm0, 8(%esp)
- andl $32752, %eax
- movq %xmm1, 16(%esp)
- subl $14448, %eax
- cmpl $3840, %eax
- ja .L_2TAG_PACKET_0.0.2
- pextrw $3, %xmm1, %eax
- andl $32752, %eax
- subl $14448, %eax
- cmpl $3840, %eax
- ja .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- unpcklpd %xmm1, %xmm0
- xorpd %xmm5, %xmm5
- xorpd %xmm3, %xmm3
- movl $2048, %eax
- pinsrw $3, %eax, %xmm5
- paddw %xmm1, %xmm5
- psrlq $29, %xmm5
- rcpss %xmm5, %xmm3
- xorpd %xmm4, %xmm4
- movl $14336, %ecx
- pinsrw $3, %ecx, %xmm4
- psllq $29, %xmm3
- paddw %xmm4, %xmm3
- mulsd %xmm0, %xmm3
- xorpd %xmm2, %xmm2
- xorpd %xmm6, %xmm6
- xorpd %xmm7, %xmm7
- movl $32768, %eax
- pinsrw $2, %eax, %xmm6
- movl $32767, %ecx
- pinsrw $3, %ecx, %xmm7
- paddd %xmm6, %xmm3
- andpd %xmm7, %xmm3
- movapd %xmm3, %xmm5
- pextrw $3, %xmm3, %eax
- movl $16448, %ecx
- pinsrw $3, %ecx, %xmm2
- minsd %xmm2, %xmm3
- movmskpd %xmm0, %edx
- psllq $1, %xmm0
- psrlq $1, %xmm0
- cmpsd $2, %xmm2, %xmm5
- psllq $1, %xmm1
- psrlq $1, %xmm1
- movapd %xmm1, %xmm6
- movapd %xmm1, %xmm7
- movapd %xmm0, %xmm2
- movl $0, %ecx
- pinsrw $0, %ecx, %xmm6
- subsd %xmm6, %xmm7
- movapd %xmm0, %xmm4
- mulsd %xmm3, %xmm6
- mulsd %xmm3, %xmm4
- mulsd %xmm3, %xmm7
- andpd %xmm5, %xmm0
- subsd %xmm6, %xmm0
- andpd %xmm5, %xmm1
- addsd %xmm1, %xmm4
- subsd %xmm7, %xmm0
- andl $32752, %eax
- subl $16286, %eax
- cmpl $1121, %eax
- ja .L_2TAG_PACKET_3.0.2
- divsd %xmm4, %xmm0
- pextrw $3, %xmm3, %ecx
- movsd 2944(%ebx), %xmm2
- movsd 2960(%ebx), %xmm3
- pextrw $0, %xmm5, %eax
- addl %edx, %edx
- movapd 2688(%ebx,%edx,8), %xmm6
- movapd 2752(%ebx,%edx,8), %xmm1
- subl $16286, %ecx
- notl %eax
- andl $1, %eax
- addl %eax, %ecx
- addl %ecx, %ecx
- movapd (%ebx,%ecx,8), %xmm5
- xorpd %xmm1, %xmm5
- addpd %xmm6, %xmm5
- movapd %xmm5, %xmm6
- unpckhpd %xmm5, %xmm5
- xorpd %xmm0, %xmm1
- movapd %xmm1, %xmm4
- mulsd %xmm0, %xmm0
- mulsd %xmm0, %xmm2
- addsd %xmm0, %xmm3
- addsd %xmm6, %xmm1
- subsd %xmm1, %xmm6
- addsd %xmm4, %xmm6
- addsd 2952(%ebx), %xmm2
- mulsd %xmm0, %xmm3
- mulsd %xmm0, %xmm4
- addsd %xmm5, %xmm6
- mulsd %xmm4, %xmm2
- addsd 2968(%ebx), %xmm3
- mulsd %xmm3, %xmm2
- addsd %xmm6, %xmm2
- addsd %xmm2, %xmm1
- movsd %xmm1, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_3.0.2:
- addl $942, %eax
- cmpl $942, %eax
- ja .L_2TAG_PACKET_5.0.2
- xorpd %xmm4, %xmm4
- movl $16368, %ecx
- pinsrw $3, %ecx, %xmm4
- divsd %xmm1, %xmm4
- addl %edx, %edx
- movapd 2752(%ebx,%edx,8), %xmm6
- unpcklpd %xmm3, %xmm3
- xorpd %xmm6, %xmm0
- xorpd %xmm6, %xmm2
- xorpd %xmm6, %xmm3
- movapd 2816(%ebx,%edx,8), %xmm7
- movsd 2944(%ebx), %xmm1
- movsd 2960(%ebx), %xmm5
- andpd 2880(%ebx,%edx,8), %xmm3
- mulsd %xmm4, %xmm2
- mulsd %xmm4, %xmm0
- movapd %xmm2, %xmm6
- mulsd %xmm2, %xmm2
- mulsd %xmm2, %xmm1
- addsd %xmm2, %xmm5
- mulsd %xmm2, %xmm6
- addsd 2952(%ebx), %xmm1
- mulsd %xmm2, %xmm5
- addsd %xmm0, %xmm7
- addpd %xmm3, %xmm7
- mulsd %xmm6, %xmm1
- addsd 2968(%ebx), %xmm5
- mulsd %xmm1, %xmm5
- addsd %xmm7, %xmm5
- unpckhpd %xmm7, %xmm7
- addsd %xmm7, %xmm5
- movsd %xmm5, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_5.0.2:
- movsd 16(%esp), %xmm1
- movsd 8(%esp), %xmm0
- pextrw $3, %xmm1, %eax
- andl $32752, %eax
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- cmpl %eax, %ecx
- jg .L_2TAG_PACKET_6.0.2
- pextrw $3, %xmm1, %ecx
- cmpl $32767, %ecx
- jg .L_2TAG_PACKET_7.0.2
- divsd %xmm1, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_7.0.2:
- andpd 2672(%ebx), %xmm0
- movsd 2640(%ebx), %xmm2
- xorpd %xmm2, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_6.0.2:
- andpd 2672(%ebx), %xmm0
- movsd 2624(%ebx), %xmm2
- xorpd %xmm2, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_0.0.2:
-.L_2TAG_PACKET_1.0.2:
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- pextrw $3, %xmm1, %eax
- andl $32752, %eax
- cmpl $32752, %ecx
- je .L_2TAG_PACKET_8.0.2
- cmpl $32752, %eax
- je .L_2TAG_PACKET_9.0.2
- movsd 2992(%ebx), %xmm3
- movl $1024, %edx
- movsd 2976(%ebx), %xmm4
- xorpd %xmm6, %xmm6
- movsd 3008(%ebx), %xmm7
- cmpl $0, %ecx
- je .L_2TAG_PACKET_10.0.2
-.L_2TAG_PACKET_11.0.2:
- cmpl $0, %eax
- je .L_2TAG_PACKET_12.0.2
-.L_2TAG_PACKET_13.0.2:
- addl %ecx, %edx
- subl %eax, %edx
- cmpl $2048, %edx
- ja .L_2TAG_PACKET_5.0.2
- addl $15344, %edx
- pinsrw $3, %edx, %xmm6
- andpd %xmm4, %xmm0
- andpd %xmm4, %xmm1
- orpd %xmm6, %xmm0
- orpd %xmm7, %xmm1
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_10.0.2:
- subl $880, %edx
- mulsd %xmm3, %xmm0
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- cmpl $0, %ecx
- je .L_2TAG_PACKET_14.0.2
- jmp .L_2TAG_PACKET_11.0.2
-.L_2TAG_PACKET_12.0.2:
- addl $880, %edx
- mulsd %xmm3, %xmm1
- pextrw $3, %xmm1, %eax
- andl $32752, %eax
- cmpl $0, %eax
- je .L_2TAG_PACKET_15.0.2
- jmp .L_2TAG_PACKET_13.0.2
-.L_2TAG_PACKET_8.0.2:
- movd %xmm0, %edx
- movapd %xmm0, %xmm2
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- andl $1048575, %ecx
- orl %edx, %ecx
- cmpl $0, %ecx
- jne .L_2TAG_PACKET_16.0.2
- psrlq $63, %xmm0
- psllq $63, %xmm0
- cmpl $32752, %eax
- jae .L_2TAG_PACKET_17.0.2
- movapd 2624(%ebx), %xmm5
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- orpd %xmm5, %xmm0
-.L_2TAG_PACKET_18.0.2:
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_16.0.2:
- addsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_18.0.2
-.L_2TAG_PACKET_17.0.2:
- movd %xmm1, %eax
- movapd %xmm1, %xmm2
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- movl $-2147483648, %edx
- andl %ecx, %edx
- andl $1048575, %ecx
- orl %eax, %ecx
- cmpl $0, %ecx
- jne .L_2TAG_PACKET_19.0.2
- cmpl $0, %edx
- jne .L_2TAG_PACKET_20.0.2
- movapd 2656(%ebx), %xmm5
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- orpd %xmm5, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_19.0.2:
- movapd %xmm1, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_20.0.2:
- movapd 2656(%ebx), %xmm5
- movapd 2624(%ebx), %xmm6
- addpd %xmm6, %xmm5
- pshufd $238, %xmm5, %xmm6
- addpd %xmm6, %xmm5
- orpd %xmm5, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_9.0.2:
- movd %xmm1, %eax
- movapd %xmm1, %xmm2
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- movl $-2147483648, %edx
- andl %ecx, %edx
- andl $1048575, %ecx
- orl %eax, %ecx
- cmpl $0, %ecx
- jne .L_2TAG_PACKET_19.0.2
- psrlq $63, %xmm0
- psllq $63, %xmm0
- cmpl $0, %edx
- jne .L_2TAG_PACKET_21.0.2
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_21.0.2:
- movapd 2640(%ebx), %xmm5
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- orpd %xmm5, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_14.0.2:
- pextrw $3, %xmm1, %edx
- andl $32768, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_22.0.2
- movapd 2640(%ebx), %xmm5
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- comisd %xmm0, %xmm1
- orpd %xmm5, %xmm0
- jne .L_2TAG_PACKET_23.0.2
-.L_2TAG_PACKET_24.0.2:
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_23.0.2:
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_22.0.2:
- comisd %xmm0, %xmm1
- jne .L_2TAG_PACKET_23.0.2
- je .L_2TAG_PACKET_24.0.2
-.L_2TAG_PACKET_15.0.2:
- movapd 2624(%ebx), %xmm5
- psrlq $63, %xmm0
- psllq $63, %xmm0
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- orpd %xmm5, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
-.L_2TAG_PACKET_4.0.2:
- movl 64(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(atan2)
-# -- End atan2
-
-# Start file scope ASM
-ALIAS_SYMBOL(atan2l, atan2);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 3390881280
- .long 1067318733
- .long 1411116779
- .long 1018950063
- .long 2985987840
- .long 1067384211
- .long 2088903695
- .long 1018086027
- .long 3148445184
- .long 1067449685
- .long 2044163806
- .long 1017271335
- .long 3667629184
- .long 1067515494
- .long 2353092775
- .long 1019967309
- .long 1546568832
- .long 1067580954
- .long 611991315
- .long 1017602584
- .long 3815996800
- .long 1067646404
- .long 466038598
- .long 1019686426
- .long 4050241920
- .long 1067711845
- .long 3265026328
- .long 1019626952
- .long 120454912
- .long 1067777277
- .long 1542207696
- .long 1020155608
- .long 2784639744
- .long 1067842697
- .long 3883834623
- .long 1018602870
- .long 1328010624
- .long 1067908107
- .long 1791097456
- .long 1019053126
- .long 2217794048
- .long 1067973505
- .long 551619938
- .long 1018494194
- .long 3333520000
- .long 1068038891
- .long 2390331823
- .long 1019033022
- .long 2557052032
- .long 1068104265
- .long 2423976108
- .long 1019728674
- .long 2067649536
- .long 1068169626
- .long 3757397745
- .long 1018672362
- .long 4047094784
- .long 1068234973
- .long 481613184
- .long 1019275104
- .long 2089853184
- .long 1068300307
- .long 1733914374
- .long 1020124677
- .long 2678003840
- .long 1068365626
- .long 1373600282
- .long 1013935474
- .long 3706496128
- .long 1068430930
- .long 1000610902
- .long 1019673285
- .long 3073179008
- .long 1068496219
- .long 1497143008
- .long 1019900342
- .long 2803716736
- .long 1068562846
- .long 1476677416
- .long 1019444094
- .long 3204984128
- .long 1068628077
- .long 1192335905
- .long 1018748628
- .long 831146624
- .long 1068693273
- .long 2733586224
- .long 1018823295
- .long 243029376
- .long 1068758431
- .long 950106081
- .long 1019046675
- .long 1735561920
- .long 1068823549
- .long 3546440856
- .long 1020104712
- .long 1339217792
- .long 1068888626
- .long 3028812387
- .long 1019818321
- .long 3706342144
- .long 1068953659
- .long 3814564029
- .long 1017763871
- .long 637726976
- .long 1069018648
- .long 3584007699
- .long 1017976868
- .long 1148779264
- .long 1069083589
- .long 2282532133
- .long 1019483954
- .long 1406131392
- .long 1069148481
- .long 1547359113
- .long 1019786342
- .long 1908875904
- .long 1069213322
- .long 1315508410
- .long 1020009473
- .long 3194947520
- .long 1069278110
- .long 3845393201
- .long 1015803761
- .long 1547487744
- .long 1069342844
- .long 3863107865
- .long 1019810104
- .long 1881061952
- .long 1069407521
- .long 4288343548
- .long 1019687581
- .long 563086336
- .long 1069472140
- .long 2582230241
- .long 1020099350
- .long 2594975552
- .long 1069536698
- .long 2306443764
- .long 1019667244
- .long 3438545024
- .long 1069606573
- .long 957455549
- .long 1015587735
- .long 4211357472
- .long 1069670906
- .long 2611778754
- .long 1017877214
- .long 3002835424
- .long 1069735101
- .long 235580458
- .long 1020211685
- .long 3905315424
- .long 1069799150
- .long 3630647617
- .long 1018736849
- .long 2849656576
- .long 1069863047
- .long 2412165062
- .long 1019693004
- .long 507429472
- .long 1069926785
- .long 1397750723
- .long 1018412717
- .long 2307470272
- .long 1069990356
- .long 1796470904
- .long 1019796181
- .long 1271814912
- .long 1070053755
- .long 189761565
- .long 1016149115
- .long 3800538144
- .long 1070116974
- .long 2524871582
- .long 1018263353
- .long 3916203552
- .long 1070180008
- .long 127848658
- .long 1017672664
- .long 457192032
- .long 1070242851
- .long 4020400938
- .long 1019823010
- .long 1385324704
- .long 1070305495
- .long 564511179
- .long 1016079094
- .long 2322869856
- .long 1070367935
- .long 2347103319
- .long 1018927760
- .long 3743438624
- .long 1070430165
- .long 877973862
- .long 1019638162
- .long 2392255552
- .long 1070492180
- .long 2432782267
- .long 1018872629
- .long 4180443328
- .long 1070553973
- .long 3102990015
- .long 1020093101
- .long 2547540832
- .long 1070636485
- .long 3877738253
- .long 1017300424
- .long 2735468912
- .long 1070697461
- .long 2446470256
- .long 1019235378
- .long 542633792
- .long 1070757943
- .long 583606328
- .long 1018624131
- .long 923265984
- .long 1070817911
- .long 1793926708
- .long 1019714161
- .long 918728448
- .long 1070877348
- .long 3726463586
- .long 1019433296
- .long 2572275008
- .long 1070936237
- .long 1845354238
- .long 1019459238
- .long 50974688
- .long 1070994564
- .long 983808064
- .long 1016685418
- .long 1105518320
- .long 1071052313
- .long 2357496692
- .long 1015139882
- .long 1264825328
- .long 1071109472
- .long 2244129354
- .long 1019046344
- .long 961157920
- .long 1071166029
- .long 3124185339
- .long 1018541776
- .long 1162701584
- .long 1071221973
- .long 1279780948
- .long 1019268918
- .long 3284935664
- .long 1071277294
- .long 2670033472
- .long 1019833744
- .long 497441888
- .long 1071331985
- .long 1032737410
- .long 1019795212
- .long 3377383904
- .long 1071386036
- .long 2356897182
- .long 1020205553
- .long 1126962000
- .long 1071439443
- .long 3723724586
- .long 1015212418
- .long 90291008
- .long 1071492199
- .long 4178672431
- .long 1020186971
- .long 190059536
- .long 1071595741
- .long 1763589807
- .long 1019162163
- .long 2497392840
- .long 1071670654
- .long 3036997041
- .long 1020204325
- .long 2616971944
- .long 1071719773
- .long 300151069
- .long 1017041957
- .long 2883518128
- .long 1071767563
- .long 2203981414
- .long 1019190108
- .long 1496354352
- .long 1071814030
- .long 332287966
- .long 1016846435
- .long 483276728
- .long 1071859184
- .long 653845024
- .long 1018830914
- .long 3097401072
- .long 1071903039
- .long 1514746408
- .long 1019278972
- .long 2737217248
- .long 1071945615
- .long 1358845067
- .long 1017268275
- .long 2072577560
- .long 1071986933
- .long 3041024735
- .long 1019929672
- .long 2266405656
- .long 1072027017
- .long 1271261130
- .long 1012925070
- .long 958652544
- .long 1072065894
- .long 2158017058
- .long 1019955372
- .long 3312993840
- .long 1072103591
- .long 765809169
- .long 1019114443
- .long 3177001304
- .long 1072140139
- .long 144180084
- .long 1019822186
- .long 3071642184
- .long 1072175568
- .long 4004602424
- .long 1019420740
- .long 4283953648
- .long 1072209909
- .long 1511950430
- .long 1020176966
- .long 1413754136
- .long 1072243195
- .long 856972295
- .long 1015129638
- .long 4073202944
- .long 1072306725
- .long 4068194804
- .long 1019714860
- .long 946117760
- .long 1072366415
- .long 694980733
- .long 1020150135
- .long 3980632032
- .long 1072422512
- .long 1313251280
- .long 1019948709
- .long 1468297112
- .long 1072475260
- .long 330111143
- .long 1019809198
- .long 3478063816
- .long 1072524887
- .long 2930067044
- .long 1017784081
- .long 1153979856
- .long 1072571613
- .long 2225786102
- .long 1017634481
- .long 2089828808
- .long 1072615641
- .long 474621367
- .long 1017043414
- .long 3531732632
- .long 1072657163
- .long 2276396220
- .long 1018757240
- .long 775214612
- .long 1072694803
- .long 3209744818
- .long 1019963015
- .long 662307284
- .long 1072713319
- .long 1381696763
- .long 1019763781
- .long 1192776652
- .long 1072730830
- .long 3017932994
- .long 1015179769
- .long 744202396
- .long 1072747407
- .long 2073854034
- .long 1019512292
- .long 8337908
- .long 1072763115
- .long 16004448
- .long 1019599514
- .long 3589868768
- .long 1072778013
- .long 1374369804
- .long 1018019237
- .long 121647320
- .long 1072792159
- .long 128481634
- .long 1018115438
- .long 2464923204
- .long 1072805601
- .long 1787331214
- .long 1016798022
- .long 4093304372
- .long 1072830562
- .long 3306868969
- .long 1019384078
- .long 1436891684
- .long 1072853231
- .long 676347266
- .long 1017302183
- .long 1104571840
- .long 1072873890
- .long 2870400285
- .long 1019938149
- .long 2037009832
- .long 1072892781
- .long 2956702105
- .long 1016472908
- .long 3139037960
- .long 1072910111
- .long 916057147
- .long 1018364335
- .long 1826698064
- .long 1072926058
- .long 2171961098
- .long 1019669816
- .long 1353941060
- .long 1072940774
- .long 1722928782
- .long 1019926215
- .long 1803191644
- .long 1072954391
- .long 1547878639
- .long 1020259262
- .long 1092591296
- .long 1072967024
- .long 3070107923
- .long 1018320401
- .long 2205372832
- .long 1072978772
- .long 787328196
- .long 1014621351
- .long 1291577100
- .long 1072989723
- .long 2964757301
- .long 1020242528
- .long 4234512804
- .long 1072999952
- .long 3136030038
- .long 1017522144
- .long 3248069132
- .long 1073009528
- .long 1506192355
- .long 1018050472
- .long 3932628500
- .long 1073018509
- .long 1045823554
- .long 1019946655
- .long 4195697848
- .long 1073026948
- .long 233443322
- .long 1018917447
- .long 2501811452
- .long 1073034892
- .long 901427976
- .long 1017333852
- .long 866379428
- .long 1073049455
- .long 2437443742
- .long 1019678792
- .long 1376865888
- .long 1073062480
- .long 3365790232
- .long 1014547152
- .long 3290094268
- .long 1073074195
- .long 3898947415
- .long 1018683566
- .long 354764884
- .long 1073084787
- .long 3854322404
- .long 1019662058
- .long 3332975496
- .long 1073094406
- .long 3171701655
- .long 1017830922
- .long 1141460088
- .long 1073103181
- .long 3946082701
- .long 1020032019
- .long 745761284
- .long 1073111216
- .long 1347210591
- .long 1019106121
- .long 1673304508
- .long 1073118600
- .long 1760606642
- .long 1017324577
- .long 983388240
- .long 1073125409
- .long 3740651204
- .long 1019514104
- .long 3895509100
- .long 1073131706
- .long 2409629983
- .long 1020069322
- .long 2128523668
- .long 1073137548
- .long 3045605368
- .long 1018579174
- .long 2075485692
- .long 1073142981
- .long 3720571789
- .long 1017557436
- .long 121855976
- .long 1073148047
- .long 2391744767
- .long 1020160645
- .long 4181733780
- .long 1073152780
- .long 995028816
- .long 1019681295
- .long 2887813280
- .long 1073157214
- .long 218733247
- .long 1020003509
- .long 2862180896
- .long 1073161375
- .long 2043806490
- .long 1018602288
- .long 3909375184
- .long 1073168973
- .long 1559903412
- .long 1020103444
- .long 3533966292
- .long 1073175738
- .long 734884149
- .long 1018462962
- .long 3815044608
- .long 1073181799
- .long 3630523428
- .long 1017250093
- .long 739639376
- .long 1073187261
- .long 4167476661
- .long 1020008277
- .long 1068309648
- .long 1073192207
- .long 2110061437
- .long 1019295858
- .long 2350566352
- .long 1073196707
- .long 582596516
- .long 1018568821
- .long 2529520024
- .long 1073200819
- .long 745552787
- .long 1019053165
- .long 1841667508
- .long 1073204591
- .long 3982568700
- .long 1016503327
- .long 2242261080
- .long 1073208063
- .long 3433582258
- .long 1016196763
- .long 715134328
- .long 1073211270
- .long 355901358
- .long 1020087916
- .long 2700735876
- .long 1073214240
- .long 3640957736
- .long 1019780205
- .long 141607580
- .long 1073217000
- .long 2488245051
- .long 1020262395
- .long 287934404
- .long 1073219570
- .long 2392691085
- .long 1019883292
- .long 2363373988
- .long 1073221969
- .long 4194561737
- .long 1019237447
- .long 3829340424
- .long 1073224214
- .long 429455526
- .long 1019490975
- .long 1988805928
- .long 1073226320
- .long 3029848706
- .long 1018104889
- .long 1647572320
- .long 1073230161
- .long 10289938
- .long 1017394880
- .long 3988000624
- .long 1073233576
- .long 1957559169
- .long 1019434816
- .long 4263843944
- .long 1073236633
- .long 204710264
- .long 1019908761
- .long 663197724
- .long 1073239386
- .long 1921757578
- .long 1019778948
- .long 3560800700
- .long 1073241876
- .long 3994348896
- .long 1019230192
- .long 2441785656
- .long 1073244141
- .long 871468611
- .long 1014800505
- .long 3277400272
- .long 1073246209
- .long 4092218139
- .long 1020040842
- .long 3951990120
- .long 1073248105
- .long 4276546478
- .long 1019763677
- .long 2737338540
- .long 1073249850
- .long 252776012
- .long 1018794951
- .long 1511361316
- .long 1073251461
- .long 3119653999
- .long 1018514803
- .long 3969162516
- .long 1073252952
- .long 1037069016
- .long 1016792900
- .long 413985240
- .long 1073254338
- .long 4110171432
- .long 1020001345
- .long 3681283576
- .long 1073255627
- .long 1463092818
- .long 1020260354
- .long 3146455488
- .long 1073256831
- .long 1031209123
- .long 1016554799
- .long 95214512
- .long 1073257958
- .long 1373808632
- .long 1019493031
- .long 4250240828
- .long 1073259013
- .long 3891047882
- .long 1020108730
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 1016178214
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 1016178214
- .long 1413754136
- .long 1074340347
- .long 856972295
- .long 1017226790
- .long 1413754136
- .long 1072243195
- .long 856972295
- .long 1015129638
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1413754136
- .long 1074340347
- .long 856972295
- .long 1017226790
- .long 1413754136
- .long 3221823995
- .long 856972295
- .long 3164710438
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 856972295
- .long 1017226790
- .long 1413754136
- .long 1074340347
- .long 856972295
- .long 3164710438
- .long 1413754136
- .long 3221823995
- .long 0
- .long 0
- .long 4294967295
- .long 4294967295
- .long 0
- .long 0
- .long 4294967295
- .long 4294967295
- .long 4294967295
- .long 4294967295
- .long 0
- .long 0
- .long 4294967295
- .long 4294967295
- .long 0
- .long 0
- .long 2006262985
- .long 1069310863
- .long 2358449471
- .long 3217342131
- .long 3845454352
- .long 1069952297
- .long 2829679149
- .long 1073771565
- .long 4294967295
- .long 2148532223
- .long 0
- .long 0
- .long 0
- .long 1130364928
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .type static_const_table,@object
- .size static_const_table,3024
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/e_cosh.S b/libm/x86/e_cosh.S
deleted file mode 100644
index 567a9d0..0000000
--- a/libm/x86/e_cosh.S
+++ /dev/null
@@ -1,1349 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// cosh(x)=(exp(x)+exp(-x))/2
-//
-// Let |x|=xH+xL (upper 26 bits, lower 27 bits)
-// log2(e) rounded to 26 bits (high part) plus a double precision low part is
-// L2EH+L2EL (upper 26, lower 53 bits)
-//
-// Let xH*L2EH=k+f+r`, where (k+f)*2^7=int(xH*L2EH*2^7),
-// f=0.b1 b2 ... b7, k integer
-// 2^f is approximated as Tp[f]+Dp[f], and 2^{-f} as Tn[f]+Dn[f]
-// Tp stores higher 53 bits, Dp stores (2^f-Tp[f]) rounded to double precision
-//
-// e^|x|=2^{k+f}*2^r, r=r`+xL*L2EH+|x|*L2EL, |r|<2^{-8}+2^{-14},
-// for |x| in [1/8,3*2^8)
-// e^{-|x|}=2^{-k-f}*2^{-r}
-//
-// e^|x| is approximated as 2^k*Tp+2^k*Tp*c1*r(1+c2*r+..+c5*r^4)+2^k*Dp=
-// =2^k*Tp+2^k*Tp*P15+2^k*Dp
-// e^{-|x|} approximated as 2^{-k}*Tn-2^{-k}*Tn*c1*r(1-c2*r+..+c5*r^4)
-//
-// For |x| in [1/8, 3*2^7), cosh(x) is formed as
-// RN(2^k*Tp+2^{-k}*Tn)+2^k*Tp*P15+2^{-k}*Tn*P`15+2^{-k}*TnL+2^{-k}*Dn+2^k*Dp
-//
-// For |x| in [3*2^7, 3*2^8), (e^|x|)/2 is returned, and
-// the result is checked for overflow.
-//
-// For |x|<1/8, a Taylor polynomial expansion is used (degree 10)
-// (error bound for polynomial expansion is below 0.501 ulp)
-//
-// Special cases:
-// cosh(NaN) = quiet NaN, and raise invalid exception
-// cosh(INF) = that INF
-// cosh(0)=1
-// for finite argument, only cosh(0)=1 is exact
-// For IEEE double
-// cosh(x) overflows
-// for x > 710.47586007394386342639336362481117248535156250 = MAXLOG+log(2)
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin cosh
-ENTRY(cosh)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $104, %esp
- movl %ebx, 40(%esp)
- call static_func
- movl %eax, %ebx
- movsd 112(%esp), %xmm0
- movsd 4240(%ebx), %xmm3
- xorpd %xmm4, %xmm4
- movsd 4192(%ebx), %xmm1
- movsd 4200(%ebx), %xmm2
- movl $32768, %eax
- pinsrw $3, %eax, %xmm4
- movsd 4096(%ebx), %xmm6
- pextrw $3, %xmm0, %ecx
- andpd %xmm0, %xmm3
- andnpd %xmm0, %xmm4
- pshufd $68, %xmm4, %xmm5
- andl $32767, %ecx
- subl $16320, %ecx
- cmpl $200, %ecx
- jae .L_2TAG_PACKET_0.0.2
- subsd %xmm3, %xmm4
- mulsd %xmm1, %xmm3
- mulsd %xmm5, %xmm2
- cvtsd2si %xmm3, %eax
- movapd %xmm3, %xmm7
- addsd %xmm6, %xmm3
- mulsd %xmm4, %xmm1
- xorpd %xmm5, %xmm5
- subsd %xmm6, %xmm3
- movapd 4112(%ebx), %xmm4
- addsd %xmm1, %xmm2
- movapd 4128(%ebx), %xmm6
- subsd %xmm3, %xmm7
- movl $32704, %edx
- pinsrw $3, %edx, %xmm5
- movapd 4144(%ebx), %xmm1
- addsd %xmm7, %xmm2
- movl $127, %edx
- andl %eax, %edx
- addl %edx, %edx
- shrl $3, %eax
- andl $65520, %eax
- addl $16352, %eax
- xorpd %xmm0, %xmm0
- cmpl $184, %ecx
- jae .L_2TAG_PACKET_1.0.2
- pshufd $68, %xmm5, %xmm5
- pinsrw $3, %eax, %xmm0
- pshufd $68, %xmm0, %xmm0
- psubw %xmm0, %xmm5
- mulpd (%ebx,%edx,8), %xmm0
- mulpd 2048(%ebx,%edx,8), %xmm5
- pshufd $68, %xmm2, %xmm3
- movapd 4160(%ebx), %xmm7
- pshufd $68, %xmm2, %xmm2
- mulpd %xmm3, %xmm3
- mulpd %xmm2, %xmm4
- mulpd %xmm2, %xmm6
- mulpd 4176(%ebx), %xmm2
- mulpd %xmm3, %xmm1
- mulpd %xmm3, %xmm7
- mulpd %xmm3, %xmm4
- mulpd %xmm3, %xmm1
- addpd %xmm7, %xmm6
- movapd %xmm0, %xmm7
- addpd %xmm1, %xmm4
- shufpd $0, %xmm5, %xmm7
- addpd %xmm5, %xmm0
- mulpd %xmm7, %xmm2
- addpd %xmm6, %xmm4
- subsd %xmm0, %xmm7
- mulpd %xmm2, %xmm4
- pshufd $238, %xmm0, %xmm6
- addsd %xmm5, %xmm7
- addpd %xmm2, %xmm4
- addsd %xmm6, %xmm7
- pshufd $238, %xmm4, %xmm2
- addsd %xmm7, %xmm2
- addsd %xmm4, %xmm2
- addsd %xmm2, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_0.0.2:
- addl $16320, %ecx
- cmpl $16320, %ecx
- ja .L_2TAG_PACKET_3.0.2
- cmpl $15952, %ecx
- jae .L_2TAG_PACKET_4.0.2
- addsd %xmm2, %xmm6
- movsd 4248(%ebx), %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_1.0.2:
- subl $16352, %eax
- movl %eax, %ecx
- andl $32752, %eax
- shrl $1, %eax
- andl $65520, %eax
- subl %eax, %ecx
- addl $16352, %eax
- pinsrw $3, %eax, %xmm0
- pshufd $68, %xmm0, %xmm0
- mulpd (%ebx,%edx,8), %xmm0
- pshufd $68, %xmm2, %xmm3
- movsd 4160(%ebx), %xmm7
- mulsd %xmm3, %xmm3
- mulsd %xmm2, %xmm4
- mulsd %xmm2, %xmm6
- mulsd 4176(%ebx), %xmm2
- mulsd %xmm3, %xmm1
- mulsd %xmm3, %xmm7
- mulsd %xmm3, %xmm4
- addl $16368, %ecx
- pinsrw $3, %ecx, %xmm5
- mulsd %xmm3, %xmm1
- addsd %xmm7, %xmm6
- addsd %xmm1, %xmm4
- mulsd %xmm0, %xmm2
- addsd %xmm6, %xmm4
- mulsd %xmm2, %xmm4
- pshufd $238, %xmm0, %xmm6
- addsd %xmm6, %xmm4
- addsd %xmm4, %xmm2
- addsd %xmm2, %xmm0
- mulsd %xmm5, %xmm0
- pextrw $3, %xmm0, %eax
- andl $32752, %eax
- movl $64, %edx
- cmpl $32752, %eax
- je .L_2TAG_PACKET_5.0.2
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_4.0.2:
- movapd 4208(%ebx), %xmm1
- mulpd %xmm5, %xmm5
- movapd 4224(%ebx), %xmm2
- xorpd %xmm3, %xmm3
- movapd %xmm5, %xmm0
- mulpd %xmm5, %xmm1
- movsd 4248(%ebx), %xmm6
- mulpd %xmm5, %xmm5
- movl $16352, %eax
- pinsrw $3, %eax, %xmm3
- addpd %xmm2, %xmm1
- mulpd %xmm5, %xmm1
- pshufd $238, %xmm1, %xmm2
- mulsd %xmm1, %xmm5
- mulsd %xmm3, %xmm0
- addsd %xmm5, %xmm2
- addsd %xmm2, %xmm0
- addsd %xmm6, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_3.0.2:
- cmpl $32752, %ecx
- jae .L_2TAG_PACKET_6.0.2
- xorpd %xmm0, %xmm0
- movl $32736, %eax
- pinsrw $3, %eax, %xmm0
- mulsd %xmm0, %xmm0
- movl $64, %edx
-.L_2TAG_PACKET_5.0.2:
- movsd %xmm0, (%esp)
- movsd 112(%esp), %xmm0
- fldl (%esp)
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_6.0.2:
- mulsd %xmm0, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_2.0.2:
- movsd %xmm0, 24(%esp)
- fldl 24(%esp)
-.L_2TAG_PACKET_7.0.2:
- movl 40(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(cosh)
-# -- End cosh
-
-# Start file scope ASM
-ALIAS_SYMBOL(coshl, cosh);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 2851812149
- .long 1072698941
- .long 2595802551
- .long 1016815913
- .long 1048019041
- .long 1072704666
- .long 1398474845
- .long 3161559171
- .long 3899555717
- .long 1072710421
- .long 427280750
- .long 3163595548
- .long 3541402996
- .long 1072716208
- .long 2759177317
- .long 1015903202
- .long 702412510
- .long 1072722027
- .long 3803266087
- .long 3163328991
- .long 410360776
- .long 1072727877
- .long 1269990655
- .long 1013024446
- .long 3402036099
- .long 1072733758
- .long 405889334
- .long 1016154232
- .long 1828292879
- .long 1072739672
- .long 1255956747
- .long 1016636974
- .long 728909815
- .long 1072745618
- .long 383930225
- .long 1016078044
- .long 852742562
- .long 1072751596
- .long 667253586
- .long 1010842135
- .long 2952712987
- .long 1072757606
- .long 3293494651
- .long 3161168877
- .long 3490863953
- .long 1072763649
- .long 960797498
- .long 3163997456
- .long 3228316108
- .long 1072769725
- .long 3010241991
- .long 3159471380
- .long 2930322912
- .long 1072775834
- .long 2599499422
- .long 3163762623
- .long 3366293073
- .long 1072781976
- .long 3119426314
- .long 1015169130
- .long 1014845819
- .long 1072788152
- .long 3117910646
- .long 3162607681
- .long 948735466
- .long 1072794361
- .long 3516338028
- .long 3163623459
- .long 3949972341
- .long 1072800603
- .long 2068408548
- .long 1015962444
- .long 2214878420
- .long 1072806880
- .long 892270087
- .long 3164164998
- .long 828946858
- .long 1072813191
- .long 10642492
- .long 1016988014
- .long 586995997
- .long 1072819536
- .long 41662348
- .long 3163676568
- .long 2288159958
- .long 1072825915
- .long 2169144469
- .long 1015924597
- .long 2440944790
- .long 1072832329
- .long 2492769774
- .long 1015196030
- .long 1853186616
- .long 1072838778
- .long 3066496371
- .long 1016705150
- .long 1337108031
- .long 1072845262
- .long 3203724452
- .long 1015726421
- .long 1709341917
- .long 1072851781
- .long 2571168217
- .long 1015201075
- .long 3790955393
- .long 1072858335
- .long 2352942462
- .long 3164228666
- .long 4112506593
- .long 1072864925
- .long 2947355221
- .long 1015419624
- .long 3504003472
- .long 1072871551
- .long 3594001060
- .long 3158379228
- .long 2799960843
- .long 1072878213
- .long 1423655381
- .long 1016070727
- .long 2839424854
- .long 1072884911
- .long 1171596163
- .long 1014090255
- .long 171030293
- .long 1072891646
- .long 3526460132
- .long 1015477354
- .long 4232894513
- .long 1072898416
- .long 2383938684
- .long 1015717095
- .long 2992903935
- .long 1072905224
- .long 2218154406
- .long 1016276769
- .long 1603444721
- .long 1072912069
- .long 1548633640
- .long 3163249902
- .long 926591435
- .long 1072918951
- .long 3208833762
- .long 3163962090
- .long 1829099622
- .long 1072925870
- .long 1016661181
- .long 3164509581
- .long 887463927
- .long 1072932827
- .long 3596744163
- .long 3161842742
- .long 3272845541
- .long 1072939821
- .long 928852419
- .long 3164536824
- .long 1276261410
- .long 1072946854
- .long 300981948
- .long 1015732745
- .long 78413852
- .long 1072953925
- .long 4183226867
- .long 3164065827
- .long 569847338
- .long 1072961034
- .long 472945272
- .long 3160339305
- .long 3645941911
- .long 1072968181
- .long 3814685081
- .long 3162621917
- .long 1617004845
- .long 1072975368
- .long 82804944
- .long 1011391354
- .long 3978100823
- .long 1072982593
- .long 3513027190
- .long 1016894539
- .long 3049340112
- .long 1072989858
- .long 3062915824
- .long 1014219171
- .long 4040676318
- .long 1072997162
- .long 4090609238
- .long 1016712034
- .long 3577096743
- .long 1073004506
- .long 2951496418
- .long 1014842263
- .long 2583551245
- .long 1073011890
- .long 3161094195
- .long 1016655067
- .long 1990012071
- .long 1073019314
- .long 3529070563
- .long 3163861769
- .long 2731501122
- .long 1073026778
- .long 1774031855
- .long 3163518597
- .long 1453150082
- .long 1073034283
- .long 498154669
- .long 3162536638
- .long 3395129871
- .long 1073041828
- .long 4025345435
- .long 3163383964
- .long 917841882
- .long 1073049415
- .long 18715565
- .long 1016707884
- .long 3566716925
- .long 1073057042
- .long 1536826856
- .long 1015191009
- .long 3712504873
- .long 1073064711
- .long 88491949
- .long 1016476236
- .long 2321106615
- .long 1073072422
- .long 2171176610
- .long 1010584347
- .long 363667784
- .long 1073080175
- .long 813753950
- .long 1016833785
- .long 3111574537
- .long 1073087969
- .long 2606161479
- .long 3163808322
- .long 2956612997
- .long 1073095806
- .long 2118169751
- .long 3163784129
- .long 885834528
- .long 1073103686
- .long 1973258547
- .long 3163310140
- .long 2186617381
- .long 1073111608
- .long 2270764084
- .long 3164321289
- .long 3561793907
- .long 1073119573
- .long 1157054053
- .long 1012938926
- .long 1719614413
- .long 1073127582
- .long 330458198
- .long 3164331316
- .long 1963711167
- .long 1073135634
- .long 1744767757
- .long 3161622870
- .long 1013258799
- .long 1073143730
- .long 1748797611
- .long 3161177658
- .long 4182873220
- .long 1073151869
- .long 629542646
- .long 3163044879
- .long 3907805044
- .long 1073160053
- .long 2257091225
- .long 3162598983
- .long 1218806132
- .long 1073168282
- .long 1818613052
- .long 3163597017
- .long 1447192521
- .long 1073176555
- .long 1462857171
- .long 3163563097
- .long 1339972927
- .long 1073184873
- .long 167908909
- .long 1016620728
- .long 1944781191
- .long 1073193236
- .long 3993278767
- .long 3162772855
- .long 19972402
- .long 1073201645
- .long 3507899862
- .long 1017057868
- .long 919555682
- .long 1073210099
- .long 3121969534
- .long 1013996802
- .long 1413356050
- .long 1073218599
- .long 1651349291
- .long 3163716742
- .long 2571947539
- .long 1073227145
- .long 3558159064
- .long 3164425245
- .long 1176749997
- .long 1073235738
- .long 2738998779
- .long 3163084420
- .long 2604962541
- .long 1073244377
- .long 2614425274
- .long 3164587768
- .long 3649726105
- .long 1073253063
- .long 4085036346
- .long 1016698050
- .long 1110089947
- .long 1073261797
- .long 1451641639
- .long 1016523249
- .long 380978316
- .long 1073270578
- .long 854188970
- .long 3161511262
- .long 2568320822
- .long 1073279406
- .long 2732824428
- .long 1015401491
- .long 194117574
- .long 1073288283
- .long 777528612
- .long 3164460665
- .long 2966275557
- .long 1073297207
- .long 2176155324
- .long 3160891335
- .long 3418903055
- .long 1073306180
- .long 2527457337
- .long 3161869180
- .long 2682146384
- .long 1073315202
- .long 2082178513
- .long 3164411995
- .long 1892288442
- .long 1073324273
- .long 2446255666
- .long 3163648957
- .long 2191782032
- .long 1073333393
- .long 2960257726
- .long 1014791238
- .long 434316067
- .long 1073342563
- .long 2028358766
- .long 1014506698
- .long 2069751141
- .long 1073351782
- .long 1562170675
- .long 3163773257
- .long 3964284211
- .long 1073361051
- .long 2111583915
- .long 1016475740
- .long 2990417245
- .long 1073370371
- .long 3683467745
- .long 3164417902
- .long 321958744
- .long 1073379742
- .long 3401933767
- .long 1016843134
- .long 1434058175
- .long 1073389163
- .long 251133233
- .long 1016134345
- .long 3218338682
- .long 1073398635
- .long 3404164304
- .long 3163525684
- .long 2572866477
- .long 1073408159
- .long 878562433
- .long 1016570317
- .long 697153126
- .long 1073417735
- .long 1283515429
- .long 3164331765
- .long 3092190715
- .long 1073427362
- .long 814012168
- .long 3160571998
- .long 2380618042
- .long 1073437042
- .long 3149557219
- .long 3164369375
- .long 4076559943
- .long 1073446774
- .long 2119478331
- .long 3161806927
- .long 815859274
- .long 1073456560
- .long 240396590
- .long 3164536019
- .long 2420883922
- .long 1073466398
- .long 2049810052
- .long 1015168464
- .long 1540824585
- .long 1073476290
- .long 1064017011
- .long 3164536266
- .long 3716502172
- .long 1073486235
- .long 2303740125
- .long 1015091301
- .long 1610600570
- .long 1073496235
- .long 3766732298
- .long 1016808759
- .long 777507147
- .long 1073506289
- .long 4282924205
- .long 1016236109
- .long 2483480501
- .long 1073516397
- .long 1216371780
- .long 1014082748
- .long 3706687593
- .long 1073526560
- .long 3521726940
- .long 1014301643
- .long 1432208378
- .long 1073536779
- .long 1401068914
- .long 3163412539
- .long 1242007932
- .long 1073547053
- .long 1132034716
- .long 3164388407
- .long 135105010
- .long 1073557383
- .long 1906148728
- .long 3164424315
- .long 3707479175
- .long 1073567768
- .long 3613079303
- .long 1015213314
- .long 382305176
- .long 1073578211
- .long 2347622376
- .long 3163627201
- .long 64696965
- .long 1073588710
- .long 1768797490
- .long 1016865536
- .long 4076975200
- .long 1073599265
- .long 2029000899
- .long 1016257111
- .long 863738719
- .long 1073609879
- .long 1326992220
- .long 3163661773
- .long 351641897
- .long 1073620550
- .long 2172261526
- .long 3164059175
- .long 3884662774
- .long 1073631278
- .long 2158611599
- .long 1015258761
- .long 4224142467
- .long 1073642065
- .long 3389820386
- .long 1016255778
- .long 2728693978
- .long 1073652911
- .long 396109971
- .long 3164511267
- .long 764307441
- .long 1073663816
- .long 3021057420
- .long 3164378099
- .long 3999357479
- .long 1073674779
- .long 2258941616
- .long 1016973300
- .long 929806999
- .long 1073685803
- .long 3205336643
- .long 1016308133
- .long 1533953344
- .long 1073696886
- .long 769171851
- .long 1016714209
- .long 2912730644
- .long 1073708029
- .long 3490067722
- .long 3164453650
- .long 2174652632
- .long 1073719233
- .long 4087714590
- .long 1015498835
- .long 730821105
- .long 1073730498
- .long 2523232743
- .long 1013115764
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 730821105
- .long 1072681922
- .long 2523232743
- .long 1012067188
- .long 2174652632
- .long 1072670657
- .long 4087714590
- .long 1014450259
- .long 2912730644
- .long 1072659453
- .long 3490067722
- .long 3163405074
- .long 1533953344
- .long 1072648310
- .long 769171851
- .long 1015665633
- .long 929806999
- .long 1072637227
- .long 3205336643
- .long 1015259557
- .long 3999357479
- .long 1072626203
- .long 2258941616
- .long 1015924724
- .long 764307441
- .long 1072615240
- .long 3021057420
- .long 3163329523
- .long 2728693978
- .long 1072604335
- .long 396109971
- .long 3163462691
- .long 4224142467
- .long 1072593489
- .long 3389820386
- .long 1015207202
- .long 3884662774
- .long 1072582702
- .long 2158611599
- .long 1014210185
- .long 351641897
- .long 1072571974
- .long 2172261526
- .long 3163010599
- .long 863738719
- .long 1072561303
- .long 1326992220
- .long 3162613197
- .long 4076975200
- .long 1072550689
- .long 2029000899
- .long 1015208535
- .long 64696965
- .long 1072540134
- .long 1768797490
- .long 1015816960
- .long 382305176
- .long 1072529635
- .long 2347622376
- .long 3162578625
- .long 3707479175
- .long 1072519192
- .long 3613079303
- .long 1014164738
- .long 135105010
- .long 1072508807
- .long 1906148728
- .long 3163375739
- .long 1242007932
- .long 1072498477
- .long 1132034716
- .long 3163339831
- .long 1432208378
- .long 1072488203
- .long 1401068914
- .long 3162363963
- .long 3706687593
- .long 1072477984
- .long 3521726940
- .long 1013253067
- .long 2483480501
- .long 1072467821
- .long 1216371780
- .long 1013034172
- .long 777507147
- .long 1072457713
- .long 4282924205
- .long 1015187533
- .long 1610600570
- .long 1072447659
- .long 3766732298
- .long 1015760183
- .long 3716502172
- .long 1072437659
- .long 2303740125
- .long 1014042725
- .long 1540824585
- .long 1072427714
- .long 1064017011
- .long 3163487690
- .long 2420883922
- .long 1072417822
- .long 2049810052
- .long 1014119888
- .long 815859274
- .long 1072407984
- .long 240396590
- .long 3163487443
- .long 4076559943
- .long 1072398198
- .long 2119478331
- .long 3160758351
- .long 2380618042
- .long 1072388466
- .long 3149557219
- .long 3163320799
- .long 3092190715
- .long 1072378786
- .long 814012168
- .long 3159523422
- .long 697153126
- .long 1072369159
- .long 1283515429
- .long 3163283189
- .long 2572866477
- .long 1072359583
- .long 878562433
- .long 1015521741
- .long 3218338682
- .long 1072350059
- .long 3404164304
- .long 3162477108
- .long 1434058175
- .long 1072340587
- .long 251133233
- .long 1015085769
- .long 321958744
- .long 1072331166
- .long 3401933767
- .long 1015794558
- .long 2990417245
- .long 1072321795
- .long 3683467745
- .long 3163369326
- .long 3964284211
- .long 1072312475
- .long 2111583915
- .long 1015427164
- .long 2069751141
- .long 1072303206
- .long 1562170675
- .long 3162724681
- .long 434316067
- .long 1072293987
- .long 2028358766
- .long 1013458122
- .long 2191782032
- .long 1072284817
- .long 2960257726
- .long 1013742662
- .long 1892288442
- .long 1072275697
- .long 2446255666
- .long 3162600381
- .long 2682146384
- .long 1072266626
- .long 2082178513
- .long 3163363419
- .long 3418903055
- .long 1072257604
- .long 2527457337
- .long 3160820604
- .long 2966275557
- .long 1072248631
- .long 2176155324
- .long 3159842759
- .long 194117574
- .long 1072239707
- .long 777528612
- .long 3163412089
- .long 2568320822
- .long 1072230830
- .long 2732824428
- .long 1014352915
- .long 380978316
- .long 1072222002
- .long 854188970
- .long 3160462686
- .long 1110089947
- .long 1072213221
- .long 1451641639
- .long 1015474673
- .long 3649726105
- .long 1072204487
- .long 4085036346
- .long 1015649474
- .long 2604962541
- .long 1072195801
- .long 2614425274
- .long 3163539192
- .long 1176749997
- .long 1072187162
- .long 2738998779
- .long 3162035844
- .long 2571947539
- .long 1072178569
- .long 3558159064
- .long 3163376669
- .long 1413356050
- .long 1072170023
- .long 1651349291
- .long 3162668166
- .long 919555682
- .long 1072161523
- .long 3121969534
- .long 1012948226
- .long 19972402
- .long 1072153069
- .long 3507899862
- .long 1016009292
- .long 1944781191
- .long 1072144660
- .long 3993278767
- .long 3161724279
- .long 1339972927
- .long 1072136297
- .long 167908909
- .long 1015572152
- .long 1447192521
- .long 1072127979
- .long 1462857171
- .long 3162514521
- .long 1218806132
- .long 1072119706
- .long 1818613052
- .long 3162548441
- .long 3907805044
- .long 1072111477
- .long 2257091225
- .long 3161550407
- .long 4182873220
- .long 1072103293
- .long 629542646
- .long 3161996303
- .long 1013258799
- .long 1072095154
- .long 1748797611
- .long 3160129082
- .long 1963711167
- .long 1072087058
- .long 1744767757
- .long 3160574294
- .long 1719614413
- .long 1072079006
- .long 330458198
- .long 3163282740
- .long 3561793907
- .long 1072070997
- .long 1157054053
- .long 1011890350
- .long 2186617381
- .long 1072063032
- .long 2270764084
- .long 3163272713
- .long 885834528
- .long 1072055110
- .long 1973258547
- .long 3162261564
- .long 2956612997
- .long 1072047230
- .long 2118169751
- .long 3162735553
- .long 3111574537
- .long 1072039393
- .long 2606161479
- .long 3162759746
- .long 363667784
- .long 1072031599
- .long 813753950
- .long 1015785209
- .long 2321106615
- .long 1072023846
- .long 2171176610
- .long 1009535771
- .long 3712504873
- .long 1072016135
- .long 88491949
- .long 1015427660
- .long 3566716925
- .long 1072008466
- .long 1536826856
- .long 1014142433
- .long 917841882
- .long 1072000839
- .long 18715565
- .long 1015659308
- .long 3395129871
- .long 1071993252
- .long 4025345435
- .long 3162335388
- .long 1453150082
- .long 1071985707
- .long 498154669
- .long 3161488062
- .long 2731501122
- .long 1071978202
- .long 1774031855
- .long 3162470021
- .long 1990012071
- .long 1071970738
- .long 3529070563
- .long 3162813193
- .long 2583551245
- .long 1071963314
- .long 3161094195
- .long 1015606491
- .long 3577096743
- .long 1071955930
- .long 2951496418
- .long 1013793687
- .long 4040676318
- .long 1071948586
- .long 4090609238
- .long 1015663458
- .long 3049340112
- .long 1071941282
- .long 3062915824
- .long 1013170595
- .long 3978100823
- .long 1071934017
- .long 3513027190
- .long 1015845963
- .long 1617004845
- .long 1071926792
- .long 82804944
- .long 1010342778
- .long 3645941911
- .long 1071919605
- .long 3814685081
- .long 3161573341
- .long 569847338
- .long 1071912458
- .long 472945272
- .long 3159290729
- .long 78413852
- .long 1071905349
- .long 4183226867
- .long 3163017251
- .long 1276261410
- .long 1071898278
- .long 300981948
- .long 1014684169
- .long 3272845541
- .long 1071891245
- .long 928852419
- .long 3163488248
- .long 887463927
- .long 1071884251
- .long 3596744163
- .long 3160794166
- .long 1829099622
- .long 1071877294
- .long 1016661181
- .long 3163461005
- .long 926591435
- .long 1071870375
- .long 3208833762
- .long 3162913514
- .long 1603444721
- .long 1071863493
- .long 1548633640
- .long 3162201326
- .long 2992903935
- .long 1071856648
- .long 2218154406
- .long 1015228193
- .long 4232894513
- .long 1071849840
- .long 2383938684
- .long 1014668519
- .long 171030293
- .long 1071843070
- .long 3526460132
- .long 1014428778
- .long 2839424854
- .long 1071836335
- .long 1171596163
- .long 1013041679
- .long 2799960843
- .long 1071829637
- .long 1423655381
- .long 1015022151
- .long 3504003472
- .long 1071822975
- .long 3594001060
- .long 3157330652
- .long 4112506593
- .long 1071816349
- .long 2947355221
- .long 1014371048
- .long 3790955393
- .long 1071809759
- .long 2352942462
- .long 3163180090
- .long 1709341917
- .long 1071803205
- .long 2571168217
- .long 1014152499
- .long 1337108031
- .long 1071796686
- .long 3203724452
- .long 1014677845
- .long 1853186616
- .long 1071790202
- .long 3066496371
- .long 1015656574
- .long 2440944790
- .long 1071783753
- .long 2492769774
- .long 1014147454
- .long 2288159958
- .long 1071777339
- .long 2169144469
- .long 1014876021
- .long 586995997
- .long 1071770960
- .long 41662348
- .long 3162627992
- .long 828946858
- .long 1071764615
- .long 10642492
- .long 1015939438
- .long 2214878420
- .long 1071758304
- .long 892270087
- .long 3163116422
- .long 3949972341
- .long 1071752027
- .long 2068408548
- .long 1014913868
- .long 948735466
- .long 1071745785
- .long 3516338028
- .long 3162574883
- .long 1014845819
- .long 1071739576
- .long 3117910646
- .long 3161559105
- .long 3366293073
- .long 1071733400
- .long 3119426314
- .long 1014120554
- .long 2930322912
- .long 1071727258
- .long 2599499422
- .long 3162714047
- .long 3228316108
- .long 1071721149
- .long 3010241991
- .long 3158422804
- .long 3490863953
- .long 1071715073
- .long 960797498
- .long 3162948880
- .long 2952712987
- .long 1071709030
- .long 3293494651
- .long 3160120301
- .long 852742562
- .long 1071703020
- .long 667253586
- .long 1009793559
- .long 728909815
- .long 1071697042
- .long 383930225
- .long 1015029468
- .long 1828292879
- .long 1071691096
- .long 1255956747
- .long 1015588398
- .long 3402036099
- .long 1071685182
- .long 405889334
- .long 1015105656
- .long 410360776
- .long 1071679301
- .long 1269990655
- .long 1011975870
- .long 702412510
- .long 1071673451
- .long 3803266087
- .long 3162280415
- .long 3541402996
- .long 1071667632
- .long 2759177317
- .long 1014854626
- .long 3899555717
- .long 1071661845
- .long 427280750
- .long 3162546972
- .long 1048019041
- .long 1071656090
- .long 1398474845
- .long 3160510595
- .long 2851812149
- .long 1071650365
- .long 2595802551
- .long 1015767337
- .long 0
- .long 1127743488
- .long 0
- .long 3275227136
- .long 3607404736
- .long 1044146952
- .long 3607404736
- .long 3191630600
- .long 4277811695
- .long 1063661122
- .long 4277811695
- .long 3211144770
- .long 2140175755
- .long 1033864261
- .long 2140175755
- .long 1033864261
- .long 4289495988
- .long 1054113747
- .long 4289495988
- .long 1054113747
- .long 4277811695
- .long 1064709698
- .long 4277811695
- .long 3212193346
- .long 1610612736
- .long 1080497479
- .long 4166901572
- .long 1053077003
- .long 3078135644
- .long 1049787983
- .long 381774870
- .long 1062650220
- .long 436314137
- .long 1056571808
- .long 1431655765
- .long 1067799893
- .long 4160749568
- .long 2147483647
- .long 0
- .long 1072693248
- .type static_const_table,@object
- .size static_const_table,4256
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/e_hypot.S b/libm/x86/e_hypot.S
deleted file mode 100644
index 8422024..0000000
--- a/libm/x86/e_hypot.S
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// X87 version:
-// Use 80-bit FPU precision fmul, fsqrt to compute square and sqrt.
-//
-// SSE version:
-// Swap x, y if |x|<|y|
-// For x=2^k*x, get y=y*2^(-k)
-// Get S ~ sqrt(x^2+y^2) (leading 1 + leading 25 mantissa bits)
-//
-// Get D = ( RN(x^2+y^2) - S^2 ) + ( x^2 - RN(x^2) ) +
-// + ( y^2 - ((RN(x^2+y^2)-RN(x^2)) )
-//
-// Result is 2^k*(S + Se), where Se = S*e
-// S*e is approximated as (D/2S)*( 1 - (D/2S)^2*1.0/S )
-//
-// Return 2^k*(S+Se)
-//
-// For |y/x|<2^(-64), return x
-//
-// For cases where maximum biased exponent is either greater than 7fdh or
-// below 32, take a special path to check for special cases (0, NaN, Inf),
-// possible overflow, and more accurate computation for denormal results
-//
-// Special cases:
-// hypot(x,y), hypot(y,x), and hypot(x,-y) are equivalent
-// hypot(x,+-0) is equivalent to fabs(x)
-// hypot(x,y) = y if (x==NaN or x==INF) and y==INF
-// hypot(x,y) = x if (x==NaN or x==INF) and y!=INF (even if y==NaN!)
-// hypot(x,y) = y if (x!=NaN and x!=INF) and (y==NaN or y==INF)
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin hypot
-ENTRY(hypot)
-# parameter 1: 8 + %ebp
-# parameter 2: 16 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $152, %esp
- movl %ebx, 96(%esp)
- call static_func
- movl %eax, %ebx
- movapd (%ebx), %xmm3
- movsd 160(%esp), %xmm0
- movsd 168(%esp), %xmm1
- andpd %xmm3, %xmm0
- andpd %xmm3, %xmm1
- pextrw $3, %xmm0, %eax
- pextrw $3, %xmm1, %edx
- cmpl $24528, %eax
- ja .L_2TAG_PACKET_0.0.2
- cmpl $24528, %edx
- ja .L_2TAG_PACKET_0.0.2
-.L_2TAG_PACKET_1.0.2:
- fldl 160(%esp)
- fldl 168(%esp)
- fxch %st(1)
- fmul %st(0), %st
- fxch %st(1)
- nop
- fmul %st(0), %st
- faddp %st, %st(1)
- fsqrt
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_0.0.2:
- cmpl $32752, %eax
- movl %eax, %ecx
- jae .L_2TAG_PACKET_3.0.2
- subl %edx, %ecx
- cmpl $32752, %edx
- jae .L_2TAG_PACKET_3.0.2
- addl $928, %ecx
- addl %edx, %eax
- cmpl $1856, %ecx
- ja .L_2TAG_PACKET_4.0.2
- cmpl $49056, %eax
- jb .L_2TAG_PACKET_1.0.2
- fldl 160(%esp)
- fldl 168(%esp)
- fxch %st(1)
- fmul %st(0), %st
- fxch %st(1)
- nop
- fmul %st(0), %st
- faddp %st, %st(1)
- fsqrt
-.L_2TAG_PACKET_5.0.2:
- fstl (%esp)
- fstpt 16(%esp)
- xorl %eax, %eax
- movw 24(%esp), %ax
- cmpl $17407, %eax
- jae .L_2TAG_PACKET_6.0.2
- fldl (%esp)
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_4.0.2:
- movsd %xmm0, 32(%esp)
- movsd %xmm1, 40(%esp)
- fldl 32(%esp)
- faddl 40(%esp)
- jmp .L_2TAG_PACKET_5.0.2
-.L_2TAG_PACKET_6.0.2:
- movl $46, %edx
-.L_2TAG_PACKET_8.0.2:
- movsd 160(%esp), %xmm0
- movsd 168(%esp), %xmm1
- fldl (%esp)
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_3.0.2:
- shufpd $0, %xmm1, %xmm0
- movdqa %xmm0, %xmm2
- movdqa 16(%ebx), %xmm3
- movsd %xmm0, 32(%esp)
- movsd %xmm1, 40(%esp)
- cmppd $3, %xmm0, %xmm2
- cmppd $0, %xmm0, %xmm3
- movmskpd %xmm2, %edx
- movmskpd %xmm3, %eax
- testl %edx, %edx
- je .L_2TAG_PACKET_9.0.2
- fldl 32(%esp)
- fmull 40(%esp)
- testl $1, %eax
- jne .L_2TAG_PACKET_10.0.2
- testl $2, %eax
- jne .L_2TAG_PACKET_11.0.2
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_9.0.2:
- fldl 32(%esp)
- faddl 40(%esp)
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_10.0.2:
- fstpl 40(%esp)
- fldl 32(%esp)
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_11.0.2:
- fstpl 32(%esp)
- fldl 40(%esp)
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_2.0.2:
-.L_2TAG_PACKET_7.0.2:
- movl 96(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(hypot)
-# -- End hypot
-
-# Start file scope ASM
-ALIAS_SYMBOL(hypotl, hypot);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 4294967295
- .long 2147483647
- .long 4294967295
- .long 2147483647
- .long 0
- .long 2146435072
- .long 0
- .long 2146435072
- .type static_const_table,@object
- .size static_const_table,32
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/e_log10.S b/libm/x86/e_log10.S
deleted file mode 100644
index 473cea3..0000000
--- a/libm/x86/e_log10.S
+++ /dev/null
@@ -1,795 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Let x=2^k * mx, mx in [1,2)
-//
-// Get B~1/mx based on the output of rcpss instruction (B0)
-// B = int((B0*LH*2^7+0.5))/2^7
-// LH is a short approximation for log10(e)
-//
-// Reduced argument: r=B*mx-LH (computed accurately in high and low parts)
-//
-// Result: k*log10(2) - log(B) + p(r)
-// p(r) is a degree 7 polynomial
-// -log(B) read from data table (high, low parts)
-// Result is formed from high and low parts
-//
-// Special cases:
-// log10(0) = -INF with divide-by-zero exception raised
-// log10(1) = +0
-// log10(x) = NaN with invalid exception raised if x < -0, including -INF
-// log10(+INF) = +INF
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin log10
-ENTRY(log10)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $104, %esp
- movl %ebx, 40(%esp)
- call static_func
- movl %eax, %ebx
- xorpd %xmm2, %xmm2
- movl $16368, %eax
- pinsrw $3, %eax, %xmm2
- movl $1054736384, %ecx
- movd %ecx, %xmm7
- xorpd %xmm3, %xmm3
- movl $30704, %edx
- pinsrw $3, %edx, %xmm3
- movsd 112(%esp), %xmm0
- movapd %xmm0, %xmm1
- movl $32768, %edx
- movd %edx, %xmm4
- movapd 2128(%ebx), %xmm5
- pextrw $3, %xmm0, %eax
- orpd %xmm2, %xmm0
- movl $16352, %ecx
- psllq $5, %xmm0
- movsd 2144(%ebx), %xmm2
- psrlq $34, %xmm0
- rcpss %xmm0, %xmm0
- psllq $12, %xmm1
- pshufd $78, %xmm5, %xmm6
- psrlq $12, %xmm1
- subl $16, %eax
- cmpl $32736, %eax
- jae .L_2TAG_PACKET_0.0.2
-.L_2TAG_PACKET_1.0.2:
- mulss %xmm7, %xmm0
- orpd %xmm3, %xmm1
- andpd %xmm1, %xmm5
- paddd %xmm4, %xmm0
- subsd %xmm5, %xmm1
- movd %xmm0, %edx
- psllq $29, %xmm0
- andpd %xmm6, %xmm0
- andl $32752, %eax
- subl %ecx, %eax
- cvtsi2sdl %eax, %xmm7
- mulpd %xmm0, %xmm5
- mulsd %xmm0, %xmm1
- movsd 2064(%ebx), %xmm6
- movapd 2080(%ebx), %xmm3
- subsd %xmm2, %xmm5
- andl $16711680, %edx
- shrl $12, %edx
- movapd -1504(%ebx,%edx), %xmm0
- movapd 2096(%ebx), %xmm4
- addsd %xmm5, %xmm1
- movapd 2112(%ebx), %xmm2
- mulsd %xmm7, %xmm6
- pshufd $68, %xmm1, %xmm5
- mulsd 2072(%ebx), %xmm7
- mulsd %xmm1, %xmm3
- addsd %xmm6, %xmm0
- mulpd %xmm5, %xmm4
- movsd 2152(%ebx), %xmm6
- mulpd %xmm5, %xmm5
- addpd %xmm2, %xmm4
- mulpd %xmm5, %xmm3
- pshufd $228, %xmm0, %xmm2
- addsd %xmm1, %xmm0
- mulsd %xmm1, %xmm4
- subsd %xmm0, %xmm2
- mulsd %xmm1, %xmm6
- addsd %xmm2, %xmm1
- pshufd $238, %xmm0, %xmm2
- mulsd %xmm5, %xmm5
- addsd %xmm2, %xmm7
- addsd %xmm6, %xmm1
- addpd %xmm3, %xmm4
- addsd %xmm7, %xmm1
- mulpd %xmm5, %xmm4
- addsd %xmm4, %xmm1
- pshufd $238, %xmm4, %xmm5
- addsd %xmm5, %xmm1
- addsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_0.0.2:
- movsd 112(%esp), %xmm0
- movapd %xmm0, %xmm1
- addl $16, %eax
- cmpl $32768, %eax
- jae .L_2TAG_PACKET_3.0.2
- cmpl $16, %eax
- jb .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_5.0.2:
- addsd %xmm0, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_6.0.2:
- ja .L_2TAG_PACKET_5.0.2
- cmpl $0, %edx
- ja .L_2TAG_PACKET_5.0.2
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_3.0.2:
- movd %xmm1, %edx
- psrlq $32, %xmm1
- movd %xmm1, %ecx
- addl %ecx, %ecx
- cmpl $-2097152, %ecx
- jae .L_2TAG_PACKET_6.0.2
- orl %ecx, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_8.0.2
-.L_2TAG_PACKET_7.0.2:
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $32752, %eax
- pinsrw $3, %eax, %xmm1
- movl $9, %edx
- mulsd %xmm1, %xmm0
-.L_2TAG_PACKET_9.0.2:
- movsd %xmm0, (%esp)
- movsd 112(%esp), %xmm0
- fldl (%esp)
- jmp .L_2TAG_PACKET_10.0.2
-.L_2TAG_PACKET_8.0.2:
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $49136, %eax
- pinsrw $3, %eax, %xmm0
- divsd %xmm1, %xmm0
- movl $8, %edx
- jmp .L_2TAG_PACKET_9.0.2
-.L_2TAG_PACKET_4.0.2:
- movd %xmm1, %edx
- psrlq $32, %xmm1
- movd %xmm1, %ecx
- orl %ecx, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_8.0.2
- xorpd %xmm1, %xmm1
- movl $18416, %eax
- pinsrw $3, %eax, %xmm1
- mulsd %xmm1, %xmm0
- xorpd %xmm2, %xmm2
- movl $16368, %eax
- pinsrw $3, %eax, %xmm2
- movapd %xmm0, %xmm1
- pextrw $3, %xmm0, %eax
- orpd %xmm2, %xmm0
- movl $18416, %ecx
- psllq $5, %xmm0
- movsd 2144(%ebx), %xmm2
- psrlq $34, %xmm0
- rcpss %xmm0, %xmm0
- psllq $12, %xmm1
- pshufd $78, %xmm5, %xmm6
- psrlq $12, %xmm1
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- movsd %xmm0, 24(%esp)
- fldl 24(%esp)
-.L_2TAG_PACKET_10.0.2:
- movl 40(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(log10)
-# -- End log10
-
-# Start file scope ASM
-ALIAS_SYMBOL(log10l, log10);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 1352628224
- .long 1070810131
- .long 521319256
- .long 1025503025
- .long 2150839296
- .long 1070801944
- .long 3329350096
- .long 3170190015
- .long 1360613376
- .long 1070793794
- .long 2024059075
- .long 1024991594
- .long 1875350528
- .long 1070785680
- .long 2163882141
- .long 3163564137
- .long 2312126464
- .long 1070777602
- .long 1975711076
- .long 1023674196
- .long 1306336256
- .long 1070769560
- .long 3524899523
- .long 3170508164
- .long 1806334976
- .long 1070761553
- .long 4254777025
- .long 1025238739
- .long 2483193856
- .long 1070753581
- .long 3800671317
- .long 3172916830
- .long 2025350144
- .long 1070745644
- .long 1731514745
- .long 1025501083
- .long 3433285632
- .long 1070737741
- .long 2551857336
- .long 3169662186
- .long 1134317568
- .long 1070729873
- .long 3426297655
- .long 3172637891
- .long 2457152512
- .long 1070722038
- .long 63549415
- .long 1025415416
- .long 1861803008
- .long 1070714237
- .long 1910171636
- .long 1023977580
- .long 2414140416
- .long 1070706469
- .long 4002514337
- .long 3170841618
- .long 2900726784
- .long 1070698734
- .long 3268064083
- .long 1022459609
- .long 2123517952
- .long 1070691032
- .long 1767031218
- .long 1022448156
- .long 3194569728
- .long 1070683362
- .long 3402332618
- .long 3171671160
- .long 650882048
- .long 1070675725
- .long 4146023905
- .long 3171023038
- .long 1928988672
- .long 1070668119
- .long 1438617867
- .long 1016360491
- .long 1594908672
- .long 1070660545
- .long 971389377
- .long 1024763979
- .long 2818746368
- .long 1070653002
- .long 3555925341
- .long 3172434821
- .long 194584576
- .long 1070645491
- .long 943919215
- .long 3172950063
- .long 1215096832
- .long 1070638010
- .long 2283358588
- .long 1022335098
- .long 501519360
- .long 1070630560
- .long 480904295
- .long 1024437959
- .long 1278266368
- .long 1070623140
- .long 2755806066
- .long 3172342012
- .long 2487812096
- .long 1070615750
- .long 2489653202
- .long 3172481099
- .long 3085451264
- .long 1070608390
- .long 3759184951
- .long 3172574892
- .long 2039090176
- .long 1070601060
- .long 1361176676
- .long 3172355319
- .long 953057280
- .long 1070591423
- .long 1176587546
- .long 3166422018
- .long 3370524672
- .long 1070576879
- .long 3669570051
- .long 1025376630
- .long 749742080
- .long 1070562394
- .long 707700964
- .long 3170814058
- .long 4008353792
- .long 1070547965
- .long 3247327652
- .long 1022431400
- .long 2612455424
- .long 1070533594
- .long 2453457344
- .long 3172322969
- .long 3230920704
- .long 1070519279
- .long 1296781801
- .long 1025115335
- .long 3965253632
- .long 1070505020
- .long 373075289
- .long 1017938528
- .long 2593157120
- .long 1070476669
- .long 1068054086
- .long 1021616576
- .long 925962240
- .long 1070448537
- .long 850121213
- .long 1023928989
- .long 1732556800
- .long 1070420620
- .long 1305206740
- .long 3172665570
- .long 3815630848
- .long 1070392915
- .long 192642943
- .long 3172699907
- .long 2001758208
- .long 1070365420
- .long 2820786683
- .long 1024704867
- .long 16746496
- .long 1070338131
- .long 1399573110
- .long 3171372773
- .long 1886492672
- .long 1070311044
- .long 3621428075
- .long 3172974358
- .long 3338196992
- .long 1070284157
- .long 3793882035
- .long 1025124701
- .long 381769728
- .long 1070257468
- .long 3877933342
- .long 3170195490
- .long 2186491904
- .long 1070230972
- .long 1838687089
- .long 1017927292
- .long 1008330752
- .long 1070204668
- .long 2228321664
- .long 1025352196
- .long 2247065600
- .long 1070178552
- .long 1413900906
- .long 3170902532
- .long 2964070400
- .long 1070152622
- .long 3590454629
- .long 1025016844
- .long 465154048
- .long 1070126876
- .long 2079688550
- .long 3172268183
- .long 883615744
- .long 1070101310
- .long 989244452
- .long 3171900485
- .long 1993768960
- .long 1070075922
- .long 1124327841
- .long 3172964992
- .long 1794471936
- .long 1070050710
- .long 1140575046
- .long 1022673726
- .long 2797932544
- .long 1070025671
- .long 1894836933
- .long 3172544059
- .long 3433797632
- .long 1070000803
- .long 3221831166
- .long 3171921685
- .long 2338371584
- .long 1069976104
- .long 3732461053
- .long 3164513518
- .long 2644013056
- .long 1069951571
- .long 2519460462
- .long 3172548740
- .long 3383814144
- .long 1069927202
- .long 2290997657
- .long 1025499649
- .long 3781380096
- .long 1069902995
- .long 380479405
- .long 1025184136
- .long 3245785088
- .long 1069878948
- .long 1096398261
- .long 3169885192
- .long 1366712320
- .long 1069855059
- .long 2218343715
- .long 3170281628
- .long 2204717056
- .long 1069831325
- .long 2668334011
- .long 1025264524
- .long 1401772032
- .long 1069807745
- .long 4103993159
- .long 1022925721
- .long 3356721152
- .long 1069784316
- .long 3573790772
- .long 3172186527
- .long 4041148416
- .long 1069761037
- .long 4027691910
- .long 3171276990
- .long 3880151040
- .long 1069737906
- .long 4087118786
- .long 3172710734
- .long 3453364224
- .long 1069714921
- .long 99014299
- .long 3172003077
- .long 3491092480
- .long 1069692080
- .long 3801836701
- .long 3172989287
- .long 575580160
- .long 1069669382
- .long 1920406012
- .long 3170874125
- .long 22282240
- .long 1069646824
- .long 964193370
- .long 1019363159
- .long 2991429632
- .long 1069624404
- .long 3372589890
- .long 1023425053
- .long 2189645824
- .long 1069602122
- .long 2610503872
- .long 1023652442
- .long 3341467648
- .long 1069579975
- .long 1190292004
- .long 1022425665
- .long 3711293440
- .long 1069557962
- .long 1104795356
- .long 1023625829
- .long 1380401152
- .long 1069524644
- .long 1156998217
- .long 1025100499
- .long 765710336
- .long 1069481144
- .long 1736649113
- .long 1024999439
- .long 849412096
- .long 1069437902
- .long 2618178330
- .long 3170853629
- .long 1433104384
- .long 1069394915
- .long 43477267
- .long 3170378811
- .long 2548596736
- .long 1069352180
- .long 3967367063
- .long 1025246584
- .long 157577216
- .long 1069309695
- .long 100402533
- .long 3172825502
- .long 3326238720
- .long 1069267455
- .long 1176892909
- .long 1025464099
- .long 4155494400
- .long 1069225459
- .long 3713707617
- .long 3172630046
- .long 3545804800
- .long 1069183704
- .long 857007315
- .long 1024965777
- .long 2602520576
- .long 1069142187
- .long 2588758347
- .long 1022463131
- .long 2631196672
- .long 1069100905
- .long 2118424235
- .long 1022490989
- .long 838135808
- .long 1069059856
- .long 4117002727
- .long 1024874520
- .long 3210903552
- .long 1069019036
- .long 650070125
- .long 3172012966
- .long 3039211520
- .long 1068978444
- .long 438055812
- .long 1017743757
- .long 2385633280
- .long 1068938077
- .long 3011990369
- .long 3171312044
- .long 3491618816
- .long 1068897932
- .long 712813818
- .long 3172720400
- .long 183644160
- .long 1068858008
- .long 4287006742
- .long 1022379728
- .long 3639214080
- .long 1068818300
- .long 353762279
- .long 3172980009
- .long 3728416768
- .long 1068778808
- .long 1851367730
- .long 1025486574
- .long 3370094592
- .long 1068739529
- .long 4046594913
- .long 3172567047
- .long 1348407296
- .long 1068700461
- .long 143189675
- .long 1025397632
- .long 899403776
- .long 1068661601
- .long 3753687842
- .long 3170772772
- .long 1117708288
- .long 1068622947
- .long 1857340812
- .long 3170782678
- .long 1248276480
- .long 1068584497
- .long 1289858203
- .long 1025222289
- .long 683237376
- .long 1068546249
- .long 2356679608
- .long 3171629170
- .long 3253764096
- .long 1068508200
- .long 3267136556
- .long 1018554987
- .long 94478336
- .long 1068441756
- .long 1927868814
- .long 3169378180
- .long 3233144832
- .long 1068366445
- .long 2682188854
- .long 1023964004
- .long 2940297216
- .long 1068291522
- .long 275301289
- .long 1023944679
- .long 3677708288
- .long 1068216982
- .long 302658771
- .long 1024465567
- .long 1576968192
- .long 1068142822
- .long 3672035940
- .long 3172254610
- .long 1614069760
- .long 1068069037
- .long 480052905
- .long 3172692062
- .long 424435712
- .long 1067995624
- .long 2207869657
- .long 3170965436
- .long 3477782528
- .long 1067922578
- .long 2980661858
- .long 3164990018
- .long 3598401536
- .long 1067849897
- .long 1974393034
- .long 3171357083
- .long 2435235840
- .long 1067777577
- .long 1385289011
- .long 1024615823
- .long 1867333632
- .long 1067705614
- .long 3442236633
- .long 1025334384
- .long 3999301632
- .long 1067634004
- .long 3506472073
- .long 1025132546
- .long 2566971392
- .long 1067562745
- .long 1425757592
- .long 3172358463
- .long 112943104
- .long 1067491833
- .long 1693407156
- .long 3172426603
- .long 3079929856
- .long 1067392159
- .long 3999942455
- .long 1018549369
- .long 2443837440
- .long 1067251701
- .long 974534460
- .long 1023963412
- .long 359366656
- .long 1067111917
- .long 2204915018
- .long 1013514416
- .long 3564519424
- .long 1066972799
- .long 3977441659
- .long 3170879860
- .long 2011086848
- .long 1066834343
- .long 590145514
- .long 1025390011
- .long 3216982016
- .long 1066696541
- .long 3629120110
- .long 1024330313
- .long 2194128896
- .long 1066559388
- .long 2367098512
- .long 3172260338
- .long 2916220928
- .long 1066422877
- .long 2262431886
- .long 1021229446
- .long 2263941120
- .long 1066172214
- .long 3118507287
- .long 1021484970
- .long 3076292608
- .long 1065901726
- .long 1411737803
- .long 3172957147
- .long 1186136064
- .long 1065632488
- .long 3109349337
- .long 1025397383
- .long 3085303808
- .long 1065364487
- .long 584715031
- .long 3172596519
- .long 1821048832
- .long 1064842211
- .long 2182246895
- .long 3172536214
- .long 697368576
- .long 1064311094
- .long 3157561765
- .long 3172716357
- .long 894042112
- .long 1063260131
- .long 3237958154
- .long 3172587292
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1352628224
- .long 1066615827
- .long 521319256
- .long 1021308721
- .long 3248877870
- .long 1077250164
- .long 1691676429
- .long 3221787401
- .long 945132465
- .long 3223701783
- .long 3700831335
- .long 1073506818
- .long 2141010593
- .long 1075227551
- .long 3698831637
- .long 3220339442
- .long 4160749568
- .long 4294967295
- .long 0
- .long 4294959104
- .long 0
- .long 1071366144
- .long 3207479560
- .long 1062894188
- .type static_const_table,@object
- .size static_const_table,2160
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/e_sinh.S b/libm/x86/e_sinh.S
deleted file mode 100644
index b9a2930..0000000
--- a/libm/x86/e_sinh.S
+++ /dev/null
@@ -1,1407 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// sinh(x)=(exp(x)-exp(-x))/2
-//
-// Let |x|=xH+xL (upper 26 bits, lower 27 bits)
-// log2(e) rounded to 26 bits (high part) plus a double precision low part is
-// L2EH+L2EL (upper 26, lower 53 bits)
-//
-// Let xH*L2EH=k+f+r`, where (k+f)*2^7=int(xH*L2EH*2^7),
-// f=0.b1 b2 ... b7, k integer
-// 2^f is approximated as Tp[f]+Dp[f], and 2^{-f} as Tn[f]+Dn[f]
-// Tp stores the high 53 bits, Dp stores (2^f-Tp[f]) rounded to double precision
-//
-// e^|x|=2^{k+f}*2^r, r=r`+xL*L2EH+|x|*L2EL, |r|<2^{-8}+2^{-14},
-// for |x| in [23/64,3*2^7)
-// e^{-|x|}=2^{-k-f}*2^{-r}
-//
-// e^|x| is approximated as 2^k*Tp+2^k*Tp*c1*r(1+c2*r+..+c5*r^4)+2^k*Dp=
-// =2^k*Tp+2^k*Tp*P15+2^k*Dp
-// e^{-|x|} approximated as 2^{-k}*Tn-2^{-k}*Tn*c1*r(1-c2*r+..+c5*r^4)+2^{-k}*Dn
-//
-// For |x| in [1/8, 3*2^7), sinh(x) is formed as
-// RN(2^k*Tp-2^{-k}*Tn)+2^k*Tp*P15-2^{-k}*Tn*P`15-2^{-k}*TnL-2^{-k}*Dn+2^k*Dp
-//
-// For x in (3*2^7, 3*2^8), sign(x)*(e^|x|)/2 is returned, and
-// the result is checked for overflow.
-//
-// For |x|<23/64, a Taylor polynomial expansion is used (degree 13)
-// To reduce rounding errors, the p3*x^3 term is computed as
-// (p3*xh^3)_high+[(p3*xl*(3*x*xh+xl^2))+(p3*xh^3)_low],
-// where x=xh+xl, (xh are the leading 17 bits of x), and
-// (p3*xh^3)_high=RN(x+p3*xh^3)-x
-// (error bound for polynomial expansion is below 0.51 ulp)
-//
-// Special cases:
-// sinh(NaN) = quiet NaN, and raise invalid exception
-// sinh(+/-INF) = +/-INF
-// sinh(x) = x for subnormals
-// for finite argument, only sinh(0)=0 is exact
-// For IEEE double
-// sinh(x) overflows for x >
-// 710.47586007394386342639336362481117248535156250 = MAXLOG+log(2)
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin sinh
-ENTRY(sinh)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $104, %esp
- movl %ebx, 40(%esp)
- call static_func
- movl %eax, %ebx
- movsd 112(%esp), %xmm0
- movsd 4272(%ebx), %xmm3
- xorpd %xmm4, %xmm4
- movsd 4192(%ebx), %xmm1
- movsd 4200(%ebx), %xmm2
- movl $32768, %eax
- pinsrw $3, %eax, %xmm4
- movsd 4096(%ebx), %xmm6
- pextrw $3, %xmm0, %ecx
- andpd %xmm0, %xmm3
- andnpd %xmm0, %xmm4
- pshufd $68, %xmm4, %xmm5
- movl $32768, %edx
- andl %ecx, %edx
- andl $32767, %ecx
- subl $16343, %ecx
- cmpl $177, %ecx
- jae .L_2TAG_PACKET_0.0.2
- subsd %xmm3, %xmm4
- mulsd %xmm1, %xmm3
- mulsd %xmm5, %xmm2
- cvtsd2si %xmm3, %eax
- shll $3, %edx
- orl %edx, %eax
- movapd %xmm3, %xmm7
- addsd %xmm6, %xmm3
- mulsd %xmm4, %xmm1
- xorpd %xmm5, %xmm5
- subsd %xmm6, %xmm3
- movapd 4112(%ebx), %xmm4
- addsd %xmm1, %xmm2
- movapd 4128(%ebx), %xmm6
- subsd %xmm3, %xmm7
- movl $32704, %edx
- pinsrw $3, %edx, %xmm5
- movapd 4144(%ebx), %xmm1
- addsd %xmm7, %xmm2
- movl $127, %edx
- andl %eax, %edx
- addl %edx, %edx
- shrl $3, %eax
- andl $65520, %eax
- addl $16352, %eax
- xorpd %xmm0, %xmm0
- cmpl $161, %ecx
- jae .L_2TAG_PACKET_1.0.2
- pshufd $68, %xmm5, %xmm5
- pinsrw $3, %eax, %xmm0
- pshufd $68, %xmm0, %xmm0
- psubw %xmm0, %xmm5
- mulpd (%ebx,%edx,8), %xmm0
- mulpd 2048(%ebx,%edx,8), %xmm5
- pshufd $68, %xmm2, %xmm3
- movapd 4160(%ebx), %xmm7
- pshufd $68, %xmm2, %xmm2
- mulpd %xmm3, %xmm3
- mulpd %xmm2, %xmm4
- mulpd %xmm2, %xmm6
- mulpd 4176(%ebx), %xmm2
- mulpd %xmm3, %xmm1
- mulpd %xmm3, %xmm7
- mulpd %xmm3, %xmm4
- mulpd %xmm3, %xmm1
- addpd %xmm7, %xmm6
- movapd %xmm0, %xmm7
- addpd %xmm1, %xmm4
- shufpd $0, %xmm5, %xmm7
- subpd %xmm5, %xmm0
- mulpd %xmm7, %xmm2
- addpd %xmm6, %xmm4
- subsd %xmm0, %xmm7
- mulpd %xmm2, %xmm4
- pshufd $238, %xmm0, %xmm6
- subsd %xmm5, %xmm7
- addpd %xmm2, %xmm4
- addsd %xmm6, %xmm7
- pshufd $238, %xmm4, %xmm2
- addsd %xmm7, %xmm2
- addsd %xmm4, %xmm2
- addsd %xmm2, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_1.0.2:
- subl $16352, %eax
- movl %eax, %ecx
- andl $32752, %eax
- shrl $1, %eax
- andl $65520, %eax
- subl %eax, %ecx
- addl $16352, %eax
- pinsrw $3, %eax, %xmm0
- pshufd $68, %xmm0, %xmm0
- mulpd (%ebx,%edx,8), %xmm0
- pshufd $68, %xmm2, %xmm3
- movsd 4160(%ebx), %xmm7
- mulsd %xmm3, %xmm3
- mulsd %xmm2, %xmm4
- mulsd %xmm2, %xmm6
- mulsd 4176(%ebx), %xmm2
- mulsd %xmm3, %xmm1
- mulsd %xmm3, %xmm7
- mulsd %xmm3, %xmm4
- addl $16368, %ecx
- pinsrw $3, %ecx, %xmm5
- mulsd %xmm3, %xmm1
- addsd %xmm7, %xmm6
- addsd %xmm1, %xmm4
- mulsd %xmm0, %xmm2
- addsd %xmm6, %xmm4
- mulsd %xmm2, %xmm4
- pshufd $238, %xmm0, %xmm6
- addsd %xmm6, %xmm4
- addsd %xmm4, %xmm2
- addsd %xmm2, %xmm0
- mulsd %xmm5, %xmm0
- pextrw $3, %xmm0, %eax
- andl $32752, %eax
- movl $127, %edx
- cmpl $32752, %eax
- je .L_2TAG_PACKET_3.0.2
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_0.0.2:
- addl $16343, %ecx
- cmpl $16343, %ecx
- ja .L_2TAG_PACKET_4.0.2
- cmpl $15856, %ecx
- jb .L_2TAG_PACKET_5.0.2
- movapd 4208(%ebx), %xmm1
- pshufd $68, %xmm0, %xmm6
- mulpd %xmm5, %xmm5
- movapd 4224(%ebx), %xmm2
- pshufd $68, %xmm0, %xmm7
- movapd 4240(%ebx), %xmm3
- pshufd $68, %xmm0, %xmm4
- andpd 4256(%ebx), %xmm6
- mulpd %xmm5, %xmm1
- mulsd %xmm5, %xmm2
- subpd %xmm6, %xmm4
- mulpd %xmm5, %xmm7
- addpd %xmm3, %xmm1
- pshufd $68, %xmm6, %xmm3
- mulpd %xmm5, %xmm5
- mulsd %xmm7, %xmm2
- mulpd %xmm7, %xmm1
- pshufd $68, %xmm0, %xmm7
- mulsd %xmm6, %xmm6
- addsd %xmm7, %xmm7
- mulsd %xmm4, %xmm4
- mulpd %xmm5, %xmm1
- addsd %xmm0, %xmm7
- mulsd %xmm3, %xmm6
- mulsd %xmm3, %xmm7
- pshufd $238, %xmm1, %xmm3
- mulsd %xmm5, %xmm1
- pshufd $238, %xmm4, %xmm5
- addsd %xmm2, %xmm3
- pshufd $238, %xmm2, %xmm2
- addsd %xmm4, %xmm7
- movapd %xmm0, %xmm4
- mulsd %xmm2, %xmm6
- mulsd %xmm5, %xmm7
- addsd %xmm6, %xmm0
- mulsd %xmm2, %xmm7
- subsd %xmm0, %xmm4
- addsd %xmm7, %xmm1
- addsd %xmm4, %xmm6
- addsd %xmm3, %xmm1
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_5.0.2:
- cmpl $16, %ecx
- jae .L_2TAG_PACKET_6.0.2
- movapd %xmm0, %xmm1
- mulsd %xmm1, %xmm1
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_6.0.2:
- xorpd %xmm2, %xmm2
- movl $17392, %ecx
- pinsrw $3, %ecx, %xmm2
- xorpd %xmm3, %xmm3
- movl $15344, %edx
- pinsrw $3, %edx, %xmm3
- mulsd %xmm0, %xmm2
- addsd %xmm2, %xmm0
- mulsd %xmm3, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_4.0.2:
- cmpl $32752, %ecx
- jae .L_2TAG_PACKET_7.0.2
- xorpd %xmm0, %xmm0
- movl $32736, %eax
- pinsrw $3, %eax, %xmm0
- orl %edx, %eax
- pinsrw $3, %eax, %xmm1
- mulsd %xmm1, %xmm0
- movl $127, %edx
-.L_2TAG_PACKET_3.0.2:
- movsd %xmm0, (%esp)
- movsd 112(%esp), %xmm0
- fldl (%esp)
- jmp .L_2TAG_PACKET_8.0.2
-.L_2TAG_PACKET_7.0.2:
- xorpd %xmm1, %xmm1
- movl $32768, %eax
- pinsrw $3, %eax, %xmm1
- andnpd %xmm0, %xmm1
- mulsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_2.0.2:
- movsd %xmm0, 24(%esp)
- fldl 24(%esp)
-.L_2TAG_PACKET_8.0.2:
- movl 40(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(sinh)
-# -- End sinh
-
-# Start file scope ASM
-ALIAS_SYMBOL(sinhl, sinh);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 2851812149
- .long 1072698941
- .long 2595802551
- .long 1016815913
- .long 1048019041
- .long 1072704666
- .long 1398474845
- .long 3161559171
- .long 3899555717
- .long 1072710421
- .long 427280750
- .long 3163595548
- .long 3541402996
- .long 1072716208
- .long 2759177317
- .long 1015903202
- .long 702412510
- .long 1072722027
- .long 3803266087
- .long 3163328991
- .long 410360776
- .long 1072727877
- .long 1269990655
- .long 1013024446
- .long 3402036099
- .long 1072733758
- .long 405889334
- .long 1016154232
- .long 1828292879
- .long 1072739672
- .long 1255956747
- .long 1016636974
- .long 728909815
- .long 1072745618
- .long 383930225
- .long 1016078044
- .long 852742562
- .long 1072751596
- .long 667253586
- .long 1010842135
- .long 2952712987
- .long 1072757606
- .long 3293494651
- .long 3161168877
- .long 3490863953
- .long 1072763649
- .long 960797498
- .long 3163997456
- .long 3228316108
- .long 1072769725
- .long 3010241991
- .long 3159471380
- .long 2930322912
- .long 1072775834
- .long 2599499422
- .long 3163762623
- .long 3366293073
- .long 1072781976
- .long 3119426314
- .long 1015169130
- .long 1014845819
- .long 1072788152
- .long 3117910646
- .long 3162607681
- .long 948735466
- .long 1072794361
- .long 3516338028
- .long 3163623459
- .long 3949972341
- .long 1072800603
- .long 2068408548
- .long 1015962444
- .long 2214878420
- .long 1072806880
- .long 892270087
- .long 3164164998
- .long 828946858
- .long 1072813191
- .long 10642492
- .long 1016988014
- .long 586995997
- .long 1072819536
- .long 41662348
- .long 3163676568
- .long 2288159958
- .long 1072825915
- .long 2169144469
- .long 1015924597
- .long 2440944790
- .long 1072832329
- .long 2492769774
- .long 1015196030
- .long 1853186616
- .long 1072838778
- .long 3066496371
- .long 1016705150
- .long 1337108031
- .long 1072845262
- .long 3203724452
- .long 1015726421
- .long 1709341917
- .long 1072851781
- .long 2571168217
- .long 1015201075
- .long 3790955393
- .long 1072858335
- .long 2352942462
- .long 3164228666
- .long 4112506593
- .long 1072864925
- .long 2947355221
- .long 1015419624
- .long 3504003472
- .long 1072871551
- .long 3594001060
- .long 3158379228
- .long 2799960843
- .long 1072878213
- .long 1423655381
- .long 1016070727
- .long 2839424854
- .long 1072884911
- .long 1171596163
- .long 1014090255
- .long 171030293
- .long 1072891646
- .long 3526460132
- .long 1015477354
- .long 4232894513
- .long 1072898416
- .long 2383938684
- .long 1015717095
- .long 2992903935
- .long 1072905224
- .long 2218154406
- .long 1016276769
- .long 1603444721
- .long 1072912069
- .long 1548633640
- .long 3163249902
- .long 926591435
- .long 1072918951
- .long 3208833762
- .long 3163962090
- .long 1829099622
- .long 1072925870
- .long 1016661181
- .long 3164509581
- .long 887463927
- .long 1072932827
- .long 3596744163
- .long 3161842742
- .long 3272845541
- .long 1072939821
- .long 928852419
- .long 3164536824
- .long 1276261410
- .long 1072946854
- .long 300981948
- .long 1015732745
- .long 78413852
- .long 1072953925
- .long 4183226867
- .long 3164065827
- .long 569847338
- .long 1072961034
- .long 472945272
- .long 3160339305
- .long 3645941911
- .long 1072968181
- .long 3814685081
- .long 3162621917
- .long 1617004845
- .long 1072975368
- .long 82804944
- .long 1011391354
- .long 3978100823
- .long 1072982593
- .long 3513027190
- .long 1016894539
- .long 3049340112
- .long 1072989858
- .long 3062915824
- .long 1014219171
- .long 4040676318
- .long 1072997162
- .long 4090609238
- .long 1016712034
- .long 3577096743
- .long 1073004506
- .long 2951496418
- .long 1014842263
- .long 2583551245
- .long 1073011890
- .long 3161094195
- .long 1016655067
- .long 1990012071
- .long 1073019314
- .long 3529070563
- .long 3163861769
- .long 2731501122
- .long 1073026778
- .long 1774031855
- .long 3163518597
- .long 1453150082
- .long 1073034283
- .long 498154669
- .long 3162536638
- .long 3395129871
- .long 1073041828
- .long 4025345435
- .long 3163383964
- .long 917841882
- .long 1073049415
- .long 18715565
- .long 1016707884
- .long 3566716925
- .long 1073057042
- .long 1536826856
- .long 1015191009
- .long 3712504873
- .long 1073064711
- .long 88491949
- .long 1016476236
- .long 2321106615
- .long 1073072422
- .long 2171176610
- .long 1010584347
- .long 363667784
- .long 1073080175
- .long 813753950
- .long 1016833785
- .long 3111574537
- .long 1073087969
- .long 2606161479
- .long 3163808322
- .long 2956612997
- .long 1073095806
- .long 2118169751
- .long 3163784129
- .long 885834528
- .long 1073103686
- .long 1973258547
- .long 3163310140
- .long 2186617381
- .long 1073111608
- .long 2270764084
- .long 3164321289
- .long 3561793907
- .long 1073119573
- .long 1157054053
- .long 1012938926
- .long 1719614413
- .long 1073127582
- .long 330458198
- .long 3164331316
- .long 1963711167
- .long 1073135634
- .long 1744767757
- .long 3161622870
- .long 1013258799
- .long 1073143730
- .long 1748797611
- .long 3161177658
- .long 4182873220
- .long 1073151869
- .long 629542646
- .long 3163044879
- .long 3907805044
- .long 1073160053
- .long 2257091225
- .long 3162598983
- .long 1218806132
- .long 1073168282
- .long 1818613052
- .long 3163597017
- .long 1447192521
- .long 1073176555
- .long 1462857171
- .long 3163563097
- .long 1339972927
- .long 1073184873
- .long 167908909
- .long 1016620728
- .long 1944781191
- .long 1073193236
- .long 3993278767
- .long 3162772855
- .long 19972402
- .long 1073201645
- .long 3507899862
- .long 1017057868
- .long 919555682
- .long 1073210099
- .long 3121969534
- .long 1013996802
- .long 1413356050
- .long 1073218599
- .long 1651349291
- .long 3163716742
- .long 2571947539
- .long 1073227145
- .long 3558159064
- .long 3164425245
- .long 1176749997
- .long 1073235738
- .long 2738998779
- .long 3163084420
- .long 2604962541
- .long 1073244377
- .long 2614425274
- .long 3164587768
- .long 3649726105
- .long 1073253063
- .long 4085036346
- .long 1016698050
- .long 1110089947
- .long 1073261797
- .long 1451641639
- .long 1016523249
- .long 380978316
- .long 1073270578
- .long 854188970
- .long 3161511262
- .long 2568320822
- .long 1073279406
- .long 2732824428
- .long 1015401491
- .long 194117574
- .long 1073288283
- .long 777528612
- .long 3164460665
- .long 2966275557
- .long 1073297207
- .long 2176155324
- .long 3160891335
- .long 3418903055
- .long 1073306180
- .long 2527457337
- .long 3161869180
- .long 2682146384
- .long 1073315202
- .long 2082178513
- .long 3164411995
- .long 1892288442
- .long 1073324273
- .long 2446255666
- .long 3163648957
- .long 2191782032
- .long 1073333393
- .long 2960257726
- .long 1014791238
- .long 434316067
- .long 1073342563
- .long 2028358766
- .long 1014506698
- .long 2069751141
- .long 1073351782
- .long 1562170675
- .long 3163773257
- .long 3964284211
- .long 1073361051
- .long 2111583915
- .long 1016475740
- .long 2990417245
- .long 1073370371
- .long 3683467745
- .long 3164417902
- .long 321958744
- .long 1073379742
- .long 3401933767
- .long 1016843134
- .long 1434058175
- .long 1073389163
- .long 251133233
- .long 1016134345
- .long 3218338682
- .long 1073398635
- .long 3404164304
- .long 3163525684
- .long 2572866477
- .long 1073408159
- .long 878562433
- .long 1016570317
- .long 697153126
- .long 1073417735
- .long 1283515429
- .long 3164331765
- .long 3092190715
- .long 1073427362
- .long 814012168
- .long 3160571998
- .long 2380618042
- .long 1073437042
- .long 3149557219
- .long 3164369375
- .long 4076559943
- .long 1073446774
- .long 2119478331
- .long 3161806927
- .long 815859274
- .long 1073456560
- .long 240396590
- .long 3164536019
- .long 2420883922
- .long 1073466398
- .long 2049810052
- .long 1015168464
- .long 1540824585
- .long 1073476290
- .long 1064017011
- .long 3164536266
- .long 3716502172
- .long 1073486235
- .long 2303740125
- .long 1015091301
- .long 1610600570
- .long 1073496235
- .long 3766732298
- .long 1016808759
- .long 777507147
- .long 1073506289
- .long 4282924205
- .long 1016236109
- .long 2483480501
- .long 1073516397
- .long 1216371780
- .long 1014082748
- .long 3706687593
- .long 1073526560
- .long 3521726940
- .long 1014301643
- .long 1432208378
- .long 1073536779
- .long 1401068914
- .long 3163412539
- .long 1242007932
- .long 1073547053
- .long 1132034716
- .long 3164388407
- .long 135105010
- .long 1073557383
- .long 1906148728
- .long 3164424315
- .long 3707479175
- .long 1073567768
- .long 3613079303
- .long 1015213314
- .long 382305176
- .long 1073578211
- .long 2347622376
- .long 3163627201
- .long 64696965
- .long 1073588710
- .long 1768797490
- .long 1016865536
- .long 4076975200
- .long 1073599265
- .long 2029000899
- .long 1016257111
- .long 863738719
- .long 1073609879
- .long 1326992220
- .long 3163661773
- .long 351641897
- .long 1073620550
- .long 2172261526
- .long 3164059175
- .long 3884662774
- .long 1073631278
- .long 2158611599
- .long 1015258761
- .long 4224142467
- .long 1073642065
- .long 3389820386
- .long 1016255778
- .long 2728693978
- .long 1073652911
- .long 396109971
- .long 3164511267
- .long 764307441
- .long 1073663816
- .long 3021057420
- .long 3164378099
- .long 3999357479
- .long 1073674779
- .long 2258941616
- .long 1016973300
- .long 929806999
- .long 1073685803
- .long 3205336643
- .long 1016308133
- .long 1533953344
- .long 1073696886
- .long 769171851
- .long 1016714209
- .long 2912730644
- .long 1073708029
- .long 3490067722
- .long 3164453650
- .long 2174652632
- .long 1073719233
- .long 4087714590
- .long 1015498835
- .long 730821105
- .long 1073730498
- .long 2523232743
- .long 1013115764
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 730821105
- .long 1072681922
- .long 2523232743
- .long 1012067188
- .long 2174652632
- .long 1072670657
- .long 4087714590
- .long 1014450259
- .long 2912730644
- .long 1072659453
- .long 3490067722
- .long 3163405074
- .long 1533953344
- .long 1072648310
- .long 769171851
- .long 1015665633
- .long 929806999
- .long 1072637227
- .long 3205336643
- .long 1015259557
- .long 3999357479
- .long 1072626203
- .long 2258941616
- .long 1015924724
- .long 764307441
- .long 1072615240
- .long 3021057420
- .long 3163329523
- .long 2728693978
- .long 1072604335
- .long 396109971
- .long 3163462691
- .long 4224142467
- .long 1072593489
- .long 3389820386
- .long 1015207202
- .long 3884662774
- .long 1072582702
- .long 2158611599
- .long 1014210185
- .long 351641897
- .long 1072571974
- .long 2172261526
- .long 3163010599
- .long 863738719
- .long 1072561303
- .long 1326992220
- .long 3162613197
- .long 4076975200
- .long 1072550689
- .long 2029000899
- .long 1015208535
- .long 64696965
- .long 1072540134
- .long 1768797490
- .long 1015816960
- .long 382305176
- .long 1072529635
- .long 2347622376
- .long 3162578625
- .long 3707479175
- .long 1072519192
- .long 3613079303
- .long 1014164738
- .long 135105010
- .long 1072508807
- .long 1906148728
- .long 3163375739
- .long 1242007932
- .long 1072498477
- .long 1132034716
- .long 3163339831
- .long 1432208378
- .long 1072488203
- .long 1401068914
- .long 3162363963
- .long 3706687593
- .long 1072477984
- .long 3521726940
- .long 1013253067
- .long 2483480501
- .long 1072467821
- .long 1216371780
- .long 1013034172
- .long 777507147
- .long 1072457713
- .long 4282924205
- .long 1015187533
- .long 1610600570
- .long 1072447659
- .long 3766732298
- .long 1015760183
- .long 3716502172
- .long 1072437659
- .long 2303740125
- .long 1014042725
- .long 1540824585
- .long 1072427714
- .long 1064017011
- .long 3163487690
- .long 2420883922
- .long 1072417822
- .long 2049810052
- .long 1014119888
- .long 815859274
- .long 1072407984
- .long 240396590
- .long 3163487443
- .long 4076559943
- .long 1072398198
- .long 2119478331
- .long 3160758351
- .long 2380618042
- .long 1072388466
- .long 3149557219
- .long 3163320799
- .long 3092190715
- .long 1072378786
- .long 814012168
- .long 3159523422
- .long 697153126
- .long 1072369159
- .long 1283515429
- .long 3163283189
- .long 2572866477
- .long 1072359583
- .long 878562433
- .long 1015521741
- .long 3218338682
- .long 1072350059
- .long 3404164304
- .long 3162477108
- .long 1434058175
- .long 1072340587
- .long 251133233
- .long 1015085769
- .long 321958744
- .long 1072331166
- .long 3401933767
- .long 1015794558
- .long 2990417245
- .long 1072321795
- .long 3683467745
- .long 3163369326
- .long 3964284211
- .long 1072312475
- .long 2111583915
- .long 1015427164
- .long 2069751141
- .long 1072303206
- .long 1562170675
- .long 3162724681
- .long 434316067
- .long 1072293987
- .long 2028358766
- .long 1013458122
- .long 2191782032
- .long 1072284817
- .long 2960257726
- .long 1013742662
- .long 1892288442
- .long 1072275697
- .long 2446255666
- .long 3162600381
- .long 2682146384
- .long 1072266626
- .long 2082178513
- .long 3163363419
- .long 3418903055
- .long 1072257604
- .long 2527457337
- .long 3160820604
- .long 2966275557
- .long 1072248631
- .long 2176155324
- .long 3159842759
- .long 194117574
- .long 1072239707
- .long 777528612
- .long 3163412089
- .long 2568320822
- .long 1072230830
- .long 2732824428
- .long 1014352915
- .long 380978316
- .long 1072222002
- .long 854188970
- .long 3160462686
- .long 1110089947
- .long 1072213221
- .long 1451641639
- .long 1015474673
- .long 3649726105
- .long 1072204487
- .long 4085036346
- .long 1015649474
- .long 2604962541
- .long 1072195801
- .long 2614425274
- .long 3163539192
- .long 1176749997
- .long 1072187162
- .long 2738998779
- .long 3162035844
- .long 2571947539
- .long 1072178569
- .long 3558159064
- .long 3163376669
- .long 1413356050
- .long 1072170023
- .long 1651349291
- .long 3162668166
- .long 919555682
- .long 1072161523
- .long 3121969534
- .long 1012948226
- .long 19972402
- .long 1072153069
- .long 3507899862
- .long 1016009292
- .long 1944781191
- .long 1072144660
- .long 3993278767
- .long 3161724279
- .long 1339972927
- .long 1072136297
- .long 167908909
- .long 1015572152
- .long 1447192521
- .long 1072127979
- .long 1462857171
- .long 3162514521
- .long 1218806132
- .long 1072119706
- .long 1818613052
- .long 3162548441
- .long 3907805044
- .long 1072111477
- .long 2257091225
- .long 3161550407
- .long 4182873220
- .long 1072103293
- .long 629542646
- .long 3161996303
- .long 1013258799
- .long 1072095154
- .long 1748797611
- .long 3160129082
- .long 1963711167
- .long 1072087058
- .long 1744767757
- .long 3160574294
- .long 1719614413
- .long 1072079006
- .long 330458198
- .long 3163282740
- .long 3561793907
- .long 1072070997
- .long 1157054053
- .long 1011890350
- .long 2186617381
- .long 1072063032
- .long 2270764084
- .long 3163272713
- .long 885834528
- .long 1072055110
- .long 1973258547
- .long 3162261564
- .long 2956612997
- .long 1072047230
- .long 2118169751
- .long 3162735553
- .long 3111574537
- .long 1072039393
- .long 2606161479
- .long 3162759746
- .long 363667784
- .long 1072031599
- .long 813753950
- .long 1015785209
- .long 2321106615
- .long 1072023846
- .long 2171176610
- .long 1009535771
- .long 3712504873
- .long 1072016135
- .long 88491949
- .long 1015427660
- .long 3566716925
- .long 1072008466
- .long 1536826856
- .long 1014142433
- .long 917841882
- .long 1072000839
- .long 18715565
- .long 1015659308
- .long 3395129871
- .long 1071993252
- .long 4025345435
- .long 3162335388
- .long 1453150082
- .long 1071985707
- .long 498154669
- .long 3161488062
- .long 2731501122
- .long 1071978202
- .long 1774031855
- .long 3162470021
- .long 1990012071
- .long 1071970738
- .long 3529070563
- .long 3162813193
- .long 2583551245
- .long 1071963314
- .long 3161094195
- .long 1015606491
- .long 3577096743
- .long 1071955930
- .long 2951496418
- .long 1013793687
- .long 4040676318
- .long 1071948586
- .long 4090609238
- .long 1015663458
- .long 3049340112
- .long 1071941282
- .long 3062915824
- .long 1013170595
- .long 3978100823
- .long 1071934017
- .long 3513027190
- .long 1015845963
- .long 1617004845
- .long 1071926792
- .long 82804944
- .long 1010342778
- .long 3645941911
- .long 1071919605
- .long 3814685081
- .long 3161573341
- .long 569847338
- .long 1071912458
- .long 472945272
- .long 3159290729
- .long 78413852
- .long 1071905349
- .long 4183226867
- .long 3163017251
- .long 1276261410
- .long 1071898278
- .long 300981948
- .long 1014684169
- .long 3272845541
- .long 1071891245
- .long 928852419
- .long 3163488248
- .long 887463927
- .long 1071884251
- .long 3596744163
- .long 3160794166
- .long 1829099622
- .long 1071877294
- .long 1016661181
- .long 3163461005
- .long 926591435
- .long 1071870375
- .long 3208833762
- .long 3162913514
- .long 1603444721
- .long 1071863493
- .long 1548633640
- .long 3162201326
- .long 2992903935
- .long 1071856648
- .long 2218154406
- .long 1015228193
- .long 4232894513
- .long 1071849840
- .long 2383938684
- .long 1014668519
- .long 171030293
- .long 1071843070
- .long 3526460132
- .long 1014428778
- .long 2839424854
- .long 1071836335
- .long 1171596163
- .long 1013041679
- .long 2799960843
- .long 1071829637
- .long 1423655381
- .long 1015022151
- .long 3504003472
- .long 1071822975
- .long 3594001060
- .long 3157330652
- .long 4112506593
- .long 1071816349
- .long 2947355221
- .long 1014371048
- .long 3790955393
- .long 1071809759
- .long 2352942462
- .long 3163180090
- .long 1709341917
- .long 1071803205
- .long 2571168217
- .long 1014152499
- .long 1337108031
- .long 1071796686
- .long 3203724452
- .long 1014677845
- .long 1853186616
- .long 1071790202
- .long 3066496371
- .long 1015656574
- .long 2440944790
- .long 1071783753
- .long 2492769774
- .long 1014147454
- .long 2288159958
- .long 1071777339
- .long 2169144469
- .long 1014876021
- .long 586995997
- .long 1071770960
- .long 41662348
- .long 3162627992
- .long 828946858
- .long 1071764615
- .long 10642492
- .long 1015939438
- .long 2214878420
- .long 1071758304
- .long 892270087
- .long 3163116422
- .long 3949972341
- .long 1071752027
- .long 2068408548
- .long 1014913868
- .long 948735466
- .long 1071745785
- .long 3516338028
- .long 3162574883
- .long 1014845819
- .long 1071739576
- .long 3117910646
- .long 3161559105
- .long 3366293073
- .long 1071733400
- .long 3119426314
- .long 1014120554
- .long 2930322912
- .long 1071727258
- .long 2599499422
- .long 3162714047
- .long 3228316108
- .long 1071721149
- .long 3010241991
- .long 3158422804
- .long 3490863953
- .long 1071715073
- .long 960797498
- .long 3162948880
- .long 2952712987
- .long 1071709030
- .long 3293494651
- .long 3160120301
- .long 852742562
- .long 1071703020
- .long 667253586
- .long 1009793559
- .long 728909815
- .long 1071697042
- .long 383930225
- .long 1015029468
- .long 1828292879
- .long 1071691096
- .long 1255956747
- .long 1015588398
- .long 3402036099
- .long 1071685182
- .long 405889334
- .long 1015105656
- .long 410360776
- .long 1071679301
- .long 1269990655
- .long 1011975870
- .long 702412510
- .long 1071673451
- .long 3803266087
- .long 3162280415
- .long 3541402996
- .long 1071667632
- .long 2759177317
- .long 1014854626
- .long 3899555717
- .long 1071661845
- .long 427280750
- .long 3162546972
- .long 1048019041
- .long 1071656090
- .long 1398474845
- .long 3160510595
- .long 2851812149
- .long 1071650365
- .long 2595802551
- .long 1015767337
- .long 0
- .long 1127743488
- .long 0
- .long 3275227136
- .long 3607404736
- .long 1044146952
- .long 3607404736
- .long 3191630600
- .long 4277811695
- .long 1063661122
- .long 4277811695
- .long 3211144770
- .long 2140175755
- .long 1033864261
- .long 2140175755
- .long 1033864261
- .long 4289495988
- .long 1054113747
- .long 4289495988
- .long 1054113747
- .long 4277811695
- .long 1064709698
- .long 4277811695
- .long 1064709698
- .long 1610612736
- .long 1080497479
- .long 4166901572
- .long 1053077003
- .long 329805064
- .long 1038488134
- .long 2773927730
- .long 1053236707
- .long 286331153
- .long 1065423121
- .long 1431655765
- .long 1069897045
- .long 1744127201
- .long 1046144581
- .long 436314137
- .long 1059717536
- .long 0
- .long 4294967280
- .long 0
- .long 4294967280
- .long 4160749568
- .long 2147483647
- .type static_const_table,@object
- .size static_const_table,4280
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/floor.S b/libm/x86/floor.S
deleted file mode 100644
index b859736..0000000
--- a/libm/x86/floor.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(floor)
- mov %esp,%eax
- and $0xfffffff8,%eax
- movsd 0x4(%esp),%xmm0
- roundsd $0x1,%xmm0,%xmm0
- movlpd %xmm0,-0x8(%eax)
- fldl -0x8(%eax)
- ret
-END(floor)
-
-ALIAS_SYMBOL(floorl, floor);
diff --git a/libm/x86/floorf.S b/libm/x86/floorf.S
deleted file mode 100644
index 79b9073..0000000
--- a/libm/x86/floorf.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(floorf)
- movss 0x4(%esp),%xmm0
- roundss $0x1,%xmm0,%xmm0
- movss %xmm0,-0x4(%esp)
- flds -0x4(%esp)
- ret
-END(floorf)
diff --git a/libm/x86/libm_reduce_pi04l.S b/libm/x86/libm_reduce_pi04l.S
deleted file mode 100644
index 25976ea..0000000
--- a/libm/x86/libm_reduce_pi04l.S
+++ /dev/null
@@ -1,3718 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-# -- Begin __libm_reduce_pi04l
- .text
- .align 16,0x90
- .hidden __libm_reduce_pi04l
- .globl __libm_reduce_pi04l
-__libm_reduce_pi04l:
-# parameter 1: 8 + %ebp
-# parameter 2: 20 + %ebp
-# parameter 3: 24 + %ebp
-..B1.1:
- pushl %ebp
- movl %esp, %ebp
- andl $-16, %esp
- pushl %esi
- pushl %edi
- pushl %ebx
- subl $20, %esp
- movzwl 16(%ebp), %ebx
- andl $32767, %ebx
- movl 20(%ebp), %eax
- cmpl $16413, %ebx
- movl 24(%ebp), %esi
- call ..L2
-..L2:
- popl %edi
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi
- movl %eax, 4(%esp)
- jge ..B1.8
-..B1.2:
- fldt 8(%ebp)
- fldl __4onpi_d@GOTOFF(%edi)
- fmul %st(1), %st
- fstpt 8(%esp)
- movzwl 16(%esp), %ecx
- negl %ecx
- addl $30, %ecx
- movl 12(%esp), %eax
- shrl %cl, %eax
- cmpl $0, 4(%esp)
- jne ..B1.4
-..B1.3:
- lea 1(%eax), %ecx
- andl $-2, %ecx
- jmp ..B1.5
-..B1.4:
- movl %eax, %ecx
- addl 4(%esp), %eax
- movl %eax, %edx
- andl $1, %edx
- addl %edx, %ecx
-..B1.5:
- fldl _TWO_32H@GOTOFF(%edi)
- cmpl $16400, %ebx
- movl %ecx, (%esp)
- fildl (%esp)
- jge ..B1.7
-..B1.6:
- fldl _pi04_3d@GOTOFF(%edi)
- fmul %st(1), %st
- fsubrp %st, %st(3)
- fxch %st(1)
- fmul %st(2), %st
- fld %st(2)
- fadd %st(1), %st
- fsubp %st, %st(1)
- fld %st(0)
- fxch %st(1)
- fsubr %st, %st(3)
- fldl 8+_pi04_3d@GOTOFF(%edi)
- fmul %st(3), %st
- fsubr %st, %st(2)
- fxch %st(1)
- fsub %st(2), %st
- fsubp %st, %st(1)
- faddp %st, %st(3)
- fldl 16+_pi04_3d@GOTOFF(%edi)
- fmulp %st, %st(2)
- fld %st(1)
- fsubr %st(1), %st
- fsubr %st, %st(1)
- fxch %st(2)
- fsubrp %st, %st(1)
- faddp %st, %st(2)
- fxch %st(1)
- jmp ..B1.15
-..B1.7:
- fldl _pi04_5d@GOTOFF(%edi)
- fmul %st(1), %st
- fsubrp %st, %st(3)
- fxch %st(1)
- fmul %st(2), %st
- fld %st(2)
- fadd %st(1), %st
- fsubp %st, %st(1)
- fld %st(0)
- fxch %st(1)
- fsubr %st, %st(3)
- fldl 8+_pi04_5d@GOTOFF(%edi)
- fmul %st(3), %st
- fsubr %st, %st(2)
- fxch %st(1)
- fsub %st(2), %st
- fsubp %st, %st(1)
- faddp %st, %st(3)
- fldl 16+_pi04_5d@GOTOFF(%edi)
- fmul %st(2), %st
- fld %st(0)
- fsubr %st(2), %st
- fsubr %st, %st(2)
- fxch %st(1)
- fsubrp %st, %st(2)
- fxch %st(1)
- faddp %st, %st(3)
- fldl 24+_pi04_5d@GOTOFF(%edi)
- fmul %st(2), %st
- fld %st(0)
- fsubr %st(2), %st
- fsubr %st, %st(2)
- fxch %st(1)
- fsubrp %st, %st(2)
- fxch %st(1)
- faddp %st, %st(3)
- fldl 32+_pi04_5d@GOTOFF(%edi)
- fmulp %st, %st(2)
- fld %st(1)
- fsubr %st(1), %st
- fsubr %st, %st(1)
- fxch %st(2)
- fsubrp %st, %st(1)
- faddp %st, %st(2)
- fxch %st(1)
- jmp ..B1.15
-..B1.8:
- fldt 8(%ebp)
- addl $-16417, %ebx
- fmull _SCALE@GOTOFF(%edi)
- movl $-2078209981, %eax
- imull %ebx
- addl %ebx, %edx
- movl %ebx, %ecx
- sarl $4, %edx
- sarl $31, %ecx
- subl %ecx, %edx
- movl %edx, %eax
- shll $5, %eax
- fstpt 8(%ebp)
- fldt 8(%ebp)
- subl %edx, %eax
- movl $0, 8(%ebp)
- subl %eax, %ebx
- fldt 8(%ebp)
- cmpl $17, %ebx
- fsubr %st, %st(1)
- jl ..B1.10
-..B1.9:
- lea (,%edx,8), %eax
- lea (%eax,%edx,4), %ecx
- incl %edx
- fldt __4onpi_31l@GOTOFF(%ecx,%edi)
- fmul %st(2), %st
- fldt 12+__4onpi_31l@GOTOFF(%edi,%ecx)
- fmul %st(2), %st
- fld %st(0)
- fadd %st(2), %st
- fsubr %st, %st(2)
- fxch %st(1)
- faddp %st, %st(2)
- fld %st(1)
- fadd %st(1), %st
- fstpt 8(%esp)
- andl $-16777216, 8(%esp)
- fldt 8(%esp)
- fsubrp %st, %st(1)
- jmp ..B1.11
-..B1.10:
- fldl _zeros@GOTOFF(%edi)
- fld %st(0)
-..B1.11:
- fld %st(0)
- lea (,%edx,8), %eax
- fld %st(3)
- lea (%eax,%edx,4), %edx
- fldt __4onpi_31l@GOTOFF(%edx,%edi)
- fmul %st(6), %st
- movl %edx, (%esp)
- fadd %st, %st(2)
- fxch %st(2)
- fsubr %st, %st(3)
- fxch %st(2)
- faddp %st, %st(3)
- fxch %st(2)
- faddp %st, %st(3)
- fldt 12+__4onpi_31l@GOTOFF(%edx,%edi)
- fmul %st, %st(2)
- fld %st(2)
- fadd %st(2), %st
- fld %st(0)
- fxch %st(1)
- fsub %st, %st(3)
- fxch %st(3)
- fchs
- faddp %st, %st(4)
- fxch %st(3)
- faddp %st, %st(4)
- fxch %st(2)
- fadd %st(3), %st
- fxch %st(2)
- fmul %st(5), %st
- fadd %st, %st(2)
- fld %st(4)
- fldt 24+__4onpi_31l@GOTOFF(%edx,%edi)
- fmul %st, %st(1)
- fxch %st(1)
- fadd %st, %st(4)
- fxch %st(4)
- fstpt 8(%esp)
- movzwl 16(%esp), %ebx
- andl $32767, %ebx
- cmpl $16415, %ebx
- jge ..B1.13
-..B1.12:
- negl %ebx
- addl $30, %ebx
- movl %ebx, %ecx
- movl 12(%esp), %eax
- shrl %cl, %eax
- shll %cl, %eax
- movl %eax, 12(%esp)
- movl $0, 8(%esp)
- shrl %cl, %eax
- jmp ..B1.14
-..B1.13:
- negl %ebx
- addl $30, %ebx
- movl %ebx, %ecx
- movl 8(%esp), %edx
- shrl %cl, %edx
- shll %cl, %edx
- negl %ecx
- movl 12(%esp), %eax
- shll %cl, %eax
- movl %ebx, %ecx
- movl %edx, 8(%esp)
- shrl %cl, %edx
- orl %edx, %eax
-..B1.14:
- fldt 8(%esp)
- addl 4(%esp), %eax
- fsubrp %st, %st(3)
- fmul %st(6), %st
- fld %st(4)
- movl %eax, %edx
- andl $1, %edx
- fadd %st(3), %st
- movl (%esp), %ecx
- fsubr %st, %st(3)
- fxch %st(3)
- faddp %st, %st(5)
- fld %st(1)
- fxch %st(3)
- faddl zero_none@GOTOFF(%edi,%edx,8)
- fadd %st, %st(3)
- fsub %st(3), %st
- faddp %st, %st(2)
- fxch %st(1)
- faddp %st, %st(4)
- fld %st(2)
- fadd %st(2), %st
- fsubr %st, %st(2)
- fxch %st(3)
- faddp %st, %st(2)
- fxch %st(1)
- faddp %st, %st(3)
- fld %st(0)
- fadd %st(2), %st
- fsubr %st, %st(2)
- fxch %st(1)
- faddp %st, %st(2)
- fxch %st(1)
- faddp %st, %st(2)
- fld %st(2)
- fldt 36+__4onpi_31l@GOTOFF(%ecx,%edi)
- fmul %st, %st(1)
- fld %st(1)
- fadd %st(3), %st
- fsubr %st, %st(3)
- fxch %st(2)
- faddp %st, %st(3)
- fxch %st(2)
- faddp %st, %st(3)
- fxch %st(1)
- fmul %st(4), %st
- fld %st(0)
- fadd %st(2), %st
- fsubr %st, %st(2)
- fxch %st(1)
- faddp %st, %st(2)
- fxch %st(1)
- faddp %st, %st(2)
- fld %st(2)
- fldt 48+__4onpi_31l@GOTOFF(%ecx,%edi)
- fmul %st, %st(1)
- fld %st(1)
- fadd %st(3), %st
- fsubr %st, %st(3)
- fxch %st(2)
- faddp %st, %st(3)
- fxch %st(2)
- faddp %st, %st(3)
- fld %st(3)
- fxch %st(2)
- fmul %st(5), %st
- fldt 60+__4onpi_31l@GOTOFF(%ecx,%edi)
- fmul %st, %st(3)
- fxch %st(3)
- faddp %st, %st(1)
- fld %st(0)
- fadd %st(2), %st
- fsubr %st, %st(2)
- fxch %st(1)
- faddp %st, %st(2)
- fxch %st(1)
- faddp %st, %st(3)
- fld %st(3)
- fxch %st(2)
- fmul %st(5), %st
- fldt 72+__4onpi_31l@GOTOFF(%ecx,%edi)
- fmul %st, %st(3)
- fxch %st(3)
- faddp %st, %st(1)
- fld %st(0)
- fadd %st(2), %st
- fsubr %st, %st(2)
- fxch %st(1)
- faddp %st, %st(2)
- fxch %st(1)
- faddp %st, %st(3)
- fxch %st(1)
- fmulp %st, %st(4)
- fldt 84+__4onpi_31l@GOTOFF(%edi,%ecx)
- fmulp %st, %st(3)
- fxch %st(2)
- faddp %st, %st(3)
- fld %st(2)
- fadd %st(2), %st
- fldl _TWO_32H@GOTOFF(%edi)
- fmul %st(1), %st
- fadd %st, %st(1)
- fsubrp %st, %st(1)
- fsubr %st, %st(2)
- fxch %st(3)
- faddp %st, %st(2)
- faddp %st, %st(1)
- fldl _pi04_2d@GOTOFF(%edi)
- fld %st(0)
- fmul %st(2), %st
- fxch %st(2)
- fadd %st(3), %st
- fxch %st(1)
- fmulp %st, %st(3)
- fmull 8+_pi04_2d@GOTOFF(%edi)
- faddp %st, %st(1)
-..B1.15:
- fldl _TWO_12H@GOTOFF(%edi)
- fld %st(2)
- fadd %st(2), %st
- fmul %st, %st(1)
- fstpt 8(%esp)
- fldt 8(%esp)
- fadd %st(1), %st
- fsubp %st, %st(1)
- fstl (%esi)
- fsubrp %st, %st(2)
- faddp %st, %st(1)
- fstpl 8(%esi)
- addl $20, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
- .align 16,0x90
- .type __libm_reduce_pi04l,@function
- .size __libm_reduce_pi04l,.-__libm_reduce_pi04l
- .data
-# -- End __libm_reduce_pi04l
- .section .rodata, "a"
- .align 8
- .align 8
-zero_none:
- .long 0x00000000,0x00000000
- .long 0x00000000,0xbff00000
- .type zero_none,@object
- .size zero_none,16
- .align 4
-__4onpi_d:
- .long 1841940611
- .long 1072979760
- .type __4onpi_d,@object
- .size __4onpi_d,8
- .align 4
-_TWO_32H:
- .long 0
- .long 1106771968
- .type _TWO_32H,@object
- .size _TWO_32H,8
- .align 4
-_pi04_3d:
- .long 1413754112
- .long 1072243195
- .long 2563527040
- .long 1021855384
- .long 3417685868
- .long 3118450936
- .type _pi04_3d,@object
- .size _pi04_3d,24
- .align 4
-_pi04_5d:
- .long 1413480448
- .long 1072243195
- .long 442499072
- .long 1036039265
- .long 771751936
- .long 999496074
- .long 622854144
- .long 963347354
- .long 1396597664
- .long 922906692
- .type _pi04_5d,@object
- .size _pi04_5d,40
- .align 4
-_SCALE:
- .long 0
- .long 845152256
- .type _SCALE,@object
- .size _SCALE,8
- .align 4
-_zeros:
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .type _zeros,@object
- .size _zeros,16
- .align 4
-_pi04_2d:
- .long 1413480448
- .long 1072243195
- .long 442655537
- .long 1036039265
- .type _pi04_2d,@object
- .size _pi04_2d,16
- .align 4
-_TWO_12H:
- .long 0
- .long 1085800448
- .type _TWO_12H,@object
- .size _TWO_12H,8
- .align 2
-__4onpi_31l:
- .word 0
- .word 0
- .word 0
- .word 0
- .word 0
- .word 0
- .word 0
- .word 0
- .word 33646
- .word 41721
- .word 16600
- .word 0
- .word 0
- .word 0
- .word 10832
- .word 40072
- .word 16567
- .word 0
- .word 0
- .word 0
- .word 44008
- .word 65043
- .word 16537
- .word 0
- .word 0
- .word 0
- .word 28384
- .word 64154
- .word 16505
- .word 0
- .word 0
- .word 0
- .word 38272
- .word 56162
- .word 16472
- .word 0
- .word 0
- .word 0
- .word 7298
- .word 51682
- .word 16445
- .word 0
- .word 0
- .word 0
- .word 45504
- .word 65320
- .word 16409
- .word 0
- .word 0
- .word 0
- .word 61204
- .word 44922
- .word 16382
- .word 0
- .word 0
- .word 0
- .word 18652
- .word 50030
- .word 16351
- .word 0
- .word 0
- .word 0
- .word 14144
- .word 59657
- .word 16318
- .word 0
- .word 0
- .word 0
- .word 37450
- .word 47105
- .word 16290
- .word 0
- .word 0
- .word 0
- .word 14898
- .word 56641
- .word 16259
- .word 0
- .word 0
- .word 0
- .word 34680
- .word 34623
- .word 16226
- .word 0
- .word 0
- .word 0
- .word 4760
- .word 45515
- .word 16196
- .word 0
- .word 0
- .word 0
- .word 41480
- .word 40187
- .word 16166
- .word 0
- .word 0
- .word 0
- .word 47852
- .word 55252
- .word 16134
- .word 0
- .word 0
- .word 0
- .word 54072
- .word 35081
- .word 16103
- .word 0
- .word 0
- .word 0
- .word 26808
- .word 57421
- .word 16071
- .word 0
- .word 0
- .word 0
- .word 20068
- .word 57232
- .word 16042
- .word 0
- .word 0
- .word 0
- .word 49576
- .word 60188
- .word 16009
- .word 0
- .word 0
- .word 0
- .word 10016
- .word 52861
- .word 15978
- .word 0
- .word 0
- .word 0
- .word 30648
- .word 35825
- .word 15947
- .word 0
- .word 0
- .word 0
- .word 60542
- .word 58528
- .word 15918
- .word 0
- .word 0
- .word 0
- .word 65468
- .word 61743
- .word 15887
- .word 0
- .word 0
- .word 0
- .word 64960
- .word 45825
- .word 15851
- .word 0
- .word 0
- .word 0
- .word 50604
- .word 38792
- .word 15825
- .word 0
- .word 0
- .word 0
- .word 18394
- .word 33435
- .word 15794
- .word 0
- .word 0
- .word 0
- .word 55780
- .word 42703
- .word 15763
- .word 0
- .word 0
- .word 0
- .word 14056
- .word 63841
- .word 15731
- .word 0
- .word 0
- .word 0
- .word 63080
- .word 62563
- .word 15700
- .word 0
- .word 0
- .word 0
- .word 20840
- .word 62207
- .word 15669
- .word 0
- .word 0
- .word 0
- .word 30094
- .word 59983
- .word 15639
- .word 0
- .word 0
- .word 0
- .word 61818
- .word 60389
- .word 15608
- .word 0
- .word 0
- .word 0
- .word 40186
- .word 40579
- .word 15577
- .word 0
- .word 0
- .word 0
- .word 42170
- .word 58004
- .word 15546
- .word 0
- .word 0
- .word 0
- .word 55276
- .word 39678
- .word 15514
- .word 0
- .word 0
- .word 0
- .word 44672
- .word 36806
- .word 15481
- .word 0
- .word 0
- .word 0
- .word 13060
- .word 34144
- .word 15452
- .word 0
- .word 0
- .word 0
- .word 28016
- .word 57231
- .word 15419
- .word 0
- .word 0
- .word 0
- .word 16112
- .word 44995
- .word 15390
- .word 0
- .word 0
- .word 0
- .word 53464
- .word 33387
- .word 15358
- .word 0
- .word 0
- .word 0
- .word 7296
- .word 60751
- .word 15325
- .word 0
- .word 0
- .word 0
- .word 29452
- .word 45231
- .word 15297
- .word 0
- .word 0
- .word 0
- .word 26208
- .word 49689
- .word 15266
- .word 0
- .word 0
- .word 0
- .word 37900
- .word 44002
- .word 15235
- .word 0
- .word 0
- .word 0
- .word 57340
- .word 33800
- .word 15204
- .word 0
- .word 0
- .word 0
- .word 27544
- .word 50178
- .word 15173
- .word 0
- .word 0
- .word 0
- .word 6168
- .word 40132
- .word 15142
- .word 0
- .word 0
- .word 0
- .word 21392
- .word 43702
- .word 15109
- .word 0
- .word 0
- .word 0
- .word 45168
- .word 54372
- .word 15081
- .word 0
- .word 0
- .word 0
- .word 8986
- .word 40688
- .word 15050
- .word 0
- .word 0
- .word 0
- .word 1648
- .word 53745
- .word 15018
- .word 0
- .word 0
- .word 0
- .word 30520
- .word 55795
- .word 14986
- .word 0
- .word 0
- .word 0
- .word 43060
- .word 32914
- .word 14956
- .word 0
- .word 0
- .word 0
- .word 46172
- .word 52771
- .word 14925
- .word 0
- .word 0
- .word 0
- .word 14056
- .word 45285
- .word 14893
- .word 0
- .word 0
- .word 0
- .word 53590
- .word 44868
- .word 14864
- .word 0
- .word 0
- .word 0
- .word 40786
- .word 35970
- .word 14833
- .word 0
- .word 0
- .word 0
- .word 33436
- .word 65411
- .word 14801
- .word 0
- .word 0
- .word 0
- .word 32006
- .word 61382
- .word 14771
- .word 0
- .word 0
- .word 0
- .word 37856
- .word 45239
- .word 14738
- .word 0
- .word 0
- .word 0
- .word 60894
- .word 49555
- .word 14709
- .word 0
- .word 0
- .word 0
- .word 48064
- .word 53065
- .word 14674
- .word 0
- .word 0
- .word 0
- .word 48624
- .word 54844
- .word 14647
- .word 0
- .word 0
- .word 0
- .word 7988
- .word 40762
- .word 14616
- .word 0
- .word 0
- .word 0
- .word 16270
- .word 58745
- .word 14585
- .word 0
- .word 0
- .word 0
- .word 37064
- .word 50168
- .word 14553
- .word 0
- .word 0
- .word 0
- .word 18624
- .word 63736
- .word 14519
- .word 0
- .word 0
- .word 0
- .word 60758
- .word 44966
- .word 14492
- .word 0
- .word 0
- .word 0
- .word 33304
- .word 47465
- .word 14461
- .word 0
- .word 0
- .word 0
- .word 6226
- .word 60503
- .word 14430
- .word 0
- .word 0
- .word 0
- .word 26380
- .word 54900
- .word 14398
- .word 0
- .word 0
- .word 0
- .word 44352
- .word 49860
- .word 14368
- .word 0
- .word 0
- .word 0
- .word 11904
- .word 42646
- .word 14337
- .word 0
- .word 0
- .word 0
- .word 55296
- .word 50279
- .word 14300
- .word 0
- .word 0
- .word 0
- .word 15474
- .word 50606
- .word 14275
- .word 0
- .word 0
- .word 0
- .word 45062
- .word 44137
- .word 14244
- .word 0
- .word 0
- .word 0
- .word 13472
- .word 36063
- .word 14210
- .word 0
- .word 0
- .word 0
- .word 40658
- .word 53854
- .word 14182
- .word 0
- .word 0
- .word 0
- .word 28652
- .word 43690
- .word 14151
- .word 0
- .word 0
- .word 0
- .word 24640
- .word 64348
- .word 14118
- .word 0
- .word 0
- .word 0
- .word 30284
- .word 41980
- .word 14088
- .word 0
- .word 0
- .word 0
- .word 45652
- .word 38222
- .word 14057
- .word 0
- .word 0
- .word 0
- .word 15900
- .word 62940
- .word 14026
- .word 0
- .word 0
- .word 0
- .word 31494
- .word 50741
- .word 13996
- .word 0
- .word 0
- .word 0
- .word 43194
- .word 55096
- .word 13965
- .word 0
- .word 0
- .word 0
- .word 1740
- .word 45646
- .word 13933
- .word 0
- .word 0
- .word 0
- .word 28936
- .word 44150
- .word 13903
- .word 0
- .word 0
- .word 0
- .word 8996
- .word 42955
- .word 13872
- .word 0
- .word 0
- .word 0
- .word 44096
- .word 61205
- .word 13839
- .word 0
- .word 0
- .word 0
- .word 44614
- .word 54550
- .word 13810
- .word 0
- .word 0
- .word 0
- .word 24926
- .word 57347
- .word 13779
- .word 0
- .word 0
- .word 0
- .word 3312
- .word 61415
- .word 13745
- .word 0
- .word 0
- .word 0
- .word 64336
- .word 63884
- .word 13717
- .word 0
- .word 0
- .word 0
- .word 2748
- .word 62259
- .word 13685
- .word 0
- .word 0
- .word 0
- .word 56672
- .word 51775
- .word 13653
- .word 0
- .word 0
- .word 0
- .word 32438
- .word 55423
- .word 13624
- .word 0
- .word 0
- .word 0
- .word 17652
- .word 45713
- .word 13593
- .word 0
- .word 0
- .word 0
- .word 65408
- .word 51586
- .word 13558
- .word 0
- .word 0
- .word 0
- .word 40416
- .word 55736
- .word 13531
- .word 0
- .word 0
- .word 0
- .word 52546
- .word 37734
- .word 13500
- .word 0
- .word 0
- .word 0
- .word 48880
- .word 64238
- .word 13469
- .word 0
- .word 0
- .word 0
- .word 56004
- .word 46833
- .word 13437
- .word 0
- .word 0
- .word 0
- .word 61760
- .word 38110
- .word 13405
- .word 0
- .word 0
- .word 0
- .word 41496
- .word 35659
- .word 13374
- .word 0
- .word 0
- .word 0
- .word 25472
- .word 41269
- .word 13342
- .word 0
- .word 0
- .word 0
- .word 45444
- .word 36018
- .word 13314
- .word 0
- .word 0
- .word 0
- .word 6510
- .word 56417
- .word 13283
- .word 0
- .word 0
- .word 0
- .word 3072
- .word 56837
- .word 13252
- .word 0
- .word 0
- .word 0
- .word 61338
- .word 48440
- .word 13221
- .word 0
- .word 0
- .word 0
- .word 49568
- .word 57088
- .word 13189
- .word 0
- .word 0
- .word 0
- .word 4240
- .word 39283
- .word 13157
- .word 0
- .word 0
- .word 0
- .word 18562
- .word 33537
- .word 13128
- .word 0
- .word 0
- .word 0
- .word 31422
- .word 44487
- .word 13097
- .word 0
- .word 0
- .word 0
- .word 31930
- .word 60459
- .word 13066
- .word 0
- .word 0
- .word 0
- .word 42272
- .word 36641
- .word 13033
- .word 0
- .word 0
- .word 0
- .word 28940
- .word 36150
- .word 13004
- .word 0
- .word 0
- .word 0
- .word 21010
- .word 50925
- .word 12973
- .word 0
- .word 0
- .word 0
- .word 29448
- .word 64886
- .word 12941
- .word 0
- .word 0
- .word 0
- .word 20500
- .word 54600
- .word 12911
- .word 0
- .word 0
- .word 0
- .word 54258
- .word 46233
- .word 12880
- .word 0
- .word 0
- .word 0
- .word 32628
- .word 42502
- .word 12848
- .word 0
- .word 0
- .word 0
- .word 61608
- .word 55072
- .word 12818
- .word 0
- .word 0
- .word 0
- .word 6236
- .word 57871
- .word 12786
- .word 0
- .word 0
- .word 0
- .word 42408
- .word 34616
- .word 12756
- .word 0
- .word 0
- .word 0
- .word 56692
- .word 51963
- .word 12724
- .word 0
- .word 0
- .word 0
- .word 39094
- .word 48526
- .word 12694
- .word 0
- .word 0
- .word 0
- .word 59870
- .word 38783
- .word 12663
- .word 0
- .word 0
- .word 0
- .word 26560
- .word 33165
- .word 12632
- .word 0
- .word 0
- .word 0
- .word 58666
- .word 37666
- .word 12601
- .word 0
- .word 0
- .word 0
- .word 58728
- .word 39788
- .word 12569
- .word 0
- .word 0
- .word 0
- .word 9048
- .word 43530
- .word 12538
- .word 0
- .word 0
- .word 0
- .word 58496
- .word 57659
- .word 12505
- .word 0
- .word 0
- .word 0
- .word 12324
- .word 37025
- .word 12477
- .word 0
- .word 0
- .word 0
- .word 38432
- .word 55856
- .word 12445
- .word 0
- .word 0
- .word 0
- .word 35210
- .word 45960
- .word 12415
- .word 0
- .word 0
- .word 0
- .word 45644
- .word 51345
- .word 12384
- .word 0
- .word 0
- .word 0
- .word 32854
- .word 63883
- .word 12353
- .word 0
- .word 0
- .word 0
- .word 29348
- .word 41450
- .word 12321
- .word 0
- .word 0
- .word 0
- .word 27384
- .word 38024
- .word 12289
- .word 0
- .word 0
- .word 0
- .word 57356
- .word 57291
- .word 12260
- .word 0
- .word 0
- .word 0
- .word 61164
- .word 51521
- .word 12228
- .word 0
- .word 0
- .word 0
- .word 21472
- .word 59151
- .word 12196
- .word 0
- .word 0
- .word 0
- .word 36704
- .word 39943
- .word 12165
- .word 0
- .word 0
- .word 0
- .word 45864
- .word 50151
- .word 12136
- .word 0
- .word 0
- .word 0
- .word 37892
- .word 63687
- .word 12104
- .word 0
- .word 0
- .word 0
- .word 14560
- .word 51615
- .word 12073
- .word 0
- .word 0
- .word 0
- .word 38776
- .word 55684
- .word 12041
- .word 0
- .word 0
- .word 0
- .word 59136
- .word 53570
- .word 12010
- .word 0
- .word 0
- .word 0
- .word 55556
- .word 37955
- .word 11981
- .word 0
- .word 0
- .word 0
- .word 54458
- .word 44670
- .word 11950
- .word 0
- .word 0
- .word 0
- .word 36446
- .word 34084
- .word 11919
- .word 0
- .word 0
- .word 0
- .word 46416
- .word 51693
- .word 11886
- .word 0
- .word 0
- .word 0
- .word 21432
- .word 34376
- .word 11857
- .word 0
- .word 0
- .word 0
- .word 56036
- .word 34809
- .word 11826
- .word 0
- .word 0
- .word 0
- .word 10562
- .word 55654
- .word 11795
- .word 0
- .word 0
- .word 0
- .word 20264
- .word 53052
- .word 11763
- .word 0
- .word 0
- .word 0
- .word 64064
- .word 50415
- .word 11729
- .word 0
- .word 0
- .word 0
- .word 17444
- .word 48295
- .word 11701
- .word 0
- .word 0
- .word 0
- .word 11874
- .word 52677
- .word 11671
- .word 0
- .word 0
- .word 0
- .word 60808
- .word 39275
- .word 11640
- .word 0
- .word 0
- .word 0
- .word 31792
- .word 55677
- .word 11606
- .word 0
- .word 0
- .word 0
- .word 60710
- .word 49006
- .word 11578
- .word 0
- .word 0
- .word 0
- .word 10520
- .word 37403
- .word 11546
- .word 0
- .word 0
- .word 0
- .word 20004
- .word 59470
- .word 11515
- .word 0
- .word 0
- .word 0
- .word 28096
- .word 37612
- .word 11485
- .word 0
- .word 0
- .word 0
- .word 20268
- .word 44280
- .word 11453
- .word 0
- .word 0
- .word 0
- .word 50740
- .word 61588
- .word 11422
- .word 0
- .word 0
- .word 0
- .word 56432
- .word 58835
- .word 11390
- .word 0
- .word 0
- .word 0
- .word 8576
- .word 42496
- .word 11355
- .word 0
- .word 0
- .word 0
- .word 33920
- .word 54912
- .word 11324
- .word 0
- .word 0
- .word 0
- .word 35620
- .word 54843
- .word 11298
- .word 0
- .word 0
- .word 0
- .word 736
- .word 43591
- .word 11264
- .word 0
- .word 0
- .word 0
- .word 39632
- .word 61060
- .word 11235
- .word 0
- .word 0
- .word 0
- .word 63452
- .word 63129
- .word 11206
- .word 0
- .word 0
- .word 0
- .word 56798
- .word 58512
- .word 11175
- .word 0
- .word 0
- .word 0
- .word 13472
- .word 46333
- .word 11141
- .word 0
- .word 0
- .word 0
- .word 37300
- .word 36598
- .word 11112
- .word 0
- .word 0
- .word 0
- .word 41952
- .word 41639
- .word 11079
- .word 0
- .word 0
- .word 0
- .word 52452
- .word 33459
- .word 11050
- .word 0
- .word 0
- .word 0
- .word 58558
- .word 33287
- .word 11020
- .word 0
- .word 0
- .word 0
- .word 7570
- .word 43843
- .word 10989
- .word 0
- .word 0
- .word 0
- .word 59416
- .word 63990
- .word 10957
- .word 0
- .word 0
- .word 0
- .word 65298
- .word 47744
- .word 10927
- .word 0
- .word 0
- .word 0
- .word 21076
- .word 34089
- .word 10896
- .word 0
- .word 0
- .word 0
- .word 7048
- .word 57394
- .word 10865
- .word 0
- .word 0
- .word 0
- .word 12872
- .word 55405
- .word 10832
- .word 0
- .word 0
- .word 0
- .word 12608
- .word 51669
- .word 10798
- .word 0
- .word 0
- .word 0
- .word 5350
- .word 48455
- .word 10772
- .word 0
- .word 0
- .word 0
- .word 23568
- .word 58692
- .word 10740
- .word 0
- .word 0
- .word 0
- .word 40784
- .word 37046
- .word 10708
- .word 0
- .word 0
- .word 0
- .word 38992
- .word 43861
- .word 10678
- .word 0
- .word 0
- .word 0
- .word 10064
- .word 40199
- .word 10648
- .word 0
- .word 0
- .word 0
- .word 26368
- .word 35771
- .word 10611
- .word 0
- .word 0
- .word 0
- .word 23994
- .word 60721
- .word 10586
- .word 0
- .word 0
- .word 0
- .word 25052
- .word 34302
- .word 10554
- .word 0
- .word 0
- .word 0
- .word 39842
- .word 54964
- .word 10524
- .word 0
- .word 0
- .word 0
- .word 11568
- .word 58277
- .word 10491
- .word 0
- .word 0
- .word 0
- .word 26160
- .word 46438
- .word 10461
- .word 0
- .word 0
- .word 0
- .word 23252
- .word 43049
- .word 10431
- .word 0
- .word 0
- .word 0
- .word 35288
- .word 58000
- .word 10400
- .word 0
- .word 0
- .word 0
- .word 14614
- .word 50216
- .word 10369
- .word 0
- .word 0
- .word 0
- .word 1168
- .word 48804
- .word 10336
- .word 0
- .word 0
- .word 0
- .word 60934
- .word 33006
- .word 10307
- .word 0
- .word 0
- .word 0
- .word 64512
- .word 62247
- .word 10272
- .word 0
- .word 0
- .word 0
- .word 59968
- .word 43121
- .word 10240
- .word 0
- .word 0
- .word 0
- .word 25560
- .word 39974
- .word 10212
- .word 0
- .word 0
- .word 0
- .word 1978
- .word 49353
- .word 10183
- .word 0
- .word 0
- .word 0
- .word 16290
- .word 38807
- .word 10152
- .word 0
- .word 0
- .word 0
- .word 8646
- .word 65226
- .word 10121
- .word 0
- .word 0
- .word 0
- .word 56896
- .word 34317
- .word 10088
- .word 0
- .word 0
- .word 0
- .word 40136
- .word 39118
- .word 10057
- .word 0
- .word 0
- .word 0
- .word 14200
- .word 41756
- .word 10026
- .word 0
- .word 0
- .word 0
- .word 59256
- .word 63202
- .word 9995
- .word 0
- .word 0
- .word 0
- .word 22968
- .word 63553
- .word 9965
- .word 0
- .word 0
- .word 0
- .word 736
- .word 44292
- .word 9933
- .word 0
- .word 0
- .word 0
- .word 23186
- .word 37760
- .word 9904
- .word 0
- .word 0
- .word 0
- .word 51008
- .word 34950
- .word 9869
- .word 0
- .word 0
- .word 0
- .word 1664
- .word 64248
- .word 9836
- .word 0
- .word 0
- .word 0
- .word 64352
- .word 35199
- .word 9811
- .word 0
- .word 0
- .word 0
- .word 34656
- .word 63747
- .word 9780
- .word 0
- .word 0
- .word 0
- .word 44330
- .word 49864
- .word 9749
- .word 0
- .word 0
- .word 0
- .word 11654
- .word 35567
- .word 9718
- .word 0
- .word 0
- .word 0
- .word 7924
- .word 58919
- .word 9686
- .word 0
- .word 0
- .word 0
- .word 2532
- .word 32800
- .word 9655
- .word 0
- .word 0
- .word 0
- .word 30024
- .word 53799
- .word 9624
- .word 0
- .word 0
- .word 0
- .word 30172
- .word 64347
- .word 9593
- .word 0
- .word 0
- .word 0
- .word 60036
- .word 51382
- .word 9562
- .word 0
- .word 0
- .word 0
- .word 58576
- .word 33093
- .word 9531
- .word 0
- .word 0
- .word 0
- .word 13888
- .word 38760
- .word 9500
- .word 0
- .word 0
- .word 0
- .word 9322
- .word 52460
- .word 9470
- .word 0
- .word 0
- .word 0
- .word 20944
- .word 41077
- .word 9437
- .word 0
- .word 0
- .word 0
- .word 17976
- .word 41861
- .word 9407
- .word 0
- .word 0
- .word 0
- .word 55176
- .word 55158
- .word 9377
- .word 0
- .word 0
- .word 0
- .word 4976
- .word 35223
- .word 9346
- .word 0
- .word 0
- .word 0
- .word 7816
- .word 39783
- .word 9314
- .word 0
- .word 0
- .word 0
- .word 27656
- .word 55669
- .word 9284
- .word 0
- .word 0
- .word 0
- .word 64944
- .word 53184
- .word 9250
- .word 0
- .word 0
- .word 0
- .word 12544
- .word 49190
- .word 9222
- .word 0
- .word 0
- .word 0
- .word 50612
- .word 44644
- .word 9190
- .word 0
- .word 0
- .word 0
- .word 8832
- .word 63111
- .word 9155
- .word 0
- .word 0
- .word 0
- .word 11744
- .word 36870
- .word 9129
- .word 0
- .word 0
- .word 0
- .word 9404
- .word 63025
- .word 9098
- .word 0
- .word 0
- .word 0
- .word 47316
- .word 43381
- .word 9067
- .word 0
- .word 0
- .word 0
- .word 55716
- .word 47433
- .word 9035
- .word 0
- .word 0
- .word 0
- .word 46414
- .word 48441
- .word 9005
- .word 0
- .word 0
- .word 0
- .word 19116
- .word 39506
- .word 8974
- .word 0
- .word 0
- .word 0
- .word 48060
- .word 53381
- .word 8943
- .word 0
- .word 0
- .word 0
- .word 57112
- .word 50739
- .word 8911
- .word 0
- .word 0
- .word 0
- .word 5840
- .word 60581
- .word 8879
- .word 0
- .word 0
- .word 0
- .word 62112
- .word 57199
- .word 8846
- .word 0
- .word 0
- .word 0
- .word 35908
- .word 59499
- .word 8818
- .word 0
- .word 0
- .word 0
- .word 13760
- .word 48116
- .word 8787
- .word 0
- .word 0
- .word 0
- .word 3136
- .word 56059
- .word 8752
- .word 0
- .word 0
- .word 0
- .word 37596
- .word 39221
- .word 8726
- .word 0
- .word 0
- .word 0
- .word 3232
- .word 48550
- .word 8691
- .word 0
- .word 0
- .word 0
- .word 22872
- .word 42749
- .word 8662
- .word 0
- .word 0
- .word 0
- .word 41948
- .word 40319
- .word 8633
- .word 0
- .word 0
- .word 0
- .word 31196
- .word 64693
- .word 8601
- .word 0
- .word 0
- .word 0
- .word 62052
- .word 52923
- .word 8571
- .word 0
- .word 0
- .word 0
- .word 2750
- .word 33544
- .word 8540
- .word 0
- .word 0
- .word 0
- .word 12462
- .word 46179
- .word 8509
- .word 0
- .word 0
- .word 0
- .word 25128
- .word 45120
- .word 8476
- .word 0
- .word 0
- .word 0
- .word 51634
- .word 62523
- .word 8447
- .word 0
- .word 0
- .word 0
- .word 15758
- .word 42163
- .word 8416
- .word 0
- .word 0
- .word 0
- .word 34022
- .word 36267
- .word 8385
- .word 0
- .word 0
- .word 0
- .word 41252
- .word 39796
- .word 8353
- .word 0
- .word 0
- .word 0
- .word 49782
- .word 54423
- .word 8323
- .word 0
- .word 0
- .word 0
- .word 25428
- .word 42086
- .word 8291
- .word 0
- .word 0
- .word 0
- .word 34388
- .word 44810
- .word 8260
- .word 0
- .word 0
- .word 0
- .word 7456
- .word 64092
- .word 8228
- .word 0
- .word 0
- .word 0
- .word 48336
- .word 62448
- .word 8196
- .word 0
- .word 0
- .word 0
- .word 60912
- .word 61622
- .word 8167
- .word 0
- .word 0
- .word 0
- .word 17852
- .word 37250
- .word 8137
- .word 0
- .word 0
- .word 0
- .word 57940
- .word 56453
- .word 8106
- .word 0
- .word 0
- .word 0
- .word 47256
- .word 59825
- .word 8074
- .word 0
- .word 0
- .word 0
- .word 3774
- .word 59120
- .word 8044
- .word 0
- .word 0
- .word 0
- .word 43448
- .word 62852
- .word 8012
- .word 0
- .word 0
- .word 0
- .word 4840
- .word 57195
- .word 7982
- .word 0
- .word 0
- .word 0
- .word 40862
- .word 52565
- .word 7951
- .word 0
- .word 0
- .word 0
- .word 1440
- .word 60474
- .word 7919
- .word 0
- .word 0
- .word 0
- .word 55520
- .word 38648
- .word 7889
- .word 0
- .word 0
- .word 0
- .word 15316
- .word 52422
- .word 7857
- .word 0
- .word 0
- .word 0
- .word 18704
- .word 47227
- .word 7827
- .word 0
- .word 0
- .word 0
- .word 48892
- .word 54283
- .word 7795
- .word 0
- .word 0
- .word 0
- .word 12670
- .word 41990
- .word 7765
- .word 0
- .word 0
- .word 0
- .word 27570
- .word 49842
- .word 7734
- .word 0
- .word 0
- .word 0
- .word 47230
- .word 47992
- .word 7703
- .word 0
- .word 0
- .word 0
- .word 41020
- .word 56253
- .word 7671
- .word 0
- .word 0
- .word 0
- .word 23404
- .word 58312
- .word 7641
- .word 0
- .word 0
- .word 0
- .word 35176
- .word 51854
- .word 7610
- .word 0
- .word 0
- .word 0
- .word 49188
- .word 59051
- .word 7578
- .word 0
- .word 0
- .word 0
- .word 16656
- .word 54507
- .word 7546
- .word 0
- .word 0
- .word 0
- .word 41320
- .word 48565
- .word 7517
- .word 0
- .word 0
- .word 0
- .word 302
- .word 42490
- .word 7486
- .word 0
- .word 0
- .word 0
- .word 26680
- .word 39967
- .word 7454
- .word 0
- .word 0
- .word 0
- .word 41304
- .word 43638
- .word 7424
- .word 0
- .word 0
- .word 0
- .word 2314
- .word 48533
- .word 7393
- .word 0
- .word 0
- .word 0
- .word 63294
- .word 35693
- .word 7362
- .word 0
- .word 0
- .word 0
- .word 24538
- .word 48319
- .word 7331
- .word 0
- .word 0
- .word 0
- .word 56296
- .word 47263
- .word 7300
- .word 0
- .word 0
- .word 0
- .word 28236
- .word 38599
- .word 7268
- .word 0
- .word 0
- .word 0
- .word 6594
- .word 62116
- .word 7238
- .word 0
- .word 0
- .word 0
- .word 47104
- .word 63573
- .word 7198
- .word 0
- .word 0
- .word 0
- .word 34812
- .word 34303
- .word 7176
- .word 0
- .word 0
- .word 0
- .word 5144
- .word 33695
- .word 7145
- .word 0
- .word 0
- .word 0
- .word 24966
- .word 55768
- .word 7114
- .word 0
- .word 0
- .word 0
- .word 62720
- .word 43946
- .word 7078
- .word 0
- .word 0
- .word 0
- .word 31542
- .word 56062
- .word 7052
- .word 0
- .word 0
- .word 0
- .word 62356
- .word 59096
- .word 7020
- .word 0
- .word 0
- .word 0
- .word 28412
- .word 40533
- .word 6990
- .word 0
- .word 0
- .word 0
- .word 24080
- .word 50467
- .word 6958
- .word 0
- .word 0
- .word 0
- .word 33296
- .word 46841
- .word 6925
- .word 0
- .word 0
- .word 0
- .word 39600
- .word 38627
- .word 6897
- .word 0
- .word 0
- .word 0
- .word 14436
- .word 37607
- .word 6865
- .word 0
- .word 0
- .word 0
- .word 39032
- .word 56421
- .word 6833
- .word 0
- .word 0
- .word 0
- .word 64032
- .word 54987
- .word 6804
- .word 0
- .word 0
- .word 0
- .word 27648
- .word 42212
- .word 6768
- .word 0
- .word 0
- .word 0
- .word 43840
- .word 46107
- .word 6739
- .word 0
- .word 0
- .word 0
- .word 17316
- .word 36574
- .word 6711
- .word 0
- .word 0
- .word 0
- .word 8928
- .word 37652
- .word 6677
- .word 0
- .word 0
- .word 0
- .word 24944
- .word 47433
- .word 6648
- .word 0
- .word 0
- .word 0
- .word 27392
- .word 57430
- .word 6616
- .word 0
- .word 0
- .word 0
- .word 39848
- .word 43340
- .word 6585
- .word 0
- .word 0
- .word 0
- .word 64160
- .word 43542
- .word 6555
- .word 0
- .word 0
- .word 0
- .word 35226
- .word 63015
- .word 6525
- .word 0
- .word 0
- .word 0
- .word 40736
- .word 64368
- .word 6493
- .word 0
- .word 0
- .word 0
- .word 42168
- .word 49526
- .word 6462
- .word 0
- .word 0
- .word 0
- .word 45596
- .word 34243
- .word 6432
- .word 0
- .word 0
- .word 0
- .word 20690
- .word 39705
- .word 6401
- .word 0
- .word 0
- .word 0
- .word 54448
- .word 46856
- .word 6368
- .word 0
- .word 0
- .word 0
- .word 64392
- .word 62736
- .word 6337
- .word 0
- .word 0
- .word 0
- .word 12780
- .word 56461
- .word 6307
- .word 0
- .word 0
- .word 0
- .word 15360
- .word 49145
- .word 6277
- .word 0
- .word 0
- .word 0
- .word 20512
- .word 49931
- .word 6242
- .word 0
- .word 0
- .word 0
- .word 54512
- .word 55820
- .word 6212
- .word 0
- .word 0
- .word 0
- .word 8402
- .word 39333
- .word 6184
- .word 0
- .word 0
- .word 0
- .word 34094
- .word 53593
- .word 6153
- .word 0
- .word 0
- .word 0
- .word 31960
- .word 38817
- .word 6121
- .word 0
- .word 0
- .word 0
- .word 16954
- .word 39291
- .word 6091
- .word 0
- .word 0
- .word 0
- .word 49600
- .word 48765
- .word 6056
- .word 0
- .word 0
- .word 0
- .word 59580
- .word 56541
- .word 6029
- .word 0
- .word 0
- .word 0
- .word 35624
- .word 44550
- .word 5998
- .word 0
- .word 0
- .word 0
- .word 4142
- .word 47316
- .word 5967
- .word 0
- .word 0
- .word 0
- .word 43520
- .word 43612
- .word 5935
- .word 0
- .word 0
- .word 0
- .word 20976
- .word 40896
- .word 5902
- .word 0
- .word 0
- .word 0
- .word 63576
- .word 57729
- .word 5874
- .word 0
- .word 0
- .word 0
- .word 37288
- .word 33122
- .word 5843
- .word 0
- .word 0
- .word 0
- .word 24384
- .word 52079
- .word 5809
- .word 0
- .word 0
- .word 0
- .word 47952
- .word 58719
- .word 5779
- .word 0
- .word 0
- .word 0
- .word 44242
- .word 55445
- .word 5750
- .word 0
- .word 0
- .word 0
- .word 61232
- .word 38847
- .word 5716
- .word 0
- .word 0
- .word 0
- .word 63232
- .word 46039
- .word 5683
- .word 0
- .word 0
- .word 0
- .word 13396
- .word 42933
- .word 5657
- .word 0
- .word 0
- .word 0
- .word 27392
- .word 43305
- .word 5622
- .word 0
- .word 0
- .word 0
- .word 40708
- .word 35319
- .word 5595
- .word 0
- .word 0
- .word 0
- .word 44408
- .word 55685
- .word 5564
- .word 0
- .word 0
- .word 0
- .word 42090
- .word 44607
- .word 5533
- .word 0
- .word 0
- .word 0
- .word 25504
- .word 53466
- .word 5500
- .word 0
- .word 0
- .word 0
- .word 24208
- .word 33149
- .word 5470
- .word 0
- .word 0
- .word 0
- .word 5268
- .word 45375
- .word 5440
- .word 0
- .word 0
- .word 0
- .word 144
- .word 40000
- .word 5409
- .word 0
- .word 0
- .word 0
- .word 56688
- .word 52358
- .word 5376
- .word 0
- .word 0
- .word 0
- .word 25848
- .word 56175
- .word 5345
- .word 0
- .word 0
- .word 0
- .word 57900
- .word 44055
- .word 5315
- .word 0
- .word 0
- .word 0
- .word 24800
- .word 43437
- .word 5283
- .word 0
- .word 0
- .word 0
- .word 17984
- .word 54872
- .word 5249
- .word 0
- .word 0
- .word 0
- .word 25744
- .word 41345
- .word 5223
- .word 0
- .word 0
- .word 0
- .word 7668
- .word 43682
- .word 5191
- .word 0
- .word 0
- .word 0
- .word 47434
- .word 36705
- .word 5161
- .word 0
- .word 0
- .word 0
- .word 20888
- .word 40323
- .word 5129
- .word 0
- .word 0
- .word 0
- .word 3962
- .word 43032
- .word 5099
- .word 0
- .word 0
- .word 0
- .word 50270
- .word 49260
- .word 5068
- .word 0
- .word 0
- .word 0
- .word 20160
- .word 64041
- .word 5032
- .word 0
- .word 0
- .word 0
- .word 25624
- .word 36013
- .word 5004
- .word 0
- .word 0
- .word 0
- .word 48328
- .word 59345
- .word 4975
- .word 0
- .word 0
- .word 0
- .word 51508
- .word 63920
- .word 4943
- .word 0
- .word 0
- .word 0
- .word 27872
- .word 39135
- .word 4913
- .word 0
- .word 0
- .word 0
- .word 13590
- .word 58857
- .word 4882
- .word 0
- .word 0
- .word 0
- .word 50880
- .word 61323
- .word 4847
- .word 0
- .word 0
- .word 0
- .word 44802
- .word 37181
- .word 4820
- .word 0
- .word 0
- .word 0
- .word 53808
- .word 57813
- .word 4789
- .word 0
- .word 0
- .word 0
- .word 64424
- .word 49714
- .word 4757
- .word 0
- .word 0
- .word 0
- .word 31652
- .word 44011
- .word 4727
- .word 0
- .word 0
- .word 0
- .word 28252
- .word 50834
- .word 4696
- .word 0
- .word 0
- .word 0
- .word 30370
- .word 38742
- .word 4665
- .word 0
- .word 0
- .word 0
- .word 57728
- .word 58403
- .word 4628
- .word 0
- .word 0
- .word 0
- .word 35900
- .word 37112
- .word 4603
- .word 0
- .word 0
- .word 0
- .word 40764
- .word 40914
- .word 4572
- .word 0
- .word 0
- .word 0
- .word 21472
- .word 46910
- .word 4541
- .word 0
- .word 0
- .word 0
- .word 17854
- .word 35030
- .word 4510
- .word 0
- .word 0
- .word 0
- .word 4378
- .word 35776
- .word 4479
- .word 0
- .word 0
- .word 0
- .word 57962
- .word 55295
- .word 4448
- .word 0
- .word 0
- .word 0
- .word 64352
- .word 56717
- .word 4415
- .word 0
- .word 0
- .word 0
- .word 37744
- .word 49416
- .word 4384
- .word 0
- .word 0
- .word 0
- .word 38484
- .word 35759
- .word 4355
- .word 0
- .word 0
- .word 0
- .word 55020
- .word 54969
- .word 4324
- .word 0
- .word 0
- .word 0
- .word 9188
- .word 55223
- .word 4292
- .word 0
- .word 0
- .word 0
- .word 6822
- .word 43079
- .word 4262
- .word 0
- .word 0
- .word 0
- .word 48870
- .word 40943
- .word 4231
- .word 0
- .word 0
- .word 0
- .word 9936
- .word 42731
- .word 4198
- .word 0
- .word 0
- .word 0
- .word 23430
- .word 43136
- .word 4169
- .word 0
- .word 0
- .word 0
- .word 4700
- .word 55665
- .word 4137
- .word 0
- .word 0
- .word 0
- .word 8056
- .word 40216
- .word 4106
- .word 0
- .word 0
- .word 0
- .word 3716
- .word 45403
- .word 4075
- .word 0
- .word 0
- .word 0
- .word 53440
- .word 49488
- .word 4044
- .word 0
- .word 0
- .word 0
- .word 41776
- .word 50188
- .word 4013
- .word 0
- .word 0
- .word 0
- .word 20994
- .word 64556
- .word 3983
- .word 0
- .word 0
- .word 0
- .word 16252
- .word 60661
- .word 3951
- .word 0
- .word 0
- .word 0
- .word 61252
- .word 65021
- .word 3920
- .word 0
- .word 0
- .word 0
- .word 16236
- .word 43803
- .word 3889
- .word 0
- .word 0
- .word 0
- .word 63064
- .word 35308
- .word 3857
- .word 0
- .word 0
- .word 0
- .word 49096
- .word 39848
- .word 3828
- .word 0
- .word 0
- .word 0
- .word 15680
- .word 48673
- .word 3797
- .word 0
- .word 0
- .word 0
- .word 48068
- .word 50957
- .word 3766
- .word 0
- .word 0
- .word 0
- .word 20824
- .word 56086
- .word 3734
- .word 0
- .word 0
- .word 0
- .word 46504
- .word 43224
- .word 3704
- .word 0
- .word 0
- .word 0
- .word 52428
- .word 46094
- .word 3672
- .word 0
- .word 0
- .word 0
- .word 17548
- .word 52066
- .word 3642
- .word 0
- .word 0
- .word 0
- .word 61738
- .word 35565
- .word 3611
- .word 0
- .word 0
- .word 0
- .word 31184
- .word 50588
- .word 3579
- .word 0
- .word 0
- .word 0
- .word 1716
- .word 52681
- .word 3549
- .word 0
- .word 0
- .word 0
- .word 44656
- .word 43385
- .word 3518
- .word 0
- .word 0
- .word 0
- .word 12668
- .word 43259
- .word 3486
- .word 0
- .word 0
- .word 0
- .word 24544
- .word 35408
- .word 3453
- .word 0
- .word 0
- .word 0
- .word 28854
- .word 65018
- .word 3425
- .word 0
- .word 0
- .word 0
- .word 5696
- .word 40391
- .word 3393
- .word 0
- .word 0
- .word 0
- .word 39580
- .word 56400
- .word 3363
- .word 0
- .word 0
- .word 0
- .word 20428
- .word 39579
- .word 3332
- .word 0
- .word 0
- .word 0
- .word 32328
- .word 36727
- .word 3301
- .word 0
- .word 0
- .word 0
- .word 34020
- .word 54457
- .word 3270
- .word 0
- .word 0
- .word 0
- .word 34016
- .word 48400
- .word 3238
- .word 0
- .word 0
- .word 0
- .word 6922
- .word 51417
- .word 3208
- .word 0
- .word 0
- .word 0
- .word 27208
- .word 64641
- .word 3176
- .word 0
- .word 0
- .word 0
- .word 1802
- .word 48886
- .word 3146
- .word 0
- .word 0
- .word 0
- .word 35440
- .word 61590
- .word 3115
- .word 0
- .word 0
- .word 0
- .word 60610
- .word 51604
- .word 3084
- .word 0
- .word 0
- .word 0
- .word 5440
- .word 38199
- .word 3050
- .word 0
- .word 0
- .word 0
- .word 6914
- .word 43867
- .word 3022
- .word 0
- .word 0
- .word 0
- .word 24000
- .word 45256
- .word 2989
- .word 0
- .word 0
- .word 0
- .word 51496
- .word 57396
- .word 2959
- .word 0
- .word 0
- .word 0
- .word 11538
- .word 46256
- .word 2929
- .word 0
- .word 0
- .word 0
- .word 36802
- .word 48020
- .word 2898
- .word 0
- .word 0
- .word 0
- .word 57910
- .word 57903
- .word 2867
- .word 0
- .word 0
- .word 0
- .word 47484
- .word 48798
- .word 2835
- .word 0
- .word 0
- .word 0
- .word 57766
- .word 57709
- .word 2805
- .word 0
- .word 0
- .word 0
- .word 54064
- .word 47856
- .word 2774
- .word 0
- .word 0
- .word 0
- .word 49340
- .word 48080
- .word 2743
- .word 0
- .word 0
- .word 0
- .word 36454
- .word 56731
- .word 2712
- .word 0
- .word 0
- .word 0
- .word 51548
- .word 63385
- .word 2681
- .word 0
- .word 0
- .word 0
- .word 56000
- .word 48716
- .word 2645
- .word 0
- .word 0
- .word 0
- .word 44992
- .word 50040
- .word 2615
- .word 0
- .word 0
- .word 0
- .word 43136
- .word 58177
- .word 2585
- .word 0
- .word 0
- .word 0
- .word 49730
- .word 33270
- .word 2557
- .word 0
- .word 0
- .word 0
- .word 29808
- .word 51063
- .word 2526
- .word 0
- .word 0
- .word 0
- .word 25276
- .word 46724
- .word 2494
- .word 0
- .word 0
- .word 0
- .word 17324
- .word 35928
- .word 2463
- .word 0
- .word 0
- .word 0
- .word 52284
- .word 63916
- .word 2433
- .word 0
- .word 0
- .word 0
- .word 5414
- .word 46704
- .word 2402
- .word 0
- .word 0
- .word 0
- .word 51710
- .word 57168
- .word 2371
- .word 0
- .word 0
- .word 0
- .word 27366
- .word 49253
- .word 2340
- .word 0
- .word 0
- .word 0
- .word 45332
- .word 53033
- .word 2309
- .word 0
- .word 0
- .word 0
- .word 54152
- .word 37418
- .word 2276
- .word 0
- .word 0
- .word 0
- .word 53076
- .word 47398
- .word 2247
- .word 0
- .word 0
- .word 0
- .word 14374
- .word 59477
- .word 2216
- .word 0
- .word 0
- .word 0
- .word 59336
- .word 33435
- .word 2184
- .word 0
- .word 0
- .word 0
- .word 21612
- .word 43267
- .word 2154
- .word 0
- .word 0
- .word 0
- .word 34664
- .word 39372
- .word 2121
- .word 0
- .word 0
- .word 0
- .word 172
- .word 62761
- .word 2091
- .word 0
- .word 0
- .word 0
- .word 9816
- .word 40715
- .word 2060
- .word 0
- .word 0
- .word 0
- .word 65116
- .word 40481
- .word 2030
- .word 0
- .word 0
- .word 0
- .word 28066
- .word 39184
- .word 1999
- .word 0
- .word 0
- .word 0
- .word 37408
- .word 63923
- .word 1968
- .word 0
- .word 0
- .word 0
- .word 15760
- .word 42305
- .word 1937
- .word 0
- .word 0
- .word 0
- .word 28236
- .word 59340
- .word 1905
- .word 0
- .word 0
- .word 0
- .word 43258
- .word 59402
- .word 1875
- .word 0
- .word 0
- .word 0
- .word 19988
- .word 50087
- .word 1844
- .word 0
- .word 0
- .word 0
- .word 63456
- .word 47833
- .word 1810
- .word 0
- .word 0
- .word 0
- .word 65184
- .word 61426
- .word 1781
- .word 0
- .word 0
- .word 0
- .word 52982
- .word 48456
- .word 1751
- .word 0
- .word 0
- .word 0
- .word 30020
- .word 62809
- .word 1719
- .word 0
- .word 0
- .word 0
- .word 9096
- .word 63061
- .word 1688
- .word 0
- .word 0
- .word 0
- .word 59648
- .word 44374
- .word 1654
- .word 0
- .word 0
- .word 0
- .word 11456
- .word 33847
- .word 1625
- .word 0
- .word 0
- .word 0
- .word 12392
- .word 50500
- .word 1595
- .word 0
- .word 0
- .word 0
- .word 56432
- .word 59196
- .word 1563
- .word 0
- .word 0
- .word 0
- .word 61008
- .word 40265
- .word 1532
- .word 0
- .word 0
- .word 0
- .word 37842
- .word 33270
- .word 1503
- .word 0
- .word 0
- .word 0
- .word 37916
- .word 44543
- .word 1471
- .word 0
- .word 0
- .word 0
- .word 11490
- .word 36421
- .word 1441
- .word 0
- .word 0
- .word 0
- .word 19040
- .word 38397
- .word 1409
- .word 0
- .word 0
- .word 0
- .word 31224
- .word 47162
- .word 1379
- .word 0
- .word 0
- .word 0
- .word 52056
- .word 41461
- .word 1347
- .word 0
- .word 0
- .word 0
- .word 10810
- .word 56374
- .word 1317
- .word 0
- .word 0
- .word 0
- .word 5358
- .word 35086
- .word 1286
- .word 0
- .word 0
- .word 0
- .word 36640
- .word 50226
- .word 1251
- .word 0
- .word 0
- .word 0
- .word 33856
- .word 45597
- .word 1222
- .word 0
- .word 0
- .word 0
- .word 21552
- .word 63128
- .word 1191
- .word 0
- .word 0
- .word 0
- .word 1198
- .word 35616
- .word 1162
- .word 0
- .word 0
- .word 0
- .word 1232
- .word 59506
- .word 1131
- .word 0
- .word 0
- .word 0
- .word 51086
- .word 34963
- .word 1100
- .word 0
- .word 0
- .word 0
- .word 3960
- .word 39061
- .word 1067
- .word 0
- .word 0
- .word 0
- .word 4564
- .word 57134
- .word 1037
- .word 0
- .word 0
- .word 0
- .word 59468
- .word 35285
- .word 1007
- .word 0
- .word 0
- .word 0
- .word 63422
- .word 35431
- .word 976
- .word 0
- .word 0
- .word 0
- .word 38352
- .word 51462
- .word 945
- .word 0
- .word 0
- .word 0
- .word 25806
- .word 55660
- .word 914
- .word 0
- .word 0
- .word 0
- .word 38842
- .word 41327
- .word 883
- .word 0
- .word 0
- .word 0
- .word 17980
- .word 50458
- .word 852
- .word 0
- .word 0
- .word 0
- .word 61194
- .word 59710
- .word 821
- .word 0
- .word 0
- .word 0
- .word 21098
- .word 42086
- .word 790
- .word 0
- .word 0
- .word 0
- .word 16704
- .word 43341
- .word 757
- .word 0
- .word 0
- .word 0
- .word 46316
- .word 52840
- .word 728
- .word 0
- .word 0
- .word 0
- .word 20386
- .word 33936
- .word 697
- .word 0
- .word 0
- .word 0
- .word 20064
- .word 51864
- .word 664
- .word 0
- .word 0
- .word 0
- .word 2268
- .word 57500
- .word 634
- .word 0
- .word 0
- .word 0
- .word 11152
- .word 51171
- .word 604
- .word 0
- .word 0
- .word 0
- .word 23164
- .word 63727
- .word 572
- .word 0
- .word 0
- .word 0
- .word 20514
- .word 40280
- .word 542
- .word 0
- .word 0
- .word 0
- .word 21818
- .word 57922
- .word 511
- .word 0
- .word 0
- .word 0
- .word 32366
- .word 46413
- .word 480
- .word 0
- .word 0
- .word 0
- .word 53972
- .word 43148
- .word 449
- .word 0
- .word 0
- .word 0
- .word 30134
- .word 65133
- .word 418
- .word 0
- .word 0
- .word 0
- .word 15282
- .word 61516
- .word 387
- .word 0
- .word 0
- .word 0
- .word 49872
- .word 49222
- .word 355
- .word 0
- .word 0
- .word 0
- .word 9484
- .word 63958
- .word 325
- .word 0
- .word 0
- .word 0
- .word 47028
- .word 35341
- .word 294
- .word 0
- .word 0
- .word 0
- .word 6770
- .word 58613
- .word 263
- .word 0
- .word 0
- .word 0
- .word 33372
- .word 43448
- .word 232
- .word 0
- .word 0
- .word 0
- .word 27792
- .word 51629
- .word 198
- .word 0
- .word 0
- .word 0
- .word 19712
- .word 53691
- .word 170
- .word 0
- .word 0
- .word 0
- .word 42144
- .word 60929
- .word 135
- .word 0
- .word 0
- .word 0
- .word 35240
- .word 48799
- .word 107
- .word 0
- .word 0
- .word 0
- .word 910
- .word 51212
- .word 77
- .word 0
- .word 0
- .word 0
- .word 65062
- .word 33668
- .word 46
- .word 0
- .word 0
- .word 0
- .word 52624
- .word 51799
- .word 14
- .word 0
- .type __4onpi_31l,@object
- .size __4onpi_31l,6444
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/libm_sincos_huge.S b/libm/x86/libm_sincos_huge.S
deleted file mode 100644
index 4601b87..0000000
--- a/libm/x86/libm_sincos_huge.S
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-# -- Begin __libm_sincos_huge
- .text
- .align 16,0x90
- .hidden __libm_sincos_huge
- .globl __libm_sincos_huge
-__libm_sincos_huge:
-# parameter 1: 8 + %ebp
-# parameter 2: 16 + %ebp
-# parameter 3: 20 + %ebp
-..B1.1:
- pushl %ebp
- movl %esp, %ebp
- andl $-64, %esp
- pushl %esi
- pushl %edi
- pushl %ebx
- subl $52, %esp
- movl 16(%ebp), %eax
- movl 20(%ebp), %edx
- movl %eax, 32(%esp)
- movl %edx, 36(%esp)
-..B1.2:
- fnstcw 30(%esp)
-..B1.3:
- call ..L2
-..L2:
- popl %edi
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi
- movsd 8(%ebp), %xmm1
- movl 12(%ebp), %esi
- movl %esi, %eax
- andl $2147483647, %eax
- andps .L_2il0floatpacket.0@GOTOFF(%edi), %xmm1
- shrl $31, %esi
- movl %eax, 40(%esp)
- cmpl $1104150528, %eax
- movsd %xmm1, 8(%ebp)
- jae ..B1.11
-..B1.4:
- movsd _Pi4Inv@GOTOFF(%edi), %xmm0
- mulsd %xmm1, %xmm0
- movzwl 30(%esp), %edx
- movl %edx, %eax
- andl $768, %eax
- movsd %xmm0, (%esp)
- cmpl $768, %eax
- je ..B1.42
-..B1.5:
- orl $-64768, %edx
- movw %dx, 28(%esp)
-..B1.6:
- fldcw 28(%esp)
-..B1.7:
- movsd 8(%ebp), %xmm1
- movl $1, %ebx
-..B1.8:
- movl %ebx, 12(%esp)
- movl 4(%esp), %ebx
- movl %ebx, %eax
- movl %esi, 8(%esp)
- movl %ebx, %esi
- shrl $20, %esi
- andl $1048575, %eax
- movl %esi, %ecx
- orl $1048576, %eax
- negl %ecx
- movl %eax, %edx
- addl $19, %ecx
- addl $13, %esi
- movl %ecx, 24(%esp)
- shrl %cl, %edx
- movl %esi, %ecx
- shll %cl, %eax
- movl 24(%esp), %ecx
- movl (%esp), %esi
- shrl %cl, %esi
- orl %esi, %eax
- cmpl $1094713344, %ebx
- movsd %xmm1, 16(%esp)
- fldl 16(%esp)
- cmovb %edx, %eax
- movl 8(%esp), %esi
- lea 1(%eax), %edx
- movl %edx, %ebx
- andl $-2, %ebx
- movl %ebx, 16(%esp)
- fildl 16(%esp)
- movl 12(%esp), %ebx
- cmpl $1094713344, 40(%esp)
- jae ..B1.10
-..B1.9:
- fldl _Pi4x3@GOTOFF(%edi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 8+_Pi4x3@GOTOFF(%edi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 16+_Pi4x3@GOTOFF(%edi)
- fmulp %st, %st(1)
- faddp %st, %st(1)
- jmp ..B1.17
-..B1.10:
- fldl _Pi4x4@GOTOFF(%edi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 8+_Pi4x4@GOTOFF(%edi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 16+_Pi4x4@GOTOFF(%edi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 24+_Pi4x4@GOTOFF(%edi)
- fmulp %st, %st(1)
- faddp %st, %st(1)
- jmp ..B1.17
-..B1.11:
- movzwl 30(%esp), %edx
- movl %edx, %eax
- andl $768, %eax
- cmpl $768, %eax
- je ..B1.43
-..B1.12:
- orl $-64768, %edx
- movw %dx, 28(%esp)
-..B1.13:
- fldcw 28(%esp)
-..B1.14:
- movsd 8(%ebp), %xmm1
- movl $1, %ebx
-..B1.15:
- movsd %xmm1, 16(%esp)
- fldl 16(%esp)
- addl $-32, %esp
- lea 32(%esp), %eax
- fstpt (%esp)
- movl $0, 12(%esp)
- movl %eax, 16(%esp)
- call __libm_reduce_pi04l
-..B1.46:
- addl $32, %esp
-..B1.16:
- fldl (%esp)
- lea 1(%eax), %edx
- fldl 8(%esp)
- faddp %st, %st(1)
-..B1.17:
- movl %edx, %ecx
- addl $3, %eax
- shrl $2, %ecx
- andl $1, %ecx
- shrl $2, %eax
- xorl %ecx, %esi
- movl 36(%esp), %ecx
- andl $1, %eax
- andl $3, %ecx
- cmpl $3, %ecx
- jne ..B1.25
-..B1.18:
- fldt 84+_SP@GOTOFF(%edi)
- fld %st(1)
- fmul %st(2), %st
- testb $2, %dl
- fmul %st, %st(1)
- fldt 72+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fmul %st, %st(1)
- fldt 60+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fmul %st, %st(1)
- fldt 48+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fmul %st, %st(1)
- fldt 36+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fmul %st, %st(1)
- fldt 24+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fmul %st, %st(1)
- fldt 12+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fmul %st, %st(1)
- fldt _SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fmul %st, %st(1)
- fldt 84+_CP@GOTOFF(%edi)
- fmul %st(1), %st
- fldt 72+_CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmul %st(1), %st
- fldt 60+_CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmul %st(1), %st
- fldt 48+_CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmul %st(1), %st
- fldt 36+_CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmul %st(1), %st
- fldt 24+_CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmul %st(1), %st
- fldt 12+_CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmul %st(1), %st
- fldt _CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmulp %st, %st(1)
- fldl _ones@GOTOFF(%edi,%esi,8)
- fldl _ones@GOTOFF(%edi,%eax,8)
- je ..B1.22
-..B1.19:
- fmulp %st, %st(4)
- testl %ebx, %ebx
- fxch %st(2)
- fmul %st(3), %st
- movl 32(%esp), %eax
- faddp %st, %st(3)
- fxch %st(2)
- fstpl (%eax)
- fmul %st, %st(1)
- faddp %st, %st(1)
- fstpl 8(%eax)
- je ..B1.21
-..B1.20:
- fldcw 30(%esp)
-..B1.21:
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.22:
- fxch %st(1)
- fmulp %st, %st(4)
- testl %ebx, %ebx
- fxch %st(2)
- fmul %st(3), %st
- movl 32(%esp), %eax
- faddp %st, %st(3)
- fxch %st(2)
- fstpl 8(%eax)
- fmul %st, %st(1)
- faddp %st, %st(1)
- fstpl (%eax)
- je ..B1.24
-..B1.23:
- fldcw 30(%esp)
-..B1.24:
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.25:
- testb $2, 36(%esp)
- je ..B1.33
-..B1.26:
- fld %st(0)
- testb $2, %dl
- fmul %st(1), %st
- fld %st(0)
- fmul %st(1), %st
- je ..B1.30
-..B1.27:
- fstp %st(2)
- fldt 84+_CP@GOTOFF(%edi)
- testl %ebx, %ebx
- fmul %st(2), %st
- fldt 72+_CP@GOTOFF(%edi)
- fmul %st(3), %st
- fldt 60+_CP@GOTOFF(%edi)
- movl 32(%esp), %eax
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(3), %st
- fldt 48+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(3), %st
- fldt 36+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(3), %st
- fldt 24+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(3), %st
- fldt 12+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmulp %st, %st(3)
- fldt _CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmulp %st, %st(1)
- faddp %st, %st(1)
- fldl _ones@GOTOFF(%edi,%esi,8)
- fmul %st, %st(1)
- faddp %st, %st(1)
- fstpl 8(%eax)
- je ..B1.29
-..B1.28:
- fldcw 30(%esp)
-..B1.29:
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.30:
- fldt 84+_SP@GOTOFF(%edi)
- testl %ebx, %ebx
- fmul %st(1), %st
- fldt 72+_SP@GOTOFF(%edi)
- fmul %st(2), %st
- fldt 60+_SP@GOTOFF(%edi)
- movl 32(%esp), %eax
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 48+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 36+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 24+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 12+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmulp %st, %st(2)
- fldt _SP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmulp %st, %st(2)
- faddp %st, %st(1)
- fldl _ones@GOTOFF(%edi,%esi,8)
- fmulp %st, %st(2)
- fmul %st(1), %st
- faddp %st, %st(1)
- fstpl 8(%eax)
- je ..B1.32
-..B1.31:
- fldcw 30(%esp)
-..B1.32:
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.33:
- testb $1, 36(%esp)
- je ..B1.41
-..B1.34:
- fld %st(0)
- testb $2, %dl
- fmul %st(1), %st
- fld %st(0)
- fmul %st(1), %st
- je ..B1.38
-..B1.35:
- fldt 84+_SP@GOTOFF(%edi)
- testl %ebx, %ebx
- fmul %st(1), %st
- fldt 72+_SP@GOTOFF(%edi)
- fmul %st(2), %st
- fldt 60+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 48+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 36+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 24+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 12+_SP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmulp %st, %st(2)
- fldt _SP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmulp %st, %st(2)
- faddp %st, %st(1)
- fldl _ones@GOTOFF(%edi,%eax,8)
- fmulp %st, %st(2)
- fmul %st(1), %st
- movl 32(%esp), %eax
- faddp %st, %st(1)
- fstpl (%eax)
- je ..B1.37
-..B1.36:
- fldcw 30(%esp)
-..B1.37:
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.38:
- fstp %st(2)
- fldt 84+_CP@GOTOFF(%edi)
- testl %ebx, %ebx
- fmul %st(2), %st
- fldt 72+_CP@GOTOFF(%edi)
- fmul %st(3), %st
- fldt 60+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(3), %st
- fldt 48+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(3), %st
- fldt 36+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(3), %st
- fldt 24+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(3), %st
- fldt 12+_CP@GOTOFF(%edi)
- faddp %st, %st(2)
- fxch %st(1)
- fmulp %st, %st(3)
- fldt _CP@GOTOFF(%edi)
- faddp %st, %st(1)
- fmulp %st, %st(1)
- faddp %st, %st(1)
- fldl _ones@GOTOFF(%edi,%eax,8)
- fmul %st, %st(1)
- movl 32(%esp), %eax
- faddp %st, %st(1)
- fstpl (%eax)
- je ..B1.40
-..B1.39:
- fldcw 30(%esp)
-..B1.40:
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.41:
- fstp %st(0)
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.42:
- xorl %ebx, %ebx
- jmp ..B1.8
-..B1.43:
- xorl %ebx, %ebx
- jmp ..B1.15
- .align 16,0x90
- .type __libm_sincos_huge,@function
- .size __libm_sincos_huge,.-__libm_sincos_huge
- .data
-# -- End __libm_sincos_huge
- .section .rodata, "a"
- .align 16
- .align 16
-.L_2il0floatpacket.0:
- .long 0xffffffff,0x7fffffff,0x00000000,0x00000000
- .type .L_2il0floatpacket.0,@object
- .size .L_2il0floatpacket.0,16
- .align 16
-_Pi4Inv:
- .long 1841940611
- .long 1072979760
- .type _Pi4Inv,@object
- .size _Pi4Inv,8
- .space 8, 0x00 # pad
- .align 16
-_Pi4x3:
- .long 1413754880
- .long 3219726843
- .long 993632256
- .long 1027030475
- .long 3773204808
- .long 3129236486
- .type _Pi4x3,@object
- .size _Pi4x3,24
- .space 8, 0x00 # pad
- .align 16
-_Pi4x4:
- .long 1413480448
- .long 3219726843
- .long 442499072
- .long 3183522913
- .long 771751936
- .long 3146979722
- .long 622873025
- .long 3110831002
- .type _Pi4x4,@object
- .size _Pi4x4,32
- .align 16
-_SP:
- .word 43691
- .word 43690
- .word 43690
- .word 43690
- .word 49148
- .word 0
- .word 34951
- .word 34952
- .word 34952
- .word 34952
- .word 16376
- .word 0
- .word 50471
- .word 3328
- .word 208
- .word 53261
- .word 49138
- .word 0
- .word 17910
- .word 46614
- .word 7466
- .word 47343
- .word 16364
- .word 0
- .word 33371
- .word 14743
- .word 11071
- .word 55090
- .word 49125
- .word 0
- .word 48947
- .word 35764
- .word 12250
- .word 45202
- .word 16350
- .word 0
- .word 17574
- .word 60698
- .word 10735
- .word 55102
- .word 49110
- .word 0
- .word 34320
- .word 12415
- .word 25249
- .word 51489
- .word 16334
- .word 0
- .type _SP,@object
- .size _SP,96
- .align 16
-_CP:
- .word 0
- .word 0
- .word 0
- .word 32768
- .word 49150
- .word 0
- .word 43685
- .word 43690
- .word 43690
- .word 43690
- .word 16378
- .word 0
- .word 39983
- .word 2912
- .word 24758
- .word 46603
- .word 49141
- .word 0
- .word 61476
- .word 3244
- .word 208
- .word 53261
- .word 16367
- .word 0
- .word 1022
- .word 16229
- .word 32187
- .word 37874
- .word 49129
- .word 0
- .word 55373
- .word 44526
- .word 50840
- .word 36726
- .word 16354
- .word 0
- .word 55994
- .word 65145
- .word 59958
- .word 51657
- .word 49114
- .word 0
- .word 15046
- .word 2976
- .word 1998
- .word 54661
- .word 16338
- .word 0
- .type _CP,@object
- .size _CP,96
- .align 16
-_ones:
- .long 0
- .long 1072693248
- .long 0
- .long 3220176896
- .type _ones,@object
- .size _ones,16
- .data
- .hidden __libm_reduce_pi04l
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/libm_tancot_huge.S b/libm/x86/libm_tancot_huge.S
deleted file mode 100644
index cdaa820..0000000
--- a/libm/x86/libm_tancot_huge.S
+++ /dev/null
@@ -1,750 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-# -- Begin __libm_tancot_huge
- .text
- .align 16,0x90
- .hidden __libm_tancot_huge
- .globl __libm_tancot_huge
-__libm_tancot_huge:
-# parameter 1: 8 + %ebp
-# parameter 2: 16 + %ebp
-# parameter 3: 20 + %ebp
-..B1.1:
- pushl %ebp
- movl %esp, %ebp
- andl $-64, %esp
- pushl %esi
- pushl %edi
- pushl %ebx
- subl $52, %esp
- movl 16(%ebp), %eax
- movl 20(%ebp), %ebx
- movl %eax, 40(%esp)
-..B1.2:
- fnstcw 38(%esp)
-..B1.3:
- movl 12(%ebp), %edx
- movl %edx, %eax
- andl $2147483647, %eax
- shrl $31, %edx
- movl %edx, 44(%esp)
- cmpl $1104150528, %eax
- call ..L2
-..L2:
- popl %esi
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi
- jae ..B1.11
-..B1.4:
- movsd 8(%ebp), %xmm1
- movzwl 38(%esp), %ecx
- movl %ecx, %edx
- andl $768, %edx
- andps .L_2il0floatpacket.0@GOTOFF(%esi), %xmm1
- cmpl $768, %edx
- movsd _Pi4Inv@GOTOFF(%esi), %xmm0
- mulsd %xmm1, %xmm0
- movsd %xmm1, 8(%ebp)
- movsd %xmm0, (%esp)
- je ..B1.39
-..B1.5:
- orl $-64768, %ecx
- movw %cx, 36(%esp)
-..B1.6:
- fldcw 36(%esp)
-..B1.7:
- movsd 8(%ebp), %xmm1
- movl $1, %edi
-..B1.8:
- movl %esi, 12(%esp)
- movl 4(%esp), %esi
- movl %esi, %edx
- movl %edi, 24(%esp)
- movl %esi, %edi
- shrl $20, %edi
- andl $1048575, %edx
- movl %edi, %ecx
- orl $1048576, %edx
- negl %ecx
- addl $13, %edi
- movl %ebx, 8(%esp)
- addl $19, %ecx
- movl %edx, %ebx
- movl %ecx, 28(%esp)
- shrl %cl, %ebx
- movl %edi, %ecx
- shll %cl, %edx
- movl 28(%esp), %ecx
- movl (%esp), %edi
- shrl %cl, %edi
- orl %edi, %edx
- cmpl $1094713344, %esi
- movsd %xmm1, 16(%esp)
- fldl 16(%esp)
- cmovb %ebx, %edx
- movl 24(%esp), %edi
- movl 12(%esp), %esi
- lea 1(%edx), %ebx
- andl $-2, %ebx
- movl %ebx, 16(%esp)
- cmpl $1094713344, %eax
- fildl 16(%esp)
- movl 8(%esp), %ebx
- jae ..B1.10
-..B1.9:
- fldl _Pi4x3@GOTOFF(%esi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 8+_Pi4x3@GOTOFF(%esi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 16+_Pi4x3@GOTOFF(%esi)
- fmulp %st, %st(1)
- faddp %st, %st(1)
- jmp ..B1.17
-..B1.10:
- fldl _Pi4x4@GOTOFF(%esi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 8+_Pi4x4@GOTOFF(%esi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 16+_Pi4x4@GOTOFF(%esi)
- fmul %st(1), %st
- faddp %st, %st(2)
- fldl 24+_Pi4x4@GOTOFF(%esi)
- fmulp %st, %st(1)
- faddp %st, %st(1)
- jmp ..B1.17
-..B1.11:
- movzwl 38(%esp), %edx
- movl %edx, %eax
- andl $768, %eax
- cmpl $768, %eax
- je ..B1.40
-..B1.12:
- orl $-64768, %edx
- movw %dx, 36(%esp)
-..B1.13:
- fldcw 36(%esp)
-..B1.14:
- movl $1, %edi
-..B1.15:
- movsd 8(%ebp), %xmm0
- addl $-32, %esp
- andps .L_2il0floatpacket.0@GOTOFF(%esi), %xmm0
- lea 32(%esp), %eax
- movsd %xmm0, 16(%eax)
- fldl 16(%eax)
- fstpt (%esp)
- movl $0, 12(%esp)
- movl %eax, 16(%esp)
- call __libm_reduce_pi04l
-..B1.43:
- movl %eax, %edx
- addl $32, %esp
-..B1.16:
- fldl (%esp)
- fldl 8(%esp)
- faddp %st, %st(1)
-..B1.17:
- movl %ebx, %eax
- andl $3, %eax
- cmpl $3, %eax
- jne ..B1.24
-..B1.18:
- fldl _ones@GOTOFF(%esi)
- incl %edx
- fdiv %st(1), %st
- testb $2, %dl
- fstpt 24(%esp)
- fld %st(0)
- fmul %st(1), %st
- fld %st(0)
- fmul %st(1), %st
- fldt 36+_TP@GOTOFF(%esi)
- fmul %st(2), %st
- fldt 24+_TP@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(2), %st
- fldt 12+_TP@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(2), %st
- fldt 36+_TQ@GOTOFF(%esi)
- fmul %st(3), %st
- fldt 24+_TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(3), %st
- fldt 12+_TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(3), %st
- fldt _TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fldt _TP@GOTOFF(%esi)
- faddp %st, %st(2)
- fldt 132+_GP@GOTOFF(%esi)
- fmul %st(3), %st
- fldt 120+_GP@GOTOFF(%esi)
- fmul %st(4), %st
- fldt 108+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(4), %st
- fldt 96+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(4), %st
- fldt 84+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(4), %st
- fldt 72+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(4), %st
- fldt 60+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(4), %st
- fldt 48+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(4), %st
- fldt 36+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(4), %st
- fldt 24+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmulp %st, %st(4)
- fldt 12+_GP@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(4), %st
- fmul %st(5), %st
- fldt _GP@GOTOFF(%esi)
- faddp %st, %st(4)
- fxch %st(3)
- fmul %st(5), %st
- faddp %st, %st(3)
- je ..B1.20
-..B1.19:
- fldt 24(%esp)
- fxch %st(1)
- fdivrp %st, %st(2)
- fxch %st(1)
- fmulp %st, %st(3)
- movl 44(%esp), %eax
- xorl $1, %eax
- fxch %st(2)
- fmul %st(3), %st
- fldl _ones@GOTOFF(%esi,%eax,8)
- fmul %st, %st(2)
- fmul %st, %st(3)
- fxch %st(3)
- faddp %st, %st(2)
- fxch %st(1)
- fstpl 16(%esp)
- fmul %st(1), %st
- fxch %st(1)
- fmulp %st, %st(2)
- movsd 16(%esp), %xmm0
- faddp %st, %st(1)
- fstpl 16(%esp)
- movsd 16(%esp), %xmm1
- jmp ..B1.21
-..B1.20:
- fdivrp %st, %st(1)
- fmulp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- movl 44(%esp), %eax
- fldl _ones@GOTOFF(%esi,%eax,8)
- fmul %st, %st(1)
- fmul %st, %st(3)
- fxch %st(3)
- faddp %st, %st(1)
- fstpl 16(%esp)
- fmul %st(1), %st
- fldt 24(%esp)
- fmulp %st, %st(2)
- movsd 16(%esp), %xmm0
- faddp %st, %st(1)
- fstpl 16(%esp)
- movsd 16(%esp), %xmm1
-..B1.21:
- testl %edi, %edi
- je ..B1.23
-..B1.22:
- fldcw 38(%esp)
-..B1.23:
- movl 40(%esp), %eax
- movsd %xmm0, (%eax)
- movsd %xmm1, 8(%eax)
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.24:
- testb $2, %bl
- je ..B1.31
-..B1.25:
- incl %edx
- fld %st(0)
- fmul %st(1), %st
- testb $2, %dl
- je ..B1.27
-..B1.26:
- fldl _ones@GOTOFF(%esi)
- fdiv %st(2), %st
- fld %st(1)
- fmul %st(2), %st
- fldt 132+_GP@GOTOFF(%esi)
- fmul %st(1), %st
- fldt 120+_GP@GOTOFF(%esi)
- fmul %st(2), %st
- fldt 108+_GP@GOTOFF(%esi)
- movl 44(%esp), %eax
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- xorl $1, %eax
- fldt 96+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 84+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 72+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 60+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 48+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 36+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 24+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmulp %st, %st(2)
- fldt 12+_GP@GOTOFF(%esi)
- faddp %st, %st(1)
- fmulp %st, %st(3)
- fldt _GP@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(3), %st
- fxch %st(2)
- fmulp %st, %st(3)
- fxch %st(1)
- faddp %st, %st(2)
- fldl _ones@GOTOFF(%esi,%eax,8)
- fmul %st, %st(2)
- fmulp %st, %st(1)
- faddp %st, %st(1)
- fstpl 16(%esp)
- movsd 16(%esp), %xmm0
- jmp ..B1.28
-..B1.27:
- fldt 36+_TP@GOTOFF(%esi)
- fmul %st(1), %st
- fldt 24+_TP@GOTOFF(%esi)
- movl 44(%esp), %eax
- faddp %st, %st(1)
- fmul %st(1), %st
- fldt 36+_TQ@GOTOFF(%esi)
- fmul %st(2), %st
- fldt 24+_TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(2), %st
- fldt 12+_TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(2), %st
- fldt _TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fldt 12+_TP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt _TP@GOTOFF(%esi)
- faddp %st, %st(1)
- fdivp %st, %st(1)
- fmulp %st, %st(1)
- fmul %st(1), %st
- fldl _ones@GOTOFF(%esi,%eax,8)
- fmul %st, %st(1)
- fmulp %st, %st(2)
- faddp %st, %st(1)
- fstpl 16(%esp)
- movsd 16(%esp), %xmm0
-..B1.28:
- testl %edi, %edi
- je ..B1.30
-..B1.29:
- fldcw 38(%esp)
-..B1.30:
- movl 40(%esp), %eax
- movsd %xmm0, (%eax)
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.31:
- testb $1, %bl
- je ..B1.38
-..B1.32:
- incl %edx
- fld %st(0)
- fmul %st(1), %st
- testb $2, %dl
- je ..B1.34
-..B1.33:
- fldt 36+_TP@GOTOFF(%esi)
- fmul %st(1), %st
- fldt 24+_TP@GOTOFF(%esi)
- movl 44(%esp), %eax
- faddp %st, %st(1)
- fmul %st(1), %st
- xorl $1, %eax
- fldt 36+_TQ@GOTOFF(%esi)
- fmul %st(2), %st
- fldt 24+_TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(2), %st
- fldt 12+_TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(2), %st
- fldt _TQ@GOTOFF(%esi)
- faddp %st, %st(1)
- fldt 12+_TP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt _TP@GOTOFF(%esi)
- faddp %st, %st(1)
- fdivp %st, %st(1)
- fmulp %st, %st(1)
- fmul %st(1), %st
- fldl _ones@GOTOFF(%esi,%eax,8)
- fmul %st, %st(1)
- fmulp %st, %st(2)
- faddp %st, %st(1)
- fstpl 16(%esp)
- movsd 16(%esp), %xmm0
- jmp ..B1.35
-..B1.34:
- fldl _ones@GOTOFF(%esi)
- fdiv %st(2), %st
- fld %st(1)
- fmul %st(2), %st
- fldt 132+_GP@GOTOFF(%esi)
- fmul %st(1), %st
- fldt 120+_GP@GOTOFF(%esi)
- fmul %st(2), %st
- fldt 108+_GP@GOTOFF(%esi)
- movl 44(%esp), %eax
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 96+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 84+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 72+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 60+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 48+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 36+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmul %st(2), %st
- fldt 24+_GP@GOTOFF(%esi)
- faddp %st, %st(2)
- fxch %st(1)
- fmulp %st, %st(2)
- fldt 12+_GP@GOTOFF(%esi)
- faddp %st, %st(1)
- fmulp %st, %st(3)
- fldt _GP@GOTOFF(%esi)
- faddp %st, %st(1)
- fmul %st(3), %st
- fxch %st(2)
- fmulp %st, %st(3)
- fxch %st(1)
- faddp %st, %st(2)
- fldl _ones@GOTOFF(%esi,%eax,8)
- fmul %st, %st(2)
- fmulp %st, %st(1)
- faddp %st, %st(1)
- fstpl 16(%esp)
- movsd 16(%esp), %xmm0
-..B1.35:
- testl %edi, %edi
- je ..B1.37
-..B1.36:
- fldcw 38(%esp)
-..B1.37:
- movl 40(%esp), %eax
- movsd %xmm0, 8(%eax)
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.38:
- fstp %st(0)
- addl $52, %esp
- popl %ebx
- popl %edi
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B1.39:
- xorl %edi, %edi
- jmp ..B1.8
-..B1.40:
- xorl %edi, %edi
- jmp ..B1.15
- .align 16,0x90
- .type __libm_tancot_huge,@function
- .size __libm_tancot_huge,.-__libm_tancot_huge
- .data
-# -- End __libm_tancot_huge
- .section .rodata, "a"
- .align 16
- .align 16
-.L_2il0floatpacket.0:
- .long 0xffffffff,0x7fffffff,0x00000000,0x00000000
- .type .L_2il0floatpacket.0,@object
- .size .L_2il0floatpacket.0,16
- .align 16
-_Pi4Inv:
- .long 1841940611
- .long 1072979760
- .type _Pi4Inv,@object
- .size _Pi4Inv,8
- .space 8, 0x00 # pad
- .align 16
-_Pi4x3:
- .long 1413754880
- .long 3219726843
- .long 993632256
- .long 1027030475
- .long 3773204808
- .long 3129236486
- .type _Pi4x3,@object
- .size _Pi4x3,24
- .space 8, 0x00 # pad
- .align 16
-_Pi4x4:
- .long 1413480448
- .long 3219726843
- .long 442499072
- .long 3183522913
- .long 771751936
- .long 3146979722
- .long 622873025
- .long 3110831002
- .type _Pi4x4,@object
- .size _Pi4x4,32
- .align 16
-_ones:
- .long 0
- .long 1072693248
- .long 0
- .long 3220176896
- .type _ones,@object
- .size _ones,16
- .align 16
-_TP:
- .word 19670
- .word 44908
- .word 50960
- .word 50786
- .word 49149
- .word 0
- .word 19206
- .word 45228
- .word 54194
- .word 52268
- .word 16377
- .word 0
- .word 227
- .word 51280
- .word 43560
- .word 38195
- .word 49139
- .word 0
- .word 12272
- .word 18029
- .word 6715
- .word 45670
- .word 16357
- .word 0
- .type _TP,@object
- .size _TP,48
- .align 16
-_TQ:
- .word 14748
- .word 33681
- .word 5452
- .word 38090
- .word 49151
- .word 0
- .word 46755
- .word 50026
- .word 17634
- .word 35372
- .word 16382
- .word 0
- .word 46863
- .word 53352
- .word 42702
- .word 59869
- .word 49145
- .word 0
- .word 33295
- .word 20942
- .word 32118
- .word 39935
- .word 16371
- .word 0
- .type _TQ,@object
- .size _TQ,48
- .align 16
-_GP:
- .word 43691
- .word 43690
- .word 43690
- .word 43690
- .word 49149
- .word 0
- .word 46639
- .word 2912
- .word 24758
- .word 46603
- .word 49145
- .word 0
- .word 57255
- .word 2218
- .word 21984
- .word 35507
- .word 49142
- .word 0
- .word 34208
- .word 43033
- .word 48281
- .word 56811
- .word 49138
- .word 0
- .word 28773
- .word 27191
- .word 31071
- .word 45908
- .word 49135
- .word 0
- .word 43257
- .word 33777
- .word 11976
- .word 37184
- .word 49132
- .word 0
- .word 62410
- .word 35990
- .word 36363
- .word 60269
- .word 49128
- .word 0
- .word 13659
- .word 55568
- .word 26569
- .word 48851
- .word 49125
- .word 0
- .word 10347
- .word 46238
- .word 47188
- .word 39576
- .word 49122
- .word 0
- .word 2161
- .word 6703
- .word 25719
- .word 64708
- .word 49118
- .word 0
- .word 42329
- .word 7593
- .word 44754
- .word 47734
- .word 49115
- .word 0
- .word 163
- .word 32746
- .word 39875
- .word 61957
- .word 49112
- .word 0
- .type _GP,@object
- .size _GP,144
- .data
- .hidden __libm_reduce_pi04l
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/rint.S b/libm/x86/rint.S
deleted file mode 100644
index 282d3ed..0000000
--- a/libm/x86/rint.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(rint)
- subl $12,%esp
- movsd 16(%esp),%xmm0
- roundsd $4,%xmm0,%xmm0
- movsd %xmm0,(%esp)
- fldl (%esp)
- addl $12,%esp
- ret
-END(rint)
-
-// LP32 sizeof(long double) == sizeof(double).
-ALIAS_SYMBOL(rintl, rint);
diff --git a/libm/x86/rintf.S b/libm/x86/rintf.S
deleted file mode 100644
index d5cbe78..0000000
--- a/libm/x86/rintf.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(rintf)
- subl $12,%esp
- movss 16(%esp),%xmm0
- roundss $4,%xmm0,%xmm0
- movss %xmm0,(%esp)
- flds (%esp)
- add $12,%esp
- ret
-END(rintf)
diff --git a/libm/x86/s_atan.S b/libm/x86/s_atan.S
deleted file mode 100644
index 71ca4db..0000000
--- a/libm/x86/s_atan.S
+++ /dev/null
@@ -1,934 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// This implementation uses the main path for |x| in [2^{-5},2^65).
-// For |x| in [2^{-64},2^{-5}), a secondary path is used.
-// For the biased exponent of X within 3FFH-64 and 3FF+64, we use one branch.
-// We use the following definition of B and X` so that the formula
-// atan(X) = Tau + atan( (X`-B) / (One + BX) ) is correct
-//
-// X = (-1)^s * 2^k * 1. x1 x2 ... x52
-//
-// Define X` = 0 if k >= 5; and X` = |X| otherwise
-// Define One = 0 if k >= 5; and One = 1 otherwise
-// Define B = 0 if k <= -6; B = 2^k * 1.x1 x2 x3 x4 1 if -5 <= k <= 4
-// Define B = 2^5 * 1.0 0 ... 0 if k >= 5
-//
-// Tau is 0 if k <= -6;
-// Tau is atan( B ) if -5 <= k <= 4
-// Tau is pi/2 if k >= 5
-//
-// Special cases:
-// atan(NaN) = quiet NaN
-// atan(+/-INF) = +/-Pi/2
-// atan(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin atan
-ENTRY(atan)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $104, %esp
- movl %ebx, 48(%esp)
- call static_func
- movl %eax, %ebx
- movsd 112(%esp), %xmm0
- movsd 2640(%ebx), %xmm3
- movsd 2624(%ebx), %xmm5
- movsd 2656(%ebx), %xmm4
- movsd %xmm0, 8(%esp)
- pextrw $3, %xmm0, %edx
- andpd %xmm0, %xmm3
- pshufd $68, %xmm0, %xmm1
- orpd %xmm4, %xmm3
- movl %edx, %eax
- andl $32767, %edx
- subl $16288, %edx
- cmpl $159, %edx
- ja .L_2TAG_PACKET_0.0.2
- mulsd %xmm3, %xmm1
- subsd %xmm3, %xmm0
- addsd %xmm5, %xmm1
- divsd %xmm1, %xmm0
- addl $1, %edx
- movsd 2672(%ebx), %xmm2
- movsd 2688(%ebx), %xmm4
- andl $32768, %eax
- xorpd %xmm7, %xmm7
- pinsrw $3, %eax, %xmm7
- addl %edx, %edx
- movsd (%ebx,%edx,8), %xmm6
- movsd 8(%ebx,%edx,8), %xmm5
- xorpd %xmm7, %xmm5
- xorpd %xmm7, %xmm6
- movsd 2680(%ebx), %xmm7
- pshufd $68, %xmm0, %xmm1
- mulsd %xmm0, %xmm0
- pshufd $68, %xmm1, %xmm3
- addsd %xmm6, %xmm1
- mulsd %xmm0, %xmm2
- addsd %xmm0, %xmm4
- subsd %xmm1, %xmm6
- mulsd %xmm0, %xmm4
- addsd %xmm7, %xmm2
- mulsd %xmm3, %xmm0
- addsd %xmm3, %xmm6
- mulsd %xmm2, %xmm0
- addsd 2696(%ebx), %xmm4
- addsd %xmm5, %xmm6
- mulsd %xmm4, %xmm0
- addsd %xmm6, %xmm0
- addsd %xmm1, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_0.0.2:
- addl $944, %edx
- cmpl $1103, %edx
- ja .L_2TAG_PACKET_2.0.2
- movsd 2672(%ebx), %xmm4
- movsd 2688(%ebx), %xmm7
- movsd 8(%esp), %xmm0
- mulsd %xmm1, %xmm1
- movsd 2680(%ebx), %xmm2
- movsd 2696(%ebx), %xmm5
- mulsd %xmm1, %xmm4
- addsd %xmm1, %xmm7
- movapd %xmm1, %xmm6
- mulsd %xmm0, %xmm1
- addsd %xmm4, %xmm2
- mulsd %xmm6, %xmm7
- mulsd %xmm1, %xmm2
- addsd %xmm5, %xmm7
- mulsd %xmm7, %xmm2
- addsd %xmm2, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- addl $15344, %edx
- cmpl $16368, %edx
- ja .L_2TAG_PACKET_3.0.2
- movsd 8(%esp), %xmm0
- movsd 8(%esp), %xmm1
- cmpl $16, %edx
- jae .L_2TAG_PACKET_4.0.2
- mulsd %xmm0, %xmm1
-.L_2TAG_PACKET_4.0.2:
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_3.0.2:
- cmpl $17392, %edx
- jae .L_2TAG_PACKET_5.0.2
- xorpd %xmm1, %xmm1
- movl $49136, %ecx
- pinsrw $3, %ecx, %xmm1
- divsd %xmm0, %xmm1
- movsd 2672(%ebx), %xmm2
- movsd 2688(%ebx), %xmm4
- andl $32768, %eax
- xorpd %xmm7, %xmm7
- pinsrw $3, %eax, %xmm7
- addl %edx, %edx
- movsd 2592(%ebx), %xmm6
- movsd 2600(%ebx), %xmm5
- xorpd %xmm7, %xmm5
- xorpd %xmm7, %xmm6
- movsd 2680(%ebx), %xmm7
- pshufd $68, %xmm1, %xmm0
- mulsd %xmm1, %xmm1
- pshufd $68, %xmm0, %xmm3
- addsd %xmm6, %xmm0
- mulsd %xmm1, %xmm2
- addsd %xmm1, %xmm4
- subsd %xmm0, %xmm6
- mulsd %xmm1, %xmm4
- addsd %xmm7, %xmm2
- mulsd %xmm3, %xmm1
- addsd %xmm3, %xmm6
- mulsd %xmm2, %xmm1
- addsd 2696(%ebx), %xmm4
- addsd %xmm5, %xmm6
- mulsd %xmm4, %xmm1
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_5.0.2:
- movsd 8(%esp), %xmm4
- movsd 2608(%ebx), %xmm0
- movsd 2592(%ebx), %xmm2
- movsd 2600(%ebx), %xmm3
- movd %xmm1, %eax
- psrlq $32, %xmm1
- movd %xmm1, %edx
- andl $2147483647, %edx
- cmpl $2146435072, %edx
- jae .L_2TAG_PACKET_6.0.2
-.L_2TAG_PACKET_7.0.2:
- andnpd %xmm4, %xmm0
- orpd %xmm0, %xmm2
- orpd %xmm3, %xmm0
- addsd %xmm2, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_6.0.2:
- subl $2146435072, %edx
- orl %edx, %eax
- cmpl $0, %eax
- je .L_2TAG_PACKET_7.0.2
- movapd %xmm4, %xmm0
- addsd %xmm0, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
-.L_2TAG_PACKET_1.0.2:
- movl 48(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(atan)
-# -- End atan
-
-# Start file scope ASM
-ALIAS_SYMBOL(atanl, atan);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3819695742
- .long 1067482761
- .long 2398680355
- .long 3155462074
- .long 2998791009
- .long 1067548225
- .long 3868465248
- .long 3157182472
- .long 3339424991
- .long 1067613680
- .long 3296670360
- .long 1010752543
- .long 2710002256
- .long 1067679126
- .long 3403896007
- .long 1010910768
- .long 3275701428
- .long 1067744562
- .long 119959933
- .long 1011482843
- .long 2908636881
- .long 1067809988
- .long 2464489612
- .long 1011545526
- .long 3777889398
- .long 1067875403
- .long 3262682165
- .long 1009703919
- .long 3759667419
- .long 1067940807
- .long 1838130851
- .long 3157373556
- .long 732369940
- .long 1068006200
- .long 1203428313
- .long 1010055371
- .long 1166616461
- .long 1068071580
- .long 2901274051
- .long 3158549977
- .long 2945472892
- .long 1068136947
- .long 3726120658
- .long 1009762715
- .long 3954480976
- .long 1068202301
- .long 1289173457
- .long 1009429861
- .long 2081752829
- .long 1068267642
- .long 1836909874
- .long 1006212095
- .long 3807999788
- .long 1068332968
- .long 2172459940
- .long 3156162078
- .long 2731789884
- .long 1068398280
- .long 3450718392
- .long 3159216547
- .long 1044477961
- .long 1068463577
- .long 2230553229
- .long 1011424339
- .long 1486930287
- .long 1068530218
- .long 2861547474
- .long 1012041376
- .long 2293016881
- .long 1068595466
- .long 136843272
- .long 1012684797
- .long 201518157
- .long 1068660680
- .long 63231984
- .long 1012427198
- .long 4054234584
- .long 1068725856
- .long 3927006960
- .long 1011878955
- .long 1246477213
- .long 1068790995
- .long 1494265652
- .long 3155219350
- .long 678186699
- .long 1068856093
- .long 1264361424
- .long 3159256693
- .long 2690594995
- .long 1068921148
- .long 3906996379
- .long 1009288267
- .long 3362611517
- .long 1068986159
- .long 1650970041
- .long 3158331771
- .long 3102162111
- .long 1069051124
- .long 365917035
- .long 3160264153
- .long 2352611067
- .long 1069116041
- .long 4008970190
- .long 3159478182
- .long 1594134794
- .long 1069180908
- .long 466690178
- .long 1012526501
- .long 1345079306
- .long 1069245723
- .long 2268273568
- .long 3160164092
- .long 2163300970
- .long 1069310484
- .long 2750834800
- .long 3158113482
- .long 352522716
- .long 1069375190
- .long 1750411372
- .long 1011790845
- .long 848541647
- .long 1069439838
- .long 2164207573
- .long 1011698350
- .long 40647312
- .long 1069504427
- .long 2949165434
- .long 3159107267
- .long 2216766270
- .long 1069574357
- .long 2197920765
- .long 3161055954
- .long 1090914384
- .long 1069638757
- .long 2330454674
- .long 1013365998
- .long 387601244
- .long 1069703022
- .long 3185681168
- .long 1013434071
- .long 3991640484
- .long 1069767144
- .long 1313211590
- .long 3161087959
- .long 3322489502
- .long 1069831118
- .long 3013977995
- .long 1013053011
- .long 3121698570
- .long 1069894936
- .long 4069015667
- .long 1013023362
- .long 4289964660
- .long 1069958591
- .long 1736191156
- .long 3158266731
- .long 3903312386
- .long 1070022077
- .long 1833592413
- .long 3159731471
- .long 3818449864
- .long 1070085387
- .long 851036429
- .long 3159730451
- .long 2097480306
- .long 1070148515
- .long 3506390884
- .long 3160462302
- .long 1611694502
- .long 1070211454
- .long 2785735540
- .long 3160465144
- .long 1464694796
- .long 1070274198
- .long 4229277299
- .long 3159907000
- .long 1299612775
- .long 1070336741
- .long 4116653788
- .long 3160427739
- .long 1310544789
- .long 1070399077
- .long 1064430331
- .long 1013218202
- .long 2253168030
- .long 1070461200
- .long 1405044609
- .long 3157623179
- .long 1159567373
- .long 1070523105
- .long 2353445521
- .long 3159992176
- .long 1359373750
- .long 1070605818
- .long 1748171336
- .long 3161879263
- .long 908341706
- .long 1070667034
- .long 3372710815
- .long 3161775245
- .long 1743027350
- .long 1070727765
- .long 687089934
- .long 3160507171
- .long 2055355646
- .long 1070787992
- .long 2392855242
- .long 1013682469
- .long 690426164
- .long 1070847697
- .long 1103926666
- .long 1014052810
- .long 1483247847
- .long 1070906862
- .long 2082645847
- .long 3161345479
- .long 392040270
- .long 1070965472
- .long 2407720023
- .long 1014053754
- .long 2673846014
- .long 1071023511
- .long 1293605532
- .long 3158464385
- .long 1384215810
- .long 1071080967
- .long 2446095872
- .long 3159216407
- .long 3101660631
- .long 1071137826
- .long 698040758
- .long 1014855328
- .long 2094057058
- .long 1071194078
- .long 2282048339
- .long 1014040385
- .long 1712750594
- .long 1071249712
- .long 1204372378
- .long 3162276464
- .long 1411515787
- .long 1071304719
- .long 949080808
- .long 1015006403
- .long 931538085
- .long 1071359091
- .long 3027127039
- .long 1014307233
- .long 179139065
- .long 1071412821
- .long 4285547492
- .long 3161934731
- .long 3387721259
- .long 1071465902
- .long 373225773
- .long 1013486625
- .long 2132236852
- .long 1071544299
- .long 3250533429
- .long 1014031677
- .long 1942070284
- .long 1071645596
- .long 1237964179
- .long 3163239113
- .long 1532707802
- .long 1071695380
- .long 330645583
- .long 1012495610
- .long 2294184979
- .long 1071743834
- .long 3959472897
- .long 1015833116
- .long 3805060714
- .long 1071790961
- .long 2671256142
- .long 1013727772
- .long 2215037898
- .long 1071836770
- .long 2683359117
- .long 1015831902
- .long 483661594
- .long 1071881273
- .long 836288326
- .long 3162648643
- .long 1534679894
- .long 1071924486
- .long 373258696
- .long 3162470096
- .long 1538714628
- .long 1071966430
- .long 3199433068
- .long 1015325501
- .long 527642555
- .long 1072007128
- .long 3636832592
- .long 3161843145
- .long 291339150
- .long 1072046605
- .long 890169537
- .long 3160586117
- .long 2450210201
- .long 1072084888
- .long 1636353294
- .long 3163193400
- .long 2411367951
- .long 1072122007
- .long 374899873
- .long 1011331750
- .long 681549971
- .long 1072157992
- .long 506411689
- .long 1015373954
- .long 1466745541
- .long 1072192873
- .long 2143860931
- .long 1013364334
- .long 2845622366
- .long 1072226682
- .long 2869178209
- .long 3162423682
- .long 2838871438
- .long 1072275456
- .long 3742223599
- .long 1014338577
- .long 4200275274
- .long 1072337034
- .long 1566539915
- .long 3161839550
- .long 3034733530
- .long 1072394897
- .long 652621408
- .long 3162261964
- .long 3207412993
- .long 1072449290
- .long 3206124665
- .long 1014408733
- .long 624461478
- .long 1072500450
- .long 932437485
- .long 1015204343
- .long 767665908
- .long 1072548600
- .long 1037911952
- .long 3163527627
- .long 1110773639
- .long 1072593952
- .long 2371517912
- .long 3160465741
- .long 1940828530
- .long 1072636704
- .long 2731408428
- .long 3162895795
- .long 1911329388
- .long 1072677041
- .long 1773089615
- .long 3159569267
- .long 1764715788
- .long 1072704191
- .long 691346949
- .long 3164069946
- .long 3332979233
- .long 1072722195
- .long 3550733983
- .long 1014770628
- .long 1321870254
- .long 1072739231
- .long 1415315820
- .long 1016224052
- .long 3657429030
- .long 1072755365
- .long 3910539033
- .long 1015966402
- .long 4197624557
- .long 1072770661
- .long 2333399254
- .long 3164546480
- .long 1512059493
- .long 1072785177
- .long 2701510318
- .long 1016178092
- .long 453379037
- .long 1072798965
- .long 4046344253
- .long 3162814364
- .long 1942345162
- .long 1072818388
- .long 621134147
- .long 1016335195
- .long 4210176273
- .long 1072842164
- .long 2701013387
- .long 3164326619
- .long 4185644010
- .long 1072863795
- .long 4163699341
- .long 1016203112
- .long 679688788
- .long 1072883543
- .long 4147276762
- .long 1014066750
- .long 29432865
- .long 1072901630
- .long 970415797
- .long 1016902063
- .long 4070721092
- .long 1072918247
- .long 2539004411
- .long 3163736096
- .long 2252468843
- .long 1072933561
- .long 3424082887
- .long 3163407177
- .long 2929724825
- .long 1072947712
- .long 3661482235
- .long 3163846989
- .long 1377513368
- .long 1072960824
- .long 3987926680
- .long 1013647908
- .long 1031632908
- .long 1072973003
- .long 3672217151
- .long 1016614619
- .long 2516508130
- .long 1072984342
- .long 545855020
- .long 3162728930
- .long 3792452178
- .long 1072994923
- .long 3420119467
- .long 1016471430
- .long 3147791459
- .long 1073004818
- .long 1342204979
- .long 1013937254
- .long 999189752
- .long 1073014090
- .long 1006335472
- .long 3162850919
- .long 711011011
- .long 1073022794
- .long 4633488
- .long 3162966895
- .long 15640363
- .long 1073030980
- .long 1686389560
- .long 3164376226
- .long 1218463589
- .long 1073042382
- .long 1526837110
- .long 3163533985
- .long 2538470555
- .long 1073056144
- .long 2273304406
- .long 3163784996
- .long 1229720947
- .long 1073068489
- .long 2971628206
- .long 3162356540
- .long 3115427016
- .long 1073079621
- .long 4215132957
- .long 3164282762
- .long 4030612557
- .long 1073089709
- .long 1913251691
- .long 3163671292
- .long 2728521257
- .long 1073098892
- .long 2861089500
- .long 1015454459
- .long 1118696283
- .long 1073107285
- .long 1628948053
- .long 1016179658
- .long 2682711255
- .long 1073114984
- .long 2906306266
- .long 1014142643
- .long 2073898081
- .long 1073122072
- .long 1322740454
- .long 3164497217
- .long 1403700297
- .long 1073128618
- .long 416137895
- .long 3162781466
- .long 2502685617
- .long 1073134681
- .long 3242008732
- .long 1014593495
- .long 1531926851
- .long 1073140313
- .long 1362708094
- .long 1016517604
- .long 3572814411
- .long 1073145557
- .long 3709790527
- .long 1012646874
- .long 1695536111
- .long 1073150453
- .long 3980346340
- .long 1016705136
- .long 2363057203
- .long 1073155033
- .long 2551194792
- .long 1012569695
- .long 2873365682
- .long 1073159327
- .long 3181154748
- .long 1017041450
- .long 1053384691
- .long 1073165288
- .long 3074536879
- .long 1016965660
- .long 3270542712
- .long 1073172451
- .long 2535319415
- .long 3163051778
- .long 1353631484
- .long 1073178850
- .long 1173833755
- .long 1015534537
- .long 3511218460
- .long 1073184599
- .long 1243608109
- .long 3161592122
- .long 4121259284
- .long 1073189793
- .long 398584912
- .long 3163829923
- .long 1193862106
- .long 1073194509
- .long 1873745539
- .long 3163802819
- .long 3861949790
- .long 1073198808
- .long 3841261147
- .long 1015587248
- .long 1486904578
- .long 1073202745
- .long 1634726776
- .long 3163847886
- .long 2879153715
- .long 1073206362
- .long 200456242
- .long 3164138657
- .long 385353253
- .long 1073209698
- .long 1186355517
- .long 1014887155
- .long 1125865839
- .long 1073212783
- .long 203561262
- .long 3161244927
- .long 1221361475
- .long 1073215645
- .long 3382476563
- .long 1014936138
- .long 2077323573
- .long 1073218307
- .long 1005121005
- .long 3164430752
- .long 215611373
- .long 1073220790
- .long 353198764
- .long 3164485137
- .long 2347419265
- .long 1073223110
- .long 1103143360
- .long 1016542137
- .long 1379112765
- .long 1073225284
- .long 381583533
- .long 3162870833
- .long 3891198463
- .long 1073228298
- .long 1771275754
- .long 1014654681
- .long 3395914051
- .long 1073231917
- .long 2350900914
- .long 3164013978
- .long 2799919478
- .long 1073235146
- .long 2893950164
- .long 3163260901
- .long 1138673476
- .long 1073238045
- .long 2622204785
- .long 3164174388
- .long 3408855940
- .long 1073240661
- .long 2800881650
- .long 1016008624
- .long 2044858738
- .long 1073243035
- .long 604544785
- .long 1017022901
- .long 2578795176
- .long 1073245198
- .long 2557332925
- .long 1016135165
- .long 4196285314
- .long 1073247177
- .long 2032365307
- .long 1016194735
- .long 224877747
- .long 1073248996
- .long 497926916
- .long 1016947111
- .long 3271386490
- .long 1073250671
- .long 2689994846
- .long 1016631513
- .long 813635989
- .long 1073252221
- .long 747035277
- .long 3164530136
- .long 369829519
- .long 1073253658
- .long 2182033858
- .long 3163190340
- .long 1187679052
- .long 1073254994
- .long 673954443
- .long 1016149821
- .long 4232586098
- .long 1073256239
- .long 497775200
- .long 3162179015
- .long 426690558
- .long 1073257404
- .long 3063343247
- .long 1016865578
- .long 1624065902
- .long 1073258494
- .long 1354224996
- .long 3163503778
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 1016178214
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 1016178214
- .long 4294967295
- .long 2147483647
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 4294901760
- .long 0
- .long 0
- .long 0
- .long 32768
- .long 0
- .long 0
- .long 2006262985
- .long 1069310863
- .long 2358449471
- .long 3217342131
- .long 3845454352
- .long 1069952297
- .long 2829679149
- .long 1073771565
- .type static_const_table,@object
- .size static_const_table,2704
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/s_cbrt.S b/libm/x86/s_cbrt.S
deleted file mode 100644
index 53d3cc2..0000000
--- a/libm/x86/s_cbrt.S
+++ /dev/null
@@ -1,738 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Assume x=2^{3*k+j} * 1.b1 b2 ... b5 b6 ... b52, where j = 0,1,2.
-// Let r=(x*2^{-3k-j} - 1.b1 b2 ... b5 1)* rcp[b1 b2 ..b5],
-// where rcp[b1 b2 .. b5]=1/(1.b1 b2 b3 b4 b5 1) in double precision
-// cbrt(2^j * 1. b1 b2 .. b5 1) is approximated as T[j][b1..b5]+D[j][b1..b5]
-// (T stores the high 53 bits, D stores the low order bits)
-// Result=2^k*T+(2^k*T*r)*P+2^k*D
-// where P=p1+p2*r+..+p8*r^7
-//
-// Special cases:
-// cbrt(NaN) = quiet NaN, and raise invalid exception
-// cbrt(INF) = that INF
-// cbrt(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin cbrt
-ENTRY(cbrt)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $120, %esp
- movl %esi, 52(%esp)
- call static_func
- movl %eax, %esi
- movsd 128(%esp), %xmm0
- movapd %xmm0, %xmm7
- movsd %xmm0, 8(%esp)
- movl $524032, %edx
- movsd 64(%esi), %xmm5
- movsd 80(%esi), %xmm3
- psrlq $44, %xmm7
- pextrw $0, %xmm7, %ecx
- movd %xmm7, %eax
- movsd 96(%esi), %xmm1
- movsd 112(%esi), %xmm2
- movl %ebx, 16(%esp)
- andl $248, %ecx
- movsd 128(%ecx,%esi), %xmm4
- movl %eax, %ebx
- andl %eax, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_0.0.2
- cmpl $524032, %edx
- je .L_2TAG_PACKET_1.0.2
- shrl $8, %edx
- shrl $8, %ebx
- andpd %xmm0, %xmm2
- andpd %xmm5, %xmm0
- orpd %xmm2, %xmm3
- orpd %xmm0, %xmm1
- movapd (%esi), %xmm5
- movl $5462, %eax
- movapd 16(%esi), %xmm6
- mull %edx
- movl %ebx, %edx
- andl $2047, %ebx
- shrl $14, %eax
- andl $2048, %edx
- subl %eax, %ebx
- subl %eax, %ebx
- subl %eax, %ebx
- shll $8, %ebx
- addl $682, %eax
- orl %edx, %eax
- movd %eax, %xmm7
- addl %ebx, %ecx
- psllq $52, %xmm7
-.L_2TAG_PACKET_2.0.2:
- movapd 32(%esi), %xmm2
- movapd 48(%esi), %xmm0
- subsd %xmm3, %xmm1
- movq %xmm7, %xmm3
- mulsd 384(%ecx,%esi), %xmm7
- mulsd %xmm4, %xmm1
- mulsd 1152(%ecx,%esi), %xmm3
- movapd %xmm1, %xmm4
- unpcklpd %xmm1, %xmm1
- mulpd %xmm1, %xmm5
- mulpd %xmm1, %xmm6
- mulpd %xmm1, %xmm1
- addpd %xmm5, %xmm2
- addpd %xmm6, %xmm0
- mulpd %xmm1, %xmm2
- mulpd %xmm1, %xmm1
- mulsd %xmm7, %xmm4
- addpd %xmm2, %xmm0
- movl 16(%esp), %ebx
- mulsd %xmm0, %xmm1
- unpckhpd %xmm0, %xmm0
- addsd %xmm1, %xmm0
- mulsd %xmm4, %xmm0
- addsd %xmm3, %xmm0
- addsd %xmm7, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_0.0.2:
- mulsd 1984(%esi), %xmm0
- movq %xmm0, %xmm7
- movl $524032, %edx
- psrlq $44, %xmm7
- pextrw $0, %xmm7, %ecx
- movd %xmm7, %eax
- andl $248, %ecx
- movsd 128(%ecx,%esi), %xmm4
- movl %eax, %ebx
- andl %eax, %edx
- shrl $8, %edx
- shrl $8, %ebx
- cmpl $0, %edx
- je .L_2TAG_PACKET_4.0.2
- andpd %xmm0, %xmm2
- andpd %xmm5, %xmm0
- orpd %xmm2, %xmm3
- orpd %xmm0, %xmm1
- movapd (%esi), %xmm5
- movl $5462, %eax
- movapd 16(%esi), %xmm6
- mull %edx
- movl %ebx, %edx
- andl $2047, %ebx
- shrl $14, %eax
- andl $2048, %edx
- subl %eax, %ebx
- subl %eax, %ebx
- subl %eax, %ebx
- shll $8, %ebx
- addl $661, %eax
- orl %edx, %eax
- movd %eax, %xmm7
- addl %ebx, %ecx
- psllq $52, %xmm7
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_4.0.2:
- cmpl $0, %ebx
- jne .L_2TAG_PACKET_5.0.2
- movl 16(%esp), %ebx
- fldl 1952(%esi)
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_5.0.2:
- movl 16(%esp), %ebx
- fldl 1968(%esi)
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_1.0.2:
- movl 16(%esp), %ebx
- movl 132(%esp), %eax
- movl 128(%esp), %edx
- movl %eax, %ecx
- andl $2147483647, %ecx
- cmpl $2146435072, %ecx
- ja .L_2TAG_PACKET_6.0.2
- cmpl $0, %edx
- jne .L_2TAG_PACKET_6.0.2
- cmpl $2146435072, %eax
- jne .L_2TAG_PACKET_7.0.2
- fldl 1920(%esi)
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_7.0.2:
- fldl 1936(%esi)
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_6.0.2:
- movsd 8(%esp), %xmm0
- addsd %xmm0, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
-.L_2TAG_PACKET_3.0.2:
- movl 52(%esp), %esi
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(cbrt)
-# -- End cbrt
-
-# Start file scope ASM
-ALIAS_SYMBOL(cbrtl, cbrt);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 1553778919
- .long 3213899486
- .long 3534952507
- .long 3215266280
- .long 1646371399
- .long 3214412045
- .long 477218588
- .long 3216798151
- .long 3582521621
- .long 1066628362
- .long 1007461464
- .long 1068473053
- .long 889629714
- .long 1067378449
- .long 1431655765
- .long 1070945621
- .long 4294967295
- .long 1048575
- .long 0
- .long 0
- .long 0
- .long 3220193280
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 1032192
- .long 0
- .long 0
- .long 528611360
- .long 3220144632
- .long 2884679527
- .long 3220082993
- .long 1991868891
- .long 3220024928
- .long 2298714891
- .long 3219970134
- .long 58835168
- .long 3219918343
- .long 3035110223
- .long 3219869313
- .long 1617585086
- .long 3219822831
- .long 2500867033
- .long 3219778702
- .long 4241943008
- .long 3219736752
- .long 258732970
- .long 3219696825
- .long 404232216
- .long 3219658776
- .long 2172167368
- .long 3219622476
- .long 1544257904
- .long 3219587808
- .long 377579543
- .long 3219554664
- .long 1616385542
- .long 3219522945
- .long 813783277
- .long 3219492562
- .long 3940743189
- .long 3219463431
- .long 2689777499
- .long 3219435478
- .long 1700977147
- .long 3219408632
- .long 3169102082
- .long 3219382828
- .long 327235604
- .long 3219358008
- .long 1244336319
- .long 3219334115
- .long 1300311200
- .long 3219311099
- .long 3095471925
- .long 3219288912
- .long 2166487928
- .long 3219267511
- .long 2913108253
- .long 3219246854
- .long 293672978
- .long 3219226904
- .long 288737297
- .long 3219207624
- .long 1810275472
- .long 3219188981
- .long 174592167
- .long 3219170945
- .long 3539053052
- .long 3219153485
- .long 2164392968
- .long 3219136576
- .long 572345495
- .long 1072698681
- .long 1998204467
- .long 1072709382
- .long 3861501553
- .long 1072719872
- .long 2268192434
- .long 1072730162
- .long 2981979308
- .long 1072740260
- .long 270859143
- .long 1072750176
- .long 2958651392
- .long 1072759916
- .long 313113243
- .long 1072769490
- .long 919449400
- .long 1072778903
- .long 2809328903
- .long 1072788162
- .long 2222981587
- .long 1072797274
- .long 2352530781
- .long 1072806244
- .long 594152517
- .long 1072815078
- .long 1555767199
- .long 1072823780
- .long 4282421314
- .long 1072832355
- .long 2355578597
- .long 1072840809
- .long 1162590619
- .long 1072849145
- .long 797864051
- .long 1072857367
- .long 431273680
- .long 1072865479
- .long 2669831148
- .long 1072873484
- .long 733477752
- .long 1072881387
- .long 4280220604
- .long 1072889189
- .long 801961634
- .long 1072896896
- .long 2915370760
- .long 1072904508
- .long 1159613482
- .long 1072912030
- .long 2689944798
- .long 1072919463
- .long 1248687822
- .long 1072926811
- .long 2967951030
- .long 1072934075
- .long 630170432
- .long 1072941259
- .long 3760898254
- .long 1072948363
- .long 0
- .long 1072955392
- .long 2370273294
- .long 1072962345
- .long 1261754802
- .long 1072972640
- .long 546334065
- .long 1072986123
- .long 1054893830
- .long 1072999340
- .long 1571187597
- .long 1073012304
- .long 1107975175
- .long 1073025027
- .long 3606909377
- .long 1073037519
- .long 1113616747
- .long 1073049792
- .long 4154744632
- .long 1073061853
- .long 3358931423
- .long 1073073713
- .long 4060702372
- .long 1073085379
- .long 747576176
- .long 1073096860
- .long 3023138255
- .long 1073108161
- .long 1419988548
- .long 1073119291
- .long 1914185305
- .long 1073130255
- .long 294389948
- .long 1073141060
- .long 3761802570
- .long 1073151710
- .long 978281566
- .long 1073162213
- .long 823148820
- .long 1073172572
- .long 2420954441
- .long 1073182792
- .long 3815449908
- .long 1073192878
- .long 2046058587
- .long 1073202835
- .long 1807524753
- .long 1073212666
- .long 2628681401
- .long 1073222375
- .long 3225667357
- .long 1073231966
- .long 1555307421
- .long 1073241443
- .long 3454043099
- .long 1073250808
- .long 1208137896
- .long 1073260066
- .long 3659916772
- .long 1073269218
- .long 1886261264
- .long 1073278269
- .long 3593647839
- .long 1073287220
- .long 3086012205
- .long 1073296075
- .long 2769796922
- .long 1073304836
- .long 888716057
- .long 1073317807
- .long 2201465623
- .long 1073334794
- .long 164369365
- .long 1073351447
- .long 3462666733
- .long 1073367780
- .long 2773905457
- .long 1073383810
- .long 1342879088
- .long 1073399550
- .long 2543933975
- .long 1073415012
- .long 1684477781
- .long 1073430209
- .long 3532178543
- .long 1073445151
- .long 1147747300
- .long 1073459850
- .long 1928031793
- .long 1073474314
- .long 2079717015
- .long 1073488553
- .long 4016765315
- .long 1073502575
- .long 3670431139
- .long 1073516389
- .long 3549227225
- .long 1073530002
- .long 11637607
- .long 1073543422
- .long 588220169
- .long 1073556654
- .long 2635407503
- .long 1073569705
- .long 2042029317
- .long 1073582582
- .long 1925128962
- .long 1073595290
- .long 4136375664
- .long 1073607834
- .long 759964600
- .long 1073620221
- .long 4257606771
- .long 1073632453
- .long 297278907
- .long 1073644538
- .long 3655053093
- .long 1073656477
- .long 2442253172
- .long 1073668277
- .long 1111876799
- .long 1073679941
- .long 3330973139
- .long 1073691472
- .long 3438879452
- .long 1073702875
- .long 3671565478
- .long 1073714153
- .long 1317849547
- .long 1073725310
- .long 1642364115
- .long 1073736348
- .long 4050900474
- .long 1014427190
- .long 1157977860
- .long 1016444461
- .long 1374568199
- .long 1017271387
- .long 2809163288
- .long 1016882676
- .long 3742377377
- .long 1013168191
- .long 3101606597
- .long 1017541672
- .long 65224358
- .long 1017217597
- .long 2691591250
- .long 1017266643
- .long 4020758549
- .long 1017689313
- .long 1316310992
- .long 1018030788
- .long 1031537856
- .long 1014090882
- .long 3261395239
- .long 1016413641
- .long 886424999
- .long 1016313335
- .long 3114776834
- .long 1014195875
- .long 1681120620
- .long 1017825416
- .long 1329600273
- .long 1016625740
- .long 465474623
- .long 1017097119
- .long 4251633980
- .long 1017169077
- .long 1986990133
- .long 1017710645
- .long 752958613
- .long 1017159641
- .long 2216216792
- .long 1018020163
- .long 4282860129
- .long 1015924861
- .long 1557627859
- .long 1016039538
- .long 3889219754
- .long 1018086237
- .long 3684996408
- .long 1017353275
- .long 723532103
- .long 1017717141
- .long 2951149676
- .long 1012528470
- .long 831890937
- .long 1017830553
- .long 1031212645
- .long 1017387331
- .long 2741737450
- .long 1017604974
- .long 2863311531
- .long 1003776682
- .long 4276736099
- .long 1013153088
- .long 4111778382
- .long 1015673686
- .long 1728065769
- .long 1016413986
- .long 2708718031
- .long 1018078833
- .long 1069335005
- .long 1015291224
- .long 700037144
- .long 1016482032
- .long 2904566452
- .long 1017226861
- .long 4074156649
- .long 1017622651
- .long 25019565
- .long 1015245366
- .long 3601952608
- .long 1015771755
- .long 3267129373
- .long 1017904664
- .long 503203103
- .long 1014921629
- .long 2122011730
- .long 1018027866
- .long 3927295461
- .long 1014189456
- .long 2790625147
- .long 1016024251
- .long 1330460186
- .long 1016940346
- .long 4033568463
- .long 1015538390
- .long 3695818227
- .long 1017509621
- .long 257573361
- .long 1017208868
- .long 3227697852
- .long 1017337964
- .long 234118548
- .long 1017169577
- .long 4009025803
- .long 1017278524
- .long 1948343394
- .long 1017749310
- .long 678398162
- .long 1018144239
- .long 3083864863
- .long 1016669086
- .long 2415453452
- .long 1017890370
- .long 175467344
- .long 1017330033
- .long 3197359580
- .long 1010339928
- .long 2071276951
- .long 1015941358
- .long 268372543
- .long 1016737773
- .long 938132959
- .long 1017389108
- .long 1816750559
- .long 1017337448
- .long 4119203749
- .long 1017152174
- .long 2578653878
- .long 1013108497
- .long 2470331096
- .long 1014678606
- .long 123855735
- .long 1016553320
- .long 1265650889
- .long 1014782687
- .long 3414398172
- .long 1017182638
- .long 1040773369
- .long 1016158401
- .long 3483628886
- .long 1016886550
- .long 4140499405
- .long 1016191425
- .long 3893477850
- .long 1016964495
- .long 3935319771
- .long 1009634717
- .long 2978982660
- .long 1015027112
- .long 2452709923
- .long 1017990229
- .long 3190365712
- .long 1015835149
- .long 4237588139
- .long 1015832925
- .long 2610678389
- .long 1017962711
- .long 2127316774
- .long 1017405770
- .long 824267502
- .long 1017959463
- .long 2165924042
- .long 1017912225
- .long 2774007076
- .long 1013257418
- .long 4123916326
- .long 1017582284
- .long 1976417958
- .long 1016959909
- .long 4092806412
- .long 1017711279
- .long 119251817
- .long 1015363631
- .long 3475418768
- .long 1017675415
- .long 1972580503
- .long 1015470684
- .long 815541017
- .long 1017517969
- .long 2429917451
- .long 1017397776
- .long 4062888482
- .long 1016749897
- .long 68284153
- .long 1017925678
- .long 2207779246
- .long 1016320298
- .long 1183466520
- .long 1017408657
- .long 143326427
- .long 1017060403
- .long 0
- .long 2146435072
- .long 0
- .long 0
- .long 0
- .long 4293918720
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .long 0
- .long 1138753536
- .long 0
- .long 0
- .type static_const_table,@object
- .size static_const_table,2000
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/s_cos.S b/libm/x86/s_cos.S
deleted file mode 100644
index e47c63e..0000000
--- a/libm/x86/s_cos.S
+++ /dev/null
@@ -1,892 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// 1. RANGE REDUCTION
-//
-// We perform an initial range reduction from X to r with
-//
-// X =~= N * pi/32 + r
-//
-// so that |r| <= pi/64 + epsilon. We restrict inputs to those
-// where |N| <= 932560. Beyond this, the range reduction is
-// insufficiently accurate. For extremely small inputs,
-// denormalization can occur internally, impacting performance.
-// This means that the main path is actually only taken for
-// 2^-252 <= |X| < 90112.
-//
-// To avoid branches, we perform the range reduction to full
-// accuracy each time.
-//
-// X - N * (P_1 + P_2 + P_3)
-//
-// where P_1 and P_2 are 32-bit numbers (so multiplication by N
-// is exact) and P_3 is a 53-bit number. Together, these
-// approximate pi well enough for all cases in the restricted
-// range.
-//
-// The main reduction sequence is:
-//
-// y = 32/pi * x
-// N = integer(y)
-// (computed by adding and subtracting off SHIFTER)
-//
-// m_1 = N * P_1
-// m_2 = N * P_2
-// r_1 = x - m_1
-// r = r_1 - m_2
-// (this r can be used for most of the calculation)
-//
-// c_1 = r_1 - r
-// m_3 = N * P_3
-// c_2 = c_1 - m_2
-// c = c_2 - m_3
-//
-// 2. MAIN ALGORITHM
-//
-// The algorithm uses a table lookup based on B = M * pi / 32
-// where M = N mod 64. The stored values are:
-// sigma closest power of 2 to cos(B)
-// C_hl 53-bit cos(B) - sigma
-// S_hi + S_lo 2 * 53-bit sin(B)
-//
-// The computation is organized as follows:
-//
-// sin(B + r + c) = [sin(B) + sigma * r] +
-// r * (cos(B) - sigma) +
-// sin(B) * [cos(r + c) - 1] +
-// cos(B) * [sin(r + c) - r]
-//
-// which is approximately:
-//
-// [S_hi + sigma * r] +
-// C_hl * r +
-// S_lo + S_hi * [(cos(r) - 1) - r * c] +
-// (C_hl + sigma) * [(sin(r) - r) + c]
-//
-// and this is what is actually computed. We separate this sum
-// into four parts:
-//
-// hi + med + pols + corr
-//
-// where
-//
-// hi = S_hi + sigma r
-// med = C_hl * r
-// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r)
-// corr = S_lo + c * ((C_hl + sigma) - S_hi * r)
-//
-// 3. POLYNOMIAL
-//
-// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) *
-// (sin(r) - r) can be rearranged freely, since it is quite
-// small, so we exploit parallelism to the fullest.
-//
-// psc4 = SC_4 * r_1
-// msc4 = psc4 * r
-// r2 = r * r
-// msc2 = SC_2 * r2
-// r4 = r2 * r2
-// psc3 = SC_3 + msc4
-// psc1 = SC_1 + msc2
-// msc3 = r4 * psc3
-// sincospols = psc1 + msc3
-// pols = sincospols *
-// <S_hi * r^2 | (C_hl + sigma) * r^3>
-//
-// 4. CORRECTION TERM
-//
-// This is where the "c" component of the range reduction is
-// taken into account; recall that just "r" is used for most of
-// the calculation.
-//
-// -c = m_3 - c_2
-// -d = S_hi * r - (C_hl + sigma)
-// corr = -c * -d + S_lo
-//
-// 5. COMPENSATED SUMMATIONS
-//
-// The two successive compensated summations add up the high
-// and medium parts, leaving just the low parts to add up at
-// the end.
-//
-// rs = sigma * r
-// res_int = S_hi + rs
-// k_0 = S_hi - res_int
-// k_2 = k_0 + rs
-// med = C_hl * r
-// res_hi = res_int + med
-// k_1 = res_int - res_hi
-// k_3 = k_1 + med
-//
-// 6. FINAL SUMMATION
-//
-// We now add up all the small parts:
-//
-// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3
-//
-// Now the overall result is just:
-//
-// res_hi + res_lo
-//
-// 7. SMALL ARGUMENTS
-//
-// Inputs with |X| < 2^-252 are treated specially as
-// 1 - |x|.
-//
-// Special cases:
-// cos(NaN) = quiet NaN, and raise invalid exception
-// cos(INF) = NaN and raise invalid exception
-// cos(0) = 1
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin cos
-ENTRY(cos)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $120, %esp
- movl %ebx, 56(%esp)
- call static_func
- movl %eax, %ebx
- movsd 128(%esp), %xmm0
- pextrw $3, %xmm0, %eax
- andl $32767, %eax
- subl $12336, %eax
- cmpl $4293, %eax
- ja .L_2TAG_PACKET_0.0.2
- movsd 2160(%ebx), %xmm1
- mulsd %xmm0, %xmm1
- movapd 2240(%ebx), %xmm5
- movsd 2224(%ebx), %xmm4
- andpd %xmm0, %xmm4
- orps %xmm4, %xmm5
- movsd 2128(%ebx), %xmm3
- movapd 2112(%ebx), %xmm2
- addpd %xmm5, %xmm1
- cvttsd2si %xmm1, %edx
- cvtsi2sdl %edx, %xmm1
- mulsd %xmm1, %xmm3
- unpcklpd %xmm1, %xmm1
- addl $1865232, %edx
- movapd %xmm0, %xmm4
- andl $63, %edx
- movapd 2096(%ebx), %xmm5
- lea (%ebx), %eax
- shll $5, %edx
- addl %edx, %eax
- mulpd %xmm1, %xmm2
- subsd %xmm3, %xmm0
- mulsd 2144(%ebx), %xmm1
- subsd %xmm3, %xmm4
- movsd 8(%eax), %xmm7
- unpcklpd %xmm0, %xmm0
- movapd %xmm4, %xmm3
- subsd %xmm2, %xmm4
- mulpd %xmm0, %xmm5
- subpd %xmm2, %xmm0
- movapd 2064(%ebx), %xmm6
- mulsd %xmm4, %xmm7
- subsd %xmm4, %xmm3
- mulpd %xmm0, %xmm5
- mulpd %xmm0, %xmm0
- subsd %xmm2, %xmm3
- movapd (%eax), %xmm2
- subsd %xmm3, %xmm1
- movsd 24(%eax), %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm7
- mulsd %xmm4, %xmm2
- mulpd %xmm0, %xmm6
- mulsd %xmm4, %xmm3
- mulpd %xmm0, %xmm2
- mulpd %xmm0, %xmm0
- addpd 2080(%ebx), %xmm5
- mulsd (%eax), %xmm4
- addpd 2048(%ebx), %xmm6
- mulpd %xmm0, %xmm5
- movapd %xmm3, %xmm0
- addsd 8(%eax), %xmm3
- mulpd %xmm7, %xmm1
- movapd %xmm4, %xmm7
- addsd %xmm3, %xmm4
- addpd %xmm5, %xmm6
- movsd 8(%eax), %xmm5
- subsd %xmm3, %xmm5
- subsd %xmm4, %xmm3
- addsd 16(%eax), %xmm1
- mulpd %xmm2, %xmm6
- addsd %xmm0, %xmm5
- addsd %xmm7, %xmm3
- addsd %xmm5, %xmm1
- addsd %xmm3, %xmm1
- addsd %xmm6, %xmm1
- unpckhpd %xmm6, %xmm6
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm4
- movsd %xmm4, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_0.0.2:
- jg .L_2TAG_PACKET_2.0.2
- pextrw $3, %xmm0, %eax
- andl $32767, %eax
- pinsrw $3, %eax, %xmm0
- movsd 2192(%ebx), %xmm1
- subsd %xmm0, %xmm1
- movsd %xmm1, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- movl 132(%esp), %eax
- andl $2146435072, %eax
- cmpl $2146435072, %eax
- je .L_2TAG_PACKET_3.0.2
- subl $32, %esp
- movsd %xmm0, (%esp)
- lea 40(%esp), %eax
- movl %eax, 8(%esp)
- movl $1, %eax
- movl %eax, 12(%esp)
- call __libm_sincos_huge
- addl $32, %esp
- fldl 8(%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_3.0.2:
- fldl 128(%esp)
- fmull 2208(%ebx)
-.L_2TAG_PACKET_1.0.2:
- movl 56(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(cos)
-# -- End cos
-
-# Start file scope ASM
-ALIAS_SYMBOL(cosl, cos);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 393047345
- .long 3212032302
- .long 3156849708
- .long 1069094822
- .long 3758096384
- .long 3158189848
- .long 0
- .long 1072693248
- .long 18115067
- .long 3214126342
- .long 1013556747
- .long 1070135480
- .long 3221225472
- .long 3160567065
- .long 0
- .long 1072693248
- .long 2476548698
- .long 3215330282
- .long 785751814
- .long 1070765062
- .long 2684354560
- .long 3161838221
- .long 0
- .long 1072693248
- .long 2255197647
- .long 3216211105
- .long 2796464483
- .long 1071152610
- .long 3758096384
- .long 3160878317
- .long 0
- .long 1072693248
- .long 1945768569
- .long 3216915048
- .long 939980347
- .long 1071524701
- .long 536870912
- .long 1012796809
- .long 0
- .long 1072693248
- .long 1539668340
- .long 3217396327
- .long 967731400
- .long 1071761211
- .long 536870912
- .long 1015752157
- .long 0
- .long 1072693248
- .long 1403757309
- .long 3217886718
- .long 621354454
- .long 1071926515
- .long 536870912
- .long 1013450602
- .long 0
- .long 1072693248
- .long 2583490354
- .long 1070236281
- .long 1719614413
- .long 1072079006
- .long 536870912
- .long 3163282740
- .long 0
- .long 1071644672
- .long 2485417816
- .long 1069626316
- .long 1796544321
- .long 1072217216
- .long 536870912
- .long 3162686945
- .long 0
- .long 1071644672
- .long 2598800519
- .long 1068266419
- .long 688824739
- .long 1072339814
- .long 3758096384
- .long 1010431536
- .long 0
- .long 1071644672
- .long 2140183630
- .long 3214756396
- .long 4051746225
- .long 1072445618
- .long 2147483648
- .long 3161907377
- .long 0
- .long 1071644672
- .long 1699043957
- .long 3216902261
- .long 3476196678
- .long 1072533611
- .long 536870912
- .long 1014257638
- .long 0
- .long 1071644672
- .long 1991047213
- .long 1067753521
- .long 1455828442
- .long 1072602945
- .long 3758096384
- .long 1015505073
- .long 0
- .long 1070596096
- .long 240740309
- .long 3215727903
- .long 3489094832
- .long 1072652951
- .long 536870912
- .long 1014325783
- .long 0
- .long 1070596096
- .long 257503056
- .long 3214647653
- .long 2748392742
- .long 1072683149
- .long 1073741824
- .long 3163061750
- .long 0
- .long 1069547520
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 0
- .long 257503056
- .long 1067164005
- .long 2748392742
- .long 1072683149
- .long 1073741824
- .long 3163061750
- .long 0
- .long 3217031168
- .long 240740309
- .long 1068244255
- .long 3489094832
- .long 1072652951
- .long 536870912
- .long 1014325783
- .long 0
- .long 3218079744
- .long 1991047213
- .long 3215237169
- .long 1455828442
- .long 1072602945
- .long 3758096384
- .long 1015505073
- .long 0
- .long 3218079744
- .long 1699043957
- .long 1069418613
- .long 3476196678
- .long 1072533611
- .long 536870912
- .long 1014257638
- .long 0
- .long 3219128320
- .long 2140183630
- .long 1067272748
- .long 4051746225
- .long 1072445618
- .long 2147483648
- .long 3161907377
- .long 0
- .long 3219128320
- .long 2598800519
- .long 3215750067
- .long 688824739
- .long 1072339814
- .long 3758096384
- .long 1010431536
- .long 0
- .long 3219128320
- .long 2485417816
- .long 3217109964
- .long 1796544321
- .long 1072217216
- .long 536870912
- .long 3162686945
- .long 0
- .long 3219128320
- .long 2583490354
- .long 3217719929
- .long 1719614413
- .long 1072079006
- .long 536870912
- .long 3163282740
- .long 0
- .long 3219128320
- .long 1403757309
- .long 1070403070
- .long 621354454
- .long 1071926515
- .long 536870912
- .long 1013450602
- .long 0
- .long 3220176896
- .long 1539668340
- .long 1069912679
- .long 967731400
- .long 1071761211
- .long 536870912
- .long 1015752157
- .long 0
- .long 3220176896
- .long 1945768569
- .long 1069431400
- .long 939980347
- .long 1071524701
- .long 536870912
- .long 1012796809
- .long 0
- .long 3220176896
- .long 2255197647
- .long 1068727457
- .long 2796464483
- .long 1071152610
- .long 3758096384
- .long 3160878317
- .long 0
- .long 3220176896
- .long 2476548698
- .long 1067846634
- .long 785751814
- .long 1070765062
- .long 2684354560
- .long 3161838221
- .long 0
- .long 3220176896
- .long 18115067
- .long 1066642694
- .long 1013556747
- .long 1070135480
- .long 3221225472
- .long 3160567065
- .long 0
- .long 3220176896
- .long 393047345
- .long 1064548654
- .long 3156849708
- .long 1069094822
- .long 3758096384
- .long 3158189848
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 393047345
- .long 1064548654
- .long 3156849708
- .long 3216578470
- .long 3758096384
- .long 1010706200
- .long 0
- .long 3220176896
- .long 18115067
- .long 1066642694
- .long 1013556747
- .long 3217619128
- .long 3221225472
- .long 1013083417
- .long 0
- .long 3220176896
- .long 2476548698
- .long 1067846634
- .long 785751814
- .long 3218248710
- .long 2684354560
- .long 1014354573
- .long 0
- .long 3220176896
- .long 2255197647
- .long 1068727457
- .long 2796464483
- .long 3218636258
- .long 3758096384
- .long 1013394669
- .long 0
- .long 3220176896
- .long 1945768569
- .long 1069431400
- .long 939980347
- .long 3219008349
- .long 536870912
- .long 3160280457
- .long 0
- .long 3220176896
- .long 1539668340
- .long 1069912679
- .long 967731400
- .long 3219244859
- .long 536870912
- .long 3163235805
- .long 0
- .long 3220176896
- .long 1403757309
- .long 1070403070
- .long 621354454
- .long 3219410163
- .long 536870912
- .long 3160934250
- .long 0
- .long 3220176896
- .long 2583490354
- .long 3217719929
- .long 1719614413
- .long 3219562654
- .long 536870912
- .long 1015799092
- .long 0
- .long 3219128320
- .long 2485417816
- .long 3217109964
- .long 1796544321
- .long 3219700864
- .long 536870912
- .long 1015203297
- .long 0
- .long 3219128320
- .long 2598800519
- .long 3215750067
- .long 688824739
- .long 3219823462
- .long 3758096384
- .long 3157915184
- .long 0
- .long 3219128320
- .long 2140183630
- .long 1067272748
- .long 4051746225
- .long 3219929266
- .long 2147483648
- .long 1014423729
- .long 0
- .long 3219128320
- .long 1699043957
- .long 1069418613
- .long 3476196678
- .long 3220017259
- .long 536870912
- .long 3161741286
- .long 0
- .long 3219128320
- .long 1991047213
- .long 3215237169
- .long 1455828442
- .long 3220086593
- .long 3758096384
- .long 3162988721
- .long 0
- .long 3218079744
- .long 240740309
- .long 1068244255
- .long 3489094832
- .long 3220136599
- .long 536870912
- .long 3161809431
- .long 0
- .long 3218079744
- .long 257503056
- .long 1067164005
- .long 2748392742
- .long 3220166797
- .long 1073741824
- .long 1015578102
- .long 0
- .long 3217031168
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 0
- .long 257503056
- .long 3214647653
- .long 2748392742
- .long 3220166797
- .long 1073741824
- .long 1015578102
- .long 0
- .long 1069547520
- .long 240740309
- .long 3215727903
- .long 3489094832
- .long 3220136599
- .long 536870912
- .long 3161809431
- .long 0
- .long 1070596096
- .long 1991047213
- .long 1067753521
- .long 1455828442
- .long 3220086593
- .long 3758096384
- .long 3162988721
- .long 0
- .long 1070596096
- .long 1699043957
- .long 3216902261
- .long 3476196678
- .long 3220017259
- .long 536870912
- .long 3161741286
- .long 0
- .long 1071644672
- .long 2140183630
- .long 3214756396
- .long 4051746225
- .long 3219929266
- .long 2147483648
- .long 1014423729
- .long 0
- .long 1071644672
- .long 2598800519
- .long 1068266419
- .long 688824739
- .long 3219823462
- .long 3758096384
- .long 3157915184
- .long 0
- .long 1071644672
- .long 2485417816
- .long 1069626316
- .long 1796544321
- .long 3219700864
- .long 536870912
- .long 1015203297
- .long 0
- .long 1071644672
- .long 2583490354
- .long 1070236281
- .long 1719614413
- .long 3219562654
- .long 536870912
- .long 1015799092
- .long 0
- .long 1071644672
- .long 1403757309
- .long 3217886718
- .long 621354454
- .long 3219410163
- .long 536870912
- .long 3160934250
- .long 0
- .long 1072693248
- .long 1539668340
- .long 3217396327
- .long 967731400
- .long 3219244859
- .long 536870912
- .long 3163235805
- .long 0
- .long 1072693248
- .long 1945768569
- .long 3216915048
- .long 939980347
- .long 3219008349
- .long 536870912
- .long 3160280457
- .long 0
- .long 1072693248
- .long 2255197647
- .long 3216211105
- .long 2796464483
- .long 3218636258
- .long 3758096384
- .long 1013394669
- .long 0
- .long 1072693248
- .long 2476548698
- .long 3215330282
- .long 785751814
- .long 3218248710
- .long 2684354560
- .long 1014354573
- .long 0
- .long 1072693248
- .long 18115067
- .long 3214126342
- .long 1013556747
- .long 3217619128
- .long 3221225472
- .long 1013083417
- .long 0
- .long 1072693248
- .long 393047345
- .long 3212032302
- .long 3156849708
- .long 3216578470
- .long 3758096384
- .long 1010706200
- .long 0
- .long 1072693248
- .long 1431655765
- .long 3217380693
- .long 0
- .long 3219128320
- .long 286331153
- .long 1065423121
- .long 1431655765
- .long 1067799893
- .long 436314138
- .long 3207201184
- .long 381774871
- .long 3210133868
- .long 2773927732
- .long 1053236707
- .long 436314138
- .long 1056571808
- .long 442499072
- .long 1032893537
- .long 442499072
- .long 1032893537
- .long 1413480448
- .long 1069097467
- .long 0
- .long 0
- .long 771977331
- .long 996350346
- .long 0
- .long 0
- .long 1841940611
- .long 1076125488
- .long 0
- .long 0
- .long 0
- .long 1127743488
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .long 0
- .long 1071644672
- .long 0
- .long 1071644672
- .type static_const_table,@object
- .size static_const_table,2256
- .data
- .hidden __libm_sincos_huge
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/s_expm1.S b/libm/x86/s_expm1.S
deleted file mode 100644
index 1816f59..0000000
--- a/libm/x86/s_expm1.S
+++ /dev/null
@@ -1,702 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Description:
-// Let K = 64 (table size).
-//
-// Four sub-domains:
-// 1. |x| < 1/(2*K)
-// expm1(x) ~ P(x)
-// 2. 1/(2*K) <= |x| <= 56*log(2)
-// x x/log(2) n
-// e - 1 = 2 = 2 * T[j] * (1 + P(y)) - 1
-// 3. 56*log(2) < x < MAX_LOG
-// x x x/log(2) n
-// e - 1 ~ e = 2 = 2 * T[j] * (1 + P(y))
-// 4. x < -56*log(2)
-// x x
-// e - 1 = -1 + e ~ -1
-// where
-// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K]
-// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2]
-// j/K
-// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
-//
-// P(y) is a minimax polynomial approximation of exp(x)-1
-// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
-//
-// In case 3, to avoid problems with arithmetic overflow and underflow,
-// n n1 n2
-// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
-// and BIAS is a value of exponent bias.
-//
-// Special cases:
-// expm1(NaN) is NaN
-// expm1(+INF) is +INF
-// expm1(-INF) is -1
-// expm1(x) is x for subnormals
-// for finite argument, only expm1(0)=0 is exact.
-// For IEEE double
-// if x > 709.782712893383973096 then expm1(x) overflow
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin expm1
-ENTRY(expm1)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $120, %esp
- movl %ebx, 64(%esp)
- call static_func
- movl %eax, %ebx
- movsd 128(%esp), %xmm0
- unpcklpd %xmm0, %xmm0
- movapd 64(%ebx), %xmm1
- movapd 48(%ebx), %xmm6
- movapd 80(%ebx), %xmm2
- movapd 96(%ebx), %xmm3
- pextrw $3, %xmm0, %eax
- andl $32767, %eax
- movl $16527, %edx
- subl %eax, %edx
- subl $16304, %eax
- orl %eax, %edx
- cmpl $-2147483648, %edx
- jae .L_2TAG_PACKET_0.0.2
- mulpd %xmm0, %xmm1
- addpd %xmm6, %xmm1
- movapd %xmm1, %xmm7
- subpd %xmm6, %xmm1
- mulpd %xmm1, %xmm2
- movapd 112(%ebx), %xmm4
- mulpd %xmm1, %xmm3
- movapd 128(%ebx), %xmm5
- subpd %xmm2, %xmm0
- movd %xmm7, %eax
- movl %eax, %ecx
- andl $63, %ecx
- shll $4, %ecx
- sarl $6, %eax
- movl %eax, %edx
- subpd %xmm3, %xmm0
- movapd 160(%ebx,%ecx), %xmm2
- movsd 144(%ebx), %xmm3
- mulpd %xmm0, %xmm4
- movapd %xmm0, %xmm1
- mulpd %xmm0, %xmm0
- mulsd %xmm0, %xmm3
- addpd %xmm4, %xmm5
- mulsd %xmm0, %xmm0
- movapd %xmm2, %xmm4
- unpckhpd %xmm2, %xmm2
- movdqa 16(%ebx), %xmm6
- pand %xmm6, %xmm7
- movdqa 32(%ebx), %xmm6
- paddq %xmm6, %xmm7
- psllq $46, %xmm7
- mulsd %xmm0, %xmm3
- mulpd %xmm5, %xmm0
- addl $894, %edx
- cmpl $1916, %edx
- ja .L_2TAG_PACKET_1.0.2
- addsd %xmm3, %xmm0
- xorpd %xmm3, %xmm3
- movl $16368, %eax
- pinsrw $3, %eax, %xmm3
- orpd %xmm7, %xmm2
- mulsd %xmm4, %xmm7
- movapd %xmm3, %xmm6
- addsd %xmm1, %xmm3
- pextrw $3, %xmm2, %edx
- pshufd $238, %xmm0, %xmm5
- psrlq $38, %xmm3
- psllq $38, %xmm3
- movapd %xmm2, %xmm4
- subsd %xmm3, %xmm6
- addsd %xmm5, %xmm0
- addsd %xmm6, %xmm1
- addsd %xmm7, %xmm4
- mulsd %xmm3, %xmm7
- mulsd %xmm2, %xmm3
- xorpd %xmm5, %xmm5
- movl $16368, %eax
- pinsrw $3, %eax, %xmm5
- addsd %xmm1, %xmm0
- movl $17184, %ecx
- subl %edx, %ecx
- subl $16256, %edx
- orl %edx, %ecx
- jl .L_2TAG_PACKET_2.0.2
- mulsd %xmm4, %xmm0
- subsd %xmm5, %xmm3
- addsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
-.L_2TAG_PACKET_3.0.2:
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_2.0.2:
- cmpl $0, %edx
- jl .L_2TAG_PACKET_5.0.2
- mulsd %xmm4, %xmm0
- subsd %xmm5, %xmm7
- addsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_5.0.2:
- mulsd %xmm4, %xmm0
- addsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
- subsd %xmm5, %xmm0
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_1.0.2:
- movl 132(%esp), %ecx
- addsd %xmm0, %xmm1
- unpckhpd %xmm0, %xmm0
- addsd %xmm1, %xmm0
- cmpl $0, %ecx
- jl .L_2TAG_PACKET_6.0.2
- fstcw 24(%esp)
- movzwl 24(%esp), %edx
- orl $768, %edx
- movw %dx, 28(%esp)
- fldcw 28(%esp)
- movl %eax, %edx
- sarl $1, %eax
- subl %eax, %edx
- movdqa (%ebx), %xmm6
- pandn %xmm2, %xmm6
- addl $1023, %eax
- movd %eax, %xmm3
- psllq $52, %xmm3
- orpd %xmm3, %xmm6
- mulsd %xmm3, %xmm4
- movsd %xmm0, 8(%esp)
- fldl 8(%esp)
- movsd %xmm6, 16(%esp)
- fldl 16(%esp)
- movsd %xmm4, 16(%esp)
- fldl 16(%esp)
- addl $1023, %edx
- movd %edx, %xmm4
- psllq $52, %xmm4
- faddp %st, %st(1)
- fmul %st, %st(1)
- faddp %st, %st(1)
- movsd %xmm4, 8(%esp)
- fldl 8(%esp)
- fmulp %st, %st(1)
- fstpl 8(%esp)
- movsd 8(%esp), %xmm0
- fldcw 24(%esp)
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- cmpl $32752, %ecx
- jae .L_2TAG_PACKET_7.0.2
- jmp .L_2TAG_PACKET_4.0.2
- cmpl $-2147483648, %ecx
- jb .L_2TAG_PACKET_7.0.2
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_7.0.2:
- movl $41, %edx
-.L_2TAG_PACKET_8.0.2:
- movsd %xmm0, (%esp)
- movsd 128(%esp), %xmm0
- fldl (%esp)
- jmp .L_2TAG_PACKET_9.0.2
-.L_2TAG_PACKET_10.0.2:
- cmpl $2146435072, %eax
- jae .L_2TAG_PACKET_11.0.2
- movsd 1272(%ebx), %xmm0
- mulsd %xmm0, %xmm0
- movl $41, %edx
- jmp .L_2TAG_PACKET_8.0.2
-.L_2TAG_PACKET_11.0.2:
- movl 132(%esp), %eax
- movl 128(%esp), %edx
- movl %eax, %ecx
- andl $2147483647, %eax
- cmpl $2146435072, %eax
- ja .L_2TAG_PACKET_12.0.2
- cmpl $0, %edx
- jne .L_2TAG_PACKET_12.0.2
- cmpl $0, %ecx
- jl .L_2TAG_PACKET_13.0.2
- movsd 1256(%ebx), %xmm0
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_13.0.2:
- jmp .L_2TAG_PACKET_6.0.2
-.L_2TAG_PACKET_12.0.2:
- movsd 128(%esp), %xmm0
- addsd %xmm0, %xmm0
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_14.0.2:
- addl $16304, %eax
- cmpl $15504, %eax
- jb .L_2TAG_PACKET_15.0.2
- movapd 1184(%ebx), %xmm2
- pshufd $68, %xmm0, %xmm1
- movapd 1200(%ebx), %xmm3
- movapd 1216(%ebx), %xmm4
- movsd 1232(%ebx), %xmm5
- mulsd %xmm1, %xmm1
- xorpd %xmm6, %xmm6
- movl $16352, %eax
- pinsrw $3, %eax, %xmm6
- mulpd %xmm0, %xmm2
- xorpd %xmm7, %xmm7
- movl $16368, %edx
- pinsrw $3, %edx, %xmm7
- addpd %xmm3, %xmm2
- mulsd %xmm1, %xmm5
- pshufd $228, %xmm1, %xmm3
- mulpd %xmm1, %xmm1
- mulsd %xmm0, %xmm6
- mulpd %xmm0, %xmm2
- addpd %xmm4, %xmm2
- movapd %xmm7, %xmm4
- addsd %xmm6, %xmm7
- mulpd %xmm3, %xmm1
- psrlq $27, %xmm7
- psllq $27, %xmm7
- movsd 1288(%ebx), %xmm3
- subsd %xmm7, %xmm4
- mulpd %xmm1, %xmm2
- addsd %xmm4, %xmm6
- pshufd $238, %xmm2, %xmm1
- addsd %xmm2, %xmm6
- andpd %xmm0, %xmm3
- movapd %xmm0, %xmm4
- addsd %xmm6, %xmm1
- subsd %xmm3, %xmm0
- addsd %xmm5, %xmm1
- mulsd %xmm7, %xmm3
- mulsd %xmm7, %xmm0
- mulsd %xmm1, %xmm4
- addsd %xmm4, %xmm0
- addsd %xmm3, %xmm0
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_15.0.2:
- cmpl $16, %eax
- jae .L_2TAG_PACKET_3.0.2
- movapd %xmm0, %xmm2
- movd %xmm0, %eax
- psrlq $31, %xmm2
- movd %xmm2, %ecx
- orl %ecx, %eax
- je .L_2TAG_PACKET_3.0.2
- movl $16, %edx
- xorpd %xmm1, %xmm1
- pinsrw $3, %edx, %xmm1
- mulsd %xmm1, %xmm1
- movl $42, %edx
- jmp .L_2TAG_PACKET_8.0.2
-.L_2TAG_PACKET_0.0.2:
- cmpl $0, %eax
- jl .L_2TAG_PACKET_14.0.2
- movl 132(%esp), %eax
- cmpl $1083179008, %eax
- jge .L_2TAG_PACKET_10.0.2
- cmpl $-1048576, %eax
- jae .L_2TAG_PACKET_11.0.2
-.L_2TAG_PACKET_6.0.2:
- xorpd %xmm0, %xmm0
- movl $49136, %eax
- pinsrw $3, %eax, %xmm0
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_4.0.2:
- movsd %xmm0, 48(%esp)
- fldl 48(%esp)
-.L_2TAG_PACKET_9.0.2:
- movl 64(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(expm1)
-# -- End expm1
-
-# Start file scope ASM
-ALIAS_SYMBOL(expm1l, expm1);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 0
- .long 4293918720
- .long 0
- .long 4293918720
- .long 4294967232
- .long 0
- .long 4294967232
- .long 0
- .long 65472
- .long 0
- .long 65472
- .long 0
- .long 0
- .long 1127743488
- .long 0
- .long 1127743488
- .long 1697350398
- .long 1079448903
- .long 1697350398
- .long 1079448903
- .long 4277796864
- .long 1065758274
- .long 4277796864
- .long 1065758274
- .long 3164486458
- .long 1025308570
- .long 3164486458
- .long 1025308570
- .long 1963358694
- .long 1065423121
- .long 1431655765
- .long 1069897045
- .long 1431655765
- .long 1067799893
- .long 0
- .long 1071644672
- .long 381774871
- .long 1062650220
- .long 381774871
- .long 1062650220
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1000070955
- .long 1042145304
- .long 1040187392
- .long 11418
- .long 988267849
- .long 1039500660
- .long 3539992576
- .long 22960
- .long 36755401
- .long 1042114290
- .long 402653184
- .long 34629
- .long 3634769483
- .long 1042178627
- .long 1820327936
- .long 46424
- .long 2155991225
- .long 1041560680
- .long 847249408
- .long 58348
- .long 2766913307
- .long 1039293264
- .long 3489660928
- .long 70401
- .long 3651174602
- .long 1040488175
- .long 2927624192
- .long 82586
- .long 3073892131
- .long 1042240606
- .long 1006632960
- .long 94904
- .long 1328391742
- .long 1042019037
- .long 3942645760
- .long 107355
- .long 2650893825
- .long 1041903210
- .long 822083584
- .long 119943
- .long 2397289153
- .long 1041802037
- .long 2281701376
- .long 132667
- .long 430997175
- .long 1042110606
- .long 1845493760
- .long 145530
- .long 1230936525
- .long 1041801015
- .long 1702887424
- .long 158533
- .long 740675935
- .long 1040178913
- .long 4110417920
- .long 171677
- .long 3489810261
- .long 1041825986
- .long 2793406464
- .long 184965
- .long 2532600530
- .long 1040767882
- .long 167772160
- .long 198398
- .long 3542557060
- .long 1041827263
- .long 2986344448
- .long 211976
- .long 1401563777
- .long 1041061093
- .long 922746880
- .long 225703
- .long 3129406026
- .long 1041852413
- .long 880803840
- .long 239579
- .long 900993572
- .long 1039283234
- .long 1275068416
- .long 253606
- .long 2115029358
- .long 1042140042
- .long 562036736
- .long 267786
- .long 1086643152
- .long 1041785419
- .long 1610612736
- .long 282120
- .long 82864366
- .long 1041256244
- .long 3045064704
- .long 296610
- .long 2392968152
- .long 1040913683
- .long 3573547008
- .long 311258
- .long 2905856183
- .long 1040002214
- .long 1988100096
- .long 326066
- .long 3742008261
- .long 1040011137
- .long 1451229184
- .long 341035
- .long 863393794
- .long 1040880621
- .long 914358272
- .long 356167
- .long 1446136837
- .long 1041372426
- .long 3707764736
- .long 371463
- .long 927855201
- .long 1040617636
- .long 360710144
- .long 386927
- .long 1492679939
- .long 1041050306
- .long 2952790016
- .long 402558
- .long 608827001
- .long 1041582217
- .long 2181038080
- .long 418360
- .long 606260204
- .long 1042271987
- .long 1711276032
- .long 434334
- .long 3163044019
- .long 1041843851
- .long 1006632960
- .long 450482
- .long 4148747325
- .long 1041962972
- .long 3900702720
- .long 466805
- .long 802924201
- .long 1041275378
- .long 1442840576
- .long 483307
- .long 3052749833
- .long 1041940577
- .long 1937768448
- .long 499988
- .long 2216116399
- .long 1041486744
- .long 914358272
- .long 516851
- .long 2729697836
- .long 1041445764
- .long 2566914048
- .long 533897
- .long 540608356
- .long 1041310907
- .long 2600468480
- .long 551129
- .long 2916344493
- .long 1040535661
- .long 1107296256
- .long 568549
- .long 731391814
- .long 1039497014
- .long 2566914048
- .long 586158
- .long 1024722704
- .long 1041461625
- .long 2961178624
- .long 603959
- .long 3806831748
- .long 1041732499
- .long 2675965952
- .long 621954
- .long 238953304
- .long 1040316488
- .long 2189426688
- .long 640145
- .long 749123235
- .long 1041725785
- .long 2063597568
- .long 658534
- .long 1168187977
- .long 1041175214
- .long 2986344448
- .long 677123
- .long 3506096399
- .long 1042186095
- .long 1426063360
- .long 695915
- .long 1470221620
- .long 1041675499
- .long 2566914048
- .long 714911
- .long 3182425146
- .long 1041483134
- .long 3087007744
- .long 734114
- .long 3131698208
- .long 1042208657
- .long 4068474880
- .long 753526
- .long 2300504125
- .long 1041428596
- .long 2415919104
- .long 773150
- .long 2290297931
- .long 1037388400
- .long 3716153344
- .long 792987
- .long 3532148223
- .long 1041626194
- .long 771751936
- .long 813041
- .long 1161884404
- .long 1042015258
- .long 3699376128
- .long 833312
- .long 876383176
- .long 1037968878
- .long 1241513984
- .long 853805
- .long 3379986796
- .long 1042213153
- .long 3699376128
- .long 874520
- .long 1545797737
- .long 1041681569
- .long 58720256
- .long 895462
- .long 2925146801
- .long 1042212567
- .long 855638016
- .long 916631
- .long 1316627971
- .long 1038516204
- .long 3883925504
- .long 938030
- .long 3267869137
- .long 1040337004
- .long 2726297600
- .long 959663
- .long 3720868999
- .long 1041782409
- .long 3992977408
- .long 981531
- .long 433316142
- .long 1041994064
- .long 1526726656
- .long 1003638
- .long 781232103
- .long 1040093400
- .long 2172649472
- .long 1025985
- .long 2773927732
- .long 1053236707
- .long 381774871
- .long 1062650220
- .long 379653899
- .long 1056571845
- .long 286331153
- .long 1065423121
- .long 436314138
- .long 1059717536
- .long 1431655765
- .long 1067799893
- .long 1431655765
- .long 1069897045
- .long 0
- .long 1071644672
- .long 0
- .long 1072693248
- .long 0
- .long 2146435072
- .long 0
- .long 0
- .long 4294967295
- .long 2146435071
- .long 0
- .long 1048576
- .long 4227858432
- .long 4294967295
- .type static_const_table,@object
- .size static_const_table,1296
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/s_log1p.S b/libm/x86/s_log1p.S
deleted file mode 100644
index de7b87b..0000000
--- a/libm/x86/s_log1p.S
+++ /dev/null
@@ -1,827 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Let x=2^k * mx, mx in [1,2)
-//
-// Get B~1/mx based on the output of rcpps instruction (B0)
-// B = int((B0*2^7+0.5))/2^7
-//
-// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
-//
-// Result: k*log(2) - log(B) + p(r)
-// p(r) is a degree 7 polynomial
-// -log(B) read from data table (high, low parts)
-// Result is formed from high and low parts
-//
-// Special cases:
-// log1p(NaN) = quiet NaN, and raise invalid exception
-// log1p(+INF) = that INF
-// log1p(x) = NaN if x < -1 or x = -INF, and raises invalid exception
-// log1p(-1) = -INF, and raises divide-by-zero exception
-// log1p(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin log1p
-ENTRY(log1p)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $104, %esp
- movl %ebx, 40(%esp)
- call static_func
- movl %eax, %ebx
- movsd 112(%esp), %xmm0
- xorpd %xmm2, %xmm2
- movl $16368, %eax
- pinsrw $3, %eax, %xmm2
- xorpd %xmm3, %xmm3
- movl $32768, %ecx
- movd %ecx, %xmm4
- movsd 2128(%ebx), %xmm5
- pshufd $68, %xmm0, %xmm7
- movapd %xmm2, %xmm6
- pextrw $3, %xmm0, %ecx
- addsd %xmm2, %xmm0
- movapd %xmm0, %xmm1
- pextrw $3, %xmm0, %eax
- subsd %xmm0, %xmm6
- orpd %xmm2, %xmm0
- psllq $5, %xmm0
- psrlq $34, %xmm0
- subl $16, %eax
- cmpl $32736, %eax
- jae .L_2TAG_PACKET_0.0.2
- addsd %xmm6, %xmm7
- rcpss %xmm0, %xmm0
- psllq $12, %xmm1
- pshufd $228, %xmm5, %xmm6
- psrlq $12, %xmm1
- andl $32752, %ecx
- cmpl $16256, %ecx
- jb .L_2TAG_PACKET_1.0.2
- andl $32752, %eax
- movl $32720, %ecx
- subl %eax, %ecx
- pinsrw $3, %ecx, %xmm3
-.L_2TAG_PACKET_2.0.2:
- mulsd %xmm3, %xmm7
- paddd %xmm4, %xmm0
- xorpd %xmm4, %xmm4
- movl $14336, %ecx
- pinsrw $3, %ecx, %xmm4
- orpd %xmm2, %xmm1
- movd %xmm0, %edx
- psllq $29, %xmm0
- andpd %xmm1, %xmm5
- andpd %xmm6, %xmm0
- subsd %xmm5, %xmm1
- paddd %xmm4, %xmm0
- mulsd %xmm0, %xmm5
- movl $16352, %ecx
- subl %ecx, %eax
- cvtsi2sdl %eax, %xmm4
- mulsd %xmm0, %xmm7
- mulsd %xmm0, %xmm1
- movsd 2064(%ebx), %xmm6
- movapd 2080(%ebx), %xmm3
- subsd %xmm2, %xmm5
- andl $16711680, %edx
- shrl $12, %edx
- movapd (%ebx,%edx), %xmm0
- movapd 2096(%ebx), %xmm2
- addsd %xmm5, %xmm1
- movapd %xmm1, %xmm5
- addsd %xmm7, %xmm1
- subsd %xmm1, %xmm5
- addsd %xmm5, %xmm7
- mulsd %xmm4, %xmm6
- mulsd 2072(%ebx), %xmm4
- mulsd %xmm1, %xmm3
- pshufd $68, %xmm1, %xmm5
- addsd %xmm6, %xmm0
- mulpd %xmm5, %xmm2
- mulpd %xmm5, %xmm5
- pshufd $228, %xmm0, %xmm6
- addsd %xmm1, %xmm0
- addpd 2112(%ebx), %xmm2
- mulpd %xmm5, %xmm3
- subsd %xmm0, %xmm6
- mulsd %xmm1, %xmm2
- addsd %xmm7, %xmm4
- mulsd %xmm1, %xmm7
- addsd %xmm6, %xmm1
- pshufd $238, %xmm0, %xmm6
- mulsd %xmm5, %xmm5
- addsd %xmm6, %xmm4
- subsd %xmm7, %xmm1
- addpd %xmm3, %xmm2
- addsd %xmm4, %xmm1
- mulpd %xmm5, %xmm2
- addsd %xmm2, %xmm1
- pshufd $238, %xmm2, %xmm5
- addsd %xmm5, %xmm1
- addsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_0.0.2:
- movsd 112(%esp), %xmm0
- movapd %xmm0, %xmm1
- addl $16, %eax
- cmpl $32768, %eax
- jae .L_2TAG_PACKET_4.0.2
- cmpl $0, %eax
- je .L_2TAG_PACKET_5.0.2
-.L_2TAG_PACKET_6.0.2:
- addsd %xmm0, %xmm0
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_7.0.2:
- ja .L_2TAG_PACKET_6.0.2
- cmpl $0, %edx
- ja .L_2TAG_PACKET_6.0.2
- jmp .L_2TAG_PACKET_8.0.2
-.L_2TAG_PACKET_4.0.2:
- movd %xmm1, %edx
- psrlq $32, %xmm1
- movd %xmm1, %ecx
- addl %ecx, %ecx
- cmpl $-2097152, %ecx
- jae .L_2TAG_PACKET_7.0.2
- orl %ecx, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_5.0.2
-.L_2TAG_PACKET_8.0.2:
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $32752, %eax
- pinsrw $3, %eax, %xmm1
- movl $141, %edx
- mulsd %xmm1, %xmm0
-.L_2TAG_PACKET_9.0.2:
- movsd %xmm0, (%esp)
- movsd 112(%esp), %xmm0
- fldl (%esp)
- jmp .L_2TAG_PACKET_10.0.2
-.L_2TAG_PACKET_5.0.2:
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $49136, %eax
- pinsrw $3, %eax, %xmm0
- divsd %xmm1, %xmm0
- movl $140, %edx
- jmp .L_2TAG_PACKET_9.0.2
-.L_2TAG_PACKET_1.0.2:
- movsd 112(%esp), %xmm0
- cmpl $15504, %ecx
- jb .L_2TAG_PACKET_11.0.2
- movapd 2144(%ebx), %xmm1
- pshufd $68, %xmm0, %xmm0
- movapd 2160(%ebx), %xmm2
- pshufd $68, %xmm0, %xmm4
- movapd 2176(%ebx), %xmm3
- mulpd %xmm0, %xmm1
- xorpd %xmm6, %xmm6
- mulpd %xmm4, %xmm4
- addpd %xmm2, %xmm1
- pshufd $68, %xmm4, %xmm5
- mulpd %xmm0, %xmm4
- movl $49120, %eax
- pinsrw $3, %eax, %xmm6
- mulpd %xmm0, %xmm1
- mulsd %xmm4, %xmm4
- addpd %xmm3, %xmm1
- mulsd %xmm6, %xmm5
- mulpd %xmm4, %xmm1
- pshufd $238, %xmm1, %xmm7
- addsd %xmm7, %xmm1
- addsd %xmm5, %xmm1
- addsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_11.0.2:
- cmpl $16, %ecx
- jb .L_2TAG_PACKET_12.0.2
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_12.0.2:
- movapd %xmm0, %xmm1
- mulsd %xmm1, %xmm1
- jmp .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_3.0.2:
- movsd %xmm0, 24(%esp)
- fldl 24(%esp)
-.L_2TAG_PACKET_10.0.2:
- movl 40(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(log1p)
-# -- End log1p
-
-# Start file scope ASM
-ALIAS_SYMBOL(log1pl, log1p);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 4277811200
- .long 1072049730
- .long 2479318832
- .long 1026487127
- .long 2854492160
- .long 1072033410
- .long 215631550
- .long 1025638968
- .long 1547061248
- .long 1072017216
- .long 2886781435
- .long 1026423395
- .long 649825280
- .long 1072001146
- .long 4281533405
- .long 1024038923
- .long 646346752
- .long 1071985198
- .long 1562735921
- .long 1023790276
- .long 2203734016
- .long 1071969370
- .long 1838397691
- .long 3173936209
- .long 1872169984
- .long 1071953661
- .long 3981202460
- .long 1022325013
- .long 669557760
- .long 1071938069
- .long 4182597802
- .long 3173174122
- .long 4076413952
- .long 1071922591
- .long 1209029111
- .long 3170736207
- .long 556125184
- .long 1071907228
- .long 821086028
- .long 3173437049
- .long 204914688
- .long 1071891976
- .long 2097025986
- .long 3171071798
- .long 387545088
- .long 1071876834
- .long 3142936996
- .long 3173092218
- .long 2912783360
- .long 1071861800
- .long 2502420140
- .long 1024505919
- .long 1144260608
- .long 1071846874
- .long 3315658140
- .long 3173469843
- .long 1471209472
- .long 1071832053
- .long 129621009
- .long 3172443877
- .long 1829683200
- .long 1071817336
- .long 3885467693
- .long 1025535275
- .long 288676864
- .long 1071802722
- .long 86139472
- .long 3171639793
- .long 3636378624
- .long 1071788208
- .long 1850238587
- .long 1024654342
- .long 1606817792
- .long 1071773795
- .long 3388899795
- .long 3173675586
- .long 1236164608
- .long 1071759480
- .long 3983599207
- .long 1020046558
- .long 1089616896
- .long 1071745262
- .long 4171974224
- .long 1024773198
- .long 4143093760
- .long 1071731139
- .long 2727587401
- .long 3173965207
- .long 600267776
- .long 1071717112
- .long 3147685042
- .long 3173353031
- .long 2249313280
- .long 1071703177
- .long 125835074
- .long 1025255832
- .long 3805303808
- .long 1071689334
- .long 2289991207
- .long 1025460331
- .long 87278592
- .long 1071675583
- .long 1106114045
- .long 1025933602
- .long 3195405312
- .long 1071661920
- .long 3885316576
- .long 3171206239
- .long 3853649920
- .long 1071648346
- .long 2977069852
- .long 3171236771
- .long 2944026624
- .long 1071625048
- .long 1008093493
- .long 1023444474
- .long 3993180160
- .long 1071598247
- .long 1862355595
- .long 1024642533
- .long 1454641152
- .long 1071571617
- .long 1514603089
- .long 1026500596
- .long 3286085632
- .long 1071545154
- .long 1400028424
- .long 3173279056
- .long 438773760
- .long 1071518858
- .long 120727864
- .long 3172148914
- .long 1212979200
- .long 1071492725
- .long 1625055594
- .long 3172901933
- .long 1189017600
- .long 1071466754
- .long 3920062376
- .long 1025727407
- .long 403064832
- .long 1071440943
- .long 1053271728
- .long 3171391427
- .long 3343210496
- .long 1071415289
- .long 3243395502
- .long 3173627613
- .long 1765777408
- .long 1071389792
- .long 2145968512
- .long 1026354304
- .long 461430784
- .long 1071364449
- .long 4094322285
- .long 1026021467
- .long 71706624
- .long 1071339258
- .long 763632021
- .long 1024496933
- .long 1380503552
- .long 1071314217
- .long 1383547992
- .long 3173088453
- .long 1015732224
- .long 1071289325
- .long 3198646877
- .long 1025390322
- .long 35977216
- .long 1071264580
- .long 2141026805
- .long 1025754693
- .long 3927306240
- .long 1071239979
- .long 282116272
- .long 3173394334
- .long 1125341184
- .long 1071215523
- .long 2768427504
- .long 3172279059
- .long 1666971648
- .long 1071191208
- .long 786837629
- .long 3172427445
- .long 2827694080
- .long 1071167033
- .long 3857122416
- .long 3173014241
- .long 2003683328
- .long 1071142997
- .long 859010954
- .long 1026545007
- .long 1004017664
- .long 1071119098
- .long 3356644970
- .long 3173458064
- .long 1753020416
- .long 1071095334
- .long 788338552
- .long 1026157693
- .long 1992718336
- .long 1071071704
- .long 1239179443
- .long 1026394889
- .long 3870234624
- .long 1071048206
- .long 2082614663
- .long 1024926053
- .long 1050437632
- .long 1071024840
- .long 660007840
- .long 1025548499
- .long 188395520
- .long 1071001603
- .long 3878792704
- .long 3173889571
- .long 3747176448
- .long 1070978493
- .long 144991708
- .long 3171552042
- .long 1405669376
- .long 1070955511
- .long 3999088879
- .long 1025486317
- .long 121151488
- .long 1070932654
- .long 2170865497
- .long 1026473584
- .long 2652319744
- .long 1070909920
- .long 453695652
- .long 3173916809
- .long 3262236672
- .long 1070887309
- .long 157800053
- .long 3173984206
- .long 601221120
- .long 1070864820
- .long 3968917661
- .long 1023992886
- .long 1999843328
- .long 1070842450
- .long 3053895004
- .long 1024998228
- .long 1992167424
- .long 1070820199
- .long 2968614856
- .long 1024552653
- .long 3788726272
- .long 1070798065
- .long 3542170808
- .long 3173573242
- .long 2094829568
- .long 1070776048
- .long 1246758132
- .long 1026202874
- .long 288675840
- .long 1070754146
- .long 3747328950
- .long 1026331585
- .long 1829681152
- .long 1070732357
- .long 3125197546
- .long 1024100318
- .long 1666869248
- .long 1070710681
- .long 1363656119
- .long 1026336493
- .long 3417110528
- .long 1070689116
- .long 4154791553
- .long 1026267853
- .long 2183653376
- .long 1070667662
- .long 1671819292
- .long 3173785870
- .long 1734434816
- .long 1070646317
- .long 373091049
- .long 1025972363
- .long 1615681536
- .long 1070625080
- .long 384650897
- .long 1022926043
- .long 1445382144
- .long 1070603950
- .long 344320330
- .long 3172397196
- .long 1823715328
- .long 1070569756
- .long 3389841200
- .long 1025231852
- .long 3839688704
- .long 1070527917
- .long 1706790417
- .long 3167363349
- .long 4293332992
- .long 1070486286
- .long 1614935088
- .long 1019351591
- .long 2966720512
- .long 1070444861
- .long 4145393717
- .long 3173711658
- .long 4066729984
- .long 1070403639
- .long 1974925028
- .long 3171437182
- .long 3337621504
- .long 1070362619
- .long 3314953170
- .long 3169971314
- .long 943448064
- .long 1070321799
- .long 1498682038
- .long 3173862340
- .long 1465634816
- .long 1070281176
- .long 1319952810
- .long 3171693965
- .long 1015734272
- .long 1070240749
- .long 1347821929
- .long 3173544515
- .long 118001664
- .long 1070200516
- .long 1751482746
- .long 1026134093
- .long 3707174912
- .long 1070160474
- .long 1486946159
- .long 1023930920
- .long 3946381312
- .long 1070120623
- .long 2867408081
- .long 3171368276
- .long 1699848192
- .long 1070080961
- .long 2590187139
- .long 1025379803
- .long 2235846656
- .long 1070041485
- .long 1888568069
- .long 3172754960
- .long 2339729408
- .long 1070002194
- .long 3852214753
- .long 3173323149
- .long 3196850176
- .long 1069963086
- .long 742141560
- .long 1025101707
- .long 1800683520
- .long 1069924160
- .long 3949500444
- .long 3172102179
- .long 3835801600
- .long 1069885413
- .long 3848895943
- .long 1025913832
- .long 2201202688
- .long 1069846845
- .long 1425913464
- .long 1025868665
- .long 2778279936
- .long 1069808453
- .long 2120889677
- .long 3173831128
- .long 2954203136
- .long 1069770236
- .long 592147081
- .long 1019621288
- .long 210141184
- .long 1069732193
- .long 3414275233
- .long 1023647084
- .long 709476352
- .long 1069694321
- .long 2413027164
- .long 1024462115
- .long 2116284416
- .long 1069656619
- .long 1144559924
- .long 1026336654
- .long 2183651328
- .long 1069619086
- .long 3459057650
- .long 1025634168
- .long 3047047168
- .long 1069581720
- .long 1879674924
- .long 3173508573
- .long 970711040
- .long 1069541521
- .long 1335954173
- .long 3173332182
- .long 2198478848
- .long 1069467449
- .long 2951103968
- .long 3173892200
- .long 1669611520
- .long 1069393703
- .long 531044147
- .long 1025149248
- .long 29114368
- .long 1069320280
- .long 3327831251
- .long 1025918673
- .long 2376949760
- .long 1069247176
- .long 737634533
- .long 3172176000
- .long 1085390848
- .long 1069174390
- .long 3108243400
- .long 3171828406
- .long 1566130176
- .long 1069101918
- .long 985483226
- .long 1025708380
- .long 792780800
- .long 1069029758
- .long 4184866295
- .long 1024426204
- .long 183156736
- .long 1068957907
- .long 2845699378
- .long 1022107277
- .long 1301782528
- .long 1068886362
- .long 1012735262
- .long 3173804294
- .long 1562411008
- .long 1068815121
- .long 2197086703
- .long 3170187813
- .long 2815549440
- .long 1068744181
- .long 2782613207
- .long 1026345054
- .long 2756124672
- .long 1068673540
- .long 2929486205
- .long 3173037800
- .long 3511050240
- .long 1068603195
- .long 1443733147
- .long 3173331549
- .long 3047047168
- .long 1068533144
- .long 1879674924
- .long 3172459997
- .long 3221667840
- .long 1068427825
- .long 1338588027
- .long 3171815742
- .long 3453861888
- .long 1068288883
- .long 1205348359
- .long 3172624626
- .long 3506110464
- .long 1068150514
- .long 893105198
- .long 1025571866
- .long 346013696
- .long 1068012714
- .long 3495569021
- .long 3172563349
- .long 4074029056
- .long 1067875476
- .long 3961106338
- .long 3171065595
- .long 3559784448
- .long 1067738798
- .long 1975385384
- .long 3173783155
- .long 797769728
- .long 1067602675
- .long 3760305787
- .long 1026047642
- .long 2313633792
- .long 1067467101
- .long 1559353171
- .long 1023480256
- .long 3960766464
- .long 1067213778
- .long 1067365107
- .long 1025865926
- .long 684261376
- .long 1066944805
- .long 844762164
- .long 3173687482
- .long 630718464
- .long 1066676905
- .long 2458269694
- .long 1024033081
- .long 1486061568
- .long 1066410070
- .long 115537874
- .long 3173243995
- .long 2743664640
- .long 1065886792
- .long 3665098304
- .long 3173471607
- .long 1971912704
- .long 1065357333
- .long 2577214440
- .long 3171993451
- .long 1498939392
- .long 1064306693
- .long 3409036923
- .long 1025599151
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 4277811200
- .long 1067855426
- .long 2479318832
- .long 1022292823
- .long 2454267026
- .long 1069697316
- .long 0
- .long 3218079744
- .long 1030730101
- .long 3217380702
- .long 1431655765
- .long 1070945621
- .long 2576980378
- .long 1070176665
- .long 0
- .long 3219128320
- .long 0
- .long 4294959104
- .long 0
- .long 4294959104
- .long 0
- .long 3217031168
- .long 2576980378
- .long 1070176665
- .long 2454267026
- .long 1069697316
- .long 0
- .long 3218079744
- .long 1431655765
- .long 3217380693
- .long 1431655765
- .long 1070945621
- .type static_const_table,@object
- .size static_const_table,2192
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/s_sin.S b/libm/x86/s_sin.S
deleted file mode 100644
index 74d1b86..0000000
--- a/libm/x86/s_sin.S
+++ /dev/null
@@ -1,907 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// 1. RANGE REDUCTION
-//
-// We perform an initial range reduction from X to r with
-//
-// X =~= N * pi/32 + r
-//
-// so that |r| <= pi/64 + epsilon. We restrict inputs to those
-// where |N| <= 932560. Beyond this, the range reduction is
-// insufficiently accurate. For extremely small inputs,
-// denormalization can occur internally, impacting performance.
-// This means that the main path is actually only taken for
-// 2^-252 <= |X| < 90112.
-//
-// To avoid branches, we perform the range reduction to full
-// accuracy each time.
-//
-// X - N * (P_1 + P_2 + P_3)
-//
-// where P_1 and P_2 are 32-bit numbers (so multiplication by N
-// is exact) and P_3 is a 53-bit number. Together, these
-// approximate pi well enough for all cases in the restricted
-// range.
-//
-// The main reduction sequence is:
-//
-// y = 32/pi * x
-// N = integer(y)
-// (computed by adding and subtracting off SHIFTER)
-//
-// m_1 = N * P_1
-// m_2 = N * P_2
-// r_1 = x - m_1
-// r = r_1 - m_2
-// (this r can be used for most of the calculation)
-//
-// c_1 = r_1 - r
-// m_3 = N * P_3
-// c_2 = c_1 - m_2
-// c = c_2 - m_3
-//
-// 2. MAIN ALGORITHM
-//
-// The algorithm uses a table lookup based on B = M * pi / 32
-// where M = N mod 64. The stored values are:
-// sigma closest power of 2 to cos(B)
-// C_hl 53-bit cos(B) - sigma
-// S_hi + S_lo 2 * 53-bit sin(B)
-//
-// The computation is organized as follows:
-//
-// sin(B + r + c) = [sin(B) + sigma * r] +
-// r * (cos(B) - sigma) +
-// sin(B) * [cos(r + c) - 1] +
-// cos(B) * [sin(r + c) - r]
-//
-// which is approximately:
-//
-// [S_hi + sigma * r] +
-// C_hl * r +
-// S_lo + S_hi * [(cos(r) - 1) - r * c] +
-// (C_hl + sigma) * [(sin(r) - r) + c]
-//
-// and this is what is actually computed. We separate this sum
-// into four parts:
-//
-// hi + med + pols + corr
-//
-// where
-//
-// hi = S_hi + sigma r
-// med = C_hl * r
-// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r)
-// corr = S_lo + c * ((C_hl + sigma) - S_hi * r)
-//
-// 3. POLYNOMIAL
-//
-// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) *
-// (sin(r) - r) can be rearranged freely, since it is quite
-// small, so we exploit parallelism to the fullest.
-//
-// psc4 = SC_4 * r_1
-// msc4 = psc4 * r
-// r2 = r * r
-// msc2 = SC_2 * r2
-// r4 = r2 * r2
-// psc3 = SC_3 + msc4
-// psc1 = SC_1 + msc2
-// msc3 = r4 * psc3
-// sincospols = psc1 + msc3
-// pols = sincospols *
-// <S_hi * r^2 | (C_hl + sigma) * r^3>
-//
-// 4. CORRECTION TERM
-//
-// This is where the "c" component of the range reduction is
-// taken into account; recall that just "r" is used for most of
-// the calculation.
-//
-// -c = m_3 - c_2
-// -d = S_hi * r - (C_hl + sigma)
-// corr = -c * -d + S_lo
-//
-// 5. COMPENSATED SUMMATIONS
-//
-// The two successive compensated summations add up the high
-// and medium parts, leaving just the low parts to add up at
-// the end.
-//
-// rs = sigma * r
-// res_int = S_hi + rs
-// k_0 = S_hi - res_int
-// k_2 = k_0 + rs
-// med = C_hl * r
-// res_hi = res_int + med
-// k_1 = res_int - res_hi
-// k_3 = k_1 + med
-//
-// 6. FINAL SUMMATION
-//
-// We now add up all the small parts:
-//
-// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3
-//
-// Now the overall result is just:
-//
-// res_hi + res_lo
-//
-// 7. SMALL ARGUMENTS
-//
-// If |x| < SNN (SNN meaning the smallest normal number), we
-// simply perform 0.1111111 cdots 1111 * x. For SNN <= |x|, we
-// do 2^-55 * (2^55 * x - x).
-//
-// Special cases:
-// sin(NaN) = quiet NaN, and raise invalid exception
-// sin(INF) = NaN and raise invalid exception
-// sin(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin sin
-ENTRY(sin)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $120, %esp
- movl %ebx, 56(%esp)
- call static_func
- movl %eax, %ebx
- movsd 128(%esp), %xmm0
- pextrw $3, %xmm0, %eax
- andl $32767, %eax
- subl $12336, %eax
- cmpl $4293, %eax
- ja .L_2TAG_PACKET_0.0.2
- movsd 2160(%ebx), %xmm1
- mulsd %xmm0, %xmm1
- movsd 2272(%ebx), %xmm5
- movapd 2256(%ebx), %xmm4
- andpd %xmm0, %xmm4
- orps %xmm4, %xmm5
- movsd 2128(%ebx), %xmm3
- movapd 2112(%ebx), %xmm2
- addpd %xmm5, %xmm1
- cvttsd2si %xmm1, %edx
- cvtsi2sdl %edx, %xmm1
- mulsd %xmm1, %xmm3
- unpcklpd %xmm1, %xmm1
- addl $1865216, %edx
- movapd %xmm0, %xmm4
- andl $63, %edx
- movapd 2096(%ebx), %xmm5
- lea (%ebx), %eax
- shll $5, %edx
- addl %edx, %eax
- mulpd %xmm1, %xmm2
- subsd %xmm3, %xmm0
- mulsd 2144(%ebx), %xmm1
- subsd %xmm3, %xmm4
- movsd 8(%eax), %xmm7
- unpcklpd %xmm0, %xmm0
- movapd %xmm4, %xmm3
- subsd %xmm2, %xmm4
- mulpd %xmm0, %xmm5
- subpd %xmm2, %xmm0
- movapd 2064(%ebx), %xmm6
- mulsd %xmm4, %xmm7
- subsd %xmm4, %xmm3
- mulpd %xmm0, %xmm5
- mulpd %xmm0, %xmm0
- subsd %xmm2, %xmm3
- movapd (%eax), %xmm2
- subsd %xmm3, %xmm1
- movsd 24(%eax), %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm7
- mulsd %xmm4, %xmm2
- mulpd %xmm0, %xmm6
- mulsd %xmm4, %xmm3
- mulpd %xmm0, %xmm2
- mulpd %xmm0, %xmm0
- addpd 2080(%ebx), %xmm5
- mulsd (%eax), %xmm4
- addpd 2048(%ebx), %xmm6
- mulpd %xmm0, %xmm5
- movapd %xmm3, %xmm0
- addsd 8(%eax), %xmm3
- mulpd %xmm7, %xmm1
- movapd %xmm4, %xmm7
- addsd %xmm3, %xmm4
- addpd %xmm5, %xmm6
- movsd 8(%eax), %xmm5
- subsd %xmm3, %xmm5
- subsd %xmm4, %xmm3
- addsd 16(%eax), %xmm1
- mulpd %xmm2, %xmm6
- addsd %xmm0, %xmm5
- addsd %xmm7, %xmm3
- addsd %xmm5, %xmm1
- addsd %xmm3, %xmm1
- addsd %xmm6, %xmm1
- unpckhpd %xmm6, %xmm6
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm4
- movsd %xmm4, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_0.0.2:
- jg .L_2TAG_PACKET_2.0.2
- shrl $4, %eax
- cmpl $268434685, %eax
- jne .L_2TAG_PACKET_3.0.2
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_3.0.2:
- movsd 2192(%ebx), %xmm3
- mulsd %xmm0, %xmm3
- subsd %xmm0, %xmm3
- mulsd 2208(%ebx), %xmm3
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- movl 132(%esp), %eax
- andl $2146435072, %eax
- cmpl $2146435072, %eax
- je .L_2TAG_PACKET_4.0.2
- subl $32, %esp
- movsd %xmm0, (%esp)
- lea 40(%esp), %eax
- movl %eax, 8(%esp)
- movl $2, %eax
- movl %eax, 12(%esp)
- call __libm_sincos_huge
- addl $32, %esp
- fldl 16(%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_4.0.2:
- fldl 128(%esp)
- fmull 2240(%ebx)
-.L_2TAG_PACKET_1.0.2:
- movl 56(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(sin)
-# -- End sin
-
-# Start file scope ASM
-ALIAS_SYMBOL(sinl, sin);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 393047345
- .long 3212032302
- .long 3156849708
- .long 1069094822
- .long 3758096384
- .long 3158189848
- .long 0
- .long 1072693248
- .long 18115067
- .long 3214126342
- .long 1013556747
- .long 1070135480
- .long 3221225472
- .long 3160567065
- .long 0
- .long 1072693248
- .long 2476548698
- .long 3215330282
- .long 785751814
- .long 1070765062
- .long 2684354560
- .long 3161838221
- .long 0
- .long 1072693248
- .long 2255197647
- .long 3216211105
- .long 2796464483
- .long 1071152610
- .long 3758096384
- .long 3160878317
- .long 0
- .long 1072693248
- .long 1945768569
- .long 3216915048
- .long 939980347
- .long 1071524701
- .long 536870912
- .long 1012796809
- .long 0
- .long 1072693248
- .long 1539668340
- .long 3217396327
- .long 967731400
- .long 1071761211
- .long 536870912
- .long 1015752157
- .long 0
- .long 1072693248
- .long 1403757309
- .long 3217886718
- .long 621354454
- .long 1071926515
- .long 536870912
- .long 1013450602
- .long 0
- .long 1072693248
- .long 2583490354
- .long 1070236281
- .long 1719614413
- .long 1072079006
- .long 536870912
- .long 3163282740
- .long 0
- .long 1071644672
- .long 2485417816
- .long 1069626316
- .long 1796544321
- .long 1072217216
- .long 536870912
- .long 3162686945
- .long 0
- .long 1071644672
- .long 2598800519
- .long 1068266419
- .long 688824739
- .long 1072339814
- .long 3758096384
- .long 1010431536
- .long 0
- .long 1071644672
- .long 2140183630
- .long 3214756396
- .long 4051746225
- .long 1072445618
- .long 2147483648
- .long 3161907377
- .long 0
- .long 1071644672
- .long 1699043957
- .long 3216902261
- .long 3476196678
- .long 1072533611
- .long 536870912
- .long 1014257638
- .long 0
- .long 1071644672
- .long 1991047213
- .long 1067753521
- .long 1455828442
- .long 1072602945
- .long 3758096384
- .long 1015505073
- .long 0
- .long 1070596096
- .long 240740309
- .long 3215727903
- .long 3489094832
- .long 1072652951
- .long 536870912
- .long 1014325783
- .long 0
- .long 1070596096
- .long 257503056
- .long 3214647653
- .long 2748392742
- .long 1072683149
- .long 1073741824
- .long 3163061750
- .long 0
- .long 1069547520
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 0
- .long 257503056
- .long 1067164005
- .long 2748392742
- .long 1072683149
- .long 1073741824
- .long 3163061750
- .long 0
- .long 3217031168
- .long 240740309
- .long 1068244255
- .long 3489094832
- .long 1072652951
- .long 536870912
- .long 1014325783
- .long 0
- .long 3218079744
- .long 1991047213
- .long 3215237169
- .long 1455828442
- .long 1072602945
- .long 3758096384
- .long 1015505073
- .long 0
- .long 3218079744
- .long 1699043957
- .long 1069418613
- .long 3476196678
- .long 1072533611
- .long 536870912
- .long 1014257638
- .long 0
- .long 3219128320
- .long 2140183630
- .long 1067272748
- .long 4051746225
- .long 1072445618
- .long 2147483648
- .long 3161907377
- .long 0
- .long 3219128320
- .long 2598800519
- .long 3215750067
- .long 688824739
- .long 1072339814
- .long 3758096384
- .long 1010431536
- .long 0
- .long 3219128320
- .long 2485417816
- .long 3217109964
- .long 1796544321
- .long 1072217216
- .long 536870912
- .long 3162686945
- .long 0
- .long 3219128320
- .long 2583490354
- .long 3217719929
- .long 1719614413
- .long 1072079006
- .long 536870912
- .long 3163282740
- .long 0
- .long 3219128320
- .long 1403757309
- .long 1070403070
- .long 621354454
- .long 1071926515
- .long 536870912
- .long 1013450602
- .long 0
- .long 3220176896
- .long 1539668340
- .long 1069912679
- .long 967731400
- .long 1071761211
- .long 536870912
- .long 1015752157
- .long 0
- .long 3220176896
- .long 1945768569
- .long 1069431400
- .long 939980347
- .long 1071524701
- .long 536870912
- .long 1012796809
- .long 0
- .long 3220176896
- .long 2255197647
- .long 1068727457
- .long 2796464483
- .long 1071152610
- .long 3758096384
- .long 3160878317
- .long 0
- .long 3220176896
- .long 2476548698
- .long 1067846634
- .long 785751814
- .long 1070765062
- .long 2684354560
- .long 3161838221
- .long 0
- .long 3220176896
- .long 18115067
- .long 1066642694
- .long 1013556747
- .long 1070135480
- .long 3221225472
- .long 3160567065
- .long 0
- .long 3220176896
- .long 393047345
- .long 1064548654
- .long 3156849708
- .long 1069094822
- .long 3758096384
- .long 3158189848
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 393047345
- .long 1064548654
- .long 3156849708
- .long 3216578470
- .long 3758096384
- .long 1010706200
- .long 0
- .long 3220176896
- .long 18115067
- .long 1066642694
- .long 1013556747
- .long 3217619128
- .long 3221225472
- .long 1013083417
- .long 0
- .long 3220176896
- .long 2476548698
- .long 1067846634
- .long 785751814
- .long 3218248710
- .long 2684354560
- .long 1014354573
- .long 0
- .long 3220176896
- .long 2255197647
- .long 1068727457
- .long 2796464483
- .long 3218636258
- .long 3758096384
- .long 1013394669
- .long 0
- .long 3220176896
- .long 1945768569
- .long 1069431400
- .long 939980347
- .long 3219008349
- .long 536870912
- .long 3160280457
- .long 0
- .long 3220176896
- .long 1539668340
- .long 1069912679
- .long 967731400
- .long 3219244859
- .long 536870912
- .long 3163235805
- .long 0
- .long 3220176896
- .long 1403757309
- .long 1070403070
- .long 621354454
- .long 3219410163
- .long 536870912
- .long 3160934250
- .long 0
- .long 3220176896
- .long 2583490354
- .long 3217719929
- .long 1719614413
- .long 3219562654
- .long 536870912
- .long 1015799092
- .long 0
- .long 3219128320
- .long 2485417816
- .long 3217109964
- .long 1796544321
- .long 3219700864
- .long 536870912
- .long 1015203297
- .long 0
- .long 3219128320
- .long 2598800519
- .long 3215750067
- .long 688824739
- .long 3219823462
- .long 3758096384
- .long 3157915184
- .long 0
- .long 3219128320
- .long 2140183630
- .long 1067272748
- .long 4051746225
- .long 3219929266
- .long 2147483648
- .long 1014423729
- .long 0
- .long 3219128320
- .long 1699043957
- .long 1069418613
- .long 3476196678
- .long 3220017259
- .long 536870912
- .long 3161741286
- .long 0
- .long 3219128320
- .long 1991047213
- .long 3215237169
- .long 1455828442
- .long 3220086593
- .long 3758096384
- .long 3162988721
- .long 0
- .long 3218079744
- .long 240740309
- .long 1068244255
- .long 3489094832
- .long 3220136599
- .long 536870912
- .long 3161809431
- .long 0
- .long 3218079744
- .long 257503056
- .long 1067164005
- .long 2748392742
- .long 3220166797
- .long 1073741824
- .long 1015578102
- .long 0
- .long 3217031168
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 0
- .long 257503056
- .long 3214647653
- .long 2748392742
- .long 3220166797
- .long 1073741824
- .long 1015578102
- .long 0
- .long 1069547520
- .long 240740309
- .long 3215727903
- .long 3489094832
- .long 3220136599
- .long 536870912
- .long 3161809431
- .long 0
- .long 1070596096
- .long 1991047213
- .long 1067753521
- .long 1455828442
- .long 3220086593
- .long 3758096384
- .long 3162988721
- .long 0
- .long 1070596096
- .long 1699043957
- .long 3216902261
- .long 3476196678
- .long 3220017259
- .long 536870912
- .long 3161741286
- .long 0
- .long 1071644672
- .long 2140183630
- .long 3214756396
- .long 4051746225
- .long 3219929266
- .long 2147483648
- .long 1014423729
- .long 0
- .long 1071644672
- .long 2598800519
- .long 1068266419
- .long 688824739
- .long 3219823462
- .long 3758096384
- .long 3157915184
- .long 0
- .long 1071644672
- .long 2485417816
- .long 1069626316
- .long 1796544321
- .long 3219700864
- .long 536870912
- .long 1015203297
- .long 0
- .long 1071644672
- .long 2583490354
- .long 1070236281
- .long 1719614413
- .long 3219562654
- .long 536870912
- .long 1015799092
- .long 0
- .long 1071644672
- .long 1403757309
- .long 3217886718
- .long 621354454
- .long 3219410163
- .long 536870912
- .long 3160934250
- .long 0
- .long 1072693248
- .long 1539668340
- .long 3217396327
- .long 967731400
- .long 3219244859
- .long 536870912
- .long 3163235805
- .long 0
- .long 1072693248
- .long 1945768569
- .long 3216915048
- .long 939980347
- .long 3219008349
- .long 536870912
- .long 3160280457
- .long 0
- .long 1072693248
- .long 2255197647
- .long 3216211105
- .long 2796464483
- .long 3218636258
- .long 3758096384
- .long 1013394669
- .long 0
- .long 1072693248
- .long 2476548698
- .long 3215330282
- .long 785751814
- .long 3218248710
- .long 2684354560
- .long 1014354573
- .long 0
- .long 1072693248
- .long 18115067
- .long 3214126342
- .long 1013556747
- .long 3217619128
- .long 3221225472
- .long 1013083417
- .long 0
- .long 1072693248
- .long 393047345
- .long 3212032302
- .long 3156849708
- .long 3216578470
- .long 3758096384
- .long 1010706200
- .long 0
- .long 1072693248
- .long 1431655765
- .long 3217380693
- .long 0
- .long 3219128320
- .long 286331153
- .long 1065423121
- .long 1431655765
- .long 1067799893
- .long 436314138
- .long 3207201184
- .long 381774871
- .long 3210133868
- .long 2773927732
- .long 1053236707
- .long 436314138
- .long 1056571808
- .long 442499072
- .long 1032893537
- .long 442499072
- .long 1032893537
- .long 1413480448
- .long 1069097467
- .long 0
- .long 0
- .long 771977331
- .long 996350346
- .long 0
- .long 0
- .long 1841940611
- .long 1076125488
- .long 0
- .long 0
- .long 0
- .long 1127743488
- .long 0
- .long 0
- .long 0
- .long 1130364928
- .long 0
- .long 0
- .long 0
- .long 1015021568
- .long 0
- .long 0
- .long 4294967295
- .long 1072693247
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 0
- .long 1071644672
- .long 0
- .long 1071644672
- .type static_const_table,@object
- .size static_const_table,2288
- .data
- .hidden __libm_sincos_huge
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/s_tan.S b/libm/x86/s_tan.S
deleted file mode 100644
index 7935efe..0000000
--- a/libm/x86/s_tan.S
+++ /dev/null
@@ -1,1766 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Polynomials coefficients and other constants.
-//
-// Note that in this algorithm, there is a different polynomial for
-// each breakpoint, so there are 32 sets of polynomial coefficients
-// as well as 32 instances of the other constants.
-//
-// The polynomial coefficients and constants are offset from the start
-// of the main block as follows:
-//
-// 0: c8 | c0
-// 16: c9 | c1
-// 32: c10 | c2
-// 48: c11 | c3
-// 64: c12 | c4
-// 80: c13 | c5
-// 96: c14 | c6
-// 112: c15 | c7
-// 128: T_hi
-// 136: T_lo
-// 144: Sigma
-// 152: T_hl
-// 160: Tau
-// 168: Mask
-// 176: (end of block)
-//
-// The total table size is therefore 5632 bytes.
-//
-// Note that c0 and c1 are always zero. We could try storing
-// other constants here, and just loading the low part of the
-// SIMD register in these cases, after ensuring the high part
-// is zero.
-//
-// The higher terms of the polynomial are computed in the *low*
-// part of the SIMD register. This is so we can overlap the
-// multiplication by r^8 and the unpacking of the other part.
-//
-// The constants are:
-// T_hi + T_lo = accurate constant term in power series
-// Sigma + T_hl = accurate coefficient of r in power series (Sigma=1 bit)
-// Tau = multiplier for the reciprocal, always -1 or 0
-//
-// The basic reconstruction formula using these constants is:
-//
-// High = tau * recip_hi + t_hi
-// Med = (sgn * r + t_hl * r)_hi
-// Low = (sgn * r + t_hl * r)_lo +
-// tau * recip_lo + T_lo + (T_hl + sigma) * c + pol
-//
-// where pol = c0 + c1 * r + c2 * r^2 + ... + c15 * r^15
-//
-// (c0 = c1 = 0, but using them keeps SIMD regularity)
-//
-// We then do a compensated sum High + Med, add the low parts together
-// and then do the final sum.
-//
-// Here recip_hi + recip_lo is an accurate reciprocal of the remainder
-// modulo pi/2
-//
-// Special cases:
-// tan(NaN) = quiet NaN, and raise invalid exception
-// tan(INF) = NaN and raise invalid exception
-// tan(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin tan
-ENTRY(tan)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $120, %esp
- movl %ebx, 56(%esp)
- call static_func
- movl %eax, %ebx
- movsd 128(%esp), %xmm0
- pextrw $3, %xmm0, %eax
- andl $32767, %eax
- subl $14368, %eax
- cmpl $2216, %eax
- ja .L_2TAG_PACKET_0.0.2
- movapd 5840(%ebx), %xmm5
- movapd 5856(%ebx), %xmm6
- unpcklpd %xmm0, %xmm0
- movapd 5712(%ebx), %xmm4
- andpd %xmm0, %xmm4
- movapd 5632(%ebx), %xmm1
- mulpd %xmm0, %xmm1
- orpd %xmm4, %xmm5
- addpd %xmm5, %xmm1
- movapd %xmm1, %xmm7
- unpckhpd %xmm7, %xmm7
- cvttsd2si %xmm7, %edx
- cvttpd2dq %xmm1, %xmm1
- cvtdq2pd %xmm1, %xmm1
- mulpd %xmm6, %xmm1
- movapd 5664(%ebx), %xmm3
- movsd 5728(%ebx), %xmm5
- addl $469248, %edx
- movapd 5680(%ebx), %xmm4
- mulpd %xmm1, %xmm3
- andl $31, %edx
- mulsd %xmm1, %xmm5
- movl %edx, %ecx
- mulpd %xmm1, %xmm4
- shll $1, %ecx
- subpd %xmm3, %xmm0
- mulpd 5696(%ebx), %xmm1
- addl %ecx, %edx
- shll $2, %ecx
- addl %ecx, %edx
- addsd %xmm0, %xmm5
- movapd %xmm0, %xmm2
- subpd %xmm4, %xmm0
- movsd 5744(%ebx), %xmm6
- shll $4, %edx
- lea (%ebx), %eax
- andpd 5776(%ebx), %xmm5
- movapd %xmm0, %xmm3
- addl %edx, %eax
- subpd %xmm0, %xmm2
- unpckhpd %xmm0, %xmm0
- divsd %xmm5, %xmm6
- subpd %xmm4, %xmm2
- movapd 16(%eax), %xmm7
- subsd %xmm5, %xmm3
- mulpd %xmm0, %xmm7
- subpd %xmm1, %xmm2
- movapd 48(%eax), %xmm1
- mulpd %xmm0, %xmm1
- movapd 96(%eax), %xmm4
- mulpd %xmm0, %xmm4
- addsd %xmm3, %xmm2
- movapd %xmm0, %xmm3
- mulpd %xmm0, %xmm0
- addpd (%eax), %xmm7
- addpd 32(%eax), %xmm1
- mulpd %xmm0, %xmm1
- addpd 80(%eax), %xmm4
- addpd %xmm1, %xmm7
- movapd 112(%eax), %xmm1
- mulpd %xmm0, %xmm1
- mulpd %xmm0, %xmm0
- addpd %xmm1, %xmm4
- movapd 64(%eax), %xmm1
- mulpd %xmm0, %xmm1
- addpd %xmm1, %xmm7
- movapd %xmm3, %xmm1
- mulpd %xmm0, %xmm3
- mulsd %xmm0, %xmm0
- mulpd 144(%eax), %xmm1
- mulpd %xmm3, %xmm4
- movapd %xmm1, %xmm3
- addpd %xmm4, %xmm7
- movapd %xmm1, %xmm4
- mulsd %xmm7, %xmm0
- unpckhpd %xmm7, %xmm7
- addsd %xmm7, %xmm0
- unpckhpd %xmm1, %xmm1
- addsd %xmm1, %xmm3
- subsd %xmm3, %xmm4
- addsd %xmm4, %xmm1
- movapd %xmm2, %xmm4
- movsd 144(%eax), %xmm7
- unpckhpd %xmm2, %xmm2
- addsd 152(%eax), %xmm7
- mulsd %xmm2, %xmm7
- addsd 136(%eax), %xmm7
- addsd %xmm1, %xmm7
- addsd %xmm7, %xmm0
- movsd 5744(%ebx), %xmm7
- mulsd %xmm6, %xmm4
- movsd 168(%eax), %xmm2
- andpd %xmm6, %xmm2
- mulsd %xmm2, %xmm5
- mulsd 160(%eax), %xmm6
- subsd %xmm5, %xmm7
- subsd 128(%eax), %xmm2
- subsd %xmm4, %xmm7
- mulsd %xmm6, %xmm7
- movapd %xmm3, %xmm4
- subsd %xmm2, %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm4
- addsd %xmm4, %xmm0
- subsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
- movsd %xmm0, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_0.0.2:
- jg .L_2TAG_PACKET_2.0.2
- shrl $4, %eax
- cmpl $268434558, %eax
- jne .L_2TAG_PACKET_3.0.2
- movapd %xmm0, %xmm3
- mulsd 5808(%ebx), %xmm3
-.L_2TAG_PACKET_3.0.2:
- movsd 5792(%ebx), %xmm3
- mulsd %xmm0, %xmm3
- addsd %xmm0, %xmm3
- mulsd 5808(%ebx), %xmm3
- movsd %xmm3, (%esp)
- fldl (%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- movq 5712(%ebx), %xmm7
- andpd %xmm0, %xmm7
- xorpd %xmm0, %xmm7
- ucomisd 5760(%ebx), %xmm7
- je .L_2TAG_PACKET_4.0.2
- subl $32, %esp
- movsd %xmm0, (%esp)
- lea 40(%esp), %eax
- movl %eax, 8(%esp)
- movl $2, %eax
- movl %eax, 12(%esp)
- call __libm_tancot_huge
- addl $32, %esp
- fldl 8(%esp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_4.0.2:
- movq %xmm0, (%esp)
- fldl (%esp)
- fsubl (%esp)
-.L_2TAG_PACKET_1.0.2:
- movl 56(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(tan)
-# -- End tan
-
-# Start file scope ASM
-ALIAS_SYMBOL(tanl, tan);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2284589306
- .long 1066820852
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1441186365
- .long 1065494243
- .long 1431655765
- .long 1070945621
- .long 0
- .long 0
- .long 0
- .long 0
- .long 236289504
- .long 1064135997
- .long 286331153
- .long 1069617425
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1160476131
- .long 1062722102
- .long 463583772
- .long 1068212666
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1313038235
- .long 1066745731
- .long 0
- .long 0
- .long 1013878342
- .long 1067152618
- .long 0
- .long 0
- .long 3663426833
- .long 1065725283
- .long 3693284251
- .long 1069118808
- .long 650852232
- .long 1065882376
- .long 1996245381
- .long 1071000265
- .long 2008746170
- .long 1064664197
- .long 3055842593
- .long 1068578846
- .long 1495406348
- .long 1064652437
- .long 2269530157
- .long 1069711235
- .long 285563696
- .long 1063576465
- .long 1046897440
- .long 1067705865
- .long 233429731
- .long 1063453151
- .long 522045958
- .long 1068476590
- .long 2354785698
- .long 1069102779
- .long 1317599141
- .long 1012432133
- .long 0
- .long 1072693248
- .long 2828230105
- .long 1065606626
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1512545955
- .long 1068119047
- .long 0
- .long 0
- .long 1127048698
- .long 1067909459
- .long 0
- .long 0
- .long 2300200450
- .long 1067254767
- .long 3593250296
- .long 1070233561
- .long 3009365544
- .long 1066902117
- .long 1127373050
- .long 1071173457
- .long 3046103305
- .long 1066371299
- .long 24583402
- .long 1069723988
- .long 4082511758
- .long 1065914199
- .long 3223889699
- .long 1070020367
- .long 548927984
- .long 1065415756
- .long 558065897
- .long 1068949418
- .long 680073315
- .long 1064940726
- .long 388873200
- .long 1068944270
- .long 3763679576
- .long 1070167541
- .long 1497360404
- .long 1009710547
- .long 0
- .long 1072693248
- .long 64931152
- .long 1067729411
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2467582782
- .long 1069256389
- .long 0
- .long 0
- .long 162150096
- .long 1068946420
- .long 0
- .long 0
- .long 3702794237
- .long 1068579152
- .long 3631919291
- .long 1070936926
- .long 3456821413
- .long 1068217218
- .long 2031366438
- .long 1071495745
- .long 1596664020
- .long 1067799281
- .long 1509038701
- .long 1070601643
- .long 583171477
- .long 1067510148
- .long 3785344682
- .long 1070618476
- .long 2402036048
- .long 1067075736
- .long 3233018412
- .long 1069913186
- .long 411280568
- .long 1066710556
- .long 1065584192
- .long 1069747896
- .long 895247324
- .long 1070819848
- .long 500078909
- .long 3161288781
- .long 0
- .long 1072693248
- .long 729983843
- .long 1068994194
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1458794562
- .long 1070398550
- .long 0
- .long 0
- .long 2857777489
- .long 1070137637
- .long 0
- .long 0
- .long 1024359517
- .long 1069876531
- .long 2616040238
- .long 1071582937
- .long 1609024636
- .long 1069675088
- .long 2529240549
- .long 1071836633
- .long 1510128600
- .long 1069440113
- .long 2251697184
- .long 1071253687
- .long 1262761453
- .long 1069142850
- .long 1263091857
- .long 1071190461
- .long 3043383486
- .long 1068885191
- .long 2476932470
- .long 1070842002
- .long 3659995028
- .long 1068669200
- .long 855891755
- .long 1070696894
- .long 2583490354
- .long 1071284857
- .long 3062633575
- .long 1014008623
- .long 0
- .long 1072693248
- .long 2550940471
- .long 1069938201
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3422807297
- .long 1071640847
- .long 0
- .long 0
- .long 1151658053
- .long 1071494715
- .long 0
- .long 0
- .long 929607071
- .long 1071346340
- .long 1037049034
- .long 1072037305
- .long 2786928657
- .long 1071215282
- .long 1447406859
- .long 1072265209
- .long 3490952107
- .long 1071090851
- .long 3205232916
- .long 1071968658
- .long 1297344304
- .long 1070977120
- .long 1066110976
- .long 1071946035
- .long 3803721480
- .long 1070871082
- .long 1496754229
- .long 1071807201
- .long 2982550683
- .long 1070773243
- .long 4014441989
- .long 1071736222
- .long 419968236
- .long 1071717047
- .long 3451266538
- .long 3163444811
- .long 0
- .long 1072693248
- .long 2960267235
- .long 1070745841
- .long 0
- .long 0
- .long 0
- .long 0
- .long 724322768
- .long 1072881308
- .long 0
- .long 0
- .long 643153048
- .long 1072905816
- .long 0
- .long 0
- .long 4285079458
- .long 1072928558
- .long 3912524733
- .long 1072622983
- .long 118362272
- .long 1072952754
- .long 4107767972
- .long 1072827408
- .long 2689502883
- .long 1072976922
- .long 946523347
- .long 1072772766
- .long 573204189
- .long 1073001761
- .long 581531518
- .long 1072826391
- .long 1386236526
- .long 1073026959
- .long 3718905905
- .long 1072832823
- .long 1145558140
- .long 1073052673
- .long 513572637
- .long 1072861969
- .long 716700048
- .long 1071997368
- .long 547126769
- .long 1015523525
- .long 0
- .long 1072693248
- .long 1097907398
- .long 1071420120
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3349892442
- .long 1074290212
- .long 0
- .long 0
- .long 3913197405
- .long 1074501181
- .long 0
- .long 0
- .long 2494034522
- .long 1074739170
- .long 1264738763
- .long 1073084804
- .long 1520293906
- .long 1074899632
- .long 1958936600
- .long 1073411493
- .long 2133649635
- .long 1075052171
- .long 4270740730
- .long 1073574708
- .long 1728930189
- .long 1075224844
- .long 1303998552
- .long 1073799186
- .long 618611933
- .long 1075420255
- .long 1769828046
- .long 1073938542
- .long 2200537986
- .long 1075641421
- .long 433361110
- .long 1074105369
- .long 719595600
- .long 1072317184
- .long 294527206
- .long 3162140088
- .long 0
- .long 1073741824
- .long 3811788216
- .long 3218400550
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1704352102
- .long 1075943001
- .long 0
- .long 0
- .long 2284589306
- .long 1076258036
- .long 0
- .long 0
- .long 2211264291
- .long 1076659010
- .long 0
- .long 1073741824
- .long 1441186365
- .long 1077028579
- .long 1431655765
- .long 1074091349
- .long 876943673
- .long 1077353622
- .long 2863311531
- .long 1074440874
- .long 236289504
- .long 1077767485
- .long 286331153
- .long 1074860305
- .long 2805473311
- .long 1078115278
- .long 95443718
- .long 1075163227
- .long 1160476131
- .long 1078450742
- .long 463583772
- .long 1075552698
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 1073741824
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1330165971
- .long 3207850745
- .long 0
- .long 0
- .long 217536623
- .long 1059109098
- .long 0
- .long 0
- .long 3492120849
- .long 3205151475
- .long 602185705
- .long 3215678092
- .long 760422958
- .long 1056312597
- .long 555127889
- .long 1067545266
- .long 3139784124
- .long 3202470837
- .long 3690544014
- .long 3213150171
- .long 95707915
- .long 1053635428
- .long 4003114407
- .long 1064581412
- .long 2034926231
- .long 3199711161
- .long 3759536023
- .long 3210559989
- .long 3826928214
- .long 1050893819
- .long 3837960785
- .long 1061790379
- .long 1526325248
- .long 3217967566
- .long 2356426521
- .long 1025423456
- .long 0
- .long 0
- .long 457728975
- .long 1071088276
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1398462608
- .long 3207303968
- .long 0
- .long 0
- .long 26205983
- .long 1058461213
- .long 0
- .long 0
- .long 56226238
- .long 3204528612
- .long 2754706541
- .long 3215359511
- .long 2187799823
- .long 1055634437
- .long 790323742
- .long 1067402587
- .long 1372385848
- .long 3201651479
- .long 4097292716
- .long 3212856302
- .long 3348210357
- .long 1052830099
- .long 2442796466
- .long 1064337602
- .long 862608142
- .long 3198830754
- .long 170296152
- .long 3210060867
- .long 3755571428
- .long 1049933343
- .long 3614866008
- .long 1061361670
- .long 719978496
- .long 3217669096
- .long 1998842465
- .long 3174703977
- .long 0
- .long 0
- .long 3749156607
- .long 1071048258
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 3120498638
- .long 3206749304
- .long 0
- .long 0
- .long 2773578114
- .long 1058009312
- .long 0
- .long 0
- .long 2030783676
- .long 3203817873
- .long 2223654598
- .long 3215071936
- .long 2976134650
- .long 1054987244
- .long 706390066
- .long 1067217386
- .long 4258437615
- .long 3200900378
- .long 1066252975
- .long 3212391267
- .long 815777514
- .long 1051989462
- .long 3202745457
- .long 1064010682
- .long 2493556375
- .long 3198004753
- .long 1046243251
- .long 3209678971
- .long 2593078846
- .long 1049017717
- .long 2763962276
- .long 1060970161
- .long 701480960
- .long 3217377742
- .long 3205862232
- .long 3174660915
- .long 0
- .long 0
- .long 2267016812
- .long 1071015664
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 2107155798
- .long 3206166872
- .long 0
- .long 0
- .long 2642992129
- .long 1057424578
- .long 0
- .long 0
- .long 1936992811
- .long 3203204426
- .long 1485063559
- .long 3214682643
- .long 1432914553
- .long 1054319398
- .long 3996381654
- .long 1067075828
- .long 2833029256
- .long 3200223545
- .long 2866066872
- .long 3211982662
- .long 2432888737
- .long 1051234178
- .long 3669764559
- .long 1063748136
- .long 2458496952
- .long 3197170774
- .long 1948234989
- .long 3209098147
- .long 2843698787
- .long 1048163519
- .long 3398041407
- .long 1060559728
- .long 2829230080
- .long 3217092115
- .long 1034046433
- .long 3174271903
- .long 0
- .long 0
- .long 298675305
- .long 1070989821
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 437603223
- .long 3205589761
- .long 0
- .long 0
- .long 759330352
- .long 1057048511
- .long 0
- .long 0
- .long 3107463368
- .long 3202507988
- .long 3144465176
- .long 3214191500
- .long 2290961810
- .long 1053841035
- .long 1618153340
- .long 1066971547
- .long 3836869393
- .long 3199400272
- .long 584032116
- .long 3211469261
- .long 1245704358
- .long 1050626462
- .long 4247487438
- .long 1063561943
- .long 1669034927
- .long 3196274812
- .long 3844233498
- .long 3208626322
- .long 2706958524
- .long 1047411374
- .long 3857199098
- .long 1060281647
- .long 3593904128
- .long 3216590719
- .long 3267547836
- .long 3172163321
- .long 0
- .long 0
- .long 4076712227
- .long 1070970214
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 3290090340
- .long 3204793485
- .long 0
- .long 0
- .long 3685760367
- .long 1056668370
- .long 0
- .long 0
- .long 2655163949
- .long 3201674917
- .long 628750575
- .long 3213566872
- .long 680140505
- .long 1053299777
- .long 2954464709
- .long 1066900026
- .long 803201619
- .long 3198516435
- .long 1466315631
- .long 3210837162
- .long 1611220163
- .long 1049972438
- .long 2766187256
- .long 1063437894
- .long 1804579484
- .long 3195331491
- .long 3695969289
- .long 3207854418
- .long 2617238373
- .long 1046675948
- .long 3095830084
- .long 1060095334
- .long 3789570048
- .long 3216034914
- .long 23826559
- .long 3172048060
- .long 0
- .long 0
- .long 3870939386
- .long 1070956467
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1571758758
- .long 3203672535
- .long 0
- .long 0
- .long 113026373
- .long 1056416381
- .long 0
- .long 0
- .long 1913766298
- .long 3200523326
- .long 2507068734
- .long 3212502004
- .long 4000648818
- .long 1053003803
- .long 2446607349
- .long 1066858259
- .long 912662124
- .long 3197333001
- .long 1349489537
- .long 3209765608
- .long 3412972607
- .long 1049641401
- .long 1721283327
- .long 1063366855
- .long 1466691883
- .long 3194116746
- .long 3852528092
- .long 3206760861
- .long 285443293
- .long 1046158380
- .long 1758739894
- .long 1059895449
- .long 1858781184
- .long 3214984212
- .long 3447575948
- .long 1024675855
- .long 0
- .long 0
- .long 2242038011
- .long 1070948320
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 0
- .long 0
- .long 0
- .long 0
- .long 737611454
- .long 1056336527
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3594790527
- .long 1052911621
- .long 381774871
- .long 1066844524
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3303051618
- .long 1049456050
- .long 3154187623
- .long 1063343722
- .long 0
- .long 0
- .long 0
- .long 0
- .long 528061788
- .long 1045944910
- .long 2469719819
- .long 1059831159
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1431655765
- .long 1070945621
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1571758758
- .long 1056188887
- .long 0
- .long 0
- .long 113026373
- .long 1056416381
- .long 0
- .long 0
- .long 1913766298
- .long 1053039678
- .long 2507068734
- .long 1065018356
- .long 4000648818
- .long 1053003803
- .long 2446607349
- .long 1066858259
- .long 912662124
- .long 1049849353
- .long 1349489537
- .long 1062281960
- .long 3412972607
- .long 1049641401
- .long 1721283327
- .long 1063366855
- .long 1466691883
- .long 1046633098
- .long 3852528092
- .long 1059277213
- .long 285443293
- .long 1046158380
- .long 1758739894
- .long 1059895449
- .long 1858781184
- .long 1067500564
- .long 3447575948
- .long 3172159503
- .long 0
- .long 0
- .long 2242038011
- .long 1070948320
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 3290090340
- .long 1057309837
- .long 0
- .long 0
- .long 3685760367
- .long 1056668370
- .long 0
- .long 0
- .long 2655163949
- .long 1054191269
- .long 628750575
- .long 1066083224
- .long 680140505
- .long 1053299777
- .long 2954464709
- .long 1066900026
- .long 803201619
- .long 1051032787
- .long 1466315631
- .long 1063353514
- .long 1611220163
- .long 1049972438
- .long 2766187256
- .long 1063437894
- .long 1804579484
- .long 1047847843
- .long 3695969289
- .long 1060370770
- .long 2617238373
- .long 1046675948
- .long 3095830084
- .long 1060095334
- .long 3789570048
- .long 1068551266
- .long 23826559
- .long 1024564412
- .long 0
- .long 0
- .long 3870939386
- .long 1070956467
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 437603223
- .long 1058106113
- .long 0
- .long 0
- .long 759330352
- .long 1057048511
- .long 0
- .long 0
- .long 3107463368
- .long 1055024340
- .long 3144465176
- .long 1066707852
- .long 2290961810
- .long 1053841035
- .long 1618153340
- .long 1066971547
- .long 3836869393
- .long 1051916624
- .long 584032116
- .long 1063985613
- .long 1245704358
- .long 1050626462
- .long 4247487438
- .long 1063561943
- .long 1669034927
- .long 1048791164
- .long 3844233498
- .long 1061142674
- .long 2706958524
- .long 1047411374
- .long 3857199098
- .long 1060281647
- .long 3593904128
- .long 1069107071
- .long 3267547836
- .long 1024679673
- .long 0
- .long 0
- .long 4076712227
- .long 1070970214
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 2107155798
- .long 1058683224
- .long 0
- .long 0
- .long 2642992129
- .long 1057424578
- .long 0
- .long 0
- .long 1936992811
- .long 1055720778
- .long 1485063559
- .long 1067198995
- .long 1432914553
- .long 1054319398
- .long 3996381654
- .long 1067075828
- .long 2833029256
- .long 1052739897
- .long 2866066872
- .long 1064499014
- .long 2432888737
- .long 1051234178
- .long 3669764559
- .long 1063748136
- .long 2458496952
- .long 1049687126
- .long 1948234989
- .long 1061614499
- .long 2843698787
- .long 1048163519
- .long 3398041407
- .long 1060559728
- .long 2829230080
- .long 1069608467
- .long 1034046433
- .long 1026788255
- .long 0
- .long 0
- .long 298675305
- .long 1070989821
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 3120498638
- .long 1059265656
- .long 0
- .long 0
- .long 2773578114
- .long 1058009312
- .long 0
- .long 0
- .long 2030783676
- .long 1056334225
- .long 2223654598
- .long 1067588288
- .long 2976134650
- .long 1054987244
- .long 706390066
- .long 1067217386
- .long 4258437615
- .long 1053416730
- .long 1066252975
- .long 1064907619
- .long 815777514
- .long 1051989462
- .long 3202745457
- .long 1064010682
- .long 2493556375
- .long 1050521105
- .long 1046243251
- .long 1062195323
- .long 2593078846
- .long 1049017717
- .long 2763962276
- .long 1060970161
- .long 701480960
- .long 1069894094
- .long 3205862232
- .long 1027177267
- .long 0
- .long 0
- .long 2267016812
- .long 1071015664
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1398462608
- .long 1059820320
- .long 0
- .long 0
- .long 26205983
- .long 1058461213
- .long 0
- .long 0
- .long 56226238
- .long 1057044964
- .long 2754706541
- .long 1067875863
- .long 2187799823
- .long 1055634437
- .long 790323742
- .long 1067402587
- .long 1372385848
- .long 1054167831
- .long 4097292716
- .long 1065372654
- .long 3348210357
- .long 1052830099
- .long 2442796466
- .long 1064337602
- .long 862608142
- .long 1051347106
- .long 170296152
- .long 1062577219
- .long 3755571428
- .long 1049933343
- .long 3614866008
- .long 1061361670
- .long 719978496
- .long 1070185448
- .long 1998842465
- .long 1027220329
- .long 0
- .long 0
- .long 3749156607
- .long 1071048258
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1330165971
- .long 1060367097
- .long 0
- .long 0
- .long 217536623
- .long 1059109098
- .long 0
- .long 0
- .long 3492120849
- .long 1057667827
- .long 602185705
- .long 1068194444
- .long 760422958
- .long 1056312597
- .long 555127889
- .long 1067545266
- .long 3139784124
- .long 1054987189
- .long 3690544014
- .long 1065666523
- .long 95707915
- .long 1053635428
- .long 4003114407
- .long 1064581412
- .long 2034926231
- .long 1052227513
- .long 3759536023
- .long 1063076341
- .long 3826928214
- .long 1050893819
- .long 3837960785
- .long 1061790379
- .long 1526325248
- .long 1070483918
- .long 2356426521
- .long 3172907104
- .long 0
- .long 0
- .long 457728975
- .long 1071088276
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1704352102
- .long 3223426649
- .long 0
- .long 0
- .long 2284589306
- .long 1076258036
- .long 0
- .long 0
- .long 2211264291
- .long 3224142658
- .long 0
- .long 3221225472
- .long 1441186365
- .long 1077028579
- .long 1431655765
- .long 1074091349
- .long 876943673
- .long 3224837270
- .long 2863311531
- .long 3221924522
- .long 236289504
- .long 1077767485
- .long 286331153
- .long 1074860305
- .long 2805473311
- .long 3225598926
- .long 95443718
- .long 3222646875
- .long 1160476131
- .long 1078450742
- .long 463583772
- .long 1075552698
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 1073741824
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3349892442
- .long 3221773860
- .long 0
- .long 0
- .long 3913197405
- .long 1074501181
- .long 0
- .long 0
- .long 2494034522
- .long 3222222818
- .long 1264738763
- .long 3220568452
- .long 1520293906
- .long 1074899632
- .long 1958936600
- .long 1073411493
- .long 2133649635
- .long 3222535819
- .long 4270740730
- .long 3221058356
- .long 1728930189
- .long 1075224844
- .long 1303998552
- .long 1073799186
- .long 618611933
- .long 3222903903
- .long 1769828046
- .long 3221422190
- .long 2200537986
- .long 1075641421
- .long 433361110
- .long 1074105369
- .long 719595600
- .long 3219800832
- .long 294527206
- .long 1014656440
- .long 0
- .long 1073741824
- .long 3811788216
- .long 3218400550
- .long 0
- .long 0
- .long 0
- .long 0
- .long 724322768
- .long 3220364956
- .long 0
- .long 0
- .long 643153048
- .long 1072905816
- .long 0
- .long 0
- .long 4285079458
- .long 3220412206
- .long 3912524733
- .long 3220106631
- .long 118362272
- .long 1072952754
- .long 4107767972
- .long 1072827408
- .long 2689502883
- .long 3220460570
- .long 946523347
- .long 3220256414
- .long 573204189
- .long 1073001761
- .long 581531518
- .long 1072826391
- .long 1386236526
- .long 3220510607
- .long 3718905905
- .long 3220316471
- .long 1145558140
- .long 1073052673
- .long 513572637
- .long 1072861969
- .long 716700048
- .long 3219481016
- .long 547126769
- .long 3163007173
- .long 0
- .long 1072693248
- .long 1097907398
- .long 1071420120
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3422807297
- .long 3219124495
- .long 0
- .long 0
- .long 1151658053
- .long 1071494715
- .long 0
- .long 0
- .long 929607071
- .long 3218829988
- .long 1037049034
- .long 3219520953
- .long 2786928657
- .long 1071215282
- .long 1447406859
- .long 1072265209
- .long 3490952107
- .long 3218574499
- .long 3205232916
- .long 3219452306
- .long 1297344304
- .long 1070977120
- .long 1066110976
- .long 1071946035
- .long 3803721480
- .long 3218354730
- .long 1496754229
- .long 3219290849
- .long 2982550683
- .long 1070773243
- .long 4014441989
- .long 1071736222
- .long 419968236
- .long 3219200695
- .long 3451266538
- .long 1015961163
- .long 0
- .long 1072693248
- .long 2960267235
- .long 1070745841
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1458794562
- .long 3217882198
- .long 0
- .long 0
- .long 2857777489
- .long 1070137637
- .long 0
- .long 0
- .long 1024359517
- .long 3217360179
- .long 2616040238
- .long 3219066585
- .long 1609024636
- .long 1069675088
- .long 2529240549
- .long 1071836633
- .long 1510128600
- .long 3216923761
- .long 2251697184
- .long 3218737335
- .long 1262761453
- .long 1069142850
- .long 1263091857
- .long 1071190461
- .long 3043383486
- .long 3216368839
- .long 2476932470
- .long 3218325650
- .long 3659995028
- .long 1068669200
- .long 855891755
- .long 1070696894
- .long 2583490354
- .long 3218768505
- .long 3062633575
- .long 3161492271
- .long 0
- .long 1072693248
- .long 2550940471
- .long 1069938201
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2467582782
- .long 3216740037
- .long 0
- .long 0
- .long 162150096
- .long 1068946420
- .long 0
- .long 0
- .long 3702794237
- .long 3216062800
- .long 3631919291
- .long 3218420574
- .long 3456821413
- .long 1068217218
- .long 2031366438
- .long 1071495745
- .long 1596664020
- .long 3215282929
- .long 1509038701
- .long 3218085291
- .long 583171477
- .long 1067510148
- .long 3785344682
- .long 1070618476
- .long 2402036048
- .long 3214559384
- .long 3233018412
- .long 3217396834
- .long 411280568
- .long 1066710556
- .long 1065584192
- .long 1069747896
- .long 895247324
- .long 3218303496
- .long 500078909
- .long 1013805133
- .long 0
- .long 1072693248
- .long 729983843
- .long 1068994194
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1512545955
- .long 3215602695
- .long 0
- .long 0
- .long 1127048698
- .long 1067909459
- .long 0
- .long 0
- .long 2300200450
- .long 3214738415
- .long 3593250296
- .long 3217717209
- .long 3009365544
- .long 1066902117
- .long 1127373050
- .long 1071173457
- .long 3046103305
- .long 3213854947
- .long 24583402
- .long 3217207636
- .long 4082511758
- .long 1065914199
- .long 3223889699
- .long 1070020367
- .long 548927984
- .long 3212899404
- .long 558065897
- .long 3216433066
- .long 680073315
- .long 1064940726
- .long 388873200
- .long 1068944270
- .long 3763679576
- .long 3217651189
- .long 1497360404
- .long 3157194195
- .long 0
- .long 1072693248
- .long 64931152
- .long 1067729411
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1313038235
- .long 3214229379
- .long 0
- .long 0
- .long 1013878342
- .long 1067152618
- .long 0
- .long 0
- .long 3663426833
- .long 3213208931
- .long 3693284251
- .long 3216602456
- .long 650852232
- .long 1065882376
- .long 1996245381
- .long 1071000265
- .long 2008746170
- .long 3212147845
- .long 3055842593
- .long 3216062494
- .long 1495406348
- .long 1064652437
- .long 2269530157
- .long 1069711235
- .long 285563696
- .long 3211060113
- .long 1046897440
- .long 3215189513
- .long 233429731
- .long 1063453151
- .long 522045958
- .long 1068476590
- .long 2354785698
- .long 3216586427
- .long 1317599141
- .long 3159915781
- .long 0
- .long 1072693248
- .long 2828230105
- .long 1065606626
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1841940611
- .long 1071931184
- .long 1841940611
- .long 1076125488
- .long 0
- .long 1131937792
- .long 0
- .long 1127743488
- .long 1413758976
- .long 1069097467
- .long 1413742592
- .long 1069097467
- .long 1734819840
- .long 3174229945
- .long 1280049152
- .long 1028033571
- .long 923219018
- .long 984130272
- .long 57701189
- .long 988383790
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 1734816687
- .long 1026746297
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 2146435072
- .long 0
- .long 0
- .long 4294705152
- .long 4294967295
- .long 0
- .long 0
- .long 0
- .long 1130364928
- .long 0
- .long 0
- .long 0
- .long 1015021568
- .long 0
- .long 0
- .long 0
- .long 1017118720
- .long 0
- .long 0
- .long 0
- .long 1071644672
- .long 0
- .long 1071644672
- .long 0
- .long 1076887552
- .long 0
- .long 1072693248
- .type static_const_table,@object
- .size static_const_table,5872
- .data
- .hidden __libm_tancot_huge
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/s_tanh.S b/libm/x86/s_tanh.S
deleted file mode 100644
index 777519f..0000000
--- a/libm/x86/s_tanh.S
+++ /dev/null
@@ -1,1361 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// tanh(x)=(exp(x)-exp(-x))/(exp(x)+exp(-x))=(1-exp(-2*x))/(1+exp(-2*x))
-//
-// Let |x|=xH+xL (upper 26 bits, lower 27 bits)
-// log2(e) rounded to 26 bits (high part) plus a double precision low part is
-// L2EH+L2EL (upper 26, lower 53 bits)
-//
-// Let xH*L2EH=k+f+r`, where (k+f)*2^8*2=int(xH*L2EH*2^9),
-// f=0.b1 b2 ... b8, k integer
-// 2^{-f} is approximated as Tn[f]+Dn[f]
-// Tn stores the high 53 bits, Dn stores (2^{-f}-Tn[f]) rounded to double precision
-//
-// r=r`+xL*L2EH+|x|*L2EL, |r|<2^{-9}+2^{-14},
-// for |x| in [23/64,3*2^7)
-// e^{-2*|x|}=2^{-k-f}*2^{-r} ~ 2^{-k}*(Tn+Dn)*(1+p)=(T0+D0)*(1+p)
-//
-// For |x| in [2^{-4},2^5):
-// 2^{-r}-1 ~ p=c1*r+c2*r^2+..+c5*r^5
-// Let R=1/(1+T0+p*T0), truncated to 35 significant bits
-// R=1/(1+T0+D0+p*(T0+D0))*(1+eps), |eps|<2^{-33}
-// 1+T0+D0+p*(T0+D0)=KH+KL, where
-// KH=(1+T0+c1*r*T0)_high (leading 17 bits)
-// KL=T0_low+D0+(c1*r*T0)_low+c1*r*D0+(c2*r^2+..c5*r^5)*T0
-// eps ~ (R*KH-1)+R*KL
-// 1/(1+T0+D0+p*(T0+D0)) ~ R-R*eps
-// The result is approximated as (1-T0-D0-(T0+D0)*p)*(R-R*eps)
-// 1-T0-D0-(T0+D0)*p=-((KH-2)+KL)
-// The result is formed as
-// (KH-2)*R+(-(KH-2)*R*eps+(KL*R-KL*R*eps)), with the correct sign
-// set at the end
-//
-// For |x| in [2^{-64},2^{-4}):
-// A Taylor series expansion is used (x+p3*x^3+..+p13*x^{13})
-//
-// For |x|<2^{-64}: x is returned
-//
-// For |x|>=2^32: return +/-1
-//
-// Special cases:
-// tanh(NaN) = quiet NaN, and raise invalid exception
-// tanh(INF) = that INF
-// tanh(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin static_func
- .text
- .align __bionic_asm_align
- .type static_func, @function
-static_func:
-..B1.1:
- call ..L2
-..L2:
- popl %eax
- lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
- lea static_const_table@GOTOFF(%eax), %eax
- ret
- .size static_func,.-static_func
-# -- End static_func
-
-# -- Begin tanh
-ENTRY(tanh)
-# parameter 1: 8 + %ebp
-..B2.1:
-..B2.2:
- pushl %ebp
- movl %esp, %ebp
- subl $104, %esp
- movl %ebx, 40(%esp)
- call static_func
- movl %eax, %ebx
- movsd 112(%esp), %xmm0
- movsd 4256(%ebx), %xmm3
- xorpd %xmm4, %xmm4
- movsd 4112(%ebx), %xmm1
- movsd 4120(%ebx), %xmm2
- movl $32768, %eax
- pinsrw $3, %eax, %xmm4
- movsd 4096(%ebx), %xmm6
- pextrw $3, %xmm0, %ecx
- andpd %xmm0, %xmm3
- andnpd %xmm0, %xmm4
- pshufd $68, %xmm4, %xmm5
- movl $32768, %edx
- andl %ecx, %edx
- andl $32767, %ecx
- subl $16304, %ecx
- cmpl $144, %ecx
- jae .L_2TAG_PACKET_0.0.2
- subsd %xmm3, %xmm4
- mulsd %xmm1, %xmm3
- mulsd %xmm5, %xmm2
- cvtsd2si %xmm3, %eax
- movapd %xmm3, %xmm7
- addsd %xmm6, %xmm3
- mulsd %xmm4, %xmm1
- movsd 4264(%ebx), %xmm4
- subsd %xmm6, %xmm3
- xorpd %xmm0, %xmm0
- addsd %xmm1, %xmm2
- subsd %xmm3, %xmm7
- movapd 4128(%ebx), %xmm6
- addsd %xmm7, %xmm2
- movl $255, %ecx
- andl %eax, %ecx
- addl %ecx, %ecx
- movapd (%ebx,%ecx,8), %xmm5
- shrl $4, %eax
- andl $65520, %eax
- subl $16368, %eax
- negl %eax
- pinsrw $3, %eax, %xmm0
- movapd 4144(%ebx), %xmm1
- pshufd $68, %xmm0, %xmm0
- mulpd %xmm5, %xmm0
- movsd 4160(%ebx), %xmm7
- pshufd $68, %xmm2, %xmm2
- movapd %xmm4, %xmm5
- addsd %xmm0, %xmm4
- mulpd %xmm2, %xmm6
- mulsd %xmm2, %xmm7
- mulpd %xmm2, %xmm2
- addpd %xmm6, %xmm1
- mulsd %xmm2, %xmm2
- movsd 4264(%ebx), %xmm3
- mulpd %xmm2, %xmm1
- pshufd $78, %xmm1, %xmm6
- addsd %xmm6, %xmm1
- movapd %xmm1, %xmm6
- addsd %xmm7, %xmm1
- mulsd %xmm0, %xmm1
- addsd %xmm4, %xmm1
- andpd 4224(%ebx), %xmm4
- divsd %xmm1, %xmm5
- subsd %xmm4, %xmm3
- pshufd $238, %xmm0, %xmm1
- addsd %xmm0, %xmm3
- movapd %xmm4, %xmm2
- addsd %xmm1, %xmm3
- mulsd %xmm7, %xmm1
- mulsd %xmm0, %xmm7
- addsd %xmm1, %xmm3
- addsd %xmm7, %xmm4
- movsd 4240(%ebx), %xmm1
- mulsd %xmm0, %xmm6
- andpd 4224(%ebx), %xmm4
- addsd %xmm6, %xmm3
- movapd %xmm4, %xmm6
- subsd %xmm4, %xmm2
- addsd %xmm7, %xmm2
- movsd 4264(%ebx), %xmm7
- andpd %xmm1, %xmm5
- addsd %xmm2, %xmm3
- mulsd %xmm5, %xmm4
- xorpd %xmm2, %xmm2
- mulsd %xmm5, %xmm3
- subsd 4272(%ebx), %xmm6
- subsd %xmm7, %xmm4
- xorl $32768, %edx
- pinsrw $3, %edx, %xmm2
- addsd %xmm3, %xmm4
- mulsd %xmm5, %xmm6
- movapd %xmm3, %xmm1
- mulsd %xmm4, %xmm3
- movapd %xmm6, %xmm0
- mulsd %xmm4, %xmm6
- subsd %xmm3, %xmm1
- subsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- xorpd %xmm2, %xmm0
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_0.0.2:
- addl $960, %ecx
- cmpl $1104, %ecx
- jae .L_2TAG_PACKET_2.0.2
- movapd 4176(%ebx), %xmm2
- pshufd $68, %xmm0, %xmm1
- movapd 4192(%ebx), %xmm3
- mulpd %xmm1, %xmm1
- movapd 4208(%ebx), %xmm4
- mulpd %xmm1, %xmm2
- pshufd $68, %xmm1, %xmm5
- addpd %xmm3, %xmm2
- mulsd %xmm5, %xmm5
- mulpd %xmm1, %xmm2
- mulsd %xmm5, %xmm5
- addpd %xmm4, %xmm2
- mulpd %xmm5, %xmm2
- pshufd $238, %xmm2, %xmm5
- addsd %xmm5, %xmm2
- mulsd %xmm0, %xmm2
- addsd %xmm2, %xmm0
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- addl $15344, %ecx
- cmpl $16448, %ecx
- jae .L_2TAG_PACKET_3.0.2
- cmpl $16, %ecx
- jb .L_2TAG_PACKET_4.0.2
- xorpd %xmm2, %xmm2
- movl $17392, %eax
- pinsrw $3, %eax, %xmm2
- mulsd %xmm0, %xmm2
- addsd %xmm0, %xmm2
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_4.0.2:
- movapd %xmm0, %xmm2
- mulsd %xmm2, %xmm2
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_3.0.2:
- cmpl $32752, %ecx
- jae .L_2TAG_PACKET_5.0.2
- xorpd %xmm2, %xmm2
- movl $15344, %ecx
- pinsrw $3, %ecx, %xmm2
- movapd %xmm2, %xmm3
- mulsd %xmm2, %xmm2
- addsd %xmm3, %xmm2
-.L_2TAG_PACKET_6.0.2:
- xorpd %xmm0, %xmm0
- orl $16368, %edx
- pinsrw $3, %edx, %xmm0
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_5.0.2:
- movapd %xmm0, %xmm2
- movd %xmm0, %eax
- psrlq $20, %xmm2
- movd %xmm2, %ecx
- orl %eax, %ecx
- cmpl $0, %ecx
- je .L_2TAG_PACKET_6.0.2
- addsd %xmm0, %xmm0
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_1.0.2:
- movsd %xmm0, 24(%esp)
- fldl 24(%esp)
-.L_2TAG_PACKET_7.0.2:
- movl 40(%esp), %ebx
- movl %ebp, %esp
- popl %ebp
- ret
-..B2.3:
-END(tanh)
-# -- End tanh
-
-# Start file scope ASM
-ALIAS_SYMBOL(tanhl, tanh);
-# End file scope ASM
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 1797923801
- .long 1072687577
- .long 1950547427
- .long 1013229059
- .long 730821105
- .long 1072681922
- .long 2523232743
- .long 1012067188
- .long 915592468
- .long 1072676282
- .long 352947894
- .long 3161024371
- .long 2174652632
- .long 1072670657
- .long 4087714590
- .long 1014450259
- .long 35929225
- .long 1072665048
- .long 2809788041
- .long 3159436968
- .long 2912730644
- .long 1072659453
- .long 3490067722
- .long 3163405074
- .long 2038973688
- .long 1072653874
- .long 892941374
- .long 1016046459
- .long 1533953344
- .long 1072648310
- .long 769171851
- .long 1015665633
- .long 1222472308
- .long 1072642761
- .long 1054357470
- .long 3161021018
- .long 929806999
- .long 1072637227
- .long 3205336643
- .long 1015259557
- .long 481706282
- .long 1072631708
- .long 1696079173
- .long 3162710528
- .long 3999357479
- .long 1072626203
- .long 2258941616
- .long 1015924724
- .long 2719515920
- .long 1072620714
- .long 2760332941
- .long 1015137933
- .long 764307441
- .long 1072615240
- .long 3021057420
- .long 3163329523
- .long 2256325230
- .long 1072609780
- .long 580117746
- .long 1015317295
- .long 2728693978
- .long 1072604335
- .long 396109971
- .long 3163462691
- .long 2009970496
- .long 1072598905
- .long 2159039665
- .long 3162572948
- .long 4224142467
- .long 1072593489
- .long 3389820386
- .long 1015207202
- .long 610758006
- .long 1072588089
- .long 1965209397
- .long 3161866232
- .long 3884662774
- .long 1072582702
- .long 2158611599
- .long 1014210185
- .long 991358482
- .long 1072577331
- .long 838715019
- .long 3163157668
- .long 351641897
- .long 1072571974
- .long 2172261526
- .long 3163010599
- .long 1796832535
- .long 1072566631
- .long 3176955716
- .long 3160585513
- .long 863738719
- .long 1072561303
- .long 1326992220
- .long 3162613197
- .long 1679558232
- .long 1072555989
- .long 2390342287
- .long 3163333970
- .long 4076975200
- .long 1072550689
- .long 2029000899
- .long 1015208535
- .long 3594158869
- .long 1072545404
- .long 2456521700
- .long 3163256561
- .long 64696965
- .long 1072540134
- .long 1768797490
- .long 1015816960
- .long 1912561781
- .long 1072534877
- .long 3147495102
- .long 1015678253
- .long 382305176
- .long 1072529635
- .long 2347622376
- .long 3162578625
- .long 3898795731
- .long 1072524406
- .long 1249994144
- .long 1011869818
- .long 3707479175
- .long 1072519192
- .long 3613079303
- .long 1014164738
- .long 3939148246
- .long 1072513992
- .long 3210352148
- .long 1015274323
- .long 135105010
- .long 1072508807
- .long 1906148728
- .long 3163375739
- .long 721996136
- .long 1072503635
- .long 563754734
- .long 1015371318
- .long 1242007932
- .long 1072498477
- .long 1132034716
- .long 3163339831
- .long 1532734324
- .long 1072493333
- .long 3094216535
- .long 3163162857
- .long 1432208378
- .long 1072488203
- .long 1401068914
- .long 3162363963
- .long 778901109
- .long 1072483087
- .long 2248183955
- .long 3161268751
- .long 3706687593
- .long 1072477984
- .long 3521726940
- .long 1013253067
- .long 1464976603
- .long 1072472896
- .long 3507292405
- .long 3161977534
- .long 2483480501
- .long 1072467821
- .long 1216371780
- .long 1013034172
- .long 2307442995
- .long 1072462760
- .long 3190117721
- .long 3162404539
- .long 777507147
- .long 1072457713
- .long 4282924205
- .long 1015187533
- .long 2029714210
- .long 1072452679
- .long 613660079
- .long 1015099143
- .long 1610600570
- .long 1072447659
- .long 3766732298
- .long 1015760183
- .long 3657065772
- .long 1072442652
- .long 399025623
- .long 3162957078
- .long 3716502172
- .long 1072437659
- .long 2303740125
- .long 1014042725
- .long 1631695677
- .long 1072432680
- .long 2717633076
- .long 3162344026
- .long 1540824585
- .long 1072427714
- .long 1064017011
- .long 3163487690
- .long 3287523847
- .long 1072422761
- .long 1625971539
- .long 3157009955
- .long 2420883922
- .long 1072417822
- .long 2049810052
- .long 1014119888
- .long 3080351519
- .long 1072412896
- .long 3379126788
- .long 3157218001
- .long 815859274
- .long 1072407984
- .long 240396590
- .long 3163487443
- .long 4062661092
- .long 1072403084
- .long 1422616006
- .long 3163255318
- .long 4076559943
- .long 1072398198
- .long 2119478331
- .long 3160758351
- .long 703710506
- .long 1072393326
- .long 1384660846
- .long 1015195891
- .long 2380618042
- .long 1072388466
- .long 3149557219
- .long 3163320799
- .long 364333489
- .long 1072383620
- .long 3923737744
- .long 3161421373
- .long 3092190715
- .long 1072378786
- .long 814012168
- .long 3159523422
- .long 1822067026
- .long 1072373966
- .long 1241994956
- .long 1015340290
- .long 697153126
- .long 1072369159
- .long 1283515429
- .long 3163283189
- .long 3861050111
- .long 1072364364
- .long 254893773
- .long 3162813180
- .long 2572866477
- .long 1072359583
- .long 878562433
- .long 1015521741
- .long 977020788
- .long 1072354815
- .long 3065100517
- .long 1015541563
- .long 3218338682
- .long 1072350059
- .long 3404164304
- .long 3162477108
- .long 557149882
- .long 1072345317
- .long 3672720709
- .long 1014537265
- .long 1434058175
- .long 1072340587
- .long 251133233
- .long 1015085769
- .long 1405169241
- .long 1072335870
- .long 2998539689
- .long 3162830951
- .long 321958744
- .long 1072331166
- .long 3401933767
- .long 1015794558
- .long 2331271250
- .long 1072326474
- .long 812057446
- .long 1012207446
- .long 2990417245
- .long 1072321795
- .long 3683467745
- .long 3163369326
- .long 2152073944
- .long 1072317129
- .long 1486860576
- .long 3163203456
- .long 3964284211
- .long 1072312475
- .long 2111583915
- .long 1015427164
- .long 3985553595
- .long 1072307834
- .long 4002146062
- .long 1015834136
- .long 2069751141
- .long 1072303206
- .long 1562170675
- .long 3162724681
- .long 2366108318
- .long 1072298590
- .long 2867985102
- .long 3161762254
- .long 434316067
- .long 1072293987
- .long 2028358766
- .long 1013458122
- .long 424392917
- .long 1072289396
- .long 2749202995
- .long 3162838718
- .long 2191782032
- .long 1072284817
- .long 2960257726
- .long 1013742662
- .long 1297350157
- .long 1072280251
- .long 1308022040
- .long 3163412558
- .long 1892288442
- .long 1072275697
- .long 2446255666
- .long 3162600381
- .long 3833209506
- .long 1072271155
- .long 2722920684
- .long 1013754842
- .long 2682146384
- .long 1072266626
- .long 2082178513
- .long 3163363419
- .long 2591453363
- .long 1072262109
- .long 2132396182
- .long 3159074198
- .long 3418903055
- .long 1072257604
- .long 2527457337
- .long 3160820604
- .long 727685349
- .long 1072253112
- .long 2038246809
- .long 3162358742
- .long 2966275557
- .long 1072248631
- .long 2176155324
- .long 3159842759
- .long 1403662306
- .long 1072244163
- .long 2788809599
- .long 3161671007
- .long 194117574
- .long 1072239707
- .long 777528612
- .long 3163412089
- .long 3492293770
- .long 1072235262
- .long 2248032210
- .long 1015386826
- .long 2568320822
- .long 1072230830
- .long 2732824428
- .long 1014352915
- .long 1577608921
- .long 1072226410
- .long 1875489510
- .long 3162968394
- .long 380978316
- .long 1072222002
- .long 854188970
- .long 3160462686
- .long 3134592888
- .long 1072217605
- .long 4232266862
- .long 1015991134
- .long 1110089947
- .long 1072213221
- .long 1451641639
- .long 1015474673
- .long 2759350287
- .long 1072208848
- .long 1148526634
- .long 1015894933
- .long 3649726105
- .long 1072204487
- .long 4085036346
- .long 1015649474
- .long 3643909174
- .long 1072200138
- .long 3537586109
- .long 1014354647
- .long 2604962541
- .long 1072195801
- .long 2614425274
- .long 3163539192
- .long 396319521
- .long 1072191476
- .long 4172420816
- .long 3159074632
- .long 1176749997
- .long 1072187162
- .long 2738998779
- .long 3162035844
- .long 515457527
- .long 1072182860
- .long 836709333
- .long 1015651226
- .long 2571947539
- .long 1072178569
- .long 3558159064
- .long 3163376669
- .long 2916157145
- .long 1072174290
- .long 219487565
- .long 1015309367
- .long 1413356050
- .long 1072170023
- .long 1651349291
- .long 3162668166
- .long 2224145553
- .long 1072165767
- .long 3482522030
- .long 3161489169
- .long 919555682
- .long 1072161523
- .long 3121969534
- .long 1012948226
- .long 1660913392
- .long 1072157290
- .long 4218599604
- .long 1015135707
- .long 19972402
- .long 1072153069
- .long 3507899862
- .long 1016009292
- .long 158781403
- .long 1072148859
- .long 2221464712
- .long 3163286453
- .long 1944781191
- .long 1072144660
- .long 3993278767
- .long 3161724279
- .long 950803702
- .long 1072140473
- .long 1655364926
- .long 1015237032
- .long 1339972927
- .long 1072136297
- .long 167908909
- .long 1015572152
- .long 2980802057
- .long 1072132132
- .long 378619896
- .long 1015773303
- .long 1447192521
- .long 1072127979
- .long 1462857171
- .long 3162514521
- .long 903334909
- .long 1072123837
- .long 1636462108
- .long 1015039997
- .long 1218806132
- .long 1072119706
- .long 1818613052
- .long 3162548441
- .long 2263535754
- .long 1072115586
- .long 752233586
- .long 3162639008
- .long 3907805044
- .long 1072111477
- .long 2257091225
- .long 3161550407
- .long 1727278727
- .long 1072107380
- .long 3562710623
- .long 1011471940
- .long 4182873220
- .long 1072103293
- .long 629542646
- .long 3161996303
- .long 2555984613
- .long 1072099218
- .long 2652555442
- .long 3162552692
- .long 1013258799
- .long 1072095154
- .long 1748797611
- .long 3160129082
- .long 3721688645
- .long 1072091100
- .long 3069276937
- .long 1015839401
- .long 1963711167
- .long 1072087058
- .long 1744767757
- .long 3160574294
- .long 4201977662
- .long 1072083026
- .long 748330254
- .long 1013594357
- .long 1719614413
- .long 1072079006
- .long 330458198
- .long 3163282740
- .long 2979960120
- .long 1072074996
- .long 2599109725
- .long 1014498493
- .long 3561793907
- .long 1072070997
- .long 1157054053
- .long 1011890350
- .long 3339203574
- .long 1072067009
- .long 1483497780
- .long 3162408754
- .long 2186617381
- .long 1072063032
- .long 2270764084
- .long 3163272713
- .long 4273770423
- .long 1072059065
- .long 3383180809
- .long 3163218901
- .long 885834528
- .long 1072055110
- .long 1973258547
- .long 3162261564
- .long 488188413
- .long 1072051165
- .long 3199821029
- .long 1015564048
- .long 2956612997
- .long 1072047230
- .long 2118169751
- .long 3162735553
- .long 3872257780
- .long 1072043306
- .long 1253592103
- .long 1015958334
- .long 3111574537
- .long 1072039393
- .long 2606161479
- .long 3162759746
- .long 551349105
- .long 1072035491
- .long 3821916050
- .long 3162106589
- .long 363667784
- .long 1072031599
- .long 813753950
- .long 1015785209
- .long 2425981843
- .long 1072027717
- .long 2830390851
- .long 3163346599
- .long 2321106615
- .long 1072023846
- .long 2171176610
- .long 1009535771
- .long 4222122499
- .long 1072019985
- .long 1277378074
- .long 3163256737
- .long 3712504873
- .long 1072016135
- .long 88491949
- .long 1015427660
- .long 671025100
- .long 1072012296
- .long 3832014351
- .long 3163022030
- .long 3566716925
- .long 1072008466
- .long 1536826856
- .long 1014142433
- .long 3689071823
- .long 1072004647
- .long 2321004996
- .long 3162552716
- .long 917841882
- .long 1072000839
- .long 18715565
- .long 1015659308
- .long 3723038930
- .long 1071997040
- .long 378465264
- .long 3162569582
- .long 3395129871
- .long 1071993252
- .long 4025345435
- .long 3162335388
- .long 4109806887
- .long 1071989474
- .long 422403966
- .long 1014469229
- .long 1453150082
- .long 1071985707
- .long 498154669
- .long 3161488062
- .long 3896463087
- .long 1071981949
- .long 1139797873
- .long 3161233805
- .long 2731501122
- .long 1071978202
- .long 1774031855
- .long 3162470021
- .long 2135241198
- .long 1071974465
- .long 1236747871
- .long 1013589147
- .long 1990012071
- .long 1071970738
- .long 3529070563
- .long 3162813193
- .long 2178460671
- .long 1071967021
- .long 777878098
- .long 3162842493
- .long 2583551245
- .long 1071963314
- .long 3161094195
- .long 1015606491
- .long 3088564500
- .long 1071959617
- .long 1762311517
- .long 1015045673
- .long 3577096743
- .long 1071955930
- .long 2951496418
- .long 1013793687
- .long 3933059031
- .long 1071952253
- .long 2133366768
- .long 3161531832
- .long 4040676318
- .long 1071948586
- .long 4090609238
- .long 1015663458
- .long 3784486610
- .long 1071944929
- .long 1581883040
- .long 3161698953
- .long 3049340112
- .long 1071941282
- .long 3062915824
- .long 1013170595
- .long 1720398391
- .long 1071937645
- .long 3980678963
- .long 3163300080
- .long 3978100823
- .long 1071934017
- .long 3513027190
- .long 1015845963
- .long 1118294578
- .long 1071930400
- .long 2197495694
- .long 3159909401
- .long 1617004845
- .long 1071926792
- .long 82804944
- .long 1010342778
- .long 1065662932
- .long 1071923194
- .long 2533670915
- .long 1014530238
- .long 3645941911
- .long 1071919605
- .long 3814685081
- .long 3161573341
- .long 654919306
- .long 1071916027
- .long 3232961757
- .long 3163047469
- .long 569847338
- .long 1071912458
- .long 472945272
- .long 3159290729
- .long 3278348324
- .long 1071908898
- .long 3069497416
- .long 1014750712
- .long 78413852
- .long 1071905349
- .long 4183226867
- .long 3163017251
- .long 3743175029
- .long 1071901808
- .long 2072812490
- .long 3162175075
- .long 1276261410
- .long 1071898278
- .long 300981948
- .long 1014684169
- .long 1156440435
- .long 1071894757
- .long 2351451249
- .long 1013967056
- .long 3272845541
- .long 1071891245
- .long 928852419
- .long 3163488248
- .long 3219942644
- .long 1071887743
- .long 3798990616
- .long 1015368806
- .long 887463927
- .long 1071884251
- .long 3596744163
- .long 3160794166
- .long 460407023
- .long 1071880768
- .long 4237175092
- .long 3163138469
- .long 1829099622
- .long 1071877294
- .long 1016661181
- .long 3163461005
- .long 589198666
- .long 1071873830
- .long 2664346172
- .long 3163157962
- .long 926591435
- .long 1071870375
- .long 3208833762
- .long 3162913514
- .long 2732492859
- .long 1071866929
- .long 2691479646
- .long 3162255684
- .long 1603444721
- .long 1071863493
- .long 1548633640
- .long 3162201326
- .long 1726216749
- .long 1071860066
- .long 2466808228
- .long 3161676405
- .long 2992903935
- .long 1071856648
- .long 2218154406
- .long 1015228193
- .long 1000925746
- .long 1071853240
- .long 1018491672
- .long 3163309544
- .long 4232894513
- .long 1071849840
- .long 2383938684
- .long 1014668519
- .long 3991843581
- .long 1071846450
- .long 4092853457
- .long 1014585763
- .long 171030293
- .long 1071843070
- .long 3526460132
- .long 1014428778
- .long 1253935211
- .long 1071839698
- .long 1395382931
- .long 3159702613
- .long 2839424854
- .long 1071836335
- .long 1171596163
- .long 1013041679
- .long 526652809
- .long 1071832982
- .long 4223459736
- .long 1015879375
- .long 2799960843
- .long 1071829637
- .long 1423655381
- .long 1015022151
- .long 964107055
- .long 1071826302
- .long 2800439588
- .long 3162833221
- .long 3504003472
- .long 1071822975
- .long 3594001060
- .long 3157330652
- .long 1724976915
- .long 1071819658
- .long 420909223
- .long 3163117379
- .long 4112506593
- .long 1071816349
- .long 2947355221
- .long 1014371048
- .long 1972484976
- .long 1071813050
- .long 675290301
- .long 3161640050
- .long 3790955393
- .long 1071809759
- .long 2352942462
- .long 3163180090
- .long 874372905
- .long 1071806478
- .long 100263788
- .long 1015940732
- .long 1709341917
- .long 1071803205
- .long 2571168217
- .long 1014152499
- .long 1897844341
- .long 1071799941
- .long 1254300460
- .long 1015275938
- .long 1337108031
- .long 1071796686
- .long 3203724452
- .long 1014677845
- .long 4219606026
- .long 1071793439
- .long 2434574742
- .long 1014681548
- .long 1853186616
- .long 1071790202
- .long 3066496371
- .long 1015656574
- .long 2725843665
- .long 1071786973
- .long 1433917087
- .long 1014838523
- .long 2440944790
- .long 1071783753
- .long 2492769774
- .long 1014147454
- .long 897099801
- .long 1071780542
- .long 754756297
- .long 1015241005
- .long 2288159958
- .long 1071777339
- .long 2169144469
- .long 1014876021
- .long 2218315341
- .long 1071774145
- .long 2694295388
- .long 3163288868
- .long 586995997
- .long 1071770960
- .long 41662348
- .long 3162627992
- .long 1588871207
- .long 1071767783
- .long 143439582
- .long 3162963416
- .long 828946858
- .long 1071764615
- .long 10642492
- .long 1015939438
- .long 2502433899
- .long 1071761455
- .long 2148595913
- .long 1015023991
- .long 2214878420
- .long 1071758304
- .long 892270087
- .long 3163116422
- .long 4162030108
- .long 1071755161
- .long 2763428480
- .long 1015529349
- .long 3949972341
- .long 1071752027
- .long 2068408548
- .long 1014913868
- .long 1480023343
- .long 1071748902
- .long 2247196168
- .long 1015327453
- .long 948735466
- .long 1071745785
- .long 3516338028
- .long 3162574883
- .long 2257959872
- .long 1071742676
- .long 3802946148
- .long 1012964927
- .long 1014845819
- .long 1071739576
- .long 3117910646
- .long 3161559105
- .long 1416741826
- .long 1071736484
- .long 2196380210
- .long 1011413563
- .long 3366293073
- .long 1071733400
- .long 3119426314
- .long 1014120554
- .long 2471440686
- .long 1071730325
- .long 968836267
- .long 3162214888
- .long 2930322912
- .long 1071727258
- .long 2599499422
- .long 3162714047
- .long 351405227
- .long 1071724200
- .long 3125337328
- .long 3159822479
- .long 3228316108
- .long 1071721149
- .long 3010241991
- .long 3158422804
- .long 2875075254
- .long 1071718107
- .long 4144233330
- .long 3163333716
- .long 3490863953
- .long 1071715073
- .long 960797498
- .long 3162948880
- .long 685187902
- .long 1071712048
- .long 378731989
- .long 1014843115
- .long 2952712987
- .long 1071709030
- .long 3293494651
- .long 3160120301
- .long 1608493509
- .long 1071706021
- .long 3159622171
- .long 3162807737
- .long 852742562
- .long 1071703020
- .long 667253586
- .long 1009793559
- .long 590962156
- .long 1071700027
- .long 3829346666
- .long 3163275597
- .long 728909815
- .long 1071697042
- .long 383930225
- .long 1015029468
- .long 1172597893
- .long 1071694065
- .long 114433263
- .long 1015347593
- .long 1828292879
- .long 1071691096
- .long 1255956747
- .long 1015588398
- .long 2602514713
- .long 1071688135
- .long 2268929336
- .long 1014354284
- .long 3402036099
- .long 1071685182
- .long 405889334
- .long 1015105656
- .long 4133881824
- .long 1071682237
- .long 2148155345
- .long 3162931299
- .long 410360776
- .long 1071679301
- .long 1269990655
- .long 1011975870
- .long 728934454
- .long 1071676372
- .long 1413842688
- .long 1014178612
- .long 702412510
- .long 1071673451
- .long 3803266087
- .long 3162280415
- .long 238821257
- .long 1071670538
- .long 1469694871
- .long 3162884987
- .long 3541402996
- .long 1071667632
- .long 2759177317
- .long 1014854626
- .long 1928746161
- .long 1071664735
- .long 983617676
- .long 1014285177
- .long 3899555717
- .long 1071661845
- .long 427280750
- .long 3162546972
- .long 772914124
- .long 1071658964
- .long 4004372762
- .long 1012230161
- .long 1048019041
- .long 1071656090
- .long 1398474845
- .long 3160510595
- .long 339411585
- .long 1071653224
- .long 264588982
- .long 3161636657
- .long 2851812149
- .long 1071650365
- .long 2595802551
- .long 1015767337
- .long 4200250559
- .long 1071647514
- .long 2808127345
- .long 3161781938
- .long 0
- .long 1127743488
- .long 0
- .long 3275227136
- .long 1610612736
- .long 1082594631
- .long 4166901572
- .long 1055174155
- .long 3884607281
- .long 3168131199
- .long 3607404735
- .long 3190582024
- .long 1874480759
- .long 1032041131
- .long 4286760334
- .long 1053736893
- .long 4277811695
- .long 3211144770
- .long 0
- .long 0
- .long 236289503
- .long 1064135997
- .long 463583772
- .long 3215696314
- .long 1441186365
- .long 3212977891
- .long 286331153
- .long 1069617425
- .long 2284589306
- .long 1066820852
- .long 1431655765
- .long 3218429269
- .long 0
- .long 4294967280
- .long 0
- .long 4294967280
- .long 4294705152
- .long 4294967295
- .long 4294705152
- .long 4294967295
- .long 4160749568
- .long 2147483647
- .long 0
- .long 1072693248
- .long 0
- .long 1073741824
- .type static_const_table,@object
- .size static_const_table,4280
- .data
- .section .note.GNU-stack, "",@progbits
-# End
diff --git a/libm/x86/sqrt.S b/libm/x86/sqrt.S
deleted file mode 100644
index c9d434d..0000000
--- a/libm/x86/sqrt.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(sqrt)
- mov %esp,%eax
- and $0xfffffff8,%eax
- movsd 0x4(%esp),%xmm0
- sqrtsd %xmm0,%xmm0
- movlpd %xmm0,-0x8(%eax)
- fldl -0x8(%eax)
- ret
-END(sqrt)
-
-ALIAS_SYMBOL(sqrtl, sqrt);
diff --git a/libm/x86/sqrtf.S b/libm/x86/sqrtf.S
deleted file mode 100644
index 78c183b..0000000
--- a/libm/x86/sqrtf.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(sqrtf)
- movss 0x4(%esp),%xmm0
- sqrtss %xmm0,%xmm0
- movss %xmm0,-0x4(%esp)
- flds -0x4(%esp)
- ret
-END(sqrtf)
diff --git a/libm/x86/trunc.S b/libm/x86/trunc.S
deleted file mode 100644
index da9d5fb..0000000
--- a/libm/x86/trunc.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(trunc)
- mov %esp,%eax
- and $0xfffffff8,%eax
- movsd 0x4(%esp),%xmm0
- roundsd $0x3,%xmm0,%xmm0
- movlpd %xmm0,-0x8(%eax)
- fldl -0x8(%eax)
- ret
-END(trunc)
-
-ALIAS_SYMBOL(truncl, trunc);
diff --git a/libm/x86/truncf.S b/libm/x86/truncf.S
deleted file mode 100644
index d3e3f4a..0000000
--- a/libm/x86/truncf.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(truncf)
- movss 0x4(%esp),%xmm0
- roundss $0x3,%xmm0,%xmm0
- movss %xmm0,-0x4(%esp)
- flds -0x4(%esp)
- ret
-END(truncf)
diff --git a/libm/x86_64/ceil.S b/libm/x86_64/ceil.S
deleted file mode 100644
index d4492c4..0000000
--- a/libm/x86_64/ceil.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(ceil)
-roundsd $0x2,%xmm0,%xmm0
-retq
-END(ceil)
diff --git a/libm/x86_64/ceilf.S b/libm/x86_64/ceilf.S
deleted file mode 100644
index 0e1ca95..0000000
--- a/libm/x86_64/ceilf.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(ceilf)
-roundss $0x2,%xmm0,%xmm0
-retq
-END(ceilf)
diff --git a/libm/x86_64/e_acos.S b/libm/x86_64/e_acos.S
deleted file mode 100644
index 57c910e..0000000
--- a/libm/x86_64/e_acos.S
+++ /dev/null
@@ -1,1957 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// To compute acos(s), separate schemes are used when s is in different
-// intervals.
-//
-// |s| in [2^{-4}, sqrt(3)/2):
-// Let t=2^k*1.b1 b2..b6 1, where s=2^k*1.b1 b2 .. b52
-// acos(s)=pi/2-asin(t)-asin(r), where r=s*sqrt(1-t^2)-t*sqrt(1-s^2)
-// asin(r)-r evaluated as 7-degree polynomial (c3*r^3+c5*r^5+c7*r^7)
-// For the first degree term, r is evaluated as
-// R=(s^2-t^2)/(sqrt(1-t^2)*s+sqrt(1-s^2)*t)
-// (sqrt(1-t^2) read from table)
-// The main source of error is still R (may still be affected by up to 3 ulps
-// of rounding error). The table size must be sufficiently large, to minimize
-// this effect.
-//
-// |s| in [sqrt(3)/2, 255/256):
-// Let t=2^k*1.b1 b2..b6 1, where sqrt(1-s^2)=2^k*1.b1 b2 .. b52 (rounded)
-// acos(|s|)=asin(t)-asin(r), r=s*t-sqrt(1-s^2)*sqrt(1-t^2)
-// acos(-|s|)=pi-acos(|s|)
-// (The -PI constant, or 0, is added to the result. The sign is set at
-// the end)
-// asin(r) evaluated as a polynomial (same as above)
-// The first degree term is evaluated as
-// r=(s^2+t^2-1)/(s*t+sqrt(1-s^2)*sqrt(1-t^2))
-//
-// |s|<2^{-4}: acos(s)=pi/2-asin(s)
-// evaluate asin(s) as 13-degree polynomial
-//
-// |s| in [255/256,1): acos(|s|)=2*asin(q), where q=sqrt((1-|s|)/2)
-// asin(q) is evaluated as 13-degree polynomial
-// q^2=(1-|s|)/2 is obtained in advance
-// 2*q*eps ~ ((1-|s|)/2-q^2)/q used for first term
-// acos(-|s|)=pi-acos(|s|)
-// (The -PI constant, or 0, is added to the result. The sign is set at
-// the end)
-//
-// Special cases:
-// acos(NaN) = quiet NaN, and raise invalid exception
-// acos(INF) = QNaN and raise invalid exception
-// acos(x) = QNaN and raise invalid exception, for |x|>1.0
-// acos(1) = +0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin acos
-ENTRY(acos)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_acos.1:
- subq $24, %rsp
-..___tag_value_acos.3:
- movsd %xmm0, (%rsp)
-..B1.2:
- movsd ABSVALMASK(%rip), %xmm4
- movsd ONEMASK(%rip), %xmm3
- xorpd %xmm5, %xmm5
- movsd TMASK(%rip), %xmm2
- movq %xmm0, %xmm1
- psrlq $44, %xmm0
- movd %xmm0, %edx
- movq %xmm1, %xmm7
- movl $8192, %ecx
- pinsrw $2, %ecx, %xmm5
- movq %xmm1, %xmm0
- movl $524287, %eax
- andl %edx, %eax
- subl $260864, %eax
- cmpl $955, %eax
- jae .L_2TAG_PACKET_0.0.2
- mulsd %xmm1, %xmm1
- andl $65535, %edx
- subsd %xmm1, %xmm3
- sqrtsd %xmm3, %xmm3
- andpd %xmm7, %xmm2
- andl $-4, %edx
- subl $64256, %edx
- lea T_table(%rip), %r8
- movsd (%r8,%rdx,2), %xmm1
- orpd %xmm5, %xmm2
- lea Tbl_addr(%rip), %r8
- movapd (%r8,%rdx,4), %xmm4
- movq %xmm7, %xmm6
- addsd %xmm2, %xmm7
- subsd %xmm2, %xmm0
- mulsd %xmm0, %xmm7
- mulsd %xmm1, %xmm6
- mulsd %xmm2, %xmm3
- movq %xmm6, %xmm1
- addsd %xmm3, %xmm6
- divsd %xmm6, %xmm7
- movsd 24+cv(%rip), %xmm0
- movsd 8+cv(%rip), %xmm5
- subsd %xmm3, %xmm1
- psrlq $63, %xmm2
- movq %xmm1, %xmm3
- psllq $63, %xmm2
- mulsd %xmm1, %xmm1
- pshufd $68, %xmm2, %xmm2
- movsd 16+cv(%rip), %xmm6
- mulsd %xmm1, %xmm3
- mulsd %xmm1, %xmm0
- xorpd %xmm2, %xmm4
- mulsd %xmm3, %xmm5
- subpd PI_BY_2(%rip), %xmm4
- mulsd %xmm1, %xmm3
- addsd %xmm6, %xmm0
- mulsd %xmm3, %xmm0
- subsd %xmm4, %xmm5
- pshufd $238, %xmm4, %xmm4
- addsd %xmm5, %xmm0
- subsd %xmm7, %xmm0
- subsd %xmm4, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_0.0.2:
- subl $955, %eax
- cmpl $65, %eax
- jae .L_2TAG_PACKET_1.0.2
- psrlq $38, %xmm7
- psllq $38, %xmm7
- pmovmskb %xmm0, %eax
- andnpd %xmm0, %xmm4
- subsd %xmm7, %xmm1
- movq %xmm7, %xmm6
- mulsd %xmm7, %xmm7
- addsd %xmm6, %xmm0
- orpd %xmm4, %xmm5
- subsd %xmm7, %xmm3
- mulsd %xmm1, %xmm0
- movq %xmm3, %xmm4
- subsd %xmm0, %xmm3
- sqrtsd %xmm3, %xmm3
- andl $128, %eax
- shrl $7, %eax
- negl %eax
- movq %xmm3, %xmm7
- andpd %xmm3, %xmm2
- psllq $2, %xmm3
- pextrw $3, %xmm3, %edx
- orpd %xmm5, %xmm2
- movd %eax, %xmm3
- pshufd $0, %xmm3, %xmm3
- subl $65216, %edx
- addl %edx, %edx
- lea T_table(%rip), %r8
- mulsd (%r8,%rdx,4), %xmm7
- mulsd %xmm2, %xmm6
- mulsd %xmm2, %xmm1
- mulsd %xmm2, %xmm2
- subsd %xmm7, %xmm6
- andpd NEG_PI(%rip), %xmm3
- addsd %xmm1, %xmm6
- subsd %xmm2, %xmm4
- addsd %xmm7, %xmm7
- movsd 8+cv(%rip), %xmm5
- subsd %xmm0, %xmm4
- addsd %xmm6, %xmm7
- movsd 24+cv(%rip), %xmm0
- divsd %xmm7, %xmm4
- movsd 16+cv(%rip), %xmm2
- lea Tbl_addr(%rip), %r8
- addpd (%r8,%rdx,8), %xmm3
- movq %xmm6, %xmm1
- mulsd %xmm6, %xmm6
- mulsd %xmm6, %xmm0
- mulsd %xmm6, %xmm1
- mulsd %xmm1, %xmm5
- mulsd %xmm6, %xmm1
- addsd %xmm2, %xmm0
- pxor %xmm6, %xmm6
- mulsd %xmm1, %xmm0
- addsd %xmm3, %xmm5
- addsd %xmm5, %xmm0
- andl $32768, %eax
- pinsrw $3, %eax, %xmm6
- movq %xmm4, %xmm5
- pshufd $238, %xmm3, %xmm3
- addsd %xmm3, %xmm4
- subsd %xmm4, %xmm3
- addsd %xmm3, %xmm5
- addsd %xmm5, %xmm0
- addsd %xmm4, %xmm0
- xorpd %xmm6, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_1.0.2:
- addl $15291, %eax
- cmpl $14336, %eax
- jae .L_2TAG_PACKET_2.0.2
- unpcklpd %xmm0, %xmm0
- movapd cv2(%rip), %xmm6
- unpcklpd %xmm0, %xmm1
- movapd 16+cv2(%rip), %xmm2
- movapd 32+cv2(%rip), %xmm4
- mulpd %xmm0, %xmm0
- movapd PI_BY_2(%rip), %xmm5
- mulpd %xmm0, %xmm1
- mulpd %xmm0, %xmm6
- mulpd %xmm0, %xmm0
- movq %xmm1, %xmm3
- mulsd %xmm1, %xmm1
- addpd %xmm2, %xmm6
- mulpd %xmm0, %xmm4
- mulsd %xmm3, %xmm1
- addpd %xmm4, %xmm6
- pshufd $238, %xmm5, %xmm0
- mulpd %xmm6, %xmm1
- pshufd $238, %xmm5, %xmm6
- subsd %xmm7, %xmm0
- pshufd $238, %xmm1, %xmm2
- subsd %xmm1, %xmm5
- subsd %xmm0, %xmm6
- subsd %xmm2, %xmm5
- subsd %xmm6, %xmm7
- subsd %xmm7, %xmm5
- addsd %xmm5, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_2.0.2:
- subl $15356, %eax
- cmpl $4, %eax
- jae .L_2TAG_PACKET_3.0.2
- xorpd %xmm6, %xmm6
- andpd ABSVALMASK(%rip), %xmm7
- movsd ONE_BY_2(%rip), %xmm4
- movapd cv2(%rip), %xmm1
- mulsd %xmm4, %xmm7
- movapd 16+cv2(%rip), %xmm2
- subsd %xmm7, %xmm4
- movapd 32+cv2(%rip), %xmm3
- pshufd $68, %xmm4, %xmm7
- sqrtsd %xmm4, %xmm4
- mulpd %xmm7, %xmm1
- pshufd $68, %xmm7, %xmm5
- pextrw $3, %xmm0, %eax
- mulpd %xmm7, %xmm7
- addpd %xmm1, %xmm2
- movsd HALFMASK(%rip), %xmm1
- mulpd %xmm7, %xmm3
- cmpsd $1, %xmm6, %xmm0
- mulsd %xmm5, %xmm7
- addpd %xmm3, %xmm2
- pshufd $68, %xmm0, %xmm0
- mulsd %xmm7, %xmm2
- andpd NEG_PI(%rip), %xmm0
- mulpd %xmm5, %xmm2
- andpd %xmm4, %xmm1
- pshufd $68, %xmm4, %xmm3
- subsd %xmm1, %xmm4
- addsd %xmm3, %xmm3
- mulsd %xmm1, %xmm1
- subsd %xmm4, %xmm3
- subsd %xmm1, %xmm5
- mulsd %xmm3, %xmm4
- pshufd $238, %xmm3, %xmm3
- subsd %xmm4, %xmm5
- divsd %xmm3, %xmm5
- addpd %xmm3, %xmm3
- mulpd %xmm3, %xmm2
- pshufd $238, %xmm2, %xmm4
- addsd %xmm0, %xmm2
- andl $32768, %eax
- pinsrw $3, %eax, %xmm6
- pshufd $238, %xmm0, %xmm0
- addsd %xmm4, %xmm2
- addsd %xmm5, %xmm2
- addsd %xmm3, %xmm2
- addsd %xmm2, %xmm0
- xorpd %xmm6, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_3.0.2:
- addl $261884, %eax
- cmpl $261888, %eax
- jb .L_2TAG_PACKET_4.0.2
- movd %xmm7, %ecx
- psrlq $32, %xmm7
- movd %xmm7, %edx
- andl $2147483647, %edx
- movl $1072693248, %eax
- subl %edx, %eax
- orl %ecx, %eax
- cmpl $0, %eax
- je .L_2TAG_PACKET_5.0.2
- movsd (%rsp), %xmm2
- movd %xmm2, %edx
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- andl $2147483647, %ecx
- subl $1, %edx
- sbbl $2146435072, %ecx
- cmpl $0, %ecx
- jge .L_2TAG_PACKET_6.0.2
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $32752, %edx
- pinsrw $3, %edx, %xmm1
- mulsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_5.0.2:
- pextrw $1, %xmm7, %edx
- shrl $15, %edx
- negl %edx
- movd %edx, %xmm7
- pshufd $0, %xmm7, %xmm7
- movsd PI(%rip), %xmm2
- movsd 8+PI(%rip), %xmm0
- andpd %xmm7, %xmm2
- andpd %xmm7, %xmm0
- addsd %xmm2, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_4.0.2:
- movsd PI_BY_2(%rip), %xmm2
- movsd 8+PI_BY_2(%rip), %xmm0
- addsd %xmm2, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_6.0.2:
- xorpd %xmm6, %xmm6
- addsd %xmm6, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_7.0.2:
- movq %xmm0, 8(%rsp)
-..B1.3:
- movq 8(%rsp), %xmm0
-.L_2TAG_PACKET_8.0.2:
-..B1.5:
- addq $24, %rsp
-..___tag_value_acos.4:
- ret
-..___tag_value_acos.5:
-END(acos)
-# -- End acos
- .section .rodata, "a"
- .align 16
- .align 16
-ABSVALMASK:
- .long 4294967295
- .long 2147483647
- .long 0
- .long 0
- .type ABSVALMASK,@object
- .size ABSVALMASK,16
- .align 16
-T_table:
- .long 2642784509
- .long 1072689083
- .long 1514442531
- .long 1072688953
- .long 333108933
- .long 1072688821
- .long 3392112024
- .long 1072688686
- .long 2099852862
- .long 1072688550
- .long 749609004
- .long 1072688412
- .long 3634632596
- .long 1072688271
- .long 2163248461
- .long 1072688129
- .long 628657846
- .long 1072687985
- .long 3324036511
- .long 1072687838
- .long 1657632815
- .long 1072687690
- .long 4217538760
- .long 1072687539
- .long 2411951597
- .long 1072687387
- .long 533944872
- .long 1072687233
- .long 2876566508
- .long 1072687076
- .long 847936891
- .long 1072686918
- .long 3036019913
- .long 1072686757
- .long 848884575
- .long 1072686595
- .long 2874443326
- .long 1072686430
- .long 520713666
- .long 1072686264
- .long 2375556481
- .long 1072686095
- .long 4141904948
- .long 1072685924
- .long 1522666382
- .long 1072685752
- .long 3105624104
- .long 1072685577
- .long 298666327
- .long 1072685401
- .long 1689524500
- .long 1072685222
- .long 2981002200
- .long 1072685041
- .long 4170844284
- .long 1072684858
- .long 961802263
- .long 1072684674
- .long 1941503454
- .long 1072684487
- .long 2812647170
- .long 1072684298
- .long 3572873869
- .long 1072684107
- .long 4219797823
- .long 1072683914
- .long 456039788
- .long 1072683720
- .long 869096151
- .long 1072683523
- .long 1161535119
- .long 1072683324
- .long 1330865866
- .long 1072683123
- .long 1374571204
- .long 1072682920
- .long 1290107538
- .long 1072682715
- .long 1074904836
- .long 1072682508
- .long 726366587
- .long 1072682299
- .long 241869763
- .long 1072682088
- .long 3913732079
- .long 1072681874
- .long 3149342765
- .long 1072681659
- .long 2240966306
- .long 1072681442
- .long 1185873216
- .long 1072681223
- .long 4276274591
- .long 1072681001
- .long 2919452883
- .long 1072680778
- .long 1407565635
- .long 1072680553
- .long 4032743551
- .long 1072680325
- .long 2202188565
- .long 1072680096
- .long 207977577
- .long 1072679865
- .long 2342160518
- .long 1072679631
- .long 11858423
- .long 1072679396
- .long 1804034453
- .long 1072679158
- .long 3420722787
- .long 1072678918
- .long 563930456
- .long 1072678677
- .long 1820539192
- .long 1072678433
- .long 2892501606
- .long 1072678187
- .long 3776710320
- .long 1072677939
- .long 175063337
- .long 1072677690
- .long 674333171
- .long 1072677438
- .long 976363026
- .long 1072677184
- .long 1077935934
- .long 1072676928
- .long 1921075490
- .long 1072676540
- .long 881493302
- .long 1072676016
- .long 3275752439
- .long 1072675483
- .long 486855588
- .long 1072674943
- .long 1077229111
- .long 1072674394
- .long 723950308
- .long 1072673837
- .long 3693582199
- .long 1072673271
- .long 1367335316
- .long 1072672698
- .long 2305837020
- .long 1072672116
- .long 2184358641
- .long 1072671526
- .long 972682840
- .long 1072670928
- .long 2935101762
- .long 1072670321
- .long 3745513263
- .long 1072669706
- .long 3372320886
- .long 1072669083
- .long 1783464620
- .long 1072668452
- .long 3241386215
- .long 1072667812
- .long 3418125284
- .long 1072667164
- .long 2280219148
- .long 1072666508
- .long 4088700758
- .long 1072665843
- .long 219227400
- .long 1072665171
- .long 3521816918
- .long 1072664489
- .long 1076205279
- .long 1072663800
- .long 1436484616
- .long 1072663102
- .long 271362610
- .long 1072662396
- .long 1838996688
- .long 1072661681
- .long 1807122518
- .long 1072660958
- .long 137953542
- .long 1072660227
- .long 1088178584
- .long 1072659487
- .long 324057537
- .long 1072658739
- .long 2101288076
- .long 1072657982
- .long 2085133974
- .long 1072657217
- .long 235324451
- .long 1072656444
- .long 806051592
- .long 1072655662
- .long 3756033140
- .long 1072654871
- .long 453542543
- .long 1072654073
- .long 3741177327
- .long 1072653265
- .long 691216109
- .long 1072652450
- .long 4145223372
- .long 1072651625
- .long 1174439091
- .long 1072650793
- .long 324416139
- .long 1072649952
- .long 1550246310
- .long 1072649102
- .long 511524674
- .long 1072648244
- .long 1457248482
- .long 1072647377
- .long 45944955
- .long 1072646502
- .long 525537397
- .long 1072645618
- .long 2848440188
- .long 1072644725
- .long 2671555633
- .long 1072643824
- .long 4241172637
- .long 1072642914
- .long 3213094278
- .long 1072641996
- .long 3832503688
- .long 1072641069
- .long 1754091534
- .long 1072640134
- .long 1221921804
- .long 1072639190
- .long 2184526489
- .long 1072638237
- .long 294902089
- .long 1072637276
- .long 4090375270
- .long 1072636305
- .long 632860906
- .long 1072635327
- .long 2753498702
- .long 1072634339
- .long 1808009252
- .long 1072633343
- .long 2036428672
- .long 1072632338
- .long 3383235626
- .long 1072631324
- .long 1497347484
- .long 1072630302
- .long 617018317
- .long 1072629271
- .long 684933058
- .long 1072628231
- .long 1643170798
- .long 1072627182
- .long 3011066360
- .long 1072625592
- .long 957158713
- .long 1072623442
- .long 1390907941
- .long 1072621256
- .long 3819155270
- .long 1072619034
- .long 3443571196
- .long 1072616777
- .long 4045412458
- .long 1072614484
- .long 805503923
- .long 1072612156
- .long 1778922015
- .long 1072609791
- .long 2125033665
- .long 1072607390
- .long 1287203863
- .long 1072604953
- .long 2992629568
- .long 1072602479
- .long 2367267127
- .long 1072599969
- .long 3115526047
- .long 1072597422
- .long 340219539
- .long 1072594839
- .long 2017215719
- .long 1072592218
- .long 3225443424
- .long 1072589560
- .long 3326565673
- .long 1072586865
- .long 1669811211
- .long 1072584133
- .long 1886735022
- .long 1072581363
- .long 3301071171
- .long 1072578555
- .long 928514283
- .long 1072575710
- .long 2656364059
- .long 1072572826
- .long 3473490507
- .long 1072569904
- .long 2649965606
- .long 1072566944
- .long 3736819052
- .long 1072563945
- .long 1680885175
- .long 1072560908
- .long 4413771
- .long 1072557832
- .long 2214869753
- .long 1072554716
- .long 3214725184
- .long 1072551561
- .long 2186079903
- .long 1072548367
- .long 2590372131
- .long 1072545133
- .long 3578146079
- .long 1072541859
- .long 4283712755
- .long 1072538545
- .long 3824834510
- .long 1072535191
- .long 1302400298
- .long 1072531797
- .long 95058636
- .long 1072528362
- .long 3563906063
- .long 1072524885
- .long 2167230730
- .long 1072521368
- .long 3524918334
- .long 1072517809
- .long 2353304918
- .long 1072514209
- .long 1939625839
- .long 1072510567
- .long 1256714581
- .long 1072506883
- .long 3552525848
- .long 1072503156
- .long 3464809522
- .long 1072499387
- .long 4200542593
- .long 1072495575
- .long 355609124
- .long 1072491721
- .long 3684139099
- .long 1072487822
- .long 148355918
- .long 1072483881
- .long 1457689242
- .long 1072479895
- .long 2118591596
- .long 1072475865
- .long 908848089
- .long 1072471791
- .long 877032689
- .long 1072467672
- .long 752012304
- .long 1072463508
- .long 3532301749
- .long 1072459298
- .long 3600563221
- .long 1072455043
- .long 3902857084
- .long 1072450742
- .long 3063101036
- .long 1072446395
- .long 3972344374
- .long 1072442001
- .long 903183549
- .long 1072437561
- .long 983892938
- .long 1072433073
- .long 2722858568
- .long 1072428537
- .long 302790515
- .long 1072423954
- .long 759811057
- .long 1072419322
- .long 2507809922
- .long 1072414641
- .long 2388408813
- .long 1072407528
- .long 2084492942
- .long 1072397870
- .long 2435703301
- .long 1072388010
- .long 1935433360
- .long 1072377945
- .long 2742047290
- .long 1072367671
- .long 2053284205
- .long 1072357185
- .long 657783367
- .long 1072346483
- .long 2893664841
- .long 1072335560
- .long 3718906405
- .long 1072324413
- .long 1547896303
- .long 1072313038
- .long 2494058440
- .long 1072301429
- .long 3133238742
- .long 1072289582
- .long 3327000086
- .long 1072277492
- .long 1860667274
- .long 1072265154
- .long 665340747
- .long 1072252562
- .long 443347841
- .long 1072239710
- .long 581282618
- .long 1072226592
- .long 3349780465
- .long 1072213201
- .long 914217606
- .long 1072199532
- .long 989797661
- .long 1072185576
- .long 945436416
- .long 1072171326
- .long 549291300
- .long 1072156774
- .long 1814636389
- .long 1072141911
- .long 239092858
- .long 1072126729
- .long 1794680724
- .long 1072111217
- .long 1241534678
- .long 1072095366
- .long 3366566214
- .long 1072079164
- .long 1244090828
- .long 1072062601
- .long 1708448120
- .long 1072045663
- .long 3544260650
- .long 1072028337
- .long 1402741403
- .long 1072010610
- .long 2551936888
- .long 1071992465
- .long 617669739
- .long 1071973887
- .long 794002186
- .long 1071954857
- .long 2021237693
- .long 1071935356
- .long 540450384
- .long 1071915364
- .long 1920555537
- .long 1071894857
- .long 2879585206
- .long 1071873811
- .long 3000237455
- .long 1071852199
- .long 3352974346
- .long 1071829991
- .long 569629937
- .long 1071807155
- .long 2077237208
- .long 1071783653
- .long 2284891805
- .long 1071759446
- .long 1226651784
- .long 1071734489
- .long 1102047405
- .long 1071708731
- .long 2009896384
- .long 1071682115
- .long 927419082
- .long 1071654577
- .long 85010366
- .long 1071607413
- .long 696431025
- .long 1071548180
- .long 2611410541
- .long 1071486585
- .long 2612593658
- .long 1071422396
- .long 3548155306
- .long 1071355336
- .long 3887997484
- .long 1071285073
- .long 244854763
- .long 1071211202
- .long 4214445648
- .long 1071133216
- .long 2303966727
- .long 1071050478
- .long 3991040013
- .long 1070962152
- .long 3126952278
- .long 1070867118
- .long 1817448378
- .long 1070763804
- .long 1793814864
- .long 1070649884
- .long 3507224072
- .long 1070447193
- .long 4027609105
- .long 1070148772
- .long 577507993
- .long 1069779414
- .long 2310232419
- .long 1068931829
- .type T_table,@object
- .size T_table,2048
- .align 16
-Tbl_addr:
- .long 3822952792
- .long 1021639372
- .long 182792448
- .long 1068507836
- .long 2264213271
- .long 1019558908
- .long 649052928
- .long 1068524253
- .long 1797139609
- .long 1022295143
- .long 1243095296
- .long 1068540671
- .long 1415938756
- .long 1021439537
- .long 2033294592
- .long 1068557090
- .long 2356809978
- .long 1021777916
- .long 3088063744
- .long 1068573510
- .long 2669055318
- .long 1022124482
- .long 180888576
- .long 1068589932
- .long 3566445325
- .long 1021358712
- .long 1970196992
- .long 1068606354
- .long 896980323
- .long 1021319659
- .long 4229555456
- .long 1068622777
- .long 436049712
- .long 1021319758
- .long 2732572160
- .long 1068639202
- .long 583123209
- .long 1020797960
- .long 1842831872
- .long 1068655628
- .long 1370449804
- .long 1021429270
- .long 1628994560
- .long 1068672055
- .long 2411391464
- .long 1021057980
- .long 2159763712
- .long 1068688483
- .long 1208692749
- .long 1021943903
- .long 3503886336
- .long 1068704912
- .long 538793309
- .long 1019744063
- .long 1435187200
- .long 1068721343
- .long 4085087612
- .long 1020608419
- .long 317469952
- .long 1068737775
- .long 144386942
- .long 1021440732
- .long 219617280
- .long 1068754208
- .long 2940088361
- .long 1019981122
- .long 1210558208
- .long 1068770642
- .long 2176850347
- .long 1018373705
- .long 3359268352
- .long 1068787077
- .long 2395611454
- .long 1021889042
- .long 2439803648
- .long 1068803514
- .long 1650705253
- .long 1020227966
- .long 2816203520
- .long 1068819952
- .long 3702166386
- .long 1019379914
- .long 262620672
- .long 1068836392
- .long 1855649370
- .long 1020453124
- .long 3438159616
- .long 1068852832
- .long 923063860
- .long 1019273834
- .long 3822105856
- .long 1068869274
- .long 4289947947
- .long 1019434249
- .long 1483729920
- .long 1068885718
- .long 787455814
- .long 1020738379
- .long 787321088
- .long 1068902163
- .long 3321653337
- .long 1021842569
- .long 1802253312
- .long 1068918609
- .long 2653633526
- .long 1021821525
- .long 302985984
- .long 1068935057
- .long 161272028
- .long 1021655149
- .long 653966080
- .long 1068951506
- .long 2566098667
- .long 1020066219
- .long 2924727296
- .long 1068967956
- .long 3646493722
- .long 1014292285
- .long 2889890304
- .long 1068984408
- .long 1081009196
- .long 1022189620
- .long 619098112
- .long 1069000862
- .long 4011643355
- .long 1021773297
- .long 477017600
- .long 1069017317
- .long 4030305534
- .long 1021292252
- .long 2533403904
- .long 1069033773
- .long 2645187591
- .long 1019527099
- .long 2563102208
- .long 1069050231
- .long 3857293792
- .long 1022311697
- .long 635982336
- .long 1069066691
- .long 3625936637
- .long 1017511744
- .long 1116940800
- .long 1069083152
- .long 3653872993
- .long 1022016631
- .long 4075964160
- .long 1069099614
- .long 2468900271
- .long 1021769532
- .long 993165568
- .long 1069116079
- .long 1358104224
- .long 1021199776
- .long 528586752
- .long 1069132545
- .long 2200950332
- .long 1022024872
- .long 2752395776
- .long 1069149012
- .long 3197072454
- .long 1017751319
- .long 3439855616
- .long 1069165481
- .long 1651081806
- .long 1020809338
- .long 2661257728
- .long 1069181952
- .long 539032752
- .long 1021728805
- .long 486957312
- .long 1069198425
- .long 3136045149
- .long 1016888671
- .long 1282340352
- .long 1069214899
- .long 2593963259
- .long 1018956103
- .long 822921728
- .long 1069231375
- .long 2146032737
- .long 1022306465
- .long 3474216192
- .long 1069247852
- .long 3976811625
- .long 1021350207
- .long 716902656
- .long 1069264332
- .long 718267222
- .long 1018624727
- .long 1211594496
- .long 1069280813
- .long 1485641389
- .long 1018447451
- .long 734070272
- .long 1069297296
- .long 354455128
- .long 1021341291
- .long 3650110720
- .long 1069313780
- .long 682185947
- .long 1021651853
- .long 1440663040
- .long 1069330267
- .long 3558574550
- .long 1021615110
- .long 2766612224
- .long 1069346755
- .long 874607978
- .long 1017746872
- .long 3404011008
- .long 1069363245
- .long 4154988502
- .long 1021439906
- .long 3423949056
- .long 1069379737
- .long 2263202309
- .long 1021479615
- .long 2897587712
- .long 1069396231
- .long 2562065031
- .long 1022090363
- .long 1896159232
- .long 1069412727
- .long 3836237663
- .long 1019867288
- .long 490968576
- .long 1069429225
- .long 3322056743
- .long 1006752762
- .long 3048360192
- .long 1069445724
- .long 1152314833
- .long 1013122252
- .long 1049850624
- .long 1069462226
- .long 3601590727
- .long 1022214610
- .long 3156899584
- .long 1069478729
- .long 1855169970
- .long 1019487271
- .long 851173376
- .long 1069495235
- .long 312649594
- .long 1020868604
- .long 2794281728
- .long 1069511742
- .long 1093490181
- .long 1020777577
- .long 468042496
- .long 1069528252
- .long 1152540679
- .long 1021403732
- .long 2534219264
- .long 1069544763
- .long 2292126035
- .long 1021872430
- .long 1376146432
- .long 1069558527
- .long 3293753641
- .long 1020500454
- .long 4175442432
- .long 1069575044
- .long 3626347564
- .long 1021610969
- .long 3523113472
- .long 1069591566
- .long 339956500
- .long 1021119039
- .long 4003350528
- .long 1069608092
- .long 3429333082
- .long 1022813542
- .long 1611067392
- .long 1069624623
- .long 2298017544
- .long 1021977587
- .long 931782144
- .long 1069641158
- .long 2164684743
- .long 1021250988
- .long 2256725504
- .long 1069657697
- .long 1138762335
- .long 1021443776
- .long 1582853120
- .long 1069674241
- .long 1084010382
- .long 1022994693
- .long 3497758720
- .long 1069690789
- .long 406366244
- .long 1022713586
- .long 3999816960
- .long 1069707342
- .long 1488723042
- .long 1023381290
- .long 3383096064
- .long 1069723900
- .long 2541558953
- .long 1019137887
- .long 1942403584
- .long 1069740463
- .long 1879620343
- .long 1022653642
- .long 4268263680
- .long 1069757030
- .long 3039077047
- .long 1022252545
- .long 2067062272
- .long 1069773603
- .long 4190670677
- .long 1020725863
- .long 4225828096
- .long 1069790180
- .long 1998567321
- .long 1022014385
- .long 2452507136
- .long 1069806763
- .long 1511628873
- .long 1021900300
- .long 1340746240
- .long 1069823351
- .long 788367341
- .long 1022726208
- .long 1190035456
- .long 1069839944
- .long 3856337230
- .long 1021834118
- .long 2300688384
- .long 1069856542
- .long 3211396579
- .long 1022621365
- .long 678886400
- .long 1069873146
- .long 4001011887
- .long 1022042646
- .long 921594112
- .long 1069889755
- .long 557811968
- .long 1023065533
- .long 3331668992
- .long 1069906369
- .long 1877060679
- .long 1022419742
- .long 3917875200
- .long 1069922989
- .long 1181055171
- .long 1022752712
- .long 2984829696
- .long 1069939615
- .long 4294526932
- .long 1021499988
- .long 838049024
- .long 1069956247
- .long 3658081878
- .long 1022957952
- .long 2078928384
- .long 1069972884
- .long 820353701
- .long 1019391107
- .long 2719854336
- .long 1069989527
- .long 1644022489
- .long 1023378240
- .long 3069117696
- .long 1070006176
- .long 2771393702
- .long 1019319954
- .long 3435962368
- .long 1070022831
- .long 3876394145
- .long 1023024433
- .long 4130595328
- .long 1070039492
- .long 1630447748
- .long 1021465882
- .long 1169236224
- .long 1070056160
- .long 2828355997
- .long 1020458120
- .long 3453997312
- .long 1070072833
- .long 164091641
- .long 1020388279
- .long 2708127744
- .long 1070089513
- .long 3036550223
- .long 1023328684
- .long 3540797696
- .long 1070106199
- .long 3710949463
- .long 1022568805
- .long 1972276736
- .long 1070122892
- .long 3885277950
- .long 1019761674
- .long 2613815552
- .long 1070139591
- .long 2764165077
- .long 1022921023
- .long 1487791616
- .long 1070156297
- .long 1330644769
- .long 1023162679
- .long 3207593472
- .long 1070173009
- .long 3911007221
- .long 1022993496
- .long 3797764608
- .long 1070189728
- .long 979712598
- .long 1022554580
- .long 3578920448
- .long 1070206454
- .long 2825738223
- .long 1020223708
- .long 2872795648
- .long 1070223187
- .long 392451124
- .long 1022666279
- .long 2002258432
- .long 1070239927
- .long 3730407632
- .long 1023148291
- .long 1291326464
- .long 1070256674
- .long 3723802980
- .long 1022514089
- .long 1065180928
- .long 1070273428
- .long 2635617463
- .long 1022654470
- .long 1650181632
- .long 1070290189
- .long 2061982883
- .long 1022853411
- .long 3373882880
- .long 1070306957
- .long 319732785
- .long 1022017175
- .long 2270081280
- .long 1070323733
- .long 2237757411
- .long 1023064087
- .long 2963732736
- .long 1070340516
- .long 468839165
- .long 1023293774
- .long 1491099904
- .long 1070357307
- .long 1502657946
- .long 1021533479
- .long 2479636480
- .long 1070374105
- .long 482913562
- .long 1021986286
- .long 1968133632
- .long 1070390911
- .long 3281474337
- .long 1022646400
- .long 291639040
- .long 1070407725
- .long 2453320259
- .long 1022812423
- .long 2081472512
- .long 1070424546
- .long 2939989570
- .long 1023091888
- .long 3380340480
- .long 1070441375
- .long 2850707499
- .long 1021921109
- .long 232287488
- .long 1070458213
- .long 3674625342
- .long 1020725130
- .long 1567614208
- .long 1070475058
- .long 9347334
- .long 1022024009
- .long 3433091072
- .long 1070491911
- .long 282524999
- .long 1021433523
- .long 1876877312
- .long 1070508773
- .long 3470449440
- .long 1019309721
- .long 1538472192
- .long 1070525643
- .long 2089486825
- .long 1019698916
- .long 2763830784
- .long 1070542521
- .long 443498115
- .long 1020505194
- .long 1605381632
- .long 1070559408
- .long 3018871601
- .long 1022869913
- .long 2706946048
- .long 1070576303
- .long 3936260892
- .long 1023175875
- .long 2123887360
- .long 1070593207
- .long 2994220655
- .long 1022825948
- .long 104015104
- .long 1070603108
- .long 335054493
- .long 1023441853
- .long 2904568832
- .long 1070615800
- .long 1451215633
- .long 1023853857
- .long 3456197120
- .long 1070632739
- .long 436334733
- .long 1024026432
- .long 252452352
- .long 1070649697
- .long 34596167
- .long 1024031396
- .long 3328018432
- .long 1070666672
- .long 2644547073
- .long 1024296758
- .long 1255829248
- .long 1070683667
- .long 552832586
- .long 1023763122
- .long 4097058560
- .long 1070700680
- .long 1955640623
- .long 1021394654
- .long 451770112
- .long 1070717714
- .long 3428903777
- .long 1022941142
- .long 408920832
- .long 1070734767
- .long 165503263
- .long 1023894958
- .long 1186960640
- .long 1070751840
- .long 435826450
- .long 1024026134
- .long 19078656
- .long 1070768934
- .long 1834169749
- .long 1022899284
- .long 2743490304
- .long 1070786048
- .long 494581074
- .long 1018818479
- .long 2328961024
- .long 1070803184
- .long 2987908834
- .long 1022581110
- .long 350011392
- .long 1070820342
- .long 240771184
- .long 1024143083
- .long 2692326912
- .long 1070837521
- .long 666056837
- .long 1022394776
- .long 2373274368
- .long 1070854723
- .long 2484337770
- .long 1024228156
- .long 1017131520
- .long 1070871948
- .long 3285648279
- .long 1024025789
- .long 265558272
- .long 1070889196
- .long 392241896
- .long 1024252809
- .long 1778008064
- .long 1070906467
- .long 1536107943
- .long 1023949300
- .long 2937184768
- .long 1070923762
- .long 3541062251
- .long 1019448646
- .long 1144442880
- .long 1070941082
- .long 3691683781
- .long 1022123948
- .long 2410165504
- .long 1070958426
- .long 1804181960
- .long 1023945221
- .long 4174350848
- .long 1070975795
- .long 2016094861
- .long 1021716585
- .long 3897012480
- .long 1070993190
- .long 175294410
- .long 1023703404
- .long 3353623040
- .long 1071010611
- .long 167973242
- .long 1023240839
- .long 45671168
- .long 1071028059
- .long 2166856113
- .long 1021565413
- .long 86063872
- .long 1071045533
- .long 2676254727
- .long 1023985299
- .long 1019772672
- .long 1071063034
- .long 989043593
- .long 1021549587
- .long 414297344
- .long 1071080563
- .long 3960972046
- .long 1024307251
- .long 155173120
- .long 1071098120
- .long 1830919291
- .long 1021592251
- .long 2151562240
- .long 1071115705
- .long 405408666
- .long 1023423128
- .long 4041854720
- .long 1071133319
- .long 2043497827
- .long 1024411503
- .long 3489224192
- .long 1071150963
- .long 3072215864
- .long 1022698635
- .long 2477196288
- .long 1071168637
- .long 1812195139
- .long 1022689192
- .long 3015298816
- .long 1071186341
- .long 764841969
- .long 1021027331
- .long 2844731136
- .long 1071204076
- .long 2878117321
- .long 1019116513
- .long 4028950528
- .long 1071221842
- .long 698911452
- .long 1023265602
- .long 69441536
- .long 1071239641
- .long 3253467847
- .long 1020795075
- .long 1676209920
- .long 1071257471
- .long 4272431167
- .long 1022873982
- .long 2408752384
- .long 1071275334
- .long 648519100
- .long 1024385717
- .long 151623680
- .long 1071293231
- .long 345257017
- .long 1019561408
- .long 1410154240
- .long 1071311161
- .long 197863993
- .long 1023224207
- .long 4131351552
- .long 1071329125
- .long 2620801789
- .long 1024411169
- .long 1999664384
- .long 1071347125
- .long 3952692616
- .long 1024168086
- .long 1617668864
- .long 1071365160
- .long 3019889809
- .long 1021907692
- .long 1032074240
- .long 1071383231
- .long 59469899
- .long 1023656194
- .long 2619492096
- .long 1071401338
- .long 1417526820
- .long 1021457783
- .long 202429440
- .long 1071419483
- .long 2927667935
- .long 1019175447
- .long 525044224
- .long 1071437665
- .long 38166811
- .long 1023981879
- .long 1779258880
- .long 1071455885
- .long 481252500
- .long 1023310234
- .long 2195673600
- .long 1071474144
- .long 3962395981
- .long 1021339088
- .long 44573696
- .long 1071492443
- .long 3936281395
- .long 1023014829
- .long 2226905344
- .long 1071510781
- .long 1515320476
- .long 1024320623
- .long 2800512512
- .long 1071529160
- .long 1225403697
- .long 1021081846
- .long 161113600
- .long 1071547581
- .long 3064809733
- .long 1024173917
- .long 1338410240
- .long 1071566043
- .long 2027604973
- .long 1024362526
- .long 522433280
- .long 1071584548
- .long 2055171723
- .long 1023858825
- .long 539595776
- .long 1071603096
- .long 3868820135
- .long 1022936424
- .long 4264017664
- .long 1071621687
- .long 3228065145
- .long 1023479578
- .long 1733924096
- .long 1071640324
- .long 3511934475
- .long 1022496355
- .long 108880384
- .long 1071651839
- .long 615880967
- .long 1023519706
- .long 3517856512
- .long 1071661202
- .long 3113108559
- .long 1025190289
- .long 4043153152
- .long 1071670589
- .long 1571836218
- .long 1023106116
- .long 3251299072
- .long 1071680000
- .long 3444076102
- .long 1022187841
- .long 2736921600
- .long 1071689435
- .long 272771483
- .long 1025095280
- .long 3897698560
- .long 1071703633
- .long 2075390188
- .long 1022489022
- .long 3209485056
- .long 1071722652
- .long 1438094065
- .long 1021844944
- .long 3781432064
- .long 1071741774
- .long 1675017145
- .long 1024143828
- .long 2684184064
- .long 1071761003
- .long 2259963753
- .long 1024731393
- .long 1840489728
- .long 1071780342
- .long 3372883597
- .long 1023431408
- .long 3764087808
- .long 1071799794
- .long 3307523102
- .long 1024485788
- .long 3006232320
- .long 1071819364
- .long 3088971966
- .long 1025213251
- .long 3374881280
- .long 1071839055
- .long 834437749
- .long 1025236452
- .long 797284864
- .long 1071858872
- .long 3122663941
- .long 1025320473
- .long 545765120
- .long 1071878818
- .long 826539625
- .long 1022450955
- .long 107562240
- .long 1071898898
- .long 339584600
- .long 1022481255
- .long 2123649024
- .long 1071919116
- .long 3912959833
- .long 1024321009
- .long 1562385664
- .long 1071939478
- .long 2846067230
- .long 1023343981
- .long 2963085824
- .long 1071959988
- .long 954548627
- .long 1021475211
- .long 3325550592
- .long 1071980652
- .long 3459651155
- .long 1025305573
- .long 775752448
- .long 1072001476
- .long 3582746667
- .long 1023859460
- .long 3238590720
- .long 1072022464
- .long 634636162
- .long 1024472353
- .long 2758801920
- .long 1072043624
- .long 3078216319
- .long 1025304516
- .long 1370319104
- .long 1072064962
- .long 2570569078
- .long 1025099442
- .long 2615805184
- .long 1072086484
- .long 3729933412
- .long 1024605112
- .long 3077336576
- .long 1072108198
- .long 1948916066
- .long 1024781603
- .long 1099528192
- .long 1072130112
- .long 3139143157
- .long 1023729360
- .long 1231903232
- .long 1072152233
- .long 1349513477
- .long 1024737515
- .long 1507504128
- .long 1072174570
- .long 3484516322
- .long 1024000959
- .long 2214659840
- .long 1072197132
- .long 2563820917
- .long 1025225535
- .long 1804739840
- .long 1072219929
- .long 760038746
- .long 1024482855
- .long 1413746688
- .long 1072242971
- .long 3401734714
- .long 1025129838
- .long 821409536
- .long 1072266269
- .long 3729772551
- .long 1025484796
- .long 3031825664
- .long 1072289834
- .long 122256749
- .long 1024752594
- .long 1710784256
- .long 1072313680
- .long 1518205483
- .long 1024724809
- .long 3025265152
- .long 1072337819
- .long 409951989
- .long 1022835555
- .long 287769088
- .long 1072362267
- .long 800355594
- .long 1022484850
- .long 198179840
- .long 1072387038
- .long 3502926213
- .long 1024209373
- .long 1909130496
- .long 1072412149
- .long 3064694319
- .long 1025380823
- .long 1941732096
- .long 1072437619
- .long 4112930390
- .long 1024294679
- .long 3492010496
- .long 1072463467
- .long 2684918107
- .long 1023220233
- .long 81959680
- .long 1072489716
- .long 220021366
- .long 1020635131
- .long 2297837056
- .long 1072516387
- .long 4027683826
- .long 1021041185
- .long 270404096
- .long 1072543508
- .long 2012766065
- .long 1021780753
- .long 3667376896
- .long 1072571105
- .long 2727981522
- .long 1023009874
- .long 330400256
- .long 1072599212
- .long 2940017003
- .long 1025393439
- .long 1119293952
- .long 1072627861
- .long 1608550416
- .long 1022675612
- .long 3536155904
- .long 1072657091
- .long 349665778
- .long 1025156751
- .long 3078046720
- .long 1072686946
- .long 2016159996
- .long 1022193169
- .long 455228416
- .long 1072705361
- .long 1908539328
- .long 1026126332
- .long 1871505664
- .long 1072720988
- .long 2784700894
- .long 1025922277
- .long 1630994432
- .long 1072737010
- .long 361107678
- .long 1022887244
- .long 2084558336
- .long 1072753462
- .type Tbl_addr,@object
- .size Tbl_addr,3840
- .space 768, 0x00 # pad
- .align 16
-cv:
- .long 0
- .long 0
- .long 1431655765
- .long 3217380693
- .long 858993459
- .long 3216192307
- .long 3067833783
- .long 3215383405
- .type cv,@object
- .size cv,32
- .align 16
-PI_BY_2:
- .long 856972295
- .long 1016178214
- .long 1413754136
- .long 1073291771
- .type PI_BY_2,@object
- .size PI_BY_2,16
- .align 16
-NEG_PI:
- .long 856972295
- .long 3164710438
- .long 1413754136
- .long 3221823995
- .type NEG_PI,@object
- .size NEG_PI,16
- .align 16
-cv2:
- .long 780903145
- .long 1066854586
- .long 858993459
- .long 1068708659
- .long 3340530119
- .long 1067392113
- .long 1431655765
- .long 1069897045
- .long 1321528399
- .long 1066517740
- .long 3067833783
- .long 1067899757
- .long 2021159460
- .long 1065855096
- .long 2576980378
- .long 1066178969
- .type cv2,@object
- .size cv2,64
- .align 16
-HALFMASK:
- .long 4160749568
- .long 4294967295
- .long 4160749568
- .long 4294967295
- .type HALFMASK,@object
- .size HALFMASK,16
- .align 16
-PI:
- .long 856972295
- .long 1017226790
- .long 1413754136
- .long 1074340347
- .type PI,@object
- .size PI,16
- .align 4
-ONEMASK:
- .long 0
- .long 1072693248
- .type ONEMASK,@object
- .size ONEMASK,8
- .align 4
-TMASK:
- .long 0
- .long 4294950912
- .type TMASK,@object
- .size TMASK,8
- .align 4
-ONE_BY_2:
- .long 0
- .long 1071644672
- .type ONE_BY_2,@object
- .size ONE_BY_2,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_acos.1-.
- .4byte ..___tag_value_acos.5-..___tag_value_acos.1
- .2byte 0x0400
- .4byte ..___tag_value_acos.3-..___tag_value_acos.1
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_acos.4-..___tag_value_acos.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/e_asin.S b/libm/x86_64/e_asin.S
deleted file mode 100644
index 4242543..0000000
--- a/libm/x86_64/e_asin.S
+++ /dev/null
@@ -1,2036 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// To compute asin(s), separate schemes are used when s is in different
-// intervals.
-//
-// |s| in [2^{-4}, sqrt(3)/2):
-// Let t=2^k*1.b1 b2..b6 1, where s=2^k*1.b1 b2 .. b52
-// asin(s)=asin(t)+asin(r), where r=s*sqrt(1-t^2)-t*sqrt(1-s^2)
-// asin(r)-r evaluated as 7-degree polynomial (c3*r^3+c5*r^5+c7*r^7)
-// For the first degree term, r is evaluated as
-// R=(s^2-t^2)/(sqrt(1-t^2)*s+sqrt(1-s^2)*t)
-// (sqrt(1-t^2) read from table)
-// The main source of error is still R (may still be affected by up to 3 ulps
-// of rounding error). The table size must be sufficiently large, to minimize
-// this effect.
-//
-// |s| in [sqrt(3)/2, 255/256):
-// Let t=2^k*1.b1 b2..b6 1, where sqrt(1-s^2)=2^k*1.b1 b2 .. b52 (rounded)
-// asin(|s|)=pi/2-asin(t)+asin(r), r=s*t-sqrt(1-s^2)*sqrt(1-t^2)
-// asin(r) evaluated as polynomial (same as above)
-// The first degree term is evaluated as
-// r=(s^2+t^2-1)/(s*t+sqrt(1-s^2)*sqrt(1-t^2))
-//
-// |s|<2^{-4}: evaluate as 13-degree polynomial
-//
-// |s| in [255/256,1): asin(|s|)=pi/2-asin(sqrt(1-s^2))
-// use 17-degree polynomial, get error term
-// Q*eps ~ (1-s^2-Q^2)/(2*Q) for first term
-// ( Q(1+eps)=sqrt(1-s^2) )
-//
-// Special cases:
-// asin(NaN) = quiet NaN, and raise invalid exception
-// asin(INF) = QNaN and raise invalid exception
-// asin(x) = QNaN and raise invalid exception, for |x|>1.0
-// asin(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin asin
-ENTRY(asin)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_asin.1:
- subq $24, %rsp
-..___tag_value_asin.3:
- movsd %xmm0, (%rsp)
-..B1.2:
- stmxcsr 16(%rsp)
- movl 16(%rsp), %eax
- andl $-24577, %eax
- cmpl 16(%rsp), %eax
- jne .L_2TAG_PACKET_0.0.2
-.L_2TAG_PACKET_1.0.2:
- movsd ABSVALMASK(%rip), %xmm4
- movsd ONEMASK(%rip), %xmm3
- xorpd %xmm5, %xmm5
- movsd TMASK(%rip), %xmm2
- movl $8192, %ecx
- pinsrw $2, %ecx, %xmm5
- movq %xmm0, %xmm1
- psrlq $44, %xmm0
- movd %xmm0, %edx
- movq %xmm1, %xmm7
- movl $8192, %ecx
- pinsrw $2, %ecx, %xmm5
- movq %xmm1, %xmm0
- movl $524287, %eax
- andl %edx, %eax
- subl $260864, %eax
- cmpl $955, %eax
- jae .L_2TAG_PACKET_2.0.2
- mulsd %xmm1, %xmm1
- andl $65535, %edx
- subsd %xmm1, %xmm3
- sqrtsd %xmm3, %xmm3
- andpd %xmm7, %xmm2
- andl $-4, %edx
- subl $64256, %edx
- lea T_table(%rip), %r8
- movsd (%r8,%rdx,2), %xmm1
- orpd %xmm5, %xmm2
- lea Tbl_addr(%rip), %r8
- movapd (%r8,%rdx,4), %xmm4
- movq %xmm7, %xmm6
- addsd %xmm2, %xmm7
- subsd %xmm2, %xmm0
- mulsd %xmm7, %xmm0
- mulsd %xmm1, %xmm6
- mulsd %xmm2, %xmm3
- movq %xmm6, %xmm1
- addsd %xmm3, %xmm6
- divsd %xmm6, %xmm0
- movsd 16+cv(%rip), %xmm7
- movsd cv(%rip), %xmm5
- subsd %xmm3, %xmm1
- andpd SIGNMASK(%rip), %xmm2
- movq %xmm1, %xmm3
- mulsd %xmm1, %xmm1
- movsd 8+cv(%rip), %xmm6
- mulsd %xmm1, %xmm3
- mulsd %xmm1, %xmm7
- mulsd %xmm3, %xmm5
- xorpd %xmm2, %xmm4
- mulsd %xmm1, %xmm3
- addsd %xmm7, %xmm6
- mulsd %xmm3, %xmm6
- addsd %xmm4, %xmm5
- pshufd $238, %xmm4, %xmm4
- addsd %xmm5, %xmm6
- orpd %xmm2, %xmm4
- addsd %xmm6, %xmm0
- movl 16(%rsp), %eax
- andl $-24577, %eax
- cmpl 16(%rsp), %eax
- je .L_2TAG_PACKET_3.0.2
- stmxcsr 20(%rsp)
- movl 16(%rsp), %eax
- andl $24576, %eax
- orl %eax, 20(%rsp)
- ldmxcsr 20(%rsp)
-.L_2TAG_PACKET_3.0.2:
- addsd %xmm4, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_2.0.2:
- subl $955, %eax
- cmpl $67, %eax
- jae .L_2TAG_PACKET_4.0.2
- mulsd %xmm1, %xmm1
- subsd %xmm1, %xmm3
- sqrtsd %xmm3, %xmm3
- movl %edx, %eax
- andpd ABSVALMASK(%rip), %xmm0
- andpd HALFMASK2(%rip), %xmm7
- movq %xmm0, %xmm1
- movsd ONEMASK(%rip), %xmm4
- movq %xmm7, %xmm6
- subsd %xmm7, %xmm1
- mulsd %xmm7, %xmm7
- addsd %xmm6, %xmm0
- subsd %xmm7, %xmm4
- mulsd %xmm1, %xmm0
- movq %xmm3, %xmm7
- andpd %xmm3, %xmm2
- psllq $2, %xmm3
- pextrw $3, %xmm3, %edx
- orpd %xmm5, %xmm2
- subl $65216, %edx
- addl %edx, %edx
- lea T_table(%rip), %r8
- mulsd (%r8,%rdx,4), %xmm7
- mulsd %xmm2, %xmm6
- movapd PI_BY_2(%rip), %xmm3
- mulsd %xmm2, %xmm1
- mulsd %xmm2, %xmm2
- subsd %xmm7, %xmm6
- addsd %xmm1, %xmm6
- subsd %xmm2, %xmm4
- addsd %xmm7, %xmm7
- movsd cv(%rip), %xmm5
- subsd %xmm0, %xmm4
- addsd %xmm6, %xmm7
- movsd 16+cv(%rip), %xmm0
- divsd %xmm7, %xmm4
- movsd 8+cv(%rip), %xmm2
- lea Tbl_addr(%rip), %r8
- subpd (%r8,%rdx,8), %xmm3
- movq %xmm6, %xmm1
- mulsd %xmm6, %xmm6
- andl $524288, %eax
- shrl $4, %eax
- mulsd %xmm6, %xmm0
- mulsd %xmm6, %xmm1
- mulsd %xmm1, %xmm5
- mulsd %xmm6, %xmm1
- addsd %xmm2, %xmm0
- pxor %xmm6, %xmm6
- mulsd %xmm1, %xmm0
- addsd %xmm3, %xmm5
- pinsrw $3, %eax, %xmm6
- addsd %xmm5, %xmm0
- movq %xmm4, %xmm5
- pshufd $238, %xmm3, %xmm3
- subsd %xmm3, %xmm4
- addsd %xmm4, %xmm3
- subsd %xmm3, %xmm5
- subsd %xmm5, %xmm0
- movl 16(%rsp), %eax
- andl $-24577, %eax
- cmpl 16(%rsp), %eax
- je .L_2TAG_PACKET_5.0.2
- stmxcsr 20(%rsp)
- movl 16(%rsp), %eax
- andl $24576, %eax
- orl %eax, 20(%rsp)
- ldmxcsr 20(%rsp)
-.L_2TAG_PACKET_5.0.2:
- xorpd %xmm6, %xmm0
- xorpd %xmm6, %xmm4
- subsd %xmm4, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_4.0.2:
- addl $15291, %eax
- cmpl $14336, %eax
- jae .L_2TAG_PACKET_6.0.2
- unpcklpd %xmm7, %xmm7
- movapd cv2(%rip), %xmm1
- movapd %xmm7, %xmm6
- movapd 16+cv2(%rip), %xmm2
- movapd 32+cv2(%rip), %xmm4
- mulpd %xmm7, %xmm7
- mulpd %xmm7, %xmm6
- mulpd %xmm7, %xmm1
- mulpd %xmm7, %xmm7
- movq %xmm6, %xmm3
- mulsd %xmm6, %xmm6
- addpd %xmm2, %xmm1
- mulpd %xmm7, %xmm4
- mulsd %xmm3, %xmm6
- addpd %xmm4, %xmm1
- mulpd %xmm6, %xmm1
- pshufd $238, %xmm1, %xmm2
- addsd %xmm2, %xmm1
- movl 16(%rsp), %eax
- andl $-24577, %eax
- cmpl 16(%rsp), %eax
- je .L_2TAG_PACKET_7.0.2
- stmxcsr 20(%rsp)
- movl 16(%rsp), %eax
- andl $24576, %eax
- orl %eax, 20(%rsp)
- ldmxcsr 20(%rsp)
-.L_2TAG_PACKET_7.0.2:
- addsd %xmm1, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_6.0.2:
- subl $15358, %eax
- cmpl $2, %eax
- jae .L_2TAG_PACKET_8.0.2
- mulsd %xmm1, %xmm1
- subsd %xmm1, %xmm3
- sqrtsd %xmm3, %xmm3
- movl %edx, %eax
- andpd HALFMASK(%rip), %xmm7
- pshufd $68, %xmm3, %xmm5
- andpd HALFMASK(%rip), %xmm3
- movq %xmm7, %xmm1
- movsd ONEMASK(%rip), %xmm4
- movq %xmm7, %xmm6
- subsd %xmm7, %xmm0
- mulsd %xmm7, %xmm7
- addsd %xmm1, %xmm1
- mulsd %xmm0, %xmm1
- subsd %xmm7, %xmm4
- movq %xmm3, %xmm6
- mulsd %xmm3, %xmm3
- mulsd %xmm0, %xmm0
- subsd %xmm1, %xmm4
- subsd %xmm5, %xmm6
- addsd %xmm5, %xmm5
- subsd %xmm3, %xmm4
- movapd cv2(%rip), %xmm2
- pshufd $238, %xmm5, %xmm3
- subsd %xmm0, %xmm4
- addsd %xmm6, %xmm5
- pshufd $238, %xmm3, %xmm7
- addsd %xmm3, %xmm3
- mulsd %xmm6, %xmm5
- addsd %xmm5, %xmm4
- pshufd $238, %xmm7, %xmm6
- divsd %xmm3, %xmm4
- movapd 48+cv2(%rip), %xmm1
- movapd 16+cv2(%rip), %xmm5
- movapd 32+cv2(%rip), %xmm0
- mulpd %xmm7, %xmm7
- movq %xmm6, %xmm3
- mulpd %xmm7, %xmm2
- mulpd %xmm7, %xmm6
- shrl $4, %eax
- andl $32768, %eax
- mulsd %xmm7, %xmm1
- mulpd %xmm7, %xmm7
- addpd %xmm2, %xmm5
- movapd %xmm6, %xmm2
- mulsd %xmm6, %xmm6
- mulpd %xmm0, %xmm7
- movapd PI_BY_2(%rip), %xmm0
- mulsd %xmm6, %xmm2
- addpd %xmm5, %xmm7
- pshufd $238, %xmm1, %xmm5
- mulsd %xmm2, %xmm6
- mulpd %xmm2, %xmm7
- addsd %xmm5, %xmm1
- xorpd %xmm5, %xmm5
- pshufd $238, %xmm7, %xmm2
- mulsd %xmm6, %xmm1
- pshufd $238, %xmm0, %xmm6
- addsd %xmm2, %xmm7
- movq %xmm3, %xmm2
- pinsrw $3, %eax, %xmm5
- subsd %xmm6, %xmm3
- addsd %xmm1, %xmm0
- addsd %xmm3, %xmm6
- addsd %xmm4, %xmm7
- subsd %xmm6, %xmm2
- subsd %xmm7, %xmm0
- subsd %xmm2, %xmm0
- movl 16(%rsp), %eax
- andl $-24577, %eax
- cmpl 16(%rsp), %eax
- je .L_2TAG_PACKET_9.0.2
- stmxcsr 20(%rsp)
- movl 16(%rsp), %eax
- andl $24576, %eax
- orl %eax, 20(%rsp)
- ldmxcsr 20(%rsp)
-.L_2TAG_PACKET_9.0.2:
- xorpd %xmm5, %xmm0
- xorpd %xmm5, %xmm3
- subsd %xmm3, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_8.0.2:
- addl $261886, %eax
- cmpl $261888, %eax
- jb .L_2TAG_PACKET_10.0.2
- movd %xmm0, %ecx
- psrlq $32, %xmm0
- movd %xmm0, %edx
- andl $2147483647, %edx
- movl $1072693248, %eax
- subl %edx, %eax
- orl %ecx, %eax
- cmpl $0, %eax
- je .L_2TAG_PACKET_11.0.2
- movsd (%rsp), %xmm2
- movd %xmm2, %edx
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- andl $2147483647, %ecx
- subl $1, %edx
- sbbl $2146435072, %ecx
- cmpl $0, %ecx
- jge .L_2TAG_PACKET_10.0.2
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $32752, %edx
- pinsrw $3, %edx, %xmm1
- mulsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_12.0.2
-.L_2TAG_PACKET_11.0.2:
- movsd ABSVALMASK(%rip), %xmm1
- movsd PI_BY_2(%rip), %xmm2
- movsd 8+PI_BY_2(%rip), %xmm0
- addsd %xmm2, %xmm0
- andnpd %xmm7, %xmm1
- orpd %xmm1, %xmm0
- movl 16(%rsp), %eax
- andl $-24577, %eax
- cmpl 16(%rsp), %eax
- je .L_2TAG_PACKET_13.0.2
- stmxcsr 20(%rsp)
- movl 16(%rsp), %eax
- andl $24576, %eax
- orl %eax, 20(%rsp)
- ldmxcsr 20(%rsp)
-.L_2TAG_PACKET_13.0.2:
- jmp ..B1.5
-.L_2TAG_PACKET_10.0.2:
- movsd (%rsp), %xmm0
- xorpd %xmm6, %xmm6
- movq %xmm0, %xmm7
- movl 16(%rsp), %eax
- andl $-24577, %eax
- cmpl 16(%rsp), %eax
- je .L_2TAG_PACKET_14.0.2
- stmxcsr 20(%rsp)
- movl 16(%rsp), %eax
- andl $24576, %eax
- orl %eax, 20(%rsp)
- ldmxcsr 20(%rsp)
-.L_2TAG_PACKET_14.0.2:
- pextrw $3, %xmm0, %edx
- andl $32752, %edx
- subl $16, %edx
- cmpl $32736, %edx
- jb .L_2TAG_PACKET_15.0.2
- addsd %xmm0, %xmm6
- orpd %xmm6, %xmm0
- mulsd %xmm0, %xmm7
-.L_2TAG_PACKET_15.0.2:
- jmp ..B1.5
-.L_2TAG_PACKET_0.0.2:
- movl %eax, 20(%rsp)
- ldmxcsr 20(%rsp)
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_12.0.2:
- movl 16(%rsp), %eax
- andl $-24577, %eax
- cmpl 16(%rsp), %eax
- je .L_2TAG_PACKET_16.0.2
- stmxcsr 20(%rsp)
- movl 16(%rsp), %eax
- andl $24576, %eax
- orl %eax, 20(%rsp)
- ldmxcsr 20(%rsp)
-.L_2TAG_PACKET_16.0.2:
- movq %xmm0, 8(%rsp)
-..B1.3:
- movq 8(%rsp), %xmm0
-.L_2TAG_PACKET_17.0.2:
-..B1.5:
- addq $24, %rsp
-..___tag_value_asin.4:
- ret
-..___tag_value_asin.5:
-END(asin)
-# -- End asin
- .section .rodata, "a"
- .align 16
- .align 16
-ABSVALMASK:
- .long 4294967295
- .long 2147483647
- .long 0
- .long 0
- .type ABSVALMASK,@object
- .size ABSVALMASK,16
- .align 16
-T_table:
- .long 2642784509
- .long 1072689083
- .long 1514442531
- .long 1072688953
- .long 333108933
- .long 1072688821
- .long 3392112024
- .long 1072688686
- .long 2099852862
- .long 1072688550
- .long 749609004
- .long 1072688412
- .long 3634632596
- .long 1072688271
- .long 2163248461
- .long 1072688129
- .long 628657846
- .long 1072687985
- .long 3324036511
- .long 1072687838
- .long 1657632815
- .long 1072687690
- .long 4217538760
- .long 1072687539
- .long 2411951597
- .long 1072687387
- .long 533944872
- .long 1072687233
- .long 2876566508
- .long 1072687076
- .long 847936891
- .long 1072686918
- .long 3036019913
- .long 1072686757
- .long 848884575
- .long 1072686595
- .long 2874443326
- .long 1072686430
- .long 520713666
- .long 1072686264
- .long 2375556481
- .long 1072686095
- .long 4141904948
- .long 1072685924
- .long 1522666382
- .long 1072685752
- .long 3105624104
- .long 1072685577
- .long 298666327
- .long 1072685401
- .long 1689524500
- .long 1072685222
- .long 2981002200
- .long 1072685041
- .long 4170844284
- .long 1072684858
- .long 961802263
- .long 1072684674
- .long 1941503454
- .long 1072684487
- .long 2812647170
- .long 1072684298
- .long 3572873869
- .long 1072684107
- .long 4219797823
- .long 1072683914
- .long 456039788
- .long 1072683720
- .long 869096151
- .long 1072683523
- .long 1161535119
- .long 1072683324
- .long 1330865866
- .long 1072683123
- .long 1374571204
- .long 1072682920
- .long 1290107538
- .long 1072682715
- .long 1074904836
- .long 1072682508
- .long 726366587
- .long 1072682299
- .long 241869763
- .long 1072682088
- .long 3913732079
- .long 1072681874
- .long 3149342765
- .long 1072681659
- .long 2240966306
- .long 1072681442
- .long 1185873216
- .long 1072681223
- .long 4276274591
- .long 1072681001
- .long 2919452883
- .long 1072680778
- .long 1407565635
- .long 1072680553
- .long 4032743551
- .long 1072680325
- .long 2202188565
- .long 1072680096
- .long 207977577
- .long 1072679865
- .long 2342160518
- .long 1072679631
- .long 11858423
- .long 1072679396
- .long 1804034453
- .long 1072679158
- .long 3420722787
- .long 1072678918
- .long 563930456
- .long 1072678677
- .long 1820539192
- .long 1072678433
- .long 2892501606
- .long 1072678187
- .long 3776710320
- .long 1072677939
- .long 175063337
- .long 1072677690
- .long 674333171
- .long 1072677438
- .long 976363026
- .long 1072677184
- .long 1077935934
- .long 1072676928
- .long 1921075490
- .long 1072676540
- .long 881493302
- .long 1072676016
- .long 3275752439
- .long 1072675483
- .long 486855588
- .long 1072674943
- .long 1077229111
- .long 1072674394
- .long 723950308
- .long 1072673837
- .long 3693582199
- .long 1072673271
- .long 1367335316
- .long 1072672698
- .long 2305837020
- .long 1072672116
- .long 2184358641
- .long 1072671526
- .long 972682840
- .long 1072670928
- .long 2935101762
- .long 1072670321
- .long 3745513263
- .long 1072669706
- .long 3372320886
- .long 1072669083
- .long 1783464620
- .long 1072668452
- .long 3241386215
- .long 1072667812
- .long 3418125284
- .long 1072667164
- .long 2280219148
- .long 1072666508
- .long 4088700758
- .long 1072665843
- .long 219227400
- .long 1072665171
- .long 3521816918
- .long 1072664489
- .long 1076205279
- .long 1072663800
- .long 1436484616
- .long 1072663102
- .long 271362610
- .long 1072662396
- .long 1838996688
- .long 1072661681
- .long 1807122518
- .long 1072660958
- .long 137953542
- .long 1072660227
- .long 1088178584
- .long 1072659487
- .long 324057537
- .long 1072658739
- .long 2101288076
- .long 1072657982
- .long 2085133974
- .long 1072657217
- .long 235324451
- .long 1072656444
- .long 806051592
- .long 1072655662
- .long 3756033140
- .long 1072654871
- .long 453542543
- .long 1072654073
- .long 3741177327
- .long 1072653265
- .long 691216109
- .long 1072652450
- .long 4145223372
- .long 1072651625
- .long 1174439091
- .long 1072650793
- .long 324416139
- .long 1072649952
- .long 1550246310
- .long 1072649102
- .long 511524674
- .long 1072648244
- .long 1457248482
- .long 1072647377
- .long 45944955
- .long 1072646502
- .long 525537397
- .long 1072645618
- .long 2848440188
- .long 1072644725
- .long 2671555633
- .long 1072643824
- .long 4241172637
- .long 1072642914
- .long 3213094278
- .long 1072641996
- .long 3832503688
- .long 1072641069
- .long 1754091534
- .long 1072640134
- .long 1221921804
- .long 1072639190
- .long 2184526489
- .long 1072638237
- .long 294902089
- .long 1072637276
- .long 4090375270
- .long 1072636305
- .long 632860906
- .long 1072635327
- .long 2753498702
- .long 1072634339
- .long 1808009252
- .long 1072633343
- .long 2036428672
- .long 1072632338
- .long 3383235626
- .long 1072631324
- .long 1497347484
- .long 1072630302
- .long 617018317
- .long 1072629271
- .long 684933058
- .long 1072628231
- .long 1643170798
- .long 1072627182
- .long 3011066360
- .long 1072625592
- .long 957158713
- .long 1072623442
- .long 1390907941
- .long 1072621256
- .long 3819155270
- .long 1072619034
- .long 3443571196
- .long 1072616777
- .long 4045412458
- .long 1072614484
- .long 805503923
- .long 1072612156
- .long 1778922015
- .long 1072609791
- .long 2125033665
- .long 1072607390
- .long 1287203863
- .long 1072604953
- .long 2992629568
- .long 1072602479
- .long 2367267127
- .long 1072599969
- .long 3115526047
- .long 1072597422
- .long 340219539
- .long 1072594839
- .long 2017215719
- .long 1072592218
- .long 3225443424
- .long 1072589560
- .long 3326565673
- .long 1072586865
- .long 1669811211
- .long 1072584133
- .long 1886735022
- .long 1072581363
- .long 3301071171
- .long 1072578555
- .long 928514283
- .long 1072575710
- .long 2656364059
- .long 1072572826
- .long 3473490507
- .long 1072569904
- .long 2649965606
- .long 1072566944
- .long 3736819052
- .long 1072563945
- .long 1680885175
- .long 1072560908
- .long 4413771
- .long 1072557832
- .long 2214869753
- .long 1072554716
- .long 3214725184
- .long 1072551561
- .long 2186079903
- .long 1072548367
- .long 2590372131
- .long 1072545133
- .long 3578146079
- .long 1072541859
- .long 4283712755
- .long 1072538545
- .long 3824834510
- .long 1072535191
- .long 1302400298
- .long 1072531797
- .long 95058636
- .long 1072528362
- .long 3563906063
- .long 1072524885
- .long 2167230730
- .long 1072521368
- .long 3524918334
- .long 1072517809
- .long 2353304918
- .long 1072514209
- .long 1939625839
- .long 1072510567
- .long 1256714581
- .long 1072506883
- .long 3552525848
- .long 1072503156
- .long 3464809522
- .long 1072499387
- .long 4200542593
- .long 1072495575
- .long 355609124
- .long 1072491721
- .long 3684139099
- .long 1072487822
- .long 148355918
- .long 1072483881
- .long 1457689242
- .long 1072479895
- .long 2118591596
- .long 1072475865
- .long 908848089
- .long 1072471791
- .long 877032689
- .long 1072467672
- .long 752012304
- .long 1072463508
- .long 3532301749
- .long 1072459298
- .long 3600563221
- .long 1072455043
- .long 3902857084
- .long 1072450742
- .long 3063101036
- .long 1072446395
- .long 3972344374
- .long 1072442001
- .long 903183549
- .long 1072437561
- .long 983892938
- .long 1072433073
- .long 2722858568
- .long 1072428537
- .long 302790515
- .long 1072423954
- .long 759811057
- .long 1072419322
- .long 2507809922
- .long 1072414641
- .long 2388408813
- .long 1072407528
- .long 2084492942
- .long 1072397870
- .long 2435703301
- .long 1072388010
- .long 1935433360
- .long 1072377945
- .long 2742047290
- .long 1072367671
- .long 2053284205
- .long 1072357185
- .long 657783367
- .long 1072346483
- .long 2893664841
- .long 1072335560
- .long 3718906405
- .long 1072324413
- .long 1547896303
- .long 1072313038
- .long 2494058440
- .long 1072301429
- .long 3133238742
- .long 1072289582
- .long 3327000086
- .long 1072277492
- .long 1860667274
- .long 1072265154
- .long 665340747
- .long 1072252562
- .long 443347841
- .long 1072239710
- .long 581282618
- .long 1072226592
- .long 3349780465
- .long 1072213201
- .long 914217606
- .long 1072199532
- .long 989797661
- .long 1072185576
- .long 945436416
- .long 1072171326
- .long 549291300
- .long 1072156774
- .long 1814636389
- .long 1072141911
- .long 239092858
- .long 1072126729
- .long 1794680724
- .long 1072111217
- .long 1241534678
- .long 1072095366
- .long 3366566214
- .long 1072079164
- .long 1244090828
- .long 1072062601
- .long 1708448120
- .long 1072045663
- .long 3544260650
- .long 1072028337
- .long 1402741403
- .long 1072010610
- .long 2551936888
- .long 1071992465
- .long 617669739
- .long 1071973887
- .long 794002186
- .long 1071954857
- .long 2021237693
- .long 1071935356
- .long 540450384
- .long 1071915364
- .long 1920555537
- .long 1071894857
- .long 2879585206
- .long 1071873811
- .long 3000237455
- .long 1071852199
- .long 3352974346
- .long 1071829991
- .long 569629937
- .long 1071807155
- .long 2077237208
- .long 1071783653
- .long 2284891805
- .long 1071759446
- .long 1226651784
- .long 1071734489
- .long 1102047405
- .long 1071708731
- .long 2009896384
- .long 1071682115
- .long 927419082
- .long 1071654577
- .long 85010366
- .long 1071607413
- .long 696431025
- .long 1071548180
- .long 2611410541
- .long 1071486585
- .long 2612593658
- .long 1071422396
- .long 3548155306
- .long 1071355336
- .long 3887997484
- .long 1071285073
- .long 244854763
- .long 1071211202
- .long 4214445648
- .long 1071133216
- .long 2303966727
- .long 1071050478
- .long 3991040013
- .long 1070962152
- .long 3126952278
- .long 1070867118
- .long 1817448378
- .long 1070763804
- .long 1793814864
- .long 1070649884
- .long 3507224072
- .long 1070447193
- .long 4027609105
- .long 1070148772
- .long 577507993
- .long 1069779414
- .long 2310232419
- .long 1068931829
- .type T_table,@object
- .size T_table,2048
- .align 16
-Tbl_addr:
- .long 3822952792
- .long 1021639372
- .long 182792448
- .long 1068507836
- .long 2264213271
- .long 1019558908
- .long 649052928
- .long 1068524253
- .long 1797139609
- .long 1022295143
- .long 1243095296
- .long 1068540671
- .long 1415938756
- .long 1021439537
- .long 2033294592
- .long 1068557090
- .long 2356809978
- .long 1021777916
- .long 3088063744
- .long 1068573510
- .long 2669055318
- .long 1022124482
- .long 180888576
- .long 1068589932
- .long 3566445325
- .long 1021358712
- .long 1970196992
- .long 1068606354
- .long 896980323
- .long 1021319659
- .long 4229555456
- .long 1068622777
- .long 436049712
- .long 1021319758
- .long 2732572160
- .long 1068639202
- .long 583123209
- .long 1020797960
- .long 1842831872
- .long 1068655628
- .long 1370449804
- .long 1021429270
- .long 1628994560
- .long 1068672055
- .long 2411391464
- .long 1021057980
- .long 2159763712
- .long 1068688483
- .long 1208692749
- .long 1021943903
- .long 3503886336
- .long 1068704912
- .long 538793309
- .long 1019744063
- .long 1435187200
- .long 1068721343
- .long 4085087612
- .long 1020608419
- .long 317469952
- .long 1068737775
- .long 144386942
- .long 1021440732
- .long 219617280
- .long 1068754208
- .long 2940088361
- .long 1019981122
- .long 1210558208
- .long 1068770642
- .long 2176850347
- .long 1018373705
- .long 3359268352
- .long 1068787077
- .long 2395611454
- .long 1021889042
- .long 2439803648
- .long 1068803514
- .long 1650705253
- .long 1020227966
- .long 2816203520
- .long 1068819952
- .long 3702166386
- .long 1019379914
- .long 262620672
- .long 1068836392
- .long 1855649370
- .long 1020453124
- .long 3438159616
- .long 1068852832
- .long 923063860
- .long 1019273834
- .long 3822105856
- .long 1068869274
- .long 4289947947
- .long 1019434249
- .long 1483729920
- .long 1068885718
- .long 787455814
- .long 1020738379
- .long 787321088
- .long 1068902163
- .long 3321653337
- .long 1021842569
- .long 1802253312
- .long 1068918609
- .long 2653633526
- .long 1021821525
- .long 302985984
- .long 1068935057
- .long 161272028
- .long 1021655149
- .long 653966080
- .long 1068951506
- .long 2566098667
- .long 1020066219
- .long 2924727296
- .long 1068967956
- .long 3646493722
- .long 1014292285
- .long 2889890304
- .long 1068984408
- .long 1081009196
- .long 1022189620
- .long 619098112
- .long 1069000862
- .long 4011643355
- .long 1021773297
- .long 477017600
- .long 1069017317
- .long 4030305534
- .long 1021292252
- .long 2533403904
- .long 1069033773
- .long 2645187591
- .long 1019527099
- .long 2563102208
- .long 1069050231
- .long 3857293792
- .long 1022311697
- .long 635982336
- .long 1069066691
- .long 3625936637
- .long 1017511744
- .long 1116940800
- .long 1069083152
- .long 3653872993
- .long 1022016631
- .long 4075964160
- .long 1069099614
- .long 2468900271
- .long 1021769532
- .long 993165568
- .long 1069116079
- .long 1358104224
- .long 1021199776
- .long 528586752
- .long 1069132545
- .long 2200950332
- .long 1022024872
- .long 2752395776
- .long 1069149012
- .long 3197072454
- .long 1017751319
- .long 3439855616
- .long 1069165481
- .long 1651081806
- .long 1020809338
- .long 2661257728
- .long 1069181952
- .long 539032752
- .long 1021728805
- .long 486957312
- .long 1069198425
- .long 3136045149
- .long 1016888671
- .long 1282340352
- .long 1069214899
- .long 2593963259
- .long 1018956103
- .long 822921728
- .long 1069231375
- .long 2146032737
- .long 1022306465
- .long 3474216192
- .long 1069247852
- .long 3976811625
- .long 1021350207
- .long 716902656
- .long 1069264332
- .long 718267222
- .long 1018624727
- .long 1211594496
- .long 1069280813
- .long 1485641389
- .long 1018447451
- .long 734070272
- .long 1069297296
- .long 354455128
- .long 1021341291
- .long 3650110720
- .long 1069313780
- .long 682185947
- .long 1021651853
- .long 1440663040
- .long 1069330267
- .long 3558574550
- .long 1021615110
- .long 2766612224
- .long 1069346755
- .long 874607978
- .long 1017746872
- .long 3404011008
- .long 1069363245
- .long 4154988502
- .long 1021439906
- .long 3423949056
- .long 1069379737
- .long 2263202309
- .long 1021479615
- .long 2897587712
- .long 1069396231
- .long 2562065031
- .long 1022090363
- .long 1896159232
- .long 1069412727
- .long 3836237663
- .long 1019867288
- .long 490968576
- .long 1069429225
- .long 3322056743
- .long 1006752762
- .long 3048360192
- .long 1069445724
- .long 1152314833
- .long 1013122252
- .long 1049850624
- .long 1069462226
- .long 3601590727
- .long 1022214610
- .long 3156899584
- .long 1069478729
- .long 1855169970
- .long 1019487271
- .long 851173376
- .long 1069495235
- .long 312649594
- .long 1020868604
- .long 2794281728
- .long 1069511742
- .long 1093490181
- .long 1020777577
- .long 468042496
- .long 1069528252
- .long 1152540679
- .long 1021403732
- .long 2534219264
- .long 1069544763
- .long 2292126035
- .long 1021872430
- .long 1376146432
- .long 1069558527
- .long 3293753641
- .long 1020500454
- .long 4175442432
- .long 1069575044
- .long 3626347564
- .long 1021610969
- .long 3523113472
- .long 1069591566
- .long 339956500
- .long 1021119039
- .long 4003350528
- .long 1069608092
- .long 3429333082
- .long 1022813542
- .long 1611067392
- .long 1069624623
- .long 2298017544
- .long 1021977587
- .long 931782144
- .long 1069641158
- .long 2164684743
- .long 1021250988
- .long 2256725504
- .long 1069657697
- .long 1138762335
- .long 1021443776
- .long 1582853120
- .long 1069674241
- .long 1084010382
- .long 1022994693
- .long 3497758720
- .long 1069690789
- .long 406366244
- .long 1022713586
- .long 3999816960
- .long 1069707342
- .long 1488723042
- .long 1023381290
- .long 3383096064
- .long 1069723900
- .long 2541558953
- .long 1019137887
- .long 1942403584
- .long 1069740463
- .long 1879620343
- .long 1022653642
- .long 4268263680
- .long 1069757030
- .long 3039077047
- .long 1022252545
- .long 2067062272
- .long 1069773603
- .long 4190670677
- .long 1020725863
- .long 4225828096
- .long 1069790180
- .long 1998567321
- .long 1022014385
- .long 2452507136
- .long 1069806763
- .long 1511628873
- .long 1021900300
- .long 1340746240
- .long 1069823351
- .long 788367341
- .long 1022726208
- .long 1190035456
- .long 1069839944
- .long 3856337230
- .long 1021834118
- .long 2300688384
- .long 1069856542
- .long 3211396579
- .long 1022621365
- .long 678886400
- .long 1069873146
- .long 4001011887
- .long 1022042646
- .long 921594112
- .long 1069889755
- .long 557811968
- .long 1023065533
- .long 3331668992
- .long 1069906369
- .long 1877060679
- .long 1022419742
- .long 3917875200
- .long 1069922989
- .long 1181055171
- .long 1022752712
- .long 2984829696
- .long 1069939615
- .long 4294526932
- .long 1021499988
- .long 838049024
- .long 1069956247
- .long 3658081878
- .long 1022957952
- .long 2078928384
- .long 1069972884
- .long 820353701
- .long 1019391107
- .long 2719854336
- .long 1069989527
- .long 1644022489
- .long 1023378240
- .long 3069117696
- .long 1070006176
- .long 2771393702
- .long 1019319954
- .long 3435962368
- .long 1070022831
- .long 3876394145
- .long 1023024433
- .long 4130595328
- .long 1070039492
- .long 1630447748
- .long 1021465882
- .long 1169236224
- .long 1070056160
- .long 2828355997
- .long 1020458120
- .long 3453997312
- .long 1070072833
- .long 164091641
- .long 1020388279
- .long 2708127744
- .long 1070089513
- .long 3036550223
- .long 1023328684
- .long 3540797696
- .long 1070106199
- .long 3710949463
- .long 1022568805
- .long 1972276736
- .long 1070122892
- .long 3885277950
- .long 1019761674
- .long 2613815552
- .long 1070139591
- .long 2764165077
- .long 1022921023
- .long 1487791616
- .long 1070156297
- .long 1330644769
- .long 1023162679
- .long 3207593472
- .long 1070173009
- .long 3911007221
- .long 1022993496
- .long 3797764608
- .long 1070189728
- .long 979712598
- .long 1022554580
- .long 3578920448
- .long 1070206454
- .long 2825738223
- .long 1020223708
- .long 2872795648
- .long 1070223187
- .long 392451124
- .long 1022666279
- .long 2002258432
- .long 1070239927
- .long 3730407632
- .long 1023148291
- .long 1291326464
- .long 1070256674
- .long 3723802980
- .long 1022514089
- .long 1065180928
- .long 1070273428
- .long 2635617463
- .long 1022654470
- .long 1650181632
- .long 1070290189
- .long 2061982883
- .long 1022853411
- .long 3373882880
- .long 1070306957
- .long 319732785
- .long 1022017175
- .long 2270081280
- .long 1070323733
- .long 2237757411
- .long 1023064087
- .long 2963732736
- .long 1070340516
- .long 468839165
- .long 1023293774
- .long 1491099904
- .long 1070357307
- .long 1502657946
- .long 1021533479
- .long 2479636480
- .long 1070374105
- .long 482913562
- .long 1021986286
- .long 1968133632
- .long 1070390911
- .long 3281474337
- .long 1022646400
- .long 291639040
- .long 1070407725
- .long 2453320259
- .long 1022812423
- .long 2081472512
- .long 1070424546
- .long 2939989570
- .long 1023091888
- .long 3380340480
- .long 1070441375
- .long 2850707499
- .long 1021921109
- .long 232287488
- .long 1070458213
- .long 3674625342
- .long 1020725130
- .long 1567614208
- .long 1070475058
- .long 9347334
- .long 1022024009
- .long 3433091072
- .long 1070491911
- .long 282524999
- .long 1021433523
- .long 1876877312
- .long 1070508773
- .long 3470449440
- .long 1019309721
- .long 1538472192
- .long 1070525643
- .long 2089486825
- .long 1019698916
- .long 2763830784
- .long 1070542521
- .long 443498115
- .long 1020505194
- .long 1605381632
- .long 1070559408
- .long 3018871601
- .long 1022869913
- .long 2706946048
- .long 1070576303
- .long 3936260892
- .long 1023175875
- .long 2123887360
- .long 1070593207
- .long 2994220655
- .long 1022825948
- .long 104015104
- .long 1070603108
- .long 335054493
- .long 1023441853
- .long 2904568832
- .long 1070615800
- .long 1451215633
- .long 1023853857
- .long 3456197120
- .long 1070632739
- .long 436334733
- .long 1024026432
- .long 252452352
- .long 1070649697
- .long 34596167
- .long 1024031396
- .long 3328018432
- .long 1070666672
- .long 2644547073
- .long 1024296758
- .long 1255829248
- .long 1070683667
- .long 552832586
- .long 1023763122
- .long 4097058560
- .long 1070700680
- .long 1955640623
- .long 1021394654
- .long 451770112
- .long 1070717714
- .long 3428903777
- .long 1022941142
- .long 408920832
- .long 1070734767
- .long 165503263
- .long 1023894958
- .long 1186960640
- .long 1070751840
- .long 435826450
- .long 1024026134
- .long 19078656
- .long 1070768934
- .long 1834169749
- .long 1022899284
- .long 2743490304
- .long 1070786048
- .long 494581074
- .long 1018818479
- .long 2328961024
- .long 1070803184
- .long 2987908834
- .long 1022581110
- .long 350011392
- .long 1070820342
- .long 240771184
- .long 1024143083
- .long 2692326912
- .long 1070837521
- .long 666056837
- .long 1022394776
- .long 2373274368
- .long 1070854723
- .long 2484337770
- .long 1024228156
- .long 1017131520
- .long 1070871948
- .long 3285648279
- .long 1024025789
- .long 265558272
- .long 1070889196
- .long 392241896
- .long 1024252809
- .long 1778008064
- .long 1070906467
- .long 1536107943
- .long 1023949300
- .long 2937184768
- .long 1070923762
- .long 3541062251
- .long 1019448646
- .long 1144442880
- .long 1070941082
- .long 3691683781
- .long 1022123948
- .long 2410165504
- .long 1070958426
- .long 1804181960
- .long 1023945221
- .long 4174350848
- .long 1070975795
- .long 2016094861
- .long 1021716585
- .long 3897012480
- .long 1070993190
- .long 175294410
- .long 1023703404
- .long 3353623040
- .long 1071010611
- .long 167973242
- .long 1023240839
- .long 45671168
- .long 1071028059
- .long 2166856113
- .long 1021565413
- .long 86063872
- .long 1071045533
- .long 2676254727
- .long 1023985299
- .long 1019772672
- .long 1071063034
- .long 989043593
- .long 1021549587
- .long 414297344
- .long 1071080563
- .long 3960972046
- .long 1024307251
- .long 155173120
- .long 1071098120
- .long 1830919291
- .long 1021592251
- .long 2151562240
- .long 1071115705
- .long 405408666
- .long 1023423128
- .long 4041854720
- .long 1071133319
- .long 2043497827
- .long 1024411503
- .long 3489224192
- .long 1071150963
- .long 3072215864
- .long 1022698635
- .long 2477196288
- .long 1071168637
- .long 1812195139
- .long 1022689192
- .long 3015298816
- .long 1071186341
- .long 764841969
- .long 1021027331
- .long 2844731136
- .long 1071204076
- .long 2878117321
- .long 1019116513
- .long 4028950528
- .long 1071221842
- .long 698911452
- .long 1023265602
- .long 69441536
- .long 1071239641
- .long 3253467847
- .long 1020795075
- .long 1676209920
- .long 1071257471
- .long 4272431167
- .long 1022873982
- .long 2408752384
- .long 1071275334
- .long 648519100
- .long 1024385717
- .long 151623680
- .long 1071293231
- .long 345257017
- .long 1019561408
- .long 1410154240
- .long 1071311161
- .long 197863993
- .long 1023224207
- .long 4131351552
- .long 1071329125
- .long 2620801789
- .long 1024411169
- .long 1999664384
- .long 1071347125
- .long 3952692616
- .long 1024168086
- .long 1617668864
- .long 1071365160
- .long 3019889809
- .long 1021907692
- .long 1032074240
- .long 1071383231
- .long 59469899
- .long 1023656194
- .long 2619492096
- .long 1071401338
- .long 1417526820
- .long 1021457783
- .long 202429440
- .long 1071419483
- .long 2927667935
- .long 1019175447
- .long 525044224
- .long 1071437665
- .long 38166811
- .long 1023981879
- .long 1779258880
- .long 1071455885
- .long 481252500
- .long 1023310234
- .long 2195673600
- .long 1071474144
- .long 3962395981
- .long 1021339088
- .long 44573696
- .long 1071492443
- .long 3936281395
- .long 1023014829
- .long 2226905344
- .long 1071510781
- .long 1515320476
- .long 1024320623
- .long 2800512512
- .long 1071529160
- .long 1225403697
- .long 1021081846
- .long 161113600
- .long 1071547581
- .long 3064809733
- .long 1024173917
- .long 1338410240
- .long 1071566043
- .long 2027604973
- .long 1024362526
- .long 522433280
- .long 1071584548
- .long 2055171723
- .long 1023858825
- .long 539595776
- .long 1071603096
- .long 3868820135
- .long 1022936424
- .long 4264017664
- .long 1071621687
- .long 3228065145
- .long 1023479578
- .long 1733924096
- .long 1071640324
- .long 3511934475
- .long 1022496355
- .long 108880384
- .long 1071651839
- .long 615880967
- .long 1023519706
- .long 3517856512
- .long 1071661202
- .long 3113108559
- .long 1025190289
- .long 4043153152
- .long 1071670589
- .long 1571836218
- .long 1023106116
- .long 3251299072
- .long 1071680000
- .long 3444076102
- .long 1022187841
- .long 2736921600
- .long 1071689435
- .long 272771483
- .long 1025095280
- .long 3897698560
- .long 1071703633
- .long 2075390188
- .long 1022489022
- .long 3209485056
- .long 1071722652
- .long 1438094065
- .long 1021844944
- .long 3781432064
- .long 1071741774
- .long 1675017145
- .long 1024143828
- .long 2684184064
- .long 1071761003
- .long 2259963753
- .long 1024731393
- .long 1840489728
- .long 1071780342
- .long 3372883597
- .long 1023431408
- .long 3764087808
- .long 1071799794
- .long 3307523102
- .long 1024485788
- .long 3006232320
- .long 1071819364
- .long 3088971966
- .long 1025213251
- .long 3374881280
- .long 1071839055
- .long 834437749
- .long 1025236452
- .long 797284864
- .long 1071858872
- .long 3122663941
- .long 1025320473
- .long 545765120
- .long 1071878818
- .long 826539625
- .long 1022450955
- .long 107562240
- .long 1071898898
- .long 339584600
- .long 1022481255
- .long 2123649024
- .long 1071919116
- .long 3912959833
- .long 1024321009
- .long 1562385664
- .long 1071939478
- .long 2846067230
- .long 1023343981
- .long 2963085824
- .long 1071959988
- .long 954548627
- .long 1021475211
- .long 3325550592
- .long 1071980652
- .long 3459651155
- .long 1025305573
- .long 775752448
- .long 1072001476
- .long 3582746667
- .long 1023859460
- .long 3238590720
- .long 1072022464
- .long 634636162
- .long 1024472353
- .long 2758801920
- .long 1072043624
- .long 3078216319
- .long 1025304516
- .long 1370319104
- .long 1072064962
- .long 2570569078
- .long 1025099442
- .long 2615805184
- .long 1072086484
- .long 3729933412
- .long 1024605112
- .long 3077336576
- .long 1072108198
- .long 1948916066
- .long 1024781603
- .long 1099528192
- .long 1072130112
- .long 3139143157
- .long 1023729360
- .long 1231903232
- .long 1072152233
- .long 1349513477
- .long 1024737515
- .long 1507504128
- .long 1072174570
- .long 3484516322
- .long 1024000959
- .long 2214659840
- .long 1072197132
- .long 2563820917
- .long 1025225535
- .long 1804739840
- .long 1072219929
- .long 760038746
- .long 1024482855
- .long 1413746688
- .long 1072242971
- .long 3401734714
- .long 1025129838
- .long 821409536
- .long 1072266269
- .long 3729772551
- .long 1025484796
- .long 3031825664
- .long 1072289834
- .long 122256749
- .long 1024752594
- .long 1710784256
- .long 1072313680
- .long 1518205483
- .long 1024724809
- .long 3025265152
- .long 1072337819
- .long 409951989
- .long 1022835555
- .long 287769088
- .long 1072362267
- .long 800355594
- .long 1022484850
- .long 198179840
- .long 1072387038
- .long 3502926213
- .long 1024209373
- .long 1909130496
- .long 1072412149
- .long 3064694319
- .long 1025380823
- .long 1941732096
- .long 1072437619
- .long 4112930390
- .long 1024294679
- .long 3492010496
- .long 1072463467
- .long 2684918107
- .long 1023220233
- .long 81959680
- .long 1072489716
- .long 220021366
- .long 1020635131
- .long 2297837056
- .long 1072516387
- .long 4027683826
- .long 1021041185
- .long 270404096
- .long 1072543508
- .long 2012766065
- .long 1021780753
- .long 3667376896
- .long 1072571105
- .long 2727981522
- .long 1023009874
- .long 330400256
- .long 1072599212
- .long 2940017003
- .long 1025393439
- .long 1119293952
- .long 1072627861
- .long 1608550416
- .long 1022675612
- .long 3536155904
- .long 1072657091
- .long 349665778
- .long 1025156751
- .long 3078046720
- .long 1072686946
- .long 2016159996
- .long 1022193169
- .long 455228416
- .long 1072705361
- .long 1908539328
- .long 1026126332
- .long 1871505664
- .long 1072720988
- .long 2784700894
- .long 1025922277
- .long 1630994432
- .long 1072737010
- .long 361107678
- .long 1022887244
- .long 2084558336
- .long 1072753462
- .type Tbl_addr,@object
- .size Tbl_addr,3840
- .space 768, 0x00 # pad
- .align 16
-SIGNMASK:
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .type SIGNMASK,@object
- .size SIGNMASK,16
- .align 16
-HALFMASK2:
- .long 0
- .long 2147483584
- .long 0
- .long 0
- .type HALFMASK2,@object
- .size HALFMASK2,16
- .align 16
-PI_BY_2:
- .long 856972295
- .long 1016178214
- .long 1413754136
- .long 1073291771
- .type PI_BY_2,@object
- .size PI_BY_2,16
- .align 16
-cv2:
- .long 780903145
- .long 1066854586
- .long 858993459
- .long 1068708659
- .long 3340530119
- .long 1067392113
- .long 1431655765
- .long 1069897045
- .long 1321528399
- .long 1066517740
- .long 3067833783
- .long 1067899757
- .long 2021159460
- .long 1065855096
- .long 2576980378
- .long 1066178969
- .type cv2,@object
- .size cv2,64
- .align 16
-HALFMASK:
- .long 4160749568
- .long 4294967295
- .long 4160749568
- .long 4294967295
- .type HALFMASK,@object
- .size HALFMASK,16
- .align 4
-ONEMASK:
- .long 0
- .long 1072693248
- .type ONEMASK,@object
- .size ONEMASK,8
- .align 4
-TMASK:
- .long 0
- .long 4294950912
- .type TMASK,@object
- .size TMASK,8
- .align 4
-cv:
- .long 1431655765
- .long 1069897045
- .long 858993459
- .long 1068708659
- .long 3067833783
- .long 1067899757
- .type cv,@object
- .size cv,24
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_asin.1-.
- .4byte ..___tag_value_asin.5-..___tag_value_asin.1
- .2byte 0x0400
- .4byte ..___tag_value_asin.3-..___tag_value_asin.1
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_asin.4-..___tag_value_asin.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/e_atan2.S b/libm/x86_64/e_atan2.S
deleted file mode 100644
index f0ba43c..0000000
--- a/libm/x86_64/e_atan2.S
+++ /dev/null
@@ -1,1242 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-//
-//1. The method is based on the relationship of atan2(Y,X) to atan(|Y/X|)
-// as follows.
-// / sign(Y) atan(|Y/X|) if X > 0
-// atan2(Y,X) =
-// \ sign(Y)*pi - sign(Y)*atan(|Y/X|) if X < 0
-//
-// Thus, atan2(Y,X) is of the form atan2(Y,X) = PI + sgn*atan(|Y/X|)
-// where PI and sgn can be determined by the four possible combinations of
-// of the pair (sign(X),sign(Y)). We concentrate on the numerical method
-// for atan(|Y/X|).
-//
-//2. For |Y/X| < 2^(-64), atan(|Y/X|) ~=~ |Y/X|. Hence, atan2(Y,X) is Y/X
-// if X > 0, and sign(Y)*pi otherwise.
-//3. For |Y/X| >= 2^(65), atan(|Y/X|) ~=~ pi/2. Hence atan2(Y,X) is sign(Y)pi/2.
-//4. For 2^(-64) <= |Y/X| < 2^(-5), atan(|Y/X|) is approximated by a polynomial
-// of the form Z + Z*E*polynomial(E), where Z = |Y/X| and E = Z*Z.
-//5. For |Y/X| > 2^(5), atan(|Y/X|) = pi/2 + atan(-|X/Y|), and atan(-|X/Y|) is
-// calculated using the polynomial in 4 above.
-//6. For 2^(-5) <= |Y/X| <= 2^(5), we employ a table lookup method. First,
-// we obtain B = 2^k * 1.b1 b2 b3 b4 = 2^k * (1+k/16) that approximate
-// |Y/X| to approximately 5 significant bits. Hence, atan(|Y/X|) is
-//
-// atan(|Y/X|) = atan(B) + atan(Z), where Z = (|Y|-B|X|)/(|X|+B|Y|).
-// ~=~ tau + Z + Z*E*polynomial(E), where E = Z*Z.
-//
-// B has the range from 2^(-6)*(1+14/16) to 2^5 = 2^(5)*(1+0/16), totally
-// 163 possible values. These values are calculated beforehand and stored
-// in a table. The polynomial is the one used in 4.
-//
-// Special cases:
-// atan2(+-0, +0) = +-0
-// atan2(+-0, -0) = +-pi
-// atan2(+-0, x) = +-0, for x > 0, and +-pi, for x < 0
-// atan2(y, +-0) = +pi/2 for y > 0, and -pi/2 for y < 0
-// atan2(+-y, +INF) = +-0, for finite y > 0
-// atan2(+-y, -INF) = +-pi, for finite y > 0
-// atan2(+-INF, x) = +-pi/2, for finite x
-// atan2(+-INF, +INF) = +-pi/4
-// atan2(+-INF, -INF) = +-3*pi/4
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin atan2
-ENTRY(atan2)
-# parameter 1: %xmm0
-# parameter 2: %xmm1
-..B1.1:
-..___tag_value_atan2.1:
- subq $24, %rsp
-..___tag_value_atan2.3:
- movsd %xmm0, (%rsp)
- movsd %xmm1, 8(%rsp)
-..B1.2:
- pextrw $3, %xmm0, %eax
- andl $32752, %eax
- subl $14448, %eax
- cmpl $3840, %eax
- ja .L_2TAG_PACKET_0.0.2
- pextrw $3, %xmm1, %eax
- andl $32752, %eax
- subl $14448, %eax
- cmpl $3840, %eax
- ja .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- unpcklpd %xmm1, %xmm0
- xorpd %xmm5, %xmm5
- xorpd %xmm3, %xmm3
- movl $2048, %eax
- pinsrw $3, %eax, %xmm5
- paddw %xmm1, %xmm5
- psrlq $29, %xmm5
- rcpss %xmm5, %xmm3
- xorpd %xmm4, %xmm4
- movl $14336, %ecx
- pinsrw $3, %ecx, %xmm4
- psllq $29, %xmm3
- paddw %xmm4, %xmm3
- mulsd %xmm0, %xmm3
- xorpd %xmm2, %xmm2
- xorpd %xmm6, %xmm6
- xorpd %xmm7, %xmm7
- movl $32768, %eax
- pinsrw $2, %eax, %xmm6
- movl $32767, %ecx
- pinsrw $3, %ecx, %xmm7
- paddd %xmm6, %xmm3
- andpd %xmm7, %xmm3
- movq %xmm3, %xmm5
- pextrw $3, %xmm3, %eax
- movl $16448, %ecx
- pinsrw $3, %ecx, %xmm2
- minsd %xmm2, %xmm3
- movmskpd %xmm0, %edx
- psllq $1, %xmm0
- psrlq $1, %xmm0
- cmpsd $2, %xmm2, %xmm5
- psllq $1, %xmm1
- psrlq $1, %xmm1
- movq %xmm1, %xmm6
- movq %xmm1, %xmm7
- movq %xmm0, %xmm2
- movl $0, %ecx
- pinsrw $0, %ecx, %xmm6
- subsd %xmm6, %xmm7
- movq %xmm0, %xmm4
- mulsd %xmm3, %xmm6
- mulsd %xmm3, %xmm4
- mulsd %xmm3, %xmm7
- andpd %xmm5, %xmm0
- subsd %xmm6, %xmm0
- andpd %xmm5, %xmm1
- addsd %xmm1, %xmm4
- subsd %xmm7, %xmm0
- andl $32752, %eax
- subl $16286, %eax
- cmpl $1121, %eax
- ja .L_2TAG_PACKET_3.0.2
- divsd %xmm4, %xmm0
- pextrw $3, %xmm3, %ecx
- movsd a2(%rip), %xmm2
- movsd b2(%rip), %xmm3
- pextrw $0, %xmm5, %eax
- addl %edx, %edx
- lea P_TBL(%rip), %r8
- movapd (%r8,%rdx,8), %xmm6
- lea SGN_TBL(%rip), %r8
- movapd (%r8,%rdx,8), %xmm1
- subl $16286, %ecx
- notl %eax
- andl $1, %eax
- addl %eax, %ecx
- addl %ecx, %ecx
- lea ATAN_TBL(%rip), %r8
- movapd (%r8,%rcx,8), %xmm5
- xorpd %xmm1, %xmm5
- addpd %xmm6, %xmm5
- movq %xmm5, %xmm6
- unpckhpd %xmm5, %xmm5
- xorpd %xmm0, %xmm1
- movq %xmm1, %xmm4
- mulsd %xmm0, %xmm0
- mulsd %xmm0, %xmm2
- addsd %xmm0, %xmm3
- addsd %xmm6, %xmm1
- subsd %xmm1, %xmm6
- addsd %xmm4, %xmm6
- addsd 8+a2(%rip), %xmm2
- mulsd %xmm0, %xmm3
- mulsd %xmm4, %xmm0
- addsd %xmm5, %xmm6
- mulsd %xmm2, %xmm0
- addsd 8+b2(%rip), %xmm3
- mulsd %xmm3, %xmm0
- addsd %xmm6, %xmm0
- addsd %xmm1, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_3.0.2:
- addl $942, %eax
- cmpl $942, %eax
- ja .L_2TAG_PACKET_4.0.2
- xorpd %xmm4, %xmm4
- movl $16368, %ecx
- pinsrw $3, %ecx, %xmm4
- divsd %xmm1, %xmm4
- addl %edx, %edx
- lea SGN_TBL(%rip), %r8
- movapd (%r8,%rdx,8), %xmm6
- unpcklpd %xmm3, %xmm3
- xorpd %xmm6, %xmm0
- xorpd %xmm6, %xmm2
- xorpd %xmm6, %xmm3
- lea P_TBL2(%rip), %r8
- movapd (%r8,%rdx,8), %xmm7
- movsd a2(%rip), %xmm1
- movsd b2(%rip), %xmm5
- lea SELECT_B(%rip), %r8
- andpd (%r8,%rdx,8), %xmm3
- mulsd %xmm4, %xmm2
- mulsd %xmm4, %xmm0
- movq %xmm2, %xmm6
- mulsd %xmm2, %xmm2
- mulsd %xmm2, %xmm1
- addsd %xmm2, %xmm5
- mulsd %xmm2, %xmm6
- addsd 8+a2(%rip), %xmm1
- mulsd %xmm2, %xmm5
- addsd %xmm0, %xmm7
- addpd %xmm3, %xmm7
- mulsd %xmm6, %xmm1
- addsd 8+b2(%rip), %xmm5
- mulsd %xmm1, %xmm5
- addsd %xmm7, %xmm5
- pshufd $238, %xmm7, %xmm0
- addsd %xmm5, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_4.0.2:
- movsd 8(%rsp), %xmm1
- movsd (%rsp), %xmm0
- pextrw $3, %xmm1, %eax
- andl $32752, %eax
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- cmpl %eax, %ecx
- jg .L_2TAG_PACKET_5.0.2
- pextrw $3, %xmm1, %ecx
- cmpl $32767, %ecx
- jg .L_2TAG_PACKET_6.0.2
- divsd %xmm1, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_6.0.2:
- andpd SGNMASK(%rip), %xmm0
- movsd pi_table(%rip), %xmm2
- xorpd %xmm2, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_5.0.2:
- andpd SGNMASK(%rip), %xmm0
- movsd pi2_table(%rip), %xmm2
- xorpd %xmm2, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_0.0.2:
-.L_2TAG_PACKET_1.0.2:
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- pextrw $3, %xmm1, %eax
- andl $32752, %eax
- cmpl $32752, %ecx
- je .L_2TAG_PACKET_7.0.2
- cmpl $32752, %eax
- je .L_2TAG_PACKET_8.0.2
- movsd POW55(%rip), %xmm3
- movl $1024, %edx
- movsd INVEXPMASK(%rip), %xmm4
- xorpd %xmm6, %xmm6
- movsd EXPMASK(%rip), %xmm7
- cmpl $0, %ecx
- je .L_2TAG_PACKET_9.0.2
-.L_2TAG_PACKET_10.0.2:
- cmpl $0, %eax
- je .L_2TAG_PACKET_11.0.2
-.L_2TAG_PACKET_12.0.2:
- addl %ecx, %edx
- subl %eax, %edx
- cmpl $2048, %edx
- ja .L_2TAG_PACKET_4.0.2
- addl $15344, %edx
- pinsrw $3, %edx, %xmm6
- andpd %xmm4, %xmm0
- andpd %xmm4, %xmm1
- orpd %xmm6, %xmm0
- orpd %xmm7, %xmm1
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_9.0.2:
- subl $880, %edx
- mulsd %xmm3, %xmm0
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- cmpl $0, %ecx
- je .L_2TAG_PACKET_13.0.2
- jmp .L_2TAG_PACKET_10.0.2
-.L_2TAG_PACKET_11.0.2:
- addl $880, %edx
- mulsd %xmm3, %xmm1
- pextrw $3, %xmm1, %eax
- andl $32752, %eax
- cmpl $0, %eax
- je .L_2TAG_PACKET_14.0.2
- jmp .L_2TAG_PACKET_12.0.2
-.L_2TAG_PACKET_7.0.2:
- movd %xmm0, %edx
- movq %xmm0, %xmm2
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- andl $1048575, %ecx
- orl %edx, %ecx
- cmpl $0, %ecx
- jne .L_2TAG_PACKET_15.0.2
- psrlq $63, %xmm0
- psllq $63, %xmm0
- cmpl $32752, %eax
- jae .L_2TAG_PACKET_16.0.2
- movapd pi2_table(%rip), %xmm5
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- orpd %xmm5, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_15.0.2:
- addsd %xmm0, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_16.0.2:
- movd %xmm1, %eax
- movq %xmm1, %xmm2
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- movl $-2147483648, %edx
- andl %ecx, %edx
- andl $1048575, %ecx
- orl %eax, %ecx
- cmpl $0, %ecx
- jne .L_2TAG_PACKET_17.0.2
- cmpl $0, %edx
- jne .L_2TAG_PACKET_18.0.2
- movapd pi4_table(%rip), %xmm5
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- orpd %xmm5, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_17.0.2:
- movq %xmm1, %xmm0
- addsd %xmm0, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_18.0.2:
- movapd pi4_table(%rip), %xmm5
- movapd pi2_table(%rip), %xmm6
- addpd %xmm6, %xmm5
- pshufd $238, %xmm5, %xmm6
- addpd %xmm6, %xmm5
- orpd %xmm5, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_8.0.2:
- movd %xmm1, %eax
- movq %xmm1, %xmm2
- psrlq $32, %xmm2
- movd %xmm2, %ecx
- movl $-2147483648, %edx
- andl %ecx, %edx
- andl $1048575, %ecx
- orl %eax, %ecx
- cmpl $0, %ecx
- jne .L_2TAG_PACKET_17.0.2
- psrlq $63, %xmm0
- psllq $63, %xmm0
- cmpl $0, %edx
- jne .L_2TAG_PACKET_19.0.2
- jmp ..B1.5
-.L_2TAG_PACKET_19.0.2:
- movapd pi_table(%rip), %xmm5
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- orpd %xmm5, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_13.0.2:
- pextrw $3, %xmm1, %edx
- andl $32768, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_20.0.2
- movapd pi_table(%rip), %xmm5
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- comisd %xmm0, %xmm1
- orpd %xmm5, %xmm0
- je .L_2TAG_PACKET_21.0.2
- jmp ..B1.5
-.L_2TAG_PACKET_20.0.2:
- comisd %xmm0, %xmm1
- je .L_2TAG_PACKET_21.0.2
- jmp ..B1.5
-.L_2TAG_PACKET_14.0.2:
- movapd pi2_table(%rip), %xmm5
- psrlq $63, %xmm0
- psllq $63, %xmm0
- pshufd $238, %xmm5, %xmm4
- addsd %xmm4, %xmm5
- orpd %xmm5, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_21.0.2:
- movq %xmm0, 16(%rsp)
-..B1.3:
- movq 16(%rsp), %xmm0
-.L_2TAG_PACKET_22.0.2:
-..B1.5:
- addq $24, %rsp
-..___tag_value_atan2.4:
- ret
-..___tag_value_atan2.5:
-END(atan2)
-# -- End atan2
- .section .rodata, "a"
- .align 16
- .align 16
-a2:
- .long 2006262985
- .long 1069310863
- .long 2358449471
- .long 3217342131
- .type a2,@object
- .size a2,16
- .align 16
-b2:
- .long 3845454352
- .long 1069952297
- .long 2829679149
- .long 1073771565
- .type b2,@object
- .size b2,16
- .align 16
-P_TBL:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1413754136
- .long 1074340347
- .long 856972295
- .long 1017226790
- .long 1413754136
- .long 3221823995
- .long 856972295
- .long 3164710438
- .type P_TBL,@object
- .size P_TBL,64
- .align 16
-SGN_TBL:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .long 0
- .long 0
- .long 0
- .long 0
- .type SGN_TBL,@object
- .size SGN_TBL,64
- .align 16
-ATAN_TBL:
- .long 3390881280
- .long 1067318733
- .long 1411116779
- .long 1018950063
- .long 2985987840
- .long 1067384211
- .long 2088903695
- .long 1018086027
- .long 3148445184
- .long 1067449685
- .long 2044163806
- .long 1017271335
- .long 3667629184
- .long 1067515494
- .long 2353092775
- .long 1019967309
- .long 1546568832
- .long 1067580954
- .long 611991315
- .long 1017602584
- .long 3815996800
- .long 1067646404
- .long 466038598
- .long 1019686426
- .long 4050241920
- .long 1067711845
- .long 3265026328
- .long 1019626952
- .long 120454912
- .long 1067777277
- .long 1542207696
- .long 1020155608
- .long 2784639744
- .long 1067842697
- .long 3883834623
- .long 1018602870
- .long 1328010624
- .long 1067908107
- .long 1791097456
- .long 1019053126
- .long 2217794048
- .long 1067973505
- .long 551619938
- .long 1018494194
- .long 3333520000
- .long 1068038891
- .long 2390331823
- .long 1019033022
- .long 2557052032
- .long 1068104265
- .long 2423976108
- .long 1019728674
- .long 2067649536
- .long 1068169626
- .long 3757397745
- .long 1018672362
- .long 4047094784
- .long 1068234973
- .long 481613184
- .long 1019275104
- .long 2089853184
- .long 1068300307
- .long 1733914374
- .long 1020124677
- .long 2678003840
- .long 1068365626
- .long 1373600282
- .long 1013935474
- .long 3706496128
- .long 1068430930
- .long 1000610902
- .long 1019673285
- .long 3073179008
- .long 1068496219
- .long 1497143008
- .long 1019900342
- .long 2803716736
- .long 1068562846
- .long 1476677416
- .long 1019444094
- .long 3204984128
- .long 1068628077
- .long 1192335905
- .long 1018748628
- .long 831146624
- .long 1068693273
- .long 2733586224
- .long 1018823295
- .long 243029376
- .long 1068758431
- .long 950106081
- .long 1019046675
- .long 1735561920
- .long 1068823549
- .long 3546440856
- .long 1020104712
- .long 1339217792
- .long 1068888626
- .long 3028812387
- .long 1019818321
- .long 3706342144
- .long 1068953659
- .long 3814564029
- .long 1017763871
- .long 637726976
- .long 1069018648
- .long 3584007699
- .long 1017976868
- .long 1148779264
- .long 1069083589
- .long 2282532133
- .long 1019483954
- .long 1406131392
- .long 1069148481
- .long 1547359113
- .long 1019786342
- .long 1908875904
- .long 1069213322
- .long 1315508410
- .long 1020009473
- .long 3194947520
- .long 1069278110
- .long 3845393201
- .long 1015803761
- .long 1547487744
- .long 1069342844
- .long 3863107865
- .long 1019810104
- .long 1881061952
- .long 1069407521
- .long 4288343548
- .long 1019687581
- .long 563086336
- .long 1069472140
- .long 2582230241
- .long 1020099350
- .long 2594975552
- .long 1069536698
- .long 2306443764
- .long 1019667244
- .long 3438545024
- .long 1069606573
- .long 957455549
- .long 1015587735
- .long 4211357472
- .long 1069670906
- .long 2611778754
- .long 1017877214
- .long 3002835424
- .long 1069735101
- .long 235580458
- .long 1020211685
- .long 3905315424
- .long 1069799150
- .long 3630647617
- .long 1018736849
- .long 2849656576
- .long 1069863047
- .long 2412165062
- .long 1019693004
- .long 507429472
- .long 1069926785
- .long 1397750723
- .long 1018412717
- .long 2307470272
- .long 1069990356
- .long 1796470904
- .long 1019796181
- .long 1271814912
- .long 1070053755
- .long 189761565
- .long 1016149115
- .long 3800538144
- .long 1070116974
- .long 2524871582
- .long 1018263353
- .long 3916203552
- .long 1070180008
- .long 127848658
- .long 1017672664
- .long 457192032
- .long 1070242851
- .long 4020400938
- .long 1019823010
- .long 1385324704
- .long 1070305495
- .long 564511179
- .long 1016079094
- .long 2322869856
- .long 1070367935
- .long 2347103319
- .long 1018927760
- .long 3743438624
- .long 1070430165
- .long 877973862
- .long 1019638162
- .long 2392255552
- .long 1070492180
- .long 2432782267
- .long 1018872629
- .long 4180443328
- .long 1070553973
- .long 3102990015
- .long 1020093101
- .long 2547540832
- .long 1070636485
- .long 3877738253
- .long 1017300424
- .long 2735468912
- .long 1070697461
- .long 2446470256
- .long 1019235378
- .long 542633792
- .long 1070757943
- .long 583606328
- .long 1018624131
- .long 923265984
- .long 1070817911
- .long 1793926708
- .long 1019714161
- .long 918728448
- .long 1070877348
- .long 3726463586
- .long 1019433296
- .long 2572275008
- .long 1070936237
- .long 1845354238
- .long 1019459238
- .long 50974688
- .long 1070994564
- .long 983808064
- .long 1016685418
- .long 1105518320
- .long 1071052313
- .long 2357496692
- .long 1015139882
- .long 1264825328
- .long 1071109472
- .long 2244129354
- .long 1019046344
- .long 961157920
- .long 1071166029
- .long 3124185339
- .long 1018541776
- .long 1162701584
- .long 1071221973
- .long 1279780948
- .long 1019268918
- .long 3284935664
- .long 1071277294
- .long 2670033472
- .long 1019833744
- .long 497441888
- .long 1071331985
- .long 1032737410
- .long 1019795212
- .long 3377383904
- .long 1071386036
- .long 2356897182
- .long 1020205553
- .long 1126962000
- .long 1071439443
- .long 3723724586
- .long 1015212418
- .long 90291008
- .long 1071492199
- .long 4178672431
- .long 1020186971
- .long 190059536
- .long 1071595741
- .long 1763589807
- .long 1019162163
- .long 2497392840
- .long 1071670654
- .long 3036997041
- .long 1020204325
- .long 2616971944
- .long 1071719773
- .long 300151069
- .long 1017041957
- .long 2883518128
- .long 1071767563
- .long 2203981414
- .long 1019190108
- .long 1496354352
- .long 1071814030
- .long 332287966
- .long 1016846435
- .long 483276728
- .long 1071859184
- .long 653845024
- .long 1018830914
- .long 3097401072
- .long 1071903039
- .long 1514746408
- .long 1019278972
- .long 2737217248
- .long 1071945615
- .long 1358845067
- .long 1017268275
- .long 2072577560
- .long 1071986933
- .long 3041024735
- .long 1019929672
- .long 2266405656
- .long 1072027017
- .long 1271261130
- .long 1012925070
- .long 958652544
- .long 1072065894
- .long 2158017058
- .long 1019955372
- .long 3312993840
- .long 1072103591
- .long 765809169
- .long 1019114443
- .long 3177001304
- .long 1072140139
- .long 144180084
- .long 1019822186
- .long 3071642184
- .long 1072175568
- .long 4004602424
- .long 1019420740
- .long 4283953648
- .long 1072209909
- .long 1511950430
- .long 1020176966
- .long 1413754136
- .long 1072243195
- .long 856972295
- .long 1015129638
- .long 4073202944
- .long 1072306725
- .long 4068194804
- .long 1019714860
- .long 946117760
- .long 1072366415
- .long 694980733
- .long 1020150135
- .long 3980632032
- .long 1072422512
- .long 1313251280
- .long 1019948709
- .long 1468297112
- .long 1072475260
- .long 330111143
- .long 1019809198
- .long 3478063816
- .long 1072524887
- .long 2930067044
- .long 1017784081
- .long 1153979856
- .long 1072571613
- .long 2225786102
- .long 1017634481
- .long 2089828808
- .long 1072615641
- .long 474621367
- .long 1017043414
- .long 3531732632
- .long 1072657163
- .long 2276396220
- .long 1018757240
- .long 775214612
- .long 1072694803
- .long 3209744818
- .long 1019963015
- .long 662307284
- .long 1072713319
- .long 1381696763
- .long 1019763781
- .long 1192776652
- .long 1072730830
- .long 3017932994
- .long 1015179769
- .long 744202396
- .long 1072747407
- .long 2073854034
- .long 1019512292
- .long 8337908
- .long 1072763115
- .long 16004448
- .long 1019599514
- .long 3589868768
- .long 1072778013
- .long 1374369804
- .long 1018019237
- .long 121647320
- .long 1072792159
- .long 128481634
- .long 1018115438
- .long 2464923204
- .long 1072805601
- .long 1787331214
- .long 1016798022
- .long 4093304372
- .long 1072830562
- .long 3306868969
- .long 1019384078
- .long 1436891684
- .long 1072853231
- .long 676347266
- .long 1017302183
- .long 1104571840
- .long 1072873890
- .long 2870400285
- .long 1019938149
- .long 2037009832
- .long 1072892781
- .long 2956702105
- .long 1016472908
- .long 3139037960
- .long 1072910111
- .long 916057147
- .long 1018364335
- .long 1826698064
- .long 1072926058
- .long 2171961098
- .long 1019669816
- .long 1353941060
- .long 1072940774
- .long 1722928782
- .long 1019926215
- .long 1803191644
- .long 1072954391
- .long 1547878639
- .long 1020259262
- .long 1092591296
- .long 1072967024
- .long 3070107923
- .long 1018320401
- .long 2205372832
- .long 1072978772
- .long 787328196
- .long 1014621351
- .long 1291577100
- .long 1072989723
- .long 2964757301
- .long 1020242528
- .long 4234512804
- .long 1072999952
- .long 3136030038
- .long 1017522144
- .long 3248069132
- .long 1073009528
- .long 1506192355
- .long 1018050472
- .long 3932628500
- .long 1073018509
- .long 1045823554
- .long 1019946655
- .long 4195697848
- .long 1073026948
- .long 233443322
- .long 1018917447
- .long 2501811452
- .long 1073034892
- .long 901427976
- .long 1017333852
- .long 866379428
- .long 1073049455
- .long 2437443742
- .long 1019678792
- .long 1376865888
- .long 1073062480
- .long 3365790232
- .long 1014547152
- .long 3290094268
- .long 1073074195
- .long 3898947415
- .long 1018683566
- .long 354764884
- .long 1073084787
- .long 3854322404
- .long 1019662058
- .long 3332975496
- .long 1073094406
- .long 3171701655
- .long 1017830922
- .long 1141460088
- .long 1073103181
- .long 3946082701
- .long 1020032019
- .long 745761284
- .long 1073111216
- .long 1347210591
- .long 1019106121
- .long 1673304508
- .long 1073118600
- .long 1760606642
- .long 1017324577
- .long 983388240
- .long 1073125409
- .long 3740651204
- .long 1019514104
- .long 3895509100
- .long 1073131706
- .long 2409629983
- .long 1020069322
- .long 2128523668
- .long 1073137548
- .long 3045605368
- .long 1018579174
- .long 2075485692
- .long 1073142981
- .long 3720571789
- .long 1017557436
- .long 121855976
- .long 1073148047
- .long 2391744767
- .long 1020160645
- .long 4181733780
- .long 1073152780
- .long 995028816
- .long 1019681295
- .long 2887813280
- .long 1073157214
- .long 218733247
- .long 1020003509
- .long 2862180896
- .long 1073161375
- .long 2043806490
- .long 1018602288
- .long 3909375184
- .long 1073168973
- .long 1559903412
- .long 1020103444
- .long 3533966292
- .long 1073175738
- .long 734884149
- .long 1018462962
- .long 3815044608
- .long 1073181799
- .long 3630523428
- .long 1017250093
- .long 739639376
- .long 1073187261
- .long 4167476661
- .long 1020008277
- .long 1068309648
- .long 1073192207
- .long 2110061437
- .long 1019295858
- .long 2350566352
- .long 1073196707
- .long 582596516
- .long 1018568821
- .long 2529520024
- .long 1073200819
- .long 745552787
- .long 1019053165
- .long 1841667508
- .long 1073204591
- .long 3982568700
- .long 1016503327
- .long 2242261080
- .long 1073208063
- .long 3433582258
- .long 1016196763
- .long 715134328
- .long 1073211270
- .long 355901358
- .long 1020087916
- .long 2700735876
- .long 1073214240
- .long 3640957736
- .long 1019780205
- .long 141607580
- .long 1073217000
- .long 2488245051
- .long 1020262395
- .long 287934404
- .long 1073219570
- .long 2392691085
- .long 1019883292
- .long 2363373988
- .long 1073221969
- .long 4194561737
- .long 1019237447
- .long 3829340424
- .long 1073224214
- .long 429455526
- .long 1019490975
- .long 1988805928
- .long 1073226320
- .long 3029848706
- .long 1018104889
- .long 1647572320
- .long 1073230161
- .long 10289938
- .long 1017394880
- .long 3988000624
- .long 1073233576
- .long 1957559169
- .long 1019434816
- .long 4263843944
- .long 1073236633
- .long 204710264
- .long 1019908761
- .long 663197724
- .long 1073239386
- .long 1921757578
- .long 1019778948
- .long 3560800700
- .long 1073241876
- .long 3994348896
- .long 1019230192
- .long 2441785656
- .long 1073244141
- .long 871468611
- .long 1014800505
- .long 3277400272
- .long 1073246209
- .long 4092218139
- .long 1020040842
- .long 3951990120
- .long 1073248105
- .long 4276546478
- .long 1019763677
- .long 2737338540
- .long 1073249850
- .long 252776012
- .long 1018794951
- .long 1511361316
- .long 1073251461
- .long 3119653999
- .long 1018514803
- .long 3969162516
- .long 1073252952
- .long 1037069016
- .long 1016792900
- .long 413985240
- .long 1073254338
- .long 4110171432
- .long 1020001345
- .long 3681283576
- .long 1073255627
- .long 1463092818
- .long 1020260354
- .long 3146455488
- .long 1073256831
- .long 1031209123
- .long 1016554799
- .long 95214512
- .long 1073257958
- .long 1373808632
- .long 1019493031
- .long 4250240828
- .long 1073259013
- .long 3891047882
- .long 1020108730
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 1016178214
- .type ATAN_TBL,@object
- .size ATAN_TBL,2624
- .align 16
-P_TBL2:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 856972295
- .long 1017226790
- .long 1413754136
- .long 1074340347
- .long 856972295
- .long 3164710438
- .long 1413754136
- .long 3221823995
- .type P_TBL2,@object
- .size P_TBL2,64
- .align 16
-SELECT_B:
- .long 0
- .long 0
- .long 4294967295
- .long 4294967295
- .long 0
- .long 0
- .long 4294967295
- .long 4294967295
- .long 4294967295
- .long 4294967295
- .long 0
- .long 0
- .long 4294967295
- .long 4294967295
- .long 0
- .long 0
- .type SELECT_B,@object
- .size SELECT_B,64
- .align 16
-SGNMASK:
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .type SGNMASK,@object
- .size SGNMASK,16
- .align 16
-pi_table:
- .long 1413754136
- .long 1074340347
- .long 856972295
- .long 1017226790
- .type pi_table,@object
- .size pi_table,16
- .align 16
-pi2_table:
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 1016178214
- .type pi2_table,@object
- .size pi2_table,16
- .align 16
-pi4_table:
- .long 1413754136
- .long 1072243195
- .long 856972295
- .long 1015129638
- .type pi4_table,@object
- .size pi4_table,16
- .align 4
-POW55:
- .long 0
- .long 1130364928
- .type POW55,@object
- .size POW55,8
- .align 4
-INVEXPMASK:
- .long 4294967295
- .long 2148532223
- .type INVEXPMASK,@object
- .size INVEXPMASK,8
- .align 4
-EXPMASK:
- .long 0
- .long 1072693248
- .type EXPMASK,@object
- .size EXPMASK,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_atan2.1-.
- .4byte ..___tag_value_atan2.5-..___tag_value_atan2.1
- .2byte 0x0400
- .4byte ..___tag_value_atan2.3-..___tag_value_atan2.1
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_atan2.4-..___tag_value_atan2.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/e_cosh.S b/libm/x86_64/e_cosh.S
deleted file mode 100644
index 97cb389..0000000
--- a/libm/x86_64/e_cosh.S
+++ /dev/null
@@ -1,1372 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// cosh(x)=(exp(x)+exp(-x))/2
-//
-// Let |x|=xH+xL (upper 26 bits, lower 27 bits)
-// log2(e) rounded to 26 bits (high part) plus a double precision low part is
-// L2EH+L2EL (upper 26, lower 53 bits)
-//
-// Let xH*L2EH=k+f+r`, where (k+f)*2^7=int(xH*L2EH*2^7),
-// f=0.b1 b2 ... b7, k integer
-// 2^f is approximated as Tp[f]+Dp[f], and 2^{-f} as Tn[f]+Dn[f]
-// Tp stores higher 53 bits, Dp stores (2^f-Tp[f]) rounded to double precision
-//
-// e^|x|=2^{k+f}*2^r, r=r`+xL*L2EH+|x|*L2EL, |r|<2^{-8}+2^{-14},
-// for |x| in [1/8,3*2^8)
-// e^{-|x|}=2^{-k-f}*2^{-r}
-//
-// e^|x| is approximated as 2^k*Tp+2^k*Tp*c1*r(1+c2*r+..+c5*r^4)+2^k*Dp=
-// =2^k*Tp+2^k*Tp*P15+2^k*Dp
-// e^{-|x|} approximated as 2^{-k}*Tn-2^{-k}*Tn*c1*r(1-c2*r+..+c5*r^4)
-//
-// For |x| in [1/8, 3*2^7), cosh(x) is formed as
-// RN(2^k*Tp+2^{-k}*Tn)+2^k*Tp*P15+2^{-k}*Tn*P`15+2^{-k}*TnL+2^{-k}*Dn+2^k*Dp
-//
-// For |x| in [3*2^7, 3*2^8), (e^|x|)/2 is returned, and
-// the result is checked for overflow.
-//
-// For |x|<1/8, a Taylor polynomial expansion is used (degree 10)
-// (error bound for polynomial expansion is below 0.501 ulp)
-//
-// Special cases:
-// cosh(NaN) = quiet NaN, and raise invalid exception
-// cosh(INF) = that INF
-// cosh(0)=1
-// for finite argument, only cosh(0)=1 is exact
-// For IEEE double
-// cosh(x) overflows
-// for x > 710.47586007394386342639336362481117248535156250 = MAXLOG+log(2)
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-
-# -- Begin cosh
-ENTRY(cosh)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_cosh.1:
- pushq %rsi
-..___tag_value_cosh.3:
-..B1.2:
- movsd HALFMASK(%rip), %xmm3
- xorpd %xmm4, %xmm4
- movsd L2E(%rip), %xmm1
- movsd 8+L2E(%rip), %xmm2
- movl $32768, %eax
- pinsrw $3, %eax, %xmm4
- movsd Shifter(%rip), %xmm6
- pextrw $3, %xmm0, %ecx
- andpd %xmm0, %xmm3
- andnpd %xmm0, %xmm4
- pshufd $68, %xmm4, %xmm5
- andl $32767, %ecx
- subl $16320, %ecx
- cmpl $200, %ecx
- jae .L_2TAG_PACKET_0.0.2
- subsd %xmm3, %xmm4
- mulsd %xmm1, %xmm3
- mulsd %xmm5, %xmm2
- cvtsd2si %xmm3, %eax
- movq %xmm3, %xmm7
- addsd %xmm6, %xmm3
- mulsd %xmm4, %xmm1
- xorpd %xmm5, %xmm5
- subsd %xmm6, %xmm3
- movapd cv(%rip), %xmm4
- addsd %xmm1, %xmm2
- movapd 16+cv(%rip), %xmm6
- subsd %xmm3, %xmm7
- movl $32704, %edx
- pinsrw $3, %edx, %xmm5
- movapd 32+cv(%rip), %xmm1
- addsd %xmm7, %xmm2
- movl $127, %edx
- andl %eax, %edx
- addl %edx, %edx
- shrl $3, %eax
- andl $65520, %eax
- addl $16352, %eax
- xorpd %xmm0, %xmm0
- cmpl $184, %ecx
- jae .L_2TAG_PACKET_1.0.2
- pshufd $68, %xmm5, %xmm5
- pinsrw $3, %eax, %xmm0
- pshufd $68, %xmm0, %xmm0
- psubw %xmm0, %xmm5
- lea T2f(%rip), %r8
- mulpd (%r8,%rdx,8), %xmm0
- lea T2_neg_f(%rip), %r8
- mulpd (%r8,%rdx,8), %xmm5
- pshufd $68, %xmm2, %xmm3
- movapd 48+cv(%rip), %xmm7
- pshufd $68, %xmm2, %xmm2
- mulpd %xmm3, %xmm3
- mulpd %xmm2, %xmm4
- mulpd %xmm2, %xmm6
- mulpd 64+cv(%rip), %xmm2
- mulpd %xmm3, %xmm1
- mulpd %xmm3, %xmm7
- mulpd %xmm3, %xmm4
- mulpd %xmm3, %xmm1
- addpd %xmm7, %xmm6
- movq %xmm0, %xmm7
- addpd %xmm1, %xmm4
- shufpd $0, %xmm5, %xmm7
- addpd %xmm5, %xmm0
- mulpd %xmm7, %xmm2
- addpd %xmm6, %xmm4
- subsd %xmm0, %xmm7
- mulpd %xmm2, %xmm4
- pshufd $238, %xmm0, %xmm6
- addsd %xmm5, %xmm7
- addpd %xmm2, %xmm4
- addsd %xmm6, %xmm7
- pshufd $238, %xmm4, %xmm2
- addsd %xmm7, %xmm2
- addsd %xmm4, %xmm2
- addsd %xmm2, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_0.0.2:
- addl $16320, %ecx
- cmpl $16320, %ecx
- ja .L_2TAG_PACKET_2.0.2
- cmpl $15952, %ecx
- jae .L_2TAG_PACKET_3.0.2
- addsd %xmm2, %xmm6
- movq ONEMASK(%rip), %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_1.0.2:
- subl $16352, %eax
- movl %eax, %ecx
- andl $32752, %eax
- shrl $1, %eax
- andl $65520, %eax
- subl %eax, %ecx
- addl $16352, %eax
- pinsrw $3, %eax, %xmm0
- pshufd $68, %xmm0, %xmm0
- lea T2f(%rip), %r8
- mulpd (%r8,%rdx,8), %xmm0
- pshufd $68, %xmm2, %xmm3
- movsd 48+cv(%rip), %xmm7
- mulsd %xmm3, %xmm3
- mulsd %xmm2, %xmm4
- mulsd %xmm2, %xmm6
- mulsd 64+cv(%rip), %xmm2
- mulsd %xmm3, %xmm1
- mulsd %xmm3, %xmm7
- mulsd %xmm3, %xmm4
- addl $16368, %ecx
- pinsrw $3, %ecx, %xmm5
- mulsd %xmm3, %xmm1
- addsd %xmm7, %xmm6
- addsd %xmm1, %xmm4
- mulsd %xmm0, %xmm2
- addsd %xmm6, %xmm4
- mulsd %xmm2, %xmm4
- pshufd $238, %xmm0, %xmm6
- addsd %xmm6, %xmm4
- addsd %xmm4, %xmm2
- addsd %xmm2, %xmm0
- mulsd %xmm5, %xmm0
- pextrw $3, %xmm0, %eax
- andl $32752, %eax
- cmpl $32752, %eax
- je .L_2TAG_PACKET_4.0.2
- jmp ..B1.5
-.L_2TAG_PACKET_3.0.2:
- movapd pv(%rip), %xmm1
- mulpd %xmm5, %xmm5
- movapd 16+pv(%rip), %xmm2
- xorpd %xmm3, %xmm3
- movq %xmm5, %xmm0
- mulpd %xmm5, %xmm1
- movsd ONEMASK(%rip), %xmm6
- mulpd %xmm5, %xmm5
- movl $16352, %eax
- pinsrw $3, %eax, %xmm3
- addpd %xmm2, %xmm1
- mulpd %xmm5, %xmm1
- pshufd $238, %xmm1, %xmm2
- mulsd %xmm1, %xmm5
- mulsd %xmm3, %xmm0
- addsd %xmm5, %xmm2
- addsd %xmm2, %xmm0
- addsd %xmm6, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_2.0.2:
- cmpl $32752, %ecx
- jae .L_2TAG_PACKET_5.0.2
- xorpd %xmm0, %xmm0
- movl $32736, %eax
- pinsrw $3, %eax, %xmm0
- mulsd %xmm0, %xmm0
- jmp .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_5.0.2:
- mulsd %xmm0, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_4.0.2:
- movq %xmm0, (%rsp)
-..B1.3:
- movq (%rsp), %xmm0
-.L_2TAG_PACKET_6.0.2:
-..B1.5:
- popq %rcx
-..___tag_value_cosh.4:
- ret
-..___tag_value_cosh.5:
-END(cosh)
-# -- End cosh
- .section .rodata, "a"
- .align 16
- .align 16
-L2E:
- .long 1610612736
- .long 1080497479
- .long 4166901572
- .long 1053077003
- .type L2E,@object
- .size L2E,16
- .align 16
-Shifter:
- .long 0
- .long 1127743488
- .long 0
- .long 3275227136
- .type Shifter,@object
- .size Shifter,16
- .align 16
-cv:
- .long 3607404736
- .long 1044146952
- .long 3607404736
- .long 3191630600
- .long 4277811695
- .long 1063661122
- .long 4277811695
- .long 3211144770
- .long 2140175755
- .long 1033864261
- .long 2140175755
- .long 1033864261
- .long 4289495988
- .long 1054113747
- .long 4289495988
- .long 1054113747
- .long 4277811695
- .long 1064709698
- .long 4277811695
- .long 3212193346
- .type cv,@object
- .size cv,80
- .align 16
-T2f:
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 2851812149
- .long 1072698941
- .long 2595802551
- .long 1016815913
- .long 1048019041
- .long 1072704666
- .long 1398474845
- .long 3161559171
- .long 3899555717
- .long 1072710421
- .long 427280750
- .long 3163595548
- .long 3541402996
- .long 1072716208
- .long 2759177317
- .long 1015903202
- .long 702412510
- .long 1072722027
- .long 3803266087
- .long 3163328991
- .long 410360776
- .long 1072727877
- .long 1269990655
- .long 1013024446
- .long 3402036099
- .long 1072733758
- .long 405889334
- .long 1016154232
- .long 1828292879
- .long 1072739672
- .long 1255956747
- .long 1016636974
- .long 728909815
- .long 1072745618
- .long 383930225
- .long 1016078044
- .long 852742562
- .long 1072751596
- .long 667253586
- .long 1010842135
- .long 2952712987
- .long 1072757606
- .long 3293494651
- .long 3161168877
- .long 3490863953
- .long 1072763649
- .long 960797498
- .long 3163997456
- .long 3228316108
- .long 1072769725
- .long 3010241991
- .long 3159471380
- .long 2930322912
- .long 1072775834
- .long 2599499422
- .long 3163762623
- .long 3366293073
- .long 1072781976
- .long 3119426314
- .long 1015169130
- .long 1014845819
- .long 1072788152
- .long 3117910646
- .long 3162607681
- .long 948735466
- .long 1072794361
- .long 3516338028
- .long 3163623459
- .long 3949972341
- .long 1072800603
- .long 2068408548
- .long 1015962444
- .long 2214878420
- .long 1072806880
- .long 892270087
- .long 3164164998
- .long 828946858
- .long 1072813191
- .long 10642492
- .long 1016988014
- .long 586995997
- .long 1072819536
- .long 41662348
- .long 3163676568
- .long 2288159958
- .long 1072825915
- .long 2169144469
- .long 1015924597
- .long 2440944790
- .long 1072832329
- .long 2492769774
- .long 1015196030
- .long 1853186616
- .long 1072838778
- .long 3066496371
- .long 1016705150
- .long 1337108031
- .long 1072845262
- .long 3203724452
- .long 1015726421
- .long 1709341917
- .long 1072851781
- .long 2571168217
- .long 1015201075
- .long 3790955393
- .long 1072858335
- .long 2352942462
- .long 3164228666
- .long 4112506593
- .long 1072864925
- .long 2947355221
- .long 1015419624
- .long 3504003472
- .long 1072871551
- .long 3594001060
- .long 3158379228
- .long 2799960843
- .long 1072878213
- .long 1423655381
- .long 1016070727
- .long 2839424854
- .long 1072884911
- .long 1171596163
- .long 1014090255
- .long 171030293
- .long 1072891646
- .long 3526460132
- .long 1015477354
- .long 4232894513
- .long 1072898416
- .long 2383938684
- .long 1015717095
- .long 2992903935
- .long 1072905224
- .long 2218154406
- .long 1016276769
- .long 1603444721
- .long 1072912069
- .long 1548633640
- .long 3163249902
- .long 926591435
- .long 1072918951
- .long 3208833762
- .long 3163962090
- .long 1829099622
- .long 1072925870
- .long 1016661181
- .long 3164509581
- .long 887463927
- .long 1072932827
- .long 3596744163
- .long 3161842742
- .long 3272845541
- .long 1072939821
- .long 928852419
- .long 3164536824
- .long 1276261410
- .long 1072946854
- .long 300981948
- .long 1015732745
- .long 78413852
- .long 1072953925
- .long 4183226867
- .long 3164065827
- .long 569847338
- .long 1072961034
- .long 472945272
- .long 3160339305
- .long 3645941911
- .long 1072968181
- .long 3814685081
- .long 3162621917
- .long 1617004845
- .long 1072975368
- .long 82804944
- .long 1011391354
- .long 3978100823
- .long 1072982593
- .long 3513027190
- .long 1016894539
- .long 3049340112
- .long 1072989858
- .long 3062915824
- .long 1014219171
- .long 4040676318
- .long 1072997162
- .long 4090609238
- .long 1016712034
- .long 3577096743
- .long 1073004506
- .long 2951496418
- .long 1014842263
- .long 2583551245
- .long 1073011890
- .long 3161094195
- .long 1016655067
- .long 1990012071
- .long 1073019314
- .long 3529070563
- .long 3163861769
- .long 2731501122
- .long 1073026778
- .long 1774031855
- .long 3163518597
- .long 1453150082
- .long 1073034283
- .long 498154669
- .long 3162536638
- .long 3395129871
- .long 1073041828
- .long 4025345435
- .long 3163383964
- .long 917841882
- .long 1073049415
- .long 18715565
- .long 1016707884
- .long 3566716925
- .long 1073057042
- .long 1536826856
- .long 1015191009
- .long 3712504873
- .long 1073064711
- .long 88491949
- .long 1016476236
- .long 2321106615
- .long 1073072422
- .long 2171176610
- .long 1010584347
- .long 363667784
- .long 1073080175
- .long 813753950
- .long 1016833785
- .long 3111574537
- .long 1073087969
- .long 2606161479
- .long 3163808322
- .long 2956612997
- .long 1073095806
- .long 2118169751
- .long 3163784129
- .long 885834528
- .long 1073103686
- .long 1973258547
- .long 3163310140
- .long 2186617381
- .long 1073111608
- .long 2270764084
- .long 3164321289
- .long 3561793907
- .long 1073119573
- .long 1157054053
- .long 1012938926
- .long 1719614413
- .long 1073127582
- .long 330458198
- .long 3164331316
- .long 1963711167
- .long 1073135634
- .long 1744767757
- .long 3161622870
- .long 1013258799
- .long 1073143730
- .long 1748797611
- .long 3161177658
- .long 4182873220
- .long 1073151869
- .long 629542646
- .long 3163044879
- .long 3907805044
- .long 1073160053
- .long 2257091225
- .long 3162598983
- .long 1218806132
- .long 1073168282
- .long 1818613052
- .long 3163597017
- .long 1447192521
- .long 1073176555
- .long 1462857171
- .long 3163563097
- .long 1339972927
- .long 1073184873
- .long 167908909
- .long 1016620728
- .long 1944781191
- .long 1073193236
- .long 3993278767
- .long 3162772855
- .long 19972402
- .long 1073201645
- .long 3507899862
- .long 1017057868
- .long 919555682
- .long 1073210099
- .long 3121969534
- .long 1013996802
- .long 1413356050
- .long 1073218599
- .long 1651349291
- .long 3163716742
- .long 2571947539
- .long 1073227145
- .long 3558159064
- .long 3164425245
- .long 1176749997
- .long 1073235738
- .long 2738998779
- .long 3163084420
- .long 2604962541
- .long 1073244377
- .long 2614425274
- .long 3164587768
- .long 3649726105
- .long 1073253063
- .long 4085036346
- .long 1016698050
- .long 1110089947
- .long 1073261797
- .long 1451641639
- .long 1016523249
- .long 380978316
- .long 1073270578
- .long 854188970
- .long 3161511262
- .long 2568320822
- .long 1073279406
- .long 2732824428
- .long 1015401491
- .long 194117574
- .long 1073288283
- .long 777528612
- .long 3164460665
- .long 2966275557
- .long 1073297207
- .long 2176155324
- .long 3160891335
- .long 3418903055
- .long 1073306180
- .long 2527457337
- .long 3161869180
- .long 2682146384
- .long 1073315202
- .long 2082178513
- .long 3164411995
- .long 1892288442
- .long 1073324273
- .long 2446255666
- .long 3163648957
- .long 2191782032
- .long 1073333393
- .long 2960257726
- .long 1014791238
- .long 434316067
- .long 1073342563
- .long 2028358766
- .long 1014506698
- .long 2069751141
- .long 1073351782
- .long 1562170675
- .long 3163773257
- .long 3964284211
- .long 1073361051
- .long 2111583915
- .long 1016475740
- .long 2990417245
- .long 1073370371
- .long 3683467745
- .long 3164417902
- .long 321958744
- .long 1073379742
- .long 3401933767
- .long 1016843134
- .long 1434058175
- .long 1073389163
- .long 251133233
- .long 1016134345
- .long 3218338682
- .long 1073398635
- .long 3404164304
- .long 3163525684
- .long 2572866477
- .long 1073408159
- .long 878562433
- .long 1016570317
- .long 697153126
- .long 1073417735
- .long 1283515429
- .long 3164331765
- .long 3092190715
- .long 1073427362
- .long 814012168
- .long 3160571998
- .long 2380618042
- .long 1073437042
- .long 3149557219
- .long 3164369375
- .long 4076559943
- .long 1073446774
- .long 2119478331
- .long 3161806927
- .long 815859274
- .long 1073456560
- .long 240396590
- .long 3164536019
- .long 2420883922
- .long 1073466398
- .long 2049810052
- .long 1015168464
- .long 1540824585
- .long 1073476290
- .long 1064017011
- .long 3164536266
- .long 3716502172
- .long 1073486235
- .long 2303740125
- .long 1015091301
- .long 1610600570
- .long 1073496235
- .long 3766732298
- .long 1016808759
- .long 777507147
- .long 1073506289
- .long 4282924205
- .long 1016236109
- .long 2483480501
- .long 1073516397
- .long 1216371780
- .long 1014082748
- .long 3706687593
- .long 1073526560
- .long 3521726940
- .long 1014301643
- .long 1432208378
- .long 1073536779
- .long 1401068914
- .long 3163412539
- .long 1242007932
- .long 1073547053
- .long 1132034716
- .long 3164388407
- .long 135105010
- .long 1073557383
- .long 1906148728
- .long 3164424315
- .long 3707479175
- .long 1073567768
- .long 3613079303
- .long 1015213314
- .long 382305176
- .long 1073578211
- .long 2347622376
- .long 3163627201
- .long 64696965
- .long 1073588710
- .long 1768797490
- .long 1016865536
- .long 4076975200
- .long 1073599265
- .long 2029000899
- .long 1016257111
- .long 863738719
- .long 1073609879
- .long 1326992220
- .long 3163661773
- .long 351641897
- .long 1073620550
- .long 2172261526
- .long 3164059175
- .long 3884662774
- .long 1073631278
- .long 2158611599
- .long 1015258761
- .long 4224142467
- .long 1073642065
- .long 3389820386
- .long 1016255778
- .long 2728693978
- .long 1073652911
- .long 396109971
- .long 3164511267
- .long 764307441
- .long 1073663816
- .long 3021057420
- .long 3164378099
- .long 3999357479
- .long 1073674779
- .long 2258941616
- .long 1016973300
- .long 929806999
- .long 1073685803
- .long 3205336643
- .long 1016308133
- .long 1533953344
- .long 1073696886
- .long 769171851
- .long 1016714209
- .long 2912730644
- .long 1073708029
- .long 3490067722
- .long 3164453650
- .long 2174652632
- .long 1073719233
- .long 4087714590
- .long 1015498835
- .long 730821105
- .long 1073730498
- .long 2523232743
- .long 1013115764
- .type T2f,@object
- .size T2f,2048
- .align 16
-T2_neg_f:
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 730821105
- .long 1072681922
- .long 2523232743
- .long 1012067188
- .long 2174652632
- .long 1072670657
- .long 4087714590
- .long 1014450259
- .long 2912730644
- .long 1072659453
- .long 3490067722
- .long 3163405074
- .long 1533953344
- .long 1072648310
- .long 769171851
- .long 1015665633
- .long 929806999
- .long 1072637227
- .long 3205336643
- .long 1015259557
- .long 3999357479
- .long 1072626203
- .long 2258941616
- .long 1015924724
- .long 764307441
- .long 1072615240
- .long 3021057420
- .long 3163329523
- .long 2728693978
- .long 1072604335
- .long 396109971
- .long 3163462691
- .long 4224142467
- .long 1072593489
- .long 3389820386
- .long 1015207202
- .long 3884662774
- .long 1072582702
- .long 2158611599
- .long 1014210185
- .long 351641897
- .long 1072571974
- .long 2172261526
- .long 3163010599
- .long 863738719
- .long 1072561303
- .long 1326992220
- .long 3162613197
- .long 4076975200
- .long 1072550689
- .long 2029000899
- .long 1015208535
- .long 64696965
- .long 1072540134
- .long 1768797490
- .long 1015816960
- .long 382305176
- .long 1072529635
- .long 2347622376
- .long 3162578625
- .long 3707479175
- .long 1072519192
- .long 3613079303
- .long 1014164738
- .long 135105010
- .long 1072508807
- .long 1906148728
- .long 3163375739
- .long 1242007932
- .long 1072498477
- .long 1132034716
- .long 3163339831
- .long 1432208378
- .long 1072488203
- .long 1401068914
- .long 3162363963
- .long 3706687593
- .long 1072477984
- .long 3521726940
- .long 1013253067
- .long 2483480501
- .long 1072467821
- .long 1216371780
- .long 1013034172
- .long 777507147
- .long 1072457713
- .long 4282924205
- .long 1015187533
- .long 1610600570
- .long 1072447659
- .long 3766732298
- .long 1015760183
- .long 3716502172
- .long 1072437659
- .long 2303740125
- .long 1014042725
- .long 1540824585
- .long 1072427714
- .long 1064017011
- .long 3163487690
- .long 2420883922
- .long 1072417822
- .long 2049810052
- .long 1014119888
- .long 815859274
- .long 1072407984
- .long 240396590
- .long 3163487443
- .long 4076559943
- .long 1072398198
- .long 2119478331
- .long 3160758351
- .long 2380618042
- .long 1072388466
- .long 3149557219
- .long 3163320799
- .long 3092190715
- .long 1072378786
- .long 814012168
- .long 3159523422
- .long 697153126
- .long 1072369159
- .long 1283515429
- .long 3163283189
- .long 2572866477
- .long 1072359583
- .long 878562433
- .long 1015521741
- .long 3218338682
- .long 1072350059
- .long 3404164304
- .long 3162477108
- .long 1434058175
- .long 1072340587
- .long 251133233
- .long 1015085769
- .long 321958744
- .long 1072331166
- .long 3401933767
- .long 1015794558
- .long 2990417245
- .long 1072321795
- .long 3683467745
- .long 3163369326
- .long 3964284211
- .long 1072312475
- .long 2111583915
- .long 1015427164
- .long 2069751141
- .long 1072303206
- .long 1562170675
- .long 3162724681
- .long 434316067
- .long 1072293987
- .long 2028358766
- .long 1013458122
- .long 2191782032
- .long 1072284817
- .long 2960257726
- .long 1013742662
- .long 1892288442
- .long 1072275697
- .long 2446255666
- .long 3162600381
- .long 2682146384
- .long 1072266626
- .long 2082178513
- .long 3163363419
- .long 3418903055
- .long 1072257604
- .long 2527457337
- .long 3160820604
- .long 2966275557
- .long 1072248631
- .long 2176155324
- .long 3159842759
- .long 194117574
- .long 1072239707
- .long 777528612
- .long 3163412089
- .long 2568320822
- .long 1072230830
- .long 2732824428
- .long 1014352915
- .long 380978316
- .long 1072222002
- .long 854188970
- .long 3160462686
- .long 1110089947
- .long 1072213221
- .long 1451641639
- .long 1015474673
- .long 3649726105
- .long 1072204487
- .long 4085036346
- .long 1015649474
- .long 2604962541
- .long 1072195801
- .long 2614425274
- .long 3163539192
- .long 1176749997
- .long 1072187162
- .long 2738998779
- .long 3162035844
- .long 2571947539
- .long 1072178569
- .long 3558159064
- .long 3163376669
- .long 1413356050
- .long 1072170023
- .long 1651349291
- .long 3162668166
- .long 919555682
- .long 1072161523
- .long 3121969534
- .long 1012948226
- .long 19972402
- .long 1072153069
- .long 3507899862
- .long 1016009292
- .long 1944781191
- .long 1072144660
- .long 3993278767
- .long 3161724279
- .long 1339972927
- .long 1072136297
- .long 167908909
- .long 1015572152
- .long 1447192521
- .long 1072127979
- .long 1462857171
- .long 3162514521
- .long 1218806132
- .long 1072119706
- .long 1818613052
- .long 3162548441
- .long 3907805044
- .long 1072111477
- .long 2257091225
- .long 3161550407
- .long 4182873220
- .long 1072103293
- .long 629542646
- .long 3161996303
- .long 1013258799
- .long 1072095154
- .long 1748797611
- .long 3160129082
- .long 1963711167
- .long 1072087058
- .long 1744767757
- .long 3160574294
- .long 1719614413
- .long 1072079006
- .long 330458198
- .long 3163282740
- .long 3561793907
- .long 1072070997
- .long 1157054053
- .long 1011890350
- .long 2186617381
- .long 1072063032
- .long 2270764084
- .long 3163272713
- .long 885834528
- .long 1072055110
- .long 1973258547
- .long 3162261564
- .long 2956612997
- .long 1072047230
- .long 2118169751
- .long 3162735553
- .long 3111574537
- .long 1072039393
- .long 2606161479
- .long 3162759746
- .long 363667784
- .long 1072031599
- .long 813753950
- .long 1015785209
- .long 2321106615
- .long 1072023846
- .long 2171176610
- .long 1009535771
- .long 3712504873
- .long 1072016135
- .long 88491949
- .long 1015427660
- .long 3566716925
- .long 1072008466
- .long 1536826856
- .long 1014142433
- .long 917841882
- .long 1072000839
- .long 18715565
- .long 1015659308
- .long 3395129871
- .long 1071993252
- .long 4025345435
- .long 3162335388
- .long 1453150082
- .long 1071985707
- .long 498154669
- .long 3161488062
- .long 2731501122
- .long 1071978202
- .long 1774031855
- .long 3162470021
- .long 1990012071
- .long 1071970738
- .long 3529070563
- .long 3162813193
- .long 2583551245
- .long 1071963314
- .long 3161094195
- .long 1015606491
- .long 3577096743
- .long 1071955930
- .long 2951496418
- .long 1013793687
- .long 4040676318
- .long 1071948586
- .long 4090609238
- .long 1015663458
- .long 3049340112
- .long 1071941282
- .long 3062915824
- .long 1013170595
- .long 3978100823
- .long 1071934017
- .long 3513027190
- .long 1015845963
- .long 1617004845
- .long 1071926792
- .long 82804944
- .long 1010342778
- .long 3645941911
- .long 1071919605
- .long 3814685081
- .long 3161573341
- .long 569847338
- .long 1071912458
- .long 472945272
- .long 3159290729
- .long 78413852
- .long 1071905349
- .long 4183226867
- .long 3163017251
- .long 1276261410
- .long 1071898278
- .long 300981948
- .long 1014684169
- .long 3272845541
- .long 1071891245
- .long 928852419
- .long 3163488248
- .long 887463927
- .long 1071884251
- .long 3596744163
- .long 3160794166
- .long 1829099622
- .long 1071877294
- .long 1016661181
- .long 3163461005
- .long 926591435
- .long 1071870375
- .long 3208833762
- .long 3162913514
- .long 1603444721
- .long 1071863493
- .long 1548633640
- .long 3162201326
- .long 2992903935
- .long 1071856648
- .long 2218154406
- .long 1015228193
- .long 4232894513
- .long 1071849840
- .long 2383938684
- .long 1014668519
- .long 171030293
- .long 1071843070
- .long 3526460132
- .long 1014428778
- .long 2839424854
- .long 1071836335
- .long 1171596163
- .long 1013041679
- .long 2799960843
- .long 1071829637
- .long 1423655381
- .long 1015022151
- .long 3504003472
- .long 1071822975
- .long 3594001060
- .long 3157330652
- .long 4112506593
- .long 1071816349
- .long 2947355221
- .long 1014371048
- .long 3790955393
- .long 1071809759
- .long 2352942462
- .long 3163180090
- .long 1709341917
- .long 1071803205
- .long 2571168217
- .long 1014152499
- .long 1337108031
- .long 1071796686
- .long 3203724452
- .long 1014677845
- .long 1853186616
- .long 1071790202
- .long 3066496371
- .long 1015656574
- .long 2440944790
- .long 1071783753
- .long 2492769774
- .long 1014147454
- .long 2288159958
- .long 1071777339
- .long 2169144469
- .long 1014876021
- .long 586995997
- .long 1071770960
- .long 41662348
- .long 3162627992
- .long 828946858
- .long 1071764615
- .long 10642492
- .long 1015939438
- .long 2214878420
- .long 1071758304
- .long 892270087
- .long 3163116422
- .long 3949972341
- .long 1071752027
- .long 2068408548
- .long 1014913868
- .long 948735466
- .long 1071745785
- .long 3516338028
- .long 3162574883
- .long 1014845819
- .long 1071739576
- .long 3117910646
- .long 3161559105
- .long 3366293073
- .long 1071733400
- .long 3119426314
- .long 1014120554
- .long 2930322912
- .long 1071727258
- .long 2599499422
- .long 3162714047
- .long 3228316108
- .long 1071721149
- .long 3010241991
- .long 3158422804
- .long 3490863953
- .long 1071715073
- .long 960797498
- .long 3162948880
- .long 2952712987
- .long 1071709030
- .long 3293494651
- .long 3160120301
- .long 852742562
- .long 1071703020
- .long 667253586
- .long 1009793559
- .long 728909815
- .long 1071697042
- .long 383930225
- .long 1015029468
- .long 1828292879
- .long 1071691096
- .long 1255956747
- .long 1015588398
- .long 3402036099
- .long 1071685182
- .long 405889334
- .long 1015105656
- .long 410360776
- .long 1071679301
- .long 1269990655
- .long 1011975870
- .long 702412510
- .long 1071673451
- .long 3803266087
- .long 3162280415
- .long 3541402996
- .long 1071667632
- .long 2759177317
- .long 1014854626
- .long 3899555717
- .long 1071661845
- .long 427280750
- .long 3162546972
- .long 1048019041
- .long 1071656090
- .long 1398474845
- .long 3160510595
- .long 2851812149
- .long 1071650365
- .long 2595802551
- .long 1015767337
- .type T2_neg_f,@object
- .size T2_neg_f,2048
- .align 16
-pv:
- .long 3078135644
- .long 1049787983
- .long 381774870
- .long 1062650220
- .long 436314137
- .long 1056571808
- .long 1431655765
- .long 1067799893
- .type pv,@object
- .size pv,32
- .align 4
-HALFMASK:
- .long 4160749568
- .long 2147483647
- .type HALFMASK,@object
- .size HALFMASK,8
- .align 4
-ONEMASK:
- .long 0
- .long 1072693248
- .type ONEMASK,@object
- .size ONEMASK,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_cosh.1-.
- .4byte ..___tag_value_cosh.5-..___tag_value_cosh.1
- .2byte 0x0400
- .4byte ..___tag_value_cosh.3-..___tag_value_cosh.1
- .2byte 0x100e
- .byte 0x04
- .4byte ..___tag_value_cosh.4-..___tag_value_cosh.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/e_hypot.S b/libm/x86_64/e_hypot.S
deleted file mode 100644
index e46669f..0000000
--- a/libm/x86_64/e_hypot.S
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// X87 version:
-// Use 80-bit FPU precision fmul, fsqrt to compute square and sqrt.
-//
-// SSE version:
-// Swap x, y if |x|<|y|
-// For x=2^k*x, get y=y*2^(-k)
-// Get S ~ sqrt(x^2+y^2) (leading 1 + leading 25 mantissa bits)
-//
-// Get D = ( RN(x^2+y^2) - S^2 ) + ( x^2 - RN(x^2) ) +
-// + ( y^2 - ((RN(x^2+y^2)-RN(x^2)) )
-//
-// Result is 2^k*(S + Se), where Se = S*e
-// S*e is approximated as (D/2S)*( 1 - (D/2S)^2*1.0/S )
-//
-// Return 2^k*(S+Se)
-//
-// For |y/x|<2^(-64), return x
-//
-// For cases where maximum biased exponent is either greater than 7fdh or
-// below 32, take a special path to check for special cases (0, NaN, Inf),
-// possible overflow, and more accurate computation for denormal results
-//
-// Special cases:
-// hypot(x,y), hypot(y,x), and hypot(x,-y) are equivalent
-// hypot(x,+-0) is equivalent to fabs(x)
-// hypot(x,y) = y if (x==NaN or x==INF) and y==INF
-// hypot(x,y) = x if (x==NaN or x==INF) and y!=INF (even if y==NaN!)
-// hypot(x,y) = y if (x!=NaN and x!=INF) and (y==NaN or y==INF)
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin hypot
-ENTRY(hypot)
-# parameter 1: %xmm0
-# parameter 2: %xmm1
-..B1.1:
-..___tag_value_hypot.1:
-..___tag_value_hypot.3:
-..B1.2:
- subq $64, %rsp
- movapd static_const_table(%rip), %xmm3
- movsd %xmm0, 48(%rsp)
- movsd %xmm1, 56(%rsp)
- andpd %xmm3, %xmm0
- andpd %xmm3, %xmm1
- pextrw $3, %xmm0, %eax
- pextrw $3, %xmm1, %edx
- cmpl $24528, %eax
- ja .L_2TAG_PACKET_0.0.1
- cmpl $24528, %edx
- ja .L_2TAG_PACKET_0.0.1
-.L_2TAG_PACKET_1.0.1:
- fldl 48(%rsp)
- fldl 56(%rsp)
- fxch %st(1)
- fmul %st(0), %st
- fxch %st(1)
- nop
- fmul %st(0), %st
- faddp %st, %st(1)
- fsqrt
- jmp .L_2TAG_PACKET_2.0.1
-.L_2TAG_PACKET_0.0.1:
- cmpl $32752, %eax
- movl %eax, %ecx
- jae .L_2TAG_PACKET_3.0.1
- subl %edx, %ecx
- cmpl $32752, %edx
- jae .L_2TAG_PACKET_3.0.1
- addl $928, %ecx
- addl %edx, %eax
- cmpl $1856, %ecx
- ja .L_2TAG_PACKET_4.0.1
- cmpl $49056, %eax
- jb .L_2TAG_PACKET_1.0.1
- fldl 48(%rsp)
- fldl 56(%rsp)
- fxch %st(1)
- fmul %st(0), %st
- fxch %st(1)
- nop
- fmul %st(0), %st
- faddp %st, %st(1)
- fsqrt
-.L_2TAG_PACKET_5.0.1:
- fstl (%rsp)
- fstpt 16(%rsp)
- xorl %eax, %eax
- movw 24(%rsp), %ax
- cmpl $17407, %eax
- jae .L_2TAG_PACKET_6.0.1
- fldl (%rsp)
- jmp .L_2TAG_PACKET_7.0.1
-.L_2TAG_PACKET_4.0.1:
- movsd %xmm0, 32(%rsp)
- movsd %xmm1, 40(%rsp)
- fldl 32(%rsp)
- faddl 40(%rsp)
- jmp .L_2TAG_PACKET_5.0.1
-.L_2TAG_PACKET_6.0.1:
- fldl (%rsp)
- jmp .L_2TAG_PACKET_7.0.1
-.L_2TAG_PACKET_3.0.1:
- shufpd $0, %xmm1, %xmm0
- movdqa %xmm0, %xmm2
- movdqa 16+static_const_table(%rip), %xmm3
- movsd %xmm0, 32(%rsp)
- movsd %xmm1, 40(%rsp)
- cmppd $3, %xmm0, %xmm2
- cmppd $0, %xmm0, %xmm3
- movmskpd %xmm2, %edx
- movmskpd %xmm3, %rax
- testl %edx, %edx
- je .L_2TAG_PACKET_8.0.1
- fldl 32(%rsp)
- fmull 40(%rsp)
- testq $1, %rax
- jne .L_2TAG_PACKET_9.0.1
- testq $2, %rax
- jne .L_2TAG_PACKET_10.0.1
- jmp .L_2TAG_PACKET_2.0.1
-.L_2TAG_PACKET_8.0.1:
- fldl 32(%rsp)
- faddl 40(%rsp)
- jmp .L_2TAG_PACKET_2.0.1
-.L_2TAG_PACKET_9.0.1:
- fstpl 40(%rsp)
- fldl 32(%rsp)
- jmp .L_2TAG_PACKET_7.0.1
-.L_2TAG_PACKET_10.0.1:
- fstpl 32(%rsp)
- fldl 40(%rsp)
- jmp .L_2TAG_PACKET_7.0.1
-.L_2TAG_PACKET_2.0.1:
-.L_2TAG_PACKET_7.0.1:
- fstpl 16(%rsp)
- movq 16(%rsp), %xmm0
- addq $64, %rsp
- ret
-..B1.3:
-..___tag_value_hypot.4:
-END(hypot)
-# -- End hypot
- .section .rodata, "a"
- .align 16
- .align 16
-static_const_table:
- .long 4294967295
- .long 2147483647
- .long 4294967295
- .long 2147483647
- .long 0
- .long 2146435072
- .long 0
- .long 2146435072
- .type static_const_table,@object
- .size static_const_table,32
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x00000014
- .4byte 0x0000001c
- .4byte ..___tag_value_hypot.1-.
- .4byte ..___tag_value_hypot.4-..___tag_value_hypot.1
- .2byte 0x0400
- .4byte ..___tag_value_hypot.3-..___tag_value_hypot.1
- .2byte 0x100e
-# End
diff --git a/libm/x86_64/e_log10.S b/libm/x86_64/e_log10.S
deleted file mode 100644
index 86f86ce..0000000
--- a/libm/x86_64/e_log10.S
+++ /dev/null
@@ -1,807 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Let x=2^k * mx, mx in [1,2)
-//
-// Get B~1/mx based on the output of rcpss instruction (B0)
-// B = int((B0*LH*2^7+0.5))/2^7
-// LH is a short approximation for log10(e)
-//
-// Reduced argument: r=B*mx-LH (computed accurately in high and low parts)
-//
-// Result: k*log10(2) - log(B) + p(r)
-// p(r) is a degree 7 polynomial
-// -log(B) read from data table (high, low parts)
-// Result is formed from high and low parts
-//
-// Special cases:
-// log10(0) = -INF with divide-by-zero exception raised
-// log10(1) = +0
-// log10(x) = NaN with invalid exception raised if x < -0, including -INF
-// log10(+INF) = +INF
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin log10
-ENTRY(log10)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_log10.1:
- subq $24, %rsp
-..___tag_value_log10.3:
- movsd %xmm0, (%rsp)
-..B1.2:
- xorpd %xmm2, %xmm2
- movl $16368, %eax
- pinsrw $3, %eax, %xmm2
- movl $1054736384, %ecx
- movd %ecx, %xmm7
- xorpd %xmm3, %xmm3
- movl $30704, %edx
- pinsrw $3, %edx, %xmm3
- movq %xmm0, %xmm1
- movl $32768, %edx
- movd %edx, %xmm4
- movapd HIGHSIGMASK(%rip), %xmm5
- pextrw $3, %xmm0, %eax
- orpd %xmm2, %xmm0
- movl $16352, %ecx
- psrlq $27, %xmm0
- movq LOG10_E(%rip), %xmm2
- psrld $2, %xmm0
- rcpps %xmm0, %xmm0
- psllq $12, %xmm1
- pshufd $78, %xmm5, %xmm6
- psrlq $12, %xmm1
- subl $16, %eax
- cmpl $32736, %eax
- jae .L_2TAG_PACKET_0.0.2
-.L_2TAG_PACKET_1.0.2:
- mulss %xmm7, %xmm0
- orpd %xmm3, %xmm1
- lea L_tbl(%rip), %r11
- andpd %xmm1, %xmm5
- paddd %xmm4, %xmm0
- subsd %xmm5, %xmm1
- movd %xmm0, %edx
- psllq $29, %xmm0
- andpd %xmm6, %xmm0
- andl $32752, %eax
- subl %ecx, %eax
- cvtsi2sd %eax, %xmm7
- mulpd %xmm0, %xmm5
- mulsd %xmm0, %xmm1
- movq log2(%rip), %xmm6
- movapd coeff(%rip), %xmm3
- subsd %xmm2, %xmm5
- andl $16711680, %edx
- shrl $12, %edx
- movapd -1504(%r11,%rdx), %xmm0
- movapd 16+coeff(%rip), %xmm4
- addsd %xmm5, %xmm1
- movapd 32+coeff(%rip), %xmm2
- mulsd %xmm7, %xmm6
- pshufd $68, %xmm1, %xmm5
- mulsd 8+log2(%rip), %xmm7
- mulsd %xmm1, %xmm3
- addsd %xmm6, %xmm0
- mulpd %xmm5, %xmm4
- movq 8+LOG10_E(%rip), %xmm6
- mulpd %xmm5, %xmm5
- addpd %xmm2, %xmm4
- mulpd %xmm5, %xmm3
- pshufd $228, %xmm0, %xmm2
- addsd %xmm1, %xmm0
- mulsd %xmm1, %xmm4
- subsd %xmm0, %xmm2
- mulsd %xmm1, %xmm6
- addsd %xmm2, %xmm1
- pshufd $238, %xmm0, %xmm2
- mulsd %xmm5, %xmm5
- addsd %xmm2, %xmm7
- addsd %xmm6, %xmm1
- addpd %xmm3, %xmm4
- addsd %xmm7, %xmm1
- mulpd %xmm5, %xmm4
- addsd %xmm4, %xmm1
- pshufd $238, %xmm4, %xmm5
- addsd %xmm5, %xmm1
- addsd %xmm1, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_0.0.2:
- movq (%rsp), %xmm0
- movq (%rsp), %xmm1
- addl $16, %eax
- cmpl $32768, %eax
- jae .L_2TAG_PACKET_2.0.2
- cmpl $16, %eax
- jb .L_2TAG_PACKET_3.0.2
-.L_2TAG_PACKET_4.0.2:
- addsd %xmm0, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_5.0.2:
- ja .L_2TAG_PACKET_4.0.2
- cmpl $0, %edx
- ja .L_2TAG_PACKET_4.0.2
- jmp .L_2TAG_PACKET_6.0.2
-.L_2TAG_PACKET_3.0.2:
- xorpd %xmm1, %xmm1
- addsd %xmm0, %xmm1
- movd %xmm1, %edx
- psrlq $32, %xmm1
- movd %xmm1, %ecx
- orl %ecx, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_7.0.2
- xorpd %xmm1, %xmm1
- movl $18416, %eax
- pinsrw $3, %eax, %xmm1
- mulsd %xmm1, %xmm0
- xorpd %xmm2, %xmm2
- movl $16368, %eax
- pinsrw $3, %eax, %xmm2
- movq %xmm0, %xmm1
- pextrw $3, %xmm0, %eax
- orpd %xmm2, %xmm0
- movl $18416, %ecx
- psrlq $27, %xmm0
- movq LOG10_E(%rip), %xmm2
- psrld $2, %xmm0
- rcpps %xmm0, %xmm0
- psllq $12, %xmm1
- pshufd $78, %xmm5, %xmm6
- psrlq $12, %xmm1
- jmp .L_2TAG_PACKET_1.0.2
-.L_2TAG_PACKET_2.0.2:
- movd %xmm1, %edx
- psrlq $32, %xmm1
- movd %xmm1, %ecx
- addl %ecx, %ecx
- cmpl $-2097152, %ecx
- jae .L_2TAG_PACKET_5.0.2
- orl %ecx, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_6.0.2:
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $32752, %eax
- pinsrw $3, %eax, %xmm1
- mulsd %xmm1, %xmm0
- movl $9, 16(%rsp)
- jmp .L_2TAG_PACKET_8.0.2
-.L_2TAG_PACKET_7.0.2:
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $49136, %eax
- pinsrw $3, %eax, %xmm0
- divsd %xmm1, %xmm0
- movl $8, 16(%rsp)
-.L_2TAG_PACKET_8.0.2:
- movq %xmm0, 8(%rsp)
-..B1.3:
- movq 8(%rsp), %xmm0
-.L_2TAG_PACKET_9.0.2:
-..B1.5:
- addq $24, %rsp
-..___tag_value_log10.4:
- ret
-..___tag_value_log10.5:
-END(log10)
-# -- End log10
- .section .rodata, "a"
- .align 16
- .align 16
-HIGHSIGMASK:
- .long 4160749568
- .long 4294967295
- .long 0
- .long 4294959104
- .type HIGHSIGMASK,@object
- .size HIGHSIGMASK,16
- .align 16
-LOG10_E:
- .long 0
- .long 1071366144
- .long 3207479560
- .long 1062894188
- .type LOG10_E,@object
- .size LOG10_E,16
- .align 16
-L_tbl:
- .long 1352628224
- .long 1070810131
- .long 521319256
- .long 1025503025
- .long 2150839296
- .long 1070801944
- .long 3329350096
- .long 3170190015
- .long 1360613376
- .long 1070793794
- .long 2024059075
- .long 1024991594
- .long 1875350528
- .long 1070785680
- .long 2163882141
- .long 3163564137
- .long 2312126464
- .long 1070777602
- .long 1975711076
- .long 1023674196
- .long 1306336256
- .long 1070769560
- .long 3524899523
- .long 3170508164
- .long 1806334976
- .long 1070761553
- .long 4254777025
- .long 1025238739
- .long 2483193856
- .long 1070753581
- .long 3800671317
- .long 3172916830
- .long 2025350144
- .long 1070745644
- .long 1731514745
- .long 1025501083
- .long 3433285632
- .long 1070737741
- .long 2551857336
- .long 3169662186
- .long 1134317568
- .long 1070729873
- .long 3426297655
- .long 3172637891
- .long 2457152512
- .long 1070722038
- .long 63549415
- .long 1025415416
- .long 1861803008
- .long 1070714237
- .long 1910171636
- .long 1023977580
- .long 2414140416
- .long 1070706469
- .long 4002514337
- .long 3170841618
- .long 2900726784
- .long 1070698734
- .long 3268064083
- .long 1022459609
- .long 2123517952
- .long 1070691032
- .long 1767031218
- .long 1022448156
- .long 3194569728
- .long 1070683362
- .long 3402332618
- .long 3171671160
- .long 650882048
- .long 1070675725
- .long 4146023905
- .long 3171023038
- .long 1928988672
- .long 1070668119
- .long 1438617867
- .long 1016360491
- .long 1594908672
- .long 1070660545
- .long 971389377
- .long 1024763979
- .long 2818746368
- .long 1070653002
- .long 3555925341
- .long 3172434821
- .long 194584576
- .long 1070645491
- .long 943919215
- .long 3172950063
- .long 1215096832
- .long 1070638010
- .long 2283358588
- .long 1022335098
- .long 501519360
- .long 1070630560
- .long 480904295
- .long 1024437959
- .long 1278266368
- .long 1070623140
- .long 2755806066
- .long 3172342012
- .long 2487812096
- .long 1070615750
- .long 2489653202
- .long 3172481099
- .long 3085451264
- .long 1070608390
- .long 3759184951
- .long 3172574892
- .long 2039090176
- .long 1070601060
- .long 1361176676
- .long 3172355319
- .long 953057280
- .long 1070591423
- .long 1176587546
- .long 3166422018
- .long 3370524672
- .long 1070576879
- .long 3669570051
- .long 1025376630
- .long 749742080
- .long 1070562394
- .long 707700964
- .long 3170814058
- .long 4008353792
- .long 1070547965
- .long 3247327652
- .long 1022431400
- .long 2612455424
- .long 1070533594
- .long 2453457344
- .long 3172322969
- .long 3230920704
- .long 1070519279
- .long 1296781801
- .long 1025115335
- .long 3965253632
- .long 1070505020
- .long 373075289
- .long 1017938528
- .long 2593157120
- .long 1070476669
- .long 1068054086
- .long 1021616576
- .long 925962240
- .long 1070448537
- .long 850121213
- .long 1023928989
- .long 1732556800
- .long 1070420620
- .long 1305206740
- .long 3172665570
- .long 3815630848
- .long 1070392915
- .long 192642943
- .long 3172699907
- .long 2001758208
- .long 1070365420
- .long 2820786683
- .long 1024704867
- .long 16746496
- .long 1070338131
- .long 1399573110
- .long 3171372773
- .long 1886492672
- .long 1070311044
- .long 3621428075
- .long 3172974358
- .long 3338196992
- .long 1070284157
- .long 3793882035
- .long 1025124701
- .long 381769728
- .long 1070257468
- .long 3877933342
- .long 3170195490
- .long 2186491904
- .long 1070230972
- .long 1838687089
- .long 1017927292
- .long 1008330752
- .long 1070204668
- .long 2228321664
- .long 1025352196
- .long 2247065600
- .long 1070178552
- .long 1413900906
- .long 3170902532
- .long 2964070400
- .long 1070152622
- .long 3590454629
- .long 1025016844
- .long 465154048
- .long 1070126876
- .long 2079688550
- .long 3172268183
- .long 883615744
- .long 1070101310
- .long 989244452
- .long 3171900485
- .long 1993768960
- .long 1070075922
- .long 1124327841
- .long 3172964992
- .long 1794471936
- .long 1070050710
- .long 1140575046
- .long 1022673726
- .long 2797932544
- .long 1070025671
- .long 1894836933
- .long 3172544059
- .long 3433797632
- .long 1070000803
- .long 3221831166
- .long 3171921685
- .long 2338371584
- .long 1069976104
- .long 3732461053
- .long 3164513518
- .long 2644013056
- .long 1069951571
- .long 2519460462
- .long 3172548740
- .long 3383814144
- .long 1069927202
- .long 2290997657
- .long 1025499649
- .long 3781380096
- .long 1069902995
- .long 380479405
- .long 1025184136
- .long 3245785088
- .long 1069878948
- .long 1096398261
- .long 3169885192
- .long 1366712320
- .long 1069855059
- .long 2218343715
- .long 3170281628
- .long 2204717056
- .long 1069831325
- .long 2668334011
- .long 1025264524
- .long 1401772032
- .long 1069807745
- .long 4103993159
- .long 1022925721
- .long 3356721152
- .long 1069784316
- .long 3573790772
- .long 3172186527
- .long 4041148416
- .long 1069761037
- .long 4027691910
- .long 3171276990
- .long 3880151040
- .long 1069737906
- .long 4087118786
- .long 3172710734
- .long 3453364224
- .long 1069714921
- .long 99014299
- .long 3172003077
- .long 3491092480
- .long 1069692080
- .long 3801836701
- .long 3172989287
- .long 575580160
- .long 1069669382
- .long 1920406012
- .long 3170874125
- .long 22282240
- .long 1069646824
- .long 964193370
- .long 1019363159
- .long 2991429632
- .long 1069624404
- .long 3372589890
- .long 1023425053
- .long 2189645824
- .long 1069602122
- .long 2610503872
- .long 1023652442
- .long 3341467648
- .long 1069579975
- .long 1190292004
- .long 1022425665
- .long 3711293440
- .long 1069557962
- .long 1104795356
- .long 1023625829
- .long 1380401152
- .long 1069524644
- .long 1156998217
- .long 1025100499
- .long 765710336
- .long 1069481144
- .long 1736649113
- .long 1024999439
- .long 849412096
- .long 1069437902
- .long 2618178330
- .long 3170853629
- .long 1433104384
- .long 1069394915
- .long 43477267
- .long 3170378811
- .long 2548596736
- .long 1069352180
- .long 3967367063
- .long 1025246584
- .long 157577216
- .long 1069309695
- .long 100402533
- .long 3172825502
- .long 3326238720
- .long 1069267455
- .long 1176892909
- .long 1025464099
- .long 4155494400
- .long 1069225459
- .long 3713707617
- .long 3172630046
- .long 3545804800
- .long 1069183704
- .long 857007315
- .long 1024965777
- .long 2602520576
- .long 1069142187
- .long 2588758347
- .long 1022463131
- .long 2631196672
- .long 1069100905
- .long 2118424235
- .long 1022490989
- .long 838135808
- .long 1069059856
- .long 4117002727
- .long 1024874520
- .long 3210903552
- .long 1069019036
- .long 650070125
- .long 3172012966
- .long 3039211520
- .long 1068978444
- .long 438055812
- .long 1017743757
- .long 2385633280
- .long 1068938077
- .long 3011990369
- .long 3171312044
- .long 3491618816
- .long 1068897932
- .long 712813818
- .long 3172720400
- .long 183644160
- .long 1068858008
- .long 4287006742
- .long 1022379728
- .long 3639214080
- .long 1068818300
- .long 353762279
- .long 3172980009
- .long 3728416768
- .long 1068778808
- .long 1851367730
- .long 1025486574
- .long 3370094592
- .long 1068739529
- .long 4046594913
- .long 3172567047
- .long 1348407296
- .long 1068700461
- .long 143189675
- .long 1025397632
- .long 899403776
- .long 1068661601
- .long 3753687842
- .long 3170772772
- .long 1117708288
- .long 1068622947
- .long 1857340812
- .long 3170782678
- .long 1248276480
- .long 1068584497
- .long 1289858203
- .long 1025222289
- .long 683237376
- .long 1068546249
- .long 2356679608
- .long 3171629170
- .long 3253764096
- .long 1068508200
- .long 3267136556
- .long 1018554987
- .long 94478336
- .long 1068441756
- .long 1927868814
- .long 3169378180
- .long 3233144832
- .long 1068366445
- .long 2682188854
- .long 1023964004
- .long 2940297216
- .long 1068291522
- .long 275301289
- .long 1023944679
- .long 3677708288
- .long 1068216982
- .long 302658771
- .long 1024465567
- .long 1576968192
- .long 1068142822
- .long 3672035940
- .long 3172254610
- .long 1614069760
- .long 1068069037
- .long 480052905
- .long 3172692062
- .long 424435712
- .long 1067995624
- .long 2207869657
- .long 3170965436
- .long 3477782528
- .long 1067922578
- .long 2980661858
- .long 3164990018
- .long 3598401536
- .long 1067849897
- .long 1974393034
- .long 3171357083
- .long 2435235840
- .long 1067777577
- .long 1385289011
- .long 1024615823
- .long 1867333632
- .long 1067705614
- .long 3442236633
- .long 1025334384
- .long 3999301632
- .long 1067634004
- .long 3506472073
- .long 1025132546
- .long 2566971392
- .long 1067562745
- .long 1425757592
- .long 3172358463
- .long 112943104
- .long 1067491833
- .long 1693407156
- .long 3172426603
- .long 3079929856
- .long 1067392159
- .long 3999942455
- .long 1018549369
- .long 2443837440
- .long 1067251701
- .long 974534460
- .long 1023963412
- .long 359366656
- .long 1067111917
- .long 2204915018
- .long 1013514416
- .long 3564519424
- .long 1066972799
- .long 3977441659
- .long 3170879860
- .long 2011086848
- .long 1066834343
- .long 590145514
- .long 1025390011
- .long 3216982016
- .long 1066696541
- .long 3629120110
- .long 1024330313
- .long 2194128896
- .long 1066559388
- .long 2367098512
- .long 3172260338
- .long 2916220928
- .long 1066422877
- .long 2262431886
- .long 1021229446
- .long 2263941120
- .long 1066172214
- .long 3118507287
- .long 1021484970
- .long 3076292608
- .long 1065901726
- .long 1411737803
- .long 3172957147
- .long 1186136064
- .long 1065632488
- .long 3109349337
- .long 1025397383
- .long 3085303808
- .long 1065364487
- .long 584715031
- .long 3172596519
- .long 1821048832
- .long 1064842211
- .long 2182246895
- .long 3172536214
- .long 697368576
- .long 1064311094
- .long 3157561765
- .long 3172716357
- .long 894042112
- .long 1063260131
- .long 3237958154
- .long 3172587292
- .long 0
- .long 0
- .long 0
- .long 0
- .type L_tbl,@object
- .size L_tbl,2064
- .align 16
-log2:
- .long 1352628224
- .long 1066615827
- .long 521319256
- .long 1021308721
- .type log2,@object
- .size log2,16
- .align 16
-coeff:
- .long 3248877870
- .long 1077250164
- .long 1691676429
- .long 3221787401
- .long 945132465
- .long 3223701783
- .long 3700831335
- .long 1073506818
- .long 2141010593
- .long 1075227551
- .long 3698831637
- .long 3220339442
- .type coeff,@object
- .size coeff,48
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_log10.1-.
- .4byte ..___tag_value_log10.5-..___tag_value_log10.1
- .2byte 0x0400
- .4byte ..___tag_value_log10.3-..___tag_value_log10.1
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_log10.4-..___tag_value_log10.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/e_sinh.S b/libm/x86_64/e_sinh.S
deleted file mode 100644
index d5f7b16..0000000
--- a/libm/x86_64/e_sinh.S
+++ /dev/null
@@ -1,1430 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// sinh(x)=(exp(x)-exp(-x))/2
-//
-// Let |x|=xH+xL (upper 26 bits, lower 27 bits)
-// log2(e) rounded to 26 bits (high part) plus a double precision low part is
-// L2EH+L2EL (upper 26, lower 53 bits)
-//
-// Let xH*L2EH=k+f+r`, where (k+f)*2^7=int(xH*L2EH*2^7),
-// f=0.b1 b2 ... b7, k integer
-// 2^f is approximated as Tp[f]+Dp[f], and 2^{-f} as Tn[f]+Dn[f]
-// Tp stores the high 53 bits, Dp stores (2^f-Tp[f]) rounded to double precision
-//
-// e^|x|=2^{k+f}*2^r, r=r`+xL*L2EH+|x|*L2EL, |r|<2^{-8}+2^{-14},
-// for |x| in [23/64,3*2^7)
-// e^{-|x|}=2^{-k-f}*2^{-r}
-//
-// e^|x| is approximated as 2^k*Tp+2^k*Tp*c1*r(1+c2*r+..+c5*r^4)+2^k*Dp=
-// =2^k*Tp+2^k*Tp*P15+2^k*Dp
-// e^{-|x|} approximated as 2^{-k}*Tn-2^{-k}*Tn*c1*r(1-c2*r+..+c5*r^4)+2^{-k}*Dn
-//
-// For |x| in [1/8, 3*2^7), sinh(x) is formed as
-// RN(2^k*Tp-2^{-k}*Tn)+2^k*Tp*P15-2^{-k}*Tn*P`15-2^{-k}*TnL-2^{-k}*Dn+2^k*Dp
-//
-// For x in (3*2^7, 3*2^8), sign(x)*(e^|x|)/2 is returned, and
-// the result is checked for overflow.
-//
-// For |x|<23/64, a Taylor polynomial expansion is used (degree 13)
-// To reduce rounding errors, the p3*x^3 term is computed as
-// (p3*xh^3)_high+[(p3*xl*(3*x*xh+xl^2))+(p3*xh^3)_low],
-// where x=xh+xl, (xh are the leading 17 bits of x), and
-// (p3*xh^3)_high=RN(x+p3*xh^3)-x
-// (error bound for polynomial expansion is below 0.51 ulp)
-//
-// Special cases:
-// sinh(NaN) = quiet NaN, and raise invalid exception
-// sinh(+/-INF) = +/-INF
-// sinh(x) = x for subnormals
-// for finite argument, only sinh(0)=0 is exact
-// For IEEE double
-// sinh(x) overflows for x >
-// 710.47586007394386342639336362481117248535156250 = MAXLOG+log(2)
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin sinh
-ENTRY(sinh)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_sinh.1:
- pushq %rsi
-..___tag_value_sinh.3:
-..B1.2:
- movsd HALFMASK(%rip), %xmm3
- xorpd %xmm4, %xmm4
- movsd L2E(%rip), %xmm1
- movsd 8+L2E(%rip), %xmm2
- movl $32768, %eax
- pinsrw $3, %eax, %xmm4
- movsd Shifter(%rip), %xmm6
- pextrw $3, %xmm0, %ecx
- andpd %xmm0, %xmm3
- andnpd %xmm0, %xmm4
- pshufd $68, %xmm4, %xmm5
- movl $32768, %edx
- andl %ecx, %edx
- andl $32767, %ecx
- subl $16343, %ecx
- cmpl $177, %ecx
- jae .L_2TAG_PACKET_0.0.2
- subsd %xmm3, %xmm4
- mulsd %xmm1, %xmm3
- mulsd %xmm5, %xmm2
- cvtsd2si %xmm3, %eax
- shll $3, %edx
- orl %edx, %eax
- movq %xmm3, %xmm7
- addsd %xmm6, %xmm3
- mulsd %xmm4, %xmm1
- xorpd %xmm5, %xmm5
- subsd %xmm6, %xmm3
- movapd cv(%rip), %xmm4
- addsd %xmm1, %xmm2
- movapd 16+cv(%rip), %xmm6
- subsd %xmm3, %xmm7
- movl $32704, %edx
- pinsrw $3, %edx, %xmm5
- movapd 32+cv(%rip), %xmm1
- addsd %xmm7, %xmm2
- movl $127, %edx
- andl %eax, %edx
- addl %edx, %edx
- shrl $3, %eax
- andl $65520, %eax
- addl $16352, %eax
- xorpd %xmm0, %xmm0
- cmpl $161, %ecx
- jae .L_2TAG_PACKET_1.0.2
- pshufd $68, %xmm5, %xmm5
- pinsrw $3, %eax, %xmm0
- pshufd $68, %xmm0, %xmm0
- psubw %xmm0, %xmm5
- lea T2f(%rip), %r8
- mulpd (%r8,%rdx,8), %xmm0
- lea T2_neg_f(%rip), %r8
- mulpd (%r8,%rdx,8), %xmm5
- pshufd $68, %xmm2, %xmm3
- movapd 48+cv(%rip), %xmm7
- pshufd $68, %xmm2, %xmm2
- mulpd %xmm3, %xmm3
- mulpd %xmm2, %xmm4
- mulpd %xmm2, %xmm6
- mulpd 64+cv(%rip), %xmm2
- mulpd %xmm3, %xmm1
- mulpd %xmm3, %xmm7
- mulpd %xmm3, %xmm4
- mulpd %xmm3, %xmm1
- addpd %xmm7, %xmm6
- movq %xmm0, %xmm7
- addpd %xmm1, %xmm4
- shufpd $0, %xmm5, %xmm7
- subpd %xmm5, %xmm0
- mulpd %xmm7, %xmm2
- addpd %xmm6, %xmm4
- subsd %xmm0, %xmm7
- mulpd %xmm2, %xmm4
- pshufd $238, %xmm0, %xmm6
- subsd %xmm5, %xmm7
- addpd %xmm2, %xmm4
- addsd %xmm6, %xmm7
- pshufd $238, %xmm4, %xmm2
- addsd %xmm7, %xmm2
- addsd %xmm4, %xmm2
- addsd %xmm2, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_1.0.2:
- subl $16352, %eax
- movl %eax, %ecx
- andl $32752, %eax
- shrl $1, %eax
- andl $65520, %eax
- subl %eax, %ecx
- addl $16352, %eax
- pinsrw $3, %eax, %xmm0
- pshufd $68, %xmm0, %xmm0
- lea T2f(%rip), %r8
- mulpd (%r8,%rdx,8), %xmm0
- pshufd $68, %xmm2, %xmm3
- movsd 48+cv(%rip), %xmm7
- mulsd %xmm3, %xmm3
- mulsd %xmm2, %xmm4
- mulsd %xmm2, %xmm6
- mulsd 64+cv(%rip), %xmm2
- mulsd %xmm3, %xmm1
- mulsd %xmm3, %xmm7
- mulsd %xmm3, %xmm4
- addl $16368, %ecx
- pinsrw $3, %ecx, %xmm5
- mulsd %xmm3, %xmm1
- addsd %xmm7, %xmm6
- addsd %xmm1, %xmm4
- mulsd %xmm0, %xmm2
- addsd %xmm6, %xmm4
- mulsd %xmm2, %xmm4
- pshufd $238, %xmm0, %xmm6
- addsd %xmm6, %xmm4
- addsd %xmm4, %xmm2
- addsd %xmm2, %xmm0
- mulsd %xmm5, %xmm0
- pextrw $3, %xmm0, %eax
- andl $32752, %eax
- movl $127, %edx
- cmpl $32752, %eax
- je .L_2TAG_PACKET_2.0.2
- jmp ..B1.5
-.L_2TAG_PACKET_0.0.2:
- addl $16343, %ecx
- cmpl $16343, %ecx
- ja .L_2TAG_PACKET_3.0.2
- cmpl $15856, %ecx
- jb .L_2TAG_PACKET_4.0.2
- movapd pv(%rip), %xmm1
- pshufd $68, %xmm0, %xmm6
- mulpd %xmm5, %xmm5
- movapd 16+pv(%rip), %xmm2
- pshufd $68, %xmm0, %xmm7
- movapd 32+pv(%rip), %xmm3
- pshufd $68, %xmm0, %xmm4
- andpd MASK3(%rip), %xmm6
- mulpd %xmm5, %xmm1
- mulsd %xmm5, %xmm2
- subpd %xmm6, %xmm4
- mulpd %xmm5, %xmm7
- addpd %xmm3, %xmm1
- pshufd $68, %xmm6, %xmm3
- mulpd %xmm5, %xmm5
- mulsd %xmm7, %xmm2
- mulpd %xmm7, %xmm1
- pshufd $68, %xmm0, %xmm7
- mulsd %xmm6, %xmm6
- addsd %xmm7, %xmm7
- mulsd %xmm4, %xmm4
- mulpd %xmm5, %xmm1
- addsd %xmm0, %xmm7
- mulsd %xmm3, %xmm6
- mulsd %xmm3, %xmm7
- pshufd $238, %xmm1, %xmm3
- mulsd %xmm5, %xmm1
- pshufd $238, %xmm4, %xmm5
- addsd %xmm2, %xmm3
- pshufd $238, %xmm2, %xmm2
- addsd %xmm4, %xmm7
- movq %xmm0, %xmm4
- mulsd %xmm2, %xmm6
- mulsd %xmm5, %xmm7
- addsd %xmm6, %xmm0
- mulsd %xmm2, %xmm7
- subsd %xmm0, %xmm4
- addsd %xmm7, %xmm1
- addsd %xmm4, %xmm6
- addsd %xmm3, %xmm1
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_4.0.2:
- cmpl $16, %ecx
- jae .L_2TAG_PACKET_5.0.2
- movq %xmm0, %xmm1
- mulsd %xmm1, %xmm1
- jmp ..B1.5
-.L_2TAG_PACKET_5.0.2:
- xorpd %xmm2, %xmm2
- movl $17392, %ecx
- pinsrw $3, %ecx, %xmm2
- xorpd %xmm3, %xmm3
- movl $15344, %edx
- pinsrw $3, %edx, %xmm3
- mulsd %xmm0, %xmm2
- addsd %xmm2, %xmm0
- mulsd %xmm3, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_3.0.2:
- cmpl $32752, %ecx
- jae .L_2TAG_PACKET_6.0.2
- xorpd %xmm0, %xmm0
- movl $32736, %eax
- pinsrw $3, %eax, %xmm0
- orl %edx, %eax
- pinsrw $3, %eax, %xmm1
- mulsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_2.0.2
-.L_2TAG_PACKET_6.0.2:
- xorpd %xmm1, %xmm1
- movl $32768, %eax
- pinsrw $3, %eax, %xmm1
- andnpd %xmm0, %xmm1
- mulsd %xmm1, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_2.0.2:
- movq %xmm0, (%rsp)
-..B1.3:
- movq (%rsp), %xmm0
-.L_2TAG_PACKET_7.0.2:
-..B1.5:
- popq %rcx
-..___tag_value_sinh.4:
- ret
-..___tag_value_sinh.5:
-END(sinh)
-# -- End sinh
- .section .rodata, "a"
- .align 16
- .align 16
-L2E:
- .long 1610612736
- .long 1080497479
- .long 4166901572
- .long 1053077003
- .type L2E,@object
- .size L2E,16
- .align 16
-Shifter:
- .long 0
- .long 1127743488
- .long 0
- .long 3275227136
- .type Shifter,@object
- .size Shifter,16
- .align 16
-cv:
- .long 3607404736
- .long 1044146952
- .long 3607404736
- .long 3191630600
- .long 4277811695
- .long 1063661122
- .long 4277811695
- .long 3211144770
- .long 2140175755
- .long 1033864261
- .long 2140175755
- .long 1033864261
- .long 4289495988
- .long 1054113747
- .long 4289495988
- .long 1054113747
- .long 4277811695
- .long 1064709698
- .long 4277811695
- .long 1064709698
- .type cv,@object
- .size cv,80
- .align 16
-T2f:
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 2851812149
- .long 1072698941
- .long 2595802551
- .long 1016815913
- .long 1048019041
- .long 1072704666
- .long 1398474845
- .long 3161559171
- .long 3899555717
- .long 1072710421
- .long 427280750
- .long 3163595548
- .long 3541402996
- .long 1072716208
- .long 2759177317
- .long 1015903202
- .long 702412510
- .long 1072722027
- .long 3803266087
- .long 3163328991
- .long 410360776
- .long 1072727877
- .long 1269990655
- .long 1013024446
- .long 3402036099
- .long 1072733758
- .long 405889334
- .long 1016154232
- .long 1828292879
- .long 1072739672
- .long 1255956747
- .long 1016636974
- .long 728909815
- .long 1072745618
- .long 383930225
- .long 1016078044
- .long 852742562
- .long 1072751596
- .long 667253586
- .long 1010842135
- .long 2952712987
- .long 1072757606
- .long 3293494651
- .long 3161168877
- .long 3490863953
- .long 1072763649
- .long 960797498
- .long 3163997456
- .long 3228316108
- .long 1072769725
- .long 3010241991
- .long 3159471380
- .long 2930322912
- .long 1072775834
- .long 2599499422
- .long 3163762623
- .long 3366293073
- .long 1072781976
- .long 3119426314
- .long 1015169130
- .long 1014845819
- .long 1072788152
- .long 3117910646
- .long 3162607681
- .long 948735466
- .long 1072794361
- .long 3516338028
- .long 3163623459
- .long 3949972341
- .long 1072800603
- .long 2068408548
- .long 1015962444
- .long 2214878420
- .long 1072806880
- .long 892270087
- .long 3164164998
- .long 828946858
- .long 1072813191
- .long 10642492
- .long 1016988014
- .long 586995997
- .long 1072819536
- .long 41662348
- .long 3163676568
- .long 2288159958
- .long 1072825915
- .long 2169144469
- .long 1015924597
- .long 2440944790
- .long 1072832329
- .long 2492769774
- .long 1015196030
- .long 1853186616
- .long 1072838778
- .long 3066496371
- .long 1016705150
- .long 1337108031
- .long 1072845262
- .long 3203724452
- .long 1015726421
- .long 1709341917
- .long 1072851781
- .long 2571168217
- .long 1015201075
- .long 3790955393
- .long 1072858335
- .long 2352942462
- .long 3164228666
- .long 4112506593
- .long 1072864925
- .long 2947355221
- .long 1015419624
- .long 3504003472
- .long 1072871551
- .long 3594001060
- .long 3158379228
- .long 2799960843
- .long 1072878213
- .long 1423655381
- .long 1016070727
- .long 2839424854
- .long 1072884911
- .long 1171596163
- .long 1014090255
- .long 171030293
- .long 1072891646
- .long 3526460132
- .long 1015477354
- .long 4232894513
- .long 1072898416
- .long 2383938684
- .long 1015717095
- .long 2992903935
- .long 1072905224
- .long 2218154406
- .long 1016276769
- .long 1603444721
- .long 1072912069
- .long 1548633640
- .long 3163249902
- .long 926591435
- .long 1072918951
- .long 3208833762
- .long 3163962090
- .long 1829099622
- .long 1072925870
- .long 1016661181
- .long 3164509581
- .long 887463927
- .long 1072932827
- .long 3596744163
- .long 3161842742
- .long 3272845541
- .long 1072939821
- .long 928852419
- .long 3164536824
- .long 1276261410
- .long 1072946854
- .long 300981948
- .long 1015732745
- .long 78413852
- .long 1072953925
- .long 4183226867
- .long 3164065827
- .long 569847338
- .long 1072961034
- .long 472945272
- .long 3160339305
- .long 3645941911
- .long 1072968181
- .long 3814685081
- .long 3162621917
- .long 1617004845
- .long 1072975368
- .long 82804944
- .long 1011391354
- .long 3978100823
- .long 1072982593
- .long 3513027190
- .long 1016894539
- .long 3049340112
- .long 1072989858
- .long 3062915824
- .long 1014219171
- .long 4040676318
- .long 1072997162
- .long 4090609238
- .long 1016712034
- .long 3577096743
- .long 1073004506
- .long 2951496418
- .long 1014842263
- .long 2583551245
- .long 1073011890
- .long 3161094195
- .long 1016655067
- .long 1990012071
- .long 1073019314
- .long 3529070563
- .long 3163861769
- .long 2731501122
- .long 1073026778
- .long 1774031855
- .long 3163518597
- .long 1453150082
- .long 1073034283
- .long 498154669
- .long 3162536638
- .long 3395129871
- .long 1073041828
- .long 4025345435
- .long 3163383964
- .long 917841882
- .long 1073049415
- .long 18715565
- .long 1016707884
- .long 3566716925
- .long 1073057042
- .long 1536826856
- .long 1015191009
- .long 3712504873
- .long 1073064711
- .long 88491949
- .long 1016476236
- .long 2321106615
- .long 1073072422
- .long 2171176610
- .long 1010584347
- .long 363667784
- .long 1073080175
- .long 813753950
- .long 1016833785
- .long 3111574537
- .long 1073087969
- .long 2606161479
- .long 3163808322
- .long 2956612997
- .long 1073095806
- .long 2118169751
- .long 3163784129
- .long 885834528
- .long 1073103686
- .long 1973258547
- .long 3163310140
- .long 2186617381
- .long 1073111608
- .long 2270764084
- .long 3164321289
- .long 3561793907
- .long 1073119573
- .long 1157054053
- .long 1012938926
- .long 1719614413
- .long 1073127582
- .long 330458198
- .long 3164331316
- .long 1963711167
- .long 1073135634
- .long 1744767757
- .long 3161622870
- .long 1013258799
- .long 1073143730
- .long 1748797611
- .long 3161177658
- .long 4182873220
- .long 1073151869
- .long 629542646
- .long 3163044879
- .long 3907805044
- .long 1073160053
- .long 2257091225
- .long 3162598983
- .long 1218806132
- .long 1073168282
- .long 1818613052
- .long 3163597017
- .long 1447192521
- .long 1073176555
- .long 1462857171
- .long 3163563097
- .long 1339972927
- .long 1073184873
- .long 167908909
- .long 1016620728
- .long 1944781191
- .long 1073193236
- .long 3993278767
- .long 3162772855
- .long 19972402
- .long 1073201645
- .long 3507899862
- .long 1017057868
- .long 919555682
- .long 1073210099
- .long 3121969534
- .long 1013996802
- .long 1413356050
- .long 1073218599
- .long 1651349291
- .long 3163716742
- .long 2571947539
- .long 1073227145
- .long 3558159064
- .long 3164425245
- .long 1176749997
- .long 1073235738
- .long 2738998779
- .long 3163084420
- .long 2604962541
- .long 1073244377
- .long 2614425274
- .long 3164587768
- .long 3649726105
- .long 1073253063
- .long 4085036346
- .long 1016698050
- .long 1110089947
- .long 1073261797
- .long 1451641639
- .long 1016523249
- .long 380978316
- .long 1073270578
- .long 854188970
- .long 3161511262
- .long 2568320822
- .long 1073279406
- .long 2732824428
- .long 1015401491
- .long 194117574
- .long 1073288283
- .long 777528612
- .long 3164460665
- .long 2966275557
- .long 1073297207
- .long 2176155324
- .long 3160891335
- .long 3418903055
- .long 1073306180
- .long 2527457337
- .long 3161869180
- .long 2682146384
- .long 1073315202
- .long 2082178513
- .long 3164411995
- .long 1892288442
- .long 1073324273
- .long 2446255666
- .long 3163648957
- .long 2191782032
- .long 1073333393
- .long 2960257726
- .long 1014791238
- .long 434316067
- .long 1073342563
- .long 2028358766
- .long 1014506698
- .long 2069751141
- .long 1073351782
- .long 1562170675
- .long 3163773257
- .long 3964284211
- .long 1073361051
- .long 2111583915
- .long 1016475740
- .long 2990417245
- .long 1073370371
- .long 3683467745
- .long 3164417902
- .long 321958744
- .long 1073379742
- .long 3401933767
- .long 1016843134
- .long 1434058175
- .long 1073389163
- .long 251133233
- .long 1016134345
- .long 3218338682
- .long 1073398635
- .long 3404164304
- .long 3163525684
- .long 2572866477
- .long 1073408159
- .long 878562433
- .long 1016570317
- .long 697153126
- .long 1073417735
- .long 1283515429
- .long 3164331765
- .long 3092190715
- .long 1073427362
- .long 814012168
- .long 3160571998
- .long 2380618042
- .long 1073437042
- .long 3149557219
- .long 3164369375
- .long 4076559943
- .long 1073446774
- .long 2119478331
- .long 3161806927
- .long 815859274
- .long 1073456560
- .long 240396590
- .long 3164536019
- .long 2420883922
- .long 1073466398
- .long 2049810052
- .long 1015168464
- .long 1540824585
- .long 1073476290
- .long 1064017011
- .long 3164536266
- .long 3716502172
- .long 1073486235
- .long 2303740125
- .long 1015091301
- .long 1610600570
- .long 1073496235
- .long 3766732298
- .long 1016808759
- .long 777507147
- .long 1073506289
- .long 4282924205
- .long 1016236109
- .long 2483480501
- .long 1073516397
- .long 1216371780
- .long 1014082748
- .long 3706687593
- .long 1073526560
- .long 3521726940
- .long 1014301643
- .long 1432208378
- .long 1073536779
- .long 1401068914
- .long 3163412539
- .long 1242007932
- .long 1073547053
- .long 1132034716
- .long 3164388407
- .long 135105010
- .long 1073557383
- .long 1906148728
- .long 3164424315
- .long 3707479175
- .long 1073567768
- .long 3613079303
- .long 1015213314
- .long 382305176
- .long 1073578211
- .long 2347622376
- .long 3163627201
- .long 64696965
- .long 1073588710
- .long 1768797490
- .long 1016865536
- .long 4076975200
- .long 1073599265
- .long 2029000899
- .long 1016257111
- .long 863738719
- .long 1073609879
- .long 1326992220
- .long 3163661773
- .long 351641897
- .long 1073620550
- .long 2172261526
- .long 3164059175
- .long 3884662774
- .long 1073631278
- .long 2158611599
- .long 1015258761
- .long 4224142467
- .long 1073642065
- .long 3389820386
- .long 1016255778
- .long 2728693978
- .long 1073652911
- .long 396109971
- .long 3164511267
- .long 764307441
- .long 1073663816
- .long 3021057420
- .long 3164378099
- .long 3999357479
- .long 1073674779
- .long 2258941616
- .long 1016973300
- .long 929806999
- .long 1073685803
- .long 3205336643
- .long 1016308133
- .long 1533953344
- .long 1073696886
- .long 769171851
- .long 1016714209
- .long 2912730644
- .long 1073708029
- .long 3490067722
- .long 3164453650
- .long 2174652632
- .long 1073719233
- .long 4087714590
- .long 1015498835
- .long 730821105
- .long 1073730498
- .long 2523232743
- .long 1013115764
- .type T2f,@object
- .size T2f,2048
- .align 16
-T2_neg_f:
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 730821105
- .long 1072681922
- .long 2523232743
- .long 1012067188
- .long 2174652632
- .long 1072670657
- .long 4087714590
- .long 1014450259
- .long 2912730644
- .long 1072659453
- .long 3490067722
- .long 3163405074
- .long 1533953344
- .long 1072648310
- .long 769171851
- .long 1015665633
- .long 929806999
- .long 1072637227
- .long 3205336643
- .long 1015259557
- .long 3999357479
- .long 1072626203
- .long 2258941616
- .long 1015924724
- .long 764307441
- .long 1072615240
- .long 3021057420
- .long 3163329523
- .long 2728693978
- .long 1072604335
- .long 396109971
- .long 3163462691
- .long 4224142467
- .long 1072593489
- .long 3389820386
- .long 1015207202
- .long 3884662774
- .long 1072582702
- .long 2158611599
- .long 1014210185
- .long 351641897
- .long 1072571974
- .long 2172261526
- .long 3163010599
- .long 863738719
- .long 1072561303
- .long 1326992220
- .long 3162613197
- .long 4076975200
- .long 1072550689
- .long 2029000899
- .long 1015208535
- .long 64696965
- .long 1072540134
- .long 1768797490
- .long 1015816960
- .long 382305176
- .long 1072529635
- .long 2347622376
- .long 3162578625
- .long 3707479175
- .long 1072519192
- .long 3613079303
- .long 1014164738
- .long 135105010
- .long 1072508807
- .long 1906148728
- .long 3163375739
- .long 1242007932
- .long 1072498477
- .long 1132034716
- .long 3163339831
- .long 1432208378
- .long 1072488203
- .long 1401068914
- .long 3162363963
- .long 3706687593
- .long 1072477984
- .long 3521726940
- .long 1013253067
- .long 2483480501
- .long 1072467821
- .long 1216371780
- .long 1013034172
- .long 777507147
- .long 1072457713
- .long 4282924205
- .long 1015187533
- .long 1610600570
- .long 1072447659
- .long 3766732298
- .long 1015760183
- .long 3716502172
- .long 1072437659
- .long 2303740125
- .long 1014042725
- .long 1540824585
- .long 1072427714
- .long 1064017011
- .long 3163487690
- .long 2420883922
- .long 1072417822
- .long 2049810052
- .long 1014119888
- .long 815859274
- .long 1072407984
- .long 240396590
- .long 3163487443
- .long 4076559943
- .long 1072398198
- .long 2119478331
- .long 3160758351
- .long 2380618042
- .long 1072388466
- .long 3149557219
- .long 3163320799
- .long 3092190715
- .long 1072378786
- .long 814012168
- .long 3159523422
- .long 697153126
- .long 1072369159
- .long 1283515429
- .long 3163283189
- .long 2572866477
- .long 1072359583
- .long 878562433
- .long 1015521741
- .long 3218338682
- .long 1072350059
- .long 3404164304
- .long 3162477108
- .long 1434058175
- .long 1072340587
- .long 251133233
- .long 1015085769
- .long 321958744
- .long 1072331166
- .long 3401933767
- .long 1015794558
- .long 2990417245
- .long 1072321795
- .long 3683467745
- .long 3163369326
- .long 3964284211
- .long 1072312475
- .long 2111583915
- .long 1015427164
- .long 2069751141
- .long 1072303206
- .long 1562170675
- .long 3162724681
- .long 434316067
- .long 1072293987
- .long 2028358766
- .long 1013458122
- .long 2191782032
- .long 1072284817
- .long 2960257726
- .long 1013742662
- .long 1892288442
- .long 1072275697
- .long 2446255666
- .long 3162600381
- .long 2682146384
- .long 1072266626
- .long 2082178513
- .long 3163363419
- .long 3418903055
- .long 1072257604
- .long 2527457337
- .long 3160820604
- .long 2966275557
- .long 1072248631
- .long 2176155324
- .long 3159842759
- .long 194117574
- .long 1072239707
- .long 777528612
- .long 3163412089
- .long 2568320822
- .long 1072230830
- .long 2732824428
- .long 1014352915
- .long 380978316
- .long 1072222002
- .long 854188970
- .long 3160462686
- .long 1110089947
- .long 1072213221
- .long 1451641639
- .long 1015474673
- .long 3649726105
- .long 1072204487
- .long 4085036346
- .long 1015649474
- .long 2604962541
- .long 1072195801
- .long 2614425274
- .long 3163539192
- .long 1176749997
- .long 1072187162
- .long 2738998779
- .long 3162035844
- .long 2571947539
- .long 1072178569
- .long 3558159064
- .long 3163376669
- .long 1413356050
- .long 1072170023
- .long 1651349291
- .long 3162668166
- .long 919555682
- .long 1072161523
- .long 3121969534
- .long 1012948226
- .long 19972402
- .long 1072153069
- .long 3507899862
- .long 1016009292
- .long 1944781191
- .long 1072144660
- .long 3993278767
- .long 3161724279
- .long 1339972927
- .long 1072136297
- .long 167908909
- .long 1015572152
- .long 1447192521
- .long 1072127979
- .long 1462857171
- .long 3162514521
- .long 1218806132
- .long 1072119706
- .long 1818613052
- .long 3162548441
- .long 3907805044
- .long 1072111477
- .long 2257091225
- .long 3161550407
- .long 4182873220
- .long 1072103293
- .long 629542646
- .long 3161996303
- .long 1013258799
- .long 1072095154
- .long 1748797611
- .long 3160129082
- .long 1963711167
- .long 1072087058
- .long 1744767757
- .long 3160574294
- .long 1719614413
- .long 1072079006
- .long 330458198
- .long 3163282740
- .long 3561793907
- .long 1072070997
- .long 1157054053
- .long 1011890350
- .long 2186617381
- .long 1072063032
- .long 2270764084
- .long 3163272713
- .long 885834528
- .long 1072055110
- .long 1973258547
- .long 3162261564
- .long 2956612997
- .long 1072047230
- .long 2118169751
- .long 3162735553
- .long 3111574537
- .long 1072039393
- .long 2606161479
- .long 3162759746
- .long 363667784
- .long 1072031599
- .long 813753950
- .long 1015785209
- .long 2321106615
- .long 1072023846
- .long 2171176610
- .long 1009535771
- .long 3712504873
- .long 1072016135
- .long 88491949
- .long 1015427660
- .long 3566716925
- .long 1072008466
- .long 1536826856
- .long 1014142433
- .long 917841882
- .long 1072000839
- .long 18715565
- .long 1015659308
- .long 3395129871
- .long 1071993252
- .long 4025345435
- .long 3162335388
- .long 1453150082
- .long 1071985707
- .long 498154669
- .long 3161488062
- .long 2731501122
- .long 1071978202
- .long 1774031855
- .long 3162470021
- .long 1990012071
- .long 1071970738
- .long 3529070563
- .long 3162813193
- .long 2583551245
- .long 1071963314
- .long 3161094195
- .long 1015606491
- .long 3577096743
- .long 1071955930
- .long 2951496418
- .long 1013793687
- .long 4040676318
- .long 1071948586
- .long 4090609238
- .long 1015663458
- .long 3049340112
- .long 1071941282
- .long 3062915824
- .long 1013170595
- .long 3978100823
- .long 1071934017
- .long 3513027190
- .long 1015845963
- .long 1617004845
- .long 1071926792
- .long 82804944
- .long 1010342778
- .long 3645941911
- .long 1071919605
- .long 3814685081
- .long 3161573341
- .long 569847338
- .long 1071912458
- .long 472945272
- .long 3159290729
- .long 78413852
- .long 1071905349
- .long 4183226867
- .long 3163017251
- .long 1276261410
- .long 1071898278
- .long 300981948
- .long 1014684169
- .long 3272845541
- .long 1071891245
- .long 928852419
- .long 3163488248
- .long 887463927
- .long 1071884251
- .long 3596744163
- .long 3160794166
- .long 1829099622
- .long 1071877294
- .long 1016661181
- .long 3163461005
- .long 926591435
- .long 1071870375
- .long 3208833762
- .long 3162913514
- .long 1603444721
- .long 1071863493
- .long 1548633640
- .long 3162201326
- .long 2992903935
- .long 1071856648
- .long 2218154406
- .long 1015228193
- .long 4232894513
- .long 1071849840
- .long 2383938684
- .long 1014668519
- .long 171030293
- .long 1071843070
- .long 3526460132
- .long 1014428778
- .long 2839424854
- .long 1071836335
- .long 1171596163
- .long 1013041679
- .long 2799960843
- .long 1071829637
- .long 1423655381
- .long 1015022151
- .long 3504003472
- .long 1071822975
- .long 3594001060
- .long 3157330652
- .long 4112506593
- .long 1071816349
- .long 2947355221
- .long 1014371048
- .long 3790955393
- .long 1071809759
- .long 2352942462
- .long 3163180090
- .long 1709341917
- .long 1071803205
- .long 2571168217
- .long 1014152499
- .long 1337108031
- .long 1071796686
- .long 3203724452
- .long 1014677845
- .long 1853186616
- .long 1071790202
- .long 3066496371
- .long 1015656574
- .long 2440944790
- .long 1071783753
- .long 2492769774
- .long 1014147454
- .long 2288159958
- .long 1071777339
- .long 2169144469
- .long 1014876021
- .long 586995997
- .long 1071770960
- .long 41662348
- .long 3162627992
- .long 828946858
- .long 1071764615
- .long 10642492
- .long 1015939438
- .long 2214878420
- .long 1071758304
- .long 892270087
- .long 3163116422
- .long 3949972341
- .long 1071752027
- .long 2068408548
- .long 1014913868
- .long 948735466
- .long 1071745785
- .long 3516338028
- .long 3162574883
- .long 1014845819
- .long 1071739576
- .long 3117910646
- .long 3161559105
- .long 3366293073
- .long 1071733400
- .long 3119426314
- .long 1014120554
- .long 2930322912
- .long 1071727258
- .long 2599499422
- .long 3162714047
- .long 3228316108
- .long 1071721149
- .long 3010241991
- .long 3158422804
- .long 3490863953
- .long 1071715073
- .long 960797498
- .long 3162948880
- .long 2952712987
- .long 1071709030
- .long 3293494651
- .long 3160120301
- .long 852742562
- .long 1071703020
- .long 667253586
- .long 1009793559
- .long 728909815
- .long 1071697042
- .long 383930225
- .long 1015029468
- .long 1828292879
- .long 1071691096
- .long 1255956747
- .long 1015588398
- .long 3402036099
- .long 1071685182
- .long 405889334
- .long 1015105656
- .long 410360776
- .long 1071679301
- .long 1269990655
- .long 1011975870
- .long 702412510
- .long 1071673451
- .long 3803266087
- .long 3162280415
- .long 3541402996
- .long 1071667632
- .long 2759177317
- .long 1014854626
- .long 3899555717
- .long 1071661845
- .long 427280750
- .long 3162546972
- .long 1048019041
- .long 1071656090
- .long 1398474845
- .long 3160510595
- .long 2851812149
- .long 1071650365
- .long 2595802551
- .long 1015767337
- .type T2_neg_f,@object
- .size T2_neg_f,2048
- .align 16
-pv:
- .long 329805064
- .long 1038488134
- .long 2773927730
- .long 1053236707
- .long 286331153
- .long 1065423121
- .long 1431655765
- .long 1069897045
- .long 1744127201
- .long 1046144581
- .long 436314137
- .long 1059717536
- .type pv,@object
- .size pv,48
- .align 16
-MASK3:
- .long 0
- .long 4294967280
- .long 0
- .long 4294967280
- .type MASK3,@object
- .size MASK3,16
- .align 8
-HALFMASK:
- .long 4160749568
- .long 2147483647
- .type HALFMASK,@object
- .size HALFMASK,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_sinh.1-.
- .4byte ..___tag_value_sinh.5-..___tag_value_sinh.1
- .2byte 0x0400
- .4byte ..___tag_value_sinh.3-..___tag_value_sinh.1
- .2byte 0x100e
- .byte 0x04
- .4byte ..___tag_value_sinh.4-..___tag_value_sinh.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/floor.S b/libm/x86_64/floor.S
deleted file mode 100644
index dc80e88..0000000
--- a/libm/x86_64/floor.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(floor)
-roundsd $0x1,%xmm0,%xmm0
-retq
-END(floor)
diff --git a/libm/x86_64/floorf.S b/libm/x86_64/floorf.S
deleted file mode 100644
index 832f9c5..0000000
--- a/libm/x86_64/floorf.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(floorf)
-roundss $0x1,%xmm0,%xmm0
-retq
-END(floorf)
diff --git a/libm/x86_64/rint.S b/libm/x86_64/rint.S
deleted file mode 100644
index 9731daa..0000000
--- a/libm/x86_64/rint.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(rint)
- roundsd $0x4,%xmm0,%xmm0
- retq
-END(rint)
diff --git a/libm/x86_64/rintf.S b/libm/x86_64/rintf.S
deleted file mode 100644
index c3e98bf..0000000
--- a/libm/x86_64/rintf.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(rintf)
- roundss $0x4,%xmm0,%xmm0
- retq
-END(rintf)
diff --git a/libm/x86_64/s_atan.S b/libm/x86_64/s_atan.S
deleted file mode 100644
index d0e5d72..0000000
--- a/libm/x86_64/s_atan.S
+++ /dev/null
@@ -1,927 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// This implementation uses the main path for |x| in [2^{-5},2^65).
-// For |x| in [2^{-64},2^{-5}), a secondary path is used.
-// For the biased exponent of X within 3FFH-64 and 3FF+64, we use one branch.
-// We use the following definition of B and X` so that the formula
-// atan(X) = Tau + atan( (X`-B) / (One + BX) ) is correct
-//
-// X = (-1)^s * 2^k * 1. x1 x2 ... x52
-//
-// Define X` = 0 if k >= 5; and X` = |X| otherwise
-// Define One = 0 if k >= 5; and One = 1 otherwise
-// Define B = 0 if k <= -6; B = 2^k * 1.x1 x2 x3 x4 1 if -5 <= k <= 4
-// Define B = 2^5 * 1.0 0 ... 0 if k >= 5
-//
-// Tau is 0 if k <= -6;
-// Tau is atan( B ) if -5 <= k <= 4
-// Tau is pi/2 if k >= 5
-//
-// Special cases:
-// atan(NaN) = quiet NaN
-// atan(+/-INF) = +/-Pi/2
-// atan(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin atan
-ENTRY(atan)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_atan.1:
- pushq %rsi
-..___tag_value_atan.3:
- movsd %xmm0, (%rsp)
-..B1.2:
- movq $0xffff000000000000, %r8
- movd %r8, %xmm3
- movq ONEMASK(%rip), %xmm5
- movq $0x800000000000, %r9
- movd %r9, %xmm4
- pextrw $3, %xmm0, %edx
- andpd %xmm0, %xmm3
- pshufd $68, %xmm0, %xmm1
- orpd %xmm4, %xmm3
- movl %edx, %eax
- andl $32767, %edx
- subl $16288, %edx
- cmpl $159, %edx
- ja .L_2TAG_PACKET_0.0.1
- mulsd %xmm3, %xmm1
- subsd %xmm3, %xmm0
- addsd %xmm5, %xmm1
- divsd %xmm1, %xmm0
- addl $1, %edx
- movq a2(%rip), %xmm2
- movq b2(%rip), %xmm4
- andl $32768, %eax
- xorpd %xmm7, %xmm7
- pinsrw $3, %eax, %xmm7
- addl %edx, %edx
- lea atan_tbl(%rip), %r8
- movq (%r8,%rdx,8), %xmm6
- movq 8(%r8,%rdx,8), %xmm5
- xorpd %xmm7, %xmm5
- xorpd %xmm7, %xmm6
- movq 8+a2(%rip), %xmm7
- movddup %xmm0, %xmm1
- mulsd %xmm0, %xmm0
- movddup %xmm1, %xmm3
- addsd %xmm6, %xmm1
- mulsd %xmm0, %xmm2
- addsd %xmm0, %xmm4
- subsd %xmm1, %xmm6
- mulsd %xmm0, %xmm4
- addsd %xmm7, %xmm2
- mulsd %xmm3, %xmm0
- addsd %xmm3, %xmm6
- mulsd %xmm2, %xmm0
- addsd 8+b2(%rip), %xmm4
- addsd %xmm5, %xmm6
- mulsd %xmm4, %xmm0
- addsd %xmm6, %xmm0
- addsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_1.0.1
-.L_2TAG_PACKET_0.0.1:
- addl $944, %edx
- cmpl $1103, %edx
- ja .L_2TAG_PACKET_2.0.1
- movq a2(%rip), %xmm4
- movq b2(%rip), %xmm7
- movq (%rsp), %xmm0
- mulsd %xmm1, %xmm1
- movq 8+a2(%rip), %xmm2
- movq 8+b2(%rip), %xmm5
- mulsd %xmm1, %xmm4
- addsd %xmm1, %xmm7
- movq %xmm1, %xmm6
- mulsd %xmm0, %xmm1
- addsd %xmm4, %xmm2
- mulsd %xmm6, %xmm7
- mulsd %xmm1, %xmm2
- addsd %xmm5, %xmm7
- mulsd %xmm7, %xmm2
- addsd %xmm2, %xmm0
- jmp .L_2TAG_PACKET_1.0.1
-.L_2TAG_PACKET_2.0.1:
- addl $15344, %edx
- cmpl $16368, %edx
- ja .L_2TAG_PACKET_3.0.1
- movq (%rsp), %xmm0
- movq (%rsp), %xmm1
- cmpl $16, %edx
- jae .L_2TAG_PACKET_1.0.1
- mulsd %xmm0, %xmm1
- jmp .L_2TAG_PACKET_1.0.1
-.L_2TAG_PACKET_3.0.1:
- cmpl $17392, %edx
- jae .L_2TAG_PACKET_4.0.1
- movq $0xbff0000000000000, %r8
- movd %r8, %xmm1
- divsd %xmm0, %xmm1
- movq a2(%rip), %xmm2
- movq b2(%rip), %xmm4
- andl $32768, %eax
- xorpd %xmm7, %xmm7
- pinsrw $3, %eax, %xmm7
- addl %edx, %edx
- movq pi_table(%rip), %xmm6
- movq 8+pi_table(%rip), %xmm5
- xorpd %xmm7, %xmm5
- xorpd %xmm7, %xmm6
- movq 8+a2(%rip), %xmm7
- movddup %xmm1, %xmm0
- mulsd %xmm1, %xmm1
- movddup %xmm0, %xmm3
- addsd %xmm6, %xmm0
- mulsd %xmm1, %xmm2
- addsd %xmm1, %xmm4
- subsd %xmm0, %xmm6
- mulsd %xmm1, %xmm4
- addsd %xmm7, %xmm2
- mulsd %xmm3, %xmm1
- addsd %xmm3, %xmm6
- mulsd %xmm2, %xmm1
- addsd 8+b2(%rip), %xmm4
- addsd %xmm5, %xmm6
- mulsd %xmm4, %xmm1
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_1.0.1
-.L_2TAG_PACKET_4.0.1:
- movq (%rsp), %xmm4
- movq SGNMASK(%rip), %xmm0
- movq pi_table(%rip), %xmm2
- movq 8+pi_table(%rip), %xmm3
- movd %xmm1, %eax
- psrlq $32, %xmm1
- movd %xmm1, %edx
- andl $2147483647, %edx
- cmpl $2146435072, %edx
- jae .L_2TAG_PACKET_5.0.1
-.L_2TAG_PACKET_6.0.1:
- andnpd %xmm4, %xmm0
- orpd %xmm0, %xmm2
- orpd %xmm3, %xmm0
- addsd %xmm2, %xmm0
- jmp .L_2TAG_PACKET_1.0.1
-.L_2TAG_PACKET_5.0.1:
- subl $2146435072, %edx
- orl %edx, %eax
- cmpl $0, %eax
- je .L_2TAG_PACKET_6.0.1
- movq %xmm4, %xmm0
- addsd %xmm0, %xmm0
-.L_2TAG_PACKET_1.0.1:
-..B1.3:
- popq %rcx
-..___tag_value_atan.4:
- ret
-..___tag_value_atan.5:
-END(atan)
-# -- End atan
- .section .rodata, "a"
- .align 4
- .align 4
-ONEMASK:
- .long 0
- .long 1072693248
- .type ONEMASK,@object
- .size ONEMASK,8
- .align 4
-a2:
- .long 2006262985
- .long 1069310863
- .long 2358449471
- .long 3217342131
- .type a2,@object
- .size a2,16
- .align 4
-b2:
- .long 3845454352
- .long 1069952297
- .long 2829679149
- .long 1073771565
- .type b2,@object
- .size b2,16
- .align 4
-atan_tbl:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3819695742
- .long 1067482761
- .long 2398680355
- .long 3155462074
- .long 2998791009
- .long 1067548225
- .long 3868465248
- .long 3157182472
- .long 3339424991
- .long 1067613680
- .long 3296670360
- .long 1010752543
- .long 2710002256
- .long 1067679126
- .long 3403896007
- .long 1010910768
- .long 3275701428
- .long 1067744562
- .long 119959933
- .long 1011482843
- .long 2908636881
- .long 1067809988
- .long 2464489612
- .long 1011545526
- .long 3777889398
- .long 1067875403
- .long 3262682165
- .long 1009703919
- .long 3759667419
- .long 1067940807
- .long 1838130851
- .long 3157373556
- .long 732369940
- .long 1068006200
- .long 1203428313
- .long 1010055371
- .long 1166616461
- .long 1068071580
- .long 2901274051
- .long 3158549977
- .long 2945472892
- .long 1068136947
- .long 3726120658
- .long 1009762715
- .long 3954480976
- .long 1068202301
- .long 1289173457
- .long 1009429861
- .long 2081752829
- .long 1068267642
- .long 1836909874
- .long 1006212095
- .long 3807999788
- .long 1068332968
- .long 2172459940
- .long 3156162078
- .long 2731789884
- .long 1068398280
- .long 3450718392
- .long 3159216547
- .long 1044477961
- .long 1068463577
- .long 2230553229
- .long 1011424339
- .long 1486930287
- .long 1068530218
- .long 2861547474
- .long 1012041376
- .long 2293016881
- .long 1068595466
- .long 136843272
- .long 1012684797
- .long 201518157
- .long 1068660680
- .long 63231984
- .long 1012427198
- .long 4054234584
- .long 1068725856
- .long 3927006960
- .long 1011878955
- .long 1246477213
- .long 1068790995
- .long 1494265652
- .long 3155219350
- .long 678186699
- .long 1068856093
- .long 1264361424
- .long 3159256693
- .long 2690594995
- .long 1068921148
- .long 3906996379
- .long 1009288267
- .long 3362611517
- .long 1068986159
- .long 1650970041
- .long 3158331771
- .long 3102162111
- .long 1069051124
- .long 365917035
- .long 3160264153
- .long 2352611067
- .long 1069116041
- .long 4008970190
- .long 3159478182
- .long 1594134794
- .long 1069180908
- .long 466690178
- .long 1012526501
- .long 1345079306
- .long 1069245723
- .long 2268273568
- .long 3160164092
- .long 2163300970
- .long 1069310484
- .long 2750834800
- .long 3158113482
- .long 352522716
- .long 1069375190
- .long 1750411372
- .long 1011790845
- .long 848541647
- .long 1069439838
- .long 2164207573
- .long 1011698350
- .long 40647312
- .long 1069504427
- .long 2949165434
- .long 3159107267
- .long 2216766270
- .long 1069574357
- .long 2197920765
- .long 3161055954
- .long 1090914384
- .long 1069638757
- .long 2330454674
- .long 1013365998
- .long 387601244
- .long 1069703022
- .long 3185681168
- .long 1013434071
- .long 3991640484
- .long 1069767144
- .long 1313211590
- .long 3161087959
- .long 3322489502
- .long 1069831118
- .long 3013977995
- .long 1013053011
- .long 3121698570
- .long 1069894936
- .long 4069015667
- .long 1013023362
- .long 4289964660
- .long 1069958591
- .long 1736191156
- .long 3158266731
- .long 3903312386
- .long 1070022077
- .long 1833592413
- .long 3159731471
- .long 3818449864
- .long 1070085387
- .long 851036429
- .long 3159730451
- .long 2097480306
- .long 1070148515
- .long 3506390884
- .long 3160462302
- .long 1611694502
- .long 1070211454
- .long 2785735540
- .long 3160465144
- .long 1464694796
- .long 1070274198
- .long 4229277299
- .long 3159907000
- .long 1299612775
- .long 1070336741
- .long 4116653788
- .long 3160427739
- .long 1310544789
- .long 1070399077
- .long 1064430331
- .long 1013218202
- .long 2253168030
- .long 1070461200
- .long 1405044609
- .long 3157623179
- .long 1159567373
- .long 1070523105
- .long 2353445521
- .long 3159992176
- .long 1359373750
- .long 1070605818
- .long 1748171336
- .long 3161879263
- .long 908341706
- .long 1070667034
- .long 3372710815
- .long 3161775245
- .long 1743027350
- .long 1070727765
- .long 687089934
- .long 3160507171
- .long 2055355646
- .long 1070787992
- .long 2392855242
- .long 1013682469
- .long 690426164
- .long 1070847697
- .long 1103926666
- .long 1014052810
- .long 1483247847
- .long 1070906862
- .long 2082645847
- .long 3161345479
- .long 392040270
- .long 1070965472
- .long 2407720023
- .long 1014053754
- .long 2673846014
- .long 1071023511
- .long 1293605532
- .long 3158464385
- .long 1384215810
- .long 1071080967
- .long 2446095872
- .long 3159216407
- .long 3101660631
- .long 1071137826
- .long 698040758
- .long 1014855328
- .long 2094057058
- .long 1071194078
- .long 2282048339
- .long 1014040385
- .long 1712750594
- .long 1071249712
- .long 1204372378
- .long 3162276464
- .long 1411515787
- .long 1071304719
- .long 949080808
- .long 1015006403
- .long 931538085
- .long 1071359091
- .long 3027127039
- .long 1014307233
- .long 179139065
- .long 1071412821
- .long 4285547492
- .long 3161934731
- .long 3387721259
- .long 1071465902
- .long 373225773
- .long 1013486625
- .long 2132236852
- .long 1071544299
- .long 3250533429
- .long 1014031677
- .long 1942070284
- .long 1071645596
- .long 1237964179
- .long 3163239113
- .long 1532707802
- .long 1071695380
- .long 330645583
- .long 1012495610
- .long 2294184979
- .long 1071743834
- .long 3959472897
- .long 1015833116
- .long 3805060714
- .long 1071790961
- .long 2671256142
- .long 1013727772
- .long 2215037898
- .long 1071836770
- .long 2683359117
- .long 1015831902
- .long 483661594
- .long 1071881273
- .long 836288326
- .long 3162648643
- .long 1534679894
- .long 1071924486
- .long 373258696
- .long 3162470096
- .long 1538714628
- .long 1071966430
- .long 3199433068
- .long 1015325501
- .long 527642555
- .long 1072007128
- .long 3636832592
- .long 3161843145
- .long 291339150
- .long 1072046605
- .long 890169537
- .long 3160586117
- .long 2450210201
- .long 1072084888
- .long 1636353294
- .long 3163193400
- .long 2411367951
- .long 1072122007
- .long 374899873
- .long 1011331750
- .long 681549971
- .long 1072157992
- .long 506411689
- .long 1015373954
- .long 1466745541
- .long 1072192873
- .long 2143860931
- .long 1013364334
- .long 2845622366
- .long 1072226682
- .long 2869178209
- .long 3162423682
- .long 2838871438
- .long 1072275456
- .long 3742223599
- .long 1014338577
- .long 4200275274
- .long 1072337034
- .long 1566539915
- .long 3161839550
- .long 3034733530
- .long 1072394897
- .long 652621408
- .long 3162261964
- .long 3207412993
- .long 1072449290
- .long 3206124665
- .long 1014408733
- .long 624461478
- .long 1072500450
- .long 932437485
- .long 1015204343
- .long 767665908
- .long 1072548600
- .long 1037911952
- .long 3163527627
- .long 1110773639
- .long 1072593952
- .long 2371517912
- .long 3160465741
- .long 1940828530
- .long 1072636704
- .long 2731408428
- .long 3162895795
- .long 1911329388
- .long 1072677041
- .long 1773089615
- .long 3159569267
- .long 1764715788
- .long 1072704191
- .long 691346949
- .long 3164069946
- .long 3332979233
- .long 1072722195
- .long 3550733983
- .long 1014770628
- .long 1321870254
- .long 1072739231
- .long 1415315820
- .long 1016224052
- .long 3657429030
- .long 1072755365
- .long 3910539033
- .long 1015966402
- .long 4197624557
- .long 1072770661
- .long 2333399254
- .long 3164546480
- .long 1512059493
- .long 1072785177
- .long 2701510318
- .long 1016178092
- .long 453379037
- .long 1072798965
- .long 4046344253
- .long 3162814364
- .long 1942345162
- .long 1072818388
- .long 621134147
- .long 1016335195
- .long 4210176273
- .long 1072842164
- .long 2701013387
- .long 3164326619
- .long 4185644010
- .long 1072863795
- .long 4163699341
- .long 1016203112
- .long 679688788
- .long 1072883543
- .long 4147276762
- .long 1014066750
- .long 29432865
- .long 1072901630
- .long 970415797
- .long 1016902063
- .long 4070721092
- .long 1072918247
- .long 2539004411
- .long 3163736096
- .long 2252468843
- .long 1072933561
- .long 3424082887
- .long 3163407177
- .long 2929724825
- .long 1072947712
- .long 3661482235
- .long 3163846989
- .long 1377513368
- .long 1072960824
- .long 3987926680
- .long 1013647908
- .long 1031632908
- .long 1072973003
- .long 3672217151
- .long 1016614619
- .long 2516508130
- .long 1072984342
- .long 545855020
- .long 3162728930
- .long 3792452178
- .long 1072994923
- .long 3420119467
- .long 1016471430
- .long 3147791459
- .long 1073004818
- .long 1342204979
- .long 1013937254
- .long 999189752
- .long 1073014090
- .long 1006335472
- .long 3162850919
- .long 711011011
- .long 1073022794
- .long 4633488
- .long 3162966895
- .long 15640363
- .long 1073030980
- .long 1686389560
- .long 3164376226
- .long 1218463589
- .long 1073042382
- .long 1526837110
- .long 3163533985
- .long 2538470555
- .long 1073056144
- .long 2273304406
- .long 3163784996
- .long 1229720947
- .long 1073068489
- .long 2971628206
- .long 3162356540
- .long 3115427016
- .long 1073079621
- .long 4215132957
- .long 3164282762
- .long 4030612557
- .long 1073089709
- .long 1913251691
- .long 3163671292
- .long 2728521257
- .long 1073098892
- .long 2861089500
- .long 1015454459
- .long 1118696283
- .long 1073107285
- .long 1628948053
- .long 1016179658
- .long 2682711255
- .long 1073114984
- .long 2906306266
- .long 1014142643
- .long 2073898081
- .long 1073122072
- .long 1322740454
- .long 3164497217
- .long 1403700297
- .long 1073128618
- .long 416137895
- .long 3162781466
- .long 2502685617
- .long 1073134681
- .long 3242008732
- .long 1014593495
- .long 1531926851
- .long 1073140313
- .long 1362708094
- .long 1016517604
- .long 3572814411
- .long 1073145557
- .long 3709790527
- .long 1012646874
- .long 1695536111
- .long 1073150453
- .long 3980346340
- .long 1016705136
- .long 2363057203
- .long 1073155033
- .long 2551194792
- .long 1012569695
- .long 2873365682
- .long 1073159327
- .long 3181154748
- .long 1017041450
- .long 1053384691
- .long 1073165288
- .long 3074536879
- .long 1016965660
- .long 3270542712
- .long 1073172451
- .long 2535319415
- .long 3163051778
- .long 1353631484
- .long 1073178850
- .long 1173833755
- .long 1015534537
- .long 3511218460
- .long 1073184599
- .long 1243608109
- .long 3161592122
- .long 4121259284
- .long 1073189793
- .long 398584912
- .long 3163829923
- .long 1193862106
- .long 1073194509
- .long 1873745539
- .long 3163802819
- .long 3861949790
- .long 1073198808
- .long 3841261147
- .long 1015587248
- .long 1486904578
- .long 1073202745
- .long 1634726776
- .long 3163847886
- .long 2879153715
- .long 1073206362
- .long 200456242
- .long 3164138657
- .long 385353253
- .long 1073209698
- .long 1186355517
- .long 1014887155
- .long 1125865839
- .long 1073212783
- .long 203561262
- .long 3161244927
- .long 1221361475
- .long 1073215645
- .long 3382476563
- .long 1014936138
- .long 2077323573
- .long 1073218307
- .long 1005121005
- .long 3164430752
- .long 215611373
- .long 1073220790
- .long 353198764
- .long 3164485137
- .long 2347419265
- .long 1073223110
- .long 1103143360
- .long 1016542137
- .long 1379112765
- .long 1073225284
- .long 381583533
- .long 3162870833
- .long 3891198463
- .long 1073228298
- .long 1771275754
- .long 1014654681
- .long 3395914051
- .long 1073231917
- .long 2350900914
- .long 3164013978
- .long 2799919478
- .long 1073235146
- .long 2893950164
- .long 3163260901
- .long 1138673476
- .long 1073238045
- .long 2622204785
- .long 3164174388
- .long 3408855940
- .long 1073240661
- .long 2800881650
- .long 1016008624
- .long 2044858738
- .long 1073243035
- .long 604544785
- .long 1017022901
- .long 2578795176
- .long 1073245198
- .long 2557332925
- .long 1016135165
- .long 4196285314
- .long 1073247177
- .long 2032365307
- .long 1016194735
- .long 224877747
- .long 1073248996
- .long 497926916
- .long 1016947111
- .long 3271386490
- .long 1073250671
- .long 2689994846
- .long 1016631513
- .long 813635989
- .long 1073252221
- .long 747035277
- .long 3164530136
- .long 369829519
- .long 1073253658
- .long 2182033858
- .long 3163190340
- .long 1187679052
- .long 1073254994
- .long 673954443
- .long 1016149821
- .long 4232586098
- .long 1073256239
- .long 497775200
- .long 3162179015
- .long 426690558
- .long 1073257404
- .long 3063343247
- .long 1016865578
- .long 1624065902
- .long 1073258494
- .long 1354224996
- .long 3163503778
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 1016178214
- .type atan_tbl,@object
- .size atan_tbl,2592
- .align 4
-pi_table:
- .long 1413754136
- .long 1073291771
- .long 856972295
- .long 1016178214
- .type pi_table,@object
- .size pi_table,16
- .align 4
-SGNMASK:
- .long 4294967295
- .long 2147483647
- .type SGNMASK,@object
- .size SGNMASK,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_atan.1-.
- .4byte ..___tag_value_atan.5-..___tag_value_atan.1
- .2byte 0x0400
- .4byte ..___tag_value_atan.3-..___tag_value_atan.1
- .2byte 0x100e
- .byte 0x04
- .4byte ..___tag_value_atan.4-..___tag_value_atan.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/s_cbrt.S b/libm/x86_64/s_cbrt.S
deleted file mode 100644
index 6b00f56..0000000
--- a/libm/x86_64/s_cbrt.S
+++ /dev/null
@@ -1,754 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Assume x=2^{3*k+j} * 1.b1 b2 ... b5 b6 ... b52, where j = 0,1,2.
-// Let r=(x*2^{-3k-j} - 1.b1 b2 ... b5 1)* rcp[b1 b2 ..b5],
-// where rcp[b1 b2 .. b5]=1/(1.b1 b2 b3 b4 b5 1) in double precision
-// cbrt(2^j * 1. b1 b2 .. b5 1) is approximated as T[j][b1..b5]+D[j][b1..b5]
-// (T stores the high 53 bits, D stores the low order bits)
-// Result=2^k*T+(2^k*T*r)*P+2^k*D
-// where P=p1+p2*r+..+p8*r^7
-//
-// Special cases:
-// cbrt(NaN) = quiet NaN, and raise invalid exception
-// cbrt(INF) = that INF
-// cbrt(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin cbrt
-ENTRY(cbrt)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_cbrt.1:
- subq $24, %rsp
-..___tag_value_cbrt.3:
- movsd %xmm0, (%rsp)
-..B1.2:
- movq %xmm0, %xmm7
- movl $524032, %edx
- movsd EXP_MSK3(%rip), %xmm5
- movsd EXP_MSK2(%rip), %xmm3
- psrlq $44, %xmm7
- pextrw $0, %xmm7, %ecx
- movd %xmm7, %eax
- movsd EXP_MASK(%rip), %xmm1
- movsd SIG_MASK(%rip), %xmm2
- andl $248, %ecx
- lea rcp_table(%rip), %r8
- movsd (%rcx,%r8), %xmm4
- movq %rax, %r9
- andl %eax, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_0.0.1
- cmpl $524032, %edx
- je .L_2TAG_PACKET_1.0.1
- shrl $8, %edx
- shrq $8, %r9
- andpd %xmm0, %xmm2
- andpd %xmm5, %xmm0
- orpd %xmm2, %xmm3
- orpd %xmm0, %xmm1
- movapd coeff_table(%rip), %xmm5
- movl $5462, %eax
- movapd 16+coeff_table(%rip), %xmm6
- mull %edx
- movq %r9, %rdx
- andq $2047, %r9
- shrl $14, %eax
- andl $2048, %edx
- subq %rax, %r9
- subq %rax, %r9
- subq %rax, %r9
- shlq $8, %r9
- addl $682, %eax
- orl %edx, %eax
- movd %eax, %xmm7
- addq %r9, %rcx
- psllq $52, %xmm7
-.L_2TAG_PACKET_2.0.1:
- movapd 32+coeff_table(%rip), %xmm2
- movapd 48+coeff_table(%rip), %xmm0
- subsd %xmm3, %xmm1
- movq %xmm7, %xmm3
- lea cbrt_table(%rip), %r8
- mulsd (%rcx,%r8), %xmm7
- mulsd %xmm4, %xmm1
- lea D_table(%rip), %r8
- mulsd (%rcx,%r8), %xmm3
- movapd %xmm1, %xmm4
- unpcklpd %xmm1, %xmm1
- mulpd %xmm1, %xmm5
- mulpd %xmm1, %xmm6
- mulpd %xmm1, %xmm1
- addpd %xmm5, %xmm2
- addpd %xmm6, %xmm0
- mulpd %xmm1, %xmm2
- mulpd %xmm1, %xmm1
- mulsd %xmm7, %xmm4
- addpd %xmm2, %xmm0
- mulsd %xmm0, %xmm1
- unpckhpd %xmm0, %xmm0
- addsd %xmm1, %xmm0
- mulsd %xmm4, %xmm0
- addsd %xmm3, %xmm0
- addsd %xmm7, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_0.0.1:
- mulsd SCALE63(%rip), %xmm0
- movq %xmm0, %xmm7
- movl $524032, %edx
- psrlq $44, %xmm7
- pextrw $0, %xmm7, %ecx
- movd %xmm7, %eax
- andl $248, %ecx
- lea rcp_table(%rip), %r8
- movsd (%rcx,%r8), %xmm4
- movq %rax, %r9
- andl %eax, %edx
- shrl $8, %edx
- shrq $8, %r9
- cmpl $0, %edx
- je .L_2TAG_PACKET_3.0.1
- andpd %xmm0, %xmm2
- andpd %xmm5, %xmm0
- orpd %xmm2, %xmm3
- orpd %xmm0, %xmm1
- movapd coeff_table(%rip), %xmm5
- movl $5462, %eax
- movapd 16+coeff_table(%rip), %xmm6
- mull %edx
- movq %r9, %rdx
- andq $2047, %r9
- shrl $14, %eax
- andl $2048, %edx
- subq %rax, %r9
- subq %rax, %r9
- subq %rax, %r9
- shlq $8, %r9
- addl $661, %eax
- orl %edx, %eax
- movd %eax, %xmm7
- addq %r9, %rcx
- psllq $52, %xmm7
- jmp .L_2TAG_PACKET_2.0.1
-.L_2TAG_PACKET_3.0.1:
- cmpq $0, %r9
- jne .L_2TAG_PACKET_4.0.1
- xorpd %xmm0, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_4.0.1:
- movsd ZERON(%rip), %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_1.0.1:
- movl 4(%rsp), %eax
- movl (%rsp), %edx
- movl %eax, %ecx
- andl $2147483647, %ecx
- cmpl $2146435072, %ecx
- ja .L_2TAG_PACKET_5.0.1
- cmpl $0, %edx
- jne .L_2TAG_PACKET_5.0.1
- cmpl $2146435072, %eax
- jne .L_2TAG_PACKET_6.0.1
- movsd INF(%rip), %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_6.0.1:
- movsd NEG_INF(%rip), %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_5.0.1:
- movsd (%rsp), %xmm0
- addsd %xmm0, %xmm0
- movq %xmm0, 8(%rsp)
-.L_2TAG_PACKET_7.0.1:
-..B1.4:
- addq $24, %rsp
-..___tag_value_cbrt.4:
- ret
-..___tag_value_cbrt.5:
-END(cbrt)
-# -- End cbrt
- .section .rodata, "a"
- .align 16
- .align 16
-coeff_table:
- .long 1553778919
- .long 3213899486
- .long 3534952507
- .long 3215266280
- .long 1646371399
- .long 3214412045
- .long 477218588
- .long 3216798151
- .long 3582521621
- .long 1066628362
- .long 1007461464
- .long 1068473053
- .long 889629714
- .long 1067378449
- .long 1431655765
- .long 1070945621
- .type coeff_table,@object
- .size coeff_table,64
- .align 4
-EXP_MSK3:
- .long 4294967295
- .long 1048575
- .type EXP_MSK3,@object
- .size EXP_MSK3,8
- .align 4
-EXP_MSK2:
- .long 0
- .long 3220193280
- .type EXP_MSK2,@object
- .size EXP_MSK2,8
- .align 4
-EXP_MASK:
- .long 0
- .long 3220176896
- .type EXP_MASK,@object
- .size EXP_MASK,8
- .align 4
-SIG_MASK:
- .long 0
- .long 1032192
- .type SIG_MASK,@object
- .size SIG_MASK,8
- .align 4
-rcp_table:
- .long 528611360
- .long 3220144632
- .long 2884679527
- .long 3220082993
- .long 1991868891
- .long 3220024928
- .long 2298714891
- .long 3219970134
- .long 58835168
- .long 3219918343
- .long 3035110223
- .long 3219869313
- .long 1617585086
- .long 3219822831
- .long 2500867033
- .long 3219778702
- .long 4241943008
- .long 3219736752
- .long 258732970
- .long 3219696825
- .long 404232216
- .long 3219658776
- .long 2172167368
- .long 3219622476
- .long 1544257904
- .long 3219587808
- .long 377579543
- .long 3219554664
- .long 1616385542
- .long 3219522945
- .long 813783277
- .long 3219492562
- .long 3940743189
- .long 3219463431
- .long 2689777499
- .long 3219435478
- .long 1700977147
- .long 3219408632
- .long 3169102082
- .long 3219382828
- .long 327235604
- .long 3219358008
- .long 1244336319
- .long 3219334115
- .long 1300311200
- .long 3219311099
- .long 3095471925
- .long 3219288912
- .long 2166487928
- .long 3219267511
- .long 2913108253
- .long 3219246854
- .long 293672978
- .long 3219226904
- .long 288737297
- .long 3219207624
- .long 1810275472
- .long 3219188981
- .long 174592167
- .long 3219170945
- .long 3539053052
- .long 3219153485
- .long 2164392968
- .long 3219136576
- .type rcp_table,@object
- .size rcp_table,256
- .align 4
-cbrt_table:
- .long 572345495
- .long 1072698681
- .long 1998204467
- .long 1072709382
- .long 3861501553
- .long 1072719872
- .long 2268192434
- .long 1072730162
- .long 2981979308
- .long 1072740260
- .long 270859143
- .long 1072750176
- .long 2958651392
- .long 1072759916
- .long 313113243
- .long 1072769490
- .long 919449400
- .long 1072778903
- .long 2809328903
- .long 1072788162
- .long 2222981587
- .long 1072797274
- .long 2352530781
- .long 1072806244
- .long 594152517
- .long 1072815078
- .long 1555767199
- .long 1072823780
- .long 4282421314
- .long 1072832355
- .long 2355578597
- .long 1072840809
- .long 1162590619
- .long 1072849145
- .long 797864051
- .long 1072857367
- .long 431273680
- .long 1072865479
- .long 2669831148
- .long 1072873484
- .long 733477752
- .long 1072881387
- .long 4280220604
- .long 1072889189
- .long 801961634
- .long 1072896896
- .long 2915370760
- .long 1072904508
- .long 1159613482
- .long 1072912030
- .long 2689944798
- .long 1072919463
- .long 1248687822
- .long 1072926811
- .long 2967951030
- .long 1072934075
- .long 630170432
- .long 1072941259
- .long 3760898254
- .long 1072948363
- .long 0
- .long 1072955392
- .long 2370273294
- .long 1072962345
- .long 1261754802
- .long 1072972640
- .long 546334065
- .long 1072986123
- .long 1054893830
- .long 1072999340
- .long 1571187597
- .long 1073012304
- .long 1107975175
- .long 1073025027
- .long 3606909377
- .long 1073037519
- .long 1113616747
- .long 1073049792
- .long 4154744632
- .long 1073061853
- .long 3358931423
- .long 1073073713
- .long 4060702372
- .long 1073085379
- .long 747576176
- .long 1073096860
- .long 3023138255
- .long 1073108161
- .long 1419988548
- .long 1073119291
- .long 1914185305
- .long 1073130255
- .long 294389948
- .long 1073141060
- .long 3761802570
- .long 1073151710
- .long 978281566
- .long 1073162213
- .long 823148820
- .long 1073172572
- .long 2420954441
- .long 1073182792
- .long 3815449908
- .long 1073192878
- .long 2046058587
- .long 1073202835
- .long 1807524753
- .long 1073212666
- .long 2628681401
- .long 1073222375
- .long 3225667357
- .long 1073231966
- .long 1555307421
- .long 1073241443
- .long 3454043099
- .long 1073250808
- .long 1208137896
- .long 1073260066
- .long 3659916772
- .long 1073269218
- .long 1886261264
- .long 1073278269
- .long 3593647839
- .long 1073287220
- .long 3086012205
- .long 1073296075
- .long 2769796922
- .long 1073304836
- .long 888716057
- .long 1073317807
- .long 2201465623
- .long 1073334794
- .long 164369365
- .long 1073351447
- .long 3462666733
- .long 1073367780
- .long 2773905457
- .long 1073383810
- .long 1342879088
- .long 1073399550
- .long 2543933975
- .long 1073415012
- .long 1684477781
- .long 1073430209
- .long 3532178543
- .long 1073445151
- .long 1147747300
- .long 1073459850
- .long 1928031793
- .long 1073474314
- .long 2079717015
- .long 1073488553
- .long 4016765315
- .long 1073502575
- .long 3670431139
- .long 1073516389
- .long 3549227225
- .long 1073530002
- .long 11637607
- .long 1073543422
- .long 588220169
- .long 1073556654
- .long 2635407503
- .long 1073569705
- .long 2042029317
- .long 1073582582
- .long 1925128962
- .long 1073595290
- .long 4136375664
- .long 1073607834
- .long 759964600
- .long 1073620221
- .long 4257606771
- .long 1073632453
- .long 297278907
- .long 1073644538
- .long 3655053093
- .long 1073656477
- .long 2442253172
- .long 1073668277
- .long 1111876799
- .long 1073679941
- .long 3330973139
- .long 1073691472
- .long 3438879452
- .long 1073702875
- .long 3671565478
- .long 1073714153
- .long 1317849547
- .long 1073725310
- .long 1642364115
- .long 1073736348
- .type cbrt_table,@object
- .size cbrt_table,768
- .align 4
-D_table:
- .long 4050900474
- .long 1014427190
- .long 1157977860
- .long 1016444461
- .long 1374568199
- .long 1017271387
- .long 2809163288
- .long 1016882676
- .long 3742377377
- .long 1013168191
- .long 3101606597
- .long 1017541672
- .long 65224358
- .long 1017217597
- .long 2691591250
- .long 1017266643
- .long 4020758549
- .long 1017689313
- .long 1316310992
- .long 1018030788
- .long 1031537856
- .long 1014090882
- .long 3261395239
- .long 1016413641
- .long 886424999
- .long 1016313335
- .long 3114776834
- .long 1014195875
- .long 1681120620
- .long 1017825416
- .long 1329600273
- .long 1016625740
- .long 465474623
- .long 1017097119
- .long 4251633980
- .long 1017169077
- .long 1986990133
- .long 1017710645
- .long 752958613
- .long 1017159641
- .long 2216216792
- .long 1018020163
- .long 4282860129
- .long 1015924861
- .long 1557627859
- .long 1016039538
- .long 3889219754
- .long 1018086237
- .long 3684996408
- .long 1017353275
- .long 723532103
- .long 1017717141
- .long 2951149676
- .long 1012528470
- .long 831890937
- .long 1017830553
- .long 1031212645
- .long 1017387331
- .long 2741737450
- .long 1017604974
- .long 2863311531
- .long 1003776682
- .long 4276736099
- .long 1013153088
- .long 4111778382
- .long 1015673686
- .long 1728065769
- .long 1016413986
- .long 2708718031
- .long 1018078833
- .long 1069335005
- .long 1015291224
- .long 700037144
- .long 1016482032
- .long 2904566452
- .long 1017226861
- .long 4074156649
- .long 1017622651
- .long 25019565
- .long 1015245366
- .long 3601952608
- .long 1015771755
- .long 3267129373
- .long 1017904664
- .long 503203103
- .long 1014921629
- .long 2122011730
- .long 1018027866
- .long 3927295461
- .long 1014189456
- .long 2790625147
- .long 1016024251
- .long 1330460186
- .long 1016940346
- .long 4033568463
- .long 1015538390
- .long 3695818227
- .long 1017509621
- .long 257573361
- .long 1017208868
- .long 3227697852
- .long 1017337964
- .long 234118548
- .long 1017169577
- .long 4009025803
- .long 1017278524
- .long 1948343394
- .long 1017749310
- .long 678398162
- .long 1018144239
- .long 3083864863
- .long 1016669086
- .long 2415453452
- .long 1017890370
- .long 175467344
- .long 1017330033
- .long 3197359580
- .long 1010339928
- .long 2071276951
- .long 1015941358
- .long 268372543
- .long 1016737773
- .long 938132959
- .long 1017389108
- .long 1816750559
- .long 1017337448
- .long 4119203749
- .long 1017152174
- .long 2578653878
- .long 1013108497
- .long 2470331096
- .long 1014678606
- .long 123855735
- .long 1016553320
- .long 1265650889
- .long 1014782687
- .long 3414398172
- .long 1017182638
- .long 1040773369
- .long 1016158401
- .long 3483628886
- .long 1016886550
- .long 4140499405
- .long 1016191425
- .long 3893477850
- .long 1016964495
- .long 3935319771
- .long 1009634717
- .long 2978982660
- .long 1015027112
- .long 2452709923
- .long 1017990229
- .long 3190365712
- .long 1015835149
- .long 4237588139
- .long 1015832925
- .long 2610678389
- .long 1017962711
- .long 2127316774
- .long 1017405770
- .long 824267502
- .long 1017959463
- .long 2165924042
- .long 1017912225
- .long 2774007076
- .long 1013257418
- .long 4123916326
- .long 1017582284
- .long 1976417958
- .long 1016959909
- .long 4092806412
- .long 1017711279
- .long 119251817
- .long 1015363631
- .long 3475418768
- .long 1017675415
- .long 1972580503
- .long 1015470684
- .long 815541017
- .long 1017517969
- .long 2429917451
- .long 1017397776
- .long 4062888482
- .long 1016749897
- .long 68284153
- .long 1017925678
- .long 2207779246
- .long 1016320298
- .long 1183466520
- .long 1017408657
- .long 143326427
- .long 1017060403
- .type D_table,@object
- .size D_table,768
- .align 4
-SCALE63:
- .long 0
- .long 1138753536
- .type SCALE63,@object
- .size SCALE63,8
- .align 4
-ZERON:
- .long 0
- .long 2147483648
- .type ZERON,@object
- .size ZERON,8
- .align 4
-INF:
- .long 0
- .long 2146435072
- .type INF,@object
- .size INF,8
- .align 4
-NEG_INF:
- .long 0
- .long 4293918720
- .type NEG_INF,@object
- .size NEG_INF,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_cbrt.1-.
- .4byte ..___tag_value_cbrt.5-..___tag_value_cbrt.1
- .2byte 0x0400
- .4byte ..___tag_value_cbrt.3-..___tag_value_cbrt.1
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_cbrt.4-..___tag_value_cbrt.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/s_cos.S b/libm/x86_64/s_cos.S
deleted file mode 100644
index 3d9e402..0000000
--- a/libm/x86_64/s_cos.S
+++ /dev/null
@@ -1,1275 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// 1. RANGE REDUCTION
-//
-// We perform an initial range reduction from X to r with
-//
-// X =~= N * pi/32 + r
-//
-// so that |r| <= pi/64 + epsilon. We restrict inputs to those
-// where |N| <= 932560. Beyond this, the range reduction is
-// insufficiently accurate. For extremely small inputs,
-// denormalization can occur internally, impacting performance.
-// This means that the main path is actually only taken for
-// 2^-252 <= |X| < 90112.
-//
-// To avoid branches, we perform the range reduction to full
-// accuracy each time.
-//
-// X - N * (P_1 + P_2 + P_3)
-//
-// where P_1 and P_2 are 32-bit numbers (so multiplication by N
-// is exact) and P_3 is a 53-bit number. Together, these
-// approximate pi well enough for all cases in the restricted
-// range.
-//
-// The main reduction sequence is:
-//
-// y = 32/pi * x
-// N = integer(y)
-// (computed by adding and subtracting off SHIFTER)
-//
-// m_1 = N * P_1
-// m_2 = N * P_2
-// r_1 = x - m_1
-// r = r_1 - m_2
-// (this r can be used for most of the calculation)
-//
-// c_1 = r_1 - r
-// m_3 = N * P_3
-// c_2 = c_1 - m_2
-// c = c_2 - m_3
-//
-// 2. MAIN ALGORITHM
-//
-// The algorithm uses a table lookup based on B = M * pi / 32
-// where M = N mod 64. The stored values are:
-// sigma closest power of 2 to cos(B)
-// C_hl 53-bit cos(B) - sigma
-// S_hi + S_lo 2 * 53-bit sin(B)
-//
-// The computation is organized as follows:
-//
-// sin(B + r + c) = [sin(B) + sigma * r] +
-// r * (cos(B) - sigma) +
-// sin(B) * [cos(r + c) - 1] +
-// cos(B) * [sin(r + c) - r]
-//
-// which is approximately:
-//
-// [S_hi + sigma * r] +
-// C_hl * r +
-// S_lo + S_hi * [(cos(r) - 1) - r * c] +
-// (C_hl + sigma) * [(sin(r) - r) + c]
-//
-// and this is what is actually computed. We separate this sum
-// into four parts:
-//
-// hi + med + pols + corr
-//
-// where
-//
-// hi = S_hi + sigma r
-// med = C_hl * r
-// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r)
-// corr = S_lo + c * ((C_hl + sigma) - S_hi * r)
-//
-// 3. POLYNOMIAL
-//
-// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) *
-// (sin(r) - r) can be rearranged freely, since it is quite
-// small, so we exploit parallelism to the fullest.
-//
-// psc4 = SC_4 * r_1
-// msc4 = psc4 * r
-// r2 = r * r
-// msc2 = SC_2 * r2
-// r4 = r2 * r2
-// psc3 = SC_3 + msc4
-// psc1 = SC_1 + msc2
-// msc3 = r4 * psc3
-// sincospols = psc1 + msc3
-// pols = sincospols *
-// <S_hi * r^2 | (C_hl + sigma) * r^3>
-//
-// 4. CORRECTION TERM
-//
-// This is where the "c" component of the range reduction is
-// taken into account; recall that just "r" is used for most of
-// the calculation.
-//
-// -c = m_3 - c_2
-// -d = S_hi * r - (C_hl + sigma)
-// corr = -c * -d + S_lo
-//
-// 5. COMPENSATED SUMMATIONS
-//
-// The two successive compensated summations add up the high
-// and medium parts, leaving just the low parts to add up at
-// the end.
-//
-// rs = sigma * r
-// res_int = S_hi + rs
-// k_0 = S_hi - res_int
-// k_2 = k_0 + rs
-// med = C_hl * r
-// res_hi = res_int + med
-// k_1 = res_int - res_hi
-// k_3 = k_1 + med
-//
-// 6. FINAL SUMMATION
-//
-// We now add up all the small parts:
-//
-// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3
-//
-// Now the overall result is just:
-//
-// res_hi + res_lo
-//
-// 7. SMALL ARGUMENTS
-//
-// Inputs with |X| < 2^-252 are treated specially as
-// 1 - |x|.
-//
-// Special cases:
-// cos(NaN) = quiet NaN, and raise invalid exception
-// cos(INF) = NaN and raise invalid exception
-// cos(0) = 1
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin cos
-ENTRY(cos)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_cos.1:
- pushq %rbx
-..___tag_value_cos.3:
- subq $16, %rsp
-..___tag_value_cos.5:
- movsd %xmm0, 8(%rsp)
-..B1.2:
- movl 12(%rsp), %eax
- movq PI32INV(%rip), %xmm1
- andl $2147418112, %eax
- subl $808452096, %eax
- cmpl $281346048, %eax
- ja .L_2TAG_PACKET_0.0.1
- mulsd %xmm0, %xmm1
- movapd ONEHALF(%rip), %xmm5
- movq SIGN_MASK(%rip), %xmm4
- andpd %xmm0, %xmm4
- orps %xmm4, %xmm5
- addpd %xmm5, %xmm1
- cvttsd2si %xmm1, %edx
- cvtsi2sd %edx, %xmm1
- movapd P_2(%rip), %xmm2
- movq P_1(%rip), %xmm3
- mulsd %xmm1, %xmm3
- unpcklpd %xmm1, %xmm1
- addq $1865232, %rdx
- movq %xmm0, %xmm4
- andq $63, %rdx
- movapd SC_4(%rip), %xmm5
- lea Ctable(%rip), %rax
- shlq $5, %rdx
- addq %rdx, %rax
- mulpd %xmm1, %xmm2
- subsd %xmm3, %xmm0
- mulsd P_3(%rip), %xmm1
- subsd %xmm3, %xmm4
- movq 8(%rax), %xmm7
- unpcklpd %xmm0, %xmm0
- movq %xmm4, %xmm3
- subsd %xmm2, %xmm4
- mulpd %xmm0, %xmm5
- subpd %xmm2, %xmm0
- movapd SC_2(%rip), %xmm6
- mulsd %xmm4, %xmm7
- subsd %xmm4, %xmm3
- mulpd %xmm0, %xmm5
- mulpd %xmm0, %xmm0
- subsd %xmm2, %xmm3
- movapd (%rax), %xmm2
- subsd %xmm3, %xmm1
- movq 24(%rax), %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm7
- mulsd %xmm4, %xmm2
- mulpd %xmm0, %xmm6
- mulsd %xmm4, %xmm3
- mulpd %xmm0, %xmm2
- mulpd %xmm0, %xmm0
- addpd SC_3(%rip), %xmm5
- mulsd (%rax), %xmm4
- addpd SC_1(%rip), %xmm6
- mulpd %xmm0, %xmm5
- movq %xmm3, %xmm0
- addsd 8(%rax), %xmm3
- mulpd %xmm7, %xmm1
- movq %xmm4, %xmm7
- addsd %xmm3, %xmm4
- addpd %xmm5, %xmm6
- movq 8(%rax), %xmm5
- subsd %xmm3, %xmm5
- subsd %xmm4, %xmm3
- addsd 16(%rax), %xmm1
- mulpd %xmm2, %xmm6
- addsd %xmm5, %xmm0
- addsd %xmm7, %xmm3
- addsd %xmm1, %xmm0
- addsd %xmm3, %xmm0
- addsd %xmm6, %xmm0
- unpckhpd %xmm6, %xmm6
- addsd %xmm6, %xmm0
- addsd %xmm4, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_0.0.1:
- jg .L_2TAG_PACKET_1.0.1
- pextrw $3, %xmm0, %eax
- andw $32767, %ax
- pinsrw $3, %eax, %xmm0
- movq ONE(%rip), %xmm1
- subsd %xmm0, %xmm1
- movq %xmm1, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_1.0.1:
- pextrw $3, %xmm0, %eax
- andl $32752, %eax
- cmpl $32752, %eax
- je .L_2TAG_PACKET_2.0.1
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- subl $16224, %ecx
- shrl $7, %ecx
- andl $65532, %ecx
- lea PI_INV_TABLE(%rip), %r11
- addq %r11, %rcx
- movd %xmm0, %rax
- movl 20(%rcx), %r10d
- movl 24(%rcx), %r8d
- movl %eax, %edx
- shrq $21, %rax
- orl $-2147483648, %eax
- shrl $11, %eax
- movl %r10d, %r9d
- imulq %rdx, %r10
- imulq %rax, %r9
- imulq %rax, %r8
- movl 16(%rcx), %esi
- movl 12(%rcx), %edi
- movl %r10d, %r11d
- shrq $32, %r10
- addq %r10, %r9
- addq %r8, %r11
- movl %r11d, %r8d
- shrq $32, %r11
- addq %r11, %r9
- movl %esi, %r10d
- imulq %rdx, %rsi
- imulq %rax, %r10
- movl %edi, %r11d
- imulq %rdx, %rdi
- movl %esi, %ebx
- shrq $32, %rsi
- addq %rbx, %r9
- movl %r9d, %ebx
- shrq $32, %r9
- addq %rsi, %r10
- addq %r9, %r10
- shlq $32, %rbx
- orq %rbx, %r8
- imulq %rax, %r11
- movl 8(%rcx), %r9d
- movl 4(%rcx), %esi
- movl %edi, %ebx
- shrq $32, %rdi
- addq %rbx, %r10
- movl %r10d, %ebx
- shrq $32, %r10
- addq %rdi, %r11
- addq %r10, %r11
- movq %r9, %rdi
- imulq %rdx, %r9
- imulq %rax, %rdi
- movl %r9d, %r10d
- shrq $32, %r9
- addq %r10, %r11
- movl %r11d, %r10d
- shrq $32, %r11
- addq %r9, %rdi
- addq %r11, %rdi
- movq %rsi, %r9
- imulq %rdx, %rsi
- imulq %rax, %r9
- shlq $32, %r10
- orq %rbx, %r10
- movl (%rcx), %eax
- movl %esi, %r11d
- shrq $32, %rsi
- addq %r11, %rdi
- movl %edi, %r11d
- shrq $32, %rdi
- addq %rsi, %r9
- addq %rdi, %r9
- imulq %rax, %rdx
- pextrw $3, %xmm0, %ebx
- lea PI_INV_TABLE(%rip), %rdi
- subq %rdi, %rcx
- addl %ecx, %ecx
- addl %ecx, %ecx
- addl %ecx, %ecx
- addl $19, %ecx
- movl $32768, %esi
- andl %ebx, %esi
- shrl $4, %ebx
- andl $2047, %ebx
- subl $1023, %ebx
- subl %ebx, %ecx
- addq %rdx, %r9
- movl %ecx, %edx
- addl $32, %edx
- cmpl $1, %ecx
- jl .L_2TAG_PACKET_3.0.1
- negl %ecx
- addl $29, %ecx
- shll %cl, %r9d
- movl %r9d, %edi
- andl $536870911, %r9d
- testl $268435456, %r9d
- jne .L_2TAG_PACKET_4.0.1
- shrl %cl, %r9d
- movl $0, %ebx
- shlq $32, %r9
- orq %r11, %r9
-.L_2TAG_PACKET_5.0.1:
-.L_2TAG_PACKET_6.0.1:
- cmpq $0, %r9
- je .L_2TAG_PACKET_7.0.1
-.L_2TAG_PACKET_8.0.1:
- bsr %r9, %r11
- movl $29, %ecx
- subl %r11d, %ecx
- jle .L_2TAG_PACKET_9.0.1
- shlq %cl, %r9
- movq %r10, %rax
- shlq %cl, %r10
- addl %ecx, %edx
- negl %ecx
- addl $64, %ecx
- shrq %cl, %rax
- shrq %cl, %r8
- orq %rax, %r9
- orq %r8, %r10
-.L_2TAG_PACKET_10.0.1:
- cvtsi2sdq %r9, %xmm0
- shrq $1, %r10
- cvtsi2sdq %r10, %xmm3
- xorpd %xmm4, %xmm4
- shll $4, %edx
- negl %edx
- addl $16368, %edx
- orl %esi, %edx
- xorl %ebx, %edx
- pinsrw $3, %edx, %xmm4
- movq PI_4(%rip), %xmm2
- movq 8+PI_4(%rip), %xmm6
- xorpd %xmm5, %xmm5
- subl $1008, %edx
- pinsrw $3, %edx, %xmm5
- mulsd %xmm4, %xmm0
- shll $16, %esi
- sarl $31, %esi
- mulsd %xmm5, %xmm3
- movq %xmm0, %xmm1
- mulsd %xmm2, %xmm0
- shrl $29, %edi
- addsd %xmm3, %xmm1
- mulsd %xmm2, %xmm3
- addl %esi, %edi
- xorl %esi, %edi
- mulsd %xmm1, %xmm6
- movl %edi, %eax
- addsd %xmm3, %xmm6
- movq %xmm0, %xmm2
- addsd %xmm6, %xmm0
- subsd %xmm0, %xmm2
- addsd %xmm2, %xmm6
-.L_2TAG_PACKET_11.0.1:
- movq PI32INV(%rip), %xmm1
- mulsd %xmm0, %xmm1
- movq ONEHALF(%rip), %xmm5
- movq SIGN_MASK(%rip), %xmm4
- andpd %xmm0, %xmm4
- orps %xmm4, %xmm5
- addpd %xmm5, %xmm1
- cvttsd2si %xmm1, %rdx
- cvtsi2sdq %rdx, %xmm1
- movq P_1(%rip), %xmm3
- movapd P_2(%rip), %xmm2
- mulsd %xmm1, %xmm3
- unpcklpd %xmm1, %xmm1
- shll $3, %eax
- addl $1865232, %edx
- movq %xmm0, %xmm4
- addl %eax, %edx
- andl $63, %edx
- movapd SC_4(%rip), %xmm5
- lea Ctable(%rip), %rax
- shll $5, %edx
- addq %rdx, %rax
- mulpd %xmm1, %xmm2
- subsd %xmm3, %xmm0
- mulsd P_3(%rip), %xmm1
- subsd %xmm3, %xmm4
- movq 8(%rax), %xmm7
- unpcklpd %xmm0, %xmm0
- movq %xmm4, %xmm3
- subsd %xmm2, %xmm4
- mulpd %xmm0, %xmm5
- subpd %xmm2, %xmm0
- mulsd %xmm4, %xmm7
- subsd %xmm4, %xmm3
- mulpd %xmm0, %xmm5
- mulpd %xmm0, %xmm0
- subsd %xmm2, %xmm3
- movapd (%rax), %xmm2
- subsd %xmm3, %xmm1
- movq 24(%rax), %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm7
- subsd %xmm6, %xmm1
- movapd SC_2(%rip), %xmm6
- mulsd %xmm4, %xmm2
- mulpd %xmm0, %xmm6
- mulsd %xmm4, %xmm3
- mulpd %xmm0, %xmm2
- mulpd %xmm0, %xmm0
- addpd SC_3(%rip), %xmm5
- mulsd (%rax), %xmm4
- addpd SC_1(%rip), %xmm6
- mulpd %xmm0, %xmm5
- movq %xmm3, %xmm0
- addsd 8(%rax), %xmm3
- mulpd %xmm7, %xmm1
- movq %xmm4, %xmm7
- addsd %xmm3, %xmm4
- addpd %xmm5, %xmm6
- movq 8(%rax), %xmm5
- subsd %xmm3, %xmm5
- subsd %xmm4, %xmm3
- addsd 16(%rax), %xmm1
- mulpd %xmm2, %xmm6
- addsd %xmm0, %xmm5
- addsd %xmm7, %xmm3
- addsd %xmm5, %xmm1
- addsd %xmm3, %xmm1
- addsd %xmm6, %xmm1
- unpckhpd %xmm6, %xmm6
- movq %xmm4, %xmm0
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_7.0.1:
- addl $64, %edx
- movq %r10, %r9
- movq %r8, %r10
- movq $0, %r8
- cmpq $0, %r9
- jne .L_2TAG_PACKET_8.0.1
- addl $64, %edx
- movq %r10, %r9
- movq %r8, %r10
- cmpq $0, %r9
- jne .L_2TAG_PACKET_8.0.1
- xorpd %xmm0, %xmm0
- xorpd %xmm6, %xmm6
- jmp .L_2TAG_PACKET_11.0.1
-.L_2TAG_PACKET_9.0.1:
- je .L_2TAG_PACKET_10.0.1
- negl %ecx
- shrq %cl, %r10
- movq %r9, %rax
- shrq %cl, %r9
- subl %ecx, %edx
- negl %ecx
- addl $64, %ecx
- shlq %cl, %rax
- orq %rax, %r10
- jmp .L_2TAG_PACKET_10.0.1
-.L_2TAG_PACKET_3.0.1:
- negl %ecx
- shlq $32, %r9
- orq %r11, %r9
- shlq %cl, %r9
- movq %r9, %rdi
- testl $-2147483648, %r9d
- jne .L_2TAG_PACKET_12.0.1
- shrl %cl, %r9d
- movl $0, %ebx
- shrq $3, %rdi
- jmp .L_2TAG_PACKET_6.0.1
-.L_2TAG_PACKET_4.0.1:
- shrl %cl, %r9d
- movl $536870912, %ebx
- shrl %cl, %ebx
- shlq $32, %r9
- orq %r11, %r9
- shlq $32, %rbx
- addl $536870912, %edi
- movq $0, %rcx
- movq $0, %r11
- subq %r8, %rcx
- sbbq %r10, %r11
- sbbq %r9, %rbx
- movq %rcx, %r8
- movq %r11, %r10
- movq %rbx, %r9
- movl $32768, %ebx
- jmp .L_2TAG_PACKET_5.0.1
-.L_2TAG_PACKET_12.0.1:
- shrl %cl, %r9d
- movq $0x100000000, %rbx
- shrq %cl, %rbx
- movq $0, %rcx
- movq $0, %r11
- subq %r8, %rcx
- sbbq %r10, %r11
- sbbq %r9, %rbx
- movq %rcx, %r8
- movq %r11, %r10
- movq %rbx, %r9
- movl $32768, %ebx
- shrq $3, %rdi
- addl $536870912, %edi
- jmp .L_2TAG_PACKET_6.0.1
-.L_2TAG_PACKET_2.0.1:
- movsd 8(%rsp), %xmm0
- mulsd NEG_ZERO(%rip), %xmm0
- movq %xmm0, (%rsp)
-.L_2TAG_PACKET_13.0.1:
-..B1.4:
- addq $16, %rsp
-..___tag_value_cos.6:
- popq %rbx
-..___tag_value_cos.8:
- ret
-..___tag_value_cos.9:
-END(cos)
-# -- End cos
- .section .rodata, "a"
- .align 16
- .align 16
-ONEHALF:
- .long 0
- .long 1071644672
- .long 0
- .long 1071644672
- .type ONEHALF,@object
- .size ONEHALF,16
- .align 16
-P_2:
- .long 442499072
- .long 1032893537
- .long 442499072
- .long 1032893537
- .type P_2,@object
- .size P_2,16
- .align 16
-SC_4:
- .long 2773927732
- .long 1053236707
- .long 436314138
- .long 1056571808
- .type SC_4,@object
- .size SC_4,16
- .align 16
-Ctable:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 393047345
- .long 3212032302
- .long 3156849708
- .long 1069094822
- .long 3758096384
- .long 3158189848
- .long 0
- .long 1072693248
- .long 18115067
- .long 3214126342
- .long 1013556747
- .long 1070135480
- .long 3221225472
- .long 3160567065
- .long 0
- .long 1072693248
- .long 2476548698
- .long 3215330282
- .long 785751814
- .long 1070765062
- .long 2684354560
- .long 3161838221
- .long 0
- .long 1072693248
- .long 2255197647
- .long 3216211105
- .long 2796464483
- .long 1071152610
- .long 3758096384
- .long 3160878317
- .long 0
- .long 1072693248
- .long 1945768569
- .long 3216915048
- .long 939980347
- .long 1071524701
- .long 536870912
- .long 1012796809
- .long 0
- .long 1072693248
- .long 1539668340
- .long 3217396327
- .long 967731400
- .long 1071761211
- .long 536870912
- .long 1015752157
- .long 0
- .long 1072693248
- .long 1403757309
- .long 3217886718
- .long 621354454
- .long 1071926515
- .long 536870912
- .long 1013450602
- .long 0
- .long 1072693248
- .long 2583490354
- .long 1070236281
- .long 1719614413
- .long 1072079006
- .long 536870912
- .long 3163282740
- .long 0
- .long 1071644672
- .long 2485417816
- .long 1069626316
- .long 1796544321
- .long 1072217216
- .long 536870912
- .long 3162686945
- .long 0
- .long 1071644672
- .long 2598800519
- .long 1068266419
- .long 688824739
- .long 1072339814
- .long 3758096384
- .long 1010431536
- .long 0
- .long 1071644672
- .long 2140183630
- .long 3214756396
- .long 4051746225
- .long 1072445618
- .long 2147483648
- .long 3161907377
- .long 0
- .long 1071644672
- .long 1699043957
- .long 3216902261
- .long 3476196678
- .long 1072533611
- .long 536870912
- .long 1014257638
- .long 0
- .long 1071644672
- .long 1991047213
- .long 1067753521
- .long 1455828442
- .long 1072602945
- .long 3758096384
- .long 1015505073
- .long 0
- .long 1070596096
- .long 240740309
- .long 3215727903
- .long 3489094832
- .long 1072652951
- .long 536870912
- .long 1014325783
- .long 0
- .long 1070596096
- .long 257503056
- .long 3214647653
- .long 2748392742
- .long 1072683149
- .long 1073741824
- .long 3163061750
- .long 0
- .long 1069547520
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 0
- .long 257503056
- .long 1067164005
- .long 2748392742
- .long 1072683149
- .long 1073741824
- .long 3163061750
- .long 0
- .long 3217031168
- .long 240740309
- .long 1068244255
- .long 3489094832
- .long 1072652951
- .long 536870912
- .long 1014325783
- .long 0
- .long 3218079744
- .long 1991047213
- .long 3215237169
- .long 1455828442
- .long 1072602945
- .long 3758096384
- .long 1015505073
- .long 0
- .long 3218079744
- .long 1699043957
- .long 1069418613
- .long 3476196678
- .long 1072533611
- .long 536870912
- .long 1014257638
- .long 0
- .long 3219128320
- .long 2140183630
- .long 1067272748
- .long 4051746225
- .long 1072445618
- .long 2147483648
- .long 3161907377
- .long 0
- .long 3219128320
- .long 2598800519
- .long 3215750067
- .long 688824739
- .long 1072339814
- .long 3758096384
- .long 1010431536
- .long 0
- .long 3219128320
- .long 2485417816
- .long 3217109964
- .long 1796544321
- .long 1072217216
- .long 536870912
- .long 3162686945
- .long 0
- .long 3219128320
- .long 2583490354
- .long 3217719929
- .long 1719614413
- .long 1072079006
- .long 536870912
- .long 3163282740
- .long 0
- .long 3219128320
- .long 1403757309
- .long 1070403070
- .long 621354454
- .long 1071926515
- .long 536870912
- .long 1013450602
- .long 0
- .long 3220176896
- .long 1539668340
- .long 1069912679
- .long 967731400
- .long 1071761211
- .long 536870912
- .long 1015752157
- .long 0
- .long 3220176896
- .long 1945768569
- .long 1069431400
- .long 939980347
- .long 1071524701
- .long 536870912
- .long 1012796809
- .long 0
- .long 3220176896
- .long 2255197647
- .long 1068727457
- .long 2796464483
- .long 1071152610
- .long 3758096384
- .long 3160878317
- .long 0
- .long 3220176896
- .long 2476548698
- .long 1067846634
- .long 785751814
- .long 1070765062
- .long 2684354560
- .long 3161838221
- .long 0
- .long 3220176896
- .long 18115067
- .long 1066642694
- .long 1013556747
- .long 1070135480
- .long 3221225472
- .long 3160567065
- .long 0
- .long 3220176896
- .long 393047345
- .long 1064548654
- .long 3156849708
- .long 1069094822
- .long 3758096384
- .long 3158189848
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 393047345
- .long 1064548654
- .long 3156849708
- .long 3216578470
- .long 3758096384
- .long 1010706200
- .long 0
- .long 3220176896
- .long 18115067
- .long 1066642694
- .long 1013556747
- .long 3217619128
- .long 3221225472
- .long 1013083417
- .long 0
- .long 3220176896
- .long 2476548698
- .long 1067846634
- .long 785751814
- .long 3218248710
- .long 2684354560
- .long 1014354573
- .long 0
- .long 3220176896
- .long 2255197647
- .long 1068727457
- .long 2796464483
- .long 3218636258
- .long 3758096384
- .long 1013394669
- .long 0
- .long 3220176896
- .long 1945768569
- .long 1069431400
- .long 939980347
- .long 3219008349
- .long 536870912
- .long 3160280457
- .long 0
- .long 3220176896
- .long 1539668340
- .long 1069912679
- .long 967731400
- .long 3219244859
- .long 536870912
- .long 3163235805
- .long 0
- .long 3220176896
- .long 1403757309
- .long 1070403070
- .long 621354454
- .long 3219410163
- .long 536870912
- .long 3160934250
- .long 0
- .long 3220176896
- .long 2583490354
- .long 3217719929
- .long 1719614413
- .long 3219562654
- .long 536870912
- .long 1015799092
- .long 0
- .long 3219128320
- .long 2485417816
- .long 3217109964
- .long 1796544321
- .long 3219700864
- .long 536870912
- .long 1015203297
- .long 0
- .long 3219128320
- .long 2598800519
- .long 3215750067
- .long 688824739
- .long 3219823462
- .long 3758096384
- .long 3157915184
- .long 0
- .long 3219128320
- .long 2140183630
- .long 1067272748
- .long 4051746225
- .long 3219929266
- .long 2147483648
- .long 1014423729
- .long 0
- .long 3219128320
- .long 1699043957
- .long 1069418613
- .long 3476196678
- .long 3220017259
- .long 536870912
- .long 3161741286
- .long 0
- .long 3219128320
- .long 1991047213
- .long 3215237169
- .long 1455828442
- .long 3220086593
- .long 3758096384
- .long 3162988721
- .long 0
- .long 3218079744
- .long 240740309
- .long 1068244255
- .long 3489094832
- .long 3220136599
- .long 536870912
- .long 3161809431
- .long 0
- .long 3218079744
- .long 257503056
- .long 1067164005
- .long 2748392742
- .long 3220166797
- .long 1073741824
- .long 1015578102
- .long 0
- .long 3217031168
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 0
- .long 257503056
- .long 3214647653
- .long 2748392742
- .long 3220166797
- .long 1073741824
- .long 1015578102
- .long 0
- .long 1069547520
- .long 240740309
- .long 3215727903
- .long 3489094832
- .long 3220136599
- .long 536870912
- .long 3161809431
- .long 0
- .long 1070596096
- .long 1991047213
- .long 1067753521
- .long 1455828442
- .long 3220086593
- .long 3758096384
- .long 3162988721
- .long 0
- .long 1070596096
- .long 1699043957
- .long 3216902261
- .long 3476196678
- .long 3220017259
- .long 536870912
- .long 3161741286
- .long 0
- .long 1071644672
- .long 2140183630
- .long 3214756396
- .long 4051746225
- .long 3219929266
- .long 2147483648
- .long 1014423729
- .long 0
- .long 1071644672
- .long 2598800519
- .long 1068266419
- .long 688824739
- .long 3219823462
- .long 3758096384
- .long 3157915184
- .long 0
- .long 1071644672
- .long 2485417816
- .long 1069626316
- .long 1796544321
- .long 3219700864
- .long 536870912
- .long 1015203297
- .long 0
- .long 1071644672
- .long 2583490354
- .long 1070236281
- .long 1719614413
- .long 3219562654
- .long 536870912
- .long 1015799092
- .long 0
- .long 1071644672
- .long 1403757309
- .long 3217886718
- .long 621354454
- .long 3219410163
- .long 536870912
- .long 3160934250
- .long 0
- .long 1072693248
- .long 1539668340
- .long 3217396327
- .long 967731400
- .long 3219244859
- .long 536870912
- .long 3163235805
- .long 0
- .long 1072693248
- .long 1945768569
- .long 3216915048
- .long 939980347
- .long 3219008349
- .long 536870912
- .long 3160280457
- .long 0
- .long 1072693248
- .long 2255197647
- .long 3216211105
- .long 2796464483
- .long 3218636258
- .long 3758096384
- .long 1013394669
- .long 0
- .long 1072693248
- .long 2476548698
- .long 3215330282
- .long 785751814
- .long 3218248710
- .long 2684354560
- .long 1014354573
- .long 0
- .long 1072693248
- .long 18115067
- .long 3214126342
- .long 1013556747
- .long 3217619128
- .long 3221225472
- .long 1013083417
- .long 0
- .long 1072693248
- .long 393047345
- .long 3212032302
- .long 3156849708
- .long 3216578470
- .long 3758096384
- .long 1010706200
- .long 0
- .long 1072693248
- .type Ctable,@object
- .size Ctable,2048
- .align 16
-SC_2:
- .long 286331153
- .long 1065423121
- .long 1431655765
- .long 1067799893
- .type SC_2,@object
- .size SC_2,16
- .align 16
-SC_3:
- .long 436314138
- .long 3207201184
- .long 381774871
- .long 3210133868
- .type SC_3,@object
- .size SC_3,16
- .align 16
-SC_1:
- .long 1431655765
- .long 3217380693
- .long 0
- .long 3219128320
- .type SC_1,@object
- .size SC_1,16
- .align 16
-PI_INV_TABLE:
- .long 0
- .long 0
- .long 2734261102
- .long 1313084713
- .long 4230436817
- .long 4113882560
- .long 3680671129
- .long 1011060801
- .long 4266746795
- .long 3736847713
- .long 3072618042
- .long 1112396512
- .long 105459434
- .long 164729372
- .long 4263373596
- .long 2972297022
- .long 3900847605
- .long 784024708
- .long 3919343654
- .long 3026157121
- .long 965858873
- .long 2203269620
- .long 2625920907
- .long 3187222587
- .long 536385535
- .long 3724908559
- .long 4012839307
- .long 1510632735
- .long 1832287951
- .long 667617719
- .long 1330003814
- .long 2657085997
- .long 1965537991
- .long 3957715323
- .long 1023883767
- .long 2320667370
- .long 1811636145
- .long 529358088
- .long 1443049542
- .long 4235946923
- .long 4040145953
- .type PI_INV_TABLE,@object
- .size PI_INV_TABLE,164
- .space 12, 0x00 # pad
- .align 16
-PI_4:
- .long 1073741824
- .long 1072243195
- .long 407279769
- .long 1046758445
- .type PI_4,@object
- .size PI_4,16
- .align 8
-PI32INV:
- .long 1841940611
- .long 1076125488
- .type PI32INV,@object
- .size PI32INV,8
- .align 8
-SIGN_MASK:
- .long 0
- .long 2147483648
- .type SIGN_MASK,@object
- .size SIGN_MASK,8
- .align 8
-P_1:
- .long 1413480448
- .long 1069097467
- .type P_1,@object
- .size P_1,8
- .align 8
-P_3:
- .long 771977331
- .long 996350346
- .type P_3,@object
- .size P_3,8
- .align 8
-ONE:
- .long 0
- .long 1072693248
- .type ONE,@object
- .size ONE,8
- .align 8
-NEG_ZERO:
- .long 0
- .long 2147483648
- .type NEG_ZERO,@object
- .size NEG_ZERO,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000002c
- .4byte 0x0000001c
- .4byte ..___tag_value_cos.1-.
- .4byte ..___tag_value_cos.9-..___tag_value_cos.1
- .2byte 0x0400
- .4byte ..___tag_value_cos.3-..___tag_value_cos.1
- .4byte 0x0283100e
- .byte 0x04
- .4byte ..___tag_value_cos.5-..___tag_value_cos.3
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_cos.6-..___tag_value_cos.5
- .4byte 0x04c3100e
- .4byte ..___tag_value_cos.8-..___tag_value_cos.6
- .2byte 0x080e
-# End
diff --git a/libm/x86_64/s_expm1.S b/libm/x86_64/s_expm1.S
deleted file mode 100644
index 4b22f5a..0000000
--- a/libm/x86_64/s_expm1.S
+++ /dev/null
@@ -1,727 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Description:
-// Let K = 64 (table size).
-//
-// Four sub-domains:
-// 1. |x| < 1/(2*K)
-// expm1(x) ~ P(x)
-// 2. 1/(2*K) <= |x| <= 56*log(2)
-// x x/log(2) n
-// e - 1 = 2 = 2 * T[j] * (1 + P(y)) - 1
-// 3. 56*log(2) < x < MAX_LOG
-// x x x/log(2) n
-// e - 1 ~ e = 2 = 2 * T[j] * (1 + P(y))
-// 4. x < -56*log(2)
-// x x
-// e - 1 = -1 + e ~ -1
-// where
-// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K]
-// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2]
-// j/K
-// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
-//
-// P(y) is a minimax polynomial approximation of exp(x)-1
-// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
-//
-// In case 3, to avoid problems with arithmetic overflow and underflow,
-// n n1 n2
-// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
-// and BIAS is a value of exponent bias.
-//
-// Special cases:
-// expm1(NaN) is NaN
-// expm1(+INF) is +INF
-// expm1(-INF) is -1
-// expm1(x) is x for subnormals
-// for finite argument, only expm1(0)=0 is exact.
-// For IEEE double
-// if x > 709.782712893383973096 then expm1(x) overflow
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin expm1
-ENTRY(expm1)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_expm1.1:
- subq $56, %rsp
-..___tag_value_expm1.3:
- movsd %xmm0, 32(%rsp)
-..B1.2:
- unpcklpd %xmm0, %xmm0
- movapd cv(%rip), %xmm1
- movapd Shifter(%rip), %xmm6
- movapd 16+cv(%rip), %xmm2
- movapd 32+cv(%rip), %xmm3
- pextrw $3, %xmm0, %eax
- andl $32767, %eax
- movl $16527, %edx
- subl %eax, %edx
- subl $16304, %eax
- orl %eax, %edx
- cmpl $-2147483648, %edx
- jae .L_2TAG_PACKET_0.0.2
- mulpd %xmm0, %xmm1
- addpd %xmm6, %xmm1
- movapd %xmm1, %xmm7
- subpd %xmm6, %xmm1
- mulpd %xmm1, %xmm2
- movapd 48+cv(%rip), %xmm4
- mulpd %xmm1, %xmm3
- movapd 64+cv(%rip), %xmm5
- subpd %xmm2, %xmm0
- movd %xmm7, %eax
- movl %eax, %ecx
- andl $63, %ecx
- shll $4, %ecx
- sarl $6, %eax
- movl %eax, %edx
- subpd %xmm3, %xmm0
- lea Tbl_addr(%rip), %r11
- movapd (%rcx,%r11), %xmm2
- movq 80+cv(%rip), %xmm3
- mulpd %xmm0, %xmm4
- movapd %xmm0, %xmm1
- mulpd %xmm0, %xmm0
- mulsd %xmm0, %xmm3
- addpd %xmm4, %xmm5
- mulsd %xmm0, %xmm0
- movq %xmm2, %xmm4
- unpckhpd %xmm2, %xmm2
- movdqa mmask(%rip), %xmm6
- pand %xmm6, %xmm7
- movdqa bias(%rip), %xmm6
- paddq %xmm6, %xmm7
- psllq $46, %xmm7
- mulsd %xmm0, %xmm3
- mulpd %xmm5, %xmm0
- addl $894, %edx
- cmpl $1916, %edx
- ja .L_2TAG_PACKET_1.0.2
- addsd %xmm3, %xmm0
- xorpd %xmm3, %xmm3
- movl $16368, %eax
- pinsrw $3, %eax, %xmm3
- orpd %xmm7, %xmm2
- mulsd %xmm4, %xmm7
- movq %xmm3, %xmm6
- addsd %xmm1, %xmm3
- pextrw $3, %xmm2, %edx
- pshufd $238, %xmm0, %xmm5
- psrlq $38, %xmm3
- psllq $38, %xmm3
- movq %xmm2, %xmm4
- subsd %xmm3, %xmm6
- addsd %xmm5, %xmm0
- addsd %xmm6, %xmm1
- addsd %xmm7, %xmm4
- mulsd %xmm3, %xmm7
- mulsd %xmm2, %xmm3
- xorpd %xmm5, %xmm5
- movl $16368, %eax
- pinsrw $3, %eax, %xmm5
- addsd %xmm1, %xmm0
- movl $17184, %ecx
- subl %edx, %ecx
- subl $16256, %edx
- orl %edx, %ecx
- jl .L_2TAG_PACKET_2.0.2
- mulsd %xmm4, %xmm0
- subsd %xmm5, %xmm3
- addsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
-.L_2TAG_PACKET_3.0.2:
- jmp ..B1.5
-.L_2TAG_PACKET_2.0.2:
- cmpl $0, %edx
- jl .L_2TAG_PACKET_4.0.2
- mulsd %xmm4, %xmm0
- subsd %xmm5, %xmm7
- addsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_4.0.2:
- mulsd %xmm4, %xmm0
- addsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
- subsd %xmm5, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_1.0.2:
- movl 36(%rsp), %ecx
- addsd %xmm0, %xmm1
- unpckhpd %xmm0, %xmm0
- addsd %xmm1, %xmm0
- cmpl $0, %ecx
- jl .L_2TAG_PACKET_5.0.2
- fstcw (%rsp)
- movw (%rsp), %dx
- orw $768, %dx
- movw %dx, 4(%rsp)
- fldcw 4(%rsp)
- movl %eax, %edx
- sarl $1, %eax
- subl %eax, %edx
- movdqa emask(%rip), %xmm6
- pandn %xmm2, %xmm6
- addl $1023, %eax
- movd %eax, %xmm3
- psllq $52, %xmm3
- orpd %xmm3, %xmm6
- mulsd %xmm3, %xmm4
- movsd %xmm0, 16(%rsp)
- fldl 16(%rsp)
- movsd %xmm6, 24(%rsp)
- fldl 24(%rsp)
- movsd %xmm4, 16(%rsp)
- fldl 16(%rsp)
- addl $1023, %edx
- movd %edx, %xmm4
- psllq $52, %xmm4
- faddp %st, %st(1)
- fmul %st, %st(1)
- faddp %st, %st(1)
- movsd %xmm4, 24(%rsp)
- fldl 24(%rsp)
- fmulp %st, %st(1)
- fstpl 16(%rsp)
- movsd 16(%rsp), %xmm0
- fldcw (%rsp)
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- cmpl $32752, %ecx
- jae .L_2TAG_PACKET_6.0.2
- jmp ..B1.5
- cmpl $-2147483648, %ecx
- jb .L_2TAG_PACKET_6.0.2
- jmp ..B1.5
-.L_2TAG_PACKET_6.0.2:
- movl $41, 8(%rsp)
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_8.0.2:
- cmpl $2146435072, %eax
- jae .L_2TAG_PACKET_9.0.2
- movsd XMAX(%rip), %xmm0
- mulsd %xmm0, %xmm0
- movl $41, 8(%rsp)
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_9.0.2:
- movl 36(%rsp), %eax
- movl 32(%rsp), %edx
- movl %eax, %ecx
- andl $2147483647, %eax
- cmpl $2146435072, %eax
- ja .L_2TAG_PACKET_10.0.2
- cmpl $0, %edx
- jne .L_2TAG_PACKET_10.0.2
- cmpl $0, %ecx
- jl .L_2TAG_PACKET_11.0.2
- movq INF(%rip), %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_11.0.2:
- jmp .L_2TAG_PACKET_5.0.2
-.L_2TAG_PACKET_10.0.2:
- movsd 32(%rsp), %xmm0
- addsd %xmm0, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_12.0.2:
- addl $16304, %eax
- cmpl $15504, %eax
- jb .L_2TAG_PACKET_13.0.2
- movapd cvl(%rip), %xmm2
- pshufd $68, %xmm0, %xmm1
- movapd 16+cvl(%rip), %xmm3
- movapd 32+cvl(%rip), %xmm4
- movq 48+cvl(%rip), %xmm5
- mulsd %xmm1, %xmm1
- xorpd %xmm6, %xmm6
- movl $16352, %eax
- pinsrw $3, %eax, %xmm6
- mulpd %xmm0, %xmm2
- xorpd %xmm7, %xmm7
- movl $16368, %edx
- pinsrw $3, %edx, %xmm7
- addpd %xmm3, %xmm2
- mulsd %xmm1, %xmm5
- pshufd $228, %xmm1, %xmm3
- mulpd %xmm1, %xmm1
- mulsd %xmm0, %xmm6
- mulpd %xmm0, %xmm2
- addpd %xmm4, %xmm2
- movq %xmm7, %xmm4
- addsd %xmm6, %xmm7
- mulpd %xmm3, %xmm1
- psrlq $27, %xmm7
- psllq $27, %xmm7
- movq HIGHMASK(%rip), %xmm3
- subsd %xmm7, %xmm4
- mulpd %xmm1, %xmm2
- addsd %xmm4, %xmm6
- pshufd $238, %xmm2, %xmm1
- addsd %xmm2, %xmm6
- andpd %xmm0, %xmm3
- movq %xmm0, %xmm4
- addsd %xmm6, %xmm1
- subsd %xmm3, %xmm0
- addsd %xmm5, %xmm1
- mulsd %xmm7, %xmm3
- mulsd %xmm7, %xmm0
- mulsd %xmm1, %xmm4
- addsd %xmm4, %xmm0
- addsd %xmm3, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_13.0.2:
- cmpl $16, %eax
- jae .L_2TAG_PACKET_3.0.2
- movq %xmm0, %xmm2
- movd %xmm0, %eax
- psrlq $31, %xmm2
- movd %xmm2, %ecx
- orl %ecx, %eax
- je .L_2TAG_PACKET_3.0.2
- movl $16, %edx
- xorpd %xmm1, %xmm1
- pinsrw $3, %edx, %xmm1
- mulsd %xmm1, %xmm1
- movl $42, 8(%rsp)
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_0.0.2:
- cmpl $0, %eax
- jl .L_2TAG_PACKET_12.0.2
- movl 36(%rsp), %eax
- cmpl $1083179008, %eax
- jge .L_2TAG_PACKET_8.0.2
- cmpl $-1048576, %eax
- jae .L_2TAG_PACKET_9.0.2
-.L_2TAG_PACKET_5.0.2:
- xorpd %xmm0, %xmm0
- movl $49136, %eax
- pinsrw $3, %eax, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_7.0.2:
- movq %xmm0, 40(%rsp)
-..B1.3:
- movq 40(%rsp), %xmm0
-.L_2TAG_PACKET_14.0.2:
-..B1.5:
- addq $56, %rsp
-..___tag_value_expm1.4:
- ret
-..___tag_value_expm1.5:
-END(expm1)
-# -- End expm1
- .section .rodata, "a"
- .align 16
- .align 16
-cv:
- .long 1697350398
- .long 1079448903
- .long 1697350398
- .long 1079448903
- .long 4277796864
- .long 1065758274
- .long 4277796864
- .long 1065758274
- .long 3164486458
- .long 1025308570
- .long 3164486458
- .long 1025308570
- .long 1963358694
- .long 1065423121
- .long 1431655765
- .long 1069897045
- .long 1431655765
- .long 1067799893
- .long 0
- .long 1071644672
- .long 381774871
- .long 1062650220
- .long 381774871
- .long 1062650220
- .type cv,@object
- .size cv,96
- .align 16
-Shifter:
- .long 0
- .long 1127743488
- .long 0
- .long 1127743488
- .type Shifter,@object
- .size Shifter,16
- .align 16
-Tbl_addr:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1000070955
- .long 1042145304
- .long 1040187392
- .long 11418
- .long 988267849
- .long 1039500660
- .long 3539992576
- .long 22960
- .long 36755401
- .long 1042114290
- .long 402653184
- .long 34629
- .long 3634769483
- .long 1042178627
- .long 1820327936
- .long 46424
- .long 2155991225
- .long 1041560680
- .long 847249408
- .long 58348
- .long 2766913307
- .long 1039293264
- .long 3489660928
- .long 70401
- .long 3651174602
- .long 1040488175
- .long 2927624192
- .long 82586
- .long 3073892131
- .long 1042240606
- .long 1006632960
- .long 94904
- .long 1328391742
- .long 1042019037
- .long 3942645760
- .long 107355
- .long 2650893825
- .long 1041903210
- .long 822083584
- .long 119943
- .long 2397289153
- .long 1041802037
- .long 2281701376
- .long 132667
- .long 430997175
- .long 1042110606
- .long 1845493760
- .long 145530
- .long 1230936525
- .long 1041801015
- .long 1702887424
- .long 158533
- .long 740675935
- .long 1040178913
- .long 4110417920
- .long 171677
- .long 3489810261
- .long 1041825986
- .long 2793406464
- .long 184965
- .long 2532600530
- .long 1040767882
- .long 167772160
- .long 198398
- .long 3542557060
- .long 1041827263
- .long 2986344448
- .long 211976
- .long 1401563777
- .long 1041061093
- .long 922746880
- .long 225703
- .long 3129406026
- .long 1041852413
- .long 880803840
- .long 239579
- .long 900993572
- .long 1039283234
- .long 1275068416
- .long 253606
- .long 2115029358
- .long 1042140042
- .long 562036736
- .long 267786
- .long 1086643152
- .long 1041785419
- .long 1610612736
- .long 282120
- .long 82864366
- .long 1041256244
- .long 3045064704
- .long 296610
- .long 2392968152
- .long 1040913683
- .long 3573547008
- .long 311258
- .long 2905856183
- .long 1040002214
- .long 1988100096
- .long 326066
- .long 3742008261
- .long 1040011137
- .long 1451229184
- .long 341035
- .long 863393794
- .long 1040880621
- .long 914358272
- .long 356167
- .long 1446136837
- .long 1041372426
- .long 3707764736
- .long 371463
- .long 927855201
- .long 1040617636
- .long 360710144
- .long 386927
- .long 1492679939
- .long 1041050306
- .long 2952790016
- .long 402558
- .long 608827001
- .long 1041582217
- .long 2181038080
- .long 418360
- .long 606260204
- .long 1042271987
- .long 1711276032
- .long 434334
- .long 3163044019
- .long 1041843851
- .long 1006632960
- .long 450482
- .long 4148747325
- .long 1041962972
- .long 3900702720
- .long 466805
- .long 802924201
- .long 1041275378
- .long 1442840576
- .long 483307
- .long 3052749833
- .long 1041940577
- .long 1937768448
- .long 499988
- .long 2216116399
- .long 1041486744
- .long 914358272
- .long 516851
- .long 2729697836
- .long 1041445764
- .long 2566914048
- .long 533897
- .long 540608356
- .long 1041310907
- .long 2600468480
- .long 551129
- .long 2916344493
- .long 1040535661
- .long 1107296256
- .long 568549
- .long 731391814
- .long 1039497014
- .long 2566914048
- .long 586158
- .long 1024722704
- .long 1041461625
- .long 2961178624
- .long 603959
- .long 3806831748
- .long 1041732499
- .long 2675965952
- .long 621954
- .long 238953304
- .long 1040316488
- .long 2189426688
- .long 640145
- .long 749123235
- .long 1041725785
- .long 2063597568
- .long 658534
- .long 1168187977
- .long 1041175214
- .long 2986344448
- .long 677123
- .long 3506096399
- .long 1042186095
- .long 1426063360
- .long 695915
- .long 1470221620
- .long 1041675499
- .long 2566914048
- .long 714911
- .long 3182425146
- .long 1041483134
- .long 3087007744
- .long 734114
- .long 3131698208
- .long 1042208657
- .long 4068474880
- .long 753526
- .long 2300504125
- .long 1041428596
- .long 2415919104
- .long 773150
- .long 2290297931
- .long 1037388400
- .long 3716153344
- .long 792987
- .long 3532148223
- .long 1041626194
- .long 771751936
- .long 813041
- .long 1161884404
- .long 1042015258
- .long 3699376128
- .long 833312
- .long 876383176
- .long 1037968878
- .long 1241513984
- .long 853805
- .long 3379986796
- .long 1042213153
- .long 3699376128
- .long 874520
- .long 1545797737
- .long 1041681569
- .long 58720256
- .long 895462
- .long 2925146801
- .long 1042212567
- .long 855638016
- .long 916631
- .long 1316627971
- .long 1038516204
- .long 3883925504
- .long 938030
- .long 3267869137
- .long 1040337004
- .long 2726297600
- .long 959663
- .long 3720868999
- .long 1041782409
- .long 3992977408
- .long 981531
- .long 433316142
- .long 1041994064
- .long 1526726656
- .long 1003638
- .long 781232103
- .long 1040093400
- .long 2172649472
- .long 1025985
- .type Tbl_addr,@object
- .size Tbl_addr,1024
- .align 16
-mmask:
- .long 4294967232
- .long 0
- .long 4294967232
- .long 0
- .type mmask,@object
- .size mmask,16
- .align 16
-bias:
- .long 65472
- .long 0
- .long 65472
- .long 0
- .type bias,@object
- .size bias,16
- .align 16
-emask:
- .long 0
- .long 4293918720
- .long 0
- .long 4293918720
- .type emask,@object
- .size emask,16
- .align 16
-cvl:
- .long 2773927732
- .long 1053236707
- .long 381774871
- .long 1062650220
- .long 379653899
- .long 1056571845
- .long 286331153
- .long 1065423121
- .long 436314138
- .long 1059717536
- .long 1431655765
- .long 1067799893
- .long 1431655765
- .long 1069897045
- .long 0
- .long 1071644672
- .type cvl,@object
- .size cvl,64
- .align 8
-XMAX:
- .long 4294967295
- .long 2146435071
- .type XMAX,@object
- .size XMAX,8
- .align 8
-INF:
- .long 0
- .long 2146435072
- .type INF,@object
- .size INF,8
- .align 8
-HIGHMASK:
- .long 4227858432
- .long 4294967295
- .type HIGHMASK,@object
- .size HIGHMASK,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_expm1.1-.
- .4byte ..___tag_value_expm1.5-..___tag_value_expm1.1
- .2byte 0x0400
- .4byte ..___tag_value_expm1.3-..___tag_value_expm1.1
- .2byte 0x400e
- .byte 0x04
- .4byte ..___tag_value_expm1.4-..___tag_value_expm1.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/s_log1p.S b/libm/x86_64/s_log1p.S
deleted file mode 100644
index 27fab74..0000000
--- a/libm/x86_64/s_log1p.S
+++ /dev/null
@@ -1,829 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Let x=2^k * mx, mx in [1,2)
-//
-// Get B~1/mx based on the output of rcpps instruction (B0)
-// B = int((B0*2^7+0.5))/2^7
-//
-// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
-//
-// Result: k*log(2) - log(B) + p(r)
-// p(r) is a degree 7 polynomial
-// -log(B) read from data table (high, low parts)
-// Result is formed from high and low parts
-//
-// Special cases:
-// log1p(NaN) = quiet NaN, and raise invalid exception
-// log1p(+INF) = that INF
-// log1p(x) = NaN if x < -1 or x = -INF, and raises invalid exception
-// log1p(-1) = -INF, and raises divide-by-zero exception
-// log1p(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin log1p
-ENTRY(log1p)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_log1p.1:
- subq $24, %rsp
-..___tag_value_log1p.3:
- movsd %xmm0, 8(%rsp)
-..B1.2:
- movq $0x3ff0000000000000, %rax
- movd %rax, %xmm2
- xorpd %xmm3, %xmm3
- movl $32768, %ecx
- movd %rcx, %xmm4
- movq $0xffffe00000000000, %r8
- movd %r8, %xmm5
- movddup %xmm0, %xmm7
- pshufd $68, %xmm2, %xmm6
- pextrw $3, %xmm0, %ecx
- addsd %xmm2, %xmm0
- movq %xmm0, %xmm1
- pextrw $3, %xmm0, %eax
- subsd %xmm0, %xmm6
- orpd %xmm2, %xmm0
- psrlq $27, %xmm0
- lea L_tbl(%rip), %r11
- psrld $2, %xmm0
- subl $16, %eax
- cmpl $32736, %eax
- jae .L_2TAG_PACKET_0.0.2
- addsd %xmm6, %xmm7
- rcpps %xmm0, %xmm0
- psllq $12, %xmm1
- pshufd $228, %xmm5, %xmm6
- psrlq $12, %xmm1
- andl $32752, %ecx
- cmpl $16256, %ecx
- jb .L_2TAG_PACKET_1.0.2
- andl $32752, %eax
- movl $32720, %ecx
- subl %eax, %ecx
- pinsrw $3, %ecx, %xmm3
-.L_2TAG_PACKET_2.0.2:
- mulsd %xmm3, %xmm7
- paddd %xmm4, %xmm0
- movq $0x3800000000000000, %rcx
- movd %rcx, %xmm4
- orpd %xmm2, %xmm1
- movd %xmm0, %edx
- psllq $29, %xmm0
- andpd %xmm1, %xmm5
- andpd %xmm6, %xmm0
- subsd %xmm5, %xmm1
- paddd %xmm4, %xmm0
- mulsd %xmm0, %xmm5
- movl $16352, %ecx
- subl %ecx, %eax
- cvtsi2sd %eax, %xmm4
- mulsd %xmm0, %xmm7
- mulsd %xmm0, %xmm1
- movq log2(%rip), %xmm6
- movapd coeff(%rip), %xmm3
- subsd %xmm2, %xmm5
- andl $16711680, %edx
- shrl $12, %edx
- movapd (%r11,%rdx), %xmm0
- movapd 16+coeff(%rip), %xmm2
- addsd %xmm5, %xmm1
- movq %xmm1, %xmm5
- addsd %xmm7, %xmm1
- subsd %xmm1, %xmm5
- addsd %xmm5, %xmm7
- mulsd %xmm4, %xmm6
- mulsd 8+log2(%rip), %xmm4
- mulsd %xmm1, %xmm3
- movddup %xmm1, %xmm5
- addsd %xmm6, %xmm0
- mulpd %xmm5, %xmm2
- mulpd %xmm5, %xmm5
- movddup %xmm0, %xmm6
- addsd %xmm1, %xmm0
- addpd 32+coeff(%rip), %xmm2
- mulpd %xmm5, %xmm3
- subsd %xmm0, %xmm6
- mulsd %xmm1, %xmm2
- addsd %xmm7, %xmm4
- mulsd %xmm1, %xmm7
- addsd %xmm6, %xmm1
- pshufd $238, %xmm0, %xmm6
- mulsd %xmm5, %xmm5
- addsd %xmm6, %xmm4
- subsd %xmm7, %xmm1
- addpd %xmm3, %xmm2
- addsd %xmm4, %xmm1
- mulpd %xmm5, %xmm2
- addsd %xmm2, %xmm1
- pshufd $238, %xmm2, %xmm5
- addsd %xmm5, %xmm1
- addsd %xmm1, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_0.0.2:
- movq 8(%rsp), %xmm0
- movq 8(%rsp), %xmm1
- addl $16, %eax
- cmpl $32768, %eax
- jae .L_2TAG_PACKET_3.0.2
- cmpl $0, %eax
- je .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_5.0.2:
- addsd %xmm0, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_6.0.2:
- ja .L_2TAG_PACKET_5.0.2
- cmpl $0, %edx
- ja .L_2TAG_PACKET_5.0.2
- jmp .L_2TAG_PACKET_7.0.2
-.L_2TAG_PACKET_3.0.2:
- movd %xmm1, %edx
- psrlq $32, %xmm1
- movd %xmm1, %ecx
- addl %ecx, %ecx
- cmpl $-2097152, %ecx
- jae .L_2TAG_PACKET_6.0.2
- orl %ecx, %edx
- cmpl $0, %edx
- je .L_2TAG_PACKET_4.0.2
-.L_2TAG_PACKET_7.0.2:
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $32752, %eax
- pinsrw $3, %eax, %xmm1
- movl $141, (%rsp)
- mulsd %xmm1, %xmm0
- jmp .L_2TAG_PACKET_8.0.2
-.L_2TAG_PACKET_4.0.2:
- xorpd %xmm1, %xmm1
- xorpd %xmm0, %xmm0
- movl $49136, %eax
- pinsrw $3, %eax, %xmm0
- divsd %xmm1, %xmm0
- movl $140, (%rsp)
- jmp .L_2TAG_PACKET_8.0.2
-.L_2TAG_PACKET_1.0.2:
- movq 8(%rsp), %xmm0
- cmpl $15504, %ecx
- jb .L_2TAG_PACKET_9.0.2
- movapd coeff2(%rip), %xmm1
- pshufd $68, %xmm0, %xmm0
- movapd 16+coeff2(%rip), %xmm2
- pshufd $68, %xmm0, %xmm4
- movapd 32+coeff2(%rip), %xmm3
- mulpd %xmm0, %xmm1
- xorpd %xmm6, %xmm6
- mulpd %xmm4, %xmm4
- addpd %xmm2, %xmm1
- pshufd $68, %xmm4, %xmm5
- mulpd %xmm0, %xmm4
- movl $49120, %eax
- pinsrw $3, %eax, %xmm6
- mulpd %xmm0, %xmm1
- mulsd %xmm4, %xmm4
- addpd %xmm3, %xmm1
- mulsd %xmm6, %xmm5
- mulpd %xmm4, %xmm1
- pshufd $238, %xmm1, %xmm7
- addsd %xmm7, %xmm1
- addsd %xmm5, %xmm1
- addsd %xmm1, %xmm0
- jmp ..B1.5
-.L_2TAG_PACKET_9.0.2:
- cmpl $16, %ecx
- jb .L_2TAG_PACKET_10.0.2
- jmp ..B1.5
-.L_2TAG_PACKET_10.0.2:
- movq %xmm0, %xmm1
- mulsd %xmm1, %xmm1
- jmp ..B1.5
-.L_2TAG_PACKET_8.0.2:
- movq %xmm0, 16(%rsp)
-..B1.3:
- movq 16(%rsp), %xmm0
-.L_2TAG_PACKET_11.0.2:
-..B1.5:
- addq $24, %rsp
-..___tag_value_log1p.4:
- ret
-..___tag_value_log1p.5:
-END(log1p)
-# -- End log1p
- .section .rodata, "a"
- .align 16
- .align 16
-L_tbl:
- .long 4277811200
- .long 1072049730
- .long 2479318832
- .long 1026487127
- .long 2854492160
- .long 1072033410
- .long 215631550
- .long 1025638968
- .long 1547061248
- .long 1072017216
- .long 2886781435
- .long 1026423395
- .long 649825280
- .long 1072001146
- .long 4281533405
- .long 1024038923
- .long 646346752
- .long 1071985198
- .long 1562735921
- .long 1023790276
- .long 2203734016
- .long 1071969370
- .long 1838397691
- .long 3173936209
- .long 1872169984
- .long 1071953661
- .long 3981202460
- .long 1022325013
- .long 669557760
- .long 1071938069
- .long 4182597802
- .long 3173174122
- .long 4076413952
- .long 1071922591
- .long 1209029111
- .long 3170736207
- .long 556125184
- .long 1071907228
- .long 821086028
- .long 3173437049
- .long 204914688
- .long 1071891976
- .long 2097025986
- .long 3171071798
- .long 387545088
- .long 1071876834
- .long 3142936996
- .long 3173092218
- .long 2912783360
- .long 1071861800
- .long 2502420140
- .long 1024505919
- .long 1144260608
- .long 1071846874
- .long 3315658140
- .long 3173469843
- .long 1471209472
- .long 1071832053
- .long 129621009
- .long 3172443877
- .long 1829683200
- .long 1071817336
- .long 3885467693
- .long 1025535275
- .long 288676864
- .long 1071802722
- .long 86139472
- .long 3171639793
- .long 3636378624
- .long 1071788208
- .long 1850238587
- .long 1024654342
- .long 1606817792
- .long 1071773795
- .long 3388899795
- .long 3173675586
- .long 1236164608
- .long 1071759480
- .long 3983599207
- .long 1020046558
- .long 1089616896
- .long 1071745262
- .long 4171974224
- .long 1024773198
- .long 4143093760
- .long 1071731139
- .long 2727587401
- .long 3173965207
- .long 600267776
- .long 1071717112
- .long 3147685042
- .long 3173353031
- .long 2249313280
- .long 1071703177
- .long 125835074
- .long 1025255832
- .long 3805303808
- .long 1071689334
- .long 2289991207
- .long 1025460331
- .long 87278592
- .long 1071675583
- .long 1106114045
- .long 1025933602
- .long 3195405312
- .long 1071661920
- .long 3885316576
- .long 3171206239
- .long 3853649920
- .long 1071648346
- .long 2977069852
- .long 3171236771
- .long 2944026624
- .long 1071625048
- .long 1008093493
- .long 1023444474
- .long 3993180160
- .long 1071598247
- .long 1862355595
- .long 1024642533
- .long 1454641152
- .long 1071571617
- .long 1514603089
- .long 1026500596
- .long 3286085632
- .long 1071545154
- .long 1400028424
- .long 3173279056
- .long 438773760
- .long 1071518858
- .long 120727864
- .long 3172148914
- .long 1212979200
- .long 1071492725
- .long 1625055594
- .long 3172901933
- .long 1189017600
- .long 1071466754
- .long 3920062376
- .long 1025727407
- .long 403064832
- .long 1071440943
- .long 1053271728
- .long 3171391427
- .long 3343210496
- .long 1071415289
- .long 3243395502
- .long 3173627613
- .long 1765777408
- .long 1071389792
- .long 2145968512
- .long 1026354304
- .long 461430784
- .long 1071364449
- .long 4094322285
- .long 1026021467
- .long 71706624
- .long 1071339258
- .long 763632021
- .long 1024496933
- .long 1380503552
- .long 1071314217
- .long 1383547992
- .long 3173088453
- .long 1015732224
- .long 1071289325
- .long 3198646877
- .long 1025390322
- .long 35977216
- .long 1071264580
- .long 2141026805
- .long 1025754693
- .long 3927306240
- .long 1071239979
- .long 282116272
- .long 3173394334
- .long 1125341184
- .long 1071215523
- .long 2768427504
- .long 3172279059
- .long 1666971648
- .long 1071191208
- .long 786837629
- .long 3172427445
- .long 2827694080
- .long 1071167033
- .long 3857122416
- .long 3173014241
- .long 2003683328
- .long 1071142997
- .long 859010954
- .long 1026545007
- .long 1004017664
- .long 1071119098
- .long 3356644970
- .long 3173458064
- .long 1753020416
- .long 1071095334
- .long 788338552
- .long 1026157693
- .long 1992718336
- .long 1071071704
- .long 1239179443
- .long 1026394889
- .long 3870234624
- .long 1071048206
- .long 2082614663
- .long 1024926053
- .long 1050437632
- .long 1071024840
- .long 660007840
- .long 1025548499
- .long 188395520
- .long 1071001603
- .long 3878792704
- .long 3173889571
- .long 3747176448
- .long 1070978493
- .long 144991708
- .long 3171552042
- .long 1405669376
- .long 1070955511
- .long 3999088879
- .long 1025486317
- .long 121151488
- .long 1070932654
- .long 2170865497
- .long 1026473584
- .long 2652319744
- .long 1070909920
- .long 453695652
- .long 3173916809
- .long 3262236672
- .long 1070887309
- .long 157800053
- .long 3173984206
- .long 601221120
- .long 1070864820
- .long 3968917661
- .long 1023992886
- .long 1999843328
- .long 1070842450
- .long 3053895004
- .long 1024998228
- .long 1992167424
- .long 1070820199
- .long 2968614856
- .long 1024552653
- .long 3788726272
- .long 1070798065
- .long 3542170808
- .long 3173573242
- .long 2094829568
- .long 1070776048
- .long 1246758132
- .long 1026202874
- .long 288675840
- .long 1070754146
- .long 3747328950
- .long 1026331585
- .long 1829681152
- .long 1070732357
- .long 3125197546
- .long 1024100318
- .long 1666869248
- .long 1070710681
- .long 1363656119
- .long 1026336493
- .long 3417110528
- .long 1070689116
- .long 4154791553
- .long 1026267853
- .long 2183653376
- .long 1070667662
- .long 1671819292
- .long 3173785870
- .long 1734434816
- .long 1070646317
- .long 373091049
- .long 1025972363
- .long 1615681536
- .long 1070625080
- .long 384650897
- .long 1022926043
- .long 1445382144
- .long 1070603950
- .long 344320330
- .long 3172397196
- .long 1823715328
- .long 1070569756
- .long 3389841200
- .long 1025231852
- .long 3839688704
- .long 1070527917
- .long 1706790417
- .long 3167363349
- .long 4293332992
- .long 1070486286
- .long 1614935088
- .long 1019351591
- .long 2966720512
- .long 1070444861
- .long 4145393717
- .long 3173711658
- .long 4066729984
- .long 1070403639
- .long 1974925028
- .long 3171437182
- .long 3337621504
- .long 1070362619
- .long 3314953170
- .long 3169971314
- .long 943448064
- .long 1070321799
- .long 1498682038
- .long 3173862340
- .long 1465634816
- .long 1070281176
- .long 1319952810
- .long 3171693965
- .long 1015734272
- .long 1070240749
- .long 1347821929
- .long 3173544515
- .long 118001664
- .long 1070200516
- .long 1751482746
- .long 1026134093
- .long 3707174912
- .long 1070160474
- .long 1486946159
- .long 1023930920
- .long 3946381312
- .long 1070120623
- .long 2867408081
- .long 3171368276
- .long 1699848192
- .long 1070080961
- .long 2590187139
- .long 1025379803
- .long 2235846656
- .long 1070041485
- .long 1888568069
- .long 3172754960
- .long 2339729408
- .long 1070002194
- .long 3852214753
- .long 3173323149
- .long 3196850176
- .long 1069963086
- .long 742141560
- .long 1025101707
- .long 1800683520
- .long 1069924160
- .long 3949500444
- .long 3172102179
- .long 3835801600
- .long 1069885413
- .long 3848895943
- .long 1025913832
- .long 2201202688
- .long 1069846845
- .long 1425913464
- .long 1025868665
- .long 2778279936
- .long 1069808453
- .long 2120889677
- .long 3173831128
- .long 2954203136
- .long 1069770236
- .long 592147081
- .long 1019621288
- .long 210141184
- .long 1069732193
- .long 3414275233
- .long 1023647084
- .long 709476352
- .long 1069694321
- .long 2413027164
- .long 1024462115
- .long 2116284416
- .long 1069656619
- .long 1144559924
- .long 1026336654
- .long 2183651328
- .long 1069619086
- .long 3459057650
- .long 1025634168
- .long 3047047168
- .long 1069581720
- .long 1879674924
- .long 3173508573
- .long 970711040
- .long 1069541521
- .long 1335954173
- .long 3173332182
- .long 2198478848
- .long 1069467449
- .long 2951103968
- .long 3173892200
- .long 1669611520
- .long 1069393703
- .long 531044147
- .long 1025149248
- .long 29114368
- .long 1069320280
- .long 3327831251
- .long 1025918673
- .long 2376949760
- .long 1069247176
- .long 737634533
- .long 3172176000
- .long 1085390848
- .long 1069174390
- .long 3108243400
- .long 3171828406
- .long 1566130176
- .long 1069101918
- .long 985483226
- .long 1025708380
- .long 792780800
- .long 1069029758
- .long 4184866295
- .long 1024426204
- .long 183156736
- .long 1068957907
- .long 2845699378
- .long 1022107277
- .long 1301782528
- .long 1068886362
- .long 1012735262
- .long 3173804294
- .long 1562411008
- .long 1068815121
- .long 2197086703
- .long 3170187813
- .long 2815549440
- .long 1068744181
- .long 2782613207
- .long 1026345054
- .long 2756124672
- .long 1068673540
- .long 2929486205
- .long 3173037800
- .long 3511050240
- .long 1068603195
- .long 1443733147
- .long 3173331549
- .long 3047047168
- .long 1068533144
- .long 1879674924
- .long 3172459997
- .long 3221667840
- .long 1068427825
- .long 1338588027
- .long 3171815742
- .long 3453861888
- .long 1068288883
- .long 1205348359
- .long 3172624626
- .long 3506110464
- .long 1068150514
- .long 893105198
- .long 1025571866
- .long 346013696
- .long 1068012714
- .long 3495569021
- .long 3172563349
- .long 4074029056
- .long 1067875476
- .long 3961106338
- .long 3171065595
- .long 3559784448
- .long 1067738798
- .long 1975385384
- .long 3173783155
- .long 797769728
- .long 1067602675
- .long 3760305787
- .long 1026047642
- .long 2313633792
- .long 1067467101
- .long 1559353171
- .long 1023480256
- .long 3960766464
- .long 1067213778
- .long 1067365107
- .long 1025865926
- .long 684261376
- .long 1066944805
- .long 844762164
- .long 3173687482
- .long 630718464
- .long 1066676905
- .long 2458269694
- .long 1024033081
- .long 1486061568
- .long 1066410070
- .long 115537874
- .long 3173243995
- .long 2743664640
- .long 1065886792
- .long 3665098304
- .long 3173471607
- .long 1971912704
- .long 1065357333
- .long 2577214440
- .long 3171993451
- .long 1498939392
- .long 1064306693
- .long 3409036923
- .long 1025599151
- .long 0
- .long 0
- .long 0
- .long 2147483648
- .type L_tbl,@object
- .size L_tbl,2064
- .align 16
-log2:
- .long 4277811200
- .long 1067855426
- .long 2479318832
- .long 1022292823
- .type log2,@object
- .size log2,16
- .align 16
-coeff:
- .long 2454267026
- .long 1069697316
- .long 0
- .long 3218079744
- .long 1030730101
- .long 3217380702
- .long 1431655765
- .long 1070945621
- .long 2576980378
- .long 1070176665
- .long 0
- .long 3219128320
- .type coeff,@object
- .size coeff,48
- .align 16
-coeff2:
- .long 0
- .long 3217031168
- .long 2576980378
- .long 1070176665
- .long 2454267026
- .long 1069697316
- .long 0
- .long 3218079744
- .long 1431655765
- .long 3217380693
- .long 1431655765
- .long 1070945621
- .type coeff2,@object
- .size coeff2,48
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_log1p.1-.
- .4byte ..___tag_value_log1p.5-..___tag_value_log1p.1
- .2byte 0x0400
- .4byte ..___tag_value_log1p.3-..___tag_value_log1p.1
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_log1p.4-..___tag_value_log1p.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/s_sin.S b/libm/x86_64/s_sin.S
deleted file mode 100644
index fb54a2a..0000000
--- a/libm/x86_64/s_sin.S
+++ /dev/null
@@ -1,1300 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// 1. RANGE REDUCTION
-//
-// We perform an initial range reduction from X to r with
-//
-// X =~= N * pi/32 + r
-//
-// so that |r| <= pi/64 + epsilon. We restrict inputs to those
-// where |N| <= 932560. Beyond this, the range reduction is
-// insufficiently accurate. For extremely small inputs,
-// denormalization can occur internally, impacting performance.
-// This means that the main path is actually only taken for
-// 2^-252 <= |X| < 90112.
-//
-// To avoid branches, we perform the range reduction to full
-// accuracy each time.
-//
-// X - N * (P_1 + P_2 + P_3)
-//
-// where P_1 and P_2 are 32-bit numbers (so multiplication by N
-// is exact) and P_3 is a 53-bit number. Together, these
-// approximate pi well enough for all cases in the restricted
-// range.
-//
-// The main reduction sequence is:
-//
-// y = 32/pi * x
-// N = integer(y)
-// (computed by adding and subtracting off SHIFTER)
-//
-// m_1 = N * P_1
-// m_2 = N * P_2
-// r_1 = x - m_1
-// r = r_1 - m_2
-// (this r can be used for most of the calculation)
-//
-// c_1 = r_1 - r
-// m_3 = N * P_3
-// c_2 = c_1 - m_2
-// c = c_2 - m_3
-//
-// 2. MAIN ALGORITHM
-//
-// The algorithm uses a table lookup based on B = M * pi / 32
-// where M = N mod 64. The stored values are:
-// sigma closest power of 2 to cos(B)
-// C_hl 53-bit cos(B) - sigma
-// S_hi + S_lo 2 * 53-bit sin(B)
-//
-// The computation is organized as follows:
-//
-// sin(B + r + c) = [sin(B) + sigma * r] +
-// r * (cos(B) - sigma) +
-// sin(B) * [cos(r + c) - 1] +
-// cos(B) * [sin(r + c) - r]
-//
-// which is approximately:
-//
-// [S_hi + sigma * r] +
-// C_hl * r +
-// S_lo + S_hi * [(cos(r) - 1) - r * c] +
-// (C_hl + sigma) * [(sin(r) - r) + c]
-//
-// and this is what is actually computed. We separate this sum
-// into four parts:
-//
-// hi + med + pols + corr
-//
-// where
-//
-// hi = S_hi + sigma r
-// med = C_hl * r
-// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r)
-// corr = S_lo + c * ((C_hl + sigma) - S_hi * r)
-//
-// 3. POLYNOMIAL
-//
-// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) *
-// (sin(r) - r) can be rearranged freely, since it is quite
-// small, so we exploit parallelism to the fullest.
-//
-// psc4 = SC_4 * r_1
-// msc4 = psc4 * r
-// r2 = r * r
-// msc2 = SC_2 * r2
-// r4 = r2 * r2
-// psc3 = SC_3 + msc4
-// psc1 = SC_1 + msc2
-// msc3 = r4 * psc3
-// sincospols = psc1 + msc3
-// pols = sincospols *
-// <S_hi * r^2 | (C_hl + sigma) * r^3>
-//
-// 4. CORRECTION TERM
-//
-// This is where the "c" component of the range reduction is
-// taken into account; recall that just "r" is used for most of
-// the calculation.
-//
-// -c = m_3 - c_2
-// -d = S_hi * r - (C_hl + sigma)
-// corr = -c * -d + S_lo
-//
-// 5. COMPENSATED SUMMATIONS
-//
-// The two successive compensated summations add up the high
-// and medium parts, leaving just the low parts to add up at
-// the end.
-//
-// rs = sigma * r
-// res_int = S_hi + rs
-// k_0 = S_hi - res_int
-// k_2 = k_0 + rs
-// med = C_hl * r
-// res_hi = res_int + med
-// k_1 = res_int - res_hi
-// k_3 = k_1 + med
-//
-// 6. FINAL SUMMATION
-//
-// We now add up all the small parts:
-//
-// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3
-//
-// Now the overall result is just:
-//
-// res_hi + res_lo
-//
-// 7. SMALL ARGUMENTS
-//
-// If |x| < SNN (SNN meaning the smallest normal number), we
-// simply perform 0.1111111 cdots 1111 * x. For SNN <= |x|, we
-// do 2^-55 * (2^55 * x - x).
-//
-// Special cases:
-// sin(NaN) = quiet NaN, and raise invalid exception
-// sin(INF) = NaN and raise invalid exception
-// sin(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin sin
-ENTRY(sin)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_sin.1:
- pushq %rbx
-..___tag_value_sin.3:
- subq $16, %rsp
-..___tag_value_sin.5:
- movsd %xmm0, 8(%rsp)
-..B1.2:
- movl 12(%rsp), %eax
- movq PI32INV(%rip), %xmm1
- movq SHIFTER(%rip), %xmm2
- andl $2147418112, %eax
- subl $808452096, %eax
- cmpl $281346048, %eax
- ja .L_2TAG_PACKET_0.0.1
- mulsd %xmm0, %xmm1
- movapd ONEHALF(%rip), %xmm5
- movq SIGN_MASK(%rip), %xmm4
- andpd %xmm0, %xmm4
- orps %xmm4, %xmm5
- addpd %xmm5, %xmm1
- cvttsd2si %xmm1, %edx
- cvtsi2sd %edx, %xmm1
- movapd P_2(%rip), %xmm6
- movq $0x3fb921fb54400000, %r8
- movd %r8, %xmm3
- movapd SC_4(%rip), %xmm5
- pshufd $68, %xmm0, %xmm4
- mulsd %xmm1, %xmm3
- movddup %xmm1, %xmm1
- andl $63, %edx
- shll $5, %edx
- lea Ctable(%rip), %rax
- addq %rdx, %rax
- mulpd %xmm1, %xmm6
- mulsd P_3(%rip), %xmm1
- subsd %xmm3, %xmm4
- movq 8(%rax), %xmm7
- subsd %xmm3, %xmm0
- movddup %xmm4, %xmm3
- subsd %xmm6, %xmm4
- pshufd $68, %xmm0, %xmm0
- movapd (%rax), %xmm2
- mulpd %xmm0, %xmm5
- subpd %xmm6, %xmm0
- mulsd %xmm4, %xmm7
- subsd %xmm4, %xmm3
- mulpd %xmm0, %xmm5
- mulpd %xmm0, %xmm0
- subsd %xmm6, %xmm3
- movapd SC_2(%rip), %xmm6
- subsd %xmm3, %xmm1
- movq 24(%rax), %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm7
- mulsd %xmm4, %xmm2
- mulpd %xmm0, %xmm6
- mulsd %xmm4, %xmm3
- mulpd %xmm0, %xmm2
- mulpd %xmm0, %xmm0
- addpd SC_3(%rip), %xmm5
- mulsd (%rax), %xmm4
- addpd SC_1(%rip), %xmm6
- mulpd %xmm0, %xmm5
- movq %xmm3, %xmm0
- addsd 8(%rax), %xmm3
- mulpd %xmm7, %xmm1
- movq %xmm4, %xmm7
- addsd %xmm3, %xmm4
- addpd %xmm5, %xmm6
- movq 8(%rax), %xmm5
- subsd %xmm3, %xmm5
- subsd %xmm4, %xmm3
- addsd 16(%rax), %xmm1
- mulpd %xmm2, %xmm6
- addsd %xmm0, %xmm5
- addsd %xmm7, %xmm3
- addsd %xmm5, %xmm1
- addsd %xmm3, %xmm1
- addsd %xmm6, %xmm1
- unpckhpd %xmm6, %xmm6
- movq %xmm4, %xmm0
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_0.0.1:
- jg .L_2TAG_PACKET_1.0.1
- shrl $20, %eax
- cmpw $3325, %ax
- jne .L_2TAG_PACKET_2.0.1
- mulsd ALL_ONES(%rip), %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_2.0.1:
- movq TWO_POW_55(%rip), %xmm3
- mulsd %xmm0, %xmm3
- subsd %xmm0, %xmm3
- mulsd TWO_POW_M55(%rip), %xmm3
- jmp ..B1.4
-.L_2TAG_PACKET_1.0.1:
- pextrw $3, %xmm0, %eax
- andl $32752, %eax
- cmpl $32752, %eax
- je .L_2TAG_PACKET_3.0.1
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- subl $16224, %ecx
- shrl $7, %ecx
- andl $65532, %ecx
- lea PI_INV_TABLE(%rip), %r11
- addq %r11, %rcx
- movd %xmm0, %rax
- movl 20(%rcx), %r10d
- movl 24(%rcx), %r8d
- movl %eax, %edx
- shrq $21, %rax
- orl $-2147483648, %eax
- shrl $11, %eax
- movl %r10d, %r9d
- imulq %rdx, %r10
- imulq %rax, %r9
- imulq %rax, %r8
- movl 16(%rcx), %esi
- movl 12(%rcx), %edi
- movl %r10d, %r11d
- shrq $32, %r10
- addq %r10, %r9
- addq %r8, %r11
- movl %r11d, %r8d
- shrq $32, %r11
- addq %r11, %r9
- movl %esi, %r10d
- imulq %rdx, %rsi
- imulq %rax, %r10
- movl %edi, %r11d
- imulq %rdx, %rdi
- movl %esi, %ebx
- shrq $32, %rsi
- addq %rbx, %r9
- movl %r9d, %ebx
- shrq $32, %r9
- addq %rsi, %r10
- addq %r9, %r10
- shlq $32, %rbx
- orq %rbx, %r8
- imulq %rax, %r11
- movl 8(%rcx), %r9d
- movl 4(%rcx), %esi
- movl %edi, %ebx
- shrq $32, %rdi
- addq %rbx, %r10
- movl %r10d, %ebx
- shrq $32, %r10
- addq %rdi, %r11
- addq %r10, %r11
- movq %r9, %rdi
- imulq %rdx, %r9
- imulq %rax, %rdi
- movl %r9d, %r10d
- shrq $32, %r9
- addq %r10, %r11
- movl %r11d, %r10d
- shrq $32, %r11
- addq %r9, %rdi
- addq %r11, %rdi
- movq %rsi, %r9
- imulq %rdx, %rsi
- imulq %rax, %r9
- shlq $32, %r10
- orq %rbx, %r10
- movl (%rcx), %eax
- movl %esi, %r11d
- shrq $32, %rsi
- addq %r11, %rdi
- movl %edi, %r11d
- shrq $32, %rdi
- addq %rsi, %r9
- addq %rdi, %r9
- imulq %rax, %rdx
- pextrw $3, %xmm0, %ebx
- lea PI_INV_TABLE(%rip), %rdi
- subq %rdi, %rcx
- addl %ecx, %ecx
- addl %ecx, %ecx
- addl %ecx, %ecx
- addl $19, %ecx
- movl $32768, %esi
- andl %ebx, %esi
- shrl $4, %ebx
- andl $2047, %ebx
- subl $1023, %ebx
- subl %ebx, %ecx
- addq %rdx, %r9
- movl %ecx, %edx
- addl $32, %edx
- cmpl $1, %ecx
- jl .L_2TAG_PACKET_4.0.1
- negl %ecx
- addl $29, %ecx
- shll %cl, %r9d
- movl %r9d, %edi
- andl $536870911, %r9d
- testl $268435456, %r9d
- jne .L_2TAG_PACKET_5.0.1
- shrl %cl, %r9d
- movl $0, %ebx
- shlq $32, %r9
- orq %r11, %r9
-.L_2TAG_PACKET_6.0.1:
-.L_2TAG_PACKET_7.0.1:
- cmpq $0, %r9
- je .L_2TAG_PACKET_8.0.1
-.L_2TAG_PACKET_9.0.1:
- bsr %r9, %r11
- movl $29, %ecx
- subl %r11d, %ecx
- jle .L_2TAG_PACKET_10.0.1
- shlq %cl, %r9
- movq %r10, %rax
- shlq %cl, %r10
- addl %ecx, %edx
- negl %ecx
- addl $64, %ecx
- shrq %cl, %rax
- shrq %cl, %r8
- orq %rax, %r9
- orq %r8, %r10
-.L_2TAG_PACKET_11.0.1:
- cvtsi2sdq %r9, %xmm0
- shrq $1, %r10
- cvtsi2sdq %r10, %xmm3
- xorpd %xmm4, %xmm4
- shll $4, %edx
- negl %edx
- addl $16368, %edx
- orl %esi, %edx
- xorl %ebx, %edx
- pinsrw $3, %edx, %xmm4
- movq PI_4(%rip), %xmm2
- movq 8+PI_4(%rip), %xmm6
- xorpd %xmm5, %xmm5
- subl $1008, %edx
- pinsrw $3, %edx, %xmm5
- mulsd %xmm4, %xmm0
- shll $16, %esi
- sarl $31, %esi
- mulsd %xmm5, %xmm3
- movq %xmm0, %xmm1
- mulsd %xmm2, %xmm0
- shrl $29, %edi
- addsd %xmm3, %xmm1
- mulsd %xmm2, %xmm3
- addl %esi, %edi
- xorl %esi, %edi
- mulsd %xmm1, %xmm6
- movl %edi, %eax
- addsd %xmm3, %xmm6
- movq %xmm0, %xmm2
- addsd %xmm6, %xmm0
- subsd %xmm0, %xmm2
- addsd %xmm2, %xmm6
-.L_2TAG_PACKET_12.0.1:
- movq PI32INV(%rip), %xmm1
- mulsd %xmm0, %xmm1
- movq ONEHALF(%rip), %xmm5
- movq SIGN_MASK(%rip), %xmm4
- andpd %xmm0, %xmm4
- orps %xmm4, %xmm5
- addpd %xmm5, %xmm1
- cvttsd2si %xmm1, %edx
- cvtsi2sd %edx, %xmm1
- movq P_1(%rip), %xmm3
- movapd P_2(%rip), %xmm2
- mulsd %xmm1, %xmm3
- unpcklpd %xmm1, %xmm1
- shll $3, %eax
- addl $1865216, %edx
- movq %xmm0, %xmm4
- addl %eax, %edx
- andl $63, %edx
- movapd SC_4(%rip), %xmm5
- lea Ctable(%rip), %rax
- shll $5, %edx
- addq %rdx, %rax
- mulpd %xmm1, %xmm2
- subsd %xmm3, %xmm0
- mulsd P_3(%rip), %xmm1
- subsd %xmm3, %xmm4
- movq 8(%rax), %xmm7
- unpcklpd %xmm0, %xmm0
- movq %xmm4, %xmm3
- subsd %xmm2, %xmm4
- mulpd %xmm0, %xmm5
- subpd %xmm2, %xmm0
- mulsd %xmm4, %xmm7
- subsd %xmm4, %xmm3
- mulpd %xmm0, %xmm5
- mulpd %xmm0, %xmm0
- subsd %xmm2, %xmm3
- movapd (%rax), %xmm2
- subsd %xmm3, %xmm1
- movq 24(%rax), %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm7
- subsd %xmm6, %xmm1
- movapd SC_2(%rip), %xmm6
- mulsd %xmm4, %xmm2
- mulpd %xmm0, %xmm6
- mulsd %xmm4, %xmm3
- mulpd %xmm0, %xmm2
- mulpd %xmm0, %xmm0
- addpd SC_3(%rip), %xmm5
- mulsd (%rax), %xmm4
- addpd SC_1(%rip), %xmm6
- mulpd %xmm0, %xmm5
- movq %xmm3, %xmm0
- addsd 8(%rax), %xmm3
- mulpd %xmm7, %xmm1
- movq %xmm4, %xmm7
- addsd %xmm3, %xmm4
- addpd %xmm5, %xmm6
- movq 8(%rax), %xmm5
- subsd %xmm3, %xmm5
- subsd %xmm4, %xmm3
- addsd 16(%rax), %xmm1
- mulpd %xmm2, %xmm6
- addsd %xmm0, %xmm5
- addsd %xmm7, %xmm3
- addsd %xmm5, %xmm1
- addsd %xmm3, %xmm1
- addsd %xmm6, %xmm1
- unpckhpd %xmm6, %xmm6
- movq %xmm4, %xmm0
- addsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_8.0.1:
- addl $64, %edx
- movq %r10, %r9
- movq %r8, %r10
- movq $0, %r8
- cmpq $0, %r9
- jne .L_2TAG_PACKET_9.0.1
- addl $64, %edx
- movq %r10, %r9
- movq %r8, %r10
- cmpq $0, %r9
- jne .L_2TAG_PACKET_9.0.1
- xorpd %xmm0, %xmm0
- xorpd %xmm6, %xmm6
- jmp .L_2TAG_PACKET_12.0.1
-.L_2TAG_PACKET_10.0.1:
- je .L_2TAG_PACKET_11.0.1
- negl %ecx
- shrq %cl, %r10
- movq %r9, %rax
- shrq %cl, %r9
- subl %ecx, %edx
- negl %ecx
- addl $64, %ecx
- shlq %cl, %rax
- orq %rax, %r10
- jmp .L_2TAG_PACKET_11.0.1
-.L_2TAG_PACKET_4.0.1:
- negl %ecx
- shlq $32, %r9
- orq %r11, %r9
- shlq %cl, %r9
- movq %r9, %rdi
- testl $-2147483648, %r9d
- jne .L_2TAG_PACKET_13.0.1
- shrl %cl, %r9d
- movl $0, %ebx
- shrq $3, %rdi
- jmp .L_2TAG_PACKET_7.0.1
-.L_2TAG_PACKET_5.0.1:
- shrl %cl, %r9d
- movl $536870912, %ebx
- shrl %cl, %ebx
- shlq $32, %r9
- orq %r11, %r9
- shlq $32, %rbx
- addl $536870912, %edi
- movq $0, %rcx
- movq $0, %r11
- subq %r8, %rcx
- sbbq %r10, %r11
- sbbq %r9, %rbx
- movq %rcx, %r8
- movq %r11, %r10
- movq %rbx, %r9
- movl $32768, %ebx
- jmp .L_2TAG_PACKET_6.0.1
-.L_2TAG_PACKET_13.0.1:
- shrl %cl, %r9d
- movq $0x100000000, %rbx
- shrq %cl, %rbx
- movq $0, %rcx
- movq $0, %r11
- subq %r8, %rcx
- sbbq %r10, %r11
- sbbq %r9, %rbx
- movq %rcx, %r8
- movq %r11, %r10
- movq %rbx, %r9
- movl $32768, %ebx
- shrq $3, %rdi
- addl $536870912, %edi
- jmp .L_2TAG_PACKET_7.0.1
-.L_2TAG_PACKET_3.0.1:
- movq 8(%rsp), %xmm0
- mulsd NEG_ZERO(%rip), %xmm0
- movq %xmm0, (%rsp)
-.L_2TAG_PACKET_14.0.1:
-..B1.4:
- addq $16, %rsp
-..___tag_value_sin.6:
- popq %rbx
-..___tag_value_sin.8:
- ret
-..___tag_value_sin.9:
-END(sin)
-# -- End sin
- .section .rodata, "a"
- .align 16
- .align 16
-ONEHALF:
- .long 0
- .long 1071644672
- .long 0
- .long 1071644672
- .type ONEHALF,@object
- .size ONEHALF,16
- .align 16
-P_2:
- .long 442499072
- .long 1032893537
- .long 442499072
- .long 1032893537
- .type P_2,@object
- .size P_2,16
- .align 16
-SC_4:
- .long 2773927732
- .long 1053236707
- .long 436314138
- .long 1056571808
- .type SC_4,@object
- .size SC_4,16
- .align 16
-Ctable:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 393047345
- .long 3212032302
- .long 3156849708
- .long 1069094822
- .long 3758096384
- .long 3158189848
- .long 0
- .long 1072693248
- .long 18115067
- .long 3214126342
- .long 1013556747
- .long 1070135480
- .long 3221225472
- .long 3160567065
- .long 0
- .long 1072693248
- .long 2476548698
- .long 3215330282
- .long 785751814
- .long 1070765062
- .long 2684354560
- .long 3161838221
- .long 0
- .long 1072693248
- .long 2255197647
- .long 3216211105
- .long 2796464483
- .long 1071152610
- .long 3758096384
- .long 3160878317
- .long 0
- .long 1072693248
- .long 1945768569
- .long 3216915048
- .long 939980347
- .long 1071524701
- .long 536870912
- .long 1012796809
- .long 0
- .long 1072693248
- .long 1539668340
- .long 3217396327
- .long 967731400
- .long 1071761211
- .long 536870912
- .long 1015752157
- .long 0
- .long 1072693248
- .long 1403757309
- .long 3217886718
- .long 621354454
- .long 1071926515
- .long 536870912
- .long 1013450602
- .long 0
- .long 1072693248
- .long 2583490354
- .long 1070236281
- .long 1719614413
- .long 1072079006
- .long 536870912
- .long 3163282740
- .long 0
- .long 1071644672
- .long 2485417816
- .long 1069626316
- .long 1796544321
- .long 1072217216
- .long 536870912
- .long 3162686945
- .long 0
- .long 1071644672
- .long 2598800519
- .long 1068266419
- .long 688824739
- .long 1072339814
- .long 3758096384
- .long 1010431536
- .long 0
- .long 1071644672
- .long 2140183630
- .long 3214756396
- .long 4051746225
- .long 1072445618
- .long 2147483648
- .long 3161907377
- .long 0
- .long 1071644672
- .long 1699043957
- .long 3216902261
- .long 3476196678
- .long 1072533611
- .long 536870912
- .long 1014257638
- .long 0
- .long 1071644672
- .long 1991047213
- .long 1067753521
- .long 1455828442
- .long 1072602945
- .long 3758096384
- .long 1015505073
- .long 0
- .long 1070596096
- .long 240740309
- .long 3215727903
- .long 3489094832
- .long 1072652951
- .long 536870912
- .long 1014325783
- .long 0
- .long 1070596096
- .long 257503056
- .long 3214647653
- .long 2748392742
- .long 1072683149
- .long 1073741824
- .long 3163061750
- .long 0
- .long 1069547520
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 0
- .long 257503056
- .long 1067164005
- .long 2748392742
- .long 1072683149
- .long 1073741824
- .long 3163061750
- .long 0
- .long 3217031168
- .long 240740309
- .long 1068244255
- .long 3489094832
- .long 1072652951
- .long 536870912
- .long 1014325783
- .long 0
- .long 3218079744
- .long 1991047213
- .long 3215237169
- .long 1455828442
- .long 1072602945
- .long 3758096384
- .long 1015505073
- .long 0
- .long 3218079744
- .long 1699043957
- .long 1069418613
- .long 3476196678
- .long 1072533611
- .long 536870912
- .long 1014257638
- .long 0
- .long 3219128320
- .long 2140183630
- .long 1067272748
- .long 4051746225
- .long 1072445618
- .long 2147483648
- .long 3161907377
- .long 0
- .long 3219128320
- .long 2598800519
- .long 3215750067
- .long 688824739
- .long 1072339814
- .long 3758096384
- .long 1010431536
- .long 0
- .long 3219128320
- .long 2485417816
- .long 3217109964
- .long 1796544321
- .long 1072217216
- .long 536870912
- .long 3162686945
- .long 0
- .long 3219128320
- .long 2583490354
- .long 3217719929
- .long 1719614413
- .long 1072079006
- .long 536870912
- .long 3163282740
- .long 0
- .long 3219128320
- .long 1403757309
- .long 1070403070
- .long 621354454
- .long 1071926515
- .long 536870912
- .long 1013450602
- .long 0
- .long 3220176896
- .long 1539668340
- .long 1069912679
- .long 967731400
- .long 1071761211
- .long 536870912
- .long 1015752157
- .long 0
- .long 3220176896
- .long 1945768569
- .long 1069431400
- .long 939980347
- .long 1071524701
- .long 536870912
- .long 1012796809
- .long 0
- .long 3220176896
- .long 2255197647
- .long 1068727457
- .long 2796464483
- .long 1071152610
- .long 3758096384
- .long 3160878317
- .long 0
- .long 3220176896
- .long 2476548698
- .long 1067846634
- .long 785751814
- .long 1070765062
- .long 2684354560
- .long 3161838221
- .long 0
- .long 3220176896
- .long 18115067
- .long 1066642694
- .long 1013556747
- .long 1070135480
- .long 3221225472
- .long 3160567065
- .long 0
- .long 3220176896
- .long 393047345
- .long 1064548654
- .long 3156849708
- .long 1069094822
- .long 3758096384
- .long 3158189848
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 393047345
- .long 1064548654
- .long 3156849708
- .long 3216578470
- .long 3758096384
- .long 1010706200
- .long 0
- .long 3220176896
- .long 18115067
- .long 1066642694
- .long 1013556747
- .long 3217619128
- .long 3221225472
- .long 1013083417
- .long 0
- .long 3220176896
- .long 2476548698
- .long 1067846634
- .long 785751814
- .long 3218248710
- .long 2684354560
- .long 1014354573
- .long 0
- .long 3220176896
- .long 2255197647
- .long 1068727457
- .long 2796464483
- .long 3218636258
- .long 3758096384
- .long 1013394669
- .long 0
- .long 3220176896
- .long 1945768569
- .long 1069431400
- .long 939980347
- .long 3219008349
- .long 536870912
- .long 3160280457
- .long 0
- .long 3220176896
- .long 1539668340
- .long 1069912679
- .long 967731400
- .long 3219244859
- .long 536870912
- .long 3163235805
- .long 0
- .long 3220176896
- .long 1403757309
- .long 1070403070
- .long 621354454
- .long 3219410163
- .long 536870912
- .long 3160934250
- .long 0
- .long 3220176896
- .long 2583490354
- .long 3217719929
- .long 1719614413
- .long 3219562654
- .long 536870912
- .long 1015799092
- .long 0
- .long 3219128320
- .long 2485417816
- .long 3217109964
- .long 1796544321
- .long 3219700864
- .long 536870912
- .long 1015203297
- .long 0
- .long 3219128320
- .long 2598800519
- .long 3215750067
- .long 688824739
- .long 3219823462
- .long 3758096384
- .long 3157915184
- .long 0
- .long 3219128320
- .long 2140183630
- .long 1067272748
- .long 4051746225
- .long 3219929266
- .long 2147483648
- .long 1014423729
- .long 0
- .long 3219128320
- .long 1699043957
- .long 1069418613
- .long 3476196678
- .long 3220017259
- .long 536870912
- .long 3161741286
- .long 0
- .long 3219128320
- .long 1991047213
- .long 3215237169
- .long 1455828442
- .long 3220086593
- .long 3758096384
- .long 3162988721
- .long 0
- .long 3218079744
- .long 240740309
- .long 1068244255
- .long 3489094832
- .long 3220136599
- .long 536870912
- .long 3161809431
- .long 0
- .long 3218079744
- .long 257503056
- .long 1067164005
- .long 2748392742
- .long 3220166797
- .long 1073741824
- .long 1015578102
- .long 0
- .long 3217031168
- .long 0
- .long 0
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 0
- .long 257503056
- .long 3214647653
- .long 2748392742
- .long 3220166797
- .long 1073741824
- .long 1015578102
- .long 0
- .long 1069547520
- .long 240740309
- .long 3215727903
- .long 3489094832
- .long 3220136599
- .long 536870912
- .long 3161809431
- .long 0
- .long 1070596096
- .long 1991047213
- .long 1067753521
- .long 1455828442
- .long 3220086593
- .long 3758096384
- .long 3162988721
- .long 0
- .long 1070596096
- .long 1699043957
- .long 3216902261
- .long 3476196678
- .long 3220017259
- .long 536870912
- .long 3161741286
- .long 0
- .long 1071644672
- .long 2140183630
- .long 3214756396
- .long 4051746225
- .long 3219929266
- .long 2147483648
- .long 1014423729
- .long 0
- .long 1071644672
- .long 2598800519
- .long 1068266419
- .long 688824739
- .long 3219823462
- .long 3758096384
- .long 3157915184
- .long 0
- .long 1071644672
- .long 2485417816
- .long 1069626316
- .long 1796544321
- .long 3219700864
- .long 536870912
- .long 1015203297
- .long 0
- .long 1071644672
- .long 2583490354
- .long 1070236281
- .long 1719614413
- .long 3219562654
- .long 536870912
- .long 1015799092
- .long 0
- .long 1071644672
- .long 1403757309
- .long 3217886718
- .long 621354454
- .long 3219410163
- .long 536870912
- .long 3160934250
- .long 0
- .long 1072693248
- .long 1539668340
- .long 3217396327
- .long 967731400
- .long 3219244859
- .long 536870912
- .long 3163235805
- .long 0
- .long 1072693248
- .long 1945768569
- .long 3216915048
- .long 939980347
- .long 3219008349
- .long 536870912
- .long 3160280457
- .long 0
- .long 1072693248
- .long 2255197647
- .long 3216211105
- .long 2796464483
- .long 3218636258
- .long 3758096384
- .long 1013394669
- .long 0
- .long 1072693248
- .long 2476548698
- .long 3215330282
- .long 785751814
- .long 3218248710
- .long 2684354560
- .long 1014354573
- .long 0
- .long 1072693248
- .long 18115067
- .long 3214126342
- .long 1013556747
- .long 3217619128
- .long 3221225472
- .long 1013083417
- .long 0
- .long 1072693248
- .long 393047345
- .long 3212032302
- .long 3156849708
- .long 3216578470
- .long 3758096384
- .long 1010706200
- .long 0
- .long 1072693248
- .type Ctable,@object
- .size Ctable,2048
- .align 16
-SC_2:
- .long 286331153
- .long 1065423121
- .long 1431655765
- .long 1067799893
- .type SC_2,@object
- .size SC_2,16
- .align 16
-SC_3:
- .long 436314138
- .long 3207201184
- .long 381774871
- .long 3210133868
- .type SC_3,@object
- .size SC_3,16
- .align 16
-SC_1:
- .long 1431655765
- .long 3217380693
- .long 0
- .long 3219128320
- .type SC_1,@object
- .size SC_1,16
- .align 16
-PI_INV_TABLE:
- .long 0
- .long 0
- .long 2734261102
- .long 1313084713
- .long 4230436817
- .long 4113882560
- .long 3680671129
- .long 1011060801
- .long 4266746795
- .long 3736847713
- .long 3072618042
- .long 1112396512
- .long 105459434
- .long 164729372
- .long 4263373596
- .long 2972297022
- .long 3900847605
- .long 784024708
- .long 3919343654
- .long 3026157121
- .long 965858873
- .long 2203269620
- .long 2625920907
- .long 3187222587
- .long 536385535
- .long 3724908559
- .long 4012839307
- .long 1510632735
- .long 1832287951
- .long 667617719
- .long 1330003814
- .long 2657085997
- .long 1965537991
- .long 3957715323
- .long 1023883767
- .long 2320667370
- .long 1811636145
- .long 529358088
- .long 1443049542
- .long 4235946923
- .long 4040145953
- .type PI_INV_TABLE,@object
- .size PI_INV_TABLE,164
- .space 12, 0x00 # pad
- .align 16
-PI_4:
- .long 1073741824
- .long 1072243195
- .long 407279769
- .long 1046758445
- .type PI_4,@object
- .size PI_4,16
- .align 8
-PI32INV:
- .long 1841940611
- .long 1076125488
- .type PI32INV,@object
- .size PI32INV,8
- .align 8
-SHIFTER:
- .long 0
- .long 1127743488
- .type SHIFTER,@object
- .size SHIFTER,8
- .align 8
-SIGN_MASK:
- .long 0
- .long 2147483648
- .type SIGN_MASK,@object
- .size SIGN_MASK,8
- .align 8
-P_3:
- .long 771977331
- .long 996350346
- .type P_3,@object
- .size P_3,8
- .align 8
-ALL_ONES:
- .long 4294967295
- .long 1072693247
- .type ALL_ONES,@object
- .size ALL_ONES,8
- .align 8
-TWO_POW_55:
- .long 0
- .long 1130364928
- .type TWO_POW_55,@object
- .size TWO_POW_55,8
- .align 8
-TWO_POW_M55:
- .long 0
- .long 1015021568
- .type TWO_POW_M55,@object
- .size TWO_POW_M55,8
- .align 8
-P_1:
- .long 1413480448
- .long 1069097467
- .type P_1,@object
- .size P_1,8
- .align 8
-NEG_ZERO:
- .long 0
- .long 2147483648
- .type NEG_ZERO,@object
- .size NEG_ZERO,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000002c
- .4byte 0x0000001c
- .4byte ..___tag_value_sin.1-.
- .4byte ..___tag_value_sin.9-..___tag_value_sin.1
- .2byte 0x0400
- .4byte ..___tag_value_sin.3-..___tag_value_sin.1
- .4byte 0x0283100e
- .byte 0x04
- .4byte ..___tag_value_sin.5-..___tag_value_sin.3
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_sin.6-..___tag_value_sin.5
- .4byte 0x04c3100e
- .4byte ..___tag_value_sin.8-..___tag_value_sin.6
- .2byte 0x080e
-# End
diff --git a/libm/x86_64/s_tan.S b/libm/x86_64/s_tan.S
deleted file mode 100644
index 4fa12e3..0000000
--- a/libm/x86_64/s_tan.S
+++ /dev/null
@@ -1,2239 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// Polynomials coefficients and other constants.
-//
-// Note that in this algorithm, there is a different polynomial for
-// each breakpoint, so there are 32 sets of polynomial coefficients
-// as well as 32 instances of the other constants.
-//
-// The polynomial coefficients and constants are offset from the start
-// of the main block as follows:
-//
-// 0: c8 | c0
-// 16: c9 | c1
-// 32: c10 | c2
-// 48: c11 | c3
-// 64: c12 | c4
-// 80: c13 | c5
-// 96: c14 | c6
-// 112: c15 | c7
-// 128: T_hi
-// 136: T_lo
-// 144: Sigma
-// 152: T_hl
-// 160: Tau
-// 168: Mask
-// 176: (end of block)
-//
-// The total table size is therefore 5632 bytes.
-//
-// Note that c0 and c1 are always zero. We could try storing
-// other constants here, and just loading the low part of the
-// SIMD register in these cases, after ensuring the high part
-// is zero.
-//
-// The higher terms of the polynomial are computed in the *low*
-// part of the SIMD register. This is so we can overlap the
-// multiplication by r^8 and the unpacking of the other part.
-//
-// The constants are:
-// T_hi + T_lo = accurate constant term in power series
-// Sigma + T_hl = accurate coefficient of r in power series (Sigma=1 bit)
-// Tau = multiplier for the reciprocal, always -1 or 0
-//
-// The basic reconstruction formula using these constants is:
-//
-// High = tau * recip_hi + t_hi
-// Med = (sgn * r + t_hl * r)_hi
-// Low = (sgn * r + t_hl * r)_lo +
-// tau * recip_lo + T_lo + (T_hl + sigma) * c + pol
-//
-// where pol = c0 + c1 * r + c2 * r^2 + ... + c15 * r^15
-//
-// (c0 = c1 = 0, but using them keeps SIMD regularity)
-//
-// We then do a compensated sum High + Med, add the low parts together
-// and then do the final sum.
-//
-// Here recip_hi + recip_lo is an accurate reciprocal of the remainder
-// modulo pi/2
-//
-// Special cases:
-// tan(NaN) = quiet NaN, and raise invalid exception
-// tan(INF) = NaN and raise invalid exception
-// tan(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin tan
-ENTRY(tan)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_tan.1:
- pushq %rbx
-..___tag_value_tan.3:
- subq $16, %rsp
-..___tag_value_tan.5:
- movsd %xmm0, 8(%rsp)
-..B1.2:
- pextrw $3, %xmm0, %eax
- andl $32767, %eax
- subl $16314, %eax
- cmpl $270, %eax
- ja .L_2TAG_PACKET_0.0.1
- movapd ONEHALF(%rip), %xmm5
- movapd MUL16(%rip), %xmm6
- unpcklpd %xmm0, %xmm0
- movapd sign_mask(%rip), %xmm4
- andpd %xmm0, %xmm4
- movapd PI32INV(%rip), %xmm1
- mulpd %xmm0, %xmm1
- orps %xmm4, %xmm5
- addpd %xmm5, %xmm1
- movapd %xmm1, %xmm7
- unpckhpd %xmm7, %xmm7
- cvttsd2si %xmm7, %edx
- cvttpd2dq %xmm1, %xmm1
- cvtdq2pd %xmm1, %xmm1
- mulpd %xmm6, %xmm1
- movapd P_1(%rip), %xmm3
- movq QQ_2(%rip), %xmm5
- addq $469248, %rdx
- movapd P_2(%rip), %xmm4
- mulpd %xmm1, %xmm3
- andq $31, %rdx
- mulsd %xmm1, %xmm5
- movq %rdx, %rcx
- mulpd %xmm1, %xmm4
- shlq $1, %rcx
- subpd %xmm3, %xmm0
- mulpd P_3(%rip), %xmm1
- addq %rcx, %rdx
- shlq $2, %rcx
- addq %rcx, %rdx
- addsd %xmm0, %xmm5
- movapd %xmm0, %xmm2
- subpd %xmm4, %xmm0
- movq ONE(%rip), %xmm6
- shlq $4, %rdx
- lea Ctable(%rip), %rax
- andpd MASK_35(%rip), %xmm5
- movapd %xmm0, %xmm3
- addq %rdx, %rax
- subpd %xmm0, %xmm2
- unpckhpd %xmm0, %xmm0
- divsd %xmm5, %xmm6
- subpd %xmm4, %xmm2
- movapd 16(%rax), %xmm7
- subsd %xmm5, %xmm3
- mulpd %xmm0, %xmm7
- subpd %xmm1, %xmm2
- movapd 48(%rax), %xmm1
- mulpd %xmm0, %xmm1
- movapd 96(%rax), %xmm4
- mulpd %xmm0, %xmm4
- addsd %xmm3, %xmm2
- movapd %xmm0, %xmm3
- mulpd %xmm0, %xmm0
- addpd (%rax), %xmm7
- addpd 32(%rax), %xmm1
- mulpd %xmm0, %xmm1
- addpd 80(%rax), %xmm4
- addpd %xmm1, %xmm7
- movapd 112(%rax), %xmm1
- mulpd %xmm0, %xmm1
- mulpd %xmm0, %xmm0
- addpd %xmm1, %xmm4
- movapd 64(%rax), %xmm1
- mulpd %xmm0, %xmm1
- addpd %xmm1, %xmm7
- movapd %xmm3, %xmm1
- mulpd %xmm0, %xmm3
- mulsd %xmm0, %xmm0
- mulpd 144(%rax), %xmm1
- mulpd %xmm3, %xmm4
- movq %xmm1, %xmm3
- addpd %xmm4, %xmm7
- movq %xmm1, %xmm4
- mulsd %xmm7, %xmm0
- unpckhpd %xmm7, %xmm7
- addsd %xmm7, %xmm0
- unpckhpd %xmm1, %xmm1
- addsd %xmm1, %xmm3
- subsd %xmm3, %xmm4
- addsd %xmm4, %xmm1
- movq %xmm2, %xmm4
- movq 144(%rax), %xmm7
- unpckhpd %xmm2, %xmm2
- addsd 152(%rax), %xmm7
- mulsd %xmm2, %xmm7
- addsd 136(%rax), %xmm7
- addsd %xmm1, %xmm7
- addsd %xmm7, %xmm0
- movq ONE(%rip), %xmm7
- mulsd %xmm6, %xmm4
- movq 168(%rax), %xmm2
- andpd %xmm6, %xmm2
- mulsd %xmm2, %xmm5
- mulsd 160(%rax), %xmm6
- subsd %xmm5, %xmm7
- subsd 128(%rax), %xmm2
- subsd %xmm4, %xmm7
- mulsd %xmm6, %xmm7
- movq %xmm3, %xmm4
- subsd %xmm2, %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm4
- addsd %xmm4, %xmm0
- subsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_0.0.1:
- jg .L_2TAG_PACKET_1.0.1
- pextrw $3, %xmm0, %eax
- movl %eax, %edx
- andl $32752, %eax
- je .L_2TAG_PACKET_2.0.1
- andl $32767, %edx
- cmpl $15904, %edx
- jb .L_2TAG_PACKET_3.0.1
- movq %xmm0, %xmm2
- movq %xmm0, %xmm3
- movq Q_11(%rip), %xmm1
- mulsd %xmm0, %xmm2
- mulsd %xmm2, %xmm3
- mulsd %xmm2, %xmm1
- addsd Q_9(%rip), %xmm1
- mulsd %xmm2, %xmm1
- addsd Q_7(%rip), %xmm1
- mulsd %xmm2, %xmm1
- addsd Q_5(%rip), %xmm1
- mulsd %xmm2, %xmm1
- addsd Q_3(%rip), %xmm1
- mulsd %xmm3, %xmm1
- addsd %xmm1, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_3.0.1:
- movq TWO_POW_55(%rip), %xmm3
- mulsd %xmm0, %xmm3
- addsd %xmm3, %xmm0
- mulsd TWO_POW_M55(%rip), %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_2.0.1:
- movq %xmm0, %xmm1
- mulsd %xmm1, %xmm1
- jmp ..B1.4
-.L_2TAG_PACKET_1.0.1:
- pextrw $3, %xmm0, %eax
- andl $32752, %eax
- cmpl $32752, %eax
- je .L_2TAG_PACKET_4.0.1
- pextrw $3, %xmm0, %ecx
- andl $32752, %ecx
- subl $16224, %ecx
- shrl $7, %ecx
- andl $65532, %ecx
- lea PI_INV_TABLE(%rip), %r11
- addq %r11, %rcx
- movd %xmm0, %rax
- movl 20(%rcx), %r10d
- movl 24(%rcx), %r8d
- movl %eax, %edx
- shrq $21, %rax
- orl $-2147483648, %eax
- shrl $11, %eax
- movl %r10d, %r9d
- imulq %rdx, %r10
- imulq %rax, %r9
- imulq %rax, %r8
- movl 16(%rcx), %esi
- movl 12(%rcx), %edi
- movl %r10d, %r11d
- shrq $32, %r10
- addq %r10, %r9
- addq %r8, %r11
- movl %r11d, %r8d
- shrq $32, %r11
- addq %r11, %r9
- movl %esi, %r10d
- imulq %rdx, %rsi
- imulq %rax, %r10
- movl %edi, %r11d
- imulq %rdx, %rdi
- movl %esi, %ebx
- shrq $32, %rsi
- addq %rbx, %r9
- movl %r9d, %ebx
- shrq $32, %r9
- addq %rsi, %r10
- addq %r9, %r10
- shlq $32, %rbx
- orq %rbx, %r8
- imulq %rax, %r11
- movl 8(%rcx), %r9d
- movl 4(%rcx), %esi
- movl %edi, %ebx
- shrq $32, %rdi
- addq %rbx, %r10
- movl %r10d, %ebx
- shrq $32, %r10
- addq %rdi, %r11
- addq %r10, %r11
- movq %r9, %rdi
- imulq %rdx, %r9
- imulq %rax, %rdi
- movl %r9d, %r10d
- shrq $32, %r9
- addq %r10, %r11
- movl %r11d, %r10d
- shrq $32, %r11
- addq %r9, %rdi
- addq %r11, %rdi
- movq %rsi, %r9
- imulq %rdx, %rsi
- imulq %rax, %r9
- shlq $32, %r10
- orq %rbx, %r10
- movl (%rcx), %eax
- movl %esi, %r11d
- shrq $32, %rsi
- addq %r11, %rdi
- movl %edi, %r11d
- shrq $32, %rdi
- addq %rsi, %r9
- addq %rdi, %r9
- imulq %rax, %rdx
- pextrw $3, %xmm0, %ebx
- lea PI_INV_TABLE(%rip), %rdi
- subq %rdi, %rcx
- addl %ecx, %ecx
- addl %ecx, %ecx
- addl %ecx, %ecx
- addl $19, %ecx
- movl $32768, %esi
- andl %ebx, %esi
- shrl $4, %ebx
- andl $2047, %ebx
- subl $1023, %ebx
- subl %ebx, %ecx
- addq %rdx, %r9
- movl %ecx, %edx
- addl $32, %edx
- cmpl $0, %ecx
- jl .L_2TAG_PACKET_5.0.1
- negl %ecx
- addl $29, %ecx
- shll %cl, %r9d
- movl %r9d, %edi
- andl $1073741823, %r9d
- testl $536870912, %r9d
- jne .L_2TAG_PACKET_6.0.1
- shrl %cl, %r9d
- movl $0, %ebx
- shlq $32, %r9
- orq %r11, %r9
-.L_2TAG_PACKET_7.0.1:
-.L_2TAG_PACKET_8.0.1:
- cmpq $0, %r9
- je .L_2TAG_PACKET_9.0.1
-.L_2TAG_PACKET_10.0.1:
- bsr %r9, %r11
- movl $29, %ecx
- subl %r11d, %ecx
- jle .L_2TAG_PACKET_11.0.1
- shlq %cl, %r9
- movq %r10, %rax
- shlq %cl, %r10
- addl %ecx, %edx
- negl %ecx
- addl $64, %ecx
- shrq %cl, %rax
- shrq %cl, %r8
- orq %rax, %r9
- orq %r8, %r10
-.L_2TAG_PACKET_12.0.1:
- cvtsi2sdq %r9, %xmm0
- shrq $1, %r10
- cvtsi2sdq %r10, %xmm3
- xorpd %xmm4, %xmm4
- shll $4, %edx
- negl %edx
- addl $16368, %edx
- orl %esi, %edx
- xorl %ebx, %edx
- pinsrw $3, %edx, %xmm4
- movq PI_4(%rip), %xmm2
- movq 8+PI_4(%rip), %xmm7
- xorpd %xmm5, %xmm5
- subl $1008, %edx
- pinsrw $3, %edx, %xmm5
- mulsd %xmm4, %xmm0
- shll $16, %esi
- sarl $31, %esi
- mulsd %xmm5, %xmm3
- movq %xmm0, %xmm1
- mulsd %xmm2, %xmm0
- shrl $30, %edi
- addsd %xmm3, %xmm1
- mulsd %xmm2, %xmm3
- addl %esi, %edi
- xorl %esi, %edi
- mulsd %xmm1, %xmm7
- movl %edi, %eax
- addsd %xmm3, %xmm7
- movq %xmm0, %xmm2
- addsd %xmm7, %xmm0
- subsd %xmm0, %xmm2
- addsd %xmm2, %xmm7
- movapd PI32INV(%rip), %xmm1
- movddup %xmm0, %xmm0
- movapd sign_mask(%rip), %xmm4
- andpd %xmm0, %xmm4
- mulpd %xmm0, %xmm1
- movddup %xmm7, %xmm7
- movapd ONEHALF(%rip), %xmm5
- movapd MUL16(%rip), %xmm6
- orps %xmm4, %xmm5
- addpd %xmm5, %xmm1
- movapd %xmm1, %xmm5
- unpckhpd %xmm5, %xmm5
- cvttsd2si %xmm5, %edx
- cvttpd2dq %xmm1, %xmm1
- cvtdq2pd %xmm1, %xmm1
- mulpd %xmm6, %xmm1
- movapd P_1(%rip), %xmm3
- movq QQ_2(%rip), %xmm5
- shll $4, %eax
- addl $469248, %edx
- movapd P_2(%rip), %xmm4
- mulpd %xmm1, %xmm3
- addl %eax, %edx
- andl $31, %edx
- mulsd %xmm1, %xmm5
- movl %edx, %ecx
- mulpd %xmm1, %xmm4
- shll $1, %ecx
- subpd %xmm3, %xmm0
- mulpd P_3(%rip), %xmm1
- addl %ecx, %edx
- shll $2, %ecx
- addl %ecx, %edx
- addsd %xmm0, %xmm5
- movapd %xmm0, %xmm2
- subpd %xmm4, %xmm0
- movq ONE(%rip), %xmm6
- shll $4, %edx
- lea Ctable(%rip), %rax
- andpd MASK_35(%rip), %xmm5
- movapd %xmm0, %xmm3
- addq %rdx, %rax
- subpd %xmm0, %xmm2
- unpckhpd %xmm0, %xmm0
- divsd %xmm5, %xmm6
- subpd %xmm4, %xmm2
- subsd %xmm5, %xmm3
- subpd %xmm1, %xmm2
- movapd 48(%rax), %xmm1
- addpd %xmm7, %xmm2
- movapd 16(%rax), %xmm7
- mulpd %xmm0, %xmm7
- movapd 96(%rax), %xmm4
- mulpd %xmm0, %xmm1
- mulpd %xmm0, %xmm4
- addsd %xmm3, %xmm2
- movapd %xmm0, %xmm3
- mulpd %xmm0, %xmm0
- addpd (%rax), %xmm7
- addpd 32(%rax), %xmm1
- mulpd %xmm0, %xmm1
- addpd 80(%rax), %xmm4
- addpd %xmm1, %xmm7
- movapd 112(%rax), %xmm1
- mulpd %xmm0, %xmm1
- mulpd %xmm0, %xmm0
- addpd %xmm1, %xmm4
- movapd 64(%rax), %xmm1
- mulpd %xmm0, %xmm1
- addpd %xmm1, %xmm7
- movapd %xmm3, %xmm1
- mulpd %xmm0, %xmm3
- mulsd %xmm0, %xmm0
- mulpd 144(%rax), %xmm1
- mulpd %xmm3, %xmm4
- movq %xmm1, %xmm3
- addpd %xmm4, %xmm7
- movq %xmm1, %xmm4
- mulsd %xmm7, %xmm0
- unpckhpd %xmm7, %xmm7
- addsd %xmm7, %xmm0
- unpckhpd %xmm1, %xmm1
- addsd %xmm1, %xmm3
- subsd %xmm3, %xmm4
- addsd %xmm4, %xmm1
- movq %xmm2, %xmm4
- movq 144(%rax), %xmm7
- unpckhpd %xmm2, %xmm2
- addsd 152(%rax), %xmm7
- mulsd %xmm2, %xmm7
- addsd 136(%rax), %xmm7
- addsd %xmm1, %xmm7
- addsd %xmm7, %xmm0
- movq ONE(%rip), %xmm7
- mulsd %xmm6, %xmm4
- movq 168(%rax), %xmm2
- andpd %xmm6, %xmm2
- mulsd %xmm2, %xmm5
- mulsd 160(%rax), %xmm6
- subsd %xmm5, %xmm7
- subsd 128(%rax), %xmm2
- subsd %xmm4, %xmm7
- mulsd %xmm6, %xmm7
- movq %xmm3, %xmm4
- subsd %xmm2, %xmm3
- addsd %xmm3, %xmm2
- subsd %xmm2, %xmm4
- addsd %xmm4, %xmm0
- subsd %xmm7, %xmm0
- addsd %xmm3, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_9.0.1:
- addl $64, %edx
- movq %r10, %r9
- movq %r8, %r10
- movq $0, %r8
- cmpq $0, %r9
- jne .L_2TAG_PACKET_10.0.1
- addl $64, %edx
- movq %r10, %r9
- movq %r8, %r10
- cmpq $0, %r9
- jne .L_2TAG_PACKET_10.0.1
- jmp .L_2TAG_PACKET_12.0.1
-.L_2TAG_PACKET_11.0.1:
- je .L_2TAG_PACKET_12.0.1
- negl %ecx
- shrq %cl, %r10
- movq %r9, %rax
- shrq %cl, %r9
- subl %ecx, %edx
- negl %ecx
- addl $64, %ecx
- shlq %cl, %rax
- orq %rax, %r10
- jmp .L_2TAG_PACKET_12.0.1
-.L_2TAG_PACKET_5.0.1:
- notl %ecx
- shlq $32, %r9
- orq %r11, %r9
- shlq %cl, %r9
- movq %r9, %rdi
- testl $-2147483648, %r9d
- jne .L_2TAG_PACKET_13.0.1
- shrl %cl, %r9d
- movl $0, %ebx
- shrq $2, %rdi
- jmp .L_2TAG_PACKET_8.0.1
-.L_2TAG_PACKET_6.0.1:
- shrl %cl, %r9d
- movl $1073741824, %ebx
- shrl %cl, %ebx
- shlq $32, %r9
- orq %r11, %r9
- shlq $32, %rbx
- addl $1073741824, %edi
- movq $0, %rcx
- movq $0, %r11
- subq %r8, %rcx
- sbbq %r10, %r11
- sbbq %r9, %rbx
- movq %rcx, %r8
- movq %r11, %r10
- movq %rbx, %r9
- movl $32768, %ebx
- jmp .L_2TAG_PACKET_7.0.1
-.L_2TAG_PACKET_13.0.1:
- shrl %cl, %r9d
- movq $0x100000000, %rbx
- shrq %cl, %rbx
- movq $0, %rcx
- movq $0, %r11
- subq %r8, %rcx
- sbbq %r10, %r11
- sbbq %r9, %rbx
- movq %rcx, %r8
- movq %r11, %r10
- movq %rbx, %r9
- movl $32768, %ebx
- shrq $2, %rdi
- addl $1073741824, %edi
- jmp .L_2TAG_PACKET_8.0.1
-.L_2TAG_PACKET_4.0.1:
- movq 8(%rsp), %xmm0
- mulsd NEG_ZERO(%rip), %xmm0
- movq %xmm0, (%rsp)
-.L_2TAG_PACKET_14.0.1:
-..B1.4:
- addq $16, %rsp
-..___tag_value_tan.6:
- popq %rbx
-..___tag_value_tan.8:
- ret
-..___tag_value_tan.9:
-END(tan)
-# -- End tan
- .section .rodata, "a"
- .align 16
- .align 16
-ONEHALF:
- .long 0
- .long 1071644672
- .long 0
- .long 1071644672
- .type ONEHALF,@object
- .size ONEHALF,16
- .align 16
-MUL16:
- .long 0
- .long 1076887552
- .long 0
- .long 1072693248
- .type MUL16,@object
- .size MUL16,16
- .align 16
-sign_mask:
- .long 0
- .long 2147483648
- .long 0
- .long 2147483648
- .type sign_mask,@object
- .size sign_mask,16
- .align 16
-PI32INV:
- .long 1841940611
- .long 1071931184
- .long 1841940611
- .long 1076125488
- .type PI32INV,@object
- .size PI32INV,16
- .align 16
-P_1:
- .long 1413758976
- .long 1069097467
- .long 1413742592
- .long 1069097467
- .type P_1,@object
- .size P_1,16
- .align 16
-P_2:
- .long 1734819840
- .long 3174229945
- .long 1280049152
- .long 1028033571
- .type P_2,@object
- .size P_2,16
- .align 16
-P_3:
- .long 923219018
- .long 984130272
- .long 57701189
- .long 988383790
- .type P_3,@object
- .size P_3,16
- .align 16
-Ctable:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2284589306
- .long 1066820852
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1441186365
- .long 1065494243
- .long 1431655765
- .long 1070945621
- .long 0
- .long 0
- .long 0
- .long 0
- .long 236289504
- .long 1064135997
- .long 286331153
- .long 1069617425
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1160476131
- .long 1062722102
- .long 463583772
- .long 1068212666
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1313038235
- .long 1066745731
- .long 0
- .long 0
- .long 1013878342
- .long 1067152618
- .long 0
- .long 0
- .long 3663426833
- .long 1065725283
- .long 3693284251
- .long 1069118808
- .long 650852232
- .long 1065882376
- .long 1996245381
- .long 1071000265
- .long 2008746170
- .long 1064664197
- .long 3055842593
- .long 1068578846
- .long 1495406348
- .long 1064652437
- .long 2269530157
- .long 1069711235
- .long 285563696
- .long 1063576465
- .long 1046897440
- .long 1067705865
- .long 233429731
- .long 1063453151
- .long 522045958
- .long 1068476590
- .long 2354785698
- .long 1069102779
- .long 1317599141
- .long 1012432133
- .long 0
- .long 1072693248
- .long 2828230105
- .long 1065606626
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1512545955
- .long 1068119047
- .long 0
- .long 0
- .long 1127048698
- .long 1067909459
- .long 0
- .long 0
- .long 2300200450
- .long 1067254767
- .long 3593250296
- .long 1070233561
- .long 3009365544
- .long 1066902117
- .long 1127373050
- .long 1071173457
- .long 3046103305
- .long 1066371299
- .long 24583402
- .long 1069723988
- .long 4082511758
- .long 1065914199
- .long 3223889699
- .long 1070020367
- .long 548927984
- .long 1065415756
- .long 558065897
- .long 1068949418
- .long 680073315
- .long 1064940726
- .long 388873200
- .long 1068944270
- .long 3763679576
- .long 1070167541
- .long 1497360404
- .long 1009710547
- .long 0
- .long 1072693248
- .long 64931152
- .long 1067729411
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2467582782
- .long 1069256389
- .long 0
- .long 0
- .long 162150096
- .long 1068946420
- .long 0
- .long 0
- .long 3702794237
- .long 1068579152
- .long 3631919291
- .long 1070936926
- .long 3456821413
- .long 1068217218
- .long 2031366438
- .long 1071495745
- .long 1596664020
- .long 1067799281
- .long 1509038701
- .long 1070601643
- .long 583171477
- .long 1067510148
- .long 3785344682
- .long 1070618476
- .long 2402036048
- .long 1067075736
- .long 3233018412
- .long 1069913186
- .long 411280568
- .long 1066710556
- .long 1065584192
- .long 1069747896
- .long 895247324
- .long 1070819848
- .long 500078909
- .long 3161288781
- .long 0
- .long 1072693248
- .long 729983843
- .long 1068994194
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1458794562
- .long 1070398550
- .long 0
- .long 0
- .long 2857777489
- .long 1070137637
- .long 0
- .long 0
- .long 1024359517
- .long 1069876531
- .long 2616040238
- .long 1071582937
- .long 1609024636
- .long 1069675088
- .long 2529240549
- .long 1071836633
- .long 1510128600
- .long 1069440113
- .long 2251697184
- .long 1071253687
- .long 1262761453
- .long 1069142850
- .long 1263091857
- .long 1071190461
- .long 3043383486
- .long 1068885191
- .long 2476932470
- .long 1070842002
- .long 3659995028
- .long 1068669200
- .long 855891755
- .long 1070696894
- .long 2583490354
- .long 1071284857
- .long 3062633575
- .long 1014008623
- .long 0
- .long 1072693248
- .long 2550940471
- .long 1069938201
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3422807297
- .long 1071640847
- .long 0
- .long 0
- .long 1151658053
- .long 1071494715
- .long 0
- .long 0
- .long 929607071
- .long 1071346340
- .long 1037049034
- .long 1072037305
- .long 2786928657
- .long 1071215282
- .long 1447406859
- .long 1072265209
- .long 3490952107
- .long 1071090851
- .long 3205232916
- .long 1071968658
- .long 1297344304
- .long 1070977120
- .long 1066110976
- .long 1071946035
- .long 3803721480
- .long 1070871082
- .long 1496754229
- .long 1071807201
- .long 2982550683
- .long 1070773243
- .long 4014441989
- .long 1071736222
- .long 419968236
- .long 1071717047
- .long 3451266538
- .long 3163444811
- .long 0
- .long 1072693248
- .long 2960267235
- .long 1070745841
- .long 0
- .long 0
- .long 0
- .long 0
- .long 724322768
- .long 1072881308
- .long 0
- .long 0
- .long 643153048
- .long 1072905816
- .long 0
- .long 0
- .long 4285079458
- .long 1072928558
- .long 3912524733
- .long 1072622983
- .long 118362272
- .long 1072952754
- .long 4107767972
- .long 1072827408
- .long 2689502883
- .long 1072976922
- .long 946523347
- .long 1072772766
- .long 573204189
- .long 1073001761
- .long 581531518
- .long 1072826391
- .long 1386236526
- .long 1073026959
- .long 3718905905
- .long 1072832823
- .long 1145558140
- .long 1073052673
- .long 513572637
- .long 1072861969
- .long 716700048
- .long 1071997368
- .long 547126769
- .long 1015523525
- .long 0
- .long 1072693248
- .long 1097907398
- .long 1071420120
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3349892442
- .long 1074290212
- .long 0
- .long 0
- .long 3913197405
- .long 1074501181
- .long 0
- .long 0
- .long 2494034522
- .long 1074739170
- .long 1264738763
- .long 1073084804
- .long 1520293906
- .long 1074899632
- .long 1958936600
- .long 1073411493
- .long 2133649635
- .long 1075052171
- .long 4270740730
- .long 1073574708
- .long 1728930189
- .long 1075224844
- .long 1303998552
- .long 1073799186
- .long 618611933
- .long 1075420255
- .long 1769828046
- .long 1073938542
- .long 2200537986
- .long 1075641421
- .long 433361110
- .long 1074105369
- .long 719595600
- .long 1072317184
- .long 294527206
- .long 3162140088
- .long 0
- .long 1073741824
- .long 3811788216
- .long 3218400550
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1704352102
- .long 1075943001
- .long 0
- .long 0
- .long 2284589306
- .long 1076258036
- .long 0
- .long 0
- .long 2211264291
- .long 1076659010
- .long 0
- .long 1073741824
- .long 1441186365
- .long 1077028579
- .long 1431655765
- .long 1074091349
- .long 876943673
- .long 1077353622
- .long 2863311531
- .long 1074440874
- .long 236289504
- .long 1077767485
- .long 286331153
- .long 1074860305
- .long 2805473311
- .long 1078115278
- .long 95443718
- .long 1075163227
- .long 1160476131
- .long 1078450742
- .long 463583772
- .long 1075552698
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 0
- .long 1073741824
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1330165971
- .long 3207850745
- .long 0
- .long 0
- .long 217536623
- .long 1059109098
- .long 0
- .long 0
- .long 3492120849
- .long 3205151475
- .long 602185705
- .long 3215678092
- .long 760422958
- .long 1056312597
- .long 555127889
- .long 1067545266
- .long 3139784124
- .long 3202470837
- .long 3690544014
- .long 3213150171
- .long 95707915
- .long 1053635428
- .long 4003114407
- .long 1064581412
- .long 2034926231
- .long 3199711161
- .long 3759536023
- .long 3210559989
- .long 3826928214
- .long 1050893819
- .long 3837960785
- .long 1061790379
- .long 1526325248
- .long 3217967566
- .long 2356426521
- .long 1025423456
- .long 0
- .long 0
- .long 457728975
- .long 1071088276
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1398462608
- .long 3207303968
- .long 0
- .long 0
- .long 26205983
- .long 1058461213
- .long 0
- .long 0
- .long 56226238
- .long 3204528612
- .long 2754706541
- .long 3215359511
- .long 2187799823
- .long 1055634437
- .long 790323742
- .long 1067402587
- .long 1372385848
- .long 3201651479
- .long 4097292716
- .long 3212856302
- .long 3348210357
- .long 1052830099
- .long 2442796466
- .long 1064337602
- .long 862608142
- .long 3198830754
- .long 170296152
- .long 3210060867
- .long 3755571428
- .long 1049933343
- .long 3614866008
- .long 1061361670
- .long 719978496
- .long 3217669096
- .long 1998842465
- .long 3174703977
- .long 0
- .long 0
- .long 3749156607
- .long 1071048258
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 3120498638
- .long 3206749304
- .long 0
- .long 0
- .long 2773578114
- .long 1058009312
- .long 0
- .long 0
- .long 2030783676
- .long 3203817873
- .long 2223654598
- .long 3215071936
- .long 2976134650
- .long 1054987244
- .long 706390066
- .long 1067217386
- .long 4258437615
- .long 3200900378
- .long 1066252975
- .long 3212391267
- .long 815777514
- .long 1051989462
- .long 3202745457
- .long 1064010682
- .long 2493556375
- .long 3198004753
- .long 1046243251
- .long 3209678971
- .long 2593078846
- .long 1049017717
- .long 2763962276
- .long 1060970161
- .long 701480960
- .long 3217377742
- .long 3205862232
- .long 3174660915
- .long 0
- .long 0
- .long 2267016812
- .long 1071015664
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 2107155798
- .long 3206166872
- .long 0
- .long 0
- .long 2642992129
- .long 1057424578
- .long 0
- .long 0
- .long 1936992811
- .long 3203204426
- .long 1485063559
- .long 3214682643
- .long 1432914553
- .long 1054319398
- .long 3996381654
- .long 1067075828
- .long 2833029256
- .long 3200223545
- .long 2866066872
- .long 3211982662
- .long 2432888737
- .long 1051234178
- .long 3669764559
- .long 1063748136
- .long 2458496952
- .long 3197170774
- .long 1948234989
- .long 3209098147
- .long 2843698787
- .long 1048163519
- .long 3398041407
- .long 1060559728
- .long 2829230080
- .long 3217092115
- .long 1034046433
- .long 3174271903
- .long 0
- .long 0
- .long 298675305
- .long 1070989821
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 437603223
- .long 3205589761
- .long 0
- .long 0
- .long 759330352
- .long 1057048511
- .long 0
- .long 0
- .long 3107463368
- .long 3202507988
- .long 3144465176
- .long 3214191500
- .long 2290961810
- .long 1053841035
- .long 1618153340
- .long 1066971547
- .long 3836869393
- .long 3199400272
- .long 584032116
- .long 3211469261
- .long 1245704358
- .long 1050626462
- .long 4247487438
- .long 1063561943
- .long 1669034927
- .long 3196274812
- .long 3844233498
- .long 3208626322
- .long 2706958524
- .long 1047411374
- .long 3857199098
- .long 1060281647
- .long 3593904128
- .long 3216590719
- .long 3267547836
- .long 3172163321
- .long 0
- .long 0
- .long 4076712227
- .long 1070970214
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 3290090340
- .long 3204793485
- .long 0
- .long 0
- .long 3685760367
- .long 1056668370
- .long 0
- .long 0
- .long 2655163949
- .long 3201674917
- .long 628750575
- .long 3213566872
- .long 680140505
- .long 1053299777
- .long 2954464709
- .long 1066900026
- .long 803201619
- .long 3198516435
- .long 1466315631
- .long 3210837162
- .long 1611220163
- .long 1049972438
- .long 2766187256
- .long 1063437894
- .long 1804579484
- .long 3195331491
- .long 3695969289
- .long 3207854418
- .long 2617238373
- .long 1046675948
- .long 3095830084
- .long 1060095334
- .long 3789570048
- .long 3216034914
- .long 23826559
- .long 3172048060
- .long 0
- .long 0
- .long 3870939386
- .long 1070956467
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1571758758
- .long 3203672535
- .long 0
- .long 0
- .long 113026373
- .long 1056416381
- .long 0
- .long 0
- .long 1913766298
- .long 3200523326
- .long 2507068734
- .long 3212502004
- .long 4000648818
- .long 1053003803
- .long 2446607349
- .long 1066858259
- .long 912662124
- .long 3197333001
- .long 1349489537
- .long 3209765608
- .long 3412972607
- .long 1049641401
- .long 1721283327
- .long 1063366855
- .long 1466691883
- .long 3194116746
- .long 3852528092
- .long 3206760861
- .long 285443293
- .long 1046158380
- .long 1758739894
- .long 1059895449
- .long 1858781184
- .long 3214984212
- .long 3447575948
- .long 1024675855
- .long 0
- .long 0
- .long 2242038011
- .long 1070948320
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 0
- .long 0
- .long 0
- .long 0
- .long 737611454
- .long 1056336527
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3594790527
- .long 1052911621
- .long 381774871
- .long 1066844524
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3303051618
- .long 1049456050
- .long 3154187623
- .long 1063343722
- .long 0
- .long 0
- .long 0
- .long 0
- .long 528061788
- .long 1045944910
- .long 2469719819
- .long 1059831159
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1431655765
- .long 1070945621
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1571758758
- .long 1056188887
- .long 0
- .long 0
- .long 113026373
- .long 1056416381
- .long 0
- .long 0
- .long 1913766298
- .long 1053039678
- .long 2507068734
- .long 1065018356
- .long 4000648818
- .long 1053003803
- .long 2446607349
- .long 1066858259
- .long 912662124
- .long 1049849353
- .long 1349489537
- .long 1062281960
- .long 3412972607
- .long 1049641401
- .long 1721283327
- .long 1063366855
- .long 1466691883
- .long 1046633098
- .long 3852528092
- .long 1059277213
- .long 285443293
- .long 1046158380
- .long 1758739894
- .long 1059895449
- .long 1858781184
- .long 1067500564
- .long 3447575948
- .long 3172159503
- .long 0
- .long 0
- .long 2242038011
- .long 1070948320
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 3290090340
- .long 1057309837
- .long 0
- .long 0
- .long 3685760367
- .long 1056668370
- .long 0
- .long 0
- .long 2655163949
- .long 1054191269
- .long 628750575
- .long 1066083224
- .long 680140505
- .long 1053299777
- .long 2954464709
- .long 1066900026
- .long 803201619
- .long 1051032787
- .long 1466315631
- .long 1063353514
- .long 1611220163
- .long 1049972438
- .long 2766187256
- .long 1063437894
- .long 1804579484
- .long 1047847843
- .long 3695969289
- .long 1060370770
- .long 2617238373
- .long 1046675948
- .long 3095830084
- .long 1060095334
- .long 3789570048
- .long 1068551266
- .long 23826559
- .long 1024564412
- .long 0
- .long 0
- .long 3870939386
- .long 1070956467
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 437603223
- .long 1058106113
- .long 0
- .long 0
- .long 759330352
- .long 1057048511
- .long 0
- .long 0
- .long 3107463368
- .long 1055024340
- .long 3144465176
- .long 1066707852
- .long 2290961810
- .long 1053841035
- .long 1618153340
- .long 1066971547
- .long 3836869393
- .long 1051916624
- .long 584032116
- .long 1063985613
- .long 1245704358
- .long 1050626462
- .long 4247487438
- .long 1063561943
- .long 1669034927
- .long 1048791164
- .long 3844233498
- .long 1061142674
- .long 2706958524
- .long 1047411374
- .long 3857199098
- .long 1060281647
- .long 3593904128
- .long 1069107071
- .long 3267547836
- .long 1024679673
- .long 0
- .long 0
- .long 4076712227
- .long 1070970214
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 2107155798
- .long 1058683224
- .long 0
- .long 0
- .long 2642992129
- .long 1057424578
- .long 0
- .long 0
- .long 1936992811
- .long 1055720778
- .long 1485063559
- .long 1067198995
- .long 1432914553
- .long 1054319398
- .long 3996381654
- .long 1067075828
- .long 2833029256
- .long 1052739897
- .long 2866066872
- .long 1064499014
- .long 2432888737
- .long 1051234178
- .long 3669764559
- .long 1063748136
- .long 2458496952
- .long 1049687126
- .long 1948234989
- .long 1061614499
- .long 2843698787
- .long 1048163519
- .long 3398041407
- .long 1060559728
- .long 2829230080
- .long 1069608467
- .long 1034046433
- .long 1026788255
- .long 0
- .long 0
- .long 298675305
- .long 1070989821
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 3120498638
- .long 1059265656
- .long 0
- .long 0
- .long 2773578114
- .long 1058009312
- .long 0
- .long 0
- .long 2030783676
- .long 1056334225
- .long 2223654598
- .long 1067588288
- .long 2976134650
- .long 1054987244
- .long 706390066
- .long 1067217386
- .long 4258437615
- .long 1053416730
- .long 1066252975
- .long 1064907619
- .long 815777514
- .long 1051989462
- .long 3202745457
- .long 1064010682
- .long 2493556375
- .long 1050521105
- .long 1046243251
- .long 1062195323
- .long 2593078846
- .long 1049017717
- .long 2763962276
- .long 1060970161
- .long 701480960
- .long 1069894094
- .long 3205862232
- .long 1027177267
- .long 0
- .long 0
- .long 2267016812
- .long 1071015664
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1398462608
- .long 1059820320
- .long 0
- .long 0
- .long 26205983
- .long 1058461213
- .long 0
- .long 0
- .long 56226238
- .long 1057044964
- .long 2754706541
- .long 1067875863
- .long 2187799823
- .long 1055634437
- .long 790323742
- .long 1067402587
- .long 1372385848
- .long 1054167831
- .long 4097292716
- .long 1065372654
- .long 3348210357
- .long 1052830099
- .long 2442796466
- .long 1064337602
- .long 862608142
- .long 1051347106
- .long 170296152
- .long 1062577219
- .long 3755571428
- .long 1049933343
- .long 3614866008
- .long 1061361670
- .long 719978496
- .long 1070185448
- .long 1998842465
- .long 1027220329
- .long 0
- .long 0
- .long 3749156607
- .long 1071048258
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1330165971
- .long 1060367097
- .long 0
- .long 0
- .long 217536623
- .long 1059109098
- .long 0
- .long 0
- .long 3492120849
- .long 1057667827
- .long 602185705
- .long 1068194444
- .long 760422958
- .long 1056312597
- .long 555127889
- .long 1067545266
- .long 3139784124
- .long 1054987189
- .long 3690544014
- .long 1065666523
- .long 95707915
- .long 1053635428
- .long 4003114407
- .long 1064581412
- .long 2034926231
- .long 1052227513
- .long 3759536023
- .long 1063076341
- .long 3826928214
- .long 1050893819
- .long 3837960785
- .long 1061790379
- .long 1526325248
- .long 1070483918
- .long 2356426521
- .long 3172907104
- .long 0
- .long 0
- .long 457728975
- .long 1071088276
- .long 0
- .long 1072693248
- .long 0
- .long 4294967288
- .long 1704352102
- .long 3223426649
- .long 0
- .long 0
- .long 2284589306
- .long 1076258036
- .long 0
- .long 0
- .long 2211264291
- .long 3224142658
- .long 0
- .long 3221225472
- .long 1441186365
- .long 1077028579
- .long 1431655765
- .long 1074091349
- .long 876943673
- .long 3224837270
- .long 2863311531
- .long 3221924522
- .long 236289504
- .long 1077767485
- .long 286331153
- .long 1074860305
- .long 2805473311
- .long 3225598926
- .long 95443718
- .long 3222646875
- .long 1160476131
- .long 1078450742
- .long 463583772
- .long 1075552698
- .long 0
- .long 3220176896
- .long 0
- .long 0
- .long 0
- .long 1073741824
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3349892442
- .long 3221773860
- .long 0
- .long 0
- .long 3913197405
- .long 1074501181
- .long 0
- .long 0
- .long 2494034522
- .long 3222222818
- .long 1264738763
- .long 3220568452
- .long 1520293906
- .long 1074899632
- .long 1958936600
- .long 1073411493
- .long 2133649635
- .long 3222535819
- .long 4270740730
- .long 3221058356
- .long 1728930189
- .long 1075224844
- .long 1303998552
- .long 1073799186
- .long 618611933
- .long 3222903903
- .long 1769828046
- .long 3221422190
- .long 2200537986
- .long 1075641421
- .long 433361110
- .long 1074105369
- .long 719595600
- .long 3219800832
- .long 294527206
- .long 1014656440
- .long 0
- .long 1073741824
- .long 3811788216
- .long 3218400550
- .long 0
- .long 0
- .long 0
- .long 0
- .long 724322768
- .long 3220364956
- .long 0
- .long 0
- .long 643153048
- .long 1072905816
- .long 0
- .long 0
- .long 4285079458
- .long 3220412206
- .long 3912524733
- .long 3220106631
- .long 118362272
- .long 1072952754
- .long 4107767972
- .long 1072827408
- .long 2689502883
- .long 3220460570
- .long 946523347
- .long 3220256414
- .long 573204189
- .long 1073001761
- .long 581531518
- .long 1072826391
- .long 1386236526
- .long 3220510607
- .long 3718905905
- .long 3220316471
- .long 1145558140
- .long 1073052673
- .long 513572637
- .long 1072861969
- .long 716700048
- .long 3219481016
- .long 547126769
- .long 3163007173
- .long 0
- .long 1072693248
- .long 1097907398
- .long 1071420120
- .long 0
- .long 0
- .long 0
- .long 0
- .long 3422807297
- .long 3219124495
- .long 0
- .long 0
- .long 1151658053
- .long 1071494715
- .long 0
- .long 0
- .long 929607071
- .long 3218829988
- .long 1037049034
- .long 3219520953
- .long 2786928657
- .long 1071215282
- .long 1447406859
- .long 1072265209
- .long 3490952107
- .long 3218574499
- .long 3205232916
- .long 3219452306
- .long 1297344304
- .long 1070977120
- .long 1066110976
- .long 1071946035
- .long 3803721480
- .long 3218354730
- .long 1496754229
- .long 3219290849
- .long 2982550683
- .long 1070773243
- .long 4014441989
- .long 1071736222
- .long 419968236
- .long 3219200695
- .long 3451266538
- .long 1015961163
- .long 0
- .long 1072693248
- .long 2960267235
- .long 1070745841
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1458794562
- .long 3217882198
- .long 0
- .long 0
- .long 2857777489
- .long 1070137637
- .long 0
- .long 0
- .long 1024359517
- .long 3217360179
- .long 2616040238
- .long 3219066585
- .long 1609024636
- .long 1069675088
- .long 2529240549
- .long 1071836633
- .long 1510128600
- .long 3216923761
- .long 2251697184
- .long 3218737335
- .long 1262761453
- .long 1069142850
- .long 1263091857
- .long 1071190461
- .long 3043383486
- .long 3216368839
- .long 2476932470
- .long 3218325650
- .long 3659995028
- .long 1068669200
- .long 855891755
- .long 1070696894
- .long 2583490354
- .long 3218768505
- .long 3062633575
- .long 3161492271
- .long 0
- .long 1072693248
- .long 2550940471
- .long 1069938201
- .long 0
- .long 0
- .long 0
- .long 0
- .long 2467582782
- .long 3216740037
- .long 0
- .long 0
- .long 162150096
- .long 1068946420
- .long 0
- .long 0
- .long 3702794237
- .long 3216062800
- .long 3631919291
- .long 3218420574
- .long 3456821413
- .long 1068217218
- .long 2031366438
- .long 1071495745
- .long 1596664020
- .long 3215282929
- .long 1509038701
- .long 3218085291
- .long 583171477
- .long 1067510148
- .long 3785344682
- .long 1070618476
- .long 2402036048
- .long 3214559384
- .long 3233018412
- .long 3217396834
- .long 411280568
- .long 1066710556
- .long 1065584192
- .long 1069747896
- .long 895247324
- .long 3218303496
- .long 500078909
- .long 1013805133
- .long 0
- .long 1072693248
- .long 729983843
- .long 1068994194
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1512545955
- .long 3215602695
- .long 0
- .long 0
- .long 1127048698
- .long 1067909459
- .long 0
- .long 0
- .long 2300200450
- .long 3214738415
- .long 3593250296
- .long 3217717209
- .long 3009365544
- .long 1066902117
- .long 1127373050
- .long 1071173457
- .long 3046103305
- .long 3213854947
- .long 24583402
- .long 3217207636
- .long 4082511758
- .long 1065914199
- .long 3223889699
- .long 1070020367
- .long 548927984
- .long 3212899404
- .long 558065897
- .long 3216433066
- .long 680073315
- .long 1064940726
- .long 388873200
- .long 1068944270
- .long 3763679576
- .long 3217651189
- .long 1497360404
- .long 3157194195
- .long 0
- .long 1072693248
- .long 64931152
- .long 1067729411
- .long 0
- .long 0
- .long 0
- .long 0
- .long 1313038235
- .long 3214229379
- .long 0
- .long 0
- .long 1013878342
- .long 1067152618
- .long 0
- .long 0
- .long 3663426833
- .long 3213208931
- .long 3693284251
- .long 3216602456
- .long 650852232
- .long 1065882376
- .long 1996245381
- .long 1071000265
- .long 2008746170
- .long 3212147845
- .long 3055842593
- .long 3216062494
- .long 1495406348
- .long 1064652437
- .long 2269530157
- .long 1069711235
- .long 285563696
- .long 3211060113
- .long 1046897440
- .long 3215189513
- .long 233429731
- .long 1063453151
- .long 522045958
- .long 1068476590
- .long 2354785698
- .long 3216586427
- .long 1317599141
- .long 3159915781
- .long 0
- .long 1072693248
- .long 2828230105
- .long 1065606626
- .long 0
- .long 0
- .long 0
- .long 0
- .type Ctable,@object
- .size Ctable,5632
- .align 16
-MASK_35:
- .long 4294705152
- .long 4294967295
- .long 0
- .long 0
- .type MASK_35,@object
- .size MASK_35,16
- .align 16
-Q_11:
- .long 3103673719
- .long 1065509018
- .type Q_11,@object
- .size Q_11,8
- .space 8, 0x00 # pad
- .align 16
-Q_9:
- .long 3213130307
- .long 1066820768
- .type Q_9,@object
- .size Q_9,8
- .space 8, 0x00 # pad
- .align 16
-Q_7:
- .long 1388628139
- .long 1068212666
- .type Q_7,@object
- .size Q_7,8
- .space 8, 0x00 # pad
- .align 16
-Q_5:
- .long 285812550
- .long 1069617425
- .type Q_5,@object
- .size Q_5,8
- .space 8, 0x00 # pad
- .align 16
-Q_3:
- .long 1431655954
- .long 1070945621
- .type Q_3,@object
- .size Q_3,8
- .space 8, 0x00 # pad
- .align 16
-PI_INV_TABLE:
- .long 0
- .long 0
- .long 2734261102
- .long 1313084713
- .long 4230436817
- .long 4113882560
- .long 3680671129
- .long 1011060801
- .long 4266746795
- .long 3736847713
- .long 3072618042
- .long 1112396512
- .long 105459434
- .long 164729372
- .long 4263373596
- .long 2972297022
- .long 3900847605
- .long 784024708
- .long 3919343654
- .long 3026157121
- .long 965858873
- .long 2203269620
- .long 2625920907
- .long 3187222587
- .long 536385535
- .long 3724908559
- .long 4012839307
- .long 1510632735
- .long 1832287951
- .long 667617719
- .long 1330003814
- .long 2657085997
- .long 1965537991
- .long 3957715323
- .long 1023883767
- .long 2320667370
- .long 1811636145
- .long 529358088
- .long 1443049542
- .long 4235946923
- .long 4040145953
- .type PI_INV_TABLE,@object
- .size PI_INV_TABLE,164
- .space 12, 0x00 # pad
- .align 16
-PI_4:
- .long 0
- .long 1072243195
- .long 1175561766
- .long 1048908043
- .type PI_4,@object
- .size PI_4,16
- .align 8
-QQ_2:
- .long 1734816687
- .long 1026746297
- .type QQ_2,@object
- .size QQ_2,8
- .align 8
-ONE:
- .long 0
- .long 1072693248
- .type ONE,@object
- .size ONE,8
- .align 8
-TWO_POW_55:
- .long 0
- .long 1130364928
- .type TWO_POW_55,@object
- .size TWO_POW_55,8
- .align 8
-TWO_POW_M55:
- .long 0
- .long 1015021568
- .type TWO_POW_M55,@object
- .size TWO_POW_M55,8
- .align 4
-NEG_ZERO:
- .long 0
- .long 2147483648
- .type NEG_ZERO,@object
- .size NEG_ZERO,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000002c
- .4byte 0x0000001c
- .4byte ..___tag_value_tan.1-.
- .4byte ..___tag_value_tan.9-..___tag_value_tan.1
- .2byte 0x0400
- .4byte ..___tag_value_tan.3-..___tag_value_tan.1
- .4byte 0x0283100e
- .byte 0x04
- .4byte ..___tag_value_tan.5-..___tag_value_tan.3
- .2byte 0x200e
- .byte 0x04
- .4byte ..___tag_value_tan.6-..___tag_value_tan.5
- .4byte 0x04c3100e
- .4byte ..___tag_value_tan.8-..___tag_value_tan.6
- .2byte 0x080e
-# End
diff --git a/libm/x86_64/s_tanh.S b/libm/x86_64/s_tanh.S
deleted file mode 100644
index a76a5c2..0000000
--- a/libm/x86_64/s_tanh.S
+++ /dev/null
@@ -1,1392 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/******************************************************************************/
-// ALGORITHM DESCRIPTION
-// ---------------------
-//
-// tanh(x)=(exp(x)-exp(-x))/(exp(x)+exp(-x))=(1-exp(-2*x))/(1+exp(-2*x))
-//
-// Let |x|=xH+xL (upper 26 bits, lower 27 bits)
-// log2(e) rounded to 26 bits (high part) plus a double precision low part is
-// L2EH+L2EL (upper 26, lower 53 bits)
-//
-// Let xH*L2EH=k+f+r`, where (k+f)*2^8*2=int(xH*L2EH*2^9),
-// f=0.b1 b2 ... b8, k integer
-// 2^{-f} is approximated as Tn[f]+Dn[f]
-// Tn stores the high 53 bits, Dn stores (2^{-f}-Tn[f]) rounded to double precision
-//
-// r=r`+xL*L2EH+|x|*L2EL, |r|<2^{-9}+2^{-14},
-// for |x| in [23/64,3*2^7)
-// e^{-2*|x|}=2^{-k-f}*2^{-r} ~ 2^{-k}*(Tn+Dn)*(1+p)=(T0+D0)*(1+p)
-//
-// For |x| in [2^{-4},2^5):
-// 2^{-r}-1 ~ p=c1*r+c2*r^2+..+c5*r^5
-// Let R=1/(1+T0+p*T0), truncated to 35 significant bits
-// R=1/(1+T0+D0+p*(T0+D0))*(1+eps), |eps|<2^{-33}
-// 1+T0+D0+p*(T0+D0)=KH+KL, where
-// KH=(1+T0+c1*r*T0)_high (leading 17 bits)
-// KL=T0_low+D0+(c1*r*T0)_low+c1*r*D0+(c2*r^2+..c5*r^5)*T0
-// eps ~ (R*KH-1)+R*KL
-// 1/(1+T0+D0+p*(T0+D0)) ~ R-R*eps
-// The result is approximated as (1-T0-D0-(T0+D0)*p)*(R-R*eps)
-// 1-T0-D0-(T0+D0)*p=-((KH-2)+KL)
-// The result is formed as
-// (KH-2)*R+(-(KH-2)*R*eps+(KL*R-KL*R*eps)), with the correct sign
-// set at the end
-//
-// For |x| in [2^{-64},2^{-4}):
-// A Taylor series expansion is used (x+p3*x^3+..+p13*x^{13})
-//
-// For |x|<2^{-64}: x is returned
-//
-// For |x|>=2^32: return +/-1
-//
-// Special cases:
-// tanh(NaN) = quiet NaN, and raise invalid exception
-// tanh(INF) = that INF
-// tanh(+/-0) = +/-0
-//
-/******************************************************************************/
-
-#include <private/bionic_asm.h>
-# -- Begin tanh
-ENTRY(tanh)
-# parameter 1: %xmm0
-..B1.1:
-..___tag_value_tanh.1:
- pushq %rsi
-..___tag_value_tanh.3:
-..B1.2:
- movsd HALFMASK(%rip), %xmm3
- xorpd %xmm4, %xmm4
- movsd L2E(%rip), %xmm1
- movsd 8+L2E(%rip), %xmm2
- movl $32768, %eax
- pinsrw $3, %eax, %xmm4
- movsd Shifter(%rip), %xmm6
- pextrw $3, %xmm0, %ecx
- andpd %xmm0, %xmm3
- andnpd %xmm0, %xmm4
- pshufd $68, %xmm4, %xmm5
- movl $32768, %edx
- andl %ecx, %edx
- andl $32767, %ecx
- subl $16304, %ecx
- cmpl $144, %ecx
- jae .L_2TAG_PACKET_0.0.1
- subsd %xmm3, %xmm4
- mulsd %xmm1, %xmm3
- mulsd %xmm5, %xmm2
- cvtsd2si %xmm3, %eax
- movq %xmm3, %xmm7
- addsd %xmm6, %xmm3
- mulsd %xmm4, %xmm1
- movsd ONEMASK(%rip), %xmm4
- subsd %xmm6, %xmm3
- xorpd %xmm0, %xmm0
- addsd %xmm1, %xmm2
- subsd %xmm3, %xmm7
- movapd cv(%rip), %xmm6
- addsd %xmm7, %xmm2
- movl $255, %ecx
- andl %eax, %ecx
- addl %ecx, %ecx
- lea T2_neg_f(%rip), %r8
- movapd (%r8,%rcx,8), %xmm5
- shrl $4, %eax
- andl $65520, %eax
- subl $16368, %eax
- negl %eax
- pinsrw $3, %eax, %xmm0
- movapd 16+cv(%rip), %xmm1
- pshufd $68, %xmm0, %xmm0
- mulpd %xmm5, %xmm0
- movsd 32+cv(%rip), %xmm7
- pshufd $68, %xmm2, %xmm2
- movq %xmm4, %xmm5
- addsd %xmm0, %xmm4
- mulpd %xmm2, %xmm6
- mulsd %xmm2, %xmm7
- mulpd %xmm2, %xmm2
- addpd %xmm6, %xmm1
- mulsd %xmm2, %xmm2
- movsd ONEMASK(%rip), %xmm3
- mulpd %xmm2, %xmm1
- pshufd $78, %xmm1, %xmm6
- addsd %xmm6, %xmm1
- movq %xmm1, %xmm6
- addsd %xmm7, %xmm1
- mulsd %xmm0, %xmm1
- addsd %xmm4, %xmm1
- andpd MASK3(%rip), %xmm4
- divsd %xmm1, %xmm5
- subsd %xmm4, %xmm3
- pshufd $238, %xmm0, %xmm1
- addsd %xmm0, %xmm3
- movq %xmm4, %xmm2
- addsd %xmm1, %xmm3
- mulsd %xmm7, %xmm1
- mulsd %xmm0, %xmm7
- addsd %xmm1, %xmm3
- addsd %xmm7, %xmm4
- movsd RMASK(%rip), %xmm1
- mulsd %xmm0, %xmm6
- andpd MASK3(%rip), %xmm4
- addsd %xmm6, %xmm3
- movq %xmm4, %xmm6
- subsd %xmm4, %xmm2
- addsd %xmm7, %xmm2
- movsd ONEMASK(%rip), %xmm7
- andpd %xmm1, %xmm5
- addsd %xmm2, %xmm3
- mulsd %xmm5, %xmm4
- xorpd %xmm2, %xmm2
- mulsd %xmm5, %xmm3
- subsd TWOMASK(%rip), %xmm6
- subsd %xmm7, %xmm4
- xorl $32768, %edx
- pinsrw $3, %edx, %xmm2
- addsd %xmm3, %xmm4
- mulsd %xmm5, %xmm6
- movq %xmm3, %xmm1
- mulsd %xmm4, %xmm3
- movq %xmm6, %xmm0
- mulsd %xmm4, %xmm6
- subsd %xmm3, %xmm1
- subsd %xmm6, %xmm1
- addsd %xmm1, %xmm0
- xorpd %xmm2, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_0.0.1:
- addl $960, %ecx
- cmpl $1104, %ecx
- jae .L_2TAG_PACKET_1.0.1
- movapd pv(%rip), %xmm2
- pshufd $68, %xmm0, %xmm1
- movapd 16+pv(%rip), %xmm3
- mulpd %xmm1, %xmm1
- movapd 32+pv(%rip), %xmm4
- mulpd %xmm1, %xmm2
- pshufd $68, %xmm1, %xmm5
- addpd %xmm3, %xmm2
- mulsd %xmm5, %xmm5
- mulpd %xmm1, %xmm2
- mulsd %xmm5, %xmm5
- addpd %xmm4, %xmm2
- mulpd %xmm5, %xmm2
- pshufd $238, %xmm2, %xmm5
- addsd %xmm5, %xmm2
- mulsd %xmm0, %xmm2
- addsd %xmm2, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_1.0.1:
- addl $15344, %ecx
- cmpl $16448, %ecx
- jae .L_2TAG_PACKET_2.0.1
- cmpl $16, %ecx
- jb .L_2TAG_PACKET_3.0.1
- xorpd %xmm2, %xmm2
- movl $17392, %eax
- pinsrw $3, %eax, %xmm2
- mulsd %xmm0, %xmm2
- addsd %xmm0, %xmm2
- jmp ..B1.4
-.L_2TAG_PACKET_3.0.1:
- movq %xmm0, %xmm2
- mulsd %xmm2, %xmm2
- jmp ..B1.4
-.L_2TAG_PACKET_2.0.1:
- cmpl $32752, %ecx
- jae .L_2TAG_PACKET_4.0.1
- xorpd %xmm2, %xmm2
- movl $15344, %ecx
- pinsrw $3, %ecx, %xmm2
- movq %xmm2, %xmm3
- mulsd %xmm2, %xmm2
- addsd %xmm3, %xmm2
-.L_2TAG_PACKET_5.0.1:
- xorpd %xmm0, %xmm0
- orl $16368, %edx
- pinsrw $3, %edx, %xmm0
- jmp ..B1.4
-.L_2TAG_PACKET_4.0.1:
- movq %xmm0, %xmm2
- movd %xmm0, %eax
- psrlq $20, %xmm2
- movd %xmm2, %ecx
- orl %eax, %ecx
- cmpl $0, %ecx
- je .L_2TAG_PACKET_5.0.1
- addsd %xmm0, %xmm0
- movq %xmm0, (%rsp)
-.L_2TAG_PACKET_6.0.1:
-..B1.4:
- popq %rcx
-..___tag_value_tanh.4:
- ret
-..___tag_value_tanh.5:
-END(tanh)
-# -- End tanh
- .section .rodata, "a"
- .align 16
- .align 16
-L2E:
- .long 1610612736
- .long 1082594631
- .long 4166901572
- .long 1055174155
- .type L2E,@object
- .size L2E,16
- .align 16
-Shifter:
- .long 0
- .long 1127743488
- .long 0
- .long 3275227136
- .type Shifter,@object
- .size Shifter,16
- .align 16
-cv:
- .long 3884607281
- .long 3168131199
- .long 3607404735
- .long 3190582024
- .long 1874480759
- .long 1032041131
- .long 4286760334
- .long 1053736893
- .long 4277811695
- .long 3211144770
- .long 0
- .long 0
- .type cv,@object
- .size cv,48
- .align 16
-T2_neg_f:
- .long 0
- .long 1072693248
- .long 0
- .long 0
- .long 1797923801
- .long 1072687577
- .long 1950547427
- .long 1013229059
- .long 730821105
- .long 1072681922
- .long 2523232743
- .long 1012067188
- .long 915592468
- .long 1072676282
- .long 352947894
- .long 3161024371
- .long 2174652632
- .long 1072670657
- .long 4087714590
- .long 1014450259
- .long 35929225
- .long 1072665048
- .long 2809788041
- .long 3159436968
- .long 2912730644
- .long 1072659453
- .long 3490067722
- .long 3163405074
- .long 2038973688
- .long 1072653874
- .long 892941374
- .long 1016046459
- .long 1533953344
- .long 1072648310
- .long 769171851
- .long 1015665633
- .long 1222472308
- .long 1072642761
- .long 1054357470
- .long 3161021018
- .long 929806999
- .long 1072637227
- .long 3205336643
- .long 1015259557
- .long 481706282
- .long 1072631708
- .long 1696079173
- .long 3162710528
- .long 3999357479
- .long 1072626203
- .long 2258941616
- .long 1015924724
- .long 2719515920
- .long 1072620714
- .long 2760332941
- .long 1015137933
- .long 764307441
- .long 1072615240
- .long 3021057420
- .long 3163329523
- .long 2256325230
- .long 1072609780
- .long 580117746
- .long 1015317295
- .long 2728693978
- .long 1072604335
- .long 396109971
- .long 3163462691
- .long 2009970496
- .long 1072598905
- .long 2159039665
- .long 3162572948
- .long 4224142467
- .long 1072593489
- .long 3389820386
- .long 1015207202
- .long 610758006
- .long 1072588089
- .long 1965209397
- .long 3161866232
- .long 3884662774
- .long 1072582702
- .long 2158611599
- .long 1014210185
- .long 991358482
- .long 1072577331
- .long 838715019
- .long 3163157668
- .long 351641897
- .long 1072571974
- .long 2172261526
- .long 3163010599
- .long 1796832535
- .long 1072566631
- .long 3176955716
- .long 3160585513
- .long 863738719
- .long 1072561303
- .long 1326992220
- .long 3162613197
- .long 1679558232
- .long 1072555989
- .long 2390342287
- .long 3163333970
- .long 4076975200
- .long 1072550689
- .long 2029000899
- .long 1015208535
- .long 3594158869
- .long 1072545404
- .long 2456521700
- .long 3163256561
- .long 64696965
- .long 1072540134
- .long 1768797490
- .long 1015816960
- .long 1912561781
- .long 1072534877
- .long 3147495102
- .long 1015678253
- .long 382305176
- .long 1072529635
- .long 2347622376
- .long 3162578625
- .long 3898795731
- .long 1072524406
- .long 1249994144
- .long 1011869818
- .long 3707479175
- .long 1072519192
- .long 3613079303
- .long 1014164738
- .long 3939148246
- .long 1072513992
- .long 3210352148
- .long 1015274323
- .long 135105010
- .long 1072508807
- .long 1906148728
- .long 3163375739
- .long 721996136
- .long 1072503635
- .long 563754734
- .long 1015371318
- .long 1242007932
- .long 1072498477
- .long 1132034716
- .long 3163339831
- .long 1532734324
- .long 1072493333
- .long 3094216535
- .long 3163162857
- .long 1432208378
- .long 1072488203
- .long 1401068914
- .long 3162363963
- .long 778901109
- .long 1072483087
- .long 2248183955
- .long 3161268751
- .long 3706687593
- .long 1072477984
- .long 3521726940
- .long 1013253067
- .long 1464976603
- .long 1072472896
- .long 3507292405
- .long 3161977534
- .long 2483480501
- .long 1072467821
- .long 1216371780
- .long 1013034172
- .long 2307442995
- .long 1072462760
- .long 3190117721
- .long 3162404539
- .long 777507147
- .long 1072457713
- .long 4282924205
- .long 1015187533
- .long 2029714210
- .long 1072452679
- .long 613660079
- .long 1015099143
- .long 1610600570
- .long 1072447659
- .long 3766732298
- .long 1015760183
- .long 3657065772
- .long 1072442652
- .long 399025623
- .long 3162957078
- .long 3716502172
- .long 1072437659
- .long 2303740125
- .long 1014042725
- .long 1631695677
- .long 1072432680
- .long 2717633076
- .long 3162344026
- .long 1540824585
- .long 1072427714
- .long 1064017011
- .long 3163487690
- .long 3287523847
- .long 1072422761
- .long 1625971539
- .long 3157009955
- .long 2420883922
- .long 1072417822
- .long 2049810052
- .long 1014119888
- .long 3080351519
- .long 1072412896
- .long 3379126788
- .long 3157218001
- .long 815859274
- .long 1072407984
- .long 240396590
- .long 3163487443
- .long 4062661092
- .long 1072403084
- .long 1422616006
- .long 3163255318
- .long 4076559943
- .long 1072398198
- .long 2119478331
- .long 3160758351
- .long 703710506
- .long 1072393326
- .long 1384660846
- .long 1015195891
- .long 2380618042
- .long 1072388466
- .long 3149557219
- .long 3163320799
- .long 364333489
- .long 1072383620
- .long 3923737744
- .long 3161421373
- .long 3092190715
- .long 1072378786
- .long 814012168
- .long 3159523422
- .long 1822067026
- .long 1072373966
- .long 1241994956
- .long 1015340290
- .long 697153126
- .long 1072369159
- .long 1283515429
- .long 3163283189
- .long 3861050111
- .long 1072364364
- .long 254893773
- .long 3162813180
- .long 2572866477
- .long 1072359583
- .long 878562433
- .long 1015521741
- .long 977020788
- .long 1072354815
- .long 3065100517
- .long 1015541563
- .long 3218338682
- .long 1072350059
- .long 3404164304
- .long 3162477108
- .long 557149882
- .long 1072345317
- .long 3672720709
- .long 1014537265
- .long 1434058175
- .long 1072340587
- .long 251133233
- .long 1015085769
- .long 1405169241
- .long 1072335870
- .long 2998539689
- .long 3162830951
- .long 321958744
- .long 1072331166
- .long 3401933767
- .long 1015794558
- .long 2331271250
- .long 1072326474
- .long 812057446
- .long 1012207446
- .long 2990417245
- .long 1072321795
- .long 3683467745
- .long 3163369326
- .long 2152073944
- .long 1072317129
- .long 1486860576
- .long 3163203456
- .long 3964284211
- .long 1072312475
- .long 2111583915
- .long 1015427164
- .long 3985553595
- .long 1072307834
- .long 4002146062
- .long 1015834136
- .long 2069751141
- .long 1072303206
- .long 1562170675
- .long 3162724681
- .long 2366108318
- .long 1072298590
- .long 2867985102
- .long 3161762254
- .long 434316067
- .long 1072293987
- .long 2028358766
- .long 1013458122
- .long 424392917
- .long 1072289396
- .long 2749202995
- .long 3162838718
- .long 2191782032
- .long 1072284817
- .long 2960257726
- .long 1013742662
- .long 1297350157
- .long 1072280251
- .long 1308022040
- .long 3163412558
- .long 1892288442
- .long 1072275697
- .long 2446255666
- .long 3162600381
- .long 3833209506
- .long 1072271155
- .long 2722920684
- .long 1013754842
- .long 2682146384
- .long 1072266626
- .long 2082178513
- .long 3163363419
- .long 2591453363
- .long 1072262109
- .long 2132396182
- .long 3159074198
- .long 3418903055
- .long 1072257604
- .long 2527457337
- .long 3160820604
- .long 727685349
- .long 1072253112
- .long 2038246809
- .long 3162358742
- .long 2966275557
- .long 1072248631
- .long 2176155324
- .long 3159842759
- .long 1403662306
- .long 1072244163
- .long 2788809599
- .long 3161671007
- .long 194117574
- .long 1072239707
- .long 777528612
- .long 3163412089
- .long 3492293770
- .long 1072235262
- .long 2248032210
- .long 1015386826
- .long 2568320822
- .long 1072230830
- .long 2732824428
- .long 1014352915
- .long 1577608921
- .long 1072226410
- .long 1875489510
- .long 3162968394
- .long 380978316
- .long 1072222002
- .long 854188970
- .long 3160462686
- .long 3134592888
- .long 1072217605
- .long 4232266862
- .long 1015991134
- .long 1110089947
- .long 1072213221
- .long 1451641639
- .long 1015474673
- .long 2759350287
- .long 1072208848
- .long 1148526634
- .long 1015894933
- .long 3649726105
- .long 1072204487
- .long 4085036346
- .long 1015649474
- .long 3643909174
- .long 1072200138
- .long 3537586109
- .long 1014354647
- .long 2604962541
- .long 1072195801
- .long 2614425274
- .long 3163539192
- .long 396319521
- .long 1072191476
- .long 4172420816
- .long 3159074632
- .long 1176749997
- .long 1072187162
- .long 2738998779
- .long 3162035844
- .long 515457527
- .long 1072182860
- .long 836709333
- .long 1015651226
- .long 2571947539
- .long 1072178569
- .long 3558159064
- .long 3163376669
- .long 2916157145
- .long 1072174290
- .long 219487565
- .long 1015309367
- .long 1413356050
- .long 1072170023
- .long 1651349291
- .long 3162668166
- .long 2224145553
- .long 1072165767
- .long 3482522030
- .long 3161489169
- .long 919555682
- .long 1072161523
- .long 3121969534
- .long 1012948226
- .long 1660913392
- .long 1072157290
- .long 4218599604
- .long 1015135707
- .long 19972402
- .long 1072153069
- .long 3507899862
- .long 1016009292
- .long 158781403
- .long 1072148859
- .long 2221464712
- .long 3163286453
- .long 1944781191
- .long 1072144660
- .long 3993278767
- .long 3161724279
- .long 950803702
- .long 1072140473
- .long 1655364926
- .long 1015237032
- .long 1339972927
- .long 1072136297
- .long 167908909
- .long 1015572152
- .long 2980802057
- .long 1072132132
- .long 378619896
- .long 1015773303
- .long 1447192521
- .long 1072127979
- .long 1462857171
- .long 3162514521
- .long 903334909
- .long 1072123837
- .long 1636462108
- .long 1015039997
- .long 1218806132
- .long 1072119706
- .long 1818613052
- .long 3162548441
- .long 2263535754
- .long 1072115586
- .long 752233586
- .long 3162639008
- .long 3907805044
- .long 1072111477
- .long 2257091225
- .long 3161550407
- .long 1727278727
- .long 1072107380
- .long 3562710623
- .long 1011471940
- .long 4182873220
- .long 1072103293
- .long 629542646
- .long 3161996303
- .long 2555984613
- .long 1072099218
- .long 2652555442
- .long 3162552692
- .long 1013258799
- .long 1072095154
- .long 1748797611
- .long 3160129082
- .long 3721688645
- .long 1072091100
- .long 3069276937
- .long 1015839401
- .long 1963711167
- .long 1072087058
- .long 1744767757
- .long 3160574294
- .long 4201977662
- .long 1072083026
- .long 748330254
- .long 1013594357
- .long 1719614413
- .long 1072079006
- .long 330458198
- .long 3163282740
- .long 2979960120
- .long 1072074996
- .long 2599109725
- .long 1014498493
- .long 3561793907
- .long 1072070997
- .long 1157054053
- .long 1011890350
- .long 3339203574
- .long 1072067009
- .long 1483497780
- .long 3162408754
- .long 2186617381
- .long 1072063032
- .long 2270764084
- .long 3163272713
- .long 4273770423
- .long 1072059065
- .long 3383180809
- .long 3163218901
- .long 885834528
- .long 1072055110
- .long 1973258547
- .long 3162261564
- .long 488188413
- .long 1072051165
- .long 3199821029
- .long 1015564048
- .long 2956612997
- .long 1072047230
- .long 2118169751
- .long 3162735553
- .long 3872257780
- .long 1072043306
- .long 1253592103
- .long 1015958334
- .long 3111574537
- .long 1072039393
- .long 2606161479
- .long 3162759746
- .long 551349105
- .long 1072035491
- .long 3821916050
- .long 3162106589
- .long 363667784
- .long 1072031599
- .long 813753950
- .long 1015785209
- .long 2425981843
- .long 1072027717
- .long 2830390851
- .long 3163346599
- .long 2321106615
- .long 1072023846
- .long 2171176610
- .long 1009535771
- .long 4222122499
- .long 1072019985
- .long 1277378074
- .long 3163256737
- .long 3712504873
- .long 1072016135
- .long 88491949
- .long 1015427660
- .long 671025100
- .long 1072012296
- .long 3832014351
- .long 3163022030
- .long 3566716925
- .long 1072008466
- .long 1536826856
- .long 1014142433
- .long 3689071823
- .long 1072004647
- .long 2321004996
- .long 3162552716
- .long 917841882
- .long 1072000839
- .long 18715565
- .long 1015659308
- .long 3723038930
- .long 1071997040
- .long 378465264
- .long 3162569582
- .long 3395129871
- .long 1071993252
- .long 4025345435
- .long 3162335388
- .long 4109806887
- .long 1071989474
- .long 422403966
- .long 1014469229
- .long 1453150082
- .long 1071985707
- .long 498154669
- .long 3161488062
- .long 3896463087
- .long 1071981949
- .long 1139797873
- .long 3161233805
- .long 2731501122
- .long 1071978202
- .long 1774031855
- .long 3162470021
- .long 2135241198
- .long 1071974465
- .long 1236747871
- .long 1013589147
- .long 1990012071
- .long 1071970738
- .long 3529070563
- .long 3162813193
- .long 2178460671
- .long 1071967021
- .long 777878098
- .long 3162842493
- .long 2583551245
- .long 1071963314
- .long 3161094195
- .long 1015606491
- .long 3088564500
- .long 1071959617
- .long 1762311517
- .long 1015045673
- .long 3577096743
- .long 1071955930
- .long 2951496418
- .long 1013793687
- .long 3933059031
- .long 1071952253
- .long 2133366768
- .long 3161531832
- .long 4040676318
- .long 1071948586
- .long 4090609238
- .long 1015663458
- .long 3784486610
- .long 1071944929
- .long 1581883040
- .long 3161698953
- .long 3049340112
- .long 1071941282
- .long 3062915824
- .long 1013170595
- .long 1720398391
- .long 1071937645
- .long 3980678963
- .long 3163300080
- .long 3978100823
- .long 1071934017
- .long 3513027190
- .long 1015845963
- .long 1118294578
- .long 1071930400
- .long 2197495694
- .long 3159909401
- .long 1617004845
- .long 1071926792
- .long 82804944
- .long 1010342778
- .long 1065662932
- .long 1071923194
- .long 2533670915
- .long 1014530238
- .long 3645941911
- .long 1071919605
- .long 3814685081
- .long 3161573341
- .long 654919306
- .long 1071916027
- .long 3232961757
- .long 3163047469
- .long 569847338
- .long 1071912458
- .long 472945272
- .long 3159290729
- .long 3278348324
- .long 1071908898
- .long 3069497416
- .long 1014750712
- .long 78413852
- .long 1071905349
- .long 4183226867
- .long 3163017251
- .long 3743175029
- .long 1071901808
- .long 2072812490
- .long 3162175075
- .long 1276261410
- .long 1071898278
- .long 300981948
- .long 1014684169
- .long 1156440435
- .long 1071894757
- .long 2351451249
- .long 1013967056
- .long 3272845541
- .long 1071891245
- .long 928852419
- .long 3163488248
- .long 3219942644
- .long 1071887743
- .long 3798990616
- .long 1015368806
- .long 887463927
- .long 1071884251
- .long 3596744163
- .long 3160794166
- .long 460407023
- .long 1071880768
- .long 4237175092
- .long 3163138469
- .long 1829099622
- .long 1071877294
- .long 1016661181
- .long 3163461005
- .long 589198666
- .long 1071873830
- .long 2664346172
- .long 3163157962
- .long 926591435
- .long 1071870375
- .long 3208833762
- .long 3162913514
- .long 2732492859
- .long 1071866929
- .long 2691479646
- .long 3162255684
- .long 1603444721
- .long 1071863493
- .long 1548633640
- .long 3162201326
- .long 1726216749
- .long 1071860066
- .long 2466808228
- .long 3161676405
- .long 2992903935
- .long 1071856648
- .long 2218154406
- .long 1015228193
- .long 1000925746
- .long 1071853240
- .long 1018491672
- .long 3163309544
- .long 4232894513
- .long 1071849840
- .long 2383938684
- .long 1014668519
- .long 3991843581
- .long 1071846450
- .long 4092853457
- .long 1014585763
- .long 171030293
- .long 1071843070
- .long 3526460132
- .long 1014428778
- .long 1253935211
- .long 1071839698
- .long 1395382931
- .long 3159702613
- .long 2839424854
- .long 1071836335
- .long 1171596163
- .long 1013041679
- .long 526652809
- .long 1071832982
- .long 4223459736
- .long 1015879375
- .long 2799960843
- .long 1071829637
- .long 1423655381
- .long 1015022151
- .long 964107055
- .long 1071826302
- .long 2800439588
- .long 3162833221
- .long 3504003472
- .long 1071822975
- .long 3594001060
- .long 3157330652
- .long 1724976915
- .long 1071819658
- .long 420909223
- .long 3163117379
- .long 4112506593
- .long 1071816349
- .long 2947355221
- .long 1014371048
- .long 1972484976
- .long 1071813050
- .long 675290301
- .long 3161640050
- .long 3790955393
- .long 1071809759
- .long 2352942462
- .long 3163180090
- .long 874372905
- .long 1071806478
- .long 100263788
- .long 1015940732
- .long 1709341917
- .long 1071803205
- .long 2571168217
- .long 1014152499
- .long 1897844341
- .long 1071799941
- .long 1254300460
- .long 1015275938
- .long 1337108031
- .long 1071796686
- .long 3203724452
- .long 1014677845
- .long 4219606026
- .long 1071793439
- .long 2434574742
- .long 1014681548
- .long 1853186616
- .long 1071790202
- .long 3066496371
- .long 1015656574
- .long 2725843665
- .long 1071786973
- .long 1433917087
- .long 1014838523
- .long 2440944790
- .long 1071783753
- .long 2492769774
- .long 1014147454
- .long 897099801
- .long 1071780542
- .long 754756297
- .long 1015241005
- .long 2288159958
- .long 1071777339
- .long 2169144469
- .long 1014876021
- .long 2218315341
- .long 1071774145
- .long 2694295388
- .long 3163288868
- .long 586995997
- .long 1071770960
- .long 41662348
- .long 3162627992
- .long 1588871207
- .long 1071767783
- .long 143439582
- .long 3162963416
- .long 828946858
- .long 1071764615
- .long 10642492
- .long 1015939438
- .long 2502433899
- .long 1071761455
- .long 2148595913
- .long 1015023991
- .long 2214878420
- .long 1071758304
- .long 892270087
- .long 3163116422
- .long 4162030108
- .long 1071755161
- .long 2763428480
- .long 1015529349
- .long 3949972341
- .long 1071752027
- .long 2068408548
- .long 1014913868
- .long 1480023343
- .long 1071748902
- .long 2247196168
- .long 1015327453
- .long 948735466
- .long 1071745785
- .long 3516338028
- .long 3162574883
- .long 2257959872
- .long 1071742676
- .long 3802946148
- .long 1012964927
- .long 1014845819
- .long 1071739576
- .long 3117910646
- .long 3161559105
- .long 1416741826
- .long 1071736484
- .long 2196380210
- .long 1011413563
- .long 3366293073
- .long 1071733400
- .long 3119426314
- .long 1014120554
- .long 2471440686
- .long 1071730325
- .long 968836267
- .long 3162214888
- .long 2930322912
- .long 1071727258
- .long 2599499422
- .long 3162714047
- .long 351405227
- .long 1071724200
- .long 3125337328
- .long 3159822479
- .long 3228316108
- .long 1071721149
- .long 3010241991
- .long 3158422804
- .long 2875075254
- .long 1071718107
- .long 4144233330
- .long 3163333716
- .long 3490863953
- .long 1071715073
- .long 960797498
- .long 3162948880
- .long 685187902
- .long 1071712048
- .long 378731989
- .long 1014843115
- .long 2952712987
- .long 1071709030
- .long 3293494651
- .long 3160120301
- .long 1608493509
- .long 1071706021
- .long 3159622171
- .long 3162807737
- .long 852742562
- .long 1071703020
- .long 667253586
- .long 1009793559
- .long 590962156
- .long 1071700027
- .long 3829346666
- .long 3163275597
- .long 728909815
- .long 1071697042
- .long 383930225
- .long 1015029468
- .long 1172597893
- .long 1071694065
- .long 114433263
- .long 1015347593
- .long 1828292879
- .long 1071691096
- .long 1255956747
- .long 1015588398
- .long 2602514713
- .long 1071688135
- .long 2268929336
- .long 1014354284
- .long 3402036099
- .long 1071685182
- .long 405889334
- .long 1015105656
- .long 4133881824
- .long 1071682237
- .long 2148155345
- .long 3162931299
- .long 410360776
- .long 1071679301
- .long 1269990655
- .long 1011975870
- .long 728934454
- .long 1071676372
- .long 1413842688
- .long 1014178612
- .long 702412510
- .long 1071673451
- .long 3803266087
- .long 3162280415
- .long 238821257
- .long 1071670538
- .long 1469694871
- .long 3162884987
- .long 3541402996
- .long 1071667632
- .long 2759177317
- .long 1014854626
- .long 1928746161
- .long 1071664735
- .long 983617676
- .long 1014285177
- .long 3899555717
- .long 1071661845
- .long 427280750
- .long 3162546972
- .long 772914124
- .long 1071658964
- .long 4004372762
- .long 1012230161
- .long 1048019041
- .long 1071656090
- .long 1398474845
- .long 3160510595
- .long 339411585
- .long 1071653224
- .long 264588982
- .long 3161636657
- .long 2851812149
- .long 1071650365
- .long 2595802551
- .long 1015767337
- .long 4200250559
- .long 1071647514
- .long 2808127345
- .long 3161781938
- .type T2_neg_f,@object
- .size T2_neg_f,4096
- .space 512, 0x00 # pad
- .align 16
-MASK3:
- .long 0
- .long 4294967280
- .long 0
- .long 4294967280
- .type MASK3,@object
- .size MASK3,16
- .align 16
-RMASK:
- .long 4294705152
- .long 4294967295
- .long 4294705152
- .long 4294967295
- .type RMASK,@object
- .size RMASK,16
- .align 16
-pv:
- .long 236289503
- .long 1064135997
- .long 463583772
- .long 3215696314
- .long 1441186365
- .long 3212977891
- .long 286331153
- .long 1069617425
- .long 2284589306
- .long 1066820852
- .long 1431655765
- .long 3218429269
- .type pv,@object
- .size pv,48
- .align 4
-HALFMASK:
- .long 4160749568
- .long 2147483647
- .type HALFMASK,@object
- .size HALFMASK,8
- .align 4
-ONEMASK:
- .long 0
- .long 1072693248
- .type ONEMASK,@object
- .size ONEMASK,8
- .align 4
-TWOMASK:
- .long 0
- .long 1073741824
- .type TWOMASK,@object
- .size TWOMASK,8
- .data
- .section .note.GNU-stack, "",@progbits
-// -- Begin DWARF2 SEGMENT .eh_frame
- .section .eh_frame,"a",@progbits
-.eh_frame_seg:
- .align 1
- .4byte 0x00000014
- .8byte 0x00527a0100000000
- .8byte 0x08070c1b01107801
- .4byte 0x00000190
- .4byte 0x0000001c
- .4byte 0x0000001c
- .4byte ..___tag_value_tanh.1-.
- .4byte ..___tag_value_tanh.5-..___tag_value_tanh.1
- .2byte 0x0400
- .4byte ..___tag_value_tanh.3-..___tag_value_tanh.1
- .2byte 0x100e
- .byte 0x04
- .4byte ..___tag_value_tanh.4-..___tag_value_tanh.3
- .2byte 0x080e
- .byte 0x00
-# End
diff --git a/libm/x86_64/sqrt.S b/libm/x86_64/sqrt.S
deleted file mode 100644
index ee97026..0000000
--- a/libm/x86_64/sqrt.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(sqrt)
-sqrtsd %xmm0,%xmm0
-retq
-END(sqrt)
diff --git a/libm/x86_64/sqrtf.S b/libm/x86_64/sqrtf.S
deleted file mode 100644
index 910407f..0000000
--- a/libm/x86_64/sqrtf.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(sqrtf)
-sqrtss %xmm0,%xmm0
-retq
-END(sqrtf)
diff --git a/libm/x86_64/trunc.S b/libm/x86_64/trunc.S
deleted file mode 100644
index fe18b40..0000000
--- a/libm/x86_64/trunc.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(trunc)
-roundsd $0x3,%xmm0,%xmm0
-retq
-END(trunc)
diff --git a/libm/x86_64/truncf.S b/libm/x86_64/truncf.S
deleted file mode 100644
index eeee1d7..0000000
--- a/libm/x86_64/truncf.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <private/bionic_asm.h>
-
-ENTRY(truncf)
-roundss $0x3,%xmm0,%xmm0
-retq
-END(truncf)
diff --git a/linker/Android.bp b/linker/Android.bp
index d5e7367..020bd7d 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -52,6 +52,9 @@
arm64: {
srcs: ["arch/arm64/linker_wrapper_begin.S"],
},
+ riscv64: {
+ srcs: ["arch/riscv64/linker_wrapper_begin.S"],
+ },
x86_64: {
srcs: ["arch/x86_64/linker_wrapper_begin.S"],
},
@@ -115,7 +118,7 @@
"libasync_safe",
- "liblog",
+ "liblog_for_runtime_apex",
],
// We need to access Bionic private headers in the linker.
@@ -208,6 +211,13 @@
}
filegroup {
+ name: "linker_sources_riscv64",
+ srcs: [
+ "arch/riscv64/begin.S",
+ ],
+}
+
+filegroup {
name: "linker_sources_x86",
srcs: [
"arch/x86/begin.S",
@@ -224,10 +234,11 @@
cc_defaults {
name: "linker_version_script_overlay",
arch: {
- arm: { version_script: "linker.arm.map" },
- arm64: { version_script: "linker.generic.map" },
- x86: { version_script: "linker.generic.map" },
- x86_64: { version_script: "linker.generic.map" },
+ arm: { version_script: "linker.arm.map" },
+ arm64: { version_script: "linker.generic.map" },
+ riscv64: { version_script: "linker.generic.map" },
+ x86: { version_script: "linker.generic.map" },
+ x86_64: { version_script: "linker.generic.map" },
},
}
@@ -241,15 +252,50 @@
arch: {
arm: {
srcs: [":linker_sources_arm"],
+
+ // Arm 32 bit does not produce complete exidx unwind information
+ // so keep the .debug_frame which is relatively small and does
+ // include needed unwind information.
+ // See b/242162222 for details.
+ strip: {
+ keep_symbols_and_debug_frame: true,
+ },
},
arm64: {
srcs: [":linker_sources_arm64"],
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
+ },
+ riscv64: {
+ srcs: [":linker_sources_riscv64"],
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
},
x86: {
srcs: [":linker_sources_x86"],
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
},
x86_64: {
srcs: [":linker_sources_x86_64"],
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
},
},
@@ -275,12 +321,6 @@
static_executable: true,
- // Leave the symbols in the shared library so that stack unwinders can produce
- // meaningful name resolution.
- strip: {
- keep_symbols: true,
- },
-
// Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
// looking up symbols in the linker by mistake.
prefix_symbols: "__dl_",
@@ -334,6 +374,11 @@
],
symlinks: ["linker_asan"],
+ arch: {
+ arm64: {
+ symlinks: ["linker_hwasan"],
+ },
+ },
multilib: {
lib64: {
suffix: "64",
@@ -406,6 +451,7 @@
"-Wl,--exclude-libs=libgcc_stripped.a",
"-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
+ "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
],
@@ -494,7 +540,7 @@
static_libs: [
"libasync_safe",
"libbase",
- "liblog",
+ "liblog_for_runtime_apex",
],
arch: {
diff --git a/linker/NOTICE b/linker/NOTICE
index 8f70d87..d61a193 100644
--- a/linker/NOTICE
+++ b/linker/NOTICE
@@ -334,3 +334,31 @@
-------------------------------------------------------------------
+Copyright (C) 2022 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
diff --git a/linker/arch/arm/begin.S b/linker/arch/arm/begin.S
index 80d9fe1..3b673f0 100644
--- a/linker/arch/arm/begin.S
+++ b/linker/arch/arm/begin.S
@@ -35,6 +35,6 @@
mov r0, sp
bl __linker_init
- /* linker init returns the _entry address in the main image */
+ // __linker_init returns the address of the entry point in the main image.
bx r0
END(_start)
diff --git a/linker/arch/arm64/begin.S b/linker/arch/arm64/begin.S
index a947475..14999cd 100644
--- a/linker/arch/arm64/begin.S
+++ b/linker/arch/arm64/begin.S
@@ -35,6 +35,6 @@
mov x0, sp
bl __linker_init
- /* linker init returns the _entry address in the main image */
+ // __linker_init returns the address of the entry point in the main image.
br x0
END(_start)
diff --git a/linker/arch/arm64/tlsdesc_resolver.S b/linker/arch/arm64/tlsdesc_resolver.S
index 96eff8e..ad155e2 100644
--- a/linker/arch/arm64/tlsdesc_resolver.S
+++ b/linker/arch/arm64/tlsdesc_resolver.S
@@ -58,9 +58,9 @@
cmp x21, x22
b.lo .fallback
- ldr x21, [x0, #8] // TlsIndex::module
+ ldr x21, [x0, #8] // TlsIndex::module_id
ldr x22, [x0, #16] // TlsIndex::offset
- ldr x21, [x20, x21, lsl #3] // TlsDtv::modules[module]
+ ldr x21, [x20, x21, lsl #3] // TlsDtv::modules[module_id]
cbz x21, .fallback
add x0, x21, x22
sub x0, x0, x19
diff --git a/libc/arch-arm64/generic/bionic/memcpy.S b/linker/arch/riscv64/begin.S
similarity index 83%
copy from libc/arch-arm64/generic/bionic/memcpy.S
copy to linker/arch/riscv64/begin.S
index bc1945c..f7509c6 100644
--- a/libc/arch-arm64/generic/bionic/memcpy.S
+++ b/linker/arch/riscv64/begin.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,12 +26,15 @@
* SUCH DAMAGE.
*/
-// Prototype: void *memcpy (void *dst, const void *src, size_t count).
-
#include <private/bionic_asm.h>
-ENTRY(__memcpy)
- #include "memcpy_base.S"
-END(__memcpy)
+ENTRY(_start)
+ // Force unwinds to end in this function.
+ .cfi_undefined ra
-NOTE_GNU_PROPERTY()
+ mv a0, sp
+ jal __linker_init
+
+ // __linker_init returns the address of the entry point in the main image.
+ jr a0
+END(_start)
diff --git a/linker/arch/x86/begin.S b/linker/arch/x86/begin.S
index 3812646..81e2740 100644
--- a/linker/arch/x86/begin.S
+++ b/linker/arch/x86/begin.S
@@ -38,6 +38,6 @@
call __linker_init // %esp is aligned to 16 before the call.
addl $16, %esp
- /* linker init returns (%eax) the _entry address in the main image */
+ // __linker_init returns the address of the entry point in the main image.
jmp *%eax
END(_start)
diff --git a/linker/arch/x86_64/begin.S b/linker/arch/x86_64/begin.S
index 4722301..baba0db 100644
--- a/linker/arch/x86_64/begin.S
+++ b/linker/arch/x86_64/begin.S
@@ -35,6 +35,6 @@
mov %rsp, %rdi
call __linker_init
- /* linker init returns (%rax) the _entry address in the main image */
+ // __linker_init returns the address of the entry point in the main image.
jmp *%rax
END(_start)
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index af05027..a3f5246 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -28,8 +28,9 @@
#include "linker.h"
#include "linker_cfi.h"
-#include "linker_globals.h"
+#include "linker_debuggerd.h"
#include "linker_dlwarning.h"
+#include "linker_globals.h"
#include <link.h>
#include <pthread.h>
@@ -92,6 +93,8 @@
#if defined(__arm__)
_Unwind_Ptr __loader_dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) __LINKER_PUBLIC__;
#endif
+bool __loader_android_handle_signal(int signal_number, siginfo_t* info,
+ void* context) __LINKER_PUBLIC__;
}
static pthread_mutex_t g_dl_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
@@ -302,6 +305,10 @@
return __libc_shared_globals();
}
+bool __loader_android_handle_signal(int signal_number, siginfo_t* info, void* context) {
+ return debuggerd_handle_signal(signal_number, info, context);
+}
+
static uint8_t __libdl_info_buf[sizeof(soinfo)] __attribute__((aligned(8)));
static soinfo* __libdl_info = nullptr;
diff --git a/linker/ld_android.cpp b/linker/ld_android.cpp
index 0239c30..1c03106 100644
--- a/linker/ld_android.cpp
+++ b/linker/ld_android.cpp
@@ -44,6 +44,7 @@
__strong_alias(__loader_android_set_application_target_sdk_version, __internal_linker_error);
__strong_alias(__loader_android_update_LD_LIBRARY_PATH, __internal_linker_error);
__strong_alias(__loader_cfi_fail, __internal_linker_error);
+__strong_alias(__loader_android_handle_signal, __internal_linker_error);
__strong_alias(__loader_dl_iterate_phdr, __internal_linker_error);
__strong_alias(__loader_dladdr, __internal_linker_error);
__strong_alias(__loader_dlclose, __internal_linker_error);
diff --git a/linker/linker.arm.map b/linker/linker.arm.map
index be438ca..b805cd6 100644
--- a/linker/linker.arm.map
+++ b/linker/linker.arm.map
@@ -24,6 +24,7 @@
__loader_remove_thread_local_dtor;
__loader_shared_globals;
rtld_db_dlactivity;
+ __loader_android_handle_signal;
local:
*;
};
diff --git a/linker/linker.cpp b/linker/linker.cpp
index c6588d2..17b574f 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -34,11 +34,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/auxv.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/vfs.h>
#include <unistd.h>
+#include <iterator>
#include <new>
#include <string>
#include <unordered_map>
@@ -132,6 +134,36 @@
nullptr
};
+#if defined(__aarch64__)
+static const char* const kHwasanSystemLibDir = "/system/lib64/hwasan";
+static const char* const kHwasanOdmLibDir = "/odm/lib64/hwasan";
+static const char* const kHwasanVendorLibDir = "/vendor/lib64/hwasan";
+
+// HWASan is only supported on aarch64.
+static const char* const kHwsanDefaultLdPaths[] = {
+ kHwasanSystemLibDir,
+ kSystemLibDir,
+ kHwasanOdmLibDir,
+ kOdmLibDir,
+ kHwasanVendorLibDir,
+ kVendorLibDir,
+ nullptr
+};
+
+// Is HWASAN enabled?
+static bool g_is_hwasan = false;
+#else
+static const char* const kHwsanDefaultLdPaths[] = {
+ kSystemLibDir,
+ kOdmLibDir,
+ kVendorLibDir,
+ nullptr
+};
+
+// Never any HWASan. Help the compiler remove the code we don't need.
+constexpr bool g_is_hwasan = false;
+#endif
+
// Is ASAN enabled?
static bool g_is_asan = false;
@@ -371,7 +403,7 @@
char* static_tls = reinterpret_cast<char*>(__get_bionic_tcb()) - layout.offset_bionic_tcb();
return static_tls + tls_mod.static_offset;
} else if (should_alloc) {
- const TlsIndex ti { si_tls->module_id, 0 };
+ const TlsIndex ti { si_tls->module_id, static_cast<size_t>(0 - TLS_DTV_OFFSET) };
return TLS_GET_ADDR(&ti);
} else {
TlsDtv* dtv = __get_tcb_dtv(__get_bionic_tcb());
@@ -1189,8 +1221,6 @@
if ((fs_stat.f_type != TMPFS_MAGIC) && (!ns->is_accessible(realpath))) {
// TODO(dimitry): workaround for http://b/26394120 - the exempt-list
- // TODO(dimitry) before O release: add a namespace attribute to have this enabled
- // only for classloader-namespaces
const soinfo* needed_by = task->is_dt_needed() ? task->get_needed_by() : nullptr;
if (is_exempt_lib(ns, name, needed_by)) {
// print warning only if needed by non-system library
@@ -1568,18 +1598,16 @@
task->set_extinfo(is_dt_needed ? nullptr : extinfo);
task->set_dt_needed(is_dt_needed);
- LD_LOG(kLogDlopen, "find_libraries(ns=%s): task=%s, is_dt_needed=%d", ns->get_name(),
- task->get_name(), is_dt_needed);
-
// Note: start from the namespace that is stored in the LoadTask. This namespace
// is different from the current namespace when the LoadTask is for a transitive
// dependency and the lib that created the LoadTask is not found in the
- // current namespace but in one of the linked namespace.
- if (!find_library_internal(const_cast<android_namespace_t*>(task->get_start_from()),
- task,
- &zip_archive_cache,
- &load_tasks,
- rtld_flags)) {
+ // current namespace but in one of the linked namespaces.
+ android_namespace_t* start_ns = const_cast<android_namespace_t*>(task->get_start_from());
+
+ LD_LOG(kLogDlopen, "find_library_internal(ns=%s@%p): task=%s, is_dt_needed=%d",
+ start_ns->get_name(), start_ns, task->get_name(), is_dt_needed);
+
+ if (!find_library_internal(start_ns, task, &zip_archive_cache, &load_tasks, rtld_flags)) {
return false;
}
@@ -2137,26 +2165,46 @@
}
// End Workaround for dlopen(/system/lib/<soname>) when .so is in /apex.
- std::string asan_name_holder;
+ std::string translated_name_holder;
+ assert(!g_is_hwasan || !g_is_asan);
const char* translated_name = name;
if (g_is_asan && translated_name != nullptr && translated_name[0] == '/') {
char original_path[PATH_MAX];
if (realpath(name, original_path) != nullptr) {
- asan_name_holder = std::string(kAsanLibDirPrefix) + original_path;
- if (file_exists(asan_name_holder.c_str())) {
+ translated_name_holder = std::string(kAsanLibDirPrefix) + original_path;
+ if (file_exists(translated_name_holder.c_str())) {
soinfo* si = nullptr;
if (find_loaded_library_by_realpath(ns, original_path, true, &si)) {
PRINT("linker_asan dlopen NOT translating \"%s\" -> \"%s\": library already loaded", name,
- asan_name_holder.c_str());
+ translated_name_holder.c_str());
} else {
PRINT("linker_asan dlopen translating \"%s\" -> \"%s\"", name, translated_name);
- translated_name = asan_name_holder.c_str();
+ translated_name = translated_name_holder.c_str();
+ }
+ }
+ }
+ } else if (g_is_hwasan && translated_name != nullptr && translated_name[0] == '/') {
+ char original_path[PATH_MAX];
+ if (realpath(name, original_path) != nullptr) {
+ // Keep this the same as CreateHwasanPath in system/linkerconfig/modules/namespace.cc.
+ std::string path(original_path);
+ auto slash = path.rfind('/');
+ if (slash != std::string::npos || slash != path.size() - 1) {
+ translated_name_holder = path.substr(0, slash) + "/hwasan" + path.substr(slash);
+ }
+ if (!translated_name_holder.empty() && file_exists(translated_name_holder.c_str())) {
+ soinfo* si = nullptr;
+ if (find_loaded_library_by_realpath(ns, original_path, true, &si)) {
+ PRINT("linker_hwasan dlopen NOT translating \"%s\" -> \"%s\": library already loaded", name,
+ translated_name_holder.c_str());
+ } else {
+ PRINT("linker_hwasan dlopen translating \"%s\" -> \"%s\"", name, translated_name);
+ translated_name = translated_name_holder.c_str();
}
}
}
}
-
ProtectedDataGuard guard;
soinfo* si = find_library(ns, translated_name, flags, extinfo, caller);
loading_trace.End();
@@ -2488,11 +2536,12 @@
return false;
}
- auto sonames = android::base::Split(shared_lib_sonames, ":");
- std::unordered_set<std::string> sonames_set(sonames.begin(), sonames.end());
+ std::vector<std::string> sonames = android::base::Split(shared_lib_sonames, ":");
+ std::unordered_set<std::string> sonames_set(std::make_move_iterator(sonames.begin()),
+ std::make_move_iterator(sonames.end()));
ProtectedDataGuard guard;
- namespace_from->add_linked_namespace(namespace_to, sonames_set, false);
+ namespace_from->add_linked_namespace(namespace_to, std::move(sonames_set), false);
return true;
}
@@ -3144,6 +3193,14 @@
case DT_AARCH64_VARIANT_PCS:
// Ignored: AArch64 processor-specific dynamic array tags.
break;
+ // TODO(mitchp): Add support to libc_init_mte to use these dynamic array entries instead of
+ // the Android-specific ELF note.
+ case DT_AARCH64_MEMTAG_MODE:
+ case DT_AARCH64_MEMTAG_HEAP:
+ case DT_AARCH64_MEMTAG_STACK:
+ case DT_AARCH64_MEMTAG_GLOBALS:
+ case DT_AARCH64_MEMTAG_GLOBALSSZ:
+ break;
#endif
default:
@@ -3329,9 +3386,10 @@
return true;
}
-static std::vector<android_namespace_t*> init_default_namespace_no_config(bool is_asan) {
+static std::vector<android_namespace_t*> init_default_namespace_no_config(bool is_asan, bool is_hwasan) {
g_default_namespace.set_isolated(false);
- auto default_ld_paths = is_asan ? kAsanDefaultLdPaths : kDefaultLdPaths;
+ auto default_ld_paths = is_asan ? kAsanDefaultLdPaths : (
+ is_hwasan ? kHwsanDefaultLdPaths : kDefaultLdPaths);
char real_path[PATH_MAX];
std::vector<std::string> ld_default_paths;
@@ -3435,6 +3493,7 @@
return kLdConfigFilePath;
}
+
std::vector<android_namespace_t*> init_default_namespaces(const char* executable_path) {
g_default_namespace.set_name("(default)");
@@ -3448,6 +3507,16 @@
(strcmp(bname, "linker_asan") == 0 ||
strcmp(bname, "linker_asan64") == 0);
+#if defined(__aarch64__)
+ // HWASan is only supported on AArch64.
+ // The AT_SECURE restriction is because this is a debug feature that does
+ // not need to work on secure binaries, it doesn't hurt to disallow the
+ // environment variable for them, as it impacts the program execution.
+ char* hwasan_env = getenv("LD_HWASAN");
+ g_is_hwasan = (bname != nullptr &&
+ strcmp(bname, "linker_hwasan64") == 0) ||
+ (hwasan_env != nullptr && !getauxval(AT_SECURE) && strcmp(hwasan_env, "1") == 0);
+#endif
const Config* config = nullptr;
{
@@ -3455,7 +3524,7 @@
INFO("[ Reading linker config \"%s\" ]", ld_config_file_path.c_str());
ScopedTrace trace(("linker config " + ld_config_file_path).c_str());
std::string error_msg;
- if (!Config::read_binary_config(ld_config_file_path.c_str(), executable_path, g_is_asan,
+ if (!Config::read_binary_config(ld_config_file_path.c_str(), executable_path, g_is_asan, g_is_hwasan,
&config, &error_msg)) {
if (!error_msg.empty()) {
DL_WARN("Warning: couldn't read '%s' for '%s' (using default configuration instead): %s",
@@ -3466,7 +3535,7 @@
}
if (config == nullptr) {
- return init_default_namespace_no_config(g_is_asan);
+ return init_default_namespace_no_config(g_is_asan, g_is_hwasan);
}
const auto& namespace_configs = config->namespace_configs();
diff --git a/linker/linker.generic.map b/linker/linker.generic.map
index f3c01c0..4d7f236 100644
--- a/linker/linker.generic.map
+++ b/linker/linker.generic.map
@@ -23,6 +23,7 @@
__loader_remove_thread_local_dtor;
__loader_shared_globals;
rtld_db_dlactivity;
+ __loader_android_handle_signal;
local:
*;
};
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 1771e87..ad40c50 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -463,6 +463,7 @@
bool Config::read_binary_config(const char* ld_config_file_path,
const char* binary_realpath,
bool is_asan,
+ bool is_hwasan,
const Config** config,
std::string* error_msg) {
g_config.clear();
@@ -579,6 +580,8 @@
// these are affected by is_asan flag
if (is_asan) {
property_name_prefix += ".asan";
+ } else if (is_hwasan) {
+ property_name_prefix += ".hwasan";
}
// search paths are resolved (canonicalized). This is required mainly for
diff --git a/linker/linker_config.h b/linker/linker_config.h
index fe23ec1..09fea45 100644
--- a/linker/linker_config.h
+++ b/linker/linker_config.h
@@ -166,6 +166,7 @@
static bool read_binary_config(const char* ld_config_file_path,
const char* binary_realpath,
bool is_asan,
+ bool is_hwasan,
const Config** config,
std::string* error_msg);
diff --git a/linker/linker_config_test.cpp b/linker/linker_config_test.cpp
index acdf641..7e947f3 100644
--- a/linker/linker_config_test.cpp
+++ b/linker/linker_config_test.cpp
@@ -40,6 +40,7 @@
#include <android-base/file.h>
#include <android-base/scopeguard.h>
#include <android-base/stringprintf.h>
+#include <vector>
#if defined(__LP64__)
#define ARCH_SUFFIX "64"
@@ -64,6 +65,10 @@
"namespace.default.asan.search.paths = /data\n"
"namespace.default.asan.search.paths += /vendor/${LIB}\n"
"namespace.default.asan.permitted.paths = /data:/vendor\n"
+ "namespace.default.hwasan.search.paths = /vendor/${LIB}/hwasan\n"
+ "namespace.default.hwasan.search.paths += /vendor/${LIB}\n"
+ "namespace.default.hwasan.permitted.paths = /vendor/${LIB}/hwasan\n"
+ "namespace.default.hwasan.permitted.paths += /vendor/${LIB}\n"
"namespace.default.links = system\n"
"namespace.default.links += vndk\n"
// irregular whitespaces are added intentionally for testing purpose
@@ -77,11 +82,17 @@
"namespace.system.permitted.paths = /system/${LIB}\n"
"namespace.system.asan.search.paths = /data:/system/${LIB}\n"
"namespace.system.asan.permitted.paths = /data:/system\n"
+ "namespace.system.hwasan.search.paths = /system/${LIB}/hwasan\n"
+ "namespace.system.hwasan.search.paths += /system/${LIB}\n"
+ "namespace.system.hwasan.permitted.paths = /system/${LIB}/hwasan\n"
+ "namespace.system.hwasan.permitted.paths += /system/${LIB}\n"
"namespace.vndk.isolated = tr\n"
"namespace.vndk.isolated += ue\n" // should be ignored and return as 'false'.
"namespace.vndk.search.paths = /system/${LIB}/vndk\n"
"namespace.vndk.asan.search.paths = /data\n"
"namespace.vndk.asan.search.paths += /system/${LIB}/vndk\n"
+ "namespace.vndk.hwasan.search.paths = /system/${LIB}/vndk/hwasan\n"
+ "namespace.vndk.hwasan.search.paths += /system/${LIB}/vndk\n"
"namespace.vndk.links = default\n"
"namespace.vndk.link.default.allow_all_shared_libs = true\n"
"namespace.vndk.link.vndk_in_system.allow_all_shared_libs = true\n"
@@ -107,26 +118,50 @@
return resolved_paths;
}
-static void run_linker_config_smoke_test(bool is_asan) {
- const std::vector<std::string> kExpectedDefaultSearchPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/vendor/lib" ARCH_SUFFIX }) :
- std::vector<std::string>({ "/vendor/lib" ARCH_SUFFIX }));
+enum class SmokeTestType {
+ None,
+ Asan,
+ Hwasan,
+};
- const std::vector<std::string> kExpectedDefaultPermittedPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/vendor" }) :
- std::vector<std::string>({ "/vendor/lib" ARCH_SUFFIX }));
+static void run_linker_config_smoke_test(SmokeTestType type) {
+ std::vector<std::string> expected_default_search_path;
+ std::vector<std::string> expected_default_permitted_path;
+ std::vector<std::string> expected_system_search_path;
+ std::vector<std::string> expected_system_permitted_path;
+ std::vector<std::string> expected_vndk_search_path;
- const std::vector<std::string> kExpectedSystemSearchPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/system/lib" ARCH_SUFFIX }) :
- std::vector<std::string>({ "/system/lib" ARCH_SUFFIX }));
+ switch (type) {
+ case SmokeTestType::None:
+ expected_default_search_path = { "/vendor/lib" ARCH_SUFFIX };
+ expected_default_permitted_path = { "/vendor/lib" ARCH_SUFFIX };
+ expected_system_search_path = { "/system/lib" ARCH_SUFFIX };
+ expected_system_permitted_path = { "/system/lib" ARCH_SUFFIX };
+ expected_vndk_search_path = { "/system/lib" ARCH_SUFFIX "/vndk" };
+ break;
+ case SmokeTestType::Asan:
+ expected_default_search_path = { "/data", "/vendor/lib" ARCH_SUFFIX };
+ expected_default_permitted_path = { "/data", "/vendor" };
+ expected_system_search_path = { "/data", "/system/lib" ARCH_SUFFIX };
+ expected_system_permitted_path = { "/data", "/system" };
+ expected_vndk_search_path = { "/data", "/system/lib" ARCH_SUFFIX "/vndk" };
+ break;
+ case SmokeTestType::Hwasan:
+ expected_default_search_path = { "/vendor/lib" ARCH_SUFFIX "/hwasan", "/vendor/lib" ARCH_SUFFIX };
+ expected_default_permitted_path = { "/vendor/lib" ARCH_SUFFIX "/hwasan", "/vendor/lib" ARCH_SUFFIX };
+ expected_system_search_path = { "/system/lib" ARCH_SUFFIX "/hwasan" , "/system/lib" ARCH_SUFFIX };
+ expected_system_permitted_path = { "/system/lib" ARCH_SUFFIX "/hwasan", "/system/lib" ARCH_SUFFIX };
+ expected_vndk_search_path = { "/system/lib" ARCH_SUFFIX "/vndk/hwasan", "/system/lib" ARCH_SUFFIX "/vndk" };
+ break;
+ }
- const std::vector<std::string> kExpectedSystemPermittedPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/system" }) :
- std::vector<std::string>({ "/system/lib" ARCH_SUFFIX }));
-
- const std::vector<std::string> kExpectedVndkSearchPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/system/lib" ARCH_SUFFIX "/vndk"}) :
- std::vector<std::string>({ "/system/lib" ARCH_SUFFIX "/vndk"}));
+ expected_default_search_path = resolve_paths(expected_default_search_path);
+ // expected_default_permitted_path is skipped on purpose, permitted paths
+ // do not get resolved in linker_config.cpp
+ expected_system_search_path = resolve_paths(expected_system_search_path);
+ // expected_system_permitted_path is skipped on purpose, permitted paths
+ // do not get resolved in linker_config.cpp
+ expected_vndk_search_path = resolve_paths(expected_vndk_search_path);
TemporaryFile tmp_file;
close(tmp_file.fd);
@@ -149,7 +184,8 @@
std::string error_msg;
ASSERT_TRUE(Config::read_binary_config(tmp_file.path,
executable_path.c_str(),
- is_asan,
+ type == SmokeTestType::Asan,
+ type == SmokeTestType::Hwasan,
&config,
&error_msg)) << error_msg;
ASSERT_TRUE(config != nullptr);
@@ -162,8 +198,8 @@
ASSERT_TRUE(default_ns_config->isolated());
ASSERT_FALSE(default_ns_config->visible());
- ASSERT_EQ(kExpectedDefaultSearchPath, default_ns_config->search_paths());
- ASSERT_EQ(kExpectedDefaultPermittedPath, default_ns_config->permitted_paths());
+ ASSERT_EQ(expected_default_search_path, default_ns_config->search_paths());
+ ASSERT_EQ(expected_default_permitted_path, default_ns_config->permitted_paths());
const auto& default_ns_links = default_ns_config->links();
ASSERT_EQ(2U, default_ns_links.size());
@@ -202,14 +238,14 @@
ASSERT_TRUE(ns_system->isolated());
ASSERT_TRUE(ns_system->visible());
- ASSERT_EQ(kExpectedSystemSearchPath, ns_system->search_paths());
- ASSERT_EQ(kExpectedSystemPermittedPath, ns_system->permitted_paths());
+ ASSERT_EQ(expected_system_search_path, ns_system->search_paths());
+ ASSERT_EQ(expected_system_permitted_path, ns_system->permitted_paths());
ASSERT_TRUE(ns_vndk != nullptr) << "vndk namespace was not found";
ASSERT_FALSE(ns_vndk->isolated()); // malformed bool property
ASSERT_FALSE(ns_vndk->visible()); // undefined bool property
- ASSERT_EQ(kExpectedVndkSearchPath, ns_vndk->search_paths());
+ ASSERT_EQ(expected_vndk_search_path, ns_vndk->search_paths());
const auto& ns_vndk_links = ns_vndk->links();
ASSERT_EQ(1U, ns_vndk_links.size());
@@ -223,11 +259,15 @@
}
TEST(linker_config, smoke) {
- run_linker_config_smoke_test(false);
+ run_linker_config_smoke_test(SmokeTestType::None);
}
TEST(linker_config, asan_smoke) {
- run_linker_config_smoke_test(true);
+ run_linker_config_smoke_test(SmokeTestType::Asan);
+}
+
+TEST(linker_config, hwasan_smoke) {
+ run_linker_config_smoke_test(SmokeTestType::Hwasan);
}
TEST(linker_config, ns_link_shared_libs_invalid_settings) {
@@ -259,6 +299,7 @@
ASSERT_FALSE(Config::read_binary_config(tmp_file.path,
executable_path.c_str(),
false,
+ false,
&config,
&error_msg));
ASSERT_TRUE(config == nullptr);
@@ -304,6 +345,7 @@
ASSERT_TRUE(Config::read_binary_config(tmp_file.path,
executable_path.c_str(),
false,
+ false,
&config,
&error_msg)) << error_msg;
diff --git a/linker/linker_debuggerd.h b/linker/linker_debuggerd.h
index d701879..95f99e7 100644
--- a/linker/linker_debuggerd.h
+++ b/linker/linker_debuggerd.h
@@ -28,4 +28,7 @@
#pragma once
+#include <signal.h>
+
void linker_debuggerd_init();
+extern "C" bool debuggerd_handle_signal(int signal_number, siginfo_t* info, void* context);
diff --git a/linker/linker_debuggerd_android.cpp b/linker/linker_debuggerd_android.cpp
index cba6345..ab6fc30 100644
--- a/linker/linker_debuggerd_android.cpp
+++ b/linker/linker_debuggerd_android.cpp
@@ -43,6 +43,18 @@
.scudo_stack_depot = __libc_shared_globals()->scudo_stack_depot,
.scudo_region_info = __libc_shared_globals()->scudo_region_info,
.scudo_ring_buffer = __libc_shared_globals()->scudo_ring_buffer,
+ .scudo_ring_buffer_size = __libc_shared_globals()->scudo_ring_buffer_size,
+ };
+}
+
+static gwp_asan_callbacks_t get_gwp_asan_callbacks() {
+ return {
+ .debuggerd_needs_gwp_asan_recovery =
+ __libc_shared_globals()->debuggerd_needs_gwp_asan_recovery,
+ .debuggerd_gwp_asan_pre_crash_report =
+ __libc_shared_globals()->debuggerd_gwp_asan_pre_crash_report,
+ .debuggerd_gwp_asan_post_crash_report =
+ __libc_shared_globals()->debuggerd_gwp_asan_post_crash_report,
};
}
#endif
@@ -52,9 +64,10 @@
// so don't pass in any process info from the bootstrap linker.
debuggerd_callbacks_t callbacks = {
#if defined(__ANDROID_APEX__)
- .get_process_info = get_process_info,
+ .get_process_info = get_process_info,
+ .get_gwp_asan_callbacks = get_gwp_asan_callbacks,
#endif
- .post_dump = notify_gdb_of_libraries,
+ .post_dump = notify_gdb_of_libraries,
};
debuggerd_init(&callbacks);
}
diff --git a/linker/linker_debuggerd_stub.cpp b/linker/linker_debuggerd_stub.cpp
index 631e6e4..c671dd9 100644
--- a/linker/linker_debuggerd_stub.cpp
+++ b/linker/linker_debuggerd_stub.cpp
@@ -28,5 +28,11 @@
#include "linker_debuggerd.h"
+#include <signal.h>
+
void linker_debuggerd_init() {
}
+extern "C" bool debuggerd_handle_signal(int /* signal_number */, siginfo_t* /* info */,
+ void* /* context */) {
+ return false;
+}
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 9e5be34..26e2228 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -43,7 +43,6 @@
#include "linker_tls.h"
#include "linker_utils.h"
-#include "private/bionic_auxv.h"
#include "private/bionic_call_ifunc_resolver.h"
#include "private/bionic_globals.h"
#include "private/bionic_tls.h"
@@ -68,7 +67,8 @@
static void set_bss_vma_name(soinfo* si);
-void __libc_init_mte(const void* phdr_start, size_t phdr_count, uintptr_t load_bias);
+void __libc_init_mte(const void* phdr_start, size_t phdr_count, uintptr_t load_bias,
+ void* stack_top);
// These should be preserved static to avoid emitting
// RELATIVE relocations for the part of the code running
@@ -202,35 +202,29 @@
ElfW(Addr) entry_point;
};
-static ExecutableInfo get_executable_info() {
+static ExecutableInfo get_executable_info(const char* arg_path) {
ExecutableInfo result = {};
+ char const* exe_path = "/proc/self/exe";
- if (is_first_stage_init()) {
- // /proc fs is not mounted when first stage init starts. Therefore we can't
- // use /proc/self/exe for init.
- stat("/init", &result.file_stat);
-
- // /init may be a symlink, so try to read it as such.
- char path[PATH_MAX];
- ssize_t path_len = readlink("/init", path, sizeof(path));
- if (path_len == -1 || path_len >= static_cast<ssize_t>(sizeof(path))) {
- result.path = "/init";
- } else {
- result.path = std::string(path, path_len);
+ // Stat "/proc/self/exe" instead of executable_path because
+ // the executable could be unlinked by this point and it should
+ // not cause a crash (see http://b/31084669)
+ if (TEMP_FAILURE_RETRY(stat(exe_path, &result.file_stat) == -1)) {
+ // Fallback to argv[0] for the case where /proc isn't available
+ if (TEMP_FAILURE_RETRY(stat(arg_path, &result.file_stat) == -1)) {
+ async_safe_fatal("unable to stat either \"/proc/self/exe\" or \"%s\": %s",
+ arg_path, strerror(errno));
}
+ exe_path = arg_path;
+ }
+
+ // Path might be a symlink
+ char sym_path[PATH_MAX];
+ ssize_t sym_path_len = readlink(exe_path, sym_path, sizeof(sym_path));
+ if (sym_path_len > 0 && sym_path_len < static_cast<ssize_t>(sizeof(sym_path))) {
+ result.path = std::string(sym_path, sym_path_len);
} else {
- // Stat "/proc/self/exe" instead of executable_path because
- // the executable could be unlinked by this point and it should
- // not cause a crash (see http://b/31084669)
- if (TEMP_FAILURE_RETRY(stat("/proc/self/exe", &result.file_stat)) != 0) {
- async_safe_fatal("unable to stat \"/proc/self/exe\": %s", strerror(errno));
- }
- char path[PATH_MAX];
- ssize_t path_len = readlink("/proc/self/exe", path, sizeof(path));
- if (path_len == -1 || path_len >= static_cast<ssize_t>(sizeof(path))) {
- async_safe_fatal("readlink('/proc/self/exe') failed: %s", strerror(errno));
- }
- result.path = std::string(path, path_len);
+ result.path = std::string(exe_path, strlen(exe_path));
}
result.phdr = reinterpret_cast<const ElfW(Phdr)*>(getauxval(AT_PHDR));
@@ -358,7 +352,7 @@
}
const ExecutableInfo exe_info = exe_to_load ? load_executable(exe_to_load) :
- get_executable_info();
+ get_executable_info(args.argv[0]);
INFO("[ Linking executable \"%s\" ]", exe_info.path.c_str());
@@ -408,7 +402,7 @@
}
}
- __libc_init_mte(somain->phdr, somain->phnum, somain->load_bias);
+ __libc_init_mte(somain->phdr, somain->phnum, somain->load_bias, args.argv);
#endif
// Register the main executable and the linker upfront to have
diff --git a/linker/linker_namespaces.h b/linker/linker_namespaces.h
index 6817901..671e0b5 100644
--- a/linker/linker_namespaces.h
+++ b/linker/linker_namespaces.h
@@ -41,11 +41,11 @@
struct android_namespace_link_t {
public:
android_namespace_link_t(android_namespace_t* linked_namespace,
- const std::unordered_set<std::string>& shared_lib_sonames,
+ std::unordered_set<std::string> shared_lib_sonames,
bool allow_all_shared_libs)
- : linked_namespace_(linked_namespace), shared_lib_sonames_(shared_lib_sonames),
- allow_all_shared_libs_(allow_all_shared_libs)
- {}
+ : linked_namespace_(linked_namespace),
+ shared_lib_sonames_(std::move(shared_lib_sonames)),
+ allow_all_shared_libs_(allow_all_shared_libs) {}
android_namespace_t* linked_namespace() const {
return linked_namespace_;
@@ -127,10 +127,10 @@
return linked_namespaces_;
}
void add_linked_namespace(android_namespace_t* linked_namespace,
- const std::unordered_set<std::string>& shared_lib_sonames,
+ std::unordered_set<std::string> shared_lib_sonames,
bool allow_all_shared_libs) {
- linked_namespaces_.push_back(
- android_namespace_link_t(linked_namespace, shared_lib_sonames, allow_all_shared_libs));
+ linked_namespaces_.emplace_back(linked_namespace, std::move(shared_lib_sonames),
+ allow_all_shared_libs);
}
void add_soinfo(soinfo* si) {
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 60fd776..73cfced 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -51,6 +51,8 @@
return EM_AARCH64;
#elif defined(__i386__)
return EM_386;
+#elif defined(__riscv)
+ return EM_RISCV;
#elif defined(__x86_64__)
return EM_X86_64;
#endif
@@ -173,7 +175,8 @@
if (did_load_) {
return true;
}
- if (ReserveAddressSpace(address_space) && LoadSegments() && FindPhdr() &&
+ bool reserveSuccess = ReserveAddressSpace(address_space);
+ if (reserveSuccess && LoadSegments() && FindPhdr() &&
FindGnuPropertySection()) {
did_load_ = true;
#if defined(__aarch64__)
@@ -184,6 +187,13 @@
}
#endif
}
+ if (reserveSuccess && !did_load_) {
+ if (load_start_ != nullptr && load_size_ != 0) {
+ if (!mapped_by_caller_) {
+ munmap(load_start_, load_size_);
+ }
+ }
+ }
return did_load_;
}
@@ -214,6 +224,7 @@
if (em == EM_386) return "EM_386";
if (em == EM_AARCH64) return "EM_AARCH64";
if (em == EM_ARM) return "EM_ARM";
+ if (em == EM_RISCV) return "EM_RISCV";
if (em == EM_X86_64) return "EM_X86_64";
return "EM_???";
}
diff --git a/linker/linker_relocate.cpp b/linker/linker_relocate.cpp
index c7c7bfb..952dade 100644
--- a/linker/linker_relocate.cpp
+++ b/linker/linker_relocate.cpp
@@ -49,7 +49,9 @@
case R_GENERIC_TLS_DTPMOD:
case R_GENERIC_TLS_DTPREL:
case R_GENERIC_TLS_TPREL:
+#if defined(R_GENERIC_TLSDESC)
case R_GENERIC_TLSDESC:
+#endif
return true;
default:
return false;
@@ -426,7 +428,7 @@
case R_GENERIC_TLS_DTPREL:
count_relocation_if<IsGeneral>(kRelocRelative);
{
- const ElfW(Addr) result = sym_addr + get_addend_rel();
+ const ElfW(Addr) result = sym_addr + get_addend_rel() - TLS_DTV_OFFSET;
trace_reloc("RELO TLS_DTPREL %16p <- %16p %s",
rel_target, reinterpret_cast<void*>(result), sym_name);
*static_cast<ElfW(Addr)*>(rel_target) = result;
diff --git a/linker/linker_relocs.h b/linker/linker_relocs.h
index 93d899e..37a7880 100644
--- a/linker/linker_relocs.h
+++ b/linker/linker_relocs.h
@@ -73,6 +73,20 @@
#define R_GENERIC_TLS_TPREL R_386_TLS_TPOFF
#define R_GENERIC_TLSDESC R_386_TLS_DESC
+#elif defined (__riscv)
+
+#define R_GENERIC_JUMP_SLOT R_RISCV_JUMP_SLOT
+#define R_GENERIC_ABSOLUTE R_RISCV_64
+#define R_GENERIC_GLOB_DAT R_RISCV_64
+#define R_GENERIC_RELATIVE R_RISCV_RELATIVE
+#define R_GENERIC_IRELATIVE R_RISCV_IRELATIVE
+#define R_GENERIC_COPY R_RISCV_COPY
+#define R_GENERIC_TLS_DTPMOD R_RISCV_TLS_DTPMOD64
+#define R_GENERIC_TLS_DTPREL R_RISCV_TLS_DTPREL64
+#define R_GENERIC_TLS_TPREL R_RISCV_TLS_TPREL64
+// TODO: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/94
+// #define R_GENERIC_TLSDESC R_RISCV_TLS_DESC
+
#elif defined (__x86_64__)
#define R_GENERIC_JUMP_SLOT R_X86_64_JUMP_SLOT
diff --git a/linker/linker_transparent_hugepage_support.cpp b/linker/linker_transparent_hugepage_support.cpp
index 65ba4cd..0631577 100644
--- a/linker/linker_transparent_hugepage_support.cpp
+++ b/linker/linker_transparent_hugepage_support.cpp
@@ -39,6 +39,6 @@
return false;
}
return enabled.find("[never]") == std::string::npos;
- };
+ }();
return transparent_hugepages_supported;
}
diff --git a/tests/Android.bp b/tests/Android.bp
index a54ffb8..1be1ec3 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -66,18 +66,20 @@
"libcutils_headers",
"gwp_asan_headers"
],
- // Ensure that the tests exercise shadow call stack support and
- // the hint space PAC/BTI instructions.
+ stl: "libc++",
+
+ // Ensure that the tests exercise shadow call stack support.
+ // We don't use `scs: true` here because that would give us a second
+ // variant of this library where we actually just want to say "this
+ // library should always be built this way".
arch: {
arm64: {
- cflags: [
- "-fsanitize=shadow-call-stack",
- // Disable this option for now: see b/151372823
- //"-mbranch-protection=standard",
- ],
+ cflags: ["-fsanitize=shadow-call-stack"],
+ },
+ riscv64: {
+ cflags: ["-fsanitize=shadow-call-stack"],
},
},
- stl: "libc++",
sanitize: {
address: false,
},
@@ -105,6 +107,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
},
@@ -128,6 +133,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
},
@@ -151,6 +159,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
},
@@ -174,6 +185,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
},
@@ -197,6 +211,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
},
@@ -220,6 +237,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
},
@@ -243,6 +263,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
},
@@ -266,6 +289,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
},
@@ -289,6 +315,9 @@
arm64: {
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
},
+ riscv64: {
+ srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so"],
+ },
x86: {
srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
},
@@ -331,8 +360,8 @@
cc_test_library {
name: "clang_diagnostic_tests",
cflags: [
- "-Xclang",
- "-verify",
+ "-Xclang",
+ "-verify",
],
srcs: ["sys_ioctl_diag_test.cpp"],
}
@@ -340,6 +369,9 @@
cc_test_library {
name: "libBionicStandardTests",
defaults: ["bionic_tests_defaults"],
+ tidy_disabled_srcs: [
+ "malloc_test.cpp", // timed out with clang-tidy, and too many warnings
+ ],
srcs: [
"__aeabi_read_tp_test.cpp",
"__cxa_atexit_test.cpp",
@@ -393,6 +425,7 @@
"math_test.cpp",
"math_force_long_double_test.cpp",
"membarrier_test.cpp",
+ "memtag_stack_test.cpp",
"mntent_test.cpp",
"mte_test.cpp",
"netdb_test.cpp",
@@ -479,7 +512,9 @@
"uchar_test.cpp",
"unistd_nofortify_test.cpp",
"unistd_test.cpp",
+ "utils.cpp",
"utmp_test.cpp",
+ "utmpx_test.cpp",
"wchar_test.cpp",
"wctype_test.cpp",
],
@@ -506,6 +541,10 @@
// unsupported relocation type 37
"ifunc_test.cpp",
+
+ // musl #defines utmp to utmpx, causing a collision with
+ // utmpx_test.cpp
+ "utmp_test.cpp",
],
},
},
@@ -598,18 +637,6 @@
],
}
-cc_test_library {
- name: "libBionicGwpAsanTests",
- defaults: ["bionic_tests_defaults"],
- srcs: [
- "gwp_asan_test.cpp",
- ],
- include_dirs: [
- "bionic/libc",
- ],
- static_libs: ["libbase"],
-}
-
// -----------------------------------------------------------------------------
// Fortify tests.
// -----------------------------------------------------------------------------
@@ -641,9 +668,6 @@
],
tidy: false,
target: {
- host: {
- clang_cflags: ["-D__clang__"],
- },
musl: {
// Musl doesn't have fortify
enabled: false,
@@ -727,7 +751,7 @@
tidy: false,
target: {
host: {
- clang_cflags: ["-D__clang__"],
+ cflags: ["-D__clang__"],
},
},
}
@@ -762,7 +786,6 @@
},
}
-
// -----------------------------------------------------------------------------
// Library of all tests (excluding the dynamic linker tests).
// -----------------------------------------------------------------------------
@@ -774,7 +797,6 @@
"libBionicStandardTests",
"libBionicElfTlsTests",
"libBionicFramePointerTests",
- "libBionicGwpAsanTests",
"libfortify1-tests-clang",
"libfortify1-new-tests-clang",
"libfortify2-tests-clang",
@@ -876,6 +898,7 @@
"__cxa_thread_atexit_test.cpp",
"gtest_globals.cpp",
"gtest_main.cpp",
+ "gwp_asan_test.cpp",
"thread_local_test.cpp",
],
@@ -928,6 +951,8 @@
"heap_tagging_static_disabled_helper",
"heap_tagging_static_sync_helper",
"heap_tagging_sync_helper",
+ "stack_tagging_helper",
+ "stack_tagging_static_helper",
"ld_config_test_helper",
"ld_config_test_helper_lib1",
"ld_config_test_helper_lib2",
@@ -1091,6 +1116,30 @@
}
cc_test {
+ name: "hwasan_test",
+ enabled: false,
+ // This does not use bionic_tests_defaults because it is not supported on
+ // host.
+ arch: {
+ arm64: {
+ enabled: true,
+ },
+ },
+ sanitize: {
+ hwaddress: true,
+ },
+ srcs: [
+ "hwasan_test.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ ],
+ data_libs: ["libtest_simple_hwasan", "libtest_simple_hwasan_nohwasan"],
+ header_libs: ["bionic_libc_platform_headers"],
+ test_suites: ["device-tests"],
+}
+
+cc_test {
name: "bionic-stress-tests",
defaults: [
"bionic_tests_defaults",
@@ -1176,6 +1225,8 @@
"heap_tagging_static_disabled_helper",
"heap_tagging_static_sync_helper",
"heap_tagging_sync_helper",
+ "stack_tagging_helper",
+ "stack_tagging_static_helper",
],
}
diff --git a/tests/NOTICE b/tests/NOTICE
index 8c3483c..cc99d20 100644
--- a/tests/NOTICE
+++ b/tests/NOTICE
@@ -383,6 +383,50 @@
-------------------------------------------------------------------
Copyright (C) 2022 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-------------------------------------------------------------------
+
+Copyright (C) 2022 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (C) 2023 The Android Open Source Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/tests/__cxa_atexit_test.cpp b/tests/__cxa_atexit_test.cpp
index 6a122d1..9f73261 100644
--- a/tests/__cxa_atexit_test.cpp
+++ b/tests/__cxa_atexit_test.cpp
@@ -26,19 +26,30 @@
* SUCH DAMAGE.
*/
-#include <cxxabi.h>
#include <gtest/gtest.h>
+extern "C" {
+int __cxa_atexit(void (*func)(void*), void* arg, void* dso);
+
+// TODO(b/175635923). __cxa_finalize's return type should actually be "void",
+// but it is declared "int" here instead to be compatible with the declaration
+// in an old version of cxxabi.h, which is included indirectly. The declarations
+// of __cxa_atexit and __cxa_finalize are removed from newer versions of
+// cxxabi.h, so once libc++ is updated, this return type should be changed to
+// "void".
+int __cxa_finalize(void* dso);
+}
+
TEST(__cxa_atexit, simple) {
int counter = 0;
- __cxxabiv1::__cxa_atexit([](void* arg) { ++*static_cast<int*>(arg); }, &counter, &counter);
+ __cxa_atexit([](void* arg) { ++*static_cast<int*>(arg); }, &counter, &counter);
- __cxxabiv1::__cxa_finalize(&counter);
+ __cxa_finalize(&counter);
ASSERT_EQ(counter, 1);
// The handler won't be called twice.
- __cxxabiv1::__cxa_finalize(&counter);
+ __cxa_finalize(&counter);
ASSERT_EQ(counter, 1);
}
@@ -54,16 +65,16 @@
};
for (int i = 0; i < 500; ++i) {
- __cxxabiv1::__cxa_atexit(append_to_actual, new int{i}, &handles[i % 2]);
+ __cxa_atexit(append_to_actual, new int{i}, &handles[i % 2]);
}
- __cxxabiv1::__cxa_finalize(&handles[0]);
+ __cxa_finalize(&handles[0]);
for (int i = 500; i < 750; ++i) {
- __cxxabiv1::__cxa_atexit(append_to_actual, new int{i}, &handles[1]);
+ __cxa_atexit(append_to_actual, new int{i}, &handles[1]);
}
- __cxxabiv1::__cxa_finalize(&handles[1]);
+ __cxa_finalize(&handles[1]);
std::vector<int> expected;
for (int i = 498; i >= 0; i -= 2) expected.push_back(i);
diff --git a/tests/__cxa_demangle_test.cpp b/tests/__cxa_demangle_test.cpp
index 4628a61..d400619 100644
--- a/tests/__cxa_demangle_test.cpp
+++ b/tests/__cxa_demangle_test.cpp
@@ -29,11 +29,9 @@
#include <cxxabi.h>
#include <gtest/gtest.h>
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
TEST(__cxa_demangle, cxa_demangle_fuzz_152588929) {
#if defined(__aarch64__)
- char* p = __cxa_demangle("1\006ILeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", 0, 0, 0);
+ char* p = abi::__cxa_demangle("1\006ILeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", 0, 0, 0);
ASSERT_STREQ("\x6<-0x1.cecececececececececececececep+11983", p);
free(p);
#endif
@@ -41,7 +39,7 @@
TEST(__cxa_demangle, DISABLED_cxa_demangle_fuzz_167977068) {
#if defined(__aarch64__)
- char* p = __cxa_demangle("DTLeeeeeeeeeeeeeeeeeeeeeeeeeEEEEeeEEEE", 0, 0, 0);
+ char* p = abi::__cxa_demangle("DTLeeeeeeeeeeeeeeeeeeeeeeeeeEEEEeeEEEE", 0, 0, 0);
ASSERT_EQ(nullptr, p) << p;
free(p);
#endif
diff --git a/tests/async_safe_test.cpp b/tests/async_safe_test.cpp
index f52387e..dc4db07 100644
--- a/tests/async_safe_test.cpp
+++ b/tests/async_safe_test.cpp
@@ -16,6 +16,8 @@
#include <gtest/gtest.h>
+#include <errno.h>
+
#if defined(__BIONIC__)
#include <async_safe/log.h>
#endif // __BIONIC__
@@ -227,3 +229,19 @@
GTEST_SKIP() << "bionic-only test";
#endif // __BIONIC__
}
+
+// Verify that using %m is never cut off.
+TEST(async_safe_format_buffer, percent_m_fits_in_buffer) {
+#if defined(__BIONIC__)
+ for (int i = 0; i < 256; i++) {
+ errno = i;
+ char async_buf[256];
+ async_safe_format_buffer(async_buf, sizeof(async_buf), "%m");
+ char strerror_buf[1024];
+ strerror_r(errno, strerror_buf, sizeof(strerror_buf));
+ ASSERT_STREQ(strerror_buf, async_buf);
+ }
+#else // __BIONIC__
+ GTEST_SKIP() << "bionic-only test";
+#endif // __BIONIC__
+}
diff --git a/tests/clang_fortify_tests.cpp b/tests/clang_fortify_tests.cpp
index 40cb83f..544af43 100644
--- a/tests/clang_fortify_tests.cpp
+++ b/tests/clang_fortify_tests.cpp
@@ -387,6 +387,8 @@
}
static void testStdlib() {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
char path_buffer[PATH_MAX - 1];
// expected-warning@+2{{ignoring return value of function}}
// expected-error@+1{{must be NULL or a pointer to a buffer with >= PATH_MAX bytes}}
@@ -401,6 +403,7 @@
// expected-warning@+2{{ignoring return value of function}}
// expected-error@+1{{flipped arguments?}}
realpath(nullptr, nullptr);
+#pragma clang diagnostic pop
}
} // namespace compilation_tests
#endif
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index a61586b..2f3e905 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -32,9 +32,10 @@
#include <regex>
#include <string>
-#include "gtest_globals.h"
#include <android-base/file.h>
+#include <android-base/macros.h>
#include <android-base/test_utils.h>
+#include "gtest_globals.h"
#include "utils.h"
extern "C" int main_global_default_serial() {
@@ -84,22 +85,13 @@
#if defined(__BIONIC__)
#if defined(__LP64__)
- static constexpr const char* kPathToLinker = "/system/bin/linker64";
+#define LINKER_NAME "linker64"
#else
- static constexpr const char* kPathToLinker = "/system/bin/linker";
+#define LINKER_NAME "linker"
#endif
-
-#if defined (__aarch64__)
- static constexpr const char* kAlternatePathToLinker = "/system/bin/arm64/linker64";
-#elif defined (__arm__)
- static constexpr const char* kAlternatePathToLinker = "/system/bin/arm/linker";
-#elif defined (__x86_64__)
- static constexpr const char* kAlternatePathToLinker = "/system/bin/x86_64/linker64";
-#elif defined (__i386__)
- static constexpr const char* kAlternatePathToLinker = "/system/bin/x86/linker";
-#else
-#error "Unknown architecture"
-#endif
+static constexpr const char* kPathToLinker = "/system/bin/" LINKER_NAME;
+static constexpr const char* kAlternatePathToLinker = "/system/bin/" ABI_STRING "/" LINKER_NAME;
+#undef LINKER_NAME
const char* PathToLinker() {
// On the systems with emulated architecture linker would be of different
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 940e726..b68ee7b 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -33,6 +33,7 @@
#include <thread>
#include <android-base/file.h>
+#include <android-base/macros.h>
#include <android-base/scopeguard.h>
#include "gtest_globals.h"
@@ -888,11 +889,14 @@
void* sym;
#if defined(__BIONIC__) && !defined(__LP64__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
// RTLD_DEFAULT in lp32 bionic is not (void*)0
// so it can be distinguished from the NULL handle.
sym = dlsym(nullptr, "test");
ASSERT_TRUE(sym == nullptr);
ASSERT_STREQ("dlsym failed: library handle is null", dlerror());
+#pragma clang diagnostic pop
#endif
// Symbol that doesn't exist.
@@ -966,20 +970,16 @@
#endif
}
-#if defined (__aarch64__)
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib64/arm64/"
-#elif defined (__arm__)
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/arm/"
-#elif defined (__i386__)
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib/x86/"
-#elif defined (__x86_64__)
-#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib64/x86_64/"
+#define ALTERNATE_PATH_TO_SYSTEM_LIB "/system/lib64/" ABI_STRING "/"
+#if __has_feature(hwaddress_sanitizer)
+#define PATH_TO_LIBC PATH_TO_SYSTEM_LIB "hwasan/libc.so"
+#define PATH_TO_BOOTSTRAP_LIBC PATH_TO_SYSTEM_LIB "bootstrap/hwasan/libc.so"
+#define ALTERNATE_PATH_TO_LIBC ALTERNATE_PATH_TO_SYSTEM_LIB "hwasan/libc.so"
#else
-#error "Unknown architecture"
-#endif
#define PATH_TO_LIBC PATH_TO_SYSTEM_LIB "libc.so"
#define PATH_TO_BOOTSTRAP_LIBC PATH_TO_SYSTEM_LIB "bootstrap/libc.so"
#define ALTERNATE_PATH_TO_LIBC ALTERNATE_PATH_TO_SYSTEM_LIB "libc.so"
+#endif
TEST(dlfcn, dladdr_libc) {
#if defined(__GLIBC__)
@@ -987,24 +987,25 @@
#endif
Dl_info info;
- void* addr = reinterpret_cast<void*>(puts); // well-known libc function
+ void* addr = reinterpret_cast<void*>(puts); // An arbitrary libc function.
ASSERT_TRUE(dladdr(addr, &info) != 0);
- char libc_realpath[PATH_MAX];
-
// Check if libc is in canonical path or in alternate path.
+ const char* expected_path;
if (strncmp(ALTERNATE_PATH_TO_SYSTEM_LIB,
info.dli_fname,
sizeof(ALTERNATE_PATH_TO_SYSTEM_LIB) - 1) == 0) {
// Platform with emulated architecture. Symlink on ARC++.
- ASSERT_TRUE(realpath(ALTERNATE_PATH_TO_LIBC, libc_realpath) == libc_realpath);
+ expected_path = ALTERNATE_PATH_TO_LIBC;
} else if (strncmp(PATH_TO_BOOTSTRAP_LIBC, info.dli_fname,
sizeof(PATH_TO_BOOTSTRAP_LIBC) - 1) == 0) {
- ASSERT_TRUE(realpath(PATH_TO_BOOTSTRAP_LIBC, libc_realpath) == libc_realpath);
+ expected_path = PATH_TO_BOOTSTRAP_LIBC;
} else {
// /system/lib is symlink when this test is executed on host.
- ASSERT_TRUE(realpath(PATH_TO_LIBC, libc_realpath) == libc_realpath);
+ expected_path = PATH_TO_LIBC;
}
+ char libc_realpath[PATH_MAX];
+ ASSERT_TRUE(realpath(expected_path, libc_realpath) != nullptr) << strerror(errno);
ASSERT_STREQ(libc_realpath, info.dli_fname);
// TODO: add check for dfi_fbase
@@ -1017,9 +1018,12 @@
dlerror(); // Clear any pending errors.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
// No symbol corresponding to NULL.
ASSERT_EQ(dladdr(nullptr, &info), 0); // Zero on error, non-zero on success.
ASSERT_TRUE(dlerror() == nullptr); // dladdr(3) doesn't set dlerror(3).
+#pragma clang diagnostic pop
// No symbol corresponding to a stack address.
ASSERT_EQ(dladdr(&info, &info), 0); // Zero on error, non-zero on success.
@@ -1655,6 +1659,9 @@
}
TEST(dlfcn, dlopen_invalid_local_tls) {
+#if defined(__riscv)
+ // This is a test for bad gold behavior, and gold doesn't support riscv64.
+#else
const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-local-tls.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
@@ -1667,6 +1674,7 @@
std::string expected_dlerror = std::string("dlopen failed: unexpected TLS reference to ") +
referent + " in \"" + libpath + "\"";
ASSERT_SUBSTR(expected_dlerror.c_str(), dlerror());
+#endif
}
TEST(dlfcn, dlopen_df_1_global) {
diff --git a/tests/elftls_dl_test.cpp b/tests/elftls_dl_test.cpp
index 82ccf82..56736e7 100644
--- a/tests/elftls_dl_test.cpp
+++ b/tests/elftls_dl_test.cpp
@@ -30,6 +30,7 @@
#include <link.h>
#include <android-base/file.h>
+#include <android-base/test_utils.h>
#include <gtest/gtest.h>
#include <thread>
@@ -153,6 +154,7 @@
}
TEST(elftls_dl, dtv_resize) {
+ SKIP_WITH_HWASAN; // TODO(b/271243811): Fix for new toolchain
#if defined(__BIONIC__)
#define LOAD_LIB(soname) ({ \
auto lib = dlopen(soname, RTLD_LOCAL | RTLD_NOW); \
diff --git a/tests/fcntl_test.cpp b/tests/fcntl_test.cpp
index d50a438..f9bfb30 100644
--- a/tests/fcntl_test.cpp
+++ b/tests/fcntl_test.cpp
@@ -23,6 +23,7 @@
#include <sys/vfs.h>
#include <android-base/file.h>
+#include <android-base/silent_death_test.h>
#include <android-base/stringprintf.h>
// Glibc v2.19 doesn't include these in fcntl.h so host builds will fail without.
@@ -33,6 +34,8 @@
#include <linux/magic.h>
#endif
+using fcntl_DeathTest = SilentDeathTest;
+
TEST(fcntl, fcntl_smoke) {
int fd = open("/proc/version", O_RDONLY);
ASSERT_TRUE(fd != -1);
@@ -356,3 +359,7 @@
ASSERT_EQ(0, close(fd));
#endif
}
+
+TEST(fcntl_DeathTest, fcntl_F_SETFD) {
+ EXPECT_DEATH(fcntl(0, F_SETFD, O_NONBLOCK), "FD_CLOEXEC");
+}
diff --git a/tests/fenv_test.cpp b/tests/fenv_test.cpp
index c5b5eca..9cf9d98 100644
--- a/tests/fenv_test.cpp
+++ b/tests/fenv_test.cpp
@@ -117,6 +117,21 @@
ASSERT_EQ(FE_OVERFLOW, fetestexcept(FE_ALL_EXCEPT));
}
+TEST(fenv, fegetenv_fesetenv_rounding_mode) {
+ // Test that fegetenv()/fesetenv() includes the rounding mode.
+ fesetround(FE_DOWNWARD);
+ ASSERT_EQ(FE_DOWNWARD, fegetround());
+
+ fenv_t env;
+ fegetenv(&env);
+
+ fesetround(FE_UPWARD);
+ ASSERT_EQ(FE_UPWARD, fegetround());
+
+ fesetenv(&env);
+ ASSERT_EQ(FE_DOWNWARD, fegetround());
+}
+
TEST(fenv, feholdexcept_feupdateenv) {
// Set FE_OVERFLOW only.
feclearexcept(FE_ALL_EXCEPT);
@@ -187,9 +202,10 @@
TEST(fenv, feenableexcept_fegetexcept) {
#if !defined(ANDROID_HOST_MUSL)
-#if defined(__aarch64__) || defined(__arm__)
- // ARM doesn't support this. They used to if you go back far enough, but it was removed in
- // the Cortex-A8 between r3p1 and r3p2.
+#if defined(__aarch64__) || defined(__arm__) || defined(__riscv)
+ // ARM and RISC-V don't support hardware trapping of floating point
+ // exceptions. ARM used to if you go back far enough, but it was
+ // removed in the Cortex-A8 between r3p1 and r3p2. RISC-V never has.
ASSERT_EQ(-1, feenableexcept(FE_INVALID));
ASSERT_EQ(0, fegetexcept());
ASSERT_EQ(-1, feenableexcept(FE_DIVBYZERO));
@@ -200,8 +216,10 @@
ASSERT_EQ(0, fegetexcept());
ASSERT_EQ(-1, feenableexcept(FE_INEXACT));
ASSERT_EQ(0, fegetexcept());
+#if defined(_FE_DENORMAL) // riscv64 doesn't support this.
ASSERT_EQ(-1, feenableexcept(FE_DENORMAL));
ASSERT_EQ(0, fegetexcept());
+#endif
#else
// We can't recover from SIGFPE, so sacrifice a child...
pid_t pid = fork();
diff --git a/tests/gwp_asan_test.cpp b/tests/gwp_asan_test.cpp
index 23fb8b9..c31f48c 100644
--- a/tests/gwp_asan_test.cpp
+++ b/tests/gwp_asan_test.cpp
@@ -28,27 +28,21 @@
#include <gtest/gtest.h>
#include <stdio.h>
+#include <sys/file.h>
#include <string>
#if defined(__BIONIC__)
+#include "android-base/file.h"
+#include "android-base/test_utils.h"
#include "gwp_asan/options.h"
#include "platform/bionic/malloc.h"
+#include "sys/system_properties.h"
#include "utils.h"
-void RunGwpAsanTest(const char* test_name) {
- ExecTestHelper eh;
- eh.SetEnv({"GWP_ASAN_SAMPLE_RATE=1", "GWP_ASAN_PROCESS_SAMPLING=1", "GWP_ASAN_MAX_ALLOCS=40000",
- nullptr});
- std::string filter_arg = "--gtest_filter=";
- filter_arg += test_name;
- std::string exec(testing::internal::GetArgvs()[0]);
- eh.SetArgs({exec.c_str(), "--gtest_also_run_disabled_tests", filter_arg.c_str(), nullptr});
- eh.Run([&]() { execve(exec.c_str(), eh.GetArgs(), eh.GetEnv()); },
- /* expected_exit_status */ 0,
- // |expected_output_regex|, ensure at least one test ran:
- R"(\[ PASSED \] [1-9]+0? test)");
-}
+// basename is a mess, use gnu basename explicitly to avoid the need for string
+// mutation.
+extern "C" const char* __gnu_basename(const char* path);
// GWP-ASan tests can run much slower, especially when combined with HWASan.
// Triple the deadline to avoid flakes (b/238585984).
@@ -64,7 +58,210 @@
// the torture mode is is generally 40,000, so that svelte devices don't
// explode, as this uses ~163MiB RAM (4KiB per live allocation).
TEST(gwp_asan_integration, malloc_tests_under_torture) {
+ // Do not override HWASan with GWP ASan.
+ SKIP_WITH_HWASAN;
+
RunGwpAsanTest("malloc.*:-malloc.mallinfo*");
}
+class SyspropRestorer {
+ private:
+ std::vector<std::pair<std::string, std::string>> props_to_restore_;
+ // System properties are global for a device, so the tests that mutate the
+ // GWP-ASan system properties must be run mutually exclusive. Because
+ // bionic-unit-tests is run in an isolated gtest fashion (each test is run in
+ // its own process), we have to use flocks to synchronise between tests.
+ int flock_fd_;
+
+ public:
+ SyspropRestorer() {
+ std::string path = testing::internal::GetArgvs()[0];
+ flock_fd_ = open(path.c_str(), O_RDONLY);
+ EXPECT_NE(flock_fd_, -1) << "failed to open self for a flock";
+ EXPECT_NE(flock(flock_fd_, LOCK_EX), -1) << "failed to flock myself";
+
+ const char* basename = __gnu_basename(path.c_str());
+ std::vector<std::string> props = {
+ std::string("libc.debug.gwp_asan.sample_rate.") + basename,
+ std::string("libc.debug.gwp_asan.process_sampling.") + basename,
+ std::string("libc.debug.gwp_asan.max_allocs.") + basename,
+ "libc.debug.gwp_asan.sample_rate.system_default",
+ "libc.debug.gwp_asan.sample_rate.app_default",
+ "libc.debug.gwp_asan.process_sampling.system_default",
+ "libc.debug.gwp_asan.process_sampling.app_default",
+ "libc.debug.gwp_asan.max_allocs.system_default",
+ "libc.debug.gwp_asan.max_allocs.app_default",
+ };
+
+ size_t base_props_size = props.size();
+ for (size_t i = 0; i < base_props_size; ++i) {
+ props.push_back("persist." + props[i]);
+ }
+
+ std::string reset_log;
+
+ for (const std::string& prop : props) {
+ std::string value = GetSysprop(prop);
+ props_to_restore_.emplace_back(prop, value);
+ if (!value.empty()) {
+ __system_property_set(prop.c_str(), "");
+ }
+ }
+ }
+
+ ~SyspropRestorer() {
+ for (const auto& kv : props_to_restore_) {
+ if (kv.second != GetSysprop(kv.first)) {
+ __system_property_set(kv.first.c_str(), kv.second.c_str());
+ }
+ }
+ close(flock_fd_);
+ }
+
+ static std::string GetSysprop(const std::string& name) {
+ std::string value;
+ const prop_info* pi = __system_property_find(name.c_str());
+ if (pi == nullptr) return value;
+ __system_property_read_callback(
+ pi,
+ [](void* cookie, const char* /* name */, const char* value, uint32_t /* serial */) {
+ std::string* v = static_cast<std::string*>(cookie);
+ *v = value;
+ },
+ &value);
+ return value;
+ }
+};
+
+TEST(gwp_asan_integration, DISABLED_assert_gwp_asan_enabled) {
+ std::string maps;
+ EXPECT_TRUE(android::base::ReadFileToString("/proc/self/maps", &maps));
+ EXPECT_TRUE(maps.find("GWP-ASan") != std::string::npos) << maps;
+
+ volatile int* x = new int;
+ delete x;
+ EXPECT_DEATH({ *x = 7; }, "");
+}
+
+// A weaker version of the above tests, only checking that GWP-ASan is enabled
+// for any pointer, not *our* pointer. This allows us to test the system_default
+// sysprops without potentially OOM-ing other random processes:
+// b/273904016#comment5
+TEST(gwp_asan_integration, DISABLED_assert_gwp_asan_enabled_weaker) {
+ std::string maps;
+ EXPECT_TRUE(android::base::ReadFileToString("/proc/self/maps", &maps));
+ EXPECT_TRUE(maps.find("GWP-ASan") != std::string::npos) << maps;
+}
+
+TEST(gwp_asan_integration, DISABLED_assert_gwp_asan_disabled) {
+ std::string maps;
+ EXPECT_TRUE(android::base::ReadFileToString("/proc/self/maps", &maps));
+ EXPECT_TRUE(maps.find("GWP-ASan") == std::string::npos);
+}
+
+TEST(gwp_asan_integration, sysprops_program_specific) {
+ // Do not override HWASan with GWP ASan.
+ SKIP_WITH_HWASAN;
+
+ SyspropRestorer restorer;
+
+ std::string path = testing::internal::GetArgvs()[0];
+ const char* basename = __gnu_basename(path.c_str());
+ __system_property_set((std::string("libc.debug.gwp_asan.sample_rate.") + basename).c_str(), "1");
+ __system_property_set((std::string("libc.debug.gwp_asan.process_sampling.") + basename).c_str(),
+ "1");
+ __system_property_set((std::string("libc.debug.gwp_asan.max_allocs.") + basename).c_str(),
+ "40000");
+
+ RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
+}
+
+TEST(gwp_asan_integration, sysprops_persist_program_specific) {
+ // Do not override HWASan with GWP ASan.
+ SKIP_WITH_HWASAN;
+
+ SyspropRestorer restorer;
+
+ std::string path = testing::internal::GetArgvs()[0];
+ const char* basename = __gnu_basename(path.c_str());
+ __system_property_set(
+ (std::string("persist.libc.debug.gwp_asan.sample_rate.") + basename).c_str(), "1");
+ __system_property_set(
+ (std::string("persist.libc.debug.gwp_asan.process_sampling.") + basename).c_str(), "1");
+ __system_property_set((std::string("persist.libc.debug.gwp_asan.max_allocs.") + basename).c_str(),
+ "40000");
+
+ RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
+}
+
+TEST(gwp_asan_integration, sysprops_non_persist_overrides_persist) {
+ // Do not override HWASan with GWP ASan.
+ SKIP_WITH_HWASAN;
+
+ SyspropRestorer restorer;
+
+ __system_property_set("libc.debug.gwp_asan.sample_rate.system_default", "1");
+ __system_property_set("libc.debug.gwp_asan.process_sampling.system_default", "1");
+ // Note, any processes launched elsewhere on the system right now will have
+ // GWP-ASan enabled. Make sure that we only use a single slot, otherwise we
+ // could end up causing said badly-timed processes to use up to 163MiB extra
+ // penalty that 40,000 allocs would cause. See b/273904016#comment5 for more
+ // context.
+ __system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "1");
+
+ __system_property_set("persist.libc.debug.gwp_asan.sample_rate.system_default", "0");
+ __system_property_set("persist.libc.debug.gwp_asan.process_sampling.system_default", "0");
+ __system_property_set("persist.libc.debug.gwp_asan.max_allocs.system_default", "0");
+
+ RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled_weaker");
+}
+
+TEST(gwp_asan_integration, sysprops_program_specific_overrides_default) {
+ // Do not override HWASan with GWP ASan.
+ SKIP_WITH_HWASAN;
+
+ SyspropRestorer restorer;
+
+ std::string path = testing::internal::GetArgvs()[0];
+ const char* basename = __gnu_basename(path.c_str());
+ __system_property_set(
+ (std::string("persist.libc.debug.gwp_asan.sample_rate.") + basename).c_str(), "1");
+ __system_property_set(
+ (std::string("persist.libc.debug.gwp_asan.process_sampling.") + basename).c_str(), "1");
+ __system_property_set((std::string("persist.libc.debug.gwp_asan.max_allocs.") + basename).c_str(),
+ "40000");
+
+ __system_property_set("libc.debug.gwp_asan.sample_rate.system_default", "0");
+ __system_property_set("libc.debug.gwp_asan.process_sampling.system_default", "0");
+ __system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "0");
+
+ RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
+}
+
+TEST(gwp_asan_integration, sysprops_can_disable) {
+ // Do not override HWASan with GWP ASan.
+ SKIP_WITH_HWASAN;
+
+ SyspropRestorer restorer;
+
+ __system_property_set("libc.debug.gwp_asan.sample_rate.system_default", "0");
+ __system_property_set("libc.debug.gwp_asan.process_sampling.system_default", "0");
+ __system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "0");
+
+ RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_disabled");
+}
+
+TEST(gwp_asan_integration, env_overrides_sysprop) {
+ // Do not override HWASan with GWP ASan.
+ SKIP_WITH_HWASAN;
+
+ SyspropRestorer restorer;
+
+ __system_property_set("libc.debug.gwp_asan.sample_rate.system_default", "0");
+ __system_property_set("libc.debug.gwp_asan.process_sampling.system_default", "0");
+ __system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "0");
+
+ RunGwpAsanTest("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
+}
+
#endif // defined(__BIONIC__)
diff --git a/tests/headers/posix/Android.bp b/tests/headers/posix/Android.bp
index 4a20d45..0809cdb 100644
--- a/tests/headers/posix/Android.bp
+++ b/tests/headers/posix/Android.bp
@@ -33,8 +33,5 @@
darwin: {
enabled: false,
},
- musl: {
- enabled: false,
- },
},
}
diff --git a/tests/headers/posix/fcntl_h.c b/tests/headers/posix/fcntl_h.c
index a55fe89..418add0 100644
--- a/tests/headers/posix/fcntl_h.c
+++ b/tests/headers/posix/fcntl_h.c
@@ -84,7 +84,11 @@
// POSIX: "The <fcntl.h> header shall define the symbolic constants for
// file modes for use as values of mode_t as described in <sys/stat.h>."
+ // Musl only defines the file mode bits (S_IFUSR, etc.) and not the file
+ // type bits (S_IFMT, etc.).
+#if !defined(ANDROID_HOST_MUSL)
#include "sys_stat_h_mode_constants.h"
+#endif
MACRO(AT_FDCWD);
#if !defined(__BIONIC__) // See comment in "faccessat.cpp".
diff --git a/tests/headers/posix/limits_h.c b/tests/headers/posix/limits_h.c
index 143f717..7e92d81 100644
--- a/tests/headers/posix/limits_h.c
+++ b/tests/headers/posix/limits_h.c
@@ -32,15 +32,17 @@
static void limits_h() {
// These are only defined if they're constants.
-#if !defined(__BIONIC__) && !defined(__GLIBC__)
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(AIO_LISTIO_MAX);
MACRO(AIO_MAX);
#endif
-#if !defined(__BIONIC__)
+#if !defined(__BIONIC__) && !defined(ANDROID_HOST_MUSL)
MACRO(AIO_PRIO_DELTA_MAX);
#endif
#if !defined(__BIONIC__) && !defined(__GLIBC__)
MACRO(ARG_MAX);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(ATEXIT_MAX);
MACRO(CHILD_MAX);
#endif
@@ -50,14 +52,16 @@
MACRO(HOST_NAME_MAX);
MACRO(IOV_MAX);
MACRO(LOGIN_NAME_MAX);
-#if !defined(__BIONIC__) && !defined(__GLIBC__)
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(MQ_OPEN_MAX);
#endif
#if !defined(__BIONIC__)
MACRO(MQ_PRIO_MAX);
#endif
-#if !defined(__BIONIC__) && !defined(__GLIBC__)
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(OPEN_MAX);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
MACRO(PAGESIZE);
MACRO(PAGE_SIZE);
#endif
@@ -66,19 +70,25 @@
#if !defined(__BIONIC__)
MACRO(PTHREAD_STACK_MIN);
#endif
-#if !defined(__BIONIC__) && !defined(__GLIBC__)
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(PTHREAD_THREADS_MAX);
#endif
+#if !defined(ANDROID_HOST_MUSL)
MACRO(RTSIG_MAX);
+#endif
#if !defined(__BIONIC__) && !defined(__GLIBC__)
MACRO(SEM_NSEMS_MAX);
#endif
MACRO(SEM_VALUE_MAX);
-#if !defined(__BIONIC__) && !defined(__GLIBC__)
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(SIGQUEUE_MAX);
MACRO(SS_REPL_MAX);
MACRO(STREAM_MAX);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
MACRO(SYMLOOP_MAX);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(TIMER_MAX);
#endif
#if !defined(__BIONIC__)
@@ -90,10 +100,14 @@
#if !defined(__BIONIC__) && !defined(__GLIBC__)
MACRO(FILESIZEBITS);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(LINK_MAX);
#endif
+#if !defined(ANDROID_HOST_MUSL)
MACRO(MAX_CANON);
MACRO(MAX_INPUT);
+#endif
MACRO(NAME_MAX);
MACRO(PATH_MAX);
MACRO(PIPE_BUF);
@@ -104,7 +118,7 @@
MACRO(POSIX_REC_MIN_XFER_SIZE);
MACRO(POSIX_REC_XFER_ALIGN);
#endif
-#if !defined(__BIONIC__) && !defined(__GLIBC__)
+#if !defined(__BIONIC__) && !defined(__GLIBC__) && !defined(ANDROID_HOST_MUSL)
MACRO(SYMLINK_MAX);
#endif
diff --git a/tests/headers/posix/sys_stat_h.c b/tests/headers/posix/sys_stat_h.c
index b22e34f..a299426 100644
--- a/tests/headers/posix/sys_stat_h.c
+++ b/tests/headers/posix/sys_stat_h.c
@@ -69,7 +69,7 @@
STRUCT_MEMBER(struct stat, struct timespec, st_mtim);
STRUCT_MEMBER(struct stat, struct timespec, st_ctim);
#if defined(__BIONIC__)
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(__riscv)
STRUCT_MEMBER(struct stat, int, st_blksize);
#elif defined(__x86_64__)
STRUCT_MEMBER(struct stat, long, st_blksize);
diff --git a/tests/headers/posix/unistd_h.c b/tests/headers/posix/unistd_h.c
index b713f53..0b2cee5 100644
--- a/tests/headers/posix/unistd_h.c
+++ b/tests/headers/posix/unistd_h.c
@@ -51,8 +51,10 @@
MACRO(_POSIX_MESSAGE_PASSING);
MACRO(_POSIX_MONOTONIC_CLOCK);
MACRO(_POSIX_NO_TRUNC);
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_POSIX_PRIORITIZED_IO);
MACRO(_POSIX_PRIORITY_SCHEDULING);
+#endif
MACRO(_POSIX_RAW_SOCKETS);
MACRO(_POSIX_READER_WRITER_LOCKS);
MACRO(_POSIX_REALTIME_SIGNALS);
@@ -63,35 +65,51 @@
MACRO(_POSIX_SHELL);
MACRO(_POSIX_SPAWN);
MACRO(_POSIX_SPIN_LOCKS);
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_POSIX_SPORADIC_SERVER);
MACRO(_POSIX_SYNCHRONIZED_IO);
+#endif
MACRO(_POSIX_THREAD_ATTR_STACKADDR);
MACRO(_POSIX_THREAD_ATTR_STACKSIZE);
MACRO(_POSIX_THREAD_CPUTIME);
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_POSIX_THREAD_PRIO_INHERIT);
MACRO(_POSIX_THREAD_PRIO_PROTECT);
+#endif
MACRO(_POSIX_THREAD_PRIORITY_SCHEDULING);
MACRO(_POSIX_THREAD_PROCESS_SHARED);
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_POSIX_THREAD_ROBUST_PRIO_INHERIT);
MACRO(_POSIX_THREAD_ROBUST_PRIO_PROTECT);
+#endif
MACRO(_POSIX_THREAD_SAFE_FUNCTIONS);
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_POSIX_THREAD_SPORADIC_SERVER);
+#endif
MACRO(_POSIX_THREADS);
MACRO(_POSIX_TIMEOUTS);
MACRO(_POSIX_TIMERS);
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_POSIX_TYPED_MEMORY_OBJECTS);
+#endif
MACRO(_POSIX2_C_BIND);
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_POSIX2_CHAR_TERM);
MACRO(_POSIX2_LOCALEDEF);
MACRO(_POSIX2_SW_DEV);
+#endif
#if 0 // No libc I can find actually has this.
MACRO(_POSIX2_UPE);
#endif
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_XOPEN_CRYPT);
+#endif
MACRO(_XOPEN_ENH_I18N);
+#if !defined(ANDROID_HOST_MUSL)
MACRO(_XOPEN_REALTIME);
MACRO(_XOPEN_REALTIME_THREADS);
MACRO(_XOPEN_SHM);
+#endif
MACRO(_XOPEN_UNIX);
#if defined(_XOPEN_UUCP)
#if _XOPEN_UUCP != -1 && _XOPEN_UUCP != 0 && _XOPEN_UUCP != 200809L
diff --git a/tests/headers/posix/utmpx_h.c b/tests/headers/posix/utmpx_h.c
new file mode 100644
index 0000000..44dfac9
--- /dev/null
+++ b/tests/headers/posix/utmpx_h.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <utmpx.h>
+
+#include "header_checks.h"
+
+static void utmpx_h() {
+ TYPE(struct utmpx);
+ STRUCT_MEMBER_ARRAY(struct utmpx, char/*[]*/, ut_user);
+ STRUCT_MEMBER_ARRAY(struct utmpx, char/*[]*/, ut_id);
+ STRUCT_MEMBER_ARRAY(struct utmpx, char/*[]*/, ut_line);
+ STRUCT_MEMBER(struct utmpx, pid_t, ut_pid);
+ STRUCT_MEMBER(struct utmpx, short, ut_type);
+#if !defined(__GLIBC__)
+ // POSIX says struct timeval, but glibc has an anonymous struct.
+ STRUCT_MEMBER(struct utmpx, struct timeval, ut_tv);
+#endif
+
+ TYPE(pid_t);
+ TYPE(struct timeval);
+
+ MACRO(EMPTY);
+ MACRO(BOOT_TIME);
+ MACRO(OLD_TIME);
+ MACRO(NEW_TIME);
+ MACRO(USER_PROCESS);
+ MACRO(INIT_PROCESS);
+ MACRO(LOGIN_PROCESS);
+ MACRO(DEAD_PROCESS);
+
+ FUNCTION(endutxent, void (*f)(void));
+ FUNCTION(getutxent, struct utmpx* (*f)(void));
+ FUNCTION(getutxid, struct utmpx* (*f)(const struct utmpx*));
+ FUNCTION(getutxline, struct utmpx* (*f)(const struct utmpx*));
+ FUNCTION(pututxline, struct utmpx* (*f)(const struct utmpx*));
+ FUNCTION(setutxent, void (*f)(void));
+}
diff --git a/tests/heap_tagging_level_test.cpp b/tests/heap_tagging_level_test.cpp
index ae678b7..917be37 100644
--- a/tests/heap_tagging_level_test.cpp
+++ b/tests/heap_tagging_level_test.cpp
@@ -26,6 +26,7 @@
#include "SignalUtils.h"
+#include <android-base/properties.h>
#include <android-base/test_utils.h>
#include <bionic/malloc_tagged_pointers.h>
@@ -223,6 +224,9 @@
TEST_P(MemtagNoteTest, SEGV) {
#if defined(__BIONIC__) && defined(__aarch64__)
SKIP_WITH_NATIVE_BRIDGE; // http://b/242170715
+ if (android::base::GetProperty("persist.arm64.memtag.default", "") != "") {
+ GTEST_SKIP() << "not supported when overriding memtag mode with property";
+ }
// Note that we do not check running_with_hwasan() - what matters here is whether the test binary
// itself is built with HWASan.
bool withHWASAN = __has_feature(hwaddress_sanitizer);
diff --git a/tests/hwasan_test.cpp b/tests/hwasan_test.cpp
new file mode 100644
index 0000000..5c21495
--- /dev/null
+++ b/tests/hwasan_test.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dlfcn.h>
+#include <stdlib.h>
+
+#include <gtest/gtest.h>
+
+#include <android-base/silent_death_test.h>
+#include <android-base/test_utils.h>
+
+using HwasanDeathTest = SilentDeathTest;
+
+TEST_F(HwasanDeathTest, UseAfterFree) {
+ EXPECT_DEATH(
+ {
+ void* m = malloc(1);
+ volatile char* x = const_cast<volatile char*>(reinterpret_cast<char*>(m));
+ *x = 1;
+ free(m);
+ *x = 2;
+ },
+ "use-after-free");
+}
+
+TEST_F(HwasanDeathTest, OutOfBounds) {
+ EXPECT_DEATH(
+ {
+ void* m = malloc(1);
+ volatile char* x = const_cast<volatile char*>(reinterpret_cast<char*>(m));
+ x[1] = 1;
+ },
+ "buffer-overflow");
+}
+
+// Check whether dlopen of /foo/bar.so checks /foo/hwasan/bar.so first.
+TEST(HwasanTest, DlopenAbsolutePath) {
+ std::string path = android::base::GetExecutableDirectory() + "/libtest_simple_hwasan.so";
+ ASSERT_EQ(0, access(path.c_str(), F_OK)); // Verify test setup.
+ std::string hwasan_path =
+ android::base::GetExecutableDirectory() + "/hwasan/libtest_simple_hwasan.so";
+ ASSERT_EQ(0, access(hwasan_path.c_str(), F_OK)); // Verify test setup.
+
+ void* handle = dlopen(path.c_str(), RTLD_NOW);
+ ASSERT_TRUE(handle != nullptr);
+ uint32_t* compiled_with_hwasan =
+ reinterpret_cast<uint32_t*>(dlsym(handle, "dlopen_testlib_compiled_with_hwasan"));
+ EXPECT_TRUE(*compiled_with_hwasan);
+ dlclose(handle);
+}
+
+TEST(HwasanTest, IsRunningWithHWasan) {
+ EXPECT_TRUE(running_with_hwasan());
+}
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index 0046ef6..a2fbe55 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -41,6 +41,9 @@
enabled: false,
},
},
+ strip: {
+ none: true,
+ },
}
// -----------------------------------------------------------------------------
@@ -240,6 +243,38 @@
}
// -----------------------------------------------------------------------------
+// Libraries used by hwasan_test
+// -----------------------------------------------------------------------------
+cc_test_library {
+ name: "libtest_simple_hwasan",
+ arch: {
+ arm64: {
+ enabled: true,
+ },
+ },
+ sanitize: {
+ hwaddress: true,
+ },
+ relative_install_path: "hwasan",
+ enabled: false,
+ srcs: ["dlopen_testlib_simple_hwasan.cpp"],
+}
+
+cc_test_library {
+ // A weird name. This is the vanilla (non-HWASan) copy of the library that
+ // is used for the hwasan test.
+ name: "libtest_simple_hwasan_nohwasan",
+ arch: {
+ arm64: {
+ enabled: true,
+ },
+ },
+ stem: "libtest_simple_hwasan",
+ enabled: false,
+ srcs: ["dlopen_testlib_simple_hwasan.cpp"],
+}
+
+// -----------------------------------------------------------------------------
// Library used by dlext direct unload on the namespace boundary tests
// -----------------------------------------------------------------------------
cc_test_library {
@@ -1532,12 +1567,6 @@
host_supported: false,
defaults: ["bionic_testlib_defaults"],
srcs: ["relocations.cpp"],
-
- // Hack to ensure we're using llvm-objcopy because our binutils prebuilt
- // only supports the old numbers (http://b/141010852).
- strip: {
- keep_symbols: true,
- },
}
// This is the same encoding as SHT_RELR, but using OS-specific constants.
@@ -1652,6 +1681,37 @@
},
}
+cc_test {
+ name: "stack_tagging_helper",
+ defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
+ srcs: ["stack_tagging_helper.cpp"],
+ sanitize: {
+ memtag_heap: true,
+ memtag_stack: true,
+ diag: {
+ memtag_heap: true,
+ },
+ },
+ header_libs: ["bionic_libc_platform_headers"],
+ cflags: ["-fexceptions"],
+}
+
+cc_test {
+ name: "stack_tagging_static_helper",
+ defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
+ srcs: ["stack_tagging_helper.cpp"],
+ static_executable: true,
+ sanitize: {
+ memtag_heap: true,
+ memtag_stack: true,
+ diag: {
+ memtag_heap: true,
+ },
+ },
+ header_libs: ["bionic_libc_platform_headers"],
+ cflags: ["-fexceptions"],
+}
+
cc_genrule {
name: "libdlext_test_zip_zipaligned",
out: ["bionic-loader-test-libs/libdlext_test_zip/libdlext_test_zip_zipaligned.zip"],
diff --git a/libm/arm64/sqrt.S b/tests/libs/dlopen_testlib_simple_hwasan.cpp
similarity index 63%
rename from libm/arm64/sqrt.S
rename to tests/libs/dlopen_testlib_simple_hwasan.cpp
index 0659b13..b92e05f 100644
--- a/libm/arm64/sqrt.S
+++ b/tests/libs/dlopen_testlib_simple_hwasan.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,16 +14,14 @@
* limitations under the License.
*/
-#include <private/bionic_asm.h>
+#include <stdint.h>
-ENTRY(sqrt)
- fsqrt d0, d0
- ret
-END(sqrt)
+#if __has_feature(hwaddress_sanitizer)
+extern "C" uint32_t dlopen_testlib_compiled_with_hwasan = true;
+#else
+extern "C" uint32_t dlopen_testlib_compiled_with_hwasan = false;
+#endif
-ENTRY(sqrtf)
- fsqrt s0, s0
- ret
-END(sqrtf)
-
-NOTE_GNU_PROPERTY()
+extern "C" bool dlopen_testlib_simple_hwasan_func() {
+ return true;
+}
diff --git a/tests/libs/heap_tagging_helper.cpp b/tests/libs/heap_tagging_helper.cpp
index 16a8c8b..ed5601a 100644
--- a/tests/libs/heap_tagging_helper.cpp
+++ b/tests/libs/heap_tagging_helper.cpp
@@ -49,6 +49,10 @@
sa.sa_sigaction = action;
sa.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &sa, nullptr);
+ // suppress HWASan crash in logcat / tombstone.
+ struct sigaction dfl_sa = {};
+ dfl_sa.sa_handler = SIG_DFL;
+ sigaction(SIGABRT, &dfl_sa, nullptr);
std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
volatile int oob = p[-1];
diff --git a/tests/libs/stack_tagging_helper.cpp b/tests/libs/stack_tagging_helper.cpp
new file mode 100644
index 0000000..d29844d
--- /dev/null
+++ b/tests/libs/stack_tagging_helper.cpp
@@ -0,0 +1,387 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <errno.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <thread>
+
+#include <bionic/malloc.h>
+
+#include "libs_utils.h"
+
+#if defined(__aarch64__)
+
+template <typename T>
+static inline void mte_set_tag(T* p) {
+ __asm__ __volatile__(
+ ".arch_extension memtag\n"
+ "stg %[Ptr], [%[Ptr]]\n"
+ :
+ : [Ptr] "r"(p)
+ : "memory");
+}
+
+template <typename T>
+static inline T* mte_get_tag(T* p) {
+ __asm__ __volatile__(
+ ".arch_extension memtag\n"
+ "ldg %[Ptr], [%[Ptr]]\n"
+ : [Ptr] "+r"(p)
+ :
+ : "memory");
+ return p;
+}
+
+template <typename T>
+static inline T* mte_increment_tag(T* p) {
+ T* res;
+ __asm__ __volatile__(
+ ".arch_extension memtag\n"
+ "addg %[Res], %[Ptr], #0, #1\n"
+ : [Res] "=r"(res)
+ : [Ptr] "r"(p)
+ : "memory");
+ return res;
+}
+
+constexpr size_t kStackAllocationSize = 128 * 1024;
+
+// Prevent optimizations.
+volatile void* sink;
+
+enum struct ChildAction { Exit, Execve, Execl };
+
+// Either execve or _exit, transferring control back to parent.
+__attribute__((no_sanitize("memtag"), optnone, noinline)) void vfork_child2(ChildAction action,
+ void* fp_parent) {
+ // Make sure that the buffer in the caller has not been optimized out.
+ void* fp = __builtin_frame_address(0);
+ CHECK(reinterpret_cast<uintptr_t>(fp_parent) - reinterpret_cast<uintptr_t>(fp) >=
+ kStackAllocationSize);
+ if (action == ChildAction::Execve) {
+ const char* argv[] = {"/system/bin/true", nullptr};
+ const char* envp[] = {nullptr};
+ execve("/system/bin/true", const_cast<char**>(argv), const_cast<char**>(envp));
+ fprintf(stderr, "execve failed: %m\n");
+ _exit(1);
+ } else if (action == ChildAction::Execl) {
+ execl("/system/bin/true", "/system/bin/true", "unusedA", "unusedB", nullptr);
+ fprintf(stderr, "execl failed: %m\n");
+ _exit(1);
+ } else if (action == ChildAction::Exit) {
+ _exit(0);
+ }
+ CHECK(0);
+}
+
+// Place a tagged buffer on the stack. Do not tag the top half so that the parent does not crash too
+// early even if things go wrong.
+__attribute__((no_sanitize("memtag"), optnone, noinline)) void vfork_child(ChildAction action) {
+ alignas(16) char buf[kStackAllocationSize] __attribute__((uninitialized));
+ sink = &buf;
+
+ for (char* p = buf; p < buf + sizeof(buf) / 2; p += 16) {
+ char* q = mte_increment_tag(p);
+ mte_set_tag(q);
+ CHECK(mte_get_tag(p) == q);
+ }
+ vfork_child2(action, __builtin_frame_address(0));
+}
+
+// Parent. Check that the stack has correct allocation tags.
+__attribute__((no_sanitize("memtag"), optnone, noinline)) void vfork_parent(pid_t pid) {
+ alignas(16) char buf[kStackAllocationSize] __attribute__((uninitialized));
+ fprintf(stderr, "vfork_parent %p\n", &buf);
+ bool success = true;
+ for (char* p = buf; p < buf + sizeof(buf); p += 16) {
+ char* q = mte_get_tag(p);
+ if (p != q) {
+ fprintf(stderr, "tag mismatch at offset %zx: %p != %p\n", p - buf, p, q);
+ success = false;
+ break;
+ }
+ }
+
+ int wstatus;
+ do {
+ int res = waitpid(pid, &wstatus, 0);
+ CHECK(res == pid);
+ } while (!WIFEXITED(wstatus) && !WIFSIGNALED(wstatus));
+
+ CHECK(WIFEXITED(wstatus));
+ CHECK(WEXITSTATUS(wstatus) == 0);
+
+ if (!success) exit(1);
+}
+
+void test_vfork(ChildAction action) {
+ pid_t pid = vfork();
+ if (pid == 0) {
+ vfork_child(action);
+ } else {
+ vfork_parent(pid);
+ }
+}
+
+__attribute__((no_sanitize("memtag"), optnone, noinline)) static void settag_and_longjmp(
+ jmp_buf cont) {
+ alignas(16) char buf[kStackAllocationSize] __attribute__((uninitialized));
+ sink = &buf;
+
+ for (char* p = buf; p < buf + sizeof(buf) / 2; p += 16) {
+ char* q = mte_increment_tag(p);
+ mte_set_tag(q);
+ if (mte_get_tag(p) != q) {
+ fprintf(stderr, "failed to set allocation tags on stack: %p != %p\n", mte_get_tag(p), q);
+ exit(1);
+ }
+ }
+ longjmp(cont, 42);
+}
+
+// Check that the stack has correct allocation tags.
+__attribute__((no_sanitize("memtag"), optnone, noinline)) static void check_stack_tags() {
+ alignas(16) char buf[kStackAllocationSize] __attribute__((uninitialized));
+ for (char* p = buf; p < buf + sizeof(buf); p += 16) {
+ void* q = mte_get_tag(p);
+ if (p != q) {
+ fprintf(stderr, "stack tags mismatch: expected %p, got %p", p, q);
+ exit(1);
+ }
+ }
+}
+
+void check_longjmp_restores_tags() {
+ int value;
+ jmp_buf jb;
+ if ((value = setjmp(jb)) == 0) {
+ settag_and_longjmp(jb);
+ exit(2); // Unreachable.
+ } else {
+ CHECK(value == 42);
+ check_stack_tags();
+ }
+}
+
+class SigAltStackScoped {
+ stack_t old_ss;
+ void* altstack_start;
+ size_t altstack_size;
+
+ public:
+ SigAltStackScoped(size_t sz) : altstack_size(sz) {
+ altstack_start = mmap(nullptr, altstack_size, PROT_READ | PROT_WRITE | PROT_MTE,
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ if (altstack_start == MAP_FAILED) {
+ fprintf(stderr, "sigaltstack mmap failed: %m\n");
+ exit(1);
+ }
+ stack_t ss = {};
+ ss.ss_sp = altstack_start;
+ ss.ss_size = altstack_size;
+ int res = sigaltstack(&ss, &old_ss);
+ CHECK(res == 0);
+ }
+
+ ~SigAltStackScoped() {
+ int res = sigaltstack(&old_ss, nullptr);
+ CHECK(res == 0);
+ munmap(altstack_start, altstack_size);
+ }
+};
+
+class SigActionScoped {
+ int signo;
+ struct sigaction oldsa;
+
+ public:
+ using handler_t = void (*)(int, siginfo_t* siginfo, void*);
+
+ SigActionScoped(int signo, handler_t handler) : signo(signo) {
+ struct sigaction sa = {};
+ sa.sa_sigaction = handler;
+ sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
+ int res = sigaction(signo, &sa, &oldsa);
+ CHECK(res == 0);
+ }
+
+ ~SigActionScoped() {
+ int res = sigaction(signo, &oldsa, nullptr);
+ CHECK(res == 0);
+ }
+};
+
+void test_longjmp() {
+ check_longjmp_restores_tags();
+
+ std::thread t([]() { check_longjmp_restores_tags(); });
+ t.join();
+}
+
+void test_longjmp_sigaltstack() {
+ constexpr size_t kAltStackSize = kStackAllocationSize + PAGE_SIZE * 16;
+ SigAltStackScoped sigAltStackScoped(kAltStackSize);
+ SigActionScoped sigActionScoped(
+ SIGUSR1, [](int, siginfo_t*, void*) { check_longjmp_restores_tags(); });
+ raise(SIGUSR1);
+
+ // same for a secondary thread
+ std::thread t([]() {
+ SigAltStackScoped sigAltStackScoped(kAltStackSize);
+ raise(SIGUSR1);
+ });
+ t.join();
+}
+
+void test_android_mallopt() {
+ bool memtag_stack;
+ CHECK(android_mallopt(M_MEMTAG_STACK_IS_ON, &memtag_stack, sizeof(memtag_stack)));
+ CHECK(memtag_stack);
+}
+
+static uintptr_t GetTag(void* addr) {
+ return reinterpret_cast<uintptr_t>(addr) & (0xFULL << 56);
+}
+
+static uintptr_t GetTag(volatile void* addr) {
+ return GetTag(const_cast<void*>(addr));
+}
+
+static volatile char* throw_frame;
+static volatile char* skip_frame3_frame;
+volatile char *x;
+
+__attribute__((noinline)) void throws() {
+ // Prevent optimization.
+ if (getpid() == 0) return;
+ throw_frame = reinterpret_cast<char*>(__builtin_frame_address(0));
+ throw "error";
+}
+
+__attribute__((noinline)) void maybe_throws() {
+ // These are all unique sizes so in case of a failure, we can see which ones
+ // are not untagged from the tag dump.
+ volatile char y[5 * 16]= {};
+ x = y;
+ // Make sure y is tagged.
+ CHECK(GetTag(&y) != GetTag(__builtin_frame_address(0)));
+ throws();
+}
+
+__attribute__((noinline, no_sanitize("memtag"))) void skip_frame() {
+ volatile char y[6*16] = {};
+ x = y;
+ // Make sure y is not tagged.
+ CHECK(GetTag(&y) == GetTag(__builtin_frame_address(0)));
+ maybe_throws();
+}
+
+__attribute__((noinline)) void skip_frame2() {
+ volatile char y[7*16] = {};
+ x = y;
+ // Make sure y is tagged.
+ CHECK(GetTag(&y) != GetTag(__builtin_frame_address(0)));
+ skip_frame();
+}
+
+__attribute__((noinline, no_sanitize("memtag"))) void skip_frame3() {
+ volatile char y[8*16] = {};
+ x = y;
+ skip_frame3_frame = reinterpret_cast<char*>(__builtin_frame_address(0));
+ // Make sure y is not tagged.
+ CHECK(GetTag(&y) == GetTag(__builtin_frame_address(0)));
+ skip_frame2();
+}
+
+void test_exception_cleanup() {
+ // This is here for debugging purposes, if something goes wrong we can
+ // verify that this placeholder did not get untagged.
+ volatile char placeholder[16*16] = {};
+ x = placeholder;
+ try {
+ skip_frame3();
+ } catch (const char* e) {
+ }
+ if (throw_frame >= skip_frame3_frame) {
+ fprintf(stderr, "invalid throw frame");
+ exit(1);
+ }
+ for (char* b = const_cast<char*>(throw_frame); b < skip_frame3_frame; ++b) {
+ if (mte_get_tag(b) != b) {
+ fprintf(stderr, "invalid tag at %p", b);
+ exit(1);
+ }
+ }
+}
+
+int main(int argc, char** argv) {
+ if (argc < 2) {
+ printf("nothing to do\n");
+ return 1;
+ }
+
+ if (strcmp(argv[1], "vfork_execve") == 0) {
+ test_vfork(ChildAction::Execve);
+ return 0;
+ }
+
+ if (strcmp(argv[1], "vfork_execl") == 0) {
+ test_vfork(ChildAction::Execl);
+ return 0;
+ }
+
+ if (strcmp(argv[1], "vfork_exit") == 0) {
+ test_vfork(ChildAction::Exit);
+ return 0;
+ }
+
+ if (strcmp(argv[1], "longjmp") == 0) {
+ test_longjmp();
+ return 0;
+ }
+
+ if (strcmp(argv[1], "longjmp_sigaltstack") == 0) {
+ test_longjmp_sigaltstack();
+ return 0;
+ }
+
+ if (strcmp(argv[1], "android_mallopt") == 0) {
+ test_android_mallopt();
+ return 0;
+ }
+
+ if (strcmp(argv[1], "exception_cleanup") == 0) {
+ test_exception_cleanup();
+ return 0;
+ }
+
+ printf("unrecognized command: %s\n", argv[1]);
+ return 1;
+}
+#else
+int main(int, char**) {
+ printf("aarch64 only\n");
+ return 1;
+}
+#endif // defined(__aarch64__)
diff --git a/tests/locale_test.cpp b/tests/locale_test.cpp
index b4da6de..a220c83 100644
--- a/tests/locale_test.cpp
+++ b/tests/locale_test.cpp
@@ -79,9 +79,12 @@
}
TEST(locale, newlocale_NULL_locale_name) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
errno = 0;
EXPECT_EQ(nullptr, newlocale(LC_ALL, nullptr, nullptr));
EXPECT_EQ(EINVAL, errno);
+#pragma clang diagnostic pop
}
TEST(locale, newlocale_bad_locale_name) {
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index 69f8506..22905f4 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -35,7 +35,11 @@
#include <algorithm>
#include <atomic>
+#include <functional>
+#include <string>
#include <thread>
+#include <unordered_map>
+#include <utility>
#include <vector>
#include <tinyxml2.h>
@@ -661,13 +665,13 @@
}
TEST(malloc, mallopt_smoke) {
-#if !defined(ANDROID_HOST_MUSL)
+#if defined(__BIONIC__)
errno = 0;
ASSERT_EQ(0, mallopt(-1000, 1));
// mallopt doesn't set errno.
ASSERT_EQ(0, errno);
#else
- GTEST_SKIP() << "musl doesn't have mallopt";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -694,6 +698,44 @@
#endif
}
+TEST(malloc, mallopt_purge_all) {
+#if defined(__BIONIC__)
+ SKIP_WITH_HWASAN << "hwasan does not implement mallopt";
+ errno = 0;
+ ASSERT_EQ(1, mallopt(M_PURGE_ALL, 0));
+#else
+ GTEST_SKIP() << "bionic-only test";
+#endif
+}
+
+// Verify that all of the mallopt values are unique.
+TEST(malloc, mallopt_unique_params) {
+#if defined(__BIONIC__)
+ std::vector<std::pair<int, std::string>> params{
+ std::make_pair(M_DECAY_TIME, "M_DECAY_TIME"),
+ std::make_pair(M_PURGE, "M_PURGE"),
+ std::make_pair(M_PURGE_ALL, "M_PURGE_ALL"),
+ std::make_pair(M_MEMTAG_TUNING, "M_MEMTAG_TUNING"),
+ std::make_pair(M_THREAD_DISABLE_MEM_INIT, "M_THREAD_DISABLE_MEM_INIT"),
+ std::make_pair(M_CACHE_COUNT_MAX, "M_CACHE_COUNT_MAX"),
+ std::make_pair(M_CACHE_SIZE_MAX, "M_CACHE_SIZE_MAX"),
+ std::make_pair(M_TSDS_COUNT_MAX, "M_TSDS_COUNT_MAX"),
+ std::make_pair(M_BIONIC_ZERO_INIT, "M_BIONIC_ZERO_INIT"),
+ std::make_pair(M_BIONIC_SET_HEAP_TAGGING_LEVEL, "M_BIONIC_SET_HEAP_TAGGING_LEVEL"),
+ };
+
+ std::unordered_map<int, std::string> all_params;
+ for (const auto& param : params) {
+ EXPECT_TRUE(all_params.count(param.first) == 0)
+ << "mallopt params " << all_params[param.first] << " and " << param.second
+ << " have the same value " << param.first;
+ all_params.insert(param);
+ }
+#else
+ GTEST_SKIP() << "bionic-only test";
+#endif
+}
+
#if defined(__BIONIC__)
static void GetAllocatorVersion(bool* allocator_scudo) {
TemporaryFile tf;
@@ -1383,6 +1425,15 @@
#endif
}
+TEST(android_mallopt, memtag_stack_is_on) {
+#if defined(__BIONIC__)
+ bool memtag_stack;
+ EXPECT_TRUE(android_mallopt(M_MEMTAG_STACK_IS_ON, &memtag_stack, sizeof(memtag_stack)));
+#else
+ GTEST_SKIP() << "bionic extension";
+#endif
+}
+
void TestHeapZeroing(int num_iterations, int (*get_alloc_size)(int iteration)) {
std::vector<void*> allocs;
constexpr int kMaxBytesToCheckZero = 64;
@@ -1519,3 +1570,161 @@
}
}
}
+
+void VerifyAllocationsAreZero(std::function<void*(size_t)> alloc_func, std::string function_name,
+ std::vector<size_t>& test_sizes, size_t max_allocations) {
+ // Vector of zero'd data used for comparisons. Make it twice the largest size.
+ std::vector<char> zero(test_sizes.back() * 2, 0);
+
+ SCOPED_TRACE(testing::Message() << function_name << " failed to zero memory");
+
+ for (size_t test_size : test_sizes) {
+ std::vector<void*> ptrs(max_allocations);
+ for (size_t i = 0; i < ptrs.size(); i++) {
+ SCOPED_TRACE(testing::Message() << "size " << test_size << " at iteration " << i);
+ ptrs[i] = alloc_func(test_size);
+ ASSERT_TRUE(ptrs[i] != nullptr);
+ size_t alloc_size = malloc_usable_size(ptrs[i]);
+ ASSERT_LE(alloc_size, zero.size());
+ ASSERT_EQ(0, memcmp(ptrs[i], zero.data(), alloc_size));
+
+ // Set the memory to non-zero to make sure if the pointer
+ // is reused it's still zero.
+ memset(ptrs[i], 0xab, alloc_size);
+ }
+ // Free the pointers.
+ for (size_t i = 0; i < ptrs.size(); i++) {
+ free(ptrs[i]);
+ }
+ for (size_t i = 0; i < ptrs.size(); i++) {
+ SCOPED_TRACE(testing::Message() << "size " << test_size << " at iteration " << i);
+ ptrs[i] = malloc(test_size);
+ ASSERT_TRUE(ptrs[i] != nullptr);
+ size_t alloc_size = malloc_usable_size(ptrs[i]);
+ ASSERT_LE(alloc_size, zero.size());
+ ASSERT_EQ(0, memcmp(ptrs[i], zero.data(), alloc_size));
+ }
+ // Free all of the pointers later to maximize the chance of reusing from
+ // the first loop.
+ for (size_t i = 0; i < ptrs.size(); i++) {
+ free(ptrs[i]);
+ }
+ }
+}
+
+// Verify that small and medium allocations are always zero.
+// @CddTest = 9.7/C-4-1
+TEST(malloc, zeroed_allocations_small_medium_sizes) {
+#if !defined(__BIONIC__)
+ GTEST_SKIP() << "Only valid on bionic";
+#endif
+
+ if (IsLowRamDevice()) {
+ GTEST_SKIP() << "Skipped on low memory devices.";
+ }
+
+ constexpr size_t kMaxAllocations = 1024;
+ std::vector<size_t> test_sizes = {16, 48, 128, 1024, 4096, 65536};
+ VerifyAllocationsAreZero([](size_t size) -> void* { return malloc(size); }, "malloc", test_sizes,
+ kMaxAllocations);
+
+ VerifyAllocationsAreZero([](size_t size) -> void* { return memalign(64, size); }, "memalign",
+ test_sizes, kMaxAllocations);
+
+ VerifyAllocationsAreZero(
+ [](size_t size) -> void* {
+ void* ptr;
+ if (posix_memalign(&ptr, 64, size) == 0) {
+ return ptr;
+ }
+ return nullptr;
+ },
+ "posix_memalign", test_sizes, kMaxAllocations);
+}
+
+// Verify that large allocations are always zero.
+// @CddTest = 9.7/C-4-1
+TEST(malloc, zeroed_allocations_large_sizes) {
+#if !defined(__BIONIC__)
+ GTEST_SKIP() << "Only valid on bionic";
+#endif
+
+ if (IsLowRamDevice()) {
+ GTEST_SKIP() << "Skipped on low memory devices.";
+ }
+
+ constexpr size_t kMaxAllocations = 20;
+ std::vector<size_t> test_sizes = {1000000, 2000000, 3000000, 4000000};
+ VerifyAllocationsAreZero([](size_t size) -> void* { return malloc(size); }, "malloc", test_sizes,
+ kMaxAllocations);
+
+ VerifyAllocationsAreZero([](size_t size) -> void* { return memalign(64, size); }, "memalign",
+ test_sizes, kMaxAllocations);
+
+ VerifyAllocationsAreZero(
+ [](size_t size) -> void* {
+ void* ptr;
+ if (posix_memalign(&ptr, 64, size) == 0) {
+ return ptr;
+ }
+ return nullptr;
+ },
+ "posix_memalign", test_sizes, kMaxAllocations);
+}
+
+// Verify that reallocs are zeroed when expanded.
+// @CddTest = 9.7/C-4-1
+TEST(malloc, zeroed_allocations_realloc) {
+#if !defined(__BIONIC__)
+ GTEST_SKIP() << "Only valid on bionic";
+#endif
+
+ if (IsLowRamDevice()) {
+ GTEST_SKIP() << "Skipped on low memory devices.";
+ }
+
+ // Vector of zero'd data used for comparisons.
+ constexpr size_t kMaxMemorySize = 131072;
+ std::vector<char> zero(kMaxMemorySize, 0);
+
+ constexpr size_t kMaxAllocations = 1024;
+ std::vector<size_t> test_sizes = {16, 48, 128, 1024, 4096, 65536};
+ // Do a number of allocations and set them to non-zero.
+ for (size_t test_size : test_sizes) {
+ std::vector<void*> ptrs(kMaxAllocations);
+ for (size_t i = 0; i < kMaxAllocations; i++) {
+ ptrs[i] = malloc(test_size);
+ ASSERT_TRUE(ptrs[i] != nullptr);
+
+ // Set the memory to non-zero to make sure if the pointer
+ // is reused it's still zero.
+ memset(ptrs[i], 0xab, malloc_usable_size(ptrs[i]));
+ }
+ // Free the pointers.
+ for (size_t i = 0; i < kMaxAllocations; i++) {
+ free(ptrs[i]);
+ }
+ }
+
+ // Do the reallocs to a larger size and verify the rest of the allocation
+ // is zero.
+ constexpr size_t kInitialSize = 8;
+ for (size_t test_size : test_sizes) {
+ std::vector<void*> ptrs(kMaxAllocations);
+ for (size_t i = 0; i < kMaxAllocations; i++) {
+ ptrs[i] = malloc(kInitialSize);
+ ASSERT_TRUE(ptrs[i] != nullptr);
+ size_t orig_alloc_size = malloc_usable_size(ptrs[i]);
+
+ ptrs[i] = realloc(ptrs[i], test_size);
+ ASSERT_TRUE(ptrs[i] != nullptr);
+ size_t new_alloc_size = malloc_usable_size(ptrs[i]);
+ char* ptr = reinterpret_cast<char*>(ptrs[i]);
+ ASSERT_EQ(0, memcmp(&ptr[orig_alloc_size], zero.data(), new_alloc_size - orig_alloc_size))
+ << "realloc from " << kInitialSize << " to size " << test_size << " at iteration " << i;
+ }
+ for (size_t i = 0; i < kMaxAllocations; i++) {
+ free(ptrs[i]);
+ }
+ }
+}
diff --git a/tests/math_test.cpp b/tests/math_test.cpp
index 76b5078..60872f3 100644
--- a/tests/math_test.cpp
+++ b/tests/math_test.cpp
@@ -1053,22 +1053,22 @@
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
fesetround(FE_UPWARD); // lrint/lrintf/lrintl obey the rounding mode.
- ASSERT_EQ(1235, lrint(1234.01));
- ASSERT_EQ(1235, lrintf(1234.01f));
- ASSERT_EQ(1235, lrintl(1234.01L));
+ EXPECT_EQ(1235, lrint(1234.01));
+ EXPECT_EQ(1235, lrintf(1234.01f));
+ EXPECT_EQ(1235, lrintl(1234.01L));
fesetround(FE_TOWARDZERO); // lrint/lrintf/lrintl obey the rounding mode.
- ASSERT_EQ(1234, lrint(1234.01));
- ASSERT_EQ(1234, lrintf(1234.01f));
- ASSERT_EQ(1234, lrintl(1234.01L));
+ EXPECT_EQ(1234, lrint(1234.01));
+ EXPECT_EQ(1234, lrintf(1234.01f));
+ EXPECT_EQ(1234, lrintl(1234.01L));
fesetround(FE_UPWARD); // llrint/llrintf/llrintl obey the rounding mode.
- ASSERT_EQ(1235L, llrint(1234.01));
- ASSERT_EQ(1235L, llrintf(1234.01f));
- ASSERT_EQ(1235L, llrintl(1234.01L));
+ EXPECT_EQ(1235L, llrint(1234.01));
+ EXPECT_EQ(1235L, llrintf(1234.01f));
+ EXPECT_EQ(1235L, llrintl(1234.01L));
fesetround(FE_TOWARDZERO); // llrint/llrintf/llrintl obey the rounding mode.
- ASSERT_EQ(1234L, llrint(1234.01));
- ASSERT_EQ(1234L, llrintf(1234.01f));
- ASSERT_EQ(1234L, llrintl(1234.01L));
+ EXPECT_EQ(1234L, llrint(1234.01));
+ EXPECT_EQ(1234L, llrintf(1234.01f));
+ EXPECT_EQ(1234L, llrintl(1234.01L));
}
TEST(MATH_TEST, rint) {
diff --git a/tests/memtag_stack_test.cpp b/tests/memtag_stack_test.cpp
new file mode 100644
index 0000000..97084ec
--- /dev/null
+++ b/tests/memtag_stack_test.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <tuple>
+
+#include <gtest/gtest.h>
+
+#if defined(__BIONIC__)
+#include "gtest_globals.h"
+#include "platform/bionic/mte.h"
+#include "utils.h"
+#endif
+
+class MemtagStackTest : public testing::TestWithParam<std::tuple<const char*, bool>> {};
+
+TEST_P(MemtagStackTest, test) {
+#if defined(__BIONIC__) && defined(__aarch64__)
+ if (!mte_supported()) {
+ GTEST_SKIP() << "MTE unsupported";
+ }
+ bool is_static = std::get<1>(GetParam());
+ std::string helper =
+ GetTestlibRoot() + (is_static ? "/stack_tagging_static_helper" : "/stack_tagging_helper");
+ const char* arg = std::get<0>(GetParam());
+ chmod(helper.c_str(), 0755);
+ ExecTestHelper eth;
+ eth.SetArgs({helper.c_str(), arg, nullptr});
+ eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, "");
+#else
+ GTEST_SKIP() << "bionic/arm64 only";
+#endif
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ , MemtagStackTest,
+ testing::Combine(testing::Values("vfork_execve", "vfork_execl", "vfork_exit", "longjmp",
+ "longjmp_sigaltstack", "android_mallopt", "exception_cleanup"),
+ testing::Bool()),
+ [](const ::testing::TestParamInfo<MemtagStackTest::ParamType>& info) {
+ std::string s = std::get<0>(info.param);
+ if (std::get<1>(info.param)) s += "_static";
+ return s;
+ });
diff --git a/tests/mte_test.cpp b/tests/mte_test.cpp
index ade9532..5eb804f 100644
--- a/tests/mte_test.cpp
+++ b/tests/mte_test.cpp
@@ -32,6 +32,7 @@
reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(p.get()) + (1ULL << 56));
{
ScopedDisableMTE x;
+ // Test that nested ScopedDisableMTE does not reset MTE state.
{ ScopedDisableMTE y; }
#if defined(__aarch64__)
volatile int load ATTRIBUTE_UNUSED = *mistagged_p;
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_empty.so b/tests/prebuilt-elf-files/riscv64/libtest_empty.so
new file mode 100755
index 0000000..f3218f7
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_empty.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so
new file mode 100755
index 0000000..9f15ff9
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so
new file mode 100755
index 0000000..32db3b9
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-textrels.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-textrels.so
new file mode 100755
index 0000000..5ee9aab
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-textrels.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so
new file mode 100755
index 0000000..664d3df
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so
new file mode 100755
index 0000000..3e773c0
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so
new file mode 100755
index 0000000..d3bcd9a
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so
new file mode 100755
index 0000000..956dca8
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so
new file mode 100755
index 0000000..e663dae
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so b/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so
new file mode 100755
index 0000000..294f854
--- /dev/null
+++ b/tests/prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so
Binary files differ
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 907a35c..aad2a4d 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -41,6 +41,7 @@
#include <android-base/scopeguard.h>
#include <android-base/silent_death_test.h>
#include <android-base/strings.h>
+#include <android-base/test_utils.h>
#include "private/bionic_constants.h"
#include "SignalUtils.h"
@@ -184,6 +185,30 @@
ASSERT_EQ(0, pthread_key_delete(key));
}
+static void* FnWithStackFrame(void*) {
+ int x;
+ *const_cast<volatile int*>(&x) = 1;
+ return nullptr;
+}
+
+TEST(pthread, pthread_heap_allocated_stack) {
+ SKIP_WITH_HWASAN; // TODO(b/148982147): Re-enable when fixed.
+
+ size_t stack_size = 640 * 1024;
+ std::unique_ptr<char[]> stack(new (std::align_val_t(getpagesize())) char[stack_size]);
+ memset(stack.get(), '\xff', stack_size);
+
+ pthread_attr_t attr;
+ ASSERT_EQ(0, pthread_attr_init(&attr));
+ ASSERT_EQ(0, pthread_attr_setstack(&attr, stack.get(), stack_size));
+
+ pthread_t t;
+ ASSERT_EQ(0, pthread_create(&t, &attr, FnWithStackFrame, nullptr));
+
+ void* result;
+ ASSERT_EQ(0, pthread_join(t, &result));
+}
+
TEST(pthread, static_pthread_key_used_before_creation) {
#if defined(__BIONIC__)
// See http://b/19625804. The bug is about a static/global pthread key being used before creation.
diff --git a/tests/sched_test.cpp b/tests/sched_test.cpp
index 03e8062..fa1a07f 100644
--- a/tests/sched_test.cpp
+++ b/tests/sched_test.cpp
@@ -303,5 +303,8 @@
}
TEST(sched, sched_getaffinity_failure) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
ASSERT_EQ(-1, sched_getaffinity(getpid(), 0, nullptr));
+#pragma clang diagnostic pop
}
diff --git a/tests/scs_test.cpp b/tests/scs_test.cpp
index 24cb347..0776a43 100644
--- a/tests/scs_test.cpp
+++ b/tests/scs_test.cpp
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-#if __has_feature(shadow_call_stack)
-
#include <gtest/gtest.h>
#include "private/bionic_constants.h"
@@ -33,7 +31,9 @@
}
TEST(scs_test, stack_overflow) {
+#if defined(__aarch64__) || defined(__riscv)
ASSERT_EXIT(recurse1(SCS_SIZE), testing::KilledBySignal(SIGSEGV), "");
-}
-
+#else
+ GTEST_SKIP() << "no SCS on this architecture";
#endif
+}
diff --git a/tests/semaphore_test.cpp b/tests/semaphore_test.cpp
index f3f6020..6f8797f 100644
--- a/tests/semaphore_test.cpp
+++ b/tests/semaphore_test.cpp
@@ -165,8 +165,10 @@
TEST_F(semaphore_DeathTest, sem_timedwait_null_timeout) {
sem_t s;
ASSERT_EQ(0, sem_init(&s, 0, 0));
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
ASSERT_EXIT(sem_timedwait(&s, nullptr), testing::KilledBySignal(SIGSEGV), "");
+#pragma clang diagnostic pop
}
TEST(semaphore, sem_getvalue) {
diff --git a/tests/setjmp_test.cpp b/tests/setjmp_test.cpp
index 472aa20..6ae8bfd 100644
--- a/tests/setjmp_test.cpp
+++ b/tests/setjmp_test.cpp
@@ -81,8 +81,10 @@
sigset64_t ss;
sigemptyset64(&ss);
sigaddset64(&ss, SIGUSR1 + offset);
+#if defined(__BIONIC__)
// TIMER_SIGNAL.
sigaddset64(&ss, __SIGRTMIN);
+#endif
sigaddset64(&ss, SIGRTMIN + offset);
return ss;
}
@@ -224,13 +226,15 @@
}
#if defined(__arm__)
-#define __JB_SIGFLAG 0
+#define JB_SIGFLAG_OFFSET 0
#elif defined(__aarch64__)
-#define __JB_SIGFLAG 0
+#define JB_SIGFLAG_OFFSET 0
#elif defined(__i386__)
-#define __JB_SIGFLAG 8
+#define JB_SIGFLAG_OFFSET 8
+#elif defined(__riscv)
+#define JB_SIGFLAG_OFFSET 0
#elif defined(__x86_64)
-#define __JB_SIGFLAG 8
+#define JB_SIGFLAG_OFFSET 8
#endif
TEST_F(setjmp_DeathTest, setjmp_cookie) {
@@ -238,7 +242,7 @@
int value = setjmp(jb);
ASSERT_EQ(0, value);
- long* sigflag = reinterpret_cast<long*>(jb) + __JB_SIGFLAG;
+ long* sigflag = reinterpret_cast<long*>(jb) + JB_SIGFLAG_OFFSET;
// Make sure there's actually a cookie.
EXPECT_NE(0, *sigflag & ~1);
@@ -274,7 +278,6 @@
}
TEST(setjmp, bug_152210274) {
- SKIP_WITH_HWASAN; // b/227390656
// Ensure that we never have a mangled value in the stack pointer.
#if defined(__BIONIC__)
struct sigaction sa = {.sa_flags = SA_SIGINFO, .sa_sigaction = [](int, siginfo_t*, void*) {}};
@@ -295,15 +298,19 @@
perror("setjmp");
abort();
}
- if (*static_cast<pid_t*>(arg) == 100) longjmp(buf, 1);
+ // This will never be true, but the compiler doesn't know that, so the
+ // setjmp won't be removed by DCE. With HWASan/MTE this also acts as a
+ // kind of enforcement that the threads are done before leaving the test.
+ if (*static_cast<size_t*>(arg) != 123) longjmp(buf, 1);
}
return nullptr;
};
+ pthread_t threads[kNumThreads];
pid_t tids[kNumThreads] = {};
+ size_t var = 123;
for (size_t i = 0; i < kNumThreads; ++i) {
- pthread_t t;
- ASSERT_EQ(0, pthread_create(&t, nullptr, jumper, &tids[i]));
- tids[i] = pthread_gettid_np(t);
+ ASSERT_EQ(0, pthread_create(&threads[i], nullptr, jumper, &var));
+ tids[i] = pthread_gettid_np(threads[i]);
}
// Start the interrupter thread.
@@ -323,6 +330,9 @@
pthread_t t;
ASSERT_EQ(0, pthread_create(&t, nullptr, interrupter, tids));
pthread_join(t, nullptr);
+ for (size_t i = 0; i < kNumThreads; i++) {
+ pthread_join(threads[i], nullptr);
+ }
#else
GTEST_SKIP() << "tests uses functions not in glibc";
#endif
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index 5bda8b3..fa648d2 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -34,6 +34,13 @@
using namespace std::chrono_literals;
+#if defined(ANDROID_HOST_MUSL)
+// Musl doesn't export __SIGRTMIN and __SIGRTMAX, #define
+// them here.
+#define __SIGRTMIN 32
+#define __SIGRTMAX 64
+#endif
+
static int SIGNAL_MIN() {
return 1; // Signals start at 1 (SIGHUP), not 0.
}
@@ -816,9 +823,9 @@
#endif
TEST(signal, sigset_size) {
- // The setjmp implementations assume that sigset_t can fit in a
- // long. This is true because ARM and x86 have broken rt signal support,
- // and AArch64 and x86_64 both have a SIGRTMAX defined as 64.
+ // The setjmp implementations assume that sigset_t can fit in a long.
+ // This is true because the 32-bit ABIs have broken rt signal support,
+ // but the 64-bit ABIs both have a SIGRTMAX defined as 64.
#if defined(__BIONIC__)
static_assert(sizeof(sigset_t) <= sizeof(long), "sigset_t doesn't fit in a long");
#endif
diff --git a/tests/spawn_test.cpp b/tests/spawn_test.cpp
index a9563b8..ab3e877 100644
--- a/tests/spawn_test.cpp
+++ b/tests/spawn_test.cpp
@@ -232,18 +232,28 @@
}
TEST(spawn, posix_spawn_file_actions) {
+#if !defined(__GLIBC__)
int fds[2];
ASSERT_NE(-1, pipe(fds));
posix_spawn_file_actions_t fa;
ASSERT_EQ(0, posix_spawn_file_actions_init(&fa));
+ // Test addclose and adddup2 by redirecting output to the pipe created above.
ASSERT_EQ(0, posix_spawn_file_actions_addclose(&fa, fds[0]));
ASSERT_EQ(0, posix_spawn_file_actions_adddup2(&fa, fds[1], 1));
ASSERT_EQ(0, posix_spawn_file_actions_addclose(&fa, fds[1]));
// Check that close(2) failures are ignored by closing the same fd again.
ASSERT_EQ(0, posix_spawn_file_actions_addclose(&fa, fds[1]));
+ // Open a file directly, to test addopen.
ASSERT_EQ(0, posix_spawn_file_actions_addopen(&fa, 56, "/proc/version", O_RDONLY, 0));
+ // Test addfchdir by opening the same file a second way...
+ ASSERT_EQ(0, posix_spawn_file_actions_addopen(&fa, 57, "/proc", O_PATH, 0));
+ ASSERT_EQ(0, posix_spawn_file_actions_addfchdir_np(&fa, 57));
+ ASSERT_EQ(0, posix_spawn_file_actions_addopen(&fa, 58, "version", O_RDONLY, 0));
+ // Test addchdir by opening the same file a third way...
+ ASSERT_EQ(0, posix_spawn_file_actions_addchdir_np(&fa, "/"));
+ ASSERT_EQ(0, posix_spawn_file_actions_addopen(&fa, 59, "proc/version", O_RDONLY, 0));
ExecTestHelper eth;
eth.SetArgs({"ls", "-l", "/proc/self/fd", nullptr});
@@ -259,12 +269,21 @@
AssertChildExited(pid, 0);
// We'll know the dup2 worked if we see any ls(1) output in our pipe.
- // The open we can check manually...
+ // The opens we can check manually (and they implicitly check the chdirs)...
bool open_to_fd_56_worked = false;
+ bool open_to_fd_58_worked = false;
+ bool open_to_fd_59_worked = false;
for (const auto& line : android::base::Split(content, "\n")) {
if (line.find(" 56 -> /proc/version") != std::string::npos) open_to_fd_56_worked = true;
+ if (line.find(" 58 -> /proc/version") != std::string::npos) open_to_fd_58_worked = true;
+ if (line.find(" 59 -> /proc/version") != std::string::npos) open_to_fd_59_worked = true;
}
- ASSERT_TRUE(open_to_fd_56_worked);
+ ASSERT_TRUE(open_to_fd_56_worked) << content;
+ ASSERT_TRUE(open_to_fd_58_worked) << content;
+ ASSERT_TRUE(open_to_fd_59_worked) << content;
+#else
+ GTEST_SKIP() << "our old glibc doesn't have the chdirs; newer versions and musl do.";
+#endif
}
static void CatFileToString(posix_spawnattr_t* sa, const char* path, std::string* content) {
diff --git a/tests/stack_protector_test_helper.cpp b/tests/stack_protector_test_helper.cpp
index eddd940..69b3c5d 100644
--- a/tests/stack_protector_test_helper.cpp
+++ b/tests/stack_protector_test_helper.cpp
@@ -15,12 +15,11 @@
*/
// Deliberately overwrite the stack canary.
-__attribute__((noinline)) void modify_stack_protector_test() {
+__attribute__((noinline, optnone)) void modify_stack_protector_test() {
// We can't use memset here because it's fortified, and we want to test
// the line of defense *after* that.
- // Without volatile, the generic x86/x86-64 targets don't write to the stack.
// We can't make a constant change, since the existing byte might already have
// had that value.
- volatile char* p = reinterpret_cast<volatile char*>(&p + 1);
+ char* p = reinterpret_cast<char*>(&p + 1);
*p = ~*p;
}
diff --git a/tests/stdio_ext_test.cpp b/tests/stdio_ext_test.cpp
index fce600a..dce1a66 100644
--- a/tests/stdio_ext_test.cpp
+++ b/tests/stdio_ext_test.cpp
@@ -78,6 +78,24 @@
fclose(fp);
}
+TEST(stdio_ext, __freadahead) {
+#if defined(__GLIBC__)
+ GTEST_SKIP() << "glibc doesn't have __freadahead";
+#else
+ FILE* fp = tmpfile();
+ ASSERT_NE(EOF, fputs("hello", fp));
+ rewind(fp);
+
+ ASSERT_EQ('h', fgetc(fp));
+ ASSERT_EQ(4u, __freadahead(fp));
+
+ ASSERT_EQ('H', ungetc('H', fp));
+ ASSERT_EQ(5u, __freadahead(fp));
+
+ fclose(fp);
+#endif
+}
+
TEST(stdio_ext, __fpurge) {
FILE* fp = tmpfile();
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 87031f6..0e267c5 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -25,6 +25,7 @@
#include <sys/cdefs.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/sysinfo.h>
#include <sys/types.h>
#include <unistd.h>
#include <wchar.h>
@@ -35,6 +36,7 @@
#include <android-base/file.h>
#include <android-base/silent_death_test.h>
+#include <android-base/strings.h>
#include <android-base/test_utils.h>
#include <android-base/unique_fd.h>
@@ -139,6 +141,22 @@
fclose(fp);
}
+TEST(STDIO_TEST, tmpfile_TMPDIR) {
+ TemporaryDir td;
+ setenv("TMPDIR", td.path, 1);
+
+ FILE* fp = tmpfile();
+ ASSERT_TRUE(fp != nullptr);
+
+ std::string fd_path = android::base::StringPrintf("/proc/self/fd/%d", fileno(fp));
+ char path[PATH_MAX];
+ ASSERT_GT(readlink(fd_path.c_str(), path, sizeof(path)), 0);
+ // $TMPDIR influenced where our temporary file ended up?
+ ASSERT_TRUE(android::base::StartsWith(path, td.path)) << path;
+ // And we used O_TMPFILE, right?
+ ASSERT_TRUE(android::base::EndsWith(path, " (deleted)")) << path;
+}
+
TEST(STDIO_TEST, dprintf) {
TemporaryFile tf;
@@ -189,6 +207,8 @@
}
TEST(STDIO_TEST, getdelim_invalid) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
FILE* fp = tmpfile();
ASSERT_TRUE(fp != nullptr);
@@ -205,6 +225,7 @@
ASSERT_EQ(getdelim(&buffer, nullptr, ' ', fp), -1);
ASSERT_EQ(EINVAL, errno);
fclose(fp);
+#pragma clang diagnostic pop
}
TEST(STDIO_TEST, getdelim_directory) {
@@ -259,6 +280,8 @@
}
TEST(STDIO_TEST, getline_invalid) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
FILE* fp = tmpfile();
ASSERT_TRUE(fp != nullptr);
@@ -275,6 +298,7 @@
ASSERT_EQ(getline(&buffer, nullptr, fp), -1);
ASSERT_EQ(EINVAL, errno);
fclose(fp);
+#pragma clang diagnostic pop
}
TEST(STDIO_TEST, printf_ssize_t) {
@@ -364,13 +388,13 @@
TEST_F(STDIO_DEATHTEST, snprintf_n) {
#if defined(__BIONIC__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat"
// http://b/14492135 and http://b/31832608.
char buf[32];
int i = 1234;
EXPECT_DEATH(snprintf(buf, sizeof(buf), "a %n b", &i), "%n not allowed on Android");
-#pragma GCC diagnostic pop
+#pragma clang diagnostic pop
#else
GTEST_SKIP() << "glibc does allow %n";
#endif
@@ -489,22 +513,22 @@
// NaN.
- snprintf_fn(buf, sizeof(buf), fmt, nanf(""));
+ snprintf_fn(buf, sizeof(buf), fmt, nan(""));
EXPECT_STREQ(nan_, buf) << fmt;
EXPECT_EQ(1, sscanf_fn(buf, fmt, &f));
EXPECT_TRUE(isnan(f));
- snprintf_fn(buf, sizeof(buf), fmt, -nanf(""));
+ snprintf_fn(buf, sizeof(buf), fmt, -nan(""));
EXPECT_STREQ(minus_nan, buf) << fmt;
EXPECT_EQ(1, sscanf_fn(buf, fmt, &f));
EXPECT_TRUE(isnan(f));
- snprintf_fn(buf, sizeof(buf), fmt_plus, nanf(""));
+ snprintf_fn(buf, sizeof(buf), fmt_plus, nan(""));
EXPECT_STREQ(plus_nan, buf) << fmt_plus;
EXPECT_EQ(1, sscanf_fn(buf, fmt, &f));
EXPECT_TRUE(isnan(f));
- snprintf_fn(buf, sizeof(buf), fmt_plus, -nanf(""));
+ snprintf_fn(buf, sizeof(buf), fmt_plus, -nan(""));
EXPECT_STREQ(minus_nan, buf) << fmt_plus;
EXPECT_EQ(1, sscanf_fn(buf, fmt, &f));
EXPECT_TRUE(isnan(f));
@@ -1943,6 +1967,8 @@
TEST(STDIO_TEST, open_memstream_EINVAL) {
#if defined(__BIONIC__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
char* p;
size_t size;
@@ -1955,6 +1981,7 @@
errno = 0;
ASSERT_EQ(nullptr, open_memstream(&p, nullptr));
ASSERT_EQ(EINVAL, errno);
+#pragma clang diagnostic pop
#else
GTEST_SKIP() << "glibc is broken";
#endif
@@ -2938,3 +2965,454 @@
fclose(fp);
}
+
+#if defined(__LP64__)
+static int64_t GetTotalRamGiB() {
+ struct sysinfo si;
+ sysinfo(&si);
+ return (static_cast<int64_t>(si.totalram) * si.mem_unit) / 1024 / 1024 / 1024;
+}
+#endif
+
+TEST(STDIO_TEST, fread_int_overflow) {
+#if defined(__LP64__)
+ if (GetTotalRamGiB() <= 4) GTEST_SKIP() << "not enough memory";
+
+ const size_t too_big_for_an_int = 0x80000000ULL;
+ std::vector<char> buf(too_big_for_an_int);
+ std::unique_ptr<FILE, decltype(&fclose)> fp{fopen("/dev/zero", "re"), fclose};
+ ASSERT_EQ(too_big_for_an_int, fread(&buf[0], 1, too_big_for_an_int, fp.get()));
+#else
+ GTEST_SKIP() << "32-bit can't allocate 2GiB";
+#endif
+}
+
+TEST(STDIO_TEST, fwrite_int_overflow) {
+#if defined(__LP64__)
+ if (GetTotalRamGiB() <= 4) GTEST_SKIP() << "not enough memory";
+
+ const size_t too_big_for_an_int = 0x80000000ULL;
+ std::vector<char> buf(too_big_for_an_int);
+ std::unique_ptr<FILE, decltype(&fclose)> fp{fopen("/dev/null", "we"), fclose};
+ ASSERT_EQ(too_big_for_an_int, fwrite(&buf[0], 1, too_big_for_an_int, fp.get()));
+#else
+ GTEST_SKIP() << "32-bit can't allocate 2GiB";
+#endif
+}
+
+TEST(STDIO_TEST, snprintf_b) {
+#if defined(__BIONIC__)
+ char buf[BUFSIZ];
+
+ uint8_t b = 5;
+ EXPECT_EQ(5, snprintf(buf, sizeof(buf), "<%" PRIb8 ">", b));
+ EXPECT_STREQ("<101>", buf);
+ EXPECT_EQ(10, snprintf(buf, sizeof(buf), "<%08" PRIb8 ">", b));
+ EXPECT_STREQ("<00000101>", buf);
+
+ uint16_t s = 0xaaaa;
+ EXPECT_EQ(18, snprintf(buf, sizeof(buf), "<%" PRIb16 ">", s));
+ EXPECT_STREQ("<1010101010101010>", buf);
+ EXPECT_EQ(20, snprintf(buf, sizeof(buf), "<%#" PRIb16 ">", s));
+ EXPECT_STREQ("<0b1010101010101010>", buf);
+
+ EXPECT_EQ(34, snprintf(buf, sizeof(buf), "<%" PRIb32 ">", 0xaaaaaaaa));
+ EXPECT_STREQ("<10101010101010101010101010101010>", buf);
+ EXPECT_EQ(36, snprintf(buf, sizeof(buf), "<%#" PRIb32 ">", 0xaaaaaaaa));
+ EXPECT_STREQ("<0b10101010101010101010101010101010>", buf);
+
+ // clang doesn't like "%lb" (https://github.com/llvm/llvm-project/issues/62247)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat"
+ EXPECT_EQ(66, snprintf(buf, sizeof(buf), "<%" PRIb64 ">", 0xaaaaaaaa'aaaaaaaa));
+ EXPECT_STREQ("<1010101010101010101010101010101010101010101010101010101010101010>", buf);
+ EXPECT_EQ(68, snprintf(buf, sizeof(buf), "<%#" PRIb64 ">", 0xaaaaaaaa'aaaaaaaa));
+ EXPECT_STREQ("<0b1010101010101010101010101010101010101010101010101010101010101010>", buf);
+#pragma clang diagnostic pop
+
+ EXPECT_EQ(3, snprintf(buf, sizeof(buf), "<%#b>", 0));
+ EXPECT_STREQ("<0>", buf);
+#else
+ GTEST_SKIP() << "no %b in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, snprintf_B) {
+#if defined(__BIONIC__)
+ char buf[BUFSIZ];
+
+ uint8_t b = 5;
+ EXPECT_EQ(5, snprintf(buf, sizeof(buf), "<%" PRIB8 ">", b));
+ EXPECT_STREQ("<101>", buf);
+ EXPECT_EQ(10, snprintf(buf, sizeof(buf), "<%08" PRIB8 ">", b));
+ EXPECT_STREQ("<00000101>", buf);
+
+ uint16_t s = 0xaaaa;
+ EXPECT_EQ(18, snprintf(buf, sizeof(buf), "<%" PRIB16 ">", s));
+ EXPECT_STREQ("<1010101010101010>", buf);
+ EXPECT_EQ(20, snprintf(buf, sizeof(buf), "<%#" PRIB16 ">", s));
+ EXPECT_STREQ("<0B1010101010101010>", buf);
+
+ EXPECT_EQ(34, snprintf(buf, sizeof(buf), "<%" PRIB32 ">", 0xaaaaaaaa));
+ EXPECT_STREQ("<10101010101010101010101010101010>", buf);
+ EXPECT_EQ(36, snprintf(buf, sizeof(buf), "<%#" PRIB32 ">", 0xaaaaaaaa));
+ EXPECT_STREQ("<0B10101010101010101010101010101010>", buf);
+
+ // clang doesn't like "%lB" (https://github.com/llvm/llvm-project/issues/62247)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat"
+ EXPECT_EQ(66, snprintf(buf, sizeof(buf), "<%" PRIB64 ">", 0xaaaaaaaa'aaaaaaaa));
+ EXPECT_STREQ("<1010101010101010101010101010101010101010101010101010101010101010>", buf);
+ EXPECT_EQ(68, snprintf(buf, sizeof(buf), "<%#" PRIB64 ">", 0xaaaaaaaa'aaaaaaaa));
+ EXPECT_STREQ("<0B1010101010101010101010101010101010101010101010101010101010101010>", buf);
+#pragma clang diagnostic pop
+
+ EXPECT_EQ(3, snprintf(buf, sizeof(buf), "<%#b>", 0));
+ EXPECT_STREQ("<0>", buf);
+#else
+ GTEST_SKIP() << "no %B in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, swprintf_b) {
+#if defined(__BIONIC__)
+ wchar_t buf[BUFSIZ];
+
+ uint8_t b = 5;
+ EXPECT_EQ(5, swprintf(buf, sizeof(buf), L"<%" PRIb8 ">", b));
+ EXPECT_EQ(std::wstring(L"<101>"), buf);
+ EXPECT_EQ(10, swprintf(buf, sizeof(buf), L"<%08" PRIb8 ">", b));
+ EXPECT_EQ(std::wstring(L"<00000101>"), buf);
+
+ uint16_t s = 0xaaaa;
+ EXPECT_EQ(18, swprintf(buf, sizeof(buf), L"<%" PRIb16 ">", s));
+ EXPECT_EQ(std::wstring(L"<1010101010101010>"), buf);
+ EXPECT_EQ(20, swprintf(buf, sizeof(buf), L"<%#" PRIb16 ">", s));
+ EXPECT_EQ(std::wstring(L"<0b1010101010101010>"), buf);
+
+ EXPECT_EQ(34, swprintf(buf, sizeof(buf), L"<%" PRIb32 ">", 0xaaaaaaaa));
+ EXPECT_EQ(std::wstring(L"<10101010101010101010101010101010>"), buf);
+ EXPECT_EQ(36, swprintf(buf, sizeof(buf), L"<%#" PRIb32 ">", 0xaaaaaaaa));
+ EXPECT_EQ(std::wstring(L"<0b10101010101010101010101010101010>"), buf);
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat" // clang doesn't like "%lb"
+ EXPECT_EQ(66, swprintf(buf, sizeof(buf), L"<%" PRIb64 ">", 0xaaaaaaaa'aaaaaaaa));
+ EXPECT_EQ(std::wstring(L"<1010101010101010101010101010101010101010101010101010101010101010>"),
+ buf);
+ EXPECT_EQ(68, swprintf(buf, sizeof(buf), L"<%#" PRIb64 ">", 0xaaaaaaaa'aaaaaaaa));
+ EXPECT_EQ(std::wstring(L"<0b1010101010101010101010101010101010101010101010101010101010101010>"),
+ buf);
+#pragma clang diagnostic pop
+
+ EXPECT_EQ(3, swprintf(buf, sizeof(buf), L"<%#b>", 0));
+ EXPECT_EQ(std::wstring(L"<0>"), buf);
+#else
+ GTEST_SKIP() << "no %b in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, swprintf_B) {
+#if defined(__BIONIC__)
+ wchar_t buf[BUFSIZ];
+
+ uint8_t b = 5;
+ EXPECT_EQ(5, swprintf(buf, sizeof(buf), L"<%" PRIB8 ">", b));
+ EXPECT_EQ(std::wstring(L"<101>"), buf);
+ EXPECT_EQ(10, swprintf(buf, sizeof(buf), L"<%08" PRIB8 ">", b));
+ EXPECT_EQ(std::wstring(L"<00000101>"), buf);
+
+ uint16_t s = 0xaaaa;
+ EXPECT_EQ(18, swprintf(buf, sizeof(buf), L"<%" PRIB16 ">", s));
+ EXPECT_EQ(std::wstring(L"<1010101010101010>"), buf);
+ EXPECT_EQ(20, swprintf(buf, sizeof(buf), L"<%#" PRIB16 ">", s));
+ EXPECT_EQ(std::wstring(L"<0B1010101010101010>"), buf);
+
+ EXPECT_EQ(34, swprintf(buf, sizeof(buf), L"<%" PRIB32 ">", 0xaaaaaaaa));
+ EXPECT_EQ(std::wstring(L"<10101010101010101010101010101010>"), buf);
+ EXPECT_EQ(36, swprintf(buf, sizeof(buf), L"<%#" PRIB32 ">", 0xaaaaaaaa));
+ EXPECT_EQ(std::wstring(L"<0B10101010101010101010101010101010>"), buf);
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat" // clang doesn't like "%lb"
+ EXPECT_EQ(66, swprintf(buf, sizeof(buf), L"<%" PRIB64 ">", 0xaaaaaaaa'aaaaaaaa));
+ EXPECT_EQ(std::wstring(L"<1010101010101010101010101010101010101010101010101010101010101010>"),
+ buf);
+ EXPECT_EQ(68, swprintf(buf, sizeof(buf), L"<%#" PRIB64 ">", 0xaaaaaaaa'aaaaaaaa));
+ EXPECT_EQ(std::wstring(L"<0B1010101010101010101010101010101010101010101010101010101010101010>"),
+ buf);
+#pragma clang diagnostic pop
+
+ EXPECT_EQ(3, swprintf(buf, sizeof(buf), L"<%#B>", 0));
+ EXPECT_EQ(std::wstring(L"<0>"), buf);
+#else
+ GTEST_SKIP() << "no %B in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, scanf_i_decimal) {
+ int i;
+ EXPECT_EQ(1, sscanf("<123789>", "<%i>", &i));
+ EXPECT_EQ(123789, i);
+
+ long long int lli;
+ char ch;
+ EXPECT_EQ(2, sscanf("1234567890abcdefg", "%lli%c", &lli, &ch));
+ EXPECT_EQ(1234567890, lli);
+ EXPECT_EQ('a', ch);
+}
+
+TEST(STDIO_TEST, scanf_i_hex) {
+ int i;
+ EXPECT_EQ(1, sscanf("<0x123abf>", "<%i>", &i));
+ EXPECT_EQ(0x123abf, i);
+
+ long long int lli;
+ char ch;
+ EXPECT_EQ(2, sscanf("0x1234567890abcdefg", "%lli%c", &lli, &ch));
+ EXPECT_EQ(0x1234567890abcdefLL, lli);
+ EXPECT_EQ('g', ch);
+}
+
+TEST(STDIO_TEST, scanf_i_octal) {
+ int i;
+ EXPECT_EQ(1, sscanf("<01234567>", "<%i>", &i));
+ EXPECT_EQ(01234567, i);
+
+ long long int lli;
+ char ch;
+ EXPECT_EQ(2, sscanf("010234567890abcdefg", "%lli%c", &lli, &ch));
+ EXPECT_EQ(010234567, lli);
+ EXPECT_EQ('8', ch);
+}
+
+TEST(STDIO_TEST, scanf_i_binary) {
+ int i;
+ EXPECT_EQ(1, sscanf("<0b101>", "<%i>", &i));
+ EXPECT_EQ(0b101, i);
+
+ long long int lli;
+ char ch;
+ EXPECT_EQ(2, sscanf("0b10234567890abcdefg", "%lli%c", &lli, &ch));
+ EXPECT_EQ(0b10, lli);
+ EXPECT_EQ('2', ch);
+}
+
+TEST(STDIO_TEST, wscanf_i_decimal) {
+ int i;
+ EXPECT_EQ(1, swscanf(L"<123789>", L"<%i>", &i));
+ EXPECT_EQ(123789, i);
+
+ long long int lli;
+ char ch;
+ EXPECT_EQ(2, swscanf(L"1234567890abcdefg", L"%lli%c", &lli, &ch));
+ EXPECT_EQ(1234567890, lli);
+ EXPECT_EQ('a', ch);
+}
+
+TEST(STDIO_TEST, wscanf_i_hex) {
+ int i;
+ EXPECT_EQ(1, swscanf(L"<0x123abf>", L"<%i>", &i));
+ EXPECT_EQ(0x123abf, i);
+
+ long long int lli;
+ char ch;
+ EXPECT_EQ(2, swscanf(L"0x1234567890abcdefg", L"%lli%c", &lli, &ch));
+ EXPECT_EQ(0x1234567890abcdefLL, lli);
+ EXPECT_EQ('g', ch);
+}
+
+TEST(STDIO_TEST, wscanf_i_octal) {
+ int i;
+ EXPECT_EQ(1, swscanf(L"<01234567>", L"<%i>", &i));
+ EXPECT_EQ(01234567, i);
+
+ long long int lli;
+ char ch;
+ EXPECT_EQ(2, swscanf(L"010234567890abcdefg", L"%lli%c", &lli, &ch));
+ EXPECT_EQ(010234567, lli);
+ EXPECT_EQ('8', ch);
+}
+
+TEST(STDIO_TEST, wscanf_i_binary) {
+ int i;
+ EXPECT_EQ(1, swscanf(L"<0b101>", L"<%i>", &i));
+ EXPECT_EQ(0b101, i);
+
+ long long int lli;
+ char ch;
+ EXPECT_EQ(2, swscanf(L"0b10234567890abcdefg", L"%lli%c", &lli, &ch));
+ EXPECT_EQ(0b10, lli);
+ EXPECT_EQ('2', ch);
+}
+
+TEST(STDIO_TEST, scanf_b) {
+ int i;
+ char ch;
+ EXPECT_EQ(2, sscanf("<1012>", "<%b%c>", &i, &ch));
+ EXPECT_EQ(0b101, i);
+ EXPECT_EQ('2', ch);
+ EXPECT_EQ(1, sscanf("<00000101>", "<%08b>", &i));
+ EXPECT_EQ(0b00000101, i);
+ EXPECT_EQ(1, sscanf("<0b1010>", "<%b>", &i));
+ EXPECT_EQ(0b1010, i);
+ EXPECT_EQ(2, sscanf("-0b", "%i%c", &i, &ch));
+ EXPECT_EQ(0, i);
+ EXPECT_EQ('b', ch);
+}
+
+TEST(STDIO_TEST, swscanf_b) {
+ int i;
+ char ch;
+ EXPECT_EQ(2, swscanf(L"<1012>", L"<%b%c>", &i, &ch));
+ EXPECT_EQ(0b101, i);
+ EXPECT_EQ('2', ch);
+ EXPECT_EQ(1, swscanf(L"<00000101>", L"<%08b>", &i));
+ EXPECT_EQ(0b00000101, i);
+ EXPECT_EQ(1, swscanf(L"<0b1010>", L"<%b>", &i));
+ EXPECT_EQ(0b1010, i);
+ EXPECT_EQ(2, swscanf(L"-0b", L"%i%c", &i, &ch));
+ EXPECT_EQ(0, i);
+ EXPECT_EQ('b', ch);
+}
+
+TEST(STDIO_TEST, snprintf_w_base) {
+#if defined(__BIONIC__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-invalid-specifier"
+#pragma clang diagnostic ignored "-Wconstant-conversion"
+ char buf[BUFSIZ];
+ int8_t a = 0b101;
+ snprintf(buf, sizeof(buf), "<%w8b>", a);
+ EXPECT_STREQ("<101>", buf);
+ int8_t b1 = 0xFF;
+ snprintf(buf, sizeof(buf), "<%w8d>", b1);
+ EXPECT_STREQ("<-1>", buf);
+ int8_t b2 = 0x1FF;
+ snprintf(buf, sizeof(buf), "<%w8d>", b2);
+ EXPECT_STREQ("<-1>", buf);
+ int16_t c = 0xFFFF;
+ snprintf(buf, sizeof(buf), "<%w16i>", c);
+ EXPECT_STREQ("<-1>", buf);
+ int32_t d = 021;
+ snprintf(buf, sizeof(buf), "<%w32o>", d);
+ EXPECT_STREQ("<21>", buf);
+ uint32_t e = -1;
+ snprintf(buf, sizeof(buf), "<%w32u>", e);
+ EXPECT_STREQ("<4294967295>", buf);
+ int64_t f = 0x3b;
+ snprintf(buf, sizeof(buf), "<%w64x>", f);
+ EXPECT_STREQ("<3b>", buf);
+ snprintf(buf, sizeof(buf), "<%w64X>", f);
+ EXPECT_STREQ("<3B>", buf);
+#pragma clang diagnostic pop
+#else
+ GTEST_SKIP() << "no %w in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, snprintf_w_arguments_reordering) {
+#if defined(__BIONIC__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-invalid-specifier"
+#pragma clang diagnostic ignored "-Wformat-extra-args"
+ char buf[BUFSIZ];
+ int32_t a = 0xaaaaaaaa;
+ int64_t b = 0x11111111'22222222;
+ int64_t c = 0x33333333'44444444;
+ int64_t d = 0xaaaaaaaa'aaaaaaaa;
+ snprintf(buf, sizeof(buf), "<%2$w32b --- %1$w64x>", c, a);
+ EXPECT_STREQ("<10101010101010101010101010101010 --- 3333333344444444>", buf);
+ snprintf(buf, sizeof(buf), "<%3$w64b --- %1$w64x --- %2$w64x>", b, c, d);
+ EXPECT_STREQ(
+ "<1010101010101010101010101010101010101010101010101010101010101010 --- 1111111122222222 --- "
+ "3333333344444444>",
+ buf);
+#pragma clang diagnostic pop
+#else
+ GTEST_SKIP() << "no %w in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, snprintf_invalid_w_width) {
+#if defined(__BIONIC__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-invalid-specifier"
+ char buf[BUFSIZ];
+ int32_t a = 100;
+ EXPECT_DEATH(snprintf(buf, sizeof(buf), "%w20d", &a), "%w20 is unsupported");
+#pragma clang diagnostic pop
+#else
+ GTEST_SKIP() << "no %w in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, swprintf_w_base) {
+#if defined(__BIONIC__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-invalid-specifier"
+#pragma clang diagnostic ignored "-Wconstant-conversion"
+ wchar_t buf[BUFSIZ];
+ int8_t a = 0b101;
+ swprintf(buf, sizeof(buf), L"<%w8b>", a);
+ EXPECT_EQ(std::wstring(L"<101>"), buf);
+ int8_t b1 = 0xFF;
+ swprintf(buf, sizeof(buf), L"<%w8d>", b1);
+ EXPECT_EQ(std::wstring(L"<-1>"), buf);
+ int8_t b2 = 0x1FF;
+ swprintf(buf, sizeof(buf), L"<%w8d>", b2);
+ EXPECT_EQ(std::wstring(L"<-1>"), buf);
+ int16_t c = 0xFFFF;
+ swprintf(buf, sizeof(buf), L"<%w16i>", c);
+ EXPECT_EQ(std::wstring(L"<-1>"), buf);
+ int32_t d = 021;
+ swprintf(buf, sizeof(buf), L"<%w32o>", d);
+ EXPECT_EQ(std::wstring(L"<21>"), buf);
+ uint32_t e = -1;
+ swprintf(buf, sizeof(buf), L"<%w32u>", e);
+ EXPECT_EQ(std::wstring(L"<4294967295>"), buf);
+ int64_t f = 0x3b;
+ swprintf(buf, sizeof(buf), L"<%w64x>", f);
+ EXPECT_EQ(std::wstring(L"<3b>"), buf);
+ swprintf(buf, sizeof(buf), L"<%w64X>", f);
+ EXPECT_EQ(std::wstring(L"<3B>"), buf);
+#pragma clang diagnostic pop
+#else
+ GTEST_SKIP() << "no %w in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, swprintf_w_arguments_reordering) {
+#if defined(__BIONIC__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-invalid-specifier"
+#pragma clang diagnostic ignored "-Wformat-extra-args"
+ wchar_t buf[BUFSIZ];
+ int32_t a = 0xaaaaaaaa;
+ int64_t b = 0x11111111'22222222;
+ int64_t c = 0x33333333'44444444;
+ int64_t d = 0xaaaaaaaa'aaaaaaaa;
+ swprintf(buf, sizeof(buf), L"<%2$w32b --- %1$w64x>", c, a);
+ EXPECT_EQ(std::wstring(L"<10101010101010101010101010101010 --- 3333333344444444>"), buf);
+ swprintf(buf, sizeof(buf), L"<%3$w64b --- %1$w64x --- %2$w64x>", b, c, d);
+ EXPECT_EQ(std::wstring(L"<1010101010101010101010101010101010101010101010101010101010101010 --- "
+ L"1111111122222222 --- 3333333344444444>"),
+ buf);
+#pragma clang diagnostic pop
+#else
+ GTEST_SKIP() << "no %w in glibc";
+#endif
+}
+
+TEST(STDIO_TEST, swprintf_invalid_w_width) {
+#if defined(__BIONIC__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-invalid-specifier"
+ wchar_t buf[BUFSIZ];
+ int32_t a = 100;
+ EXPECT_DEATH(swprintf(buf, sizeof(buf), L"%w20d", &a), "%w20 is unsupported");
+#pragma clang diagnostic pop
+#else
+ GTEST_SKIP() << "no %w in glibc";
+#endif
+}
\ No newline at end of file
diff --git a/tests/stdlib_test.cpp b/tests/stdlib_test.cpp
index 465e61a..45169e3 100644
--- a/tests/stdlib_test.cpp
+++ b/tests/stdlib_test.cpp
@@ -494,7 +494,10 @@
TEST(stdlib, system_NULL) {
// "The system() function shall always return non-zero when command is NULL."
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
ASSERT_NE(0, system(nullptr));
+#pragma clang diagnostic pop
}
// https://austingroupbugs.net/view.php?id=1440
@@ -843,11 +846,19 @@
ASSERT_EQ(T(-123), fn("-123", &end_p, 10));
ASSERT_EQ(T(123), fn("+123", &end_p, 10));
+ // If we see "0b" *not* followed by a binary digit, we shouldn't swallow the 'b'.
+ ASSERT_EQ(T(0), fn("0b", &end_p, 2));
+ ASSERT_EQ('b', *end_p);
+
+ // Binary (the "0b" prefix) is case-insensitive.
+ ASSERT_EQ(T(0b101), fn("0b101", &end_p, 0));
+ ASSERT_EQ(T(0b101), fn("0B101", &end_p, 0));
+
// If we see "0x" *not* followed by a hex digit, we shouldn't swallow the 'x'.
ASSERT_EQ(T(0), fn("0xy", &end_p, 16));
ASSERT_EQ('x', *end_p);
- // Hexadecimal (both the 0x and the digits) is case-insensitive.
+ // Hexadecimal (both the "0x" prefix and the digits) is case-insensitive.
ASSERT_EQ(T(0xab), fn("0xab", &end_p, 0));
ASSERT_EQ(T(0xab), fn("0Xab", &end_p, 0));
ASSERT_EQ(T(0xab), fn("0xAB", &end_p, 0));
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
index 8d3fb68..38957e2 100644
--- a/tests/string_test.cpp
+++ b/tests/string_test.cpp
@@ -136,7 +136,7 @@
// A real-time signal.
ASSERT_STREQ("Real-time signal 14", strsignal(SIGRTMIN + 14));
// One of the signals the C library keeps to itself.
- ASSERT_STREQ("Unknown signal 32", strsignal(__SIGRTMIN));
+ ASSERT_STREQ("Unknown signal 32", strsignal(32)); // __SIGRTMIN
// Errors.
ASSERT_STREQ("Unknown signal -1", strsignal(-1)); // Too small.
@@ -1673,3 +1673,15 @@
ASSERT_EQ(nullptr, memccpy(dst, "hello world", ' ', 4));
ASSERT_STREQ("hell", dst);
}
+
+TEST(STRING_TEST, memset_explicit_smoke) {
+#if defined(__BIONIC__)
+ // We can't reliably test that the compiler won't optimize out calls to
+ // memset_explicit(), but we can at least check that it behaves like memset.
+ char buf[32];
+ memset_explicit(buf, 'x', sizeof(buf));
+ ASSERT_TRUE(memcmp(buf, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", sizeof(buf)) == 0);
+#else
+ GTEST_SKIP() << "memset_explicit not available";
+#endif
+}
diff --git a/tests/struct_layout_test.cpp b/tests/struct_layout_test.cpp
index 0123ed9..10c100a 100644
--- a/tests/struct_layout_test.cpp
+++ b/tests/struct_layout_test.cpp
@@ -30,7 +30,7 @@
#define CHECK_OFFSET(name, field, offset) \
check_offset(#name, #field, offsetof(name, field), offset);
#ifdef __LP64__
- CHECK_SIZE(pthread_internal_t, 776);
+ CHECK_SIZE(pthread_internal_t, 784);
CHECK_OFFSET(pthread_internal_t, next, 0);
CHECK_OFFSET(pthread_internal_t, prev, 8);
CHECK_OFFSET(pthread_internal_t, tid, 16);
@@ -55,6 +55,7 @@
CHECK_OFFSET(pthread_internal_t, dlerror_buffer, 248);
CHECK_OFFSET(pthread_internal_t, bionic_tls, 760);
CHECK_OFFSET(pthread_internal_t, errno_value, 768);
+ CHECK_OFFSET(pthread_internal_t, vfork_child_stack_bottom, 776);
CHECK_SIZE(bionic_tls, 12200);
CHECK_OFFSET(bionic_tls, key_data, 0);
CHECK_OFFSET(bionic_tls, locale, 2080);
@@ -72,7 +73,7 @@
CHECK_OFFSET(bionic_tls, bionic_systrace_disabled, 12193);
CHECK_OFFSET(bionic_tls, padding, 12194);
#else
- CHECK_SIZE(pthread_internal_t, 668);
+ CHECK_SIZE(pthread_internal_t, 672);
CHECK_OFFSET(pthread_internal_t, next, 0);
CHECK_OFFSET(pthread_internal_t, prev, 4);
CHECK_OFFSET(pthread_internal_t, tid, 8);
@@ -97,6 +98,7 @@
CHECK_OFFSET(pthread_internal_t, dlerror_buffer, 148);
CHECK_OFFSET(pthread_internal_t, bionic_tls, 660);
CHECK_OFFSET(pthread_internal_t, errno_value, 664);
+ CHECK_OFFSET(pthread_internal_t, vfork_child_stack_bottom, 668);
CHECK_SIZE(bionic_tls, 11080);
CHECK_OFFSET(bionic_tls, key_data, 0);
CHECK_OFFSET(bionic_tls, locale, 1040);
diff --git a/tests/sys_msg_test.cpp b/tests/sys_msg_test.cpp
index 200f654..da45087 100644
--- a/tests/sys_msg_test.cpp
+++ b/tests/sys_msg_test.cpp
@@ -74,9 +74,12 @@
}
TEST(sys_msg, msgctl_failure) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
errno = 0;
ASSERT_EQ(-1, msgctl(-1, IPC_STAT, nullptr));
ASSERT_TRUE(errno == EINVAL || errno == ENOSYS);
+#pragma clang diagnostic pop
}
TEST(sys_msg, msgget_failure) {
@@ -86,9 +89,12 @@
}
TEST(sys_msg, msgrcv_failure) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
errno = 0;
ASSERT_EQ(-1, msgrcv(-1, nullptr, 0, 0, 0));
ASSERT_TRUE(errno == EINVAL || errno == ENOSYS);
+#pragma clang diagnostic pop
}
TEST(sys_msg, msgsnd_failure) {
diff --git a/tests/sys_ptrace_test.cpp b/tests/sys_ptrace_test.cpp
index a079ead..b8c1537 100644
--- a/tests/sys_ptrace_test.cpp
+++ b/tests/sys_ptrace_test.cpp
@@ -257,6 +257,9 @@
asm volatile("stm %0, { r0, r1, r2, r3 }" : : "r"(&data));
#elif defined(__aarch64__)
asm volatile("stp x0, x1, %0" : : "m"(data));
+#elif defined(__riscv)
+ UNUSED(data);
+ GTEST_LOG_(INFO) << "missing riscv64 instruction to store > 64 bits in one instruction";
#endif
}
diff --git a/tests/sys_random_test.cpp b/tests/sys_random_test.cpp
index 2e2665b..e0cbf78 100644
--- a/tests/sys_random_test.cpp
+++ b/tests/sys_random_test.cpp
@@ -48,6 +48,8 @@
}
TEST(sys_random, getentropy_EFAULT) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
#if defined(HAVE_SYS_RANDOM)
errno = 0;
ASSERT_EQ(-1, getentropy(nullptr, 1));
@@ -55,6 +57,7 @@
#else
GTEST_SKIP() << "<sys/random.h> not available";
#endif
+#pragma clang diagnostic pop
}
TEST(sys_random, getentropy_EIO) {
@@ -84,6 +87,8 @@
}
TEST(sys_random, getrandom_EFAULT) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
#if defined(HAVE_SYS_RANDOM)
errno = 0;
ASSERT_EQ(-1, getrandom(nullptr, 256, 0));
@@ -91,6 +96,7 @@
#else
GTEST_SKIP() << "<sys/random.h> not available";
#endif
+#pragma clang diagnostic pop
}
TEST(sys_random, getrandom_EINVAL) {
diff --git a/tests/sys_resource_test.cpp b/tests/sys_resource_test.cpp
index 0247fcb..492fabd 100644
--- a/tests/sys_resource_test.cpp
+++ b/tests/sys_resource_test.cpp
@@ -26,6 +26,7 @@
ASSERT_NE(sizeof(rlimit), sizeof(rlimit64));
ASSERT_EQ(4U, sizeof(rlim_t));
#endif
+ ASSERT_EQ(8U, sizeof(rlim64_t));
}
class SysResourceTest : public ::testing::Test {
diff --git a/tests/sys_sysinfo_test.cpp b/tests/sys_sysinfo_test.cpp
index cca2f44..69656ad 100644
--- a/tests/sys_sysinfo_test.cpp
+++ b/tests/sys_sysinfo_test.cpp
@@ -43,7 +43,7 @@
memset(&si, 0, sizeof(si));
ASSERT_EQ(0, sysinfo(&si));
- ASSERT_GT(si.uptime, 10); // You're not running CTS within 10s of booting!
+ ASSERT_GT(static_cast<long>(si.uptime), 10); // You're not running CTS within 10s of booting!
ASSERT_GT(uint64_t(si.totalram) * si.mem_unit, uint64_t(512 * 1024 * 1024));
ASSERT_GE(si.totalram, si.freeram);
ASSERT_GE(si.totalswap, si.freeswap);
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 5fc4cad..0dcbcd2 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -84,6 +84,16 @@
ASSERT_EQ(1970, broken_down->tm_year + 1900);
}
+TEST(time, mktime_TZ_as_UTC_and_offset) {
+ struct tm tm = {.tm_year = 70, .tm_mon = 0, .tm_mday = 1};
+
+ // This TZ value is not a valid Olson ID and is not present in tzdata file,
+ // but is a valid TZ string according to POSIX standard.
+ setenv("TZ", "UTC+08:00:00", 1);
+ tzset();
+ ASSERT_EQ(static_cast<time_t>(8 * 60 * 60), mktime(&tm));
+}
+
static void* gmtime_no_stack_overflow_14313703_fn(void*) {
const char* original_tz = getenv("TZ");
// Ensure we'll actually have to enter tzload by using a time zone that doesn't exist.
@@ -134,15 +144,11 @@
}
TEST(time, mktime_10310929) {
- struct tm t;
- memset(&t, 0, sizeof(tm));
- t.tm_year = 200;
- t.tm_mon = 2;
- t.tm_mday = 10;
+ struct tm tm = {.tm_year = 2100 - 1900, .tm_mon = 2, .tm_mday = 10};
#if !defined(__LP64__)
// 32-bit bionic has a signed 32-bit time_t.
- ASSERT_EQ(-1, mktime(&t));
+ ASSERT_EQ(-1, mktime(&tm));
ASSERT_EQ(EOVERFLOW, errno);
#else
// Everyone else should be using a signed 64-bit time_t.
@@ -151,18 +157,19 @@
setenv("TZ", "America/Los_Angeles", 1);
tzset();
errno = 0;
- ASSERT_EQ(static_cast<time_t>(4108348800U), mktime(&t));
- ASSERT_EQ(0, errno);
- setenv("TZ", "UTC", 1);
- tzset();
- errno = 0;
- ASSERT_EQ(static_cast<time_t>(4108320000U), mktime(&t));
+ // On the date/time specified by tm America/Los_Angeles
+ // follows DST. But tm_isdst is set to 0, which forces
+ // mktime to interpret that time as local standard, hence offset
+ // is 8 hours, not 7.
+ ASSERT_EQ(static_cast<time_t>(4108348800U), mktime(&tm));
ASSERT_EQ(0, errno);
#endif
}
-TEST(time, mktime_EOVERFLOW) {
+TEST(time, DISABLED_mktime_EOVERFLOW) {
+ setenv("TZ", "UTC", 1);
+
struct tm t;
memset(&t, 0, sizeof(tm));
@@ -184,6 +191,43 @@
ASSERT_EQ(EOVERFLOW, errno);
}
+TEST(time, mktime_invalid_tm_TZ_combination) {
+ setenv("TZ", "UTC", 1);
+
+ struct tm t;
+ memset(&t, 0, sizeof(tm));
+ t.tm_year = 2022 - 1900;
+ t.tm_mon = 11;
+ t.tm_mday = 31;
+ // UTC does not observe DST
+ t.tm_isdst = 1;
+
+ errno = 0;
+
+ EXPECT_EQ(static_cast<time_t>(-1), mktime(&t));
+ // mktime sets errno to EOVERFLOW if result is unrepresentable.
+ EXPECT_EQ(EOVERFLOW, errno);
+}
+
+// Transitions in the tzdata file are generated up to the year 2100. Testing
+// that dates beyond that are handled properly too.
+TEST(time, mktime_after_2100) {
+ struct tm tm = {.tm_year = 2150 - 1900, .tm_mon = 2, .tm_mday = 10, .tm_isdst = -1};
+
+#if !defined(__LP64__)
+ // 32-bit bionic has a signed 32-bit time_t.
+ ASSERT_EQ(-1, mktime(&tm));
+ ASSERT_EQ(EOVERFLOW, errno);
+#else
+ setenv("TZ", "Europe/London", 1);
+ tzset();
+ errno = 0;
+
+ ASSERT_EQ(static_cast<time_t>(5686156800U), mktime(&tm));
+ ASSERT_EQ(0, errno);
+#endif
+}
+
TEST(time, strftime) {
setenv("TZ", "UTC", 1);
@@ -206,7 +250,25 @@
EXPECT_STREQ("Sun Mar 10 00:00:00 2100", buf);
}
-TEST(time, strftime_null_tm_zone) {
+TEST(time, strftime_second_before_epoch) {
+ setenv("TZ", "UTC", 1);
+
+ struct tm t;
+ memset(&t, 0, sizeof(tm));
+ t.tm_year = 1969 - 1900;
+ t.tm_mon = 11;
+ t.tm_mday = 31;
+ t.tm_hour = 23;
+ t.tm_min = 59;
+ t.tm_sec = 59;
+
+ char buf[64];
+
+ EXPECT_EQ(2U, strftime(buf, sizeof(buf), "%s", &t));
+ EXPECT_STREQ("-1", buf);
+}
+
+TEST(time, strftime_Z_null_tm_zone) {
// Netflix on Nexus Player wouldn't start (http://b/25170306).
struct tm t;
memset(&t, 0, sizeof(tm));
@@ -244,6 +306,86 @@
#endif
}
+// According to C language specification the only tm struct field needed to
+// find out replacement for %z and %Z in strftime is tm_isdst. Which is
+// wrong, as time zones change their standard offset and even DST savings.
+// tzcode deviates from C language specification and requires tm struct either
+// to be output of localtime-like functions or to be modified by mktime call
+// before passing to strftime. See tz mailing discussion for more details
+// https://mm.icann.org/pipermail/tz/2022-July/031674.html
+// But we are testing case when tm.tm_zone is null, which means that tm struct
+// is not coming from localtime and is neither modified by mktime. That's why
+// we are comparing against +0000, even though America/Los_Angeles never
+// observes it.
+TEST(time, strftime_z_null_tm_zone) {
+ char str[64];
+ struct tm tm = {.tm_year = 109, .tm_mon = 4, .tm_mday = 2, .tm_isdst = 0};
+
+ setenv("TZ", "America/Los_Angeles", 1);
+ tzset();
+
+ tm.tm_zone = NULL;
+
+ size_t result = strftime(str, sizeof(str), "%z", &tm);
+
+ EXPECT_EQ(5U, result);
+ EXPECT_STREQ("+0000", str);
+
+ tm.tm_isdst = 1;
+
+ result = strftime(str, sizeof(str), "%z", &tm);
+
+ EXPECT_EQ(5U, result);
+ EXPECT_STREQ("+0000", str);
+
+ setenv("TZ", "UTC", 1);
+ tzset();
+
+ tm.tm_isdst = 0;
+
+ result = strftime(str, sizeof(str), "%z", &tm);
+
+ EXPECT_EQ(5U, result);
+ EXPECT_STREQ("+0000", str);
+
+ tm.tm_isdst = 1;
+
+ result = strftime(str, sizeof(str), "%z", &tm);
+
+ EXPECT_EQ(5U, result);
+ EXPECT_STREQ("+0000", str);
+}
+
+TEST(time, strftime_z_Europe_Lisbon) {
+ char str[64];
+ // During 1992-1996 Europe/Lisbon standard offset was 1 hour.
+ // tm_isdst is not set as it will be overridden by mktime call anyway.
+ struct tm tm = {.tm_year = 1996 - 1900, .tm_mon = 2, .tm_mday = 13};
+
+ setenv("TZ", "Europe/Lisbon", 1);
+ tzset();
+
+ // tzcode's strftime implementation for %z relies on prior mktime call.
+ // At the moment of writing %z value is taken from tm_gmtoff. So without
+ // mktime call %z is replaced with +0000.
+ // See https://mm.icann.org/pipermail/tz/2022-July/031674.html
+ mktime(&tm);
+
+ size_t result = strftime(str, sizeof(str), "%z", &tm);
+
+ EXPECT_EQ(5U, result);
+ EXPECT_STREQ("+0100", str);
+
+ // Now standard offset is 0.
+ tm = {.tm_year = 2022 - 1900, .tm_mon = 2, .tm_mday = 13};
+
+ mktime(&tm);
+ result = strftime(str, sizeof(str), "%z", &tm);
+
+ EXPECT_EQ(5U, result);
+ EXPECT_STREQ("+0000", str);
+}
+
TEST(time, strftime_l) {
locale_t cloc = newlocale(LC_ALL, "C.UTF-8", nullptr);
locale_t old_locale = uselocale(cloc);
@@ -858,6 +1000,10 @@
ASSERT_EQ(-1, ts.tv_sec);
}
+TEST(time, clock_getres_null_resolution) {
+ ASSERT_EQ(0, clock_getres(CLOCK_REALTIME, nullptr));
+}
+
TEST(time, clock) {
// clock(3) is hard to test, but a 1s sleep should cost less than 10ms on average.
static const clock_t N = 5;
diff --git a/tests/uchar_test.cpp b/tests/uchar_test.cpp
index 4dc6314..703f558 100644
--- a/tests/uchar_test.cpp
+++ b/tests/uchar_test.cpp
@@ -112,7 +112,7 @@
ASSERT_EQ(0U, mbrtoc16(nullptr, nullptr, 0, nullptr));
}
-TEST(uchar, mbrtoc16_zero_len) {
+TEST(uchar, DISABLED_mbrtoc16_zero_len) {
char16_t out;
out = L'x';
@@ -125,7 +125,7 @@
ASSERT_EQ(L'h', out);
}
-TEST(uchar, mbrtoc16) {
+TEST(uchar, DISABLED_mbrtoc16) {
char16_t out;
ASSERT_STREQ("C.UTF-8", setlocale(LC_CTYPE, "C.UTF-8"));
@@ -196,7 +196,7 @@
ASSERT_EQ(EILSEQ, errno);
}
-TEST(uchar, mbrtoc16_incomplete) {
+TEST(uchar, DISABLED_mbrtoc16_incomplete) {
mbstate_t ps;
memset(&ps, 0, sizeof(ps));
@@ -271,7 +271,7 @@
ASSERT_EQ(EILSEQ, errno);
}
-TEST(uchar, mbrtoc32) {
+TEST(uchar, DISABLED_mbrtoc32) {
char32_t out[8];
out[0] = L'x';
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 6d7e687..4c21627 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -294,10 +294,13 @@
}
TEST(UNISTD_TEST, setenv_EINVAL) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
EXPECT_EQ(-1, setenv(nullptr, "value", 0));
EXPECT_EQ(EINVAL, errno);
EXPECT_EQ(-1, setenv(nullptr, "value", 1));
EXPECT_EQ(EINVAL, errno);
+#pragma clang diagnostic pop
EXPECT_EQ(-1, setenv("", "value", 0));
EXPECT_EQ(EINVAL, errno);
EXPECT_EQ(-1, setenv("", "value", 1));
@@ -586,9 +589,10 @@
TestGetTidCachingWithFork(CloneAndSetTid, exit);
}
+__attribute__((no_sanitize("hwaddress", "memtag")))
static int CloneStartRoutine(int (*start_routine)(void*)) {
void* child_stack[1024];
- return clone(start_routine, untag_address(&child_stack[1024]), SIGCHLD, nullptr);
+ return clone(start_routine, &child_stack[1024], SIGCHLD, nullptr);
}
static int GetPidCachingCloneStartRoutine(void*) {
@@ -1103,6 +1107,10 @@
ASSERT_EQ(4, GetCpuCountFromString("0, 1-2, 4\n"));
}
+TEST(UNISTD_TEST, sysconf_SC_NPROCESSORS_make_sense) {
+ ASSERT_LE(sysconf(_SC_NPROCESSORS_ONLN), sysconf(_SC_NPROCESSORS_CONF));
+}
+
TEST(UNISTD_TEST, sysconf_SC_NPROCESSORS_ONLN) {
std::string line;
ASSERT_TRUE(android::base::ReadFileToString("/sys/devices/system/cpu/online", &line));
@@ -1648,3 +1656,41 @@
auto t1 = std::chrono::steady_clock::now();
ASSERT_GE(t1-t0, 1s);
}
+
+TEST(UNISTD_TEST, close_range) {
+#if defined(__GLIBC__)
+ GTEST_SKIP() << "glibc too old";
+#elif defined(ANDROID_HOST_MUSL)
+ GTEST_SKIP() << "musl does not have close_range";
+#else // __GLIBC__
+ int fd = open("/proc/version", O_RDONLY);
+ ASSERT_GE(fd, 0);
+
+ // Try to close the file descriptor (this requires a 5.9+ kernel)
+ if (close_range(fd, fd, 0) == 0) {
+ // we can't close it *again*
+ ASSERT_EQ(close(fd), -1);
+ ASSERT_EQ(errno, EBADF);
+ } else {
+ ASSERT_EQ(errno, ENOSYS);
+ // since close_range() failed, we can close it normally
+ ASSERT_EQ(close(fd), 0);
+ }
+#endif // __GLIBC__
+}
+
+TEST(UNISTD_TEST, copy_file_range) {
+#if defined(__GLIBC__)
+ GTEST_SKIP() << "glibc too old";
+#else // __GLIBC__
+ TemporaryFile tf;
+ ASSERT_TRUE(android::base::WriteStringToFd("hello world", tf.fd));
+ ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0));
+ TemporaryFile tf2;
+ ASSERT_EQ(11, copy_file_range(tf.fd, NULL, tf2.fd, NULL, 11, 0));
+ ASSERT_EQ(0, lseek(tf2.fd, SEEK_SET, 0));
+ std::string content;
+ ASSERT_TRUE(android::base::ReadFdToString(tf2.fd, &content));
+ ASSERT_EQ("hello world", content);
+#endif // __GLIBC__
+}
diff --git a/tests/utils.cpp b/tests/utils.cpp
new file mode 100644
index 0000000..92ab145
--- /dev/null
+++ b/tests/utils.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "utils.h"
+
+#include <string>
+
+#include <android-base/properties.h>
+
+void RunGwpAsanTest(const char* test_name) {
+ ExecTestHelper eh;
+ eh.SetEnv({"GWP_ASAN_SAMPLE_RATE=1", "GWP_ASAN_PROCESS_SAMPLING=1", "GWP_ASAN_MAX_ALLOCS=40000",
+ nullptr});
+ std::string filter_arg = "--gtest_filter=";
+ filter_arg += test_name;
+ std::string exec(testing::internal::GetArgvs()[0]);
+ eh.SetArgs({exec.c_str(), "--gtest_also_run_disabled_tests", filter_arg.c_str(), nullptr});
+ eh.Run([&]() { execve(exec.c_str(), eh.GetArgs(), eh.GetEnv()); },
+ /* expected_exit_status */ 0,
+ // |expected_output_regex|, ensure at least one test ran:
+ R"(\[ PASSED \] [1-9][0-9]* test)");
+}
+
+void RunSubtestNoEnv(const char* test_name) {
+ ExecTestHelper eh;
+ std::string filter_arg = "--gtest_filter=";
+ filter_arg += test_name;
+ std::string exec(testing::internal::GetArgvs()[0]);
+ eh.SetArgs({exec.c_str(), "--gtest_also_run_disabled_tests", filter_arg.c_str(), nullptr});
+ eh.Run([&]() { execve(exec.c_str(), eh.GetArgs(), eh.GetEnv()); },
+ /* expected_exit_status */ 0,
+ // |expected_output_regex|, ensure at least one test ran:
+ R"(\[ PASSED \] [1-9]+0? test)");
+}
+
+bool IsLowRamDevice() {
+ return android::base::GetBoolProperty("ro.config.low_ram", false) ||
+ (android::base::GetBoolProperty("ro.debuggable", false) &&
+ android::base::GetBoolProperty("debug.force_low_ram", false));
+}
diff --git a/tests/utils.h b/tests/utils.h
index 72214c2..2e00cc1 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -19,6 +19,7 @@
#include <dirent.h>
#include <dlfcn.h>
#include <fcntl.h>
+#include <gtest/gtest.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <sys/prctl.h>
@@ -264,6 +265,7 @@
};
void RunGwpAsanTest(const char* test_name);
+void RunSubtestNoEnv(const char* test_name);
#endif
class FdLeakChecker {
@@ -311,3 +313,5 @@
return false;
#endif
}
+
+bool IsLowRamDevice();
diff --git a/tests/utmp_test.cpp b/tests/utmp_test.cpp
index 6d0d6f1..459f9c3 100644
--- a/tests/utmp_test.cpp
+++ b/tests/utmp_test.cpp
@@ -25,9 +25,11 @@
}
TEST(utmp, smoke) {
+ // The rest of <utmp.h> is just no-op implementations, so testing is trivial.
ASSERT_EQ(-1, utmpname("hello"));
setutent();
ASSERT_EQ(NULL, getutent());
endutent();
- ASSERT_EQ(NULL, pututline(NULL));
+ utmp failure = {.ut_type = EMPTY};
+ ASSERT_EQ(NULL, pututline(&failure));
}
diff --git a/libc/include/android/legacy_sys_stat_inlines.h b/tests/utmpx_test.cpp
similarity index 76%
rename from libc/include/android/legacy_sys_stat_inlines.h
rename to tests/utmpx_test.cpp
index d42ac01..55427a6 100644
--- a/libc/include/android/legacy_sys_stat_inlines.h
+++ b/tests/utmpx_test.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,20 +26,17 @@
* SUCH DAMAGE.
*/
-#pragma once
+#include <gtest/gtest.h>
-#include <sys/cdefs.h>
+#include <utmpx.h>
-#if __ANDROID_API__ < 21
-
-#include <sys/stat.h>
-
-__BEGIN_DECLS
-
-static __inline int mkfifo(const char* __path, mode_t __mode) {
- return mknod(__path, (__mode & ~S_IFMT) | S_IFIFO, (dev_t)0);
+TEST(utmpx, smoke) {
+ // Our utmpx "implementation" just calls the utmp no-op functions.
+ setutxent();
+ utmpx empty = {.ut_type = EMPTY};
+ ASSERT_EQ(NULL, getutxent());
+ ASSERT_EQ(NULL, getutxid(&empty));
+ ASSERT_EQ(NULL, getutxline(&empty));
+ endutxent();
+ ASSERT_EQ(NULL, pututxline(&empty));
}
-
-__END_DECLS
-
-#endif
diff --git a/tests/wchar_test.cpp b/tests/wchar_test.cpp
index 85a75ec..07eef1b 100644
--- a/tests/wchar_test.cpp
+++ b/tests/wchar_test.cpp
@@ -34,7 +34,7 @@
EXPECT_EQ(4U, sizeof(wint_t));
}
-TEST(wchar, mbrlen) {
+TEST(wchar, DISABLED_mbrlen) {
char bytes[] = { 'h', 'e', 'l', 'l', 'o', '\0' };
EXPECT_EQ(0U, mbrlen(&bytes[0], 0, nullptr));
EXPECT_EQ(1U, mbrlen(&bytes[0], 1, nullptr));
@@ -252,7 +252,7 @@
ASSERT_TRUE(wcsstr(L"romrom", L"rom") != nullptr);
}
-TEST(wchar, mbtowc) {
+TEST(wchar, DISABLED_mbtowc) {
wchar_t out[8];
out[0] = 'x';
@@ -271,7 +271,7 @@
ASSERT_EQ(0, mbtowc(nullptr, nullptr, 0));
}
-TEST(wchar, mbrtowc) {
+TEST(wchar, DISABLED_mbrtowc) {
wchar_t out[8];
out[0] = 'x';
@@ -460,6 +460,7 @@
TestSingleWcsToInt(fn, L" 123 45", 0, static_cast<T>(123), 6);
TestSingleWcsToInt(fn, L" -123", 0, static_cast<T>(-123), 6);
TestSingleWcsToInt(fn, L"0x10000", 0, static_cast<T>(65536), 7);
+ TestSingleWcsToInt(fn, L"0b1011", 0, static_cast<T>(0b1011), 6);
}
template <typename T>
@@ -713,7 +714,8 @@
#if defined(__BIONIC__)
wchar_t* p;
size_t size;
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
// Invalid buffer.
errno = 0;
ASSERT_EQ(nullptr, open_wmemstream(nullptr, &size));
@@ -723,6 +725,7 @@
errno = 0;
ASSERT_EQ(nullptr, open_wmemstream(&p, nullptr));
ASSERT_EQ(EINVAL, errno);
+#pragma clang diagnostic pop
#else
GTEST_SKIP() << "This test is bionic-specific";
#endif
diff --git a/tools/Android.bp b/tools/Android.bp
index dcd2a7d..d3ca28a 100644
--- a/tools/Android.bp
+++ b/tools/Android.bp
@@ -15,7 +15,7 @@
subdirs = ["*"]
-filegroup {
- name: "bionic-generate-version-script",
+python_binary_host {
+ name: "generate-version-script",
srcs: ["generate-version-script.py"],
}
diff --git a/tools/generate-version-script.py b/tools/generate-version-script.py
index def621e..fab46b9 100755
--- a/tools/generate-version-script.py
+++ b/tools/generate-version-script.py
@@ -8,7 +8,7 @@
import sys
def has_arch_tags(tags):
- for arch in ["arm", "arm64", "x86", "x86_64"]:
+ for arch in ["arm", "arm64", "riscv64", "x86", "x86_64"]:
if arch in tags:
return True
return False
diff --git a/tools/versioner/src/Arch.cpp b/tools/versioner/src/Arch.cpp
index 3a27a6e..d4d0208 100644
--- a/tools/versioner/src/Arch.cpp
+++ b/tools/versioner/src/Arch.cpp
@@ -28,6 +28,9 @@
case Arch::arm64:
return "arm64";
+ case Arch::riscv64:
+ return "riscv64";
+
case Arch::x86:
return "x86";
@@ -41,6 +44,7 @@
static const std::unordered_map<std::string, Arch> arch_name_map{
{"arm", Arch::arm},
{"arm64", Arch::arm64},
+ {"riscv64", Arch::riscv64},
{"x86", Arch::x86},
{"x86_64", Arch::x86_64},
};
diff --git a/tools/versioner/src/Arch.h b/tools/versioner/src/Arch.h
index 74d0f8f..fd98abc 100644
--- a/tools/versioner/src/Arch.h
+++ b/tools/versioner/src/Arch.h
@@ -28,6 +28,7 @@
enum class Arch : size_t {
arm = 0,
arm64,
+ riscv64,
x86,
x86_64,
};
@@ -121,6 +122,7 @@
static const std::set<Arch> supported_archs = {
Arch::arm,
Arch::arm64,
+ Arch::riscv64,
Arch::x86,
Arch::x86_64,
};
@@ -128,17 +130,19 @@
static ArchMap<std::string> arch_targets = {
{ Arch::arm, "arm-linux-androideabi" },
{ Arch::arm64, "aarch64-linux-android" },
+ { Arch::riscv64, "riscv64-linux-android" },
{ Arch::x86, "i686-linux-android" },
{ Arch::x86_64, "x86_64-linux-android" },
};
static const std::set<int> default_levels = {
- 14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30,
+ 14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34,
};
static const ArchMap<int> arch_min_api = {
{ Arch::arm, 9 },
{ Arch::arm64, 21 },
+ { Arch::riscv64, 10000 },
{ Arch::x86, 9 },
{ Arch::x86_64, 21 },
};
@@ -160,4 +164,7 @@
{"P", 28},
{"Q", 29},
{"R", 30},
+ {"S", 31},
+ {"T", 33},
+ {"U", 34},
};
diff --git a/tools/versioner/src/DeclarationDatabase.cpp b/tools/versioner/src/DeclarationDatabase.cpp
index ec2e38d..a029c3b 100644
--- a/tools/versioner/src/DeclarationDatabase.cpp
+++ b/tools/versioner/src/DeclarationDatabase.cpp
@@ -170,6 +170,7 @@
&arch_availability[Arch::x86].introduced } },
{ "introduced_in_64",
{ &arch_availability[Arch::arm64].introduced,
+ &arch_availability[Arch::riscv64].introduced,
&arch_availability[Arch::x86_64].introduced } },
};
diff --git a/tools/versioner/src/Preprocessor.cpp b/tools/versioner/src/Preprocessor.cpp
index eb88c46..14f80d8 100644
--- a/tools/versioner/src/Preprocessor.cpp
+++ b/tools/versioner/src/Preprocessor.cpp
@@ -141,11 +141,12 @@
static const std::vector<std::pair<std::string, std::set<Arch>>> arch_sets = {
{ "", supported_archs },
{ "!defined(__LP64__)", { Arch::arm, Arch::x86 } },
- { "defined(__LP64__)", { Arch::arm64, Arch::x86_64 } },
+ { "defined(__LP64__)", { Arch::arm64, Arch::riscv64, Arch::x86_64 } },
};
std::map<Arch, std::string> individual_archs = {
{ Arch::arm, "defined(__arm__)" },
{ Arch::arm64, "defined(__aarch64__)" },
+ { Arch::riscv64, "defined(__riscv)" },
{ Arch::x86, "defined(__i386__)" },
{ Arch::x86_64, "defined(__x86_64__)" },
};
diff --git a/tools/versioner/src/versioner.h b/tools/versioner/src/versioner.h
index e9c4989..225e14b 100644
--- a/tools/versioner/src/versioner.h
+++ b/tools/versioner/src/versioner.h
@@ -39,5 +39,5 @@
{ "sys/_system_properties.h", supported_archs },
// time64.h #errors when included on LP64 archs.
- { "time64.h", { Arch::arm64, Arch::x86_64 } },
+ { "time64.h", { Arch::arm64, Arch::riscv64, Arch::x86_64 } },
};