From f0002b52bec86a1be66f7feeb215dec5007e4ad2 Mon Sep 17 00:00:00 2001 From: yufeng <321353225@qq.com> Date: Sun, 4 Aug 2024 00:34:43 +0800 Subject: [PATCH] feat: publish polyhal --- Cargo.toml | 6 +++--- example/Cargo.lock | 2 ++ src/components/boot/mod.rs | 1 - src/components/pagetable/riscv64.rs | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 73df634..21c26ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,15 +11,15 @@ repository = "https://github.com/Byte-OS/polyhal" [features] kcontext = [] -multicore = [] -interrupt = [] +multicore = ["boot"] +trap = [] boot = [] logger = [] vga_text = [] graphic = [] -default = ["multicore", "interrupt", "boot", "kcontext"] +default = ["boot", "trap", "kcontext"] [dependencies] log = "0.4" diff --git a/example/Cargo.lock b/example/Cargo.lock index 53c7cf5..9015c45 100644 --- a/example/Cargo.lock +++ b/example/Cargo.lock @@ -171,6 +171,8 @@ dependencies = [ [[package]] name = "polyhal-macro" version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5cee39179815e92d0109327456e59eaed6021d0377c2fd84d02f2c6c345b122" dependencies = [ "proc-macro2", "quote", diff --git a/src/components/boot/mod.rs b/src/components/boot/mod.rs index 8b38d06..14aea5b 100644 --- a/src/components/boot/mod.rs +++ b/src/components/boot/mod.rs @@ -15,6 +15,5 @@ pub(crate) static mut BOOT_STACK: [u8; STACK_SIZE] = [0; STACK_SIZE]; // Declare the _main_for_arch exists. extern "Rust" { - #[cfg(feature = "boot")] pub(crate) fn _main_for_arch(hartid: usize); } diff --git a/src/components/pagetable/riscv64.rs b/src/components/pagetable/riscv64.rs index 3839d3b..0921f3f 100644 --- a/src/components/pagetable/riscv64.rs +++ b/src/components/pagetable/riscv64.rs @@ -4,7 +4,6 @@ use bitflags::bitflags; use riscv::register::satp; use crate::addr::{PhysAddr, PhysPage, VirtAddr, VirtPage}; -use crate::components::boot::boot_page_table; use crate::components::pagetable::{MappingFlags, PageTable, PTE, TLB}; use crate::utils::bit; @@ -185,7 +184,7 @@ impl PageTable { #[inline] pub fn restore(&self) { self.release(); - let kernel_arr = Self::get_pte_list(boot_page_table().0); + let kernel_arr = Self::get_pte_list(crate::boot::boot_page_table().0); let arr = Self::get_pte_list(self.0); arr[0x100..].copy_from_slice(&kernel_arr[0x100..]); arr[0..0x100].fill(PTE(0));