Skip to content

Commit

Permalink
resolve issue on framebuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbanSeurat committed Jan 26, 2021
1 parent 5bd6f7c commit 9542758
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Binary file modified kernel-high.img
Binary file not shown.
9 changes: 6 additions & 3 deletions mmio/src/console/fb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use core::{ptr, mem};
use crate::{mbox, DMA};
use crate::{debugln, debug};
use core::alloc::{Allocator, Layout};
use cortex_a::asm;

#[derive(Debug)]
pub struct FrameBufferError {}
Expand Down Expand Up @@ -52,9 +53,11 @@ impl FrameBuffer {
#[inline]
pub fn scroll(&self) {
unsafe {
let last_line = self.width * self.height / 2;
let row_size = self.width as usize * 8usize * 4usize;
ptr::copy((self.base_pointer + row_size) as *const u64, self.base_pointer as *mut u64, last_line as usize);
let nb_of_u64 = self.width * self.height / 2;
let row_size = self.width as usize * 8usize * mem::size_of::<u32>();
let last_row = (self.width * self.height) as usize * mem::size_of::<u32>();
ptr::copy((self.base_pointer + row_size) as *const u64, self.base_pointer as *mut u64, nb_of_u64 as usize);
ptr::write_bytes((self.base_pointer + last_row) as *mut u64, 0, row_size / mem::size_of::<u64>());
}
}
}
Expand Down

0 comments on commit 9542758

Please sign in to comment.