Merge changes from topic "import-lib-access"

* changes:
  Ignore symbols of imported libs' dependencies
  Comment two linker namespace functions
  Rename dlsym_handle_lookup:6 to dlsym_handle_lookup_impl
diff --git a/.clang-format b/.clang-format
deleted file mode 100644
index 7630d16..0000000
--- a/.clang-format
+++ /dev/null
@@ -1,15 +0,0 @@
-BasedOnStyle: Google
-AllowShortBlocksOnASingleLine: false
-AllowShortFunctionsOnASingleLine: false
-
-ColumnLimit: 100
-CommentPragmas: NOLINT:.*
-DerivePointerAlignment: false
-IndentWidth: 2
-PointerAlignment: Left
-TabWidth: 2
-UseTab: Never
-PenaltyExcessCharacter: 32
-
-Cpp11BracedListStyle: false
-IncludeBlocks: Preserve
\ No newline at end of file
diff --git a/.clang-format b/.clang-format
new file mode 120000
index 0000000..4cefd65
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1 @@
+../system/core/.clang-format-2
\ No newline at end of file
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 7b533a4..11d9fe6 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,2 +1,8 @@
 [Hook Scripts]
 notice = tools/update_notice.sh
+
+[Builtin Hooks]
+clang_format = true
+
+[Builtin Hooks Options]
+clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 7aeb09e..9f60ae7 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -4,6 +4,9 @@
       "name": "CtsBionicTestCases"
     },
     {
+      "name": "fdtrack_test"
+    },
+    {
       "name": "malloc_debug_system_tests"
     },
     {
diff --git a/benchmarks/property_benchmark.cpp b/benchmarks/property_benchmark.cpp
index ba54ed1..15a621b 100644
--- a/benchmarks/property_benchmark.cpp
+++ b/benchmarks/property_benchmark.cpp
@@ -20,6 +20,7 @@
 #include <unistd.h>
 
 #include <string>
+#include <vector>
 
 #include <android-base/file.h>
 
@@ -192,4 +193,30 @@
 }
 BIONIC_BENCHMARK_WITH_ARG(BM_property_serial, "NUM_PROPS");
 
+// This benchmarks find the actual properties currently set on the system and accessible by the
+// user that runs this benchmark (aka this is best run as root).  It is not comparable between
+// devices, nor even boots, but is useful to understand the the real end-to-end speed, including
+// costs to find the correct property file within /dev/__properties__.
+static void BM_property_find_real(benchmark::State& state) {
+  std::vector<std::string> properties;
+  __system_property_foreach(
+      [](const prop_info* pi, void* cookie) {
+        __system_property_read_callback(pi,
+                                        [](void* cookie, const char* name, const char*, unsigned) {
+                                          auto properties =
+                                              reinterpret_cast<std::vector<std::string>*>(cookie);
+                                          properties->emplace_back(name);
+                                        },
+                                        cookie);
+      },
+      &properties);
+
+  while (state.KeepRunning()) {
+    for (const auto& property : properties) {
+      __system_property_find(property.c_str());
+    }
+  }
+}
+BIONIC_BENCHMARK(BM_property_find_real);
+
 #endif  // __BIONIC__
diff --git a/benchmarks/stdlib_benchmark.cpp b/benchmarks/stdlib_benchmark.cpp
index 61b51fa..45b953f 100644
--- a/benchmarks/stdlib_benchmark.cpp
+++ b/benchmarks/stdlib_benchmark.cpp
@@ -59,6 +59,41 @@
 BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_malloc_free_decay1, "AT_COMMON_SIZES");
 #endif
 
+static void CallocFree(benchmark::State& state) {
+  const size_t nbytes = state.range(0);
+  int pagesize = getpagesize();
+
+  for (auto _ : state) {
+    void* ptr;
+    benchmark::DoNotOptimize(ptr = calloc(1, nbytes));
+    MakeAllocationResident(ptr, nbytes, pagesize);
+    free(ptr);
+  }
+
+  state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes));
+}
+
+static void BM_stdlib_calloc_free_default(benchmark::State& state) {
+#if defined(__BIONIC__)
+  // The default is expected to be a zero decay time.
+  mallopt(M_DECAY_TIME, 0);
+#endif
+
+  CallocFree(state);
+}
+BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_calloc_free_default, "AT_COMMON_SIZES");
+
+#if defined(__BIONIC__)
+static void BM_stdlib_calloc_free_decay1(benchmark::State& state) {
+  mallopt(M_DECAY_TIME, 1);
+
+  CallocFree(state);
+
+  mallopt(M_DECAY_TIME, 0);
+}
+BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_calloc_free_decay1, "AT_COMMON_SIZES");
+#endif
+
 static void MallocMultiple(benchmark::State& state, size_t nbytes, size_t numAllocs) {
   int pagesize = getpagesize();
   void* ptrs[numAllocs];
diff --git a/benchmarks/unistd_benchmark.cpp b/benchmarks/unistd_benchmark.cpp
index d697dfd..f0a3089 100644
--- a/benchmarks/unistd_benchmark.cpp
+++ b/benchmarks/unistd_benchmark.cpp
@@ -14,9 +14,16 @@
  * limitations under the License.
  */
 
+#include <errno.h>
+#include <string.h>
 #include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 #include <unistd.h>
 
+#include <string>
+
+#include <android-base/stringprintf.h>
 #include <benchmark/benchmark.h>
 #include "util.h"
 
@@ -28,3 +35,35 @@
 BIONIC_TRIVIAL_BENCHMARK(BM_unistd_gettid, gettid());
 #endif
 BIONIC_TRIVIAL_BENCHMARK(BM_unistd_gettid_syscall, syscall(__NR_gettid));
+
+// Many native allocators have custom prefork and postfork functions.
+// Measure the fork call to make sure nothing takes too long.
+void BM_unistd_fork_call(benchmark::State& state) {
+  for (auto _ : state) {
+    pid_t pid;
+    if ((pid = fork()) == 0) {
+      // Sleep for a little while so that the parent is not interrupted
+      // right away when the process exits.
+      usleep(100);
+      _exit(1);
+    }
+    state.PauseTiming();
+    if (pid == -1) {
+      std::string err = android::base::StringPrintf("Fork failed: %s", strerror(errno));
+      state.SkipWithError(err.c_str());
+    }
+    pid_t wait_pid = waitpid(pid, 0, 0);
+    if (wait_pid != pid) {
+      if (wait_pid == -1) {
+        std::string err = android::base::StringPrintf("waitpid call failed: %s", strerror(errno));
+        state.SkipWithError(err.c_str());
+      } else {
+        std::string err = android::base::StringPrintf(
+            "waitpid return an unknown pid, expected %d, actual %d", pid, wait_pid);
+        state.SkipWithError(err.c_str());
+      }
+    }
+    state.ResumeTiming();
+  }
+}
+BIONIC_BENCHMARK(BM_unistd_fork_call);
diff --git a/libc/Android.bp b/libc/Android.bp
index ef1bbe8..84b4b12 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1085,7 +1085,7 @@
         "bionic/clone.cpp",
         "bionic/ctype.cpp",
         "bionic/dirent.cpp",
-        "bionic/dup2.cpp",
+        "bionic/dup.cpp",
         "bionic/environ.cpp",
         "bionic/error.cpp",
         "bionic/eventfd_read.cpp",
@@ -1094,7 +1094,9 @@
         "bionic/faccessat.cpp",
         "bionic/fchmod.cpp",
         "bionic/fchmodat.cpp",
+        "bionic/fcntl.cpp",
         "bionic/fdsan.cpp",
+        "bionic/fdtrack.cpp",
         "bionic/ffs.cpp",
         "bionic/fgetxattr.cpp",
         "bionic/flistxattr.cpp",
@@ -1163,6 +1165,7 @@
         "bionic/realpath.cpp",
         "bionic/reboot.cpp",
         "bionic/recv.cpp",
+        "bionic/recvmsg.cpp",
         "bionic/rename.cpp",
         "bionic/rmdir.cpp",
         "bionic/scandir.cpp",
@@ -1283,12 +1286,14 @@
         // The following implementations depend on pthread data or implementation,
         // so we can't include them in libc_ndk.a.
         "bionic/__cxa_thread_atexit_impl.cpp",
+        "bionic/android_unsafe_frame_pointer_chase.cpp",
         "stdlib/atexit.c",
         "bionic/fork.cpp",
     ],
 
     cppflags: ["-Wold-style-cast"],
     include_dirs: ["bionic/libstdc++/include"],
+    header_libs: ["bionic_libc_platform_headers"],
     name: "libc_pthread",
 }
 
@@ -1797,7 +1802,7 @@
     name: "bionic_libc_platform_headers",
     visibility: [
         "//art:__subpackages__",
-        "//bionic/libc:__subpackages__",
+        "//bionic:__subpackages__",
         "//frameworks:__subpackages__",
         "//external/perfetto:__subpackages__",
         "//external/scudo:__subpackages__",
@@ -1856,16 +1861,6 @@
                 "kernel/uapi/asm-arm64",
             ],
         },
-        mips: {
-            export_include_dirs: [
-                "kernel/uapi/asm-mips",
-            ],
-        },
-        mips64: {
-            export_include_dirs: [
-                "kernel/uapi/asm-mips",
-            ],
-        },
         x86: {
             export_include_dirs: [
                 "kernel/uapi/asm-x86",
@@ -2192,24 +2187,6 @@
     license: "NOTICE",
 }
 
-// Not actually used in the NDK, but needed to build AOSP for mips.
-ndk_headers {
-    name: "libc_asm_mips",
-    from: "kernel/uapi/asm-mips",
-    to: "mipsel-linux-android",
-    srcs: ["kernel/uapi/asm-mips/**/*.h"],
-    license: "NOTICE",
-}
-
-// Not actually used in the NDK, but needed to build AOSP for mips64.
-ndk_headers {
-    name: "libc_asm_mips64",
-    from: "kernel/uapi/asm-mips",
-    to: "mips64el-linux-android",
-    srcs: ["kernel/uapi/asm-mips/**/*.h"],
-    license: "NOTICE",
-}
-
 ndk_headers {
     name: "libc_asm_x86",
     from: "kernel/uapi/asm-x86",
@@ -2255,16 +2232,6 @@
                 "kernel/uapi/asm-arm64",
             ],
         },
-        mips: {
-            export_include_dirs: [
-                "kernel/uapi/asm-mips",
-            ],
-        },
-        mips64: {
-            export_include_dirs: [
-                "kernel/uapi/asm-mips",
-            ],
-        },
         x86: {
             export_include_dirs: [
                 "kernel/uapi/asm-x86",
@@ -2349,30 +2316,6 @@
     ],
 }
 
-cc_object {
-    name: "libseccomp_gen_syscall_nrs_mips",
-    defaults: ["libseccomp_gen_syscall_nrs_defaults"],
-    cflags: [
-        "-D_MIPS_SIM=_MIPS_SIM_ABI32",
-    ],
-    local_include_dirs: [
-        "kernel/uapi/asm-mips",
-        "kernel/uapi",
-    ],
-}
-
-cc_object {
-    name: "libseccomp_gen_syscall_nrs_mips64",
-    defaults: ["libseccomp_gen_syscall_nrs_defaults"],
-    cflags: [
-        "-D_MIPS_SIM=_MIPS_SIM_ABI64",
-    ],
-    local_include_dirs: [
-        "kernel/uapi/asm-mips",
-        "kernel/uapi",
-    ],
-}
-
 // Generate the C++ policy sources for app and system seccomp-bpf filters.
 python_binary_host {
     name: "genseccomp",
@@ -2432,8 +2375,6 @@
         "SYSCALLS.TXT",
         ":libseccomp_gen_syscall_nrs_arm",
         ":libseccomp_gen_syscall_nrs_arm64",
-        ":libseccomp_gen_syscall_nrs_mips",
-        ":libseccomp_gen_syscall_nrs_mips64",
         ":libseccomp_gen_syscall_nrs_x86",
         ":libseccomp_gen_syscall_nrs_x86_64",
     ],
@@ -2466,8 +2407,6 @@
         ":generate_app_zygote_blacklist",
         ":libseccomp_gen_syscall_nrs_arm",
         ":libseccomp_gen_syscall_nrs_arm64",
-        ":libseccomp_gen_syscall_nrs_mips",
-        ":libseccomp_gen_syscall_nrs_mips64",
         ":libseccomp_gen_syscall_nrs_x86",
         ":libseccomp_gen_syscall_nrs_x86_64",
     ],
@@ -2475,8 +2414,6 @@
     out: [
         "arm64_app_zygote_policy.cpp",
         "arm_app_zygote_policy.cpp",
-        "mips64_app_zygote_policy.cpp",
-        "mips_app_zygote_policy.cpp",
         "x86_64_app_zygote_policy.cpp",
         "x86_app_zygote_policy.cpp",
     ],
@@ -2497,8 +2434,6 @@
         "SECCOMP_BLACKLIST_APP.TXT",
         ":libseccomp_gen_syscall_nrs_arm",
         ":libseccomp_gen_syscall_nrs_arm64",
-        ":libseccomp_gen_syscall_nrs_mips",
-        ":libseccomp_gen_syscall_nrs_mips64",
         ":libseccomp_gen_syscall_nrs_x86",
         ":libseccomp_gen_syscall_nrs_x86_64",
     ],
@@ -2506,8 +2441,6 @@
     out: [
         "arm64_app_policy.cpp",
         "arm_app_policy.cpp",
-        "mips64_app_policy.cpp",
-        "mips_app_policy.cpp",
         "x86_64_app_policy.cpp",
         "x86_app_policy.cpp",
     ],
@@ -2527,8 +2460,6 @@
         "SECCOMP_BLACKLIST_COMMON.TXT",
         ":libseccomp_gen_syscall_nrs_arm",
         ":libseccomp_gen_syscall_nrs_arm64",
-        ":libseccomp_gen_syscall_nrs_mips",
-        ":libseccomp_gen_syscall_nrs_mips64",
         ":libseccomp_gen_syscall_nrs_x86",
         ":libseccomp_gen_syscall_nrs_x86_64",
     ],
@@ -2536,8 +2467,6 @@
     out: [
         "arm64_system_policy.cpp",
         "arm_system_policy.cpp",
-        "mips64_system_policy.cpp",
-        "mips_system_policy.cpp",
         "x86_64_system_policy.cpp",
         "x86_system_policy.cpp",
     ],
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 517d5f9..1343e4e 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -123,12 +123,12 @@
 ssize_t     readv(int, const struct iovec*, int)   all
 ssize_t     writev(int, const struct iovec*, int)  all
 int         __fcntl64:fcntl64(int, int, void*)  lp32
-int         fcntl(int, int, void*)  lp64
+int         __fcntl:fcntl(int, int, void*)  lp64
 int         flock(int, int)   all
 int         __fchmod:fchmod(int, mode_t)  all
-int         dup(int)  all
 int         pipe2(int*, int) all
-int         dup3(int, int, int)   all
+int         __dup:dup(int)  all
+int         __dup3:dup3(int, int, int)   all
 int         fsync(int)  all
 int         fdatasync(int) all
 int         fchown:fchown32(int, uid_t, gid_t)  arm,x86
@@ -254,9 +254,9 @@
 int           shutdown(int, int)  arm,arm64,mips,mips64,x86_64
 int           setsockopt(int, int, int, const void*, socklen_t)  arm,arm64,mips,mips64,x86_64
 int           getsockopt(int, int, int, void*, socklen_t*)    arm,arm64,mips,mips64,x86_64
-ssize_t       recvmsg(int, struct msghdr*, unsigned int)   arm,arm64,mips,mips64,x86_64
+ssize_t       __recvmsg:recvmsg(int, struct msghdr*, unsigned int)   arm,arm64,mips,mips64,x86_64
 ssize_t       __sendmsg:sendmsg(int, const struct msghdr*, unsigned int)  arm,arm64,mips,mips64,x86_64
-int           recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   arm,arm64,mips,mips64,x86_64
+int           __recvmmsg:recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   arm,arm64,mips,mips64,x86_64
 int           __sendmmsg:sendmmsg(int, struct mmsghdr*, unsigned int, int)   arm,arm64,mips,mips64,x86_64
 
 # sockets for x86. These are done as an "indexed" call to socketcall syscall.
@@ -273,9 +273,9 @@
 int           setsockopt:socketcall:14(int, int, int, const void*, socklen_t)  x86
 int           getsockopt:socketcall:15(int, int, int, void*, socklen_t*)    x86
 int           __sendmsg:socketcall:16(int, const struct msghdr*, unsigned int)  x86
-int           recvmsg:socketcall:17(int, struct msghdr*, unsigned int)   x86
+int           __recvmsg:socketcall:17(int, struct msghdr*, unsigned int)   x86
 int           __accept4:socketcall:18(int, struct sockaddr*, socklen_t*, int)  x86
-int           recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   x86
+int           __recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   x86
 int           __sendmmsg:socketcall:20(int, struct mmsghdr*, unsigned int, int)   x86
 
 # scheduler & real-time
diff --git a/libc/bionic/NetdClientDispatch.cpp b/libc/bionic/NetdClientDispatch.cpp
index 463ef36..e6f4a97 100644
--- a/libc/bionic/NetdClientDispatch.cpp
+++ b/libc/bionic/NetdClientDispatch.cpp
@@ -18,6 +18,8 @@
 
 #include <sys/socket.h>
 
+#include "private/bionic_fdtrack.h"
+
 #ifdef __i386__
 #define __socketcall __attribute__((__cdecl__))
 #else
@@ -53,7 +55,7 @@
 };
 
 int accept4(int fd, sockaddr* addr, socklen_t* addr_length, int flags) {
-    return __netdClientDispatch.accept4(fd, addr, addr_length, flags);
+  return FDTRACK_CREATE(__netdClientDispatch.accept4(fd, addr, addr_length, flags));
 }
 
 int connect(int fd, const sockaddr* addr, socklen_t addr_length) {
@@ -74,5 +76,5 @@
 }
 
 int socket(int domain, int type, int protocol) {
-    return __netdClientDispatch.socket(domain, type, protocol);
+  return FDTRACK_CREATE(__netdClientDispatch.socket(domain, type, protocol));
 }
diff --git a/libc/bionic/__libc_init_main_thread.cpp b/libc/bionic/__libc_init_main_thread.cpp
index 94cf1f8..56a8488 100644
--- a/libc/bionic/__libc_init_main_thread.cpp
+++ b/libc/bionic/__libc_init_main_thread.cpp
@@ -81,6 +81,7 @@
   __set_tls(&temp_tcb->tls_slot(0));
   main_thread.tid = __getpid();
   main_thread.set_cached_pid(main_thread.tid);
+  main_thread.stack_top = reinterpret_cast<uintptr_t>(args.argv);
 }
 
 // This code is used both by each new pthread and the code that initializes the main thread.
diff --git a/libc/bionic/android_unsafe_frame_pointer_chase.cpp b/libc/bionic/android_unsafe_frame_pointer_chase.cpp
new file mode 100644
index 0000000..0fb086e
--- /dev/null
+++ b/libc/bionic/android_unsafe_frame_pointer_chase.cpp
@@ -0,0 +1,75 @@
+/*
+ * 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/android_unsafe_frame_pointer_chase.h"
+
+#include "pthread_internal.h"
+#include "platform/bionic/mte.h"
+
+/*
+ * Implement fast stack unwinding for stack frames with frame pointers. Stores at most num_entries
+ * return addresses to buffer buf. Returns the number of available return addresses, which may be
+ * greater than num_entries.
+ *
+ * This function makes no guarantees about its behavior on encountering a frame built without frame
+ * pointers, except that it should not crash or enter an infinite loop, and that any frames prior to
+ * the frame built without frame pointers should be correct.
+ *
+ * This function is only meant to be used with memory safety tools such as sanitizers which need to
+ * take stack traces efficiently. Normal applications should use APIs such as libunwindstack or
+ * _Unwind_Backtrace.
+ */
+__attribute__((no_sanitize("address", "hwaddress"))) size_t android_unsafe_frame_pointer_chase(
+    uintptr_t* buf, size_t num_entries) {
+  // Disable MTE checks for the duration of this function, since we can't be sure that following
+  // next_frame pointers won't cause us to read from tagged memory. ASAN/HWASAN are disabled here
+  // for the same reason.
+  ScopedDisableMTE x;
+
+  struct frame_record {
+    uintptr_t next_frame, return_addr;
+  };
+
+  auto begin = reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
+  uintptr_t end = __get_thread()->stack_top;
+  size_t num_frames = 0;
+  while (1) {
+    auto* frame = reinterpret_cast<frame_record*>(begin);
+    if (num_frames < num_entries) {
+      buf[num_frames] = frame->return_addr;
+    }
+    ++num_frames;
+    if (frame->next_frame < begin + sizeof(frame_record) || frame->next_frame >= end ||
+        frame->next_frame % sizeof(void*) != 0) {
+      break;
+    }
+    begin = frame->next_frame;
+  }
+
+  return num_frames;
+}
diff --git a/libc/bionic/dup2.cpp b/libc/bionic/dup.cpp
similarity index 83%
rename from libc/bionic/dup2.cpp
rename to libc/bionic/dup.cpp
index 98c5646..d9e89a5 100644
--- a/libc/bionic/dup2.cpp
+++ b/libc/bionic/dup.cpp
@@ -29,6 +29,15 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include "private/bionic_fdtrack.h"
+
+extern "C" int __dup(int old_fd);
+extern "C" int __dup3(int old_fd, int new_fd, int flags);
+
+int dup(int old_fd) {
+  return FDTRACK_CREATE(__dup(old_fd));
+}
+
 int dup2(int old_fd, int new_fd) {
   // If old_fd is equal to new_fd and a valid file descriptor, dup2 returns
   // old_fd without closing it. This is not true of dup3, so we have to
@@ -40,5 +49,9 @@
     return old_fd;
   }
 
-  return dup3(old_fd, new_fd, 0);
+  return FDTRACK_CREATE(__dup3(old_fd, new_fd, 0));
+}
+
+int dup3(int old_fd, int new_fd, int flags) {
+  return FDTRACK_CREATE(__dup3(old_fd, new_fd, flags));
 }
diff --git a/libc/bionic/fcntl.cpp b/libc/bionic/fcntl.cpp
new file mode 100644
index 0000000..c508131
--- /dev/null
+++ b/libc/bionic/fcntl.cpp
@@ -0,0 +1,76 @@
+/*
+ * 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 <stdarg.h>
+#include <fcntl.h>
+
+#include "private/bionic_fdtrack.h"
+
+#if defined(__LP64__)
+
+extern "C" int __fcntl(int fd, int cmd, ...);
+
+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.
+  void* arg = va_arg(args, void*);
+  va_end(args);
+
+  int rc = __fcntl(fd, cmd, arg);
+  if (cmd == F_DUPFD) {
+    return FDTRACK_CREATE_NAME("F_DUPFD", rc);
+  } else if (cmd == F_DUPFD_CLOEXEC) {
+    return FDTRACK_CREATE_NAME("F_DUPFD_CLOEXEC", rc);
+  }
+  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 d4ac71c..ebc680f 100644
--- a/libc/bionic/fdsan.cpp
+++ b/libc/bionic/fdsan.cpp
@@ -43,6 +43,7 @@
 #include <platform/bionic/reserved_signals.h>
 #include <sys/system_properties.h>
 
+#include "private/bionic_fdtrack.h"
 #include "private/bionic_globals.h"
 #include "private/bionic_inline_raise.h"
 #include "pthread_internal.h"
@@ -245,6 +246,7 @@
 }
 
 int android_fdsan_close_with_tag(int fd, uint64_t expected_tag) {
+  FDTRACK_CLOSE(fd);
   FdEntry* fde = GetFdEntry(fd);
   if (!fde) {
     return __close(fd);
diff --git a/libc/bionic/fdtrack.cpp b/libc/bionic/fdtrack.cpp
new file mode 100644
index 0000000..1123512
--- /dev/null
+++ b/libc/bionic/fdtrack.cpp
@@ -0,0 +1,59 @@
+/*
+ * 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 <stdatomic.h>
+
+#include <platform/bionic/fdtrack.h>
+#include <platform/bionic/reserved_signals.h>
+
+#include "private/bionic_fdtrack.h"
+#include "private/bionic_tls.h"
+#include "private/bionic_globals.h"
+
+_Atomic(android_fdtrack_hook_t) __android_fdtrack_hook;
+
+bool android_fdtrack_get_enabled() {
+  return !__get_bionic_tls().fdtrack_disabled;
+}
+
+bool android_fdtrack_set_enabled(bool new_value) {
+  auto& tls = __get_bionic_tls();
+  bool prev = !tls.fdtrack_disabled;
+  tls.fdtrack_disabled = !new_value;
+  return prev;
+}
+
+bool android_fdtrack_compare_exchange_hook(android_fdtrack_hook_t* expected,
+                                           android_fdtrack_hook_t value) {
+  return atomic_compare_exchange_strong(&__android_fdtrack_hook, expected, value);
+}
+
+void __libc_init_fdtrack() {
+  // Register a no-op signal handler.
+  signal(BIONIC_SIGNAL_FDTRACK, [](int) {});
+}
diff --git a/libc/bionic/getauxval.cpp b/libc/bionic/getauxval.cpp
index f865f97..d6f75f8 100644
--- a/libc/bionic/getauxval.cpp
+++ b/libc/bionic/getauxval.cpp
@@ -31,6 +31,7 @@
 #include <sys/auxv.h>
 #include <private/bionic_auxv.h>
 #include <private/bionic_globals.h>
+#include <private/bionic_ifuncs.h>
 #include <elf.h>
 #include <errno.h>
 
diff --git a/libc/bionic/legacy_32_bit_support.cpp b/libc/bionic/legacy_32_bit_support.cpp
index 2de1bc7..f08e582 100644
--- a/libc/bionic/legacy_32_bit_support.cpp
+++ b/libc/bionic/legacy_32_bit_support.cpp
@@ -37,27 +37,17 @@
 #include <sys/vfs.h>
 #include <unistd.h>
 
+#include "private/bionic_fdtrack.h"
+
 #if defined(__LP64__)
 #error This code is only needed on 32-bit systems!
 #endif
 
 // System calls we need.
-extern "C" int __fcntl64(int, int, void*);
 extern "C" int __llseek(int, unsigned long, unsigned long, off64_t*, int);
 extern "C" int __preadv64(int, const struct iovec*, int, long, long);
 extern "C" int __pwritev64(int, const struct iovec*, int, long, long);
 
-// 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);
-
-  return __fcntl64(fd, cmd, arg);
-}
-
 // For lseek64 we need to use the llseek system call which splits the off64_t in two and
 // returns the off64_t result via a pointer because 32-bit kernels can't return 64-bit results.
 off64_t lseek64(int fd, off64_t off, int whence) {
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index e4106e9..12628f7 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -104,6 +104,7 @@
 
   __system_properties_init(); // Requires 'environ'.
   __libc_init_fdsan(); // Requires system properties (for debug.fdsan).
+  __libc_init_fdtrack();
 
   SetDefaultHeapTaggingLevel();
 }
diff --git a/libc/bionic/open.cpp b/libc/bionic/open.cpp
index 222e5d3..bd8685a 100644
--- a/libc/bionic/open.cpp
+++ b/libc/bionic/open.cpp
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "private/bionic_fdtrack.h"
 #include "private/bionic_fortify.h"
 
 extern "C" int __openat(int, const char*, int, int);
@@ -62,13 +63,13 @@
     va_end(args);
   }
 
-  return __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), mode);
+  return FDTRACK_CREATE(__openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), mode));
 }
 __strong_alias(open64, open);
 
 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 __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), 0);
+  return FDTRACK_CREATE_NAME("open", __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), 0));
 }
 
 int openat(int fd, const char *pathname, int flags, ...) {
@@ -81,11 +82,11 @@
     va_end(args);
   }
 
-  return __openat(fd, pathname, force_O_LARGEFILE(flags), mode);
+  return FDTRACK_CREATE_NAME("openat", __openat(fd, pathname, force_O_LARGEFILE(flags), mode));
 }
 __strong_alias(openat64, openat);
 
 int __openat_2(int fd, const char* pathname, int flags) {
   if (needs_mode(flags)) __fortify_fatal("open: called with O_CREAT/O_TMPFILE but no mode");
-  return __openat(fd, pathname, force_O_LARGEFILE(flags), 0);
+  return FDTRACK_CREATE_NAME("openat", __openat(fd, pathname, force_O_LARGEFILE(flags), 0));
 }
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 4f7ac2b..d4a8bef 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -300,6 +300,7 @@
   thread->mmap_size = mapping.mmap_size;
   thread->mmap_base_unguarded = mapping.mmap_base_unguarded;
   thread->mmap_size_unguarded = mapping.mmap_size_unguarded;
+  thread->stack_top = reinterpret_cast<uintptr_t>(stack_top);
 
   *tcbp = tcb;
   *child_stack = stack_top;
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 22b0558..ab8b955 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -125,6 +125,10 @@
   //    code to handle retries.
   void* shadow_call_stack_guard_region;
 
+  // A pointer to the top of the stack. This lets android_unsafe_frame_pointer_chase determine the
+  // top of the stack quickly, which would otherwise require special logic for the main thread.
+  uintptr_t stack_top;
+
   Lock startup_handshake_lock;
 
   void* mmap_base;
diff --git a/libc/bionic/recvmsg.cpp b/libc/bionic/recvmsg.cpp
new file mode 100644
index 0000000..003f43d
--- /dev/null
+++ b/libc/bionic/recvmsg.cpp
@@ -0,0 +1,87 @@
+/*
+ * 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 <string.h>
+#include <sys/socket.h>
+
+#include <async_safe/log.h>
+
+#include "private/bionic_fdtrack.h"
+
+extern "C" ssize_t __recvmsg(int __fd, struct msghdr* __msg, int __flags);
+extern "C" int __recvmmsg(int __fd, struct mmsghdr* __msgs, unsigned int __msg_count, int __flags,
+                          const struct timespec* __timeout);
+
+static inline __attribute__((artificial)) __attribute__((always_inline)) void track_fds(
+    struct msghdr* msg, const char* function_name) {
+  if (!__android_fdtrack_hook) {
+    return;
+  }
+
+  for (struct cmsghdr* cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
+    if (cmsg->cmsg_type != SCM_RIGHTS) {
+      continue;
+    }
+
+    if (cmsg->cmsg_len <= sizeof(struct cmsghdr)) {
+      continue;
+    }
+
+    size_t data_length = cmsg->cmsg_len - sizeof(struct cmsghdr);
+    if (data_length % sizeof(int) != 0) {
+      async_safe_fatal("invalid cmsg length: %zu", data_length);
+    }
+
+    for (size_t offset = 0; offset < data_length; offset += sizeof(int)) {
+      int fd;
+      memcpy(&fd, CMSG_DATA(cmsg) + offset, sizeof(int));
+      FDTRACK_CREATE_NAME(function_name, fd);
+    }
+  }
+}
+
+ssize_t recvmsg(int __fd, struct msghdr* __msg, int __flags) {
+  ssize_t rc = __recvmsg(__fd, __msg, __flags);
+  if (rc == -1) {
+    return -1;
+  }
+  track_fds(__msg, "recvmsg");
+  return rc;
+}
+
+int recvmmsg(int __fd, struct mmsghdr* __msgs, unsigned int __msg_count, int __flags,
+             const struct timespec* __timeout) {
+  int rc = __recvmmsg(__fd, __msgs, __msg_count, __flags, __timeout);
+  if (rc == -1) {
+    return -1;
+  }
+  for (int i = 0; i < rc; ++i) {
+    track_fds(&__msgs[i].msg_hdr, "recvmmsg");
+  }
+  return rc;
+}
diff --git a/libc/include/.clang-format b/libc/include/.clang-format
new file mode 100644
index 0000000..39789c8
--- /dev/null
+++ b/libc/include/.clang-format
@@ -0,0 +1,3 @@
+DisableFormat: true
+SortIncludes: false
+SortUsingDeclarations: false
diff --git a/libc/include/android/versioning.h b/libc/include/android/versioning.h
index 1948890..c7e844a 100644
--- a/libc/include/android/versioning.h
+++ b/libc/include/android/versioning.h
@@ -27,7 +27,7 @@
 #define __INTRODUCED_IN_64(api_level) __attribute__((annotate("introduced_in_64=" #api_level)))
 #define __INTRODUCED_IN_ARM(api_level) __attribute__((annotate("introduced_in_arm=" #api_level)))
 #define __INTRODUCED_IN_X86(api_level) __attribute__((annotate("introduced_in_x86=" #api_level)))
-#define __INTRODUCED_IN_MIPS(api_level) __attribute__((annotate("introduced_in_mips=" #api_level)))
+#define __INTRODUCED_IN_MIPS(api_level)
 
 #define __VERSIONER_NO_GUARD __attribute__((annotate("versioner_no_guard")))
 #define __VERSIONER_FORTIFY_INLINE __attribute__((annotate("versioner_fortify_inline")))
diff --git a/libc/bionic/dup2.cpp b/libc/include/bits/flock.h
similarity index 67%
copy from libc/bionic/dup2.cpp
copy to libc/include/bits/flock.h
index 98c5646..7c452ad 100644
--- a/libc/bionic/dup2.cpp
+++ b/libc/include/bits/flock.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 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,19 +26,41 @@
  * SUCH DAMAGE.
  */
 
