[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:00 PDT 2024


================
@@ -0,0 +1,26 @@
+
+//===-- Implementation of longjmp -----------------------------------------===//
+//
+// 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/setjmp/longjmp.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+[[gnu::naked]]
+LLVM_LIBC_FUNCTION(void, longjmp, (__jmp_buf * buf, int val)) {
+  asm(R"(
+      ldm r0, {r4-r12, lr}
----------------
nickdesaulniers wrote:

The definitive document on ARM assembler (32b and 64b) is called the Arm ARM.

https://developer.arm.com/documentation/ddi0487/latest/ is the stable link to the latest edition of the non-stable document.

AAPCS is also handy: https://github.com/ARM-software/abi-aa?tab=readme-ov-file#document-locations

https://nickdesaulniers.github.io/blog/2023/03/10/disambiguating-arm/

https://github.com/llvm/llvm-project/pull/93220


More information about the libc-commits mailing list