binfmt_elf32.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * binfmt_elf32.c: Support 32-bit PPC ELF binaries on Power3 and followons.
  3. * based on the SPARC64 version.
  4. * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com)
  5. * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz)
  6. *
  7. * Copyright (C) 2000,2001 Ken Aaker (kdaaker@rchland.vnet.ibm.com), IBM Corp
  8. * Copyright (C) 2001 Anton Blanchard (anton@au.ibm.com), IBM
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or (at your option) any later version.
  14. */
  15. #define ELF_ARCH EM_PPC
  16. #define ELF_CLASS ELFCLASS32
  17. #define ELF_DATA ELFDATA2MSB;
  18. #include <asm/processor.h>
  19. #include <linux/module.h>
  20. #include <linux/elfcore.h>
  21. #include <linux/compat.h>
  22. #define elf_prstatus elf_prstatus32
  23. struct elf_prstatus32
  24. {
  25. struct elf_siginfo pr_info; /* Info associated with signal */
  26. short pr_cursig; /* Current signal */
  27. unsigned int pr_sigpend; /* Set of pending signals */
  28. unsigned int pr_sighold; /* Set of held signals */
  29. pid_t pr_pid;
  30. pid_t pr_ppid;
  31. pid_t pr_pgrp;
  32. pid_t pr_sid;
  33. struct compat_timeval pr_utime; /* User time */
  34. struct compat_timeval pr_stime; /* System time */
  35. struct compat_timeval pr_cutime; /* Cumulative user time */
  36. struct compat_timeval pr_cstime; /* Cumulative system time */
  37. elf_gregset_t pr_reg; /* General purpose registers. */
  38. int pr_fpvalid; /* True if math co-processor being used. */
  39. };
  40. #define elf_prpsinfo elf_prpsinfo32
  41. struct elf_prpsinfo32
  42. {
  43. char pr_state; /* numeric process state */
  44. char pr_sname; /* char for pr_state */
  45. char pr_zomb; /* zombie */
  46. char pr_nice; /* nice val */
  47. unsigned int pr_flag; /* flags */
  48. u32 pr_uid;
  49. u32 pr_gid;
  50. pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
  51. /* Lots missing */
  52. char pr_fname[16]; /* filename of executable */
  53. char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
  54. };
  55. #include <linux/time.h>
  56. #undef cputime_to_timeval
  57. #define cputime_to_timeval cputime_to_compat_timeval
  58. static __inline__ void
  59. cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
  60. {
  61. unsigned long jiffies = cputime_to_jiffies(cputime);
  62. value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
  63. value->tv_sec = jiffies / HZ;
  64. }
  65. #define init_elf_binfmt init_elf32_binfmt
  66. #include "../../../fs/binfmt_elf.c"