On 26.02.2017 19:57, Michal Marek wrote: > Dne 26.2.2017 v 12:22 Thomas Huth napsal(a): >> On 26.02.2017 00:38, Michal Marek wrote: >>> The implementation is partially cargo cult based, but it works for the >>> linux kernel use case. >>> >>> Signed-off-by: Michal Marek <mma...@suse.com> >>> --- >>> v3: >>> - Initialize the buffer in do_stfle() >>> v2: >>> - STFLE is not a privileged instruction, go through the MMU to store the >>> result >>> - annotate the stfl helper with TCG_CALL_NO_RWG >>> - Use a large enough buffer to hold the feature bitmap >>> - Fix coding style of the stfle helper >>> --- >>> target/s390x/cpu_features.c | 6 ++++-- >>> target/s390x/cpu_features.h | 2 +- >>> target/s390x/helper.h | 2 ++ >>> target/s390x/insn-data.def | 2 ++ >>> target/s390x/misc_helper.c | 36 ++++++++++++++++++++++++++++++++++++ >>> target/s390x/translate.c | 17 +++++++++-------- >>> 6 files changed, 54 insertions(+), 11 deletions(-) [...] >>> +uint64_t HELPER(stfle)(CPUS390XState *env, uint64_t a0, uint64_t r0) >>> +{ >>> + int need, len = r0 & 0xff; >> >> According to the POP spec, the address "must be designated on a >> doubleword boundary; otherwise, a specification exception is recognized." >> Could you please add this check here (or in translate.c)? > > Dumb question, but how do I signal a specification exception? > s390_cpu_do_interrupt() does not seem to be prepared for it.
Not sure, but I think something like program_interrupt(env, PGM_SPECIFICATION, 4); should do the job here. Thomas