summaryrefslogtreecommitdiff
path: root/microkernel/mach/gnumach/boot_trace.mdwn
blob: ea999a9b8a287f63bf4b66d2dd3c47cb02e4c0a8 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
[[!meta copyright="Copyright © 2007, 2008, 2011, 2013 Free Software Foundation,
Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

`if NCPUS > 1` stuff is not being considered so far.


> i386/i386at/boothdr.S: \_start

> i386/i386at/boothdr.S: boot\_entry

>> i386/i386at/model\_dep.c: c\_boot\_entry

>>> i386/i386at/boothdr.S: discover\_x86\_cpu\_type

>>> i386/i386at/model\_dep.c: i386at\_init

>>>> i386/i386/pic.c: picinit

>>>> i386/i386at/model\_dep.c: mem\_size\_init

>>>> i386/intel/pmap.c: pmap\_bootstrap

>>>> i386/i386/gdt.c: gdt\_init

>>>> i386/i386/idt.c: idt\_init

>>>> i386/i386at/int\_init.c: int\_init

>>>> i386/i386/ldt.c: ldt\_init

>>>> i386/i386/ktss.c: ktss\_init

>>> kern/startup.c: setup\_main

>>>> kern/debug.c: panic\_init

>>>> kern/printf.c: printf\_init

>>>> kern/sched\_prim.c: sched\_init

>>>>> kern/sched\_prim.c: wait\_queue\_init

>>>>> kern/processor.c: pset\_sys\_bootstrap

>>>>> kern/ast.c: ast\_init

>>>> vm/vm\_init.c: vm\_mem\_bootstrap

>>>>> vm/vm\_resident.c: vm\_page\_bootstrap

>>>>>> vm/vm\_resident.c: pmap\_startup

>>>>> kern/zalloc.c: zone\_bootstrap

>>>>> vm/vm\_object.c: vm\_object\_bootstrap

>>>>>> vm/vm\_external.c: vm\_external\_module\_initialize

>>>>> vm/vm\_map.c: vm\_map\_init

>>>>> vm/vm\_kern.c: kmem\_init

>>>>> i386/intel/pmap.c: pmap\_init

>>>>> kern/zalloc.c: zone\_init

>>>>> kern/kalloc.c: kalloc\_init

>>>>> vm/vm\_fault.c: vm\_fault\_init

>>>>> vm/vm\_resident.c: vm\_page\_module\_init

>>>>> vm/memory\_object.c: memory\_manager\_default\_init

>>>> ipc/ipc\_init.c: ipc\_bootstrap

>>>>> ipc/ipc\_table.c: ipc\_table\_init

>>>>> ipc/ipc\_notify.c: ipc\_notify\_init

>>>>> ipc/ipc\_hash.c: ipc\_hash\_init

>>>>> ipc/ipc\_marequest.c: ipc\_marequest\_init

>>>> vm/vm\_init.c: vm\_mem\_init

>>>>> vm/vm\_object.c: vm\_object\_init

>>>> ipc/ipc\_init.c: ipc\_init

>>>>> kern/ipc\_host.c: ipc\_host\_init

>>>>>> kern/ipc\_host.c: ipc\_pset\_init

>>>>>> kern/ipc\_host.c: ipc\_pset\_enable

>>>>>> kern/ipc\_host.c: ipc\_processor\_init

>>>> i386/intel/pmap.h: PMAP\_ACTIVATE\_KERNEL

>>>> kern/timer.c: init\_timers

>>>> kern/mach\_clock.c: init\_timeout

>>>> kern/xpr.c: xprbootstrap

>>>> kern/time\_stamp.c: timestamp\_init

>>>> kern/mach\_clock.c: [[mapable\_time\_init|interface/device/time]]

>>>> i386/i386at/model\_dep.c: machine\_init

>>>>> device/cons.c: cninit

>>>>> i386/i386/fpu.c: init\_fpu

>>>>> linux/dev/init/main.c: linux\_init

>>>>>> linux/dev/arch/i386/kernel/irq.c: init\_IRQ

>>>>>>> linux/dev/arch/i386/kernel/irq.c: reserve\_mach\_irqs

>>>>>> linux/dev/kernel/sched.c: linux\_sched\_init

>>>>>> linux/dev/init/main.c: calibrate\_delay

>>>>>> linux/dev/glue/kmem.c: linux\_kmem\_init

>>>>>> linux/src/drivers/pci/pci.c: pci\_init

>>>>>>> linux/src/arch/i386/kernel/bios32.c: pcibios\_init

>>>>>>> linux/src/drivers/pci/pci.c: scan\_bus

>>>>>>> linux/src/arch/i386/kernel/bios32.c: pcibios\_fixup

>>>>>> linux/dev/glue/net.c: linux\_net\_emulation\_init

>>>>>> linux/dev/drivers/block/genhd.c: device\_setup

>>>>>>> linux/dev/glue/block.c: blk\_dev\_init

>>>>>>>> linux/src/drivers/block/ide.c: ide\_init

>>>>>>>> linux/dev/drivers/block/floppy.c: floppy\_init

>>>>>>> linux/src/drivers/scsi/scsi.c: scsi\_dev\_init

>>>>>>> linux/dev/net/core/dev.c: net\_dev\_init

>>>>>> linux/pcmcia-cs/glue/pcmcia.c: pcmcia\_init

>>>>> i386/i386at/autoconf.c: probeio

>>>>> i386/i386at/model\_dep.c: inittodr

>>>>> i386/intel/pmap.c: pmap\_unmap\_page\_zero

>>>> kern/task.c: task\_init

>>>>> kern/syscall\_emulation.c: eml\_init

>>>> kern/thread.c: thread\_init

>>>>> i386/i386/pcb.c: pcb\_module\_init

>>>>>> i386/i386/fpu.c: fpu\_module\_init

>>>>>> i386/i386/iopb.c: iopb\_init

>>>> kern/thread\_swap.c: swapper\_init

>>>> kern/sched\_prim.c: recompute\_priorities

>>>> kern/mach\_factor.c: compute\_mach\_factor

>>>> kern/startup.c: start\_kernel\_threads

[...]

>>>> kern/startup.c: cpu\_launch\_first\_thread

>>>>> i386/i386at/model\_dep.c: startrtclock

>>>>>> i386/i386/pit.c: clkstart

>>>>> i386/intel/pmap.h: PMAP\_ACTIVATE\_KERNEL

>>>>> i386/i386/pcb.c: load\_context

[...]

> kern/startup.c: start\_kernel\_threads

> Threads get created.

>> kern/sched\_prim.c: idle\_thread

>> One for each CPU.

>> kern/thread.c: reaper\_thread 

>> kern/thread\_swap.c: swapin\_thread

>> kern/sched\_prim.c: sched\_thread

>> [...]

>> kern/bootstrap.c: bootstrap\_create

>>> The [[grub/multiboot]] modules have been put somewhere into memory by
>>> [[GRUB]].  The boot scripts are parsed.  The modules' ELF image's `PT_LOAD`
>>> sections are \`\`read'' (that is, `vm_allocate` and `copyout`) and turned
>>> into real [[task]]s.  The multiboot modules' memory regions can be
>>> deallocated then.

>> [...]

>> vm\_pageout

>> Does not return.


# IRC, freenode, #hurd, 2013-10-07

    <cureOS> look, where should i dig or where from should i start from, if i
      have desire to know how the kernel was written from baremetal? Can it be
      ever done nowadays?
    <youpi> cureOS: the boot entry of the kernel is i386/i386at/boothdr.S ,
      boot_entry
    <youpi> that's what grub jumps to
    <youpi> then that jumps to c_boot_entry
    <youpi> and everything else is C
    <cureOS> grub loads it somehow. how does it prepare cpu and memoty, cpu
      cache control if any... segments for stack..
    <youpi> see the grub documentation
    <youpi> basically it's all flat linear space
    <cureOS> does kernel transform it after that?
    <youpi> see the ldt/gdt initialization
    <youpi> from i386at_init and children
    <youpi> nothing much fancy, a kernel cs/ds, and user cs/ds
    <braunr> and paging, naturally
    <youpi> sure