atlas
aien-dev/atlas
Brought by drakestapleton
atlas / physics_0.s
| 1 | /* |
| 2 | * PHYSICS-0: Minimal Machine Authority Handoff Stub |
| 3 | * Milestone 1 Target: Verifies PHYSICS_ENTRY_ABI and signals successful authorization. |
| 4 | * Entry Point: 0x40200000 |
| 5 | * Exact Payload Size: 256 bytes (0x100) |
| 6 | */ |
| 7 | |
| 8 | .global _start |
| 9 | .section .text |
| 10 | .balign 256 |
| 11 | |
| 12 | _start: |
| 13 | /* Check Verification Cookie in x2: ASCII 'PHYSICS0' = 0x5048595349435330 */ |
| 14 | ldr x3, =0x5048595349435330 |
| 15 | cmp x2, x3 |
| 16 | b.ne .Lphysics_denied |
| 17 | |
| 18 | /* Check Boot Descriptor pointer in x0 */ |
| 19 | ldr x4, =0x401FE000 |
| 20 | cmp x0, x4 |
| 21 | b.ne .Lphysics_denied |
| 22 | |
| 23 | /* Check Payload Size in x1 (256 bytes) */ |
| 24 | cmp x1, #256 |
| 25 | b.ne .Lphysics_denied |
| 26 | |
| 27 | /* Load UART Base from Boot Descriptor (offset 16) */ |
| 28 | ldr x5, [x0, #16] |
| 29 | |
| 30 | /* Emit "PHYSICS-0: AUTHORIZED\n" */ |
| 31 | adr x6, msg_authorized |
| 32 | .Lemit_auth: |
| 33 | ldrb w7, [x6], #1 |
| 34 | cbz w7, .Lphysics_quiescent |
| 35 | str w7, [x5] |
| 36 | b .Lemit_auth |
| 37 | |
| 38 | .Lphysics_denied: |
| 39 | ldr x5, =0x09000000 |
| 40 | adr x6, msg_denied |
| 41 | .Lemit_denied: |
| 42 | ldrb w7, [x6], #1 |
| 43 | cbz w7, .Lphysics_quiescent |
| 44 | str w7, [x5] |
| 45 | b .Lemit_denied |
| 46 | |
| 47 | .Lphysics_quiescent: |
| 48 | wfe |
| 49 | b .Lphysics_quiescent |
| 50 | |
| 51 | .balign 4 |
| 52 | msg_authorized: |
| 53 | .asciz "PHYSICS-0: AUTHORIZED\n" |
| 54 | msg_denied: |
| 55 | .asciz "PHYSICS-0: DENIED\n" |
| 56 | |
| 57 | .ltorg |
| 58 | |
| 59 | /* Pad exactly to 256 bytes from _start */ |
| 60 | .space 256 - (. - _start), 0 |
| 61 | _end: |