Improved file structure

This commit is contained in:
Eduard Urbach 2024-06-05 15:51:05 +02:00
parent b6400cd77e
commit c0f399df7f
Signed by: eduard
GPG key ID: 49226B848C78F6C8
18 changed files with 106 additions and 378 deletions

View file

@ -1,14 +0,0 @@
package x64
// Call places the return address on the top of the stack and continues
// program flow at the new address. The address is relative to the next instruction.
func Call(code []byte, address uint32) []byte {
return append(
code,
0xe8,
byte(address),
byte(address>>8),
byte(address>>16),
byte(address>>24),
)
}

View file

@ -1,13 +0,0 @@
package x64
// MoveRegNum32 moves a 32 bit integer into the given register.
func MoveRegNum32(code []byte, register uint8, number uint32) []byte {
return append(
code,
0xb8+register,
byte(number),
byte(number>>8),
byte(number>>16),
byte(number>>24),
)
}

View file

@ -1,7 +0,0 @@
package x64
// Return transfers program control to a return address located on the top of the stack.
// The address is usually placed on the stack by a Call instruction.
func Return(code []byte) []byte {
return append(code, 0xc3)
}

View file

@ -1,6 +0,0 @@
package x64
// Syscall is the primary way to communicate with the OS kernel.
func Syscall(code []byte) []byte {
return append(code, 0x0f, 0x05)
}