Annotation of qemu/roms/SLOF/other-licence/common/module_entry.c, revision 1.1.1.2

1.1       root        1: /******************************************************************************
1.1.1.2 ! root        2:  * Copyright (c) 2004, 2011 IBM Corporation
1.1       root        3:  * All rights reserved.
                      4:  * This program and the accompanying materials
                      5:  * are made available under the terms of the BSD License
                      6:  * which accompanies this distribution, and is available at
                      7:  * http://www.opensource.org/licenses/bsd-license.php
                      8:  *
                      9:  * Contributors:
                     10:  *     IBM Corporation - initial implementation
                     11:  *****************************************************************************/
                     12: 
                     13: #include "netdriver_int.h"
                     14: 
                     15: extern snk_module_t snk_module_interface;
                     16: 
                     17: snk_kernel_t *snk_kernel_interface = 0;
                     18: 
                     19: extern int
                     20: check_driver( pci_config_t *pci_conf );
                     21: 
                     22: 
                     23: static void*
                     24: memset( void *dest, int c, size_t n )
                     25: {
                     26:        while( n-- ) {
                     27:                *( char * ) dest++ = ( char ) c;
                     28:        }
                     29:        return dest;
                     30: }
                     31: 
                     32: 
1.1.1.2 ! root       33: extern char __module_start[];
        !            34: extern char __module_end[];
        !            35: extern char __bss_start[];
        !            36: extern char __bss_end[];
1.1       root       37: 
                     38: snk_module_t*
                     39: module_init(snk_kernel_t *snk_kernel_int, pci_config_t *pciconf)
                     40: {
1.1.1.2 ! root       41:        long module_size;
        !            42: 
        !            43:        module_size = __module_end - __module_start;
        !            44:        if (module_size >= 0x800000) {
        !            45:                snk_kernel_int->print("Module size (%llu bytes) is too big!\n",
        !            46:                                      module_size);
1.1       root       47:                return 0;
                     48:        }
                     49: 
1.1.1.2 ! root       50:        memset(__bss_start, 0, __bss_end - __bss_start);
1.1       root       51: 
                     52:        if (snk_kernel_int->version != snk_module_interface.version) {
                     53:                return 0;
                     54:        }
                     55: 
                     56:        snk_kernel_interface = snk_kernel_int;
                     57: 
                     58:        /* Check if this is the right driver */
                     59:        if (check_driver(pciconf) < 0) {
                     60:                return 0;
                     61:        }
                     62: 
                     63:        snk_module_interface.link_addr = module_init;
                     64:        return &snk_module_interface;
                     65: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.