-#include <fcntl.h>
-#include <unistd.h>
+#pragma once
 
-int dup2(int old_fd, int new_fd) {
-  // If old_fd is equal to new_fd and a valid file descriptor, dup2 returns
-  // old_fd without closing it. This is not true of dup3, so we have to
-  // handle this case ourselves.
-  if (old_fd == new_fd) {
-    if (fcntl(old_fd, F_GETFD) == -1) {
-      return -1;
-    }
-    return old_fd;
-  }
+/**
+ * @file bits/flock.h
+ * @brief struct flock.
+ */
 
-  return dup3(old_fd, new_fd, 0);
-}
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#define __FLOCK64_BODY \
+  short l_type; \
+  short l_whence; \
+  off64_t l_start; \
+  off64_t l_len; \
+  pid_t l_pid; \
+
+#if defined(__USE_FILE_OFFSET64) || defined(__LP64__)
+#define __FLOCK_BODY __FLOCK64_BODY
+#else
+#define __FLOCK_BODY \
+  short l_type; \
+  short l_whence; \
+  off_t l_start; \
+  off_t l_len; \
+  pid_t l_pid; \
+
+#endif
+
+struct flock { __FLOCK_BODY };
+struct flock64 { __FLOCK64_BODY };
+
+#undef __FLOCK_BODY
+#undef __FLOCK64_BODY
+
+__END_DECLS
diff --git a/libc/bionic/dup2.cpp b/libc/include/bits/flock64.h
similarity index 73%
copy from libc/bionic/dup2.cpp
copy to libc/include/bits/flock64.h
index 98c5646..95500b9 100644
--- a/libc/bionic/dup2.cpp
+++ b/libc/include/bits/flock64.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 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,19 +26,6 @@
  * SUCH DAMAGE.
  */
 
-#include <fcntl.h>
-#include <unistd.h>
+#pragma once
 
-int dup2(int old_fd, int new_fd) {
-  // If old_fd is equal to new_fd and a valid file descriptor, dup2 returns
-  // old_fd without closing it. This is not true of dup3, so we have to
-  // handle this case ourselves.
-  if (old_fd == new_fd) {
-    if (fcntl(old_fd, F_GETFD) == -1) {
-      return -1;
-    }
-    return old_fd;
-  }
-
-  return dup3(old_fd, new_fd, 0);
-}
+/* Empty. */
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index 23a58d6..1ea94e6 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -51,14 +51,32 @@
 
 __BEGIN_DECLS
 
-#ifdef __LP64__
+#if defined(__LP64__)
+
 /* LP64 kernels don't have F_*64 defines because their flock is 64-bit. */
+
 /** Flag for flock(). */
 #define F_GETLK64  F_GETLK
 /** Flag for flock(). */
 #define F_SETLK64  F_SETLK
 /** Flag for flock(). */
 #define F_SETLKW64 F_SETLKW
+
+#elif defined(__USE_FILE_OFFSET64)
+
+/* For _FILE_OFFSET_BITS=64, redirect the constants to the off64_t variants. */
+
+#undef F_GETLK
+#undef F_SETLK
+#undef F_SETLKW
+
+/** Flag for flock(). */
+#define F_GETLK F_GETLK64
+/** Flag for flock(). */
+#define F_SETLK F_SETLK64
+/** Flag for flock(). */
+#define F_SETLKW F_SETLKW64
+
 #endif
 
 /** Flag for open(). */
diff --git a/libc/kernel/.clang-format b/libc/kernel/.clang-format
new file mode 100644
index 0000000..39789c8
--- /dev/null
+++ b/libc/kernel/.clang-format
@@ -0,0 +1,3 @@
+DisableFormat: true
+SortIncludes: false
+SortUsingDeclarations: false
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 967d0c7..e74b346 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -6,7 +6,7 @@
 from utils import *
 
 # the list of supported architectures
-kernel_archs = [ 'arm', 'arm64', 'mips', 'x86' ]
+kernel_archs = [ 'arm', 'arm64', 'x86' ]
 
 # the list of include directories that belong to the kernel
 # tree. used when looking for sources...
@@ -41,18 +41,12 @@
 kernel_default_arch_macros = {
     "arm": {"__ARMEB__": kCppUndefinedMacro, "__ARM_EABI__": "1"},
     "arm64": {},
-    "mips": {"__MIPSEB__": kCppUndefinedMacro,
-             "__MIPSEL__": "1",
-             "CONFIG_32BIT": "_ABIO32",
-             "CONFIG_CPU_LITTLE_ENDIAN": "1",
-             "__SANE_USERSPACE_TYPES__": "1",},
     "x86": {},
     }
 
 kernel_arch_token_replacements = {
     "arm": {},
     "arm64": {},
-    "mips": {"off_t":"__kernel_off_t"},
     "x86": {},
     }
 
