Completed the project upgrade to support aarch64#9
Completed the project upgrade to support aarch64#9SiyuanSun0736 wants to merge 26 commits intoarceos-org:mainfrom
Conversation
…加架构支持选项;在 main.rs 中为不同架构的用户任务启动添加条件编译支持
…yscall.rs 中调整 syscall 处理函数的格式
* upstream/main: use new tour_test.sh( created by @yjymosheng ) for CI. tour/u_* apps in CI add github ci for tour add tour test script Update tour-README.md Update tour-README.md update rust-toolchain to 2024-09-04 for fix crate home@0.5.11 compiling problem update README for oscamp quick start guide update arceos/modules/bump_allocator/src/lib.rs for rust analyzer update arceos/Cargo.toml: add axfs_ramfs add vscode settings.json: "rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf"
There was a problem hiding this comment.
Pull Request Overview
This PR extends support to AArch64 by parameterizing architecture in Makefiles, updating payload assembly, and adding AArch64-specific handlers in axhal.
- Introduces
ARCHvariable and multi-arch support in payload Makefiles - Updates
_startassembly inmain.rsfor AArch64 syscall entry - Adds AArch64 task-pointer caching and trap handling in
axhal
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| arceos/payload/origin/src/main.rs | Added AArch64 _start assembly block |
| arceos/payload/origin/Makefile | Parameterized ARCH, TARGET_TRIPLE, clean loop |
| arceos/payload/mapfile_c/Makefile | Added ARCH branching for compiler toolchains |
| arceos/payload/hello_c/Makefile | Added ARCH branching for compiler toolchains |
| arceos/payload/fileops_c/Makefile | Added ARCH branching for compiler toolchains |
| arceos/payload/Makefile | Passed ARCH down into subdirectories |
| arceos/modules/axhal/src/cpu.rs | Introduced cache_current_task_ptr for AArch64 |
| arceos/modules/axhal/src/arch/aarch64/* | Updated trap.S, trap.rs, mod.rs, context.rs to integrate AArch64 uspace and caching |
| arceos/modules/*/Cargo.toml | Added new dependencies (log) |
| arceos/Makefile | Propagated ARCH to payload, updated GDB breakpoint |
| arceos/Cargo.toml | Added new workspace examples |
Comments suppressed due to low confidence (1)
arceos/payload/origin/Makefile:35
- This recipe calls an undefined
get-target-tripletarget. It will fail at clean time. Consider using the already-computedTARGET_TRIPLEvariable or implement a Makefile function that mapsARCHto the correct triple.
cargo clean -p $(TARGET) --target $$(make --no-print-directory ARCH=$$arch get-target-triple) --release 2>/dev/null || true; \
| #[cfg(target_arch = "aarch64")] | ||
| core::arch::asm!( | ||
| "sub sp, sp, #4", // AArch64 栈操作 | ||
| "mov sp, x0", // 设置返回值为 0 |
There was a problem hiding this comment.
The assembly line mov sp, x0 incorrectly moves the stack pointer instead of setting the return value. It should be mov x0, #0 (or mov x0, xzr) to zero the return register before the svc instruction.
| "mov sp, x0", // 设置返回值为 0 | |
| "mov x0, #0", // 设置返回值为 0 |
shilei-massclouds
left a comment
There was a problem hiding this comment.
Please fix exceptions in u_4_0, m_3_0, m_3_1 or provide a checklist of finished items.
There was a problem hiding this comment.
For ‘mk_pflash’, how about to define a function with args to handle all these three archs?
There was a problem hiding this comment.
The pflash_img code is located in the oscamp/arceos/scripts/make/utils.mk file, which defines a macro called mk_pflash .
This macro builds a Rust project origin for different target architectures (such as RISC-V 64-bit or AArch64) and packages it into a specific "pflash" image file, depending on the ARCH parameter passed in (for example, from oscamp/arceos/Makefile ).
There was a problem hiding this comment.
You copied the implementation of 'mk_pflash' for riscv64 to other two archs, so there're three copies of 'mk_pflash' with minor differences (related to arch). We can try to just define a single 'mk_pflash' function and pass in 'arch' argument.
An exmaple is 'make_disk_image' function in 'utils.mk'.
|
Dear Professor,
Thank you for your hard work. |
|
The following modifications have been submitted:
|







By adding the ARCH variable to some rules in the makefile, enabling support for other architectures in the makefiles under the payload directory, and converting some RISC-V64 assembly code into AArch64 assembly, successful AArch support for the payload part was achieved. Additionally, modifications were made to the axhal part by referencing
oscomp/arceosto enable uspace support under AArch64. A section of pflash was added toarch64-qemu-virt.toml. Together, these changes accomplished support fortour/u_*_0andtour/m_*_0.Example:
Compiling for AArch64:
Compiling for RISC-V64: