"Assembly Language Program Design" study notes (2) II. x86 system structure

Source: Internet
Author: User
Preliminary study on 2.1 x86 system structure Preliminary study on computer system of 2.1.1 80x86

The word cell address is represented by its low address.

Byte and byte access is the minimum mode of memory access, the basic unit of access.

For x86, because it takes a small-end storage mode, the Word cell address is represented by its low-level address. 2.2.1 80x86 processor and protection mode preliminary

(
This video suggests repeating 2 times.
)

You run 100 programs each program is 2G words that can not have 200G memory space This is not how do you do it? How do you prevent my data from interfering with the reading and writing of your data? This is where you need a protection mechanism, so call it a storage area for protected-mode programs. The use of paging segmented storage management mechanism to achieve the classification using non-interference of the purpose that is to make each task each program looks like I have a continuous space of a contiguous space of course, it is actually a virtual is a logical physical how to implement it through this protection mode to achieve

8 General-purpose registers EAX to EDI to ESP to EDP

Well, ESP is a little special. It is used as a hardware-supported stack top-pointing register called the stack-top pointer register. I'll talk later.

EDP is a little bit special. It's actually used as a procedure when the process is called, and it's in the stack where it's in the program stack. We'll talk about it in the back of the stack where it's located.

At the same time, there are 6 segment registers. This is actually the length of the history of the segment register is 16 bits of which 13 bits represent the memory segment of a number called the "segment selector" This is a little bit of a very important thing to say that I run the program when AH occupies a continuous space This continuous space is actually running at the time of the segmentation of each section has a distinction between

How do you distinguish that paragraph from the paragraph register to distinguish that paragraph register how to distinguish the law is actually like this to look at this picture ah roughly gives a principle in the protection mode of the 80x86 mode is the segment mode is actually divided into the section Mode page mode

Page mode we will focus on the future when we talk about MIPS in the page mode to introduce how virtual memory is implemented

Let's start with a brief introduction to the segment today. First of all, it supports multi-tasking processing to support the characteristics of virtual memory. What do you mean, when we write the program, you'll have an address in the program, a pointer, or a memory address of your address, which is called a logical address. Actually, two elements constitute an SE Lector called segment Selector

The second is that offset is the segment selector that determines which segment of the memory you want to access is within a contiguous space segment. By offset, I need to convert this logical address into a physical address.

So why do you do this conversion? Just mentioned that you can play the role of protection is equivalent to every program run time it sees the logical address space is the same, but I through the hardware through the processor to convert your logical address into a separate physical address that will cause the effect of that protection Is that every program I write the program can not take into account the other program is not running his memory how to use because we all seem to access a continuous address space but actually run when the virtual memory map to the actual physical address space to separate it from the role of protection does not interfere with each other

Well, how do you divide it? The first thing to do is to make a conversion to a virtual address, which means there's a memory addressing in protected mode. Your virtual storage address two elements a selector an offset offset in this transformation it is unchanged Selector plays a key role selector is called a segment register strictly speaking it should be called segment selection address it tells you to have this selector how do you get a table with a single segment descriptor from a header I'm in the table of this segment descriptor based on your segment selector or segment Select address the physical address of the section of the program that corresponds to your application. This base address plus your offset two a plus to generate the final physical address is equivalent to saying that you pass the physical bus The address at which this memory was accessed

Protection mode protects what.

is to distinguish between the stores used by different tasks, and not allow the data and code of other tasks to be used casually.

That's the equivalent of taking the GDT to locate the LDT through the GDT and then through this LDT to locate your section base with this section base, plus this offset, your final physical address to calculate this.

Reference documents:
1. assembly language Programming-Tsinghua University-academy online.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.