| To: | linux-mips@linux-mips.org, ralf@linux-mips.org |
|---|---|
| Subject: | [PATCH 1/3] MIPS: Add uasm_i_dsrl_safe() and uasm_i_dsll_safe() to uasm. |
| From: | David Daney <ddaney@caviumnetworks.com> |
| Date: | Wed, 28 Apr 2010 12:16:16 -0700 |
| Cc: | David Daney <ddaney@caviumnetworks.com> |
| In-reply-to: | <1272482178-4712-1-git-send-email-ddaney@caviumnetworks.com> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <1272482178-4712-1-git-send-email-ddaney@caviumnetworks.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
This allows us to clean up the code by not having to explicitly code
checks for shift amounts greater than 32.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
arch/mips/include/asm/uasm.h | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index 11a8b52..697e40c 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -167,6 +167,24 @@ static inline void __cpuinit uasm_l##lb(struct uasm_label
**lab, u32 *addr) \
#define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1)
#define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3)
+static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1,
+ unsigned int a2, unsigned int a3)
+{
+ if (a3 < 32)
+ uasm_i_dsrl(p, a1, a2, a3);
+ else
+ uasm_i_dsrl32(p, a1, a2, a3 - 32);
+}
+
+static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1,
+ unsigned int a2, unsigned int a3)
+{
+ if (a3 < 32)
+ uasm_i_dsll(p, a1, a2, a3);
+ else
+ uasm_i_dsll32(p, a1, a2, a3 - 32);
+}
+
/* Handle relocations. */
struct uasm_reloc {
u32 *addr;
--
1.6.6.1
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 0/3] Check for accesses beyond end of PGD, David Daney |
|---|---|
| Next by Date: | [PATCH 2/3] MIPS: Use uasm_i_ds{r,l}l_safe() instead of uasm_i_ds{r,l}l() in tlbex.c, David Daney |
| Previous by Thread: | Re: [PATCH 3/3] MIPS: Check for accesses beyond the end of the PGD., Ralf Baechle |
| Next by Thread: | Re: [PATCH 1/3] MIPS: Add uasm_i_dsrl_safe() and uasm_i_dsll_safe() to uasm., Ralf Baechle |
| Indexes: | [Date] [Thread] [Top] [All Lists] |