Example #1
0
File: x86.go Project: tsavola/wag
func (mach X86) updateAddr8(code gen.OpCoder, addr, value int32) {
	if value < -0x80 || value >= 0x80 {
		panic(value)
	}
	code.Bytes()[addr-1] = uint8(value)
}
Example #2
0
File: x86.go Project: tsavola/wag
// UpdateCalls modifies CallRel instructions, possibly while they are being
// executed.
func (mach X86) UpdateCalls(code gen.OpCoder, l *links.L) {
	funcAddr := l.FinalAddr()
	for _, retAddr := range l.Sites {
		mach.PutUint32(code.Bytes()[retAddr-4:retAddr], uint32(funcAddr-retAddr))
	}
}
Example #3
0
File: x86.go Project: tsavola/wag
func (mach X86) updateAddr32(code gen.OpCoder, addr, value int32) {
	binary.LittleEndian.PutUint32(code.Bytes()[addr-4:addr], uint32(value))
}