Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build error on the latest nightly (asm! import) #329

Merged
merged 4 commits into from
Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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