mirror of
https://github.com/XunilGroup/XunilOS.git
synced 2026-04-25 11:49:03 +02:00
Add a kernel crash function, add a timer using the timer interrupt and
set PIT interval to 1000hz, use a vector inside Framebuffer, remove without_interrupts from the framebuffer and serial console, move to usize on primitives, add date at boot and turn on multithreading, add a boot animation and add a test_performance function with the new timer
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
use crate::arch::x86_64::gdt::load_gdt_x86_64;
|
||||
use crate::arch::x86_64::interrupts::{PICS, init_idt_x86_64};
|
||||
use crate::arch::x86_64::interrupts::{InterruptIndex, PICS, init_idt_x86_64};
|
||||
use limine::response::{HhdmResponse, MemoryMapResponse};
|
||||
use x86_64::instructions::interrupts;
|
||||
use x86_64::instructions::interrupts::without_interrupts;
|
||||
use x86_64::instructions::{interrupts, port::Port};
|
||||
|
||||
const TIMER_PRECISION_HZ: u32 = 1000;
|
||||
const PIT_DIVISOR: u16 = (1_193_182_u32 / TIMER_PRECISION_HZ) as u16;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use crate::arch::x86_64::{
|
||||
@@ -22,6 +26,19 @@ pub fn memory_management_init<'a>(
|
||||
(mapper, frame_allocator)
|
||||
}
|
||||
|
||||
pub fn set_pit_interval() {
|
||||
without_interrupts(|| {
|
||||
let mut command_port: Port<u8> = Port::new(0x43);
|
||||
let mut data_port: Port<u8> = Port::new(0x40);
|
||||
|
||||
unsafe {
|
||||
command_port.write(0b00_11_011_0);
|
||||
data_port.write((PIT_DIVISOR & 0xFF) as u8); // low byte
|
||||
data_port.write(((PIT_DIVISOR >> 8) & 0xFF) as u8); // high byte
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pub fn init_x86_64<'a>(
|
||||
hhdm_response: &HhdmResponse,
|
||||
memory_map_response: &'a MemoryMapResponse,
|
||||
@@ -35,6 +52,8 @@ pub fn init_x86_64<'a>(
|
||||
pics.write_masks(0xFC, 0xFF);
|
||||
}
|
||||
|
||||
set_pit_interval();
|
||||
|
||||
interrupts::enable();
|
||||
|
||||
let (mut mapper, mut frame_allocator) =
|
||||
|
||||
Reference in New Issue
Block a user