cregit-Linux how code gets into the kernel

Release 4.14 arch/sparc/kernel/sigutil_64.c

// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/thread_info.h>
#include <linux/uaccess.h>
#include <linux/errno.h>

#include <asm/sigcontext.h>
#include <asm/fpumacro.h>
#include <asm/ptrace.h>
#include <asm/switch_to.h>

#include "sigutil.h"


int save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) { unsigned long *fpregs = current_thread_info()->fpregs; unsigned long fprs; int err = 0; fprs = current_thread_info()->fpsaved[0]; if (fprs & FPRS_DL) err |= copy_to_user(&fpu->si_float_regs[0], fpregs, (sizeof(unsigned int) * 32)); if (fprs & FPRS_DU) err |= copy_to_user(&fpu->si_float_regs[32], fpregs+16, (sizeof(unsigned int) * 32)); err |= __put_user(current_thread_info()->xfsr[0], &fpu->si_fsr); err |= __put_user(current_thread_info()->gsr[0], &fpu->si_gsr); err |= __put_user(fprs, &fpu->si_fprs); return err; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller159100.00%1100.00%
Total159100.00%1100.00%


int restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) { unsigned long *fpregs = current_thread_info()->fpregs; unsigned long fprs; int err; if (((unsigned long) fpu) & 7) return -EFAULT; err = get_user(fprs, &fpu->si_fprs); fprs_write(0); regs->tstate &= ~TSTATE_PEF; if (fprs & FPRS_DL) err |= copy_from_user(fpregs, &fpu->si_float_regs[0], (sizeof(unsigned int) * 32)); if (fprs & FPRS_DU) err |= copy_from_user(fpregs+16, &fpu->si_float_regs[32], (sizeof(unsigned int) * 32)); err |= __get_user(current_thread_info()->xfsr[0], &fpu->si_fsr); err |= __get_user(current_thread_info()->gsr[0], &fpu->si_gsr); current_thread_info()->fpsaved[0] |= fprs; return err; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller185100.00%2100.00%
Total185100.00%2100.00%


int save_rwin_state(int wsaved, __siginfo_rwin_t __user *rwin) { int i, err = __put_user(wsaved, &rwin->wsaved); for (i = 0; i < wsaved; i++) { struct reg_window *rp = &current_thread_info()->reg_window[i]; unsigned long fp = current_thread_info()->rwbuf_stkptrs[i]; err |= copy_to_user(&rwin->reg_window[i], rp, sizeof(struct reg_window)); err |= __put_user(fp, &rwin->rwbuf_stkptrs[i]); } return err; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller108100.00%1100.00%
Total108100.00%1100.00%


int restore_rwin_state(__siginfo_rwin_t __user *rp) { struct thread_info *t = current_thread_info(); int i, wsaved, err; if (((unsigned long) rp) & 7) return -EFAULT; get_user(wsaved, &rp->wsaved); if (wsaved > NSWINS) return -EFAULT; err = 0; for (i = 0; i < wsaved; i++) { err |= copy_from_user(&t->reg_window[i], &rp->reg_window[i], sizeof(struct reg_window)); err |= __get_user(t->rwbuf_stkptrs[i], &rp->rwbuf_stkptrs[i]); } if (err) return err; set_thread_wsaved(wsaved); synchronize_user_stack(); if (get_thread_wsaved()) return -EFAULT; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller154100.00%2100.00%
Total154100.00%2100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
David S. Miller63098.90%240.00%
Ben Hutchings30.47%120.00%
David Howells30.47%120.00%
Greg Kroah-Hartman10.16%120.00%
Total637100.00%5100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.