interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / helix / strand3_trickster / seedC0.c0

132 lines · 4983 bytes Raw Blame History
1% seedC0.c0 -- Rung C0 of Strand 3 ("The Trickster" -- Adversarial Chaos Strand).
2% 3rd completely independent hand-written AArch64 W^X seed (404 bytes), zero shared grammar or layout
3% with Strand A (seed0.hex, 0x400000, '#' comments, 32-bit LE words, RWX) or
4% Strand B (seedB0.b0, 0x500000, ';' comments, byte pairs, x10..x14).
5%
6% Grammar: '%' starts a comment to end of line. Every two hex digits emit one raw byte to stdout.
7% Whitespace (space, tab, CR, LF) and ':' separators are ignored.
8% Bad char -> exit 11. Odd trailing nibble -> exit 12. Read error -> exit 13. Write error -> exit 14.
9% Memory model: pure W^X (p_flags = PF_R|PF_X = 5, p_vaddr = 0x600000, p_memsz == p_filesz = 404).
10% Distinct register allocation: x19=acc, x20=nibbles, x21=in_comment, x22=sp_buf, x23=10.
11% Encodings verified against Arm Architecture Reference Manual DDI 0487.
12
13% ---- ELF-64 file header (64 bytes, 0x00..0x3f) ----
147f:45:4c:46:02:01:01:00 % e_ident[0..7]
1500:00:00:00:00:00:00:00 % e_ident[8..15]
1602:00:b7:00:01:00:00:00 % ET_EXEC, EM_AARCH64, version 1
1778:00:60:00:00:00:00:00 % e_entry = 0x600078
1840:00:00:00:00:00:00:00 % e_phoff = 64
1900:00:00:00:00:00:00:00 % e_shoff = 0
2000:00:00:00:40:00:38:00 % e_flags=0, ehsize=64, phentsize=56
2101:00:00:00:00:00:00:00 % phnum=1
22
23% ---- ELF-64 program header (56 bytes, 0x40..0x77) ----
2401:00:00:00:05:00:00:00 % PT_LOAD, PF_R|PF_X = 5 (pure W^X!)
2500:00:00:00:00:00:00:00 % p_offset = 0
2600:00:60:00:00:00:00:00 % p_vaddr = 0x600000
2700:00:60:00:00:00:00:00 % p_paddr = 0x600000
2894:01:00:00:00:00:00:00 % p_filesz = 404 (0x194 = 120 header + 71*4 code)
2994:01:00:00:00:00:00:00 % p_memsz = 404 (zero BSS)
3000:10:00:00:00:00:00:00 % p_align = 4096
31
32% ---- AArch64 code (71 instructions, 284 bytes, 0x600078..0x600193) ----
33% Registers: x19=acc, x20=nibble_cnt, x21=in_comment, x22=sp_buf, x23=10
34ff:43:00:d1 % [0] sub sp, sp, #16
35f6:03:00:91 % [1] mov x22, sp
3613:00:80:d2 % [2] movz x19, #0
3714:00:80:d2 % [3] movz x20, #0
3815:00:80:d2 % [4] movz x21, #0
3957:01:80:d2 % [5] movz x23, #10
40
41% loop [6]: SYS_read(0, x22, 1)
4200:00:80:d2 % [6] movz x0, #0
43e1:03:16:aa % [7] mov x1, x22 (orr x1, xzr, x22)
4422:00:80:d2 % [8] movz x2, #1
45e8:07:80:d2 % [9] movz x8, #63
4601:00:00:d4 % [10] svc #0
471f:00:00:f1 % [11] subs xzr, x0, #0
4840:06:00:54 % [12] b.eq +50 -> [62] eof
49ab:06:00:54 % [13] b.lt +53 -> [66] err_read
50c0:02:40:39 % [14] ldrb w0, [x22]
51b5:00:00:b4 % [15] cbz x21, +5 -> [20]
52
53% inside '%' comment [16..19]
541f:28:00:71 % [16] subs wzr, w0, #10 ('\n')
55a1:fe:ff:54 % [17] b.ne -11 -> [6]
5615:00:80:d2 % [18] movz x21, #0
57f3:ff:ff:17 % [19] b -13 -> [6]
58
59% not in comment [20..23]: check '%' (37 = 0x25)
601f:94:00:71 % [20] subs wzr, w0, #37 ('%')
6161:00:00:54 % [21] b.ne +3 -> [24]
6235:00:80:d2 % [22] movz x21, #1
63ef:ff:ff:17 % [23] b -17 -> [6]
64
65% digits '0'..'9' [24..26]
6601:c0:00:71 % [24] subs w1, w0, #48
673f:28:00:71 % [25] subs wzr, w1, #10
6883:02:00:54 % [26] b.lo +20 -> [46] got_nib
69
70% lowercase 'a'..'f' [27..29]
7101:84:01:71 % [27] subs w1, w0, #97
723f:18:00:71 % [28] subs wzr, w1, #6
7303:02:00:54 % [29] b.lo +16 -> [45] got_hex
74
75% uppercase 'A'..'F' [30..32]
7601:04:01:71 % [30] subs w1, w0, #65
773f:18:00:71 % [31] subs wzr, w1, #6
78a3:01:00:54 % [32] b.lo +13 -> [45] got_hex
79
80% separators: ':' (58), space (32), LF (10), TAB (9), CR (13) [33..42]
811f:e8:00:71 % [33] subs wzr, w0, #58 (':')
8280:fc:ff:54 % [34] b.eq -28 -> [6]
831f:80:00:71 % [35] subs wzr, w0, #32 (' ')
8440:fc:ff:54 % [36] b.eq -30 -> [6]
851f:28:00:71 % [37] subs wzr, w0, #10 ('\n')
8600:fc:ff:54 % [38] b.eq -32 -> [6]
871f:24:00:71 % [39] subs wzr, w0, #9 ('\t')
88c0:fb:ff:54 % [40] b.eq -34 -> [6]
891f:34:00:71 % [41] subs wzr, w0, #13 ('\r')
9080:fb:ff:54 % [42] b.eq -36 -> [6]
91
92% invalid char -> exit 11 [43..44]
9360:01:80:d2 % [43] movz x0, #11
9419:00:00:14 % [44] b +25 -> [69] do_exit
95
96% accumulate nibble [45..50]
9721:00:17:0b % [45] add w1, w1, w23 (+10)
9873:6e:1c:53 % [46] lsl w19, w19, #4
9973:02:01:2a % [47] orr w19, w19, w1
10094:06:00:91 % [48] add x20, x20, #1
1019f:0a:00:f1 % [49] subs xzr, x20, #2
10281:fa:ff:54 % [50] b.ne -44 -> [6]
103
104% emit byte [51..61]
105d3:02:00:39 % [51] strb w19, [x22]
10620:00:80:d2 % [52] movz x0, #1
107e1:03:16:aa % [53] mov x1, x22
10822:00:80:d2 % [54] movz x2, #1
10908:08:80:d2 % [55] movz x8, #64 (SYS_write)
11001:00:00:d4 % [56] svc #0
1111f:04:00:f1 % [57] subs xzr, x0, #1
11241:01:00:54 % [58] b.ne +10 -> [68] err_write
11313:00:80:d2 % [59] movz x19, #0
11414:00:80:d2 % [60] movz x20, #0
115c9:ff:ff:17 % [61] b -55 -> [6]
116
117% eof [62..65]
11800:00:80:d2 % [62] movz x0, #0
119d4:00:00:b4 % [63] cbz x20, +6 -> [69] do_exit
12080:01:80:d2 % [64] movz x0, #12 (odd nibble)
12104:00:00:14 % [65] b +4 -> [69] do_exit
122
123% err_read [66..67]
124a0:01:80:d2 % [66] movz x0, #13
12502:00:00:14 % [67] b +2 -> [69] do_exit
126
127% err_write [68]
128c0:01:80:d2 % [68] movz x0, #14
129
130% do_exit [69..70]
131a8:0b:80:d2 % [69] movz x8, #93 (SYS_exit)
13201:00:00:d4 % [70] svc #0