简体   繁体   English

如何使用 tpidr1 作为线程本地寄存器编译 rust

[英]How to compile rust with tpidr1 as thread local register

In bare-metal AArch64, rust generates tpidr0 as the default register for thread_local calculations.在裸机 AArch64 中,rust 生成tpidr0作为thread_local计算的默认寄存器。 For scenarios like kernel, tpidr1 should be used instead of tpidr0 .对于 kernel 等场景,应使用tpidr1而不是tpidr0 How to make rust compiler generate code to use tpidr1 instead of the default?如何使 rust 编译器生成代码以使用tpidr1而不是默认值?

LLVM support a custom attribute -mattr=tipdr-el[1|2|3] to override the thread local register. LLVM 支持自定义属性-mattr=tipdr-el[1|2|3]来覆盖线程本地寄存器。

By default, tipdr0 is used for this purpose.默认情况下, tipdr0用于此目的。 This can be overriden in rust by doing something like the following这可以通过执行以下操作在 rust 中覆盖

rustc -C target-feature=tpidr-el1 --target=aarch64-unknown-none

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM