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/seed/atlas/atlas.s2 # 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 / seed / atlas / atlas.s2` 475 lines ยท 9324 bytes Raw Blame History 1 ; atlas.s2 -- the Atlas boot image (CONTRACT-QEMU-VIRT-AARCH64-M1), written in asm2's language from 2 ; ~/workspace/atlas/atlas.s and sha256_clean.s, line for line, and built by asm2 (no GNU as, no ld): 3 ; cat seed/rung2/table.s2 seed/rung3/table3.s2 seed/atlas/table5.s2 seed/atlas/atlas.s2 | asm2.bin 4 ; The output is the flat image itself: byte 0 is the first instruction (flash base 0). The layout the 5 ; linker made is written here by hand: atlas.o's text at 0 (code, messages, digest, literal pool, padded 6 ; to 64), sha256_clean's text from 0x180 (each function aligned as its .p2align asks, padding = NOP), 7 ; then 4 zero bytes and the K table (.rodata, aligned to 8) at 0x4c8. Total 1480 bytes. 8 ; ---- 0x000 _start ---- 9 :_start 10 msr.daifset 15 ; msr daifset, #0xf 11 ldr.x.lit x0 L_`401fc000` 12 add.x.i sp x0 0 ; mov sp, x0 (MOV to SP = ADD #0, C6.2.278) 13 ldr.x.lit x20 L_`09000000` 14 adr x21 msg_awaken 15 bl print_string 16 ldr.x.lit x22 L_`401fe000` 17 ldr.x.lit x0 L_`40000000` 18 str.x x0 x22 0 19 ldr.x.lit x0 L_`08000000` 20 str.x x0 x22 1 21 mov.x x0 x20 22 str.x x0 x22 2 23 ldr.x.lit x0 L_`40200000` 24 str.x x0 x22 3 25 movz.x x0 256 0 26 str.x x0 x22 4 27 adr x21 msg_verify 28 bl print_string 29 ldr.x.lit x0 L_`40200000` 30 ldr.x.lit x1 L_`401fe100` 31 ldr.x.lit x2 L_`401fe080` 32 bl sha256_256bytes 33 ldr.x.lit x2 L_`401fe080` 34 adr x3 pinned_digest 35 ldp.x x4 x5 x2 0 36 ldp.x x6 x7 x3 0 37 cmp.x x4 x6 38 b.ne refuse_handoff 39 cmp.x x5 x7 40 b.ne refuse_handoff 41 ldp.x x4 x5 x2 2 42 ldp.x x6 x7 x3 2 43 cmp.x x4 x6 44 b.ne refuse_handoff 45 cmp.x x5 x7 46 b.ne refuse_handoff 47 adr x21 msg_handoff 48 bl print_string 49 mov.x x0 x22 50 movz.x x1 256 0 51 ldr.x.lit x2 L_cookie 52 ldr.x.lit x19 L_`40200000` 53 br x19 54 b quiescent_halt 55 :refuse_handoff 56 adr x21 msg_refuse 57 bl print_string 58 :quiescent_halt 59 wfe 60 b quiescent_halt 61 ; ---- 0x0c4 print_string ---- 62 :print_string 63 ldrb.post w0 x21 1 64 cbz.w w0 print_ret 65 str.w w0 x20 0 66 b print_string 67 :print_ret 68 ret 69 ; ---- 0x0d8 messages ---- 70 :msg_awaken 71 .b 0x41 72 .b 0x54 73 .b 0x4c 74 .b 0x41 75 .b 0x53 76 .b 0x3a 77 .b 0x20 78 .b 0x41 79 .b 0x57 80 .b 0x41 81 .b 0x4b 82 .b 0x45 83 .b 0x4e 84 .b 0x0a 85 .b 0 86 :msg_verify 87 ; "ATLAS: VERIFY\n" 88 .b 0x41 89 .b 0x54 90 .b 0x4c 91 .b 0x41 92 .b 0x53 93 .b 0x3a 94 .b 0x20 95 .b 0x56 96 .b 0x45 97 .b 0x52 98 .b 0x49 99 .b 0x46 100 .b 0x59 101 .b 0x0a 102 .b 0 103 :msg_handoff 104 ; "ATLAS: HANDOFF\n" 105 .b 0x41 106 .b 0x54 107 .b 0x4c 108 .b 0x41 109 .b 0x53 110 .b 0x3a 111 .b 0x20 112 .b 0x48 113 .b 0x41 114 .b 0x4e 115 .b 0x44 116 .b 0x4f 117 .b 0x46 118 .b 0x46 119 .b 0x0a 120 .b 0 121 :msg_refuse 122 ; "ATLAS: REFUSE\n" 123 .b 0x41 124 .b 0x54 125 .b 0x4c 126 .b 0x41 127 .b 0x53 128 .b 0x3a 129 .b 0x20 130 .b 0x52 131 .b 0x45 132 .b 0x46 133 .b 0x55 134 .b 0x53 135 .b 0x45 136 .b 0x0a 137 .b 0 138 ; ---- 0x115: align 8 ---- 139 .b 0 140 .b 0 141 .b 0 142 ; ---- 0x118 pinned digest ---- 143 :pinned_digest 144 .w 0xe1d89bb1 145 .w 0xe0854eba 146 .w 0xccd2be5c 147 .w 0x756c8a2f 148 .w 0xf8c5ecc8 149 .w 0xc0f90b4a 150 .w 0xbd461fb7 151 .w 0xbf98374c 152 ; ---- 0x138 literal pool (.ltorg): each value once, in order of first use ---- 153 :L_`401fc000` 154 .w 0x401fc000 155 .w 0x00000000 ; 0x401FC000 156 :L_`09000000` 157 .w 0x09000000 158 .w 0x00000000 ; 0x09000000 159 :L_`401fe000` 160 .w 0x401fe000 161 .w 0x00000000 ; 0x401FE000 162 :L_`40000000` 163 .w 0x40000000 164 .w 0x00000000 ; 0x40000000 165 :L_`08000000` 166 .w 0x08000000 167 .w 0x00000000 ; 0x08000000 168 :L_`40200000` 169 .w 0x40200000 170 .w 0x00000000 ; 0x40200000 171 :L_`401fe100` 172 .w 0x401fe100 173 .w 0x00000000 ; 0x401FE100 174 :L_`401fe080` 175 .w 0x401fe080 176 .w 0x00000000 ; 0x401FE080 177 :L_cookie 178 .w 0x49435330 179 .w 0x50485953 ; 0x5048595349435330 180 ; ---- 0x180 sha256_transform ---- 181 :sha256_transform 182 stp.x.pre x29 x30 sp -40 ; stp x29, x30, [sp, -320]! 183 sub.x.i x4 x1 4 184 movz.x x1 1 0 185 add.x.i x29 sp 0 186 add.x.i x12 sp 64 187 stp.x x19 x20 sp 2 188 stp.x x21 x22 sp 4 189 stp.x x23 x24 sp 6 190 :T_L2 191 add.x.lsl x3 x12 x1 2 192 ldr.w.r w2 x4 x1 193 add.x.i x1 x1 1 194 rev.w w2 w2 195 stur.w w2 x3 -4 196 cmp.x.i x1 17 197 b.ne T_L2 198 ldr.w w5 sp 16 199 add.x.i x4 sp 68 200 ldp.w w13 w11 sp 25 201 add.x.i x15 sp 260 202 ldp.w w10 w9 sp 27 203 ldp.w w8 w3 sp 29 204 ldr.w w7 sp 31 205 :T_L3 206 add.w w6 w5 w13 207 ldr.w w5 x4 0 208 mov.w w13 w11 209 extr.w w2 w3 w3 19 210 eor.w.ror w2 w2 w3 17 211 mov.w w11 w10 212 eor.w.lsr w2 w2 w3 10 213 extr.w w1 w5 w5 18 214 eor.w.ror w1 w1 w5 7 215 mov.w w10 w9 216 eor.w.lsr w1 w1 w5 3 217 mov.w w9 w8 218 add.w w1 w1 w2 219 mov.w w8 w3 220 add.x.i x4 x4 4 221 mov.w w3 w7 222 add.w w7 w1 w6 223 str.w w7 x4 14 224 cmp.x x4 x15 225 b.ne T_L3 226 ldp.w w20 w19 x0 0 227 adrp x13 0 0 ; K is at 0x4c8, in the same 4 KiB page as this word: page distance 0 228 ldp.w w30 w18 x0 2 229 add.x.i x13 x13 0x4c8 ; :lo12: of K = 0x4c8 230 ldp.w w17 w16 x0 4 231 mov.w w5 w20 232 ldp.w w15 w14 x0 6 233 mov.w w8 w19 234 mov.w w6 w30 235 mov.w w11 w18 236 mov.w w4 w17 237 mov.w w10 w16 238 mov.w w9 w15 239 mov.w w21 w14 240 movz.x x7 1 0 241 b T_L4 242 :T_L5 243 mov.w w9 w10 244 mov.w w6 w8 245 mov.w w10 w4 246 mov.w w8 w5 247 mov.w w4 w3 248 mov.w w5 w2 249 :T_L4 250 ubfm.x x1 x7 62 61 ; lsl x1, x7, 2 251 extr.w w22 w4 w4 6 252 add.x x23 x13 x1 253 add.x x1 x12 x1 254 and.w w3 w4 w10 255 eor.w.ror w22 w22 w4 11 256 bic.w w2 w9 w4 257 eor.w.ror w22 w22 w4 25 258 ldur.w w24 x1 -4 259 eor.w w2 w2 w3 260 ldur.w w23 x23 -4 261 eor.w w3 w8 w6 262 add.w w2 w22 w2 263 extr.w w1 w5 w5 13 264 and.w w3 w3 w5 265 and.w w22 w8 w6 266 eor.w.ror w1 w1 w5 2 267 add.w w23 w23 w24 268 eor.w w3 w3 w22 269 eor.w.ror w1 w1 w5 22 270 add.w w2 w2 w23 271 add.w w1 w1 w3 272 add.w w2 w2 w21 273 add.x.i x7 x7 1 274 add.w w3 w2 w11 275 mov.w w21 w9 276 add.w w2 w2 w1 277 mov.w w11 w6 278 cmp.x.i x7 65 279 b.ne T_L5 280 add.w w20 w20 w2 281 add.w w19 w19 w5 282 add.w w30 w30 w8 283 add.w w18 w18 w6 284 add.w w17 w17 w3 285 add.w w16 w16 w4 286 add.w w15 w15 w10 287 add.w w14 w14 w9 288 stp.w w20 w19 x0 0 289 stp.w w30 w18 x0 2 290 stp.w w17 w16 x0 4 291 stp.w w15 w14 x0 6 292 ldp.x x19 x20 sp 2 293 ldp.x x21 x22 sp 4 294 ldp.x x23 x24 sp 6 295 ldp.x.post x29 x30 sp 40 296 ret 297 nop ; .p2align 4,,11: 0x33c -> 0x340 298 ; ---- 0x340 sha256_compute ---- 299 :sha256_compute 300 stp.x.pre x29 x30 sp -8 301 movz.x x5 58983 0 302 movz.x x4 62322 0 303 add.x.i x29 sp 0 304 stp.x x21 x22 sp 4 305 mov.x x22 x3 306 movz.x x3 21119 0 307 str.x x23 sp 6 308 mov.x x23 x1 309 movz.x x1 55723 0 310 movk.x x5 0x6a09 1 311 movk.x x4 0x3c6e 1 312 movk.x x3 0x510e 1 313 movk.x x1 0x1f83 1 314 movk.x x5 0xae85 2 315 movk.x x4 0xf53a 2 316 movk.x x3 0x688c 2 317 movk.x x1 0xcd19 2 318 stp.x x19 x20 sp 2 319 movk.x x5 0xbb67 3 320 movk.x x4 0xa54f 3 321 movk.x x3 0x9b05 3 322 movk.x x1 0x5be0 3 323 stp.x x5 x4 x22 0 324 mov.x x19 x0 325 stp.x x3 x1 x22 2 326 mov.x x21 x2 327 cmp.x.i x23 63 328 b.ls C_L21 329 sub.x.i x20 x23 64 330 and.x.bm x20 x20 1 58 57 ; and x20, x20, -64: N 1, 58 ones (imms 57) rotated right by 58 331 add.x.i x20 x20 64 332 add.x x20 x0 x20 333 nop ; .p2align 3,,7: 0x3c4 -> 0x3c8 334 :C_L12 335 mov.x x1 x19 336 mov.x x0 x22 337 add.x.i x19 x19 64 338 bl sha256_transform 339 cmp.x x19 x20 340 b.ne C_L12 341 and.x.bm x2 x23 1 0 5 ; and x2, x23, 63: N 1, 6 ones (imms 5), no rotation 342 :C_L11 343 mov.x x0 x21 344 add.x.i x4 x21 128 345 nop ; .p2align 3,,7: 0x3ec -> 0x3f0 346 :C_L13 347 strb.post wzr x0 1 348 cmp.x x0 x4 349 b.ne C_L13 350 cbz.x x2 C_L14 351 movz.x x0 0 0 352 nop ; .p2align 3,,7: 0x404 -> 0x408 353 :C_L15 354 ldrb.r w1 x20 x0 355 strb.r w1 x21 x0 356 add.x.i x0 x0 1 357 cmp.x x0 x2 358 b.ne C_L15 359 movn.w w1 127 0 ; mov w1, -128 360 strb.r w1 x21 x0 361 movz.w w19 2 0 362 movz.w w1 120 0 363 cmp.x.i x0 55 364 b.ls C_L17 365 :C_L18 366 ubfm.x x23 x23 61 60 ; lsl x23, x23, 3 367 add.x.uxtw x1 x21 w1 368 movz.w w0 56 0 369 :C_L19 370 lsrv.x x2 x23 x0 371 sub.w.i w0 w0 8 372 strb.post w2 x1 1 373 cmn.w.i w0 8 374 b.ne C_L19 375 mov.x x0 x22 376 mov.x x1 x21 377 bl sha256_transform 378 cmp.w.i w19 2 379 b.eq C_L29 380 ldp.x x19 x20 sp 2 381 ldp.x x21 x22 sp 4 382 ldr.x x23 sp 6 383 ldp.x.post x29 x30 sp 8 384 ret 385 :C_L14 386 movn.w w0 127 0 ; mov w0, -128 387 strb w0 x21 0 388 :C_L17 389 movz.w w1 56 0 390 movz.w w19 1 0 391 b C_L18 392 :C_L29 393 ldp.x x19 x20 sp 2 394 add.x.i x1 x21 64 395 ldp.x x21 x22 sp 4 396 ldr.x x23 sp 6 397 ldp.x.post x29 x30 sp 8 398 b sha256_transform 399 :C_L21 400 mov.x x20 x0 401 mov.x x2 x23 402 b C_L11 403 ; ---- 0x4b4 sha256_256bytes (.p2align 4,,11 would need 12 bytes, more than 11: no padding) ---- 404 :sha256_256bytes 405 mov.x x3 x2 406 mov.x x2 x1 407 movz.x x1 256 0 408 b sha256_compute 409 ; ---- 0x4c4: 4 zero bytes, then .rodata (align 8) at 0x4c8: K ---- 410 .w 0 411 :K 412 .w 0x428a2f98 413 .w 0x71374491 414 .w 0xb5c0fbcf 415 .w 0xe9b5dba5 416 .w 0x3956c25b 417 .w 0x59f111f1 418 .w 0x923f82a4 419 .w 0xab1c5ed5 420 .w 0xd807aa98 421 .w 0x12835b01 422 .w 0x243185be 423 .w 0x550c7dc3 424 .w 0x72be5d74 425 .w 0x80deb1fe 426 .w 0x9bdc06a7 427 .w 0xc19bf174 428 .w 0xe49b69c1 429 .w 0xefbe4786 430 .w 0x0fc19dc6 431 .w 0x240ca1cc 432 .w 0x2de92c6f 433 .w 0x4a7484aa 434 .w 0x5cb0a9dc 435 .w 0x76f988da 436 .w 0x983e5152 437 .w 0xa831c66d 438 .w 0xb00327c8 439 .w 0xbf597fc7 440 .w 0xc6e00bf3 441 .w 0xd5a79147 442 .w 0x06ca6351 443 .w 0x14292967 444 .w 0x27b70a85 445 .w 0x2e1b2138 446 .w 0x4d2c6dfc 447 .w 0x53380d13 448 .w 0x650a7354 449 .w 0x766a0abb 450 .w 0x81c2c92e 451 .w 0x92722c85 452 .w 0xa2bfe8a1 453 .w 0xa81a664b 454 .w 0xc24b8b70 455 .w 0xc76c51a3 456 .w 0xd192e819 457 .w 0xd6990624 458 .w 0xf40e3585 459 .w 0x106aa070 460 .w 0x19a4c116 461 .w 0x1e376c08 462 .w 0x2748774c 463 .w 0x34b0bcb5 464 .w 0x391c0cb3 465 .w 0x4ed8aa4a 466 .w 0x5b9cca4f 467 .w 0x682e6ff3 468 .w 0x748f82ee 469 .w 0x78a5636f 470 .w 0x84c87814 471 .w 0x8cc70208 472 .w 0x90befffa 473 .w 0xa4506ceb 474 .w 0xbef9a3f7 475 .w 0xc67178f2