Author: jhb Date: Thu Feb 6 21:46:15 2020 New Revision: 357643 URL: https://svnweb.freebsd.org/changeset/base/357643
Log: Tidy the _set_tp function for RISC-V. - Use a constant for the offset instead of a magic number. - Use an addi instruction that writes to tp directly instead of a mv that writes the result of a compiler-generated addi. Reviewed by: mhorne MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D23521 Modified: head/lib/libc/riscv/gen/_set_tp.c Modified: head/lib/libc/riscv/gen/_set_tp.c ============================================================================== --- head/lib/libc/riscv/gen/_set_tp.c Thu Feb 6 21:01:19 2020 (r357642) +++ head/lib/libc/riscv/gen/_set_tp.c Thu Feb 6 21:46:15 2020 (r357643) @@ -38,13 +38,14 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <sys/types.h> -#include <machine/sysarch.h> - #include <stdlib.h> +/* NB: size of 'struct tcb'. */ +#define TP_OFFSET (sizeof(void *) * 2) + void _set_tp(void *tp) { - __asm __volatile("mv tp, %0" :: "r"((char*)tp + 0x10)); + __asm __volatile("addi tp, %0, %1" :: "r" (tp), "I" (TP_OFFSET)); } _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"