Files
riscv64-kernel/user/test_pic/src/main.rs
2026-03-20 09:47:32 +01:00

25 lines
715 B
Rust

#![allow(unused)]
use io::{Read, Write};
use std::io::{Stdin, stdin};
use shared::syscall;
fn main() {
let mut input = String::new();
input.push('a');
// let mut file = syscall::open("/dev/fb0");
// syscall::seek(&mut file, SeekFrom::End(-3));
// syscall::write(&mut file, &[255; 6400 * 50]);
// syscall::sleep(Duration::from_secs_f64(2.0));
syscall::close(0);
let mut tty = syscall::open("/dev/tty0");
tty.write(input.as_bytes()).unwrap();
syscall::spawn("/usr/bin/shell");
loop {
let mut test = [0; 2];
let len = tty.read(&mut test).unwrap();
tty.write(str::from_utf8(&test[..len as usize]).unwrap().as_bytes())
.unwrap();
}
}