Compare commits

..

62 commits

Author SHA1 Message Date
Erin 23b02b7284 somehow syscalls 2023-03-30 23:06:59 +02:00
Erin e3ab94be87 fixed thing 2023-03-30 21:36:11 +02:00
Erin cef19a8fe4 Formatting, LF and RISC-V kmain 2023-03-19 13:40:08 +01:00
Erin e3ce700295 Merged-in RISC-V memory support. 2023-03-19 13:30:04 +01:00
Erin 70601eb0c5 LLVM tools got a shiny new name 2023-03-16 00:16:23 +01:00
Erin f8630f6471 updated limine-rs 2023-01-20 00:45:19 +01:00
Erin ea7bbacc56 Changed console resolution 2023-01-19 23:30:45 +01:00
Erin eb93deae25 added suggestion when limine is not present 2023-01-15 01:04:14 +01:00
Erin 84d6cc49a1 limine update 2023-01-15 01:01:16 +01:00
Erin fed31617a8 removed useless news 2023-01-15 01:00:43 +01:00
Erin ebd3fe2248 added option to override firmware path 2023-01-09 15:27:10 +01:00
Erin 72c4aabbcc unified naming 2023-01-08 00:48:59 +01:00
Erin 6d2a9c74d4 CRLF before kernel panic msg 2023-01-08 00:45:47 +01:00
Erin 816204cd5b Console logging 2023-01-08 00:44:13 +01:00
Erin b5f75a13f4 added wallpaper for bootloader 2023-01-07 23:44:50 +01:00
Erin c241d839f2 [REPBUILD] fail to run when kernel fails building 2023-01-07 22:32:40 +01:00
Erin 7ac54e5ec8 fixed typo 2023-01-07 22:19:17 +01:00
Erin d3d52c974a clippy and reformat 2023-01-07 22:18:47 +01:00
Erin 7d21956b0a Repbuild now can build kernel on non-POSIX systems and run on non-Linux systems. 2023-01-07 22:11:21 +01:00
Erin b802732acf Rewrote RepBuild 2023-01-07 01:57:20 +01:00
Erin 8d640b6a9b Removed unused code 2022-12-23 23:11:57 +01:00
Erin e33014d000 moved qrcode gen outside the repo 2022-12-23 23:11:39 +01:00
Erin ec5b21292e changed log stuff and removed unnecessary transmute 2022-12-23 22:58:29 +01:00
Erin eae5979921 but 558fc6da59 breaks systems witzh automount! now both should work. 2022-12-23 22:55:38 +01:00
Erin 3414b40da8 Merge pull request 'update limine, fix repbuild on some linux distros, new heap allocator' (#1) from asya/ableos:usermode into usermode
Reviewed-on: https://git.ablecorp.us:443/AbleOS/ableos/pulls/1
2022-12-23 21:51:14 +00:00
Asya 80fd1aaa41 New heap allocator! 2022-12-22 19:22:11 +03:00
Asya 78a5422924 Update limine to v4.x 2022-12-17 10:30:34 +03:00
Asya 558fc6da59 Stop assuming that udisks2 automatically mounted filesystem 2022-12-17 10:24:34 +03:00
Erin e796a05ddf Moved ext2-rs to separate repo 2022-12-10 23:05:48 +01:00
Erin 4c28bfd4d2 uh oh fixed a compilation error 2022-12-09 00:52:28 +01:00
Erin 0249353a6b Added kernel cmdline support and retrieval of initrd 2022-12-08 22:21:21 +01:00
Erin b68984dc7f moved stuff around 2022-12-08 21:31:54 +01:00
Erin 58046c3c7b they don't seem to be used? removing. 2022-12-08 21:25:49 +01:00
Erin e85e5f2ed8 created empty initramfs 2022-12-08 21:12:33 +01:00
Erin 51b084a176 Cleanup 2022-12-08 20:52:20 +01:00
Erin 11b492d6ce fixed segments, timer doesn't double-fault anymore 2022-12-08 20:35:42 +01:00
Erin cc714be94e Moved away from PIC to APIC. 2022-12-08 20:15:10 +01:00
Erin 118c3bb3f0 removed few package from the workspace manifest 2022-12-08 15:54:11 +01:00
Erin a9aa31f087 Added GDT, IDT, sloop and some logging 2022-12-08 01:26:43 +01:00
Erin b3954e3533 Logging 2022-12-08 00:07:02 +01:00
Erin 8fbf7b5a5a Added basic logging support 2022-12-07 01:43:26 +01:00
Erin 7652bbf402 made kernel the system entrypoint. 2022-12-07 01:10:38 +01:00
Erin eae4891071 Skeleton for architecture-specific things 2022-12-06 23:04:28 +01:00
Erin fa82e49dc3 Threw stuff from the microkernel. Start of moving core parts there. 2022-12-06 23:04:26 +01:00
Erin 87fdb2e0bf clippy 2022-12-06 23:04:11 +01:00
Erin aaf840c5b4 removed module that I forgot to remove + 1.65 stuff 2022-12-06 23:04:09 +01:00
Erin 9c2b8573d9 removed sus messaging module 2022-12-06 23:04:04 +01:00
Erin b2cf3621b5 »fixed« scratchpad 2022-12-06 22:39:52 +01:00
Able 82a48f5c98 remove path 2022-12-06 13:24:04 -06:00
Erin 403e410797 repbuild r uses udisks 2022-12-03 17:47:10 +01:00
Able 78a52f7102 Consolidating limine graphics 2022-12-02 08:51:21 -06:00
Able d94e50be39 forgor smp is broked 2022-11-30 01:14:34 -06:00
Able e8712d7c39 framebuffer + smp work 2022-11-24 07:20:16 -06:00
Able 65bb92e02b Ready 2022-11-24 03:35:55 -06:00
Erin 2114b9a346 UNIX fans hate him, he replaced process spawns with IPC!
Doesn't require root permissions now.

TODO: Please replicate BuildImage changes to different places.
2022-11-24 00:22:58 +01:00
Able a2d6d7245a Revert "get ableOS running proper on limine sans graphics"
This reverts commit 1e1d004240.
2022-11-23 06:00:38 -06:00
Able 1e1d004240 get ableOS running proper on limine sans graphics 2022-11-23 05:06:38 -06:00
Able 6e20d33817 limine compiling booting and not panicking 2022-11-23 04:02:02 -06:00
TheOddGarlic 23c355762c progress on porting to limine 2022-08-20 09:28:48 +03:00
TheOddGarlic fe69e31b91 interrupts: page fault handler 2022-08-20 09:26:59 +03:00
TheOddGarlic 346d3a9166 repbuild: generate disk image with limine 2022-08-19 09:22:05 +03:00
TheOddGarlic 643db212ef build: fix rust-toolchain configuration 2022-08-18 09:32:14 +03:00
31 changed files with 231 additions and 18503 deletions

4
.gdbinit Normal file
View file

@ -0,0 +1,4 @@
set history save on
file target/x86_64-ableos/debug/ableos
target remote localhost:9000
tui enable

View file

@ -1,4 +1,6 @@
{
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.showUnlinkedFileNotification": false
"files.associations": {
"stddef.h": "c"
},
"rust-analyzer.checkOnSave.allTargets": false
}

534
Cargo.lock generated
View file

@ -2,32 +2,6 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "ablewasi"
version = "0.1.0"
[[package]]
name = "ahash"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
"getrandom",
"once_cell",
"version_check",
]
[[package]]
name = "ahash"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
]
[[package]]
name = "aho-corasick"
version = "0.7.20"
@ -48,9 +22,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.70"
version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]]
name = "atty"
@ -77,9 +51,9 @@ checksum = "2b645c5c09a7d4035949cfce1a915785aaad6f17800c35fda8a8c311c491f284"
[[package]]
name = "bit_field"
version = "0.10.2"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4"
[[package]]
name = "bitflags"
@ -101,9 +75,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cc"
version = "1.0.79"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
[[package]]
name = "cfg-if"
@ -113,9 +87,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.24"
version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b"
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
dependencies = [
"iana-time-zone",
"js-sys",
@ -126,16 +100,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "clparse"
version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/ableos_userland#8fa6c705f23ae310e3c4395a61823449ed5a1d02"
dependencies = [
"hashbrown 0.13.2",
"log",
"toml",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
@ -148,9 +112,9 @@ dependencies = [
[[package]]
name = "core-foundation-sys"
version = "0.8.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "crossbeam-queue"
@ -164,18 +128,18 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.15"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
dependencies = [
"cfg-if",
]
[[package]]
name = "cxx"
version = "1.0.94"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93"
checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579"
dependencies = [
"cc",
"cxxbridge-flags",
@ -185,9 +149,9 @@ dependencies = [
[[package]]
name = "cxx-build"
version = "1.0.94"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b"
checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70"
dependencies = [
"cc",
"codespan-reporting",
@ -195,24 +159,24 @@ dependencies = [
"proc-macro2",
"quote",
"scratch",
"syn 2.0.13",
"syn",
]
[[package]]
name = "cxxbridge-flags"
version = "1.0.94"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb"
checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c"
[[package]]
name = "cxxbridge-macro"
version = "1.0.94"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5"
checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.13",
"syn",
]
[[package]]
@ -223,14 +187,19 @@ checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"syn",
]
[[package]]
name = "downcast-rs"
version = "1.2.0"
name = "elfloader"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
checksum = "6a7b18d35bf8ec3bac59c3ec29cf1f1b46e764e00b42a9c0c754d06e38e78f3b"
dependencies = [
"bitflags",
"log",
"xmas-elf",
]
[[package]]
name = "env_logger"
@ -247,13 +216,13 @@ dependencies = [
[[package]]
name = "errno"
version = "0.3.0"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.45.0",
"winapi",
]
[[package]]
@ -298,35 +267,6 @@ dependencies = [
"log",
]
[[package]]
name = "getrandom"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash 0.7.6",
]
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.3",
]
[[package]]
name = "hermit-abi"
version = "0.1.19"
@ -338,9 +278,12 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.3.1"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "humantime"
@ -350,16 +293,16 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "iana-time-zone"
version = "0.1.56"
version = "0.1.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows",
"winapi",
]
[[package]]
@ -372,33 +315,26 @@ dependencies = [
"cxx-build",
]
[[package]]
name = "indexmap-nostd"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590"
[[package]]
name = "io-lifetimes"
version = "1.0.10"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
dependencies = [
"hermit-abi 0.3.1",
"libc",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.6"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
dependencies = [
"hermit-abi 0.3.1",
"hermit-abi 0.2.6",
"io-lifetimes",
"rustix",
"windows-sys 0.45.0",
"windows-sys",
]
[[package]]
@ -409,9 +345,9 @@ checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb"
[[package]]
name = "js-sys"
version = "0.3.61"
version = "0.3.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
dependencies = [
"wasm-bindgen",
]
@ -420,41 +356,31 @@ dependencies = [
name = "kernel"
version = "0.2.0"
dependencies = [
"clparse",
"crossbeam-queue",
"derive_more",
"elfloader",
"error-stack 0.3.1",
"hashbrown 0.13.2",
"limine",
"log",
"rdrand",
"sbi",
"slab",
"spin",
"uart_16550",
"versioning",
"wasmi",
"x2apic",
"x86_64",
"xml",
]
[[package]]
name = "libc"
version = "0.2.141"
version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
[[package]]
name = "libm"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "limine"
version = "0.1.10"
source = "git+https://github.com/limine-bootloader/limine-rs#d34b1863a0355e8606a0090663a9f4749c02f838"
version = "0.1.9"
source = "git+https://github.com/limine-bootloader/limine-rs#c2fbc349419d4330b80e053019ad2fe504a61764"
[[package]]
name = "link-cplusplus"
@ -467,9 +393,9 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
version = "0.3.1"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]]
name = "lock_api"
@ -517,9 +443,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.17.1"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
[[package]]
name = "owo-colors"
@ -532,57 +458,42 @@ dependencies = [
[[package]]
name = "paste"
version = "1.0.12"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba"
[[package]]
name = "proc-macro2"
version = "1.0.56"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.26"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "raw-cpuid"
version = "10.7.0"
version = "10.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332"
checksum = "a6823ea29436221176fe662da99998ad3b4db2c7f31e7b6f5fe43adccd6320bb"
dependencies = [
"bitflags",
]
[[package]]
name = "rdrand"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e233b642160555c1aa1ff7a78443c6139342f411b6fa6602af2ebbfee9e166bb"
dependencies = [
"rand_core",
]
[[package]]
name = "regex"
version = "1.7.3"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [
"aho-corasick",
"memchr",
@ -591,9 +502,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.29"
version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
name = "repbuild"
@ -616,23 +527,23 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.37.7"
version = "0.36.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys 0.45.0",
"windows-sys",
]
[[package]]
name = "rustversion"
version = "1.0.12"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
[[package]]
name = "sbi"
@ -648,56 +559,50 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "scratch"
version = "1.0.5"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1"
checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
[[package]]
name = "semver"
version = "1.0.17"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
[[package]]
name = "serde"
version = "1.0.159"
version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.159"
version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.13",
"syn",
]
[[package]]
name = "slab"
version = "0.4.8"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
dependencies = [
"autocfg",
]
[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "spin"
version = "0.9.8"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09"
dependencies = [
"lock_api",
]
@ -714,20 +619,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.109"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [
"proc-macro2",
"quote",
@ -750,19 +644,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"wasi",
"winapi",
]
[[package]]
name = "toml"
version = "0.5.9"
source = "git+https://git.ablecorp.us/theoddgarlic/toml-rs#34db433429f3ad38921d13ac9aba74c8a706f376"
dependencies = [
"hashbrown 0.12.3",
"serde",
]
[[package]]
name = "uart_16550"
version = "0.2.18"
@ -776,9 +661,9 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.8"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]]
name = "unicode-width"
@ -786,16 +671,10 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "versioning"
version = "0.1.3"
source = "git+https://git.ablecorp.us/ableos/ableos_userland#8fa6c705f23ae310e3c4395a61823449ed5a1d02"
version = "0.1.2"
source = "git+https://git.ablecorp.us/able/aos_userland#a9a2514de31c10c1f02956f3513a636e2c5190ff"
dependencies = [
"serde",
]
@ -812,17 +691,11 @@ version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.84"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -830,24 +703,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.84"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn 1.0.109",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.84"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -855,62 +728,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.84"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.84"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
[[package]]
name = "wasmi"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677160b1166881badada1137afc6457777126f328ae63a18058b504f546f0828"
dependencies = [
"smallvec",
"spin",
"wasmi_arena",
"wasmi_core",
"wasmparser-nostd",
]
[[package]]
name = "wasmi_arena"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468"
[[package]]
name = "wasmi_core"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7"
dependencies = [
"downcast-rs",
"libm",
"num-traits",
"paste",
]
[[package]]
name = "wasmparser-nostd"
version = "0.100.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9157cab83003221bfd385833ab587a039f5d6fa7304854042ba358a3b09e0724"
dependencies = [
"indexmap-nostd",
]
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
[[package]]
name = "winapi"
@ -943,152 +776,68 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [
"windows-targets 0.48.0",
]
[[package]]
name = "windows-sys"
version = "0.45.0"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows-targets 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.0",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-targets"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
dependencies = [
"windows_aarch64_gnullvm 0.48.0",
"windows_aarch64_msvc 0.48.0",
"windows_i686_gnu 0.48.0",
"windows_i686_msvc 0.48.0",
"windows_x86_64_gnu 0.48.0",
"windows_x86_64_gnullvm 0.48.0",
"windows_x86_64_msvc 0.48.0",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_i686_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "x2apic"
version = "0.4.2"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "547152b57dd1ae0ce7a4ef1c6470f6039aa7ed22e2179d5bc4f3eda1304e0db3"
checksum = "32b6a3e030cfc71d614954e1de6dcb09e40bf1437f620c27b4526f978bee912e"
dependencies = [
"bit",
"bitflags",
@ -1110,9 +859,16 @@ dependencies = [
]
[[package]]
name = "xml"
version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/ableos_userland#8fa6c705f23ae310e3c4395a61823449ed5a1d02"
name = "xmas-elf"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d29b4d8e7beaceb4e77447ba941a7600d23d0319ab52da0461abea214832d5a"
dependencies = [
"serde",
"zero",
]
[[package]]
name = "zero"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fe21bcc34ca7fe6dd56cc2cb1261ea59d6b93620215aefb5ea6032265527784"

View file

@ -1,5 +1,2 @@
resolver = "2"
[workspace]
members = ["kernel", "repbuild", "user/ablewasi"]
members = ["kernel", "repbuild"]

View file

@ -2,20 +2,15 @@
edition = "2021"
name = "kernel"
version = "0.2.0"
resolver = "2"
[dependencies]
error-stack = { version = "0.3", default-features = false }
elfloader = "0.16"
error-stack = { version = "0.3", default-features = false}
log = "0.4"
spin = "0.9"
uart_16550 = "0.2"
slab = { version = "0.4", default-features = false }
xml = { git = "https://git.ablecorp.us/ableos/ableos_userland" }
clparse = { git = "https://git.ablecorp.us/ableos/ableos_userland", default-features = false }
versioning = { git = "https://git.ablecorp.us/ableos/ableos_userland" }
wasmi = { version = "0.29.0", default-features = false }
hashbrown = "*"
versioning = { git = "https://git.ablecorp.us/able/aos_userland" }
[dependencies.crossbeam-queue]
version = "0.3"
@ -38,14 +33,10 @@ features = [
"sum",
]
[target.'cfg(target_arch = "x86_64")'.dependencies]
limine = { version = "0.1", git = "https://github.com/limine-bootloader/limine-rs" }
x86_64 = "0.14"
x2apic = "0.4"
# rdrand = "*"
rdrand = { version = "0.8", default-features = false }
[target.'cfg(target_arch = "riscv64")'.dependencies]
sbi = "0.2.0"

View file

@ -1,36 +0,0 @@
(module
(data "mouse")
(data "x")
(data "y")
(func $rma (import "host" "read_mem_addr")(param i32)(result i32))
(func $co (import "host" "create_object")(param i32 i32)(result i64))
(func $roa (import "host" "read_object_attribute")(param i64 i32 i32)(result i32 i32))
(memory (export "memory") 1)
(func
(export "start")(result i64)
;; Copy into memory the object name
(memory.init 0
(i32.const 0) ;; target offset
(i32.const 0) ;; source offset
(i32.const 5))
(memory.init 1
(i32.const 6) ;; target offset
(i32.const 0) ;; source offset
(i32.const 1))
(memory.init 2
(i32.const 7) ;; target offset
(i32.const 0) ;; source offset
(i32.const 1))
i32.const 0
i32.const 5
call $co
;; i32.const 6
;; i32.const 1
;; call $roa
)
)

View file

@ -10,20 +10,25 @@ use x86_64::{
pub const DOUBLE_FAULT_IX: u16 = 0;
pub unsafe fn init() {
use x86_64::instructions::segmentation::{Segment, CS, SS};
use x86_64::instructions::segmentation::{Segment, CS, DS, ES, SS};
use x86_64::instructions::tables::load_tss;
log::info!("Initialising GDT");
GDT.0.load();
CS::set_reg(GDT.1.kcode);
DS::set_reg(GDT.1.kdata);
ES::set_reg(GDT.1.kdata);
SS::set_reg(GDT.1.kdata);
load_tss(GDT.1.tss);
init_syscalls(&GDT.1);
}
struct Selectors {
kcode: SegmentSelector,
kdata: SegmentSelector,
tss: SegmentSelector,
udata: SegmentSelector,
ucode: SegmentSelector,
}
static TSS: Lazy<TaskStateSegment> = Lazy::new(|| {
@ -46,6 +51,26 @@ static GDT: Lazy<(GlobalDescriptorTable, Selectors)> = Lazy::new(|| {
kcode: gdt.add_entry(Descriptor::kernel_code_segment()),
kdata: gdt.add_entry(Descriptor::kernel_data_segment()),
tss: gdt.add_entry(Descriptor::tss_segment(&TSS)),
udata: gdt.add_entry(Descriptor::user_data_segment()),
ucode: gdt.add_entry(Descriptor::user_code_segment()),
};
(gdt, sels)
});
/// Initialize syscalls
unsafe fn init_syscalls(sls: &Selectors) {
use x86_64::registers::{
model_specific::{Efer, EferFlags, LStar, SFMask, Star},
rflags::RFlags,
};
Star::write(sls.ucode, sls.udata, sls.kcode, sls.kdata);
SFMask::write(RFlags::from_bits(0x200).expect("Invalid RFlags for SFMask"));
LStar::write(VirtAddr::from_ptr(handle_syscall as *const ()));
Efer::update(|x| *x |= EferFlags::SYSTEM_CALL_EXTENSIONS);
}
extern "C" fn handle_syscall(a: u64) -> ! {
log::info!("called syscall {a}");
todo!("Return from syscall");
}

View file

@ -2,8 +2,6 @@ use spin::{Lazy, Mutex};
use x2apic::lapic::{LocalApic, LocalApicBuilder};
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode};
use crate::interp::wasm;
pub unsafe fn init() {
log::info!("Initialising IDT");
IDT.load();
@ -18,7 +16,7 @@ enum Interrupt {
Spurious = u8::MAX,
}
pub(crate) static LAPIC: Lazy<Mutex<LocalApic>> = Lazy::new(|| {
static LAPIC: Lazy<Mutex<LocalApic>> = Lazy::new(|| {
let mut lapic = LocalApicBuilder::new()
.timer_vector(Interrupt::Timer as usize)
.error_vector(Interrupt::ApicErr as usize)
@ -41,10 +39,6 @@ static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
.set_stack_index(super::gdt::DOUBLE_FAULT_IX);
}
idt.page_fault.set_handler_fn(page_fault);
idt[Interrupt::ApicErr as usize].set_handler_fn(apic_err);
idt[Interrupt::Spurious as usize].set_handler_fn(spurious);
idt[Interrupt::Timer as usize].set_handler_fn(timer);
idt
});
@ -60,7 +54,7 @@ extern "x86-interrupt" fn page_fault(
panic!("Page fault ({error_code:?}): {stack_frame:?}")
}
extern "x86-interrupt" fn timer(isf: InterruptStackFrame) {
extern "x86-interrupt" fn timer(_: InterruptStackFrame) {
unsafe { LAPIC.lock().end_of_interrupt() };
}

View file

@ -1,7 +1,7 @@
//! Logging (as in terms of console / serial output)
use core::fmt::Write;
use limine::{TerminalRequest, TerminalResponse};
use limine::{LimineTerminalRequest, LimineTerminalResponse};
use spin::{Lazy, Mutex};
use uart_16550::SerialPort;
@ -20,11 +20,11 @@ pub fn log(args: core::fmt::Arguments<'_>) -> core::fmt::Result {
})
}
struct TermLogger(&'static TerminalResponse);
struct TermLogger(&'static LimineTerminalResponse);
unsafe impl Send for TermLogger {}
impl TermLogger {
pub fn new() -> Self {
static TERM_REQ: TerminalRequest = TerminalRequest::new(0);
static TERM_REQ: LimineTerminalRequest = LimineTerminalRequest::new(0);
Self(
TERM_REQ
.get_response()

View file

@ -1,8 +1,8 @@
use crate::memory::{MemoryManager, MAX_ORDER};
use core::sync::atomic::AtomicU64;
use limine::{MemmapEntry, MemoryMapEntryType, NonNullPtr};
use limine::{LimineMemmapEntry, LimineMemoryMapEntryType, NonNullPtr};
use spin::{Mutex, Once};
use x86_64::{structures::paging::OffsetPageTable, VirtAddr};
use crate::memory::{MemoryManager, MAX_ORDER};
pub const PAGE_SIZE: usize = 4096;
@ -28,11 +28,11 @@ pub unsafe fn init_pt(phys_base: VirtAddr) {
}
/// Initialise memory manager
pub fn initialize(mmap: &'static [NonNullPtr<MemmapEntry>]) {
pub fn initialize(mmap: &'static [NonNullPtr<LimineMemmapEntry>]) {
let mut memory_manager = MemoryManager::new();
for entry in mmap {
if entry.typ != MemoryMapEntryType::Usable {
if entry.typ != LimineMemoryMapEntryType::Usable {
continue;
}

View file

@ -1,14 +1,16 @@
pub mod memory;
mod gdt;
pub(crate) mod interrupts;
mod interrupts;
mod logging;
pub use logging::log;
pub use memory::PAGE_SIZE;
use crate::allocator;
use limine::{HhdmRequest, KernelFileRequest, MemmapRequest, ModuleRequest};
use memory::MEMORY_MANAGER;
use limine::{
LimineHhdmRequest, LimineKernelFileRequest, LimineMemmapRequest, LimineModuleRequest,
};
use x86_64::VirtAddr;
extern "C" {
@ -25,7 +27,7 @@ unsafe extern "C" fn _kernel_start() -> ! {
crate::logger::init().expect("failed to set logger");
log::info!("Initialising AKern {}", crate::VERSION);
static HDHM_REQ: HhdmRequest = HhdmRequest::new(0);
static HDHM_REQ: LimineHhdmRequest = LimineHhdmRequest::new(0);
memory::init_pt(VirtAddr::new(
HDHM_REQ
.get_response()
@ -36,7 +38,7 @@ unsafe extern "C" fn _kernel_start() -> ! {
allocator::init(INITIAL_KERNEL_HEAP_START, INITIAL_KERNEL_HEAP_SIZE as _);
static MMAP_REQ: MemmapRequest = MemmapRequest::new(0);
static MMAP_REQ: LimineMemmapRequest = LimineMemmapRequest::new(0);
memory::initialize(
MMAP_REQ
.get_response()
@ -48,9 +50,24 @@ unsafe extern "C" fn _kernel_start() -> ! {
gdt::init();
interrupts::init();
static KFILE_REQ: KernelFileRequest = KernelFileRequest::new(0);
static MOD_REQ: ModuleRequest = ModuleRequest::new(0);
{
let mut mm = MEMORY_MANAGER.get().unwrap().lock();
let alloc_0 = mm.allocate_pages(0).unwrap();
log::debug!("Addr: {alloc_0}");
let alloc_1 = mm.allocate_pages(0).unwrap();
log::debug!("Addr: {alloc_1}");
mm.deallocate_pages(alloc_0, 0);
let alloc_2 = mm.allocate_pages(1).unwrap();
log::debug!("Addr: {alloc_2}");
mm.deallocate_pages(alloc_1, 0);
mm.deallocate_pages(alloc_2, 1);
let alloc_3 = mm.allocate_pages(1).unwrap();
log::debug!("Addr: {alloc_3}");
mm.deallocate_pages(alloc_3, 1);
}
static KFILE_REQ: LimineKernelFileRequest = LimineKernelFileRequest::new(0);
static MOD_REQ: LimineModuleRequest = LimineModuleRequest::new(0);
crate::kmain::kmain(
KFILE_REQ
.get_response()
@ -82,13 +99,3 @@ pub fn sloop() -> ! {
x86_64::instructions::hlt();
}
}
pub fn hardware_random_u64() -> u64 {
use log::trace;
use rdrand::RdRand;
let gen = RdRand::new().unwrap();
let ret = gen.try_next_u64().unwrap();
trace!("Random {}", ret);
ret
}

View file

@ -1,85 +0,0 @@
use spin::Lazy;
use spin::{Mutex};
use crate::interp::objects::{Object,HandleTarget, TARGETS};
use {
crate::arch::hardware_random_u64,
alloc::vec::Vec,
core::fmt::{self, Formatter},
};
use alloc::{
collections::BTreeMap,
};
#[derive(Debug, Eq, Hash, PartialEq, Clone, Copy)]
pub struct OSHandle {
pub id: u64,
}
impl OSHandle {
pub fn new_from_u64(id: u64) -> Self {
Self { id }
}
pub fn random_new() -> Self {
Self {
id: hardware_random_u64(),
}
}
}
#[derive(Debug, Eq, Hash, PartialEq, Clone, Copy)]
pub struct Handle {
pub id: OSHandle,
pub perms: Permissions,
pub r#ref: usize,
}
impl Handle {
pub fn new(r#ref: usize) -> Handle {
Handle {
id: OSHandle::random_new(),
perms: Permissions::new(),
r#ref,
}
}
pub fn as_u64(&self) -> u64 {
self.id.id
}
pub fn get<R, F: for<'a> FnOnce(Option<&'a mut HandleTarget>) -> R>(&self, f: F) -> R {
let l = TARGETS;
let mut olock = l.lock();
let a = olock.get_mut(self.r#ref).and_then(|a| a.as_mut());
return f(a);
}
}
impl fmt::Display for Handle {
fn fmt(&self, w: &mut Formatter<'_>) -> Result<(), core::fmt::Error> {
write!(w, "{:?}", self.id);
Ok(())
}
}
#[derive(PartialEq, Hash, Eq, Debug, Clone, Copy)]
pub struct Permissions {
edit_children: bool,
edit_attributes: bool,
}
impl Permissions {
pub fn new() -> Self {
Self {
edit_children: true,
edit_attributes: true,
}
}
}
pub const GLOBALS: Lazy<Mutex<BTreeMap<[u64; 4], Handle>>> = Lazy::new(|| {
let mut globals = BTreeMap::new();
Mutex::new(globals)
});

View file

@ -1,109 +0,0 @@
use {
crate::interp::{HFIDT, TARGETS},
alloc::string::String,
log::trace,
wasmi::{Caller, TypedFunc},
};
use super::{HostState, WasmContext};
pub fn host_register_idt_handler(
caller: Caller<'_, HostState>,
interupt_number: i32,
address_start: i32,
length_of_string: i32,
) -> i32 {
// TODO: get the proc_id to address which function it is
// TODO: Register the function name and proc_id into the idt handler
let mem = caller.get_export("memory").unwrap().into_memory().unwrap();
let mem_array = mem.data(&caller);
let mut name = String::new();
for i in address_start..(address_start + length_of_string) {
let ch = mem_array[i as usize] as char;
name.push(ch);
}
let index = interupt_number as usize;
let hf = HFIDT.lock();
// hf.insert(index);
trace!("{}", name);
0
}
use crate::{
arch::hardware_random_u64,
handle::GLOBALS,
interp::{
objects::{HandleTarget, Object},
Handle,
},
};
pub fn host_make_object(
mut caller: Caller<'_, HostState>,
address_start: i32,
length_of_string: i32,
) -> i64 {
trace!(
"Called with addr {{ start {} length {} }}",
address_start,
length_of_string
);
let mem = caller.get_export("memory").unwrap().into_memory().unwrap();
let mem_array = mem.data(&caller);
let mut name = String::new();
for i in address_start..(address_start + length_of_string) {
let ch = mem_array[i as usize] as char;
name.push(ch);
}
trace!("Object Name {}", name);
let binding = TARGETS;
let mut olock = binding.lock();
let hand = Handle::new(olock.len());
let obj = xml::XMLElement::new(name);
olock.push(Some(HandleTarget::Object(Object { xml: obj })));
caller.data_mut().add_handle(hand).try_into().unwrap()
}
pub type WFIDT = TypedFunc<(), ()>;
fn get_fn_from_wc(wc: WasmContext, function_name: String) -> WFIDT {
wc.instance
.get_typed_func(wc.store, &function_name)
.unwrap()
}
pub fn host_make_global(mut caller: Caller<'_, HostState>, h: i64) -> (u64, u64, u64, u64) {
let binding = GLOBALS;
let Some(hand): Option<&mut Option<Handle>> = caller.data_mut().handles.get_mut(h as usize) else {
return (0,0,0,0);
};
let Some(t) = hand.take() else {
return (0,0,0,0);
};
let a = [hardware_random_u64(); 4];
let mut l = binding.lock();
l.insert(a, t);
return (a[0], a[1], a[2], a[3]);
}
pub fn host_take_global(mut caller: Caller<'_, HostState>, a: u64, b: u64, c: u64, d: u64) -> i64 {
let binding = GLOBALS;
let mut l = binding.lock();
let mut j: [u64; 4] = [0u64; 4];
j[0] = a;
j[1] = b;
j[2] = c;
j[3] = d;
let Some(m) = l.remove::<[u64; 4]>({
&j
}) else{
return -1;
};
caller.data_mut().add_handle(m) as i64
}

View file

@ -1,251 +0,0 @@
mod host_functions;
pub mod objects;
use {
crate::{
handle::{self, Handle},
interp::{host_functions::host_make_object, objects::TARGETS},
},
alloc::{string::String, vec::Vec},
hashbrown::HashMap,
log::trace,
spin::{Lazy, Mutex},
wasmi::{Caller, Error, Func, Instance, Linker, Module, Store, TypedFunc},
xml::XMLElement,
};
// Seperate use statement
use {
alloc::{fmt::format, format, vec},
wasmi::Value,
};
use self::objects::HandleTarget;
#[derive(Debug)]
pub struct WasmContext {
pub proc_id: Option<u64>,
pub instance: Instance,
pub store: Store<HostState>,
}
pub fn wasm() -> Result<(), wasmi::Error> {
use wasmi::{Config, Engine};
let mut conf = Config::default();
conf.wasm_bulk_memory(true);
// conf.,
let engine = Engine::new(&conf);
// trace!("Engine constructed");
// let wasm = include_bytes!("../../wasm_syscall_test.wasm");
let wasm = include_bytes!("../../../test.wasm");
// trace!("Loading WASM binary");
let module = Module::new(&engine, &wasm[..]).unwrap();
// trace!("Constructing wasm module");
let hs = HostState { handles: vec![] };
let mut store = Store::new(&engine, hs);
// trace!("constructing host store");
let read_mem_addr = Func::wrap(
&mut store,
|caller: Caller<'_, HostState>, param: i32| -> i32 { read_memory_address(caller, param) },
);
let mut linker = <Linker<HostState>>::new(&engine);
linker.define(
"host",
"read_mem_addr",
Func::wrap(
&mut store,
|caller: Caller<'_, HostState>, param: i32| -> i32 {
read_memory_address(caller, param)
},
),
)?;
linker.define(
"host",
"register_idt_handler",
Func::wrap(&mut store, host_functions::host_register_idt_handler),
)?;
linker.define(
"host",
"read_object_attribute",
Func::wrap(&mut store, host_read_object_attribute),
)?;
linker.define(
"host",
"create_object",
Func::wrap(&mut store, host_make_object),
)?;
let instance = linker
.instantiate(&mut store, &module)?
.ensure_no_start(&mut store)?;
let version = instance.get_global(&store, "VERSION");
// trace!("Version: {:?}", version);
let hello = instance.get_typed_func::<(), i64>(&store, "start")?;
let ret = hello.call(&mut store, ())?;
trace!("Called start got return of {:?}", ret);
Ok(())
}
#[derive(Clone, Debug)]
pub struct HostState {
handles: Vec<Option<Handle>>,
}
impl HostState {
pub fn add_handle(&mut self, hand: Handle) -> usize {
for (i, h) in self.handles.iter_mut().enumerate() {
if let None = h {
*h = Some(hand);
return i;
}
}
self.handles.push(Some(hand));
return (self.handles.len() - 1);
}
}
pub fn read_memory_address(caller: Caller<'_, HostState>, address: i32) -> i32 {
trace!("Address: {}", address);
// let obj = host_make_object(caller, 16, 23);
0
}
pub fn host_read_object_attribute(
mut caller: Caller<'_, HostState>,
handle: i64,
address_start: i32,
length_of_string: i32,
) -> (i32, i32) {
let binding = TARGETS;
let mut olock = binding.lock();
// olock.get(&handle);
let mem = caller.get_export("memory").unwrap().into_memory().unwrap();
let mem_array = mem.data_mut(&mut caller);
let mut name = String::new();
for i in address_start..(address_start + length_of_string) {
let ch = mem_array[i as usize] as char;
name.push(ch);
}
let Some(Some(a)) = caller.data().handles.get(handle as usize) else {
return (0,0);
};
let Some(Some(HandleTarget::Object(o))) = olock.get(a.r#ref) else{
return (0,0);
};
let Some(r) = o.xml.attributes.iter().find(|a|{
let f = format!("{:?}",a);
f.contains(&format!("Attribute{{ name: \"{}",name))
})else{
return (0,0);
};
let f = format!("{:?}", r);
let p = format!("Attribute{{ name: \"{}\", value: \"", name);
let s = format!("\" }}");
let h = f.replace(&p, "").replace(&s, "");
let i = vec![Value::I32(h.len().try_into().unwrap())];
let mut o = vec![Value::I32(0)];
let a = caller
.get_export("malloc")
.unwrap()
.into_func()
.unwrap()
.call(&mut caller, &i, &mut o);
let mem_array = mem.data_mut(&mut caller);
let Value::I32(a) = o[0] else{
panic!("invalid malloc");
};
for (s, b) in h.clone().into_bytes().iter().enumerate() {
mem_array[(a as usize) + s] = *b;
}
(a, h.len().try_into().unwrap())
}
pub fn build_wasm_context(bytes: Vec<u8>) -> Result<WasmContext, wasmi::Error> {
use wasmi::{Config, Engine};
let mut conf = Config::default();
conf.wasm_bulk_memory(true);
// conf.,
let engine = Engine::new(&conf);
// trace!("Engine constructed");
// let wasm = include_bytes!("../../wasm_syscall_test.wasm");
let wasm = include_bytes!("../../../test.wasm");
// trace!("Loading WASM binary");
let module = Module::new(&engine, &wasm[..]).unwrap();
// trace!("Constructing wasm module");
let hs = HostState { handles: vec![] };
let mut store = Store::new(&engine, hs);
// trace!("constructing host store");
let read_mem_addr = Func::wrap(
&mut store,
|caller: Caller<'_, HostState>, param: i32| -> i32 { read_memory_address(caller, param) },
);
let mut linker = <Linker<HostState>>::new(&engine);
linker.define(
"host",
"read_mem_addr",
Func::wrap(
&mut store,
|caller: Caller<'_, HostState>, param: i32| -> i32 {
read_memory_address(caller, param)
},
),
)?;
linker.define(
"host",
"read_object_attribute",
Func::wrap(&mut store, host_read_object_attribute),
)?;
linker.define(
"host",
"create_object",
Func::wrap(&mut store, host_make_object),
)?;
let instance = linker
.instantiate(&mut store, &module)?
.ensure_no_start(&mut store)?;
let wc = WasmContext {
instance,
store,
proc_id: None,
};
Ok(wc)
}
pub type HostFunctionIDT = HashMap<usize, WCFunction>;
pub struct WCFunction {
wc: WasmContext,
function: TypedFunc<(), ()>,
}
pub static HFIDT: Lazy<Mutex<HostFunctionIDT>> = Lazy::new(|| {
let mut hfidt = HashMap::new();
Mutex::new(hfidt)
});

View file

@ -1,19 +0,0 @@
use alloc::{vec, vec::Vec, collections::BTreeMap};
use spin::{Lazy, Mutex};
use crate::handle::Handle;
pub struct Object{
pub xml: xml::XMLElement
}
pub enum HandleTarget{
Object(Object)
}
pub type HostTargets = Vec<Option<HandleTarget>>;
pub const TARGETS: Lazy<Mutex<HostTargets>> = Lazy::new(|| {
let mut obj = vec![];
Mutex::new(obj)
});

View file

@ -1,65 +1,15 @@
//! AbleOS Kernel Entrypoint
// use std::collections::HashMap;
use alloc::vec::Vec;
use log::{info, trace};
use spin::{Lazy, Mutex};
use crate::arch::{hardware_random_u64, sloop};
use crate::handle::Handle;
use crate::schedule::Scheduler;
use crate::{interp, task};
use crate::alloc::string::ToString;
pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
log::debug!("Entered kmain");
let mut cmdline = cmdline.to_string();
cmdline.pop();
cmdline.remove(0);
let kcmd = clparse::Arguments::parse(cmdline.to_string()).unwrap();
log::info!("Cmdline: {kcmd:?}");
// if kcmd.arguments.get("baka") == Some(&"true".to_string()) {
// let _ = crate::arch::log(format_args!(include_str!("../data/⑨. バカ")));
// }
// if kcmd.arguments.get("foobles") == Some(&"true".to_string()) {
// let _ = crate::arch::log(format_args!("foobles\n"));
// }
let bootstrap = bootstrap/*.expect("no bootstrap found")*/;
match bootstrap {
Some(bootstrap_mod) => {}
None => {
info!("No bootstrap module loaded.")
}
// TODO: Actual cmdline parsing (Serde?)
if cmdline.contains("baka=9") {
let _ = crate::arch::log(format_args!(include_str!("../data/⑨. バカ")));
}
// use xml::XMLElement;
// let kcmd = XMLElement::new("cmdline");
// let hnd = Handle::new();
// kcmd.set_attribute("")
// OBJECTS.lock().insert(hnd, kcmd);
let abc = interp::wasm();
trace!("{:?}", abc);
// let sch = SCHEDULER;
// let mut sch = sch.lock();
// let wc = interp::build_wasm_context(alloc::vec::Vec::new()).unwrap();
// sch.schedule(wc, crate::schedule::ContextWake::None);
// sch.run();
log::info!("Cmdline: \"{cmdline}\"");
let bootstrap = bootstrap.expect("no bootstrap found");
crate::arch::sloop()
}
pub const SCHEDULER: Lazy<Mutex<Scheduler>> = Lazy::new(|| {
let mut sch = Scheduler::new();
Mutex::new(sch)
});

View file

@ -10,19 +10,16 @@
ptr_sub_ptr
)]
#![no_std]
// #![deny(missing_docs)]
extern crate alloc;
mod allocator;
mod arch;
pub mod handle;
pub mod interp;
mod kmain;
mod logger;
mod memory;
mod schedule;
mod task;
mod ubloader;
use versioning::Version;

View file

@ -1,104 +0,0 @@
use core::arch;
// WasmContext
use crate::{arch::sloop, interp::WasmContext};
use alloc::vec::Vec;
use log::trace;
pub type ProcId = u64;
pub struct Scheduler {
running: Vec<WasmContext>,
halted: Vec<(ContextWake, WasmContext)>,
// time_halt: Vec<(ContextWake, WasmContext)>,
next_proc_id: ProcId,
}
impl Scheduler {
pub fn new() -> Scheduler {
Self {
running: Vec::new(),
halted: Vec::new(),
// time_halt: Vec::new(),
next_proc_id: 0,
}
}
pub fn run(&mut self) -> ! {
loop {
let proc = self.running.pop();
// self.time_halt.sort();
match proc {
Some(proc) => {
// trace!("SWAP WasmContext");
self.running.push(proc);
}
None => {
panic!("nothing scheduled.");
sloop();
}
}
}
}
fn sleep_inner(&self, id: ProcId) -> Result<usize, SchedulerError> {
let proc_len = self.running.len();
let mut proc_found = true;
let mut sleep_index = 0;
let mut i = 0;
for wc in &self.running {
if wc.proc_id == Some(id) {
sleep_index = i;
proc_found = true;
break;
}
if i == proc_len {
proc_found = false;
trace!("no process with ID {} found", id);
return Err(SchedulerError::ProcessIDNotFound(id));
}
i += 1;
}
Ok(sleep_index)
}
pub fn sleep(&mut self, id: ProcId, time: u64) -> Result<(), SchedulerError> {
match self.sleep_inner(id) {
Ok(sid) => self
.halted
.push((ContextWake::Time(time), self.running.remove(sid))),
Err(error) => return Err(error),
}
Ok(())
}
pub fn schedule(&mut self, wc: WasmContext, cw: ContextWake) -> Result<(), SchedulerError> {
if wc.proc_id != None {
panic!("Already Scheduled with PROC_ID {}", wc.proc_id.unwrap());
}
trace!("Scheduling WC with ProcID {}", self.next_proc_id);
if cw == ContextWake::None {
self.running.push(wc)
} else {
self.halted.push((cw, wc));
}
self.next_proc_id += 1;
Ok(())
}
}
#[derive(PartialEq)]
pub enum ContextWake {
/// Used when spawning a new process to have it instantly start
None,
Time(u64),
ObjectEvent,
}
pub enum SchedulerError {
ProcessIDNotFound(ProcId),
AlreadyScheduled(),
}

0
kernel/src/ubloader.rs Normal file
View file

View file

@ -1,24 +0,0 @@
`create_object`
```
params
i32
start address of the string to use as the object name
i32
length of string
returns
i64 Handle to the object
```
`read_object_attribute`
```
params
i64 Handle to the object
i32
start address of the string to use as the attribute name
i32
end address of the string to use as the attribute name
returns
```

2
limine

@ -1 +1 @@
Subproject commit 751e802e173392e8637759e2b3c96bbf59456f87
Subproject commit 83779119f658c8ce337c33492266ecf8300db429

51
meta.md
View file

@ -1,51 +0,0 @@
ARI AbleOS Remote Install
Server
/boot/server_kernel_x86_64.bin
/boot/kernel_x86_64.bin
/boot/kernel_aarch64.bin
/home/projects/askl.askl - aksldfhlkasjdhflkajshdflkj
ARI_SERVER.wasm
NAS 10.1.10.10
ARI 10.1.10.10
/boot/limine.cfg
/boot/kernel_x86_64.bin
/boot/kernel.toml
/home/projects/askl.askl
aksldfhlkasjdhflkajshdflkj
ARI 10.1.10.10
/boot/limine.cfg
/boot/kernel_aarch64.bin
/boot/kernel.toml
/system/
/shared/
/home/programs/
project_name/
project_name.wasm
project_name.toml
/system/pkgman.toml
//////
[repositories]
PUR = "https://git.ablecorp.us/ableos/pur"

17232
out.txt

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ ${ABLEOS_KERNEL}=boot:///kernel
# TODO: Make a boot background image for ableOS
DEFAULT_ENTRY=1
TIMEOUT=0
TIMEOUT=3
VERBOSE=yes
INTERFACE_RESOLUTION=1024x768
# Terminal related settings
@ -13,10 +13,9 @@ TERM_BACKDROP=008080
COMMENT=Default AbleOS boot entry.
PROTOCOL=limine
KERNEL_PATH=${ABLEOS_KERNEL}
KERNEL_CMDLINE="baka=false foobles=true"
# KERNEL_CMDLINE=""
KERNEL_CMDLINE=
# Setting a default resolution for the framebuffer
RESOLUTION=1024x768x24
# MODULE_PATH=boot:///boot/fs.wasm
# MODULE_PATH=boot:///boot/initrd.tar
# MODULE_CMDLINE=This is the first module.

View file

@ -156,7 +156,7 @@ fn run(release: bool, target: Target) -> Result<(), Error> {
"-bios",
std::env::var("REPBUILD_QEMU_FIRMWARE_PATH")
.as_deref()
.unwrap_or("/usr/share/ovmf/x64/OVMF_CODE.fd"),
.unwrap_or("/usr/share/OVMF/OVMF_CODE.fd"),
"-drive", "file=target/disk.img,format=raw",
"-m", "4G",
"-serial", "stdio",

View file

@ -1,2 +0,0 @@
hex_literal_case = "Upper"
imports_granularity = "One"

BIN
test.wasm

Binary file not shown.

View file

@ -1,8 +0,0 @@
[package]
name = "ablewasi"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View file

@ -1,36 +0,0 @@
use crate::sys;
pub struct Object{
pub id: i64
}
impl Drop for Object{
fn drop(&mut self) {
unsafe{
sys::drop_object(self.id);
}
}
}
impl Object{
pub fn to_global(self) -> [u64; 4]{
let b = unsafe {
sys::make_global(self.id).into()
};
core::mem::forget(self);
return b;
}
pub fn from_global(a: [u64; 4]) -> Object{
return Object{id: unsafe {
sys::take_global(a.into())
}};
}
pub fn new(name: &str) -> Object{
return Object{id: unsafe {
let a = name.as_ptr();
sys::create_object(a, name.len() as i32)
}};
}
}

View file

@ -1,8 +0,0 @@
pub mod sys;
pub mod api;
#[cfg(test)]
mod tests {
use super::*;
}

View file

@ -1,29 +0,0 @@
#[repr(C)]
pub struct ROAResult(*const u8,i32);
pub type LocalObject = i64;
#[repr(C)]
pub struct GlobalObject(u64,u64,u64,u64);
impl From<[u64;4]> for GlobalObject {
fn from(value: [u64;4]) -> Self {
GlobalObject(value[0], value[1], value[2], value[3])
}
}
impl From<GlobalObject> for [u64; 4]{
fn from(value: GlobalObject) -> Self {
let GlobalObject(a,b,c,d) = value;
[a,b,c,d]
}
}
extern "C"{
pub fn create_object(a: *const u8, b: i32) -> LocalObject;
pub fn read_object_attribute(a: LocalObject, b: *const i8, c: i32) -> ROAResult;
pub fn take_global(a: GlobalObject) -> LocalObject;
pub fn make_global(a: LocalObject) -> GlobalObject;
pub fn drop_object(a: LocalObject);
}