std: Fix TLS definitions for 32bit PowerPC targets

Correct some silly errors and add the missing piece to set the thread
pointer (r2).
This commit is contained in:
LemonBoy 2021-04-11 18:40:08 +02:00
parent d97981f6fd
commit 9bebdc77d6

View File

@ -69,7 +69,7 @@ const tls_tcb_size = switch (builtin.arch) {
// Controls if the TP points to the end of the TCB instead of its beginning
const tls_tp_points_past_tcb = switch (builtin.arch) {
.riscv32, .riscv64, .mips, .mipsel, .powerpc64, .powerpc64le => true,
.riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => true,
else => false,
};
@ -165,7 +165,14 @@ pub fn setThreadPointer(addr: usize) void {
const rc = std.os.linux.syscall1(.set_thread_area, addr);
assert(rc == 0);
},
.powerpc, .powerpc64, .powerpc64le => {
.powerpc => {
asm volatile (
\\ mr 2, %[addr]
:
: [addr] "r" (addr)
);
},
.powerpc64, .powerpc64le => {
asm volatile (
\\ mr 13, %[addr]
: