Add the rust std as a custom sysroot

This commit is contained in:
2026-03-17 18:29:00 +01:00
parent 404a681254
commit 46cdc3714e
50 changed files with 1158 additions and 320 deletions

View File

@@ -4,4 +4,7 @@ version = "0.1.0"
edition = "2024"
[dependencies]
os-std = { path = "../../crates/os-std" }
# std = { path = "../../crates/std" }
shared = { path = "../../crates/shared", features = ["user"] }
io = { path = "../../crates/io" }
bffs = { path = "../../crates/bffs" }

View File

@@ -1,30 +1,24 @@
#![no_std]
#![no_main]
#![allow(unused)]
// use core::time::Duration;
use os_std::syscall;
os_std::custom_std_setup! {}
use io::{Read, Write};
use std::io::{Stdin, stdin};
use shared::syscall;
fn main() {
// let mut input = String::new();
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));
let mut stdin = syscall::open("/dev/tty0");
let mut file = syscall::open("/dev/tty0");
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];
syscall::read(&mut stdin, &mut test);
let len = *test.iter().find(|x| **x == 0).unwrap_or(&1) + 1;
syscall::write(
&mut file,
str::from_utf8(&test[..len as usize]).unwrap().as_bytes(),
);
let len = tty.read(&mut test).unwrap();
tty.write(str::from_utf8(&test[..len as usize]).unwrap().as_bytes())
.unwrap();
}
// println!(
// "Hello from PIC program loaded dynamically with custom std and a better justfile, and syscalls ! {:?}",
// str::from_utf8(&test)
// );
}