Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: Add a few more branch types to the branch emulator.

This plugs in some extra encodings for matching more bsr/bsrf/jsr
branches.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

+11 -6
+11 -6
arch/sh/kernel/traps_32.c
··· 689 689 } 690 690 691 691 #ifdef CONFIG_SH_FPU_EMU 692 - static int emulate_branch(unsigned short inst, struct pt_regs* regs) 692 + static int emulate_branch(unsigned short inst, struct pt_regs *regs) 693 693 { 694 694 /* 695 695 * bfs: 8fxx: PC+=d*2+4; ··· 702 702 * jsr: 4x0b: PC=Rn after PR=PC+4; 703 703 * rts: 000b: PC=PR; 704 704 */ 705 - if ((inst & 0xfd00) == 0x8d00) { 705 + if (((inst & 0xf000) == 0xb000) || /* bsr */ 706 + ((inst & 0xf0ff) == 0x0003) || /* bsrf */ 707 + ((inst & 0xf0ff) == 0x400b)) /* jsr */ 708 + regs->pr = regs->pc + 4; 709 + 710 + if ((inst & 0xfd00) == 0x8d00) { /* bfs, bts */ 706 711 regs->pc += SH_PC_8BIT_OFFSET(inst); 707 712 return 0; 708 713 } 709 714 710 - if ((inst & 0xe000) == 0xa000) { 715 + if ((inst & 0xe000) == 0xa000) { /* bra, bsr */ 711 716 regs->pc += SH_PC_12BIT_OFFSET(inst); 712 717 return 0; 713 718 } 714 719 715 - if ((inst & 0xf0df) == 0x0003) { 720 + if ((inst & 0xf0df) == 0x0003) { /* braf, bsrf */ 716 721 regs->pc += regs->regs[(inst & 0x0f00) >> 8] + 4; 717 722 return 0; 718 723 } 719 724 720 - if ((inst & 0xf0df) == 0x400b) { 725 + if ((inst & 0xf0df) == 0x400b) { /* jmp, jsr */ 721 726 regs->pc = regs->regs[(inst & 0x0f00) >> 8]; 722 727 return 0; 723 728 } 724 729 725 - if ((inst & 0xffff) == 0x000b) { 730 + if ((inst & 0xffff) == 0x000b) { /* rts */ 726 731 regs->pc = regs->pr; 727 732 return 0; 728 733 }