From owner-svn-soc-all@FreeBSD.ORG Thu Aug 21 18:56:40 2014 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 980E53FB for ; Thu, 21 Aug 2014 18:56:40 +0000 (UTC) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A4A139C5 for ; Thu, 21 Aug 2014 18:56:40 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7LIue2P040140 for ; Thu, 21 Aug 2014 18:56:40 GMT (envelope-from dpl@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id s7LIueHg040138 for svn-soc-all@FreeBSD.org; Thu, 21 Aug 2014 18:56:40 GMT (envelope-from dpl@FreeBSD.org) Date: Thu, 21 Aug 2014 18:56:40 GMT Message-Id: <201408211856.s7LIueHg040138@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to dpl@FreeBSD.org using -f From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r272788 - soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2014 18:56:40 -0000 Author: dpl Date: Thu Aug 21 18:56:39 2014 New Revision: 272788 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272788 Log: Added stuff to bitcode Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.c Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.c ============================================================================== --- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.c Thu Aug 21 18:55:42 2014 (r272787) +++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.c Thu Aug 21 18:56:39 2014 (r272788) @@ -1,7 +1,70 @@ -/* - * This is the file that gets compiled when - * generating bitcode. - */ + #include + #include #define IPFW_RULES_INLINE __unused #include "ip_fw_rules.h" + +// The real function will be compiled and inserted by the JIT. +int ipfw_chk_jit(struct ip_fw_args *args, struct ip_fw_chain *chain); + +// Declarations of some needed structs. +struct mbuf; +struct ifnet; +struct in_addr; +struct ip; +struct ip_fw_args; +struct ip_fw_chain; +struct ip_fw; +struct _ipfw_insn; +struct _ipfw_insn_if; +struct _ipfw_dyn_rule; + +// We should hide this. +#ifndef __FreeBSD__ + struct bsd_ucred; +#else + struct ucred; +#endif + +// Functions used by JIT, external. +int printf(const char * restrict format, ...); +int ipfw_find_rule(struct ip_fw_chain *chain, uint32_t key, uint32_t id); +void crfree(struct ucred *); + + +// This functions only forces the compiler to store the stubs of the functions +// so that they can be used by the JIT-compiled code instead. +// this functions is not to be called anywhere. +void +voidfunction() +{ + struct ip_fw_args arguments; + struct ip_fw_chain chainss; + + #ifndef __FreeBSD__ + struct bsd_ucred user_creds; + #else + struct ucred user_creds; + #endif + + // These two structs are not included. + // We need to do something with them. + struct _ipfw_insn_if insnif; + struct _ipfw_dyn_rule rules; + + struct ip_fw_args *args = &arguments; + struct ip_fw_chain *chain = &chainss; + + ipfw_find_rule(chain, 0, 0); + ipfw_chk_jit(args, chain); + + insnif.o.opcode = 0; + rules.next = &rules; + +#ifdef __FreeBSD__ + struct ucred *ucreds = &user_creds; + + crfree(ucreds); +#endif +} +