Commit d3241680 authored by Stefan Lankes's avatar Stefan Lankes

use llvm_asm instead of asm to support the latest nightly compiler

parent 12d37e17
Pipeline #315020 failed with stages
in 2 minutes and 51 seconds
......@@ -2,9 +2,9 @@
# It is not intended for manual editing.
[[package]]
name = "autocfg"
version = "0.1.7"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
[[package]]
name = "bit_field"
......@@ -20,9 +20,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "cc"
version = "1.0.48"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f52a465a666ca3d838ebbf08b241383421412fe7ebb463527bba275526d89f76"
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
[[package]]
name = "eduos-rs"
......@@ -35,18 +35,18 @@ dependencies = [
[[package]]
name = "num-traits"
version = "0.2.10"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4"
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
dependencies = [
"autocfg",
]
[[package]]
name = "raw-cpuid"
version = "7.0.3"
version = "8.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf"
checksum = "0cee2c7710d96f9f90f56824fca5438b301dc0fb49ece4cf9dfa044e54067e10"
dependencies = [
"bitflags",
"cc",
......@@ -79,9 +79,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "x86"
version = "0.28.0"
version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f705f7554f555fa2d0fea9e3b53f5fd8b4b67270f48aac96a4146a19b5bf7db1"
checksum = "c146cbc47471e076987378c159a7aa8fa434680c6fbddca59fe6f40f1591c819"
dependencies = [
"bit_field",
"bitflags",
......
......@@ -8,7 +8,7 @@ authors = ["Stefan Lankes <slankes@eonerc.rwth-aachen.de>"]
bitflags = "1.0"
[target.'cfg(target_arch = "x86_64")'.dependencies.x86]
version = "0.28.*"
version = "0.34.*"
[dependencies.num-traits]
version = "0.2"
......
......@@ -24,19 +24,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;
}
......
......@@ -44,7 +44,7 @@ pub fn register_task() {
let sel: u16 = 6u16 << 3;
unsafe {
asm!("ltr $0" :: "r"(sel) :: "volatile");
llvm_asm!("ltr $0" :: "r"(sel) :: "volatile");
}
}
......@@ -58,7 +58,7 @@ pub fn jump_to_user_land(func: extern "C" fn() -> !) -> ! {
let stack = USER_ENTRY + 4 * 1024 * 1024;
unsafe {
asm!("swapgs; mov $0, %ds; mov $0, %es; push $0; push $3; pushfq; push $1; push $2; iretq"
llvm_asm!("swapgs; mov $0, %ds; mov $0, %es; push $0; push $3; pushfq; push $1; push $2; iretq"
:: "r"(ds), "r"(cs), "r"(entry as u64), "r"(stack)
:: "volatile");
}
......@@ -139,7 +139,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
}
......@@ -149,7 +149,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
......@@ -160,7 +160,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
......@@ -171,7 +171,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
......@@ -182,7 +182,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");
}
......@@ -194,7 +194,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");
}
......@@ -214,7 +214,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");
}
......
......@@ -26,7 +26,7 @@ static mut SUPPORTS_1GIB_PAGES: bool = false;
#[inline(always)]
pub fn mb() {
unsafe {
asm!("mfence" ::: "memory" : "volatile");
llvm_asm!("mfence" ::: "memory" : "volatile");
}
}
......@@ -36,7 +36,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 {
......@@ -50,7 +50,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 {
......@@ -61,14 +61,14 @@ pub fn lsb(value: u64) -> Option<u64> {
#[inline(always)]
pub fn halt() {
unsafe {
asm!("hlt" :::: "volatile");
llvm_asm!("hlt" :::: "volatile");
}
}
#[inline(always)]
pub fn pause() {
unsafe {
asm!("pause" :::: "volatile");
llvm_asm!("pause" :::: "volatile");
}
}
......@@ -171,7 +171,7 @@ pub fn init() {
// reset GS registers
wrmsr(IA32_GS_BASE, 0);
asm!("wrgsbase $0" :: "r"(BOOT_STACK.top()) :: "volatile");
llvm_asm!("wrgsbase $0" :: "r"(BOOT_STACK.top()) :: "volatile");
}
// determin processor features
......
......@@ -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_rsp => 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\
......
......@@ -238,7 +238,7 @@ impl<S: PageSize> Page<S> {
#[inline(always)]
fn flush_from_tlb(&self) {
unsafe {
asm!("invlpg ($0)" :: "r"(self.virtual_address) : "memory" : "volatile");
llvm_asm!("invlpg ($0)" :: "r"(self.virtual_address) : "memory" : "volatile");
}
}
......
#![feature(asm, const_fn, lang_items)]
#![feature(llvm_asm, const_fn, lang_items)]
#![feature(allocator_api)]
#![feature(panic_info_message)]
#![feature(naked_functions)]
......
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