Make _Thread_local work across platforms

We now rewrite the binary image at runtime on Windows and XNU to change
mov %fs:0,%reg instructions to use %gs instead. There's also simpler
threading API introduced by this change and it's called _spawn() and
_join(), which has replaced most clone() usage.
This commit is contained in:
Justine Tunney 2022-07-10 04:01:17 -07:00
parent e4d6e263d4
commit 5f4f6b0e69
51 changed files with 808 additions and 1043 deletions

View file

@ -43,7 +43,8 @@
*/
static uint64_t Rando(void) {
uint64_t x;
do x = lemur64();
do
x = lemur64();
while (((x ^ READ64LE("!!!!!!!!")) - 0x0101010101010101) &
~(x ^ READ64LE("!!!!!!!!")) & 0x8080808080808080);
return x;
@ -279,7 +280,7 @@ TEST(ksnprintf, testMisalignedPointer_wontFormat) {
TEST(ksnprintf, testUnterminatedOverrun_truncatesAtPageBoundary) {
char *m;
char b[32];
m = memset(mapanon(FRAMESIZE * 2), 1, FRAMESIZE);
m = memset(_mapanon(FRAMESIZE * 2), 1, FRAMESIZE);
EXPECT_SYS(0, 0, munmap(m + FRAMESIZE, FRAMESIZE));
EXPECT_EQ(12, ksnprintf(b, 32, "%'s", m + FRAMESIZE - 3));
EXPECT_STREQ("\\001\\001\\001", b);