5 8051 : (CPU) Central Processing Unit

Total Page:16

File Type:pdf, Size:1020Kb

5 8051 : (CPU) Central Processing Unit Mechatronics 1387Spring 8051 +P+KJ1+@8$ O5 >.K8$J1+@8$ %+@F(! 28P1 -.S O1O5 YData bus Y ROM Y RAM Y CPU ! (+' l@C E,G$) .K8Š$J1+@8$ u' "FS •Dc Peripheral & Interface Ciruits YControl bus Y Address bus Address bus Data bus Countrol bus CPU Interface RAM ROM circuitry Peripheral devices (CPU) Central Processing Unit :$%&' ( )$* + , #!" ! CPU u' "FS *>7 8P/^ %.C"$ •.`T$ +.8Š$J1+@8$ u' •Dc 9'+hh "33 (Fetch & Execute Instructions) hhhhm); *+hc 1 2[^y (98$+h^ ') "h8F(! *hh>J 7^', (1 (Arithmatic/Logic Operations) "hh?G$ 1 "hh 3T$ Rhh8F(! whhh<) (2 (Sequence/ Timing Control) +.8Š$J jFKk$ •Dc jFKk$ R8F(! *, B$ 1 ˆ8+ -+KJ (3 : ! CPU u' "F:% •Dc Instruction Program Register (IR) Counter (PC) *+, m); *%/ : CPU "F:% *hh>2[^y ' Registers Ch,"$ "S: \hhŽ$ *+, +p'% *%/ 1 "$.(! \hhŽ$ Special purpose (Stack pointer ' Status Register hh)$) Instruction Registers decode and */, v: a%; I)mp) : (PC) program Counter countrol unit 2[^y % (next instrudion) */, "h8F(! J ' 2$)+, General purpose Arithmatic Registers and Logic unit B$+^ *+, binary J : (IR) Instruction Register .%.C "$ *mp) IR % Y+c -y% (instruction) G.R. Vossoughi, Sharif Univ. of Tech. 5 Mechatronics 1387Spring instruction *+, binary hJ (2h(c+) +8 / lh$! : Instruction Decode/Control unit instruction B%1;% +hhc 2, 7mc (I+8€ 1 "hhP+KJ R8F(!) 8) %.$ R8F(! w<) 1 IR % %.c.$ +[)%.$ 98$+^ E z +,) "_' 1 "?G$ R8F(! B%1;% +hhc 2, l$! : Arithmatic Logic Unit (ALU) (Instruction decoder / Control unit "K^'% *+c 1 2[^y 98$+^ ' "8F(! *hhhh>J ",', CPU J 9'+ I(! C IhhC •A H 2J .G)hh(> .%.C "$ 2K#W fetching 2[^y "8F(! *>J ' instruction ",', 2, . C, "$ m); .C, "$ +' ly+$ l$C %.: 2[^y 98$+^ B%+J (Fetch) ",', 2Fy+$ ' R8F(! .%.C "$ 2KCVW Address bus *1 +, Program Counter (PC) *.KT$ O1 .%%+W "$ -/^ READ "P+KJ -p83 O2 I%% +H data bus *1 +, 1 IC Ih).: 2hz.,+$ a%; (data) K'% ' (instruction) 98$+h^ O3 .%.C "$ IR "hhF:% +hhhK`8c B1% 2, data bus *1 (instruction code) .hh,D$ Bhh$+^ O4 .%%+W "$ l?K$ (Instruction Register) (*/, Fetch l@83 *+, "hhhW%$; 7mc) %.C "$ I%% &'D^ (Program Counter) PC *.KT$ O5 CPU Address bus N Program Data bus Counter Opcode Instruction RAM Register N+2 Control bus Clock N+1 Opcode N Read N-1 G.R. Vossoughi, Sharif Univ. of Tech. 6 Mechatronics 1387Spring IC ",', B$+^ ' J +8 / l$C (Execution stage) 98$+^ *+c 2Fy+$ ' Rh8F(! *.hhKT$ -3 7mc h8)%.$ "hP+KJ *hhhmPp83 8P. Y (instruction decoding) *+c 7mc 8)%.$ "P+KJ *hhmPp83 8P. 1 e@/P, 1 ALU B1% 2, "F:% *h>register .C, "$ ALU v3. "_' 1 "?G$ R8F(! v3. l$J .G, CPU %+@F(! 1 >%"$ l8@n 2$)+, u' Y 98$+^ 1 "8F(! *>J 2!.(<$ Program “drives” the CPU : %%+W "$ }kn$ 2$)+, (Address, Data & Control bus) "$ ( ) 12 3 . /0/ :$%&' ()$* + , #- 2K^+W @, "J+Kn$ \> , 2J -hp83 7'> •.G: ' Z83 *%/ 73 l@nK$ (bus) IWVW u' .'%+W }kn$ instruction Fetch &k, % *y .,D$ IWVW 23 u' +> &?) 1 %+@F(! . ).C "$ +tJy ">%a %; "'hh). .,D$ cpu YC, 78, n *% cpu u' *+, a, a%; [email protected] % 9' VhP 1 73 "K8,16 a, a%; 8051 +hhhP+KJ1+@8$ *+, . 7C% hh>.: 7', 2n 65535 .C, 2KC% 2[^y 64Kb = ' 65535=216 +tJy ). "$ +P+KJ1+@8$ 1024 lh@83 +> % 2J 73 w.m#$ 9', 9' YC, 78, n *% CPU u' *+, a, hK'% [email protected] % 1 HD )h$) I/O " )c RD8m< 1 2[^hhy Y CPU 98, I%% 78, n v?^ write ' Read Zm$ l$.! "@' ( a,K'% •.G: %/ ') data bus ’+! VP .%%+W "$ l?K$ (... 1 .hK8)$ IJ 988/ Zm$ *h>2Žkn$ 1 '%+W •.`T$ +.8Š$J1+@8$ u' B1% R!Az -%hh 7!+3 .`31+f1+@8$ 2J %.C"$ 2K#W "KH1 •A h t $ .%%+W "$ •.`T$ CPU v3. R!Az 0%+f 7!+3 .73 "K8, 32 data bus .`31+f1+hh@8$ 9' % 2J 73 w.m#$ 9', 9' 73 "K8, 32 Y P-IV .73 "K8, 8 a, K'% 8051 % . 73 2^+z 1% I.(> a,K'% [email protected]% (uni-directional) 73 2^+hhhG@' I.(> a, a%; G.R. Vossoughi, Sharif Univ. of Tech. 7 Mechatronics 1387Spring -hhh?K) jFKk$ R8F(! IJ “>(> &?) 2J 73 "'hhhmPp83 * 2!.(<$ l$C a, -+KJ B. "$ mPp83 2hhh).p' *2hh).() .C,"$ % Im! a,K'% 1 a, a%; *1 +, R!Az 1 I%., ‰.K$ 8`, m); &?) 1 "P+KJ *hhmPp83 %/ 1 w) .%+, w) WRITE 1 READ 1 Clock .%% CPU ‰.) 2, *%' "pK`, ,)$8 )) 5 67% :$%&' ()$* + , #4 CD-ROM Y HDD Y FDD )$ : (mass storage) I. ) *hh3I+8:” RDh8m< - Y Keyboard Y+hhK'+f Y-8$+ )$ : (Human interface) B`) , • RD8m< - speaker Y Mouse :• l$.! *>%+, ' >$ *>R+f 1 profi Y 7)+K' *hhh>2@ C : (Communication) "z RD8m< - 2G31 -'+3 1 *.$ >+pF(! 1 >.`3 ‰.) )$ : “'.K8).$ 1 "P+KJ RD8m< - : 9$ :$%&' ()$* + , # Application B./, %hh3 "$ +H+, user , Z8?K`$ •hh 2J *Dhh^ w+) i].(/$ • % D^ 7k3 , *D^w+) 2'] 1% E'+z D^ w+) 9' Y%.C "$ 2K:hhC Software .73 ‚'+n l,H l,?$ w+W'% v3. K:3 9' .C, "$ Application Software Dh^ 7k3 hh, Z8?K`$ .hhhhG, Input/output Subroutines (user interface) a( % (... 1 A/D 1 D/A %+, 1 HD YCRT Y keyboard )$) Operating System 98† E'+z +h.8Š$J u' *>"c1+: 1 > *%11 28FJ 1 I%., hh> Subroutine 2hh).p' .%+8W "$ w<) "'hhh>Subroutine Input/output routines ' Basic I/O System )hh$) IC *mp) ROM % “•$.(!“ (access to hardware) .).C "$ 2KC.) assembly B, 2, •$.(! 1 (IBM-PC % BIOS Hardware *hhh>+K$f %11 , •$.(! I/O subroutines I%hhh#K3 B%+J initialize E'+z (Subroutine parameters ) 2hhhz.,+$ E'+z 2FSy •'K) Y subroutine call w<) ef 1 I'%+hW h€; CPU *hhhh>+K`8c *%/ .%.C "$ 7^', RAM % "Žkn$ *h> a%; E'+z ' 1 CPU *hhhh>+K`8c +p'% *%/ G.R. Vossoughi, Sharif Univ. of Tech. 8 Mechatronics 1387Spring B%+hhhJ reset ef 2n8(> 2J 73 start-up 2$)+, u' *1y ROM Yh> I/O subroutine +, I1A! 2, (pc) program counter I.hhhh(> Y CPU B%+hhhhhJ reset ef .%%+hhhW "$ -hhh/^ CPU B(> ) .,D$ a%; % %.c.$ 2h$)+, VP 1 2K^h' +88— – 0000H •].(/$ – ROM B1% "hhkn$ a%; *+p'% a%; 2, jmp u' 0000H a%; % ˆF€ 2K P) '%+W >.: +c CPU v3. (startup 2$)+, 1 2[^y B%+J u† B.‹(> "hh8F(! w<) +, I1A! Start up 2$hhhhh)+, ( ... 1 %+8W "$ w<) ROM % Track Y Bootstrap Loader w, ROM B1% +p'% routine u' B% S , Y-.(/$ *hh> ",'ˆ8! Operating "K(`H 2$)+, 9' .)Š3"$ B, -+KJ 1 I).:+^ RAM lh:% 2, uh`'% -1 .)Š3"$ B; 2, -+KJ 1 I).:+^ (RAM) 2[^y l:% 2, u`'% *1 system (DOS Command Language hhh)hh$) user interface 9h8$h +, I1A! Operating Sytem .C, "$ Application Software 8P. 1 "`'.)2$)+, 2, B8nk, 7P.m3 7mc "'hh>D, *% +P+KJ1+@8$ 1 .`31+f1+@8$ 98, R1# O2O5 "8$ %) 7`8) IC I%% +H IC u' *1 +, 2J CPU u' Dc *D8† .h`31+f1+@8$ •].S (73 %+, 9'† "Ky 1 IC 9'† l@nK$ %.: CPU > main frame 1 >+.Š8$J +P+KJ1+@8$ u' % Z8), +' w+W'% % IC I%% Bn) •Dc l@nK$ +.8Š$J1+@8$ u' +W hh)$) Rhhh8S.Ž: 8`, % •$.(! 2K P . 73 IC I%% *c IC u' % I%+ $) •Dc 28FJ u' (interrupt ' 2#H1 •.G: %/ 1 -'+3 *hhhhhh>R+f %/ Y ROM 1 RAM &'<W h, .,D$ *> 7'%1T$ 2K P .C, +.8Š$J1+@8$ u' +%1T$ 8`, 73 9@($ +P+KJ1+@8$ .73 28c. l,H ("P+KJ *>ZK`83 %) >+P+KJ1+@8$ %+,J %.$ 2, 2c. External External Serial Parallel Clocks interrupts Device Device Internal Clocks Interrupt Serial Parallel Timers control interface interface CPU RAM ROM G.R. Vossoughi, Sharif Univ. of Tech. 9 Mechatronics 1387Spring *c IC u' % (+hhhP+KJ1+@8$ %+,) "P+KJ %+, u' 7:3 *+, 8) %.$ •Dc ˆF€ 2@' 2, 2c. , 1 "y+z 2'D> 9' 2J C,"$ 7:3 l,H IC "(J 8`, %/ , +P+KJ1+@8$ *>%+, VP IC I%% .%%"$ 2p) 98'f 8`, >%+, 2).p' 7:3 "'). 9' h, .73 (interrupts) 2#H1 0%+f % m); "'). Y>+P+KJ1+@8$ "FJ *> 2Žkn$ "@' ' clock *hhhhh>e Pf )$) jFKk$ (events) b'H1 2, )."$ (+hhhP+KJ1+@8$) "P+KJ ZhhK`83 .C, .pk3f •/'+3 ( *+G_ *>78/_1 98$+^ ' "8F(! J %/ 1 j8z % +P+KJ1+@8$ 1 .hhh`31+f1+@8$ u' 98, *> R1# +p'% "@' , B%+JJ "'). Y(98p3) R!Az 0%+f \> , .hhh`31+f1+@8$ u' .73 (instruction set) 1 I'%+W "y+z ... 1 (arrays) •D, *>2'; , B%+J J 7P.m3 Y"K', 8 1 "K', 4 Y"K',2 *>I%% . C, "$ >%+,J 2).p' *+, "S: (instruction) "8F(! *>J *% VP C, 2,n$ *>J 1 2P u' B%+J 0.$: 1 9C1 \> 73 9@($ +hP+KJ1+@8$ u' % 2@); -y u' % %.c.$ ">% a%; *>$ 1 > instruction *8`, Y2hh'D> 9KCmp) 98'f .[(, Y1 9' v3. l?K`$ .G, > 78, -+KJ "'). 2@); -y Y%.C "() I'% +hhhP+KJ1+@8$ u' % .`31+f1+@8$ 1 hhhh> instruction %/ &'D^ , ) .73 +'Vf B@$ +P+KJ1+@8$ % "S: *hhhhh> instruction %1y 8051 +P+KJ1+@8$ u' % -t$ *+, . ,' "$ &'D^ • / , + 3 ... 1 7:3 1 "y+z *hh> 2'D> 80286 .hh`31+f1+@8$ u' % 2K^ @, .K`'D)+ %/ 2@); -y 1 2K^ @, .hK`'D)+ 60/000 .K`'D)+ B.8F8$3/1 %1y pentuim u' % 1 B.8F8$1/2 %1y 80486 u' % 1134/000 %1y (. 73 IC \+Ž$ B.8F8$ 42 %1y Pentium IV .K`'D)+ B.8F8$ 5/5 %1y pentiume pro % 1 G.R. Vossoughi, Sharif Univ. of Tech. 10 Mechatronics 1387Spring MSC-51 I%.): *>+P+KJ1+@8$ *D^7k3 Rkn$ O3O5 , 2, INTEL 7J+C v3. 1980 2>% l'1 % 2J K`> >+P+KJ1+@8$ *I %.): MSC-51 8K$ 9hK^+W , philips 1 Fujitsu Y AMD Ye(' )$ jFKk$ *hhh>7J+C e3 1 IC 2_+! : )%.() 2_+! , 2, (%.: ™: *>"').
Recommended publications
  • I386-Engine™ Technical Manual
    i386-Engine™ C/C++ Programmable, 32-bit Microprocessor Module Based on the Intel386EX Technical Manual 1950 5 th Street, Davis, CA 95616, USA Tel: 530-758-0180 Fax: 530-758-0181 Email: [email protected] http://www.tern.com Internet Email: [email protected] http://www.tern.com COPYRIGHT i386-Engine, VE232, A-Engine, A-Core, C-Engine, V25-Engine, MotionC, BirdBox, PowerDrive, SensorWatch, Pc-Co, LittleDrive, MemCard, ACTF, and NT-Kit are trademarks of TERN, Inc. Intel386EX and Intel386SX are trademarks of Intel Coporation. Borland C/C++ are trademarks of Borland International. Microsoft, MS-DOS, Windows, and Windows 95 are trademarks of Microsoft Corporation. IBM is a trademark of International Business Machines Corporation. Version 2.00 October 28, 2010 No part of this document may be copied or reproduced in any form or by any means without the prior written consent of TERN, Inc. © 1998-2010 1950 5 th Street, Davis, CA 95616, USA Tel: 530-758-0180 Fax: 530-758-0181 Email: [email protected] http://www.tern.com Important Notice TERN is developing complex, high technology integration systems. These systems are integrated with software and hardware that are not 100% defect free. TERN products are not designed, intended, authorized, or warranted to be suitable for use in life-support applications, devices, or systems, or in other critical applications. TERN and the Buyer agree that TERN will not be liable for incidental or consequential damages arising from the use of TERN products. It is the Buyer's responsibility to protect life and property against incidental failure. TERN reserves the right to make changes and improvements to its products without providing notice.
    [Show full text]
  • Xv6 Booting: Transitioning from 16 to 32 Bit Mode
    238P Operating Systems, Fall 2018 xv6 Boot Recap: Transitioning from 16 bit mode to 32 bit mode 3 November 2018 Aftab Hussain University of California, Irvine BIOS xv6 Boot loader what it does Sets up the hardware. Transfers control to the Boot Loader. BIOS xv6 Boot loader what it does Sets up the hardware. Transfers control to the Boot Loader. how it transfers control to the Boot Loader Boot loader is loaded from the 1st 512-byte sector of the boot disk. This 512-byte sector is known as the boot sector. Boot loader is loaded at 0x7c00. Sets processor’s ip register to 0x7c00. BIOS xv6 Boot loader 2 source source files bootasm.S - 16 and 32 bit assembly code. bootmain.c - C code. BIOS xv6 Boot loader 2 source source files bootasm.S - 16 and 32 bit assembly code. bootmain.c - C code. executing bootasm.S 1. Disable interrupts using cli instruction. (Code). > Done in case BIOS has initialized any of its interrupt handlers while setting up the hardware. Also, BIOS is not running anymore, so better to disable them. > Clear segment registers. Use xor for %ax, and copy it to the rest (Code). 2. Switch from real mode to protected mode. (References: a, b). > Note the difference between processor modes and kernel privilege modes > We do the above switch to increase the size of the memory we can address. BIOS xv6 Boot loader 2 source source file executing bootasm.S m. Let’s 2. Switch from real mode to protected mode. expand on this a little bit Addressing in Real Mode In real mode, the processor sends 20-bit addresses to the memory.
    [Show full text]
  • Protected Mode - Wikipedia
    2/12/2019 Protected mode - Wikipedia Protected mode In computing, protected mode, also called protected virtual address mode,[1] is an operational mode of x86- compatible central processing units (CPUs). It allows system software to use features such as virtual memory, paging and safe multi-tasking designed to increase an operating system's control over application software.[2][3] When a processor that supports x86 protected mode is powered on, it begins executing instructions in real mode, in order to maintain backward compatibility with earlier x86 processors.[4] Protected mode may only be entered after the system software sets up one descriptor table and enables the Protection Enable (PE) bit in the control register 0 (CR0).[5] Protected mode was first added to the x86 architecture in 1982,[6] with the release of Intel's 80286 (286) processor, and later extended with the release of the 80386 (386) in 1985.[7] Due to the enhancements added by protected mode, it has become widely adopted and has become the foundation for all subsequent enhancements to the x86 architecture,[8] although many of those enhancements, such as added instructions and new registers, also brought benefits to the real mode. Contents History The 286 The 386 386 additions to protected mode Entering and exiting protected mode Features Privilege levels Real mode application compatibility Virtual 8086 mode Segment addressing Protected mode 286 386 Structure of segment descriptor entry Paging Multitasking Operating systems See also References External links History https://en.wikipedia.org/wiki/Protected_mode
    [Show full text]
  • Chapter 2 Powerpc Register Set
    Chapter 2 PowerPC Register Set 20 20 This chapter describes the register organization defined by the three levels of the PowerPC U architecture—user instruction set architecture (UISA), virtual environment architecture V (VEA), and operating environment architecture (OEA). The PowerPC architecture defines O register-to-register operations for all computational instructions. Source data for these instructions are accessed from the on-chip registers or are provided as immediate values embedded in the opcode. The three-register instruction format allows specification of a target register distinct from the two source registers, thus preserving the original data for use by other instructions and reducing the number of instructions required for certain operations. Data is transferred between memory and registers with explicit load and store instructions only. Note that the handling of reserved bits in any register is implementation-dependent. Software is permitted to write any value to a reserved bit in a register. However, a subsequent reading of the reserved bit returns 0 if the value last written to the bit was 0 and returns an undefined value (may be 0 or 1) otherwise. This means that even if the last value written to a reserved bit was 1, reading that bit may return 0. 2.1 PowerPC UISA Register Set The PowerPC UISA registers, shown in Figure 2-1, can be accessed by either user- or U supervisor-level instructions (the architecture specification refers to user-level and supervisor-level as problem state and privileged state respectively). The general-purpose registers (GPRs) and floating-point registers (FPRs) are accessed as instruction operands.
    [Show full text]
  • A Comparison of Protection Lookaside Buffers and the PA-RISC
    rI3 HEWLETT ~~PACKARD A Comparison ofProtection Lookaside Buffers and the PA·RISC Protection Architecture John Wilkes, Bart Sears Computer Systems Laboratory HPL-92-55 March 1992 processor architecture, Eric Koldinger and others at the University of single address space, 64­ Washington Department of Computer Science have bitaddressing, protection, proposed a new model for memory protection in PA-RISe, protection single-address-space architectures. This paper lookaside buffers, PLB, compares the Washington proposal with what translation lookaside already exists in PA-RISC, and suggests some buffers,TLB, cache incremental improvements to the latter that would indexing, virtually­ provide most of the benefits of the former. addressed caches Internal Accession Date Only © Copyright Hewlett-Packard Company 1992 1 Introduction A recent technical report by Eric Koldinger and others [Koldinger91] proposes a new model for managing protectioninformationinsingle address space processors. This paper is one outcome of discussions withthe authors about the real differences betweentheir proposal and the scheme usedinPA-RISC[Lee89,HPPA90]:it offers a restatement of the newproposal, a comparisonwith the existing PA-RISCarchitecture, and some thoughts onhow the PA-RISCarchitecture mightbe extended in the future to provide some of the benefits that the PLBidea was trying to achieve. The reader is assumed to be familiar withmodem TLB,cache and processor architectures; with luck, sufficient information is provided in this paper that detailed prior knowledge about either the Washington proposal or PA-RISCisn't required. Example To help illustrate some of the finer points of the different protectionmodels, anexample based on the LRPC work of Brian Bershad is used [Bershad90] (see Figure 1).
    [Show full text]
  • Intel® 64 and IA-32 Architectures Software Developer's Manual
    Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3B: System Programming Guide, Part 2 NOTE: The Intel® 64 and IA-32 Architectures Software Developer's Manual consists of five volumes: Basic Architecture, Order Number 253665; Instruction Set Reference A-M, Order Number 253666; Instruction Set Reference N-Z, Order Number 253667; System Programming Guide, Part 1, Order Number 253668; System Programming Guide, Part 2, Order Number 253669. Refer to all five volumes when evaluating your design needs. Order Number: 253669-029US November 2008 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 GRANT- ED 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. UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR IN- TENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUA- TION WHERE PERSONAL INJURY OR DEATH MAY OCCUR. 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 "unde- fined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them.
    [Show full text]
  • AMD 64-Bit Technology
    Preliminary Information AMD 64-Bit Technology The AMD x86-64™ Architecture Programmers Overview Publication # 24108 Rev: A Issue Date: August 2000 Preliminary Information © 2000 Advanced Micro Devices, Inc. All rights reserved. The contents of this document are provided in connection with Advanced Micro Devices, Inc. (“AMD”) products. AMD makes no representations or warranties with respect to the accuracy or completeness of the contents of this publication and reserves the right to make changes to specifications and product descriptions at any time without notice. No license, whether express, implied, arising by estoppel or otherwise, to any intellectual property rights is granted by this publication. Except as set forth in AMD’s Standard Terms and Conditions of Sale, AMD assumes no liability whatsoever, and disclaims any express or implied warranty, relating to its products including, but not limited to, the implied warranty of merchantability, fitness for a particular purpose, or infringement of any intellectual property right. AMD’s products are not designed, intended, authorized or warranted for use as components in systems intended for surgical implant into the body, or in other applications intended to support or sustain life, or in any other applica- tion in which the failure of AMD’s product could create a situation where per- sonal injury, death, or severe property or environmental damage may occur. AMD reserves the right to discontinue or make changes to its products at any time without notice. Trademarks AMD, the AMD logo, x86-64, AMD Athlon, and combinations thereof are trademarks of Advanced Micro Devices, Inc. MMX is a trademark of Intel Corporation.
    [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]
  • 18-447: Computer Architecture Lecture 18: Virtual Memory III
    18-447: Computer Architecture Lecture 18: Virtual Memory III Yoongu Kim Carnegie Mellon University Spring 2013, 3/1 Upcoming Schedule • Today: Lab 3 Due • Today: Lecture/Recitation • Monday (3/4): Lecture – Q&A Session • Wednesday (3/6): Midterm 1 – 12:30 – 2:20 – Closed book – One letter-sized cheat sheet • Can be double-sided • Can be either typed or written Readings • Required – P&H, Chapter 5.4 – Hamacher et al., Chapter 8.8 • Recommended – Denning, P. J. Virtual Memory. ACM Computing Surveys. 1970 – Jacob, B., & Mudge, T. Virtual Memory in Contemporary Microprocessors. IEEE Micro. 1998. • References – Intel Manuals for 8086/80286/80386/IA32/Intel64 – MIPS Manual Review of Last Lecture • Two approaches to virtual memory 1. Segmentation • Not as popular today 2. Paging • What is usually meant today by “virtual memory” • Virtual memory requires HW+SW support – HW component is called the MMU • Memory management unit – How to translate: virtual ↔ physical addresses? Review of Last Lecture (cont’d) 1. Segmentation – Divide the address space into segments • Physical Address = BASE + Virtual Address – Case studies: Intel 8086, 80286, x86, x86-64 – Advantages • Modularity/Isolation/Protection • Translation is simple – Disadvantages • Complicated management • Fragmentation • Only a few segments are addressable at the same time Review of Last Lecture (cont’d) 2. Paging – Virtual address space: Large, contiguous, imaginary – Page: A fixed-sized chunk of the address space – Mapping: Virtual pages → physical pages – Page table: The data structure that stores the mappings • Problem #1: Too large – Solution: Hierarchical page tables • Problem #2: Large latency – Solution: Translation Lookaside Buffer (TLB) – Case study: Intel 80386 – Today, we’ll talk more about paging ..
    [Show full text]
  • X86 Assembly Language: AT&T and Intel
    x86_16 real mode (or at least enough for cos318 project 1) Overview Preliminary information - How to find help The toolchain The machine If you only remember one thing: gcc -S the -S (capital S) flag causes gcc to ouput assembly. Preliminary Information Assembly can be hard Development strategies conquer risk: Write small test cases. Write functions, test each separately. Print diagnostics frequently. Think defensively! and the interweb is helpful too. The Interwebs as a resource. The internet offers much information that seems confusing or contradictory. How do you sort out information "in the wild?" Syntax There are (at least) two different syntaxes for x86 assembly language: AT&T and Intel. AT&T: opcodes have a suffix to denote data type, use sigils, and place the destination operand on the right. Intel: operands use a keyword to denote data type, no sigils, destination operand is leftmost. Example: AT&T vs Intel push %bp push bp mov %sp,%bp mov bp,sp sub $0x10,%sp sub sp,0x10 movw mov si,WORD 0x200b(%bx),%si PTR [bx+0x200b] mov $0x4006,%di mov di,0x4006 mov $0x0,%ax mov ax,0x0 call printf call printf leaveq leave retq ret In this class, use AT&T! Versions of the architecture x86 won't die. All backwards compatible. 8086 -> 16bit, Real 80386 / ia32 -> 32bit, Protected x86_64 -> 64bit, Protected If you find an example: For which architecture was it written? The Register Test If you see "%rax", then 64-bit code; else If you see "%eax", then 32-bit code; else You are looking at 16-bit code.
    [Show full text]
  • Intel X86 Assembly Language & Microarchitecture
    Intel x86 Assembly Language & Microarchitecture #x86 Table of Contents About 1 Chapter 1: Getting started with Intel x86 Assembly Language & Microarchitecture 2 Remarks 2 Examples 2 x86 Assembly Language 2 x86 Linux Hello World Example 3 Chapter 2: Assemblers 6 Examples 6 Microsoft Assembler - MASM 6 Intel Assembler 6 AT&T assembler - as 7 Borland's Turbo Assembler - TASM 7 GNU assembler - gas 7 Netwide Assembler - NASM 8 Yet Another Assembler - YASM 9 Chapter 3: Calling Conventions 10 Remarks 10 Resources 10 Examples 10 32-bit cdecl 10 Parameters 10 Return Value 11 Saved and Clobbered Registers 11 64-bit System V 11 Parameters 11 Return Value 11 Saved and Clobbered Registers 11 32-bit stdcall 12 Parameters 12 Return Value 12 Saved and Clobbered Registers 12 32-bit, cdecl — Dealing with Integers 12 As parameters (8, 16, 32 bits) 12 As parameters (64 bits) 12 As return value 13 32-bit, cdecl — Dealing with Floating Point 14 As parameters (float, double) 14 As parameters (long double) 14 As return value 15 64-bit Windows 15 Parameters 15 Return Value 16 Saved and Clobbered Registers 16 Stack alignment 16 32-bit, cdecl — Dealing with Structs 16 Padding 16 As parameters (pass by reference) 17 As parameters (pass by value) 17 As return value 17 Chapter 4: Control Flow 19 Examples 19 Unconditional jumps 19 Relative near jumps 19 Absolute indirect near jumps 19 Absolute far jumps 19 Absolute indirect far jumps 20 Missing jumps 20 Testing conditions 20 Flags 21 Non-destructive tests 21 Signed and unsigned tests 22 Conditional jumps 22 Synonyms and terminology 22 Equality 22 Greater than 23 Less than 24 Specific flags 24 One more conditional jump (extra one) 25 Test arithmetic relations 25 Unsigned integers 25 Signed integers 26 a_label 26 Synonyms 27 Signed unsigned companion codes 27 Chapter 5: Converting decimal strings to integers 28 Remarks 28 Examples 28 IA-32 assembly, GAS, cdecl calling convention 28 MS-DOS, TASM/MASM function to read a 16-bit unsigned integer 29 Read a 16-bit unsigned integer from input.
    [Show full text]
  • Intel® Architecture Instruction Set Extensions and Future Features
    Intel® Architecture Instruction Set Extensions and Future Features Programming Reference May 2021 319433-044 Intel technologies may require enabled hardware, software or service activation. No product or component can be absolutely secure. Your costs and results may vary. You may not use or facilitate the use of this document in connection with any infringement or other legal analysis concerning Intel products described herein. You agree to grant Intel a non-exclusive, royalty-free license to any patent claim thereafter drafted which includes subject matter disclosed herein. No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document. All product plans and roadmaps are subject to change without notice. The products described 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. Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade. Code names are used by Intel to identify products, technologies, or services that are in development and not publicly available. These are not “commercial” names and not intended to function as trademarks. Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be ob- tained by calling 1-800-548-4725, or by visiting http://www.intel.com/design/literature.htm. Copyright © 2021, Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries.
    [Show full text]