From ba6cfead254b9d1a008c6a3b4987e1e735f10c8c Mon Sep 17 00:00:00 2001 From: YanLien Date: Wed, 4 Mar 2026 15:54:32 +0800 Subject: [PATCH 1/3] update configs for loongarch64 and axstd version --- .axconfig.toml | 142 ++++++++++++---------- Cargo.lock | 256 +++++++++++++++++++++++++-------------- Cargo.toml | 2 +- configs/aarch64.toml | 4 +- configs/loongarch64.toml | 6 +- configs/riscv64.toml | 4 +- configs/x86_64.toml | 4 +- 7 files changed, 256 insertions(+), 162 deletions(-) diff --git a/.axconfig.toml b/.axconfig.toml index a23c2a5..c884bcf 100644 --- a/.axconfig.toml +++ b/.axconfig.toml @@ -1,9 +1,9 @@ # Architecture identifier. -arch = "riscv64" # str +arch = "loongarch64" # str # Platform package. -package = "axplat-riscv64-qemu-virt" # str +package = "axplat-loongarch64-qemu-virt" # str # Platform identifier. -platform = "riscv64-qemu-virt" # str +platform = "loongarch64-qemu-virt" # 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 @@ -15,68 +15,76 @@ ticks-per-sec = 100 # uint # [devices] # IPI interrupt num -ipi-irq = "0x8000_0000_0000_0001" # uint +ipi-irq = 12 # uint +eiointc-irq = 0x03 # uint +# eiointc@1400 { +# reg = <0x00 0x1400 0x00 0x800>; +# interrupts = <0x03>; +# interrupt-parent = <0x8001>; +# #interrupt-cells = <0x01>; +# interrupt-controller; +# compatible = "loongson,ls2k2000-eiointc"; +# phandle = <0x8002>; +# }; +eiointc-paddr = 0x1400 # uint +# poweroff { +# value = <0x00000034>; +# offset = <0x00000000>; +# compatible = "syscon-poweroff"; +# }; +# ged@100e001c { +# reg-io-width = <0x00000001>; +# reg-shift = <0x00000000>; +# reg = <0x00000000 0x100e001c 0x00000000 0x00000003>; +# compatible = "syscon"; +# }; +ged-paddr = 0x100E001C # uint # MMIO ranges with format (`base_paddr`, `size`). mmio-ranges = [ - [0x0010_1000, 0x1000], - [0x0c00_0000, 0x21_0000], - [0x1000_0000, 0x1000], - [0x1000_1000, 0x8000], - [0x2000_0000, 0x400_0000], - [0x3000_0000, 0x1000_0000], - [0x4000_0000, 0x4000_0000] + [0x1000_0000, 0x0000_0400], + [0x100D_0000, 0x0000_1000], + [0x100E_0000, 0x0000_1000], + [0x1D00_0000, 0x40_0000], + [0x1FE0_0000, 0x0000_1000], + [0x2000_0000, 0x1000_0000], + [0x4000_0000, 0x0002_0000] ] # [(uint, uint)] -# End PCI bus number (`bus-range` property in device tree). -pci-bus-end = 0xff # uint +# platic@10000000 { +# loongson,pic-base-vec = <0x00>; +# interrupt-parent = <0x8002>; +# #interrupt-cells = <0x02>; +# interrupt-controller; +# reg = <0x00 0x10000000 0x00 0x400>; +# compatible = "loongson,pch-pic-1.0"; +# phandle = <0x8003>; +# }; +pch-pic-paddr = 0x10000000 # uint +# End PCI bus number. +pci-bus-end = 0x7f # uint # Base physical address of the PCIe ECAM space. -pci-ecam-base = 0x3000_0000 # uint -# PCI device memory ranges (`ranges` property in device tree). +pci-ecam-base = 0x2000_0000 # uint +# PCI device memory ranges. pci-ranges = [ - [0x0300_0000, 0x1_0000], - [0x4000_0000, 0x4000_0000], - [0x4_0000_0000, 0x4_0000_0000] + [0, 0], + [0x4000_0000, 0x0002_0000] ] # [(uint, uint)] -# plic@c000000 { -# phandle = <0x03>; -# riscv,ndev = <0x5f>; -# reg = <0x00 0xc000000 0x00 0x600000>; -# interrupts-extended = <0x02 0x0b 0x02 0x09>; -# interrupt-controller; -# compatible = "sifive,plic-1.0.0\0riscv,plic0"; -# }; -plic-paddr = 0x0c00_0000 # uint -# rtc@101000 { -# interrupts = <0x0b>; -# interrupt-parent = <0x03>; -# reg = <0x00 0x101000 0x00 0x1000>; -# compatible = "google,goldfish-rtc"; -# }; -# RTC (goldfish) Address -rtc-paddr = 0x10_1000 # uint +# RTC (ls7a) Address +rtc-paddr = 0x100d_0100 # uint # Timer interrupt frequency in Hz. -timer-frequency = 10_000_000 # uint -# Timer interrupt num. -timer-irq = "0x8000_0000_0000_0005" # uint -uart-irq = 0x0a # uint -# serial@10000000 { -# interrupts = <0x0a>; -# interrupt-parent = <0x03>; -# clock-frequency = "\08@"; -# reg = <0x00 0x10000000 0x00 0x100>; +timer-frequency = 100_000_000 # uint +# Timer interrupt number. +timer-irq = 11 # uint +uart-irq = 0x2 # uint +# serial@1fe001e0 { +# interrupt-parent = <0x00008003>; +# interrupts = <0x00000002 0x00000004>; +# clock-frequency = <0x05f5e100>; +# reg = <0x00000000 0x1fe001e0 0x00000000 0x00000100>; # compatible = "ns16550a"; # }; -uart-paddr = 0x1000_0000 # uint +uart-paddr = 0x1FE001E0 # uint # VirtIO MMIO ranges with format (`base_paddr`, `size`). -virtio-mmio-ranges = [ - [0x1000_1000, 0x1000], - [0x1000_2000, 0x1000], - [0x1000_3000, 0x1000], - [0x1000_4000, 0x1000], - [0x1000_5000, 0x1000], - [0x1000_6000, 0x1000], - [0x1000_7000, 0x1000], - [0x1000_8000, 0x1000] -] # [(uint, uint)] +virtio-mmio-ranges = [] # [(uint, uint)] # # Platform configs @@ -84,23 +92,29 @@ virtio-mmio-ranges = [ [plat] # Stack size on bootstrapping. (256K) boot-stack-size = 0x40000 # uint -# Number of CPUs. -cpu-num = 1 # uint +# Maximum number of CPUs. +max-cpu-num = 1 # uint +# Base address of the high physical memory. +high-memory-base = 0x8000_0000 # uint # Kernel address space base. -kernel-aspace-base = "0xffff_ffc0_0000_0000" # uint +kernel-aspace-base = "0xffff_8000_0000_0000" # uint # Kernel address space size. -kernel-aspace-size = "0x0000_003f_ffff_f000" # uint +kernel-aspace-size = "0x0000_7fff_ffff_f000" # uint # Base physical address of the kernel image. -kernel-base-paddr = 0x8020_0000 # uint +kernel-base-paddr = 0x0020_0000 # uint # Base virtual address of the kernel image. -kernel-base-vaddr = "0xffff_ffc0_8020_0000" # uint +kernel-base-vaddr = "0xffff_8000_0020_0000" # uint +# Base address of the low physical memory. +low-memory-base = 0x0 # uint +# Size of the low physical memory. (256M) +low-memory-size = 0x1000_0000 # uint +# Linear mapping offset at boot time. +phys-boot-offset = "0x9000_0000_0000_0000" # uint # Offset of bus address and phys address. some boards, the bus address is # different from the physical address. phys-bus-offset = 0 # uint -# Base address of the whole physical memory. -phys-memory-base = 0x8000_0000 # uint # Size of the whole physical memory. (128M) phys-memory-size = 0x800_0000 # uint # Linear mapping offset, for quick conversions between physical and virtual # addresses. -phys-virt-offset = "0xffff_ffc0_0000_0000" # uint +phys-virt-offset = "0xffff_8000_0000_0000" # uint diff --git a/Cargo.lock b/Cargo.lock index 706089b..073e8a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,11 +4,11 @@ version = 4 [[package]] name = "aarch64-cpu" -version = "10.0.0" +version = "11.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a21cd0131c25c438e19cd6a774adf7e3f64f7f4d723022882facc2dee0f8bc9" +checksum = "44171e22925ec72b63d86747bc3655c7849a5b8d865c980222128839f45ac034" dependencies = [ - "tock-registers 0.9.0", + "tock-registers 0.10.1", ] [[package]] @@ -63,7 +63,7 @@ dependencies = [ [[package]] name = "arceos-msgqueue" -version = "0.4.5" +version = "0.4.6" dependencies = [ "axstd", "clap", @@ -71,9 +71,9 @@ dependencies = [ [[package]] name = "arceos_api" -version = "0.2.2-preview.1" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f963b62c30e72fec3236956eb2155a6afd26e558ef0d21bfd0d841c9e70fb17e" +checksum = "ba14ebd68212f426bd9402f7a3056aeceb45ea663b23f286f517907cde588bbb" dependencies = [ "axalloc", "axconfig", @@ -89,16 +89,16 @@ dependencies = [ [[package]] name = "arm-gic-driver" -version = "0.15.12" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4439bfed45ec60e61de4905b54780f618c6887cb7ebb277f138663e2749251a" +checksum = "e30c6a0ffd23095c69f48afd996eb51156b2511b52a01bdbb0b418fdfd1d458c" dependencies = [ "aarch64-cpu", "bitflags 2.11.0", "enum_dispatch", "log", "paste", - "tock-registers 0.9.0", + "tock-registers 0.10.1", ] [[package]] @@ -133,9 +133,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "axalloc" -version = "0.2.2-preview.1" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b65a834aad62cd89cf1fe1dbeba0a71fd13e4b04dbbd9baef347e9b6a3da71" +checksum = "86b84e565389d1a4f3440a04ae9ef27072ee0389a6a80c677e95dba01999b9a5" dependencies = [ "axallocator", "axerrno 0.2.2", @@ -152,6 +152,7 @@ version = "0.1.3-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1af235e0e403b05aef675f5273ded7f54e79d78ffb358a7b46e950434c4e1fd8" dependencies = [ + "axerrno 0.1.2", "bitmap-allocator", "cfg-if", "rlsf", @@ -165,14 +166,14 @@ checksum = "bf9566516f5d799b2f791a6ec5af57eec87d17624346f7c876fa006b922c99e6" dependencies = [ "cfg-if", "log", - "spin 0.10.0", + "spin", ] [[package]] name = "axconfig" -version = "0.2.2-preview.1" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5119974fb25183abb35d1529a9b9705adfe7aadb1b247f662b78231e917ebdd0" +checksum = "56a86ea2dde8dadf15a7b70ae036e2e5f070f869228d01818d5fc579e00fc079" dependencies = [ "axconfig-macros", ] @@ -201,9 +202,9 @@ dependencies = [ [[package]] name = "axcpu" -version = "0.3.0-preview.3" +version = "0.3.0-preview.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eeabf0939995cb9bcc17c8f7b49099eba7ce13fb811da1071186b584cad2656" +checksum = "61dc8203ac5b80e4aa613c1139b1c69b908aededadd1ae7c55b41da06084a2ad" dependencies = [ "aarch64-cpu", "axbacktrace", @@ -218,7 +219,7 @@ dependencies = [ "percpu", "riscv", "static_assertions", - "tock-registers 0.9.0", + "tock-registers 0.10.1", "x86", "x86_64", ] @@ -245,9 +246,9 @@ dependencies = [ [[package]] name = "axfeat" -version = "0.2.2-preview.1" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b7c2b83ebecd5a9c20baf9ce20a785f87a163053f8cbf3b59480df195a285d" +checksum = "e64aadd7c96ec4a7114ae2460ea98ae1dda6368a8e7cc820e75eacb115ae47b9" dependencies = [ "axalloc", "axbacktrace", @@ -260,9 +261,9 @@ dependencies = [ [[package]] name = "axhal" -version = "0.2.2-preview.5" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca21270c3588736410abbeaee1aecc28af912837d7b0e713de76733a4b6bc250" +checksum = "92fc83bbf1378e2414dd87bad66531e0f4c011e2945ecd1ef30459cd57cfbb3f" dependencies = [ "axalloc", "axconfig", @@ -276,11 +277,11 @@ dependencies = [ "fdt-parser", "heapless", "kernel_guard", - "lazyinit", "log", "memory_addr", "page_table_multiarch", "percpu", + "spin", ] [[package]] @@ -295,31 +296,39 @@ dependencies = [ "memchr", ] +[[package]] +name = "axklib" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03bf328ee0dd583179ce7108584ec69da10e06bd4beb4d6acac7f6cb33754dab" +dependencies = [ + "axerrno 0.2.2", + "memory_addr", + "trait-ffi", +] + [[package]] name = "axlog" -version = "0.2.2-preview.1" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d061cd7ec45902f758710ab17ca30a01d7aa9af1455d6eb2232aa217456184" +checksum = "52b4f17e9b030d8c6212346e5c4180e421f9e4698724edb044fda82baf1fb663" dependencies = [ "cfg-if", - "crate_interface", + "crate_interface 0.1.4", "kspin", "log", ] [[package]] name = "axmm" -version = "0.2.2-preview.1" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd888813ea2c3e503dad39dd9c8ab29d8aa6180a1ed142f7c8ff2033e2148abe" +checksum = "3806ed4605d2bbe1db5093152c60899087f7fd863fd35269926b40bd644f15cd" dependencies = [ "axalloc", "axconfig", "axerrno 0.2.2", "axhal", - "axsync", - "axtask", - "enum_dispatch", "kspin", "lazyinit", "log", @@ -329,14 +338,14 @@ dependencies = [ [[package]] name = "axplat" -version = "0.3.0-preview.2" +version = "0.3.1-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92cadeaefb5b95b1617dd76c0b3e1191b73dcc295f42aad7716636027cab6151" +checksum = "b7e82da07eb9c931a90029d80ae487b4dd532cdf69d44ae692776bbd72e6708a" dependencies = [ "axplat-macros", "bitflags 2.11.0", "const-str", - "crate_interface", + "crate_interface 0.3.0", "kspin", "memory_addr", "percpu", @@ -344,9 +353,9 @@ dependencies = [ [[package]] name = "axplat-aarch64-peripherals" -version = "0.3.0-preview.2" +version = "0.3.1-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0b6662596b170e4b4d8cb396af4ab8f133ea14fda055a207a149f437eea285f" +checksum = "6f3819d30fa3a4038c0f9ab7e122c8b3ba840b323ee3fc19e4dbabe22b4e56ac" dependencies = [ "aarch64-cpu", "arm-gic-driver", @@ -358,15 +367,14 @@ dependencies = [ "kspin", "lazyinit", "log", - "page_table_entry", - "spin 0.10.0", + "spin", ] [[package]] name = "axplat-aarch64-qemu-virt" -version = "0.3.0-preview.2" +version = "0.3.1-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a846bef67308540f97d01ff64e13c0fbba111cb19a2ed9cc5055477ec021bf9" +checksum = "ccbc5793ffa4ae120815f3761bea658e0bafeba2d1a5f324cb457de8d41fbfa9" dependencies = [ "axconfig-macros", "axcpu", @@ -378,9 +386,9 @@ dependencies = [ [[package]] name = "axplat-loongarch64-qemu-virt" -version = "0.3.0-preview.2" +version = "0.3.1-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6950cea16d394b76a2d0c6970be4a631ef4bb30db6fbe4994e488fbc9f5ab2f" +checksum = "e95a7a015c7ff23303f5807d1f28c31c15c09dd167f192757000f0ca201f29a8" dependencies = [ "axconfig-macros", "axcpu", @@ -406,9 +414,9 @@ dependencies = [ [[package]] name = "axplat-riscv64-qemu-virt" -version = "0.3.0-preview.2" +version = "0.3.1-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f0ee11922a369bd9c3c4b555cc27d5a969aad1ef1f1ea63af82c80bdbd17c5" +checksum = "7c9f0161378a2bd66773ed208a461ecf36b1c9aae977fbb75d51a271b2790fe8" dependencies = [ "axconfig-macros", "axcpu", @@ -423,9 +431,9 @@ dependencies = [ [[package]] name = "axplat-x86-pc" -version = "0.3.0-preview.2" +version = "0.3.1-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbe66f46c561de269466a386b2b844a0ff05b51b1844c808a3eacb3ca90fe16" +checksum = "02c2a75cf2d03a8a0ab223d124d434a80f03bb365b5bb616f019c4ac97288c96" dependencies = [ "axconfig-macros", "axcpu", @@ -453,27 +461,31 @@ checksum = "f3970d53be0955ea3e995b9ef4ec10778b061ee89671395c74e6ceb8e0798602" dependencies = [ "bitflags 2.11.0", "linux-raw-sys", - "spin 0.10.0", + "spin", ] [[package]] name = "axruntime" -version = "0.2.2-preview.2" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d457ccb4246b5c447d2b89bac387978c22e85805191e171d660fad70128422" +checksum = "64f7f0be5da44c662fd3e90f5aee43b71c0e670eba21e23a6ce8dc6cefb661d5" dependencies = [ "axalloc", "axbacktrace", "axconfig", + "axerrno 0.2.2", "axhal", + "axklib", "axlog", "axmm", "axplat", "axtask", + "cfg-if", "chrono", - "crate_interface", + "crate_interface 0.1.4", "ctor_bare", "indoc", + "log", ] [[package]] @@ -487,24 +499,25 @@ dependencies = [ [[package]] name = "axstd" -version = "0.2.2-preview.1" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac756e9fc50dedce0e710a391035c5d1ceaf07ccb055fefb0eed2dbfc0d31c03" +checksum = "71913df85aaaa1f5d89e920d92f85457fbb2c1dcdac3b736c3e92fa5ac4de86a" dependencies = [ "arceos_api", "axerrno 0.2.2", "axfeat", "axio", "kspin", + "lazyinit", "lock_api", - "spin 0.10.0", + "spin", ] [[package]] name = "axsync" -version = "0.2.2-preview.1" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e087fcacdf9adb81492b0e5b8051e9c0eaf275fa79894b53a3290586959d645a" +checksum = "0d0f968847b0370ef3b1fb3a67956491c9329a836d6d801da63f766f988c74c5" dependencies = [ "axtask", "event-listener", @@ -514,9 +527,9 @@ dependencies = [ [[package]] name = "axtask" -version = "0.2.2-preview.3" +version = "0.3.0-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea1ee808218981a12bbcfd0322d88f576d88201b6ab029c5bf1a2036383ff68" +checksum = "4b77e63126532aefe63381637961f7db5f69a53379fcb8e886e70e996e5b1b73" dependencies = [ "axconfig", "axerrno 0.2.2", @@ -525,7 +538,7 @@ dependencies = [ "axsched", "cfg-if", "cpumask", - "crate_interface", + "crate_interface 0.1.4", "event-listener", "futures-util", "kernel_guard", @@ -534,6 +547,7 @@ dependencies = [ "log", "memory_addr", "percpu", + "spin", ] [[package]] @@ -665,9 +679,9 @@ checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" [[package]] name = "const-str" -version = "0.6.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451d0640545a0553814b4c646eb549343561618838e9b42495f466131fe3ad49" +checksum = "18f12cc9948ed9604230cdddc7c86e270f9401ccbe3c2e98a4378c5e7632212f" [[package]] name = "const_fn" @@ -675,6 +689,15 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f8a2ca5ac02d09563609681103aada9e1777d54fc57a5acd7a41404f9c93b6e" +[[package]] +name = "convert_case" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "cpumask" version = "0.1.0" @@ -695,6 +718,17 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "crate_interface" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51e5c7109dea31fc91ab584e99752baa997f76d46e49bab0a17b5e9679248df7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "critical-section" version = "1.2.0" @@ -872,7 +906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d10c55bedf6789bc3748e0d8756ee639df1ae25144fd3525ed311044bd9a739f" dependencies = [ "cfg-if", - "crate_interface", + "crate_interface 0.1.4", ] [[package]] @@ -891,6 +925,35 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f03abfebdaaf0fad16790237a0348baf84886d3ade460db13bae59e614a180" +[[package]] +name = "lenient_semver" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de8de3f4f3754c280ce1c8c42ed8dd26a9c8385c2e5ad4ec5a77e774cea9c1ec" +dependencies = [ + "lenient_semver_parser", + "semver", +] + +[[package]] +name = "lenient_semver_parser" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f650c1d024ddc26b4bb79c3076b30030f2cf2b18292af698c81f7337a64d7d6" +dependencies = [ + "lenient_semver_version_builder", + "semver", +] + +[[package]] +name = "lenient_semver_version_builder" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9049f8ff49f75b946f95557148e70230499c8a642bf2d6528246afc7d0282d17" +dependencies = [ + "semver", +] + [[package]] name = "libc" version = "0.2.182" @@ -1008,9 +1071,9 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "page_table_entry" -version = "0.5.8" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af51afffbce2ea801b0830b29fcea77068e821521f13c5e3e4734585abcc061" +checksum = "8e9a63b9b86d32f64c3874a90936939281d045ef1751d0aca3d82d5e4e06b2ef" dependencies = [ "aarch64-cpu", "bitflags 2.11.0", @@ -1020,12 +1083,11 @@ dependencies = [ [[package]] name = "page_table_multiarch" -version = "0.5.8" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a012c0bb9b8b0c4887d0b90f37cf8164537b69bb5560ecdcf4ada0c3b64e3976" +checksum = "42c5b75d5d9bdbee44c827b0dd2766fa3d478a76b9c6735419228089d1b24536" dependencies = [ "arrayvec", - "axerrno 0.1.2", "log", "memory_addr", "page_table_entry", @@ -1041,21 +1103,21 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "percpu" -version = "0.2.2" +version = "0.2.3-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54ca06381bdd16a5397e23cf61d347b539c765e2c20b2ecc5cb36df88695c1f7" +checksum = "8c03ecfaf97c11a791d8b65e34a6353d012a735a5cbfebba34ee6668da16ce38" dependencies = [ "cfg-if", "percpu_macros", - "spin 0.9.8", + "spin", "x86", ] [[package]] name = "percpu_macros" -version = "0.2.2" +version = "0.2.3-preview.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a933d46113c0171aee86623311a9367f2ec3a86dab0a96aba1d5bc627473617e" +checksum = "6660d83b91174e6d39fae0cdf893889dcdbffda6e99664f8ee8a45fde6a6936c" dependencies = [ "cfg-if", "proc-macro2", @@ -1107,22 +1169,22 @@ dependencies = [ [[package]] name = "riscv" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1671c79a01a149fe000af2429ce9ccc8e58cdecda72672355d50e5536b363c" +checksum = "9251433e48c39d2133cbaff3ae7809ce6a1ecbc8225ca7da33d96d10cf360582" dependencies = [ "critical-section", "embedded-hal", "paste", "riscv-macros", - "riscv-pac", + "riscv-types", ] [[package]] name = "riscv-macros" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c4aa1ea1af6dcc83a61be12e8189f9b293c3ba5a487778a4cd89fb060fdbbc" +checksum = "d47d1fb716349455b8e5e3ebbf1eff95344dbdf9f782a4e1359d2f16f51e3dce" dependencies = [ "proc-macro2", "quote", @@ -1130,10 +1192,10 @@ dependencies = [ ] [[package]] -name = "riscv-pac" -version = "0.2.0" +name = "riscv-types" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" +checksum = "d3f2ad9f15a07f4a0e1677124f9120ce7e83ab7e1ca7186af0ca9da529b62e80" [[package]] name = "rlsf" @@ -1176,19 +1238,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "slab" -version = "0.4.12" +name = "semver" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" [[package]] -name = "spin" -version = "0.9.8" +name = "slab" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "spin" @@ -1281,9 +1340,9 @@ checksum = "696941a0aee7e276a165a978b37918fd5d22c55c3d6bda197813070ca9c0f21c" [[package]] name = "tock-registers" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b9e2fdb3a1e862c0661768b7ed25390811df1947a8acbfbefe09b47078d93c4" +checksum = "8d2d250f87fb3fb6f225c907cf54381509f47b40b74b1d1f12d2dccbc915bdfe" [[package]] name = "toml_datetime" @@ -1309,6 +1368,19 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" +[[package]] +name = "trait-ffi" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d49469ee333631b3130bec28965c47dcf0d4f3a792f8ed425dd036cf84be7" +dependencies = [ + "convert_case", + "lenient_semver", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "uart_16550" version = "0.4.0" @@ -1326,6 +1398,12 @@ version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "unicode-width" version = "0.1.14" diff --git a/Cargo.toml b/Cargo.toml index a8769ab..bdbcd35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ path = "xtask/src/main.rs" required-features = ["xtask"] [dependencies] -axstd = { version = "0.2.2-preview.1", features = ["defplat", "alloc", "paging", "multitask"], optional = true } +axstd = { version = "=0.3.0-preview.1", features = ["defplat", "alloc", "paging", "multitask"], optional = true } clap = { version = "4", features = ["derive"], optional = true } [profile.release] diff --git a/configs/aarch64.toml b/configs/aarch64.toml index e7a7e93..230d0c4 100644 --- a/configs/aarch64.toml +++ b/configs/aarch64.toml @@ -97,8 +97,8 @@ virtio-mmio-ranges = [ [plat] # Stack size on bootstrapping. (256K) boot-stack-size = 0x40000 # uint -# Number of CPUs. -cpu-num = 1 # uint +# Maximum number of CPUs. +max-cpu-num = 1 # uint # Kernel address space base. kernel-aspace-base = "0xffff_0000_0000_0000" # uint # Kernel address space size. diff --git a/configs/loongarch64.toml b/configs/loongarch64.toml index c636ddb..c884bcf 100644 --- a/configs/loongarch64.toml +++ b/configs/loongarch64.toml @@ -14,6 +14,8 @@ ticks-per-sec = 100 # uint # Device specifications # [devices] +# IPI interrupt num +ipi-irq = 12 # uint eiointc-irq = 0x03 # uint # eiointc@1400 { # reg = <0x00 0x1400 0x00 0x800>; @@ -90,8 +92,8 @@ virtio-mmio-ranges = [] # [(uint, uint)] [plat] # Stack size on bootstrapping. (256K) boot-stack-size = 0x40000 # uint -# Number of CPUs. -cpu-num = 1 # uint +# Maximum number of CPUs. +max-cpu-num = 1 # uint # Base address of the high physical memory. high-memory-base = 0x8000_0000 # uint # Kernel address space base. diff --git a/configs/riscv64.toml b/configs/riscv64.toml index a23c2a5..946b6b8 100644 --- a/configs/riscv64.toml +++ b/configs/riscv64.toml @@ -84,8 +84,8 @@ virtio-mmio-ranges = [ [plat] # Stack size on bootstrapping. (256K) boot-stack-size = 0x40000 # uint -# Number of CPUs. -cpu-num = 1 # uint +# Maximum number of CPUs. +max-cpu-num = 1 # uint # Kernel address space base. kernel-aspace-base = "0xffff_ffc0_0000_0000" # uint # Kernel address space size. diff --git a/configs/x86_64.toml b/configs/x86_64.toml index e757825..37b5893 100644 --- a/configs/x86_64.toml +++ b/configs/x86_64.toml @@ -44,8 +44,8 @@ virtio-mmio-ranges = [] # [(uint, uint)] [plat] # Stack size on bootstrapping. (256K) boot-stack-size = 0x40000 # uint -# Number of CPUs. -cpu-num = 1 # uint +# Maximum number of CPUs. +max-cpu-num = 1 # uint # Kernel address space base. kernel-aspace-base = "0xffff_8000_0000_0000" # uint # Kernel address space size. From 970f1c2e7207e5d08b4041bb567bbad317e8e03c Mon Sep 17 00:00:00 2001 From: YanLien Date: Thu, 5 Mar 2026 09:53:30 +0800 Subject: [PATCH 2/3] add CI workflow and test script --- .github/workflows/ci.yml | 31 ++++++++++ scripts/test.sh | 128 +++++++++++++++++++++++++++++++++++++++ xtask/src/main.rs | 13 ++-- 3 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100755 scripts/test.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..926472c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + branches: [main, dev, master] + pull_request: + branches: [main, dev, master] + +jobs: + test: + runs-on: ubuntu-latest + container: ghcr.io/chyyuu/tangram-crates + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Verify tools + run: | + echo "=== Checking Rust version ===" + rustc --version --verbose + echo "" + echo "=== Checking QEMU version ===" + qemu-system-riscv64 --version + qemu-system-x86_64 --version + qemu-system-aarch64 --version + qemu-system-loongarch64 --version + echo "" + + - name: Run tests + run: ./scripts/test.sh diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..cc3dc78 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,128 @@ +#!/bin/bash +set -e + +echo "=== ArceOS Helloworld Test Script ===" +echo "" + +# Check if required tools are installed +check_tools() { + echo "[1/7] Checking required tools..." + + if ! command -v cargo &> /dev/null; then + echo "Error: cargo is not installed" + exit 1 + fi + + if ! command -v rust-objcopy &> /dev/null; then + echo "Warning: cargo-binutils not installed, installing..." + cargo install cargo-binutils + fi + + echo "✓ All required tools are available" + echo "" +} + +# Format check +check_format() { + echo "[2/7] Checking code format..." + cargo fmt -- --check + echo "✓ Code format check passed" + echo "" +} + +# Clippy lint check +check_clippy() { + echo "[3/7] Running clippy lint checks..." + cargo clippy -- -D warnings + echo "✓ Clippy check passed" + echo "" +} + +# Basic build check (no default features to avoid platform-specific issues) +check_build() { + echo "[4/7] Checking basic build (no default features)..." + cargo check --no-default-features + echo "✓ Basic build check passed" + echo "" +} + +# Run tests for each architecture +run_arch_tests() { + echo "[5/7] Running architecture-specific tests..." + + local archs=("riscv64" "x86_64" "aarch64" "loongarch64") + local qemu_ok=true + + for arch in "${archs[@]}"; do + echo "" + echo "Testing architecture: $arch" + + # Check if QEMU is available + qemu_cmd="qemu-system-$arch" + if ! command -v "$qemu_cmd" &> /dev/null; then + echo "Warning: $qemu_cmd not found, skipping run test for $arch" + qemu_ok=false + continue + fi + + # Build and run + if cargo xtask run --arch="$arch" 2>&1 | grep -q "Multi-task message queue OK!"; then + echo "✓ $arch test passed" + else + echo "Error: $arch test failed" + exit 1 + fi + done + + if [ "$qemu_ok" = true ]; then + echo "" + echo "✓ All architecture tests passed" + fi + echo "" +} + +# Publish dry-run check +check_publish() { + echo "[6/7] Checking publish readiness..." + cargo publish --dry-run --allow-dirty + echo "✓ Publish check passed" + echo "" +} + +# Summary +print_summary() { + echo "[7/7] Test Summary" + echo "==================" + echo "✓ All checks passed successfully!" + echo "" + echo "The following checks were performed:" + echo " 1. Code format check (cargo fmt)" + echo " 2. Lint check (cargo clippy)" + echo " 3. Basic build check (cargo check)" + echo " 4. Architecture tests (riscv64, x86_64, aarch64, loongarch64)" + echo " 5. Publish readiness check (cargo publish --dry-run)" + echo "" +} + +# Main execution +main() { + local skip_qemu=${SKIP_QEMU:-false} + + check_tools + check_format + check_clippy + check_build + + if [ "$skip_qemu" = "true" ]; then + echo "[5/7] Skipping architecture tests (SKIP_QEMU=true)" + echo "" + else + run_arch_tests + fi + + check_publish + print_summary +} + +# Run main function +main "$@" diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 96dc6ca..05b58ab 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -4,7 +4,10 @@ use std::process::{self, Command}; /// ArceOS msgqueue multi-architecture build & run tool #[derive(Parser)] -#[command(name = "xtask", about = "Build and run arceos-msgqueue on different architectures")] +#[command( + name = "xtask", + about = "Build and run arceos-msgqueue on different architectures" +)] struct Cli { #[command(subcommand)] command: Cmd, @@ -168,10 +171,10 @@ fn find_seabios() -> PathBuf { /// - loongarch64: pflash1 size is flexible (we use 4MB) fn pflash_size(arch: &str) -> usize { match arch { - "riscv64" => 32 * 1024 * 1024, // 32MB - fixed by QEMU virt machine - "aarch64" => 64 * 1024 * 1024, // 64MB - fixed by QEMU virt machine - "x86_64" => 4 * 1024 * 1024, // 4MB - "loongarch64" => 4 * 1024 * 1024, // 4MB + "riscv64" => 32 * 1024 * 1024, // 32MB - fixed by QEMU virt machine + "aarch64" => 64 * 1024 * 1024, // 64MB - fixed by QEMU virt machine + "x86_64" => 4 * 1024 * 1024, // 4MB + "loongarch64" => 4 * 1024 * 1024, // 4MB _ => 4 * 1024 * 1024, } } From eed04ada1de3cd979dca3f0aa5c8cdf486bdb733 Mon Sep 17 00:00:00 2001 From: YanLien Date: Thu, 5 Mar 2026 10:50:02 +0800 Subject: [PATCH 3/3] update test script for multi-architecture and remove config --- .axconfig.toml | 120 ------------------------------------------------ scripts/test.sh | 62 ++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 127 deletions(-) delete mode 100644 .axconfig.toml diff --git a/.axconfig.toml b/.axconfig.toml deleted file mode 100644 index c884bcf..0000000 --- a/.axconfig.toml +++ /dev/null @@ -1,120 +0,0 @@ -# Architecture identifier. -arch = "loongarch64" # str -# Platform package. -package = "axplat-loongarch64-qemu-virt" # str -# Platform identifier. -platform = "loongarch64-qemu-virt" # 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 - -# -# Device specifications -# -[devices] -# IPI interrupt num -ipi-irq = 12 # uint -eiointc-irq = 0x03 # uint -# eiointc@1400 { -# reg = <0x00 0x1400 0x00 0x800>; -# interrupts = <0x03>; -# interrupt-parent = <0x8001>; -# #interrupt-cells = <0x01>; -# interrupt-controller; -# compatible = "loongson,ls2k2000-eiointc"; -# phandle = <0x8002>; -# }; -eiointc-paddr = 0x1400 # uint -# poweroff { -# value = <0x00000034>; -# offset = <0x00000000>; -# compatible = "syscon-poweroff"; -# }; -# ged@100e001c { -# reg-io-width = <0x00000001>; -# reg-shift = <0x00000000>; -# reg = <0x00000000 0x100e001c 0x00000000 0x00000003>; -# compatible = "syscon"; -# }; -ged-paddr = 0x100E001C # uint -# MMIO ranges with format (`base_paddr`, `size`). -mmio-ranges = [ - [0x1000_0000, 0x0000_0400], - [0x100D_0000, 0x0000_1000], - [0x100E_0000, 0x0000_1000], - [0x1D00_0000, 0x40_0000], - [0x1FE0_0000, 0x0000_1000], - [0x2000_0000, 0x1000_0000], - [0x4000_0000, 0x0002_0000] -] # [(uint, uint)] -# platic@10000000 { -# loongson,pic-base-vec = <0x00>; -# interrupt-parent = <0x8002>; -# #interrupt-cells = <0x02>; -# interrupt-controller; -# reg = <0x00 0x10000000 0x00 0x400>; -# compatible = "loongson,pch-pic-1.0"; -# phandle = <0x8003>; -# }; -pch-pic-paddr = 0x10000000 # uint -# End PCI bus number. -pci-bus-end = 0x7f # uint -# Base physical address of the PCIe ECAM space. -pci-ecam-base = 0x2000_0000 # uint -# PCI device memory ranges. -pci-ranges = [ - [0, 0], - [0x4000_0000, 0x0002_0000] -] # [(uint, uint)] -# RTC (ls7a) Address -rtc-paddr = 0x100d_0100 # uint -# Timer interrupt frequency in Hz. -timer-frequency = 100_000_000 # uint -# Timer interrupt number. -timer-irq = 11 # uint -uart-irq = 0x2 # uint -# serial@1fe001e0 { -# interrupt-parent = <0x00008003>; -# interrupts = <0x00000002 0x00000004>; -# clock-frequency = <0x05f5e100>; -# reg = <0x00000000 0x1fe001e0 0x00000000 0x00000100>; -# compatible = "ns16550a"; -# }; -uart-paddr = 0x1FE001E0 # uint -# VirtIO MMIO ranges with format (`base_paddr`, `size`). -virtio-mmio-ranges = [] # [(uint, uint)] - -# -# Platform configs -# -[plat] -# Stack size on bootstrapping. (256K) -boot-stack-size = 0x40000 # uint -# Maximum number of CPUs. -max-cpu-num = 1 # uint -# Base address of the high physical memory. -high-memory-base = 0x8000_0000 # uint -# Kernel address space base. -kernel-aspace-base = "0xffff_8000_0000_0000" # uint -# Kernel address space size. -kernel-aspace-size = "0x0000_7fff_ffff_f000" # uint -# Base physical address of the kernel image. -kernel-base-paddr = 0x0020_0000 # uint -# Base virtual address of the kernel image. -kernel-base-vaddr = "0xffff_8000_0020_0000" # uint -# Base address of the low physical memory. -low-memory-base = 0x0 # uint -# Size of the low physical memory. (256M) -low-memory-size = 0x1000_0000 # uint -# Linear mapping offset at boot time. -phys-boot-offset = "0x9000_0000_0000_0000" # uint -# Offset of bus address and phys address. some boards, the bus address is -# different from the physical address. -phys-bus-offset = 0 # uint -# Size of the whole physical memory. (128M) -phys-memory-size = 0x800_0000 # uint -# Linear mapping offset, for quick conversions between physical and virtual -# addresses. -phys-virt-offset = "0xffff_8000_0000_0000" # uint diff --git a/scripts/test.sh b/scripts/test.sh index cc3dc78..2abd83e 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -echo "=== ArceOS Helloworld Test Script ===" +echo "=== ArceOS Childtask Test Script ===" echo "" # Check if required tools are installed @@ -30,11 +30,35 @@ check_format() { echo "" } -# Clippy lint check +# Clippy lint check by architecture check_clippy() { echo "[3/7] Running clippy lint checks..." - cargo clippy -- -D warnings - echo "✓ Clippy check passed" + + local archs=("riscv64" "x86_64" "aarch64" "loongarch64") + local targets=("riscv64gc-unknown-none-elf" "x86_64-unknown-none" "aarch64-unknown-none-softfloat" "loongarch64-unknown-none") + + for i in "${!archs[@]}"; do + local arch="${archs[$i]}" + local target="${targets[$i]}" + + echo "" + echo "Running clippy for architecture: $arch" + + # Install config file for the architecture + cp "configs/${arch}.toml" ".axconfig.toml" + + if cargo clippy --features axstd --target="$target" -- -D warnings; then + echo "✓ $arch clippy check passed" + else + echo "Error: $arch clippy check failed" + rm -f .axconfig.toml + exit 1 + fi + done + + rm -f .axconfig.toml + echo "" + echo "✓ All architecture clippy checks passed" echo "" } @@ -81,11 +105,35 @@ run_arch_tests() { echo "" } -# Publish dry-run check +# Publish dry-run check by architecture check_publish() { echo "[6/7] Checking publish readiness..." - cargo publish --dry-run --allow-dirty - echo "✓ Publish check passed" + + local archs=("riscv64" "x86_64" "aarch64" "loongarch64") + local targets=("riscv64gc-unknown-none-elf" "x86_64-unknown-none" "aarch64-unknown-none-softfloat" "loongarch64-unknown-none") + + for i in "${!archs[@]}"; do + local arch="${archs[$i]}" + local target="${targets[$i]}" + + echo "" + echo "Checking publish for architecture: $arch" + + # Install config file for the architecture + cp "configs/${arch}.toml" ".axconfig.toml" + + if cargo publish --features axstd --dry-run --allow-dirty --target="$target"; then + echo "✓ $arch publish check passed" + else + echo "Error: $arch publish check failed" + rm -f .axconfig.toml + exit 1 + fi + done + + rm -f .axconfig.toml + echo "" + echo "✓ All architecture publish checks passed" echo "" }