From 9677c927dfe25be831622d5d6d6df50f5377facd Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Tue, 10 Nov 2026 04:10:24 +0900 Subject: [PATCH 1/3] 0.9.0: openkal 0.25 - kal_memory_info (0.23): the allocator's region and what is not yet handed out - kal_env_image, kal_env_loader, kal_env_system (0.17): kal_err_not_found, as the specification states for an environment without a named image, a loader or a system name; kal_env_resources (0.23): the default preference - openkal follows the specification's branch feat/0.25.0 until 0.25.0 is released --- README.md | 13 +++++++++++-- mcpp.toml | 4 ++-- src/env.cpp | 12 ++++++++++++ src/kal.cpp | 18 ++++++++++++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f6b2667..d14ae0f 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,19 @@ An implementation of [openkal][kal] on the RISC-V Supervisor Binary Interface. ```toml [dependencies] -openkal = "0.15.0" -openkal-opensbi = "0.8.3" +openkal = "0.25.0" +openkal-opensbi = "0.9.0" ``` +## What 0.9 adds (openkal 0.25) + +The interfaces this implementation provides are those of openkal 0.25. +`kal_memory_info` (0.23) states the allocator's region and what of it is not yet +handed out; `kal_env_image`, `kal_env_loader` and `kal_env_system` (0.17) report +`kal_err_not_found`, since a program here is started from no named image, by no +loader and on firmware that names no system; `kal_env_resources` (0.23) is the +default preference. + ## The portable RISC-V backend, as distinct from a board's own A board-supplied backend writes to a device address, and that address is a board diff --git a/mcpp.toml b/mcpp.toml index 8c6624d..c7daf77 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -14,7 +14,7 @@ [package] namespace = "mcpplibs" name = "openkal-opensbi" -version = "0.8.3" +version = "0.9.0" description = "An implementation of openkal on the RISC-V Supervisor Binary Interface, portable across every machine whose firmware provides one" license = "Apache-2.0" @@ -33,7 +33,7 @@ repo = "https://github.com/mcpplibs/openkal-opensbi" # The contract, not an implementation of it. Declaring it turns a version # mismatch into a resolution-time message rather than a link-time one. [dependencies] -openkal = "0.16.0" +openkal = { git = "https://github.com/mcpplibs/openkal.git", branch = "feat/0.25.0" } # WHAT RECEIVES CONTROL, WHICH IS A STATEMENT ABOUT THE PROGRAM. # diff --git a/src/env.cpp b/src/env.cpp index c3c5669..8ed78cc 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -59,4 +59,16 @@ kal_intptr kal_env_var_at(kal_uintptr, char*, kal_uintptr) { return -kal_err_not_found; } +// THE IMAGE, THE LOADER AND THE SYSTEM (openkal 0.17): a program here is not +// started from a named image, is loaded by nothing this interface names, and +// runs upon firmware that gives its environment no system name. Each is the +// condition the operation states for that case. +kal_intptr kal_env_image(char*, kal_uintptr) { return -kal_err_not_found; } +kal_intptr kal_env_loader(char*, kal_uintptr) { return -kal_err_not_found; } +kal_intptr kal_env_system(char*, kal_uintptr) { return -kal_err_not_found; } + +// The resource preference (openkal 0.23): nothing starts a program here with +// one, so it is the default. +int kal_env_resources(void) { return KAL_RESOURCES_BALANCED; } + } // extern "C" diff --git a/src/kal.cpp b/src/kal.cpp index e2a35c7..4e847a5 100644 --- a/src/kal.cpp +++ b/src/kal.cpp @@ -248,6 +248,24 @@ void* kal_alloc(kal_uintptr size, kal_uintptr align) { // rather than an omission. void kal_free(void*, kal_uintptr, kal_uintptr) {} +// What the environment can give this program now (openkal 0.23): the region the +// allocator hands out, and what of it is not yet handed out. Nothing is given +// back (kal_free above), so the second only falls. +int kal_memory_info(kal_memory_status* out) { + if (out == nullptr || out->self_size < 2 * sizeof(kal_u32)) return kal_err_invalid; + const region r = heap_region(); + out->present = 0; + if (out->self_size >= 2 * sizeof(kal_u32) + sizeof(kal_u64)) { + out->total_bytes = r.size; + out->present |= KAL_MSTATUS_TOTAL; + } + if (out->self_size >= 2 * sizeof(kal_u32) + 2 * sizeof(kal_u64)) { + out->available_bytes = r.size > g_used ? r.size - g_used : 0; + out->present |= KAL_MSTATUS_AVAILABLE; + } + return kal_ok; +} + // ── The interfaces this machine does not have are absent, and stay absent ─── // // NO `kal_fs_props`, NO `kal_task_props`, AND THAT IS THE MECHANISM RATHER From 5dfc946f52c6df7c3eb3fcd855ee8b924523fbfd Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Tue, 10 Nov 2026 04:45:19 +0900 Subject: [PATCH 2/3] ci: the macOS cross-build runs on macos-15 GitHub no longer offers the macos-14 image; the job was cancelled before its first step ("The configuration 'macos-14-arm64-us-default' is not supported"). --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4911e53..2164e80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -317,7 +317,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-14, windows-2022] + os: [macos-15, windows-2022] defaults: run: shell: bash From b93cac4d6f4b7ad2e3c37f1709560071d44e7220 Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Tue, 10 Nov 2026 05:31:27 +0900 Subject: [PATCH 3/3] openkal 0.25.0, as released --- mcpp.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcpp.toml b/mcpp.toml index c7daf77..320f446 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -33,7 +33,7 @@ repo = "https://github.com/mcpplibs/openkal-opensbi" # The contract, not an implementation of it. Declaring it turns a version # mismatch into a resolution-time message rather than a link-time one. [dependencies] -openkal = { git = "https://github.com/mcpplibs/openkal.git", branch = "feat/0.25.0" } +openkal = "0.25.0" # WHAT RECEIVES CONTROL, WHICH IS A STATEMENT ABOUT THE PROGRAM. #