diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-07-14 16:48:14 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-07-14 16:48:14 +0000 |
commit | aeb84d0d09322e445c37e4037207311fa7c7941d (patch) | |
tree | f877c83a36757b0fe9a7b19ae2466bafbe413743 /lib/libc/arch | |
parent | a1aefa45eb1fc75eaee170b69482223f5a408d1d (diff) |
Fix TIB/TCB on powerpc64. Some bright sould decided that the TCB should
be 8 bytes in the 64-bit ABI just like in the 32-bit ABI. But that means
there is no "spare" word in the TCB that we can use to store a pointer
to our struct pthread. So we have to treat powerpc64 special.
Also recognize that the thread pointer points 0x7000 bytes after the TCB.
Since the TCB is 8 bytes this means that TCB_OFFSET should be 0x7008.
Pointed out by guenther@; ok deraadt@
Diffstat (limited to 'lib/libc/arch')
-rw-r--r-- | lib/libc/arch/powerpc64/SYS.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/arch/powerpc64/SYS.h b/lib/libc/arch/powerpc64/SYS.h index 60a41e370c5..b239fffc8ea 100644 --- a/lib/libc/arch/powerpc64/SYS.h +++ b/lib/libc/arch/powerpc64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.2 2020/06/26 17:58:45 kettenis Exp $ */ +/* $OpenBSD: SYS.h,v 1.3 2020/07/14 16:48:13 kettenis Exp $ */ /*- * Copyright (c) 1994 * Andrew Cagney. All rights reserved. @@ -47,9 +47,9 @@ /* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */ -#define TCB_OFFSET_ERRNO (-12) +#define TCB_OFFSET_ERRNO (-20) /* from <powerpc64/tcb.h>: TCB address == %r13 - TCB_OFFSET */ -#define TCB_OFFSET 0x7000 +#define TCB_OFFSET 0x7008 /* offset of errno from %r13 */ #define R13_OFFSET_ERRNO (-TCB_OFFSET + TCB_OFFSET_ERRNO) |