and by only using: ANDL ORL ADDL SUBL XORL SHL SHRL QUESTION: Write a function t
ID: 3679354 • Letter: A
Question
and by only using:
ANDL ORL ADDL SUBL XORL SHL SHRL
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
.Ltext0: .section .rodata .LC0: 0000 20252E32 .string " %.2x" 7800 .text .globl show_mem_rep show_mem_rep: .LFB0: .cfi_startproc 0000 55 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 0001 4889E5 movq %rsp, %rbp .cfi_def_cfa_register 6 0004 4883EC20 subq $32, %rsp 0008 48897DE8 movq %rdi, -24(%rbp) 000c 8975E4 movl %esi, -28(%rbp) 000f C745FC00 movl $0, -4(%rbp) 000000 0016 EB28 jmp .L2 .L3: .LBB2: 0018 8B45FC movl -4(%rbp), %eax 001b 4863D0 movslq %eax, %rdx 001e 488B45E8 movq -24(%rbp), %rax 0022 4801D0 addq %rdx, %rax 0025 0FB600 movzbl (%rax), %eax 0028 0FBEC0 movsbl %al, %eax 002b 89C6 movl %eax, %esi 002d BF000000 movl $.LC0, %edi 00 0032 B8000000 movl $0, %eax 00 0037 E8000000 call printf 00 .LBE2: 003c 8345FC01 addl $1, -4(%rbp) .L2: 0040 8B45FC movl -4(%rbp), %eax 0043 3B45E4 cmpl -28(%rbp), %eax 0046 7CD0 jl .L3 0048 BF0A0000 movl $10, %edi 00 004d E8000000 call putchar 00 0052 C9 leave .cfi_def_cfa 7, 8 0053 C3 ret .cfi_endproc .LFE0: .Letext0:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.