From c20376464ee99c4d05708e1e27692154015413f4 Mon Sep 17 00:00:00 2001 From: able Date: Thu, 23 May 2024 16:59:17 -0500 Subject: [PATCH] reorg sysdata --- sysdata/libraries/stn/README.md | 1 + sysdata/libraries/stn/src/lib.hb | 29 +++++++++++++++ sysdata/programs/dev/README.md | 14 -------- sysdata/programs/dev/meta.toml | 16 --------- sysdata/programs/dev/src/main.c | 5 --- sysdata/programs/diskio_driver/README.md | 4 +++ sysdata/programs/diskio_driver/src/main.hb | 4 +++ sysdata/programs/fb_driver/README.md | 0 sysdata/programs/fb_driver/meta.toml | 11 ++++++ sysdata/programs/fb_driver/src/main.hb | 7 ++++ sysdata/programs/fisp_test/meta.toml | 15 -------- sysdata/programs/fisp_test/src/main.fisp | 1 - sysdata/programs/kvstore/README.md | 2 ++ sysdata/programs/kvstore/src/main.hb | 37 +++++++++++++++++++ sysdata/programs/serial_driver/README.md | 2 ++ sysdata/programs/serial_driver/src/main.hb | 7 ++++ sysdata/programs/test/meta.toml | 16 --------- sysdata/programs/test/src/main.S | 10 ------ sysdata/spec/Memory Service spec.md | 2 +- sysdata/system_config.toml | 41 ++++++++++++---------- sysdata/test-programs/ecall.rhai | 3 -- sysdata/test-programs/failure.rhai | 1 - sysdata/test-programs/main.rhai | 33 ----------------- sysdata/test-programs/vfs.rhai | 11 ------ 24 files changed, 127 insertions(+), 145 deletions(-) create mode 100644 sysdata/libraries/stn/README.md create mode 100644 sysdata/libraries/stn/src/lib.hb delete mode 100644 sysdata/programs/dev/README.md delete mode 100644 sysdata/programs/dev/meta.toml delete mode 100644 sysdata/programs/dev/src/main.c create mode 100644 sysdata/programs/diskio_driver/README.md create mode 100644 sysdata/programs/diskio_driver/src/main.hb create mode 100644 sysdata/programs/fb_driver/README.md create mode 100644 sysdata/programs/fb_driver/meta.toml create mode 100644 sysdata/programs/fb_driver/src/main.hb delete mode 100644 sysdata/programs/fisp_test/meta.toml delete mode 100644 sysdata/programs/fisp_test/src/main.fisp create mode 100644 sysdata/programs/kvstore/README.md create mode 100644 sysdata/programs/kvstore/src/main.hb create mode 100644 sysdata/programs/serial_driver/README.md create mode 100644 sysdata/programs/serial_driver/src/main.hb delete mode 100644 sysdata/programs/test/meta.toml delete mode 100644 sysdata/programs/test/src/main.S delete mode 100644 sysdata/test-programs/ecall.rhai delete mode 100644 sysdata/test-programs/failure.rhai delete mode 100644 sysdata/test-programs/main.rhai delete mode 100644 sysdata/test-programs/vfs.rhai diff --git a/sysdata/libraries/stn/README.md b/sysdata/libraries/stn/README.md new file mode 100644 index 00000000..e3cf7dcb --- /dev/null +++ b/sysdata/libraries/stn/README.md @@ -0,0 +1 @@ +The standard library for ableOS. diff --git a/sysdata/libraries/stn/src/lib.hb b/sysdata/libraries/stn/src/lib.hb new file mode 100644 index 00000000..bab8d981 --- /dev/null +++ b/sysdata/libraries/stn/src/lib.hb @@ -0,0 +1,29 @@ +/* +Refer to the spec in "spec/Logging Service spec.md" +*/ + + +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) +} \ No newline at end of file diff --git a/sysdata/programs/dev/README.md b/sysdata/programs/dev/README.md deleted file mode 100644 index 2b2985ce..00000000 --- a/sysdata/programs/dev/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# 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. \ No newline at end of file diff --git a/sysdata/programs/dev/meta.toml b/sysdata/programs/dev/meta.toml deleted file mode 100644 index 8ca8b7cb..00000000 --- a/sysdata/programs/dev/meta.toml +++ /dev/null @@ -1,16 +0,0 @@ -[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" diff --git a/sysdata/programs/dev/src/main.c b/sysdata/programs/dev/src/main.c deleted file mode 100644 index 75d5431d..00000000 --- a/sysdata/programs/dev/src/main.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "lib/file_service.h" - -int main() { - File fhand = file_open("meta.toml"); -} \ No newline at end of file diff --git a/sysdata/programs/diskio_driver/README.md b/sysdata/programs/diskio_driver/README.md new file mode 100644 index 00000000..4784a2d9 --- /dev/null +++ b/sysdata/programs/diskio_driver/README.md @@ -0,0 +1,4 @@ +# 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'. \ No newline at end of file diff --git a/sysdata/programs/diskio_driver/src/main.hb b/sysdata/programs/diskio_driver/src/main.hb new file mode 100644 index 00000000..f0702282 --- /dev/null +++ b/sysdata/programs/diskio_driver/src/main.hb @@ -0,0 +1,4 @@ +main := fn(): int { + + return 0; +} \ No newline at end of file diff --git a/sysdata/programs/fb_driver/README.md b/sysdata/programs/fb_driver/README.md new file mode 100644 index 00000000..e69de29b diff --git a/sysdata/programs/fb_driver/meta.toml b/sysdata/programs/fb_driver/meta.toml new file mode 100644 index 00000000..362ee379 --- /dev/null +++ b/sysdata/programs/fb_driver/meta.toml @@ -0,0 +1,11 @@ +[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" diff --git a/sysdata/programs/fb_driver/src/main.hb b/sysdata/programs/fb_driver/src/main.hb new file mode 100644 index 00000000..3b846351 --- /dev/null +++ b/sysdata/programs/fb_driver/src/main.hb @@ -0,0 +1,7 @@ + +main := fn(): int { + loop { + + } + return 0; +} diff --git a/sysdata/programs/fisp_test/meta.toml b/sysdata/programs/fisp_test/meta.toml deleted file mode 100644 index c0f4a7b1..00000000 --- a/sysdata/programs/fisp_test/meta.toml +++ /dev/null @@ -1,15 +0,0 @@ -[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" diff --git a/sysdata/programs/fisp_test/src/main.fisp b/sysdata/programs/fisp_test/src/main.fisp deleted file mode 100644 index 8d387257..00000000 --- a/sysdata/programs/fisp_test/src/main.fisp +++ /dev/null @@ -1 +0,0 @@ -(log info "Hello World\n") \ No newline at end of file diff --git a/sysdata/programs/kvstore/README.md b/sysdata/programs/kvstore/README.md new file mode 100644 index 00000000..b4fa24ff --- /dev/null +++ b/sysdata/programs/kvstore/README.md @@ -0,0 +1,2 @@ +# KVStore +This is a small single process in memory key value store. \ No newline at end of file diff --git a/sysdata/programs/kvstore/src/main.hb b/sysdata/programs/kvstore/src/main.hb new file mode 100644 index 00000000..1abfa97c --- /dev/null +++ b/sysdata/programs/kvstore/src/main.hb @@ -0,0 +1,37 @@ +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; +} \ No newline at end of file diff --git a/sysdata/programs/serial_driver/README.md b/sysdata/programs/serial_driver/README.md new file mode 100644 index 00000000..cca5b23f --- /dev/null +++ b/sysdata/programs/serial_driver/README.md @@ -0,0 +1,2 @@ +# Serial Driver +This program is a small serial driver for the emulated arm device in QEMU. \ No newline at end of file diff --git a/sysdata/programs/serial_driver/src/main.hb b/sysdata/programs/serial_driver/src/main.hb new file mode 100644 index 00000000..db85d0b4 --- /dev/null +++ b/sysdata/programs/serial_driver/src/main.hb @@ -0,0 +1,7 @@ + +main:= fn(): int { + arch := "Arm"; + ADDR := 0x09000000; + loop { } + return 0; +} \ No newline at end of file diff --git a/sysdata/programs/test/meta.toml b/sysdata/programs/test/meta.toml deleted file mode 100644 index 60e5f4b5..00000000 --- a/sysdata/programs/test/meta.toml +++ /dev/null @@ -1,16 +0,0 @@ -[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" diff --git a/sysdata/programs/test/src/main.S b/sysdata/programs/test/src/main.S deleted file mode 100644 index 1b4a4ff0..00000000 --- a/sysdata/programs/test/src/main.S +++ /dev/null @@ -1,10 +0,0 @@ -jmp start - -start: - li64 r1, 3 - li64 r2, 1 - lra16 r3, r0, hello_string - li64 r4, 0x14 - -string - .db "Hello, world!\n" \ No newline at end of file diff --git a/sysdata/spec/Memory Service spec.md b/sysdata/spec/Memory Service spec.md index 509311d7..6144a0bd 100644 --- a/sysdata/spec/Memory Service spec.md +++ b/sysdata/spec/Memory Service spec.md @@ -11,7 +11,7 @@ The memory service uses the first byte in the message to identify the request ty [U8] -> 1 [U8] -> Page count -[U64] -> ptr to dealloc from +[U64] -> ptr to dealloc from ## Map Device Into Memory Typically only used for simple drivers such as vga. diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 312a43b4..2a3fc4ca 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -17,29 +17,32 @@ resolution = "1024x768x24" [boot.limine.ableos.modules] -[boot.limine.ableos.modules.failure] -path = "boot:///failure.hbf" +# [boot.limine.ableos.modules.failure] +# path = "boot:///failure.hbf" -[boot.limine.ableos.modules.ecall] -path = "boot:///ecall.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.sds_test] +# path = "boot:///sds_test.hbf" -[boot.limine.ableos.modules.main] -path = "boot:///main.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.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.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.bin] +path = "boot:///bin.hbf" -[boot.limine.ableos.modules.serial_driver] -path = "boot:///serial_driver.hbf" -cmd_line = "arch=${ARCH}" +# [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}" diff --git a/sysdata/test-programs/ecall.rhai b/sysdata/test-programs/ecall.rhai deleted file mode 100644 index ca1d2fc3..00000000 --- a/sysdata/test-programs/ecall.rhai +++ /dev/null @@ -1,3 +0,0 @@ -li64 (r1, 2); -eca (); -tx (); diff --git a/sysdata/test-programs/failure.rhai b/sysdata/test-programs/failure.rhai deleted file mode 100644 index a483c3b4..00000000 --- a/sysdata/test-programs/failure.rhai +++ /dev/null @@ -1 +0,0 @@ -un(); diff --git a/sysdata/test-programs/main.rhai b/sysdata/test-programs/main.rhai deleted file mode 100644 index 827b3850..00000000 --- a/sysdata/test-programs/main.rhai +++ /dev/null @@ -1,33 +0,0 @@ -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(); diff --git a/sysdata/test-programs/vfs.rhai b/sysdata/test-programs/vfs.rhai deleted file mode 100644 index bd28fd40..00000000 --- a/sysdata/test-programs/vfs.rhai +++ /dev/null @@ -1,11 +0,0 @@ -/// 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(); \ No newline at end of file