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
1b2a28a4
Verified
Commit
1b2a28a4
authored
3 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Use FRAMEBUFFER variables for graphical debug
parent
413238a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/arch/x86_64/graphical_debug/mod.rs
+27
-12
27 additions, 12 deletions
src/arch/x86_64/graphical_debug/mod.rs
src/arch/x86_64/graphical_debug/mode_info.rs
+0
-37
0 additions, 37 deletions
src/arch/x86_64/graphical_debug/mode_info.rs
src/arch/x86_64/start.rs
+5
-2
5 additions, 2 deletions
src/arch/x86_64/start.rs
with
32 additions
and
51 deletions
src/arch/x86_64/graphical_debug/mod.rs
+
27
−
12
View file @
1b2a28a4
use
core
::
str
;
use
spin
::
Mutex
;
use
crate
::
memory
::
Frame
;
...
...
@@ -7,31 +8,45 @@ use crate::paging::mapper::PageFlushAll;
pub
use
self
::
debug
::
DebugDisplay
;
use
self
::
display
::
Display
;
use
self
::
mode_info
::
VBEModeInfo
;
use
self
::
primitive
::
fast_set64
;
pub
mod
debug
;
pub
mod
display
;
pub
mod
mode_info
;
pub
mod
primitive
;
pub
static
FONT
:
&
'static
[
u8
]
=
include_bytes!
(
"../../../../res/unifont.font"
);
pub
static
DEBUG_DISPLAY
:
Mutex
<
Option
<
DebugDisplay
>>
=
Mutex
::
new
(
None
);
pub
fn
init
(
active_table
:
&
mut
ActivePageTable
)
{
pub
fn
init
(
active_table
:
&
mut
ActivePageTable
,
env
:
&
[
u8
]
)
{
println!
(
"Starting graphical debug"
);
let
width
;
let
height
;
let
physbaseptr
;
let
mut
width
=
0
;
let
mut
height
=
0
;
let
mut
physbaseptr
=
0
;
{
let
mode_info_addr
=
0x5200
+
crate
::
PHYS_OFFSET
;
let
mode_info
=
unsafe
{
&*
(
mode_info_addr
as
*
const
VBEModeInfo
)
};
width
=
mode_info
.xresolution
as
usize
;
height
=
mode_info
.yresolution
as
usize
;
physbaseptr
=
mode_info
.physbaseptr
as
usize
;
//TODO: should errors be reported?
for
line
in
str
::
from_utf8
(
env
)
.unwrap_or
(
""
)
.lines
()
{
let
mut
parts
=
line
.splitn
(
2
,
'='
);
let
name
=
parts
.next
()
.unwrap_or
(
""
);
let
value
=
parts
.next
()
.unwrap_or
(
""
);
if
name
==
"FRAMEBUFFER_ADDR"
{
physbaseptr
=
usize
::
from_str_radix
(
value
,
16
)
.unwrap_or
(
0
);
}
if
name
==
"FRAMEBUFFER_WIDTH"
{
width
=
usize
::
from_str_radix
(
value
,
16
)
.unwrap_or
(
0
);
}
if
name
==
"FRAMEBUFFER_HEIGHT"
{
height
=
usize
::
from_str_radix
(
value
,
16
)
.unwrap_or
(
0
);
}
}
if
physbaseptr
==
0
||
width
==
0
||
height
==
0
{
println!
(
"Framebuffer not found"
);
return
;
}
println!
(
"Framebuffer {}x{} at {:X}"
,
width
,
height
,
physbaseptr
);
...
...
This diff is collapsed.
Click to expand it.
src/arch/x86_64/graphical_debug/mode_info.rs
deleted
100644 → 0
+
0
−
37
View file @
413238a0
/// The info of the VBE mode
#[derive(Copy,
Clone,
Default,
Debug)]
#[repr(packed)]
pub
struct
VBEModeInfo
{
attributes
:
u16
,
win_a
:
u8
,
win_b
:
u8
,
granularity
:
u16
,
winsize
:
u16
,
segment_a
:
u16
,
segment_b
:
u16
,
winfuncptr
:
u32
,
bytesperscanline
:
u16
,
pub
xresolution
:
u16
,
pub
yresolution
:
u16
,
xcharsize
:
u8
,
ycharsize
:
u8
,
numberofplanes
:
u8
,
bitsperpixel
:
u8
,
numberofbanks
:
u8
,
memorymodel
:
u8
,
banksize
:
u8
,
numberofimagepages
:
u8
,
unused
:
u8
,
redmasksize
:
u8
,
redfieldposition
:
u8
,
greenmasksize
:
u8
,
greenfieldposition
:
u8
,
bluemasksize
:
u8
,
bluefieldposition
:
u8
,
rsvdmasksize
:
u8
,
rsvdfieldposition
:
u8
,
directcolormodeinfo
:
u8
,
pub
physbaseptr
:
u32
,
offscreenmemoryoffset
:
u32
,
offscreenmemsize
:
u16
,
}
This diff is collapsed.
Click to expand it.
src/arch/x86_64/start.rs
+
5
−
2
View file @
1b2a28a4
...
...
@@ -149,9 +149,12 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
// Activate memory logging
log
::
init
();
// Convert env to slice
let
env
=
slice
::
from_raw_parts
((
env_base
+
crate
::
PHYS_OFFSET
)
as
*
const
u8
,
env_size
);
// Use graphical debug
#[cfg(feature=
"graphical_debug"
)]
graphical_debug
::
init
(
&
mut
active_table
);
graphical_debug
::
init
(
&
mut
active_table
,
env
);
#[cfg(feature
=
"system76_ec_debug"
)]
device
::
system76_ec
::
init
();
...
...
@@ -175,7 +178,7 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
BSP_READY
.store
(
true
,
Ordering
::
SeqCst
);
slice
::
from_raw_parts
((
env_base
+
crate
::
PHYS_OFFSET
)
as
*
const
u8
,
env_size
)
env
};
crate
::
kmain
(
CPU_COUNT
.load
(
Ordering
::
SeqCst
),
env
);
...
...
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