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, Problem 7.12HW

A.

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>

From the given question,

r.offset=0xar.symbol=swapr.type=R_X86_64_PC32r.addend=-4

And then value of “ADDR(.text)” is “0x4004e0” and value of “ADDR(swap)” is “0x4004f8”.

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

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

refaddr=ADDR(s)+r

B.

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>

From the given question,

From the given question,

r.offset=0xar.symbol=swapr.type=R_X86_64_PC32r.addend=-4

And then value of “ADDR(.text)” is “0x4004d0” and value of “ADDR(swap)” is “0x400500”.

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

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

refaddr=ADDR(s)+r

Blurred answer
Students have asked these similar questions
2. Create a program that prints "CS2253" using the TRAP instruction (opcode 1111) and trap vector x22 (see Table A.3 on page 675). for the string should start at address x6000 and the program should start at address x3000. The data Note that you can load multiple .bin files into the simulator. can contain your program at address x3000, and the other can contain your data, at address x6000. One Your program should not make any assumptions about what values are initially in R0 to R7 when it starts to run. Screen shot required.
Do execution paths 3 and 4 encompass the first three conditions for a deadlock to occur?
Write a C program that uses the following: a main() to read two integer values from the user, val1 and val2, and prints the returned value from swap().a swap() that uses call by reference (takes the addresses into pointers) to swap values, and prints their values after the swap "num1 = # and num2 = #". This function returns the largest of the two values. If these are equal, it returns their sum.
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