forked from AbleOS/ableos
limine compiling booting and not panicking
This commit is contained in:
parent
23c355762c
commit
6e20d33817
|
@ -1,6 +1,7 @@
|
|||
// #![allow(clippy::print_literal)]
|
||||
use super::{gdt, interrupts};
|
||||
use crate::{logger, serial_println, TERM};
|
||||
// use crate::{logger, serial_println, TERM};
|
||||
use crate::{logger, serial_println};
|
||||
|
||||
/// x86_64 initialization
|
||||
pub fn init() {
|
||||
|
@ -24,14 +25,14 @@ pub fn init() {
|
|||
interrupts::init_idt();
|
||||
unsafe { interrupts::PICS.lock().initialize() };
|
||||
|
||||
trace!("term");
|
||||
let term = &*TERM;
|
||||
trace!("term.lock()");
|
||||
let mut term = term.lock();
|
||||
// trace!("term");
|
||||
// let term = &*TERM;
|
||||
// trace!("term.lock()");
|
||||
// let mut term = term.lock();
|
||||
// term.initialize();
|
||||
term.set_dirty(true);
|
||||
term.draw_term();
|
||||
drop(term);
|
||||
// term.set_dirty(true);
|
||||
// term.draw_term();
|
||||
// drop(term);
|
||||
|
||||
x86_64::instructions::interrupts::enable();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,10 @@ use pic8259::ChainedPics;
|
|||
use qrcode::QrCode;
|
||||
use seq_macro::seq;
|
||||
use spin::Lazy;
|
||||
use x86_64::{structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode}, registers::control::Cr2};
|
||||
use x86_64::{
|
||||
registers::control::Cr2,
|
||||
structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode},
|
||||
};
|
||||
|
||||
use super::sloop;
|
||||
|
||||
|
@ -96,10 +99,11 @@ extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
|
|||
|
||||
extern "x86-interrupt" fn page_fault_handler(
|
||||
stack_frame: InterruptStackFrame,
|
||||
error_code: PageFaultErrorCode
|
||||
error_code: PageFaultErrorCode,
|
||||
) {
|
||||
error!("EXCEPTION: PAGE FAULT {error_code:?}\n{:#?}", stack_frame);
|
||||
trace!("CR2: {:x}", Cr2::read_raw());
|
||||
trace!("SCREE");
|
||||
loop {}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,9 +103,9 @@ fn on_complete(mouse_state: MouseState) {
|
|||
mouse.change_y(delta_y);
|
||||
|
||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
use crate::TERM;
|
||||
let mut term = TERM.lock();
|
||||
term.set_dirty(true);
|
||||
// use crate::TERM;
|
||||
// let mut term = TERM.lock();
|
||||
// term.set_dirty(true);
|
||||
});
|
||||
|
||||
// draw_mouse((mouse.get_x() as usize, mouse.get_y() as usize));
|
||||
|
|
|
@ -12,7 +12,8 @@ use crate::arch::memory::BootInfoFrameAllocator;
|
|||
use crate::arch::{drivers::sysinfo::master, init, sloop};
|
||||
use crate::devices::pci;
|
||||
use crate::relib::network::socket::{SimpleSock, Socket};
|
||||
use crate::{boot_conf::KernelConfig, scratchpad, systeminfo::RELEASE_TYPE, TERM};
|
||||
use crate::{boot_conf::KernelConfig, scratchpad, systeminfo::RELEASE_TYPE};
|
||||
// use crate::{boot_conf::KernelConfig, scratchpad, systeminfo::RELEASE_TYPE, TERM};
|
||||
use crate::{filesystem, hardware};
|
||||
use kernel::KERNEL_VERSION;
|
||||
use spin::Lazy;
|
||||
|
@ -144,9 +145,9 @@ pub static TICK: AtomicU64 = AtomicU64::new(0);
|
|||
|
||||
pub fn tick() {
|
||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
let mut term = TERM.lock();
|
||||
// let mut term = TERM.lock();
|
||||
|
||||
term.draw_term();
|
||||
// term.draw_term();
|
||||
use core::sync::atomic::Ordering::Relaxed;
|
||||
|
||||
let mut data = TICK.load(Relaxed);
|
||||
|
|
|
@ -23,7 +23,7 @@ impl core::fmt::Write for Stdout {
|
|||
fn write_str(&mut self, s: &str) -> Result<(), Error> {
|
||||
// use mini_backtrace::Backtrace;
|
||||
|
||||
use crate::TERM;
|
||||
// use crate::TERM;
|
||||
|
||||
// Capture up to 16 frames. This is returned using an ArrayVec that doesn't
|
||||
// perform any dynamic memory allocation.
|
||||
|
@ -38,14 +38,15 @@ impl core::fmt::Write for Stdout {
|
|||
}
|
||||
*/
|
||||
|
||||
// trace!("printing");
|
||||
trace!("printing");
|
||||
trace!("PRINT: {}", s);
|
||||
// x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
let mut term = TERM.lock();
|
||||
// let mut term = TERM.lock();
|
||||
|
||||
term.set_dirty(true);
|
||||
term.print(s);
|
||||
// term.set_dirty(true);
|
||||
// term.print(s);
|
||||
|
||||
drop(term);
|
||||
// drop(term);
|
||||
// });
|
||||
// trace!("Finished printing");
|
||||
Ok(())
|
||||
|
|
|
@ -43,17 +43,19 @@ impl acpi::AcpiHandler for AcpiStruct {
|
|||
}
|
||||
}
|
||||
|
||||
pub static TERM: Lazy<spin::Mutex<VTerm>> = Lazy::new(|| {
|
||||
trace!("mutex");
|
||||
let mutex = spin::Mutex::new({
|
||||
trace!("vterm");
|
||||
let vterm = VTerm::new();
|
||||
trace!("vterm-done");
|
||||
vterm
|
||||
});
|
||||
trace!("mutex-done");
|
||||
mutex
|
||||
});
|
||||
// pub static TERM: Lazy<spin::Mutex<VTerm>> = Lazy::new(|| {
|
||||
// trace!("mutex");
|
||||
|
||||
// loop {}
|
||||
// let mutex = spin::Mutex::new({
|
||||
// trace!("vterm");
|
||||
// let vterm = VTerm::new();
|
||||
// trace!("vterm-done");
|
||||
// vterm
|
||||
// });
|
||||
// trace!("mutex-done");
|
||||
// mutex
|
||||
// });
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Path {
|
||||
|
@ -143,7 +145,9 @@ pub fn scratchpad() {
|
|||
let mut pci_ide_device = pci_ide_device.lock();
|
||||
if let PciDevice::Ide(device) = &mut *pci_ide_device {
|
||||
let mut first_sector = Vec::with_capacity(512);
|
||||
device.read(Channel::Primary, Drive::Master, 0, 1, &mut first_sector).unwrap();
|
||||
device
|
||||
.read(Channel::Primary, Drive::Master, 0, 1, &mut first_sector)
|
||||
.unwrap();
|
||||
trace!("IDE Primary/Master sector 0: {first_sector:?}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ pub struct VTerm {
|
|||
impl VTerm {
|
||||
/// Construct a new VTerm
|
||||
pub fn new() -> Self {
|
||||
trace!("Setting vga mode");
|
||||
let mode = VGAE.lock();
|
||||
mode.set_mode();
|
||||
// let fb = mode.get_frame_buffer();
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
use std::{fs::{self, File}, process::Command};
|
||||
use std::{
|
||||
fs::{self, File},
|
||||
process::Command,
|
||||
};
|
||||
|
||||
use colored::*;
|
||||
|
||||
|
@ -259,9 +262,9 @@ fn main() {
|
|||
.args(["/dev/loop0p1", "./disk"])
|
||||
.status()
|
||||
.unwrap();
|
||||
|
||||
// copy the kernel over to ./disk/boot/kernel
|
||||
Command::new("sudo")
|
||||
|
||||
// copy the kernel over to ./disk/boot/kernel
|
||||
Command::new("sudo")
|
||||
.arg("cp")
|
||||
.arg("./target/x86_64-ableos/debug/ableos")
|
||||
.arg("./disk/boot/kernel")
|
||||
|
@ -293,7 +296,7 @@ fn main() {
|
|||
.args(["-m", "4G"])
|
||||
.args(["-serial", "stdio"])
|
||||
.args(["-smp", "cores=2"])
|
||||
.args(["-soundhw", "pcspk"])
|
||||
// .args(["-soundhw", "pcspk"])
|
||||
// .args(["-device", "VGA"])
|
||||
// .args(["-device", "virtio-gpu-pci"])
|
||||
.args(["-device", "vmware-svga"])
|
||||
|
@ -326,9 +329,9 @@ fn main() {
|
|||
.args(["/dev/loop0p1", "./disk"])
|
||||
.status()
|
||||
.unwrap();
|
||||
|
||||
// copy the kernel over to ./disk/boot/kernel
|
||||
Command::new("sudo")
|
||||
|
||||
// copy the kernel over to ./disk/boot/kernel
|
||||
Command::new("sudo")
|
||||
.arg("cp")
|
||||
.arg("./target/x86_64-ableos/release/ableos")
|
||||
.arg("./disk/boot/kernel")
|
||||
|
@ -360,7 +363,7 @@ fn main() {
|
|||
.args(["-m", "4G"])
|
||||
.args(["-serial", "stdio"])
|
||||
.args(["-smp", "cores=2"])
|
||||
.args(["-soundhw", "pcspk"])
|
||||
// .args(["-soundhw", "pcspk"])
|
||||
// .args(["-device", "VGA"])
|
||||
// .args(["-device", "virtio-gpu-pci"])
|
||||
.args(["-device", "vmware-svga"])
|
||||
|
|
Loading…
Reference in a new issue