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/tests/polyglot/cs_call.S # 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 / tests / polyglot / cs_call.S` 88 lines ยท 2208 bytes Raw Blame History 1 /* POLYGLOT-0 shared verifier: callee-saved register sentinel trampoline. 2 * (review G-S4; harness from docs/polyglot/review-polyglot-0.md appendix) 3 * 4 * int omx_cs_call(run_fn fn, const oma_rz_plan *p, const int8_t *x, int32_t *y, uint64_t out[18]) 5 * 6 * Loads x19-x28 and d8-d15 (AAPCS64 callee-saved) with known sentinels, 7 * calls fn(p, x, y), then stores the ten x registers and the eight d 8 * registers to out[0..17] and restores the caller's values. Returns fn's 9 * return value (w0 is not touched after the call). The sentinels are 10 * OMX_CS_SENTINEL(i) = 0x5a00000000000000 | (i << 48) | (0x1111 * (i + 1)), 11 * i = 0..17, built with movz/movk so every value has high and low bits set. 12 */ 13 .text 14 .p2align 4 15 .globl omx_cs_call 16 .type omx_cs_call, %function 17 omx_cs_call: // x0 fn, x1 p, x2 x, x3 y, x4 out 18 stp x29, x30, [sp, #-176]! 19 mov x29, sp 20 stp x19, x20, [sp, #16] 21 stp x21, x22, [sp, #32] 22 stp x23, x24, [sp, #48] 23 stp x25, x26, [sp, #64] 24 stp x27, x28, [sp, #80] 25 stp d8, d9, [sp, #96] 26 stp d10, d11, [sp, #112] 27 stp d12, d13, [sp, #128] 28 stp d14, d15, [sp, #144] 29 str x4, [sp, #160] 30 mov x16, x0 31 mov x0, x1 32 mov x1, x2 33 mov x2, x3 34 .macro SENT reg, i 35 movz \reg, #(0x1111 * (\i + 1)) & 0xffff 36 movk \reg, #(0x5a00 | \i), lsl #48 37 .endm 38 SENT x19, 0 39 SENT x20, 1 40 SENT x21, 2 41 SENT x22, 3 42 SENT x23, 4 43 SENT x24, 5 44 SENT x25, 6 45 SENT x26, 7 46 SENT x27, 8 47 SENT x28, 9 48 SENT x9, 10 49 fmov d8, x9 50 SENT x9, 11 51 fmov d9, x9 52 SENT x9, 12 53 fmov d10, x9 54 SENT x9, 13 55 fmov d11, x9 56 SENT x9, 14 57 fmov d12, x9 58 SENT x9, 15 59 fmov d13, x9 60 SENT x9, 16 61 fmov d14, x9 62 SENT x9, 17 63 fmov d15, x9 64 blr x16 65 ldr x4, [sp, #160] 66 stp x19, x20, [x4] 67 stp x21, x22, [x4, #16] 68 stp x23, x24, [x4, #32] 69 stp x25, x26, [x4, #48] 70 stp x27, x28, [x4, #64] 71 stp d8, d9, [x4, #80] 72 stp d10, d11, [x4, #96] 73 stp d12, d13, [x4, #112] 74 stp d14, d15, [x4, #128] 75 ldp x19, x20, [sp, #16] 76 ldp x21, x22, [sp, #32] 77 ldp x23, x24, [sp, #48] 78 ldp x25, x26, [sp, #64] 79 ldp x27, x28, [sp, #80] 80 ldp d8, d9, [sp, #96] 81 ldp d10, d11, [sp, #112] 82 ldp d12, d13, [sp, #128] 83 ldp d14, d15, [sp, #144] 84 ldp x29, x30, [sp], #176 85 ret 86 .size omx_cs_call, . - omx_cs_call 87 88 .section .note.GNU-stack, "", %progbits