qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] SH: Fix movca.l/ocbi emulation.


From: Vladimir Prus
Subject: [Qemu-devel] SH: Fix movca.l/ocbi emulation.
Date: Thu, 11 Dec 2008 21:34:30 +0300
User-agent: KMail/1.9.10

This patch fixes the emulation of movca.l and ocbi
instructions. movca.l is documented to allocate a cache
like, and write into it. ocbi invalidates a cache line.
So, given code like:

                        asm volatile("movca.l r0, @%0\n\t"
                             "movca.l r0, @%1\n\t"
                             "ocbi @%0\n\t"
                             "ocbi @%1" : :
                             "r" (a0), "r" (a1));

Nothing is actually written to memory. Code like this can be
found in arch/sh/mm/cache-sh4.c and is used to flush the cache.

Current QEMU implements movca.l the same way as ordinary move,
and the code above just corrupts memory. Doing full cache emulation
is out of question, so this patch implements a hack. Stores
done by movca.l are delayed. If we execute an instructions that is
neither movca.l nor ocbi, we flush all pending stores. If we execute
ocbi, we look at pending stores and delete a store to the invalidated
address. This appears to work fairly well in practice.

- Volodya

Attachment: 0004-Fix-movcal.l-ocbi-emulation.patch
Description: Text Data


reply via email to

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