@@ -90,6 +84,8 @@
 kernel_struct_replacements = set(
         [
           "epoll_event",
+          "flock",
+          "flock64",
           "in_addr",
           "ip_mreq_source",
           "ip_msfilter",
diff --git a/libc/kernel/tools/generate_uapi_headers.sh b/libc/kernel/tools/generate_uapi_headers.sh
index 61c78ce..088c12e 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" "mips" "x86")
+ARCH_LIST=("arm" "arm64" "x86")
 ANDROID_KERNEL_DIR="external/kernel-headers/original"
 SKIP_GENERATION=0
 VERIFY_HEADERS_ONLY=0
diff --git a/libc/kernel/uapi/asm-generic/fcntl.h b/libc/kernel/uapi/asm-generic/fcntl.h
index aeb1ac6..a2cb5f4 100644
--- a/libc/kernel/uapi/asm-generic/fcntl.h
+++ b/libc/kernel/uapi/asm-generic/fcntl.h
@@ -18,6 +18,8 @@
  ****************************************************************************/
 #ifndef _ASM_GENERIC_FCNTL_H
 #define _ASM_GENERIC_FCNTL_H
+#include <bits/flock64.h>
+#include <bits/flock.h>
 #include <linux/types.h>
 #define O_ACCMODE 00000003
 #define O_RDONLY 00000000
@@ -145,26 +147,10 @@
 #ifndef __ARCH_FLOCK_PAD
 #define __ARCH_FLOCK_PAD
 #endif
-struct flock {
-  short l_type;
-  short l_whence;
-  __kernel_off_t l_start;
-  __kernel_off_t l_len;
-  __kernel_pid_t l_pid;
-  __ARCH_FLOCK_PAD
-};
 #endif
 #ifndef HAVE_ARCH_STRUCT_FLOCK64
 #ifndef __ARCH_FLOCK64_PAD
 #define __ARCH_FLOCK64_PAD
 #endif
-struct flock64 {
-  short l_type;
-  short l_whence;
-  __kernel_loff_t l_start;
-  __kernel_loff_t l_len;
-  __kernel_pid_t l_pid;
-  __ARCH_FLOCK64_PAD
-};
 #endif
 #endif
diff --git a/libc/kernel/uapi/asm-mips/asm/auxvec.h b/libc/kernel/uapi/asm-mips/asm/auxvec.h
deleted file mode 100644
index 74fca55..0000000
--- a/libc/kernel/uapi/asm-mips/asm/auxvec.h
+++ /dev/null
@@ -1,23 +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 __ASM_AUXVEC_H
-#define __ASM_AUXVEC_H
-#define AT_SYSINFO_EHDR 33
-#define AT_VECTOR_SIZE_ARCH 1
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/bitfield.h b/libc/kernel/uapi/asm-mips/asm/bitfield.h
deleted file mode 100644
index 5c71170..0000000
--- a/libc/kernel/uapi/asm-mips/asm/bitfield.h
+++ /dev/null
@@ -1,22 +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 __UAPI_ASM_BITFIELD_H
-#define __UAPI_ASM_BITFIELD_H
-#define __BITFIELD_FIELD(field,more) more field;
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/bitsperlong.h b/libc/kernel/uapi/asm-mips/asm/bitsperlong.h
deleted file mode 100644
index f9a9718..0000000
--- a/libc/kernel/uapi/asm-mips/asm/bitsperlong.h
+++ /dev/null
@@ -1,23 +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 __ASM_MIPS_BITSPERLONG_H
-#define __ASM_MIPS_BITSPERLONG_H
-#define __BITS_PER_LONG _MIPS_SZLONG
-#include <asm-generic/bitsperlong.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/bpf_perf_event.h b/libc/kernel/uapi/asm-mips/asm/bpf_perf_event.h
deleted file mode 100644
index fa7bc48..0000000
--- a/libc/kernel/uapi/asm-mips/asm/bpf_perf_event.h
+++ /dev/null
@@ -1,19 +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!
- ***
- ****************************************************************************
- ****************************************************************************/
-#include <asm-generic/bpf_perf_event.h>
diff --git a/libc/kernel/uapi/asm-mips/asm/break.h b/libc/kernel/uapi/asm-mips/asm/break.h
deleted file mode 100644
index 48e0688..0000000
--- a/libc/kernel/uapi/asm-mips/asm/break.h
+++ /dev/null
@@ -1,33 +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 __UAPI_ASM_BREAK_H
-#define __UAPI_ASM_BREAK_H
-#define BRK_USERBP 0
-#define BRK_SSTEPBP 5
-#define BRK_OVERFLOW 6
-#define BRK_DIVZERO 7
-#define BRK_RANGE 8
-#define BRK_BUG 12
-#define BRK_UPROBE 13
-#define BRK_UPROBE_XOL 14
-#define BRK_MEMU 514
-#define BRK_KPROBE_BP 515
-#define BRK_KPROBE_SSTEPBP 516
-#define BRK_MULOVF 1023
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/byteorder.h b/libc/kernel/uapi/asm-mips/asm/byteorder.h
deleted file mode 100644
index fbca513..0000000
--- a/libc/kernel/uapi/asm-mips/asm/byteorder.h
+++ /dev/null
@@ -1,22 +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 _ASM_BYTEORDER_H
-#define _ASM_BYTEORDER_H
-#include <linux/byteorder/little_endian.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/cachectl.h b/libc/kernel/uapi/asm-mips/asm/cachectl.h
deleted file mode 100644
index 0808e69..0000000
--- a/libc/kernel/uapi/asm-mips/asm/cachectl.h
+++ /dev/null
@@ -1,26 +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 _ASM_CACHECTL
-#define _ASM_CACHECTL
-#define ICACHE (1 << 0)
-#define DCACHE (1 << 1)
-#define BCACHE (ICACHE | DCACHE)
-#define CACHEABLE 0
-#define UNCACHEABLE 1
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/errno.h b/libc/kernel/uapi/asm-mips/asm/errno.h
deleted file mode 100644
index a73d077..0000000
--- a/libc/kernel/uapi/asm-mips/asm/errno.h
+++ /dev/null
@@ -1,123 +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 _UAPI_ASM_ERRNO_H
-#define _UAPI_ASM_ERRNO_H
-#include <asm-generic/errno-base.h>
-#define ENOMSG 35
-#define EIDRM 36
-#define ECHRNG 37
-#define EL2NSYNC 38
-#define EL3HLT 39
-#define EL3RST 40
-#define ELNRNG 41
-#define EUNATCH 42
-#define ENOCSI 43
-#define EL2HLT 44
-#define EDEADLK 45
-#define ENOLCK 46
-#define EBADE 50
-#define EBADR 51
-#define EXFULL 52
-#define ENOANO 53
-#define EBADRQC 54
-#define EBADSLT 55
-#define EDEADLOCK 56
-#define EBFONT 59
-#define ENOSTR 60
-#define ENODATA 61
-#define ETIME 62
-#define ENOSR 63
-#define ENONET 64
-#define ENOPKG 65
-#define EREMOTE 66
-#define ENOLINK 67
-#define EADV 68
-#define ESRMNT 69
-#define ECOMM 70
-#define EPROTO 71
-#define EDOTDOT 73
-#define EMULTIHOP 74
-#define EBADMSG 77
-#define ENAMETOOLONG 78
-#define EOVERFLOW 79
-#define ENOTUNIQ 80
-#define EBADFD 81
-#define EREMCHG 82
-#define ELIBACC 83
-#define ELIBBAD 84
-#define ELIBSCN 85
-#define ELIBMAX 86
-#define ELIBEXEC 87
-#define EILSEQ 88
-#define ENOSYS 89
-#define ELOOP 90
-#define ERESTART 91
-#define ESTRPIPE 92
-#define ENOTEMPTY 93
-#define EUSERS 94
-#define ENOTSOCK 95
-#define EDESTADDRREQ 96
-#define EMSGSIZE 97
-#define EPROTOTYPE 98
-#define ENOPROTOOPT 99
-#define EPROTONOSUPPORT 120
-#define ESOCKTNOSUPPORT 121
-#define EOPNOTSUPP 122
-#define EPFNOSUPPORT 123
-#define EAFNOSUPPORT 124
-#define EADDRINUSE 125
-#define EADDRNOTAVAIL 126
-#define ENETDOWN 127
-#define ENETUNREACH 128
-#define ENETRESET 129
-#define ECONNABORTED 130
-#define ECONNRESET 131
-#define ENOBUFS 132
-#define EISCONN 133
-#define ENOTCONN 134
-#define EUCLEAN 135
-#define ENOTNAM 137
-#define ENAVAIL 138
-#define EISNAM 139
-#define EREMOTEIO 140
-#define EINIT 141
-#define EREMDEV 142
-#define ESHUTDOWN 143
-#define ETOOMANYREFS 144
-#define ETIMEDOUT 145
-#define ECONNREFUSED 146
-#define EHOSTDOWN 147
-#define EHOSTUNREACH 148
-#define EWOULDBLOCK EAGAIN
-#define EALREADY 149
-#define EINPROGRESS 150
-#define ESTALE 151
-#define ECANCELED 158
-#define ENOMEDIUM 159
-#define EMEDIUMTYPE 160
-#define ENOKEY 161
-#define EKEYEXPIRED 162
-#define EKEYREVOKED 163
-#define EKEYREJECTED 164
-#define EOWNERDEAD 165
-#define ENOTRECOVERABLE 166
-#define ERFKILL 167
-#define EHWPOISON 168
-#define EDQUOT 1133
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/fcntl.h b/libc/kernel/uapi/asm-mips/asm/fcntl.h
deleted file mode 100644
index 91835f2..0000000
--- a/libc/kernel/uapi/asm-mips/asm/fcntl.h
+++ /dev/null
@@ -1,58 +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 _UAPI_ASM_FCNTL_H
-#define _UAPI_ASM_FCNTL_H
-#include <asm/sgidefs.h>
-#define O_APPEND 0x0008
-#define O_DSYNC 0x0010
-#define O_NONBLOCK 0x0080
-#define O_CREAT 0x0100
-#define O_TRUNC 0x0200
-#define O_EXCL 0x0400
-#define O_NOCTTY 0x0800
-#define FASYNC 0x1000
-#define O_LARGEFILE 0x2000
-#define __O_SYNC 0x4000
-#define O_SYNC (__O_SYNC | O_DSYNC)
-#define O_DIRECT 0x8000
-#define F_GETLK 14
-#define F_SETLK 6
-#define F_SETLKW 7
-#define F_SETOWN 24
-#define F_GETOWN 23
-#ifndef __mips64
-#define F_GETLK64 33
-#define F_SETLK64 34
-#define F_SETLKW64 35
-#endif
-#if _MIPS_SIM != _MIPS_SIM_ABI64
-#include <linux/types.h>
-struct flock {
-  short l_type;
-  short l_whence;
-  __kernel_off_t l_start;
-  __kernel_off_t l_len;
-  long l_sysid;
-  __kernel_pid_t l_pid;
-  long pad[4];
-};
-#define HAVE_ARCH_STRUCT_FLOCK
-#endif
-#include <asm-generic/fcntl.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/hwcap.h b/libc/kernel/uapi/asm-mips/asm/hwcap.h
deleted file mode 100644
index 702b6f6..0000000
--- a/libc/kernel/uapi/asm-mips/asm/hwcap.h
+++ /dev/null
@@ -1,35 +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 _UAPI_ASM_HWCAP_H
-#define _UAPI_ASM_HWCAP_H
-#define HWCAP_MIPS_R6 (1 << 0)
-#define HWCAP_MIPS_MSA (1 << 1)
-#define HWCAP_MIPS_CRC32 (1 << 2)
-#define HWCAP_MIPS_MIPS16 (1 << 3)
-#define HWCAP_MIPS_MDMX (1 << 4)
-#define HWCAP_MIPS_MIPS3D (1 << 5)
-#define HWCAP_MIPS_SMARTMIPS (1 << 6)
-#define HWCAP_MIPS_DSP (1 << 7)
-#define HWCAP_MIPS_DSP2 (1 << 8)
-#define HWCAP_MIPS_DSP3 (1 << 9)
-#define HWCAP_MIPS_MIPS16E2 (1 << 10)
-#define HWCAP_LOONGSON_MMI (1 << 11)
-#define HWCAP_LOONGSON_EXT (1 << 12)
-#define HWCAP_LOONGSON_EXT2 (1 << 13)
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/inst.h b/libc/kernel/uapi/asm-mips/asm/inst.h
deleted file mode 100644
index 8489575..0000000
--- a/libc/kernel/uapi/asm-mips/asm/inst.h
+++ /dev/null
@@ -1,978 +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 _UAPI_ASM_INST_H
-#define _UAPI_ASM_INST_H
-#include <asm/bitfield.h>
-enum major_op {
-  spec_op,
-  bcond_op,
-  j_op,
-  jal_op,
-  beq_op,
-  bne_op,
-  blez_op,
-  bgtz_op,
-  addi_op,
-  pop10_op = addi_op,
-  addiu_op,
-  slti_op,
-  sltiu_op,
-  andi_op,
-  ori_op,
-  xori_op,
-  lui_op,
-  cop0_op,
-  cop1_op,
-  cop2_op,
-  cop1x_op,
-  beql_op,
-  bnel_op,
-  blezl_op,
-  bgtzl_op,
-  daddi_op,
-  pop30_op = daddi_op,
-  daddiu_op,
-  ldl_op,
-  ldr_op,
-  spec2_op,
-  jalx_op,
-  mdmx_op,
-  msa_op = mdmx_op,
-  spec3_op,
-  lb_op,
-  lh_op,
-  lwl_op,
-  lw_op,
-  lbu_op,
-  lhu_op,
-  lwr_op,
-  lwu_op,
-  sb_op,
-  sh_op,
-  swl_op,
-  sw_op,
-  sdl_op,
-  sdr_op,
-  swr_op,
-  cache_op,
-  ll_op,
-  lwc1_op,
-  lwc2_op,
-  bc6_op = lwc2_op,
-  pref_op,
-  lld_op,
-  ldc1_op,
-  ldc2_op,
-  pop66_op = ldc2_op,
-  ld_op,
-  sc_op,
-  swc1_op,
-  swc2_op,
-  balc6_op = swc2_op,
-  major_3b_op,
-  scd_op,
-  sdc1_op,
-  sdc2_op,
-  pop76_op = sdc2_op,
-  sd_op
-};
-enum spec_op {
-  sll_op,
-  movc_op,
-  srl_op,
-  sra_op,
-  sllv_op,
-  pmon_op,
-  srlv_op,
-  srav_op,
-  jr_op,
-  jalr_op,
-  movz_op,
-  movn_op,
-  syscall_op,
-  break_op,
-  spim_op,
-  sync_op,
-  mfhi_op,
-  mthi_op,
-  mflo_op,
-  mtlo_op,
-  dsllv_op,
-  spec2_unused_op,
-  dsrlv_op,
-  dsrav_op,
-  mult_op,
-  multu_op,
-  div_op,
-  divu_op,
-  dmult_op,
-  dmultu_op,
-  ddiv_op,
-  ddivu_op,
-  add_op,
-  addu_op,
-  sub_op,
-  subu_op,
-  and_op,
-  or_op,
-  xor_op,
-  nor_op,
-  spec3_unused_op,
-  spec4_unused_op,
-  slt_op,
-  sltu_op,
-  dadd_op,
-  daddu_op,
-  dsub_op,
-  dsubu_op,
-  tge_op,
-  tgeu_op,
-  tlt_op,
-  tltu_op,
-  teq_op,
-  seleqz_op,
-  tne_op,
-  selnez_op,
-  dsll_op,
-  spec5_unused_op,
-  dsrl_op,
-  dsra_op,
-  dsll32_op,
-  spec6_unused_op,
-  dsrl32_op,
-  dsra32_op
-};
-enum spec2_op {
-  madd_op,
-  maddu_op,
-  mul_op,
-  spec2_3_unused_op,
-  msub_op,
-  msubu_op,
-  clz_op = 0x20,
-  clo_op,
-  dclz_op = 0x24,
-  dclo_op,
-  sdbpp_op = 0x3f
-};
-enum spec3_op {
-  ext_op,
-  dextm_op,
-  dextu_op,
-  dext_op,
-  ins_op,
-  dinsm_op,
-  dinsu_op,
-  dins_op,
-  yield_op = 0x09,
-  lx_op = 0x0a,
-  lwle_op = 0x19,
-  lwre_op = 0x1a,
-  cachee_op = 0x1b,
-  sbe_op = 0x1c,
-  she_op = 0x1d,
-  sce_op = 0x1e,
-  swe_op = 0x1f,
-  bshfl_op = 0x20,
-  swle_op = 0x21,
-  swre_op = 0x22,
-  prefe_op = 0x23,
-  dbshfl_op = 0x24,
-  cache6_op = 0x25,
-  sc6_op = 0x26,
-  scd6_op = 0x27,
-  lbue_op = 0x28,
-  lhue_op = 0x29,
-  lbe_op = 0x2c,
-  lhe_op = 0x2d,
-  lle_op = 0x2e,
-  lwe_op = 0x2f,
-  pref6_op = 0x35,
-  ll6_op = 0x36,
-  lld6_op = 0x37,
-  rdhwr_op = 0x3b
-};
-enum mult_op {
-  mult_mult_op = 0x0,
-  mult_mul_op = 0x2,
-  mult_muh_op = 0x3,
-};
-enum multu_op {
-  multu_multu_op = 0x0,
-  multu_mulu_op = 0x2,
-  multu_muhu_op = 0x3,
-};
-enum div_op {
-  div_div_op = 0x0,
-  div_div6_op = 0x2,
-  div_mod_op = 0x3,
-};
-enum divu_op {
-  divu_divu_op = 0x0,
-  divu_divu6_op = 0x2,
-  divu_modu_op = 0x3,
-};
-enum dmult_op {
-  dmult_dmult_op = 0x0,
-  dmult_dmul_op = 0x2,
-  dmult_dmuh_op = 0x3,
-};
-enum dmultu_op {
-  dmultu_dmultu_op = 0x0,
-  dmultu_dmulu_op = 0x2,
-  dmultu_dmuhu_op = 0x3,
-};
-enum ddiv_op {
-  ddiv_ddiv_op = 0x0,
-  ddiv_ddiv6_op = 0x2,
-  ddiv_dmod_op = 0x3,
-};
-enum ddivu_op {
-  ddivu_ddivu_op = 0x0,
-  ddivu_ddivu6_op = 0x2,
-  ddivu_dmodu_op = 0x3,
-};
-enum rt_op {
-  bltz_op,
-  bgez_op,
-  bltzl_op,
-  bgezl_op,
-  spimi_op,
-  unused_rt_op_0x05,
-  unused_rt_op_0x06,
-  unused_rt_op_0x07,
-  tgei_op,
-  tgeiu_op,
-  tlti_op,
-  tltiu_op,
-  teqi_op,
-  unused_0x0d_rt_op,
-  tnei_op,
-  unused_0x0f_rt_op,
-  bltzal_op,
-  bgezal_op,
-  bltzall_op,
-  bgezall_op,
-  rt_op_0x14,
-  rt_op_0x15,
-  rt_op_0x16,
-  rt_op_0x17,
-  rt_op_0x18,
-  rt_op_0x19,
-  rt_op_0x1a,
-  rt_op_0x1b,
-  bposge32_op,
-  rt_op_0x1d,
-  rt_op_0x1e,
-  synci_op
-};
-enum cop_op {
-  mfc_op = 0x00,
-  dmfc_op = 0x01,
-  cfc_op = 0x02,
-  mfhc0_op = 0x02,
-  mfhc_op = 0x03,
-  mtc_op = 0x04,
-  dmtc_op = 0x05,
-  ctc_op = 0x06,
-  mthc0_op = 0x06,
-  mthc_op = 0x07,
-  bc_op = 0x08,
-  bc1eqz_op = 0x09,
-  mfmc0_op = 0x0b,
-  bc1nez_op = 0x0d,
-  wrpgpr_op = 0x0e,
-  cop_op = 0x10,
-  copm_op = 0x18
-};
-enum bcop_op {
-  bcf_op,
-  bct_op,
-  bcfl_op,
-  bctl_op
-};
-enum cop0_coi_func {
-  tlbr_op = 0x01,
-  tlbwi_op = 0x02,
-  tlbwr_op = 0x06,
-  tlbp_op = 0x08,
-  rfe_op = 0x10,
-  eret_op = 0x18,
-  wait_op = 0x20,
-  hypcall_op = 0x28
-};
-enum cop0_com_func {
-  tlbr1_op = 0x01,
-  tlbw_op = 0x02,
-  tlbp1_op = 0x08,
-  dctr_op = 0x09,
-  dctw_op = 0x0a
-};
-enum cop1_fmt {
-  s_fmt,
-  d_fmt,
-  e_fmt,
-  q_fmt,
-  w_fmt,
-  l_fmt
-};
-enum cop1_sdw_func {
-  fadd_op = 0x00,
-  fsub_op = 0x01,
-  fmul_op = 0x02,
-  fdiv_op = 0x03,
-  fsqrt_op = 0x04,
-  fabs_op = 0x05,
-  fmov_op = 0x06,
-  fneg_op = 0x07,
-  froundl_op = 0x08,
-  ftruncl_op = 0x09,
-  fceill_op = 0x0a,
-  ffloorl_op = 0x0b,
-  fround_op = 0x0c,
-  ftrunc_op = 0x0d,
-  fceil_op = 0x0e,
-  ffloor_op = 0x0f,
-  fsel_op = 0x10,
-  fmovc_op = 0x11,
-  fmovz_op = 0x12,
-  fmovn_op = 0x13,
-  fseleqz_op = 0x14,
-  frecip_op = 0x15,
-  frsqrt_op = 0x16,
-  fselnez_op = 0x17,
-  fmaddf_op = 0x18,
-  fmsubf_op = 0x19,
-  frint_op = 0x1a,
-  fclass_op = 0x1b,
-  fmin_op = 0x1c,
-  fmina_op = 0x1d,
-  fmax_op = 0x1e,
-  fmaxa_op = 0x1f,
-  fcvts_op = 0x20,
-  fcvtd_op = 0x21,
-  fcvte_op = 0x22,
-  fcvtw_op = 0x24,
-  fcvtl_op = 0x25,
-  fcmp_op = 0x30
-};
-enum cop1x_func {
-  lwxc1_op = 0x00,
-  ldxc1_op = 0x01,
-  swxc1_op = 0x08,
-  sdxc1_op = 0x09,
-  pfetch_op = 0x0f,
-  madd_s_op = 0x20,
-  madd_d_op = 0x21,
-  madd_e_op = 0x22,
-  msub_s_op = 0x28,
-  msub_d_op = 0x29,
-  msub_e_op = 0x2a,
-  nmadd_s_op = 0x30,
-  nmadd_d_op = 0x31,
-  nmadd_e_op = 0x32,
-  nmsub_s_op = 0x38,
-  nmsub_d_op = 0x39,
-  nmsub_e_op = 0x3a
-};
-enum mad_func {
-  madd_fp_op = 0x08,
-  msub_fp_op = 0x0a,
-  nmadd_fp_op = 0x0c,
-  nmsub_fp_op = 0x0e
-};
-enum ptw_func {
-  lwdir_op = 0x00,
-  lwpte_op = 0x01,
-  lddir_op = 0x02,
-  ldpte_op = 0x03,
-};
-enum lx_func {
-  lwx_op = 0x00,
-  lhx_op = 0x04,
-  lbux_op = 0x06,
-  ldx_op = 0x08,
-  lwux_op = 0x10,
-  lhux_op = 0x14,
-  lbx_op = 0x16,
-};
-enum bshfl_func {
-  wsbh_op = 0x2,
-  seb_op = 0x10,
-  seh_op = 0x18,
-};
-enum dbshfl_func {
-  dsbh_op = 0x2,
-  dshd_op = 0x5,
-};
-enum msa_func {
-  msa_elm_op = 0x19,
-};
-enum msa_elm {
-  msa_ctc_op = 0x3e,
-  msa_cfc_op = 0x7e,
-};
-enum msa_mi10_func {
-  msa_ld_op = 8,
-  msa_st_op = 9,
-};
-enum msa_2b_fmt {
-  msa_fmt_b = 0,
-  msa_fmt_h = 1,
-  msa_fmt_w = 2,
-  msa_fmt_d = 3,
-};
-enum mm_major_op {
-  mm_pool32a_op,
-  mm_pool16a_op,
-  mm_lbu16_op,
-  mm_move16_op,
-  mm_addi32_op,
-  mm_lbu32_op,
-  mm_sb32_op,
-  mm_lb32_op,
-  mm_pool32b_op,
-  mm_pool16b_op,
-  mm_lhu16_op,
-  mm_andi16_op,
-  mm_addiu32_op,
-  mm_lhu32_op,
-  mm_sh32_op,
-  mm_lh32_op,
-  mm_pool32i_op,
-  mm_pool16c_op,
-  mm_lwsp16_op,
-  mm_pool16d_op,
-  mm_ori32_op,
-  mm_pool32f_op,
-  mm_pool32s_op,
-  mm_reserved2_op,
-  mm_pool32c_op,
-  mm_lwgp16_op,
-  mm_lw16_op,
-  mm_pool16e_op,
-  mm_xori32_op,
-  mm_jals32_op,
-  mm_addiupc_op,
-  mm_reserved3_op,
-  mm_reserved4_op,
-  mm_pool16f_op,
-  mm_sb16_op,
-  mm_beqz16_op,
-  mm_slti32_op,
-  mm_beq32_op,
-  mm_swc132_op,
-  mm_lwc132_op,
-  mm_reserved5_op,
-  mm_reserved6_op,
-  mm_sh16_op,
-  mm_bnez16_op,
-  mm_sltiu32_op,
-  mm_bne32_op,
-  mm_sdc132_op,
-  mm_ldc132_op,
-  mm_reserved7_op,
-  mm_reserved8_op,
-  mm_swsp16_op,
-  mm_b16_op,
-  mm_andi32_op,
-  mm_j32_op,
-  mm_sd32_op,
-  mm_ld32_op,
-  mm_reserved11_op,
-  mm_reserved12_op,
-  mm_sw16_op,
-  mm_li16_op,
-  mm_jalx32_op,
-  mm_jal32_op,
-  mm_sw32_op,
-  mm_lw32_op,
-};
-enum mm_32i_minor_op {
-  mm_bltz_op,
-  mm_bltzal_op,
-  mm_bgez_op,
-  mm_bgezal_op,
-  mm_blez_op,
-  mm_bnezc_op,
-  mm_bgtz_op,
-  mm_beqzc_op,
-  mm_tlti_op,
-  mm_tgei_op,
-  mm_tltiu_op,
-  mm_tgeiu_op,
-  mm_tnei_op,
-  mm_lui_op,
-  mm_teqi_op,
-  mm_reserved13_op,
-  mm_synci_op,
-  mm_bltzals_op,
-  mm_reserved14_op,
-  mm_bgezals_op,
-  mm_bc2f_op,
-  mm_bc2t_op,
-  mm_reserved15_op,
-  mm_reserved16_op,
-  mm_reserved17_op,
-  mm_reserved18_op,
-  mm_bposge64_op,
-  mm_bposge32_op,
-  mm_bc1f_op,
-  mm_bc1t_op,
-  mm_reserved19_op,
-  mm_reserved20_op,
-  mm_bc1any2f_op,
-  mm_bc1any2t_op,
-  mm_bc1any4f_op,
-  mm_bc1any4t_op,
-};
-enum mm_32a_minor_op {
-  mm_sll32_op = 0x000,
-  mm_ins_op = 0x00c,
-  mm_sllv32_op = 0x010,
-  mm_ext_op = 0x02c,
-  mm_pool32axf_op = 0x03c,
-  mm_srl32_op = 0x040,
-  mm_srlv32_op = 0x050,
-  mm_sra_op = 0x080,
-  mm_srav_op = 0x090,
-  mm_rotr_op = 0x0c0,
-  mm_lwxs_op = 0x118,
-  mm_addu32_op = 0x150,
-  mm_subu32_op = 0x1d0,
-  mm_wsbh_op = 0x1ec,
-  mm_mul_op = 0x210,
-  mm_and_op = 0x250,
-  mm_or32_op = 0x290,
-  mm_xor32_op = 0x310,
-  mm_slt_op = 0x350,
-  mm_sltu_op = 0x390,
-};
-enum mm_32b_func {
-  mm_lwc2_func = 0x0,
-  mm_lwp_func = 0x1,
-  mm_ldc2_func = 0x2,
-  mm_ldp_func = 0x4,
-  mm_lwm32_func = 0x5,
-  mm_cache_func = 0x6,
-  mm_ldm_func = 0x7,
-  mm_swc2_func = 0x8,
-  mm_swp_func = 0x9,
-  mm_sdc2_func = 0xa,
-  mm_sdp_func = 0xc,
-  mm_swm32_func = 0xd,
-  mm_sdm_func = 0xf,
-};
-enum mm_32c_func {
-  mm_pref_func = 0x2,
-  mm_ll_func = 0x3,
-  mm_swr_func = 0x9,
-  mm_sc_func = 0xb,
-  mm_lwu_func = 0xe,
-};
-enum mm_32axf_minor_op {
-  mm_mfc0_op = 0x003,
-  mm_mtc0_op = 0x00b,
-  mm_tlbp_op = 0x00d,
-  mm_mfhi32_op = 0x035,
-  mm_jalr_op = 0x03c,
-  mm_tlbr_op = 0x04d,
-  mm_mflo32_op = 0x075,
-  mm_jalrhb_op = 0x07c,
-  mm_tlbwi_op = 0x08d,
-  mm_mthi32_op = 0x0b5,
-  mm_tlbwr_op = 0x0cd,
-  mm_mtlo32_op = 0x0f5,
-  mm_di_op = 0x11d,
-  mm_jalrs_op = 0x13c,
-  mm_jalrshb_op = 0x17c,
-  mm_sync_op = 0x1ad,
-  mm_syscall_op = 0x22d,
-  mm_wait_op = 0x24d,
-  mm_eret_op = 0x3cd,
-  mm_divu_op = 0x5dc,
-};
-enum mm_32f_minor_op {
-  mm_32f_00_op = 0x00,
-  mm_32f_01_op = 0x01,
-  mm_32f_02_op = 0x02,
-  mm_32f_10_op = 0x08,
-  mm_32f_11_op = 0x09,
-  mm_32f_12_op = 0x0a,
-  mm_32f_20_op = 0x10,
-  mm_32f_30_op = 0x18,
-  mm_32f_40_op = 0x20,
-  mm_32f_41_op = 0x21,
-  mm_32f_42_op = 0x22,
-  mm_32f_50_op = 0x28,
-  mm_32f_51_op = 0x29,
-  mm_32f_52_op = 0x2a,
-  mm_32f_60_op = 0x30,
-  mm_32f_70_op = 0x38,
-  mm_32f_73_op = 0x3b,
-  mm_32f_74_op = 0x3c,
-};
-enum mm_32f_10_minor_op {
-  mm_lwxc1_op = 0x1,
-  mm_swxc1_op,
-  mm_ldxc1_op,
-  mm_sdxc1_op,
-  mm_luxc1_op,
-  mm_suxc1_op,
-};
-enum mm_32f_func {
-  mm_lwxc1_func = 0x048,
-  mm_swxc1_func = 0x088,
-  mm_ldxc1_func = 0x0c8,
-  mm_sdxc1_func = 0x108,
-};
-enum mm_32f_40_minor_op {
-  mm_fmovf_op,
-  mm_fmovt_op,
-};
-enum mm_32f_60_minor_op {
-  mm_fadd_op,
-  mm_fsub_op,
-  mm_fmul_op,
-  mm_fdiv_op,
-};
-enum mm_32f_70_minor_op {
-  mm_fmovn_op,
-  mm_fmovz_op,
-};
-enum mm_32f_73_minor_op {
-  mm_fmov0_op = 0x01,
-  mm_fcvtl_op = 0x04,
-  mm_movf0_op = 0x05,
-  mm_frsqrt_op = 0x08,
-  mm_ffloorl_op = 0x0c,
-  mm_fabs0_op = 0x0d,
-  mm_fcvtw_op = 0x24,
-  mm_movt0_op = 0x25,
-  mm_fsqrt_op = 0x28,
-  mm_ffloorw_op = 0x2c,
-  mm_fneg0_op = 0x2d,
-  mm_cfc1_op = 0x40,
-  mm_frecip_op = 0x48,
-  mm_fceill_op = 0x4c,
-  mm_fcvtd0_op = 0x4d,
-  mm_ctc1_op = 0x60,
-  mm_fceilw_op = 0x6c,
-  mm_fcvts0_op = 0x6d,
-  mm_mfc1_op = 0x80,
-  mm_fmov1_op = 0x81,
-  mm_movf1_op = 0x85,
-  mm_ftruncl_op = 0x8c,
-  mm_fabs1_op = 0x8d,
-  mm_mtc1_op = 0xa0,
-  mm_movt1_op = 0xa5,
-  mm_ftruncw_op = 0xac,
-  mm_fneg1_op = 0xad,
-  mm_mfhc1_op = 0xc0,
-  mm_froundl_op = 0xcc,
-  mm_fcvtd1_op = 0xcd,
-  mm_mthc1_op = 0xe0,
-  mm_froundw_op = 0xec,
-  mm_fcvts1_op = 0xed,
-};
-enum mm_32s_minor_op {
-  mm_32s_elm_op = 0x16,
-};
-enum mm_16c_minor_op {
-  mm_lwm16_op = 0x04,
-  mm_swm16_op = 0x05,
-  mm_jr16_op = 0x0c,
-  mm_jrc_op = 0x0d,
-  mm_jalr16_op = 0x0e,
-  mm_jalrs16_op = 0x0f,
-  mm_jraddiusp_op = 0x18,
-};
-enum mm_16d_minor_op {
-  mm_addius5_func,
-  mm_addiusp_func,
-};
-enum MIPS16e_ops {
-  MIPS16e_jal_op = 003,
-  MIPS16e_ld_op = 007,
-  MIPS16e_i8_op = 014,
-  MIPS16e_sd_op = 017,
-  MIPS16e_lb_op = 020,
-  MIPS16e_lh_op = 021,
-  MIPS16e_lwsp_op = 022,
-  MIPS16e_lw_op = 023,
-  MIPS16e_lbu_op = 024,
-  MIPS16e_lhu_op = 025,
-  MIPS16e_lwpc_op = 026,
-  MIPS16e_lwu_op = 027,
-  MIPS16e_sb_op = 030,
-  MIPS16e_sh_op = 031,
-  MIPS16e_swsp_op = 032,
-  MIPS16e_sw_op = 033,
-  MIPS16e_rr_op = 035,
-  MIPS16e_extend_op = 036,
-  MIPS16e_i64_op = 037,
-};
-enum MIPS16e_i64_func {
-  MIPS16e_ldsp_func,
-  MIPS16e_sdsp_func,
-  MIPS16e_sdrasp_func,
-  MIPS16e_dadjsp_func,
-  MIPS16e_ldpc_func,
-};
-enum MIPS16e_rr_func {
-  MIPS16e_jr_func,
-};
-enum MIPS6e_i8_func {
-  MIPS16e_swrasp_func = 02,
-};
-#define MM_NOP16 0x0c00
-struct j_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int target : 26,;
- ))
-};
-struct i_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(signed int simmediate : 16,;
- ))))
-};
-struct u_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int uimmediate : 16,;
- ))))
-};
-struct c_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int c_op : 3, __BITFIELD_FIELD(unsigned int cache : 2, __BITFIELD_FIELD(unsigned int simmediate : 16,;
- )))))
-};
-struct r_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int re : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct c0r_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int z : 8, __BITFIELD_FIELD(unsigned int sel : 3,;
- ))))))
-};
-struct mfmc0_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int re : 5, __BITFIELD_FIELD(unsigned int sc : 1, __BITFIELD_FIELD(unsigned int : 2, __BITFIELD_FIELD(unsigned int sel : 3,;
- ))))))))
-};
-struct co_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int co : 1, __BITFIELD_FIELD(unsigned int code : 19, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))
-};
-struct p_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int re : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct f_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int : 1, __BITFIELD_FIELD(unsigned int fmt : 4, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int re : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- )))))))
-};
-struct ma_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int fr : 5, __BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int func : 4, __BITFIELD_FIELD(unsigned int fmt : 2,;
- )))))))
-};
-struct b_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int code : 20, __BITFIELD_FIELD(unsigned int func : 6,;
- )))
-};
-struct ps_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct v_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int sel : 4, __BITFIELD_FIELD(unsigned int fmt : 1, __BITFIELD_FIELD(unsigned int vt : 5, __BITFIELD_FIELD(unsigned int vs : 5, __BITFIELD_FIELD(unsigned int vd : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- )))))))
-};
-struct msa_mi10_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(signed int s10 : 10, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int wd : 5, __BITFIELD_FIELD(unsigned int func : 4, __BITFIELD_FIELD(unsigned int df : 2,;
- ))))))
-};
-struct dsp_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int base : 5, __BITFIELD_FIELD(unsigned int index : 5, __BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int op : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct spec3_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(signed int simmediate : 9, __BITFIELD_FIELD(unsigned int func : 7,;
- )))))
-};
-struct fb_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int bc : 5, __BITFIELD_FIELD(unsigned int cc : 3, __BITFIELD_FIELD(unsigned int flag : 2, __BITFIELD_FIELD(signed int simmediate : 16,;
- )))))
-};
-struct fp0_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int fmt : 5, __BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct mm_fp0_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fmt : 3, __BITFIELD_FIELD(unsigned int op : 2, __BITFIELD_FIELD(unsigned int func : 6,;
- )))))))
-};
-struct fp1_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int op : 5, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct mm_fp1_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fmt : 2, __BITFIELD_FIELD(unsigned int op : 8, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct mm_fp2_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int cc : 3, __BITFIELD_FIELD(unsigned int zero : 2, __BITFIELD_FIELD(unsigned int fmt : 2, __BITFIELD_FIELD(unsigned int op : 3, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))))
-};
-struct mm_fp3_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fmt : 3, __BITFIELD_FIELD(unsigned int op : 7, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct mm_fp4_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int cc : 3, __BITFIELD_FIELD(unsigned int fmt : 3, __BITFIELD_FIELD(unsigned int cond : 4, __BITFIELD_FIELD(unsigned int func : 6,;
- )))))))
-};
-struct mm_fp5_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int index : 5, __BITFIELD_FIELD(unsigned int base : 5, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int op : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct fp6_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int fr : 5, __BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct mm_fp6_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fr : 5, __BITFIELD_FIELD(unsigned int func : 6,;
- ))))))
-};
-struct mm_i_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(signed int simmediate : 16,;
- ))))
-};
-struct mm_m_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int base : 5, __BITFIELD_FIELD(unsigned int func : 4, __BITFIELD_FIELD(signed int simmediate : 12,;
- )))))
-};
-struct mm_x_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int index : 5, __BITFIELD_FIELD(unsigned int base : 5, __BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int func : 11,;
- )))))
-};
-struct mm_a_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 3, __BITFIELD_FIELD(signed int simmediate : 23,;
- )))
-};
-struct mm_b0_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(signed int simmediate : 10, __BITFIELD_FIELD(unsigned int : 16,;
- )))
-};
-struct mm_b1_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rs : 3, __BITFIELD_FIELD(signed int simmediate : 7, __BITFIELD_FIELD(unsigned int : 16,;
- ))))
-};
-struct mm16_m_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int func : 4, __BITFIELD_FIELD(unsigned int rlist : 2, __BITFIELD_FIELD(unsigned int imm : 4, __BITFIELD_FIELD(unsigned int : 16,;
- )))))
-};
-struct mm16_rb_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rt : 3, __BITFIELD_FIELD(unsigned int base : 3, __BITFIELD_FIELD(signed int simmediate : 4, __BITFIELD_FIELD(unsigned int : 16,;
- )))))
-};
-struct mm16_r3_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rt : 3, __BITFIELD_FIELD(signed int simmediate : 7, __BITFIELD_FIELD(unsigned int : 16,;
- ))))
-};
-struct mm16_r5_format {
-  __BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int imm : 5, __BITFIELD_FIELD(unsigned int : 16,;
- ))))
-};
-struct m16e_rr {
-  __BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int rx : 3, __BITFIELD_FIELD(unsigned int nd : 1, __BITFIELD_FIELD(unsigned int l : 1, __BITFIELD_FIELD(unsigned int ra : 1, __BITFIELD_FIELD(unsigned int func : 5,;
- ))))))
-};
-struct m16e_jal {
-  __BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int x : 1, __BITFIELD_FIELD(unsigned int imm20_16 : 5, __BITFIELD_FIELD(signed int imm25_21 : 5,;
- ))))
-};
-struct m16e_i64 {
-  __BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int func : 3, __BITFIELD_FIELD(unsigned int imm : 8,;
- )))
-};
-struct m16e_ri64 {
-  __BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int func : 3, __BITFIELD_FIELD(unsigned int ry : 3, __BITFIELD_FIELD(unsigned int imm : 5,;
- ))))
-};
-struct m16e_ri {
-  __BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int rx : 3, __BITFIELD_FIELD(unsigned int imm : 8,;
- )))
-};
-struct m16e_rri {
-  __BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int rx : 3, __BITFIELD_FIELD(unsigned int ry : 3, __BITFIELD_FIELD(unsigned int imm : 5,;
- ))))
-};
-struct m16e_i8 {
-  __BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int func : 3, __BITFIELD_FIELD(unsigned int imm : 8,;
- )))
-};
-union mips_instruction {
-  unsigned int word;
-  unsigned short halfword[2];
-  unsigned char byte[4];
-  struct j_format j_format;
-  struct i_format i_format;
-  struct u_format u_format;
-  struct c_format c_format;
-  struct r_format r_format;
-  struct c0r_format c0r_format;
-  struct mfmc0_format mfmc0_format;
-  struct co_format co_format;
-  struct p_format p_format;
-  struct f_format f_format;
-  struct ma_format ma_format;
-  struct msa_mi10_format msa_mi10_format;
-  struct b_format b_format;
-  struct ps_format ps_format;
-  struct v_format v_format;
-  struct dsp_format dsp_format;
-  struct spec3_format spec3_format;
-  struct fb_format fb_format;
-  struct fp0_format fp0_format;
-  struct mm_fp0_format mm_fp0_format;
-  struct fp1_format fp1_format;
-  struct mm_fp1_format mm_fp1_format;
-  struct mm_fp2_format mm_fp2_format;
-  struct mm_fp3_format mm_fp3_format;
-  struct mm_fp4_format mm_fp4_format;
-  struct mm_fp5_format mm_fp5_format;
-  struct fp6_format fp6_format;
-  struct mm_fp6_format mm_fp6_format;
-  struct mm_i_format mm_i_format;
-  struct mm_m_format mm_m_format;
-  struct mm_x_format mm_x_format;
-  struct mm_a_format mm_a_format;
-  struct mm_b0_format mm_b0_format;
-  struct mm_b1_format mm_b1_format;
-  struct mm16_m_format mm16_m_format;
-  struct mm16_rb_format mm16_rb_format;
-  struct mm16_r3_format mm16_r3_format;
-  struct mm16_r5_format mm16_r5_format;
-};
-union mips16e_instruction {
-  unsigned int full : 16;
-  struct m16e_rr rr;
-  struct m16e_jal jal;
-  struct m16e_i64 i64;
-  struct m16e_ri64 ri64;
-  struct m16e_ri ri;
-  struct m16e_rri rri;
-  struct m16e_i8 i8;
-};
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/ioctl.h b/libc/kernel/uapi/asm-mips/asm/ioctl.h
deleted file mode 100644
index 73e6244..0000000
--- a/libc/kernel/uapi/asm-mips/asm/ioctl.h
+++ /dev/null
@@ -1,27 +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 __ASM_IOCTL_H
-#define __ASM_IOCTL_H
-#define _IOC_SIZEBITS 13
-#define _IOC_DIRBITS 3
-#define _IOC_NONE 1U
-#define _IOC_READ 2U
-#define _IOC_WRITE 4U
-#include <asm-generic/ioctl.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/ioctls.h b/libc/kernel/uapi/asm-mips/asm/ioctls.h
deleted file mode 100644
index 694546f..0000000
--- a/libc/kernel/uapi/asm-mips/asm/ioctls.h
+++ /dev/null
@@ -1,108 +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 __ASM_IOCTLS_H
-#define __ASM_IOCTLS_H
-#include <asm/ioctl.h>
-#define TCGETA 0x5401
-#define TCSETA 0x5402
-#define TCSETAW 0x5403
-#define TCSETAF 0x5404
-#define TCSBRK 0x5405
-#define TCXONC 0x5406
-#define TCFLSH 0x5407
-#define TCGETS 0x540d
-#define TCSETS 0x540e
-#define TCSETSW 0x540f
-#define TCSETSF 0x5410
-#define TIOCEXCL 0x740d
-#define TIOCNXCL 0x740e
-#define TIOCOUTQ 0x7472
-#define TIOCSTI 0x5472
-#define TIOCMGET 0x741d
-#define TIOCMBIS 0x741b
-#define TIOCMBIC 0x741c
-#define TIOCMSET 0x741a
-#define TIOCPKT 0x5470
-#define TIOCPKT_DATA 0x00
-#define TIOCPKT_FLUSHREAD 0x01
-#define TIOCPKT_FLUSHWRITE 0x02
-#define TIOCPKT_STOP 0x04
-#define TIOCPKT_START 0x08
-#define TIOCPKT_NOSTOP 0x10
-#define TIOCPKT_DOSTOP 0x20
-#define TIOCPKT_IOCTL 0x40
-#define TIOCSWINSZ _IOW('t', 103, struct winsize)
-#define TIOCGWINSZ _IOR('t', 104, struct winsize)
-#define TIOCNOTTY 0x5471
-#define TIOCSETD 0x7401
-#define TIOCGETD 0x7400
-#define FIOCLEX 0x6601
-#define FIONCLEX 0x6602
-#define FIOASYNC 0x667d
-#define FIONBIO 0x667e
-#define FIOQSIZE 0x667f
-#define TIOCGLTC 0x7474
-#define TIOCSLTC 0x7475
-#define TIOCSPGRP _IOW('t', 118, int)
-#define TIOCGPGRP _IOR('t', 119, int)
-#define TIOCCONS _IOW('t', 120, int)
-#define FIONREAD 0x467f
-#define TIOCINQ FIONREAD
-#define TIOCGETP 0x7408
-#define TIOCSETP 0x7409
-#define TIOCSETN 0x740a
-#define TIOCSBRK 0x5427
-#define TIOCCBRK 0x5428
-#define TIOCGSID 0x7416
-#define TCGETS2 _IOR('T', 0x2A, struct termios2)
-#define TCSETS2 _IOW('T', 0x2B, struct termios2)
-#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
-#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
-#define TIOCGRS485 _IOR('T', 0x2E, struct serial_rs485)
-#define TIOCSRS485 _IOWR('T', 0x2F, struct serial_rs485)
-#define TIOCGPTN _IOR('T', 0x30, unsigned int)
-#define TIOCSPTLCK _IOW('T', 0x31, int)
-#define TIOCGDEV _IOR('T', 0x32, unsigned int)
-#define TIOCSIG _IOW('T', 0x36, int)
-#define TIOCVHANGUP 0x5437
-#define TIOCGPKT _IOR('T', 0x38, int)
-#define TIOCGPTLCK _IOR('T', 0x39, int)
-#define TIOCGEXCL _IOR('T', 0x40, int)
-#define TIOCGPTPEER _IO('T', 0x41)
-#define TIOCGISO7816 _IOR('T', 0x42, struct serial_iso7816)
-#define TIOCSISO7816 _IOWR('T', 0x43, struct serial_iso7816)
-#define TIOCSCTTY 0x5480
-#define TIOCGSOFTCAR 0x5481
-#define TIOCSSOFTCAR 0x5482
-#define TIOCLINUX 0x5483
-#define TIOCGSERIAL 0x5484
-#define TIOCSSERIAL 0x5485
-#define TCSBRKP 0x5486
-#define TIOCSERCONFIG 0x5488
-#define TIOCSERGWILD 0x5489
-#define TIOCSERSWILD 0x548a
-#define TIOCGLCKTRMIOS 0x548b
-#define TIOCSLCKTRMIOS 0x548c
-#define TIOCSERGSTRUCT 0x548d
-#define TIOCSERGETLSR 0x548e
-#define TIOCSERGETMULTI 0x548f
-#define TIOCSERSETMULTI 0x5490
-#define TIOCMIWAIT 0x5491
-#define TIOCGICOUNT 0x5492
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/ipcbuf.h b/libc/kernel/uapi/asm-mips/asm/ipcbuf.h
deleted file mode 100644
index 0021f14..0000000
--- a/libc/kernel/uapi/asm-mips/asm/ipcbuf.h
+++ /dev/null
@@ -1,19 +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!
- ***
- ****************************************************************************
- ****************************************************************************/
-#include <asm-generic/ipcbuf.h>
diff --git a/libc/kernel/uapi/asm-mips/asm/kvm.h b/libc/kernel/uapi/asm-mips/asm/kvm.h
deleted file mode 100644
index c42ea8d..0000000
--- a/libc/kernel/uapi/asm-mips/asm/kvm.h
+++ /dev/null
@@ -1,100 +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_KVM_MIPS_H
-#define __LINUX_KVM_MIPS_H
-#include <linux/types.h>
-#define __KVM_HAVE_READONLY_MEM
-#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
-struct kvm_regs {
-  __u64 gpr[32];
-  __u64 hi;
-  __u64 lo;
-  __u64 pc;
-};
-struct kvm_fpu {
-};
-#define KVM_REG_MIPS_GP (KVM_REG_MIPS | 0x0000000000000000ULL)
-#define KVM_REG_MIPS_CP0 (KVM_REG_MIPS | 0x0000000000010000ULL)
-#define KVM_REG_MIPS_KVM (KVM_REG_MIPS | 0x0000000000020000ULL)
-#define KVM_REG_MIPS_FPU (KVM_REG_MIPS | 0x0000000000030000ULL)
-#define KVM_REG_MIPS_R0 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 0)
-#define KVM_REG_MIPS_R1 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 1)
-#define KVM_REG_MIPS_R2 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 2)
-#define KVM_REG_MIPS_R3 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 3)
-#define KVM_REG_MIPS_R4 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 4)
-#define KVM_REG_MIPS_R5 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 5)
-#define KVM_REG_MIPS_R6 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 6)
-#define KVM_REG_MIPS_R7 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 7)
-#define KVM_REG_MIPS_R8 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 8)
-#define KVM_REG_MIPS_R9 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 9)
-#define KVM_REG_MIPS_R10 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 10)
-#define KVM_REG_MIPS_R11 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 11)
-#define KVM_REG_MIPS_R12 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 12)
-#define KVM_REG_MIPS_R13 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 13)
-#define KVM_REG_MIPS_R14 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 14)
-#define KVM_REG_MIPS_R15 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 15)
-#define KVM_REG_MIPS_R16 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 16)
-#define KVM_REG_MIPS_R17 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 17)
-#define KVM_REG_MIPS_R18 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 18)
-#define KVM_REG_MIPS_R19 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 19)
-#define KVM_REG_MIPS_R20 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 20)
-#define KVM_REG_MIPS_R21 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 21)
-#define KVM_REG_MIPS_R22 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 22)
-#define KVM_REG_MIPS_R23 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 23)
-#define KVM_REG_MIPS_R24 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 24)
-#define KVM_REG_MIPS_R25 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 25)
-#define KVM_REG_MIPS_R26 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 26)
-#define KVM_REG_MIPS_R27 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 27)
-#define KVM_REG_MIPS_R28 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 28)
-#define KVM_REG_MIPS_R29 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 29)
-#define KVM_REG_MIPS_R30 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 30)
-#define KVM_REG_MIPS_R31 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 31)
-#define KVM_REG_MIPS_HI (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 32)
-#define KVM_REG_MIPS_LO (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 33)
-#define KVM_REG_MIPS_PC (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 34)
-#define KVM_REG_MIPS_MAAR (KVM_REG_MIPS_CP0 | (1 << 8))
-#define KVM_REG_MIPS_CP0_MAAR(n) (KVM_REG_MIPS_MAAR | KVM_REG_SIZE_U64 | (n))
-#define KVM_REG_MIPS_COUNT_CTL (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 0)
-#define KVM_REG_MIPS_COUNT_CTL_DC 0x00000001
-#define KVM_REG_MIPS_COUNT_RESUME (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 1)
-#define KVM_REG_MIPS_COUNT_HZ (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 2)
-#define KVM_REG_MIPS_FPR (KVM_REG_MIPS_FPU | 0x0000000000000000ULL)
-#define KVM_REG_MIPS_FCR (KVM_REG_MIPS_FPU | 0x0000000000000100ULL)
-#define KVM_REG_MIPS_MSACR (KVM_REG_MIPS_FPU | 0x0000000000000200ULL)
-#define KVM_REG_MIPS_FPR_32(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U32 | (n))
-#define KVM_REG_MIPS_FPR_64(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U64 | (n))
-#define KVM_REG_MIPS_VEC_128(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U128 | (n))
-#define KVM_REG_MIPS_FCR_IR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 0)
-#define KVM_REG_MIPS_FCR_CSR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 31)
-#define KVM_REG_MIPS_MSA_IR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 0)
-#define KVM_REG_MIPS_MSA_CSR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 1)
-struct kvm_debug_exit_arch {
-  __u64 epc;
-};
-struct kvm_guest_debug_arch {
-};
-struct kvm_sync_regs {
-};
-struct kvm_sregs {
-};
-struct kvm_mips_interrupt {
-  __u32 cpu;
-  __u32 irq;
-};
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/kvm_para.h b/libc/kernel/uapi/asm-mips/asm/kvm_para.h
deleted file mode 100644
index 825c12a..0000000
--- a/libc/kernel/uapi/asm-mips/asm/kvm_para.h
+++ /dev/null
@@ -1,21 +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 _UAPI_ASM_MIPS_KVM_PARA_H
-#define _UAPI_ASM_MIPS_KVM_PARA_H
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/mman.h b/libc/kernel/uapi/asm-mips/asm/mman.h
deleted file mode 100644
index 86df482..0000000
--- a/libc/kernel/uapi/asm-mips/asm/mman.h
+++ /dev/null
@@ -1,76 +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 _ASM_MMAN_H
-#define _ASM_MMAN_H
-#define PROT_NONE 0x00
-#define PROT_READ 0x01
-#define PROT_WRITE 0x02
-#define PROT_EXEC 0x04
-#define PROT_SEM 0x10
-#define PROT_GROWSDOWN 0x01000000
-#define PROT_GROWSUP 0x02000000
-#define MAP_TYPE 0x00f
-#define MAP_FIXED 0x010
-#define MAP_RENAME 0x020
-#define MAP_AUTOGROW 0x040
-#define MAP_LOCAL 0x080
-#define MAP_AUTORSRV 0x100
-#define MAP_NORESERVE 0x0400
-#define MAP_ANONYMOUS 0x0800
-#define MAP_GROWSDOWN 0x1000
-#define MAP_DENYWRITE 0x2000
-#define MAP_EXECUTABLE 0x4000
-#define MAP_LOCKED 0x8000
-#define MAP_POPULATE 0x10000
-#define MAP_NONBLOCK 0x20000
-#define MAP_STACK 0x40000
-#define MAP_HUGETLB 0x80000
-#define MAP_FIXED_NOREPLACE 0x100000
-#define MS_ASYNC 0x0001
-#define MS_INVALIDATE 0x0002
-#define MS_SYNC 0x0004
-#define MCL_CURRENT 1
-#define MCL_FUTURE 2
-#define MCL_ONFAULT 4
-#define MLOCK_ONFAULT 0x01
-#define MADV_NORMAL 0
-#define MADV_RANDOM 1
-#define MADV_SEQUENTIAL 2
-#define MADV_WILLNEED 3
-#define MADV_DONTNEED 4
-#define MADV_FREE 8
-#define MADV_REMOVE 9
-#define MADV_DONTFORK 10
-#define MADV_DOFORK 11
-#define MADV_MERGEABLE 12
-#define MADV_UNMERGEABLE 13
-#define MADV_HWPOISON 100
-#define MADV_HUGEPAGE 14
-#define MADV_NOHUGEPAGE 15
-#define MADV_DONTDUMP 16
-#define MADV_DODUMP 17
-#define MADV_WIPEONFORK 18
-#define MADV_KEEPONFORK 19
-#define MADV_COLD 20
-#define MADV_PAGEOUT 21
-#define MAP_FILE 0
-#define PKEY_DISABLE_ACCESS 0x1
-#define PKEY_DISABLE_WRITE 0x2
-#define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE)
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/msgbuf.h b/libc/kernel/uapi/asm-mips/asm/msgbuf.h
deleted file mode 100644
index e41761a..0000000
--- a/libc/kernel/uapi/asm-mips/asm/msgbuf.h
+++ /dev/null
@@ -1,53 +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 _ASM_MSGBUF_H
-#define _ASM_MSGBUF_H
-#ifdef __mips64
-struct msqid64_ds {
-  struct ipc64_perm msg_perm;
-  __kernel_time_t msg_stime;
-  __kernel_time_t msg_rtime;
-  __kernel_time_t msg_ctime;
-  unsigned long msg_cbytes;
-  unsigned long msg_qnum;
-  unsigned long msg_qbytes;
-  __kernel_pid_t msg_lspid;
-  __kernel_pid_t msg_lrpid;
-  unsigned long __unused4;
-  unsigned long __unused5;
-};
-#elif 1
-struct msqid64_ds {
-  struct ipc64_perm msg_perm;
-  unsigned long msg_stime;
-  unsigned long msg_stime_high;
-  unsigned long msg_rtime;
-  unsigned long msg_rtime_high;
-  unsigned long msg_ctime;
-  unsigned long msg_ctime_high;
-  unsigned long msg_cbytes;
-  unsigned long msg_qnum;
-  unsigned long msg_qbytes;
-  __kernel_pid_t msg_lspid;
-  __kernel_pid_t msg_lrpid;
-  unsigned long __unused4;
-  unsigned long __unused5;
-};
-#endif
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/param.h b/libc/kernel/uapi/asm-mips/asm/param.h
deleted file mode 100644
index cdfa9b8..0000000
--- a/libc/kernel/uapi/asm-mips/asm/param.h
+++ /dev/null
@@ -1,23 +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 _ASM_PARAM_H
-#define _ASM_PARAM_H
-#define EXEC_PAGESIZE 65536
-#include <asm-generic/param.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/poll.h b/libc/kernel/uapi/asm-mips/asm/poll.h
deleted file mode 100644
index 566ec4f..0000000
--- a/libc/kernel/uapi/asm-mips/asm/poll.h
+++ /dev/null
@@ -1,24 +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 __ASM_POLL_H
-#define __ASM_POLL_H
-#define POLLWRNORM POLLOUT
-#define POLLWRBAND 0x0100
-#include <asm-generic/poll.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/posix_types.h b/libc/kernel/uapi/asm-mips/asm/posix_types.h
deleted file mode 100644
index 30c9f32..0000000
--- a/libc/kernel/uapi/asm-mips/asm/posix_types.h
+++ /dev/null
@@ -1,25 +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 _ASM_POSIX_TYPES_H
-#define _ASM_POSIX_TYPES_H
-#include <asm/sgidefs.h>
-typedef long __kernel_daddr_t;
-#define __kernel_daddr_t __kernel_daddr_t
-#include <asm-generic/posix_types.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/ptrace.h b/libc/kernel/uapi/asm-mips/asm/ptrace.h
deleted file mode 100644
index a5f49aa..0000000
--- a/libc/kernel/uapi/asm-mips/asm/ptrace.h
+++ /dev/null
@@ -1,79 +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 _UAPI_ASM_PTRACE_H
-#define _UAPI_ASM_PTRACE_H
-#include <linux/types.h>
-#define FPR_BASE 32
-#define PC 64
-#define CAUSE 65
-#define BADVADDR 66
-#define MMHI 67
-#define MMLO 68
-#define FPC_CSR 69
-#define FPC_EIR 70
-#define DSP_BASE 71
-#define DSP_CONTROL 77
-#define ACX 78
-struct pt_regs {
-  __u64 regs[32];
-  __u64 lo;
-  __u64 hi;
-  __u64 cp0_epc;
-  __u64 cp0_badvaddr;
-  __u64 cp0_status;
-  __u64 cp0_cause;
-} __attribute__((aligned(8)));
-#define PTRACE_GETREGS 12
-#define PTRACE_SETREGS 13
-#define PTRACE_GETFPREGS 14
-#define PTRACE_SETFPREGS 15
-#define PTRACE_OLDSETOPTIONS 21
-#define PTRACE_GET_THREAD_AREA 25
-#define PTRACE_SET_THREAD_AREA 26
-#define PTRACE_PEEKTEXT_3264 0xc0
-#define PTRACE_PEEKDATA_3264 0xc1
-#define PTRACE_POKETEXT_3264 0xc2
-#define PTRACE_POKEDATA_3264 0xc3
-#define PTRACE_GET_THREAD_AREA_3264 0xc4
-enum pt_watch_style {
-  pt_watch_style_mips32,
-  pt_watch_style_mips64
-};
-struct mips32_watch_regs {
-  unsigned int watchlo[8];
-  unsigned short watchhi[8];
-  unsigned short watch_masks[8];
-  unsigned int num_valid;
-} __attribute__((aligned(8)));
-struct mips64_watch_regs {
-  unsigned long long watchlo[8];
-  unsigned short watchhi[8];
-  unsigned short watch_masks[8];
-  unsigned int num_valid;
-} __attribute__((aligned(8)));
-struct pt_watch_regs {
-  enum pt_watch_style style;
-  union {
-    struct mips32_watch_regs mips32;
-    struct mips64_watch_regs mips64;
-  };
-};
-#define PTRACE_GET_WATCH_REGS 0xd0
-#define PTRACE_SET_WATCH_REGS 0xd1
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/reg.h b/libc/kernel/uapi/asm-mips/asm/reg.h
deleted file mode 100644
index 70015bc..0000000
--- a/libc/kernel/uapi/asm-mips/asm/reg.h
+++ /dev/null
@@ -1,182 +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 __UAPI_ASM_MIPS_REG_H
-#define __UAPI_ASM_MIPS_REG_H
-#define MIPS32_EF_R0 6
-#define MIPS32_EF_R1 7
-#define MIPS32_EF_R2 8
-#define MIPS32_EF_R3 9
-#define MIPS32_EF_R4 10
-#define MIPS32_EF_R5 11
-#define MIPS32_EF_R6 12
-#define MIPS32_EF_R7 13
-#define MIPS32_EF_R8 14
-#define MIPS32_EF_R9 15
-#define MIPS32_EF_R10 16
-#define MIPS32_EF_R11 17
-#define MIPS32_EF_R12 18
-#define MIPS32_EF_R13 19
-#define MIPS32_EF_R14 20
-#define MIPS32_EF_R15 21
-#define MIPS32_EF_R16 22
-#define MIPS32_EF_R17 23
-#define MIPS32_EF_R18 24
-#define MIPS32_EF_R19 25
-#define MIPS32_EF_R20 26
-#define MIPS32_EF_R21 27
-#define MIPS32_EF_R22 28
-#define MIPS32_EF_R23 29
-#define MIPS32_EF_R24 30
-#define MIPS32_EF_R25 31
-#define MIPS32_EF_R26 32
-#define MIPS32_EF_R27 33
-#define MIPS32_EF_R28 34
-#define MIPS32_EF_R29 35
-#define MIPS32_EF_R30 36
-#define MIPS32_EF_R31 37
-#define MIPS32_EF_LO 38
-#define MIPS32_EF_HI 39
-#define MIPS32_EF_CP0_EPC 40
-#define MIPS32_EF_CP0_BADVADDR 41
-#define MIPS32_EF_CP0_STATUS 42
-#define MIPS32_EF_CP0_CAUSE 43
-#define MIPS32_EF_UNUSED0 44
-#define MIPS32_EF_SIZE 180
-#define MIPS64_EF_R0 0
-#define MIPS64_EF_R1 1
-#define MIPS64_EF_R2 2
-#define MIPS64_EF_R3 3
-#define MIPS64_EF_R4 4
-#define MIPS64_EF_R5 5
-#define MIPS64_EF_R6 6
-#define MIPS64_EF_R7 7
-#define MIPS64_EF_R8 8
-#define MIPS64_EF_R9 9
-#define MIPS64_EF_R10 10
-#define MIPS64_EF_R11 11
-#define MIPS64_EF_R12 12
-#define MIPS64_EF_R13 13
-#define MIPS64_EF_R14 14
-#define MIPS64_EF_R15 15
-#define MIPS64_EF_R16 16
-#define MIPS64_EF_R17 17
-#define MIPS64_EF_R18 18
-#define MIPS64_EF_R19 19
-#define MIPS64_EF_R20 20
-#define MIPS64_EF_R21 21
-#define MIPS64_EF_R22 22
-#define MIPS64_EF_R23 23
-#define MIPS64_EF_R24 24
-#define MIPS64_EF_R25 25
-#define MIPS64_EF_R26 26
-#define MIPS64_EF_R27 27
-#define MIPS64_EF_R28 28
-#define MIPS64_EF_R29 29
-#define MIPS64_EF_R30 30
-#define MIPS64_EF_R31 31
-#define MIPS64_EF_LO 32
-#define MIPS64_EF_HI 33
-#define MIPS64_EF_CP0_EPC 34
-#define MIPS64_EF_CP0_BADVADDR 35
-#define MIPS64_EF_CP0_STATUS 36
-#define MIPS64_EF_CP0_CAUSE 37
-#define MIPS64_EF_SIZE 304
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-#define EF_R0 MIPS32_EF_R0
-#define EF_R1 MIPS32_EF_R1
-#define EF_R2 MIPS32_EF_R2
-#define EF_R3 MIPS32_EF_R3
-#define EF_R4 MIPS32_EF_R4
-#define EF_R5 MIPS32_EF_R5
-#define EF_R6 MIPS32_EF_R6
-#define EF_R7 MIPS32_EF_R7
-#define EF_R8 MIPS32_EF_R8
-#define EF_R9 MIPS32_EF_R9
-#define EF_R10 MIPS32_EF_R10
-#define EF_R11 MIPS32_EF_R11
-#define EF_R12 MIPS32_EF_R12
-#define EF_R13 MIPS32_EF_R13
-#define EF_R14 MIPS32_EF_R14
-#define EF_R15 MIPS32_EF_R15
-#define EF_R16 MIPS32_EF_R16
-#define EF_R17 MIPS32_EF_R17
-#define EF_R18 MIPS32_EF_R18
-#define EF_R19 MIPS32_EF_R19
-#define EF_R20 MIPS32_EF_R20
-#define EF_R21 MIPS32_EF_R21
-#define EF_R22 MIPS32_EF_R22
-#define EF_R23 MIPS32_EF_R23
-#define EF_R24 MIPS32_EF_R24
-#define EF_R25 MIPS32_EF_R25
-#define EF_R26 MIPS32_EF_R26
-#define EF_R27 MIPS32_EF_R27
-#define EF_R28 MIPS32_EF_R28
-#define EF_R29 MIPS32_EF_R29
-#define EF_R30 MIPS32_EF_R30
-#define EF_R31 MIPS32_EF_R31
-#define EF_LO MIPS32_EF_LO
-#define EF_HI MIPS32_EF_HI
-#define EF_CP0_EPC MIPS32_EF_CP0_EPC
-#define EF_CP0_BADVADDR MIPS32_EF_CP0_BADVADDR
-#define EF_CP0_STATUS MIPS32_EF_CP0_STATUS
-#define EF_CP0_CAUSE MIPS32_EF_CP0_CAUSE
-#define EF_UNUSED0 MIPS32_EF_UNUSED0
-#define EF_SIZE MIPS32_EF_SIZE
-#elif _MIPS_SIM==_MIPS_SIM_ABI64||_MIPS_SIM==_MIPS_SIM_NABI32
-#define EF_R0 MIPS64_EF_R0
-#define EF_R1 MIPS64_EF_R1
-#define EF_R2 MIPS64_EF_R2
-#define EF_R3 MIPS64_EF_R3
-#define EF_R4 MIPS64_EF_R4
-#define EF_R5 MIPS64_EF_R5
-#define EF_R6 MIPS64_EF_R6
-#define EF_R7 MIPS64_EF_R7
-#define EF_R8 MIPS64_EF_R8
-#define EF_R9 MIPS64_EF_R9
-#define EF_R10 MIPS64_EF_R10
-#define EF_R11 MIPS64_EF_R11
-#define EF_R12 MIPS64_EF_R12
-#define EF_R13 MIPS64_EF_R13
-#define EF_R14 MIPS64_EF_R14
-#define EF_R15 MIPS64_EF_R15
-#define EF_R16 MIPS64_EF_R16
-#define EF_R17 MIPS64_EF_R17
-#define EF_R18 MIPS64_EF_R18
-#define EF_R19 MIPS64_EF_R19
-#define EF_R20 MIPS64_EF_R20
-#define EF_R21 MIPS64_EF_R21
-#define EF_R22 MIPS64_EF_R22
-#define EF_R23 MIPS64_EF_R23
-#define EF_R24 MIPS64_EF_R24
-#define EF_R25 MIPS64_EF_R25
-#define EF_R26 MIPS64_EF_R26
-#define EF_R27 MIPS64_EF_R27
-#define EF_R28 MIPS64_EF_R28
-#define EF_R29 MIPS64_EF_R29
-#define EF_R30 MIPS64_EF_R30
-#define EF_R31 MIPS64_EF_R31
-#define EF_LO MIPS64_EF_LO
-#define EF_HI MIPS64_EF_HI
-#define EF_CP0_EPC MIPS64_EF_CP0_EPC
-#define EF_CP0_BADVADDR MIPS64_EF_CP0_BADVADDR
-#define EF_CP0_STATUS MIPS64_EF_CP0_STATUS
-#define EF_CP0_CAUSE MIPS64_EF_CP0_CAUSE
-#define EF_SIZE MIPS64_EF_SIZE
-#endif
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/resource.h b/libc/kernel/uapi/asm-mips/asm/resource.h
deleted file mode 100644
index f0cefad..0000000
--- a/libc/kernel/uapi/asm-mips/asm/resource.h
+++ /dev/null
@@ -1,30 +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 _ASM_RESOURCE_H
-#define _ASM_RESOURCE_H
-#define RLIMIT_NOFILE 5
-#define RLIMIT_AS 6
-#define RLIMIT_RSS 7
-#define RLIMIT_NPROC 8
-#define RLIMIT_MEMLOCK 9
-#ifndef __mips64
-#define RLIM_INFINITY 0x7fffffffUL
-#endif
-#include <asm-generic/resource.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/sembuf.h b/libc/kernel/uapi/asm-mips/asm/sembuf.h
deleted file mode 100644
index a46f326..0000000
--- a/libc/kernel/uapi/asm-mips/asm/sembuf.h
+++ /dev/null
@@ -1,40 +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 _ASM_SEMBUF_H
-#define _ASM_SEMBUF_H
-#ifdef __mips64
-struct semid64_ds {
-  struct ipc64_perm sem_perm;
-  __kernel_time_t sem_otime;
-  __kernel_time_t sem_ctime;
-  unsigned long sem_nsems;
-  unsigned long __unused1;
-  unsigned long __unused2;
-};
-#else
-struct semid64_ds {
-  struct ipc64_perm sem_perm;
-  unsigned long sem_otime;
-  unsigned long sem_ctime;
-  unsigned long sem_nsems;
-  unsigned long sem_otime_high;
-  unsigned long sem_ctime_high;
-};
-#endif
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/setup.h b/libc/kernel/uapi/asm-mips/asm/setup.h
deleted file mode 100644
index 4e09e3c..0000000
--- a/libc/kernel/uapi/asm-mips/asm/setup.h
+++ /dev/null
@@ -1,22 +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 _UAPI_MIPS_SETUP_H
-#define _UAPI_MIPS_SETUP_H
-#define COMMAND_LINE_SIZE 4096
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/sgidefs.h b/libc/kernel/uapi/asm-mips/asm/sgidefs.h
deleted file mode 100644
index 92750de..0000000
--- a/libc/kernel/uapi/asm-mips/asm/sgidefs.h
+++ /dev/null
@@ -1,31 +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 __ASM_SGIDEFS_H
-#define __ASM_SGIDEFS_H
-#define _MIPS_ISA_MIPS1 1
-#define _MIPS_ISA_MIPS2 2
-#define _MIPS_ISA_MIPS3 3
-#define _MIPS_ISA_MIPS4 4
-#define _MIPS_ISA_MIPS5 5
-#define _MIPS_ISA_MIPS32 6
-#define _MIPS_ISA_MIPS64 7
-#define _MIPS_SIM_ABI32 1
-#define _MIPS_SIM_NABI32 2
-#define _MIPS_SIM_ABI64 3
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/shmbuf.h b/libc/kernel/uapi/asm-mips/asm/shmbuf.h
deleted file mode 100644
index 9c42cee..0000000
--- a/libc/kernel/uapi/asm-mips/asm/shmbuf.h
+++ /dev/null
@@ -1,61 +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 _ASM_SHMBUF_H
-#define _ASM_SHMBUF_H
-#ifdef __mips64
-struct shmid64_ds {
-  struct ipc64_perm shm_perm;
-  size_t shm_segsz;
-  __kernel_time_t shm_atime;
-  __kernel_time_t shm_dtime;
-  __kernel_time_t shm_ctime;
-  __kernel_pid_t shm_cpid;
-  __kernel_pid_t shm_lpid;
-  unsigned long shm_nattch;
-  unsigned long __unused1;
-  unsigned long __unused2;
-};
-#else
-struct shmid64_ds {
-  struct ipc64_perm shm_perm;
-  size_t shm_segsz;
-  unsigned long shm_atime;
-  unsigned long shm_dtime;
-  unsigned long shm_ctime;
-  __kernel_pid_t shm_cpid;
-  __kernel_pid_t shm_lpid;
-  unsigned long shm_nattch;
-  unsigned short shm_atime_high;
-  unsigned short shm_dtime_high;
-  unsigned short shm_ctime_high;
-  unsigned short __unused1;
-};
-#endif
-struct shminfo64 {
-  unsigned long shmmax;
-  unsigned long shmmin;
-  unsigned long shmmni;
-  unsigned long shmseg;
-  unsigned long shmall;
-  unsigned long __unused1;
-  unsigned long __unused2;
-  unsigned long __unused3;
-  unsigned long __unused4;
-};
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/sigcontext.h b/libc/kernel/uapi/asm-mips/asm/sigcontext.h
deleted file mode 100644
index da82711..0000000
--- a/libc/kernel/uapi/asm-mips/asm/sigcontext.h
+++ /dev/null
@@ -1,69 +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 _UAPI_ASM_SIGCONTEXT_H
-#define _UAPI_ASM_SIGCONTEXT_H
-#include <linux/types.h>
-#include <asm/sgidefs.h>
-#define USED_FP (1 << 0)
-#define USED_FR1 (1 << 1)
-#define USED_HYBRID_FPRS (1 << 2)
-#define USED_EXTCONTEXT (1 << 3)
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-struct sigcontext {
-  unsigned int sc_regmask;
-  unsigned int sc_status;
-  unsigned long long sc_pc;
-  unsigned long long sc_regs[32];
-  unsigned long long sc_fpregs[32];
-  unsigned int sc_acx;
-  unsigned int sc_fpc_csr;
-  unsigned int sc_fpc_eir;
-  unsigned int sc_used_math;
-  unsigned int sc_dsp;
-  unsigned long long sc_mdhi;
-  unsigned long long sc_mdlo;
-  unsigned long sc_hi1;
-  unsigned long sc_lo1;
-  unsigned long sc_hi2;
-  unsigned long sc_lo2;
-  unsigned long sc_hi3;
-  unsigned long sc_lo3;
-};
-#endif
-#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
-#include <linux/posix_types.h>
-struct sigcontext {
-  __u64 sc_regs[32];
-  __u64 sc_fpregs[32];
-  __u64 sc_mdhi;
-  __u64 sc_hi1;
-  __u64 sc_hi2;
-  __u64 sc_hi3;
-  __u64 sc_mdlo;
-  __u64 sc_lo1;
-  __u64 sc_lo2;
-  __u64 sc_lo3;
-  __u64 sc_pc;
-  __u32 sc_fpc_csr;
-  __u32 sc_used_math;
-  __u32 sc_dsp;
-  __u32 sc_reserved;
-};
-#endif
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/siginfo.h b/libc/kernel/uapi/asm-mips/asm/siginfo.h
deleted file mode 100644
index c9efb21..0000000
--- a/libc/kernel/uapi/asm-mips/asm/siginfo.h
+++ /dev/null
@@ -1,31 +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 _UAPI_ASM_SIGINFO_H
-#define _UAPI_ASM_SIGINFO_H
-#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2 * sizeof(int))
-#undef __ARCH_SI_TRAPNO
-#define __ARCH_HAS_SWAPPED_SIGINFO
-#include <asm-generic/siginfo.h>
-#undef SI_ASYNCIO
-#undef SI_TIMER
-#undef SI_MESGQ
-#define SI_ASYNCIO - 2
-#define SI_TIMER - 3
-#define SI_MESGQ - 4
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/signal.h b/libc/kernel/uapi/asm-mips/asm/signal.h
deleted file mode 100644
index 969bf86..0000000
--- a/libc/kernel/uapi/asm-mips/asm/signal.h
+++ /dev/null
@@ -1,90 +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 _UAPI_ASM_SIGNAL_H
-#define _UAPI_ASM_SIGNAL_H
-#include <linux/types.h>
-#define _KERNEL__NSIG 128
-#define _NSIG_BPW (sizeof(unsigned long) * 8)
-#define _NSIG_WORDS (_KERNEL__NSIG / _NSIG_BPW)
-typedef struct {
-  unsigned long sig[_NSIG_WORDS];
-} sigset_t;
-typedef unsigned long old_sigset_t;
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGTRAP 5
-#define SIGIOT 6
-#define SIGABRT SIGIOT
-#define SIGEMT 7
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGBUS 10
-#define SIGSEGV 11
-#define SIGSYS 12
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGUSR1 16
-#define SIGUSR2 17
-#define SIGCHLD 18
-#define SIGCLD SIGCHLD
-#define SIGPWR 19
-#define SIGWINCH 20
-#define SIGURG 21
-#define SIGIO 22
-#define SIGPOLL SIGIO
-#define SIGSTOP 23
-#define SIGTSTP 24
-#define SIGCONT 25
-#define SIGTTIN 26
-#define SIGTTOU 27
-#define SIGVTALRM 28
-#define SIGPROF 29
-#define SIGXCPU 30
-#define SIGXFSZ 31
-#define __SIGRTMIN 32
-#define __SIGRTMAX _KERNEL__NSIG
-#define SA_ONSTACK 0x08000000
-#define SA_RESETHAND 0x80000000
-#define SA_RESTART 0x10000000
-#define SA_SIGINFO 0x00000008
-#define SA_NODEFER 0x40000000
-#define SA_NOCLDWAIT 0x00010000
-#define SA_NOCLDSTOP 0x00000001
-#define SA_NOMASK SA_NODEFER
-#define SA_ONESHOT SA_RESETHAND
-#define MINSIGSTKSZ 2048
-#define SIGSTKSZ 8192
-#define SIG_BLOCK 1
-#define SIG_UNBLOCK 2
-#define SIG_SETMASK 3
-#include <asm-generic/signal-defs.h>
-struct sigaction {
-  unsigned int sa_flags;
-  __sighandler_t sa_handler;
-  sigset_t sa_mask;
-};
-typedef struct sigaltstack {
-  void __user * ss_sp;
-  size_t ss_size;
-  int ss_flags;
-} stack_t;
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/socket.h b/libc/kernel/uapi/asm-mips/asm/socket.h
deleted file mode 100644
index d24c09e..0000000
--- a/libc/kernel/uapi/asm-mips/asm/socket.h
+++ /dev/null
@@ -1,113 +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 _UAPI_ASM_SOCKET_H
-#define _UAPI_ASM_SOCKET_H
-#include <linux/posix_types.h>
-#include <asm/sockios.h>
-#define SOL_SOCKET 0xffff
-#define SO_DEBUG 0x0001
-#define SO_REUSEADDR 0x0004
-#define SO_KEEPALIVE 0x0008
-#define SO_DONTROUTE 0x0010
-#define SO_BROADCAST 0x0020
-#define SO_LINGER 0x0080
-#define SO_OOBINLINE 0x0100
-#define SO_REUSEPORT 0x0200
-#define SO_TYPE 0x1008
-#define SO_STYLE SO_TYPE
-#define SO_ERROR 0x1007
-#define SO_SNDBUF 0x1001
-#define SO_RCVBUF 0x1002
-#define SO_SNDLOWAT 0x1003
-#define SO_RCVLOWAT 0x1004
-#define SO_SNDTIMEO_OLD 0x1005
-#define SO_RCVTIMEO_OLD 0x1006
-#define SO_ACCEPTCONN 0x1009
-#define SO_PROTOCOL 0x1028
-#define SO_DOMAIN 0x1029
-#define SO_NO_CHECK 11
-#define SO_PRIORITY 12
-#define SO_BSDCOMPAT 14
-#define SO_PASSCRED 17
-#define SO_PEERCRED 18
-#define SO_SECURITY_AUTHENTICATION 22
-#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
-#define SO_SECURITY_ENCRYPTION_NETWORK 24
-#define SO_BINDTODEVICE 25
-#define SO_ATTACH_FILTER 26
-#define SO_DETACH_FILTER 27
-#define SO_GET_FILTER SO_ATTACH_FILTER
-#define SO_PEERNAME 28
-#define SO_PEERSEC 30
-#define SO_SNDBUFFORCE 31
-#define SO_RCVBUFFORCE 33
-#define SO_PASSSEC 34
-#define SO_MARK 36
-#define SO_RXQ_OVFL 40
-#define SO_WIFI_STATUS 41
-#define SCM_WIFI_STATUS SO_WIFI_STATUS
-#define SO_PEEK_OFF 42
-#define SO_NOFCS 43
-#define SO_LOCK_FILTER 44
-#define SO_SELECT_ERR_QUEUE 45
-#define SO_BUSY_POLL 46
-#define SO_MAX_PACING_RATE 47
-#define SO_BPF_EXTENSIONS 48
-#define SO_INCOMING_CPU 49
-#define SO_ATTACH_BPF 50
-#define SO_DETACH_BPF SO_DETACH_FILTER
-#define SO_ATTACH_REUSEPORT_CBPF 51
-#define SO_ATTACH_REUSEPORT_EBPF 52
-#define SO_CNX_ADVICE 53
-#define SCM_TIMESTAMPING_OPT_STATS 54
-#define SO_MEMINFO 55
-#define SO_INCOMING_NAPI_ID 56
-#define SO_COOKIE 57
-#define SCM_TIMESTAMPING_PKTINFO 58
-#define SO_PEERGROUPS 59
-#define SO_ZEROCOPY 60
-#define SO_TXTIME 61
-#define SCM_TXTIME SO_TXTIME
-#define SO_BINDTOIFINDEX 62
-#define SO_TIMESTAMP_OLD 29
-#define SO_TIMESTAMPNS_OLD 35
-#define SO_TIMESTAMPING_OLD 37
-#define SO_TIMESTAMP_NEW 63
-#define SO_TIMESTAMPNS_NEW 64
-#define SO_TIMESTAMPING_NEW 65
-#define SO_RCVTIMEO_NEW 66
-#define SO_SNDTIMEO_NEW 67
-#define SO_DETACH_REUSEPORT_BPF 68
-#if __BITS_PER_LONG == 64
-#define SO_TIMESTAMP SO_TIMESTAMP_OLD
-#define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
-#define SO_TIMESTAMPING SO_TIMESTAMPING_OLD
-#define SO_RCVTIMEO SO_RCVTIMEO_OLD
-#define SO_SNDTIMEO SO_SNDTIMEO_OLD
-#else
-#define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
-#define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
-#define SO_TIMESTAMPING (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPING_OLD : SO_TIMESTAMPING_NEW)
-#define SO_RCVTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_RCVTIMEO_OLD : SO_RCVTIMEO_NEW)
-#define SO_SNDTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_SNDTIMEO_OLD : SO_SNDTIMEO_NEW)
-#endif
-#define SCM_TIMESTAMP SO_TIMESTAMP
-#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
-#define SCM_TIMESTAMPING SO_TIMESTAMPING
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/sockios.h b/libc/kernel/uapi/asm-mips/asm/sockios.h
deleted file mode 100644
index 4240418..0000000
--- a/libc/kernel/uapi/asm-mips/asm/sockios.h
+++ /dev/null
@@ -1,29 +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 _ASM_SOCKIOS_H
-#define _ASM_SOCKIOS_H
-#include <asm/ioctl.h>
-#define FIOGETOWN _IOR('f', 123, int)
-#define FIOSETOWN _IOW('f', 124, int)
-#define SIOCATMARK _IOR('s', 7, int)
-#define SIOCSPGRP _IOW('s', 8, pid_t)
-#define SIOCGPGRP _IOR('s', 9, pid_t)
-#define SIOCGSTAMP_OLD 0x8906
-#define SIOCGSTAMPNS_OLD 0x8907
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/stat.h b/libc/kernel/uapi/asm-mips/asm/stat.h
deleted file mode 100644
index e37e7ab..0000000
--- a/libc/kernel/uapi/asm-mips/asm/stat.h
+++ /dev/null
@@ -1,92 +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 _ASM_STAT_H
-#define _ASM_STAT_H
-#include <linux/types.h>
-#include <asm/sgidefs.h>
-#if _MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _MIPS_SIM_NABI32
-struct stat {
-  unsigned st_dev;
-  long st_pad1[3];
-  ino_t st_ino;
-  mode_t st_mode;
-  __u32 st_nlink;
-  uid_t st_uid;
-  gid_t st_gid;
-  unsigned st_rdev;
-  long st_pad2[2];
-  __kernel_off_t st_size;
-  long st_pad3;
-  time_t st_atime;
-  long st_atime_nsec;
-  time_t st_mtime;
-  long st_mtime_nsec;
-  time_t st_ctime;
-  long st_ctime_nsec;
-  long st_blksize;
-  long st_blocks;
-  long st_pad4[14];
-};
-struct stat64 {
-  unsigned long st_dev;
-  unsigned long st_pad0[3];
-  unsigned long long st_ino;
-  mode_t st_mode;
-  __u32 st_nlink;
-  uid_t st_uid;
-  gid_t st_gid;
-  unsigned long st_rdev;
-  unsigned long st_pad1[3];
-  long long st_size;
-  time_t st_atime;
-  unsigned long st_atime_nsec;
-  time_t st_mtime;
-  unsigned long st_mtime_nsec;
-  time_t st_ctime;
-  unsigned long st_ctime_nsec;
-  unsigned long st_blksize;
-  unsigned long st_pad2;
-  long long st_blocks;
-};
-#endif
-#if _MIPS_SIM == _MIPS_SIM_ABI64
-struct stat {
-  unsigned int st_dev;
-  unsigned int st_pad0[3];
-  unsigned long st_ino;
-  mode_t st_mode;
-  __u32 st_nlink;
-  uid_t st_uid;
-  gid_t st_gid;
-  unsigned int st_rdev;
-  unsigned int st_pad1[3];
-  __kernel_off_t st_size;
-  unsigned int st_atime;
-  unsigned int st_atime_nsec;
-  unsigned int st_mtime;
-  unsigned int st_mtime_nsec;
-  unsigned int st_ctime;
-  unsigned int st_ctime_nsec;
-  unsigned int st_blksize;
-  unsigned int st_pad2;
-  unsigned long st_blocks;
-};
-#endif
-#define STAT_HAVE_NSEC 1
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/statfs.h b/libc/kernel/uapi/asm-mips/asm/statfs.h
deleted file mode 100644
index 1f6abff..0000000
--- a/libc/kernel/uapi/asm-mips/asm/statfs.h
+++ /dev/null
@@ -1,86 +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 _ASM_STATFS_H
-#define _ASM_STATFS_H
-#include <linux/posix_types.h>
-#include <asm/sgidefs.h>
-struct statfs {
-  long f_type;
-#define f_fstyp f_type
-  long f_bsize;
-  long f_frsize;
-  long f_blocks;
-  long f_bfree;
-  long f_files;
-  long f_ffree;
-  long f_bavail;
-  __kernel_fsid_t f_fsid;
-  long f_namelen;
-  long f_flags;
-  long f_spare[5];
-};
-#if _MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _MIPS_SIM_NABI32
-struct statfs64 {
-  __u32 f_type;
-  __u32 f_bsize;
-  __u32 f_frsize;
-  __u32 __pad;
-  __u64 f_blocks;
-  __u64 f_bfree;
-  __u64 f_files;
-  __u64 f_ffree;
-  __u64 f_bavail;
-  __kernel_fsid_t f_fsid;
-  __u32 f_namelen;
-  __u32 f_flags;
-  __u32 f_spare[5];
-};
-#endif
-#if _MIPS_SIM == _MIPS_SIM_ABI64
-struct statfs64 {
-  long f_type;
-  long f_bsize;
-  long f_frsize;
-  long f_blocks;
-  long f_bfree;
-  long f_files;
-  long f_ffree;
-  long f_bavail;
-  __kernel_fsid_t f_fsid;
-  long f_namelen;
-  long f_flags;
-  long f_spare[5];
-};
-struct compat_statfs64 {
-  __u32 f_type;
-  __u32 f_bsize;
-  __u32 f_frsize;
-  __u32 __pad;
-  __u64 f_blocks;
-  __u64 f_bfree;
-  __u64 f_files;
-  __u64 f_ffree;
-  __u64 f_bavail;
-  __kernel_fsid_t f_fsid;
-  __u32 f_namelen;
-  __u32 f_flags;
-  __u32 f_spare[5];
-};
-#endif
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/swab.h b/libc/kernel/uapi/asm-mips/asm/swab.h
deleted file mode 100644
index 2d739f0..0000000
--- a/libc/kernel/uapi/asm-mips/asm/swab.h
+++ /dev/null
@@ -1,31 +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 _ASM_SWAB_H
-#define _ASM_SWAB_H
-#include <linux/compiler.h>
-#include <linux/types.h>
-#define __SWAB_64_THRU_32__
-#if !defined(__mips16) && (defined(__mips_isa_rev) && __mips_isa_rev >= 2 || defined(_MIPS_ARCH_LOONGSON3A))
-#define __arch_swab16 __arch_swab16
-#define __arch_swab32 __arch_swab32
-#ifdef __mips64
-#define __arch_swab64 __arch_swab64
-#endif
-#endif
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/sysmips.h b/libc/kernel/uapi/asm-mips/asm/sysmips.h
deleted file mode 100644
index f217c7d..0000000
--- a/libc/kernel/uapi/asm-mips/asm/sysmips.h
+++ /dev/null
@@ -1,26 +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 _ASM_SYSMIPS_H
-#define _ASM_SYSMIPS_H
-#define SETNAME 1
-#define FLUSH_CACHE 3
-#define MIPS_FIXADE 7
-#define MIPS_RDNVRAM 10
-#define MIPS_ATOMIC_SET 2001
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/termbits.h b/libc/kernel/uapi/asm-mips/asm/termbits.h
deleted file mode 100644
index a913ee3..0000000
--- a/libc/kernel/uapi/asm-mips/asm/termbits.h
+++ /dev/null
@@ -1,197 +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 _ASM_TERMBITS_H
-#define _ASM_TERMBITS_H
-#include <linux/posix_types.h>
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
-#define NCCS 23
-struct termios {
-  tcflag_t c_iflag;
-  tcflag_t c_oflag;
-  tcflag_t c_cflag;
-  tcflag_t c_lflag;
-  cc_t c_line;
-  cc_t c_cc[NCCS];
-};
-struct termios2 {
-  tcflag_t c_iflag;
-  tcflag_t c_oflag;
-  tcflag_t c_cflag;
-  tcflag_t c_lflag;
-  cc_t c_line;
-  cc_t c_cc[NCCS];
-  speed_t c_ispeed;
-  speed_t c_ospeed;
-};
-struct ktermios {
-  tcflag_t c_iflag;
-  tcflag_t c_oflag;
-  tcflag_t c_cflag;
-  tcflag_t c_lflag;
-  cc_t c_line;
-  cc_t c_cc[NCCS];
-  speed_t c_ispeed;
-  speed_t c_ospeed;
-};
-#define VINTR 0
-#define VQUIT 1
-#define VERASE 2
-#define VKILL 3
-#define VMIN 4
-#define VTIME 5
-#define VEOL2 6
-#define VSWTC 7
-#define VSWTCH VSWTC
-#define VSTART 8
-#define VSTOP 9
-#define VSUSP 10
-#define VREPRINT 12
-#define VDISCARD 13
-#define VWERASE 14
-#define VLNEXT 15
-#define VEOF 16
-#define VEOL 17
-#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 IEXTEN 0000400
-#define ECHOCTL 0001000
-#define ECHOPRT 0002000
-#define ECHOKE 0004000
-#define FLUSHO 0020000
-#define PENDIN 0040000
-#define TOSTOP 0100000
-#define ITOSTOP TOSTOP
-#define EXTPROC 0200000
-#define TIOCSER_TEMT 0x01
-#define TCOOFF 0
-#define TCOON 1
-#define TCIOFF 2
-#define TCION 3
-#define TCIFLUSH 0
-#define TCOFLUSH 1
-#define TCIOFLUSH 2
-#define TCSANOW TCSETS
-#define TCSADRAIN TCSETSW
-#define TCSAFLUSH TCSETSF
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/termios.h b/libc/kernel/uapi/asm-mips/asm/termios.h
deleted file mode 100644
index 2c9724f..0000000
--- a/libc/kernel/uapi/asm-mips/asm/termios.h
+++ /dev/null
@@ -1,76 +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 _UAPI_ASM_TERMIOS_H
-#define _UAPI_ASM_TERMIOS_H
-#include <linux/errno.h>
-#include <asm/termbits.h>
-#include <asm/ioctls.h>
-struct sgttyb {
-  char sg_ispeed;
-  char sg_ospeed;
-  char sg_erase;
-  char sg_kill;
-  int sg_flags;
-};
-struct tchars {
-  char t_intrc;
-  char t_quitc;
-  char t_startc;
-  char t_stopc;
-  char t_eofc;
-  char t_brkc;
-};
-struct ltchars {
-  char t_suspc;
-  char t_dsuspc;
-  char t_rprntc;
-  char t_flushc;
-  char t_werasc;
-  char t_lnextc;
-};
-struct winsize {
-  unsigned short ws_row;
-  unsigned short ws_col;
-  unsigned short ws_xpixel;
-  unsigned short ws_ypixel;
-};
-#define NCC 8
-struct termio {
-  unsigned short c_iflag;
-  unsigned short c_oflag;
-  unsigned short c_cflag;
-  unsigned short c_lflag;
-  char c_line;
-  unsigned char c_cc[NCCS];
-};
-#define TIOCM_LE 0x001
-#define TIOCM_DTR 0x002
-#define TIOCM_RTS 0x004
-#define TIOCM_ST 0x010
-#define TIOCM_SR 0x020
-#define TIOCM_CTS 0x040
-#define TIOCM_CAR 0x100
-#define TIOCM_CD TIOCM_CAR
-#define TIOCM_RNG 0x200
-#define TIOCM_RI TIOCM_RNG
-#define TIOCM_DSR 0x400
-#define TIOCM_OUT1 0x2000
-#define TIOCM_OUT2 0x4000
-#define TIOCM_LOOP 0x8000
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/types.h b/libc/kernel/uapi/asm-mips/asm/types.h
deleted file mode 100644
index 7b1d512..0000000
--- a/libc/kernel/uapi/asm-mips/asm/types.h
+++ /dev/null
@@ -1,22 +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 _UAPI_ASM_TYPES_H
-#define _UAPI_ASM_TYPES_H
-#include <asm-generic/int-ll64.h>
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/ucontext.h b/libc/kernel/uapi/asm-mips/asm/ucontext.h
deleted file mode 100644
index 8775722..0000000
--- a/libc/kernel/uapi/asm-mips/asm/ucontext.h
+++ /dev/null
@@ -1,40 +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 __MIPS_UAPI_ASM_UCONTEXT_H
-#define __MIPS_UAPI_ASM_UCONTEXT_H
-struct extcontext {
-  unsigned int magic;
-  unsigned int size;
-};
-struct msa_extcontext {
-  struct extcontext ext;
-#define MSA_EXTCONTEXT_MAGIC 0x784d5341
-  unsigned long long wr[32];
-  unsigned int csr;
-};
-#define END_EXTCONTEXT_MAGIC 0x78454e44
-struct ucontext {
-  unsigned long uc_flags;
-  struct ucontext * uc_link;
-  stack_t uc_stack;
-  struct sigcontext uc_mcontext;
-  sigset_t uc_sigmask;
-  unsigned long long uc_extcontext[0];
-};
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd.h b/libc/kernel/uapi/asm-mips/asm/unistd.h
deleted file mode 100644
index 65f3614..0000000
--- a/libc/kernel/uapi/asm-mips/asm/unistd.h
+++ /dev/null
@@ -1,34 +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 _UAPI_ASM_UNISTD_H
-#define _UAPI_ASM_UNISTD_H
-#include <asm/sgidefs.h>
-#if _MIPS_SIM == _MIPS_SIM_ABI32
-#define __NR_Linux 4000
-#include <asm/unistd_o32.h>
-#endif
-#if _MIPS_SIM == _MIPS_SIM_ABI64
-#define __NR_Linux 5000
-#include <asm/unistd_n64.h>
-#endif
-#if _MIPS_SIM == _MIPS_SIM_NABI32
-#define __NR_Linux 6000
-#include <asm/unistd_n32.h>
-#endif
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_n32.h b/libc/kernel/uapi/asm-mips/asm/unistd_n32.h
deleted file mode 100644
index 974fb54..0000000
--- a/libc/kernel/uapi/asm-mips/asm/unistd_n32.h
+++ /dev/null
@@ -1,385 +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 _UAPI_ASM_MIPS_UNISTD_N32_H
-#define _UAPI_ASM_MIPS_UNISTD_N32_H
-#define __NR_read (__NR_Linux + 0)
-#define __NR_write (__NR_Linux + 1)
-#define __NR_open (__NR_Linux + 2)
-#define __NR_close (__NR_Linux + 3)
-#define __NR_stat (__NR_Linux + 4)
-#define __NR_fstat (__NR_Linux + 5)
-#define __NR_lstat (__NR_Linux + 6)
-#define __NR_poll (__NR_Linux + 7)
-#define __NR_lseek (__NR_Linux + 8)
-#define __NR_mmap (__NR_Linux + 9)
-#define __NR_mprotect (__NR_Linux + 10)
-#define __NR_munmap (__NR_Linux + 11)
-#define __NR_brk (__NR_Linux + 12)
-#define __NR_rt_sigaction (__NR_Linux + 13)
-#define __NR_rt_sigprocmask (__NR_Linux + 14)
-#define __NR_ioctl (__NR_Linux + 15)
-#define __NR_pread64 (__NR_Linux + 16)
-#define __NR_pwrite64 (__NR_Linux + 17)
-#define __NR_readv (__NR_Linux + 18)
-#define __NR_writev (__NR_Linux + 19)
-#define __NR_access (__NR_Linux + 20)
-#define __NR_pipe (__NR_Linux + 21)
-#define __NR__newselect (__NR_Linux + 22)
-#define __NR_sched_yield (__NR_Linux + 23)
-#define __NR_mremap (__NR_Linux + 24)
-#define __NR_msync (__NR_Linux + 25)
-#define __NR_mincore (__NR_Linux + 26)
-#define __NR_madvise (__NR_Linux + 27)
-#define __NR_shmget (__NR_Linux + 28)
-#define __NR_shmat (__NR_Linux + 29)
-#define __NR_shmctl (__NR_Linux + 30)
-#define __NR_dup (__NR_Linux + 31)
-#define __NR_dup2 (__NR_Linux + 32)
-#define __NR_pause (__NR_Linux + 33)
-#define __NR_nanosleep (__NR_Linux + 34)
-#define __NR_getitimer (__NR_Linux + 35)
-#define __NR_setitimer (__NR_Linux + 36)
-#define __NR_alarm (__NR_Linux + 37)
-#define __NR_getpid (__NR_Linux + 38)
-#define __NR_sendfile (__NR_Linux + 39)
-#define __NR_socket (__NR_Linux + 40)
-#define __NR_connect (__NR_Linux + 41)
-#define __NR_accept (__NR_Linux + 42)
-#define __NR_sendto (__NR_Linux + 43)
-#define __NR_recvfrom (__NR_Linux + 44)
-#define __NR_sendmsg (__NR_Linux + 45)
-#define __NR_recvmsg (__NR_Linux + 46)
-#define __NR_shutdown (__NR_Linux + 47)
-#define __NR_bind (__NR_Linux + 48)
-#define __NR_listen (__NR_Linux + 49)
-#define __NR_getsockname (__NR_Linux + 50)
-#define __NR_getpeername (__NR_Linux + 51)
-#define __NR_socketpair (__NR_Linux + 52)
-#define __NR_setsockopt (__NR_Linux + 53)
-#define __NR_getsockopt (__NR_Linux + 54)
-#define __NR_clone (__NR_Linux + 55)
-#define __NR_fork (__NR_Linux + 56)
-#define __NR_execve (__NR_Linux + 57)
-#define __NR_exit (__NR_Linux + 58)
-#define __NR_wait4 (__NR_Linux + 59)
-#define __NR_kill (__NR_Linux + 60)
-#define __NR_uname (__NR_Linux + 61)
-#define __NR_semget (__NR_Linux + 62)
-#define __NR_semop (__NR_Linux + 63)
-#define __NR_semctl (__NR_Linux + 64)
-#define __NR_shmdt (__NR_Linux + 65)
-#define __NR_msgget (__NR_Linux + 66)
-#define __NR_msgsnd (__NR_Linux + 67)
-#define __NR_msgrcv (__NR_Linux + 68)
-#define __NR_msgctl (__NR_Linux + 69)
-#define __NR_fcntl (__NR_Linux + 70)
-#define __NR_flock (__NR_Linux + 71)
-#define __NR_fsync (__NR_Linux + 72)
-#define __NR_fdatasync (__NR_Linux + 73)
-#define __NR_truncate (__NR_Linux + 74)
-#define __NR_ftruncate (__NR_Linux + 75)
-#define __NR_getdents (__NR_Linux + 76)
-#define __NR_getcwd (__NR_Linux + 77)
-#define __NR_chdir (__NR_Linux + 78)
-#define __NR_fchdir (__NR_Linux + 79)
-#define __NR_rename (__NR_Linux + 80)
-#define __NR_mkdir (__NR_Linux + 81)
-#define __NR_rmdir (__NR_Linux + 82)
-#define __NR_creat (__NR_Linux + 83)
-#define __NR_link (__NR_Linux + 84)
-#define __NR_unlink (__NR_Linux + 85)
-#define __NR_symlink (__NR_Linux + 86)
-#define __NR_readlink (__NR_Linux + 87)
-#define __NR_chmod (__NR_Linux + 88)
-#define __NR_fchmod (__NR_Linux + 89)
-#define __NR_chown (__NR_Linux + 90)
-#define __NR_fchown (__NR_Linux + 91)
-#define __NR_lchown (__NR_Linux + 92)
-#define __NR_umask (__NR_Linux + 93)
-#define __NR_gettimeofday (__NR_Linux + 94)
-#define __NR_getrlimit (__NR_Linux + 95)
-#define __NR_getrusage (__NR_Linux + 96)
-#define __NR_sysinfo (__NR_Linux + 97)
-#define __NR_times (__NR_Linux + 98)
-#define __NR_ptrace (__NR_Linux + 99)
-#define __NR_getuid (__NR_Linux + 100)
-#define __NR_syslog (__NR_Linux + 101)
-#define __NR_getgid (__NR_Linux + 102)
-#define __NR_setuid (__NR_Linux + 103)
-#define __NR_setgid (__NR_Linux + 104)
-#define __NR_geteuid (__NR_Linux + 105)
-#define __NR_getegid (__NR_Linux + 106)
-#define __NR_setpgid (__NR_Linux + 107)
-#define __NR_getppid (__NR_Linux + 108)
-#define __NR_getpgrp (__NR_Linux + 109)
-#define __NR_setsid (__NR_Linux + 110)
-#define __NR_setreuid (__NR_Linux + 111)
-#define __NR_setregid (__NR_Linux + 112)
-#define __NR_getgroups (__NR_Linux + 113)
-#define __NR_setgroups (__NR_Linux + 114)
-#define __NR_setresuid (__NR_Linux + 115)
-#define __NR_getresuid (__NR_Linux + 116)
-#define __NR_setresgid (__NR_Linux + 117)
-#define __NR_getresgid (__NR_Linux + 118)
-#define __NR_getpgid (__NR_Linux + 119)
-#define __NR_setfsuid (__NR_Linux + 120)
-#define __NR_setfsgid (__NR_Linux + 121)
-#define __NR_getsid (__NR_Linux + 122)
-#define __NR_capget (__NR_Linux + 123)
-#define __NR_capset (__NR_Linux + 124)
-#define __NR_rt_sigpending (__NR_Linux + 125)
-#define __NR_rt_sigtimedwait (__NR_Linux + 126)
-#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
-#define __NR_rt_sigsuspend (__NR_Linux + 128)
-#define __NR_sigaltstack (__NR_Linux + 129)
-#define __NR_utime (__NR_Linux + 130)
-#define __NR_mknod (__NR_Linux + 131)
-#define __NR_personality (__NR_Linux + 132)
-#define __NR_ustat (__NR_Linux + 133)
-#define __NR_statfs (__NR_Linux + 134)
-#define __NR_fstatfs (__NR_Linux + 135)
-#define __NR_sysfs (__NR_Linux + 136)
-#define __NR_getpriority (__NR_Linux + 137)
-#define __NR_setpriority (__NR_Linux + 138)
-#define __NR_sched_setparam (__NR_Linux + 139)
-#define __NR_sched_getparam (__NR_Linux + 140)
-#define __NR_sched_setscheduler (__NR_Linux + 141)
-#define __NR_sched_getscheduler (__NR_Linux + 142)
-#define __NR_sched_get_priority_max (__NR_Linux + 143)
-#define __NR_sched_get_priority_min (__NR_Linux + 144)
-#define __NR_sched_rr_get_interval (__NR_Linux + 145)
-#define __NR_mlock (__NR_Linux + 146)
-#define __NR_munlock (__NR_Linux + 147)
-#define __NR_mlockall (__NR_Linux + 148)
-#define __NR_munlockall (__NR_Linux + 149)
-#define __NR_vhangup (__NR_Linux + 150)
-#define __NR_pivot_root (__NR_Linux + 151)
-#define __NR__sysctl (__NR_Linux + 152)
-#define __NR_prctl (__NR_Linux + 153)
-#define __NR_adjtimex (__NR_Linux + 154)
-#define __NR_setrlimit (__NR_Linux + 155)
-#define __NR_chroot (__NR_Linux + 156)
-#define __NR_sync (__NR_Linux + 157)
-#define __NR_acct (__NR_Linux + 158)
-#define __NR_settimeofday (__NR_Linux + 159)
-#define __NR_mount (__NR_Linux + 160)
-#define __NR_umount2 (__NR_Linux + 161)
-#define __NR_swapon (__NR_Linux + 162)
-#define __NR_swapoff (__NR_Linux + 163)
-#define __NR_reboot (__NR_Linux + 164)
-#define __NR_sethostname (__NR_Linux + 165)
-#define __NR_setdomainname (__NR_Linux + 166)
-#define __NR_create_module (__NR_Linux + 167)
-#define __NR_init_module (__NR_Linux + 168)
-#define __NR_delete_module (__NR_Linux + 169)
-#define __NR_get_kernel_syms (__NR_Linux + 170)
-#define __NR_query_module (__NR_Linux + 171)
-#define __NR_quotactl (__NR_Linux + 172)
-#define __NR_nfsservctl (__NR_Linux + 173)
-#define __NR_getpmsg (__NR_Linux + 174)
-#define __NR_putpmsg (__NR_Linux + 175)
-#define __NR_afs_syscall (__NR_Linux + 176)
-#define __NR_reserved177 (__NR_Linux + 177)
-#define __NR_gettid (__NR_Linux + 178)
-#define __NR_readahead (__NR_Linux + 179)
-#define __NR_setxattr (__NR_Linux + 180)
-#define __NR_lsetxattr (__NR_Linux + 181)
-#define __NR_fsetxattr (__NR_Linux + 182)
-#define __NR_getxattr (__NR_Linux + 183)
-#define __NR_lgetxattr (__NR_Linux + 184)
-#define __NR_fgetxattr (__NR_Linux + 185)
-#define __NR_listxattr (__NR_Linux + 186)
-#define __NR_llistxattr (__NR_Linux + 187)
-#define __NR_flistxattr (__NR_Linux + 188)
-#define __NR_removexattr (__NR_Linux + 189)
-#define __NR_lremovexattr (__NR_Linux + 190)
-#define __NR_fremovexattr (__NR_Linux + 191)
-#define __NR_tkill (__NR_Linux + 192)
-#define __NR_reserved193 (__NR_Linux + 193)
-#define __NR_futex (__NR_Linux + 194)
-#define __NR_sched_setaffinity (__NR_Linux + 195)
-#define __NR_sched_getaffinity (__NR_Linux + 196)
-#define __NR_cacheflush (__NR_Linux + 197)
-#define __NR_cachectl (__NR_Linux + 198)
-#define __NR_sysmips (__NR_Linux + 199)
-#define __NR_io_setup (__NR_Linux + 200)
-#define __NR_io_destroy (__NR_Linux + 201)
-#define __NR_io_getevents (__NR_Linux + 202)
-#define __NR_io_submit (__NR_Linux + 203)
-#define __NR_io_cancel (__NR_Linux + 204)
-#define __NR_exit_group (__NR_Linux + 205)
-#define __NR_lookup_dcookie (__NR_Linux + 206)
-#define __NR_epoll_create (__NR_Linux + 207)
-#define __NR_epoll_ctl (__NR_Linux + 208)
-#define __NR_epoll_wait (__NR_Linux + 209)
-#define __NR_remap_file_pages (__NR_Linux + 210)
-#define __NR_rt_sigreturn (__NR_Linux + 211)
-#define __NR_fcntl64 (__NR_Linux + 212)
-#define __NR_set_tid_address (__NR_Linux + 213)
-#define __NR_restart_syscall (__NR_Linux + 214)
-#define __NR_semtimedop (__NR_Linux + 215)
-#define __NR_fadvise64 (__NR_Linux + 216)
-#define __NR_statfs64 (__NR_Linux + 217)
-#define __NR_fstatfs64 (__NR_Linux + 218)
-#define __NR_sendfile64 (__NR_Linux + 219)
-#define __NR_timer_create (__NR_Linux + 220)
-#define __NR_timer_settime (__NR_Linux + 221)
-#define __NR_timer_gettime (__NR_Linux + 222)
-#define __NR_timer_getoverrun (__NR_Linux + 223)
-#define __NR_timer_delete (__NR_Linux + 224)
-#define __NR_clock_settime (__NR_Linux + 225)
-#define __NR_clock_gettime (__NR_Linux + 226)
-#define __NR_clock_getres (__NR_Linux + 227)
-#define __NR_clock_nanosleep (__NR_Linux + 228)
-#define __NR_tgkill (__NR_Linux + 229)
-#define __NR_utimes (__NR_Linux + 230)
-#define __NR_mbind (__NR_Linux + 231)
-#define __NR_get_mempolicy (__NR_Linux + 232)
-#define __NR_set_mempolicy (__NR_Linux + 233)
-#define __NR_mq_open (__NR_Linux + 234)
-#define __NR_mq_unlink (__NR_Linux + 235)
-#define __NR_mq_timedsend (__NR_Linux + 236)
-#define __NR_mq_timedreceive (__NR_Linux + 237)
-#define __NR_mq_notify (__NR_Linux + 238)
-#define __NR_mq_getsetattr (__NR_Linux + 239)
-#define __NR_vserver (__NR_Linux + 240)
-#define __NR_waitid (__NR_Linux + 241)
-#define __NR_add_key (__NR_Linux + 243)
-#define __NR_request_key (__NR_Linux + 244)
-#define __NR_keyctl (__NR_Linux + 245)
-#define __NR_set_thread_area (__NR_Linux + 246)
-#define __NR_inotify_init (__NR_Linux + 247)
-#define __NR_inotify_add_watch (__NR_Linux + 248)
-#define __NR_inotify_rm_watch (__NR_Linux + 249)
-#define __NR_migrate_pages (__NR_Linux + 250)
-#define __NR_openat (__NR_Linux + 251)
-#define __NR_mkdirat (__NR_Linux + 252)
-#define __NR_mknodat (__NR_Linux + 253)
-#define __NR_fchownat (__NR_Linux + 254)
-#define __NR_futimesat (__NR_Linux + 255)
-#define __NR_newfstatat (__NR_Linux + 256)
-#define __NR_unlinkat (__NR_Linux + 257)
-#define __NR_renameat (__NR_Linux + 258)
-#define __NR_linkat (__NR_Linux + 259)
-#define __NR_symlinkat (__NR_Linux + 260)
-#define __NR_readlinkat (__NR_Linux + 261)
-#define __NR_fchmodat (__NR_Linux + 262)
-#define __NR_faccessat (__NR_Linux + 263)
-#define __NR_pselect6 (__NR_Linux + 264)
-#define __NR_ppoll (__NR_Linux + 265)
-#define __NR_unshare (__NR_Linux + 266)
-#define __NR_splice (__NR_Linux + 267)
-#define __NR_sync_file_range (__NR_Linux + 268)
-#define __NR_tee (__NR_Linux + 269)
-#define __NR_vmsplice (__NR_Linux + 270)
-#define __NR_move_pages (__NR_Linux + 271)
-#define __NR_set_robust_list (__NR_Linux + 272)
-#define __NR_get_robust_list (__NR_Linux + 273)
-#define __NR_kexec_load (__NR_Linux + 274)
-#define __NR_getcpu (__NR_Linux + 275)
-#define __NR_epoll_pwait (__NR_Linux + 276)
-#define __NR_ioprio_set (__NR_Linux + 277)
-#define __NR_ioprio_get (__NR_Linux + 278)
-#define __NR_utimensat (__NR_Linux + 279)
-#define __NR_signalfd (__NR_Linux + 280)
-#define __NR_timerfd (__NR_Linux + 281)
-#define __NR_eventfd (__NR_Linux + 282)
-#define __NR_fallocate (__NR_Linux + 283)
-#define __NR_timerfd_create (__NR_Linux + 284)
-#define __NR_timerfd_gettime (__NR_Linux + 285)
-#define __NR_timerfd_settime (__NR_Linux + 286)
-#define __NR_signalfd4 (__NR_Linux + 287)
-#define __NR_eventfd2 (__NR_Linux + 288)
-#define __NR_epoll_create1 (__NR_Linux + 289)
-#define __NR_dup3 (__NR_Linux + 290)
-#define __NR_pipe2 (__NR_Linux + 291)
-#define __NR_inotify_init1 (__NR_Linux + 292)
-#define __NR_preadv (__NR_Linux + 293)
-#define __NR_pwritev (__NR_Linux + 294)
-#define __NR_rt_tgsigqueueinfo (__NR_Linux + 295)
-#define __NR_perf_event_open (__NR_Linux + 296)
-#define __NR_accept4 (__NR_Linux + 297)
-#define __NR_recvmmsg (__NR_Linux + 298)
-#define __NR_getdents64 (__NR_Linux + 299)
-#define __NR_fanotify_init (__NR_Linux + 300)
-#define __NR_fanotify_mark (__NR_Linux + 301)
-#define __NR_prlimit64 (__NR_Linux + 302)
-#define __NR_name_to_handle_at (__NR_Linux + 303)
-#define __NR_open_by_handle_at (__NR_Linux + 304)
-#define __NR_clock_adjtime (__NR_Linux + 305)
-#define __NR_syncfs (__NR_Linux + 306)
-#define __NR_sendmmsg (__NR_Linux + 307)
-#define __NR_setns (__NR_Linux + 308)
-#define __NR_process_vm_readv (__NR_Linux + 309)
-#define __NR_process_vm_writev (__NR_Linux + 310)
-#define __NR_kcmp (__NR_Linux + 311)
-#define __NR_finit_module (__NR_Linux + 312)
-#define __NR_sched_setattr (__NR_Linux + 313)
-#define __NR_sched_getattr (__NR_Linux + 314)
-#define __NR_renameat2 (__NR_Linux + 315)
-#define __NR_seccomp (__NR_Linux + 316)
-#define __NR_getrandom (__NR_Linux + 317)
-#define __NR_memfd_create (__NR_Linux + 318)
-#define __NR_bpf (__NR_Linux + 319)
-#define __NR_execveat (__NR_Linux + 320)
-#define __NR_userfaultfd (__NR_Linux + 321)
-#define __NR_membarrier (__NR_Linux + 322)
-#define __NR_mlock2 (__NR_Linux + 323)
-#define __NR_copy_file_range (__NR_Linux + 324)
-#define __NR_preadv2 (__NR_Linux + 325)
-#define __NR_pwritev2 (__NR_Linux + 326)
-#define __NR_pkey_mprotect (__NR_Linux + 327)
-#define __NR_pkey_alloc (__NR_Linux + 328)
-#define __NR_pkey_free (__NR_Linux + 329)
-#define __NR_statx (__NR_Linux + 330)
-#define __NR_rseq (__NR_Linux + 331)
-#define __NR_io_pgetevents (__NR_Linux + 332)
-#define __NR_clock_gettime64 (__NR_Linux + 403)
-#define __NR_clock_settime64 (__NR_Linux + 404)
-#define __NR_clock_adjtime64 (__NR_Linux + 405)
-#define __NR_clock_getres_time64 (__NR_Linux + 406)
-#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
-#define __NR_timer_gettime64 (__NR_Linux + 408)
-#define __NR_timer_settime64 (__NR_Linux + 409)
-#define __NR_timerfd_gettime64 (__NR_Linux + 410)
-#define __NR_timerfd_settime64 (__NR_Linux + 411)
-#define __NR_utimensat_time64 (__NR_Linux + 412)
-#define __NR_pselect6_time64 (__NR_Linux + 413)
-#define __NR_ppoll_time64 (__NR_Linux + 414)
-#define __NR_io_pgetevents_time64 (__NR_Linux + 416)
-#define __NR_recvmmsg_time64 (__NR_Linux + 417)
-#define __NR_mq_timedsend_time64 (__NR_Linux + 418)
-#define __NR_mq_timedreceive_time64 (__NR_Linux + 419)
-#define __NR_semtimedop_time64 (__NR_Linux + 420)
-#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421)
-#define __NR_futex_time64 (__NR_Linux + 422)
-#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423)
-#define __NR_pidfd_send_signal (__NR_Linux + 424)
-#define __NR_io_uring_setup (__NR_Linux + 425)
-#define __NR_io_uring_enter (__NR_Linux + 426)
-#define __NR_io_uring_register (__NR_Linux + 427)
-#define __NR_open_tree (__NR_Linux + 428)
-#define __NR_move_mount (__NR_Linux + 429)
-#define __NR_fsopen (__NR_Linux + 430)
-#define __NR_fsconfig (__NR_Linux + 431)
-#define __NR_fsmount (__NR_Linux + 432)
-#define __NR_fspick (__NR_Linux + 433)
-#define __NR_pidfd_open (__NR_Linux + 434)
-#define __NR_clone3 (__NR_Linux + 435)
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_n64.h b/libc/kernel/uapi/asm-mips/asm/unistd_n64.h
deleted file mode 100644
index e71caf2..0000000
--- a/libc/kernel/uapi/asm-mips/asm/unistd_n64.h
+++ /dev/null
@@ -1,361 +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 _UAPI_ASM_MIPS_UNISTD_N64_H
-#define _UAPI_ASM_MIPS_UNISTD_N64_H
-#define __NR_read (__NR_Linux + 0)
-#define __NR_write (__NR_Linux + 1)
-#define __NR_open (__NR_Linux + 2)
-#define __NR_close (__NR_Linux + 3)
-#define __NR_stat (__NR_Linux + 4)
-#define __NR_fstat (__NR_Linux + 5)
-#define __NR_lstat (__NR_Linux + 6)
-#define __NR_poll (__NR_Linux + 7)
-#define __NR_lseek (__NR_Linux + 8)
-#define __NR_mmap (__NR_Linux + 9)
-#define __NR_mprotect (__NR_Linux + 10)
-#define __NR_munmap (__NR_Linux + 11)
-#define __NR_brk (__NR_Linux + 12)
-#define __NR_rt_sigaction (__NR_Linux + 13)
-#define __NR_rt_sigprocmask (__NR_Linux + 14)
-#define __NR_ioctl (__NR_Linux + 15)
-#define __NR_pread64 (__NR_Linux + 16)
-#define __NR_pwrite64 (__NR_Linux + 17)
-#define __NR_readv (__NR_Linux + 18)
-#define __NR_writev (__NR_Linux + 19)
-#define __NR_access (__NR_Linux + 20)
-#define __NR_pipe (__NR_Linux + 21)
-#define __NR__newselect (__NR_Linux + 22)
-#define __NR_sched_yield (__NR_Linux + 23)
-#define __NR_mremap (__NR_Linux + 24)
-#define __NR_msync (__NR_Linux + 25)
-#define __NR_mincore (__NR_Linux + 26)
-#define __NR_madvise (__NR_Linux + 27)
-#define __NR_shmget (__NR_Linux + 28)
-#define __NR_shmat (__NR_Linux + 29)
-#define __NR_shmctl (__NR_Linux + 30)
-#define __NR_dup (__NR_Linux + 31)
-#define __NR_dup2 (__NR_Linux + 32)
-#define __NR_pause (__NR_Linux + 33)
-#define __NR_nanosleep (__NR_Linux + 34)
-#define __NR_getitimer (__NR_Linux + 35)
-#define __NR_setitimer (__NR_Linux + 36)
-#define __NR_alarm (__NR_Linux + 37)
-#define __NR_getpid (__NR_Linux + 38)
-#define __NR_sendfile (__NR_Linux + 39)
-#define __NR_socket (__NR_Linux + 40)
-#define __NR_connect (__NR_Linux + 41)
-#define __NR_accept (__NR_Linux + 42)
-#define __NR_sendto (__NR_Linux + 43)
-#define __NR_recvfrom (__NR_Linux + 44)
-#define __NR_sendmsg (__NR_Linux + 45)
-#define __NR_recvmsg (__NR_Linux + 46)
-#define __NR_shutdown (__NR_Linux + 47)
-#define __NR_bind (__NR_Linux + 48)
-#define __NR_listen (__NR_Linux + 49)
-#define __NR_getsockname (__NR_Linux + 50)
-#define __NR_getpeername (__NR_Linux + 51)
-#define __NR_socketpair (__NR_Linux + 52)
-#define __NR_setsockopt (__NR_Linux + 53)
-#define __NR_getsockopt (__NR_Linux + 54)
-#define __NR_clone (__NR_Linux + 55)
-#define __NR_fork (__NR_Linux + 56)
-#define __NR_execve (__NR_Linux + 57)
-#define __NR_exit (__NR_Linux + 58)
-#define __NR_wait4 (__NR_Linux + 59)
-#define __NR_kill (__NR_Linux + 60)
-#define __NR_uname (__NR_Linux + 61)
-#define __NR_semget (__NR_Linux + 62)
-#define __NR_semop (__NR_Linux + 63)
-#define __NR_semctl (__NR_Linux + 64)
-#define __NR_shmdt (__NR_Linux + 65)
-#define __NR_msgget (__NR_Linux + 66)
-#define __NR_msgsnd (__NR_Linux + 67)
-#define __NR_msgrcv (__NR_Linux + 68)
-#define __NR_msgctl (__NR_Linux + 69)
-#define __NR_fcntl (__NR_Linux + 70)
-#define __NR_flock (__NR_Linux + 71)
-#define __NR_fsync (__NR_Linux + 72)
-#define __NR_fdatasync (__NR_Linux + 73)
-#define __NR_truncate (__NR_Linux + 74)
-#define __NR_ftruncate (__NR_Linux + 75)
-#define __NR_getdents (__NR_Linux + 76)
-#define __NR_getcwd (__NR_Linux + 77)
-#define __NR_chdir (__NR_Linux + 78)
-#define __NR_fchdir (__NR_Linux + 79)
-#define __NR_rename (__NR_Linux + 80)
-#define __NR_mkdir (__NR_Linux + 81)
-#define __NR_rmdir (__NR_Linux + 82)
-#define __NR_creat (__NR_Linux + 83)
-#define __NR_link (__NR_Linux + 84)
-#define __NR_unlink (__NR_Linux + 85)
-#define __NR_symlink (__NR_Linux + 86)
-#define __NR_readlink (__NR_Linux + 87)
-#define __NR_chmod (__NR_Linux + 88)
-#define __NR_fchmod (__NR_Linux + 89)
-#define __NR_chown (__NR_Linux + 90)
-#define __NR_fchown (__NR_Linux + 91)
-#define __NR_lchown (__NR_Linux + 92)
-#define __NR_umask (__NR_Linux + 93)
-#define __NR_gettimeofday (__NR_Linux + 94)
-#define __NR_getrlimit (__NR_Linux + 95)
-#define __NR_getrusage (__NR_Linux + 96)
-#define __NR_sysinfo (__NR_Linux + 97)
-#define __NR_times (__NR_Linux + 98)
-#define __NR_ptrace (__NR_Linux + 99)
-#define __NR_getuid (__NR_Linux + 100)
-#define __NR_syslog (__NR_Linux + 101)
-#define __NR_getgid (__NR_Linux + 102)
-#define __NR_setuid (__NR_Linux + 103)
-#define __NR_setgid (__NR_Linux + 104)
-#define __NR_geteuid (__NR_Linux + 105)
-#define __NR_getegid (__NR_Linux + 106)
-#define __NR_setpgid (__NR_Linux + 107)
-#define __NR_getppid (__NR_Linux + 108)
-#define __NR_getpgrp (__NR_Linux + 109)
-#define __NR_setsid (__NR_Linux + 110)
-#define __NR_setreuid (__NR_Linux + 111)
-#define __NR_setregid (__NR_Linux + 112)
-#define __NR_getgroups (__NR_Linux + 113)
-#define __NR_setgroups (__NR_Linux + 114)
-#define __NR_setresuid (__NR_Linux + 115)
-#define __NR_getresuid (__NR_Linux + 116)
-#define __NR_setresgid (__NR_Linux + 117)
-#define __NR_getresgid (__NR_Linux + 118)
-#define __NR_getpgid (__NR_Linux + 119)
-#define __NR_setfsuid (__NR_Linux + 120)
-#define __NR_setfsgid (__NR_Linux + 121)
-#define __NR_getsid (__NR_Linux + 122)
-#define __NR_capget (__NR_Linux + 123)
-#define __NR_capset (__NR_Linux + 124)
-#define __NR_rt_sigpending (__NR_Linux + 125)
-#define __NR_rt_sigtimedwait (__NR_Linux + 126)
-#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
-#define __NR_rt_sigsuspend (__NR_Linux + 128)
-#define __NR_sigaltstack (__NR_Linux + 129)
-#define __NR_utime (__NR_Linux + 130)
-#define __NR_mknod (__NR_Linux + 131)
-#define __NR_personality (__NR_Linux + 132)
-#define __NR_ustat (__NR_Linux + 133)
-#define __NR_statfs (__NR_Linux + 134)
-#define __NR_fstatfs (__NR_Linux + 135)
-#define __NR_sysfs (__NR_Linux + 136)
-#define __NR_getpriority (__NR_Linux + 137)
-#define __NR_setpriority (__NR_Linux + 138)
-#define __NR_sched_setparam (__NR_Linux + 139)
-#define __NR_sched_getparam (__NR_Linux + 140)
-#define __NR_sched_setscheduler (__NR_Linux + 141)
-#define __NR_sched_getscheduler (__NR_Linux + 142)
-#define __NR_sched_get_priority_max (__NR_Linux + 143)
-#define __NR_sched_get_priority_min (__NR_Linux + 144)
-#define __NR_sched_rr_get_interval (__NR_Linux + 145)
-#define __NR_mlock (__NR_Linux + 146)
-#define __NR_munlock (__NR_Linux + 147)
-#define __NR_mlockall (__NR_Linux + 148)
-#define __NR_munlockall (__NR_Linux + 149)
-#define __NR_vhangup (__NR_Linux + 150)
-#define __NR_pivot_root (__NR_Linux + 151)
-#define __NR__sysctl (__NR_Linux + 152)
-#define __NR_prctl (__NR_Linux + 153)
-#define __NR_adjtimex (__NR_Linux + 154)
-#define __NR_setrlimit (__NR_Linux + 155)
-#define __NR_chroot (__NR_Linux + 156)
-#define __NR_sync (__NR_Linux + 157)
-#define __NR_acct (__NR_Linux + 158)
-#define __NR_settimeofday (__NR_Linux + 159)
-#define __NR_mount (__NR_Linux + 160)
-#define __NR_umount2 (__NR_Linux + 161)
-#define __NR_swapon (__NR_Linux + 162)
-#define __NR_swapoff (__NR_Linux + 163)
-#define __NR_reboot (__NR_Linux + 164)
-#define __NR_sethostname (__NR_Linux + 165)
-#define __NR_setdomainname (__NR_Linux + 166)
-#define __NR_create_module (__NR_Linux + 167)
-#define __NR_init_module (__NR_Linux + 168)
-#define __NR_delete_module (__NR_Linux + 169)
-#define __NR_get_kernel_syms (__NR_Linux + 170)
-#define __NR_query_module (__NR_Linux + 171)
-#define __NR_quotactl (__NR_Linux + 172)
-#define __NR_nfsservctl (__NR_Linux + 173)
-#define __NR_getpmsg (__NR_Linux + 174)
-#define __NR_putpmsg (__NR_Linux + 175)
-#define __NR_afs_syscall (__NR_Linux + 176)
-#define __NR_reserved177 (__NR_Linux + 177)
-#define __NR_gettid (__NR_Linux + 178)
-#define __NR_readahead (__NR_Linux + 179)
-#define __NR_setxattr (__NR_Linux + 180)
-#define __NR_lsetxattr (__NR_Linux + 181)
-#define __NR_fsetxattr (__NR_Linux + 182)
-#define __NR_getxattr (__NR_Linux + 183)
-#define __NR_lgetxattr (__NR_Linux + 184)
-#define __NR_fgetxattr (__NR_Linux + 185)
-#define __NR_listxattr (__NR_Linux + 186)
-#define __NR_llistxattr (__NR_Linux + 187)
-#define __NR_flistxattr (__NR_Linux + 188)
-#define __NR_removexattr (__NR_Linux + 189)
-#define __NR_lremovexattr (__NR_Linux + 190)
-#define __NR_fremovexattr (__NR_Linux + 191)
-#define __NR_tkill (__NR_Linux + 192)
-#define __NR_reserved193 (__NR_Linux + 193)
-#define __NR_futex (__NR_Linux + 194)
-#define __NR_sched_setaffinity (__NR_Linux + 195)
-#define __NR_sched_getaffinity (__NR_Linux + 196)
-#define __NR_cacheflush (__NR_Linux + 197)
-#define __NR_cachectl (__NR_Linux + 198)
-#define __NR_sysmips (__NR_Linux + 199)
-#define __NR_io_setup (__NR_Linux + 200)
-#define __NR_io_destroy (__NR_Linux + 201)
-#define __NR_io_getevents (__NR_Linux + 202)
-#define __NR_io_submit (__NR_Linux + 203)
-#define __NR_io_cancel (__NR_Linux + 204)
-#define __NR_exit_group (__NR_Linux + 205)
-#define __NR_lookup_dcookie (__NR_Linux + 206)
-#define __NR_epoll_create (__NR_Linux + 207)
-#define __NR_epoll_ctl (__NR_Linux + 208)
-#define __NR_epoll_wait (__NR_Linux + 209)
-#define __NR_remap_file_pages (__NR_Linux + 210)
-#define __NR_rt_sigreturn (__NR_Linux + 211)
-#define __NR_set_tid_address (__NR_Linux + 212)
-#define __NR_restart_syscall (__NR_Linux + 213)
-#define __NR_semtimedop (__NR_Linux + 214)
-#define __NR_fadvise64 (__NR_Linux + 215)
-#define __NR_timer_create (__NR_Linux + 216)
-#define __NR_timer_settime (__NR_Linux + 217)
-#define __NR_timer_gettime (__NR_Linux + 218)
-#define __NR_timer_getoverrun (__NR_Linux + 219)
-#define __NR_timer_delete (__NR_Linux + 220)
-#define __NR_clock_settime (__NR_Linux + 221)
-#define __NR_clock_gettime (__NR_Linux + 222)
-#define __NR_clock_getres (__NR_Linux + 223)
-#define __NR_clock_nanosleep (__NR_Linux + 224)
-#define __NR_tgkill (__NR_Linux + 225)
-#define __NR_utimes (__NR_Linux + 226)
-#define __NR_mbind (__NR_Linux + 227)
-#define __NR_get_mempolicy (__NR_Linux + 228)
-#define __NR_set_mempolicy (__NR_Linux + 229)
-#define __NR_mq_open (__NR_Linux + 230)
-#define __NR_mq_unlink (__NR_Linux + 231)
-#define __NR_mq_timedsend (__NR_Linux + 232)
-#define __NR_mq_timedreceive (__NR_Linux + 233)
-#define __NR_mq_notify (__NR_Linux + 234)
-#define __NR_mq_getsetattr (__NR_Linux + 235)
-#define __NR_vserver (__NR_Linux + 236)
-#define __NR_waitid (__NR_Linux + 237)
-#define __NR_add_key (__NR_Linux + 239)
-#define __NR_request_key (__NR_Linux + 240)
-#define __NR_keyctl (__NR_Linux + 241)
-#define __NR_set_thread_area (__NR_Linux + 242)
-#define __NR_inotify_init (__NR_Linux + 243)
-#define __NR_inotify_add_watch (__NR_Linux + 244)
-#define __NR_inotify_rm_watch (__NR_Linux + 245)
-#define __NR_migrate_pages (__NR_Linux + 246)
-#define __NR_openat (__NR_Linux + 247)
-#define __NR_mkdirat (__NR_Linux + 248)
-#define __NR_mknodat (__NR_Linux + 249)
-#define __NR_fchownat (__NR_Linux + 250)
-#define __NR_futimesat (__NR_Linux + 251)
-#define __NR_newfstatat (__NR_Linux + 252)
-#define __NR_unlinkat (__NR_Linux + 253)
-#define __NR_renameat (__NR_Linux + 254)
-#define __NR_linkat (__NR_Linux + 255)
-#define __NR_symlinkat (__NR_Linux + 256)
-#define __NR_readlinkat (__NR_Linux + 257)
-#define __NR_fchmodat (__NR_Linux + 258)
-#define __NR_faccessat (__NR_Linux + 259)
-#define __NR_pselect6 (__NR_Linux + 260)
-#define __NR_ppoll (__NR_Linux + 261)
-#define __NR_unshare (__NR_Linux + 262)
-#define __NR_splice (__NR_Linux + 263)
-#define __NR_sync_file_range (__NR_Linux + 264)
-#define __NR_tee (__NR_Linux + 265)
-#define __NR_vmsplice (__NR_Linux + 266)
-#define __NR_move_pages (__NR_Linux + 267)
-#define __NR_set_robust_list (__NR_Linux + 268)
-#define __NR_get_robust_list (__NR_Linux + 269)
-#define __NR_kexec_load (__NR_Linux + 270)
-#define __NR_getcpu (__NR_Linux + 271)
-#define __NR_epoll_pwait (__NR_Linux + 272)
-#define __NR_ioprio_set (__NR_Linux + 273)
-#define __NR_ioprio_get (__NR_Linux + 274)
-#define __NR_utimensat (__NR_Linux + 275)
-#define __NR_signalfd (__NR_Linux + 276)
-#define __NR_timerfd (__NR_Linux + 277)
-#define __NR_eventfd (__NR_Linux + 278)
-#define __NR_fallocate (__NR_Linux + 279)
-#define __NR_timerfd_create (__NR_Linux + 280)
-#define __NR_timerfd_gettime (__NR_Linux + 281)
-#define __NR_timerfd_settime (__NR_Linux + 282)
-#define __NR_signalfd4 (__NR_Linux + 283)
-#define __NR_eventfd2 (__NR_Linux + 284)
-#define __NR_epoll_create1 (__NR_Linux + 285)
-#define __NR_dup3 (__NR_Linux + 286)
-#define __NR_pipe2 (__NR_Linux + 287)
-#define __NR_inotify_init1 (__NR_Linux + 288)
-#define __NR_preadv (__NR_Linux + 289)
-#define __NR_pwritev (__NR_Linux + 290)
-#define __NR_rt_tgsigqueueinfo (__NR_Linux + 291)
-#define __NR_perf_event_open (__NR_Linux + 292)
-#define __NR_accept4 (__NR_Linux + 293)
-#define __NR_recvmmsg (__NR_Linux + 294)
-#define __NR_fanotify_init (__NR_Linux + 295)
-#define __NR_fanotify_mark (__NR_Linux + 296)
-#define __NR_prlimit64 (__NR_Linux + 297)
-#define __NR_name_to_handle_at (__NR_Linux + 298)
-#define __NR_open_by_handle_at (__NR_Linux + 299)
-#define __NR_clock_adjtime (__NR_Linux + 300)
-#define __NR_syncfs (__NR_Linux + 301)
-#define __NR_sendmmsg (__NR_Linux + 302)
-#define __NR_setns (__NR_Linux + 303)
-#define __NR_process_vm_readv (__NR_Linux + 304)
-#define __NR_process_vm_writev (__NR_Linux + 305)
-#define __NR_kcmp (__NR_Linux + 306)
-#define __NR_finit_module (__NR_Linux + 307)
-#define __NR_getdents64 (__NR_Linux + 308)
-#define __NR_sched_setattr (__NR_Linux + 309)
-#define __NR_sched_getattr (__NR_Linux + 310)
-#define __NR_renameat2 (__NR_Linux + 311)
-#define __NR_seccomp (__NR_Linux + 312)
-#define __NR_getrandom (__NR_Linux + 313)
-#define __NR_memfd_create (__NR_Linux + 314)
-#define __NR_bpf (__NR_Linux + 315)
-#define __NR_execveat (__NR_Linux + 316)
-#define __NR_userfaultfd (__NR_Linux + 317)
-#define __NR_membarrier (__NR_Linux + 318)
-#define __NR_mlock2 (__NR_Linux + 319)
-#define __NR_copy_file_range (__NR_Linux + 320)
-#define __NR_preadv2 (__NR_Linux + 321)
-#define __NR_pwritev2 (__NR_Linux + 322)
-#define __NR_pkey_mprotect (__NR_Linux + 323)
-#define __NR_pkey_alloc (__NR_Linux + 324)
-#define __NR_pkey_free (__NR_Linux + 325)
-#define __NR_statx (__NR_Linux + 326)
-#define __NR_rseq (__NR_Linux + 327)
-#define __NR_io_pgetevents (__NR_Linux + 328)
-#define __NR_pidfd_send_signal (__NR_Linux + 424)
-#define __NR_io_uring_setup (__NR_Linux + 425)
-#define __NR_io_uring_enter (__NR_Linux + 426)
-#define __NR_io_uring_register (__NR_Linux + 427)
-#define __NR_open_tree (__NR_Linux + 428)
-#define __NR_move_mount (__NR_Linux + 429)
-#define __NR_fsopen (__NR_Linux + 430)
-#define __NR_fsconfig (__NR_Linux + 431)
-#define __NR_fsmount (__NR_Linux + 432)
-#define __NR_fspick (__NR_Linux + 433)
-#define __NR_pidfd_open (__NR_Linux + 434)
-#define __NR_clone3 (__NR_Linux + 435)
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h
deleted file mode 100644
index 4a98139..0000000
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h
+++ /dev/null
@@ -1,23 +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 _UAPI_ASM_MIPS_UNISTD_NR_N32_H
-#define _UAPI_ASM_MIPS_UNISTD_NR_N32_H
-#define __NR_N32_Linux 6000
-#define __NR_N32_Linux_syscalls 436
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h
deleted file mode 100644
index f5b5982..0000000
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h
+++ /dev/null
@@ -1,23 +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 _UAPI_ASM_MIPS_UNISTD_NR_N64_H
-#define _UAPI_ASM_MIPS_UNISTD_NR_N64_H
-#define __NR_64_Linux 5000
-#define __NR_64_Linux_syscalls 436
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h
deleted file mode 100644
index 72a6c59..0000000
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h
+++ /dev/null
@@ -1,23 +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 _UAPI_ASM_MIPS_UNISTD_NR_O32_H
-#define _UAPI_ASM_MIPS_UNISTD_NR_O32_H
-#define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls 436
-#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_o32.h b/libc/kernel/uapi/asm-mips/asm/unistd_o32.h
deleted file mode 100644
index 0ed3ba2..0000000
--- a/libc/kernel/uapi/asm-mips/asm/unistd_o32.h
+++ /dev/null
@@ -1,431 +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 _UAPI_ASM_MIPS_UNISTD_O32_H
-#define _UAPI_ASM_MIPS_UNISTD_O32_H
-#define __NR_syscall (__NR_Linux + 0)
-#define __NR_exit (__NR_Linux + 1)
-#define __NR_fork (__NR_Linux + 2)
-#define __NR_read (__NR_Linux + 3)
-#define __NR_write (__NR_Linux + 4)
-#define __NR_open (__NR_Linux + 5)
-#define __NR_close (__NR_Linux + 6)
-#define __NR_waitpid (__NR_Linux + 7)
-#define __NR_creat (__NR_Linux + 8)
-#define __NR_link (__NR_Linux + 9)
-#define __NR_unlink (__NR_Linux + 10)
-#define __NR_execve (__NR_Linux + 11)
-#define __NR_chdir (__NR_Linux + 12)
-#define __NR_time (__NR_Linux + 13)
-#define __NR_mknod (__NR_Linux + 14)
-#define __NR_chmod (__NR_Linux + 15)
-#define __NR_lchown (__NR_Linux + 16)
-#define __NR_break (__NR_Linux + 17)
-#define __NR_unused18 (__NR_Linux + 18)
-#define __NR_lseek (__NR_Linux + 19)
-#define __NR_getpid (__NR_Linux + 20)
-#define __NR_mount (__NR_Linux + 21)
-#define __NR_umount (__NR_Linux + 22)
-#define __NR_setuid (__NR_Linux + 23)
-#define __NR_getuid (__NR_Linux + 24)
-#define __NR_stime (__NR_Linux + 25)
-#define __NR_ptrace (__NR_Linux + 26)
-#define __NR_alarm (__NR_Linux + 27)
-#define __NR_unused28 (__NR_Linux + 28)
-#define __NR_pause (__NR_Linux + 29)
-#define __NR_utime (__NR_Linux + 30)
-#define __NR_stty (__NR_Linux + 31)
-#define __NR_gtty (__NR_Linux + 32)
-#define __NR_access (__NR_Linux + 33)
-#define __NR_nice (__NR_Linux + 34)
-#define __NR_ftime (__NR_Linux + 35)
-#define __NR_sync (__NR_Linux + 36)
-#define __NR_kill (__NR_Linux + 37)
-#define __NR_rename (__NR_Linux + 38)
-#define __NR_mkdir (__NR_Linux + 39)
-#define __NR_rmdir (__NR_Linux + 40)
-#define __NR_dup (__NR_Linux + 41)
-#define __NR_pipe (__NR_Linux + 42)
-#define __NR_times (__NR_Linux + 43)
-#define __NR_prof (__NR_Linux + 44)
-#define __NR_brk (__NR_Linux + 45)
-#define __NR_setgid (__NR_Linux + 46)
-#define __NR_getgid (__NR_Linux + 47)
-#define __NR_signal (__NR_Linux + 48)
-#define __NR_geteuid (__NR_Linux + 49)
-#define __NR_getegid (__NR_Linux + 50)
-#define __NR_acct (__NR_Linux + 51)
-#define __NR_umount2 (__NR_Linux + 52)
-#define __NR_lock (__NR_Linux + 53)
-#define __NR_ioctl (__NR_Linux + 54)
-#define __NR_fcntl (__NR_Linux + 55)
-#define __NR_mpx (__NR_Linux + 56)
-#define __NR_setpgid (__NR_Linux + 57)
-#define __NR_ulimit (__NR_Linux + 58)
-#define __NR_unused59 (__NR_Linux + 59)
-#define __NR_umask (__NR_Linux + 60)
-#define __NR_chroot (__NR_Linux + 61)
-#define __NR_ustat (__NR_Linux + 62)
-#define __NR_dup2 (__NR_Linux + 63)
-#define __NR_getppid (__NR_Linux + 64)
-#define __NR_getpgrp (__NR_Linux + 65)
-#define __NR_setsid (__NR_Linux + 66)
-#define __NR_sigaction (__NR_Linux + 67)
-#define __NR_sgetmask (__NR_Linux + 68)
-#define __NR_ssetmask (__NR_Linux + 69)
-#define __NR_setreuid (__NR_Linux + 70)
-#define __NR_setregid (__NR_Linux + 71)
-#define __NR_sigsuspend (__NR_Linux + 72)
-#define __NR_sigpending (__NR_Linux + 73)
-#define __NR_sethostname (__NR_Linux + 74)
-#define __NR_setrlimit (__NR_Linux + 75)
-#define __NR_getrlimit (__NR_Linux + 76)
-#define __NR_getrusage (__NR_Linux + 77)
-#define __NR_gettimeofday (__NR_Linux + 78)
-#define __NR_settimeofday (__NR_Linux + 79)
-#define __NR_getgroups (__NR_Linux + 80)
-#define __NR_setgroups (__NR_Linux + 81)
-#define __NR_reserved82 (__NR_Linux + 82)
-#define __NR_symlink (__NR_Linux + 83)
-#define __NR_unused84 (__NR_Linux + 84)
-#define __NR_readlink (__NR_Linux + 85)
-#define __NR_uselib (__NR_Linux + 86)
-#define __NR_swapon (__NR_Linux + 87)
-#define __NR_reboot (__NR_Linux + 88)
-#define __NR_readdir (__NR_Linux + 89)
-#define __NR_mmap (__NR_Linux + 90)
-#define __NR_munmap (__NR_Linux + 91)
-#define __NR_truncate (__NR_Linux + 92)
-#define __NR_ftruncate (__NR_Linux + 93)
-#define __NR_fchmod (__NR_Linux + 94)
-#define __NR_fchown (__NR_Linux + 95)
-#define __NR_getpriority (__NR_Linux + 96)
-#define __NR_setpriority (__NR_Linux + 97)
-#define __NR_profil (__NR_Linux + 98)
-#define __NR_statfs (__NR_Linux + 99)
-#define __NR_fstatfs (__NR_Linux + 100)
-#define __NR_ioperm (__NR_Linux + 101)
-#define __NR_socketcall (__NR_Linux + 102)
-#define __NR_syslog (__NR_Linux + 103)
-#define __NR_setitimer (__NR_Linux + 104)
-#define __NR_getitimer (__NR_Linux + 105)
-#define __NR_stat (__NR_Linux + 106)
-#define __NR_lstat (__NR_Linux + 107)
-#define __NR_fstat (__NR_Linux + 108)
-#define __NR_unused109 (__NR_Linux + 109)
-#define __NR_iopl (__NR_Linux + 110)
-#define __NR_vhangup (__NR_Linux + 111)
-#define __NR_idle (__NR_Linux + 112)
-#define __NR_vm86 (__NR_Linux + 113)
-#define __NR_wait4 (__NR_Linux + 114)
-#define __NR_swapoff (__NR_Linux + 115)
-#define __NR_sysinfo (__NR_Linux + 116)
-#define __NR_ipc (__NR_Linux + 117)
-#define __NR_fsync (__NR_Linux + 118)
-#define __NR_sigreturn (__NR_Linux + 119)
-#define __NR_clone (__NR_Linux + 120)
-#define __NR_setdomainname (__NR_Linux + 121)
-#define __NR_uname (__NR_Linux + 122)
-#define __NR_modify_ldt (__NR_Linux + 123)
-#define __NR_adjtimex (__NR_Linux + 124)
-#define __NR_mprotect (__NR_Linux + 125)
-#define __NR_sigprocmask (__NR_Linux + 126)
-#define __NR_create_module (__NR_Linux + 127)
-#define __NR_init_module (__NR_Linux + 128)
-#define __NR_delete_module (__NR_Linux + 129)
-#define __NR_get_kernel_syms (__NR_Linux + 130)
-#define __NR_quotactl (__NR_Linux + 131)
-#define __NR_getpgid (__NR_Linux + 132)
-#define __NR_fchdir (__NR_Linux + 133)
-#define __NR_bdflush (__NR_Linux + 134)
-#define __NR_sysfs (__NR_Linux + 135)
-#define __NR_personality (__NR_Linux + 136)
-#define __NR_afs_syscall (__NR_Linux + 137)
-#define __NR_setfsuid (__NR_Linux + 138)
-#define __NR_setfsgid (__NR_Linux + 139)
-#define __NR__llseek (__NR_Linux + 140)
-#define __NR_getdents (__NR_Linux + 141)
-#define __NR__newselect (__NR_Linux + 142)
-#define __NR_flock (__NR_Linux + 143)
-#define __NR_msync (__NR_Linux + 144)
-#define __NR_readv (__NR_Linux + 145)
-#define __NR_writev (__NR_Linux + 146)
-#define __NR_cacheflush (__NR_Linux + 147)
-#define __NR_cachectl (__NR_Linux + 148)
-#define __NR_sysmips (__NR_Linux + 149)
-#define __NR_unused150 (__NR_Linux + 150)
-#define __NR_getsid (__NR_Linux + 151)
-#define __NR_fdatasync (__NR_Linux + 152)
-#define __NR__sysctl (__NR_Linux + 153)
-#define __NR_mlock (__NR_Linux + 154)
-#define __NR_munlock (__NR_Linux + 155)
-#define __NR_mlockall (__NR_Linux + 156)
-#define __NR_munlockall (__NR_Linux + 157)
-#define __NR_sched_setparam (__NR_Linux + 158)
-#define __NR_sched_getparam (__NR_Linux + 159)
-#define __NR_sched_setscheduler (__NR_Linux + 160)
-#define __NR_sched_getscheduler (__NR_Linux + 161)
-#define __NR_sched_yield (__NR_Linux + 162)
-#define __NR_sched_get_priority_max (__NR_Linux + 163)
-#define __NR_sched_get_priority_min (__NR_Linux + 164)
-#define __NR_sched_rr_get_interval (__NR_Linux + 165)
-#define __NR_nanosleep (__NR_Linux + 166)
-#define __NR_mremap (__NR_Linux + 167)
-#define __NR_accept (__NR_Linux + 168)
-#define __NR_bind (__NR_Linux + 169)
-#define __NR_connect (__NR_Linux + 170)
-#define __NR_getpeername (__NR_Linux + 171)
-#define __NR_getsockname (__NR_Linux + 172)
-#define __NR_getsockopt (__NR_Linux + 173)
-#define __NR_listen (__NR_Linux + 174)
-#define __NR_recv (__NR_Linux + 175)
-#define __NR_recvfrom (__NR_Linux + 176)
-#define __NR_recvmsg (__NR_Linux + 177)
-#define __NR_send (__NR_Linux + 178)
-#define __NR_sendmsg (__NR_Linux + 179)
-#define __NR_sendto (__NR_Linux + 180)
-#define __NR_setsockopt (__NR_Linux + 181)
-#define __NR_shutdown (__NR_Linux + 182)
-#define __NR_socket (__NR_Linux + 183)
-#define __NR_socketpair (__NR_Linux + 184)
-#define __NR_setresuid (__NR_Linux + 185)
-#define __NR_getresuid (__NR_Linux + 186)
-#define __NR_query_module (__NR_Linux + 187)
-#define __NR_poll (__NR_Linux + 188)
-#define __NR_nfsservctl (__NR_Linux + 189)
-#define __NR_setresgid (__NR_Linux + 190)
-#define __NR_getresgid (__NR_Linux + 191)
-#define __NR_prctl (__NR_Linux + 192)
-#define __NR_rt_sigreturn (__NR_Linux + 193)
-#define __NR_rt_sigaction (__NR_Linux + 194)
-#define __NR_rt_sigprocmask (__NR_Linux + 195)
-#define __NR_rt_sigpending (__NR_Linux + 196)
-#define __NR_rt_sigtimedwait (__NR_Linux + 197)
-#define __NR_rt_sigqueueinfo (__NR_Linux + 198)
-#define __NR_rt_sigsuspend (__NR_Linux + 199)
-#define __NR_pread64 (__NR_Linux + 200)
-#define __NR_pwrite64 (__NR_Linux + 201)
-#define __NR_chown (__NR_Linux + 202)
-#define __NR_getcwd (__NR_Linux + 203)
-#define __NR_capget (__NR_Linux + 204)
-#define __NR_capset (__NR_Linux + 205)
-#define __NR_sigaltstack (__NR_Linux + 206)
-#define __NR_sendfile (__NR_Linux + 207)
-#define __NR_getpmsg (__NR_Linux + 208)
-#define __NR_putpmsg (__NR_Linux + 209)
-#define __NR_mmap2 (__NR_Linux + 210)
-#define __NR_truncate64 (__NR_Linux + 211)
-#define __NR_ftruncate64 (__NR_Linux + 212)
-#define __NR_stat64 (__NR_Linux + 213)
-#define __NR_lstat64 (__NR_Linux + 214)
-#define __NR_fstat64 (__NR_Linux + 215)
-#define __NR_pivot_root (__NR_Linux + 216)
-#define __NR_mincore (__NR_Linux + 217)
-#define __NR_madvise (__NR_Linux + 218)
-#define __NR_getdents64 (__NR_Linux + 219)
-#define __NR_fcntl64 (__NR_Linux + 220)
-#define __NR_reserved221 (__NR_Linux + 221)
-#define __NR_gettid (__NR_Linux + 222)
-#define __NR_readahead (__NR_Linux + 223)
-#define __NR_setxattr (__NR_Linux + 224)
-#define __NR_lsetxattr (__NR_Linux + 225)
-#define __NR_fsetxattr (__NR_Linux + 226)
-#define __NR_getxattr (__NR_Linux + 227)
-#define __NR_lgetxattr (__NR_Linux + 228)
-#define __NR_fgetxattr (__NR_Linux + 229)
-#define __NR_listxattr (__NR_Linux + 230)
-#define __NR_llistxattr (__NR_Linux + 231)
-#define __NR_flistxattr (__NR_Linux + 232)
-#define __NR_removexattr (__NR_Linux + 233)
-#define __NR_lremovexattr (__NR_Linux + 234)
-#define __NR_fremovexattr (__NR_Linux + 235)
-#define __NR_tkill (__NR_Linux + 236)
-#define __NR_sendfile64 (__NR_Linux + 237)
-#define __NR_futex (__NR_Linux + 238)
-#define __NR_sched_setaffinity (__NR_Linux + 239)
-#define __NR_sched_getaffinity (__NR_Linux + 240)
-#define __NR_io_setup (__NR_Linux + 241)
-#define __NR_io_destroy (__NR_Linux + 242)
-#define __NR_io_getevents (__NR_Linux + 243)
-#define __NR_io_submit (__NR_Linux + 244)
-#define __NR_io_cancel (__NR_Linux + 245)
-#define __NR_exit_group (__NR_Linux + 246)
-#define __NR_lookup_dcookie (__NR_Linux + 247)
-#define __NR_epoll_create (__NR_Linux + 248)
-#define __NR_epoll_ctl (__NR_Linux + 249)
-#define __NR_epoll_wait (__NR_Linux + 250)
-#define __NR_remap_file_pages (__NR_Linux + 251)
-#define __NR_set_tid_address (__NR_Linux + 252)
-#define __NR_restart_syscall (__NR_Linux + 253)
-#define __NR_fadvise64 (__NR_Linux + 254)
-#define __NR_statfs64 (__NR_Linux + 255)
-#define __NR_fstatfs64 (__NR_Linux + 256)
-#define __NR_timer_create (__NR_Linux + 257)
-#define __NR_timer_settime (__NR_Linux + 258)
-#define __NR_timer_gettime (__NR_Linux + 259)
-#define __NR_timer_getoverrun (__NR_Linux + 260)
-#define __NR_timer_delete (__NR_Linux + 261)
-#define __NR_clock_settime (__NR_Linux + 262)
-#define __NR_clock_gettime (__NR_Linux + 263)
-#define __NR_clock_getres (__NR_Linux + 264)
-#define __NR_clock_nanosleep (__NR_Linux + 265)
-#define __NR_tgkill (__NR_Linux + 266)
-#define __NR_utimes (__NR_Linux + 267)
-#define __NR_mbind (__NR_Linux + 268)
-#define __NR_get_mempolicy (__NR_Linux + 269)
-#define __NR_set_mempolicy (__NR_Linux + 270)
-#define __NR_mq_open (__NR_Linux + 271)
-#define __NR_mq_unlink (__NR_Linux + 272)
-#define __NR_mq_timedsend (__NR_Linux + 273)
-#define __NR_mq_timedreceive (__NR_Linux + 274)
-#define __NR_mq_notify (__NR_Linux + 275)
-#define __NR_mq_getsetattr (__NR_Linux + 276)
-#define __NR_vserver (__NR_Linux + 277)
-#define __NR_waitid (__NR_Linux + 278)
-#define __NR_add_key (__NR_Linux + 280)
-#define __NR_request_key (__NR_Linux + 281)
-#define __NR_keyctl (__NR_Linux + 282)
-#define __NR_set_thread_area (__NR_Linux + 283)
-#define __NR_inotify_init (__NR_Linux + 284)
-#define __NR_inotify_add_watch (__NR_Linux + 285)
-#define __NR_inotify_rm_watch (__NR_Linux + 286)
-#define __NR_migrate_pages (__NR_Linux + 287)
-#define __NR_openat (__NR_Linux + 288)
-#define __NR_mkdirat (__NR_Linux + 289)
-#define __NR_mknodat (__NR_Linux + 290)
-#define __NR_fchownat (__NR_Linux + 291)
-#define __NR_futimesat (__NR_Linux + 292)
-#define __NR_fstatat64 (__NR_Linux + 293)
-#define __NR_unlinkat (__NR_Linux + 294)
-#define __NR_renameat (__NR_Linux + 295)
-#define __NR_linkat (__NR_Linux + 296)
-#define __NR_symlinkat (__NR_Linux + 297)
-#define __NR_readlinkat (__NR_Linux + 298)
-#define __NR_fchmodat (__NR_Linux + 299)
-#define __NR_faccessat (__NR_Linux + 300)
-#define __NR_pselect6 (__NR_Linux + 301)
-#define __NR_ppoll (__NR_Linux + 302)
-#define __NR_unshare (__NR_Linux + 303)
-#define __NR_splice (__NR_Linux + 304)
-#define __NR_sync_file_range (__NR_Linux + 305)
-#define __NR_tee (__NR_Linux + 306)
-#define __NR_vmsplice (__NR_Linux + 307)
-#define __NR_move_pages (__NR_Linux + 308)
-#define __NR_set_robust_list (__NR_Linux + 309)
-#define __NR_get_robust_list (__NR_Linux + 310)
-#define __NR_kexec_load (__NR_Linux + 311)
-#define __NR_getcpu (__NR_Linux + 312)
-#define __NR_epoll_pwait (__NR_Linux + 313)
-#define __NR_ioprio_set (__NR_Linux + 314)
-#define __NR_ioprio_get (__NR_Linux + 315)
-#define __NR_utimensat (__NR_Linux + 316)
-#define __NR_signalfd (__NR_Linux + 317)
-#define __NR_timerfd (__NR_Linux + 318)
-#define __NR_eventfd (__NR_Linux + 319)
-#define __NR_fallocate (__NR_Linux + 320)
-#define __NR_timerfd_create (__NR_Linux + 321)
-#define __NR_timerfd_gettime (__NR_Linux + 322)
-#define __NR_timerfd_settime (__NR_Linux + 323)
-#define __NR_signalfd4 (__NR_Linux + 324)
-#define __NR_eventfd2 (__NR_Linux + 325)
-#define __NR_epoll_create1 (__NR_Linux + 326)
-#define __NR_dup3 (__NR_Linux + 327)
-#define __NR_pipe2 (__NR_Linux + 328)
-#define __NR_inotify_init1 (__NR_Linux + 329)
-#define __NR_preadv (__NR_Linux + 330)
-#define __NR_pwritev (__NR_Linux + 331)
-#define __NR_rt_tgsigqueueinfo (__NR_Linux + 332)
-#define __NR_perf_event_open (__NR_Linux + 333)
-#define __NR_accept4 (__NR_Linux + 334)
-#define __NR_recvmmsg (__NR_Linux + 335)
-#define __NR_fanotify_init (__NR_Linux + 336)
-#define __NR_fanotify_mark (__NR_Linux + 337)
-#define __NR_prlimit64 (__NR_Linux + 338)
-#define __NR_name_to_handle_at (__NR_Linux + 339)
-#define __NR_open_by_handle_at (__NR_Linux + 340)
-#define __NR_clock_adjtime (__NR_Linux + 341)
-#define __NR_syncfs (__NR_Linux + 342)
-#define __NR_sendmmsg (__NR_Linux + 343)
-#define __NR_setns (__NR_Linux + 344)
-#define __NR_process_vm_readv (__NR_Linux + 345)
-#define __NR_process_vm_writev (__NR_Linux + 346)
-#define __NR_kcmp (__NR_Linux + 347)
-#define __NR_finit_module (__NR_Linux + 348)
-#define __NR_sched_setattr (__NR_Linux + 349)
-#define __NR_sched_getattr (__NR_Linux + 350)
-#define __NR_renameat2 (__NR_Linux + 351)
-#define __NR_seccomp (__NR_Linux + 352)
-#define __NR_getrandom (__NR_Linux + 353)
-#define __NR_memfd_create (__NR_Linux + 354)
-#define __NR_bpf (__NR_Linux + 355)
-#define __NR_execveat (__NR_Linux + 356)
-#define __NR_userfaultfd (__NR_Linux + 357)
-#define __NR_membarrier (__NR_Linux + 358)
-#define __NR_mlock2 (__NR_Linux + 359)
-#define __NR_copy_file_range (__NR_Linux + 360)
-#define __NR_preadv2 (__NR_Linux + 361)
-#define __NR_pwritev2 (__NR_Linux + 362)
-#define __NR_pkey_mprotect (__NR_Linux + 363)
-#define __NR_pkey_alloc (__NR_Linux + 364)
-#define __NR_pkey_free (__NR_Linux + 365)
-#define __NR_statx (__NR_Linux + 366)
-#define __NR_rseq (__NR_Linux + 367)
-#define __NR_io_pgetevents (__NR_Linux + 368)
-#define __NR_semget (__NR_Linux + 393)
-#define __NR_semctl (__NR_Linux + 394)
-#define __NR_shmget (__NR_Linux + 395)
-#define __NR_shmctl (__NR_Linux + 396)
-#define __NR_shmat (__NR_Linux + 397)
-#define __NR_shmdt (__NR_Linux + 398)
-#define __NR_msgget (__NR_Linux + 399)
-#define __NR_msgsnd (__NR_Linux + 400)
-#define __NR_msgrcv (__NR_Linux + 401)
-#define __NR_msgctl (__NR_Linux + 402)
-#define __NR_clock_gettime64 (__NR_Linux + 403)
-#define __NR_clock_settime64 (__NR_Linux + 404)
-#define __NR_clock_adjtime64 (__NR_Linux + 405)
-#define __NR_clock_getres_time64 (__NR_Linux + 406)
-#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
-#define __NR_timer_gettime64 (__NR_Linux + 408)
-#define __NR_timer_settime64 (__NR_Linux + 409)
-#define __NR_timerfd_gettime64 (__NR_Linux + 410)
-#define __NR_timerfd_settime64 (__NR_Linux + 411)
-#define __NR_utimensat_time64 (__NR_Linux + 412)
-#define __NR_pselect6_time64 (__NR_Linux + 413)
-#define __NR_ppoll_time64 (__NR_Linux + 414)
-#define __NR_io_pgetevents_time64 (__NR_Linux + 416)
-#define __NR_recvmmsg_time64 (__NR_Linux + 417)
-#define __NR_mq_timedsend_time64 (__NR_Linux + 418)
-#define __NR_mq_timedreceive_time64 (__NR_Linux + 419)
-#define __NR_semtimedop_time64 (__NR_Linux + 420)
-#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421)
-#define __NR_futex_time64 (__NR_Linux + 422)
-#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423)
-#define __NR_pidfd_send_signal (__NR_Linux + 424)
-#define __NR_io_uring_setup (__NR_Linux + 425)
-#define __NR_io_uring_enter (__NR_Linux + 426)
-#define __NR_io_uring_register (__NR_Linux + 427)
-#define __NR_open_tree (__NR_Linux + 428)
-#define __NR_move_mount (__NR_Linux + 429)
-#define __NR_fsopen (__NR_Linux + 430)
-#define __NR_fsconfig (__NR_Linux + 431)
-#define __NR_fsmount (__NR_Linux + 432)
-#define __NR_fspick (__NR_Linux + 433)
-#define __NR_pidfd_open (__NR_Linux + 434)
-#define __NR_clone3 (__NR_Linux + 435)
-#endif
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 2710fb2..54da02e 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1707,6 +1707,7 @@
     android_gethostbyaddrfornetcontext;
     android_gethostbynamefornet;
     android_gethostbynamefornetcontext;
