Commit 043bd71621

LemonBoy <thatlemon@gmail.com>
2019-05-07 13:19:38
Add ARCH_SET_* definitions for x86_64
1 parent b1db696
Changed files (2)
std
std/os/linux/tls.zig
@@ -109,9 +109,8 @@ pub var tls_image: ?TLSImage = null;
 pub fn setThreadPointer(addr: usize) void {
     switch (builtin.arch) {
         .x86_64 => {
-            const ARCH_SET_FS = 0x1002;
-            const rc = std.os.linux.syscall2(std.os.linux.SYS_arch_prctl, ARCH_SET_FS, addr);
-            // arch_prctl is documented to never fail
+            const rc = std.os.linux.syscall2(std.os.linux.SYS_arch_prctl,
+                                             std.os.linux.ARCH_SET_FS, addr);
             assert(rc == 0);
         },
         .aarch64 => {
std/os/linux/x86_64.zig
@@ -388,6 +388,11 @@ pub const VDSO_CGT_VER = "LINUX_2.6";
 pub const VDSO_GETCPU_SYM = "__vdso_getcpu";
 pub const VDSO_GETCPU_VER = "LINUX_2.6";
 
+pub const ARCH_SET_GS = 0x1001;
+pub const ARCH_SET_FS = 0x1002;
+pub const ARCH_GET_FS = 0x1003;
+pub const ARCH_GET_GS = 0x1004;
+
 pub fn syscall0(number: usize) usize {
     return asm volatile ("syscall"
         : [ret] "={rax}" (-> usize)