本文介绍了如何理解“ cmpl $ 0x0,-0x30(%rbp)” /“ je ...”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我炸弹圈问题的汇编代码,我被困在phase2中;
炸弹实验室要求我们根据汇编代码找出正确的输入,否则它将爆炸。

This is the assembly code from my bomb lap question, I am stuck in phase2;The bomb lab require us to find out the correct input based on assembly code or it will exploded.

来自< +20>我知道%rbp -0x30(48)== 0否则它将调用< +32>并炸弹;因此%rbp = 48(DEC)

From <+20> I know that %rbp -0x30(48) == 0 or it will call <+32> and explode the bomb; so %rbp = 48(DEC)

之后(+26)%rbp-0x2c(44)必须等于1否则它将炸弹爆炸...
但由于%rbp = 48,炸弹会在任何地方爆炸,所以我现在感到困惑...

After that(+26) %rbp - 0x2c(44) must equal 1 or it will explode the bomb...But since %rbp = 48, the bomb will explode anywhere so I am confuse now...

我认为我误解了compl,je / jne或如何计算这些东西...

I think I misunderstand the compl , je/jne or how to calculate these things...

推荐答案

-0x30(%ebp)并不意味着使用值%ebp-0x30 。这是要读取的内存地址。指令( cmpl )的后缀为 l ,因此它处理的是4个字节的数量。因此,实际上发生的是它从地址%ebp-0x30 中读取了一个4字节的数字,并检查它是否为零。

-0x30(%ebp) doesn't mean to use the value %ebp - 0x30. It's a memory address to read from. The instruction (cmpl) has an l suffix, so it's dealing with a 4 byte quantity. So what's actually happening is that it reads a 4 byte number from the address %ebp - 0x30 and checks whether it's zero.

(前缀 $ 表示它是立即数,而不是地址。这就是为什么 0x0 照字面意义使用并且未取消引用。)

(The $ prefix means it's an immediate value, not an address. This is why 0x0 is taken literally and not dereferenced.)

这篇关于如何理解“ cmpl $ 0x0,-0x30(%rbp)” /“ je ...”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-12 22:32