On 23/03/19 20:09, Richard Henderson wrote:
> Amusingly, we had already ignored the comment to keep this
> value at the end of CPUState.  This restores the minimum
> negative offset from TCG_AREG0 for code generation.
> 
> This is slightly complicated for qom/cpu.c and tcg-all.c,
> in that they are compiled once.  This means we need an out
> of line helper to access the icount_decr value.
> 
> Cc: Paolo Bonzini <pbonz...@redhat.com>
> Cc: Andreas Färber <afaer...@suse.de>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> ---
> 
> RFC: I had problems with the build system moving qom/cpu.c
> from common-obj-y to obj-y.  Then I tried just splitting out
> a piece of it, and ran into odder build system issues.  Then
> I hacked Makefile.target in a way that doesn't look right,
> but works.
> 
> Question: Should I bother splitting qom/cpu.c at all?  Just
> move the whole thing to obj-y (with non-broken build changes,
> obviously, whatever that might be).

I think you should, because moving it to obj-y would be a major headache
if we ever were to resurrect the multiarch patches by Peter C.

That said, does cpu_neg really need env_neg and thus ArchCPU?  Perhaps
you could:

1) define CPUTLB in terms of MAX_MMU_MODES (12) instead of NB_MMU_MODES

2) assert that

   offsetof(ArchCPU, env) - offsetof(ArchCPU, neg) ==
      sizeof(CPUNegativeOffsetState)

3) use this in cpu_neg to go from cpu->env_ptr to the
CPUNegativeOffsetState.

This lets you implement cpu_neg in a target-independent manner.

Paolo

Reply via email to