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

TOMOYO Linux Cross Reference
Linux/tools/include/nolibc/arch-s390.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/include/nolibc/arch-s390.h (Version linux-6.12-rc7) and /tools/include/nolibc/arch-s390.h (Version policy-sample)


  1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */      1 
  2 /*                                                
  3  * s390 specific definitions for NOLIBC           
  4  */                                               
  5                                                   
  6 #ifndef _NOLIBC_ARCH_S390_H                       
  7 #define _NOLIBC_ARCH_S390_H                       
  8 #include <asm/signal.h>                           
  9 #include <asm/unistd.h>                           
 10                                                   
 11 #include "compiler.h"                             
 12 #include "crt.h"                                  
 13                                                   
 14 /* Syscalls for s390:                             
 15  *   - registers are 64-bit                       
 16  *   - syscall number is passed in r1             
 17  *   - arguments are in r2-r7                     
 18  *   - the system call is performed by calling    
 19  *   - syscall return value is in r2              
 20  *   - r1 and r2 are clobbered, others are pre    
 21  *                                                
 22  * Link s390 ABI: https://github.com/IBM/s390x    
 23  *                                                
 24  */                                               
 25                                                   
 26 #define my_syscall0(num)                          
 27 ({                                                
 28         register long _num __asm__ ("1") = (nu    
 29         register long _rc __asm__ ("2");          
 30                                                   
 31         __asm__ volatile (                        
 32                 "svc 0\n"                         
 33                 : "=d"(_rc)                       
 34                 : "d"(_num)                       
 35                 : "memory", "cc"                  
 36                 );                                
 37         _rc;                                      
 38 })                                                
 39                                                   
 40 #define my_syscall1(num, arg1)                    
 41 ({                                                
 42         register long _num __asm__ ("1") = (nu    
 43         register long _arg1 __asm__ ("2") = (l    
 44                                                   
 45         __asm__ volatile (                        
 46                 "svc 0\n"                         
 47                 : "+d"(_arg1)                     
 48                 : "d"(_num)                       
 49                 : "memory", "cc"                  
 50                 );                                
 51         _arg1;                                    
 52 })                                                
 53                                                   
 54 #define my_syscall2(num, arg1, arg2)              
 55 ({                                                
 56         register long _num __asm__ ("1") = (nu    
 57         register long _arg1 __asm__ ("2") = (l    
 58         register long _arg2 __asm__ ("3") = (l    
 59                                                   
 60         __asm__ volatile (                        
 61                 "svc 0\n"                         
 62                 : "+d"(_arg1)                     
 63                 : "d"(_arg2), "d"(_num)           
 64                 : "memory", "cc"                  
 65                 );                                
 66         _arg1;                                    
 67 })                                                
 68                                                   
 69 #define my_syscall3(num, arg1, arg2, arg3)        
 70 ({                                                
 71         register long _num __asm__ ("1") = (nu    
 72         register long _arg1 __asm__ ("2") = (l    
 73         register long _arg2 __asm__ ("3") = (l    
 74         register long _arg3 __asm__ ("4") = (l    
 75                                                   
 76         __asm__ volatile (                        
 77                 "svc 0\n"                         
 78                 : "+d"(_arg1)                     
 79                 : "d"(_arg2), "d"(_arg3), "d"(    
 80                 : "memory", "cc"                  
 81                 );                                
 82         _arg1;                                    
 83 })                                                
 84                                                   
 85 #define my_syscall4(num, arg1, arg2, arg3, arg    
 86 ({                                                
 87         register long _num __asm__ ("1") = (nu    
 88         register long _arg1 __asm__ ("2") = (l    
 89         register long _arg2 __asm__ ("3") = (l    
 90         register long _arg3 __asm__ ("4") = (l    
 91         register long _arg4 __asm__ ("5") = (l    
 92                                                   
 93         __asm__ volatile (                        
 94                 "svc 0\n"                         
 95                 : "+d"(_arg1)                     
 96                 : "d"(_arg2), "d"(_arg3), "d"(    
 97                 : "memory", "cc"                  
 98                 );                                
 99         _arg1;                                    
100 })                                                
101                                                   
102 #define my_syscall5(num, arg1, arg2, arg3, arg    
103 ({                                                
104         register long _num __asm__ ("1") = (nu    
105         register long _arg1 __asm__ ("2") = (l    
106         register long _arg2 __asm__ ("3") = (l    
107         register long _arg3 __asm__ ("4") = (l    
108         register long _arg4 __asm__ ("5") = (l    
109         register long _arg5 __asm__ ("6") = (l    
110                                                   
111         __asm__ volatile (                        
112                 "svc 0\n"                         
113                 : "+d"(_arg1)                     
114                 : "d"(_arg2), "d"(_arg3), "d"(    
115                   "d"(_num)                       
116                 : "memory", "cc"                  
117                 );                                
118         _arg1;                                    
119 })                                                
120                                                   
121 #define my_syscall6(num, arg1, arg2, arg3, arg    
122 ({                                                
123         register long _num __asm__ ("1") = (nu    
124         register long _arg1 __asm__ ("2") = (l    
125         register long _arg2 __asm__ ("3") = (l    
126         register long _arg3 __asm__ ("4") = (l    
127         register long _arg4 __asm__ ("5") = (l    
128         register long _arg5 __asm__ ("6") = (l    
129         register long _arg6 __asm__ ("7") = (l    
130                                                   
131         __asm__ volatile (                        
132                 "svc 0\n"                         
133                 : "+d"(_arg1)                     
134                 : "d"(_arg2), "d"(_arg3), "d"(    
135                   "d"(_arg6), "d"(_num)           
136                 : "memory", "cc"                  
137                 );                                
138         _arg1;                                    
139 })                                                
140                                                   
141 /* startup code */                                
142 void __attribute__((weak, noreturn)) __nolibc_    
143 {                                                 
144         __asm__ volatile (                        
145                 "lgr    %r2, %r15\n"              
146                 "aghi   %r15, -160\n"             
147                 "xc     0(8,%r15), 0(%r15)\n"     
148                 "brasl  %r14, _start_c\n"         
149         );                                        
150         __nolibc_entrypoint_epilogue();           
151 }                                                 
152                                                   
153 struct s390_mmap_arg_struct {                     
154         unsigned long addr;                       
155         unsigned long len;                        
156         unsigned long prot;                       
157         unsigned long flags;                      
158         unsigned long fd;                         
159         unsigned long offset;                     
160 };                                                
161                                                   
162 static __attribute__((unused))                    
163 void *sys_mmap(void *addr, size_t length, int     
164                off_t offset)                      
165 {                                                 
166         struct s390_mmap_arg_struct args = {      
167                 .addr = (unsigned long)addr,      
168                 .len = (unsigned long)length,     
169                 .prot = prot,                     
170                 .flags = flags,                   
171                 .fd = fd,                         
172                 .offset = (unsigned long)offse    
173         };                                        
174                                                   
175         return (void *)my_syscall1(__NR_mmap,     
176 }                                                 
177 #define sys_mmap sys_mmap                         
178                                                   
179 static __attribute__((unused))                    
180 pid_t sys_fork(void)                              
181 {                                                 
182         return my_syscall5(__NR_clone, 0, SIGC    
183 }                                                 
184 #define sys_fork sys_fork                         
185                                                   
186 #endif /* _NOLIBC_ARCH_S390_H */                  
187                                                   

~ [ 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