linux - ALT_SMP 和 ALT_UP 有什么作用?

标签 linux arm

我刚刚导航到 Linux arm 内核树,我看到汇编文件中使用了 ALT_SMP 和 ALT_UP,它们到底是做什么用的?

最佳答案

指的是 https://github.com/torvalds/linux/blob/master/arch/arm/include/asm/assembler.h#L169

ALT_SMP 应该表示仅在SMP、对称多处理 系统中执行。

#ifdef CONFIG_SMP
#define ALT_SMP(instr...) \
9998: instr
#define ALT_UP(instr...) \
.pushsection ".alt.smp.init", "a" ;\
.long 9998b ;\
9997: instr ;\
.if . - 9997b != 4 ;\
.error "ALT_UP() content must assemble to exactly 4 bytes";\
.endif ;\
.popsection
// skipped
#else
#define ALT_SMP(instr...)
#define ALT_UP(instr...) instr

考虑到这个上下文 UP 应该意味着 Uni Processor

也来自这个maillinux-arm-kernel 上:

The ALT_{UP,SMP} macros are used to patch instructions at runtime depending on whether we are running on an SMP platform or not. This is generally done in out-of-line assembly code, but there is also the need for this functionality in inline assembly (e.g. spinlocks).

关于linux - ALT_SMP 和 ALT_UP 有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17083941/

相关文章:

linux - ext4 卷的根目录上的 fsync 会刷新所有子卷吗?

linux - Apache 中的自定义响应

c++ - 如何在 Linux 中通过索引访问 fd_set 中的 FD?

git - Azure - 使用arm模板从Visual Studio部署Web应用程序,连接到VSTS git源代码控制

c++ - 告诉编译器我希望变量始终存储在寄存器中的正确方法是什么?

arm - 链接到 libssh 时针对 ARM 进行交叉编译 - libssh.so : file not recognized

linux - 我如何使用 Qt Framework Installer 创建注册文件类型及其图标?

linux - 启用 Systemd 的服务不再在启动时启动

c - ARM板什么时候安装操作系统?调用端口地址会映射到真实地址还是虚拟地址?

assembly - 如何确定 ARMv8 处理器是否支持 AArch32 执行状态?