diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-14 04:32:29 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:12:53 -0500 |
commit | 50f4f23c3bd95afc82e931254a71e7b1b3699fd2 (patch) | |
tree | 5ed7cc71e1140a3a839c8d65ca95b755012d4bde /include/asm-sparc64/pgtable.h | |
parent | 3af6e01e9acfb786c5dd2862f57f206b0b3cb889 (diff) |
[SPARC64]: Fix gcc-3.3.x warnings.
It doesn't like const variables being passed into
"i" constraing asm operations. It's a bug, but
there is nothing we can really do but work around
it.
Based upon a report from Andrew Morton.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/pgtable.h')
-rw-r--r-- | include/asm-sparc64/pgtable.h | 143 |
1 files changed, 25 insertions, 118 deletions
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 00eecbb52f95..bc446f302ea4 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h | |||
@@ -232,13 +232,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) | |||
232 | unsigned long paddr = pfn << PAGE_SHIFT; | 232 | unsigned long paddr = pfn << PAGE_SHIFT; |
233 | unsigned long sz_bits; | 233 | unsigned long sz_bits; |
234 | 234 | ||
235 | BUILD_BUG_ON(!__builtin_constant_p(_PAGE_SZBITS_4U) || | ||
236 | !__builtin_constant_p(_PAGE_SZBITS_4V)); | ||
237 | |||
238 | sz_bits = 0UL; | 235 | sz_bits = 0UL; |
239 | if (_PAGE_SZBITS_4U != 0UL || _PAGE_SZBITS_4V != 0UL) { | 236 | if (_PAGE_SZBITS_4U != 0UL || _PAGE_SZBITS_4V != 0UL) { |
240 | BUILD_BUG_ON((_PAGE_SZBITS_4U & ~(0xfffffc0000000000UL)) || | ||
241 | (_PAGE_SZBITS_4V & ~(0x0000000000000fffUL))); | ||
242 | __asm__ __volatile__( | 237 | __asm__ __volatile__( |
243 | "\n661: sethi %uhi(%1), %0\n" | 238 | "\n661: sethi %uhi(%1), %0\n" |
244 | " sllx %0, 32, %0\n" | 239 | " sllx %0, 32, %0\n" |
@@ -257,10 +252,6 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) | |||
257 | /* This one can be done with two shifts. */ | 252 | /* This one can be done with two shifts. */ |
258 | static inline unsigned long pte_pfn(pte_t pte) | 253 | static inline unsigned long pte_pfn(pte_t pte) |
259 | { | 254 | { |
260 | const unsigned long pte_paddr_shl_sun4u = 21; | ||
261 | const unsigned long pte_paddr_shr_sun4u = 21 + PAGE_SHIFT; | ||
262 | const unsigned long pte_paddr_shl_sun4v = 8; | ||
263 | const unsigned long pte_paddr_shr_sun4v = 8 + PAGE_SHIFT; | ||
264 | unsigned long ret; | 255 | unsigned long ret; |
265 | 256 | ||
266 | __asm__ __volatile__( | 257 | __asm__ __volatile__( |
@@ -273,8 +264,8 @@ static inline unsigned long pte_pfn(pte_t pte) | |||
273 | " .previous\n" | 264 | " .previous\n" |
274 | : "=r" (ret) | 265 | : "=r" (ret) |
275 | : "r" (pte_val(pte)), | 266 | : "r" (pte_val(pte)), |
276 | "i" (pte_paddr_shl_sun4u), "i" (pte_paddr_shr_sun4u), | 267 | "i" (21), "i" (21 + PAGE_SHIFT), |
277 | "i" (pte_paddr_shl_sun4v), "i" (pte_paddr_shr_sun4v)); | 268 | "i" (8), "i" (8 + PAGE_SHIFT)); |
278 | 269 | ||
279 | return ret; | 270 | return ret; |
280 | } | 271 | } |
@@ -282,22 +273,6 @@ static inline unsigned long pte_pfn(pte_t pte) | |||
282 | 273 | ||
283 | static inline pte_t pte_modify(pte_t pte, pgprot_t prot) | 274 | static inline pte_t pte_modify(pte_t pte, pgprot_t prot) |
284 | { | 275 | { |
285 | const unsigned long preserve_mask_sun4u = (_PAGE_PADDR_4U | | ||
286 | _PAGE_MODIFIED_4U | | ||
287 | _PAGE_ACCESSED_4U | | ||
288 | _PAGE_CP_4U | | ||
289 | _PAGE_CV_4U | | ||
290 | _PAGE_E_4U | | ||
291 | _PAGE_PRESENT_4U | | ||
292 | _PAGE_SZBITS_4U); | ||
293 | const unsigned long preserve_mask_sun4v = (_PAGE_PADDR_4V | | ||
294 | _PAGE_MODIFIED_4V | | ||
295 | _PAGE_ACCESSED_4V | | ||
296 | _PAGE_CP_4V | | ||
297 | _PAGE_CV_4V | | ||
298 | _PAGE_E_4V | | ||
299 | _PAGE_PRESENT_4V | | ||
300 | _PAGE_SZBITS_4V); | ||
301 | unsigned long mask, tmp; | 276 | unsigned long mask, tmp; |
302 | 277 | ||
303 | /* SUN4U: 0x600307ffffffecb8 (negated == 0x9ffcf80000001347) | 278 | /* SUN4U: 0x600307ffffffecb8 (negated == 0x9ffcf80000001347) |
@@ -329,7 +304,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot) | |||
329 | " or %0, %1, %0\n" | 304 | " or %0, %1, %0\n" |
330 | " .previous\n" | 305 | " .previous\n" |
331 | : "=r" (mask), "=r" (tmp) | 306 | : "=r" (mask), "=r" (tmp) |
332 | : "i" (preserve_mask_sun4u), "i" (preserve_mask_sun4v)); | 307 | : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U | |
308 | _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U | | ||
309 | _PAGE_SZBITS_4U), | ||
310 | "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | | ||
311 | _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V | | ||
312 | _PAGE_SZBITS_4V)); | ||
333 | 313 | ||
334 | return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask)); | 314 | return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask)); |
335 | } | 315 | } |
@@ -338,9 +318,6 @@ static inline pte_t pgoff_to_pte(unsigned long off) | |||
338 | { | 318 | { |
339 | off <<= PAGE_SHIFT; | 319 | off <<= PAGE_SHIFT; |
340 | 320 | ||
341 | BUILD_BUG_ON((_PAGE_FILE_4U & ~0xfffUL) || | ||
342 | (_PAGE_FILE_4V & ~0xfffUL)); | ||
343 | |||
344 | __asm__ __volatile__( | 321 | __asm__ __volatile__( |
345 | "\n661: or %0, %2, %0\n" | 322 | "\n661: or %0, %2, %0\n" |
346 | " .section .sun4v_1insn_patch, \"ax\"\n" | 323 | " .section .sun4v_1insn_patch, \"ax\"\n" |
@@ -357,9 +334,6 @@ static inline pgprot_t pgprot_noncached(pgprot_t prot) | |||
357 | { | 334 | { |
358 | unsigned long val = pgprot_val(prot); | 335 | unsigned long val = pgprot_val(prot); |
359 | 336 | ||
360 | BUILD_BUG_ON(((_PAGE_CP_4U | _PAGE_CP_4U | _PAGE_E_4U) & ~(0xfffUL)) || | ||
361 | ((_PAGE_CP_4V | _PAGE_CP_4V | _PAGE_E_4V) & ~(0xfffUL))); | ||
362 | |||
363 | __asm__ __volatile__( | 337 | __asm__ __volatile__( |
364 | "\n661: andn %0, %2, %0\n" | 338 | "\n661: andn %0, %2, %0\n" |
365 | " or %0, %3, %0\n" | 339 | " or %0, %3, %0\n" |
@@ -382,13 +356,8 @@ static inline pgprot_t pgprot_noncached(pgprot_t prot) | |||
382 | 356 | ||
383 | static inline pte_t pte_mkhuge(pte_t pte) | 357 | static inline pte_t pte_mkhuge(pte_t pte) |
384 | { | 358 | { |
385 | const unsigned long mask_4u = _PAGE_SZHUGE_4U; | ||
386 | const unsigned long mask_4v = _PAGE_SZHUGE_4V; | ||
387 | unsigned long mask; | 359 | unsigned long mask; |
388 | 360 | ||
389 | BUILD_BUG_ON((mask_4u & ~(0xfffffc0000000000UL)) || | ||
390 | (mask_4v & ~(0xfffUL))); | ||
391 | |||
392 | __asm__ __volatile__( | 361 | __asm__ __volatile__( |
393 | "\n661: sethi %%uhi(%1), %0\n" | 362 | "\n661: sethi %%uhi(%1), %0\n" |
394 | " sllx %0, 32, %0\n" | 363 | " sllx %0, 32, %0\n" |
@@ -398,20 +367,15 @@ static inline pte_t pte_mkhuge(pte_t pte) | |||
398 | " nop\n" | 367 | " nop\n" |
399 | " .previous\n" | 368 | " .previous\n" |
400 | : "=r" (mask) | 369 | : "=r" (mask) |
401 | : "i" (mask_4u), "i" (mask_4v)); | 370 | : "i" (_PAGE_SZHUGE_4U), "i" (_PAGE_SZHUGE_4V)); |
402 | 371 | ||
403 | return __pte(pte_val(pte) | mask); | 372 | return __pte(pte_val(pte) | mask); |
404 | } | 373 | } |
405 | 374 | ||
406 | static inline pte_t pte_mkdirty(pte_t pte) | 375 | static inline pte_t pte_mkdirty(pte_t pte) |
407 | { | 376 | { |
408 | const unsigned long mask_4u = _PAGE_MODIFIED_4U | _PAGE_W_4U; | ||
409 | const unsigned long mask_4v = _PAGE_MODIFIED_4V | _PAGE_W_4V; | ||
410 | unsigned long val = pte_val(pte), tmp; | 377 | unsigned long val = pte_val(pte), tmp; |
411 | 378 | ||
412 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
413 | (mask_4v & ~(0xfffffc0000000fffUL))); | ||
414 | |||
415 | __asm__ __volatile__( | 379 | __asm__ __volatile__( |
416 | "\n661: or %0, %3, %0\n" | 380 | "\n661: or %0, %3, %0\n" |
417 | " nop\n" | 381 | " nop\n" |
@@ -426,20 +390,16 @@ static inline pte_t pte_mkdirty(pte_t pte) | |||
426 | " or %0, %1, %0\n" | 390 | " or %0, %1, %0\n" |
427 | " .previous\n" | 391 | " .previous\n" |
428 | : "=r" (val), "=r" (tmp) | 392 | : "=r" (val), "=r" (tmp) |
429 | : "0" (val), "i" (mask_4u), "i" (mask_4v)); | 393 | : "0" (val), "i" (_PAGE_MODIFIED_4U | _PAGE_W_4U), |
394 | "i" (_PAGE_MODIFIED_4V | _PAGE_W_4V)); | ||
430 | 395 | ||
431 | return __pte(val); | 396 | return __pte(val); |
432 | } | 397 | } |
433 | 398 | ||
434 | static inline pte_t pte_mkclean(pte_t pte) | 399 | static inline pte_t pte_mkclean(pte_t pte) |
435 | { | 400 | { |
436 | const unsigned long mask_4u = _PAGE_MODIFIED_4U | _PAGE_W_4U; | ||
437 | const unsigned long mask_4v = _PAGE_MODIFIED_4V | _PAGE_W_4V; | ||
438 | unsigned long val = pte_val(pte), tmp; | 401 | unsigned long val = pte_val(pte), tmp; |
439 | 402 | ||
440 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
441 | (mask_4v & ~(0xfffffc0000000fffUL))); | ||
442 | |||
443 | __asm__ __volatile__( | 403 | __asm__ __volatile__( |
444 | "\n661: andn %0, %3, %0\n" | 404 | "\n661: andn %0, %3, %0\n" |
445 | " nop\n" | 405 | " nop\n" |
@@ -454,20 +414,16 @@ static inline pte_t pte_mkclean(pte_t pte) | |||
454 | " andn %0, %1, %0\n" | 414 | " andn %0, %1, %0\n" |
455 | " .previous\n" | 415 | " .previous\n" |
456 | : "=r" (val), "=r" (tmp) | 416 | : "=r" (val), "=r" (tmp) |
457 | : "0" (val), "i" (mask_4u), "i" (mask_4v)); | 417 | : "0" (val), "i" (_PAGE_MODIFIED_4U | _PAGE_W_4U), |
418 | "i" (_PAGE_MODIFIED_4V | _PAGE_W_4V)); | ||
458 | 419 | ||
459 | return __pte(val); | 420 | return __pte(val); |
460 | } | 421 | } |
461 | 422 | ||
462 | static inline pte_t pte_mkwrite(pte_t pte) | 423 | static inline pte_t pte_mkwrite(pte_t pte) |
463 | { | 424 | { |
464 | const unsigned long mask_4u = _PAGE_WRITE_4U; | ||
465 | const unsigned long mask_4v = _PAGE_WRITE_4V; | ||
466 | unsigned long val = pte_val(pte), mask; | 425 | unsigned long val = pte_val(pte), mask; |
467 | 426 | ||
468 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
469 | (mask_4v & ~(0xfffffc0000000000UL))); | ||
470 | |||
471 | __asm__ __volatile__( | 427 | __asm__ __volatile__( |
472 | "\n661: mov %1, %0\n" | 428 | "\n661: mov %1, %0\n" |
473 | " nop\n" | 429 | " nop\n" |
@@ -477,20 +433,15 @@ static inline pte_t pte_mkwrite(pte_t pte) | |||
477 | " sllx %0, 32, %0\n" | 433 | " sllx %0, 32, %0\n" |
478 | " .previous\n" | 434 | " .previous\n" |
479 | : "=r" (mask) | 435 | : "=r" (mask) |
480 | : "i" (mask_4u), "i" (mask_4v)); | 436 | : "i" (_PAGE_WRITE_4U), "i" (_PAGE_WRITE_4V)); |
481 | 437 | ||
482 | return __pte(val | mask); | 438 | return __pte(val | mask); |
483 | } | 439 | } |
484 | 440 | ||
485 | static inline pte_t pte_wrprotect(pte_t pte) | 441 | static inline pte_t pte_wrprotect(pte_t pte) |
486 | { | 442 | { |
487 | const unsigned long mask_4u = _PAGE_WRITE_4U | _PAGE_W_4U; | ||
488 | const unsigned long mask_4v = _PAGE_WRITE_4V | _PAGE_W_4V; | ||
489 | unsigned long val = pte_val(pte), tmp; | 443 | unsigned long val = pte_val(pte), tmp; |
490 | 444 | ||
491 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
492 | (mask_4v & ~(0xfffffc0000000fffUL))); | ||
493 | |||
494 | __asm__ __volatile__( | 445 | __asm__ __volatile__( |
495 | "\n661: andn %0, %3, %0\n" | 446 | "\n661: andn %0, %3, %0\n" |
496 | " nop\n" | 447 | " nop\n" |
@@ -505,20 +456,16 @@ static inline pte_t pte_wrprotect(pte_t pte) | |||
505 | " andn %0, %1, %0\n" | 456 | " andn %0, %1, %0\n" |
506 | " .previous\n" | 457 | " .previous\n" |
507 | : "=r" (val), "=r" (tmp) | 458 | : "=r" (val), "=r" (tmp) |
508 | : "0" (val), "i" (mask_4u), "i" (mask_4v)); | 459 | : "0" (val), "i" (_PAGE_WRITE_4U | _PAGE_W_4U), |
460 | "i" (_PAGE_WRITE_4V | _PAGE_W_4V)); | ||
509 | 461 | ||
510 | return __pte(val); | 462 | return __pte(val); |
511 | } | 463 | } |
512 | 464 | ||
513 | static inline pte_t pte_mkold(pte_t pte) | 465 | static inline pte_t pte_mkold(pte_t pte) |
514 | { | 466 | { |
515 | const unsigned long mask_4u = _PAGE_ACCESSED_4U; | ||
516 | const unsigned long mask_4v = _PAGE_ACCESSED_4V; | ||
517 | unsigned long mask; | 467 | unsigned long mask; |
518 | 468 | ||
519 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
520 | (mask_4v & ~(0xfffffc0000000000UL))); | ||
521 | |||
522 | __asm__ __volatile__( | 469 | __asm__ __volatile__( |
523 | "\n661: mov %1, %0\n" | 470 | "\n661: mov %1, %0\n" |
524 | " nop\n" | 471 | " nop\n" |
@@ -528,7 +475,7 @@ static inline pte_t pte_mkold(pte_t pte) | |||
528 | " sllx %0, 32, %0\n" | 475 | " sllx %0, 32, %0\n" |
529 | " .previous\n" | 476 | " .previous\n" |
530 | : "=r" (mask) | 477 | : "=r" (mask) |
531 | : "i" (mask_4u), "i" (mask_4v)); | 478 | : "i" (_PAGE_ACCESSED_4U), "i" (_PAGE_ACCESSED_4V)); |
532 | 479 | ||
533 | mask |= _PAGE_R; | 480 | mask |= _PAGE_R; |
534 | 481 | ||
@@ -537,13 +484,8 @@ static inline pte_t pte_mkold(pte_t pte) | |||
537 | 484 | ||
538 | static inline pte_t pte_mkyoung(pte_t pte) | 485 | static inline pte_t pte_mkyoung(pte_t pte) |
539 | { | 486 | { |
540 | const unsigned long mask_4u = _PAGE_ACCESSED_4U; | ||
541 | const unsigned long mask_4v = _PAGE_ACCESSED_4V; | ||
542 | unsigned long mask; | 487 | unsigned long mask; |
543 | 488 | ||
544 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
545 | (mask_4v & ~(0xfffffc0000000000UL))); | ||
546 | |||
547 | __asm__ __volatile__( | 489 | __asm__ __volatile__( |
548 | "\n661: mov %1, %0\n" | 490 | "\n661: mov %1, %0\n" |
549 | " nop\n" | 491 | " nop\n" |
@@ -553,7 +495,7 @@ static inline pte_t pte_mkyoung(pte_t pte) | |||
553 | " sllx %0, 32, %0\n" | 495 | " sllx %0, 32, %0\n" |
554 | " .previous\n" | 496 | " .previous\n" |
555 | : "=r" (mask) | 497 | : "=r" (mask) |
556 | : "i" (mask_4u), "i" (mask_4v)); | 498 | : "i" (_PAGE_ACCESSED_4U), "i" (_PAGE_ACCESSED_4V)); |
557 | 499 | ||
558 | mask |= _PAGE_R; | 500 | mask |= _PAGE_R; |
559 | 501 | ||
@@ -562,13 +504,8 @@ static inline pte_t pte_mkyoung(pte_t pte) | |||
562 | 504 | ||
563 | static inline unsigned long pte_young(pte_t pte) | 505 | static inline unsigned long pte_young(pte_t pte) |
564 | { | 506 | { |
565 | const unsigned long mask_4u = _PAGE_ACCESSED_4U; | ||
566 | const unsigned long mask_4v = _PAGE_ACCESSED_4V; | ||
567 | unsigned long mask; | 507 | unsigned long mask; |
568 | 508 | ||
569 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
570 | (mask_4v & ~(0xfffffc0000000000UL))); | ||
571 | |||
572 | __asm__ __volatile__( | 509 | __asm__ __volatile__( |
573 | "\n661: mov %1, %0\n" | 510 | "\n661: mov %1, %0\n" |
574 | " nop\n" | 511 | " nop\n" |
@@ -578,20 +515,15 @@ static inline unsigned long pte_young(pte_t pte) | |||
578 | " sllx %0, 32, %0\n" | 515 | " sllx %0, 32, %0\n" |
579 | " .previous\n" | 516 | " .previous\n" |
580 | : "=r" (mask) | 517 | : "=r" (mask) |
581 | : "i" (mask_4u), "i" (mask_4v)); | 518 | : "i" (_PAGE_ACCESSED_4U), "i" (_PAGE_ACCESSED_4V)); |
582 | 519 | ||
583 | return (pte_val(pte) & mask); | 520 | return (pte_val(pte) & mask); |
584 | } | 521 | } |
585 | 522 | ||
586 | static inline unsigned long pte_dirty(pte_t pte) | 523 | static inline unsigned long pte_dirty(pte_t pte) |
587 | { | 524 | { |
588 | const unsigned long mask_4u = _PAGE_MODIFIED_4U; | ||
589 | const unsigned long mask_4v = _PAGE_MODIFIED_4V; | ||
590 | unsigned long mask; | 525 | unsigned long mask; |
591 | 526 | ||
592 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
593 | (mask_4v & ~(0xfffffc0000000000UL))); | ||
594 | |||
595 | __asm__ __volatile__( | 527 | __asm__ __volatile__( |
596 | "\n661: mov %1, %0\n" | 528 | "\n661: mov %1, %0\n" |
597 | " nop\n" | 529 | " nop\n" |
@@ -601,20 +533,15 @@ static inline unsigned long pte_dirty(pte_t pte) | |||
601 | " sllx %0, 32, %0\n" | 533 | " sllx %0, 32, %0\n" |
602 | " .previous\n" | 534 | " .previous\n" |
603 | : "=r" (mask) | 535 | : "=r" (mask) |
604 | : "i" (mask_4u), "i" (mask_4v)); | 536 | : "i" (_PAGE_MODIFIED_4U), "i" (_PAGE_MODIFIED_4V)); |
605 | 537 | ||
606 | return (pte_val(pte) & mask); | 538 | return (pte_val(pte) & mask); |
607 | } | 539 | } |
608 | 540 | ||
609 | static inline unsigned long pte_write(pte_t pte) | 541 | static inline unsigned long pte_write(pte_t pte) |
610 | { | 542 | { |
611 | const unsigned long mask_4u = _PAGE_WRITE_4U; | ||
612 | const unsigned long mask_4v = _PAGE_WRITE_4V; | ||
613 | unsigned long mask; | 543 | unsigned long mask; |
614 | 544 | ||
615 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
616 | (mask_4v & ~(0xfffffc0000000000UL))); | ||
617 | |||
618 | __asm__ __volatile__( | 545 | __asm__ __volatile__( |
619 | "\n661: mov %1, %0\n" | 546 | "\n661: mov %1, %0\n" |
620 | " nop\n" | 547 | " nop\n" |
@@ -624,20 +551,15 @@ static inline unsigned long pte_write(pte_t pte) | |||
624 | " sllx %0, 32, %0\n" | 551 | " sllx %0, 32, %0\n" |
625 | " .previous\n" | 552 | " .previous\n" |
626 | : "=r" (mask) | 553 | : "=r" (mask) |
627 | : "i" (mask_4u), "i" (mask_4v)); | 554 | : "i" (_PAGE_WRITE_4U), "i" (_PAGE_WRITE_4V)); |
628 | 555 | ||
629 | return (pte_val(pte) & mask); | 556 | return (pte_val(pte) & mask); |
630 | } | 557 | } |
631 | 558 | ||
632 | static inline unsigned long pte_exec(pte_t pte) | 559 | static inline unsigned long pte_exec(pte_t pte) |
633 | { | 560 | { |
634 | const unsigned long mask_4u = _PAGE_EXEC_4U; | ||
635 | const unsigned long mask_4v = _PAGE_EXEC_4V; | ||
636 | unsigned long mask; | 561 | unsigned long mask; |
637 | 562 | ||
638 | BUILD_BUG_ON((mask_4u & ~(0x00000000fffffc00UL)) || | ||
639 | (mask_4v & ~(0x0000000000000fffUL))); | ||
640 | |||
641 | __asm__ __volatile__( | 563 | __asm__ __volatile__( |
642 | "\n661: sethi %%hi(%1), %0\n" | 564 | "\n661: sethi %%hi(%1), %0\n" |
643 | " .section .sun4v_1insn_patch, \"ax\"\n" | 565 | " .section .sun4v_1insn_patch, \"ax\"\n" |
@@ -645,20 +567,15 @@ static inline unsigned long pte_exec(pte_t pte) | |||
645 | " mov %2, %0\n" | 567 | " mov %2, %0\n" |
646 | " .previous\n" | 568 | " .previous\n" |
647 | : "=r" (mask) | 569 | : "=r" (mask) |
648 | : "i" (mask_4u), "i" (mask_4v)); | 570 | : "i" (_PAGE_EXEC_4U), "i" (_PAGE_EXEC_4V)); |
649 | 571 | ||
650 | return (pte_val(pte) & mask); | 572 | return (pte_val(pte) & mask); |
651 | } | 573 | } |
652 | 574 | ||
653 | static inline unsigned long pte_read(pte_t pte) | 575 | static inline unsigned long pte_read(pte_t pte) |
654 | { | 576 | { |
655 | const unsigned long mask_4u = _PAGE_READ_4U; | ||
656 | const unsigned long mask_4v = _PAGE_READ_4V; | ||
657 | unsigned long mask; | 577 | unsigned long mask; |
658 | 578 | ||
659 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
660 | (mask_4v & ~(0xfffffc0000000000UL))); | ||
661 | |||
662 | __asm__ __volatile__( | 579 | __asm__ __volatile__( |
663 | "\n661: mov %1, %0\n" | 580 | "\n661: mov %1, %0\n" |
664 | " nop\n" | 581 | " nop\n" |
@@ -668,20 +585,15 @@ static inline unsigned long pte_read(pte_t pte) | |||
668 | " sllx %0, 32, %0\n" | 585 | " sllx %0, 32, %0\n" |
669 | " .previous\n" | 586 | " .previous\n" |
670 | : "=r" (mask) | 587 | : "=r" (mask) |
671 | : "i" (mask_4u), "i" (mask_4v)); | 588 | : "i" (_PAGE_READ_4U), "i" (_PAGE_READ_4V)); |
672 | 589 | ||
673 | return (pte_val(pte) & mask); | 590 | return (pte_val(pte) & mask); |
674 | } | 591 | } |
675 | 592 | ||
676 | static inline unsigned long pte_file(pte_t pte) | 593 | static inline unsigned long pte_file(pte_t pte) |
677 | { | 594 | { |
678 | const unsigned long mask_4u = _PAGE_FILE_4U; | ||
679 | const unsigned long mask_4v = _PAGE_FILE_4V; | ||
680 | unsigned long val = pte_val(pte); | 595 | unsigned long val = pte_val(pte); |
681 | 596 | ||
682 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
683 | (mask_4v & ~(0x0000000000000fffUL))); | ||
684 | |||
685 | __asm__ __volatile__( | 597 | __asm__ __volatile__( |
686 | "\n661: and %0, %2, %0\n" | 598 | "\n661: and %0, %2, %0\n" |
687 | " .section .sun4v_1insn_patch, \"ax\"\n" | 599 | " .section .sun4v_1insn_patch, \"ax\"\n" |
@@ -689,20 +601,15 @@ static inline unsigned long pte_file(pte_t pte) | |||
689 | " and %0, %3, %0\n" | 601 | " and %0, %3, %0\n" |
690 | " .previous\n" | 602 | " .previous\n" |
691 | : "=r" (val) | 603 | : "=r" (val) |
692 | : "0" (val), "i" (mask_4u), "i" (mask_4v)); | 604 | : "0" (val), "i" (_PAGE_FILE_4U), "i" (_PAGE_FILE_4V)); |
693 | 605 | ||
694 | return val; | 606 | return val; |
695 | } | 607 | } |
696 | 608 | ||
697 | static inline unsigned long pte_present(pte_t pte) | 609 | static inline unsigned long pte_present(pte_t pte) |
698 | { | 610 | { |
699 | const unsigned long mask_4u = _PAGE_PRESENT_4U; | ||
700 | const unsigned long mask_4v = _PAGE_PRESENT_4V; | ||
701 | unsigned long val = pte_val(pte); | 611 | unsigned long val = pte_val(pte); |
702 | 612 | ||
703 | BUILD_BUG_ON((mask_4u & ~(0x0000000000000fffUL)) || | ||
704 | (mask_4v & ~(0x0000000000000fffUL))); | ||
705 | |||
706 | __asm__ __volatile__( | 613 | __asm__ __volatile__( |
707 | "\n661: and %0, %2, %0\n" | 614 | "\n661: and %0, %2, %0\n" |
708 | " .section .sun4v_1insn_patch, \"ax\"\n" | 615 | " .section .sun4v_1insn_patch, \"ax\"\n" |
@@ -710,7 +617,7 @@ static inline unsigned long pte_present(pte_t pte) | |||
710 | " and %0, %3, %0\n" | 617 | " and %0, %3, %0\n" |
711 | " .previous\n" | 618 | " .previous\n" |
712 | : "=r" (val) | 619 | : "=r" (val) |
713 | : "0" (val), "i" (mask_4u), "i" (mask_4v)); | 620 | : "0" (val), "i" (_PAGE_PRESENT_4U), "i" (_PAGE_PRESENT_4V)); |
714 | 621 | ||
715 | return val; | 622 | return val; |
716 | } | 623 | } |