From: Leon Alrae <leon.alrae@imgtec.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PULL 1/2] target-mips: replace cpu_save/cpu_load with VMStateDescription
Date: Wed, 22 Jul 2015 15:03:13 +0100 [thread overview]
Message-ID: <55AFA2A1.7090408@imgtec.com> (raw)
In-Reply-To: <CAFEAcA8Emh7HQEHks-+7N1UXt=sh8UBg28K9ekm5C8pJbJsfVQ@mail.gmail.com>
On 22/07/2015 13:08, Peter Maydell wrote:
> On 11 March 2015 at 16:15, Leon Alrae <leon.alrae@imgtec.com> wrote:
>> Create VMStateDescription for MIPS CPU. The new structure contains exactly the
>> same fields as before, therefore leaving existing version_id.
>>
>> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
>
> Hi. I've just noticed that this commit has a bug, which provokes
> a warning on FreeBSD:
>
> target-mips/machine.c:171:20: warning: incompatible pointer types
> passing 'uint_fast8_t *' (aka 'unsigned int *') to parameter of
> type 'const uint8_t *' (ake 'const unsigned char *')
> [-Wincompatible-pointer-types]
> qemu_put_8s(f, &v->ASID);
> ^~~~~~~~
>
> This is because in the old code:
>
>
>> - /* Save TLB */
>> - qemu_put_be32s(f, &env->tlb->nb_tlb);
>> - qemu_put_be32s(f, &env->tlb->tlb_in_use);
>> - for(i = 0; i < MIPS_TLB_MAX; i++) {
>> - uint16_t flags = ((env->tlb->mmu.r4k.tlb[i].EHINV << 15) |
>> - (env->tlb->mmu.r4k.tlb[i].RI1 << 14) |
>> - (env->tlb->mmu.r4k.tlb[i].RI0 << 13) |
>> - (env->tlb->mmu.r4k.tlb[i].XI1 << 12) |
>> - (env->tlb->mmu.r4k.tlb[i].XI0 << 11) |
>> - (env->tlb->mmu.r4k.tlb[i].G << 10) |
>> - (env->tlb->mmu.r4k.tlb[i].C0 << 7) |
>> - (env->tlb->mmu.r4k.tlb[i].C1 << 4) |
>> - (env->tlb->mmu.r4k.tlb[i].V0 << 3) |
>> - (env->tlb->mmu.r4k.tlb[i].V1 << 2) |
>> - (env->tlb->mmu.r4k.tlb[i].D0 << 1) |
>> - (env->tlb->mmu.r4k.tlb[i].D1 << 0));
>> - uint8_t asid;
>> -
>> - qemu_put_betls(f, &env->tlb->mmu.r4k.tlb[i].VPN);
>> - qemu_put_be32s(f, &env->tlb->mmu.r4k.tlb[i].PageMask);
>> - asid = env->tlb->mmu.r4k.tlb[i].ASID;
>> - qemu_put_8s(f, &asid);
>
> we copied the asid to a local variable of the right size
> to pass the address to qemu_put_8s()...
>
>> + uint16_t flags = ((v->EHINV << 15) |
>> + (v->RI1 << 14) |
>> + (v->RI0 << 13) |
>> + (v->XI1 << 12) |
>> + (v->XI0 << 11) |
>> + (v->G << 10) |
>> + (v->C0 << 7) |
>> + (v->C1 << 4) |
>> + (v->V0 << 3) |
>> + (v->V1 << 2) |
>> + (v->D0 << 1) |
>> + (v->D1 << 0));
>> +
>> + qemu_put_betls(f, &v->VPN);
>> + qemu_put_be32s(f, &v->PageMask);
>> + qemu_put_8s(f, &v->ASID);
>
> ...but in the new code we just directly use the
> address in the struct, which won't work because it has
> a (potentially) incompatible type.
I've just posted the patch correcting this.
Thanks,
Leon
next prev parent reply other threads:[~2015-07-22 14:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-11 16:15 [Qemu-devel] [PULL 0/2] target-mips queue Leon Alrae
2015-03-11 16:15 ` [Qemu-devel] [PULL 1/2] target-mips: replace cpu_save/cpu_load with VMStateDescription Leon Alrae
2015-07-22 12:08 ` Peter Maydell
2015-07-22 14:03 ` Leon Alrae [this message]
2015-03-11 16:15 ` [Qemu-devel] [PULL 2/2] target-mips: add missing MSACSR and restore fp_status and hflags Leon Alrae
2015-03-12 9:12 ` [Qemu-devel] [PULL 0/2] target-mips queue 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=55AFA2A1.7090408@imgtec.com \
--to=leon.alrae@imgtec.com \
--cc=peter.maydell@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.