@@ -173,6 +173,8 @@ struct cpuid {
uint64_t reserved : 15;
};
+#define SVC_LEAVE_PSTATE 1
+
static inline unsigned short stap(void)
{
unsigned short cpu_address;
@@ -276,6 +278,11 @@ static inline void enter_pstate(void)
load_psw_mask(mask);
}
+static inline void leave_pstate(void)
+{
+ asm volatile(" svc %0\n" : : "i" (SVC_LEAVE_PSTATE));
+}
+
static inline int stsi(void *addr, int fc, int sel1, int sel2)
{
register int r0 asm("0") = (fc << 28) | sel1;
@@ -188,6 +188,14 @@ int unregister_io_int_func(void (*f)(void))
void handle_svc_int(void)
{
- report_abort("Unexpected supervisor call interrupt: on cpu %d at %#lx",
- stap(), lc->svc_old_psw.addr);
+ uint16_t code = lc->svc_int_code;
+
+ switch (code) {
+ case SVC_LEAVE_PSTATE:
+ lc->svc_old_psw.mask &= ~PSW_MASK_PSTATE;
+ break;
+ default:
+ report_abort("Unexpected supervisor call interrupt: code %#x on cpu %d at %#lx",
+ code, stap(), lc->svc_old_psw.addr);
+ }
}