Skip to content

Commit

Permalink
remove asm feature
Browse files Browse the repository at this point in the history
The `asm!()` macro was stabilized in
rust-lang/rust#91728. This removes the feature
and imports it through `core::arch` instead.
  • Loading branch information
bradjc committed Feb 9, 2022
1 parent 2ab8d33 commit f00a398
Show file tree
Hide file tree
Showing 28 changed files with 42 additions and 17 deletions.
3 changes: 2 additions & 1 deletion arch/cortex-m/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#![crate_name = "cortexm"]
#![crate_type = "rlib"]
#![feature(asm, asm_sym)]
#![feature(asm_sym)]
#![feature(naked_functions)]
#![no_std]

use core::arch::asm;
use core::fmt::Write;

pub mod mpu;
Expand Down
2 changes: 2 additions & 0 deletions arch/cortex-m/src/scb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//!
//! <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/CIHFDJCA.html>
use core::arch::asm;

use kernel::utilities::registers::interfaces::{ReadWriteable, Readable, Writeable};
use kernel::utilities::registers::{register_bitfields, register_structs, ReadOnly, ReadWrite};
use kernel::utilities::StaticRef;
Expand Down
1 change: 1 addition & 0 deletions arch/cortex-m/src/support.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::arch::asm;
use core::ops::FnOnce;

#[cfg(all(target_arch = "arm", target_os = "none"))]
Expand Down
4 changes: 3 additions & 1 deletion arch/cortex-m0/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![crate_name = "cortexm0"]
#![crate_type = "rlib"]
#![feature(asm, asm_sym, naked_functions)]
#![feature(asm_sym, naked_functions)]
#![no_std]

// Re-export the base generic cortex-m functions here as they are
Expand All @@ -13,6 +13,8 @@ pub use cortexm::nvic;
pub use cortexm::print_cortexm_state as print_cortexm0_state;
pub use cortexm::syscall;

use core::arch::asm;

