aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / omega / allen / tests / memory.om
| 1 | global Disk uchar 8192 |
| 2 | text Name "Allen" |
| 3 | text Ntext "Meet at noon." |
| 4 | fn enctounit to void |
| 5 | for i ulong 4096 |
| 6 | put Unit i get Enc i |
| 7 | end |
| 8 | end |
| 9 | fn diskput slot ulong count ulong to void |
| 10 | for i ulong count |
| 11 | put Disk add mul slot 4096 i get Enc i |
| 12 | end |
| 13 | end |
| 14 | fn diskget slot ulong to void |
| 15 | for i ulong 4096 |
| 16 | put Unit i get Disk add mul slot 4096 i |
| 17 | end |
| 18 | end |
| 19 | fn main to int |
| 20 | constants |
| 21 | mset32 0 3 |
| 22 | for i ulong len Name |
| 23 | put Mem add i 40 get Name i |
| 24 | end |
| 25 | check memenc 1 301 |
| 26 | check eq get32 12 76 302 |
| 27 | check memdec 303 |
| 28 | check eq get Md 0 1 304 |
| 29 | check eq get Mem 40 65 305 |
| 30 | put Unit 24 uchar 1 |
| 31 | check not memdec 306 |
| 32 | check eq get Md 0 1 307 |
| 33 | check eq get Mem 40 65 308 |
| 34 | enctounit |
| 35 | put Unit 64 uchar 4 |
| 36 | check not memdec 309 |
| 37 | check eq get Mem 0 3 310 |
| 38 | enctounit |
| 39 | put32 8 3 |
| 40 | put32 12 64 |
| 41 | seal 64 |
| 42 | check memdec 311 |
| 43 | check eq get Md 1 3 312 |
| 44 | check eq get Mem 40 65 313 |
| 45 | put32 8 2 |
| 46 | put32 12 40 |
| 47 | for i ulong 24 |
| 48 | put Unit add i 104 0 |
| 49 | end |
| 50 | seal 40 |
| 51 | check memdec 314 |
| 52 | check eq get Md 1 2 315 |
| 53 | check eq get Mem 40 0 316 |
| 54 | put Mem 40 uchar 65 |
| 55 | check memenc 1 317 |
| 56 | check txbegin 318 |
| 57 | check eq get Tx 1 0 319 |
| 58 | diskput 0 4096 |
| 59 | check txwrite true 320 |
| 60 | check txflush true 321 |
| 61 | diskget 0 |
| 62 | check txread true 322 |
| 63 | check eq get St 0 1 323 |
| 64 | check eq get St 1 0 324 |
| 65 | mset32 0 4 |
| 66 | check txbegin 325 |
| 67 | check eq get Tx 1 1 326 |
| 68 | diskput 1 512 |
| 69 | check not txwrite false 327 |
| 70 | check eq get St 0 1 328 |
| 71 | diskget 0 |
| 72 | check memdec 329 |
| 73 | check eq get Mem 0 3 330 |
| 74 | mset32 0 4 |
| 75 | check txbegin 331 |
| 76 | diskput 1 4096 |
| 77 | check txwrite true 332 |
| 78 | check not txflush false 333 |
| 79 | check eq get St 0 1 334 |
| 80 | check txbegin 335 |
| 81 | check txwrite true 336 |
| 82 | check txflush true 337 |
| 83 | diskget 1 |
| 84 | put Unit 200 uchar 1 |
| 85 | check not txread true 338 |
| 86 | check eq get St 0 1 339 |
| 87 | check txbegin 340 |
| 88 | check txwrite true 341 |
| 89 | check txflush true 342 |
| 90 | check not txread false 343 |
| 91 | check eq get St 0 1 344 |
| 92 | check txbegin 345 |
| 93 | diskput 1 4096 |
| 94 | check txwrite true 346 |
| 95 | check txflush true 347 |
| 96 | diskget 1 |
| 97 | check txread true 348 |
| 98 | check eq get St 0 2 349 |
| 99 | check eq get St 1 1 350 |
| 100 | for i ulong 3 |
| 101 | put St i 0 |
| 102 | end |
| 103 | diskget 1 |
| 104 | check loadcopy 1 351 |
| 105 | diskget 0 |
| 106 | check loadcopy 0 352 |
| 107 | check not loadcopy 0 362 |
| 108 | check eq get St 2 2 363 |
| 109 | check eq get St 0 2 353 |
| 110 | check eq get Mem 0 4 354 |
| 111 | put Ns 0 len Ntext |
| 112 | put Ns 1 2 |
| 113 | put Ns 2 3 |
| 114 | for i ulong len Ntext |
| 115 | put Note i get Ntext i |
| 116 | end |
| 117 | check noteenc 355 |
| 118 | check notedec 2 356 |
| 119 | check eq get Ns 0 len Ntext 357 |
| 120 | check not notedec 3 358 |
| 121 | put Unit 28 uchar 1 |
| 122 | check not notedec 2 359 |
| 123 | check eq get Ns 1 2 360 |
| 124 | check nbegin 364 |
| 125 | check not txbegin 365 |
| 126 | check not nwrite false 366 |
| 127 | check eq get Nt 0 0 367 |
| 128 | check nbegin 368 |
| 129 | check nwrite true 369 |
| 130 | check not nflush false 370 |
| 131 | check nbegin 371 |
| 132 | check nwrite true 372 |
| 133 | check nflush true 373 |
| 134 | enctounit |
| 135 | put Unit 300 uchar 1 |
| 136 | check not nread true 374 |
| 137 | check nbegin 375 |
| 138 | check nwrite true 376 |
| 139 | check nflush true 377 |
| 140 | enctounit |
| 141 | check nread true 378 |
| 142 | check eq get St 0 2 379 |
| 143 | put St 0 18446744073709551615 |
| 144 | check not txbegin 361 |
| 145 | ret int get Fails 0 |
| 146 | end |