Skip to content

Commit ae727a2

Browse files
committed
fix/feat(RV64): implement dynamic heap start/size decider by using fdt crate and reading DTB pointer when booting
1 parent 58f1e2b commit ae727a2

745 files changed

Lines changed: 203106 additions & 7110 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,52 @@
11
[alias]
2-
x86 = "build --package awkernel --no-default-features --features x86 --target x86_64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
3-
raspi3 = "build --package awkernel --no-default-features --features raspi3 --target aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
4-
raspi4 = "build --package awkernel --no-default-features --features raspi4 --target aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
2+
x86 = "build --package awkernel --no-default-features --features x86 --target targets/x86_64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
3+
aarch64 = "build --package awkernel --no-default-features --features aarch64 --target targets/aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
54
rv32 = "build --package awkernel --no-default-features --features rv32 --target riscv32imac-unknown-none-elf -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
5+
rv64 = "build --package awkernel --no-default-features --features rv64 --target riscv64gc-unknown-none-elf -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
66
std = "build --package awkernel --no-default-features --features std"
77

88
test_awkernel_lib = "test --package awkernel_lib --no-default-features --features std"
99
test_awkernel_async_lib = "test --package awkernel_async_lib --no-default-features --features std"
10-
test_awkernel_drivers = "test --package awkernel_drivers"
10+
test_awkernel_drivers = "test --package awkernel_drivers --no-default-features --features std"
11+
test_smoltcp = "test --package smoltcp --no-default-features --features std --features awkernel"
12+
test_rd_gen_to_dags = "test --package rd_gen_to_dags --no-default-features --features std --features milliseconds"
1113

14+
clippy_x86 = "clippy --package awkernel --no-default-features --features x86 --target targets/x86_64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
15+
clippy_raspi = "clippy --package awkernel --no-default-features --features raspi --target targets/aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
16+
clippy_raspi5 = "clippy --package awkernel --no-default-features --features raspi5 --target targets/aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
17+
clippy_aarch64_virt = "clippy --package awkernel --no-default-features --features aarch64_virt --target targets/aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
18+
clippy_std = "clippy --package awkernel --no-default-features --features std"
19+
clippy_rv32 = "clippy --package awkernel --no-default-features --features rv32 --target riscv32imac-unknown-none-elf -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
20+
clippy_rv64 = "clippy --package awkernel --no-default-features --features rv64 --target riscv64gc-unknown-none-elf -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
21+
clippy_rd_gen_to_dags = "clippy --package rd_gen_to_dags --no-default-features --features std --features milliseconds"
22+
23+
check_aarch64 = "check --package awkernel --no-default-features --features aarch64 --target targets/aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
24+
check_x86 = "check --package awkernel --no-default-features --features x86 --target targets/x86_64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
25+
check_rv32 = "check --package awkernel --no-default-features --features rv32 --target riscv32imac-unknown-none-elf -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
26+
check_rv64 = "check --package awkernel --no-default-features --features rv64 --target riscv64gc-unknown-none-elf -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
1227
check_no_std = "check --package awkernel -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem --quiet --message-format=json"
13-
check_std = "check --package awkernel --quiet --message-format=json"
28+
check_std = "check --package awkernel --no-default-features --features std"
1429

15-
clippy_x86 = "clippy --package awkernel --no-default-features --features x86 --target x86_64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
16-
clippy_raspi3 = "clippy --package awkernel --no-default-features --features raspi3 --target aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
17-
clippy_raspi4 = "clippy --package awkernel --no-default-features --features raspi4 --target aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
18-
clippy_std = "clippy --package awkernel --no-default-features --features std"
30+
doc_raspi = "doc --package awkernel --no-default-features --features raspi --target targets/aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
31+
doc_aarch64_virt = "doc --package awkernel --no-default-features --features aarch64_virt --target targets/aarch64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
32+
doc_x86 = "doc --package awkernel --no-default-features --features x86 --target targets/x86_64-kernel.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
33+
34+
udeps_x86 = "udeps --package awkernel --no-default-features --features x86"
35+
udeps_raspi = "udeps --package awkernel --no-default-features --features x86"
36+
udeps_aarch64_virt = "udeps --package awkernel --no-default-features --features aarch64_virt"
37+
udeps_lib_x86 = "udeps --package awkernel_lib --no-default-features --features x86"
38+
udeps_lib_aarch64 = "udeps --package awkernel_lib --no-default-features --features aarch64"
39+
udeps_lib_rv64 = "udeps --package awkernel_lib --no-default-features --features rv64"
40+
udeps_async_lib = "udeps --package awkernel_async_lib --no-default-features --features std"
41+
udeps_drivers_x86 = "udeps --package awkernel_drivers --no-default-features --features x86"
42+
udeps_drivers_raspi = "udeps --package awkernel_drivers --no-default-features --features aarch64 --features raspi --features pl011"
43+
udeps_async_lib_verified = "udeps --package awkernel_async_lib_verified"
1944

