s390/bpf: encode register within extable entry
Instead of decoding the instruction that faulted to get the register which needs to be zeroed, simply encode its number into the extable entries during code generation. This allows to get rid of a bit of code, and is also what other architectures are doing. Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Tested-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
484a8ed8b7
commit
7fc8c362e7
@ -624,16 +624,8 @@ static int get_probe_mem_regno(const u8 *insn)
|
|||||||
|
|
||||||
bool ex_handler_bpf(const struct exception_table_entry *x, struct pt_regs *regs)
|
bool ex_handler_bpf(const struct exception_table_entry *x, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
int regno;
|
|
||||||
u8 *insn;
|
|
||||||
|
|
||||||
regs->psw.addr = extable_fixup(x);
|
regs->psw.addr = extable_fixup(x);
|
||||||
insn = (u8 *)__rewind_psw(regs->psw, regs->int_code >> 16);
|
regs->gprs[x->data] = 0;
|
||||||
regno = get_probe_mem_regno(insn);
|
|
||||||
if (WARN_ON_ONCE(regno < 0))
|
|
||||||
/* JIT bug - unexpected instruction. */
|
|
||||||
return false;
|
|
||||||
regs->gprs[regno] = 0;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,16 +633,17 @@ static int bpf_jit_probe_mem(struct bpf_jit *jit, struct bpf_prog *fp,
|
|||||||
int probe_prg, int nop_prg)
|
int probe_prg, int nop_prg)
|
||||||
{
|
{
|
||||||
struct exception_table_entry *ex;
|
struct exception_table_entry *ex;
|
||||||
|
int reg, prg;
|
||||||
s64 delta;
|
s64 delta;
|
||||||
u8 *insn;
|
u8 *insn;
|
||||||
int prg;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!fp->aux->extable)
|
if (!fp->aux->extable)
|
||||||
/* Do nothing during early JIT passes. */
|
/* Do nothing during early JIT passes. */
|
||||||
return 0;
|
return 0;
|
||||||
insn = jit->prg_buf + probe_prg;
|
insn = jit->prg_buf + probe_prg;
|
||||||
if (WARN_ON_ONCE(get_probe_mem_regno(insn) < 0))
|
reg = get_probe_mem_regno(insn);
|
||||||
|
if (WARN_ON_ONCE(reg < 0))
|
||||||
/* JIT bug - unexpected probe instruction. */
|
/* JIT bug - unexpected probe instruction. */
|
||||||
return -1;
|
return -1;
|
||||||
if (WARN_ON_ONCE(probe_prg + insn_length(*insn) != nop_prg))
|
if (WARN_ON_ONCE(probe_prg + insn_length(*insn) != nop_prg))
|
||||||
@ -678,6 +671,7 @@ static int bpf_jit_probe_mem(struct bpf_jit *jit, struct bpf_prog *fp,
|
|||||||
return -1;
|
return -1;
|
||||||
ex->fixup = delta;
|
ex->fixup = delta;
|
||||||
ex->type = EX_TYPE_BPF;
|
ex->type = EX_TYPE_BPF;
|
||||||
|
ex->data = reg;
|
||||||
jit->excnt++;
|
jit->excnt++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user