aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/mem_map.h
blob: 945815cd62ac0d404bb0f3095ffaa240d70d59ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include "common/common_types.h"

namespace Memory {

extern u8* g_exefs_code;  ///< ExeFS:/.code is loaded here
extern u8* g_heap;        ///< Application heap (main memory)
extern u8* g_shared_mem;  ///< Shared memory
extern u8* g_heap_linear; ///< Linear heap (main memory)
extern u8* g_vram;        ///< Video memory (VRAM)
extern u8* g_dsp_mem;     ///< DSP memory
extern u8* g_tls_mem;     ///< TLS memory

void Init();
void Shutdown();

/**
 * Maps a block of memory on the heap
 * @param size Size of block in bytes
 * @param operation Memory map operation type
 * @param permissions Memory allocation permissions
 */
u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions);

/**
 * Maps a block of memory on the GSP heap
 * @param size Size of block in bytes
 * @param operation Memory map operation type
 * @param permissions Control memory permissions
 */
u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions);

/**
 * Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical
 * address. This should be used by services to translate addresses for use by the hardware.
 */
PAddr VirtualToPhysicalAddress(VAddr addr);

/**
 * Undoes a mapping performed by VirtualToPhysicalAddress().
 */
VAddr PhysicalToVirtualAddress(PAddr addr);

} // namespace