Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/arch/aarch64/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ use crate::env;
pub struct FPUState {
/// Advanced SIMD 128-bit vector registers.
q: [u128; 32],
/// fpcr register.
/// FPCR register.
fpcr: u64,
/// fpsr register.
/// FPSR register.
fpsr: u64,
}

Expand Down
10 changes: 5 additions & 5 deletions src/arch/aarch64/kernel/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{DEFAULT_STACK_SIZE, KERNEL_STACK_SIZE};
#[derive(Debug)]
#[repr(C, packed)]
pub(crate) struct State {
/// stack selector
/// Stack selector
pub spsel: u64,
/// Exception Link Register
pub elr_el1: extern "C" fn(extern "C" fn(usize), usize) -> !,
Expand Down Expand Up @@ -96,16 +96,16 @@ pub(crate) struct State {
}

pub struct BootStack {
/// stack for kernel tasks
/// Stack for kernel tasks
stack: VirtAddr,
}

pub struct CommonStack {
/// start address of allocated virtual memory region
/// Start address of allocated virtual memory region
virt_addr: VirtAddr,
/// start address of allocated virtual memory region
/// Start address of allocated virtual memory region
phys_addr: PhysAddr,
/// total size of all stacks
/// Total size of all stacks
total_size: usize,
}

Expand Down
2 changes: 1 addition & 1 deletion src/arch/riscv64/kernel/core_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct CoreLocal {
core_id: CoreId,
/// Scheduler of the current Core.
scheduler: Cell<*mut PerCoreScheduler>,
/// start address of the kernel stack
/// Start address of the kernel stack
pub kernel_stack: Cell<u64>,
/// The core-local async executor.
ex: StaticLocalExecutor<RawSpinMutex, RawRwSpinLock>,
Expand Down
2 changes: 1 addition & 1 deletion src/arch/riscv64/kernel/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::drivers::mmio::get_interrupt_handlers;
use crate::drivers::pci::get_interrupt_handlers;
use crate::scheduler;

/// base address of the PLIC, only one access at the same time is allowed
/// Base address of the PLIC, only one access at the same time is allowed
static PLIC_BASE: SpinMutex<usize> = SpinMutex::new(0x0);

/// PLIC context for new interrupt handlers
Expand Down
16 changes: 8 additions & 8 deletions src/arch/riscv64/kernel/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ use crate::{DEFAULT_STACK_SIZE, KERNEL_STACK_SIZE};
#[repr(C, packed)]
#[derive(Clone, Copy, Debug)]
pub struct State {
/// return address register
/// Return address register
ra: unsafe extern "C" fn(extern "C" fn(usize), usize, u64),
/// stack pointer register
/// Stack pointer register
sp: usize,
/// global pointer register
/// Global pointer register
gp: usize,
/// thread pointer register
/// Thread pointer register
tp: usize,
/// x5 register
x5: usize,
Expand Down Expand Up @@ -79,16 +79,16 @@ pub struct State {
}

pub struct BootStack {
/// stack for kernel tasks
/// Stack for kernel tasks
stack: VirtAddr,
}

pub struct CommonStack {
/// start address of allocated virtual memory region
/// Start address of allocated virtual memory region
virt_addr: VirtAddr,
/// start address of allocated virtual memory region
/// Start address of allocated virtual memory region
phys_addr: PhysAddr,
/// total size of all stacks
/// Total size of all stacks
total_size: usize,
}

Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/kernel/apic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ fn detect_from_acpi() -> Result<PhysAddr, ()> {
Ok(PhysAddr::new(madt_header.local_apic_address.into()))
}

/// Helper function to search Floating Pointer Structure of the Multiprocessing Specification
/// Search Floating Pointer Structure of the Multiprocessing Specification
fn search_mp_floating(memory_range: AddrRange<PhysAddr>) -> Result<&'static ApicMP, ()> {
let layout = PageLayout::from_size(BasePageSize::SIZE as usize).unwrap();
let page_range = PageBox::new(layout).unwrap();
Expand Down Expand Up @@ -415,7 +415,7 @@ fn search_mp_floating(memory_range: AddrRange<PhysAddr>) -> Result<&'static Apic
Err(())
}

/// Helper function to detect APIC by the Multiprocessor Specification
/// Detect APIC by the Multiprocessor Specification
fn detect_from_mp() -> Result<PhysAddr, ()> {
let mp_float = if let Ok(mpf) = search_mp_floating(
AddrRange::new(PhysAddr::new(0x9f000u64), PhysAddr::new(0xa0000u64)).unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86_64/kernel/core_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) struct CoreLocal {
scheduler: Cell<*mut PerCoreScheduler>,
/// Task State Segment (TSS) allocated for this CPU Core.
pub tss: Cell<*mut TaskStateSegment>,
/// start address of the kernel stack
/// Start address of the kernel stack
pub kernel_stack: Cell<*mut u8>,
/// Interface to the interrupt counters
irq_statistics: &'static IrqStatistics,
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::arch::x86_64::kernel::acpi;
use crate::arch::x86_64::kernel::{interrupts, pic, pit};
use crate::env;

/// see <http://biosbits.org>.
/// See <http://biosbits.org>.
const MSR_PLATFORM_INFO: u32 = 0xce;

/// See Table 35-2. See Section 14.1, Enhanced Intel Speedstep® Technology.
Expand All @@ -45,7 +45,7 @@ const IA32_MISC_ENABLE_TURBO_DISABLE: u64 = 1 << 38;
/// Maximum Ratio Limit of Turbo Mode RO if MSR_PLATFORM_INFO.\[28\] = 0, RW if MSR_PLATFORM_INFO.\[28\] = 1
const MSR_TURBO_RATIO_LIMIT: u32 = 0x1ad;

/// if CPUID.6H:ECX\[3\] = 1
/// If CPUID.6H:ECX\[3\] = 1
const IA32_ENERGY_PERF_BIAS: u32 = 0x1b0;

// See Intel SDM - Volume 1 - Section 7.3.17.1
Expand Down
14 changes: 7 additions & 7 deletions src/arch/x86_64/kernel/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ struct State {
rcx: u64,
/// RAX register
rax: u64,
/// status flags
/// Status flags
rflags: u64,
/// instruction pointer
/// Instruction pointer
rip: extern "C" fn(extern "C" fn(usize), usize, u64) -> !,
}

pub struct BootStack {
/// stack for kernel tasks
/// Stack for kernel tasks
stack: VirtAddr,
/// stack to handle interrupts
/// Stack to handle interrupts
ist1: VirtAddr,
}

pub struct CommonStack {
/// start address of allocated virtual memory region
/// Start address of allocated virtual memory region
virt_addr: VirtAddr,
/// start address of allocated virtual memory region
/// Start address of allocated virtual memory region
phys_addr: PhysAddr,
/// total size of all stacks
/// Total size of all stacks
total_size: usize,
}

Expand Down
13 changes: 6 additions & 7 deletions src/arch/x86_64/mm/paging.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use core::fmt::Debug;
use core::ptr;
use core::{fmt, ptr};

use free_list::PageLayout;
use x86_64::registers::control::{Cr0, Cr0Flags, Cr2, Cr3};
Expand Down Expand Up @@ -146,7 +145,7 @@ pub fn map<S>(
count: usize,
flags: PageTableEntryFlags,
) where
S: PageSize + Debug,
S: PageSize + fmt::Debug,
for<'a> OffsetPageTable<'a>: Mapper<S>,
{
let pages = {
Expand All @@ -173,7 +172,7 @@ pub fn map<S>(
) -> bool
where
M: Mapper<S>,
S: PageSize + Debug,
S: PageSize + fmt::Debug,
{
let mut unmapped = false;
for (page, frame) in pages.zip(frames) {
Expand Down Expand Up @@ -205,7 +204,7 @@ pub fn map<S>(
/// the number of successful mapped pages are returned as error value.
pub fn map_heap<S>(virt_addr: VirtAddr, count: usize) -> Result<(), usize>
where
S: PageSize + Debug,
S: PageSize + fmt::Debug,
for<'a> OffsetPageTable<'a>: Mapper<S>,
{
let flags = {
Expand All @@ -228,7 +227,7 @@ where

pub fn identity_map<S>(phys_addr: PhysAddr)
where
S: PageSize + Debug,
S: PageSize + fmt::Debug,
for<'a> OffsetPageTable<'a>: Mapper<S>,
{
let frame = PhysFrame::<S>::from_start_address(phys_addr.into()).unwrap();
Expand All @@ -253,7 +252,7 @@ where

pub fn unmap<S>(virtual_address: VirtAddr, count: usize)
where
S: PageSize + Debug,
S: PageSize + fmt::Debug,
for<'a> OffsetPageTable<'a>: Mapper<S>,
{
trace!("Unmapping virtual address {virtual_address:p} ({count} pages)");
Expand Down
3 changes: 1 addition & 2 deletions src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use x86_64::registers::segmentation::SegmentSelector;

use crate::arch::mm::paging::ExceptionStackFrame;

/// Helper function to swap the GS register, if the user-space is
/// is interrupted.
/// Swap the GS register, if the user-space is is interrupted.
#[cfg(feature = "common-os")]
#[inline(always)]
pub(crate) fn swapgs(stack_frame: &ExceptionStackFrame) {
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/net/gem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ enum PhyPartnerAbility {
ANEnableMask = 0x1000,
}

/// size of a receive buffer (must be multiple of 64)
/// Size of a receive buffer (must be multiple of 64)
const RX_BUF_LEN: u32 = 1600;
const RX_BUFFER_MULTIPLE: u32 = 64;
/// Number of receive buffers
const RX_BUF_NUM: u32 = 64;

/// size of a transmit buffer
/// Size of a transmit buffer
const TX_BUF_LEN: u32 = 1600;
/// Number of transmit buffers
const TX_BUF_NUM: u32 = 1;
Expand Down
18 changes: 9 additions & 9 deletions src/drivers/net/rtl8139.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ use crate::drivers::net::{NetworkDriver, mtu};
use crate::drivers::pci::PciDevice;
use crate::mm::device_alloc::DeviceAlloc;

/// size of the receive buffer
/// Size of the receive buffer
const RX_BUF_LEN: usize = 8192;
/// size of the send buffer
/// Size of the send buffer
const TX_BUF_LEN: usize = 4096;

/// Reset, set to 1 to invoke S/W reset, held to 1 while resetting
Expand All @@ -41,24 +41,24 @@ const CR_BUFE: u8 = 0x01;
const CR9346_EEM1: u8 = 0x80;
/// 00 = Normal, 01 = Auto-load, 10 = Programming, 11 = Config, Register write enabled
const CR9346_EEM0: u8 = 0x40;
/// status of EESK
/// Status of EESK
const CR9346_EESK: u8 = 0x4;
/// status of EEDI
/// Status of EEDI
const CR9346_EEDI: u8 = 0x2;
/// status of EEDO
/// Status of EEDO
const CR9346_EEDO: u8 = 0x1;

/// leds status
/// Leds status
const CONFIG1_LEDS: u8 = 0xc0;
/// is the driver loaded ?
/// Is the driver loaded ?
const CONFIG1_DVRLOAD: u8 = 0x20;
/// lanwake mode
/// Lanwake mode
const CONFIG1_LWACT: u8 = 0x10;
/// Memory mapping enabled ?
const CONFIG1_MEMMAP: u8 = 0x8;
/// IO map enabled ?
const CONFIG1_IOMAP: u8 = 0x4;
/// enable the virtual product data
/// Enable the virtual product data
const CONFIG1_VPD: u8 = 0x2;
/// Power Management Enable
const CONFIG1_PMEN: u8 = 0x1;
Expand Down
14 changes: 7 additions & 7 deletions src/fd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ bitflags! {
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct PollFd {
/// file descriptor
/// File descriptor
pub fd: i32,
/// events to look for
/// Events to look for
pub events: PollEvent,
/// events returned
/// Events returned
pub revents: PollEvent,
}

Expand Down Expand Up @@ -197,7 +197,7 @@ impl Default for AccessPermission {

#[async_trait]
pub(crate) trait ObjectInterface: Sync + Send {
/// check if an IO event is possible
/// Check if an IO event is possible
async fn poll(&self, _event: PollEvent) -> io::Result<PollEvent> {
Ok(PollEvent::empty())
}
Expand Down Expand Up @@ -282,13 +282,13 @@ pub(crate) trait ObjectInterface: Sync + Send {
Ok(None)
}

/// receive a message from a socket
/// Receive a message from a socket
#[cfg(any(feature = "net", feature = "virtio-vsock"))]
async fn recvfrom(&self, _buffer: &mut [MaybeUninit<u8>]) -> io::Result<(usize, Endpoint)> {
Err(Errno::Nosys)
}

/// send a message from a socket
/// Send a message from a socket
///
/// The sendto() function shall send a message.
/// If the socket is a connectionless-mode socket, the message shall
Expand All @@ -300,7 +300,7 @@ pub(crate) trait ObjectInterface: Sync + Send {
Err(Errno::Nosys)
}

/// shut down part of a full-duplex connection
/// Shut down part of a full-duplex connection
#[cfg(any(feature = "net", feature = "virtio-vsock"))]
async fn shutdown(&self, _how: i32) -> io::Result<()> {
Err(Errno::Nosys)
Expand Down
6 changes: 3 additions & 3 deletions src/fd/socket/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ use crate::fd::{self, Endpoint, ListenEndpoint, ObjectInterface, PollEvent, Sock
use crate::syscalls::socket::Af;
use crate::{DEFAULT_KEEP_ALIVE_INTERVAL, io};

/// further receives will be disallowed
/// Further receives will be disallowed
pub const SHUT_RD: i32 = 0;
/// further sends will be disallowed
/// Further sends will be disallowed
pub const SHUT_WR: i32 = 1;
/// further sends and receives will be disallowed
/// Further sends and receives will be disallowed
pub const SHUT_RDWR: i32 = 2;
/// The default queue size for incoming connections
pub const DEFAULT_BACKLOG: i32 = 128;
Expand Down
5 changes: 3 additions & 2 deletions src/fs/fuse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub(crate) mod ops {
#![allow(clippy::type_complexity)]
use alloc::boxed::Box;
use alloc::ffi::CString;
use core::fmt;

use fuse_abi::linux;
use fuse_abi::linux::*;
Expand All @@ -81,9 +82,9 @@ pub(crate) mod ops {
pub(crate) trait Op {
const OP_CODE: fuse_opcode;

type InStruct: core::fmt::Debug;
type InStruct: fmt::Debug;
type InPayload: ?Sized;
type OutStruct: core::fmt::Debug;
type OutStruct: fmt::Debug;
type OutPayload: ?Sized;
}

Expand Down
Loading
Loading