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" runner = "bootimage runner"
[target.riscv64gc-unknown-none-elf] [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 allocator;
pub mod graphics; pub mod graphics;
pub mod mmio; pub mod mmio;
pub mod sysinfo;
pub mod uart; pub mod uart;

View file

@ -1 +1,23 @@
pub fn sysinfo() {} 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,25 +51,29 @@ extern "C" fn _start() -> ! {
uart.put('\r' as u8); uart.put('\r' as u8);
} }
91 => { /*
if let Some(ch) = uart.get() { 91 => {
match ch as char { if let Some(ch) = uart.get() {
'A' => { match ch as char {
serial_println!("That's the up arrow!"); 'A' => {
} serial_println!("That's the up arrow!");
'B' => { }
serial_println!("That's the down arrow!"); 'B' => {
} serial_println!("That's the down arrow!");
'C' => { }
serial_println!("That's the right arrow!"); 'C' => {
} serial_println!("That's the right arrow!");
'D' => { }
serial_println!("That's the left arrow!"); 'D' => {
} serial_println!("That's the left arrow!");
} }
} _ => {
} serial_println!("That's something else!");
}
}
}
}
*/
_ => { _ => {
uart.put(c); uart.put(c);
} }

View file

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

View file

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

View file

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