Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
HermitCore
libhermit-rs
Commits
4f533262
Commit
4f533262
authored
Aug 17, 2021
by
Stefan Lankes
Browse files
using AllocError to indicate an allocation failure
parent
1f30129c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/arch/aarch64/mm/physicalmem.rs
View file @
4f533262
...
...
@@ -5,7 +5,7 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
use
core
::
convert
::
TryInto
;
use
core
::
{
alloc
::
AllocError
,
convert
::
TryInto
}
;
use
crate
::
arch
::
aarch64
::
mm
::
paging
::{
BasePageSize
,
PageSize
};
use
crate
::
arch
::
aarch64
::
mm
::{
PhysAddr
,
VirtAddr
};
...
...
@@ -43,7 +43,7 @@ pub fn total_memory_size() -> usize {
pub
fn
init_page_tables
()
{}
pub
fn
allocate
(
size
:
usize
)
->
Result
<
PhysAddr
,
()
>
{
pub
fn
allocate
(
size
:
usize
)
->
Result
<
PhysAddr
,
AllocError
>
{
assert!
(
size
>
0
);
assert_eq!
(
size
%
BasePageSize
::
SIZE
,
...
...
@@ -62,7 +62,7 @@ pub fn allocate(size: usize) -> Result<PhysAddr, ()> {
))
}
pub
fn
allocate_aligned
(
size
:
usize
,
alignment
:
usize
)
->
Result
<
PhysAddr
,
()
>
{
pub
fn
allocate_aligned
(
size
:
usize
,
alignment
:
usize
)
->
Result
<
PhysAddr
,
AllocError
>
{
assert!
(
size
>
0
);
assert!
(
alignment
>
0
);
assert_eq!
(
...
...
src/arch/aarch64/mm/virtualmem.rs
View file @
4f533262
...
...
@@ -5,7 +5,7 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
use
core
::
convert
::
TryInto
;
use
core
::
{
alloc
::
AllocError
,
convert
::
TryInto
}
;
use
crate
::
arch
::
aarch64
::
mm
::
paging
::{
BasePageSize
,
PageSize
};
use
crate
::
arch
::
aarch64
::
mm
::{
PhysAddr
,
VirtAddr
};
...
...
@@ -32,7 +32,7 @@ pub fn init() {
KERNEL_FREE_LIST
.lock
()
.list
.push_back
(
entry
);
}
pub
fn
allocate
(
size
:
usize
)
->
Result
<
VirtAddr
,
()
>
{
pub
fn
allocate
(
size
:
usize
)
->
Result
<
VirtAddr
,
AllocError
>
{
assert!
(
size
>
0
);
assert_eq!
(
size
%
BasePageSize
::
SIZE
,
...
...
@@ -51,7 +51,7 @@ pub fn allocate(size: usize) -> Result<VirtAddr, ()> {
))
}
pub
fn
allocate_aligned
(
size
:
usize
,
alignment
:
usize
)
->
Result
<
VirtAddr
,
()
>
{
pub
fn
allocate_aligned
(
size
:
usize
,
alignment
:
usize
)
->
Result
<
VirtAddr
,
AllocError
>
{
assert!
(
size
>
0
);
assert!
(
alignment
>
0
);
assert_eq!
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment