Re: [RFC PATCH v3 15/32] x86/fred: make unions for the cs and ss fields in struct pt_regs
From: andrew . cooper3
Date: Fri Feb 24 2023 - 06:01:36 EST
On 24/02/2023 7:01 am, Xin Li wrote:
> diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
> index f4db78b09c8f..341e44847cc1 100644
> --- a/arch/x86/include/asm/ptrace.h
> +++ b/arch/x86/include/asm/ptrace.h
> @@ -82,13 +82,41 @@ struct pt_regs {
> * On hw interrupt, it's IRQ number:
> */
> unsigned long orig_ax;
> -/* Return frame for iretq */
> +
> + /* Return frame for iretq/eretu/erets */
> unsigned long ip;
> - unsigned long cs;
> + union {
> + unsigned long csl; /* CS + any fields above it */
I guess that CSL here is supposed to mean cs long, but CSL (Current
Stack Level) is a new term in the FRED spec which isn't this.
This causes changes such as the final hunk in patch 27 to read
incorrectly, despite being technically correct.
cs_slot would be much clearer in code, but tbh, even cs_l would be
better than the version without an underscore.
And obviously, whatever is done here should be mirrored for ss.
~Andrew