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
AstranciA
axmm_crates
Commits
f790642c
Commit
f790642c
authored
1 month ago
by
LEOibyug
Browse files
Options
Download
Patches
Plain Diff
busybox fix
parent
d40df2ee
main
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
memory_set/src/area.rs
+3
-2
memory_set/src/area.rs
memory_set/src/set.rs
+2
-1
memory_set/src/set.rs
memory_set/src/tests.rs
+9
-2
memory_set/src/tests.rs
with
14 additions
and
5 deletions
+14
-5
memory_set/src/area.rs
+
3
−
2
View file @
f790642c
...
...
@@ -98,10 +98,11 @@ impl<B: MappingBackend> MemoryArea<B> {
}
/// Maps the whole memory area in the page table.
pub
fn
map_area
(
&
mut
self
,
page_table
:
&
mut
B
::
PageTable
)
->
MappingResult
{
pub
fn
map_area
(
&
mut
self
,
page_table
:
&
mut
B
::
PageTable
,
flags
:
Option
<
B
::
Flags
>
)
->
MappingResult
{
let
flag
=
flags
.unwrap_or
(
self
.flags
);
let
frame_refs
=
self
.backend
.map
(
self
.start
(),
self
.size
(),
self
.
flag
s
,
page_table
)
.map
(
self
.start
(),
self
.size
(),
flag
,
page_table
)
.or
(
Err
(
MappingError
::
BadState
))
?
;
#[cfg(feature
=
"RAII"
)]
self
.frames
.extend
(
frame_refs
);
...
...
This diff is collapsed.
Click to expand it.
memory_set/src/set.rs
+
2
−
1
View file @
f790642c
...
...
@@ -120,6 +120,7 @@ impl<B: MappingBackend> MemorySet<B> {
mut
area
:
MemoryArea
<
B
>
,
page_table
:
&
mut
B
::
PageTable
,
unmap_overlap
:
bool
,
flags
:
Option
<
B
::
Flags
>
,
)
->
MappingResult
{
if
area
.va_range
()
.is_empty
()
{
return
Err
(
MappingError
::
InvalidParam
);
...
...
@@ -133,7 +134,7 @@ impl<B: MappingBackend> MemorySet<B> {
}
}
area
.map_area
(
page_table
)
?
;
area
.map_area
(
page_table
,
flags
)
?
;
assert!
(
self
.areas
.insert
(
area
.start
(),
area
)
.is_none
());
Ok
(())
}
...
...
This diff is collapsed.
Click to expand it.
memory_set/src/tests.rs
+
9
−
2
View file @
f790642c
...
...
@@ -91,6 +91,7 @@ fn test_map_unmap() {
MemoryArea
::
new
(
start
.into
(),
0x1000
,
1
,
MockBackend
),
&
mut
pt
,
false
,
None
));
}
// Map [0x1000, 0x2000), [0x3000, 0x4000), [0x5000, 0x6000), ...
...
...
@@ -99,6 +100,7 @@ fn test_map_unmap() {
MemoryArea
::
new
(
start
.into
(),
0x1000
,
2
,
MockBackend
),
&
mut
pt
,
false
,
None
));
}
dump_memory_set
(
&
set
);
...
...
@@ -119,7 +121,8 @@ fn test_map_unmap() {
set
.map
(
MemoryArea
::
new
(
0x4000
.into
(),
0x4000
,
3
,
MockBackend
),
&
mut
pt
,
false
false
,
None
),
AlreadyExists
);
...
...
@@ -127,7 +130,8 @@ fn test_map_unmap() {
assert_ok!
(
set
.map
(
MemoryArea
::
new
(
0x4000
.into
(),
0x4000
,
3
,
MockBackend
),
&
mut
pt
,
true
true
,
None
));
dump_memory_set
(
&
set
);
assert_eq!
(
set
.len
(),
13
);
...
...
@@ -163,6 +167,7 @@ fn test_unmap_split() {
MemoryArea
::
new
(
start
.into
(),
0x1000
,
1
,
MockBackend
),
&
mut
pt
,
false
,
None
));
}
assert_eq!
(
set
.len
(),
8
);
...
...
@@ -249,6 +254,7 @@ fn test_protect() {
MemoryArea
::
new
(
start
.into
(),
0x1000
,
0x7
,
MockBackend
),
&
mut
pt
,
false
,
None
));
}
assert_eq!
(
set
.len
(),
8
);
...
...
@@ -338,6 +344,7 @@ fn test_find_free_area() {
MemoryArea
::
new
(
start
.into
(),
0x1000
,
1
,
MockBackend
),
&
mut
pt
,
false
,
None
));
}
...
...
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