Philipp Tomsich | b4806d6 | 2017-10-10 16:21:13 +0200 | [diff] [blame] | 1 | /* |
| 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" |
| 12 | ENTRY(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 |
| 22 | ENDPROC(setjmp) |
| 23 | .popsection |
| 24 | |
| 25 | .pushsection .text.longjmp, "ax" |
| 26 | ENTRY(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 |
| 34 | 1: |
| 35 | bx lr |
| 36 | ENDPROC(longjmp) |
| 37 | .popsection |