about summary refs log tree commit diff stats
path: root/subx/012elf.cc
Commit message (Collapse)AuthorAgeFilesLines
* 4761Kartik Agaram2018-11-231-4/+4
| | | | | Bugfix: I forgot about ELF segment offsets when implementing VMAs. Eventually segments grew large enough that I started seeing overlaps.
* 4723Kartik Agaram2018-10-241-0/+9
| | | | Fix CI.
* 4720Kartik Agaram2018-10-241-2/+2
| | | | Raise an error when we fall off the end of the code segment.
* 4661Kartik Agaram2018-10-041-12/+10
| | | | | Make segment management a little more consistent between initial segments and add-on segments (using `mmap`).
* 4632Kartik Agaram2018-10-011-3/+10
| | | | Detect overlapping segments when loading ELF binaries.
* 4614 - redo simulated RAMKartik Agaram2018-09-291-19/+20
| | | | | | | | | | | Now simulated 'Memory' isn't just a single flat array. Instead it knows about segments and VMAs. The code segment will always be first, and the data/heap segment will always be second. The brk() syscall knows about the data segment. One nice side-effect is that I no longer need to mess with Memory initialization regardless of where I place my segments.
* 4565Kartik Agaram2018-09-211-2/+3
|
* 4537Kartik Agaram2018-09-071-1/+0
| | | | | | | | | | | | | | | Streamline the factorial function; we don't need to save a stack variable into a register before operating on it. All instructions can take a stack variable directly. In the process we found two bugs: a) Opcode f7 was not implemented correctly. It was internally consistent but I'd never validated it against a natively running program. Turns out it encodes multiple instructions, not just 'not'. b) The way we look up imm32 operands was sometimes reading them before disp8/disp32 operands.
* 4528 - commandline arguments working nativelyKartik Agaram2018-08-311-14/+5
| | | | | | | | | | | | | | Turns out I had totally the wrong idea. The stack at the start of the program doesn't contain 2 words, one for argc and a second for argv that must then be dereferenced to get to its contents (each a pointer to a string). It contains a word for argc, one for argv[0], another for argv[1], and so on. Many thanks to Jeremiah Orians and the #bootstrappable channel on freenode for showing me https://github.com/oriansj/mescc-tools/blob/master/test/test5/exec_enable_amd64.M1 which set me straight. I could just pop the args like that example does, but it seems slightly more elegant, given the current calling convention, to assume the imaginary caller handles the popping.
* 4527 - reading commandline argumentsKartik Agaram2018-08-301-4/+36
| | | | | | | | | | | The new example ex9 doesn't yet work natively. In the process I've emulated the kernel's role in providing args, implemented a couple of instructions acting on 8-bit operands (useful for ASCII string operations), and begun the start of the standard library (ascii_length is the same as strlen). At the level of SubX we're just only going to support ASCII.
* 4519Kartik Agaram2018-08-131-5/+5
|
* 4469Kartik Agaram2018-08-031-0/+143
>^
107fdd35 ^




b9119b43 ^

107fdd35 ^
2490f5b4 ^
107fdd35 ^

92837ec1 ^
107fdd35 ^


447d2358 ^
21ab1821 ^
107fdd35 ^

0d15c710 ^

6a9e1930 ^
9aa282f6 ^

0d15c710 ^






2451b7b1 ^




















0d15c710 ^
d782b007 ^


0fbaa6f5 ^
d782b007 ^
fa89e2aa ^
0d15c710 ^
fa89e2aa ^

0d15c710 ^
264fc55a ^
0c1092fd ^

1809064d ^

0c1092fd ^
3ceb9b0d ^
fa89e2aa ^
7e4b1b1d ^
0fbaa6f5 ^

fa89e2aa ^

0fbaa6f5 ^

fa89e2aa ^
264fc55a ^

d782b007 ^
0fbaa6f5 ^
3ceb9b0d ^



0fbaa6f5 ^


d782b007 ^


0fbaa6f5 ^
7f7973f9 ^
2655d9e8 ^
0c1092fd ^

1809064d ^
0fbaa6f5 ^

0c1092fd ^

13ee16de ^
0fbaa6f5 ^


















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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158