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/atlas/blob/master/atlas.s # atlas aien-dev/atlas Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `atlas / atlas.s` 129 lines ยท 3736 bytes Raw Blame History 1 /* 2 * ATLAS: Irreducible Bootstrap Seed 3 * Canonical Root Artifact: atlas.bin 4 * Formerly designated Alpha (alpha.bin) in early lineage bootstrap drafting. 5 * Machine Contract: CONTRACT-QEMU-VIRT-AARCH64-M1 6 * Cryptographic Integrity Scheme: Standard SHA-256 7 * Pinned Digest: `e1d89bb1e0854ebaccd2be5c756c8a2ff8c5ecc8c0f90b4abd461fb7bf98374c` 8 * Entry Point: 0x00000000 (Flash Base) 9 */ 10 11 .global _start 12 .section .text 13 .balign 64 14 15 _start: 16 /* 1. Mask all interrupts (DAIF: D=1, A=1, I=1, F=1) */ 17 msr daifset, #0xf 18 19 /* 2. Initialize Stack Pointer to Scratchpad RAM (Disjoint from Descriptor @ 0x401FE000) */ 20 ldr x0, =0x401FC000 21 mov sp, x0 22 23 /* 3. Initialize UART MMIO Base Pointer in x20 */ 24 ldr x20, =0x09000000 25 26 /* 4. Emit Diagnostic Checkpoint 1: AWAKEN */ 27 adr x21, msg_awaken 28 bl print_string 29 30 /* 5. Populate Machine Boot Descriptor at 0x401FE000 */ 31 ldr x22, =0x401FE000 32 ldr x0, =0x40000000 33 str x0, [x22, #0] /* +0: RAM Base */ 34 ldr x0, =0x08000000 35 str x0, [x22, #8] /* +8: RAM Size (128 MiB) */ 36 mov x0, x20 37 str x0, [x22, #16] /* +16: UART MMIO Base */ 38 ldr x0, =0x40200000 39 str x0, [x22, #24] /* +24: Physics Payload Base */ 40 mov x0, #256 41 str x0, [x22, #32] /* +32: Physics Payload Size */ 42 43 /* 6. Emit Diagnostic Checkpoint 2: VERIFY */ 44 adr x21, msg_verify 45 bl print_string 46 47 /* 7. Verify PHYSICS-0 Integrity using Cryptographic SHA-256 */ 48 /* sha256_256bytes(payload, scratch_buf, out_digest) */ 49 ldr x0, =0x40200000 /* Arg 0: Payload base */ 50 ldr x1, =0x401FE100 /* Arg 1: 64-byte scratchpad for padding block */ 51 ldr x2, =0x401FE080 /* Arg 2: 32-byte digest output buffer */ 52 bl sha256_256bytes 53 54 /* Compare computed 32-byte SHA-256 against pinned expected digest */ 55 ldr x2, =0x401FE080 56 adr x3, pinned_sha256_digest 57 58 /* Compare 8 x 32-bit words (2 x 64-bit pair loads) */ 59 ldp x4, x5, [x2, #0] 60 ldp x6, x7, [x3, #0] 61 cmp x4, x6 62 b.ne .Lrefuse_handoff 63 cmp x5, x7 64 b.ne .Lrefuse_handoff 65 66 ldp x4, x5, [x2, #16] 67 ldp x6, x7, [x3, #16] 68 cmp x4, x6 69 b.ne .Lrefuse_handoff 70 cmp x5, x7 71 b.ne .Lrefuse_handoff 72 73 /* 8. Emit Diagnostic Checkpoint 3: HANDOFF */ 74 adr x21, msg_handoff 75 bl print_string 76 77 /* 9. Establish PHYSICS_ENTRY_ABI */ 78 mov x0, x22 /* x0 = pointer to Boot Descriptor (0x401FE000) */ 79 mov x1, #256 /* x1 = payload size (256 bytes) */ 80 ldr x2, =0x5048595349435330 /* x2 = verification cookie ('PHYSICS0') */ 81 82 /* Static Target Proof: x19 is explicitly loaded from literal 0x40200000 immediately before branch */ 83 ldr x19, =0x40200000 /* Target: Contract-defined Physics Entry */ 84 85 /* 10. Transfer Control to Physics */ 86 br x19 87 88 /* Terminal fallthrough trap */ 89 b .Lquiescent_halt 90 91 .Lrefuse_handoff: 92 /* Emit Refusal Diagnostic */ 93 adr x21, msg_refuse 94 bl print_string 95 96 .Lquiescent_halt: 97 /* Fail-Closed Quiescence: no external side effects, no fallthrough */ 98 wfe 99 b .Lquiescent_halt 100 101 /* Helper: Polled UART String Output */ 102 print_string: 103 .Lprint_char: 104 ldrb w0, [x21], #1 105 cbz w0, .Lprint_ret 106 str w0, [x20] 107 b .Lprint_char 108 .Lprint_ret: 109 ret 110 111 .balign 8 112 msg_awaken: 113 .asciz "ATLAS: AWAKEN\n" 114 msg_verify: 115 .asciz "ATLAS: VERIFY\n" 116 msg_handoff: 117 .asciz "ATLAS: HANDOFF\n" 118 msg_refuse: 119 .asciz "ATLAS: REFUSE\n" 120 121 .balign 8 122 pinned_sha256_digest: 123 /* `e1d89bb1` `e0854eba` `ccd2be5c` `756c8a2f` `f8c5ecc8` `c0f90b4a` `bd461fb7` `bf98374c` */ 124 .word 0xe1d89bb1, 0xe0854eba, 0xccd2be5c, 0x756c8a2f 125 .word 0xf8c5ecc8, 0xc0f90b4a, 0xbd461fb7, 0xbf98374c 126 127 .ltorg 128 .balign 64 129 code_end: