qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/19] target/ppc: add exclusive user write function for PMU


From: Richard Henderson
Subject: Re: [PATCH 03/19] target/ppc: add exclusive user write function for PMU regs
Date: Tue, 10 Aug 2021 14:05:39 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 8/9/21 5:29 PM, David Gibson wrote:
      ctx->spr_cb = env->spr_cb;
+    ctx->spr = env->spr;

Eep... with that one line you're copying 8kiB of data into the context
structure.  That sounds undesirable.. especially since it look like
you only check 8 bytes of it.

Plus.. TBH, I'm a bit fuzzy on how the disascontext stuff works, but
I'm not sure copying the stuff here is correct.

It isn't.

I think instead you need to actually generate the instructions to read
from MMCR0 and conditionally generate an exception if the permission
bit isn't set.

Or copy exactly the bits you need from MMCR0 for the permission check into env->hflags, so that you can later read them from ctx->flags. Bearing in mind that hflags has only 32 bits, 19 of them are currently in use.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]