-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mips32i_assembler Add instructions and pseudoinstructions to mips_i_ext.h Add instructions format at mipsassembler_common.h Add mipsrelocations.h to take 16MSB and 16LSB Edit instruction.h to for Signed, Unsigned and Branch instructions of MIPS32
- Loading branch information
1 parent
6082d75
commit db3e9ed
Showing
7 changed files
with
538 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
create_ripes_lib(assembler LINK_TO_RIPES_LIB) | ||
|
||
target_sources(assembler_lib | ||
PRIVATE | ||
mips32i_assembler.h mips32i_assembler.cpp | ||
mipsrelocations.h | ||
mips_i_ext.h | ||
mipsassembler_common.h | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "mips32i_assembler.h" | ||
#include "gnudirectives.h" | ||
#include "mipsrelocations.h" | ||
#include "ripessettings.h" | ||
|
||
#include <QByteArray> | ||
#include <algorithm> | ||
|
||
#include "mips_i_ext.h" | ||
|
||
namespace Ripes { | ||
namespace Assembler { | ||
|
||
MIPS32I_Assembler::MIPS32I_Assembler(const ISAInfo<ISA::MIPS32I> *isa) | ||
: Assembler<Reg_T>(isa) { | ||
auto [instrs, pseudos] = initInstructions(isa); | ||
|
||
auto directives = gnuDirectives(); | ||
auto relocations = mipsRelocations<Reg_T>(); | ||
initialize(instrs, pseudos, directives, relocations); | ||
|
||
// Initialize segment pointers and monitor settings changes to segment | ||
// pointers | ||
connect(RipesSettings::getObserver(RIPES_SETTING_ASSEMBLER_TEXTSTART), | ||
&SettingObserver::modified, this, [this](const QVariant &value) { | ||
setSegmentBase(".text", value.toULongLong()); | ||
}); | ||
RipesSettings::getObserver(RIPES_SETTING_ASSEMBLER_TEXTSTART)->trigger(); | ||
connect(RipesSettings::getObserver(RIPES_SETTING_ASSEMBLER_DATASTART), | ||
&SettingObserver::modified, this, [this](const QVariant &value) { | ||
setSegmentBase(".data", 268500992); | ||
}); | ||
RipesSettings::getObserver(RIPES_SETTING_ASSEMBLER_DATASTART)->trigger(); | ||
connect(RipesSettings::getObserver(RIPES_SETTING_ASSEMBLER_BSSSTART), | ||
&SettingObserver::modified, this, [this](const QVariant &value) { | ||
setSegmentBase(".bss", value.toULongLong()); | ||
}); | ||
RipesSettings::getObserver(RIPES_SETTING_ASSEMBLER_BSSSTART)->trigger(); | ||
} | ||
|
||
std::tuple<MIPS32I_Assembler::_InstrVec, MIPS32I_Assembler::_PseudoInstrVec> | ||
MIPS32I_Assembler::initInstructions(const ISAInfo<ISA::MIPS32I> *isa) const { | ||
_InstrVec instructions; | ||
_PseudoInstrVec pseudoInstructions; | ||
|
||
MIPS_I<Reg_T>::enable(isa, instructions, pseudoInstructions); | ||
return {instructions, pseudoInstructions}; | ||
} | ||
|
||
} // namespace Assembler | ||
} // namespace Ripes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
#include <QObject> | ||
#include <functional> | ||
|
||
#include "assembler.h" | ||
#include "mipsassembler_common.h" | ||
|
||
namespace Ripes { | ||
namespace Assembler { | ||
|
||
class MIPS32I_Assembler : public QObject, public Assembler<uint32_t> { | ||
Q_OBJECT | ||
|
||
public: | ||
using Reg_T = uint32_t; | ||
MIPS32I_Assembler(const ISAInfo<ISA::MIPS32I> *isa); | ||
|
||
private: | ||
std::tuple<_InstrVec, _PseudoInstrVec> | ||
initInstructions(const ISAInfo<ISA::MIPS32I> *isa) const; | ||
|
||
protected: | ||
QChar commentDelimiter() const override { return '#'; } | ||
}; | ||
|
||
} // namespace Assembler | ||
} // namespace Ripes |
Oops, something went wrong.