Something went wrong. Try again.
A custom OS written in Zig
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364#![no_std]#![no_main]#![feature(abi_x86_interrupt)]
extern crate alloc;
use limine_requests::{BASE_REVISION, FRAME_BUFFER_REQUEST};use crate::{cpu_local_data::get_local, guarded_stack::{GuardedStack, NORMAL_STACK_SIZE, StackId, StackType}, limine_requests::MEMORY_MAP_REQUEST, init::init_bsp};
mod limine_requests;mod rgb_pixel_info;mod frame_buffer_info;mod frame_buffer_embedded_graphics;mod logger;mod write_with_cr;mod panic_handler;mod hlt_loop;mod memory;mod hhdm_offset;mod translate_addr;mod cpu_local_data;mod gdt;mod idt;mod guarded_stack;mod x86_64_consts;mod call_with_rsp;mod acpi;mod spcr;mod apic;mod interrupt_vector;mod nmi_handler_states;mod run_program_0;mod elf_segment_flags;mod elf_segment_type;mod enter_user_mode;mod syscall_handler;mod init;mod fs;mod port_io;
#[unsafe(no_mangle)]unsafe extern "C" fn entry_point_bsp() -> ! { // All limine requests must also be referenced in a called function, // otherwise they may be removed by the linker. assert!(BASE_REVISION.is_supported());
let frame_buffer_response = FRAME_BUFFER_REQUEST.response().unwrap(); logger::init(frame_buffer_response).unwrap(); log::info!("Hello from BSP!");
let memory_map = MEMORY_MAP_REQUEST.response().unwrap(); // Safety: no page tables were modified before this unsafe { memory::init_bsp(memory_map) }; unsafe { cpu_local_data::init_bsp(); }
GuardedStack::new( NORMAL_STACK_SIZE, StackId { _type: StackType::Normal, cpu_id: get_local().kernel_assigned_id } ) .switch(init_bsp)}