mirror of
https://github.com/realmicrosoft/windows.git
synced 2024-08-14 22:46:44 +00:00
initial stuff so we only get expected errors
This commit is contained in:
parent
314189882b
commit
7319725700
13 changed files with 214 additions and 21 deletions
6
.cargo/config
Normal file
6
.cargo/config
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[target.ppc32-custom.json]
|
||||||
|
linker = "powerpc-unknown-linux-gnu-gcc"
|
||||||
|
ar = "powerpc-unknown-linux-gnu-ar"
|
||||||
|
#rustflags = [ "-C", "link-args=-nostdlib -ffreestanding -fPIC -Ttext 100000 -mbig-endian", "-C", "target-feature=+crt-static"]
|
||||||
|
# for some reason it wants a string
|
||||||
|
rustflags = "-C link-args='-nostdlib -ffreestanding -fPIC -Ttext 100000 -mbig-endian' -C target-feature=+crt-static"
|
21
Cargo.toml
21
Cargo.toml
|
@ -5,19 +5,28 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
spin = "0.9.1"
|
spin = "0.9.1"
|
||||||
x86_64 = "0.14.10"
|
|
||||||
x2apic = "0.4.1"
|
|
||||||
rlibc = "1.0"
|
rlibc = "1.0"
|
||||||
limine = { version = "0.1.9", optional = true }
|
|
||||||
acpi = { version = "4.1.1", optional = true }
|
|
||||||
linked_list_allocator = { version = "0.9.0", optional = true }
|
|
||||||
pc-keyboard = "0.6.1"
|
pc-keyboard = "0.6.1"
|
||||||
|
cstr_core = { version = "0.2.6", features = ["alloc"] }
|
||||||
|
libfar = { git = "https://github.com/realmicrosoft/libfar_nostd" }
|
||||||
|
linked_list_allocator = { version = "0.9.0", optional = true }
|
||||||
[dependencies.lazy_static]
|
[dependencies.lazy_static]
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
features = ["spin_no_std"]
|
features = ["spin_no_std"]
|
||||||
|
|
||||||
|
# x86_64 specific dependencies
|
||||||
|
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
||||||
|
x86_64 = "0.14.10"
|
||||||
|
x2apic = "0.4.1"
|
||||||
|
acpi = { version = "4.1.1", optional = true }
|
||||||
|
limine = { version = "0.1.9", optional = true }
|
||||||
|
|
||||||
|
# powerpc (32) specific dependencies
|
||||||
|
[target.'cfg(target_arch = "powerpc")'.dependencies]
|
||||||
|
openfirmware-sys = { git = "https://github.com/realmicrosoft/openfirmware-sys.git" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["f_limine", "f_ll_alloc"]#, "f_debug_verbose"]
|
default = ["f_limine", "f_ll_alloc", "f_debug_verbose"]
|
||||||
f_debug_verbose = []
|
f_debug_verbose = []
|
||||||
f_limine = ["dep:limine", "dep:acpi"]
|
f_limine = ["dep:limine", "dep:acpi"]
|
||||||
f_ll_alloc = ["dep:linked_list_allocator"]
|
f_ll_alloc = ["dep:linked_list_allocator"]
|
22
Makefile
22
Makefile
|
@ -3,9 +3,14 @@ kernel := target/$(arch)-custom/debug/wukkOS
|
||||||
iso := build/arch/$(arch)/wukkOS.iso
|
iso := build/arch/$(arch)/wukkOS.iso
|
||||||
target ?= $(arch)-custom
|
target ?= $(arch)-custom
|
||||||
final := build/arch/$(arch)/wukkOS.bin
|
final := build/arch/$(arch)/wukkOS.bin
|
||||||
|
initwukko := byob/initwukko.far
|
||||||
|
initwukko_from := initwukko
|
||||||
efi_bios := build/arch/$(arch)/OVMF-pure-efi.fd
|
efi_bios := build/arch/$(arch)/OVMF-pure-efi.fd
|
||||||
|
kernel_flags :=
|
||||||
|
RUST_FLAGS :=
|
||||||
gcc ?= gcc
|
gcc ?= gcc
|
||||||
ld ?= ld
|
ld ?= ld
|
||||||
|
far-rs ?= $(shell which far-rs)
|
||||||
|
|
||||||
linker_script := arch/$(arch)/linker.ld
|
linker_script := arch/$(arch)/linker.ld
|
||||||
bootloader_cfg := arch/$(arch)/limine.cfg
|
bootloader_cfg := arch/$(arch)/limine.cfg
|
||||||
|
@ -13,6 +18,13 @@ assembly_source_files := $(wildcard arch/$(arch)/*.asm)
|
||||||
assembly_object_files := $(patsubst arch/$(arch)/%.asm, \
|
assembly_object_files := $(patsubst arch/$(arch)/%.asm, \
|
||||||
build/arch/$(arch)/%.o, $(assembly_source_files))
|
build/arch/$(arch)/%.o, $(assembly_source_files))
|
||||||
|
|
||||||
|
|
||||||
|
ifeq "$(arch)" "x86_64"
|
||||||
|
kernel_flags += --features "f_limine"
|
||||||
|
endif
|
||||||
|
ifeq "$(arch)" "ppc32"
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: all clean run iso quick_invalidate build_no_iso
|
.PHONY: all clean run iso quick_invalidate build_no_iso
|
||||||
|
|
||||||
all: $(final) $(iso)
|
all: $(final) $(iso)
|
||||||
|
@ -40,7 +52,7 @@ $(iso): $(final) $(grub_cfg)
|
||||||
@mkdir -p isodir/boot
|
@mkdir -p isodir/boot
|
||||||
@cp $(final) isodir/boot/wukkOS.bin
|
@cp $(final) isodir/boot/wukkOS.bin
|
||||||
@cp $(bootloader_cfg) isodir/boot/limine.cfg
|
@cp $(bootloader_cfg) isodir/boot/limine.cfg
|
||||||
@cp byob/limine.sys byob/limine-cd.bin byob/limine-cd-efi.bin isodir/boot/
|
@cp byob/limine.sys byob/limine-cd.bin byob/limine-cd-efi.bin $(initwukko) isodir/boot/
|
||||||
@xorriso -as mkisofs -b boot/limine-cd.bin \
|
@xorriso -as mkisofs -b boot/limine-cd.bin \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||||
--efi-boot boot/limine-cd-efi.bin \
|
--efi-boot boot/limine-cd-efi.bin \
|
||||||
|
@ -49,14 +61,18 @@ $(iso): $(final) $(grub_cfg)
|
||||||
@rm -rf isodir
|
@rm -rf isodir
|
||||||
@byob/limine-deploy $(iso)
|
@byob/limine-deploy $(iso)
|
||||||
|
|
||||||
$(final): $(kernel) $(linker_script) $(assembly_object_files)
|
$(final): $(kernel) $(linker_script) $(initwukko)
|
||||||
@mkdir -p $(shell dirname $@)
|
@mkdir -p $(shell dirname $@)
|
||||||
@cp $(kernel) $(final)
|
@cp $(kernel) $(final)
|
||||||
#@$(ld) -n -T $(linker_script) -o $(final) $(kernel) \
|
#@$(ld) -n -T $(linker_script) -o $(final) $(kernel) \
|
||||||
# --gc-sections
|
# --gc-sections
|
||||||
|
|
||||||
$(kernel):
|
$(kernel):
|
||||||
@RUST_TARGET_PATH=$(shell pwd) xargo build --target $(target) -Zbuild-std=core,alloc --features "f_limine"
|
@RUSTFLAGS="$(RUST_FLAGS)" RUST_TARGET_PATH="$(shell pwd)" cargo +nightly build --target $(target) -Zbuild-std=core,alloc $(kernel_flags)
|
||||||
|
|
||||||
|
$(initwukko):
|
||||||
|
@mkdir -p $(shell dirname $@)
|
||||||
|
@$(far-rs) create $(initwukko) initwukko/*
|
||||||
|
|
||||||
build/arch/$(arch)/%.o: arch/$(arch)/%.asm
|
build/arch/$(arch)/%.o: arch/$(arch)/%.asm
|
||||||
@mkdir -p $(shell dirname $@)
|
@mkdir -p $(shell dirname $@)
|
||||||
|
|
46
arch/ppc32/linker.ld
Normal file
46
arch/ppc32/linker.ld
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
OUTPUT_FORMAT(elf32-powerpc)
|
||||||
|
OUTPUT_ARCH(powerpc)
|
||||||
|
|
||||||
|
ENTRY(kernel_main)
|
||||||
|
|
||||||
|
/* Define the program headers we want so the bootloader gives us the right */
|
||||||
|
/* MMU permissions */
|
||||||
|
PHDRS
|
||||||
|
{
|
||||||
|
null PT_NULL FLAGS(0) ; /* Null segment */
|
||||||
|
text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */
|
||||||
|
rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */
|
||||||
|
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
/* We wanna be placed in the topmost 2GiB of the address space, for optimisations */
|
||||||
|
/* and because that is what the Limine spec mandates. */
|
||||||
|
/* Any address in this region will do, but often 0xffffffff80000000 is chosen as */
|
||||||
|
/* that is the beginning of the region. */
|
||||||
|
. = 0xffffffff80000000;
|
||||||
|
|
||||||
|
.text : {
|
||||||
|
*(.text .text.*)
|
||||||
|
} :text
|
||||||
|
|
||||||
|
/* Move to the next memory page for .rodata */
|
||||||
|
. += CONSTANT(MAXPAGESIZE);
|
||||||
|
|
||||||
|
.rodata : {
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
} :rodata
|
||||||
|
|
||||||
|
/* Move to the next memory page for .data */
|
||||||
|
. += CONSTANT(MAXPAGESIZE);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
*(.data .data.*)
|
||||||
|
} :data
|
||||||
|
|
||||||
|
.bss : {
|
||||||
|
*(COMMON)
|
||||||
|
*(.bss .bss.*)
|
||||||
|
} :data
|
||||||
|
}
|
|
@ -3,3 +3,4 @@ TIMEOUT=0
|
||||||
:wukkOS
|
:wukkOS
|
||||||
PROTOCOL=limine
|
PROTOCOL=limine
|
||||||
KERNEL_PATH=boot:///boot/wukkOS.bin
|
KERNEL_PATH=boot:///boot/wukkOS.bin
|
||||||
|
MODULE_PATH=boot:///boot/initwukko.far
|
3
byob/.gitignore
vendored
3
byob/.gitignore
vendored
|
@ -3,3 +3,6 @@ limine.sys
|
||||||
limine-cd.bin
|
limine-cd.bin
|
||||||
limine-cd-efi.bin
|
limine-cd-efi.bin
|
||||||
limine-deploy
|
limine-deploy
|
||||||
|
|
||||||
|
# initrd
|
||||||
|
initwukko.far
|
|
@ -7,3 +7,8 @@ currently the binaries are:
|
||||||
- limine-cd.bin
|
- limine-cd.bin
|
||||||
- limine-cd-efi.bin
|
- limine-cd-efi.bin
|
||||||
- limine-deploy (should be for your current system)
|
- limine-deploy (should be for your current system)
|
||||||
|
|
||||||
|
you also need to supply an initramfs, which is a tar archive located at
|
||||||
|
`byob/initwukko.tar`
|
||||||
|
for now, this is supplied from the `initwukko/` folder, which will automatically add
|
||||||
|
all included files to the tar archive.
|
1
initwukko/magic.wukk
Normal file
1
initwukko/magic.wukk
Normal file
|
@ -0,0 +1 @@
|
||||||
|
WUKKOS_COMPLIANT_RAMDISK
|
16
ppc32-custom.json
Normal file
16
ppc32-custom.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"llvm-target": "powerpc-unknown-linux-gnu",
|
||||||
|
"data-layout": "E-m:e-p:32:32-i64:64-n32",
|
||||||
|
"arch": "powerpc",
|
||||||
|
"target-endian": "big",
|
||||||
|
"target-pointer-width": "32",
|
||||||
|
"target-c-int-width": "32",
|
||||||
|
"os": "none",
|
||||||
|
"panic-strategy": "abort",
|
||||||
|
"pre-link-args": {
|
||||||
|
"ld.lld": [
|
||||||
|
"--gc-sections",
|
||||||
|
"--script=arch/ppc32/linker.ld"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
40
serial.log
40
serial.log
|
@ -12,14 +12,42 @@ debug: IDT loaded
|
||||||
|
|
||||||
welcome to wukkOS!
|
welcome to wukkOS!
|
||||||
(c) 2022 Real Microsoft, LLC
|
(c) 2022 Real Microsoft, LLC
|
||||||
initialising mapper...[OK]
|
initialising mapper...[debug] kernel physical address: 0x19a35000
|
||||||
|
[debug] kernel virtual address: 0xffffffff80000000
|
||||||
|
[OK]
|
||||||
initialising frame allocator...[OK]
|
initialising frame allocator...[OK]
|
||||||
initialising heap...[OK]
|
initialising heap...[OK]
|
||||||
testing heap...[OK]
|
testing heap...[OK]
|
||||||
checking for apic compatibility...[OK]
|
checking for apic compatibility...[OK]
|
||||||
initialising apic...[OK]
|
initialising apic...[debug] mapping physical region: 1fb7e014 - 1fb7e038
|
||||||
setting up apic interrupts...[OK]
|
[debug] mapping physical region: 1fb7d0e8 - 1fb7d10c
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] mapping physical region: 1fb7d0e8 - 1fb7d134
|
||||||
|
[debug] mapping physical region: 1fb7a000 - 1fb7a024
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] mapping physical region: 1fb7a000 - 1fb7a114
|
||||||
|
[debug] mapping physical region: 1fb7b000 - 1fb7b024
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] mapping physical region: 1fb79000 - 1fb79024
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] mapping physical region: 1fb78000 - 1fb78024
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] mapping physical region: 1fb77000 - 1fb77024
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] mapping physical region: 1fb76000 - 1fb76024
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] mapping physical region: 1fb7a000 - 1fb7a074
|
||||||
|
[debug] mapping physical region: 1fb79000 - 1fb79078
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[debug] (THIS IS NORMAL) failed to unmap physical region: ParentEntryHugePage
|
||||||
|
[OK]
|
||||||
|
setting up apic interrupts...[debug] ioapicaddr: 0xfec00000
|
||||||
|
[OK]
|
||||||
|
loading initwukko...[debug] initwukko path: /boot/initwukko.far
|
||||||
|
[debug] magic: WUKKOS_COMPLIANT_RAMDISK
|
||||||
|
[OK]
|
||||||
|
|
||||||
hello world i am typing this using the legacy keyboard driver thingy in the apic from ioapic irq 1!
|
hello i love sex 123 123 69 lol
|
||||||
wukkOS moment, probably gonna swap this out for a real keyboard driver eventually but this is funny so (:
|
|
||||||
top ten wukkooOS moments
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
use alloc::boxed::Box;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use core::ptr::NonNull;
|
use core::ptr::NonNull;
|
||||||
use acpi::{AcpiHandler, AcpiTables, InterruptModel, PhysicalMapping};
|
use acpi::{AcpiHandler, AcpiTables, InterruptModel, PhysicalMapping};
|
||||||
use acpi::platform::interrupt::InterruptSourceOverride;
|
use acpi::platform::interrupt::InterruptSourceOverride;
|
||||||
use limine::{LimineBootInfoRequest, LimineKernelAddressRequest, LimineMemmapRequest, LimineTerminalRequest, LimineTerminalResponse, LimineRsdpRequest, LimineSmpRequest};
|
use cstr_core::CString;
|
||||||
|
use limine::{LimineBootInfoRequest, LimineKernelAddressRequest, LimineMemmapRequest, LimineTerminalRequest, LimineTerminalResponse, LimineRsdpRequest, LimineSmpRequest, LimineModuleRequest};
|
||||||
use crate::{debug, println};
|
use crate::{debug, println};
|
||||||
|
|
||||||
#[cfg(feature = "f_multiboot2")]
|
#[cfg(feature = "f_multiboot2")]
|
||||||
|
@ -20,6 +22,7 @@ pub static MEM_MAP: LimineMemmapRequest = LimineMemmapRequest::new(0);
|
||||||
pub static RSDP_REQUEST: LimineRsdpRequest = LimineRsdpRequest::new(0);
|
pub static RSDP_REQUEST: LimineRsdpRequest = LimineRsdpRequest::new(0);
|
||||||
pub static KERNEL_ADDRESS: LimineKernelAddressRequest = LimineKernelAddressRequest::new(0);
|
pub static KERNEL_ADDRESS: LimineKernelAddressRequest = LimineKernelAddressRequest::new(0);
|
||||||
pub static SMP_REQUEST: LimineSmpRequest = LimineSmpRequest::new(0);
|
pub static SMP_REQUEST: LimineSmpRequest = LimineSmpRequest::new(0);
|
||||||
|
pub static MOD_REQUEST: LimineModuleRequest = LimineModuleRequest::new(0);
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Handler;
|
struct Handler;
|
||||||
|
@ -86,3 +89,20 @@ pub fn get_ioapic_info() -> (u32, Vec<InterruptSourceOverride>) {
|
||||||
let overrides = apic.interrupt_source_overrides;
|
let overrides = apic.interrupt_source_overrides;
|
||||||
(address, overrides)
|
(address, overrides)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_initwukko() -> Vec<u8> {
|
||||||
|
let mut response = MOD_REQUEST.get_response().get_mut().unwrap();
|
||||||
|
let module = &response.modules()[0];
|
||||||
|
let path_cstr = module.path.as_ptr().unwrap();
|
||||||
|
let path = unsafe { CString::from_raw(path_cstr as *mut _) };
|
||||||
|
debug!("initwukko path: {}", path.to_str().unwrap());
|
||||||
|
let start = module.base.get().unwrap() as *const _ as usize;
|
||||||
|
let size = module.length as usize;
|
||||||
|
let end = start + size;
|
||||||
|
let mut data = Vec::new();
|
||||||
|
for i in start..end {
|
||||||
|
let byte = unsafe { *(i as *const u8) };
|
||||||
|
data.push(byte);
|
||||||
|
}
|
||||||
|
data
|
||||||
|
}
|
36
src/main.rs
36
src/main.rs
|
@ -11,11 +11,16 @@
|
||||||
extern crate rlibc;
|
extern crate rlibc;
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
|
use alloc::boxed::Box;
|
||||||
use alloc::rc::Rc;
|
use alloc::rc::Rc;
|
||||||
|
use alloc::string::{String, ToString};
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
|
use alloc::vec::Vec;
|
||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
use libfar::farlib;
|
||||||
|
use libfar::farlib::{FarArchive, FarFileInfo};
|
||||||
use limine::{LimineBootInfoRequest, LimineMemmapRequest, LimineTerminalRequest};
|
use limine::{LimineBootInfoRequest, LimineMemmapRequest, LimineTerminalRequest};
|
||||||
use spin::Mutex;
|
use spin::Mutex;
|
||||||
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
|
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
|
||||||
|
@ -24,7 +29,7 @@ use x86_64::structures::tss::TaskStateSegment;
|
||||||
use x86_64::{PhysAddr, set_general_handler, VirtAddr};
|
use x86_64::{PhysAddr, set_general_handler, VirtAddr};
|
||||||
use x86_64::registers::segmentation::{CS, Segment, SS};
|
use x86_64::registers::segmentation::{CS, Segment, SS};
|
||||||
use x86_64::structures::paging::Translate;
|
use x86_64::structures::paging::Translate;
|
||||||
use crate::boot::{get_ioapic_info, KERNEL_ADDRESS};
|
use crate::boot::{get_initwukko, get_ioapic_info, KERNEL_ADDRESS};
|
||||||
use crate::internals::WhyDoTheyCallItOvenWhenYouOfInTheColdFoodOfOutHotEatTheFood::*;
|
use crate::internals::WhyDoTheyCallItOvenWhenYouOfInTheColdFoodOfOutHotEatTheFood::*;
|
||||||
use crate::memory::{FRAME_ALLOC, MEM_MAPPER};
|
use crate::memory::{FRAME_ALLOC, MEM_MAPPER};
|
||||||
use crate::serial::terminal::ST;
|
use crate::serial::terminal::ST;
|
||||||
|
@ -37,6 +42,8 @@ mod boot;
|
||||||
mod memory;
|
mod memory;
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
|
pub type InitWukko = FarArchive;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
//pub static ref KERN_INFO: Mutex<Option<KernelInfo>> = Mutex::new(None);
|
//pub static ref KERN_INFO: Mutex<Option<KernelInfo>> = Mutex::new(None);
|
||||||
static ref GDT: Mutex<GlobalDescriptorTable> = {
|
static ref GDT: Mutex<GlobalDescriptorTable> = {
|
||||||
|
@ -58,6 +65,8 @@ lazy_static! {
|
||||||
}
|
}
|
||||||
idt
|
idt
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ref INITWUKKO: Mutex<Option<InitWukko>> = Mutex::new(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,6 +299,31 @@ pub extern "C" fn kernel_main() -> ! {
|
||||||
//x86_64::instructions::interrupts::enable();
|
//x86_64::instructions::interrupts::enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initwukko stuff
|
||||||
|
{
|
||||||
|
print!("loading initwukko...");
|
||||||
|
let initwukko_raw = get_initwukko();
|
||||||
|
let ar = farlib::test(&initwukko_raw).expect("invalid initwukko");
|
||||||
|
let ar = ar.load_file_data(&initwukko_raw);
|
||||||
|
let mut initwukko_magic = None;
|
||||||
|
for entry in &ar.file_data {
|
||||||
|
let entry_name = &entry.name;
|
||||||
|
if entry_name == "magic.wukk" {
|
||||||
|
initwukko_magic = Some(entry.data.clone());
|
||||||
|
debug!("magic: {}", String::from_utf8_lossy(&entry.data));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const CORRECT_MAGIC: &[u8; 24] = b"WUKKOS_COMPLIANT_RAMDISK";
|
||||||
|
if initwukko_magic.as_ref().unwrap_or(&vec![])[..CORRECT_MAGIC.len()] != CORRECT_MAGIC[..] {
|
||||||
|
debug!("initwukko magic: {:?}", initwukko_magic);
|
||||||
|
println!("[FAIL]");
|
||||||
|
panic!("invalid initwukko");
|
||||||
|
}
|
||||||
|
println!("[OK]");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
x86_64::instructions::hlt();
|
x86_64::instructions::hlt();
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,15 @@ pub fn test_port(port: potential_serial_ports) -> bool {
|
||||||
|
|
||||||
pub fn init_serial() -> SerialPorts {
|
pub fn init_serial() -> SerialPorts {
|
||||||
// this is so fucking cursed
|
// this is so fucking cursed
|
||||||
let mut ports_tmp : [Port; 8] = [Port { base: potential_serial_ports::COM1 }, Port { base: potential_serial_ports::COM2 }, Port { base: potential_serial_ports::COM3 }, Port { base: potential_serial_ports::COM4 }, Port { base: potential_serial_ports::COM5 }, Port { base: potential_serial_ports::COM6 }, Port { base: potential_serial_ports::COM7 }, Port { base: potential_serial_ports::COM8 }];
|
let mut ports_tmp : [Port; 8] = [
|
||||||
|
Port { base: potential_serial_ports::COM1 },
|
||||||
|
Port { base: potential_serial_ports::COM2 },
|
||||||
|
Port { base: potential_serial_ports::COM3 },
|
||||||
|
Port { base: potential_serial_ports::COM4 },
|
||||||
|
Port { base: potential_serial_ports::COM5 },
|
||||||
|
Port { base: potential_serial_ports::COM6 },
|
||||||
|
Port { base: potential_serial_ports::COM7 },
|
||||||
|
Port { base: potential_serial_ports::COM8 }];
|
||||||
let mut ports_enabled_tmp : [bool; 8] = [false; 8];
|
let mut ports_enabled_tmp : [bool; 8] = [false; 8];
|
||||||
for i in 0..8 {
|
for i in 0..8 {
|
||||||
if test_port(ports_tmp[i].base) {
|
if test_port(ports_tmp[i].base) {
|
||||||
|
|
Loading…
Reference in a new issue