Added x86 package
All checks were successful
/ test (push) Successful in 14s

This commit is contained in:
Eduard Urbach 2025-06-23 11:45:57 +02:00
parent 31c5ed614c
commit bac5986425
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
61 changed files with 2745 additions and 0 deletions

19
src/x86/SIB.go Normal file
View file

@ -0,0 +1,19 @@
package x86
// ScaleFactor encodes the scale factor.
type ScaleFactor = byte
const (
Scale1 = ScaleFactor(0b00)
Scale2 = ScaleFactor(0b01)
Scale4 = ScaleFactor(0b10)
Scale8 = ScaleFactor(0b11)
)
// SIB is used to generate an SIB byte.
// - scale: 2 bits. Multiplies the value of the index.
// - index: 3 bits. Specifies the index register.
// - base: 3 bits. Specifies the base register.
func SIB(scale ScaleFactor, index byte, base byte) byte {
return (scale << 6) | (index << 3) | base
}