summaryrefslogtreecommitdiff
path: root/arch/x86/machine/param.h
blob: e7241fd623bbdc03040a6ce42427a0d21cc98a37 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * Copyright (c) 2010, 2011, 2012 Richard Braun.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _X86_PARAM_H
#define _X86_PARAM_H

#include <lib/macros.h>
#include <machine/pmap.h>

#define __LITTLE_ENDIAN__

/*
 * L1 cache line size.
 *
 * XXX Use this value until processor selection is available.
 */
#define CPU_L1_SIZE 64

/*
 * Code/data alignment.
 */
#define TEXT_ALIGN  16
#define DATA_ALIGN  8

/*
 * System timer frequency.
 */
#define HZ 100

/*
 * 4 KiB pages.
 */
#define PAGE_SHIFT  12
#define PAGE_SIZE   (1 << PAGE_SHIFT)
#define PAGE_MASK   (PAGE_SIZE - 1)

/*
 * Kernel stack size for threads and interrupt handlers.
 */
#define STACK_SIZE PAGE_SIZE

/*
 * User space boundaries.
 */
#define VM_MIN_ADDRESS  DECL_CONST(0, UL)

#ifdef __LP64__
#define VM_MAX_ADDRESS  DECL_CONST(0x800000000000, UL)
#else /* __LP64__ */
#define VM_MAX_ADDRESS  DECL_CONST(0xc0000000, UL)
#endif/* __LP64__ */

/*
 * Location of the recursive mapping of PTEs.
 *
 * See the pmap module for more information.
 */
#ifdef __LP64__
#define VM_PMAP_PTEMAP_ADDRESS  DECL_CONST(0xffff800000000000, UL)
#else /* __LP64__ */
#define VM_PMAP_PTEMAP_ADDRESS  VM_MAX_ADDRESS
#endif /* __LP64__ */

/*
 * Kernel space boundaries.
 */
#define VM_MIN_KERNEL_ADDRESS   (VM_PMAP_PTEMAP_ADDRESS + PMAP_PTEMAP_SIZE)

#ifdef __LP64__
#define VM_MAX_KERNEL_ADDRESS   DECL_CONST(0xffffffff80000000, UL)
#else /* __LP64__ */
#define VM_MAX_KERNEL_ADDRESS   DECL_CONST(0xffe00000, UL)
#endif /* __LP64__ */

/*
 * Physical memory properties.
 */
#ifdef __LP64__
#define VM_MAX_PHYS_SEG 2
#define VM_PHYS_NORMAL_LIMIT    DECL_CONST(0x100000000, UL)
#define VM_PHYS_HIGHMEM_LIMIT   DECL_CONST(0x10000000000000, UL)
#else /* __LP64__ */
#ifdef X86_PAE
#define VM_MAX_PHYS_SEG 2
#define VM_PHYS_NORMAL_LIMIT    DECL_CONST(0x100000000, ULL)
#define VM_PHYS_HIGHMEM_LIMIT   DECL_CONST(0x10000000000000, ULL)
#else /* X86_PAE */
#define VM_MAX_PHYS_SEG 1
#define VM_PHYS_NORMAL_LIMIT    DECL_CONST(0xfffff000, UL)
#endif /* X86_PAE */
#endif /* __LP64__ */

/*
 * Number of physical segment lists.
 */
#define VM_NR_PHYS_SEGLIST VM_MAX_PHYS_SEG

/*
 * Segment list priorities.
 */
#define VM_PHYS_SEGLIST_HIGHMEM 1
#define VM_PHYS_SEGLIST_NORMAL  0

/*
 * Virtual space reserved for kernel map entries.
 */
#define VM_MAP_KENTRY_SIZE DECL_CONST(0x800000, UL)

#endif /* _X86_PARAM_H */