diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ad1319a..df935cf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ ### Added +- **openkal 0.23.0;openkal-linux 0.24.0、openkal-macos 0.21.0、openkal-windows 0.19.0、openkal-emscripten 0.12.0。** + 映像在其基址上放置(`kal_exec_alloc_at`、placement note);exec 区域返回时为零,可封存(`kal_exec_seal_part`)、预取、私有映射 + 文件的部分(`KAL_EXEC_MAP_WRITE`);按名字解析全部链接(`kal_fs_resolved_name`)与带属性的列举;目录授予的衰减(只读、不变、 + 记录)与系统隔离(`KAL_SPAWN_CONFINE`);缺页、故障报告、采样与触页记录;资源偏好(`kal_env_resources`、 + `KAL_SPAWN_RESOURCES_*`)与可用内存(`kal_memory_info`)。测试成员 `openkal` 随之移动,并观察基址上的区域、只读衰减、内存与 + 资源偏好。GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,sha256 两处一致。 - **openkal-ld/run/tools/bind 0.3.2。** 在 openkal 0.22 的实现上构建(openkal-linux 0.23.0、openkal-macos 0.20.0、openkal-windows 0.18.0):映像启动程序时可以在位置上得到系统的空设备(`KAL_SPAWN_NULL_*`),自身无改动。测试成员 `openkal-tools`、 `openkal-bind` 随之移动。GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,sha256 两处一致。 diff --git a/pkgs/o/openkal-emscripten.lua b/pkgs/o/openkal-emscripten.lua index b9cd791e..0d7e1d41 100644 --- a/pkgs/o/openkal-emscripten.lua +++ b/pkgs/o/openkal-emscripten.lua @@ -46,6 +46,13 @@ package = { xpm = { linux = { + ["0.12.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.12.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.12.0/openkal-emscripten-0.12.0.tar.gz", + }, + sha256 = "95e62daa863ad194c041a75fe2a3adbf159f90dcc57386905ba66b14e059baaa", + }, ["0.11.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.11.0.tar.gz", @@ -139,6 +146,13 @@ package = { }, }, macosx = { + ["0.12.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.12.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.12.0/openkal-emscripten-0.12.0.tar.gz", + }, + sha256 = "95e62daa863ad194c041a75fe2a3adbf159f90dcc57386905ba66b14e059baaa", + }, ["0.11.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.11.0.tar.gz", @@ -232,6 +246,13 @@ package = { }, }, windows = { + ["0.12.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.12.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.12.0/openkal-emscripten-0.12.0.tar.gz", + }, + sha256 = "95e62daa863ad194c041a75fe2a3adbf159f90dcc57386905ba66b14e059baaa", + }, ["0.11.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.11.0.tar.gz", diff --git a/pkgs/o/openkal-linux.lua b/pkgs/o/openkal-linux.lua index 84c4dc61..7be6266b 100644 --- a/pkgs/o/openkal-linux.lua +++ b/pkgs/o/openkal-linux.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.24.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.24.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.24.0/openkal-linux-0.24.0.tar.gz", + }, + sha256 = "af872024a9c861d71a86ee08b75b9b924b0632e9e5ad322cc7a3f44903bbcfcf", + }, ["0.23.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.23.0.tar.gz", @@ -217,6 +224,13 @@ package = { }, }, macosx = { + ["0.24.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.24.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.24.0/openkal-linux-0.24.0.tar.gz", + }, + sha256 = "af872024a9c861d71a86ee08b75b9b924b0632e9e5ad322cc7a3f44903bbcfcf", + }, ["0.23.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.23.0.tar.gz", @@ -415,6 +429,13 @@ package = { }, }, windows = { + ["0.24.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.24.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.24.0/openkal-linux-0.24.0.tar.gz", + }, + sha256 = "af872024a9c861d71a86ee08b75b9b924b0632e9e5ad322cc7a3f44903bbcfcf", + }, ["0.23.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.23.0.tar.gz", diff --git a/pkgs/o/openkal-macos.lua b/pkgs/o/openkal-macos.lua index 487b3437..4940462c 100644 --- a/pkgs/o/openkal-macos.lua +++ b/pkgs/o/openkal-macos.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.21.0/openkal-macos-0.21.0.tar.gz", + }, + sha256 = "f0b372d98852ce287d97c6fd380cfa543c01682897193f1b7dbb2b4effc26491", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.20.0.tar.gz", @@ -217,6 +224,13 @@ package = { }, }, macosx = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.21.0/openkal-macos-0.21.0.tar.gz", + }, + sha256 = "f0b372d98852ce287d97c6fd380cfa543c01682897193f1b7dbb2b4effc26491", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.20.0.tar.gz", @@ -415,6 +429,13 @@ package = { }, }, windows = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.21.0/openkal-macos-0.21.0.tar.gz", + }, + sha256 = "f0b372d98852ce287d97c6fd380cfa543c01682897193f1b7dbb2b4effc26491", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.20.0.tar.gz", diff --git a/pkgs/o/openkal-windows.lua b/pkgs/o/openkal-windows.lua index 4ba43df3..a45c0bdb 100644 --- a/pkgs/o/openkal-windows.lua +++ b/pkgs/o/openkal-windows.lua @@ -21,6 +21,13 @@ package = { xpm = { linux = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.19.0/openkal-windows-0.19.0.tar.gz", + }, + sha256 = "014f0032c79853b4d3037b53525d6c70a7f60f86964ca00a040546f5fbbec9ac", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.18.0.tar.gz", @@ -240,6 +247,13 @@ package = { }, }, macosx = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.19.0/openkal-windows-0.19.0.tar.gz", + }, + sha256 = "014f0032c79853b4d3037b53525d6c70a7f60f86964ca00a040546f5fbbec9ac", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.18.0.tar.gz", @@ -459,6 +473,13 @@ package = { }, }, windows = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.19.0/openkal-windows-0.19.0.tar.gz", + }, + sha256 = "014f0032c79853b4d3037b53525d6c70a7f60f86964ca00a040546f5fbbec9ac", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.18.0.tar.gz", diff --git a/pkgs/o/openkal.lua b/pkgs/o/openkal.lua index c15514e9..ac900e05 100644 --- a/pkgs/o/openkal.lua +++ b/pkgs/o/openkal.lua @@ -22,6 +22,13 @@ package = { xpm = { linux = { + ["0.23.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.23.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.23.0/openkal-0.23.0.tar.gz", + }, + sha256 = "3c89b8c0bfc84089abd500e9247f3ead5d755a305fae237fde687ef286657eae", + }, ["0.22.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.22.0.tar.gz", @@ -178,6 +185,13 @@ package = { }, }, macosx = { + ["0.23.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.23.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.23.0/openkal-0.23.0.tar.gz", + }, + sha256 = "3c89b8c0bfc84089abd500e9247f3ead5d755a305fae237fde687ef286657eae", + }, ["0.22.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.22.0.tar.gz", @@ -334,6 +348,13 @@ package = { }, }, windows = { + ["0.23.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.23.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.23.0/openkal-0.23.0.tar.gz", + }, + sha256 = "3c89b8c0bfc84089abd500e9247f3ead5d755a305fae237fde687ef286657eae", + }, ["0.22.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.22.0.tar.gz", diff --git a/tests/examples/openkal/mcpp.toml b/tests/examples/openkal/mcpp.toml index 3d4fb808..15498541 100644 --- a/tests/examples/openkal/mcpp.toml +++ b/tests/examples/openkal/mcpp.toml @@ -18,22 +18,22 @@ name = "openkal-tests" version = "0.1.0" [dependencies.mcpplibs] -openkal = "0.22.0" +openkal = "0.23.0" [target.'cfg(os = "linux")'.dependencies.mcpplibs] -openkal-linux = "0.23.0" +openkal-linux = "0.24.0" [target.'cfg(os = "macos")'.dependencies.mcpplibs] -openkal-macos = "0.20.0" +openkal-macos = "0.21.0" [target.'cfg(windows)'.dependencies.mcpplibs] -openkal-windows = "0.18.0" +openkal-windows = "0.19.0" [target.'cfg(all(os = "linux", env = "musl"))'.dependencies.mcpplibs] openkal-llvm-runtime = "0.17.1" [target.'cfg(arch = "wasm32")'.dependencies.mcpplibs] -openkal-emscripten = "0.11.0" +openkal-emscripten = "0.12.0" [target.'cfg(arch = "riscv64")'.dependencies.mcpplibs] openkal-opensbi = "0.8.3" diff --git a/tests/examples/openkal/tests/kal.cpp b/tests/examples/openkal/tests/kal.cpp index cdfbb37d..e3de277b 100644 --- a/tests/examples/openkal/tests/kal.cpp +++ b/tests/examples/openkal/tests/kal.cpp @@ -15,7 +15,9 @@ // zero, and released; (0.21) where the implementation states it, part of an // executable region is a file's bytes, read from where the file holds them; // (0.22) the null device beside a stream at one position is refused, and is -// refused as unsupported where the implementation does not state it. +// refused as unsupported where the implementation does not state it; (0.23) a +// region at an address, zero; a read-only attenuation; the machine's memory +// and the resource preference. // The terminal is not observed here, // because a test run has none; the implementations observe it on a terminal // they make. @@ -235,6 +237,46 @@ int main() { kal_fs_remove(root, "okt.x", 5); } + // 0.23: a region at an address, and a region zero when returned; a + // directory attenuated read-only refuses a creation beneath it; the + // machine's memory and this program's resource preference are told. + if ((kal_interfaces() & KAL_IFACE_EXEC) && (kal_exec_props() & KAL_EXEC_PROP_PLACE)) { + const kal_uintptr a = 65536; + void* any = kal_exec_alloc(a); + if (any) { + kal_exec_free(any, a); + auto* r = static_cast(kal_exec_alloc_at(any, a)); + check(r == any, "a region is reserved at the address asked for"); + check(r && r[0] == 0 && r[a - 1] == 0, "and is zero"); + if (r) { + check(kal_exec_alloc_at(r, a) == nullptr, "an address already held is refused"); + kal_exec_free(r, a); + } + } + } + if (kal_fs_preopen_count() > 0 && kal_fs_preopen(0, &root, nullptr, 0, nullptr) == kal_ok + && (kal_fs_props(root) & KAL_FS_PROP_ATTENUATE)) { + kal_dir_rights rights{}; + rights.self_size = sizeof rights; + rights.flags = KAL_DIR_READ_ONLY; + kal_dir ro{}; + check(kal_fs_dir_attenuate(root, &rights, &ro) == kal_ok, "a directory is attenuated read-only"); + kal_file f{}; + check(kal_fs_open(ro, "okt.ro", 6, KAL_OPEN_WRITE | KAL_OPEN_CREATE, &f) != kal_ok, + "and a creation beneath it is refused"); + kal_fs_remove(root, "okt.ro", 6); + kal_fs_close_dir(ro); + } + { + kal_memory_status m{}; + m.self_size = sizeof m; + check(kal_memory_info(&m) != kal_ok || !(m.present & KAL_MSTATUS_TOTAL) || m.total_bytes > 0, + "the machine's memory is told where it is stated"); + const int pref = kal_env_resources(); + check(pref == KAL_RESOURCES_BALANCED || pref == KAL_RESOURCES_PERFORMANCE || pref == KAL_RESOURCES_ECONOMY, + "and the resource preference is one of three"); + } + if (failures == 0) kal_stream_write(kal_stdout(), "openkal: held\n", 14); return failures == 0 ? 0 : 1; }