From owner-p4-projects@FreeBSD.ORG Tue Mar 28 15:21:46 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 747DC16A424; Tue, 28 Mar 2006 15:21:46 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 538E516A422 for ; Tue, 28 Mar 2006 15:21:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E9CF943D48 for ; Tue, 28 Mar 2006 15:21:45 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2SFLjdk033542 for ; Tue, 28 Mar 2006 15:21:45 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2SFLjJE033539 for perforce@freebsd.org; Tue, 28 Mar 2006 15:21:45 GMT (envelope-from jhb@freebsd.org) Date: Tue, 28 Mar 2006 15:21:45 GMT Message-Id: <200603281521.k2SFLjJE033539@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 94171 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Mar 2006 15:21:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=94171 Change 94171 by jhb@jhb_slimer on 2006/03/28 15:21:11 Add an internal (locked) version of linker_file_lookup_symbol(). Affected files ... .. //depot/projects/smpng/sys/kern/kern_linker.c#48 edit .. //depot/projects/smpng/sys/sys/linker.h#18 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_linker.c#48 (text+ko) ==== @@ -635,13 +635,25 @@ caddr_t linker_file_lookup_symbol(linker_file_t file, const char *name, int deps) { + caddr_t sym; + + KLD_LOCK(); + sym = linker_file_lookup_symbol_internal(file, name, deps); + KLD_UNLOCK(); + return (sym); +} + +caddr_t +linker_file_lookup_symbol_internal(linker_file_t file, const char *name, + int deps) +{ c_linker_sym_t sym; linker_symval_t symval; caddr_t address; size_t common_size = 0; int i; - KLD_LOCK(); + KLD_LOCK_ASSERT(); KLD_DPF(SYM, ("linker_file_lookup_symbol: file=%p, name=%s, deps=%d\n", file, name, deps)); @@ -657,7 +669,6 @@ else { KLD_DPF(SYM, ("linker_file_lookup_symbol: symbol" ".value=%p\n", symval.value)); - KLD_UNLOCK(); return (symval.value); } } @@ -668,7 +679,6 @@ if (address) { KLD_DPF(SYM, ("linker_file_lookup_symbol:" " deps value=%p\n", address)); - KLD_UNLOCK(); return (address); } } @@ -685,7 +695,6 @@ if (strcmp(cp->name, name) == 0) { KLD_DPF(SYM, ("linker_file_lookup_symbol:" " old common value=%p\n", cp->address)); - KLD_UNLOCK(); return (cp->address); } } @@ -704,10 +713,8 @@ KLD_DPF(SYM, ("linker_file_lookup_symbol: new common" " value=%p\n", cp->address)); - KLD_UNLOCK(); return (cp->address); } - KLD_UNLOCK(); KLD_DPF(SYM, ("linker_file_lookup_symbol: fail\n")); return (0); } ==== //depot/projects/smpng/sys/sys/linker.h#18 (text+ko) ==== @@ -146,6 +146,8 @@ * Functions soley for use by the linker class handlers. */ int linker_add_class(linker_class_t _cls); +caddr_t linker_file_lookup_symbol_internal(linker_file_t _file, + const char* _name, int _deps); int linker_file_unload_internal(linker_file_t _file, int flags); int linker_load_dependencies(linker_file_t _lf); linker_file_t linker_make_file(const char* _filename, linker_class_t _cls);