RT-Thread / RT-Thread/rt-thread

[Feature] 64 位架构适配 32 位指针 ABI | Using ILP32D ABI on 64-bit architecture

Open
#9,366 2 comments 0 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

Describe problem solved by the proposed feature

描述

#9194 在 QEMU 平台引入了 ILP32D 支持,同时也引入了内核对该 ABI 的支持需求。但内核、组件众多代码仍然隐式依赖、混用 intptr_t 与 RT-Thread 的架构关联类型 rt_base_t。

https://github.com/RT-Thread/rt-thread/blob/8249e71bcccffc8d4e96b32178f1e40863656ccf/include/rttypes.h#L36

如注释中清晰表达 —— Nbit CPU related data type,rt_base_t 直接与架构相关。这个类型的实际意义是需要一个专用类型来存储来自系统寄存器等对象的值。

intptr_t 来自标准 C,意义为 integer type capable of holding a pointer。为了充分发挥 ILP32D ABI 的优势,该类型自然是 32-bit 位长。

因此两种类型在这种场景下完全不能混淆。这导致了使用该 ABI 的工具链后,产生如下问题

  1. 内核编译期产生大量警告(指针与不可比整型的隐式类型转换)
  2. 内核中常使用 void * 存储物理地址。但是在 ILP32D 下,指针类型并不一定能表示所有的可用物理地址范围
Describe your preferred solution

No response

Describe possible alternatives

No response

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 include/rttypes.h at the linked rt_base_t definition and review the ILP32D support introduced by issue #9194 on QEMU. Trace uses that mix rt_base_t, intptr_t, and void * for architecture-related values, then define completion as removing the reported conversion warnings and safely representing physical addresses under ILP32D.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.