1 / 5

The Instruction Pointer Register IP

The Instruction Pointer Register IP . Mian (). ip : Instruction Pointer Register.  ip =01F01.  ip =01F02.  ip =01F03.  ip =01F04.  ip =01F05. 1:The address where the sub-function foo() starts.  ip =? 1.  ip =01F07.  ip =01F08. 2:assigned another address by the O.S. .

lalo
Télécharger la présentation

The Instruction Pointer Register IP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Instruction Pointer Register IP Mian() ip: Instruction Pointer Register  ip=01F01  ip=01F02  ip=01F03  ip=01F04  ip=01F05 1:The address where the sub-function foo() starts  ip=? 1  ip=01F07  ip=01F08 2:assigned another address by the O.S.  ip = ? 2

  2. Stack and Sub functions • Stack Memory: • Stack memory is a part of the system memory that is used during calling and returning to and from sub-function within a program • Such as • Passes parameters to a sub-functions and get the return values from the sub-function • Stores local variables of the sub function • Stack Mechanism: • Stack memory follows the LIFO mechanism (Last In First Out) • You can put values on the stack and get values from the stack according to LIFO • Stack Memory commands : • push <value> • Store a value at the TOP of the stack • pop • Take the value at TOP of the stack and assign it to a variable or register

  3. Stack and Sub functions Mian() • When we call a sub-function : • Store the address of next instructioninto the stack memory using the push command • Start address of that sub-function goes to IP Register Foo() moo() koo() • When we return from a sub-function : • The address of next instructionpoppedfrom the stack memory and stored in the IP Register using the pop command

  4. Stack and Sub functions • When we call a sub-function : • Store the address of next instructioninto the stack memory using the push command • Start address of that sub-function goes to IP Register • When we return from a sub-function : • The address of next instructionpoppedfrom the stack memory and stored in the IP Register using the pop command

  5. Stack Memory Stack and Sub functions Mian() Foo() 0x001F1F0E Push 0x000F1F09 moo() 0x00001F06 koo() Push Push Pop Pop Pop Push 0x000F1F09 Push 0x001F1F0E Push 0x00001F06

More Related