vitasdk
Documentation of the vitasdk
sysmem.h
Go to the documentation of this file.
1 
6 #ifndef _PSP2KERN_KERNEL_SYSMEM_H_
7 #define _PSP2KERN_KERNEL_SYSMEM_H_
8 
9 #include <vitasdk/build_utils.h>
10 #include <psp2kern/types.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 typedef enum SceKernelMemoryRefPerm {
36 
37 // specific to 3.60
63 
65 
77 
86 
95 int ksceKernelGetMemBlockBase(SceUID uid, void **base);
96 
105 int ksceKernelGetMemBlockType(SceUID uid, unsigned int *type);
106 
116 
127 
137 
146 
156 
166 
175 
192 SceUID ksceKernelUserMap(const char *name, int permission, const void *user_buf, SceSize size, void **kernel_page, SceSize *kernel_size, SceUInt32 *kernel_offset);
193 
211 SceUID ksceKernelProcUserMap(SceUID pid, const char *name, int permission, const void *user_buf, SceSize size, void **kernel_page, SceSize *kernel_size, SceUInt32 *kernel_offset);
212 
230 SceUID ksceKernelUserMapWithFlags(const char *name, int permission, int flags, const void *user_buf, SceSize size, void **kernel_page, SceSize *kernel_size, unsigned int *kernel_offset);
231 
242 
256 
271 
286 
300 
315 
330 
331 
334 
335 
336 /* Macros for backwards compatibility */
337 #define ksceKernelFindMemBlockByAddrForPid(pid, addr, size) ksceKernelFindProcMemBlockByAddr(pid, addr, size)
338 
339 #define ksceKernelMapBlockUserVisible(uid) ksceKernelMapMemBlock(uid)
340 #define ksceKernelRemapBlock(uid, type) ksceKernelRemapMemBlock(uid, type)
341 
342 #define ksceKernelMapUserBlock(name, permission, flags, user_buf, size, kernel_page, kernel_size, kernel_offset) ksceKernelUserMapWithFlags(name, permission, flags, user_buf, size, kernel_page, kernel_size, kernel_offset)
343 #define ksceKernelMapUserBlockDefaultType(name, permission, user_buf, size, kernel_page, kernel_size, kernel_offset) ksceKernelUserMap(name, permission, user_buf, size, kernel_page, kernel_size, kernel_offset)
344 #define ksceKernelMapUserBlockDefaultTypeForPid(pid, name, permission, user_buf, size, kernel_page, kernel_size, kernel_offset) ksceKernelProcUserMap(pid, name, permission, user_buf, size, kernel_page, kernel_size, kernel_offset)
345 #define ksceKernelMemBlockRelease(uid) ksceKernelUserUnmap(uid)
346 
347 #define ksceKernelMemRangeRetain(addr, size) ksceKernelLockRange(addr, size)
348 #define ksceKernelMemRangeRetainForPid(pid, addr, size) ksceKernelLockRangeProc(pid, addr, size)
349 #define ksceKernelMemRangeRetainWithPerm(perm, addr, size) ksceKernelLockRangeWithMode(perm, addr, size)
350 
351 #define ksceKernelMemRangeRelease(addr, size) ksceKernelUnlockRange(addr, size)
352 #define ksceKernelMemRangeReleaseForPid(pid, addr, size) ksceKernelUnlockRangeProc(pid, addr, size)
353 #define ksceKernelMemRangeReleaseWithPerm(perm, addr, size) ksceKernelUnlockRangeWithMode(perm, addr, size)
354 
355 #ifdef __cplusplus
356 }
357 #endif
358 
359 #endif /* _PSP2KERN_KERNEL_SYSMEM_H_ */
uint8_t type
0 = read?, 1 = write?, 2 = feature?, 3 = ?
Definition: bt.h:2
SceSize size
struct size(variable size)
Definition: debug.h:0
int flags
Event flags.
Definition: debug.h:3
SceUID pid
Definition: debug.h:1
SceUInt32 SceKernelMemBlockType
Definition: sysmem.h:16
int ksceKernelFreeMemBlock(SceUID uid)
Frees new memory block.
SceUInt32 field_4C
Definition: sysmem.h:58
SceUID ksceKernelAllocPartitionMemBlock(SceUID part, const char *name, SceKernelMemBlockType type, SceSize size, const SceKernelAllocMemBlockOptKernel *pOpt)
SceUInt32 attr
OR of SceKernelAllocMemBlockAttr.
Definition: sysmem.h:41
int ksceKernelGetMemBlockType(SceUID uid, unsigned int *type)
Gets the memory block type of a memory block.
SceUInt32 extraHigh
Definition: sysmem.h:46
SceUInt32 field_34
Definition: sysmem.h:52
SceUID ksceKernelProcUserMap(SceUID pid, const char *name, int permission, const void *user_buf, SceSize size, void **kernel_page, SceSize *kernel_size, SceUInt32 *kernel_offset)
The mapping user address space to kernel with process.
SceUID pid
Definition: sysmem.h:48
SceUID ksceKernelFindProcMemBlockByAddr(SceUID pid, const void *addr, SceSize size)
Find the SceUID of a memory block in a process.
SceUInt32 paddr
Definition: sysmem.h:43
SceSize alignment
Definition: sysmem.h:44
SceKernelAllocMemBlockKernelOpt SceKernelAllocMemBlockOptKernel
Definition: sysmem.h:64
SceUInt32 field_4
Definition: sysmem.h:40
SceSize size
sizeof(SceKernelAllocMemBlockKernelOpt)
Definition: sysmem.h:39
int ksceKernelUnmapMemBlock(SceUID uid)
Unmap a memblock.
SceKernelPaddrList * paddr_list
Definition: sysmem.h:49
SceUID ksceKernelAllocMemBlock(const char *name, SceKernelMemBlockType type, SceSize size, SceKernelAllocMemBlockKernelOpt *opt)
Allocates a new memory block.
SceUInt32 field_54
Definition: sysmem.h:60
SceUInt32 field_3C
Definition: sysmem.h:54
SceUInt32 mirror_blockid
Definition: sysmem.h:47
SceUID ksceKernelFindMemBlockByAddr(const void *addr, SceSize size)
Find the SceUID of a memory block.
int ksceKernelLockRangeWithMode(SceKernelMemoryRefPerm perm, void *addr, SceSize size)
Locks a memory range, checking for a given permission.
SceUInt32 field_44
Definition: sysmem.h:56
SceUInt32 field_50
Definition: sysmem.h:59
int ksceKernelUnlockRangeWithMode(SceKernelMemoryRefPerm perm, void *addr, SceSize size)
Unlocks a memory range checking for a given permission.
int ksceKernelRemapMemBlock(SceUID uid, SceKernelMemBlockType type)
Changes the block type.
SceUInt32 extraLow
Definition: sysmem.h:45
int ksceKernelUnlockRange(void *addr, SceSize size)
Unlocks a memory range.
SceUID ksceKernelUserMapWithFlags(const char *name, int permission, int flags, const void *user_buf, SceSize size, void **kernel_page, SceSize *kernel_size, unsigned int *kernel_offset)
The mapping user address space to kernel with flags.
int ksceKernelUserUnmap(SceUID uid)
Frees a memblock mapped with ksceKernelUserMap.
SceUID ksceKernelUserMap(const char *name, int permission, const void *user_buf, SceSize size, void **kernel_page, SceSize *kernel_size, SceUInt32 *kernel_offset)
The mapping user address space to kernel.
int ksceKernelMapMemBlockWithFlag(SceUID uid, int flag)
Map a memblock.
SceKernelMemoryRefPerm
Definition: sysmem.h:27
int ksceKernelGetMemBlockBase(SceUID uid, void **base)
Gets the base address of a memory block.
int ksceKernelMapMemBlock(SceUID uid)
Map a memblock.
int ksceKernelLockRangeProc(SceUID pid, void *addr, SceSize size)
Locks a memory range for a process (pid)
SceUInt32 field_2C
Definition: sysmem.h:50
SceUInt32 field_48
Definition: sysmem.h:57
SceUInt32 field_38
Definition: sysmem.h:53
SceUInt32 field_30
Definition: sysmem.h:51
int ksceKernelUnlockRangeProc(SceUID pid, void *addr, SceSize size)
Unlocks a memory range for a process (pid)
int ksceKernelFreeSimpleMemBlock(void *a1)
SceUInt32 field_C
Definition: sysmem.h:42
int ksceKernelGetMemBlockAllocMapSize(SceUID memid, SceSize *alloc_map_size)
Get the AllocMapSize of a MemBlock.
int ksceKernelLockRange(void *addr, SceSize size)
Locks a memory range.
SceUInt32 field_40
Definition: sysmem.h:55
@ SCE_KERNEL_MEMORY_REF_PERM_USER_R
Definition: sysmem.h:29
@ SCE_KERNEL_MEMORY_REF_PERM_KERN_R
Definition: sysmem.h:32
@ SCE_KERNEL_MEMORY_REF_PERM_KERN_X
Definition: sysmem.h:34
@ SCE_KERNEL_MEMORY_REF_PERM_ANY
Definition: sysmem.h:28
@ SCE_KERNEL_MEMORY_REF_PERM_KERN_W
Definition: sysmem.h:33
@ SCE_KERNEL_MEMORY_REF_PERM_USER_W
Definition: sysmem.h:30
@ SCE_KERNEL_MEMORY_REF_PERM_USER_X
Definition: sysmem.h:31
Definition: sysmem.h:38
VITASDK_BUILD_ASSERT_EQ(0x40, SceKernelAllocMemBlockOpt)
unsigned int SceSize
Definition: types.h:56
int SceUID
UIDs are used to describe many different kernel objects.
Definition: types.h:90
uint32_t SceUInt32
Definition: types.h:45
Definition: types.h:128