Skip to content

Commit

Permalink
Replace the nsaveds() function with #define NSAVEDS 3. No functional …
Browse files Browse the repository at this point in the history
…change.

Patch from Michael McConville.
  • Loading branch information
alnsn committed Dec 29, 2015
1 parent bcf085d commit 3f73e0b
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions sys/net/bpfjit.c
@@ -1,4 +1,4 @@
/* $NetBSD: bpfjit.c,v 1.43 2015/02/14 21:32:46 alnsn Exp $ */
/* $NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $ */

/*-
* Copyright (c) 2011-2015 Alexander Nasonov.
Expand Down Expand Up @@ -31,9 +31,9 @@

#include <sys/cdefs.h>
#ifdef _KERNEL
__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.43 2015/02/14 21:32:46 alnsn Exp $");
__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $");
#else
__RCSID("$NetBSD: bpfjit.c,v 1.43 2015/02/14 21:32:46 alnsn Exp $");
__RCSID("$NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $");
#endif

#include <sys/types.h>
Expand Down Expand Up @@ -75,6 +75,11 @@ __RCSID("$NetBSD: bpfjit.c,v 1.43 2015/02/14 21:32:46 alnsn Exp $");
#include <stdio.h> /* for stderr */
#endif

/*
* Number of saved registers to pass to sljit_emit_enter() function.
*/
#define NSAVEDS 3

/*
* Arguments of generated bpfjit_func_t.
* The first argument is reassigned upon entry
Expand Down Expand Up @@ -273,18 +278,6 @@ nscratches(bpfjit_hint_t hints)
return rv;
}

/*
* Return a number of saved registers to pass
* to sljit_emit_enter() function.
*/
static sljit_si
nsaveds(bpfjit_hint_t hints)
{
sljit_si rv = 3;

return rv;
}

static uint32_t
read_width(const struct bpf_insn *pc)
{
Expand Down Expand Up @@ -2192,7 +2185,7 @@ bpfjit_generate_code(const bpf_ctx_t *bc,
#endif

status = sljit_emit_enter(compiler,
2, nscratches(hints), nsaveds(hints), sizeof(struct bpfjit_stack));
2, nscratches(hints), NSAVEDS, sizeof(struct bpfjit_stack));
if (status != SLJIT_SUCCESS)
goto fail;

Expand Down

0 comments on commit 3f73e0b

Please sign in to comment.