Computer Systems: A Programmer's Perspective Plus Mastering Engineering With Pearson Etext -- Access Card Package (3rd Edition)
Computer Systems: A Programmer's Perspective Plus Mastering Engineering With Pearson Etext -- Access Card Package (3rd Edition)
3rd Edition
ISBN: 9780134123837
Author: Randal E. Bryant, David R. 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
1.BL=00, after instruction DEC BL is executed, CF =? 2.CH=80H; after ROL CH, 1; CH=?
A program has the following breakdown: 25% ld (50% of them directly followed by a dependent instruction),25% sd, 30% r_type, 20% beq (80% of them are taken. Branches are calculated in the third cycle. What is the average CPI of the program when run on the pipelined RISC V implementation in the textbook?
1. We wish to compare the performance of two different machines: M1 and M2. The following measurements have been made on these machines:   Program Time on M1 Time on M2 1 10 seconds 5 seconds 2 3 seconds 4 seconds Which machine is faster for each program, and by how much?   2. For M1 and M2 of problem 1, the following additional measurements are made:. Find the instruction execution rate (instructions per second) for each machine when running program 1.   Program Instructions executed on M1 Instructions executed on M2 1 200 x 106 160 x 106   3. For M1 and M2 of problem 1, if the clock rates are 200 MHz and 300 MHz, respectively, find the CPI for program 1 on both machines using the data provided in problems 1 and 2.   4. You are going to enhance a machine, and there are two possible improvements: either make multiply instructions run four times faster than before or make memory access instructions run two times faster than before. You…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr