Format
This commit is contained in:
parent
9cbe50e9be
commit
e753cd09b0
@ -1,5 +1,10 @@
|
||||
use crate::{
|
||||
bootinfo::BOOTINFO, dbg, pit::NUM_INTERRUPTS, print, println, tasking::{InvalidPid, IpcMessage, SleepReason}, virtual_memory::{ASpaceMutex, AddressSpace, PagingError, ACTIVE_SPACE, KERNEL_SPACE}, TASKING
|
||||
bootinfo::BOOTINFO,
|
||||
pit::NUM_INTERRUPTS,
|
||||
print, println,
|
||||
tasking::{InvalidPid, IpcMessage, SleepReason},
|
||||
virtual_memory::{ASpaceMutex, AddressSpace, PagingError, ACTIVE_SPACE, KERNEL_SPACE},
|
||||
TASKING,
|
||||
};
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
use az::WrappingCast;
|
||||
@ -116,9 +121,7 @@ extern "x86-interrupt" fn page_fault_handler(
|
||||
TASKING.exit(254);
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn device_not_available_handler(
|
||||
_stack_frame: InterruptStackFrame,
|
||||
) {
|
||||
extern "x86-interrupt" fn device_not_available_handler(_stack_frame: InterruptStackFrame) {
|
||||
TASKING.switch_fpu_context();
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,23 @@
|
||||
use crate::{
|
||||
gdt, interrupts::{send_ipc_to, REGISTERD_PIDS}, pit, println, virtual_memory::{ASpaceMutex, AddressSpace, PagingError, ACTIVE_SPACE, KERNEL_SPACE}
|
||||
gdt,
|
||||
interrupts::{send_ipc_to, REGISTERD_PIDS},
|
||||
pit, println,
|
||||
virtual_memory::{ASpaceMutex, AddressSpace, PagingError, ACTIVE_SPACE, KERNEL_SPACE},
|
||||
};
|
||||
use alloc::{boxed::Box, collections::VecDeque, vec, vec::Vec};
|
||||
use cast::{u64, usize};
|
||||
use core::{
|
||||
arch::{asm, naked_asm}, ptr::{addr_of, addr_of_mut}, sync::atomic::{AtomicBool, Ordering}
|
||||
arch::{asm, naked_asm},
|
||||
ptr::{addr_of, addr_of_mut},
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
use crossbeam_queue::SegQueue;
|
||||
use slab::Slab;
|
||||
use spin::{Lazy, Mutex, Once, RwLock};
|
||||
use x86_64::{
|
||||
registers::control::{Cr0, Cr0Flags}, structures::paging::{Page, PageTableFlags}, VirtAddr
|
||||
registers::control::{Cr0, Cr0Flags},
|
||||
structures::paging::{Page, PageTableFlags},
|
||||
VirtAddr,
|
||||
};
|
||||
|
||||
#[naked]
|
||||
@ -93,14 +100,12 @@ pub fn store_initial_fpu_state() {
|
||||
#[repr(align(16))]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
struct FpuState {
|
||||
state: [u8; 512]
|
||||
state: [u8; 512],
|
||||
}
|
||||
|
||||
impl FpuState {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
state: [0; 512],
|
||||
}
|
||||
Self { state: [0; 512] }
|
||||
}
|
||||
|
||||
fn save(&mut self) {
|
||||
@ -792,6 +797,7 @@ impl Tasking {
|
||||
self.processes.read()[fpu_pid].threads.read()[fpu_tid].fpu_state.lock().save();
|
||||
}
|
||||
self.current_thread(|thread| thread.fpu_state.lock().load());
|
||||
*self.current_fpu_context.lock() = Some((self.current_pid().unwrap(), self.current_tid().unwrap()));
|
||||
*self.current_fpu_context.lock() =
|
||||
Some((self.current_pid().unwrap(), self.current_tid().unwrap()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user