root/arch/um/include/shared/ptrace_user.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 /* 
   3  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
   4  */
   5 
   6 #ifndef __PTRACE_USER_H__
   7 #define __PTRACE_USER_H__
   8 
   9 #include <sys/ptrace.h>
  10 #include <sysdep/ptrace_user.h>
  11 
  12 extern int ptrace_getregs(long pid, unsigned long *regs_out);
  13 extern int ptrace_setregs(long pid, unsigned long *regs_in);
  14 
  15 /* syscall emulation path in ptrace */
  16 
  17 #ifndef PTRACE_SYSEMU
  18 #define PTRACE_SYSEMU 31
  19 #endif
  20 #ifndef PTRACE_SYSEMU_SINGLESTEP
  21 #define PTRACE_SYSEMU_SINGLESTEP 32
  22 #endif
  23 
  24 /* On architectures, that started to support PTRACE_O_TRACESYSGOOD
  25  * in linux 2.4, there are two different definitions of
  26  * PTRACE_SETOPTIONS: linux 2.4 uses 21 while linux 2.6 uses 0x4200.
  27  * For binary compatibility, 2.6 also supports the old "21", named
  28  * PTRACE_OLDSETOPTION. On these architectures, UML always must use
  29  * "21", to ensure the kernel runs on 2.4 and 2.6 host without
  30  * recompilation. So, we use PTRACE_OLDSETOPTIONS in UML.
  31  * We also want to be able to build the kernel on 2.4, which doesn't
  32  * have PTRACE_OLDSETOPTIONS. So, if it is missing, we declare
  33  * PTRACE_OLDSETOPTIONS to be the same as PTRACE_SETOPTIONS.
  34  *
  35  * On architectures, that start to support PTRACE_O_TRACESYSGOOD on
  36  * linux 2.6, PTRACE_OLDSETOPTIONS never is defined, and also isn't
  37  * supported by the host kernel. In that case, our trick lets us use
  38  * the new 0x4200 with the name PTRACE_OLDSETOPTIONS.
  39  */
  40 #ifndef PTRACE_OLDSETOPTIONS
  41 #define PTRACE_OLDSETOPTIONS PTRACE_SETOPTIONS
  42 #endif
  43 
  44 void set_using_sysemu(int value);
  45 int get_using_sysemu(void);
  46 extern int sysemu_supported;
  47 
  48 #define SELECT_PTRACE_OPERATION(sysemu_mode, singlestep_mode) \
  49         (((int[3][3] ) { \
  50                 { PTRACE_SYSCALL, PTRACE_SYSCALL, PTRACE_SINGLESTEP }, \
  51                 { PTRACE_SYSEMU, PTRACE_SYSEMU, PTRACE_SINGLESTEP }, \
  52                 { PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP, \
  53                   PTRACE_SYSEMU_SINGLESTEP } }) \
  54                 [sysemu_mode][singlestep_mode])
  55 
  56 #endif

/* [<][>][^][v][top][bottom][index][help] */