英文:
What are the conditional jump instructions for Go's assembler?
问题
Go语言的6a汇编器具有条件跳转指令:
JCC
JCS
JCXZL
JEQ
JGE
JGT
JHI
JLE
JLS
JLT
JMI
JNE
JOC
JOS
JPC
JPL
JPS
但是它们如何映射到x86条件跳转指令呢?
英文:
Go's 6a assembler has conditional jump instructions:
JCC
JCS
JCXZL
JEQ
JGE
JGT
JHI
JLE
JLS
JLT
JMI
JNE
JOC
JOS
JPC
JPL
JPS
But how do they map to x86 conditional jumps?
答案1
得分: 12
我正在回答这个问题,这样我就不会丢失信息,其他人也不必经历和我一样的搜寻游戏。通过查看optab.c和x86跳转指令,我们可以将指令编码进行匹配,解决这个谜题。
JCC JAE
JCS JB
JCXZL JECXZ
JEQ JE,JZ
JGE JGE
JGT JG
JHI JA
JLE JLE
JLS JBE
JLT JL
JMI JS
JNE JNE, JNZ
JOC JNO
JOS JO
JPC JNP, JPO
JPL JNS
JPS JP, JPE
英文:
I'm answering this so I don't lose the information, and so other people don't have to go through the same sleuthing game as me. Looking at optab.c and the x86 jumps we can match up the instruction encodings to solve the puzzle.
JCC JAE
JCS JB
JCXZL JECXZ
JEQ JE,JZ
JGE JGE
JGT JG
JHI JA
JLE JLE
JLS JBE
JLT JL
JMI JS
JNE JNE, JNZ
JOC JNO
JOS JO
JPC JNP, JPO
JPL JNS
JPS JP, JPE
答案2
得分: 2
Go汇编器的arch.go文件中写道:
instructions["JA"] = x86.AJHI
instructions["JAE"] = x86.AJCC
instructions["JB"] = x86.AJCS
等等
这意味着Go汇编中的JHI相当于Intel汇编中的JA,以此类推。
英文:
The Go assembler's arch.go says:
instructions["JA"] = x86.AJHI
instructions["JAE"] = x86.AJCC
instructions["JB"] = x86.AJCS
etc
which means that Go asm's JHI means Intel asm's JA, etc.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论