psl1ght
A free SDK for Sony's PS3 console
memory.h
Go to the documentation of this file.
1 
5 #ifndef __SYS_MEMORY_H__
6 #define __SYS_MEMORY_H__
7 
8 #include <ppu-lv2.h>
9 #include <lv2/memory.h>
10 
11 #define SYS_MEMORY_PAGE_SIZE_1M 0x0000000000000400ULL
12 #define SYS_MEMORY_PAGE_SIZE_64K 0x0000000000000200ULL
13 
14 #define SYS_MEMORY_ACCESS_RIGHT_PPU_THR 0x0000000000000008ULL
15 #define SYS_MEMORY_ACCESS_RIGHT_HANDLER 0x0000000000000004ULL
16 #define SYS_MEMORY_ACCESS_RIGHT_SPU_THR 0x0000000000000002ULL
17 #define SYS_MEMORY_ACCESS_RIGHT_RAW_SPU 0x0000000000000001ULL
18 #define SYS_MEMORY_ACCESS_RIGHT_ANY (SYS_MEMORY_ACCESS_RIGHT_PPU_THR | \
19  SYS_MEMORY_ACCESS_RIGHT_HANDLER | \
20  SYS_MEMORY_ACCESS_RIGHT_SPU_THR | \
21  SYS_MEMORY_ACCESS_RIGHT_RAW_SPU)
22 #define SYS_MEMORY_ACCESS_RIGHT_NONE 0x00000000000000f0ULL
23 
24 #define SYS_MEMORY_PROT_READ_ONLY 0x0000000000080000ULL
25 #define SYS_MEMORY_PROT_READ_WRITE 0x0000000000040000ULL
26 
27 #ifdef __cplusplus
28  extern "C" {
29 #endif
30 
31 LV2_SYSCALL sysMemoryAllocate(size_t size,u64 flags,sys_mem_addr_t *alloc_addr)
32 {
33  lv2syscall3(348,size,flags,(u64)alloc_addr);
34  return_to_user_prog(s32);
35 }
36 
37 LV2_SYSCALL sysMemoryFree(sys_mem_addr_t start_addr)
38 {
39  lv2syscall1(349,start_addr);
40  return_to_user_prog(s32);
41 }
42 
43 LV2_SYSCALL sysMMapperAllocateAddress(size_t size,u64 flags,size_t alignment,sys_mem_addr_t *alloc_addr)
44 {
45  lv2syscall4(330,size,flags,alignment,(u64)alloc_addr);
46  return_to_user_prog(s32);
47 }
48 
49 LV2_SYSCALL sysMMapperFreeAddress(sys_mem_addr_t start_addr)
50 {
51  lv2syscall1(331,start_addr);
52  return_to_user_prog(s32);
53 }
54 
55 LV2_SYSCALL sysMMapperSearchAndMap(sys_mem_addr_t start_addr,sys_mem_id_t mem_id,u64 flags,sys_mem_addr_t *alloc_addr)
56 {
57  lv2syscall4(337,start_addr,mem_id,flags,(u64)alloc_addr);
58  return_to_user_prog(s32);
59 }
60 
61 LV2_SYSCALL sysMemContainerCreate(sys_mem_container_t *container,size_t size)
62 {
63  lv2syscall2(324,(u64)container,size);
64  return_to_user_prog(s32);
65 }
66 
67 LV2_SYSCALL sysMemContainerDestroy(sys_mem_container_t container)
68 {
69  lv2syscall1(325,container);
70  return_to_user_prog(s32);
71 }
72 
73 LV2_SYSCALL sysMemAllocateFromContainer(size_t size,sys_mem_container_t container,u64 flags,sys_mem_addr_t *alloc_addr)
74 {
75  lv2syscall4(350,size,container,flags,(u64)alloc_addr);
76  return_to_user_prog(s32);
77 }
78 
79 #ifdef __cplusplus
80  }
81 #endif
82 
83 #endif
Memory management functions.