authorgravatar for hannesbredberg@gmail.comN00byEdge <hannesbredberg@gmail.com> 2021-07-30 19:04:18+02:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-08-02 11:05:05+00:00
log934df5bd448e7e27f2142d0d9ceec534f391c7f5
treebc6609f7fe68c2e946dfcf6c7a0f5337544e6c72
parentb465037a65dd6a31c5865086ec4392a1d3a372bc

Make linux syscalls accessible with non-Linux target OS


10 files changed, 10 insertions(+), 0 deletions(-)

lib/std/os/linux/arm-eabi.zig+1
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6usingnamespace @import("../bits.zig");6usingnamespace @import("../bits.zig");
7usingnamespace @import("../bits/linux.zig");
78
8pub fn syscall0(number: SYS) usize {9pub fn syscall0(number: SYS) usize {
9 return asm volatile ("svc #0"10 return asm volatile ("svc #0"
lib/std/os/linux/arm64.zig+1
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6usingnamespace @import("../bits.zig");6usingnamespace @import("../bits.zig");
7usingnamespace @import("../bits/linux.zig");
78
8pub fn syscall0(number: SYS) usize {9pub fn syscall0(number: SYS) usize {
9 return asm volatile ("svc #0"10 return asm volatile ("svc #0"
lib/std/os/linux/i386.zig+1
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6usingnamespace @import("../bits.zig");6usingnamespace @import("../bits.zig");
7usingnamespace @import("../bits/linux.zig");
78
8pub fn syscall0(number: SYS) usize {9pub fn syscall0(number: SYS) usize {
9 return asm volatile ("int $0x80"10 return asm volatile ("int $0x80"
lib/std/os/linux/mips.zig+1
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6usingnamespace @import("../bits.zig");6usingnamespace @import("../bits.zig");
7usingnamespace @import("../bits/linux.zig");
78
8pub fn syscall0(number: SYS) usize {9pub fn syscall0(number: SYS) usize {
9 return asm volatile (10 return asm volatile (
lib/std/os/linux/powerpc.zig+1
...@@ -5,6 +5,7 @@...@@ -5,6 +5,7 @@
5// and substantial portions of the software.5// and substantial portions of the software.
66
7usingnamespace @import("../bits.zig");7usingnamespace @import("../bits.zig");
8usingnamespace @import("../bits/linux.zig");
89
9pub fn syscall0(number: SYS) usize {10pub fn syscall0(number: SYS) usize {
10 return asm volatile (11 return asm volatile (
lib/std/os/linux/powerpc64.zig+1
...@@ -5,6 +5,7 @@...@@ -5,6 +5,7 @@
5// and substantial portions of the software.5// and substantial portions of the software.
66
7usingnamespace @import("../bits.zig");7usingnamespace @import("../bits.zig");
8usingnamespace @import("../bits/linux.zig");
89
9pub fn syscall0(number: SYS) usize {10pub fn syscall0(number: SYS) usize {
10 return asm volatile (11 return asm volatile (
lib/std/os/linux/riscv64.zig+1
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6usingnamespace @import("../bits.zig");6usingnamespace @import("../bits.zig");
7usingnamespace @import("../bits/linux.zig");
78
8pub fn syscall0(number: SYS) usize {9pub fn syscall0(number: SYS) usize {
9 return asm volatile ("ecall"10 return asm volatile ("ecall"
lib/std/os/linux/sparc64.zig+1
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1usingnamespace @import("../bits.zig");1usingnamespace @import("../bits.zig");
2usingnamespace @import("../bits/linux.zig");
23
3pub fn syscall_pipe(fd: *[2]i32) usize {4pub fn syscall_pipe(fd: *[2]i32) usize {
4 return asm volatile (5 return asm volatile (
lib/std/os/linux/thumb.zig+1
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6usingnamespace @import("../bits.zig");6usingnamespace @import("../bits.zig");
7usingnamespace @import("../bits/linux.zig");
78
8// The syscall interface is identical to the ARM one but we're facing an extra9// The syscall interface is identical to the ARM one but we're facing an extra
9// challenge: r7, the register where the syscall number is stored, may be10// challenge: r7, the register where the syscall number is stored, may be
lib/std/os/linux/x86_64.zig+1
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6usingnamespace @import("../bits.zig");6usingnamespace @import("../bits.zig");
7usingnamespace @import("../bits/linux.zig");
78
8pub fn syscall0(number: SYS) usize {9pub fn syscall0(number: SYS) usize {
9 return asm volatile ("syscall"10 return asm volatile ("syscall"