AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
mm.h
Go to the documentation of this file.
1
#ifndef _AARCH64_MM_H
2
#define _AARCH64_MM_H
3
4
#include <
core/system.h
>
5
6
/*
7
* aarch64's address space: user space is the lower half (TTBR0_EL1, 48
8
* bits), and the kernel the upper half (TTBR1_EL1). In the upper half,
9
* all physical memory is mapped at ARCH_DMAP_BASE (the direct map), with
10
* the kernel in it (linked at _VMA plus its physical address); then come
11
* the kernel's heap, its small objects, and the window for devices'
12
* registers.
13
*/
14
#define ARCH_DMAP_BASE (0xFFFF000000000000ULL)
15
#define ARCH_KVMEM_BASE (0xFFFF800000000000ULL)
16
#define ARCH_KVMEM_SIZE (1ULL << 30)
/* 1 GiB */
17
#define ARCH_SLAB_BASE (0xFFFF900000000000ULL)
18
#define ARCH_SLAB_SIZE (16ULL << 30)
/* 16 GiB */
19
#define ARCH_MMIO_BASE (0xFFFFA00000000000ULL)
/* devices' registers */
20
#define ARCH_MMIO_SIZE (64ULL << 30)
/* 64 GiB */
21
22
/* How much physical memory the boot tables map (boot/head.S). */
23
#define ARCH_BOOT_MAPPED (4ULL << 30)
24
25
/* A physical address's kernel address, in the direct map. */
26
#define PHYS2VIRT(paddr) ((void *) (ARCH_DMAP_BASE + (uintptr_t) (paddr)))
27
28
extern
char
_VMA
;
/* the linker script's offset of the kernel's addresses */
29
30
/* The kernel address of something in the kernel's image, from its
31
* physical address (VMA()), and the other way around (LMA()), as on x86. */
32
#define __VMA_ADD(obj, op) ((uintptr_t) (obj) op (uintptr_t) &_VMA)
33
#define __VMA_TYPED(obj, op) \
34
__builtin_choose_expr(sizeof(obj) == sizeof(uintptr_t), \
35
(typeof(obj)) __VMA_ADD(obj, op), __VMA_ADD(obj, op))
36
#define VMA(obj) __VMA_TYPED(obj, +)
37
#define LMA(obj) __VMA_TYPED(obj, -)
38
39
typedef
uint64_t
paddr_t
;
40
typedef
uint64_t
vaddr_t
;
41
43
static
inline
void
tlb_flush
(
void
)
44
{
45
asm
volatile
(
"dsb ishst; tlbi vmalle1; dsb ish; isb"
:::
"memory"
);
46
}
47
48
#include_next <mm/mm.h>
49
50
#endif
/* ! _AARCH64_MM_H */
paddr_t
uint64_t paddr_t
Definition
mm.h:39
_VMA
char _VMA
tlb_flush
static void tlb_flush(void)
Flushes every translation from this CPU's TLB.
Definition
mm.h:43
vaddr_t
uint64_t vaddr_t
Definition
mm.h:40
system.h
uint64_t
unsigned long long int uint64_t
Definition
stddef.h:23
kernel
arch
aarch64
include
mm
mm.h
Generated by
1.18.0