atlas
aien-dev/atlas
Brought by drakestapleton
atlas / atlas.control-flow
| 1 | # ATLAS CONTROL FLOW GRAPH (CFG) |
| 2 | ## Target Profile: CONTRACT-QEMU-VIRT-AARCH64-M1 (Cryptographic SHA-256 + Disjoint Stack) |
| 3 | *Formerly designated Alpha in early bootstrap drafting.* |
| 4 | |
| 5 | ```text |
| 6 | [Entry: 0x00000000 (_start)] |
| 7 | │ |
| 8 | ├─> Mask DAIF interrupts (msr daifset, #0xf) |
| 9 | ├─> Set SP = 0x401FC000 (Scratchpad stack, disjoint from descriptor by 8 KiB gap) |
| 10 | ├─> Set UART Base = 0x09000000 (x20) |
| 11 | ├─> Call print_string(msg_awaken) ──> [print_string] ──> [Return] |
| 12 | ├─> Populate Boot Descriptor at 0x401FE000 (x22) |
| 13 | ├─> Call print_string(msg_verify) ──> [print_string] ──> [Return] |
| 14 | │ |
| 15 | ▼ |
| 16 | [Cryptographic Verification: sha256_256bytes] |
| 17 | │ |
| 18 | ├─> Arg 0: x0 = 0x40200000 (Physics payload base) |
| 19 | ├─> Arg 1: x1 = 0x401FE100 (Padding & block scratch buffer) |
| 20 | ├─> Arg 2: x2 = 0x401FE080 (32-byte digest output buffer) |
| 21 | ├─> bl sha256_256bytes (NIST FIPS 180-4 pure AArch64 software implementation) |
| 22 | │ |
| 23 | ▼ |
| 24 | [Compare Digest: 32-Byte Constant-Time Check] |
| 25 | │ |
| 26 | ├─> Compare 8 x 32-bit words against pinned digest (e1d89bb1...374c) |
| 27 | │ |
| 28 | ├── [ANY MISMATCH: b.ne] ─────────────────┐ |
| 29 | │ │ |
| 30 | ▼ [EXACT MATCH] ▼ [.Lrefuse_handoff] |
| 31 | [Emit Handoff Checkpoint] │ |
| 32 | │ ├─> Call print_string(msg_refuse) |
| 33 | ├─> Call print_string(msg_handoff) │ |
| 34 | │ ▼ |
| 35 | ▼ [.Lquiescent_halt] <──────┐ |
| 36 | [Setup PHYSICS_ENTRY_ABI] │ │ |
| 37 | │ ├─> wfe │ (Quiescent halt) |
| 38 | ├─> mov x0, 0x401FE000 (Descriptor) └─> b .Lquiescent_halt ─┘ |
| 39 | ├─> mov x1, 256 (Payload size) |
| 40 | ├─> ldr x2, =0x5048595349435330 ('PHYSICS0' cookie) |
| 41 | ├─> ldr x19, =0x40200000 (Static Target Proof: literal loaded directly into x19) |
| 42 | │ |
| 43 | ▼ |
| 44 | [Handoff to Physics] |
| 45 | │ |
| 46 | ├─> br x19 (Branch to target-proven address 0x40200000) |
| 47 | │ |
| 48 | ▼ [UNREACHABLE FALLTHROUGH TRAP] |
| 49 | └─> b .Lquiescent_halt |
| 50 | |
| 51 | [Subroutine: print_string] |
| 52 | │ |
| 53 | ├─> .Lprint_char: ldrb w0, [x21], #1 |
| 54 | ├─> cbz w0, .Lprint_ret |
| 55 | ├─> str w0, [x20] (UART MMIO Polled Write) |
| 56 | ├─> b .Lprint_char |
| 57 | └─> .Lprint_ret: ret |
| 58 | ``` |