Fixed behavior of VTerm when driver is set at runtime
[tpg/acess2.git] / Kernel / arch / x86_64 / include / mm_virt.h
1 /*
2  * Acess2 x86_64 Architecture Code
3  *
4  * This file is published under the terms of the Acess Licence.
5  * See the file COPYING for more details
6  *
7  * vmem.h - Virtual Memory Functions & Definitions
8  */
9 #ifndef _VMEM_H_
10 #define _VMEM_H_
11
12 #include <arch.h>
13
14 // === Memory Location Definitions ===
15 /*
16  * Userland - Lower Half
17  * Kernel land - Upper Half
18  * 
19  *    START ADDRESS          END ADDRESS       BITS   SIZE      NAME
20  * 0x00000000 00000000 - 0x00007FFF FFFFFFFF    47      128 TiB User Space
21  * 0x00008000 00000000 - 0xFFFF7FFF FFFFFFFF    --- SIGN EXTENSION NULL ZONE
22  * 0xFFFF8000 00000000 - 0xFFFFFFFF FFFFFFFF    47      128     TiB     Kernel Range
23  *       8000 00000000 -       9000 00000000    42      16      TiB     Kernel Heap
24  *       9000 00000000 -       9800 00000000    43      8       TiB     Module Space
25  *       9800 00000000 -       9A00 00000000    41      2       TiB     Kernel VFS
26  *       ---- GAP ----                                  6       TiB
27  *       A000 00000000 -       B000 00000000    44      16      TiB     Kernel Stacks
28  *       C000 00000000 -       D000 00000000    44      16      TiB     Hardware Mappings
29  *       D000 00000000 -       D080 00000000    39      512     GiB     Per-Process Data
30  *       D080 00000000 -       D100 00000000    39      512     GiB     Kernel Supplied User Code
31  *       ---- GAP ----                                  15      TiB
32  *       E000 00000000 -       E400 00000000    42      4       TiB     Physical Page Reference Counts (2**40 = 2**52 bytes)
33  *       E400 00000000 -       E480 00000000    39      512     GiB     Physical Page Bitmap (1 page per bit)
34  *       E480 00000000 -       E500 00000000    39      512     GiB     Physical Page DblAlloc Bitmap (1 page per bit)
35  *       E500 00000000 -       E500 80000000    31      2       GiB     Physical Page Super Bitmap (64 pages per bit)
36  *       ---- GAP ----                                  9       TiB
37  *       FE00 00000000 -       FE80 00000000    39      512     GiB     Fractal Mapping (PML4 508)
38  *       FE80 00000000 -       FF00 00000000    39      512     GiB     Temp Fractal Mapping
39  *       ---- GAP ----                                  512     GiB     -- UNUSED --
40  *       FF80 00000000 -       FF80 80000000    39      2       GiB     Local APIC
41  *       ---- GAP ----
42  *       FFFF 00000000 -       FFFF 80000000    31      2       GiB     User Code
43  *       FFFF 80000000 -       FFFF FFFFFFFF    31      2       GiB     Identity Map
44  */
45
46 #define MM_USER_MIN     0x00000000##00010000
47 #define USER_LIB_MAX    0x00007000##00000000
48 #define USER_STACK_SZ   0x00000000##00020000    // 64 KiB
49 #define USER_STACK_TOP  0x00007FFF##FFFFF000
50 #define MM_USER_MAX     0x00007FFF##FFFFF000
51 #define MM_KERNEL_RANGE 0xFFFF8000##00000000
52 #define MM_KHEAP_BASE   (MM_KERNEL_RANGE|(0x8000##00000000))
53 #define MM_KHEAP_MAX    (MM_KERNEL_RANGE|(0x9000##00000000))
54 #define MM_MODULE_MIN   (MM_KERNEL_RANGE|(0x9000##00000000))
55 #define MM_MODULE_MAX   (MM_KERNEL_RANGE|(0x9800##00000000))
56 #define MM_KERNEL_VFS   (MM_KERNEL_RANGE|(0x9800##00000000))
57 #define MM_KSTACK_BASE  (MM_KERNEL_RANGE|(0xA000##00000000))
58 #define MM_KSTACK_TOP   (MM_KERNEL_RANGE|(0xB000##00000000))
59
60 #define MM_HWMAP_BASE   (MM_KERNEL_RANGE|(0xC000##00000000))
61 #define MM_HWMAP_TOP    (MM_KERNEL_RANGE|(0xD000##00000000))
62 #define MM_PPD_BASE     (MM_KERNEL_RANGE|(0xD000##00000000))
63 #define MM_PPD_CFG      MM_PPD_BASE
64 #define MM_PPD_VFS      (MM_KERNEL_RANGE|(0xD008##00000000))
65 #define MM_USER_CODE    (MM_KERNEL_RANGE|(0xD080##00000000))
66
67 #define MM_PAGE_COUNTS  (MM_KERNEL_RANGE|(0xE000##00000000))
68 #define MM_PAGE_BITMAP  (MM_KERNEL_RANGE|(0xE400##00000000))
69 #define MM_PAGE_DBLBMP  (MM_KERNEL_RANGE|(0xE480##00000000))
70 #define MM_PAGE_SUPBMP  (MM_KERNEL_RANGE|(0xE500##00000000))
71
72 #define MM_FRACTAL_BASE (MM_KERNEL_RANGE|(0xFE00##00000000))
73 #define MM_TMPFRAC_BASE (MM_KERNEL_RANGE|(0xFE80##00000000))
74 #define MM_LOCALAPIC    (MM_KERNEL_RANGE|(0xFF80##00000000))
75
76
77 // === FUNCTIONS ===
78 void    MM_FinishVirtualInit(void);
79 tVAddr  MM_NewKStack(void);
80 tVAddr  MM_Clone(void);
81 tVAddr  MM_NewWorkerStack(void);
82
83 #endif

UCC git Repository :: git.ucc.asn.au