Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
kernel
Commits
df145ea0
Verified
Commit
df145ea0
authored
4 years ago
by
Jacob Lorentzon
Browse files
Options
Downloads
Patches
Plain Diff
Utilize linear_phys_to_virt where applicable.
parent
16a31b0c
No related branches found
No related tags found
1 merge request
!187
No more recursive mapping
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/arch/x86_64/paging/mapper.rs
+3
-2
3 additions, 2 deletions
src/arch/x86_64/paging/mapper.rs
src/arch/x86_64/paging/mod.rs
+2
-1
2 additions, 1 deletion
src/arch/x86_64/paging/mod.rs
src/arch/x86_64/paging/table.rs
+3
-2
3 additions, 2 deletions
src/arch/x86_64/paging/table.rs
with
8 additions
and
5 deletions
src/arch/x86_64/paging/mapper.rs
+
3
−
2
View file @
df145ea0
use
crate
::
memory
::{
allocate_frames
,
deallocate_frames
,
Frame
};
use
super
::{
Page
,
PAGE_SIZE
,
PageFlags
,
PhysicalAddress
,
VirtualAddress
};
use
super
::{
linear_phys_to_virt
,
Page
,
PAGE_SIZE
,
PageFlags
,
PhysicalAddress
,
VirtualAddress
};
use
super
::
RmmA
;
use
super
::
table
::{
Table
,
Level4
};
...
...
@@ -37,7 +37,8 @@ impl<'table> Mapper<'table> {
/// must also be valid, and the frame must not outlive the lifetime.
pub
unsafe
fn
from_p4_unchecked
(
frame
:
&
mut
Frame
)
->
Self
{
let
phys
=
frame
.start_address
();
let
virt
=
VirtualAddress
::
new
(
phys
.data
()
+
crate
::
KERNEL_OFFSET
);
let
virt
=
linear_phys_to_virt
(
phys
)
.expect
(
"expected page table frame to fit within linear mapping"
);
Self
{
p4
:
&
mut
*
(
virt
.data
()
as
*
mut
Table
<
Level4
>
),
...
...
This diff is collapsed.
Click to expand it.
src/arch/x86_64/paging/mod.rs
+
2
−
1
View file @
df145ea0
...
...
@@ -310,7 +310,8 @@ impl InactivePageTable {
// case it is outside the pre-mapped physical address range, or if such a range is too
// large to fit the whole physical address space in the virtual address space.
{
let
table
=
VirtualAddress
::
new
(
frame
.start_address
()
.data
()
+
crate
::
KERNEL_OFFSET
);
let
table
=
linear_phys_to_virt
(
frame
.start_address
())
.expect
(
"cannot initialize InactivePageTable (currently) without the frame being linearly mapped"
);
// now we are able to zero the table
// SAFETY: The caller must ensure exclusive access to the pointed-to virtual address of
...
...
This diff is collapsed.
Click to expand it.
src/arch/x86_64/paging/table.rs
+
3
−
2
View file @
df145ea0
...
...
@@ -5,7 +5,7 @@ use core::marker::PhantomData;
use
core
::
ops
::{
Index
,
IndexMut
};
use
crate
::
memory
::
allocate_frames
;
use
crate
::
paging
::
VirtualAddress
;
use
crate
::
paging
::
{
linear_phys_to_virt
,
VirtualAddress
}
;
use
super
::{
ENTRY_COUNT
,
PageFlags
};
use
super
::
entry
::{
Entry
,
EntryFlags
};
...
...
@@ -112,7 +112,8 @@ impl<L> Table<L> where L: HierarchicalLevel {
return
None
;
}
let
next_table_physaddr
=
next_table_frame
.start_address
();
let
next_table_virtaddr
=
VirtualAddress
::
new
(
next_table_physaddr
.data
()
+
crate
::
KERNEL_OFFSET
);
let
next_table_virtaddr
=
linear_phys_to_virt
(
next_table_physaddr
)
.expect
(
"expected page table frame to fit within linear mapping"
);
Some
(
next_table_virtaddr
)
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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