Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41391
b: refs/heads/master
c: e567988
h: refs/heads/master
i:
  41389: 4152b4f
  41387: d846706
  41383: f1da174
  41375: bbe5985
v: v3
  • Loading branch information
Ralf Baechle committed Nov 30, 2006
1 parent 6475fac commit c17902a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dd6bfd627c4f4df771b9b73e4df75c6c0c177b09
refs/heads/master: e56798824456bd907cefe840ca127df0518942e3
43 changes: 22 additions & 21 deletions trunk/arch/mips/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,19 +399,6 @@ asmlinkage void do_be(struct pt_regs *regs)
force_sig(SIGBUS, current);
}

static inline int get_insn_opcode(struct pt_regs *regs, unsigned int *opcode)
{
unsigned int __user *epc;

epc = (unsigned int __user *) regs->cp0_epc +
((regs->cp0_cause & CAUSEF_BD) != 0);
if (!get_user(*opcode, epc))
return 0;

force_sig(SIGSEGV, current);
return 1;
}

/*
* ll/sc emulation
*/
Expand Down Expand Up @@ -546,8 +533,8 @@ static inline int simulate_llsc(struct pt_regs *regs)
{
unsigned int opcode;

if (unlikely(get_insn_opcode(regs, &opcode)))
return -EFAULT;
if (get_user(opcode, (unsigned int __user *) exception_epc(regs)))
goto out_sigsegv;

if ((opcode & OPCODE) == LL) {
simulate_ll(regs, opcode);
Expand All @@ -559,6 +546,10 @@ static inline int simulate_llsc(struct pt_regs *regs)
}

return -EFAULT; /* Strange things going on ... */

out_sigsegv:
force_sig(SIGSEGV, current);
return -EFAULT;
}

/*
Expand All @@ -571,8 +562,8 @@ static inline int simulate_rdhwr(struct pt_regs *regs)
struct thread_info *ti = task_thread_info(current);
unsigned int opcode;

if (unlikely(get_insn_opcode(regs, &opcode)))
return -EFAULT;
if (get_user(opcode, (unsigned int __user *) exception_epc(regs)))
goto out_sigsegv;

if (unlikely(compute_return_epc(regs)))
return -EFAULT;
Expand All @@ -591,6 +582,10 @@ static inline int simulate_rdhwr(struct pt_regs *regs)

/* Not ours. */
return -EFAULT;

out_sigsegv:
force_sig(SIGSEGV, current);
return -EFAULT;
}

asmlinkage void do_ov(struct pt_regs *regs)
Expand Down Expand Up @@ -676,8 +671,8 @@ asmlinkage void do_bp(struct pt_regs *regs)

die_if_kernel("Break instruction in kernel code", regs);

if (get_insn_opcode(regs, &opcode))
return;
if (get_user(opcode, (unsigned int __user *) exception_epc(regs)))
goto out_sigsegv;

/*
* There is the ancient bug in the MIPS assemblers that the break
Expand Down Expand Up @@ -710,6 +705,9 @@ asmlinkage void do_bp(struct pt_regs *regs)
default:
force_sig(SIGTRAP, current);
}

out_sigsegv:
force_sig(SIGSEGV, current);
}

asmlinkage void do_tr(struct pt_regs *regs)
Expand All @@ -719,8 +717,8 @@ asmlinkage void do_tr(struct pt_regs *regs)

die_if_kernel("Trap instruction in kernel code", regs);

if (get_insn_opcode(regs, &opcode))
return;
if (get_user(opcode, (unsigned int __user *) exception_epc(regs)))
goto out_sigsegv;

/* Immediate versions don't provide a code. */
if (!(opcode & OPCODE))
Expand All @@ -747,6 +745,9 @@ asmlinkage void do_tr(struct pt_regs *regs)
default:
force_sig(SIGTRAP, current);
}

out_sigsegv:
force_sig(SIGSEGV, current);
}

asmlinkage void do_ri(struct pt_regs *regs)
Expand Down

0 comments on commit c17902a

Please sign in to comment.