cregit-Linux how code gets into the kernel

Release 4.14 arch/s390/kernel/process.c

Directory: arch/s390/kernel
// SPDX-License-Identifier: GPL-2.0
/*
 * This file handles the architecture dependent parts of process handling.
 *
 *    Copyright IBM Corp. 1999, 2009
 *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
 *               Hartmut Penner <hp@de.ibm.com>,
 *               Denis Joseph Barrow,
 */

#include <linux/elf-randomize.h>
#include <linux/compiler.h>
#include <linux/cpu.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
#include <linux/sched/task.h>
#include <linux/sched/task_stack.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/elfcore.h>
#include <linux/smp.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/tick.h>
#include <linux/personality.h>
#include <linux/syscalls.h>
#include <linux/compat.h>
#include <linux/kprobes.h>
#include <linux/random.h>
#include <linux/export.h>
#include <linux/init_task.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/vtimer.h>
#include <asm/exec.h>
#include <asm/irq.h>
#include <asm/nmi.h>
#include <asm/smp.h>
#include <asm/switch_to.h>
#include <asm/runtime_instr.h>
#include "entry.h"

asmlinkage void ret_from_fork(void) asm ("ret_from_fork");

extern void kernel_thread_starter(void);

/*
 * Free current thread data structures etc..
 */

void exit_thread(struct task_struct *tsk) { if (tsk == current) { exit_thread_runtime_instr(); exit_thread_gs(); } }

Contributors

PersonTokensPropCommitsCommitProp
Jiri Slaby1041.67%125.00%
Jan Glauber520.83%125.00%
Martin Schwidefsky520.83%125.00%
Linus Torvalds (pre-git)416.67%125.00%
Total24100.00%4100.00%


void flush_thread(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)583.33%150.00%
Martin Schwidefsky116.67%150.00%
Total6100.00%2100.00%


void release_thread(struct task_struct *dead_task) { }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)9100.00%1100.00%
Total9100.00%1100.00%


void arch_release_task_struct(struct task_struct *tsk) { }

Contributors

PersonTokensPropCommitsCommitProp
Hendrik Brueckner888.89%150.00%
Martin Schwidefsky111.11%150.00%
Total9100.00%2100.00%


