authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-07 13:19:38+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-07 13:19:38+02:00
log043bd716210b0233f1bc0bb90a8fb063cd63d0b8
treebcdd994a11bcef3e1b3a679e31159141bb0275fd
parentb1db696c10f3895d59d26ddfb4f2ef7a6e7384fb

Add ARCH_SET_* definitions for x86_64


2 files changed, 7 insertions(+), 3 deletions(-)

std/os/linux/tls.zig+2-3
......@@ -109,9 +109,8 @@ pub var tls_image: ?TLSImage = null;
109109pub fn setThreadPointer(addr: usize) void {
110110 switch (builtin.arch) {
111111 .x86_64 => {
112 const ARCH_SET_FS = 0x1002;
113 const rc = std.os.linux.syscall2(std.os.linux.SYS_arch_prctl, ARCH_SET_FS, addr);
114 // arch_prctl is documented to never fail
112 const rc = std.os.linux.syscall2(std.os.linux.SYS_arch_prctl,
113 std.os.linux.ARCH_SET_FS, addr);
115114 assert(rc == 0);
116115 },
117116 .aarch64 => {
std/os/linux/x86_64.zig+5
......@@ -388,6 +388,11 @@ pub const VDSO_CGT_VER = "LINUX_2.6";
388388pub const VDSO_GETCPU_SYM = "__vdso_getcpu";
389389pub const VDSO_GETCPU_VER = "LINUX_2.6";
390390
391pub const ARCH_SET_GS = 0x1001;
392pub const ARCH_SET_FS = 0x1002;
393pub const ARCH_GET_FS = 0x1003;
394pub const ARCH_GET_GS = 0x1004;
395
391396pub fn syscall0(number: usize) usize {
392397 return asm volatile ("syscall"
393398 : [ret] "={rax}" (-> usize)