+    android_unsafe_frame_pointer_chase;
     arc4random_addrandom; # arm x86 mips
     arc4random_stir; # arm x86 mips
     atexit; # arm
@@ -1752,6 +1753,9 @@
     __system_property_set_filename;
     __system_property_update;
     android_fdsan_get_fd_table;
+    android_fdtrack_compare_exchange_hook; # llndk
+    android_fdtrack_get_enabled; # llndk
+    android_fdtrack_set_enabled; # llndk
     android_net_res_stats_get_info_for_net;
     android_net_res_stats_aggregate;
     android_net_res_stats_get_usable_servers;
diff --git a/libc/platform/bionic/android_unsafe_frame_pointer_chase.h b/libc/platform/bionic/android_unsafe_frame_pointer_chase.h
new file mode 100644
index 0000000..2b9a32f
--- /dev/null
+++ b/libc/platform/bionic/android_unsafe_frame_pointer_chase.h
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <stddef.h>
+#include <stdint.h>
+
+/*
+ * Implement fast stack unwinding for stack frames with frame pointers. Stores at most num_entries
+ * return addresses to buffer buf. Returns the number of available return addresses, which may be
+ * greater than num_entries.
+ *
+ * This function makes no guarantees about its behavior on encountering a frame built without frame
+ * pointers, except that it should not crash or enter an infinite loop, and that any frames prior to
+ * the frame built without frame pointers should be correct.
+ *
+ * This function is only meant to be used with memory safety tools such as sanitizers which need to
+ * take stack traces efficiently. Normal applications should use APIs such as libunwindstack or
+ * _Unwind_Backtrace.
+ */
+extern "C" size_t android_unsafe_frame_pointer_chase(uintptr_t* buf, size_t num_entries);
diff --git a/libc/platform/bionic/fdtrack.h b/libc/platform/bionic/fdtrack.h
new file mode 100644
index 0000000..6eb379b
--- /dev/null
+++ b/libc/platform/bionic/fdtrack.h
@@ -0,0 +1,73 @@
+/*
+ * 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 <stdbool.h>
+#include <stdint.h>
+
+__BEGIN_DECLS
+
+// Types of an android_fdtrack_event.
+enum android_fdtrack_event_type {
+  // File descriptor creation: create is the active member of android_fdtrack_event::data.
+  ANDROID_FDTRACK_EVENT_TYPE_CREATE,
+
+  // File descriptor closed.
+  ANDROID_FDTRACK_EVENT_TYPE_CLOSE,
+};
+
+struct android_fdtrack_event {
+  // File descriptor for which this event occurred.
+  int fd;
+
+  // Type of event: this is one of the enumerators of android_fdtrack_event_type.
+  uint8_t type;
+
+  // Data for the event.
+  union {
+    struct {
+      const char* function_name;
+    } create;
+  } data;
+};
+
+// Callback invoked upon file descriptor creation/closure.
+typedef void (*android_fdtrack_hook_t)(struct android_fdtrack_event*);
+
+// Register a hook which is called to track fd lifecycle events.
+bool android_fdtrack_compare_exchange_hook(android_fdtrack_hook_t* expected, android_fdtrack_hook_t value) __INTRODUCED_IN(30);
+
+// Enable/disable fdtrack *on the current thread*.
+// This is primarily useful when performing operations which you don't want to track
+// (e.g. when emitting already-recorded information).
+bool android_fdtrack_get_enabled() __INTRODUCED_IN(30);
+bool android_fdtrack_set_enabled(bool new_value) __INTRODUCED_IN(30);
+
+__END_DECLS
diff --git a/libc/bionic/dup2.cpp b/libc/platform/bionic/mte.h
similarity index 66%
copy from libc/bionic/dup2.cpp
copy to libc/platform/bionic/mte.h
index 98c5646..661664a 100644
--- a/libc/bionic/dup2.cpp
+++ b/libc/platform/bionic/mte.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 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,19 +26,36 @@
  * SUCH DAMAGE.
  */
 