int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) { /* * Save the floating-point or vector register state of the current * task and set the CIF_FPU flag to lazy restore the FPU register * state when returning to user space. */ save_fpu_regs(); memcpy(dst, src, arch_task_struct_size); dst->thread.fpu.regs = dst->thread.fpu.fprs; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Hendrik Brueckner3982.98%480.00%
Martin Schwidefsky817.02%120.00%
Total47100.00%5100.00%


int copy_thread_tls(unsigned long clone_flags, unsigned long new_stackp, unsigned long arg, struct task_struct *p, unsigned long tls) { struct fake_frame { struct stack_frame sf; struct pt_regs childregs; } *frame; frame = container_of(task_pt_regs(p), struct fake_frame, childregs); p->thread.ksp = (unsigned long) frame; /* Save access registers to new thread structure. */ save_access_regs(&p->thread.acrs[0]); /* start new process with ar4 pointing to the correct address space */ p->thread.mm_segment = get_fs(); /* Don't copy debug registers */ memset(&p->thread.per_user, 0, sizeof(p->thread.per_user)); memset(&p->thread.per_event, 0, sizeof(p->thread.per_event)); clear_tsk_thread_flag(p, TIF_SINGLE_STEP); /* Initialize per thread user and system timer values */ p->thread.user_timer = 0; p->thread.guest_timer = 0; p->thread.system_timer = 0; p->thread.hardirq_timer = 0; p->thread.softirq_timer = 0; frame->sf.back_chain = 0; /* new return point is ret_from_fork */ frame->sf.gprs[8] = (unsigned long) ret_from_fork; /* fake return stack for resume(), don't go back to schedule */ frame->sf.gprs[9] = (unsigned long) frame; /* Store access registers to kernel stack of new process. */ if (unlikely(p->flags & PF_KTHREAD)) { /* kernel thread */ memset(&frame->childregs, 0, sizeof(struct pt_regs)); frame->childregs.psw.mask = PSW_KERNEL_BITS | PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; frame->childregs.psw.addr = (unsigned long) kernel_thread_starter; frame->childregs.gprs[9] = new_stackp; /* function */ frame->childregs.gprs[10] = arg; frame->childregs.gprs[11] = (unsigned long) do_exit; frame->childregs.orig_gpr2 = -1; return 0; } frame->childregs = *current_pt_regs(); frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */ frame->childregs.flags = 0; if (new_stackp) frame->childregs.gprs[15] = new_stackp; /* Don't copy runtime instrumentation info */ p->thread.ri_cb = NULL; frame->childregs.psw.mask &= ~PSW_MASK_RI; /* Don't copy guarded storage control block */ p->thread.gs_cb = NULL; p->thread.gs_bc_cb = NULL; /* Set a new TLS ? */ if (clone_flags & CLONE_SETTLS) { if (is_compat_task()) { p->thread.acrs[0] = (unsigned int)tls; } else { p->thread.acrs[0] = (unsigned int)(tls >> 32); p->thread.acrs[1] = (unsigned int)tls; } } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Al Viro17936.76%315.00%
Martin Schwidefsky14229.16%945.00%
Linus Torvalds (pre-git)11924.44%210.00%
Jan Glauber204.11%15.00%
Andrew Morton163.29%15.00%
Heiko Carstens71.44%210.00%
Linus Torvalds40.82%210.00%
Total487100.00%20100.00%


asmlinkage void execve_tail(void) { current->thread.fpu.fpc = 0; asm volatile("sfpc %0" : : "d" (0)); }

Contributors

PersonTokensPropCommitsCommitProp
Martin Schwidefsky1990.48%133.33%
Hendrik Brueckner14.76%133.33%
Heiko Carstens14.76%133.33%
Total21100.00%3100.00%

/* * fill in the FPU structure for a core dump. */
int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs) { save_fpu_regs(); fpregs->fpc = current->thread.fpu.fpc; fpregs->pad = 0; if (MACHINE_HAS_VX) convert_vx_to_fp((freg_t *)&fpregs->fprs, current->thread.fpu.vxrs); else memcpy(&fpregs->fprs, current->thread.fpu.fprs, sizeof(fpregs->fprs)); return 1; }

Contributors

PersonTokensPropCommitsCommitProp
Hendrik Brueckner5867.44%350.00%
Linus Torvalds (pre-git)1719.77%116.67%
Martin Schwidefsky1112.79%233.33%
Total86100.00%6100.00%

EXPORT_SYMBOL(dump_fpu);
unsigned long get_wchan(struct task_struct *p) { struct stack_frame *sf, *low, *high; unsigned long return_address; int count; if (!p || p == current || p->state == TASK_RUNNING || !task_stack_page(p)) return 0; low = task_stack_page(p); high = (struct stack_frame *) task_pt_regs(p); sf = (struct stack_frame *) p->thread.ksp; if (sf <= low || sf > high) return 0; for (count = 0; count < 16; count++) { sf = (struct stack_frame *) sf->back_chain; if (sf <= low || sf > high) return 0; return_address = sf->gprs[8]; if (!in_sched_functions(return_address)) return return_address; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Martin Schwidefsky6943.12%233.33%
Linus Torvalds (pre-git)5836.25%116.67%
Linus Torvalds2012.50%116.67%
Al Viro95.62%116.67%
Andrew Morton42.50%116.67%
Total160100.00%6100.00%


unsigned long arch_align_stack(unsigned long sp) { if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) sp -= get_random_int() & ~PAGE_MASK; return sp & ~0xf; }

Contributors

PersonTokensPropCommitsCommitProp
Heiko Carstens37100.00%1100.00%
Total37100.00%1100.00%


static inline unsigned long brk_rnd(void) { return (get_random_int() & BRK_RND_MASK) << PAGE_SHIFT; }

Contributors

PersonTokensPropCommitsCommitProp
Heiko Carstens1995.00%150.00%
Martin Schwidefsky15.00%150.00%
Total20100.00%2100.00%


unsigned long arch_randomize_brk(struct mm_struct *mm) { unsigned long ret; ret = PAGE_ALIGN(mm->brk + brk_rnd()); return (ret > mm->brk) ? ret : mm->brk; }

Contributors

PersonTokensPropCommitsCommitProp
Heiko Carstens3173.81%150.00%
Martin Schwidefsky1126.19%150.00%
Total42100.00%2100.00%


void set_fs_fixup(void) { struct pt_regs *regs = current_pt_regs(); static bool warned; set_fs(USER_DS); if (warned) return; WARN(1, "Unbalanced set_fs - int code: 0x%x\n", regs->int_code); show_registers(regs); warned = true; }

Contributors

PersonTokensPropCommitsCommitProp
Heiko Carstens49100.00%1100.00%
Total49100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Martin Schwidefsky28725.69%2030.30%
Linus Torvalds (pre-git)25122.47%23.03%
Al Viro18816.83%46.06%
Heiko Carstens18016.11%1725.76%
Hendrik Brueckner1099.76%710.61%
Jan Glauber282.51%11.52%
Andrew Morton252.24%46.06%
Linus Torvalds242.15%34.55%
Jiri Slaby100.90%11.52%
Ingo Molnar90.81%34.55%
David Howells30.27%11.52%
Greg Kroah-Hartman10.09%11.52%
Tejun Heo10.09%11.52%
Paul Gortmaker10.09%11.52%
Total1117100.00%66100.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.