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

semihosting_write bug in generic

Open
#339 7 comments 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

semihosting_write is called in semihosting_puts which expects that semihosting_write returns the length it writes.
Length minus the return value of syswrite trap which is normally the true length the syscall writes according to the convention is returned in the implementation of semihosting_write. So semihosting_write returns zero actually.

When I am debuging the opensbi with a debugger attached, I get infinite loop of printing 'OpenSBI 1.3.1'.

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 by locating semihosting_write and its caller semihosting_puts, then inspect how the syswrite trap return value is interpreted. Verify that the write function reports the number of bytes actually written so repeated printing terminates rather than looping on the OpenSBI banner.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.