Change to limine bootloader

This commit is contained in:
2026-08-27 14:03:06 +03:00
parent a6c5053b1d
commit 67d281d6be
6 changed files with 92 additions and 22 deletions
+2 -1
View File
@@ -20,8 +20,9 @@ stack_top:
.section .text
.global _start
.type _start, @function
_start:
mov $stack_top, %esp
mov $stack_top, %rsp
/* Initialize processor state here */
+22 -2
View File
@@ -6,10 +6,24 @@
#if defined(__linux__)
#error "Not using cross compiler"
#endif
#if !defined(__i386__)
#error "Not using a ix86-elf compiler"
#if !defined(__x86_64__)
#error "Not using a x86_64-elf compiler"
#endif
static inline uint64_t read_msr(uint32_t msr) {
uint32_t lo, hi;
__asm__ volatile("rdmsr" : "=a"(lo), "=d"(hi) : "c"(msr));
return ((uint64_t)hi << 32) | lo;
}
#define IA32_EFER 0xC0000080
#define EFER_LMA (1 << 10)
int is_long_mode_active(void) {
uint64_t efer = read_msr(IA32_EFER);
return (efer & EFER_LMA) != 0;
}
void kernel_main(void) {
init_serial();
if (!test_serial()) {
@@ -17,4 +31,10 @@ void kernel_main(void) {
return;
}
serial_log(S_LOG, "Init serial succesfully.");
if (!is_long_mode_active()) {
serial_log(S_ERR, "Kernel is not in long mode!");
return;
}
serial_log(S_LOG, "Kernel is in long mode.");
}
+3
View File
@@ -0,0 +1,3 @@
/SimpleKernel
protocol: multiboot1
kernel_path: boot():/boot/kernel