diff options
author | Michal Simek <michal.simek@xilinx.com> | 2013-11-19 10:20:34 -0500 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2014-01-27 05:26:33 -0500 |
commit | 52ade599e3440d188c20e57c3e34934784f9cb52 (patch) | |
tree | 8455e10479ae74349abc033f0a176a010fe5a416 /arch/microblaze | |
parent | 34b9c07a3b644760159571ee99d0f7fc67b83a8d (diff) |
microblaze: Fix compilation error for BS=0
This bug was introduced by:
"microblaze: Do not used hardcoded value in exception handler"
(sha1: 9f78d3b5ab97a22a7e836312c495804ee4bca4ab)
System without barrel shifter are pretty rare that's why
this bug has been fixed so late.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/kernel/hw_exception_handler.S | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S index fc6b89f4dd31..0b11a4469deb 100644 --- a/arch/microblaze/kernel/hw_exception_handler.S +++ b/arch/microblaze/kernel/hw_exception_handler.S | |||
@@ -147,15 +147,14 @@ | |||
147 | or r3, r0, NUM_TO_REG (regnum); | 147 | or r3, r0, NUM_TO_REG (regnum); |
148 | 148 | ||
149 | /* Shift right instruction depending on available configuration */ | 149 | /* Shift right instruction depending on available configuration */ |
150 | #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0 | 150 | #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL == 0 |
151 | #define BSRLI(rD, rA, imm) \ | ||
152 | bsrli rD, rA, imm | ||
153 | #else | ||
154 | #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA) | ||
155 | /* Only the used shift constants defined here - add more if needed */ | 151 | /* Only the used shift constants defined here - add more if needed */ |
156 | #define BSRLI2(rD, rA) \ | 152 | #define BSRLI2(rD, rA) \ |
157 | srl rD, rA; /* << 1 */ \ | 153 | srl rD, rA; /* << 1 */ \ |
158 | srl rD, rD; /* << 2 */ | 154 | srl rD, rD; /* << 2 */ |
155 | #define BSRLI4(rD, rA) \ | ||
156 | BSRLI2(rD, rA); \ | ||
157 | BSRLI2(rD, rD) | ||
159 | #define BSRLI10(rD, rA) \ | 158 | #define BSRLI10(rD, rA) \ |
160 | srl rD, rA; /* << 1 */ \ | 159 | srl rD, rA; /* << 1 */ \ |
161 | srl rD, rD; /* << 2 */ \ | 160 | srl rD, rD; /* << 2 */ \ |
@@ -170,7 +169,33 @@ | |||
170 | #define BSRLI20(rD, rA) \ | 169 | #define BSRLI20(rD, rA) \ |
171 | BSRLI10(rD, rA); \ | 170 | BSRLI10(rD, rA); \ |
172 | BSRLI10(rD, rD) | 171 | BSRLI10(rD, rD) |
172 | |||
173 | .macro bsrli, rD, rA, IMM | ||
174 | .if (\IMM) == 2 | ||
175 | BSRLI2(\rD, \rA) | ||
176 | .elseif (\IMM) == 10 | ||
177 | BSRLI10(\rD, \rA) | ||
178 | .elseif (\IMM) == 12 | ||
179 | BSRLI2(\rD, \rA) | ||
180 | BSRLI10(\rD, \rD) | ||
181 | .elseif (\IMM) == 14 | ||
182 | BSRLI4(\rD, \rA) | ||
183 | BSRLI10(\rD, \rD) | ||
184 | .elseif (\IMM) == 20 | ||
185 | BSRLI20(\rD, \rA) | ||
186 | .elseif (\IMM) == 24 | ||
187 | BSRLI4(\rD, \rA) | ||
188 | BSRLI20(\rD, \rD) | ||
189 | .elseif (\IMM) == 28 | ||
190 | BSRLI4(\rD, \rA) | ||
191 | BSRLI4(\rD, \rD) | ||
192 | BSRLI20(\rD, \rD) | ||
193 | .else | ||
194 | .error "BSRLI shift macros \IMM" | ||
195 | .endif | ||
196 | .endm | ||
173 | #endif | 197 | #endif |
198 | |||
174 | #endif /* CONFIG_MMU */ | 199 | #endif /* CONFIG_MMU */ |
175 | 200 | ||
176 | .extern other_exception_handler /* Defined in exception.c */ | 201 | .extern other_exception_handler /* Defined in exception.c */ |
@@ -604,7 +629,7 @@ ex_handler_done: | |||
604 | ex4: | 629 | ex4: |
605 | tophys(r4,r4) | 630 | tophys(r4,r4) |
606 | /* Create L1 (pgdir/pmd) address */ | 631 | /* Create L1 (pgdir/pmd) address */ |
607 | BSRLI(r5,r3, PGDIR_SHIFT - 2) | 632 | bsrli r5, r3, PGDIR_SHIFT - 2 |
608 | andi r5, r5, PAGE_SIZE - 4 | 633 | andi r5, r5, PAGE_SIZE - 4 |
609 | /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ | 634 | /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ |
610 | or r4, r4, r5 | 635 | or r4, r4, r5 |
@@ -613,7 +638,7 @@ ex_handler_done: | |||
613 | beqi r5, ex2 /* Bail if no table */ | 638 | beqi r5, ex2 /* Bail if no table */ |
614 | 639 | ||
615 | tophys(r5,r5) | 640 | tophys(r5,r5) |
616 | BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ | 641 | bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ |
617 | andi r6, r6, PAGE_SIZE - 4 | 642 | andi r6, r6, PAGE_SIZE - 4 |
618 | or r5, r5, r6 | 643 | or r5, r5, r6 |
619 | lwi r4, r5, 0 /* Get Linux PTE */ | 644 | lwi r4, r5, 0 /* Get Linux PTE */ |
@@ -705,7 +730,7 @@ ex_handler_done: | |||
705 | ex6: | 730 | ex6: |
706 | tophys(r4,r4) | 731 | tophys(r4,r4) |
707 | /* Create L1 (pgdir/pmd) address */ | 732 | /* Create L1 (pgdir/pmd) address */ |
708 | BSRLI(r5,r3, PGDIR_SHIFT - 2) | 733 | bsrli r5, r3, PGDIR_SHIFT - 2 |
709 | andi r5, r5, PAGE_SIZE - 4 | 734 | andi r5, r5, PAGE_SIZE - 4 |
710 | /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ | 735 | /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ |
711 | or r4, r4, r5 | 736 | or r4, r4, r5 |
@@ -714,7 +739,7 @@ ex_handler_done: | |||
714 | beqi r5, ex7 /* Bail if no table */ | 739 | beqi r5, ex7 /* Bail if no table */ |
715 | 740 | ||
716 | tophys(r5,r5) | 741 | tophys(r5,r5) |
717 | BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ | 742 | bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ |
718 | andi r6, r6, PAGE_SIZE - 4 | 743 | andi r6, r6, PAGE_SIZE - 4 |
719 | or r5, r5, r6 | 744 | or r5, r5, r6 |
720 | lwi r4, r5, 0 /* Get Linux PTE */ | 745 | lwi r4, r5, 0 /* Get Linux PTE */ |
@@ -776,7 +801,7 @@ ex_handler_done: | |||
776 | ex9: | 801 | ex9: |
777 | tophys(r4,r4) | 802 | tophys(r4,r4) |
778 | /* Create L1 (pgdir/pmd) address */ | 803 | /* Create L1 (pgdir/pmd) address */ |
779 | BSRLI(r5,r3, PGDIR_SHIFT - 2) | 804 | bsrli r5, r3, PGDIR_SHIFT - 2 |
780 | andi r5, r5, PAGE_SIZE - 4 | 805 | andi r5, r5, PAGE_SIZE - 4 |
781 | /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ | 806 | /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ |
782 | or r4, r4, r5 | 807 | or r4, r4, r5 |
@@ -785,7 +810,7 @@ ex_handler_done: | |||
785 | beqi r5, ex10 /* Bail if no table */ | 810 | beqi r5, ex10 /* Bail if no table */ |
786 | 811 | ||
787 | tophys(r5,r5) | 812 | tophys(r5,r5) |
788 | BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ | 813 | bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ |
789 | andi r6, r6, PAGE_SIZE - 4 | 814 | andi r6, r6, PAGE_SIZE - 4 |
790 | or r5, r5, r6 | 815 | or r5, r5, r6 |
791 | lwi r4, r5, 0 /* Get Linux PTE */ | 816 | lwi r4, r5, 0 /* Get Linux PTE */ |
@@ -922,7 +947,7 @@ ex_handler_done: | |||
922 | .ent _unaligned_data_exception | 947 | .ent _unaligned_data_exception |
923 | _unaligned_data_exception: | 948 | _unaligned_data_exception: |
924 | andi r8, r3, 0x3E0; /* Mask and extract the register operand */ | 949 | andi r8, r3, 0x3E0; /* Mask and extract the register operand */ |
925 | BSRLI(r8,r8,2); /* r8 >> 2 = register operand * 8 */ | 950 | bsrli r8, r8, 2; /* r8 >> 2 = register operand * 8 */ |
926 | andi r6, r3, 0x400; /* Extract ESR[S] */ | 951 | andi r6, r3, 0x400; /* Extract ESR[S] */ |
927 | bneid r6, ex_sw_vm; | 952 | bneid r6, ex_sw_vm; |
928 | andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */ | 953 | andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */ |