Commit 8cbbd215 authored by Stefan Lankes's avatar Stefan Lankes

use llvm_asm instead of asm to support the latest nightly compiler

parent edb3c415
Pipeline #315021 failed with stages
in 2 minutes and 52 seconds
......@@ -4,71 +4,69 @@
name = "bit_field"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a165d606cf084741d4ac3a28fb6e9b1eb0bd31f6cd999098cfddb0b2ab381dc0"
[[package]]
name = "bitflags"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "cc"
version = "1.0.46"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
[[package]]
name = "eduos-rs"
version = "0.1.0"
dependencies = [
"x86 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
"x86",
]
[[package]]
name = "raw-cpuid"
version = "7.0.3"
version = "8.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cee2c7710d96f9f90f56824fca5438b301dc0fb49ece4cf9dfa044e54067e10"
dependencies = [
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags",
"cc",
"rustc_version",
]
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"semver",
]
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"semver-parser",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "x86"
version = "0.24.0"
version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c146cbc47471e076987378c159a7aa8fa434680c6fbddca59fe6f40f1591c819"
dependencies = [
"bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bit_field",
"bitflags",
"raw-cpuid",
]
[metadata]
"checksum bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a165d606cf084741d4ac3a28fb6e9b1eb0bd31f6cd999098cfddb0b2ab381dc0"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c"
"checksum raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum x86 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0ccb9e004394bf7b12fc2f279f09e0a20e31741efb84a94d25a7866549a4fea"
......@@ -5,7 +5,7 @@ license = "MIT/Apache-2.0"
authors = ["Stefan Lankes <slankes@eonerc.rwth-aachen.de>"]
[target.'cfg(target_arch = "x86_64")'.dependencies.x86]
version = "0.24.*"
version = "0.34.*"
default-features = false
# The development profile, used for `cargo build`.
......
......@@ -23,19 +23,19 @@ const KERNEL_CODE_SELECTOR: SegmentSelector = SegmentSelector::new(1, Ring::Ring
/// Enable Interrupts
pub fn irq_enable() {
unsafe { asm!("sti" ::: "memory" : "volatile") };
unsafe { llvm_asm!("sti" ::: "memory" : "volatile") };
}
/// Disable Interrupts
pub fn irq_disable() {
unsafe { asm!("cli" ::: "memory" : "volatile") };
unsafe { llvm_asm!("cli" ::: "memory" : "volatile") };
}
/// Determines, if the interrupt flags (IF) is set
pub fn is_irq_enabled() -> bool {
let rflags: u64;
unsafe { asm!("pushf; pop $0": "=r"(rflags) :: "memory" : "volatile") };
unsafe { llvm_asm!("pushf; pop $0": "=r"(rflags) :: "memory" : "volatile") };
if (rflags & (1u64 << 9)) != 0 {
return true;
}
......
......@@ -14,7 +14,7 @@ pub fn register_task() {
let sel: u16 = 6u16 << 3;
unsafe {
asm!("ltr $0" :: "r"(sel) :: "volatile");
llvm_asm!("ltr $0" :: "r"(sel) :: "volatile");
}
}
......@@ -25,7 +25,7 @@ pub fn jump_to_user_land(func: fn() -> !) -> ! {
let cs = 0x2bu64;
unsafe {
asm!("mov $0, %ds; mov $0, %es; push $0; push %rsp; addq $$16, (%rsp); pushfq; push $1; push $2; iretq"
llvm_asm!("mov $0, %ds; mov $0, %es; push $0; push %rsp; addq $$16, (%rsp); pushfq; push $1; push $2; iretq"
:: "r"(ds), "r"(cs), "r"(func as u64)
:: "volatile");
}
......@@ -105,7 +105,7 @@ macro_rules! syscall {
pub fn syscall0(arg0: u64) -> u64 {
let mut ret: u64;
unsafe {
asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0) : "rcx", "r11", "memory" : "volatile");
llvm_asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0) : "rcx", "r11", "memory" : "volatile");
}
ret
}
......@@ -115,7 +115,7 @@ pub fn syscall0(arg0: u64) -> u64 {
pub fn syscall1(arg0: u64, arg1: u64) -> u64 {
let mut ret: u64;
unsafe {
asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0), "{rdi}" (arg1)
llvm_asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0), "{rdi}" (arg1)
: "rcx", "r11", "memory" : "volatile");
}
ret
......@@ -126,7 +126,7 @@ pub fn syscall1(arg0: u64, arg1: u64) -> u64 {
pub fn syscall2(arg0: u64, arg1: u64, arg2: u64) -> u64 {
let mut ret: u64;
unsafe {
asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0), "{rdi}" (arg1), "{rsi}" (arg2)
llvm_asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0), "{rdi}" (arg1), "{rsi}" (arg2)
: "rcx", "r11", "memory" : "volatile");
}
ret
......@@ -137,7 +137,7 @@ pub fn syscall2(arg0: u64, arg1: u64, arg2: u64) -> u64 {
pub fn syscall3(arg0: u64, arg1: u64, arg2: u64, arg3: u64) -> u64 {
let mut ret: u64;
unsafe {
asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0), "{rdi}" (arg1), "{rsi}" (arg2),
llvm_asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0), "{rdi}" (arg1), "{rsi}" (arg2),
"{rdx}" (arg3) : "rcx", "r11", "memory" : "volatile");
}
ret
......@@ -148,7 +148,7 @@ pub fn syscall3(arg0: u64, arg1: u64, arg2: u64, arg3: u64) -> u64 {
pub fn syscall4(arg0: u64, arg1: u64, arg2: u64, arg3: u64, arg4: u64) -> u64 {
let mut ret: u64;
unsafe {
asm!("syscall" : "={rax}" (ret)
llvm_asm!("syscall" : "={rax}" (ret)
: "{rax}" (arg0), "{rdi}" (arg1), "{rsi}" (arg2), "{rdx}" (arg3),
"{r10}" (arg4) : "rcx", "r11", "memory" : "volatile");
}
......@@ -160,7 +160,7 @@ pub fn syscall4(arg0: u64, arg1: u64, arg2: u64, arg3: u64, arg4: u64) -> u64 {
pub fn syscall5(arg0: u64, arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64) -> u64 {
let mut ret: u64;
unsafe {
asm!("syscall" : "={rax}" (ret)
llvm_asm!("syscall" : "={rax}" (ret)
: "{rax}" (arg0), "{rdi}" (arg1), "{rsi}" (arg2), "{rdx}" (arg3),
"{r10}" (arg4), "{r8}" (arg5) : "rcx", "r11", "memory" : "volatile");
}
......@@ -180,7 +180,7 @@ pub fn syscall6(
) -> u64 {
let mut ret: u64;
unsafe {
asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0), "{rdi}" (arg1), "{rsi}" (arg2),
llvm_asm!("syscall" : "={rax}" (ret) : "{rax}" (arg0), "{rdi}" (arg1), "{rsi}" (arg2),
"{rdx}" (arg3), "{r10}" (arg4), "{r8}" (arg5), "{r9}" (arg6)
: "rcx", "r11", "memory" : "volatile");
}
......
......@@ -21,7 +21,7 @@ const EFER_TCE: u64 = (1 << 15);
#[inline(always)]
pub fn mb() {
unsafe {
asm!("mfence" ::: "memory" : "volatile");
llvm_asm!("mfence" ::: "memory" : "volatile");
}
}
......@@ -31,7 +31,7 @@ pub fn msb(value: u64) -> Option<u64> {
if value > 0 {
let ret: u64;
unsafe {
asm!("bsr $1, $0" : "=r"(ret) : "r"(value) : "cc" : "volatile");
llvm_asm!("bsr $1, $0" : "=r"(ret) : "r"(value) : "cc" : "volatile");
}
Some(ret)
} else {
......@@ -45,7 +45,7 @@ pub fn lsb(value: u64) -> Option<u64> {
if value > 0 {
let ret: u64;
unsafe {
asm!("bsf $1, $0" : "=r"(ret) : "r"(value) : "cc" : "volatile");
llvm_asm!("bsf $1, $0" : "=r"(ret) : "r"(value) : "cc" : "volatile");
}
Some(ret)
} else {
......@@ -55,13 +55,13 @@ pub fn lsb(value: u64) -> Option<u64> {
pub fn halt() {
unsafe {
asm!("hlt" :::: "volatile");
llvm_asm!("hlt" :::: "volatile");
}
}
pub fn pause() {
unsafe {
asm!("pause" :::: "volatile");
llvm_asm!("pause" :::: "volatile");
}
}
......
......@@ -16,7 +16,7 @@ extern "C" {
#[naked]
pub unsafe extern "C" fn _start() {
// be sure that rsp is a valid stack pointer
asm!("mov $0, %rsp" :: "r"(BOOT_STACK.top()) :: "volatile");
llvm_asm!("mov $0, %rsp" :: "r"(BOOT_STACK.top()) :: "volatile");
main();
......
......@@ -12,7 +12,7 @@ pub extern "C" fn switch(_old_stack: *mut usize, _new_stack: usize) {
// rsi = new_stack => stack pointer of the new task
unsafe {
asm!(
llvm_asm!(
// store context
"pushfq\n\t\
push %rax\n\t\
......
......@@ -8,7 +8,7 @@
#[no_mangle]
#[naked]
pub unsafe extern "C" fn syscall_handler() {
asm!(
llvm_asm!(
// save context, see x86_64 ABI
"push %rcx\n\t\
push %rdx\n\t\
......
#![feature(asm, const_fn, lang_items)]
#![feature(llvm_asm, const_fn, lang_items)]
#![feature(allocator_api)]
#![feature(naked_functions)]
#![feature(abi_x86_interrupt)]
......
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