qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Glauber Costa" <glommer@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [4609] moved halted field to CPU_COMMON
Date: Wed, 28 May 2008 14:24:28 -0300	[thread overview]
Message-ID: <5d6222a80805281024n2adecb8bt9adf931151ae88fe@mail.gmail.com> (raw)
In-Reply-To: <E1K1PE3-0003Mo-5Y@cvs.savannah.gnu.org>

On Wed, May 28, 2008 at 2:14 PM, Fabrice Bellard <fabrice@bellard.org> wrote:
> Revision: 4609
>          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4609
> Author:   bellard
> Date:     2008-05-28 17:14:10 +0000 (Wed, 28 May 2008)
>
> Log Message:
> -----------
> moved halted field to CPU_COMMON

It is very good to have it commited, but I feel really embarassed to
see no mention to me at all in the changelog.
Even if it is a slightly modified version of the patch itself
(although this one seems more like a subset), giving credit to the
work I've done is a good thing. At the very least,
it will keep developers around and motivated.

> Modified Paths:
> --------------
>    trunk/cpu-defs.h
>    trunk/hw/apic.c
>    trunk/hw/pc.c
>    trunk/monitor.c
>    trunk/target-alpha/cpu.h
>    trunk/target-arm/cpu.h
>    trunk/target-cris/cpu.h
>    trunk/target-i386/cpu.h
>    trunk/target-i386/exec.h
>    trunk/target-i386/helper.c
>    trunk/target-i386/op_helper.c
>    trunk/target-m68k/cpu.h
>    trunk/target-mips/cpu.h
>    trunk/target-ppc/cpu.h
>    trunk/target-sh4/cpu.h
>    trunk/target-sparc/cpu.h
>
> Modified: trunk/cpu-defs.h
> ===================================================================
> --- trunk/cpu-defs.h    2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/cpu-defs.h    2008-05-28 17:14:10 UTC (rev 4609)
> @@ -140,6 +140,7 @@
>                                    written */                           \
>     target_ulong mem_write_vaddr; /* target virtual addr at which the   \
>                                      memory was written */              \
> +    int halted; /* TRUE if the CPU is in suspend state */               \
>     /* The meaning of the MMU modes is defined in the target code. */   \
>     CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE];                  \
>     struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE];           \
>
> Modified: trunk/hw/apic.c
> ===================================================================
> --- trunk/hw/apic.c     2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/hw/apic.c     2008-05-28 17:14:10 UTC (rev 4609)
> @@ -443,12 +443,12 @@
>  static void apic_startup(APICState *s, int vector_num)
>  {
>     CPUState *env = s->cpu_env;
> -    if (!(env->hflags & HF_HALTED_MASK))
> +    if (!env->halted)
>         return;
>     env->eip = 0;
>     cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12,
>                            0xffff, 0);
> -    env->hflags &= ~HF_HALTED_MASK;
> +    env->halted = 0;
>  }
>
>  static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,
>
> Modified: trunk/hw/pc.c
> ===================================================================
> --- trunk/hw/pc.c       2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/hw/pc.c       2008-05-28 17:14:10 UTC (rev 4609)
> @@ -761,7 +761,7 @@
>             exit(1);
>         }
>         if (i != 0)
> -            env->hflags |= HF_HALTED_MASK;
> +            env->halted = 1;
>         if (smp_cpus > 1) {
>             /* XXX: enable it in all cases */
>             env->cpuid_features |= CPUID_APIC;
>
> Modified: trunk/monitor.c
> ===================================================================
> --- trunk/monitor.c     2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/monitor.c     2008-05-28 17:14:10 UTC (rev 4609)
> @@ -314,21 +314,15 @@
>                     env->cpu_index);
>  #if defined(TARGET_I386)
>         term_printf(" pc=0x" TARGET_FMT_lx, env->eip + env->segs[R_CS].base);
> -        if (env->hflags & HF_HALTED_MASK)
> -            term_printf(" (halted)");
>  #elif defined(TARGET_PPC)
>         term_printf(" nip=0x" TARGET_FMT_lx, env->nip);
> -        if (env->halted)
> -            term_printf(" (halted)");
>  #elif defined(TARGET_SPARC)
>         term_printf(" pc=0x" TARGET_FMT_lx " npc=0x" TARGET_FMT_lx, env->pc, env->npc);
> -        if (env->halted)
> -            term_printf(" (halted)");
>  #elif defined(TARGET_MIPS)
>         term_printf(" PC=0x" TARGET_FMT_lx, env->PC[env->current_tc]);
> +#endif
>         if (env->halted)
>             term_printf(" (halted)");
> -#endif
>         term_printf("\n");
>     }
>  }
>
> Modified: trunk/target-alpha/cpu.h
> ===================================================================
> --- trunk/target-alpha/cpu.h    2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-alpha/cpu.h    2008-05-28 17:14:10 UTC (rev 4609)
> @@ -285,7 +285,6 @@
>     jmp_buf jmp_env;
>     int user_mode_only; /* user mode only simulation */
>     uint32_t hflags;
> -    int halted;
>
>     int exception_index;
>     int error_code;
>
> Modified: trunk/target-arm/cpu.h
> ===================================================================
> --- trunk/target-arm/cpu.h      2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-arm/cpu.h      2008-05-28 17:14:10 UTC (rev 4609)
> @@ -160,7 +160,6 @@
>     int exception_index;
>     int interrupt_request;
>     int user_mode_only;
> -    int halted;
>
>     /* VFP coprocessor state.  */
>     struct {
>
> Modified: trunk/target-cris/cpu.h
> ===================================================================
> --- trunk/target-cris/cpu.h     2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-cris/cpu.h     2008-05-28 17:14:10 UTC (rev 4609)
> @@ -157,7 +157,6 @@
>
>        int features;
>        int user_mode_only;
> -       int halted;
>
>        jmp_buf jmp_env;
>        CPU_COMMON
>
> Modified: trunk/target-i386/cpu.h
> ===================================================================
> --- trunk/target-i386/cpu.h     2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-i386/cpu.h     2008-05-28 17:14:10 UTC (rev 4609)
> @@ -119,7 +119,7 @@
>  #define ID_MASK                 0x00200000
>
>  /* hidden flags - used internally by qemu to represent additional cpu
> -   states. Only the CPL, INHIBIT_IRQ and HALTED are not redundant. We avoid
> +   states. Only the CPL and INHIBIT_IRQ are not redundant. We avoid
>    using the IOPL_MASK, TF_MASK and VM_MASK bit position to ease oring
>    with eflags. */
>  /* current cpl */
> @@ -144,7 +144,6 @@
>  #define HF_CS64_SHIFT       15 /* only used on x86_64: 64 bit code segment  */
>  #define HF_OSFXSR_SHIFT     16 /* CR4.OSFXSR */
>  #define HF_VM_SHIFT         17 /* must be same as eflags */
> -#define HF_HALTED_SHIFT     18 /* CPU halted */
>  #define HF_SMM_SHIFT        19 /* CPU in SMM mode */
>  #define HF_GIF_SHIFT        20 /* if set CPU takes interrupts */
>  #define HF_HIF_SHIFT        21 /* shadow copy of IF_MASK when in SVM */
> @@ -166,7 +165,6 @@
>  #define HF_LMA_MASK          (1 << HF_LMA_SHIFT)
>  #define HF_CS64_MASK         (1 << HF_CS64_SHIFT)
>  #define HF_OSFXSR_MASK       (1 << HF_OSFXSR_SHIFT)
> -#define HF_HALTED_MASK       (1 << HF_HALTED_SHIFT)
>  #define HF_SMM_MASK          (1 << HF_SMM_SHIFT)
>  #define HF_GIF_MASK          (1 << HF_GIF_SHIFT)
>  #define HF_HIF_MASK          (1 << HF_HIF_SHIFT)
>
> Modified: trunk/target-i386/exec.h
> ===================================================================
> --- trunk/target-i386/exec.h    2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-i386/exec.h    2008-05-28 17:14:10 UTC (rev 4609)
> @@ -385,13 +385,13 @@
>
>  static inline int cpu_halted(CPUState *env) {
>     /* handle exit of HALTED state */
> -    if (!(env->hflags & HF_HALTED_MASK))
> +    if (!env->halted)
>         return 0;
>     /* disable halt condition */
>     if (((env->interrupt_request & CPU_INTERRUPT_HARD) &&
>          (env->eflags & IF_MASK)) ||
>         (env->interrupt_request & CPU_INTERRUPT_NMI)) {
> -        env->hflags &= ~HF_HALTED_MASK;
> +        env->halted = 0;
>         return 0;
>     }
>     return EXCP_HALTED;
>
> Modified: trunk/target-i386/helper.c
> ===================================================================
> --- trunk/target-i386/helper.c  2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-i386/helper.c  2008-05-28 17:14:10 UTC (rev 4609)
> @@ -515,7 +515,7 @@
>                     (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
>                     (int)(env->a20_mask >> 20) & 1,
>                     (env->hflags >> HF_SMM_SHIFT) & 1,
> -                    (env->hflags >> HF_HALTED_SHIFT) & 1);
> +                    env->halted);
>     } else
>  #endif
>     {
> @@ -542,7 +542,7 @@
>                     (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
>                     (int)(env->a20_mask >> 20) & 1,
>                     (env->hflags >> HF_SMM_SHIFT) & 1,
> -                    (env->hflags >> HF_HALTED_SHIFT) & 1);
> +                    env->halted);
>     }
>
>  #ifdef TARGET_X86_64
>
> Modified: trunk/target-i386/op_helper.c
> ===================================================================
> --- trunk/target-i386/op_helper.c       2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-i386/op_helper.c       2008-05-28 17:14:10 UTC (rev 4609)
> @@ -4546,7 +4546,7 @@
>     helper_svm_check_intercept_param(SVM_EXIT_HLT, 0);
>
>     env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */
> -    env->hflags |= HF_HALTED_MASK;
> +    env->halted = 1;
>     env->exception_index = EXCP_HLT;
>     cpu_loop_exit();
>  }
>
> Modified: trunk/target-m68k/cpu.h
> ===================================================================
> --- trunk/target-m68k/cpu.h     2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-m68k/cpu.h     2008-05-28 17:14:10 UTC (rev 4609)
> @@ -108,7 +108,6 @@
>     int exception_index;
>     int interrupt_request;
>     int user_mode_only;
> -    uint32_t halted;
>
>     int pending_vector;
>     int pending_level;
>
> Modified: trunk/target-mips/cpu.h
> ===================================================================
> --- trunk/target-mips/cpu.h     2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-mips/cpu.h     2008-05-28 17:14:10 UTC (rev 4609)
> @@ -449,8 +449,6 @@
>     target_ulong btarget;        /* Jump / branch target               */
>     int bcond;                   /* Branch condition (if needed)       */
>
> -    int halted; /* TRUE if the CPU is in suspend state */
> -
>     int SYNCI_Step; /* Address step size for SYNCI */
>     int CCRes; /* Cycle count resolution/divisor */
>     uint32_t CP0_Status_rw_bitmask; /* Read/write bits in CP0_Status */
>
> Modified: trunk/target-ppc/cpu.h
> ===================================================================
> --- trunk/target-ppc/cpu.h      2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-ppc/cpu.h      2008-05-28 17:14:10 UTC (rev 4609)
> @@ -586,8 +586,6 @@
>
>     CPU_COMMON
>
> -    int halted; /* TRUE if the CPU is in suspend state */
> -
>     int access_type; /* when a memory exception occurs, the access
>                         type is stored here */
>
>
> Modified: trunk/target-sh4/cpu.h
> ===================================================================
> --- trunk/target-sh4/cpu.h      2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-sh4/cpu.h      2008-05-28 17:14:10 UTC (rev 4609)
> @@ -117,7 +117,6 @@
>     jmp_buf jmp_env;
>     int user_mode_only;
>     int interrupt_request;
> -    int halted;
>     int exception_index;
>      CPU_COMMON tlb_t utlb[UTLB_SIZE]; /* unified translation table */
>     tlb_t itlb[ITLB_SIZE];     /* instruction translation table */
>
> Modified: trunk/target-sparc/cpu.h
> ===================================================================
> --- trunk/target-sparc/cpu.h    2008-05-28 16:49:25 UTC (rev 4608)
> +++ trunk/target-sparc/cpu.h    2008-05-28 17:14:10 UTC (rev 4609)
> @@ -219,7 +219,6 @@
>     int exception_index;
>     int interrupt_index;
>     int interrupt_request;
> -    int halted;
>     uint32_t mmu_bm;
>     uint32_t mmu_ctpr_mask;
>     uint32_t mmu_cxr_mask;
>
>
>
>
>



-- 
Glauber Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

  reply	other threads:[~2008-05-28 17:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 17:14 [Qemu-devel] [4609] moved halted field to CPU_COMMON Fabrice Bellard
2008-05-28 17:24 ` Glauber Costa [this message]
2008-05-28 18:15   ` Fabrice Bellard

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=5d6222a80805281024n2adecb8bt9adf931151ae88fe@mail.gmail.com \
    --to=glommer@gmail.com \
    --cc=qemu-devel@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).