Skip to content

Commit

Permalink
feat: migration the arch module in https://github.com/yfblock/ByteOS/…
Browse files Browse the repository at this point in the history
…tree/main/arch to crates/hal
  • Loading branch information
Azure-stars committed Mar 24, 2024
1 parent 14f9c3b commit e2ede64
Show file tree
Hide file tree
Showing 98 changed files with 6,520 additions and 526 deletions.
29 changes: 29 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Target Platform
[build]
target = 'riscv64gc-unknown-none-elf'
# target = 'x86_64-unknown-none'
# target = 'aarch64-unknown-none-softfloat'
# target = 'loongarch64-unknown-none'

# This flags also can be set from every target.
rustflags = [
'-Cforce-frame-pointers=yes',
'-Clink-arg=-no-pie',
'--cfg=board="qemu"',
'--cfg=driver="kvirtio,kgoldfish-rtc,ns16550a"',
# '-Zunstable-options',
# '--check-cfg=values(board, "qemu","k210","cv1811h", "knvme", "")',
# '--cfg=kernel_base="0xffffffc080200000"', # riscv64gc-unknown-none-elf
# '--cfg=kernel_base="0xffffff8000200000"', # x86_64-unknown-none
]

[target.riscv64gc-unknown-none-elf]

[target.x86_64-unknown-none]

[target.aarch64-unknown-none-softfloat]

[target.loongarch64-unknown-none]

[unstable]
features = ['dev_dep','host_dep']
121 changes: 116 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ members = [
"crates/driver_net",
"crates/driver_pci",
"crates/driver_virtio",
"crates/elf_parser",
"crates/flatten_objects",
"crates/hal",
"crates/handler_table",
"crates/kernel_guard",
"crates/lazy_init",
Expand All @@ -35,7 +37,6 @@ members = [
"crates/spinlock",
"crates/timer_list",
"crates/tuple_for_each",
"crates/elf_parser",

"modules/axalloc",
"modules/axconfig",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ debug: build
sleep 1
$(GDB) $(OUT_ELF) \
-ex 'target remote localhost:1234' \
-ex 'b rust_main' \
-ex 'b rust_entry' \
-ex 'continue' \
-ex 'disp /16i $$pc'

Expand Down
6 changes: 3 additions & 3 deletions apps/monolithic_userboot/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ pub const SDCARD_TESTCASES: &[&str] = &[
// "busybox sh ./test_all.sh",
// "./riscv64-linux-musl-native/bin/riscv64-linux-musl-gcc ./hello.c -static",
// "./a.out",
"./time-test",
"./interrupts-test-1",
// "./time-test",
// "./interrupts-test-1",
// "./interrupts-test-2",
// "./copy-file-range-test-1",
// "./copy-file-range-test-2",
Expand Down Expand Up @@ -56,7 +56,7 @@ pub const SDCARD_TESTCASES: &[&str] = &[
// "lmbench_all bw_mmap_rd -P 1 512k open2close /var/tmp/XXX",
// "busybox echo context switch overhead",
// "lmbench_all lat_ctx -P 1 -s 32 2 4 8 16 24 32 64 96",
// "busybox sh libctest_testcode.sh",
"busybox sh libctest_testcode.sh",
// "busybox sh lua_testcode.sh",
// "libc-bench",
// "busybox sh ./netperf_testcode.sh",
Expand Down
44 changes: 44 additions & 0 deletions crates/hal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "hal"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
# whether to use the stackful coroutine
stackful = []
alloc = []

[dependencies]
log = "0.4"
fdt = "0.1.5"
bitflags = "2.0.2"
cfg-if = "1.0.0"
crate_interface = { path = "../crate_interface" }
allocator = { path = "../allocator" }
percpu = { path = "../percpu" }
memory_addr = { path = "../memory_addr" }

[target.'cfg(target_arch = "riscv64")'.dependencies]
riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }

[target.'cfg(target_arch = "x86_64")'.dependencies]
x86 = "0.52"
x86_64 = "0.14"
spin = { version = "0.9.8", features = ["mutex"] }
irq_safety = { git = "https://github.com/theseus-os/irq_safety.git"}
multiboot = "0.8.0"
x2apic = "0.4"
raw-cpuid = "11.0"

[target.'cfg(target_arch = "aarch64")'.dependencies]
aarch64-cpu = "9.3"
arm_pl011 = { path = "../arm_pl011" }
tock-registers = "0.8"
irq_safety = { git = "https://github.com/theseus-os/irq_safety.git"}
arm_gic = { path = "../arm_gic" }

[target.'cfg(target_arch = "loongarch64")'.dependencies]
spin = { version = "0.9.8", features = ["mutex"] }
loongarch64 = {git = "https://github.com/Godones/loongArch64",package = "loongarch64" }
Loading

0 comments on commit e2ede64

Please sign in to comment.