Re: [PATCH v1 02/14] x86/realmode: make %gs == 0 an invariant
From: H. Peter Anvin
Date: Tue Jan 20 2026 - 19:48:31 EST
On 2026-01-20 14:40, David Laight wrote:
>
> Would it be better to wrap that as (say) read_abs_32() since the
> objective is to read an absolute address (using the relevant zero segment
> register) rather than to read though either fs or gs.
>
> Is this code all running in 32bit linear mode with non-zero cs/ss/ds
> segment registers and 'suitable' entries in the GDT?
> That mode makes my brain hurt :-)
> Or is there a fudge to get 16bit asm from the C.
>
To address your specific question, no I don't think that is a good idea, since
it would imply that you can reach an arbitrary linear address, which is
definitely not the case.
At least this way the user has to look at what they are doing, which I think
is a good thing for this specific code.
-hpa