Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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:

movl            Immediate, Register 

movq             Register, Register 

addq            [Memory], Register 

addl             Immediate,[Memory] 

iImulw          Register,Register 

mulq           immediate,register


Notes:

    1. 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.
    2. 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
    3. 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:
    4. 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.
student submitted image, transcription available below

 

55 89 5 8b 45 0c 03 45 08 89 ec 5d c3 8d 76 00 This corresponds to the 1st instruction This corresponds to the 2nd instruction

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Architecture Fundamentals And Principles Of Computer Design

Authors: Joseph D. Dumas II

2nd Edition

1032097337, 978-1032097336

More Books

Students also viewed these Programming questions