[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v2 03/11] target/ppc: support for 32-bit carry and
From: |
Nikunj A Dadhania |
Subject: |
Re: [Qemu-ppc] [PATCH v2 03/11] target/ppc: support for 32-bit carry and overflow |
Date: |
Wed, 22 Feb 2017 16:25:45 +0530 |
User-agent: |
Notmuch/0.21 (https://notmuchmail.org) Emacs/25.0.94.1 (x86_64-redhat-linux-gnu) |
Richard Henderson <address@hidden> writes:
> On 02/22/2017 08:29 PM, Nikunj A Dadhania wrote:
>> target_ulong cpu_read_xer(CPUPPCState *env)
>> {
>> - return env->xer | (env->so << XER_SO) | (env->ov << XER_OV) |
>> + target_ulong xer;
>> +
>> + xer = env->xer | (env->so << XER_SO) | (env->ov << XER_OV) |
>> (env->ca << XER_CA);
>> +
>> + if (is_isa300(env)) {
>> + xer |= (env->ov32 << XER_OV32) | (env->ca32 << XER_CA32);
>> + }
>> + return xer;
>> }
>>
>> void cpu_write_xer(CPUPPCState *env, target_ulong xer)
>> @@ -32,5 +39,13 @@ void cpu_write_xer(CPUPPCState *env, target_ulong xer)
>> env->so = (xer >> XER_SO) & 1;
>> env->ov = (xer >> XER_OV) & 1;
>> env->ca = (xer >> XER_CA) & 1;
>> - env->xer = xer & ~((1u << XER_SO) | (1u << XER_OV) | (1u << XER_CA));
>> + if (is_isa300(env)) {
>> + env->ov32 = (xer >> XER_OV32) & 1;
>> + env->ca32 = (xer >> XER_CA32) & 1;
>> + env->xer = xer & ~((1ul << XER_SO) |
>> + (1ul << XER_OV) | (1ul << XER_CA) |
>> + (1ul << XER_OV32) | (1ul << XER_CA32));
>> + } else {
>> + env->xer = xer & ~((1u << XER_SO) | (1u << XER_OV) | (1u <<
>> XER_CA));
>> + }
>> }
>
> Do cpus before power9 really save all of the bits you write to it?
> I.e. if you write -1 to XER, do you read -1 back?
I did a quick test on power8, and it doesn't read back -1 after a write(-1).
int main(void)
{
long res;
asm volatile ("mtxer %1; mfxer %0;" : "=r"(res) : "r"(-1));
printf("xer %lx\n", res);
}
$ ./a.out
xer e00fffff
$
> If so, then I suppose I'll have to revise my previous advice; there's no
> point
> in NOT storing bit 19 in env->ov32, because we can always read it back out.
Regards
Nikunj
- [Qemu-ppc] [PATCH v2 00/11] POWER9 TCG enablements - part15, Nikunj A Dadhania, 2017/02/22
- [Qemu-ppc] [PATCH v2 01/11] target/ppc: move cpu_[read, write]_xer to cpu.c, Nikunj A Dadhania, 2017/02/22
- [Qemu-ppc] [PATCH v2 03/11] target/ppc: support for 32-bit carry and overflow, Nikunj A Dadhania, 2017/02/22
- [Qemu-ppc] [PATCH v2 02/11] target/ppc: optimize gen_write_xer(), Nikunj A Dadhania, 2017/02/22
- [Qemu-ppc] [PATCH v2 04/11] target/ppc: update ca32 in arithmetic add, Nikunj A Dadhania, 2017/02/22
- [Qemu-ppc] [PATCH v2 07/11] target/ppc: use tcg ops for neg instruction, Nikunj A Dadhania, 2017/02/22
- [Qemu-ppc] [PATCH v2 06/11] target/ppc: update overflow flags for add/sub, Nikunj A Dadhania, 2017/02/22