3 * Alexander Graf <agraf@suse.de>
5 * SPDX-License-Identifier: GPL-2.0+
17 typedef struct jmp_buf_data jmp_buf[1];
19 static inline int setjmp(jmp_buf jmp)
25 "adr x1, jmp_target\n"
32 : "=m" (jmp->target), "=m" (jmp->regs[0]),
33 "=m" (jmp->regs[2]), "=m" (jmp->regs[4])
35 : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
36 "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
37 "x16", "x17", "x18", "x19", "x20", "x21", "x22",
38 "x23", "x24", "x25", /* x26, x27, x28, x29, sp */
39 "x30", "cc", "memory");
42 #ifdef CONFIG_SYS_THUMB_BUILD
44 "adr r0, jmp_target\n"
47 "adr r0, jmp_target\n"
51 "stm r1!, {r0, r2, r4, r5, r6, r7}\n"
56 : "r0", "r1", "r2", "r3", /* "r4", "r5", "r6", "r7", */
57 "r8", "r9", "r10", "r11", /* sp, */ "ip", "lr",
64 static inline __noreturn void longjmp(jmp_buf jmp, int ret)
78 : "m" (jmp->target), "m" (jmp->regs[0]), "m" (jmp->regs[2]),
80 : "x0", "x1", "x25", "x26", "x27", "x28");
84 "ldm r1!, {r0, r2, r4, r5, r6, r7}\n"
96 #endif /* _SETJMP_H_ */