Skip to content

Commit

Permalink
Merge pull request #329 from toku-sa-n/fix_asm
Browse files Browse the repository at this point in the history
fix: build error on the latest nightly
  • Loading branch information
phil-opp authored Dec 18, 2021
2 parents 55d5fad + 449f6b9 commit 575de31
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 10 deletions.
39 changes: 29 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ jobs:
rustc -Vv
cargo -Vv
- name: Cache binaries
id: cache-bin
uses: actions/cache@v1
with:
path: binaries
key: ${{ runner.OS }}-binaries
- name: Add binaries/bin to PATH
run: echo "$GITHUB_WORKSPACE/binaries/bin" >> $GITHUB_PATH
shell: bash

- name: "Run cargo build"
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -131,6 +121,35 @@ jobs:
cargo build --target i686-unknown-linux-gnu --no-default-features --features nightly
cargo build --target thumbv7em-none-eabihf --no-default-features --features nightly
bootloader-test:
name: "Bootloader Integration Test"

strategy:
fail-fast: false
matrix:
platform: [
ubuntu-latest,
macos-latest,
windows-latest
]

runs-on: ${{ matrix.platform }}
timeout-minutes: 15

steps:
- name: "Checkout Repository"
uses: actions/checkout@v1

- name: Cache binaries
id: cache-bin
uses: actions/cache@v1
with:
path: binaries
key: ${{ runner.OS }}-binaries
- name: Add binaries/bin to PATH
run: echo "$GITHUB_WORKSPACE/binaries/bin" >> $GITHUB_PATH
shell: bash

- name: "Install Rustup Components"
run: rustup component add rust-src llvm-tools-preview
- name: "Install cargo-xbuild"
Expand Down
3 changes: 3 additions & 0 deletions src/instructions/interrupts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Enabling and disabling interrupts
#[cfg(feature = "inline_asm")]
use core::arch::asm;

/// Returns whether interrupts are enabled.
#[inline]
pub fn are_enabled() -> bool {
Expand Down
3 changes: 3 additions & 0 deletions src/instructions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pub mod segmentation;
pub mod tables;
pub mod tlb;

#[cfg(feature = "inline_asm")]
use core::arch::asm;

/// Halts the CPU until the next interrupt arrives.
#[inline]
pub fn hlt() {
Expand Down
2 changes: 2 additions & 0 deletions src/instructions/port.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Access to I/O ports
#[cfg(feature = "inline_asm")]
use core::arch::asm;
use core::fmt;
use core::marker::PhantomData;

Expand Down
2 changes: 2 additions & 0 deletions src/instructions/segmentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use crate::{
structures::gdt::SegmentSelector,
VirtAddr,
};
#[cfg(feature = "inline_asm")]
use core::arch::asm;

macro_rules! get_reg_impl {
($name:literal, $asm_get:ident) => {
Expand Down
2 changes: 2 additions & 0 deletions src/instructions/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
use crate::structures::gdt::SegmentSelector;
use crate::VirtAddr;
#[cfg(feature = "inline_asm")]
use core::arch::asm;

pub use crate::structures::DescriptorTablePointer;

Expand Down
2 changes: 2 additions & 0 deletions src/instructions/tlb.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! Functions to flush the translation lookaside buffer (TLB).
use crate::VirtAddr;
#[cfg(feature = "inline_asm")]
use core::arch::asm;

/// Invalidate the given address in the TLB using the `invlpg` instruction.
#[inline]
Expand Down
2 changes: 2 additions & 0 deletions src/registers/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ bitflags! {
mod x86_64 {
use super::*;
use crate::{instructions::tlb::Pcid, structures::paging::PhysFrame, PhysAddr, VirtAddr};
#[cfg(feature = "inline_asm")]
use core::arch::asm;

impl Cr0 {
/// Read the current set of CR0 flags.
Expand Down
2 changes: 2 additions & 0 deletions src/registers/model_specific.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ mod x86_64 {
control::Cr4Flags,
segmentation::{Segment, Segment64, CS, SS},
};
#[cfg(feature = "inline_asm")]
use core::arch::asm;

impl Msr {
/// Read 64 bits msr register.
Expand Down
2 changes: 2 additions & 0 deletions src/registers/rflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ bitflags! {
#[cfg(feature = "instructions")]
mod x86_64 {
use super::*;
#[cfg(feature = "inline_asm")]
use core::arch::asm;

/// Returns the current value of the RFLAGS register.
///
Expand Down
3 changes: 3 additions & 0 deletions src/registers/xcontrol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ bitflags! {
#[cfg(feature = "instructions")]
mod x86_64 {
use super::*;
#[cfg(feature = "inline_asm")]
use core::arch::asm;

impl XCr0 {
/// Read the current set of XCR0 flags.
#[inline]
Expand Down

0 comments on commit 575de31

Please sign in to comment.