1
0
Fork 0
forked from AbleOS/ableos
This commit is contained in:
peony 2024-10-25 17:43:23 +02:00
commit d143acb8b6
32 changed files with 264 additions and 841 deletions

685
Cargo.lock generated
View file

@ -11,21 +11,6 @@ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]]
name = "addr2line"
version = "0.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
dependencies = [
"gimli",
]
[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]] [[package]]
name = "allocator-api2" name = "allocator-api2"
version = "0.2.18" version = "0.2.18"
@ -49,9 +34,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.90" version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
@ -59,21 +44,6 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "backtrace"
version = "0.3.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
dependencies = [
"addr2line",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
"windows-targets",
]
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.22.1" version = "0.22.1"
@ -115,6 +85,9 @@ name = "bumpalo"
version = "3.16.0" version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
dependencies = [
"allocator-api2",
]
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@ -122,12 +95,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.1.31" version = "1.1.31"
@ -255,56 +222,6 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "futures-channel"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
[[package]]
name = "futures-io"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-sink"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
[[package]]
name = "futures-task"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
[[package]]
name = "futures-util"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
"futures-core",
"futures-io",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
"pin-utils",
"slab",
]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.15" version = "0.2.15"
@ -317,10 +234,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "gimli" name = "hashbrown"
version = "0.31.1" version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
@ -336,129 +253,28 @@ 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#15e4762d4ac8993d12fe2dd54e2b2d842c8a034b" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faa8dd2e6fabe2e0e4a375e677171856da491c61"
[[package]] [[package]]
name = "hblang" name = "hblang"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#15e4762d4ac8993d12fe2dd54e2b2d842c8a034b" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faa8dd2e6fabe2e0e4a375e677171856da491c61"
dependencies = [ dependencies = [
"hashbrown", "hashbrown 0.15.0",
"hbbytecode", "hbbytecode",
"hbvm", "hbvm",
"log", "log",
"regalloc2",
] ]
[[package]] [[package]]
name = "hbvm" name = "hbvm"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#15e4762d4ac8993d12fe2dd54e2b2d842c8a034b" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faa8dd2e6fabe2e0e4a375e677171856da491c61"
dependencies = [ dependencies = [
"hbbytecode", "hbbytecode",
] ]
[[package]]
name = "hermit-abi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "http"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
dependencies = [
"bytes",
"fnv",
"itoa",
]
[[package]]
name = "http-body"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
dependencies = [
"bytes",
"http",
]
[[package]]
name = "http-body-util"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
dependencies = [
"bytes",
"futures-util",
"http",
"http-body",
"pin-project-lite",
]
[[package]]
name = "httparse"
version = "1.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946"
[[package]]
name = "hyper"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"http",
"http-body",
"httparse",
"itoa",
"pin-project-lite",
"smallvec",
"tokio",
"want",
]
[[package]]
name = "hyper-rustls"
version = "0.27.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
dependencies = [
"futures-util",
"http",
"hyper",
"hyper-util",
"rustls",
"rustls-pki-types",
"tokio",
"tokio-rustls",
"tower-service",
"webpki-roots",
]
[[package]]
name = "hyper-util"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"http",
"http-body",
"hyper",
"pin-project-lite",
"socket2",
"tokio",
"tower-service",
"tracing",
]
[[package]] [[package]]
name = "iana-time-zone" name = "iana-time-zone"
version = "0.1.61" version = "0.1.61"
@ -499,21 +315,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown", "hashbrown 0.15.0",
] ]
[[package]]
name = "ipnet"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
[[package]]
name = "itoa"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.72" version = "0.3.72"
@ -530,7 +334,7 @@ dependencies = [
"aarch64-cpu", "aarch64-cpu",
"crossbeam-queue", "crossbeam-queue",
"derive_more", "derive_more",
"hashbrown", "hashbrown 0.15.0",
"hbvm", "hbvm",
"limine", "limine",
"log", "log",
@ -617,33 +421,6 @@ version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "miniz_oxide"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
dependencies = [
"adler2",
]
[[package]]
name = "mio"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
dependencies = [
"hermit-abi",
"libc",
"wasi",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.19" version = "0.2.19"
@ -653,15 +430,6 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "object"
version = "0.36.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.20.2" version = "1.20.2"
@ -680,84 +448,15 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project-lite"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "ppv-lite86"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [
"zerocopy",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.88" version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "quinn"
version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684"
dependencies = [
"bytes",
"pin-project-lite",
"quinn-proto",
"quinn-udp",
"rustc-hash",
"rustls",
"socket2",
"thiserror",
"tokio",
"tracing",
]
[[package]]
name = "quinn-proto"
version = "0.11.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6"
dependencies = [
"bytes",
"rand",
"ring",
"rustc-hash",
"rustls",
"slab",
"thiserror",
"tinyvec",
"tracing",
]
[[package]]
name = "quinn-udp"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b"
dependencies = [
"libc",
"once_cell",
"socket2",
"tracing",
"windows-sys 0.59.0",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.37" version = "1.0.37"
@ -767,36 +466,6 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
]
[[package]] [[package]]
name = "raw-cpuid" name = "raw-cpuid"
version = "10.7.0" version = "10.7.0"
@ -815,6 +484,19 @@ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
] ]
[[package]]
name = "regalloc2"
version = "0.10.2"
source = "git+https://github.com/jakubDoka/regalloc2?branch=reuse-allocations#21c43e3ee182824e92e2b25f1d3c03ed47f9c02b"
dependencies = [
"allocator-api2",
"bumpalo",
"hashbrown 0.14.5",
"log",
"rustc-hash",
"smallvec",
]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.5" version = "0.8.5"
@ -831,52 +513,9 @@ dependencies = [
"hblang", "hblang",
"log", "log",
"raw-cpuid 11.2.0", "raw-cpuid 11.2.0",
"reqwest",
"str-reader", "str-reader",
"toml", "toml",
] "ureq",
[[package]]
name = "reqwest"
version = "0.12.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b"
dependencies = [
"base64",
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-rustls",
"hyper-util",
"ipnet",
"js-sys",
"log",
"mime",
"once_cell",
"percent-encoding",
"pin-project-lite",
"quinn",
"rustls",
"rustls-pemfile",
"rustls-pki-types",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper",
"tokio",
"tokio-rustls",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots",
"windows-registry",
] ]
[[package]] [[package]]
@ -891,15 +530,9 @@ dependencies = [
"libc", "libc",
"spin", "spin",
"untrusted", "untrusted",
"windows-sys 0.52.0", "windows-sys",
] ]
[[package]]
name = "rustc-demangle"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]] [[package]]
name = "rustc-hash" name = "rustc-hash"
version = "2.0.0" version = "2.0.0"
@ -921,6 +554,7 @@ version = "0.23.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993"
dependencies = [ dependencies = [
"log",
"once_cell", "once_cell",
"ring", "ring",
"rustls-pki-types", "rustls-pki-types",
@ -929,15 +563,6 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "rustls-pemfile"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50"
dependencies = [
"rustls-pki-types",
]
[[package]] [[package]]
name = "rustls-pki-types" name = "rustls-pki-types"
version = "1.10.0" version = "1.10.0"
@ -961,12 +586,6 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248"
[[package]]
name = "ryu"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]] [[package]]
name = "sbi" name = "sbi"
version = "0.2.0" version = "0.2.0"
@ -987,36 +606,24 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.210" version = "1.0.213"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.210" version = "1.0.213"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "serde_json"
version = "1.0.132"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "0.6.8" version = "0.6.8"
@ -1026,18 +633,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
"itoa",
"ryu",
"serde",
]
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.3.0" version = "1.3.0"
@ -1059,16 +654,6 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "socket2"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.8" version = "0.9.8"
@ -1092,44 +677,15 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.79" version = "2.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "sync_wrapper"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
dependencies = [
"futures-core",
]
[[package]]
name = "thiserror"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.8.0" version = "1.8.0"
@ -1151,32 +707,6 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "696941a0aee7e276a165a978b37918fd5d22c55c3d6bda197813070ca9c0f21c" checksum = "696941a0aee7e276a165a978b37918fd5d22c55c3d6bda197813070ca9c0f21c"
[[package]]
name = "tokio"
version = "1.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
dependencies = [
"backtrace",
"bytes",
"libc",
"mio",
"pin-project-lite",
"socket2",
"windows-sys 0.52.0",
]
[[package]]
name = "tokio-rustls"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
dependencies = [
"rustls",
"rustls-pki-types",
"tokio",
]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.8.19" version = "0.8.19"
@ -1211,37 +741,6 @@ dependencies = [
"winnow", "winnow",
] ]
[[package]]
name = "tower-service"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [
"pin-project-lite",
"tracing-core",
]
[[package]]
name = "tracing-core"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [
"once_cell",
]
[[package]]
name = "try-lock"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]] [[package]]
name = "uart_16550" name = "uart_16550"
version = "0.3.1" version = "0.3.1"
@ -1286,6 +785,21 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "ureq"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a"
dependencies = [
"base64",
"log",
"once_cell",
"rustls",
"rustls-pki-types",
"url",
"webpki-roots",
]
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.2" version = "2.5.2"
@ -1311,15 +825,6 @@ version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793" checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793"
[[package]]
name = "want"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
dependencies = [
"try-lock",
]
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.11.0+wasi-snapshot-preview1" version = "0.11.0+wasi-snapshot-preview1"
@ -1352,18 +857,6 @@ dependencies = [
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.95" version = "0.2.95"
@ -1393,16 +886,6 @@ version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
[[package]]
name = "web-sys"
version = "0.3.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.26.6" version = "0.26.6"
@ -1421,36 +904,6 @@ dependencies = [
"windows-targets", "windows-targets",
] ]
[[package]]
name = "windows-registry"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
dependencies = [
"windows-result",
"windows-strings",
"windows-targets",
]
[[package]]
name = "windows-result"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-strings"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
dependencies = [
"windows-result",
"windows-targets",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.52.0" version = "0.52.0"
@ -1460,15 +913,6 @@ dependencies = [
"windows-targets", "windows-targets",
] ]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.52.6" version = "0.52.6"
@ -1598,27 +1042,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "zerocopy"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder",
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "zeroize" name = "zeroize"
version = "1.8.1" version = "1.8.1"

