Re: [PATCH] x86/sev-es: Fix SEV-ES OUT/IN immediate opcode vc handling

From: Borislav Petkov
Date: Tue Dec 29 2020 - 05:59:17 EST


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