Skip to content

Commit 1980a19

Browse files
committed
Format imports
1 parent d2e6c6d commit 1980a19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+288
-315
lines changed

src/arch/aarch64/kernel/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ pub mod stubs;
99
pub mod switch;
1010
pub mod systemtime;
1111

12-
pub use crate::arch::aarch64::kernel::stubs::*;
13-
pub use crate::arch::aarch64::kernel::systemtime::get_boot_time;
14-
1512
use core::arch::{asm, global_asm};
1613
use core::ptr;
1714

1815
use hermit_entry::boot_info::{BootInfo, PlatformInfo, RawBootInfo};
1916

2017
use crate::arch::aarch64::kernel::percore::*;
2118
use crate::arch::aarch64::kernel::serial::SerialPort;
19+
pub use crate::arch::aarch64::kernel::stubs::*;
20+
pub use crate::arch::aarch64::kernel::systemtime::get_boot_time;
2221
use crate::arch::aarch64::mm::{PhysAddr, VirtAddr};
2322
use crate::config::*;
2423
use crate::env;

src/arch/aarch64/kernel/pci.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use crate::synch::spinlock::SpinlockIrqSave;
21
use alloc::rc::Rc;
32
use core::cell::RefCell;
43

4+
use crate::synch::spinlock::SpinlockIrqSave;
5+
56
// Currently, onbly a dummy implementation
67
pub struct VirtioNetDriver;
78

src/arch/aarch64/kernel/percore.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::scheduler::{CoreId, PerCoreScheduler};
21
use core::ptr;
32

3+
use crate::scheduler::{CoreId, PerCoreScheduler};
4+
45
#[no_mangle]
56
pub static mut PERCORE: PerCoreVariables = PerCoreVariables::new(0);
67

src/arch/aarch64/kernel/scheduler.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//! Architecture dependent interface to initialize a task
22
3+
use alloc::rc::Rc;
4+
use core::cell::RefCell;
5+
use core::{mem, ptr};
6+
37
use crate::arch::aarch64::kernel::percore::*;
48
use crate::arch::aarch64::kernel::processor;
59
use crate::arch::aarch64::mm::paging::{BasePageSize, PageSize, PageTableEntryFlags};
610
use crate::arch::aarch64::mm::{PhysAddr, VirtAddr};
7-
use crate::env;
811
use crate::scheduler::task::{Task, TaskFrame};
9-
use crate::{DEFAULT_STACK_SIZE, KERNEL_STACK_SIZE};
10-
use alloc::rc::Rc;
11-
use core::cell::RefCell;
12-
use core::{mem, ptr};
12+
use crate::{env, DEFAULT_STACK_SIZE, KERNEL_STACK_SIZE};
1313

