riscv work
This commit is contained in:
parent
51c841e2de
commit
b3f8b11c5a
|
@ -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
|
|
@ -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;
|
||||||
|
|
|
@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue