如果一个函数是通过近调用进入的,它是否可以在不破坏返回地址预测的情况下进行远尾调用?

Jos*_*ica 5 x86 assembly x86-64 cpu-architecture branch-prediction

考虑这段代码:

.globl _non_tail, _tail
.text

.code32
_non_tail:
    lcall $0x33, $_non_tail.heavensgate
    ret

.code64
_non_tail.heavensgate:
    # do stuff. there's 12 bytes on the stack before the first argument
    lret

.code32
_tail:
    pushl (%esp)
    movw %cs, 4(%esp)
    ljmp $0x33, $_tail.heavensgate

.code64
_tail.heavensgate:
    # do stuff. there's 8 bytes on the stack before the first argument
    lret
Run Code Online (Sandbox Code Playgroud)

_tail导致返回堆栈缓冲区错误预测未来的返回吗?一方面,它将近调用与远返回配对,但另一方面,它仍然返回到与正常情况完全相同的位置。