blob: e4493e2098a92f73ce34744d6283e8b8389561dd (
about) (
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
|
#ifndef MEMORY_H
#define MEMORY_H
#define POWER_OF_2(EXP) (((uint32_t) 1) << EXP)
#define ALIGN_POWER_OF_2(ADDR, EXP) \
(((ADDR - 1) & ~(POWER_OF_2(EXP) - 1)) + POWER_OF_2(EXP))
#define SECTION_SIZE POWER_OF_2(20)
#define ALIGN_SECTION(ADDR) ALIGN_POWER_OF_2(ADDR, 20)
#define INTERRUPT_VECTOR_TABLE_START ((uint32_t) 0x0)
#define STACK_START ((uint32_t) 0x4000)
#define STACK_END ((uint32_t) 0x8000)
extern const char __end;
extern const char __start;
#define KERNEL_START ((uint32_t) &__start) // this is 0x8000
#define KERNEL_END ((uint32_t) &__end)
// first 2^14 aligned address after the kernel
#define TRANSLATION_TABLE_BASE ALIGN_POWER_OF_2(KERNEL_END, 14)
#define TRANSLATION_TABLE_END \
(TRANSLATION_TABLE_BASE + (uint32_t) (4096 * 4))
#define PRIVILEGED_MEMORY_END ALIGN_SECTION(TRANSLATION_TABLE_END)
#define UNPRIVILEGED_MEMORY_START PRIVILEGED_MEMORY_END
#define UNPRIVILEGED_MEMORY_END \
(UNPRIVILEGED_MEMORY_START + SECTION_SIZE)
#define PL0_SECTION_NUMBER ((uint32_t) 0b101010101010)
#define VIRTUAL_PL0_MEMORY_START (PL0_SECTION_NUMBER << 20)
#endif // MEMORY_H
|