Re: [PATCH 6/8] Return -1 on memory error in print_insn_m68k

Yao Qi
2017-01-13T12:29:38Z

On 17-01-13 12:24:12, Alan Modra wrote:
> > > Actually there is a good reason not to change that call, I just didn't
> > > look at the code well enough and thought you'd accidentally missed
> > > it. The previous patch is OK. The newest one would fail if you had
> > > a 2-byte insn at the end of a segment and happened to try a 4-byte
> > > insn match first.
> > >
> >
> > Hi Alan,
> > This won't happen in the 2nd patch, because if the instruction is 2-byte,
> > it won't read and match the next 2 bytes. There is a guard
> > ((0xffff & match) != 0) for read. Am I missing something?
>
> The code is looping over an opcode table. You might try to match a
> 4-byte instruction from the opcode table before matching the 2-byte
> instruction you have. If you exit the loop due to failing to read 4
> bytes then you won't disassemble the instruction.
>

OK, the v1 is pushed in.

--
Yao (é½å°§)