skip to content
==> include/mesh/abi/ring.h <==
1/* @ajax/mesh-abi-ring: A program's ticket ring and its completion results and marks.
2 *
3 * Part of alpha-c-mesh, a C port of alpha-rust-mesh (README.md says from where). */
4#ifndef MESH_ABI_RING_H
5#define MESH_ABI_RING_H
6
7#include <stdbool.h>
8#include <stddef.h>
9#include <stdint.h>
10
11/* ring: PROG_RING entries {op, arg, slot, seq}, ticket t at P_RING + ENTRY_BYTES * (t % PROG_RING) */
12#define MESH_P_RING 0x200
13#define MESH_PROG_RING 64u
14#define MESH_ENTRY_BYTES 16
15#define MESH_E_OP 0x0
16#define MESH_E_ARG 0x4
17#define MESH_E_SLOT 0x8 /* completion slot (< PROG_RESULTS) */
18#define MESH_E_SEQ 0xc /* t + 1 when published */
19/* Completion: result at P_RESULTS + 4 slot, then P_MARKS + 4 slot =
20 * t + 1 (release), then P_DONE += 1.  The host never publishes ticket
21 * t + PROG_RING before t completed.  After a halt (every node gone) meshd
22 * rewinds P_RING_HEAD to its published tail before relaunching. */
23#define MESH_P_RESULTS 0x600
24#define MESH_P_MARKS 0x700
25#define MESH_PROG_RESULTS 64u
26
27/* The Rust const asserts that only involve this package. */
28_Static_assert(MESH_P_RING + MESH_ENTRY_BYTES * MESH_PROG_RING  <= MESH_P_RESULTS, "P_RING + ENTRY_BYTES * PROG_RING as usize <= P_RESULTS");
29_Static_assert(MESH_P_RESULTS + 4 * MESH_PROG_RESULTS  <= MESH_P_MARKS, "P_RESULTS + 4 * PROG_RESULTS as usize <= P_MARKS");
30_Static_assert(MESH_PROG_RING == MESH_PROG_RESULTS, "PROG_RING == PROG_RESULTS");
31
32#endif