2 * (C) Copyright 2007-2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
13 static int handle_noop(struct virt_sys
*sys
)
18 static int handle_program(struct virt_sys
*sys
)
20 con_printf(sys
->con
, "INTRCPT: PROG\n");
21 sys
->cpu
->state
= GUEST_STOPPED
;
25 static int handle_instruction_and_program(struct virt_sys
*sys
)
27 con_printf(sys
->con
, "INTRCPT: INST+PROG\n");
28 sys
->cpu
->state
= GUEST_STOPPED
;
32 static int handle_ext_req(struct virt_sys
*sys
)
34 con_printf(sys
->con
, "INTRCPT: EXT REQ\n");
35 sys
->cpu
->state
= GUEST_STOPPED
;
39 static int handle_ext_int(struct virt_sys
*sys
)
41 con_printf(sys
->con
, "INTRCPT: EXT INT\n");
42 sys
->cpu
->state
= GUEST_STOPPED
;
46 static int handle_io_req(struct virt_sys
*sys
)
48 con_printf(sys
->con
, "INTRCPT: IO REQ\n");
49 sys
->cpu
->state
= GUEST_STOPPED
;
53 static int handle_wait(struct virt_sys
*sys
)
55 con_printf(sys
->con
, "INTRCPT: WAIT\n");
59 static int handle_validity(struct virt_sys
*sys
)
61 con_printf(sys
->con
, "INTRCPT: VALIDITY\n");
62 sys
->cpu
->state
= GUEST_STOPPED
;
66 static int handle_stop(struct virt_sys
*sys
)
68 atomic_clear_mask(CPUSTAT_STOP_INT
, &sys
->cpu
->sie_cb
.cpuflags
);
72 static int handle_oper_except(struct virt_sys
*sys
)
74 con_printf(sys
->con
, "INTRCPT: OPER EXCEPT\n");
75 sys
->cpu
->state
= GUEST_STOPPED
;
79 static int handle_exp_run(struct virt_sys
*sys
)
81 con_printf(sys
->con
, "INTRCPT: EXP RUN\n");
82 sys
->cpu
->state
= GUEST_STOPPED
;
86 static int handle_exp_timer(struct virt_sys
*sys
)
88 con_printf(sys
->con
, "INTRCPT: EXP TIMER\n");
89 sys
->cpu
->state
= GUEST_STOPPED
;
93 static const intercept_handler_t intercept_funcs
[0x4c >> 2] = {
94 [0x00 >> 2] = handle_noop
,
95 [0x04 >> 2] = handle_instruction
,
96 [0x08 >> 2] = handle_program
,
97 [0x0c >> 2] = handle_instruction_and_program
,
98 [0x10 >> 2] = handle_ext_req
,
99 [0x14 >> 2] = handle_ext_int
,
100 [0x18 >> 2] = handle_io_req
,
101 [0x1c >> 2] = handle_wait
,
102 [0x20 >> 2] = handle_validity
,
103 [0x28 >> 2] = handle_stop
,
104 [0x2c >> 2] = handle_oper_except
,
105 [0x44 >> 2] = handle_exp_run
,
106 [0x48 >> 2] = handle_exp_timer
,
109 void handle_interception(struct virt_sys
*sys
)
111 struct virt_cpu
*cpu
= sys
->cpu
;
112 intercept_handler_t h
;
115 h
= intercept_funcs
[cpu
->sie_cb
.icptcode
>> 2];
120 cpu
->state
= GUEST_STOPPED
;
121 con_printf(sys
->con
, "Unknown/mis-handled intercept code %02x, err = %d\n",
122 cpu
->sie_cb
.icptcode
, err
);