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 / aienux / kernel / core / pipe.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note aienux/kernel/core/pipe.om: Pure-Omega Capability-Gated Bounded Byte Pipes (AIENOS-NATIVE-PIPE-1). |
| 3 | note Converted from upstream aienux native/kernel/core/pipe.h and native/kernel/core/pipe.c. |
| 4 | note Fixed pool of 4 pipes * 64 KiB each, epoch-tagged capability handles, EOF/BROKEN_PIPE/WOULD_BLOCK, |
| 5 | note revocation with buffer scrub, per-end cancel, user-VA window validation, and OSHF op-table dispatch. |
| 6 | |
| 7 | const PIPE_ABI_VERSION ulong 1 |
| 8 | const PIPE_FRAME_MAGIC ulong 0x4f534846 |
| 9 | const PIPE_CAPACITY ulong 65536 |
| 10 | const PIPE_POOL_PIPES ulong 4 |
| 11 | const PIPE_RES_TAG uint 0x50 |
| 12 | const PIPE_EPOCH_MAX uint 0xfffff |
| 13 | const PIPE_USER_TOP ulong 0xffff000000000000 |
| 14 | const PIPE_BOUNCE ulong 1024 |
| 15 | |
| 16 | note Pipe ends and capability rights |
| 17 | const PIPE_END_READ uint 0 |
| 18 | const PIPE_END_WRITE uint 1 |
| 19 | const PIPE_R_READ uint 1 |
| 20 | const PIPE_R_WRITE uint 2 |
| 21 | const PIPE_R_DERIVE uint 4 |
| 22 | const PIPE_R_GRANT uint 8 |
| 23 | const PIPE_R_REVOKE uint 16 |
| 24 | const PIPE_CTL_RIGHTS uint 28 |
| 25 | |
| 26 | note Pipe flags |
| 27 | const PIPE_FLAG_LIVE uint 1 |
| 28 | const PIPE_FLAG_REVOKED uint 2 |
| 29 | const PIPE_FLAG_CANCEL_RD uint 4 |
| 30 | const PIPE_FLAG_CANCEL_WR uint 8 |
| 31 | |
| 32 | note Platform op ids (OSHF) |
| 33 | const PIPE_OP_CREATE ulong 1 |
| 34 | const PIPE_OP_READ ulong 2 |
| 35 | const PIPE_OP_WRITE ulong 3 |
| 36 | const PIPE_OP_CLOSE ulong 4 |
| 37 | const PIPE_OP_DUP ulong 5 |
| 38 | |
| 39 | note OSH error codes |
| 40 | const OSH_E_OK uint 0 |
| 41 | const OSH_E_INVALID_ARG uint 1 |
| 42 | const OSH_E_DENIED uint 2 |
| 43 | const OSH_E_STALE uint 3 |
| 44 | const OSH_E_REVOKED uint 4 |
| 45 | const OSH_E_LIMIT uint 5 |
| 46 | const OSH_E_WOULD_BLOCK uint 6 |
| 47 | const OSH_E_BROKEN_PIPE uint 7 |
| 48 | const OSH_E_INTERRUPTED uint 8 |
| 49 | const OSH_E_NOT_SUPPORTED uint 9 |
| 50 | |
| 51 | note Pipe pool storage: 4 pipes * 65536 bytes = 262144 bytes |
| 52 | global pipe_buf uchar 262144 |
| 53 | note Per-pipe metadata (4 pipes * 8 u32s = 32): |
| 54 | note 0=head, 1=len, 2=epoch, 3=rrefs, 4=wrefs, 5=flags |
| 55 | global pipe_meta uint 32 |
| 56 | note Pool totals: 0=live, 1=bytes_written, 2=bytes_read, 3=eof, 4=broken_pipe, 5=revocations, 6=refused |
| 57 | global pipe_stats ulong 8 |
| 58 | |
| 59 | note Capability tables: 2 principals (0=caller, 1=peer) * 16 slots = 32 slots |
| 60 | const PIPE_CAP_SLOTS ulong 16 |
| 61 | global pcap_used uchar 32 |
| 62 | global pcap_gen uint 32 |
| 63 | global pcap_res uint 32 |
| 64 | global pcap_rights uint 32 |
| 65 | |
| 66 | fn pipe_make_res idx uint end_id uint epoch uint to uint |
| 67 | ret or or shl PIPE_RES_TAG 24 shl and end_id 1 23 or shl and idx 7 20 and epoch PIPE_EPOCH_MAX |
| 68 | end |
| 69 | |
| 70 | fn pipe_make_handle slot uint gen uint to ulong |
| 71 | ret or ulong slot shl ulong gen 32 |
| 72 | end |
| 73 | |
| 74 | fn pipe_pool_init to void |
| 75 | for i ulong 32 |
| 76 | put pipe_meta i 0 |
| 77 | put pcap_used i 0 |
| 78 | put pcap_gen i 0 |
| 79 | put pcap_res i 0 |
| 80 | put pcap_rights i 0 |
| 81 | end |
| 82 | for s ulong 8 |
| 83 | put pipe_stats s 0 |
| 84 | end |
| 85 | end |
| 86 | |
| 87 | fn pipe_pool_empty to bool |
| 88 | if ne get pipe_stats 0 0 |
| 89 | ret false |
| 90 | end |
| 91 | for i ulong 4 |
| 92 | if ne and get pipe_meta add mul i 8 5 PIPE_FLAG_LIVE 0 |
| 93 | ret false |
| 94 | end |
| 95 | end |
| 96 | ret true |
| 97 | end |
| 98 | |
| 99 | fn pcap_insert tbl ulong res uint rights uint h_out edit ulong 1 to bool |
| 100 | base = mul tbl PIPE_CAP_SLOTS |
| 101 | slot = PIPE_CAP_SLOTS |
| 102 | for i ulong 16 |
| 103 | if eq get pcap_used add base i 0 |
| 104 | slot = i |
| 105 | break |
| 106 | end |
| 107 | end |
| 108 | if ge slot PIPE_CAP_SLOTS |
| 109 | ret false |
| 110 | end |
| 111 | pos = add base slot |
| 112 | gen = add get pcap_gen pos 1 |
| 113 | if eq gen 0 |
| 114 | gen = uint 1 |
| 115 | end |
| 116 | put pcap_used pos 1 |
| 117 | put pcap_gen pos gen |
| 118 | put pcap_res pos res |
| 119 | put pcap_rights pos rights |
| 120 | put h_out 0 pipe_make_handle uint slot gen |
| 121 | ret true |
| 122 | end |
| 123 | |
| 124 | fn pcap_remove tbl ulong h ulong to bool |
| 125 | slot = ulong and h 0xffffffff |
| 126 | gen = uint shr h 32 |
| 127 | if or ge slot PIPE_CAP_SLOTS eq gen 0 |
| 128 | ret false |
| 129 | end |
| 130 | pos = add mul tbl PIPE_CAP_SLOTS slot |
| 131 | if or eq get pcap_used pos 0 ne get pcap_gen pos gen |
| 132 | ret false |
| 133 | end |
| 134 | put pcap_used pos 0 |
| 135 | put pcap_res pos 0 |
| 136 | put pcap_rights pos 0 |
| 137 | ret true |
| 138 | end |
| 139 | |
| 140 | fn pipe_check_live idx uint epoch uint live_ok bool to uint |
| 141 | mbase = mul ulong idx 8 |
| 142 | flags = get pipe_meta add mbase 5 |
| 143 | if or eq and flags PIPE_FLAG_LIVE 0 ne get pipe_meta add mbase 2 epoch |
| 144 | put pipe_stats 6 add get pipe_stats 6 1 |
| 145 | ret OSH_E_STALE |
| 146 | end |
| 147 | if and not live_ok ne and flags PIPE_FLAG_REVOKED 0 |
| 148 | put pipe_stats 6 add get pipe_stats 6 1 |
| 149 | ret OSH_E_REVOKED |
| 150 | end |
| 151 | ret OSH_E_OK |
| 152 | end |
| 153 | |
| 154 | fn pcap_lookup_res tbl ulong h ulong need uint res_out edit uint 1 to uint |
| 155 | slot = ulong and h 0xffffffff |
| 156 | gen = uint shr h 32 |
| 157 | if or ge tbl 2 or ge slot PIPE_CAP_SLOTS eq gen 0 |
| 158 | ret OSH_E_INVALID_ARG |
| 159 | end |
| 160 | pos = add mul tbl PIPE_CAP_SLOTS slot |
| 161 | if or eq get pcap_used pos 0 ne get pcap_gen pos gen |
| 162 | put pipe_stats 6 add get pipe_stats 6 1 |
| 163 | ret OSH_E_STALE |
| 164 | end |
| 165 | if ne and get pcap_rights pos need need |
| 166 | put pipe_stats 6 add get pipe_stats 6 1 |
| 167 | ret OSH_E_DENIED |
| 168 | end |
| 169 | put res_out 0 get pcap_res pos |
| 170 | ret OSH_E_OK |
| 171 | end |
| 172 | |
| 173 | note Resolve handle h in table tbl requiring rights `need` and end `want_end` (2 = either). |
| 174 | note On OK writes idx to out_ie[0], end to out_ie[1]. |
| 175 | fn pipe_resolve tbl ulong h ulong need uint want_end uint live_ok bool out_ie edit uint 2 to uint |
| 176 | rbox = new uint 1 0 |
| 177 | lrc = pcap_lookup_res tbl h need rbox |
| 178 | if ne lrc OSH_E_OK |
| 179 | ret lrc |
| 180 | end |
| 181 | res = get rbox 0 |
| 182 | if ne shr res 24 PIPE_RES_TAG |
| 183 | put pipe_stats 6 add get pipe_stats 6 1 |
| 184 | ret OSH_E_DENIED |
| 185 | end |
| 186 | idx = and shr res 20 7 |
| 187 | end_id = and shr res 23 1 |
| 188 | if ge ulong idx PIPE_POOL_PIPES |
| 189 | put pipe_stats 6 add get pipe_stats 6 1 |
| 190 | ret OSH_E_DENIED |
| 191 | end |
| 192 | if lt want_end 2 |
| 193 | if ne end_id want_end |
| 194 | put pipe_stats 6 add get pipe_stats 6 1 |
| 195 | ret OSH_E_DENIED |
| 196 | end |
| 197 | end |
| 198 | rc = pipe_check_live idx and res PIPE_EPOCH_MAX live_ok |
| 199 | if ne rc OSH_E_OK |
| 200 | ret rc |
| 201 | end |
| 202 | put out_ie 0 idx |
| 203 | put out_ie 1 end_id |
| 204 | ret OSH_E_OK |
| 205 | end |
| 206 | |
| 207 | fn pipe_scrub idx ulong to void |
| 208 | base = mul idx PIPE_CAPACITY |
| 209 | for i ulong 65536 |
| 210 | put pipe_buf add base i 0 |
| 211 | end |
| 212 | end |
| 213 | |
| 214 | fn pipe_create tbl ulong rd_out edit ulong 1 wr_out edit ulong 1 to uint |
| 215 | if ge tbl 2 |
| 216 | ret OSH_E_INVALID_ARG |
| 217 | end |
| 218 | idx = PIPE_POOL_PIPES |
| 219 | for i ulong 4 |
| 220 | mbase = mul i 8 |
| 221 | fl = get pipe_meta add mbase 5 |
| 222 | ep = get pipe_meta add mbase 2 |
| 223 | if and eq and fl PIPE_FLAG_LIVE 0 lt ep PIPE_EPOCH_MAX |
| 224 | idx = i |
| 225 | break |
| 226 | end |
| 227 | end |
| 228 | if ge idx PIPE_POOL_PIPES |
| 229 | ret OSH_E_LIMIT |
| 230 | end |
| 231 | mbase = mul idx 8 |
| 232 | epoch = add get pipe_meta add mbase 2 1 |
| 233 | rres = pipe_make_res uint idx PIPE_END_READ epoch |
| 234 | wres = pipe_make_res uint idx PIPE_END_WRITE epoch |
| 235 | if not pcap_insert tbl rres or PIPE_R_READ PIPE_CTL_RIGHTS rd_out |
| 236 | ret OSH_E_LIMIT |
| 237 | end |
| 238 | if not pcap_insert tbl wres or PIPE_R_WRITE PIPE_CTL_RIGHTS wr_out |
| 239 | ok_rm = pcap_remove tbl get rd_out 0 |
| 240 | if ok_rm |
| 241 | ret OSH_E_LIMIT |
| 242 | end |
| 243 | ret OSH_E_LIMIT |
| 244 | end |
| 245 | put pipe_meta add mbase 0 0 |
| 246 | put pipe_meta add mbase 1 0 |
| 247 | put pipe_meta add mbase 2 epoch |
| 248 | put pipe_meta add mbase 3 1 |
| 249 | put pipe_meta add mbase 4 1 |
| 250 | put pipe_meta add mbase 5 PIPE_FLAG_LIVE |
| 251 | put pipe_stats 0 add get pipe_stats 0 1 |
| 252 | ret OSH_E_OK |
| 253 | end |
| 254 | |
| 255 | fn pipe_ring_write idx ulong src view uchar * take ulong to void |
| 256 | mbase = mul idx 8 |
| 257 | cur_len = ulong get pipe_meta add mbase 1 |
| 258 | head = ulong get pipe_meta add mbase 0 |
| 259 | wpos = rem add head cur_len PIPE_CAPACITY |
| 260 | pbase = mul idx PIPE_CAPACITY |
| 261 | i = ulong 0 |
| 262 | while lt i take bound 65536 |
| 263 | put pipe_buf add pbase wpos get src i |
| 264 | wpos = rem add wpos 1 PIPE_CAPACITY |
| 265 | i = add i 1 |
| 266 | end |
| 267 | put pipe_meta add mbase 1 uint add cur_len take |
| 268 | put pipe_stats 1 add get pipe_stats 1 take |
| 269 | end |
| 270 | |
| 271 | fn pipe_write tbl ulong h ulong src view uchar * n_out edit ulong 1 to uint |
| 272 | put n_out 0 0 |
| 273 | ie = new uint 2 0 |
| 274 | rc = pipe_resolve tbl h PIPE_R_WRITE PIPE_END_WRITE false ie |
| 275 | if ne rc OSH_E_OK |
| 276 | ret rc |
| 277 | end |
| 278 | idx = ulong get ie 0 |
| 279 | mbase = mul idx 8 |
| 280 | fl = get pipe_meta add mbase 5 |
| 281 | if ne and fl PIPE_FLAG_CANCEL_WR 0 |
| 282 | put pipe_meta add mbase 5 and fl xor uint 0xffffffff PIPE_FLAG_CANCEL_WR |
| 283 | ret OSH_E_INTERRUPTED |
| 284 | end |
| 285 | if eq get pipe_meta add mbase 3 0 |
| 286 | put pipe_stats 4 add get pipe_stats 4 1 |
| 287 | ret OSH_E_BROKEN_PIPE |
| 288 | end |
| 289 | slen = len src |
| 290 | if eq slen 0 |
| 291 | ret OSH_E_OK |
| 292 | end |
| 293 | room = sub PIPE_CAPACITY ulong get pipe_meta add mbase 1 |
| 294 | if eq room 0 |
| 295 | ret OSH_E_WOULD_BLOCK |
| 296 | end |
| 297 | take = slen |
| 298 | if gt take room |
| 299 | take = room |
| 300 | end |
| 301 | pipe_ring_write idx src take |
| 302 | put n_out 0 take |
| 303 | ret OSH_E_OK |
| 304 | end |
| 305 | |
| 306 | fn pipe_ring_read idx ulong dst edit uchar * take ulong to void |
| 307 | mbase = mul idx 8 |
| 308 | cur_len = ulong get pipe_meta add mbase 1 |
| 309 | head = ulong get pipe_meta add mbase 0 |
| 310 | pbase = mul idx PIPE_CAPACITY |
| 311 | i = ulong 0 |
| 312 | while lt i take bound 65536 |
| 313 | put dst i get pipe_buf add pbase head |
| 314 | put pipe_buf add pbase head 0 |
| 315 | head = rem add head 1 PIPE_CAPACITY |
| 316 | i = add i 1 |
| 317 | end |
| 318 | new_len = sub cur_len take |
| 319 | if eq new_len 0 |
| 320 | head = ulong 0 |
| 321 | end |
| 322 | put pipe_meta add mbase 0 uint head |
| 323 | put pipe_meta add mbase 1 uint new_len |
| 324 | put pipe_stats 2 add get pipe_stats 2 take |
| 325 | end |
| 326 | |
| 327 | fn pipe_read tbl ulong h ulong dst edit uchar * n_out edit ulong 1 to uint |
| 328 | put n_out 0 0 |
| 329 | ie = new uint 2 0 |
| 330 | rc = pipe_resolve tbl h PIPE_R_READ PIPE_END_READ false ie |
| 331 | if ne rc OSH_E_OK |
| 332 | ret rc |
| 333 | end |
| 334 | idx = ulong get ie 0 |
| 335 | mbase = mul idx 8 |
| 336 | fl = get pipe_meta add mbase 5 |
| 337 | if ne and fl PIPE_FLAG_CANCEL_RD 0 |
| 338 | put pipe_meta add mbase 5 and fl xor uint 0xffffffff PIPE_FLAG_CANCEL_RD |
| 339 | ret OSH_E_INTERRUPTED |
| 340 | end |
| 341 | dlen = len dst |
| 342 | if eq dlen 0 |
| 343 | ret OSH_E_OK |
| 344 | end |
| 345 | cur_len = ulong get pipe_meta add mbase 1 |
| 346 | if eq cur_len 0 |
| 347 | if eq get pipe_meta add mbase 4 0 |
| 348 | put pipe_stats 3 add get pipe_stats 3 1 |
| 349 | ret OSH_E_OK |
| 350 | end |
| 351 | ret OSH_E_WOULD_BLOCK |
| 352 | end |
| 353 | take = dlen |
| 354 | if gt take cur_len |
| 355 | take = cur_len |
| 356 | end |
| 357 | pipe_ring_read idx dst take |
| 358 | put n_out 0 take |
| 359 | ret OSH_E_OK |
| 360 | end |
| 361 | |
| 362 | fn pipe_close tbl ulong h ulong to uint |
| 363 | ie = new uint 2 0 |
| 364 | rc = pipe_resolve tbl h 0 2 true ie |
| 365 | ok_rm = pcap_remove tbl h |
| 366 | if ne rc OSH_E_OK |
| 367 | if ok_rm |
| 368 | ret rc |
| 369 | end |
| 370 | ret rc |
| 371 | end |
| 372 | idx = ulong get ie 0 |
| 373 | end_id = get ie 1 |
| 374 | mbase = mul idx 8 |
| 375 | if eq end_id PIPE_END_READ |
| 376 | rr = get pipe_meta add mbase 3 |
| 377 | if gt rr 0 |
| 378 | put pipe_meta add mbase 3 sub rr 1 |
| 379 | end |
| 380 | else |
| 381 | wr = get pipe_meta add mbase 4 |
| 382 | if gt wr 0 |
| 383 | put pipe_meta add mbase 4 sub wr 1 |
| 384 | end |
| 385 | end |
| 386 | rr0 = get pipe_meta add mbase 3 |
| 387 | wr0 = get pipe_meta add mbase 4 |
| 388 | if and eq rr0 0 eq wr0 0 |
| 389 | pipe_scrub idx |
| 390 | put pipe_meta add mbase 0 0 |
| 391 | put pipe_meta add mbase 1 0 |
| 392 | put pipe_meta add mbase 5 0 |
| 393 | if gt get pipe_stats 0 0 |
| 394 | put pipe_stats 0 sub get pipe_stats 0 1 |
| 395 | end |
| 396 | end |
| 397 | ret OSH_E_OK |
| 398 | end |
| 399 | |
| 400 | fn pipe_revoke tbl ulong h ulong to uint |
| 401 | ie = new uint 2 0 |
| 402 | rc = pipe_resolve tbl h PIPE_R_REVOKE 2 false ie |
| 403 | if ne rc OSH_E_OK |
| 404 | ret rc |
| 405 | end |
| 406 | idx = ulong get ie 0 |
| 407 | mbase = mul idx 8 |
| 408 | pipe_scrub idx |
| 409 | put pipe_meta add mbase 0 0 |
| 410 | put pipe_meta add mbase 1 0 |
| 411 | put pipe_meta add mbase 5 or get pipe_meta add mbase 5 PIPE_FLAG_REVOKED |
| 412 | put pipe_stats 5 add get pipe_stats 5 1 |
| 413 | ret OSH_E_OK |
| 414 | end |
| 415 | |
| 416 | fn pipe_cancel tbl ulong h ulong to uint |
| 417 | ie = new uint 2 0 |
| 418 | rc = pipe_resolve tbl h 0 2 false ie |
| 419 | if ne rc OSH_E_OK |
| 420 | ret rc |
| 421 | end |
| 422 | idx = ulong get ie 0 |
| 423 | end_id = get ie 1 |
| 424 | need = PIPE_R_WRITE |
| 425 | cflag = PIPE_FLAG_CANCEL_WR |
| 426 | if eq end_id PIPE_END_READ |
| 427 | need = PIPE_R_READ |
| 428 | cflag = PIPE_FLAG_CANCEL_RD |
| 429 | end |
| 430 | rc2 = pipe_resolve tbl h need end_id false ie |
| 431 | if ne rc2 OSH_E_OK |
| 432 | ret rc2 |
| 433 | end |
| 434 | mbase = mul idx 8 |
| 435 | put pipe_meta add mbase 5 or get pipe_meta add mbase 5 cflag |
| 436 | ret OSH_E_OK |
| 437 | end |
| 438 | |
| 439 | fn pipe_dup_rights_ok src_r uint end_id uint rights uint to bool |
| 440 | dright = PIPE_R_WRITE |
| 441 | if eq end_id PIPE_END_READ |
| 442 | dright = PIPE_R_READ |
| 443 | end |
| 444 | allowed = or dright PIPE_CTL_RIGHTS |
| 445 | if eq and rights dright 0 |
| 446 | ret false |
| 447 | end |
| 448 | if ne and rights xor uint 0xffffffff src_r 0 |
| 449 | ret false |
| 450 | end |
| 451 | ret eq and rights xor uint 0xffffffff allowed 0 |
| 452 | end |
| 453 | |
| 454 | fn pipe_dup from_tbl ulong h ulong to_tbl ulong rights uint h_out edit ulong 1 to uint |
| 455 | if ge to_tbl 2 |
| 456 | ret OSH_E_INVALID_ARG |
| 457 | end |
| 458 | need_ctl = PIPE_R_GRANT |
| 459 | if eq from_tbl to_tbl |
| 460 | need_ctl = PIPE_R_DERIVE |
| 461 | end |
| 462 | ie = new uint 2 0 |
| 463 | rc = pipe_resolve from_tbl h need_ctl 2 false ie |
| 464 | if ne rc OSH_E_OK |
| 465 | ret rc |
| 466 | end |
| 467 | pos = add mul from_tbl PIPE_CAP_SLOTS ulong and h 0xffffffff |
| 468 | if not pipe_dup_rights_ok get pcap_rights pos get ie 1 rights |
| 469 | ret OSH_E_DENIED |
| 470 | end |
| 471 | if not pcap_insert to_tbl get pcap_res pos rights h_out |
| 472 | ret OSH_E_LIMIT |
| 473 | end |
| 474 | mbase = mul ulong get ie 0 8 |
| 475 | if eq get ie 1 PIPE_END_READ |
| 476 | put pipe_meta add mbase 3 add get pipe_meta add mbase 3 1 |
| 477 | else |
| 478 | put pipe_meta add mbase 4 add get pipe_meta add mbase 4 1 |
| 479 | end |
| 480 | ret OSH_E_OK |
| 481 | end |
| 482 | |
| 483 | fn pipe_user_window_ok base ulong slen ulong user_lo ulong user_hi ulong to bool |
| 484 | if eq slen 0 |
| 485 | ret true |
| 486 | end |
| 487 | if or gt user_hi PIPE_USER_TOP le user_hi user_lo |
| 488 | ret false |
| 489 | end |
| 490 | if or lt base user_lo ge base user_hi |
| 491 | ret false |
| 492 | end |
| 493 | ret le slen sub user_hi base |
| 494 | end |
| 495 | |
| 496 | fn pipe_dispatch_check frame view ulong * to uint |
| 497 | ncells = len frame |
| 498 | if lt ncells 4 |
| 499 | ret OSH_E_INVALID_ARG |
| 500 | end |
| 501 | if or ne get frame 0 PIPE_FRAME_MAGIC ne get frame 3 0 |
| 502 | ret OSH_E_INVALID_ARG |
| 503 | end |
| 504 | if ne get frame 1 PIPE_ABI_VERSION |
| 505 | ret OSH_E_NOT_SUPPORTED |
| 506 | end |
| 507 | op = get frame 2 |
| 508 | if eq op PIPE_OP_CREATE |
| 509 | if ne ncells 4 |
| 510 | ret OSH_E_INVALID_ARG |
| 511 | end |
| 512 | ret OSH_E_OK |
| 513 | end |
| 514 | if or eq op PIPE_OP_READ eq op PIPE_OP_WRITE |
| 515 | if ne ncells 6 |
| 516 | ret OSH_E_INVALID_ARG |
| 517 | end |
| 518 | if or eq shr get frame 4 32 0 gt get frame 5 1 |
| 519 | ret OSH_E_INVALID_ARG |
| 520 | end |
| 521 | ret OSH_E_OK |
| 522 | end |
| 523 | if eq op PIPE_OP_CLOSE |
| 524 | if ne ncells 5 |
| 525 | ret OSH_E_INVALID_ARG |
| 526 | end |
| 527 | if eq shr get frame 4 32 0 |
| 528 | ret OSH_E_INVALID_ARG |
| 529 | end |
| 530 | ret OSH_E_OK |
| 531 | end |
| 532 | if eq op PIPE_OP_DUP |
| 533 | if ne ncells 7 |
| 534 | ret OSH_E_INVALID_ARG |
| 535 | end |
| 536 | if or eq shr get frame 4 32 0 gt get frame 6 1 |
| 537 | ret OSH_E_INVALID_ARG |
| 538 | end |
| 539 | ret OSH_E_OK |
| 540 | end |
| 541 | ret OSH_E_NOT_SUPPORTED |
| 542 | end |