mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-21 22:43:23 +00:00
@ -1,4 +1,5 @@
|
||||
/// 每个架构都需要实现的IO接口
|
||||
#[allow(unused)]
|
||||
pub trait PortIOArch {
|
||||
unsafe fn in8(port: u16) -> u8;
|
||||
unsafe fn in16(port: u16) -> u16;
|
||||
|
@ -156,6 +156,7 @@ impl LocalApicTimerIntrController {
|
||||
local_apic_timer.start_current();
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn disable(&self) {
|
||||
let cpu_id = smp_get_processor_id();
|
||||
let local_apic_timer = local_apic_timer_instance_mut(cpu_id);
|
||||
|
@ -179,6 +179,7 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn irq_msi_compose_msg(cfg: &HardwareIrqConfig, msg: &mut MsiMsg, dmar: bool) {
|
||||
*msg = MsiMsg::new_zeroed();
|
||||
|
||||
|
@ -35,6 +35,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[allow(static_mut_refs)]
|
||||
unsafe extern "C" fn kernel_main(
|
||||
mb2_info: u64,
|
||||
mb2_magic: u64,
|
||||
@ -66,6 +67,7 @@ unsafe extern "C" fn kernel_main(
|
||||
|
||||
/// 在内存管理初始化之前的架构相关的早期初始化
|
||||
#[inline(never)]
|
||||
#[allow(static_mut_refs)]
|
||||
pub fn early_setup_arch() -> Result<(), SystemError> {
|
||||
let stack_start = unsafe { *(head_stack_start as *const u64) } as usize;
|
||||
debug!("head_stack_start={:#x}\n", stack_start);
|
||||
|
@ -564,6 +564,7 @@ pub unsafe fn set_system_trap_gate(irq: u32, ist: u8, vaddr: VirtAddr) {
|
||||
set_gate(idt_entry, 0xEF, ist, vaddr);
|
||||
}
|
||||
|
||||
#[allow(static_mut_refs)]
|
||||
unsafe fn get_idt_entry(irq: u32) -> &'static mut [u64] {
|
||||
assert!(irq < 256);
|
||||
let mut idt_vaddr =
|
||||
|
@ -26,6 +26,7 @@ pub struct X86MsiDataNormal {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub struct X86MsiDataDmar {
|
||||
pub dmar_subhandle: u32,
|
||||
}
|
||||
|
@ -396,6 +396,7 @@ impl SigContext {
|
||||
}
|
||||
}
|
||||
/// @brief 信号处理备用栈的信息
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct SigStack {
|
||||
pub sp: *mut c_void,
|
||||
|
@ -42,6 +42,7 @@ pub struct MSRBitmap {
|
||||
pub data: [u8; PAGE_SIZE],
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub struct VcpuData {
|
||||
/// The virtual and physical address of the Vmxon naturally aligned 4-KByte region of memory
|
||||
@ -73,6 +74,7 @@ pub enum VcpuState {
|
||||
Act = 2,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub struct VmxVcpu {
|
||||
pub vcpu_id: u32,
|
||||
@ -318,13 +320,13 @@ impl VmxVcpu {
|
||||
)?;
|
||||
vmx_vmwrite(
|
||||
VmcsFields::HOST_GDTR_BASE as u32,
|
||||
pseudo_descriptpr.base.to_bits() as u64,
|
||||
pseudo_descriptpr.base as usize as u64,
|
||||
)?;
|
||||
vmx_vmwrite(VmcsFields::HOST_IDTR_BASE as u32, unsafe {
|
||||
let mut pseudo_descriptpr: x86::dtables::DescriptorTablePointer<u64> =
|
||||
Default::default();
|
||||
x86::dtables::sidt(&mut pseudo_descriptpr);
|
||||
pseudo_descriptpr.base.to_bits() as u64
|
||||
pseudo_descriptpr.base as usize as u64
|
||||
})?;
|
||||
|
||||
// fast entry into the kernel
|
||||
|
@ -64,10 +64,10 @@ pub fn vmx_vmlaunch() -> Result<(), SystemError> {
|
||||
"push rsi",
|
||||
"push rdi",
|
||||
"vmwrite {0:r}, rsp",
|
||||
"lea rax, 1f[rip]",
|
||||
"lea rax, 2f[rip]",
|
||||
"vmwrite {1:r}, rax",
|
||||
"vmlaunch",
|
||||
"1:",
|
||||
"2:",
|
||||
"pop rdi",
|
||||
"pop rsi",
|
||||
"pop rdx",
|
||||
|
@ -30,6 +30,7 @@ pub use interrupt::X86_64InterruptArch as CurrentIrqArch;
|
||||
pub use crate::arch::asm::pio::X86_64PortIOArch as CurrentPortIOArch;
|
||||
pub use kvm::X86_64KVMArch as KVMArch;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
pub use crate::arch::ipc::signal::X86_64SignalArch as CurrentSignalArch;
|
||||
pub use crate::arch::time::X86_64TimeArch as CurrentTimeArch;
|
||||
|
||||
|
@ -42,9 +42,8 @@ impl KernelThreadMechanism {
|
||||
frame.rip = kernel_thread_bootstrap_stage1 as usize as u64;
|
||||
|
||||
// fork失败的话,子线程不会执行。否则将导致内存安全问题。
|
||||
let pid = ProcessManager::fork(&frame, clone_flags).map_err(|e| {
|
||||
let pid = ProcessManager::fork(&frame, clone_flags).inspect_err(|_e| {
|
||||
unsafe { KernelThreadCreateInfo::parse_unsafe_arc_ptr(create_info) };
|
||||
e
|
||||
})?;
|
||||
|
||||
ProcessManager::find(pid)
|
||||
|
@ -59,6 +59,7 @@ impl TSSManager {
|
||||
x86::task::load_tr(selector);
|
||||
}
|
||||
|
||||
#[allow(static_mut_refs)]
|
||||
unsafe fn set_tss_descriptor(index: u16, vaddr: VirtAddr) {
|
||||
const LIMIT: u64 = 103;
|
||||
let gdt_vaddr = VirtAddr::new(&GDT_Table as *const _ as usize);
|
||||
|
@ -259,6 +259,7 @@ impl X86_64SMPArch {
|
||||
}
|
||||
|
||||
impl SmpCpuManager {
|
||||
#[allow(static_mut_refs)]
|
||||
pub fn arch_init(_boot_cpu: ProcessorId) {
|
||||
assert!(smp_get_processor_id().data() == 0);
|
||||
// 写入APU_START_CR3,这个值会在AP处理器启动时设置到CR3寄存器
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"llvm-target": "x86_64-unknown-none",
|
||||
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
|
||||
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
|
||||
"arch": "x86_64",
|
||||
"target-endian": "little",
|
||||
"target-pointer-width": "64",
|
||||
|
Reference in New Issue
Block a user