mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-17 06:47:49 +00:00
Create a static WRITER protected by a spinlock
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#![feature(lang_items)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_unique_new)]
|
||||
#![feature(unique)]
|
||||
#![no_std]
|
||||
|
||||
extern crate rlibc;
|
||||
extern crate volatile;
|
||||
extern crate spin;
|
||||
|
||||
mod vga_buffer;
|
||||
|
||||
@@ -12,7 +14,10 @@ mod vga_buffer;
|
||||
pub extern fn rust_main() {
|
||||
// ATTENTION: we have a very small stack and no guard page
|
||||
|
||||
vga_buffer::print_something();
|
||||
use core::fmt::Write;
|
||||
|
||||
vga_buffer::WRITER.lock().write_str("Hello again");
|
||||
write!(vga_buffer::WRITER.lock(), ", some numbers: {} {}", 42, 1.337);
|
||||
|
||||
loop{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user