~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/um/sys-ppc/ptrace.c

Version: ~ [ linux-5.12-rc1 ] ~ [ linux-5.11.2 ] ~ [ linux-5.10.19 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.101 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.177 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.222 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.258 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.258 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include <linux/sched.h>
  2 #include "asm/ptrace.h"
  3 
  4 int putreg(struct task_struct *child, unsigned long regno, 
  5                   unsigned long value)
  6 {
  7         child->thread.process_regs.regs[regno >> 2] = value;
  8         return 0;
  9 }
 10 
 11 int poke_user(struct task_struct *child, long addr, long data)
 12 {
 13         if ((addr & 3) || addr < 0)
 14                 return -EIO;
 15 
 16         if (addr < MAX_REG_OFFSET)
 17                 return putreg(child, addr, data);
 18 
 19         else if((addr >= offsetof(struct user, u_debugreg[0])) &&
 20                 (addr <= offsetof(struct user, u_debugreg[7]))){
 21                   addr -= offsetof(struct user, u_debugreg[0]);
 22                   addr = addr >> 2;
 23                   if((addr == 4) || (addr == 5)) return -EIO;
 24                   child->thread.arch.debugregs[addr] = data;
 25                   return 0;
 26         }
 27         return -EIO;
 28 }
 29 
 30 unsigned long getreg(struct task_struct *child, unsigned long regno)
 31 {
 32         unsigned long retval = ~0UL;
 33 
 34         retval &= child->thread.process_regs.regs[regno >> 2];
 35         return retval;
 36 }
 37 
 38 int peek_user(struct task_struct *child, long addr, long data)
 39 {
 40         /* read the word at location addr in the USER area. */
 41         unsigned long tmp;
 42 
 43         if ((addr & 3) || addr < 0)
 44                 return -EIO;
 45 
 46         tmp = 0;  /* Default return condition */
 47         if(addr < MAX_REG_OFFSET){
 48                 tmp = getreg(child, addr);
 49         }
 50         else if((addr >= offsetof(struct user, u_debugreg[0])) &&
 51                 (addr <= offsetof(struct user, u_debugreg[7]))){
 52                 addr -= offsetof(struct user, u_debugreg[0]);
 53                 addr = addr >> 2;
 54                 tmp = child->thread.arch.debugregs[addr];
 55         }
 56         return put_user(tmp, (unsigned long *) data);
 57 }
 58 
 59 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp