module.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. /* FIXME: If module_region == mod->init_region, trim exception
  34. table entries. */
  35. }
  36. /* We don't need anything special. */
  37. int module_frob_arch_sections(Elf_Ehdr *hdr,
  38. Elf_Shdr *sechdrs,
  39. char *secstrings,
  40. struct module *mod)
  41. {
  42. return 0;
  43. }
  44. int apply_relocate(Elf32_Shdr *sechdrs,
  45. const char *strtab,
  46. unsigned int symindex,
  47. unsigned int relsec,
  48. struct module *me)
  49. {
  50. printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
  51. return -ENOEXEC;
  52. }
  53. int apply_relocate_add(Elf32_Shdr *sechdrs,
  54. const char *strtab,
  55. unsigned int symindex,
  56. unsigned int relsec,
  57. struct module *me)
  58. {
  59. printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
  60. return -ENOEXEC;
  61. }
  62. int module_finalize(const Elf_Ehdr *hdr,
  63. const Elf_Shdr *sechdrs,
  64. struct module *me)
  65. {
  66. return 0;
  67. }
  68. void module_arch_cleanup(struct module *mod)
  69. {
  70. }