blob: d188bd9ad272addddbd0197f2ab0507728b1fa4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# Solid Pill Boot Flow (C Vere)
## Investigation Summary
Tracked the solid pill boot flow through C Vere to understand how `-B solid.pill` works.
## Call Chain
```
1. king.c:_boothack_doom()
↓ Creates boot command: [%boot bot pill_spec path]
2. king.c:_king_doom()
↓ Routes to _king_fake() for fake ships
3. king.c:_king_fake()
↓ Creates message: [%boot pill vent props]
↓ Calls u3_lord_boot() with jammed message
4. lord.c:u3_lord_boot()
↓ Spawns worker process with "boot" protocol
↓ Jams and sends boot message to worker
5. main.c:_cw_boot()
↓ Worker process receives boot message
↓ Sets up u3_mars_boot as message handler
6. mars.c:u3_mars_boot()
↓ Cues the boot message
↓ Calls _mars_boot_make() to prepare events
7. mars.c:_mars_boot_make()
↓ Calls _mars_sift_pill() to parse pill
↓ Builds timestamped event list
↓ Writes events to disk
8. mars.c:_mars_sift_pill() <-- KEY FUNCTION
↓ Parses pill structure
9. mars.c:_mars_do_boot()
↓ Reads events from disk
↓ Calls u3v_boot(eve)
10. vortex.c:u3v_boot()
↓ Calls u3v_life(eve)
11. vortex.c:u3v_life()
↓ Runs lifecycle formula [2 [0 3] [0 2]]
```
## Pill Structure
### Ivory Pill
```
[%ivory core]
```
- Tag: %ivory
- Content: The compiled kernel core directly
### Solid Pill
```
[%pill %solid bot mod use]
```
Which expands to:
```
[%pill [%solid [bot [mod [use nil]]]]]
```
From `mars.c:1629`:
```c
if ( c3n == u3r_qual(dat, &typ, bot, mod, use) ) {
```
Where `dat` is the second element after %pill tag, containing `[%solid bot mod use]`.
## Event List Construction
From `mars.c:1832-1866`, the event list is built as:
1. **Bot events** (3 events): NO timestamp, bare events
2. **Mod events** (0 in pill + 4 synthesized): WITH timestamps
- Synthesized events added at lines 1758-1774:
- `wack`: entropy (16 random words)
- `whom`: ship identity
- `verb`: verbose flag
- Version negotiation card
3. **Use events** (3-5 depending on pill): WITH timestamps
The final structure passed to `u3v_boot(eve)`:
```
[bare_bot_1 bare_bot_2 bare_bot_3 [ts mod_1] [ts mod_2] ... [ts use_1] ...]
```
A MIXED list: some bare events, some timestamped pairs!
## Key Findings
1. **Ivory rejection**: `_mars_sift_pill` line 1608-1611 REJECTS ivory pills:
```c
if ( c3y == u3r_sing_c("ivory", tag) ) {
fprintf(stderr, "boot: failed: unable to boot from ivory pill\r\n");
return c3n;
}
```
2. **Pill tag value**: `c3__pill` = 0x6c6c6970 = 1819044208 (NOT 1819633778!)
3. **u3v_life formula**: `[2 [0 3] [0 2]]` is applied to the ENTIRE event list
- Works on the full mixed list (bot + mod + use)
- NOT just bot events!
4. **My solid.pill has**:
- Bot: 3 events (bare)
- Mod: 0 events (empty list in pill)
- Use: 5 events
- Total: 8 events
- But C Vere adds 4 synthetic mod events → 12 total
## Current Problem
The lifecycle formula `[2 [0 3] [0 2]]` is failing on my 8-event list with `Nock.Exit`.
This formula means:
- `[0 2]`: get slot 2 (head) = first event/formula
- `[0 3]`: get slot 3 (tail) = rest of events
- `[2 formula subject]`: nock(subject formula)
So it's trying to: `nock(rest-of-events first-event)`
The first event should be a FORMULA (executable code), but my bot events might just be data!
## Next Steps
Need to understand what the bot events actually contain - are they formulas or data?
|