-#include <fcntl.h>
-#include <unistd.h>
+#pragma once
 
-int dup2(int old_fd, int new_fd) {
-  // If old_fd is equal to new_fd and a valid file descriptor, dup2 returns
-  // old_fd without closing it. This is not true of dup3, so we have to
-  // handle this case ourselves.
-  if (old_fd == new_fd) {
-    if (fcntl(old_fd, F_GETFD) == -1) {
-      return -1;
+#include <sys/auxv.h>
+#include <bionic/mte_kernel.h>
+
+#ifdef __aarch64__
+inline bool mte_supported() {
+#ifdef ANDROID_EXPERIMENTAL_MTE
+  static bool supported = getauxval(AT_HWCAP2) & HWCAP2_MTE;
+#else
+  static bool supported = false;
+#endif
+  return supported;
+}
+#endif
+
+struct ScopedDisableMTE {
+  ScopedDisableMTE() {
+#ifdef __aarch64__
+    if (mte_supported()) {
+      __asm__ __volatile__(".arch_extension mte; msr tco, #1");
     }
-    return old_fd;
+#endif
   }
 
-  return dup3(old_fd, new_fd, 0);
-}
+  ~ScopedDisableMTE() {
+#ifdef __aarch64__
+    if (mte_supported()) {
+      __asm__ __volatile__(".arch_extension mte; msr tco, #0");
+    }
+#endif
+  }
+};
diff --git a/libc/platform/bionic/reserved_signals.h b/libc/platform/bionic/reserved_signals.h
index 7634b27..4ac6455 100644
--- a/libc/platform/bionic/reserved_signals.h
+++ b/libc/platform/bionic/reserved_signals.h
@@ -42,14 +42,16 @@
 //   36 (__SIGRTMIN + 4)        platform profilers (heapprofd, traced_perf)
 //   37 (__SIGRTMIN + 5)        coverage (libprofile-extras)
 //   38 (__SIGRTMIN + 6)        heapprofd ART managed heap dumps
+//   39 (__SIGRTMIN + 7)        fdtrack
 //
 // If you change this, also change __ndk_legacy___libc_current_sigrtmin
 // in <android/legacy_signal_inlines.h> to match.
 
 #define BIONIC_SIGNAL_DEBUGGER __SIGRTMIN + 3
 #define BIONIC_SIGNAL_PROFILER __SIGRTMIN + 4
+#define BIONIC_SIGNAL_FDTRACK __SIGRTMIN + 7
 
-#define __SIGRT_RESERVED 7
+#define __SIGRT_RESERVED 8
 static inline __always_inline sigset64_t filter_reserved_signals(sigset64_t sigset, int how) {
   int (*block)(sigset64_t*, int);
   int (*unblock)(sigset64_t*, int);
@@ -77,5 +79,6 @@
   unblock(&sigset, __SIGRTMIN + 4);
   unblock(&sigset, __SIGRTMIN + 5);
   unblock(&sigset, __SIGRTMIN + 6);
+  unblock(&sigset, __SIGRTMIN + 7);
   return sigset;
 }
diff --git a/libc/private/bionic_fdtrack.h b/libc/private/bionic_fdtrack.h
new file mode 100644
index 0000000..174ba1d
--- /dev/null
+++ b/libc/private/bionic_fdtrack.h
@@ -0,0 +1,93 @@
+/*
+ * 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 <stdatomic.h>
+
+#include "platform/bionic/fdtrack.h"
+
+#include "bionic/pthread_internal.h"
+#include "private/bionic_tls.h"
+#include "private/ErrnoRestorer.h"
+
+extern "C" _Atomic(android_fdtrack_hook_t) __android_fdtrack_hook;
+
+// Macro to record file descriptor creation.
+// e.g.:
+//   int socket(int domain, int type, int protocol) {
+//     return FDTRACK_CREATE_NAME("socket", __socket(domain, type, protocol));
+//   }
+#define FDTRACK_CREATE_NAME(name, fd_value)                       \
+  ({                                                              \
+    int __fd = (fd_value);                                        \
+    if (__fd != -1 && __predict_false(__android_fdtrack_hook)) {  \
+      bionic_tls& tls = __get_bionic_tls();                       \
+      /* fdtrack_disabled is only true during reentrant calls. */ \
+      if (!__predict_false(tls.fdtrack_disabled)) {               \
+        ErrnoRestorer r;                                          \
+        tls.fdtrack_disabled = true;                              \
+        android_fdtrack_event event;                              \
+        event.fd = __fd;                                          \
+        event.type = ANDROID_FDTRACK_EVENT_TYPE_CREATE;           \
+        event.data.create.function_name = name;                   \
+        __android_fdtrack_hook(&event);                           \
+        tls.fdtrack_disabled = false;                             \
+      }                                                           \
+    }                                                             \
+    __fd;                                                         \
+  })
+
+// Macro to record file descriptor creation, with the current function's name.
+// e.g.:
+//   int socket(int domain, int type, int protocol) {
+//     return FDTRACK_CREATE_NAME(__socket(domain, type, protocol));
+//   }
+#define FDTRACK_CREATE(fd_value) FDTRACK_CREATE_NAME(__func__, (fd_value))
+
+// Macro to record file descriptor closure.
+// Note that this does not actually close the file descriptor.
+#define FDTRACK_CLOSE(fd_value)                                  \
+  ({                                                             \
+    int __fd = (fd_value);                                       \
+    if (__fd != -1 && __predict_false(__android_fdtrack_hook)) { \
+      bionic_tls& tls = __get_bionic_tls();                      \
+      if (!__predict_false(tls.fdtrack_disabled)) {              \
+        int saved_errno = errno;                                 \
+        tls.fdtrack_disabled = true;                             \
+        android_fdtrack_event event;                             \
+        event.fd = __fd;                                         \
+        event.type = ANDROID_FDTRACK_EVENT_TYPE_CLOSE;           \
+        __android_fdtrack_hook(&event);                          \
+        tls.fdtrack_disabled = false;                            \
+        errno = saved_errno;                                     \
+      }                                                          \
+    }                                                            \
+    __fd;                                                        \
+  })
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
index 8997ceb..4cc9bbe 100644
--- a/libc/private/bionic_globals.h
+++ b/libc/private/bionic_globals.h
@@ -100,6 +100,7 @@
 
 __LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals();
 __LIBC_HIDDEN__ void __libc_init_fdsan();
