Re: [PATCH v8 02/33] x86/fred: make unions for the cs and ss fields in struct pt_regs

From: Thomas Gleixner
Date: Mon Jun 05 2023 - 08:07:54 EST


On Mon, Apr 10 2023 at 01:14, Xin Li wrote:
> + union {
> + unsigned long csx; /* cs extended: CS + any fields above it */
> + struct __attribute__((__packed__)) {
> + unsigned short cs; /* CS selector proper */
> + unsigned int current_stack_level: 2;
> + unsigned int __csx_resv1 : 6;
> + unsigned int interrupt_shadowed : 1;
> + unsigned int software_initiated : 1;
> + unsigned int __csx_resv2 : 2;
> + unsigned int nmi : 1;
> + unsigned int __csx_resv3 : 3;
> + unsigned int __csx_resv4 : 32;
> + };
> + };
> unsigned long flags;
> unsigned long sp;
> - unsigned long ss;
> + union {
> + unsigned long ssx; /* ss extended: SS + any fields above it */
> + struct __attribute__((__packed__)) {
> + unsigned short ss; /* SS selector proper */
> + unsigned int __ssx_resv1 : 16;
> + unsigned int vector : 8;
> + unsigned int __ssx_resv2 : 8;
> + unsigned int type : 4;
> + unsigned int __ssx_resv3 : 4;
> + unsigned int enclv : 1;
> + unsigned int long_mode : 1;
> + unsigned int nested : 1;
> + unsigned int __ssx_resv4 : 1;
> + unsigned int instr_len : 4;
> + };
> + };

This does not match section

5.2.1 Saving Information on the Regular Stack?

of version 4 and later of the specification.

Thanks,

tglx