180 lines
4.1 KiB
Rust
Raw Normal View History

2024-03-05 16:56:25 +02:00
#![feature(never_type)]
use std::{
marker::PhantomData,
sync::atomic::{AtomicBool, Ordering},
};
use kernel_arch_interface::{
cpu::IpiQueue,
mem::{
DeviceMemoryAttributes, KernelTableManager, PhysicalMemoryAllocator, RawDeviceMemoryMapping,
},
task::{Scheduler, TaskContext},
Architecture,
};
use libk_mm_interface::{
address::PhysicalAddress,
process::ProcessAddressSpaceManager,
table::{MapAttributes, TableAllocator},
};
use yggdrasil_abi::{
error::Error,
process::{ProcessGroupId, Signal},
};
2024-03-05 16:56:25 +02:00
pub struct ArchitectureImpl;
#[derive(Debug)]
pub struct KernelTableManagerImpl;
pub struct ProcessAddressSpaceImpl<TA: TableAllocator>(!, PhantomData<TA>);
pub struct TaskContextImpl<K: KernelTableManager, PA: PhysicalMemoryAllocator>(
!,
PhantomData<(K, PA)>,
);
static DUMMY_INTERRUPT_MASK: AtomicBool = AtomicBool::new(true);
impl Architecture for ArchitectureImpl {
type PerCpuData = ();
fn local_cpu() -> *mut Self::PerCpuData {
unimplemented!()
}
unsafe fn set_local_cpu(_cpu: *mut Self::PerCpuData) {
unimplemented!()
}
unsafe fn init_local_cpu<S: Scheduler + 'static>(_id: Option<u32>, _data: Self::PerCpuData) {
unimplemented!()
}
unsafe fn init_ipi_queues(_queues: Vec<IpiQueue<Self>>) {
unimplemented!()
}
fn idle_task() -> extern "C" fn(usize) -> ! {
unimplemented!()
}
fn cpu_count() -> usize {
unimplemented!()
}
fn cpu_index<S: Scheduler + 'static>() -> u32 {
unimplemented!()
}
unsafe fn set_interrupt_mask(mask: bool) -> bool {
DUMMY_INTERRUPT_MASK.swap(mask, Ordering::Acquire)
}
fn interrupt_mask() -> bool {
unimplemented!()
}
fn wait_for_interrupt() {
unimplemented!()
}
}
impl KernelTableManager for KernelTableManagerImpl {
fn virtualize(_phys: u64) -> usize {
unimplemented!()
}
fn physicalize(_virt: usize) -> u64 {
unimplemented!()
}
unsafe fn map_device_pages(
_base: u64,
_count: usize,
_attrs: DeviceMemoryAttributes,
) -> Result<RawDeviceMemoryMapping<Self>, Error> {
unimplemented!()
}
unsafe fn unmap_device_pages(_mapping: &RawDeviceMemoryMapping<Self>) {
unimplemented!()
}
}
impl<TA: TableAllocator> ProcessAddressSpaceManager<TA> for ProcessAddressSpaceImpl<TA> {
const LOWER_LIMIT_PFN: usize = 16;
const UPPER_LIMIT_PFN: usize = 1024;
fn new() -> Result<Self, Error> {
unimplemented!()
}
unsafe fn clear(&mut self) {
unimplemented!()
}
unsafe fn map_page(
&mut self,
_address: usize,
_physical: PhysicalAddress,
_flags: MapAttributes,
) -> Result<(), Error> {
unimplemented!()
}
unsafe fn unmap_page(&mut self, _address: usize) -> Result<PhysicalAddress, Error> {
unimplemented!()
}
fn translate(&self, _address: usize) -> Result<(PhysicalAddress, MapAttributes), Error> {
unimplemented!()
}
fn as_address_with_asid(&self) -> u64 {
unimplemented!()
}
}
impl<K: KernelTableManager, PA: PhysicalMemoryAllocator> TaskContext<K, PA>
for TaskContextImpl<K, PA>
{
const USER_STACK_EXTRA_ALIGN: usize = 0;
const SIGNAL_STACK_EXTRA_ALIGN: usize = 0;
unsafe fn enter(&self) -> ! {
unimplemented!()
}
unsafe fn switch(&self, _from: &Self) {
unimplemented!()
}
unsafe fn switch_and_drop(&self, _thread: *const ()) {
unimplemented!()
}
fn user(
_entry: usize,
_arg: usize,
_cr3: u64,
_user_stack_sp: usize,
_tls_address: usize,
) -> Result<Self, Error> {
unimplemented!()
}
fn kernel(_entry: extern "C" fn(usize) -> !, _arg: usize) -> Result<Self, Error> {
unimplemented!()
}
fn kernel_closure<F: FnOnce() -> ! + Send + 'static>(_f: F) -> Result<Self, Error> {
unimplemented!()
}
}
#[no_mangle]
extern "Rust" fn __signal_process_group(_group_id: ProcessGroupId, _signal: Signal) {
2024-03-05 16:56:25 +02:00
unimplemented!()
}