forked from koniifer/ableos
FORMAT
This commit is contained in:
parent
1a98fe8908
commit
c2b8341667
|
@ -2,21 +2,21 @@ use core::{arch::asm, fmt, ops::Deref, slice, str};
|
|||
|
||||
#[repr(u32)]
|
||||
pub enum RequestType {
|
||||
BasicInformation = 0x00000000,
|
||||
VersionInformation = 0x00000001,
|
||||
ThermalPowerManagementInformation = 0x00000006,
|
||||
StructuredExtendedInformation = 0x00000007,
|
||||
ExtendedFunctionInformation = 0x80000000,
|
||||
ExtendedProcessorSignature = 0x80000001,
|
||||
BrandString1 = 0x80000002,
|
||||
BrandString2 = 0x80000003,
|
||||
BrandString3 = 0x80000004,
|
||||
BasicInformation = 0x0000_0000,
|
||||
VersionInformation = 0x0000_0001,
|
||||
ThermalPowerManagementInformation = 0x0000_0006,
|
||||
StructuredExtendedInformation = 0x0000_0007,
|
||||
ExtendedFunctionInformation = 0x8000_0000,
|
||||
ExtendedProcessorSignature = 0x8000_0001,
|
||||
BrandString1 = 0x8000_0002,
|
||||
BrandString2 = 0x8000_0003,
|
||||
BrandString3 = 0x8000_0004,
|
||||
// reserved = 0x80000005,
|
||||
CacheLine = 0x80000006,
|
||||
TimeStampCounter = 0x80000007,
|
||||
PhysicalAddressSize = 0x80000008,
|
||||
CacheLine = 0x8000_0006,
|
||||
TimeStampCounter = 0x8000_0007,
|
||||
PhysicalAddressSize = 0x8000_0008,
|
||||
}
|
||||
|
||||
#[allow(clippy::similar_names)]
|
||||
pub fn cpuid(code: RequestType) -> (u32, u32, u32, u32) {
|
||||
let eax;
|
||||
let ebx;
|
||||
|
@ -424,7 +424,7 @@ impl Clone for BrandString {
|
|||
for (d, s) in bytes.iter_mut().zip(self.bytes.iter()) {
|
||||
*d = *s;
|
||||
}
|
||||
BrandString { bytes: bytes }
|
||||
BrandString { bytes }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -761,8 +761,8 @@ impl Master {
|
|||
thermal_power_management_information: tpm,
|
||||
structured_extended_information: sei,
|
||||
extended_processor_signature: eps,
|
||||
brand_string: brand_string,
|
||||
cache_line: cache_line,
|
||||
brand_string,
|
||||
cache_line,
|
||||
time_stamp_counter: tsc,
|
||||
physical_address_size: pas,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
//! Logging (as in terms of console / serial output)
|
||||
#![allow(deprecated)]
|
||||
|
||||
use spin::Lazy;
|
||||
|
||||
use {
|
||||
core::fmt::Write,
|
||||
limine::{TerminalRequest, TerminalResponse},
|
||||
spin::Mutex,
|
||||
spin::{Lazy, Mutex},
|
||||
uart_16550::SerialPort,
|
||||
};
|
||||
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
use {
|
||||
crate::ipc::message::Message,
|
||||
alloc::vec::Vec,
|
||||
crossbeam_queue::{ArrayQueue, SegQueue},
|
||||
hbvm::engine::Engine,
|
||||
log::trace,
|
||||
HostError::MemoryError,
|
||||
};
|
||||
/// Host errors
|
||||
pub enum HostError {
|
||||
|
@ -20,13 +22,13 @@ pub fn ipc_send(engine: &mut Engine) -> Result<(), HostError> {
|
|||
let message_start = engine.registers.f1;
|
||||
let message_length = engine.registers.f2;
|
||||
|
||||
let mut ipc_msg: alloc::vec::Vec<u8> = alloc::vec![];
|
||||
let mut ipc_msg: Vec<u8> = alloc::vec![];
|
||||
|
||||
for x in message_start..message_start + message_length {
|
||||
let byte = engine.read_mem_addr_8(x);
|
||||
match byte {
|
||||
Ok(byte) => ipc_msg.push(byte),
|
||||
Err(_) => return Err(HostError::MemoryError),
|
||||
Err(_) => return Err(MemoryError),
|
||||
}
|
||||
}
|
||||
log::trace!("Message bytes {:?}", ipc_msg);
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
use {
|
||||
crate::{alloc::string::ToString, arch::logging::SERIAL_CONSOLE, device_tree::DeviceTree},
|
||||
clparse::Arguments,
|
||||
hbvm::engine::Engine,
|
||||
log::{debug, trace},
|
||||
spin::{Lazy, Mutex},
|
||||
xml::XMLElement,
|
||||
};
|
||||
|
||||
pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
|
||||
|
@ -14,10 +16,10 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
|
|||
cmdline.pop();
|
||||
cmdline.remove(0);
|
||||
|
||||
let kcmd = clparse::Arguments::parse(cmdline.to_string()).unwrap();
|
||||
let kcmd = Arguments::parse(cmdline.to_string()).unwrap();
|
||||
trace!("Cmdline: {kcmd:?}");
|
||||
|
||||
let mut kcl = xml::XMLElement::new("Kernel Command Line");
|
||||
let mut kcl = XMLElement::new("Kernel Command Line");
|
||||
for (key, value) in kcmd.arguments {
|
||||
kcl.set_attribute(key, value);
|
||||
}
|
||||
|
@ -34,7 +36,7 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
|
|||
}
|
||||
let dt = DEVICE_TREE.lock();
|
||||
|
||||
trace!("Device Tree{}", dt);
|
||||
log::info!("Device Tree{}", dt);
|
||||
|
||||
let bytes = alloc::vec![0];
|
||||
let mut prog = Engine::new(bytes);
|
||||
|
@ -62,10 +64,8 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
|
|||
let byte = sc.receive();
|
||||
if byte == b'\r' {
|
||||
sc.send(b'\n');
|
||||
sc.send(b'\r');
|
||||
} else {
|
||||
sc.send(byte);
|
||||
}
|
||||
sc.send(byte);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,9 @@
|
|||
ptr_sub_ptr,
|
||||
custom_test_frameworks
|
||||
)]
|
||||
#![deny(clippy::pedantic, warnings)]
|
||||
#![deny(clippy::pedantic, missing_docs, warnings)]
|
||||
#![allow(dead_code)]
|
||||
#![test_runner(crate::test_runner)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
|
|
Loading…
Reference in a new issue