forked from DragonOS-Community/DragonOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
riscv: 把内核编译target改为riscv64gc & 获取time csr的频率 & 修正浮点保存与恢复的汇编的问题 (Drag…
…onOS-Community#699) * 1. 把内核编译target改为riscv64gc 2. fix: 修正浮点保存与恢复的汇编的问题 * riscv: 获取time csr的频率
- Loading branch information
Showing
28 changed files
with
373 additions
and
229 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,3 @@ Cargo.lock | |
.cache | ||
compile_commands.json | ||
/logs/ | ||
.vscode |
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,3 +1,5 @@ | ||
#![feature(cfg_target_abi)] | ||
|
||
#[macro_use] | ||
extern crate lazy_static; | ||
extern crate cc; | ||
|
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod of; | ||
pub mod sbi; |
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,40 @@ | ||
use system_error::SystemError; | ||
|
||
use crate::{ | ||
driver::open_firmware::fdt::OpenFirmwareFdtDriver, | ||
init::boot_params, | ||
libs::align::page_align_up, | ||
mm::{mmio_buddy::mmio_pool, MemoryManagementArch, PhysAddr}, | ||
}; | ||
|
||
impl OpenFirmwareFdtDriver { | ||
#[allow(dead_code)] | ||
pub unsafe fn map_fdt(&self) -> Result<(), SystemError> { | ||
let bp_guard = boot_params().read(); | ||
let fdt_size = bp_guard.arch.fdt_size; | ||
let fdt_paddr = bp_guard.arch.fdt_paddr; | ||
|
||
let offset = fdt_paddr.data() & crate::arch::MMArch::PAGE_OFFSET_MASK; | ||
let map_size = page_align_up(fdt_size + offset); | ||
let map_paddr = PhysAddr::new(fdt_paddr.data() & crate::arch::MMArch::PAGE_MASK); | ||
// kdebug!( | ||
// "map_fdt paddr: {:?}, map_pa: {:?},fdt_size: {}, size: {:?}", | ||
// fdt_paddr, | ||
// map_paddr, | ||
// fdt_size, | ||
// map_size | ||
// ); | ||
let mmio_guard = mmio_pool().create_mmio(map_size)?; | ||
|
||
// drop the boot params guard in order to avoid deadlock | ||
drop(bp_guard); | ||
mmio_guard.map_phys(map_paddr, map_size)?; | ||
let mut bp_guard = boot_params().write(); | ||
let vaddr = mmio_guard.vaddr() + offset; | ||
|
||
self.set_fdt_map_guard(Some(mmio_guard)); | ||
bp_guard.arch.fdt_vaddr.replace(vaddr); | ||
|
||
return Ok(()); | ||
} | ||
} |
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
Oops, something went wrong.