Skip to content

Commit db40648

Browse files
authored
Merge pull request #2229 from hermit-os/vfs-node-sync-send
refactor: clean up docs, `core::fmt` imports and `VfsNode + Send + Sync`
2 parents 84a5a8b + b485e1c commit db40648

File tree

26 files changed

+123
-132
lines changed

26 files changed

+123
-132
lines changed

src/arch/aarch64/kernel/processor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ use crate::env;
2121
pub struct FPUState {
2222
/// Advanced SIMD 128-bit vector registers.
2323
q: [u128; 32],
24-
/// fpcr register.
24+
/// FPCR register.
2525
fpcr: u64,
26-
/// fpsr register.
26+
/// FPSR register.
2727
fpsr: u64,
2828
}
2929

src/arch/aarch64/kernel/scheduler.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::{DEFAULT_STACK_SIZE, KERNEL_STACK_SIZE};
2121
#[derive(Debug)]
2222
#[repr(C, packed)]
2323
pub(crate) struct State {
24-
/// stack selector
24+
/// Stack selector
2525
pub spsel: u64,
2626
/// Exception Link Register
2727
pub elr_el1: extern "C" fn(extern "C" fn(usize), usize) -> !,
@@ -96,16 +96,16 @@ pub(crate) struct State {
9696
}
9797

9898
pub struct BootStack {
99-
/// stack for kernel tasks
99+
/// Stack for kernel tasks
100100
stack: VirtAddr,
101101
}
102102

103103
pub struct CommonStack {
104-
/// start address of allocated virtual memory region
104+
/// Start address of allocated virtual memory region
105105
virt_addr: VirtAddr,
106-
/// start address of allocated virtual memory region
106+
/// Start address of allocated virtual memory region
107107
phys_addr: PhysAddr,
108-
/// total size of all stacks
108+
/// Total size of all stacks
109109
total_size: usize,
110110
}
111111

src/arch/riscv64/kernel/core_local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct CoreLocal {
1919
core_id: CoreId,
2020
/// Scheduler of the current Core.
2121
scheduler: Cell<*mut PerCoreScheduler>,
22-
/// start address of the kernel stack
22+
/// Start address of the kernel stack
2323
pub kernel_stack: Cell<u64>,
2424
/// The core-local async executor.
2525
ex: StaticLocalExecutor<RawSpinMutex, RawRwSpinLock>,

src/arch/riscv64/kernel/interrupts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::drivers::mmio::get_interrupt_handlers;
1616
use crate::drivers::pci::get_interrupt_handlers;
1717
use crate::scheduler;
1818

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

2222
/// PLIC context for new interrupt handlers

src/arch/riscv64/kernel/scheduler.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ use crate::{DEFAULT_STACK_SIZE, KERNEL_STACK_SIZE};
1414
#[repr(C, packed)]
1515
#[derive(Clone, Copy, Debug)]
1616
pub struct State {
17-
/// return address register
17+
/// Return address register
1818
ra: unsafe extern "C" fn(extern "C" fn(usize), usize, u64),
19-
/// stack pointer register
19+
/// Stack pointer register
2020
sp: usize,
21-
/// global pointer register
21+
/// Global pointer register
2222
gp: usize,
23-
/// thread pointer register
23+
/// Thread pointer register
2424
tp: usize,
2525
/// x5 register
2626
x5: usize,
@@ -79,16 +79,16 @@ pub struct State {
7979
}
8080

8181
pub struct BootStack {
82-
/// stack for kernel tasks
82+
/// Stack for kernel tasks
8383
stack: VirtAddr,
8484
}
8585

8686
pub struct CommonStack {
87-
/// start address of allocated virtual memory region
87+
/// Start address of allocated virtual memory region
8888
virt_addr: VirtAddr,
89-
/// start address of allocated virtual memory region
89+
/// Start address of allocated virtual memory region
9090
phys_addr: PhysAddr,
91-
/// total size of all stacks
91+
/// Total size of all stacks
9292
total_size: usize,
9393
}
9494

src/arch/x86_64/kernel/apic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ fn detect_from_acpi() -> Result<PhysAddr, ()> {
384384
Ok(PhysAddr::new(madt_header.local_apic_address.into()))
385385
}
386386

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

418-
/// Helper function to detect APIC by the Multiprocessor Specification
418+
/// Detect APIC by the Multiprocessor Specification
419419
fn detect_from_mp() -> Result<PhysAddr, ()> {
420420
let mp_float = if let Ok(mpf) = search_mp_floating(
421421
AddrRange::new(PhysAddr::new(0x9f000u64), PhysAddr::new(0xa0000u64)).unwrap(),

src/arch/x86_64/kernel/core_local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) struct CoreLocal {
2828
scheduler: Cell<*mut PerCoreScheduler>,
2929
/// Task State Segment (TSS) allocated for this CPU Core.
3030
pub tss: Cell<*mut TaskStateSegment>,
31-
/// start address of the kernel stack
31+
/// Start address of the kernel stack
3232
pub kernel_stack: Cell<*mut u8>,
3333
/// Interface to the interrupt counters
3434
irq_statistics: &'static IrqStatistics,

src/arch/x86_64/kernel/processor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::arch::x86_64::kernel::acpi;
3030
use crate::arch::x86_64::kernel::{interrupts, pic, pit};
3131
use crate::env;
3232

33-
/// see <http://biosbits.org>.
33+
/// See <http://biosbits.org>.
3434
const MSR_PLATFORM_INFO: u32 = 0xce;
3535

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

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

5151
// See Intel SDM - Volume 1 - Section 7.3.17.1

src/arch/x86_64/kernel/scheduler.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,25 @@ struct State {
5656
rcx: u64,
5757
/// RAX register
5858
rax: u64,
59-
/// status flags
59+
/// Status flags
6060
rflags: u64,
61-
/// instruction pointer
61+
/// Instruction pointer
6262
rip: extern "C" fn(extern "C" fn(usize), usize, u64) -> !,
6363
}
6464

6565
pub struct BootStack {
66-
/// stack for kernel tasks
66+
/// Stack for kernel tasks
6767
stack: VirtAddr,
68-
/// stack to handle interrupts
68+
/// Stack to handle interrupts
6969
ist1: VirtAddr,
7070
}
7171

7272
pub struct CommonStack {
73-
/// start address of allocated virtual memory region
73+
/// Start address of allocated virtual memory region
7474
virt_addr: VirtAddr,
75-
/// start address of allocated virtual memory region
75+
/// Start address of allocated virtual memory region
7676
phys_addr: PhysAddr,
77-
/// total size of all stacks
77+
/// Total size of all stacks
7878
total_size: usize,
7979
}
8080

src/arch/x86_64/mm/paging.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use core::fmt::Debug;
2-
use core::ptr;
1+
use core::{fmt, ptr};
32

43
use free_list::PageLayout;
54
use x86_64::registers::control::{Cr0, Cr0Flags, Cr2, Cr3};
@@ -146,7 +145,7 @@ pub fn map<S>(
146145
count: usize,
147146
flags: PageTableEntryFlags,
148147
) where
149-
S: PageSize + Debug,
148+
S: PageSize + fmt::Debug,
150149
for<'a> OffsetPageTable<'a>: Mapper<S>,
151150
{
152151
let pages = {
@@ -173,7 +172,7 @@ pub fn map<S>(
173172
) -> bool
174173
where
175174
M: Mapper<S>,
176-
S: PageSize + Debug,
175+
S: PageSize + fmt::Debug,
177176
{
178177
let mut unmapped = false;
179178
for (page, frame) in pages.zip(frames) {
@@ -205,7 +204,7 @@ pub fn map<S>(
205204
/// the number of successful mapped pages are returned as error value.
206205
pub fn map_heap<S>(virt_addr: VirtAddr, count: usize) -> Result<(), usize>
207206
where
208-
S: PageSize + Debug,
207+
S: PageSize + fmt::Debug,
209208
for<'a> OffsetPageTable<'a>: Mapper<S>,
210209
{
211210
let flags = {
@@ -228,7 +227,7 @@ where
228227

229228
pub fn identity_map<S>(phys_addr: PhysAddr)
230229
where
231-
S: PageSize + Debug,
230+
S: PageSize + fmt::Debug,
232231
for<'a> OffsetPageTable<'a>: Mapper<S>,
233232
{
234233
let frame = PhysFrame::<S>::from_start_address(phys_addr.into()).unwrap();
@@ -253,7 +252,7 @@ where
253252

254253
pub fn unmap<S>(virtual_address: VirtAddr, count: usize)
255254
where
256-
S: PageSize + Debug,
255+
S: PageSize + fmt::Debug,
257256
for<'a> OffsetPageTable<'a>: Mapper<S>,
258257
{
259258
trace!("Unmapping virtual address {virtual_address:p} ({count} pages)");

0 commit comments

Comments
 (0)