Re: [PATCH v2 2/2] x86/tdx: Fix zero-extension for 32-bit port I/O

From: Dave Hansen

Date: Tue May 12 2026 - 21:14:27 EST


On 4/28/26 05:56, Kiryl Shutsemau (Meta) wrote:
> + if (size == 4)
> + regs->ax = 0;
> + else
> + regs->ax &= ~mask;

I haven't thought about this _that_ much, but this feels wrong. Why is
is 4 so special cased?

Also, what _are_ the limits on the registers that 'in' can be used on?

RAX - n/a, no 64-bit I/O
EAX - size=4
AX - size=2
AH - n/a no encoding for inb
AL - size=1

I'd find this much easier to grasp if there was a nice table of what the
registers, sizes, and masks ended up being usable. As usual, x86 is
"fun" here.