Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
drivers
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Liam Naddell
drivers
Commits
8a52c84f
Commit
8a52c84f
authored
Jun 19, 2018
by
Jeremy Soller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to new alloc API
parent
63b5755a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
vesad/src/display.rs
vesad/src/display.rs
+3
-4
vesad/src/main.rs
vesad/src/main.rs
+0
-2
No files found.
vesad/src/display.rs
View file @
8a52c84f
#[cfg(feature=
"rusttype"
)]
extern
crate
rusttype
;
use
alloc
::
allocator
::{
Alloc
,
Layout
};
use
alloc
::
heap
::
Global
;
use
std
::
alloc
::{
Alloc
,
Global
,
Layout
};
use
std
::{
cmp
,
slice
};
use
std
::
ptr
::
NonNull
;
...
...
@@ -108,7 +107,7 @@ impl Display {
let
onscreen
=
self
.onscreen
.as_mut_ptr
();
self
.onscreen
=
unsafe
{
slice
::
from_raw_parts_mut
(
onscreen
,
size
)
};
unsafe
{
Global
.dealloc
(
NonNull
::
new_unchecked
(
self
.offscreen
.as_mut_ptr
()
as
*
mut
u8
)
.as_opaque
()
,
Layout
::
from_size_align_unchecked
(
self
.offscreen
.len
()
*
4
,
4096
))
};
unsafe
{
Global
.dealloc
(
NonNull
::
new_unchecked
(
self
.offscreen
.as_mut_ptr
()
as
*
mut
u8
),
Layout
::
from_size_align_unchecked
(
self
.offscreen
.len
()
*
4
,
4096
))
};
self
.offscreen
=
unsafe
{
slice
::
from_raw_parts_mut
(
offscreen
as
*
mut
u32
,
size
)
};
}
else
{
println!
(
"Display is already {}, {}"
,
width
,
height
);
...
...
@@ -277,6 +276,6 @@ impl Display {
impl
Drop
for
Display
{
fn
drop
(
&
mut
self
)
{
unsafe
{
Global
.dealloc
(
NonNull
::
new_unchecked
(
self
.offscreen
.as_mut_ptr
()
as
*
mut
u8
)
.as_opaque
()
,
Layout
::
from_size_align_unchecked
(
self
.offscreen
.len
()
*
4
,
4096
))
};
unsafe
{
Global
.dealloc
(
NonNull
::
new_unchecked
(
self
.offscreen
.as_mut_ptr
()
as
*
mut
u8
),
Layout
::
from_size_align_unchecked
(
self
.offscreen
.len
()
*
4
,
4096
))
};
}
}
vesad/src/main.rs
View file @
8a52c84f
#![deny(warnings)]
#![feature(alloc)]
#![feature(allocator_api)]
#![feature(asm)]
extern
crate
alloc
;
extern
crate
orbclient
;
extern
crate
syscall
;
...
...
Write
Preview
Markdown
is supported
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