From 40f55d922d2a1339f77aec139b96bb5ec8ae8f8c Mon Sep 17 00:00:00 2001 From: Able Date: Sat, 27 Nov 2021 14:59:29 -0600 Subject: [PATCH] Work done on adding board support packages --- ableos/src/allocator/mod.rs | 3 - ableos/src/arch/riscv/boards/virt/virt.lds | 64 ++++++++++++++++++++++ ableos/src/arch/x86_64/interrupts.rs | 5 +- ableos/src/kmain.rs | 2 +- ableos/src/lib.rs | 2 + ableos/src/log.rs | 16 +----- ableos/src/wasm/mod.rs | 1 + 7 files changed, 73 insertions(+), 20 deletions(-) create mode 100644 ableos/src/arch/riscv/boards/virt/virt.lds diff --git a/ableos/src/allocator/mod.rs b/ableos/src/allocator/mod.rs index 22f96619..e1e59f51 100644 --- a/ableos/src/allocator/mod.rs +++ b/ableos/src/allocator/mod.rs @@ -1,7 +1,4 @@ -use alloc::alloc::{GlobalAlloc, Layout}; - mod aalloc; -// use dummy::Dummy; pub const HEAP_START: usize = 0x_4444_4444_0000; /// 131072 bytes diff --git a/ableos/src/arch/riscv/boards/virt/virt.lds b/ableos/src/arch/riscv/boards/virt/virt.lds new file mode 100644 index 00000000..c471c85e --- /dev/null +++ b/ableos/src/arch/riscv/boards/virt/virt.lds @@ -0,0 +1,64 @@ +OUTPUT_ARCH(riscv64gc) + +ENTRY(_boot); + + +SECTIONS { + . = 0x80200000; + .text : { + PROVIDE(__text_start = .); + PROVIDE(KERNEL_START = .); + *(.init.boot) + *(.init.rust) + *(.text .text.*) + . = ALIGN(4K); + PROVIDE(__text_end = .); + } + + .data : { + PROVIDE(__data_start = .); + *(.data .data.* .rodata .rodata.*) + . = ALIGN(8); + PROVIDE(__tmp_stack_bottom = .); + . += 1024 * 1024 * 4; + PROVIDE(__tmp_stack_top = .); + . += 4096; + PROVIDE(__scratch_stack = .); + . = ALIGN(8); + } + + . = ALIGN(8); + + .sdata : { + PROVIDE(__global_pointer$ = .); + *(.sdata .sdata.*) + . = ALIGN(4K); + PROVIDE(__data_end = .); + } + + PROVIDE(__bss_start = .); + .sbss : { + *(.sbss .sbss.*); + } + + .bss : { + *(.bss .bss.*) + } + . = ALIGN(4K); + PROVIDE(__bss_end = .); + + .tdata : { + . = ALIGN(4K); + PROVIDE(__tdata_start = .); + + *(.tdata .tdata.*) + + . = ALIGN(4K); + PROVIDE(__tdata_end = .); + } + + . = ALIGN(2M); + PROVIDE(KERNEL_END = .); + + /DISCARD/ : { *(.eh_frame_hdr .eh_frame) } +} diff --git a/ableos/src/arch/x86_64/interrupts.rs b/ableos/src/arch/x86_64/interrupts.rs index 2fe35709..51797298 100644 --- a/ableos/src/arch/x86_64/interrupts.rs +++ b/ableos/src/arch/x86_64/interrupts.rs @@ -8,8 +8,6 @@ pub const PIC_2_OFFSET: u8 = PIC_1_OFFSET + 8; pub static PICS: spin::Mutex = spin::Mutex::new(unsafe { ChainedPics::new(PIC_1_OFFSET, PIC_2_OFFSET) }); -use crate::arch::sloop; -use x86_64::structures::idt::PageFaultErrorCode; /// Interrupt offsets. #[derive(Debug, Clone, Copy)] #[repr(u8)] @@ -99,6 +97,8 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac .notify_end_of_interrupt(InterruptIndex::Keyboard.as_u8()); } } + +/* extern "x86-interrupt" fn page_fault_handler( stack_frame: InterruptStackFrame, error_code: PageFaultErrorCode, @@ -110,3 +110,4 @@ extern "x86-interrupt" fn page_fault_handler( println!["{:#?}", stack_frame]; sloop(); } +*/ diff --git a/ableos/src/kmain.rs b/ableos/src/kmain.rs index 3cd0504e..658bf38f 100644 --- a/ableos/src/kmain.rs +++ b/ableos/src/kmain.rs @@ -4,7 +4,7 @@ use crate::{ driver_traits::graphics::Graphics, experiments::systeminfo::{KERNEL_VERSION, RELEASE_TYPE}, keyboard::DecodedKey, - relib::math::rand::{RAND_HANDLE, RNG}, + relib::math::rand::RAND_HANDLE, }; use lazy_static::lazy_static; diff --git a/ableos/src/lib.rs b/ableos/src/lib.rs index 08b62f0a..75d4a041 100644 --- a/ableos/src/lib.rs +++ b/ableos/src/lib.rs @@ -36,4 +36,6 @@ pub mod kmain; pub mod log; pub mod panic; pub mod relib; +pub mod wasm; + extern crate alloc; diff --git a/ableos/src/log.rs b/ableos/src/log.rs index 74222666..452df75e 100644 --- a/ableos/src/log.rs +++ b/ableos/src/log.rs @@ -6,23 +6,11 @@ pub trait Log { } use crate::serial_print; -use lliw::{Bg, Fg, Reset, Style}; +use lliw::{Fg, Reset}; pub struct ANSISerialLogger; impl Log for ANSISerialLogger { fn debug() { - // serial_print!("[{}Debug{}]",); - - serial_print!( - "{}{}Attention!{}{} You have {}{}1{}{} new message", - Style::Underline, - Fg::Yellow, - Style::NoUnderline, - Fg::Reset, - Bg::White, - Fg::Black, - Bg::Reset, - Fg::Reset, - ); + serial_print!("[{}Debug{}]", Fg::Blue, Reset); todo!(); } diff --git a/ableos/src/wasm/mod.rs b/ableos/src/wasm/mod.rs index e69de29b..8b137891 100644 --- a/ableos/src/wasm/mod.rs +++ b/ableos/src/wasm/mod.rs @@ -0,0 +1 @@ +