Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-14, windows-2022]
os: [macos-15, windows-2022]
defaults:
run:
shell: bash
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 = "0.25.0"

# WHAT RECEIVES CONTROL, WHICH IS A STATEMENT ABOUT THE PROGRAM.
#
Expand Down
12 changes: 12 additions & 0 deletions src/env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
18 changes: 18 additions & 0 deletions src/kal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading