Sie sind auf Seite 1von 3

ASSIGNMENT 2

BY VINAY DAYAL 2018117


mov $100, 100 /*INVALID: The following instruction is invalid because 100 is not a register name
and there's no suffix such as l or b to define size. If the instruction was valid then it would have
moved 100 to register 100*/

movb $100, 100 /*VALID: The following instruction is valid and we are adding 100 in single byte
at address 100.*/

movl $100, 100(%eax, %edx, 8) /*VALID: The following is an example of Indirect memory
operand addressing mode. address a1: 100+%eax+(%edx*8)
32 bit Integer representation of 100 is stored in address a1.*/

add $100, 100(%eax,%edx,8) /*VALID: The following also uses indirect memory operand for
addressing so we add 100 to the address a1: 100+%eax+(%edx*8)*/

addw $100, 100(%eax, %edx, 8) /*VALID: The following instruction uses 16 bit Integer
representation of 100 to address a1 stated above*/
add $100, %eax /*VALID: The following instruction add 100 to eax register*/

add %eax, %ecx /*VALID: The following instruction add contents of eax register to ecx register*/

lea %eax, %eax /*INVALID: The following instructions are invalid as the first operand should
memory address but the second should be register, but the first here is the register which is
invalid.*/

lea (%eax), %eax /*VALID: Storing address of register EAX into EAX.*/

lea 100(%eax), %eax /*VALID: Storing address:100+address of eax to EAX register*/

lea %eax, 100(%eax) /*INVALID: The following address is using first operand as register but it
should be memory location and second operand should be a register rather than a memory location
that's why it is invalid. The following instruction would have stored the address of EAX register to
memory location 100+address of eax. */

ret /*VALID: The following address returns the control address from stack and resume the
function/procedure/macro to run the next instructions.*/

jmp 0x100 /*VALID: Following instruction transfer the control flow to instruction at the address
0x100 */

jmpw 0x100 /*VALID: Following instruction transfer the control flow to the instruction at 16 bit
integer representation of the address of 0x100 */

jmp *0x100 /*VALID: Following instruction transfer the control flow to the instruction at address
where 0x100 is stored.*/

jmpb *0x100 /*INVALID:Following instruction is invalid as suffix b is not used for jmp as the
address stated in operand can be non convertible to 1 BYTE. If the following instruction would've
been true then would transfer control to instruction at address at 1 byte representation of address
where 0x100 is stored.*/
jmpw *0x100 /*VALID: Following instruction transfer control flow to instruction at address at 16
bit integer representation of address where 0x100 is stored. */

cmp %eax, (%eax) /* VALID: Following instruction compare eax register with the contents in eax
register */

cmp $100, (%eax) /*VALID: Following instruction compares 100 with content in EAX Register */

cmpb $100, (%eax) /*VALID: Following instruction compares 100 in single byte to contents of
EAX Register */

je 0x100 /* VALID: Following instruction transfer the control to instruction at address 0x100 if the
above comparison operands are compared as equal.*/

je *0x100 /* INVALID: Pointer to je is not a valid operand for je statement as the function have to
jump to instruction stored at the address but it jumps to address where 0x100 is stored which is not
a valid instruction*/

jne 0x100 /* VALID: Following instruction transfer control to location 0x100 if the previous
comparison statement is not equal */

ja 0x100 /* VALID: Following instruction transfer the control flow to location 0x100 if first
operand is bigger than that of second operand in the previous comparison statement */

jb 0x100 /* VALID: Following instruction transfer the control flow to location 0x100 if first
operand is smaller than the second operand in the previous comparison statement */

jae 0x100 /* VALID: Following instruction transfer the control to address 0x100 if first operand is
equal to or greater than second operand in the previous comparison statement */

call 0x100 /* VALID: Following instruction transfer control to address 0x100. If there is a
subroutine at 0x100 then it will push the return address of subroutine in stack as well.*/

call *0x100 /* VALID: Following instruction transfer control to instruction set at the address where
0x100 is stored. */

callb *0x100 /* INVALID: Following instruction transfer control to single byte instruction set at the
address where 0x100 address is stored*/

and %eax, (%eax) /*VALID: Following instruction checks EAX Register address with content of
EAX Register bitwise and give out the result in first operand that is EAX Register. */

and %eax, %ecx /*VALID: Comparing Register EAX and ECX and replacing result from EAX. */

pushb %al /*INVALID: Pushing the one byte of register AL in stack is not valid as AL register can
not be converted into 1 byte. */

pushw %ax /* VALID: Pushing 16 bit of Integer representation of AX register on stack */

push %eax /*INVALID: pushing EAX Register into stack but 64 bit OS don't let eax(as it's a 32 bit
register) to be pushed in stack */
shl $12, %eax /*VALID: shifting left 12 till the address of EAX register*/

shr $12, %eax /*VALID: Shifting right 12 till the address count of EAX Register */

or $0x100, %eax /*VALID: Return the result of bitwise OR operaton of Ox100 and EAX register
address* and result gets stored in first operand*/

xor $100, %eax /* VALID: performs XOR with 100 and EAX and return result in first operand */

xchg %eax, %ecx /* VALID: EAX address is stored in ecx and ECX Address is stored in EAX*/

xchg %eax, (%ecx) /*VALID: ECX Content stored in eax and eax address stored in ecx. */

xadd %eax, (%ecx) /*VALID: The following instruction exchange the content in eax register with
that of address where ECX register exist. */

pushfl /*INVALID: The following instruction is invalid for x64 OS as it doesn't let eflag register to
add on top of stack. */

popfl /*INVALID: The following instruction is invalid for x64 OS as it doesn't let eflag register to
push or pop on or from stack */

lahf /*VALID: The following instruction is valid and used to load value of eflag register to AH
Register */

sahf /*VALID: The following instruction is valid and used to load AH Register content to EFlag
register */

rdtsc /*VALID: The following instruction is valid and used to store the CPU Ticks took place since
processor was reset and the following counter value is loaded to EAX Register*/

Das könnte Ihnen auch gefallen