diff --git a/.github/workflows/osdk_test.yml b/.github/workflows/osdk_test.yml index a4ed731ed..2eef736b2 100644 --- a/.github/workflows/osdk_test.yml +++ b/.github/workflows/osdk_test.yml @@ -3,8 +3,8 @@ name: OSDK Test on: pull_request: paths: - - framework/** - osdk/** + - ostd/** - tools/** - Cargo.toml push: diff --git a/Cargo.lock b/Cargo.lock index 7371f374c..29001efd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,13 +77,13 @@ name = "aster-block" version = "0.1.0" dependencies = [ "align_ext", - "aster-frame", "aster-util", "bitflags 1.3.2", "component", "int-to-c-enum", "lazy_static", "log", + "ostd", "pod", "spin 0.9.8", "static_assertions", @@ -93,63 +93,22 @@ dependencies = [ name = "aster-console" version = "0.1.0" dependencies = [ - "aster-frame", "aster-util", "bitflags 1.3.2", "component", "log", + "ostd", "spin 0.9.8", ] -[[package]] -name = "aster-frame" -version = "0.1.0" -dependencies = [ - "acpi", - "align_ext", - "aml", - "array-init", - "aster-main", - "bit_field", - "bitflags 1.3.2", - "bitvec", - "buddy_system_allocator", - "cfg-if", - "gimli", - "iced-x86", - "id-alloc", - "inherit-methods-macro", - "int-to-c-enum", - "intrusive-collections", - "ktest", - "lazy_static", - "linux-boot-params", - "log", - "multiboot2", - "num", - "num-derive", - "num-traits", - "pod", - "rsdp", - "spin 0.9.8", - "static_assertions", - "tdx-guest", - "trapframe", - "unwinding", - "volatile", - "x86", - "x86_64", - "xarray", -] - [[package]] name = "aster-framebuffer" version = "0.1.0" dependencies = [ - "aster-frame", "component", "font8x8", "log", + "ostd", "spin 0.9.8", ] @@ -158,7 +117,6 @@ name = "aster-input" version = "0.1.0" dependencies = [ "ascii", - "aster-frame", "aster-rights", "aster-util", "bitflags 1.3.2", @@ -166,6 +124,7 @@ dependencies = [ "int-to-c-enum", "lazy_static", "log", + "ostd", "spin 0.9.8", ] @@ -183,7 +142,6 @@ name = "aster-network" version = "0.1.0" dependencies = [ "align_ext", - "aster-frame", "aster-rights", "aster-util", "bitflags 1.3.2", @@ -192,6 +150,7 @@ dependencies = [ "int-to-c-enum", "ktest", "log", + "ostd", "pod", "ringbuf", "smoltcp", @@ -206,7 +165,6 @@ dependencies = [ "ascii", "aster-block", "aster-console", - "aster-frame", "aster-input", "aster-network", "aster-rights", @@ -237,6 +195,7 @@ dependencies = [ "libflate", "log", "lru", + "ostd", "paste", "pod", "rand", @@ -276,10 +235,10 @@ dependencies = [ name = "aster-time" version = "0.1.0" dependencies = [ - "aster-frame", "aster-util", "component", "log", + "ostd", "spin 0.9.8", ] @@ -287,11 +246,11 @@ dependencies = [ name = "aster-util" version = "0.1.0" dependencies = [ - "aster-frame", "aster-rights", "aster-rights-proc", "inherit-methods-macro", "ktest", + "ostd", "pod", "typeflags-util", ] @@ -303,7 +262,6 @@ dependencies = [ "align_ext", "aster-block", "aster-console", - "aster-frame", "aster-input", "aster-network", "aster-rights", @@ -315,6 +273,7 @@ dependencies = [ "id-alloc", "int-to-c-enum", "log", + "ostd", "pod", "smoltcp", "spin 0.9.8", @@ -325,12 +284,12 @@ dependencies = [ name = "asterinas" version = "0.4.0" dependencies = [ - "aster-frame", "aster-framebuffer", "aster-nix", "aster-time", "component", "id-alloc", + "ostd", "x86_64", ] @@ -1134,6 +1093,47 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "ostd" +version = "0.1.0" +dependencies = [ + "acpi", + "align_ext", + "aml", + "array-init", + "aster-main", + "bit_field", + "bitflags 1.3.2", + "bitvec", + "buddy_system_allocator", + "cfg-if", + "gimli", + "iced-x86", + "id-alloc", + "inherit-methods-macro", + "int-to-c-enum", + "intrusive-collections", + "ktest", + "lazy_static", + "linux-boot-params", + "log", + "multiboot2", + "num", + "num-derive", + "num-traits", + "pod", + "rsdp", + "spin 0.9.8", + "static_assertions", + "tdx-guest", + "trapframe", + "unwinding", + "volatile", + "x86", + "x86_64", + "xarray", +] + [[package]] name = "owo-colors" version = "3.5.0" diff --git a/Cargo.toml b/Cargo.toml index 30aad62f9..df1efd782 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,15 +1,15 @@ [workspace] resolver = "2" members = [ - "framework/aster-frame", - "framework/libs/align_ext", - "framework/libs/aster-main", - "framework/libs/id-alloc", - "framework/libs/linux-bzimage/builder", - "framework/libs/linux-bzimage/boot-params", - "framework/libs/linux-bzimage/setup", - "framework/libs/ktest", - "framework/libs/ktest-proc-macro", + "ostd", + "ostd/libs/align_ext", + "ostd/libs/aster-main", + "ostd/libs/id-alloc", + "ostd/libs/linux-bzimage/builder", + "ostd/libs/linux-bzimage/boot-params", + "ostd/libs/linux-bzimage/setup", + "ostd/libs/ktest", + "ostd/libs/ktest-proc-macro", "kernel", "kernel/aster-nix", "kernel/comps/block", diff --git a/Makefile b/Makefile index 03d343816..2c1ee6e89 100644 --- a/Makefile +++ b/Makefile @@ -85,13 +85,13 @@ export # Basically, non-OSDK crates do not depend on Aster Frame and can be checked # or tested without OSDK. NON_OSDK_CRATES := \ - framework/libs/align_ext \ - framework/libs/aster-main \ - framework/libs/id-alloc \ - framework/libs/linux-bzimage/builder \ - framework/libs/linux-bzimage/boot-params \ - framework/libs/ktest \ - framework/libs/ktest-proc-macro \ + ostd/libs/align_ext \ + ostd/libs/aster-main \ + ostd/libs/id-alloc \ + ostd/libs/linux-bzimage/builder \ + ostd/libs/linux-bzimage/boot-params \ + ostd/libs/ktest \ + ostd/libs/ktest-proc-macro \ kernel/libs/cpio-decoder \ kernel/libs/int-to-c-enum \ kernel/libs/int-to-c-enum/derive \ @@ -101,11 +101,11 @@ NON_OSDK_CRATES := \ kernel/libs/typeflags \ kernel/libs/typeflags-util -# In contrast, OSDK crates depend on Aster Frame (or being aster-frame itself) +# In contrast, OSDK crates depend on OSTD (or being `ostd` itself) # and need to be built or tested with OSDK. OSDK_CRATES := \ - framework/aster-frame \ - framework/libs/linux-bzimage/setup \ + ostd \ + ostd/libs/linux-bzimage/setup \ kernel \ kernel/aster-nix \ kernel/comps/block \ @@ -179,7 +179,7 @@ test: ktest: initramfs $(CARGO_OSDK) @# Exclude linux-bzimage-setup from ktest since it's hard to be unit tested @for dir in $(OSDK_CRATES); do \ - [ $$dir = "framework/libs/linux-bzimage/setup" ] && continue; \ + [ $$dir = "ostd/libs/linux-bzimage/setup" ] && continue; \ (cd $$dir && cargo osdk test) || exit 1; \ done diff --git a/docs/src/README.md b/docs/src/README.md index 0759ba698..c5613d00e 100644 --- a/docs/src/README.md +++ b/docs/src/README.md @@ -20,20 +20,20 @@ Asterinas Kernel implements Linux ABI in a safe and efficient way. This means it can seamlessly replace Linux, offering enhanced safety and security. -#### [Part 2: Asterinas Framework](framework/) +#### [Part 2: Asterinas OSTD](ostd/) -The Framework lays down a minimalistic, powerful, and solid foundation +Asterinas OSTD lays down a minimalistic, powerful, and solid foundation for OS development. It's akin to Rust's `std` crate but crafted for the demands of _safe_ Rust OS development. -Asterinas Kernel is built on this very Framework. +Asterinas Kernel is built on this very OSTD. #### [Part 3: Asterinas OSDK](osdk/guide/) The OSDK is a command-line tool that streamlines the workflow to create, build, test, and run Rust OS projects -that are built upon Asterinas Framework. +that are built upon Asterinas OSTD. Developed specifically for OS developers, it extends Rust's Cargo tool to better suite their specific needs. OSDK is instrumental in the development of Asterinas Kernel. diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index af5f85e89..e7ee7dc49 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -11,10 +11,10 @@ * [Linux Compatibility](kernel/linux-compatibility.md) * [Roadmap](kernel/roadmap.md) -# Asterinas Framework +# Asterinas OSTD -* [An Overview of the Framework](framework/README.md) -* [Example: Writing a Kernel in 100 Lines of Safe Rust](framework/a-100-line-kernel.md) +* [An Overview of OSTD](ostd/README.md) +* [Example: Writing a Kernel in 100 Lines of Safe Rust](ostd/a-100-line-kernel.md) * [Example: Writing a Driver in 100 Lines of Safe Rust]() * [Soundness Analysis]() diff --git a/docs/src/kernel/advanced-instructions.md b/docs/src/kernel/advanced-instructions.md index 4c0695c04..c5be3cb53 100644 --- a/docs/src/kernel/advanced-instructions.md +++ b/docs/src/kernel/advanced-instructions.md @@ -26,7 +26,7 @@ make ktest To test an individual crate in kernel mode, enter the directory of the crate and invoke `cargo osdk test`. ```bash -cd asterinas/framework/aster-frame +cd asterinas/ostd cargo osdk test ``` diff --git a/docs/src/kernel/the-framekernel-architecture.md b/docs/src/kernel/the-framekernel-architecture.md index 07fb01776..d3ca68480 100644 --- a/docs/src/kernel/the-framekernel-architecture.md +++ b/docs/src/kernel/the-framekernel-architecture.md @@ -75,7 +75,7 @@ as [zero-cost abstractions](https://monomorph.is/posts/zero-cost-abstractions/). Fortunatelly, our efforts to design and implement an OS framework meeting these standards -have borne fruit in the form of the [Asterinas Framework](../framework/). +have borne fruit in the form of the [Asterinas OSTD](../ostd/). Using this framework as a foundation, we have developed the Asterinas Kernel; this framework also enables others to create their own framekernels, diff --git a/docs/src/osdk/guide/create-project.md b/docs/src/osdk/guide/create-project.md index ce4d1dd67..e4cff2b31 100644 --- a/docs/src/osdk/guide/create-project.md +++ b/docs/src/osdk/guide/create-project.md @@ -77,11 +77,11 @@ and each test case is marked with `#[ktest]`. The `Cargo.toml` file is the Rust project manifest. In addition to the contents of a normal Rust project, -OSDK will add the dependencies of the Asterinas framework to the file. +OSDK will add the dependencies of the Asterinas OSTD to the file. The dependency version may change over time. ```toml -[dependencies.aster_frame] +[dependencies.ostd] git = "https://github.com/asterinas/asterinas" branch = "main" @@ -116,4 +116,4 @@ The default manifest of a kernel project: ### `rust-toolchain.toml` The Rust toolchain for the kernel. -It aligns with the toolchain of the Asterinas framework. +It aligns with the toolchain of the Asterinas OSTD. diff --git a/docs/src/framework/README.md b/docs/src/ostd/README.md similarity index 89% rename from docs/src/framework/README.md rename to docs/src/ostd/README.md index 05d3d9ebe..7cd55ee32 100644 --- a/docs/src/framework/README.md +++ b/docs/src/ostd/README.md @@ -1,4 +1,4 @@ -# Asterinas Framework +# Asterinas OSTD > Confucious remarked, > "I could follow whatever my heart desired @@ -7,7 +7,7 @@ > 子曰: > "从心所欲,不逾矩。" -With Asterinas Framework, +With Asterinas OSTD, you don't have to learn the dark art of unsafe Rust programming and risk shooting yourself in the foot. You will be doing whatever your heart desired @@ -17,7 +17,7 @@ even if today marks your Day 1 as a Rust programmer. ## APIs -Asterinas Framework stands +Asterinas OSTD stands as a powerful and solid foundation for safe kernel development, providing high-level safe Rust APIs that are @@ -38,14 +38,14 @@ Most of these APIs fall into the following categories: To explore how these APIs come into play, see [the example of a 100-line kernel in safe Rust](a-100-line-kernel.md). -The framework APIs have been extensively documented. +The OSTD APIs have been extensively documented. You can access the comprehensive API documentation for each release by visiting the [API docs](https://asterinas.github.io/api-docs). Additionally, you can refer to the latest nightly version API documentation at [API docs nightly](https://asterinas.github.io/api-docs-nightly), which remains in sync with the latest changes in the main branch. ## Four Requirements Satisfied -In designing and implementing Asterinas Framework, +In designing and implementing OSTD, we have risen to meet the challenge of fulfilling [the aforementioned four criteria as demanded by the framekernel architecture](../kernel/the-framekernel-architecture.md). @@ -55,19 +55,19 @@ file systems, network protocols, and device drivers (e.g., Virtio drivers) have been implemented in safe Rust -by leveraging the Framework. +by leveraging OSTD. Adopting a minimalist philosophy, -the Framework has a small codebase. -At its core lies the `aster-frame` crate, +OSTD has a small codebase. +At its core lies the `ostd` crate, currently encompassing about 10K lines of code ---a figure that is even smaller than those of many microkernels. -As the Framework evolves, +As OSTD evolves, its codebase will expand, albeit at a relatively slow rate in comparison to the OS services layered atop it. -The Framework's efficiency is measurable +OSTD's efficiency is measurable through the performance metrics of its APIs and the system calls of Asterinas Kernel. No intrinsic limitations have been identified within Rust diff --git a/docs/src/framework/a-100-line-kernel.md b/docs/src/ostd/a-100-line-kernel.md similarity index 91% rename from docs/src/framework/a-100-line-kernel.md rename to docs/src/ostd/a-100-line-kernel.md index c2aca4027..a10373ec1 100644 --- a/docs/src/framework/a-100-line-kernel.md +++ b/docs/src/ostd/a-100-line-kernel.md @@ -1,7 +1,7 @@ # Example: Writing a Kernel in About 100 Lines of Safe Rust To give you a sense of -how Asterinas Framework enables writing kernels in safe Rust, +how Asterinas OSTD enables writing kernels in safe Rust, we will show a new kernel in about 100 lines of safe Rust. Our new kernel will be able to run the following Hello World program. @@ -39,7 +39,7 @@ The user program above requires our kernel to support three main features: A sample implementation of the kernel in safe Rust is given below. Comments are added -to highlight how the APIs of Asterinas Framework enable safe kernel development. +to highlight how the APIs of Asterinas OSTD enable safe kernel development. ```rust #![no_std] @@ -52,13 +52,13 @@ use core::str; use alloc::sync::Arc; use alloc::vec; -use aster_frame::cpu::UserContext; -use aster_frame::prelude::*; -use aster_frame::task::{Task, TaskOptions}; -use aster_frame::user::{ReturnReason, UserMode, UserSpace}; -use aster_frame::mm::{PageFlags, PAGE_SIZE, Vaddr, FrameAllocOptions, VmIo, VmMapOptions, VmSpace}; +use ostd::cpu::UserContext; +use ostd::prelude::*; +use ostd::task::{Task, TaskOptions}; +use ostd::user::{ReturnReason, UserMode, UserSpace}; +use ostd::mm::{PageFlags, PAGE_SIZE, Vaddr, FrameAllocOptions, VmIo, VmMapOptions, VmSpace}; -/// The kernel's boot and initialization process is managed by Asterinas Framework. +/// The kernel's boot and initialization process is managed by Asterinas OSTD. /// After the process is done, the kernel's execution environment /// (e.g., stack, heap, tasks) will be ready for use and the entry function /// labeled as `#[aster_main]` will be called. @@ -130,9 +130,9 @@ fn create_user_task(user_space: Arc) -> Arc { } } - // Kernel tasks are managed by the Framework, + // Kernel tasks are managed by OSTD, // while scheduling algorithms for them can be - // determined by the users of the Framework. + // determined by the users of OSTD. TaskOptions::new(user_task) .user_space(Some(user_space)) .data(0) diff --git a/framework/README.md b/framework/README.md deleted file mode 100644 index 604a9ee7e..000000000 --- a/framework/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Asterinas Framework - -Asterinas Framework is a Rust OS framework that facilitates the development of and innovation in OS kernels written in Rust. - -## An overview - -Asterinas Framework provides a solid foundation for Rust developers to build their own OS kernels. While Asterinas Framework origins from Asterinas, the first ever framekernel, Asterinas Framework is well suited for building OS kernels of any architecture, be it a framekernel, a monolithic kernel, or a microkernel. - -Asterinas Framework offers the following key values. - -1. **Lowering the entry bar for OS innovation.** Building an OS from scratch is not easy. Not to mention a novel one. Before adding any novel or interesting feature, an OS developer must first have something runnable, which must include basic functionalities for managing CPU, memory, and interrupts. Asterinas Framework has laid this groundwork so that OS developers do not have to deal with the most low-level, error-prone, architecture-specific aspects of OS development themselves. - -2. **Enhancing the memory safety of Rust OSes.** Asterinas Framework encapsulates low-level, machine-oriented unsafe Rust code into high-level, machine-agnostic safe APIs. These APIs are carefully designed and implemented to be sound and minimal, ensuring the memory safety of any safe Rust callers. Our experience in building Asterinas has shown that Asterinas Framework is powerful enough to allow a feature-rich, Linux-compatible kernel to be completely written in safe Rust, including its device drivers. - -3. **Promoting code reuse across Rust OS projects.** Shipped as crates, Rust code can be reused across projects---except when they are OSes. A crate that implements a feature or driver for OS A can hardly be reused by OS B because the crate must be [`no_std`](https://docs.rust-embedded.org/book/intro/no-std.html#summary) and depend on the infrastructure APIs provided by OS A, which are obviously different from that provided by OS B. This incompatibility problem can be resolved by Asterinas Framework as it can serve as a common ground across different Rust OS projects, as long as they are built upon Asterinas Framework. - -4. **Boost productivity with user-mode development.** Traditionally, developing a kernel feature involves countless rounds of coding, failing, and rebooting on bare-metal or virtual machines, which is a painfully slow process. Asterinas Framework accelerates the process by allowing high-level OS features like file systems and network stacks to be quickly tested in user mode, making the experience of OS development as smooth as that of application development. To support user-mode development, Asterinas Framework is implemented for the Linux platform, in addition to bare-mental or virtual machine environments. - -## Framework APIs - -TODO - -## Implementation status - -TODO - -## Roadmap and plan - -TODO \ No newline at end of file diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index ff7f39fdb..352805230 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -4,8 +4,8 @@ version = "0.4.0" edition = "2021" [dependencies] -id-alloc = { path = "../framework/libs/id-alloc" } -aster-frame = { path = "../framework/aster-frame" } +id-alloc = { path = "../ostd/libs/id-alloc" } +ostd = { path = "../ostd" } aster-nix = { path = "aster-nix" } component = { path = "libs/comp-sys/component" } @@ -15,4 +15,4 @@ aster-time = { path = "comps/time" } aster-framebuffer = { path = "comps/framebuffer" } [features] -intel_tdx = ["aster-frame/intel_tdx", "aster-nix/intel_tdx"] +intel_tdx = ["ostd/intel_tdx", "aster-nix/intel_tdx"] diff --git a/kernel/aster-nix/Cargo.toml b/kernel/aster-nix/Cargo.toml index d149a3056..530954831 100644 --- a/kernel/aster-nix/Cargo.toml +++ b/kernel/aster-nix/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aster-frame = { path = "../../framework/aster-frame" } -align_ext = { path = "../../framework/libs/align_ext" } +ostd = { path = "../../ostd" } +align_ext = { path = "../../ostd/libs/align_ext" } pod = { git = "https://github.com/asterinas/pod", rev = "d7dba56" } aster-input = { path = "../comps/input" } aster-block = { path = "../comps/block" } @@ -21,7 +21,7 @@ typeflags = { path = "../libs/typeflags" } typeflags-util = { path = "../libs/typeflags-util" } aster-rights-proc = { path = "../libs/aster-rights-proc" } aster-util = { path = "../libs/aster-util" } -id-alloc = { path = "../../framework/libs/id-alloc" } +id-alloc = { path = "../../ostd/libs/id-alloc" } int-to-c-enum = { path = "../libs/int-to-c-enum" } cpio-decoder = { path = "../libs/cpio-decoder" } ascii = { version = "1.1", default-features = false, features = ["alloc"] } @@ -42,7 +42,7 @@ smoltcp = { version = "0.9.1", default-features = false, features = [ "socket-raw", "socket-dhcpv4", ] } -ktest = { path = "../../framework/libs/ktest" } +ktest = { path = "../../ostd/libs/ktest" } tdx-guest = { version = "0.1.0", optional = true } # parse elf file diff --git a/kernel/aster-nix/src/arch/x86/cpu.rs b/kernel/aster-nix/src/arch/x86/cpu.rs index b58a0304d..b6b257211 100644 --- a/kernel/aster-nix/src/arch/x86/cpu.rs +++ b/kernel/aster-nix/src/arch/x86/cpu.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::cpu::UserContext; +use ostd::cpu::UserContext; use crate::cpu::LinuxAbi; diff --git a/kernel/aster-nix/src/arch/x86/signal.rs b/kernel/aster-nix/src/arch/x86/signal.rs index b3544b3a2..ec5070ec6 100644 --- a/kernel/aster-nix/src/arch/x86/signal.rs +++ b/kernel/aster-nix/src/arch/x86/signal.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::cpu::UserContext; +use ostd::cpu::UserContext; use crate::process::signal::{sig_num::SigNum, SignalContext}; diff --git a/kernel/aster-nix/src/device/tty/driver.rs b/kernel/aster-nix/src/device/tty/driver.rs index ec2675599..c8b083cec 100644 --- a/kernel/aster-nix/src/device/tty/driver.rs +++ b/kernel/aster-nix/src/device/tty/driver.rs @@ -2,8 +2,8 @@ #![allow(dead_code)] -pub use aster_frame::arch::console; -use aster_frame::mm::VmReader; +pub use ostd::arch::console; +use ostd::mm::VmReader; use spin::Once; use crate::{ diff --git a/kernel/aster-nix/src/device/tty/line_discipline.rs b/kernel/aster-nix/src/device/tty/line_discipline.rs index 4170d45db..2bd274a6b 100644 --- a/kernel/aster-nix/src/device/tty/line_discipline.rs +++ b/kernel/aster-nix/src/device/tty/line_discipline.rs @@ -4,7 +4,7 @@ use alloc::format; -use aster_frame::trap::{disable_local, in_interrupt_context}; +use ostd::trap::{disable_local, in_interrupt_context}; use ringbuf::{ring_buffer::RbBase, Rb, StaticRb}; use super::termio::{KernelTermios, WinSize, CC_C_CHAR}; diff --git a/kernel/aster-nix/src/device/tty/mod.rs b/kernel/aster-nix/src/device/tty/mod.rs index 95bafe75f..94afa4598 100644 --- a/kernel/aster-nix/src/device/tty/mod.rs +++ b/kernel/aster-nix/src/device/tty/mod.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -use aster_frame::early_print; +use ostd::early_print; use spin::Once; use self::{driver::TtyDriver, line_discipline::LineDiscipline}; diff --git a/kernel/aster-nix/src/error.rs b/kernel/aster-nix/src/error.rs index 072bee2be..10eafb002 100644 --- a/kernel/aster-nix/src/error.rs +++ b/kernel/aster-nix/src/error.rs @@ -188,17 +188,17 @@ impl AsRef for Error { } } -impl From for Error { - fn from(frame_error: aster_frame::Error) -> Self { +impl From for Error { + fn from(frame_error: ostd::Error) -> Self { match frame_error { - aster_frame::Error::AccessDenied => Error::new(Errno::EFAULT), - aster_frame::Error::NoMemory => Error::new(Errno::ENOMEM), - aster_frame::Error::InvalidArgs => Error::new(Errno::EINVAL), - aster_frame::Error::IoError => Error::new(Errno::EIO), - aster_frame::Error::NotEnoughResources => Error::new(Errno::EBUSY), - aster_frame::Error::PageFault => Error::new(Errno::EFAULT), - aster_frame::Error::Overflow => Error::new(Errno::EOVERFLOW), - aster_frame::Error::MapAlreadyMappedVaddr => Error::new(Errno::EINVAL), + ostd::Error::AccessDenied => Error::new(Errno::EFAULT), + ostd::Error::NoMemory => Error::new(Errno::ENOMEM), + ostd::Error::InvalidArgs => Error::new(Errno::EINVAL), + ostd::Error::IoError => Error::new(Errno::EIO), + ostd::Error::NotEnoughResources => Error::new(Errno::EBUSY), + ostd::Error::PageFault => Error::new(Errno::EFAULT), + ostd::Error::Overflow => Error::new(Errno::EOVERFLOW), + ostd::Error::MapAlreadyMappedVaddr => Error::new(Errno::EINVAL), } } } @@ -288,16 +288,16 @@ impl From for Error { } } -impl From for aster_frame::Error { +impl From for ostd::Error { fn from(error: Error) -> Self { match error.errno { - Errno::EACCES => aster_frame::Error::AccessDenied, - Errno::EIO => aster_frame::Error::IoError, - Errno::ENOMEM => aster_frame::Error::NoMemory, - Errno::EFAULT => aster_frame::Error::PageFault, - Errno::EINVAL => aster_frame::Error::InvalidArgs, - Errno::EBUSY => aster_frame::Error::NotEnoughResources, - _ => aster_frame::Error::InvalidArgs, + Errno::EACCES => ostd::Error::AccessDenied, + Errno::EIO => ostd::Error::IoError, + Errno::ENOMEM => ostd::Error::NoMemory, + Errno::EFAULT => ostd::Error::PageFault, + Errno::EINVAL => ostd::Error::InvalidArgs, + Errno::EBUSY => ostd::Error::NotEnoughResources, + _ => ostd::Error::InvalidArgs, } } } diff --git a/kernel/aster-nix/src/fs/exfat/dentry.rs b/kernel/aster-nix/src/fs/exfat/dentry.rs index 15085c8b7..5c6ed50c4 100644 --- a/kernel/aster-nix/src/fs/exfat/dentry.rs +++ b/kernel/aster-nix/src/fs/exfat/dentry.rs @@ -2,8 +2,8 @@ use core::{fmt::Display, ops::Range}; -use aster_frame::mm::VmIo; use aster_rights::Full; +use ostd::mm::VmIo; use super::{ constants::{EXFAT_FILE_NAME_LEN, MAX_NAME_LENGTH}, diff --git a/kernel/aster-nix/src/fs/exfat/fs.rs b/kernel/aster-nix/src/fs/exfat/fs.rs index 4cc388cf8..077bdc507 100644 --- a/kernel/aster-nix/src/fs/exfat/fs.rs +++ b/kernel/aster-nix/src/fs/exfat/fs.rs @@ -6,10 +6,10 @@ use core::{num::NonZeroUsize, ops::Range, sync::atomic::AtomicU64}; use aster_block::{bio::BioWaiter, id::BlockId, BlockDevice}; -use aster_frame::mm::Frame; -pub(super) use aster_frame::mm::VmIo; use hashbrown::HashMap; use lru::LruCache; +use ostd::mm::Frame; +pub(super) use ostd::mm::VmIo; use super::{ bitmap::ExfatBitmap, diff --git a/kernel/aster-nix/src/fs/exfat/inode.rs b/kernel/aster-nix/src/fs/exfat/inode.rs index 2444b142a..88b0ee0fd 100644 --- a/kernel/aster-nix/src/fs/exfat/inode.rs +++ b/kernel/aster-nix/src/fs/exfat/inode.rs @@ -12,8 +12,8 @@ use aster_block::{ id::{Bid, BlockId}, BLOCK_SIZE, }; -use aster_frame::mm::{Frame, FrameAllocOptions, VmIo}; use aster_rights::Full; +use ostd::mm::{Frame, FrameAllocOptions, VmIo}; use super::{ constants::*, diff --git a/kernel/aster-nix/src/fs/exfat/mod.rs b/kernel/aster-nix/src/fs/exfat/mod.rs index 43b1ce1d3..fb7f194c8 100644 --- a/kernel/aster-nix/src/fs/exfat/mod.rs +++ b/kernel/aster-nix/src/fs/exfat/mod.rs @@ -21,7 +21,7 @@ mod test { bio::{BioEnqueueError, BioStatus, BioType, SubmittedBio}, BlockDevice, }; - use aster_frame::mm::{FrameAllocOptions, Segment, VmIo}; + use ostd::mm::{FrameAllocOptions, Segment, VmIo}; use rand::{rngs::SmallRng, RngCore, SeedableRng}; use crate::{ diff --git a/kernel/aster-nix/src/fs/ext2/impl_for_vfs/fs.rs b/kernel/aster-nix/src/fs/ext2/impl_for_vfs/fs.rs index bf2626a9d..a118160a1 100644 --- a/kernel/aster-nix/src/fs/ext2/impl_for_vfs/fs.rs +++ b/kernel/aster-nix/src/fs/ext2/impl_for_vfs/fs.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::sync::RwMutexReadGuard; +use ostd::sync::RwMutexReadGuard; use crate::{ fs::{ diff --git a/kernel/aster-nix/src/fs/ext2/prelude.rs b/kernel/aster-nix/src/fs/ext2/prelude.rs index 165a1b789..bd6847134 100644 --- a/kernel/aster-nix/src/fs/ext2/prelude.rs +++ b/kernel/aster-nix/src/fs/ext2/prelude.rs @@ -11,11 +11,11 @@ pub(super) use aster_block::{ id::Bid, BlockDevice, BLOCK_SIZE, }; -pub(super) use aster_frame::{ +pub(super) use aster_rights::Full; +pub(super) use ostd::{ mm::{Frame, FrameAllocOptions, Segment, VmIo}, sync::{RwMutex, RwMutexReadGuard, RwMutexWriteGuard}, }; -pub(super) use aster_rights::Full; pub(super) use static_assertions::const_assert; pub(super) use super::utils::{Dirty, IsPowerOf}; diff --git a/kernel/aster-nix/src/fs/ramfs/fs.rs b/kernel/aster-nix/src/fs/ramfs/fs.rs index 97d90d3d4..e428fa534 100644 --- a/kernel/aster-nix/src/fs/ramfs/fs.rs +++ b/kernel/aster-nix/src/fs/ramfs/fs.rs @@ -6,12 +6,12 @@ use core::{ }; use aster_block::bio::BioWaiter; -use aster_frame::{ +use aster_rights::Full; +use aster_util::slot_vec::SlotVec; +use ostd::{ mm::{Frame, VmIo}, sync::RwMutexWriteGuard, }; -use aster_rights::Full; -use aster_util::slot_vec::SlotVec; use super::*; use crate::{ diff --git a/kernel/aster-nix/src/fs/utils/page_cache.rs b/kernel/aster-nix/src/fs/utils/page_cache.rs index 55581e4e0..39b138efc 100644 --- a/kernel/aster-nix/src/fs/utils/page_cache.rs +++ b/kernel/aster-nix/src/fs/utils/page_cache.rs @@ -5,9 +5,9 @@ use core::ops::Range; use aster_block::bio::{BioStatus, BioWaiter}; -use aster_frame::mm::{Frame, FrameAllocOptions}; use aster_rights::Full; use lru::LruCache; +use ostd::mm::{Frame, FrameAllocOptions}; use crate::{ prelude::*, diff --git a/kernel/aster-nix/src/lib.rs b/kernel/aster-nix/src/lib.rs index c4328d58a..0e25c93ed 100644 --- a/kernel/aster-nix/src/lib.rs +++ b/kernel/aster-nix/src/lib.rs @@ -23,7 +23,7 @@ #![feature(trait_upcasting)] #![register_tool(component_access_control)] -use aster_frame::{ +use ostd::{ arch::qemu::{exit_qemu, QemuExitCode}, boot, }; @@ -91,7 +91,7 @@ fn init_thread() { thread::work_queue::init(); // FIXME: Remove this if we move the step of mounting // the filesystems to be done within the init process. - aster_frame::trap::enable_local(); + ostd::trap::enable_local(); net::lazy_init(); fs::lazy_init(); // driver::pci::virtio::block::block_device_test(); diff --git a/kernel/aster-nix/src/net/iface/common.rs b/kernel/aster-nix/src/net/iface/common.rs index ff38a19ff..787669245 100644 --- a/kernel/aster-nix/src/net/iface/common.rs +++ b/kernel/aster-nix/src/net/iface/common.rs @@ -3,8 +3,8 @@ use alloc::collections::btree_map::Entry; use core::sync::atomic::{AtomicU64, Ordering}; -use aster_frame::sync::WaitQueue; use keyable_arc::KeyableWeak; +use ostd::sync::WaitQueue; use smoltcp::{ iface::{SocketHandle, SocketSet}, phy::Device, diff --git a/kernel/aster-nix/src/net/iface/mod.rs b/kernel/aster-nix/src/net/iface/mod.rs index e947def0d..d90b746d9 100644 --- a/kernel/aster-nix/src/net/iface/mod.rs +++ b/kernel/aster-nix/src/net/iface/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::sync::WaitQueue; +use ostd::sync::WaitQueue; use smoltcp::iface::SocketSet; use self::common::IfaceCommon; diff --git a/kernel/aster-nix/src/net/iface/time.rs b/kernel/aster-nix/src/net/iface/time.rs index 1c275e9c4..7936dd740 100644 --- a/kernel/aster-nix/src/net/iface/time.rs +++ b/kernel/aster-nix/src/net/iface/time.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::arch::timer::Jiffies; +use ostd::arch::timer::Jiffies; pub(super) fn get_network_timestamp() -> smoltcp::time::Instant { let millis = Jiffies::elapsed().as_duration().as_millis(); diff --git a/kernel/aster-nix/src/net/iface/util.rs b/kernel/aster-nix/src/net/iface/util.rs index 3e1e5492a..bc73a6886 100644 --- a/kernel/aster-nix/src/net/iface/util.rs +++ b/kernel/aster-nix/src/net/iface/util.rs @@ -2,7 +2,7 @@ use core::time::Duration; -use aster_frame::{arch::timer::Jiffies, task::Priority}; +use ostd::{arch::timer::Jiffies, task::Priority}; use super::Iface; use crate::{ diff --git a/kernel/aster-nix/src/prelude.rs b/kernel/aster-nix/src/prelude.rs index 1bc354704..9eb5c056d 100644 --- a/kernel/aster-nix/src/prelude.rs +++ b/kernel/aster-nix/src/prelude.rs @@ -13,13 +13,13 @@ pub(crate) use alloc::{ }; pub(crate) use core::{any::Any, ffi::CStr, fmt::Debug}; -pub(crate) use aster_frame::{ - mm::{Vaddr, PAGE_SIZE}, - sync::{Mutex, MutexGuard, RwLock, RwMutex, SpinLock, SpinLockGuard}, -}; pub(crate) use bitflags::bitflags; pub(crate) use int_to_c_enum::TryFromInt; pub(crate) use log::{debug, error, info, log_enabled, trace, warn}; +pub(crate) use ostd::{ + mm::{Vaddr, PAGE_SIZE}, + sync::{Mutex, MutexGuard, RwLock, RwMutex, SpinLock, SpinLockGuard}, +}; pub(crate) use pod::Pod; /// return current process diff --git a/kernel/aster-nix/src/process/clone.rs b/kernel/aster-nix/src/process/clone.rs index 646bafcf8..cf7a93e48 100644 --- a/kernel/aster-nix/src/process/clone.rs +++ b/kernel/aster-nix/src/process/clone.rs @@ -4,12 +4,12 @@ use core::sync::atomic::Ordering; -use aster_frame::{ +use aster_rights::Full; +use ostd::{ cpu::UserContext, mm::VmIo, user::{UserContextApi, UserSpace}, }; -use aster_rights::Full; use super::{ credentials, diff --git a/kernel/aster-nix/src/process/credentials/credentials_.rs b/kernel/aster-nix/src/process/credentials/credentials_.rs index a2d9c926e..9e8585e79 100644 --- a/kernel/aster-nix/src/process/credentials/credentials_.rs +++ b/kernel/aster-nix/src/process/credentials/credentials_.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::sync::{RwLockReadGuard, RwLockWriteGuard}; +use ostd::sync::{RwLockReadGuard, RwLockWriteGuard}; use super::{group::AtomicGid, user::AtomicUid, Gid, Uid}; use crate::{ diff --git a/kernel/aster-nix/src/process/credentials/static_cap.rs b/kernel/aster-nix/src/process/credentials/static_cap.rs index 3a831e16b..452d7068f 100644 --- a/kernel/aster-nix/src/process/credentials/static_cap.rs +++ b/kernel/aster-nix/src/process/credentials/static_cap.rs @@ -2,9 +2,9 @@ #![allow(dead_code)] -use aster_frame::sync::{RwLockReadGuard, RwLockWriteGuard}; use aster_rights::{Dup, Read, TRights, Write}; use aster_rights_proc::require; +use ostd::sync::{RwLockReadGuard, RwLockWriteGuard}; use super::{capabilities::CapSet, credentials_::Credentials_, Credentials, Gid, Uid}; use crate::prelude::*; diff --git a/kernel/aster-nix/src/process/posix_thread/builder.rs b/kernel/aster-nix/src/process/posix_thread/builder.rs index a807a37e4..cbce48e35 100644 --- a/kernel/aster-nix/src/process/posix_thread/builder.rs +++ b/kernel/aster-nix/src/process/posix_thread/builder.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -use aster_frame::user::UserSpace; +use ostd::user::UserSpace; use super::PosixThread; use crate::{ diff --git a/kernel/aster-nix/src/process/posix_thread/futex.rs b/kernel/aster-nix/src/process/posix_thread/futex.rs index a03c4ca89..5abceaa53 100644 --- a/kernel/aster-nix/src/process/posix_thread/futex.rs +++ b/kernel/aster-nix/src/process/posix_thread/futex.rs @@ -4,7 +4,7 @@ use core::sync::atomic::{AtomicBool, Ordering}; -use aster_frame::cpu::num_cpus; +use ostd::cpu::num_cpus; use spin::Once; use crate::{ diff --git a/kernel/aster-nix/src/process/posix_thread/posix_thread_ext.rs b/kernel/aster-nix/src/process/posix_thread/posix_thread_ext.rs index 045673831..012da1225 100644 --- a/kernel/aster-nix/src/process/posix_thread/posix_thread_ext.rs +++ b/kernel/aster-nix/src/process/posix_thread/posix_thread_ext.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::{ +use ostd::{ cpu::UserContext, user::{UserContextApi, UserSpace}, }; diff --git a/kernel/aster-nix/src/process/process/timer_manager.rs b/kernel/aster-nix/src/process/process/timer_manager.rs index 776ff9ccc..98a0e39fb 100644 --- a/kernel/aster-nix/src/process/process/timer_manager.rs +++ b/kernel/aster-nix/src/process/process/timer_manager.rs @@ -7,14 +7,14 @@ use alloc::{ }; use core::time::Duration; -use aster_frame::{ +use id_alloc::IdAlloc; +use ostd::{ arch::{ timer::{self, TIMER_FREQ}, x86::trap::is_kernel_interrupted, }, sync::Mutex, }; -use id_alloc::IdAlloc; use super::Process; use crate::{ diff --git a/kernel/aster-nix/src/process/process_vm/init_stack/mod.rs b/kernel/aster-nix/src/process/process_vm/init_stack/mod.rs index 2105cd949..1046fd514 100644 --- a/kernel/aster-nix/src/process/process_vm/init_stack/mod.rs +++ b/kernel/aster-nix/src/process/process_vm/init_stack/mod.rs @@ -19,8 +19,8 @@ use core::{ }; use align_ext::AlignExt; -use aster_frame::mm::{VmIo, MAX_USERSPACE_VADDR}; use aster_rights::{Full, Rights}; +use ostd::mm::{VmIo, MAX_USERSPACE_VADDR}; use self::aux_vec::{AuxKey, AuxVec}; use crate::{ diff --git a/kernel/aster-nix/src/process/program_loader/elf/load_elf.rs b/kernel/aster-nix/src/process/program_loader/elf/load_elf.rs index d6797a129..5f2345ada 100644 --- a/kernel/aster-nix/src/process/program_loader/elf/load_elf.rs +++ b/kernel/aster-nix/src/process/program_loader/elf/load_elf.rs @@ -7,8 +7,8 @@ //! When create a process from elf file, we will use the elf_load_info to construct the VmSpace use align_ext::AlignExt; -use aster_frame::mm::VmIo; use aster_rights::{Full, Rights}; +use ostd::mm::VmIo; use xmas_elf::program::{self, ProgramHeader64}; use super::elf_file::Elf; diff --git a/kernel/aster-nix/src/process/signal/c_types.rs b/kernel/aster-nix/src/process/signal/c_types.rs index b176a00ce..b2f39c9c4 100644 --- a/kernel/aster-nix/src/process/signal/c_types.rs +++ b/kernel/aster-nix/src/process/signal/c_types.rs @@ -5,8 +5,8 @@ use core::mem::{self, size_of}; -use aster_frame::cpu::GeneralRegs; use aster_util::{read_union_fields, union_read_ptr::UnionReadPtr}; +use ostd::cpu::GeneralRegs; use super::sig_num::SigNum; use crate::{ diff --git a/kernel/aster-nix/src/process/signal/mod.rs b/kernel/aster-nix/src/process/signal/mod.rs index c0ae37bb8..7a811c27c 100644 --- a/kernel/aster-nix/src/process/signal/mod.rs +++ b/kernel/aster-nix/src/process/signal/mod.rs @@ -16,9 +16,9 @@ pub mod signals; use core::{mem, sync::atomic::Ordering}; use align_ext::AlignExt; -use aster_frame::{cpu::UserContext, user::UserContextApi}; use c_types::{siginfo_t, ucontext_t}; pub use events::{SigEvents, SigEventsFilter}; +use ostd::{cpu::UserContext, user::UserContextApi}; pub use pauser::Pauser; pub use poll::{Pollee, Poller}; use sig_action::{SigAction, SigActionFlags, SigDefaultAction}; diff --git a/kernel/aster-nix/src/process/signal/pauser.rs b/kernel/aster-nix/src/process/signal/pauser.rs index 25c4f6f64..f02ae5346 100644 --- a/kernel/aster-nix/src/process/signal/pauser.rs +++ b/kernel/aster-nix/src/process/signal/pauser.rs @@ -7,7 +7,7 @@ use core::{ time::Duration, }; -use aster_frame::sync::WaitQueue; +use ostd::sync::WaitQueue; use super::{sig_mask::SigMask, SigEvents, SigEventsFilter}; use crate::{ @@ -24,7 +24,7 @@ use crate::{ /// into one. Both putting the current thread to sleep and waking it up can be done through the /// same `Pauser` object, using its `pause`- and `resume`-family methods. /// -/// [`Waiter`]: aster_frame::sync::Waiter +/// [`Waiter`]: ostd::sync::Waiter /// /// # Example /// diff --git a/kernel/aster-nix/src/process/signal/signals/fault.rs b/kernel/aster-nix/src/process/signal/signals/fault.rs index 58ac80ac2..07cbf5219 100644 --- a/kernel/aster-nix/src/process/signal/signals/fault.rs +++ b/kernel/aster-nix/src/process/signal/signals/fault.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::cpu::{ +use ostd::cpu::{ CpuException, CpuExceptionInfo, ALIGNMENT_CHECK, BOUND_RANGE_EXCEEDED, DIVIDE_BY_ZERO, GENERAL_PROTECTION_FAULT, INVALID_OPCODE, PAGE_FAULT, SIMD_FLOATING_POINT_EXCEPTION, X87_FLOATING_POINT_EXCEPTION, diff --git a/kernel/aster-nix/src/process/sync/condvar.rs b/kernel/aster-nix/src/process/sync/condvar.rs index a27ff52ce..4d696f8f6 100644 --- a/kernel/aster-nix/src/process/sync/condvar.rs +++ b/kernel/aster-nix/src/process/sync/condvar.rs @@ -6,7 +6,7 @@ use alloc::sync::Arc; use core::time::Duration; -use aster_frame::sync::{MutexGuard, SpinLock, WaitQueue}; +use ostd::sync::{MutexGuard, SpinLock, WaitQueue}; use crate::time::wait::WaitTimeout; @@ -51,7 +51,7 @@ impl LockErr { /// /// ```rust /// use alloc::sync::Arc; -/// use aster_frame::sync::Mutex; +/// use ostd::sync::Mutex; /// use crate::{process::sync::Condvar, thread::{kernel_thread::KernelThreadExt, Thread}}; /// /// // Initializing a shared condition between threads @@ -264,7 +264,7 @@ impl Condvar { #[cfg(ktest)] mod test { - use aster_frame::sync::Mutex; + use ostd::sync::Mutex; use super::*; use crate::thread::{ diff --git a/kernel/aster-nix/src/sched/priority_scheduler.rs b/kernel/aster-nix/src/sched/priority_scheduler.rs index 1ee3628da..c4928b61a 100644 --- a/kernel/aster-nix/src/sched/priority_scheduler.rs +++ b/kernel/aster-nix/src/sched/priority_scheduler.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::task::{set_scheduler, Scheduler, Task, TaskAdapter}; use intrusive_collections::LinkedList; +use ostd::task::{set_scheduler, Scheduler, Task, TaskAdapter}; use crate::prelude::*; diff --git a/kernel/aster-nix/src/syscall/arch_prctl.rs b/kernel/aster-nix/src/syscall/arch_prctl.rs index 98c4763fd..64b0f00cb 100644 --- a/kernel/aster-nix/src/syscall/arch_prctl.rs +++ b/kernel/aster-nix/src/syscall/arch_prctl.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::cpu::UserContext; +use ostd::cpu::UserContext; use super::SyscallReturn; use crate::{cpu::LinuxAbi, prelude::*}; diff --git a/kernel/aster-nix/src/syscall/clone.rs b/kernel/aster-nix/src/syscall/clone.rs index 5547f837f..70f8b004e 100644 --- a/kernel/aster-nix/src/syscall/clone.rs +++ b/kernel/aster-nix/src/syscall/clone.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::cpu::UserContext; +use ostd::cpu::UserContext; use super::SyscallReturn; use crate::{ diff --git a/kernel/aster-nix/src/syscall/execve.rs b/kernel/aster-nix/src/syscall/execve.rs index 23a991c9c..7a592ca7c 100644 --- a/kernel/aster-nix/src/syscall/execve.rs +++ b/kernel/aster-nix/src/syscall/execve.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::{cpu::UserContext, user::UserContextApi}; use aster_rights::WriteOp; +use ostd::{cpu::UserContext, user::UserContextApi}; use super::{constants::*, SyscallReturn}; use crate::{ diff --git a/kernel/aster-nix/src/syscall/fork.rs b/kernel/aster-nix/src/syscall/fork.rs index ff1a4a849..8eb21ba30 100644 --- a/kernel/aster-nix/src/syscall/fork.rs +++ b/kernel/aster-nix/src/syscall/fork.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] -use aster_frame::cpu::UserContext; +use ostd::cpu::UserContext; use super::SyscallReturn; use crate::{ diff --git a/kernel/aster-nix/src/syscall/mod.rs b/kernel/aster-nix/src/syscall/mod.rs index 9fa4ea591..503130954 100644 --- a/kernel/aster-nix/src/syscall/mod.rs +++ b/kernel/aster-nix/src/syscall/mod.rs @@ -2,8 +2,8 @@ //! Read the Cpu context content then dispatch syscall to corrsponding handler //! The each sub module contains functions that handle real syscall logic. -use aster_frame::cpu::UserContext; pub use clock_gettime::ClockId; +use ostd::cpu::UserContext; use crate::{cpu::LinuxAbi, prelude::*}; @@ -160,7 +160,7 @@ macro_rules! dispatch_fn_inner { $crate::syscall::syscall_handler!($cnt, $handler, $args, &$context) }; ( $args: ident, $context: ident, $handler: ident ( args[ .. $cnt: tt ] , &mut context ) ) => { - // `$context` is already of type `&mut aster_frame::cpu::UserContext`, + // `$context` is already of type `&mut ostd::cpu::UserContext`, // so no need to take `&mut` again $crate::syscall::syscall_handler!($cnt, $handler, $args, $context) }; @@ -178,7 +178,7 @@ macro_rules! impl_syscall_nums_and_dispatch_fn { pub fn syscall_dispatch( syscall_number: u64, args: [u64; 6], - context: &mut aster_frame::cpu::UserContext, + context: &mut ostd::cpu::UserContext, ) -> $crate::prelude::Result<$crate::syscall::SyscallReturn> { match syscall_number { $( diff --git a/kernel/aster-nix/src/syscall/rt_sigprocmask.rs b/kernel/aster-nix/src/syscall/rt_sigprocmask.rs index b042fae4b..45c723a70 100644 --- a/kernel/aster-nix/src/syscall/rt_sigprocmask.rs +++ b/kernel/aster-nix/src/syscall/rt_sigprocmask.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] -use aster_frame::mm::VmIo; +use ostd::mm::VmIo; use super::SyscallReturn; use crate::{ diff --git a/kernel/aster-nix/src/syscall/rt_sigreturn.rs b/kernel/aster-nix/src/syscall/rt_sigreturn.rs index c9e6746a6..a25258bba 100644 --- a/kernel/aster-nix/src/syscall/rt_sigreturn.rs +++ b/kernel/aster-nix/src/syscall/rt_sigreturn.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::{cpu::UserContext, user::UserContextApi}; +use ostd::{cpu::UserContext, user::UserContextApi}; use super::SyscallReturn; use crate::{ diff --git a/kernel/aster-nix/src/taskless.rs b/kernel/aster-nix/src/taskless.rs index b5a401156..74733ce82 100644 --- a/kernel/aster-nix/src/taskless.rs +++ b/kernel/aster-nix/src/taskless.rs @@ -8,8 +8,8 @@ use core::{ sync::atomic::{AtomicBool, Ordering}, }; -use aster_frame::{cpu_local, sync::SpinLock, trap::SoftIrqLine, CpuLocal}; use intrusive_collections::{intrusive_adapter, LinkedList, LinkedListAtomicLink}; +use ostd::{cpu_local, sync::SpinLock, trap::SoftIrqLine, CpuLocal}; use crate::softirq_id::{TASKLESS_SOFTIRQ_ID, TASKLESS_URGENT_SOFTIRQ_ID}; @@ -41,7 +41,7 @@ use crate::softirq_id::{TASKLESS_SOFTIRQ_ID, TASKLESS_URGENT_SOFTIRQ_ID}; /// /// Users can create a `Taskless` and schedule it at any place. /// ```rust -/// #use aster_frame::softirq::Taskless; +/// #use ostd::softirq::Taskless; /// /// #fn my_func() {} /// @@ -189,7 +189,7 @@ fn taskless_softirq_handler( mod test { use core::sync::atomic::AtomicUsize; - use aster_frame::trap::enable_local; + use ostd::trap::enable_local; use super::*; diff --git a/kernel/aster-nix/src/thread/exception.rs b/kernel/aster-nix/src/thread/exception.rs index c3ae0d0be..ca350aa5e 100644 --- a/kernel/aster-nix/src/thread/exception.rs +++ b/kernel/aster-nix/src/thread/exception.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] -use aster_frame::cpu::*; +use ostd::cpu::*; use crate::{ prelude::*, process::signal::signals::fault::FaultSignal, diff --git a/kernel/aster-nix/src/thread/kernel_thread.rs b/kernel/aster-nix/src/thread/kernel_thread.rs index b0e58b003..461e22827 100644 --- a/kernel/aster-nix/src/thread/kernel_thread.rs +++ b/kernel/aster-nix/src/thread/kernel_thread.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::{ +use ostd::{ cpu::CpuSet, task::{Priority, TaskOptions}, }; diff --git a/kernel/aster-nix/src/thread/mod.rs b/kernel/aster-nix/src/thread/mod.rs index 55f4f2bca..b9cbe0fdd 100644 --- a/kernel/aster-nix/src/thread/mod.rs +++ b/kernel/aster-nix/src/thread/mod.rs @@ -4,7 +4,7 @@ use core::sync::atomic::{AtomicU32, Ordering}; -use aster_frame::task::Task; +use ostd::task::Task; use self::status::{AtomicThreadStatus, ThreadStatus}; use crate::prelude::*; diff --git a/kernel/aster-nix/src/thread/task.rs b/kernel/aster-nix/src/thread/task.rs index 433334de8..799d736d4 100644 --- a/kernel/aster-nix/src/thread/task.rs +++ b/kernel/aster-nix/src/thread/task.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::{ +use ostd::{ task::{preempt, Task, TaskOptions}, user::{ReturnReason, UserContextApi, UserMode, UserSpace}, }; diff --git a/kernel/aster-nix/src/thread/work_queue/mod.rs b/kernel/aster-nix/src/thread/work_queue/mod.rs index 6d8f45d1c..dccba18dd 100644 --- a/kernel/aster-nix/src/thread/work_queue/mod.rs +++ b/kernel/aster-nix/src/thread/work_queue/mod.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -use aster_frame::cpu::CpuSet; +use ostd::cpu::CpuSet; use spin::Once; use work_item::WorkItem; use worker_pool::WorkerPool; @@ -65,7 +65,7 @@ static WORKQUEUE_GLOBAL_HIGH_PRI: Once> = Once::new(); /// Certainly, users can also create a dedicated WorkQueue and WorkerPool. /// /// ```rust -/// use aster_frame::cpu::CpuSet; +/// use ostd::cpu::CpuSet; /// use crate::thread::work_queue::{WorkQueue, WorkerPool, WorkItem}; /// /// fn deferred_task(){ diff --git a/kernel/aster-nix/src/thread/work_queue/work_item.rs b/kernel/aster-nix/src/thread/work_queue/work_item.rs index 5b9e1cd76..ec083e4a8 100644 --- a/kernel/aster-nix/src/thread/work_queue/work_item.rs +++ b/kernel/aster-nix/src/thread/work_queue/work_item.rs @@ -4,7 +4,7 @@ use core::sync::atomic::{AtomicBool, Ordering}; -use aster_frame::cpu::CpuSet; +use ostd::cpu::CpuSet; use crate::prelude::*; diff --git a/kernel/aster-nix/src/thread/work_queue/worker.rs b/kernel/aster-nix/src/thread/work_queue/worker.rs index 8e23a5ec4..be3b30600 100644 --- a/kernel/aster-nix/src/thread/work_queue/worker.rs +++ b/kernel/aster-nix/src/thread/work_queue/worker.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -use aster_frame::{cpu::CpuSet, task::Priority}; +use ostd::{cpu::CpuSet, task::Priority}; use super::worker_pool::WorkerPool; use crate::{ diff --git a/kernel/aster-nix/src/thread/work_queue/worker_pool.rs b/kernel/aster-nix/src/thread/work_queue/worker_pool.rs index e8b790ad4..77ad2f5af 100644 --- a/kernel/aster-nix/src/thread/work_queue/worker_pool.rs +++ b/kernel/aster-nix/src/thread/work_queue/worker_pool.rs @@ -7,7 +7,7 @@ use core::{ time::Duration, }; -use aster_frame::{ +use ostd::{ cpu::CpuSet, sync::WaitQueue, task::{add_task, Priority}, diff --git a/kernel/aster-nix/src/time/clocks/cpu_clock.rs b/kernel/aster-nix/src/time/clocks/cpu_clock.rs index df36f1d98..9ce69c482 100644 --- a/kernel/aster-nix/src/time/clocks/cpu_clock.rs +++ b/kernel/aster-nix/src/time/clocks/cpu_clock.rs @@ -3,7 +3,7 @@ use alloc::sync::Arc; use core::time::Duration; -use aster_frame::sync::SpinLock; +use ostd::sync::SpinLock; use crate::time::Clock; diff --git a/kernel/aster-nix/src/time/clocks/system_wide.rs b/kernel/aster-nix/src/time/clocks/system_wide.rs index cbdaaa116..dbd2a42cf 100644 --- a/kernel/aster-nix/src/time/clocks/system_wide.rs +++ b/kernel/aster-nix/src/time/clocks/system_wide.rs @@ -3,8 +3,8 @@ use alloc::sync::Arc; use core::time::Duration; -use aster_frame::{arch::timer::Jiffies, cpu_local, sync::SpinLock, CpuLocal}; use aster_time::read_monotonic_time; +use ostd::{arch::timer::Jiffies, cpu_local, sync::SpinLock, CpuLocal}; use paste::paste; use spin::Once; diff --git a/kernel/aster-nix/src/time/core/mod.rs b/kernel/aster-nix/src/time/core/mod.rs index 3a9ca30c3..5a52e08d7 100644 --- a/kernel/aster-nix/src/time/core/mod.rs +++ b/kernel/aster-nix/src/time/core/mod.rs @@ -2,8 +2,8 @@ use core::time::Duration; -use aster_frame::arch::timer::TIMER_FREQ; use aster_time::NANOS_PER_SECOND; +use ostd::arch::timer::TIMER_FREQ; pub mod timer; diff --git a/kernel/aster-nix/src/time/core/timer.rs b/kernel/aster-nix/src/time/core/timer.rs index bb191491c..c086ebe15 100644 --- a/kernel/aster-nix/src/time/core/timer.rs +++ b/kernel/aster-nix/src/time/core/timer.rs @@ -11,7 +11,7 @@ use core::{ time::Duration, }; -use aster_frame::sync::SpinLock; +use ostd::sync::SpinLock; use super::Clock; diff --git a/kernel/aster-nix/src/time/softirq.rs b/kernel/aster-nix/src/time/softirq.rs index cee8dc19e..afcae1007 100644 --- a/kernel/aster-nix/src/time/softirq.rs +++ b/kernel/aster-nix/src/time/softirq.rs @@ -2,7 +2,7 @@ use alloc::{boxed::Box, vec::Vec}; -use aster_frame::{arch::timer, sync::RwLock, trap::SoftIrqLine}; +use ostd::{arch::timer, sync::RwLock, trap::SoftIrqLine}; use crate::softirq_id::TIMER_SOFTIRQ_ID; diff --git a/kernel/aster-nix/src/time/system_time.rs b/kernel/aster-nix/src/time/system_time.rs index 0b72d8705..4be1b7abc 100644 --- a/kernel/aster-nix/src/time/system_time.rs +++ b/kernel/aster-nix/src/time/system_time.rs @@ -81,7 +81,7 @@ impl SystemTime { } } -/// convert aster_frame::time::Time to System time +/// convert ostd::time::Time to System time fn convert_system_time(system_time: aster_time::SystemTime) -> Result { let month = match Month::try_from(system_time.month) { Ok(month) => month, diff --git a/kernel/aster-nix/src/time/wait.rs b/kernel/aster-nix/src/time/wait.rs index b8c920a06..efc830e07 100644 --- a/kernel/aster-nix/src/time/wait.rs +++ b/kernel/aster-nix/src/time/wait.rs @@ -2,7 +2,7 @@ use core::time::Duration; -use aster_frame::sync::{WaitQueue, Waiter}; +use ostd::sync::{WaitQueue, Waiter}; use super::{clocks::JIFFIES_TIMER_MANAGER, timer::Timeout}; diff --git a/kernel/aster-nix/src/util/mod.rs b/kernel/aster-nix/src/util/mod.rs index 5cf53588c..ea16dbd87 100644 --- a/kernel/aster-nix/src/util/mod.rs +++ b/kernel/aster-nix/src/util/mod.rs @@ -2,8 +2,8 @@ use core::mem; -use aster_frame::mm::VmIo; use aster_rights::Full; +use ostd::mm::VmIo; use crate::{prelude::*, vm::vmar::Vmar}; mod iovec; diff --git a/kernel/aster-nix/src/util/net/options/utils.rs b/kernel/aster-nix/src/util/net/options/utils.rs index 87d8a5164..574ec3cf5 100644 --- a/kernel/aster-nix/src/util/net/options/utils.rs +++ b/kernel/aster-nix/src/util/net/options/utils.rs @@ -2,8 +2,8 @@ use core::time::Duration; -use aster_frame::mm::VmIo; use aster_rights::Full; +use ostd::mm::VmIo; use crate::{ net::socket::{ip::stream::CongestionControl, LingerOption}, diff --git a/kernel/aster-nix/src/vdso.rs b/kernel/aster-nix/src/vdso.rs index ca7ed21c4..1db2adbc7 100644 --- a/kernel/aster-nix/src/vdso.rs +++ b/kernel/aster-nix/src/vdso.rs @@ -17,13 +17,13 @@ use alloc::{boxed::Box, sync::Arc}; use core::{mem::ManuallyDrop, time::Duration}; -use aster_frame::{ - mm::{Frame, VmIo, PAGE_SIZE}, - sync::SpinLock, -}; use aster_rights::Rights; use aster_time::{read_monotonic_time, Instant}; use aster_util::coeff::Coeff; +use ostd::{ + mm::{Frame, VmIo, PAGE_SIZE}, + sync::SpinLock, +}; use pod::Pod; use spin::Once; diff --git a/kernel/aster-nix/src/vm/perms.rs b/kernel/aster-nix/src/vm/perms.rs index 852db0bf6..8a3cbb14b 100644 --- a/kernel/aster-nix/src/vm/perms.rs +++ b/kernel/aster-nix/src/vm/perms.rs @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::mm::PageFlags; use aster_rights::Rights; use bitflags::bitflags; +use ostd::mm::PageFlags; bitflags! { /// The memory access permissions of memory mappings. diff --git a/kernel/aster-nix/src/vm/vmar/dyn_cap.rs b/kernel/aster-nix/src/vm/vmar/dyn_cap.rs index 9f819e53f..2be7b82be 100644 --- a/kernel/aster-nix/src/vm/vmar/dyn_cap.rs +++ b/kernel/aster-nix/src/vm/vmar/dyn_cap.rs @@ -2,8 +2,8 @@ use core::ops::Range; -use aster_frame::mm::VmIo; use aster_rights::Rights; +use ostd::mm::VmIo; use super::{ options::VmarChildOptions, vm_mapping::VmarMapOptions, VmPerms, Vmar, VmarRightsOp, Vmar_, @@ -159,13 +159,13 @@ impl Vmar { } impl VmIo for Vmar { - fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> { + fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> { self.check_rights(Rights::READ)?; self.0.read(offset, buf)?; Ok(()) } - fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> { + fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> { self.check_rights(Rights::WRITE)?; self.0.write(offset, buf)?; Ok(()) diff --git a/kernel/aster-nix/src/vm/vmar/mod.rs b/kernel/aster-nix/src/vm/vmar/mod.rs index bcb495219..7a63e5da8 100644 --- a/kernel/aster-nix/src/vm/vmar/mod.rs +++ b/kernel/aster-nix/src/vm/vmar/mod.rs @@ -13,8 +13,8 @@ pub mod vm_mapping; use core::{cmp::min, ops::Range}; use align_ext::AlignExt; -use aster_frame::mm::{VmSpace, MAX_USERSPACE_VADDR}; use aster_rights::Rights; +use ostd::mm::{VmSpace, MAX_USERSPACE_VADDR}; use self::{ interval::{Interval, IntervalSet}, diff --git a/kernel/aster-nix/src/vm/vmar/options.rs b/kernel/aster-nix/src/vm/vmar/options.rs index c37859bc4..0a68e527f 100644 --- a/kernel/aster-nix/src/vm/vmar/options.rs +++ b/kernel/aster-nix/src/vm/vmar/options.rs @@ -2,7 +2,7 @@ //! Options for allocating child VMARs. -use aster_frame::{mm::PAGE_SIZE, Error, Result}; +use ostd::{mm::PAGE_SIZE, Error, Result}; use super::Vmar; @@ -135,8 +135,8 @@ impl VmarChildOptions { #[cfg(ktest)] mod test { - use aster_frame::mm::VmIo; use aster_rights::Full; + use ostd::mm::VmIo; use super::*; use crate::vm::{ diff --git a/kernel/aster-nix/src/vm/vmar/static_cap.rs b/kernel/aster-nix/src/vm/vmar/static_cap.rs index eee6e1a4b..0813b7345 100644 --- a/kernel/aster-nix/src/vm/vmar/static_cap.rs +++ b/kernel/aster-nix/src/vm/vmar/static_cap.rs @@ -2,9 +2,9 @@ use core::ops::Range; -use aster_frame::mm::VmIo; use aster_rights::{Dup, Rights, TRightSet, TRights}; use aster_rights_proc::require; +use ostd::mm::VmIo; use super::{ options::VmarChildOptions, vm_mapping::VmarMapOptions, VmPerms, Vmar, VmarRightsOp, Vmar_, @@ -180,13 +180,13 @@ impl Vmar> { } impl VmIo for Vmar> { - fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> { + fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> { self.check_rights(Rights::READ)?; self.0.read(offset, buf)?; Ok(()) } - fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> { + fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> { self.check_rights(Rights::WRITE)?; self.0.write(offset, buf)?; Ok(()) diff --git a/kernel/aster-nix/src/vm/vmar/vm_mapping.rs b/kernel/aster-nix/src/vm/vmar/vm_mapping.rs index 8f657089e..f65b9cbdc 100644 --- a/kernel/aster-nix/src/vm/vmar/vm_mapping.rs +++ b/kernel/aster-nix/src/vm/vmar/vm_mapping.rs @@ -5,7 +5,7 @@ use core::ops::Range; -use aster_frame::mm::{Frame, FrameVec, PageFlags, VmIo, VmMapOptions, VmSpace}; +use ostd::mm::{Frame, FrameVec, PageFlags, VmIo, VmMapOptions, VmSpace}; use super::{interval::Interval, is_intersected, Vmar, Vmar_}; use crate::{ diff --git a/kernel/aster-nix/src/vm/vmo/dyn_cap.rs b/kernel/aster-nix/src/vm/vmo/dyn_cap.rs index 15051aff5..f3db6e669 100644 --- a/kernel/aster-nix/src/vm/vmo/dyn_cap.rs +++ b/kernel/aster-nix/src/vm/vmo/dyn_cap.rs @@ -2,8 +2,8 @@ use core::ops::Range; -use aster_frame::mm::{Frame, VmIo}; use aster_rights::{Rights, TRights}; +use ostd::mm::{Frame, VmIo}; use super::{ options::{VmoCowChild, VmoSliceChild}, @@ -151,13 +151,13 @@ impl Vmo { } impl VmIo for Vmo { - fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> { + fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> { self.check_rights(Rights::READ)?; self.0.read_bytes(offset, buf)?; Ok(()) } - fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> { + fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> { self.check_rights(Rights::WRITE)?; self.0.write_bytes(offset, buf)?; Ok(()) diff --git a/kernel/aster-nix/src/vm/vmo/mod.rs b/kernel/aster-nix/src/vm/vmo/mod.rs index be7f8f0bb..f66b26cfc 100644 --- a/kernel/aster-nix/src/vm/vmo/mod.rs +++ b/kernel/aster-nix/src/vm/vmo/mod.rs @@ -8,11 +8,11 @@ use core::ops::Range; use align_ext::AlignExt; -use aster_frame::{ +use aster_rights::Rights; +use ostd::{ collections::xarray::{CursorMut, XArray, XMark}, mm::{Frame, FrameAllocOptions, VmReader, VmWriter}, }; -use aster_rights::Rights; use crate::prelude::*; @@ -76,7 +76,7 @@ use self::options::ChildType; /// # Implementation /// /// `Vmo` provides high-level APIs for address space management by wrapping -/// around its low-level counterpart `aster_frame::vm::VmFrames`. +/// around its low-level counterpart `ostd::vm::VmFrames`. /// Compared with `VmFrames`, /// `Vmo` is easier to use (by offering more powerful APIs) and /// harder to misuse (thanks to its nature of being capability). diff --git a/kernel/aster-nix/src/vm/vmo/options.rs b/kernel/aster-nix/src/vm/vmo/options.rs index dd70b4846..03e04ca4f 100644 --- a/kernel/aster-nix/src/vm/vmo/options.rs +++ b/kernel/aster-nix/src/vm/vmo/options.rs @@ -7,12 +7,12 @@ use core::{marker::PhantomData, ops::Range}; use align_ext::AlignExt; -use aster_frame::{ +use aster_rights::{Dup, Rights, TRightSet, TRights, Write}; +use aster_rights_proc::require; +use ostd::{ collections::xarray::XArray, mm::{Frame, FrameAllocOptions}, }; -use aster_rights::{Dup, Rights, TRightSet, TRights, Write}; -use aster_rights_proc::require; use typeflags_util::{SetExtend, SetExtendOp}; use super::{Pager, Pages, Vmo, VmoFlags, VmoMark, VmoRightsOp}; @@ -476,8 +476,8 @@ impl VmoChildType for VmoCowChild {} #[cfg(ktest)] mod test { - use aster_frame::mm::VmIo; use aster_rights::Full; + use ostd::mm::VmIo; use super::*; diff --git a/kernel/aster-nix/src/vm/vmo/pager.rs b/kernel/aster-nix/src/vm/vmo/pager.rs index 09870a231..dbe7622ad 100644 --- a/kernel/aster-nix/src/vm/vmo/pager.rs +++ b/kernel/aster-nix/src/vm/vmo/pager.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::mm::Frame; +use ostd::mm::Frame; use crate::prelude::*; diff --git a/kernel/aster-nix/src/vm/vmo/static_cap.rs b/kernel/aster-nix/src/vm/vmo/static_cap.rs index 02d273408..f3a42b1ac 100644 --- a/kernel/aster-nix/src/vm/vmo/static_cap.rs +++ b/kernel/aster-nix/src/vm/vmo/static_cap.rs @@ -2,9 +2,9 @@ use core::ops::Range; -use aster_frame::mm::{Frame, VmIo}; use aster_rights::{Dup, Rights, TRightSet, TRights, Write}; use aster_rights_proc::require; +use ostd::mm::{Frame, VmIo}; use super::{ options::{VmoCowChild, VmoSliceChild}, @@ -145,13 +145,13 @@ impl Vmo> { } impl VmIo for Vmo> { - fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> { + fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> { self.check_rights(Rights::READ)?; self.0.read_bytes(offset, buf)?; Ok(()) } - fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> { + fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> { self.check_rights(Rights::WRITE)?; self.0.write_bytes(offset, buf)?; Ok(()) diff --git a/kernel/comps/block/Cargo.toml b/kernel/comps/block/Cargo.toml index f5bbfc822..95af96b15 100644 --- a/kernel/comps/block/Cargo.toml +++ b/kernel/comps/block/Cargo.toml @@ -9,8 +9,8 @@ edition = "2021" bitflags = "1.3" spin = "0.9.4" pod = { git = "https://github.com/asterinas/pod", rev = "d7dba56" } -aster-frame = { path = "../../../framework/aster-frame" } -align_ext = { path = "../../../framework/libs/align_ext" } +ostd = { path = "../../../ostd" } +align_ext = { path = "../../../ostd/libs/align_ext" } aster-util = { path = "../../libs/aster-util" } int-to-c-enum = { path = "../../libs/int-to-c-enum" } component = { path = "../../libs/comp-sys/component" } diff --git a/kernel/comps/block/src/bio.rs b/kernel/comps/block/src/bio.rs index 3812515c1..37bf9e39f 100644 --- a/kernel/comps/block/src/bio.rs +++ b/kernel/comps/block/src/bio.rs @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MPL-2.0 use align_ext::AlignExt; -use aster_frame::{ +use int_to_c_enum::TryFromInt; +use ostd::{ mm::{Frame, Segment, VmReader, VmWriter}, sync::WaitQueue, }; -use int_to_c_enum::TryFromInt; use super::{id::Sid, BlockDevice}; use crate::prelude::*; @@ -140,9 +140,9 @@ pub enum BioEnqueueError { TooBig, } -impl From for aster_frame::Error { +impl From for ostd::Error { fn from(_error: BioEnqueueError) -> Self { - aster_frame::Error::NotEnoughResources + ostd::Error::NotEnoughResources } } diff --git a/kernel/comps/block/src/impl_block_device.rs b/kernel/comps/block/src/impl_block_device.rs index 303c75a69..604d6d6ab 100644 --- a/kernel/comps/block/src/impl_block_device.rs +++ b/kernel/comps/block/src/impl_block_device.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::mm::{Frame, FrameAllocOptions, Segment, VmIo}; +use ostd::mm::{Frame, FrameAllocOptions, Segment, VmIo}; use super::{ bio::{Bio, BioEnqueueError, BioSegment, BioStatus, BioType, BioWaiter, SubmittedBio}, @@ -75,9 +75,9 @@ impl dyn BlockDevice { impl VmIo for dyn BlockDevice { /// Reads consecutive bytes of several sectors in size. - fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> aster_frame::Result<()> { + fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> ostd::Result<()> { if offset % SECTOR_SIZE != 0 || buf.len() % SECTOR_SIZE != 0 { - return Err(aster_frame::Error::InvalidArgs); + return Err(ostd::Error::InvalidArgs); } if buf.is_empty() { return Ok(()); @@ -111,14 +111,14 @@ impl VmIo for dyn BlockDevice { let _ = bio_segment.reader().read(&mut buf.into()); Ok(()) } - _ => Err(aster_frame::Error::IoError), + _ => Err(ostd::Error::IoError), } } /// Writes consecutive bytes of several sectors in size. - fn write_bytes(&self, offset: usize, buf: &[u8]) -> aster_frame::Result<()> { + fn write_bytes(&self, offset: usize, buf: &[u8]) -> ostd::Result<()> { if offset % SECTOR_SIZE != 0 || buf.len() % SECTOR_SIZE != 0 { - return Err(aster_frame::Error::InvalidArgs); + return Err(ostd::Error::InvalidArgs); } if buf.is_empty() { return Ok(()); @@ -150,16 +150,16 @@ impl VmIo for dyn BlockDevice { let status = bio.submit_sync(self)?; match status { BioStatus::Complete => Ok(()), - _ => Err(aster_frame::Error::IoError), + _ => Err(ostd::Error::IoError), } } } impl dyn BlockDevice { /// Asynchronously writes consecutive bytes of several sectors in size. - pub fn write_bytes_async(&self, offset: usize, buf: &[u8]) -> aster_frame::Result { + pub fn write_bytes_async(&self, offset: usize, buf: &[u8]) -> ostd::Result { if offset % SECTOR_SIZE != 0 || buf.len() % SECTOR_SIZE != 0 { - return Err(aster_frame::Error::InvalidArgs); + return Err(ostd::Error::InvalidArgs); } if buf.is_empty() { return Ok(BioWaiter::new()); diff --git a/kernel/comps/block/src/lib.rs b/kernel/comps/block/src/lib.rs index 161c233f3..fe228cab1 100644 --- a/kernel/comps/block/src/lib.rs +++ b/kernel/comps/block/src/lib.rs @@ -41,8 +41,8 @@ mod impl_block_device; mod prelude; pub mod request_queue; -use aster_frame::sync::SpinLock; use component::{init_component, ComponentInitError}; +use ostd::sync::SpinLock; use spin::Once; use self::{ @@ -50,7 +50,7 @@ use self::{ prelude::*, }; -pub const BLOCK_SIZE: usize = aster_frame::mm::PAGE_SIZE; +pub const BLOCK_SIZE: usize = ostd::mm::PAGE_SIZE; pub const SECTOR_SIZE: usize = 512; pub trait BlockDevice: Send + Sync + Any + Debug { diff --git a/kernel/comps/block/src/request_queue.rs b/kernel/comps/block/src/request_queue.rs index 7721cbe68..10a31be7d 100644 --- a/kernel/comps/block/src/request_queue.rs +++ b/kernel/comps/block/src/request_queue.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::sync::{Mutex, WaitQueue}; +use ostd::sync::{Mutex, WaitQueue}; use super::{ bio::{BioEnqueueError, BioType, SubmittedBio}, diff --git a/kernel/comps/console/Cargo.toml b/kernel/comps/console/Cargo.toml index 82ec86767..47469efe1 100644 --- a/kernel/comps/console/Cargo.toml +++ b/kernel/comps/console/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] bitflags = "1.3" spin = "0.9.4" -aster-frame = { path = "../../../framework/aster-frame" } +ostd = { path = "../../../ostd" } aster-util = { path = "../../libs/aster-util" } component = { path = "../../libs/comp-sys/component" } log = "0.4" diff --git a/kernel/comps/console/src/lib.rs b/kernel/comps/console/src/lib.rs index 77fa95fb2..01c639a4f 100644 --- a/kernel/comps/console/src/lib.rs +++ b/kernel/comps/console/src/lib.rs @@ -10,8 +10,8 @@ extern crate alloc; use alloc::{collections::BTreeMap, fmt::Debug, string::String, sync::Arc, vec::Vec}; use core::any::Any; -use aster_frame::{mm::VmReader, sync::SpinLock}; use component::{init_component, ComponentInitError}; +use ostd::{mm::VmReader, sync::SpinLock}; use spin::Once; pub type ConsoleCallback = dyn Fn(VmReader) + Send + Sync; diff --git a/kernel/comps/framebuffer/Cargo.toml b/kernel/comps/framebuffer/Cargo.toml index d8c729ed9..f7feb99af 100644 --- a/kernel/comps/framebuffer/Cargo.toml +++ b/kernel/comps/framebuffer/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aster-frame = { path = "../../../framework/aster-frame" } +ostd = { path = "../../../ostd" } component = { path = "../../libs/comp-sys/component" } log = "0.4" spin = "0.9.4" diff --git a/kernel/comps/framebuffer/src/lib.rs b/kernel/comps/framebuffer/src/lib.rs index f634292cb..3637ca188 100644 --- a/kernel/comps/framebuffer/src/lib.rs +++ b/kernel/comps/framebuffer/src/lib.rs @@ -13,14 +13,14 @@ use core::{ ops::{Index, IndexMut}, }; -use aster_frame::{ +use component::{init_component, ComponentInitError}; +use font8x8::UnicodeFonts; +use ostd::{ boot, io_mem::IoMem, mm::{VmIo, PAGE_SIZE}, sync::SpinLock, }; -use component::{init_component, ComponentInitError}; -use font8x8::UnicodeFonts; use spin::Once; #[init_component] @@ -39,7 +39,7 @@ pub(crate) fn init() { let mut writer = { let framebuffer = boot::framebuffer_arg(); let mut size = 0; - for i in aster_frame::mm::FRAMEBUFFER_REGIONS.get().unwrap().iter() { + for i in ostd::mm::FRAMEBUFFER_REGIONS.get().unwrap().iter() { size = i.len(); } diff --git a/kernel/comps/input/Cargo.toml b/kernel/comps/input/Cargo.toml index 3a629304d..111aee787 100644 --- a/kernel/comps/input/Cargo.toml +++ b/kernel/comps/input/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] bitflags = "1.3" spin = "0.9.4" -aster-frame = { path = "../../../framework/aster-frame" } +ostd = { path = "../../../ostd" } aster-util = { path = "../../libs/aster-util" } aster-rights = { path = "../../libs/aster-rights" } component = { path = "../../libs/comp-sys/component" } diff --git a/kernel/comps/input/src/lib.rs b/kernel/comps/input/src/lib.rs index 0af7eed15..5d1704574 100644 --- a/kernel/comps/input/src/lib.rs +++ b/kernel/comps/input/src/lib.rs @@ -12,9 +12,9 @@ pub mod key; use alloc::{collections::BTreeMap, string::String, sync::Arc, vec::Vec}; use core::{any::Any, fmt::Debug}; -use aster_frame::sync::SpinLock; use component::{init_component, ComponentInitError}; use key::{Key, KeyStatus}; +use ostd::sync::SpinLock; use spin::Once; #[derive(Debug, Clone, Copy)] diff --git a/kernel/comps/network/Cargo.toml b/kernel/comps/network/Cargo.toml index 4895cf872..ffe359287 100644 --- a/kernel/comps/network/Cargo.toml +++ b/kernel/comps/network/Cargo.toml @@ -6,16 +6,16 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -align_ext = { path = "../../../framework/libs/align_ext" } -aster-frame = { path = "../../../framework/aster-frame" } +align_ext = { path = "../../../ostd/libs/align_ext" } aster-util = { path = "../../libs/aster-util" } aster-rights = { path = "../../libs/aster-rights" } bitflags = "1.3" bitvec = { version = "1.0.1", default-features = false, features = ["alloc"]} component = { path = "../../libs/comp-sys/component" } int-to-c-enum = { path = "../../libs/int-to-c-enum" } -ktest = { path = "../../../framework/libs/ktest" } +ktest = { path = "../../../ostd/libs/ktest" } log = "0.4" +ostd = { path = "../../../ostd" } pod = { git = "https://github.com/asterinas/pod", rev = "d7dba56" } ringbuf = { version = "0.3.2", default-features = false, features = ["alloc"] } smoltcp = { version = "0.9.1", default-features = false, features = ["alloc", "log", "medium-ethernet", "medium-ip", "proto-dhcpv4", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw", "socket-dhcpv4"] } diff --git a/kernel/comps/network/src/buffer.rs b/kernel/comps/network/src/buffer.rs index e0918d7c7..c4fd2204c 100644 --- a/kernel/comps/network/src/buffer.rs +++ b/kernel/comps/network/src/buffer.rs @@ -3,7 +3,7 @@ use alloc::{collections::LinkedList, sync::Arc}; use align_ext::AlignExt; -use aster_frame::{ +use ostd::{ mm::{ Daddr, DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmReader, VmWriter, PAGE_SIZE, }, diff --git a/kernel/comps/network/src/dma_pool.rs b/kernel/comps/network/src/dma_pool.rs index 33a9b312b..3be350f6a 100644 --- a/kernel/comps/network/src/dma_pool.rs +++ b/kernel/comps/network/src/dma_pool.rs @@ -8,14 +8,14 @@ use alloc::{ }; use core::ops::Range; -use aster_frame::{ +use bitvec::{array::BitArray, prelude::Lsb0}; +use ktest::ktest; +use ostd::{ mm::{ Daddr, DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmReader, VmWriter, PAGE_SIZE, }, sync::{RwLock, SpinLock}, }; -use bitvec::{array::BitArray, prelude::Lsb0}; -use ktest::ktest; /// `DmaPool` is responsible for allocating small streaming DMA segments /// (equal to or smaller than PAGE_SIZE), @@ -95,7 +95,7 @@ impl DmaPool { } /// Allocates a `DmaSegment` from the pool - pub fn alloc_segment(self: &Arc) -> Result { + pub fn alloc_segment(self: &Arc) -> Result { // Lock order: pool.avail_pages -> pool.all_pages // pool.avail_pages -> page.allocated_segments let mut avail_pages = self.avail_pages.lock_irq_disabled(); @@ -150,12 +150,12 @@ impl DmaPage { direction: DmaDirection, is_cache_coherent: bool, pool: Weak, - ) -> Result { + ) -> Result { let dma_stream = { let vm_segment = FrameAllocOptions::new(1).alloc_contiguous()?; DmaStream::map(vm_segment, direction, is_cache_coherent) - .map_err(|_| aster_frame::Error::AccessDenied)? + .map_err(|_| ostd::Error::AccessDenied)? }; Ok(Self { @@ -234,17 +234,17 @@ impl DmaSegment { self.size } - pub fn reader(&self) -> Result, aster_frame::Error> { + pub fn reader(&self) -> Result, ostd::Error> { let offset = self.start_addr - self.dma_stream.daddr(); Ok(self.dma_stream.reader()?.skip(offset).limit(self.size)) } - pub fn writer(&self) -> Result, aster_frame::Error> { + pub fn writer(&self) -> Result, ostd::Error> { let offset = self.start_addr - self.dma_stream.daddr(); Ok(self.dma_stream.writer()?.skip(offset).limit(self.size)) } - pub fn sync(&self, byte_range: Range) -> Result<(), aster_frame::Error> { + pub fn sync(&self, byte_range: Range) -> Result<(), ostd::Error> { let offset = self.daddr() - self.dma_stream.daddr(); let range = byte_range.start + offset..byte_range.end + offset; self.dma_stream.sync(range) diff --git a/kernel/comps/network/src/driver.rs b/kernel/comps/network/src/driver.rs index 21eb31a93..67308f7f7 100644 --- a/kernel/comps/network/src/driver.rs +++ b/kernel/comps/network/src/driver.rs @@ -2,7 +2,7 @@ use alloc::vec; -use aster_frame::mm::VmWriter; +use ostd::mm::VmWriter; use smoltcp::{phy, time::Instant}; use crate::{buffer::RxBuffer, AnyNetworkDevice}; diff --git a/kernel/comps/network/src/lib.rs b/kernel/comps/network/src/lib.rs index d63158595..5c19dfa88 100644 --- a/kernel/comps/network/src/lib.rs +++ b/kernel/comps/network/src/lib.rs @@ -15,11 +15,11 @@ extern crate alloc; use alloc::{collections::BTreeMap, string::String, sync::Arc, vec::Vec}; use core::{any::Any, fmt::Debug}; -use aster_frame::sync::SpinLock; use aster_util::safe_ptr::Pod; pub use buffer::{RxBuffer, TxBuffer, RX_BUFFER_POOL, TX_BUFFER_POOL}; use component::{init_component, ComponentInitError}; pub use dma_pool::DmaSegment; +use ostd::sync::SpinLock; use smoltcp::phy; use spin::Once; diff --git a/kernel/comps/time/Cargo.toml b/kernel/comps/time/Cargo.toml index aa595969c..2b58beec5 100644 --- a/kernel/comps/time/Cargo.toml +++ b/kernel/comps/time/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aster-frame = { path = "../../../framework/aster-frame" } +ostd = { path = "../../../ostd" } aster-util = { path = "../../libs/aster-util" } component = { path = "../../libs/comp-sys/component" } log = "0.4" diff --git a/kernel/comps/time/src/clocksource.rs b/kernel/comps/time/src/clocksource.rs index 563ca9e55..bd492f1ed 100644 --- a/kernel/comps/time/src/clocksource.rs +++ b/kernel/comps/time/src/clocksource.rs @@ -13,8 +13,8 @@ use alloc::sync::Arc; use core::{cmp::max, ops::Add, time::Duration}; -use aster_frame::sync::RwLock; use aster_util::coeff::Coeff; +use ostd::sync::RwLock; use crate::NANOS_PER_SECOND; diff --git a/kernel/comps/time/src/lib.rs b/kernel/comps/time/src/lib.rs index b00cad75c..7baefffc9 100644 --- a/kernel/comps/time/src/lib.rs +++ b/kernel/comps/time/src/lib.rs @@ -9,10 +9,10 @@ extern crate alloc; use alloc::sync::Arc; use core::{sync::atomic::Ordering::Relaxed, time::Duration}; -use aster_frame::sync::Mutex; use clocksource::ClockSource; pub use clocksource::Instant; use component::{init_component, ComponentInitError}; +use ostd::sync::Mutex; use rtc::{get_cmos, is_updating, CENTURY_REGISTER}; use spin::Once; diff --git a/kernel/comps/time/src/rtc.rs b/kernel/comps/time/src/rtc.rs index 4a73d5a06..4347910ab 100644 --- a/kernel/comps/time/src/rtc.rs +++ b/kernel/comps/time/src/rtc.rs @@ -2,7 +2,7 @@ use core::sync::atomic::{AtomicU8, Ordering::Relaxed}; -use aster_frame::arch::x86::device::cmos::{get_century_register, CMOS_ADDRESS, CMOS_DATA}; +use ostd::arch::x86::device::cmos::{get_century_register, CMOS_ADDRESS, CMOS_DATA}; pub(crate) static CENTURY_REGISTER: AtomicU8 = AtomicU8::new(0); diff --git a/kernel/comps/time/src/tsc.rs b/kernel/comps/time/src/tsc.rs index 758f555fb..3c27b09e1 100644 --- a/kernel/comps/time/src/tsc.rs +++ b/kernel/comps/time/src/tsc.rs @@ -6,7 +6,7 @@ use alloc::sync::Arc; use core::sync::atomic::{AtomicU64, Ordering}; -use aster_frame::arch::{ +use ostd::arch::{ read_tsc, timer::{self, TIMER_FREQ}, x86::tsc_freq, diff --git a/kernel/comps/virtio/Cargo.toml b/kernel/comps/virtio/Cargo.toml index 9137bf6e1..9763a7738 100644 --- a/kernel/comps/virtio/Cargo.toml +++ b/kernel/comps/virtio/Cargo.toml @@ -9,16 +9,16 @@ edition = "2021" bitflags = "1.3" spin = "0.9.4" bytes = { version = "1.4.0", default-features = false } -align_ext = { path = "../../../framework/libs/align_ext" } +align_ext = { path = "../../../ostd/libs/align_ext" } aster-input = { path = "../input" } aster-block = { path = "../block" } aster-network = { path = "../network" } aster-console = { path = "../console" } -aster-frame = { path = "../../../framework/aster-frame" } aster-util = { path = "../../libs/aster-util" } aster-rights = { path = "../../libs/aster-rights" } -id-alloc = { path = "../../../framework/libs/id-alloc" } +id-alloc = { path = "../../../ostd/libs/id-alloc" } typeflags-util = { path = "../../libs/typeflags-util" } +ostd = { path = "../../../ostd" } pod = { git = "https://github.com/asterinas/pod", rev = "d7dba56" } component = { path = "../../libs/comp-sys/component" } log = "0.4" diff --git a/kernel/comps/virtio/src/device/block/device.rs b/kernel/comps/virtio/src/device/block/device.rs index 0b15b09eb..fce5c64e6 100644 --- a/kernel/comps/virtio/src/device/block/device.rs +++ b/kernel/comps/virtio/src/device/block/device.rs @@ -7,15 +7,15 @@ use aster_block::{ bio::{BioEnqueueError, BioStatus, BioType, SubmittedBio}, request_queue::{BioRequest, BioRequestSingleQueue}, }; -use aster_frame::{ +use aster_util::safe_ptr::SafePtr; +use id_alloc::IdAlloc; +use log::info; +use ostd::{ io_mem::IoMem, mm::{DmaDirection, DmaStream, DmaStreamSlice, FrameAllocOptions, VmIo}, sync::SpinLock, trap::TrapFrame, }; -use aster_util::safe_ptr::SafePtr; -use id_alloc::IdAlloc; -use log::info; use pod::Pod; use super::{BlockFeatures, VirtioBlockConfig}; diff --git a/kernel/comps/virtio/src/device/block/mod.rs b/kernel/comps/virtio/src/device/block/mod.rs index 81415cf7e..18faf8a18 100644 --- a/kernel/comps/virtio/src/device/block/mod.rs +++ b/kernel/comps/virtio/src/device/block/mod.rs @@ -2,10 +2,10 @@ pub mod device; -use aster_frame::io_mem::IoMem; use aster_util::safe_ptr::SafePtr; use bitflags::bitflags; use int_to_c_enum::TryFromInt; +use ostd::io_mem::IoMem; use pod::Pod; use crate::transport::VirtioTransport; diff --git a/kernel/comps/virtio/src/device/console/config.rs b/kernel/comps/virtio/src/device/console/config.rs index 411bcb9f8..05d24ef1c 100644 --- a/kernel/comps/virtio/src/device/console/config.rs +++ b/kernel/comps/virtio/src/device/console/config.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::io_mem::IoMem; use aster_util::safe_ptr::SafePtr; +use ostd::io_mem::IoMem; use pod::Pod; use crate::transport::VirtioTransport; diff --git a/kernel/comps/virtio/src/device/console/device.rs b/kernel/comps/virtio/src/device/console/device.rs index 929a5ffb2..6d4babc29 100644 --- a/kernel/comps/virtio/src/device/console/device.rs +++ b/kernel/comps/virtio/src/device/console/device.rs @@ -4,14 +4,14 @@ use alloc::{boxed::Box, fmt::Debug, string::ToString, sync::Arc, vec::Vec}; use core::hint::spin_loop; use aster_console::{AnyConsoleDevice, ConsoleCallback}; -use aster_frame::{ +use aster_util::safe_ptr::SafePtr; +use log::debug; +use ostd::{ io_mem::IoMem, mm::{DmaDirection, DmaStream, DmaStreamSlice, FrameAllocOptions, VmReader}, sync::{RwLock, SpinLock}, trap::TrapFrame, }; -use aster_util::safe_ptr::SafePtr; -use log::debug; use super::{config::VirtioConsoleConfig, DEVICE_NAME}; use crate::{ diff --git a/kernel/comps/virtio/src/device/input/device.rs b/kernel/comps/virtio/src/device/input/device.rs index 0cb0b9838..a035947a2 100644 --- a/kernel/comps/virtio/src/device/input/device.rs +++ b/kernel/comps/virtio/src/device/input/device.rs @@ -8,13 +8,6 @@ use alloc::{ }; use core::{fmt::Debug, iter, mem}; -use aster_frame::{ - io_mem::IoMem, - mm::{DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmIo, PAGE_SIZE}, - offset_of, - sync::{RwLock, SpinLock}, - trap::TrapFrame, -}; use aster_input::{ key::{Key, KeyStatus}, InputEvent, @@ -22,6 +15,13 @@ use aster_input::{ use aster_util::{field_ptr, safe_ptr::SafePtr}; use bitflags::bitflags; use log::{debug, info}; +use ostd::{ + io_mem::IoMem, + mm::{DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmIo, PAGE_SIZE}, + offset_of, + sync::{RwLock, SpinLock}, + trap::TrapFrame, +}; use super::{InputConfigSelect, VirtioInputConfig, VirtioInputEvent, QUEUE_EVENT, QUEUE_STATUS}; use crate::{ diff --git a/kernel/comps/virtio/src/device/input/mod.rs b/kernel/comps/virtio/src/device/input/mod.rs index 5f9dae1c4..e42a53e98 100644 --- a/kernel/comps/virtio/src/device/input/mod.rs +++ b/kernel/comps/virtio/src/device/input/mod.rs @@ -27,8 +27,8 @@ // pub mod device; -use aster_frame::io_mem::IoMem; use aster_util::safe_ptr::SafePtr; +use ostd::io_mem::IoMem; use pod::Pod; use crate::transport::VirtioTransport; diff --git a/kernel/comps/virtio/src/device/network/config.rs b/kernel/comps/virtio/src/device/network/config.rs index a819e3b04..aa2fe3874 100644 --- a/kernel/comps/virtio/src/device/network/config.rs +++ b/kernel/comps/virtio/src/device/network/config.rs @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::io_mem::IoMem; use aster_network::EthernetAddr; use aster_util::safe_ptr::SafePtr; use bitflags::bitflags; +use ostd::io_mem::IoMem; use pod::Pod; use crate::transport::VirtioTransport; diff --git a/kernel/comps/virtio/src/device/network/device.rs b/kernel/comps/virtio/src/device/network/device.rs index 52ec880ae..22bc8330b 100644 --- a/kernel/comps/virtio/src/device/network/device.rs +++ b/kernel/comps/virtio/src/device/network/device.rs @@ -3,13 +3,13 @@ use alloc::{boxed::Box, string::ToString, sync::Arc}; use core::{fmt::Debug, hint::spin_loop, mem::size_of}; -use aster_frame::{offset_of, sync::SpinLock, trap::TrapFrame}; use aster_network::{ AnyNetworkDevice, EthernetAddr, RxBuffer, TxBuffer, VirtioNetError, RX_BUFFER_POOL, TX_BUFFER_POOL, }; use aster_util::{field_ptr, slot_vec::SlotVec}; use log::debug; +use ostd::{offset_of, sync::SpinLock, trap::TrapFrame}; use smoltcp::phy::{DeviceCapabilities, Medium}; use super::{config::VirtioNetConfig, header::VirtioNetHdr}; diff --git a/kernel/comps/virtio/src/device/socket/buffer.rs b/kernel/comps/virtio/src/device/socket/buffer.rs index 7279bc004..7463e821e 100644 --- a/kernel/comps/virtio/src/device/socket/buffer.rs +++ b/kernel/comps/virtio/src/device/socket/buffer.rs @@ -2,11 +2,11 @@ use alloc::{collections::LinkedList, sync::Arc}; -use aster_frame::{ +use aster_network::dma_pool::DmaPool; +use ostd::{ mm::{DmaDirection, DmaStream}, sync::SpinLock, }; -use aster_network::dma_pool::DmaPool; use spin::Once; const RX_BUFFER_LEN: usize = 4096; diff --git a/kernel/comps/virtio/src/device/socket/config.rs b/kernel/comps/virtio/src/device/socket/config.rs index b931aef48..8c1331f7b 100644 --- a/kernel/comps/virtio/src/device/socket/config.rs +++ b/kernel/comps/virtio/src/device/socket/config.rs @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::io_mem::IoMem; use aster_util::safe_ptr::SafePtr; use bitflags::bitflags; +use ostd::io_mem::IoMem; use pod::Pod; use crate::transport::VirtioTransport; diff --git a/kernel/comps/virtio/src/device/socket/device.rs b/kernel/comps/virtio/src/device/socket/device.rs index 8c6d8c0cd..3536c20c5 100644 --- a/kernel/comps/virtio/src/device/socket/device.rs +++ b/kernel/comps/virtio/src/device/socket/device.rs @@ -3,10 +3,10 @@ use alloc::{boxed::Box, string::ToString, sync::Arc, vec, vec::Vec}; use core::{fmt::Debug, hint::spin_loop, mem::size_of}; -use aster_frame::{mm::VmWriter, offset_of, sync::SpinLock, trap::TrapFrame}; use aster_network::{RxBuffer, TxBuffer}; use aster_util::{field_ptr, slot_vec::SlotVec}; use log::debug; +use ostd::{mm::VmWriter, offset_of, sync::SpinLock, trap::TrapFrame}; use pod::Pod; use super::{ diff --git a/kernel/comps/virtio/src/device/socket/mod.rs b/kernel/comps/virtio/src/device/socket/mod.rs index 46bb0750d..df7e2ed5d 100644 --- a/kernel/comps/virtio/src/device/socket/mod.rs +++ b/kernel/comps/virtio/src/device/socket/mod.rs @@ -3,7 +3,7 @@ // ! #![feature(linked_list_cursors)] use alloc::{collections::BTreeMap, string::String, sync::Arc, vec::Vec}; -use aster_frame::sync::SpinLock; +use ostd::sync::SpinLock; use spin::Once; use self::device::SocketDevice; diff --git a/kernel/comps/virtio/src/dma_buf.rs b/kernel/comps/virtio/src/dma_buf.rs index c24c90b78..e0dc5586a 100644 --- a/kernel/comps/virtio/src/dma_buf.rs +++ b/kernel/comps/virtio/src/dma_buf.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::mm::{DmaCoherent, DmaStream, DmaStreamSlice, HasDaddr}; use aster_network::{DmaSegment, RxBuffer, TxBuffer}; +use ostd::mm::{DmaCoherent, DmaStream, DmaStreamSlice, HasDaddr}; /// A DMA-capable buffer. /// diff --git a/kernel/comps/virtio/src/queue.rs b/kernel/comps/virtio/src/queue.rs index fc90cb93a..c8a167668 100644 --- a/kernel/comps/virtio/src/queue.rs +++ b/kernel/comps/virtio/src/queue.rs @@ -8,15 +8,15 @@ use core::{ sync::atomic::{fence, Ordering}, }; -use aster_frame::{ - io_mem::IoMem, - mm::{DmaCoherent, FrameAllocOptions}, - offset_of, -}; use aster_rights::{Dup, TRightSet, TRights, Write}; use aster_util::{field_ptr, safe_ptr::SafePtr}; use bitflags::bitflags; use log::debug; +use ostd::{ + io_mem::IoMem, + mm::{DmaCoherent, FrameAllocOptions}, + offset_of, +}; use pod::Pod; use crate::{dma_buf::DmaBuf, transport::VirtioTransport}; diff --git a/kernel/comps/virtio/src/transport/mmio/device.rs b/kernel/comps/virtio/src/transport/mmio/device.rs index 2ddc1cc17..3a5828d95 100644 --- a/kernel/comps/virtio/src/transport/mmio/device.rs +++ b/kernel/comps/virtio/src/transport/mmio/device.rs @@ -3,7 +3,10 @@ use alloc::{boxed::Box, sync::Arc}; use core::mem::size_of; -use aster_frame::{ +use aster_rights::{ReadOp, WriteOp}; +use aster_util::{field_ptr, safe_ptr::SafePtr}; +use log::warn; +use ostd::{ bus::mmio::{ bus::MmioDevice, device::{MmioCommonDevice, VirtioMmioVersion}, @@ -14,9 +17,6 @@ use aster_frame::{ sync::RwLock, trap::IrqCallbackFunction, }; -use aster_rights::{ReadOp, WriteOp}; -use aster_util::{field_ptr, safe_ptr::SafePtr}; -use log::warn; use super::{layout::VirtioMmioLayout, multiplex::MultiplexIrq}; use crate::{ @@ -34,7 +34,7 @@ pub struct VirtioMmioDevice { pub struct VirtioMmioTransport { layout: SafePtr, device: Arc, - common_device: aster_frame::bus::mmio::device::MmioCommonDevice, + common_device: ostd::bus::mmio::device::MmioCommonDevice, multiplex: Arc>, } diff --git a/kernel/comps/virtio/src/transport/mmio/driver.rs b/kernel/comps/virtio/src/transport/mmio/driver.rs index 06b4ebfa1..5bc793a22 100644 --- a/kernel/comps/virtio/src/transport/mmio/driver.rs +++ b/kernel/comps/virtio/src/transport/mmio/driver.rs @@ -2,7 +2,7 @@ use alloc::{sync::Arc, vec::Vec}; -use aster_frame::{ +use ostd::{ bus::{ mmio::{ bus::{MmioDevice, MmioDriver}, diff --git a/kernel/comps/virtio/src/transport/mmio/mod.rs b/kernel/comps/virtio/src/transport/mmio/mod.rs index ebea107f8..2bf16e294 100644 --- a/kernel/comps/virtio/src/transport/mmio/mod.rs +++ b/kernel/comps/virtio/src/transport/mmio/mod.rs @@ -2,7 +2,7 @@ use alloc::sync::Arc; -use aster_frame::bus::mmio::MMIO_BUS; +use ostd::bus::mmio::MMIO_BUS; use spin::Once; use self::driver::VirtioMmioDriver; diff --git a/kernel/comps/virtio/src/transport/mmio/multiplex.rs b/kernel/comps/virtio/src/transport/mmio/multiplex.rs index 4680f6a76..26ec2ed18 100644 --- a/kernel/comps/virtio/src/transport/mmio/multiplex.rs +++ b/kernel/comps/virtio/src/transport/mmio/multiplex.rs @@ -3,13 +3,13 @@ use alloc::{boxed::Box, sync::Arc, vec::Vec}; use core::fmt::Debug; -use aster_frame::{ +use aster_rights::{ReadOp, TRightSet, WriteOp}; +use aster_util::safe_ptr::SafePtr; +use ostd::{ io_mem::IoMem, sync::RwLock, trap::{IrqCallbackFunction, IrqLine, TrapFrame}, }; -use aster_rights::{ReadOp, TRightSet, WriteOp}; -use aster_util::safe_ptr::SafePtr; /// Multiplexing Irqs. The two interrupt types (configuration space change and queue interrupt) /// of the virtio-mmio device share the same IRQ, so `MultiplexIrq` are used to distinguish them. diff --git a/kernel/comps/virtio/src/transport/mod.rs b/kernel/comps/virtio/src/transport/mod.rs index 60f4523ee..e042710a3 100644 --- a/kernel/comps/virtio/src/transport/mod.rs +++ b/kernel/comps/virtio/src/transport/mod.rs @@ -3,8 +3,8 @@ use alloc::boxed::Box; use core::fmt::Debug; -use aster_frame::{io_mem::IoMem, mm::DmaCoherent, trap::IrqCallbackFunction}; use aster_util::safe_ptr::SafePtr; +use ostd::{io_mem::IoMem, mm::DmaCoherent, trap::IrqCallbackFunction}; use self::{mmio::virtio_mmio_init, pci::virtio_pci_init}; use crate::{ diff --git a/kernel/comps/virtio/src/transport/pci/capability.rs b/kernel/comps/virtio/src/transport/pci/capability.rs index c387dc04c..004804aac 100644 --- a/kernel/comps/virtio/src/transport/pci/capability.rs +++ b/kernel/comps/virtio/src/transport/pci/capability.rs @@ -2,7 +2,7 @@ use alloc::sync::Arc; -use aster_frame::bus::pci::{ +use ostd::bus::pci::{ capability::vendor::CapabilityVndrData, cfg_space::{Bar, IoBar, MemoryBar}, common_device::BarManager, diff --git a/kernel/comps/virtio/src/transport/pci/common_cfg.rs b/kernel/comps/virtio/src/transport/pci/common_cfg.rs index b291d3287..a6e8b2e29 100644 --- a/kernel/comps/virtio/src/transport/pci/common_cfg.rs +++ b/kernel/comps/virtio/src/transport/pci/common_cfg.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -use aster_frame::io_mem::IoMem; use aster_util::safe_ptr::SafePtr; +use ostd::io_mem::IoMem; use pod::Pod; use super::capability::VirtioPciCapabilityData; diff --git a/kernel/comps/virtio/src/transport/pci/device.rs b/kernel/comps/virtio/src/transport/pci/device.rs index b5cb79973..5567b7c34 100644 --- a/kernel/comps/virtio/src/transport/pci/device.rs +++ b/kernel/comps/virtio/src/transport/pci/device.rs @@ -3,7 +3,9 @@ use alloc::{boxed::Box, sync::Arc}; use core::fmt::Debug; -use aster_frame::{ +use aster_util::{field_ptr, safe_ptr::SafePtr}; +use log::{info, warn}; +use ostd::{ bus::{ pci::{ bus::PciDevice, capability::CapabilityData, common_device::PciCommonDevice, PciDeviceId, @@ -15,8 +17,6 @@ use aster_frame::{ offset_of, trap::IrqCallbackFunction, }; -use aster_util::{field_ptr, safe_ptr::SafePtr}; -use log::{info, warn}; use super::{common_cfg::VirtioPciCommonCfg, msix::VirtioMsixManager}; use crate::{ diff --git a/kernel/comps/virtio/src/transport/pci/driver.rs b/kernel/comps/virtio/src/transport/pci/driver.rs index 99454ae90..965834227 100644 --- a/kernel/comps/virtio/src/transport/pci/driver.rs +++ b/kernel/comps/virtio/src/transport/pci/driver.rs @@ -2,7 +2,7 @@ use alloc::{sync::Arc, vec::Vec}; -use aster_frame::{ +use ostd::{ bus::{ pci::{ bus::{PciDevice, PciDriver}, diff --git a/kernel/comps/virtio/src/transport/pci/mod.rs b/kernel/comps/virtio/src/transport/pci/mod.rs index c2aab077c..d894f70a4 100644 --- a/kernel/comps/virtio/src/transport/pci/mod.rs +++ b/kernel/comps/virtio/src/transport/pci/mod.rs @@ -8,7 +8,7 @@ pub(super) mod msix; use alloc::sync::Arc; -use aster_frame::bus::pci::PCI_BUS; +use ostd::bus::pci::PCI_BUS; use spin::Once; use self::driver::VirtioPciDriver; diff --git a/kernel/comps/virtio/src/transport/pci/msix.rs b/kernel/comps/virtio/src/transport/pci/msix.rs index b3a21935e..f12ac7a0b 100644 --- a/kernel/comps/virtio/src/transport/pci/msix.rs +++ b/kernel/comps/virtio/src/transport/pci/msix.rs @@ -2,7 +2,7 @@ use alloc::vec::Vec; -use aster_frame::{bus::pci::capability::msix::CapabilityMsixData, trap::IrqLine}; +use ostd::{bus::pci::capability::msix::CapabilityMsixData, trap::IrqLine}; pub struct VirtioMsixManager { config_msix_vector: u16, @@ -20,7 +20,7 @@ impl VirtioMsixManager { pub fn new(mut msix: CapabilityMsixData) -> Self { let mut msix_vector_list: Vec = (0..msix.table_size()).collect(); for i in msix_vector_list.iter() { - let irq = aster_frame::trap::IrqLine::alloc().unwrap(); + let irq = ostd::trap::IrqLine::alloc().unwrap(); msix.set_interrupt_vector(irq, *i); } let config_msix_vector = msix_vector_list.pop().unwrap(); diff --git a/kernel/libs/aster-util/Cargo.toml b/kernel/libs/aster-util/Cargo.toml index 51f42930c..4ee55838b 100644 --- a/kernel/libs/aster-util/Cargo.toml +++ b/kernel/libs/aster-util/Cargo.toml @@ -6,12 +6,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aster-frame = { path = "../../../framework/aster-frame" } +ostd = { path = "../../../ostd" } pod = { git = "https://github.com/asterinas/pod", rev = "d7dba56" } typeflags-util = { path = "../typeflags-util" } aster-rights-proc = { path = "../aster-rights-proc" } aster-rights = { path = "../aster-rights" } inherit-methods-macro = { git = "https://github.com/asterinas/inherit-methods-macro", rev = "98f7e3e" } -ktest = { path = "../../../framework/libs/ktest" } +ktest = { path = "../../../ostd/libs/ktest" } [features] diff --git a/kernel/libs/aster-util/src/dup.rs b/kernel/libs/aster-util/src/dup.rs index c3de639da..a937c97d3 100644 --- a/kernel/libs/aster-util/src/dup.rs +++ b/kernel/libs/aster-util/src/dup.rs @@ -11,5 +11,5 @@ /// _exclusively_ to one another. In other words, a type should not implement /// both traits. pub trait Dup: Sized { - fn dup(&self) -> aster_frame::Result; + fn dup(&self) -> ostd::Result; } diff --git a/kernel/libs/aster-util/src/safe_ptr.rs b/kernel/libs/aster-util/src/safe_ptr.rs index 3e5f34f0d..dd9bde819 100644 --- a/kernel/libs/aster-util/src/safe_ptr.rs +++ b/kernel/libs/aster-util/src/safe_ptr.rs @@ -2,13 +2,13 @@ use core::{fmt::Debug, marker::PhantomData}; -use aster_frame::{ - mm::{Daddr, DmaStream, HasDaddr, HasPaddr, Paddr, VmIo}, - Result, -}; use aster_rights::{Dup, Exec, Full, Read, Signal, TRightSet, TRights, Write}; use aster_rights_proc::require; use inherit_methods_macro::inherit_methods; +use ostd::{ + mm::{Daddr, DmaStream, HasDaddr, HasPaddr, Paddr, VmIo}, + Result, +}; pub use pod::Pod; pub use typeflags_util::SetContain; @@ -381,8 +381,8 @@ impl Debug for SafePtr { #[macro_export] macro_rules! field_ptr { ($ptr:expr, $type:ty, $($field:tt)+) => {{ - use aster_frame::offset_of; - use aster_frame::mm::VmIo; + use ostd::offset_of; + use ostd::mm::VmIo; use aster_rights::Dup; use aster_rights::TRightSet; use aster_rights::TRights; diff --git a/kernel/libs/aster-util/src/union_read_ptr.rs b/kernel/libs/aster-util/src/union_read_ptr.rs index a215429db..3e811630c 100644 --- a/kernel/libs/aster-util/src/union_read_ptr.rs +++ b/kernel/libs/aster-util/src/union_read_ptr.rs @@ -37,7 +37,7 @@ macro_rules! read_union_fields { union_read_ptr.read_at(offset) }); ($container:ident.$($field:ident).*) => ({ - let field_offset = aster_frame::value_offset!($container.$($field).*); + let field_offset = ostd::value_offset!($container.$($field).*); let union_read_ptr = UnionReadPtr::new(&*$container); union_read_ptr.read_at(field_offset) }); diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 7b2f34931..c60d51f09 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -3,13 +3,13 @@ #![no_std] #![no_main] #![deny(unsafe_code)] -extern crate aster_frame; +extern crate ostd; -use aster_frame::prelude::*; +use ostd::prelude::*; #[aster_main] pub fn main() { - println!("[kernel] finish init aster_frame"); + println!("[kernel] finish init ostd"); component::init_all(component::parse_metadata!()).unwrap(); aster_nix::init(); aster_nix::run_first_process(); diff --git a/osdk/Cargo.toml b/osdk/Cargo.toml index 7e7642862..b63429cf2 100644 --- a/osdk/Cargo.toml +++ b/osdk/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/asterinas/asterinas" [dependencies.linux-bzimage-builder] # The path for local development -path = "../framework/libs/linux-bzimage/builder" +path = "../ostd/libs/linux-bzimage/builder" # The version specified here is used for publishing on crates.io. # Please update this version when publishing the cargo-osdk crate # if there have been any changes to the dependent crate. diff --git a/osdk/src/base_crate/mod.rs b/osdk/src/base_crate/mod.rs index d4a54bff3..4f1b727ae 100644 --- a/osdk/src/base_crate/mod.rs +++ b/osdk/src/base_crate/mod.rs @@ -72,7 +72,7 @@ pub fn new_base_crate( )+}; } // TODO: currently just x86_64 works; add support for other architectures - // here when the framework is ready + // here when OSTD is ready include_linker_script!(["x86_64.ld"]); // Overrite the main.rs file diff --git a/osdk/src/bundle/mod.rs b/osdk/src/bundle/mod.rs index 27da172d6..2c75c8da7 100644 --- a/osdk/src/bundle/mod.rs +++ b/osdk/src/bundle/mod.rs @@ -279,8 +279,8 @@ impl Bundle { let qemu_exit_code = exit_status.code().unwrap(); let kernel_exit_code = qemu_exit_code >> 1; match kernel_exit_code { - 0x10 /*aster_frame::QemuExitCode::Success*/ => { std::process::exit(0); }, - 0x20 /*aster_frame::QemuExitCode::Failed*/ => { std::process::exit(1); }, + 0x10 /*ostd::QemuExitCode::Success*/ => { std::process::exit(0); }, + 0x20 /*ostd::QemuExitCode::Failed*/ => { std::process::exit(1); }, _ /* unknown, e.g., a triple fault */ => { std::process::exit(2) }, } } diff --git a/osdk/src/cli.rs b/osdk/src/cli.rs index b1434f4c3..2514f4f8e 100644 --- a/osdk/src/cli.rs +++ b/osdk/src/cli.rs @@ -69,9 +69,7 @@ enum CargoSubcommand { #[derive(Debug, Parser)] pub enum OsdkSubcommand { - #[command( - about = "Create a new kernel package or library package which depends on aster-frame" - )] + #[command(about = "Create a new kernel package or library package which depends on OSTD")] New(NewArgs), #[command(about = "Compile the project and its dependencies")] Build(BuildArgs), diff --git a/osdk/src/commands/new/kernel.template b/osdk/src/commands/new/kernel.template index 43fd8f718..a6a09c9e7 100644 --- a/osdk/src/commands/new/kernel.template +++ b/osdk/src/commands/new/kernel.template @@ -1,7 +1,7 @@ #![no_std] #![deny(unsafe_code)] -use aster_frame::prelude::*; +use ostd::prelude::*; #[aster_main] fn kernel_main() { diff --git a/osdk/src/commands/new/lib.template b/osdk/src/commands/new/lib.template index f783a5fcc..7add7017e 100644 --- a/osdk/src/commands/new/lib.template +++ b/osdk/src/commands/new/lib.template @@ -3,13 +3,13 @@ #[cfg_attr(ktest, macro_use)] extern crate ktest; -extern crate aster_frame; +extern crate ostd; #[cfg(ktest)] mod tests { #[ktest] fn it_works() { - let memory_regions = aster_frame::boot::memory_regions(); + let memory_regions = ostd::boot::memory_regions(); assert!(!memory_regions.is_empty()); } } diff --git a/osdk/src/commands/new/mod.rs b/osdk/src/commands/new/mod.rs index 9c9f4b8c9..74dee3a20 100644 --- a/osdk/src/commands/new/mod.rs +++ b/osdk/src/commands/new/mod.rs @@ -40,8 +40,8 @@ fn add_manifest_dependencies(cargo_metadata: &serde_json::Value, crate_name: &st let dependencies = manifest.get_mut("dependencies").unwrap(); - let aster_frame_dep = toml::Table::from_str(&aster_crate_dep("aster-frame")).unwrap(); - dependencies.as_table_mut().unwrap().extend(aster_frame_dep); + let ostd_dep = toml::Table::from_str(&aster_crate_dep("ostd")).unwrap(); + dependencies.as_table_mut().unwrap().extend(ostd_dep); let ktest_dep = toml::Table::from_str(&aster_crate_dep("ktest")).unwrap(); dependencies.as_table_mut().unwrap().extend(ktest_dep); diff --git a/osdk/tests/examples_in_book/work_in_workspace_templates/mylib/src/lib.rs b/osdk/tests/examples_in_book/work_in_workspace_templates/mylib/src/lib.rs index a31673dbe..5ab331370 100644 --- a/osdk/tests/examples_in_book/work_in_workspace_templates/mylib/src/lib.rs +++ b/osdk/tests/examples_in_book/work_in_workspace_templates/mylib/src/lib.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 pub fn available_memory() -> usize { - let regions = aster_frame::boot::memory_regions(); + let regions = ostd::boot::memory_regions(); regions.iter().map(|region| region.len()).sum() } diff --git a/osdk/tests/examples_in_book/work_in_workspace_templates/myos/src/lib.rs b/osdk/tests/examples_in_book/work_in_workspace_templates/myos/src/lib.rs index 199965ae0..6214b0bb3 100644 --- a/osdk/tests/examples_in_book/work_in_workspace_templates/myos/src/lib.rs +++ b/osdk/tests/examples_in_book/work_in_workspace_templates/myos/src/lib.rs @@ -3,7 +3,7 @@ #![no_std] #![deny(unsafe_code)] -use aster_frame::prelude::*; +use ostd::prelude::*; #[aster_main] fn kernel_main() { diff --git a/framework/aster-frame/Cargo.toml b/ostd/Cargo.toml similarity index 86% rename from framework/aster-frame/Cargo.toml rename to ostd/Cargo.toml index 8634e43a0..d03097b44 100644 --- a/framework/aster-frame/Cargo.toml +++ b/ostd/Cargo.toml @@ -1,29 +1,29 @@ [package] -name = "aster-frame" +name = "ostd" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -align_ext = { path = "../libs/align_ext" } -aster-main = { path = "../libs/aster-main" } +align_ext = { path = "libs/align_ext" } +aster-main = { path = "libs/aster-main" } bit_field = "0.10.1" bitflags = "1.3" bitvec = { version = "1.0", default-features = false, features = ["alloc"] } -linux-boot-params = { path = "../libs/linux-bzimage/boot-params" } +linux-boot-params = { path = "libs/linux-bzimage/boot-params" } buddy_system_allocator = "0.9.0" cfg-if = "1.0" gimli = { version = "0.28", default-features = false, features = ["read-core"] } inherit-methods-macro = { git = "https://github.com/asterinas/inherit-methods-macro", rev = "98f7e3e" } xarray = { git = "https://github.com/asterinas/xarray", rev = "72a4067" } -int-to-c-enum = { path = "../../kernel/libs/int-to-c-enum" } +int-to-c-enum = { path = "../kernel/libs/int-to-c-enum" } # instrusive-collections of version 0.9.6 fails to compile with current rust toolchain, # So we set a fixed version 0.9.5 for this crate intrusive-collections = { version = "=0.9.5", features = ["nightly"] } array-init = "2.0" -ktest = { path = "../libs/ktest" } -id-alloc = { path = "../libs/id-alloc" } +ktest = { path = "libs/ktest" } +id-alloc = { path = "libs/id-alloc" } lazy_static = { version = "1.0", features = ["spin_no_std"] } log = "0.4" num = { version = "0.4", default-features = false } diff --git a/ostd/README.md b/ostd/README.md new file mode 100644 index 000000000..fb2d163ed --- /dev/null +++ b/ostd/README.md @@ -0,0 +1,29 @@ +# Asterinas OSTD + +Asterinas OSTD is a Rust OS framework that facilitates the development of and innovation in OS kernels written in Rust. + +## An overview + +Asterinas OSTD provides a solid foundation for Rust developers to build their own OS kernels. While Asterinas OSTD origins from Asterinas, the first ever framekernel, Asterinas OSTD is well suited for building OS kernels of any architecture, be it a framekernel, a monolithic kernel, or a microkernel. + +Asterinas OSTD offers the following key values. + +1. **Lowering the entry bar for OS innovation.** Building an OS from scratch is not easy. Not to mention a novel one. Before adding any novel or interesting feature, an OS developer must first have something runnable, which must include basic functionalities for managing CPU, memory, and interrupts. Asterinas OSTD has laid this groundwork so that OS developers do not have to deal with the most low-level, error-prone, architecture-specific aspects of OS development themselves. + +2. **Enhancing the memory safety of Rust OSes.** Asterinas OSTD encapsulates low-level, machine-oriented unsafe Rust code into high-level, machine-agnostic safe APIs. These APIs are carefully designed and implemented to be sound and minimal, ensuring the memory safety of any safe Rust callers. Our experience in building Asterinas has shown that Asterinas OSTD is powerful enough to allow a feature-rich, Linux-compatible kernel to be completely written in safe Rust, including its device drivers. + +3. **Promoting code reuse across Rust OS projects.** Shipped as crates, Rust code can be reused across projects---except when they are OSes. A crate that implements a feature or driver for OS A can hardly be reused by OS B because the crate must be [`no_std`](https://docs.rust-embedded.org/book/intro/no-std.html#summary) and depend on the infrastructure APIs provided by OS A, which are obviously different from that provided by OS B. This incompatibility problem can be resolved by Asterinas OSTD as it can serve as a common ground across different Rust OS projects, as long as they are built upon Asterinas OSTD. + +4. **Boost productivity with user-mode development.** Traditionally, developing a kernel feature involves countless rounds of coding, failing, and rebooting on bare-metal or virtual machines, which is a painfully slow process. Asterinas OSTD accelerates the process by allowing high-level OS features like file systems and network stacks to be quickly tested in user mode, making the experience of OS development as smooth as that of application development. To support user-mode development, Asterinas OSTD is implemented for the Linux platform, in addition to bare-mental or virtual machine environments. + +## OSTD APIs + +TODO + +## Implementation status + +TODO + +## Roadmap and plan + +TODO \ No newline at end of file diff --git a/framework/libs/align_ext/Cargo.toml b/ostd/libs/align_ext/Cargo.toml similarity index 100% rename from framework/libs/align_ext/Cargo.toml rename to ostd/libs/align_ext/Cargo.toml diff --git a/framework/libs/align_ext/src/lib.rs b/ostd/libs/align_ext/src/lib.rs similarity index 100% rename from framework/libs/align_ext/src/lib.rs rename to ostd/libs/align_ext/src/lib.rs diff --git a/framework/libs/aster-main/Cargo.toml b/ostd/libs/aster-main/Cargo.toml similarity index 100% rename from framework/libs/aster-main/Cargo.toml rename to ostd/libs/aster-main/Cargo.toml diff --git a/framework/libs/aster-main/src/lib.rs b/ostd/libs/aster-main/src/lib.rs similarity index 86% rename from framework/libs/aster-main/src/lib.rs rename to ostd/libs/aster-main/src/lib.rs index 4e6ad31ac..a0bef7e7d 100644 --- a/framework/libs/aster-main/src/lib.rs +++ b/ostd/libs/aster-main/src/lib.rs @@ -13,9 +13,9 @@ pub fn aster_main(_attr: TokenStream, item: TokenStream) -> TokenStream { quote!( #[no_mangle] pub fn __aster_main() -> ! { - aster_frame::init(); + ostd::init(); #main_fn_name(); - aster_frame::prelude::abort(); + ostd::prelude::abort(); } #main_fn diff --git a/framework/libs/id-alloc/Cargo.toml b/ostd/libs/id-alloc/Cargo.toml similarity index 100% rename from framework/libs/id-alloc/Cargo.toml rename to ostd/libs/id-alloc/Cargo.toml diff --git a/framework/libs/id-alloc/src/lib.rs b/ostd/libs/id-alloc/src/lib.rs similarity index 100% rename from framework/libs/id-alloc/src/lib.rs rename to ostd/libs/id-alloc/src/lib.rs diff --git a/framework/libs/ktest-proc-macro/Cargo.toml b/ostd/libs/ktest-proc-macro/Cargo.toml similarity index 100% rename from framework/libs/ktest-proc-macro/Cargo.toml rename to ostd/libs/ktest-proc-macro/Cargo.toml diff --git a/framework/libs/ktest-proc-macro/src/lib.rs b/ostd/libs/ktest-proc-macro/src/lib.rs similarity index 100% rename from framework/libs/ktest-proc-macro/src/lib.rs rename to ostd/libs/ktest-proc-macro/src/lib.rs diff --git a/framework/libs/ktest/Cargo.toml b/ostd/libs/ktest/Cargo.toml similarity index 100% rename from framework/libs/ktest/Cargo.toml rename to ostd/libs/ktest/Cargo.toml diff --git a/framework/libs/ktest/src/lib.rs b/ostd/libs/ktest/src/lib.rs similarity index 96% rename from framework/libs/ktest/src/lib.rs rename to ostd/libs/ktest/src/lib.rs index af7ca465a..6b4605324 100644 --- a/framework/libs/ktest/src/lib.rs +++ b/ostd/libs/ktest/src/lib.rs @@ -6,7 +6,7 @@ //! `cargo test`-like experience for any `#![no_std]` bare metal crates. //! //! In Asterinas, all the tests written in the source tree of the crates will be run -//! immediately after the initialization of aster-frame. Thus you can use any +//! immediately after the initialization of `ostd`. Thus you can use any //! feature provided by the frame including the heap allocator, etc. //! //! By all means, ktest is an individule crate that only requires: @@ -42,7 +42,7 @@ //! } //! ``` //! -//! And also, any crates using the ktest framework should be linked with aster-frame +//! And also, any crates using the ktest framework should be linked with ostd //! and import the `ktest` crate: //! //! ```toml @@ -70,14 +70,14 @@ //! This is achieved by a whitelist filter on the test name. //! //! ```bash -//! make run KTEST=1 KTEST_WHITELIST=failing_assertion,aster_frame::test::expect_panic +//! make run KTEST=1 KTEST_WHITELIST=failing_assertion,ostd::test::expect_panic //! ``` //! //! `KTEST_CRATES` variable is used to specify in which crates the tests to be run. //! This is achieved by conditionally compiling the test module using the `#[cfg]`. //! //! ```bash -//! make run KTEST=1 KTEST_CRATES=aster-frame +//! make run KTEST=1 KTEST_CRATES=ostd //! `` //! //! We support the `#[should_panic]` attribute just in the same way as the standard diff --git a/framework/libs/ktest/src/path.rs b/ostd/libs/ktest/src/path.rs similarity index 100% rename from framework/libs/ktest/src/path.rs rename to ostd/libs/ktest/src/path.rs diff --git a/framework/libs/ktest/src/runner.rs b/ostd/libs/ktest/src/runner.rs similarity index 100% rename from framework/libs/ktest/src/runner.rs rename to ostd/libs/ktest/src/runner.rs diff --git a/framework/libs/ktest/src/tree.rs b/ostd/libs/ktest/src/tree.rs similarity index 100% rename from framework/libs/ktest/src/tree.rs rename to ostd/libs/ktest/src/tree.rs diff --git a/framework/libs/linux-bzimage/boot-params/Cargo.toml b/ostd/libs/linux-bzimage/boot-params/Cargo.toml similarity index 100% rename from framework/libs/linux-bzimage/boot-params/Cargo.toml rename to ostd/libs/linux-bzimage/boot-params/Cargo.toml diff --git a/framework/libs/linux-bzimage/boot-params/src/lib.rs b/ostd/libs/linux-bzimage/boot-params/src/lib.rs similarity index 100% rename from framework/libs/linux-bzimage/boot-params/src/lib.rs rename to ostd/libs/linux-bzimage/boot-params/src/lib.rs diff --git a/framework/libs/linux-bzimage/builder/Cargo.toml b/ostd/libs/linux-bzimage/builder/Cargo.toml similarity index 100% rename from framework/libs/linux-bzimage/builder/Cargo.toml rename to ostd/libs/linux-bzimage/builder/Cargo.toml diff --git a/framework/libs/linux-bzimage/builder/src/lib.rs b/ostd/libs/linux-bzimage/builder/src/lib.rs similarity index 98% rename from framework/libs/linux-bzimage/builder/src/lib.rs rename to ostd/libs/linux-bzimage/builder/src/lib.rs index df757fa54..6d7758d19 100644 --- a/framework/libs/linux-bzimage/builder/src/lib.rs +++ b/ostd/libs/linux-bzimage/builder/src/lib.rs @@ -131,7 +131,7 @@ fn to_flat_binary(elf_file: &[u8]) -> Vec { /// This function should be used when generating the Linux x86 Boot setup header. /// Some fields in the Linux x86 Boot setup header should be filled after assembled. /// And the filled fields must have the bytes with values of 0xAB. See -/// `framework/aster-frame/src/arch/x86/boot/linux_boot/setup/src/header.S` for more +/// `ostd/src/arch/x86/boot/linux_boot/setup/src/header.S` for more /// info on this mechanism. fn fill_header_field(header: &mut [u8], offset: usize, value: &[u8]) { let size = value.len(); diff --git a/framework/libs/linux-bzimage/builder/src/mapping.rs b/ostd/libs/linux-bzimage/builder/src/mapping.rs similarity index 100% rename from framework/libs/linux-bzimage/builder/src/mapping.rs rename to ostd/libs/linux-bzimage/builder/src/mapping.rs diff --git a/framework/libs/linux-bzimage/builder/src/pe_header.rs b/ostd/libs/linux-bzimage/builder/src/pe_header.rs similarity index 100% rename from framework/libs/linux-bzimage/builder/src/pe_header.rs rename to ostd/libs/linux-bzimage/builder/src/pe_header.rs diff --git a/framework/libs/linux-bzimage/builder/src/x86_64-i386_pm-none.json b/ostd/libs/linux-bzimage/builder/src/x86_64-i386_pm-none.json similarity index 100% rename from framework/libs/linux-bzimage/builder/src/x86_64-i386_pm-none.json rename to ostd/libs/linux-bzimage/builder/src/x86_64-i386_pm-none.json diff --git a/framework/libs/linux-bzimage/setup/.cargo/config.toml b/ostd/libs/linux-bzimage/setup/.cargo/config.toml similarity index 100% rename from framework/libs/linux-bzimage/setup/.cargo/config.toml rename to ostd/libs/linux-bzimage/setup/.cargo/config.toml diff --git a/framework/libs/linux-bzimage/setup/.gitignore b/ostd/libs/linux-bzimage/setup/.gitignore similarity index 100% rename from framework/libs/linux-bzimage/setup/.gitignore rename to ostd/libs/linux-bzimage/setup/.gitignore diff --git a/framework/libs/linux-bzimage/setup/Cargo.toml b/ostd/libs/linux-bzimage/setup/Cargo.toml similarity index 100% rename from framework/libs/linux-bzimage/setup/Cargo.toml rename to ostd/libs/linux-bzimage/setup/Cargo.toml diff --git a/framework/libs/linux-bzimage/setup/build.rs b/ostd/libs/linux-bzimage/setup/build.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/build.rs rename to ostd/libs/linux-bzimage/setup/build.rs diff --git a/framework/libs/linux-bzimage/setup/src/console.rs b/ostd/libs/linux-bzimage/setup/src/console.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/console.rs rename to ostd/libs/linux-bzimage/setup/src/console.rs diff --git a/framework/libs/linux-bzimage/setup/src/loader.rs b/ostd/libs/linux-bzimage/setup/src/loader.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/loader.rs rename to ostd/libs/linux-bzimage/setup/src/loader.rs diff --git a/framework/libs/linux-bzimage/setup/src/main.rs b/ostd/libs/linux-bzimage/setup/src/main.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/main.rs rename to ostd/libs/linux-bzimage/setup/src/main.rs diff --git a/framework/libs/linux-bzimage/setup/src/x86/amd64_efi/efi.rs b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/efi.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/amd64_efi/efi.rs rename to ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/efi.rs diff --git a/framework/libs/linux-bzimage/setup/src/x86/amd64_efi/header.S b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/header.S similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/amd64_efi/header.S rename to ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/header.S diff --git a/framework/libs/linux-bzimage/setup/src/x86/amd64_efi/linker.ld b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/linker.ld similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/amd64_efi/linker.ld rename to ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/linker.ld diff --git a/framework/libs/linux-bzimage/setup/src/x86/amd64_efi/mod.rs b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/mod.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/amd64_efi/mod.rs rename to ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/mod.rs diff --git a/framework/libs/linux-bzimage/setup/src/x86/amd64_efi/paging.rs b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/paging.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/amd64_efi/paging.rs rename to ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/paging.rs diff --git a/framework/libs/linux-bzimage/setup/src/x86/amd64_efi/relocation.rs b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/relocation.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/amd64_efi/relocation.rs rename to ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/relocation.rs diff --git a/framework/libs/linux-bzimage/setup/src/x86/amd64_efi/setup.S b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/setup.S similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/amd64_efi/setup.S rename to ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/setup.S diff --git a/framework/libs/linux-bzimage/setup/src/x86/legacy_i386/header.S b/ostd/libs/linux-bzimage/setup/src/x86/legacy_i386/header.S similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/legacy_i386/header.S rename to ostd/libs/linux-bzimage/setup/src/x86/legacy_i386/header.S diff --git a/framework/libs/linux-bzimage/setup/src/x86/legacy_i386/linker.ld b/ostd/libs/linux-bzimage/setup/src/x86/legacy_i386/linker.ld similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/legacy_i386/linker.ld rename to ostd/libs/linux-bzimage/setup/src/x86/legacy_i386/linker.ld diff --git a/framework/libs/linux-bzimage/setup/src/x86/legacy_i386/mod.rs b/ostd/libs/linux-bzimage/setup/src/x86/legacy_i386/mod.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/legacy_i386/mod.rs rename to ostd/libs/linux-bzimage/setup/src/x86/legacy_i386/mod.rs diff --git a/framework/libs/linux-bzimage/setup/src/x86/legacy_i386/setup.S b/ostd/libs/linux-bzimage/setup/src/x86/legacy_i386/setup.S similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/legacy_i386/setup.S rename to ostd/libs/linux-bzimage/setup/src/x86/legacy_i386/setup.S diff --git a/framework/libs/linux-bzimage/setup/src/x86/mod.rs b/ostd/libs/linux-bzimage/setup/src/x86/mod.rs similarity index 100% rename from framework/libs/linux-bzimage/setup/src/x86/mod.rs rename to ostd/libs/linux-bzimage/setup/src/x86/mod.rs diff --git a/framework/aster-frame/src/arch/mod.rs b/ostd/src/arch/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/mod.rs rename to ostd/src/arch/mod.rs diff --git a/framework/aster-frame/src/arch/x86/boot/boot.S b/ostd/src/arch/x86/boot/boot.S similarity index 100% rename from framework/aster-frame/src/arch/x86/boot/boot.S rename to ostd/src/arch/x86/boot/boot.S diff --git a/framework/aster-frame/src/arch/x86/boot/linux_boot/mod.rs b/ostd/src/arch/x86/boot/linux_boot/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/boot/linux_boot/mod.rs rename to ostd/src/arch/x86/boot/linux_boot/mod.rs diff --git a/framework/aster-frame/src/arch/x86/boot/mod.rs b/ostd/src/arch/x86/boot/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/boot/mod.rs rename to ostd/src/arch/x86/boot/mod.rs diff --git a/framework/aster-frame/src/arch/x86/boot/multiboot/header.S b/ostd/src/arch/x86/boot/multiboot/header.S similarity index 100% rename from framework/aster-frame/src/arch/x86/boot/multiboot/header.S rename to ostd/src/arch/x86/boot/multiboot/header.S diff --git a/framework/aster-frame/src/arch/x86/boot/multiboot/mod.rs b/ostd/src/arch/x86/boot/multiboot/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/boot/multiboot/mod.rs rename to ostd/src/arch/x86/boot/multiboot/mod.rs diff --git a/framework/aster-frame/src/arch/x86/boot/multiboot2/header.S b/ostd/src/arch/x86/boot/multiboot2/header.S similarity index 100% rename from framework/aster-frame/src/arch/x86/boot/multiboot2/header.S rename to ostd/src/arch/x86/boot/multiboot2/header.S diff --git a/framework/aster-frame/src/arch/x86/boot/multiboot2/mod.rs b/ostd/src/arch/x86/boot/multiboot2/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/boot/multiboot2/mod.rs rename to ostd/src/arch/x86/boot/multiboot2/mod.rs diff --git a/framework/aster-frame/src/arch/x86/console.rs b/ostd/src/arch/x86/console.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/console.rs rename to ostd/src/arch/x86/console.rs diff --git a/framework/aster-frame/src/arch/x86/cpu.rs b/ostd/src/arch/x86/cpu.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/cpu.rs rename to ostd/src/arch/x86/cpu.rs diff --git a/framework/aster-frame/src/arch/x86/device/cmos.rs b/ostd/src/arch/x86/device/cmos.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/device/cmos.rs rename to ostd/src/arch/x86/device/cmos.rs diff --git a/framework/aster-frame/src/arch/x86/device/io_port.rs b/ostd/src/arch/x86/device/io_port.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/device/io_port.rs rename to ostd/src/arch/x86/device/io_port.rs diff --git a/framework/aster-frame/src/arch/x86/device/mod.rs b/ostd/src/arch/x86/device/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/device/mod.rs rename to ostd/src/arch/x86/device/mod.rs diff --git a/framework/aster-frame/src/arch/x86/device/serial.rs b/ostd/src/arch/x86/device/serial.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/device/serial.rs rename to ostd/src/arch/x86/device/serial.rs diff --git a/framework/aster-frame/src/arch/x86/iommu/context_table.rs b/ostd/src/arch/x86/iommu/context_table.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/iommu/context_table.rs rename to ostd/src/arch/x86/iommu/context_table.rs diff --git a/framework/aster-frame/src/arch/x86/iommu/fault.rs b/ostd/src/arch/x86/iommu/fault.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/iommu/fault.rs rename to ostd/src/arch/x86/iommu/fault.rs diff --git a/framework/aster-frame/src/arch/x86/iommu/mod.rs b/ostd/src/arch/x86/iommu/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/iommu/mod.rs rename to ostd/src/arch/x86/iommu/mod.rs diff --git a/framework/aster-frame/src/arch/x86/iommu/remapping.rs b/ostd/src/arch/x86/iommu/remapping.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/iommu/remapping.rs rename to ostd/src/arch/x86/iommu/remapping.rs diff --git a/framework/aster-frame/src/arch/x86/iommu/second_stage.rs b/ostd/src/arch/x86/iommu/second_stage.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/iommu/second_stage.rs rename to ostd/src/arch/x86/iommu/second_stage.rs diff --git a/framework/aster-frame/src/arch/x86/irq.rs b/ostd/src/arch/x86/irq.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/irq.rs rename to ostd/src/arch/x86/irq.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/acpi/dmar.rs b/ostd/src/arch/x86/kernel/acpi/dmar.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/acpi/dmar.rs rename to ostd/src/arch/x86/kernel/acpi/dmar.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/acpi/mod.rs b/ostd/src/arch/x86/kernel/acpi/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/acpi/mod.rs rename to ostd/src/arch/x86/kernel/acpi/mod.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/acpi/remapping.rs b/ostd/src/arch/x86/kernel/acpi/remapping.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/acpi/remapping.rs rename to ostd/src/arch/x86/kernel/acpi/remapping.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/apic/ioapic.rs b/ostd/src/arch/x86/kernel/apic/ioapic.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/apic/ioapic.rs rename to ostd/src/arch/x86/kernel/apic/ioapic.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/apic/mod.rs b/ostd/src/arch/x86/kernel/apic/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/apic/mod.rs rename to ostd/src/arch/x86/kernel/apic/mod.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/apic/x2apic.rs b/ostd/src/arch/x86/kernel/apic/x2apic.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/apic/x2apic.rs rename to ostd/src/arch/x86/kernel/apic/x2apic.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/apic/xapic.rs b/ostd/src/arch/x86/kernel/apic/xapic.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/apic/xapic.rs rename to ostd/src/arch/x86/kernel/apic/xapic.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/mod.rs b/ostd/src/arch/x86/kernel/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/mod.rs rename to ostd/src/arch/x86/kernel/mod.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/pic.rs b/ostd/src/arch/x86/kernel/pic.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/pic.rs rename to ostd/src/arch/x86/kernel/pic.rs diff --git a/framework/aster-frame/src/arch/x86/kernel/tsc.rs b/ostd/src/arch/x86/kernel/tsc.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/kernel/tsc.rs rename to ostd/src/arch/x86/kernel/tsc.rs diff --git a/framework/aster-frame/src/arch/x86/mm/mod.rs b/ostd/src/arch/x86/mm/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/mm/mod.rs rename to ostd/src/arch/x86/mm/mod.rs diff --git a/framework/aster-frame/src/arch/x86/mod.rs b/ostd/src/arch/x86/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/mod.rs rename to ostd/src/arch/x86/mod.rs diff --git a/framework/aster-frame/src/arch/x86/pci.rs b/ostd/src/arch/x86/pci.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/pci.rs rename to ostd/src/arch/x86/pci.rs diff --git a/framework/aster-frame/src/arch/x86/qemu.rs b/ostd/src/arch/x86/qemu.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/qemu.rs rename to ostd/src/arch/x86/qemu.rs diff --git a/framework/aster-frame/src/arch/x86/task/mod.rs b/ostd/src/arch/x86/task/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/task/mod.rs rename to ostd/src/arch/x86/task/mod.rs diff --git a/framework/aster-frame/src/arch/x86/task/switch.S b/ostd/src/arch/x86/task/switch.S similarity index 100% rename from framework/aster-frame/src/arch/x86/task/switch.S rename to ostd/src/arch/x86/task/switch.S diff --git a/framework/aster-frame/src/arch/x86/tdx_guest.rs b/ostd/src/arch/x86/tdx_guest.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/tdx_guest.rs rename to ostd/src/arch/x86/tdx_guest.rs diff --git a/framework/aster-frame/src/arch/x86/timer/apic.rs b/ostd/src/arch/x86/timer/apic.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/timer/apic.rs rename to ostd/src/arch/x86/timer/apic.rs diff --git a/framework/aster-frame/src/arch/x86/timer/hpet.rs b/ostd/src/arch/x86/timer/hpet.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/timer/hpet.rs rename to ostd/src/arch/x86/timer/hpet.rs diff --git a/framework/aster-frame/src/arch/x86/timer/jiffies.rs b/ostd/src/arch/x86/timer/jiffies.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/timer/jiffies.rs rename to ostd/src/arch/x86/timer/jiffies.rs diff --git a/framework/aster-frame/src/arch/x86/timer/mod.rs b/ostd/src/arch/x86/timer/mod.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/timer/mod.rs rename to ostd/src/arch/x86/timer/mod.rs diff --git a/framework/aster-frame/src/arch/x86/timer/pit.rs b/ostd/src/arch/x86/timer/pit.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/timer/pit.rs rename to ostd/src/arch/x86/timer/pit.rs diff --git a/framework/aster-frame/src/arch/x86/trap.rs b/ostd/src/arch/x86/trap.rs similarity index 100% rename from framework/aster-frame/src/arch/x86/trap.rs rename to ostd/src/arch/x86/trap.rs diff --git a/framework/aster-frame/src/boot/kcmdline.rs b/ostd/src/boot/kcmdline.rs similarity index 100% rename from framework/aster-frame/src/boot/kcmdline.rs rename to ostd/src/boot/kcmdline.rs diff --git a/framework/aster-frame/src/boot/memory_region.rs b/ostd/src/boot/memory_region.rs similarity index 100% rename from framework/aster-frame/src/boot/memory_region.rs rename to ostd/src/boot/memory_region.rs diff --git a/framework/aster-frame/src/boot/mod.rs b/ostd/src/boot/mod.rs similarity index 96% rename from framework/aster-frame/src/boot/mod.rs rename to ostd/src/boot/mod.rs index 7c019dbba..1bfe8710a 100644 --- a/framework/aster-frame/src/boot/mod.rs +++ b/ostd/src/boot/mod.rs @@ -3,7 +3,7 @@ #![allow(dead_code)] //! The architecture-independent boot module, which provides a universal interface -//! from the bootloader to the rest of the framework. +//! from the bootloader to the rest of OSTD. //! pub mod kcmdline; @@ -108,15 +108,15 @@ pub fn init() { call_all_boot_init_callbacks(); } -/// Calls the framework-user defined entrypoint of the actual kernel. +/// Calls the OSTD-user defined entrypoint of the actual kernel. /// -/// Any kernel that uses the aster-frame crate should define a function named +/// Any kernel that uses the `ostd` crate should define a function named /// `aster_main` as the entrypoint. pub fn call_aster_main() -> ! { #[cfg(not(ktest))] unsafe { // The entry point of kernel code, which should be defined by the package that - // uses aster-frame. + // uses OSTD. extern "Rust" { fn __aster_main() -> !; } diff --git a/framework/aster-frame/src/bus/mmio/bus.rs b/ostd/src/bus/mmio/bus.rs similarity index 100% rename from framework/aster-frame/src/bus/mmio/bus.rs rename to ostd/src/bus/mmio/bus.rs diff --git a/framework/aster-frame/src/bus/mmio/device.rs b/ostd/src/bus/mmio/device.rs similarity index 100% rename from framework/aster-frame/src/bus/mmio/device.rs rename to ostd/src/bus/mmio/device.rs diff --git a/framework/aster-frame/src/bus/mmio/mod.rs b/ostd/src/bus/mmio/mod.rs similarity index 100% rename from framework/aster-frame/src/bus/mmio/mod.rs rename to ostd/src/bus/mmio/mod.rs diff --git a/framework/aster-frame/src/bus/mod.rs b/ostd/src/bus/mod.rs similarity index 100% rename from framework/aster-frame/src/bus/mod.rs rename to ostd/src/bus/mod.rs diff --git a/framework/aster-frame/src/bus/pci/bus.rs b/ostd/src/bus/pci/bus.rs similarity index 100% rename from framework/aster-frame/src/bus/pci/bus.rs rename to ostd/src/bus/pci/bus.rs diff --git a/framework/aster-frame/src/bus/pci/capability/mod.rs b/ostd/src/bus/pci/capability/mod.rs similarity index 100% rename from framework/aster-frame/src/bus/pci/capability/mod.rs rename to ostd/src/bus/pci/capability/mod.rs diff --git a/framework/aster-frame/src/bus/pci/capability/msix.rs b/ostd/src/bus/pci/capability/msix.rs similarity index 100% rename from framework/aster-frame/src/bus/pci/capability/msix.rs rename to ostd/src/bus/pci/capability/msix.rs diff --git a/framework/aster-frame/src/bus/pci/capability/vendor.rs b/ostd/src/bus/pci/capability/vendor.rs similarity index 100% rename from framework/aster-frame/src/bus/pci/capability/vendor.rs rename to ostd/src/bus/pci/capability/vendor.rs diff --git a/framework/aster-frame/src/bus/pci/cfg_space.rs b/ostd/src/bus/pci/cfg_space.rs similarity index 100% rename from framework/aster-frame/src/bus/pci/cfg_space.rs rename to ostd/src/bus/pci/cfg_space.rs diff --git a/framework/aster-frame/src/bus/pci/common_device.rs b/ostd/src/bus/pci/common_device.rs similarity index 100% rename from framework/aster-frame/src/bus/pci/common_device.rs rename to ostd/src/bus/pci/common_device.rs diff --git a/framework/aster-frame/src/bus/pci/device_info.rs b/ostd/src/bus/pci/device_info.rs similarity index 100% rename from framework/aster-frame/src/bus/pci/device_info.rs rename to ostd/src/bus/pci/device_info.rs diff --git a/framework/aster-frame/src/bus/pci/mod.rs b/ostd/src/bus/pci/mod.rs similarity index 100% rename from framework/aster-frame/src/bus/pci/mod.rs rename to ostd/src/bus/pci/mod.rs diff --git a/framework/aster-frame/src/collections/mod.rs b/ostd/src/collections/mod.rs similarity index 100% rename from framework/aster-frame/src/collections/mod.rs rename to ostd/src/collections/mod.rs diff --git a/framework/aster-frame/src/collections/xarray.rs b/ostd/src/collections/xarray.rs similarity index 100% rename from framework/aster-frame/src/collections/xarray.rs rename to ostd/src/collections/xarray.rs diff --git a/framework/aster-frame/src/console.rs b/ostd/src/console.rs similarity index 100% rename from framework/aster-frame/src/console.rs rename to ostd/src/console.rs diff --git a/framework/aster-frame/src/cpu.rs b/ostd/src/cpu.rs similarity index 100% rename from framework/aster-frame/src/cpu.rs rename to ostd/src/cpu.rs diff --git a/framework/aster-frame/src/error.rs b/ostd/src/error.rs similarity index 100% rename from framework/aster-frame/src/error.rs rename to ostd/src/error.rs diff --git a/framework/aster-frame/src/io_mem.rs b/ostd/src/io_mem.rs similarity index 100% rename from framework/aster-frame/src/io_mem.rs rename to ostd/src/io_mem.rs diff --git a/framework/aster-frame/src/lib.rs b/ostd/src/lib.rs similarity index 95% rename from framework/aster-frame/src/lib.rs rename to ostd/src/lib.rs index 7af1fcc56..92622c63e 100644 --- a/framework/aster-frame/src/lib.rs +++ b/ostd/src/lib.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -//! The framework part of Asterinas. +//! The standard library for Asterinas and other Rust OSes. #![feature(alloc_error_handler)] #![feature(const_mut_refs)] #![feature(const_ptr_sub_ptr)] @@ -49,10 +49,10 @@ use tdx_guest::init_tdx; pub use self::{cpu::CpuLocal, error::Error, prelude::Result}; -/// Initialize the framework. +/// Initialize OSTD. /// /// This function represents the first phase booting up the system. It makes -/// all functionalities of the framework available after the call. +/// all functionalities of OSTD available after the call. /// /// TODO: We need to refactor this function to make it more modular and /// make inter-initialization-dependencies more clear and reduce usages of diff --git a/framework/aster-frame/src/logger.rs b/ostd/src/logger.rs similarity index 100% rename from framework/aster-frame/src/logger.rs rename to ostd/src/logger.rs diff --git a/framework/aster-frame/src/mm/dma/dma_coherent.rs b/ostd/src/mm/dma/dma_coherent.rs similarity index 100% rename from framework/aster-frame/src/mm/dma/dma_coherent.rs rename to ostd/src/mm/dma/dma_coherent.rs diff --git a/framework/aster-frame/src/mm/dma/dma_stream.rs b/ostd/src/mm/dma/dma_stream.rs similarity index 100% rename from framework/aster-frame/src/mm/dma/dma_stream.rs rename to ostd/src/mm/dma/dma_stream.rs diff --git a/framework/aster-frame/src/mm/dma/mod.rs b/ostd/src/mm/dma/mod.rs similarity index 100% rename from framework/aster-frame/src/mm/dma/mod.rs rename to ostd/src/mm/dma/mod.rs diff --git a/framework/aster-frame/src/mm/frame/frame_vec.rs b/ostd/src/mm/frame/frame_vec.rs similarity index 100% rename from framework/aster-frame/src/mm/frame/frame_vec.rs rename to ostd/src/mm/frame/frame_vec.rs diff --git a/framework/aster-frame/src/mm/frame/mod.rs b/ostd/src/mm/frame/mod.rs similarity index 100% rename from framework/aster-frame/src/mm/frame/mod.rs rename to ostd/src/mm/frame/mod.rs diff --git a/framework/aster-frame/src/mm/frame/options.rs b/ostd/src/mm/frame/options.rs similarity index 100% rename from framework/aster-frame/src/mm/frame/options.rs rename to ostd/src/mm/frame/options.rs diff --git a/framework/aster-frame/src/mm/frame/segment.rs b/ostd/src/mm/frame/segment.rs similarity index 100% rename from framework/aster-frame/src/mm/frame/segment.rs rename to ostd/src/mm/frame/segment.rs diff --git a/framework/aster-frame/src/mm/heap_allocator.rs b/ostd/src/mm/heap_allocator.rs similarity index 100% rename from framework/aster-frame/src/mm/heap_allocator.rs rename to ostd/src/mm/heap_allocator.rs diff --git a/framework/aster-frame/src/mm/io.rs b/ostd/src/mm/io.rs similarity index 100% rename from framework/aster-frame/src/mm/io.rs rename to ostd/src/mm/io.rs diff --git a/framework/aster-frame/src/mm/kspace.rs b/ostd/src/mm/kspace.rs similarity index 98% rename from framework/aster-frame/src/mm/kspace.rs rename to ostd/src/mm/kspace.rs index be90013b2..50f68efa0 100644 --- a/framework/aster-frame/src/mm/kspace.rs +++ b/ostd/src/mm/kspace.rs @@ -74,7 +74,7 @@ pub const KERNEL_END_VADDR: Vaddr = 0xffff_ffff_ffff_0000 << ADDR_WIDTH_SHIFT; /// The kernel code is linear mapped to this address. /// /// FIXME: This offset should be randomly chosen by the loader or the -/// boot compatibility layer. But we disabled it because the framework +/// boot compatibility layer. But we disabled it because OSTD /// doesn't support relocatable kernel yet. pub fn kernel_loaded_offset() -> usize { KERNEL_CODE_BASE_VADDR @@ -95,7 +95,7 @@ pub const VMALLOC_VADDR_RANGE: Range = VMALLOC_BASE_VADDR..FRAME_METADATA pub const LINEAR_MAPPING_BASE_VADDR: Vaddr = 0xffff_8000_0000_0000 << ADDR_WIDTH_SHIFT; pub const LINEAR_MAPPING_VADDR_RANGE: Range = LINEAR_MAPPING_BASE_VADDR..VMALLOC_BASE_VADDR; -/// Convert physical address to virtual address using offset, only available inside aster-frame +/// Convert physical address to virtual address using offset, only available inside `ostd` pub fn paddr_to_vaddr(pa: Paddr) -> usize { debug_assert!(pa < VMALLOC_BASE_VADDR - LINEAR_MAPPING_BASE_VADDR); pa + LINEAR_MAPPING_BASE_VADDR diff --git a/framework/aster-frame/src/mm/mod.rs b/ostd/src/mm/mod.rs similarity index 100% rename from framework/aster-frame/src/mm/mod.rs rename to ostd/src/mm/mod.rs diff --git a/framework/aster-frame/src/mm/offset.rs b/ostd/src/mm/offset.rs similarity index 100% rename from framework/aster-frame/src/mm/offset.rs rename to ostd/src/mm/offset.rs diff --git a/framework/aster-frame/src/mm/page/allocator.rs b/ostd/src/mm/page/allocator.rs similarity index 100% rename from framework/aster-frame/src/mm/page/allocator.rs rename to ostd/src/mm/page/allocator.rs diff --git a/framework/aster-frame/src/mm/page/cont_pages.rs b/ostd/src/mm/page/cont_pages.rs similarity index 100% rename from framework/aster-frame/src/mm/page/cont_pages.rs rename to ostd/src/mm/page/cont_pages.rs diff --git a/framework/aster-frame/src/mm/page/meta.rs b/ostd/src/mm/page/meta.rs similarity index 100% rename from framework/aster-frame/src/mm/page/meta.rs rename to ostd/src/mm/page/meta.rs diff --git a/framework/aster-frame/src/mm/page/mod.rs b/ostd/src/mm/page/mod.rs similarity index 100% rename from framework/aster-frame/src/mm/page/mod.rs rename to ostd/src/mm/page/mod.rs diff --git a/framework/aster-frame/src/mm/page_prop.rs b/ostd/src/mm/page_prop.rs similarity index 98% rename from framework/aster-frame/src/mm/page_prop.rs rename to ostd/src/mm/page_prop.rs index bbdd83685..7bb028ed1 100644 --- a/framework/aster-frame/src/mm/page_prop.rs +++ b/ostd/src/mm/page_prop.rs @@ -119,7 +119,7 @@ bitflags! { } bitflags! { - /// Page property that are only accessible in the framework. + /// Page property that are only accessible in OSTD. pub(crate) struct PrivilegedPageFlags: u8 { /// Accessible from user mode. const USER = 0b00000001; diff --git a/framework/aster-frame/src/mm/page_table/boot_pt.rs b/ostd/src/mm/page_table/boot_pt.rs similarity index 100% rename from framework/aster-frame/src/mm/page_table/boot_pt.rs rename to ostd/src/mm/page_table/boot_pt.rs diff --git a/framework/aster-frame/src/mm/page_table/cursor.rs b/ostd/src/mm/page_table/cursor.rs similarity index 100% rename from framework/aster-frame/src/mm/page_table/cursor.rs rename to ostd/src/mm/page_table/cursor.rs diff --git a/framework/aster-frame/src/mm/page_table/mod.rs b/ostd/src/mm/page_table/mod.rs similarity index 100% rename from framework/aster-frame/src/mm/page_table/mod.rs rename to ostd/src/mm/page_table/mod.rs diff --git a/framework/aster-frame/src/mm/page_table/node.rs b/ostd/src/mm/page_table/node.rs similarity index 100% rename from framework/aster-frame/src/mm/page_table/node.rs rename to ostd/src/mm/page_table/node.rs diff --git a/framework/aster-frame/src/mm/page_table/test.rs b/ostd/src/mm/page_table/test.rs similarity index 100% rename from framework/aster-frame/src/mm/page_table/test.rs rename to ostd/src/mm/page_table/test.rs diff --git a/framework/aster-frame/src/mm/space.rs b/ostd/src/mm/space.rs similarity index 100% rename from framework/aster-frame/src/mm/space.rs rename to ostd/src/mm/space.rs diff --git a/framework/aster-frame/src/panicking.rs b/ostd/src/panicking.rs similarity index 96% rename from framework/aster-frame/src/panicking.rs rename to ostd/src/panicking.rs index dbd799ffa..bb2472403 100644 --- a/framework/aster-frame/src/panicking.rs +++ b/ostd/src/panicking.rs @@ -24,8 +24,8 @@ use unwinding::{ }; /// The panic handler must be defined in the binary crate or in the crate that the binary -/// crate explicity declares by `extern crate`. We cannot let the base crate depend on the -/// framework due to prismatic dependencies. That's why we export this symbol and state the +/// crate explicity declares by `extern crate`. We cannot let the base crate depend on OSTD +/// due to prismatic dependencies. That's why we export this symbol and state the /// panic handler in the binary crate. #[export_name = "__aster_panic_handler"] pub fn panic_handler(info: &core::panic::PanicInfo) -> ! { diff --git a/framework/aster-frame/src/prelude.rs b/ostd/src/prelude.rs similarity index 100% rename from framework/aster-frame/src/prelude.rs rename to ostd/src/prelude.rs diff --git a/framework/aster-frame/src/sync/atomic_bits.rs b/ostd/src/sync/atomic_bits.rs similarity index 100% rename from framework/aster-frame/src/sync/atomic_bits.rs rename to ostd/src/sync/atomic_bits.rs diff --git a/framework/aster-frame/src/sync/mod.rs b/ostd/src/sync/mod.rs similarity index 100% rename from framework/aster-frame/src/sync/mod.rs rename to ostd/src/sync/mod.rs diff --git a/framework/aster-frame/src/sync/mutex.rs b/ostd/src/sync/mutex.rs similarity index 100% rename from framework/aster-frame/src/sync/mutex.rs rename to ostd/src/sync/mutex.rs diff --git a/framework/aster-frame/src/sync/rcu/mod.rs b/ostd/src/sync/rcu/mod.rs similarity index 100% rename from framework/aster-frame/src/sync/rcu/mod.rs rename to ostd/src/sync/rcu/mod.rs diff --git a/framework/aster-frame/src/sync/rcu/monitor.rs b/ostd/src/sync/rcu/monitor.rs similarity index 100% rename from framework/aster-frame/src/sync/rcu/monitor.rs rename to ostd/src/sync/rcu/monitor.rs diff --git a/framework/aster-frame/src/sync/rcu/owner_ptr.rs b/ostd/src/sync/rcu/owner_ptr.rs similarity index 100% rename from framework/aster-frame/src/sync/rcu/owner_ptr.rs rename to ostd/src/sync/rcu/owner_ptr.rs diff --git a/framework/aster-frame/src/sync/rwlock.rs b/ostd/src/sync/rwlock.rs similarity index 99% rename from framework/aster-frame/src/sync/rwlock.rs rename to ostd/src/sync/rwlock.rs index 535ba1ae5..15e02609c 100644 --- a/framework/aster-frame/src/sync/rwlock.rs +++ b/ostd/src/sync/rwlock.rs @@ -67,7 +67,7 @@ use crate::{ /// # Examples /// /// ``` -/// use aster_frame::sync::RwLock; +/// use ostd::sync::RwLock; /// /// let lock = RwLock::new(5) /// diff --git a/framework/aster-frame/src/sync/rwmutex.rs b/ostd/src/sync/rwmutex.rs similarity index 99% rename from framework/aster-frame/src/sync/rwmutex.rs rename to ostd/src/sync/rwmutex.rs index c442d2c7f..0b6289a07 100644 --- a/framework/aster-frame/src/sync/rwmutex.rs +++ b/ostd/src/sync/rwmutex.rs @@ -53,7 +53,7 @@ use super::WaitQueue; /// # Examples /// /// ``` -/// use aster_frame::sync::RwMutex; +/// use ostd::sync::RwMutex; /// /// let mutex = RwMutex::new(5) /// diff --git a/framework/aster-frame/src/sync/spin.rs b/ostd/src/sync/spin.rs similarity index 100% rename from framework/aster-frame/src/sync/spin.rs rename to ostd/src/sync/spin.rs diff --git a/framework/aster-frame/src/sync/wait.rs b/ostd/src/sync/wait.rs similarity index 100% rename from framework/aster-frame/src/sync/wait.rs rename to ostd/src/sync/wait.rs diff --git a/framework/aster-frame/src/task/mod.rs b/ostd/src/task/mod.rs similarity index 100% rename from framework/aster-frame/src/task/mod.rs rename to ostd/src/task/mod.rs diff --git a/framework/aster-frame/src/task/priority.rs b/ostd/src/task/priority.rs similarity index 100% rename from framework/aster-frame/src/task/priority.rs rename to ostd/src/task/priority.rs diff --git a/framework/aster-frame/src/task/processor.rs b/ostd/src/task/processor.rs similarity index 100% rename from framework/aster-frame/src/task/processor.rs rename to ostd/src/task/processor.rs diff --git a/framework/aster-frame/src/task/scheduler.rs b/ostd/src/task/scheduler.rs similarity index 100% rename from framework/aster-frame/src/task/scheduler.rs rename to ostd/src/task/scheduler.rs diff --git a/framework/aster-frame/src/task/task.rs b/ostd/src/task/task.rs similarity index 100% rename from framework/aster-frame/src/task/task.rs rename to ostd/src/task/task.rs diff --git a/framework/aster-frame/src/trap/handler.rs b/ostd/src/trap/handler.rs similarity index 100% rename from framework/aster-frame/src/trap/handler.rs rename to ostd/src/trap/handler.rs diff --git a/framework/aster-frame/src/trap/irq.rs b/ostd/src/trap/irq.rs similarity index 99% rename from framework/aster-frame/src/trap/irq.rs rename to ostd/src/trap/irq.rs index 5bd64c54e..6a07c818c 100644 --- a/framework/aster-frame/src/trap/irq.rs +++ b/ostd/src/trap/irq.rs @@ -119,7 +119,7 @@ impl Drop for IrqLine { /// # Example /// /// ```rust -/// use aster_frame::irq; +/// use ostd::irq; /// /// { /// let _ = irq::disable_local(); diff --git a/framework/aster-frame/src/trap/mod.rs b/ostd/src/trap/mod.rs similarity index 100% rename from framework/aster-frame/src/trap/mod.rs rename to ostd/src/trap/mod.rs diff --git a/framework/aster-frame/src/trap/softirq.rs b/ostd/src/trap/softirq.rs similarity index 100% rename from framework/aster-frame/src/trap/softirq.rs rename to ostd/src/trap/softirq.rs diff --git a/framework/aster-frame/src/user.rs b/ostd/src/user.rs similarity index 98% rename from framework/aster-frame/src/user.rs rename to ostd/src/user.rs index 39181e573..2628ed444 100644 --- a/framework/aster-frame/src/user.rs +++ b/ostd/src/user.rs @@ -50,7 +50,7 @@ impl UserSpace { /// Specific architectures need to implement this trait. This should only used in [`UserMode`] /// -/// Only visible in aster-frame +/// Only visible in `ostd`. pub(crate) trait UserContextApiInternal { /// Starts executing in the user mode. fn execute(&mut self, has_kernel_event: F) -> ReturnReason @@ -90,7 +90,7 @@ pub trait UserContextApi { /// Here is a sample code on how to use `UserMode`. /// /// ```no_run -/// use aster_frame::task::Task; +/// use ostd::task::Task; /// /// let current = Task::current(); /// let user_space = current.user_space() diff --git a/tools/github_workflows/build_and_upload_api_docs.sh b/tools/github_workflows/build_and_upload_api_docs.sh index c0eaeba7a..0059876f6 100755 --- a/tools/github_workflows/build_and_upload_api_docs.sh +++ b/tools/github_workflows/build_and_upload_api_docs.sh @@ -38,11 +38,11 @@ validate_parameter() { fi } -# Build documentation of aster-frame +# Build documentation of ostd build_api_docs() { cd "${ASTER_SRC_DIR}" make install_osdk - cd "${ASTER_SRC_DIR}/framework/aster-frame" + cd "${ASTER_SRC_DIR}/ostd" cargo osdk doc } @@ -84,7 +84,7 @@ update_nightly_doc() { git checkout --orphan new_branch rm -rf * cp -r ${ASTER_SRC_DIR}/target/x86_64-unknown-none/doc/* ./ - generate_redirect_index_html "https://asterinas.github.io/api-docs-nightly/aster_frame" + generate_redirect_index_html "https://asterinas.github.io/api-docs-nightly/ostd" git add . git commit -am "Update nightly API docs" git branch -D main @@ -100,7 +100,7 @@ update_release_doc() { git rm -rf --ignore-unmatch "${VERSION}" mkdir "${VERSION}" cp -r ${ASTER_SRC_DIR}/target/x86_64-unknown-none/doc/* ${VERSION}/ - generate_redirect_index_html "https://asterinas.github.io/api-docs/${VERSION}/aster_frame" + generate_redirect_index_html "https://asterinas.github.io/api-docs/${VERSION}/ostd" git add . git commit -am "Update API docs to v${VERSION}" GIT_SSH_COMMAND="ssh -i ${SSH_KEY_FILE} -o UserKnownHostsFile=${KNOWN_HOSTS_FILE}" git push -f origin main