当前位置:网站首页>8086 of x86 architecture
8086 of x86 architecture
2022-04-23 13:00:00 【CS student】
Composition of computer
The following figure is an abstract diagram of the hardware that makes up the computer .

- CPU: The core hardware of a computer , Responsible for the execution of ( Calculation ) Program . All hardware devices work around it .
- Bus : There are many integrated circuits on the motherboard , be responsible for CPU High speed communication with other devices .
- Memory : Assist the computer to complete the calculation task . Because complex tasks require complex calculation steps , The amount of calculation results produced by complex calculation steps is CPU The register cannot hold , Memory is responsible for helping CPU Storage exceeds CPU Those intermediate results of register capacity .
- Other equipment : There are other devices on the bus , For example, the graphics card will be connected to the display 、 The disk controller will connect the hard disk 、USB The controller will connect the keyboard, mouse and so on .
CPU The composition of
CPU In fact, it is not a simple piece , It consists of three parts , Arithmetic unit 、 Data unit and control unit .

- Arithmetic unit : In charge of calculation , For example, adding 、 Do displacement, etc . however , It doesn't know what data to count , Where should the operation result be placed . If the data calculated by the operation unit passes through the bus every time , Go to the memory and get it now , It's too slow , So there it is
- Data unit : Be responsible for temporarily storing data and calculation results . Data unit Include CPU Internal cache and register set , The space is very small , But fast .
- control unit : Be responsible for what operations . It's a unified command center , Its register can get the next instruction , Then execute the command . This instruction will instruct the arithmetic unit to fetch some data in the data unit , Calculate a result , Then put it somewhere in the data unit .
CPU Cooperation with memory

First , Make it clear that ,
- Each process corresponds to a program , The program is stored on the hard disk in binary form .
- Once the process runs , You will have your own independent memory space . for example : The process in the figure A and B Memory space is isolated and discontinuous .
- The memory space of a process is divided into code segments and data segments , This is a relatively abstract division method , It's actually more complicated .
- The instruction is divided into two parts . The first part is the operand , What operation does it represent ; The latter part is the operation data .
- Instruction pointer register : In order to CPU control unit , It stores the address of the next instruction in memory .
after , Let's see CPU Interaction with memory ,
- First , be located CPU The instruction pointer register of the control unit will guide the control unit to continuously read instructions from the code segment , And store the instructions in the instruction register located in the control unit .
- after , The first part of the instruction is given to the arithmetic unit , The second part is handed over to the data unit .
- In the following , The data unit reads the data in the data segment into the data register of the data unit according to the data address , At this time, the data can participate in the operation of the operation unit .
- When the operation is finished , The result will be temporarily stored in the data register of the data unit .
- Final , There will be instructions to write data back to the data segment in memory .
CPU How to distinguish the processes to be executed
The above process is for a process , So many times CPU How to distinguish ?
CPU There are two registers in the control unit to distinguish which process should be executed at present , They are Instruction start address register and Data start address register .
- Instruction start address register : Used to point to the starting address of the code segment .
- Data start address register : Used to point to the starting address of the data segment .
When the points of two registers belong to the memory space of the same process , So what is currently executing is the instruction of this process .
Bus ——CPU Channels that interact with memory
CPU The interaction with memory mainly involves two types of data , One is the address , That is, where do I want to get the data in memory ; One is data , The real data . They are transmitted through different types of buses , They are address bus and data bus .
- Address bus : The number of digits determines how wide the address range can be accessed . For example, there are only two , that CPU You can only recognize 00,01,10,11 Four positions , More than four positions , You can't tell . The more digits , The more locations you can access , The more memory you can manage .
- data bus : The number of digits determines how many data can be taken in at a time . For example, there are only two , that CPU You can only get two digits from memory at a time . If you want eight , Just take it four times . The more digits , The more data you get at a time , The faster the access speed .
X86 framework
16 Bit model ——8086 processor

