基于x86处理器汇编语言-x86处理器架构

2.1一般概念

1. The central processor unit (CPU) contains registers and what other basic elements?

  • The clock synchronizes the internal operations of the CPU with other system components. 时钟同步CPU内部操作和其它系统组件。
  • The control unit (CU) coordinates the sequencing of steps involved in executing machine instructions. 控制单元协调执行机器指令中步骤顺序。
  • The arithmetic logic unit (ALU) performs arithmetic operations such as addition and subtraction and logic operations such as AND, OR, and NOT. 算术逻辑单元执行算术操作,例如加、减,逻辑操作,例如与、或、非。

2. The central processor unit is connected to the rest of the computer system using what three buses?

  • data bus. 数据总线。
  • control bus. 控制总线。
  • address bus. 地址总线。

3. Why does memory access take more machine cycles than register access? 为什么访问存储器要比寄存器使用更多的机器周期。

Conventional memory is ouside the CPU and it responds more slowly to access requests. Registers are hard-wired inside the CPU.

传统的存储器都在CPU外部,对访问的响应比较慢。寄存器在CPU内部。

4. What are the three basic steps in the instruction execution cycle? 执行指令周期的基本三个步骤是什么?

  • Fetch. 取指令。
  • Decode. 解码。
  • Execute. 执行。

5. Which two additional steps are required in the instruction execution cycle when a memory operand is used? 如果使用存储器操作数,指令执行周期的两个额外步骤是什么?

  • Fetch operands. 取操作数。
  • Store output operand. 存储结果。

6. During which stage of the instruction execution cycle is the program counter incremented? 在指令执行周期的哪个阶段,程序计数器增长。

Fetch step. 取指令步骤。

7. When a program runs, what information does the OS read from the filename’s disk directory entry? 当程序运行时,操作系统从程序硬盘目录项中读取哪些信息?

filename, file size, and starting location on the disk. 文件名、文件大小、磁盘上的开始位置。

8. After a program has been loaded into memory, how does it begin execution? 当程序加载到内存后,如何开始执行?

The OS executes a branch (like a GOTO) to the first machine instruction in the program. 操作系统执行一个跳转指令(类似GOTO),转到程序的第一条机器指令。

9. Define multitasking. 描述多任务。

The CPU executes multiple tasks (programs) by rapidly switching from one program to the next. This gives the impression that all programs are executing at the same time.

CPUc通过在多个任务(程序)间快速地切换执行多个任务。这给我们一个感觉,所有的程序在同一时间执行。

10. What is the function of the OS scheduler? 操作系统调试程序的作用是什么?

The OS scheduler determines how much time to allot to each task, and it switches between tasks.

决定分配给每个任务的时间,并在任务间切换。

11. When the processor switches form one task to another, what values in the first task’s state must preserved? 当处理器从一个任务切换到另一个任务时,需要保留第一个任务的哪些状态。

The program counter, the task’s variables, and the CPU registers (including the status flags). 程序计数器,任务变量和CPU寄存器(包括状态标志)。

12. What is the duration of a single clock cycle in a 3-GHz processor? 3-GHz处理器的一个时钟周期有多长?

3.33 * 10-10

2.2 x86架构细节

1. What are the x86 processor’s three basic modes of operation? 什么是x86的基本操作模式?

  • Protected Mode. 保护模式。在保护模式下,所有指令和特性都能使用。程序被分配单独的内存区域,称作段。处理器禁止程序引用分配的段之外的内存。
  • Real-address mode. 实地址模式。实地址模式实现了8086处理器的编程环境和一些额外的特性,例如切换到其它模式的功能。Windows 98可以使用这个模式,这个模式可以用来运行需要访问系统内存和硬件设备的MS-DOS程序。在实地址模式下运行的程序可能导致操作系统崩溃(停止响应)。
  • System management mode. 系统管理模式。提供操作系统实现一些类似电源管理和系统安全等功能的机制。这些功能通常由计算机生产商实现。

2. Name all eight 32-bit general-purpose registers. 说出所有8个32位通用寄存器。

EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP

3. Name all six segment registers.  说出所有6个段寄存器。

CS, DS, SS, ES, FS, GS

4. What special purpose does the ECX register serve? ECX寄存器有什么特殊作用?

Loop counter. 循环计数器。

5. Besides the stack pointer (ESP), what other register points to variables on the stack? 除了栈指针(ESP),还有哪个寄存器指向栈上的变量?

EBP.

