[PATCH] x86_64: eliminate empty_bad_{page,{pte,pmd}_table}

... as they are no longer needed. Since there were hard-coded numbers in the
file, the patch also adds a mechanism to avoid these (otherwise potential
future changes would again and again require adjusting these numbers).

Signed-Off-By: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Jan Beulich and committed by Linus Torvalds f0cf5d1a 0addb142

+37 -71
+37 -71
arch/x86_64/kernel/head.S
··· 241 ENTRY(stext) 242 ENTRY(_stext) 243 244 - .org 0x1000 245 - ENTRY(init_level4_pgt) 246 /* This gets initialized in x86_64_start_kernel */ 247 .fill 512,8,0 248 249 - .org 0x2000 250 - ENTRY(level3_ident_pgt) 251 - .quad 0x0000000000004007 + __PHYSICAL_START 252 .fill 511,8,0 253 254 - .org 0x3000 255 - ENTRY(level3_kernel_pgt) 256 .fill 510,8,0 257 /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */ 258 - .quad 0x0000000000005007 + __PHYSICAL_START /* -> level2_kernel_pgt */ 259 .fill 1,8,0 260 261 - .org 0x4000 262 - ENTRY(level2_ident_pgt) 263 /* 40MB for bootup. */ 264 - .quad 0x0000000000000083 265 - .quad 0x0000000000200083 266 - .quad 0x0000000000400083 267 - .quad 0x0000000000600083 268 - .quad 0x0000000000800083 269 - .quad 0x0000000000A00083 270 - .quad 0x0000000000C00083 271 - .quad 0x0000000000E00083 272 - .quad 0x0000000001000083 273 - .quad 0x0000000001200083 274 - .quad 0x0000000001400083 275 - .quad 0x0000000001600083 276 - .quad 0x0000000001800083 277 - .quad 0x0000000001A00083 278 - .quad 0x0000000001C00083 279 - .quad 0x0000000001E00083 280 - .quad 0x0000000002000083 281 - .quad 0x0000000002200083 282 - .quad 0x0000000002400083 283 - .quad 0x0000000002600083 284 /* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */ 285 .globl temp_boot_pmds 286 temp_boot_pmds: 287 .fill 492,8,0 288 289 - .org 0x5000 290 - ENTRY(level2_kernel_pgt) 291 /* 40MB kernel mapping. The kernel code cannot be bigger than that. 292 When you change this change KERNEL_TEXT_SIZE in page.h too. */ 293 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ 294 - .quad 0x0000000000000183 295 - .quad 0x0000000000200183 296 - .quad 0x0000000000400183 297 - .quad 0x0000000000600183 298 - .quad 0x0000000000800183 299 - .quad 0x0000000000A00183 300 - .quad 0x0000000000C00183 301 - .quad 0x0000000000E00183 302 - .quad 0x0000000001000183 303 - .quad 0x0000000001200183 304 - .quad 0x0000000001400183 305 - .quad 0x0000000001600183 306 - .quad 0x0000000001800183 307 - .quad 0x0000000001A00183 308 - .quad 0x0000000001C00183 309 - .quad 0x0000000001E00183 310 - .quad 0x0000000002000183 311 - .quad 0x0000000002200183 312 - .quad 0x0000000002400183 313 - .quad 0x0000000002600183 314 /* Module mapping starts here */ 315 .fill 492,8,0 316 317 - .org 0x6000 318 - ENTRY(empty_zero_page) 319 320 - .org 0x7000 321 - ENTRY(empty_bad_page) 322 323 - .org 0x8000 324 - ENTRY(empty_bad_pte_table) 325 326 - .org 0x9000 327 - ENTRY(empty_bad_pmd_table) 328 329 - .org 0xa000 330 - ENTRY(level3_physmem_pgt) 331 - .quad 0x0000000000005007 + __PHYSICAL_START /* -> level2_kernel_pgt (so that __va works even before pagetable_init) */ 332 - 333 - .org 0xb000 334 #ifdef CONFIG_ACPI_SLEEP 335 ENTRY(wakeup_level4_pgt) 336 - .quad 0x0000000000002007 + __PHYSICAL_START /* -> level3_ident_pgt */ 337 .fill 255,8,0 338 - .quad 0x000000000000a007 + __PHYSICAL_START 339 .fill 254,8,0 340 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ 341 - .quad 0x0000000000003007 + __PHYSICAL_START /* -> level3_kernel_pgt */ 342 #endif 343 344 #ifndef CONFIG_HOTPLUG_CPU ··· 318 */ 319 .align PAGE_SIZE 320 ENTRY(boot_level4_pgt) 321 - .quad 0x0000000000002007 + __PHYSICAL_START /* -> level3_ident_pgt */ 322 .fill 255,8,0 323 - .quad 0x000000000000a007 + __PHYSICAL_START 324 .fill 254,8,0 325 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ 326 - .quad 0x0000000000003007 + __PHYSICAL_START /* -> level3_kernel_pgt */ 327 328 .data 329
··· 241 ENTRY(stext) 242 ENTRY(_stext) 243 244 + $page = 0 245 + #define NEXT_PAGE(name) \ 246 + $page = $page + 1; \ 247 + .org $page * 0x1000; \ 248 + phys_/**/name = $page * 0x1000 + __PHYSICAL_START; \ 249 + ENTRY(name) 250 + 251 + NEXT_PAGE(init_level4_pgt) 252 /* This gets initialized in x86_64_start_kernel */ 253 .fill 512,8,0 254 255 + NEXT_PAGE(level3_ident_pgt) 256 + .quad phys_level2_ident_pgt | 0x007 257 .fill 511,8,0 258 259 + NEXT_PAGE(level3_kernel_pgt) 260 .fill 510,8,0 261 /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */ 262 + .quad phys_level2_kernel_pgt | 0x007 263 .fill 1,8,0 264 265 + NEXT_PAGE(level2_ident_pgt) 266 /* 40MB for bootup. */ 267 + i = 0 268 + .rept 20 269 + .quad i << 21 | 0x083 270 + i = i + 1 271 + .endr 272 /* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */ 273 .globl temp_boot_pmds 274 temp_boot_pmds: 275 .fill 492,8,0 276 277 + NEXT_PAGE(level2_kernel_pgt) 278 /* 40MB kernel mapping. The kernel code cannot be bigger than that. 279 When you change this change KERNEL_TEXT_SIZE in page.h too. */ 280 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ 281 + i = 0 282 + .rept 20 283 + .quad i << 21 | 0x183 284 + i = i + 1 285 + .endr 286 /* Module mapping starts here */ 287 .fill 492,8,0 288 289 + NEXT_PAGE(empty_zero_page) 290 291 + NEXT_PAGE(level3_physmem_pgt) 292 + .quad phys_level2_kernel_pgt | 0x007 /* so that __va works even before pagetable_init */ 293 + .fill 511,8,0 294 295 + #undef NEXT_PAGE 296 297 + .data 298 299 #ifdef CONFIG_ACPI_SLEEP 300 + .align PAGE_SIZE 301 ENTRY(wakeup_level4_pgt) 302 + .quad phys_level3_ident_pgt | 0x007 303 .fill 255,8,0 304 + .quad phys_level3_physmem_pgt | 0x007 305 .fill 254,8,0 306 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ 307 + .quad phys_level3_kernel_pgt | 0x007 308 #endif 309 310 #ifndef CONFIG_HOTPLUG_CPU ··· 352 */ 353 .align PAGE_SIZE 354 ENTRY(boot_level4_pgt) 355 + .quad phys_level3_ident_pgt | 0x007 356 .fill 255,8,0 357 + .quad phys_level3_physmem_pgt | 0x007 358 .fill 254,8,0 359 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ 360 + .quad phys_level3_kernel_pgt | 0x007 361 362 .data 363