From 934df5bd448e7e27f2142d0d9ceec534f391c7f5 Mon Sep 17 00:00:00 2001 From: N00byEdge Date: Fri, 30 Jul 2021 19:04:18 +0200 Subject: [PATCH] Make linux syscalls accessible with non-Linux target OS --- lib/std/os/linux/arm-eabi.zig | 1 + lib/std/os/linux/arm64.zig | 1 + lib/std/os/linux/i386.zig | 1 + lib/std/os/linux/mips.zig | 1 + lib/std/os/linux/powerpc.zig | 1 + lib/std/os/linux/powerpc64.zig | 1 + lib/std/os/linux/riscv64.zig | 1 + lib/std/os/linux/sparc64.zig | 1 + lib/std/os/linux/thumb.zig | 1 + lib/std/os/linux/x86_64.zig | 1 + 10 files changed, 10 insertions(+) diff --git a/lib/std/os/linux/arm-eabi.zig b/lib/std/os/linux/arm-eabi.zig index bac7048615add41114c4abfab98193893e4d07d6..0fe74c966520aa7b899b7871250f90e17cd8c503 100644 --- a/lib/std/os/linux/arm-eabi.zig +++ b/lib/std/os/linux/arm-eabi.zig @@ -4,6 +4,7 @@ // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall0(number: SYS) usize { return asm volatile ("svc #0" diff --git a/lib/std/os/linux/arm64.zig b/lib/std/os/linux/arm64.zig index dd5c3ef3af67c61cd63ae701f8c29176c5dd8e70..0e1af984934435aa53fe9d38df41aa3f03b8ce93 100644 --- a/lib/std/os/linux/arm64.zig +++ b/lib/std/os/linux/arm64.zig @@ -4,6 +4,7 @@ // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall0(number: SYS) usize { return asm volatile ("svc #0" diff --git a/lib/std/os/linux/i386.zig b/lib/std/os/linux/i386.zig index c1ac6938fb3a61d0af17a2033b75d586d2842965..df58336eb0da87694c789e0c77fcbfb930fef84c 100644 --- a/lib/std/os/linux/i386.zig +++ b/lib/std/os/linux/i386.zig @@ -4,6 +4,7 @@ // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall0(number: SYS) usize { return asm volatile ("int $0x80" diff --git a/lib/std/os/linux/mips.zig b/lib/std/os/linux/mips.zig index a04a592f3bde308480c3660b21167581f242e85d..2ac029cae8283e3673e79390097dce8d0f5d65a3 100644 --- a/lib/std/os/linux/mips.zig +++ b/lib/std/os/linux/mips.zig @@ -4,6 +4,7 @@ // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall0(number: SYS) usize { return asm volatile ( diff --git a/lib/std/os/linux/powerpc.zig b/lib/std/os/linux/powerpc.zig index 567ad2bc1fe737bdac129c8b2aaced12a18198c1..341eb3f920a775f10791d5b13b4e016fa4b3a58b 100644 --- a/lib/std/os/linux/powerpc.zig +++ b/lib/std/os/linux/powerpc.zig @@ -5,6 +5,7 @@ // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall0(number: SYS) usize { return asm volatile ( diff --git a/lib/std/os/linux/powerpc64.zig b/lib/std/os/linux/powerpc64.zig index 567ad2bc1fe737bdac129c8b2aaced12a18198c1..341eb3f920a775f10791d5b13b4e016fa4b3a58b 100644 --- a/lib/std/os/linux/powerpc64.zig +++ b/lib/std/os/linux/powerpc64.zig @@ -5,6 +5,7 @@ // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall0(number: SYS) usize { return asm volatile ( diff --git a/lib/std/os/linux/riscv64.zig b/lib/std/os/linux/riscv64.zig index d58e0804076157e767cefb8a51c5596aa99ff69d..cab2ecfbafd973a96e9399f2411d9974eb3d9bf0 100644 --- a/lib/std/os/linux/riscv64.zig +++ b/lib/std/os/linux/riscv64.zig @@ -4,6 +4,7 @@ // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall0(number: SYS) usize { return asm volatile ("ecall" diff --git a/lib/std/os/linux/sparc64.zig b/lib/std/os/linux/sparc64.zig index 902940071e1df86da8510adb60cd4bb3848d3a6f..cbe5ee3b704658ccc199c762e52d4921e809b13d 100644 --- a/lib/std/os/linux/sparc64.zig +++ b/lib/std/os/linux/sparc64.zig @@ -1,4 +1,5 @@ usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall_pipe(fd: *[2]i32) usize { return asm volatile ( diff --git a/lib/std/os/linux/thumb.zig b/lib/std/os/linux/thumb.zig index 5db9d2cbf4c0cec1a6b34c820ad5ae9631609d69..955c3420d431d589cf5f04113a9226a17dcb4b05 100644 --- a/lib/std/os/linux/thumb.zig +++ b/lib/std/os/linux/thumb.zig @@ -4,6 +4,7 @@ // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); // The syscall interface is identical to the ARM one but we're facing an extra // challenge: r7, the register where the syscall number is stored, may be diff --git a/lib/std/os/linux/x86_64.zig b/lib/std/os/linux/x86_64.zig index b9b3ff47ebccc72e9a597c2e3b1d82808352366f..da4206a521354c4bc16247b340dab90ebbdeffd5 100644 --- a/lib/std/os/linux/x86_64.zig +++ b/lib/std/os/linux/x86_64.zig @@ -4,6 +4,7 @@ // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. usingnamespace @import("../bits.zig"); +usingnamespace @import("../bits/linux.zig"); pub fn syscall0(number: SYS) usize { return asm volatile ("syscall" -- 2.54.0