1414
extern "C" {
1515
static tls_start: u8;

src/arch/aarch64/kernel/start.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
use core::arch::asm;
22

3-
use hermit_entry::{
4-
boot_info::{BootInfo, RawBootInfo},
5-
Entry,
6-
};
3+
use hermit_entry::boot_info::{BootInfo, RawBootInfo};
4+
use hermit_entry::Entry;
75

6+
use crate::arch::aarch64::kernel::scheduler::TaskStacks;
87
use crate::arch::aarch64::kernel::serial::SerialPort;
9-
use crate::arch::aarch64::kernel::{
10-
get_processor_count, scheduler::TaskStacks, BOOT_INFO, RAW_BOOT_INFO,
11-
};
8+
use crate::arch::aarch64::kernel::{get_processor_count, BOOT_INFO, RAW_BOOT_INFO};
129
use crate::KERNEL_STACK_SIZE;
1310

1411
extern "C" {

src/arch/aarch64/mm/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ pub mod paging;
22
pub mod physicalmem;
33
pub mod virtualmem;
44

5-
pub use aarch64::paging::PhysAddr;
6-
pub use aarch64::paging::VirtAddr;
5+
pub use aarch64::paging::{PhysAddr, VirtAddr};
76

87
pub use self::physicalmem::init_page_tables;
98

src/arch/aarch64/mm/paging.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@ use core::marker::PhantomData;
33
use core::{fmt, mem, ptr, usize};
44

55
use crate::arch::aarch64::kernel::percore::*;
6-
use crate::arch::aarch64::kernel::processor;
76
use crate::arch::aarch64::kernel::{
8-
get_base_address, get_boot_info_address, get_image_size, get_ram_address, is_uhyve,
7+
get_base_address, get_boot_info_address, get_image_size, get_ram_address, is_uhyve, processor,
98
};
10-
use crate::arch::aarch64::mm::physicalmem;
11-
use crate::arch::aarch64::mm::virtualmem;
12-
use crate::arch::aarch64::mm::{PhysAddr, VirtAddr};
13-
use crate::mm;
14-
use crate::scheduler;
15-
use crate::KERNEL_STACK_SIZE;
9+
use crate::arch::aarch64::mm::{physicalmem, virtualmem, PhysAddr, VirtAddr};
10+
use crate::{mm, scheduler, KERNEL_STACK_SIZE};
1611

1712
/// Pointer to the root page table (called "Level 0" in ARM terminology).
1813
/// Setting the upper bits to zero tells the MMU to use TTBR0 for the base address for the first table.

src/arch/mod.rs

+13-24
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,28 @@ pub mod x86_64;
77

88
// Export our platform-specific modules.
99
#[cfg(target_arch = "aarch64")]
10-
pub use crate::arch::aarch64::*;
11-
12-
#[cfg(target_arch = "aarch64")]
13-
pub use crate::arch::aarch64::kernel::stubs::{set_oneshot_timer, wakeup_core};
14-
10+
pub use crate::arch::aarch64::kernel::irq;
1511
#[cfg(target_arch = "aarch64")]
16-
pub use crate::arch::aarch64::kernel::{
17-
application_processor_init, boot_application_processors, boot_processor_init,
18-
get_processor_count, message_output_init, output_message_buf, output_message_byte,
19-
};
20-
12+
pub use crate::arch::aarch64::kernel::percore;
2113
#[cfg(target_arch = "aarch64")]
2214
use crate::arch::aarch64::kernel::percore::core_scheduler;
23-
2415
#[cfg(target_arch = "aarch64")]
25-
pub use crate::arch::aarch64::kernel::percore;
26-
16+
pub use crate::arch::aarch64::kernel::processor;
2717
#[cfg(target_arch = "aarch64")]
2818
pub use crate::arch::aarch64::kernel::scheduler;
29-
3019
#[cfg(target_arch = "aarch64")]
31-
pub use crate::arch::aarch64::kernel::processor;
32-
20+
pub use crate::arch::aarch64::kernel::stubs::{set_oneshot_timer, wakeup_core};
3321
#[cfg(target_arch = "aarch64")]
34-
pub use crate::arch::aarch64::kernel::irq;
35-
22+
pub use crate::arch::aarch64::kernel::switch;
3623
#[cfg(target_arch = "aarch64")]
3724
pub use crate::arch::aarch64::kernel::systemtime::get_boot_time;
38-
3925
#[cfg(target_arch = "aarch64")]
40-
pub use crate::arch::aarch64::kernel::switch;
41-
42-
#[cfg(target_arch = "x86_64")]
43-
pub use crate::arch::x86_64::*;
44-
26+
pub use crate::arch::aarch64::kernel::{
27+
application_processor_init, boot_application_processors, boot_processor_init,
28+
get_processor_count, message_output_init, output_message_buf, output_message_byte,
29+
};
30+
#[cfg(target_arch = "aarch64")]
31+
pub use crate::arch::aarch64::*;
4532
#[cfg(target_arch = "x86_64")]
4633
pub use crate::arch::x86_64::kernel::apic::{set_oneshot_timer, wakeup_core};
4734
#[cfg(all(target_arch = "x86_64", target_os = "none", feature = "smp"))]
@@ -66,6 +53,8 @@ pub use crate::arch::x86_64::kernel::{boot_application_processors, boot_processo
6653
pub use crate::arch::x86_64::kernel::{
6754
get_processor_count, message_output_init, output_message_buf, output_message_byte,
6855
};
56+
#[cfg(target_arch = "x86_64")]
57+
pub use crate::arch::x86_64::*;
6958

7059
pub fn init_drivers() {
7160
// Initialize PCI Drivers if on x86_64

src/arch/x86_64/kernel/acpi.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
use core::convert::Infallible;
2+
use core::{mem, ptr, slice, str};
3+
14
use x86_64::structures::paging::PhysFrame;
25

36
use crate::arch::x86_64::kernel::processor;
47
use crate::arch::x86_64::mm::paging::{
58
BasePageSize, PageSize, PageTableEntryFlags, PageTableEntryFlagsExt,
69
};
7-
use crate::arch::x86_64::mm::{paging, virtualmem};
8-
use crate::arch::x86_64::mm::{PhysAddr, VirtAddr};
10+
use crate::arch::x86_64::mm::{paging, virtualmem, PhysAddr, VirtAddr};
911
use crate::x86::io::*;
10-
use core::convert::Infallible;
11-
use core::{mem, ptr, slice, str};
1212

1313
/// Memory at this physical address is supposed to contain a pointer to the Extended BIOS Data Area (EBDA).
1414
const EBDA_PTR_LOCATION: PhysAddr = PhysAddr(0x0000_040E);

src/arch/x86_64/kernel/apic.rs

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
1-
use crate::arch;
1+
use alloc::boxed::Box;
2+
use alloc::vec::Vec;
3+
#[cfg(any(feature = "pci", feature = "smp"))]
4+
use core::arch::x86_64::_mm_mfence;
5+
use core::hint::spin_loop;
6+
#[cfg(feature = "smp")]
7+
use core::ptr;
8+
use core::sync::atomic::Ordering;
9+
use core::{cmp, fmt, mem, u32};
10+
11+
use arch::x86_64::kernel::percore::*;
12+
use arch::x86_64::kernel::{idt, irq, processor};
13+
use crossbeam_utils::CachePadded;
14+
215
#[cfg(feature = "acpi")]
316
use crate::arch::x86_64::kernel::acpi;
417
use crate::arch::x86_64::kernel::irq::IrqStatistics;
518
use crate::arch::x86_64::kernel::{CURRENT_STACK_ADDRESS, IRQ_COUNTERS};
619
use crate::arch::x86_64::mm::paging::{
720
BasePageSize, PageSize, PageTableEntryFlags, PageTableEntryFlagsExt,
821
};
9-
use crate::arch::x86_64::mm::{paging, virtualmem};
10-
use crate::arch::x86_64::mm::{PhysAddr, VirtAddr};
22+
use crate::arch::x86_64::mm::{paging, virtualmem, PhysAddr, VirtAddr};
1123
use crate::collections::irqsave;
1224
use crate::config::*;
13-
use crate::env;
14-
use crate::mm;
15-
use crate::scheduler;
1625
use crate::scheduler::CoreId;
1726
#[cfg(feature = "smp")]
1827
use crate::x86::controlregs::*;
1928
use crate::x86::msr::*;
20-
use alloc::boxed::Box;
21-
use alloc::vec::Vec;
22-
use arch::x86_64::kernel::{idt, irq, percore::*, processor};
23-
#[cfg(any(feature = "pci", feature = "smp"))]
24-
use core::arch::x86_64::_mm_mfence;
25-
use core::hint::spin_loop;
26-
#[cfg(feature = "smp")]
27-
use core::ptr;
28-
use core::sync::atomic::Ordering;
29-
use core::{cmp, fmt, mem, u32};
30-
use crossbeam_utils::CachePadded;
29+
use crate::{arch, env, mm, scheduler};
3130

3231
const MP_FLT_SIGNATURE: u32 = 0x5f504d5f;
3332
const MP_CONFIG_SIGNATURE: u32 = 0x504d4350;

src/arch/x86_64/kernel/fuse.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
use crate::arch::kernel::pci::get_filesystem_driver;
2-
use crate::syscalls::fs::{FileError, FilePerms, PosixFile, PosixFileSystem, SeekWhence};
31
use alloc::boxed::Box;
42
use alloc::vec::Vec;
53
use core::{fmt, u32, u8};
64

5+
use crate::arch::kernel::pci::get_filesystem_driver;
6+
use crate::syscalls::fs::{FileError, FilePerms, PosixFile, PosixFileSystem, SeekWhence};
7+
78
// response out layout eg @ https://github.com/zargony/fuse-rs/blob/bf6d1cf03f3277e35b580f3c7b9999255d72ecf3/src/ll/request.rs#L44
89
// op in/out sizes/layout: https://github.com/hanwen/go-fuse/blob/204b45dba899dfa147235c255908236d5fde2d32/fuse/opcode.go#L439
910
// possible responses for command: qemu/tools/virtiofsd/fuse_lowlevel.h

src/arch/x86_64/kernel/gdt.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
use alloc::boxed::Box;
2+
use core::mem;
3+
use core::sync::atomic::Ordering;
4+
5+
use super::scheduler::TaskStacks;
6+
use super::CURRENT_STACK_ADDRESS;
17
use crate::arch::x86_64::kernel::percore::*;
28
use crate::config::*;
39
use crate::x86::bits64::segmentation::*;
@@ -6,12 +12,6 @@ use crate::x86::dtables::{self, DescriptorTablePointer};
612
use crate::x86::segmentation::*;
713
use crate::x86::task::*;
814
use crate::x86::Ring;
9-
use alloc::boxed::Box;
10-
use core::mem;
11-
use core::sync::atomic::Ordering;
12-
13-
use super::scheduler::TaskStacks;
14-
use super::CURRENT_STACK_ADDRESS;
1515

1616
pub const GDT_NULL: u16 = 0;
1717
pub const GDT_KERNEL_CODE: u16 = 1;

src/arch/x86_64/kernel/idt.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
use core::sync::atomic::{AtomicBool, Ordering};
2+
13
use crate::arch::x86_64::kernel::gdt;
24
use crate::x86::bits64::paging::VAddr;
35
use crate::x86::dtables::{self, DescriptorTablePointer};
46
use crate::x86::segmentation::{SegmentSelector, SystemDescriptorTypes64};
57
use crate::x86::Ring;
6-
use core::sync::atomic::{AtomicBool, Ordering};
78

89
/// An interrupt gate descriptor.
910
///

src/arch/x86_64/kernel/irq.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
use crate::arch::x86_64::kernel::apic;
2-
use crate::arch::x86_64::kernel::idt;
3-
use crate::arch::x86_64::kernel::percore::*;
4-
use crate::arch::x86_64::kernel::processor;
5-
use crate::scheduler;
6-
use crate::synch::spinlock::SpinlockIrqSave;
7-
8-
use crate::alloc::string::ToString;
91
use alloc::collections::BTreeMap;
102
use alloc::string::String;
113
use core::arch::asm;
124
use core::fmt;
5+
136
use x86::bits64::rflags::{self, RFlags};
14-
use x86::controlregs;
15-
use x86::irq;
167
use x86::irq::PageFaultError;
8+
use x86::{controlregs, irq};
9+
10+
use crate::alloc::string::ToString;
11+
use crate::arch::x86_64::kernel::percore::*;
12+
use crate::arch::x86_64::kernel::{apic, idt, processor};
13+
use crate::scheduler;
14+
use crate::synch::spinlock::SpinlockIrqSave;
1715

1816
static IRQ_NAMES: SpinlockIrqSave<BTreeMap<u32, String>> = SpinlockIrqSave::new(BTreeMap::new());
1917

src/arch/x86_64/kernel/mmio.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
use crate::collections::irqsave;
1+
use alloc::vec::Vec;
2+
use core::str;
23

3-
use crate::arch::x86_64::mm::paging;
44
use crate::arch::x86_64::mm::paging::{
55
BasePageSize, PageSize, PageTableEntryFlags, PageTableEntryFlagsExt,
66
};
7-
use crate::arch::x86_64::mm::PhysAddr;
7+
use crate::arch::x86_64::mm::{paging, PhysAddr};
8+
use crate::collections::irqsave;
89
use crate::drivers::net::virtio_net::VirtioNetDriver;
910
use crate::drivers::net::NetworkInterface;
1011
use crate::drivers::virtio::transport::mmio as mmio_virtio;
1112
use crate::drivers::virtio::transport::mmio::{DevId, MmioRegisterLayout, VirtioDriver};
1213
use crate::synch::spinlock::SpinlockIrqSave;
13-
use alloc::vec::Vec;
14-
use core::str;
1514

1615
pub const MAGIC_VALUE: u32 = 0x74726976;
1716

src/arch/x86_64/kernel/pci.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
use alloc::vec::Vec;
2+
use core::{fmt, u32, u8};
3+
14
use num_derive::{FromPrimitive, ToPrimitive};
25

36
use crate::arch::x86_64::mm::{PhysAddr, VirtAddr};
@@ -10,8 +13,6 @@ use crate::drivers::virtio::transport::pci as pci_virtio;
1013
use crate::drivers::virtio::transport::pci::VirtioDriver;
1114
use crate::synch::spinlock::SpinlockIrqSave;
1215
use crate::x86::io::*;
13-
use alloc::vec::Vec;
14-
use core::{fmt, u32, u8};
1516

1617
// TODO: should these be pub? currently needed since used in virtio.rs maybe use getter methods to be more flexible.
1718
pub const PCI_MAX_BUS_NUMBER: u8 = 32;

src/arch/x86_64/kernel/percore.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
use core::arch::asm;
2+
use core::sync::atomic::{AtomicU64, Ordering};
3+
use core::{mem, ptr};
4+
5+
use crossbeam_utils::CachePadded;
6+
17
use crate::arch::x86_64::kernel::irq::IrqStatistics;
28
use crate::scheduler::{CoreId, PerCoreScheduler};
39
use crate::x86::bits64::task::TaskStateSegment;
410
use crate::x86::msr::*;
5-
use core::arch::asm;
6-
use core::mem;
7-
use core::ptr;
8-
use core::sync::atomic::{AtomicU64, Ordering};
9-
use crossbeam_utils::CachePadded;
1011

1112
pub static mut PERCORE: PerCoreVariables = CachePadded::new(PerCoreInnerVariables::new(0));
1213

0 commit comments

Comments
 (0)