Fix format errors

This commit is contained in:
Jianfeng Jiang 2024-03-22 06:40:31 +00:00 committed by Tate, Hongliang Tian
parent 63499c675c
commit 5941d3e6eb
4 changed files with 17 additions and 7 deletions

View File

@ -8,8 +8,8 @@ use crate::{
arch::mm::{PageTableEntry, PageTableFlags}, arch::mm::{PageTableEntry, PageTableFlags},
prelude::*, prelude::*,
vm::{ vm::{
is_page_aligned, VmAllocOptions, VmFrame, VmFrameVec, VmReader, VmWriter, is_page_aligned, VmAllocOptions, VmFrame, VmFrameVec, VmReader, VmWriter, PAGE_SIZE,
PHYS_MEM_BASE_VADDR, PAGE_SIZE, PHYS_MEM_BASE_VADDR,
}, },
Error, Error,
}; };

View File

@ -37,7 +37,7 @@ use crate::boot::memory_region::{MemoryRegion, MemoryRegionType};
pub const PAGE_SIZE: usize = 0x1000; pub const PAGE_SIZE: usize = 0x1000;
/// The maximum virtual address of user space (non inclusive). /// The maximum virtual address of user space (non inclusive).
/// ///
/// Typicall 64-bit systems have at least 48-bit virtual address space. /// Typicall 64-bit systems have at least 48-bit virtual address space.
/// A typical way to reserve half of the address space for the kernel is /// A typical way to reserve half of the address space for the kernel is
/// to use the highest 48-bit virtual address space. /// to use the highest 48-bit virtual address space.
@ -49,7 +49,7 @@ pub const PAGE_SIZE: usize = 0x1000;
pub const MAX_USERSPACE_VADDR: Vaddr = 0x0000_8000_0000_0000 - PAGE_SIZE; pub const MAX_USERSPACE_VADDR: Vaddr = 0x0000_8000_0000_0000 - PAGE_SIZE;
/// Start of the kernel address space. /// Start of the kernel address space.
/// ///
/// This is the _lowest_ address of the x86-64's _high_ canonical addresses. /// This is the _lowest_ address of the x86-64's _high_ canonical addresses.
/// ///
/// This is also the base address of the direct mapping of all physical /// This is also the base address of the direct mapping of all physical

View File

@ -40,7 +40,9 @@ fn work_in_workspace() {
.open(&module_src_path) .open(&module_src_path)
.unwrap(); .unwrap();
module_src_file module_src_file
.write_all(include_bytes!("work_in_workspace_templates/mymodule/src/lib.rs")) .write_all(include_bytes!(
"work_in_workspace_templates/mymodule/src/lib.rs"
))
.unwrap(); .unwrap();
module_src_file.flush().unwrap(); module_src_file.flush().unwrap();
@ -52,14 +54,20 @@ fn work_in_workspace() {
.open(&kernel_manifest_path) .open(&kernel_manifest_path)
.unwrap(); .unwrap();
kernel_manifest_file kernel_manifest_file
.write_all(include_bytes!("work_in_workspace_templates/myos/Cargo.toml")) .write_all(include_bytes!(
"work_in_workspace_templates/myos/Cargo.toml"
))
.unwrap(); .unwrap();
kernel_manifest_file.flush().unwrap(); kernel_manifest_file.flush().unwrap();
// Add the content to myos/src/lib.rs // Add the content to myos/src/lib.rs
let kernel_src_path = workspace_dir.join(kernel).join("src").join("lib.rs"); let kernel_src_path = workspace_dir.join(kernel).join("src").join("lib.rs");
assert!(kernel_src_path.is_file()); assert!(kernel_src_path.is_file());
fs::write(&kernel_src_path, include_str!("work_in_workspace_templates/myos/src/lib.rs")).unwrap(); fs::write(
&kernel_src_path,
include_str!("work_in_workspace_templates/myos/src/lib.rs"),
)
.unwrap();
// Run subcommand build & run // Run subcommand build & run
cargo_osdk(&["build"]).ok().unwrap(); cargo_osdk(&["build"]).ok().unwrap();

View File

@ -2,6 +2,8 @@
# SPDX-License-Identifier: MPL-2.0 # SPDX-License-Identifier: MPL-2.0
set -e
WORKSPACE_ROOT="$(dirname "$(readlink -f "$0")")/.." WORKSPACE_ROOT="$(dirname "$(readlink -f "$0")")/.."
EXCLUDED_CRATES=$(sed -n '/^\[workspace\]/,/^\[.*\]/{/exclude = \[/,/\]/p}' "$WORKSPACE_ROOT/Cargo.toml" | grep -v "exclude = \[" | tr -d '", \]') EXCLUDED_CRATES=$(sed -n '/^\[workspace\]/,/^\[.*\]/{/exclude = \[/,/\]/p}' "$WORKSPACE_ROOT/Cargo.toml" | grep -v "exclude = \[" | tr -d '", \]')