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
c3f38be7
Commit
c3f38be7
authored
8 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Use core intrinsics instead of memset
parent
99a15e79
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
context/memory.rs
+7
-3
7 additions, 3 deletions
context/memory.rs
with
7 additions
and
3 deletions
context/memory.rs
+
7
−
3
View file @
c3f38be7
use
alloc
::
arc
::{
Arc
,
Weak
};
use
alloc
::
arc
::{
Arc
,
Weak
};
use
collections
::
VecDeque
;
use
collections
::
VecDeque
;
use
core
::
intrinsics
;
use
spin
::
Mutex
;
use
spin
::
Mutex
;
use
arch
::
externs
::
memset
;
use
arch
::
memory
::
Frame
;
use
arch
::
memory
::
Frame
;
use
arch
::
paging
::{
ActivePageTable
,
InactivePageTable
,
Page
,
PageIter
,
PhysicalAddress
,
VirtualAddress
};
use
arch
::
paging
::{
ActivePageTable
,
InactivePageTable
,
Page
,
PageIter
,
PhysicalAddress
,
VirtualAddress
};
use
arch
::
paging
::
entry
::{
self
,
EntryFlags
};
use
arch
::
paging
::
entry
::{
self
,
EntryFlags
};
...
@@ -202,7 +202,9 @@ impl Memory {
...
@@ -202,7 +202,9 @@ impl Memory {
if
clear
{
if
clear
{
assert!
(
flush
&&
self
.flags
.contains
(
entry
::
WRITABLE
));
assert!
(
flush
&&
self
.flags
.contains
(
entry
::
WRITABLE
));
unsafe
{
memset
(
self
.start_address
()
.get
()
as
*
mut
u8
,
0
,
self
.size
);
}
unsafe
{
intrinsics
::
write_bytes
(
self
.start_address
()
.get
()
as
*
mut
u8
,
0
,
self
.size
);
}
}
}
}
}
...
@@ -300,7 +302,9 @@ impl Memory {
...
@@ -300,7 +302,9 @@ impl Memory {
if
clear
{
if
clear
{
assert!
(
flush
);
assert!
(
flush
);
unsafe
{
memset
((
self
.start
.get
()
+
self
.size
)
as
*
mut
u8
,
0
,
new_size
-
self
.size
);
}
unsafe
{
intrinsics
::
write_bytes
((
self
.start
.get
()
+
self
.size
)
as
*
mut
u8
,
0
,
new_size
-
self
.size
);
}
}
}
}
else
if
new_size
<
self
.size
{
}
else
if
new_size
<
self
.size
{
let
mut
flush_all
=
false
;
let
mut
flush_all
=
false
;
...
...
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