std.os.linux.tls: Add loongarch support.

This commit is contained in:
Alex Rønne Petersen 2024-07-23 07:27:17 +02:00
parent 44d4656dfc
commit 9db992bd9b
No known key found for this signature in database

View File

@ -70,6 +70,8 @@ const current_variant: Variant = switch (native_arch) {
.thumb,
.thumbeb,
=> .I_original,
.loongarch32,
.loongarch64,
.m68k,
.mips,
.mipsel,
@ -243,6 +245,13 @@ pub fn setThreadPointer(addr: usize) void {
const rc = linux.syscall1(.set_thread_area, addr);
assert(rc == 0);
},
.loongarch32, .loongarch64 => {
asm volatile (
\\ mv tp, %[addr]
:
: [addr] "r" (addr),
);
},
.riscv32, .riscv64 => {
asm volatile (
\\ mv tp, %[addr]