From owner-svn-soc-all@FreeBSD.ORG Tue Aug 12 11:05:17 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 799A7694 for ; Tue, 12 Aug 2014 11:05:17 +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 4C5072C86 for ; Tue, 12 Aug 2014 11:05:17 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7CB5H74004069 for ; Tue, 12 Aug 2014 11:05:17 GMT (envelope-from dpl@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id s7CB5GnX004066 for svn-soc-all@FreeBSD.org; Tue, 12 Aug 2014 11:05:16 GMT (envelope-from dpl@FreeBSD.org) Date: Tue, 12 Aug 2014 11:05:16 GMT Message-Id: <201408121105.s7CB5GnX004066@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: r272267 - 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 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: Tue, 12 Aug 2014 11:05:17 -0000 Author: dpl Date: Tue Aug 12 11:05:16 2014 New Revision: 272267 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272267 Log: Added the pointer to struct types Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc ============================================================================== --- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc Tue Aug 12 10:31:31 2014 (r272266) +++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc Tue Aug 12 11:05:16 2014 (r272267) @@ -116,7 +116,7 @@ // Not pkg-filtering related funcs. Function *printf; - // Used structs + // Used structs. StructType *ifnetTy; StructType *in_addrTy; StructType *ipTy; @@ -129,6 +129,19 @@ StructType *mbufTy; StructType *ucredTy; + // Pointer to structs type. + PointerType *ifnetTy; + PointerType *in_addrTy; + PointerType *ipTy; + PointerType *ip_fw_argsTy; + PointerType *ip_fw_chainTy; + PointerType *ip_fwTy; + PointerType *ip_fw_insnTy; + PointerType *ipfw_dyn_ruleTy; + PointerType *ipfw_insn_ifTy; + PointerType *mbufTy; + PointerType *ucredTy; + // Load the bc for JIT compilation. Module * loadbc(std::string name) @@ -170,12 +183,27 @@ ip_fw_insnTy = mod->getTypeByName("_ip_fw_insn"); ipfw_insn_ifTy = mod->getTypeByName("_ipfw_insn_if"); mbufTy = mod->getTypeByName("mbuf"); -#ifndef __FreeBSD__ - ucredTy = mod->getTypeByName("bsd_ucred"); -#else +#ifdef __FreeBSD__ ucredTy = mod->getTypeByName("ucred"); +#else + ucredTy = mod->getTypeByName("bsd_ucred"); #endif /* __FreeBSD__ */ + // Create Pointer to StructType types. + ipfw_dyn_rulePtrTy = PointerType::get(ipfw_dyn_ruleTy); + ifnetPtrTy = PointerType::get(ifnetTy); + in_addrPtrTy = PointerType::get(in_addrTy); + ipPtrTy = PointerType::get(ipTy); + ip_fw_argsPtrTy = PointerType::get(ip_fw_argsTy); + ip_fw_chainPtrTy = PointerType::get(ip_fw_chainTy); + ip_fwPtrTy = PointerType::get(ip_fwTy); + ip_fw_insnPtrTy = PointerType::get(_ip_fw_insnTy); + ipfw_insn_ifPtrTy = PointerType::get(_ipfw_insn_ifTy); + mbufPtrTy = PointerType::get(mbufTy); +#ifdef __FreeBSD__ + ucredPtrTy = PointerType::get(ucredTy); +#endif + // Allocate vars. match = irb.CreateAlloca(int32Ty); l = irb.CreateAlloca(int32Ty);