diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index 15dc395..f2ba0ff 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -78,7 +78,7 @@ source = "git+https://github.com/myrrlyn/bitvec.git#8ab20a3e33fe068fc3a4a05eda12 [[package]] name = "bootloader" version = "0.4.0" -source = "git+https://github.com/rcore-os/bootloader#18e4fec0d82e8a5571abceb69d1d11fc0edccba1" +source = "git+https://github.com/rcore-os/bootloader?branch=vga#adc3ceda509e18b0d5a5623473dab4f8801a2551" dependencies = [ "apic 0.1.0 (git+https://github.com/rcore-os/apic-rs)", "fixedvec 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -354,7 +354,7 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bitmap-allocator 0.1.0 (git+https://github.com/rcore-os/bitmap-allocator)", "bitvec 0.11.0 (git+https://github.com/myrrlyn/bitvec.git)", - "bootloader 0.4.0 (git+https://github.com/rcore-os/bootloader)", + "bootloader 0.4.0 (git+https://github.com/rcore-os/bootloader?branch=vga)", "buddy_system_allocator 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", "console-traits 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -650,7 +650,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum bitmap-allocator 0.1.0 (git+https://github.com/rcore-os/bitmap-allocator)" = "" "checksum bitvec 0.11.0 (git+https://github.com/myrrlyn/bitvec.git)" = "" "checksum bitvec 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfadef5c4e2c2e64067b9ecc061179f12ac7ec65ba613b1f60f3972bbada1f5b" -"checksum bootloader 0.4.0 (git+https://github.com/rcore-os/bootloader)" = "" +"checksum bootloader 0.4.0 (git+https://github.com/rcore-os/bootloader?branch=vga)" = "" "checksum buddy_system_allocator 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "59da15ef556589ee78370281d75b67f2d69ed26465ec0e0f3961e2021502426f" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ce8bb087aacff865633f0bd5aeaed910fe2fe55b55f4739527f2e023a2e53d" diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 9547d31..f7562f8 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -70,7 +70,7 @@ rcore-fs = { git = "https://github.com/rcore-os/rcore-fs" } rcore-fs-sfs = { git = "https://github.com/rcore-os/rcore-fs" } [target.'cfg(target_arch = "x86_64")'.dependencies] -bootloader = { git = "https://github.com/rcore-os/bootloader" } +bootloader = { git = "https://github.com/rcore-os/bootloader", branch="vga", features=["vga_320x200"] } apic = { git = "https://github.com/rcore-os/apic-rs" } x86_64 = "0.5" raw-cpuid = "6.0" diff --git a/kernel/src/arch/x86_64/io.rs b/kernel/src/arch/x86_64/io.rs index c78b014..a25c655 100644 --- a/kernel/src/arch/x86_64/io.rs +++ b/kernel/src/arch/x86_64/io.rs @@ -10,18 +10,18 @@ pub fn getchar() -> char { } pub fn putfmt(fmt: Arguments) { - #[cfg(feature = "nographic")] - { + //#[cfg(feature = "nographic")] + //{ unsafe { COM1.force_unlock(); } COM1.lock().write_fmt(fmt).unwrap(); - } - #[cfg(not(feature = "nographic"))] - { - unsafe { - VGA_WRITER.force_unlock(); - } - VGA_WRITER.lock().write_fmt(fmt).unwrap(); - } + //} + //#[cfg(not(feature = "nographic"))] + //{ + //unsafe { + //VGA_WRITER.force_unlock(); + //} + //VGA_WRITER.lock().write_fmt(fmt).unwrap(); + //} } diff --git a/kernel/src/arch/x86_64/mod.rs b/kernel/src/arch/x86_64/mod.rs index 2d0e6ca..c0087ec 100644 --- a/kernel/src/arch/x86_64/mod.rs +++ b/kernel/src/arch/x86_64/mod.rs @@ -54,6 +54,17 @@ pub extern "C" fn _start(boot_info: &'static BootInfo) -> ! { crate::process::init(); // wake up other CPUs AP_CAN_INIT.store(true, Ordering::Relaxed); + unsafe{ + use crate::consts::KERNEL_OFFSET; + use core::slice; + let frame_buffer_data = + unsafe { slice::from_raw_parts_mut((KERNEL_OFFSET + 0xf000_0000) as *mut u8, 64000 as usize) }; + for x in 0..320 { + for y in 0..200 { + frame_buffer_data[x + y * 320] = (x % 16 + ( y % 16) * 16) as u8; + } + } + } // call the first main function in kernel. crate::kmain(); }