📝 Say the create refuses a memory map whose ranges overlap [ci skip]

The config's memory_map said only that its ranges may not overlap, and
api.md's status table did not list the refusal. The create refuses, with
RVG_ERR_INVALID_ARGUMENT, a map whose ranges overlap or run past the
address space (core's MemoryMap::new), and one whose ranges are NULL but
counted (the C API's memory_map). The field's doc, the header and the
table now say so.
This commit is contained in:
Anees Iqbal committed 2026-12-02 09:50:13 -08:00
1 parent b7f2948592
commit 8a470a3874
3 files changed
+5 -3

No files matched your search

+2 -1
View File
@@ -619,7 +619,8 @@ typedef struct {
// down to 16 KiB, or the host GPU's answer where that is less; with no map, and on a GPU of
// its own memory, the host GPU's. The map's pages stay the guest's RAM, mapped, until the
// process exits (`RvgMemoryRange`): a host that discards guest RAM (a balloon, virtio-mem,
// hot-unplug) passes NULL. Its ranges may not overlap.
// hot-unplug) passes NULL. Its ranges may not overlap: a map whose ranges overlap, or one
// of whose ranges runs past the address space, is refused (RVG_ERR_INVALID_ARGUMENT).
const RvgMemoryMap *memory_map;
// With `memory_map`: the files behind its ranges, NULL for none, one entry per range, each
// duplicated during the create. Refused (RVG_ERR_INVALID_ARGUMENT), in this order: files
+2 -1
View File
@@ -353,7 +353,8 @@ pub struct RvgGraphicsDeviceConfig {
/// down to 16 KiB, or the host GPU's answer where that is less; with no map, and on a GPU of
/// its own memory, the host GPU's. The map's pages stay the guest's RAM, mapped, until the
/// process exits (`RvgMemoryRange`): a host that discards guest RAM (a balloon, virtio-mem,
/// hot-unplug) passes NULL. Its ranges may not overlap.
/// hot-unplug) passes NULL. Its ranges may not overlap: a map whose ranges overlap, or one
/// of whose ranges runs past the address space, is refused (RVG_ERR_INVALID_ARGUMENT).
pub memory_map: *const RvgMemoryMap,
/// With `memory_map`: the files behind its ranges, NULL for none, one entry per range, each
/// duplicated during the create. Refused (RVG_ERR_INVALID_ARGUMENT), in this order: files
+1 -1
View File
@@ -85,7 +85,7 @@ unknown status as a failure.
| value | name | when |
|---|---|---|
| 0 | `RVG_OK` | |
| 1 | `RVG_ERR_INVALID_ARGUMENT` | a NULL handle, config or out-pointer where one is needed; a `struct_size` too small; a refused memory file; a `guest_arch` that is none of `RVG_GUEST_ARCH_*`; a `doorbell_pages` other than 0 or 1; a `display_count` past `RVG_GRAPHICS_DISPLAYS_MAX`, or `display_windows` not given exactly where `window` is (one for each display from 1), or holding NULL; a pool range not in whole 2 MiB, past the address space, overlapping the memory map, or given without `pool_add` and `pool_remove`; a `pool_host_memory` other than 0 or 1, or 1 with a pool on a platform that makes no pool blocks of host memory (macOS, Windows); a doorbell that is not open, or a second one; `read_display`'s destination missing or too short; `read_display_at`'s display at or past the device's count; a pool call on a device without a pool, an address the device asked no add at, a second `pool_added` of one piece, or a `pool_grow` of 0 bytes |
| 1 | `RVG_ERR_INVALID_ARGUMENT` | a NULL handle, config or out-pointer where one is needed; a `struct_size` too small; a memory map whose ranges are NULL but counted, overlap, or run past the address space; a refused memory file; a `guest_arch` that is none of `RVG_GUEST_ARCH_*`; a `doorbell_pages` other than 0 or 1; a `display_count` past `RVG_GRAPHICS_DISPLAYS_MAX`, or `display_windows` not given exactly where `window` is (one for each display from 1), or holding NULL; a pool range not in whole 2 MiB, past the address space, overlapping the memory map, or given without `pool_add` and `pool_remove`; a `pool_host_memory` other than 0 or 1, or 1 with a pool on a platform that makes no pool blocks of host memory (macOS, Windows); a doorbell that is not open, or a second one; `read_display`'s destination missing or too short; `read_display_at`'s display at or past the device's count; a pool call on a device without a pool, an address the device asked no add at, a second `pool_added` of one piece, or a `pool_grow` of 0 bytes |
| 2 | `RVG_ERR_UNSUPPORTED` | a larger `struct_size` with non-zero bytes the library does not know |
| 3 | `RVG_ERR_METAL` | the platform refused the display's texture or its draw (`rvg_graphics_device_read_display`) |
| 4 | `RVG_ERR_GPU` | the call's GPU work ended with an error |