View file

@ -1,4 +1,3 @@
#![allow(unused)]
use std::io::Write; use std::io::Write;
use idl::build_idl; use idl::build_idl;
@ -139,8 +138,8 @@ fn build(name: String) {
} }
} }
pub fn build_program(name: String) {} pub fn build_program(_name: String) {}
pub fn build_library(name: String) {} pub fn build_library(_name: String) {}
fn help() { fn help() {
println!( println!(

View file

@ -131,9 +131,13 @@ pub fn handler(vm: &mut Vm) {
3 => unimplemented!("TODO: implement whatever buffer 3 does for no x86_64"), 3 => unimplemented!("TODO: implement whatever buffer 3 does for no x86_64"),
// source of rng // source of rng
4 => { 4 => {
// limit to last 32 bits let block = block_read(mem_addr, length);
vm.registers[1] = block.chunks_mut(8.min(length)).for_each(|chunk| {
hbvm::value::Value(crate::arch::hardware_random_u64() & 0xFFFFFFFF); chunk.clone_from_slice(
&crate::arch::hardware_random_u64().to_le_bytes()[..chunk.len()],
);
});
vm.registers[1] = hbvm::value::Value(mem_addr);
} }
5 => match dt_msg_handler(vm, mem_addr, length) { 5 => match dt_msg_handler(vm, mem_addr, length) {
Ok(()) => {} Ok(()) => {}

View file

@ -38,7 +38,7 @@ unsafe fn memset(mut dest: *mut u8, src: *const u8, count: usize, size: usize) {
let mut buffer_size = size; let mut buffer_size = size;
src.copy_to_nonoverlapping(buffer.as_mut_ptr(), size); src.copy_to_nonoverlapping(buffer.as_mut_ptr(), size);
while buffer_size * 2 <= BLOCK_SIZE { while core::intrinsics::likely(buffer_size * 2 <= BLOCK_SIZE) {
buffer buffer
.as_mut_ptr() .as_mut_ptr()
.copy_to_nonoverlapping(buffer.as_mut_ptr().add(buffer_size), buffer_size); .copy_to_nonoverlapping(buffer.as_mut_ptr().add(buffer_size), buffer_size);
@ -53,7 +53,7 @@ unsafe fn memset(mut dest: *mut u8, src: *const u8, count: usize, size: usize) {
remaining -= 1; remaining -= 1;
} }
while remaining >= 8 { while core::intrinsics::likely(remaining >= 8) {
*(dest as *mut u64) = *buffer_ptr; *(dest as *mut u64) = *buffer_ptr;
dest = dest.add(8); dest = dest.add(8);
remaining -= 8; remaining -= 8;
@ -122,18 +122,17 @@ pub fn memory_msg_handler(
log::debug!(" {} pages", page_count); log::debug!(" {} pages", page_count);
} }
4 => unsafe { 4 => unsafe {
let count = u64::from_le_bytes(msg_vec[1..9].try_into().unwrap_unchecked()) as usize; let count = u32::from_le_bytes(msg_vec[1..5].try_into().unwrap_unchecked()) as usize;
let src = u64::from_le_bytes(msg_vec[9..17].try_into().unwrap_unchecked()) as *const u8; let src = u64::from_le_bytes(msg_vec[5..13].try_into().unwrap_unchecked()) as *const u8;
let dest = u64::from_le_bytes(msg_vec[17..25].try_into().unwrap_unchecked()) as *mut u8; let dest = u64::from_le_bytes(msg_vec[13..21].try_into().unwrap_unchecked()) as *mut u8;
src.copy_to_nonoverlapping(dest, count); src.copy_to_nonoverlapping(dest, count);
}, },
5 => unsafe { 5 => unsafe {
let count = u64::from_le_bytes(msg_vec[1..9].try_into().unwrap_unchecked()) as usize; let count = u32::from_le_bytes(msg_vec[1..5].try_into().unwrap_unchecked()) as usize;
let size = u64::from_le_bytes(msg_vec[9..17].try_into().unwrap_unchecked()) as usize; let size = u32::from_le_bytes(msg_vec[5..9].try_into().unwrap_unchecked()) as usize;
let src = let src = u64::from_le_bytes(msg_vec[9..17].try_into().unwrap_unchecked()) as *const u8;
u64::from_le_bytes(msg_vec[17..25].try_into().unwrap_unchecked()) as *const u8; let dest = u64::from_le_bytes(msg_vec[17..25].try_into().unwrap_unchecked()) as *mut u8;
let dest = u64::from_le_bytes(msg_vec[25..33].try_into().unwrap_unchecked()) as *mut u8;
memset(dest, src, count, size); memset(dest, src, count, size);
}, },

View file

@ -6,6 +6,7 @@
slice_split_once, slice_split_once,
exclusive_wrapper, exclusive_wrapper,
new_uninit, new_uninit,
core_intrinsics,
abi_x86_interrupt, abi_x86_interrupt,
alloc_error_handler, alloc_error_handler,
ptr_sub_ptr, ptr_sub_ptr,
@ -14,8 +15,7 @@
pointer_is_aligned_to pointer_is_aligned_to
)] )]
#![test_runner(crate::test_runner)] #![test_runner(crate::test_runner)]
#![cfg_attr(not(debug_assertions), allow(unused, deprecated))] #![allow(dead_code, internal_features)]
#![allow(dead_code)]
extern crate alloc; extern crate alloc;
mod allocator; mod allocator;

View file

@ -22,11 +22,13 @@ fatfs = "0.3"
toml = "0.8" toml = "0.8"
hblang = { git = "https://git.ablecorp.us/AbleOS/holey-bytes.git", features = [ hblang = { git = "https://git.ablecorp.us/AbleOS/holey-bytes.git", features = [
"std", "std",
"opts",
], default-features = false } ], default-features = false }
log = "0.4" log = "0.4"
raw-cpuid = "11" raw-cpuid = "11"
ureq = { version = "2", default-features = false, features = ["tls"] }
[dependencies.reqwest] # [dependencies.reqwest]
version = "0.12" # version = "0.12"
default-features = false # default-features = false
features = ["rustls-tls", "blocking"] # features = ["rustls-tls", "blocking"]

View file

@ -63,7 +63,7 @@ impl Package {
build_cmd, build_cmd,
} }
} }
pub fn build(&self) { pub fn build(&self) -> std::io::Result<()> {
if self.binaries.contains(&"hblang".to_string()) { if self.binaries.contains(&"hblang".to_string()) {
let file = self.build_cmd.split_ascii_whitespace().last().unwrap(); let file = self.build_cmd.split_ascii_whitespace().last().unwrap();
@ -71,15 +71,24 @@ impl Package {
let mut bytes = Vec::new(); let mut bytes = Vec::new();
// compile here // compile here
let _ = hblang::run_compiler( hblang::run_compiler(
&path, &path,
Options { Options {
fmt: true, fmt: true,
optimize: true,
..Default::default() ..Default::default()
}, },
&mut bytes, &mut bytes,
); )?;
let _ = hblang::run_compiler(&path, Default::default(), &mut bytes);
hblang::run_compiler(
&path,
Options {
optimize: true,
..Default::default()
},
&mut bytes,
)?;
match std::fs::create_dir("target/programs") { match std::fs::create_dir("target/programs") {
Ok(_) => (), Ok(_) => (),
@ -88,15 +97,17 @@ impl Package {
} }
std::fs::write(format!("target/programs/{}.hbf", self.name), &bytes).unwrap(); std::fs::write(format!("target/programs/{}.hbf", self.name), &bytes).unwrap();
bytes.clear(); bytes.clear();
let _ = hblang::run_compiler( hblang::run_compiler(
&path, &path,
Options { Options {
dump_asm: true, dump_asm: true,
optimize: true,
..Default::default() ..Default::default()
}, },
&mut bytes, &mut bytes,
); )?;
std::fs::write(format!("target/programs/{}.hba", self.name), &bytes).unwrap(); std::fs::write(format!("target/programs/{}.hba", self.name), &bytes).unwrap();
} }
Ok(())
} }
} }

View file

@ -1,5 +1,3 @@
// #![allow(unused)]
mod dev; mod dev;
use { use {
@ -8,7 +6,6 @@ use {
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::{
// fmt::Display,
fs::{self, File}, fs::{self, File},
io::{self, Write}, io::{self, Write},
path::Path, path::Path,
@ -84,7 +81,7 @@ fn main() -> Result<(), Error> {
" -r / --release: build in release mode\n", " -r / --release: build in release mode\n",
" -d / --debuginfo: build with debug info\n", " -d / --debuginfo: build with debug info\n",
" --noaccel: run without acceleration (e.g, no kvm)\n", " --noaccel: run without acceleration (e.g, no kvm)\n",
"[ rv64 / riscv64 / riscv64-virt / aarch64 / arm64 / aarch64-virt ]: sets target" "[ rv64 / riscv64 / riscv64-virt / aarch64 / arm64 / aarch64-virt / avx2 ]: sets target"
),); ),);
Ok(()) Ok(())
} }
@ -207,7 +204,9 @@ TERM_BACKDROP={}
let modules = value.get_mut("modules").unwrap().as_table_mut().unwrap(); let modules = value.get_mut("modules").unwrap().as_table_mut().unwrap();
// let mut real_modules = modules.clone(); // let mut real_modules = modules.clone();
modules.into_iter().for_each(|(_, value)| { modules
.into_iter()
.map(|(_, value)| -> Result<(), io::Error> {
if value.is_table() { if value.is_table() {
let path = get_path_without_boot_prefix( let path = get_path_without_boot_prefix(
value.get("path").expect("You must have `path` as a value"), value.get("path").expect("You must have `path` as a value"),
@ -219,9 +218,11 @@ TERM_BACKDROP={}
let p = Package::load_from_file( let p = Package::load_from_file(
format!("sysdata/programs/{}/meta.toml", path).to_owned(), format!("sysdata/programs/{}/meta.toml", path).to_owned(),
); );
p.build(); p.build()?;
} }
}); Ok(())
})
.for_each(drop);
modules.into_iter().for_each(|(_key, value)| { modules.into_iter().for_each(|(_key, value)| {
if value.is_table() { if value.is_table() {
let path = value.get("path").expect("You must have `path` as a value"); let path = value.get("path").expect("You must have `path` as a value");
@ -475,12 +476,12 @@ fn fetch_ovmf(target: Target) -> Result<String, OvmfFetchError> {
Ok(_) => return Ok(ovmf_path.to_owned()), Ok(_) => return Ok(ovmf_path.to_owned()),
Err(e) => return Err(report!(e).change_context(OvmfFetchError::Io)), Err(e) => return Err(report!(e).change_context(OvmfFetchError::Io)),
}; };
let mut bytes = reqwest::blocking::get(ovmf_url) let req = ureq::get(ovmf_url)
.call()
.map_err(Report::from) .map_err(Report::from)
.change_context(OvmfFetchError::Fetch)?; .change_context(OvmfFetchError::Fetch)?;
bytes std::io::copy(&mut req.into_reader(), &mut file)
.copy_to(&mut file)
.map_err(Report::from) .map_err(Report::from)
.change_context(OvmfFetchError::Io)?; .change_context(OvmfFetchError::Io)?;

View file

@ -23,7 +23,7 @@ create_window := fn(channel: int): ^render.Surface {
mem_buf := memory.request_page(1) mem_buf := memory.request_page(1)
if windowing_system_buffer == 0 { if windowing_system_buffer == 0 {
return 0 return @as(^render.Surface, idk)
} else { } else {
// ! bad able, stop using string messages :ragey: // ! bad able, stop using string messages :ragey:
// msg := "\{01}\0" // msg := "\{01}\0"
@ -43,6 +43,6 @@ create_window := fn(channel: int): ^render.Surface {
log.info("No messages\0") log.info("No messages\0")
} }
return 0 return @as(^render.Surface, idk)
} }
} }

View file

@ -41,14 +41,13 @@ surface_from_bmp := fn(bmp: ^u8): Surface {
info_header := @as(^BitmapInfoHeader, @bitcast(bmp + @sizeof(BitmapFileHeader))) info_header := @as(^BitmapInfoHeader, @bitcast(bmp + @sizeof(BitmapFileHeader)))
bmp += file_header.offset bmp += file_header.offset
a := 0
px := info_header.width * info_header.height px := info_header.width * info_header.height
ptr := @as(^Color, @bitcast(bmp)) ptr := @as(^Color, @bitcast(bmp))
tmp := @as(Color, idk) tmp := @as(Color, idk)
row := 0 row := @as(i32, 0)
loop if row == info_header.height / 2 break else { loop if row == info_header.height / 2 break else {
col := 0 col := @as(i32, 0)
loop if col == info_header.width break else { loop if col == info_header.width break else {
top_index := row * info_header.width + col top_index := row * info_header.width + col
bottom_index := (info_header.height - 1 - row) * info_header.width + col bottom_index := (info_header.height - 1 - row) * info_header.width + col
@ -62,7 +61,7 @@ surface_from_bmp := fn(bmp: ^u8): Surface {
row += 1 row += 1
} }
return .(@bitcast(bmp), @intcast(info_header.width), @intcast(info_header.height)) return .(@bitcast(bmp), info_header.width, info_header.height)
} }
new_surface_from_bmp := fn(bmp: ^u8): Surface { new_surface_from_bmp := fn(bmp: ^u8): Surface {
@ -74,8 +73,8 @@ new_surface_from_bmp := fn(bmp: ^u8): Surface {
info_header := @as(^BitmapInfoHeader, @bitcast(bmp + @sizeof(BitmapFileHeader))) info_header := @as(^BitmapInfoHeader, @bitcast(bmp + @sizeof(BitmapFileHeader)))
bmp += file_header.offset bmp += file_header.offset
width := @as(int, @intcast(info_header.width)) width := @as(uint, @intcast(info_header.width))
height := @as(int, @intcast(info_header.height)) height := @as(uint, @intcast(info_header.height))
surface := new_surface(width, height) surface := new_surface(width, height)
top_start_idx := surface.buf top_start_idx := surface.buf

View file

@ -4,11 +4,11 @@
Surface := struct { Surface := struct {
buf: ^Color, buf: ^Color,
width: int, width: uint,
height: int, height: uint,
} }
new_surface := fn(width: int, height: int): Surface { new_surface := fn(width: uint, height: uint): Surface {
return .( return .(
@inline(memory.alloc, Color, width * height), @inline(memory.alloc, Color, width * height),
width, width,
@ -16,7 +16,7 @@ new_surface := fn(width: int, height: int): Surface {
) )
} }
surface_from_ptr := fn(ptr: ^Color, width: int, height: int): Surface { surface_from_ptr := fn(ptr: ^Color, width: uint, height: uint): Surface {
return .( return .(
ptr, ptr,
width, width,
@ -39,8 +39,8 @@ framebuffer := @as(^Color, idk)
init := fn(doublebuffer: bool): Surface { init := fn(doublebuffer: bool): Surface {
framebuffer = dt.get(^Color, "framebuffer/fb0/ptr\0") framebuffer = dt.get(^Color, "framebuffer/fb0/ptr\0")
width := dt.get(int, "framebuffer/fb0/width\0") width := dt.get(uint, "framebuffer/fb0/width\0")
height := dt.get(int, "framebuffer/fb0/height\0") height := dt.get(uint, "framebuffer/fb0/height\0")
if doublebuffer { if doublebuffer {
return new_surface(width, height) return new_surface(width, height)
} else { } else {
@ -49,7 +49,7 @@ init := fn(doublebuffer: bool): Surface {
} }
clear := fn(surface: Surface, color: Color): void { clear := fn(surface: Surface, color: Color): void {
return @inline(memory.set, Color, &color, surface.buf, @bitcast(surface.width * surface.height)) return @inline(memory.set, Color, &color, surface.buf, surface.width * surface.height)
} }
sync := fn(surface: Surface): void { sync := fn(surface: Surface): void {
@ -60,20 +60,20 @@ sync := fn(surface: Surface): void {
return @inline(memory.copy, Color, surface.buf, framebuffer, @bitcast(surface.width * surface.height)) return @inline(memory.copy, Color, surface.buf, framebuffer, @bitcast(surface.width * surface.height))
} }
index := fn(surface: Surface, x: int, y: int): int { index := fn(surface: Surface, x: uint, y: uint): uint {
return x + surface.width * y return x + surface.width * y
} }
indexptr := fn(surface: Surface, x: int, y: int): ^Color { indexptr := fn(surface: Surface, x: uint, y: uint): ^Color {
return surface.buf + @inline(index, surface, x, y) return surface.buf + @inline(index, surface, x, y)
} }
put_pixel := fn(surface: Surface, pos: Vec2(uint), color: Color): void { put_pixel := fn(surface: Surface, pos: Vec2(uint), color: Color): void {
*@inline(indexptr, surface, @intcast(pos.x), @intcast(pos.y)) = color *@inline(indexptr, surface, pos.x, pos.y) = color
return return
} }
put_filled_rect := fn(surface: Surface, pos: Vec2(int), tr: Vec2(int), color: Color): void { put_filled_rect := fn(surface: Surface, pos: Vec2(uint), tr: Vec2(uint), color: Color): void {
top_start_idx := @inline(indexptr, surface, pos.x, pos.y) top_start_idx := @inline(indexptr, surface, pos.x, pos.y)
bottom_start_idx := @inline(indexptr, surface, pos.x, pos.y + tr.y - 1) bottom_start_idx := @inline(indexptr, surface, pos.x, pos.y + tr.y - 1)
rows_to_fill := tr.y rows_to_fill := tr.y
@ -94,7 +94,7 @@ put_filled_rect := fn(surface: Surface, pos: Vec2(int), tr: Vec2(int), color: Co
return return
} }
put_rect := fn(surface: Surface, pos: Vec2(int), tr: Vec2(int), color: Color): void { put_rect := fn(surface: Surface, pos: Vec2(uint), tr: Vec2(uint), color: Color): void {
start_idx := @inline(indexptr, surface, pos.x, pos.y) start_idx := @inline(indexptr, surface, pos.x, pos.y)
end_idx := @inline(indexptr, surface, pos.x, pos.y + tr.y) end_idx := @inline(indexptr, surface, pos.x, pos.y + tr.y)
right_start_idx := @inline(indexptr, surface, pos.x + tr.x, pos.y) right_start_idx := @inline(indexptr, surface, pos.x + tr.x, pos.y)
@ -112,15 +112,15 @@ put_rect := fn(surface: Surface, pos: Vec2(int), tr: Vec2(int), color: Color): v
return return
} }
put_line_low := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color): void { put_line_low := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Color): void {
dx := p1.x - p0.x dx := @as(int, @bitcast(p1.x - p0.x))
dy := p1.y - p0.y dy := @as(int, @bitcast(p1.y - p0.y))
yi := 1 yi := 1
if dy < 0 { if dy < 0 {
yi = -1 yi = -1
dy = -dy dy = -dy
} }
D := 2 * dy - dx D := @as(int, 2) * dy - dx
y := p0.y y := p0.y
x := p0.x x := p0.x
loop if x == p1.x break else { loop if x == p1.x break else {
@ -136,15 +136,15 @@ put_line_low := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color)
return return
} }
put_line_high := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color): void { put_line_high := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Color): void {
dx := p1.x - p0.x dx := @as(int, @bitcast(p1.x - p0.x))
dy := p1.y - p0.y dy := @as(int, @bitcast(p1.y - p0.y))
xi := 1 xi := 1
if dy < 0 { if dy < 0 {
xi = -1 xi = -1
dx = -dx dx = -dx
} }
D := 2 * dx - dy D := @as(int, 2) * dx - dy
x := p0.x x := p0.x
y := p0.y y := p0.y
loop if y == p1.y break else { loop if y == p1.y break else {
@ -160,8 +160,8 @@ put_line_high := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color
return return
} }
put_line := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color): void { put_line := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Color): void {
if math.abs(int, p1.y - p0.y) < math.abs(int, p1.x - p0.x) { if math.abs(uint, p1.y - p0.y) < math.abs(uint, p1.x - p0.x) {
if p0.x > p1.x { if p0.x > p1.x {
@inline(put_line_low, surface, p1, p0, color) @inline(put_line_low, surface, p1, p0, color)
} else { } else {
@ -177,7 +177,7 @@ put_line := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color): vo
return return
} }
put_surface := fn(surface: Surface, top: Surface, pos: Vec2(int), flip_v: bool): void { put_surface := fn(surface: Surface, top: Surface, pos: Vec2(uint), flip_v: bool): void {
top_start_idx := @inline(indexptr, surface, pos.x, pos.y) top_start_idx := @inline(indexptr, surface, pos.x, pos.y)
bottom_start_idx := @inline(indexptr, surface, pos.x, pos.y + top.height - 1) bottom_start_idx := @inline(indexptr, surface, pos.x, pos.y + top.height - 1)
rows_to_copy := top.height rows_to_copy := top.height
@ -279,29 +279,29 @@ put_scaled := fn(surface: Surface, source: Surface, pos: Vec2(int), size: Vec2(i
} }
// peony-made // peony-made
put_trirect := fn(surface: Surface, pos: Vec2(int), size: Vec2(int), color0: Color, color1: Color): void { put_trirect := fn(surface: Surface, pos: Vec2(uint), size: Vec2(int), color0: Color, color1: Color): void {
step := Vec2(int).(1, 1) step := Vec2(int).(1, 1)
if size.x < 0 { if size.x < 0 {
step.x = -1 step.x = -1
} }
if size.y < 0 { if size.y < 0 {
step.y = size.y / size.x step.y /= @bitcast(size.x)
} }
start_y := pos.y start_y := pos.y
target := pos + size target := pos + @bitcast(size)
loop if pos.x == target.x break else { loop if pos.x == target.x break else {
@inline(put_vline, surface, pos.x, pos.y, target.y, color0) @inline(put_vline, surface, pos.x, pos.y, target.y, color0)
@inline(put_vline, surface, pos.x, pos.y, start_y, color1) @inline(put_vline, surface, pos.x, pos.y, start_y, color1)
pos += step pos += @bitcast(step)
} }
return return
} }
// peony-made // peony-made
put_vline := fn(surface: Surface, x: int, y0: int, y1: int, color: Color): void { put_vline := fn(surface: Surface, x: uint, y0: uint, y1: uint, color: Color): void {
if y1 < y0 { if y1 < y0 {
tmp := y0 tmp := y0
y0 = y1 y0 = y1
@ -318,7 +318,7 @@ put_vline := fn(surface: Surface, x: int, y0: int, y1: int, color: Color): void
} }
// peony-made // peony-made
put_hline := fn(surface: Surface, y: int, x0: int, x1: int, color: Color): void { put_hline := fn(surface: Surface, y: uint, x0: uint, x1: uint, color: Color): void {
if x1 < x0 { if x1 < x0 {
tmp := x0 tmp := x0
x0 = x1 x0 = x1

View file

@ -8,6 +8,14 @@ write := fn($Expr: type, msg: ^Expr, buffer_id: int): void {
return @eca(3, buffer_id, msg, @sizeof(Expr)) return @eca(3, buffer_id, msg, @sizeof(Expr))
} }
recv_length := fn(buffer_id: int, memory_map_location: ^u8, length: int): void {
return @eca(4, buffer_id, memory_map_location, length)
}
write_length := fn(msg: ^u8, buffer_id: int, length: int): void {
return @eca(3, buffer_id, msg, length)
}
BufferMsg := packed struct {operation: u8, msg: ^u8, msg_len: uint} BufferMsg := packed struct {operation: u8, msg: ^u8, msg_len: uint}
create := fn(msg: ^u8): int { create := fn(msg: ^u8): int {

View file

@ -2,8 +2,8 @@ string := @use("string.hb")
LogMsg := packed struct {level: u8, string: ^u8, strlen: uint} LogMsg := packed struct {level: u8, string: ^u8, strlen: uint}
log := fn($Level: u8, message: ^u8): void { log := fn(level: u8, message: ^u8): void {
return @eca(3, 1, LogMsg.(Level, message, @inline(string.length, message)), @sizeof(LogMsg)) return @eca(3, 1, LogMsg.(level, message, @inline(string.length, message)), @sizeof(LogMsg))
} }
error := fn(message: ^u8): void return @inline(log, 0, message) error := fn(message: ^u8): void return @inline(log, 0, message)

View file

@ -2,49 +2,27 @@ PAGE_SIZE := 4096
MAX_ALLOC := 0xFF MAX_ALLOC := 0xFF
MAX_FREE := 0xFF MAX_FREE := 0xFF
calc_pages := fn($Expr: type, num: int): int { calc_pages := fn($Expr: type, num: uint): uint {
return 1 + @bitcast(@sizeof(Expr)) * num / PAGE_SIZE return 1 + @sizeof(Expr) * num / PAGE_SIZE
} }
alloc := fn($Expr: type, num: int): ^Expr { alloc := fn($Expr: type, num: uint): ^Expr {
pages := @inline(calc_pages, Expr, num) pages := @inline(calc_pages, Expr, num)
if pages <= MAX_ALLOC { if pages <= MAX_ALLOC {
return @bitcast(request_page(@intcast(pages))) return @bitcast(request_page(@intcast(pages)))
} }
ptr := request_page(0xFF) ptr := request_page(0xFF)
remaining := pages - MAX_ALLOC remaining := pages - MAX_ALLOC
loop if remaining <= 0 break else { loop if remaining < MAX_ALLOC break else {
if remaining < MAX_ALLOC { _ := request_page(@intcast(MAX_ALLOC))
request_page(@intcast(remaining))
} else {
request_page(@intcast(MAX_ALLOC))
}
remaining -= MAX_ALLOC remaining -= MAX_ALLOC
} }
_ := request_page(@intcast(remaining))
return @bitcast(ptr) return @bitcast(ptr)
} }
// ! is broked, somebody fix please :( // ! stub
free := fn($Expr: type, ptr: ^Expr, num: int, nullify: bool): void { free := fn($Expr: type, ptr: ^Expr, num: uint, nullify: bool): void {
if nullify {
null := @as(u8, 0)
set(u8, &null, @bitcast(ptr), @bitcast(num) * @bitcast(PAGE_SIZE))
}
pages := @inline(calc_pages, Expr, num)
if pages <= MAX_FREE {
return release_page(@bitcast(ptr), @intcast(pages))
}
page_ptr := @as(^[u8; PAGE_SIZE], @bitcast(ptr)) + 1
remaining := pages - MAX_FREE
loop if remaining <= 0 break else {
if remaining < MAX_FREE {
release_page(@bitcast(page_ptr), @intcast(remaining))
} else {
release_page(@bitcast(page_ptr), @intcast(MAX_FREE))
}
remaining -= MAX_FREE
page_ptr += 1
}
return return
} }
@ -78,12 +56,12 @@ inl := fn(addr: u16): u32 {
return @eca(3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg)) return @eca(3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
} }
CopyMsg := packed struct {a: u8, count: uint, src: uint, dest: ^u8} CopyMsg := packed struct {a: u8, count: u32, src: ^u8, dest: ^u8}
copy := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void { copy := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void {
return @eca(3, 2, &CopyMsg.(4, count * @sizeof(Expr), @bitcast(src), @bitcast(dest)), @sizeof(CopyMsg)) return @eca(3, 2, &CopyMsg.(4, @intcast(count * @sizeof(Expr)), @bitcast(src), @bitcast(dest)), @sizeof(CopyMsg))
} }
SetMsg := packed struct {a: u8, count: uint, size: uint, src: ^u8, dest: ^u8} SetMsg := packed struct {a: u8, count: u32, size: u32, src: ^u8, dest: ^u8}
set := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void { set := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void {
return @eca(3, 2, &SetMsg.(5, count, @sizeof(Expr), @bitcast(src), @bitcast(dest)), @sizeof(SetMsg)) return @eca(3, 2, &SetMsg.(5, @intcast(count), @intcast(@sizeof(Expr)), @bitcast(src), @bitcast(dest)), @sizeof(SetMsg))
} }

View file

@ -1,8 +1,7 @@
any := fn($Expr: type): Expr { any := fn($Expr: type): Expr {
return @intcast(@eca(3, 4)) return *@eca(3, 4, &@as(Expr, idk), @sizeof(Expr))
} }
range := fn($Expr: type, min: Expr, max: Expr): Expr { range := fn($Expr: type, min: Expr, max: Expr): Expr {
// wtf is this return @inline(any, Expr) % (max - min) + @intcast(1) + min
return @intcast(@as(int, @eca(3, 4)) % @as(int, @intcast(max) - @intcast(min)) + 1 + @intcast(min))
} }

View file

@ -1,10 +1,11 @@
length := fn(ptr: ^u8): uint { length := fn(ptr: ^u8): uint {
len := @as(uint, 0) len := @as(uint, 0)
// loop if *(ptr + len) == 0 return len else len += 1
loop if *(ptr + len) == 0 break else len += 1 loop if *(ptr + len) == 0 break else len += 1
return len return len
} }
display_int := fn(num: int, p: ^u8, radix: int): ^u8 { display_int := fn(num: int, p: ^u8, radix: uint): ^u8 {
ptr := p ptr := p
negative := num < 0 negative := num < 0
if negative { if negative {
@ -33,14 +34,14 @@ display_int := fn(num: int, p: ^u8, radix: int): ^u8 {
ptr += 1 ptr += 1
} else { } else {
loop if num == 0 break else { loop if num == 0 break else {
digit := num % radix digit := num % @bitcast(radix)
if digit < 10 { if digit < 10 {
*ptr = digit + 48 *ptr = @intcast(digit) + 48
} else { } else {
*ptr = digit + 55 *ptr = @intcast(digit) + 55
} }
ptr += 1 ptr += 1
num /= radix num /= @bitcast(radix)
} }
} }
@ -55,11 +56,11 @@ display_int := fn(num: int, p: ^u8, radix: int): ^u8 {
return p return p
} }
reverse := fn(s: ^u8): void { reverse := fn(s: ^u8): void {
len := @inline(length, s) i := @as(uint, 0)
i := 0 j := @inline(length, s) - 1
j := len - 1 temp := @as(u8, 0)
temp := 0
loop if i >= j break else { loop if i >= j break else {
temp = *(s + i); temp = *(s + i);
*(s + i) = *(s + j); *(s + i) = *(s + j);

View file

@ -1,13 +1,13 @@
.{dt} := @use("../../../libraries/stn/src/lib.hb") .{dt} := @use("../../../libraries/stn/src/lib.hb")
main := fn(): int { main := fn(): void {
dt.get(int, "framebuffer/fb0/width\0") dt.get(void, "framebuffer/fb0/width\0")
dt.get(int, "cpu/cpu0/architecture\0") dt.get(void, "cpu/cpu0/architecture\0")
// Checking if the first detected serial port is memory mapped or port mapped // Checking if the first detected serial port is memory mapped or port mapped
// 0 -> memory mapped // 0 -> memory mapped
// 1 -> port mapped // 1 -> port mapped
dt.get(int, "serial_ports/sp0/mapping\0") dt.get(void, "serial_ports/sp0/mapping\0")
return 0 return
} }

View file

@ -1,7 +1,7 @@
READ_ONLY := 0x1 READ_ONLY := @as(u32, 0x1)
HIDDEN := 0x2 HIDDEN := @as(u32, 0x2)
SYSTEM := 0x4 SYSTEM := @as(u32, 0x4)
VOLUME_ID := 0x8 VOLUME_ID := @as(u32, 0x8)
DIRECTORY := 0x10 DIRECTORY := @as(u32, 0x10)
ARCHIVE := 0x20 ARCHIVE := @as(u32, 0x20)
LFN := READ_ONLY | HIDDEN | SYSTEM | VOLUME_ID LFN := READ_ONLY | HIDDEN | SYSTEM | VOLUME_ID

View file

@ -63,7 +63,7 @@ VolumeName := [u8; 11]
SystemIdentifierString := [u8; 8] SystemIdentifierString := [u8; 8]
VALID_SYSTEM_IDENTIFIER_STRING := [u8].(46, 41, 54, 33, 32, 20, 20, 20) VALID_SYSTEM_IDENTIFIER_STRING := [u8].(46, 41, 54, 33, 32, 20, 20, 20)
BOOTABLE_PARTITION_SIGNATURE := 0xAA55 BOOTABLE_PARTITION_SIGNATURE := @as(u32, 0xAA55)
BootCode := [u8; 420] BootCode := [u8; 420]
@ -100,9 +100,10 @@ ebr_sanity_check := fn(ebr: ExtendedBootRecord): int {
log.warn("EBR-Signature sanity check failed\0") log.warn("EBR-Signature sanity check failed\0")
} }
if ebr.system_identifier_string != VALID_SYSTEM_IDENTIFIER_STRING { // ! comparison between [u8] is not supported in hblang
log.warn("EBR-Signature-Identifier-String sanity check failed\0") // if ebr.system_identifier_string != VALID_SYSTEM_IDENTIFIER_STRING {
} // log.warn("EBR-Signature-Identifier-String sanity check failed\0")
// }
return 0 return 0
} }
@ -131,8 +132,8 @@ new_ebr := fn(): ExtendedBootRecord {
) )
} }
VALID_LEAD_FS_INFO := 0x41615252 VALID_LEAD_FS_INFO := @as(u32, 0x41615252)
VALID_TRAIL_FS_INFO := 0xAA550000 VALID_TRAIL_FS_INFO := @as(u32, 0xAA550000)
FSInfo := struct { FSInfo := struct {
// Must be 0x41615252 to indicate a valid FSInfo structure // Must be 0x41615252 to indicate a valid FSInfo structure
@ -145,7 +146,7 @@ FSInfo := struct {
trail_signature: u32, trail_signature: u32,
} }
fs_info_sanity_check := fn(fs_info: FSInfo): int { fs_info_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

View file

@ -16,7 +16,7 @@ FAT12 := 1
FAT16 := 2 FAT16 := 2
FAT32 := 3 FAT32 := 3
calculate_fat_type := fn(sector_size: int, total_clusters: int): int { calculate_fat_type := fn(sector_size: uint, total_clusters: uint): uint {
if sector_size == 0 { if sector_size == 0 {
return ExFAT return ExFAT
} else if total_clusters < 4085 { } else if total_clusters < 4085 {

View file

@ -25,14 +25,14 @@ main := fn(): int {
window := render.new_surface(screen.width / 3, screen.height / 3) window := render.new_surface(screen.width / 3, screen.height / 3)
x := 10 x := 0
mem_buf := memory.request_page(1) mem_buf := memory.request_page(1)
color := random.range(render.Color, render.black, render.white) color := random.any(render.Color)
side := window.width / 8 side := window.width / 8
vel_inner := Vec2(int).(1, 1) vel_inner := Vec2(int).(1, 1)
pos_inner := Vec2(int).((window.width - side) / 2, (window.height - side) / 2) pos_inner := Vec2(uint).((window.width - side) / 2, (window.height - side) / 2)
loop { loop {
// Clear the screen // Clear the screen
@ -48,11 +48,11 @@ main := fn(): int {
if pos_inner.x == 0 | pos_inner.x == window.width - side { if pos_inner.x == 0 | pos_inner.x == window.width - side {
vel_inner.x = -vel_inner.x vel_inner.x = -vel_inner.x
color = random.range(render.Color, render.black, render.white) color = random.any(render.Color)
} }
if pos_inner.y == 20 | pos_inner.y == window.height - side { if pos_inner.y == 20 | pos_inner.y == window.height - side {
vel_inner.y = -vel_inner.y vel_inner.y = -vel_inner.y
color = random.range(render.Color, render.black, render.white) color = random.any(render.Color)
} }
// TODO: Get windows out of a collection and iter through // TODO: Get windows out of a collection and iter through
@ -69,17 +69,17 @@ main := fn(): int {
render.put_filled_rect(window, pos_inner, .(side, side), color) render.put_filled_rect(window, pos_inner, .(side, side), color)
// Apply the image to the screen // Apply the image to the screen
pos := Vec2(int).(x, 100) pos := Vec2(uint).(x, 100)
render.put_surface(screen, window, pos, false) render.put_surface(screen, window, pos, false)
if window_count >= 1 { if window_count >= 1 {
x = 10 x = 0
break break
} }
window_count += 1 window_count += 1
x += 400 x += screen.width / 2
} }
pos_inner += vel_inner pos_inner += @bitcast(vel_inner)
// Sync the screen // Sync the screen
render.sync(screen) render.sync(screen)

View file

@ -7,7 +7,7 @@ send_byte := fn(byte: u8): u8 {
main := fn(): int { main := fn(): int {
buf := buffer.create("XKeyboard\0") buf := buffer.create("XKeyboard\0")
send_byte(238) _ := send_byte(238)
log.info("PS/2 Driver Loaded\0") log.info("PS/2 Driver Loaded\0")
if send_byte(238) == 238 { if send_byte(238) == 238 {
log.info("PS/2 Keyboard Echoed\0") log.info("PS/2 Keyboard Echoed\0")

View file

@ -8,13 +8,13 @@ bmp_1 := @embed("./assets/able.bmp")
bmp_2 := @embed("./assets/mini.bmp") bmp_2 := @embed("./assets/mini.bmp")
example := fn(): void { example := fn(): void {
images := [render.Surface; 2].( images := [render.Surface].(
render.image.surface_from_bmp(@bitcast(&bmp_1)), render.image.surface_from_bmp(@bitcast(&bmp_1)),
render.image.surface_from_bmp(@bitcast(&bmp_2)), render.image.surface_from_bmp(@bitcast(&bmp_2)),
) )
screen := render.init(true) screen := render.init(true)
vel := Vec2(int).(1, 1) vel := Vec2(int).(1, 1)
pos := Vec2(int).(100, 100) pos := Vec2(uint).(100, 100)
n := 0 n := 0
loop { loop {
image := images[n] image := images[n]
@ -31,7 +31,7 @@ example := fn(): void {
n = 1 - n n = 1 - n
} }
pos += vel pos += @bitcast(vel)
} }
return return
} }

View file

@ -8,8 +8,8 @@ render := @use("../../../../libraries/render/src/lib.hb")
example := fn(): void { example := fn(): void {
screen := render.init(true) screen := render.init(true)
render.clear(screen, .(100, 50, 0, 255)) render.clear(screen, .(100, 50, 0, 255))
p0 := Vec2(int).(0, 0) p0 := Vec2(uint).(0, 0)
p1 := Vec2(int).(0, screen.height) p1 := Vec2(uint).(0, screen.height)
loop if p0.y >= screen.height break else { loop if p0.y >= screen.height break else {
render.put_line(screen, p0, p1, .(255, 180, 100, 255)) render.put_line(screen, p0, p1, .(255, 180, 100, 255))
render.put_line(screen, .(screen.width, screen.height) - p0, .(screen.width, screen.height) - p1, .(255, 180, 100, 255)) render.put_line(screen, .(screen.width, screen.height) - p0, .(screen.width, screen.height) - p1, .(255, 180, 100, 255))

View file

@ -5,11 +5,11 @@ example := fn(): void {
screen := render.init(false) screen := render.init(false)
render.clear(screen, render.black) render.clear(screen, render.black)
loop { loop {
x := random.range(int, 0, 1024) x := random.range(uint, 0, screen.width)
y := random.range(int, 0, 768) y := random.range(uint, 0, screen.height)
r := random.range(int, 0, 255) r := random.range(u8, 0, 255)
g := random.range(int, 0, 75) g := random.range(u8, 0, 75)
b := random.range(int, 0, 155) b := random.range(u8, 0, 155)
render.put_pixel(screen, .(x, y), .(b, g, r, 255)) render.put_pixel(screen, .(x, y), .(b, g, r, 255))
} }
return return

View file

@ -9,8 +9,8 @@ example := fn(): void {
screen := render.init(true) screen := render.init(true)
vel := Vec2(int).(1, 1) vel := Vec2(int).(1, 1)
side := screen.width / 8 side := screen.width / 8
pos := Vec2(int).((screen.width - side) / 2, (screen.height - side) / 2) pos := Vec2(uint).((screen.width - side) / 2, (screen.height - side) / 2)
color := random.range(render.Color, render.black, render.white) color := random.any(render.Color)
loop { loop {
render.put_filled_rect(screen, pos, .(side, side), color) render.put_filled_rect(screen, pos, .(side, side), color)
render.sync(screen) render.sync(screen)
@ -18,14 +18,14 @@ example := fn(): void {
if pos.x == 0 | pos.x == screen.width - side { if pos.x == 0 | pos.x == screen.width - side {
vel.x = -vel.x vel.x = -vel.x
color = random.range(render.Color, render.black, render.white) color = random.any(render.Color)
} }
if pos.y == 0 | pos.y == screen.height - side { if pos.y == 0 | pos.y == screen.height - side {
vel.y = -vel.y vel.y = -vel.y
color = random.range(render.Color, render.black, render.white) color = random.any(render.Color)
} }
pos += vel pos += @bitcast(vel)
} }
return return
} }

View file

@ -10,14 +10,12 @@ example := fn(): void {
image := render.new_surface(screen.width / 3, screen.height / 3) image := render.new_surface(screen.width / 3, screen.height / 3)
vel := Vec2(int).(-1, -1) vel := Vec2(int).(-1, -1)
pos := Vec2(int).(100, 100) pos := Vec2(uint).(100, 100)
side := image.width / 8 side := image.width / 8
vel_inner := Vec2(int).(1, 1) vel_inner := Vec2(int).(1, 1)
pos_inner := Vec2(int).((image.width - side) / 2, (image.height - side) / 2) pos_inner := Vec2(uint).((image.width - side) / 2, (image.height - side) / 2)
// workaround for compiler bug color := random.any(render.Color)
color := render.Color.(0, 0, 0, 0) target_color := random.any(render.Color)
color = random.range(render.Color, render.black, render.white)
target_color := color
loop { loop {
render.clear(screen, render.black) render.clear(screen, render.black)
render.put_filled_rect(image, pos_inner, .(side, side), color) render.put_filled_rect(image, pos_inner, .(side, side), color)
@ -30,11 +28,11 @@ example := fn(): void {
if pos_inner.x == 0 | pos_inner.x == image.width - side { if pos_inner.x == 0 | pos_inner.x == image.width - side {
vel_inner.x = -vel_inner.x vel_inner.x = -vel_inner.x
target_color = random.range(render.Color, render.black, render.white) target_color = random.any(render.Color)
} }
if pos_inner.y == 0 | pos_inner.y == image.height - side { if pos_inner.y == 0 | pos_inner.y == image.height - side {
vel_inner.y = -vel_inner.y vel_inner.y = -vel_inner.y
target_color = random.range(render.Color, render.black, render.white) target_color = random.any(render.Color)
} }
if pos.x == 0 | pos.x == screen.width - image.width { if pos.x == 0 | pos.x == screen.width - image.width {
@ -45,13 +43,13 @@ example := fn(): void {
} }
color += .( color += .(
@intcast(color.b < target_color.b) - @intcast(color.b > target_color.b), @bitcast(color.b < target_color.b) - @bitcast(color.b > target_color.b),
@intcast(color.g < target_color.g) - @intcast(color.g > target_color.g), @bitcast(color.g < target_color.g) - @bitcast(color.g > target_color.g),
@intcast(color.r < target_color.r) - @intcast(color.r > target_color.r), @bitcast(color.r < target_color.r) - @bitcast(color.r > target_color.r),
0, 0,
) )
pos += vel pos += @bitcast(vel)
pos_inner += vel_inner pos_inner += @bitcast(vel_inner)
} }
return return
} }

View file

@ -12,7 +12,7 @@ example := fn(): void {
width := screen.width width := screen.width
height := screen.height height := screen.height
cell_size := 0 cell_size := 0
range := Vec2(int).(0, 0) range := Vec2(uint).(0, 0)
if width > height { if width > height {
cell_size = width / 40 cell_size = width / 40
range = .(39, height / cell_size - 1) range = .(39, height / cell_size - 1)
@ -24,19 +24,19 @@ example := fn(): void {
height -= 1 height -= 1
scroll := 0 scroll := 0
target := Vec2(int).(random.range(int, 0, range.x), random.range(int, 0, range.y)) target := Vec2(uint).(random.range(uint, 0, range.x), random.range(uint, 0, range.y))
halfcell := cell_size / 2 halfcell := cell_size / 2
octcell := cell_size / 8 octcell := cell_size / 8
sevenoctcell := cell_size - octcell sevenoctcell := cell_size - octcell
seeker := Vec2(int).(random.range(int, 0, range.x), random.range(int, 0, range.y)) seeker := Vec2(uint).(random.range(uint, 0, range.x), random.range(uint, 0, range.y))
loop { loop {
render.clear(screen, render.black) render.clear(screen, render.black)
target_pixel_coord := target * .(cell_size, cell_size) + .(scroll, scroll) target_pixel_coord := target * .(@bitcast(cell_size), @bitcast(cell_size)) + .(scroll, scroll)
render.put_trirect(screen, target_pixel_coord, .(cell_size, cell_size), render.red, render.light_red) render.put_trirect(screen, target_pixel_coord, .(@bitcast(cell_size), @bitcast(cell_size)), render.red, render.light_red)
render.put_hline(screen, target_pixel_coord.y + halfcell, target_pixel_coord.x - octcell, target_pixel_coord.x - sevenoctcell, render.light_red) render.put_hline(screen, target_pixel_coord.y + halfcell, target_pixel_coord.x - octcell, target_pixel_coord.x - sevenoctcell, render.light_red)
render.put_hline(screen, target_pixel_coord.y + halfcell, target_pixel_coord.x + cell_size + octcell, target_pixel_coord.x + cell_size + sevenoctcell, render.light_red) render.put_hline(screen, target_pixel_coord.y + halfcell, target_pixel_coord.x + cell_size + octcell, target_pixel_coord.x + cell_size + sevenoctcell, render.light_red)
@ -69,7 +69,7 @@ example := fn(): void {
} else if seeker.y > target.y { } else if seeker.y > target.y {
seeker.y -= 1 seeker.y -= 1
} else { } else {
target = .(random.range(int, 0, range.x), random.range(int, 0, range.y)) target = .(random.range(uint, 0, range.x), random.range(uint, 0, range.y))
} }
scroll += 1 scroll += 1

View file

@ -1,7 +1,7 @@
.{memory, buffer} := @use("../../../libraries/stn/src/lib.hb") .{memory, buffer} := @use("../../../libraries/stn/src/lib.hb")
serial_print := fn(ptr: ^u8): void { serial_print := fn(ptr: ^u8): void {
letter := 0 letter := @as(u8, 0)
loop if *ptr == 0 break else { loop if *ptr == 0 break else {
letter = *ptr letter = *ptr
memory.outb(0xF803, letter) memory.outb(0xF803, letter)

View file

@ -21,9 +21,9 @@ main := fn(): int {
beep() beep()
//service_search() //service_search()
buf := "\0\0\0\0" buf := "\0\0\0\0"
x := 0 x := @as(int, 0)
loop if x == 255 break else { loop if x > 255 break else {
log.info(string.display_int(x, buf, 10)) log.info(string.display_int(x, buf, 2))
x += 1 x += 1
} }
return 0 return 0

View file

@ -26,17 +26,17 @@ resolution = "1600x900x24"
# [boot.limine.ableos.modules.diskio_driver] # [boot.limine.ableos.modules.diskio_driver]
# path = "boot:///diskio_driver.hbf" # path = "boot:///diskio_driver.hbf"
[boot.limine.ableos.modules.render_example] # [boot.limine.ableos.modules.render_example]
path = "boot:///render_example.hbf" # path = "boot:///render_example.hbf"
# [boot.limine.ableos.modules.serial_driver_test] # [boot.limine.ableos.modules.serial_driver_test]
# path = "boot:///serial_driver_test.hbf" # path = "boot:///serial_driver_test.hbf"
# [boot.limine.ableos.modules.horizon] [boot.limine.ableos.modules.horizon]
# path = "boot:///horizon.hbf" path = "boot:///horizon.hbf"
# [boot.limine.ableos.modules.horizon_testing_program] [boot.limine.ableos.modules.horizon_testing_program]
# path = "boot:///horizon_testing_program.hbf" path = "boot:///horizon_testing_program.hbf"
# [boot.limine.ableos.modules.dt_buffer_test] # [boot.limine.ableos.modules.dt_buffer_test]
# path = "boot:///dt_buffer_test.hbf" # path = "boot:///dt_buffer_test.hbf"