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

TOMOYO Linux Cross Reference
Linux/arch/x86/um/shared/sysdep/stub_64.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
  3  * Licensed under the GPL
  4  */
  5 
  6 #ifndef __SYSDEP_STUB_H
  7 #define __SYSDEP_STUB_H
  8 
  9 #include <stddef.h>
 10 #include <sysdep/ptrace_user.h>
 11 #include <generated/asm-offsets.h>
 12 #include <linux/stddef.h>
 13 
 14 #define STUB_MMAP_NR __NR_mmap
 15 #define MMAP_OFFSET(o) (o)
 16 
 17 #define __syscall_clobber "r11","rcx","memory"
 18 #define __syscall "syscall"
 19 
 20 static __always_inline long stub_syscall0(long syscall)
 21 {
 22         long ret;
 23 
 24         __asm__ volatile (__syscall
 25                 : "=a" (ret)
 26                 : "" (syscall) : __syscall_clobber );
 27 
 28         return ret;
 29 }
 30 
 31 static __always_inline long stub_syscall2(long syscall, long arg1, long arg2)
 32 {
 33         long ret;
 34 
 35         __asm__ volatile (__syscall
 36                 : "=a" (ret)
 37                 : "" (syscall), "D" (arg1), "S" (arg2) : __syscall_clobber );
 38 
 39         return ret;
 40 }
 41 
 42 static __always_inline long stub_syscall3(long syscall, long arg1, long arg2,
 43                                           long arg3)
 44 {
 45         long ret;
 46 
 47         __asm__ volatile (__syscall
 48                 : "=a" (ret)
 49                 : "" (syscall), "D" (arg1), "S" (arg2), "d" (arg3)
 50                 : __syscall_clobber );
 51 
 52         return ret;
 53 }
 54 
 55 static __always_inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
 56                                  long arg4)
 57 {
 58         long ret;
 59 
 60         __asm__ volatile ("movq %5,%%r10 ; " __syscall
 61                 : "=a" (ret)
 62                 : "" (syscall), "D" (arg1), "S" (arg2), "d" (arg3),
 63                   "g" (arg4)
 64                 : __syscall_clobber, "r10" );
 65 
 66         return ret;
 67 }
 68 
 69 static __always_inline long stub_syscall5(long syscall, long arg1, long arg2,
 70                                           long arg3, long arg4, long arg5)
 71 {
 72         long ret;
 73 
 74         __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall
 75                 : "=a" (ret)
 76                 : "" (syscall), "D" (arg1), "S" (arg2), "d" (arg3),
 77                   "g" (arg4), "g" (arg5)
 78                 : __syscall_clobber, "r10", "r8" );
 79 
 80         return ret;
 81 }
 82 
 83 static __always_inline long stub_syscall6(long syscall, long arg1, long arg2,
 84                                           long arg3, long arg4, long arg5,
 85                                           long arg6)
 86 {
 87         long ret;
 88 
 89         __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9 ; "
 90                 __syscall
 91                 : "=a" (ret)
 92                 : "" (syscall), "D" (arg1), "S" (arg2), "d" (arg3),
 93                   "g" (arg4), "g" (arg5), "g" (arg6)
 94                 : __syscall_clobber, "r10", "r8", "r9");
 95 
 96         return ret;
 97 }
 98 
 99 static __always_inline void trap_myself(void)
100 {
101         __asm("int3");
102 }
103 
104 static __always_inline void *get_stub_data(void)
105 {
106         unsigned long ret;
107 
108         asm volatile (
109                 "movq %%rsp,%0 ;"
110                 "andq %1,%0"
111                 : "=a" (ret)
112                 : "g" (~(STUB_DATA_PAGES * UM_KERN_PAGE_SIZE - 1)));
113 
114         return (void *)ret;
115 }
116 #endif
117 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php