-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix project structure, create workspace for two crates
- Loading branch information
Showing
12 changed files
with
73 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
[package] | ||
name = "memory_addr" | ||
version = "0.2.1" | ||
[workspace] | ||
resolver = "2" | ||
|
||
members = [ | ||
"memory_addr", | ||
"memory_set", | ||
] | ||
|
||
[workspace.package] | ||
version = "0.3.0-dev" # dev here to avoid publishing it mistakenly, as `memory_set` is not updated yet | ||
edition = "2021" | ||
authors = ["Yuekai Jia <[email protected]>"] | ||
description = "Wrappers and helper functions for physical and virtual addresses" | ||
authors = ["Yuekai Jia <[email protected]>", "aarkegz <[email protected]>"] | ||
license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPSL-2.0" | ||
homepage = "https://github.com/arceos-org/arceos" | ||
# documentation = "let member have their own documentation links" | ||
repository = "https://github.com/arceos-org/memory_addr" | ||
documentation = "https://docs.rs/memory_addr" | ||
keywords = ["arceos", "address", "virtual-memory"] | ||
# keywords = ["let member have their own keywords"] | ||
categories = ["os", "memory-management", "no-std"] | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,9 @@ | ||
# memory_addr | ||
# `memory_addr` | ||
|
||
[![Crates.io](https://img.shields.io/crates/v/memory_addr)](https://crates.io/crates/memory_addr) | ||
[![Docs.rs](https://docs.rs/memory_addr/badge.svg)](https://docs.rs/memory_addr) | ||
[![CI](https://github.com/arceos-org/memory_addr/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/arceos-org/memory_addr/actions/workflows/ci.yml) | ||
Structures, functions and traits for physical and virtual memory addresses as well as memory mappings. | ||
|
||
Wrappers and helper functions for physical and virtual memory addresses. | ||
See documentations and readmes of the sub-crates for more information. | ||
|
||
## Examples | ||
- `memory_addr`([docs](https://docs.rs/memory_addr)|[crates.io](https://crates.io/crates/memory_addr)|[readme](memory_addr/README.md)): Wrappers and helper functions for physical and virtual memory addresses. | ||
- `memory_set`([docs](https://docs.rs/memory_set)|[crates.io](https://crates.io/crates/memory_set)|[readme](memory_set/README.md)): Data structures and operations for managing memory mappings. | ||
|
||
```rust | ||
use memory_addr::{pa, va, va_range, PhysAddr, VirtAddr, MemoryAddr}; | ||
|
||
let phys_addr = PhysAddr::from(0x12345678); | ||
let virt_addr = VirtAddr::from(0x87654321); | ||
|
||
assert_eq!(phys_addr.align_down(0x1000usize), pa!(0x12345000)); | ||
assert_eq!(phys_addr.align_offset_4k(), 0x678); | ||
assert_eq!(virt_addr.align_up_4k(), va!(0x87655000)); | ||
assert!(!virt_addr.is_aligned_4k()); | ||
assert!(va!(0xabcedf0).is_aligned(16usize)); | ||
|
||
let va_range = va_range!(0x87654000..0x87655000); | ||
assert_eq!(va_range.start, va!(0x87654000)); | ||
assert_eq!(va_range.size(), 0x1000); | ||
assert!(va_range.contains(virt_addr)); | ||
assert!(va_range.contains_range(va_range!(virt_addr..virt_addr + 0x100))); | ||
assert!(!va_range.contains_range(va_range!(virt_addr..virt_addr + 0x1000))); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "memory_addr" | ||
description = "Wrappers and helper functions for physical and virtual addresses" | ||
documentation = "https://docs.rs/memory_addr" | ||
keywords = ["arceos", "address", "virtual-memory"] | ||
|
||
version.workspace = true | ||
edition.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
categories.workspace = true | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# memory_addr | ||
|
||
[![Crates.io](https://img.shields.io/crates/v/memory_addr)](https://crates.io/crates/memory_addr) | ||
[![Docs.rs](https://docs.rs/memory_addr/badge.svg)](https://docs.rs/memory_addr) | ||
[![CI](https://github.com/arceos-org/memory_addr/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/arceos-org/memory_addr/actions/workflows/ci.yml) | ||
|
||
Wrappers and helper functions for physical and virtual memory addresses. | ||
|
||
## Examples | ||
|
||
```rust | ||
use memory_addr::{pa, va, va_range, PhysAddr, VirtAddr, MemoryAddr}; | ||
|
||
let phys_addr = PhysAddr::from(0x12345678); | ||
let virt_addr = VirtAddr::from(0x87654321); | ||
|
||
assert_eq!(phys_addr.align_down(0x1000usize), pa!(0x12345000)); | ||
assert_eq!(phys_addr.align_offset_4k(), 0x678); | ||
assert_eq!(virt_addr.align_up_4k(), va!(0x87655000)); | ||
assert!(!virt_addr.is_aligned_4k()); | ||
assert!(va!(0xabcedf0).is_aligned(16usize)); | ||
|
||
let va_range = va_range!(0x87654000..0x87655000); | ||
assert_eq!(va_range.start, va!(0x87654000)); | ||
assert_eq!(va_range.size(), 0x1000); | ||
assert!(va_range.contains(virt_addr)); | ||
assert!(va_range.contains_range(va_range!(virt_addr..virt_addr + 0x100))); | ||
assert!(!va_range.contains_range(va_range!(virt_addr..virt_addr + 0x1000))); | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
[package] | ||
name = "memory_set" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["Yuekai Jia <[email protected]>"] | ||
description = "Data structures and operations for managing memory mappings" | ||
license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPSL-2.0" | ||
homepage = "https://github.com/arceos-org/arceos" | ||
repository = "https://github.com/arceos-org/memory_set" | ||
documentation = "https://docs.rs/memory_set" | ||
keywords = ["arceos", "virtual-memory", "memory-area", "mmap"] | ||
categories = ["os", "memory-management", "no-std"] | ||
|
||
version.workspace = true | ||
edition.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
categories.workspace = true | ||
|
||
[dependencies] | ||
memory_addr = "0.2" | ||
# todo: update it to local one once it gets adapted to the current version | ||
# memory_addr = { path = "../memory_addr", version = "0.2" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters