Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Adapt to the new version of sljit@r313.



details:   https://anonhg.NetBSD.org/src/rev/62b7ba4734b8
branches:  trunk
changeset: 345460:62b7ba4734b8
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Sun May 29 17:20:22 2016 +0000

description:
Adapt to the new version of sljit@r313.

diffstat:

 sys/net/bpfjit.c |  226 +++++++++++++++++++++++++++---------------------------
 1 files changed, 113 insertions(+), 113 deletions(-)

diffs (truncated from 724 to 300 lines):

diff -r 8402ab7ce53d -r 62b7ba4734b8 sys/net/bpfjit.c
--- a/sys/net/bpfjit.c  Sun May 29 17:19:01 2016 +0000
+++ b/sys/net/bpfjit.c  Sun May 29 17:20:22 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $        */
+/*     $NetBSD: bpfjit.c,v 1.45 2016/05/29 17:20:22 alnsn Exp $        */
 
 /*-
  * Copyright (c) 2011-2015 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include <sys/cdefs.h>
 #ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.45 2016/05/29 17:20:22 alnsn Exp $");
 #else
-__RCSID("$NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.45 2016/05/29 17:20:22 alnsn Exp $");
 #endif
 
 #include <sys/types.h>
@@ -85,20 +85,20 @@
  * The first argument is reassigned upon entry
  * to a more frequently used buf argument.
  */
-#define BJ_CTX_ARG     SLJIT_SAVED_REG1
-#define BJ_ARGS                SLJIT_SAVED_REG2
+#define BJ_CTX_ARG     SLJIT_S0
+#define BJ_ARGS                SLJIT_S1
 
 /*
  * Permanent register assignments.
  */
-#define BJ_BUF         SLJIT_SAVED_REG1
-//#define BJ_ARGS      SLJIT_SAVED_REG2
-#define BJ_BUFLEN      SLJIT_SAVED_REG3
-#define BJ_AREG                SLJIT_SCRATCH_REG1
-#define BJ_TMP1REG     SLJIT_SCRATCH_REG2
-#define BJ_TMP2REG     SLJIT_SCRATCH_REG3
-#define BJ_XREG                SLJIT_TEMPORARY_EREG1
-#define BJ_TMP3REG     SLJIT_TEMPORARY_EREG2
+#define BJ_BUF         SLJIT_S0
+//#define BJ_ARGS      SLJIT_S1
+#define BJ_BUFLEN      SLJIT_S2
+#define BJ_AREG                SLJIT_R0
+#define BJ_TMP1REG     SLJIT_R1
+#define BJ_TMP2REG     SLJIT_R2
+#define BJ_XREG                SLJIT_R3
+#define BJ_TMP3REG     SLJIT_R4
 
 #ifdef _KERNEL
 #define MAX_MEMWORDS BPF_MAX_MEMWORDS
@@ -248,10 +248,10 @@
  * Return a number of scratch registers to pass
  * to sljit_emit_enter() function.
  */
