[libc-commits] [libc] [libc][arm] implement a basic setjmp/longjmp (PR #93220)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Fri May 24 09:39:03 PDT 2024
================
@@ -0,0 +1,23 @@
+//===-- Implementation of setjmp ------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/common.h"
+#include "src/setjmp/setjmp_impl.h"
+
+namespace LIBC_NAMESPACE {
+
+[[gnu::naked]]
+LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
+ asm(R"(
+ mov r12, sp
----------------
nickdesaulniers wrote:
This code is saving r4-r11, sp, and lr registers to the memory referred to by `buf`, then returning zero.
https://github.com/llvm/llvm-project/pull/93220
More information about the libc-commits
mailing list