Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Review some SLJIT_MOV instructions with respect to w...
details: https://anonhg.NetBSD.org/src/rev/c31912f3196d
branches: trunk
changeset: 797090:c31912f3196d
user: alnsn <alnsn%NetBSD.org@localhost>
date: Sat Jul 05 11:13:13 2014 +0000
description:
Review some SLJIT_MOV instructions with respect to width.
diffstat:
sys/net/bpfjit.c | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
diffs (111 lines):
diff -r 4c17557241ac -r c31912f3196d sys/net/bpfjit.c
--- a/sys/net/bpfjit.c Sat Jul 05 11:13:12 2014 +0000
+++ b/sys/net/bpfjit.c Sat Jul 05 11:13:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpfjit.c,v 1.20 2014/07/04 21:32:08 alnsn Exp $ */
+/* $NetBSD: bpfjit.c,v 1.21 2014/07/05 11:13:13 alnsn Exp $ */
/*-
* Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
#include <sys/cdefs.h>
#ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.20 2014/07/04 21:32:08 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.21 2014/07/05 11:13:13 alnsn Exp $");
#else
-__RCSID("$NetBSD: bpfjit.c,v 1.20 2014/07/04 21:32:08 alnsn Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.21 2014/07/05 11:13:13 alnsn Exp $");
#endif
#include <sys/types.h>
@@ -140,7 +140,7 @@
bpf_ctx_t *ctx;
uint32_t *extmem; /* pointer to external memory store */
#ifdef _KERNEL
- void *tmp;
+ int err; /* 3rd argument for m_xword/m_xhalf/m_xbyte function call */
#endif
uint32_t mem[BPF_MEMWORDS]; /* internal memory store */
};
@@ -243,7 +243,7 @@
#endif
/*
- * Return a number of scratch regiters to pass
+ * Return a number of scratch registers to pass
* to sljit_emit_enter() function.
*/
static sljit_si
@@ -303,7 +303,7 @@
return status;
status = sljit_emit_op1(compiler,
- SLJIT_MOV,
+ SLJIT_MOV, /* size_t source */
BJ_BUFLEN, 0,
SLJIT_MEM1(BJ_ARGS),
offsetof(struct bpf_args, buflen));
@@ -525,11 +525,6 @@
#endif
int status;
- /*
- * The third argument of fn is an address on stack.
- */
- const int arg3_offset = offsetof(struct bpfjit_stack, tmp);
-
if (BPF_CLASS(pc->code) == BPF_LDX) {
/* save A */
status = sljit_emit_op1(compiler,
@@ -566,8 +561,12 @@
if (status != SLJIT_SUCCESS)
return status;
+ /*
+ * The third argument of fn is an address on stack.
+ */
status = sljit_get_local_base(compiler,
- SLJIT_SCRATCH_REG3, 0, arg3_offset);
+ SLJIT_SCRATCH_REG3, 0,
+ offsetof(struct bpfjit_stack, err));
if (status != SLJIT_SUCCESS)
return status;
@@ -600,7 +599,8 @@
status = sljit_emit_op1(compiler,
SLJIT_MOV_UI,
SLJIT_SCRATCH_REG3, 0,
- SLJIT_MEM1(SLJIT_LOCALS_REG), arg3_offset);
+ SLJIT_MEM1(SLJIT_LOCALS_REG),
+ offsetof(struct bpfjit_stack, err));
if (status != SLJIT_SUCCESS)
return status;
@@ -700,7 +700,7 @@
* memory addressing.
*/
status = sljit_emit_op1(compiler,
- SLJIT_MOV_P,
+ SLJIT_MOV,
BJ_COPF_IDX, 0,
BJ_XREG, 0);
if (status != SLJIT_SUCCESS)
@@ -1708,7 +1708,7 @@
/* BPF_LD+BPF_W+BPF_LEN A <- len */
if (pc->code == (BPF_LD|BPF_W|BPF_LEN)) {
status = sljit_emit_op1(compiler,
- SLJIT_MOV,
+ SLJIT_MOV, /* size_t source */
BJ_AREG, 0,
SLJIT_MEM1(BJ_ARGS),
offsetof(struct bpf_args, wirelen));
@@ -1754,7 +1754,7 @@
if (BPF_SIZE(pc->code) != BPF_W)
goto fail;
status = sljit_emit_op1(compiler,
- SLJIT_MOV,
+ SLJIT_MOV, /* size_t source */
BJ_XREG, 0,
SLJIT_MEM1(BJ_ARGS),
offsetof(struct bpf_args, wirelen));
Home |
Main Index |
Thread Index |
Old Index