vitasdk
Documentation of the vitasdk
address_space.h
Go to the documentation of this file.
1 
6 #ifndef _PSP2KERN_KERNEL_SYSMEM_ADDRESS_SPACE_H_
7 #define _PSP2KERN_KERNEL_SYSMEM_ADDRESS_SPACE_H_
8 
9 #include <vitasdk/build_utils.h>
10 #include <psp2kern/types.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
25 int ksceKernelVAtoPA(const void *va, uintptr_t *pa);
26 
36 
46 
47 typedef struct SceKernelProcessContext {
53 
54 
62 
70 
71 
73 int ksceKernelAddressSpaceSetPhyMemPart(SceUID guid, SceUInt32 index, void *pPhyMemPart);
74 int ksceKernelAddressSpaceUnmap(SceUID uid, int a2, int a3, void* addr, SceSize size);
75 int ksceKernelAddressSpaceVAtoPA(void *pAS, SceUInt32 mode, void *pVA, void **pPA);
76 SceUID ksceKernelCreateAddressSpace(SceUID pid, const char *name, SceUInt32 type, void *pOpt);
78 
79 
80 #if defined(PSP2_SDK_VERSION) && PSP2_SDK_VERSION <= 0x1692000
81 int ksceKernelSwitchVmaForPid(SceUID pid);
82 #endif
83 
84 
85 /* For backwards compatibility */
86 
87 #define ksceKernelGetPidContext ksceKernelProcessGetContext
88 #define ksceKernelSwitchPidContext ksceKernelProcessSwitchContext
89 #define ksceKernelGetPaddr(va, pa) ksceKernelVAtoPA(va, pa)
90 #define ksceKernelGetPaddrList(input, list) ksceKernelVARangeToPAVector((const SceKernelVARange *)input, list)
91 
97 static inline SceInt32 ksceKernelCpuSaveContext(SceKernelProcessContext *context)
98 {
99  int res;
101 
103  if(res < 0){
104  return res;
105  }
106 
107  memcpy(context, ctx, sizeof(*context));
108 
109  return 0;
110 }
111 
117 static inline SceInt32 ksceKernelCpuRestoreContext(const SceKernelProcessContext *context)
118 {
119  return ksceKernelProcessSwitchContext(context, NULL);
120 }
121 
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* _PSP2KERN_KERNEL_SYSMEM_ADDRESS_SPACE_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
SceUID pid
Definition: debug.h:1
void * memcpy(void *dst, const void *src, unsigned int len)
Copy memory1 to memory2.
int ksceKernelVARangeToPARange(const SceKernelVARange *va_range, SceKernelPARange *pa_range)
Get the physical address range of a given virtual address range.
int ksceKernelProcessSwitchContext(const SceKernelProcessContext *new_context, SceKernelProcessContext *prev_context)
Switch the process context.
int ksceKernelVAtoPA(const void *va, uintptr_t *pa)
Get the physical address of a given virtual address.
int ksceKernelVARangeToPAVector(const SceKernelVARange *va_range, SceKernelPAVector *pa_vector)
Get the physical address list of a given virtual address range.
int ksceKernelAddressSpaceSetPhyMemPart(SceUID guid, SceUInt32 index, void *pPhyMemPart)
int ksceKernelAddressSpaceVAtoPA(void *pAS, SceUInt32 mode, void *pVA, void **pPA)
VITASDK_BUILD_ASSERT_EQ(0xC, SceKernelProcessContext)
int ksceKernelAddressSpaceUnmap(SceUID uid, int a2, int a3, void *addr, SceSize size)
SceUID ksceKernelCreateAddressSpace(SceUID pid, const char *name, SceUInt32 type, void *pOpt)
SceUInt32 TTBR1
Definition: address_space.h:48
SceUInt32 CONTEXTIDR
Definition: address_space.h:50
int ksceKernelProcessGetContext(SceUID pid, SceKernelProcessContext **ctx)
Get the process context.
int ksceKernelDeleteAddressSpace(SceUID guid)
int ksceKernelAddressSpaceFreeAllMemBlock(SceUID guid)
SceUInt32 DACR
Definition: address_space.h:49
Definition: address_space.h:47
int32_t SceInt32
Definition: types.h:44
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
#define SCE_KERNEL_PROCESS_ID_SELF
Current process's UID - pass to APIs expecting a process ID to operate on calling process.
Definition: types.h:100
Definition: types.h:122
Definition: types.h:128
Definition: types.h:116