control unit
First look at the registers of the control unit :
- IP register : Instruction pointer register . Point to the location of the next instruction in the code segment .CPU According to it, the instructions will be continuously removed from the code segment in memory , Load into CPU In the instruction queue , Then give it to the arithmetic unit to execute .
- CS register : Code segment register , It is the instruction start address register in the previous figure .
- DS register : Segment register , Is the data start address register in the previous figure .
- SS register : Stack segment register , The starting address of the stack segment .
- ES register
- Other registers
Data unit
First look at the registers of the control unit :
- General registers :8 individual 16 position , The number of digits depends on the machine word length . Namely AX、BX、CX、DX、SP、BP、SI、DI. These registers are mainly used to temporarily store data during calculation .
- AX、BX、CX、DX It can be divided into two 8 Bit register to use , Namely AH、AL、BH、BL、CH、CL、DH、DL, among H Namely High( High position ),L Namely Low( Low position ) It means .
CPU How to get data from memory
The data bus has only 16 position , The address is also 16 position . The address bus has 20 position , So how to address it ?CS、DS Corresponding to the starting position , The starting position can only be calibrated , To determine the specific position in the segment, you also need the position in the segment , This is called offset . The formula is :
The specific location in the paragraph = The starting position << 4 + Offset .
The offset of the code segment is IP In the register , The offset of the data segment is in the general register . in addition , Addition does not cause data bit overflow , because , The range of offset is determined according to the start address and end address of the segment , It's not as big as you can be . such as : The starting address of the segment is FFFF0, The maximum segment end address is FFFFF, The range of the offset is 0000~000F, The offset can never be FFFF.
This is a kind of direct Methods , Get the segment start address from the segment register .
32 Bit model
x86 Architecture is a compatible structure ,32 The design of bit should also take into account 16 Design of bit architecture .

Data unit
- General registers : Put the original 16 The bit register is extended to 32 position , But still keep 8 Bit and 16 Bit composition .
control unit
- IP register :16 Bit extension to 32 position .
Control unit and original 16 Bit design incompatibility
Because the original model (16 Bit design ) Actually, it's a little nondescript , Because it's not used 16 Bit data as the starting address of a segment , I didn't press 8 Bits or 16 Bit extended form , But according to the hardware at that time , Got a top-down 20 Address of bit . In this way, you have to move four places to the left every time , This means that the starting address of the segment cannot be anywhere , It's just divisible 16 The place of .
How to solve it ? set up a separate kitchen !
- Segment descriptor cache device : True segment start address .
- Some form : Consists of segment descriptors , Each item in the table is a segment descriptor .
- CS、DS、SS、ES register : Still 16 position , Save an item in the form .
- Segment selection sub register :CS、DS、SS、ES Register composition .
CPU How to get data from memory

Segment select from register first select an item from the table , Then get the starting address of the segment from this item . The segment start address is initially in memory ,CPU In order to get the address faster , Will put the starting address of the segment into CPU The cache .
This is a kind of indirect Methods .
CPU Real mode and protection mode
| CPU Pattern | The way of distinction | Time | remarks |
|---|---|---|---|
| Real model | Get the segment start address directly from the segment register | When the system starts up | This is compatible 16 Bit |
| Protected mode | Indirectly, first find an entry in the table from the segment register , Then get the starting address of the segment from an item in the table | Need more memory | Follow certain rules , Carry out a series of operational switching |
版权声明
本文为[CS student]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230613588759.html
边栏推荐
- SSM framework series - JUnit unit test optimization day2-3
- V-model binding value in El select, data echo only displays value, not label
- STM32 control stepper motor (ULN2003 + 28byj)
- MySQL supports IP access
- Remote access to raspberry pie at home (Part 1)
- Image attribute of input: type attribute of fashion cloud learning -h5
- 22. Bracket generation
- HQL statement tuning
- Get the punch in record of nailing attendance machine
- 4.DRF 权限&访问频率&过滤&排序
猜你喜欢

Recovering data with MySQL binlog

梳理網絡IP代理的幾大用途

Process virtual address space partition

Date time type in database

There is no need to crack the markdown editing tool typora

有趣的IDEA插件推荐,给你的开发工作增添色彩

Servlet监听器&过滤器介绍

世界读书日:我想推荐这几本书
![[vulnhub range] - DC2](/img/b7/c34f69a231dad653b8a912f1f36bef.png)
[vulnhub range] - DC2

The quill editor image zooms, multiple rich text boxes are used on one page, and the quill editor upload image address is the server address
随机推荐
软件测试周刊(第68期):解决棘手问题的最上乘方法是:静观其变,顺水推舟。
Community version Alibaba MQ ordinary message sending subscription demo
leetcode-791. 自定义字符串排序
Customize classloader and implement hot deployment - use loadclass
5 free audio material websites, recommended collection
SSM框架系列——注解开发day2-2
Jupiter notebook installation
将opencv 图片转换为字节的方式
21 days learning mongodb notes
Idea的src子文件下无法创建servlet
Golang implements MD5, sha256 and bcrypt encryption
1130 - host XXX is not allowed to connect to this MySQL server error in Navicat remote connection database
Byte jump 2020 autumn recruitment programming question: quickly find your own ranking according to the job number
leetcode-791. Custom string sorting
产品开发都应该知道的8个网站,增强工作体验
HQL statement tuning
SQL exercise question 1
Important knowledge of transport layer (interview, retest, final)
Remote sensing image classification and recognition system based on convolutional neural network
Jiachen chapter Genesis "inner universe" joint Edition