1
0
Fork 0
mirror of https://gitlab.com/bztsrc/bootboot.git synced 2023-02-13 20:54:32 -05:00

Merge branch 'improvement/update_unsafe_usages_fix_ld' into 'master'

Improve unsafe usage, fix LD file

See merge request bztsrc/bootboot!11
This commit is contained in:
bzt 2021-05-07 02:10:13 +00:00
commit c4b073b307
4 changed files with 87 additions and 665 deletions

4
.gitignore vendored
View file

@ -12,5 +12,5 @@ images/*
mkbootimg/*.o
mkbootimg/mkbootimg
mykernel-rust/target
mykernel-rust/Cargo.lock
mykernel/rust/target/
mykernel/rust/Cargo.lock

View file

@ -34,6 +34,8 @@ bootboot = 0xffffffffffe00000;
environment = 0xffffffffffe01000;
initstack = 4096;
KERNEL_OFFSET = 0xffffffffffe02000;
PHDRS
{
boot PT_LOAD FILEHDR PHDRS; /* one single loadable segment */

View file

@ -17,45 +17,21 @@ pub const MMAP_FREE: u32 = 1;
pub const MMAP_ACPI: u32 = 2;
pub const MMAP_MMIO: u32 = 3;
pub const INITRD_MAXSIZE: u32 = 16;
pub const BOOTBOOT_MMIO: u64 = 0xfffffffff8000000; /* memory mapped IO virtual address */
pub const BOOTBOOT_FB: u64 = 0xfffffffffc000000; /* frame buffer virtual address */
pub const BOOTBOOT_INFO: u64 = 0xffffffffffe00000; /* bootboot struct virtual address */
pub const BOOTBOOT_ENV: u64 = 0xffffffffffe01000; /* environment string virtual address */
pub const BOOTBOOT_CORE: u64 = 0xffffffffffe02000; /* core loadable segment start */
#[repr(C, packed)]
#[derive(Debug, Copy, Clone)]
pub struct MMapEnt {
pub ptr: u64,
pub size: u64,
}
#[test]
fn bindgen_test_layout_MMapEnt() {
assert_eq!(
::core::mem::size_of::<MMapEnt>(),
16usize,
concat!("Size of: ", stringify!(MMapEnt))
);
assert_eq!(
::core::mem::align_of::<MMapEnt>(),
1usize,
concat!("Alignment of ", stringify!(MMapEnt))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<MMapEnt>())).ptr as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MMapEnt),
"::",
stringify!(ptr)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<MMapEnt>())).size as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MMapEnt),
"::",
stringify!(size)
)
);
}
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub struct BOOTBOOT {
@ -74,19 +50,22 @@ pub struct BOOTBOOT {
pub fb_width: u32,
pub fb_height: u32,
pub fb_scanline: u32,
pub arch: BOOTBOOT__bindgen_ty_1,
pub arch: arch_union,
pub mmap: MMapEnt,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union BOOTBOOT__bindgen_ty_1 {
pub x86_64: BOOTBOOT__bindgen_ty_1__bindgen_ty_1,
pub aarch64: BOOTBOOT__bindgen_ty_1__bindgen_ty_2,
pub union arch_union {
pub x86_64: arch_x86,
pub aarch64: arch_aarch64,
_bindgen_union_align: [u64; 8usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BOOTBOOT__bindgen_ty_1__bindgen_ty_1 {
pub struct arch_x86 {
pub acpi_ptr: u64,
pub smbi_ptr: u64,
pub efi_ptr: u64,
@ -96,132 +75,11 @@ pub struct BOOTBOOT__bindgen_ty_1__bindgen_ty_1 {
pub unused2: u64,
pub unused3: u64,
}
#[test]
fn bindgen_test_layout_BOOTBOOT__bindgen_ty_1__bindgen_ty_1() {
assert_eq!(
::core::mem::size_of::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>(),
64usize,
concat!(
"Size of: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>(),
8usize,
concat!(
"Alignment of ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>())).acpi_ptr as *const _
as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(acpi_ptr)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>())).smbi_ptr as *const _
as usize
},
8usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(smbi_ptr)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>())).efi_ptr as *const _
as usize
},
16usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(efi_ptr)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>())).mp_ptr as *const _
as usize
},
24usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(mp_ptr)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>())).unused0 as *const _
as usize
},
32usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(unused0)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>())).unused1 as *const _
as usize
},
40usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(unused1)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>())).unused2 as *const _
as usize
},
48usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(unused2)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_1>())).unused3 as *const _
as usize
},
56usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(unused3)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BOOTBOOT__bindgen_ty_1__bindgen_ty_2 {
pub struct arch_aarch64 {
pub acpi_ptr: u64,
pub mmio_ptr: u64,
pub efi_ptr: u64,
@ -231,354 +89,7 @@ pub struct BOOTBOOT__bindgen_ty_1__bindgen_ty_2 {
pub unused3: u64,
pub unused4: u64,
}
#[test]
fn bindgen_test_layout_BOOTBOOT__bindgen_ty_1__bindgen_ty_2() {
assert_eq!(
::core::mem::size_of::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>(),
64usize,
concat!(
"Size of: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2)
)
);
assert_eq!(
::core::mem::align_of::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>(),
8usize,
concat!(
"Alignment of ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>())).acpi_ptr as *const _
as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(acpi_ptr)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>())).mmio_ptr as *const _
as usize
},
8usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(mmio_ptr)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>())).efi_ptr as *const _
as usize
},
16usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(efi_ptr)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>())).unused0 as *const _
as usize
},
24usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(unused0)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>())).unused1 as *const _
as usize
},
32usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(unused1)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>())).unused2 as *const _
as usize
},
40usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(unused2)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>())).unused3 as *const _
as usize
},
48usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(unused3)
)
);
assert_eq!(
unsafe {
&(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1__bindgen_ty_2>())).unused4 as *const _
as usize
},
56usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(unused4)
)
);
}
#[test]
fn bindgen_test_layout_BOOTBOOT__bindgen_ty_1() {
assert_eq!(
::core::mem::size_of::<BOOTBOOT__bindgen_ty_1>(),
64usize,
concat!("Size of: ", stringify!(BOOTBOOT__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<BOOTBOOT__bindgen_ty_1>(),
8usize,
concat!("Alignment of ", stringify!(BOOTBOOT__bindgen_ty_1))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1>())).x86_64 as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1),
"::",
stringify!(x86_64)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT__bindgen_ty_1>())).aarch64 as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT__bindgen_ty_1),
"::",
stringify!(aarch64)
)
);
}
#[test]
fn bindgen_test_layout_BOOTBOOT() {
assert_eq!(
::core::mem::size_of::<BOOTBOOT>(),
144usize,
concat!("Size of: ", stringify!(BOOTBOOT))
);
assert_eq!(
::core::mem::align_of::<BOOTBOOT>(),
1usize,
concat!("Alignment of ", stringify!(BOOTBOOT))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).magic as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(magic)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).size as *const _ as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(size)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).protocol as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(protocol)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).fb_type as *const _ as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(fb_type)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).numcores as *const _ as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(numcores)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).bspid as *const _ as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(bspid)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).timezone as *const _ as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(timezone)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).datetime as *const _ as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(datetime)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).initrd_ptr as *const _ as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(initrd_ptr)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).initrd_size as *const _ as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(initrd_size)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).fb_ptr as *const _ as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(fb_ptr)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).fb_size as *const _ as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(fb_size)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).fb_width as *const _ as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(fb_width)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).fb_height as *const _ as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(fb_height)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).fb_scanline as *const _ as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(fb_scanline)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).arch as *const _ as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(arch)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<BOOTBOOT>())).mmap as *const _ as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(BOOTBOOT),
"::",
stringify!(mmap)
)
);
}
extern "C" {
pub static mut bootboot: BOOTBOOT;
}
extern "C" {
pub static mut environment: *mut custom_ctypes::c_uchar;
}
extern "C" {
pub static mut fb: u8;
}
#[doc = " Display text on screen *"]
#[repr(C, packed)]
#[derive(Debug, Copy, Clone)]
@ -593,110 +104,7 @@ pub struct psf2_t {
pub width: u32,
pub glyphs: u8,
}
#[test]
fn bindgen_test_layout_psf2_t() {
assert_eq!(
::core::mem::size_of::<psf2_t>(),
33usize,
concat!("Size of: ", stringify!(psf2_t))
);
assert_eq!(
::core::mem::align_of::<psf2_t>(),
1usize,
concat!("Alignment of ", stringify!(psf2_t))
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).magic as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(magic)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).version as *const _ as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(version)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).headersize as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(headersize)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).flags as *const _ as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(flags)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).numglyph as *const _ as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(numglyph)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).bytesperglyph as *const _ as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(bytesperglyph)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).height as *const _ as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(height)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).width as *const _ as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(width)
)
);
assert_eq!(
unsafe { &(*(::core::ptr::null::<psf2_t>())).glyphs as *const _ as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(psf2_t),
"::",
stringify!(glyphs)
)
);
}
extern "C" {
pub static mut _binary_font_psf_start: custom_ctypes::c_uchar;
pub static mut _binary_font_psf_start: u64;
}
pub mod custom_ctypes { pub type c_int = i64; pub type c_uchar = u64; }

