qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabien Chouteau <chouteau@adacore.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/6] [RFC] SPARCV8 asr17 register support.
Date: Tue, 07 Dec 2010 12:51:43 +0100	[thread overview]
Message-ID: <4CFE1FCF.7000303@adacore.com> (raw)
In-Reply-To: <AANLkTim5+1DETERnYk5yBwZAOWUA3PMX5TOx2pULRqVF@mail.gmail.com>

On 12/06/2010 07:01 PM, Blue Swirl wrote:
> On Mon, Dec 6, 2010 at 9:26 AM, Fabien Chouteau<chouteau@adacore.com>  wrote:
>>
>> Signed-off-by: Fabien Chouteau<chouteau@adacore.com>
>> ---
>>   hw/leon3.c               |    6 ++++++
>>   target-sparc/cpu.h       |    1 +
>>   target-sparc/machine.c   |    2 ++
>>   target-sparc/translate.c |   10 ++++++++++
>>   4 files changed, 19 insertions(+), 0 deletions(-)
>>
>> diff --git a/hw/leon3.c b/hw/leon3.c
>> index ba61081..9605ce8 100644
>> --- a/hw/leon3.c
>> +++ b/hw/leon3.c
>> @@ -187,6 +187,12 @@ static void main_cpu_reset(void *opaque)
>>         values */
>>      leon3_state.inst_cache_conf = 0x10220000;
>>      leon3_state.data_cache_conf = 0x18220000;
>> +
>> +    /* Asr17 for Leon3 mono-processor */
>> +    env->asr17&= 0<<  28;          /* CPU id */
>> +    env->asr17&= 1<<  8;           /* SPARC V8 multiply and divide available */
>> +    env->asr17&= env->nwindows -1; /* Number of implemented registers
>> +                                       windows */
>
> This is constant...
>
>>   }
>>
>>   static void leon3_generic_hw_init(ram_addr_t  ram_size,
>> diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
>> index 6020ffd..36d49fc 100644
>> --- a/target-sparc/cpu.h
>> +++ b/target-sparc/cpu.h
>> @@ -341,6 +341,7 @@ typedef struct CPUSPARCState {
>>                            from PSR) */
>>   #if !defined(TARGET_SPARC64) || defined(TARGET_ABI32)
>>      uint32_t wim;      /* window invalid mask */
>> +    uint32_t asr17;    /* asr17 */
>
> ... so no new env fields are needed...
>
>>   #endif
>>      target_ulong tbr;  /* trap base register */
>>   #if !defined(TARGET_SPARC64)
>> diff --git a/target-sparc/machine.c b/target-sparc/machine.c
>> index 752e431..c530bd3 100644
>> --- a/target-sparc/machine.c
>> +++ b/target-sparc/machine.c
>> @@ -42,6 +42,7 @@ void cpu_save(QEMUFile *f, void *opaque)
>>      qemu_put_be32s(f,&env->pil_in);
>>   #ifndef TARGET_SPARC64
>>      qemu_put_be32s(f,&env->wim);
>> +    qemu_put_be32s(f,&env->asr17);
>
> ... there's also nothing to save/load...
>
>>      /* MMU */
>>      for (i = 0; i<  32; i++)
>>          qemu_put_be32s(f,&env->mmuregs[i]);
>> @@ -138,6 +139,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
>>      qemu_get_be32s(f,&env->pil_in);
>>   #ifndef TARGET_SPARC64
>>      qemu_get_be32s(f,&env->wim);
>> +    qemu_get_be32s(f,&env->asr17);
>>      /* MMU */
>>      for (i = 0; i<  32; i++)
>>          qemu_get_be32s(f,&env->mmuregs[i]);
>> diff --git a/target-sparc/translate.c b/target-sparc/translate.c
>> index 23f9519..65de614 100644
>> --- a/target-sparc/translate.c
>> +++ b/target-sparc/translate.c
>> @@ -58,6 +58,7 @@ static TCGv cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver;
>>   static TCGv_i32 cpu_softint;
>>   #else
>>   static TCGv cpu_wim;
>> +static TCGv cpu_asr17;
>>   #endif
>>   /* local register indexes (only used inside old micro ops) */
>>   static TCGv cpu_tmp0;
>> @@ -2049,6 +2050,8 @@ static void disas_sparc_insn(DisasContext * dc)
>>                  rs1 = GET_FIELD(insn, 13, 17);
>>                  switch(rs1) {
>>                  case 0: /* rdy */
>> +                    gen_movl_TN_reg(rd, cpu_y);
>> +                    break;
>>   #ifndef TARGET_SPARC64
>>                  case 0x01 ... 0x0e: /* undefined in the SPARCv8
>>                                         manual, rdy on the microSPARC
>> @@ -2058,6 +2061,11 @@ static void disas_sparc_insn(DisasContext * dc)
>>                  case 0x10 ... 0x1f: /* implementation-dependent in the
>>                                         SPARCv8 manual, rdy on the
>>                                         microSPARC II */
>> +
>> +                    if (rs1 == 0x11) { /* Read %asr17 */
>> +                        gen_movl_TN_reg(rd, cpu_asr17);
>
> Instead:
> r_const = tcg_const_tl(asr constants  | dc->def->nwindows - 1);
> gen_movl_TN_reg(rd, r_const);
> tcg_temp_free(r_const);

OK for me, if it is acceptable to have this Leon3's specific behavior 
for all the SPARC32 CPUs.

-- 
Fabien Chouteau

  reply	other threads:[~2010-12-07 11:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06  9:26 [Qemu-devel] [PATCH 0/6] [RFC] New SPARC machine: Leon3 Fabien Chouteau
2010-12-06  9:26 ` [Qemu-devel] [PATCH 1/6] [RFC] Emulation of GRLIB GPTimer as defined in GRLIB IP Core User's Manual Fabien Chouteau
2010-12-06  9:26   ` [Qemu-devel] [PATCH 2/6] [RFC] Emulation of GRLIB IRQMP " Fabien Chouteau
2010-12-06  9:26     ` [Qemu-devel] [PATCH 3/6] [RFC] Emulation of GRLIB APB UART " Fabien Chouteau
2010-12-06  9:26       ` [Qemu-devel] [PATCH 4/6] [RFC] Header file for the GRLIB components Fabien Chouteau
2010-12-06  9:26         ` [Qemu-devel] [PATCH 5/6] [RFC] Emulation of Leon3 Fabien Chouteau
2010-12-06  9:26           ` [Qemu-devel] [PATCH 6/6] [RFC] SPARCV8 asr17 register support Fabien Chouteau
2010-12-06 18:01             ` Blue Swirl
2010-12-07 11:51               ` Fabien Chouteau [this message]
2010-12-11  9:59                 ` Blue Swirl
2010-12-13 17:01                   ` Fabien Chouteau
2010-12-06 17:53           ` [Qemu-devel] [PATCH 5/6] [RFC] Emulation of Leon3 Blue Swirl
2010-12-07 11:40             ` Fabien Chouteau
2010-12-11  9:56               ` Blue Swirl
2010-12-13 15:51                 ` Fabien Chouteau
2010-12-13 18:18                   ` Blue Swirl
2010-12-15 17:47                     ` Fabien Chouteau
2010-12-17 19:14                       ` Blue Swirl
2010-12-20  6:46                         ` Edgar E. Iglesias
2010-12-20  9:40                           ` Fabien Chouteau
2010-12-20 20:09                             ` Blue Swirl
2010-12-20  9:25                         ` Fabien Chouteau
2010-12-20 19:27                           ` Blue Swirl
2010-12-12 14:41           ` Andreas Färber
2010-12-13 17:00             ` Fabien Chouteau
2010-12-06 17:31         ` [Qemu-devel] [PATCH 4/6] [RFC] Header file for the GRLIB components Blue Swirl
2010-12-07 11:04           ` Fabien Chouteau
2010-12-06 17:29       ` [Qemu-devel] [PATCH 3/6] [RFC] Emulation of GRLIB APB UART as defined in GRLIB IP Core User's Manual Blue Swirl
2010-12-07 10:55         ` Fabien Chouteau
2010-12-06 17:25     ` [Qemu-devel] [PATCH 2/6] [RFC] Emulation of GRLIB IRQMP " Blue Swirl
2010-12-07 10:43       ` Fabien Chouteau
2010-12-11 10:31         ` Blue Swirl
2010-12-13 16:23           ` Fabien Chouteau
2010-12-13 18:13             ` Blue Swirl
2010-12-09 10:32     ` Edgar E. Iglesias
2010-12-09 11:03       ` Fabien Chouteau
2010-12-09 11:06         ` Edgar E. Iglesias
2010-12-09 11:32           ` Fabien Chouteau
2010-12-06 17:12   ` [Qemu-devel] [PATCH 1/6] [RFC] Emulation of GRLIB GPTimer " Blue Swirl
2010-12-07  9:55     ` Fabien Chouteau
2010-12-08  8:30       ` Edgar E. Iglesias
2010-12-08  9:39         ` Fabien Chouteau
2010-12-08 21:02           ` Edgar E. Iglesias
2010-12-08 22:51   ` Edgar E. Iglesias
2010-12-09 10:04     ` Fabien Chouteau
2010-12-09 10:22       ` Edgar E. Iglesias
2010-12-06 10:44 ` [Qemu-devel] [PATCH 0/6] [RFC] New SPARC machine: Leon3 Artyom Tarasenko
2010-12-06 15:07   ` Fabien Chouteau
2010-12-06 18:12     ` Blue Swirl
2010-12-07 17:43       ` Fabien Chouteau
2010-12-06 18:05 ` Blue Swirl

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=4CFE1FCF.7000303@adacore.com \
    --to=chouteau@adacore.com \
    --cc=blauwirbel@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).