Date: Thu, 21 Aug 2014 18:56:40 GMT From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r272788 - soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw Message-ID: <201408211856.s7LIueHg040138@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/param.h> + #include <sys/ucred.h> #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 +} +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408211856.s7LIueHg040138>