1
0
Fork 0
forked from koniifer/ableos

riscv work

This commit is contained in:
Able 2022-04-12 13:46:50 -05:00
parent 51c841e2de
commit b3f8b11c5a
7 changed files with 52 additions and 24 deletions

View file

@ -11,4 +11,5 @@ rustflags = ["-C", "target-feature=+rdrand"]
runner = "bootimage runner"
[target.riscv64gc-unknown-none-elf]
rustflags = "-C link-arg=-T../ableos/src/arch/riscv/virt.lds"
rustflags = "-C link-arg=-Tableos/src/arch/riscv/virt.lds"
# ableos/src/arch/riscv/virt.lds

View file

@ -1,4 +1,5 @@
pub mod allocator;
pub mod graphics;
pub mod mmio;
pub mod sysinfo;
pub mod uart;

View file

@ -1 +1,23 @@
pub fn sysinfo() {}
pub fn master() -> Option<Master> {
Some(Master {
brand_string: Some("riscv".to_string()),
})
}
pub struct Master {
// TODO: Rename struct
// version_information: Option<VersionInformation>,
// thermal_power_management_information: Option<ThermalPowerManagementInformation>,
// structured_extended_information: Option<StructuredExtendedInformation>,
// extended_processor_signature: Option<ExtendedProcessorSignature>,
pub brand_string: Option<String>,
// cache_line: Option<CacheLine>,
// time_stamp_counter: Option<TimeStampCounter>,
// physical_address_size: Option<PhysicalAddressSize>,
}
impl Master {
pub fn brand_string(&self) -> Option<&str> {
self.brand_string.as_deref()
}
}

View file

@ -51,6 +51,7 @@ extern "C" fn _start() -> ! {
uart.put('\r' as u8);
}
/*
91 => {
if let Some(ch) = uart.get() {
match ch as char {
@ -66,10 +67,13 @@ extern "C" fn _start() -> ! {
'D' => {
serial_println!("That's the left arrow!");
}
_ => {
serial_println!("That's something else!");
}
}
}
}
*/
_ => {
uart.put(c);
}

View file

@ -42,7 +42,6 @@ impl KernelInfo {
enable();
let cpu = CpuType::X86_64(master().unwrap().brand_string().unwrap().to_string());
KernelInfo {
kernel_version: Version {
major: 0,

View file

@ -69,7 +69,6 @@ pub fn afetch() {
let used = allocator.used();
enable();
// let mem = format!("{}/{}", used, size);
println!(
include_str!("balloon.txt"),
kstate.hostname,
@ -77,6 +76,7 @@ pub fn afetch() {
KERNEL_VERSION,
tick_time,
master().unwrap().brand_string().unwrap(),
// "",
// mem
used,
size

View file

@ -168,6 +168,7 @@ impl Externals for HostExternals {
GET_INPUT_INDEX => {
let input =
// None;
x86_64::instructions::interrupts::without_interrupts(|| KEYBUFF.lock().pop());
if let Some(chr) = input {
trace!("SYSCALL: input: {}", chr);