|
|
1.1 ! root 1: /****************************************************************************** ! 2: * Copyright (c) 2004, 2011 IBM Corporation ! 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 <string.h> ! 14: #include <netdriver_int.h> ! 15: #include "virtio-net.h" ! 16: ! 17: extern char __module_start[]; ! 18: extern char __module_end[]; ! 19: extern char __bss_start[]; ! 20: extern char __bss_end[]; ! 21: ! 22: snk_kernel_t *snk_kernel_interface; ! 23: snk_module_t *snk_module_interface; ! 24: ! 25: ! 26: snk_module_t* module_init(snk_kernel_t *snk_kernel_int, pci_config_t *conf) ! 27: { ! 28: long module_size; ! 29: ! 30: module_size = __module_end - __module_start; ! 31: if (module_size >= 0x800000) { ! 32: snk_kernel_int->print("Module size (%llu bytes) is too big!\n", ! 33: module_size); ! 34: return 0; ! 35: } ! 36: ! 37: memset(__bss_start, 0, __bss_end - __bss_start); ! 38: ! 39: snk_kernel_interface = snk_kernel_int; ! 40: snk_module_interface = &virtionet_interface; ! 41: snk_module_interface->link_addr = module_init; ! 42: ! 43: if (snk_kernel_int->version != snk_module_interface->version) ! 44: return 0; ! 45: ! 46: if (vn_module_init_pci(snk_kernel_int, conf)) ! 47: return 0; ! 48: ! 49: return &virtionet_interface; ! 50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.