汇编语言学习[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
Flag | Bit | Name |
---|---|---|
CF | 0 | Carry flag |
PF | 2 | Parity flag |
AF | 4 | Adjust flag |
ZF | 6 | Zero flag |
SF | 7 | Sign flag |
OF | 11 | Overflow 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.
Flag | Bit | Name |
---|---|---|
TF | 8 | Trap flag |
IF | 9 | Interrupt enable flag |
IOPL | 12 and 13 | I/O privilege level flag |
NF | 14 | Nested taskflag |
RF | 16 | Resume flag |
VM | 17 | Virtual-8086 mode flag |
AC | 18 | Alignment check flag |
VIF | 19 | Virtual interrupt flag |
VIP | 20 | Virtual interrupt pending flag |
ID | 21 | Identification flag |
另外浮点数操作相关寄存器
FPU Register | Description |
---|---|
Data registers | Eight 80-bit registers for floating-point data |
Status registers | 16-bit register to report the status of the FPU |
Control registers | 16-bit register to control the precision of the FPU |
Tag registers | 16-bit register to describe the contents of the eight data registers |
FIP registers | 48-bit FPU instruction pointer (FIP) points to the next FPU instruction |
FDP registers | 48-bit FPU data pointer (FDP) points to the data in memory |
Opcode registers | 11-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