GNU汇编中的1b和1f [英] 1b and 1f in GNU assembly

查看:428
本文介绍了GNU汇编中的1b和1f的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在分析linux异常代码. 顺便说一句,我无法理解gnu汇编语法.

I am analyzing a linux exception code. By the way I can't understand gnu assembly syntax.

    svc_preempt:
    mov r8, lr
1:  bl  preempt_schedule_irq        @ irq en/disable is done inside
    ldr r0, [tsk, #TI_FLAGS]        @ get new tasks TI_FLAGS
    tst r0, #_TIF_NEED_RESCHED
    moveq   pc, r8              @ go again
    b   1b

在此代码中,我可以看到"b 1b",但是在任何地方都找不到"1b"标签.

In this code, I can see "b 1b", but I can't find "1b" label anywhere.

然后

#ifdef CONFIG_NEON
    adr r6, .LCneon_thumb_opcodes
    b   2f
#endif
call_fpe:
#ifdef CONFIG_NEON
    adr r6, .LCneon_arm_opcodes
2:
    ldr r7, [r6], #4            @ mask value
    cmp r7, #0              @ end mask?
    beq 1f
    and r8, r0, r7
    ldr r7, [r6], #4            @ opcode bits matching in mask
    cmp r8, r7              @ NEON instruction?
    bne 2b
    get_thread_info r10
    mov r7, #1
    strb    r7, [r10, #TI_USED_CP + 10] @ mark CP#10 as used
    strb    r7, [r10, #TI_USED_CP + 11] @ mark CP#11 as used
    b   do_vfp              @ let VFP handler handle this
1:

我找不到"2f"和"1f"标签.

I can't find "2f" and "1f" label.

所以,我想知道"1b","1f","2f"等的含义.

So, I wonder the meaning of "1b", "1f", "2f" and so on.

推荐答案

标记"xb"和"xf"(其中"x"是数字)是对GNU程序集的智能扩展.分支到第一个找到的标签"x",在"forward"中搜索"f",在"backward"中搜索"b".

Labels "xb" and "xf", where "x" is a number are a smart extension to the GNU assembly. It branches to the first found label "x" searching "forward" for "f" or "backward" for "b".

这意味着在第一个使用"1b"作为目标的清单中,将在使用该指令的之前中搜索"1".在第二个清单中,"2f"将搜索"2" AFTER 使用它的指令,该清单末尾的"2b"将跳转到相同的"2",因为它是之前指令.

That means that in your first listing using "1b" as a target will search for "1" BEFORE the instruction that uses it. In the second listing "2f" will search for "2" AFTER the instruction that uses it, the "2b" at the end of this listing will then branch to the same "2", because it is BEFORE the instruction.

您的代码中可能有多个带有数字的标签.

There may be multiple labels with numbers in your code.

请参阅此处- https://sourceware.org/binutils/docs- 2.24/as/Symbol-Names.html#Symbol-Names -本地标签"一章.

See here - https://sourceware.org/binutils/docs-2.24/as/Symbol-Names.html#Symbol-Names - chapter "Local labels".

这篇关于GNU汇编中的1b和1f的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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