frame point trace is in loop
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rust
- Domain
- operating-systems
Research direction
Reproduce the stack trace with QEMU using both opensbi.bin and rustsbi.bin, comparing the reported ra and fp values. Start from the supplied print_stack_trace entry point and determine whether OpenSBI or the caller's frame-pointer termination assumptions produce the repeated frame; done means the cause is identified and the differing behavior is explained.
Written by the indexing model from the issue text.
Description
when I use rust write os in qemu, I wrote a stack trace function to resolve frame point trace, but found qemu in loop.
my code is like this:
pub unsafe fn print_stack_trace() {
let mut fp: *const usize;
asm!("mv {}, fp", out(reg) fp);
let mut saved_ra = *fp.sub(1);
let mut saved_fp = *fp.sub(2);
println!("== Begin stack trace ==");
while (!fp.is_null() && saved_fp != 0) || (saved_ra == *fp) {
println!("0x{:016x}, fp = 0x{:016x}", saved_ra, saved_fp);
fp = saved_fp as *const usize;
saved_ra = *fp.sub(1);
saved_fp = *fp.sub(2);
}
println!("== End stack trace ==");
}
but with "-bios opensbi.bin" ,the console out like this:
ra =0x0000000080200010, fp = 0x000000008020fa60
ra =0x0000000080210158, fp = 0x000000008020fcd0
ra =0x0000000080213c3c, fp = 0x000000008020fd10
ra =0x0000000080212190, fp = 0x0000000080210010
ra =0x0000000080200010, fp = 0x000000008020fa60
.........
when I use "-bios rustsbi.bin" (version 0.0.4") run the same code ,the console out like this:
== Begin stack trace ==
0x0000000080210158, fp = 0x000000008020fcd0
0x0000000080213c3c, fp = 0x000000008020fd10
0x0000000080212190, fp = 0x0000000080210010
== End stack trace ==
the result is correct.
Then I write out the ra & fp ,found when
use rustsbi : ra = 0x0000000080210010,fp=0,
so that the code is correct over.
but use opensbi :ra =0x0000000080200010, fp = 0x000000008020fa60
fp is not null, so that is in loop.
where opensbi code has bug?
- Dominant language
- C
- Stars
- 1.6k
- Forks
- 734
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from riscv-software-src/opensbi
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
riscv-software-src/opensbi#425 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
riscv-software-src/opensbi#424 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
riscv-software-src/opensbi#439 ·
-
sbi_trap_redirect() does not clear SPELP when the interrupted context had no landing pad expectedOpen
Difficulty 3/5 1-2 days Newbie friendliness 67/100
riscv-software-src/opensbi#438 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
riscv-software-src/opensbi#436 · 3 comments ·
All issues in riscv-software-src/opensbi
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libreswan/libreswan#3185 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
llvm:instcombine
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
llvm/llvm-project#246503 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day