On Mon, Dec 28, 2020 at 03:43:06PM -0800, Sean Christopherson wrote:
> Eh, casting to u8 is "absolutely correct" as well.  I don't like using bytes[]
> because it feels like accessing the raw data as opposed to the end result of
> decoding, but it's not a sticking point.

Ok, code in the kernel uses mostly ->value so u8 casting it is.

> Yes, insn_get_immediate() sets insn->immediate.value directly and sign extends
> the imm8 (which is correct, e.g. for "AND r/m64, imm8"). 
> 
>       switch (inat_immediate_size(insn->attr)) {
>       case INAT_IMM_BYTE:
>               insn->immediate.value = get_next(signed char, insn);
>               insn->immediate.nbytes = 1;

Ah, there it is. And we set nbytes too, conveniently.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Reply via email to