chore: 将工具链更新到2024-07-23 (#864)

* chore: 将工具链更新到2024-07-23
This commit is contained in:
LoGin 2024-07-25 00:55:02 +08:00 committed by GitHub
parent 634349e0eb
commit bd70d2d1f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
150 changed files with 237 additions and 200 deletions

View File

@ -51,17 +51,17 @@ jobs:
cargo install cargo-binutils cargo install cargo-binutils
rustup toolchain install nightly-x86_64-unknown-linux-gnu rustup toolchain install nightly-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-01-21-x86_64-unknown-linux-gnu rustup toolchain install nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-08-15-x86_64-unknown-linux-gnu rustup toolchain install nightly-2023-08-15-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu rustup component add rust-src --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu rustup component add rust-src --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-none --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu rustup target add x86_64-unknown-none --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-none --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu rustup target add x86_64-unknown-none --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-01-21-riscv64gc-unknown-linux-gnu --force-non-host rustup toolchain install nightly-2024-07-23-riscv64gc-unknown-linux-gnu --force-non-host
rustup toolchain install nightly-2023-08-15-riscv64gc-unknown-linux-gnu --force-non-host rustup toolchain install nightly-2023-08-15-riscv64gc-unknown-linux-gnu --force-non-host
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
@ -71,12 +71,12 @@ jobs:
rustup component add rustfmt rustup component add rustfmt
rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu rustup component add rustfmt --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu rustup component add rustfmt --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu rustup component add rustfmt --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu rustup component add rustfmt --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
rustup default nightly rustup default nightly-2024-07-23
cargo install dadk --version 0.1.11 cargo install dadk --version 0.1.11
@ -87,5 +87,8 @@ jobs:
rustup component add --toolchain ${userapp_musl_toolchain} rust-src rustup component add --toolchain ${userapp_musl_toolchain} rust-src
rustup target add --toolchain ${userapp_musl_toolchain} x86_64-unknown-linux-musl rustup target add --toolchain ${userapp_musl_toolchain} x86_64-unknown-linux-musl
rustup target add x86_64-unknown-linux-musl --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu

View File

@ -5,4 +5,4 @@ fmt:
clean: clean:
@cargo clean @cargo clean
check: check:
@cargo +nightly-2023-08-15 check --workspace $(CARGO_ZBUILD) --message-format=json @cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json

View File

@ -1,5 +1,3 @@
#![feature(cfg_target_abi)]
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
extern crate cc; extern crate cc;

View File

@ -5,4 +5,9 @@
[target.'cfg(target_os = "none")'] [target.'cfg(target_os = "none")']
runner = "bootimage runner" runner = "bootimage runner"
[build]
# '-Zlinker-features=-lld' 禁用rustlld20240723因为它与linkme0.3版本冲突
rustflags = ["-Zlinker-features=-lld"]
rustdocflags = ["-Zlinker-features=-lld"]
[env] [env]

View File

@ -12,16 +12,18 @@ crate-type = ["staticlib"]
[workspace] [workspace]
members = [ members = [
"crates/*", "crates/*",
"src/libs/intertrait"
] ]
[features] [features]
default = ["backtrace", "kvm"] default = ["backtrace", "kvm", "fatfs", "fatfs-secure"]
# 内核栈回溯 # 内核栈回溯
backtrace = [] backtrace = []
# kvm # kvm
kvm = [] kvm = []
fatfs = []
fatfs-secure = ["fatfs"]
# 运行时依赖项 # 运行时依赖项
[dependencies] [dependencies]
@ -37,10 +39,10 @@ driver_base_macros = { "path" = "crates/driver_base_macros" }
elf = { version = "=0.7.2", default-features = false } elf = { version = "=0.7.2", default-features = false }
hashbrown = "=0.13.2" hashbrown = "=0.13.2"
ida = { path = "src/libs/ida" } ida = { path = "src/libs/ida" }
intertrait = { path = "src/libs/intertrait" } intertrait = { path = "crates/intertrait" }
kdepends = { path = "crates/kdepends" } kdepends = { path = "crates/kdepends" }
klog_types = { path = "crates/klog_types" } klog_types = { path = "crates/klog_types" }
linkme = "=0.2" linkme = "=0.3.27"
num = { version = "=0.4.0", default-features = false } num = { version = "=0.4.0", default-features = false }
num-derive = "=0.3" num-derive = "=0.3"
num-traits = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/num-traits.git", rev="1597c1c", default-features = false } num-traits = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/num-traits.git", rev="1597c1c", default-features = false }

View File

@ -36,12 +36,12 @@ check: ECHO
# @echo "Checking kernel... ARCH=$(ARCH)" # @echo "Checking kernel... ARCH=$(ARCH)"
# @exit 1 # @exit 1
ifeq ($(ARCH), x86_64) ifeq ($(ARCH), x86_64)
@cargo +nightly-2023-08-15 check --workspace $(CARGO_ZBUILD) --message-format=json --target ./src/$(TARGET_JSON) @cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json --target ./src/$(TARGET_JSON)
else ifeq ($(ARCH), riscv64) else ifeq ($(ARCH), riscv64)
@cargo +nightly-2023-08-15 check --workspace $(CARGO_ZBUILD) --message-format=json --target $(TARGET_JSON) @cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json --target $(TARGET_JSON)
endif endif
test: test:
# 测试内核库 # 测试内核库
@cargo +nightly-2023-08-15 test --workspace --exclude dragonos_kernel @cargo +nightly-2024-07-23 test --workspace --exclude dragonos_kernel

View File

@ -2,6 +2,7 @@
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![allow(incomplete_features)] // for const generics #![allow(incomplete_features)] // for const generics
#![feature(generic_const_exprs)] #![feature(generic_const_exprs)]
#![allow(internal_features)]
#![allow(clippy::needless_return)] #![allow(clippy::needless_return)]
#[macro_use] #[macro_use]

View File

