README.ipl revision 1.1.6.2 1 1.1.6.2 yamt # $NetBSD: README.ipl,v 1.1.6.2 2014/05/22 11:39:51 yamt Exp $
2 1.1.6.2 yamt
3 1.1.6.2 yamt Coding note:
4 1.1.6.2 yamt
5 1.1.6.2 yamt In order to make this relocatable, you must follow following
6 1.1.6.2 yamt restrictions:
7 1.1.6.2 yamt
8 1.1.6.2 yamt 1. Do not place any objects in text segment
9 1.1.6.2 yamt 1.1. For compiler,
10 1.1.6.2 yamt (1) do not declare or define any objects to be placed in
11 1.1.6.2 yamt text segment, that is, do not use ``const'' keyword
12 1.1.6.2 yamt (but declaring a pointer to const is probably OK),
13 1.1.6.2 yamt
14 1.1.6.2 yamt (2) make sure string literals, if any, are placed in data
15 1.1.6.2 yamt segment (use traditional compiler),
16 1.1.6.2 yamt
17 1.1.6.2 yamt (3) avoid initialization of automatic objects (non-static
18 1.1.6.2 yamt function-local variables) of aggregate types (arrays,
19 1.1.6.2 yamt structs and unions), which may implicitly emits
20 1.1.6.2 yamt constant data.
21 1.1.6.2 yamt
22 1.1.6.2 yamt In summary, do not use ANSI extension. Use traditional C. :-)
23 1.1.6.2 yamt
24 1.1.6.2 yamt 1.2. For linker, do not actually place objects in text segment.
25 1.1.6.2 yamt
26 1.1.6.2 yamt 2. Do not use function pointers.
27 1.1.6.2 yamt
28 1.1.6.2 yamt
29 1.1.6.2 yamt On-disk layout:
30 1.1.6.2 yamt
31 1.1.6.2 yamt We have 6.5KB for the primary boot.
32 1.1.6.2 yamt
33 1.1.6.2 yamt disk address
34 1.1.6.2 yamt start size
35 1.1.6.2 yamt 000000 0000FC LIF header
36 1.1.6.2 yamt 0000FC 000104 unused
37 1.1.6.2 yamt 000200 000194 disklabel (404 bytes for 16-partition label)
38 1.1.6.2 yamt 000394 00006C unused
39 1.1.6.2 yamt 000400 000400 ipl part 2 (1KB)
40 1.1.6.2 yamt 000800 000100 optional LIF directory
41 1.1.6.2 yamt 000900 000100 unused
42 1.1.6.2 yamt 000A00 000600 ipl part 3 (1.5KB)
43 1.1.6.2 yamt 001000 001000 ipl part 1 (4KB)
44 1.1.6.2 yamt 002000 (file system starts here)
45 1.1.6.2 yamt
46 1.1.6.2 yamt
47 1.1.6.2 yamt On-memory layout on IPL startup:
48 1.1.6.2 yamt
49 1.1.6.2 yamt The firmware loads ipl part 1 on the memory, and executes it.
50 1.1.6.2 yamt
51 1.1.6.2 yamt address offset
52 1.1.6.2 yamt start size
53 1.1.6.2 yamt 000000 001000 ipl part 1
54 1.1.6.2 yamt 001000 000A00 (not loaded yet)
55 1.1.6.2 yamt (bss section etc)
56 1.1.6.2 yamt x 001000 temporary disk buffer
57 1.1.6.2 yamt x+1000 stack
58 1.1.6.2 yamt
59 1.1.6.2 yamt
60 1.1.6.2 yamt Then the IPL will load the rest of itself:
61 1.1.6.2 yamt
62 1.1.6.2 yamt ipl part 1 loads parts 2 and 3, then continues execution.
63 1.1.6.2 yamt
64 1.1.6.2 yamt address offset
65 1.1.6.2 yamt start size
66 1.1.6.2 yamt 000000 001000 ipl part 1
67 1.1.6.2 yamt 001000 000400 ipl part 2
68 1.1.6.2 yamt 001400 000600 ipl part 3
69 1.1.6.2 yamt 001A00 xxxxxx (bss section etc)
70