+__LIBC_HIDDEN__ void __libc_init_fdtrack();
 __LIBC_HIDDEN__ void __libc_init_profiling_handlers();
 
 __LIBC_HIDDEN__ void __libc_init_malloc(libc_globals* globals);
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index bb5c67b..80d645a 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -128,6 +128,9 @@
   group_state_t group;
   passwd_state_t passwd;
 
+  char fdtrack_disabled;
+  char padding[3];
+
   // Initialize the main thread's final object using its bootstrap object.
   void copy_from_bootstrap(const bionic_tls* boot __attribute__((unused))) {
     // Nothing in bionic_tls needs to be preserved in the transition to the
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 60fb698..fa5420b 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -16,7 +16,7 @@
 import tempfile
 
 
-SupportedArchitectures = [ "arm", "arm64", "mips", "mips64", "x86", "x86_64" ]
+SupportedArchitectures = [ "arm", "arm64", "x86", "x86_64" ]
 
 syscall_stub_header = \
 """
@@ -467,6 +467,9 @@
             for arch in string.split(arch_list, ','):
                 if arch in SupportedArchitectures:
                     t[arch] = True
+                elif arch in ['mips', 'mips64']:
+                    # Unused.
+                    pass
                 else:
                     E("invalid syscall architecture '%s' in '%s'" % (arch, line))
                     return
diff --git a/libc/upstream-freebsd/.clang-format b/libc/upstream-freebsd/.clang-format
new file mode 100644
index 0000000..39789c8
--- /dev/null
+++ b/libc/upstream-freebsd/.clang-format
@@ -0,0 +1,3 @@
+DisableFormat: true
+SortIncludes: false
+SortUsingDeclarations: false
diff --git a/libc/upstream-netbsd/.clang-format b/libc/upstream-netbsd/.clang-format
new file mode 100644
index 0000000..39789c8
--- /dev/null
+++ b/libc/upstream-netbsd/.clang-format
@@ -0,0 +1,3 @@
+DisableFormat: true
+SortIncludes: false
+SortUsingDeclarations: false
diff --git a/libc/upstream-openbsd/.clang-format b/libc/upstream-openbsd/.clang-format
new file mode 100644
index 0000000..39789c8
--- /dev/null
+++ b/libc/upstream-openbsd/.clang-format
@@ -0,0 +1,3 @@
+DisableFormat: true
+SortIncludes: false
+SortUsingDeclarations: false
diff --git a/libc/versioner-dependencies/mips/kernel_uapi_asm-mips b/libc/versioner-dependencies/mips/kernel_uapi_asm-mips
deleted file mode 120000
index 94bb3db..0000000
--- a/libc/versioner-dependencies/mips/kernel_uapi_asm-mips
+++ /dev/null
@@ -1 +0,0 @@
-../../kernel/uapi/asm-mips
\ No newline at end of file
diff --git a/libc/versioner-dependencies/mips64/kernel_uapi_asm-mips b/libc/versioner-dependencies/mips64/kernel_uapi_asm-mips
deleted file mode 120000
index 94bb3db..0000000
--- a/libc/versioner-dependencies/mips64/kernel_uapi_asm-mips
+++ /dev/null
@@ -1 +0,0 @@
-../../kernel/uapi/asm-mips
\ No newline at end of file
diff --git a/libfdtrack/.clang-format b/libfdtrack/.clang-format
new file mode 120000
index 0000000..fd0645f
--- /dev/null
+++ b/libfdtrack/.clang-format
@@ -0,0 +1 @@
+../.clang-format-2
\ No newline at end of file
diff --git a/libfdtrack/Android.bp b/libfdtrack/Android.bp
new file mode 100644
index 0000000..a907d9a
--- /dev/null
+++ b/libfdtrack/Android.bp
@@ -0,0 +1,26 @@
+cc_library_shared {
+    name: "libfdtrack",
+    srcs: ["fdtrack.cpp"],
+    stl: "libc++_static",
+
+    header_libs: ["bionic_libc_platform_headers"],
+    static_libs: [
+        "libasync_safe",
+        "libbase",
+        "libunwindstack",
+        "liblzma",
+        "liblog",
+    ],
+    version_script: "libfdtrack.map.txt",
+
+    allow_undefined_symbols: true,
+    recovery_available: true,
+}
+
+cc_test {
+    name: "fdtrack_test",
+    srcs: ["fdtrack_test.cpp"],
+    whole_static_libs: ["libBionicCtsGtestMain"],
+    static_libs: ["liblog"],
+    test_suites: ["device-tests"],
+}
diff --git a/libfdtrack/fdtrack.cpp b/libfdtrack/fdtrack.cpp
new file mode 100644
index 0000000..b20e65e
--- /dev/null
+++ b/libfdtrack/fdtrack.cpp
@@ -0,0 +1,183 @@
+/*
+ * 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 <inttypes.h>
+#include <stdint.h>
+
+#include <array>
+#include <mutex>
+#include <vector>
+
+#include <android/fdsan.h>
+#include <bionic/fdtrack.h>
+
+#include <android-base/no_destructor.h>
+#include <android-base/thread_annotations.h>
+#include <async_safe/log.h>
+#include <bionic/reserved_signals.h>
+#include <unwindstack/LocalUnwinder.h>
+
+struct FdEntry {
+  std::mutex mutex;
+  std::vector<unwindstack::LocalFrameData> backtrace GUARDED_BY(mutex);
+};
+
+extern "C" void fdtrack_dump();
+
+using fdtrack_callback_t = bool (*)(int fd, const char* const* function_names,
+                                    const uint64_t* function_offsets, size_t count, void* arg);
+extern "C" void fdtrack_iterate(fdtrack_callback_t callback, void* arg);
+
+static void fd_hook(android_fdtrack_event* event);
+
+// Backtraces for the first 4k file descriptors ought to be enough to diagnose an fd leak.
+static constexpr size_t kFdTableSize = 4096;
+static constexpr size_t kStackDepth = 10;
+
+static bool installed = false;
+static std::array<FdEntry, kFdTableSize> stack_traces;
+static unwindstack::LocalUnwinder& Unwinder() {
+  static android::base::NoDestructor<unwindstack::LocalUnwinder> unwinder;
+  return *unwinder.get();
+}
+
+__attribute__((constructor)) static void ctor() {
+  for (auto& entry : stack_traces) {
+    entry.backtrace.reserve(kStackDepth);
+  }
+
+  signal(BIONIC_SIGNAL_FDTRACK, [](int) { fdtrack_dump(); });
+  if (Unwinder().Init()) {
+    android_fdtrack_hook_t expected = nullptr;
+    installed = android_fdtrack_compare_exchange_hook(&expected, &fd_hook);
+  }
+}
+
+__attribute__((destructor)) static void dtor() {
+  if (installed) {
+    android_fdtrack_hook_t expected = &fd_hook;
+    android_fdtrack_compare_exchange_hook(&expected, nullptr);
+  }
+}
+
+FdEntry* GetFdEntry(int fd) {
+  if (fd >= 0 && fd < static_cast<int>(kFdTableSize)) {
+    return &stack_traces[fd];
+  }
+  return nullptr;
+}
+
+static void fd_hook(android_fdtrack_event* event) {
+  if (event->type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) {
+    if (FdEntry* entry = GetFdEntry(event->fd); entry) {
+      std::lock_guard<std::mutex> lock(entry->mutex);
+      entry->backtrace.clear();
+      Unwinder().Unwind(&entry->backtrace, kStackDepth);
+    }
+  } else if (event->type == ANDROID_FDTRACK_EVENT_TYPE_CLOSE) {
+    if (FdEntry* entry = GetFdEntry(event->fd); entry) {
+      std::lock_guard<std::mutex> lock(entry->mutex);
+      entry->backtrace.clear();
+    }
+  }
+}
+
+void fdtrack_iterate(fdtrack_callback_t callback, void* arg) {
+  bool prev = android_fdtrack_set_enabled(false);
+
+  for (int fd = 0; fd < static_cast<int>(stack_traces.size()); ++fd) {
+    const char* function_names[kStackDepth];
+    uint64_t function_offsets[kStackDepth];
+    FdEntry* entry = GetFdEntry(fd);
+    if (!entry) {
+      continue;
+    }
+
+    if (!entry->mutex.try_lock()) {
+      async_safe_format_log(ANDROID_LOG_WARN, "fdtrack", "fd %d locked, skipping", fd);
+      continue;
+    }
+
+    if (entry->backtrace.empty()) {
+      entry->mutex.unlock();
+      continue;
+    } else if (entry->backtrace.size() < 2) {
+      async_safe_format_log(ANDROID_LOG_WARN, "fdtrack", "fd %d missing frames: size = %zu", fd,
+                            entry->backtrace.size());
+
+      entry->mutex.unlock();
+      continue;
+    }
+
+    constexpr size_t frame_skip = 2;
+    for (size_t i = frame_skip; i < entry->backtrace.size(); ++i) {
+      size_t j = i - frame_skip;
+      function_names[j] = entry->backtrace[i].function_name.c_str();
+      function_offsets[j] = entry->backtrace[i].function_offset;
+    }
+
+    bool should_continue =
+        callback(fd, function_names, function_offsets, entry->backtrace.size() - frame_skip, arg);
+
+    entry->mutex.unlock();
+
+    if (!should_continue) {
+      break;
+    }
+  }
+
+  android_fdtrack_set_enabled(prev);
+}
+
+void fdtrack_dump() {
+  if (!installed) {
+    async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fdtrack not installed");
+  } else {
+    async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fdtrack dumping...");
+  }
+
+  fdtrack_iterate(
+      [](int fd, const char* const* function_names, const uint64_t* function_offsets, size_t count,
+         void*) {
+        uint64_t fdsan_owner = android_fdsan_get_owner_tag(fd);
+        if (fdsan_owner != 0) {
+          async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fd %d: (owner = %#" PRIx64 ")", fd,
+                                fdsan_owner);
+        } else {
+          async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fd %d: (unowned)", fd);
+        }
+
+        for (size_t i = 0; i < count; ++i) {
+          async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "  %zu: %s+%" PRIu64, i,
+                                function_names[i], function_offsets[i]);
+        }
+
+        return true;
+      },
+      nullptr);
+}
diff --git a/libfdtrack/fdtrack_test.cpp b/libfdtrack/fdtrack_test.cpp
new file mode 100644
index 0000000..0edf0b8
--- /dev/null
+++ b/libfdtrack/fdtrack_test.cpp
@@ -0,0 +1,111 @@
+/*
+ * 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 <dlfcn.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <map>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+struct FdtrackFrame {
+  const char* function_name;
+  uint64_t function_offset;
+};
+
+std::map<int, std::vector<FdtrackFrame>> RunFdtrack(std::function<void()> f) {
+  void* libfdtrack = dlopen("libfdtrack.so", RTLD_NOW);
+  if (!libfdtrack) {
+    errx(1, "failed to dlopen libfdtrack.so: %s", dlerror());
+  }
+
+  using fdtrack_callback_t = bool (*)(int fd, const char* const* function_names,
+                                      const uint64_t* function_offsets, size_t count, void* arg);
+  auto fdtrack_iterate = reinterpret_cast<void (*)(fdtrack_callback_t, void* arg)>(
+      dlsym(libfdtrack, "fdtrack_iterate"));
+  if (!fdtrack_iterate) {
+    errx(1, "failed to dlsym fdtrack_iterate");
+  }
+
+  f();
+
+  std::map<int, std::vector<FdtrackFrame>> result;
+  fdtrack_iterate(
+      [](int fd, const char* const* function_names, const uint64_t* function_offsets, size_t count,
+         void* arg) {
+        auto& map = *static_cast<decltype(result)*>(arg);
+        for (size_t i = 0; i < count; ++i) {
+          map[fd].push_back(FdtrackFrame{
+              .function_name = function_names[i],
+              .function_offset = function_offsets[i],
+          });
+        }
+
+        return true;
+      },
+      &result);
+
+  return result;
+}
+
+TEST(fdtrack, open) {
+  static int fd = -1;
+  auto result = RunFdtrack([]() { fd = open("/dev/null", O_RDONLY | O_CLOEXEC); });
+
+  ASSERT_NE(-1, fd);
+  ASSERT_EQ(1, result.size());
+  ASSERT_EQ(fd, result.begin()->first);
+  ASSERT_NE(nullptr, strstr(result.begin()->second.at(0).function_name, "open"));
+}
+
+TEST(fdtrack, close) {
+  static int fd1 = -1;
+  static int fd2 = -1;
+  static int fd3 = -1;
+  auto result = RunFdtrack([]() {
+    fd1 = open("/dev/null", O_RDONLY | O_CLOEXEC);
+    fd2 = open("/dev/null", O_RDONLY | O_CLOEXEC);
+    fd3 = open("/dev/null", O_RDONLY | O_CLOEXEC);
+    close(fd2);
+  });
+
+  ASSERT_NE(-1, fd1);
+  ASSERT_NE(-1, fd2);
+  ASSERT_NE(-1, fd3);
+
+  ASSERT_EQ(2, result.size());
+  ASSERT_EQ(1, result.count(fd1));
+  ASSERT_EQ(1, result.count(fd3));
+
+  ASSERT_NE(nullptr, strstr(result[fd1].at(0).function_name, "open"));
+  ASSERT_NE(nullptr, strstr(result[fd3].at(0).function_name, "open"));
+}
diff --git a/libfdtrack/libfdtrack.map.txt b/libfdtrack/libfdtrack.map.txt
new file mode 100644
index 0000000..7a23954
--- /dev/null
+++ b/libfdtrack/libfdtrack.map.txt
@@ -0,0 +1,7 @@
+LIBFDTRACK {
+  global:
+    fdtrack_dump;
+    fdtrack_iterate;
+  local:
+    *;
+};
diff --git a/libm/upstream-freebsd/.clang-format b/libm/upstream-freebsd/.clang-format
new file mode 100644
index 0000000..39789c8
--- /dev/null
+++ b/libm/upstream-freebsd/.clang-format
@@ -0,0 +1,3 @@
+DisableFormat: true
+SortIncludes: false
+SortUsingDeclarations: false
diff --git a/libm/upstream-netbsd/.clang-format b/libm/upstream-netbsd/.clang-format
new file mode 100644
index 0000000..39789c8
--- /dev/null
+++ b/libm/upstream-netbsd/.clang-format
@@ -0,0 +1,3 @@
+DisableFormat: true
+SortIncludes: false
+SortUsingDeclarations: false
diff --git a/tests/Android.bp b/tests/Android.bp
index 469ae92..4bd96ad 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -38,6 +38,7 @@
         // For glibc.
         "-D__STDC_LIMIT_MACROS",
     ],
+    header_libs: ["bionic_libc_platform_headers"],
     // Make the bionic tests implicitly test bionic's shadow call stack support.
     arch: {
         arm64: {
@@ -49,6 +50,12 @@
         address: false,
     },
     bootstrap: true,
+
+    product_variables: {
+        experimental_mte: {
+            cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
+        },
+    },
 }
 
 // -----------------------------------------------------------------------------
@@ -91,7 +98,9 @@
         "eventfd_test.cpp",
         "fcntl_test.cpp",
         "fdsan_test.cpp",
+        "fdtrack_test.cpp",
         "fenv_test.cpp",
+        "_FILE_OFFSET_BITS_test.cpp",
         "float_test.cpp",
         "ftw_test.cpp",
         "getauxval_test.cpp",
@@ -117,6 +126,7 @@
         "math_force_long_double_test.cpp",
         "membarrier_test.cpp",
         "mntent_test.cpp",
+        "mte_test.cpp",
         "netdb_test.cpp",
         "net_if_test.cpp",
         "netinet_ether_test.cpp",
@@ -285,6 +295,20 @@
     },
 }
 
+cc_test_library {
+    name: "libBionicFramePointerTests",
+    defaults: ["bionic_tests_defaults"],
+    srcs: [
+        "android_unsafe_frame_pointer_chase_test.cpp",
+    ],
+    include_dirs: [
+        "bionic/libc",
+    ],
+    cflags: [
+        "-fno-omit-frame-pointer",
+    ],
+}
+
 // -----------------------------------------------------------------------------
 // Fortify tests.
 // -----------------------------------------------------------------------------
@@ -434,6 +458,7 @@
     whole_static_libs: [
         "libBionicStandardTests",
         "libBionicElfTlsTests",
+        "libBionicFramePointerTests",
         "libfortify1-tests-clang",
         "libfortify1-new-tests-clang",
         "libfortify2-tests-clang",
diff --git a/libc/bionic/dup2.cpp b/tests/_FILE_OFFSET_BITS_test.cpp
similarity index 75%
copy from libc/bionic/dup2.cpp
copy to tests/_FILE_OFFSET_BITS_test.cpp
index 98c5646..cbdb369 100644
--- a/libc/bionic/dup2.cpp
+++ b/tests/_FILE_OFFSET_BITS_test.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 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,19 +26,22 @@
  * SUCH DAMAGE.
  */
 
+#define _FILE_OFFSET_BITS 64
+
+#include <gtest/gtest.h>
+
 #include <fcntl.h>
-#include <unistd.h>
 
-int dup2(int old_fd, int new_fd) {
-  // If old_fd is equal to new_fd and a valid file descriptor, dup2 returns
-  // old_fd without closing it. This is not true of dup3, so we have to
-  // handle this case ourselves.
-  if (old_fd == new_fd) {
-    if (fcntl(old_fd, F_GETFD) == -1) {
-      return -1;
-    }
-    return old_fd;
-  }
+TEST(fcntl, f_getlk_FOB64) {
+  int fd = open("/proc/version", O_RDONLY);
+  ASSERT_TRUE(fd != -1);
 
-  return dup3(old_fd, new_fd, 0);
+  struct flock check_lock;
+  check_lock.l_type = F_WRLCK;
+  check_lock.l_start = 0;
+  check_lock.l_whence = SEEK_SET;
+  check_lock.l_len = 0;
+
+  ASSERT_EQ(0, fcntl(fd, F_GETLK, &check_lock));
+  close(fd);
 }
diff --git a/tests/android_unsafe_frame_pointer_chase_test.cpp b/tests/android_unsafe_frame_pointer_chase_test.cpp
new file mode 100644
index 0000000..dd04c33
--- /dev/null
+++ b/tests/android_unsafe_frame_pointer_chase_test.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2020 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 <gtest/gtest.h>
+
+#if defined(__BIONIC__)
+
+#include "platform/bionic/android_unsafe_frame_pointer_chase.h"
+
+// Prevent tail calls inside recurse.
+__attribute__((weak, noinline)) size_t nop(size_t val) {
+  return val;
+}
+
+// Call android_unsafe_frame_pointer_chase inside count recurse stack frames.
+__attribute__((weak, noinline)) int recurse(int count, uintptr_t* buf, size_t num_entries) {
+  if (count != 0) return nop(recurse(count - 1, buf, num_entries));
+  return nop(android_unsafe_frame_pointer_chase(buf, num_entries));
+}
+
+static constexpr size_t kNumFrames = 32;
+
+static bool CheckFrames(uintptr_t* frames, size_t num_frames) {
+  // We expect one recurse frame calling android_unsafe_frame_pointer_chase, followed by kNumFrames identical
+  // recurse frames calling themselves, followed by at least one frame (the first caller of
+  // recurse).
+  if (num_frames < kNumFrames + 2) {
+    printf("num_frames (0x%zu) < kNumFrames + 2", num_frames);
+    return false;
+  }
+
+  if (frames[0] == frames[1]) {
+    printf("frames[0] == frames[1] (0x%zx)", frames[0]);
+    return false;
+  }
+
+  for (size_t i = 2; i <= kNumFrames; ++i) {
+    if (frames[i] != frames[1]) {
+      printf("frames[i] (0x%zx) != frames[1] (0x%zx)", frames[i], frames[1]);
+      return false;
+    }
+  }
+
+  if (frames[kNumFrames] == frames[kNumFrames + 1]) {
+    printf("frames[kNumFrames] == frames[kNumFrames + 1] (0x%zx)", frames[kNumFrames]);
+    return false;
+  }
+
+  return true;
+}
+
+TEST(android_unsafe_frame_pointer_chase, main_thread) {
+  size_t size = recurse(kNumFrames, 0, 0);
+
+  uintptr_t frames[kNumFrames + 2];
+  size_t size2 = recurse(kNumFrames, frames, kNumFrames + 2);
+  EXPECT_EQ(size2, size);
+
+  EXPECT_TRUE(CheckFrames(frames, size));
+}
+
+static void *BacktraceThread(void *) {
+  size_t size = recurse(kNumFrames, 0, 0);
+
+  uintptr_t frames[kNumFrames + 2];
+  size_t size2 = recurse(kNumFrames, frames, kNumFrames + 2);
+  if (size2 != size) {
+    return (void*)"size2 != size";
+  }
+
+  if (!CheckFrames(frames, size)) {
+    return (void*)"CheckFrames failed";
+  }
+  return nullptr;
+}
+
+TEST(android_unsafe_frame_pointer_chase, pthread) {
+  pthread_t t;
+  ASSERT_EQ(0, pthread_create(&t, nullptr, BacktraceThread, nullptr));
+  void* retval;
+  ASSERT_EQ(0, pthread_join(t, &retval));
+  EXPECT_EQ(nullptr, reinterpret_cast<char*>(retval));
+}
+
+#endif // __BIONIC__
diff --git a/tests/fcntl_test.cpp b/tests/fcntl_test.cpp
index d7dce31..a8a4cc5 100644
--- a/tests/fcntl_test.cpp
+++ b/tests/fcntl_test.cpp
@@ -148,6 +148,20 @@
   ASSERT_EQ(4, sb.st_size);
 }
 
+TEST(fcntl, f_getlk) {
+  int fd = open("/proc/version", O_RDONLY);
+  ASSERT_TRUE(fd != -1);
+
+  struct flock check_lock;
+  check_lock.l_type = F_WRLCK;
+  check_lock.l_start = 0;
+  check_lock.l_whence = SEEK_SET;
+  check_lock.l_len = 0;
+
+  ASSERT_EQ(0, fcntl(fd, F_GETLK, &check_lock));
+  close(fd);
+}
+
 TEST(fcntl, f_getlk64) {
   int fd = open64("/proc/version", O_RDONLY);
   ASSERT_TRUE(fd != -1);
@@ -158,9 +172,7 @@
   check_lock.l_whence = SEEK_SET;
   check_lock.l_len = 0;
 
-  int rc = fcntl(fd, F_GETLK64, &check_lock);
-  ASSERT_EQ(0, rc);
-
+  ASSERT_EQ(0, fcntl(fd, F_GETLK64, &check_lock));
   close(fd);
 }
 
diff --git a/tests/fdtrack_test.cpp b/tests/fdtrack_test.cpp
new file mode 100644
index 0000000..fca92ce
--- /dev/null
+++ b/tests/fdtrack_test.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2020 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 <gtest/gtest.h>
+
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#if defined(__BIONIC__)
+#include "platform/bionic/fdtrack.h"
+#endif
+
+#include <vector>
+
+#include <android-base/unique_fd.h>
+
+#if defined(__BIONIC__)
+std::vector<android_fdtrack_event> FdtrackRun(void (*func)()) {
+  // Each bionic test is run in separate process, so we can safely use a static here.
+  static std::vector<android_fdtrack_event> events;
+  events.clear();
+
+  android_fdtrack_hook_t previous = nullptr;
+  android_fdtrack_hook_t hook = [](android_fdtrack_event* event) {
+    events.push_back(*event);
+  };
+
+  if (!android_fdtrack_compare_exchange_hook(&previous, hook)) {
+    errx(1, "failed to exchange hook: previous hook was %p", previous);
+  }
+
+  if (previous) {
+    errx(1, "hook was already registered?");
+    abort();
+  }
+
+  func();
+
+  if (!android_fdtrack_compare_exchange_hook(&hook, nullptr)) {
+    errx(1, "failed to reset hook");
+  }
+
+  return std::move(events);
+}
+#endif
+
+TEST(fdtrack, open) {
+#if defined(__BIONIC__)
+  static int fd = -1;
+  auto events = FdtrackRun([]() { fd = open("/dev/null", O_WRONLY | O_CLOEXEC); });
+  ASSERT_NE(-1, fd);
+  ASSERT_EQ(1U, events.size());
+  ASSERT_EQ(fd, events[0].fd);
+  ASSERT_EQ(ANDROID_FDTRACK_EVENT_TYPE_CREATE, events[0].type);
+  ASSERT_STREQ("open", events[0].data.create.function_name);
+#endif
+}
+
+TEST(fdtrack, close) {
+#if defined(__BIONIC__)
+  static int fd = open("/dev/null", O_WRONLY | O_CLOEXEC);
+  ASSERT_NE(-1, fd);
+
+  auto events = FdtrackRun([]() { close(fd); });
+  ASSERT_EQ(1U, events.size());
+  ASSERT_EQ(fd, events[0].fd);
+  ASSERT_EQ(ANDROID_FDTRACK_EVENT_TYPE_CLOSE, events[0].type);
+#endif
+}
+
+TEST(fdtrack, enable_disable) {
+#if defined(__BIONIC__)
+  static int fd1 = -1;
+  static int fd2 = -1;
+  static int fd3 = -1;
+
+  auto events = FdtrackRun([]() {
+    if (!android_fdtrack_get_enabled()) {
+      errx(1, "fdtrack is disabled");
+    }
+    fd1 = open("/dev/null", O_WRONLY | O_CLOEXEC);
+    android_fdtrack_set_enabled(false);
+    fd2 = open("/dev/null", O_WRONLY | O_CLOEXEC);
+    android_fdtrack_set_enabled(true);
+    fd3 = open("/dev/null", O_WRONLY | O_CLOEXEC);
+  });
+
+  if (fd1 == -1 || fd2 == -1 || fd3 == -1) {
+    errx(1, "failed to open /dev/null");
+  }
+
+  ASSERT_EQ(2U, events.size());
+
+  ASSERT_EQ(fd1, events[0].fd);
+  ASSERT_EQ(ANDROID_FDTRACK_EVENT_TYPE_CREATE, events[0].type);
+  ASSERT_STREQ("open", events[0].data.create.function_name);
+
+  ASSERT_EQ(fd3, events[1].fd);
+  ASSERT_EQ(ANDROID_FDTRACK_EVENT_TYPE_CREATE, events[1].type);
+  ASSERT_STREQ("open", events[1].data.create.function_name);
+#endif
+}
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index ef2f895..6620cdb 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -829,6 +829,63 @@
 #endif
 }
 
+// Jemalloc doesn't pass this test right now, so leave it as disabled.
+TEST(malloc, DISABLED_alloc_after_fork) {
+  // Both of these need to be a power of 2.
+  static constexpr size_t kMinAllocationSize = 8;
+  static constexpr size_t kMaxAllocationSize = 2097152;
+
+  static constexpr size_t kNumAllocatingThreads = 5;
+  static constexpr size_t kNumForkLoops = 100;
+
+  std::atomic_bool stop;
+
+  // Create threads that simply allocate and free different sizes.
+  std::vector<std::thread*> threads;
+  for (size_t i = 0; i < kNumAllocatingThreads; i++) {
+    std::thread* t = new std::thread([&stop] {
+      while (!stop) {
+        for (size_t size = kMinAllocationSize; size <= kMaxAllocationSize; size <<= 1) {
+          void* ptr = malloc(size);
+          if (ptr == nullptr) {
+            return;
+          }
+          // Make sure this value is not optimized away.
+          asm volatile("" : : "r,m"(ptr) : "memory");
+          free(ptr);
+        }
+      }
+    });
+    threads.push_back(t);
+  }
+
+  // Create a thread to fork and allocate.
+  for (size_t i = 0; i < kNumForkLoops; i++) {
+    pid_t pid;
+    if ((pid = fork()) == 0) {
+      for (size_t size = kMinAllocationSize; size <= kMaxAllocationSize; size <<= 1) {
+        void* ptr = malloc(size);
+        ASSERT_TRUE(ptr != nullptr);
+        // Make sure this value is not optimized away.
+        asm volatile("" : : "r,m"(ptr) : "memory");
+        // Make sure we can touch all of the allocation.
+        memset(ptr, 0x1, size);
+        ASSERT_LE(size, malloc_usable_size(ptr));
+        free(ptr);
+      }
+      _exit(10);
+    }
+    ASSERT_NE(-1, pid);
+    AssertChildExited(pid, 10);
+  }
+
+  stop = true;
+  for (auto thread : threads) {
+    thread->join();
+    delete thread;
+  }
+}
+
 TEST(android_mallopt, error_on_unexpected_option) {
 #if defined(__BIONIC__)
   const int unrecognized_option = -1;
diff --git a/tests/mte_test.cpp b/tests/mte_test.cpp
new file mode 100644
index 0000000..2f922a2
--- /dev/null
+++ b/tests/mte_test.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2020 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 <gtest/gtest.h>
+
+#include <bionic/mte.h>
+
+__attribute__((no_sanitize("hwaddress")))
+static void test_tag_mismatch() {
+  ScopedDisableMTE x;
+#if defined(__aarch64__)
+  std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
+  p[0] = 1;
+  int* mistagged_p = reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(p.get()) + (1ULL << 56));
+  volatile int load = *mistagged_p;
+  (void)load;
+#endif
+}
+
+TEST(mte_test, ScopedDisableMTE) {
+  test_tag_mismatch();
+}
diff --git a/tools/versioner/src/Arch.cpp b/tools/versioner/src/Arch.cpp
index 4cd9e07..3a27a6e 100644
--- a/tools/versioner/src/Arch.cpp
+++ b/tools/versioner/src/Arch.cpp
@@ -28,12 +28,6 @@
     case Arch::arm64:
       return "arm64";
 
-    case Arch::mips:
-      return "mips";
-
-    case Arch::mips64:
-      return "mips64";
-
     case Arch::x86:
       return "x86";
 
@@ -47,8 +41,6 @@
 static const std::unordered_map<std::string, Arch> arch_name_map{
   {"arm", Arch::arm},
   {"arm64", Arch::arm64},
-  {"mips", Arch::mips},
-  {"mips64", Arch::mips64},
   {"x86", Arch::x86},
   {"x86_64", Arch::x86_64},
 };
diff --git a/tools/versioner/src/Arch.h b/tools/versioner/src/Arch.h
index e4bbcc4..74d0f8f 100644
--- a/tools/versioner/src/Arch.h
+++ b/tools/versioner/src/Arch.h
@@ -28,8 +28,6 @@
 enum class Arch : size_t {
   arm = 0,
   arm64,
-  mips,
-  mips64,
   x86,
   x86_64,
 };
@@ -123,8 +121,6 @@
 static const std::set<Arch> supported_archs = {
   Arch::arm,
   Arch::arm64,
-  Arch::mips,
-  Arch::mips64,
   Arch::x86,
   Arch::x86_64,
 };
@@ -132,8 +128,6 @@
 static ArchMap<std::string> arch_targets = {
   { Arch::arm, "arm-linux-androideabi" },
   { Arch::arm64, "aarch64-linux-android" },
-  { Arch::mips, "mipsel-linux-android" },
-  { Arch::mips64, "mips64el-linux-android" },
   { Arch::x86, "i686-linux-android" },
   { Arch::x86_64, "x86_64-linux-android" },
 };
@@ -145,8 +139,6 @@
 static const ArchMap<int> arch_min_api = {
   { Arch::arm, 9 },
   { Arch::arm64, 21 },
-  { Arch::mips, 9 },
-  { Arch::mips64, 21 },
   { Arch::x86, 9 },
   { Arch::x86_64, 21 },
 };
diff --git a/tools/versioner/src/DeclarationDatabase.cpp b/tools/versioner/src/DeclarationDatabase.cpp
index afae509..3c6f643 100644
--- a/tools/versioner/src/DeclarationDatabase.cpp
+++ b/tools/versioner/src/DeclarationDatabase.cpp
@@ -164,15 +164,12 @@
           { "deprecated_in", { &global_availability.deprecated } },
           { "obsoleted_in", { &global_availability.obsoleted } },
           { "introduced_in_arm", { &arch_availability[Arch::arm].introduced } },
-          { "introduced_in_mips", { &arch_availability[Arch::mips].introduced } },
           { "introduced_in_x86", { &arch_availability[Arch::x86].introduced } },
           { "introduced_in_32",
             { &arch_availability[Arch::arm].introduced,
-              &arch_availability[Arch::mips].introduced,
               &arch_availability[Arch::x86].introduced } },
           { "introduced_in_64",
             { &arch_availability[Arch::arm64].introduced,
-              &arch_availability[Arch::mips64].introduced,
               &arch_availability[Arch::x86_64].introduced } },
         };
 
diff --git a/tools/versioner/src/Preprocessor.cpp b/tools/versioner/src/Preprocessor.cpp
index 9eac2ab..4ee3446 100644
--- a/tools/versioner/src/Preprocessor.cpp
+++ b/tools/versioner/src/Preprocessor.cpp
@@ -140,15 +140,12 @@
   std::vector<std::string> expressions;
   static const std::vector<std::pair<std::string, std::set<Arch>>> arch_sets = {
     { "", supported_archs },
-    { "!defined(__LP64__)", { Arch::arm, Arch::mips, Arch::x86 } },
-    { "defined(__LP64__)", { Arch::arm64, Arch::mips64, Arch::x86_64 } },
-    { "defined(__mips__)", { Arch::mips, Arch::mips64 } },
+    { "!defined(__LP64__)", { Arch::arm, Arch::x86 } },
+    { "defined(__LP64__)", { Arch::arm64, Arch::x86_64 } },
   };
   std::map<Arch, std::string> individual_archs = {
     { Arch::arm, "defined(__arm__)" },
     { Arch::arm64, "defined(__aarch64__)" },
-    { Arch::mips, "defined(__mips__) && !defined(__LP64__)" },
-    { Arch::mips64, "defined(__mips__) && defined(__LP64__)" },
     { 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 a5f2c7d..5e53498 100644
--- a/tools/versioner/src/versioner.h
+++ b/tools/versioner/src/versioner.h
@@ -38,7 +38,7 @@
   { "sys/_system_properties.h", supported_archs },
 
   // time64.h #errors when included on LP64 archs.
-  { "time64.h", { Arch::arm64, Arch::mips64, Arch::x86_64 } },
+  { "time64.h", { Arch::arm64, Arch::x86_64 } },
 };
 
 static const std::unordered_set<std::string> missing_symbol_whitelist = {