Write a C programs that operates like a mini-assembler for an x86-64 processor. The program would generate
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a C programs that operates like a mini-assembler for an x86-64 processor. The program would generate the machine code corresponding to any assembly code that comprises any combination of the following six (7) assembly instructions:
movlImmediate, Register
movq Register, Register
addq [Memory], Register
addl Immediate,[Memory]
iImulw Register,Register
mulq immediate,register
Notes:
- The registers can only be rdi (and derivatives), rsi(and derivatives), rax(and derivatives. Also, [Memory] is the content of memory pointed by one of these three registers.
- Your program shall be written in such a way that only one assembly instruction is written in one line. One or several lines can be inserted between instructions
- The output of your program shall display in each line the machine code corresponding to one single instruction only. Remember that the x86-86 processor is a CISCO processor. Example of Display:
- Your program shall display the message “Syntax Error” for any instruction which has a syntax error. For instance, mulq $14, %eax has a syntax error.
Related Book For
Computer Architecture Fundamentals And Principles Of Computer Design
ISBN: 9781032097336
2nd Edition
Authors: Joseph D. Dumas II
Posted Date: