Understanding the Linkage Stack in Computer Architecture

the linkage stack bakr and pr n.w
1 / 7
Embed
Share

Learn about the Linkage Stack, a technique in computer architecture used for saving state and facilitating subroutine linkage. Explore how the Branch and Stack instructions work, along with the Program Return instruction. Understand the execution details and practical uses of the Linkage Stack in programming.

  • Computer Architecture
  • Linkage Stack
  • Branch and Stack
  • Program Return
  • Subroutine

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. The Linkage Stack BAKR and PR

  2. The Linkage Stack This feature was not part of the original architecture Designed as an alternative technique for saving current state (registers and PSW) A Linkage state entry (registers and psw) is created and pushed onto the linkage stack when BAKR (Branch and Stack) is executed A Linkage state entry is popped off the stack and used to reset the registers and PSW when PR (Program Return) is executed While BAKR and PR can be complex (consult Principles of Operation) with many execution details, you can use them easily in most cases

  3. Branch and Stack (BAKR) RRE instruction format Explicit coding: BAKR R1,R2 When executed, general and access registers 0-15, along with most of the current PSW, are saved in a Linkage Stack Entry Used to save registers at the beginning of a program or to facilitate linkage to a called subroutine. No need for Save areas! If R1is 0, the address of the next instruction is stored in the PSW in the linkage stack (this becomes the return address) If R1is not 0, the contents or R1 is stored in the PSW in the linkage stack (this becomes the return address)

  4. Branch and Stack (BAKR) If R2is 0, no branch occurs. BAKR R14,0 UPON PROGRAM ENTRY If R2is not 0, the address in R2 becomes the target of the branch LARL R8,SUB1 POINT AT SUB1 BAKR 0,R8 JUMP THERE

  5. Using BAKR in a Called Program When entering the program, R14 contains the return address We can store all the registers and the PSW, and indicate the return address is already in R14 by coding the following: BAKR R14,0 Alternatively, we could put the return address in a different register and alter the BAKR LR R8,R14 BAKR R8,R0

  6. Program Return (PR) PR has instruction format E and no operands Executing Program Return (PR) restores registers 2-14, and most of the PSW from the topmost Linkage Stack Entry The Linkage Stack Entry is removed from the stack

  7. Using PR in a Called Program BAKR R14,0 RETURN ADR ALREADY IN R14 LA R15,0 RC IN R15 PR

More Related Content