Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 7.7, Problem 7.5PP

Explanation of Solution

Computing the value of the relocated reference to swap in the “callq” instruction:

From the given question, the function “swap” in object file “m.o” is

9: e8 00 00 00 00callqe<main+oxe>

Based on the relocates PC-relative references,

  • ADDR(s)=ADDR(.text)=0x4004d0
    • Here “ADDR” means run-time addresses for each section.
  • ADDR(r.symbol)=ADDR(swap)=0x4004e8

Compute the run time address of the references using the formula of “refaddr = ADDR(s) + r.offset”

refaddr=ADDR(s)+r.offset=0x4004d0+0xa=0x4004da

Then updates the reference by using the below formula

*refptr=(usnsigned)(ADDR(

Blurred answer
Students have asked these similar questions
9.23 The starting address of the trap routine is stored at the address specified in the TRAP instruction. Why isn't the first instruction of the trap routine stored at that address instead? Assume each trap service routine requires at most 16 instructions. Modify the semantics of the LC-3 TRAP instruction so that the trap vector provides the starting address of the service routine.
2. Design a Read Only Memory (ROM) to implement the following, A097803, polynomial A = 3(2x? + 1), with input (x) : 0< (x) <7 (a) What is the size of the initial (unsimplified) ROM ? (b) What is the size of the final (simplified) ROM ? (c) Show in detail the final ROM layout, using LogiSim.
[8]  A C program containing the function food has been compiled into LC-3 assembly language. The partial translation of the function is:food:ADD R6, R6, #2STR R7, R6, #0ADD R6, R6, #1STR R5, R6, #0 ADD R5, R6, #1 ADD R6, R6, #4...How many local variables does this function have?a. 3b. 4c. 5d. 6
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education