Add rustfmt from relibc and apply it with cargo fmt
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use super::Display;
|
||||
|
||||
pub struct DebugDisplay {
|
||||
pub (crate) display: Display,
|
||||
pub(crate) display: Display,
|
||||
x: usize,
|
||||
y: usize,
|
||||
w: usize,
|
||||
@@ -10,8 +10,8 @@ pub struct DebugDisplay {
|
||||
|
||||
impl DebugDisplay {
|
||||
pub fn new(display: Display) -> DebugDisplay {
|
||||
let w = display.width/8;
|
||||
let h = display.height/16;
|
||||
let w = display.width / 8;
|
||||
let h = display.height / 16;
|
||||
DebugDisplay {
|
||||
display,
|
||||
x: 0,
|
||||
@@ -34,18 +34,15 @@ impl DebugDisplay {
|
||||
self.display.scroll(d_y * 16);
|
||||
|
||||
unsafe {
|
||||
self.display.sync(0, 0, self.display.width, self.display.height);
|
||||
self.display
|
||||
.sync(0, 0, self.display.width, self.display.height);
|
||||
}
|
||||
|
||||
self.y = new_y;
|
||||
}
|
||||
|
||||
if c != '\n' {
|
||||
self.display.char(
|
||||
self.x * 8, self.y * 16,
|
||||
c,
|
||||
0xFFFFFF
|
||||
);
|
||||
self.display.char(self.x * 8, self.y * 16, c, 0xFFFFFF);
|
||||
|
||||
unsafe {
|
||||
self.display.sync(self.x * 8, self.y * 16, 8, 16);
|
||||
|
||||
@@ -9,7 +9,7 @@ pub struct Display {
|
||||
pub height: usize,
|
||||
pub stride: usize,
|
||||
pub onscreen: &'static mut [u32],
|
||||
pub offscreen: Option<Box<[u32]>>
|
||||
pub offscreen: Option<Box<[u32]>>,
|
||||
}
|
||||
|
||||
impl Display {
|
||||
@@ -46,7 +46,9 @@ impl Display {
|
||||
let row_data = FONT[font_i + row];
|
||||
for col in 0..8 {
|
||||
if (row_data >> (7 - col)) & 1 == 1 {
|
||||
unsafe { *((dst + col * 4) as *mut u32) = color; }
|
||||
unsafe {
|
||||
*((dst + col * 4) as *mut u32) = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
dst += self.stride * 4;
|
||||
@@ -71,9 +73,7 @@ impl Display {
|
||||
if let Some(offscreen) = &self.offscreen {
|
||||
let mut offset = y * self.stride + x;
|
||||
while h > 0 {
|
||||
self.onscreen[offset..offset+w].copy_from_slice(
|
||||
&offscreen[offset..offset+w]
|
||||
);
|
||||
self.onscreen[offset..offset + w].copy_from_slice(&offscreen[offset..offset + w]);
|
||||
offset += self.stride;
|
||||
h -= 1;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,10 @@ pub fn init(env: &[u8]) {
|
||||
return;
|
||||
}
|
||||
|
||||
println!("Framebuffer {}x{} stride {} at {:X} mapped to {:X}", width, height, stride, phys, virt);
|
||||
println!(
|
||||
"Framebuffer {}x{} stride {} at {:X} mapped to {:X}",
|
||||
width, height, stride, phys, virt
|
||||
);
|
||||
|
||||
{
|
||||
let display = Display::new(width, height, stride, virt as *mut u32);
|
||||
@@ -67,9 +70,8 @@ pub fn init(env: &[u8]) {
|
||||
|
||||
pub fn init_heap() {
|
||||
if let Some(debug_display) = &mut *DEBUG_DISPLAY.lock() {
|
||||
debug_display.display.offscreen = Some(
|
||||
debug_display.display.onscreen.to_vec().into_boxed_slice()
|
||||
);
|
||||
debug_display.display.offscreen =
|
||||
Some(debug_display.display.onscreen.to_vec().into_boxed_slice());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
use core::convert::TryInto;
|
||||
use core::ptr::{addr_of, addr_of_mut};
|
||||
use core::{
|
||||
convert::TryInto,
|
||||
ptr::{addr_of, addr_of_mut},
|
||||
};
|
||||
|
||||
use crate::syscall::io::{Io, Mmio, ReadOnly};
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
use crate::syscall::io::Pio;
|
||||
use crate::syscall::io::{Io, Mmio, ReadOnly};
|
||||
|
||||
bitflags! {
|
||||
/// Interrupt enable flags
|
||||
|
||||
Reference in New Issue
Block a user