Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
John Hodge
rust_os
Commits
4c91cbd4
Commit
4c91cbd4
authored
Sep 26, 2018
by
John Hodge
Browse files
Kernel Core - Wrap text in panic rendering
parent
8b9eaa8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Kernel/Core/metadevs/video/mod.rs
View file @
4c91cbd4
...
...
@@ -127,8 +127,8 @@ pub fn set_panic(file: &str, line: usize, message: &::core::fmt::Arguments)
}
}
// 3. Render message to top-left
let
_
=
write!
(
&
mut
PanicWriter
::
new
(
&
mut
*
surf
.fb
,
0
,
0
),
"Panic at {}:{}"
,
file
,
line
);
let
_
=
write!
(
&
mut
PanicWriter
::
new
(
&
mut
*
surf
.fb
,
0
,
16
),
"- {}"
,
message
);
let
_
=
write!
(
&
mut
PanicWriter
::
new
(
&
mut
*
surf
.fb
,
0
,
0
,
dims
.w
as
u16
),
"Panic at {}:{}"
,
file
,
line
);
let
_
=
write!
(
&
mut
PanicWriter
::
new
(
&
mut
*
surf
.fb
,
0
,
16
,
dims
.w
as
u16
),
"- {}"
,
message
);
}
return
;
...
...
@@ -151,12 +151,12 @@ pub fn set_panic(file: &str, line: usize, message: &::core::fmt::Arguments)
}
}
impl
<
'a
>
PanicWriter
<
'a
>
{
fn
new
<
'b
>
(
fb
:
&
'b
mut
Framebuffer
,
x
:
u16
,
y
:
u16
)
->
PanicWriter
<
'b
>
{
fn
new
<
'b
>
(
fb
:
&
'b
mut
Framebuffer
,
x
:
u16
,
y
:
u16
,
w
:
u16
)
->
PanicWriter
<
'b
>
{
PanicWriter
{
font
:
kernel_font
::
KernelFont
::
new
(
PANIC_COLOUR
),
out
:
PanicWriterOut
{
fb
:
fb
,
x
:
x
,
y
:
y
,
x
:
x
,
y
:
y
,
w
:
w
,
},
}
}
...
...
@@ -168,13 +168,17 @@ pub fn set_panic(file: &str, line: usize, message: &::core::fmt::Arguments)
}
struct
PanicWriterOut
<
'a
>
{
fb
:
&
'a
mut
Framebuffer
,
x
:
u16
,
y
:
u16
,
x
:
u16
,
y
:
u16
,
w
:
u16
,
}
impl
<
'a
>
PanicWriterOut
<
'a
>
{
fn
putc
(
&
mut
self
,
data
:
&
[
u32
;
8
*
16
])
{
self
.fb
.blit_buf
(
Rect
::
new
(
self
.x
as
u32
,
self
.y
as
u32
,
8
,
16
),
data
);
self
.x
+=
8
;
if
self
.x
==
self
.w
{
self
.y
+=
16
;
self
.x
=
0
;
}
}
}
}
...
...
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