forked from AbleOS/ableos
Compare commits
57 commits
kold/inter
...
master
Author | SHA1 | Date | |
---|---|---|---|
Able | 2afa83a615 | ||
Able | 28258e0d45 | ||
Able | 190f0941dc | ||
Able | 68840571c0 | ||
Able | dc3b7f71d5 | ||
Able | bff8db4c13 | ||
peony | 13c4649fd6 | ||
peony | f7f5b677e9 | ||
peony | 821497fbe6 | ||
Able | 5abdef4be6 | ||
Able | b5282ea6fb | ||
peony | 498cfbf913 | ||
peony | e3abec2927 | ||
peony | b3d07b5235 | ||
peony | a93512eed1 | ||
peony | c429641f98 | ||
koniifer | db01da58e1 | ||
koniifer | 38d3a10659 | ||
koniifer | a551b2672f | ||
koniifer | fd26ec734b | ||
koniifer | 9d1c59b65d | ||
cda022e6f0 | |||
95cf948d59 | |||
koniifer | f6a8a78b6c | ||
kodin | 5d152811b2 | ||
peony | 5028062e39 | ||
peony | f7f9fece4f | ||
peony | f4ceab972c | ||
peony | 96c07e137b | ||
peony | d78878a12f | ||
peony | 8f265ebf40 | ||
peony | 3d5a8f6f10 | ||
peony | f11122e58e | ||
peony | 2fdede7199 | ||
peony | 13422dfd9f | ||
peony | 90a97cd160 | ||
peony | 23b45b1887 | ||
peony | cf37eaf086 | ||
peony | 284aa5a5e6 | ||
peony | 11976b752f | ||
peony | 98b15d4c10 | ||
peony | f5c6d7d822 | ||
peony | efcd6c0631 | ||
peony | b795aced8e | ||
peony | 08099b0877 | ||
peony | a1bfd8e85f | ||
peony | edfb588060 | ||
peony | cc4a32afaa | ||
peony | be6a095c14 | ||
peony | aac1164d55 | ||
peony | 89d08d8a62 | ||
peony | 8f5833955f | ||
peony | 4c0adbe15d | ||
peony | 3708acc077 | ||
peony | b5b122f451 | ||
peony | 39ebaa03ba | ||
peony | de8000f596 |
61
Cargo.lock
generated
61
Cargo.lock
generated
|
@ -73,9 +73,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.1"
|
version = "1.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47"
|
checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"shlex",
|
"shlex",
|
||||||
]
|
]
|
||||||
|
@ -201,9 +201,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.15.1"
|
version = "0.15.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
|
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
"equivalent",
|
"equivalent",
|
||||||
|
@ -213,12 +213,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbbytecode"
|
name = "hbbytecode"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#a3355a59c0727e58519a94a8f65013beb9c2331b"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c5d5301b7bbdc44a5e365381594604c710d9a980"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hblang"
|
name = "hblang"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#a3355a59c0727e58519a94a8f65013beb9c2331b"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c5d5301b7bbdc44a5e365381594604c710d9a980"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"hbbytecode",
|
"hbbytecode",
|
||||||
|
@ -229,7 +229,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbvm"
|
name = "hbvm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#a3355a59c0727e58519a94a8f65013beb9c2331b"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c5d5301b7bbdc44a5e365381594604c710d9a980"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbbytecode",
|
"hbbytecode",
|
||||||
]
|
]
|
||||||
|
@ -375,9 +375,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.6.0"
|
version = "2.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
|
@ -401,7 +401,7 @@ dependencies = [
|
||||||
"uart_16550",
|
"uart_16550",
|
||||||
"versioning",
|
"versioning",
|
||||||
"x2apic",
|
"x2apic",
|
||||||
"x86_64 0.15.1",
|
"x86_64 0.15.2",
|
||||||
"xml",
|
"xml",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -421,9 +421,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.164"
|
version = "0.2.167"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f"
|
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "limine"
|
name = "limine"
|
||||||
|
@ -433,9 +433,9 @@ checksum = "02034f8f6b3e7bf050f310fbaf6db0018b8e54b75598d0a4c97172054752fede"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "litemap"
|
name = "litemap"
|
||||||
version = "0.7.4"
|
version = "0.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
|
checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
|
@ -593,9 +593,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.23.18"
|
version = "0.23.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f"
|
checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
@ -726,9 +726,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.89"
|
version = "2.0.90"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e"
|
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -827,17 +827,20 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ureq"
|
name = "ureq"
|
||||||
version = "2.10.1"
|
version = "2.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a"
|
checksum = "b30e6f97efe1fa43535ee241ee76967d3ff6ff3953ebb430d8d55c5393029e7b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
|
"litemap",
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustls",
|
"rustls",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"url",
|
"url",
|
||||||
"webpki-roots",
|
"webpki-roots",
|
||||||
|
"yoke",
|
||||||
|
"zerofrom",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -996,7 +999,7 @@ dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"paste",
|
"paste",
|
||||||
"raw-cpuid 10.7.0",
|
"raw-cpuid 10.7.0",
|
||||||
"x86_64 0.14.12",
|
"x86_64 0.14.13",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1012,9 +1015,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x86_64"
|
name = "x86_64"
|
||||||
version = "0.14.12"
|
version = "0.14.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "96cb6fd45bfeab6a5055c5bffdb08768bd0c069f1d946debe585bbb380a7c062"
|
checksum = "c101112411baafbb4bf8d33e4c4a80ab5b02d74d2612331c61e8192fc9710491"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit_field",
|
"bit_field",
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
|
@ -1024,9 +1027,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x86_64"
|
name = "x86_64"
|
||||||
version = "0.15.1"
|
version = "0.15.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4bc79523af8abf92fb1a970c3e086c5a343f6bcc1a0eb890f575cbb3b45743df"
|
checksum = "0f042214de98141e9c8706e8192b73f56494087cc55ebec28ce10f26c5c364ae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit_field",
|
"bit_field",
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
|
@ -1044,9 +1047,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yoke"
|
name = "yoke"
|
||||||
version = "0.7.5"
|
version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
|
checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
|
@ -1068,9 +1071,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerofrom"
|
name = "zerofrom"
|
||||||
version = "0.1.5"
|
version = "0.1.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
|
checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zerofrom-derive",
|
"zerofrom-derive",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,28 +1,85 @@
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
extern crate quote;
|
extern crate quote;
|
||||||
extern crate syn;
|
extern crate syn;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
proc_macro::TokenStream,
|
proc_macro::TokenStream,
|
||||||
quote::quote,
|
quote::quote,
|
||||||
syn::{parse_macro_input, ItemFn}
|
syn::{parse::Parse, parse_macro_input, Expr, ItemFn, Token}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct KtestInput {
|
||||||
|
lhs: Expr,
|
||||||
|
_comma: Token![,],
|
||||||
|
rhs: Expr,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Parse for KtestInput {
|
||||||
|
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
|
||||||
|
Ok(Self {
|
||||||
|
lhs: input.parse()?,
|
||||||
|
_comma: input.parse()?,
|
||||||
|
rhs: input.parse()?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[proc_macro]
|
||||||
|
pub fn ktest_eq(item: TokenStream) -> TokenStream {
|
||||||
|
let input = parse_macro_input!(item as KtestInput);
|
||||||
|
|
||||||
|
let lhs = input.lhs;
|
||||||
|
let rhs = input.rhs;
|
||||||
|
|
||||||
|
let out = quote! {
|
||||||
|
if #lhs != #rhs {
|
||||||
|
return Err(name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TokenStream::from(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[proc_macro]
|
||||||
|
pub fn ktest_neq(item: TokenStream) -> TokenStream {
|
||||||
|
let input = parse_macro_input!(item as KtestInput);
|
||||||
|
|
||||||
|
let lhs = input.lhs;
|
||||||
|
let rhs = input.rhs;
|
||||||
|
|
||||||
|
let out = quote! {
|
||||||
|
if #lhs == #rhs {
|
||||||
|
return Err(name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TokenStream::from(out)
|
||||||
|
}
|
||||||
|
|
||||||
#[proc_macro_attribute]
|
#[proc_macro_attribute]
|
||||||
pub fn ktest(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
pub fn ktest(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||||
let input = parse_macro_input!(item as ItemFn);
|
let input = parse_macro_input!(item as ItemFn);
|
||||||
let test_name = &input.sig.ident;
|
let test_name = &input.sig.ident;
|
||||||
|
let test_string = test_name.to_string();
|
||||||
let static_var_name = syn::Ident::new(
|
let static_var_name = syn::Ident::new(
|
||||||
&format!("__ktest_{}", test_name),
|
&format!("__ktest_{}", test_name).to_uppercase(),
|
||||||
test_name.span(),
|
test_name.span(),
|
||||||
);
|
);
|
||||||
let out = quote! {
|
|
||||||
// #[cfg(feature = "ktest")]
|
|
||||||
#input
|
|
||||||
|
|
||||||
// #[cfg(feature = "ktest")]
|
let block = &input.block;
|
||||||
|
let out = quote! {
|
||||||
|
#[cfg(feature = "ktest")]
|
||||||
|
fn #test_name() -> Result<String, String> {
|
||||||
|
use crate::alloc::string::ToString;
|
||||||
|
let name = #test_string.to_string();
|
||||||
|
|
||||||
|
#block
|
||||||
|
|
||||||
|
return Ok(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "ktest")]
|
||||||
#[unsafe(link_section = ".note.ktest")]
|
#[unsafe(link_section = ".note.ktest")]
|
||||||
#[used]
|
#[used]
|
||||||
pub static #static_var_name: fn() = #test_name;
|
pub static #static_var_name: fn() -> Result<String, String> = #test_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
TokenStream::from(out)
|
TokenStream::from(out)
|
||||||
|
|
|
@ -6,6 +6,11 @@ SECTIONS
|
||||||
.text.boot : { *(.text.boot) }
|
.text.boot : { *(.text.boot) }
|
||||||
.text : { *(.text) }
|
.text : { *(.text) }
|
||||||
.data : { *(.data) }
|
.data : { *(.data) }
|
||||||
|
.note.ktest : {
|
||||||
|
__ktest_start = .;
|
||||||
|
*(.note.ktest)
|
||||||
|
__ktest_end = .;
|
||||||
|
}
|
||||||
.rodata : { *(.rodata) }
|
.rodata : { *(.rodata) }
|
||||||
.bss : {
|
.bss : {
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
|
|
|
@ -83,33 +83,31 @@ extern "x86-interrupt" fn spurious(_: InterruptStackFrame) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused_imports)]
|
||||||
fn interrupt(interrupt_type: Interrupt) {
|
fn interrupt(interrupt_type: Interrupt) {
|
||||||
use crate::arch::INTERRUPT_LIST;
|
use crate::{arch::INTERRUPT_LIST, kmain::EXECUTOR};
|
||||||
use crate::kmain::EXECUTOR;
|
// let il = INTERRUPT_LIST.lock();
|
||||||
let il = INTERRUPT_LIST.lock();
|
// let val = il.list.get(&interrupt_type).unwrap();
|
||||||
let val = il.list.get(&interrupt_type).unwrap();
|
|
||||||
|
|
||||||
use crate::holeybytes::kernel_services::service_definition_service::sds_search_service;
|
// use crate::holeybytes::kernel_services::service_definition_service::sds_search_service;
|
||||||
let buffer = sds_search_service(val);
|
// let buffer = sds_search_service(val);
|
||||||
if buffer != 0 {
|
// if buffer != 0 {
|
||||||
use {crate::kmain::IPC_BUFFERS, alloc::vec::Vec};
|
// use {crate::kmain::IPC_BUFFERS, alloc::vec::Vec};
|
||||||
let mut buffs = IPC_BUFFERS.lock();
|
// let mut buffs = IPC_BUFFERS.lock();
|
||||||
match buffs.get_mut(&buffer) {
|
// match buffs.get_mut(&buffer) {
|
||||||
Some(buff) => {
|
// Some(buff) => {
|
||||||
let mut msg_vec = Vec::new();
|
// let mut msg_vec = Vec::new();
|
||||||
msg_vec.push(0xFF);
|
// msg_vec.push(0xFF);
|
||||||
buff.push(msg_vec.to_vec());
|
// buff.push(msg_vec.to_vec());
|
||||||
log::debug!("Sent Message {:?} to Buffer({})", msg_vec, buffer);
|
// log::debug!("Sent Message {:?} to Buffer({})", msg_vec, buffer);
|
||||||
}
|
// }
|
||||||
None => {
|
// None => {
|
||||||
log::error!("Access of non-existent buffer {}", buffer)
|
// log::error!("Access of non-existent buffer {}", buffer)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// log::info!("{}", buffer);
|
unsafe {
|
||||||
}
|
|
||||||
|
|
||||||
unsafe{
|
|
||||||
EXECUTOR.send_interrupt(interrupt_type as u8);
|
EXECUTOR.send_interrupt(interrupt_type as u8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
//! Environment call handling routines
|
//! Environment call handling routines
|
||||||
|
|
||||||
use log::log;
|
|
||||||
|
|
||||||
use {alloc::boxed::Box, core::cell::LazyCell, hbvm::mem::Address};
|
use {alloc::boxed::Box, core::cell::LazyCell, hbvm::mem::Address};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -82,6 +80,10 @@ pub fn handler(vm: &mut Vm, pid: &usize) {
|
||||||
let length = vm.registers[5].cast::<u64>() as usize;
|
let length = vm.registers[5].cast::<u64>() as usize;
|
||||||
trace!("IPC address: {:?}", mem_addr);
|
trace!("IPC address: {:?}", mem_addr);
|
||||||
|
|
||||||
|
unsafe { LazyCell::<Executor>::get_mut(&mut EXECUTOR) }
|
||||||
|
.unwrap()
|
||||||
|
.send_buffer(buffer_id as usize);
|
||||||
|
|
||||||
match buffer_id {
|
match buffer_id {
|
||||||
0 => match sds_msg_handler(vm, mem_addr, length) {
|
0 => match sds_msg_handler(vm, mem_addr, length) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
|
@ -244,13 +246,26 @@ pub fn handler(vm: &mut Vm, pid: &usize) {
|
||||||
vm.registers[3] = x
|
vm.registers[3] = x
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
6 => { // Wait till interrupt
|
6 => {
|
||||||
|
// Wait till interrupt
|
||||||
use crate::kmain::EXECUTOR;
|
use crate::kmain::EXECUTOR;
|
||||||
let interrupt_type = vm.registers[3].cast::<u8>();
|
let interrupt_type = vm.registers[3].cast::<u8>();
|
||||||
info!("Interrupt subscribled: {}", interrupt_type);
|
debug!("Interrupt subscribed: {}", interrupt_type);
|
||||||
unsafe{
|
unsafe {
|
||||||
EXECUTOR.pause(pid.clone());
|
LazyCell::<Executor>::get_mut(&mut EXECUTOR)
|
||||||
LazyCell::<Executor>::get_mut(&mut EXECUTOR).unwrap().interrupt_subscribe(pid.clone(), interrupt_type);
|
.unwrap()
|
||||||
|
.interrupt_subscribe(*pid, interrupt_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
7 => {
|
||||||
|
// Wait till buffer
|
||||||
|
use crate::kmain::EXECUTOR;
|
||||||
|
let buffer_id = vm.registers[3].cast::<u64>() as usize;
|
||||||
|
debug!("Buffer subscribed: {}", buffer_id);
|
||||||
|
unsafe {
|
||||||
|
LazyCell::<Executor>::get_mut(&mut EXECUTOR)
|
||||||
|
.unwrap()
|
||||||
|
.buffer_subscribe(*pid, buffer_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -24,8 +24,11 @@ pub fn kmain(_cmdline: &str, boot_modules: BootModules) -> ! {
|
||||||
|
|
||||||
#[cfg(feature = "ktest")]
|
#[cfg(feature = "ktest")]
|
||||||
{
|
{
|
||||||
use crate::ktest;
|
use {
|
||||||
debug!("TESTING");
|
crate::ktest,
|
||||||
|
log::info,
|
||||||
|
};
|
||||||
|
info!("Running tests");
|
||||||
ktest::test_main();
|
ktest::test_main();
|
||||||
|
|
||||||
loop {}
|
loop {}
|
||||||
|
|
|
@ -1,38 +1,51 @@
|
||||||
pub use ktest_macro::ktest;
|
pub use ktest_macro::*;
|
||||||
use log::debug;
|
|
||||||
|
use {
|
||||||
|
alloc::string::String,
|
||||||
|
log::{error, info},
|
||||||
|
};
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static __ktest_start: fn();
|
static __ktest_start: fn() -> Result<String, String>;
|
||||||
static __ktest_end: fn();
|
static __ktest_end: fn() -> Result<String, String>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Get test_fn linker name (may require no_mangle in macro)
|
// TODO: Implement ktest for arm and riscv (Later problems, see below)
|
||||||
// More info on tests (run the rest even if panic)
|
|
||||||
// Implement ktest for arm and riscv (Later problems, see below)
|
|
||||||
// Allow for arch specific tests (Leave for now)
|
// Allow for arch specific tests (Leave for now)
|
||||||
// Allow for ktest test name attr
|
// Should panic tests
|
||||||
// Usefull message at the end of testing
|
// Test specific panic handler
|
||||||
pub fn test_main() {
|
pub fn test_main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut current_test = &__ktest_start as *const fn();
|
let mut current_test = &__ktest_start as *const fn() -> Result<String, String>;
|
||||||
let mut current = 1;
|
let test_end = &__ktest_end as *const fn() -> Result<String, String>;
|
||||||
let test_end = &__ktest_end as *const fn();
|
|
||||||
|
let mut pass = 0;
|
||||||
|
let mut fail = 0;
|
||||||
|
|
||||||
while current_test < test_end {
|
while current_test < test_end {
|
||||||
let test_fn = *current_test;
|
let test_fn = *current_test;
|
||||||
|
|
||||||
debug!("Running test {}", current);
|
let test_name = test_fn();
|
||||||
|
match test_name {
|
||||||
test_fn();
|
Ok(name) => {
|
||||||
debug!("Test {} passed", current);
|
info!("Test: {} passed", name);
|
||||||
|
pass += 1;
|
||||||
|
},
|
||||||
|
Err(name) => {
|
||||||
|
error!("Test: {} failed", name);
|
||||||
|
fail += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
current_test = current_test.add(1);
|
current_test = current_test.add(1);
|
||||||
current += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info!("{}/{} tests passed", pass, pass + fail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[ktest]
|
#[ktest]
|
||||||
pub fn trivial_assertion() {
|
pub fn trivial_assertion() {
|
||||||
assert_eq!(1, 1);
|
ktest_eq!(1, 1);
|
||||||
}
|
ktest_neq!(0, 1);
|
||||||
|
}
|
||||||
|
|
|
@ -34,10 +34,10 @@ mod memory;
|
||||||
mod task;
|
mod task;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
// #[cfg(feature = "tests")]
|
#[allow(improper_ctypes, non_upper_case_globals)]
|
||||||
mod ktest;
|
mod ktest;
|
||||||
|
|
||||||
use {alloc::string::ToString, versioning::Version};
|
use versioning::Version;
|
||||||
|
|
||||||
/// Kernel's version
|
/// Kernel's version
|
||||||
pub const VERSION: Version = Version {
|
pub const VERSION: Version = Version {
|
||||||
|
@ -49,6 +49,7 @@ pub const VERSION: Version = Version {
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
#[cfg(target_os = "none")]
|
#[cfg(target_os = "none")]
|
||||||
fn panic(info: &core::panic::PanicInfo) -> ! {
|
fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||||
|
use alloc::string::ToString;
|
||||||
arch::register_dump();
|
arch::register_dump();
|
||||||
|
|
||||||
if let Some(loc) = info.location() {
|
if let Some(loc) = info.location() {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
use {
|
use {
|
||||||
alloc::{boxed::Box, sync::Arc},
|
alloc::{
|
||||||
|
boxed::Box,
|
||||||
|
collections::{BTreeMap, BTreeSet},
|
||||||
|
sync::Arc,
|
||||||
|
},
|
||||||
core::{
|
core::{
|
||||||
future::Future,
|
future::Future,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
|
@ -33,17 +37,19 @@ pub trait Process: Future<Output = ()> + Send {}
|
||||||
impl<T: Future<Output = ()> + Send> Process for T {}
|
impl<T: Future<Output = ()> + Send> Process for T {}
|
||||||
|
|
||||||
pub struct Executor {
|
pub struct Executor {
|
||||||
tasks: Slab<Task>,
|
tasks: Slab<Task>,
|
||||||
task_queue: Arc<SegQueue<usize>>,
|
task_queue: Arc<SegQueue<usize>>,
|
||||||
interrupt_lookup: [Option<usize>; u8::MAX as usize],
|
interrupt_lookup: [Option<usize>; u8::MAX as usize],
|
||||||
|
buffer_lookup: BTreeMap<usize, BTreeSet<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Executor {
|
impl Executor {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
tasks: Slab::new(),
|
tasks: Slab::new(),
|
||||||
task_queue: Arc::new(SegQueue::new()),
|
task_queue: Arc::new(SegQueue::new()),
|
||||||
interrupt_lookup: [None; u8::MAX as usize],
|
interrupt_lookup: [None; u8::MAX as usize],
|
||||||
|
buffer_lookup: BTreeMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,10 +73,20 @@ impl Executor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn interrupt_subscribe(&mut self, pid : usize, interrupt_type: u8){
|
pub fn interrupt_subscribe(&mut self, pid: usize, interrupt_type: u8) {
|
||||||
|
self.pause(pid);
|
||||||
self.interrupt_lookup[interrupt_type as usize] = Some(pid);
|
self.interrupt_lookup[interrupt_type as usize] = Some(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn buffer_subscribe(&mut self, pid: usize, buffer_id: usize) {
|
||||||
|
self.pause(pid);
|
||||||
|
if let Some(buf) = self.buffer_lookup.get_mut(&buffer_id) {
|
||||||
|
buf.insert(pid);
|
||||||
|
} else {
|
||||||
|
self.buffer_lookup.insert(buffer_id, BTreeSet::from([pid]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn run(&mut self) {
|
pub fn run(&mut self) {
|
||||||
let mut task_batch = [0; 32];
|
let mut task_batch = [0; 32];
|
||||||
loop {
|
loop {
|
||||||
|
@ -85,7 +101,7 @@ impl Executor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if batch_len == 0 {
|
if batch_len == 0 {
|
||||||
//break;
|
// break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,26 +116,34 @@ impl Executor {
|
||||||
|
|
||||||
if let Poll::Ready(()) = task.poll(&mut cx) {
|
if let Poll::Ready(()) = task.poll(&mut cx) {
|
||||||
self.tasks.remove(id);
|
self.tasks.remove(id);
|
||||||
self.interrupt_lookup.map(|pid|{
|
self.interrupt_lookup.map(|pid| {
|
||||||
if let Some(pid) = pid{
|
if let Some(pid) = pid {
|
||||||
if pid == id {
|
if pid == id {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pid;
|
return pid;
|
||||||
});
|
});
|
||||||
|
self.buffer_lookup.iter_mut().for_each(|(_, pid_set)| {
|
||||||
|
pid_set.remove(&id);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_interrupt(&self, interrupt : u8){
|
pub fn send_interrupt(&self, interrupt: u8) {
|
||||||
let id = self.interrupt_lookup[interrupt as usize];
|
let id = self.interrupt_lookup[interrupt as usize];
|
||||||
if let Some(id) = id{
|
if let Some(id) = id {
|
||||||
self.unpause(id);
|
self.unpause(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn send_buffer(&self, id: usize) {
|
||||||
|
if let Some(buf) = self.buffer_lookup.get(&id) {
|
||||||
|
buf.iter().for_each(|pid| self.unpause(*pid));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Task {
|
struct Task {
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
{
|
{
|
||||||
"arch": "aarch64",
|
"arch": "aarch64",
|
||||||
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32",
|
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32",
|
||||||
"disable-redzone": true,
|
"disable-redzone": true,
|
||||||
"env": "",
|
"env": "",
|
||||||
"executables": true,
|
"executables": true,
|
||||||
"features": "+strict-align,+neon,+fp-armv8",
|
"features": "+strict-align,+neon,+fp-armv8",
|
||||||
"linker": "rust-lld",
|
"linker": "rust-lld",
|
||||||
"linker-flavor": "ld.lld",
|
"linker-flavor": "ld.lld",
|
||||||
"linker-is-gnu": true,
|
"linker-is-gnu": true,
|
||||||
"pre-link-args": {
|
"pre-link-args": {
|
||||||
"ld.lld": [
|
"ld.lld": [
|
||||||
"-Tkernel/lds/aarch64-qemu.ld"
|
"-Tkernel/lds/aarch64-qemu.ld"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"llvm-target": "aarch64-unknown-none",
|
"llvm-target": "aarch64-unknown-none",
|
||||||
"max-atomic-width": 128,
|
"max-atomic-width": 128,
|
||||||
"os": "none",
|
"os": "none",
|
||||||
"panic-strategy": "abort",
|
"panic-strategy": "abort",
|
||||||
"relocation-model": "static",
|
"relocation-model": "static",
|
||||||
"target-c-int-width": "32",
|
"target-c-int-width": "32",
|
||||||
"target-endian": "little",
|
"target-endian": "little",
|
||||||
"target-pointer-width": "64",
|
"target-pointer-width": "64",
|
||||||
"vendor": ""
|
"vendor": "ablecorp"
|
||||||
}
|
}
|
|
@ -83,7 +83,8 @@ impl Package {
|
||||||
&path,
|
&path,
|
||||||
Options {
|
Options {
|
||||||
fmt: true,
|
fmt: true,
|
||||||
in_house_regalloc: true,
|
resolver: Some(hblang::ABLEOS_PATH_RESOLVER),
|
||||||
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
out,
|
out,
|
||||||
|
@ -99,7 +100,7 @@ impl Package {
|
||||||
hblang::run_compiler(
|
hblang::run_compiler(
|
||||||
&path,
|
&path,
|
||||||
Options {
|
Options {
|
||||||
in_house_regalloc: true,
|
resolver: Some(hblang::ABLEOS_PATH_RESOLVER),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
out,
|
out,
|
||||||
|
@ -111,8 +112,9 @@ impl Package {
|
||||||
hblang::run_compiler(
|
hblang::run_compiler(
|
||||||
&path,
|
&path,
|
||||||
Options {
|
Options {
|
||||||
|
resolver: Some(hblang::ABLEOS_PATH_RESOLVER),
|
||||||
dump_asm: true,
|
dump_asm: true,
|
||||||
in_house_regalloc: true,
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
out,
|
out,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
# old toolchain
|
# old toolchain
|
||||||
# channel = "nightly-2024-07-27"
|
# channel = "nightly-2024-07-27"
|
||||||
channel = "nightly-2024-11-20"
|
# last stable
|
||||||
|
# channel = "nightly-2024-11-20"
|
||||||
|
channel = "nightly"
|
||||||
components = ["rust-src", "llvm-tools"]
|
components = ["rust-src", "llvm-tools"]
|
||||||
|
|
|
@ -15,8 +15,8 @@ Label := struct {
|
||||||
bg: Color,
|
bg: Color,
|
||||||
fg: Color,
|
fg: Color,
|
||||||
|
|
||||||
new_label := fn(text: ^u8): Self {
|
new_label := fn(text: ^u8, width: uint): Self {
|
||||||
text_surface := render.new_surface(1024, 20)
|
text_surface := render.new_surface(width, 20)
|
||||||
text_length := string.length(text)
|
text_length := string.length(text)
|
||||||
label := Self.(3, true, text_surface, text, text_length, render.black, render.white)
|
label := Self.(3, true, text_surface, text, text_length, render.black, render.white)
|
||||||
return label
|
return label
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
string := @use("string.hb")
|
string := @use("string.hb")
|
||||||
|
|
||||||
|
$await := fn(buffer_id: uint): void {
|
||||||
|
return @eca(7, buffer_id)
|
||||||
|
}
|
||||||
|
|
||||||
$recv := fn($Expr: type, buffer_id: uint, memory_map_location: ^Expr): void {
|
$recv := fn($Expr: type, buffer_id: uint, memory_map_location: ^Expr): void {
|
||||||
return @eca(4, buffer_id, memory_map_location, @sizeof(Expr))
|
return @eca(4, buffer_id, memory_map_location, @sizeof(Expr))
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ random := @use("random.hb")
|
||||||
file := @use("file_io.hb")
|
file := @use("file_io.hb")
|
||||||
dt := @use("dt.hb")
|
dt := @use("dt.hb")
|
||||||
process := @use("process.hb")
|
process := @use("process.hb")
|
||||||
|
sleep := @use("sleep.hb")
|
||||||
|
|
||||||
panic := fn(message: ?^u8): never {
|
panic := fn(message: ?^u8): never {
|
||||||
log.error("Error: Panic Called, Message:\0")
|
log.error("Error: Panic Called, Message:\0")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.{math: .{Vec2}, buffer, memory} := @use("../../stn/src/lib.hb");
|
.{math: .{Vec2}, buffer, memory} := @use("stn");
|
||||||
.{Surface} := @use("../../render/src/lib.hb")
|
.{Surface} := @use("../../render/src/lib.hb")
|
||||||
|
|
||||||
$BUFFER_SERVER := "sunset_server\0"
|
$BUFFER_SERVER := "sunset_server\0"
|
||||||
|
@ -48,6 +48,8 @@ await_channel := fn(): Channel {
|
||||||
await_message := fn($Expr: type, buffer_id: uint): Message(Expr) {
|
await_message := fn($Expr: type, buffer_id: uint): Message(Expr) {
|
||||||
response := @as(?Message(Expr), null)
|
response := @as(?Message(Expr), null)
|
||||||
loop {
|
loop {
|
||||||
|
// awaiting here causes flickering... idk why
|
||||||
|
buffer.await(buffer_id)
|
||||||
buffer.recv(?Message(Expr), buffer_id, &response)
|
buffer.recv(?Message(Expr), buffer_id, &response)
|
||||||
if response != null {
|
if response != null {
|
||||||
return @as(Message(Expr), response)
|
return @as(Message(Expr), response)
|
||||||
|
@ -58,9 +60,11 @@ await_message := fn($Expr: type, buffer_id: uint): Message(Expr) {
|
||||||
await_header := fn(buffer_id: uint): MessageHeader {
|
await_header := fn(buffer_id: uint): MessageHeader {
|
||||||
response := @as(?MessageHeader, null)
|
response := @as(?MessageHeader, null)
|
||||||
loop {
|
loop {
|
||||||
|
// awaiting here causes flickering... idk why
|
||||||
|
buffer.await(buffer_id)
|
||||||
buffer.recv(?MessageHeader, buffer_id, &response)
|
buffer.recv(?MessageHeader, buffer_id, &response)
|
||||||
if response != null {
|
if response != null {
|
||||||
return @as(?MessageHeader, response)
|
return @as(MessageHeader, response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.{math, log, string, random, buffer, memory} := @use("../../stn/src/lib.hb");
|
.{math, log, string, random, buffer, memory} := @use("stn");
|
||||||
.{Color, Surface, new_surface, put_surface, sync, put_rect, put_filled_rect, text, put_text, clear, white, black} := @use("../../render/src/lib.hb");
|
.{Color, Surface, new_surface, put_surface, sync, put_rect, put_filled_rect, text, put_text, clear, white, black} := @use("lib:render");
|
||||||
.{Channel, Window, WindowProps, WindowData, MessageHeader, BUFFER_SERVER, BUFFER_CLIENT, message, permissions, recv_header, recv_message, send_message, send_header, await_message} := @use("./lib.hb")
|
.{Channel, Window, WindowProps, WindowData, MessageHeader, BUFFER_SERVER, BUFFER_CLIENT, message, permissions, recv_header, recv_message, send_message, send_header, await_message} := @use("lib:sunset_proto")
|
||||||
|
|
||||||
WindowServer := struct {
|
WindowServer := struct {
|
||||||
window_count: uint,
|
window_count: uint,
|
||||||
|
|
1
sysdata/programs/ablefetch/README.md
Normal file
1
sysdata/programs/ablefetch/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# ablefetch
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "hash_test"
|
name = "ablefetch"
|
||||||
authors = [""]
|
authors = [""]
|
||||||
|
|
||||||
[dependants.libraries]
|
[dependants.libraries]
|
46
sysdata/programs/ablefetch/src/main.hb
Normal file
46
sysdata/programs/ablefetch/src/main.hb
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
.{log} := @use("../../../libraries/stn/src/lib.hb")
|
||||||
|
sunset := @use("../../../libraries/sunset_proto/src/lib.hb")
|
||||||
|
render := @use("../../../libraries/render/src/lib.hb")
|
||||||
|
stn := @use("../../../libraries/stn/src/lib.hb");
|
||||||
|
.{Vec2} := stn.math
|
||||||
|
psf := @embed("../../../assets/consolefonts/tamsyn/10x20r.psf")
|
||||||
|
|
||||||
|
horizon_api := @use("../../../libraries/horizon_api/src/lib.hb");
|
||||||
|
.{set_color, render_label_to_surface, Label} := horizon_api.widgets.label
|
||||||
|
|
||||||
|
main := fn(): void {
|
||||||
|
sunset.client.find_server()
|
||||||
|
|
||||||
|
window := sunset.client.new(.(.(400, 100), .(400, 300), "ableFetch!\0"))
|
||||||
|
font := @unwrap(render.text.font_from_psf2(@bitcast(&psf), false))
|
||||||
|
// pos := Vec2(uint).(1, 100)
|
||||||
|
|
||||||
|
if window == null {
|
||||||
|
log.error("got no window\0")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
text_label := Label.new_label("kernel : akern 0.2.0\0", 300)
|
||||||
|
text_label.set_color(sunset.server.DECO_COLOUR, render.black)
|
||||||
|
|
||||||
|
text_label_2 := Label.new_label("os : ableos\0", 300)
|
||||||
|
text_label_2.set_color(sunset.server.DECO_COLOUR, render.black)
|
||||||
|
text_label_3 := Label.new_label("wm : sunset\0", 300)
|
||||||
|
text_label_3.set_color(sunset.server.DECO_COLOUR, render.black)
|
||||||
|
|
||||||
|
loop {
|
||||||
|
render.clear(window.surface, render.black)
|
||||||
|
// render.put_surface(window.surface, image, .(image.width + x % window.data.props.dimensions.x, 40), false)
|
||||||
|
pos := Vec2(uint).(1, 100)
|
||||||
|
|
||||||
|
render_label_to_surface(window.surface, text_label, font, pos)
|
||||||
|
pos = Vec2(uint).(1, 120)
|
||||||
|
|
||||||
|
render_label_to_surface(window.surface, text_label_2, font, pos)
|
||||||
|
|
||||||
|
pos = Vec2(uint).(1, 140)
|
||||||
|
render_label_to_surface(window.surface, text_label_3, font, pos)
|
||||||
|
|
||||||
|
_ = sunset.client.send_frame(window)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
# alloc_test
|
|
|
@ -1,30 +0,0 @@
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb");
|
|
||||||
.{allocators, panic, log} := stn
|
|
||||||
|
|
||||||
AStruct := struct {
|
|
||||||
a_field: u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
main := fn(): void {
|
|
||||||
// alloc := allocators.FakeAlloc.init()
|
|
||||||
// astruct := alloc.alloc(AStruct, 2)
|
|
||||||
// if astruct.ptr != null{
|
|
||||||
// panic.panic("FakeAlloc actually allocated.")
|
|
||||||
// }
|
|
||||||
// alloc.dealloc(&astruct.ptr, AStruct, 2)
|
|
||||||
// alloc.deinit()
|
|
||||||
|
|
||||||
balloc := allocators.BlockAlloc.init()
|
|
||||||
// defer {
|
|
||||||
// balloc.deinit()
|
|
||||||
// }
|
|
||||||
bstruct := balloc.alloc(AStruct, 2)
|
|
||||||
// if bstruct.ptr == null {
|
|
||||||
// log.info("Hi\0")
|
|
||||||
// // panic.panic("BlockAlloc actually didn't allocate.")
|
|
||||||
// } else {
|
|
||||||
// log.info("Allocator functioned.\0")
|
|
||||||
// }
|
|
||||||
// balloc.dealloc(bstruct_ptr, AStruct, 2)
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
# dt_buffer_test
|
|
|
@ -1,13 +0,0 @@
|
||||||
.{dt} := @use("../../../libraries/stn/src/lib.hb")
|
|
||||||
|
|
||||||
main := fn(): void {
|
|
||||||
dt.get(void, "framebuffer/fb0/width\0")
|
|
||||||
dt.get(void, "cpu/cpu0/architecture\0")
|
|
||||||
|
|
||||||
// Checking if the first detected serial port is memory mapped or port mapped
|
|
||||||
// 0 -> memory mapped
|
|
||||||
// 1 -> port mapped
|
|
||||||
dt.get(void, "serial_ports/sp0/mapping\0")
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -6,10 +6,10 @@ VALID_JUMP_BYTES := [u8].(0xEB, 0x3C, 0x90)
|
||||||
OemIdent := struct {
|
OemIdent := struct {
|
||||||
dos_version: [u8; 8],
|
dos_version: [u8; 8],
|
||||||
dos_version_name: [u8; 8],
|
dos_version_name: [u8; 8],
|
||||||
}
|
|
||||||
|
|
||||||
new_oem_ident := fn(major: int, minor: int): OemIdent {
|
new := fn(major: int, minor: int): OemIdent {
|
||||||
return .(.(0, 0, 0, 0, 0, 0, 0, 0), .(0, 0, 0, 0, 0, 0, 0, 0))
|
return .(.(0, 0, 0, 0, 0, 0, 0, 0), .(0, 0, 0, 0, 0, 0, 0, 0))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BiosParameterBlock := struct {
|
BiosParameterBlock := struct {
|
||||||
|
@ -30,21 +30,21 @@ BiosParameterBlock := struct {
|
||||||
head_count: u16,
|
head_count: u16,
|
||||||
hidden_sectors: u32,
|
hidden_sectors: u32,
|
||||||
large_sector_count: u32,
|
large_sector_count: u32,
|
||||||
}
|
|
||||||
|
|
||||||
bpb_sanity_check := fn(bpb: BiosParameterBlock): int {
|
sanity_check := fn(bpb: BiosParameterBlock): int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
new_bpb := fn(): BiosParameterBlock {
|
new := fn(): BiosParameterBlock {
|
||||||
return .(VALID_JUMP_BYTES, new_oem_ident(0, 0), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
return .(VALID_JUMP_BYTES, OemIdent.new(0, 0), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
sector_count := fn(bpb: BiosParameterBlock): u32 {
|
sector_count := fn(bpb: BiosParameterBlock): u32 {
|
||||||
if bpb.total_sectors == 0 {
|
if bpb.total_sectors == 0 {
|
||||||
return bpb.large_sector_count
|
return bpb.large_sector_count
|
||||||
} else {
|
} else {
|
||||||
return bpb.total_sectors
|
return bpb.total_sectors
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,48 +85,48 @@ ExtendedBootRecord := struct {
|
||||||
system_identifier_string: SystemIdentifierString,
|
system_identifier_string: SystemIdentifierString,
|
||||||
boot_code: BootCode,
|
boot_code: BootCode,
|
||||||
partition_signature: u16,
|
partition_signature: u16,
|
||||||
}
|
|
||||||
|
|
||||||
ebr_sanity_check := fn(ebr: ExtendedBootRecord): int {
|
sanity_check := fn(ebr: ExtendedBootRecord): int {
|
||||||
ret := 0
|
ret := 0
|
||||||
if ebr.drive_number != 0x0 | ebr.drive_number != 0x80 {
|
if ebr.drive_number != 0x0 | ebr.drive_number != 0x80 {
|
||||||
log.warn("EBR-Drive-Number sanity check failed\0")
|
log.warn("EBR-Drive-Number sanity check failed\0")
|
||||||
|
}
|
||||||
|
|
||||||
|
if ebr.signature != 0x28 | ebr.signature != 0x29 {
|
||||||
|
log.warn("EBR-Signature sanity check failed\0")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ! comparison between [u8] is not supported in hblang
|
||||||
|
// if ebr.system_identifier_string != VALID_SYSTEM_IDENTIFIER_STRING {
|
||||||
|
// log.warn("EBR-Signature-Identifier-String sanity check failed\0")
|
||||||
|
// }
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if ebr.signature != 0x28 | ebr.signature != 0x29 {
|
new := fn(): ExtendedBootRecord {
|
||||||
log.warn("EBR-Signature sanity check failed\0")
|
version := FatVersionNumber.(0, 0)
|
||||||
|
fmt_res := FormatReservation.(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
|
vol_name := @as([u8; 11], idk)
|
||||||
|
boot_code := @as([u8; 420], idk)
|
||||||
|
|
||||||
|
return ExtendedBootRecord.(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
version,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
fmt_res,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
vol_name,
|
||||||
|
VALID_SYSTEM_IDENTIFIER_STRING,
|
||||||
|
boot_code,
|
||||||
|
0,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ! comparison between [u8] is not supported in hblang
|
|
||||||
// if ebr.system_identifier_string != VALID_SYSTEM_IDENTIFIER_STRING {
|
|
||||||
// log.warn("EBR-Signature-Identifier-String sanity check failed\0")
|
|
||||||
// }
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
new_ebr := fn(): ExtendedBootRecord {
|
|
||||||
version := FatVersionNumber.(0, 0)
|
|
||||||
fmt_res := FormatReservation.(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
|
||||||
vol_name := @as([u8; 11], idk)
|
|
||||||
boot_code := @as([u8; 420], idk)
|
|
||||||
|
|
||||||
return ExtendedBootRecord.(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
version,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
fmt_res,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
vol_name,
|
|
||||||
VALID_SYSTEM_IDENTIFIER_STRING,
|
|
||||||
boot_code,
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VALID_LEAD_FS_INFO := @as(u32, 0x41615252)
|
VALID_LEAD_FS_INFO := @as(u32, 0x41615252)
|
||||||
|
@ -141,39 +141,39 @@ FSInfo := struct {
|
||||||
last_known_avalible_cluster: u32,
|
last_known_avalible_cluster: u32,
|
||||||
trail_reserved: [u8; 12],
|
trail_reserved: [u8; 12],
|
||||||
trail_signature: u32,
|
trail_signature: u32,
|
||||||
}
|
|
||||||
|
|
||||||
fs_info_sanity_check := fn(fs_info: FSInfo): uint {
|
sanity_check := fn(fs_info: FSInfo): uint {
|
||||||
ret := 0
|
ret := 0
|
||||||
if fs_info.lead_signature != VALID_LEAD_FS_INFO {
|
if fs_info.lead_signature != VALID_LEAD_FS_INFO {
|
||||||
ret &= 1
|
ret &= 1
|
||||||
log.warn("Invalid leading signature in FSInfo.\0")
|
log.warn("Invalid leading signature in FSInfo.\0")
|
||||||
}
|
}
|
||||||
if fs_info.last_known_free_cluster_count == 0xFFFFFFFF {
|
if fs_info.last_known_free_cluster_count == 0xFFFFFFFF {
|
||||||
ret &= 2
|
ret &= 2
|
||||||
log.warn("Last known free cluster count unknown.\0")
|
log.warn("Last known free cluster count unknown.\0")
|
||||||
}
|
}
|
||||||
if fs_info.last_known_avalible_cluster == 0xFFFFFFFF {
|
if fs_info.last_known_avalible_cluster == 0xFFFFFFFF {
|
||||||
ret &= 4
|
ret &= 4
|
||||||
log.warn("Last known avalible cluster count unknown.\0")
|
log.warn("Last known avalible cluster count unknown.\0")
|
||||||
}
|
}
|
||||||
if fs_info.trail_signature != VALID_TRAIL_FS_INFO {
|
if fs_info.trail_signature != VALID_TRAIL_FS_INFO {
|
||||||
ret &= 8
|
ret &= 8
|
||||||
log.warn("Invalid trailing signature in FSInfo.\0")
|
log.warn("Invalid trailing signature in FSInfo.\0")
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret
|
new := fn(): FSInfo {
|
||||||
}
|
lead_reserved := @as([u8; 480], idk)
|
||||||
|
trail_reserved := @as([u8; 12], idk)
|
||||||
new_fs_info := fn(): FSInfo {
|
return FSInfo.(
|
||||||
lead_reserved := @as([u8; 480], idk)
|
VALID_LEAD_FS_INFO,
|
||||||
trail_reserved := @as([u8; 12], idk)
|
lead_reserved,
|
||||||
return FSInfo.(
|
0,
|
||||||
VALID_LEAD_FS_INFO,
|
0,
|
||||||
lead_reserved,
|
trail_reserved,
|
||||||
0,
|
VALID_TRAIL_FS_INFO,
|
||||||
0,
|
)
|
||||||
trail_reserved,
|
}
|
||||||
VALID_TRAIL_FS_INFO,
|
|
||||||
)
|
|
||||||
}
|
}
|
|
@ -2,24 +2,25 @@ Date := struct {
|
||||||
year: u16,
|
year: u16,
|
||||||
month: u16,
|
month: u16,
|
||||||
day: u16,
|
day: u16,
|
||||||
|
|
||||||
|
compress_date := fn(year: u16, month: u16, day: u16): u16 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
decompress_date := fn(date: u16): Date {
|
||||||
|
return Date.(0, 0, 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Time := struct {
|
Time := struct {
|
||||||
hour: u16,
|
hour: u16,
|
||||||
minutes: u16,
|
minutes: u16,
|
||||||
seconds: u16,
|
seconds: u16,
|
||||||
}
|
|
||||||
|
|
||||||
compress_date := fn(year: u16, month: u16, day: u16): u16 {
|
compress_time := fn(hour: u16, minutes: u16, seconds: u16): u16 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
decompress_date := fn(date: u16): Date {
|
|
||||||
return Date.(0, 0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
compress_time := fn(hour: u16, minutes: u16, seconds: u16): u16 {
|
decompress_time := fn(time: u16): Time {
|
||||||
return 0
|
return Time.(0, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
decompress_time := fn(time: u16): Time {
|
|
||||||
return Time.(0, 0, 0)
|
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ datetime := @use("datetime.hb")
|
||||||
directory := @use("file.hb")
|
directory := @use("file.hb")
|
||||||
bios_parameter_block := @use("bios_parameter_block.hb");
|
bios_parameter_block := @use("bios_parameter_block.hb");
|
||||||
.{bpb_sanity_check, ebr_sanity_check, fs_info_sanity_check} := bios_parameter_block;
|
.{bpb_sanity_check, ebr_sanity_check, fs_info_sanity_check} := bios_parameter_block;
|
||||||
.{new_bpb, new_ebr, new_fs_info} := bios_parameter_block
|
.{BiosParameterBlock, ExtendedBootRecord, FSInfo} := bios_parameter_block
|
||||||
|
|
||||||
FAT12_THRESHOLD := 4085
|
FAT12_THRESHOLD := 4085
|
||||||
FAT16_THRESHOLD := 65525
|
FAT16_THRESHOLD := 65525
|
||||||
|
@ -29,9 +29,9 @@ calculate_fat_type := fn(sector_size: uint, total_clusters: uint): uint {
|
||||||
}
|
}
|
||||||
|
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
bpb := new_bpb()
|
bpb := BiosParameterBlock.new()
|
||||||
ebr := new_ebr()
|
ebr := ExtendedBootRecord.new()
|
||||||
fsi := new_fs_info()
|
fsi := FSInfo.new()
|
||||||
|
|
||||||
fat_type := calculate_fat_type(1, 100)
|
fat_type := calculate_fat_type(1, 100)
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ main := fn(): int {
|
||||||
log.warn("filesystem_fat32 driver only supports Fat32.\0")
|
log.warn("filesystem_fat32 driver only supports Fat32.\0")
|
||||||
}
|
}
|
||||||
|
|
||||||
bsc := bpb_sanity_check(bpb)
|
bsc := bpb.sanity_check()
|
||||||
esc := ebr_sanity_check(ebr)
|
esc := ebr.sanity_check()
|
||||||
fssc := fs_info_sanity_check(fsi)
|
fssc := fsi.sanity_check()
|
||||||
|
|
||||||
msg_type := 0
|
msg_type := 0
|
||||||
|
|
||||||
|
|
23
sysdata/programs/ps2_driver/README.md
Normal file
23
sysdata/programs/ps2_driver/README.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Unified PS/2 Driver
|
||||||
|
|
||||||
|
Te entire thing is held together inspite
|
||||||
|
|
||||||
|
## !!Assumptions!!
|
||||||
|
Anyone who works on this should work to keep this list as small as possible/remove as many of these as possible.
|
||||||
|
- Bit 5 of the response form 0x64 indicates which port the data is coming from. (Not true on all systems)
|
||||||
|
- A parity or timeout error never occurs.
|
||||||
|
- PS/2 controller exists.
|
||||||
|
- Both PS/2 ports being broken doesn't need handling.
|
||||||
|
- One PS/2 port being broken doesn't need special attention.
|
||||||
|
- PS/2 controller doesn't need to perform a self-check.
|
||||||
|
- These DeviceIDs never exist:
|
||||||
|
- 0xFFFD
|
||||||
|
- 0xFFFE
|
||||||
|
- 0xFFFF
|
||||||
|
- 0x01xx
|
||||||
|
- 0x03xx
|
||||||
|
- 0x04xx
|
||||||
|
- Literally all PS/2 keyboards can be handeled the exact same way. We have the capability for detecting different keyboard types, I just don't bother with it because that would litreally take months to get working.
|
||||||
|
- The device doesn't send any data while we're waiting for an `ACK`.
|
||||||
|
|
||||||
|
Supporting mice in the keyboard port and vice versa was a ***bad*** idea, but I do not regret it because it means we're "superior" to real world operating systems.
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "processes"
|
name = "ps2_driver"
|
||||||
authors = ["koniifer"]
|
authors = ["Peony"]
|
||||||
|
|
||||||
[dependants.libraries]
|
[dependants.libraries]
|
||||||
|
|
26
sysdata/programs/ps2_driver/src/bits.hb
Normal file
26
sysdata/programs/ps2_driver/src/bits.hb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
//Do not question.
|
||||||
|
|
||||||
|
$bit0 := fn(value: u8): bool {
|
||||||
|
return (value & 0x1) > 0
|
||||||
|
}
|
||||||
|
$bit1 := fn(value: u8): bool {
|
||||||
|
return (value & 0x2) > 0
|
||||||
|
}
|
||||||
|
$bit2 := fn(value: u8): bool {
|
||||||
|
return (value & 0x4) > 0
|
||||||
|
}
|
||||||
|
$bit3 := fn(value: u8): bool {
|
||||||
|
return (value & 0x8) > 0
|
||||||
|
}
|
||||||
|
$bit4 := fn(value: u8): bool {
|
||||||
|
return (value & 0x10) > 0
|
||||||
|
}
|
||||||
|
$bit5 := fn(value: u8): bool {
|
||||||
|
return (value & 0x20) > 0
|
||||||
|
}
|
||||||
|
$bit6 := fn(value: u8): bool {
|
||||||
|
return (value & 0x40) > 0
|
||||||
|
}
|
||||||
|
$bit7 := fn(value: u8): bool {
|
||||||
|
return (value & 0x80) > 0
|
||||||
|
}
|
101
sysdata/programs/ps2_driver/src/controller.hb
Normal file
101
sysdata/programs/ps2_driver/src/controller.hb
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
.{memory, log} := @use("../../../libraries/stn/src/lib.hb");
|
||||||
|
.{bit0, bit1, bit5, bit6, bit7} := @use("bits.hb");
|
||||||
|
.{Port, PORT_AT_STARTUP} := @use("port.hb")
|
||||||
|
|
||||||
|
port1 := @as(Port, PORT_AT_STARTUP)
|
||||||
|
port2 := @as(Port, PORT_AT_STARTUP)
|
||||||
|
|
||||||
|
//wiki.osdev.org/"8042"_PS/2_Controller#PS/2_Controller_IO_Ports
|
||||||
|
$CONTROLLER_PORT := 0x64
|
||||||
|
$DATA_PORT := 0x60
|
||||||
|
|
||||||
|
$disable_port1 := fn(): void memory.outb(CONTROLLER_PORT, 0xAD)
|
||||||
|
$enable_port1 := fn(): void memory.outb(CONTROLLER_PORT, 0xAE)
|
||||||
|
$disable_port2 := fn(): void memory.outb(CONTROLLER_PORT, 0xA7)
|
||||||
|
$enable_port2 := fn(): void memory.outb(CONTROLLER_PORT, 0xA8)
|
||||||
|
|
||||||
|
test_port1 := fn(): bool {
|
||||||
|
memory.outb(CONTROLLER_PORT, 0xAB)
|
||||||
|
loop if has_input(get_info()) break
|
||||||
|
input := get_input()
|
||||||
|
return input == 0x0
|
||||||
|
}
|
||||||
|
|
||||||
|
test_port2 := fn(): bool {
|
||||||
|
memory.outb(CONTROLLER_PORT, 0xA9)
|
||||||
|
loop if has_input(get_info()) break
|
||||||
|
input := get_input()
|
||||||
|
return input == 0x0
|
||||||
|
}
|
||||||
|
|
||||||
|
get_config_byte := fn(): u8 {
|
||||||
|
memory.outb(CONTROLLER_PORT, 0x20)
|
||||||
|
loop if has_input(get_info()) break
|
||||||
|
return get_input()
|
||||||
|
}
|
||||||
|
|
||||||
|
Info := struct {d: u8}
|
||||||
|
|
||||||
|
$get_info := fn(): Info return .(memory.inb(CONTROLLER_PORT))
|
||||||
|
//inline when can
|
||||||
|
has_input := fn(info: Info): bool return bit0(info.d)
|
||||||
|
can_send := fn(info: Info): bool return bit1(info.d) == false
|
||||||
|
timed_out := fn(info: Info): bool return bit6(info.d)
|
||||||
|
check_parity := fn(info: Info): bool return bit7(info.d)
|
||||||
|
get_port := fn(info: Info): ^Port {
|
||||||
|
if bit5(info.d) {
|
||||||
|
return &port2
|
||||||
|
} else {
|
||||||
|
return &port1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//T
|
||||||
|
port2_ptr := &port2
|
||||||
|
send_byte := fn(port: ^Port, byte: u8): void {
|
||||||
|
if port == port2_ptr {
|
||||||
|
memory.outb(CONTROLLER_PORT, 0xD4)
|
||||||
|
}
|
||||||
|
loop if can_send(get_info()) break
|
||||||
|
memory.outb(DATA_PORT, byte)
|
||||||
|
}
|
||||||
|
|
||||||
|
$get_input := fn(): u8 return memory.inb(DATA_PORT)
|
||||||
|
$write_out := fn(data: u8): void memory.outb(DATA_PORT, data)
|
||||||
|
|
||||||
|
flush_input := fn(): void {
|
||||||
|
loop if has_input(get_info()) == false break else get_info()
|
||||||
|
}
|
||||||
|
|
||||||
|
init := fn(): void {
|
||||||
|
disable_port1()
|
||||||
|
disable_port2()
|
||||||
|
//Disables ports to make sure that they won't interfere with the setup process.
|
||||||
|
|
||||||
|
flush_input()
|
||||||
|
|
||||||
|
enable_port2()
|
||||||
|
port2.exists = bit5(@inline(get_config_byte)) == false
|
||||||
|
disable_port2()
|
||||||
|
|
||||||
|
flush_input()
|
||||||
|
|
||||||
|
port1.exists = test_port1()
|
||||||
|
|
||||||
|
if port2.exists {
|
||||||
|
port2.exists = test_port2()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (port1.exists | port2.exists) == false {
|
||||||
|
log.error("No ports detected! No input will be processed! Cannot handle this!\0")
|
||||||
|
}
|
||||||
|
|
||||||
|
if port1.exists {
|
||||||
|
log.info("Port 1 exists.\0")
|
||||||
|
enable_port1()
|
||||||
|
}
|
||||||
|
if port2.exists {
|
||||||
|
log.info("Port 2 exists.\0")
|
||||||
|
enable_port2()
|
||||||
|
}
|
||||||
|
}
|
15
sysdata/programs/ps2_driver/src/devices.hb
Normal file
15
sysdata/programs/ps2_driver/src/devices.hb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
DeviceID := struct {value: u16}
|
||||||
|
|
||||||
|
$MOUSE_3_BUTTON := DeviceID.(0x0)
|
||||||
|
$MOUSE_SCROLLWHEEL := DeviceID.(0x3)
|
||||||
|
$MOUSE_5_BUTTON := DeviceID.(0x4)
|
||||||
|
$KEYBOARD_SPACESAVER := DeviceID.(0x84AB)
|
||||||
|
$KEYBOARD_122_KEY := DeviceID.(0x86AB)
|
||||||
|
$KEYBOARD_JAPANESE_G := DeviceID.(0x90AB)
|
||||||
|
$KEYBOARD_JAPANESE_P := DeviceID.(0x91AB)
|
||||||
|
$KEYBOARD_JAPANESE_A := DeviceID.(0x92AB)
|
||||||
|
$KEYBOARD_NCD_SUN := DeviceID.(0xA1AC)
|
||||||
|
|
||||||
|
$MOUSE_INIT_1 := DeviceID.(0xFFFD)
|
||||||
|
$MOUSE_INIT_2 := DeviceID.(0xFFFE)
|
||||||
|
$NO_DEVICE := DeviceID.(0xFFFF)
|
152
sysdata/programs/ps2_driver/src/main.hb
Normal file
152
sysdata/programs/ps2_driver/src/main.hb
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
.{memory, log, buffer, string} := @use("../../../libraries/stn/src/lib.hb");
|
||||||
|
.{MouseEvent} := @use("../../../libraries/intouch/src/lib.hb").events;
|
||||||
|
.{bit0, bit1, bit2, bit3, bit4} := @use("bits.hb")
|
||||||
|
devices := @use("devices.hb")
|
||||||
|
controller := @use("controller.hb");
|
||||||
|
.{Info, Port} := controller
|
||||||
|
mouse := @use("mouse.hb")
|
||||||
|
format_page := memory.dangling(u8)
|
||||||
|
|
||||||
|
mouse_buffer := 0
|
||||||
|
keyboard_buffer := 0
|
||||||
|
info := Info.(0)
|
||||||
|
|
||||||
|
send_command := fn(port: ^Port, byte: u8): void {
|
||||||
|
tries := 3
|
||||||
|
loop if tries == 0 break else {
|
||||||
|
controller.send_byte(port, byte)
|
||||||
|
loop {
|
||||||
|
info = controller.get_info()
|
||||||
|
if controller.has_input(info) == false {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
input := controller.get_input()
|
||||||
|
if controller.get_port(info) != port {
|
||||||
|
if check_complete(port) == false {
|
||||||
|
port.packet[port.packet_length] = input
|
||||||
|
port.packet_length += 1
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if input == 0xFA {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tries -= 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enable_streaming := fn(port: ^Port): void {
|
||||||
|
@inline(send_command, port, 0xF4)
|
||||||
|
}
|
||||||
|
|
||||||
|
process := fn(port: ^controller.Port): void {
|
||||||
|
if port.device.value < devices.MOUSE_5_BUTTON.value {
|
||||||
|
event := MouseEvent.(0, 0, false, false, false)
|
||||||
|
|
||||||
|
event.left = bit0(port.packet[0])
|
||||||
|
event.right = bit1(port.packet[0])
|
||||||
|
event.middle = bit2(port.packet[0])
|
||||||
|
|
||||||
|
event.x_change = @intcast(port.packet[1])
|
||||||
|
event.y_change = @intcast(port.packet[2])
|
||||||
|
|
||||||
|
buffer.write(MouseEvent, mouse_buffer, &event)
|
||||||
|
} else if port.device == devices.MOUSE_INIT_1 {
|
||||||
|
port.device.value = port.packet[0]
|
||||||
|
if port.device != devices.MOUSE_SCROLLWHEEL {
|
||||||
|
enable_streaming(port)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
port.device = devices.MOUSE_INIT_2
|
||||||
|
} else if port.device == devices.MOUSE_INIT_2 {
|
||||||
|
port.device.value = port.packet[0]
|
||||||
|
} else if port.device == devices.NO_DEVICE {
|
||||||
|
if port.packet_length == 1 {
|
||||||
|
port.device.value = port.packet[0]
|
||||||
|
enable_streaming(port)
|
||||||
|
//TODO: Upgrade mouse.
|
||||||
|
} else {
|
||||||
|
port.device.value = port.packet[1] | port.packet[0] << 8
|
||||||
|
enable_streaming(port)
|
||||||
|
}
|
||||||
|
log.info("Identified device!\0")
|
||||||
|
log.info(string.display_int(port.device.value, format_page, 16))
|
||||||
|
} else {
|
||||||
|
log.info("KEY PRESSED\0")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
check_complete := fn(port: ^controller.Port): bool {
|
||||||
|
last_value := port.packet[port.packet_length - 1]
|
||||||
|
if port.device == devices.NO_DEVICE {
|
||||||
|
if last_value == 0 | last_value == 3 | last_value == 4 {
|
||||||
|
return true
|
||||||
|
} else if port.packet_length == 2 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else if port.device == devices.MOUSE_3_BUTTON {
|
||||||
|
if port.packet_length == 3 return true
|
||||||
|
} else if port.device == devices.MOUSE_SCROLLWHEEL | port.device == devices.MOUSE_5_BUTTON {
|
||||||
|
if port.packet_length == 4 return true
|
||||||
|
} else {
|
||||||
|
if port.packet[0] == 0xE1 {
|
||||||
|
if port.packet_length == 6 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else if port.packet[0] != 0xE0 {
|
||||||
|
return true
|
||||||
|
} else if port.packet_length == 2 & port.packet[1] != 0x2A & port.packet[1] != 0xB7 {
|
||||||
|
return true
|
||||||
|
} else if port.packet_length == 4 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
main := fn(): void {
|
||||||
|
mouse_buffer = buffer.create("PS/2 Mouse\0")
|
||||||
|
format_page = memory.alloc(u8, 1024)
|
||||||
|
|
||||||
|
controller.init()
|
||||||
|
|
||||||
|
if controller.port1.exists {
|
||||||
|
//log.info("Port 1 exists.\0")
|
||||||
|
controller.send_byte(@bitcast(0), 0xF4)
|
||||||
|
}
|
||||||
|
if controller.port2.exists {
|
||||||
|
//controller.send_byte(&controller.port2, 0xF4)
|
||||||
|
}
|
||||||
|
|
||||||
|
loop {
|
||||||
|
info = controller.get_info()
|
||||||
|
|
||||||
|
if controller.timed_out(info) {
|
||||||
|
log.error("Timeout error! Cannot handle these!\0")
|
||||||
|
}
|
||||||
|
if controller.check_parity(info) {
|
||||||
|
log.error("Parity error! Cannot handle these!\0")
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if controller.has_input(info) {
|
||||||
|
port := controller.get_port(info)
|
||||||
|
if port.packet_length > 0 & check_complete(port) {
|
||||||
|
process(port)
|
||||||
|
}
|
||||||
|
input := controller.get_input()
|
||||||
|
/*if input == 0xAA & port.can_hot_plug {
|
||||||
|
port.device = devices.NO_DEVICE
|
||||||
|
controller.send_byte(port, 0xF4)
|
||||||
|
}*/
|
||||||
|
port.packet[port.packet_length] = input
|
||||||
|
port.packet_length += 1
|
||||||
|
if check_complete(port) {
|
||||||
|
process(port)
|
||||||
|
port.packet_length = 0
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
21
sysdata/programs/ps2_driver/src/mouse.hb
Normal file
21
sysdata/programs/ps2_driver/src/mouse.hb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
Button := struct {id: u8}
|
||||||
|
$LEFT_BUTTON := Button.(1)
|
||||||
|
$RIGHT_BUTTON := Button.(2)
|
||||||
|
$MIDDLE_BUTTON := Button.(4)
|
||||||
|
$BUTTON4 := Button.(8)
|
||||||
|
$BUTTON5 := Button.(16)
|
||||||
|
|
||||||
|
SampleRate := struct {value: u8}
|
||||||
|
$SR10 := SampleRate.(10)
|
||||||
|
$SR20 := SampleRate.(20)
|
||||||
|
$SR40 := SampleRate.(40)
|
||||||
|
$SR60 := SampleRate.(60)
|
||||||
|
$SR80 := SampleRate.(80)
|
||||||
|
$SR100 := SampleRate.(100)
|
||||||
|
$SR200 := SampleRate.(200)
|
||||||
|
|
||||||
|
Resolution := struct {value: u8}
|
||||||
|
$RES_1COUNT_PER_MM := Resolution.(0)
|
||||||
|
$RES_2COUNT_PER_MM := Resolution.(1)
|
||||||
|
$RES_4COUNT_PER_MM := Resolution.(2)
|
||||||
|
$RES_8COUNT_PER_MM := Resolution.(3)
|
21
sysdata/programs/ps2_driver/src/port.hb
Normal file
21
sysdata/programs/ps2_driver/src/port.hb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
.{DeviceID, NO_DEVICE} := @use("devices.hb")
|
||||||
|
|
||||||
|
State := struct {s: u8}
|
||||||
|
$Recive := State.(0)
|
||||||
|
$Reboot := State.(1)
|
||||||
|
|
||||||
|
Port := packed struct {
|
||||||
|
exists: bool,
|
||||||
|
device: DeviceID,
|
||||||
|
packet: [u8; 8],
|
||||||
|
packet_length: u8,
|
||||||
|
can_hot_plug: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
$PORT_AT_STARTUP := Port.(
|
||||||
|
true,
|
||||||
|
NO_DEVICE,
|
||||||
|
.(0, 0, 0, 0, 0, 0, 0, 0),
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
)
|
|
@ -1,3 +0,0 @@
|
||||||
# PS/2 Driver
|
|
||||||
|
|
||||||
This program is a simple driver to read keypresses from a PS/2 Keyboard Also will contain an abstraction for the PS/2 controller in general so the Mouse code will probably also live here...maybe
|
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "ps2_keyboard_driver"
|
|
||||||
authors = ["Talha Qamar"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,40 +0,0 @@
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb");
|
|
||||||
.{memory, log, buffer} := stn
|
|
||||||
|
|
||||||
intouch := @use("../../../libraries/intouch/src/lib.hb");
|
|
||||||
.{KeyEvent} := intouch
|
|
||||||
|
|
||||||
send_byte := fn(byte: u8): u8 {
|
|
||||||
memory.outb(96, byte)
|
|
||||||
return memory.inb(96)
|
|
||||||
}
|
|
||||||
|
|
||||||
main := fn(): int {
|
|
||||||
buf := buffer.create("PS/2 Keyboard\0")
|
|
||||||
_ = send_byte(238)
|
|
||||||
log.info("PS/2 Driver Loaded\0")
|
|
||||||
|
|
||||||
if send_byte(238) == 238 {
|
|
||||||
log.info("PS/2 Keyboard Echoed\0")
|
|
||||||
}
|
|
||||||
|
|
||||||
if send_byte(244) == 250 {
|
|
||||||
log.info("Enabled scanning\0")
|
|
||||||
}
|
|
||||||
|
|
||||||
prev_input := 250
|
|
||||||
loop {
|
|
||||||
loop if (memory.inb(0x64) & 0x20) == 0x20 break
|
|
||||||
|
|
||||||
input := memory.inb(96)
|
|
||||||
|
|
||||||
if input == prev_input {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
prev_input = input
|
|
||||||
kevent := KeyEvent.(false, true, input)
|
|
||||||
|
|
||||||
buffer.write(KeyEvent, buf, &kevent)
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
1
sysdata/programs/rtc_driver/README.md
Normal file
1
sysdata/programs/rtc_driver/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# rtc_driver
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "alloc_test"
|
name = "rtc_driver"
|
||||||
authors = [""]
|
authors = [""]
|
||||||
|
|
||||||
[dependants.libraries]
|
[dependants.libraries]
|
12
sysdata/programs/rtc_driver/src/main.hb
Normal file
12
sysdata/programs/rtc_driver/src/main.hb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
stn := @use("../../../libraries/stn/src/lib.hb");
|
||||||
|
.{sleep, log, memory} := stn
|
||||||
|
|
||||||
|
main := fn(): int {
|
||||||
|
loop {
|
||||||
|
log.info("BEFORE\0")
|
||||||
|
sleep.sleep_until_interrupt(8)
|
||||||
|
log.info("AFTER\0")
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "serial_driver_test"
|
|
||||||
authors = ["able"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,20 +0,0 @@
|
||||||
.{string, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
|
||||||
|
|
||||||
log_info := fn(): void {
|
|
||||||
a := buffer.search("XNumber\0")
|
|
||||||
if a == 0 {
|
|
||||||
} else {
|
|
||||||
msg := "XABC\0"
|
|
||||||
// inline is broked
|
|
||||||
// msg_length := @inline(string.length, msg)
|
|
||||||
msg_length := 5
|
|
||||||
@as(void, @eca(3, a, msg, msg_length))
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
main := fn(): int {
|
|
||||||
log_info()
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -31,7 +31,7 @@ main := fn(): int {
|
||||||
mouse_x := 100
|
mouse_x := 100
|
||||||
mouse_y := 100
|
mouse_y := 100
|
||||||
|
|
||||||
text_label := Label.new_label("Hi\0")
|
text_label := Label.new_label("Hi\0", 1024)
|
||||||
text_label.set_color(sunset.server.DECO_COLOUR, render.black)
|
text_label.set_color(sunset.server.DECO_COLOUR, render.black)
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -91,8 +91,8 @@ main := fn(): int {
|
||||||
|
|
||||||
// Mouse cursor
|
// Mouse cursor
|
||||||
{
|
{
|
||||||
render.put_filled_rect(screen, .(mouse_x, mouse_y), .(20, 20), sunset.server.DECO_COLOUR_DARKER)
|
render.put_filled_circle(screen, .(mouse_x, mouse_y), 10, sunset.server.DECO_COLOUR_DARKER)
|
||||||
render.put_rect(screen, .(mouse_x, mouse_y), .(20, 20), sunset.server.DECO_COLOUR)
|
render.put_circle(screen, .(mouse_x, mouse_y), 10, sunset.server.DECO_COLOUR)
|
||||||
}
|
}
|
||||||
|
|
||||||
render.sync(screen)
|
render.sync(screen)
|
||||||
|
|
2
sysdata/programs/tempfs/README.md
Normal file
2
sysdata/programs/tempfs/README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# tempfs
|
||||||
|
A ram backed filesystem for ableOS.
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "dt_buffer_test"
|
name = "tempfs"
|
||||||
authors = ["able"]
|
authors = [""]
|
||||||
|
|
||||||
[dependants.libraries]
|
[dependants.libraries]
|
||||||
|
|
12
sysdata/programs/tempfs/src/main.hb
Normal file
12
sysdata/programs/tempfs/src/main.hb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
stn := @use("../../../libraries/stn/src/lib.hb");
|
||||||
|
.{sleep} := stn
|
||||||
|
|
||||||
|
main := fn(): int {
|
||||||
|
tmpfs_buffer := buffer.create("TmpFS\0")
|
||||||
|
loop {
|
||||||
|
// TODO
|
||||||
|
// sleep.sleep_until_buffer(tmpfs_buffer)
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
11
sysdata/programs/test/meta.toml
Normal file
11
sysdata/programs/test/meta.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "test"
|
||||||
|
authors = ["koniifer", "able"]
|
||||||
|
|
||||||
|
[dependants.libraries]
|
||||||
|
|
||||||
|
[dependants.binaries]
|
||||||
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
command = "hblang src/main.hb"
|
7
sysdata/programs/test/src/main.hb
Normal file
7
sysdata/programs/test/src/main.hb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
stn := @use("./tests/stn/lib.hb")
|
||||||
|
serial_driver := @use("./tests/serial_driver.hb")
|
||||||
|
|
||||||
|
main := fn(): uint {
|
||||||
|
// return serial_driver.test()
|
||||||
|
return stn.sleep.test()
|
||||||
|
}
|
18
sysdata/programs/test/src/tests/serial_driver.hb
Normal file
18
sysdata/programs/test/src/tests/serial_driver.hb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
.{string, buffer} := @use("../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
log_info := fn(): void {
|
||||||
|
a := buffer.search("XNumber\0")
|
||||||
|
if a == 0 {
|
||||||
|
} else {
|
||||||
|
msg := "XABC\0"
|
||||||
|
msg_length := string.length(msg)
|
||||||
|
@eca(3, a, msg, msg_length)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
test := fn(): uint {
|
||||||
|
log_info()
|
||||||
|
return 0
|
||||||
|
}
|
30
sysdata/programs/test/src/tests/stn/allocators.hb
Normal file
30
sysdata/programs/test/src/tests/stn/allocators.hb
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
stn := @use("../../../../../libraries/stn/src/lib.hb");
|
||||||
|
.{allocators, panic, log} := stn
|
||||||
|
|
||||||
|
AStruct := struct {
|
||||||
|
a_field: u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
test := fn(): uint {
|
||||||
|
alloc := allocators.FakeAlloc.init()
|
||||||
|
astruct := alloc.alloc(AStruct, 2)
|
||||||
|
if astruct.ptr != null {
|
||||||
|
panic.panic("FakeAlloc actually allocated.")
|
||||||
|
}
|
||||||
|
alloc.dealloc(&astruct.ptr, AStruct, 2)
|
||||||
|
alloc.deinit()
|
||||||
|
|
||||||
|
balloc := allocators.BlockAlloc.init()
|
||||||
|
defer {
|
||||||
|
balloc.deinit()
|
||||||
|
}
|
||||||
|
bstruct := balloc.alloc(AStruct, 2)
|
||||||
|
if bstruct.ptr == null {
|
||||||
|
log.info("Hi\0")
|
||||||
|
// panic.panic("BlockAlloc actually didn't allocate.")
|
||||||
|
} else {
|
||||||
|
log.info("Allocator functioned.\0")
|
||||||
|
}
|
||||||
|
balloc.dealloc(&bstruct.ptr, AStruct, 2)
|
||||||
|
return 0
|
||||||
|
}
|
18
sysdata/programs/test/src/tests/stn/dt.hb
Normal file
18
sysdata/programs/test/src/tests/stn/dt.hb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
.{dt, memory, string, log} := @use("../../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
test := fn(): uint {
|
||||||
|
buffer := memory.request_page(1)
|
||||||
|
|
||||||
|
log.info(string.display_int(dt.get(int, "framebuffer/fb0/width\0"), buffer, 10))
|
||||||
|
string.clear(buffer)
|
||||||
|
|
||||||
|
log.info(string.display_int(dt.get(int, "cpu/cpu0/architecture\0"), buffer, 10))
|
||||||
|
string.clear(buffer)
|
||||||
|
|
||||||
|
// 0 -> memory mapped
|
||||||
|
// 1 -> port mapped
|
||||||
|
|
||||||
|
log.info(string.display_int(dt.get(int, "serial_ports/sp0/mapping\0"), buffer, 10))
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
.{hashers, log, memory, string} := @use("../../../libraries/stn/src/lib.hb")
|
.{hashers, log, memory, string} := @use("../../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
main := fn(): void {
|
test := fn(): uint {
|
||||||
buffer := memory.request_page(1)
|
buffer := memory.request_page(1)
|
||||||
target := "abcdefghijklmnop\0"
|
target := "abcdefghijklmnop\0"
|
||||||
strings := [^u8].("abcdefshijklmnop\0", "abcdefghijklnnop\0", "abcdefshijklmnop\0", "abcdefghijklmnop\0", "abcdefghijflmnop\0", "dbcdefghijklmnop\0", "abcdefghijklmnop\0")
|
strings := [^u8].("abcdefshijklmnop\0", "abcdefghijklnnop\0", "abcdefshijklmnop\0", "abcdefghijklmnop\0", "abcdefghijflmnop\0", "dbcdefghijklmnop\0", "abcdefghijklmnop\0")
|
||||||
|
@ -28,4 +28,5 @@ main := fn(): void {
|
||||||
log.debug(string.display_int(@bitcast(d), buffer, 16))
|
log.debug(string.display_int(@bitcast(d), buffer, 16))
|
||||||
string.clear(buffer)
|
string.clear(buffer)
|
||||||
}
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
5
sysdata/programs/test/src/tests/stn/lib.hb
Normal file
5
sysdata/programs/test/src/tests/stn/lib.hb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
hashers := @use("./hashers.hb")
|
||||||
|
allocators := @use("./allocators.hb")
|
||||||
|
sleep := @use("./sleep.hb")
|
||||||
|
dt := @use("./dt.hb")
|
||||||
|
process := @use("./process.hb")
|
|
@ -1,8 +1,8 @@
|
||||||
.{process, log, string, memory} := @use("../../../libraries/stn/src/lib.hb")
|
.{process, log, string, memory} := @use("../../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
exe := @embed("./hello_world_and_spin.hbf")
|
exe := @embed("./assets/hello_world_and_spin.hbf")
|
||||||
|
|
||||||
main := fn(): void {
|
test := fn(): uint {
|
||||||
buf := "\0\0\0\0\0\0\0"
|
buf := "\0\0\0\0\0\0\0"
|
||||||
loop {
|
loop {
|
||||||
log.info(
|
log.info(
|
||||||
|
@ -16,4 +16,5 @@ main := fn(): void {
|
||||||
i := 0
|
i := 0
|
||||||
loop if i == 1000000 break else i += 1
|
loop if i == 1000000 break else i += 1
|
||||||
}
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
8
sysdata/programs/test/src/tests/stn/sleep.hb
Normal file
8
sysdata/programs/test/src/tests/stn/sleep.hb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
.{sleep, log} := @use("../../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
test := fn(): uint {
|
||||||
|
log.info("BEFORE\0")
|
||||||
|
sleep.sleep_until_interrupt(32)
|
||||||
|
log.info("AFTER\0")
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "timer_test"
|
|
||||||
authors = ["Talha Qamar"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,8 +0,0 @@
|
||||||
sleep := @use("../../../libraries/stn/src/sleep.hb")
|
|
||||||
log := @use("../../../libraries/stn/src/log.hb")
|
|
||||||
|
|
||||||
main := fn(): int {
|
|
||||||
log.info("BEFORE\0")
|
|
||||||
sleep.sleep_until_interrupt(32)
|
|
||||||
log.info("AFTER\0")
|
|
||||||
}
|
|
|
@ -28,32 +28,20 @@ resolution = "1024x768x24"
|
||||||
# [boot.limine.ableos.modules.horizon]
|
# [boot.limine.ableos.modules.horizon]
|
||||||
# path = "boot:///horizon.hbf"
|
# path = "boot:///horizon.hbf"
|
||||||
|
|
||||||
# path = "boot:///ps2_mouse_driver.hbf"
|
[boot.limine.ableos.modules.ps2_mouse_driver]
|
||||||
# [boot.limine.ableos.modules.ps2_mouse_driver]
|
path = "boot:///ps2_mouse_driver.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.ps2_keyboard_driver]
|
# [boot.limine.ableos.modules.ps2_keyboard_driver]
|
||||||
# path = "boot:///ps2_keyboard_driver.hbf"
|
# path = "boot:///ps2_keyboard_driver.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.timer_test]
|
# [boot.limine.ableos.modules.ps2_driver]
|
||||||
path = "boot:///timer_test.hbf"
|
# path = "boot:///ps2_driver.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.sunset_client]
|
# [boot.limine.ableos.modules.sunset_client]
|
||||||
# path = "boot:///sunset_client.hbf"
|
# path = "boot:///sunset_client.hbf"
|
||||||
#
|
|
||||||
# [boot.limine.ableos.modules.sunset_client_2]
|
|
||||||
# path = "boot:///sunset_client_2.hbf"
|
|
||||||
#
|
|
||||||
# [boot.limine.ableos.modules.sdoom]
|
|
||||||
# path = "boot:///sdoom.hbf"
|
|
||||||
#
|
|
||||||
# [boot.limine.ableos.modules.sunset_server]
|
|
||||||
# path = "boot:///sunset_server.hbf"
|
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.pcspkr]
|
[boot.limine.ableos.modules.sunset_server]
|
||||||
# path = "boot:///pcspkr.hbf"
|
path = "boot:///sunset_server.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.alloc_test]
|
[boot.limine.ableos.modules.ablefetch]
|
||||||
# path = "boot:///alloc_test.hbf"
|
path = "boot:///ablefetch.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.hash_test]
|
|
||||||
# path = "boot:///hash_test.hbf"
|
|
||||||
|
|
40
todo.md
40
todo.md
|
@ -1,40 +0,0 @@
|
||||||
@konii
|
|
||||||
Windowing System
|
|
||||||
Rendering
|
|
||||||
|
|
||||||
@able
|
|
||||||
Windowing System
|
|
||||||
Interrupt Forwarding
|
|
||||||
|
|
||||||
|
|
||||||
@peony
|
|
||||||
PS/2
|
|
||||||
XYZ
|
|
||||||
|
|
||||||
|
|
||||||
@kodin
|
|
||||||
AIDL AbleOS Interface Description Language
|
|
||||||
UI-SEXPR lispy ui decl language
|
|
||||||
|
|
||||||
@morshy
|
|
||||||
Simple Userland Allocator
|
|
||||||
|
|
||||||
@funky
|
|
||||||
Kernel Testing Framework (A rust framework for testing the kernel)
|
|
||||||
|
|
||||||
@unassigned
|
|
||||||
FileIO (Fat32)
|
|
||||||
DiskIO (Undecided Disk type)
|
|
||||||
Proper Memory Protection
|
|
||||||
Channels (Two buffers bundled together to form two way communication)
|
|
||||||
Userland Testing Framework (An hblang framework for testing the userspace)
|
|
||||||
PCI/E (Honestly I have no fucking clue whats going on with PCI or why userland cant properly read it)
|
|
||||||
Kernel Reimpl (Do not you dare think about this yet its only here as an option to show goals)
|
|
||||||
|
|
||||||
AbleOS Compiler Collection
|
|
||||||
acc-asm
|
|
||||||
hblang^2 (hblang compiler in hblang)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue