-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel.c
More file actions
42 lines (34 loc) · 1.25 KB
/
Copy pathkernel.c
File metadata and controls
42 lines (34 loc) · 1.25 KB
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
#include "screen.h"
#include "util.h"
#include <stdint.h>
#include <stddef.h>
/**
* @brief The main entry point for the CloverOS kernel (kmain).
*
* This function is called by the Assembly boot code after stack setup.
*
* @param magic The Multiboot magic number (pushed by GRUB into EAX).
* @param multiboot_info_addr Address of the Multiboot information structure (pushed by GRUB into EBX).
*/
void kmain(uint32_t magic, uint32_t multiboot_info_addr) {
// 1. Initial Boot Check
// GRUB is expected to pass 0x2BADB002 in EAX
if (magic != 0x2BADB002) {
kpanic("Multiboot check failed. OS requires a compliant bootloader (GRUB).");
}
// Unused variable to avoid Werror 'unused parameter'
(void)multiboot_info_addr;
// 2. Render the Modern UI
render_boot_ui();
// 3. Example of kpanic using a placeholder error
// delay(30000000); // Wait a moment
// 4. Main Kernel Loop / Halt
// Print final message before halting
set_color(vga_entry_color(VGA_COLOR_PASTEL_GREEN, VGA_COLOR_BLACK));
print_at(1, VGA_HEIGHT - 1, "CloverOS has finished booting and is now idle. Halt...");
// Enter infinite loop (System Halt)
__asm__ volatile ("cli");
while (1) {
__asm__ volatile ("hlt");
}
}