mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 12:27:41 +00:00
Add ARCH_SET_* definitions for x86_64
This commit is contained in:
parent
b1db696c10
commit
043bd71621
@ -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 => {
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user