2045
[target.'cfg(target_os = "linux")']
2146
rustflags = ["-C", "link-arg=-lc", "-C", "link-arg=-lpthread"]
2247

2348
[target.riscv32imac-unknown-none-elf]
24-
rustflags = [ "-C", "link-arg=-Trv32-link.lds" ]
49+
rustflags = ["-C", "link-arg=-Tkernel/ld/rv32-link.lds"]
50+
51+
[target.riscv64gc-unknown-none-elf]
52+
rustflags = ["-C", "link-arg=-Tkernel/ld/rv64-link.lds"]

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Description
2+
3+
## Related links
4+
5+
## How was this PR tested?
6+
7+
## Notes for reviewers

.github/workflows/auto-assign.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: auto assign author to assignee
2+
3+
on:
4+
pull_request:
5+
types: opened
6+
7+
jobs:
8+
assign:
9+
runs-on: ubuntu-22.04
10+
steps:
11+
- name: Assign author to assignee on PR
12+
uses: technote-space/assign-author@v1

.github/workflows/rust.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
schedule:
9+
- cron: "0 13 * * 1"
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Install Rust nightly
22+
run: rustup toolchain install nightly-2025-05-22
23+
- name: Use Rust nightly
24+
run: rustup default nightly-2025-05-22
25+
- name: Add Rust components
26+
run: rustup component add rust-src llvm-tools-preview clippy rustfmt
27+
- name: Add Rust targets
28+
run: rustup target add x86_64-unknown-none aarch64-unknown-none riscv32imac-unknown-none-elf riscv64gc-unknown-none-elf
29+
- name: Install libssl1.1
30+
run: wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.23_amd64.deb && sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.23_amd64.deb
31+
- name: Install cargo-binstall
32+
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
33+
- name: Install cargo-binutils
34+
run: cargo binstall cargo-binutils -y
35+
- name: Install cargo-udeps
36+
run: cargo binstall cargo-udeps -y
37+
38+
- name: Cargo fmt
39+
run: cargo fmt && git diff --exit-code
40+
41+
- name: Build aarch64_virt
42+
run: make check_aarch64 BSP=aarch64_virt
43+
- name: Build aarch64 raspi5
44+
run: make check_aarch64 BSP=raspi5
45+
- name: Build aarch64 raspi4
46+
run: make check_aarch64 BSP=raspi4
47+
- name: Build aarch64 raspi3
48+
run: make check_aarch64 BSP=raspi3
49+
- name: Build x86_64
50+
run: make check_x86_64
51+
- name: Build RISCV32
52+
run: make check_riscv32
53+
- name: Build RISCV64
54+
run: make check_riscv64
55+
- name: Build std
56+
run: make check_std
57+
58+
- name: Clippy aarch64_virt
59+
run: cargo clippy_aarch64_virt -- --deny warnings
60+
- name: Clippy raspi
61+
run: cargo clippy_raspi -- --deny warnings
62+
- name: Cliipy raspi5
63+
run: cargo clippy_raspi5 -- --deny warnings
64+
- name: Clippy x86_64
65+
run: cargo clippy_x86 -- --deny warnings
66+
- name: Clippy RISCV32
67+
run: cargo clippy_rv32 -- --deny warnings
68+
- name: Clippy RISCV64
69+
run: cargo clippy_rv64 -- --deny warnings
70+
- name: Clippy std
71+
run: cargo clippy_std -- --deny warnings
72+
- name: Clippy rd_gen_to_dags
73+
run: cargo clippy_rd_gen_to_dags -- --deny warnings
74+
75+
- name: udeps
76+
run: make udeps
77+
78+
- name: test
79+
run: RUSTFLAGS="-D warnings" make test

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,10 @@ dkms.conf
6060
**/target
6161
**/*.rs.bk
6262
**/Cargo.lock
63+
64+
# Generated Files at Compile Time
65+
66+
kernel/ld/aarch64-link-bsp.lds
67+
x86_64_uefi_pxe_boot/*
68+
69+
.ovmfpath/

.vscode/settings.json

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,53 @@
11
{
2-
// For AArch64
2+
"rust-analyzer.showUnlinkedFileNotification": false,
3+
"tlaplus.tlc.modelChecker.options": "-workers auto",
4+
"editor.formatOnSave": true,
5+
// For AArch64 Virt
36
// "rust-analyzer.cargo.buildScripts.overrideCommand": [
47
// "cargo",
5-
// "+nightly",
8+
// "+nightly-2025-05-22",
69
// "check_no_std",
7-
// "--target=aarch64-kernel.json",
10+
// "--target=targets/aarch64-kernel.json",
811
// ],
912
// "rust-analyzer.check.overrideCommand": [
1013
// "cargo",
11-
// "+nightly",
14+
// "+nightly-2025-05-22",
1215
// "check_no_std",
13-
// "--target=aarch64-kernel.json",
16+
// "--target=targets/aarch64-kernel.json",
17+
// ],
18+
// "rust-analyzer.cargo.features": [
19+
// "aarch64_virt"
1420
// ],
15-
// "rust-analyzer.cargo.features": ["aarch64"],
1621
// For x86_64
1722
"rust-analyzer.cargo.buildScripts.overrideCommand": [
1823
"cargo",
19-
"+nightly",
24+
"+nightly-2025-05-22",
2025
"check_no_std",
21-
"--target=x86_64-kernel.json",
26+
"--target=targets/x86_64-kernel.json",
2227
],
2328
"rust-analyzer.check.overrideCommand": [
2429
"cargo",
25-
"+nightly",
30+
"+nightly-2025-05-22",
2631
"check_no_std",
27-
"--target=x86_64-kernel.json",
32+
"--target=targets/x86_64-kernel.json",
2833
],
2934
"rust-analyzer.cargo.features": [
30-
"raspi4"
35+
"x86"
3136
],
32-
"rust-analyzer.showUnlinkedFileNotification": false,
33-
"tlaplus.tlc.modelChecker.options": "-workers auto",
3437
// For Linux
3538
// "rust-analyzer.cargo.buildScripts.overrideCommand": [
3639
// "cargo",
37-
// "+nightly",
40+
// "+nightly-2025-05-22",
3841
// "check_std",
42+
// "--quiet",
43+
// "--message-format=json"
3944
// ],
4045
// "rust-analyzer.check.overrideCommand": [
4146
// "cargo",
42-
// "+nightly",
47+
// "+nightly-2025-05-22",
4348
// "check_std",
49+
// "--quiet",
50+
// "--message-format=json"
4451
// ],
4552
// "rust-analyzer.cargo.features": [
4653
// "std"

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ members = [
1010
"awkernel_lib",
1111
"awkernel_aarch64",
1212
"awkernel_drivers",
13-
"applications/awkernel_shell"
13+
"applications/awkernel_services",
14+
"applications/awkernel_shell",
15+
"applications/awkernel_display",
16+
"applications/rd_gen_to_dags",
17+
"applications/tests/*",
18+
"smoltcp",
19+
"awkernel_futures_macro",
1420
]
1521

1622
resolver = "2"

LICENSE

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -201,27 +201,3 @@
201201
limitations under the License.
202202

203203
/******************************************************************************/
204-
205-
The xv6 software is:
206-
207-
Copyright (c) 2006-2018 Frans Kaashoek, Robert Morris, Russ Cox,
208-
Massachusetts Institute of Technology
209-
210-
Permission is hereby granted, free of charge, to any person obtaining
211-
a copy of this software and associated documentation files (the
212-
"Software"), to deal in the Software without restriction, including
213-
without limitation the rights to use, copy, modify, merge, publish,
214-
distribute, sublicense, and/or sell copies of the Software, and to
215-
permit persons to whom the Software is furnished to do so, subject to
216-
the following conditions:
217-
218-
The above copyright notice and this permission notice shall be
219-
included in all copies or substantial portions of the Software.
220-
221-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
222-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
223-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
224-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
225-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
226-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
227-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)