Updated module path
This commit is contained in:
parent
06c662589e
commit
1f0db51a95
211 changed files with 506 additions and 506 deletions
|
@ -1,7 +1,7 @@
|
|||
package x86
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// AddRegisterNumber adds a number to the given register.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestAddRegisterNumber(t *testing.T) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package x86
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// AndRegisterNumber performs a bitwise AND using a register and a number.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestAndRegisterNumber(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// Compares the register with the number and sets the status flags in the EFLAGS register.
|
||||
func CompareRegisterNumber(code []byte, register cpu.Register, number int) []byte {
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestCompareRegisterNumber(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// DivRegister divides RDX:RAX by the value in the register.
|
||||
func DivRegister(code []byte, divisor cpu.Register) []byte {
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestDivRegister(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,8 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestJump(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// LoadRegister loads from memory into a register.
|
||||
func LoadRegister(code []byte, destination cpu.Register, offset int8, length byte, source cpu.Register) []byte {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// LoadDynamicRegister loads from memory with a register offset into a register.
|
||||
func LoadDynamicRegister(code []byte, destination cpu.Register, offset cpu.Register, length byte, source cpu.Register) []byte {
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestLoadDynamicRegister(t *testing.T) {
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestLoadRegister(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,8 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestModRM(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,8 @@ package x86
|
|||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/sizeof"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/sizeof"
|
||||
)
|
||||
|
||||
// MoveRegisterNumber moves an integer into the given register.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestMoveRegisterNumber(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// MulRegisterNumber multiplies a register with a number.
|
||||
func MulRegisterNumber(code []byte, register cpu.Register, number int) []byte {
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestMulRegisterNumber(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// NegateRegister negates the value in the register.
|
||||
func NegateRegister(code []byte, register cpu.Register) []byte {
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestNegateRegister(t *testing.T) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package x86
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// OrRegisterNumber performs a bitwise OR using a register and a number.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestOrRegisterNumber(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// PopRegister pops a value from the stack and saves it into the register.
|
||||
func PopRegister(code []byte, register cpu.Register) []byte {
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestPopRegister(t *testing.T) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package x86
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/sizeof"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/sizeof"
|
||||
)
|
||||
|
||||
// PushNumber pushes a number onto the stack.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestPushNumber(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,8 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestREX(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
const (
|
||||
RAX cpu.Register = iota
|
||||
|
|
|
@ -3,8 +3,8 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestRegisters(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,8 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestSIB(t *testing.T) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package x86
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// ShiftLeftNumber shifts the register value by `bitCount` bits to the left.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestShiftLeftNumber(t *testing.T) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package x86
|
|||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// StoreNumber stores a number into the memory address included in the given register.
|
||||
|
|
|
@ -3,7 +3,7 @@ package x86
|
|||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// StoreDynamicNumber stores a number into the memory address at `destination` with a register offset.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestStoreDynamicNumber(t *testing.T) {
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestStoreNumber(t *testing.T) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package x86
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// SubRegisterNumber subtracts a number from the given register.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestSubRegisterNumber(t *testing.T) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package x86
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// XorRegisterNumber performs a bitwise XOR using a register and a number.
|
||||
|
|
|
@ -3,9 +3,9 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestXorRegisterNumber(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// encode is the core function that encodes an instruction.
|
||||
func encode(code []byte, mod AddressMode, reg cpu.Register, rm cpu.Register, numBytes byte, opCodes ...byte) []byte {
|
||||
|
|
|
@ -3,8 +3,8 @@ package x86
|
|||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/sizeof"
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/cli/q/src/sizeof"
|
||||
)
|
||||
|
||||
// encodeNum encodes an instruction with up to two registers and a number parameter.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// memoryAccess encodes a memory access.
|
||||
func memoryAccess(code []byte, opCode8 byte, opCode32 byte, register cpu.Register, offset int8, numBytes byte, source cpu.Register) []byte {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package x86
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/cpu"
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// memoryAccessDynamic encodes a memory access using the value of a register as an offset.
|
||||
func memoryAccessDynamic(code []byte, opCode8 byte, opCode32 byte, destination cpu.Register, offset cpu.Register, numBytes byte, source cpu.Register) []byte {
|
||||
|
|
|
@ -3,8 +3,8 @@ package x86_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/x86"
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.urbach.dev/cli/q/src/x86"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestX86(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue