mirror of
https://github.com/ziglang/zig.git
synced 2025-12-23 14:43:17 +00:00
Make linux syscalls accessible with non-Linux target OS
This commit is contained in:
parent
b465037a65
commit
934df5bd44
@ -4,6 +4,7 @@
|
|||||||
// The MIT license requires this copyright notice to be included in all copies
|
// The MIT license requires this copyright notice to be included in all copies
|
||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) usize {
|
pub fn syscall0(number: SYS) usize {
|
||||||
return asm volatile ("svc #0"
|
return asm volatile ("svc #0"
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
// The MIT license requires this copyright notice to be included in all copies
|
// The MIT license requires this copyright notice to be included in all copies
|
||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) usize {
|
pub fn syscall0(number: SYS) usize {
|
||||||
return asm volatile ("svc #0"
|
return asm volatile ("svc #0"
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
// The MIT license requires this copyright notice to be included in all copies
|
// The MIT license requires this copyright notice to be included in all copies
|
||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) usize {
|
pub fn syscall0(number: SYS) usize {
|
||||||
return asm volatile ("int $0x80"
|
return asm volatile ("int $0x80"
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
// The MIT license requires this copyright notice to be included in all copies
|
// The MIT license requires this copyright notice to be included in all copies
|
||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) usize {
|
pub fn syscall0(number: SYS) usize {
|
||||||
return asm volatile (
|
return asm volatile (
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
|
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) usize {
|
pub fn syscall0(number: SYS) usize {
|
||||||
return asm volatile (
|
return asm volatile (
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
|
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) usize {
|
pub fn syscall0(number: SYS) usize {
|
||||||
return asm volatile (
|
return asm volatile (
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
// The MIT license requires this copyright notice to be included in all copies
|
// The MIT license requires this copyright notice to be included in all copies
|
||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) usize {
|
pub fn syscall0(number: SYS) usize {
|
||||||
return asm volatile ("ecall"
|
return asm volatile ("ecall"
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall_pipe(fd: *[2]i32) usize {
|
pub fn syscall_pipe(fd: *[2]i32) usize {
|
||||||
return asm volatile (
|
return asm volatile (
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
// The MIT license requires this copyright notice to be included in all copies
|
// The MIT license requires this copyright notice to be included in all copies
|
||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
// The syscall interface is identical to the ARM one but we're facing an extra
|
// 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
|
// challenge: r7, the register where the syscall number is stored, may be
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
// The MIT license requires this copyright notice to be included in all copies
|
// The MIT license requires this copyright notice to be included in all copies
|
||||||
// and substantial portions of the software.
|
// and substantial portions of the software.
|
||||||
usingnamespace @import("../bits.zig");
|
usingnamespace @import("../bits.zig");
|
||||||
|
usingnamespace @import("../bits/linux.zig");
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) usize {
|
pub fn syscall0(number: SYS) usize {
|
||||||
return asm volatile ("syscall"
|
return asm volatile ("syscall"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user