From owner-svn-src-all@freebsd.org Wed Dec 23 17:54:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECB6CA5080E; Wed, 23 Dec 2015 17:54:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF9A01EE2; Wed, 23 Dec 2015 17:54:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBNHsJDU018423; Wed, 23 Dec 2015 17:54:19 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBNHsJ6f018422; Wed, 23 Dec 2015 17:54:19 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201512231754.tBNHsJ6f018422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 23 Dec 2015 17:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292663 - head/sys/cddl/dev/fbt/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2015 17:54:21 -0000 Author: andrew Date: Wed Dec 23 17:54:19 2015 New Revision: 292663 URL: https://svnweb.freebsd.org/changeset/base/292663 Log: Be stricter on which functions we can probe with FBT. We now only check the first instruction to see if it's either a pushm with lr, or a sub with sp. The former is the common case, with the latter used with va_args. This removes 12 probes. These are all hand-written assembly, with a few C functions with no stack usage. Submitted by: Howard Su Differential Revision: https://reviews.freebsd.org/D4419 Modified: head/sys/cddl/dev/fbt/arm/fbt_isa.c Modified: head/sys/cddl/dev/fbt/arm/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/arm/fbt_isa.c Wed Dec 23 17:43:55 2015 (r292662) +++ head/sys/cddl/dev/fbt/arm/fbt_isa.c Wed Dec 23 17:54:19 2015 (r292663) @@ -35,6 +35,7 @@ #include #include +#include #include #include "fbt.h" @@ -42,6 +43,7 @@ #define FBT_PUSHM 0xe92d0000 #define FBT_POPM 0xe8bd0000 #define FBT_JUMP 0xea000000 +#define FBT_SUBSP 0xe24dd000 #define FBT_ENTRY "entry" #define FBT_RETURN "return" @@ -111,12 +113,18 @@ fbt_provide_module_function(linker_file_ instr = (uint32_t *)symval->value; limit = (uint32_t *)(symval->value + symval->size); - for (; instr < limit; instr++) - if ((*instr & 0xffff0000) == FBT_PUSHM && - (*instr & 0x4000) != 0) - break; + /* + * va_arg functions has first instruction of + * sub sp, sp, #? + */ + if ((*instr & 0xfffff000) == FBT_SUBSP) + instr++; - if (instr >= limit) + /* + * check if insn is a pushm with LR + */ + if ((*instr & 0xffff0000) != FBT_PUSHM || + (*instr & (1 << LR)) == 0) return (0); fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO);