authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-04-11 18:40:08+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-04-11 21:26:22+02:00
log9bebdc77d66369fc7cf6c1de7c9559fdd0c2c561
tree8424becb7c39e99cba10a20f0231125096fbef7c
parentd97981f6fd4e98506404de4259230dc157cc50dd

std: Fix TLS definitions for 32bit PowerPC targets

Correct some silly errors and add the missing piece to set the thread pointer (r2).

1 files changed, 9 insertions(+), 2 deletions(-)

lib/std/os/linux/tls.zig+9-2
...@@ -69,7 +69,7 @@ const tls_tcb_size = switch (builtin.arch) {...@@ -69,7 +69,7 @@ const tls_tcb_size = switch (builtin.arch) {
6969
70// Controls if the TP points to the end of the TCB instead of its beginning70// Controls if the TP points to the end of the TCB instead of its beginning
71const tls_tp_points_past_tcb = switch (builtin.arch) {71const tls_tp_points_past_tcb = switch (builtin.arch) {
72 .riscv32, .riscv64, .mips, .mipsel, .powerpc64, .powerpc64le => true,72 .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => true,
73 else => false,73 else => false,
74};74};
7575
...@@ -165,7 +165,14 @@ pub fn setThreadPointer(addr: usize) void {...@@ -165,7 +165,14 @@ pub fn setThreadPointer(addr: usize) void {
165 const rc = std.os.linux.syscall1(.set_thread_area, addr);165 const rc = std.os.linux.syscall1(.set_thread_area, addr);
166 assert(rc == 0);166 assert(rc == 0);
167 },167 },
168 .powerpc, .powerpc64, .powerpc64le => {168 .powerpc => {
169 asm volatile (
170 \\ mr 2, %[addr]
171 :
172 : [addr] "r" (addr)
173 );
174 },
175 .powerpc64, .powerpc64le => {
169 asm volatile (176 asm volatile (
170 \\ mr 13, %[addr]177 \\ mr 13, %[addr]
171 :178 :