diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-09 09:50:58 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-09 09:50:58 +0100 |
commit | 1ac8ab06e9aad3b6d22685255459d71cb49e1f28 (patch) | |
tree | 95e4ca7de492180aef9d459ee40663b1bf134b66 /cpp.cpp | |
parent | db0654fa48ddc07e6bcaaaeddfa301a32806dadc (diff) |
First program: Can add 2 integers and return result via exit code
Diffstat (limited to 'cpp.cpp')
-rw-r--r-- | cpp.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,6 +1,7 @@ #include "cpp.h" #include "asm/encode.h" +#include "asm/operators.h" #include "bnf.h" #include "cppbnf.h" #include "debug.h" @@ -584,13 +585,13 @@ void CPP::link() // TODO // mSegment -> elf -#if 0 - return { + + mCode = std::vector<uint8_t>{ 0x48, 0xc7, 0xc0, 0x3c, 0x00, 0x00, 0x00, // mov $0x3c,%rax # syscall 60 0x48, 0x31, 0xff, // xor %rdi,%rdi # exit code 0 + } + mSegment.getCode() + std::vector<uint8_t>{ // add to edi 0x0f, 0x05, // syscall }; -#endif } // phases of translation, according to standard |