diff options
author | Reiko Asakura | 2021-01-19 20:09:40 -0500 |
---|---|---|
committer | Reiko Asakura | 2021-01-19 20:09:40 -0500 |
commit | e20827375d173baca809ad2ccbe04c45ca0112f4 (patch) | |
tree | 017fdbcc7098b2dbd6771e30c6255ab86a88207e /include | |
parent | Remove dupe: kernel/cpu.h (diff) | |
download | vds-libraries-e20827375d173baca809ad2ccbe04c45ca0112f4.tar.gz |
Remove dupe: sysmem related
Diffstat (limited to 'include')
-rw-r--r-- | include/kernel/kernel/sysmem.h | 66 | ||||
-rw-r--r-- | include/user/kernel/sysmem.h | 25 | ||||
-rw-r--r-- | include/user/kernel/sysmem/memblock.h | 233 |
3 files changed, 13 insertions, 311 deletions
diff --git a/include/kernel/kernel/sysmem.h b/include/kernel/kernel/sysmem.h index 98598bb..094a203 100644 --- a/include/kernel/kernel/sysmem.h +++ b/include/kernel/kernel/sysmem.h @@ -1,33 +1,26 @@ #ifndef _PSP2_KERNEL_SYSMEM_H_ #define _PSP2_KERNEL_SYSMEM_H_ -#include <stdarg.h> -#include <psp2kern/kernel/types.h> +#include_next <kernel/sysmem.h> + +#include <stddef.h> +#include <stdint.h> #ifdef __cplusplus extern "C" { #endif -typedef enum _SceKernelMemBlockType { - SCE_KERNEL_MEMBLOCK_TYPE_SHARED_RX = 0x0390D050, - SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW = 0x09408060, - SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE = 0x0C208060, - SCE_KERNEL_MEMBLOCK_TYPE_USER_RX = 0x0C20D050, - SCE_KERNEL_MEMBLOCK_TYPE_USER_RW = 0x0C20D060, - SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_RW = 0x0C80D060, - SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_NC_RW = 0x0D808060, - SCE_KERNEL_MEMBLOCK_TYPE_KERNEL_RX = 0x1020D005, - SCE_KERNEL_MEMBLOCK_TYPE_KERNEL_RW = 0x1020D006, - SCE_KERNEL_MEMBLOCK_TYPE_RW_UNK0 = 0x6020D006 -} _SceKernelMemBlockType; +#define SCE_KERNEL_MEMBLOCK_TYPE_SHARED_RX 0x0390D050 +#define SCE_KERNEL_MEMBLOCK_TYPE_USER_RX 0x0C20D050 +#define SCE_KERNEL_MEMBLOCK_TYPE_KERNEL_RX 0x1020D005 +#define SCE_KERNEL_MEMBLOCK_TYPE_KERNEL_RW 0x1020D006 +#define SCE_KERNEL_MEMBLOCK_TYPE_RW_UNK0 0x6020D006 typedef enum SceKernelAllocMemBlockAttr { SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_HAS_PADDR = 0x00000002U, - SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_HAS_ALIGNMENT = 0x00000004U, SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_HAS_MIRROR_BLOCKID = 0x00000040U, SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_HAS_PID = 0x00000080U, SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_HAS_PADDR_LIST = 0x00001000U, - SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_PHYCONT = 0x00200000U, SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_ALLOW_PARTIAL_OP = 0x04000000U } SceKernelAllocMemBlockAttr; @@ -146,37 +139,6 @@ typedef struct SceKernelSysrootSelfInfo { } SceKernelSysrootSelfInfo; /** - * Allocates a new memory block - * - * @param[in] name - Name for the memory block - * @param[in] type - Type of the memory to allocate - * @param[in] size - Size of the memory to allocate - * @param[in] opt - Memory block options? - * - * @return SceUID of the memory block on success, < 0 on error. -*/ -SceUID sceKernelAllocMemBlock(const char *name, SceKernelMemBlockType type, SceSize size, SceKernelAllocMemBlockKernelOpt *opt); - -/** - * Frees new memory block - * - * @param[in] uid - SceUID of the memory block to free - * - * @return 0 on success, < 0 on error. -*/ -int sceKernelFreeMemBlock(SceUID uid); - -/** - * Gets the base address of a memory block - * - * @param[in] uid - SceUID of the memory block - * @param[out] base - Base address of the memory block identified by uid - * - * @return 0 on success, < 0 on error. -*/ -int sceKernelGetMemBlockBase(SceUID uid, void **base); - -/** * Gets the memory block type of a memory block * * @param[in] uid - SceUID of the memory block @@ -187,16 +149,6 @@ int sceKernelGetMemBlockBase(SceUID uid, void **base); int sceKernelGetMemBlockType(SceUID uid, unsigned int *type); /** - * Find the SceUID of a memory block - * - * @param[in] addr - Base address of the memory block - * @param[in] size - Size to search for (usally set to 0) - * - * @return SceUID of the memory block on success, < 0 on error. -*/ -SceUID sceKernelFindMemBlockByAddr(const void *addr, SceSize size); - -/** * Find the SceUID of a memory block for a PID * * @param[in] pid - PID of the process diff --git a/include/user/kernel/sysmem.h b/include/user/kernel/sysmem.h index 04e3ea2..dd156e1 100644 --- a/include/user/kernel/sysmem.h +++ b/include/user/kernel/sysmem.h @@ -1,18 +1,9 @@ #ifndef _PSP2_KERNEL_SYSMEM_H_ #define _PSP2_KERNEL_SYSMEM_H_ -#include <psp2/kernel/sysmem/memblock.h> +#include_next <kernel/sysmem.h> -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SceKernelFreeMemorySizeInfo { - int size; //!< sizeof(SceKernelFreeMemorySizeInfo) - int size_user; //!< Free memory size for *_USER_RW memory - int size_cdram; //!< Free memory size for USER_CDRAM_RW memory - int size_phycont; //!< Free memory size for USER_MAIN_PHYCONT_*_RW memory -} SceKernelFreeMemorySizeInfo; +SCE_CDECL_BEGIN typedef enum SceKernelModel { SCE_KERNEL_MODEL_VITA = 0x10000, @@ -41,19 +32,9 @@ int sceKernelGetModelForCDialog(void); */ int sceKernelGetModel(void); -/** - * Get free memory size in bytes - * - * @param[out] info - Returned free memory size for different kind of memory block types - * @return 0 on success, < 0 on error. -*/ -int sceKernelGetFreeMemorySize(SceKernelFreeMemorySizeInfo *info); - int sceKernelIsPSVitaTV(void); -#ifdef __cplusplus -} -#endif +SCE_CDECL_END #endif diff --git a/include/user/kernel/sysmem/memblock.h b/include/user/kernel/sysmem/memblock.h index e422826..fd341e3 100644 --- a/include/user/kernel/sysmem/memblock.h +++ b/include/user/kernel/sysmem/memblock.h @@ -1,121 +1,23 @@ #ifndef _DOLCESDK_PSP2_KERNEL_SYSMEM_MEMBLOCK_H_ #define _DOLCESDK_PSP2_KERNEL_SYSMEM_MEMBLOCK_H_ -#include <psp2/cdefs.h> -#include <psp2/kernel/types.h> +#include_next <kernel/sysmem/memblock.h> /** @name sceKernelAllocMemBlockで指定可能なメモリタイプ */ /*@{*/ /** - * memory block type for read write cache allocated on LPDDR2 - */ -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_RW 0x0c20d060U - -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_RWDATA SCE_KERNEL_MEMBLOCK_TYPE_USER_RW - -/** * memory block type for read execute cache allocated on LPDDR2 */ #define SCE_KERNEL_MEMBLOCK_TYPE_USER_RX 0x0c20d050U -/** - * memory block type for read write uncache allocated on LPDDR2 - */ -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_NC_RW 0x0c208060U - -/** - * alias of SCE_KERNEL_MEMBLOCK_TYPE_USER_NC_RW - */ -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE SCE_KERNEL_MEMBLOCK_TYPE_USER_NC_RW - -/** - * alias of SCE_KERNEL_MEMBLOCK_TYPE_USER_NC_RW - */ -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_RWDATA_UNCACHE SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE - -/** - * memory block type for read write cache allocated on LPDDR2 physical continuous area - */ -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_RW 0x0c80d060U - -/** - * memory block type for read write uncache allocated on LPDDR2 physical continuous area - */ -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_NC_RW 0x0d808060U - -/** - * memory block type for read write uncache allocated on CDRAM - */ -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW 0x09408060U - -#define SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RWDATA SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW - /*@}*/ SCE_CDECL_BEGIN #if !defined(_LANGUAGE_ASSEMBLY) -typedef struct SceKernelAllocMemBlockOpt0940 { - SceSize size; - SceUInt32 attr; - SceSize alignment; - SceUID uidBaseBlock; - const char *strBaseBlockName; -} SceKernelAllocMemBlockOpt0940; - -/** - * Option parameter for sceKernelAllocMemBlock - */ - typedef struct SceKernelAllocMemBlockOpt { - /** - * size of this - */ - SceSize size; - - /** - * attributes field - */ - SceUInt32 attr; - - /** - * alignment option - * must set SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_HAS_ALIGNMENT to 'attr' - */ - SceSize alignment; - - /** - * reserved - */ - SceUInt32 reserved; - - /** - * reserved2 - */ - const char *strBaseBlockName; - -#if 0 - /** - * mapped base address [out] - */ - void *mappedBase; - - /** - * mapped size [out] - */ - SceSize mappedSize; - - /** - * memory type [out] - */ - SceKernelMemoryType memoryType; - - SceUInt32 access; -#endif -} SceKernelAllocMemBlockOpt; - typedef struct SceKernelAllocMemBlockOptInternal { SceSize size; SceUInt32 attr; @@ -126,146 +28,13 @@ typedef struct SceKernelAllocMemBlockOptInternal { SceUInt32 reserved[10]; } SceKernelAllocMemBlockOptInternal; -/** - * Enable 'alignment' member - */ -#define SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_HAS_ALIGNMENT 0x00000004U - -#define SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_PHYCONT 0x00200000U - -/** - * Allocating memory block - * - * @param[in] name memory block name - * @param[in] vsize memory block virtual size - * @param[in] flags options - * @retval id UID of memory block - * @retval <SCE_OK Error code - * - */ -SceUID sceKernelAllocMemBlock( - const char *name, - SceKernelMemBlockType type, - SceSize vsize, - const struct SceKernelAllocMemBlockOpt *pOpt); - -/** - * free memory block - * @param[in] uid block uid - */ -int sceKernelFreeMemBlock(SceUID uid); - -/** - * Get base address of memory block. - * @param[in] uid block id - * @param[out] ppBase base address of memory block - * @retval SCE_OK success - * @retval <SCE_OK Error - */ -#if !defined(__INTELLISENSE__) -int sceKernelGetMemBlockBase(SceUID uid, void **ppBase) - __attribute__((__nonnull__(2))); -#else /* !defined(__INTELLISENSE__) */ -int sceKernelGetMemBlockBase(SceUID uid, void **ppBase); -#endif /* !defined(__INTELLISENSE__) */ - -/** - * Find memory block by virtual range (base address and size) - * If size == 0, API returns a memory block which contains 'start' - * If size > 0, API returns a memory block just fit range [start, start + size]. - * @param[in] vaddr base address - * @param[in] size address size - * @retval >=SCE_OK block id - * @retval <SCE_OK error - */ -SceUID sceKernelFindMemBlockByAddr( - void *uaddr, - SceSize size); - -/** - * type for memory block type used in sceKernelAllocMemBlock - */ -typedef int SceKernelMemoryType; - -/** - * information structure for memory block - */ -typedef struct SceKernelMemBlockInfo { - SceSize size; /**< sizeof this */ - void *mappedBase; /**< mapped base address */ - SceSize mappedSize; /**< mapped size */ - - SceKernelMemoryType memoryType; /**< memory type like cache, uncache */ - - SceUInt32 access; /**< memory access permission */ - SceKernelMemBlockType type; /**< Memory Block type */ - -} SceKernelMemBlockInfo; - /*----- memory access permission -----*/ /** - * readable memory - */ -#define SCE_KERNEL_MEMORY_ACCESS_R 0x04U - -/** - * writable memory - */ -#define SCE_KERNEL_MEMORY_ACCESS_W 0x02U - -/** * executable memory */ #define SCE_KERNEL_MEMORY_ACCESS_X 0x01U -/*----- memory type -----*/ - -/** - * uncache normal memory - */ -#define SCE_KERNEL_MEMORY_TYPE_NORMAL_NC 0x80 - -/** - * cache normal memory - */ -#define SCE_KERNEL_MEMORY_TYPE_NORMAL 0xD0 - -/** - * Get memory block information by giving virtual address - * @param[in] vbase base address - * @param[inout] pInfo pointer to information structure - */ -#if !defined(__INTELLISENSE__) -int sceKernelGetMemBlockInfoByAddr( - void *vbase, - SceKernelMemBlockInfo *pInfo) - __attribute__((__nonnull__(1,2), __warn_unused_result__)); -#else /* !defined(__INTELLISENSE__) */ -int sceKernelGetMemBlockInfoByAddr( - void *vbase, - SceKernelMemBlockInfo *pInfo); -#endif /* !defined(__INTELLISENSE__) */ - -/** - * Get memory block informaton by virtuak address range - * @param[in] vbase base address - * @param[in] vsize size - * @param[inout] pInfo information structure - */ -#if !defined(__INTELLISENSE__) -int sceKernelGetMemBlockInfoByRange( - void *vbase, - SceSize vsize, - SceKernelMemBlockInfo *pInfo) - __attribute__((__nonnull__(1,3), __warn_unused_result__)); -#else /* !defined(__INTELLISENSE__) */ -int sceKernelGetMemBlockInfoByRange( - void *vbase, - SceSize vsize, - SceKernelMemBlockInfo *pInfo); -#endif /* !defined(__INTELLISENSE__) */ - #endif /* !defined(_LANGUAGE_ASSEMBLY) */ SCE_CDECL_END |