The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/libsa/bootstrap.cpp

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
    5  * 
    6  * This file contains Original Code and/or Modifications of Original Code
    7  * as defined in and that are subject to the Apple Public Source License
    8  * Version 2.0 (the 'License'). You may not use this file except in
    9  * compliance with the License. The rights granted to you under the License
   10  * may not be used to create, or enable the creation or redistribution of,
   11  * unlawful or unlicensed copies of an Apple operating system, or to
   12  * circumvent, violate, or enable the circumvention or violation of, any
   13  * terms of an Apple operating system software license agreement.
   14  * 
   15  * Please obtain a copy of the License at
   16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
   17  * 
   18  * The Original Code and all software distributed under the License are
   19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   23  * Please see the License for the specific language governing rights and
   24  * limitations under the License.
   25  * 
   26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
   27  */
   28 #include <IOKit/IOLib.h>
   29 #include <mach/kmod.h>
   30 #include <libkern/c++/OSDictionary.h>
   31 
   32 #include <libsa/kext.h>
   33 #include <libsa/catalogue.h>
   34 #include <libsa/malloc.h>
   35 
   36 #include "kld_patch.h"
   37 
   38 /*****
   39  * This function is used by IOCatalogue to load a kernel
   40  * extension. libsa initially sets it to be a function
   41  * that uses libkld to load and link the extension from
   42  * within the kernel. Once the root filesystem is up,
   43  * this gets switch to the kmod_load_extension() function,
   44  * which merely queues the extension for loading by the
   45  * kmodload utility.
   46  */
   47 extern kern_return_t (*kmod_load_function)(char *extension_name);
   48 extern bool (*record_startup_extensions_function)(void);
   49 extern bool (*add_from_mkext_function)(OSData * mkext);
   50 extern void (*remove_startup_extension_function)(const char * name);
   51 
   52 /****
   53  * IOCatalogue uses this variable to make a few decisions
   54  * about loading and matching drivers.
   55  */
   56 extern int kernelLinkerPresent;
   57 
   58 
   59 class KLDBootstrap {
   60 public:
   61     KLDBootstrap();
   62     ~KLDBootstrap();
   63 };
   64 
   65 
   66 static KLDBootstrap bootstrap_obj;
   67 
   68 
   69 /* The constructor creates a lock and puts entries into a dispatch
   70  * table for functions used to record and load kmods.
   71  */
   72 KLDBootstrap::KLDBootstrap() {
   73 
   74     malloc_init();
   75 
   76     kmod_load_function = &load_kernel_extension;
   77 
   78     record_startup_extensions_function = &recordStartupExtensions;
   79     add_from_mkext_function = &addExtensionsFromArchive;
   80     remove_startup_extension_function = &removeStartupExtension;
   81 
   82 #ifndef CONFIG_NOKLD
   83     kernelLinkerPresent = 1;
   84 #endif
   85 }
   86 
   87 /* The destructor frees all wired memory regions held
   88  * by libsa's malloc package and disposes of the lock.
   89  */
   90 KLDBootstrap::~KLDBootstrap() {
   91 
   92     kld_file_cleanup_all_resources();
   93 
   94    /* Dump all device-tree entries for boot drivers, and all
   95     * info on startup extensions. The IOCatalogue will now
   96     * get personalities from kextd.
   97     */
   98     clearStartupExtensionsAndLoaderInfo();
   99 
  100    /* Free all temporary malloc memory.
  101     */
  102     malloc_reset();
  103 }

Cache object: dd63a149cdd4d924098ffaf2a6a83281


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.