View file

@ -49,54 +49,59 @@ extern crate rlibc;
#[no_mangle] // don't mangle the name of this function
fn _start() -> ! {
/*** NOTE: this code runs on all cores in parallel ***/
unsafe {
if bootboot::bootboot.fb_scanline > 0 {
let fb = &bootboot::fb as *const u8 as u64;
use bootboot::*;
// cross-hair to see screen dimension detected correctly
for y in 0..bootboot::bootboot.fb_height {
let addr = fb
+ bootboot::bootboot.fb_scanline as u64 * y as u64
+ bootboot::bootboot.fb_width as u64 * 2;
*(addr as *mut u64) = 0x00FFFFFF;
}
for x in 0..bootboot::bootboot.fb_width {
let addr = fb
+ bootboot::bootboot.fb_scanline as u64 * (bootboot::bootboot.fb_height / 2) as u64 + (x * 4) as u64;
*(addr as *mut u64) = 0x00FFFFFF;
}
//Lets use the BOOTBOOT_INFO as a pointer, dereference it and immediately borrow it.
let bootboot_r = unsafe { & (*(BOOTBOOT_INFO as *const BOOTBOOT)) };
// red, green, blue boxes in order
for y in 0..20 {
for x in 0..20 {
let addr = fb
+ bootboot::bootboot.fb_scanline as u64 * (y + 20) as u64
+ (x + 20) * 4;
*(addr as *mut u64) = 0x00FF0000;
}
}
for y in 0..20 {
for x in 0..20 {
let addr = fb
+ bootboot::bootboot.fb_scanline as u64 * (y + 20) as u64
+ (x + 50) * 4;
*(addr as *mut u64) = 0x0000FF00;
}
}
for y in 0..20 {
for x in 0..20 {
let addr = fb
+ bootboot::bootboot.fb_scanline as u64 * (y + 20) as u64
+ (x + 80) * 4;
*(addr as *mut u64) = 0x000000FF;
}
}
if bootboot_r.fb_scanline > 0 {
//As pointer arithmetic is not possible in rust, use the address as u64
let fb = BOOTBOOT_FB as u64;
// cross-hair to see screen dimension detected correctly
for y in 0..bootboot_r.fb_height {
let addr = fb
+ bootboot_r.fb_scanline as u64 * y as u64
+ bootboot_r.fb_width as u64 * 2;
unsafe { *(addr as *mut u64) = 0x00FFFFFF };
}
for x in 0..bootboot_r.fb_width {
let addr = fb
+ bootboot_r.fb_scanline as u64 * (bootboot_r.fb_height / 2) as u64 + (x * 4) as u64;
unsafe { *(addr as *mut u64) = 0x00FFFFFF };
}
// say hello
puts("Hello from a simple BOOTBOOT kernel");
// red, green, blue boxes in order
for y in 0..20 {
for x in 0..20 {
let addr = fb
+ bootboot_r.fb_scanline as u64 * (y + 20) as u64
+ (x + 20) * 4;
unsafe { *(addr as *mut u64) = 0x00FF0000 };
}
}
for y in 0..20 {
for x in 0..20 {
let addr = fb
+ bootboot_r.fb_scanline as u64 * (y + 20) as u64
+ (x + 50) * 4;
unsafe { *(addr as *mut u64) = 0x0000FF00 };
}
}
for y in 0..20 {
for x in 0..20 {
let addr = fb
+ bootboot_r.fb_scanline as u64 * (y + 20) as u64
+ (x + 80) * 4;
unsafe { *(addr as *mut u64) = 0x000000FF };
}
}
}
// say hello
puts("Hello Rust Hobby Kernel");
// hang for now
loop {}
}
@ -104,10 +109,16 @@ fn _start() -> ! {
/**************************
* Display text on screen *
**************************/
fn puts(string: &'static str) {
//TODO: REFACTOR
fn puts(string: &'static str) {
use bootboot::*;
let fb = BOOTBOOT_FB as u64;
let bootboot_r = unsafe { & (*(BOOTBOOT_INFO as *const BOOTBOOT)) };
unsafe {
let font: *mut bootboot::psf2_t = &_binary_font_psf_start as *const u64 as *mut psf2_t;
let font: *mut psf2_t = &_binary_font_psf_start as *const u64 as *mut psf2_t;
let (mut kx, mut line, mut mask, mut offs): (u32, u64, u64, u32);
kx = 0;
let bpl = ((*font).width + 7) / 8;
@ -126,7 +137,7 @@ fn puts(string: &'static str) {
line = offs as u64;
mask = 1 << ((*font).width - 1);
for _x in 0..(*font).width {
let target_location = (&bootboot::fb as *const u8 as u64 + line) as *mut u32;
let target_location = (fb as *const u8 as u64 + line) as *mut u32;
let mut target_value: u32 = 0;
if (*glyph as u64) & (mask) > 0 {
target_value = 0xFFFFFF;
@ -135,16 +146,17 @@ fn puts(string: &'static str) {
mask >>= 1;
line += 4;
}
let target_location = (&bootboot::fb as *const u8 as u64 + line) as *mut u32;
let target_location = (fb as *const u8 as u64 + line) as *mut u32;
*target_location = 0;
glyph = glyph.offset(bpl as isize);
offs += bootboot.fb_scanline;
offs += bootboot_r.fb_scanline;
}
kx += 1;
}
}
}
/*************************************
* This function is called on panic. *
*************************************/