From: Thomas Huth <thuth@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>, qemu-devel@nongnu.org
Cc: "Dr. David Alan Gilbert" <dave@treblig.org>, qemu-trivial@nongnu.org
Subject: Re: [PULL 10/23] linux-user: Remove unused handle_vm86_fault
Date: Fri, 11 Oct 2024 18:02:54 +0200 [thread overview]
Message-ID: <c48513a2-a58f-4d41-a1c4-f04b82325894@redhat.com> (raw)
In-Reply-To: <20241004160331.1282441-11-mjt@tls.msk.ru>
On 04/10/2024 18.03, Michael Tokarev 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>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
> 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;
> - }
> -}
FYI, looks like this broke compiling with Clang:
../../devel/qemu/linux-user/vm86.c:50:20: error: unused function 'vm_putl'
[-Werror,-Wunused-function]
50 | static inline void vm_putl(CPUX86State *env, uint32_t segptr,
| ^~~~~~~
../../devel/qemu/linux-user/vm86.c:56:28: error: unused function 'vm_getb'
[-Werror,-Wunused-function]
56 | static inline unsigned int vm_getb(CPUX86State *env,
| ^~~~~~~
../../devel/qemu/linux-user/vm86.c:62:28: error: unused function 'vm_getw'
[-Werror,-Wunused-function]
62 | static inline unsigned int vm_getw(CPUX86State *env,
| ^~~~~~~
../../devel/qemu/linux-user/vm86.c:68:28: error: unused function 'vm_getl'
[-Werror,-Wunused-function]
68 | static inline unsigned int vm_getl(CPUX86State *env,
| ^~~~~~~
../../devel/qemu/linux-user/vm86.c:165:19: error: unused function
'set_vflags_long' [-Werror,-Wunused-function]
165 | static inline int set_vflags_long(unsigned long eflags, CPUX86State
*env)
| ^~~~~~~~~~~~~~~
../../devel/qemu/linux-user/vm86.c:179:19: error: unused function
'set_vflags_short' [-Werror,-Wunused-function]
179 | static inline int set_vflags_short(unsigned short flags,
CPUX86State *env)
| ^~~~~~~~~~~~~~~~
6 errors generated.
Should be easy to fix, I guess..
Thomas
next prev parent reply other threads:[~2024-10-11 17:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 16:03 [PULL 00/23] Trivial patches for 2024-10-04 Michael Tokarev
2024-10-04 16:03 ` [PULL 01/23] hw/audio/virtio-snd: Remove unnecessary "exec/tswap.h" header Michael Tokarev
2024-10-04 16:03 ` [PULL 02/23] qemu-keymap: Release local allocation references Michael Tokarev
2024-10-04 16:03 ` [PULL 03/23] vnc: fix crash when no console attached Michael Tokarev
2024-10-04 16:03 ` [PULL 04/23] MAINTAINERS: remove gensyscalls.sh from the linux-user section Michael Tokarev
2024-10-04 16:03 ` [PULL 05/23] hw/xen: Remove deadcode Michael Tokarev
2024-10-04 16:03 ` [PULL 06/23] q35: Remove unused mch_mcfg_base Michael Tokarev
2024-10-04 16:03 ` [PULL 07/23] net: Remove deadcode Michael Tokarev
2024-10-04 16:03 ` [PULL 08/23] hw/net/net_rx_pkt: " Michael Tokarev
2024-10-04 16:03 ` [PULL 09/23] hw/char: Remove unused serial_set_frequency Michael Tokarev
2024-10-04 16:03 ` [PULL 10/23] linux-user: Remove unused handle_vm86_fault Michael Tokarev
2024-10-11 16:02 ` Thomas Huth [this message]
2024-10-11 21:16 ` Michael Tokarev
2024-10-04 16:03 ` [PULL 11/23] hw: Remove unused fw_cfg_init_io Michael Tokarev
2024-10-04 16:03 ` [PULL 12/23] ui/cursor: remove cursor_get_mono_image Michael Tokarev
2024-10-04 16:03 ` [PULL 13/23] vhost: Remove unused vhost_dev_{load|save}_inflight Michael Tokarev
2024-10-04 16:03 ` [PULL 14/23] remote: Remove unused remote_iohub_finalize Michael Tokarev
2024-10-04 16:03 ` [PULL 15/23] replay: Remove unused replay_disable_events Michael Tokarev
2024-10-04 16:03 ` [PULL 16/23] hw/pci: Remove unused pcie_chassis_find_slot Michael Tokarev
2024-10-04 16:03 ` [PULL 17/23] hw/net/rocker: Remove unused rocker_fp_ports Michael Tokarev
2024-10-04 16:03 ` [PULL 18/23] block-backend: Remove deadcode Michael Tokarev
2024-10-04 16:03 ` [PULL 19/23] tests/tcg/plugins: Remove remainder of the cris target Michael Tokarev
2024-10-04 16:03 ` [PULL 20/23] hw/mips: Build fw_cfg.c once Michael Tokarev
2024-10-04 16:03 ` [PULL 21/23] tests/functional: Fix hash validation Michael Tokarev
2024-10-04 16:03 ` [PULL 22/23] docs/devel: Mention post_load hook restrictions where we document the hook Michael Tokarev
2024-10-04 16:03 ` [PULL 23/23] MAINTAINERS: Add myself as maintainer of e500 machines Michael Tokarev
2024-10-04 18:26 ` [PULL 00/23] Trivial patches for 2024-10-04 Peter Maydell
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=c48513a2-a58f-4d41-a1c4-f04b82325894@redhat.com \
--to=thuth@redhat.com \
--cc=dave@treblig.org \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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).