Improved file structure

This commit is contained in:
2024-06-05 15:51:05 +02:00
parent 453b4d8956
commit 42a212a3f4
18 changed files with 106 additions and 378 deletions

View File

@ -3,10 +3,10 @@ package asm
import (
"encoding/binary"
"git.akyoto.dev/cli/q/src/arch/x64"
"git.akyoto.dev/cli/q/src/config"
"git.akyoto.dev/cli/q/src/log"
"git.akyoto.dev/cli/q/src/register"
"git.akyoto.dev/cli/q/src/x64"
)
// Assembler contains a list of instructions.

View File

@ -3,9 +3,9 @@ package asm_test
import (
"testing"
"git.akyoto.dev/cli/q/src/arch/x64"
"git.akyoto.dev/cli/q/src/asm"
"git.akyoto.dev/cli/q/src/linux"
"git.akyoto.dev/cli/q/src/register"
"git.akyoto.dev/cli/q/src/os/linux"
"git.akyoto.dev/go/assert"
)
@ -13,14 +13,14 @@ func TestHello(t *testing.T) {
a := asm.New()
hello := []byte("Hello\n")
a.MoveRegisterNumber(register.Syscall0, linux.Write)
a.MoveRegisterNumber(register.Syscall1, 1)
a.MoveRegisterData(register.Syscall2, hello)
a.MoveRegisterNumber(register.Syscall3, uint64(len(hello)))
a.MoveRegisterNumber(x64.SyscallNumber, linux.Write)
a.MoveRegisterNumber(x64.SyscallArgs[0], 1)
a.MoveRegisterData(x64.SyscallArgs[1], hello)
a.MoveRegisterNumber(x64.SyscallArgs[2], uint64(len(hello)))
a.Syscall()
a.MoveRegisterNumber(register.Syscall0, linux.Exit)
a.MoveRegisterNumber(register.Syscall1, 0)
a.MoveRegisterNumber(x64.SyscallNumber, linux.Exit)
a.MoveRegisterNumber(x64.SyscallArgs[0], 0)
a.Syscall()
code, data := a.Finalize()