Switch to new Rust inline asm! syntax

pull/66/head
Andre Richter 4 years ago
parent a1c2729f19
commit cfc3bfc996
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -16,11 +16,11 @@ global_asm!(include_str!("cpu.S"));
pub fn wait_forever() -> ! {
unsafe {
loop {
llvm_asm!("wfe"
: // outputs
: // inputs
: // clobbers
: "volatile") // options
#[rustfmt::skip]
asm!(
"wfe",
options(nomem, nostack, preserves_flags)
);
}
}
}

@ -92,8 +92,8 @@
//! - `crate::memory::*`
//! - `crate::bsp::memory::*`
#![feature(asm)]
#![feature(global_asm)]
#![feature(llvm_asm)]
#![no_main]
#![no_std]

@ -16,11 +16,11 @@ global_asm!(include_str!("cpu.S"));
pub fn wait_forever() -> ! {
unsafe {
loop {
llvm_asm!("wfe"
: // outputs
: // inputs
: // clobbers
: "volatile") // options
#[rustfmt::skip]
asm!(
"wfe",
options(nomem, nostack, preserves_flags)
);
}
}
}

@ -92,8 +92,8 @@
//! - `crate::memory::*`
//! - `crate::bsp::memory::*`
#![feature(asm)]
#![feature(global_asm)]
#![feature(llvm_asm)]
#![no_main]
#![no_std]

@ -139,13 +139,12 @@ diff -uNr 02_runtime_init/src/console.rs 03_hacky_hello_world/src/console.rs
diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs
--- 02_runtime_init/src/main.rs
+++ 03_hacky_hello_world/src/main.rs
@@ -92,8 +92,10 @@
//! - `crate::memory::*`
@@ -93,7 +93,9 @@
//! - `crate::bsp::memory::*`
#![feature(asm)]
+#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(llvm_asm)]
+#![feature(panic_info_message)]
#![no_main]
#![no_std]

@ -16,11 +16,11 @@ global_asm!(include_str!("cpu.S"));
pub fn wait_forever() -> ! {
unsafe {
loop {
llvm_asm!("wfe"
: // outputs
: // inputs
: // clobbers
: "volatile") // options
#[rustfmt::skip]
asm!(
"wfe",
options(nomem, nostack, preserves_flags)
);
}
}
}

@ -92,9 +92,9 @@
//! - `crate::memory::*`
//! - `crate::bsp::memory::*`
#![feature(asm)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(llvm_asm)]
#![feature(panic_info_message)]
#![no_main]
#![no_std]

@ -100,11 +100,11 @@ diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu.rs 04_zero_overhead_abstrac
pub fn wait_forever() -> ! {
- unsafe {
- loop {
- llvm_asm!("wfe"
- : // outputs
- : // inputs
- : // clobbers
- : "volatile") // options
- #[rustfmt::skip]
- asm!(
- "wfe",
- options(nomem, nostack, preserves_flags)
- );
- }
+ loop {
+ asm::wfe()
@ -194,12 +194,13 @@ diff -uNr 03_hacky_hello_world/src/cpu.rs 04_zero_overhead_abstraction/src/cpu.r
diff -uNr 03_hacky_hello_world/src/main.rs 04_zero_overhead_abstraction/src/main.rs
--- 03_hacky_hello_world/src/main.rs
+++ 04_zero_overhead_abstraction/src/main.rs
@@ -93,8 +93,7 @@
@@ -92,9 +92,8 @@
//! - `crate::memory::*`
//! - `crate::bsp::memory::*`
-#![feature(asm)]
#![feature(format_args_nl)]
-#![feature(global_asm)]
-#![feature(llvm_asm)]
+#![feature(naked_functions)]
#![feature(panic_info_message)]
#![no_main]

@ -826,11 +826,11 @@ diff -uNr 13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 14_e
+/// - Changes the HW state of the executing core.
+#[inline(always)]
+pub unsafe fn local_irq_unmask() {
+ llvm_asm!("msr DAIFClr, $0"
+ : // outputs
+ : "i"(daif_bits::IRQ) // inputs
+ : // clobbers
+ : "volatile" // options
+ #[rustfmt::skip]
+ asm!(
+ "msr DAIFClr, {arg}",
+ arg = const daif_bits::IRQ,
+ options(nomem, nostack, preserves_flags)
+ );
+}
+
@ -841,11 +841,11 @@ diff -uNr 13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 14_e
+/// - Changes the HW state of the executing core.
+#[inline(always)]
+pub unsafe fn local_irq_mask() {
+ llvm_asm!("msr DAIFSet, $0"
+ : // outputs
+ : "i"(daif_bits::IRQ) // inputs
+ : // clobbers
+ : "volatile" // options
+ #[rustfmt::skip]
+ asm!(
+ "msr DAIFSet, {arg}",
+ arg = const daif_bits::IRQ,
+ options(nomem, nostack, preserves_flags)
+ );
+}
+
@ -2568,10 +2568,11 @@ diff -uNr 13_integrated_testing/src/lib.rs 14_exceptions_part2_peripheral_IRQs/s
//! [timer interface]: ../libkernel/time/interface/trait.TimeManager.html
//!
//! # Code organization and architecture
@@ -107,11 +112,15 @@
@@ -107,8 +112,12 @@
//! - `crate::bsp::memory::*`
#![allow(incomplete_features)]
+#![feature(asm)]
+#![feature(const_fn)]
#![feature(const_generics)]
-#![feature(custom_inner_attributes)]
@ -2581,10 +2582,6 @@ diff -uNr 13_integrated_testing/src/lib.rs 14_exceptions_part2_peripheral_IRQs/s
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(linkage)]
+#![feature(llvm_asm)]
#![feature(naked_functions)]
#![feature(panic_info_message)]
#![feature(slice_ptr_range)]
@@ -137,6 +146,7 @@
pub mod exception;
pub mod memory;

@ -77,11 +77,11 @@ pub fn is_local_irq_masked() -> bool {
/// - Changes the HW state of the executing core.
#[inline(always)]
pub unsafe fn local_irq_unmask() {
llvm_asm!("msr DAIFClr, $0"
: // outputs
: "i"(daif_bits::IRQ) // inputs
: // clobbers
: "volatile" // options
#[rustfmt::skip]
asm!(
"msr DAIFClr, {arg}",
arg = const daif_bits::IRQ,
options(nomem, nostack, preserves_flags)
);
}
@ -92,11 +92,11 @@ pub unsafe fn local_irq_unmask() {
/// - Changes the HW state of the executing core.
#[inline(always)]
pub unsafe fn local_irq_mask() {
llvm_asm!("msr DAIFSet, $0"
: // outputs
: "i"(daif_bits::IRQ) // inputs
: // clobbers
: "volatile" // options
#[rustfmt::skip]
asm!(
"msr DAIFSet, {arg}",
arg = const daif_bits::IRQ,
options(nomem, nostack, preserves_flags)
);
}

@ -112,6 +112,7 @@
//! - `crate::bsp::memory::*`
#![allow(incomplete_features)]
#![feature(asm)]
#![feature(const_fn)]
#![feature(const_generics)]
#![feature(const_if_match)]
@ -120,7 +121,6 @@
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(linkage)]
#![feature(llvm_asm)]
#![feature(naked_functions)]
#![feature(panic_info_message)]
#![feature(slice_ptr_range)]

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save