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