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
c06f403d
Commit
c06f403d
authored
6 years ago
by
Liam Naddell
Browse files
Options
Downloads
Patches
Plain Diff
second round of documentation
parent
9d1fb301
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!95
Add more documentation to the redox kernel
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/context/mod.rs
+2
-0
2 additions, 0 deletions
src/context/mod.rs
src/syscall/mod.rs
+5
-0
5 additions, 0 deletions
src/syscall/mod.rs
src/syscall/time.rs
+2
-0
2 additions, 0 deletions
src/syscall/time.rs
with
9 additions
and
0 deletions
src/context/mod.rs
+
2
−
0
View file @
c06f403d
...
@@ -70,6 +70,8 @@ fn init_contexts() -> RwLock<ContextList> {
...
@@ -70,6 +70,8 @@ fn init_contexts() -> RwLock<ContextList> {
/// Get the global schemes list, const
/// Get the global schemes list, const
pub
fn
contexts
()
->
RwLockReadGuard
<
'static
,
ContextList
>
{
pub
fn
contexts
()
->
RwLockReadGuard
<
'static
,
ContextList
>
{
//call once will init_contexts only once during the kernel's exececution, otherwise it will return the current context via a
//cache.
CONTEXTS
.call_once
(
init_contexts
)
.read
()
CONTEXTS
.call_once
(
init_contexts
)
.read
()
}
}
...
...
This diff is collapsed.
Click to expand it.
src/syscall/mod.rs
+
5
−
0
View file @
c06f403d
...
@@ -170,6 +170,11 @@ pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, bp: u
...
@@ -170,6 +170,11 @@ pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, bp: u
}
}
*/
*/
// The next lines set the current syscall in the context struct, then once the inner() function
// completes, we set the current syscall to none.
//
// When the code below falls out of scope it will release the lock
// see the spin crate for details
{
{
let
contexts
=
::
context
::
contexts
();
let
contexts
=
::
context
::
contexts
();
if
let
Some
(
context_lock
)
=
contexts
.current
()
{
if
let
Some
(
context_lock
)
=
contexts
.current
()
{
...
...
This diff is collapsed.
Click to expand it.
src/syscall/time.rs
+
2
−
0
View file @
c06f403d
...
@@ -16,7 +16,9 @@ pub fn clock_gettime(clock: usize, time: &mut TimeSpec) -> Result<usize> {
...
@@ -16,7 +16,9 @@ pub fn clock_gettime(clock: usize, time: &mut TimeSpec) -> Result<usize> {
Ok
(
0
)
Ok
(
0
)
}
}
/// Nanosleep will sleep by switching the current context
pub
fn
nanosleep
(
req
:
&
TimeSpec
,
rem_opt
:
Option
<&
mut
TimeSpec
>
)
->
Result
<
usize
>
{
pub
fn
nanosleep
(
req
:
&
TimeSpec
,
rem_opt
:
Option
<&
mut
TimeSpec
>
)
->
Result
<
usize
>
{
//start is a tuple of (seconds, nanoseconds)
let
start
=
time
::
monotonic
();
let
start
=
time
::
monotonic
();
let
sum
=
start
.1
+
req
.tv_nsec
as
u64
;
let
sum
=
start
.1
+
req
.tv_nsec
as
u64
;
let
end
=
(
start
.0
+
req
.tv_sec
as
u64
+
sum
/
1_000_000_000
,
sum
%
1_000_000_000
);
let
end
=
(
start
.0
+
req
.tv_sec
as
u64
+
sum
/
1_000_000_000
,
sum
%
1_000_000_000
);
...
...
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