-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fmt: Format code and fix some clippy
- Loading branch information
Showing
29 changed files
with
171 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
use alloc::vec; | ||
use alloc::vec::Vec; | ||
|
||
use crate::components::{common::{DTB_BIN, MEM_AREA}, consts::VIRT_ADDR_START}; | ||
|
||
|
||
pub(crate) fn arch_init() { | ||
DTB_BIN.init_by(Vec::new()); | ||
MEM_AREA.init_by({ | ||
let mut mem_area = Vec::new(); | ||
// This is just temporary solution until we find a better way to detect memory areas. | ||
mem_area.push((VIRT_ADDR_START | 0x9000_0000, 0x2000_0000)); | ||
mem_area | ||
}); | ||
MEM_AREA.init_by(vec![ | ||
(VIRT_ADDR_START | 0x9000_0000, 0x2000_0000) | ||
]); | ||
} | ||
|
||
#[inline] | ||
pub fn hart_id() -> usize { | ||
loongArch64::register::cpuid::read().core_id() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#[cfg(target_arch = "loongarch64")] | ||
#[macro_export] | ||
macro_rules! pub_use_arch { | ||
($($name:ident),*) => { | ||
$( | ||
pub use self::loongarch64::$name; | ||
)* | ||
}; | ||
} | ||
|
||
#[cfg(target_arch = "x86_64")] | ||
#[macro_export] | ||
macro_rules! pub_use_arch { | ||
($($name:ident),*) => { | ||
$( | ||
pub use self::x86_64::$name; | ||
)* | ||
}; | ||
} | ||
|
||
#[cfg(target_arch = "riscv64")] | ||
#[macro_export] | ||
macro_rules! pub_use_arch { | ||
($($name:ident),*) => { | ||
$( | ||
pub use self::riscv64::$name; | ||
)* | ||
}; | ||
} | ||
|
||
#[cfg(target_arch = "aarch64")] | ||
#[macro_export] | ||
macro_rules! pub_use_arch { | ||
($($name:ident),*) => { | ||
$( | ||
pub use self::aarch64::$name; | ||
)* | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
use loongArch64::ipi::{csr_mail_send, send_ipi_single}; | ||
|
||
use crate::components::multicore::MultiCore; | ||
use crate::{boot::BOOT_STACK, components::multicore::MultiCore}; | ||
|
||
// TODO: Boot a core with top pointer of the stack | ||
pub fn boot_core(hart_id: usize, sp_top: usize) { | ||
csr_mail_send(crate::components::boot::_start_secondary as _, hart_id, 0); | ||
csr_mail_send(sp_top as _, hart_id, 1); | ||
send_ipi_single(1, 1); | ||
} | ||
|
||
impl MultiCore { | ||
pub fn boot_all() { | ||
// Stack Pointer. | ||
let stack_ptr = unsafe { BOOT_STACK.as_ptr() as u64 + BOOT_STACK.len() as u64 }; | ||
csr_mail_send(crate::components::boot::_start_secondary as _, 1, 0); | ||
csr_mail_send(stack_ptr, 1, 1); | ||
send_ipi_single(1, 1); | ||
loop {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
use crate::components::multicore::MultiCore; | ||
|
||
// TODO: Boot a core with top pointer of the stack | ||
pub fn boot_core(_hart_id: usize, _sp_top: usize) { | ||
log::error!("Boot Core is not implemented yet for aarch64"); | ||
} | ||
|
||
impl MultiCore { | ||
pub fn boot_all() {} | ||
} |
Oops, something went wrong.