blob: b68edb86d691f8353474c1ae1ec1f3d05ca7993d [file] [log] [blame]
Philipp Tomsichb4806d62017-10-10 16:21:13 +02001/*
2 * (C) 2017 Theobroma Systems Design und Consulting GmbH
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <config.h>
8#include <asm/macro.h>
9#include <linux/linkage.h>
10
11.pushsection .text.setjmp, "ax"
12ENTRY(setjmp)
13 /* Preserve all callee-saved registers and the SP */
14 stp x19, x20, [x0,#0]
15 stp x21, x22, [x0,#16]
16 stp x23, x24, [x0,#32]
17 stp x25, x26, [x0,#48]
18 stp x27, x28, [x0,#64]
19 stp x29, x30, [x0,#80]
20 mov x2, sp
21 str x2, [x0, #96]
22 mov x0, #0
23 ret
24ENDPROC(setjmp)
25.popsection
26
27.pushsection .text.longjmp, "ax"
28ENTRY(longjmp)
29 ldp x19, x20, [x0,#0]
30 ldp x21, x22, [x0,#16]
31 ldp x23, x24, [x0,#32]
32 ldp x25, x26, [x0,#48]
33 ldp x27, x28, [x0,#64]
34 ldp x29, x30, [x0,#80]
35 ldr x2, [x0,#96]
36 mov sp, x2
37 /* Move the return value in place, but return 1 if passed 0. */
38 adds x0, xzr, x1
39 csinc x0, x0, xzr, ne
40 ret
41ENDPROC(longjmp)
42.popsection