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