extern "C" {
// _estack is not really a function, but it makes the types work
// You should never actually invoke it!!
Expand Down
3 changes: 2 additions & 1 deletion arch/cortex-m0p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![crate_name = "cortexm0p"]
#![crate_type = "rlib"]
#![feature(asm)]
#![feature(naked_functions)]
#![no_std]

Expand All @@ -26,6 +25,8 @@ pub use cortexm0::generic_isr;
pub use cortexm0::hard_fault_handler;
pub use cortexm0::systick_handler;

use core::arch::asm;

// Mock implementation for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn switch_to_user(
Expand Down
3 changes: 2 additions & 1 deletion arch/rv32i/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#![crate_name = "rv32i"]
#![crate_type = "rlib"]
#![feature(asm, asm_sym, const_fn_trait_bound, naked_functions)]
#![feature(asm_sym, const_fn_trait_bound, naked_functions)]
#![no_std]

use core::arch::asm;
use core::fmt::Write;

use kernel::utilities::registers::interfaces::{Readable, Writeable};
Expand Down
1 change: 1 addition & 0 deletions arch/rv32i/src/support.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Core low-level operations.
use crate::csr::{mstatus::mstatus, CSR};
use core::arch::asm;
use core::ops::FnOnce;

#[cfg(all(target_arch = "riscv32", target_os = "none"))]
Expand Down
1 change: 1 addition & 0 deletions arch/rv32i/src/syscall.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Kernel-userland system call interface for RISC-V architecture.
use core::arch::asm;
use core::convert::TryInto;
use core::fmt::Write;
use core::mem::size_of;
Expand Down
4 changes: 3 additions & 1 deletion boards/nano_rp2040_connect/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![deny(missing_docs)]
#![feature(asm, naked_functions)]
#![feature(naked_functions)]

use core::arch::asm;

use capsules::virtual_alarm::VirtualMuxAlarm;
use components::gpio::GpioComponent;
Expand Down
4 changes: 3 additions & 1 deletion boards/pico_explorer_base/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![deny(missing_docs)]
#![feature(asm, naked_functions)]
#![feature(naked_functions)]

use core::arch::asm;

use kernel::dynamic_deferred_call::{DynamicDeferredCall, DynamicDeferredCallClientState};

Expand Down
4 changes: 3 additions & 1 deletion boards/raspberry_pi_pico/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
// https://github.com/rust-lang/rust/issues/62184.
#![cfg_attr(not(doc), no_main)]
#![deny(missing_docs)]
#![feature(asm, naked_functions)]
#![feature(naked_functions)]

use core::arch::asm;

use capsules::i2c_master::I2CMasterDriver;
use capsules::virtual_alarm::VirtualMuxAlarm;
Expand Down
4 changes: 3 additions & 1 deletion chips/apollo3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![crate_name = "apollo3"]
#![crate_type = "rlib"]
#![feature(asm, const_fn_trait_bound)]
#![feature(const_fn_trait_bound)]
#![no_std]

// Peripherals
Expand All @@ -18,6 +18,8 @@ pub mod pwrctrl;
pub mod stimer;
pub mod uart;

use core::arch::asm;

use cortexm4::{
generic_isr, hard_fault_handler, initialize_ram_jump_to_main, scb, svc_handler,
systick_handler, unhandled_interrupt,
Expand Down
1 change: 1 addition & 0 deletions chips/arty_e21_chip/src/chip.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::arch::asm;
use core::fmt::Write;
use kernel;
use kernel::debug;
Expand Down
1 change: 0 additions & 1 deletion chips/arty_e21_chip/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Drivers and chip support for the E21 soft core.
#![feature(asm)]
#![no_std]
#![crate_name = "arty_e21_chip"]
#![crate_type = "rlib"]
Expand Down
1 change: 1 addition & 0 deletions chips/earlgrey/src/chip.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! High-level setup and interrupt mapping for the chip.
use core::arch::asm;
use core::fmt::Write;
use kernel;
use kernel::dynamic_deferred_call::DynamicDeferredCall;
Expand Down
2 changes: 1 addition & 1 deletion chips/earlgrey/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Drivers and chip support for EarlGrey.
#![feature(asm, const_fn_trait_bound, naked_functions)]
#![feature(const_fn_trait_bound, naked_functions)]
#![no_std]
#![crate_name = "earlgrey"]
#![crate_type = "rlib"]
Expand Down
1 change: 1 addition & 0 deletions chips/esp32-c3/src/chip.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! High-level setup and interrupt mapping for the chip.
use core::arch::asm;
use core::fmt::Write;

use kernel;
Expand Down
2 changes: 1 addition & 1 deletion chips/esp32-c3/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Drivers and chip support for ESP32-C3.
#![feature(const_fn_trait_bound, naked_functions, asm)]
#![feature(const_fn_trait_bound, naked_functions)]
#![no_std]
#![crate_name = "esp32_c3"]
#![crate_type = "rlib"]
Expand Down
3 changes: 3 additions & 0 deletions chips/litex_vexriscv/src/interrupt_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ mod vexriscv_irq_raw {
#[cfg(all(target_arch = "riscv32", target_os = "none"))]
pub unsafe fn irq_getmask() -> usize {
let mask: usize;
use core::arch::asm;
asm!("csrr {mask}, {csr}", mask = out(reg) mask, csr = const CSR_IRQ_MASK);
mask
}
Expand All @@ -116,6 +117,7 @@ mod vexriscv_irq_raw {

#[cfg(all(target_arch = "riscv32", target_os = "none"))]
pub unsafe fn irq_setmask(mask: usize) {
use core::arch::asm;
asm!("csrw {csr}, {mask}", csr = const CSR_IRQ_MASK, mask = in(reg) mask);
}

Expand All @@ -127,6 +129,7 @@ mod vexriscv_irq_raw {
#[cfg(all(target_arch = "riscv32", target_os = "none"))]
pub unsafe fn irq_pending() -> usize {
let pending: usize;
use core::arch::asm;
asm!("csrr {pending}, {csr}", pending = out(reg) pending, csr = const CSR_IRQ_PENDING);
pending
}
Expand Down
2 changes: 1 addition & 1 deletion chips/litex_vexriscv/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! LiteX SoCs based around a VexRiscv CPU
#![feature(asm, asm_const, const_fn_trait_bound)]
#![feature(asm_const, const_fn_trait_bound)]
#![no_std]
#![crate_name = "litex_vexriscv"]
#![crate_type = "rlib"]
Expand Down
2 changes: 1 addition & 1 deletion chips/msp432/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![crate_name = "msp432"]
#![crate_type = "rlib"]
#![feature(asm, const_fn_trait_bound)]
#![feature(const_fn_trait_bound)]
#![no_std]

use cortexm4::{
Expand Down
1 change: 1 addition & 0 deletions chips/rp2040/src/clocks.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::arch::asm;
use core::cell::Cell;
use kernel::utilities::registers::interfaces::{ReadWriteable, Readable, Writeable};
use kernel::utilities::registers::{register_bitfields, register_structs, ReadOnly, ReadWrite};
Expand Down
2 changes: 1 addition & 1 deletion chips/rp2040/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(const_fn_trait_bound, asm)]
#![feature(const_fn_trait_bound)]
#![no_std]

pub mod adc;
Expand Down
1 change: 1 addition & 0 deletions chips/stm32f4xx/src/fsmc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::rcc;
use core::arch::asm;
use core::cell::Cell;
use kernel::deferred_call::DeferredCall;
use kernel::hil::bus8080::{Bus8080, BusWidth, Client};
Expand Down
1 change: 0 additions & 1 deletion chips/stm32f4xx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#![crate_name = "stm32f4xx"]
#![crate_type = "rlib"]
#![feature(const_fn_trait_bound)]
#![feature(asm)]
#![no_std]

pub mod chip;
Expand Down
2 changes: 1 addition & 1 deletion chips/swervolf-eh1/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Drivers and chip support for SweRVolf.
#![feature(asm, const_fn_trait_bound, naked_functions)]
#![feature(const_fn_trait_bound, naked_functions)]
#![no_std]
#![crate_name = "swervolf_eh1"]
#![crate_type = "rlib"]
Expand Down
1 change: 1 addition & 0 deletions libraries/riscv-csr/src/csr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! `ReadWriteRiscvCsr` type for RISC-V CSRs.
use core::arch::asm;
use core::marker::PhantomData;

use tock_registers::fields::Field;
Expand Down
2 changes: 1 addition & 1 deletion libraries/riscv-csr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Uses the Tock Register Interface to control RISC-V CSRs.
#![feature(asm, asm_const)]
#![feature(asm_const)]
#![feature(const_fn_trait_bound)]
#![no_std]

Expand Down

0 comments on commit f00a398

Please sign in to comment.