Given this MIPS machine language code fragment in memory Dis
Given this MIPS machine language code fragment in memory:
Disassemble and show the MIPS instructions.
For constants in I-format instructions, you may leave them in hexadecimal, or translate them into decimal.
Don’t worry about labels. Show clearly target addresses for all branches and jumps.
Solution
Answer:
MIPS instructions after dissembling the given code fragment:
0: 00 04 00 add BYTE PTR [eax+eax*1],al
 3: 02 40 34 add al,BYTE PTR [eax+0x34]
 6: 11 00 adc DWORD PTR [eax],eax
 8: 0b 00 or eax,DWORD PTR [eax]
 a: 04 00 add al,0x0
 c: 02 80 3c 10 10 01 add al,BYTE PTR [eax+0x110103c]
 12: 00 04 00 add BYTE PTR [eax+eax*1],al
 15: 02 c0 add al,al
 17: 2a 21 sub ah,BYTE PTR [ecx]
 19: 00 0b add BYTE PTR [ebx],cl
 1b: 00 04 00 add BYTE PTR [eax+eax*1],al
 1e: 03 00 add eax,DWORD PTR [eax]
 20: 14 20 adc al,0x20
 22: 00 07 add BYTE PTR [edi],al
 24: 00 04 00 add BYTE PTR [eax+eax*1],al
 27: 03 40 ae add eax,DWORD PTR [eax-0x52]
 2a: 08 00 or BYTE PTR [eax],al
 2c: 04 00 add al,0x0
 2e: 04 00 add al,0x0
 30: 03 80 22 31 ff ff add eax,DWORD PTR [eax-0xcede]
 36: 00 04 00 add BYTE PTR [eax+eax*1],al
 39: 03 c0 add eax,eax
 3b: 01 12 add DWORD PTR [edx],edx
 3d: 90 nop
 3e: 20 00 and BYTE PTR [eax],al
 40: 04 00 add al,0x0
 42: 04 00 add al,0x0
 44: 22 10 and dl,BYTE PTR [eax]
 46: ff (bad)
 47: fc cld
 48: 00 04 00 add BYTE PTR [eax+eax*1],al
 4b: 04 40 add al,0x40
 4d: 2a 21 sub ah,BYTE PTR [ecx]
 4f: 00 02 add BYTE PTR [edx],al
 51: 00 04 00 add BYTE PTR [eax+eax*1],al
 54: 04 80 add al,0x80
 56: 10 20 adc BYTE PTR [eax],ah
 58: ff (bad)
 59: fb sti

