Skip to content

Commit

Permalink
MIPS: uasm: Add option to export uasm API.
Browse files Browse the repository at this point in the history
A 'select EXPORT_UASM' in Kconfig will cause the uasm to be exported
for use in modules.  When it is exported, all the uasm data and code
cease to be __init and __initdata.

Also daddiu_bug cannot be __cpuinitdata if uasm is exported.  The
cleanest thing is to just make it normal data.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: wim@iguana.be
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/1500/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
David Daney authored and Ralf Baechle committed Aug 5, 2010
1 parent 5b97c3f commit 22b0763
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 63 deletions.
3 changes: 3 additions & 0 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,9 @@ config CPU_LITTLE_ENDIAN

endchoice

config EXPORT_UASM
bool

config SYS_SUPPORTS_APM_EMULATION
bool

Expand Down
37 changes: 24 additions & 13 deletions arch/mips/include/asm/uasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,55 @@

#include <linux/types.h>

#ifdef CONFIG_EXPORT_UASM
#include <linux/module.h>
#define __uasminit
#define __uasminitdata
#define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym)
#else
#define __uasminit __cpuinit
#define __uasminitdata __cpuinitdata
#define UASM_EXPORT_SYMBOL(sym)
#endif

#define Ip_u1u2u3(op) \
void __cpuinit \
void __uasminit \
uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)

#define Ip_u2u1u3(op) \
void __cpuinit \
void __uasminit \
uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)

#define Ip_u3u1u2(op) \
void __cpuinit \
void __uasminit \
uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)

#define Ip_u1u2s3(op) \
void __cpuinit \
void __uasminit \
uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)

#define Ip_u2s3u1(op) \
void __cpuinit \
void __uasminit \
uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c)

#define Ip_u2u1s3(op) \
void __cpuinit \
void __uasminit \
uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)

#define Ip_u2u1msbu3(op) \
void __cpuinit \
void __uasminit \
uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
unsigned int d)

#define Ip_u1u2(op) \
void __cpuinit uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
void __uasminit uasm_i##op(u32 **buf, unsigned int a, unsigned int b)

#define Ip_u1s2(op) \
void __cpuinit uasm_i##op(u32 **buf, unsigned int a, signed int b)
void __uasminit uasm_i##op(u32 **buf, unsigned int a, signed int b)

#define Ip_u1(op) void __cpuinit uasm_i##op(u32 **buf, unsigned int a)
#define Ip_u1(op) void __uasminit uasm_i##op(u32 **buf, unsigned int a)

#define Ip_0(op) void __cpuinit uasm_i##op(u32 **buf)
#define Ip_0(op) void __uasminit uasm_i##op(u32 **buf)

Ip_u2u1s3(_addiu);
Ip_u3u1u2(_addu);
Expand Down Expand Up @@ -112,7 +123,7 @@ struct uasm_label {
int lab;
};

void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid);
void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid);
#ifdef CONFIG_64BIT
int uasm_in_compat_space_p(long addr);
#endif
Expand All @@ -122,7 +133,7 @@ void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr);
void UASM_i_LA(u32 **buf, unsigned int rs, long addr);

#define UASM_L_LA(lb) \
static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
{ \
uasm_build_label(lab, addr, label##lb); \
}
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/cpu-bugs64.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static inline void check_daddi(void)
panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
}

int daddiu_bug __cpuinitdata = -1;
int daddiu_bug = -1;

static inline void check_daddiu(void)
{
Expand Down
Loading

0 comments on commit 22b0763

Please sign in to comment.