feat(rust): Implement Rust-for-SUB-OS kernel layer, ChaCha20 crypto, HWMON thermal governor, and lazybox applets

- Add freestanding no_std Rust kernel layer compiled with rustc
- Implement memory-safe ChaCha20 RFC-8439 stream cipher and CSPRNG in Rust
- Implement intelligent thermal fan speed governor in Rust
- Add printk macro bridge (kprint!, kprintln!) for Rust
- Register 'rustinfo' and 'chacha20' LazyBox applets
- Enable x86_64 hardware FPU & SSE (CR4.OSFXSR/OSXMMEXCPT)
- Add cross-architecture C-bridge for ARM targets
- Update stage2.asm kernel sector copy bounds to 448 KB
This commit is contained in:
subhobhai943 committed 2026-08-18 12:44:25 +05:30
1 parent 20bd992876
commit 24deed8ead
13 files changed
+433 -10

No files matched your search

+13
View File
@@ -7,11 +7,24 @@
#include <arch/x86_64/cpuid.h>
#include <kernel/timer.h>
static void enable_fpu_sse(void) {
uint64_t cr0, cr4;
__asm__ volatile ("mov %%cr0, %0" : "=r"(cr0));
cr0 &= ~(1ULL << 2); // Clear EM (x87 emulation)
cr0 |= (1ULL << 1); // Set MP (Monitor co-processor)
__asm__ volatile ("mov %0, %%cr0" :: "r"(cr0));
__asm__ volatile ("mov %%cr4, %0" : "=r"(cr4));
cr4 |= (1ULL << 9) | (1ULL << 10); // Set OSFXSR (bit 9) and OSXMMEXCPT (bit 10)
__asm__ volatile ("mov %0, %%cr4" :: "r"(cr4));
}
void arch_early_init(void) {
// x86_64 serial and tty initialized in main
}
void arch_init(void) {
enable_fpu_sse();
gdt_init();
idt_init();
isr_init();