]> git.buserror.net Git - polintos/scott/priv.git/blob - kernel/include/arch-x64/mem.h
Initial checkin from Perforce.
[polintos/scott/priv.git] / kernel / include / arch-x64 / mem.h
1 #ifndef _ARCH_MEM_H
2 #define _ARCH_MEM_H
3
4 #include <kern/types.h>
5 #include <arch/paging.h>
6
7 extern int _end;
8
9 namespace Mem {
10         class PageAllocZone;
11 };
12
13 namespace Arch {
14         // First and last+1 pages of memory, as page numbers.  Small holes are
15         // ignored; large holes will require discontiguous memory support.
16         
17         static const size_t mem_start = 0;
18         extern size_t mem_end;
19         
20         static const uintptr_t highzonestart = 4UL*1024*1024*1024 / page_size;
21         static const uintptr_t dma32zonestart = 16*1024*1024 / page_size;
22
23         extern Mem::PageAllocZone *pagezones[];
24         extern Mem::PageAllocZone **pagezonelists[3];
25
26         extern uintptr_t next_free_bootmem;
27         
28         namespace Priv {
29                 struct Descriptor {
30                         u16 limit_low;
31                         u16 base_low;
32                         u8 base_mid;
33                         u8 type:4;
34                         u8 user:1;
35                         u8 dpl:2;
36                         u8 present:1;
37                         u8 limit_high:4;
38                         u8 sw:1;
39                         u8 code64:1;
40                         u8 opsize:1;
41                         u8 gran:1;
42                         u8 base_high;
43                 };
44
45                 extern Mem::PageAllocZone isadmazone, dma32zone, highzone;
46
47                 void early_adjust_mappings();
48
49                 // Call after mem_end is set.
50                 void map_physmem();
51         }
52 }
53
54 extern Arch::Priv::Descriptor x64_gdt[1024];
55
56 #endif