Proof of concept code I developed that we briefly deployed, but has
[linux-2.6.git] / arch / xen / kernel / vmlinux.lds.S
1 /* ld script to make i386 Linux kernel
2  * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3  */
4
5
6 #include <asm-generic/vmlinux.lds.h>
7 #include <asm/thread_info.h>
8 #include <asm/page.h>
9         
10
11 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
12 OUTPUT_ARCH(i386)
13 #ifdef ALK_KEXEC        
14 #define LOAD_OFFSET __PAGE_OFFSET
15 #define KERN_PHYS_OFFSET (CONFIG_KERN_PHYS_OFFSET * 0x100000)
16 ENTRY(phys_startup_32)
17 jiffies = jiffies_64;
18 SECTIONS
19 {
20   . = LOAD_OFFSET + KERN_PHYS_OFFSET;
21   phys_startup_32 = startup_32 - LOAD_OFFSET;
22   /* read-only */
23   _text = .;                    /* Text and read-only data */
24   .text : AT(ADDR(.text) - LOAD_OFFSET) {
25         *(.text)
26         SCHED_TEXT
27         LOCK_TEXT
28         *(.fixup)
29         *(.gnu.warning)
30         } = 0x9090
31
32   _etext = .;                   /* End of text section */
33
34   . = ALIGN(16);                /* Exception table */
35   __start___ex_table = .;
36   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
37   __stop___ex_table = .;
38
39   RODATA
40
41   /* writeable */
42   .data : AT(ADDR(.data) - LOAD_OFFSET) {                       /* Data */
43         *(.data)
44         CONSTRUCTORS
45         }
46
47   . = ALIGN(4096);
48   __nosave_begin = .;
49   .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
50   . = ALIGN(4096);
51   __nosave_end = .;
52
53   . = ALIGN(4096);
54   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { *(.data.idt) }
55
56   . = ALIGN(32);
57   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
58         *(.data.cacheline_aligned)
59   }
60
61   _edata = .;                   /* End of data section */
62
63   . = ALIGN(THREAD_SIZE);       /* init_task */
64   .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { *(.data.init_task) }
65
66   /* will be freed after init */
67   . = ALIGN(4096);              /* Init code and data */
68   __init_begin = .;
69   .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
70         _sinittext = .;
71         *(.init.text)
72         _einittext = .;
73   }
74   .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
75   . = ALIGN(16);
76   __setup_start = .;
77   .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
78   __setup_end = .;
79   __initcall_start = .;
80   .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
81         *(.initcall1.init) 
82         *(.initcall2.init) 
83         *(.initcall3.init) 
84         *(.initcall4.init) 
85         *(.initcall5.init) 
86         *(.initcall6.init) 
87         *(.initcall7.init)
88   }
89   __initcall_end = .;
90   __con_initcall_start = .;
91   .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
92         *(.con_initcall.init)
93   }
94   __con_initcall_end = .;
95   SECURITY_INIT
96   . = ALIGN(4);
97   __alt_instructions = .;
98   .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
99         *(.altinstructions)
100   }
101   __alt_instructions_end = .;
102  .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
103         *(.altinstr_replacement)
104  }
105   /* .exit.text is discard at runtime, not link time, to deal with references
106      from .altinstructions and .eh_frame */
107   .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
108   .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
109   . = ALIGN(4096);
110   __initramfs_start = .;
111   .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
112   __initramfs_end = .;
113   . = ALIGN(32);
114   __per_cpu_start = .;
115   .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
116   __per_cpu_end = .;
117   . = ALIGN(4096);
118   __init_end = .;
119   /* freed after init ends here */
120         
121   __bss_start = .;              /* BSS */
122   .bss.page_aligned  : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) {
123         *(.bss.page_aligned) }
124   .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
125         *(.bss)
126   }
127   . = ALIGN(4);
128   __bss_stop = .; 
129
130   _end = . ;
131
132   /* This is where the kernel creates the early boot page tables */
133   . = ALIGN(4096);
134   pg0 = .;
135
136   /* Sections to be discarded */
137   /DISCARD/ : {
138         *(.exitcall.exit)
139         }
140
141   /* Stabs debugging sections.  */
142   .stab 0 : { *(.stab) }
143   .stabstr 0 : { *(.stabstr) }
144   .stab.excl 0 : { *(.stab.excl) }
145   .stab.exclstr 0 : { *(.stab.exclstr) }
146   .stab.index 0 : { *(.stab.index) }
147   .stab.indexstr 0 : { *(.stab.indexstr) }
148   .comment 0 : { *(.comment) }
149 }
150 #else
151 ENTRY(startup_32)
152 jiffies = jiffies_64;
153 SECTIONS
154 {
155   . = __PAGE_OFFSET + 0x100000;
156   /* read-only */
157   _text = .;                    /* Text and read-only data */
158   .text : {
159         *(.text)
160         SCHED_TEXT
161         LOCK_TEXT
162         *(.fixup)
163         *(.gnu.warning)
164         } = 0x9090
165
166   _etext = .;                   /* End of text section */
167
168   . = ALIGN(16);                /* Exception table */
169   __start___ex_table = .;
170   __ex_table : { *(__ex_table) }
171   __stop___ex_table = .;
172
173   RODATA
174
175   /* writeable */
176   .data : {                     /* Data */
177         *(.data)
178         CONSTRUCTORS
179         }
180
181   . = ALIGN(4096);
182   __nosave_begin = .;
183   .data_nosave : { *(.data.nosave) }
184   . = ALIGN(4096);
185   __nosave_end = .;
186
187   . = ALIGN(4096);
188   .data.page_aligned : { *(.data.idt) }
189
190   . = ALIGN(32);
191   .data.cacheline_aligned : { *(.data.cacheline_aligned) }
192
193   _edata = .;                   /* End of data section */
194
195   . = ALIGN(THREAD_SIZE);       /* init_task */
196   .data.init_task : { *(.data.init_task) }
197
198   /* will be freed after init */
199   . = ALIGN(4096);              /* Init code and data */
200   __init_begin = .;
201   .init.text : { 
202         _sinittext = .;
203         *(.init.text)
204         _einittext = .;
205   }
206   .init.data : { *(.init.data) }
207   . = ALIGN(16);
208   __setup_start = .;
209   .init.setup : { *(.init.setup) }
210   __setup_end = .;
211   __initcall_start = .;
212   .initcall.init : {
213         *(.initcall1.init) 
214         *(.initcall2.init) 
215         *(.initcall3.init) 
216         *(.initcall4.init) 
217         *(.initcall5.init) 
218         *(.initcall6.init) 
219         *(.initcall7.init)
220   }
221   __initcall_end = .;
222   __con_initcall_start = .;
223   .con_initcall.init : { *(.con_initcall.init) }
224   __con_initcall_end = .;
225   SECURITY_INIT
226   . = ALIGN(4);
227   __alt_instructions = .;
228   .altinstructions : { *(.altinstructions) } 
229   __alt_instructions_end = .; 
230  .altinstr_replacement : { *(.altinstr_replacement) } 
231   /* .exit.text is discard at runtime, not link time, to deal with references
232      from .altinstructions and .eh_frame */
233   .exit.text : { *(.exit.text) }
234   .exit.data : { *(.exit.data) }
235   . = ALIGN(4096);
236   __initramfs_start = .;
237   .init.ramfs : { *(.init.ramfs) }
238   __initramfs_end = .;
239   . = ALIGN(32);
240   __per_cpu_start = .;
241   .data.percpu  : { *(.data.percpu) }
242   __per_cpu_end = .;
243   . = ALIGN(4096);
244   __init_end = .;
245   /* freed after init ends here */
246         
247   __bss_start = .;              /* BSS */
248   .bss : {
249         *(.bss.page_aligned)
250         *(.bss)
251   }
252   . = ALIGN(4);
253   __bss_stop = .; 
254
255   _end = . ;
256
257   /* This is where the kernel creates the early boot page tables */
258   . = ALIGN(4096);
259   pg0 = .;
260
261   /* Sections to be discarded */
262   /DISCARD/ : {
263         *(.exitcall.exit)
264         }
265
266   /* Stabs debugging sections.  */
267   .stab 0 : { *(.stab) }
268   .stabstr 0 : { *(.stabstr) }
269   .stab.excl 0 : { *(.stab.excl) }
270   .stab.exclstr 0 : { *(.stab.exclstr) }
271   .stab.index 0 : { *(.stab.index) }
272   .stab.indexstr 0 : { *(.stab.indexstr) }
273   .comment 0 : { *(.comment) }
274 }
275 #endif