-static sljit_si
+static sljit_s32
 nscratches(bpfjit_hint_t hints)
 {
-       sljit_si rv = 2;
+       sljit_s32 rv = 2;
 
 #ifdef _KERNEL
        if (hints & BJ_HINT_PKT)
@@ -354,11 +354,11 @@
  * Emit code for BPF_LD+BPF_B+BPF_ABS    A <- P[k:1].
  */
 static int
-emit_read8(struct sljit_compiler *compiler, sljit_si src, uint32_t k)
+emit_read8(struct sljit_compiler *compiler, sljit_s32 src, uint32_t k)
 {
 
        return sljit_emit_op1(compiler,
-           SLJIT_MOV_UB,
+           SLJIT_MOV_U8,
            BJ_AREG, 0,
            SLJIT_MEM1(src), k);
 }
@@ -367,7 +367,7 @@
  * Emit code for BPF_LD+BPF_H+BPF_ABS    A <- P[k:2].
  */
 static int
-emit_read16(struct sljit_compiler *compiler, sljit_si src, uint32_t k)
+emit_read16(struct sljit_compiler *compiler, sljit_s32 src, uint32_t k)
 {
        int status;
 
@@ -375,7 +375,7 @@
 
        /* A = buf[k]; */
        status = sljit_emit_op1(compiler,
-           SLJIT_MOV_UB,
+           SLJIT_MOV_U8,
            BJ_AREG, 0,
            SLJIT_MEM1(src), k);
        if (status != SLJIT_SUCCESS)
@@ -383,7 +383,7 @@
 
        /* tmp1 = buf[k+1]; */
        status = sljit_emit_op1(compiler,
-           SLJIT_MOV_UB,
+           SLJIT_MOV_U8,
            BJ_TMP1REG, 0,
            SLJIT_MEM1(src), k+1);
        if (status != SLJIT_SUCCESS)
@@ -411,7 +411,7 @@
  * Emit code for BPF_LD+BPF_W+BPF_ABS    A <- P[k:4].
  */
 static int
-emit_read32(struct sljit_compiler *compiler, sljit_si src, uint32_t k)
+emit_read32(struct sljit_compiler *compiler, sljit_s32 src, uint32_t k)
 {
        int status;
 
@@ -419,7 +419,7 @@
 
        /* A = buf[k]; */
        status = sljit_emit_op1(compiler,
-           SLJIT_MOV_UB,
+           SLJIT_MOV_U8,
            BJ_AREG, 0,
            SLJIT_MEM1(src), k);
        if (status != SLJIT_SUCCESS)
@@ -427,7 +427,7 @@
 
        /* tmp1 = buf[k+1]; */
        status = sljit_emit_op1(compiler,
-           SLJIT_MOV_UB,
+           SLJIT_MOV_U8,
            BJ_TMP1REG, 0,
            SLJIT_MEM1(src), k+1);
        if (status != SLJIT_SUCCESS)
@@ -453,7 +453,7 @@
 
        /* tmp1 = buf[k+2]; */
        status = sljit_emit_op1(compiler,
-           SLJIT_MOV_UB,
+           SLJIT_MOV_U8,
            BJ_TMP1REG, 0,
            SLJIT_MEM1(src), k+2);
        if (status != SLJIT_SUCCESS)
@@ -479,7 +479,7 @@
 
        /* tmp1 = buf[k+3]; */
        status = sljit_emit_op1(compiler,
-           SLJIT_MOV_UB,
+           SLJIT_MOV_U8,
            BJ_TMP1REG, 0,
            SLJIT_MEM1(src), k+3);
        if (status != SLJIT_SUCCESS)
@@ -522,13 +522,13 @@
     uint32_t (*fn)(const struct mbuf *, uint32_t, int *))
 {
 #if BJ_XREG == SLJIT_RETURN_REG   || \
-    BJ_XREG == SLJIT_SCRATCH_REG1 || \
-    BJ_XREG == SLJIT_SCRATCH_REG2 || \
-    BJ_XREG == SLJIT_SCRATCH_REG3
+    BJ_XREG == SLJIT_R0 || \
+    BJ_XREG == SLJIT_R1 || \
+    BJ_XREG == SLJIT_R2
 #error "Not supported assignment of registers."
 #endif
        struct sljit_jump *jump;
-       sljit_si save_reg;
+       sljit_s32 save_reg;
        int status;
 
        save_reg = (BPF_CLASS(pc->code) == BPF_LDX) ? BJ_AREG : BJ_XREG;
@@ -536,8 +536,8 @@
        if (save_reg == BJ_AREG || (hints & BJ_HINT_XREG)) {
                /* save A or X */
                status = sljit_emit_op1(compiler,
-                   SLJIT_MOV_UI, /* uint32_t destination */
-                   SLJIT_MEM1(SLJIT_LOCALS_REG),
+                   SLJIT_MOV_U32,
+                   SLJIT_MEM1(SLJIT_SP),
                    offsetof(struct bpfjit_stack, reg),
                    save_reg, 0);
                if (status != SLJIT_SUCCESS)
@@ -549,7 +549,7 @@
         */
        status = sljit_emit_op1(compiler,
            SLJIT_MOV,
-           SLJIT_SCRATCH_REG1, 0,
+           SLJIT_R0, 0,
            BJ_BUF, 0);
        if (status != SLJIT_SUCCESS)
                return status;
@@ -559,14 +559,14 @@
                        /* k = X; */
                        status = sljit_emit_op1(compiler,
                            SLJIT_MOV,
-                           SLJIT_SCRATCH_REG2, 0,
+                           SLJIT_R1, 0,
                            BJ_XREG, 0);
                        if (status != SLJIT_SUCCESS)
                                return status;
                } else {
                        /* if (X > UINT32_MAX - pc->k) return 0; */
                        jump = sljit_emit_cmp(compiler,
-                           SLJIT_C_GREATER,
+                           SLJIT_GREATER,
                            BJ_XREG, 0,
                            SLJIT_IMM, UINT32_MAX - pc->k);
                        if (jump == NULL)
@@ -577,7 +577,7 @@
                        /* k = X + pc->k; */
                        status = sljit_emit_op2(compiler,
                            SLJIT_ADD,
-                           SLJIT_SCRATCH_REG2, 0,
+                           SLJIT_R1, 0,
                            BJ_XREG, 0,
                            SLJIT_IMM, (uint32_t)pc->k);
                        if (status != SLJIT_SUCCESS)
@@ -587,7 +587,7 @@
                /* k = pc->k */
                status = sljit_emit_op1(compiler,
                    SLJIT_MOV,
-                   SLJIT_SCRATCH_REG2, 0,
+                   SLJIT_R1, 0,
                    SLJIT_IMM, (uint32_t)pc->k);
                if (status != SLJIT_SUCCESS)
                        return status;
@@ -597,7 +597,7 @@
         * The third argument of fn is an address on stack.
         */
        status = sljit_get_local_base(compiler,
-           SLJIT_SCRATCH_REG3, 0,
+           SLJIT_R2, 0,
            offsetof(struct bpfjit_stack, err));
        if (status != SLJIT_SUCCESS)
                return status;
@@ -621,8 +621,8 @@
 
        /* if (*err != 0) return 0; */
        jump = sljit_emit_cmp(compiler,
-           SLJIT_C_NOT_EQUAL|SLJIT_INT_OP,
-           SLJIT_MEM1(SLJIT_LOCALS_REG),
+           SLJIT_NOT_EQUAL|SLJIT_I32_OP,
+           SLJIT_MEM1(SLJIT_SP),
            offsetof(struct bpfjit_stack, err),
            SLJIT_IMM, 0);
        if (jump == NULL)
@@ -634,9 +634,9 @@
        if (save_reg == BJ_AREG || (hints & BJ_HINT_XREG)) {
                /* restore A or X */
                status = sljit_emit_op1(compiler,
-                   SLJIT_MOV_UI, /* uint32_t source */
+                   SLJIT_MOV_U32,
                    save_reg, 0,
-                   SLJIT_MEM1(SLJIT_LOCALS_REG),
+                   SLJIT_MEM1(SLJIT_SP),
                    offsetof(struct bpfjit_stack, reg));
                if (status != SLJIT_SUCCESS)
                        return status;
@@ -655,17 +655,17 @@
     struct sljit_jump ***ret0, size_t *ret0_size, size_t *ret0_maxsize)
 {
 #if BJ_XREG    == SLJIT_RETURN_REG   || \
-    BJ_XREG    == SLJIT_SCRATCH_REG1 || \
-    BJ_XREG    == SLJIT_SCRATCH_REG2 || \
-    BJ_XREG    == SLJIT_SCRATCH_REG3 || \
-    BJ_TMP3REG == SLJIT_SCRATCH_REG1 || \
-    BJ_TMP3REG == SLJIT_SCRATCH_REG2 || \
-    BJ_TMP3REG == SLJIT_SCRATCH_REG3
+    BJ_XREG    == SLJIT_R0 || \
+    BJ_XREG    == SLJIT_R1 || \
+    BJ_XREG    == SLJIT_R2 || \
+    BJ_TMP3REG == SLJIT_R0 || \
+    BJ_TMP3REG == SLJIT_R1 || \
+    BJ_TMP3REG == SLJIT_R2
 #error "Not supported assignment of registers."
 #endif
 
        struct sljit_jump *jump;
-       sljit_si call_reg;
+       sljit_s32 call_reg;
        sljit_sw call_off;
        int status;
 
@@ -674,8 +674,8 @@
        if (hints & BJ_HINT_LDX) {
                /* save X */
                status = sljit_emit_op1(compiler,
-                   SLJIT_MOV_UI, /* uint32_t destination */
-                   SLJIT_MEM1(SLJIT_LOCALS_REG),
+                   SLJIT_MOV_U32,
+                   SLJIT_MEM1(SLJIT_SP),
                    offsetof(struct bpfjit_stack, reg),
                    BJ_XREG, 0);
                if (status != SLJIT_SUCCESS)
@@ -688,7 +688,7 @@
        } else {
                /* if (X >= bc->nfuncs) return 0; */
                jump = sljit_emit_cmp(compiler,
-                   SLJIT_C_GREATER_EQUAL,
+                   SLJIT_GREATER_EQUAL,
                    BJ_XREG, 0,
                    SLJIT_IMM, bc->nfuncs);



Home | Main Index | Thread Index | Old Index