mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 02:46:47 +00:00
内核:在lib.rs中,将arch模块的路径进行更改,使得其他模块使用arch的代码时,不需要指定arch::x86_64 (#128)
This commit is contained in:
parent
ac643d420b
commit
adc1846b06
@ -1,3 +0,0 @@
|
||||
#[cfg(target_arch="x86_64")]
|
||||
#[macro_use]
|
||||
pub mod x86_64;
|
@ -8,7 +8,7 @@ pub struct rtc_time_t {
|
||||
}
|
||||
|
||||
use crate::{
|
||||
arch::x86_64::interrupt::{cli, sti},
|
||||
arch::interrupt::{cli, sti},
|
||||
include::bindings::bindings::{io_in8, io_out8},
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use core::{ffi::c_void, intrinsics::size_of, ptr::read_volatile, sync::atomic::compiler_fence};
|
||||
|
||||
use crate::{
|
||||
arch::x86_64::{
|
||||
arch::{
|
||||
asm::{bitops::ffz, current::current_pcb, ptrace::user_mode},
|
||||
interrupt::sti,
|
||||
},
|
||||
|
@ -10,8 +10,12 @@
|
||||
#[allow(non_snake_case)]
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
/// 导出x86_64架构相关的代码,命名为arch模块
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[path = "arch/x86_64/mod.rs"]
|
||||
#[macro_use]
|
||||
mod arch;
|
||||
|
||||
#[macro_use]
|
||||
mod include;
|
||||
mod ipc;
|
||||
@ -25,13 +29,15 @@ mod sched;
|
||||
mod smp;
|
||||
mod time;
|
||||
|
||||
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use mm::allocator::KernelAllocator;
|
||||
|
||||
// <3>
|
||||
use crate::{
|
||||
arch::x86_64::asm::current::current_pcb,
|
||||
arch::asm::current::current_pcb,
|
||||
include::bindings::bindings::{process_do_exit, BLACK, GREEN},
|
||||
};
|
||||
|
||||
|
@ -3,8 +3,8 @@ use core::ptr::read_volatile;
|
||||
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use crate::arch::x86_64::asm::irqflags::{local_irq_restore, local_irq_save};
|
||||
use crate::arch::x86_64::interrupt::{cli, sti};
|
||||
use crate::arch::asm::irqflags::{local_irq_restore, local_irq_save};
|
||||
use crate::arch::interrupt::{cli, sti};
|
||||
use crate::include::bindings::bindings::{spin_lock, spin_unlock, spinlock_t};
|
||||
use crate::process::preempt::{preempt_disable, preempt_enable};
|
||||
|
||||
|
@ -3,7 +3,7 @@ use core::{ffi::c_void, ptr::null_mut, sync::atomic::compiler_fence};
|
||||
use alloc::boxed::Box;
|
||||
|
||||
use crate::{
|
||||
arch::x86_64::asm::current::current_pcb,
|
||||
arch::asm::current::current_pcb,
|
||||
include::bindings::bindings::{
|
||||
process_control_block, CLONE_CLEAR_SIGHAND, CLONE_SIGHAND, CLONE_THREAD, ENOMEM,
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{include::bindings::bindings::pt_regs, arch::x86_64::asm::current::current_pcb};
|
||||
use crate::{include::bindings::bindings::pt_regs, arch::asm::current::current_pcb};
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::arch::x86_64::asm::current::current_pcb;
|
||||
use crate::arch::asm::current::current_pcb;
|
||||
|
||||
/// @brief 增加进程的锁持有计数
|
||||
#[inline]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use core::ptr::{read_volatile, write_volatile};
|
||||
|
||||
use crate::{
|
||||
arch::x86_64::asm::current::current_pcb,
|
||||
arch::asm::current::current_pcb,
|
||||
include::bindings::bindings::{
|
||||
process_control_block, sched_enqueue, PROC_RUNNING, PROC_STOPPED,
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{include::bindings::bindings::process_control_block, process::process::process_cpu, arch::x86_64::asm::current::current_pcb};
|
||||
use crate::{include::bindings::bindings::process_control_block, process::process::process_cpu, arch::asm::current::current_pcb};
|
||||
|
||||
/// @brief 获取指定的cpu上正在执行的进程的pcb
|
||||
#[inline]
|
||||
|
@ -2,7 +2,7 @@
|
||||
#[inline]
|
||||
pub fn smp_get_processor_id() -> u32 {
|
||||
if cfg!(x86_64) {
|
||||
return crate::arch::x86_64::cpu::arch_current_apic_id() as u32;
|
||||
return crate::arch::cpu::arch_current_apic_id() as u32;
|
||||
} else {
|
||||
255
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user