diff --git a/CHANGELOG.md b/CHANGELOG.md index 681203e5..8e2a69ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ ### Added +- **openkal 0.21.0;openkal-linux 0.22.0、openkal-macos 0.19.0、openkal-windows 0.17.0。** `openkal.exec` 的 + `kal_exec_map_part`:可执行区域的一部分由文件的字节构成(只读,或只读且可执行,属性 `KAL_EXEC_PROP_FILE`),加载器据此映射映像的 + 指令与只读数据;结束的程序的处理器时间在句柄释放前可读。openkal-linux 以 `CLONE_VM | CLONE_VFORK` 启动程序、`kal_alloc` 按需 + 切分;openkal-windows 不提供文件部分。测试成员 `openkal` 随之移动,并观察可执行区域的文件部分。 - **openkal-ld/run/tools/bind 0.2.0。** openkal 0.20 的一轮:运行器提供加载器接口 `openkal.prof` 与 `openkal.debug`, `okrun --prof=`(`OKRUN_PROF`)度量一个映像的调用、计数器与阶段,`okprof`(openkal-tools)记录、汇总与比较报告; `kal_debug_symbolize` 由映像文件的符号表给出地址的名字;okb 的准入按用户记住,同一文件的后续启动不再重读整个 okb。测试成员 diff --git a/pkgs/o/openkal-linux.lua b/pkgs/o/openkal-linux.lua index 3049dc8e..1ae83bb2 100644 --- a/pkgs/o/openkal-linux.lua +++ b/pkgs/o/openkal-linux.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.22.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.22.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.22.0/openkal-linux-0.22.0.tar.gz", + }, + sha256 = "f1b21de93a77a16ab5077a45d5d3c315b8e423529ee16e7117dbf578a23c4f31", + }, ["0.21.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz", @@ -203,6 +210,13 @@ package = { }, }, macosx = { + ["0.22.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.22.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.22.0/openkal-linux-0.22.0.tar.gz", + }, + sha256 = "f1b21de93a77a16ab5077a45d5d3c315b8e423529ee16e7117dbf578a23c4f31", + }, ["0.21.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz", @@ -387,6 +401,13 @@ package = { }, }, windows = { + ["0.22.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.22.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.22.0/openkal-linux-0.22.0.tar.gz", + }, + sha256 = "f1b21de93a77a16ab5077a45d5d3c315b8e423529ee16e7117dbf578a23c4f31", + }, ["0.21.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz", diff --git a/pkgs/o/openkal-macos.lua b/pkgs/o/openkal-macos.lua index e26f03f2..b97d0098 100644 --- a/pkgs/o/openkal-macos.lua +++ b/pkgs/o/openkal-macos.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.19.0/openkal-macos-0.19.0.tar.gz", + }, + sha256 = "1cec7ae1ea5a8181c1b5fe9ed400a79fe096d503caff11290cb21b1673a5fe2a", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz", @@ -203,6 +210,13 @@ package = { }, }, macosx = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.19.0/openkal-macos-0.19.0.tar.gz", + }, + sha256 = "1cec7ae1ea5a8181c1b5fe9ed400a79fe096d503caff11290cb21b1673a5fe2a", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz", @@ -387,6 +401,13 @@ package = { }, }, windows = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.19.0/openkal-macos-0.19.0.tar.gz", + }, + sha256 = "1cec7ae1ea5a8181c1b5fe9ed400a79fe096d503caff11290cb21b1673a5fe2a", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz", diff --git a/pkgs/o/openkal-windows.lua b/pkgs/o/openkal-windows.lua index 97217177..085a3e23 100644 --- a/pkgs/o/openkal-windows.lua +++ b/pkgs/o/openkal-windows.lua @@ -21,6 +21,13 @@ package = { xpm = { linux = { + ["0.17.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.17.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.17.0/openkal-windows-0.17.0.tar.gz", + }, + sha256 = "422c79cc05094ec095af76622d603cc97e024261592c8d07aac616e2adc8e8d7", + }, ["0.16.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz", @@ -226,6 +233,13 @@ package = { }, }, macosx = { + ["0.17.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.17.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.17.0/openkal-windows-0.17.0.tar.gz", + }, + sha256 = "422c79cc05094ec095af76622d603cc97e024261592c8d07aac616e2adc8e8d7", + }, ["0.16.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz", @@ -431,6 +445,13 @@ package = { }, }, windows = { + ["0.17.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.17.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.17.0/openkal-windows-0.17.0.tar.gz", + }, + sha256 = "422c79cc05094ec095af76622d603cc97e024261592c8d07aac616e2adc8e8d7", + }, ["0.16.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz", diff --git a/pkgs/o/openkal.lua b/pkgs/o/openkal.lua index 6658f448..575b2ea9 100644 --- a/pkgs/o/openkal.lua +++ b/pkgs/o/openkal.lua @@ -22,6 +22,13 @@ package = { xpm = { linux = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.21.0/openkal-0.21.0.tar.gz", + }, + sha256 = "e0b2d3cc12a44983f0b77801531f1d80222e537a581eb4e5249a35774151d765", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz", @@ -164,6 +171,13 @@ package = { }, }, macosx = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.21.0/openkal-0.21.0.tar.gz", + }, + sha256 = "e0b2d3cc12a44983f0b77801531f1d80222e537a581eb4e5249a35774151d765", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz", @@ -306,6 +320,13 @@ package = { }, }, windows = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.21.0/openkal-0.21.0.tar.gz", + }, + sha256 = "e0b2d3cc12a44983f0b77801531f1d80222e537a581eb4e5249a35774151d765", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz", diff --git a/tests/examples/openkal/mcpp.toml b/tests/examples/openkal/mcpp.toml index 10e7840f..4ab95a54 100644 --- a/tests/examples/openkal/mcpp.toml +++ b/tests/examples/openkal/mcpp.toml @@ -18,16 +18,16 @@ name = "openkal-tests" version = "0.1.0" [dependencies.mcpplibs] -openkal = "0.20.0" +openkal = "0.21.0" [target.'cfg(os = "linux")'.dependencies.mcpplibs] -openkal-linux = "0.21.0" +openkal-linux = "0.22.0" [target.'cfg(os = "macos")'.dependencies.mcpplibs] -openkal-macos = "0.18.0" +openkal-macos = "0.19.0" [target.'cfg(windows)'.dependencies.mcpplibs] -openkal-windows = "0.16.0" +openkal-windows = "0.17.0" [target.'cfg(all(os = "linux", env = "musl"))'.dependencies.mcpplibs] openkal-llvm-runtime = "0.16.15" diff --git a/tests/examples/openkal/tests/kal.cpp b/tests/examples/openkal/tests/kal.cpp index da3ded4d..4ef42bdc 100644 --- a/tests/examples/openkal/tests/kal.cpp +++ b/tests/examples/openkal/tests/kal.cpp @@ -12,11 +12,13 @@ // (0.20) a transfer at an offset neither uses nor moves the file's position, // this program is told the memory it occupies and its peak, and a region is // reserved, backed, written, its backing returned and backed again reading -// zero, and released. +// 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. // The terminal is not observed here, // because a test run has none; the implementations observe it on a terminal // they make. #include +#include #include #include #include @@ -187,6 +189,27 @@ int main() { } } + if ((kal_interfaces() & KAL_IFACE_EXEC) && (kal_exec_props() & KAL_EXEC_PROP_FILE) + && kal_fs_preopen_count() > 0 && kal_fs_preopen(0, &root, nullptr, 0, nullptr) == kal_ok) { + const kal_uintptr a = 65536; + kal_file f{}; + if (kal_fs_open(root, "okt.x", 5, KAL_OPEN_READ | KAL_OPEN_WRITE | KAL_OPEN_CREATE | KAL_OPEN_TRUNCATE, &f) == kal_ok) { + static unsigned char block[65536]; + for (kal_uintptr i = 0; i < a; ++i) block[i] = static_cast(i * 7 + 1); + kal_stream_write(kal_fs_stream(f), block, a); + auto* r = static_cast(kal_exec_alloc(a)); + check(r != nullptr && kal_exec_map_part(r, 0, a, f, 0, 0) == kal_ok, + "part of an executable region is made a file's bytes"); + kal_fs_close_file(f); + if (r) { + check(r[0] == 1 && r[a - 1] == static_cast((a - 1) * 7 + 1), + "and holds them after the file's handle is closed"); + kal_exec_free(r, a); + } + } + kal_fs_remove(root, "okt.x", 5); + } + if (failures == 0) kal_stream_write(kal_stdout(), "openkal: held\n", 14); return failures == 0 ? 0 : 1; }