Skip to content

Commit 3fc2066

Browse files
committed
fix(lab/1): cannot find function in lib.rs
1 parent d805b0c commit 3fc2066

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/0x01/pkg/boot/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ pub fn current_page_table() -> OffsetPageTable<'static> {
4545
}
4646

4747
/// The entry point of kernel, set by BSP.
48+
#[cfg(feature = "boot")]
4849
static mut ENTRY: usize = 0;
4950

5051
/// Jump to ELF entry according to global variable `ENTRY`
5152
///
5253
/// # Safety
5354
///
5455
/// This function is unsafe because the caller must ensure that the kernel entry point is valid.
55-
pub(crate) fn jump_to_entry(bootinfo: *const BootInfo, stacktop: u64) -> ! {
56+
#[cfg(feature = "boot")]
57+
pub fn jump_to_entry(bootinfo: *const BootInfo, stacktop: u64) -> ! {
5658
unsafe {
5759
assert!(ENTRY != 0, "ENTRY is not set");
5860
asm!("mov rsp, {}; call {}", in(reg) stacktop, in(reg) ENTRY, in("rdi") bootinfo);
@@ -66,7 +68,8 @@ pub(crate) fn jump_to_entry(bootinfo: *const BootInfo, stacktop: u64) -> ! {
6668
///
6769
/// This function is unsafe because the caller must ensure that the kernel entry point is valid.
6870
#[inline(always)]
69-
pub(crate) fn set_entry(entry: usize) {
71+
#[cfg(feature = "boot")]
72+
pub fn set_entry(entry: usize) {
7073
unsafe {
7174
ENTRY = entry;
7275
}

0 commit comments

Comments
 (0)