1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00

libthr _get_curthread amd64: quiet gcc -Warray-bounds

Use a constant input operand instead of a bogus memory reference to tell
the compiler about offsetof(struct tcb, tcb_thread) in the fs segment.
Otherwise gcc complains if we tell it we are reading memory offset 0x10.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45828
This commit is contained in:
Ryan Libby 2024-07-03 08:37:11 -07:00
parent 2730f42914
commit 657b1276ad

View File

@ -47,8 +47,8 @@ _get_curthread(void)
{
struct pthread *thr;
__asm __volatile("movq %%fs:%1, %0" : "=r" (thr)
: "m" (*(volatile u_long *)offsetof(struct tcb, tcb_thread)));
__asm __volatile("movq %%fs:%c1, %0" : "=r" (thr)
: "i" (offsetof(struct tcb, tcb_thread)));
return (thr);
}