Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bootloader
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
bootloader
Commits
ef998629
Commit
ef998629
authored
2 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Framebuffer mapping for aarch64
parent
050f5eb5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/arch/aarch64.rs
+48
-2
48 additions, 2 deletions
src/arch/aarch64.rs
with
48 additions
and
2 deletions
src/arch/aarch64.rs
+
48
−
2
View file @
ef998629
...
...
@@ -91,6 +91,52 @@ pub unsafe fn paging_framebuffer<
D
:
Disk
,
V
:
Iterator
<
Item
=
OsVideoMode
>
>
(
os
:
&
mut
dyn
Os
<
D
,
V
>
,
page_phys
:
usize
,
framebuffer_phys
:
u64
,
framebuffer_size
:
u64
)
->
Option
<
()
>
{
log
::
error!
(
"paging_framebuffer not implemented for aarch64"
);
None
//TODO: smarter test for framebuffer already mapped
if
framebuffer_phys
+
framebuffer_size
<=
0x2_0000_0000
{
return
Some
(());
}
let
l0_i
=
((
framebuffer_phys
/
0x80_0000_0000
)
+
256
)
as
usize
;
let
mut
l1_i
=
((
framebuffer_phys
%
0x80_0000_0000
)
/
0x4000_0000
)
as
usize
;
let
mut
l2_i
=
((
framebuffer_phys
%
0x4000_0000
)
/
0x20_0000
)
as
usize
;
assert_eq!
(
framebuffer_phys
%
0x20_0000
,
0
);
let
l0
=
slice
::
from_raw_parts_mut
(
page_phys
as
*
mut
u64
,
PAGE_ENTRIES
);
// Create l1 for framebuffer mapping
let
l1
=
if
l0
[
l0_i
]
==
0
{
let
l1
=
paging_allocate
(
os
)
?
;
l0
[
l0_i
]
=
l1
.as_ptr
()
as
u64
|
1
<<
10
|
1
<<
1
|
1
;
l1
}
else
{
slice
::
from_raw_parts_mut
(
(
l0
[
l0_i
]
&
ENTRY_ADDRESS_MASK
)
as
*
mut
u64
,
PAGE_ENTRIES
)
};
// Map framebuffer_size at framebuffer offset
let
mut
framebuffer_mapped
=
0
;
while
framebuffer_mapped
<
framebuffer_size
&&
l1_i
<
l1
.len
()
{
let
l2
=
paging_allocate
(
os
)
?
;
assert_eq!
(
l1
[
l1_i
],
0
);
l1
[
l1_i
]
=
l2
.as_ptr
()
as
u64
|
1
<<
10
|
1
<<
1
|
1
;
while
framebuffer_mapped
<
framebuffer_size
&&
l2_i
<
l2
.len
()
{
let
addr
=
framebuffer_phys
+
framebuffer_mapped
;
assert_eq!
(
l2
[
l2_i
],
0
);
l2
[
l2_i
]
=
addr
|
1
<<
10
|
1
;
framebuffer_mapped
+=
0x20_0000
;
l2_i
+=
1
;
}
l1_i
+=
1
;
l2_i
=
0
;
}
assert!
(
framebuffer_mapped
>=
framebuffer_size
);
Some
(())
}
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