使得DragonOS kernel 能为riscv64编译通过(尚未能启动) (#457)

* 使得DragonOS kernel 能为riscv64编译通过(尚未能启动)

* 修正了系统调用号声明不正确的问题,同时添加了编译配置文档
This commit is contained in:
LoGin
2023-11-25 12:07:39 +08:00
committed by GitHub
parent a1fd1cf1cb
commit 4fda81ce81
112 changed files with 2587 additions and 615 deletions

View File

@ -2,6 +2,7 @@ use crate::utils::cargo_handler::{CargoHandler, TargetArch};
use self::x86_64::X86_64BindgenArch;
pub mod riscv64;
pub mod x86_64;
pub(super) trait BindgenArch {
@ -13,6 +14,7 @@ pub(super) fn current_bindgenarch() -> &'static dyn BindgenArch {
let arch = CargoHandler::target_arch();
match arch {
TargetArch::X86_64 => &X86_64BindgenArch,
TargetArch::Riscv64 => &riscv64::RiscV64BindgenArch,
_ => panic!("Unsupported arch: {:?}", arch),
}
}

View File

@ -0,0 +1,10 @@
use super::BindgenArch;
pub struct RiscV64BindgenArch;
impl BindgenArch for RiscV64BindgenArch {
fn generate_bindings(&self, builder: bindgen::Builder) -> bindgen::Builder {
builder
.clang_arg("-I./src/arch/riscv64/include")
.clang_arg("--target=riscv64-none-none-elf")
}
}