SYSCALL_DEFINE1(s390_runtime_instr, int, command) { struct runtime_instr_cb *cb; if (!test_facility(64)) return -EOPNOTSUPP; if (command == S390_RUNTIME_INSTR_STOP) { preempt_disable(); exit_thread_runtime_instr(); preempt_enable(); return 0; } if (command != S390_RUNTIME_INSTR_START) return -EINVAL; if (!current->thread.ri_cb) { cb = kzalloc(sizeof(*cb), GFP_KERNEL); if (!cb) return -ENOMEM; } else { cb = current->thread.ri_cb; memset(cb, 0, sizeof(*cb)); } init_runtime_instr_cb(cb); /* now load the control block to make it available */ preempt_disable(); current->thread.ri_cb = cb; load_runtime_instr_cb(cb); preempt_enable(); return 0; }
/* * Free current thread data structures etc.. */ void exit_thread(void) { exit_thread_runtime_instr(); }