target-i386: Use struct X86XSaveArea in fpu_helper.c
PATCH v2 1/1 target-i386: Use struct X86XSaveArea in fpu_helper.c
This avoids a double hand-full of magic numbers in the xsave and xrstor helper functions.
--- target-i386/cpu.c | 7 ++- target-i386/cpu.h | 10 +---- target-i386/fpu_helper.c | 108 ++++++++++++++++++++++++++--------------------- 3 files changed, 67 insertions(+), 58 deletions(-)
---
V2: Adjust struct X86XSaveHeader so as to retain the test for 16 bytes of zeros within xrstor. Comment on the slight inconsistency in two sections of the current Intel documentation.
target-i386/cpu.c +6 -1
@@ -472,7 +472,12 @@ static const X86RegisterInfo32 x86_reg_info_32[CPU_NB_REGS32] = { };#undef REGISTER -const ExtSaveArea x86_ext_save_areas[] = { +typedef struct ExtSaveArea { +uint32_t feature, bits; +uint32_t offset, size; +}ExtSaveArea ; + +static const ExtSaveArea x86_ext_save_areas[] = { [XSTATE_YMM_BIT ] = { .feature =FEAT_1_ECX , .bits =CPUID_EXT_AVX , .offset = offsetof(X86XSaveArea , avx_state),
target-i386/cpu.h +2 -8
@@ -855,7 +855,8 @@ typedef union X86LegacyXSaveArea {typedef struct X86XSaveHeader {uint64_t xstate_bv;uint64_t xcomp_bv; -uint8_t reserved[48 ]; +uint64_t reserve0; +uint8_t reserved[40 ]; }X86XSaveHeader ;/* Ext. save area 2: AVX State */
@@ -1345,13 +1346,6 @@ int cpu_x86_signal_handler(int host_signum, void *pinfo, void *puc);/* cpu.c */ -typedef struct ExtSaveArea { -uint32_t feature, bits; -uint32_t offset, size; -}ExtSaveArea ; - -extern const ExtSaveArea x86_ext_save_areas[]; -void cpu_x86_cpuid (CPUX86State *env,uint32_t index,uint32_t count,uint32_t *eax,uint32_t *ebx,uint32_t *ecx,uint32_t *edx);
target-i386/fpu_helper.c +59 -49
258 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 9 lines · Richard Henderson
This avoids a double hand-full of magic numbers in the xsave and xrstor helper functions.
Signed-off-by Richard Henderson <[email protected]>--- target-i386/cpu.c | 7 ++- target-i386/cpu.h | 10 +---- target-i386/fpu_helper.c | 108 ++++++++++++++++++++++++++--------------------- 3 files changed, 67 insertions(+), 58 deletions(-)
Quoted 5 lines
---
V2: Adjust struct X86XSaveHeader so as to retain the test for 16 bytes of zeros within xrstor. Comment on the slight inconsistency in two sections of the current Intel documentation.
Ping.
r~
Eduardo Habkost
AppliedQuoted 12 lines · Richard Henderson
Quoted 11 lines · Richard Henderson
This avoids a double hand-full of magic numbers in the xsave and xrstor helper functions.
Signed-off-by Richard Henderson <[email protected]>--- target-i386/cpu.c | 7 ++- target-i386/cpu.h | 10 +---- target-i386/fpu_helper.c | 108 ++++++++++++++++++++++++++--------------------- 3 files changed, 67 insertions(+), 58 deletions(-)---
Quoted 5 lines
Quoted 3 lines
V2: Adjust struct X86XSaveHeader so as to retain the test for 16 bytes of zeros within xrstor. Comment on the slight inconsistency in two sections of the current Intel documentation.
Ping.
Applied to x86-next, thanks!
Signature · 1 line
Eduardo