Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

by using ANDL ORL ADDL SUBL XORL SHL SHRL and only assembly code QUESTION: Write

ID: 3679536 • Letter: B

Question

by using ANDL ORL ADDL SUBL XORL SHL SHRL

and only assembly code

QUESTION: Write a function to check if a machine uses little endian or big endian notation. The basic structure of the program is given in the attached assembly language file. You are expected to write the function int isLittleEndian(). Complete the function implementation to return the following values from the function. The function int isLittleEndian () should return the following values 1 if the architecture is "Little Endian" ·0 if the architecture is "Big Endian" Note: You may use the Homework2 as reference for the C program logic and implement the same in assembly. Also, pay attention to the return values and make appropriate changes.

Explanation / Answer

.global _isLittleEndian
_isLittleEndian:
pushl %ebp
movl %esp, %ebp
subl $16, %esp

movl 0x11, $16(%esp)
xorl %ebx, %ebx
mov $16(%esp), bl
xorl %eax, %eax
cmpl %ebx, 0x11
jne bigendian
movl $1, %eax

bigendian:
movl %ebp, %esp
popl %ebp
ret