aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/mm/tlbex.c83
1 files changed, 26 insertions, 57 deletions
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 21bcf084882f..c298344fcb71 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -720,6 +720,22 @@ il_bgez(u32 **p, struct reloc **r, unsigned int reg, enum label_id l)
720 i_bgez(p, reg, 0); 720 i_bgez(p, reg, 0);
721} 721}
722 722
723/*
724 * For debug purposes.
725 */
726static inline void dump_handler(const u32 *handler, int count)
727{
728 int i;
729
730 pr_debug("\t.set push\n");
731 pr_debug("\t.set noreorder\n");
732
733 for (i = 0; i < count; i++)
734 pr_debug("\t%p\t.word 0x%08x\n", &handler[i], handler[i]);
735
736 pr_debug("\t.set pop\n");
737}
738
723/* The only general purpose registers allowed in TLB handlers. */ 739/* The only general purpose registers allowed in TLB handlers. */
724#define K0 26 740#define K0 26
725#define K1 27 741#define K1 27
@@ -762,7 +778,6 @@ static void __init build_r3000_tlb_refill_handler(void)
762{ 778{
763 long pgdc = (long)pgd_current; 779 long pgdc = (long)pgd_current;
764 u32 *p; 780 u32 *p;
765 int i;
766 781
767 memset(tlb_handler, 0, sizeof(tlb_handler)); 782 memset(tlb_handler, 0, sizeof(tlb_handler));
768 p = tlb_handler; 783 p = tlb_handler;
@@ -791,13 +806,9 @@ static void __init build_r3000_tlb_refill_handler(void)
791 pr_info("Synthesized TLB refill handler (%u instructions).\n", 806 pr_info("Synthesized TLB refill handler (%u instructions).\n",
792 (unsigned int)(p - tlb_handler)); 807 (unsigned int)(p - tlb_handler));
793 808
794 pr_debug("\t.set push\n");
795 pr_debug("\t.set noreorder\n");
796 for (i = 0; i < (p - tlb_handler); i++)
797 pr_debug("\t.word 0x%08x\n", tlb_handler[i]);
798 pr_debug("\t.set pop\n");
799
800 memcpy((void *)ebase, tlb_handler, 0x80); 809 memcpy((void *)ebase, tlb_handler, 0x80);
810
811 dump_handler((u32 *)ebase, 32);
801} 812}
802 813
803/* 814/*
@@ -1264,7 +1275,6 @@ static void __init build_r4000_tlb_refill_handler(void)
1264 struct reloc *r = relocs; 1275 struct reloc *r = relocs;
1265 u32 *f; 1276 u32 *f;
1266 unsigned int final_len; 1277 unsigned int final_len;
1267 int i;
1268 1278
1269 memset(tlb_handler, 0, sizeof(tlb_handler)); 1279 memset(tlb_handler, 0, sizeof(tlb_handler));
1270 memset(labels, 0, sizeof(labels)); 1280 memset(labels, 0, sizeof(labels));
@@ -1366,20 +1376,9 @@ static void __init build_r4000_tlb_refill_handler(void)
1366 pr_info("Synthesized TLB refill handler (%u instructions).\n", 1376 pr_info("Synthesized TLB refill handler (%u instructions).\n",
1367 final_len); 1377 final_len);
1368 1378
1369 f = final_handler;
1370#if defined(CONFIG_64BIT) && !defined(CONFIG_CPU_LOONGSON2)
1371 if (final_len > 32)
1372 final_len = 64;
1373 else
1374 f = final_handler + 32;
1375#endif /* CONFIG_64BIT */
1376 pr_debug("\t.set push\n");
1377 pr_debug("\t.set noreorder\n");
1378 for (i = 0; i < final_len; i++)
1379 pr_debug("\t.word 0x%08x\n", f[i]);
1380 pr_debug("\t.set pop\n");
1381
1382 memcpy((void *)ebase, final_handler, 0x100); 1379 memcpy((void *)ebase, final_handler, 0x100);
1380
1381 dump_handler((u32 *)ebase, 64);
1383} 1382}
1384 1383
1385/* 1384/*
@@ -1607,7 +1606,6 @@ static void __init build_r3000_tlb_load_handler(void)
1607 u32 *p = handle_tlbl; 1606 u32 *p = handle_tlbl;
1608 struct label *l = labels; 1607 struct label *l = labels;
1609 struct reloc *r = relocs; 1608 struct reloc *r = relocs;
1610 int i;
1611 1609
1612 memset(handle_tlbl, 0, sizeof(handle_tlbl)); 1610 memset(handle_tlbl, 0, sizeof(handle_tlbl));
1613 memset(labels, 0, sizeof(labels)); 1611 memset(labels, 0, sizeof(labels));
@@ -1630,11 +1628,7 @@ static void __init build_r3000_tlb_load_handler(void)
1630 pr_info("Synthesized TLB load handler fastpath (%u instructions).\n", 1628 pr_info("Synthesized TLB load handler fastpath (%u instructions).\n",
1631 (unsigned int)(p - handle_tlbl)); 1629 (unsigned int)(p - handle_tlbl));
1632 1630
1633 pr_debug("\t.set push\n"); 1631 dump_handler(handle_tlbl, ARRAY_SIZE(handle_tlbl));
1634 pr_debug("\t.set noreorder\n");
1635 for (i = 0; i < (p - handle_tlbl); i++)
1636 pr_debug("\t.word 0x%08x\n", handle_tlbl[i]);
1637 pr_debug("\t.set pop\n");
1638} 1632}
1639 1633
1640static void __init build_r3000_tlb_store_handler(void) 1634static void __init build_r3000_tlb_store_handler(void)
@@ -1642,7 +1636,6 @@ static void __init build_r3000_tlb_store_handler(void)
1642 u32 *p = handle_tlbs; 1636 u32 *p = handle_tlbs;
1643 struct label *l = labels; 1637 struct label *l = labels;
1644 struct reloc *r = relocs; 1638 struct reloc *r = relocs;
1645 int i;
1646 1639
1647 memset(handle_tlbs, 0, sizeof(handle_tlbs)); 1640 memset(handle_tlbs, 0, sizeof(handle_tlbs));
1648 memset(labels, 0, sizeof(labels)); 1641 memset(labels, 0, sizeof(labels));
@@ -1665,11 +1658,7 @@ static void __init build_r3000_tlb_store_handler(void)
1665 pr_info("Synthesized TLB store handler fastpath (%u instructions).\n", 1658 pr_info("Synthesized TLB store handler fastpath (%u instructions).\n",
1666 (unsigned int)(p - handle_tlbs)); 1659 (unsigned int)(p - handle_tlbs));
1667 1660
1668 pr_debug("\t.set push\n"); 1661 dump_handler(handle_tlbs, ARRAY_SIZE(handle_tlbs));
1669 pr_debug("\t.set noreorder\n");
1670 for (i = 0; i < (p - handle_tlbs); i++)
1671 pr_debug("\t.word 0x%08x\n", handle_tlbs[i]);
1672 pr_debug("\t.set pop\n");
1673} 1662}
1674 1663
1675static void __init build_r3000_tlb_modify_handler(void) 1664static void __init build_r3000_tlb_modify_handler(void)
@@ -1677,7 +1666,6 @@ static void __init build_r3000_tlb_modify_handler(void)
1677 u32 *p = handle_tlbm; 1666 u32 *p = handle_tlbm;
1678 struct label *l = labels; 1667 struct label *l = labels;
1679 struct reloc *r = relocs; 1668 struct reloc *r = relocs;
1680 int i;
1681 1669
1682 memset(handle_tlbm, 0, sizeof(handle_tlbm)); 1670 memset(handle_tlbm, 0, sizeof(handle_tlbm));
1683 memset(labels, 0, sizeof(labels)); 1671 memset(labels, 0, sizeof(labels));
@@ -1700,11 +1688,7 @@ static void __init build_r3000_tlb_modify_handler(void)
1700 pr_info("Synthesized TLB modify handler fastpath (%u instructions).\n", 1688 pr_info("Synthesized TLB modify handler fastpath (%u instructions).\n",
1701 (unsigned int)(p - handle_tlbm)); 1689 (unsigned int)(p - handle_tlbm));
1702 1690
1703 pr_debug("\t.set push\n"); 1691 dump_handler(handle_tlbm, ARRAY_SIZE(handle_tlbm));
1704 pr_debug("\t.set noreorder\n");
1705 for (i = 0; i < (p - handle_tlbm); i++)
1706 pr_debug("\t.word 0x%08x\n", handle_tlbm[i]);
1707 pr_debug("\t.set pop\n");
1708} 1692}
1709 1693
1710/* 1694/*
@@ -1757,7 +1741,6 @@ static void __init build_r4000_tlb_load_handler(void)
1757 u32 *p = handle_tlbl; 1741 u32 *p = handle_tlbl;
1758 struct label *l = labels; 1742 struct label *l = labels;
1759 struct reloc *r = relocs; 1743 struct reloc *r = relocs;
1760 int i;
1761 1744
1762 memset(handle_tlbl, 0, sizeof(handle_tlbl)); 1745 memset(handle_tlbl, 0, sizeof(handle_tlbl));
1763 memset(labels, 0, sizeof(labels)); 1746 memset(labels, 0, sizeof(labels));
@@ -1790,11 +1773,7 @@ static void __init build_r4000_tlb_load_handler(void)
1790 pr_info("Synthesized TLB load handler fastpath (%u instructions).\n", 1773 pr_info("Synthesized TLB load handler fastpath (%u instructions).\n",
1791 (unsigned int)(p - handle_tlbl)); 1774 (unsigned int)(p - handle_tlbl));
1792 1775
1793 pr_debug("\t.set push\n"); 1776 dump_handler(handle_tlbl, ARRAY_SIZE(handle_tlbl));
1794 pr_debug("\t.set noreorder\n");
1795 for (i = 0; i < (p - handle_tlbl); i++)
1796 pr_debug("\t.word 0x%08x\n", handle_tlbl[i]);
1797 pr_debug("\t.set pop\n");
1798} 1777}
1799 1778
1800static void __init build_r4000_tlb_store_handler(void) 1779static void __init build_r4000_tlb_store_handler(void)
@@ -1802,7 +1781,6 @@ static void __init build_r4000_tlb_store_handler(void)
1802 u32 *p = handle_tlbs; 1781 u32 *p = handle_tlbs;
1803 struct label *l = labels; 1782 struct label *l = labels;
1804 struct reloc *r = relocs; 1783 struct reloc *r = relocs;
1805 int i;
1806 1784
1807 memset(handle_tlbs, 0, sizeof(handle_tlbs)); 1785 memset(handle_tlbs, 0, sizeof(handle_tlbs));
1808 memset(labels, 0, sizeof(labels)); 1786 memset(labels, 0, sizeof(labels));
@@ -1826,11 +1804,7 @@ static void __init build_r4000_tlb_store_handler(void)
1826 pr_info("Synthesized TLB store handler fastpath (%u instructions).\n", 1804 pr_info("Synthesized TLB store handler fastpath (%u instructions).\n",
1827 (unsigned int)(p - handle_tlbs)); 1805 (unsigned int)(p - handle_tlbs));
1828 1806
1829 pr_debug("\t.set push\n"); 1807 dump_handler(handle_tlbs, ARRAY_SIZE(handle_tlbs));
1830 pr_debug("\t.set noreorder\n");
1831 for (i = 0; i < (p - handle_tlbs); i++)
1832 pr_debug("\t.word 0x%08x\n", handle_tlbs[i]);
1833 pr_debug("\t.set pop\n");
1834} 1808}
1835 1809
1836static void __init build_r4000_tlb_modify_handler(void) 1810static void __init build_r4000_tlb_modify_handler(void)
@@ -1838,7 +1812,6 @@ static void __init build_r4000_tlb_modify_handler(void)
1838 u32 *p = handle_tlbm; 1812 u32 *p = handle_tlbm;
1839 struct label *l = labels; 1813 struct label *l = labels;
1840 struct reloc *r = relocs; 1814 struct reloc *r = relocs;
1841 int i;
1842 1815
1843 memset(handle_tlbm, 0, sizeof(handle_tlbm)); 1816 memset(handle_tlbm, 0, sizeof(handle_tlbm));
1844 memset(labels, 0, sizeof(labels)); 1817 memset(labels, 0, sizeof(labels));
@@ -1863,11 +1836,7 @@ static void __init build_r4000_tlb_modify_handler(void)
1863 pr_info("Synthesized TLB modify handler fastpath (%u instructions).\n", 1836 pr_info("Synthesized TLB modify handler fastpath (%u instructions).\n",
1864 (unsigned int)(p - handle_tlbm)); 1837 (unsigned int)(p - handle_tlbm));
1865 1838
1866 pr_debug("\t.set push\n"); 1839 dump_handler(handle_tlbm, ARRAY_SIZE(handle_tlbm));
1867 pr_debug("\t.set noreorder\n");
1868 for (i = 0; i < (p - handle_tlbm); i++)
1869 pr_debug("\t.word 0x%08x\n", handle_tlbm[i]);
1870 pr_debug("\t.set pop\n");
1871} 1840}
1872 1841
1873void __init build_tlb_refill_handler(void) 1842void __init build_tlb_refill_handler(void)