每个 AT&T 语法操作数访问内存或寄存器中的什么值? [英] What value from memory or register do each of the AT&T syntax operands access?

查看:43
本文介绍了每个 AT&T 语法操作数访问内存或寄存器中的什么值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设以下值存储在指定的内存地址和寄存器中:

Assume the following values are stored at the indicated memory addresses and registers:

Address    Value            Register     Value
0x100      0xFF             %eax         0x100
0x104      0xAB             %ecx         0x1
0x108      0x13             %edx         0x3
0x10C      0x11


Fill in the following table showing the values for the indicated operands:

Operand           Value    //Solutions at the end of the chapter
%eax              _____    //0x100
0x104             _____    //0xAB
$0x108            _____    //0x108
(%eax)            _____    //0xFF
4(%eax)           _____    //0xAB
9(%eax, %edx)     _____    //0x11
260(%ecx, %edx)   _____    //0x13
0xFC(,%ecx,4)     _____    //0xFF
(%eax, %edx,4)    _____    //0x11

有人可以用外行的话向我解释如何做到这一点.这不是 hmwk(这是某些阅读中的练习题,在本章末尾有答案),我只是不理解阅读.

Can someone explain to me how to do this in layman's terms. This isn't hmwk (it's practice problems during certain readings which have the answers @ the end of the chapter), I'm just not understanding the reading.

推荐答案

AT&T x86 汇编语法的一般规则是

The general rule for AT&T x86 assembly syntax is

displacement(offset, relative offset, multiplier) = offset + displacement + ( relative offset * multiplier)

  1. %eax 指的是寄存器的实际值(=0x100).
  2. 0x104 指地址 0x104 处的值.
  3. $0x108 指的是常量值 0x108.
  4. (%eax) 指的是地址 EAX 处的值,相当于 0x100(=0xFF).
  5. 4(%eax) 指地址 EAX+4 处的值,即 0x104.
  6. 9(%eax, %edx) 指地址 EAX+9 + EDX 处的值,即 0x10C.
  7. 260(%ecx, %edx) 指地址 ECX+260 + EDX 处的值,即 0x108.
  8. 0xFC(,%ecx,4) 指地址 (ECX*4)+0xFC 处的值,即 0x100.
  9. (%eax, %edx, 4) 指的是地址 (EAX+(EDX*4),在 0x10C 处的值.
  1. %eax refers to actual value of the register(=0x100).
  2. 0x104 refers to the value at address 0x104.
  3. $0x108 refers to the constant value 0x108.
  4. (%eax) refers to the value at address EAX, which is equivalent to 0x100(=0xFF).
  5. 4(%eax) refers to the value at address EAX+4, which is at 0x104.
  6. 9(%eax, %edx) refers to the value at address EAX+9 + EDX, which is at 0x10C.
  7. 260(%ecx, %edx) refers to the value at address ECX+260 + EDX, which is at 0x108.
  8. 0xFC(,%ecx,4) refers to the value at address (ECX*4)+0xFC, which is at 0x100.
  9. (%eax, %edx, 4) refers to the value at address (EAX+(EDX*4), which is at 0x10C.

这篇关于每个 AT&T 语法操作数访问内存或寄存器中的什么值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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