Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / arch / x86_64 / kernel / vmlwk.lds.S
1 /* ld script to make x86-64 LWK kernel
2  * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3  */
4
5 #define LOAD_OFFSET __START_KERNEL_map
6
7 #include <arch-generic/vmlwk.lds.h>
8 #include <arch/page.h>
9
10 #undef i386     /* in case the preprocessor is a 32bit one */
11
12 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
13 OUTPUT_ARCH(i386:x86-64)
14 ENTRY(phys_startup_64)
15 _proxy_pda = 1;
16 PHDRS {
17         text PT_LOAD FLAGS(5);  /* R_E */
18         data PT_LOAD FLAGS(7);  /* RWE */
19         user PT_LOAD FLAGS(7);  /* RWE */
20         data.init PT_LOAD FLAGS(7);     /* RWE */
21         note PT_NOTE FLAGS(4);  /* R__ */
22 }
23 SECTIONS
24 {
25   . = __START_KERNEL;
26   phys_startup_64 = startup_64 - LOAD_OFFSET;
27   _text = .;                    /* Text and read-only data */
28   .text :  AT(ADDR(.text) - LOAD_OFFSET) {
29         /* First the code that has to be first for bootstrapping */
30         *(.bootstrap.text)
31         _stext = .;
32         /* Then the rest */
33         TEXT_TEXT
34         SCHED_TEXT
35         LOCK_TEXT
36         KPROBES_TEXT
37         *(.fixup)
38         *(.gnu.warning)
39         } :text = 0x9090
40                                 /* out-of-line lock text */
41   .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
42
43   _etext = .;                   /* End of text section */
44
45   . = ALIGN(16);                /* Exception table */
46   __start___ex_table = .;
47   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
48   __stop___ex_table = .;
49
50   BUG_TABLE
51
52   RODATA
53
54   . = ALIGN(PAGE_SIZE);        /* Align data segment to page size boundary */
55                                 /* Data */
56   .data : AT(ADDR(.data) - LOAD_OFFSET) {
57         DATA_DATA
58         CONSTRUCTORS
59         } :data
60
61   _edata = .;                   /* End of data section */
62
63   . = ALIGN(PAGE_SIZE);
64   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
65   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
66         *(.data.cacheline_aligned)
67   }
68   . = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES);
69   .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
70         *(.data.read_mostly)
71   }
72
73 #define VSYSCALL_ADDR (-10*1024*1024)
74 #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
75 #define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
76
77 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
78 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
79
80 #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
81 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
82
83   . = VSYSCALL_ADDR;
84   .vsyscall_0 :  AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) } :user
85   __vsyscall_0 = VSYSCALL_VIRT_ADDR;
86
87   .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1))
88                 { *(.vsyscall_1) }
89
90   .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2))
91                 { *(.vsyscall_2) }
92
93   .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3))
94                 { *(.vsyscall_3) }
95
96   . = VSYSCALL_VIRT_ADDR + PAGE_SIZE;
97
98 #undef VSYSCALL_ADDR
99 #undef VSYSCALL_PHYS_ADDR
100 #undef VSYSCALL_VIRT_ADDR
101 #undef VLOAD_OFFSET
102 #undef VLOAD
103 #undef VVIRT_OFFSET
104 #undef VVIRT
105
106   . = ALIGN(8192);              /* bootstrap_task */
107   .data.bootstrap_task : AT(ADDR(.data.bootstrap_task) - LOAD_OFFSET) {
108         *(.data.bootstrap_task)
109   }:data.init
110
111   . = ALIGN(4096);
112   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
113         *(.data.page_aligned)
114   }
115
116   /* might get freed after init */
117   . = ALIGN(4096);
118   __smp_alt_begin = .;
119   __smp_alt_instructions = .;
120   .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
121         *(.smp_altinstructions)
122   }
123   __smp_alt_instructions_end = .;
124   . = ALIGN(8);
125   __smp_locks = .;
126   .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
127         *(.smp_locks)
128   }
129   __smp_locks_end = .;
130   .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
131         *(.smp_altinstr_replacement)
132   }
133   . = ALIGN(4096);
134   __smp_alt_end = .;
135
136   . = ALIGN(4096);              /* Init code and data */
137   __init_begin = .;
138   .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
139         _sinittext = .;
140         *(.init.text)
141         _einittext = .;
142   }
143   __initdata_begin = .;
144   .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
145   __initdata_end = .;
146   . = ALIGN(16);
147   __setup_start = .;
148   .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
149   __setup_end = .;
150   __initcall_start = .;
151   .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
152         INITCALLS
153   }
154   __initcall_end = .;
155   __con_initcall_start = .;
156   .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
157         *(.con_initcall.init)
158   }
159   __con_initcall_end = .;
160   SECURITY_INIT
161   . = ALIGN(8);
162   __alt_instructions = .;
163   .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
164         *(.altinstructions)
165   }
166   __alt_instructions_end = .; 
167   .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
168         *(.altinstr_replacement)
169   }
170   /* .exit.text is discard at runtime, not link time, to deal with references
171      from .altinstructions and .eh_frame */
172   .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
173   .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
174
175 #ifdef CONFIG_BLK_DEV_INITRD
176   . = ALIGN(4096);
177   __initramfs_start = .;
178   .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
179   __initramfs_end = .;
180 #endif
181
182   . = ALIGN(4096);
183   __per_cpu_start = .;
184   .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
185   __per_cpu_end = .;
186   . = ALIGN(4096);
187   __init_end = .;
188
189   . = ALIGN(4096);
190   __nosave_begin = .;
191   .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
192   . = ALIGN(4096);
193   __nosave_end = .;
194
195   __bss_start = .;              /* BSS */
196   .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
197         *(.bss.page_aligned)
198         *(.bss)
199         }
200   __bss_stop = .;
201
202   _end = . ;
203
204   /* Sections to be discarded */
205   /DISCARD/ : {
206         *(.exitcall.exit)
207         *(.eh_frame)
208         }
209
210   STABS_DEBUG
211
212   DWARF_DEBUG
213 }