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() -> ! { pub fn wait_forever() -> ! {
unsafe { unsafe {
loop { loop {
llvm_asm!("wfe" #[rustfmt::skip]
: // outputs asm!(
: // inputs "wfe",
: // clobbers options(nomem, nostack, preserves_flags)
: "volatile") // options );
} }
} }
} }

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

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

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

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

@ -92,9 +92,9 @@
//! - `crate::memory::*` //! - `crate::memory::*`
//! - `crate::bsp::memory::*` //! - `crate::bsp::memory::*`
#![feature(asm)]
#![feature(format_args_nl)] #![feature(format_args_nl)]
#![feature(global_asm)] #![feature(global_asm)]
#![feature(llvm_asm)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
#![no_main] #![no_main]
#![no_std] #![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() -> ! { pub fn wait_forever() -> ! {
- unsafe { - unsafe {
- loop { - loop {
- llvm_asm!("wfe" - #[rustfmt::skip]
- : // outputs - asm!(
- : // inputs - "wfe",
- : // clobbers - options(nomem, nostack, preserves_flags)
- : "volatile") // options - );
- } - }
+ loop { + loop {
+ asm::wfe() + 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 diff -uNr 03_hacky_hello_world/src/main.rs 04_zero_overhead_abstraction/src/main.rs
--- 03_hacky_hello_world/src/main.rs --- 03_hacky_hello_world/src/main.rs
+++ 04_zero_overhead_abstraction/src/main.rs +++ 04_zero_overhead_abstraction/src/main.rs
@@ -93,8 +93,7 @@ @@ -92,9 +92,8 @@
//! - `crate::memory::*`
//! - `crate::bsp::memory::*` //! - `crate::bsp::memory::*`
-#![feature(asm)]
#![feature(format_args_nl)] #![feature(format_args_nl)]
-#![feature(global_asm)] -#![feature(global_asm)]
-#![feature(llvm_asm)]
+#![feature(naked_functions)] +#![feature(naked_functions)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
#![no_main] #![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. +/// - Changes the HW state of the executing core.
+#[inline(always)] +#[inline(always)]
+pub unsafe fn local_irq_unmask() { +pub unsafe fn local_irq_unmask() {
+ llvm_asm!("msr DAIFClr, $0" + #[rustfmt::skip]
+ : // outputs + asm!(
+ : "i"(daif_bits::IRQ) // inputs + "msr DAIFClr, {arg}",
+ : // clobbers + arg = const daif_bits::IRQ,
+ : "volatile" // options + 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. +/// - Changes the HW state of the executing core.
+#[inline(always)] +#[inline(always)]
+pub unsafe fn local_irq_mask() { +pub unsafe fn local_irq_mask() {
+ llvm_asm!("msr DAIFSet, $0" + #[rustfmt::skip]
+ : // outputs + asm!(
+ : "i"(daif_bits::IRQ) // inputs + "msr DAIFSet, {arg}",
+ : // clobbers + arg = const daif_bits::IRQ,
+ : "volatile" // options + 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 //! [timer interface]: ../libkernel/time/interface/trait.TimeManager.html
//! //!
//! # Code organization and architecture //! # Code organization and architecture
@@ -107,11 +112,15 @@ @@ -107,8 +112,12 @@
//! - `crate::bsp::memory::*` //! - `crate::bsp::memory::*`
#![allow(incomplete_features)] #![allow(incomplete_features)]
+#![feature(asm)]
+#![feature(const_fn)] +#![feature(const_fn)]
#![feature(const_generics)] #![feature(const_generics)]
-#![feature(custom_inner_attributes)] -#![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(format_args_nl)]
#![feature(global_asm)] #![feature(global_asm)]
#![feature(linkage)] #![feature(linkage)]
+#![feature(llvm_asm)]
#![feature(naked_functions)]
#![feature(panic_info_message)]
#![feature(slice_ptr_range)]
@@ -137,6 +146,7 @@ @@ -137,6 +146,7 @@
pub mod exception; pub mod exception;
pub mod memory; pub mod memory;

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

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

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save