vitasdk
Documentation of the vitasdk
cpu.h
Go to the documentation of this file.
1
7#ifndef _PSP2KERN_KERNEL_CPU_H_
8#define _PSP2KERN_KERNEL_CPU_H_
9
10#include <psp2kern/types.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
29#define ENTER_SYSCALL(state) \
30 do { \
31 asm volatile ("mrc p15, 0, %0, c13, c0, 3" : "=r" (state)); \
32 asm volatile ("mcr p15, 0, %0, c13, c0, 3" :: "r" (state << 16) : "memory"); \
33 } while(0)
34
40#define EXIT_SYSCALL(state) \
41 do { \
42 asm volatile ("mcr p15, 0, %0, c13, c0, 3" :: "r" (state) : "memory"); \
43 } while (0)
44
45
52
59
68
69
70// sceKernelDomainTextMemcpy removed from 3.63
71#if PSP2_SDK_VERSION >= 0x3630000 && defined(__USE_SCE_KERNEL_DOMAIN_TEXT_MEMCPY_IMPORT)
72#undef __USE_SCE_KERNEL_DOMAIN_TEXT_MEMCPY_IMPORT
73#endif
74
84#if defined(__USE_SCE_KERNEL_DOMAIN_TEXT_MEMCPY_IMPORT)
85int ksceKernelDomainTextMemcpy(void *dst, const void *src, SceSize len);
86#else
87static inline int ksceKernelDomainTextMemcpy(void *dst, const void *src, SceSize len)
88{
89 SceUInt32 prev_dacr;
90
91 asm volatile("mrc p15, 0, %0, c3, c0, 0" : "=r" (prev_dacr));
92 asm volatile("mcr p15, 0, %0, c3, c0, 0" :: "r" (0xFFFF0000));
93
94 memcpy(dst, src, len);
95
96 ksceKernelDcacheCleanRangeForL1WBWA((void *)(((uintptr_t)dst) & ~0x1F), ((((uintptr_t)dst) + len + 0x1F) & ~0x1F) - (((uintptr_t)dst) & ~0x1F));
97
98 asm volatile("mcr p15, 0, %0, c3, c0, 0" :: "r" (prev_dacr));
99
100 return SCE_OK;
101}
102#endif
103
104
105// sceKernelGetVmaccessRange had prototype changed in some times
106void ksceKernelGetVmaccessRange(SceUIntPtr *pRangeStart, SceUIntPtr *pRangeEnd);
107
110
113
115
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif /* _PSP2KERN_KERNEL_CPU_H_ */
void ksceKernelDcacheCleanRangeForL1WBWA(void *start, unsigned int size)
The clean a range the L1 dcache.
int ksceKernelCpuId(void)
Returns the CPU ID of the calling processor.
SceKernelIntrStatus ksceKernelCpuSuspendIntr(void)
Suspend intr of calling processor.
void ksceKernelCpuUpdateSCTLR(void)
void ksceKernelCpuBranchPredictorInvalidateAllIS(void)
SceUInt8 ksceKernelCpuGetCONTEXTIDR(void)
void ksceKernelGetVmaccessRange(SceUIntPtr *pRangeStart, SceUIntPtr *pRangeEnd)
void ksceKernelCpuBranchPredictorInvalidateAll(void)
SceKernelIntrStatus ksceKernelCpuResumeIntr(SceKernelIntrStatus prev_state)
Suspend intr of calling processor.
SceBool ksceKernelIsUncacheAddressInTmpFsGame(void *address)
void * memcpy(void *dst, const void *src, unsigned int len)
Copy memory1 to memory2.
int SceBool
Definition types.h:59
unsigned int SceUIntPtr
Definition types.h:84
unsigned int SceSize
Definition types.h:56
int SceKernelIntrStatus
Interrupt status.
Definition types.h:235
uint32_t SceUInt32
Definition types.h:45
uint8_t SceUInt8
Definition types.h:36
#define SCE_OK
Definition types.h:225