mirror of https://github.com/proxmox/mirror_qemu
s390x/tcg: MVST: Fault-safe handling
Access at most single pages and document why. Using the access helpers might over-indicate watchpoints within the same page, I guess we can live with that. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com>master
parent
6514f42bf8
commit
bb36ed88e9
|
@ -866,23 +866,33 @@ uint32_t HELPER(mvpg)(CPUS390XState *env, uint64_t r0, uint64_t r1, uint64_t r2)
|
||||||
/* string copy */
|
/* string copy */
|
||||||
uint32_t HELPER(mvst)(CPUS390XState *env, uint32_t r1, uint32_t r2)
|
uint32_t HELPER(mvst)(CPUS390XState *env, uint32_t r1, uint32_t r2)
|
||||||
{
|
{
|
||||||
|
const int mmu_idx = cpu_mmu_index(env, false);
|
||||||
const uint64_t d = get_address(env, r1);
|
const uint64_t d = get_address(env, r1);
|
||||||
const uint64_t s = get_address(env, r2);
|
const uint64_t s = get_address(env, r2);
|
||||||
const uint8_t c = env->regs[0];
|
const uint8_t c = env->regs[0];
|
||||||
|
const int len = MIN(-(d | TARGET_PAGE_MASK), -(s | TARGET_PAGE_MASK));
|
||||||
|
S390Access srca, desta;
|
||||||
uintptr_t ra = GETPC();
|
uintptr_t ra = GETPC();
|
||||||
uint32_t len;
|
int i;
|
||||||
|
|
||||||
if (env->regs[0] & 0xffffff00ull) {
|
if (env->regs[0] & 0xffffff00ull) {
|
||||||
s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, ra);
|
s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, ra);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lest we fail to service interrupts in a timely manner, limit the
|
/*
|
||||||
amount of work we're willing to do. For now, let's cap at 8k. */
|
* Our access should not exceed single pages, as we must not report access
|
||||||
for (len = 0; len < 0x2000; ++len) {
|
* exceptions exceeding the actually copied range (which we don't know at
|
||||||
uint8_t v = cpu_ldub_data_ra(env, s + len, ra);
|
* this point). We might over-indicate watchpoints within the pages
|
||||||
cpu_stb_data_ra(env, d + len, v, ra);
|
* (if we ever care, we have to limit processing to a single byte).
|
||||||
|
*/
|
||||||
|
srca = access_prepare(env, s, len, MMU_DATA_LOAD, mmu_idx, ra);
|
||||||
|
desta = access_prepare(env, d, len, MMU_DATA_STORE, mmu_idx, ra);
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
const uint8_t v = access_get_byte(env, &srca, i, ra);
|
||||||
|
|
||||||
|
access_set_byte(env, &desta, i, v, ra);
|
||||||
if (v == c) {
|
if (v == c) {
|
||||||
set_address_zero(env, r1, d + len);
|
set_address_zero(env, r1, d + i);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue