vitasdk
Documentation of the vitasdk
data_transfers.h
Go to the documentation of this file.
1 
6 #ifndef _PSP2KERN_KERNEL_SYSMEM_DATA_TRANSFERS_H_
7 #define _PSP2KERN_KERNEL_SYSMEM_DATA_TRANSFERS_H_
8 
9 #include <psp2kern/types.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /*
16  * TTBR1: Translation Table Base Register 1.
17  * The 0x40000000-0xFFFFFFFF virtual region is mapped by TTBR1.
18  * This range is all userland memory.
19  * At kernel context, kernel TTBR1 is set, but it is not mapped to anything.
20  *
21  * DACR: Domain access control register.
22  * Simply put, memory access permission.
23  * See: https://developer.arm.com/documentation/ddi0406/c/System-Level-Architecture/System-Control-Registers-in-a-VMSA-implementation/VMSA-System-control-registers-descriptions--in-register-order/DACR--Domain-Access-Control-Register--VMSA?lang=en
24  */
25 
39 int ksceKernelCopyFromUser(void *dst, const void *src, SceSize len);
40 
54 int ksceKernelCopyFromUserProc(SceUID pid, void *dst, const void *src, SceSize len);
55 
69 int ksceKernelCopyToUser(void *dst, const void *src, SceSize len);
70 
84 int ksceKernelCopyToUserProc(SceUID pid, void *dst, const void *src, SceSize len);
85 
99 int ksceKernelCopyToUserDomain(void *dst, const void *src, SceSize len);
100 
114 int ksceKernelCopyToUserTextDomain(void *dst, const void *src, SceSize len);
115 
129 int ksceKernelCopyToUserProcTextDomain(SceUID pid, void *dst, const void *src, SceSize len);
130 
144 SceSSize ksceKernelStrncpyFromUser(char *dst, const char *src, SceSize len);
145 
160 SceSSize ksceKernelStrncpyFromUserProc(SceUID pid, char *dst, const char *src, SceSize len);
161 
175 SceSSize ksceKernelStrncpyToUser(char *dst, const char *src, SceSize len);
176 
191 SceSSize ksceKernelStrncpyToUserProc(SceUID pid, char *dst, const char *src, SceSize len);
192 
206 
221 
235 int ksceKernelCopyFromToUser(void *dst, const void *src, SceSize len);
236 
251 int ksceKernelCopyFromToUserProc(SceUID pid, void *dst, const void *src, SceSize len);
252 
253 
254 /* Macros for backwards compatibility */
255 #define ksceKernelMemcpyUserToKernel(__dst__, __src__, __len__) ksceKernelCopyFromUser((__dst__), (__src__), (__len__))
256 #define ksceKernelMemcpyUserToKernelForPid(__pid__, __dst__, __src__, __len__) ksceKernelCopyFromUserProc((__pid__), (__dst__), (__src__), (__len__))
257 #define ksceKernelMemcpyKernelToUser(__dst__, __src__, __len__) ksceKernelCopyToUser((__dst__), (__src__), (__len__))
258 #define ksceKernelMemcpyToUserRo(__dst__, __src__, __len__) ksceKernelCopyToUserDomain((__dst__), (__src__), (__len__))
259 #define ksceKernelMemcpyToUserRx(__dst__, __src__, __len__) ksceKernelCopyToUserTextDomain((__dst__), (__src__), (__len__))
260 #define ksceKernelRxMemcpyKernelToUserForPid(__pid__, __dst__, __src__, __len__) ksceKernelCopyToUserProcTextDomain((__pid__), (__dst__), (__src__), (__len__))
261 
262 #define ksceKernelMemcpyFromUser(__dst__, __src__, __len__) ksceKernelCopyFromUser(__dst__, __src__, __len__)
263 #define ksceKernelProcMemcpyFromUser(__pid__, __dst__, __src__, __len__) ksceKernelCopyFromUserProc(__pid__, __dst__, __src__, __len__)
264 #define ksceKernelMemcpyToUser(__dst__, __src__, __len__) ksceKernelCopyToUser(__dst__, __src__, __len__)
265 #define ksceKernelProcMemcpyToUser(__pid__, __dst__, __src__, __len__) ksceKernelCopyToUserProc(__pid__, __dst__, __src__, __len__)
266 #define ksceKernelUserMemcpy(__dst__, __src__, __len__) ksceKernelCopyFromToUser(__dst__, __src__, __len__)
267 #define ksceKernelProcUserMemcpy(__pid__, __dst__, __src__, __len__) ksceKernelCopyFromToUserProc(__pid__, __dst__, __src__, __len__)
268 #define ksceKernelProcMemcpyToUserRx(__pid__, __dst__, __src__, __len__) ksceKernelCopyToUserProcTextDomain(__pid__, __dst__, __src__, __len__)
269 
270 #define ksceKernelStrncpyUserToKernel(__dst__, __src__, __len__) ksceKernelStrncpyFromUser((__dst__), (__src__), (__len__))
271 #define ksceKernelStrncpyUserForPid(__pid__, __dst__, __src__, __len__) ksceKernelStrncpyFromUserProc((__pid__), (__dst__), (__src__), (__len__))
272 #define ksceKernelStrncpyKernelToUser(__dst__, __src__, __len__) ksceKernelStrncpyToUser((__dst__), (__src__), (__len__))
273 
274 #define ksceKernelProcStrncpyFromUser(__pid__, __dst__, __src__, __len__) ksceKernelStrncpyFromUserProc((__pid__), (__dst__), (__src__), (__len__))
275 #define ksceKernelProcStrncpyToUser(__pid__, __dst__, __src__, __len__) ksceKernelStrncpyToUserProc((__pid__), (__dst__), (__src__), (__len__))
276 #define ksceKernelStrnlenUser(__s__, __n__) ksceKernelStrnlenFromUser(__s__, __n__)
277 #define ksceKernelProcStrnlenUser(__pid__, __s__, __n__) ksceKernelStrnlenFromUserProc(__pid__, __s__, __n__)
278 
279 #ifdef __cplusplus
280 }
281 #endif
282 
283 #endif /* _PSP2KERN_KERNEL_SYSMEM_DATA_TRANSFERS_H_ */
SceUID pid
Definition: debug.h:1
SceSSize ksceKernelStrncpyToUserProc(SceUID pid, char *dst, const char *src, SceSize len)
Strncpy to user memory with process.
int ksceKernelCopyFromToUserProc(SceUID pid, void *dst, const void *src, SceSize len)
Memcpy user memory to user memory with process.
int ksceKernelCopyFromToUser(void *dst, const void *src, SceSize len)
Memcpy user memory to user memory.
int ksceKernelCopyToUserProcTextDomain(SceUID pid, void *dst, const void *src, SceSize len)
Memcpy to user RX memory with process.
SceSSize ksceKernelStrncpyFromUserProc(SceUID pid, char *dst, const char *src, SceSize len)
Strncpy from user memory with process.
int ksceKernelCopyFromUserProc(SceUID pid, void *dst, const void *src, SceSize len)
Memcpy from user memory with process.
int ksceKernelCopyToUserDomain(void *dst, const void *src, SceSize len)
Memcpy to user RO memory.
SceSSize ksceKernelStrncpyFromUser(char *dst, const char *src, SceSize len)
Strncpy from user memory.
int ksceKernelCopyFromUser(void *dst, const void *src, SceSize len)
Memcpy from user memory.
SceSSize ksceKernelStrncpyToUser(char *dst, const char *src, SceSize len)
Strncpy to user memory.
int ksceKernelCopyToUserTextDomain(void *dst, const void *src, SceSize len)
Memcpy to user RO memory with DcacheAndL2WritebackRange.
int ksceKernelCopyToUserProc(SceUID pid, void *dst, const void *src, SceSize len)
Memcpy from user memory with process.
SceSize ksceKernelStrnlenFromUser(const char *s, SceSize n)
Strnlen user memory.
int ksceKernelCopyToUser(void *dst, const void *src, SceSize len)
Memcpy to user memory.
SceSSize ksceKernelStrnlenFromUserProc(SceUID pid, const char *s, SceSize n)
Strnlen user memory with process.
signed int SceSSize
Definition: types.h:57
unsigned int SceSize
Definition: types.h:56
int SceUID
UIDs are used to describe many different kernel objects.
Definition: types.h:90