]> Git Repo - qemu.git/blob - target/s390x/misc_helper.c
Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging
[qemu.git] / target / s390x / misc_helper.c
1 /*
2  *  S/390 misc helper routines
3  *
4  *  Copyright (c) 2009 Ulrich Hecht
5  *  Copyright (c) 2009 Alexander Graf
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #include "qemu/osdep.h"
22 #include "qemu/main-loop.h"
23 #include "cpu.h"
24 #include "exec/memory.h"
25 #include "qemu/host-utils.h"
26 #include "exec/helper-proto.h"
27 #include "sysemu/kvm.h"
28 #include "qemu/timer.h"
29 #include "qemu/main-loop.h"
30 #include "exec/address-spaces.h"
31 #ifdef CONFIG_KVM
32 #include <linux/kvm.h>
33 #endif
34 #include "exec/exec-all.h"
35 #include "exec/cpu_ldst.h"
36
37 #if !defined(CONFIG_USER_ONLY)
38 #include "hw/watchdog/wdt_diag288.h"
39 #include "sysemu/cpus.h"
40 #include "sysemu/sysemu.h"
41 #include "hw/s390x/ebcdic.h"
42 #include "hw/s390x/ipl.h"
43 #endif
44
45 /* #define DEBUG_HELPER */
46 #ifdef DEBUG_HELPER
47 #define HELPER_LOG(x...) qemu_log(x)
48 #else
49 #define HELPER_LOG(x...)
50 #endif
51
52 /* Raise an exception dynamically from a helper function.  */
53 void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp,
54                                      uintptr_t retaddr)
55 {
56     CPUState *cs = CPU(s390_env_get_cpu(env));
57     int t;
58
59     cs->exception_index = EXCP_PGM;
60     env->int_pgm_code = excp;
61
62     /* Use the (ultimate) callers address to find the insn that trapped.  */
63     cpu_restore_state(cs, retaddr);
64
65     /* Advance past the insn.  */
66     t = cpu_ldub_code(env, env->psw.addr);
67     env->int_pgm_ilen = t = get_ilen(t);
68     env->psw.addr += t;
69
70     cpu_loop_exit(cs);
71 }
72
73 /* Raise an exception statically from a TB.  */
74 void HELPER(exception)(CPUS390XState *env, uint32_t excp)
75 {
76     CPUState *cs = CPU(s390_env_get_cpu(env));
77
78     HELPER_LOG("%s: exception %d\n", __func__, excp);
79     cs->exception_index = excp;
80     cpu_loop_exit(cs);
81 }
82
83 #ifndef CONFIG_USER_ONLY
84
85 void program_interrupt(CPUS390XState *env, uint32_t code, int ilen)
86 {
87     S390CPU *cpu = s390_env_get_cpu(env);
88
89     qemu_log_mask(CPU_LOG_INT, "program interrupt at %#" PRIx64 "\n",
90                   env->psw.addr);
91
92     if (kvm_enabled()) {
93 #ifdef CONFIG_KVM
94         struct kvm_s390_irq irq = {
95             .type = KVM_S390_PROGRAM_INT,
96             .u.pgm.code = code,
97         };
98
99         kvm_s390_vcpu_interrupt(cpu, &irq);
100 #endif
101     } else {
102         CPUState *cs = CPU(cpu);
103
104         env->int_pgm_code = code;
105         env->int_pgm_ilen = ilen;
106         cs->exception_index = EXCP_PGM;
107         cpu_loop_exit(cs);
108     }
109 }
110
111 /* SCLP service call */
112 uint32_t HELPER(servc)(CPUS390XState *env, uint64_t r1, uint64_t r2)
113 {
114     qemu_mutex_lock_iothread();
115     int r = sclp_service_call(env, r1, r2);
116     if (r < 0) {
117         program_interrupt(env, -r, 4);
118         r = 0;
119     }
120     qemu_mutex_unlock_iothread();
121     return r;
122 }
123
124 #ifndef CONFIG_USER_ONLY
125 static int modified_clear_reset(S390CPU *cpu)
126 {
127     S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);
128     CPUState *t;
129
130     pause_all_vcpus();
131     cpu_synchronize_all_states();
132     CPU_FOREACH(t) {
133         run_on_cpu(t, s390_do_cpu_full_reset, RUN_ON_CPU_NULL);
134     }
135     s390_cmma_reset();
136     subsystem_reset();
137     s390_crypto_reset();
138     scc->load_normal(CPU(cpu));
139     cpu_synchronize_all_post_reset();
140     resume_all_vcpus();
141     return 0;
142 }
143
144 static int load_normal_reset(S390CPU *cpu)
145 {
146     S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);
147     CPUState *t;
148
149     pause_all_vcpus();
150     cpu_synchronize_all_states();
151     CPU_FOREACH(t) {
152         run_on_cpu(t, s390_do_cpu_reset, RUN_ON_CPU_NULL);
153     }
154     s390_cmma_reset();
155     subsystem_reset();
156     scc->initial_cpu_reset(CPU(cpu));
157     scc->load_normal(CPU(cpu));
158     cpu_synchronize_all_post_reset();
159     resume_all_vcpus();
160     return 0;
161 }
162
163 int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3)
164 {
165     uint64_t func = env->regs[r1];
166     uint64_t timeout = env->regs[r1 + 1];
167     uint64_t action = env->regs[r3];
168     Object *obj;
169     DIAG288State *diag288;
170     DIAG288Class *diag288_class;
171
172     if (r1 % 2 || action != 0) {
173         return -1;
174     }
175
176     /* Timeout must be more than 15 seconds except for timer deletion */
177     if (func != WDT_DIAG288_CANCEL && timeout < 15) {
178         return -1;
179     }
180
181     obj = object_resolve_path_type("", TYPE_WDT_DIAG288, NULL);
182     if (!obj) {
183         return -1;
184     }
185
186     diag288 = DIAG288(obj);
187     diag288_class = DIAG288_GET_CLASS(diag288);
188     return diag288_class->handle_timer(diag288, func, timeout);
189 }
190
191 #define DIAG_308_RC_OK              0x0001
192 #define DIAG_308_RC_NO_CONF         0x0102
193 #define DIAG_308_RC_INVALID         0x0402
194
195 void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3)
196 {
197     uint64_t addr =  env->regs[r1];
198     uint64_t subcode = env->regs[r3];
199     IplParameterBlock *iplb;
200
201     if (env->psw.mask & PSW_MASK_PSTATE) {
202         program_interrupt(env, PGM_PRIVILEGED, ILEN_LATER_INC);
203         return;
204     }
205
206     if ((subcode & ~0x0ffffULL) || (subcode > 6)) {
207         program_interrupt(env, PGM_SPECIFICATION, ILEN_LATER_INC);
208         return;
209     }
210
211     switch (subcode) {
212     case 0:
213         modified_clear_reset(s390_env_get_cpu(env));
214         if (tcg_enabled()) {
215             cpu_loop_exit(CPU(s390_env_get_cpu(env)));
216         }
217         break;
218     case 1:
219         load_normal_reset(s390_env_get_cpu(env));
220         if (tcg_enabled()) {
221             cpu_loop_exit(CPU(s390_env_get_cpu(env)));
222         }
223         break;
224     case 3:
225         s390_reipl_request();
226         if (tcg_enabled()) {
227             cpu_loop_exit(CPU(s390_env_get_cpu(env)));
228         }
229         break;
230     case 5:
231         if ((r1 & 1) || (addr & 0x0fffULL)) {
232             program_interrupt(env, PGM_SPECIFICATION, ILEN_LATER_INC);
233             return;
234         }
235         if (!address_space_access_valid(&address_space_memory, addr,
236                                         sizeof(IplParameterBlock), false)) {
237             program_interrupt(env, PGM_ADDRESSING, ILEN_LATER_INC);
238             return;
239         }
240         iplb = g_malloc0(sizeof(IplParameterBlock));
241         cpu_physical_memory_read(addr, iplb, sizeof(iplb->len));
242         if (!iplb_valid_len(iplb)) {
243             env->regs[r1 + 1] = DIAG_308_RC_INVALID;
244             goto out;
245         }
246
247         cpu_physical_memory_read(addr, iplb, be32_to_cpu(iplb->len));
248
249         if (!iplb_valid_ccw(iplb) && !iplb_valid_fcp(iplb)) {
250             env->regs[r1 + 1] = DIAG_308_RC_INVALID;
251             goto out;
252         }
253
254         s390_ipl_update_diag308(iplb);
255         env->regs[r1 + 1] = DIAG_308_RC_OK;
256 out:
257         g_free(iplb);
258         return;
259     case 6:
260         if ((r1 & 1) || (addr & 0x0fffULL)) {
261             program_interrupt(env, PGM_SPECIFICATION, ILEN_LATER_INC);
262             return;
263         }
264         if (!address_space_access_valid(&address_space_memory, addr,
265                                         sizeof(IplParameterBlock), true)) {
266             program_interrupt(env, PGM_ADDRESSING, ILEN_LATER_INC);
267             return;
268         }
269         iplb = s390_ipl_get_iplb();
270         if (iplb) {
271             cpu_physical_memory_write(addr, iplb, be32_to_cpu(iplb->len));
272             env->regs[r1 + 1] = DIAG_308_RC_OK;
273         } else {
274             env->regs[r1 + 1] = DIAG_308_RC_NO_CONF;
275         }
276         return;
277     default:
278         hw_error("Unhandled diag308 subcode %" PRIx64, subcode);
279         break;
280     }
281 }
282 #endif
283
284 void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num)
285 {
286     uint64_t r;
287
288     switch (num) {
289     case 0x500:
290         /* KVM hypercall */
291         r = s390_virtio_hypercall(env);
292         break;
293     case 0x44:
294         /* yield */
295         r = 0;
296         break;
297     case 0x308:
298         /* ipl */
299         handle_diag_308(env, r1, r3);
300         r = 0;
301         break;
302     default:
303         r = -1;
304         break;
305     }
306
307     if (r) {
308         program_interrupt(env, PGM_OPERATION, ILEN_LATER_INC);
309     }
310 }
311
312 /* Set Prefix */
313 void HELPER(spx)(CPUS390XState *env, uint64_t a1)
314 {
315     CPUState *cs = CPU(s390_env_get_cpu(env));
316     uint32_t prefix = a1 & 0x7fffe000;
317
318     env->psa = prefix;
319     HELPER_LOG("prefix: %#x\n", prefix);
320     tlb_flush_page(cs, 0);
321     tlb_flush_page(cs, TARGET_PAGE_SIZE);
322 }
323
324 /* Store Clock */
325 uint64_t HELPER(stck)(CPUS390XState *env)
326 {
327     uint64_t time;
328
329     time = env->tod_offset +
330         time2tod(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - env->tod_basetime);
331
332     return time;
333 }
334
335 /* Set Clock Comparator */
336 void HELPER(sckc)(CPUS390XState *env, uint64_t time)
337 {
338     if (time == -1ULL) {
339         return;
340     }
341
342     env->ckc = time;
343
344     /* difference between origins */
345     time -= env->tod_offset;
346
347     /* nanoseconds */
348     time = tod2time(time);
349
350     timer_mod(env->tod_timer, env->tod_basetime + time);
351 }
352
353 /* Store Clock Comparator */
354 uint64_t HELPER(stckc)(CPUS390XState *env)
355 {
356     return env->ckc;
357 }
358
359 /* Set CPU Timer */
360 void HELPER(spt)(CPUS390XState *env, uint64_t time)
361 {
362     if (time == -1ULL) {
363         return;
364     }
365
366     /* nanoseconds */
367     time = tod2time(time);
368
369     env->cputm = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + time;
370
371     timer_mod(env->cpu_timer, env->cputm);
372 }
373
374 /* Store CPU Timer */
375 uint64_t HELPER(stpt)(CPUS390XState *env)
376 {
377     return time2tod(env->cputm - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
378 }
379
380 /* Store System Information */
381 uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0,
382                       uint64_t r0, uint64_t r1)
383 {
384     int cc = 0;
385     int sel1, sel2;
386
387     if ((r0 & STSI_LEVEL_MASK) <= STSI_LEVEL_3 &&
388         ((r0 & STSI_R0_RESERVED_MASK) || (r1 & STSI_R1_RESERVED_MASK))) {
389         /* valid function code, invalid reserved bits */
390         program_interrupt(env, PGM_SPECIFICATION, 2);
391     }
392
393     sel1 = r0 & STSI_R0_SEL1_MASK;
394     sel2 = r1 & STSI_R1_SEL2_MASK;
395
396     /* XXX: spec exception if sysib is not 4k-aligned */
397
398     switch (r0 & STSI_LEVEL_MASK) {
399     case STSI_LEVEL_1:
400         if ((sel1 == 1) && (sel2 == 1)) {
401             /* Basic Machine Configuration */
402             struct sysib_111 sysib;
403
404             memset(&sysib, 0, sizeof(sysib));
405             ebcdic_put(sysib.manuf, "QEMU            ", 16);
406             /* same as machine type number in STORE CPU ID */
407             ebcdic_put(sysib.type, "QEMU", 4);
408             /* same as model number in STORE CPU ID */
409             ebcdic_put(sysib.model, "QEMU            ", 16);
410             ebcdic_put(sysib.sequence, "QEMU            ", 16);
411             ebcdic_put(sysib.plant, "QEMU", 4);
412             cpu_physical_memory_write(a0, &sysib, sizeof(sysib));
413         } else if ((sel1 == 2) && (sel2 == 1)) {
414             /* Basic Machine CPU */
415             struct sysib_121 sysib;
416
417             memset(&sysib, 0, sizeof(sysib));
418             /* XXX make different for different CPUs? */
419             ebcdic_put(sysib.sequence, "QEMUQEMUQEMUQEMU", 16);
420             ebcdic_put(sysib.plant, "QEMU", 4);
421             stw_p(&sysib.cpu_addr, env->cpu_num);
422             cpu_physical_memory_write(a0, &sysib, sizeof(sysib));
423         } else if ((sel1 == 2) && (sel2 == 2)) {
424             /* Basic Machine CPUs */
425             struct sysib_122 sysib;
426
427             memset(&sysib, 0, sizeof(sysib));
428             stl_p(&sysib.capability, 0x443afc29);
429             /* XXX change when SMP comes */
430             stw_p(&sysib.total_cpus, 1);
431             stw_p(&sysib.active_cpus, 1);
432             stw_p(&sysib.standby_cpus, 0);
433             stw_p(&sysib.reserved_cpus, 0);
434             cpu_physical_memory_write(a0, &sysib, sizeof(sysib));
435         } else {
436             cc = 3;
437         }
438         break;
439     case STSI_LEVEL_2:
440         {
441             if ((sel1 == 2) && (sel2 == 1)) {
442                 /* LPAR CPU */
443                 struct sysib_221 sysib;
444
445                 memset(&sysib, 0, sizeof(sysib));
446                 /* XXX make different for different CPUs? */
447                 ebcdic_put(sysib.sequence, "QEMUQEMUQEMUQEMU", 16);
448                 ebcdic_put(sysib.plant, "QEMU", 4);
449                 stw_p(&sysib.cpu_addr, env->cpu_num);
450                 stw_p(&sysib.cpu_id, 0);
451                 cpu_physical_memory_write(a0, &sysib, sizeof(sysib));
452             } else if ((sel1 == 2) && (sel2 == 2)) {
453                 /* LPAR CPUs */
454                 struct sysib_222 sysib;
455
456                 memset(&sysib, 0, sizeof(sysib));
457                 stw_p(&sysib.lpar_num, 0);
458                 sysib.lcpuc = 0;
459                 /* XXX change when SMP comes */
460                 stw_p(&sysib.total_cpus, 1);
461                 stw_p(&sysib.conf_cpus, 1);
462                 stw_p(&sysib.standby_cpus, 0);
463                 stw_p(&sysib.reserved_cpus, 0);
464                 ebcdic_put(sysib.name, "QEMU    ", 8);
465                 stl_p(&sysib.caf, 1000);
466                 stw_p(&sysib.dedicated_cpus, 0);
467                 stw_p(&sysib.shared_cpus, 0);
468                 cpu_physical_memory_write(a0, &sysib, sizeof(sysib));
469             } else {
470                 cc = 3;
471             }
472             break;
473         }
474     case STSI_LEVEL_3:
475         {
476             if ((sel1 == 2) && (sel2 == 2)) {
477                 /* VM CPUs */
478                 struct sysib_322 sysib;
479
480                 memset(&sysib, 0, sizeof(sysib));
481                 sysib.count = 1;
482                 /* XXX change when SMP comes */
483                 stw_p(&sysib.vm[0].total_cpus, 1);
484                 stw_p(&sysib.vm[0].conf_cpus, 1);
485                 stw_p(&sysib.vm[0].standby_cpus, 0);
486                 stw_p(&sysib.vm[0].reserved_cpus, 0);
487                 ebcdic_put(sysib.vm[0].name, "KVMguest", 8);
488                 stl_p(&sysib.vm[0].caf, 1000);
489                 ebcdic_put(sysib.vm[0].cpi, "KVM/Linux       ", 16);
490                 cpu_physical_memory_write(a0, &sysib, sizeof(sysib));
491             } else {
492                 cc = 3;
493             }
494             break;
495         }
496     case STSI_LEVEL_CURRENT:
497         env->regs[0] = STSI_LEVEL_3;
498         break;
499     default:
500         cc = 3;
501         break;
502     }
503
504     return cc;
505 }
506
507 uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1,
508                       uint64_t cpu_addr)
509 {
510     int cc = SIGP_CC_ORDER_CODE_ACCEPTED;
511
512     HELPER_LOG("%s: %016" PRIx64 " %08x %016" PRIx64 "\n",
513                __func__, order_code, r1, cpu_addr);
514
515     /* Remember: Use "R1 or R1 + 1, whichever is the odd-numbered register"
516        as parameter (input). Status (output) is always R1. */
517
518     switch (order_code) {
519     case SIGP_SET_ARCH:
520         /* switch arch */
521         break;
522     case SIGP_SENSE:
523         /* enumerate CPU status */
524         if (cpu_addr) {
525             /* XXX implement when SMP comes */
526             return 3;
527         }
528         env->regs[r1] &= 0xffffffff00000000ULL;
529         cc = 1;
530         break;
531 #if !defined(CONFIG_USER_ONLY)
532     case SIGP_RESTART:
533         qemu_system_reset_request();
534         cpu_loop_exit(CPU(s390_env_get_cpu(env)));
535         break;
536     case SIGP_STOP:
537         qemu_system_shutdown_request();
538         cpu_loop_exit(CPU(s390_env_get_cpu(env)));
539         break;
540 #endif
541     default:
542         /* unknown sigp */
543         fprintf(stderr, "XXX unknown sigp: 0x%" PRIx64 "\n", order_code);
544         cc = SIGP_CC_NOT_OPERATIONAL;
545     }
546
547     return cc;
548 }
549 #endif
550
551 #ifndef CONFIG_USER_ONLY
552 void HELPER(xsch)(CPUS390XState *env, uint64_t r1)
553 {
554     S390CPU *cpu = s390_env_get_cpu(env);
555     qemu_mutex_lock_iothread();
556     ioinst_handle_xsch(cpu, r1);
557     qemu_mutex_unlock_iothread();
558 }
559
560 void HELPER(csch)(CPUS390XState *env, uint64_t r1)
561 {
562     S390CPU *cpu = s390_env_get_cpu(env);
563     qemu_mutex_lock_iothread();
564     ioinst_handle_csch(cpu, r1);
565     qemu_mutex_unlock_iothread();
566 }
567
568 void HELPER(hsch)(CPUS390XState *env, uint64_t r1)
569 {
570     S390CPU *cpu = s390_env_get_cpu(env);
571     qemu_mutex_lock_iothread();
572     ioinst_handle_hsch(cpu, r1);
573     qemu_mutex_unlock_iothread();
574 }
575
576 void HELPER(msch)(CPUS390XState *env, uint64_t r1, uint64_t inst)
577 {
578     S390CPU *cpu = s390_env_get_cpu(env);
579     qemu_mutex_lock_iothread();
580     ioinst_handle_msch(cpu, r1, inst >> 16);
581     qemu_mutex_unlock_iothread();
582 }
583
584 void HELPER(rchp)(CPUS390XState *env, uint64_t r1)
585 {
586     S390CPU *cpu = s390_env_get_cpu(env);
587     qemu_mutex_lock_iothread();
588     ioinst_handle_rchp(cpu, r1);
589     qemu_mutex_unlock_iothread();
590 }
591
592 void HELPER(rsch)(CPUS390XState *env, uint64_t r1)
593 {
594     S390CPU *cpu = s390_env_get_cpu(env);
595     qemu_mutex_lock_iothread();
596     ioinst_handle_rsch(cpu, r1);
597     qemu_mutex_unlock_iothread();
598 }
599
600 void HELPER(ssch)(CPUS390XState *env, uint64_t r1, uint64_t inst)
601 {
602     S390CPU *cpu = s390_env_get_cpu(env);
603     qemu_mutex_lock_iothread();
604     ioinst_handle_ssch(cpu, r1, inst >> 16);
605     qemu_mutex_unlock_iothread();
606 }
607
608 void HELPER(stsch)(CPUS390XState *env, uint64_t r1, uint64_t inst)
609 {
610     S390CPU *cpu = s390_env_get_cpu(env);
611     qemu_mutex_lock_iothread();
612     ioinst_handle_stsch(cpu, r1, inst >> 16);
613     qemu_mutex_unlock_iothread();
614 }
615
616 void HELPER(tsch)(CPUS390XState *env, uint64_t r1, uint64_t inst)
617 {
618     S390CPU *cpu = s390_env_get_cpu(env);
619     qemu_mutex_lock_iothread();
620     ioinst_handle_tsch(cpu, r1, inst >> 16);
621     qemu_mutex_unlock_iothread();
622 }
623
624 void HELPER(chsc)(CPUS390XState *env, uint64_t inst)
625 {
626     S390CPU *cpu = s390_env_get_cpu(env);
627     qemu_mutex_lock_iothread();
628     ioinst_handle_chsc(cpu, inst >> 16);
629     qemu_mutex_unlock_iothread();
630 }
631 #endif
632
633 #ifndef CONFIG_USER_ONLY
634 void HELPER(per_check_exception)(CPUS390XState *env)
635 {
636     CPUState *cs = CPU(s390_env_get_cpu(env));
637
638     if (env->per_perc_atmid) {
639         env->int_pgm_code = PGM_PER;
640         env->int_pgm_ilen = get_ilen(cpu_ldub_code(env, env->per_address));
641
642         cs->exception_index = EXCP_PGM;
643         cpu_loop_exit(cs);
644     }
645 }
646
647 void HELPER(per_branch)(CPUS390XState *env, uint64_t from, uint64_t to)
648 {
649     if ((env->cregs[9] & PER_CR9_EVENT_BRANCH)) {
650         if (!(env->cregs[9] & PER_CR9_CONTROL_BRANCH_ADDRESS)
651             || get_per_in_range(env, to)) {
652             env->per_address = from;
653             env->per_perc_atmid = PER_CODE_EVENT_BRANCH | get_per_atmid(env);
654         }
655     }
656 }
657
658 void HELPER(per_ifetch)(CPUS390XState *env, uint64_t addr)
659 {
660     if ((env->cregs[9] & PER_CR9_EVENT_IFETCH) && get_per_in_range(env, addr)) {
661         env->per_address = addr;
662         env->per_perc_atmid = PER_CODE_EVENT_IFETCH | get_per_atmid(env);
663
664         /* If the instruction has to be nullified, trigger the
665            exception immediately. */
666         if (env->cregs[9] & PER_CR9_EVENT_NULLIFICATION) {
667             CPUState *cs = CPU(s390_env_get_cpu(env));
668
669             env->int_pgm_code = PGM_PER;
670             env->int_pgm_ilen = get_ilen(cpu_ldub_code(env, addr));
671
672             cs->exception_index = EXCP_PGM;
673             cpu_loop_exit(cs);
674         }
675     }
676 }
677 #endif
This page took 0.061672 seconds and 4 git commands to generate.