aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/riscv
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2019-12-04 20:50:49 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2019-12-04 20:50:49 +0000
commitc0acb84da7794df4d2eb004980b33cca10f46cd4 (patch)
treea878009e6a1656fb9aee6d865c4164ab6e7d0321 /lib/libc/riscv
parent3487d66820b758b67aaa167e88a2440ee0d36d04 (diff)
downloadsrc-c0acb84da7794df4d2eb004980b33cca10f46cd4.tar.gz
src-c0acb84da7794df4d2eb004980b33cca10f46cd4.zip
Use a single 'ld' to read the jmpbuf magic values instead of 'la; ld'.
This saves an instruction in each case as well as an extra memory indirection via the GOT for PIC code. Reviewed by: br, James Clarke Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22656
Notes
Notes: svn path=/head/; revision=355402
Diffstat (limited to 'lib/libc/riscv')
-rw-r--r--lib/libc/riscv/gen/_setjmp.S6
-rw-r--r--lib/libc/riscv/gen/setjmp.S6
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/libc/riscv/gen/_setjmp.S b/lib/libc/riscv/gen/_setjmp.S
index afb94e2dd3fc..ded6705ef7ee 100644
--- a/lib/libc/riscv/gen/_setjmp.S
+++ b/lib/libc/riscv/gen/_setjmp.S
@@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$");
ENTRY(_setjmp)
/* Store the magic value and stack pointer */
- la t0, .Lmagic
- ld t0, 0(t0)
+ ld t0, .Lmagic
sd t0, (0 * 8)(a0)
sd sp, (1 * 8)(a0)
addi a0, a0, (2 * 8)
@@ -89,8 +88,7 @@ END(_setjmp)
ENTRY(_longjmp)
/* Check the magic value */
ld t0, 0(a0)
- la t1, .Lmagic
- ld t1, 0(t1)
+ ld t1, .Lmagic
bne t0, t1, botch
/* Restore the stack pointer */
diff --git a/lib/libc/riscv/gen/setjmp.S b/lib/libc/riscv/gen/setjmp.S
index 229ccb2c40ef..09bdb914c2cd 100644
--- a/lib/libc/riscv/gen/setjmp.S
+++ b/lib/libc/riscv/gen/setjmp.S
@@ -53,8 +53,7 @@ ENTRY(setjmp)
addi sp, sp, (2 * 8)
/* Store the magic value and stack pointer */
- la t0, .Lmagic
- ld t0, 0(t0)
+ ld t0, .Lmagic
sd t0, (0 * 8)(a0)
sd sp, (1 * 8)(a0)
addi a0, a0, (2 * 8)
@@ -119,8 +118,7 @@ ENTRY(longjmp)
/* Check the magic value */
ld t0, 0(a0)
- la t1, .Lmagic
- ld t1, 0(t1)
+ ld t1, .Lmagic
bne t0, t1, botch
/* Restore the stack pointer */