6. Name at least four CPU status flags. 说出至少四个CPU状态标志。

  • The Carry flag (CF). Is set when the reslt of an unsigned arthmetic operation is too large to fit into destination.
  • The Overflow flag (OF). Is set when the result of an signed arthmetic operation is too large or too small to fit into the destination.
  • The Sign flag (SF). Is set when the result of an arithmetic or logical operation generates a negative result。
  • The Zero flag (ZF). Is set when the result of an arithmetic or logical operation generates a result of zero。
  • The Auxiliary Carry flag (AC). Is set when an arithmetic operation causes a carry from bit 3 to bit 4 in an 8-bit operand.
  • The Parity flag (PF) is set if the least-significant byte in the result contains an even number of 1 bits. Otherwise, PF is clear. In general, it is used for error checking when there is a possibility that data might be altered or corrupted.

7. Which flag is set when the result of an unsigned arithmetic operation is too large to fit into the destination?

Carry.

8. Which flag is set when the result of a signed arithmetic operation is either too large or too small to fit into the destination?

Overflow.

9. Which flag is set when an arithmetic or logical operation generates a negative result?

Sign.

10. Which part of the CPU performs floating-point arighmetic?

Floating-point Unit。

11. How many bits long are the FPU data registers? 浮点运算单元数据寄存器的长多少比特?

80bits.

12. Which Intel processor was the first member of the IA-32 family?

The Intel 80386.

13. Which Intel processor first introduced superscalar execution? 哪一款Intel处理器首先引入超标量执行?

Pentium.

14. Which Intel processor first used MMX technology?  哪一款Intel处理器首先使用MMX技术?

The Pentium II.

15. Describe the CISC design approach. 描述CISC设计方法。

CISC means complex instruction set: a large collection of instructions, some of which perform sophisticated operations that might be typical of high-level language.

CISC指复杂指令集:大指令集合,其中的一些执行可能是高级语言特有的复杂操作。

16. Describe the RISC design approach. 描述RISC设计方法。

RISC means reduced instruction set: a small set of simple (atomic) instructions that may be combined into more complex operations.

RISC指精简指令集:由简单(原子的)指令构成的小指令集合,由它们可以组合成更复杂的操作。

2.3 x86内存管理

1. What is the range of addressable memory in protected mode? 在保护模式下的寻址范围是什么?

4GByte (0 to FFFFFFFFh).

2. What is the range of addressable memory in real-address mode? 在实模式下的寻址范围是什么?

1MByte (0 to FFFFFh).

3. The two ways of describing an address in real-address mode are segment-offset and what? 在实模式下描述地址的两个方法是段偏移地址和什么?

Linear (absolute). 线性(绝对)地址。

4. In real-address mode, convert the following hexadecimal segment-offset address to a linear address: 0950:0100.

09600h.

5. In real-address mode, convert the following hexadecimal segment-offset address to a linear address:  0CD1:02E0.

0CFF0h.

6. In MASM’s flat segmentation model, how many bits hold the address of an instruction or variable?  在MASM的平坦分段模型中,指令或变量的地址是多少位?

32bits.

7. In protected mode, which register references the descriptor for the stack segment? 在保护模式下,哪个寄存器引用栈段描述符。

SS.

8. In protected mode, which table contains pointers to memory segments used by a single program? 在保护模式下,哪张表包含指向单个程序使用的内存段的指针。

Local Descriptor Table (LDT).

9. In the flat segmentation model, which table contains pointers to at least two segments?  在平坦段模型中,哪个表包含指向至少两个段的指针。

Global Descriptor Table (GDT). 两个段指代码段和数据段。

10. What is the main advantage to using the paging feature of x86 processors? 使用x86处理器页特性的最主要的好处是什么?

The total size of all programs loaded into memory can exceed the amount of physical memory installed in the computer.

加载到内存中的所有程序的大小可以超过安装的物理内存的大小。

11. Can you think of a reason why MS-DOS was not designed to support protected-mode programming?

12. In real-address mode, demonstrate two segment-offset addresses that point to the same linear address.

2.4 典型x86计算机的组件

1. Describe SRAM and its most common use. 描述SRAM和最常用的用途。

SRAM is an acronym for Static RAM. It is used primarily for expensive, high-speed cache memory. It does not have to be refreshed. CPU cache memory is cmprised of SRAM.

SRAM的全称是静态RAM。它主要用作昂贵的、高速缓存存储器。它是一种具有静止存取功能的存储器,不需要刷新电路即能保存它内部存储的数据。而DRAM每隔一段时间,要刷新充电一次,否则内部的数据即会消失。

2. Describe VRAM. 描述VRAM。

