Factor out the kernel loading function. Add kernel_min, kernel_max addresses.
[virt-mem.git] / HACKING
1 Source files
2 ------------
3
4 We build all the tools into a single virt-mem executable, in order to
5 share the most runtime.  Almost all the code between individual tools
6 is shared anyway.
7
8 lib/
9
10  - The common core of all the tools.  Library, kernel symbols, command
11    line handling, memory images, etc.
12
13    lib/virt_mem.ml contains most of the important 'glue' code.
14
15 uname/
16 dmesg/
17   etc.
18
19  - The code specific to each tool.  This is usually rather small because
20    the code in lib/ does the hard work.
21
22 mem/
23
24  - This brings everything together and links it into a single executable.
25    Other than that purpose, there is almost nothing in this directory.
26
27 General structure of lib/virt_mem.ml
28 ------------------------------------
29
30 We start with a bare kernel memory image ('Virt_mem_types.image0')
31 which gets successively enhanced with extra data along the way:
32
33         Parse command line arguments,
34         work out what virtual machines to
35         process, load kernel images
36
37                 |
38                 |       (passes a 'Virt_mem_types.image0')
39                 V
40
41         Find kernel symbols
42
43                 |
44                 |       (enhanced into a 'Virt_mem_types.image1')
45                 V
46
47         Find kernel version (uname)
48
49                 |
50                 |       (enhanced into a 'Virt_mem_types.image2')
51                 V
52
53         Call tool's "run" function.
54
55 Tools can register other callbacks which get called at earlier stages.