Commit 85f7ef2b authored by Stefan Lankes's avatar Stefan Lankes

use llvm_asm instead of asm to support the latest nightly compiler

parent d2520739
Pipeline #315022 failed with stages
in 1 minute and 56 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 = "cfg-if"
......@@ -54,18 +54,18 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.8"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
"cfg-if",
]
[[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",
]
......@@ -96,9 +96,9 @@ dependencies = [
[[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",
......@@ -175,9 +175,9 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[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",
......
......@@ -13,7 +13,7 @@ spin = "0.5"
#features = ["spin_no_std"]
[target.'cfg(target_arch = "x86_64")'.dependencies.x86]
version = "0.28.0"
version = "0.34.*"
default-features = false
[dependencies.goblin]
......
......@@ -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;
}
......
......@@ -61,7 +61,7 @@ pub fn register_task() {
let sel: u16 = 6u16 << 3;
unsafe {
asm!("ltr $0" :: "r"(sel) :: "volatile");
llvm_asm!("ltr $0" :: "r"(sel) :: "volatile");
}
}
......@@ -75,7 +75,7 @@ pub fn jump_to_user_land(entry: u64) -> ! {
debug!("Set user space stack to 0x{:x}", stack);
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");
}
......@@ -156,7 +156,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
}
......@@ -166,7 +166,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
......@@ -177,7 +177,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
......@@ -188,7 +188,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
......@@ -199,7 +199,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");
}
......@@ -211,7 +211,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");
}
......@@ -231,7 +231,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)]
......
......@@ -13,7 +13,7 @@ use scheduler::*;
pub unsafe extern "C" fn sys_invalid() {
let mut rax: i64 = 0;
asm!("push %rax; pop $0" : "=r"(rax));
llvm_asm!("push %rax; pop $0" : "=r"(rax));
error!("Invalid syscall {}", rax);
do_exit();
......
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