Compare commits

..

No commits in common. "b427ae1c274489cacade5e4a8878dd5463924e39" and "a5cab167c5e9473ff24c5b50bf23fae4aa1d3e2b" have entirely different histories.

35 changed files with 328 additions and 288 deletions

View file

@ -1,2 +1,2 @@
[alias] [alias]
repbuild = "run --manifest-path ./repbuild/Cargo.toml -r --" repbuild = "run --manifest-path ./repbuild/Cargo.toml --"

190
Cargo.lock generated
View file

@ -29,9 +29,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.7.8" version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"once_cell", "once_cell",
@ -40,14 +40,16 @@ dependencies = [
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.8.11" version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"const-random",
"getrandom",
"once_cell", "once_cell",
"version_check", "version_check",
"zerocopy 0.7.34", "zerocopy 0.7.18",
] ]
[[package]] [[package]]
@ -191,6 +193,26 @@ dependencies = [
"toml 0.5.9", "toml 0.5.9",
] ]
[[package]]
name = "const-random"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
dependencies = [
"const-random-macro",
]
[[package]]
name = "const-random-macro"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
dependencies = [
"getrandom",
"once_cell",
"tiny-keccak",
]
[[package]] [[package]]
name = "convert_case" name = "convert_case"
version = "0.4.0" version = "0.4.0"
@ -232,6 +254,12 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]] [[package]]
name = "derive_more" name = "derive_more"
version = "0.99.17" version = "0.99.17"
@ -413,7 +441,7 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [ dependencies = [
"ahash 0.7.8", "ahash 0.7.7",
] ]
[[package]] [[package]]
@ -422,42 +450,35 @@ version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
dependencies = [ dependencies = [
"ahash 0.8.11", "ahash 0.8.6",
"allocator-api2", "allocator-api2",
] ]
[[package]] [[package]]
name = "hbbytecode" name = "hbasm"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#796a826cc5e99af341e0e0980c6f0b933896549c"
[[package]]
name = "hbbytecode"
version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
[[package]]
name = "hblang"
version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
dependencies = [ dependencies = [
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", "paste",
"rhai",
"with_builtin_macros",
]
[[package]]
name = "hbbytecode"
version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/holey-bytes#247b2c6614ab81925e96744398632e3b7bb8b7ad"
dependencies = [
"paste",
"with_builtin_macros",
] ]
[[package]] [[package]]
name = "hbvm" name = "hbvm"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07" source = "git+https://git.ablecorp.us/ableos/holey-bytes#247b2c6614ab81925e96744398632e3b7bb8b7ad"
dependencies = [ dependencies = [
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", "hbbytecode",
]
[[package]]
name = "hbvm"
version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
dependencies = [
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)",
] ]
[[package]] [[package]]
@ -581,6 +602,15 @@ dependencies = [
"hashbrown 0.12.3", "hashbrown 0.12.3",
] ]
[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.9.0" version = "2.9.0"
@ -612,7 +642,7 @@ dependencies = [
"derive_more", "derive_more",
"embedded-graphics", "embedded-graphics",
"hashbrown 0.14.2", "hashbrown 0.14.2",
"hbvm 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)", "hbvm",
"kiam", "kiam",
"limine", "limine",
"log", "log",
@ -806,7 +836,7 @@ dependencies = [
"derive_more", "derive_more",
"error-stack", "error-stack",
"fatfs", "fatfs",
"hblang", "hbasm",
"reqwest", "reqwest",
"str-reader", "str-reader",
"toml 0.5.11", "toml 0.5.11",
@ -852,6 +882,34 @@ dependencies = [
"winreg", "winreg",
] ]
[[package]]
name = "rhai"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a7d88770120601ba1e548bb6bc2a05019e54ff01b51479e38e64ec3b59d4759"
dependencies = [
"ahash 0.8.6",
"bitflags 2.4.1",
"instant",
"num-traits",
"once_cell",
"rhai_codegen",
"smallvec",
"smartstring",
"thin-vec",
]
[[package]]
name = "rhai_codegen"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59aecf17969c04b9c0c5d21f6bc9da9fec9dd4980e64d1871443a476589d8c86"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
]
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.17.5" version = "0.17.5"
@ -1004,6 +1062,23 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "smallvec"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smartstring"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"
dependencies = [
"autocfg",
"static_assertions",
"version_check",
]
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.10" version = "0.4.10"
@ -1033,6 +1108,12 @@ dependencies = [
"lock_api", "lock_api",
] ]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "str-reader" name = "str-reader"
version = "0.1.2" version = "0.1.2"
@ -1082,6 +1163,21 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "thin-vec"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b"
[[package]]
name = "tiny-keccak"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
dependencies = [
"crunchy",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.6.0" version = "1.6.0"
@ -1470,6 +1566,26 @@ dependencies = [
"windows-sys", "windows-sys",
] ]
[[package]]
name = "with_builtin_macros"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a59d55032495429b87f9d69954c6c8602e4d3f3e0a747a12dea6b0b23de685da"
dependencies = [
"with_builtin_macros-proc_macros",
]
[[package]]
name = "with_builtin_macros-proc_macros"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15bd7679c15e22924f53aee34d4e448c45b674feb6129689af88593e129f8f42"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "x2apic" name = "x2apic"
version = "0.4.3" version = "0.4.3"
@ -1515,11 +1631,11 @@ dependencies = [
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.7.34" version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" checksum = "ede7d7c7970ca2215b8c1ccf4d4f354c4733201dfaaba72d44ae5b37472e4901"
dependencies = [ dependencies = [
"zerocopy-derive 0.7.34", "zerocopy-derive 0.7.18",
] ]
[[package]] [[package]]
@ -1535,9 +1651,9 @@ dependencies = [
[[package]] [[package]]
name = "zerocopy-derive" name = "zerocopy-derive"
version = "0.7.34" version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" checksum = "4b27b1bb92570f989aac0ab7e9cbfbacdd65973f7ee920d9f0e71ebac878fd0b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View file

@ -18,12 +18,12 @@ use {
}; };
pub fn handler(vm: &mut Vm) { pub fn handler(vm: &mut Vm) {
let ecall_number = vm.registers[2].cast::<u64>(); let r1 = vm.registers[1].cast::<u64>();
// debug!("Ecall number {:?}", ecall_number); // debug!("Ecall number {:?}", r1);
// trace!("Register dump: {:?}", vm.registers); // trace!("Register dump: {:?}", vm.registers);
match ecall_number { match r1 {
0 => { 0 => {
// TODO: explode computer // TODO: explode computer
// hello world ecall // hello world ecall
@ -34,7 +34,7 @@ pub fn handler(vm: &mut Vm) {
1 => { 1 => {
// Make buffer // Make buffer
let bounded = match vm.registers[3].cast::<u64>() { let bounded = match vm.registers[2].cast::<u64>() {
0 => false, 0 => false,
1 => true, 1 => true,
_ => { _ => {
@ -42,7 +42,7 @@ pub fn handler(vm: &mut Vm) {
} }
}; };
let length = vm.registers[4].cast::<u64>(); let length = vm.registers[3].cast::<u64>();
let mut buffs = IPC_BUFFERS.lock(); let mut buffs = IPC_BUFFERS.lock();
let abc; let abc;
@ -65,9 +65,13 @@ pub fn handler(vm: &mut Vm) {
} }
3 => { 3 => {
// Send a message to a buffer // Send a message to a buffer
let buffer_id = vm.registers[3].cast::<u64>(); let r2 = vm.registers[2].cast::<u64>();
let mem_addr = vm.registers[4].cast::<u64>(); let r3 = vm.registers[3].cast::<u64>();
let length = vm.registers[5].cast::<u64>() as usize; let r4 = vm.registers[4].cast::<u64>();
let buffer_id = r2;
let mem_addr = r3;
let length = r4 as usize;
trace!("IPC address: {:?}", mem_addr); trace!("IPC address: {:?}", mem_addr);
use alloc::vec::Vec; use alloc::vec::Vec;
@ -115,12 +119,12 @@ pub fn handler(vm: &mut Vm) {
} }
} }
4 => { 4 => {
let buffer_id = vm.registers[3].cast::<u64>(); let r2 = vm.registers[2].cast::<u64>();
let mut buffs = IPC_BUFFERS.lock(); let mut buffs = IPC_BUFFERS.lock();
let mut buff = buffs.get_mut(&buffer_id).unwrap(); let mut buff = buffs.get_mut(&r2).unwrap();
let msg = buff.pop(); let msg = buff.pop();
info!("Recieve {:?} from Buffer({})", msg, buffer_id); info!("Recieve {:?} from Buffer({})", msg, r2);
} }
5 => { 5 => {
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
@ -137,7 +141,7 @@ pub fn handler(vm: &mut Vm) {
} }
// 5 // 5
_ => { _ => {
log::error!("Syscall unknown {:?}{:?}", ecall_number, vm.registers); log::error!("Syscall unknown {:?}{:?}", r1, vm.registers);
} }
} }
} }

View file

@ -12,7 +12,6 @@
ptr_sub_ptr, ptr_sub_ptr,
custom_test_frameworks, custom_test_frameworks,
naked_functions, naked_functions,
pointer_is_aligned_to
)] )]
#![allow(dead_code)] #![allow(dead_code)]
#![test_runner(crate::test_runner)] #![test_runner(crate::test_runner)]

View file

@ -1,6 +1,6 @@
{ {
"llvm-target": "x86_64-unknown-none", "llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"arch": "x86_64", "arch": "x86_64",
"target-endian": "little", "target-endian": "little",
"target-pointer-width": "64", "target-pointer-width": "64",

View file

@ -9,8 +9,8 @@ derive_more = "0.99"
error-stack = "0.4" error-stack = "0.4"
fatfs = "0.3" fatfs = "0.3"
toml = "0.5.2" toml = "0.5.2"
# hbasm.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git" hbasm.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
hblang.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
[dependencies.reqwest] [dependencies.reqwest]
version = "0.11" version = "0.11"

View file

@ -1,100 +0,0 @@
use std::{
fs::{read_to_string, File},
io::{BufWriter, Write},
process::exit,
};
use error_stack::Report;
use crate::Error;
pub struct Package {
name: String,
binaries: Vec<String>,
build_cmd: String,
}
impl Package {
pub fn load_from_file(path: String) -> Self {
let contents = match std::fs::read_to_string(path.clone()) {
// If successful return the files text as `contents`.
// `c` is a local variable.
Ok(c) => c,
// Handle the `error` case.
Err(_) => {
// Write `msg` to `stderr`.
eprintln!("Could not read file `{}`", path);
// Exit the program with exit code `1`.
exit(1);
}
};
use toml::Value;
let mut data: Value = toml::from_str(&contents).unwrap();
let mut name = data
.get("package")
.unwrap()
.get("name")
.unwrap()
.to_string();
name.pop();
name.remove(0);
let dependants = data.get("dependants").unwrap();
let bin_table = dependants.get("binaries").unwrap().as_table().unwrap();
let mut binaries = vec![];
for (count, (name, table)) in bin_table.into_iter().enumerate() {
// if count != 0 {
println!("{}", name);
binaries.push(name.clone());
// }
}
let build_table = data.get("build").unwrap();
let mut build_cmd: String = build_table.get("command").unwrap().as_str().unwrap().into();
build_cmd.remove(0);
// build_cmd.pop();
Self {
name,
binaries,
build_cmd,
}
}
pub fn build(&self) {
if self.binaries.contains(&"hblang".to_string()) {
let file_order = self.build_cmd.split_ascii_whitespace();
let mut files = vec![];
for (count, file) in file_order.enumerate() {
if count != 0 {
println!("{}", file);
files.push(file);
}
}
let mut bundle = vec![];
for file in files {
let contents = read_to_string(file).unwrap();
bundle.push((file, contents));
}
use hblang::{codegen, parser};
let mut codegen = codegen::Codegen::default();
for (path, content) in bundle.iter() {
println!("A");
codegen.files = vec![parser::Ast::new(&path, &content, &parser::no_loader)];
codegen.generate();
}
let mut buf = BufWriter::new(Vec::new());
codegen.dump(&mut buf);
let bytes = buf.into_inner().unwrap();
match std::fs::create_dir("target/programs") {
Ok(_) => (),
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
Err(e) => panic!(),
}
let path = format!("target/test-programs/{}.hbf", self.name);
let mut file = File::create(path).unwrap();
file.write_all(&bytes).unwrap();
}
}
}

View file

@ -1,8 +1,5 @@
mod dev;
use { use {
derive_more::Display, derive_more::Display,
dev::Package,
error_stack::{bail, report, Context, Report, Result, ResultExt}, error_stack::{bail, report, Context, Report, Result, ResultExt},
fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek}, fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek},
std::{ std::{
@ -117,8 +114,8 @@ fn assemble() -> Result<(), Error> {
.map_err(Report::from) .map_err(Report::from)
.change_context(Error::Io)?; .change_context(Error::Io)?;
// hbasm::assembler(&mut out, |engine| engine.run_file(entry.path())) hbasm::assembler(&mut out, |engine| engine.run_file(entry.path()))
// .map_err(|e| report!(Error::Assembler).attach_printable(e.to_string()))?; .map_err(|e| report!(Error::Assembler).attach_printable(e.to_string()))?;
} }
Ok(()) Ok(())
@ -139,10 +136,6 @@ fn get_fs() -> Result<FileSystem<impl ReadWriteSeek>, io::Error> {
let fs = FileSystem::new(img, FsOptions::new())?; let fs = FileSystem::new(img, FsOptions::new())?;
// TODO: Do not hard code these here
let p = Package::load_from_file("sysdata/programs/tests/meta.toml".to_owned());
p.build();
// Read the contents of the file using a `match` block // Read the contents of the file using a `match` block
// to return the `data: Ok(c)` as a `String` // to return the `data: Ok(c)` as a `String`
// or handle any `errors: Err(_)`. // or handle any `errors: Err(_)`.

View file

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "nightly-2024-05-17" channel = "nightly-2023-09-17"
components = ["rust-src", "llvm-tools"] components = ["rust-src", "llvm-tools"]

View file

@ -1 +0,0 @@
The standard library for ableOS.

View file

@ -1,31 +0,0 @@
char := struct {}
log := fn(log_level: int, message: ^char, message_length: int): int {
return 0;
}
error := fn(message: ^char, message_length: int): int {
log(0, message, message_length)
}
warn := fn(message: ^char, message_length: int): int {
log(1, message, message_length)
}
info := fn(message: ^char, message_length: int): int {
log(2, message, message_length)
}
debug := fn(message: ^char, message_length: int): int {
log(3, message, message_length)
}
trace := fn(message: ^char, message_length: int): int {
log(4, message, message_length)
}
main := fn(): int {
return 0;
}

View file

@ -0,0 +1,14 @@
# Dev
Dev is a (currently) hypothetical tool meant to be used to ease development and compilation on ableOS.
## Usage
A `meta.toml` file must be in the project root. A `src` folder and a `lib` folder must exist.
Binaries should be put into a folder named `bin`.
```
bin/
lib/
src/
```
The folders `lib/` and `bin/` should both be left out of source tracking.

View file

@ -0,0 +1,16 @@
[package]
name = "dev"
authors = ["able"]
[dependants.libraries]
file_service = "0.0.1"
[dependants.binaries]
susc.version = "1.0.0"
[build.debug]
command = "susc src/main.hbl"
[run.debug]
depends = ["build.debug"]
command = "bin/main.hbf"

View file

@ -0,0 +1,5 @@
#include "lib/file_service.h"
int main() {
File fhand = file_open("meta.toml");
}

View file

@ -1,4 +0,0 @@
# DiskIO Driver
The purpose of this driver is to read and write disk sectors as simply as possible.
This will be done by first getting a 'boot count'.

View file

@ -1,4 +0,0 @@
main := fn(): int {
return 0;
}

View file

@ -1,11 +0,0 @@
[package]
name = "dev"
authors = ["able"]
[dependants.libraries]
[dependants.binaries]
hblang.version = "1.0.0"
[build.debug]
command = "hblang libraries/stn/src/lib.hb src/main.hbl"

View file

@ -1,7 +0,0 @@
main := fn(): int {
loop {
}
return 0;
}

View file

@ -0,0 +1,15 @@
[package]
name = "fisp_test"
authors = ["able"]
[dependants.libraries]
[dependants.binaries]
# Refers to @FunkyEgg's lisp compiler for ableOS
fisp = ""
[build.debug]
command = "fisp src/main.fisp"
[run.debug]
depends = ["build.debug"]
command = "bin/main.hbf"

View file

@ -0,0 +1 @@
(log info "Hello World\n")

View file

@ -1,2 +0,0 @@
# KVStore
This is a small single process in memory key value store.

View file

@ -1,37 +0,0 @@
Message := struct {
msg_type: u8,
key: String,
value: String,
}
/*
# Message Type
0 => Set Key type
1 => Get Key
*/
recv_msg:= fn(): Message {
return Message.{
msg_type: 0,
key: "",
value: "",
}
}
main := fn(): int {
loop {
msg := recv_msg();
if msg.msg_type == 0 {
continue;
}
if msg.msg_type == 1 {
continue;
}
if 2 <= msg.msg_type {
error("Unexpected message type in the bagging area");
continue;
}
}
return 0;
}

View file

@ -1,2 +0,0 @@
# Serial Driver
This program is a small serial driver for the emulated arm device in QEMU.

View file

@ -1,7 +0,0 @@
main:= fn(): int {
arch := "Arm";
ADDR := 0x09000000;
loop { }
return 0;
}

View file

@ -0,0 +1,16 @@
[package]
name = "htasm_test"
authors = ["able"]
# Similar to cargo libraries
[dependants.libraries]
# Similar to cargo install
[dependants.binaries]
htasm = ""
[build.debug]
command = "htasm src/main.S"
[run.debug]
depends = ["build.debug"]
command = "bin/main.hbf"

View file

@ -0,0 +1,10 @@
jmp start
start:
li64 r1, 3
li64 r2, 1
lra16 r3, r0, hello_string
li64 r4, 0x14
string
.db "Hello, world!\n"

View file

@ -1,11 +0,0 @@
[package]
name = "tests"
authors = ["able"]
[dependants.libraries]
[dependants.binaries]
hblang.version = "1.0.0"
[build]
command = "hblang sysdata/libraries/stn/src/lib.hb sysdata/programs/tests/src/main.hb"

View file

@ -1,3 +0,0 @@
main := fn(): int {
return 0;
}

View file

@ -11,7 +11,7 @@ The memory service uses the first byte in the message to identify the request ty
<!-- Currently this does not deallocate --> <!-- Currently this does not deallocate -->
[U8] -> 1 [U8] -> 1
[U8] -> Page count [U8] -> Page count
[U64] -> ptr to dealloc from [U64] -> ptr to dealloc from
## Map Device Into Memory ## Map Device Into Memory
Typically only used for simple drivers such as vga. Typically only used for simple drivers such as vga.

View file

@ -17,6 +17,29 @@ resolution = "1024x768x24"
[boot.limine.ableos.modules] [boot.limine.ableos.modules]
[boot.limine.ableos.modules.tests] [boot.limine.ableos.modules.failure]
# TODO: Pull from the programs included here path = "boot:///failure.hbf"
path = "boot:///tests.hbf"
[boot.limine.ableos.modules.ecall]
path = "boot:///ecall.hbf"
[boot.limine.ableos.modules.sds_test]
path = "boot:///sds_test.hbf"
[boot.limine.ableos.modules.main]
path = "boot:///main.hbf"
[boot.limine.ableos.modules.keyboard_driver]
path = "boot:///keyboard_driver.hbf"
cmd_line = "arch=${ARCH}"
[boot.limine.ableos.modules.vfs_test]
path = "boot:///vfs_test.hbf"
[boot.limine.ableos.modules.limine_framebuffer_driver]
path = "boot:///limine_framebuffer_driver.hbf"
cmd_line = "height=10 width=10 arch=${ARCH}"
[boot.limine.ableos.modules.serial_driver]
path = "boot:///serial_driver.hbf"
cmd_line = "arch=${ARCH}"

View file

@ -0,0 +1,3 @@
li64 (r1, 2);
eca ();
tx ();

View file

@ -0,0 +1 @@
un();

View file

@ -0,0 +1,33 @@
import "sysdata/test-programs/hblib/std" as std;
fn main(){
std::Error(":o) h0nk");
std::Warn("Your mom is a worm!");
std::Info("Hello, world!");
// std::Debug("XYZ");
// std::Trace("Trace Deez");
// let ADDR = 0xFFFF_FFFF_8100_0000;
// let ADDR_PLUS_ONE = ADDR + 1;
// let ADDR_PLUS_NINE = ADDR + 9;
// li64(r25, 1);
// st(r25, r0, ADDR, 1);
// li64(r25, 0);
// st(r25, r0, ADDR_PLUS_ONE, 8);
// li64(r25, 17);
// st(r25, r0, ADDR_PLUS_NINE, 1);
// li64(r1, 3);
// li64(r2, 2);
// li64(r3, ADDR);
// li64(r4, 0);
eca();
tx();
}
main();

View file

@ -0,0 +1,11 @@
/// Act as a shim of a virtual file system that recieves one message from buffer 2
import "sysdata/test-programs/hblib/std" as std;
fn main() {
std::ipc_recv(2);
un();
}
main();
tx();