Skip to content

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

Open
@polarvid

Description

@polarvid

Describe problem solved by the proposed feature

描述

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

typedef signed long rt_base_t; /**< Nbit CPU related data type */

如注释中清晰表达 —— 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions