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/physics-mv/blob/main/capability.s # physics-mv FORGE: request-bound machine realization, providers and verification for AienOS. Host, simulated and GB10 hardware paths have separate evidence. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `physics-mv / capability.s` 137 lines ยท 3790 bytes Raw Blame History 1 /* 2 * capability.s - Kernel-Private Root Capability Record Genesis & Validation 3 * Milestone 2: PHYSICS_BOOT (Patched Specification) 4 * 5 * Scope: Kernel-private resource authority root (Zero Ambient Authority). 6 * Typed Identifier: CapabilityId { slot: 0, generation: 1 }. Decoupled from memory address. 7 * Storage: PHYSICS_CAPABILITY_TABLE @ 0x40206000 8 */ 9 10 .global init_root_capability 11 .global root_capability_synthesis 12 .global validate_capability 13 14 .extern print_string 15 16 .section .text, "ax" 17 .balign 4 18 19 /* 20 * init_root_capability(): 21 * Synthesizes CAP_ROOT at 0x40206000: 22 * +0x00: slot (u32=0), generation (u32=1) 23 * +0x08: principal_id (u64=1, Physics) 24 * +0x10: resource_type (u32=0xFFFFFFFF, UNIVERSAL_ROOT) 25 * +0x14: allowed_ops (u32=0xFFFFFFFF, ALL_AUTHORITY) 26 * +0x18: bound_base (u64=0x40208000, FREE_FRAME_BASE) 27 * +0x20: bound_size (u64=0x07DF8000, DRAM_END - FREE_FRAME_BASE) 28 * +0x28: revocation_state (u32=1, ACTIVE) 29 * +0x2C: attenuation_depth (u32=0) 30 * +0x30: provenance_digest (32 bytes = atlas.sha256) 31 */ 32 init_root_capability: 33 root_capability_synthesis: 34 stp x29, x30, [sp, #-16]! 35 mov x29, sp 36 37 ldr x0, =0x40206000 /* Target: PHYSICS_CAPABILITY_TABLE */ 38 39 /* +0x00: slot = 0, generation = 1 */ 40 mov w1, #0 41 str w1, [x0, #0] 42 mov w1, #1 43 str w1, [x0, #4] 44 45 /* +0x08: principal_id = 1 */ 46 mov x1, #1 47 str x1, [x0, #8] 48 49 /* +0x10: resource_type = 0x00000001 (RES_UNIVERSAL_ROOT), allowed_ops = 0xFFFFFFFF */ 50 mov w1, #1 51 str w1, [x0, #16] 52 mov w1, #-1 53 str w1, [x0, #20] 54 55 /* +0x18: bound_base = 0x40208000 (FREE_FRAME_BASE) */ 56 ldr x1, =0x40208000 57 str x1, [x0, #24] 58 59 /* +0x20: bound_size = 0x07DF8000 (~125.9 MiB free DRAM) */ 60 ldr x1, =0x07DF8000 61 str x1, [x0, #32] 62 63 /* +0x28: revocation_state = 1 (ACTIVE), attenuation_depth = 0 */ 64 mov w1, #1 65 str w1, [x0, #40] 66 mov w1, #0 67 str w1, [x0, #44] 68 69 /* +0x30: Pinned provenance digest from atlas.sha256 (32 bytes) */ 70 adr x1, pinned_atlas_sha256 71 ldp x2, x3, [x1, #0] 72 ldp x4, x5, [x1, #16] 73 stp x2, x3, [x0, #48] 74 stp x4, x5, [x0, #64] 75 76 /* Emit telemetry: "PHYSICS: CAP_ROOT_GENESIS\n" */ 77 ldr x0, =msg_cap_genesis 78 bl print_string 79 80 ldp x29, x30, [sp], #16 81 ret 82 83 /* 84 * validate_capability(cap_ptr, requested_op, address, size) 85 * x0: pointer to capability record 86 * w1: requested operation bitmask 87 * x2: requested address 88 * x3: requested size 89 * Returns: 90 * x0: 1 if valid, 0 if denied 91 */ 92 validate_capability: 93 /* Check active state */ 94 ldr w4, [x0, #40] /* revocation_state */ 95 cmp w4, #1 96 b.ne .Lcap_denied 97 98 /* Check allowed_ops: (allowed_ops & requested_op) == requested_op */ 99 ldr w4, [x0, #20] /* allowed_ops */ 100 and w5, w4, w1 101 cmp w5, w1 102 b.ne .Lcap_denied 103 104 /* Check bounds: address >= bound_base */ 105 ldr x4, [x0, #24] /* bound_base */ 106 cmp x2, x4 107 b.lo .Lcap_denied 108 109 /* Check overflow: address + size */ 110 add x5, x2, x3 111 cmp x5, x2 112 b.lo .Lcap_denied /* Wrapped around */ 113 114 /* Check upper bound: address + size <= bound_base + bound_size */ 115 ldr x6, [x0, #32] /* bound_size */ 116 add x7, x4, x6 117 cmp x5, x7 118 b.hi .Lcap_denied 119 120 mov x0, #1 121 ret 122 123 .Lcap_denied: 124 mov x0, #0 125 ret 126 127 .section .rodata 128 .balign 8 129 msg_cap_genesis: 130 .asciz "PHYSICS: CAP_ROOT_GENESIS\n" 131 132 pinned_atlas_sha256: 133 /* `f7802501` `b410a0c1` `9eff7b8f` `ca8865c9` `ba9c96bf` `a4f8065c` `a8f508b6` `7748b9a5` */ 134 .byte 0xf7, 0x80, 0x25, 0x01, 0xb4, 0x10, 0xa0, 0xc1 135 .byte 0x9e, 0xff, 0x7b, 0x8f, 0xca, 0x88, 0x65, 0xc9 136 .byte 0xba, 0x9c, 0x96, 0xbf, 0xa4, 0xf8, 0x06, 0x5c 137 .byte 0xa8, 0xf5, 0x08, 0xb6, 0x77, 0x48, 0xb9, 0xa5