From: Thomas Huth <thuth@redhat.com>
To: dave@treblig.org, richard.henderson@linaro.org,
laurent@vivier.eu, QEMU Trivial <qemu-trivial@nongnu.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] linux-user: Remove unused handle_vm86_fault
Date: Wed, 2 Oct 2024 12:32:37 +0200 [thread overview]
Message-ID: <24facf82-c3a2-47e0-98f8-e2b684a705f0@redhat.com> (raw)
In-Reply-To: <20240918141553.149521-1-dave@treblig.org>
On 18/09/2024 16.15, dave@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <dave@treblig.org>
>
> handle_vm86_fault has been unused since:
> 1ade5b2fed ("linux-user/i386: Split out maybe_handle_vm86_trap")
>
> Remove it, and it's local macros.
>
> Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
> ---
> linux-user/user-internals.h | 1 -
> linux-user/vm86.c | 136 ------------------------------------
> 2 files changed, 137 deletions(-)
>
> diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
> index 5c7f173ceb..46ffc093f4 100644
> --- a/linux-user/user-internals.h
> +++ b/linux-user/user-internals.h
> @@ -102,7 +102,6 @@ int host_to_target_waitstatus(int status);
> /* vm86.c */
> void save_v86_state(CPUX86State *env);
> void handle_vm86_trap(CPUX86State *env, int trapno);
> -void handle_vm86_fault(CPUX86State *env);
> int do_vm86(CPUX86State *env, long subfunction, abi_ulong v86_addr);
> #elif defined(TARGET_SPARC64)
> void sparc64_set_context(CPUSPARCState *env);
> diff --git a/linux-user/vm86.c b/linux-user/vm86.c
> index 9f512a2242..31a2d707cf 100644
> --- a/linux-user/vm86.c
> +++ b/linux-user/vm86.c
> @@ -255,142 +255,6 @@ void handle_vm86_trap(CPUX86State *env, int trapno)
> }
> }
>
> -#define CHECK_IF_IN_TRAP() \
> - if ((ts->vm86plus.vm86plus.flags & TARGET_vm86dbg_active) && \
> - (ts->vm86plus.vm86plus.flags & TARGET_vm86dbg_TFpendig)) \
> - newflags |= TF_MASK
> -
> -#define VM86_FAULT_RETURN \
> - if ((ts->vm86plus.vm86plus.flags & TARGET_force_return_for_pic) && \
> - (ts->v86flags & (IF_MASK | VIF_MASK))) \
> - return_to_32bit(env, TARGET_VM86_PICRETURN); \
> - return
> -
> -void handle_vm86_fault(CPUX86State *env)
> -{
> - CPUState *cs = env_cpu(env);
> - TaskState *ts = get_task_state(cs);
> - uint32_t csp, ssp;
> - unsigned int ip, sp, newflags, newip, newcs, opcode, intno;
> - int data32, pref_done;
> -
> - csp = env->segs[R_CS].selector << 4;
> - ip = env->eip & 0xffff;
> -
> - ssp = env->segs[R_SS].selector << 4;
> - sp = env->regs[R_ESP] & 0xffff;
> -
> - LOG_VM86("VM86 exception %04x:%08x\n",
> - env->segs[R_CS].selector, env->eip);
> -
> - data32 = 0;
> - pref_done = 0;
> - do {
> - opcode = vm_getb(env, csp, ip);
> - ADD16(ip, 1);
> - switch (opcode) {
> - case 0x66: /* 32-bit data */ data32=1; break;
> - case 0x67: /* 32-bit address */ break;
> - case 0x2e: /* CS */ break;
> - case 0x3e: /* DS */ break;
> - case 0x26: /* ES */ break;
> - case 0x36: /* SS */ break;
> - case 0x65: /* GS */ break;
> - case 0x64: /* FS */ break;
> - case 0xf2: /* repnz */ break;
> - case 0xf3: /* rep */ break;
> - default: pref_done = 1;
> - }
> - } while (!pref_done);
> -
> - /* VM86 mode */
> - switch(opcode) {
> - case 0x9c: /* pushf */
> - if (data32) {
> - vm_putl(env, ssp, sp - 4, get_vflags(env));
> - ADD16(env->regs[R_ESP], -4);
> - } else {
> - vm_putw(env, ssp, sp - 2, get_vflags(env));
> - ADD16(env->regs[R_ESP], -2);
> - }
> - env->eip = ip;
> - VM86_FAULT_RETURN;
> -
> - case 0x9d: /* popf */
> - if (data32) {
> - newflags = vm_getl(env, ssp, sp);
> - ADD16(env->regs[R_ESP], 4);
> - } else {
> - newflags = vm_getw(env, ssp, sp);
> - ADD16(env->regs[R_ESP], 2);
> - }
> - env->eip = ip;
> - CHECK_IF_IN_TRAP();
> - if (data32) {
> - if (set_vflags_long(newflags, env))
> - return;
> - } else {
> - if (set_vflags_short(newflags, env))
> - return;
> - }
> - VM86_FAULT_RETURN;
> -
> - case 0xcd: /* int */
> - intno = vm_getb(env, csp, ip);
> - ADD16(ip, 1);
> - env->eip = ip;
> - if (ts->vm86plus.vm86plus.flags & TARGET_vm86dbg_active) {
> - if ( (ts->vm86plus.vm86plus.vm86dbg_intxxtab[intno >> 3] >>
> - (intno &7)) & 1) {
> - return_to_32bit(env, TARGET_VM86_INTx + (intno << 8));
> - return;
> - }
> - }
> - do_int(env, intno);
> - break;
> -
> - case 0xcf: /* iret */
> - if (data32) {
> - newip = vm_getl(env, ssp, sp) & 0xffff;
> - newcs = vm_getl(env, ssp, sp + 4) & 0xffff;
> - newflags = vm_getl(env, ssp, sp + 8);
> - ADD16(env->regs[R_ESP], 12);
> - } else {
> - newip = vm_getw(env, ssp, sp);
> - newcs = vm_getw(env, ssp, sp + 2);
> - newflags = vm_getw(env, ssp, sp + 4);
> - ADD16(env->regs[R_ESP], 6);
> - }
> - env->eip = newip;
> - cpu_x86_load_seg(env, R_CS, newcs);
> - CHECK_IF_IN_TRAP();
> - if (data32) {
> - if (set_vflags_long(newflags, env))
> - return;
> - } else {
> - if (set_vflags_short(newflags, env))
> - return;
> - }
> - VM86_FAULT_RETURN;
> -
> - case 0xfa: /* cli */
> - env->eip = ip;
> - clear_IF(env);
> - VM86_FAULT_RETURN;
> -
> - case 0xfb: /* sti */
> - env->eip = ip;
> - if (set_IF(env))
> - return;
> - VM86_FAULT_RETURN;
> -
> - default:
> - /* real VM86 GPF exception */
> - return_to_32bit(env, TARGET_VM86_UNKNOWN);
> - break;
> - }
> -}
> -
> int do_vm86(CPUX86State *env, long subfunction, abi_ulong vm86_addr)
> {
> CPUState *cs = env_cpu(env);
Reviewed-by: Thomas Huth <thuth@redhat.com>
prev parent reply other threads:[~2024-10-02 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 14:15 [PATCH] linux-user: Remove unused handle_vm86_fault dave
2024-10-02 10:32 ` Thomas Huth [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=24facf82-c3a2-47e0-98f8-e2b684a705f0@redhat.com \
--to=thuth@redhat.com \
--cc=dave@treblig.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).