module.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* module.c: FRV specific module loading bits
  2. *
  3. * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. * - Derived from arch/i386/kernel/module.c, Copyright (C) 2001 Rusty Russell.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #include <linux/moduleloader.h>
  13. #include <linux/elf.h>
  14. #include <linux/vmalloc.h>
  15. #include <linux/fs.h>
  16. #include <linux/string.h>
  17. #include <linux/kernel.h>
  18. #if 0
  19. #define DEBUGP printk
  20. #else
  21. #define DEBUGP(fmt...)
  22. #endif
  23. void *module_alloc(unsigned long size)
  24. {
  25. if (size == 0)
  26. return NULL;
  27. return vmalloc_exec(size);
  28. }
  29. /* Free memory returned from module_alloc */
  30. void module_free(struct module *mod, void *module_region)
  31. {
  32. vfree(module_region);
  33. }
  34. /* We don't need anything special. */
  35. int module_frob_arch_sections(Elf_Ehdr *hdr,
  36. Elf_Shdr *sechdrs,
  37. char *secstrings,
  38. struct module *mod)
  39. {
  40. return 0;
  41. }
  42. int apply_relocate(Elf32_Shdr *sechdrs,
  43. const char *strtab,
  44. unsigned int symindex,
  45. unsigned int relsec,
  46. struct module *me)
  47. {
  48. printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
  49. return -ENOEXEC;
  50. }
  51. int apply_relocate_add(Elf32_Shdr *sechdrs,
  52. const char *strtab,
  53. unsigned int symindex,
  54. unsigned int relsec,
  55. struct module *me)
  56. {
  57. printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
  58. return -ENOEXEC;
  59. }
  60. int module_finalize(const Elf_Ehdr *hdr,
  61. const Elf_Shdr *sechdrs,
  62. struct module *me)
  63. {
  64. return 0;
  65. }
  66. void module_arch_cleanup(struct module *mod)
  67. {
  68. }