Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2018 09:54:28 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336633 - in head: lib/libc/riscv/gen sys/riscv/include
Message-ID:  <201807230954.w6N9sSe5081280@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: br
Date: Mon Jul 23 09:54:28 2018
New Revision: 336633
URL: https://svnweb.freebsd.org/changeset/base/336633

Log:
  Fix setjmp for RISC-V:
  o The correct value for _JB_SIGMASK is 27.
  o The storage size for double-precision floating
    point register is 8 bytes.
  
  Submitted by:	"James Clarke" <jrtc4@cam.ac.uk>
  Reviewed by:	markj@
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D16344

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

Modified: head/lib/libc/riscv/gen/_setjmp.S
==============================================================================
--- head/lib/libc/riscv/gen/_setjmp.S	Mon Jul 23 09:16:23 2018	(r336632)
+++ head/lib/libc/riscv/gen/_setjmp.S	Mon Jul 23 09:54:28 2018	(r336633)
@@ -63,19 +63,19 @@ ENTRY(_setjmp)
 
 #if !defined(_STANDALONE) && defined(__riscv_float_abi_double)
 	/* Store the fpe registers */
-	fsd	fs0, (0 * 16)(a0)
-	fsd	fs1, (1 * 16)(a0)
-	fsd	fs2, (2 * 16)(a0)
-	fsd	fs3, (3 * 16)(a0)
-	fsd	fs4, (4 * 16)(a0)
-	fsd	fs5, (5 * 16)(a0)
-	fsd	fs6, (6 * 16)(a0)
-	fsd	fs7, (7 * 16)(a0)
-	fsd	fs8, (8 * 16)(a0)
-	fsd	fs9, (9 * 16)(a0)
-	fsd	fs10, (10 * 16)(a0)
-	fsd	fs11, (11 * 16)(a0)
-	addi	a0, a0, (12 * 16)
+	fsd	fs0, (0 * 8)(a0)
+	fsd	fs1, (1 * 8)(a0)
+	fsd	fs2, (2 * 8)(a0)
+	fsd	fs3, (3 * 8)(a0)
+	fsd	fs4, (4 * 8)(a0)
+	fsd	fs5, (5 * 8)(a0)
+	fsd	fs6, (6 * 8)(a0)
+	fsd	fs7, (7 * 8)(a0)
+	fsd	fs8, (8 * 8)(a0)
+	fsd	fs9, (9 * 8)(a0)
+	fsd	fs10, (10 * 8)(a0)
+	fsd	fs11, (11 * 8)(a0)
+	addi	a0, a0, (12 * 8)
 #endif
 
 	/* Return value */
@@ -116,19 +116,19 @@ ENTRY(_longjmp)
 
 #if !defined(_STANDALONE) && defined(__riscv_float_abi_double)
 	/* Restore the fpe registers */
-	fld	fs0, (0 * 16)(a0)
-	fld	fs1, (1 * 16)(a0)
-	fld	fs2, (2 * 16)(a0)
-	fld	fs3, (3 * 16)(a0)
-	fld	fs4, (4 * 16)(a0)
-	fld	fs5, (5 * 16)(a0)
-	fld	fs6, (6 * 16)(a0)
-	fld	fs7, (7 * 16)(a0)
-	fld	fs8, (8 * 16)(a0)
-	fld	fs9, (9 * 16)(a0)
-	fld	fs10, (10 * 16)(a0)
-	fld	fs11, (11 * 16)(a0)
-	addi	a0, a0, (12 * 16)
+	fld	fs0, (0 * 8)(a0)
+	fld	fs1, (1 * 8)(a0)
+	fld	fs2, (2 * 8)(a0)
+	fld	fs3, (3 * 8)(a0)
+	fld	fs4, (4 * 8)(a0)
+	fld	fs5, (5 * 8)(a0)
+	fld	fs6, (6 * 8)(a0)
+	fld	fs7, (7 * 8)(a0)
+	fld	fs8, (8 * 8)(a0)
+	fld	fs9, (9 * 8)(a0)
+	fld	fs10, (10 * 8)(a0)
+	fld	fs11, (11 * 8)(a0)
+	addi	a0, a0, (12 * 8)
 #endif
 
 	/* Load the return value */

