Jump table for the swi statement is given below. You can asume that th first entry in the jump table is for the case when y-0. Ox Sa0: Oxf70 Ox5as: Oxf6b movq srdi, rax cmpq $7, Brsi Oxf6r 160: f63: long fun (long x, long y)i long result - 0; switch (y) ja jmpq *0x5a0 (, ersi, 8) addq $20, srax 167: f69: E6b: retq decq srax retq leaq (, Srax,8), Srcx subq trax, rcx movq srcx, rax andq rsi, irax retq case 170: case 173: Ox5b0: Oxf6t result (74: Ox5b8: Oxf92 break; E8c: OxSc0: Oxt6b f8f: OxSc8: Oxfr6f case result f92: Ox Sd0: Oxf€f break; 195: Ox5d8: 0xf74 case case result break; default: result x: return result; Consider the above C code and the x86- 64 assembly code that implements the branches of the switch statement of C code. Fill in the blank portions of the C code above to reproduce the function corresponding to the given assembly code. The jump table is also given.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Jump table for the swi
statement is given below.
You can assume that the
first entry in the jump table
is for the case when y=0.
movq rdi, $rax
cmpq $7, rsi
ja
jmpq *0x5a0 (, 8rsi,8)
addq $20, Srax
retq
decq rax
retq
leaq (,8rax,8), 8rcx
subq rax, rcx
movq rex, rax
andq 8rsi, rax
retq
f60:
f63:
167:
Oxf6f
long fun (long x, long y) I
long result 0;
switch (y)I
f69:
f6b:
f6f:
Ox5a0: Oxf70
case
Ox5a8: 0xf ób
Ox5b0: Oxf6f
f70:
case
173:
result
f74:
Ox5b8: Oxf92
break;
£8c:
OxSc0: Oxfeb
case
f8f:
f6fא5c8:0א0
rosult
f92:
Ox5d0: OxfEf
=
break;
f95:
Ox5d8: 0xf74
case
case
result =
break;
default:
result = x;
return result;
Consider the above C code and the x86-
64 assembly code that implements the
branches of the switch statement of C
code.
Fill in the blank portions of the C code
above to
reproduce the function
corresponding to the given assembly
code. The jump table is also given.
CamScanner ile tarandı
Transcribed Image Text:Jump table for the swi statement is given below. You can assume that the first entry in the jump table is for the case when y=0. movq rdi, $rax cmpq $7, rsi ja jmpq *0x5a0 (, 8rsi,8) addq $20, Srax retq decq rax retq leaq (,8rax,8), 8rcx subq rax, rcx movq rex, rax andq 8rsi, rax retq f60: f63: 167: Oxf6f long fun (long x, long y) I long result 0; switch (y)I f69: f6b: f6f: Ox5a0: Oxf70 case Ox5a8: 0xf ób Ox5b0: Oxf6f f70: case 173: result f74: Ox5b8: Oxf92 break; £8c: OxSc0: Oxfeb case f8f: f6fא5c8:0א0 rosult f92: Ox5d0: OxfEf = break; f95: Ox5d8: 0xf74 case case result = break; default: result = x; return result; Consider the above C code and the x86- 64 assembly code that implements the branches of the switch statement of C code. Fill in the blank portions of the C code above to reproduce the function corresponding to the given assembly code. The jump table is also given. CamScanner ile tarandı
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Intermediate SQL concepts
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education