Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
educg-net-28665-2608131
oskernel2024-9-2160
Commits
9ce31d0c
Commit
9ce31d0c
authored
3 months ago
by
只敲代码不玩耍,聪明baka也变傻ᗜˬᗜ
Browse files
Options
Download
Patches
Plain Diff
feat: remove identity mapping methods from PageNums, as we don't need identity mapping
parent
badacd9d
submit
feat/docs
feat/docs-vendored
feat/ext4-filesystem
feat/ext4-filesystem-vendored
feat/lazy-symbol-table-build
feat/lazy-symbol-table-build-vendored
feat/paging-virtual-memory
feat/paging-virtual-memory-vendored
feat/setup-trap-control-flow
feat/setup-trap-control-flow-vendored
feat/test-final
feat/test-final-vendored
master
master-vendored
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
crates/address/src/physical_page_num.rs
+0
-14
crates/address/src/physical_page_num.rs
crates/address/src/physical_page_num_range.rs
+0
-9
crates/address/src/physical_page_num_range.rs
crates/address/src/virtual_page_num.rs
+0
-6
crates/address/src/virtual_page_num.rs
crates/address/src/virtual_page_num_range.rs
+0
-9
crates/address/src/virtual_page_num_range.rs
with
0 additions
and
38 deletions
+0
-38
crates/address/src/physical_page_num.rs
+
0
−
14
View file @
9ce31d0c
...
...
@@ -8,12 +8,6 @@ pub struct PhysicalPageNum(pub usize);
impl_IPageNum!
(
PhysicalPageNum
);
impl
PhysicalPageNum
{
pub
fn
identity_mapped
(
self
)
->
VirtualPageNum
{
VirtualPageNum
::
from_usize
(
self
.as_usize
())
}
}
#[cfg(test)]
mod
physical_page_num_tests
{
use
super
::
*
;
...
...
@@ -25,14 +19,6 @@ mod physical_page_num_tests {
assert_eq!
(
page_num
.as_usize
(),
5
);
}
// Identity mapping 测试
#[test]
fn
test_identity_mapped
()
{
let
phys_page
=
PhysicalPageNum
::
from_usize
(
0x1000
);
let
virt_page
=
phys_page
.identity_mapped
();
assert_eq!
(
phys_page
.as_usize
(),
virt_page
.as_usize
());
}
// 运算符测试
#[test]
fn
test_arithmetic_operations
()
{
...
...
This diff is collapsed.
Click to expand it.
crates/address/src/physical_page_num_range.rs
+
0
−
9
View file @
9ce31d0c
...
...
@@ -3,12 +3,3 @@ use crate::*;
pub
type
PhysicalPageNumRange
=
PageNumRange
<
PhysicalPageNum
>
;
impl_range_display!
(
PhysicalPageNumRange
);
impl
PhysicalPageNumRange
{
pub
fn
identity_mapped
(
&
self
)
->
VirtualPageNumRange
{
VirtualPageNumRange
::
from_start_end
(
self
.start
()
.identity_mapped
(),
self
.end
()
.identity_mapped
(),
)
}
}
This diff is collapsed.
Click to expand it.
crates/address/src/virtual_page_num.rs
+
0
−
6
View file @
9ce31d0c
...
...
@@ -8,10 +8,4 @@ pub struct VirtualPageNum(pub usize);
impl_IPageNum!
(
VirtualPageNum
);
impl
VirtualPageNum
{
pub
fn
identity_mapped
(
self
)
->
PhysicalPageNum
{
PhysicalPageNum
::
from_usize
(
self
.as_usize
())
}
}
// No need to test VirtualPageNum, as they share the same code as PhysicalPageNum
This diff is collapsed.
Click to expand it.
crates/address/src/virtual_page_num_range.rs
+
0
−
9
View file @
9ce31d0c
...
...
@@ -3,12 +3,3 @@ use crate::*;
pub
type
VirtualPageNumRange
=
PageNumRange
<
VirtualPageNum
>
;
impl_range_display!
(
VirtualPageNumRange
);
impl
VirtualPageNumRange
{
pub
fn
identity_mapped
(
&
self
)
->
PhysicalPageNumRange
{
PhysicalPageNumRange
::
from_start_end
(
self
.start
()
.identity_mapped
(),
self
.end
()
.identity_mapped
(),
)
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets