Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Bitwise logic in assembly is yet another interesting concept! x 8 6 allows you to perform logic operations bit by bit on registers. For the

Bitwise logic in assembly is yet another interesting concept!
x86 allows you to perform logic operations bit by bit on registers.
For the sake of this example say registers only store 8 bits.
The values in rax and rbx are:
rax =10101010
rbx =00110011
If we were to perform a bitwise AND of rax and rbx using the
"and rax, rbx" instruction, the result would be calculated by
ANDing each bit pair 1 by 1 hence why it's called a bitwise
logic.
So from left to right:
1 AND 0=0
0 AND 0=0
1 AND 1=1
0 AND 1=0
...
Finally we combine the results together to get:
rax =00100010
Here are some truth tables for reference:
AND OR XOR
A | B | X A | B | X A | B | X
---+---+------+---+------+---+---
0|0|00|0|00|0|0
0|1|00|1|10|1|1
1|0|01|0|11|0|1
1|1|11|1|11|1|0
Without using the following instructions:
mov, xchg
Please perform the following:
rax = rdi AND rsi
i.e. Set rax to the value of (rdi AND rsi)
We will now set the following in preparation for your code:
rdi =0x6cc76b4408fc98e5
rsi =0x87835fb5537838fb
Please give me your assembly in bytes (up to 0x1000 bytes):

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

Students also viewed these Databases questions