Commit d1836626 authored by Jeremy Soller's avatar Jeremy Soller

Merge branch 'aj-0.2.0' into 'master'

Merge rename-to-llvm-asm into master; bump to 0.2.0

See merge request !54
parents c4ddf3ff af890302
Pipeline #8119 failed with stages
in 52 seconds
[package]
name = "redox_syscall"
version = "0.1.56"
version = "0.2.0"
description = "A Rust library to access raw Redox system calls"
license = "MIT"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
......
use super::error::{Error, Result};
pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
asm!("svc 0"
llvm_asm!("svc 0"
: "={x0}"(a)
: "{x8}"(a)
: "x0", "x8"
......@@ -11,7 +11,7 @@ pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
}
pub unsafe fn syscall1(mut a: usize, b: usize) -> Result<usize> {
asm!("svc 0"
llvm_asm!("svc 0"
: "={x0}"(a)
: "{x8}"(a), "{x0}"(b)
: "x0", "x8"
......@@ -22,7 +22,7 @@ pub unsafe fn syscall1(mut a: usize, b: usize) -> Result<usize> {
// Clobbers all registers - special for clone
pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
asm!("svc 0"
llvm_asm!("svc 0"
: "={x0}"(a)
: "{x8}"(a), "{x0}"(b)
: "memory",
......@@ -36,7 +36,7 @@ pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
}
pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
asm!("svc 0"
llvm_asm!("svc 0"
: "={x0}"(a)
: "{x8}"(a), "{x0}"(b), "{x1}"(c)
: "x0", "x1", "x8"
......@@ -46,7 +46,7 @@ pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
}
pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result<usize> {
asm!("svc 0"
llvm_asm!("svc 0"
: "={x0}"(a)
: "{x8}"(a), "{x0}"(b), "{x1}"(c), "{x2}"(d)
: "x0", "x1", "x2", "x8"
......@@ -56,7 +56,7 @@ pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result<usi
}
pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) -> Result<usize> {
asm!("svc 0"
llvm_asm!("svc 0"
: "={x0}"(a)
: "{x8}"(a), "{x0}"(b), "{x1}"(c), "{x2}"(d), "{x3}"(e)
: "x0", "x1", "x2", "x3", "x8"
......@@ -67,7 +67,7 @@ pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) ->
pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
-> Result<usize> {
asm!("svc 0"
llvm_asm!("svc 0"
: "={x0}"(a)
: "{x8}"(a), "{x0}"(b), "{x1}"(c), "{x2}"(d), "{x3}"(e), "{x4}"(f)
: "x0", "x1", "x2", "x3", "x4", "x8"
......
use super::error::{Error, Result};
pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
asm!("swi $$0"
llvm_asm!("swi $$0"
: "={r0}"(a)
: "{r7}"(a)
: "memory"
......@@ -11,7 +11,7 @@ pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
}
pub unsafe fn syscall1(mut a: usize, b: usize) -> Result<usize> {
asm!("swi $$0"
llvm_asm!("swi $$0"
: "={r0}"(a)
: "{r7}"(a), "{r0}"(b)
: "memory"
......@@ -22,7 +22,7 @@ pub unsafe fn syscall1(mut a: usize, b: usize) -> Result<usize> {
// Clobbers all registers - special for clone
pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
asm!("swi $$0"
llvm_asm!("swi $$0"
: "={r0}"(a)
: "{r7}"(a), "{r0}"(b)
: "memory", "r0", "r1", "r2", "r3", "r4"
......@@ -32,7 +32,7 @@ pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
}
pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
asm!("swi $$0"
llvm_asm!("swi $$0"
: "={r0}"(a)
: "{r7}"(a), "{r0}"(b), "{r1}"(c)
: "memory"
......@@ -42,7 +42,7 @@ pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
}
pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result<usize> {
asm!("swi $$0"
llvm_asm!("swi $$0"
: "={r0}"(a)
: "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d)
: "memory"
......@@ -52,7 +52,7 @@ pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result<usi
}
pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) -> Result<usize> {
asm!("swi $$0"
llvm_asm!("swi $$0"
: "={r0}"(a)
: "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d), "{r3}"(e)
: "memory"
......@@ -63,7 +63,7 @@ pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) ->
pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
-> Result<usize> {
asm!("swi $$0"
llvm_asm!("swi $$0"
: "={r0}"(a)
: "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d), "{r3}"(e), "{r4}"(f)
: "memory"
......
use super::error::{Error, Result};
pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
asm!("int 0x80"
llvm_asm!("int 0x80"
: "={eax}"(a)
: "{eax}"(a)
: "memory"
......@@ -11,7 +11,7 @@ pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
}
pub unsafe fn syscall1(mut a: usize, b: usize) -> Result<usize> {
asm!("int 0x80"
llvm_asm!("int 0x80"
: "={eax}"(a)
: "{eax}"(a), "{ebx}"(b)
: "memory"
......@@ -22,7 +22,7 @@ pub unsafe fn syscall1(mut a: usize, b: usize) -> Result<usize> {
// Clobbers all registers - special for clone
pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
asm!("int 0x80"
llvm_asm!("int 0x80"
: "={eax}"(a)
: "{eax}"(a), "{ebx}"(b)
: "memory", "ebx", "ecx", "edx", "esi", "edi"
......@@ -32,7 +32,7 @@ pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
}
pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
asm!("int 0x80"
llvm_asm!("int 0x80"
: "={eax}"(a)
: "{eax}"(a), "{ebx}"(b), "{ecx}"(c)
: "memory"
......@@ -42,7 +42,7 @@ pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
}
pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result<usize> {
asm!("int 0x80"
llvm_asm!("int 0x80"
: "={eax}"(a)
: "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d)
: "memory"
......@@ -52,7 +52,7 @@ pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result<usi
}
pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) -> Result<usize> {
asm!("int 0x80"
llvm_asm!("int 0x80"
: "={eax}"(a)
: "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d), "{esi}"(e)
: "memory"
......@@ -63,7 +63,7 @@ pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) ->
pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
-> Result<usize> {
asm!("int 0x80"
llvm_asm!("int 0x80"
: "={eax}"(a)
: "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d), "{esi}"(e), "{edi}"(f)
: "memory"
......
use super::error::{Error, Result};
pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
asm!("syscall"
llvm_asm!("syscall"
: "={rax}"(a)
: "{rax}"(a)
: "rcx", "r11", "memory"
......@@ -11,7 +11,7 @@ pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
}
pub unsafe fn syscall1(mut a: usize, b: usize) -> Result<usize> {
asm!("syscall"
llvm_asm!("syscall"
: "={rax}"(a)
: "{rax}"(a), "{rdi}"(b)
: "rcx", "r11", "memory"
......@@ -22,7 +22,7 @@ pub unsafe fn syscall1(mut a: usize, b: usize) -> Result<usize> {
// Clobbers all registers - special for clone
pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
asm!("syscall"
llvm_asm!("syscall"
: "={rax}"(a)
: "{rax}"(a), "{rdi}"(b)
: "memory", "rbx", "rcx", "rdx", "rsi", "rdi", "r8",
......@@ -33,7 +33,7 @@ pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
}
pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
asm!("syscall"
llvm_asm!("syscall"
: "={rax}"(a)
: "{rax}"(a), "{rdi}"(b), "{rsi}"(c)
: "rcx", "r11", "memory"
......@@ -43,7 +43,7 @@ pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
}
pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result<usize> {
asm!("syscall"
llvm_asm!("syscall"
: "={rax}"(a)
: "{rax}"(a), "{rdi}"(b), "{rsi}"(c), "{rdx}"(d)
: "rcx", "r11", "memory"
......@@ -53,7 +53,7 @@ pub unsafe fn syscall3(mut a: usize, b: usize, c: usize, d: usize) -> Result<usi
}
pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) -> Result<usize> {
asm!("syscall"
llvm_asm!("syscall"
: "={rax}"(a)
: "{rax}"(a), "{rdi}"(b), "{rsi}"(c), "{rdx}"(d), "{r10}"(e)
: "rcx", "r11", "memory"
......@@ -64,7 +64,7 @@ pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) ->
pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
-> Result<usize> {
asm!("syscall"
llvm_asm!("syscall"
: "={rax}"(a)
: "{rax}"(a), "{rdi}"(b), "{rsi}"(c), "{rdx}"(d), "{r10}"(e), "{r8}"(f)
: "rcx", "r11", "memory"
......
......@@ -28,7 +28,7 @@ impl Io for Pio<u8> {
fn read(&self) -> u8 {
let value: u8;
unsafe {
asm!("in $0, $1" : "={al}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
llvm_asm!("in $0, $1" : "={al}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
}
value
}
......@@ -37,7 +37,7 @@ impl Io for Pio<u8> {
#[inline(always)]
fn write(&mut self, value: u8) {
unsafe {
asm!("out $1, $0" : : "{al}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
llvm_asm!("out $1, $0" : : "{al}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
}
}
}
......@@ -51,7 +51,7 @@ impl Io for Pio<u16> {
fn read(&self) -> u16 {
let value: u16;
unsafe {
asm!("in $0, $1" : "={ax}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
llvm_asm!("in $0, $1" : "={ax}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
}
value
}
......@@ -60,7 +60,7 @@ impl Io for Pio<u16> {
#[inline(always)]
fn write(&mut self, value: u16) {
unsafe {
asm!("out $1, $0" : : "{ax}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
llvm_asm!("out $1, $0" : : "{ax}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
}
}
}
......@@ -74,7 +74,7 @@ impl Io for Pio<u32> {
fn read(&self) -> u32 {
let value: u32;
unsafe {
asm!("in $0, $1" : "={eax}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
llvm_asm!("in $0, $1" : "={eax}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
}
value
}
......@@ -83,7 +83,7 @@ impl Io for Pio<u32> {
#[inline(always)]
fn write(&mut self, value: u32) {
unsafe {
asm!("out $1, $0" : : "{eax}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
llvm_asm!("out $1, $0" : : "{eax}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
}
}
}
#![feature(asm)]
#![feature(llvm_asm)]
#![feature(const_fn)] // see https://github.com/rust-lang/rfcs/pull/2632
#![cfg_attr(not(test), no_std)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment