Add ARCH_SET_* definitions for x86_64

This commit is contained in:
LemonBoy 2019-05-07 13:19:38 +02:00
parent b1db696c10
commit 043bd71621
2 changed files with 7 additions and 3 deletions

View File

@ -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 => {

View File

@ -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)