Pentium ® Pro Family Developer's Manual

Total Page:16

File Type:pdf, Size:1020Kb

Pentium ® Pro Family Developer's Manual Pentium Pro Family Developer’s Manual Volume 3: Operating System Writer’s Guide NOTE: The Pentium Pro Family Developer’s Manual consists of three books: Pentium Pro Family Developer’s Manual, Volume 1: Specifications (Order Number 242690); Pentium Pro Family Developer’s Manual, Volume 2: Programmer’s Reference Manual (Order Number 242691); and the Pentium Pro Family Developer’s Manual, Volume 3: Operating System Writer’s Guide (Order Number 242692). Please refer to all three volumes when evaluating your design needs. December 1995 Information in this document is provided in connection with Intel products. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document. Except as provided in Intel’s Terms and Conditions of Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating to sale and/or use of Intel products including liability or warranties relating to fitness for a particular purpose, merchantability, or infringement of any patent, copyright or other intellectual property right. Intel products are not intended for use in medical, life saving, or life sustaining applications. Intel may make changes to specifications and product descriptions at any time, without notice. The Pentium® Pro processor may contain design defects or errors known as errata. Current characterized errata are available on request. *Third-party brands and names are the property of their respective owners. Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. Copies of documents which have an ordering number and are referenced in this document, or other Intel literature, may be obtained from: Intel Corporation P.O. Box 7641 Mt. Prospect, IL 60056-7641 or call 1-800-879-4683 COPYRIGHT © INTEL CORPORATION 1996 TABLE OF CONTENTS CHAPTER 1 ABOUT THIS MANUAL 1.1. OVERVIEW OF THE PENTIUM PRO FAMILY DEVELOPER’S MANUAL, VOLUME 3 . 1-1 1.2. OVERVIEW OF THE PENTIUM PRO PROGRAMMER’S REFERENCE MANUAL 1-3 1.3. NOTATIONAL CONVENTIONS. 1-4 1.3.1. Bit and Byte Order . .1-4 1.3.2. Reserved Bits and Software Compatibility . .1-5 1.3.3. Instruction Operands . .1-5 1.3.4. Hexadecimal and Binary Numbers . .1-6 1.3.5. Segmented Addressing . .1-6 1.3.6. Exceptions . .1-6 1.4. RELATED LITERATURE . 1-7 CHAPTER 2 SYSTEM ARCHITECTURE OVERVIEW 2.1. OVERVIEW OF THE SYSTEM-LEVEL ARCHITECTURE . 2-1 2.1.1. Global and Local Descriptor Tables . .2-3 2.1.2. System Segments, Segment Descriptors, and Gates . .2-3 2.1.3. Task State Segments and Task Gates . .2-4 2.1.4. Interrupt and Exception Handling . .2-4 2.1.5. Memory Management . .2-4 2.1.6. System Registers . .2-5 2.1.7. Other System Resources . .2-6 2.2. MODES OF OPERATION . 2-6 2.3. SYSTEM FLAGS AND FIELDS IN THE EFLAGS REGISTER . 2-7 2.4. MEMORY-MANAGEMENT REGISTERS . 2-10 2.4.1. Global Descriptor Table Register (GDTR). .2-10 2.4.2. Local Descriptor Table Register (LDTR) . .2-11 2.4.3. IDTR Interrupt Descriptor Table Register . .2-11 2.4.4. Task Register (TR) . .2-11 2.5. CONTROL REGISTERS . 2-12 2.5.1. CPUID Qualification of Control Register Flags . .2-17 2.6. SYSTEM INSTRUCTION SUMMARY . 2-17 2.6.1. Loading and Storing System Registers . .2-19 2.6.2. Verifying of Access Privileges . .2-19 2.6.3. Loading and Storing Debug Registers. .2-20 2.6.4. Invalidating Caches and TLBs. .2-20 2.6.5. Controlling the Processor . .2-20 2.6.6. Reading Performance Monitoring and Time Stamp Counters. .2-21 2.6.7. Reading and Writing Model-Specific Registers . .2-21 CHAPTER 3 PROTECTED-MODE MEMORY MANAGEMENT 3.1. MEMORY MANAGEMENT OVERVIEW . 3-1 3.2. USING SEGMENTS. 3-3 3.2.1. Flat Model . .3-3 3.2.2. Protected Flat Model . .3-4 iii TABLE OF CONTENTS 3.2.3. Multi-Segment Model. .3-5 3.2.4. Paging and Segmentation . .3-6 3.3. PHYSICAL ADDRESS SPACE . 3-7 3.4. LOGICAL AND LINEAR ADDRESSES . 3-7 3.4.1. Segment Selectors . .3-8 3.4.2. Segment Registers . .3-9 3.4.3. Segment Descriptors. .3-10 3.4.3.1. Code and Data Segment-Descriptor Types . .3-14 3.5. SYSTEM SEGMENT-DESCRIPTOR TYPES . 3-15 3.5.1. Segment Descriptor Tables. .3-16 3.6. PAGING (VIRTUAL MEMORY) . 3-18 3.6.1. Paging Options . .3-19 3.6.2. Page Tables and Directories . .3-20 3.6.2.1. Linear Address Translation (4-KByte Pages) . .3-20 3.6.2.2. Linear Address Translation (4-MByte Pages). .3-21 3.6.2.3. Mixing 4-KByte and 4-MByte Pages . .3-22 3.6.3. Base Address of the Page Directory . .3-22 3.6.4. Page-Directory and Page-Table Entries . .3-23 3.6.5. Not Present Page-Directory and Page-Table Entries . .3-27 3.7. TRANSLATION LOOKASIDE BUFFERS (TLBS) . 3-28 3.8. PHYSICAL ADDRESS EXTENSION . 3-29 3.8.1. Linear Address Translation With Extended Addressing Enabled (4-KByte Pages) . .3-29 3.8.2. Linear Address Translation With Extended Addressing Enabled (2-MByte Pages) . .3-30 3.8.3. Accessing the Full Extended Physical Address Space With the Extended Page Table Structure . .3-32 3.8.4. Page-Directory and Page-Table Entries With Extended Addressing Enabled . .3-32 3.9. MAPPING SEGMENTS TO PAGES . 3-34 CHAPTER 4 PROTECTION 4.1. ENABLING AND DISABLING SEGMENT AND PAGE PROTECTION . 4-1 4.2. FIELDS AND FLAGS USED FOR SEGMENT-LEVEL AND PAGE-LEVEL PROTECTION 4-2 4.3. LIMIT CHECKING . 4-4 4.4. TYPE CHECKING . 4-5 4.4.1. Null Segment Selector Checking. .4-6 4.5. PRIVILEGE LEVELS . 4-6 4.6. PRIVILEGE LEVEL CHECKING WHEN ACCESSING DATA SEGMENTS 4-8 4.6.1. Accessing Data in Code Segments. .4-9 4.7. PRIVILEGE LEVEL CHECKING WHEN LOADING THE SS REGISTER . 4-10 4.8. PRIVILEGE LEVEL CHECKING WHEN TRANSFERRING PROGRAM CONTROL BETWEEN CODE SEGMENTS 4-10 4.8.1. Direct Calls or Jumps to Code Segments . .4-10 4.8.1.1. Accessing Nonconforming Code Segments . .4-11 4.8.1.2. Accessing Conforming Code Segments. .4-13 4.8.2. Gate Descriptors . .4-13 4.8.3. Call Gates . .4-14 4.8.4. Accessing a Code Segment Through a Call Gate. .4-15 4.8.5. Stack Switching . ..
Recommended publications
  • Pdp11-40.Pdf
    processor handbook digital equipment corporation Copyright© 1972, by Digital Equipment Corporation DEC, PDP, UNIBUS are registered trademarks of Digital Equipment Corporation. ii TABLE OF CONTENTS CHAPTER 1 INTRODUCTION 1·1 1.1 GENERAL ............................................. 1·1 1.2 GENERAL CHARACTERISTICS . 1·2 1.2.1 The UNIBUS ..... 1·2 1.2.2 Central Processor 1·3 1.2.3 Memories ........... 1·5 1.2.4 Floating Point ... 1·5 1.2.5 Memory Management .............................. .. 1·5 1.3 PERIPHERALS/OPTIONS ......................................... 1·5 1.3.1 1/0 Devices .......... .................................. 1·6 1.3.2 Storage Devices ...................................... .. 1·6 1.3.3 Bus Options .............................................. 1·6 1.4 SOFTWARE ..... .... ........................................... ............. 1·6 1.4.1 Paper Tape Software .......................................... 1·7 1.4.2 Disk Operating System Software ........................ 1·7 1.4.3 Higher Level Languages ................................... .. 1·7 1.5 NUMBER SYSTEMS ..................................... 1-7 CHAPTER 2 SYSTEM ARCHITECTURE. 2-1 2.1 SYSTEM DEFINITION .............. 2·1 2.2 UNIBUS ......................................... 2-1 2.2.1 Bidirectional Lines ...... 2-1 2.2.2 Master-Slave Relation .. 2-2 2.2.3 Interlocked Communication 2-2 2.3 CENTRAL PROCESSOR .......... 2-2 2.3.1 General Registers ... 2-3 2.3.2 Processor Status Word ....... 2-4 2.3.3 Stack Limit Register 2-5 2.4 EXTENDED INSTRUCTION SET & FLOATING POINT .. 2-5 2.5 CORE MEMORY . .... 2-6 2.6 AUTOMATIC PRIORITY INTERRUPTS .... 2-7 2.6.1 Using the Interrupts . 2-9 2.6.2 Interrupt Procedure 2-9 2.6.3 Interrupt Servicing ............ .. 2-10 2.7 PROCESSOR TRAPS ............ 2-10 2.7.1 Power Failure ..............
    [Show full text]
  • DOS Virtualized in the Linux Kernel
    DOS Virtualized in the Linux Kernel Robert T. Johnson, III Abstract Due to the heavy dominance of Microsoft Windows® in the desktop market, some members of the software industry believe that new operating systems must be able to run Windows® applications to compete in the marketplace. However, running applications not native to the operating system generally causes their performance to degrade significantly. When the application and the operating system were written to run on the same machine architecture, all of the instructions in the application can still be directly executed under the new operating system. Some will only need to be interpreted differently to provide the required functionality. This paper investigates the feasibility and potential to speed up the performance of such applications by including the support needed to run them directly in the kernel. In order to avoid the impact to the kernel when these applications are not running, the needed support was built as a loadable kernel module. 1 Introduction New operating systems face significant challenges in gaining consumer acceptance in the desktop marketplace. One of the first realizations that must be made is that the majority of this market consists of non-technical users who are unlikely to either understand or have the desire to understand various technical details about why the new operating system is “better” than a competitor’s. This means that such details are extremely unlikely to sway a large amount of users towards the operating system by themselves. The incentive for a consumer to continue using their existing operating system or only upgrade to one that is backwards compatible is also very strong due to the importance of application software.
    [Show full text]
  • CS61C : Machine Structures •Remember: “Load from Memory”
    inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Review Lecture 9 – Introduction to MIPS • In MIPS Assembly Language: Data Transfer & Decisions I • Registers replace C variables • One Instruction (simple operation) per line • Simpler is Better, Smaller is Faster Lecturer PSOE Dan Garcia • New Instructions: www.cs.berkeley.edu/~ddgarcia add, addi, sub Future HVD 1 TB disks! ⇒ The future of digital storage • New Registers: (past the DVD, Blu-Ray and HD DVD) C Variables: $s0 - $s7 may be the Holographic Versatile Disc. Temporary Variables: $t0 - $t7 A massive 1 TB on each (200 DVDs)! 1TB www.zdnet.com.au/news/hardware/0,2000061702,39180148,00.htm Zero: $zero CS61C L09 Introduction to MIPS: Data Transfer & Decisions I (1) Garcia © UCB CS61C L09 Introduction to MIPS: Data Transfer & Decisions I (2) Garcia © UCB Assembly Operands: Memory Anatomy: 5 components of any Computer Registers are in the datapath of the • C variables map onto registers; what processor; if operands are in memory, about large data structures like arrays? Personal Computer we must transfer them to the processor to operate on them, and • 1 of 5 components of a computer: then transfer back to memory when done. memory contains such data structures Computer Processor Memory Devices • But MIPS arithmetic instructions only operate on registers, never directly on Control Input (“brain”) memory. Store (to) Datapath • Data transfer instructions transfer data Registers Output between registers and memory: Load (from) • Memory to register • Register to memory These are “data
    [Show full text]
  • Strengthening Diversification Defenses by Means of a Non-Readable Code
    1 Strengthening diversification defenses by means of a non-readable code segment Sebastian Österlund Department of Computer Science Vrije Universiteit, Amsterdam, Netherlands Supervised By: H. Bos & C. Giuffrida Abstract—In this paper we present a new defense against Just- hardware segmentation, this approach should theoretically have In-Time return-oriented-programming attacks. By making pro- no run-time performance overhead for Intel x86 architecture, gram code non-readable, the assembly of Just-In-Time gadgets by once it has been set up. Both position dependent executables scanning the memory is effectively blocked. Using segmentation and position independent executables are covered. Furthermore on Intel x86 hardware, the implementation of execute-only code an approach to implement a similar defense on x86_64 using can be achieved. We discuss two different ways of implementing the new MPX [7] instructions is presented. The defense such a defense for 32-bit Intel architecture: one for position dependent executables, and one for position independent executa- mechanism we present in this paper is of interest, mainly, bles. The first implementation works by splitting the address- for use in security of network connected applications (such space into two mirrored segments. The second implementation as servers or web-browsers), since these applications are often creates an execute-only memory-section at the top of the address- the main targets of remote code execution exploits. space, making it possible to still use the whole address-space. By relying on hardware segmentation the run-time performance II. RETURN-ORIENTED-PROGRAMMING ATTACKS overhead of these defenses is minimal. Remote code execution by means of buffer overflows has Keywords—ROP, segmentation, XnR, buffer overflow, memory been a problem for a long time.
    [Show full text]
  • Chapter 3 Protected-Mode Memory Management
    CHAPTER 3 PROTECTED-MODE MEMORY MANAGEMENT This chapter describes the Intel 64 and IA-32 architecture’s protected-mode memory management facilities, including the physical memory requirements, segmentation mechanism, and paging mechanism. See also: Chapter 5, “Protection” (for a description of the processor’s protection mechanism) and Chapter 20, “8086 Emulation” (for a description of memory addressing protection in real-address and virtual-8086 modes). 3.1 MEMORY MANAGEMENT OVERVIEW The memory management facilities of the IA-32 architecture are divided into two parts: segmentation and paging. Segmentation provides a mechanism of isolating individual code, data, and stack modules so that multiple programs (or tasks) can run on the same processor without interfering with one another. Paging provides a mech- anism for implementing a conventional demand-paged, virtual-memory system where sections of a program’s execution environment are mapped into physical memory as needed. Paging can also be used to provide isolation between multiple tasks. When operating in protected mode, some form of segmentation must be used. There is no mode bit to disable segmentation. The use of paging, however, is optional. These two mechanisms (segmentation and paging) can be configured to support simple single-program (or single- task) systems, multitasking systems, or multiple-processor systems that used shared memory. As shown in Figure 3-1, segmentation provides a mechanism for dividing the processor’s addressable memory space (called the linear address space) into smaller protected address spaces called segments. Segments can be used to hold the code, data, and stack for a program or to hold system data structures (such as a TSS or LDT).
    [Show full text]
  • MP Assignment V.Pages
    MP Assignment V 1. A. With a neat diagram, explain the internal structure of Pentium Pro. The Pentium Pro is structured d i f f e r e n t l y t h a n e a r l i e r microprocessors. The system buses, which communicate to the memory and I/O, connect to an internal level 2 cache that is often on the main board in most other microprocessor systems. The level 2 cache in the Pentium Pro is either 256K bytes or 512K bytes. The bus interface unit (BIU) controls the access to the system buses through the level 2 cache, which is integrated in Pentium Pro. The BIU generates the memory address and control signals, and passes and fetches data or instructions to either a level 1 data cache or a level 1 instruction cache. The instruction cache is connected to the instruction fetch and decode unit (IFDU). Pentium Pro can process two integer instructions and one floating-point instruction simultaneously. The dispatch and execute unit (DEU) retrieves decoded instructions from the instruction pool when they are complete, and then executes them. Pentium Pro has a RU (Retire unit) which checks the instruction pool and removes decoded instructions that have been executed. B. List the new features added to Pentium Pro when compared with its predecessors with respect to memory system. The memory system for the Pentium Pro microprocessor is 4G bytes in size, similar to 80386DX–Pentium microprocessors, but access to an area between 4G and 64G is made possible by additional address signals A32-35.
    [Show full text]
  • Computer Architectures an Overview
    Computer Architectures An Overview PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information. PDF generated at: Sat, 25 Feb 2012 22:35:32 UTC Contents Articles Microarchitecture 1 x86 7 PowerPC 23 IBM POWER 33 MIPS architecture 39 SPARC 57 ARM architecture 65 DEC Alpha 80 AlphaStation 92 AlphaServer 95 Very long instruction word 103 Instruction-level parallelism 107 Explicitly parallel instruction computing 108 References Article Sources and Contributors 111 Image Sources, Licenses and Contributors 113 Article Licenses License 114 Microarchitecture 1 Microarchitecture In computer engineering, microarchitecture (sometimes abbreviated to µarch or uarch), also called computer organization, is the way a given instruction set architecture (ISA) is implemented on a processor. A given ISA may be implemented with different microarchitectures.[1] Implementations might vary due to different goals of a given design or due to shifts in technology.[2] Computer architecture is the combination of microarchitecture and instruction set design. Relation to instruction set architecture The ISA is roughly the same as the programming model of a processor as seen by an assembly language programmer or compiler writer. The ISA includes the execution model, processor registers, address and data formats among other things. The Intel Core microarchitecture microarchitecture includes the constituent parts of the processor and how these interconnect and interoperate to implement the ISA. The microarchitecture of a machine is usually represented as (more or less detailed) diagrams that describe the interconnections of the various microarchitectural elements of the machine, which may be everything from single gates and registers, to complete arithmetic logic units (ALU)s and even larger elements.
    [Show full text]
  • PA-RISC 1.1 Architecture and Instruction Set Reference Manual
    PA-RISC 1.1 Architecture and Instruction Set Reference Manual HP Part Number: 09740-90039 Printed in U.S.A. February 1994 Third Edition Notice The information contained in this document is subject to change without notice. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with furnishing, performance, or use of this material. Hewlett-Packard assumes no responsibility for the use or reliability of its software on equipment that is not furnished by Hewlett-Packard. This document contains proprietary information which is protected by copyright. All rights are reserved. No part of this document may be photocopied, reproduced, or translated to another language without the prior written consent of Hewlett-Packard Company. Copyright © 1986 – 1994 by HEWLETT-PACKARD COMPANY Printing History The printing date will change when a new edition is printed. The manual part number will change when extensive changes are made. First Edition . November 1990 Second Edition. September 1992 Third Edition . February 1994 Contents Contents . iii Preface. ix 1 Overview . 1-1 Introduction. 1-1 System Features . 1-2 PA-RISC 1.1 Enhancements . 1-2 System Organization . 1-4 2 System Organization . 2-1 Introduction. 2-1 Memory and I/O Addressing . 2-2 Byte Ordering (Big Endian/Little Endian) . 2-3 Levels of PA-RISC. 2-5 Data Types . 2-5 Processing Resources. 2-7 3 Addressing and Access Control.
    [Show full text]
  • Instruction Set Architecture
    Instruction Set Architecture EE3376 1 –Adapted from notes from BYU ECE124 Topics to Cover… l MSP430 ISA l MSP430 Registers, ALU, Memory l Instruction Formats l Addressing Modes l Double Operand Instructions l Single Operand Instructions l Jump Instructions l Emulated Instructions – http://en.wikipedia.org/wiki/TI_MSP430 2 –Adapted from notes from BYU ECE124 Levels of Transformation –Problems –Algorithms – C Instructions –Language (Program) –Programmable –Assembly Language – MSP 430 ISA –Machine (ISA) Architecture –Computer Specific –Microarchitecture –Manufacturer Specific –Circuits –Devices 3 –Adapted from notes from BYU ECE124 Instruction Set Architecture l The computer ISA defines all of the programmer-visible components and operations of the computer – memory organization l address space -- how may locations can be addressed? l addressibility -- how many bits per location? – register set (a place to store a collection of bits) l how many? what size? how are they used? – instruction set l Opcodes (operation selection codes) l data types (data types: byte or word) l addressing modes (coding schemes to access data) l ISA provides all information needed for someone that wants to write a program in machine language (or translate 4 from a high-level language to machine language). –Adapted from notes from BYU ECE124 MSP430 Instruction Set Architecture l MSP430 CPU specifically designed to allow the use of modern programming techniques, such as: – the computation of jump addresses – data processing in tables – use of high-level languages such as C. l 64KB memory space with 16 16-bit registers that reduce fetches to memory. l Implements RISC architecture with 27 instructions and 7 addressing modes.
    [Show full text]
  • IA-32 Architecture
    Outline IA-32 Architecture Intel Microprocessors IA-32 Registers Computer Organization Instruction Execution Cycle & IA-32 Memory Management Assembly Language Programming Dr Adnan Gutub aagutub ‘at’ uqu.edu.sa [Adapted from slides of Dr. Kip Irvine: Assembly Language for Intel-Based Computers] Most Slides contents have been arranged by Dr Muhamed Mudawar & Dr Aiman El-Maleh from Computer Engineering Dept. at KFUPM 45/٢ IA-32 Architecture Computer Organization and Assembly Language slide Intel Microprocessors Intel 80286 and 80386 Processors Intel introduced the 8086 microprocessor in 1979 80286 was introduced in 1982 8086, 8087, 8088, and 80186 processors 24-bit address bus ⇒ 224 bytes = 16 MB address space 16-bit processors with 16-bit registers Introduced protected mode 16-bit data bus and 20-bit address bus Segmentation in protected mode is different from the real mode Physical address space = 220 bytes = 1 MB 80386 was introduced in 1985 8087 Floating-Point co-processor First 32-bit processor with 32-bit general-purpose registers Uses segmentation and real-address mode to address memory First processor to define the IA-32 architecture Each segment can address 216 bytes = 64 KB 32-bit data bus and 32-bit address bus 8088 is a less expensive version of 8086 232 bytes ⇒ 4 GB address space Uses an 8-bit data bus Introduced paging , virtual memory , and the flat memory model 80186 is a faster version of 8086 Segmentation can be turned off 45/٤ 45 IA-32 Architecture Computer Organization and Assembly Language slide/٣
    [Show full text]
  • Intel Architecture Software Developer's Manual
    Intel Architecture Software Developer’s Manual Volume 2: Instruction Set Reference NOTE: The Intel Architecture Software Developer’s Manual consists of three volumes: Basic Architecture, Order Number 243190; Instruction Set Reference, Order Number 243191; and the System Programming Guide, Order Number 243192. Please refer to all three volumes when evaluating your design needs. 1999 Information in this document is provided in connection with Intel products. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document. Except as provided in Intel's Terms and Conditions of Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating to sale and/or use of Intel products including liability or warranties relating to fitness for a particular purpose, merchantability, or infringement of any patent, copyright or other intellectual property right. Intel products are not intended for use in medical, life saving, or life sustaining applications. Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked “reserved” or “undefined.” Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. Intel’s Intel Architecture processors (e.g., Pentium®, Pentium® II, Pentium® III, and Pentium® Pro processors) may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
    [Show full text]
  • Assembly Operands: Memory • Scalar Variables Map Onto Registers; What About Large Data Structures Like Arrays?
    • So far, we have learnt – R-type and I-type arithmetic instructions add addi sub mul div – Some conditional and unconditional jumps for decisions • bne, beq •b, jal • loops • Conditional jumps • What we are going to learn – Memory-register transfers 31 Assembly Operands: Memory • Scalar variables map onto registers; what about large data structures like arrays? • Memory contains such data structures • But MIPS arithmetic instructions only operate on registers, never directly on memory. ° Data transfer instructions transfer data between registers and memory: – Memory to register – Register to memory 32 1 Data Transfer: Memory to Reg (1/4) • To transfer a word of data, we need to specify two things: – Register: specify this by number (0 - 31) – Memory address: more difficult - Think of memory as a single one-dimensional array, so we can address it simply by supplying a pointer to a memory address. - Other times, we want to be able to offset from this pointer. 33 Data Transfer: Memory to Reg (2/4) • To specify a memory address to copy from, specify two things: – A register which contains a pointer to memory – A numerical offset (in bytes) • The desired memory address is the sum of these two values. • Example: 8(t0) – specifies the memory address pointed to by the value in $t0, plus 8 bytes 34 2 Data Transfer: Memory to Reg (3/4) • Load Instruction Syntax: 1 2, 3(4) – where 1) operation (instruction) name 2) register that will receive value 3) numerical offset in bytes 4) register containing pointer to memory • Instruction Name: –lw (meaning
    [Show full text]