func (ed *EmulatingDisassembler) findJumpTableTargets(disp AS.VA, scale int) ([]AS.VA, error) {
	var targets []AS.VA
	va := disp
	for {
		logrus.Debugf("pointer read: %s", va)
		target, e := W.MemReadPointer(ed.emulator, va, ed.emulator.GetMode())
		check(e)

		if ProbeMemory(ed.emulator, target, uint64(scale)) {
			targets = append(targets, target)
			// not sure this conversion from negative number to uint64 is correct
			va = AS.VA(uint64(va) + uint64(scale))
		} else {
			break
		}
	}
	return targets, nil
}
Example #2
0
// read a pointer-sized number from the given address
func (emu *Emulator) MemReadPtr(va AS.VA) (AS.VA, error) {
	return W.MemReadPointer(emu, va, emu.ws.Mode)
}