blob: f87a864fb55682c0ba6738ee1e9eb11347cc17be (
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
|
# Lume
> Luminescence in the Deep Night
Lume is a multitasking operating system kernel built for the RISC-V 64 architecture.Developed from the ground up, it was created to explore the art of modern operating system.
## Architecture Overview
The initialization sequence of Lume follows modern OS design principles:
* 1.Boot: entry.asm sets up the initial stack and prepares the C++ environment.
* 2.Discovery: The FDT parser probes the DTB for hardware layout information.
* 3.Memory: Establishes physical and virtual memory mappings.
* 4.Asynchrony: Installs the Trap Handler and enables the SBI timer interrupt.
* 5.Concurrency: Initializes the Process Manager and enters the scheduler loop to run tasks.
## Roadmap
### Phase 1: Foundation (Current Status)
- [x] Bootloader & Entry: Successful hand-off from OpenSBI to Kernel.
- [x] FDT Parsing: Dynamic hardware discovery via Device Tree.
- [x] Physical Memory Management: Basic page-frame allocator.
- [x] Basic Traps: Handling supervisor-mode exceptions and interrupts.
### Phase 2: Memory & Process Management
- [x] Virtual Memory: Full SV39 page table implementation with kernel/user space separation.
- [ ] Slab Allocator: Efficient kernel-level object allocation (kmalloc).
- [ ] Process Lifecycle: Implementation of fork(), exec(), and exit().
- [x] Preemptive Scheduling: Priority-based or Round-robin scheduler.
### Phase 3: I/O & File System
- [ ] VirtIO Drivers: Support for VirtIO-Block and VirtIO-Net devices.
- [ ] Virtual File System (VFS): Abstract layer for multiple file system support.
- [ ] Initial Ramdisk (initrd): Loading a basic user-space environment during boot.
- [ ] Fat32/Ext2 Support: Persistent storage capabilities.
Phase 4: User Space & Stability
- [ ] System Call Interface: Standardized API for user-space applications.
- [ ] User-mode Shell: A basic CLI to interact with the kernel.
- [ ] Multicore (SMP): Booting secondary harts and implementing spinlocks/mutexes.
- [ ] C Standard Library (nolibc): Providing a runtime for user-level C programs.
## Quick Start
### Requirements
* riscv64-linux-gnu-gcc toolchain
* QEMU (riscv64)
### Build and Run
~~~bash
make clean
make all
make run
~~~
When you see the following output, Lumen has successfully illuminated your hardware:
~~~bash
[Lume OS Kernel] Booted in S-Mode.
2025 Richard Qin
[Boot] Kernel started.
PMM: Initializing from[Boot] PMM initialized.
[Boot] Kernel page table created.
[Boot] MMU ENABLED! We are now using virtual addresses.
[Trap] Initialized stvec to: 0x0000000080200090
[Boot] Trap Handler Installed.
[Boot] Timer Interrupt Enabled.
[Boot] ProcManager Initialized.
[Proc] Created thread: Task A
[Proc] Created thread: Task B
[Kernel] Scheduler Starting...
[Proc] Scheduler started.
...
~~~
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
##
Richard Qin Dec 2025
|