-/* $OpenBSD: _setjmp.S,v 1.1 2021/04/28 15:28:54 drahn Exp $ */
+/* $OpenBSD: _setjmp.S,v 1.2 2021/05/09 21:26:06 drahn Exp $ */
/*
* Copyright (c) 2020 Dale Rahn <drahn@openbsd.org>
*
addi sp, sp, -32
RETGUARD_SETUP(_setjmp, t6)
- sd sp, 8(a0)
+ sd sp, (1 * 8)(a0)
/* Store the general purpose registers and ra */
- sd s0, 16(a0)
- sd s1, 24(a0)
- sd s2, 32(a0)
- sd s3, 40(a0)
- sd s4, 48(a0)
- sd s5, 56(a0)
- sd s6, 64(a0)
- sd s7, 72(a0)
- sd s8, 90(a0)
- sd s9, 98(a0)
- sd s10, 106(a0)
- sd s11, 112(a0)
- sd ra, 120(a0)
+ sd s0, (2 * 8)(a0)
+ sd s1, (3 * 8)(a0)
+ sd s2, (4 * 8)(a0)
+ sd s3, (5 * 8)(a0)
+ sd s4, (6 * 8)(a0)
+ sd s5, (7 * 8)(a0)
+ sd s6, (8 * 8)(a0)
+ sd s7, (9 * 8)(a0)
+ sd s8, (10 * 8)(a0)
+ sd s9, (11 * 8)(a0)
+ sd s10, (12 * 8)(a0)
+ sd s11, (13 * 8)(a0)
+ sd ra, (14 * 8)(a0)
#ifndef _STANDALONE
/* Store the fp registers */
- fsd fs0, 128(a0)
- fsd fs1, 136(a0)
- fsd fs2, 144(a0)
- fsd fs3, 152(a0)
- fsd fs4, 160(a0)
- fsd fs5, 168(a0)
- fsd fs6, 176(a0)
- fsd fs7, 184(a0)
- fsd fs8, 192(a0)
- fsd fs9, 200(a0)
- fsd fs10, 208(a0)
- fsd fs11, 216(a0)
+ fsd fs0, (15 * 8)(a0)
+ fsd fs1, (16 * 8)(a0)
+ fsd fs2, (17 * 8)(a0)
+ fsd fs3, (18 * 8)(a0)
+ fsd fs4, (19 * 8)(a0)
+ fsd fs5, (20 * 8)(a0)
+ fsd fs6, (21 * 8)(a0)
+ fsd fs7, (22 * 8)(a0)
+ fsd fs8, (23 * 8)(a0)
+ fsd fs9, (24 * 8)(a0)
+ fsd fs10, (25 * 8)(a0)
+ fsd fs11, (26 * 8)(a0)
frcsr t0
- sd t0, 232(a0)
+ sd t0, (27 * 8)(a0)
#endif
/* Return value */
RETGUARD_LOAD_RANDOM(_longjmp, t6)
/* Restore the stack pointer */
- ld t0, 8(a0)
+ ld t0, (1 * 8)(a0)
mv sp, t0
/* Store the general purpose registers and ra */
- ld s0, 16(a0)
- ld s1, 24(a0)
- ld s2, 32(a0)
- ld s3, 40(a0)
- ld s4, 48(a0)
- ld s5, 56(a0)
- ld s6, 64(a0)
- ld s7, 72(a0)
- ld s8, 90(a0)
- ld s9, 98(a0)
- ld s10, 106(a0)
- ld s11, 112(a0)
- sd ra, 120(a0)
+ ld s0, (2 * 8)(a0)
+ ld s1, (3 * 8)(a0)
+ ld s2, (4 * 8)(a0)
+ ld s3, (5 * 8)(a0)
+ ld s4, (6 * 8)(a0)
+ ld s5, (7 * 8)(a0)
+ ld s6, (8 * 8)(a0)
+ ld s7, (9 * 8)(a0)
+ ld s8, (10 * 8)(a0)
+ ld s9, (11 * 8)(a0)
+ ld s10, (12 * 8)(a0)
+ ld s11, (13 * 8)(a0)
+ ld ra, (14 * 8)(a0)
#ifndef _STANDALONE
/* Store the fp registers */
- fld fs0, 128(a0)
- fld fs1, 136(a0)
- fld fs2, 144(a0)
- fld fs3, 152(a0)
- fld fs4, 160(a0)
- fld fs5, 168(a0)
- fld fs6, 176(a0)
- fld fs7, 184(a0)
- fld fs8, 192(a0)
- fld fs9, 200(a0)
- fld fs10, 208(a0)
- fld fs11, 216(a0)
- ld t0, 232(a0)
+ fld fs0, (15 * 8)(a0)
+ fld fs1, (16 * 8)(a0)
+ fld fs2, (17 * 8)(a0)
+ fld fs3, (18 * 8)(a0)
+ fld fs4, (19 * 8)(a0)
+ fld fs5, (20 * 8)(a0)
+ fld fs6, (21 * 8)(a0)
+ fld fs7, (22 * 8)(a0)
+ fld fs8, (23 * 8)(a0)
+ fld fs9, (24 * 8)(a0)
+ fld fs10, (25 * 8)(a0)
+ fld fs11, (26 * 8)(a0)
+ ld t0, (27 * 8)(a0)
fscsr t0
#endif
/* Load the return value */
- add a0, zero, 1
+ li a0, 1
beqz a1, 1f
mv a0, a1
1:
-/* $OpenBSD: setjmp.S,v 1.1 2021/04/28 15:28:54 drahn Exp $ */
+/* $OpenBSD: setjmp.S,v 1.2 2021/05/09 21:26:06 drahn Exp $ */
/*
* Copyright (c) 2020 Dale Rahn <drahn@openbsd.org>
*
ENTRY(setjmp)
RETGUARD_SETUP(setjmp, t6)
- mv a2, a0 /* save jmpbuf in x2 */
+ mv a2, a0 /* save jmpbuf in a2 */
/* Store the signal mask */
- mv a2, a0 /* set */
- mv a1, zero
- add a0, zero, 1
+ li a1, 0
+ li a0, 1
SYSTRAP(sigprocmask)
sw a0, (_JB_SIGMASK * 8)(a2) /* oset */
mv a0, a2
- sd sp, 8(a0)
+ sd sp, (1 * 8)(a0)
/* Store the general purpose registers and ra */
- sd s0, 16(a0)
- sd s1, 24(a0)
- sd s2, 32(a0)
- sd s3, 40(a0)
- sd s4, 48(a0)
- sd s5, 56(a0)
- sd s6, 64(a0)
- sd s7, 72(a0)
- sd s8, 90(a0)
- sd s9, 98(a0)
- sd s10, 106(a0)
- sd s11, 112(a0)
- sd ra, 120(a0)
+ sd s0, (2 * 8)(a0)
+ sd s1, (3 * 8)(a0)
+ sd s2, (4 * 8)(a0)
+ sd s3, (5 * 8)(a0)
+ sd s4, (6 * 8)(a0)
+ sd s5, (7 * 8)(a0)
+ sd s6, (8 * 8)(a0)
+ sd s7, (9 * 8)(a0)
+ sd s8, (10 * 8)(a0)
+ sd s9, (11 * 8)(a0)
+ sd s10, (12 * 8)(a0)
+ sd s11, (13 * 8)(a0)
+ sd ra, (14 * 8)(a0)
/* Store the fp registers */
- fsd fs0, 128(a0)
- fsd fs1, 136(a0)
- fsd fs2, 144(a0)
- fsd fs3, 152(a0)
- fsd fs4, 160(a0)
- fsd fs5, 168(a0)
- fsd fs6, 176(a0)
- fsd fs7, 184(a0)
- fsd fs8, 192(a0)
- fsd fs9, 200(a0)
- fsd fs10, 208(a0)
- fsd fs11, 216(a0)
+ fsd fs0, (15 * 8)(a0)
+ fsd fs1, (16 * 8)(a0)
+ fsd fs2, (17 * 8)(a0)
+ fsd fs3, (18 * 8)(a0)
+ fsd fs4, (19 * 8)(a0)
+ fsd fs5, (20 * 8)(a0)
+ fsd fs6, (21 * 8)(a0)
+ fsd fs7, (22 * 8)(a0)
+ fsd fs8, (23 * 8)(a0)
+ fsd fs9, (24 * 8)(a0)
+ fsd fs10, (25 * 8)(a0)
+ fsd fs11, (26 * 8)(a0)
frcsr t0
- sd t0, 232(a0)
+ sd t0, (27 * 8)(a0)
/* Return value */
- mv a0, zero
+ li a0, 0
RETGUARD_CHECK(setjmp, t6)
ret
/* Restore the signal mask */
lw a1, (_JB_SIGMASK * 8)(a2) /* set */
- add a0, zero, 3 /* SIG_SETMASK */
+ li a0, 3 /* SIG_SETMASK */
SYSTRAP(sigprocmask)
mv a0, a2
mv a1, a3
/* Restore the stack pointer */
- ld t0, 8(a0)
+ ld t0, (1 * 8)(a0)
mv sp, t0
/* Store the general purpose registers and ra */
- ld s0, 16(a0)
- ld s1, 24(a0)
- ld s2, 32(a0)
- ld s3, 40(a0)
- ld s4, 48(a0)
- ld s5, 56(a0)
- ld s6, 64(a0)
- ld s7, 72(a0)
- ld s8, 90(a0)
- ld s9, 98(a0)
- ld s10, 106(a0)
- ld s11, 112(a0)
- sd ra, 120(a0)
+ ld s0, (2 * 8)(a0)
+ ld s1, (3 * 8)(a0)
+ ld s2, (4 * 8)(a0)
+ ld s3, (5 * 8)(a0)
+ ld s4, (6 * 8)(a0)
+ ld s5, (7 * 8)(a0)
+ ld s6, (8 * 8)(a0)
+ ld s7, (9 * 8)(a0)
+ ld s8, (10 * 8)(a0)
+ ld s9, (11 * 8)(a0)
+ ld s10, (12 * 8)(a0)
+ ld s11, (13 * 8)(a0)
+ ld ra, (14 * 8)(a0)
/* Store the fp registers */
- fld fs0, 128(a0)
- fld fs1, 136(a0)
- fld fs2, 144(a0)
- fld fs3, 152(a0)
- fld fs4, 160(a0)
- fld fs5, 168(a0)
- fld fs6, 176(a0)
- fld fs7, 184(a0)
- fld fs8, 192(a0)
- fld fs9, 200(a0)
- fld fs10, 208(a0)
- fld fs11, 216(a0)
- ld t0, 232(a0)
+ fld fs0, (15 * 8)(a0)
+ fld fs1, (16 * 8)(a0)
+ fld fs2, (17 * 8)(a0)
+ fld fs3, (18 * 8)(a0)
+ fld fs4, (19 * 8)(a0)
+ fld fs5, (20 * 8)(a0)
+ fld fs6, (21 * 8)(a0)
+ fld fs7, (22 * 8)(a0)
+ fld fs8, (23 * 8)(a0)
+ fld fs9, (24 * 8)(a0)
+ fld fs10, (25 * 8)(a0)
+ fld fs11, (26 * 8)(a0)
+ ld t0, (27 * 8)(a0)
fscsr t0
/* Load the return value */
- add a0, zero, 1
+ li a0, 1
beqz a1, 1f
mv a0, a1
1:
-/* $OpenBSD: sigsetjmp.S,v 1.1 2021/04/28 15:28:54 drahn Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.2 2021/05/09 21:26:06 drahn Exp $ */
/*
* Copyright (c) 2020 Dale Rahn <drahn@openbsd.org>
*
ENTRY(sigsetjmp)
RETGUARD_SETUP(setjmp, t6)
- mv a2, a0 /* save jmpbuf in x2 */
+ mv a2, a0 /* save jmpbuf in a2 */
li a0, 0
beqz a1, 1f
/* Store the signal mask */
- mv a2, a0 /* set */
li a1, 0
li a0, 1 /* SIG_BLOCK */
SYSTRAP(sigprocmask)
sw a0, (_JB_SIGMASK * 8)(a2) /* oset */
mv a0, a2
- sd sp, 8(a0)
+ sd sp, (1 * 8)(a0)
/* Store the general purpose registers and ra */
- sd s0, 16(a0)
- sd s1, 24(a0)
- sd s2, 32(a0)
- sd s3, 40(a0)
- sd s4, 48(a0)
- sd s5, 56(a0)
- sd s6, 64(a0)
- sd s7, 72(a0)
- sd s8, 90(a0)
- sd s9, 98(a0)
- sd s10, 106(a0)
- sd s11, 112(a0)
- sd ra, 120(a0)
+ sd s0, (2 * 8)(a0)
+ sd s1, (3 * 8)(a0)
+ sd s2, (4 * 8)(a0)
+ sd s3, (5 * 8)(a0)
+ sd s4, (6 * 8)(a0)
+ sd s5, (7 * 8)(a0)
+ sd s6, (8 * 8)(a0)
+ sd s7, (9 * 8)(a0)
+ sd s8, (10 * 8)(a0)
+ sd s9, (11 * 8)(a0)
+ sd s10, (12 * 8)(a0)
+ sd s11, (13 * 8)(a0)
+ sd ra, (14 * 8)(a0)
/* Store the fp registers */
- fsd fs0, 128(a0)
- fsd fs1, 136(a0)
- fsd fs2, 144(a0)
- fsd fs3, 152(a0)
- fsd fs4, 160(a0)
- fsd fs5, 168(a0)
- fsd fs6, 176(a0)
- fsd fs7, 184(a0)
- fsd fs8, 192(a0)
- fsd fs9, 200(a0)
- fsd fs10, 208(a0)
- fsd fs11, 216(a0)
+ fsd fs0, (15 * 8)(a0)
+ fsd fs1, (16 * 8)(a0)
+ fsd fs2, (17 * 8)(a0)
+ fsd fs3, (18 * 8)(a0)
+ fsd fs4, (19 * 8)(a0)
+ fsd fs5, (20 * 8)(a0)
+ fsd fs6, (21 * 8)(a0)
+ fsd fs7, (22 * 8)(a0)
+ fsd fs8, (23 * 8)(a0)
+ fsd fs9, (24 * 8)(a0)
+ fsd fs10, (25 * 8)(a0)
+ fsd fs11, (26 * 8)(a0)
frcsr t0
- sd t0, 232(a0)
+ sd t0, (27 * 8)(a0)
/* Return value */
- mv a0, x0
+ li a0, 0
RETGUARD_CHECK(setjmp, t6)
ret
lw a1, (_JB_SIGMASK * 8)(a2) /* set */
beqz a1, 1f
- add a0, zero, 3 /* SIG_SETMASK */
+ li a0, 3 /* SIG_SETMASK */
SYSTRAP(sigprocmask)
1:
mv a1, a3
/* Restore the stack pointer */
- ld t0, 8(a0)
+ ld t0, (1 * 8)(a0)
mv sp, t0
/* Store the general purpose registers and ra */
- ld s0, 16(a0)
- ld s1, 24(a0)
- ld s2, 32(a0)
- ld s3, 40(a0)
- ld s4, 48(a0)
- ld s5, 56(a0)
- ld s6, 64(a0)
- ld s7, 72(a0)
- ld s8, 90(a0)
- ld s9, 98(a0)
- ld s10, 106(a0)
- ld s11, 112(a0)
- ld ra, 120(a0)
+ ld s0, (2 * 8)(a0)
+ ld s1, (3 * 8)(a0)
+ ld s2, (4 * 8)(a0)
+ ld s3, (5 * 8)(a0)
+ ld s4, (6 * 8)(a0)
+ ld s5, (7 * 8)(a0)
+ ld s6, (8 * 8)(a0)
+ ld s7, (9 * 8)(a0)
+ ld s8, (10 * 8)(a0)
+ ld s9, (11 * 8)(a0)
+ ld s10, (12 * 8)(a0)
+ ld s11, (13 * 8)(a0)
+ ld ra, (14 * 8)(a0)
/* Store the fp registers */
- fld fs0, 128(a0)
- fld fs1, 136(a0)
- fld fs2, 144(a0)
- fld fs3, 152(a0)
- fld fs4, 160(a0)
- fld fs5, 168(a0)
- fld fs6, 176(a0)
- fld fs7, 184(a0)
- fld fs8, 192(a0)
- fld fs9, 200(a0)
- fld fs10, 208(a0)
- fld fs11, 216(a0)
- ld t0, 232(a0)
+ fld fs0, (15 * 8)(a0)
+ fld fs1, (16 * 8)(a0)
+ fld fs2, (17 * 8)(a0)
+ fld fs3, (18 * 8)(a0)
+ fld fs4, (19 * 8)(a0)
+ fld fs5, (20 * 8)(a0)
+ fld fs6, (21 * 8)(a0)
+ fld fs7, (22 * 8)(a0)
+ fld fs8, (23 * 8)(a0)
+ fld fs9, (24 * 8)(a0)
+ fld fs10, (25 * 8)(a0)
+ fld fs11, (26 * 8)(a0)
+ ld t0, (27 * 8)(a0)
fscsr t0
/* Load the return value */
- add a0, zero, 1
+ li a0, 1
beqz a1, 1f
mv a0, a1
1:
-/* $OpenBSD: setjmp.h,v 1.1 2021/04/23 02:42:16 drahn Exp $ */
+/* $OpenBSD: setjmp.h,v 1.2 2021/05/09 21:26:06 drahn Exp $ */
/*
* machine/setjmp.h: machine dependent setjmp-related information.
*/
-#define _JBLEN 256 /* sp, ra, [f]s0-11, magic val, sigmask */
-#define _JB_SIGMASK 27
+#define _JBLEN 256 /* sp, ra, [f]s0-11, fscr, magic val, sigmask */
+#define _JB_SIGMASK 28