I use this book ( Computer Systems: A Programmer\'s Perspective Authors: Randal
ID: 3714349 • Letter: I
Question
I use this book (
Computer Systems: A Programmer's Perspective
Authors: Randal E. Bryant and David R. O'Hallaron
Publisher: Addison Wesley; 2
nd edition)
(in computer system language)
TQ.1] Assume the following values are stored in memory addresses and registers as indicated Value Address 0x100 0x104 0x108 0x10C 0x110 0x1C 0xBC OxFA 0x05 0x03 Register %rax %rcx %rax Value 0x104 0x001 Ox003 Fill in the following table showing the values of the given operand: Ox108 $0x104 %rcx (%rax) -8(%rax,%rcx,4) 4(%rax,%rdx,4) Q.2] Convert the following C codes to equivalent IA-64 assembly codes as per the GCC conventions.: a. If else if else int compare (int a, int *b, int c) { if (a> *b) return 1; else if (aExplanation / Answer
1) 0x108 refers to the address at 0x108 i.e., 0xFA is the answer
$0x104 refers to the constant value that is 0x104 is the answer
%rcx refers to the actual value of the register %rcx that is 0x001 is the answer
(%rax) refers to the value at the address %rax that is 0x104 that is 0xBC is the answer
-8(%rax,%rcx,4) refers to the -8+%rax+%rcx*4= -8+0x104+0x001*4=0x100 is the answer
-4(%rax,rdx,4) refers to -4+%rax+%rdx*4=-4+0x104+0x003*4=0x112 is the answer
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.