[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v22 14/17] i386: split seg_helper into user-only and sysemu p
From: |
Richard Henderson |
Subject: |
Re: [PATCH v22 14/17] i386: split seg_helper into user-only and sysemu parts |
Date: |
Wed, 24 Feb 2021 19:57:16 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 2/24/21 5:34 AM, Claudio Fontana wrote:
> Signed-off-by: Claudio Fontana <cfontana@suse.de>
> ---
> target/i386/tcg/helper-tcg.h | 5 +
> target/i386/tcg/seg_helper.h | 66 ++++++++
> target/i386/tcg/seg_helper.c | 233 +---------------------------
> target/i386/tcg/sysemu/seg_helper.c | 125 +++++++++++++++
> target/i386/tcg/user/seg_helper.c | 109 +++++++++++++
> target/i386/tcg/sysemu/meson.build | 1 +
> target/i386/tcg/user/meson.build | 1 +
> 7 files changed, 311 insertions(+), 229 deletions(-)
> create mode 100644 target/i386/tcg/seg_helper.h
> create mode 100644 target/i386/tcg/sysemu/seg_helper.c
> create mode 100644 target/i386/tcg/user/seg_helper.c
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Not your bug, but for the record:
> +void cpu_x86_load_seg(CPUX86State *env, X86Seg seg_reg, int selector)
> +{
> + if (!(env->cr[0] & CR0_PE_MASK) || (env->eflags & VM_MASK)) {
This first test is always false for user-only. The second can be true via the
vm86(2) syscall.
> + int dpl = (env->eflags & VM_MASK) ? 3 : 0;
so this second test becomes redundant.
> + selector &= 0xffff;
> + cpu_x86_load_seg_cache(env, seg_reg, selector,
> + (selector << 4), 0xffff,
> + DESC_P_MASK | DESC_S_MASK | DESC_W_MASK |
> + DESC_A_MASK | (dpl << DESC_DPL_SHIFT));
> + } else {
> + helper_load_seg(env, seg_reg, selector);
> + }
And helper_load_seg calls GETPC(), so suffers from the same problem as the fpu
helpers.
r~
- Re: [PATCH v22 06/17] meson: add target_user_arch, (continued)
- [PATCH v22 09/17] i386: split tcg excp_helper into sysemu and user parts, Claudio Fontana, 2021/02/24
- [PATCH v22 10/17] i386: move TCG btp_helper into sysemu/, Claudio Fontana, 2021/02/24
- [PATCH v22 13/17] i386: split svm_helper into sysemu and stub-only user, Claudio Fontana, 2021/02/24
- [PATCH v22 12/17] i386: separate fpu_helper into user and sysemu parts, Claudio Fontana, 2021/02/24
- [PATCH v22 14/17] i386: split seg_helper into user-only and sysemu parts, Claudio Fontana, 2021/02/24
- Re: [PATCH v22 14/17] i386: split seg_helper into user-only and sysemu parts,
Richard Henderson <=
- [PATCH v22 11/17] i386: split misc helper into user and sysemu parts, Claudio Fontana, 2021/02/24
- [PATCH v22 17/17] i386: move cpu_load_efer into sysemu-only section of cpu.h, Claudio Fontana, 2021/02/24
- [PATCH v22 16/17] i386: gdbstub: only write CR0/CR2/CR3/EFER for SOFTMMU, Claudio Fontana, 2021/02/24