diff options
| author | 2014-04-17 23:05:31 -0400 | |
|---|---|---|
| committer | 2014-04-17 23:05:31 -0400 | |
| commit | b2baafaf8ba760ce2b975391fd04db52ad386e29 (patch) | |
| tree | db16aba20508121cd0d6d7cd489d1e1963b67525 /src/core/mem_map.h | |
| parent | fixed bug in Memory::GetPointer (diff) | |
| download | yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.tar.gz yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.tar.xz yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.zip | |
added GSP heap memory allocation
Diffstat (limited to 'src/core/mem_map.h')
| -rw-r--r-- | src/core/mem_map.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/mem_map.h b/src/core/mem_map.h index 9931daece..ab1eb2606 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h | |||
| @@ -49,6 +49,23 @@ enum { | |||
| 49 | 49 | ||
| 50 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 50 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 51 | 51 | ||
| 52 | /// Represents a block of heap memory mapped by ControlMemory | ||
| 53 | struct HeapBlock { | ||
| 54 | HeapBlock() : base_address(0), address(0), size(0), operation(0), permissions(0) { | ||
| 55 | } | ||
| 56 | u32 base_address; | ||
| 57 | u32 address; | ||
| 58 | u32 size; | ||
| 59 | u32 operation; | ||
| 60 | u32 permissions; | ||
| 61 | |||
| 62 | const u32 GetVirtualAddress() const{ | ||
| 63 | return base_address + address; | ||
| 64 | } | ||
| 65 | }; | ||
| 66 | |||
| 67 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 68 | |||
| 52 | // Base is a pointer to the base of the memory map. Yes, some MMU tricks | 69 | // Base is a pointer to the base of the memory map. Yes, some MMU tricks |
| 53 | // are used to set up a full GC or Wii memory map in process memory. on | 70 | // are used to set up a full GC or Wii memory map in process memory. on |
| 54 | // 32-bit, you have to mask your offsets with 0x3FFFFFFF. This means that | 71 | // 32-bit, you have to mask your offsets with 0x3FFFFFFF. This means that |
| @@ -81,6 +98,14 @@ void Write32(const u32 addr, const u32 data); | |||
| 81 | 98 | ||
| 82 | u8* GetPointer(const u32 Address); | 99 | u8* GetPointer(const u32 Address); |
| 83 | 100 | ||
| 101 | /** | ||
| 102 | * Maps a block of memory on the GSP heap | ||
| 103 | * @param size Size of block in bytes | ||
| 104 | * @param operation Control memory operation | ||
| 105 | * @param permissions Control memory permissions | ||
| 106 | */ | ||
| 107 | u32 MapBlock_HeapGSP(u32 size, u32 operation, u32 permissions); | ||
| 108 | |||
| 84 | inline const char* GetCharPointer(const u32 address) { | 109 | inline const char* GetCharPointer(const u32 address) { |
| 85 | return (const char *)GetPointer(address); | 110 | return (const char *)GetPointer(address); |
| 86 | } | 111 | } |