From 9dc6753718d4c0fe327729fea94e4d9f3f5a3d17 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Wed, 27 Jun 2018 15:44:08 +0200 Subject: s390x/tcg: implement SET CLOCK This allows a guest to change its TOD. We already take care of updating all CKC timers from within S390TODClass. Use MO_ALIGN to load the operand manually - this will properly trigger a SPECIFICATION exception. Acked-by: Thomas Huth Signed-off-by: David Hildenbrand Message-Id: <20180627134410.4901-8-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/misc_helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'target/s390x/misc_helper.c') diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index e4c1522140..7656a9b90a 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -184,6 +184,22 @@ void tcg_s390_tod_updated(CPUState *cs, run_on_cpu_data opaque) helper_sckc(env, env->ckc); } +/* Set Clock */ +uint32_t HELPER(sck)(CPUS390XState *env, uint64_t tod_low) +{ + S390TODState *td = s390_get_todstate(); + S390TODClass *tdc = S390_TOD_GET_CLASS(td); + S390TOD tod = { + .high = 0, + .low = tod_low, + }; + + qemu_mutex_lock_iothread(); + tdc->set(td, &tod, &error_abort); + qemu_mutex_unlock_iothread(); + return 0; +} + /* Set Tod Programmable Field */ void HELPER(sckpf)(CPUS390XState *env, uint64_t r0) { -- cgit v1.2.3