blob: 6746e5e2cc40bc8e6a4edea4523051bf019cdd57 [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/assembler.h>
9#include <linux/linkage.h>
10
11.pushsection .text.setjmp, "ax"
12ENTRY(setjmp)
13 /*
14 * A subroutine must preserve the contents of the registers
15 * r4-r8, r10, r11 (v1-v5, v7 and v8) and SP (and r9 in PCS
16 * variants that designate r9 as v6).
17 */
18 mov ip, sp
19 stm a1, {v1-v8, ip, lr}
20 mov a1, #0
21 bx lr
22ENDPROC(setjmp)
23.popsection
24
25.pushsection .text.longjmp, "ax"
26ENTRY(longjmp)
27 ldm a1, {v1-v8, ip, lr}
28 mov sp, ip
29 mov a1, a2
30 /* If we were passed a return value of zero, return one instead */
31 cmp a1, #0
32 bne 1f
33 mov a1, #1
341:
35 bx lr
36ENDPROC(longjmp)
37.popsection