mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-22 01:16:26 +04:00
add cargo fmt in Makefile, and exec make fmt
This commit is contained in:
parent
daf439cff4
commit
3aa7fac88a
2
Makefile
2
Makefile
@ -6,3 +6,5 @@ docker:
|
||||
|
||||
build_docker:
|
||||
docker build -t ${DOCKER_NAME} .
|
||||
fmt:
|
||||
cd easy-fs; cargo fmt; cd ../easy-fs-fuse cargo fmt; cd ../os ; cargo fmt; cd ../user; cargo fmt; cd ..
|
@ -3,4 +3,3 @@ pub const CLOCK_FREQ: usize = 12500000;
|
||||
pub const MMIO: &[(usize, usize)] = &[(0x10001000, 0x1000)];
|
||||
|
||||
pub type BlockDeviceImpl = crate::drivers::block::VirtIOBlock;
|
||||
|
||||
|
@ -12,4 +12,3 @@ pub const TRAMPOLINE: usize = usize::MAX - PAGE_SIZE + 1;
|
||||
pub const TRAP_CONTEXT: usize = TRAMPOLINE - PAGE_SIZE;
|
||||
|
||||
pub use crate::board::{CLOCK_FREQ, MMIO};
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
mod sdcard;
|
||||
mod virtio_blk;
|
||||
|
||||
pub use virtio_blk::VirtIOBlock;
|
||||
pub use sdcard::SDCardWrapper;
|
||||
pub use virtio_blk::VirtIOBlock;
|
||||
|
||||
use crate::board::BlockDeviceImpl;
|
||||
use alloc::sync::Arc;
|
||||
use easy_fs::BlockDevice;
|
||||
use lazy_static::*;
|
||||
use crate::board::BlockDeviceImpl;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref BLOCK_DEVICE: Arc<dyn BlockDevice> = Arc::new(BlockDeviceImpl::new());
|
||||
|
@ -389,26 +389,20 @@ pub fn remap_test() {
|
||||
let mid_text: VirtAddr = ((stext as usize + etext as usize) / 2).into();
|
||||
let mid_rodata: VirtAddr = ((srodata as usize + erodata as usize) / 2).into();
|
||||
let mid_data: VirtAddr = ((sdata as usize + edata as usize) / 2).into();
|
||||
assert!(
|
||||
!kernel_space
|
||||
.page_table
|
||||
.translate(mid_text.floor())
|
||||
.unwrap()
|
||||
.writable(),
|
||||
);
|
||||
assert!(
|
||||
!kernel_space
|
||||
.page_table
|
||||
.translate(mid_rodata.floor())
|
||||
.unwrap()
|
||||
.writable(),
|
||||
);
|
||||
assert!(
|
||||
!kernel_space
|
||||
.page_table
|
||||
.translate(mid_data.floor())
|
||||
.unwrap()
|
||||
.executable(),
|
||||
);
|
||||
assert!(!kernel_space
|
||||
.page_table
|
||||
.translate(mid_text.floor())
|
||||
.unwrap()
|
||||
.writable(),);
|
||||
assert!(!kernel_space
|
||||
.page_table
|
||||
.translate(mid_rodata.floor())
|
||||
.unwrap()
|
||||
.writable(),);
|
||||
assert!(!kernel_space
|
||||
.page_table
|
||||
.translate(mid_data.floor())
|
||||
.unwrap()
|
||||
.executable(),);
|
||||
println!("remap_test passed!");
|
||||
}
|
||||
|
@ -155,8 +155,8 @@ impl PageTable {
|
||||
8usize << 60 | self.root_ppn.0
|
||||
}
|
||||
}
|
||||
/// Translate a pointer to a mutable u8 Vec through page table
|
||||
pub fn translated_byte_buffer(token: usize, ptr: *const u8, len: usize) -> Vec<&'static mut [u8]> {
|
||||
/// Translate a pointer to a mutable u8 Vec through page table
|
||||
pub fn translated_byte_buffer(token: usize, ptr: *const u8, len: usize) -> Vec<&'static mut [u8]> {
|
||||
let page_table = PageTable::from_token(token);
|
||||
let mut start = ptr as usize;
|
||||
let end = start + len;
|
||||
|
@ -27,14 +27,15 @@ use crate::fs::{open_file, OpenFlags};
|
||||
use alloc::sync::Arc;
|
||||
pub use context::TaskContext;
|
||||
use lazy_static::*;
|
||||
pub use manager::{fetch_task,TaskManager};
|
||||
pub use manager::{fetch_task, TaskManager};
|
||||
use switch::__switch;
|
||||
use task::{TaskControlBlock, TaskStatus};
|
||||
|
||||
pub use manager::add_task;
|
||||
pub use pid::{pid_alloc, KernelStack, PidHandle,PidAllocator};
|
||||
pub use pid::{pid_alloc, KernelStack, PidAllocator, PidHandle};
|
||||
pub use processor::{
|
||||
current_task, current_trap_cx, current_user_token, run_tasks, schedule, take_current_task,Processor
|
||||
current_task, current_trap_cx, current_user_token, run_tasks, schedule, take_current_task,
|
||||
Processor,
|
||||
};
|
||||
/// Suspend the current 'Running' task and run the next task in task list.
|
||||
pub fn suspend_current_and_run_next() {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
//! RISC-V timer-related functionality
|
||||
|
||||
use crate::config::CLOCK_FREQ;
|
||||
|
Loading…
Reference in New Issue
Block a user