zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 043bd716210b0233f1bc0bb90a8fb063cd63d0b8 (tree)
parent b1db696c10f3895d59d26ddfb4f2ef7a6e7384fb
Author: LemonBoy <thatlemon@gmail.com>
Date:   Tue,  7 May 2019 13:19:38 +0200

Add ARCH_SET_* definitions for x86_64

Diffstat:
Mstd/os/linux/tls.zig | 5++---
Mstd/os/linux/x86_64.zig | 5+++++
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/std/os/linux/tls.zig b/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 => { diff --git a/std/os/linux/x86_64.zig b/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)