|
My Kernel v0.1.0
|

Modules | |
| Console | |
| Devices | |
| Kernel Device/Driver API. | |
| Errors | |
| Executable file format | |
| Interrputs | |
| Arch - x86 | |
| Kernel dynamic allocator | |
| Logger | |
| Memory Constants | |
| Memory Management Unit | |
| Networking | |
| Physical Memory Manager | |
| Scheduling | |
| Scheduler implementation. | |
| Semaphore | |
| Semaphore. | |
| Kernel Symbols | |
| Syscalls | |
| Filesystem | |
| Virtual Memory Manager | |
Data Structures | |
| struct | spinlock |
| Spinlock. More... | |
Macros | |
| #define | __SPINLOCK_INIT |
| Default init value (unlocked) | |
| #define | __INIT_SPINLOCK(_lock) _lock = __SPINLOCK_INIT |
| Initialize a spinlock. | |
| #define | DECLARE_SPINLOCK(_lock) spinlock_t _lock = SPINLOCK_INIT |
| Declare a spinlock and initialize it. | |
| #define | locked_scope(_lock) |
| Define a scope that is guarded by a spinlock. More... | |
Functions | |
| static ALWAYS_INLINE spinlock_t * | __spinlock_acquire (spinlock_t *lock, vaddr_t owner) |
| Try to acquire a spinlock, or wait until it is free. | |
| static ALWAYS_INLINE void | spinlock_release (spinlock_t *lock) |
| Release a spinlock for others to take it. | |
This is a kernel (not micro nor monolithic yet), written from scratch on my free time to learn more about systems and OS designs.
This kernel serves only one purpose: learning.
The implementations and design choices are likely to be ... questionable, but this is part of the process. There exists better sources of inspiration and better examples than this project.
I try to keep arcihtecture specific code and what can be generic separated. You can find the architecture depedent code (specific structures, devices, mechanisms ...) inside the kernel/arch folder.
| #define locked_scope | ( | _lock | ) |
This is particularily useful when taking and releasing a lock in a sequential manner. For example:
locked_scope(&list_lock) { llist_add(&global_list, &new_item); }
In this example the list_lock spinlock will automatically be taken when entering the scope, and also automatically released when leaving.
WARNING: As this macro uses a for loop to function, any 'break' directive placed inside it will break out of the guarded scope instead of that of its containing loop.