[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 15/28] linux-user/i386: Drop xfeatures_size from sigcontext ar
From: |
Richard Henderson |
Subject: |
[PATCH v2 15/28] linux-user/i386: Drop xfeatures_size from sigcontext arithmetic |
Date: |
Mon, 8 Apr 2024 19:02:49 -1000 |
This is subtracting sizeof(target_fpstate_fxsave) in
TARGET_FXSAVE_SIZE, then adding it again via &fxsave->xfeatures.
Perform the same computation using xstate_size alone.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/i386/signal.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c
index 68659fa1db..547c7cc685 100644
--- a/linux-user/i386/signal.c
+++ b/linux-user/i386/signal.c
@@ -252,7 +252,6 @@ static void xsave_sigcontext(CPUX86State *env, struct
target_fpstate_fxsave *fxs
__put_user(0, &fxsave->sw_reserved.magic1);
} else {
uint32_t xstate_size = xsave_area_size(env->xcr0, false);
- uint32_t xfeatures_size = xstate_size - TARGET_FXSAVE_SIZE;
/*
* extended_size is the offset from fpstate_addr to right after the end
@@ -272,7 +271,8 @@ static void xsave_sigcontext(CPUX86State *env, struct
target_fpstate_fxsave *fxs
__put_user(extended_size, &fxsave->sw_reserved.extended_size);
__put_user(env->xcr0, &fxsave->sw_reserved.xfeatures);
__put_user(xstate_size, &fxsave->sw_reserved.xstate_size);
- __put_user(TARGET_FP_XSTATE_MAGIC2, (uint32_t *)
&fxsave->xfeatures[xfeatures_size]);
+ __put_user(TARGET_FP_XSTATE_MAGIC2,
+ (uint32_t *)((void *)fxsave + xstate_size));
}
}
@@ -558,7 +558,6 @@ static int xrstor_sigcontext(CPUX86State *env, struct
target_fpstate_fxsave *fxs
if (env->features[FEAT_1_ECX] & CPUID_EXT_XSAVE) {
uint32_t extended_size = tswapl(fxsave->sw_reserved.extended_size);
uint32_t xstate_size = tswapl(fxsave->sw_reserved.xstate_size);
- uint32_t xfeatures_size = xstate_size - TARGET_FXSAVE_SIZE;
/* Linux checks MAGIC2 using xstate_size, not extended_size. */
if (tswapl(fxsave->sw_reserved.magic1) == TARGET_FP_XSTATE_MAGIC1 &&
@@ -567,7 +566,7 @@ static int xrstor_sigcontext(CPUX86State *env, struct
target_fpstate_fxsave *fxs
extended_size - TARGET_FPSTATE_FXSAVE_OFFSET)) {
return 1;
}
- if (tswapl(*(uint32_t *) &fxsave->xfeatures[xfeatures_size]) ==
TARGET_FP_XSTATE_MAGIC2) {
+ if (tswapl(*(uint32_t *)((void *)fxsave + xstate_size)) ==
TARGET_FP_XSTATE_MAGIC2) {
cpu_x86_xrstor(env, fxsave_addr, -1);
return 0;
}
--
2.34.1
- [PATCH v2 04/28] target/i386: Convert do_fldenv to X86Access, (continued)
- [PATCH v2 04/28] target/i386: Convert do_fldenv to X86Access, Richard Henderson, 2024/04/09
- [PATCH v2 05/28] target/i386: Convert do_fstenv to X86Access, Richard Henderson, 2024/04/09
- [PATCH v2 06/28] target/i386: Convert do_fsave, do_frstor to X86Access, Richard Henderson, 2024/04/09
- [PATCH v2 07/28] target/i386: Convert do_xsave_{fpu, mxcr, sse} to X86Access, Richard Henderson, 2024/04/09
- [PATCH v2 08/28] target/i386: Convert do_xrstor_{fpu, mxcr, sse} to X86Access, Richard Henderson, 2024/04/09
- [PATCH v2 09/28] tagret/i386: Convert do_fxsave, do_fxrstor to X86Access, Richard Henderson, 2024/04/09
- [PATCH v2 10/28] target/i386: Convert do_xsave_* to X86Access, Richard Henderson, 2024/04/09
- [PATCH v2 11/28] target/i386: Convert do_xrstor_* to X86Access, Richard Henderson, 2024/04/09
- [PATCH v2 12/28] target/i386: Split out do_xsave_chk, Richard Henderson, 2024/04/09
- [PATCH v2 13/28] target/i386: Add rbfm argument to cpu_x86_{xsave, xrstor}, Richard Henderson, 2024/04/09
- [PATCH v2 15/28] linux-user/i386: Drop xfeatures_size from sigcontext arithmetic,
Richard Henderson <=
- [PATCH v2 14/28] target/i386: Add {hw, sw}_reserved to X86LegacyXSaveArea, Richard Henderson, 2024/04/09
- [PATCH v2 16/28] linux-user/i386: Remove xfeatures from target_fpstate_fxsave, Richard Henderson, 2024/04/09
- [PATCH v2 17/28] linux-user/i386: Replace target_fpstate_fxsave with X86LegacyXSaveArea, Richard Henderson, 2024/04/09
- [PATCH v2 18/28] linux-user/i386: Split out struct target_fregs_state, Richard Henderson, 2024/04/09
- [PATCH v2 20/28] linux-user/i386: Return boolean success from restore_sigcontext, Richard Henderson, 2024/04/09
- [PATCH v2 19/28] linux-user/i386: Fix -mregparm=3 for signal delivery, Richard Henderson, 2024/04/09
- [PATCH v2 21/28] linux-user/i386: Return boolean success from xrstor_sigcontext, Richard Henderson, 2024/04/09
- [PATCH v2 23/28] target/i386: Honor xfeatures in xrstor_sigcontext, Richard Henderson, 2024/04/09