1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     os_MemoryMap.h
4   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law. They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10   $Rev: 32255 $
11  *---------------------------------------------------------------------------
12 
13 
14 */
15 
16 #ifndef NN_OS_CTR_MPCORE_OS_MEMORYMAPPROCESS_H_
17 #define NN_OS_CTR_MPCORE_OS_MEMORYMAPPROCESS_H_
18 
19 
20 #define NN_OS_ADDR_SIZE(name)   (name ## _END - name ## _BEGIN)
21 
22 //--------------------------------------------------
23 // Memory space overall
24 
25 #define NN_OS_ADDR_SPACE_BEGIN  0x00000000
26 #define NN_OS_ADDR_SPACE_END    0x20000000
27 
28 
29 //--------------------------------------------------
30 // Specific memory spaces
31 
32 #define NN_OS_ADDR_NULL_TRAP_BEGIN  NN_OS_ADDR_SPACE_BEGIN
33 #define NN_OS_ADDR_NULL_TRAP_END    NN_OS_ADDR_CODE_BEGIN
34 #define NN_OS_ADDR_NULL_TRAP_SIZE   NN_OS_ADDR_SIZE(NN_OS_ADDR_NULL_TRAP)
35 
36 #define NN_OS_ADDR_CODE_BEGIN       0x00100000
37 #define NN_OS_ADDR_CODE_END         NN_OS_ADDR_LAND_BEGIN
38 #define NN_OS_ADDR_CODE_SIZE        NN_OS_ADDR_SIZE(NN_OS_ADDR_CODE)
39 
40 #define NN_OS_ADDR_LAND_BEGIN       0x04000000
41 #define NN_OS_ADDR_LAND_END         NN_OS_ADDR_HEAP_BEGIN
42 #define NN_OS_ADDR_LAND_SIZE        NN_OS_ADDR_SIZE(NN_OS_ADDR_LAND)
43 
44 #define NN_OS_ADDR_HEAP_BEGIN       0x08000000
45 #define NN_OS_ADDR_HEAP_END         NN_OS_ADDR_STACK_BEGIN
46 #define NN_OS_ADDR_HEAP_SIZE        NN_OS_ADDR_SIZE(NN_OS_ADDR_HEAP)
47 
48 #define NN_OS_ADDR_STACK_BEGIN      0x0E000000
49 #define NN_OS_ADDR_STACK_END        NN_OS_ADDR_SHARED_BEGIN
50 #define NN_OS_ADDR_STACK_SIZE       NN_OS_ADDR_SIZE(NN_OS_ADDR_STACK)
51 
52 #define NN_OS_ADDR_SHARED_BEGIN     0x10000000
53 #define NN_OS_ADDR_SHARED_END       NN_OS_ADDR_CONTINUOUS_BEGIN
54 #define NN_OS_ADDR_SHARED_SIZE      NN_OS_ADDR_SIZE(NN_OS_ADDR_SHARED)
55 
56 #define NN_OS_ADDR_CONTINUOUS_BEGIN 0x14000000
57 #define NN_OS_ADDR_CONTINUOUS_END   NN_OS_ADDR_RESERVED_BEGIN
58 #define NN_OS_ADDR_CONTINUOUS_SIZE  NN_OS_ADDR_SIZE(NN_OS_ADDR_CONTINUOUS)
59 
60 #define NN_OS_ADDR_RESERVED_BEGIN   0x1C000000
61 #define NN_OS_ADDR_RESERVED_END     NN_OS_ADDR_SPACE_END
62 #define NN_OS_ADDR_RESERVED_SIZE    NN_OS_ADDR_SIZE(NN_OS_ADDR_RESERVED)
63 
64 
65 //--------------------------------------------------
66 // Specific reserved regions
67 
68 #define NN_OS_ADDR_USER_BEGIN               NN_OS_ADDR_HEAP_BEGIN
69 #define NN_OS_ADDR_USER_END                 NN_OS_ADDR_SHARED_END
70 
71 #define NN_OS_ADDR_VRAM_BEGIN               0x1F000000
72 #define NN_OS_ADDR_VRAM_END                 (NN_OS_ADDR_VRAM_BEGIN + NN_OS_ADDR_VRAM_SIZE)
73 #if    defined(NN_HARDWARE_CTR_TEG2)
74     #define NN_OS_ADDR_VRAM_SIZE            0x00400000
75 #else
76     #define NN_OS_ADDR_VRAM_SIZE            0x00600000
77 #endif
78 
79 #define NN_OS_ADDR_DSP_WRAM_BEGIN           0x1FF00000
80 #define NN_OS_ADDR_DSP_WRAM_END             (NN_OS_ADDR_DSP_WRAM_BEGIN + NN_OS_ADDR_DSP_WRAM_SIZE)
81 #define NN_OS_ADDR_DSP_WRAM_SIZE            0x00080000
82 
83 #define NN_OS_ADDR_READONLY_SHARED_PAGE     0x1FF80000
84 #define NN_OS_ADDR_WRITABLE_SHARED_PAGE     0x1FF81000
85 
86 #define NN_OS_ADDR_THREAD_LOCAL_REGION_BEGIN    0x1FF82000
87 #define NN_OS_ADDR_THREAD_LOCAL_REGION_END      NN_OS_ADDR_RESERVED_END
88 #define NN_OS_ADDR_THREAD_LOCAL_REGION_SIZE     NN_OS_ADDR_SIZE(NN_OS_ADDR_THREAD_LOCAL_REGION)
89 
90 
91 #endif /* NN_OS_CTR_MPCORE_OS_MEMORYMAPPROCESS_H_ */
92