Skip to content

Replace jump instruction with lla and jr for kernel entry#1170

Merged
ZR233 merged 1 commit into
rcore-os:devfrom
Godones:Godones-patch-lto
Jun 7, 2026
Merged

Replace jump instruction with lla and jr for kernel entry#1170
ZR233 merged 1 commit into
rcore-os:devfrom
Godones:Godones-patch-lto

Conversation

@Godones

@Godones Godones commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

With LTO disabled, a linker error occurs with the j jump instruction.

With LTO disabled, a linker error occurs with the j jump instruction.
Copilot AI review requested due to automatic review settings June 7, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the RISC-V 64-bit early boot entry jump sequence to avoid linker/relocation range limits when branching to kernel_entry.

Changes:

  • Replaced a direct j {kernel_entry} with lla + jr to avoid R_RISCV_JAL range constraints.
  • Added explanatory comments documenting the relocation/range rationale.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Godones

Godones commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

@ZR233 请周老师合并一下

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #1170 审查结论:APPROVE

修改内容

修改 components/someboot/src/arch/riscv64/entry.rs_head() 裸汇编的早期引导入口:将 j {kernel_entry}(R_RISCV_JAL,范围±1MB)替换为 lla t0, {kernel_entry}; jr t0(auipc+addi+jr,范围±2GB)。

实现逻辑

这是 RISC-V 64 位标准做法:lla 展开为 auipc+addi,利用 PC 相对寻址避免 J 范围限制。.option norvc 保证 32 位编码,code0=8 字节,符合 RISC-V Linux 内核镜像头格式。修改与同文件 kernel_entry()_secondary_entry() 中已有的 lla+jr 模式一致。

CI 状态

自托管 runner 关键测试全部通过:Test axvisor riscv64 qemu / run_host、Test arceos riscv64 qemu / run_host 等。GitHub-hosted 容器 runner 的 Test starry riscv64 qemu / run_container 失败,但 dev 基础分支最近 CI(run 27066722548)也存在相同失败模式,是 pre-existing 环境问题,与本 PR 无关。

重复/重叠分析

无其他 PR 修改 _head() 入口。PR #1160 涉及 someboot 其他文件但不冲突。

阻断项

无阻断项。修改范围小(+4/-2 行),逻辑清晰,与现有模式一致。

Powered by mimo-v2.5-pro

@mai-team-app
mai-team-app Bot requested a review from ZR233 June 7, 2026 10:45
@mai-team-app mai-team-app Bot mentioned this pull request Jun 7, 2026
@ZR233
ZR233 merged commit 06a4d8e into rcore-os:dev Jun 7, 2026
95 of 98 checks passed
silicalet added a commit to silicalet/tgoskits that referenced this pull request Jun 7, 2026
Upstream changes:
- feat(starry-kernel): implement io_uring lite (rcore-os#1042)
- fix(starry-net): epoll_pwait alignment + netlink MSG_PEEK (rcore-os#921)
- Replace jump instruction with lla and jr for kernel entry (rcore-os#1170)

Conflicts resolved:
- os/StarryOS/kernel/src/syscall/fs/mod.rs: merge io_uring::* export
  with lock::{release_flock_lock, release_pid_flock_locks}
- os/StarryOS/kernel/src/file/mod.rs: fix auto-merge syntax error,
  add io_uring::IoUring export while preserving our TaskState/Pid imports

Validation:
- test-nix-prereqs: 12/12 PASSED
- syscall (incl. new io_uring/netlink/epoll tests): PASSED
- nix app (nosandbox): PASSED
@github-actions github-actions Bot mentioned this pull request Jun 9, 2026
aptacc2421 pushed a commit to aptacc2421/tgoskits that referenced this pull request Jun 14, 2026
)

With LTO disabled, a linker error occurs with the j jump instruction.
luodeb pushed a commit that referenced this pull request Jun 30, 2026
With LTO disabled, a linker error occurs with the j jump instruction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants