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
omega-mv / tests / arboris / native-arena.om
| 1 | note Host smoke for the native import preflight and CPU address reservations. |
| 2 | note No GPU device is opened in this program. |
| 3 | fn main to int |
| 4 | m = new ulong 16 0 |
| 5 | starts = new ulong 6 0 |
| 6 | records = new uchar 144 0 |
| 7 | put m 0 arboris_magic |
| 8 | put m 1 1 |
| 9 | put m 2 1 |
| 10 | put m 3 1 |
| 11 | put m 4 8 |
| 12 | put m 5 1 |
| 13 | put m 10 128 |
| 14 | if ne arboris_plan_arena m 1048576 4096 starts 0 |
| 15 | ret 1 |
| 16 | end |
| 17 | for i ulong 6 |
| 18 | base = mul i 24 |
| 19 | put records base 79 |
| 20 | put records add base 1 77 |
| 21 | put records add base 2 90 |
| 22 | put records add base 3 67 |
| 23 | put records add base 4 1 |
| 24 | put records add base 8 33 |
| 25 | put records add base 12 uchar add i 1 |
| 26 | put records add base 17 16 |
| 27 | end |
| 28 | if not ar_shares_valid records m starts |
| 29 | ret 2 |
| 30 | end |
| 31 | put records 132 1 |
| 32 | if ar_shares_valid records m starts |
| 33 | ret 3 |
| 34 | end |
| 35 | put records 132 6 |
| 36 | put records 17 32 |
| 37 | if ar_shares_valid records m starts |
| 38 | ret 4 |
| 39 | end |
| 40 | if ar_map_arena records m 1048576 |
| 41 | ret 5 |
| 42 | end |
| 43 | reservation = maphold 68719476736 4096 |
| 44 | if le reservation 0 |
| 45 | ret 11 |
| 46 | end |
| 47 | if ne mapbind reservation neg int 1 0 1 neg long 9 |
| 48 | ret 12 |
| 49 | end |
| 50 | note The following ar_guard reacquires that exact VA after the bind refused. |
| 51 | put nvnext 0 68719476736 |
| 52 | if not ar_guard 0 |
| 53 | ret 6 |
| 54 | end |
| 55 | clash = maphold 68719476736 4096 |
| 56 | if gt clash 0 |
| 57 | ret 7 |
| 58 | end |
| 59 | put ar_code_model 0 arboris_magic |
| 60 | if ar_unmap |
| 61 | ret 9 |
| 62 | end |
| 63 | if eq get ar_guards 0 0 |
| 64 | ret 10 |
| 65 | end |
| 66 | put ar_code_model 0 0 |
| 67 | if not ar_unmap |
| 68 | ret 8 |
| 69 | end |
| 70 | ret 0 |
| 71 | end |