ARM汇编" retne"指令 [英] ARM assembly "retne" instruction

查看:415
本文介绍了ARM汇编" retne"指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在理解什么需要为Linux内核引导过程。我是通过Linux内核源代码树浏览,特别是ARM架构,直到我偶然发现了这个汇编指令 retne LR 中的弓/ ARM /内核/ HYP-stub.S

I am currently in the process of understanding what it takes for the Linux kernel to boot. I was browsing through the Linux kernel source tree, in particular for the ARM architecture, until I stumbled upon this assembly instruction retne lr in arch/arm/kernel/hyp-stub.S

在概念上,它很容易理解的是,指令是假设返回到存储在链接寄存器的地址,如果Z标志是0。我找的就是这个ARM汇编指令实际记录。

Conceptually, it's easily understood that the instruction is suppose to return to the address stored in the link register if the Z-flag is 0. What I am looking for is where this ARM assembly instruction is actually documented.

我搜索在 ARM体系结构参考手册ARMv7-A和ARMv7-R版部分A8.8,无法找到该指令的说明。

I searched in the ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition section A8.8 and could not find the description of the instruction.

Grepping来源,看它是否是一个 ARM特定的GNU AS扩展特别没来什么。

Grepping the sources and seeing if it was an ARM specific GNU AS extension did not turn up anything in particular.

谷歌搜索与查询臂组件ret指令,手臂返回指令和任何沿线类似的没有露面任何有用的东西无论是。当然,我必须找错了地方或者我必须失去了一些东西。

A google search with the queries "arm assembly ret instruction", "arm return instruction" and anything similar along the lines did not turn up anything useful either. Surely I must be looking in the wrong places or I must be missing something.

任何澄清会更加AP preciated。

Any clarification will be much appreciated.

推荐答案

的体系结构汇编语言是一回事,现实世界code是另一回事。一旦汇编伪操作和宏开始发挥作用,工具链和有关codeBase的既熟悉有很大帮助。 Linux是特别讨厌尽可能多的组装源包含汇编器宏和CPP宏多层。如果你知道要寻找什么,并按照头线索<一个href=\"http://lxr.free-electrons.com/source/arch/arm/include/asm/assembler.h#L431\"><$c$c>arch/arm/include/asm/assembler.h,你最终会发现这个复杂的野兽:

The architectural assembly language is one thing, real world code is another. Once assembler pseudo-ops and macros come into play, a familiarity with both the toolchain and the codebase in question helps a lot. Linux is particularly nasty as much of the assembly source contains multiple layers of both assembler macros and CPP macros. If you know what to look for, and follow the header trail to arch/arm/include/asm/assembler.h, you eventually find this complicated beast:

.irp    c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
.macro  ret\c, reg
#if __LINUX_ARM_ARCH__ < 6
        mov\c   pc, \reg
#else
        .ifeqs  "\reg", "lr"
        bx\c    \reg
        .else
        mov\c   pc, \reg
        .endif
#endif
        .endm
        .endr

这样做的目的是为了<一个href=\"https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/arch/arm/include/asm/assembler.h?id=6ebbf2ce437b33022d30badd49dc94d33ecfa498\">emit在architecturally- preferred返回指令获得的<一个好处href=\"http://infocenter.arm.com/help/topic/com.arm.doc.ddi0464d/CHDIBCFC.html#CHDCBCBE\">microarchitectures与返回堆栈,同时允许在同一code到仍编译旧的架构。

The purpose of this is to emit the architecturally-preferred return instruction for the benefit of microarchitectures with a return stack, whilst allowing the same code to still compile for older architectures.

这篇关于ARM汇编&QUOT; retne&QUOT;指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