cregit-Linux how code gets into the kernel

Release 4.15 arch/s390/kernel/runtime_instr.c

Directory: arch/s390/kernel
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright IBM Corp. 2012
 * Author(s): Jan Glauber <jang@linux.vnet.ibm.com>
 */

#include <linux/kernel.h>
#include <linux/syscalls.h>
#include <linux/signal.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/kernel_stat.h>
#include <linux/sched/task_stack.h>

#include <asm/runtime_instr.h>
#include <asm/cpu_mf.h>
#include <asm/irq.h>

/* empty control block to disable RI by loading it */

struct runtime_instr_cb runtime_instr_empty_cb;


void runtime_instr_release(struct task_struct *tsk) { kfree(tsk->thread.ri_cb); }

Contributors

PersonTokensPropCommitsCommitProp
Heiko Carstens19100.00%1100.00%
Total19100.00%1100.00%


static void disable_runtime_instr(void) { struct task_struct *task = current; struct pt_regs *regs; if (!task->thread.ri_cb) return; regs = task_pt_regs(task); preempt_disable(); load_runtime_instr_cb(&runtime_instr_empty_cb); kfree(task->thread.ri_cb); task->thread.ri_cb = NULL; preempt_enable(); /* * Make sure the RI bit is deleted from the PSW. If the user did not * switch off RI before the system call the process will get a * specification exception otherwise. */ regs->psw.mask &= ~PSW_MASK_RI; }

Contributors

PersonTokensPropCommitsCommitProp
Heiko Carstens4559.21%150.00%
Jan Glauber3140.79%150.00%
Total76100.00%2100.00%


static void init_runtime_instr_cb(struct runtime_instr_cb *cb) { cb->rla = 0xfff; cb->s = 1; cb->k = 1; cb->ps = 1; cb->pc = 1; cb->key = PAGE_DEFAULT_KEY; cb->v = 1; }

Contributors

PersonTokensPropCommitsCommitProp
Jan Glauber4788.68%150.00%
Alice Frosi611.32%150.00%
Total53100.00%2100.00%

SYSCALL_DEFINE1(s390_runtime_instr, int, command) { struct runtime_instr_cb *cb; if (!test_facility(64)) return -EOPNOTSUPP; if (command == S390_RUNTIME_INSTR_STOP) { disable_runtime_instr(); 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; }

Overall Contributors

PersonTokensPropCommitsCommitProp
Jan Glauber24775.54%116.67%
Heiko Carstens6519.88%116.67%
Alice Frosi61.83%116.67%
Martin Schwidefsky51.53%116.67%
Ingo Molnar30.92%116.67%
Greg Kroah-Hartman10.31%116.67%
Total327100.00%6100.00%
Directory: arch/s390/kernel
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.