RT-Thread / RT-Thread/rt-thread

RISC-V 移植中没有初始化线程的thread-pointer

Open
#7,820 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Arch: RISC-V
Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

RT-Thread 移植的libcpu/risc-v/common/cpuport.c中没有初始化任务栈的thread-pointer,在线程中调用到依赖thread-pointer的gcc库函数后,可能会导致异常(因为tp默认被初始化0xdeadbeef,这个地址在大部分RISC-V 芯片是非法地址)

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 in libcpu/risc-v/common/cpuport.c and inspect how the task stack and initial thread context are set up. Trace the first context switch or thread entry path to determine where the thread-pointer is left at 0xdeadbeef; done means threads can call GCC library functions that depend on it without an invalid-address exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.