PatchworkOS
19e446b
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* @brief Kernel configuration.
5
* @ingroup kernel
6
* @defgroup kernel_config Configuration
7
*
8
* @{
9
*/
10
11
/**
12
* @brief Interrupt stack configuration.
13
* @def CONFIG_INTERRUPT_STACK_PAGES
14
*
15
* The `CONFIG_INTERRUPT_STACK_PAGES` constant defines the amount of pages that are allocated for the per-CPU interrupt,
16
* exception and doubleFault stacks.
17
*
18
* The interrupt stack can be much much smaller than regular kernel stacks as all interrupt handlers should be as short
19
* as possible and allocate as little memory as possible to reduce the amount of time while preemptions are disabled.
20
*/
21
#define CONFIG_INTERRUPT_STACK_PAGES 1
22
23
/**
24
* @brief Kernel stack configuration.
25
* @def CONFIG_MAX_KERNEL_STACK_PAGES
26
*
27
* The `CONFIG_MAX_KERNEL_STACK_PAGES` constant defines the maximum amount of pages that are allowed to be allocated for
28
* a threads kernel stack, the kernel stack is used while the thread is in kernel space and NOT handling an
29
* exception/interrupt.
30
*
31
*/
32
#define CONFIG_MAX_KERNEL_STACK_PAGES 100
33
34
/**
35
* @brief User stack configuration.
36
* @def CONFIG_MAX_USER_STACK_PAGES
37
*
38
* The `CONFIG_MAX_USER_STACK_PAGES` constant defines the maximum amount of pages that are allowed to be allocated for a
39
* threads user stack, the user stack is used while the thread is in user space.
40
*
41
*/
42
#define CONFIG_MAX_USER_STACK_PAGES 100
43
44
/**
45
* @brief Maximum file descriptor configuration.
46
* @def CONFIG_MAX_FD
47
*
48
* The `CONFIG_MAX_FD` constant defines the maximum amount of file descriptors that a process is allowed to have open.
49
*
50
*/
51
#define CONFIG_MAX_FD 64
52
53
/**
54
* @brief Serial logging configuration.
55
* @def CONFIG_LOG_SERIAL
56
*
57
* The `CONFIG_LOG_SERIAL` constant defines if to output logged strings via serial.
58
*
59
*/
60
#define CONFIG_LOG_SERIAL true
61
62
/**
63
* @brief Maximum note queue configuration.
64
* @def CONFIG_MAX_NOTES
65
*
66
* The `CONFIG_MAX_NOTES` constant defines the maximum length of a threads note queue.
67
*
68
*/
69
#define CONFIG_MAX_NOTES 8
70
71
/**
72
* @brief Maximum argument vector configuration.
73
* @def CONFIG_MAX_ARGC
74
*
75
* The `CONFIG_MAX_ARGC` constant defines the maximum amount of arguments that can be passed to a process via its
76
* argument vector. Used to avoid vulnerabilities where extremely large argument vectors are passed to processes.
77
*
78
*/
79
#define CONFIG_MAX_ARGC 512
80
81
/**
82
* @brief Minimum timer timeout configuration.
83
* @def CONFIG_MIN_TIMER_TIMEOUT
84
*
85
* The `CONFIG_MIN_TIMER_TIMEOUT` constant defines the minimum timeout that can be set for timers.
86
*
87
*/
88
#define CONFIG_MIN_TIMER_TIMEOUT ((CLOCKS_PER_SEC) / 10000)
89
90
/**
91
* @brief Time slice configuration.
92
* @def CONFIG_TIME_SLICE
93
*
94
* The `CONFIG_TIME_SLICE` constant defines the default time slice given to threads when they are scheduled.
95
*
96
*/
97
#define CONFIG_TIME_SLICE ((CLOCKS_PER_MS) * 10)
98
99
/**
100
* @brief Cache hot threshold configuration.
101
* @def CONFIG_CACHE_HOT_THRESHOLD
102
*
103
* The `CONFIG_CACHE_HOT_THRESHOLD` constant defines the threshold below which a time duration is considered "cache
104
* hot", meaning that the data is likely still in the CPU cache.
105
*
106
*/
107
#define CONFIG_CACHE_HOT_THRESHOLD ((CLOCKS_PER_MS) * 5)
108
109
/**
110
* @brief Maximum mutex slow spin configuration.
111
* @def CONFIG_MUTEX_MAX_SLOW_SPIN
112
*
113
* The `CONFIG_MUTEX_MAX_SLOW_SPIN` constant defines the maximum number of iterations a thread will spin before blocking
114
* on a mutex.
115
*
116
*/
117
#define CONFIG_MUTEX_MAX_SLOW_SPIN 1000
118
119
/**
120
* @brief Maximum screen lines configuration.
121
* @def CONFIG_SCREEN_MAX_LINES
122
*
123
* The `CONFIG_SCREEN_MAX_LINES` constant defines the maximum number of lines that the logging system will display.
124
*
125
*/
126
#define CONFIG_SCREEN_MAX_LINES 256
127
128
/**
129
* @brief Maximum bitmap allocator address.
130
* @def CONFIG_PMM_BITMAP_MAX_ADDR
131
*
132
* The `CONFIG_PMM_BITMAP_MAX_ADDR` constant defines the maximum address below which pages will be handled by the bitmap
133
* allocator, pages above this value will be handled by the free stack allocator.
134
*
135
*/
136
#define CONFIG_PMM_BITMAP_MAX_ADDR 0x4000000ULL
137
138
/**
139
* @brief Process reaper interval configuration.
140
* @def CONFIG_PROCESS_REAPER_INTERVAL
141
*
142
* The `CONFIG_PROCESS_REAPER_INTERVAL` constant defines the minimum interval at which the process reaper runs to clean
143
* up zombie processes. It might run less frequently.
144
*
145
*/
146
#define CONFIG_PROCESS_REAPER_INTERVAL (CLOCKS_PER_SEC * 1)
147
148
/**
149
* @brief Maximum environment variables configuration.
150
* @def CONFIG_MAX_ENV_VARS
151
*
152
* The `CONFIG_MAX_ENV_VARS` constant defines the maximum number of environment variables that a process can have.
153
*
154
*/
155
#define CONFIG_MAX_ENV_VARS 4096
156
157
/**
158
* @brief Kernel log buffer size configuration.
159
* @def CONFIG_LOG_KLOG_BUFFER_SIZE
160
*
161
* The `CONFIG_LOG_KLOG_BUFFER_SIZE` constant defines the size of the buffer used for the `/dev/klog` file.
162
*
163
*/
164
#define CONFIG_KLOG_SIZE 0x4000
165
166
/**
167
* @brief Per-CPU data size configuration.
168
* @def CONFIG_PERCPU_SIZE
169
*
170
* The `CONFIG_PERCPU_SIZE` constant defines the size allocated for per-CPU data.
171
*
172
*/
173
#define CONFIG_PERCPU_SIZE 0x10000
174
175
/**
176
* @brief Maximum wait queues configuration.
177
* @def CONFIG_MAX_WAIT_QUEUES
178
*
179
* The `CONFIG_MAX_WAIT_QUEUES` constant defines the maximum amount of wait queues that a thread can wait on
180
* simultaneously.
181
*
182
*/
183
#define CONFIG_MAX_WAIT_QUEUES 64
184
185
/**
186
* @brief Maximum rings configuration.
187
* @def CONFIG_MAX_RINGS
188
*
189
* The `CONFIG_MAX_RINGS` constant defines the maximum amount of asynchronous rings that each process can have.
190
*
191
*/
192
#define CONFIG_MAX_RINGS 8
193
194
/**
195
* @brief Maximum async ring pages configuration.
196
* @def CONFIG_MAX_RINGS_PAGES
197
*
198
* The `CONFIG_MAX_RINGS_PAGES` constant defines the maximum amount of pages that can be allocated for a async rings
199
* buffer.
200
*
201
*/
202
#define CONFIG_MAX_RINGS_PAGES 1024
203
204
/** @} */
include
kernel
config.h
Generated on Sat Jan 24 2026 10:59:24 for PatchworkOS by
1.9.8