diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-21 22:57:25 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-21 22:57:25 +0100 |
commit | 739297d8895b08a9ecd8e81b01b7ba8e8dc4a8ae (patch) | |
tree | de0c20a23a60c1ccca8585f5ddd71eeb6be25623 /asm/intel64/encode.cpp | |
parent | 39bccce4fdd1d5ebe312321c963e0325e4d696c5 (diff) |
Bugfix push + pop
Diffstat (limited to 'asm/intel64/encode.cpp')
-rw-r--r-- | asm/intel64/encode.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/asm/intel64/encode.cpp b/asm/intel64/encode.cpp index 4e72933..62101f3 100644 --- a/asm/intel64/encode.cpp +++ b/asm/intel64/encode.cpp @@ -221,6 +221,15 @@ void Asm::toMachineCode(const FlowGraph::Graph& graph, Segment& segment) segment.push_back(makeLoadValue(graph.lastOp()->destination(), graph)); // TODO: Just get last operation result to eax for now segment.push_back(makeOp("xor", Asm::Args{{Asm::Args::Register64("rdi"), Asm::Args::Register64("rdi")}})); segment.push_back(makeOp("mov", Asm::Args{{Asm::Args::Register32("edi"), Asm::Args::Register32("eax")}})); + +#if 0 + segment.push_back(makeOp("xor", Asm::Args{{Asm::Args::Register64("rbp"), Asm::Args::Register64("rbp")}})); + segment.push_back(makeOp("dec", Asm::Args{{Asm::Args::Register64("rbp")}})); + segment.push_back(makeOp("mov", Asm::Args{{Asm::Args::Mem32Ptr64("rbp", -4), Asm::Args::Immediate32(3)}})); + segment.push_back(makeOp("mov", Asm::Args{{Asm::Args::Register32("edi"), Asm::Args::Mem32Ptr64("rbp", -4)}})); + //segment.push_back(makeOp("mov", Asm::Args{{Asm::Args::Register32("edi"), Asm::Args::Immediate32(3)}})); +#endif + segment.push_back(makeOp("mov", Asm::Args{{Asm::Args::Register64("rax"), Asm::Args::Immediate32(60)}})); // syscall 60: exit() segment.push_back(makeOp("syscall")); // rax: #syscall, rdi: exit code value } else if (typeid(node_deref) == typeid(FlowGraph::DataNode)) { |