Modified: head/lib/libc/riscv/gen/setjmp.S
==============================================================================
--- head/lib/libc/riscv/gen/setjmp.S	Mon Jul 23 09:16:23 2018	(r336632)
+++ head/lib/libc/riscv/gen/setjmp.S	Mon Jul 23 09:54:28 2018	(r336633)
@@ -77,19 +77,19 @@ ENTRY(setjmp)
 
 #ifdef __riscv_float_abi_double
 	/* Store the fpe registers */
-	fsd	fs0, (0 * 16)(a0)
-	fsd	fs1, (1 * 16)(a0)
-	fsd	fs2, (2 * 16)(a0)
-	fsd	fs3, (3 * 16)(a0)
-	fsd	fs4, (4 * 16)(a0)
-	fsd	fs5, (5 * 16)(a0)
-	fsd	fs6, (6 * 16)(a0)
-	fsd	fs7, (7 * 16)(a0)
-	fsd	fs8, (8 * 16)(a0)
-	fsd	fs9, (9 * 16)(a0)
-	fsd	fs10, (10 * 16)(a0)
-	fsd	fs11, (11 * 16)(a0)
-	addi	a0, a0, (12 * 16)
+	fsd	fs0, (0 * 8)(a0)
+	fsd	fs1, (1 * 8)(a0)
+	fsd	fs2, (2 * 8)(a0)
+	fsd	fs3, (3 * 8)(a0)
+	fsd	fs4, (4 * 8)(a0)
+	fsd	fs5, (5 * 8)(a0)
+	fsd	fs6, (6 * 8)(a0)
+	fsd	fs7, (7 * 8)(a0)
+	fsd	fs8, (8 * 8)(a0)
+	fsd	fs9, (9 * 8)(a0)
+	fsd	fs10, (10 * 8)(a0)
+	fsd	fs11, (11 * 8)(a0)
+	addi	a0, a0, (12 * 8)
 #endif
 
 	/* Return value */
@@ -146,19 +146,19 @@ ENTRY(longjmp)
 
 #ifdef __riscv_float_abi_double
 	/* Restore the fpe registers */
-	fld	fs0, (0 * 16)(a0)
-	fld	fs1, (1 * 16)(a0)
-	fld	fs2, (2 * 16)(a0)
-	fld	fs3, (3 * 16)(a0)
-	fld	fs4, (4 * 16)(a0)
-	fld	fs5, (5 * 16)(a0)
-	fld	fs6, (6 * 16)(a0)
-	fld	fs7, (7 * 16)(a0)
-	fld	fs8, (8 * 16)(a0)
-	fld	fs9, (9 * 16)(a0)
-	fld	fs10, (10 * 16)(a0)
-	fld	fs11, (11 * 16)(a0)
-	addi	a0, a0, (12 * 16)
+	fld	fs0, (0 * 8)(a0)
+	fld	fs1, (1 * 8)(a0)
+	fld	fs2, (2 * 8)(a0)
+	fld	fs3, (3 * 8)(a0)
+	fld	fs4, (4 * 8)(a0)
+	fld	fs5, (5 * 8)(a0)
+	fld	fs6, (6 * 8)(a0)
+	fld	fs7, (7 * 8)(a0)
+	fld	fs8, (8 * 8)(a0)
+	fld	fs9, (9 * 8)(a0)
+	fld	fs10, (10 * 8)(a0)
+	fld	fs11, (11 * 8)(a0)
+	addi	a0, a0, (12 * 8)
 #endif
 
 	/* Load the return value */

Modified: head/sys/riscv/include/setjmp.h
==============================================================================
--- head/sys/riscv/include/setjmp.h	Mon Jul 23 09:16:23 2018	(r336632)
+++ head/sys/riscv/include/setjmp.h	Mon Jul 23 09:54:28 2018	(r336633)
@@ -40,7 +40,7 @@
 #include <sys/cdefs.h>
 
 #define	_JBLEN		63	/* sp, ra, [f]s0-11, magic val, sigmask */
-#define	_JB_SIGMASK	21
+#define	_JB_SIGMASK	27
 
 #ifdef	__ASSEMBLER__
 #define	_JB_MAGIC__SETJMP	0xbe87fd8a2910af00



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