diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2487144c3..59151f21a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,20 +13,29 @@ jobs: matrix: rust-toolchain: [nightly, nightly-2025-05-20] arch: [x86_64, riscv64, aarch64, loongarch64] + include: + - arch: x86_64 + target: x86_64-unknown-none + - arch: riscv64 + target: riscv64gc-unknown-none-elf + - arch: aarch64 + target: aarch64-unknown-none-softfloat + - arch: loongarch64 + target: loongarch64-unknown-none-softfloat steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust-toolchain }} components: rust-src, clippy, rustfmt - targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat, loongarch64-unknown-none - - name: Setup ArceOS - run: ./scripts/get_deps.sh + targets: ${{ matrix.target }} - name: Check rust version run: rustc --version --verbose - uses: arceos-org/setup-musl@v1 with: arch: ${{ matrix.arch }} + - name: Setup ArceOS + run: ./scripts/get_deps.sh - name: Check code format continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} run: cargo fmt --all -- --check @@ -35,53 +44,68 @@ jobs: run: make clippy ARCH=${{ matrix.arch }} build: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - os: [ubuntu-latest] arch: [x86_64, riscv64, aarch64, loongarch64] rust-toolchain: [nightly, nightly-2025-05-20] + include: + - arch: x86_64 + target: x86_64-unknown-none + - arch: riscv64 + target: riscv64gc-unknown-none-elf + - arch: aarch64 + target: aarch64-unknown-none-softfloat + - arch: loongarch64 + target: loongarch64-unknown-none-softfloat steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust-toolchain }} components: rust-src, llvm-tools - targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat, loongarch64-unknown-none + targets: ${{ matrix.target }} - uses: Swatinem/rust-cache@v2 with: shared-key: cargo-bin-cache cache-targets: false - - run: cargo install cargo-binutils - - run: ./scripts/get_deps.sh - uses: arceos-org/setup-musl@v1 with: arch: ${{ matrix.arch }} + - name: Setup ArceOS + run: ./scripts/get_deps.sh - name: Build for ${{ matrix.arch }} continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} run: make ARCH=${{ matrix.arch }} build test-musl: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - os: [ubuntu-latest] arch: [x86_64, riscv64, aarch64, loongarch64] rust-toolchain: [nightly-2025-05-20] + include: + - arch: x86_64 + target: x86_64-unknown-none + - arch: riscv64 + target: riscv64gc-unknown-none-elf + - arch: aarch64 + target: aarch64-unknown-none-softfloat + - arch: loongarch64 + target: loongarch64-unknown-none-softfloat steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust-toolchain }} components: rust-src, llvm-tools + targets: ${{ matrix.target }} - uses: Swatinem/rust-cache@v2 with: shared-key: cargo-bin-cache cache-targets: false - - run: cargo install cargo-binutils - - run: ./scripts/get_deps.sh - uses: arceos-org/setup-musl@v1 with: arch: ${{ matrix.arch }} @@ -89,6 +113,8 @@ jobs: with: version: ${{ env.qemu-version }} arch_list: x86_64,aarch64,riscv64,loongarch64 + - name: Setup ArceOS + run: ./scripts/get_deps.sh - name: Build rustup target if: ${{ matrix.arch != 'riscv64' }} run: rustup target add ${{ matrix.arch }}-unknown-linux-musl @@ -96,25 +122,32 @@ jobs: run: make test ARCH=${{ matrix.arch }} test-oscomp: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - os: [ubuntu-latest] arch: [x86_64, riscv64, aarch64, loongarch64] rust-toolchain: [nightly-2025-05-20] + include: + - arch: x86_64 + target: x86_64-unknown-none + - arch: riscv64 + target: riscv64gc-unknown-none-elf + - arch: aarch64 + target: aarch64-unknown-none-softfloat + - arch: loongarch64 + target: loongarch64-unknown-none-softfloat steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust-toolchain }} components: rust-src, llvm-tools + targets: ${{ matrix.target }} - uses: Swatinem/rust-cache@v2 with: shared-key: cargo-bin-cache cache-targets: false - - run: cargo install cargo-binutils - - run: ./scripts/get_deps.sh - uses: arceos-org/setup-musl@v1 with: arch: ${{ matrix.arch }} @@ -131,6 +164,8 @@ jobs: gunzip sdcard-${{ matrix.arch }}.img.gz - name: Build python environment run: sudo apt-get install -y python3 python3-pip + - name: Setup ArceOS + run: ./scripts/get_deps.sh - name: Run tests for oscomp musl testcases run: make oscomp_test ARCH=${{ matrix.arch }} LIBC=musl - name: Run tests for oscomp glibc testcases diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7698a0a4f..f2196abfc 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,11 +23,11 @@ jobs: with: shared-key: cargo-bin-cache cache-targets: false - - run: cargo install cargo-binutils - - run: ./scripts/get_deps.sh - uses: arceos-org/setup-musl@v1 with: arch: x86_64 + - name: Setup ArceOS + run: ./scripts/get_deps.sh - name: Build docs continue-on-error: ${{ github.ref != env.default-branch && github.event_name != 'pull_request' }} run: make doc diff --git a/Cargo.lock b/Cargo.lock index a6b99aad9..28e9d5213 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,6 +11,15 @@ dependencies = [ "tock-registers 0.9.0", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "allocator" version = "0.1.1" @@ -23,9 +32,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.18" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" dependencies = [ "anstyle", "anstyle-parse", @@ -38,36 +47,36 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" dependencies = [ "anstyle", - "once_cell", + "once_cell_polyfill", "windows-sys", ] @@ -90,19 +99,19 @@ dependencies = [ ] [[package]] -name = "atomic-polyfill" -version = "1.0.3" +name = "arm_pl031" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +checksum = "13696b1c2b59992f4223e0ae5bb173c81c63039367ca90eee845346ad2a13421" dependencies = [ - "critical-section", + "chrono", ] [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "axalloc" @@ -120,29 +129,51 @@ dependencies = [ name = "axconfig" version = "0.1.0" dependencies = [ - "axconfig-gen-macros", + "axconfig-macros", ] [[package]] name = "axconfig-gen" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ffa518605969ff8f4ebce2cdc3b6090345152c14987ec540601335effbf36d5" +checksum = "0bf14099a96dbb925e39a44c4f25555f1e24516194452a84a943aa7eda62383d" dependencies = [ "clap", "toml_edit", ] [[package]] -name = "axconfig-gen-macros" -version = "0.1.0" +name = "axconfig-macros" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92110c7e7a5633d7fb8a402393c91c326ad6d19710bb9cfa5ab4095e63c25948" +checksum = "f86a6711b80fbd1dc4c1d8e2fb77a5de6fc8e2eb2b96bbd0420ca8af370eb74c" dependencies = [ "axconfig-gen", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", +] + +[[package]] +name = "axcpu" +version = "0.2.1" +source = "git+https://github.com/Starry-Mix-THU/axcpu.git?rev=4d95bb0#4d95bb0e6ca7793e84329dad0122ba0c294cd9b7" +dependencies = [ + "aarch64-cpu", + "cfg-if", + "lazyinit", + "linkme", + "log", + "loongArch64", + "memory_addr", + "page_table_entry", + "page_table_multiarch", + "percpu", + "riscv", + "static_assertions", + "tock-registers 0.9.0", + "x86", + "x86_64 0.15.2", ] [[package]] @@ -254,9 +285,9 @@ dependencies = [ [[package]] name = "axfs_devfs" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d62eff0490e10cd2c2a74be2979820f0293fa5ebe00ee8bfd87b88ac7dd7d235" +checksum = "81b87ae981272ca8d5d8f106a4452c63f4b5ac36e17ee8f848ee1b250538b9f8" dependencies = [ "axfs_vfs", "log", @@ -265,9 +296,9 @@ dependencies = [ [[package]] name = "axfs_ramfs" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db46c6dae25a123579d5fdcdcc502d0dc2a8af86646106004c8a9181433271b1" +checksum = "9f50c26614485d837a3fc09a92f24a226caddc25a30df7e6aaf4bd19b304c399" dependencies = [ "axfs_vfs", "log", @@ -276,12 +307,12 @@ dependencies = [ [[package]] name = "axfs_vfs" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2314ebe07a2fef7b1c1a7d15ab817941cd306ace651bb50024b5a8b3e8485359" +checksum = "dcba2006898d7879d456a9c34b9c9460cb536f5bf69d1d5d7d0e0f19f073368d" dependencies = [ "axerrno", - "bitflags 2.9.0", + "bitflags 2.9.1", "log", ] @@ -290,35 +321,24 @@ name = "axhal" version = "0.1.0" dependencies = [ "aarch64-cpu", - "arm_gicv2", - "arm_pl011", "axalloc", "axconfig", + "axcpu", "axlog", - "bitflags 2.9.0", + "axplat", + "axplat-aarch64-qemu-virt", + "axplat-loongarch64-qemu-virt", + "axplat-riscv64-qemu-virt", + "axplat-x86-pc", "cfg-if", - "dw_apb_uart", - "handler_table", - "int_ratio", + "heapless", "kernel_guard", - "kspin", "lazyinit", "linkme", "log", - "loongArch64", "memory_addr", - "ns16550a", - "page_table_entry", "page_table_multiarch", "percpu", - "raw-cpuid 11.5.0", - "riscv 0.13.0", - "sbi-rt", - "static_assertions", - "tock-registers 0.9.0", - "x2apic", - "x86", - "x86_64 0.15.2", ] [[package]] @@ -353,6 +373,7 @@ dependencies = [ "log", "memory_addr", "memory_set", + "page_table_multiarch", ] [[package]] @@ -381,10 +402,124 @@ dependencies = [ "lazyinit", ] +[[package]] +name = "axplat" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86cdb48cf1fbd432f4326ab0852b696ac49442b0ea0aed3401cb0bbe370a19f" +dependencies = [ + "axplat-macros", + "bitflags 2.9.1", + "const-str", + "crate_interface", + "handler_table", + "kspin", + "memory_addr", +] + +[[package]] +name = "axplat-aarch64-peripherals" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3455ad3c2e0da36047388ac263aa6cf6b80ad80a2d9f1186d73fec2f0cafc7" +dependencies = [ + "aarch64-cpu", + "arm_gicv2", + "arm_pl011", + "arm_pl031", + "axcpu", + "axplat", + "int_ratio", + "kspin", + "lazyinit", + "log", + "page_table_entry", +] + +[[package]] +name = "axplat-aarch64-qemu-virt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d5d75b950e70a6548b8537aecded7ccafdd3ec639057c4c7c7d6d05b09d0e4d" +dependencies = [ + "axconfig-macros", + "axcpu", + "axplat", + "axplat-aarch64-peripherals", + "log", + "page_table_entry", +] + +[[package]] +name = "axplat-loongarch64-qemu-virt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb82011898513ca97dce6861b68a97eb56608ddb974a727cd761083c2bd8836" +dependencies = [ + "axconfig-macros", + "axcpu", + "axplat", + "kspin", + "lazyinit", + "log", + "loongArch64", + "ns16550a", + "page_table_entry", +] + +[[package]] +name = "axplat-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90dfaee06a112fe4f810c60af1a86bc080af2172185b491cacc307b84dff748" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "axplat-riscv64-qemu-virt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40f16634061d2efb7a0ee5fd9ec339d75547b3a967d238b9ba5711c5c6f01c5a" +dependencies = [ + "axconfig-macros", + "axcpu", + "axplat", + "log", + "riscv", + "sbi-rt", +] + +[[package]] +name = "axplat-x86-pc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5cd7aa6fbc9d3be3733cb5df6d800375a288e634036bf6c2d3ac08b64fc5283" +dependencies = [ + "axconfig-macros", + "axcpu", + "axplat", + "bitflags 2.9.1", + "heapless", + "int_ratio", + "kspin", + "lazyinit", + "log", + "multiboot", + "percpu", + "raw-cpuid 11.5.0", + "uart_16550", + "x2apic", + "x86", + "x86_64 0.15.2", +] + [[package]] name = "axprocess" version = "0.1.0" -source = "git+https://github.com/Starry-OS/axprocess.git#f6f0d08f202be9310ec2b72d73915b5017fac631" +source = "git+https://github.com/Starry-Mix-THU/axprocess.git?rev=1666809#16668091f34fcc7224bbc2544a6012f2d6f3a6a6" dependencies = [ "kspin", "lazyinit", @@ -403,24 +538,23 @@ dependencies = [ "axlog", "axmm", "axnet", + "axplat", "axtask", "chrono", "crate_interface", "ctor_bare", - "kernel_guard", "percpu", ] [[package]] name = "axsignal" -version = "0.1.0" -source = "git+https://github.com/Starry-OS/axsignal.git?rev=b5b6089#b5b6089c40a989ff8ae434ec32ea388b7a9d7a11" +version = "0.2.0" +source = "git+https://github.com/Starry-Mix-THU/axsignal.git?rev=dd359f6#dd359f685e96cf47009ef5ee39e8d1aca9a5e414" dependencies = [ - "axconfig", + "axcpu", "axerrno", - "axhal", - "axtask", - "bitflags 2.9.0", + "axplat", + "bitflags 2.9.1", "cfg-if", "derive_more", "linux-raw-sys", @@ -463,6 +597,26 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "bindgen" +version = "0.71.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +dependencies = [ + "bitflags 2.9.1", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.104", +] + [[package]] name = "bit" version = "0.1.1" @@ -483,9 +637,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bitmap-allocator" @@ -514,29 +668,49 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9b24894fa5f73bbf9c72196e7f495a1f81d6218a548280a09ada4a937157692" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "num-traits", ] +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" -version = "4.5.34" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e958897981290da2a852763fe9cdb89cd36977a5d729023127095fa94d95e2ff" +checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" dependencies = [ "clap_builder", "clap_derive", @@ -544,9 +718,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.34" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b0f35019843db2160b5bb19ae09b4e6411ac33fc6a712003c33e03090e2489" +checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" dependencies = [ "anstream", "anstyle", @@ -556,27 +730,27 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "const-default" @@ -584,6 +758,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" +[[package]] +name = "const-str" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e991226a70654b49d34de5ed064885f0bef0348a8e70018b8ff1ac80aa984a2" + [[package]] name = "convert_case" version = "0.7.1" @@ -610,7 +790,7 @@ checksum = "70272a03a2cef15589bac05d3d15c023752f5f8f2da8be977d983a9d9e6250fb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -636,14 +816,23 @@ checksum = "9a49d5cd78b1c748184d41407b14a58af8403c13328ff2b9f49b0a418c24e3ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "defmt" -version = "0.3.10" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + +[[package]] +name = "defmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -651,22 +840,22 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.4.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "defmt-parser" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ "thiserror", ] @@ -689,18 +878,15 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", "unicode-xid", ] [[package]] -name = "dw_apb_uart" -version = "0.1.0" +name = "either" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93d496c8faa9dc676ebfa225432e1e3b57645c9268ead889286546f6d39356d" -dependencies = [ - "tock-registers 0.8.1", -] +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "embedded-hal" @@ -719,19 +905,25 @@ name = "fatfs" version = "0.4.0" source = "git+https://github.com/rafalh/rust-fatfs?rev=85f06e0#85f06e08edbd3368e1b0562f2fc1b6d178bf7b8a" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "log", ] [[package]] name = "flatten_objects" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e362dae0b64fc12551b655a09484a643461a283a078fb8a9686d1f58fa46df9a" +checksum = "2f7719d63de27ac93e7cd2c8e0c03083f8b0ff7f842fdb6280b8cdcac21b4baf" dependencies = [ "bitmaps", ] +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + [[package]] name = "handler_table" version = "0.1.2" @@ -740,29 +932,26 @@ checksum = "702cb690200d6303c1e1992bc648f3f3bf9c1d6a27fcf50551c513d61f339c99" [[package]] name = "hash32" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" dependencies = [ "byteorder", ] [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" [[package]] name = "heapless" -version = "0.7.17" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ - "atomic-polyfill", "hash32", - "rustc_version", - "spin", "stable_deref_trait", ] @@ -774,9 +963,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" -version = "2.8.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown", @@ -784,9 +973,9 @@ dependencies = [ [[package]] name = "int_ratio" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd361c344145620f0c02e56200ca3e3a45203121447376519a9070e546b2916f" +checksum = "6045ea39e8d2862506c0dff6c65d068da362335df698bb1634033492740d2170" [[package]] name = "is_terminal_polyfill" @@ -795,10 +984,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] -name = "kernel-elf-parser" -version = "0.3.2" +name = "itertools" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "102999b07d80f34c1dca0d9e8f24adaa8028708842d39a3e5b98f4f085755627" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "kernel-elf-parser" +version = "0.3.3" +source = "git+https://github.com/Azure-stars/kernel_elf_parser.git?rev=f197de3#f197de31d179a394213380bd05e6cc98c369515e" dependencies = [ "axerrno", "cfg-if", @@ -830,15 +1027,25 @@ dependencies = [ [[package]] name = "lazyinit" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3861aac8febbb038673bf945ee47ac67940ca741b94d1bb3ff6066af2a181338" +checksum = "17f03abfebdaaf0fad16790237a0348baf84886d3ade460db13bae59e614a180" [[package]] name = "libc" -version = "0.2.171" +version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "libloading" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" +dependencies = [ + "cfg-if", + "windows-targets", +] [[package]] name = "linked_list" @@ -862,7 +1069,7 @@ checksum = "04d55ca5d5a14363da83bf3c33874b8feaa34653e760d5216d7ef9829c88001a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -873,9 +1080,9 @@ checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" dependencies = [ "autocfg", "scopeguard", @@ -894,14 +1101,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c9f0d275c70310e2a9d2fc23250c5ac826a73fa828a5f256401f85c5c554283" dependencies = [ "bit_field", - "bitflags 2.9.0", + "bitflags 2.9.1", ] [[package]] name = "lwext4_rust" version = "0.2.0" -source = "git+https://github.com/Azure-stars/lwext4_rust.git#2e56b0aa2680b210892a46375fefca2bdf6e2865" +source = "git+https://github.com/Starry-Mix-THU/lwext4_rust.git?rev=a6b4a31#a6b4a3159c2a7696eca4da7329f0819ac9995e89" dependencies = [ + "bindgen", "log", ] @@ -913,25 +1121,50 @@ checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "memory_addr" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5438b8df0f13e16e1f46140de247695a95952a5a4479e47197a8711bf1063373" +checksum = "3d4054cba279515fa87761b101d857333ce06391dbe8f18a11347204a7111416" [[package]] name = "memory_set" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4552d02c866c57e8b06b919ea8c2f8f398cad245b8f6aac726657bc972d663d" +checksum = "e7d47cbc25a4d00427f9070fd768eaf907f19c903fb72b547b19db2d56b9408e" dependencies = [ "memory_addr", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "multiboot" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87ad3b7b7bcf5da525c22221e3eb3a020cd68b2d55ae62f629c15e8bc3bd56e" +dependencies = [ + "paste", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "ns16550a" version = "0.5.0" @@ -949,22 +1182,23 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" dependencies = [ "num_enum_derive", + "rustversion", ] [[package]] name = "num_enum_derive" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -974,31 +1208,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e4bdb6b46b592948e700ea1ef24a4296491f6a0ee722b258040abd15a3714" [[package]] -name = "once_cell" -version = "1.21.3" +name = "once_cell_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "page_table_entry" -version = "0.5.3" -source = "git+https://github.com/Mivik/page_table_multiarch.git?rev=19ededd#19ededdb806ab3b22efb4880661790524fa421a5" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba811ef8ca8fb33d776e128624cb4fe25c9804cab96f83b822d4322431e6dd5a" dependencies = [ "aarch64-cpu", - "bitflags 2.9.0", + "bitflags 2.9.1", "memory_addr", "x86_64 0.15.2", ] [[package]] name = "page_table_multiarch" -version = "0.5.3" -source = "git+https://github.com/Mivik/page_table_multiarch.git?rev=19ededd#19ededdb806ab3b22efb4880661790524fa421a5" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98cb76e21ce462270afd83b331599d5b83f876c2a98c0a70382b20d73e1da6be" dependencies = [ + "bitmaps", "log", "memory_addr", "page_table_entry", - "riscv 0.12.1", + "riscv", "x86", ] @@ -1028,7 +1265,17 @@ checksum = "8a9f4cc54a2e471ff72f1499461ba381ad4eae9cbd60d29c258545b995e406e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", +] + +[[package]] +name = "prettyplease" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" +dependencies = [ + "proc-macro2", + "syn 2.0.104", ] [[package]] @@ -1050,14 +1297,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -1086,26 +1333,43 @@ version = "11.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", ] [[package]] -name = "riscv" -version = "0.12.1" +name = "regex" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ - "critical-section", - "embedded-hal", - "paste", - "riscv-pac", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + [[package]] name = "riscv" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa3cdbeccae4359f6839a00e8b77e5736caa200ba216caf38d24e4c16e2b586" +checksum = "0f1671c79a01a149fe000af2429ce9ccc8e58cdecda72672355d50e5536b363c" dependencies = [ "critical-section", "embedded-hal", @@ -1122,7 +1386,7 @@ checksum = "e8c4aa1ea1af6dcc83a61be12e8189f9b293c3ba5a487778a4cd89fb060fdbbc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -1144,19 +1408,16 @@ dependencies = [ ] [[package]] -name = "rustc_version" -version = "0.4.1" +name = "rustc-hash" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "sbi-rt" @@ -1187,12 +1448,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "semver" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" - [[package]] name = "shlex" version = "1.3.0" @@ -1201,13 +1456,13 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "smoltcp" -version = "0.10.0" -source = "git+https://github.com/rcore-os/smoltcp.git?rev=2ade274#2ade2747abc4d779d0836154b0413d13ce16cd5b" +version = "0.12.0" +source = "git+https://github.com/rcore-os/smoltcp.git?rev=21a2f82#21a2f82b062ec88442eb624d7fcec1feeb886496" dependencies = [ "bitflags 1.3.2", "byteorder", "cfg-if", - "defmt", + "defmt 0.3.100", "heapless", "log", "managed", @@ -1268,7 +1523,7 @@ dependencies = [ "axsignal", "axsync", "axtask", - "bitflags 2.9.0", + "bitflags 2.9.1", "cfg-if", "ctor_bare", "flatten_objects", @@ -1296,6 +1551,7 @@ dependencies = [ "axsignal", "axsync", "axtask", + "cfg-if", "crate_interface", "kernel-elf-parser", "linkme", @@ -1329,7 +1585,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -1358,9 +1614,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", @@ -1389,7 +1645,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -1412,21 +1668,39 @@ checksum = "2b9e2fdb3a1e862c0661768b7ed25390811df1947a8acbfbefe09b47078d93c4" [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" [[package]] name = "toml_edit" -version = "0.22.24" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", "toml_datetime", + "toml_write", "winnow", ] +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "uart_16550" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e492212ac378a5e00da953718dafb1340d9fbaf4f27d6f3c5cab03d931d1c049" +dependencies = [ + "bitflags 2.9.1", + "rustversion", + "x86", +] + [[package]] name = "unicode-ident" version = "1.0.18" @@ -1463,7 +1737,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa40e09453618c7a927c08c5a990497a2954da7c2aaa6c65e0d4f0fc975f6114" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "log", "zerocopy", ] @@ -1476,8 +1750,9 @@ checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793" [[package]] name = "weak-map" -version = "0.1.0" -source = "git+https://github.com/Starry-OS/weak-map.git#6a528cb160b8e2bcdb6bbc1b4086aa1de08e73ec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "209bc3ff6d982801239e57fa3b8b3505d4fc41102d1d162cca38b325297fe77b" [[package]] name = "windows-sys" @@ -1554,9 +1829,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.4" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" +checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" dependencies = [ "memchr", ] @@ -1592,7 +1867,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c101112411baafbb4bf8d33e4c4a80ab5b02d74d2612331c61e8192fc9710491" dependencies = [ "bit_field", - "bitflags 2.9.0", + "bitflags 2.9.1", "rustversion", "volatile", ] @@ -1604,7 +1879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f042214de98141e9c8706e8192b73f56494087cc55ebec28ce10f26c5c364ae" dependencies = [ "bit_field", - "bitflags 2.9.0", + "bitflags 2.9.1", "rustversion", "volatile", ] @@ -1642,5 +1917,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] diff --git a/Cargo.toml b/Cargo.toml index 9d11edb59..cc80f6dfe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ repository = "https://github.com/arceos-org/starry-next" [workspace.dependencies] axfeat = { git = "https://github.com/oscomp/arceos.git", features = [ + "fp-simd", "fs", "irq", "multitask", @@ -35,8 +36,8 @@ axruntime = { git = "https://github.com/oscomp/arceos.git" } axsync = { git = "https://github.com/oscomp/arceos.git" } axtask = { git = "https://github.com/oscomp/arceos.git" } -axprocess = { git = "https://github.com/Starry-OS/axprocess.git" } -axsignal = { git = "https://github.com/Starry-OS/axsignal.git", rev = "b5b6089" } +axprocess = { git = "https://github.com/Starry-Mix-THU/axprocess.git", rev = "1666809" } +axsignal = { git = "https://github.com/Starry-Mix-THU/axsignal.git", rev = "dd359f6" } axerrno = "0.1" bitflags = "2.6" @@ -49,7 +50,7 @@ linux-raw-sys = { version = "0.9.3", default-features = false, features = [ "prctl", "system", ] } -memory_addr = "0.3" +memory_addr = "0.4" spin = "0.9" starry-core = { path = "./core" } @@ -64,6 +65,7 @@ homepage.workspace = true repository.workspace = true [features] +defplat = ["axfeat/defplat"] lwext4_rs = ["axfeat/lwext4_rs"] [dependencies] @@ -90,5 +92,4 @@ shlex = { version = "1.3.0", default-features = false } syscalls = { git = "https://github.com/jasonwhite/syscalls.git", rev = "92624de", default-features = false } [patch.crates-io] -page_table_multiarch = { git = "https://github.com/Mivik/page_table_multiarch.git", rev = "19ededd" } -page_table_entry = { git = "https://github.com/Mivik/page_table_multiarch.git", rev = "19ededd" } +axcpu = { git = "https://github.com/Starry-Mix-THU/axcpu.git", rev = "4d95bb0" } diff --git a/Makefile b/Makefile index 3d5d3fd21..aac49a220 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,11 @@ AX_TESTCASE ?= nimbos ARCH ?= x86_64 LOG ?= off AX_TESTCASES_LIST=$(shell cat ./apps/$(AX_TESTCASE)/testcase_list | tr '\n' ',') -FEATURES ?= fp_simd export NO_AXSTD := y export AX_LIB := axfeat RUSTDOCFLAGS := -Z unstable-options --enable-index-page -D rustdoc::broken_intra_doc_links -D missing-docs -EXTRA_CONFIG ?= $(PWD)/configs/$(ARCH).toml ifneq ($(filter $(MAKECMDGOALS),doc),) # make doc export RUSTDOCFLAGS else ifeq ($(filter $(MAKECMDGOALS),clean user_apps ax_root),) # Not make clean, user_apps, ax_root @@ -24,15 +22,11 @@ OUT_BIN := $(DIR)_$(ARCH)-qemu-virt.bin ifeq ($(ARCH), x86_64) TARGET := x86_64-unknown-none else ifeq ($(ARCH), aarch64) - ifeq ($(findstring fp_simd,$(FEATURES)),) - TARGET := aarch64-unknown-none-softfloat - else - TARGET := aarch64-unknown-none - endif + TARGET := aarch64-unknown-none-softfloat else ifeq ($(ARCH), riscv64) TARGET := riscv64gc-unknown-none-elf else ifeq ($(ARCH), loongarch64) - TARGET := loongarch64-unknown-none + TARGET := loongarch64-unknown-none-softfloat else $(error ARCH must be one of x86_64, aarch64, riscv64, loongarch64) endif @@ -43,7 +37,7 @@ all: oscomp_build # export dummy config for clippy clippy: defconfig - @AX_CONFIG_PATH=$(PWD)/.axconfig.toml cargo clippy --target $(TARGET) --all-features -- -D warnings -A clippy::new_without_default + @cargo clippy --target $(TARGET) --all-features -- -D warnings -A clippy::new_without_default ax_root: @./scripts/set_ax_root.sh $(AX_ROOT) @@ -62,7 +56,7 @@ test: defconfig @./scripts/app_test.sh defconfig build run justrun debug disasm: ax_root - @make -C $(AX_ROOT) A=$(PWD) EXTRA_CONFIG=$(EXTRA_CONFIG) $@ + @make -C $(AX_ROOT) A=$(PWD) $@ clean: ax_root @make -C $(AX_ROOT) A=$(PWD) ARCH=$(ARCH) clean @@ -72,6 +66,6 @@ clean: ax_root @cargo clean doc: defconfig - @AX_CONFIG_PATH=$(PWD)/.axconfig.toml cargo doc --no-deps --all-features --workspace + @cargo doc --no-deps --all-features --workspace .PHONY: all ax_root build run justrun debug disasm clean test_build diff --git a/api/src/imp/mm/brk.rs b/api/src/imp/mm/brk.rs index 1276d9f6e..8d2177683 100644 --- a/api/src/imp/mm/brk.rs +++ b/api/src/imp/mm/brk.rs @@ -6,7 +6,8 @@ pub fn sys_brk(addr: usize) -> LinuxResult { let process_data = task.task_ext().process_data(); let mut return_val: isize = process_data.get_heap_top() as isize; let heap_bottom = process_data.get_heap_bottom() as usize; - if addr != 0 && addr >= heap_bottom && addr <= heap_bottom + axconfig::plat::USER_HEAP_SIZE { + if addr != 0 && addr >= heap_bottom && addr <= heap_bottom + starry_core::config::USER_HEAP_SIZE + { process_data.set_heap_top(addr); return_val = addr as isize; } diff --git a/api/src/imp/mm/mmap.rs b/api/src/imp/mm/mmap.rs index a33b0fc71..1ac807e44 100644 --- a/api/src/imp/mm/mmap.rs +++ b/api/src/imp/mm/mmap.rs @@ -168,7 +168,7 @@ pub fn sys_munmap(addr: usize, length: usize) -> LinuxResult { let length = align_up_4k(length); let start_addr = VirtAddr::from(addr); aspace.unmap(start_addr, length)?; - axhal::arch::flush_tlb(None); + axhal::asm::flush_tlb(None); Ok(0) } diff --git a/api/src/imp/signal.rs b/api/src/imp/signal.rs index 642294bfb..721ca767f 100644 --- a/api/src/imp/signal.rs +++ b/api/src/imp/signal.rs @@ -2,7 +2,7 @@ use core::{mem, time::Duration}; use alloc::sync::Arc; use axerrno::{LinuxError, LinuxResult}; -use axhal::arch::TrapFrame; +use axhal::context::TrapFrame; use axprocess::{Pid, Thread}; use axsignal::{SignalInfo, SignalSet, SignalStack, Signo}; use axtask::{TaskExtRef, current}; diff --git a/api/src/imp/task/clone.rs b/api/src/imp/task/clone.rs index 5308a1178..8287e7821 100644 --- a/api/src/imp/task/clone.rs +++ b/api/src/imp/task/clone.rs @@ -1,7 +1,7 @@ use alloc::sync::Arc; use axerrno::{LinuxError, LinuxResult}; use axfs::{CURRENT_DIR, CURRENT_DIR_PATH}; -use axhal::arch::{TrapFrame, UspaceContext}; +use axhal::context::{TrapFrame, UspaceContext}; use axprocess::Pid; use axsignal::Signo; use axsync::Mutex; diff --git a/api/src/imp/task/execve.rs b/api/src/imp/task/execve.rs index 884c883b0..e4bf71e13 100644 --- a/api/src/imp/task/execve.rs +++ b/api/src/imp/task/execve.rs @@ -2,7 +2,7 @@ use core::ffi::c_char; use alloc::{string::ToString, vec::Vec}; use axerrno::{LinuxError, LinuxResult}; -use axhal::arch::TrapFrame; +use axhal::context::TrapFrame; use axtask::{TaskExtRef, current}; use starry_core::mm::{load_user_app, map_trampoline}; @@ -44,7 +44,7 @@ pub fn sys_execve( let mut aspace = curr_ext.process_data().aspace.lock(); aspace.unmap_user_areas()?; map_trampoline(&mut aspace)?; - axhal::arch::flush_tlb(None); + axhal::asm::flush_tlb(None); let (entry_point, user_stack_base) = load_user_app(&mut aspace, &args, &envs).map_err(|_| { diff --git a/api/src/imp/task/thread.rs b/api/src/imp/task/thread.rs index 39a9a47bd..e209cfbf0 100644 --- a/api/src/imp/task/thread.rs +++ b/api/src/imp/task/thread.rs @@ -54,7 +54,7 @@ pub fn sys_set_tid_address(clear_child_tid: usize) -> LinuxResult { #[cfg(target_arch = "x86_64")] pub fn sys_arch_prctl( - tf: &mut axhal::arch::TrapFrame, + tf: &mut axhal::context::TrapFrame, code: i32, addr: usize, ) -> LinuxResult { diff --git a/api/src/ptr.rs b/api/src/ptr.rs index ff48c5ab7..f025fc1a8 100644 --- a/api/src/ptr.rs +++ b/api/src/ptr.rs @@ -3,7 +3,7 @@ use core::{alloc::Layout, ffi::c_char, mem::transmute, ptr, slice, str}; use axerrno::{LinuxError, LinuxResult}; use axhal::paging::MappingFlags; use axtask::{TaskExtRef, current}; -use memory_addr::{MemoryAddr, PAGE_SIZE_4K, VirtAddr, VirtAddrRange}; +use memory_addr::{MemoryAddr, PAGE_SIZE_4K, VirtAddr}; use starry_core::mm::access_user_memory; fn check_region(start: VirtAddr, layout: Layout, access_flags: MappingFlags) -> LinuxResult<()> { @@ -15,10 +15,7 @@ fn check_region(start: VirtAddr, layout: Layout, access_flags: MappingFlags) -> let task = current(); let mut aspace = task.task_ext().process_data().aspace.lock(); - if !aspace.check_region_access( - VirtAddrRange::from_start_size(start, layout.size()), - access_flags, - ) { + if !aspace.can_access_range(start, layout.size(), access_flags) { return Err(LinuxError::EFAULT); } @@ -60,10 +57,7 @@ fn check_null_terminated( // allocated yet. let task = current(); let aspace = task.task_ext().process_data().aspace.lock(); - if !aspace.check_region_access( - VirtAddrRange::from_start_size(page, PAGE_SIZE_4K), - access_flags, - ) { + if !aspace.can_access_range(page, PAGE_SIZE_4K, access_flags) { return Err(LinuxError::EFAULT); } diff --git a/api/src/signal.rs b/api/src/signal.rs index 70d660a42..917ddfb91 100644 --- a/api/src/signal.rs +++ b/api/src/signal.rs @@ -1,6 +1,6 @@ use axerrno::{LinuxError, LinuxResult}; use axhal::{ - arch::TrapFrame, + context::TrapFrame, trap::{POST_TRAP, register_trap_handler}, }; use axprocess::{Process, ProcessGroup, Thread}; diff --git a/apps/libc/test_cmd b/apps/libc/test_cmd index 4cb5e4638..5a0a3a028 100644 --- a/apps/libc/test_cmd +++ b/apps/libc/test_cmd @@ -1 +1 @@ -test_one "LOG=off FEATURES=fp_simd BLK=y NET=y" "expect_off.out" +test_one "LOG=off BLK=y NET=y" "expect_off.out" diff --git a/apps/nimbos/test_cmd b/apps/nimbos/test_cmd index 4cb5e4638..5a0a3a028 100644 --- a/apps/nimbos/test_cmd +++ b/apps/nimbos/test_cmd @@ -1 +1 @@ -test_one "LOG=off FEATURES=fp_simd BLK=y NET=y" "expect_off.out" +test_one "LOG=off BLK=y NET=y" "expect_off.out" diff --git a/build.rs b/build.rs deleted file mode 100644 index 7abb8c1bb..000000000 --- a/build.rs +++ /dev/null @@ -1,72 +0,0 @@ -use std::fs::{File, read_dir}; -use std::io::{Result, Write}; -use std::path::PathBuf; - -fn main() { - println!("cargo:rerun-if-changed=./apps/c/src"); - println!("cargo:rerun-if-changed=./apps/rust/src"); - println!("cargo:rerun-if-changed=.makeargs"); - let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); - link_app_data(&arch).unwrap(); -} - -fn link_app_data(arch: &str) -> Result<()> { - let testcase = option_env!("AX_TESTCASE").unwrap_or("nimbos"); - - let app_path = PathBuf::from(format!("apps/{testcase}/build/{arch}")); - let link_app_path = PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("link_app.S"); - - if let Ok(dir) = read_dir(&app_path) { - let mut apps = dir - .into_iter() - .map(|dir_entry| dir_entry.unwrap().file_name().into_string().unwrap()) - .collect::>(); - apps.sort(); - - let mut f = File::create(link_app_path)?; - writeln!( - f, - " -.section .data -.balign 8 -.global _app_count -_app_count: - .quad {}", - apps.len() - )?; - for i in 0..apps.len() { - writeln!(f, " .quad app_{i}_name")?; - writeln!(f, " .quad app_{i}_start")?; - } - writeln!(f, " .quad app_{}_end", apps.len() - 1)?; - - for (idx, app) in apps.iter().enumerate() { - println!("app_{}: {}", idx, app_path.join(app).display()); - writeln!( - f, - " -app_{0}_name: - .string \"{1}\" -.balign 8 -app_{0}_start: - .incbin \"{2}\" -app_{0}_end:", - idx, - app, - app_path.join(app).display() - )?; - } - } else { - let mut f = File::create(link_app_path)?; - writeln!( - f, - " -.section .data -.balign 8 -.global _app_count -_app_count: - .quad 0" - )?; - } - Ok(()) -} diff --git a/configs/aarch64.toml b/configs/aarch64.toml deleted file mode 100644 index 26fa9f80a..000000000 --- a/configs/aarch64.toml +++ /dev/null @@ -1,23 +0,0 @@ -[plat] -# The base address of the user space. -user-space-base = 0x1000 -# The base address for user interpreter. -user-interp-base = 0x400_0000 -# The size of the user space. -user-space-size = 0x7fff_ffff_f000 - -# The highest address of the user stack. -user-stack-top = 0x7fff_0000_0000 -# The size of the user stack. -user-stack-size = 0x1_0000 - -# The lowest address of the user heap. -user-heap-base = 0x4000_0000 -# The size of the user heap. -user-heap-size = 0x1_0000 - -# The size of the kernel stack. -kernel-stack-size = 0x40000 - -# The address of signal trampoline. -signal-trampoline = 0x4001_0000 diff --git a/configs/dummy.toml b/configs/dummy.toml deleted file mode 100644 index 6f46d2e5d..000000000 --- a/configs/dummy.toml +++ /dev/null @@ -1,73 +0,0 @@ -# Architecture identifier. -arch = "unknown" # str -# Platform identifier. -platform = "dummy" # str -# Stack size of each task. -task-stack-size = 0x40000 # uint -# Number of timer ticks per second (Hz). A timer tick may contain several timer -# interrupts. -ticks-per-sec = 100 # uint -# Number of CPUs -smp = 1 # uint - -# -# Platform configs -# -[plat] -# Platform family. -family = "dummy" # str - -# Base address of the whole physical memory. -phys-memory-base = 0 # uint -# Size of the whole physical memory. -phys-memory-size = 0 # uint -# End address of the whole physical memory. -phys-memory-end = 0 # uint -# Base physical address of the kernel image. -kernel-base-paddr = 0 # uint -# Base virtual address of the kernel image. -kernel-base-vaddr = 0 # uint -# Linear mapping offset, for quick conversions between physical and virtual -# addresses. -phys-virt-offset = 0 # uint -# Offset of bus address and phys address. some boards, the bus address is -# different from the physical address. -phys-bus-offset = 0 # uint -# Kernel address space base. -kernel-aspace-base = 0 # uint -# Kernel address space size. -kernel-aspace-size = 0 # uint -# The size of the kernel stack. -kernel-stack-size = 0 # uint -# The base address of the user space. -user-space-base = 0 # uint -# The base address for user interpreter. -user-interp-base = 0 # uint -# The size of the user space. -user-space-size = 0 # uint -# The highest address of the user stack. -user-stack-top = 0 # uint -# The size of the user stack. -user-stack-size = 0 # uint -# The lowest address of the user heap. -user-heap-base = 0 # uint -# The size of the user heap. -user-heap-size = 0 # uint - -# The address of signal trampoline. -signal-trampoline = 0 - -# -# Device specifications -# -[devices] -# MMIO regions with format (`base_paddr`, `size`). -mmio-regions = [] # [(uint, uint)] -# VirtIO MMIO regions with format (`base_paddr`, `size`). -virtio-mmio-regions = [] # [(uint, uint)] -# Base physical address of the PCIe ECAM space. -pci-ecam-base = 0 # uint -# End PCI bus number. -pci-bus-end = 0 # uint -# PCI device memory ranges. -pci-ranges = [] # [(uint, uint)] diff --git a/configs/loongarch64.toml b/configs/loongarch64.toml deleted file mode 100644 index 066920e99..000000000 --- a/configs/loongarch64.toml +++ /dev/null @@ -1,23 +0,0 @@ -[plat] -# The base address of the user space. -user-space-base = 0x1000 -# The base address for user interpreter. -user-interp-base = 0x400_0000 -# The size of the user space. -user-space-size = 0x3f_ffff_f000 - -# The highest address of the user stack. -user-stack-top = 0x4_0000_0000 -# The size of the user stack. -user-stack-size = 0x1_0000 - -# The lowest address of the user heap. -user-heap-base = 0x4000_0000 -# The size of the user heap. -user-heap-size = 0x1_0000 - -# The size of the kernel stack. -kernel-stack-size = 0x40000 - -# The address of signal trampoline. -signal-trampoline = 0x4001_0000 diff --git a/configs/riscv64.toml b/configs/riscv64.toml deleted file mode 100644 index 066920e99..000000000 --- a/configs/riscv64.toml +++ /dev/null @@ -1,23 +0,0 @@ -[plat] -# The base address of the user space. -user-space-base = 0x1000 -# The base address for user interpreter. -user-interp-base = 0x400_0000 -# The size of the user space. -user-space-size = 0x3f_ffff_f000 - -# The highest address of the user stack. -user-stack-top = 0x4_0000_0000 -# The size of the user stack. -user-stack-size = 0x1_0000 - -# The lowest address of the user heap. -user-heap-base = 0x4000_0000 -# The size of the user heap. -user-heap-size = 0x1_0000 - -# The size of the kernel stack. -kernel-stack-size = 0x40000 - -# The address of signal trampoline. -signal-trampoline = 0x4001_0000 diff --git a/configs/x86_64.toml b/configs/x86_64.toml deleted file mode 100644 index 26fa9f80a..000000000 --- a/configs/x86_64.toml +++ /dev/null @@ -1,23 +0,0 @@ -[plat] -# The base address of the user space. -user-space-base = 0x1000 -# The base address for user interpreter. -user-interp-base = 0x400_0000 -# The size of the user space. -user-space-size = 0x7fff_ffff_f000 - -# The highest address of the user stack. -user-stack-top = 0x7fff_0000_0000 -# The size of the user stack. -user-stack-size = 0x1_0000 - -# The lowest address of the user heap. -user-heap-base = 0x4000_0000 -# The size of the user heap. -user-heap-size = 0x1_0000 - -# The size of the kernel stack. -kernel-stack-size = 0x40000 - -# The address of signal trampoline. -signal-trampoline = 0x4001_0000 diff --git a/core/Cargo.toml b/core/Cargo.toml index 9cf20b203..cffb1f138 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -24,10 +24,13 @@ linkme.workspace = true memory_addr.workspace = true spin.workspace = true +cfg-if.workspace = true crate_interface = "0.1" -kernel-elf-parser = "0.3" +kernel-elf-parser = { git = "https://github.com/Azure-stars/kernel_elf_parser.git", rev = "f197de3" } numeric-enum-macro = "0.2" percpu = "0.2.0" +weak-map = "0.1" xmas-elf = "0.9" -weak-map = { git = "https://github.com/Starry-OS/weak-map.git" } +[target.'cfg(not(any(target_arch = "aarch64", target_arch = "loongarch64")))'.dependencies] +axmm = { workspace = true, features = ["copy-from"] } diff --git a/core/src/config/aarch64.rs b/core/src/config/aarch64.rs new file mode 100644 index 000000000..2cc894160 --- /dev/null +++ b/core/src/config/aarch64.rs @@ -0,0 +1,23 @@ +/// The size of the kernel stack. +pub const KERNEL_STACK_SIZE: usize = 0x40000; + +/// The base address of the user space. +pub const USER_SPACE_BASE: usize = 0x1000; +/// The base address for user interpreter. +pub const USER_SPACE_SIZE: usize = 0x7fff_ffff_f000; + +/// The highest address of the user stack. +pub const USER_STACK_TOP: usize = 0x7fff_0000_0000; +/// The size of the user stack. +pub const USER_STACK_SIZE: usize = 0x8_0000; + +/// The lowest address of the user heap. +pub const USER_HEAP_BASE: usize = 0x4000_0000; +/// The size of the user heap. +pub const USER_HEAP_SIZE: usize = 0x1_0000; + +/// The base address for user interpreter. +pub const USER_INTERP_BASE: usize = 0x400_0000; + +/// The address of signal trampoline. +pub const SIGNAL_TRAMPOLINE: usize = 0x4001_0000; diff --git a/core/src/config/loongarch64.rs b/core/src/config/loongarch64.rs new file mode 100644 index 000000000..7525bbd3b --- /dev/null +++ b/core/src/config/loongarch64.rs @@ -0,0 +1,23 @@ +/// The size of the kernel stack. +pub const KERNEL_STACK_SIZE: usize = 0x40000; + +/// The base address of the user space. +pub const USER_SPACE_BASE: usize = 0x1000; +/// The base address for user interpreter. +pub const USER_SPACE_SIZE: usize = 0x3f_ffff_f000; + +/// The highest address of the user stack. +pub const USER_STACK_TOP: usize = 0x4_0000_0000; +/// The size of the user stack. +pub const USER_STACK_SIZE: usize = 0x8_0000; + +/// The lowest address of the user heap. +pub const USER_HEAP_BASE: usize = 0x4000_0000; +/// The size of the user heap. +pub const USER_HEAP_SIZE: usize = 0x1_0000; + +/// The base address for user interpreter. +pub const USER_INTERP_BASE: usize = 0x400_0000; + +/// The address of signal trampoline. +pub const SIGNAL_TRAMPOLINE: usize = 0x4001_0000; diff --git a/core/src/config/mod.rs b/core/src/config/mod.rs new file mode 100644 index 000000000..8e462b577 --- /dev/null +++ b/core/src/config/mod.rs @@ -0,0 +1,19 @@ +//! Architecture-specific configurations. + +cfg_if::cfg_if! { + if #[cfg(target_arch = "riscv64")] { + mod riscv64; + pub use riscv64::*; + } else if #[cfg(target_arch = "loongarch64")] { + mod loongarch64; + pub use loongarch64::*; + } else if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use x86_64::*; + } else if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use aarch64::*; + } else { + compile_error!("Unsupported architecture"); + } +} diff --git a/core/src/config/riscv64.rs b/core/src/config/riscv64.rs new file mode 100644 index 000000000..7525bbd3b --- /dev/null +++ b/core/src/config/riscv64.rs @@ -0,0 +1,23 @@ +/// The size of the kernel stack. +pub const KERNEL_STACK_SIZE: usize = 0x40000; + +/// The base address of the user space. +pub const USER_SPACE_BASE: usize = 0x1000; +/// The base address for user interpreter. +pub const USER_SPACE_SIZE: usize = 0x3f_ffff_f000; + +/// The highest address of the user stack. +pub const USER_STACK_TOP: usize = 0x4_0000_0000; +/// The size of the user stack. +pub const USER_STACK_SIZE: usize = 0x8_0000; + +/// The lowest address of the user heap. +pub const USER_HEAP_BASE: usize = 0x4000_0000; +/// The size of the user heap. +pub const USER_HEAP_SIZE: usize = 0x1_0000; + +/// The base address for user interpreter. +pub const USER_INTERP_BASE: usize = 0x400_0000; + +/// The address of signal trampoline. +pub const SIGNAL_TRAMPOLINE: usize = 0x4001_0000; diff --git a/core/src/config/x86_64.rs b/core/src/config/x86_64.rs new file mode 100644 index 000000000..2cc894160 --- /dev/null +++ b/core/src/config/x86_64.rs @@ -0,0 +1,23 @@ +/// The size of the kernel stack. +pub const KERNEL_STACK_SIZE: usize = 0x40000; + +/// The base address of the user space. +pub const USER_SPACE_BASE: usize = 0x1000; +/// The base address for user interpreter. +pub const USER_SPACE_SIZE: usize = 0x7fff_ffff_f000; + +/// The highest address of the user stack. +pub const USER_STACK_TOP: usize = 0x7fff_0000_0000; +/// The size of the user stack. +pub const USER_STACK_SIZE: usize = 0x8_0000; + +/// The lowest address of the user heap. +pub const USER_HEAP_BASE: usize = 0x4000_0000; +/// The size of the user heap. +pub const USER_HEAP_SIZE: usize = 0x1_0000; + +/// The base address for user interpreter. +pub const USER_INTERP_BASE: usize = 0x400_0000; + +/// The address of signal trampoline. +pub const SIGNAL_TRAMPOLINE: usize = 0x4001_0000; diff --git a/core/src/lib.rs b/core/src/lib.rs index bab7827d1..f7dc533c0 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -8,6 +8,7 @@ extern crate axlog; extern crate alloc; +pub mod config; pub mod futex; pub mod mm; pub mod task; diff --git a/core/src/mm.rs b/core/src/mm.rs index a99cc40fd..ea082ba92 100644 --- a/core/src/mm.rs +++ b/core/src/mm.rs @@ -8,7 +8,7 @@ use axhal::{ mem::virt_to_phys, paging::{MappingFlags, PageSize}, }; -use axmm::{AddrSpace, kernel_aspace}; +use axmm::AddrSpace; use kernel_elf_parser::{AuxvEntry, ELFParser, app_stack_region}; use memory_addr::{MemoryAddr, PAGE_SIZE_4K, VirtAddr}; use xmas_elf::{ElfFile, program::SegmentData}; @@ -16,19 +16,20 @@ use xmas_elf::{ElfFile, program::SegmentData}; /// Creates a new empty user address space. pub fn new_user_aspace_empty() -> AxResult { AddrSpace::new_empty( - VirtAddr::from_usize(axconfig::plat::USER_SPACE_BASE), - axconfig::plat::USER_SPACE_SIZE, + VirtAddr::from_usize(crate::config::USER_SPACE_BASE), + crate::config::USER_SPACE_SIZE, ) } /// If the target architecture requires it, the kernel portion of the address /// space will be copied to the user address space. -pub fn copy_from_kernel(aspace: &mut AddrSpace) -> AxResult { - if !cfg!(target_arch = "aarch64") && !cfg!(target_arch = "loongarch64") { +pub fn copy_from_kernel(_aspace: &mut AddrSpace) -> AxResult { + #[cfg(not(any(target_arch = "aarch64", target_arch = "loongarch64")))] + { // ARMv8 (aarch64) and LoongArch64 use separate page tables for user space // (aarch64: TTBR0_EL1, LoongArch64: PGDL), so there is no need to copy the // kernel portion to the user page table. - aspace.copy_mappings_from(&kernel_aspace().lock())?; + _aspace.copy_mappings_from(&axmm::kernel_aspace().lock())?; } Ok(()) } @@ -37,7 +38,7 @@ pub fn copy_from_kernel(aspace: &mut AddrSpace) -> AxResult { pub fn map_trampoline(aspace: &mut AddrSpace) -> AxResult { let signal_trampoline_paddr = virt_to_phys(axsignal::arch::signal_trampoline_address().into()); aspace.map_linear( - axconfig::plat::SIGNAL_TRAMPOLINE.into(), + crate::config::SIGNAL_TRAMPOLINE.into(), signal_trampoline_paddr, PAGE_SIZE_4K, MappingFlags::READ | MappingFlags::EXECUTE | MappingFlags::USER, @@ -54,11 +55,11 @@ pub fn map_trampoline(aspace: &mut AddrSpace) -> AxResult { /// /// # Returns /// - The entry point of the user app. -fn map_elf(uspace: &mut AddrSpace, elf: &ElfFile) -> AxResult<(VirtAddr, [AuxvEntry; 16])> { +fn map_elf(uspace: &mut AddrSpace, elf: &ElfFile) -> AxResult<(VirtAddr, [AuxvEntry; 17])> { let uspace_base = uspace.base().as_usize(); let elf_parser = ELFParser::new( elf, - axconfig::plat::USER_INTERP_BASE, + crate::config::USER_INTERP_BASE, Some(uspace_base as isize), uspace_base, ) @@ -150,6 +151,7 @@ pub fn load_user_app( || interp_path == "/lib64/ld-linux-loongarch-lp64d.so.1" || interp_path == "/lib64/ld-linux-x86-64.so.2" || interp_path == "/lib/ld-linux-aarch64.so.1" + || interp_path == "/lib/ld-musl-x86_64.so.1" { // TODO: Use soft link interp_path = String::from("/musl/lib/libc.so"); @@ -166,8 +168,8 @@ pub fn load_user_app( // `ustack_start` -> `ustack_pointer`: It is the stack space that users actually read and write. // `ustack_pointer` -> `ustack_end`: It is the space that contains the arguments, environment variables and auxv passed to the app. // When the app starts running, the stack pointer points to `ustack_pointer`. - let ustack_end = VirtAddr::from_usize(axconfig::plat::USER_STACK_TOP); - let ustack_size = axconfig::plat::USER_STACK_SIZE; + let ustack_end = VirtAddr::from_usize(crate::config::USER_STACK_TOP); + let ustack_size = crate::config::USER_STACK_SIZE; let ustack_start = ustack_end - ustack_size; debug!( "Mapping user stack: {:#x?} -> {:#x?}", @@ -183,8 +185,8 @@ pub fn load_user_app( PageSize::Size4K, )?; - let heap_start = VirtAddr::from_usize(axconfig::plat::USER_HEAP_BASE); - let heap_size = axconfig::plat::USER_HEAP_SIZE; + let heap_start = VirtAddr::from_usize(crate::config::USER_HEAP_BASE); + let heap_size = crate::config::USER_HEAP_SIZE; uspace.map_alloc( heap_start, heap_size, diff --git a/core/src/task.rs b/core/src/task.rs index 33bcb0e0d..c4b7339eb 100644 --- a/core/src/task.rs +++ b/core/src/task.rs @@ -14,10 +14,10 @@ use alloc::{ }; use axerrno::{LinuxError, LinuxResult}; use axhal::{ - arch::UspaceContext, + context::UspaceContext, time::{NANOS_PER_MICROS, NANOS_PER_SEC, monotonic_time_nanos}, }; -use axmm::{AddrSpace, kernel_aspace}; +use axmm::AddrSpace; use axns::{AxNamespace, AxNamespaceIf}; use axprocess::{Pid, Process, ProcessGroup, Session, Thread}; use axsignal::{ @@ -26,7 +26,6 @@ use axsignal::{ }; use axsync::{Mutex, RawMutex}; use axtask::{TaskExtRef, TaskInner, WaitQueue, current}; -use memory_addr::VirtAddrRange; use spin::{Once, RwLock}; use weak_map::WeakMap; @@ -55,7 +54,7 @@ pub fn new_user_task( unsafe { uctx.enter_uspace(kstack_top) } }, name.into(), - axconfig::plat::KERNEL_STACK_SIZE, + crate::config::KERNEL_STACK_SIZE, ) } @@ -224,15 +223,15 @@ impl ProcessData { exe_path: RwLock::new(exe_path), aspace, ns: AxNamespace::new_thread_local(), - heap_bottom: AtomicUsize::new(axconfig::plat::USER_HEAP_BASE), - heap_top: AtomicUsize::new(axconfig::plat::USER_HEAP_BASE), + heap_bottom: AtomicUsize::new(crate::config::USER_HEAP_BASE), + heap_top: AtomicUsize::new(crate::config::USER_HEAP_BASE), child_exit_wq: WaitQueue::new(), exit_signal, signal: Arc::new(ProcessSignalManager::new( signal_actions, - axconfig::plat::SIGNAL_TRAMPOLINE, + crate::config::SIGNAL_TRAMPOLINE, )), futex_table: FutexTable::new(), @@ -266,18 +265,6 @@ impl ProcessData { } } -impl Drop for ProcessData { - fn drop(&mut self) { - if !cfg!(target_arch = "aarch64") && !cfg!(target_arch = "loongarch64") { - // See [`crate::new_user_aspace`] - let kernel = kernel_aspace().lock(); - self.aspace - .lock() - .clear_mappings(VirtAddrRange::from_start_size(kernel.base(), kernel.size())); - } - } -} - struct AxNamespaceImpl; #[crate_interface::impl_interface] impl AxNamespaceIf for AxNamespaceImpl { diff --git a/scripts/app_test.sh b/scripts/app_test.sh index a880cb793..8724a27db 100755 --- a/scripts/app_test.sh +++ b/scripts/app_test.sh @@ -24,7 +24,6 @@ if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "riscv64" ] && [ "$ARCH" != "aarch64" exit $S_FAILED fi - function compare() { local actual=$1 local expect=$2 @@ -34,13 +33,13 @@ function compare() { fi IFS='' while read -r line; do - local matched=$(grep -m1 -a "$line" < "$actual") + local matched=$(grep -m1 -a "$line" <"$actual") if [ -z "$matched" ]; then MSG="pattern \"${BLOD_C}$line${END_C}\" not matched!" unset IFS return $S_FAILED fi - done < "$expect" + done <"$expect" unset IFS return $S_PASS } @@ -52,13 +51,13 @@ function run_and_compare() { echo -ne " run with \"${BLOD_C}$args${END_C}\": " - make -C "$ROOT" AX_TESTCASE=$APP $args build > "$actual" 2>&1 + make -C "$ROOT" AX_TESTCASE=$APP $args build >"$actual" 2>&1 if [ $? -ne 0 ]; then return $S_BUILD_FAILED fi TIMEFORMAT='%3Rs' - RUN_TIME=$( { time { timeout --foreground $TIMEOUT make -C "$ROOT" AX_TESTCASE=$APP $args justrun > "$actual" 2>&1; }; } 2>&1 ) + RUN_TIME=$({ time { timeout --foreground $TIMEOUT make -C "$ROOT" AX_TESTCASE=$APP $args justrun >"$actual" 2>&1; }; } 2>&1) local res=$? if [ $res == 124 ]; then return $S_TIMEOUT @@ -74,13 +73,11 @@ function run_and_compare() { fi } - function test_one() { local args=$1 local expect="$APP_DIR/$2" local actual="$APP_DIR/actual.out" - local config_file=$(realpath --relative-to=$AX_ROOT "$ROOT/configs/$ARCH.toml") - args="$args ARCH=$ARCH ACCEL=n EXTRA_CONFIG=$config_file" + args="$args ARCH=$ARCH ACCEL=n" rm -f "$actual" MSG= diff --git a/scripts/get_deps.sh b/scripts/get_deps.sh index eea6e2f4c..537d6cb34 100755 --- a/scripts/get_deps.sh +++ b/scripts/get_deps.sh @@ -1,7 +1,7 @@ #!/bin/bash AX_ROOT=.arceos -COMMIT=54d5739 +COMMIT=b573b68 test ! -d "$AX_ROOT" && echo "Cloning repositories ..." || true test ! -d "$AX_ROOT" && git clone https://github.com/oscomp/arceos "$AX_ROOT" || true diff --git a/scripts/make/oscomp.mk b/scripts/make/oscomp.mk index ae7dbe60d..8118f337f 100644 --- a/scripts/make/oscomp.mk +++ b/scripts/make/oscomp.mk @@ -2,7 +2,7 @@ oscomp_binary: ax_root defconfig @cp -r $(PWD)/bin/* /root/.cargo/bin - @make -C $(AX_ROOT) A=$(PWD) EXTRA_CONFIG=$(EXTRA_CONFIG) build + @make -C $(AX_ROOT) A=$(PWD) build @if [ "$(ARCH)" = "riscv64" ]; then \ cp $(OUT_BIN) kernel-rv; \ else \ @@ -32,6 +32,6 @@ endef oscomp_run: ax_root defconfig $(call load_img) - $(MAKE) AX_TESTCASE=oscomp BLK=y NET=y FEATURES=fp_simd,lwext4_rs LOG=$(LOG) run + $(MAKE) AX_TESTCASE=oscomp BLK=y NET=y FEATURES=lwext4_rs LOG=$(LOG) run .PHONY: oscomp_binary oscomp_build oscomp_test oscomp_run \ No newline at end of file diff --git a/scripts/oscomp_test.sh b/scripts/oscomp_test.sh index 69342304a..78bae38e8 100755 --- a/scripts/oscomp_test.sh +++ b/scripts/oscomp_test.sh @@ -90,7 +90,7 @@ fi cp sdcard-$ARCH.img $AX_ROOT/disk.img -ARG="AX_TESTCASE=oscomp ARCH=$ARCH EXTRA_CONFIG=../configs/$ARCH.toml BLK=y NET=y FEATURES=fp_simd,lwext4_rs SMP=4 ACCEL=n LOG=off" +ARG="AX_TESTCASE=oscomp ARCH=$ARCH BLK=y NET=y FEATURES=lwext4_rs SMP=4 ACCEL=n LOG=off" echo -e "${GREEN_C}ARGS:${END_C} $ARG" if [ $? -ne 0 ]; then @@ -100,13 +100,13 @@ fi function test_one() { local testcase_type=$1 local actual="apps/oscomp/actual_$testcase_type.out" - RUN_TIME=$( { time { timeout --foreground $TIMEOUT make -C "$ROOT" $ARG run > "$actual" ; }; } ) + RUN_TIME=$({ time { timeout --foreground $TIMEOUT make -C "$ROOT" $ARG run >"$actual"; }; }) local res=$? if [ $res == 124 ]; then res=$S_TIMEOUT elif [ $res -ne 0 ]; then res=$S_FAILED - else + else res=$S_PASS fi cat "$actual" @@ -122,7 +122,7 @@ function test_one() { echo -e "${RED_C}actual output${END_C}:" else local judge_script="${ROOT}apps/oscomp/judge_${testcase_type}.py" - python3 $judge_script < "$actual" + python3 $judge_script <"$actual" if [ $? -ne 0 ]; then echo -e "${RED_C}failed!${END_C}" EXIT_STATUS=$S_FAILED @@ -140,7 +140,7 @@ for type in "${testcases_type[@]}"; do # clean the testcase_list file rm -f $ROOT/apps/oscomp/testcase_list for t in "${test_list[@]}"; do - echo $t >> $ROOT/apps/oscomp/testcase_list + echo $t >>$ROOT/apps/oscomp/testcase_list done test_one "$type" done diff --git a/src/entry.rs b/src/entry.rs index 362ea15c9..ff1f889ed 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -1,6 +1,6 @@ use alloc::{string::String, sync::Arc}; use axfs::{CURRENT_DIR, CURRENT_DIR_PATH, api::set_current_dir}; -use axhal::arch::UspaceContext; +use axhal::context::UspaceContext; use axprocess::{Pid, init_proc}; use axsignal::Signo; use axsync::Mutex; diff --git a/src/syscall.rs b/src/syscall.rs index 6fe820ee2..302b1541b 100644 --- a/src/syscall.rs +++ b/src/syscall.rs @@ -1,6 +1,6 @@ use axerrno::LinuxError; use axhal::{ - arch::TrapFrame, + context::TrapFrame, trap::{SYSCALL, register_trap_handler}, }; use starry_api::*;