correct memory_model comment, fix serial _print
This commit is contained in:
parent
5b2b881ced
commit
ea5ad2ced0
|
|
@ -653,7 +653,7 @@ The same is true also for the =Request= type, except that we have to bound the i
|
|||
Relevant to us are the =addr= field, and the fields describing how the (sub)pixels =addr= points to are laid out in memory.
|
||||
=width= and =height= describe the dimensions of the framebuffer in pixels, =pitch= describes how many bytes are used for each row of pixels, and =bpp= describes how many bits are used for each pixel.
|
||||
=bpp= can be assumed to be a multiple of 8. We will additionally assume that =bpp= is always at most 64.
|
||||
=memory_model= is the [[https://www.ctyme.com/intr/rb-0274.htm#Table82][VESA SVGA memory model]] the framebuffer uses, and at least at the time of writing, the only value reported by limine is =6=.
|
||||
=memory_model= is currently always =1=, meaning =LIMINE_FRAMEBUFFER_RGB=, but might in the future allow for other memory models in order to support [[https://www.ctyme.com/intr/rb-0274.htm#Table82][VESA SVGA memory model]] values other than Direct Color.
|
||||
The =mask_size= and =mask_shift= fields describe how the respective color channels are to be organised with a =bpp / 8= byte memory region.
|
||||
|
||||
To draw an rgb-colored pixel at a given position =(x, y)= then, we will define the following function:
|
||||
|
|
|
|||
|
|
@ -755,7 +755,9 @@ pub mod uart_16550 {
|
|||
// terminal
|
||||
self.uart.send_bytes_exact(&[8, b' ', 8]);
|
||||
}
|
||||
_ => {}
|
||||
_ => {
|
||||
self.uart.send_bytes_exact(&[*special]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -771,7 +773,7 @@ pub mod uart_16550 {
|
|||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn _print(args: core::fmt::Arguments) {
|
||||
pub fn _print(args: core::fmt::Arguments, nl: bool) {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
{
|
||||
use core::fmt::Write;
|
||||
|
|
@ -784,14 +786,18 @@ pub fn _print(args: core::fmt::Arguments) {
|
|||
}
|
||||
}
|
||||
|
||||
Writer(&uart_16550::SERIAL1).write_fmt(args).unwrap();
|
||||
let mut writer = Writer(&uart_16550::SERIAL1);
|
||||
writer.write_fmt(args).unwrap();
|
||||
if nl {
|
||||
writer.write_str("\n").unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! serial_print {
|
||||
($($arg:tt)*) => {
|
||||
$crate::serial::_print(format_args!($($arg)*));
|
||||
$crate::serial::_print(format_args!($($arg)*), false);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -800,12 +806,7 @@ macro_rules! serial_println {
|
|||
() => {
|
||||
$crate::serial_print!("\n");
|
||||
};
|
||||
($fmt:expr) => {
|
||||
$crate::serial_print!(concat!($fmt, "\n"));
|
||||
};
|
||||
($fmt:expr, $($arg:tt)*) => {
|
||||
$crate::serial_print!(
|
||||
concat!($fmt, "\n"), $($arg)*
|
||||
);
|
||||
($($arg:tt)*) => {
|
||||
$crate::serial::_print(format_args!($($arg)*), true);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue