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