PatchworkOS  da8a090
A non-POSIX operating system.
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * @brief Interrupt stack configuration.
5 * @ingroup kernel
6 * @def CONFIG_INTERRUPT_STACK_PAGES
7 *
8 * The `CONFIG_INTERRUPT_STACK_PAGES` constant defines the amount of pages that are allocated for the per-CPU interrupt,
9 * exception and doubleFault stacks.
10 *
11 * The interrupt stack can be much much smaller than regular kernel stacks as all interrupt handlers should be as short
12 * as possible and allocate as little memory as possible to reduce the amount of time while preemptions are disabled.
13 */
14#define CONFIG_INTERRUPT_STACK_PAGES 1
15
16/**
17 * @brief Kernel stack configuration.
18 * @ingroup kernel
19 * @def CONFIG_MAX_KERNEL_STACK_PAGES
20 *
21 * The `CONFIG_MAX_KERNEL_STACK_PAGES` constant defines the maximum amount of pages that are allowed to be allocated for
22 * a threads kernel stack, the kernel stack is used while the thread is in kernel space and NOT handling an
23 * exception/interrupt.
24 *
25 */
26#define CONFIG_MAX_KERNEL_STACK_PAGES 100
27
28/**
29 * @brief User stack configuration.
30 * @ingroup kernel
31 * @def CONFIG_MAX_USER_STACK_PAGES
32 *
33 * The `CONFIG_MAX_USER_STACK_PAGES` constant defines the maximum amount of pages that are allowed to be allocated for a
34 * threads user stack, the user stack is used while the thread is in user space.
35 *
36 */
37#define CONFIG_MAX_USER_STACK_PAGES 100
38
39/**
40 * @brief Maximum file descriptor configuration.
41 * @ingroup kernel
42 * @def CONFIG_MAX_FD
43 *
44 * The `CONFIG_MAX_FD` constant defines the maximum amount of file descriptors that a process is allowed to have open.
45 *
46 */
47#define CONFIG_MAX_FD 64
48
49/**
50 * @brief Serial logging configuration.
51 * @ingroup kernel
52 * @def CONFIG_LOG_SERIAL
53 *
54 * The `CONFIG_LOG_SERIAL` constant defines if to output logged strings via serial.
55 *
56 */
57#define CONFIG_LOG_SERIAL true
58
59/**
60 * @brief Maximum note queue configuration.
61 * @ingroup kernel
62 * @def CONFIG_MAX_NOTES
63 *
64 * The `CONFIG_MAX_NOTES` constant defines the maximum length of a threads note queue. If a thread is unable to receive
65 * the notes in time before the queue fills up, then notes will be discarded, unless they are flagged as NOTE_CRITICAL.
66 *
67 */
68#define CONFIG_MAX_NOTES 8
69
70/**
71 * @brief Maximum argument vector configuration.
72 * @ingroup kernel
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 * @ingroup kernel
84 * @def CONFIG_MIN_TIMER_TIMEOUT
85 *
86 * The `CONFIG_MIN_TIMER_TIMEOUT` constant defines the minimum timeout that can be set for timers.
87 *
88 */
89#define CONFIG_MIN_TIMER_TIMEOUT ((CLOCKS_PER_SEC) / 10000)
90
91/**
92 * @brief Time slice configuration.
93 * @ingroup kernel
94 * @def CONFIG_TIME_SLICE
95 *
96 * The `CONFIG_TIME_SLICE` constant defines the default time slice given to threads when they are scheduled.
97 *
98 */
99#define CONFIG_TIME_SLICE ((CLOCKS_PER_SEC / 1000) * 10)
100
101/**
102 * @brief Cache hot threshold configuration.
103 * @ingroup kernel
104 * @def CONFIG_CACHE_HOT_THRESHOLD
105 *
106 * The `CONFIG_CACHE_HOT_THRESHOLD` constant defines the threshold below which a time duration is considered "cache
107 * hot", meaning that the data is likely still in the CPU cache.
108 *
109 */
110#define CONFIG_CACHE_HOT_THRESHOLD ((CLOCKS_PER_SEC / 1000) * 5)
111
112/**
113 * @brief Maximum mutex slow spin configuration.
114 * @ingroup kernel
115 * @def CONFIG_MUTEX_MAX_SLOW_SPIN
116 *
117 * The `CONFIG_MUTEX_MAX_SLOW_SPIN` constant defines the maximum number of iterations a thread will spin before blocking
118 * on a mutex.
119 *
120 */
121#define CONFIG_MUTEX_MAX_SLOW_SPIN 1000
122
123/**
124 * @brief Maximum screen lines configuration.
125 * @ingroup kernel
126 * @def CONFIG_SCREEN_MAX_LINES
127 *
128 * The `CONFIG_SCREEN_MAX_LINES` constant defines the maximum number of lines that the logging system will display.
129 *
130 */
131#define CONFIG_SCREEN_MAX_LINES 256
132
133/**
134 * @brief Maximum bitmap allocator address.
135 * @ingroup kernel
136 * @def CONFIG_PMM_BITMAP_MAX_ADDR
137 *
138 * The `CONFIG_PMM_BITMAP_MAX_ADDR` constant defines the maximum address below which pages will be handled by the bitmap
139 * allocator, pages above this value will be handled by the free stack allocator.
140 *
141 */
142#define CONFIG_PMM_BITMAP_MAX_ADDR 0x4000000ULL
143
144/**
145 * @brief Process reaper interval configuration.
146 * @ingroup kernel
147 * @def CONFIG_PROCESS_REAPER_INTERVAL
148 *
149 * The `CONFIG_PROCESS_REAPER_INTERVAL` constant defines the minimum interval at which the process reaper runs to clean
150 * up zombie processes. It might run less frequently.
151 *
152 */
153#define CONFIG_PROCESS_REAPER_INTERVAL (CLOCKS_PER_SEC * 1)