Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/src/runtime/rx_native_bind.c # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / src / runtime / rx_native_bind.c` 71 lines ยท 3172 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* 18 * rx_native_bind.c -- point a reaction world at the native authority view. 19 * The Linux oracle is not started and is not deleted. 20 */ 21 #include "rx_world.h" 22 #include "aienos_cap.h" 23 #include "rx_argus.h" 24 25 #include 26 27 _Static_assert(sizeof(AienosCapRef) == sizeof(RxCapRef), "capability reference width"); 28 _Static_assert(sizeof(AienosCapEntry) == sizeof(RxCapEntry), "capability entry width"); 29 _Static_assert(offsetof(AienosCapEntry, resource) == offsetof(RxCapEntry, resource), 30 "resource field moved"); 31 _Static_assert(offsetof(AienosCapEntry, minted_by_generation) == 32 offsetof(RxCapEntry, minted_by_generation), 33 "entry tail moved"); 34 35 static int native_validate(const void *ctx, RxCapRef ref, uint32_t subject, uint64_t resource, 36 uint32_t rights, RxCapEntry *out) { 37 AienosCapRef cap = { ref.cap_id, ref.generation }; 38 #if RX_ARGUS 39 /* ARGUS v1.1: order key read before the validate; a success is counted in 40 * this thread's use table, a failure is a full event (generation u32 -> u64). */ 41 uint64_t argus_key = rx_argus_use_begin(); 42 #endif 43 int rc = aienos_cap_validate(ctx, cap, subject, resource, rights, (AienosCapEntry *)out); 44 #if RX_ARGUS 45 rx_argus_use_end(argus_key, ctx, subject, ref.cap_id, (uint64_t)ref.generation, resource, rc); 46 #endif 47 return rc; 48 } 49 50 static int native_inspect(const void *ctx, RxCapRef ref, RxCapEntry *out) { 51 AienosCapRef cap = { ref.cap_id, ref.generation }; 52 return aienos_cap_inspect(ctx, cap, (AienosCapEntry *)out); 53 } 54 55 int rx_world_init_native(RxWorld *w, const AienosCapView *view, uint32_t n_workers, 56 uint64_t crumb_cap) { 57 if (!view) return RX_ERR_ARG; 58 return rx_world_init_with_auth(w, NULL, view, native_validate, native_inspect, n_workers, 59 crumb_cap); 60 } 61 62 /* R15 sequential reference on the same native authority (rx_seq_reference.h). */ 63 int rx_world_init_sequential_reference(RxWorld *w, const void *auth_ctx, 64 RxAuthValidateFn validate, RxAuthInspectFn inspect, 65 uint64_t crumb_cap); 66 int rx_world_init_native_sequential_reference(RxWorld *w, const AienosCapView *view, 67 uint64_t crumb_cap) { 68 if (!view) return RX_ERR_ARG; 69 return rx_world_init_sequential_reference(w, view, native_validate, native_inspect, 70 crumb_cap); 71 }