Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Assuming AT&T Syntax, which of the following x86 instructions is both correctly written and will compute %rax = %rdi * 5 ? A: mov

1. Assuming AT&T Syntax, which of the following x86 instructions is both correctly written and will compute %rax = %rdi * 5 ?

A: mov (%rdi), %rax B: mov %rdi * 5, %rax

C: lea (, %rdi, 5), %rax D: lea (%rdi, %rdi, 4), %rax

2. Which of the following would you highlight as an example of a CISC processor instruction?

A: Adding two numbers B: Finding length of a C string

C: Jumping to an address D: 64-bit XOR Operation

3. Of the following, what x86 register might you expect a compiler to use when utilizing a variable declared as ashort when SHORT_UMAX is defined as ?

A: %rax B: %eax

C: %ax D: %al

4. Consider the x86-64 Linux C ABI mentioned in our slides. How many items (not byte size) are written to the stack as part of this (otherwise nonsense) functions activation frame to account for arguments and variables? (Ignore the return address and any potential preserved registers, such as %rbp.)

int main(char x, char y, int i, int j, const char* s, char* d, size_t length) {

char* tmp = s;

while(*d++ != '\0') {

*d = x;

}

int num = 0;

while(*s++ != '\0' && num < length) {

*d++ = *(s - 1);

num++;

}

tmp[0] = y;

return num;

}

5. Consider the following x86 assembly. What is the value is %rax at the end of its execution? (An int, here, is 32-bits, you can specify your answer in base 10.)

.data

arr: .int 1, -2, 6, -4, 11

.text

_start:

lea (arr), %rbx

mov $4, %rdi

lea (%rbx, %rdi, 4), %rax

movl (%rax), %eax

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

From Herds To Insights Harnessing Data Analytics For Sustainable Livestock Farming

Authors: Prof Suresh Neethirajan

1st Edition

B0CFD6K6KK, 979-8857075487

More Books

Students also viewed these Databases questions