2008-01-29 04:05:38 +08:00
|
|
|
/*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* A small micro-assembler. It is intentionally kept simple, does only
|
|
|
|
* support a subset of instructions, and does not try to hide pipeline
|
|
|
|
* effects like branch delay slots.
|
|
|
|
*
|
2013-01-22 19:59:30 +08:00
|
|
|
* Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer
|
2008-01-29 04:05:38 +08:00
|
|
|
* Copyright (C) 2005, 2007 Maciej W. Rozycki
|
|
|
|
* Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
|
2013-02-06 06:52:01 +08:00
|
|
|
* Copyright (C) 2012, 2013 MIPS Technologies, Inc. All rights reserved.
|
2008-01-29 04:05:38 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
enum fields {
|
|
|
|
RS = 0x001,
|
|
|
|
RT = 0x002,
|
|
|
|
RD = 0x004,
|
|
|
|
RE = 0x008,
|
|
|
|
SIMM = 0x010,
|
|
|
|
UIMM = 0x020,
|
|
|
|
BIMM = 0x040,
|
|
|
|
JIMM = 0x080,
|
|
|
|
FUNC = 0x100,
|
2010-02-19 08:13:03 +08:00
|
|
|
SET = 0x200,
|
2014-11-19 00:24:15 +08:00
|
|
|
SCIMM = 0x400,
|
|
|
|
SIMM9 = 0x800,
|
2008-01-29 04:05:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define OP_MASK 0x3f
|
|
|
|
#define OP_SH 26
|
|
|
|
#define RD_MASK 0x1f
|
|
|
|
#define RD_SH 11
|
|
|
|
#define RE_MASK 0x1f
|
|
|
|
#define RE_SH 6
|
|
|
|
#define IMM_MASK 0xffff
|
|
|
|
#define IMM_SH 0
|
|
|
|
#define JIMM_MASK 0x3ffffff
|
|
|
|
#define JIMM_SH 0
|
|
|
|
#define FUNC_MASK 0x3f
|
|
|
|
#define FUNC_SH 0
|
|
|
|
#define SET_MASK 0x7
|
|
|
|
#define SET_SH 0
|
2014-11-19 00:24:15 +08:00
|
|
|
#define SIMM9_SH 7
|
|
|
|
#define SIMM9_MASK 0x1ff
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
enum opcode {
|
2012-06-20 02:59:29 +08:00
|
|
|
insn_addiu, insn_addu, insn_and, insn_andi, insn_bbit0, insn_bbit1,
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
insn_beq, insn_beql, insn_bgez, insn_bgezl, insn_bgtz, insn_blez,
|
|
|
|
insn_bltz, insn_bltzl, insn_bne, insn_break, insn_cache, insn_cfc1,
|
|
|
|
insn_cfcmsa, insn_ctc1, insn_ctcmsa, insn_daddiu, insn_daddu, insn_ddivu,
|
|
|
|
insn_di, insn_dins, insn_dinsm, insn_dinsu, insn_divu, insn_dmfc0,
|
|
|
|
insn_dmtc0, insn_dmultu, insn_drotr, insn_drotr32, insn_dsbh, insn_dshd,
|
|
|
|
insn_dsll, insn_dsll32, insn_dsllv, insn_dsra, insn_dsra32, insn_dsrav,
|
|
|
|
insn_dsrl, insn_dsrl32, insn_dsrlv, insn_dsubu, insn_eret, insn_ext,
|
|
|
|
insn_ins, insn_j, insn_jal, insn_jalr, insn_jr, insn_lb, insn_lbu,
|
|
|
|
insn_ld, insn_lddir, insn_ldpte, insn_ldx, insn_lh, insn_lhu,
|
|
|
|
insn_ll, insn_lld, insn_lui, insn_lw, insn_lwu, insn_lwx, insn_mfc0,
|
|
|
|
insn_mfhc0, insn_mfhi, insn_mflo, insn_movn, insn_movz, insn_mtc0,
|
|
|
|
insn_mthc0, insn_mthi, insn_mtlo, insn_mul, insn_multu, insn_nor,
|
|
|
|
insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sb,
|
|
|
|
insn_sc, insn_scd, insn_sd, insn_sh, insn_sll, insn_sllv,
|
2018-12-06 02:52:30 +08:00
|
|
|
insn_slt, insn_slti, insn_sltiu, insn_sltu, insn_sra, insn_srav,
|
|
|
|
insn_srl, insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall,
|
|
|
|
insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh,
|
|
|
|
insn_xor, insn_xori, insn_yield,
|
2017-06-14 06:28:43 +08:00
|
|
|
insn_invalid /* insn_invalid must be last */
|
2008-01-29 04:05:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct insn {
|
|
|
|
u32 match;
|
|
|
|
enum fields fields;
|
|
|
|
};
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_rs(u32 arg)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg & ~RS_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
return (arg & RS_MASK) << RS_SH;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_rt(u32 arg)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg & ~RT_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
return (arg & RT_MASK) << RT_SH;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_rd(u32 arg)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg & ~RD_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
return (arg & RD_MASK) << RD_SH;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_re(u32 arg)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg & ~RE_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
return (arg & RE_MASK) << RE_SH;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_simm(s32 arg)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg > 0x7fff || arg < -0x8000,
|
|
|
|
KERN_WARNING "Micro-assembler field overflow\n");
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
return arg & 0xffff;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_uimm(u32 arg)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg & ~IMM_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
return arg & IMM_MASK;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_scimm(u32 arg)
|
2010-02-19 08:13:03 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg & ~SCIMM_MASK,
|
|
|
|
KERN_WARNING "Micro-assembler field overflow\n");
|
2010-02-19 08:13:03 +08:00
|
|
|
|
|
|
|
return (arg & SCIMM_MASK) << SCIMM_SH;
|
|
|
|
}
|
|
|
|
|
2014-11-19 00:24:15 +08:00
|
|
|
static inline u32 build_scimm9(s32 arg)
|
|
|
|
{
|
|
|
|
WARN((arg > 0xff || arg < -0x100),
|
|
|
|
KERN_WARNING "Micro-assembler field overflow\n");
|
|
|
|
|
|
|
|
return (arg & SIMM9_MASK) << SIMM9_SH;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_func(u32 arg)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg & ~FUNC_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
return arg & FUNC_MASK;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline u32 build_set(u32 arg)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2010-12-28 10:18:29 +08:00
|
|
|
WARN(arg & ~SET_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
return arg & SET_MASK;
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static void build_insn(u32 **buf, enum opcode opc, ...);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
#define I_u1u2u3(op) \
|
|
|
|
Ip_u1u2u3(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, a, b, c); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2014-06-23 17:38:44 +08:00
|
|
|
#define I_s3s1s2(op) \
|
|
|
|
Ip_s3s1s2(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, c, a); \
|
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
|
|
|
|
2008-01-29 04:05:38 +08:00
|
|
|
#define I_u2u1u3(op) \
|
|
|
|
Ip_u2u1u3(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, a, c); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2014-04-08 19:47:02 +08:00
|
|
|
#define I_u3u2u1(op) \
|
|
|
|
Ip_u3u2u1(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, c, b, a); \
|
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
|
|
|
|
2008-01-29 04:05:38 +08:00
|
|
|
#define I_u3u1u2(op) \
|
|
|
|
Ip_u3u1u2(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, c, a); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
#define I_u1u2s3(op) \
|
|
|
|
Ip_u1u2s3(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, a, b, c); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
#define I_u2s3u1(op) \
|
|
|
|
Ip_u2s3u1(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, c, a, b); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
#define I_u2u1s3(op) \
|
|
|
|
Ip_u2u1s3(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, a, c); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2009-10-15 03:16:55 +08:00
|
|
|
#define I_u2u1msbu3(op) \
|
|
|
|
Ip_u2u1msbu3(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, a, c+d-1, c); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2009-10-15 03:16:55 +08:00
|
|
|
|
2010-12-22 06:19:10 +08:00
|
|
|
#define I_u2u1msb32u3(op) \
|
|
|
|
Ip_u2u1msbu3(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, a, c+d-33, c); \
|
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
|
|
|
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
#define I_u2u1msb32msb3(op) \
|
|
|
|
Ip_u2u1msbu3(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, a, c+d-33, c-32); \
|
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
|
|
|
|
2013-01-22 19:59:30 +08:00
|
|
|
#define I_u2u1msbdu3(op) \
|
2012-07-13 01:21:31 +08:00
|
|
|
Ip_u2u1msbu3(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, a, d-1, c); \
|
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
|
|
|
|
2008-01-29 04:05:38 +08:00
|
|
|
#define I_u1u2(op) \
|
|
|
|
Ip_u1u2(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, a, b); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2014-03-04 23:12:36 +08:00
|
|
|
#define I_u2u1(op) \
|
|
|
|
Ip_u1u2(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, b, a); \
|
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
|
|
|
|
2008-01-29 04:05:38 +08:00
|
|
|
#define I_u1s2(op) \
|
|
|
|
Ip_u1s2(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, a, b); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
#define I_u1(op) \
|
|
|
|
Ip_u1(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op, a); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
#define I_0(op) \
|
|
|
|
Ip_0(op) \
|
|
|
|
{ \
|
|
|
|
build_insn(buf, insn##op); \
|
2010-07-24 09:41:43 +08:00
|
|
|
} \
|
|
|
|
UASM_EXPORT_SYMBOL(uasm_i##op);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
I_u2u1s3(_addiu)
|
|
|
|
I_u3u1u2(_addu)
|
|
|
|
I_u2u1u3(_andi)
|
|
|
|
I_u3u1u2(_and)
|
|
|
|
I_u1u2s3(_beq)
|
|
|
|
I_u1u2s3(_beql)
|
|
|
|
I_u1s2(_bgez)
|
|
|
|
I_u1s2(_bgezl)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u1s2(_bgtz)
|
|
|
|
I_u1s2(_blez)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u1s2(_bltz)
|
|
|
|
I_u1s2(_bltzl)
|
|
|
|
I_u1u2s3(_bne)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u1(_break)
|
2008-02-19 03:32:49 +08:00
|
|
|
I_u2s3u1(_cache)
|
2016-06-24 00:34:34 +08:00
|
|
|
I_u1u2(_cfc1)
|
2016-06-24 00:34:35 +08:00
|
|
|
I_u2u1(_cfcmsa)
|
2016-06-24 00:34:34 +08:00
|
|
|
I_u1u2(_ctc1)
|
2016-06-24 00:34:35 +08:00
|
|
|
I_u2u1(_ctcmsa)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u1u2(_ddivu)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u1u2u3(_dmfc0)
|
|
|
|
I_u1u2u3(_dmtc0)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u1u2(_dmultu)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2u1s3(_daddiu)
|
|
|
|
I_u3u1u2(_daddu)
|
2016-06-24 00:34:36 +08:00
|
|
|
I_u1(_di);
|
2014-04-08 19:47:06 +08:00
|
|
|
I_u1u2(_divu)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2u1(_dsbh);
|
|
|
|
I_u2u1(_dshd);
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2u1u3(_dsll)
|
|
|
|
I_u2u1u3(_dsll32)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u3u2u1(_dsllv)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2u1u3(_dsra)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2u1u3(_dsra32)
|
|
|
|
I_u3u2u1(_dsrav)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2u1u3(_dsrl)
|
|
|
|
I_u2u1u3(_dsrl32)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u3u2u1(_dsrlv)
|
2009-10-15 03:16:55 +08:00
|
|
|
I_u2u1u3(_drotr)
|
2010-07-24 09:41:41 +08:00
|
|
|
I_u2u1u3(_drotr32)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u3u1u2(_dsubu)
|
|
|
|
I_0(_eret)
|
2012-07-13 01:21:31 +08:00
|
|
|
I_u2u1msbdu3(_ext)
|
|
|
|
I_u2u1msbu3(_ins)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u1(_j)
|
|
|
|
I_u1(_jal)
|
2014-03-16 20:58:05 +08:00
|
|
|
I_u2u1(_jalr)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u1(_jr)
|
2014-04-16 20:49:57 +08:00
|
|
|
I_u2s3u1(_lb)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2s3u1(_lbu)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2s3u1(_ld)
|
2014-04-08 19:47:12 +08:00
|
|
|
I_u2s3u1(_lh)
|
2017-03-15 05:21:40 +08:00
|
|
|
I_u2s3u1(_lhu)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2s3u1(_ll)
|
|
|
|
I_u2s3u1(_lld)
|
|
|
|
I_u1s2(_lui)
|
|
|
|
I_u2s3u1(_lw)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2s3u1(_lwu)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u1u2u3(_mfc0)
|
2014-11-13 23:52:02 +08:00
|
|
|
I_u1u2u3(_mfhc0)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u3u1u2(_movn)
|
|
|
|
I_u3u1u2(_movz)
|
2014-04-08 19:47:07 +08:00
|
|
|
I_u1(_mfhi)
|
2014-04-14 22:42:31 +08:00
|
|
|
I_u1(_mflo)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u1u2u3(_mtc0)
|
2014-11-13 23:52:02 +08:00
|
|
|
I_u1u2u3(_mthc0)
|
2016-06-24 00:34:37 +08:00
|
|
|
I_u1(_mthi)
|
|
|
|
I_u1(_mtlo)
|
2014-04-08 19:47:13 +08:00
|
|
|
I_u3u1u2(_mul)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u1u2(_multu)
|
|
|
|
I_u3u1u2(_nor)
|
2010-03-23 22:54:50 +08:00
|
|
|
I_u3u1u2(_or)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2u1u3(_ori)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_0(_rfe)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2s3u1(_sb)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2s3u1(_sc)
|
|
|
|
I_u2s3u1(_scd)
|
|
|
|
I_u2s3u1(_sd)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2s3u1(_sh)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2u1u3(_sll)
|
2014-04-08 19:47:04 +08:00
|
|
|
I_u3u2u1(_sllv)
|
2014-06-23 17:38:45 +08:00
|
|
|
I_s3s1s2(_slt)
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2u1s3(_slti)
|
2014-04-08 19:47:09 +08:00
|
|
|
I_u2u1s3(_sltiu)
|
2014-04-08 19:47:10 +08:00
|
|
|
I_u3u1u2(_sltu)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2u1u3(_sra)
|
2018-12-06 02:52:30 +08:00
|
|
|
I_u3u2u1(_srav)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u2u1u3(_srl)
|
2014-04-08 19:47:05 +08:00
|
|
|
I_u3u2u1(_srlv)
|
2010-02-11 07:12:46 +08:00
|
|
|
I_u2u1u3(_rotr)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u3u1u2(_subu)
|
|
|
|
I_u2s3u1(_sw)
|
2013-12-24 11:49:45 +08:00
|
|
|
I_u1(_sync)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_0(_tlbp)
|
2010-02-11 07:12:46 +08:00
|
|
|
I_0(_tlbr)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_0(_tlbwi)
|
|
|
|
I_0(_tlbwr)
|
2013-12-24 11:50:35 +08:00
|
|
|
I_u1(_wait);
|
2014-04-08 19:47:11 +08:00
|
|
|
I_u2u1(_wsbh)
|
2008-01-29 04:05:38 +08:00
|
|
|
I_u3u1u2(_xor)
|
|
|
|
I_u2u1u3(_xori)
|
2014-03-04 23:12:36 +08:00
|
|
|
I_u2u1(_yield)
|
2009-10-15 03:16:55 +08:00
|
|
|
I_u2u1msbu3(_dins);
|
2010-12-22 06:19:10 +08:00
|
|
|
I_u2u1msb32u3(_dinsm);
|
MIPS: Add some instructions to uasm.
Follow on patches for eBPF JIT require these additional instructions:
insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
... so, add them.
Sort the insn_* enumeration values alphabetically.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-06-14 06:28:45 +08:00
|
|
|
I_u2u1msb32msb3(_dinsu);
|
2010-02-19 08:13:03 +08:00
|
|
|
I_u1(_syscall);
|
2010-07-24 09:41:42 +08:00
|
|
|
I_u1u2s3(_bbit0);
|
|
|
|
I_u1u2s3(_bbit1);
|
2010-12-28 10:07:56 +08:00
|
|
|
I_u3u1u2(_lwx)
|
|
|
|
I_u3u1u2(_ldx)
|
2016-03-03 09:45:12 +08:00
|
|
|
I_u1u2(_ldpte)
|
|
|
|
I_u2u1u3(_lddir)
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2010-10-08 07:03:53 +08:00
|
|
|
#ifdef CONFIG_CPU_CAVIUM_OCTEON
|
|
|
|
#include <asm/octeon/octeon.h>
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_i_pref(u32 **buf, unsigned int a, signed int b,
|
2010-10-08 07:03:53 +08:00
|
|
|
unsigned int c)
|
|
|
|
{
|
2015-01-15 21:11:13 +08:00
|
|
|
if (CAVIUM_OCTEON_DCACHE_PREFETCH_WAR && a <= 24 && a != 5)
|
2010-10-08 07:03:53 +08:00
|
|
|
/*
|
|
|
|
* As per erratum Core-14449, replace prefetches 0-4,
|
|
|
|
* 6-24 with 'pref 28'.
|
|
|
|
*/
|
|
|
|
build_insn(buf, insn_pref, c, 28, b);
|
|
|
|
else
|
|
|
|
build_insn(buf, insn_pref, c, a, b);
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_i_pref);
|
2010-10-08 07:03:53 +08:00
|
|
|
#else
|
|
|
|
I_u2s3u1(_pref)
|
|
|
|
#endif
|
|
|
|
|
2008-01-29 04:05:38 +08:00
|
|
|
/* Handle labels. */
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_build_label(struct uasm_label **lab, u32 *addr, int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
(*lab)->addr = addr;
|
|
|
|
(*lab)->lab = lid;
|
|
|
|
(*lab)++;
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_build_label);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
int uasm_in_compat_space_p(long addr)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
/* Is this address in 32bit compat space? */
|
MIPS: uasm: Handle low values in uasm_in_compat_space_p()
uasm_in_compat_space_p() determines whether the given value is in the
32-bit compatibility part of the 64-bit address space, i.e. is in 32-bit
sign-extended form, however it only handles the top half of the value
space (corresponding to the kernel compatibility segments in the upper
half of the address space). Since values < 2^31 (corresponding to the
low 2GiB of the address space) can also be handled using 32-bit
instructions (e.g. a LUI and ADDIU) rather than convoluted 64-bit
immediate generation, rewrite it with a cast to check whether the
address matches its 32-bit sign extended form.
This allows UASM_i_LA to be used to generate arbitrary 32-bit immediates
more efficiently on 64-bit CPUs, i.e. more like the li (load immediate)
pseudo-instruction.
For example this code to load the immediate (ST0_EXL | KSU_USER |
ST0_BEV | ST0_KX) into k0 with UASM_i_LA():
lui k0,0x0
dsll k0,k0,0x10
daddiu k0,k0,64
dsll k0,k0,0x10
daddiu k0,k0,146
Changes to this more efficient version:
lui k0,0x40
addiu k0,k0,146
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13778/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-07-08 21:05:26 +08:00
|
|
|
return addr == (int)addr;
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_in_compat_space_p);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static int uasm_rel_highest(long val)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_64BIT
|
|
|
|
return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static int uasm_rel_higher(long val)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_64BIT
|
|
|
|
return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
int uasm_rel_hi(long val)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_rel_hi);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
int uasm_rel_lo(long val)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
return ((val & 0xffff) ^ 0x8000) - 0x8000;
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_rel_lo);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2017-03-31 05:52:15 +08:00
|
|
|
if (!uasm_in_compat_space_p(addr)) {
|
|
|
|
uasm_i_lui(buf, rs, uasm_rel_highest(addr));
|
2008-01-29 04:05:38 +08:00
|
|
|
if (uasm_rel_higher(addr))
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_daddiu(buf, rs, rs, uasm_rel_higher(addr));
|
|
|
|
if (uasm_rel_hi(addr)) {
|
|
|
|
uasm_i_dsll(buf, rs, rs, 16);
|
|
|
|
uasm_i_daddiu(buf, rs, rs,
|
|
|
|
uasm_rel_hi(addr));
|
|
|
|
uasm_i_dsll(buf, rs, rs, 16);
|
2008-01-29 04:05:38 +08:00
|
|
|
} else
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_dsll32(buf, rs, rs, 0);
|
2008-01-29 04:05:38 +08:00
|
|
|
} else
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_lui(buf, rs, uasm_rel_hi(addr));
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(UASM_i_LA_mostly);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void UASM_i_LA(u32 **buf, unsigned int rs, long addr)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_i_LA_mostly(buf, rs, addr);
|
|
|
|
if (uasm_rel_lo(addr)) {
|
|
|
|
if (!uasm_in_compat_space_p(addr))
|
|
|
|
uasm_i_daddiu(buf, rs, rs,
|
|
|
|
uasm_rel_lo(addr));
|
2008-01-29 04:05:38 +08:00
|
|
|
else
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_addiu(buf, rs, rs,
|
|
|
|
uasm_rel_lo(addr));
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(UASM_i_LA);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
/* Handle relocations. */
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
(*rel)->addr = addr;
|
|
|
|
(*rel)->type = R_MIPS_PC16;
|
|
|
|
(*rel)->lab = lid;
|
|
|
|
(*rel)++;
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_r_mips_pc16);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
static inline void __resolve_relocs(struct uasm_reloc *rel,
|
|
|
|
struct uasm_label *lab);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_resolve_relocs(struct uasm_reloc *rel,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
struct uasm_label *lab)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
struct uasm_label *l;
|
|
|
|
|
|
|
|
for (; rel->lab != UASM_LABEL_INVALID; rel++)
|
|
|
|
for (l = lab; l->lab != UASM_LABEL_INVALID; l++)
|
|
|
|
if (rel->lab == l->lab)
|
|
|
|
__resolve_relocs(rel, l);
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_resolve_relocs);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
long off)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
for (; rel->lab != UASM_LABEL_INVALID; rel++)
|
|
|
|
if (rel->addr >= first && rel->addr < end)
|
|
|
|
rel->addr += off;
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_move_relocs);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
long off)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
for (; lab->lab != UASM_LABEL_INVALID; lab++)
|
|
|
|
if (lab->addr >= first && lab->addr < end)
|
|
|
|
lab->addr += off;
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_move_labels);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
u32 *first, u32 *end, u32 *target)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
long off = (long)(target - first);
|
|
|
|
|
|
|
|
memcpy(target, first, (end - first) * sizeof(u32));
|
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_move_relocs(rel, first, end, off);
|
|
|
|
uasm_move_labels(lab, first, end, off);
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_copy_handler);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
int uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
for (; rel->lab != UASM_LABEL_INVALID; rel++) {
|
|
|
|
if (rel->addr == addr
|
|
|
|
&& (rel->type == R_MIPS_PC16
|
|
|
|
|| rel->type == R_MIPS_26))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_insn_has_bdelay);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
|
|
|
/* Convenience functions for labeled branches. */
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_bltz(p, reg, 0);
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_bltz);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_b(u32 **p, struct uasm_reloc **r, int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_b(p, 0);
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_b);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_beq(u32 **p, struct uasm_reloc **r, unsigned int r1,
|
2013-12-24 11:51:39 +08:00
|
|
|
unsigned int r2, int lid)
|
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_beq(p, r1, r2, 0);
|
2013-12-24 11:51:39 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_beq);
|
2013-12-24 11:51:39 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_beqz(p, reg, 0);
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_beqz);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_beqzl(p, reg, 0);
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_beqzl);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
unsigned int reg2, int lid)
|
2008-02-19 03:32:49 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_bne(p, reg1, reg2, 0);
|
2008-02-19 03:32:49 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_bne);
|
2008-02-19 03:32:49 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_bnez(p, reg, 0);
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_bnez);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_bgezl(p, reg, 0);
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_bgezl);
|
2008-01-29 04:05:38 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
int lid)
|
2008-01-29 04:05:38 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_bgez(p, reg, 0);
|
2008-01-29 04:05:38 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_bgez);
|
2010-07-24 09:41:42 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
unsigned int bit, int lid)
|
2010-07-24 09:41:42 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_bbit0(p, reg, bit, 0);
|
2010-07-24 09:41:42 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_bbit0);
|
2010-07-24 09:41:42 +08:00
|
|
|
|
2017-03-31 05:52:15 +08:00
|
|
|
void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg,
|
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings. In any case, they are temporary and harmless.
Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files. MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.
[1] https://lkml.org/lkml/2013/5/20/589
[ralf@linux-mips.org: Folded in Paul's followup fix.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-06-18 21:38:59 +08:00
|
|
|
unsigned int bit, int lid)
|
2010-07-24 09:41:42 +08:00
|
|
|
{
|
|
|
|
uasm_r_mips_pc16(r, *p, lid);
|
2017-03-31 05:52:15 +08:00
|
|
|
uasm_i_bbit1(p, reg, bit, 0);
|
2010-07-24 09:41:42 +08:00
|
|
|
}
|
2017-03-31 05:52:15 +08:00
|
|
|
UASM_EXPORT_SYMBOL(uasm_il_bbit1);
|