Question: Code provided ------ .file cs261labw3 .text .globl main .type main, @function main: movq %rsp, %rbp addq $-56, %rsp # stack and strings concept movabsq $8263709752659164337,

 Code provided ------ .file "cs261labw3" .text .globl main .type main, @function

main: movq %rsp, %rbp addq $-56, %rsp # stack and strings concept

Code provided

------

.file "cs261labw3" .text .globl main .type main, @function main: movq %rsp, %rbp addq $-56, %rsp # stack and strings concept movabsq $8263709752659164337, %rax movq %rax, 48(%rsp) movabsq $0x6930334546128000, %rax movq %rax, 40(%rsp) movabsq $0x6425206325206425, %rax movq %rax, 32(%rsp) movabsq $0x21676e696e69, %rax movq %rax, 24(%rsp) movabsq $0x6172742064617571, %rax movq %rax, 16(%rsp) movabsq $0x73626d6f62206f74, %rax movq %rax, 8(%rsp) movabsq $0x20656d6f636c6557, %rax movq %rax, (%rsp)

# understanding types and data movement movabsq $0x1234567890abcdef, %rax movq %rax, %rcx movb $0x33, %al movl $0x33, %eax movsbq %cl, %rax movzbq %cl, %rax #address calculations and destination movq $4,%rcx leaq 0x10(, %rcx, 2), %rdx addq 0x10(%rsp, %rcx, 2), %rax movl (%rsp, %rdx), %eax #logical and arithmetic shifts movabsq $0xabcdef0123456789, %rbx movq %rbx, %rax shrq $2, %rbx sarq $2, %rax

addq $56, %rsp ret .size main, .-main .ident "GCC: () 4.1.2 20080704 (Red Hat 4.1.2-51)" .section .note.GNU-stack,"",@progbits

Open theexecutable obtained after compilation with gdb using command gob a.out 2. 3. Set a break point at line 25 that contains the instruction "movabsq $0x1234567890abcder, %rax" with the command b 25 (this works because you did the gcc-g command earlier). Fill in the stack address value and address expression for top 4 contents of stack at that point of execution. First row provides you an example. Use command x/4gx $rsp in gdb. [Note, you may have different stack address] (4 points each, total 36 points) Stack Address Value Address Expression 0x20656d6f636c6557 |(%rsp) 4, what is the string message starting at (%rsp)? (10 points) Fill in the space below with any value(s) that would satisfy the C format string that is located at address 0x20(%rsp). (9 points) 5. Based on the provided source file, give the contents of %rax after execution of each instruction below. (5 points each, total 25 points) Assembly instruction movabsq SOx1234567890abcdef, %rax movb S0x33, %al movl Sox33, %eax movsbq %d, %rax movzbq %d, %rax 6, Value of rax 7. Based on the provided source file, complete the table below. The values should be the results obtained after execution of instructions given below. (2 points each, total 20 points) Assembly instruction Destination Value addq 0x10(%rsp, %rcx, 2), %rax movi (%rsp, %rds), %eax shrq $2. %rbx sarq $2. %rax Open theexecutable obtained after compilation with gdb using command gob a.out 2. 3. Set a break point at line 25 that contains the instruction "movabsq $0x1234567890abcder, %rax" with the command b 25 (this works because you did the gcc-g command earlier). Fill in the stack address value and address expression for top 4 contents of stack at that point of execution. First row provides you an example. Use command x/4gx $rsp in gdb. [Note, you may have different stack address] (4 points each, total 36 points) Stack Address Value Address Expression 0x20656d6f636c6557 |(%rsp) 4, what is the string message starting at (%rsp)? (10 points) Fill in the space below with any value(s) that would satisfy the C format string that is located at address 0x20(%rsp). (9 points) 5. Based on the provided source file, give the contents of %rax after execution of each instruction below. (5 points each, total 25 points) Assembly instruction movabsq SOx1234567890abcdef, %rax movb S0x33, %al movl Sox33, %eax movsbq %d, %rax movzbq %d, %rax 6, Value of rax 7. Based on the provided source file, complete the table below. The values should be the results obtained after execution of instructions given below. (2 points each, total 20 points) Assembly instruction Destination Value addq 0x10(%rsp, %rcx, 2), %rax movi (%rsp, %rds), %eax shrq $2. %rbx sarq $2. %rax

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!