Skip to content

Commit

Permalink
mips: allow disabling CP1 emulator
Browse files Browse the repository at this point in the history
This saves RAM, obviously.
  • Loading branch information
ReimuNotMoe committed Jul 28, 2023
1 parent efeab84 commit a869cd6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2216,6 +2216,16 @@ config MIPS_FP_SUPPORT

If unsure, say y.

config MIPS_FP_DISABLE_EMULATOR
bool "Disable FPU emulator"
depends on MIPS_FP_SUPPORT
default n
help
If you know that your processor supports all floating point instructions
then you can say y here to shrink the kernel a little (~40KiB on MIPS32).

Don't enable this unless you absolutely know what you're doing.

config CPU_R2300_FPU
bool
depends on MIPS_FP_SUPPORT
Expand Down
8 changes: 8 additions & 0 deletions arch/mips/math-emu/cp1emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,10 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
{
unsigned int rcsr = 0; /* resulting csr */

#ifdef CONFIG_MIPS_FP_DISABLE_EMULATOR
return 0;
#endif

MIPS_FPU_EMU_INC_STATS(cp1xops);

switch (MIPSInst_FMA_FFMT(ir)) {
Expand Down Expand Up @@ -1695,6 +1699,10 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
} rv; /* resulting value */
u64 bits;

#ifdef CONFIG_MIPS_FP_DISABLE_EMULATOR
return 0;
#endif

MIPS_FPU_EMU_INC_STATS(cp1ops);
switch (rfmt = (MIPSInst_FFMT(ir) & 0xf)) {
case s_fmt: { /* 0 */
Expand Down

0 comments on commit a869cd6

Please sign in to comment.