@ -14,6 +14,15 @@ where
core: BitMapCore<usize>, core: BitMapCore<usize>,
} }
impl<const N: usize> Default for StaticBitmap<N>
where
[(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:,
{
fn default() -> Self {
Self::new()
}
}
impl<const N: usize> StaticBitmap<N> impl<const N: usize> StaticBitmap<N>
where where
[(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:, [(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:,

View File

@ -182,11 +182,6 @@ macro_rules! bitops_for {
} }
} }
#[cfg(feature = "std")]
fn to_hex(bits: &Self) -> String {
format!("{:x}", bits)
}
#[inline] #[inline]
fn bit_size() -> usize { fn bit_size() -> usize {
<$target>::BITS as usize <$target>::BITS as usize

View File

@ -14,7 +14,7 @@ include = ["src/**/*", "Cargo.toml", "LICENSE-*", "README.md"]
[dependencies] [dependencies]
linkme = "0.2" linkme = "=0.3.27"
hashbrown = "0.13.2" hashbrown = "0.13.2"
intertrait-macros = { version = "=0.2.2", path = "macros" } intertrait-macros = { version = "=0.2.2", path = "macros" }

View File

@ -23,7 +23,7 @@ Add the following two dependencies to your `Cargo.toml`:
```toml ```toml
[dependencies] [dependencies]
intertrait = "0.2" intertrait = "0.2"
linkme = "0.2" linkme = "=0.3.27"
``` ```
The `linkme` dependency is required due to the use of `linkme` macro in the output of `intertrait` macros. The `linkme` dependency is required due to the use of `linkme` macro in the output of `intertrait` macros.

View File

@ -20,4 +20,4 @@ uuid = { version = "0.8", features = ["v4"] }
[dev-dependencies] [dev-dependencies]
intertrait = { version = "=0.2.2", path = ".." } intertrait = { version = "=0.2.2", path = ".." }
linkme = "0.2" linkme = "=0.3.27"

View File

@ -175,6 +175,12 @@ impl MMLogCycle {
} }
} }
impl Default for MMLogCycle {
fn default() -> Self {
Self::new()
}
}
impl kdepends::thingbuf::Recycle<AllocatorLog> for MMLogCycle { impl kdepends::thingbuf::Recycle<AllocatorLog> for MMLogCycle {
fn new_element(&self) -> AllocatorLog { fn new_element(&self) -> AllocatorLog {
AllocatorLog::zeroed() AllocatorLog::zeroed()

View File

@ -38,7 +38,7 @@ impl Bitfield for [AtomicU64] {
fn initialize(&mut self, for_size: usize, capacity: usize) { fn initialize(&mut self, for_size: usize, capacity: usize) {
// Set everything to allocated // Set everything to allocated
for bitmap in self.iter_mut() { for bitmap in self.iter_mut() {
*bitmap = AtomicU64::new(u64::max_value()); *bitmap = AtomicU64::new(u64::MAX);
} }
// Mark actual slots as free // Mark actual slots as free
@ -64,7 +64,7 @@ impl Bitfield for [AtomicU64] {
for (base_idx, b) in self.iter().enumerate() { for (base_idx, b) in self.iter().enumerate() {
let bitval = b.load(Ordering::Relaxed); let bitval = b.load(Ordering::Relaxed);
if bitval == u64::max_value() { if bitval == u64::MAX {
continue; continue;
} else { } else {
let negated = !bitval; let negated = !bitval;
@ -125,7 +125,7 @@ impl Bitfield for [AtomicU64] {
#[inline(always)] #[inline(always)]
fn is_full(&self) -> bool { fn is_full(&self) -> bool {
self.iter() self.iter()
.filter(|&x| x.load(Ordering::Relaxed) != u64::max_value()) .filter(|&x| x.load(Ordering::Relaxed) != u64::MAX)
.count() .count()
== 0 == 0
} }
@ -410,6 +410,7 @@ impl<'a, T: AllocablePage> PageList<'a, T> {
} }
/// Removes `slab_page` from the list. /// Removes `slab_page` from the list.
#[allow(clippy::manual_inspect)]
pub(crate) fn pop<'b>(&'b mut self) -> Option<&'a mut T> { pub(crate) fn pop<'b>(&'b mut self) -> Option<&'a mut T> {
match self.head { match self.head {
None => None, None => None,
@ -453,6 +454,7 @@ impl<'a, P: AllocablePage + 'a> Iterator for ObjectPageIterMut<'a, P> {
type Item = &'a mut P; type Item = &'a mut P;
#[inline] #[inline]
#[allow(clippy::manual_inspect)]
fn next(&mut self) -> Option<&'a mut P> { fn next(&mut self) -> Option<&'a mut P> {
unsafe { unsafe {
self.head.resolve_mut().map(|next| { self.head.resolve_mut().map(|next| {

View File

@ -10,5 +10,5 @@ path = "src/main.rs"
[dependencies] [dependencies]
unified-init-macros = { path = "macros" } unified-init-macros = { path = "macros" }
linkme = "0.2" linkme = "=0.3.27"
system_error = { path = "../system_error" } system_error = { path = "../system_error" }

View File

@ -16,5 +16,5 @@ uuid = { version = "0.8", features = ["v4"] }
[dev-dependencies] [dev-dependencies]
unified-init = { path = ".." } unified-init = { path = ".." }
linkme = "0.2" linkme = "=0.3.27"
system_error = { path = "../../system_error" } system_error = { path = "../../system_error" }

View File

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "nightly-2023-08-15" channel = "nightly-2024-07-23"
components = ["rust-src", "clippy"] components = ["rust-src", "clippy"]

View File

@ -21,7 +21,7 @@ ifeq ($(ARCH), x86_64)
endif endif
endif endif
RUSTFLAGS = $(RUSTFLAGS_UNWIND) RUSTFLAGS += $(RUSTFLAGS_UNWIND)
CFLAGS = $(GLOBAL_CFLAGS) -fno-pie $(CFLAGS_UNWIND) -I $(shell pwd) -I $(shell pwd)/include CFLAGS = $(GLOBAL_CFLAGS) -fno-pie $(CFLAGS_UNWIND) -I $(shell pwd) -I $(shell pwd)/include
@ -40,7 +40,7 @@ kernel_subdirs := common driver debug syscall libs
kernel_rust: kernel_rust:
RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2023-08-15 $(CARGO_ZBUILD) build --release --target $(TARGET_JSON) RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-07-23 $(CARGO_ZBUILD) build --release --target $(TARGET_JSON)
all: kernel all: kernel

View File

@ -1,4 +1,5 @@
/// 每个架构都需要实现的IO接口 /// 每个架构都需要实现的IO接口
#[allow(unused)]
pub trait PortIOArch { pub trait PortIOArch {
unsafe fn in8(port: u16) -> u8; unsafe fn in8(port: u16) -> u8;
unsafe fn in16(port: u16) -> u16; unsafe fn in16(port: u16) -> u16;

View File

@ -156,6 +156,7 @@ impl LocalApicTimerIntrController {
local_apic_timer.start_current(); local_apic_timer.start_current();
} }
#[allow(dead_code)]
pub(super) fn disable(&self) { pub(super) fn disable(&self) {
let cpu_id = smp_get_processor_id(); let cpu_id = smp_get_processor_id();
let local_apic_timer = local_apic_timer_instance_mut(cpu_id); let local_apic_timer = local_apic_timer_instance_mut(cpu_id);

View File

@ -179,6 +179,7 @@ bitflags! {
} }
} }
#[allow(dead_code)]
pub(super) fn irq_msi_compose_msg(cfg: &HardwareIrqConfig, msg: &mut MsiMsg, dmar: bool) { pub(super) fn irq_msi_compose_msg(cfg: &HardwareIrqConfig, msg: &mut MsiMsg, dmar: bool) {
*msg = MsiMsg::new_zeroed(); *msg = MsiMsg::new_zeroed();

View File

@ -35,6 +35,7 @@ extern "C" {
} }
#[no_mangle] #[no_mangle]
#[allow(static_mut_refs)]
unsafe extern "C" fn kernel_main( unsafe extern "C" fn kernel_main(
mb2_info: u64, mb2_info: u64,
mb2_magic: u64, mb2_magic: u64,
@ -66,6 +67,7 @@ unsafe extern "C" fn kernel_main(
/// 在内存管理初始化之前的架构相关的早期初始化 /// 在内存管理初始化之前的架构相关的早期初始化
#[inline(never)] #[inline(never)]
#[allow(static_mut_refs)]
pub fn early_setup_arch() -> Result<(), SystemError> { pub fn early_setup_arch() -> Result<(), SystemError> {
let stack_start = unsafe { *(head_stack_start as *const u64) } as usize; let stack_start = unsafe { *(head_stack_start as *const u64) } as usize;
debug!("head_stack_start={:#x}\n", stack_start); debug!("head_stack_start={:#x}\n", stack_start);

View File

@ -564,6 +564,7 @@ pub unsafe fn set_system_trap_gate(irq: u32, ist: u8, vaddr: VirtAddr) {
set_gate(idt_entry, 0xEF, ist, vaddr); set_gate(idt_entry, 0xEF, ist, vaddr);
} }
#[allow(static_mut_refs)]
unsafe fn get_idt_entry(irq: u32) -> &'static mut [u64] { unsafe fn get_idt_entry(irq: u32) -> &'static mut [u64] {
assert!(irq < 256); assert!(irq < 256);
let mut idt_vaddr = let mut idt_vaddr =

View File

@ -26,6 +26,7 @@ pub struct X86MsiDataNormal {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(dead_code)]
pub struct X86MsiDataDmar { pub struct X86MsiDataDmar {
pub dmar_subhandle: u32, pub dmar_subhandle: u32,
} }

View File

@ -396,6 +396,7 @@ impl SigContext {
} }
} }
/// @brief 信号处理备用栈的信息 /// @brief 信号处理备用栈的信息
#[allow(dead_code)]
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct SigStack { pub struct SigStack {
pub sp: *mut c_void, pub sp: *mut c_void,

View File

@ -42,6 +42,7 @@ pub struct MSRBitmap {
pub data: [u8; PAGE_SIZE], pub data: [u8; PAGE_SIZE],
} }
#[allow(dead_code)]
#[derive(Debug)] #[derive(Debug)]
pub struct VcpuData { pub struct VcpuData {
/// The virtual and physical address of the Vmxon naturally aligned 4-KByte region of memory /// The virtual and physical address of the Vmxon naturally aligned 4-KByte region of memory
@ -73,6 +74,7 @@ pub enum VcpuState {
Act = 2, Act = 2,
} }
#[allow(dead_code)]
#[derive(Debug)] #[derive(Debug)]
pub struct VmxVcpu { pub struct VmxVcpu {
pub vcpu_id: u32, pub vcpu_id: u32,
@ -318,13 +320,13 @@ impl VmxVcpu {
)?; )?;
vmx_vmwrite( vmx_vmwrite(
VmcsFields::HOST_GDTR_BASE as u32, 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 { vmx_vmwrite(VmcsFields::HOST_IDTR_BASE as u32, unsafe {
let mut pseudo_descriptpr: x86::dtables::DescriptorTablePointer<u64> = let mut pseudo_descriptpr: x86::dtables::DescriptorTablePointer<u64> =
Default::default(); Default::default();
x86::dtables::sidt(&mut pseudo_descriptpr); 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 // fast entry into the kernel

View File

@ -64,10 +64,10 @@ pub fn vmx_vmlaunch() -> Result<(), SystemError> {
"push rsi", "push rsi",
"push rdi", "push rdi",
"vmwrite {0:r}, rsp", "vmwrite {0:r}, rsp",
"lea rax, 1f[rip]", "lea rax, 2f[rip]",
"vmwrite {1:r}, rax", "vmwrite {1:r}, rax",
"vmlaunch", "vmlaunch",
"1:", "2:",
"pop rdi", "pop rdi",
"pop rsi", "pop rsi",
"pop rdx", "pop rdx",

View File

@ -30,6 +30,7 @@ pub use interrupt::X86_64InterruptArch as CurrentIrqArch;
pub use crate::arch::asm::pio::X86_64PortIOArch as CurrentPortIOArch; pub use crate::arch::asm::pio::X86_64PortIOArch as CurrentPortIOArch;
pub use kvm::X86_64KVMArch as KVMArch; pub use kvm::X86_64KVMArch as KVMArch;
#[allow(unused_imports)]
pub use crate::arch::ipc::signal::X86_64SignalArch as CurrentSignalArch; pub use crate::arch::ipc::signal::X86_64SignalArch as CurrentSignalArch;
pub use crate::arch::time::X86_64TimeArch as CurrentTimeArch; pub use crate::arch::time::X86_64TimeArch as CurrentTimeArch;

View File

@ -42,9 +42,8 @@ impl KernelThreadMechanism {
frame.rip = kernel_thread_bootstrap_stage1 as usize as u64; frame.rip = kernel_thread_bootstrap_stage1 as usize as u64;
// fork失败的话子线程不会执行。否则将导致内存安全问题。 // 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) }; unsafe { KernelThreadCreateInfo::parse_unsafe_arc_ptr(create_info) };
e
})?; })?;
ProcessManager::find(pid) ProcessManager::find(pid)

View File

@ -59,6 +59,7 @@ impl TSSManager {
x86::task::load_tr(selector); x86::task::load_tr(selector);
} }
#[allow(static_mut_refs)]
unsafe fn set_tss_descriptor(index: u16, vaddr: VirtAddr) { unsafe fn set_tss_descriptor(index: u16, vaddr: VirtAddr) {
const LIMIT: u64 = 103; const LIMIT: u64 = 103;
let gdt_vaddr = VirtAddr::new(&GDT_Table as *const _ as usize); let gdt_vaddr = VirtAddr::new(&GDT_Table as *const _ as usize);

View File

@ -259,6 +259,7 @@ impl X86_64SMPArch {
} }
impl SmpCpuManager { impl SmpCpuManager {
#[allow(static_mut_refs)]
pub fn arch_init(_boot_cpu: ProcessorId) { pub fn arch_init(_boot_cpu: ProcessorId) {
assert!(smp_get_processor_id().data() == 0); assert!(smp_get_processor_id().data() == 0);
// 写入APU_START_CR3这个值会在AP处理器启动时设置到CR3寄存器 // 写入APU_START_CR3这个值会在AP处理器启动时设置到CR3寄存器

View File

@ -1,6 +1,6 @@
{ {
"llvm-target": "x86_64-unknown-none", "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", "arch": "x86_64",
"target-endian": "little", "target-endian": "little",
"target-pointer-width": "64", "target-pointer-width": "64",

View File

@ -111,6 +111,7 @@ impl Bus for AcpiBus {
/// ///
/// ///
/// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/acpi/acpi_bus.h#364 /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/acpi/acpi_bus.h#364
#[allow(unused)]
pub trait AcpiDevice: Device {} pub trait AcpiDevice: Device {}
/// Acpi驱动应当实现的trait /// Acpi驱动应当实现的trait
@ -120,4 +121,5 @@ pub trait AcpiDevice: Device {}
/// todo: 仿照linux的acpi_driver去设计这个trait /// todo: 仿照linux的acpi_driver去设计这个trait
/// ///
/// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/acpi/acpi_bus.h#163 /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/acpi/acpi_bus.h#163
#[allow(unused)]
pub trait AcpiDriver: Driver {} pub trait AcpiDriver: Driver {}

View File

@ -478,9 +478,8 @@ impl BusManager {
driver_manager() driver_manager()
.create_attr_file(driver, &DriverAttrBind) .create_attr_file(driver, &DriverAttrBind)
.map_err(|e| { .inspect_err(|_e| {
driver_manager().remove_attr_file(driver, &DriverAttrUnbind); driver_manager().remove_attr_file(driver, &DriverAttrUnbind);
e
})?; })?;
return Ok(()); return Ok(());

View File

@ -142,6 +142,7 @@ impl DeviceManager {
/// - Ok(true): 匹配成功 /// - Ok(true): 匹配成功
/// - Ok(false): 没有匹配成功 /// - Ok(false): 没有匹配成功
/// - Err(SystemError): 匹配过程中出现意外错误,没有匹配成功 /// - Err(SystemError): 匹配过程中出现意外错误,没有匹配成功
///
/// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/base/dd.c#899 /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/base/dd.c#899
fn do_device_attach_driver( fn do_device_attach_driver(
&self, &self,
@ -484,17 +485,15 @@ impl DriverManager {
sysfs_instance() sysfs_instance()
.create_link(Some(&device_kobj), &driver_kobj, "driver".to_string()) .create_link(Some(&device_kobj), &driver_kobj, "driver".to_string())
.map_err(|e| { .inspect_err(|_e| {
fail_rm_dev_link(); fail_rm_dev_link();
e
})?; })?;
device_manager() device_manager()
.create_file(device, &DeviceAttrCoredump) .create_file(device, &DeviceAttrCoredump)
.map_err(|e| { .inspect_err(|_e| {
sysfs_instance().remove_link(&device_kobj, "driver".to_string()); sysfs_instance().remove_link(&device_kobj, "driver".to_string());
fail_rm_dev_link(); fail_rm_dev_link();
e
})?; })?;
return Ok(()); return Ok(());

View File

@ -213,9 +213,9 @@ impl DriverManager {
bus_manager().add_driver(&driver)?; bus_manager().add_driver(&driver)?;
self.add_groups(&driver, driver.groups()).map_err(|e| { self.add_groups(&driver, driver.groups())
.inspect_err(|_e| {
bus_manager().remove_driver(&driver); bus_manager().remove_driver(&driver);
e
})?; })?;
// todo: 发送uevent // todo: 发送uevent

View File

@ -646,18 +646,16 @@ impl DeviceManager {
let parent_kobj = parent.clone() as Arc<dyn KObject>; let parent_kobj = parent.clone() as Arc<dyn KObject>;
sysfs_instance() sysfs_instance()
.create_link(Some(&dev_kobj), &parent_kobj, "device".to_string()) .create_link(Some(&dev_kobj), &parent_kobj, "device".to_string())
.map_err(|e| { .inspect_err(|_e| {
err_remove_subsystem(&dev_kobj); err_remove_subsystem(&dev_kobj);
e
})?; })?;
} }
sysfs_instance() sysfs_instance()
.create_link(Some(&subsys_kobj), &dev_kobj, dev.name()) .create_link(Some(&subsys_kobj), &dev_kobj, dev.name())
.map_err(|e| { .inspect_err(|_e| {
err_remove_device(&dev_kobj); err_remove_device(&dev_kobj);
err_remove_subsystem(&dev_kobj); err_remove_subsystem(&dev_kobj);
e
})?; })?;
return Ok(()); return Ok(());
@ -695,18 +693,16 @@ impl DeviceManager {
// 添加kobj_type的属性文件 // 添加kobj_type的属性文件
if let Some(kobj_type) = dev.kobj_type() { if let Some(kobj_type) = dev.kobj_type() {
self.add_groups(dev, kobj_type.attribute_groups().unwrap_or(&[])) self.add_groups(dev, kobj_type.attribute_groups().unwrap_or(&[]))
.map_err(|e| { .inspect_err(|_e| {
err_remove_class_groups(dev); err_remove_class_groups(dev);
e
})?; })?;
} }
// 添加设备本身的属性文件 // 添加设备本身的属性文件
self.add_groups(dev, dev.attribute_groups().unwrap_or(&[])) self.add_groups(dev, dev.attribute_groups().unwrap_or(&[]))
.map_err(|e| { .inspect_err(|_e| {
err_remove_kobj_type_groups(dev); err_remove_kobj_type_groups(dev);
err_remove_class_groups(dev); err_remove_class_groups(dev);
e
})?; })?;
return Ok(()); return Ok(());

View File

@ -64,6 +64,7 @@ pub trait PlatformDevice: Device {
/// @brief: 判断设备是否初始化 /// @brief: 判断设备是否初始化
/// @parameter: None /// @parameter: None
/// @return: 如果已经初始化返回true否则返回false /// @return: 如果已经初始化返回true否则返回false
#[allow(dead_code)]
fn is_initialized(&self) -> bool; fn is_initialized(&self) -> bool;
/// @brief: 设置设备状态 /// @brief: 设置设备状态

View File

@ -16,6 +16,7 @@ use super::{platform_bus, platform_device::PlatformDevice};
/// ///
/// 应当在所有实现这个trait的结构体上方添加 `#[cast_to([sync] PlatformDriver)]` /// 应当在所有实现这个trait的结构体上方添加 `#[cast_to([sync] PlatformDriver)]`
/// 否则运行时将报错“该对象不是PlatformDriver” /// 否则运行时将报错“该对象不是PlatformDriver”
#[allow(dead_code)]
pub trait PlatformDriver: Driver { pub trait PlatformDriver: Driver {
/// 检测设备是否能绑定到这个驱动 /// 检测设备是否能绑定到这个驱动
/// ///

View File

@ -16,6 +16,7 @@ static mut CMAPPER: Option<LockedCacheMapper> = None;
/// 该结构体向外提供BlockCache服务 /// 该结构体向外提供BlockCache服务
pub struct BlockCache; pub struct BlockCache;
#[allow(static_mut_refs)]
unsafe fn mapper() -> Result<&'static mut LockedCacheMapper, BlockCacheError> { unsafe fn mapper() -> Result<&'static mut LockedCacheMapper, BlockCacheError> {
unsafe { unsafe {
match &mut CMAPPER { match &mut CMAPPER {
@ -25,6 +26,7 @@ unsafe fn mapper() -> Result<&'static mut LockedCacheMapper, BlockCacheError> {
}; };
} }
#[allow(static_mut_refs)]
unsafe fn space() -> Result<&'static mut LockedCacheSpace, BlockCacheError> { unsafe fn space() -> Result<&'static mut LockedCacheSpace, BlockCacheError> {
unsafe { unsafe {
match &mut CSPACE { match &mut CSPACE {

View File

@ -195,9 +195,8 @@ impl AhciDisk {
return Err(SystemError::EIO); return Err(SystemError::EIO);
} }
} }
if let Some(kbuf) = &kbuf {
if kbuf.is_some() { buf.copy_from_slice(kbuf);
buf.copy_from_slice(kbuf.as_ref().unwrap());
} }
compiler_fence(Ordering::SeqCst); compiler_fence(Ordering::SeqCst);

View File

@ -43,6 +43,7 @@ pub enum HbaPortType {
/// 声明了 HBA 的所有属性 /// 声明了 HBA 的所有属性
#[repr(packed)] #[repr(packed)]
#[allow(dead_code)]
pub struct HbaPort { pub struct HbaPort {
pub clb: u64, // 0x00, command list base address, 1K-byte aligned pub clb: u64, // 0x00, command list base address, 1K-byte aligned
pub fb: u64, // 0x08, FIS base address, 256-byte aligned pub fb: u64, // 0x08, FIS base address, 256-byte aligned
@ -65,6 +66,7 @@ pub struct HbaPort {
/// 全称 HBA Memory Register是HBA的寄存器在内存中的映射 /// 全称 HBA Memory Register是HBA的寄存器在内存中的映射
#[repr(packed)] #[repr(packed)]
#[allow(dead_code)]
pub struct HbaMem { pub struct HbaMem {
pub cap: u32, // 0x00, Host capability pub cap: u32, // 0x00, Host capability
pub ghc: u32, // 0x04, Global host control pub ghc: u32, // 0x04, Global host control
@ -94,6 +96,7 @@ pub struct HbaPrdtEntry {
/// HAB Command Table /// HAB Command Table
/// 每个 Port 一个 Table主机和设备的交互都靠这个数据结构 /// 每个 Port 一个 Table主机和设备的交互都靠这个数据结构
#[repr(packed)] #[repr(packed)]
#[allow(dead_code)]
pub struct HbaCmdTable { pub struct HbaCmdTable {
// 0x00 // 0x00
pub cfis: [u8; 64], // Command FIS pub cfis: [u8; 64], // Command FIS
@ -262,6 +265,7 @@ pub enum FisType {
} }
#[repr(packed)] #[repr(packed)]
#[allow(dead_code)]
pub struct FisRegH2D { pub struct FisRegH2D {
// DWORD 0 // DWORD 0
pub fis_type: u8, // FIS_TYPE_REG_H2D pub fis_type: u8, // FIS_TYPE_REG_H2D

View File

@ -168,9 +168,8 @@ fn uefi_init(system_table: PhysAddr) -> Result<(), SystemError> {
let st_ptr = st_vaddr.data() as *const uefi_raw::table::system::SystemTable; let st_ptr = st_vaddr.data() as *const uefi_raw::table::system::SystemTable;
efi_manager() efi_manager()
.check_system_table_header(unsafe { &st_ptr.as_ref().unwrap().header }, 2) .check_system_table_header(unsafe { &st_ptr.as_ref().unwrap().header }, 2)
.map_err(|e| { .inspect_err(|_| {
err_unmap_systable(st_vaddr); err_unmap_systable(st_vaddr);
e
})?; })?;
let st_ref = unsafe { st_ptr.as_ref().unwrap() }; let st_ref = unsafe { st_ptr.as_ref().unwrap() };

View File

@ -1,4 +1,5 @@
use crate::driver::{base::device::Device, input::serio::serio_device::SerioDevice}; use crate::driver::{base::device::Device, input::serio::serio_device::SerioDevice};
// todo: https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/libps2.h#33 // todo: https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/libps2.h#33
#[allow(unused)]
pub trait Ps2Device: Device + SerioDevice {} pub trait Ps2Device: Device + SerioDevice {}

View File

@ -387,6 +387,7 @@ impl Ps2MouseDevice {
Ok(()) Ok(())
} }
#[allow(dead_code)]
fn wait_for_read(&self) -> Result<(), SystemError> { fn wait_for_read(&self) -> Result<(), SystemError> {
let timeout = 100_000; let timeout = 100_000;
for _ in 0..timeout { for _ in 0..timeout {

View File

@ -47,14 +47,16 @@ pub fn i8042_init() -> Result<(), SystemError> {
Ok(()) Ok(())
} }
// TODO: https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/input/serio/i8042.c#441 /// TODO: https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/input/serio/i8042.c#441
#[allow(dead_code)]
pub fn i8042_start(_serio: &Arc<dyn SerioDevice>) -> Result<(), SystemError> { pub fn i8042_start(_serio: &Arc<dyn SerioDevice>) -> Result<(), SystemError> {
todo!() todo!("i8042_start")
} }
// TODO: https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/input/serio/i8042.c#471 /// TODO: https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/input/serio/i8042.c#471
#[allow(dead_code)]
pub fn i8042_stop(_serio: &Arc<dyn SerioDevice>) -> Result<(), SystemError> { pub fn i8042_stop(_serio: &Arc<dyn SerioDevice>) -> Result<(), SystemError> {
todo!() todo!("i8042_stop")
} }
/// # 函数的功能 /// # 函数的功能

View File

@ -8,6 +8,7 @@ use super::serio_bus;
/// 串行设备实现该trait的设备实例挂载在serio总线上同时应该实现Device trait /// 串行设备实现该trait的设备实例挂载在serio总线上同时应该实现Device trait
/// ///
/// 参考: https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/serio.h#20 /// 参考: https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/serio.h#20
#[allow(dead_code)]
pub trait SerioDevice: Device { pub trait SerioDevice: Device {
/// # 函数功能 /// # 函数功能
/// ///

View File

@ -11,6 +11,7 @@ use super::{serio_bus, serio_device::SerioDevice};
/// 实现该trait的设备驱动实例应挂载在serio总线上同时应该实现Driver trait /// 实现该trait的设备驱动实例应挂载在serio总线上同时应该实现Driver trait
/// ///
/// 参考: https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/serio.h#67 /// 参考: https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/serio.h#67
#[allow(dead_code)]
pub trait SerioDriver: Driver { pub trait SerioDriver: Driver {
// 写入时唤醒设备 // 写入时唤醒设备
fn write_wakeup(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; fn write_wakeup(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>;

View File

@ -780,7 +780,8 @@ const E1000E_TXD_CMD_EOP: u8 = 1 << 0;
const E1000E_TXD_CMD_IFCS: u8 = 1 << 1; const E1000E_TXD_CMD_IFCS: u8 = 1 << 1;
const E1000E_TXD_CMD_RS: u8 = 1 << 3; const E1000E_TXD_CMD_RS: u8 = 1 << 3;
// E1000E驱动初始化过程中可能的错误 /// E1000E驱动初始化过程中可能的错误
#[allow(dead_code)]
pub enum E1000EPciError { pub enum E1000EPciError {
// 获取到错误类型的BARIO BAR // 获取到错误类型的BARIO BAR
// An IO BAR was provided rather than a memory BAR. // An IO BAR was provided rather than a memory BAR.

View File

@ -15,7 +15,6 @@ use alloc::sync::{Arc, Weak};
use alloc::vec::Vec; use alloc::vec::Vec;
use core::cell::UnsafeCell; use core::cell::UnsafeCell;
use core::ops::{Deref, DerefMut}; use core::ops::{Deref, DerefMut};
use log::debug;
use smoltcp::wire::HardwareAddress; use smoltcp::wire::HardwareAddress;
use smoltcp::{ use smoltcp::{
phy::{self}, phy::{self},

View File

@ -13,7 +13,7 @@ pub mod e1000e;
pub mod irq_handle; pub mod irq_handle;
pub mod loopback; pub mod loopback;
pub mod virtio_net; pub mod virtio_net;
#[allow(dead_code)]
pub trait NetDevice: Device { pub trait NetDevice: Device {
/// @brief 获取网卡的MAC地址 /// @brief 获取网卡的MAC地址
fn mac(&self) -> EthernetAddress; fn mac(&self) -> EthernetAddress;

View File

@ -468,8 +468,7 @@ fn read_cell(reg_value: &[u8], base_index: usize, cells: usize) -> (u64, usize)
1 => { 1 => {
return ( return (
u32::from_be_bytes(reg_value[base_index..base_index + 4].try_into().unwrap()) u32::from_be_bytes(reg_value[base_index..base_index + 4].try_into().unwrap())
.try_into() .into(),
.unwrap(),
next_base_index, next_base_index,
); );
} }

View File

@ -12,6 +12,7 @@ use super::{dev_id::PciDeviceID, device::PciDevice, subsys::pci_bus};
/// Pci驱动应该实现的trait /// Pci驱动应该实现的trait
/// ///
/// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/pci.h#907 /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/pci.h#907
#[allow(dead_code)]
pub trait PciDriver: Driver { pub trait PciDriver: Driver {
/// # 函数的功能 /// # 函数的功能
/// 对设备进行probe操作 /// 对设备进行probe操作

View File

@ -47,6 +47,7 @@ pub trait RtcDevice: Device {
fn class_ops(&self) -> &'static dyn RtcClassOps; fn class_ops(&self) -> &'static dyn RtcClassOps;
} }
#[allow(dead_code)]
pub trait RtcClassOps: Send + Sync + Debug { pub trait RtcClassOps: Send + Sync + Debug {
fn read_time(&self, dev: &Arc<dyn RtcDevice>) -> Result<RtcTime, SystemError>; fn read_time(&self, dev: &Arc<dyn RtcDevice>) -> Result<RtcTime, SystemError>;
fn set_time(&self, dev: &Arc<dyn RtcDevice>, time: &RtcTime) -> Result<(), SystemError>; fn set_time(&self, dev: &Arc<dyn RtcDevice>, time: &RtcTime) -> Result<(), SystemError>;

View File

@ -9,6 +9,7 @@ use self::serial8250::serial8250_manager;
pub mod serial8250; pub mod serial8250;
#[allow(dead_code)]
pub trait UartDriver: Debug + Send + Sync { pub trait UartDriver: Debug + Send + Sync {
fn device_number(&self) -> DeviceNumber; fn device_number(&self) -> DeviceNumber;
@ -21,6 +22,7 @@ pub trait UartDriver: Debug + Send + Sync {
/// 串口端口应当实现的trait /// 串口端口应当实现的trait
/// ///
/// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/serial_core.h#428 /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/serial_core.h#428
#[allow(dead_code)]
pub trait UartPort { pub trait UartPort {
fn iobase(&self) -> Option<usize> { fn iobase(&self) -> Option<usize> {
None None

View File

@ -141,6 +141,7 @@ impl Serial8250Manager {
} }
/// 所有的8250串口设备都应该实现的trait /// 所有的8250串口设备都应该实现的trait
#[allow(dead_code)]
trait Serial8250Port: UartPort { trait Serial8250Port: UartPort {
fn device(&self) -> Option<Arc<Serial8250ISADevices>> { fn device(&self) -> Option<Arc<Serial8250ISADevices>> {
None None

View File

@ -20,6 +20,7 @@ static mut PIO_PORTS: [Option<Serial8250PIOPort>; 8] =
[None, None, None, None, None, None, None, None]; [None, None, None, None, None, None, None, None];
impl Serial8250Manager { impl Serial8250Manager {
#[allow(static_mut_refs)]
pub(super) fn bind_pio_ports( pub(super) fn bind_pio_ports(
&self, &self,
uart_driver: &Arc<Serial8250ISADriver>, uart_driver: &Arc<Serial8250ISADriver>,
@ -251,6 +252,7 @@ impl Serial8250PIOPortInner {
Self { device: None } Self { device: None }
} }
#[allow(dead_code)]
pub fn device(&self) -> Option<Arc<Serial8250ISADevices>> { pub fn device(&self) -> Option<Arc<Serial8250ISADevices>> {
if let Some(device) = self.device.as_ref() { if let Some(device) = self.device.as_ref() {
return device.upgrade(); return device.upgrade();

View File

@ -10,6 +10,7 @@ pub trait ConsoleSwitch: Sync + Send {
fn con_init(&self, vc_data: &mut VirtualConsoleData, init: bool) -> Result<(), SystemError>; fn con_init(&self, vc_data: &mut VirtualConsoleData, init: bool) -> Result<(), SystemError>;
/// 进行释放等系列操作,目前未使用 /// 进行释放等系列操作,目前未使用
#[allow(dead_code)]
fn con_deinit(&self) -> Result<(), SystemError>; fn con_deinit(&self) -> Result<(), SystemError>;
/// ## 清空console的一片区域 /// ## 清空console的一片区域

View File

@ -7,7 +7,6 @@ use alloc::{
collections::LinkedList, collections::LinkedList,
string::String, string::String,
sync::{Arc, Weak}, sync::{Arc, Weak},
vec::Vec,
}; };
use system_error::SystemError; use system_error::SystemError;
@ -277,14 +276,6 @@ pub struct TtyContorlInfo {
pub packet: bool, pub packet: bool,
} }
#[derive(Debug, Default)]
pub struct TtyCoreWriteData {
/// 写缓冲区
pub write_buf: Vec<u8>,
/// 写入数量
pub write_cnt: usize,
}
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct TtyFlowState { pub struct TtyFlowState {
/// 表示流控是否被停止 /// 表示流控是否被停止
@ -465,9 +456,6 @@ impl TtyCoreData {
} }
} }
/// TTY 核心接口不同的tty需要各自实现这个trait
pub trait TtyCoreFuncs: Debug + Send + Sync {}
impl TtyOperation for TtyCore { impl TtyOperation for TtyCore {
#[inline] #[inline]
fn open(&self, tty: &TtyCoreData) -> Result<(), SystemError> { fn open(&self, tty: &TtyCoreData) -> Result<(), SystemError> {

View File

@ -1344,7 +1344,7 @@ impl NTtyData {
tty.write(core, &[8], 1)?; tty.write(core, &[8], 1)?;
} }
if tty.put_char(tty.core(), b' ').is_err() { if tty.put_char(tty.core(), b' ').is_err() {
tty.write(core, &[b' '], 1)?; tty.write(core, b" ", 1)?;
} }
self.cursor_column -= 1; self.cursor_column -= 1;
space -= 1; space -= 1;
@ -1357,7 +1357,7 @@ impl NTtyData {
} }
if tty.put_char(tty.core(), b'^').is_err() { if tty.put_char(tty.core(), b'^').is_err() {
tty.write(core, &[b'^'], 1)?; tty.write(core, b"^", 1)?;
} }
if tty.put_char(tty.core(), ch ^ 0o100).is_err() { if tty.put_char(tty.core(), ch ^ 0o100).is_err() {

View File

@ -132,7 +132,6 @@ pub struct VirtualConsoleData {
pub utf_char: u32, pub utf_char: u32,
/// 构建utf时需要的参数表示目前接收了多少个字节的数据来构建utf字符 /// 构建utf时需要的参数表示目前接收了多少个字节的数据来构建utf字符
pub npar: u32, pub npar: u32,
///
pub par: [u32; NPAR], pub par: [u32; NPAR],
/// 字符转换表 用于将输入字符映射到特定的字符 /// 字符转换表 用于将输入字符映射到特定的字符
@ -1786,6 +1785,7 @@ impl VirtualConsoleData {
draw.size = 0; draw.size = 0;
} }
#[allow(clippy::manual_rotate)]
fn build_attr( fn build_attr(
&self, &self,
color: u8, color: u8,

View File

@ -341,12 +341,12 @@ impl Attribute for AttrCursorBlink {
} }
#[derive(Debug, Default)] #[derive(Debug, Default)]
#[allow(dead_code)]
pub struct FrameBufferConsoleData { pub struct FrameBufferConsoleData {
/// 光标闪烁间隔 /// 光标闪烁间隔
pub cursor_blink_jiffies: i64, pub cursor_blink_jiffies: i64,
/// 是否刷新光标 /// 是否刷新光标
pub cursor_flash: bool, pub cursor_flash: bool,
///
pub display: FbConsoleDisplay, pub display: FbConsoleDisplay,
/// 光标状态 /// 光标状态
pub cursor_state: FbCursor, pub cursor_state: FbCursor,

View File

@ -301,6 +301,7 @@ impl FrameBufferInfoData {
} }
/// 帧缓冲区信息 /// 帧缓冲区信息
#[allow(dead_code)]
pub trait FrameBufferInfo: FrameBufferOps { pub trait FrameBufferInfo: FrameBufferOps {
fn framebuffer_info_data(&self) -> &RwLock<FrameBufferInfoData>; fn framebuffer_info_data(&self) -> &RwLock<FrameBufferInfoData>;
@ -377,6 +378,7 @@ pub trait FrameBufferInfo: FrameBufferOps {
/// 帧缓冲区操作 /// 帧缓冲区操作
/// ///
/// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/fb.h#237 /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/fb.h#237
#[allow(dead_code)]
pub trait FrameBufferOps { pub trait FrameBufferOps {
fn fb_open(&self, user: bool); fn fb_open(&self, user: bool);
fn fb_release(&self, user: bool); fn fb_release(&self, user: bool);
@ -1063,6 +1065,7 @@ pub enum FbAccel {
// Add other accelerators here // Add other accelerators here
} }
#[allow(dead_code)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct BootTimeScreenInfo { pub struct BootTimeScreenInfo {
pub origin_x: u8, pub origin_x: u8,

View File

@ -18,6 +18,7 @@ pub mod virtio_impl;
/// virtio 设备厂商ID /// virtio 设备厂商ID
pub const VIRTIO_VENDOR_ID: u16 = 0x1af4; pub const VIRTIO_VENDOR_ID: u16 = 0x1af4;
#[allow(dead_code)]
pub trait VirtIODevice: Device { pub trait VirtIODevice: Device {
fn handle_irq(&self, _irq: IrqNumber) -> Result<IrqReturn, SystemError>; fn handle_irq(&self, _irq: IrqNumber) -> Result<IrqReturn, SystemError>;

View File

@ -35,6 +35,7 @@ use super::{
}; };
/// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/irq.h#506 /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/irq.h#506
#[allow(dead_code)]
pub trait IrqChip: Sync + Send + Any + Debug { pub trait IrqChip: Sync + Send + Any + Debug {
fn name(&self) -> &'static str; fn name(&self) -> &'static str;
/// start up the interrupt (defaults to ->enable if ENOSYS) /// start up the interrupt (defaults to ->enable if ENOSYS)
@ -127,6 +128,7 @@ pub trait IrqChip: Sync + Send + Any + Debug {
} }
/// enable/disable power management wake-on of an interrupt /// enable/disable power management wake-on of an interrupt
#[allow(dead_code)]
fn irq_set_wake(&self, _irq_data: &Arc<IrqData>, _on: bool) -> Result<(), SystemError> { fn irq_set_wake(&self, _irq_data: &Arc<IrqData>, _on: bool) -> Result<(), SystemError> {
Err(SystemError::ENOSYS) Err(SystemError::ENOSYS)
} }
@ -281,6 +283,7 @@ struct InnerIrqChipGeneric {
chip_types: Vec<IrqChipType>, chip_types: Vec<IrqChipType>,
} }
#[allow(dead_code)]
pub trait IrqChipGenericOps: Debug + Send + Sync { pub trait IrqChipGenericOps: Debug + Send + Sync {
/// Alternate I/O accessor (defaults to readl if NULL) /// Alternate I/O accessor (defaults to readl if NULL)
unsafe fn reg_readl(&self, addr: VirtAddr) -> u32; unsafe fn reg_readl(&self, addr: VirtAddr) -> u32;

View File

@ -644,6 +644,7 @@ pub enum IrqDomainBusToken {
/// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/irqdomain.h#107 /// 参考 https://code.dragonos.org.cn/xref/linux-6.1.9/include/linux/irqdomain.h#107
pub trait IrqDomainOps: Debug + Send + Sync { pub trait IrqDomainOps: Debug + Send + Sync {
/// 匹配一个中断控制器设备节点到一个主机。 /// 匹配一个中断控制器设备节点到一个主机。
#[allow(dead_code)]
fn match_node( fn match_node(
&self, &self,
_irq_domain: &Arc<IrqDomain>, _irq_domain: &Arc<IrqDomain>,
@ -667,6 +668,7 @@ pub trait IrqDomainOps: Debug + Send + Sync {
} }
/// 删除一个虚拟中断号与一个硬件中断号之间的映射。 /// 删除一个虚拟中断号与一个硬件中断号之间的映射。
#[allow(dead_code)]
fn unmap(&self, irq_domain: &Arc<IrqDomain>, virq: IrqNumber); fn unmap(&self, irq_domain: &Arc<IrqDomain>, virq: IrqNumber);
fn activate( fn activate(

Some files were not shown because too many files have changed in this diff Show More