Implemented basic data access

This commit is contained in:
2023-10-18 17:03:31 +02:00
parent 8b66c9588c
commit 506d1e30bf
4 changed files with 36 additions and 15 deletions

View File

@ -38,9 +38,17 @@ func New(directory string) (*Build, error) {
func (build *Build) Run() error {
if build.WriteExecutable {
sampleCode := []byte{
0xb8, 0x3c, 0x00, 0x00, 0x00, // mov rax, 60
0xbf, 0x00, 0x00, 0x00, 0x00, // mov rdi, 0
0xb8, 0x01, 0x00, 0x00, 0x00, // mov eax, 1
0xbf, 0x01, 0x00, 0x00, 0x00, // mov edi, 1
0xbe, 0x80 + 0x22, 0x00, 0x40, 0x00, // mov esi, 0x4000A2
0xba, 0x06, 0x00, 0x00, 0x00, // mov edx, 6
0x0f, 0x05, // syscall
0xb8, 0x3c, 0x00, 0x00, 0x00, // mov eax, 60
0xbf, 0x00, 0x00, 0x00, 0x00, // mov edi, 0
0x0f, 0x05, // syscall
'H', 'e', 'l', 'l', 'o', '\n',
}
return writeToDisk(build.ExecutablePath, sampleCode, nil)