VRAM (video ram) holds displayable video data. When CRT monitors are used, VRAM is dual ported, allowing one port to continuously refresh the display while another port writes data to the display.

VRAM (显存)保存可显示的视频数据。当使用CRT显示器时,VRAM是双端口的,允许一个端口不断地刷新显示,而另一个端口写入需要显示的数据。

3. List at least two features found in the Intel P965 Express chipset. 列出至少两个Intel P965 Express芯片组的特点。

It is used in desktop PCs, with either an Intel Core 2 Duo or Pentium D processor. Features:

  • Intel Fast Memory Access uses an updated Memory Controller Hub (MCH). It can access dual-channel DDR2 memory, at an 800 MHz clock speed.
  • An I/O Controller Hub (Intel ICH8/R/DH) uses Intel Matrix Storage Technology (MST) to support six Serial ATA devices (disk drives).
  • Support for 10 USB ports, six PCI express slots, networking, Intel Quiet System technology.
  • A high definition auto chip provides digital sound capabilities.

4. Name four types of RAM mentioned in this chapter.

  • Dynamic RAM.
  • Static RAM.
  • Video RAM.
  • CMOS RAM.

5. Which type of RAM is used for Level 2 cache memory? 2级缓存使用哪种类型的RAM?

Static RAM.

6. What advantages does a USB device offer over a standard serial or parallel device? UST设备相对于传统的串行和并行设备相比有哪些优点?

The computer can query a device connected via USB to find out its name and device type and type of driver it supports. The computer can also suspend power to individual devices. None of these capabilities is possible with serial and parallel ports.

计算机可以询问通过USB连接的设备得到它的名字、设备类型和它支持的驱动类型。计算机也可以暂停某一设备的电源供应。传统的串行和并行端口不提供这些功能。

7. What is the purpose of the 8259A PIC controller? 8259A PIC控制器的作用是什么?

The 8259A Programmable Interrupt Controller (PIC) handles external interrupts from hardware devices, such as the keyboard, system clock, and disk drives. These devices interrupt the CPU and make it process their requests immediately.

8259A PIC可编程中断控制器处理来自硬件设备,例如键盘、系统时钟和磁盘驱动器的外部中断。这些设备中断CPU,使CPU立即处理它们的请求。

8. What are the main differences between Wi-Fi and Bluetooth? Wi-Fi和蓝牙的主要区别是什么?

Bluetooth is a wireless communication protocol for exchanging small amounts of data over short distances. It is commonly used with mobile devices such as phones and PDAs. Wi-Fi devices operate at a grater speed and capacity then Bluetooth. Wi-Fi devices often communicate with each other when in the range of a wireless network.

蓝牙是在短距离交换少量数据的无线通信协议。它通常用在移动设备,例如电话和PDA上。Wi-Fi设备比Bluetooth设备的速度更快,容量更大。Wi-Fi设备一般在无线网站中相互通信。

2.5 输入输出系统

1. Of the four levels of input/output in a computer system, which is the most universal and portal? 在计算机系统输入输出的四个层次中,哪一个是最通常和可移植的。

The application program level.

应用程序级。

2. What characteristics distinguish BIOS-level input/output? BIOS级输入输出的特点是什么?

BIOS functions communicate directly with the system hardware. They are independent of the operating system.

BIOS直接与系统硬件通信。这们独立于操作系统。

3. Why are device drivers necessary, given that the BIOS already has code that communicates with the computer’s hardware? 为什么BIOS已经可以和计算机硬件通信,设备驱动还是必须的。

New devices are invented all the time with capabilities that were often not anticipated when the BIOS was written.

因为不断地有新设备被发明出来,它们的一些功能在编写BIOS时是预料不到的。

4. In the example regarding displaying a string of characters, which level exists between the operating system and the video controller card?

The BOIS level.

5. At which level(s) can an assembly language program manipulate input/output? 汇编语言在哪些级别可以操作输入输出?

The operating system, BIOS, and hardware levels.

操作系统、BIOS和硬件级别。

6. Why do game programs often send their sound output directly to the sound card’s hardware ports?

Game programs often try to take advantage of the latest features in specialized sound cards. It should be noted that MS-DOS game applications were more prone to do this than games running under MS-Windows. In fact, Windows-NT, 2000, and XP all prevent applications from directly accessing system hardware.

7. Is it likely that the BIOS for a computer running MS-Windows would be different from that used by a computer running Linux?

No. The same BIOS would work for both operating systems. Many computer owners install two or three operating systems on the same computer. They would certainly not want to change the system BIOS every time they rebooted the computer.

你可能感兴趣的:(汇编语言)