汇编语言学习笔记——2

汇编语言学习[2018-05-07],第 2 天

Pentium 4处理器的执行单元、寄存器、标识寄存器

执行单元

  • Simple-integer operations
  • Complex-integer operations
  • Floating-point operations

对于浮点执行单元,Pentium 4包含MMX(SIMD)和SSE指令集


寄存器

IA-32平台主要的寄存器如下:

  • General purpose Eight 32-bit registers used for storing working data
  • Segment Six 16-bit registers used for handling memory access
  • Instruction pointer A single 32-bit register pointing to the next instruction code to execute
  • Floating-point data Eight 80-bit registers used for floating-point arithmetic data
  • Control Five 32-bit registers used to determine the operating mode of the processor
  • Debug Eight 32-bit registers used to contain information when debugging the processor
  • General purpose Eight 32-bit registers used for storing working data
  • General purpose Eight 32-bit registers used for storing working data
  • General purpose Eight 32-bit registers used for storing working data

通用寄存器

  • EAX Accumulator for operands and results data
  • EBX Pointer to data in the data memory segment
  • ECX Counter for string and loop operations
  • EDX I/O pointer
  • EDI Data pointer for destination of string operations
  • ESI Data pointer for source of string operations
  • ESP Stack pointer
  • EBP Stack data pointer

32位的EAX, EBX, ECX, 和 EDX寄存器,也可以作为16位或8位寄存器使用:
AX、BX、CX、DX;AL、AH、BL、BH、CL、CH、DL、DH ;

段寄存器

  • CS Code segment
  • DS Data segment
  • SS Stack segment
  • ES Extra segment pointer
  • FS Extra segment pointer
  • GS Extra segment pointer

每个段寄存器都是16位的,保存内存段的起始地址 ;
DS, ES, FS, 和 GS通常指向数据段 ;
SS段寄存器,指向栈内存段 ;
当内存模式使用Real Mode时,所有段寄存器被置0,并且不会被程序修改 ;

IA-32平台支持的内存模型
  • Flat memory model
  • Segmented memory model
  • Real-address mode

指令指针寄存器

EIP sometimes called the program counter, keeps track of the
next instruction code to execute

实模式下,指令指针指向实际内存地址 ;

段内存模式下,指令指针指向逻辑内存地址,基于CS寄存器的值 ;

控制寄存器

  • CR0 System flags that control the operating mode and states of the
    processor
  • CR1 Not currently used
  • CR2 Memory page fault information
  • CR3 Memory page directory information
  • CR4 Flags that enable processor features and indicate feature capabilities
    of the processor

控制寄存器的值,不能直接读取和写入,可以将控制寄存器的值移入通用寄存器,然后读取,写入同理,将写入的值先写入通用寄存器,然后移入控制寄存器 ;


标识寄存器

EFLAGS寄存器,用于探测处理器的操作结果;
IA-32平台,使用32寄存器保存一组status, control, and system flags ;

  • Status flags
  • Control flags
  • System flags

Status flags

FlagBitName
CF0Carry flag
PF2Parity flag
AF4Adjust flag
ZF6Zero flag
SF7Sign flag
OF11Overflow flag

Control flags

当前只有DF flag, or direction flag.It is used to control the way strings are handled by the processor.

System flags

The system flags are used to control operating system–level operations. Application programs should
never attempt to modify the system flags.

FlagBitName
TF8Trap flag
IF9Interrupt enable flag
IOPL12 and 13I/O privilege level flag
NF14Nested taskflag
RF16Resume flag
VM17Virtual-8086 mode flag
AC18Alignment check flag
VIF19Virtual interrupt flag
VIP20Virtual interrupt pending flag
ID21Identification flag

另外浮点数操作相关寄存器

FPU RegisterDescription
Data registersEight 80-bit registers for floating-point data
Status registers16-bit register to report the status of the FPU
Control registers16-bit register to control the precision of the FPU
Tag registers16-bit register to describe the contents of the eight data registers
FIP registers48-bit FPU instruction pointer (FIP) points to the next FPU instruction
FDP registers48-bit FPU data pointer (FDP) points to the data in memory
Opcode registers11-bit register to hold the last instruction processed by the FPU

其他内容摘录

  • Multimedia extensions (MMX):MMX was the first technology to support the Intel Single Instruction, Multiple
    Data (SIMD) execution model.
  • Streaming SIMD extensions (SSE)
  • Hyperthreading
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值