riscv-software-src / riscv-software-src/opensbi

Does the stack area and scratch area cover the code area?

Open
#267 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.5k
Forks
712
PR merge metrics
No merged PRs in 30d

Description

lla tp, _fw_end mul a5, s7, s8 add tp, tp, a5 /* Keep a copy of tp */ add t3, tp, zero /* Counter */ li t2, 1 /* hartid 0 is mandated by ISA */ li t1, 0 _scratch_init: /* * The following registers hold values that are computed before * entering this block, and should remain unchanged. * * t3 -> the firmware end address * s7 -> HART count * s8 -> HART stack size */ add tp, t3, zero mul a5, s8, t1 sub tp, tp, a5 li a5, SBI_SCRATCH_SIZE sub tp, tp, a5
Here, when allocating the stack area, the size only calculates the size of the stack area,However, when using this space, we add the "scratch" area,Does the stack area and scratch area cover the code area?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown _scratch_init block and trace the values of _fw_end, s7, s8, and SBI_SCRATCH_SIZE through the stack and scratch-area calculations. Confirm whether those ranges overlap the code area, then document the conclusion and any required allocation change.

Written by the indexing model from the issue text.

Assessment

Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.