Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Dec 2019 20:50:49 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355402 - head/lib/libc/riscv/gen
Message-ID:  <201912042050.xB4KonCp088817@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Dec  4 20:50:49 2019
New Revision: 355402
URL: https://svnweb.freebsd.org/changeset/base/355402

Log:
  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

Modified:
  head/lib/libc/riscv/gen/_setjmp.S
  head/lib/libc/riscv/gen/setjmp.S

Modified: head/lib/libc/riscv/gen/_setjmp.S
==============================================================================
--- head/lib/libc/riscv/gen/_setjmp.S	Wed Dec  4 20:18:12 2019	(r355401)
+++ head/lib/libc/riscv/gen/_setjmp.S	Wed Dec  4 20:50:49 2019	(r355402)
@@ -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 */

Modified: head/lib/libc/riscv/gen/setjmp.S
==============================================================================
--- head/lib/libc/riscv/gen/setjmp.S	Wed Dec  4 20:18:12 2019	(r355401)
+++ head/lib/libc/riscv/gen/setjmp.S	Wed Dec  4 20:50:49 2019	(r355402)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912042050.xB4KonCp088817>