Added assembler instructions
This commit is contained in:
8
src/asm/Assembler.go
Normal file
8
src/asm/Assembler.go
Normal file
@ -0,0 +1,8 @@
|
||||
package asm
|
||||
|
||||
import "bytes"
|
||||
|
||||
type Assembler struct {
|
||||
Code bytes.Buffer
|
||||
Data bytes.Buffer
|
||||
}
|
11
src/asm/x64/AppendUint32.go
Normal file
11
src/asm/x64/AppendUint32.go
Normal file
@ -0,0 +1,11 @@
|
||||
package x64
|
||||
|
||||
import "io"
|
||||
|
||||
// AppendUint32 appends a 32 bit number in Little Endian to the given writer.
|
||||
func AppendUint32(w io.ByteWriter, number uint32) {
|
||||
w.WriteByte(byte(number))
|
||||
w.WriteByte(byte(number >> 8))
|
||||
w.WriteByte(byte(number >> 16))
|
||||
w.WriteByte(byte(number >> 24))
|
||||
}
|
10
src/asm/x64/MoveRegNum32.go
Normal file
10
src/asm/x64/MoveRegNum32.go
Normal file
@ -0,0 +1,10 @@
|
||||
package x64
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
func MoveRegNum32(w io.ByteWriter, register byte, number uint32) {
|
||||
w.WriteByte(0xb8 + register)
|
||||
AppendUint32(w, number)
|
||||
}
|
10
src/asm/x64/Syscall.go
Normal file
10
src/asm/x64/Syscall.go
Normal file
@ -0,0 +1,10 @@
|
||||
package x64
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
func Syscall(w io.ByteWriter) {
|
||||
w.WriteByte(0x0f)
|
||||
w.WriteByte(0x05)
|
||||
}
|
Reference in New Issue
Block a user