AT&T GNU X86-64,I386 汇编语法简述

本文旨在帮助读者掌握64位x86汇编的基本知识,以便能读懂gcc生成的大部分汇编代码。尽管x86指令集设计不佳,但却是世界上最广泛使用的指令集。它打破了良好ISA设计的几乎所有规则,但Intel和AMD通过工程设计降低了其对CPU设计的负面影响。文章中包含了一个汇编语法的例子链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


1


Purposeand Caveats

 

 

 

 

•       This guide should give you enough background to read andunderstand (most) of the 64bit x86 assembly that gcc is likely to produce.

 

•       x86 is apoorly-designed ISA. It’s a mess, but it is the most widely used ISA in theworld today.

 

•         Itbreaks almost every rule of good ISA design

•         Justbecause it is popular does not mean it’s good

•       Inteland AMD have managed to engineer (at considerable cost) their CPUs so that thisugliness has relatively little impact on their processors’ design (more on thislater)

 

•        There’sa nice example here

•        http://en.wikibooks.org/wiki/X86_Assembly/GAS_Syntax


 

 

2


Registers

 

 

16bit

 

32bit

 

64bit

Description

Notes

 

AX

 

EAX

 

RAX

The accumulator register

 

 

BX

 

EBX

 

RBX

The base register

 

 

CX

 

ECX

 

RCX

The counter

 

 

DX

 

EDX

 

RDX

The data register

These can be used

 

SP

 

ESP

 

RSP

Stack pointer

more or less

 

 

 

 

 

 

 

interchangeably

 

BP

 

EBP

 

RBP

Points to the base of the stack frame

 

 

 

 

 

 

 

Rn

 

RnD

(n = 8...15) General purpose registers

 

 

SI

 

ESI

 

RSI

Source index for string operations

 

 

DI

 

EDI

 

RDI

Destination index for string operations

 

 

IP

 

EIP

 

RIP

Instruction Pointer

 

 

 

FLAGS

 

Condition codes

 

 

 

Differentnames (e.g. ax vs. eax vs. rax) refer to different parts of the same register



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值