Subject: Re: [PATCH 2/9] x86/extable: switch to using FIELD_GET_SIGNED()

From: Peter Zijlstra <[email-masked]>
Date: Mon, 20 Apr 2026 13:24:28 +0200

On Fri, Apr 17, 2026 at 01:36:13PM -0400, Yury Norov wrote:
> The EX_DATA register is laid out such that EX_DATA_IMM occupied MSB.
> It's done to make sure that FIELD_GET() will sign-extend the IMM
> field during extraction.
> 
> To enforce that, all EX_DATA masks are made signed integers. This
> works, but relies on the particular implementation of FIELD_GET(),
> i.e. masking then shifting, not vice versa; and the particular
> placement of the fields in the register.

I don't think the order of the mask and shift matters in this case. If
we were to first shift down and then mask, it would still work (after
all, the mask would also need to be shifted and would also get sign
extended, effectively ending up as -1).

But yes, this very much depends on the signed field being the topmost
field and including the MSB.