Values are decimal unless preceded by 0x. The movl instruction moves 32 bits of
ID: 3872165 • Letter: V
Question
Values are decimal unless preceded by 0x. The movl instruction moves 32 bits of data from the given source to the given destination. For each instruction below, indicate what is updated (if register, give name including %. If memory, give as Mladdress, where address is in hex-M 0x2] is an example) and ,what the new value is. Treat each instruction independently - this is not a sequence of instructions. Instruction What changed? movl 0x1 cc, %rax movl 0x1 cc (% rax) movl 0x99, 8(% rax) movl %rdi,(%rax, %rdi) movl 16(%rax),%rdi movl (%rax, % rsi,8),%rax movl 4(%rax,%rdi,2),%rsi movl %rdi,16(%rax,%rax,2)Explanation / Answer
movl 0x1cc, %rax ===> move the content of memory location ox1cc into number register %rax. ===> rax = 0x1cc.
movl 0x1cc, (%rax) ===> move the content of memory location ox1cc into register %rax. ===> m[rax] = 0x1cc.
movl 0x99, 8(%rax) ===> move the content of memory location ox99 into register %rax, ===> m[m[rax] + 8] = 0x99.
movl %rdi, (%rax, %rdi) ===> Add the contents of number register %rdi and %rax to produce a memory reference. Move the contents of this memory location into number register %rdi, ===> m[m[rax] + m[rdi]] = m[rdi].
movl 16(%rax), %rdi ===> Add the result to the contents of number register %rax, and add the result to the address of 16 to produce an address. Move the contents of this address into number register %rdi. === >. m[rdi] = m[m[rax] + 16].
movl (%rax, %rsi, 8), %rax ===> Multiply the contents of number register %rsi by 8 and add the result to the contents of number register %rax to produce a memory reference. Move the contents of this memory location into number register %rax. ===> m[rax] = m[m[rax] + m[rsi] * 8].
movl 4(%rax, %rsi, 2), %rax ===> Multiply the contents of number register %rsi by 2 and add the result to the contents of number register %rax to produce a memory reference add the result to the address of 16 to produce an address. Move the contents of this memory location into number register
%rax. ===> m[rax] = m[m[rax] + m[rsi] * 8].
movl %rax 16(%rax, %rsi, 2) ===> Multiply the contents of number register %rsi by 2 and add the result to the contents of number register %rax to produce a memory reference add the result to the address of 16 to produce an address. Move the contents %rax of this memory location into number register m[m[m[rax] + m[rsi] * 2] + 16] ===> m[m[m[rax] + m[rsi] * 2] + 16] = m[rax].
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.