added more lifters...

merge-requests/11/head
_xeroxz 3 years ago
parent 89af2c2654
commit eb13c85f48

@ -22,7 +22,10 @@ namespace vm::lifters
extern vm::lifters::lifter_t lconstq, lconstdw, lconstw, lconstbzxw, lconstbsxdw, lconstbsxq, lconstdwsxq,
lconstwsxq, lconstwsxdw;
extern vm::lifters::lifter_t nandq, nanddw, nandw;
extern vm::lifters::lifter_t readq, readdw, readw;
extern vm::lifters::lifter_t shrq, shrw;
extern vm::lifters::lifter_t vmexit;
extern vm::lifters::lifter_t pushvsp;
inline std::map< vm::handler::mnemonic_t, lifter_callback_t > all = {
// lreg lifters...
@ -40,6 +43,15 @@ namespace vm::lifters
// nand lifters...
nandq, nanddw, nandw,
// read lifters....
readq, readdw, readw,
// shr lifters...
shrq, shrw,
// pushvsp lifter...
pushvsp,
// vmexit lifter...
vmexit };
} // namespace vm::lifters

@ -0,0 +1,9 @@
#include <vmlifters.hpp>
namespace vm::lifters
{
vm::lifters::lifter_t pushvsp = {
// push vsp
vm::handler::PUSHVSP,
[]( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) { blk->push( vtil::REG_SP ); } };
}

@ -0,0 +1,37 @@
#include <vmlifters.hpp>
namespace vm::lifters
{
vm::lifters::lifter_t readq = {
// pop vregX
// ldd vregX, vregX, 0
// push vregX
vm::handler::READQ, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) {
auto t0 = blk->tmp( 64 );
blk->pop( t0 );
blk->ldd( t0, t0, 0 );
blk->push( t0 );
} };
vm::lifters::lifter_t readdw = {
// pop vregX
// ldd vregX, vregX, 0
// push vregX
vm::handler::READDW, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) {
auto t0 = blk->tmp( 32 );
blk->pop( t0 );
blk->ldd( t0, t0, 0 );
blk->push( t0 );
} };
vm::lifters::lifter_t readw = {
// pop vregX
// ldd vregX, vregX, 0
// push vregX
vm::handler::READW, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) {
auto t0 = blk->tmp( 16 );
blk->pop( t0 );
blk->ldd( t0, t0, 0 );
blk->push( t0 );
} };
} // namespace vm::lifters

@ -0,0 +1,34 @@
#include <vmlifters.hpp>
namespace vm::lifters
{
vm::lifters::lifter_t shrq = {
// pop vregX
// pop vregY
// shr vregX, vregY
// push vregX
// pushf
vm::handler::SHRQ, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) {
auto [ t0, t1 ] = blk->tmp( 64, 8 );
blk->pop( t0 );
blk->pop( t1 );
blk->bshr( t0, t1 );
blk->push( t0 );
blk->pushf();
} };
vm::lifters::lifter_t shrw = {
// pop vregX
// pop vregY
// shr vregX, vregY
// push vregX
// pushf
vm::handler::SHRW, []( vtil::basic_block *blk, vm::instrs::virt_instr_t *vinstr ) {
auto [ t0, t1 ] = blk->tmp( 16, 8 );
blk->pop( t0 );
blk->pop( t1 );
blk->bshr( t0, t1 );
blk->push( t0 );
blk->pushf();
} };
} // namespace vm::lifters

@ -171,6 +171,9 @@
<ClCompile Include="src\vmlifters\lconst.cpp" />
<ClCompile Include="src\vmlifters\lreg.cpp" />
<ClCompile Include="src\vmlifters\nand.cpp" />
<ClCompile Include="src\vmlifters\pushvsp.cpp" />
<ClCompile Include="src\vmlifters\read.cpp" />
<ClCompile Include="src\vmlifters\shr.cpp" />
<ClCompile Include="src\vmlifters\sreg.cpp" />
<ClCompile Include="src\vmlifters\vmexit.cpp" />
<ClCompile Include="src\vmprofiles\add.cpp" />

@ -276,5 +276,14 @@
<ClCompile Include="src\vmlifters\nand.cpp">
<Filter>Source Files\vmlifters</Filter>
</ClCompile>
<ClCompile Include="src\vmlifters\pushvsp.cpp">
<Filter>Source Files\vmlifters</Filter>
</ClCompile>
<ClCompile Include="src\vmlifters\read.cpp">
<Filter>Source Files\vmlifters</Filter>
</ClCompile>
<ClCompile Include="src\vmlifters\shr.cpp">
<Filter>Source Files\vmlifters</Filter>
</ClCompile>
</ItemGroup>
</Project>
Loading…
Cancel
Save