omega-gpu-driver
aien-dev/omega-gpu-driver
Brought by drakestapleton
omega-gpu-driver / tests / irqcmd_trace.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note HOST MODEL verifier input; opcode9 deliberately corrupts peer-owned live storage after capture. |
| 3 | global ciin uchar 512 |
| 4 | global ciout uchar 64 |
| 5 | fn ciword o ulong v ulong to void |
| 6 | for i ulong 8 |
| 7 | put ciout add o i uchar and shr v mul i 8 255 |
| 8 | end |
| 9 | end |
| 10 | fn ciop op uchar to long |
| 11 | if eq op 0 |
| 12 | if ne get iqcstate 0 0 |
| 13 | ret -4 |
| 14 | end |
| 15 | put iqcmode 0 1 |
| 16 | put iqcstate 0 1 |
| 17 | ret 0 |
| 18 | end |
| 19 | if or eq op 1 eq op 2 |
| 20 | ret iqcommand ulong op add get iqcseq 0 1 16 32 4 |
| 21 | end |
| 22 | if eq op 3 |
| 23 | ret iqcommand 1 get iqcseq 0 16 32 4 |
| 24 | end |
| 25 | if eq op 4 |
| 26 | ret iqctake |
| 27 | end |
| 28 | if eq op 5 |
| 29 | ret iqcack iqcget 1 |
| 30 | end |
| 31 | if eq op 6 |
| 32 | ret iqcack add iqcget 1 1 |
| 33 | end |
| 34 | if eq op 7 |
| 35 | ret iqcrevoke |
| 36 | end |
| 37 | if eq op 8 |
| 38 | put iqcmode 0 0 |
| 39 | ret 0 |
| 40 | end |
| 41 | if eq op 9 |
| 42 | put iqcmd add mul rem get iqccons 0 8 40 8 99 |
| 43 | ret 0 |
| 44 | end |
| 45 | if eq op 10 |
| 46 | ret iqcommand 3 add get iqcseq 0 1 16 32 4 |
| 47 | end |
| 48 | ret iqcommand 1 0 16 32 4 |
| 49 | end |
| 50 | fn main to int |
| 51 | n = read 0 ciin 0 512 |
| 52 | if lt n 0 |
| 53 | ret 2 |
| 54 | end |
| 55 | for k ulong ulong n |
| 56 | r = ciop get ciin k |
| 57 | ciword 0 ulong add r 128 |
| 58 | ciword 8 get iqcprod 0 |
| 59 | ciword 16 get iqccons 0 |
| 60 | ciword 24 get iqcstate 0 |
| 61 | ciword 32 get iqchold 0 |
| 62 | ciword 40 get iqcseq 0 |
| 63 | ciword 48 iqcget 0 |
| 64 | ciword 56 iqcget 1 |
| 65 | r = write 1 ciout 0 64 |
| 66 | if ne r 64 |
| 67 | ret 3 |
| 68 | end |
| 69 | r = write 1 iqcitem 0 40 |
| 70 | if ne r 40 |
| 71 | ret 4 |
| 72 | end |
| 73 | end |
| 74 | ret 0 |
| 75 | end |