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
dfcf5be7
Commit
dfcf5be7
authored
4 years ago
by
Aaron Janse
Browse files
Options
Downloads
Patches
Plain Diff
use logging instead of println
parent
0590a71b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!149
Use logging instead of println in src/lib.rs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+8
-6
8 additions, 6 deletions
src/lib.rs
with
8 additions
and
6 deletions
src/lib.rs
+
8
−
6
View file @
dfcf5be7
...
@@ -83,6 +83,8 @@ pub mod common;
...
@@ -83,6 +83,8 @@ pub mod common;
pub
mod
arch
;
pub
mod
arch
;
pub
use
crate
::
arch
::
*
;
pub
use
crate
::
arch
::
*
;
use
crate
::
log
::
info
;
/// Constants like memory locations
/// Constants like memory locations
pub
mod
consts
;
pub
mod
consts
;
...
@@ -201,8 +203,8 @@ pub fn kmain(cpus: usize, env: &'static [u8]) -> ! {
...
@@ -201,8 +203,8 @@ pub fn kmain(cpus: usize, env: &'static [u8]) -> ! {
context
::
init
();
context
::
init
();
let
pid
=
syscall
::
getpid
();
let
pid
=
syscall
::
getpid
();
println
!
(
"BSP: {:?} {}"
,
pid
,
cpus
);
info
!
(
"BSP: {:?} {}"
,
pid
,
cpus
);
println
!
(
"Env: {:?}"
,
::
core
::
str
::
from_utf8
(
env
));
info
!
(
"Env: {:?}"
,
::
core
::
str
::
from_utf8
(
env
));
match
context
::
contexts_mut
()
.spawn
(
userspace_init
)
{
match
context
::
contexts_mut
()
.spawn
(
userspace_init
)
{
Ok
(
context_lock
)
=>
{
Ok
(
context_lock
)
=>
{
...
@@ -238,7 +240,7 @@ pub fn kmain_ap(id: usize) -> ! {
...
@@ -238,7 +240,7 @@ pub fn kmain_ap(id: usize) -> ! {
context
::
init
();
context
::
init
();
let
pid
=
syscall
::
getpid
();
let
pid
=
syscall
::
getpid
();
println
!
(
"AP {}: {:?}"
,
id
,
pid
);
info
!
(
"AP {}: {:?}"
,
id
,
pid
);
loop
{
loop
{
unsafe
{
unsafe
{
...
@@ -252,7 +254,7 @@ pub fn kmain_ap(id: usize) -> ! {
...
@@ -252,7 +254,7 @@ pub fn kmain_ap(id: usize) -> ! {
}
}
}
}
}
else
{
}
else
{
println
!
(
"AP {}: Disabled"
,
id
);
info
!
(
"AP {}: Disabled"
,
id
);
loop
{
loop
{
unsafe
{
unsafe
{
...
@@ -266,12 +268,12 @@ pub fn kmain_ap(id: usize) -> ! {
...
@@ -266,12 +268,12 @@ pub fn kmain_ap(id: usize) -> ! {
/// Allow exception handlers to send signal to arch-independant kernel
/// Allow exception handlers to send signal to arch-independant kernel
#[no_mangle]
#[no_mangle]
pub
extern
fn
ksignal
(
signal
:
usize
)
{
pub
extern
fn
ksignal
(
signal
:
usize
)
{
println
!
(
"SIGNAL {}, CPU {}, PID {:?}"
,
signal
,
cpu_id
(),
context
::
context_id
());
info
!
(
"SIGNAL {}, CPU {}, PID {:?}"
,
signal
,
cpu_id
(),
context
::
context_id
());
{
{
let
contexts
=
context
::
contexts
();
let
contexts
=
context
::
contexts
();
if
let
Some
(
context_lock
)
=
contexts
.current
()
{
if
let
Some
(
context_lock
)
=
contexts
.current
()
{
let
context
=
context_lock
.read
();
let
context
=
context_lock
.read
();
println
!
(
"NAME {}"
,
unsafe
{
::
core
::
str
::
from_utf8_unchecked
(
&
context
.name
.lock
())
});
info
!
(
"NAME {}"
,
unsafe
{
::
core
::
str
::
from_utf8_unchecked
(
&
context
.name
.lock
())
});
}
}
}
}
...
...
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