Skip to content

Commit

Permalink
Export asm! macro where necessary
Browse files Browse the repository at this point in the history
It has been removed from the prelude during stabilization.
See rust-lang/rust#87228
  • Loading branch information
Demindiro committed Dec 31, 2021
1 parent 75024f9 commit 8e80158
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 4 deletions.
2 changes: 2 additions & 0 deletions boot/amd64/src/cpuid.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use core::arch::asm;

pub struct Features {
max_basic_eax: u32,
max_extended_eax: u32,
Expand Down
1 change: 1 addition & 0 deletions boot/amd64/src/gdt.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::arch::asm;
use core::mem;

#[repr(C)]
Expand Down
3 changes: 2 additions & 1 deletion boot/amd64/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_main]
#![no_std]
#![feature(asm, asm_const)]
#![feature(asm_const)]
#![feature(maybe_uninit_uninit_array, maybe_uninit_slice)]

mod cpuid;
Expand All @@ -13,6 +13,7 @@ mod multiboot2;
mod paging;
mod vga;

use core::arch::asm;
use core::mem::MaybeUninit;
use core::panic::PanicInfo;
use core::slice;
Expand Down
2 changes: 2 additions & 0 deletions boot/amd64/src/msr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use core::arch::asm;

/// # Safety
///
/// MSRs must be supported.
Expand Down
2 changes: 2 additions & 0 deletions kernel/src/arch/amd64/asm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pub mod io {
use core::arch::asm;

pub unsafe fn inb(address: u16) -> u8 {
let out: u8;
asm!("in al, dx", out("al") out, in("dx") address);
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/amd64/gdt.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::tss::TSS;
use core::arch::asm;
use core::marker::PhantomData;
use core::mem;
use core::pin::Pin;
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/amd64/idt.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::arch::asm;
use core::mem;

#[macro_export]
Expand Down
4 changes: 2 additions & 2 deletions kernel/src/arch/amd64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ mod tss;
pub mod r#virtual;

use crate::{driver::apic, power, scheduler, time::Monotonic};
use core::arch::asm;
use core::mem::MaybeUninit;
pub use idt::{Handler, IDTEntry};
pub use syscall::{current_process, current_thread, current_thread_weak, set_current_thread};

use core::mem::MaybeUninit;

static mut TSS: tss::TSS = tss::TSS::new();
static mut TSS_STACK: [usize; 512] = [0; 512];

Expand Down
2 changes: 2 additions & 0 deletions kernel/src/arch/amd64/msr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use core::arch::asm;

pub const IA32_APIC_BASE_MSR: u32 = 0x1b;
#[allow(dead_code)]
pub const IA32_APIC_BASE_MSR_BSP: u64 = 0x100;
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/amd64/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use alloc::{
boxed::Box,
sync::{Arc, Weak},
};
use core::arch::asm;
use core::ptr::{self, NonNull};

pub unsafe fn init() {
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/amd64/virtual/address_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::common;
use crate::memory::frame;
use crate::memory::r#virtual::{phys_to_virt, RWX};
use crate::memory::Page;
use core::arch::asm;
use core::num::NonZeroUsize;
use core::ptr::NonNull;

Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/amd64/virtual/common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::memory::frame;
use crate::memory::Page;
use core::arch::asm;
use core::fmt;
use core::ptr;

Expand Down
1 change: 1 addition & 0 deletions kernel/src/driver/apic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::arch::amd64::msr;
use crate::memory::Page;
use crate::time::Monotonic;
use acpi::{AcpiHandler, AcpiTables};
use core::arch::asm;
use core::time::Duration;
use reg::*;

Expand Down
1 change: 1 addition & 0 deletions kernel/src/driver/rtc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! # RTC driver
use core::arch::asm;

use crate::time::Monotonic;
use core::sync::atomic::AtomicU64;
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_std]
#![no_main]
#![feature(alloc_error_handler)]
#![feature(asm, asm_const, asm_sym)]
#![feature(asm_const, asm_sym)]
#![feature(const_trait_impl)]
#![feature(derive_default_enum)]
#![feature(drain_filter)]
Expand Down
1 change: 1 addition & 0 deletions kernel/src/scheduler/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use alloc::{
sync::{Arc, Weak},
vec::Vec,
};
use core::arch::asm;
use core::mem;
use core::ptr::NonNull;
use core::time::Duration;
Expand Down
1 change: 1 addition & 0 deletions kernel/src/scheduler/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::arch;
use crate::memory::frame;
use crate::time::Monotonic;
use alloc::sync::{Arc, Weak};
use core::arch::asm;
use core::cell::Cell;
use core::num::NonZeroUsize;
use core::ptr::NonNull;
Expand Down

0 comments on commit 8e80158

Please sign in to comment.