forked from koniifer/ableos
riscv work
This commit is contained in:
parent
51c841e2de
commit
b3f8b11c5a
|
@ -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
|
|
@ -1,4 +1,5 @@
|
|||
pub mod allocator;
|
||||
pub mod graphics;
|
||||
pub mod mmio;
|
||||
pub mod sysinfo;
|
||||
pub mod uart;
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,25 +51,29 @@ extern "C" fn _start() -> ! {
|
|||
uart.put('\r' as u8);
|
||||
}
|
||||
|
||||
91 => {
|
||||
if let Some(ch) = uart.get() {
|
||||
match ch as char {
|
||||
'A' => {
|
||||
serial_println!("That's the up arrow!");
|
||||
}
|
||||
'B' => {
|
||||
serial_println!("That's the down arrow!");
|
||||
}
|
||||
'C' => {
|
||||
serial_println!("That's the right arrow!");
|
||||
}
|
||||
'D' => {
|
||||
serial_println!("That's the left arrow!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
91 => {
|
||||
if let Some(ch) = uart.get() {
|
||||
match ch as char {
|
||||
'A' => {
|
||||
serial_println!("That's the up arrow!");
|
||||
}
|
||||
'B' => {
|
||||
serial_println!("That's the down arrow!");
|
||||
}
|
||||
'C' => {
|
||||
serial_println!("That's the right arrow!");
|
||||
}
|
||||
'D' => {
|
||||
serial_println!("That's the left arrow!");
|
||||
}
|
||||
_ => {
|
||||
serial_println!("That's something else!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
_ => {
|
||||
uart.put(c);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -167,8 +167,9 @@ impl Externals for HostExternals {
|
|||
}
|
||||
|
||||
GET_INPUT_INDEX => {
|
||||
let input =
|
||||
x86_64::instructions::interrupts::without_interrupts(|| KEYBUFF.lock().pop());
|
||||
let input =
|
||||
// None;
|
||||
x86_64::instructions::interrupts::without_interrupts(|| KEYBUFF.lock().pop());
|
||||
if let Some(chr) = input {
|
||||
trace!("SYSCALL: input: {}", chr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue