TOML config|moved a ton of boiler plate to prelude
This commit is contained in:
parent
05ce9f61c7
commit
0379a34a59
70
ableos/Cargo.lock
generated
70
ableos/Cargo.lock
generated
|
@ -34,7 +34,7 @@ dependencies = [
|
|||
"externc-libm",
|
||||
"facepalm",
|
||||
"genfs",
|
||||
"hashbrown",
|
||||
"hashbrown 0.11.2",
|
||||
"kernel",
|
||||
"lazy_static",
|
||||
"libwasm",
|
||||
|
@ -43,7 +43,6 @@ dependencies = [
|
|||
"log",
|
||||
"logos",
|
||||
"pc-beeper",
|
||||
"pci",
|
||||
"pic8259",
|
||||
"picorand",
|
||||
"pretty-hex",
|
||||
|
@ -51,10 +50,10 @@ dependencies = [
|
|||
"rhai",
|
||||
"rkyv",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"shadeable",
|
||||
"smoltcp",
|
||||
"spin 0.5.2",
|
||||
"toml",
|
||||
"uart_16550",
|
||||
"unicode-width",
|
||||
"vga",
|
||||
|
@ -75,6 +74,12 @@ dependencies = [
|
|||
"rsdp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
|
@ -247,13 +252,23 @@ dependencies = [
|
|||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf"
|
||||
dependencies = [
|
||||
"ahash 0.3.8",
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"ahash 0.7.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -265,17 +280,12 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
|
||||
[[package]]
|
||||
name = "kernel"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"versioning",
|
||||
]
|
||||
|
||||
|
@ -303,7 +313,7 @@ checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db"
|
|||
[[package]]
|
||||
name = "libwasm"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/able/libwasm.git#a89b8fc701ba0196cc9cca9989d9beb93d02a317"
|
||||
source = "git+https://git.ablecorp.us/able/libwasm.git#dedbb769ba01a4b75992437e52ca9a5c2bb9e0f9"
|
||||
|
||||
[[package]]
|
||||
name = "linked_list_allocator"
|
||||
|
@ -440,14 +450,6 @@ dependencies = [
|
|||
"x86_64",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pci"
|
||||
version = "0.0.1"
|
||||
source = "git+https://gitlab.com/robigalia/pci#4e2fddc61825568b1d14d09fdc669389e6c43f02"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pic8259"
|
||||
version = "0.10.2"
|
||||
|
@ -540,7 +542,7 @@ version = "1.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49c94fda0280985896ed6d8bf0b43bbb5a7f0e39ccc8728ac907ddb4f06dae94"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"ahash 0.7.6",
|
||||
"core-error",
|
||||
"instant",
|
||||
"libm",
|
||||
|
@ -568,7 +570,7 @@ version = "0.7.31"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439655b8d657bcb28264da8e5380d55549e34ffc4149bea9e3521890a122a7bd"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"hashbrown 0.11.2",
|
||||
"ptr_meta",
|
||||
"rkyv_derive",
|
||||
"seahash",
|
||||
|
@ -600,12 +602,6 @@ dependencies = [
|
|||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
|
@ -638,17 +634,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shadeable"
|
||||
version = "0.1.0"
|
||||
|
@ -736,6 +721,15 @@ dependencies = [
|
|||
"crunchy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.6"
|
||||
source = "git+https://github.com/diondokter/toml-rs#c4161aa70202b3992dbec79b76e7a8659713b604"
|
||||
dependencies = [
|
||||
"hashbrown 0.7.2",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ttf-parser"
|
||||
version = "0.14.0"
|
||||
|
|
|
@ -9,6 +9,9 @@ panic = "abort"
|
|||
|
||||
[package.metadata.bootimage]
|
||||
run-args = [
|
||||
"--nodefaults",
|
||||
|
||||
|
||||
"-cpu",
|
||||
"Broadwell-v3",
|
||||
|
||||
|
@ -17,28 +20,24 @@ run-args = [
|
|||
"-smp",
|
||||
"cores=2",
|
||||
|
||||
# An example gpu used with ableOS
|
||||
"-device",
|
||||
# "virtio-gpu",
|
||||
"ati-vga",
|
||||
|
||||
# An example disk used with ableOS
|
||||
"-device",
|
||||
"virtio-blk-pci,drive=drive0,id=virtblk0,num-queues=4",
|
||||
"-device", #"ati-vga",
|
||||
"cirrus-vga",
|
||||
|
||||
|
||||
|
||||
|
||||
# "-device",
|
||||
# "virtio-blk-pci,drive=drive0,id=virtblk0,num-queues=4",
|
||||
# A simple example of a boot image
|
||||
"-drive",
|
||||
"file=disk.qcow2,if=none,id=drive0",
|
||||
# "-drive",
|
||||
# "file=disk.qcow2,if=none,id=drive0",
|
||||
|
||||
# "-device",
|
||||
# "virtio-rng",
|
||||
|
||||
|
||||
|
||||
"-device",
|
||||
"virtio-rng",
|
||||
|
||||
|
||||
"-qmp",
|
||||
"unix:../qmp-sock,server,nowait"
|
||||
|
||||
# "-qmp",
|
||||
# "unix:../qmp-sock,server,nowait"
|
||||
|
||||
]
|
||||
test-args = [
|
||||
|
@ -52,7 +51,6 @@ test-args = [
|
|||
|
||||
|
||||
|
||||
|
||||
linked_list_allocator = "0.9.0"
|
||||
lliw = "0.2.0"
|
||||
# qoi_rs = "*"
|
||||
|
@ -70,7 +68,7 @@ genfs = "0.1.0"
|
|||
pc-beeper = {git = "https://github.com/AbleOS/pc-beeper"}
|
||||
rhai = "1.5"
|
||||
|
||||
pci = {git="https://gitlab.com/robigalia/pci"}
|
||||
# pci = {git="https://gitlab.com/robigalia/pci"}
|
||||
libwasm = {git="https://git.ablecorp.us:443/able/libwasm.git"}
|
||||
acpi = "4.1.0"
|
||||
|
||||
|
@ -93,10 +91,7 @@ version = "*"
|
|||
default-features = false
|
||||
features = ["derive", "alloc"]
|
||||
|
||||
[dependencies.serde_json]
|
||||
version = "*"
|
||||
default-features = false
|
||||
features = ["alloc"]
|
||||
|
||||
|
||||
[dependencies.hashbrown]
|
||||
version = "0.11.2"
|
||||
|
@ -118,6 +113,15 @@ git = "https://git.ablecorp.us:443/able/y-compositor-protocol.git"
|
|||
[dependencies.ext2]
|
||||
git = "https://git.ablecorp.us:443/able/ext2-rs.git"
|
||||
|
||||
|
||||
|
||||
|
||||
[dependencies.toml]
|
||||
git = "https://github.com/diondokter/toml-rs"
|
||||
# version = "0.5.8"
|
||||
default-features = false
|
||||
|
||||
|
||||
[dependencies.shadeable]
|
||||
path = "../shadeable"
|
||||
|
||||
|
|
12
ableos/assets/kernel.toml
Normal file
12
ableos/assets/kernel.toml
Normal file
|
@ -0,0 +1,12 @@
|
|||
[boot]
|
||||
system_processes = []
|
||||
user_processes = ["shell"]
|
||||
|
||||
[logging]
|
||||
enabled = false
|
||||
level = "Trace"
|
||||
|
||||
[tests]
|
||||
run_tests = false
|
||||
run_demos = false
|
||||
run_shader_tests = false
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"logging_level": "Trace",
|
||||
"logger_padding": 10,
|
||||
"run_tests": false,
|
||||
"run_demos": false,
|
||||
"run_shader_tests": false
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
use alloc::string::{String, ToString};
|
||||
use hashbrown::HashMap;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
|
|
|
@ -9,6 +9,11 @@ pub struct AAloc;
|
|||
|
||||
unsafe impl GlobalAlloc for AAloc {
|
||||
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
|
||||
println!("Allocating memory");
|
||||
|
||||
println!("{}", _layout.size());
|
||||
println!("{}", _layout.align());
|
||||
|
||||
null_mut()
|
||||
}
|
||||
|
||||
|
|
|
@ -8,13 +8,7 @@ pub const HEAP_MULTIPLIER: usize = 100000;
|
|||
pub const HEAP_BASE: usize = 100;
|
||||
|
||||
pub const HEAP_SIZE: usize = HEAP_BASE * HEAP_MULTIPLIER;
|
||||
// X86 alloc should be in arch/drivers/x86/alloc.rs
|
||||
|
||||
/*
|
||||
use crate::arch::drivers::allocator::Dummy;
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: Dummy = Dummy;
|
||||
*/
|
||||
use linked_list_allocator::LockedHeap;
|
||||
|
||||
#[global_allocator]
|
||||
|
@ -22,5 +16,7 @@ pub static ALLOCATOR: LockedHeap = LockedHeap::empty();
|
|||
|
||||
#[alloc_error_handler]
|
||||
fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! {
|
||||
// error!("allocation error: {:?}", layout);
|
||||
|
||||
panic!("allocation error: {:?}", layout)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use alloc::alloc::{GlobalAlloc, Layout};
|
||||
// use core::alloc::{GlobalAlloc, Layout};
|
||||
|
||||
use crate::allocator::{HEAP_SIZE, HEAP_START};
|
||||
use core::ptr::null_mut;
|
||||
use x86_64::{
|
||||
|
|
|
@ -5,6 +5,12 @@ use super::{gdt, interrupts};
|
|||
|
||||
/// x86_64 initialization
|
||||
pub fn init() {
|
||||
use crate::network::socket::SimpleSock;
|
||||
use crate::relib::network::socket::Socket;
|
||||
|
||||
let mut log_socket_id = SimpleSock::new();
|
||||
log_socket_id.register_protocol("Logger".to_string());
|
||||
|
||||
let result = logger::init();
|
||||
match result {
|
||||
Ok(_) => {}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use log::LevelFilter;
|
||||
// use rkyv::{Deserialize, Serialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Debug, Deserialize)]
|
||||
|
@ -19,29 +18,21 @@ pub enum LogLevel {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Debug, Deserialize)]
|
||||
pub struct BootConfig {
|
||||
pub logging_level: LogLevel,
|
||||
pub logger_padding: usize,
|
||||
pub run_tests: bool,
|
||||
pub run_demos: bool,
|
||||
pub run_shader_tests: bool,
|
||||
pub struct KernelConfig {
|
||||
pub boot: BootConfig,
|
||||
pub logging: LoggingConfig,
|
||||
pub tests: TestsConfig,
|
||||
}
|
||||
|
||||
impl BootConfig {
|
||||
impl KernelConfig {
|
||||
pub fn new() -> Self {
|
||||
let data = include_str!("../assets/kernel_config.json");
|
||||
|
||||
// Parse the string of data into a Person object. This is exactly the
|
||||
// same function as the one that produced serde_json::Value above, but
|
||||
// now we are asking it for a Person as output.
|
||||
let p: BootConfig = serde_json::from_str(data).unwrap();
|
||||
// info!("{:?}", p);
|
||||
let p: KernelConfig = toml::from_str(include_str!("../assets/kernel.toml")).unwrap();
|
||||
p
|
||||
}
|
||||
|
||||
pub fn log_level(&self) -> LevelFilter {
|
||||
use LevelFilter::*;
|
||||
match self.logging_level {
|
||||
match self.logging.level {
|
||||
LogLevel::Off => Off,
|
||||
LogLevel::Error => Error,
|
||||
LogLevel::Warn => Warn,
|
||||
|
@ -51,3 +42,20 @@ impl BootConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug, Deserialize)]
|
||||
pub struct LoggingConfig {
|
||||
pub enabled: bool,
|
||||
pub level: LogLevel,
|
||||
}
|
||||
#[derive(Serialize, Debug, Deserialize)]
|
||||
pub struct TestsConfig {
|
||||
pub run_tests: bool,
|
||||
pub run_demos: bool,
|
||||
pub run_shader_tests: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug, Deserialize)]
|
||||
pub struct BootConfig {
|
||||
pub processes: Vec<String>,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#[derive(Debug)]
|
||||
pub enum Vendor {
|
||||
Unknown = 0,
|
||||
Ati = 4098,
|
||||
|
||||
Ati = 1002,
|
||||
}
|
||||
|
||||
pub fn match_vendor(id: u16) -> Vendor {
|
||||
use Vendor::*;
|
||||
match id {
|
||||
4098 => Vendor::Ati,
|
||||
_ => Vendor::Unknown,
|
||||
1002 => Ati,
|
||||
|
||||
_ => Unknown,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,7 @@ pub mod character_devs;
|
|||
pub mod id;
|
||||
pub mod pci_inner;
|
||||
|
||||
use alloc::{
|
||||
boxed::Box,
|
||||
string::{String, ToString},
|
||||
};
|
||||
use hashbrown::HashMap;
|
||||
use pci::PCIDevice;
|
||||
|
||||
use kernel::device_interface::character::CharacterDevice;
|
||||
|
||||
|
@ -15,7 +10,6 @@ use kernel::device_interface::character::CharacterDevice;
|
|||
// #[derive(Debug)]
|
||||
pub enum Device {
|
||||
Character(Box<dyn CharacterDevice>),
|
||||
Pci(PCIDevice),
|
||||
}
|
||||
unsafe impl Sync for Device {}
|
||||
unsafe impl Send for Device {}
|
||||
|
|
|
@ -1,86 +1,55 @@
|
|||
//! map the DeviceClass via <https://pci-ids.ucw.cz/read/PD>
|
||||
//!
|
||||
//!
|
||||
|
||||
use pci::PortOps;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub enum DeviceClass {
|
||||
UnclassifiedDevice = 0,
|
||||
MassStorageController = 0x01,
|
||||
NetworkController = 0x02,
|
||||
DisplayController = 0x03,
|
||||
MultimediaController = 0x04,
|
||||
MemoryController = 0x05,
|
||||
BridgeDevice = 0x06,
|
||||
#[allow(dead_code)]
|
||||
fn scan_pci_bus() {}
|
||||
|
||||
CommunicationController = 0x07,
|
||||
GenericSystemPeripheral = 0x08,
|
||||
InputDevice = 0x09,
|
||||
DockingStation = 0x0a,
|
||||
Processor = 0x0b,
|
||||
SerialBusController = 0x0c,
|
||||
WirelessController = 0x0d,
|
||||
IntelligentController = 0x0e,
|
||||
SatelliteCommunicationController = 0x0f,
|
||||
EncryptionController = 0x10,
|
||||
SignalProcessingController = 0x11,
|
||||
|
||||
// 14
|
||||
// 15
|
||||
// 16
|
||||
Coprocessor = 40,
|
||||
// 64
|
||||
pub enum Vendors {
|
||||
ThreeDfxInteractiveInc = 0x121a,
|
||||
ThreeDLabs = 0x3d3d,
|
||||
AllianceSemiconductorCorp = 0x1142,
|
||||
ARKLogicInc = 0xedd8,
|
||||
ATITechnologiesInc = 0x1002,
|
||||
AvanceLogicIncALI = 0x1005,
|
||||
ChipsandTechnologies = 0x102c,
|
||||
CirrusLogic = 0x1013,
|
||||
Compaq = 0x0e11,
|
||||
CyrixCorp = 0x1078,
|
||||
DiamondMultimediaSystems = 0x1092,
|
||||
DigitalEquipmentCorp = 0x1011,
|
||||
Iit = 0x1061,
|
||||
IntegratedMicroSolutionsInc = 0x10e0,
|
||||
IntelCorp = 0x8086,
|
||||
IntergraphicsSystems = 0x10ea,
|
||||
MacronixInc = 0x10d9,
|
||||
MatroxGraphicsInc = 0x102b,
|
||||
MiroComputersProductsAG = 0x1031,
|
||||
NationalSemiconductorCorp = 0x100b,
|
||||
NeoMagicCorp = 0x10c8,
|
||||
Number9ComputerCompany = 0x105d,
|
||||
NVidiaCorporation = 0x10de,
|
||||
NVidiaSgsthomson = 0x12d2,
|
||||
OakTechnologyInc = 0x104e,
|
||||
QuantumDesignsHKLtd = 0x1098,
|
||||
Real3D = 0x003d,
|
||||
Rendition = 0x1163,
|
||||
S3Inc = 0x5333,
|
||||
SierraSemiconductor = 0x10a8,
|
||||
SiliconIntegratedSystemsSiS = 0x1039,
|
||||
SiliconMotionInc = 0x126f,
|
||||
STBSystemsInc = 0x10b4,
|
||||
TexasInstruments = 0x104c,
|
||||
ToshibaAmericaInfoSystems = 0x1179,
|
||||
TridentMicrosystems = 0x1023,
|
||||
TsengLabsInc = 0x100c,
|
||||
TundraSemiconductorCorp = 0x10e3,
|
||||
VIATechnologiesInc = 0x1106,
|
||||
VMWareInc = 0x15ad,
|
||||
Weitek = 0x100e,
|
||||
Unknown = 0xffff,
|
||||
}
|
||||
|
||||
impl DeviceClass {
|
||||
pub fn from_u8(val: u8) -> DeviceClass {
|
||||
match val {
|
||||
0x00 => DeviceClass::UnclassifiedDevice,
|
||||
0x01 => DeviceClass::MassStorageController,
|
||||
0x02 => DeviceClass::NetworkController,
|
||||
0x03 => DeviceClass::DisplayController,
|
||||
0x04 => DeviceClass::MultimediaController,
|
||||
0x05 => DeviceClass::MemoryController,
|
||||
0x06 => DeviceClass::BridgeDevice,
|
||||
0x07 => DeviceClass::CommunicationController,
|
||||
0x08 => DeviceClass::GenericSystemPeripheral,
|
||||
0x09 => DeviceClass::InputDevice,
|
||||
0x0a => DeviceClass::DockingStation,
|
||||
0x0b => DeviceClass::Processor,
|
||||
0x0c => DeviceClass::SerialBusController,
|
||||
0x0d => DeviceClass::WirelessController,
|
||||
0x0e => DeviceClass::IntelligentController,
|
||||
0x0f => DeviceClass::SatelliteCommunicationController,
|
||||
0x10 => DeviceClass::EncryptionController,
|
||||
0x11 => DeviceClass::SignalProcessingController,
|
||||
0x40 => DeviceClass::Coprocessor,
|
||||
_ => DeviceClass::UnclassifiedDevice,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PciIO {}
|
||||
|
||||
impl PortOps for PciIO {
|
||||
unsafe fn read8(&self, port: u16) -> u8 {
|
||||
cpuio::inb(port as u16)
|
||||
}
|
||||
|
||||
unsafe fn read16(&self, port: u16) -> u16 {
|
||||
cpuio::inw(port as u16)
|
||||
}
|
||||
|
||||
unsafe fn read32(&self, port: u16) -> u32 {
|
||||
cpuio::inl(port as u16)
|
||||
}
|
||||
|
||||
unsafe fn write8(&self, port: u16, val: u8) {
|
||||
cpuio::outb(val, port as u16);
|
||||
}
|
||||
|
||||
unsafe fn write16(&self, port: u16, val: u16) {
|
||||
cpuio::outw(val, port as u16);
|
||||
}
|
||||
|
||||
unsafe fn write32(&self, port: u16, val: u32) {
|
||||
cpuio::outl(val, port as u16);
|
||||
}
|
||||
pub struct PciDevice {
|
||||
pub vendor: Vendors,
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ pub fn colorify(eval: &str) {
|
|||
}
|
||||
}
|
||||
}
|
||||
use alloc::string::String;
|
||||
|
||||
use logos::Logos;
|
||||
|
||||
#[derive(Logos, Debug, PartialEq)]
|
||||
|
@ -85,7 +85,7 @@ pub enum Token {
|
|||
Error,
|
||||
}
|
||||
pub fn colorify_2(eval: &str) {
|
||||
let mut lexer = Token::lexer(eval);
|
||||
let lexer = Token::lexer(eval);
|
||||
for token in lexer {
|
||||
use Token::*;
|
||||
match token {
|
||||
|
@ -99,7 +99,7 @@ pub fn colorify_2(eval: &str) {
|
|||
kprint!("{}", text);
|
||||
}
|
||||
err => {
|
||||
error!("Error parsing");
|
||||
error!("Error parsing {:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use core::time::Duration;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
// pub struct Duration {}
|
||||
|
||||
pub struct AtomicU32(u32);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(asm)]
|
||||
#![cfg_attr(
|
||||
not(any(target_arch = "x86_64", target_arch = "x86")),
|
||||
allow(dead_code)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
use crate::driver_traits::graphics::Point;
|
||||
|
||||
use alloc::string::String;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
pub struct MenuOption {
|
||||
symbol: char,
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
use {
|
||||
alloc::{format, string::String, vec::Vec},
|
||||
ext2::{
|
||||
fs::{
|
||||
sync::{Inode, Synced},
|
||||
Ext2,
|
||||
},
|
||||
sector::{SectorSize, Size1024},
|
||||
volume::Volume,
|
||||
use ext2::{
|
||||
fs::{
|
||||
sync::{Inode, Synced},
|
||||
Ext2,
|
||||
},
|
||||
sector::{SectorSize, Size1024},
|
||||
volume::Volume,
|
||||
};
|
||||
|
||||
fn load_fs() -> Synced<Ext2<Size1024, Vec<u8>>> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::vga_e::VGAE;
|
||||
use ab_glyph::{Font, FontRef, Glyph};
|
||||
use alloc::{boxed::Box, vec, vec::Vec};
|
||||
|
||||
use shadeable::{evaluate_shader, pixel_format::Rgba64};
|
||||
use spin;
|
||||
use vga::{colors::Color16, writers::GraphicsWriter};
|
||||
|
@ -126,7 +126,6 @@ impl ScreenBuffer {
|
|||
|
||||
// TODO force clear
|
||||
pub fn force_redraw(&mut self) {
|
||||
use shadeable::pixel_format::into_vga_16;
|
||||
VGAE.lock().clear_screen(vga::colors::Color16::Black);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use alloc::string::{String, ToString};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
#![allow(clippy::empty_loop)]
|
||||
|
||||
use acpi::AcpiTables;
|
||||
use x86_64::instructions::interrupts::{disable, enable};
|
||||
|
||||
use crate::scratchpad;
|
||||
use crate::{boot_conf::KernelConfig, scratchpad};
|
||||
|
||||
use {
|
||||
crate::{
|
||||
arch::{init, sloop},
|
||||
boot_conf,
|
||||
boot_conf::BootConfig,
|
||||
capabilities::FileAccess,
|
||||
experiments::{
|
||||
info::master,
|
||||
|
@ -20,29 +17,27 @@ use {
|
|||
scheduler::SCHEDULER,
|
||||
VgaBuffer, SCREEN_BUFFER,
|
||||
},
|
||||
alloc::{
|
||||
format,
|
||||
string::{String, ToString},
|
||||
vec,
|
||||
},
|
||||
core::sync::atomic::{AtomicU64, Ordering::*},
|
||||
facepalm::start_facepalm,
|
||||
lazy_static::lazy_static,
|
||||
log::*,
|
||||
shadeable::pixel_format::from_vga_16,
|
||||
vga::colors::Color16,
|
||||
};
|
||||
|
||||
lazy_static! {
|
||||
// TODO: Change this structure to allow for multiple cores loaded
|
||||
pub static ref BOOT_CONF: BootConfig = boot_conf::BootConfig::new();
|
||||
pub static ref KERNEL_CONF: KernelConfig = KernelConfig::new();
|
||||
}
|
||||
|
||||
/// The main entry point of the kernel
|
||||
#[no_mangle]
|
||||
pub fn kernel_main() -> ! {
|
||||
init::init();
|
||||
log::set_max_level(BOOT_CONF.log_level());
|
||||
|
||||
if KERNEL_CONF.logging.enabled {
|
||||
log::set_max_level(KERNEL_CONF.log_level());
|
||||
} else {
|
||||
log::set_max_level(log::LevelFilter::Off);
|
||||
}
|
||||
|
||||
let mut scheduler = SCHEDULER.lock();
|
||||
|
||||
|
@ -74,16 +69,6 @@ pub fn kernel_main() -> ! {
|
|||
mode.copy_to_buffer();
|
||||
}
|
||||
|
||||
// TODO: create a scratchpad module
|
||||
if false {
|
||||
// Currently not implemented
|
||||
let acpi_handler = AcpiStruct {};
|
||||
let mut table;
|
||||
unsafe {
|
||||
table = AcpiTables::search_for_rsdp_bios(acpi_handler);
|
||||
}
|
||||
}
|
||||
|
||||
start_facepalm();
|
||||
scratchpad();
|
||||
|
||||
|
@ -148,7 +133,7 @@ impl acpi::AcpiHandler for AcpiStruct {
|
|||
todo!("map_physical_region");
|
||||
}
|
||||
|
||||
fn unmap_physical_region<T>(region: &acpi::PhysicalMapping<Self, T>) {
|
||||
fn unmap_physical_region<T>(_region: &acpi::PhysicalMapping<Self, T>) {
|
||||
todo!("unmap_physical_region");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
exclusive_range_pattern,
|
||||
lang_items,
|
||||
naked_functions,
|
||||
slice_pattern
|
||||
slice_pattern,
|
||||
prelude_import
|
||||
)]
|
||||
|
||||
/// Contains architecture specific code for aarch64.
|
||||
|
@ -33,6 +34,7 @@ pub mod arch;
|
|||
#[macro_use]
|
||||
pub mod print;
|
||||
pub mod devices;
|
||||
pub mod port_io;
|
||||
pub mod rhai_shell;
|
||||
pub mod wasm_jumploader;
|
||||
|
||||
|
@ -43,7 +45,6 @@ pub extern crate log;
|
|||
// Modules //
|
||||
/////////////
|
||||
pub mod allocator;
|
||||
pub mod boot_conf;
|
||||
pub mod driver_traits;
|
||||
pub mod experiments;
|
||||
pub mod graphics;
|
||||
|
@ -66,7 +67,6 @@ pub extern crate externc_libm as libm;
|
|||
// Re-exports ///
|
||||
////////////////
|
||||
pub use allocator::*;
|
||||
pub use boot_conf::*;
|
||||
pub use driver_traits::*;
|
||||
pub use experiments::*;
|
||||
pub use graphics::*;
|
||||
|
@ -79,7 +79,7 @@ pub use scheduler::*;
|
|||
pub use utils::*;
|
||||
pub use vga_e::*;
|
||||
pub use wasm::*;
|
||||
|
||||
pub mod boot_conf;
|
||||
pub mod virtio;
|
||||
pub use virtio::*;
|
||||
|
||||
|
@ -99,3 +99,8 @@ pub mod filesystem;
|
|||
pub use kernel;
|
||||
pub use kernel::messaging;
|
||||
pub use kernel::panic;
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
#[prelude_import]
|
||||
pub use prelude::rust_2021::*;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use core::sync::atomic::Ordering;
|
||||
|
||||
use crate::network::socket::{SimpleSock, Socket};
|
||||
use crate::serial_println;
|
||||
|
||||
use kernel::TICK;
|
||||
use lliw::{Fg, Reset};
|
||||
pub use log::{debug, info, trace, warn};
|
||||
use log::{Level, Metadata, Record};
|
||||
|
||||
struct SimpleLogger;
|
||||
|
@ -29,7 +30,13 @@ impl log::Log for SimpleLogger {
|
|||
log::Level::Debug => color = (Fg::Blue, "$BLUE$"),
|
||||
log::Level::Trace => color = (Fg::Yellow, "$YELLOW$"),
|
||||
}
|
||||
|
||||
let msg = format!(
|
||||
"[{}{}$RESET$][$GREEN${}$RESET$]{}\n",
|
||||
color.1,
|
||||
record.level(),
|
||||
time_float,
|
||||
record.args()
|
||||
);
|
||||
serial_println!(
|
||||
"[{}{}{}][{}{}{}] {}",
|
||||
color.0,
|
||||
|
@ -40,6 +47,14 @@ impl log::Log for SimpleLogger {
|
|||
Reset,
|
||||
record.args(),
|
||||
);
|
||||
|
||||
let log_socket_id = SimpleSock::grab_socket("Logger".to_string());
|
||||
match log_socket_id {
|
||||
Some(mut log_socket_id) => {
|
||||
log_socket_id.write(msg.as_bytes().to_vec());
|
||||
}
|
||||
None => warn!("No socket found for Logger"),
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Clear the log buffer
|
||||
|
|
16
ableos/src/port_io.rs
Normal file
16
ableos/src/port_io.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use cpuio::{inb, inl, outb, outl};
|
||||
|
||||
pub fn read32(reg: u16) -> u32 {
|
||||
unsafe { inl(reg) }
|
||||
}
|
||||
pub fn read8(reg: u16) -> u8 {
|
||||
unsafe { inb(reg) }
|
||||
}
|
||||
|
||||
pub fn write32(reg: u16, val: u32) {
|
||||
unsafe { outl(val, reg) }
|
||||
}
|
||||
|
||||
pub fn write8(reg: u16, val: u8) {
|
||||
unsafe { outb(val, reg) }
|
||||
}
|
1
ableos/src/prelude/mod.rs
Normal file
1
ableos/src/prelude/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod rust_2021;
|
8
ableos/src/prelude/rust_2021.rs
Normal file
8
ableos/src/prelude/rust_2021.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
pub use core::arch::asm;
|
||||
pub use core::prelude::rust_2021::*;
|
||||
pub use core::prelude::v1::*;
|
||||
|
||||
pub use crate::print::*;
|
||||
pub use log::{debug, info, trace, warn};
|
||||
|
||||
pub use alloc::{boxed::Box, format, string::*, vec, vec::*};
|
|
@ -19,8 +19,7 @@ impl core::fmt::Write for Stdout {
|
|||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn write_str(&mut self, s: &str) -> Result<(), Error> {
|
||||
use crate::{experiments::absi::colorify_2, kprint};
|
||||
// colorify_2(s);
|
||||
use crate::kprint;
|
||||
kprint!("{}", s);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use core::fmt;
|
||||
|
||||
use alloc::{string::String, vec, vec::Vec};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct PathRep {
|
||||
pub location: FileLocations,
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
//! The file table is not thread safe.
|
||||
//! The file table is not persistent.
|
||||
|
||||
use alloc::{
|
||||
string::{String, ToString},
|
||||
vec::Vec,
|
||||
};
|
||||
|
||||
use hashbrown::HashMap;
|
||||
|
||||
pub mod contain;
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
use alloc::{
|
||||
string::{String, ToString},
|
||||
vec,
|
||||
vec::Vec,
|
||||
};
|
||||
|
||||
/*
|
||||
clparse
|
||||
* A simple command line parser for ableOS
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use alloc::boxed::Box;
|
||||
|
||||
pub struct BinCodeWriter {
|
||||
pub stream: Box<u8>,
|
||||
}
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
pub fn encode(bytes: &[u8]) -> Vec<u8> {
|
||||
let mut encoding;
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
use alloc::string::String;
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
pub type Stream = Vec<u8>;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use alloc::vec::Vec;
|
||||
|
||||
pub fn rhai_shell() {
|
||||
let engine = engine_construction();
|
||||
let mut scope = rhai::Scope::new();
|
||||
|
@ -32,7 +30,6 @@ lazy_static::lazy_static!(
|
|||
;
|
||||
);
|
||||
|
||||
use alloc::string::String;
|
||||
use rhai::Engine;
|
||||
use x86_64::instructions::interrupts::{disable, enable};
|
||||
|
||||
|
@ -84,12 +81,15 @@ fn engine_construction() -> Engine {
|
|||
engine.register_fn("poke", poke_memory);
|
||||
engine.register_fn("sloop", sloop);
|
||||
engine.register_fn("wasm", interp);
|
||||
engine.register_fn("log_dump", log_dump);
|
||||
|
||||
engine
|
||||
}
|
||||
|
||||
/// Examine a memory pointer
|
||||
pub fn peek_memory(ptr: i64) -> u8 {
|
||||
let ptr: usize = ptr as usize;
|
||||
println!(">:(");
|
||||
unsafe { *(ptr as *const u8) }
|
||||
}
|
||||
|
||||
|
@ -97,3 +97,26 @@ pub fn poke_memory(ptr: i64, val: u8) {
|
|||
let ptr: usize = ptr as usize;
|
||||
unsafe { *(ptr as *mut u8) = val }
|
||||
}
|
||||
|
||||
pub fn log_dump() {
|
||||
use crate::network::socket::SimpleSock;
|
||||
use crate::relib::network::socket::Socket;
|
||||
let log_socket_id = SimpleSock::grab_socket("Logger".to_string());
|
||||
match log_socket_id {
|
||||
Some(mut log_socket_id) => {
|
||||
let log = log_socket_id.peek();
|
||||
|
||||
match log {
|
||||
crate::network::socket::SocketReturns::ReadOk(ok) => {
|
||||
for x in ok.iter() {
|
||||
print!("{}", *x as char);
|
||||
}
|
||||
}
|
||||
|
||||
crate::network::socket::SocketReturns::ReadIndexOutOfBounds => todo!(),
|
||||
crate::network::socket::SocketReturns::WriteOk => todo!(),
|
||||
}
|
||||
}
|
||||
None => warn!("No socket found for Logger"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use alloc::vec::Vec;
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use crate::file::PathRep;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![warn(missing_docs)]
|
||||
// #![warn(missing_docs)]
|
||||
|
||||
//! The standard ableOS scheduler named
|
||||
//!
|
||||
|
@ -6,8 +6,6 @@
|
|||
//! The scheduler is also responsible for choosing the priority of a process.
|
||||
//! The scheduler is responsible for choosing which process to execute next.
|
||||
|
||||
use alloc::{string::ToString, vec::Vec};
|
||||
|
||||
pub mod capabilities;
|
||||
pub mod proc;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use alloc::{string::ToString, vec::Vec};
|
||||
|
||||
use crate::{
|
||||
capabilities::Capabilities,
|
||||
kmain::generate_process_pass,
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//! Process definition and general utilities surrounding them
|
||||
|
||||
use alloc::string::String;
|
||||
|
||||
use super::{capabilities::Capabilities, Priority};
|
||||
|
||||
/// Process Identification
|
||||
|
|
|
@ -1,63 +1,19 @@
|
|||
use {
|
||||
crate::{
|
||||
devices::{
|
||||
id::match_vendor,
|
||||
pci_inner::{DeviceClass, PciIO},
|
||||
Device, DEVICE_TABLE,
|
||||
},
|
||||
rhai_shell::rhai_shell,
|
||||
},
|
||||
alloc::{format, vec::Vec},
|
||||
};
|
||||
use acpi::AcpiTables;
|
||||
|
||||
use crate::{kmain::AcpiStruct, rhai_shell::rhai_shell};
|
||||
|
||||
/// Experimental scratchpad for testing.
|
||||
pub fn scratchpad() {
|
||||
let mut dev_list = Vec::new();
|
||||
let bus_scan;
|
||||
unsafe {
|
||||
bus_scan = pci::scan_bus(&PciIO {}, pci::CSpaceAccessMethod::IO);
|
||||
}
|
||||
for dev in bus_scan {
|
||||
dev_list.push(dev);
|
||||
}
|
||||
|
||||
let device_table = &mut *DEVICE_TABLE.lock();
|
||||
|
||||
for x in dev_list {
|
||||
let vendor_id_name = match_vendor(x.id.vendor_id);
|
||||
use crate::devices::id::Vendor::*;
|
||||
match vendor_id_name {
|
||||
Unknown => {}
|
||||
Ati => unsafe {
|
||||
x.cspace_access_method.write32(&PciIO {}, x.loc, 0x0260, 1);
|
||||
|
||||
x.cspace_access_method
|
||||
.write32(&PciIO {}, x.loc, 0x0230, 0x00_ff_0000);
|
||||
|
||||
// 0x0260
|
||||
},
|
||||
}
|
||||
|
||||
let device_name = format!(
|
||||
"{:?}-{:?}-{}",
|
||||
vendor_id_name,
|
||||
DeviceClass::from_u8(x.id.class),
|
||||
x.id.device_id
|
||||
);
|
||||
// println!("{}", device_name);
|
||||
|
||||
device_table
|
||||
.devices
|
||||
.insert(device_name.clone(), Device::Pci(x));
|
||||
}
|
||||
|
||||
/*
|
||||
let message = "Hello, world!";
|
||||
|
||||
let xyz = ProcessMessage::new_from_string(PID(123), PID(0), message.to_string());
|
||||
|
||||
print!("{:?}", xyz);
|
||||
*/
|
||||
|
||||
pci_fun();
|
||||
rhai_shell();
|
||||
}
|
||||
|
||||
pub fn pci_fun() {}
|
||||
|
||||
pub fn acpi() {
|
||||
let acpi_handler = AcpiStruct {};
|
||||
let _table;
|
||||
unsafe {
|
||||
_table = AcpiTables::search_for_rsdp_bios(acpi_handler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
use alloc::{
|
||||
format,
|
||||
string::{String, ToString},
|
||||
vec,
|
||||
};
|
||||
use picorand::PicoRandGenerate;
|
||||
use rkyv::{ser::serializers::AllocSerializer, Deserialize};
|
||||
use shadeable::pixel_format::from_vga_16;
|
||||
|
@ -10,14 +5,14 @@ use vga::colors::Color16;
|
|||
use y_compositor_protocol::Version;
|
||||
|
||||
use crate::{
|
||||
kmain::BOOT_CONF,
|
||||
kmain::KERNEL_CONF,
|
||||
network::socket::{SimpleSock, Socket, SocketReturns},
|
||||
num_to_vga16, vga_e, VgaBuffer, SCREEN_BUFFER,
|
||||
num_to_vga16, VgaBuffer, SCREEN_BUFFER,
|
||||
};
|
||||
use kernel::TICK;
|
||||
|
||||
pub fn run_tests() {
|
||||
if BOOT_CONF.run_tests {
|
||||
if KERNEL_CONF.tests.run_tests {
|
||||
// quick and dirty testing framework
|
||||
screen_writer_test();
|
||||
socket_test();
|
||||
|
@ -26,11 +21,11 @@ pub fn run_tests() {
|
|||
socket_test_rng();
|
||||
}
|
||||
|
||||
if BOOT_CONF.run_demos {
|
||||
if KERNEL_CONF.tests.run_demos {
|
||||
graphics_api_demo();
|
||||
}
|
||||
|
||||
if BOOT_CONF.run_shader_tests {
|
||||
if KERNEL_CONF.tests.run_shader_tests {
|
||||
shader_tests();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
use shadeable::pixel_format::Rgba64;
|
||||
|
||||
use crate::SCREEN_BUFFER;
|
||||
|
||||
use {
|
||||
ab_glyph::{Font, FontRef, Glyph},
|
||||
vga::{
|
||||
colors::Color16,
|
||||
writers::{Graphics640x480x16, GraphicsWriter},
|
||||
},
|
||||
use vga::{
|
||||
colors::Color16,
|
||||
writers::{Graphics640x480x16, GraphicsWriter},
|
||||
};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use alloc::vec::Vec;
|
||||
|
||||
/// `NULL a s m` as an array of 4 bytes
|
||||
pub const WASM_BINARY_MAGIC: [u8; 4] = [0x00, 0x61, 0x73, 0x6d];
|
||||
/// `1 0 0 0` as an array of 4 bytes
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use alloc::format;
|
||||
use wasmi::{
|
||||
Error, Externals, FuncInstance, FuncRef, ModuleImportResolver, RuntimeArgs, RuntimeValue,
|
||||
Signature, Trap, ValueType,
|
||||
|
@ -54,7 +53,6 @@ impl HostExternals {
|
|||
ADD_FUNC_INDEX => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
|
||||
SEND_SIGNAL_INDEX => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
|
||||
GET_TIME_INDEX => (&[], Some(ValueType::I32)),
|
||||
|
||||
_ => return false,
|
||||
};
|
||||
signature.params() == params && signature.return_type() == ret_ty
|
||||
|
|
|
@ -3,7 +3,6 @@ pub mod host_functions;
|
|||
extern crate wasmi;
|
||||
// extern crate wabt;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use genfs::{Fs, OpenOptions};
|
||||
use wasmi::{ImportsBuilder, ModuleInstance};
|
||||
|
||||
|
|
2
kernel/.cargo/config.toml
Normal file
2
kernel/.cargo/config.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[build]
|
||||
target = "./json_targets/x86_64-ableos.json"
|
|
@ -5,6 +5,8 @@ version = "0.1.2"
|
|||
|
||||
|
||||
[dependencies]
|
||||
log = "0.4.14"
|
||||
|
||||
[dependencies.lazy_static]
|
||||
version = "1.4.0"
|
||||
default-features = false
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#![deny(missing_docs)]
|
||||
#![no_std]
|
||||
#![feature(prelude_import)]
|
||||
|
||||
//! The ableOS kernel.
|
||||
|
||||
pub mod device_interface;
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
//!
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
// #[macro_use]
|
||||
// use log;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic_handler(_info: &PanicInfo) -> ! {
|
||||
// error!("{}", _info);
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::pixel_format::{get_a, get_b, get_g, get_r, set_a, set_b, set_g, set_r};
|
||||
use crate::pixel_format::{new_rgba64, rgba_div, Rgba64};
|
||||
use crate::pixel_format::{rgba_div, Rgba64};
|
||||
|
||||
use log::{debug, info};
|
||||
use rhai::Engine;
|
||||
|
@ -7,13 +7,13 @@ use rhai::Engine;
|
|||
pub fn engine_startup() -> Engine {
|
||||
let mut engine = Engine::new();
|
||||
|
||||
// engine.on_print(|x| info!("PRINTED FROM SHADER: {}", x));
|
||||
engine.on_print(|x| info!("PRINTED FROM SHADER: {}", x));
|
||||
|
||||
// Any function or closure that takes a '&str', an 'Option<&str>' and a 'Position' argument
|
||||
// can be used to override 'debug'.
|
||||
engine.on_debug(|x, src, pos| {
|
||||
let src = src.unwrap_or("unknown");
|
||||
// debug!("SHADER DEBUG of {} at {:?}: {}", src, pos, x)
|
||||
debug!("SHADER DEBUG of {} at {:?}: {}", src, pos, x);
|
||||
});
|
||||
|
||||
engine
|
||||
|
|
Loading…
Reference in a new issue